From: Tzung-Bi Shih Subject: [PATCH] ASoC: max98090: support 20-bit and 24-bit audio format Date: Mon, 28 Jan 2019 17:15:07 +0800 Message-ID: <20190128091507.211202-1-tzungbi@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-qt1-f201.google.com (mail-qt1-f201.google.com [209.85.160.201]) by alsa0.perex.cz (Postfix) with ESMTP id B13FF267456 for ; Mon, 28 Jan 2019 10:15:30 +0100 (CET) Received: by mail-qt1-f201.google.com with SMTP id d31so20026717qtc.4 for ; Mon, 28 Jan 2019 01:15:30 -0800 (PST) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: broonie@kernel.org Cc: tzungbi@google.com, alsa-devel@alsa-project.org, dgreid@google.com, cychiang@google.com List-Id: alsa-devel@alsa-project.org >From datasheet of max98090: If RJ = 1, WS = 00, 16 bits WS = 01, 20 bits WS = 10, 24 bits Signed-off-by: Tzung-Bi Shih --- sound/soc/codecs/max98090.c | 16 +++++++++++++++- sound/soc/codecs/max98090.h | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index c97f21836c66..0ecc2f1accb5 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c @@ -1942,7 +1942,21 @@ static int max98090_dai_hw_params(struct snd_pcm_substream *substream, switch (params_width(params)) { case 16: snd_soc_component_update_bits(component, M98090_REG_INTERFACE_FORMAT, - M98090_WS_MASK, 0); + M98090_RJ_MASK, M98090_RJ_MASK); + snd_soc_component_update_bits(component, M98090_REG_INTERFACE_FORMAT, + M98090_WS_MASK, M98090_FORMAT_S16_LE); + break; + case 20: + snd_soc_component_update_bits(component, M98090_REG_INTERFACE_FORMAT, + M98090_RJ_MASK, M98090_RJ_MASK); + snd_soc_component_update_bits(component, M98090_REG_INTERFACE_FORMAT, + M98090_WS_MASK, M98090_FORMAT_S20_LE; + break; + case 24: + snd_soc_component_update_bits(component, M98090_REG_INTERFACE_FORMAT, + M98090_RJ_MASK, M98090_RJ_MASK); + snd_soc_component_update_bits(component, M98090_REG_INTERFACE_FORMAT, + M98090_WS_MASK, M98090_FORMAT_S24_LE); break; default: return -EINVAL; diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h index b1572a2d19da..9088f9d64ff2 100644 --- a/sound/soc/codecs/max98090.h +++ b/sound/soc/codecs/max98090.h @@ -706,6 +706,9 @@ #define M98090_WS_SHIFT 0 #define M98090_WS_WIDTH 2 #define M98090_WS_NUM (1<