From patchwork Mon Aug 17 15:16:28 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: 247838 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp2853110ilo; Mon, 17 Aug 2020 11:12:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHCawYikscw86bgu77h8RdkYqHtzSu0+IdxGNgp8dfqrtjNvmi9l+8y7mXg2AQGcDzKEsF X-Received: by 2002:aa7:c64e:: with SMTP id z14mr16775872edr.368.1597687967979; Mon, 17 Aug 2020 11:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597687967; cv=none; d=google.com; s=arc-20160816; b=vUthvYVCRRequS+JvsZgUKOvSpjFknpydtAaRowfIbf0Op/Qb732qeeZKvj/ga90vi rP8bdpTVocbpGQ95h97ShdSYPxwApRrR5b/wXMUqCAGYcwWklKykSG/2rOOJfP5iuVlC fqchODPxumqXSYQzASmz4yKArlN7/DErTTYbPBB4G9YtcTp43wBWhtjynDiyK4+4rpQm 3fmGhQgScUGqBDKd/AVmdJLuXnJUWM/RG3sTMjI8NUHYEXPaOyaaoHJktLNdDwdEfrql V/jSE/TXTJX40MHfgA32CzjoH70OWF2thYIRp1CKwxfahjLnZtIxuZzMp4yMMQIDB75B tTWA== 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=bs9nA6LoKFeyiwLDmPIrATNVUX2zltj4Ayd9o+WPCI6zmIbj+ntU+WdvV9j3fp+Udy 5aLf/E/jSKCa5PWYallmRXpFvjigJxlaRDZ64iRx79wz/sszVBLac/JT6rPDp7rG1fwU 5dc0BxA87suS7k4jm4rSQ3WPVWaJgtC+H1lZbGk2b1YXINqOFZkWo5btCO/WEkRBKF3h s+VpeYMo7qVEsE1ft0m21GdkkeLNmtDkxL1vI2i1VWxCkaY3SyUMB19/GgCb1T/hXJGy Txwn39znjdFwxWPAxvUQDRpLP/yiIOf0dMNVxg3WHmrHJMnzcQ/X7AYITyI3KFZkaYIE zP9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Fk9ieZvF; 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 m29si14211400edb.298.2020.08.17.11.12.47; Mon, 17 Aug 2020 11:12: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=Fk9ieZvF; 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 S2390377AbgHQSMn (ORCPT + 15 others); Mon, 17 Aug 2020 14:12:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:54542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388403AbgHQQH0 (ORCPT ); Mon, 17 Aug 2020 12:07:26 -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 5EFEC21744; Mon, 17 Aug 2020 16:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680439; bh=HTbYPPiLX1D+TeX1/625p9jUsugtMD+BGLOZNajy31g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fk9ieZvFFkq/gKaeio7XD33YfFBs0AE0VOBZqdmKJUjJvLDNP7QW4p8ZcJnKVs8CH HN6ET9HuLfALApEYIjF9qFcvqqpKDYF5mesaoTaKhrsDpomsKJsygqaTl9Dqrw66zu PLhaH9KnVBX91KZeaVEII1VcfjvVouMYBZvcVuRY= 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.4 187/270] ASoC: meson: axg-tdm-interface: fix link fmt setup Date: Mon, 17 Aug 2020 17:16:28 +0200 Message-Id: <20200817143805.127377483@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143755.807583758@linuxfoundation.org> References: <20200817143755.807583758@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;