Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp230864pxf; Thu, 11 Mar 2021 02:29:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWnziq0bI1aT1mWVUGGhk6iis3zB3TpQheDUBYXD++aBcBbylAm46qlTC+2zeUsR0hAQV6 X-Received: by 2002:a17:906:3b99:: with SMTP id u25mr2367795ejf.277.1615458588447; Thu, 11 Mar 2021 02:29:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615458588; cv=none; d=google.com; s=arc-20160816; b=VvKrfn5tZpbRAVcX24xygyH1JXppgEbCcXqWarufUENI6GvgNIN6eXGuKZevI7VhPk R4w43e/cf/42JCtOj21SYwHcifRXGSxfMOutSfdGorfbk09x2EHLRb4oKwJR7XMScG3O jsEz2M5m6lzFL1QQ4CPayUO4mCooTZUfYW0RCtJyA1tkUv9u7gwFpz5UxK2EZeJRWENR dIRMeYG98Mi7MhP0nL3E+u1STrTWO/V1u39gErYj0DavROipTpDy7ntzk31Hq4ErVEIt zyFj/FHxr80ztznvlqRZmq4++3mS7Ah3sxLoWum3jzKwULjO8WT/RN2dnJ1npAx0yDsO Vl4g== 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=F/pKw0dxLFS0KoV3Ebsgp8qficdXlTrq+SBNJfX8nr4=; b=TDY+5cjXtAyeQTlaeWesi4fx0ZsSxD4hPqHyUMTx2gE23sQcoW3EMejdRqElv08Sd4 B3G/Kt75vBIvkTg9fC20br8DxZKO3ZbZct916C37DmSh2ZXLxjlr4jkXv3MR7kOic0B2 phFSgBLLFkzyd/nsRyxt6dLqac2nZLN6OP1TlQEP0XEw5mI3HWaFi61+YMzrzEkWObfK EtBaKSomeupM+DbR5ZSVNP6a0wdQDn6kgUIgt8qeN+nQHumYBvRv3I6qRnlu+FMPm6mc 7DSHav9pmJK86H0guptaEmvPhKNp+/07+FxdCs7/FsoSGFrLry2l1bUXLh5pzGPJyibH HAYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=GRjVx3HB; 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 c13si1521414eje.45.2021.03.11.02.29.26; Thu, 11 Mar 2021 02:29:48 -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=GRjVx3HB; 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 S232123AbhCKK2Q (ORCPT + 99 others); Thu, 11 Mar 2021 05:28:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232327AbhCKK15 (ORCPT ); Thu, 11 Mar 2021 05:27:57 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE420C061574; Thu, 11 Mar 2021 02:27:57 -0800 (PST) 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 E6F0722253; Thu, 11 Mar 2021 11:27:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1615458472; 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=F/pKw0dxLFS0KoV3Ebsgp8qficdXlTrq+SBNJfX8nr4=; b=GRjVx3HBxYsMYSofVWTR5ZJiOQCtwJTZeGIpMwTuEKerCg2pEkn+9jx93ZV/TE60Rif77T 6Fa/8ObPm3/RcRb46zuXnUnUucsPDPODe/1lIz+m4JZHlbWfYO1dmZuVQW0yun+dAq5C4L e2VvFjiO4wfJkaNSAoHvH4jaoK7ypO0= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 11 Mar 2021 11:27:51 +0100 From: Michael Walle To: Sameer Pujar Cc: alsa-devel@alsa-project.org, broonie@kernel.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: X-Sender: michael@walle.cc Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sameer, 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"). >> I've had a closer look at this and it seems you're messing around with the clock of the codec's node (which is _not_ a subnode of the simple-audio-card). I don't think this is correct. I guess you should rather set the clock property in the codec subnode of the simple-audio-card, which is then picked up by the simple-audio-card driver and changed accordingly. For example: simple-audio-card,dai-link@0 { reg = <0>; bitclock-master = <&dailink0_master>; frame-master = <&dailink0_master>; format = "i2s"; cpu { sound-dai = <&sai6>; }; dailink0_master: codec { sound-dai = <&wm8904>; clocks = <&mclk>; }; }; In this case mclk will be enabled and disabled accordingly. Could you test this? -michael