Skip to content

Commit 8b3bd6f

Browse files
Mani-Sadhasivamchanwoochoi
authored andcommitted
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>
1 parent d280560 commit 8b3bd6f

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

drivers/devfreq/devfreq.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static unsigned long find_available_min_freq(struct devfreq *devfreq)
8888
struct dev_pm_opp *opp;
8989
unsigned long min_freq = 0;
9090

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);
9292
if (IS_ERR(opp))
9393
min_freq = 0;
9494
else
@@ -102,7 +102,7 @@ static unsigned long find_available_max_freq(struct devfreq *devfreq)
102102
struct dev_pm_opp *opp;
103103
unsigned long max_freq = ULONG_MAX;
104104

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);
106106
if (IS_ERR(opp))
107107
max_freq = 0;
108108
else
@@ -196,7 +196,7 @@ static int set_freq_table(struct devfreq *devfreq)
196196
return -ENOMEM;
197197

198198
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);
200200
if (IS_ERR(opp)) {
201201
devm_kfree(devfreq->dev.parent, devfreq->freq_table);
202202
return PTR_ERR(opp);
@@ -2036,18 +2036,18 @@ struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
20362036

20372037
if (flags & DEVFREQ_FLAG_LEAST_UPPER_BOUND) {
20382038
/* 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);
20402040

20412041
/* If not available, use the closest opp */
20422042
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);
20442044
} else {
20452045
/* 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);
20472047

20482048
/* If not available, use the closest opp */
20492049
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);
20512051
}
20522052

20532053
return opp;

0 commit comments

Comments
 (0)