Re:Re: [PATCH v7 08/15] gpiolib: regmap: add write_data_after_dir quirk

From: zl020895

Date: Sun Sep 20 2026 - 23:54:09 EST


Hi Linus,

Thanks for the review. v8 will skip the pre-direction gpio_regmap_set() when
write_data_after_dir is set. The gpio_regmap_set() returns stay
ignored, per Andy.

0014: added your Reviewed-by.

Best regards,
Long Zhao

At 2026-09-21 06:02:48, "Linus Walleij" <linusw@xxxxxxxxxx> wrote:
>Hi Long,
>
>thanks for your patch!
>
>On Tue, Sep 15, 2026 at 1:15 PM Long Zhao via B4 Relay
><devnull+longzhao.ambarella.com@xxxxxxxxxx> wrote:
>
>
>> From: Long Zhao <longzhao@xxxxxxxxxxxxx>
>>
>> Some controllers ignore data-register writes while a line is still an
>> input. Optionally write the output value again after switching the
>> direction, matching the existing PL061 behaviour.
>>
>> Signed-off-by: Long Zhao <longzhao@xxxxxxxxxxxxx>
>
>OK I see.
>
>(...)
>
>
>> @@ -271,9 +272,22 @@ static int gpio_regmap_direction_output(struct gpio_chip *chip,
>> return ret;
>> }
>>
>> - gpio_regmap_set(chip, offset, value);
>> + ret = gpio_regmap_set(chip, offset, value);
>> + if (ret)
>> + return ret;
>
>if (!gpio->write_data_after_dir) {
> ret = gpio_regmap_set(chip, offset, value);
> if (ret)
> return ret;
>}
>
>There is no point in doing something you know will not
>work.
>
>> + ret = gpio_regmap_set_direction(chip, offset, true);
>> + if (ret)
>> + return ret;
>>
>> - return gpio_regmap_set_direction(chip, offset, true);
>> + /*
>> + * gpio value is set again, because pl061 doesn't allow to set value of
>> + * a gpio pin before configuring it in OUT mode.
>> + */
>> + if (gpio->write_data_after_dir)
>> + return gpio_regmap_set(chip, offset, value);
>
>Then there is Andy's comment as well.
>
>The rest looks good.
>
>Yours,
>Linus Walleij