Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4589278ybe; Mon, 9 Sep 2019 11:22:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGkaFv6S5I/bufqhbsk7C/0rM8g4dFGX51C59gu0l57AiGdPSQMKvKegvr7HydP+FEJ/mX X-Received: by 2002:a50:9e26:: with SMTP id z35mr25738676ede.265.1568053360477; Mon, 09 Sep 2019 11:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568053360; cv=none; d=google.com; s=arc-20160816; b=tLfHdGaz/oKMnDYdDNnNf1m12u6C9ZCdUBvEJhyniYP3tz/KV8zdLhm2vr+tIuT9io fuf4Hn1ICEU4KwfVkfHigA1ExkSGJj1rQ1zral+L71m5RKe3o3Fl5qgC4cBh9exyy9J7 AN740SkWa5DWcblXjzzobabUwh9rxVVhcCFXCZk6nlMhgNSl0NM7e8FEeUqhSPbY/PdF wDKUg4UO3GMmhWE/EkCw+9jqG5mZqqNzAkTWTTd0Te0Gr+qCLe5Z0X3scp0IFPUezDNi Gc+bAI5OeFnNT4IixUsiP9F5Ia01oEIAAsLEEe7x7peS0CoyO1em7fGfMO5qmS9hi5cv nJRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Gjjaznh9UwZDc3b0oeYDSb40lqaAEpPXcBqoNbztiWs=; b=ZHM5d3qgBP5KnzKfDzig5B2I4rlcJXW/WBt3CS2y9n5WWjZhhz7/ID5klwTzQdgkii TXUyJ7ET/CQKt+XBfzjcNirh1lOcMFYw5Cmlb00nNfX03kFSjUdUNY9oyu2wS/0TNxnu VpfX2sH/TrJlzj0aoX/WIXCxA3IwtxYfmE4HT+88vkXXdeTPXICH6Bv31sBBPkBU7KKZ Zmu/+sZ02ylsx7nqeRe2vte7FXuBAL1VG82PbGTfcad7m2UK2Bo3NXHfLhkA+MNJZlEh cmJz4X5Y+U8UuTCpC6qdp7hYTFqg5/T8SIHzbY1IqbytmQ6q2Vr7WtK6WiKxRn72X5SK 1WKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z20si3350866edq.250.2019.09.09.11.22.16; Mon, 09 Sep 2019 11:22:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733174AbfIICtk (ORCPT + 99 others); Sun, 8 Sep 2019 22:49:40 -0400 Received: from www1102.sakura.ne.jp ([219.94.129.142]:49243 "EHLO www1102.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733062AbfIICtk (ORCPT ); Sun, 8 Sep 2019 22:49:40 -0400 Received: from fsav110.sakura.ne.jp (fsav110.sakura.ne.jp [27.133.134.237]) by www1102.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id x892nRXu066490; Mon, 9 Sep 2019 11:49:27 +0900 (JST) (envelope-from katsuhiro@katsuster.net) Received: from www1102.sakura.ne.jp (219.94.129.142) by fsav110.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav110.sakura.ne.jp); Mon, 09 Sep 2019 11:49:27 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav110.sakura.ne.jp) Received: from [192.168.1.2] (238.8.232.153.ap.dti.ne.jp [153.232.8.238]) (authenticated bits=0) by www1102.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id x892nRLX066484 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NO); Mon, 9 Sep 2019 11:49:27 +0900 (JST) (envelope-from katsuhiro@katsuster.net) Subject: Re: [PATCH] SoC: simple-card-utils: set 0Hz to sysclk when shutdown To: Kuninori Morimoto Cc: Mark Brown , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org References: <20190907174501.19833-1-katsuhiro@katsuster.net> <87woei5mzj.wl-kuninori.morimoto.gx@renesas.com> From: Katsuhiro Suzuki Message-ID: Date: Mon, 9 Sep 2019 11:49:27 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <87woei5mzj.wl-kuninori.morimoto.gx@renesas.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> --- > > 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