Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp493235pxf; Wed, 10 Mar 2021 10:16:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJycr7Nev7LVKbN8Eo75gQOUna3DtIgCNFNfdZkDNoncwxpfPpke9pVgzLdO4bg2wwqKhKay X-Received: by 2002:a17:906:b2cd:: with SMTP id cf13mr5004032ejb.181.1615400186706; Wed, 10 Mar 2021 10:16:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615400186; cv=none; d=google.com; s=arc-20160816; b=TDngeAhESYVgA3LfPyIcSwd36HXxuji9r0T8Ma4A6K34XKrj9GOqXWSx0Vd1CQzLX3 bMVrk9hZyB8PY51qpGyk4LnfVwIA8HP5/EiV1RQIdNf738xftz8iF3fN5eFZo6Mi7hc4 PaiKXgjQGaVJhtryxvPc3XjTYsqBMiPZuQ+ZtfUQ/HJugS+gE6vM5juWgCXEKrZl0vls tzd2XI1BZGjTxaKOymBef4J3K97RugCTYPvnwcKfvHTJ/jXCuBsREUuK9P8zI+r5Z/yF +E21Ss/yEH4rDeNIYJk53i4n1Q4ApuSHFTXH6JF+Pfwa6Cl1MvFERHdSIcw4lZzGd8B1 kvNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=raaT8hRIbeIkMsfmgVYBm7wNKoVMABIhHxKLm28T03s=; b=Por6yLkQe5kEtjFRY0cwRSTUX2vjym+btnNlo+N8Q8KnFIkGTBYZg6xbFXkXUHpZkI WsNFV2EBUNJ4o25Ut3aIwffZTSrZngWdwyvTX9dROqYB9pT+0X0kmg5f5zbSJTQdB6aD wg+SB97Jsg/ec28ueIgJkpCYxpX71WBaiohvTmQLmVpVy7GnxiyYiEljXMtfdmCOOMt6 lTS/KdfDPOWAQ/1aImJlLejHFgnOlYc2UyBIj26dwvbQmrri9LrmxfSiL5C5a+Y0p/PH PK264pv/QJnpyRG8MJlP7gzDFAjV7wjfvTkJPfwOpnGLGRkYVUEpNxGhbEYqk09Va/+M eQCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=tAwIfuHQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 4si95741edc.544.2021.03.10.10.16.03; Wed, 10 Mar 2021 10:16:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=tAwIfuHQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233631AbhCJSOw (ORCPT + 99 others); Wed, 10 Mar 2021 13:14:52 -0500 Received: from ssl.serverraum.org ([176.9.125.105]:52307 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233679AbhCJSOj (ORCPT ); Wed, 10 Mar 2021 13:14:39 -0500 Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 9317522173; Wed, 10 Mar 2021 19:14:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1615400078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=raaT8hRIbeIkMsfmgVYBm7wNKoVMABIhHxKLm28T03s=; b=tAwIfuHQ1UIEuWmKANx46QXvrhsMsjpXyVkGLtwNTP9g8WVpCMp5mWUEl8E4vRPOUuGyxE TmKC4VGVy2+RcPD116dB0ZQRCT050viuhioJA1P7mJ0uLYGwYp+WAsBEFBtEguybdf2GJT wnA4WYCP+dBI/SQFOBLog3Oi+jE1IN4= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 10 Mar 2021 19:14:37 +0100 From: Michael Walle To: Sameer Pujar , broonie@kernel.org Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, jonathanh@nvidia.com, kuninori.morimoto.gx@renesas.com, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, robh@kernel.org, sharadg@nvidia.com, thierry.reding@gmail.com Subject: Re: [PATCH 1/3] ASoC: simple-card-utils: Fix device module clock In-Reply-To: References: <1612939421-19900-2-git-send-email-spujar@nvidia.com> <20210309144156.18887-1-michael@walle.cc> <611ed3362dee3b3b7c7a80edfe763fd0@walle.cc> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <6e6b312eb91b8b86ceaa8a52311ea437@walle.cc> X-Sender: michael@walle.cc Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sameer, Hi Mark, Am 2021-03-10 15:50, schrieb Sameer Pujar: > On 3/10/2021 4:00 AM, Michael Walle wrote: >> Am 2021-03-09 17:27, schrieb Sameer Pujar: >>> On 3/9/2021 8:11 PM, Michael Walle wrote: >>>>> If "clocks = <&xxx>" is specified from the CPU or Codec component >>>>> device node, the clock is not getting enabled. Thus audio playback >>>>> or capture fails. >>>>> >>>>> Fix this by populating "simple_dai->clk" field when clocks property >>>>> is specified from device node as well. Also tidy up by >>>>> re-organising >>>>> conditional statements of parsing logic. >>>>> >>>>> Fixes: bb6fc620c2ed ("ASoC: simple-card-utils: add >>>>> asoc_simple_card_parse_clk()") >>>>> Cc: Kuninori Morimoto >>>>> Signed-off-by: Sameer Pujar >>>> >>>> This actually breaks sound on my board >>>> (arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var3-ads2.dts). >>>> The codec on this board (wm8904) has a fixed clock input (only >>>> distinct >>>> frequencies are supported) and uses the FLL of the codec to generate >>>> the >>>> desired sample rate. >>>> >>>> It seems that after this patch the clock rate of the codecs clock >>>> (rather >>>> than the FLL) is tried to be changed. Which fails, because it >>>> doesn't >>>> support arbitrary frequencies. >>> >>> Yes, after the given change the clock will be updated if "*mclk-fs" >>> property is specified. >>> >>> DT you mentioned has property "simple-audio-card,mclk-fs = <256>", >>> which means you need a clock that is a function of sample rate. But >>> as >>> per above you want a fixed clock for MCLK. I think if you drop this >>> property, the clock updates won't happen. Earlier for your case, this >>> property was not used at all because the clock handle was not >>> populated. >> >> You mean to drop the mclk-fs property? I can't do that because I >> actually need a frequency of 256 * sample rate. But that doesn't >> necessarily need to be the MCLK, because the codec itself has a >> FLL/PLL which can be used to generate any frequency for a given >> MCLK. So that is a valid scenario. See also commit 13409d27cb39 >> ("ASoC: wm8904: configure sysclk/FLL automatically"). >> > > If I read this correctly below is the configuration you need, > SoC -> MCLK(fixed rate) -> PLL(wm8904) -> PLL output (256 * fs) -> > sysclk > > From the doc simple-card.txt, "simple-audio-card,mclk-fs" is a scaling > factor for MCLK and hence I am not sure if it is correct to have > "*mclk-fs" property when MCLK is fixed. In simple cases, codec sysclk > direclty depends on MCLK and set_sysclk() callback helps. Your case > requires PLL configuration and set_pll() may be a better alternative. > However simple-card does not offer this yet. But even if this is > added, there should be a way to suggest PLL output requirement as a > function of sample rate. But its also a scaling factor for the sysclk, then maybe the property has a wrong name. And you might be right with your suggestion, but as I said, this breaks sound on my board and whats even worse, it breaks it for older kernel too, because of the Fixes tag. Btw I'm pretty sure, the MCLK was enabled and disabled depending on whether there was an audio stream, the last time I've measured the clock. Mark, can this patch please be reverted (with a Fixes tag) until a proper fix is found which satisfies both needs? -michael