linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kyungmin Park <kmpark@infradead.org>
To: Konstantin Krivyakin <k.krivyakin@samsung.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	viresh.kumar@linaro.org, mingo@redhat.com,
	Peter Zijlstra <peterz@infradead.org>
Cc: i.zhbanov@samsung.com, e.voevodin@samsung.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 3/3] Update current cpu power when cpu freq change for exynos.
Date: Fri, 5 Jul 2013 09:51:14 +0900	[thread overview]
Message-ID: <CAH9JG2XwWC03vR7Obg_PLBFJ5vEz19vaCjROpfGtTNsGP2Cj-w@mail.gmail.com> (raw)
In-Reply-To: <1372951039-10375-4-git-send-email-k.krivyakin@samsung.com>

+ cpufreq maintainers

On Fri, Jul 5, 2013 at 12:17 AM, Konstantin Krivyakin
<k.krivyakin@samsung.com> wrote:
> Signed-off-by: Konstantin Krivyakin <k.krivyakin@samsung.com>
> ---
>  drivers/cpufreq/exynos-cpufreq.c     |    2 ++
>  drivers/cpufreq/exynos-cpufreq.h     |    1 +
>  drivers/cpufreq/exynos4x12-cpufreq.c |   19 ++++++++++++++++++-
>  3 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
> index 0d32f02..02f17bc 100644
> --- a/drivers/cpufreq/exynos-cpufreq.c
> +++ b/drivers/cpufreq/exynos-cpufreq.c
> @@ -178,6 +178,8 @@ static int exynos_target(struct cpufreq_policy *policy,
>         }
>
>         new_freq = freq_table[index].frequency;
> +       if (exynos_info->power_table)
> +               policy->current_power = exynos_info->power_table[index];
>
>         ret = exynos_cpufreq_scale(new_freq);
>
> diff --git a/drivers/cpufreq/exynos-cpufreq.h b/drivers/cpufreq/exynos-cpufreq.h
> index 92b852e..64f964f 100644
> --- a/drivers/cpufreq/exynos-cpufreq.h
> +++ b/drivers/cpufreq/exynos-cpufreq.h
> @@ -38,6 +38,7 @@ struct exynos_dvfs_info {
>         unsigned int    pll_safe_idx;
>         struct clk      *cpu_clk;
>         unsigned int    *volt_table;
> +       u64             *power_table;
>         struct cpufreq_frequency_table  *freq_table;
>         void (*set_freq)(unsigned int, unsigned int);
>         bool (*need_apll_change)(unsigned int, unsigned int);
> diff --git a/drivers/cpufreq/exynos4x12-cpufreq.c b/drivers/cpufreq/exynos4x12-cpufreq.c
> index 08b7477..8905f9b 100644
> --- a/drivers/cpufreq/exynos4x12-cpufreq.c
> +++ b/drivers/cpufreq/exynos4x12-cpufreq.c
> @@ -219,6 +219,7 @@ static void exynos4x12_set_frequency(unsigned int old_index,
>  int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info)
>  {
>         unsigned long rate;
> +       int freq_count;
>
>         cpu_clk = clk_get(NULL, "armclk");
>         if (IS_ERR(cpu_clk))
> @@ -252,8 +253,24 @@ int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info)
>         info->set_freq = exynos4x12_set_frequency;
>         info->need_apll_change = exynos4x12_pms_change;
>
> -       return 0;
> +       freq_count = sizeof(exynos4x12_freq_table) /
> +               sizeof(struct cpufreq_frequency_table);
> +       info->power_table = kzalloc(sizeof(u64) * freq_count, GFP_KERNEL);
> +       if (!info->power_table)
> +               goto err_power_table;
> +
> +       for (i = 0; i <= freq_count; ++i) {
> +               u64 freq = info->freq_table[i].frequency;
> +               u64 volt = info->volt_table[i];
>
> +               do_div(freq, 1000);
> +               do_div(volt, 1000);
> +               info->power_table[i] = freq * volt * volt;
> +       }
> +
> +       return 0;
> +err_power_table:
> +       clk_put(mout_appl);
>  err_mout_apll:
>         clk_put(mout_mpll);
>  err_mout_mpll:
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2013-07-05  0:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-04 15:17 [PATCH RFC 0/3] Per-process power consumption measurement facility Konstantin Krivyakin
2013-07-04 15:17 ` [PATCH RFC 1/3] Add interface to receive current cpu power Konstantin Krivyakin
2013-07-05  0:49   ` Kyungmin Park
2013-07-04 15:17 ` [PATCH RFC 2/3] Add power consumption counter in task_struct Konstantin Krivyakin
2013-07-05  0:50   ` Kyungmin Park
2013-07-04 15:17 ` [PATCH RFC 3/3] Update current cpu power when cpu freq change for exynos Konstantin Krivyakin
2013-07-05  0:51   ` Kyungmin Park [this message]
2013-07-05  0:48 ` [PATCH RFC 0/3] Per-process power consumption measurement facility Kyungmin Park
2013-07-30  8:17 Konstantin Krivyakin
2013-07-30  8:17 ` [PATCH RFC 3/3] Update current cpu power when cpu freq change for exynos Konstantin Krivyakin

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=CAH9JG2XwWC03vR7Obg_PLBFJ5vEz19vaCjROpfGtTNsGP2Cj-w@mail.gmail.com \
    --to=kmpark@infradead.org \
    --cc=e.voevodin@samsung.com \
    --cc=i.zhbanov@samsung.com \
    --cc=k.krivyakin@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rjw@sisk.pl \
    --cc=viresh.kumar@linaro.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 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).