Re: [PATCH 5/6] gpio: ad7768: Add AD7768 GPIO auxiliary driver
From: Janani Sunil
Date: Tue Jul 14 2026 - 07:07:27 EST
On 7/9/26 13:05, Andy Shevchenko wrote:
On Thu, Jul 09, 2026 at 10:50:16AM +0200, Janani Sunil wrote:
The AD7768/AD7768-4 ADC exposes 5 general-purpose I/O pins that can be...
independently configured as inputs or outputs. Add an auxiliary bus driver
to expose these pins as a GPIO chip, registered by the parent IIO driver.
The driver uses the parent's regmap for register access and delegates
runtime power management to the parent device.
+ if (ret)
+ return ret;
+
+ return regmap_update_bits(st->regmap, AD7768_REG_GPIO_CONTROL,
+ BIT(offset), AD7768_GPIO_INPUT);
+}
So, I briefly looked at the implementation and I don't understand why
gpio-regmap can't be used. Do you need PM runtime there? It can be
done for all (if absent).
...
gpio-regmap does not naturally model the AD7768's direction dependent readback behavior.
On this device, GPIO Write data (0x0F) holds the latched output values and the GPIO Read Data (0x10) reads the logic input level only when the pins are configured as inputs. Using the generic gpio-regmap would always read 0x10 including output GPIOs.
The custom implementation preserves the device specific behavior.
Best Regards,
Janani Sunil