Re: [PATCH 1/6] ASoC: wcd938x: switch to using gpiod API

From: Krzysztof Kozlowski
Date: Thu Apr 20 2023 - 08:32:59 EST


On 20/04/2023 14:30, Krzysztof Kozlowski wrote:
> On 20/04/2023 13:58, Mark Brown wrote:
>> On Thu, Apr 20, 2023 at 12:16:12PM +0200, Krzysztof Kozlowski wrote:
>>
>>> - gpio_direction_output(wcd938x->reset_gpio, 0);
>>> - /* 20us sleep required after pulling the reset gpio to LOW */
>>> + gpiod_set_value_cansleep(wcd938x->reset_gpio, 1);
>>> + /* 20us sleep required after asserting the reset gpio */
>>
>> This is inverting the sense of the GPIO in the API from active low to
>> active high which will mean we're introducing a new reliance on having
>> the signal described as active low in DT. That's an ABI concern.
>
> It's bringing it to the correct level. Old code was not respecting the
> DTS thus if such DTS came with inverted design, the driver would not work.
>
> We were already fixing the upstream DTS users and I thought all of them
> are fixed since long time (half a year) or even correct from the
> beginning. Now I found one more case with incorrect level, which I will fix.

No, my bad - all upstream DTSes are corrected since half year.

>
>>
>> I remain deeply unconvinced that remapping active low outputs like this
>> in the GPIO API is helping.
>
> The code is mapping them to correct state. The previous state was
> incorrect and did not allow to handle active high (which can happen).
> This is the effort to make code correct - driver and DTS.

Best regards,
Krzysztof