From patchwork Mon Aug 17 15:15:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 247850 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp2878292ilo; Mon, 17 Aug 2020 11:50:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWovKedFRld9J0t9xMCLEKppzyTH0Ai6n3IyfM8cj3U/wO/nerbKuLqO8TWk7aH8bIr5rl X-Received: by 2002:a17:906:924b:: with SMTP id c11mr17075774ejx.75.1597690247545; Mon, 17 Aug 2020 11:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597690247; cv=none; d=google.com; s=arc-20160816; b=Jpqw7tKP31K7GSI7MFOVrUU4tpZEssZXJ5SZ3xJC3TZXRc22AjWlAkSv+cG+1Ntg2Z avQo17qUZrb1Dz3lIbYCSIgL9nEKFoLK9+pbTwRunX13jUyjUN5l753XUiZ9zDqQbvIJ sn7QSugXiVjJNgTR6GATMupXSBalgj+sD1WMxkoPseyH5lM/+cisq/b2I8LmnAxUsNVJ nDOMgkNxGNI/QvQRBZFW+uzf4hkox9q2opO+Q+1aeQIvy1h4Fgu3bCDRBE59dmkYvC1z NDc1Zw0JuhsFMwiVC8c3A1Sj/08KKgKzelBao/TqFQoWLdySTVTRQ2/AqzS6YAAXtGao fbQg== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Dfkk2FeWp5qA1NE3MpzGxb6lrH3JNWHPnWTcg2RZtJc=; b=jQF0CjI5oxJoOeOmGOKymBKmQILzwz0RB2Lr/62ZI8zjPHfB0dhgq7pMdxwMz/sEvF qWChBpn++r1PXWm3kWfSCShAxzl5hSEhxvl/L6N2fy9arMFHSptSW/lFD7fsm0wy8tji 0wPj9xN5mS1lPA3Zx1AXQA9Sft4PbcZLaLQUHHrZNbparqlmY1E6QJaIh4SeyM3NiFBy 6xkiwOJAuKNfgELSRBKWGcA3/HAiQvLIl3iqhvDyAWXS3lXNhYbR1dXwrME+cgiDZNQ2 S2PwJ0zmVuOoPgpolEWrUozCqPOpFEu+T6Pn5vPa7oWViYQRKaHwBmR6+GikfmhfMfb3 ABjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kwIVhv1m; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 91si12060547edr.457.2020.08.17.11.50.47; Mon, 17 Aug 2020 11:50:47 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@kernel.org header.s=default header.b=kwIVhv1m; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387945AbgHQSu2 (ORCPT + 15 others); Mon, 17 Aug 2020 14:50:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:40242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387927AbgHQPxg (ORCPT ); Mon, 17 Aug 2020 11:53:36 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5AB1A20882; Mon, 17 Aug 2020 15:53:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679615; bh=HTbYPPiLX1D+TeX1/625p9jUsugtMD+BGLOZNajy31g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kwIVhv1m2b8FZOY1mreiQhJQwiXm6vPkdOA5AbN/DkoNxHdF+tiXG2HO0OWhUnBAT nmvUldfBRz/pNemncVGqq5eHKztdX4GPdCO15RST2jGgDd0V0o1Cgt6SZ51xreIIEM ta9bQ9ziuLmIJtCa96vLRG3HUfioeBDFqQ7jMRBg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jerome Brunet , Mark Brown , Sasha Levin Subject: [PATCH 5.7 275/393] ASoC: meson: axg-tdm-interface: fix link fmt setup Date: Mon, 17 Aug 2020 17:15:25 +0200 Message-Id: <20200817143832.960829154@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jerome Brunet [ Upstream commit 6878ba91ce84f7a07887a0615af70f969508839f ] The .set_fmt() callback of the axg tdm interface incorrectly test the content of SND_SOC_DAIFMT_MASTER_MASK as if it was a bitfield, which it is not. Implement the test correctly. Fixes: d60e4f1e4be5 ("ASoC: meson: add tdm interface driver") Signed-off-by: Jerome Brunet Link: https://lore.kernel.org/r/20200729154456.1983396-2-jbrunet@baylibre.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/meson/axg-tdm-interface.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c index d51f3344be7c6..e25336f739123 100644 --- a/sound/soc/meson/axg-tdm-interface.c +++ b/sound/soc/meson/axg-tdm-interface.c @@ -119,18 +119,25 @@ static int axg_tdm_iface_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai); - /* These modes are not supported */ - if (fmt & (SND_SOC_DAIFMT_CBS_CFM | SND_SOC_DAIFMT_CBM_CFS)) { + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { + case SND_SOC_DAIFMT_CBS_CFS: + if (!iface->mclk) { + dev_err(dai->dev, "cpu clock master: mclk missing\n"); + return -ENODEV; + } + break; + + case SND_SOC_DAIFMT_CBM_CFM: + break; + + case SND_SOC_DAIFMT_CBS_CFM: + case SND_SOC_DAIFMT_CBM_CFS: dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n"); + /* Fall-through */ + default: return -EINVAL; } - /* If the TDM interface is the clock master, it requires mclk */ - if (!iface->mclk && (fmt & SND_SOC_DAIFMT_CBS_CFS)) { - dev_err(dai->dev, "cpu clock master: mclk missing\n"); - return -ENODEV; - } - iface->fmt = fmt; return 0; } @@ -319,7 +326,8 @@ static int axg_tdm_iface_hw_params(struct snd_pcm_substream *substream, if (ret) return ret; - if (iface->fmt & SND_SOC_DAIFMT_CBS_CFS) { + if ((iface->fmt & SND_SOC_DAIFMT_MASTER_MASK) == + SND_SOC_DAIFMT_CBS_CFS) { ret = axg_tdm_iface_set_sclk(dai, params); if (ret) return ret;