Re: [PATCH 2/3] iio: adc: Support ROHM BD79112 ADC/GPIO
From: Linus Walleij
Date: Tue Sep 02 2025 - 18:35:06 EST
Hi Matti,
On Tue, Sep 2, 2025 at 2:24 PM Matti Vaittinen <mazziesaccount@xxxxxxxxx> wrote:
> 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@xxxxxxxxx>
> +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? It can work wonders to reduce code
footprint, just git grep and look a bit at what the drivers
using it does.
Yours,
Linus Walleij