Re: [PATCH v5 3/6] iio: adc: fsl,imx25-gcq driver
On 29/01/15 10:11, Markus Pargmann wrote: > On Tue, Jan 27, 2015 at 08:30:56PM +, Jonathan Cameron wrote: >> On 24/01/15 14:01, Markus Pargmann wrote: >>> This is a conversion queue driver for the mx25 SoC. It uses the central >>> ADC which is used by two seperate independent queues. This driver >>> prepares different conversion configurations for each possible input. >>> For a conversion it creates a conversionqueue of one item with the >>> correct configuration for the chosen channel. It then executes the queue >>> once and disables the conversion queue afterwards. >>> >>> The reference voltages are configurable through devicetree subnodes, >>> depending on the connections of the ADC inputs. >>> >>> Signed-off-by: Markus Pargmann >>> Signed-off-by: Denis Carikli >> A couple of queries inline. >>> --- >>> >>> Notes: >>> Changes in v5: >>> - Fixed locking >>> - Removed module owner >>> >>> .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 51 +++ >>> drivers/iio/adc/Kconfig| 7 + >>> drivers/iio/adc/Makefile | 1 + >>> drivers/iio/adc/fsl-imx25-gcq.c| 369 >>> + >>> include/dt-bindings/iio/adc/fsl-imx25-gcq.h| 11 + >>> 5 files changed, 439 insertions(+) >>> create mode 100644 >>> Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt >>> create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c >>> create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h >>> >>> diff --git a/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt >>> b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt >>> new file mode 100644 >>> index ..d55b6b751349 >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt >>> @@ -0,0 +1,51 @@ >>> +Freescale i.MX25 ADC GCQ device >>> + >>> +This is a generic conversion queue device that can convert any of the >>> +analog inputs using the ADC unit of the i.MX25. >>> + >>> +Required properties: >>> + - compatible: Should be "fsl,imx25-gcq". >>> + - reg: Should be the register range of the module. >>> + - interrupts: Should be the interrupt number of the module. >>> + Typically this is <1>. >>> + - interrupt-parent: phandle to the tsadc module of the i.MX25. >>> + - #address-cells: Should be <1> (setting for the subnodes) >>> + - #size-cells: Should be <0> (setting for the subnodes) >>> + >>> +Optional properties: >>> + - vref-supply: The regulator supplying the ADC reference voltage. >>> + Required when at least one subnode uses the external reference. >>> + >>> +Sub-nodes: >>> +Optionally you can define subnodes which define the reference voltage >>> +for the analog inputs. >>> + >>> +Required properties for subnodes: >>> + - reg: Should be the number of the analog input. >>> + 0: xp >>> + 1: yp >>> + 2: xn >>> + 3: yn >>> + 4: wiper >>> + 5: inaux0 >>> + 6: inaux1 >>> + 7: inaux2 >>> + - fsl,adc-ref: specifies the reference input as defined in >>> + >>> + MX25_ADC_REF_INT and MX25_ADC_REF_EXT flags are supported. >>> + >>> +Example: >>> + >>> + adc: adc@50030800 { >>> + compatible = "fsl,imx25-gcq"; >>> + reg = <0x50030800 0x60>; >>> + interrupt-parent = <&tscadc>; >>> + interrupts = <1>; >>> + #address-cells = <1>; >>> + #size-cells = <0>; >>> + >>> + inaux@5 { >>> + reg = <5>; >>> + fsl,adc-ref = ; >>> + }; >>> + }; >>> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig >>> index 0f79e4725763..fccbb4bf44cc 100644 >>> --- a/drivers/iio/adc/Kconfig >>> +++ b/drivers/iio/adc/Kconfig >>> @@ -143,6 +143,13 @@ config EXYNOS_ADC >>> of SoCs for drivers such as the touchscreen and hwmon to use to share >>> this resource. >>> >>> +config FSL_MX25_ADC >>> + tristate "Freescale MX25 ADC driver" >>> + depends on MFD_MX25_TSADC >>> + help >>> + Generic Conversion Queue driver used for general purpose ADC in the >>> + MX25. This driver supports single measurements using the MX25 ADC. >>> + >>> config LP8788_ADC >>> tristate "LP8788 ADC driver" >>> depends on MFD_LP8788 >>> diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile >>> index 701fdb7c96aa..acab8d956371 100644 >>> --- a/drivers/iio/adc/Makefile >>> +++ b/drivers/iio/adc/Makefile >>> @@ -16,6 +16,7 @@ obj-$(CONFIG_AD799X) += ad799x.o >>> obj-$(CONFIG_AT91_ADC) += at91_adc.o >>> obj-$(CONFIG_AXP288_ADC) += axp288_adc.o >>> obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o >>> +obj-$(CONFIG_FSL_MX25_ADC) += fsl-imx25-gcq.o >>> obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o >>> obj-$(CONFIG_MAX1027) += max1027.o >>> obj-$(CONFIG_MAX1363) += max1363.o >>> diff --git a/drivers/iio/adc/fsl-imx25-gcq.c >>> b/drivers/iio/adc/fsl-imx25-gcq.c >>> new file mode 100644 >>> index ..c1ac5af41ec5 >>> --- /dev/null >>> +++ b/drivers/iio/a
Re: [PATCH v5 3/6] iio: adc: fsl,imx25-gcq driver
Hi Fabio, On Thu, Jan 29, 2015 at 12:51:36PM -0200, Fabio Estevam wrote: > Hi Markus, > > On Sat, Jan 24, 2015 at 12:01 PM, Markus Pargmann wrote: > > > + priv->irq = platform_get_irq(pdev, 0); > > + if (priv->irq <= 0) { > > This should be: if (priv->irq < 0) { Thanks, fixed in both drivers. Best regards, Markus -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature
Re: [PATCH v5 3/6] iio: adc: fsl,imx25-gcq driver
Hi Markus, On Sat, Jan 24, 2015 at 12:01 PM, Markus Pargmann wrote: > + priv->irq = platform_get_irq(pdev, 0); > + if (priv->irq <= 0) { This should be: if (priv->irq < 0) { -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 3/6] iio: adc: fsl,imx25-gcq driver
On Tue, Jan 27, 2015 at 08:30:56PM +, Jonathan Cameron wrote: > On 24/01/15 14:01, Markus Pargmann wrote: > > This is a conversion queue driver for the mx25 SoC. It uses the central > > ADC which is used by two seperate independent queues. This driver > > prepares different conversion configurations for each possible input. > > For a conversion it creates a conversionqueue of one item with the > > correct configuration for the chosen channel. It then executes the queue > > once and disables the conversion queue afterwards. > > > > The reference voltages are configurable through devicetree subnodes, > > depending on the connections of the ADC inputs. > > > > Signed-off-by: Markus Pargmann > > Signed-off-by: Denis Carikli > A couple of queries inline. > > --- > > > > Notes: > > Changes in v5: > > - Fixed locking > > - Removed module owner > > > > .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 51 +++ > > drivers/iio/adc/Kconfig| 7 + > > drivers/iio/adc/Makefile | 1 + > > drivers/iio/adc/fsl-imx25-gcq.c| 369 > > + > > include/dt-bindings/iio/adc/fsl-imx25-gcq.h| 11 + > > 5 files changed, 439 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt > > create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c > > create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h > > > > diff --git a/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt > > b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt > > new file mode 100644 > > index ..d55b6b751349 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt > > @@ -0,0 +1,51 @@ > > +Freescale i.MX25 ADC GCQ device > > + > > +This is a generic conversion queue device that can convert any of the > > +analog inputs using the ADC unit of the i.MX25. > > + > > +Required properties: > > + - compatible: Should be "fsl,imx25-gcq". > > + - reg: Should be the register range of the module. > > + - interrupts: Should be the interrupt number of the module. > > + Typically this is <1>. > > + - interrupt-parent: phandle to the tsadc module of the i.MX25. > > + - #address-cells: Should be <1> (setting for the subnodes) > > + - #size-cells: Should be <0> (setting for the subnodes) > > + > > +Optional properties: > > + - vref-supply: The regulator supplying the ADC reference voltage. > > + Required when at least one subnode uses the external reference. > > + > > +Sub-nodes: > > +Optionally you can define subnodes which define the reference voltage > > +for the analog inputs. > > + > > +Required properties for subnodes: > > + - reg: Should be the number of the analog input. > > + 0: xp > > + 1: yp > > + 2: xn > > + 3: yn > > + 4: wiper > > + 5: inaux0 > > + 6: inaux1 > > + 7: inaux2 > > + - fsl,adc-ref: specifies the reference input as defined in > > + > > + MX25_ADC_REF_INT and MX25_ADC_REF_EXT flags are supported. > > + > > +Example: > > + > > + adc: adc@50030800 { > > + compatible = "fsl,imx25-gcq"; > > + reg = <0x50030800 0x60>; > > + interrupt-parent = <&tscadc>; > > + interrupts = <1>; > > + #address-cells = <1>; > > + #size-cells = <0>; > > + > > + inaux@5 { > > + reg = <5>; > > + fsl,adc-ref = ; > > + }; > > + }; > > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > > index 0f79e4725763..fccbb4bf44cc 100644 > > --- a/drivers/iio/adc/Kconfig > > +++ b/drivers/iio/adc/Kconfig > > @@ -143,6 +143,13 @@ config EXYNOS_ADC > > of SoCs for drivers such as the touchscreen and hwmon to use to share > > this resource. > > > > +config FSL_MX25_ADC > > + tristate "Freescale MX25 ADC driver" > > + depends on MFD_MX25_TSADC > > + help > > + Generic Conversion Queue driver used for general purpose ADC in the > > + MX25. This driver supports single measurements using the MX25 ADC. > > + > > config LP8788_ADC > > tristate "LP8788 ADC driver" > > depends on MFD_LP8788 > > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile > > index 701fdb7c96aa..acab8d956371 100644 > > --- a/drivers/iio/adc/Makefile > > +++ b/drivers/iio/adc/Makefile > > @@ -16,6 +16,7 @@ obj-$(CONFIG_AD799X) += ad799x.o > > obj-$(CONFIG_AT91_ADC) += at91_adc.o > > obj-$(CONFIG_AXP288_ADC) += axp288_adc.o > > obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o > > +obj-$(CONFIG_FSL_MX25_ADC) += fsl-imx25-gcq.o > > obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o > > obj-$(CONFIG_MAX1027) += max1027.o > > obj-$(CONFIG_MAX1363) += max1363.o > > diff --git a/drivers/iio/adc/fsl-imx25-gcq.c > > b/drivers/iio/adc/fsl-imx25-gcq.c > > new file mode 100644 > > index ..c1ac5af41ec5 > > --- /dev/null > > +++ b/drivers/iio/adc/fsl-imx25-gcq.c > > @@ -0,0 +1,369 @@
Re: [PATCH v5 3/6] iio: adc: fsl,imx25-gcq driver
On 24/01/15 14:01, Markus Pargmann wrote: > This is a conversion queue driver for the mx25 SoC. It uses the central > ADC which is used by two seperate independent queues. This driver > prepares different conversion configurations for each possible input. > For a conversion it creates a conversionqueue of one item with the > correct configuration for the chosen channel. It then executes the queue > once and disables the conversion queue afterwards. > > The reference voltages are configurable through devicetree subnodes, > depending on the connections of the ADC inputs. > > Signed-off-by: Markus Pargmann > Signed-off-by: Denis Carikli A couple of queries inline. > --- > > Notes: > Changes in v5: > - Fixed locking > - Removed module owner > > .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 51 +++ > drivers/iio/adc/Kconfig| 7 + > drivers/iio/adc/Makefile | 1 + > drivers/iio/adc/fsl-imx25-gcq.c| 369 > + > include/dt-bindings/iio/adc/fsl-imx25-gcq.h| 11 + > 5 files changed, 439 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt > create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c > create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h > > diff --git a/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt > b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt > new file mode 100644 > index ..d55b6b751349 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt > @@ -0,0 +1,51 @@ > +Freescale i.MX25 ADC GCQ device > + > +This is a generic conversion queue device that can convert any of the > +analog inputs using the ADC unit of the i.MX25. > + > +Required properties: > + - compatible: Should be "fsl,imx25-gcq". > + - reg: Should be the register range of the module. > + - interrupts: Should be the interrupt number of the module. > + Typically this is <1>. > + - interrupt-parent: phandle to the tsadc module of the i.MX25. > + - #address-cells: Should be <1> (setting for the subnodes) > + - #size-cells: Should be <0> (setting for the subnodes) > + > +Optional properties: > + - vref-supply: The regulator supplying the ADC reference voltage. > + Required when at least one subnode uses the external reference. > + > +Sub-nodes: > +Optionally you can define subnodes which define the reference voltage > +for the analog inputs. > + > +Required properties for subnodes: > + - reg: Should be the number of the analog input. > + 0: xp > + 1: yp > + 2: xn > + 3: yn > + 4: wiper > + 5: inaux0 > + 6: inaux1 > + 7: inaux2 > + - fsl,adc-ref: specifies the reference input as defined in > + > + MX25_ADC_REF_INT and MX25_ADC_REF_EXT flags are supported. > + > +Example: > + > + adc: adc@50030800 { > + compatible = "fsl,imx25-gcq"; > + reg = <0x50030800 0x60>; > + interrupt-parent = <&tscadc>; > + interrupts = <1>; > + #address-cells = <1>; > + #size-cells = <0>; > + > + inaux@5 { > + reg = <5>; > + fsl,adc-ref = ; > + }; > + }; > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > index 0f79e4725763..fccbb4bf44cc 100644 > --- a/drivers/iio/adc/Kconfig > +++ b/drivers/iio/adc/Kconfig > @@ -143,6 +143,13 @@ config EXYNOS_ADC > of SoCs for drivers such as the touchscreen and hwmon to use to share > this resource. > > +config FSL_MX25_ADC > + tristate "Freescale MX25 ADC driver" > + depends on MFD_MX25_TSADC > + help > + Generic Conversion Queue driver used for general purpose ADC in the > + MX25. This driver supports single measurements using the MX25 ADC. > + > config LP8788_ADC > tristate "LP8788 ADC driver" > depends on MFD_LP8788 > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile > index 701fdb7c96aa..acab8d956371 100644 > --- a/drivers/iio/adc/Makefile > +++ b/drivers/iio/adc/Makefile > @@ -16,6 +16,7 @@ obj-$(CONFIG_AD799X) += ad799x.o > obj-$(CONFIG_AT91_ADC) += at91_adc.o > obj-$(CONFIG_AXP288_ADC) += axp288_adc.o > obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o > +obj-$(CONFIG_FSL_MX25_ADC) += fsl-imx25-gcq.o > obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o > obj-$(CONFIG_MAX1027) += max1027.o > obj-$(CONFIG_MAX1363) += max1363.o > diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c > new file mode 100644 > index ..c1ac5af41ec5 > --- /dev/null > +++ b/drivers/iio/adc/fsl-imx25-gcq.c > @@ -0,0 +1,369 @@ > +/* > + * Copyright 2014 Markus Pargmann, Pengutronix > + * > + * The code contained herein is licensed under the GNU General Public > + * License. You may obtain a copy of the GNU General Public License > + * Version 2 or later at the following locations: > + * > + * http://www.
[PATCH v5 3/6] iio: adc: fsl,imx25-gcq driver
This is a conversion queue driver for the mx25 SoC. It uses the central ADC which is used by two seperate independent queues. This driver prepares different conversion configurations for each possible input. For a conversion it creates a conversionqueue of one item with the correct configuration for the chosen channel. It then executes the queue once and disables the conversion queue afterwards. The reference voltages are configurable through devicetree subnodes, depending on the connections of the ADC inputs. Signed-off-by: Markus Pargmann Signed-off-by: Denis Carikli --- Notes: Changes in v5: - Fixed locking - Removed module owner .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 51 +++ drivers/iio/adc/Kconfig| 7 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/fsl-imx25-gcq.c| 369 + include/dt-bindings/iio/adc/fsl-imx25-gcq.h| 11 + 5 files changed, 439 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h diff --git a/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt new file mode 100644 index ..d55b6b751349 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt @@ -0,0 +1,51 @@ +Freescale i.MX25 ADC GCQ device + +This is a generic conversion queue device that can convert any of the +analog inputs using the ADC unit of the i.MX25. + +Required properties: + - compatible: Should be "fsl,imx25-gcq". + - reg: Should be the register range of the module. + - interrupts: Should be the interrupt number of the module. + Typically this is <1>. + - interrupt-parent: phandle to the tsadc module of the i.MX25. + - #address-cells: Should be <1> (setting for the subnodes) + - #size-cells: Should be <0> (setting for the subnodes) + +Optional properties: + - vref-supply: The regulator supplying the ADC reference voltage. + Required when at least one subnode uses the external reference. + +Sub-nodes: +Optionally you can define subnodes which define the reference voltage +for the analog inputs. + +Required properties for subnodes: + - reg: Should be the number of the analog input. + 0: xp + 1: yp + 2: xn + 3: yn + 4: wiper + 5: inaux0 + 6: inaux1 + 7: inaux2 + - fsl,adc-ref: specifies the reference input as defined in + + MX25_ADC_REF_INT and MX25_ADC_REF_EXT flags are supported. + +Example: + + adc: adc@50030800 { + compatible = "fsl,imx25-gcq"; + reg = <0x50030800 0x60>; + interrupt-parent = <&tscadc>; + interrupts = <1>; + #address-cells = <1>; + #size-cells = <0>; + + inaux@5 { + reg = <5>; + fsl,adc-ref = ; + }; + }; diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 0f79e4725763..fccbb4bf44cc 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -143,6 +143,13 @@ config EXYNOS_ADC of SoCs for drivers such as the touchscreen and hwmon to use to share this resource. +config FSL_MX25_ADC + tristate "Freescale MX25 ADC driver" + depends on MFD_MX25_TSADC + help + Generic Conversion Queue driver used for general purpose ADC in the + MX25. This driver supports single measurements using the MX25 ADC. + config LP8788_ADC tristate "LP8788 ADC driver" depends on MFD_LP8788 diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 701fdb7c96aa..acab8d956371 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_AD799X) += ad799x.o obj-$(CONFIG_AT91_ADC) += at91_adc.o obj-$(CONFIG_AXP288_ADC) += axp288_adc.o obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o +obj-$(CONFIG_FSL_MX25_ADC) += fsl-imx25-gcq.o obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o obj-$(CONFIG_MAX1027) += max1027.o obj-$(CONFIG_MAX1363) += max1363.o diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c new file mode 100644 index ..c1ac5af41ec5 --- /dev/null +++ b/drivers/iio/adc/fsl-imx25-gcq.c @@ -0,0 +1,369 @@ +/* + * Copyright 2014 Markus Pargmann, Pengutronix + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + * + * This is the driver for the imx25 GCQ (Generic Conversion Queue) + * connected to the imx25 ADC. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#in