From patchwork Mon Aug 17 15:14:42 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: 247800 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp2734966ilo; Mon, 17 Aug 2020 08:33:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybOrhiCWm5IMvw1zHo3InCqK2h6GYwohbcIiibBmIpjZorkKWrsXBG8ofsfmY+u1NavS08 X-Received: by 2002:a17:906:3b8d:: with SMTP id u13mr16330273ejf.205.1597678439034; Mon, 17 Aug 2020 08:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597678439; cv=none; d=google.com; s=arc-20160816; b=UHzY8IKeodb5g46IrIOQuix8f1WOI0E6trwFC7qMBeJFnEcme9S02qV0+e/pdoHLO0 0ZC5nU+bUmE+kkVj7ZuBUM8C8bJhcpmwBliGCkb/oKal6N5KzKCaMe5BlfvTZ7ZsQ4ab EFB1IVp7zMrkXQsd9Fr3vHBEaxDyf/6yRE/7nKcE3SY7G3/he2N17jgj0Piq3qidTx8u bHMxvtsGvavaOzuYlPV2oSFv7uPRyPykmwasE3dSkahkHflboLVgfidUfpEeByp0c4n/ EoHF/eGONxRLSNArZrfprluXUx1htm4SMUr3ouN9kemgGdZNbEUnULnptxuL63l69gFk ARnw== 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=0ARklWsqrYZqagkW9SxKnBFynlKPtJqFmHTsUZWz9MRoKYVXqxmB8O5a+dB6tHk7m1 /FcFm6J2w/a4gKVtJzQ5NRZH+/7I80XxDQ2zr+2LMV8ORjpmIz0efBpQGU3s9f/r/G52 Yio2UdtXoNDaV4adZeDdUqPneGEbZasssMJ082eZ+L9k54G0K6O4byoZ8aInHidcqyud K5+oiguHYFWuX8X2bjjzZX7VDhSRPB+VmITWn6DWX0f8NSXDot0MnGGVCi2k6EvhKuFf 18VUXPvoVfaS/WdmnmgvkSHRyKmsHcAwPGKtF/0EQn4Jani3SZiipdORkQfiVyt+F2oe PHOA== 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 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 gj25si11191599ejb.26.2020.08.17.08.33.58; Mon, 17 Aug 2020 08:33:59 -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=gpKVyv+F; 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 S1730408AbgHQPdz (ORCPT + 15 others); Mon, 17 Aug 2020 11:33:55 -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 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 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;