Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp248966ybd; Tue, 25 Jun 2019 20:43:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqz42Q1l0xc/hXN7dHmtfiVfTHv73qVzJ71lrtxrZEN4kOUGAkau4/c40EroZ9fBmZiciZSA X-Received: by 2002:a17:902:27a8:: with SMTP id d37mr2584388plb.150.1561520588014; Tue, 25 Jun 2019 20:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561520588; cv=none; d=google.com; s=arc-20160816; b=fxz8VrUr0wFbnNG3H1QDOIaXw/RwrxY5U7FhZ4zCr9wAD9sNTinRG91NCzO5O0TL0w /VBuMZyGL9/SZbuSMAGMKGF1DlXN0Pbtj8yZUrzGhAs3uSqmvRfDp4D6X2K+aQ85OA+Y eWcOuCnGTt0nx2cit8F9VO91XlOARhCO9wUJM40obwzaOW1C2CcMh0ZYTaf9Zds1t+az 6lc64snbZ3xiWY0t9nawGtiVUk3u038r1gYZvYIIK4IZvocdqdPwt6aniW9SzRHd5K8U /JfXPYTa5B1MtHyNKKIhNH1TcCQU8kjS0ApiFdGEZOFKl54RN15xv1MVFBEk0uQgYk/e YYHw== 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=B26rJ/ubXSQCgHyTfqJZFbms6x9l1BE9n2F55kD6m6E=; b=dpAUC9CChGtI8K9eYPZPWYwqAW3C5/Q3ywPI3weYiN8V8JLHQ3OV7/WCt3lNTCXqjy mAh/vuo78MbHnWH7cdkzleY4qq0X2VG9911iPtIkA2O9+p+jbls3y7+EsLh7eeMZiFsA pbFu4yWAtsZPY/Bf3NidsodUzMuSCbsQjzdA7j1557Uvg+sMf+BJmAhILFIHJanbhfiO CULS14XnRnfbFIyFMA5oq9vukSciYTzIEFKGd2z0DLTrAc6NFEeopxNgPIcS53BAI8JT Eur2/C1Sg3xKl5gjry4ByICmfCRUTn9nMHRwhDpr0H9h9Est3Ugqkxmd9OXpHz4GxOy7 9iHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vH+qB9C5; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si14565106pgv.233.2019.06.25.20.42.52; Tue, 25 Jun 2019 20:43:08 -0700 (PDT) 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=@kernel.org header.s=default header.b=vH+qB9C5; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727026AbfFZDmP (ORCPT + 99 others); Tue, 25 Jun 2019 23:42:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:52950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727005AbfFZDmL (ORCPT ); Tue, 25 Jun 2019 23:42:11 -0400 Received: from sasha-vm.mshome.net (mobile-107-77-172-74.mobile.att.net [107.77.172.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C25E120659; Wed, 26 Jun 2019 03:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561520530; bh=X6ugMEhZDja6XzrBb7A9ISvommG0GTtircnpMsfkH/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vH+qB9C51QL9KVbVepFcaYhAzGJbgNAcHZ3869RL9liOYlWnnk9PQQnm4MMAM9Q6D gUeRQV2rtEc4Pk6IOSaZZveuAhVTrBMotpbHrIsPcluc0e2I8MdmZEjsa+b7iCbSdT CE/f/BTXrDDTgp8ADHo2y3Va7M9/OZZR7LbTWkLU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yu-Hsuan Hsu , Mark Brown , Sasha Levin Subject: [PATCH AUTOSEL 5.1 20/51] ASoC: max98090: remove 24-bit format support if RJ is 0 Date: Tue, 25 Jun 2019 23:40:36 -0400 Message-Id: <20190626034117.23247-20-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190626034117.23247-1-sashal@kernel.org> References: <20190626034117.23247-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit 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 --- sound/soc/codecs/max98090.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index 7619ea31ab50..ada8c25e643d 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c @@ -1909,6 +1909,21 @@ static int max98090_configure_dmic(struct max98090_priv *max98090, return 0; } +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) @@ -2316,6 +2331,7 @@ EXPORT_SYMBOL_GPL(max98090_mic_detect); #define MAX98090_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE) static const 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, -- 2.20.1