Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PM / devfreq: Switch to dev_pm_opp_find_freq_{ceil/floor}_indexed() APIs

Some devfreq consumers like UFS driver need to work with multiple clocks
through the OPP framework. For this reason, OPP framework exposes the
_indexed() APIs for finding the floor/ceil of the supplied frequency of
the indexed clock. So let's use them in the devfreq driver.

Currently, the clock index of 0 is used which works fine for multiple as
well as single clock.

Link: https://lore.kernel.org/all/20231003111232.42663-3-manivannan.sadhasivam@linaro.org/
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

authored by

Manivannan Sadhasivam and committed by
Chanwoo Choi
8b3bd6ff d2805601

+7 -7
+7 -7
drivers/devfreq/devfreq.c
··· 88 88 struct dev_pm_opp *opp; 89 89 unsigned long min_freq = 0; 90 90 91 - opp = dev_pm_opp_find_freq_ceil(devfreq->dev.parent, &min_freq); 91 + opp = dev_pm_opp_find_freq_ceil_indexed(devfreq->dev.parent, &min_freq, 0); 92 92 if (IS_ERR(opp)) 93 93 min_freq = 0; 94 94 else ··· 102 102 struct dev_pm_opp *opp; 103 103 unsigned long max_freq = ULONG_MAX; 104 104 105 - opp = dev_pm_opp_find_freq_floor(devfreq->dev.parent, &max_freq); 105 + opp = dev_pm_opp_find_freq_floor_indexed(devfreq->dev.parent, &max_freq, 0); 106 106 if (IS_ERR(opp)) 107 107 max_freq = 0; 108 108 else ··· 196 196 return -ENOMEM; 197 197 198 198 for (i = 0, freq = 0; i < devfreq->max_state; i++, freq++) { 199 - opp = dev_pm_opp_find_freq_ceil(devfreq->dev.parent, &freq); 199 + opp = dev_pm_opp_find_freq_ceil_indexed(devfreq->dev.parent, &freq, 0); 200 200 if (IS_ERR(opp)) { 201 201 devm_kfree(devfreq->dev.parent, devfreq->freq_table); 202 202 return PTR_ERR(opp); ··· 2036 2036 2037 2037 if (flags & DEVFREQ_FLAG_LEAST_UPPER_BOUND) { 2038 2038 /* The freq is an upper bound. opp should be lower */ 2039 - opp = dev_pm_opp_find_freq_floor(dev, freq); 2039 + opp = dev_pm_opp_find_freq_floor_indexed(dev, freq, 0); 2040 2040 2041 2041 /* If not available, use the closest opp */ 2042 2042 if (opp == ERR_PTR(-ERANGE)) 2043 - opp = dev_pm_opp_find_freq_ceil(dev, freq); 2043 + opp = dev_pm_opp_find_freq_ceil_indexed(dev, freq, 0); 2044 2044 } else { 2045 2045 /* The freq is an lower bound. opp should be higher */ 2046 - opp = dev_pm_opp_find_freq_ceil(dev, freq); 2046 + opp = dev_pm_opp_find_freq_ceil_indexed(dev, freq, 0); 2047 2047 2048 2048 /* If not available, use the closest opp */ 2049 2049 if (opp == ERR_PTR(-ERANGE)) 2050 - opp = dev_pm_opp_find_freq_floor(dev, freq); 2050 + opp = dev_pm_opp_find_freq_floor_indexed(dev, freq, 0); 2051 2051 } 2052 2052 2053 2053 return opp;