All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: Thomas Abraham <ta.omasab@gmail.com>
Cc: dt list <devicetree@vger.kernel.org>,
	Lukasz Majewski <l.majewski@samsung.com>,
	"linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	linux-pm@vger.kernel.org, Viresh Kumar <viresh.kumar@linaro.org>,
	Tomasz Figa <t.figa@samsung.com>,
	rjw@rjwysocki.net, Kukjin Kim <kgene.kim@samsung.com>,
	thomas.ab@samsung.com,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 1/2] PM / OPP: Allow boost frequency to be looked up from device tree
Date: Fri, 7 Feb 2014 09:52:07 -0600	[thread overview]
Message-ID: <52F50127.606@ti.com> (raw)
In-Reply-To: <CAJuA9aiEDXyK8ABNznbzjk7s2uMfwo_diRpmLNsKBFd+pH=ffQ@mail.gmail.com>

On 02/07/2014 09:38 AM, Thomas Abraham wrote:
[...]
>>> diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
>>> index fa41874..b636826 100644
>>> --- a/drivers/base/power/opp.c
>>> +++ b/drivers/base/power/opp.c
>>> @@ -628,7 +628,8 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev,
>>>         struct device_opp *dev_opp;
>>>         struct dev_pm_opp *opp;
>>>         struct cpufreq_frequency_table *freq_table;
>>> -       int i = 0;
>>> +       int i = 0, j, len, ret;
>>> +       u32 *boost_freqs = NULL;
>>>
>>>         /* Pretend as if I am an updater */
>>>         mutex_lock(&dev_opp_list_lock);
>>> @@ -650,10 +651,35 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev,
>>>                 return -ENOMEM;
>>>         }
>>>
>>> +       if (of_find_property(dev->of_node, "boost-frequency", &len)) {
>>> +               if (len == 0 || (len & (sizeof(u32) - 1)) != 0) {
>>> +                       dev_err(dev, "%s: invalid boost frequency\n", __func__);
>>> +                       ret = -EINVAL;
>>> +                       goto err_boost;
>>> +               }
>>> +
>>> +               boost_freqs = kzalloc(len, GFP_KERNEL);
>>> +               if (!boost_freqs) {
>>> +                       dev_warn(dev, "%s: no memory for boost freq table\n",
>>> +                                       __func__);
>>> +                       ret = -ENOMEM;
>>> +                       goto err_boost;
>>> +               }
>>> +               of_property_read_u32_array(dev->of_node, "boost-frequency",
>>> +                       boost_freqs, len / sizeof(u32));
>>> +       }
>>> +
>>>         list_for_each_entry(opp, &dev_opp->opp_list, node) {
>>>                 if (opp->available) {
>>>                         freq_table[i].driver_data = i;
>>>                         freq_table[i].frequency = opp->rate / 1000;
>>> +                       for (j = 0; j < len / sizeof(u32) && boost_freqs; j++) {
>>> +                               if (boost_freqs[j] == freq_table[i].frequency) {
>>> +                                       freq_table[i].driver_data =
>>> +                                                       CPUFREQ_BOOST_FREQ;
>>> +                                       break;
>>> +                               }
>>> +                       }
>>
>> What if any one of the boost_freqs are not contained in the enabled frequencies?
> 
> It is not used as a boost frequency because its corresponding voltage
> is not known. If required a warning can be printed out for the same.

yes - that would be good, as it helps debug if there are developer
errors in dts.


-- 
Regards,
Nishanth Menon

WARNING: multiple messages have this Message-ID (diff)
From: nm@ti.com (Nishanth Menon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] PM / OPP: Allow boost frequency to be looked up from device tree
Date: Fri, 7 Feb 2014 09:52:07 -0600	[thread overview]
Message-ID: <52F50127.606@ti.com> (raw)
In-Reply-To: <CAJuA9aiEDXyK8ABNznbzjk7s2uMfwo_diRpmLNsKBFd+pH=ffQ@mail.gmail.com>

On 02/07/2014 09:38 AM, Thomas Abraham wrote:
[...]
>>> diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
>>> index fa41874..b636826 100644
>>> --- a/drivers/base/power/opp.c
>>> +++ b/drivers/base/power/opp.c
>>> @@ -628,7 +628,8 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev,
>>>         struct device_opp *dev_opp;
>>>         struct dev_pm_opp *opp;
>>>         struct cpufreq_frequency_table *freq_table;
>>> -       int i = 0;
>>> +       int i = 0, j, len, ret;
>>> +       u32 *boost_freqs = NULL;
>>>
>>>         /* Pretend as if I am an updater */
>>>         mutex_lock(&dev_opp_list_lock);
>>> @@ -650,10 +651,35 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev,
>>>                 return -ENOMEM;
>>>         }
>>>
>>> +       if (of_find_property(dev->of_node, "boost-frequency", &len)) {
>>> +               if (len == 0 || (len & (sizeof(u32) - 1)) != 0) {
>>> +                       dev_err(dev, "%s: invalid boost frequency\n", __func__);
>>> +                       ret = -EINVAL;
>>> +                       goto err_boost;
>>> +               }
>>> +
>>> +               boost_freqs = kzalloc(len, GFP_KERNEL);
>>> +               if (!boost_freqs) {
>>> +                       dev_warn(dev, "%s: no memory for boost freq table\n",
>>> +                                       __func__);
>>> +                       ret = -ENOMEM;
>>> +                       goto err_boost;
>>> +               }
>>> +               of_property_read_u32_array(dev->of_node, "boost-frequency",
>>> +                       boost_freqs, len / sizeof(u32));
>>> +       }
>>> +
>>>         list_for_each_entry(opp, &dev_opp->opp_list, node) {
>>>                 if (opp->available) {
>>>                         freq_table[i].driver_data = i;
>>>                         freq_table[i].frequency = opp->rate / 1000;
>>> +                       for (j = 0; j < len / sizeof(u32) && boost_freqs; j++) {
>>> +                               if (boost_freqs[j] == freq_table[i].frequency) {
>>> +                                       freq_table[i].driver_data =
>>> +                                                       CPUFREQ_BOOST_FREQ;
>>> +                                       break;
>>> +                               }
>>> +                       }
>>
>> What if any one of the boost_freqs are not contained in the enabled frequencies?
> 
> It is not used as a boost frequency because its corresponding voltage
> is not known. If required a warning can be printed out for the same.

yes - that would be good, as it helps debug if there are developer
errors in dts.


-- 
Regards,
Nishanth Menon

  reply	other threads:[~2014-02-07 15:52 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07 15:19 [PATCH v2 0/2] Add device tree based lookup of boost mode frequency Thomas Abraham
2014-02-07 15:19 ` Thomas Abraham
2014-02-07 15:19 ` [PATCH v2 1/2] PM / OPP: Allow boost frequency to be looked up from device tree Thomas Abraham
2014-02-07 15:19   ` Thomas Abraham
2014-02-07 15:29   ` Nishanth Menon
2014-02-07 15:29     ` Nishanth Menon
2014-02-07 15:38     ` Thomas Abraham
2014-02-07 15:38       ` Thomas Abraham
2014-02-07 15:52       ` Nishanth Menon [this message]
2014-02-07 15:52         ` Nishanth Menon
2014-02-07 16:01   ` Sudeep Holla
2014-02-07 16:01     ` Sudeep Holla
2014-02-08  5:10     ` Thomas Abraham
2014-02-08  5:10       ` Thomas Abraham
2014-02-10  7:10       ` Lukasz Majewski
2014-02-10  7:10         ` Lukasz Majewski
2014-02-10 10:40       ` Sudeep Holla
2014-02-10 10:40         ` Sudeep Holla
2014-02-07 15:19 ` [PATCH v2 2/2] Documentation: devicetree: Add boost-frequency binding to list boost mode frequency Thomas Abraham
2014-02-07 15:19   ` Thomas Abraham
2014-02-07 15:27   ` Nishanth Menon
2014-02-07 15:27     ` Nishanth Menon
2014-02-07 15:38     ` Thomas Abraham
2014-02-07 15:38       ` Thomas Abraham
2014-02-07 16:15   ` Sudeep Holla
2014-02-07 16:15     ` Sudeep Holla
2014-02-07 16:28     ` Sudeep Holla
2014-02-07 16:28       ` Sudeep Holla
2014-02-07 16:43       ` Nishanth Menon
2014-02-07 16:43         ` Nishanth Menon
2014-02-07 17:31         ` Sudeep Holla
2014-02-07 17:31           ` Sudeep Holla
2014-02-07 17:37           ` Nishanth Menon
2014-02-07 17:37             ` Nishanth Menon
2014-02-07 17:40             ` Nishanth Menon
2014-02-07 17:40               ` Nishanth Menon
2014-02-07 18:02             ` Sudeep Holla
2014-02-07 18:02               ` Sudeep Holla
2014-02-07 19:41               ` Nishanth Menon
2014-02-07 19:41                 ` Nishanth Menon
2014-02-08  6:47                 ` Thomas Abraham
2014-02-08  6:47                   ` Thomas Abraham
2014-02-10  7:53                   ` Lukasz Majewski
2014-02-10  7:53                     ` Lukasz Majewski
2014-02-10 11:20                     ` Sudeep Holla
2014-02-10 11:20                       ` Sudeep Holla
2014-02-08  6:47               ` Thomas Abraham
2014-02-08  6:47                 ` Thomas Abraham
2014-02-10  7:38                 ` Lukasz Majewski
2014-02-10  7:38                   ` Lukasz Majewski
2014-02-10 10:51                   ` Sudeep Holla
2014-02-10 10:51                     ` Sudeep Holla
2014-02-10 10:46                 ` Sudeep Holla
2014-02-10 10:46                   ` Sudeep Holla

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=52F50127.606@ti.com \
    --to=nm@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kgene.kim@samsung.com \
    --cc=l.majewski@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=t.figa@samsung.com \
    --cc=ta.omasab@gmail.com \
    --cc=thomas.ab@samsung.com \
    --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 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.