set specific ddr frequency when stop ddr dvfs
Subsystems (2)
v2 cover set specific ddr frequency when stop ddr dvfs
We need ddr run a specific frequency when ddr dvfs stop working. So we implement get suspend frequency function in devfreq framework, and call it in rk3399 dmc driver.
Lin Huang (2):
PM/devfreq: add suspend frequency support
PM/devfreq: rk3399: set specific ddr frequency when stop ddr dvfs
drivers/devfreq/devfreq.c | 17 ++++++++++++++++- drivers/devfreq/rk3399_dmc.c | 2 +- include/linux/devfreq.h | 9 +++++++++ 3 files changed, 26 insertions(+), 2 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/2 PM/devfreq: add suspend frequency support
Add suspend frequency support and if needed set it to the frequency obtained from the suspend opp (can be defined using opp-v2 bindings and is optional).
---
Changes in v2:
- use update_devfreq() instead devfreq_update_status()
drivers/devfreq/devfreq.c | 17 ++++++++++++++++- include/linux/devfreq.h | 9 +++++++++ 2 files changed, 25 insertions(+), 1 deletion(-)
drivers/devfreq/devfreq.c +16 -1
@@ -364,7 +364,10 @@ void devfreq_monitor_suspend(struct devfreq *devfreq)return ; } -devfreq_update_status (devfreq, devfreq->previous_freq); +if (devfreq->suspend_freq) +update_devfreq (devfreq, devfreq->suspend_freq); +else +devfreq_update_status (devfreq, devfreq->previous_freq); devfreq->stop_polling = true;mutex_unlock (&devfreq->lock);cancel_delayed_work_sync (&devfreq->work);
@@ -1251,6 +1254,18 @@ struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, }EXPORT_SYMBOL (devfreq_recommended_opp); +void devfreq_opp_get_suspend_opp (struct device *dev,struct devfreq *devfreq) +{ +struct dev_pm_opp *suspend_opp; + +rcu_read_lock (); + suspend_opp =dev_pm_opp_get_suspend_opp (dev); +if (suspend_opp) + devfreq->suspend_freq =dev_pm_opp_get_freq (suspend_opp); +rcu_read_unlock (); +} +EXPORT_SYMBOL (devfreq_opp_get_suspend_opp); +/** * devfreq_register_opp_notifier() - Helper function to get devfreq notified * for any changes in the OPP availability
include/linux/devfreq.h +9 -0
@@ -88,6 +88,7 @@ struct devfreq_dev_status {*/ struct devfreq_dev_profile {unsigned long initial_freq; +unsigned long suspend_freq;unsigned int polling_ms;int (*target)(struct device *dev,unsigned long *freq,u32 flags);
@@ -172,6 +173,7 @@ struct devfreq {struct delayed_work work;unsigned long previous_freq; +unsigned long suspend_freq;struct devfreq_dev_status last_status;void *data;/* private data for governors */
@@ -214,6 +216,8 @@ extern void devm_devfreq_remove_device(struct device *dev,/* Helper functions for devfreq user device driver with OPP. */ extern struct dev_pm_opp *devfreq_recommended_opp (struct device *dev,unsigned long *freq,u32 flags); +extern void devfreq_opp_get_suspend_opp (struct device *dev, +struct devfreq *devfreq);extern int devfreq_register_opp_notifier (struct device *dev,struct devfreq *devfreq); extern int devfreq_unregister_opp_notifier(struct device *dev,
@@ -348,6 +352,11 @@ static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,return ERR_PTR (-EINVAL ); } +static inline void devfreq_opp_get_suspend_opp (struct device *dev, +struct devfreq *devfreq) +{ +} +static inline int devfreq_register_opp_notifier (struct device *dev,struct devfreq *devfreq) {
Signature · 1 line
1.9.1
PATCH v2 2/2 PM/devfreq: rk3399: set specific ddr frequency when stop ddr dvfs
In reply to Lin HuangWe need ddr run a specific frequency when ddr dvfs stop working. For example: if we enable two monitor, then we will stop ddr dvfs, but we hope ddr can run in highest frequency obviously.
---
Changes in v2:
- None
drivers/devfreq/rk3399_dmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/devfreq/rk3399_dmc.c +1 -1
@@ -443,7 +443,7 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)if (IS_ERR (data->devfreq))return PTR_ERR (data->devfreq);devm_devfreq_register_opp_notifier (dev, data->devfreq); - +devfreq_opp_get_suspend_opp (dev, data->devfreq); data->dev = dev;platform_set_drvdata (pdev, data);
Signature · 1 line
1.9.1
kbuild test robot
build botRe: [PATCH v2 1/2] PM/devfreq: add suspend frequency support
In reply to Lin Huangurl: https://github.com/0day-ci/linux/commits/Lin-Huang/set-specific-ddr-frequency-when-stop-ddr-dvfs/20161103-142055 config: x86_64-randconfig-x015-201644 (attached as .config) compiler: gcc-6…
Hi Lin,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.9-rc3 next-20161028]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Lin-Huang/set-specific-ddr-frequency-when-stop-ddr-dvfs/20161103-142055
config: x86_64-randconfig-x015-201644 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 All errors (new ones prefixed by >>):
drivers/devfreq/devfreq.c: In function 'devfreq_monitor_suspend':
>> drivers/devfreq/devfreq.c:368:3: error: too many arguments to function 'update_devfreq'
update_devfreq(devfreq, devfreq->suspend_freq);
^~~~~~~~~~~~~~ drivers/devfreq/devfreq.c:228:5: note: declared here
int update_devfreq(struct devfreq *devfreq)
^~~~~~~~~~~~~~
vim +/update_devfreq +368 drivers/devfreq/devfreq.c
362 if (devfreq->stop_polling) {
363 mutex_unlock(&devfreq->lock);
364 return;
365 }
366
367 if (devfreq->suspend_freq)
> 368 update_devfreq(devfreq, devfreq->suspend_freq);
369 else
370 devfreq_update_status(devfreq, devfreq->previous_freq);
371 devfreq->stop_polling = true;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH v2 1/2] PM/devfreq: add suspend frequency support
In reply to Lin HuangHi All,
Miss something in this patch, just ignored it, sorry about that.
Quoted 90 lines · Lin Huang
Add suspend frequency support and if needed set it to the frequency obtained from the suspend opp (can be defined using opp-v2 bindings and is optional).
Change-Id Iaa0d3848d63d9ce03f65ea76f263e4685a4c295eSigned-off-by Lin Huang <[email protected]>---
Changes in v2:
- useupdate_devfreq()insteaddevfreq_update_status()drivers/devfreq/devfreq.c | 17 ++++++++++++++++- include/linux/devfreq.h | 9 +++++++++ 2 files changed, 25 insertions(+), 1 deletion(-)drivers/devfreq/devfreq.c +16
-1@@ -364,7 +364,10 @@ void devfreq_monitor_suspend(struct devfreq *devfreq)return ; } -devfreq_update_status (devfreq, devfreq->previous_freq); +if (devfreq->suspend_freq) +update_devfreq (devfreq, devfreq->suspend_freq); +else +devfreq_update_status (devfreq, devfreq->previous_freq); devfreq->stop_polling = true;mutex_unlock (&devfreq->lock);cancel_delayed_work_sync (&devfreq->work);@@ -1251,6 +1254,18 @@ struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, }EXPORT_SYMBOL (devfreq_recommended_opp); +void devfreq_opp_get_suspend_opp (struct device *dev,struct devfreq *devfreq) +{ +struct dev_pm_opp *suspend_opp; + +rcu_read_lock (); + suspend_opp =dev_pm_opp_get_suspend_opp (dev); +if (suspend_opp) + devfreq->suspend_freq =dev_pm_opp_get_freq (suspend_opp); +rcu_read_unlock (); +} +EXPORT_SYMBOL (devfreq_opp_get_suspend_opp); +/** * devfreq_register_opp_notifier() - Helper function to get devfreq notified * for any changes in the OPP availability include/linux/devfreq.h +9
-0@@ -88,6 +88,7 @@ struct devfreq_dev_status {*/ struct devfreq_dev_profile {unsigned long initial_freq; +unsigned long suspend_freq;unsigned int polling_ms;int (*target)(struct device *dev,unsigned long *freq,u32 flags);@@ -172,6 +173,7 @@ struct devfreq {struct delayed_work work;unsigned long previous_freq; +unsigned long suspend_freq;struct devfreq_dev_status last_status;void *data;/* private data for governors */ @@ -214,6 +216,8 @@ extern void devm_devfreq_remove_device(struct device *dev,/* Helper functions for devfreq user device driver with OPP. */ extern struct dev_pm_opp *devfreq_recommended_opp (struct device *dev,unsigned long *freq,u32 flags); +extern void devfreq_opp_get_suspend_opp (struct device *dev, +struct devfreq *devfreq);extern int devfreq_register_opp_notifier (struct device *dev,struct devfreq *devfreq); extern int devfreq_unregister_opp_notifier(struct device *dev,@@ -348,6 +352,11 @@ static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,return ERR_PTR (-EINVAL ); } +static inline void devfreq_opp_get_suspend_opp (struct device *dev, +struct devfreq *devfreq) +{ +} +static inline int devfreq_register_opp_notifier (struct device *dev,struct devfreq *devfreq) {
Signature · 1 line
Lin Huang