linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Katsuhiro Suzuki <katsuhiro@katsuster.net>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Mark Brown <broonie@kernel.org>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] SoC: simple-card-utils: set 0Hz to sysclk when shutdown
Date: Mon, 9 Sep 2019 11:49:27 +0900	[thread overview]
Message-ID: <af9678aa-bd38-7cb5-5d25-b133a269f19f@katsuster.net> (raw)
In-Reply-To: <87woei5mzj.wl-kuninori.morimoto.gx@renesas.com>

On 2019/09/09 9:31, Kuninori Morimoto wrote:
> 
> Hi Katsuhiro
> 
>> This patch set 0Hz to sysclk when shutdown the card.
>>
>> Some codecs set rate constraints that derives from sysclk. This
>> mechanism works correctly if machine drivers give fixed frequency.
>>
>> But simple-audio and audio-graph card set variable clock rate if
>> 'mclk-fs' property exists. In this case, rate constraints will go
>> bad scenario. For example a codec accepts three limited rates
>> (mclk / 256, mclk / 384, mclk / 512).
>>
>> Bad scenario as follows (mclk-fs = 256):
>>     - Initialize sysclk by correct value (Ex. 12.288MHz)
>>       - Codec set constraints of PCM rate by sysclk
>>         48kHz (1/256), 32kHz (1/384), 24kHz (1/512)
>>     - Play 48kHz sound, it's acceptable
>>     - Sysclk is not changed
>>
>>     - Play 32kHz sound, it's acceptable
>>     - Set sysclk to 8.192MHz (= fs * mclk-fs = 32k * 256)
>>       - Codec set constraints of PCM rate by sysclk
>>         32kHz (1/256), 21.33kHz (1/384), 16kHz (1/512)
>>
>>     - Play 48kHz again, but it's NOT acceptable because constraints
>>       do not allow 48kHz
>>
>> So codecs treat 0Hz sysclk as signal of applying no constraints to
>> avoid this problem.
>>
>> Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
>> ---
> 
> I'm not 100% understand your issue.
> .hw_params (= set mclk/sysclk) is not called in bad case ??
> Or it is called but Codec driver ignores it somehow ??
> 

Ah, sorry for confusing. It's not either. hw_params() of machine
driver has been called even if constraints don't have a requested
PCM rate. But it's not expected.

For example, if constraints are 32k, 21.33k, 16k, hw_params() will
be called with 32k when an user requests to play 48k sounds.


> Thank you for your help !!
> Best regards
> ---
> Kuninori Morimoto
> 

Best Regards,
Katsuhiro Suzuki

  reply	other threads:[~2019-09-09  2:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-07 17:45 [PATCH] SoC: simple-card-utils: set 0Hz to sysclk when shutdown Katsuhiro Suzuki
2019-09-09  0:31 ` Kuninori Morimoto
2019-09-09  2:49   ` Katsuhiro Suzuki [this message]
2019-09-09  3:54     ` Kuninori Morimoto
2019-09-09 10:07 ` Applied "SoC: simple-card-utils: set 0Hz to sysclk when shutdown" to the asoc tree Mark Brown

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=af9678aa-bd38-7cb5-5d25-b133a269f19f@katsuster.net \
    --to=katsuhiro@katsuster.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).