Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2634714pxa; Mon, 17 Aug 2020 15:03:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfOzXRQvOsjKHMs65RpSLe2HLN6sSulNXevIteU0aHe2USoM2hNbaWvw9cfi2rwHmPR3o4 X-Received: by 2002:a17:906:138b:: with SMTP id f11mr16637971ejc.310.1597701791511; Mon, 17 Aug 2020 15:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597701791; cv=none; d=google.com; s=arc-20160816; b=dAaHHffRff1J/TydtCCj6NXwAjtfODdbVBIaDIHVN+fZSV7c/4Ib3r8KCDJ1LhKiK1 0bkSVMZUNR3RDKOOKnCYxFLANm54Pop+WEIbGNNsnnKbbF9lNZZQQRoN6+eme0J1O/f9 FUI+xT2iAHqW9cPytM9rGx+8m9QR6IIPpsZIvbl3Wq7HiPyklf545hq7bQvB6k31EyND 89XO8iK1DLJufxQQL1UlC7HNglHOcGGHGlN/+vRYTwDmYPl4URcyLTKP61I3yYTksNGl vU3HcUnFxPup+nFUGp4GjUj8vMik2nmRjTqljbbJJiW9zO2TrRsqiio4U3Pg7Yv/NmEA ZLlQ== 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=CXdE0WL184SAs5xEAF2rueB20SvyDtU/0PkZ9zCMuyQ=; b=MmI+65MNOP+o5kigvbk38zAS6ZuYqHkQ+mxWkq9Suepo5yNrm0pjxFSXWU7WoEIS68 spaihR1igRIB7eXf614UGpgj1wV9l167eBwNTMDeX8X5LYmn6eTaITbGCVgF2vdHlvqt AqV6g6906NaIa5MDrADnXXB6NlICJY4Cfs4FxXC6CxXH7RLsLvJv5XQip1ip+1Qr87ZX xMvq8NEgHlBcHMugnZC0C1ReBki7fSNmuesXQpoKcODkD0mpQekxHC6lr8929wUFc5ta 55Dl1CbNXe83B+yAnZvBiN2/0+irGzn5aGF4UZfiP2YLIJWAQUVnQsz8qt2dajphxYij Os6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gpKVyv+F; 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; 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 ds7si16120860ejc.511.2020.08.17.15.02.48; Mon, 17 Aug 2020 15:03:11 -0700 (PDT) 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=@kernel.org header.s=default header.b=gpKVyv+F; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730735AbgHQPlW (ORCPT + 99 others); Mon, 17 Aug 2020 11:41:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:36696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730399AbgHQPdm (ORCPT ); Mon, 17 Aug 2020 11:33:42 -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 DDBA720882; Mon, 17 Aug 2020 15:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597678421; bh=swiXXOe0BmDRHvB9gVuUomUblqdxPDy7YROhR5Hm4W8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gpKVyv+F2TXM4UbDZPgAkIE+FJQR/kncQd8ccuzKJGruxIk7rDAJdz8WCsZP598c8 xyscZAAJkDJncpp8TYhj5d+XrQk2QOv4kVoWUGl4yiXNwbup21VzeMrsQ/iOdScxmr fE+K5AUOOkdRBZVF3KHnfxCGmqduxfAsWHtnyrIM= 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.8 329/464] ASoC: meson: axg-tdm-interface: fix link fmt setup Date: Mon, 17 Aug 2020 17:14:42 +0200 Message-Id: <20200817143849.549560358@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c index 6de27238e9dff..36df30915378c 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; -- 2.25.1