Support ROHM BD79112 ADC
| From: | Matti Vaittinen <mazziesaccount-AT-gmail.com> | |
| To: | Jonathan Cameron <jic23-AT-kernel.org>, David Lechner <dlechner-AT-baylibre.com>, Nuno Sá <nuno.sa-AT-analog.com>, Andy Shevchenko <andy-AT-kernel.org>, Rob Herring <robh-AT-kernel.org>, Krzysztof Kozlowski <krzk+dt-AT-kernel.org>, Conor Dooley <conor+dt-AT-kernel.org>, Matti Vaittinen <mazziesaccount-AT-gmail.com>, Linus Walleij <linus.walleij-AT-linaro.org>, Bartosz Golaszewski <brgl-AT-bgdev.pl> | |
| Subject: | [PATCH v5 0/3] Support ROHM BD79112 ADC | |
| Date: | Mon, 15 Sep 2025 10:11:23 +0300 | |
| Message-ID: | <20250915-bd79112-v5-0-a74e011a0560@gmail.com> | |
| Cc: | linux-iio-AT-vger.kernel.org, devicetree-AT-vger.kernel.org, linux-kernel-AT-vger.kernel.org, linux-gpio-AT-vger.kernel.org, Conor Dooley <conor.dooley-AT-microchip.com> | |
| Archive-link: | Article |
Support ROHM BD79112 ADC/GPIO The ROHM BD79112 is a 12-bit, 32 channel SAR ADC / GPIO IC. Or, a "Signal Monitor Hub IC" as data-sheet describes it. Data sheet states the maximum sampling rate to be 1 MSPS, but achieving this would probably require the SPI and samples to be processed by something else but the CPU running Linux. This could work with the "SPI offloading" which has recently landed upstream - but I have no HW to test this so nothing fancy is implemented here. It's still worth mentioning if someone needs the speed and wants to try implementing it :) The SPI protocol is slightly peculiar. Accesses are done in 16-bit sequences, separated by releasing and re-aquiring the chip-select. Register write takes 1 such sequence. The 8-bit register data to write, is stored in the last 8 bits. The high 8 bits contain register address and an I/O-bit which needs to be set for register accesses. Register read consists of two 16-bit sequences (separated by chip-select). First sequence has again the register address and an IO bit in the high byte. Additionally, reads must have a 'read bit' set. The last 8 bits must be zero. The register data will be carried in the last 8 bits of the next 16-bit sequence while high bits in reply are zero. ADC data reading is similar to register reading except: - No R/W bit or I/O bit should be set. - Register address is replaced by channel number (0 - 31). - Reply data is carried in the 12 low bits (instead of 8 bits) of the reply sequence. The protocol is implemented using custom regmap read() and write() operations. Other than that, pretty standard device and driver. Revision history: v4 => v5: - Minor driver changes - doc - SPI optimization - MAINTAINERS and dt-binding unchanged - Link to v4: https://lore.kernel.org/r/20250910-bd79112-v4-0-f82f43746... v3 => v4: - Fix Kconfig dependency (I2C => SPI) - Styling as suggested by Andy and Jonathan - Moved I/O documentation comment and read/write functions next to each other and tried clarifying the comment v2 => v3: - Mostly cosmetic changes to the driver - dt-bindings and MAINTAINERS unchanged v1 => v2: - Plenty of fixes to the driver (thanks to reviewers, Andy and David) - Add gpio-controller information to the device-tree bindings See individual patches for more accurate changelog --- To: Jonathan Cameron <jic23@kernel.org> To: David Lechner <dlechner@baylibre.com> To: Nuno Sá <nuno.sa@analog.com> To: Andy Shevchenko <andy@kernel.org> To: Rob Herring <robh@kernel.org> To: Krzysztof Kozlowski <krzk+dt@kernel.org> To: Conor Dooley <conor+dt@kernel.org> To: Matti Vaittinen <mazziesaccount@gmail.com> To: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> To: Linus Walleij <linus.walleij@linaro.org> To: Bartosz Golaszewski <brgl@bgdev.pl> Cc: linux-iio@vger.kernel.org Cc: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-gpio@vger.kernel.org --- Matti Vaittinen (3): dt-bindings: iio: adc: ROHM BD79112 ADC/GPIO iio: adc: Support ROHM BD79112 ADC/GPIO MAINTAINERS: Support ROHM BD79112 ADC .../devicetree/bindings/iio/adc/rohm,bd79112.yaml | 104 ++++ MAINTAINERS | 3 +- drivers/iio/adc/Kconfig | 10 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/rohm-bd79112.c | 550 +++++++++++++++++++++ 5 files changed, 667 insertions(+), 1 deletion(-) --- base-commit: d1487b0b78720b86ec2a2ac7acc683ec90627e5b change-id: 20250910-bd79112-436a087a5013 Best regards, -- Matti Vaittinen <mazziesaccount@gmail.com>
Attachment: signature.asc (type=application/pgp-signature)-----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmjHvBsACgkQeFA3/03a ocUijwf/TIWG2Yx/GJYf6+EPN0SAwyp/2z/AebFqy2n2AuYUhZcN/PrFxZp9FEhS kk1WSFb50J4z+GbFWLeoHHFGNFhlG81+wZVS7yfZdRsc/SSNqLq/UmjTAo8B8Qjj Gbx2v0g4elgDJUF9/Mm/fjramHHN78xamBEay1z7qe09Eg5YtKP3l5F+KIv4Oehx w4TOcT5/+utmfJ3lnxdoekSJn6SXPW7M53JvLZ0Wt7q4qdDdvgk/3s3EB9tLZDcg KibOB5bkzVWGJpUZOHeVaRTn439GtbOsNDmjE0VuyRnzg261BfVWJ/OW30M9pQ/1 PU61iNvc6GSx+XS4yeluIh9+Ye2i6w== =cHlS -----END PGP SIGNATURE-----
