Re: [PATCH 1/2] scsi: ufs: ufs-qcom: Update PHY settings only when scaling to higher gears

From: Manivannan Sadhasivam
Date: Sat Sep 09 2023 - 09:58:38 EST


On Sat, Sep 09, 2023 at 01:04:52PM +0200, Konrad Dybcio wrote:
> On 8.09.2023 16:53, Manivannan Sadhasivam wrote:
> > The "hs_gear" variable is used to program the PHY settings (submode) during
> > ufs_qcom_power_up_sequence(). Currently, it is being updated every time the
> > agreed gear changes. Due to this, if the gear got downscaled before suspend
> > (runtime/system), then while resuming, the PHY settings for the lower gear
> > will be applied first and later when scaling to max gear with REINIT, the
> > PHY settings for the max gear will be applied.
> >
> > This adds a latency while resuming and also really not needed as the PHY
> > gear settings are backwards compatible i.e., we can continue using the PHY
> > settings for max gear with lower gear speed.
> >
> > So let's update the "hs_gear" variable _only_ when the agreed gear is
> > greater than the current one. This guarantees that the PHY settings will be
> > changed only during probe time and fatal error condition.
> >
> > Due to this, UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH can now be skipped
> > when the PM operation is in progress.
> >
> > Cc: stable@xxxxxxxxxxxxxxx
> > Fixes: 96a7141da332 ("scsi: ufs: core: Add support for reinitializing the UFS device")
> > Reported-by: Can Guo <quic_cang@xxxxxxxxxxx>
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
> > ---
> Would that not increase power consumption?
>
> I'd presume that the PHY needs to work harder at higher gear
> settings to preserve signal integrity with more data flow.
>
> And if so, would that power consumption increase be measurable?
> Or is it so small that it doesn't matter?
>

Well, the power consumption won't be much. Currently the PHY driver supports
only 2 PHY init sequence, default one (G3/G4) and G4/G5. When ufshcd decides to
run at G4/G5, second sequence would be used and for rest of the gears, first one
would be used. So even today, the G3/G4 sequence is used when ufshcd decides to
downscale to lowest gear G1.

Moreover, on future SoCs the init sequence won't be compatible i.e., we cannot
switch between them. For these reasons, it makes sense to stick to the init
sequence of max gear.

- Mani

> Konrad

--
மணிவண்ணன் சதாசிவம்