Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp629209pxb; Tue, 5 Apr 2022 16:31:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNoerW/zB0ru2U2KiH+8EnmSXVvcoVtVEHVALrIpalfBILP8f13Z9h446hf1rzSGstaZrl X-Received: by 2002:a65:41cc:0:b0:380:6f53:a550 with SMTP id b12-20020a6541cc000000b003806f53a550mr4689192pgq.471.1649201513653; Tue, 05 Apr 2022 16:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649201513; cv=none; d=google.com; s=arc-20160816; b=xJMCajlMAdYtJr55TJTLZTSIf1OEnwjkS8eyMyMdHI5RC9eKBm1XWCstqEHJNIc10a uT4w+McJkMv0Jh/Yo5LhqgWiO2hNgSnI/wlRkNqlCnH58NQBt0rd5UgNDDAU8XaHf3r7 VNPUlNMpl5Vb5zmoNvCRPvfHnpqyIDtOhoclI61bx7LobIfuDhO6CWo5pLQ+zFQnJhu+ XlDc4QckPxs6C0tAjYQ+jXZJxGZDjRQ2ZF7T7zd39WToirw0j6lxYsqlNJ/DdnARqHvW CIERiLuq9JI5dYaFPrFmPHvQiVyQaQ7OGzLzVmu5PwVjcuiL/F0Jxyq7uG7nZLFek24/ HhYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w4XjpKLiNDzdacivlS9L9u9vRfUNJrMKQMz9b9Tl1C0=; b=rknSauHAGiFpdnTycZSzfYT9Q/WrnuIhb0kA5tpYYyl3fSaW9b7cdD4MbAzCcy1mEJ xdG/5yk+N4emoc3y/AAHaDEv8RqM2PQiKehglfMnxzUCQN9Rtn8h0do8edFPQsvDci9p CAKC2U0nBDEoXMTn0WCK1O6pN0e1ZZ6WhX3WU8EoW8CHkeV/Rx8pxP8ygruciQKuf0Hl Bz02WnFXHFS3Ozyy/utSLH7I60x+F9lcvmwO6HOI8WZrmUXdSGe8YELG1yB29na8iPK0 otDKpg9Xv3+IQMrLEBr24uZa2SaY7Zz6nOvW+7xSWxd33a8+Duq4aS6ZtbzNVYwVItSP ZuFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vjwBODDD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ng8-20020a17090b1a8800b001c9b844880esi3884475pjb.135.2022.04.05.16.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 16:31:53 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vjwBODDD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3316EBD7DB; Tue, 5 Apr 2022 16:16:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382389AbiDEPOc (ORCPT + 99 others); Tue, 5 Apr 2022 11:14:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346599AbiDEJpM (ORCPT ); Tue, 5 Apr 2022 05:45:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F768DC9; Tue, 5 Apr 2022 02:31:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A733AB81C9A; Tue, 5 Apr 2022 09:31:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AE22C385A3; Tue, 5 Apr 2022 09:31:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151064; bh=4SVC2Nxylfe4tkCpqrTVQRdzAUldIPjWomgZW9cYs7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vjwBODDDc3pVmJdbekJLWMGfkn8L3BgM8hyHiv4zRF0yWIb3Gm4slv0QibBKegcoP l3ReFVSopxxkAaW1Ffy50CaHbm8xlmxS1g1lmgZ5jAvSzK0DV1ygq8XN3eZW95zr7J kYv5rvXK3iuLea8Im4PqT3fKtVHjLey3tSbVwpqw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , Kuninori Morimoto , Mark Brown , Sasha Levin Subject: [PATCH 5.15 280/913] ASoC: simple-card-utils: Set sysclk on all components Date: Tue, 5 Apr 2022 09:22:22 +0200 Message-Id: <20220405070348.250345298@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robert Hancock [ Upstream commit ce2f7b8d4290c22e462e465d1da38a1c113ae66a ] If an mclk-fs value was provided in the device tree configuration, the calculated MCLK was fed into the downstream codec DAI and CPU DAI, however set_sysclk was not being called on the platform device. Some platform devices such as the Xilinx Audio Formatter need to know the MCLK as well. Call snd_soc_component_set_sysclk on each component in the stream to set the proper sysclk value in addition to the existing call of snd_soc_dai_set_sysclk on the codec DAI and CPU DAI. This may end up resulting in redundant calls if one of the snd_soc_dai_set_sysclk calls ends up calling snd_soc_component_set_sysclk itself, but that isn't expected to cause any significant harm. Fixes: f48dcbb6d47d ("ASoC: simple-card-utils: share asoc_simple_hw_param()") Signed-off-by: Robert Hancock Reviewed-by: Kuninori Morimoto Link: https://lore.kernel.org/r/20220120195832.1742271-5-robert.hancock@calian.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/generic/simple-card-utils.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 10c63b73900c..ffda8a38de3e 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -275,6 +275,7 @@ int asoc_simple_hw_params(struct snd_pcm_substream *substream, mclk_fs = props->mclk_fs; if (mclk_fs) { + struct snd_soc_component *component; mclk = params_rate(params) * mclk_fs; for_each_prop_dai_codec(props, i, pdai) { @@ -282,16 +283,30 @@ int asoc_simple_hw_params(struct snd_pcm_substream *substream, if (ret < 0) return ret; } + for_each_prop_dai_cpu(props, i, pdai) { ret = asoc_simple_set_clk_rate(pdai, mclk); if (ret < 0) return ret; } + + /* Ensure sysclk is set on all components in case any + * (such as platform components) are missed by calls to + * snd_soc_dai_set_sysclk. + */ + for_each_rtd_components(rtd, i, component) { + ret = snd_soc_component_set_sysclk(component, 0, 0, + mclk, SND_SOC_CLOCK_IN); + if (ret && ret != -ENOTSUPP) + return ret; + } + for_each_rtd_codec_dais(rtd, i, sdai) { ret = snd_soc_dai_set_sysclk(sdai, 0, mclk, SND_SOC_CLOCK_IN); if (ret && ret != -ENOTSUPP) return ret; } + for_each_rtd_cpu_dais(rtd, i, sdai) { ret = snd_soc_dai_set_sysclk(sdai, 0, mclk, SND_SOC_CLOCK_OUT); if (ret && ret != -ENOTSUPP) -- 2.34.1