Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7150368ybi; Mon, 8 Jul 2019 15:39:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzG1Lk850lCfPyDbRnLptSm7j2i7s/3/tE26CAR3uz6ytg9NmthMB2loPS9EhRkYOD05er7 X-Received: by 2002:a63:e54f:: with SMTP id z15mr12922111pgj.4.1562625571617; Mon, 08 Jul 2019 15:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625571; cv=none; d=google.com; s=arc-20160816; b=XcnXbPNfcAMUiXRld1L9AgFmfASvdoPpNCG+LbhXPE0iUm5SFUBtL5OtMTYO9XEB8g acg3JVFhDWE1vlgZc0o6ylBhAEsHv1A0Brij32Usb+85ZoKCeF5o9pjncQbNfuKn3Mkg Clo56tKO/LkdeHViymLlbsIVodL3mgf7JmnWiJSG+mGuMDnwkF2Sb6WwnXTst/Z6jzl/ CWRE7seM0hrW6DNOu4sc9KAGz3yPngSEa2uKuKhwMHeTjVGIDjurMx8Aeb4SqcUd7bvT eOa4VHQfehIj++0yAEKKKoQsKR/F/S/k7iRUoKrPhIIkMFSAoS29sYC2Ty2EuzRP+FbO 5I7Q== 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=KY7gRavbrVskkWO0FLi4H8X7WxZhiT97j+aLBfg74bo=; b=Liic9d0mU6g2XfDxWJo6FLlELxv+aClcJLsiTiEKtCsMlgeHeSvCZ0gVghMPEhQk9s dMYn/qUb+nftGVu11jskCCvj7KHvNfA6VdtAIRvjqIgSdc9+kZycZeyxbhZVCsvC/nhU CRufh9GaRDus3pztNlbBZrK+UMel+YhiJbIPwzXalU59RGk3h9AfxyIBRInTH27aR/hA /psxkT+dHPfDKG0AILAyQSLrtcFYHGZN9VrEpXMsCnyBX9OH3EGNnwFEFIomHALl4ALa gfBRM5WKUU15YqxO3QlVmbmOCoQtN+XNrLuv7BNlNmo2bVR01rAnuyGOUtBMNRLYj9X0 Sapg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dEvAxFG4; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v136si6303723pfc.9.2019.07.08.15.39.17; Mon, 08 Jul 2019 15:39:31 -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=dEvAxFG4; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389940AbfGHPbh (ORCPT + 99 others); Mon, 8 Jul 2019 11:31:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:32812 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389926AbfGHPbe (ORCPT ); Mon, 8 Jul 2019 11:31:34 -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 2379C21537; Mon, 8 Jul 2019 15:31:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599893; bh=10EwQfWbvM+ixxNR8d8JRfqkwF0sPCY4swUzz6wUq6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dEvAxFG4NxgGOmfiTaPd3oyVhRtZOVTrpbKsYJk2udPL+NadDOIwU4CEzDLfDFRaq 67THHPEZuJSN/1gt233q0ibw9NR0/NxWbAO/zrVAbuk3sD/n2xwujg1rKJy+9of9ix tQHxJZMBslpFE84RtM6P57II+gGUIH0FwXxdJgy8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu-Hsuan Hsu , Mark Brown , Sasha Levin Subject: [PATCH 5.1 24/96] ASoC: max98090: remove 24-bit format support if RJ is 0 Date: Mon, 8 Jul 2019 17:12:56 +0200 Message-Id: <20190708150527.801490093@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150526.234572443@linuxfoundation.org> References: <20190708150526.234572443@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ 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