From patchwork Thu Nov 7 20:16:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 178822 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1581195ilf; Thu, 7 Nov 2019 12:17:13 -0800 (PST) X-Google-Smtp-Source: APXvYqzUxz6gt6xc+59Gea7W0Ie4B+YyYhYFrn+RL2sdPsesgcWMBtDZtlzQPXW4paEYS8A1fm4l X-Received: by 2002:aa7:d0d4:: with SMTP id u20mr5940593edo.112.1573157833840; Thu, 07 Nov 2019 12:17:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573157833; cv=none; d=google.com; s=arc-20160816; b=KZLpmq9iDi0+AO24KKpWmZA1I/pfbsLKZCQwyZR2lDZfLFxkxhHYpEX7OsrD0YTcFV e5pw/HoVsK8eXEyVYPCGrRgeU3SaNGujG/YMprPPYeIfFBrHc7scaXqHMCl8rSP7mdJp QO+mhVWSj4h7GhUVr+8RJKB5U4cuSw2a5O9qpB1FPXL0q7TuhFql3upqXubBYjtN9yWB CZYgWCHkq7QRReP3Gj7vVRHcklPrjTQprItG1eW+OFCidf8bDyNhB7eV5GqyN6V6BWqQ RwXOJc1DTuWRRI4KiL7H3eSb0wDdznihAX2Z3ImjKVBZUbVrPUbxKev04VJgBSkUQtKv xSgQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=8Eh1A+XBqcPZEFBnh+HgUCyw+82+aoc7YA8bWZyx/XU=; b=OrXPRScu+F7d1Rmuj0NIZSGQfMCXOc1WXN7ZrmliEjlRvsFdurTZFkHpG5iu1jCYjZ TsiYMIj+OvbwxWnLLjrNnKppdTJ3wuf5CEu2nwrfZk8HzhIDV12JbPsXuSXWqZMHuDfv zhx7jvPEVWW8hV5xtpEJcOQLE+yXBJJoqsav6wJSNvNQobsD3N4NWfqiD25PYzrAycjL qHOkC6porsd5UaJRU0Uv3mEopvMVbaoFpFbdK0JJpimoMb4ZdlRiwL7/RaB6+hlmcDoI HzePFmdYTAnd0AzgtKsr3kyK97FhTFj67nCfYdM3ZQ9Ha03mdJN4Qro8dP7r150lqYlf f3Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="HdbGDG/b"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g19si2497652edb.280.2019.11.07.12.17.13; Thu, 07 Nov 2019 12:17:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="HdbGDG/b"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726019AbfKGURJ (ORCPT + 26 others); Thu, 7 Nov 2019 15:17:09 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46619 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbfKGURI (ORCPT ); Thu, 7 Nov 2019 15:17:08 -0500 Received: by mail-wr1-f66.google.com with SMTP id b3so4498041wrs.13 for ; Thu, 07 Nov 2019 12:17:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8Eh1A+XBqcPZEFBnh+HgUCyw+82+aoc7YA8bWZyx/XU=; b=HdbGDG/bD9rfLuXChKqfIL0GLBdwAQkoeEUR08XO5vmvDP4d9n5jwJzBtM5nafVUXy IbxdQZMZkDC143pI38WUWa9gkoPM4Ct8HTsfcpCvJyXbPWy6b1amMm4RNAayLLmuWkCF ot/OuCxCp8MppEtlxsnDIRm0zBzr2Y3olP1hj3Cfuhfe83eyDO1jtOrMhJgItBHinr5L NNo8Jeg3Xsvw+g9kiTxfMp/D1kolWj04wOkYmWlZHv4bo6wUkwhs7rp1K3ce/3oKRlrN cSVTDjamow1Jbjv7k3iY237zJd4PIhhBdAypb7a7ki5+2AsUX8w0g22P+oMjeBuyTZyv 65xA== 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:mime-version :content-transfer-encoding; bh=8Eh1A+XBqcPZEFBnh+HgUCyw+82+aoc7YA8bWZyx/XU=; b=FOTc12yb3CcdTvk8bsuUsNPcxvI4WAXwnT1IkDenUrbS2HoVVbmd4MciUu95nY98tP g9+ZeSx2abtkHJAr5cs0kby3ywRqMSuVBy/68dRVRGliL1ZeYGc1WTomtQc3JwhnSCmy 0rKGrJbIAXErVh7BIVBdTpJr60J7NsWzp1VracG/4iL78x9K+vQAKCTML3F1gjCxLRmh 5PJbXn2peMsX4XkYoUGCs8aiuKytX29/32JnHf8ItJmNLVnK+9DIpF17WEfbmr8QUS3p uBufcGiE6sdRtS/YLPYhJg8JeDFiq+8AT7nc2z9rp4h8odILqpQZ35QWqHL1It9EyfoC z3Sw== X-Gm-Message-State: APjAAAVsdpAWNfklcyMwQW2V2xGukRzP0OYOQyQW9T/aEVH+jUNA/y45 Inmsg/7RLNoEw6uQKctiq11KtA== X-Received: by 2002:a5d:5262:: with SMTP id l2mr4768386wrc.113.1573157826508; Thu, 07 Nov 2019 12:17:06 -0800 (PST) Received: from localhost.localdomain ([95.147.198.88]) by smtp.gmail.com with ESMTPSA id d11sm3215162wrn.28.2019.11.07.12.17.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 12:17:05 -0800 (PST) From: Lee Jones To: gregkh@google.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Yu-Hsuan Hsu , Mark Brown , Sasha Levin , Lee Jones Subject: [PATCH 01/10] ASoC: max98090: remove 24-bit format support if RJ is 0 Date: Thu, 7 Nov 2019 20:16:53 +0000 Message-Id: <20191107201702.27023-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yu-Hsuan Hsu [ Upstream commit 5628c8979642a076f91ee86c3bae5ad251639af0 ] The supported formats are S16_LE and S24_LE now. However, by datasheet of max98090, S24_LE is only supported when it is in the right justified mode. We should remove 24-bit format if it is not in that mode to avoid triggering error. Signed-off-by: Yu-Hsuan Hsu Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Signed-off-by: Lee Jones Change-Id: I68110cd295e9cd1c692bbd3cc3fbc247d92759a0 --- sound/soc/codecs/max98090.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.24.0 diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index 607f68597c21..25565f364af8 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c @@ -1847,6 +1847,21 @@ static const int dmic_comp[6][6] = { {7, 8, 3, 3, 3, 3} }; +static int max98090_dai_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct snd_soc_component *component = dai->component; + struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component); + unsigned int fmt = max98090->dai_fmt; + + /* Remove 24-bit format support if it is not in right justified mode. */ + if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_RIGHT_J) { + substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; + snd_pcm_hw_constraint_msbits(substream->runtime, 0, 16, 16); + } + return 0; +} + static int max98090_dai_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) @@ -2274,6 +2289,7 @@ EXPORT_SYMBOL_GPL(max98090_mic_detect); #define MAX98090_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE) static struct snd_soc_dai_ops max98090_dai_ops = { + .startup = max98090_dai_startup, .set_sysclk = max98090_dai_set_sysclk, .set_fmt = max98090_dai_set_fmt, .set_tdm_slot = max98090_set_tdm_slot,