From: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
To: "Liao, Bard" <bard.liao@intel.com>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
"broonie@kernel.org" <broonie@kernel.org>,
"tiwai@suse.de" <tiwai@suse.de>,
"linux-sound@vger.kernel.org" <linux-sound@vger.kernel.org>,
"vkoul@kernel.org" <vkoul@kernel.org>
Cc: "vinod.koul@linaro.org" <vinod.koul@linaro.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 00/15] ASoC/soundwire: Realtek codecs: wait codec init in hw_params
Date: Tue, 1 Jul 2025 12:33:02 +0200 [thread overview]
Message-ID: <fa12aacd-a8ef-4f3f-9d1f-3ae42c25b7e0@linux.dev> (raw)
In-Reply-To: <6e9878bc-856c-4319-b535-ab8f565f2460@linux.dev>
>> The main issue is that the codec could be attached after the codec resume.
>> Sometimes, it could take 100 ms or longer.
>
> I don't really see the problem here. The codec device (in the Linux sense) is trying to resume, and you want to wait until the hardware device is fully configured, no?
>
> Moving the waiting part is asking for trouble: the device will be reported as pm_runtime active, but it may not even be attached on the bus, and thus any register access will lead to invalid read/writes.
>
> For example, starting a register dump via debugfs would fail if the codec is not attached. The machine driver could also set jack status that would fail as well.
exhibit A for the last part: see rt700_set_jack_detect(). We absolutely want to make sure the device is attached *before* configuring the jack, that means waiting until pm_runtime_resume_and_get() is done.
So at at minimum, you would need to keep a wait_for_completion() in the resume method, but it could be demoted to a wait for the enumeration only. We do have to complete() for end of enumeration and end of initialization.
If it's the initialization that takes time, it could indeed be handled in a more asynchronous way, but I don't think you want to even think of a case where the codec finishes successfully its resume routine before the device is enumerated and can be used for register read/writes.
next prev parent reply other threads:[~2025-07-01 10:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 11:56 [PATCH 00/15] ASoC/soundwire: Realtek codecs: wait codec init in hw_params Bard Liao
2025-06-26 11:56 ` [PATCH 01/15] soundwire: add sdw_slave_wait_for_initialization helper Bard Liao
2025-06-26 11:56 ` [PATCH 02/15] ASoC: rt722: wait codec init in hw_params Bard Liao
2025-06-26 11:56 ` [PATCH 03/15] ASoC: rt712: " Bard Liao
2025-06-26 11:56 ` [PATCH 04/15] ASoC: rt1320: " Bard Liao
2025-06-26 11:56 ` [PATCH 05/15] ASoC: rt721: " Bard Liao
2025-06-26 11:56 ` [PATCH 06/15] ASoC: rt715-sdca: " Bard Liao
2025-06-26 11:56 ` [PATCH 07/15] ASoC: rt711-sdca: " Bard Liao
2025-06-26 11:56 ` [PATCH 08/15] ASoC: rt711: " Bard Liao
2025-06-26 11:56 ` [PATCH 09/15] ASoC: rt715: " Bard Liao
2025-06-26 11:56 ` [PATCH 10/15] ASoC: rt700: " Bard Liao
2025-06-26 11:56 ` [PATCH 11/15] ASoC: rt1316: " Bard Liao
2025-06-26 11:56 ` [PATCH 12/15] ASoC: rt1318: " Bard Liao
2025-06-26 11:56 ` [PATCH 13/15] ASoC: rt1308: " Bard Liao
2025-06-26 11:56 ` [PATCH 14/15] ASoC: rt5682: " Bard Liao
2025-06-26 11:56 ` [PATCH 15/15] ASoC: rt1017: " Bard Liao
2025-06-26 12:19 ` [PATCH 00/15] ASoC/soundwire: Realtek codecs: " Pierre-Louis Bossart
2025-06-27 6:53 ` Liao, Bard
2025-07-01 10:13 ` Pierre-Louis Bossart
2025-07-01 10:33 ` Pierre-Louis Bossart [this message]
2025-07-01 11:42 ` Liao, Bard
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=fa12aacd-a8ef-4f3f-9d1f-3ae42c25b7e0@linux.dev \
--to=pierre-louis.bossart@linux.dev \
--cc=bard.liao@intel.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=tiwai@suse.de \
--cc=vinod.koul@linaro.org \
--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;
as well as URLs for NNTP newsgroup(s).