All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Mike Turquette" <mturquette@linaro.org>,
	linux-pm@vger.kernel.org,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"Michal Simek" <michal.simek@xilinx.com>,
	cpufreq@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Russell King" <linux@arm.linux.org.uk>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 2/5] clk: Introduce 'clk_round_rate_nearest()'
Date: Tue, 20 May 2014 10:48:43 -0700	[thread overview]
Message-ID: <537B957B.5010001@codeaurora.org> (raw)
In-Reply-To: <4bb5f44a-60bb-4e34-8f88-f91b8419be8d@BL2FFO11FD050.protection.gbl>

On 05/20/14 09:01, Sören Brinkmann wrote:
>
>>>>> +{
>>>>> +	unsigned long lower, upper, cur, lower_last, upper_last;
>>>>> +
>>>>> +	lower = clk_round_rate(clk, rate);
>>>>> +	if (lower >= rate)
>>>>> +		return lower;
>>>> Is the >-case worth a warning?
>>> No, it's correct behavior. If you request a rate that is way lower than what the
>>> clock can generate, returning something larger is perfectly valid, IMHO.
>>> Which reveals one problem in this whole discussion. The API does not
>>> require clk_round_rate() to round down. It is actually an implementation
>>> choice that had been made for clk-divider.
>> I'm sure it's more than an implementation choice for clk-divider. But I
>> don't find any respective documentation (but I didn't try hard).
> A similar discussion - without final conclusion:
> https://lkml.org/lkml/2010/7/14/260
>
>

Please call this new API something like clk_find_nearest_rate() or
something. clk_round_rate() is supposed to return the rate that will be
set if you call clk_set_rate() with the same arguments. It's up to the
implementation to decide if that means rounding the rate up or down or
to the nearest value.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@codeaurora.org>
To: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Mike Turquette" <mturquette@linaro.org>,
	linux-pm@vger.kernel.org,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"Michal Simek" <michal.simek@xilinx.com>,
	cpufreq@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Russell King" <linux@arm.linux.org.uk>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 2/5] clk: Introduce 'clk_round_rate_nearest()'
Date: Tue, 20 May 2014 10:48:43 -0700	[thread overview]
Message-ID: <537B957B.5010001@codeaurora.org> (raw)
In-Reply-To: <4bb5f44a-60bb-4e34-8f88-f91b8419be8d@BL2FFO11FD050.protection.gbl>

On 05/20/14 09:01, Sören Brinkmann wrote:
>
>>>>> +{
>>>>> +	unsigned long lower, upper, cur, lower_last, upper_last;
>>>>> +
>>>>> +	lower = clk_round_rate(clk, rate);
>>>>> +	if (lower >= rate)
>>>>> +		return lower;
>>>> Is the >-case worth a warning?
>>> No, it's correct behavior. If you request a rate that is way lower than what the
>>> clock can generate, returning something larger is perfectly valid, IMHO.
>>> Which reveals one problem in this whole discussion. The API does not
>>> require clk_round_rate() to round down. It is actually an implementation
>>> choice that had been made for clk-divider.
>> I'm sure it's more than an implementation choice for clk-divider. But I
>> don't find any respective documentation (but I didn't try hard).
> A similar discussion - without final conclusion:
> https://lkml.org/lkml/2010/7/14/260
>
>

Please call this new API something like clk_find_nearest_rate() or
something. clk_round_rate() is supposed to return the rate that will be
set if you call clk_set_rate() with the same arguments. It's up to the
implementation to decide if that means rounding the rate up or down or
to the nearest value.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 2/5] clk: Introduce 'clk_round_rate_nearest()'
Date: Tue, 20 May 2014 10:48:43 -0700	[thread overview]
Message-ID: <537B957B.5010001@codeaurora.org> (raw)
In-Reply-To: <4bb5f44a-60bb-4e34-8f88-f91b8419be8d@BL2FFO11FD050.protection.gbl>

On 05/20/14 09:01, S?ren Brinkmann wrote:
>
>>>>> +{
>>>>> +	unsigned long lower, upper, cur, lower_last, upper_last;
>>>>> +
>>>>> +	lower = clk_round_rate(clk, rate);
>>>>> +	if (lower >= rate)
>>>>> +		return lower;
>>>> Is the >-case worth a warning?
>>> No, it's correct behavior. If you request a rate that is way lower than what the
>>> clock can generate, returning something larger is perfectly valid, IMHO.
>>> Which reveals one problem in this whole discussion. The API does not
>>> require clk_round_rate() to round down. It is actually an implementation
>>> choice that had been made for clk-divider.
>> I'm sure it's more than an implementation choice for clk-divider. But I
>> don't find any respective documentation (but I didn't try hard).
> A similar discussion - without final conclusion:
> https://lkml.org/lkml/2010/7/14/260
>
>

Please call this new API something like clk_find_nearest_rate() or
something. clk_round_rate() is supposed to return the rate that will be
set if you call clk_set_rate() with the same arguments. It's up to the
implementation to decide if that means rounding the rate up or down or
to the nearest value.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

  reply	other threads:[~2014-05-20 17:48 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 22:30 [RFC PATCH 0/5] Frequency resolution in CCF vs. cpufreq Soren Brinkmann
2014-05-14 22:30 ` Soren Brinkmann
2014-05-14 22:30 ` Soren Brinkmann
2014-05-14 22:30 ` [RFC PATCH 1/5] cpufreq: stats: Allow small rounding errors Soren Brinkmann
2014-05-14 22:30   ` Soren Brinkmann
2014-05-14 22:30   ` Soren Brinkmann
2014-05-14 22:30 ` [RFC PATCH 2/5] clk: Introduce 'clk_round_rate_nearest()' Soren Brinkmann
2014-05-14 22:30   ` Soren Brinkmann
2014-05-15  7:38   ` Uwe Kleine-König
2014-05-15  7:38     ` Uwe Kleine-König
2014-05-15 14:10     ` Sören Brinkmann
2014-05-15 14:10       ` Sören Brinkmann
2014-05-15 14:10       ` Sören Brinkmann
2014-05-19  0:51     ` Sören Brinkmann
2014-05-19  0:51       ` Sören Brinkmann
2014-05-19  0:51       ` Sören Brinkmann
2014-05-19 16:19       ` Uwe Kleine-König
2014-05-19 16:19         ` Uwe Kleine-König
2014-05-19 16:41         ` Sören Brinkmann
2014-05-19 16:41           ` Sören Brinkmann
2014-05-19 16:41           ` Sören Brinkmann
2014-05-19 17:29           ` Sören Brinkmann
2014-05-19 17:29             ` Sören Brinkmann
2014-05-19 17:29             ` Sören Brinkmann
2014-05-20  7:51             ` Uwe Kleine-König
2014-05-20  7:51               ` Uwe Kleine-König
2014-05-20  7:33           ` Uwe Kleine-König
2014-05-20  7:33             ` Uwe Kleine-König
2014-05-20 16:01             ` Sören Brinkmann
2014-05-20 16:01               ` Sören Brinkmann
2014-05-20 16:01               ` Sören Brinkmann
2014-05-20 17:48               ` Stephen Boyd [this message]
2014-05-20 17:48                 ` Stephen Boyd
2014-05-20 17:48                 ` Stephen Boyd
2014-05-20 21:48                 ` Sören Brinkmann
2014-05-20 21:48                   ` Sören Brinkmann
2014-05-21  7:34                   ` Uwe Kleine-König
2014-05-21  7:34                     ` Uwe Kleine-König
2014-05-21 15:58                     ` Sören Brinkmann
2014-05-21 15:58                       ` Sören Brinkmann
2014-05-21 15:58                       ` Sören Brinkmann
2014-05-21 18:23                       ` Uwe Kleine-König
2014-05-21 18:23                         ` Uwe Kleine-König
2014-05-21 20:19                         ` Sören Brinkmann
2014-05-21 20:19                           ` Sören Brinkmann
2014-05-21 20:19                           ` Sören Brinkmann
2014-05-21 20:33                         ` Mike Turquette
2014-05-21 20:33                           ` Mike Turquette
2014-05-22 18:03                           ` Sören Brinkmann
2014-05-22 18:03                             ` Sören Brinkmann
2014-05-22 18:20                             ` Uwe Kleine-König
2014-05-22 18:20                               ` Uwe Kleine-König
2014-05-22 20:32                               ` Sören Brinkmann
2014-05-22 20:32                                 ` Sören Brinkmann
2014-05-22 20:32                                 ` Sören Brinkmann
2014-05-22 21:03                                 ` Mike Turquette
2014-05-22 21:03                                   ` Mike Turquette
2014-05-22 23:44                                   ` Sören Brinkmann
2014-05-22 23:44                                     ` Sören Brinkmann
2014-05-23  1:37                                     ` Mike Turquette
2014-05-23  1:37                                       ` Mike Turquette
2014-05-23 16:14                                       ` Sören Brinkmann
2014-05-23 16:14                                         ` Sören Brinkmann
2014-05-23 16:14                                         ` Sören Brinkmann
2014-05-26  6:29                                         ` Viresh Kumar
2014-05-26  6:29                                           ` Viresh Kumar
2014-05-26  6:29                                           ` Viresh Kumar
2014-05-26 11:22                                           ` Rafael J. Wysocki
2014-05-26 11:22                                             ` Rafael J. Wysocki
2014-05-26 11:22                                             ` Rafael J. Wysocki
2014-05-26 11:07                                             ` Viresh Kumar
2014-05-26 11:07                                               ` Viresh Kumar
2014-05-26 11:47                                               ` Rafael J. Wysocki
2014-05-26 11:47                                                 ` Rafael J. Wysocki
2014-05-26 21:52                                                 ` Sören Brinkmann
2014-05-26 21:52                                                   ` Sören Brinkmann
2014-05-26 21:52                                                   ` Sören Brinkmann
2014-05-28  2:05                                             ` Mike Turquette
2014-05-28  2:05                                               ` Mike Turquette
2014-05-28  2:05                                               ` Mike Turquette
2014-05-28 16:17                                               ` Rafael J. Wysocki
2014-05-28 16:17                                                 ` Rafael J. Wysocki
2014-05-28 16:17                                                 ` Rafael J. Wysocki
2014-06-07  0:44                               ` Sören Brinkmann
2014-06-07  0:44                                 ` Sören Brinkmann
2014-06-07  0:44                                 ` Sören Brinkmann
2014-05-14 22:30 ` [RFC PATCH 3/5] cpufreq: cpu0: Use clk_round_rate_nearest() Soren Brinkmann
2014-05-14 22:30   ` Soren Brinkmann
2014-05-14 22:30 ` [RFC PATCH 4/5] ARM: zynq: dt: Use properly rounded frequencies in OPPs Soren Brinkmann
2014-05-14 22:30   ` Soren Brinkmann
2014-05-14 22:30 ` [RFC PATCH 5/5] net: macb: Use clk_round_rate_nearest() API Soren Brinkmann
2014-05-14 22:30   ` Soren Brinkmann
2014-05-15  6:12 ` [RFC PATCH 0/5] Frequency resolution in CCF vs. cpufreq Viresh Kumar
2014-05-15  6:12   ` Viresh Kumar
2014-05-15 14:05   ` Sören Brinkmann
2014-05-15 14:05     ` Sören Brinkmann
2014-05-15 14:05     ` Sören Brinkmann
2014-05-15  7:47 ` Uwe Kleine-König
2014-05-15  7:47   ` Uwe Kleine-König
2014-05-15 12:14   ` Nishanth Menon
2014-05-15 12:14     ` Nishanth Menon
2014-05-15 12:14     ` Nishanth Menon
2014-05-15 14:00   ` Sören Brinkmann
2014-05-15 14:00     ` Sören Brinkmann
2014-05-15 14:00     ` Sören Brinkmann

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=537B957B.5010001@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=michal.simek@xilinx.com \
    --cc=mturquette@linaro.org \
    --cc=rjw@rjwysocki.net \
    --cc=soren.brinkmann@xilinx.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --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.