Re: [PATCH 2/2] soundwire: Intel: stop sdw clock in system suspend

From: Pierre-Louis Bossart

Date: Wed Jul 01 2026 - 08:00:47 EST


On 7/1/26 13:55, Pierre-Louis Bossart wrote:
>
>> If the Manager doesn't send a clock-stop, the peripherals don't get a
>> notification that they can enter a lower-power mode. The clock suddenly
>> disappears without warning and without the peripherals being notified
>> why, so they don't have any information to know what is happening.
>
> that's not quite right, see below.
>
>> The Manager should send a clock-stop notification before stopping the
>> clock.
>
> That's exactly the existing logic in drivers/soundwire/bus.c, the core does notify all peripheral drivers of a clock stop transition.
>
> sdw_slave_clk_stop_callback(slave, SDW_CLK_PRE_PREPARE);
> sdw_slave_clk_stop_callback(slave, SDW_CLK_POST_PREPARE);
>
> These pre- and post callback that can be used by the peripheral for imp-def actions.
>
> I am not sure if the POST_PREPARE makes sense, since the clock is already stopped the peripheral cannot be programmed. IIRC it was added for symmetry.
> The PRE_PREPARE is most likely what you are looking for in the implementation of the drv->ops->clk_stop callback.
>
> Hope this helps!

Oh and in the case of a system suspend, then you also get the notification in the driver suspend callback. In that case no need to be notified of the implicit bus teardown, you can program the peripheral to enter lower power. You do not need any clock stop mechanisms to deal with system suspend optimizations.