* [PATCH] PM / devfreq: Use freq_table for available_frequencies
@ 2014-04-11 2:54 ` Saravana Kannan
0 siblings, 0 replies; 10+ messages in thread
From: Saravana Kannan @ 2014-04-11 2:54 UTC (permalink / raw)
To: MyungJoo Ham, Kyungmin Park
Cc: linux-pm, linux-kernel, linux-arm-msm, linux-arm-kernel, Saravana Kannan
Some devices use freq_table instead of OPP. For those devices, the
available_frequencies file shows up empty. Fix that by using freq_table to
generate the available_frequencies data when OPP is not present.
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
---
drivers/devfreq/devfreq.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 2042ec3..a715d15 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -912,19 +912,26 @@ static ssize_t available_frequencies_show(struct device *d,
struct devfreq *df = to_devfreq(d);
struct device *dev = df->dev.parent;
struct dev_pm_opp *opp;
+ unsigned int i = 0, max_state = df->profile->max_state;
+ bool use_opp;
ssize_t count = 0;
unsigned long freq = 0;
rcu_read_lock();
+ use_opp = dev_pm_opp_get_opp_count(dev) > 0;
do {
- opp = dev_pm_opp_find_freq_ceil(dev, &freq);
- if (IS_ERR(opp))
- break;
+ if (use_opp) {
+ opp = dev_pm_opp_find_freq_ceil(dev, &freq);
+ if (IS_ERR(opp))
+ break;
+ } else {
+ freq = df->profile->freq_table[i++];
+ }
count += scnprintf(&buf[count], (PAGE_SIZE - count - 2),
"%lu ", freq);
freq++;
- } while (1);
+ } while (use_opp || (!use_opp && i < max_state));
rcu_read_unlock();
/* Truncate the trailing space */
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] PM / devfreq: Use freq_table for available_frequencies
@ 2014-04-11 2:54 ` Saravana Kannan
0 siblings, 0 replies; 10+ messages in thread
From: Saravana Kannan @ 2014-04-11 2:54 UTC (permalink / raw)
To: linux-arm-kernel
Some devices use freq_table instead of OPP. For those devices, the
available_frequencies file shows up empty. Fix that by using freq_table to
generate the available_frequencies data when OPP is not present.
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
---
drivers/devfreq/devfreq.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 2042ec3..a715d15 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -912,19 +912,26 @@ static ssize_t available_frequencies_show(struct device *d,
struct devfreq *df = to_devfreq(d);
struct device *dev = df->dev.parent;
struct dev_pm_opp *opp;
+ unsigned int i = 0, max_state = df->profile->max_state;
+ bool use_opp;
ssize_t count = 0;
unsigned long freq = 0;
rcu_read_lock();
+ use_opp = dev_pm_opp_get_opp_count(dev) > 0;
do {
- opp = dev_pm_opp_find_freq_ceil(dev, &freq);
- if (IS_ERR(opp))
- break;
+ if (use_opp) {
+ opp = dev_pm_opp_find_freq_ceil(dev, &freq);
+ if (IS_ERR(opp))
+ break;
+ } else {
+ freq = df->profile->freq_table[i++];
+ }
count += scnprintf(&buf[count], (PAGE_SIZE - count - 2),
"%lu ", freq);
freq++;
- } while (1);
+ } while (use_opp || (!use_opp && i < max_state));
rcu_read_unlock();
/* Truncate the trailing space */
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] PM / devfreq: Use freq_table for available_frequencies
2014-04-11 2:54 ` Saravana Kannan
@ 2014-04-14 20:51 ` Saravana Kannan
-1 siblings, 0 replies; 10+ messages in thread
From: Saravana Kannan @ 2014-04-14 20:51 UTC (permalink / raw)
To: Saravana Kannan
Cc: MyungJoo Ham, Kyungmin Park, linux-pm, linux-kernel,
linux-arm-msm, linux-arm-kernel
MyungJoo/Kyungmin,
Bump. Can we accept this patch please?
-Saravana
On 04/10/2014 07:54 PM, Saravana Kannan wrote:
> Some devices use freq_table instead of OPP. For those devices, the
> available_frequencies file shows up empty. Fix that by using freq_table to
> generate the available_frequencies data when OPP is not present.
>
> Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
> ---
> drivers/devfreq/devfreq.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 2042ec3..a715d15 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -912,19 +912,26 @@ static ssize_t available_frequencies_show(struct device *d,
> struct devfreq *df = to_devfreq(d);
> struct device *dev = df->dev.parent;
> struct dev_pm_opp *opp;
> + unsigned int i = 0, max_state = df->profile->max_state;
> + bool use_opp;
> ssize_t count = 0;
> unsigned long freq = 0;
>
> rcu_read_lock();
> + use_opp = dev_pm_opp_get_opp_count(dev) > 0;
> do {
> - opp = dev_pm_opp_find_freq_ceil(dev, &freq);
> - if (IS_ERR(opp))
> - break;
> + if (use_opp) {
> + opp = dev_pm_opp_find_freq_ceil(dev, &freq);
> + if (IS_ERR(opp))
> + break;
> + } else {
> + freq = df->profile->freq_table[i++];
> + }
>
> count += scnprintf(&buf[count], (PAGE_SIZE - count - 2),
> "%lu ", freq);
> freq++;
> - } while (1);
> + } while (use_opp || (!use_opp && i < max_state));
> rcu_read_unlock();
>
> /* Truncate the trailing space */
>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] PM / devfreq: Use freq_table for available_frequencies
@ 2014-04-14 20:51 ` Saravana Kannan
0 siblings, 0 replies; 10+ messages in thread
From: Saravana Kannan @ 2014-04-14 20:51 UTC (permalink / raw)
To: linux-arm-kernel
MyungJoo/Kyungmin,
Bump. Can we accept this patch please?
-Saravana
On 04/10/2014 07:54 PM, Saravana Kannan wrote:
> Some devices use freq_table instead of OPP. For those devices, the
> available_frequencies file shows up empty. Fix that by using freq_table to
> generate the available_frequencies data when OPP is not present.
>
> Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
> ---
> drivers/devfreq/devfreq.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 2042ec3..a715d15 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -912,19 +912,26 @@ static ssize_t available_frequencies_show(struct device *d,
> struct devfreq *df = to_devfreq(d);
> struct device *dev = df->dev.parent;
> struct dev_pm_opp *opp;
> + unsigned int i = 0, max_state = df->profile->max_state;
> + bool use_opp;
> ssize_t count = 0;
> unsigned long freq = 0;
>
> rcu_read_lock();
> + use_opp = dev_pm_opp_get_opp_count(dev) > 0;
> do {
> - opp = dev_pm_opp_find_freq_ceil(dev, &freq);
> - if (IS_ERR(opp))
> - break;
> + if (use_opp) {
> + opp = dev_pm_opp_find_freq_ceil(dev, &freq);
> + if (IS_ERR(opp))
> + break;
> + } else {
> + freq = df->profile->freq_table[i++];
> + }
>
> count += scnprintf(&buf[count], (PAGE_SIZE - count - 2),
> "%lu ", freq);
> freq++;
> - } while (1);
> + } while (use_opp || (!use_opp && i < max_state));
> rcu_read_unlock();
>
> /* Truncate the trailing space */
>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] PM / devfreq: Use freq_table for available_frequencies
2014-04-15 18:41 ` Saravana Kannan
@ 2014-04-17 0:12 ` Saravana Kannan
-1 siblings, 0 replies; 10+ messages in thread
From: Saravana Kannan @ 2014-04-17 0:12 UTC (permalink / raw)
To: myungjoo.ham
Cc: 박경민,
linux-pm, linux-kernel, linux-arm-msm, linux-arm-kernel
On 04/15/2014 11:41 AM, Saravana Kannan wrote:
> Ah, I misunderstood your previous email. I thought you Nack-ed my patch
> and decided to send your own patch to replace mine. Ok, I'll fix up mine
> and send it out.
MyungJoo/Kyungmin,
I sent out an updated patch. Can you please take a look?
Thanks,
Saravana
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] PM / devfreq: Use freq_table for available_frequencies
@ 2014-04-17 0:12 ` Saravana Kannan
0 siblings, 0 replies; 10+ messages in thread
From: Saravana Kannan @ 2014-04-17 0:12 UTC (permalink / raw)
To: linux-arm-kernel
On 04/15/2014 11:41 AM, Saravana Kannan wrote:
> Ah, I misunderstood your previous email. I thought you Nack-ed my patch
> and decided to send your own patch to replace mine. Ok, I'll fix up mine
> and send it out.
MyungJoo/Kyungmin,
I sent out an updated patch. Can you please take a look?
Thanks,
Saravana
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] PM / devfreq: Use freq_table for available_frequencies
2014-04-15 6:30 함명주
@ 2014-04-15 18:41 ` Saravana Kannan
0 siblings, 0 replies; 10+ messages in thread
From: Saravana Kannan @ 2014-04-15 18:41 UTC (permalink / raw)
To: myungjoo.ham
Cc: 박경민,
linux-pm, linux-kernel, linux-arm-msm, linux-arm-kernel
On 04/14/2014 11:30 PM, 함명주 wrote:
>> On 04/14/2014 06:36 PM, 함명주 wrote:
>>>> MyungJoo/Kyungmin,
>>>>
>>>> Bump. Can we accept this patch please?
>>>>
>>>> -Saravana
>>>
>>> Nack.
>>>
>>> Please note that freq_table is also an optional value, which may
>>> be null.
>>
>> Ah, I saw that the max_freq would be zero if freq_table was NULL and I
>> assumed that it can't be NULL. But I see that the max_freq limit is not
>> applied if it's zero. Thanks for catching it.
>>
>>> Besides, please be aware that your code is under rcu_read_lock().
>>
>> Valid point. I was just trying to keep the diff simple. No one's really
>> going to be catting this file often when performance matters.
>>
>>>
>>>
>>> Cheers,
>>> MyungJoo.
>>>
>>> ps. I'll send a related patch (avoid accessing null but not-an-error
>>> pointer at other sysfs nodes). Thank you for letting me catch such bugs anyway.
>>
>> I can go ahead and do this myself if you don't mind.
>
> No, we don't need it. It was a false alarm.
> Reading again, I've found that we've already made other sysfs nodes
> check if either freq_table is null or its size is 0.
>
> So, we only need to look at this available_frequencies node now.
>
> I'll add some notes on the ABI doc for available_frequencies soon.
>
Ah, I misunderstood your previous email. I thought you Nack-ed my patch
and decided to send your own patch to replace mine. Ok, I'll fix up mine
and send it out.
-Saravana
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] PM / devfreq: Use freq_table for available_frequencies
@ 2014-04-15 18:41 ` Saravana Kannan
0 siblings, 0 replies; 10+ messages in thread
From: Saravana Kannan @ 2014-04-15 18:41 UTC (permalink / raw)
To: linux-arm-kernel
On 04/14/2014 11:30 PM, ??? wrote:
>> On 04/14/2014 06:36 PM, ??? wrote:
>>>> MyungJoo/Kyungmin,
>>>>
>>>> Bump. Can we accept this patch please?
>>>>
>>>> -Saravana
>>>
>>> Nack.
>>>
>>> Please note that freq_table is also an optional value, which may
>>> be null.
>>
>> Ah, I saw that the max_freq would be zero if freq_table was NULL and I
>> assumed that it can't be NULL. But I see that the max_freq limit is not
>> applied if it's zero. Thanks for catching it.
>>
>>> Besides, please be aware that your code is under rcu_read_lock().
>>
>> Valid point. I was just trying to keep the diff simple. No one's really
>> going to be catting this file often when performance matters.
>>
>>>
>>>
>>> Cheers,
>>> MyungJoo.
>>>
>>> ps. I'll send a related patch (avoid accessing null but not-an-error
>>> pointer at other sysfs nodes). Thank you for letting me catch such bugs anyway.
>>
>> I can go ahead and do this myself if you don't mind.
>
> No, we don't need it. It was a false alarm.
> Reading again, I've found that we've already made other sysfs nodes
> check if either freq_table is null or its size is 0.
>
> So, we only need to look at this available_frequencies node now.
>
> I'll add some notes on the ABI doc for available_frequencies soon.
>
Ah, I misunderstood your previous email. I thought you Nack-ed my patch
and decided to send your own patch to replace mine. Ok, I'll fix up mine
and send it out.
-Saravana
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] PM / devfreq: Use freq_table for available_frequencies
2014-04-15 1:36 함명주
@ 2014-04-15 5:16 ` Saravana Kannan
0 siblings, 0 replies; 10+ messages in thread
From: Saravana Kannan @ 2014-04-15 5:16 UTC (permalink / raw)
To: myungjoo.ham
Cc: 박경민,
linux-pm, linux-kernel, linux-arm-msm, linux-arm-kernel
On 04/14/2014 06:36 PM, 함명주 wrote:
>> MyungJoo/Kyungmin,
>>
>> Bump. Can we accept this patch please?
>>
>> -Saravana
>
> Nack.
>
> Please note that freq_table is also an optional value, which may
> be null.
Ah, I saw that the max_freq would be zero if freq_table was NULL and I
assumed that it can't be NULL. But I see that the max_freq limit is not
applied if it's zero. Thanks for catching it.
> Besides, please be aware that your code is under rcu_read_lock().
Valid point. I was just trying to keep the diff simple. No one's really
going to be catting this file often when performance matters.
>
>
> Cheers,
> MyungJoo.
>
> ps. I'll send a related patch (avoid accessing null but not-an-error
> pointer at other sysfs nodes). Thank you for letting me catch such bugs anyway.
I can go ahead and do this myself if you don't mind.
-Saravana
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] PM / devfreq: Use freq_table for available_frequencies
@ 2014-04-15 5:16 ` Saravana Kannan
0 siblings, 0 replies; 10+ messages in thread
From: Saravana Kannan @ 2014-04-15 5:16 UTC (permalink / raw)
To: linux-arm-kernel
On 04/14/2014 06:36 PM, ??? wrote:
>> MyungJoo/Kyungmin,
>>
>> Bump. Can we accept this patch please?
>>
>> -Saravana
>
> Nack.
>
> Please note that freq_table is also an optional value, which may
> be null.
Ah, I saw that the max_freq would be zero if freq_table was NULL and I
assumed that it can't be NULL. But I see that the max_freq limit is not
applied if it's zero. Thanks for catching it.
> Besides, please be aware that your code is under rcu_read_lock().
Valid point. I was just trying to keep the diff simple. No one's really
going to be catting this file often when performance matters.
>
>
> Cheers,
> MyungJoo.
>
> ps. I'll send a related patch (avoid accessing null but not-an-error
> pointer at other sysfs nodes). Thank you for letting me catch such bugs anyway.
I can go ahead and do this myself if you don't mind.
-Saravana
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-04-17 0:12 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-11 2:54 [PATCH] PM / devfreq: Use freq_table for available_frequencies Saravana Kannan
2014-04-11 2:54 ` Saravana Kannan
2014-04-14 20:51 ` Saravana Kannan
2014-04-14 20:51 ` Saravana Kannan
2014-04-15 1:36 함명주
2014-04-15 5:16 ` Saravana Kannan
2014-04-15 5:16 ` Saravana Kannan
2014-04-15 6:30 함명주
2014-04-15 18:41 ` Saravana Kannan
2014-04-15 18:41 ` Saravana Kannan
2014-04-17 0:12 ` Saravana Kannan
2014-04-17 0:12 ` Saravana Kannan
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.