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

Andy Shevchenko andriy.shevchenko at linux.intel.com
Fri Sep 4 04:55:45 PDT 2026


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)

>  
> -	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





More information about the linux-arm-kernel mailing list