Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1434298 > unrolled thread

[PATCH v3 0/4] iio: potentiometer: mcp4531: New parts, DT and typo

Started byFlorian Vaussard <florian.vaussard@gmail.com>
First post2016-06-30 09:40 +0200
Last post2016-07-04 09:00 +0200
Articles 7 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 0/4] iio: potentiometer: mcp4531: New parts, DT and typo Florian Vaussard <florian.vaussard@gmail.com> - 2016-06-30 09:40 +0200
    [PATCH v3 4/4] iio: potentiometer: Fix typo in Kconfig Florian Vaussard <florian.vaussard@gmail.com> - 2016-06-30 09:40 +0200
      Re: [PATCH v3 4/4] iio: potentiometer: Fix typo in Kconfig Jonathan Cameron <jic23@kernel.org> - 2016-07-03 13:00 +0200
    [PATCH v3 3/4] iio: potentiometer: mcp4531: Add device tree binding Florian Vaussard <florian.vaussard@gmail.com> - 2016-06-30 09:40 +0200
      Re: [PATCH v3 3/4] iio: potentiometer: mcp4531: Add device tree  binding Florian Vaussard <florian.vaussard@heig-vd.ch> - 2016-06-30 10:10 +0200
        Re: [PATCH v3 3/4] iio: potentiometer: mcp4531: Add device tree  binding Jonathan Cameron <jic23@kernel.org> - 2016-07-03 13:00 +0200
          Re: [PATCH v3 3/4] iio: potentiometer: mcp4531: Add device tree  binding Florian Vaussard <florian.vaussard@heig-vd.ch> - 2016-07-04 09:00 +0200

#1434298 — [PATCH v3 0/4] iio: potentiometer: mcp4531: New parts, DT and typo

FromFlorian Vaussard <florian.vaussard@gmail.com>
Date2016-06-30 09:40 +0200
Subject[PATCH v3 0/4] iio: potentiometer: mcp4531: New parts, DT and typo
Message-ID<rPEJQ-6JB-3@gated-at.bofh.it>
Hello,

This series first adds support for parts missing from mcp4531 driver
(MCP454x, MCP456x, MCP464x and MCP466x). It then introduces the necessary
device tree binding to perform DT boot. Finally it fixes a typo in the
Kconfig.

Tested with MCP4561-103 and MCP4561-503 (DT boot).

Best regards,
Florian

---
Since v2:
- Fixed 7-bit/8-bit mix in the DT documentation
- Use a macro to declare compatibles in the macro, as suggested by Peter

Since v1:
- Applied Acks
- Moved the binding to i2c/trivial-devices.txt
- Fixed data pointer handling in struct of_device_id
- Renamed struct of_device_id to mcp4531_of_match
- New patch to fix typo in Kconfig


Florian Vaussard (4):
  iio: potentiometer: mcp4531: Add support for MCP454x, MCP456x, MCP464x
    and MCP466x
  iio: potentiometer: mcp4531: Add device tree binding documentation
  iio: potentiometer: mcp4531: Add device tree binding
  iio: potentiometer: Fix typo in Kconfig

 .../devicetree/bindings/i2c/trivial-devices.txt    |  64 +++++++++
 drivers/iio/potentiometer/Kconfig                  |  12 +-
 drivers/iio/potentiometer/mcp4531.c                | 159 ++++++++++++++++++++-
 3 files changed, 229 insertions(+), 6 deletions(-)

-- 
2.5.5

[toc] | [next] | [standalone]


#1434299 — [PATCH v3 4/4] iio: potentiometer: Fix typo in Kconfig

FromFlorian Vaussard <florian.vaussard@gmail.com>
Date2016-06-30 09:40 +0200
Subject[PATCH v3 4/4] iio: potentiometer: Fix typo in Kconfig
Message-ID<rPEJQ-6JB-9@gated-at.bofh.it>
In reply to#1434298
Fix s/potentiomenter/potentiometer/.

Suggested-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
---
 drivers/iio/potentiometer/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/potentiometer/Kconfig b/drivers/iio/potentiometer/Kconfig
index 55c2414..2e9da1c 100644
--- a/drivers/iio/potentiometer/Kconfig
+++ b/drivers/iio/potentiometer/Kconfig
@@ -10,7 +10,7 @@ config DS1803
 	depends on I2C
 	help
 	  Say yes here to build support for the Maxim Integrated DS1803
-	  digital potentiomenter chip.
+	  digital potentiometer chip.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called ds1803.
@@ -39,7 +39,7 @@ config MCP4131
 	  MCP4241, MCP4242,
 	  MCP4251, MCP4252,
 	  MCP4261, MCP4262,
-	  digital potentiomenter chips.
+	  digital potentiometer chips.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called mcp4131.
@@ -53,7 +53,7 @@ config MCP4531
 	  MCP4551, MCP4552, MCP4561, MCP4562,
 	  MCP4631, MCP4632, MCP4641, MCP4642,
 	  MCP4651, MCP4652, MCP4661, MCP4662
-	  digital potentiomenter chips.
+	  digital potentiometer chips.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called mcp4531.
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1435940 — Re: [PATCH v3 4/4] iio: potentiometer: Fix typo in Kconfig

FromJonathan Cameron <jic23@kernel.org>
Date2016-07-03 13:00 +0200
SubjectRe: [PATCH v3 4/4] iio: potentiometer: Fix typo in Kconfig
Message-ID<rQNi1-7FV-9@gated-at.bofh.it>
In reply to#1434299
On 30/06/16 08:34, Florian Vaussard wrote:
> Fix s/potentiomenter/potentiometer/.
> 
> Suggested-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
> Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch>
Applied.
> ---
>  drivers/iio/potentiometer/Kconfig | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/potentiometer/Kconfig b/drivers/iio/potentiometer/Kconfig
> index 55c2414..2e9da1c 100644
> --- a/drivers/iio/potentiometer/Kconfig
> +++ b/drivers/iio/potentiometer/Kconfig
> @@ -10,7 +10,7 @@ config DS1803
>  	depends on I2C
>  	help
>  	  Say yes here to build support for the Maxim Integrated DS1803
> -	  digital potentiomenter chip.
> +	  digital potentiometer chip.
>  
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called ds1803.
> @@ -39,7 +39,7 @@ config MCP4131
>  	  MCP4241, MCP4242,
>  	  MCP4251, MCP4252,
>  	  MCP4261, MCP4262,
> -	  digital potentiomenter chips.
> +	  digital potentiometer chips.
>  
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called mcp4131.
> @@ -53,7 +53,7 @@ config MCP4531
>  	  MCP4551, MCP4552, MCP4561, MCP4562,
>  	  MCP4631, MCP4632, MCP4641, MCP4642,
>  	  MCP4651, MCP4652, MCP4661, MCP4662
> -	  digital potentiomenter chips.
> +	  digital potentiometer chips.
>  
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called mcp4531.
> 

[toc] | [prev] | [next] | [standalone]


#1434302 — [PATCH v3 3/4] iio: potentiometer: mcp4531: Add device tree binding

FromFlorian Vaussard <florian.vaussard@gmail.com>
Date2016-06-30 09:40 +0200
Subject[PATCH v3 3/4] iio: potentiometer: mcp4531: Add device tree binding
Message-ID<rPEJQ-6JB-17@gated-at.bofh.it>
In reply to#1434298
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/potentiometer/mcp4531.c | 87 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 86 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/potentiometer/mcp4531.c b/drivers/iio/potentiometer/mcp4531.c
index 2251173..13b6ae2 100644
--- a/drivers/iio/potentiometer/mcp4531.c
+++ b/drivers/iio/potentiometer/mcp4531.c
@@ -31,6 +31,8 @@
 #include <linux/module.h>
 #include <linux/i2c.h>
 #include <linux/err.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include <linux/iio/iio.h>
 
@@ -188,12 +190,89 @@ static const struct iio_info mcp4531_info = {
 	.driver_module = THIS_MODULE,
 };
 
+#ifdef CONFIG_OF
+
+#define MCP4531_COMPATIBLE(of_compatible, cfg) {	\
+			.compatible = of_compatible,	\
+			.data = &mcp4531_cfg[cfg],	\
+}
+
+static const struct of_device_id mcp4531_of_match[] = {
+	MCP4531_COMPATIBLE("microchip,mcp4531-502", MCP453x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4531-103", MCP453x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4531-503", MCP453x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4531-104", MCP453x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4532-502", MCP453x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4532-103", MCP453x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4532-503", MCP453x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4532-104", MCP453x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4541-502", MCP454x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4541-103", MCP454x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4541-503", MCP454x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4541-104", MCP454x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4542-502", MCP454x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4542-103", MCP454x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4542-503", MCP454x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4542-104", MCP454x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4551-502", MCP455x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4551-103", MCP455x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4551-503", MCP455x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4551-104", MCP455x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4552-502", MCP455x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4552-103", MCP455x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4552-503", MCP455x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4552-104", MCP455x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4561-502", MCP456x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4561-103", MCP456x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4561-503", MCP456x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4561-104", MCP456x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4562-502", MCP456x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4562-103", MCP456x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4562-503", MCP456x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4562-104", MCP456x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4631-502", MCP463x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4631-103", MCP463x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4631-503", MCP463x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4631-104", MCP463x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4632-502", MCP463x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4632-103", MCP463x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4632-503", MCP463x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4632-104", MCP463x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4641-502", MCP464x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4641-103", MCP464x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4641-503", MCP464x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4641-104", MCP464x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4642-502", MCP464x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4642-103", MCP464x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4642-503", MCP464x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4642-104", MCP464x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4651-502", MCP465x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4651-103", MCP465x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4651-503", MCP465x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4651-104", MCP465x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4652-502", MCP465x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4652-103", MCP465x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4652-503", MCP465x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4652-104", MCP465x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4661-502", MCP466x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4661-103", MCP466x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4661-503", MCP466x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4661-104", MCP466x_104),
+	MCP4531_COMPATIBLE("microchip,mcp4662-502", MCP466x_502),
+	MCP4531_COMPATIBLE("microchip,mcp4662-103", MCP466x_103),
+	MCP4531_COMPATIBLE("microchip,mcp4662-503", MCP466x_503),
+	MCP4531_COMPATIBLE("microchip,mcp4662-104", MCP466x_104),
+	{ /* sentinel */ }
+};
+#endif
+
 static int mcp4531_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
 	struct device *dev = &client->dev;
 	struct mcp4531_data *data;
 	struct iio_dev *indio_dev;
+	const struct of_device_id *match;
 
 	if (!i2c_check_functionality(client->adapter,
 				     I2C_FUNC_SMBUS_WORD_DATA)) {
@@ -207,7 +286,12 @@ static int mcp4531_probe(struct i2c_client *client,
 	data = iio_priv(indio_dev);
 	i2c_set_clientdata(client, indio_dev);
 	data->client = client;
-	data->cfg = &mcp4531_cfg[id->driver_data];
+
+	match = of_match_device(of_match_ptr(mcp4531_of_match), dev);
+	if (match)
+		data->cfg = of_device_get_match_data(dev);
+	else
+		data->cfg = &mcp4531_cfg[id->driver_data];
 
 	indio_dev->dev.parent = dev;
 	indio_dev->info = &mcp4531_info;
@@ -290,6 +374,7 @@ MODULE_DEVICE_TABLE(i2c, mcp4531_id);
 static struct i2c_driver mcp4531_driver = {
 	.driver = {
 		.name	= "mcp4531",
+		.of_match_table = of_match_ptr(mcp4531_of_match),
 	},
 	.probe		= mcp4531_probe,
 	.id_table	= mcp4531_id,
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1434327 — Re: [PATCH v3 3/4] iio: potentiometer: mcp4531: Add device tree binding

FromFlorian Vaussard <florian.vaussard@heig-vd.ch>
Date2016-06-30 10:10 +0200
SubjectRe: [PATCH v3 3/4] iio: potentiometer: mcp4531: Add device tree binding
Message-ID<rPFcS-79h-31@gated-at.bofh.it>
In reply to#1434302

Le 30. 06. 16 à 09:46, Peter Rosin a écrit :
> 
> 
> On June 30, 2016 9:34:50 AM GMT+02:00, Florian Vaussard <florian.vaussard@gmail.com> 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>
> 
> Acked-by: Peter Rosin <peda@axentia.se>
> 

Thanks for your reviews Peter,

Best,
Florian

[toc] | [prev] | [next] | [standalone]


#1435938 — Re: [PATCH v3 3/4] iio: potentiometer: mcp4531: Add device tree binding

FromJonathan Cameron <jic23@kernel.org>
Date2016-07-03 13:00 +0200
SubjectRe: [PATCH v3 3/4] iio: potentiometer: mcp4531: Add device tree binding
Message-ID<rQNi1-7FV-13@gated-at.bofh.it>
In reply to#1434327
On 30/06/16 09:09, Florian Vaussard wrote:
> 
> 
> Le 30. 06. 16 à 09:46, Peter Rosin a écrit :
>>
>>
>> On June 30, 2016 9:34:50 AM GMT+02:00, Florian Vaussard <florian.vaussard@gmail.com> 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>
>>
>> Acked-by: Peter Rosin <peda@axentia.se>
>>
> 
> Thanks for your reviews Peter,
> 
Applied and thanks to Peter seconded.

Good little patch set.

Thanks,

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
> 

[toc] | [prev] | [next] | [standalone]


#1436135 — Re: [PATCH v3 3/4] iio: potentiometer: mcp4531: Add device tree binding

FromFlorian Vaussard <florian.vaussard@heig-vd.ch>
Date2016-07-04 09:00 +0200
SubjectRe: [PATCH v3 3/4] iio: potentiometer: mcp4531: Add device tree binding
Message-ID<rR61k-2jM-9@gated-at.bofh.it>
In reply to#1435938

On 07/03/2016 12:56 PM, Jonathan Cameron wrote:
> On 30/06/16 09:09, Florian Vaussard wrote:
>>
>>
>> Le 30. 06. 16 à 09:46, Peter Rosin a écrit :
>>>
>>>
>>> On June 30, 2016 9:34:50 AM GMT+02:00, Florian Vaussard <florian.vaussard@gmail.com> 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>
>>>
>>> Acked-by: Peter Rosin <peda@axentia.se>
>>>
>>
>> Thanks for your reviews Peter,
>>
> Applied and thanks to Peter seconded.
> 

Thanks,

Florian

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web