All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6/6] PM / devfreq: Set the min_freq and max_freq of devfreq device
  2015-11-19  8:17 [PATCH 0/6] PM / devfreq: Clean code and add set the freq_table array Chanwoo Choi
@ 2015-11-19  8:17 ` Chanwoo Choi
  0 siblings, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2015-11-19  8:17 UTC (permalink / raw)
  To: myungjoo.ham, kyungmin.park; +Cc: linux-kernel, linux-pm, Chanwoo Choi

After probing the devfreq device driver, the value of both min_freq and
max_freq are zero(0). So, this patch initializes the 'min_freq' and 'max_freq'
field of devfreq device by using the freq_table array.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/devfreq/devfreq.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index c292ceb7ff19..0b24ae7b7a48 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -121,6 +121,11 @@ static void devfreq_set_freq_table(struct devfreq *devfreq)
 		profile->freq_table[i] = freq;
 	}
 	rcu_read_unlock();
+
+	mutex_lock(&devfreq->lock);
+	devfreq->min_freq = profile->freq_table[0];
+	devfreq->max_freq = profile->freq_table[profile->max_state - 1];
+	mutex_unlock(&devfreq->lock);
 }
 
 /**
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 6/6] PM / devfreq: Set the min_freq and max_freq of devfreq device
@ 2015-11-19 10:10 ` MyungJoo Ham
  0 siblings, 0 replies; 4+ messages in thread
From: MyungJoo Ham @ 2015-11-19 10:10 UTC (permalink / raw)
  To: 최찬우, 박경민
  Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org

> After probing the devfreq device driver, the value of both min_freq and
> max_freq are zero(0). So, this patch initializes the 'min_freq' and 'max_freq'
> field of devfreq device by using the freq_table array.
> 
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> ---
>  drivers/devfreq/devfreq.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index c292ceb7ff19..0b24ae7b7a48 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -121,6 +121,11 @@ static void devfreq_set_freq_table(struct devfreq *devfreq)
>  		profile->freq_table[i] = freq;
>  	}
>  	rcu_read_unlock();
> +
> +	mutex_lock(&devfreq->lock);
> +	devfreq->min_freq = profile->freq_table[0];
> +	devfreq->max_freq = profile->freq_table[profile->max_state - 1];
> +	mutex_unlock(&devfreq->lock);
>  }

No, you should not do this.

It is allowed to use devfreq without both OPP and freq_table
assuming that the devfreq device may operate with very many
frequencies so that practically, we can virtually give it
any frequency numbers in a given range.
(cases where profile->max_state is 0 and it is not an error)

The value 0 is used for min/max_freq to declare
that min/max_freq is deactivated. Therefore, it is not
required to do so; they are not intended to show the hardware
configuration as well.

Cheers,
MyungJoo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 6/6] PM / devfreq: Set the min_freq and max_freq of devfreq device
@ 2015-11-19 10:10 ` MyungJoo Ham
  0 siblings, 0 replies; 4+ messages in thread
From: MyungJoo Ham @ 2015-11-19 10:10 UTC (permalink / raw)
  To: 최찬우, 박경민
  Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 1548 bytes --]

> After probing the devfreq device driver, the value of both min_freq and
> max_freq are zero(0). So, this patch initializes the 'min_freq' and 'max_freq'
> field of devfreq device by using the freq_table array.
> 
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> ---
>  drivers/devfreq/devfreq.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index c292ceb7ff19..0b24ae7b7a48 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -121,6 +121,11 @@ static void devfreq_set_freq_table(struct devfreq *devfreq)
>  		profile->freq_table[i] = freq;
>  	}
>  	rcu_read_unlock();
> +
> +	mutex_lock(&devfreq->lock);
> +	devfreq->min_freq = profile->freq_table[0];
> +	devfreq->max_freq = profile->freq_table[profile->max_state - 1];
> +	mutex_unlock(&devfreq->lock);
>  }

No, you should not do this.

It is allowed to use devfreq without both OPP and freq_table
assuming that the devfreq device may operate with very many
frequencies so that practically, we can virtually give it
any frequency numbers in a given range.
(cases where profile->max_state is 0 and it is not an error)

The value 0 is used for min/max_freq to declare
that min/max_freq is deactivated. Therefore, it is not
required to do so; they are not intended to show the hardware
configuration as well.

Cheers,
MyungJoo
ÿôèº{.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¥

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 6/6] PM / devfreq: Set the min_freq and max_freq of devfreq device
  2015-11-19 10:10 ` MyungJoo Ham
  (?)
@ 2015-11-19 10:37 ` Chanwoo Choi
  -1 siblings, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2015-11-19 10:37 UTC (permalink / raw)
  To: myungjoo.ham, 박경민
  Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org

On 2015년 11월 19일 19:10, MyungJoo Ham wrote:
>> After probing the devfreq device driver, the value of both min_freq and
>> max_freq are zero(0). So, this patch initializes the 'min_freq' and 'max_freq'
>> field of devfreq device by using the freq_table array.
>>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> ---
>>  drivers/devfreq/devfreq.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
>> index c292ceb7ff19..0b24ae7b7a48 100644
>> --- a/drivers/devfreq/devfreq.c
>> +++ b/drivers/devfreq/devfreq.c
>> @@ -121,6 +121,11 @@ static void devfreq_set_freq_table(struct devfreq *devfreq)
>>  		profile->freq_table[i] = freq;
>>  	}
>>  	rcu_read_unlock();
>> +
>> +	mutex_lock(&devfreq->lock);
>> +	devfreq->min_freq = profile->freq_table[0];
>> +	devfreq->max_freq = profile->freq_table[profile->max_state - 1];
>> +	mutex_unlock(&devfreq->lock);
>>  }
> 
> No, you should not do this.
> 
> It is allowed to use devfreq without both OPP and freq_table
> assuming that the devfreq device may operate with very many
> frequencies so that practically, we can virtually give it
> any frequency numbers in a given range.
> (cases where profile->max_state is 0 and it is not an error)
> 
> The value 0 is used for min/max_freq to declare
> that min/max_freq is deactivated. Therefore, it is not
> required to do so; they are not intended to show the hardware
> configuration as well.

This case consider the devfreq device using OPP because devfreq_set_freq_table()
get the number of OPP entry in OPP list before setting the min_freq/max_freq.
If the devfreq device don't use the OPP entry, devfreq_set_freq_table()
will return without any operation.

IMHO, when devfreq device uses the OPP table including the frequency,
min_freq/max_freq should show the correct value as CPUFREQ framework.

Regards,
Chanwoo CHoi




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-19 10:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-19 10:10 [PATCH 6/6] PM / devfreq: Set the min_freq and max_freq of devfreq device MyungJoo Ham
2015-11-19 10:10 ` MyungJoo Ham
2015-11-19 10:37 ` Chanwoo Choi
  -- strict thread matches above, loose matches on Subject: below --
2015-11-19  8:17 [PATCH 0/6] PM / devfreq: Clean code and add set the freq_table array Chanwoo Choi
2015-11-19  8:17 ` [PATCH 6/6] PM / devfreq: Set the min_freq and max_freq of devfreq device Chanwoo Choi

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.