Re: [PATCH v6 08/13] gpio: regmap: support write_data_after_dir and girq

From
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date
2026-09-04 11:56:05
Also in
linux-clk, linux-devicetree, linux-gpio, linux-serial, lkml
Reply to
Long Zhao, 2026-09-04
On Fri, Sep 04, 2026 at 02:38:15PM +0800, Long Zhao via B4 Relay wrote:

Thanks for this change, my comments below.
Add an optional write-after-direction-output quirk for controllers
that ignore data-register writes while a line is still configured as
input,
The chips that require this are buggy. Are you going to fix this HW in the next
version of the SoC?
and allow drivers to pass an existing gpio_irq_chip through
gpio_regmap_register() so IRQ setup can stay with the caller.
This needs to be in a separate update. Also we need to understand why
it is required. The caller should be able to create the respective IRQ
domain which is important.

...
struct gpio_regmap {
 	unsigned int reg_dir_out_base;
 	unsigned long *fixed_direction_mask;
 	unsigned long *fixed_direction_output;
+	bool write_data_after_dir;
Is `pahole` happy with the layout?
 #ifdef CONFIG_REGMAP_IRQ
 	int regmap_irq_line;
...
static int gpio_regmap_direction_output(struct gpio_chip *chip,
 	gpio_regmap_set(chip, offset, value);
^^^ (see below)
quoted hunk ↗ jump to hunk
 
-	return gpio_regmap_set_direction(chip, offset, true);
+	ret = gpio_regmap_set_direction(chip, offset, true);
+	if (ret)
+		return ret;
+
+	/* Some controllers ignore data writes while the line is still an input. */
+	if (gpio->write_data_after_dir)
+		gpio_regmap_set(chip, offset, value);
This can lead to two writes to the same register, the above needs to be
conditional as well.

-- 
With Best Regards,
Andy Shevchenko


Thread (46 messages) 46 messages, 8 authors, last reply 2026-09-14
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help