From: Ryan Mallon <ryan@bluewatersys.com>
To: H Hartley Sweeten <hartleys@visionengravers.com>
Cc: "john.cooper@third-harmonic.com" <john.cooper@third-harmonic.com>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"chasedouglas@gmail.com" <chasedouglas@gmail.com>,
"buytenh@wantstofly.org" <buytenh@wantstofly.org>,
"r&d4@dave-tech.it" <r&d4@dave-tech.it>,
"lrg@slimlogic.co.uk" <lrg@slimlogic.co.uk>,
"marshall@coolbananas.co.nz" <marshall@coolbananas.co.nz>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"dhuggins@cs.cmu.edu" <dhuggins@cs.cmu.edu>
Subject: Re: [RFC PATCH v3 1/3] ep93xx i2s core support
Date: Tue, 08 Jun 2010 10:21:53 +1200 [thread overview]
Message-ID: <4C0D7101.6030506@bluewatersys.com> (raw)
In-Reply-To: <0D753D10438DA54287A00B0270842697636F83B425@AUSP01VMBX24.collaborationhost.net>
H Hartley Sweeten wrote:
> On Thursday, June 03, 2010 10:11 PM, Ryan Mallon wrote:
>> Add ep93xx core support for i2s audio
>>
>> Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>
>> ---
>> arch/arm/mach-ep93xx/clock.c | 69 ++++++++++++++++++++++-
>> arch/arm/mach-ep93xx/core.c | 31 ++++++++++
>> arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h | 10 +++
>> arch/arm/mach-ep93xx/include/mach/platform.h | 1 +
>> 4 files changed, 110 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
>> index 5f80092..503d430 100644
>> --- a/arch/arm/mach-ep93xx/clock.c
>> +++ b/arch/arm/mach-ep93xx/clock.c
>> @@ -43,7 +43,8 @@ static unsigned long get_uart_rate(struct clk *clk);
>>
>> static int set_keytchclk_rate(struct clk *clk, unsigned long rate);
>> static int set_div_rate(struct clk *clk, unsigned long rate);
>> -
>> +static int set_i2s_sclk_rate(struct clk *clk, unsigned long rate);
>> +static int set_i2s_lrclk_rate(struct clk *clk, unsigned long rate);
>>
>> static struct clk clk_xtali = {
>> .rate = EP93XX_EXT_CLK_RATE,
>> @@ -108,6 +109,31 @@ static struct clk clk_video = {
>> .set_rate = set_div_rate,
>> };
>>
>> +static struct clk clk_i2s_mclk = {
>> + .sw_locked = 1,
>> + .enable_reg = EP93XX_SYSCON_I2SCLKDIV,
>> + .enable_mask = (EP93XX_SYSCON_CLKDIV_ENABLE |
>> + EP93XX_SYSCON_I2SCLKDIV_SPOL |
>> + EP93XX_SYSCON_I2SCLKDIV_ORIDE),
>
> Setting the SPOL and ORIDE bits here might cause problems in the future.
> Granted, your i2s driver is currently the only user so its probably ok
> for now.
>
> But, you might want to move the setting of those two bits along with the
> SLAVE and DROP bits to the core registration function. The clock support
> should only be enabling/disabling and setting the rates for the clocks.
Okay, sounds sensible. Possibly I should add acquire/release functions
in addition to the register, something like:
void __init ep93xx_register_i2s(void)
{
platform_device_register(&ep93xx_i2s_device);
}
int ep93xx_i2s_acquire(unsigned pins, int override, int sclk_falling)
{
unsigned set_bits = pins,
clear_bits = EP93XX_SYSCON_DEVCFG_I2SONSSP |
EP93XX_SYSCON_DEVCFG_I2SONAC97;
if (pins != EP93XX_SYSCON_DEVCFG_I2SONSSP &&
pins != EP93XX_SYSCON_DEVCFG_I2SONAC97)
return -EINVAL;
if (override)
set_bits |= EP93XX_SYSCON_I2SCLKDIV_ORIDE;
else
clear_bits |= EP93XX_SYSCON_I2SCLKDIV_ORIDE;
if (sclk_falling)
set_bits |= EP93XX_SYSCON_I2SCLKDIV_SPOL;
else
clear_bits |= EP93XX_SYSCON_I2SCLKDIV_SPOL;
ep93xx_devcfg_clear_bits(clear_bits);
ep93xx_devcfg_set_bits(set_bits);
return 0;
}
>> + .set_rate = set_div_rate,
>
> By calling the set_div_rate routine your only updating the master clock
> rate. Should the new rate be pushed down to the children? Actually the
> new rates for the children will be established automatically when the
> master clock rate is changed. But a clk_get_rate for the children will
> return an incorrect value. Maybe just add a get_rate method for the
> children?
The code basically assumes that the clocks will always be set in the
order: mclk, sclk, lrclk. Since the i2s driver is the only user, this
should be a valid assumption. Possibly a comment should be put in to
state that this assumption is made.
~Ryan
--
Bluewater Systems Ltd - ARM Technology Solution Centre
Ryan Mallon 5 Amuri Park, 404 Barbadoes St
ryan@bluewatersys.com PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com New Zealand
Phone: +64 3 3779127 Freecall: Australia 1800 148 751
Fax: +64 3 3779135 USA 1800 261 2934
WARNING: multiple messages have this Message-ID (diff)
From: ryan@bluewatersys.com (Ryan Mallon)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v3 1/3] ep93xx i2s core support
Date: Tue, 08 Jun 2010 10:21:53 +1200 [thread overview]
Message-ID: <4C0D7101.6030506@bluewatersys.com> (raw)
In-Reply-To: <0D753D10438DA54287A00B0270842697636F83B425@AUSP01VMBX24.collaborationhost.net>
H Hartley Sweeten wrote:
> On Thursday, June 03, 2010 10:11 PM, Ryan Mallon wrote:
>> Add ep93xx core support for i2s audio
>>
>> Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>
>> ---
>> arch/arm/mach-ep93xx/clock.c | 69 ++++++++++++++++++++++-
>> arch/arm/mach-ep93xx/core.c | 31 ++++++++++
>> arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h | 10 +++
>> arch/arm/mach-ep93xx/include/mach/platform.h | 1 +
>> 4 files changed, 110 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
>> index 5f80092..503d430 100644
>> --- a/arch/arm/mach-ep93xx/clock.c
>> +++ b/arch/arm/mach-ep93xx/clock.c
>> @@ -43,7 +43,8 @@ static unsigned long get_uart_rate(struct clk *clk);
>>
>> static int set_keytchclk_rate(struct clk *clk, unsigned long rate);
>> static int set_div_rate(struct clk *clk, unsigned long rate);
>> -
>> +static int set_i2s_sclk_rate(struct clk *clk, unsigned long rate);
>> +static int set_i2s_lrclk_rate(struct clk *clk, unsigned long rate);
>>
>> static struct clk clk_xtali = {
>> .rate = EP93XX_EXT_CLK_RATE,
>> @@ -108,6 +109,31 @@ static struct clk clk_video = {
>> .set_rate = set_div_rate,
>> };
>>
>> +static struct clk clk_i2s_mclk = {
>> + .sw_locked = 1,
>> + .enable_reg = EP93XX_SYSCON_I2SCLKDIV,
>> + .enable_mask = (EP93XX_SYSCON_CLKDIV_ENABLE |
>> + EP93XX_SYSCON_I2SCLKDIV_SPOL |
>> + EP93XX_SYSCON_I2SCLKDIV_ORIDE),
>
> Setting the SPOL and ORIDE bits here might cause problems in the future.
> Granted, your i2s driver is currently the only user so its probably ok
> for now.
>
> But, you might want to move the setting of those two bits along with the
> SLAVE and DROP bits to the core registration function. The clock support
> should only be enabling/disabling and setting the rates for the clocks.
Okay, sounds sensible. Possibly I should add acquire/release functions
in addition to the register, something like:
void __init ep93xx_register_i2s(void)
{
platform_device_register(&ep93xx_i2s_device);
}
int ep93xx_i2s_acquire(unsigned pins, int override, int sclk_falling)
{
unsigned set_bits = pins,
clear_bits = EP93XX_SYSCON_DEVCFG_I2SONSSP |
EP93XX_SYSCON_DEVCFG_I2SONAC97;
if (pins != EP93XX_SYSCON_DEVCFG_I2SONSSP &&
pins != EP93XX_SYSCON_DEVCFG_I2SONAC97)
return -EINVAL;
if (override)
set_bits |= EP93XX_SYSCON_I2SCLKDIV_ORIDE;
else
clear_bits |= EP93XX_SYSCON_I2SCLKDIV_ORIDE;
if (sclk_falling)
set_bits |= EP93XX_SYSCON_I2SCLKDIV_SPOL;
else
clear_bits |= EP93XX_SYSCON_I2SCLKDIV_SPOL;
ep93xx_devcfg_clear_bits(clear_bits);
ep93xx_devcfg_set_bits(set_bits);
return 0;
}
>> + .set_rate = set_div_rate,
>
> By calling the set_div_rate routine your only updating the master clock
> rate. Should the new rate be pushed down to the children? Actually the
> new rates for the children will be established automatically when the
> master clock rate is changed. But a clk_get_rate for the children will
> return an incorrect value. Maybe just add a get_rate method for the
> children?
The code basically assumes that the clocks will always be set in the
order: mclk, sclk, lrclk. Since the i2s driver is the only user, this
should be a valid assumption. Possibly a comment should be put in to
state that this assumption is made.
~Ryan
--
Bluewater Systems Ltd - ARM Technology Solution Centre
Ryan Mallon 5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com New Zealand
Phone: +64 3 3779127 Freecall: Australia 1800 148 751
Fax: +64 3 3779135 USA 1800 261 2934
next prev parent reply other threads:[~2010-06-07 22:21 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-04 5:11 [RFC PATCH v3 0/3] ep93xx i2s audio Ryan Mallon
2010-06-04 5:11 ` Ryan Mallon
2010-06-04 5:11 ` [RFC PATCH v3 1/3] ep93xx i2s core support Ryan Mallon
2010-06-04 5:11 ` Ryan Mallon
2010-06-04 5:11 ` [RFC PATCH v3 2/3] ep93xx i2s audio driver Ryan Mallon
2010-06-04 5:11 ` Ryan Mallon
2010-06-04 5:11 ` [RFC PATCH v3 3/3] Snapper cl15 audio support Ryan Mallon
2010-06-04 5:11 ` Ryan Mallon
2010-06-07 21:55 ` [RFC PATCH v3 1/3] ep93xx i2s core support H Hartley Sweeten
2010-06-07 21:55 ` H Hartley Sweeten
2010-06-07 22:21 ` Ryan Mallon [this message]
2010-06-07 22:21 ` Ryan Mallon
2010-06-07 12:45 ` [RFC PATCH v3 0/3] ep93xx i2s audio Liam Girdwood
2010-06-07 12:45 ` [alsa-devel] " Liam Girdwood
2010-06-07 20:38 ` Ryan Mallon
2010-06-07 20:38 ` [alsa-devel] " Ryan Mallon
2010-06-07 23:52 ` Mark Brown
2010-06-07 23:52 ` [alsa-devel] " Mark Brown
2010-06-08 0:38 ` Ryan Mallon
2010-06-08 0:38 ` [alsa-devel] " Ryan Mallon
2010-06-07 13:26 ` Mark Brown
2010-06-07 13:26 ` [alsa-devel] " Mark Brown
2010-06-07 20:35 ` Ryan Mallon
2010-06-07 20:35 ` [alsa-devel] " Ryan Mallon
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=4C0D7101.6030506@bluewatersys.com \
--to=ryan@bluewatersys.com \
--cc=alsa-devel@alsa-project.org \
--cc=buytenh@wantstofly.org \
--cc=chasedouglas@gmail.com \
--cc=dhuggins@cs.cmu.edu \
--cc=hartleys@visionengravers.com \
--cc=john.cooper@third-harmonic.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=lrg@slimlogic.co.uk \
--cc=marshall@coolbananas.co.nz \
--cc=r&d4@dave-tech.it \
/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.