Skip to content

Commit 9b808f7

Browse files
kwillis01nmenon
authored andcommitted
firmware: ti_sci: Convert CPU latency constraint from us to ms
Fix CPU resume latency constraint units sent to device manager through the TI SCI API. The device manager expects CPU resume latency to be in msecs which is passed in with the TI SCI API [1]. CPU latency constraints are set in userspace using the PM QoS framework which uses usecs as the unit. Since PM QoS uses usecs for units and the device manager expects msecs as the unit, TI SCI needs to convert from usecs to msecs before passing to device manager. [1] https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/pm/lpm.html#tisci-msg-lpm-set-latency-constraint Cc: [email protected] Fixes: a7a1575 ("firmware: ti_sci: add CPU latency constraint management") Signed-off-by: Kendall Willis <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Nishanth Menon <[email protected]>
1 parent c62bc66 commit 9b808f7

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/firmware/ti_sci.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Texas Instruments System Control Interface Protocol Driver
44
*
5-
* Copyright (C) 2015-2024 Texas Instruments Incorporated - https://www.ti.com/
5+
* Copyright (C) 2015-2025 Texas Instruments Incorporated - https://www.ti.com/
66
* Nishanth Menon
77
*/
88

@@ -3670,6 +3670,7 @@ static int __maybe_unused ti_sci_suspend(struct device *dev)
36703670
struct ti_sci_info *info = dev_get_drvdata(dev);
36713671
struct device *cpu_dev, *cpu_dev_max = NULL;
36723672
s32 val, cpu_lat = 0;
3673+
u16 cpu_lat_ms;
36733674
int i, ret;
36743675

36753676
if (info->fw_caps & MSG_FLAG_CAPS_LPM_DM_MANAGED) {
@@ -3682,9 +3683,16 @@ static int __maybe_unused ti_sci_suspend(struct device *dev)
36823683
}
36833684
}
36843685
if (cpu_dev_max) {
3685-
dev_dbg(cpu_dev_max, "%s: sending max CPU latency=%u\n", __func__, cpu_lat);
3686+
/*
3687+
* PM QoS latency unit is usecs, device manager uses msecs.
3688+
* Convert to msecs and round down for device manager.
3689+
*/
3690+
cpu_lat_ms = cpu_lat / USEC_PER_MSEC;
3691+
dev_dbg(cpu_dev_max, "%s: sending max CPU latency=%u ms\n", __func__,
3692+
cpu_lat_ms);
36863693
ret = ti_sci_cmd_set_latency_constraint(&info->handle,
3687-
cpu_lat, TISCI_MSG_CONSTRAINT_SET);
3694+
cpu_lat_ms,
3695+
TISCI_MSG_CONSTRAINT_SET);
36883696
if (ret)
36893697
return ret;
36903698
}

0 commit comments

Comments
 (0)