Support ROHM BD7910[0,1,2,3]
Subsystems (3)
Matti Vaittinen
maintainerv2 cover Support ROHM BD7910[0,1,2,3]
Add support for ROHM BD7910[0,1,2,3] ADCs.
The ROHM BD79100, BD79101, BD79102 and BD79103 are ADCs derived from the BD79104. According to the data-sheets, the BD79103 is compatible with the BD79104. Rest of the ICs have different number of analog input channels.
This series adds support for these ICs using the ti-adc128s052.c.
NOTE: There has been work on couple of other patch series [1][2] touching this same driver. I haven't considered those changes because, AFAICS, there has been no new revisions of these series since mid June.
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/
Revision history:
v1 => v2:
dt-bindings:
- Fix the fallback compatible for BD79103.
- Drop the excess 'items'
other:
- Rename the channel structs as discussed during v1 review.
Matti Vaittinen (4):
dt-bindings: iio: adc: Add BD7910[0,1,2,3]
iio: adc: adc128s052: Simplify matching chip_data
iio: adc: adc128s052: Rename channel structs
iio: adc: adc128s052: Support ROHM BD7910[0,1,2,3]
.../bindings/iio/adc/rohm,bd79104.yaml | 10 +- drivers/iio/adc/ti-adc128s052.c | 132 ++++++++++++------ 2 files changed, 95 insertions(+), 47 deletions(-)
base-commit: 856d7be7f3c459a6d646b1f8432c6f616ade0d10
Signature · 1 line
2.50.1
Matti Vaittinen
maintainerPATCH v2 1/4 dt-bindings: iio: adc: Add BD7910[0,1,2,3]
The ROHM BD79100, BD79101, BD79102, BD79103 are very similar ADCs as the ROHM BD79104. The BD79100 has only 1 channel. BD79101 has 2 channels and the BD79102 has 4 channels. Both BD79103 and BD79104 have 4 channels, and, based on the data sheets, they seem identical from the software point-of-view.
---
Revision history:
v1 => v2:
- Drop unnecessary "items"
- Fix the order of fallback compatible for the bd79103
--- .../devicetree/bindings/iio/adc/rohm,bd79104.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/iio/adc/rohm,bd79104.yaml +9 -1
@@ -14,7 +14,15 @@ description: | properties: compatible: - const: rohm,bd79104 + oneOf: + - enum: + - rohm,bd79100 + - rohm,bd79101 + - rohm,bd79102 + - rohm,bd79104 + - items: + - const: rohm,bd79103 + - const: rohm,bd79104 reg: maxItems: 1
Signature · 1 line
2.50.1
Re: [PATCH v2 1/4] dt-bindings: iio: adc: Add BD7910[0,1,2,3]
Matti Vaittinen
maintainerPATCH v2 2/4 iio: adc: adc128s052: Simplify matching chip_data
In reply to Matti VaittinenThe adc128s052 driver supports a few different ICs. IC specific configuration data is stored in an array. IC data, residing in a specific point of the array, is pointed from the SPI device match data.
There is no need to have the chip config data structures in an array and splitting them out of an array has at least following benefits:
- Chip-specific structures can be named after the chips they support. This makes referring them a tad cleaner, compared to using a generic array name with a numerical index.
- Avoid all potential 'out of bounds' errors which can result if the array is changed.
Split the chip configuration data array to individual structures.
---
Revision history:
v1 =>
- No changes
There are couple of other series[1][2] changing this driver ongoing. I haven't heard of those latelty (after JUN?) so those changes haven't been taken into account and will conflict if those serieses are re-spun. Please, let me know if I should rebase my changes.
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/
--- drivers/iio/adc/ti-adc128s052.c | 78 +++++++++++++++++---------------- 1 file changed, 41 insertions(+), 37 deletions(-)
drivers/iio/adc/ti-adc128s052.c +41 -37
@@ -124,26 +124,30 @@ static const struct iio_chan_spec adc124s021_channels[] = {static const char *const bd79104_regulators[] = {"iovdd" }; -static const struct adc128_configuration adc128_config[] = { - { - .channels = adc128s052_channels, - .num_channels =ARRAY_SIZE (adc128s052_channels), - .refname ="vref" , - }, { - .channels = adc122s021_channels, - .num_channels =ARRAY_SIZE (adc122s021_channels), - .refname ="vref" , - }, { - .channels = adc124s021_channels, - .num_channels =ARRAY_SIZE (adc124s021_channels), - .refname ="vref" , - }, { - .channels = adc128s052_channels, - .num_channels =ARRAY_SIZE (adc128s052_channels), - .refname ="vdd" , - .other_regulators = &bd79104_regulators, - .num_other_regulators =1 , - }, +static const struct adc128_configuration adc122s_config = { + .channels = adc122s021_channels, + .num_channels =ARRAY_SIZE (adc122s021_channels), + .refname ="vref" , +}; + +static const struct adc128_configuration adc124s_config = { + .channels = adc124s021_channels, + .num_channels =ARRAY_SIZE (adc124s021_channels), + .refname ="vref" , +}; + +static const struct adc128_configuration adc128s_config = { + .channels = adc128s052_channels, + .num_channels =ARRAY_SIZE (adc128s052_channels), + .refname ="vref" , +}; + +static const struct adc128_configuration bd79104_config = { + .channels = adc128s052_channels, + .num_channels =ARRAY_SIZE (adc128s052_channels), + .refname ="vdd" , + .other_regulators = &bd79104_regulators, + .num_other_regulators =1 , };static const struct iio_info adc128_info = {
@@ -199,33 +203,33 @@ static int adc128_probe(struct spi_device *spi) }static const struct of_device_id adc128_of_match[] = { - { .compatible ="ti,adc128s052" , .data = &adc128_config[0 ] }, - { .compatible ="ti,adc122s021" , .data = &adc128_config[1 ] }, - { .compatible ="ti,adc122s051" , .data = &adc128_config[1 ] }, - { .compatible ="ti,adc122s101" , .data = &adc128_config[1 ] }, - { .compatible ="ti,adc124s021" , .data = &adc128_config[2 ] }, - { .compatible ="ti,adc124s051" , .data = &adc128_config[2 ] }, - { .compatible ="ti,adc124s101" , .data = &adc128_config[2 ] }, - { .compatible ="rohm,bd79104" , .data = &adc128_config[3 ] }, + { .compatible ="ti,adc128s052" , .data = &adc128s_config }, + { .compatible ="ti,adc122s021" , .data = &adc122s_config }, + { .compatible ="ti,adc122s051" , .data = &adc122s_config }, + { .compatible ="ti,adc122s101" , .data = &adc122s_config }, + { .compatible ="ti,adc124s021" , .data = &adc124s_config }, + { .compatible ="ti,adc124s051" , .data = &adc124s_config }, + { .compatible ="ti,adc124s101" , .data = &adc124s_config }, + { .compatible ="rohm,bd79104" , .data = &bd79104_config }, { } };MODULE_DEVICE_TABLE (of, adc128_of_match);static const struct spi_device_id adc128_id[] = { - {"adc128s052" , (kernel_ulong_t)&adc128_config[0 ] }, - {"adc122s021" , (kernel_ulong_t)&adc128_config[1 ] }, - {"adc122s051" , (kernel_ulong_t)&adc128_config[1 ] }, - {"adc122s101" , (kernel_ulong_t)&adc128_config[1 ] }, - {"adc124s021" , (kernel_ulong_t)&adc128_config[2 ] }, - {"adc124s051" , (kernel_ulong_t)&adc128_config[2 ] }, - {"adc124s101" , (kernel_ulong_t)&adc128_config[2 ] }, - {"bd79104" , (kernel_ulong_t)&adc128_config[3 ] }, + {"adc128s052" , (kernel_ulong_t)&adc128s_config }, + {"adc122s021" , (kernel_ulong_t)&adc122s_config }, + {"adc122s051" , (kernel_ulong_t)&adc122s_config }, + {"adc122s101" , (kernel_ulong_t)&adc122s_config }, + {"adc124s021" , (kernel_ulong_t)&adc124s_config }, + {"adc124s051" , (kernel_ulong_t)&adc124s_config }, + {"adc124s101" , (kernel_ulong_t)&adc124s_config }, + {"bd79104" , (kernel_ulong_t)&bd79104_config }, { } };MODULE_DEVICE_TABLE (spi, adc128_id);static const struct acpi_device_id adc128_acpi_match[] = { - {"AANT1280" , (kernel_ulong_t)&adc128_config[2 ] }, + {"AANT1280" , (kernel_ulong_t)&adc124s_config }, { } };MODULE_DEVICE_TABLE (acpi, adc128_acpi_match);
Signature · 1 line
2.50.1
Matti Vaittinen
maintainerPATCH v2 3/4 iio: adc: adc128s052: Rename channel structs
In reply to Matti VaittinenThe adc128s052 can be used to drive a few other ADCs but the TI's ADCs it was originally intended for. The TI's IC variants model numbers don't (trivially) explain the channel configuration (for a reader working with other than TI's ICs).
Rename the channel configuration structures to explicitly explain they are used for simple ADCs, having 2, 4 or 8 channels.
---
Revision history:
v1 => v2:
- Rename channel configuration structs as discussed during review round 1.
--- drivers/iio/adc/ti-adc128s052.c | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/iio/adc/ti-adc128s052.c +17 -17
@@ -99,52 +99,52 @@ static int adc128_read_raw(struct iio_dev *indio_dev, .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) \ } -static const struct iio_chan_spec adc128s052_channels[] = { +static const struct iio_chan_spec simple_2chan_adc_channels[] = {ADC128_VOLTAGE_CHANNEL (0 ),ADC128_VOLTAGE_CHANNEL (1 ), -ADC128_VOLTAGE_CHANNEL (2 ), -ADC128_VOLTAGE_CHANNEL (3 ), -ADC128_VOLTAGE_CHANNEL (4 ), -ADC128_VOLTAGE_CHANNEL (5 ), -ADC128_VOLTAGE_CHANNEL (6 ), -ADC128_VOLTAGE_CHANNEL (7 ), }; -static const struct iio_chan_spec adc122s021_channels[] = { +static const struct iio_chan_spec simple_4chan_adc_channels[] = {ADC128_VOLTAGE_CHANNEL (0 ),ADC128_VOLTAGE_CHANNEL (1 ), +ADC128_VOLTAGE_CHANNEL (2 ), +ADC128_VOLTAGE_CHANNEL (3 ), }; -static const struct iio_chan_spec adc124s021_channels[] = { +static const struct iio_chan_spec simple_8chan_adc_channels[] = {ADC128_VOLTAGE_CHANNEL (0 ),ADC128_VOLTAGE_CHANNEL (1 ),ADC128_VOLTAGE_CHANNEL (2 ),ADC128_VOLTAGE_CHANNEL (3 ), +ADC128_VOLTAGE_CHANNEL (4 ), +ADC128_VOLTAGE_CHANNEL (5 ), +ADC128_VOLTAGE_CHANNEL (6 ), +ADC128_VOLTAGE_CHANNEL (7 ), };static const char *const bd79104_regulators[] = {"iovdd" };static const struct adc128_configuration adc122s_config = { - .channels = adc122s021_channels, - .num_channels =ARRAY_SIZE (adc122s021_channels), + .channels = simple_2chan_adc_channels, + .num_channels =ARRAY_SIZE (simple_2chan_adc_channels), .refname ="vref" , };static const struct adc128_configuration adc124s_config = { - .channels = adc124s021_channels, - .num_channels =ARRAY_SIZE (adc124s021_channels), + .channels = simple_4chan_adc_channels, + .num_channels =ARRAY_SIZE (simple_4chan_adc_channels), .refname ="vref" , };static const struct adc128_configuration adc128s_config = { - .channels = adc128s052_channels, - .num_channels =ARRAY_SIZE (adc128s052_channels), + .channels = simple_8chan_adc_channels, + .num_channels =ARRAY_SIZE (simple_8chan_adc_channels), .refname ="vref" , };static const struct adc128_configuration bd79104_config = { - .channels = adc128s052_channels, - .num_channels =ARRAY_SIZE (adc128s052_channels), + .channels = simple_8chan_adc_channels, + .num_channels =ARRAY_SIZE (simple_8chan_adc_channels), .refname ="vdd" , .other_regulators = &bd79104_regulators, .num_other_regulators =1 ,
Signature · 1 line
2.50.1
Matti Vaittinen
maintainerPATCH v2 4/4 iio: adc: adc128s052: Support ROHM BD7910[0,1,2,3]
In reply to Matti VaittinenThe ROHM BD79100, BD79101, BD79102, BD79103 are very similar ADCs as the ROHM BD79104. The BD79100 has only 1 channel. BD79101 has 2 channels and the BD79102 has 4 channels. Both BD79103 and BD79104 have 4 channels, and, based on the data sheets, they seem identical from the software point-of-view.
---
Revision history:
v1 => v2
- Rename channel structs as discussed in review round 1.
Tested only using the BD79104. The ROHM hardware colleagues swore this testing should be sufficient...
--- drivers/iio/adc/ti-adc128s052.c | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/iio/adc/ti-adc128s052.c +36 -0
@@ -99,6 +99,10 @@ static int adc128_read_raw(struct iio_dev *indio_dev, .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) \ } +static const struct iio_chan_spec simple_1chan_adc_channels[] = { +ADC128_VOLTAGE_CHANNEL (0 ), +}; +static const struct iio_chan_spec simple_2chan_adc_channels[] = {ADC128_VOLTAGE_CHANNEL (0 ),ADC128_VOLTAGE_CHANNEL (1 ),
@@ -142,6 +146,30 @@ static const struct adc128_configuration adc128s_config = { .refname = "vref", }; +static const struct adc128_configuration bd79100_config = { + .channels = simple_1chan_adc_channels, + .num_channels =ARRAY_SIZE (simple_1chan_adc_channels), + .refname ="vdd" , + .other_regulators = &bd79104_regulators, + .num_other_regulators =1 , +}; + +static const struct adc128_configuration bd79101_config = { + .channels = simple_2chan_adc_channels, + .num_channels =ARRAY_SIZE (simple_2chan_adc_channels), + .refname ="vdd" , + .other_regulators = &bd79104_regulators, + .num_other_regulators =1 , +}; + +static const struct adc128_configuration bd79102_config = { + .channels = simple_4chan_adc_channels, + .num_channels =ARRAY_SIZE (simple_4chan_adc_channels), + .refname ="vdd" , + .other_regulators = &bd79104_regulators, + .num_other_regulators =1 , +}; +static const struct adc128_configuration bd79104_config = { .channels = simple_8chan_adc_channels, .num_channels =ARRAY_SIZE (simple_8chan_adc_channels),
@@ -210,6 +238,10 @@ static const struct of_device_id adc128_of_match[] = { { .compatible = "ti,adc124s021", .data = &adc124s_config }, { .compatible = "ti,adc124s051", .data = &adc124s_config }, { .compatible = "ti,adc124s101", .data = &adc124s_config }, + { .compatible = "rohm,bd79100", .data = &bd79100_config }, + { .compatible = "rohm,bd79101", .data = &bd79101_config }, + { .compatible = "rohm,bd79102", .data = &bd79102_config }, + { .compatible = "rohm,bd79103", .data = &bd79104_config }, { .compatible = "rohm,bd79104", .data = &bd79104_config }, { } };
@@ -223,6 +255,10 @@ static const struct spi_device_id adc128_id[] = { { "adc124s021", (kernel_ulong_t)&adc124s_config }, { "adc124s051", (kernel_ulong_t)&adc124s_config }, { "adc124s101", (kernel_ulong_t)&adc124s_config }, + { "bd79100", (kernel_ulong_t)&bd79100_config }, + { "bd79101", (kernel_ulong_t)&bd79101_config }, + { "bd79102", (kernel_ulong_t)&bd79102_config }, + { "bd79103", (kernel_ulong_t)&bd79104_config }, { "bd79104", (kernel_ulong_t)&bd79104_config }, { } };
Signature · 1 line
2.50.1
Jonathan Cameron
maintainerQuoted 6 lines · On Mon, 18 Aug 2025 11:11:56 +0300 Matti Vaittinen <[email protected]>…
Add support for ROHM BD7910[0,1,2,3] ADCs.
The ROHM BD79100, BD79101, BD79102 and BD79103 are ADCs derived from the BD79104. According to the data-sheets, the BD79103 is compatible with the BD79104. Rest of the ICs have different number of analog input channels.
Quoted 8 lines
This series adds support for these ICs using the
ti-adc128s052.c.NOTE: There has been work on couple of other patch series [1][2] touching this same driver. I haven't considered those changes because, AFAICS, there has been no new revisions of these series since mid June.
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/
Pretty simple replies to the changes requested in v1 reviews and nice and clean so I'll gamble (a tiny bit) that everyone is happy with this and at least queue it up for build testing.
Applied to the togreg branch of iio.git and pushed out as testing for 0-day to have it's fun.
Jonathan
Quoted 21 lines
Revision history:
v1 => v2:
dt-bindings:
- Fix the fallback compatible for BD79103.
- Drop the excess 'items'
other:
- Rename the channel structs as discussed during v1 review.Matti Vaittinen (4):
dt-bindings: iio: adc: Add BD7910[0,1,2,3]
iio: adc: adc128s052: Simplify matchingchip_data
iio: adc: adc128s052: Rename channel structs
iio: adc: adc128s052: Support ROHM BD7910[0,1,2,3].../bindings/iio/adc/rohm,bd79104.yaml | 10 +- drivers/iio/adc/ti-adc128s052.c | 132 ++++++++++++------ 2 files changed, 95 insertions(+), 47 deletions(-)base-commit:
856d7be7f3c459a6d646b1f8432c6f616ade0d10
Quoted 15 lines · Jonathan Cameron
Quoted 12 lines · On Mon, 18 Aug 2025 11:11:56 +0300 Matti Vaittinen <[email protected]>…
Add support for ROHM BD7910[0,1,2,3] ADCs.
The ROHM BD79100, BD79101, BD79102 and BD79103 are ADCs derived from the BD79104. According to the data-sheets, the BD79103 is compatible with the BD79104. Rest of the ICs have different number of analog input channels.
This series adds support for these ICs using the
ti-adc128s052.c.NOTE: There has been work on couple of other patch series [1][2] touching this same driver. I haven't considered those changes because, AFAICS, there has been no new revisions of these series since mid June.
Quoted 7 lines
Quoted 2 lines
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/Pretty simple replies to the changes requested in v1 reviews and nice and clean so I'll gamble (a tiny bit) that everyone is happy with this and at least queue it up for build testing.
Jonathan Cameron
maintainerQuoted 16 lines · On Mon, 18 Aug 2025 13:46:12 -0500 David Lechner <[email protected]> wrote:
Quoted 15 lines · Jonathan Cameron
Quoted 12 lines · On Mon, 18 Aug 2025 11:11:56 +0300 Matti Vaittinen <[email protected]>…
Add support for ROHM BD7910[0,1,2,3] ADCs.
The ROHM BD79100, BD79101, BD79102 and BD79103 are ADCs derived from the BD79104. According to the data-sheets, the BD79103 is compatible with the BD79104. Rest of the ICs have different number of analog input channels.
This series adds support for these ICs using the
ti-adc128s052.c.NOTE: There has been work on couple of other patch series [1][2] touching this same driver. I haven't considered those changes because, AFAICS, there has been no new revisions of these series since mid June.
Quoted 9 lines
Quoted 7 lines
Quoted 2 lines
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/Pretty simple replies to the changes requested in v1 reviews and nice and clean so I'll gamble (a tiny bit) that everyone is happy with this and at least queue it up for build testing.
Reviewed-by David Lechner <[email protected]>
Thanks. Added to the 3 you hadn't tagged already.