iio: adc: add LTC2309 support
Subsystems (3)
cover iio: adc: add LTC2309 support
The LTC2309 is an 8-Channel, 12-Bit SAR ADC with an I2C Interface.
This implements support for all single-ended and differential channels, in unipolar mode only.
---
Liam Beguin (3):
iio: adc: add ltc2309 support
iio: adc: ltc2309: switch to new .probe()
dt-bindings: iio: adc: add lltc,ltc2309 bindings
.../devicetree/bindings/iio/adc/lltc,ltc2309.yaml | 52 +++++ drivers/iio/adc/Kconfig | 10 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ltc2309.c | 231 +++++++++++++++++++++ 4 files changed, 294 insertions(+)
---
base-commit: a5e505a99ca748583dbe558b691be1b26f05d678
change-id: 20230823-ltc2309-1945e1e94931
Best regards,
Signature · 1 line
Liam Beguin <[email protected]>
PATCH 1/3 iio: adc: add ltc2309 support
The LTC2309 is an 8-Channel, 12-Bit SAR ADC with an I2C Interface.
This implements support for all single-ended and differential channels, in unipolar mode only.
--- drivers/iio/adc/Kconfig | 10 ++ drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ltc2309.c | 232 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 243 insertions(+)
drivers/iio/adc/Kconfig +10 -0
@@ -607,6 +607,16 @@ config LPC32XX_ADC activate only one via device tree selection. Provides direct access via sysfs. +config LTC2309 + tristate "Linear Technology LTC2309 ADC driver" + depends on I2C + help + Say yes here to build support for Linear Technology LTC2309, a low + noise, low power, 8-channel, 12-bit SAR ADC + + This driver can also be built as a module. If so, the module will + be called ltc2309. + config LTC2471 tristate "Linear Technology LTC2471 and LTC2473 ADC driver" depends on I2C
drivers/iio/adc/Makefile +1 -0
@@ -56,6 +56,7 @@ obj-$(CONFIG_INTEL_MRFLD_ADC) += intel_mrfld_adc.o obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o obj-$(CONFIG_LPC18XX_ADC) += lpc18xx_adc.o obj-$(CONFIG_LPC32XX_ADC) += lpc32xx_adc.o +obj-$(CONFIG_LTC2309) += ltc2309.o obj-$(CONFIG_LTC2471) += ltc2471.o obj-$(CONFIG_LTC2485) += ltc2485.o obj-$(CONFIG_LTC2496) += ltc2496.o ltc2497-core.o
drivers/iio/adc/ltc2309.c new file +232 -0
232 lines not on this page · raw message
Signature · 1 line
2.39.0
Re: [PATCH 1/3] iio: adc: add ltc2309 support
Quoted 44 lines · Liam Beguin
The LTC2309 is an 8-Channel, 12-Bit SAR ADC with an I2C Interface.
This implements support for all single-ended and differential channels, in unipolar mode only.
Signed-off-by Liam Beguin <[email protected]>--- drivers/iio/adc/Kconfig | 10 ++ drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ltc2309.c | 232 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 243 insertions(+)drivers/iio/adc/ltc2309.c new file +29
-0+static int ltc2309_read_raw (struct iio_dev *indio_dev, +struct iio_chan_spec const *chan,int *val, +int *val2,long mask) +{ +struct ltc2309 *ltc2309 =iio_priv (indio_dev); +u16 buf; +int ret; +u8 din; + +mutex_lock (<c2309->lock); + +switch (mask) { +case IIO_CHAN_INFO_RAW : + din =FIELD_PREP (LTC2309_DIN_CH_MASK , chan->address &0x0f ) | +FIELD_PREP (LTC2309_DIN_UNI ,1 ) | +FIELD_PREP (LTC2309_DIN_SLEEP ,0 ); + + ret =i2c_smbus_write_byte (ltc2309->client, din); +if (ret <0 ) { +dev_err (ltc2309->dev,"i2c command failed: %pe\n" , +ERR_PTR (ret)); + goto out; + } + + ret =i2c_master_recv (ltc2309->client, (char *)&buf,2 ); +if (ret <0 ) { +dev_err (ltc2309->dev,"i2c read failed: %pe\n" , +ERR_PTR (ret)); + goto out;
drivers/iio/adc/ltc2309.c line 145
Quoted 10 lines
drivers/iio/adc/ltc2309.c new file +10
-0+ } + + *val =be16_to_cpu (buf) >>4 ; + + ret =IIO_VAL_INT ; +break ; +case IIO_CHAN_INFO_SCALE : + *val = ltc2309->vref_mv; + *val2 =LTC2309_ADC_RESOLUTION ; + ret =IIO_VAL_FRACTIONAL_LOG2 ;
Why this case is in critical section?
Quoted 40 lines
drivers/iio/adc/ltc2309.c new file +40
-0+break ; +default : + ret = -EINVAL ; +break ; + } + +out: +mutex_unlock (<c2309->lock); +return ret; +} + +static const struct iio_info ltc2309_info = { + .read_raw = ltc2309_read_raw, +}; + +static int ltc2309_probe (struct i2c_client *client, +const struct i2c_device_id *id) +{ +struct iio_dev *indio_dev; +struct ltc2309 *ltc2309; +int ret =0 ; + + indio_dev =devm_iio_device_alloc (&client->dev,sizeof (*ltc2309)); +if (!indio_dev) +return -ENOMEM ; + +i2c_set_clientdata (client, indio_dev); + + ltc2309 =iio_priv (indio_dev); + ltc2309->dev = &indio_dev->dev; + ltc2309->client = client; + ltc2309->vref_mv =4096 ;/* Default to the internal ref */ + + indio_dev->name =DRIVER_NAME ; + indio_dev->dev.parent = &client->dev; + indio_dev->modes =INDIO_DIRECT_MODE ; + indio_dev->channels = ltc2309_channels; + indio_dev->num_channels =ARRAY_SIZE (ltc2309_channels); + indio_dev->info = <c2309_info; +
drivers/iio/adc/ltc2309.c line 195
Quoted 10 lines
drivers/iio/adc/ltc2309.c new file +10
-0+ ltc2309->refcomp =devm_regulator_get_optional (&client->dev,"refcomp" ); +if (!IS_ERR_OR_NULL (ltc2309->refcomp)) { + ret =regulator_enable (ltc2309->refcomp); +if (ret) { +dev_err (ltc2309->dev,"failed to enable REFCOMP\n" ); +return ret; + } + + ret =regulator_get_voltage (ltc2309->refcomp); +if (ret <0 )
You have unbalanced regulator. Same in all further error paths.
drivers/iio/adc/ltc2309.c line 207
Quoted 12 lines
drivers/iio/adc/ltc2309.c new file +12
-0+return ret; + + ltc2309->vref_mv = ret /1000 ; +if (ret) +return ret; + } + +mutex_init (<c2309->lock); + +return devm_iio_device_register (&client->dev, indio_dev); +} +
Best regards,
Krzysztof
Re: [PATCH 1/3] iio: adc: add ltc2309 support
Quoted 49 lines · Krzysztof Kozlowski
Quoted 48 lines · Liam Beguin
The LTC2309 is an 8-Channel, 12-Bit SAR ADC with an I2C Interface.
This implements support for all single-ended and differential channels, in unipolar mode only.
Signed-off-by Liam Beguin <[email protected]>--- drivers/iio/adc/Kconfig | 10 ++ drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ltc2309.c | 232 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 243 insertions(+)(quoted diff) +33
-0+static int ltc2309_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, + int *val2, long mask) +{ + struct ltc2309 *ltc2309 = iio_priv(indio_dev); + u16 buf; + int ret; + u8 din; + + mutex_lock(<c2309->lock); + + switch (mask) { + case IIO_CHAN_INFO_RAW: + din = FIELD_PREP(LTC2309_DIN_CH_MASK, chan->address & 0x0f) | + FIELD_PREP(LTC2309_DIN_UNI, 1) | + FIELD_PREP(LTC2309_DIN_SLEEP, 0); + + ret = i2c_smbus_write_byte(ltc2309->client, din); + if (ret < 0) { + dev_err(ltc2309->dev, "i2c command failed: %pe\n", + ERR_PTR(ret)); + goto out; + } + + ret = i2c_master_recv(ltc2309->client, (char *)&buf, 2); + if (ret < 0) { + dev_err(ltc2309->dev, "i2c read failed: %pe\n", + ERR_PTR(ret)); + goto out; + } + + *val = be16_to_cpu(buf) >> 4; +
Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ ret = IIO_VAL_INT; + break; + case IIO_CHAN_INFO_SCALE: + *val = ltc2309->vref_mv; + *val2 = LTC2309_ADC_RESOLUTION; + ret = IIO_VAL_FRACTIONAL_LOG2;Why this case is in critical section?
my bad, I'll reduce it to INFO_RAW.
Quoted 44 lines
Quoted 44 lines
(quoted diff) +44
-0+ break; + default: + ret = -EINVAL; + break; + } + +out: + mutex_unlock(<c2309->lock); + return ret; +} + +static const struct iio_info ltc2309_info = { + .read_raw = ltc2309_read_raw, +}; + +static int ltc2309_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct iio_dev *indio_dev; + struct ltc2309 *ltc2309; + int ret = 0; + + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*ltc2309)); + if (!indio_dev) + return -ENOMEM; + + i2c_set_clientdata(client, indio_dev); + + ltc2309 = iio_priv(indio_dev); + ltc2309->dev = &indio_dev->dev; + ltc2309->client = client; + ltc2309->vref_mv = 4096; /* Default to the internal ref */ + + indio_dev->name = DRIVER_NAME; + indio_dev->dev.parent = &client->dev; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = ltc2309_channels; + indio_dev->num_channels = ARRAY_SIZE(ltc2309_channels); + indio_dev->info = <c2309_info; + + ltc2309->refcomp = devm_regulator_get_optional(&client->dev, "refcomp"); + if (!IS_ERR_OR_NULL(ltc2309->refcomp)) { + ret = regulator_enable(ltc2309->refcomp); + if (ret) {
Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ dev_err(ltc2309->dev, "failed to enable REFCOMP\n"); + return ret; + } + + ret = regulator_get_voltage(ltc2309->refcomp); + if (ret < 0)You have unbalanced regulator. Same in all further error paths.
Right, will fix.
I was going to add an action with devm_add_action_or_reset(), and noticed a lot of duplicate code adding a custom disable action. Does adding something like this make sense?
-- >8 --
drivers/regulator/devres.c +6 -1
@@ -70,12 +70,17 @@ struct regulator *devm_regulator_get_exclusive(struct device *dev, }EXPORT_SYMBOL_GPL (devm_regulator_get_exclusive); -static void regulator_action_disable (void *d) +/** +* regulator_action_disable - Generic disable action for managed resource +* @d: regulator to disable +*/ +void regulator_action_disable (void *d) {struct regulator *r = (struct regulator *)d;regulator_disable (r); } +EXPORT_SYMBOL_GPL (regulator_action_disable);static int _devm_regulator_get_enable (struct device *dev,const char *id,int get_type)
include/linux/regulator/consumer.h +2 -0
@@ -207,6 +207,8 @@ struct regulator *__must_check regulator_get_optional(struct device *dev, const char *id);struct regulator *__must_check devm_regulator_get_optional (struct device *dev,const char *id); + +void regulator_action_disable (void *d);int devm_regulator_get_enable (struct device *dev,const char *id);int devm_regulator_get_enable_optional (struct device *dev,const char *id);void regulator_put (struct regulator *regulator);
-- >8 --
This would let consumers reuse it directly with something like:
devm_add_action_or_reset(ltc2309->dev, regulator_action_disable, ltc2309->vref);
Maybe it should be a separate series, including the cleanup?
Quoted 5 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ return ret; + + ltc2309->vref_mv = ret / 1000; + if (ret) + return ret;
I just noticed this extra if. will remove too.
Quoted 12 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+ } + + mutex_init(<c2309->lock); + + return devm_iio_device_register(&client->dev, indio_dev); +} +Best regards,
Krzysztof
Thanks,
Liam
PATCH 2/3 iio: adc: ltc2309: switch to new .probe()
In reply to Liam BeguinRecent changes to the I2C subsystem removed the id parameter of the probe function. Update driver to use the new prototype, and keep this as an independent commit to facilitate backporting.
--- drivers/iio/adc/ltc2309.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/adc/ltc2309.c +1 -2
@@ -158,8 +158,7 @@ static const struct iio_info ltc2309_info = { .read_raw = ltc2309_read_raw, }; -static int ltc2309_probe (struct i2c_client *client, -const struct i2c_device_id *id) +static int ltc2309_probe (struct i2c_client *client) {struct iio_dev *indio_dev;struct ltc2309 *ltc2309;
Signature · 1 line
2.39.0
Re: [PATCH 2/3] iio: adc: ltc2309: switch to new .probe()
Quoted 14 lines · Liam Beguin
Recent changes to the I2C subsystem removed the id parameter of the probe function. Update driver to use the new prototype, and keep this as an independent commit to facilitate backporting.
Signed-off-by Liam Beguin <[email protected]>--- drivers/iio/adc/ltc2309.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/iio/adc/ltc2309.c +0
-0
drivers/iio/adc/ltc2309.c static const struct iio_info ltc2309_info = { · line 161
Quoted 6 lines
drivers/iio/adc/ltc2309.c +1
-2@@ -158,8 +158,7 @@ static const struct iio_info ltc2309_info = { .read_raw = ltc2309_read_raw, }; -static int ltc2309_probe (struct i2c_client *client, -const struct i2c_device_id *id) +static int ltc2309_probe (struct i2c_client *client)
This patch does not make sense. Do not send patch (1/3) which does not compile and is buggy, just to immediately fix it. We do not add known wrong code.
Best regards,
Krzysztof
Re: [PATCH 2/3] iio: adc: ltc2309: switch to new .probe()
Quoted 18 lines · Krzysztof Kozlowski
Quoted 17 lines · Liam Beguin
Recent changes to the I2C subsystem removed the id parameter of the probe function. Update driver to use the new prototype, and keep this as an independent commit to facilitate backporting.
Signed-off-by Liam Beguin <[email protected]>--- drivers/iio/adc/ltc2309.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/iio/adc/ltc2309.c +0
-0@@ -158,8 +158,7 @@ static const struct iio_info ltc2309_info = { .read_raw = ltc2309_read_raw, };
Quoted 7 lines
drivers/iio/adc/ltc2309.c static const struct iio_info ltc2309_info = { · line 161
Quoted 3 lines
drivers/iio/adc/ltc2309.c +1
-2-static int ltc2309_probe (struct i2c_client *client, -const struct i2c_device_id *id) +static int ltc2309_probe (struct i2c_client *client)This patch does not make sense. Do not send patch (1/3) which does not compile and is buggy, just to immediately fix it. We do not add known wrong code.
Sorry about that! You're right, I missed that 1/3 doesn't build without this change. I might've pressed send too quickly here..
Quoted 3 lines
Best regards,
Krzysztof
Thanks,
Liam
kernel test robot
build botRe: [PATCH 2/3] iio: adc: ltc2309: switch to new .probe()
In reply to Liam Beguinkernel test robot noticed the following build warnings:
Hi Liam,
kernel test robot noticed the following build warnings:
[auto build test WARNING on a5e505a99ca748583dbe558b691be1b26f05d678]
url: https://github.com/intel-lab-lkp/linux/commits/Liam-Beguin/iio-adc-add-ltc2309-support/20230825-005720 base: a5e505a99ca748583dbe558b691be1b26f05d678 patch link: https://lore.kernel.org/r/20230824-ltc2309-v1-2-b87b4eb8030c%40gmail.com patch subject: [PATCH 2/3] iio: adc: ltc2309: switch to new .probe() config: i386-randconfig-061-20230906 (https://download.01.org/0day-ci/archive/20230906/[email protected]/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230906/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/iio/adc/ltc2309.c:138:24: sparse: sparse: cast to restricted __be16
vim +138 drivers/iio/adc/ltc2309.c
a967828958b014 Liam Beguin 2023-08-24 106
a967828958b014 Liam Beguin 2023-08-24 107 static int ltc2309_read_raw(struct iio_dev *indio_dev,
a967828958b014 Liam Beguin 2023-08-24 108 struct iio_chan_spec const *chan, int *val,
a967828958b014 Liam Beguin 2023-08-24 109 int *val2, long mask)
a967828958b014 Liam Beguin 2023-08-24 110 {
a967828958b014 Liam Beguin 2023-08-24 111 struct ltc2309 *ltc2309 = iio_priv(indio_dev);
a967828958b014 Liam Beguin 2023-08-24 112 u16 buf;
a967828958b014 Liam Beguin 2023-08-24 113 int ret;
a967828958b014 Liam Beguin 2023-08-24 114 u8 din;
a967828958b014 Liam Beguin 2023-08-24 115
a967828958b014 Liam Beguin 2023-08-24 116 mutex_lock(<c2309->lock);
a967828958b014 Liam Beguin 2023-08-24 117
a967828958b014 Liam Beguin 2023-08-24 118 switch (mask) {
a967828958b014 Liam Beguin 2023-08-24 119 case IIO_CHAN_INFO_RAW:
a967828958b014 Liam Beguin 2023-08-24 120 din = FIELD_PREP(LTC2309_DIN_CH_MASK, chan->address & 0x0f) |
a967828958b014 Liam Beguin 2023-08-24 121 FIELD_PREP(LTC2309_DIN_UNI, 1) |
a967828958b014 Liam Beguin 2023-08-24 122 FIELD_PREP(LTC2309_DIN_SLEEP, 0);
a967828958b014 Liam Beguin 2023-08-24 123
a967828958b014 Liam Beguin 2023-08-24 124 ret = i2c_smbus_write_byte(ltc2309->client, din);
a967828958b014 Liam Beguin 2023-08-24 125 if (ret < 0) {
a967828958b014 Liam Beguin 2023-08-24 126 dev_err(ltc2309->dev, "i2c command failed: %pe\n",
a967828958b014 Liam Beguin 2023-08-24 127 ERR_PTR(ret));
a967828958b014 Liam Beguin 2023-08-24 128 goto out;
a967828958b014 Liam Beguin 2023-08-24 129 }
a967828958b014 Liam Beguin 2023-08-24 130
a967828958b014 Liam Beguin 2023-08-24 131 ret = i2c_master_recv(ltc2309->client, (char *)&buf, 2);
a967828958b014 Liam Beguin 2023-08-24 132 if (ret < 0) {
a967828958b014 Liam Beguin 2023-08-24 133 dev_err(ltc2309->dev, "i2c read failed: %pe\n",
a967828958b014 Liam Beguin 2023-08-24 134 ERR_PTR(ret));
a967828958b014 Liam Beguin 2023-08-24 135 goto out;
a967828958b014 Liam Beguin 2023-08-24 136 }
a967828958b014 Liam Beguin 2023-08-24 137
a967828958b014 Liam Beguin 2023-08-24 @138 *val = be16_to_cpu(buf) >> 4;
a967828958b014 Liam Beguin 2023-08-24 139
a967828958b014 Liam Beguin 2023-08-24 140 ret = IIO_VAL_INT;
a967828958b014 Liam Beguin 2023-08-24 141 break;
a967828958b014 Liam Beguin 2023-08-24 142 case IIO_CHAN_INFO_SCALE:
a967828958b014 Liam Beguin 2023-08-24 143 *val = ltc2309->vref_mv;
a967828958b014 Liam Beguin 2023-08-24 144 *val2 = LTC2309_ADC_RESOLUTION;
a967828958b014 Liam Beguin 2023-08-24 145 ret = IIO_VAL_FRACTIONAL_LOG2;
a967828958b014 Liam Beguin 2023-08-24 146 break;
a967828958b014 Liam Beguin 2023-08-24 147 default:
a967828958b014 Liam Beguin 2023-08-24 148 ret = -EINVAL;
a967828958b014 Liam Beguin 2023-08-24 149 break;
a967828958b014 Liam Beguin 2023-08-24 150 }
a967828958b014 Liam Beguin 2023-08-24 151
a967828958b014 Liam Beguin 2023-08-24 152 out:
a967828958b014 Liam Beguin 2023-08-24 153 mutex_unlock(<c2309->lock);
a967828958b014 Liam Beguin 2023-08-24 154 return ret;
a967828958b014 Liam Beguin 2023-08-24 155 }
a967828958b014 Liam Beguin 2023-08-24 156 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 3/3 dt-bindings: iio: adc: add lltc,ltc2309 bindings
In reply to Liam BeguinAdd devicetree bindings for the Linear Technology LTC2309 ADC driver.
--- .../devicetree/bindings/iio/adc/lltc,ltc2309.yaml | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+)
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +52 -0
@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/lltc,ltc2309.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Linear Technology / Analog Devices LTC2309 ADC + +maintainers: + - Liam Beguin <[email protected]> + +properties: + compatible: + enum: + - lltc,ltc2309 + + refcomp-supply: + description: Power supply for the reference voltage + + reg: + enum: + - 0x08 + - 0x09 + - 0x0a + - 0x0b + - 0x18 + - 0x19 + - 0x1a + - 0x1b + - 0x28 + + "#io-channel-cells": + const: 1 + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + adc@28 { + #io-channel-cells = <1>; + compatible = "lltc,ltc2309"; + reg = <0x28>; + }; + };
Signature · 1 line
2.39.0
Re: [PATCH 3/3] dt-bindings: iio: adc: add lltc,ltc2309 bindings
Quoted 3 lines · Liam Beguin
Add devicetree bindings for the Linear Technology LTC2309 ADC driver.
Signed-off-by Liam Beguin <[email protected]>
Thank you for your patch. There is something to discuss/improve.
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml line 1
Quoted 3 lines
+++
b/Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yamlDocumentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +1
-0@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0
Wrong license. Run checkpatch before sending patches.
Quoted 7 lines
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +7
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/lltc,ltc2309.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Linear Technology / Analog Devices LTC2309 ADC +
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml line 18
Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +10
-0+maintainers: + - Liam Beguin <[email protected]> + +properties: + compatible: + enum: + - lltc,ltc2309 + + refcomp-supply: + description: Power supply for the reference voltage
refcomp is not a supply. It is called "Reference Buffer Output.". You probably wanted vref-supply, which suggests you should just add it to ltc2497 bindings. I don't see any differences.
Quoted 22 lines
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +22
-0+ + reg: + enum: + - 0x08 + - 0x09 + - 0x0a + - 0x0b + - 0x18 + - 0x19 + - 0x1a + - 0x1b + - 0x28 + + "#io-channel-cells": + const: 1 + +required: + - compatible + - reg + +unevaluatedProperties: false +
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml line 50
Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +10
-0+examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + adc@28 { + #io-channel-cells = <1>; + compatible = "lltc,ltc2309"; + reg = <0x28>;
If the example stays, then order is compatible first, then reg, then the rest. Also add the supply to make example complete.
But I think this should be squashed with other binding so no need for the example.
Best regards,
Krzysztof
Re: [PATCH 3/3] dt-bindings: iio: adc: add lltc,ltc2309 bindings
Quoted 5 lines · Krzysztof Kozlowski
Quoted 3 lines · Liam Beguin
Add devicetree bindings for the Linear Technology LTC2309 ADC driver.
Signed-off-by Liam Beguin <[email protected]>
Quoted 8 lines
Thank you for your patch. There is something to discuss/improve.
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml line 1
Quoted 3 lines
+++
b/Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yamlDocumentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +1
-0@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0Wrong license. Run checkpatch before sending patches.
Sorry about that, I ran it through checkpatch but it didn't flag anything.
Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +11
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/lltc,ltc2309.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Linear Technology / Analog Devices LTC2309 ADC + +maintainers: + - Liam Beguin <[email protected]> + +properties:
Quoted 8 lines
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml line 18
Quoted 6 lines
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +6
-0+ compatible: + enum: + - lltc,ltc2309 + + refcomp-supply: + description: Power supply for the reference voltagerefcomp is not a supply. It is called "Reference Buffer Output.". You
That makes sense, I was going for the PIN name from the datasheet.
Quoted 3 lines
probably wanted vref-supply, which suggests you should just add it to ltc2497 bindings. I don't see any differences.
I hadn't thought of reusing an existing bindings file for a different driver. I'll update ltc2497.yaml instead since it avoids duplicating the whole file.
Quoted 27 lines
Quoted 27 lines
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +27
-0+ + reg: + enum: + - 0x08 + - 0x09 + - 0x0a + - 0x0b + - 0x18 + - 0x19 + - 0x1a + - 0x1b + - 0x28 + + "#io-channel-cells": + const: 1 + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>;
Quoted 8 lines
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml line 50
Quoted 5 lines
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +5
-0+ + adc@28 { + #io-channel-cells = <1>; + compatible = "lltc,ltc2309"; + reg = <0x28>;If the example stays, then order is compatible first, then reg, then the rest. Also add the supply to make example complete.
Thanks for pointing out the proper order.
Quoted 6 lines
But I think this should be squashed with other binding so no need for the example.
Best regards,
Krzysztof
Thanks for your time!
Liam
Re: [PATCH 3/3] dt-bindings: iio: adc: add lltc,ltc2309 bindings
Quoted 15 lines · Liam Beguin
Quoted 5 lines · Krzysztof Kozlowski
Quoted 3 lines · Liam Beguin
Add devicetree bindings for the Linear Technology LTC2309 ADC driver.
Signed-off-by Liam Beguin <[email protected]>Quoted 8 lines
Thank you for your patch. There is something to discuss/improve.
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml line 1
Quoted 3 lines
+++
b/Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yamlDocumentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +1
-0@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0Wrong license. Run checkpatch before sending patches.
Quoted 2 lines
Sorry about that, I ran it through checkpatch but it didn't flag anything.
No, you didn't, because checkpatch flags it easily:
WARNING: DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause)
#21: FILE: Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml:1:
+# SPDX-License-Identifier: GPL-2.0
total: 0 errors, 2 warnings, 52 lines checked
Best regards,
Krzysztof
Re: [PATCH 3/3] dt-bindings: iio: adc: add lltc,ltc2309 bindings
Hi Krzysztof,
Quoted 19 lines · Krzysztof Kozlowski
Quoted 15 lines · Liam Beguin
Quoted 5 lines · Krzysztof Kozlowski
Quoted 3 lines · Liam Beguin
Add devicetree bindings for the Linear Technology LTC2309 ADC driver.
Signed-off-by Liam Beguin <[email protected]>Quoted 8 lines
Thank you for your patch. There is something to discuss/improve.
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml line 1
Quoted 3 lines
+++
b/Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yamlDocumentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +1
-0@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0Wrong license. Run checkpatch before sending patches.
Quoted 2 lines
Sorry about that, I ran it through checkpatch but it didn't flag anything.
Quoted 8 lines
No, you didn't, because checkpatch flags it easily:
WARNING: DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause)
#21: FILE:Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml:1:
+# SPDX-License-Identifier: GPL-2.0total: 0 errors, 2 warnings, 52 lines checked
It seems like I wasn't running checkpatch in strict mode. Thanks for pointing that out.
Quoted 3 lines
Best regards,
Krzysztof
Cheers,
Liam
Re: [PATCH 3/3] dt-bindings: iio: adc: add lltc,ltc2309 bindings
Quoted 24 lines · Liam Beguin
Hi Krzysztof,
Quoted 21 lines · Krzysztof Kozlowski
Quoted 15 lines · Liam Beguin
Quoted 5 lines · Krzysztof Kozlowski
Quoted 3 lines · Liam Beguin
Add devicetree bindings for the Linear Technology LTC2309 ADC driver.
Signed-off-by Liam Beguin <[email protected]>Quoted 8 lines
Thank you for your patch. There is something to discuss/improve.
Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml line 1
Quoted 3 lines
+++
b/Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yamlDocumentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml new file +1
-0@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0Wrong license. Run checkpatch before sending patches.
Quoted 2 lines
Sorry about that, I ran it through checkpatch but it didn't flag anything.
No, you didn't, because checkpatch flags it easily:
Quoted 8 lines
Quoted 6 lines
WARNING: DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause)
#21: FILE:Documentation/devicetree/bindings/iio/adc/lltc,ltc2309.yaml:1:
+# SPDX-License-Identifier: GPL-2.0total: 0 errors, 2 warnings, 52 lines checked
It seems like I wasn't running checkpatch in strict mode.
No. This was not a strict mode but a regular run. I don't understand why you are turning this all the time around... You can easily check by yourself and reproduce the warning any time.
Best regards,
Krzysztof