Initial support for ImgTec PWM DAC and PDM DAC
Subsystems (3)
v5 cover Initial support for ImgTec PWM DAC and PDM DAC
The Pistachio SOC from Imagination Technologies includes – 4x PDM blocks and 1x “basic PWM� block with four output channels. These share 4 MFIO pins, each PWM channel being muxed with each PDM block output (0-3 muxed with 0-3) using the CR_PERIP_PWM_PDM_CONTROL register in the peripheral wrapper register bank (offset 0x140). The PDM and PWM outputs are used to control targets such as LCD backlight.
The PWM driver uses Linux PWM framework. Since the PDM does not fit into PWM framework we have implemented it as a MISC driver.
The series is based on v3.18-rc5.
Changes from v4:
* Removed CR_prefix from the defined macros.
* Folded same data type varibles in one line.
* Removed cr-periph property from PWM DT binding document.
* Removed regmap_update_bits from img_pwm_enable and img_pwm_disable functions.
* Addressed few more comments given in v4.
Changes from v3:
* Addressed couple of comments given in v3.
Changes from v2:
* Added depends on MIPS || COMPILE_TEST.
* Corrected the logic while calculating time base steps.
* Addressed few other minor comments given in v2.
Changes from v1:
* Used regmap_update_bits at some places in the driver.
* Placed some #defines next to their register.
* Added depends on HAS_IOMEM in Kconfig.
* Removed unnecessary paragraph from file header.
* Defined register masks in a readable way.
* Renamed clk-names with clock-names.
* Added system interface clock in DT binding document.
* Addressed few other minor review comments given in v1.
Naidu Tellapati (4):
pwm: Imagination Technologies PWM DAC driver
DT: pwm: Add binding document for IMG PWM DAC
pdm: Imagination Technologies PDM DAC driver
DT: pdm: Add binding document for IMG PDM DAC
Documentation/devicetree/bindings/misc/img-pdm.txt | 54 ++ Documentation/devicetree/bindings/pwm/img-pwm.txt | 21 + drivers/misc/Kconfig | 16 + drivers/misc/Makefile | 1 + drivers/misc/img-pdm.c | 653 ++++++++++++++++++++ drivers/pwm/Kconfig | 12 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-img.c | 240 +++++++ include/linux/img_pdm.h | 52 ++ 9 files changed, 1050 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/misc/img-pdm.txt create mode 100644 Documentation/devicetree/bindings/pwm/img-pwm.txt create mode 100644 drivers/misc/img-pdm.c create mode 100644 drivers/pwm/pwm-img.c create mode 100644 include/linux/img_pdm.h
PATCH v5 1/4 pwm: Imagination Technologies PWM DAC driver
The Pistachio SOC from Imagination Technologies includes a Pulse Width Modulation DAC which produces 1 to 4 digital bit-outputs which represent digital waveforms. These PWM outputs are primarily in charge of controlling backlight LED devices
--- drivers/pwm/Kconfig | 12 +++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-img.c | 240 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 253 insertions(+), 0 deletions(-) create mode 100644 drivers/pwm/pwm-img.c
drivers/pwm/Kconfig +12 -0
@@ -110,6 +110,18 @@ config PWM_FSL_FTM To compile this driver as a module, choose M here: the module will be called pwm-fsl-ftm. +config PWM_IMG + tristate "Imagination Technologies PWM driver" + depends on HAS_IOMEM + depends on COMMON_CLK + depends on MIPS || COMPILE_TEST + help + Generic PWM framework driver for Imagination Technologies + PWM block which supports 4 channels. + + To compile this driver as a module, choose M here: the module + will be called pwm-img. + config PWM_IMX tristate "i.MX PWM support" depends on ARCH_MXC
drivers/pwm/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_PWM_BFIN) += pwm-bfin.o obj-$(CONFIG_PWM_CLPS711X) += pwm-clps711x.o obj-$(CONFIG_PWM_EP93XX) += pwm-ep93xx.o obj-$(CONFIG_PWM_FSL_FTM) += pwm-fsl-ftm.o +obj-$(CONFIG_PWM_IMG) += pwm-img.o obj-$(CONFIG_PWM_IMX) += pwm-imx.o obj-$(CONFIG_PWM_JZ4740) += pwm-jz4740.o obj-$(CONFIG_PWM_LP3943) += pwm-lp3943.o
drivers/pwm/pwm-img.c new file +240 -0
240 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v5 2/4 DT: pwm: Add binding document for IMG PWM DAC
In reply to Naidu TellapatiAdd binding document for IMG Pulse Width Modulator (PWM) DAC present on the Pistachio SOC. The PWM DAC has four channels.
---
No changes from v4.
--- Documentation/devicetree/bindings/pwm/img-pwm.txt | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/pwm/img-pwm.txt
Documentation/devicetree/bindings/pwm/img-pwm.txt new file +21 -0
@@ -0,0 +1,21 @@ +*Imagination Technologies PWM DAC driver + +Required properties: + - compatible: Should be "img,pistachio-pwm" + - reg: Should contain physical base address and length of pwm registers. + - clocks: Must contain an entry for each entry in clock-names. + See ../clock/clock-bindings.txt for details. + - clock-names: Must include the following entries: + - pwm: PWM operating clock. + - sys: PWM system interface clock. + - #pwm-cells: Should be 2. See pwm.txt in this directory for the + description of the cells format. + +Example: + pwm: pwm@18101300 { + compatible = "img,pistachio-pwm"; + reg = <0x18101300 0x100>; + clocks = <&pwm_clk>, <&system_clk>; + clock-names = "pwm", "sys"; + #pwm-cells = <2>; + };
Signature · 1 line
1.7.0.4
PATCH v5 3/4 pdm: Imagination Technologies PDM DAC driver
In reply to Naidu TellapatiThe Pistachio SOC from Imagination Technologies includes a Pulse Density Modulation DAC which produces a form of analogue output according to the relative density of output pulses to the intended analogue signal amplitude. Four PDM outputs are provided that can be used to control targets such as LCD backlight.
--- drivers/misc/Kconfig | 16 ++ drivers/misc/Makefile | 1 + drivers/misc/img-pdm.c | 653 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/img_pdm.h | 52 ++++ 4 files changed, 722 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/img-pdm.c create mode 100644 include/linux/img_pdm.h
drivers/misc/Kconfig +16 -0
@@ -515,6 +515,22 @@ config VEXPRESS_SYSCFG bus. System Configuration interface is one of the possible means of generating transactions on this bus. +config IMG_PDM + tristate "Imagination Technologies PDM driver" + depends on HAS_IOMEM + depends on MFD_SYSCON + depends on COMMON_CLK + depends on MIPS || COMPILE_TEST + + help + PDM driver for Imagination Technologies PDM block which supports 4 + blocks. + + To compile this driver as a module, choose M here: the module will + be called img-pdm. + + + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
@@ -56,3 +56,4 @@ obj-$(CONFIG_GENWQE) += genwqe/ obj-$(CONFIG_ECHO) += echo/ obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o obj-$(CONFIG_CXL_BASE) += cxl/ +obj-$(CONFIG_IMG_PDM) += img-pdm.o
drivers/misc/img-pdm.c new file +653 -0
653 lines not on this page · raw message
include/linux/img_pdm.h new file +52 -0
52 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v5 4/4 DT: pdm: Add binding document for IMG PDM DAC
In reply to Naidu TellapatiAdd binding document for the Pulse Density Modulator (PDM) DAC present on the Pistachio SOC.
--- Documentation/devicetree/bindings/misc/img-pdm.txt | 54 ++++++++++++++++++++ 1 files changed, 54 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/misc/img-pdm.txt
Documentation/devicetree/bindings/misc/img-pdm.txt new file +54 -0
@@ -0,0 +1,54 @@ +*Imagination Technologies Pulse Density Modulator (PDM) DAC. + +Required properties: + - compatible: Must be "img,pistachio-pdm" + - clocks: Must contain an entry for each entry in clock-names. + - clock-names: Must include the following entry: + Required elements: "pdm" + - img,cr-periph: Must contain a phandle to the peripheral control + syscon node which contains PDM control registers. + - #pdm-cells: Must be 2. + - The first cell is the PDM channel number (valid values: 0, 1, 2, 3) + - The second cell is 12-bit pulse-in value + +Specifying PDM information for devices +====================================== + +1. PDM User nodes + +PDM properties should be named "pdms". The exact meaning of each pdms property +is described above. + + pdm-specifier : array of #pdm-cells specifying the given PDM + (controller specific) + +The following example could be used to describe a PDM-based backlight device: + + pdm: pdm { + #pdm-cells = <2>; + }; + + [...] + + bl: backlight { + pdms = <&pdm 2 0>; + }; + +pdm-specifier typically encodes the chip-relative PDM channel number and the +12-bit pulse-in value. + +2. PDM Controller nodes + +PDM controller nodes must specify the number of cells used for the specifier +using the '#pdm-cells' property. + +An example PDM controller might look like this: + +Example: + pdm: pdm@18148000 { + compatible = "img,pistachio-pdm"; + clocks = <&pdm_clk>; + clk-names = "pdm"; + img,cr-periph = <&cr_periph>; + #pdm-cells = <2>; + };
Signature · 1 line
1.7.0.4