Skip to contentSkip to conversation

Add DAC driver support for Vybrid SoC

PATCH New Sanchayan Maity 4 participants 7 messages Feb 22, 2016 – Feb 29, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover Add DAC driver support for Vybrid SoC

Hello,

This patchset adds support for the DAC peripheral on Vybrid SoC. Patchset is based on top of shawn's for-next branch and has been tested on a Toradex Colibri VF50 module.

@Jonathan
I kept the IIO_SHARED_BY_DIR instead of using IIO_SHARED_BY_ALL since this gives "out_conversion_mode" allowing me to distinguish this in the ABI documentation, that this is explicitly for the DAC.

Since 4.5-rc4 was released recently and assuming this makes it with this or next version, I assumed the target kernel version would be 4.6 and used that in ABI documentation.

Feedbacks and comments most welcome.

Changes since v2:
1. Add dependencies on OF and HAS_IOMEM in Kconfig
2. Fix ordering of disabling DAC and calling iio unregister

Changes since v1:
1. Fix return type of vf610_dac_init function
2. Document conversion modes in sysfs-bus-iio-vf610
3. Remove "indexed" specification from iio_chan_spec
4. Use "return" directly from default case in switch
5. Remove DRIVER_NAME
6. Call vf610_dac_init before iio device registration
7. Define and use vf610_dac_exit function in remove and suspend

v2 of the patchset
http://www.spinics.net/lists/arm-kernel/msg482839.html

v1 of the patchset:
http://www.spinics.net/lists/arm-kernel/msg481190.html

Thanks & Regards,
Sanchayan Maity.

Sanchayan Maity (2):
ARM: dts: vfxxx: Add DAC node for Vybrid SoC
iio: dac: vf610_dac: Add IIO DAC driver for Vybrid SoC

 Documentation/ABI/testing/sysfs-bus-iio-vf610      |   9 +
 .../devicetree/bindings/iio/dac/vf610-dac.txt      |  20 ++
 arch/arm/boot/dts/vfxxx.dtsi                       |  18 ++
 drivers/iio/dac/Kconfig                            |  10 +
 drivers/iio/dac/Makefile                           |   1 +
 drivers/iio/dac/vf610_dac.c                        | 298 +++++++++++++++++++++
 6 files changed, 356 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/vf610-dac.txt
 create mode 100644 drivers/iio/dac/vf610_dac.c
Signature · 1 line
2.7.1
#1 lore raw

PATCH v3 1/2 ARM: dts: vfxxx: Add DAC node for Vybrid SoC

Add a device tree node entry for DAC peripheral on Vybrid SoC.

---
 arch/arm/boot/dts/vfxxx.dtsi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm/boot/dts/vfxxx.dtsi +18 -0
index a5f07e3..8238069 100644
@@ -602,6 +602,24 @@
 				status = "disabled";
 			};
 
+			dac0: dac at 400cc000 {
+				compatible = "fsl,vf610-dac";
+				reg = <0x400cc000 1000>;
+				interrupts = <55 IRQ_TYPE_LEVEL_HIGH>;
+				clock-names = "dac";
+				clocks = <&clks VF610_CLK_DAC0>;
+				status = "disabled";
+			};
+
+			dac1: dac at 400cd000 {
+				compatible = "fsl,vf610-dac";
+				reg = <0x400cd000 1000>;
+				interrupts = <56 IRQ_TYPE_LEVEL_HIGH>;
+				clock-names = "dac";
+				clocks = <&clks VF610_CLK_DAC1>;
+				status = "disabled";
+			};
+
 			fec0: ethernet at 400d0000 {
 				compatible = "fsl,mvf600-fec";
 				reg = <0x400d0000 0x1000>;
Signature · 1 line
2.7.1
#2 lore raw

PATCH v3 2/2 iio: dac: vf610_dac: Add IIO DAC driver for Vybrid SoC

In reply to Sanchayan Maity

Add driver support for DAC peripheral on Vybrid SoC.

---
 Documentation/ABI/testing/sysfs-bus-iio-vf610      |   9 +
 .../devicetree/bindings/iio/dac/vf610-dac.txt      |  20 ++
 drivers/iio/dac/Kconfig                            |  10 +
 drivers/iio/dac/Makefile                           |   1 +
 drivers/iio/dac/vf610_dac.c                        | 298 +++++++++++++++++++++
 5 files changed, 338 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/vf610-dac.txt
 create mode 100644 drivers/iio/dac/vf610_dac.c
Documentation/ABI/testing/sysfs-bus-iio-vf610 +9 -0
index ecbc1f4..308a675 100644
@@ -5,3 +5,12 @@ Description:
 		Specifies the hardware conversion mode used. The three
 		available modes are "normal", "high-speed" and "low-power",
 		where the last is the default mode.
+
+
+What:		/sys/bus/iio/devices/iio:deviceX/out_conversion_mode
+KernelVersion:	4.6
+Contact:	linux-iio at vger.kernel.org
+Description:
+		Specifies the hardware conversion mode used within DAC.
+		The two available modes are "high-power" and "low-power",
+		where "low-power" mode is the default mode.
Documentation/devicetree/bindings/iio/dac/vf610-dac.txt new file +20 -0
new file mode 100644
index 0000000..20c6c7a
@@ -0,0 +1,20 @@
+Freescale vf610 Digital to Analog Converter bindings
+
+The devicetree bindings are for the new DAC driver written for
+vf610 SoCs from Freescale.
+
+Required properties:
+- compatible: Should contain "fsl,vf610-dac"
+- reg: Offset and length of the register set for the device
+- interrupts: Should contain the interrupt for the device
+- clocks: The clock is needed by the DAC controller
+- clock-names: Must contain "dac" matching entry in the clocks property.
+
+Example:
+dac0: dac at 400cc000 {
+	compatible = "fsl,vf610-dac";
+	reg = <0x400cc000 0x1000>;
+	interrupts = <55 IRQ_TYPE_LEVEL_HIGH>;
+	clock-names = "dac";
+	clocks = <&clks VF610_CLK_DAC0>;
+};
drivers/iio/dac/Kconfig +10 -0
index e701e28..75e9708 100644
@@ -196,4 +196,14 @@ config MCP4922
 	  To compile this driver as a module, choose M here: the module
 	  will be called mcp4922.
 
+config VF610_DAC
+	tristate "Vybrid vf610 DAC driver"
+	depends on OF
+	depends on HAS_IOMEM
+	help
+	  Say yes here to support Vybrid board digital-to-analog converter.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called vf610_dac.
+
 endmenu
drivers/iio/dac/Makefile +1 -0
index 63ae056..93feb27 100644
@@ -21,3 +21,4 @@ obj-$(CONFIG_MAX517) += max517.o
 obj-$(CONFIG_MAX5821) += max5821.o
 obj-$(CONFIG_MCP4725) += mcp4725.o
 obj-$(CONFIG_MCP4922) += mcp4922.o
+obj-$(CONFIG_VF610_DAC) += vf610_dac.o
drivers/iio/dac/vf610_dac.c new file +298 -0

298 lines not on this page · raw message

Signature · 1 line
2.7.1
maintainer
#3 lore raw

PATCH v3 2/2 iio: dac: vf610_dac: Add IIO DAC driver for Vybrid SoC

Quoted 6 lines · Sanchayan Maity

Add driver support for DAC peripheral on Vybrid SoC.

---
 Documentation/ABI/testing/sysfs-bus-iio-vf610      |   9 +
 .../devicetree/bindings/iio/dac/vf610-dac.txt      |  20 ++

For the binding:

Quoted 6 lines
 drivers/iio/dac/Kconfig                            |  10 +
 drivers/iio/dac/Makefile                           |   1 +
 drivers/iio/dac/vf610_dac.c                        | 298 +++++++++++++++++++++
 5 files changed, 338 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/vf610-dac.txt
 create mode 100644 drivers/iio/dac/vf610_dac.c
maintainer
#4 lore raw

PATCH v3 2/2 iio: dac: vf610_dac: Add IIO DAC driver for Vybrid SoC

Quoted 11 lines · Rob Herring
Quoted 6 lines · Sanchayan Maity

Add driver support for DAC peripheral on Vybrid SoC.

---
 Documentation/ABI/testing/sysfs-bus-iio-vf610      |   9 +
 .../devicetree/bindings/iio/dac/vf610-dac.txt      |  20 ++

For the binding:

Applied to the togreg branch of iio.git - initially pushed out as testing for the autobuilders to play with it.

Note the dts change probably wants to go via the relevant arch trees. I can take it with an appropriate ack if not.

Jonathan

Quoted 12 lines
Quoted 7 lines
 drivers/iio/dac/Kconfig                            |  10 +
 drivers/iio/dac/Makefile                           |   1 +
 drivers/iio/dac/vf610_dac.c                        | 298 +++++++++++++++++++++
 5 files changed, 338 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/vf610-dac.txt
 create mode 100644 drivers/iio/dac/vf610_dac.c

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

PATCH v3 2/2 iio: dac: vf610_dac: Add IIO DAC driver for Vybrid SoC

Hello,

Quoted 9 lines · Jonathan Cameron
Quoted 8 lines · Rob Herring
Quoted 6 lines · Sanchayan Maity

Add driver support for DAC peripheral on Vybrid SoC.

---
 Documentation/ABI/testing/sysfs-bus-iio-vf610      |   9 +
 .../devicetree/bindings/iio/dac/vf610-dac.txt      |  20 ++
Quoted 5 lines
Quoted 3 lines

For the binding:

Applied to the togreg branch of iio.git - initially pushed out as testing for the autobuilders to play with it.

Thanks Jonathan.

Quoted 3 lines

Note the dts change probably wants to go via the relevant arch trees. I can take it with an appropriate ack if not.

Generally shawn picks up the device tree changes once the driver makes it to his for-next branch. I will ping shawn to pick this up once the driver lands in shawn's for-next branch.

Regards,
Sanchayan.

Applied
#6 lore raw

PATCH v3 2/2 iio: dac: vf610_dac: Add IIO DAC driver for Vybrid SoC

Quoted 21 lines · maitysanchayan at gmail.com

Hello,

Quoted 9 lines · Jonathan Cameron
Quoted 8 lines · Rob Herring
Quoted 6 lines · Sanchayan Maity

Add driver support for DAC peripheral on Vybrid SoC.

---
 Documentation/ABI/testing/sysfs-bus-iio-vf610      |   9 +
 .../devicetree/bindings/iio/dac/vf610-dac.txt      |  20 ++
Quoted 5 lines
Quoted 3 lines

For the binding:

Applied to the togreg branch of iio.git - initially pushed out as testing for the autobuilders to play with it.

Thanks Jonathan.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

Note the dts change probably wants to go via the relevant arch trees. I can take it with an appropriate ack if not.

Generally shawn picks up the device tree changes once the driver makes it to his for-next branch. I will ping shawn to pick this up once the driver lands in shawn's for-next branch.

For such device enabling which does no harm on my tree, i.e. no regression or breakage, I will be happy to take it once driver part gets applied, so that we do not need to wait for another release cycle to get it work.

I applied dts patch, thanks.

Shawn