From: MyungJoo Ham <myungjoo.ham@samsung.com>
To: Xiaoguang Chen <chenxg@marvell.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: 박경민 <kyungmin.park@samsung.com>,
"linux-pm@lists.linux-foundation.org"
<linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH 2/2] PM: Devfreq: Add frequency get function in profile
Date: Wed, 13 Jun 2012 04:57:36 +0000 (GMT) [thread overview]
Message-ID: <1290271.915811339563455292.JavaMail.weblogic@epml04> (raw)
> when devfreq set one frequency, the final frequency may not
> the same as the requested frequency. Add get function in profile
> to let devfreq driver return the final frequency.
>
> Signed-off-by: Xiaoguang Chen <chenxg@marvell.com>
That is why in update_freq() function that you've modified uses:
err = devfreq->profile->target(devfreq->dev.parent, &freq, flags);
not
err = devfreq->profile->target(devfreq->dev.parent, freq, flags);
The target function will return the configured frequency right there.
Calling "__devfreq_get()" at the same location wouldn't help as long as
the "target()" callback is implemented correctly.
Cheers!
MyungJoo
> ---
> drivers/devfreq/devfreq.c | 12 +++++++++++-
> include/linux/devfreq.h | 2 ++
> 2 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 2144200..50a4fc0 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -72,6 +72,16 @@ static struct devfreq *find_device_devfreq(struct device *dev)
> return ERR_PTR(-ENODEV);
> }
>
> +static unsigned long __devfreq_get(struct device *dev)
> +{
> + struct devfreq *devfreq = to_devfreq(dev);
> + unsigned long ret_freq = devfreq->previous_freq;
> + if (!devfreq->profile->get)
> + return ret_freq;
> + ret_freq = devfreq->profile->get(devfreq->dev.parent);
> + return ret_freq;
> +}
> +
> /**
> * update_devfreq() - Reevaluate the device and configure frequency.
> * @devfreq: the devfreq instance.
> @@ -116,7 +126,7 @@ int update_devfreq(struct devfreq *devfreq)
> if (err)
> return err;
>
> - devfreq->previous_freq = freq;
> + devfreq->previous_freq = __devfreq_get(&devfreq->dev);
> return err;
> }
>
> diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
> index e5e4036..f789314 100644
> --- a/include/linux/devfreq.h
> +++ b/include/linux/devfreq.h
> @@ -65,6 +65,7 @@ struct devfreq_frequency_table {
> * @initial_freq The operating frequency when devfreq_add_device() is
> * called.
> * @polling_ms The polling interval in ms. 0 disables polling.
> + * @get Get the devices's actual frequency
> * @target The device should set its operating frequency at
> * freq or lowest-upper-than-freq value. If freq is
> * higher than any operable frequency, set maximum.
> @@ -84,6 +85,7 @@ struct devfreq_dev_profile {
> unsigned long initial_freq;
> unsigned int polling_ms;
>
> + unsigned long (*get)(struct device *dev);
> int (*target)(struct device *dev, unsigned long *freq, u32 flags);
> int (*get_dev_status)(struct device *dev,
> struct devfreq_dev_status *stat);
> --
> 1.7.0.4
WARNING: multiple messages have this Message-ID (diff)
From: MyungJoo Ham <myungjoo.ham@samsung.com>
To: Xiaoguang Chen <chenxg@marvell.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: 박경민 <kyungmin.park@samsung.com>,
"linux-pm@lists.linux-foundation.org"
<linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH 2/2] PM: Devfreq: Add frequency get function in profile
Date: Wed, 13 Jun 2012 04:57:36 +0000 (GMT) [thread overview]
Message-ID: <1290271.915811339563455292.JavaMail.weblogic@epml04> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 2835 bytes --]
> when devfreq set one frequency, the final frequency may not
> the same as the requested frequency. Add get function in profile
> to let devfreq driver return the final frequency.
>
> Signed-off-by: Xiaoguang Chen <chenxg@marvell.com>
That is why in update_freq() function that you've modified uses:
err = devfreq->profile->target(devfreq->dev.parent, &freq, flags);
not
err = devfreq->profile->target(devfreq->dev.parent, freq, flags);
The target function will return the configured frequency right there.
Calling "__devfreq_get()" at the same location wouldn't help as long as
the "target()" callback is implemented correctly.
Cheers!
MyungJoo
> ---
> drivers/devfreq/devfreq.c | 12 +++++++++++-
> include/linux/devfreq.h | 2 ++
> 2 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 2144200..50a4fc0 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -72,6 +72,16 @@ static struct devfreq *find_device_devfreq(struct device *dev)
> return ERR_PTR(-ENODEV);
> }
>
> +static unsigned long __devfreq_get(struct device *dev)
> +{
> + struct devfreq *devfreq = to_devfreq(dev);
> + unsigned long ret_freq = devfreq->previous_freq;
> + if (!devfreq->profile->get)
> + return ret_freq;
> + ret_freq = devfreq->profile->get(devfreq->dev.parent);
> + return ret_freq;
> +}
> +
> /**
> * update_devfreq() - Reevaluate the device and configure frequency.
> * @devfreq: the devfreq instance.
> @@ -116,7 +126,7 @@ int update_devfreq(struct devfreq *devfreq)
> if (err)
> return err;
>
> - devfreq->previous_freq = freq;
> + devfreq->previous_freq = __devfreq_get(&devfreq->dev);
> return err;
> }
>
> diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
> index e5e4036..f789314 100644
> --- a/include/linux/devfreq.h
> +++ b/include/linux/devfreq.h
> @@ -65,6 +65,7 @@ struct devfreq_frequency_table {
> * @initial_freq The operating frequency when devfreq_add_device() is
> * called.
> * @polling_ms The polling interval in ms. 0 disables polling.
> + * @get Get the devices's actual frequency
> * @target The device should set its operating frequency at
> * freq or lowest-upper-than-freq value. If freq is
> * higher than any operable frequency, set maximum.
> @@ -84,6 +85,7 @@ struct devfreq_dev_profile {
> unsigned long initial_freq;
> unsigned int polling_ms;
>
> + unsigned long (*get)(struct device *dev);
> int (*target)(struct device *dev, unsigned long *freq, u32 flags);
> int (*get_dev_status)(struct device *dev,
> struct devfreq_dev_status *stat);
> --
> 1.7.0.4
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next reply other threads:[~2012-06-13 4:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-13 4:57 MyungJoo Ham [this message]
2012-06-13 4:57 ` [PATCH 2/2] PM: Devfreq: Add frequency get function in profile MyungJoo Ham
2012-06-13 5:16 ` Xiaoguang Chen
2012-06-13 5:16 ` Xiaoguang Chen
-- strict thread matches above, loose matches on Subject: below --
2012-06-13 4:39 Xiaoguang Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1290271.915811339563455292.JavaMail.weblogic@epml04 \
--to=myungjoo.ham@samsung.com \
--cc=chenxg@marvell.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.