* [RESEND PATCH v3 0/2] set specific ddr frequency when stop ddr dvfs
@ 2016-11-07 6:33 Lin Huang
2016-11-07 6:33 ` [RESEND PATCH v3 1/2] PM/devfreq: add suspend frequency support Lin Huang
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Lin Huang @ 2016-11-07 6:33 UTC (permalink / raw)
To: linux-arm-kernel
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: get devfreq suspend frequency
drivers/devfreq/devfreq.c | 18 ++++++++++++++++--
drivers/devfreq/governor_simpleondemand.c | 9 +++++++++
drivers/devfreq/rk3399_dmc.c | 2 +-
include/linux/devfreq.h | 8 ++++++++
4 files changed, 34 insertions(+), 3 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [RESEND PATCH v3 1/2] PM/devfreq: add suspend frequency support 2016-11-07 6:33 [RESEND PATCH v3 0/2] set specific ddr frequency when stop ddr dvfs Lin Huang @ 2016-11-07 6:33 ` Lin Huang 2016-11-07 6:33 ` [RESEND PATCH v3 2/2] PM/devfreq: rk3399: get devfreq suspend frequency Lin Huang [not found] ` <CGME20161107063403epcas5p4f8d0d95b9a997ca7bf2b2702c3e5d337@epcas5p4.samsung.com> 2 siblings, 0 replies; 4+ messages in thread From: Lin Huang @ 2016-11-07 6:33 UTC (permalink / raw) To: linux-arm-kernel 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). Signed-off-by: Lin Huang <hl@rock-chips.com> --- Changes in v2: - use update_devfreq() instead devfreq_update_status() Changes in v3: - fix build error drivers/devfreq/devfreq.c | 18 ++++++++++++++++-- drivers/devfreq/governor_simpleondemand.c | 9 +++++++++ include/linux/devfreq.h | 8 ++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index da72d97..4c76e79 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -359,8 +359,10 @@ void devfreq_monitor_suspend(struct devfreq *devfreq) mutex_unlock(&devfreq->lock); return; } - - devfreq_update_status(devfreq, devfreq->previous_freq); + if (devfreq->suspend_freq) + update_devfreq(devfreq); + else + devfreq_update_status(devfreq, devfreq->previous_freq); devfreq->stop_polling = true; mutex_unlock(&devfreq->lock); cancel_delayed_work_sync(&devfreq->work); @@ -1254,6 +1256,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 diff --git a/drivers/devfreq/governor_simpleondemand.c b/drivers/devfreq/governor_simpleondemand.c index ae72ba5..a3efee0 100644 --- a/drivers/devfreq/governor_simpleondemand.c +++ b/drivers/devfreq/governor_simpleondemand.c @@ -29,6 +29,15 @@ static int devfreq_simple_ondemand_func(struct devfreq *df, struct devfreq_simple_ondemand_data *data = df->data; unsigned long max = (df->max_freq) ? df->max_freq : UINT_MAX; + /* + * if devfreq in suspend status and have suspend_freq, + * the frequency need to set to suspend_freq + */ + if (df->stop_polling && df->suspend_freq) { + *freq = df->suspend_freq; + return 0; + } + err = devfreq_update_stats(df); if (err) return err; diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 98c6993..1bdd5d3 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -172,6 +172,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 +215,8 @@ extern int devfreq_resume_device(struct devfreq *devfreq); /* 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, @@ -315,6 +318,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) { -- 1.9.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [RESEND PATCH v3 2/2] PM/devfreq: rk3399: get devfreq suspend frequency 2016-11-07 6:33 [RESEND PATCH v3 0/2] set specific ddr frequency when stop ddr dvfs Lin Huang 2016-11-07 6:33 ` [RESEND PATCH v3 1/2] PM/devfreq: add suspend frequency support Lin Huang @ 2016-11-07 6:33 ` Lin Huang [not found] ` <CGME20161107063403epcas5p4f8d0d95b9a997ca7bf2b2702c3e5d337@epcas5p4.samsung.com> 2 siblings, 0 replies; 4+ messages in thread From: Lin Huang @ 2016-11-07 6:33 UTC (permalink / raw) To: linux-arm-kernel We 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. Signed-off-by: Lin Huang <hl@rock-chips.com> --- Changes in v2: - None Changes in v3: - None drivers/devfreq/rk3399_dmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c index 5a2da95..39f8e27 100644 --- a/drivers/devfreq/rk3399_dmc.c +++ b/drivers/devfreq/rk3399_dmc.c @@ -329,7 +329,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); pd_register_notify_to_dmc(data->devfreq); -- 1.9.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <CGME20161107063403epcas5p4f8d0d95b9a997ca7bf2b2702c3e5d337@epcas5p4.samsung.com>]
* RE: [RESEND PATCH v3 1/2] PM/devfreq: add suspend frequency support [not found] ` <CGME20161107063403epcas5p4f8d0d95b9a997ca7bf2b2702c3e5d337@epcas5p4.samsung.com> @ 2016-11-08 2:06 ` MyungJoo Ham 0 siblings, 0 replies; 4+ messages in thread From: MyungJoo Ham @ 2016-11-08 2:06 UTC (permalink / raw) To: linux-arm-kernel > 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). > > Signed-off-by: Lin Huang <hl@rock-chips.com> > --- > Changes in v2: > - use update_devfreq() instead devfreq_update_status() > Changes in v3: > - fix build error > > drivers/devfreq/devfreq.c | 18 ++++++++++++++++-- > drivers/devfreq/governor_simpleondemand.c | 9 +++++++++ > include/linux/devfreq.h | 8 ++++++++ > 3 files changed, 33 insertions(+), 2 deletions(-) > > [] > +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); > + Why do we need this function? This could be done at the init time (devfreq_add_device). Plus, when it does not have dev_pm_opp_get_suspend_opp() available, > /** > * devfreq_register_opp_notifier() - Helper function to get devfreq notified > * for any changes in the OPP availability > diff --git a/drivers/devfreq/governor_simpleondemand.c b/drivers/devfreq/governor_simpleondemand.c > index ae72ba5..a3efee0 100644 > --- a/drivers/devfreq/governor_simpleondemand.c > +++ b/drivers/devfreq/governor_simpleondemand.c > @@ -29,6 +29,15 @@ static int devfreq_simple_ondemand_func(struct devfreq *df, > struct devfreq_simple_ondemand_data *data = df->data; > unsigned long max = (df->max_freq) ? df->max_freq : UINT_MAX; > > + /* > + * if devfreq in suspend status and have suspend_freq, > + * the frequency need to set to suspend_freq > + */ > + if (df->stop_polling && df->suspend_freq) { > + *freq = df->suspend_freq; > + return 0; > + } > + Why are you adding this? "Stop polling" does not necessarily mean that we are doing suspend-to-RAM/disk. It may really mean just to stop at the current frequency. Cheers, MyungJoo ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-08 2:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-07 6:33 [RESEND PATCH v3 0/2] set specific ddr frequency when stop ddr dvfs Lin Huang
2016-11-07 6:33 ` [RESEND PATCH v3 1/2] PM/devfreq: add suspend frequency support Lin Huang
2016-11-07 6:33 ` [RESEND PATCH v3 2/2] PM/devfreq: rk3399: get devfreq suspend frequency Lin Huang
[not found] ` <CGME20161107063403epcas5p4f8d0d95b9a997ca7bf2b2702c3e5d337@epcas5p4.samsung.com>
2016-11-08 2:06 ` [RESEND PATCH v3 1/2] PM/devfreq: add suspend frequency support MyungJoo Ham
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).