* [PATCH v3 0/2] iio: adc: max1363: Add device tree support @ 2016-06-30 7:43 ` Florian Vaussard 0 siblings, 0 replies; 11+ messages in thread From: Florian Vaussard @ 2016-06-30 7:43 UTC (permalink / raw) To: devicetree, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Martin Kepplinger, linux-iio, linux-kernel, Florian Vaussard Hello, This series introduces the necessary device tree binding to perform DT boot. Tested with MAX11644 (DT boot). Best regards, Florian --- Since v2: - Use a macro to declare compatibles, as suggested by Peter Rosin for a similar patch on the mcp4531 Since v1: - First patch applied by Jonathan - Added DT maintainer's Ack - Fixed handling of data pointer in struct of_device_id Florian Vaussard (2): iio: adc: max1363: Add device tree binding documentation iio: adc: max1363: Add device tree binding .../devicetree/bindings/iio/adc/max1363.txt | 63 ++++++++++++++++++++++ drivers/iio/adc/max1363.c | 61 ++++++++++++++++++++- 2 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/max1363.txt -- 2.5.5 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 0/2] iio: adc: max1363: Add device tree support @ 2016-06-30 7:43 ` Florian Vaussard 0 siblings, 0 replies; 11+ messages in thread From: Florian Vaussard @ 2016-06-30 7:43 UTC (permalink / raw) To: devicetree-u79uwXL29TY76Z2rM5mHXA, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Martin Kepplinger, linux-iio-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Florian Vaussard Hello, This series introduces the necessary device tree binding to perform DT boot. Tested with MAX11644 (DT boot). Best regards, Florian --- Since v2: - Use a macro to declare compatibles, as suggested by Peter Rosin for a similar patch on the mcp4531 Since v1: - First patch applied by Jonathan - Added DT maintainer's Ack - Fixed handling of data pointer in struct of_device_id Florian Vaussard (2): iio: adc: max1363: Add device tree binding documentation iio: adc: max1363: Add device tree binding .../devicetree/bindings/iio/adc/max1363.txt | 63 ++++++++++++++++++++++ drivers/iio/adc/max1363.c | 61 ++++++++++++++++++++- 2 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/max1363.txt -- 2.5.5 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 1/2] iio: adc: max1363: Add device tree binding documentation 2016-06-30 7:43 ` Florian Vaussard (?) @ 2016-06-30 7:43 ` Florian Vaussard 2016-07-03 10:41 ` Jonathan Cameron -1 siblings, 1 reply; 11+ messages in thread From: Florian Vaussard @ 2016-06-30 7:43 UTC (permalink / raw) To: devicetree, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Martin Kepplinger, linux-iio, linux-kernel, Florian Vaussard Add the device tree documentation for all the supported parts. Mandatory binding is the compatible string and the slave I2C address. Optional properties can be used to specify the Vcc / Vref regulators, as well as the IRQ line if available. Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch> --- .../devicetree/bindings/iio/adc/max1363.txt | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/max1363.txt diff --git a/Documentation/devicetree/bindings/iio/adc/max1363.txt b/Documentation/devicetree/bindings/iio/adc/max1363.txt new file mode 100644 index 0000000..94a9011 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/max1363.txt @@ -0,0 +1,63 @@ +* Maxim 1x3x/136x/116xx Analog to Digital Converter (ADC) + +The node for this driver must be a child node of a I2C controller, hence +all mandatory properties for your controller must be specified. See directory: + + Documentation/devicetree/bindings/i2c + +for more details. + +Required properties: + - compatible: Should be one of + "maxim,max1361" + "maxim,max1362" + "maxim,max1363" + "maxim,max1364" + "maxim,max1036" + "maxim,max1037" + "maxim,max1038" + "maxim,max1039" + "maxim,max1136" + "maxim,max1137" + "maxim,max1138" + "maxim,max1139" + "maxim,max1236" + "maxim,max1237" + "maxim,max1238" + "maxim,max1239" + "maxim,max11600" + "maxim,max11601" + "maxim,max11602" + "maxim,max11603" + "maxim,max11604" + "maxim,max11605" + "maxim,max11606" + "maxim,max11607" + "maxim,max11608" + "maxim,max11609" + "maxim,max11610" + "maxim,max11611" + "maxim,max11612" + "maxim,max11613" + "maxim,max11614" + "maxim,max11615" + "maxim,max11616" + "maxim,max11617" + "maxim,max11644" + "maxim,max11645" + "maxim,max11646" + "maxim,max11647" + - reg: Should contain the ADC I2C address + +Optional properties: + - vcc-supply: phandle to the regulator that provides power to the ADC. + - vref-supply: phandle to the regulator for ADC reference voltage. + - interrupts: IRQ line for the ADC. If not used the driver will use + polling. + +Example: +adc: max11644@36 { + compatible = "maxim,max11644"; + reg = <0x36>; + vref-supply = <&adc_vref>; +}; -- 2.5.5 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/2] iio: adc: max1363: Add device tree binding documentation @ 2016-07-03 10:41 ` Jonathan Cameron 0 siblings, 0 replies; 11+ messages in thread From: Jonathan Cameron @ 2016-07-03 10:41 UTC (permalink / raw) To: Florian Vaussard, devicetree, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Martin Kepplinger, linux-iio, linux-kernel, Florian Vaussard On 30/06/16 08:43, Florian Vaussard wrote: > Add the device tree documentation for all the supported parts. Mandatory > binding is the compatible string and the slave I2C address. > > Optional properties can be used to specify the Vcc / Vref regulators, as > well as the IRQ line if available. > > Acked-by: Rob Herring <robh@kernel.org> > Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch> Really small point, but typically author sign off goes first then acks etc that are gained at any intermediate states, then the sign off of whoever takes the patch and applies it (here, that's me). So it kind of communicates some idea of when in the process various tags were obtained. It's not a rule set in stone though so I'll be lazy and leave this as it is. Anyhow, great and applied to the togreg branch of iio.git initially pushed out as testing for the autobuilders to poke it (or not in the case of this docume Jonathan > --- > .../devicetree/bindings/iio/adc/max1363.txt | 63 ++++++++++++++++++++++ > 1 file changed, 63 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/adc/max1363.txt > > diff --git a/Documentation/devicetree/bindings/iio/adc/max1363.txt b/Documentation/devicetree/bindings/iio/adc/max1363.txt > new file mode 100644 > index 0000000..94a9011 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/adc/max1363.txt > @@ -0,0 +1,63 @@ > +* Maxim 1x3x/136x/116xx Analog to Digital Converter (ADC) > + > +The node for this driver must be a child node of a I2C controller, hence > +all mandatory properties for your controller must be specified. See directory: > + > + Documentation/devicetree/bindings/i2c > + > +for more details. > + > +Required properties: > + - compatible: Should be one of > + "maxim,max1361" > + "maxim,max1362" > + "maxim,max1363" > + "maxim,max1364" > + "maxim,max1036" > + "maxim,max1037" > + "maxim,max1038" > + "maxim,max1039" > + "maxim,max1136" > + "maxim,max1137" > + "maxim,max1138" > + "maxim,max1139" > + "maxim,max1236" > + "maxim,max1237" > + "maxim,max1238" > + "maxim,max1239" > + "maxim,max11600" > + "maxim,max11601" > + "maxim,max11602" > + "maxim,max11603" > + "maxim,max11604" > + "maxim,max11605" > + "maxim,max11606" > + "maxim,max11607" > + "maxim,max11608" > + "maxim,max11609" > + "maxim,max11610" > + "maxim,max11611" > + "maxim,max11612" > + "maxim,max11613" > + "maxim,max11614" > + "maxim,max11615" > + "maxim,max11616" > + "maxim,max11617" > + "maxim,max11644" > + "maxim,max11645" > + "maxim,max11646" > + "maxim,max11647" > + - reg: Should contain the ADC I2C address > + > +Optional properties: > + - vcc-supply: phandle to the regulator that provides power to the ADC. > + - vref-supply: phandle to the regulator for ADC reference voltage. > + - interrupts: IRQ line for the ADC. If not used the driver will use > + polling. > + > +Example: > +adc: max11644@36 { > + compatible = "maxim,max11644"; > + reg = <0x36>; > + vref-supply = <&adc_vref>; > +}; > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/2] iio: adc: max1363: Add device tree binding documentation @ 2016-07-03 10:41 ` Jonathan Cameron 0 siblings, 0 replies; 11+ messages in thread From: Jonathan Cameron @ 2016-07-03 10:41 UTC (permalink / raw) To: Florian Vaussard, devicetree-u79uwXL29TY76Z2rM5mHXA, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Martin Kepplinger, linux-iio-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Florian Vaussard On 30/06/16 08:43, Florian Vaussard wrote: > Add the device tree documentation for all the supported parts. Mandatory > binding is the compatible string and the slave I2C address. > > Optional properties can be used to specify the Vcc / Vref regulators, as > well as the IRQ line if available. > > Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > Signed-off-by: Florian Vaussard <florian.vaussard-EWQkb/GNqlFyDzI6CaY1VQ@public.gmane.org> Really small point, but typically author sign off goes first then acks etc that are gained at any intermediate states, then the sign off of whoever takes the patch and applies it (here, that's me). So it kind of communicates some idea of when in the process various tags were obtained. It's not a rule set in stone though so I'll be lazy and leave this as it is. Anyhow, great and applied to the togreg branch of iio.git initially pushed out as testing for the autobuilders to poke it (or not in the case of this docume Jonathan > --- > .../devicetree/bindings/iio/adc/max1363.txt | 63 ++++++++++++++++++++++ > 1 file changed, 63 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/adc/max1363.txt > > diff --git a/Documentation/devicetree/bindings/iio/adc/max1363.txt b/Documentation/devicetree/bindings/iio/adc/max1363.txt > new file mode 100644 > index 0000000..94a9011 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/adc/max1363.txt > @@ -0,0 +1,63 @@ > +* Maxim 1x3x/136x/116xx Analog to Digital Converter (ADC) > + > +The node for this driver must be a child node of a I2C controller, hence > +all mandatory properties for your controller must be specified. See directory: > + > + Documentation/devicetree/bindings/i2c > + > +for more details. > + > +Required properties: > + - compatible: Should be one of > + "maxim,max1361" > + "maxim,max1362" > + "maxim,max1363" > + "maxim,max1364" > + "maxim,max1036" > + "maxim,max1037" > + "maxim,max1038" > + "maxim,max1039" > + "maxim,max1136" > + "maxim,max1137" > + "maxim,max1138" > + "maxim,max1139" > + "maxim,max1236" > + "maxim,max1237" > + "maxim,max1238" > + "maxim,max1239" > + "maxim,max11600" > + "maxim,max11601" > + "maxim,max11602" > + "maxim,max11603" > + "maxim,max11604" > + "maxim,max11605" > + "maxim,max11606" > + "maxim,max11607" > + "maxim,max11608" > + "maxim,max11609" > + "maxim,max11610" > + "maxim,max11611" > + "maxim,max11612" > + "maxim,max11613" > + "maxim,max11614" > + "maxim,max11615" > + "maxim,max11616" > + "maxim,max11617" > + "maxim,max11644" > + "maxim,max11645" > + "maxim,max11646" > + "maxim,max11647" > + - reg: Should contain the ADC I2C address > + > +Optional properties: > + - vcc-supply: phandle to the regulator that provides power to the ADC. > + - vref-supply: phandle to the regulator for ADC reference voltage. > + - interrupts: IRQ line for the ADC. If not used the driver will use > + polling. > + > +Example: > +adc: max11644@36 { > + compatible = "maxim,max11644"; > + reg = <0x36>; > + vref-supply = <&adc_vref>; > +}; > -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/2] iio: adc: max1363: Add device tree binding documentation @ 2016-07-04 6:56 ` Florian Vaussard 0 siblings, 0 replies; 11+ messages in thread From: Florian Vaussard @ 2016-07-04 6:56 UTC (permalink / raw) To: Jonathan Cameron Cc: Florian Vaussard, devicetree, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Martin Kepplinger, linux-iio, linux-kernel, Vaussard Florian Hi Jonathan, On 07/03/2016 12:41 PM, Jonathan Cameron wrote: > On 30/06/16 08:43, Florian Vaussard wrote: >> Add the device tree documentation for all the supported parts. Mandatory >> binding is the compatible string and the slave I2C address. >> >> Optional properties can be used to specify the Vcc / Vref regulators, as >> well as the IRQ line if available. >> >> Acked-by: Rob Herring <robh@kernel.org> >> Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch> > Really small point, but typically author sign off goes first then acks etc > that are gained at any intermediate states, then the sign off of whoever takes > the patch and applies it (here, that's me). So it kind of communicates some > idea of when in the process various tags were obtained. It's not a rule > set in stone though so I'll be lazy and leave this as it is. > Agree, I will try to stick to this in the future. Looking at some previous patches, I see that I used both styles without noticing. > Anyhow, great and applied to the togreg branch of iio.git initially pushed > out as testing for the autobuilders to poke it (or not in the case of this > docume > Great. Do you plan to send them for the next merge window, or will you wait for the 4.9 cycle? Best, Florian ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/2] iio: adc: max1363: Add device tree binding documentation @ 2016-07-04 6:56 ` Florian Vaussard 0 siblings, 0 replies; 11+ messages in thread From: Florian Vaussard @ 2016-07-04 6:56 UTC (permalink / raw) To: Jonathan Cameron Cc: Florian Vaussard, devicetree-u79uwXL29TY76Z2rM5mHXA, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Martin Kepplinger, linux-iio-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Vaussard Florian Hi Jonathan, On 07/03/2016 12:41 PM, Jonathan Cameron wrote: > On 30/06/16 08:43, Florian Vaussard wrote: >> Add the device tree documentation for all the supported parts. Mandatory >> binding is the compatible string and the slave I2C address. >> >> Optional properties can be used to specify the Vcc / Vref regulators, as >> well as the IRQ line if available. >> >> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> >> Signed-off-by: Florian Vaussard <florian.vaussard-EWQkb/GNqlFyDzI6CaY1VQ@public.gmane.org> > Really small point, but typically author sign off goes first then acks etc > that are gained at any intermediate states, then the sign off of whoever takes > the patch and applies it (here, that's me). So it kind of communicates some > idea of when in the process various tags were obtained. It's not a rule > set in stone though so I'll be lazy and leave this as it is. > Agree, I will try to stick to this in the future. Looking at some previous patches, I see that I used both styles without noticing. > Anyhow, great and applied to the togreg branch of iio.git initially pushed > out as testing for the autobuilders to poke it (or not in the case of this > docume > Great. Do you plan to send them for the next merge window, or will you wait for the 4.9 cycle? Best, Florian -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/2] iio: adc: max1363: Add device tree binding documentation @ 2016-07-05 20:42 ` Jonathan Cameron 0 siblings, 0 replies; 11+ messages in thread From: Jonathan Cameron @ 2016-07-05 20:42 UTC (permalink / raw) To: Florian Vaussard Cc: Florian Vaussard, devicetree, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Martin Kepplinger, linux-iio, linux-kernel On 04/07/16 07:56, Florian Vaussard wrote: > Hi Jonathan, > > On 07/03/2016 12:41 PM, Jonathan Cameron wrote: >> On 30/06/16 08:43, Florian Vaussard wrote: >>> Add the device tree documentation for all the supported parts. Mandatory >>> binding is the compatible string and the slave I2C address. >>> >>> Optional properties can be used to specify the Vcc / Vref regulators, as >>> well as the IRQ line if available. >>> >>> Acked-by: Rob Herring <robh@kernel.org> >>> Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch> >> Really small point, but typically author sign off goes first then acks etc >> that are gained at any intermediate states, then the sign off of whoever takes >> the patch and applies it (here, that's me). So it kind of communicates some >> idea of when in the process various tags were obtained. It's not a rule >> set in stone though so I'll be lazy and leave this as it is. >> > > Agree, I will try to stick to this in the future. Looking at some previous > patches, I see that I used both styles without noticing. > >> Anyhow, great and applied to the togreg branch of iio.git initially pushed >> out as testing for the autobuilders to poke it (or not in the case of this >> docume >> > > Great. Do you plan to send them for the next merge window, or will you wait for > the 4.9 cycle? > Just sending now... Should be in time for the coming merge window. Jonathan > Best, > Florian > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/2] iio: adc: max1363: Add device tree binding documentation @ 2016-07-05 20:42 ` Jonathan Cameron 0 siblings, 0 replies; 11+ messages in thread From: Jonathan Cameron @ 2016-07-05 20:42 UTC (permalink / raw) To: Florian Vaussard Cc: Florian Vaussard, devicetree-u79uwXL29TY76Z2rM5mHXA, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Martin Kepplinger, linux-iio-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On 04/07/16 07:56, Florian Vaussard wrote: > Hi Jonathan, > > On 07/03/2016 12:41 PM, Jonathan Cameron wrote: >> On 30/06/16 08:43, Florian Vaussard wrote: >>> Add the device tree documentation for all the supported parts. Mandatory >>> binding is the compatible string and the slave I2C address. >>> >>> Optional properties can be used to specify the Vcc / Vref regulators, as >>> well as the IRQ line if available. >>> >>> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> >>> Signed-off-by: Florian Vaussard <florian.vaussard-EWQkb/GNqlFyDzI6CaY1VQ@public.gmane.org> >> Really small point, but typically author sign off goes first then acks etc >> that are gained at any intermediate states, then the sign off of whoever takes >> the patch and applies it (here, that's me). So it kind of communicates some >> idea of when in the process various tags were obtained. It's not a rule >> set in stone though so I'll be lazy and leave this as it is. >> > > Agree, I will try to stick to this in the future. Looking at some previous > patches, I see that I used both styles without noticing. > >> Anyhow, great and applied to the togreg branch of iio.git initially pushed >> out as testing for the autobuilders to poke it (or not in the case of this >> docume >> > > Great. Do you plan to send them for the next merge window, or will you wait for > the 4.9 cycle? > Just sending now... Should be in time for the coming merge window. Jonathan > Best, > Florian > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 2/2] iio: adc: max1363: Add device tree binding 2016-06-30 7:43 ` Florian Vaussard (?) (?) @ 2016-06-30 7:43 ` Florian Vaussard 2016-07-03 10:41 ` Jonathan Cameron -1 siblings, 1 reply; 11+ messages in thread From: Florian Vaussard @ 2016-06-30 7:43 UTC (permalink / raw) To: devicetree, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Martin Kepplinger, linux-iio, linux-kernel, Florian Vaussard This patch adds the necessary device tree binding to allow DT probing of currently supported parts. Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch> --- drivers/iio/adc/max1363.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c index b5d28c0..c3e4c3c 100644 --- a/drivers/iio/adc/max1363.c +++ b/drivers/iio/adc/max1363.c @@ -25,6 +25,8 @@ #include <linux/slab.h> #include <linux/err.h> #include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> @@ -1516,6 +1518,56 @@ done: return IRQ_HANDLED; } +#ifdef CONFIG_OF + +#define MAX1363_COMPATIBLE(of_compatible, cfg) { \ + .compatible = of_compatible, \ + .data = &max1363_chip_info_tbl[cfg], \ +} + +static const struct of_device_id max1363_of_match[] = { + MAX1363_COMPATIBLE("maxim,max1361", max1361), + MAX1363_COMPATIBLE("maxim,max1362", max1362), + MAX1363_COMPATIBLE("maxim,max1363", max1363), + MAX1363_COMPATIBLE("maxim,max1364", max1364), + MAX1363_COMPATIBLE("maxim,max1036", max1036), + MAX1363_COMPATIBLE("maxim,max1037", max1037), + MAX1363_COMPATIBLE("maxim,max1038", max1038), + MAX1363_COMPATIBLE("maxim,max1039", max1039), + MAX1363_COMPATIBLE("maxim,max1136", max1136), + MAX1363_COMPATIBLE("maxim,max1137", max1137), + MAX1363_COMPATIBLE("maxim,max1138", max1138), + MAX1363_COMPATIBLE("maxim,max1139", max1139), + MAX1363_COMPATIBLE("maxim,max1236", max1236), + MAX1363_COMPATIBLE("maxim,max1237", max1237), + MAX1363_COMPATIBLE("maxim,max1238", max1238), + MAX1363_COMPATIBLE("maxim,max1239", max1239), + MAX1363_COMPATIBLE("maxim,max11600", max11600), + MAX1363_COMPATIBLE("maxim,max11601", max11601), + MAX1363_COMPATIBLE("maxim,max11602", max11602), + MAX1363_COMPATIBLE("maxim,max11603", max11603), + MAX1363_COMPATIBLE("maxim,max11604", max11604), + MAX1363_COMPATIBLE("maxim,max11605", max11605), + MAX1363_COMPATIBLE("maxim,max11606", max11606), + MAX1363_COMPATIBLE("maxim,max11607", max11607), + MAX1363_COMPATIBLE("maxim,max11608", max11608), + MAX1363_COMPATIBLE("maxim,max11609", max11609), + MAX1363_COMPATIBLE("maxim,max11610", max11610), + MAX1363_COMPATIBLE("maxim,max11611", max11611), + MAX1363_COMPATIBLE("maxim,max11612", max11612), + MAX1363_COMPATIBLE("maxim,max11613", max11613), + MAX1363_COMPATIBLE("maxim,max11614", max11614), + MAX1363_COMPATIBLE("maxim,max11615", max11615), + MAX1363_COMPATIBLE("maxim,max11616", max11616), + MAX1363_COMPATIBLE("maxim,max11617", max11617), + MAX1363_COMPATIBLE("maxim,max11644", max11644), + MAX1363_COMPATIBLE("maxim,max11645", max11645), + MAX1363_COMPATIBLE("maxim,max11646", max11646), + MAX1363_COMPATIBLE("maxim,max11647", max11647), + { /* sentinel */ } +}; +#endif + static int max1363_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -1523,6 +1575,7 @@ static int max1363_probe(struct i2c_client *client, struct max1363_state *st; struct iio_dev *indio_dev; struct regulator *vref; + const struct of_device_id *match; indio_dev = devm_iio_device_alloc(&client->dev, sizeof(struct max1363_state)); @@ -1549,7 +1602,12 @@ static int max1363_probe(struct i2c_client *client, /* this is only used for device removal purposes */ i2c_set_clientdata(client, indio_dev); - st->chip_info = &max1363_chip_info_tbl[id->driver_data]; + match = of_match_device(of_match_ptr(max1363_of_match), + &client->dev); + if (match) + st->chip_info = of_device_get_match_data(&client->dev); + else + st->chip_info = &max1363_chip_info_tbl[id->driver_data]; st->client = client; st->vref_uv = st->chip_info->int_vref_mv * 1000; @@ -1692,6 +1750,7 @@ MODULE_DEVICE_TABLE(i2c, max1363_id); static struct i2c_driver max1363_driver = { .driver = { .name = "max1363", + .of_match_table = of_match_ptr(max1363_of_match), }, .probe = max1363_probe, .remove = max1363_remove, -- 2.5.5 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3 2/2] iio: adc: max1363: Add device tree binding 2016-06-30 7:43 ` [PATCH v3 2/2] iio: adc: max1363: Add device tree binding Florian Vaussard @ 2016-07-03 10:41 ` Jonathan Cameron 0 siblings, 0 replies; 11+ messages in thread From: Jonathan Cameron @ 2016-07-03 10:41 UTC (permalink / raw) To: Florian Vaussard, devicetree, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Martin Kepplinger, linux-iio, linux-kernel, Florian Vaussard On 30/06/16 08:43, Florian Vaussard wrote: > This patch adds the necessary device tree binding to allow DT probing of > currently supported parts. > > Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch> Applied. Thanks. Jonathan > --- > drivers/iio/adc/max1363.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 60 insertions(+), 1 deletion(-) > > diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c > index b5d28c0..c3e4c3c 100644 > --- a/drivers/iio/adc/max1363.c > +++ b/drivers/iio/adc/max1363.c > @@ -25,6 +25,8 @@ > #include <linux/slab.h> > #include <linux/err.h> > #include <linux/module.h> > +#include <linux/of.h> > +#include <linux/of_device.h> > > #include <linux/iio/iio.h> > #include <linux/iio/sysfs.h> > @@ -1516,6 +1518,56 @@ done: > return IRQ_HANDLED; > } > > +#ifdef CONFIG_OF > + > +#define MAX1363_COMPATIBLE(of_compatible, cfg) { \ > + .compatible = of_compatible, \ > + .data = &max1363_chip_info_tbl[cfg], \ > +} > + > +static const struct of_device_id max1363_of_match[] = { > + MAX1363_COMPATIBLE("maxim,max1361", max1361), > + MAX1363_COMPATIBLE("maxim,max1362", max1362), > + MAX1363_COMPATIBLE("maxim,max1363", max1363), > + MAX1363_COMPATIBLE("maxim,max1364", max1364), > + MAX1363_COMPATIBLE("maxim,max1036", max1036), > + MAX1363_COMPATIBLE("maxim,max1037", max1037), > + MAX1363_COMPATIBLE("maxim,max1038", max1038), > + MAX1363_COMPATIBLE("maxim,max1039", max1039), > + MAX1363_COMPATIBLE("maxim,max1136", max1136), > + MAX1363_COMPATIBLE("maxim,max1137", max1137), > + MAX1363_COMPATIBLE("maxim,max1138", max1138), > + MAX1363_COMPATIBLE("maxim,max1139", max1139), > + MAX1363_COMPATIBLE("maxim,max1236", max1236), > + MAX1363_COMPATIBLE("maxim,max1237", max1237), > + MAX1363_COMPATIBLE("maxim,max1238", max1238), > + MAX1363_COMPATIBLE("maxim,max1239", max1239), > + MAX1363_COMPATIBLE("maxim,max11600", max11600), > + MAX1363_COMPATIBLE("maxim,max11601", max11601), > + MAX1363_COMPATIBLE("maxim,max11602", max11602), > + MAX1363_COMPATIBLE("maxim,max11603", max11603), > + MAX1363_COMPATIBLE("maxim,max11604", max11604), > + MAX1363_COMPATIBLE("maxim,max11605", max11605), > + MAX1363_COMPATIBLE("maxim,max11606", max11606), > + MAX1363_COMPATIBLE("maxim,max11607", max11607), > + MAX1363_COMPATIBLE("maxim,max11608", max11608), > + MAX1363_COMPATIBLE("maxim,max11609", max11609), > + MAX1363_COMPATIBLE("maxim,max11610", max11610), > + MAX1363_COMPATIBLE("maxim,max11611", max11611), > + MAX1363_COMPATIBLE("maxim,max11612", max11612), > + MAX1363_COMPATIBLE("maxim,max11613", max11613), > + MAX1363_COMPATIBLE("maxim,max11614", max11614), > + MAX1363_COMPATIBLE("maxim,max11615", max11615), > + MAX1363_COMPATIBLE("maxim,max11616", max11616), > + MAX1363_COMPATIBLE("maxim,max11617", max11617), > + MAX1363_COMPATIBLE("maxim,max11644", max11644), > + MAX1363_COMPATIBLE("maxim,max11645", max11645), > + MAX1363_COMPATIBLE("maxim,max11646", max11646), > + MAX1363_COMPATIBLE("maxim,max11647", max11647), > + { /* sentinel */ } > +}; > +#endif > + > static int max1363_probe(struct i2c_client *client, > const struct i2c_device_id *id) > { > @@ -1523,6 +1575,7 @@ static int max1363_probe(struct i2c_client *client, > struct max1363_state *st; > struct iio_dev *indio_dev; > struct regulator *vref; > + const struct of_device_id *match; > > indio_dev = devm_iio_device_alloc(&client->dev, > sizeof(struct max1363_state)); > @@ -1549,7 +1602,12 @@ static int max1363_probe(struct i2c_client *client, > /* this is only used for device removal purposes */ > i2c_set_clientdata(client, indio_dev); > > - st->chip_info = &max1363_chip_info_tbl[id->driver_data]; > + match = of_match_device(of_match_ptr(max1363_of_match), > + &client->dev); > + if (match) > + st->chip_info = of_device_get_match_data(&client->dev); > + else > + st->chip_info = &max1363_chip_info_tbl[id->driver_data]; > st->client = client; > > st->vref_uv = st->chip_info->int_vref_mv * 1000; > @@ -1692,6 +1750,7 @@ MODULE_DEVICE_TABLE(i2c, max1363_id); > static struct i2c_driver max1363_driver = { > .driver = { > .name = "max1363", > + .of_match_table = of_match_ptr(max1363_of_match), > }, > .probe = max1363_probe, > .remove = max1363_remove, > ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2016-07-05 20:42 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-06-30 7:43 [PATCH v3 0/2] iio: adc: max1363: Add device tree support Florian Vaussard 2016-06-30 7:43 ` Florian Vaussard 2016-06-30 7:43 ` [PATCH v3 1/2] iio: adc: max1363: Add device tree binding documentation Florian Vaussard 2016-07-03 10:41 ` Jonathan Cameron 2016-07-03 10:41 ` Jonathan Cameron 2016-07-04 6:56 ` Florian Vaussard 2016-07-04 6:56 ` Florian Vaussard 2016-07-05 20:42 ` Jonathan Cameron 2016-07-05 20:42 ` Jonathan Cameron 2016-06-30 7:43 ` [PATCH v3 2/2] iio: adc: max1363: Add device tree binding Florian Vaussard 2016-07-03 10:41 ` Jonathan Cameron
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.