All of lore.kernel.org
 help / color / mirror / Atom feed
From: <Codrin.Ciubotariu@microchip.com>
To: <Nicolas.Ferre@microchip.com>, <linux-clk@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Cc: <mturquette@baylibre.com>, <sboyd@kernel.org>,
	<alexandre.belloni@bootlin.com>,
	<Ludovic.Desroches@microchip.com>, <Claudiu.Beznea@microchip.com>
Subject: Re: [PATCH] clk: at91: clk-generated: Limit the requested rate to our range
Date: Fri, 9 Jul 2021 09:59:57 +0000	[thread overview]
Message-ID: <25631072-d9a3-0d84-fd47-4d2414f079f6@microchip.com> (raw)
In-Reply-To: <7586cf33-078a-cb85-98c8-9969baa0f19d@microchip.com>

On 09.07.2021 12:21, Nicolas Ferre wrote:
> On 07/07/2021 at 15:12, Codrin Ciubotariu wrote:
>> On clk_generated_determine_rate(), the requested rate could be outside
>> of clk's range. Limit the rate to the clock's range to not return an
>> error.
> 
> Isn't it saner for the user to return an error code instead of 
> automatically restrain the dynamics requested without notice?
> 
> Can you elaborate the use case where returning an error is not convenient?

The way I see it, if the user requests a rate that is out of clock's 
range, the driver's determine_rate() should return min/max, not an 
error. That is actually the closest rate supported by the clock, which 
is what determine_rate() should accomplish. The user has no clk API to 
get clock's range, so there is no way to call clk_round_rate() only for 
values within our range.

The use cause is with sam9x60's I2S driver, which has to try different 
rates to get the closest one to what it needs. There is no 'perfect' 
rate, because there is no AUDIO PLL and we have to try different values 
for our internal dividers to find the closest one.

https://elixir.bootlin.com/linux/latest/source/sound/soc/atmel/mchp-i2s-mcc.c#L416

Best regards,
Codrin

WARNING: multiple messages have this Message-ID (diff)
From: <Codrin.Ciubotariu@microchip.com>
To: <Nicolas.Ferre@microchip.com>, <linux-clk@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Cc: <mturquette@baylibre.com>, <sboyd@kernel.org>,
	<alexandre.belloni@bootlin.com>,
	<Ludovic.Desroches@microchip.com>, <Claudiu.Beznea@microchip.com>
Subject: Re: [PATCH] clk: at91: clk-generated: Limit the requested rate to our range
Date: Fri, 9 Jul 2021 09:59:57 +0000	[thread overview]
Message-ID: <25631072-d9a3-0d84-fd47-4d2414f079f6@microchip.com> (raw)
In-Reply-To: <7586cf33-078a-cb85-98c8-9969baa0f19d@microchip.com>

On 09.07.2021 12:21, Nicolas Ferre wrote:
> On 07/07/2021 at 15:12, Codrin Ciubotariu wrote:
>> On clk_generated_determine_rate(), the requested rate could be outside
>> of clk's range. Limit the rate to the clock's range to not return an
>> error.
> 
> Isn't it saner for the user to return an error code instead of 
> automatically restrain the dynamics requested without notice?
> 
> Can you elaborate the use case where returning an error is not convenient?

The way I see it, if the user requests a rate that is out of clock's 
range, the driver's determine_rate() should return min/max, not an 
error. That is actually the closest rate supported by the clock, which 
is what determine_rate() should accomplish. The user has no clk API to 
get clock's range, so there is no way to call clk_round_rate() only for 
values within our range.

The use cause is with sam9x60's I2S driver, which has to try different 
rates to get the closest one to what it needs. There is no 'perfect' 
rate, because there is no AUDIO PLL and we have to try different values 
for our internal dividers to find the closest one.

https://elixir.bootlin.com/linux/latest/source/sound/soc/atmel/mchp-i2s-mcc.c#L416

Best regards,
Codrin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-07-09 10:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 13:12 [PATCH] clk: at91: clk-generated: Limit the requested rate to our range Codrin Ciubotariu
2021-07-07 13:12 ` Codrin Ciubotariu
2021-07-09  9:21 ` Nicolas Ferre
2021-07-09  9:21   ` Nicolas Ferre
2021-07-09  9:59   ` Codrin.Ciubotariu [this message]
2021-07-09  9:59     ` Codrin.Ciubotariu
2021-07-16 19:17     ` Nicolas Ferre
2021-07-16 19:17       ` Nicolas Ferre
2021-08-29  5:28 ` Stephen Boyd
2021-08-29  5:28   ` Stephen Boyd

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=25631072-d9a3-0d84-fd47-4d2414f079f6@microchip.com \
    --to=codrin.ciubotariu@microchip.com \
    --cc=Claudiu.Beznea@microchip.com \
    --cc=Ludovic.Desroches@microchip.com \
    --cc=Nicolas.Ferre@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.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.