Re: [PATCH 2/3] iio: adc: Support ROHM BD79112 ADC/GPIO
From: Matti Vaittinen <mazziesaccount@gmail.com>
Date: 2025-09-03 05:23:23
Also in:
linux-gpio, linux-iio, lkml
Hi deee Ho Linus, Long time no chat. Thanks for the review! On 03/09/2025 01:34, Linus Walleij wrote:
Hi Matti, On Tue, Sep 2, 2025 at 2:24 PM Matti Vaittinen [off-list ref] wrote:quoted
The ROHM BD79112 is an ADC/GPIO with 32 channels. The channel inputs can be used as ADC or GPIO. Using the GPIOs as IRQ sources isn't supported. The ADC is 12-bit, supporting input voltages up to 5.7V, and separate I/O voltage supply. Maximum SPI clock rate is 20 MHz (10 MHz with daisy-chain configuration) and maximum sampling rate is 1MSPS. The IC does also support CRC but it is not implemented in the driver. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>quoted
+static int bd79112_gpio_dir_get(struct gpio_chip *gc, unsigned int offset) +static int bd79112_gpio_get(struct gpio_chip *gc, unsigned int offset) +static int bd79112_gpio_set(struct gpio_chip *gc, unsigned int offset, + int value) +static int bd79112_gpio_set_multiple(struct gpio_chip *gc, unsigned long *mask, + unsigned long *bits) +static int bd79112_gpio_dir_set(struct bd79112_data *data, unsigned int offset, + int dir) +static int bd79112_gpio_input(struct gpio_chip *gc, unsigned int offset) +static int bd79112_gpio_output(struct gpio_chip *gc, unsigned int offset, + int value)This looks like it could use select GPIO_REGMAP #include <linux/gpio/regmap.h> struct gpio_regmap_config config = {}; etc. Did you check out the GPIO_REGMAP helper library?
I did - but that was couple of years ago :) I was very excited about it back then. I actually tried (tried hard, fingers almost bleeding) to write a patch to make it cover all of the ROHM PMIC GPIOs which I had to deal with. I thought it won't get it's full potential due to it's somewhat inflexible design. (And to tell the truth, I still believe so). Anyways, fast-forward to this day, I don't see it handling valid_mask. I think it is a must for this device/driver, where pins can be either GPIOs or ADC inputs. Yours, -- Matti