From patchwork Mon Jan 28 09:15:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 10783561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2143E6C2 for ; Mon, 28 Jan 2019 10:34:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08A5B286C2 for ; Mon, 28 Jan 2019 10:33:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB6052892A; Mon, 28 Jan 2019 10:33:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 441B8286C2 for ; Mon, 28 Jan 2019 10:33:53 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E2119267467; Mon, 28 Jan 2019 10:15:36 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4904226746C; Mon, 28 Jan 2019 10:15:34 +0100 (CET) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=hRfK8wDQQr80hMfaKNGBiX3IjYW5TdPZfPX2eEWkb7w=; b=f92WEJ+Z1nGDOXK8x5h6YcZPi3t6G/6Pk48sThDvjroeerHGWrsu/WtheykXOnwMD6 6FTnNhAu99UJ811VfBQxa/snOEtc8nZAA+VlUsnJkLAZYjJwfTTBoUdoU4OMG6XzWlqr xmLSA9YXOTTqQpKXPnLSL8SU66UWNzh5S5PrxHEixu35vmemJ3BoJ4t9jXfaQJZc2Csl Rg33EcT+ZsKwiPNyXToz++vIBlPnKYuPZiLoY8eL5z4WkHMV2qBqA/+ymvCXaR5IGk5H iYj/GkyP42eVHEPbrAFcvtzypScojlON1oaBHDuLtMuJgupfV/MQbozKrPqLpLDYqEHp VPGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=hRfK8wDQQr80hMfaKNGBiX3IjYW5TdPZfPX2eEWkb7w=; b=RaB+TL/ot5pnm6SKjxWfk+k0UKCTKVoHK3gmqkCwGUiITa+1JNGBivktfmN9TM91Xk kJc8Z5jcPfKWFPRSV30/enl7y+M5d1Yc0/cfFYkdHUeb/Exs3R+AHz0mgmw8f70BzqUF Z6ZE7srVWjbIquXk8O1d9mHCyum18Pt50v+QBR/kE0eZdLtdYQ6JWLqS7tgKxr+xOh+T /glRKLrGj5HwNt63sD2Z1wwmUPlF/rvwPRmI4utAr3M8LraIMf7G/MiUFMXoco4tqe2D DDIxU3F4sC2WAv/nTmudirmR1samRLLb6/mHJ9oVEqTxKSprZnkdymTXSBdOTKKJzrHD 2aUQ== X-Gm-Message-State: AJcUukcbAZKg8Hw5phOvSaw3zxDS53jlvDPY7vSGDZ1ExDmkDJx59fun noOq/ku5FeGFVH0ifcIm5JzXHG6oN872 X-Google-Smtp-Source: ALg8bN69JnnVrbEXMwyhgoB8WIZdLEHuuuxL8yZp7lhn4aPojTmJVB7IfbrUfOx2EExO1vsi8HxoIDr1b7hF X-Received: by 2002:a0c:98a9:: with SMTP id f38mr15113418qvd.24.1548666929075; Mon, 28 Jan 2019 01:15:29 -0800 (PST) Date: Mon, 28 Jan 2019 17:15:07 +0800 Message-Id: <20190128091507.211202-1-tzungbi@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog From: Tzung-Bi Shih To: broonie@kernel.org Cc: tzungbi@google.com, alsa-devel@alsa-project.org, dgreid@google.com, cychiang@google.com Subject: [alsa-devel] [PATCH] ASoC: max98090: support 20-bit and 24-bit audio format X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" 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 X-Virus-Scanned: ClamAV using ClamSMTP 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<