iio: adc: mcp320x: Fix NULL pointer.
Subsystems (3)
PATCH 1/4 iio: adc: mcp320x: Fix NULL pointer.
Without that fix, adc->chip_info is NULL in mcp320x_read_raw
--- drivers/iio/adc/mcp320x.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/adc/mcp320x.c +1 -0
@@ -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;
Signature · 1 line
2.4.5
PATCH 2/4 iio: adc: ti-adc128s052: Add adc108s022 ID
In reply to a message not in the archive--- drivers/iio/adc/Kconfig | 6 +++--- drivers/iio/adc/ti-adc128s052.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/iio/adc/Kconfig +3 -3
@@ -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.
drivers/iio/adc/ti-adc128s052.c +2 -0
@@ -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);
Signature · 1 line
2.4.5
PATCH 3/4 iio: ti-adc128s052: Documentation: Add adc108s022 ID
In reply to a message not in the archive--- Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt +2 -2
@@ -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
Signature · 1 line
2.4.5
PATCH 4/4 iio: adc: ti-adc128s052: Add devicetree support
In reply to a message not in the archive--- drivers/iio/adc/ti-adc128s052.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/iio/adc/ti-adc128s052.c +13 -1
@@ -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,
Signature · 1 line
2.4.5
Quoted 12 lines · Denis Carikli
Without that fix,
adc->chip_infois NULL inmcp320x_read_rawSigned-off-by Denis Carikli <[email protected]>--- drivers/iio/adc/mcp320x.c | 1 + 1 file changed, 1 insertion(+)drivers/iio/adc/mcp320x.c +0
-0
drivers/iio/adc/mcp320x.c static int mcp320x_probe(struct spi_device *spi) · line 305
Quoted 7 lines
drivers/iio/adc/mcp320x.c +1
-0@@ -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.
Quoted 7 lines
Signature · 6 lines
2.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/4] iio: adc: ti-adc128s052: Add adc108s022 ID
In reply to a message not in the archiveOn Wed, Jul 22, 2015 at 06:04:22PM +0200, Denis Carikli wrote:
Where is the commit log?
https://www.kernel.org/doc/Documentation/SubmittingPatches
Quoted 52 lines
Signed-off-by Denis Carikli <[email protected]>--- drivers/iio/adc/Kconfig | 6 +++--- drivers/iio/adc/ti-adc128s052.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-)drivers/iio/adc/Kconfig +3
-3@@ -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.drivers/iio/adc/ti-adc128s052.c +2
-0@@ -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);Signature · 6 lines
2.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/4] iio: adc: ti-adc128s052: Add devicetree support
In reply to a message not in the archiveQuoted 10 lines · Denis Carikli
Signed-off-by Denis Carikli <[email protected]>--- drivers/iio/adc/ti-adc128s052.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/iio/adc/ti-adc128s052.c +0
-0
drivers/iio/adc/ti-adc128s052.c line 20
Quoted 9 lines
drivers/iio/adc/ti-adc128s052.c +2
-1@@ -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?
Quoted 26 lines
drivers/iio/adc/ti-adc128s052.c +11
-0struct 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,
Re: [PATCH 2/4] iio: adc: ti-adc128s052: Add adc108s022 ID
In reply to a message not in the archiveQuoted 1 line · Denis Carikli
Signed-off-by Denis Carikli <[email protected]>
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.
Quoted 45 lines
--- drivers/iio/adc/Kconfig | 6 +++--- drivers/iio/adc/ti-adc128s052.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-)drivers/iio/adc/Kconfig +3
-3@@ -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.drivers/iio/adc/ti-adc128s052.c +2
-0@@ -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);
Re: [PATCH 3/4] iio: ti-adc128s052: Documentation: Add adc108s022 ID
In reply to a message not in the archiveQuoted 1 line · Denis Carikli
Signed-off-by Denis Carikli <[email protected]>
Part of the same job as patch 2. Please roll them into a single patch.
Quoted 19 lines
--- Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt +2
-2@@ -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