Re: [PATCH 2/3] ASoC: qcom: q6dsp-lpass-clocks: Restore clocks after a DSP restart
From: Shawn Guo
Date: Mon Nov 30 2026 - 00:15:36 EST
On Sun, Nov 15, 2026 at 09:56:16AM +0000, Srinivas Kandagatla wrote:
> On 11/15/26 3:20 AM, Shawn Guo wrote:
> > The DSP forgets all clock requests and votes when it stops. A consumer
> > that still holds a clock prepared across a DSP restart then holds a
> > clock that the DSP no longer provides, and its later unprepare releases
> > a request the DSP never saw.
> >
> > Track which clocks are prepared, and add q6dsp_clock_dsp_down() and
> > q6dsp_clock_dsp_up() for the DSP service driver to call when the DSP
> > goes away and comes back. dsp_down() marks the prepared clocks as lost.
> > dsp_up() requests them again at their current rate, or votes for them
> > again. Unpreparing a lost clock skips the release, since the DSP holds
> > nothing for it.
> >
> > Fold the prepare/unprepare ops of rate and vote clocks into one pair,
> > so both kinds share the request/release helpers used by the restore
> > path. A mutex serializes prepare/unprepare against dsp_down/up.
> >
> > This patch does not change behaviour on its own: no driver calls the
> > new functions yet.
>
> Looks like you are hitting the devlink issue that decides to create
> provider link between remoteproc to clk consumer instead of prm clk
> controller to clk consumer.
Right, I see the same on here: pcm1681 has an active device link to
4c00000.remoteproc and none to the q6prm clock controller. The
controller's node has no device when the remoteproc binds, so
fw_devlink_pickup_dangling_consumers() moves its consumers up to the
remoteproc.
But fixing the supplier alone doesn't help. I hacked in the link
fw_devlink should have made (clock controller -> pcm1681, fw_devlink
flags). On ADSP stop the driver core unbinds pcm1681 as expected, but
nothing probes it again after the ADSP comes back: fw_devlink has
already consumed the fwnode link, so no new link is made to the new
controller device, and nothing re-probes a consumer whose supplier was
deleted and added again. The card never comes back, which is worse
than today. Only with the link re-added and pcm1681 attached by hand
does the card return.
So a devlink fix would need to re-create links and re-probe consumers
on every DSP restart, and would still tear down every codec that uses
a DSP clock. Keeping the controller across the restart and restoring
the clocks the DSP forgot is the smaller change, so v2 keeps that
approach. I'll add the devlink analysis to the commit message of
patch 3.
Shawn