Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH 0/3] devfreq: check the get_cur_freq() return value and use it in ufshcd
@ 2026-08-31 13:01 Bean Huo
  2026-08-31 13:01 ` [PATCH 1/3] PM / devfreq: Fall back to previous_freq when get_cur_freq() fails Bean Huo
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Bean Huo @ 2026-08-31 13:01 UTC (permalink / raw)
  To: MyungJoo Ham, Kyungmin Park, Chanwoo Choi, Martin K . Petersen,
	James E . J . Bottomley
  Cc: Alim Akhtar, Avri Altman, Bart Van Assche, Jie Zhan,
	Krzysztof Kozlowski, linux-pm, linux-scsi, linux-kernel, Bean Huo

The devfreq core has three users of the optional ->get_cur_freq()
callback. Two of them check the return value, the third one does not and
passes an uninitialized frequency to the transition notifiers when the
callback fails. Patch 1 fixes this.

Patch 3 adds the callback to ufshcd. Without it the cur_freq attribute
shows the last frequency the governor selected, which is wrong whenever
the controller is scaled outside the governor, for example after writing
0 to clkscale_enable.

The patches touch two subsystems. Patches 1 and 2 are for the devfreq
tree and patch 3 is for the SCSI tree. They do not depend on each other
at build time and can be applied separately. Patch 3 only needs patch 1
for the error case described above, which requires OPPs and happens
before the controller is scaled for the first time.

Tested on a Radxa Dragon Q6A with UFS 3.1, with patch 3 applied:

  before "echo 0 > clkscale_enable":  cur_freq 75000000, target_freq 75000000
  after  "echo 0 > clkscale_enable":  cur_freq 300000000, target_freq 75000000

Before patch 3 both files report 75000000 and keep doing so for as long
as clock scaling stays disabled.

Clock scaling itself still works. A 4 GiB direct read moved the controller to
300000000 and back, and trans_stat recorded it.

Bean Huo (3):
  PM / devfreq: Fall back to previous_freq when get_cur_freq() fails
  PM / devfreq: Add more details to the get_cur_freq() comment
  scsi: ufs: core: Report the current clock frequency to devfreq

 drivers/devfreq/devfreq.c |  5 ++---
 drivers/ufs/core/ufshcd.c | 32 ++++++++++++++++++++++++++++++++
 include/linux/devfreq.h   |  7 +++++--
 3 files changed, 39 insertions(+), 5 deletions(-)


base-commit: e30626823a406725ce29bc75cb8ec467d3e1e326
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-04  1:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 13:01 [PATCH 0/3] devfreq: check the get_cur_freq() return value and use it in ufshcd Bean Huo
2026-08-31 13:01 ` [PATCH 1/3] PM / devfreq: Fall back to previous_freq when get_cur_freq() fails Bean Huo
2026-08-31 13:01 ` [PATCH 2/3] PM / devfreq: Add more details to the get_cur_freq() comment Bean Huo
2026-08-31 13:01 ` [PATCH 3/3] scsi: ufs: core: Report the current clock frequency to devfreq Bean Huo
2026-09-01  1:33   ` Stanley Jhu
2026-09-03 21:33     ` Bean Huo
2026-09-04  1:29       ` Stanley Jhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox