Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1225672ybg; Wed, 29 Jul 2020 08:46:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnb6ryTeYATsb0wprGrvdc4QBmeP4Ax9su06sEo8/sqgg+G9Be9SJG+jx7qgDVpqCsizXk X-Received: by 2002:a05:6402:1457:: with SMTP id d23mr19800257edx.149.1596037604605; Wed, 29 Jul 2020 08:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596037604; cv=none; d=google.com; s=arc-20160816; b=scnQ+mXlnM6Ii6flBGV3Yy3tKqwhDW41lc5Mux01ZKTxPrNT3gtmmVt9U3/fsdpp8v XD+/HHLJvVzN3cl3gn/dchKeEmvc/kyFxEznqBYWrhZiXPpo399CU3JXZ7+OJJZlEP02 1+nixVKeau3er4/omJMfWbFn8vxZNQrrATa854/LUvO7HV5Puihxz4TJwHHUrcFxBqfi 8D3B8wPAks2gBE1bj87n0QlMTc73ucL+fYe1THabPrpVAC+nAbwVo8/eSjPWFOzYBf85 djTN+cNDJr/KLRIgN7oROQBw9wDdzMraLpKbqDHff9npxjz2GRgG/vboHvlZVcauRoxj 3g5A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aFwWixal6bg6/yGBUeckQ8zNlylY1ZjbXYs/S0fdtuA=; b=lsp/L0+ing4pi3wDVxGcDmHHl6MllXAOBTlTOovrxNoMKHz3WuteBRN6eXS2/fEbvw 8sj2iRJA5c3ApGkQp5z5KPRcTG+WtBf7e5B0bXr6k+LXfifqElHBcqM/qHqvEDa1m/ka g1cDb91u30gtMm/98zZ+O/6Tq965850yL22+KK/DeUx78udyaZsR0pgsASYYzQikuWaD wN9L432/seO4Z6hTPz2PJZTDNOtQgIY3bVgYBgIgxuKzpAlk3xRSyHBJh1mFGbycx1zg 03y4QOqkJ+ueG0JwW+X4CrDOh3ij40z2m9PF3byHkpqgLlU+sL9IUd9v1wHBuXOBjxKb 6D7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=zLTcc+Hf; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mj19si1293136ejb.291.2020.07.29.08.46.22; Wed, 29 Jul 2020 08:46:44 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=zLTcc+Hf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727063AbgG2PpS (ORCPT + 99 others); Wed, 29 Jul 2020 11:45:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726707AbgG2PpQ (ORCPT ); Wed, 29 Jul 2020 11:45:16 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51B8EC0619D2 for ; Wed, 29 Jul 2020 08:45:15 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id q76so2229870wme.4 for ; Wed, 29 Jul 2020 08:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aFwWixal6bg6/yGBUeckQ8zNlylY1ZjbXYs/S0fdtuA=; b=zLTcc+HfVBRchrfIBW1jERIX0biVz9CZS/q5ReBKow+W3caoKQqKObHjtFUrUxj8c2 xwYDvY0erPB/k5HObfYjFrjWXFf3xIgp4skpvwEhKdnWD4pvRG7mDcnMK7xXY/RLg0Q5 K3K/UK7XjR0RwzpWZzGemhvur36OTxJZSTaGEacmgrpybzO0SQ/H6ly4coZCWfDqL1sZ iHGvPEtY37h0owml1JyQD2FxV5jkGh0MmFPmTNXfE4WbzYS1dLMIXDwJKQCTg/f+TeuA y4Za0NejtucqFd8pW6sexE2gwHte8Ksk4JOt6dmVBKrfIrlntfUV9npxZnOlQHsExRRY xiuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aFwWixal6bg6/yGBUeckQ8zNlylY1ZjbXYs/S0fdtuA=; b=BNqh/vuCeSNQz1c9vbQdMu0lUjeK7XLHQsI5XBjcjoPHLdx1iycDqmqYrMhx63+4xq 2JGta4Vwl1Rcj8vUjWO6fqXp2pHkh83yqZDn2S2Znn1IexWjkR8UdiYLOLOQ3o2S9duj x7/C2+aCb0pfga33Qx7kiMFMkcqzt7vFj0g5M4IAZzUcPBuZaUtfgcYbYSWB/OtittCv PWfYkIuxFcEakm/cE8uTPS0Tc6xO3YBGoDIN5LMOAHn29zCByrv/d0ffQpMlLXHXpXes ECvF7xPGMre/te2f/I7tci4T3Eb9dv2FIdtxBT3Ahb+4iQovj38j4A3j5MtNe7LZLjN1 ly/Q== X-Gm-Message-State: AOAM531KExquUIdagr26ChNhEVnbT5WKffDh12aySEfrS6mDbbWZJUa/ HAxAUEI/o4j57g1q1gkgo+n9kDrGyCP7Bw== X-Received: by 2002:a1c:9914:: with SMTP id b20mr9098844wme.15.1596037514079; Wed, 29 Jul 2020 08:45:14 -0700 (PDT) Received: from starbuck.baylibre.local (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id k10sm5950967wrm.74.2020.07.29.08.45.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2020 08:45:13 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood Cc: Jerome Brunet , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, Kevin Hilman Subject: [PATCH 1/4] ASoC: meson: axg-tdm-interface: fix link fmt setup Date: Wed, 29 Jul 2020 17:44:53 +0200 Message-Id: <20200729154456.1983396-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200729154456.1983396-1-jbrunet@baylibre.com> References: <20200729154456.1983396-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 6de27238e9df..36df30915378 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.4