linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] iio: adc: mcp320x: Fix NULL pointer.
@ 2015-07-22 16:04 Denis Carikli
  2015-07-22 16:04 ` [PATCH 2/4] iio: adc: ti-adc128s052: Add adc108s022 ID Denis Carikli
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Denis Carikli @ 2015-07-22 16:04 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring
  Cc: Eric Bénard, linux-iio, devicetree, Denis Carikli

Without that fix, adc->chip_info is NULL in mcp320x_read_raw

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
 drivers/iio/adc/mcp320x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c
index 8d9c9b9..fccb2dc 100644
--- a/drivers/iio/adc/mcp320x.c
+++ b/drivers/iio/adc/mcp320x.c
@@ -299,6 +299,7 @@ static int mcp320x_probe(struct spi_device *spi)
 	indio_dev->channels = chip_info->channels;
 	indio_dev->num_channels = chip_info->num_channels;
 
+	adc->chip_info = chip_info;
 	adc->transfer[0].tx_buf = &adc->tx_buf;
 	adc->transfer[0].len = sizeof(adc->tx_buf);
 	adc->transfer[1].rx_buf = adc->rx_buf;
-- 
2.4.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] iio: adc: ti-adc128s052: Add adc108s022 ID
  2015-07-22 16:04 [PATCH 1/4] iio: adc: mcp320x: Fix NULL pointer Denis Carikli
@ 2015-07-22 16:04 ` Denis Carikli
  2015-07-22 17:24   ` Michael Welling
  2015-08-02 17:01   ` Jonathan Cameron
  2015-07-22 16:04 ` [PATCH 3/4] iio: ti-adc128s052: Documentation: " Denis Carikli
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Denis Carikli @ 2015-07-22 16:04 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring
  Cc: Eric Bénard, linux-iio, devicetree, Denis Carikli

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
 drivers/iio/adc/Kconfig         | 6 +++---
 drivers/iio/adc/ti-adc128s052.c | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 233d47b..ae92f23 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -313,11 +313,11 @@ config TI_ADC081C
 	  called ti-adc081c.
 
 config TI_ADC128S052
-	tristate "Texas Instruments ADC128S052/ADC122S021"
+	tristate "Texas Instruments ADC128S052, ADC122S021 and ADC108S022"
 	depends on SPI
 	help
-	  If you say yes here you get support for Texas Instruments ADC128S052
-	  and ADC122S021 chips.
+	  If you say yes here you get support for Texas Instruments ADC128S052,
+	  ADC122S021 and ADC108S022 chips.
 
 	  This driver can also be built as a module. If so, the module will be
 	  called ti-adc128s052.
diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c
index 915be6b..8aca0ff 100644
--- a/drivers/iio/adc/ti-adc128s052.c
+++ b/drivers/iio/adc/ti-adc128s052.c
@@ -5,6 +5,7 @@
  * Datasheets can be found here:
  * http://www.ti.com/lit/ds/symlink/adc128s052.pdf
  * http://www.ti.com/lit/ds/symlink/adc122s021.pdf
+ * http://www.ti.com/lit/ds/symlink/adc108s022.pdf
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -177,6 +178,7 @@ static int adc128_remove(struct spi_device *spi)
 static const struct spi_device_id adc128_id[] = {
 	{ "adc128s052", 0},	/* index into adc128_config */
 	{ "adc122s021",	1},
+	{ "adc108s022", 1},
 	{ }
 };
 MODULE_DEVICE_TABLE(spi, adc128_id);
-- 
2.4.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] iio: ti-adc128s052: Documentation: Add adc108s022 ID
  2015-07-22 16:04 [PATCH 1/4] iio: adc: mcp320x: Fix NULL pointer Denis Carikli
  2015-07-22 16:04 ` [PATCH 2/4] iio: adc: ti-adc128s052: Add adc108s022 ID Denis Carikli
@ 2015-07-22 16:04 ` Denis Carikli
  2015-08-02 17:01   ` Jonathan Cameron
  2015-07-22 16:04 ` [PATCH 4/4] iio: adc: ti-adc128s052: Add devicetree support Denis Carikli
  2015-07-22 17:18 ` [PATCH 1/4] iio: adc: mcp320x: Fix NULL pointer Michael Welling
  3 siblings, 1 reply; 9+ messages in thread
From: Denis Carikli @ 2015-07-22 16:04 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring
  Cc: Eric Bénard, linux-iio, devicetree, Denis Carikli

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
 Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt b/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt
index 15ca6b4..c8a958d 100644
--- a/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt
+++ b/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt
@@ -1,7 +1,7 @@
-* Texas Instruments' ADC128S052 and ADC122S021 ADC chip
+* Texas Instruments' ADC128S052, ADC122S021 and ADC108S022 ADC chips
 
 Required properties:
- - compatible: Should be "ti,adc128s052" or "ti,adc122s021"
+ - compatible: Should be "ti,adc128s052", "ti,adc122s021" or "ti,adc108s022"
  - reg: spi chip select number for the device
  - vref-supply: The regulator supply for ADC reference voltage
 
-- 
2.4.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] iio: adc: ti-adc128s052: Add devicetree support
  2015-07-22 16:04 [PATCH 1/4] iio: adc: mcp320x: Fix NULL pointer Denis Carikli
  2015-07-22 16:04 ` [PATCH 2/4] iio: adc: ti-adc128s052: Add adc108s022 ID Denis Carikli
  2015-07-22 16:04 ` [PATCH 3/4] iio: ti-adc128s052: Documentation: " Denis Carikli
@ 2015-07-22 16:04 ` Denis Carikli
  2015-08-02 17:01   ` Jonathan Cameron
  2015-07-22 17:18 ` [PATCH 1/4] iio: adc: mcp320x: Fix NULL pointer Michael Welling
  3 siblings, 1 reply; 9+ messages in thread
From: Denis Carikli @ 2015-07-22 16:04 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring
  Cc: Eric Bénard, linux-iio, devicetree, Denis Carikli

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
 drivers/iio/adc/ti-adc128s052.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c
index 8aca0ff..2558508 100644
--- a/drivers/iio/adc/ti-adc128s052.c
+++ b/drivers/iio/adc/ti-adc128s052.c
@@ -13,10 +13,11 @@
  */
 
 #include <linux/err.h>
-#include <linux/spi/spi.h>
 #include <linux/module.h>
 #include <linux/iio/iio.h>
+#include <linux/of.h>
 #include <linux/regulator/consumer.h>
+#include <linux/spi/spi.h>
 
 struct adc128_configuration {
 	const struct iio_chan_spec	*channels;
@@ -183,10 +184,21 @@ static const struct spi_device_id adc128_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, adc128_id);
 
+#ifdef CONFIG_OF
+static const struct of_device_id adc128_of_match[] = {
+	{ .compatible = "ti,adc128s052" },
+	{ .compatible = "ti,adc122s021" },
+	{ .compatible = "ti,adc108s022" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, adc128_of_match);
+#endif
+
 static struct spi_driver adc128_driver = {
 	.driver = {
 		.name = "adc128s052",
 		.owner = THIS_MODULE,
+		.of_match_table = of_match_ptr(adc128_of_match),
 	},
 	.probe = adc128_probe,
 	.remove = adc128_remove,
-- 
2.4.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] iio: adc: mcp320x: Fix NULL pointer.
  2015-07-22 16:04 [PATCH 1/4] iio: adc: mcp320x: Fix NULL pointer Denis Carikli
                   ` (2 preceding siblings ...)
  2015-07-22 16:04 ` [PATCH 4/4] iio: adc: ti-adc128s052: Add devicetree support Denis Carikli
@ 2015-07-22 17:18 ` Michael Welling
  3 siblings, 0 replies; 9+ messages in thread
From: Michael Welling @ 2015-07-22 17:18 UTC (permalink / raw)
  To: Denis Carikli
  Cc: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
	Eric Bénard, linux-iio, devicetree

On Wed, Jul 22, 2015 at 06:04:21PM +0200, Denis Carikli wrote:
> Without that fix, adc->chip_info is NULL in mcp320x_read_raw
> 
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---
>  drivers/iio/adc/mcp320x.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c
> index 8d9c9b9..fccb2dc 100644
> --- a/drivers/iio/adc/mcp320x.c
> +++ b/drivers/iio/adc/mcp320x.c
> @@ -299,6 +299,7 @@ static int mcp320x_probe(struct spi_device *spi)
>  	indio_dev->channels = chip_info->channels;
>  	indio_dev->num_channels = chip_info->num_channels;
>  
> +	adc->chip_info = chip_info;
>  	adc->transfer[0].tx_buf = &adc->tx_buf;
>  	adc->transfer[0].len = sizeof(adc->tx_buf);
>  	adc->transfer[1].rx_buf = adc->rx_buf;

This issue has already been dealt with.

http://www.gossamer-threads.com/lists/linux/kernel/2214469

> -- 
> 2.4.5
> 
> --
> 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] 9+ messages in thread

* Re: [PATCH 2/4] iio: adc: ti-adc128s052: Add adc108s022 ID
  2015-07-22 16:04 ` [PATCH 2/4] iio: adc: ti-adc128s052: Add adc108s022 ID Denis Carikli
@ 2015-07-22 17:24   ` Michael Welling
  2015-08-02 17:01   ` Jonathan Cameron
  1 sibling, 0 replies; 9+ messages in thread
From: Michael Welling @ 2015-07-22 17:24 UTC (permalink / raw)
  To: Denis Carikli
  Cc: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
	Eric Bénard, linux-iio, devicetree

On Wed, Jul 22, 2015 at 06:04:22PM +0200, Denis Carikli wrote:

Where is the commit log?

https://www.kernel.org/doc/Documentation/SubmittingPatches

> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---
>  drivers/iio/adc/Kconfig         | 6 +++---
>  drivers/iio/adc/ti-adc128s052.c | 2 ++
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index 233d47b..ae92f23 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -313,11 +313,11 @@ config TI_ADC081C
>  	  called ti-adc081c.
>  
>  config TI_ADC128S052
> -	tristate "Texas Instruments ADC128S052/ADC122S021"
> +	tristate "Texas Instruments ADC128S052, ADC122S021 and ADC108S022"
>  	depends on SPI
>  	help
> -	  If you say yes here you get support for Texas Instruments ADC128S052
> -	  and ADC122S021 chips.
> +	  If you say yes here you get support for Texas Instruments ADC128S052,
> +	  ADC122S021 and ADC108S022 chips.
>  
>  	  This driver can also be built as a module. If so, the module will be
>  	  called ti-adc128s052.
> diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c
> index 915be6b..8aca0ff 100644
> --- a/drivers/iio/adc/ti-adc128s052.c
> +++ b/drivers/iio/adc/ti-adc128s052.c
> @@ -5,6 +5,7 @@
>   * Datasheets can be found here:
>   * http://www.ti.com/lit/ds/symlink/adc128s052.pdf
>   * http://www.ti.com/lit/ds/symlink/adc122s021.pdf
> + * http://www.ti.com/lit/ds/symlink/adc108s022.pdf
>   *
>   * This program is free software; you can redistribute it and/or modify
>   * it under the terms of the GNU General Public License version 2 as
> @@ -177,6 +178,7 @@ static int adc128_remove(struct spi_device *spi)
>  static const struct spi_device_id adc128_id[] = {
>  	{ "adc128s052", 0},	/* index into adc128_config */
>  	{ "adc122s021",	1},
> +	{ "adc108s022", 1},
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(spi, adc128_id);
> -- 
> 2.4.5
> 
> --
> 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] 9+ messages in thread

* Re: [PATCH 4/4] iio: adc: ti-adc128s052: Add devicetree support
  2015-07-22 16:04 ` [PATCH 4/4] iio: adc: ti-adc128s052: Add devicetree support Denis Carikli
@ 2015-08-02 17:01   ` Jonathan Cameron
  0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2015-08-02 17:01 UTC (permalink / raw)
  To: Denis Carikli, Lars-Peter Clausen, Rob Herring
  Cc: Eric Bénard, linux-iio, devicetree

On 22/07/15 17:04, Denis Carikli wrote:
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> ---
>  drivers/iio/adc/ti-adc128s052.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c
> index 8aca0ff..2558508 100644
> --- a/drivers/iio/adc/ti-adc128s052.c
> +++ b/drivers/iio/adc/ti-adc128s052.c
> @@ -13,10 +13,11 @@
>   */
>  
>  #include <linux/err.h>
> -#include <linux/spi/spi.h>
>  #include <linux/module.h>
>  #include <linux/iio/iio.h>
> +#include <linux/of.h>
>  #include <linux/regulator/consumer.h>
> +#include <linux/spi/spi.h>
Why the reorder?
>  
>  struct adc128_configuration {
>  	const struct iio_chan_spec	*channels;
> @@ -183,10 +184,21 @@ static const struct spi_device_id adc128_id[] = {
>  };
>  MODULE_DEVICE_TABLE(spi, adc128_id);
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id adc128_of_match[] = {
> +	{ .compatible = "ti,adc128s052" },
> +	{ .compatible = "ti,adc122s021" },
> +	{ .compatible = "ti,adc108s022" },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(of, adc128_of_match);
> +#endif
> +
>  static struct spi_driver adc128_driver = {
>  	.driver = {
>  		.name = "adc128s052",
>  		.owner = THIS_MODULE,
> +		.of_match_table = of_match_ptr(adc128_of_match),
>  	},
>  	.probe = adc128_probe,
>  	.remove = adc128_remove,
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] iio: adc: ti-adc128s052: Add adc108s022 ID
  2015-07-22 16:04 ` [PATCH 2/4] iio: adc: ti-adc128s052: Add adc108s022 ID Denis Carikli
  2015-07-22 17:24   ` Michael Welling
@ 2015-08-02 17:01   ` Jonathan Cameron
  1 sibling, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2015-08-02 17:01 UTC (permalink / raw)
  To: Denis Carikli, Lars-Peter Clausen, Rob Herring
  Cc: Eric Bénard, linux-iio, devicetree

On 22/07/15 17:04, Denis Carikli wrote:
> Signed-off-by: Denis Carikli <denis@eukrea.com>
Given this is a 10 bit convertor and the one you are effectively
claiming it is compatible with is a 12 bit convertor, you have
more to do in the driver than this (slightly!).

The issue is in adc128_read_raw which is assuming 12 bits for 
IIO_CHAN_INFO_SCALE.


> ---
>  drivers/iio/adc/Kconfig         | 6 +++---
>  drivers/iio/adc/ti-adc128s052.c | 2 ++
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index 233d47b..ae92f23 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -313,11 +313,11 @@ config TI_ADC081C
>  	  called ti-adc081c.
>  
>  config TI_ADC128S052
> -	tristate "Texas Instruments ADC128S052/ADC122S021"
> +	tristate "Texas Instruments ADC128S052, ADC122S021 and ADC108S022"
>  	depends on SPI
>  	help
> -	  If you say yes here you get support for Texas Instruments ADC128S052
> -	  and ADC122S021 chips.
> +	  If you say yes here you get support for Texas Instruments ADC128S052,
> +	  ADC122S021 and ADC108S022 chips.
>  
>  	  This driver can also be built as a module. If so, the module will be
>  	  called ti-adc128s052.
> diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c
> index 915be6b..8aca0ff 100644
> --- a/drivers/iio/adc/ti-adc128s052.c
> +++ b/drivers/iio/adc/ti-adc128s052.c
> @@ -5,6 +5,7 @@
>   * Datasheets can be found here:
>   * http://www.ti.com/lit/ds/symlink/adc128s052.pdf
>   * http://www.ti.com/lit/ds/symlink/adc122s021.pdf
> + * http://www.ti.com/lit/ds/symlink/adc108s022.pdf
>   *
>   * This program is free software; you can redistribute it and/or modify
>   * it under the terms of the GNU General Public License version 2 as
> @@ -177,6 +178,7 @@ static int adc128_remove(struct spi_device *spi)
>  static const struct spi_device_id adc128_id[] = {
>  	{ "adc128s052", 0},	/* index into adc128_config */
>  	{ "adc122s021",	1},
> +	{ "adc108s022", 1},
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(spi, adc128_id);
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/4] iio: ti-adc128s052: Documentation: Add adc108s022 ID
  2015-07-22 16:04 ` [PATCH 3/4] iio: ti-adc128s052: Documentation: " Denis Carikli
@ 2015-08-02 17:01   ` Jonathan Cameron
  0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2015-08-02 17:01 UTC (permalink / raw)
  To: Denis Carikli, Lars-Peter Clausen, Rob Herring
  Cc: Eric Bénard, linux-iio, devicetree

On 22/07/15 17:04, Denis Carikli wrote:
> Signed-off-by: Denis Carikli <denis@eukrea.com>
Part of the same job as patch 2. Please roll them into a single patch.
> ---
>  Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt b/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt
> index 15ca6b4..c8a958d 100644
> --- a/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt
> +++ b/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt
> @@ -1,7 +1,7 @@
> -* Texas Instruments' ADC128S052 and ADC122S021 ADC chip
> +* Texas Instruments' ADC128S052, ADC122S021 and ADC108S022 ADC chips
>  
>  Required properties:
> - - compatible: Should be "ti,adc128s052" or "ti,adc122s021"
> + - compatible: Should be "ti,adc128s052", "ti,adc122s021" or "ti,adc108s022"
>   - reg: spi chip select number for the device
>   - vref-supply: The regulator supply for ADC reference voltage
>  
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-08-02 17:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-22 16:04 [PATCH 1/4] iio: adc: mcp320x: Fix NULL pointer Denis Carikli
2015-07-22 16:04 ` [PATCH 2/4] iio: adc: ti-adc128s052: Add adc108s022 ID Denis Carikli
2015-07-22 17:24   ` Michael Welling
2015-08-02 17:01   ` Jonathan Cameron
2015-07-22 16:04 ` [PATCH 3/4] iio: ti-adc128s052: Documentation: " Denis Carikli
2015-08-02 17:01   ` Jonathan Cameron
2015-07-22 16:04 ` [PATCH 4/4] iio: adc: ti-adc128s052: Add devicetree support Denis Carikli
2015-08-02 17:01   ` Jonathan Cameron
2015-07-22 17:18 ` [PATCH 1/4] iio: adc: mcp320x: Fix NULL pointer Michael Welling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).