RE: [PATCH 2/2] soundwire: record Peripheral scale_index

From: Liao, Bard

Date: Tue Apr 28 2026 - 04:06:26 EST




> > -----Original Message-----
> > From: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
> > Sent: Wednesday, March 25, 2026 7:42 PM
> > To: linux-sound@xxxxxxxxxxxxxxx; vkoul@xxxxxxxxxx
> > Cc: vinod.koul@xxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; pierre-
> > louis.bossart@xxxxxxxxx; peter.ujfalusi@xxxxxxxxxxxxxxx; Liao, Bard
> > <bard.liao@xxxxxxxxx>
> > Subject: [PATCH 2/2] soundwire: record Peripheral scale_index
> >
> > Currently, we program bus clock scale index unconditionally. It is not
> > necessary if the new index is the same as the current one.
> >
> > Signed-off-by: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
> > Reviewed-by: Simon Trimmer <simont@xxxxxxxxxxxxxxxxxxxxx>
> > Reviewed-by: Péter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx>
> > Reviewed-by: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx>
> > ---

> > manager_runtime:
> > diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
> > index 6147eb1fb210..0845182f75f9 100644
> > --- a/include/linux/soundwire/sdw.h
> > +++ b/include/linux/soundwire/sdw.h
> > @@ -661,6 +661,7 @@ struct sdw_slave_ops {
> > * protocol for SoundWire mockup devices
> > * @sdw_dev_lock: mutex used to protect callbacks/remove races
> > * @sdca_data: structure containing all device data for SDCA helpers
> > + * @scale_index: current bus clock scaling index
> > */
> > struct sdw_slave {
> > struct sdw_slave_id id;
> > @@ -686,6 +687,7 @@ struct sdw_slave {
> > bool is_mockup_device;
> > struct mutex sdw_dev_lock; /* protect callbacks/remove races */
> > struct sdca_device_data sdca_data;
> > + unsigned int scale_index;
>
> We need to store the scale index for both banks.
> Will update in v2.

On second thought, the benefits of this commit don't outweigh the effort
of maintaining the scale_index register. I will drop it and resend the first
commit.

>
> > };
> >
> > #define dev_to_sdw_dev(_dev) container_of(_dev, struct sdw_slave, dev)
> > --
> > 2.43.0