mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Mark Brown <broonie@kernel.org>
Cc: Vinod Koul <vkoul@kernel.org>,
	Bard Liao <yung-chuan.liao@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Sanyog Kale <sanyog.r.kale@intel.com>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Patrick Lai <quic_plai@quicinc.com>
Subject: Re: [PATCH 1/6] ASoC: wcd938x: switch to using gpiod API
Date: Thu, 20 Apr 2023 16:16:59 +0200	[thread overview]
Message-ID: <3eb0cbb4-f6d9-db8a-031e-92627e70f41e@linaro.org> (raw)
In-Reply-To: <d746ee5f-283d-44ce-b72c-18c8955d38b1@sirena.org.uk>

On 20/04/2023 15:00, Mark Brown wrote:
> On Thu, Apr 20, 2023 at 02:30:17PM +0200, 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.
> 
> Sure, but OTOH if the user didn't bother specifying as active low it
> would work.  I suspect it's more likely that someone missed a flag that
> had no practical impact in DT than that someone would add an inverter to
> their design.
> 
>> 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.
> 
> That's just upstream, what about any downstream users?

Life of downstream. We all know the drill: merge your DTS or suffer. The
WCD938x codecs are moderately new, so I do not expect many downstream
users. They are in theory possible, because driver was merged in
v5.14-rc1 and for the newest products Qualcomm uses v5.15. Although now
it is v5.15, but the time driver was merged, maybe it was v5.10.

I could rework this patch to provide backwards compatible solution like
I did for WSA:
https://lore.kernel.org/all/20230102114152.297305-4-krzysztof.kozlowski@linaro.org/

There are downsides of it, but as you pointed out - it's actually very
rare to have the signal inverted in hardware.

> 
>>> 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.
> 
> We could handle inversions through an explicit property if that were
> needed, that would be a less problematic transition and clearer in the
> consumer code.

I am not sure if it is worth. The DTS is supposed to describe hardware,
so even if reset pin flag was not effective, it is a mistake to describe
it as ACTIVE_HIGH. Do we care about keeping broken code happy? If yes,
then property is the way to go. If partially, then I can add
backwards-compatible approach like I mentioned above.

Best regards,
Krzysztof


  reply	other threads:[~2023-04-20 14:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 10:16 [PATCH 0/6] ASoC/soundwire: qcom: correctly probe devices after link init Krzysztof Kozlowski
2023-04-20 10:16 ` [PATCH 1/6] ASoC: wcd938x: switch to using gpiod API Krzysztof Kozlowski
2023-04-20 11:58   ` Mark Brown
2023-04-20 12:30     ` Krzysztof Kozlowski
2023-04-20 12:32       ` Krzysztof Kozlowski
2023-04-20 13:00       ` Mark Brown
2023-04-20 14:16         ` Krzysztof Kozlowski [this message]
2023-04-20 16:28           ` Mark Brown
2023-04-20 17:51             ` Krzysztof Kozlowski
2023-04-20 18:19               ` Mark Brown
2023-04-20 10:16 ` [PATCH 2/6] ASoC: codecs: wcd938x: Keep device in reset till bind Krzysztof Kozlowski
2023-04-20 10:16 ` [PATCH 3/6] ASoC: codecs: wcd938x: Check for enumeration before using TX device Krzysztof Kozlowski
2023-04-20 14:18   ` Pierre-Louis Bossart
2023-04-20 17:19     ` Mark Brown
2023-04-20 17:57     ` Krzysztof Kozlowski
2023-04-20 18:22       ` Mark Brown
2023-04-20 10:16 ` [PATCH 4/6] soundwire: qcom: drop unused struct qcom_swrm_ctrl members Krzysztof Kozlowski
2023-04-20 10:16 ` [PATCH 5/6] soudnwire: master: protect concurrecnt check for bus->md Krzysztof Kozlowski
2023-04-20 16:42   ` Pierre-Louis Bossart
2023-04-20 17:27     ` Krzysztof Kozlowski
2023-04-20 21:13       ` Pierre-Louis Bossart
2023-04-20 10:16 ` [PATCH 6/6] soundwire: qcom: do not probe devices before bus/link init Krzysztof Kozlowski
2023-04-20 21:37   ` Pierre-Louis Bossart
2023-05-01 12:24     ` Krzysztof Kozlowski
2023-05-01 13:43       ` Pierre-Louis Bossart
2023-05-03  8:00         ` Krzysztof Kozlowski
2023-05-03 14:11           ` Pierre-Louis Bossart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3eb0cbb4-f6d9-db8a-031e-92627e70f41e@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=agross@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=andersson@kernel.org \
    --cc=broonie@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=konrad.dybcio@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=quic_plai@quicinc.com \
    --cc=sanyog.r.kale@intel.com \
    --cc=tiwai@suse.com \
    --cc=vkoul@kernel.org \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®