From patchwork Mon Jul 20 01:25:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11672795 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C26E76C1 for ; Mon, 20 Jul 2020 01:36:50 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5496F20674 for ; Mon, 20 Jul 2020 01:36:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="dnEiEdTU"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="q4MZuANs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5496F20674 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id CC58C16A1; Mon, 20 Jul 2020 03:36:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CC58C16A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1595209008; bh=J2XGYf4y2wn+VZo6XrAdcY1Tv4nbp27OAKJLvA9/7Lc=; h=Date:In-Reply-To:References:Subject:From:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dnEiEdTUvJ9kMwHZIhqUW6ovr4t9i7K1U2cNndewjGumI+gf9XRpLoB4kTyUKvdSa 0e3IH9XJlhrNLNTXMVO9N5HPf0Rn7bOVMhs+gsGwRjRcvGHf5hM7VNCezVtZ3jaTGJ J1AU3K7EY25uvBPzV/CGgOsmJRM4EVwaSvOka7mE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6DDB4F800CE; Mon, 20 Jul 2020 03:26:14 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id D1820F80279; Mon, 20 Jul 2020 03:26:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=disabled version=3.4.0 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A8327F800CE for ; Mon, 20 Jul 2020 03:26:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A8327F800CE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="q4MZuANs" Received: by mail-yb1-xb4a.google.com with SMTP id x184so19761845ybx.10 for ; Sun, 19 Jul 2020 18:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=wRtuAOlPgD/NDVb7LuAhKmi8EP2ThS7Y7+6owwo8YA0=; b=q4MZuANsSa5McwhCYE41CzoiB1ZZnhJTxpKOKXg+wslt842Rmfc5eERwQpqhnrXOQv 1vTA9CTLISWpuKKCpyt/YzreMN3qR2B3bzvpPtaTF+IU3Y5VV3IXPir+QbgrZUeA9OUo UoQiYXFfkP26jUz6VVEu3enbHZVkv5+pwmEcsZaxW4O1VqDXlEuUIfbHpRcNQ8N+Esij BVEPusglu0rk7nxhPJAPM4D2aZ4GFIjiPq1bNPAx+aknH+6D8CtWT0FRqF5EIDZLHgGw B+v4PEQH0uvgGT3m7dhGuaSj/bidK9cRTcrpqS7i+z9vgpnVBgfF2JCK5k/2pMzfZt8+ +wJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=wRtuAOlPgD/NDVb7LuAhKmi8EP2ThS7Y7+6owwo8YA0=; b=V+sEQbTfYJ1QsD50RFJSzA4S9wcZsNUI0Camfreyo2mo3ziSmGS/tX61KJ8vs7sOHz 8EvjLzh43cm0LG2iZWj85pp9buulr7SvTezHT+JaV9QS0eQQ9gtDesrNgJWgq95idJLV TTaLLEdNV2MiQ0C94RGirDeajNTfuv9EnE5ZfPpe6/R649TDnE5gF31k6PE4LsiCtIjA sWbQwyVWgE8GcZd69/WlzYtKWP8FgS+0K41tRmmVcLmv8ZQu8mFjYhZ9yugtjj0qkx3j r1GeLvqAQpnc9zcg9+jLUoolp5uba9y4G5vXJQmUOdIdpcLcVR91JZqPVBg+0MAIHnry E7ZA== X-Gm-Message-State: AOAM5321j8hCYIV39Ug7dDnwC9ICjkOrJ2iBgLk7xfezYZWwkg9s7XSY wVhwb7IwEtHE+jDZdbVbYfxsQ+1Takag X-Google-Smtp-Source: ABdhPJzM+eZ40Q9LmStXUpb75UmQaFxcjwMR3oLPi7UMFIO84XGNk7eEDTVurwsJlaHd15MIvGhNmdClXUVF X-Received: by 2002:a25:3752:: with SMTP id e79mr30488518yba.263.1595208368473; Sun, 19 Jul 2020 18:26:08 -0700 (PDT) Date: Mon, 20 Jul 2020 09:25:57 +0800 In-Reply-To: <20200720012559.906088-1-tzungbi@google.com> Message-Id: <20200720012559.906088-2-tzungbi@google.com> Mime-Version: 1.0 References: <20200720012559.906088-1-tzungbi@google.com> X-Mailer: git-send-email 2.28.0.rc0.105.gf9edc3c819-goog Subject: [PATCH 1/3] ASoC: mediatek: mt8183: support left justified format for I2S From: Tzung-Bi Shih To: broonie@kernel.org Cc: tzungbi@google.com, alsa-devel@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" MT8183 audio platform supports EIAJ and I2S formats. The code fixed to use I2S format in the past. Supports EIAJ mode via set_fmt ops and preserves to use I2S format as the default format intentionally. Signed-off-by: Tzung-Bi Shih --- sound/soc/mediatek/mt8183/mt8183-dai-i2s.c | 59 +++++++++++++++++++--- 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c b/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c index 777e93d70bea..138591d71ebd 100644 --- a/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c +++ b/sound/soc/mediatek/mt8183/mt8183-dai-i2s.c @@ -49,6 +49,8 @@ struct mtk_afe_i2s_priv { int mclk_id; int mclk_rate; int mclk_apll; + + int use_eiaj; }; static unsigned int get_i2s_wlen(snd_pcm_format_t format) @@ -711,7 +713,7 @@ static int mtk_dai_i2s_config(struct mtk_base_afe *afe, unsigned int rate_reg = mt8183_rate_transform(afe->dev, rate, i2s_id); snd_pcm_format_t format = params_format(params); - unsigned int i2s_con = 0; + unsigned int i2s_con = 0, fmt_con = I2S_FMT_I2S << I2S_FMT_SFT; int ret = 0; dev_info(afe->dev, "%s(), id %d, rate %d, format %d\n", @@ -719,17 +721,21 @@ static int mtk_dai_i2s_config(struct mtk_base_afe *afe, i2s_id, rate, format); - if (i2s_priv) + if (i2s_priv) { i2s_priv->rate = rate; - else + + if (i2s_priv->use_eiaj) + fmt_con = I2S_FMT_EIAJ << I2S_FMT_SFT; + } else { dev_warn(afe->dev, "%s(), i2s_priv == NULL", __func__); + } switch (i2s_id) { case MT8183_DAI_I2S_0: regmap_update_bits(afe->regmap, AFE_DAC_CON1, I2S_MODE_MASK_SFT, rate_reg << I2S_MODE_SFT); i2s_con = I2S_IN_PAD_IO_MUX << I2SIN_PAD_SEL_SFT; - i2s_con |= I2S_FMT_I2S << I2S_FMT_SFT; + i2s_con |= fmt_con; i2s_con |= get_i2s_wlen(format) << I2S_WLEN_SFT; regmap_update_bits(afe->regmap, AFE_I2S_CON, 0xffffeffe, i2s_con); @@ -737,7 +743,7 @@ static int mtk_dai_i2s_config(struct mtk_base_afe *afe, case MT8183_DAI_I2S_1: i2s_con = I2S1_SEL_O28_O29 << I2S2_SEL_O03_O04_SFT; i2s_con |= rate_reg << I2S2_OUT_MODE_SFT; - i2s_con |= I2S_FMT_I2S << I2S2_FMT_SFT; + i2s_con |= fmt_con; i2s_con |= get_i2s_wlen(format) << I2S2_WLEN_SFT; regmap_update_bits(afe->regmap, AFE_I2S_CON1, 0xffffeffe, i2s_con); @@ -745,21 +751,21 @@ static int mtk_dai_i2s_config(struct mtk_base_afe *afe, case MT8183_DAI_I2S_2: i2s_con = 8 << I2S3_UPDATE_WORD_SFT; i2s_con |= rate_reg << I2S3_OUT_MODE_SFT; - i2s_con |= I2S_FMT_I2S << I2S3_FMT_SFT; + i2s_con |= fmt_con; i2s_con |= get_i2s_wlen(format) << I2S3_WLEN_SFT; regmap_update_bits(afe->regmap, AFE_I2S_CON2, 0xffffeffe, i2s_con); break; case MT8183_DAI_I2S_3: i2s_con = rate_reg << I2S4_OUT_MODE_SFT; - i2s_con |= I2S_FMT_I2S << I2S4_FMT_SFT; + i2s_con |= fmt_con; i2s_con |= get_i2s_wlen(format) << I2S4_WLEN_SFT; regmap_update_bits(afe->regmap, AFE_I2S_CON3, 0xffffeffe, i2s_con); break; case MT8183_DAI_I2S_5: i2s_con = rate_reg << I2S5_OUT_MODE_SFT; - i2s_con |= I2S_FMT_I2S << I2S5_FMT_SFT; + i2s_con |= fmt_con; i2s_con |= get_i2s_wlen(format) << I2S5_WLEN_SFT; regmap_update_bits(afe->regmap, AFE_I2S_CON4, 0xffffeffe, i2s_con); @@ -841,9 +847,46 @@ static int mtk_dai_i2s_set_sysclk(struct snd_soc_dai *dai, return 0; } +static int mtk_dai_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) +{ + struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); + struct mt8183_afe_private *afe_priv = afe->platform_priv; + struct mtk_afe_i2s_priv *i2s_priv; + + switch (dai->id) { + case MT8183_DAI_I2S_0: + case MT8183_DAI_I2S_1: + case MT8183_DAI_I2S_2: + case MT8183_DAI_I2S_3: + case MT8183_DAI_I2S_5: + break; + default: + dev_warn(afe->dev, "%s(), id %d not support\n", + __func__, dai->id); + return -EINVAL; + } + i2s_priv = afe_priv->dai_priv[dai->id]; + + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { + case SND_SOC_DAIFMT_LEFT_J: + i2s_priv->use_eiaj = 1; + break; + case SND_SOC_DAIFMT_I2S: + i2s_priv->use_eiaj = 0; + break; + default: + dev_warn(afe->dev, "%s(), DAI format %d not support\n", + __func__, fmt & SND_SOC_DAIFMT_FORMAT_MASK); + return -EINVAL; + } + + return 0; +} + static const struct snd_soc_dai_ops mtk_dai_i2s_ops = { .hw_params = mtk_dai_i2s_hw_params, .set_sysclk = mtk_dai_i2s_set_sysclk, + .set_fmt = mtk_dai_i2s_set_fmt, }; /* dai driver */ From patchwork Mon Jul 20 01:25:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11672797 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1B25113B6 for ; Mon, 20 Jul 2020 01:37:24 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2FF520674 for ; Mon, 20 Jul 2020 01:37:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="qxxGKyVb"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="mYO0qP11" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2FF520674 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1DB8C16A3; Mon, 20 Jul 2020 03:36:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1DB8C16A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1595209042; bh=qBVKTzJy4bm2MZJDx2w3CHjCF1hDguq09RQDpDWArNo=; h=Date:In-Reply-To:References:Subject:From:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=qxxGKyVb7t3sC4sSOTCcJS7KnAC6l+5eZwo7UhNTfwzB2jrnX0aHT+Y7l8ej/qQ2W uf6SzyXRux0ol48U6cOVk6QqdmiamOSVW3RnQzvHELJmsXn9w1Ua8Dd58dQMfh+mXC XH0iMeFxS7noCP4+GUYZ2B9nZIfHM0UP2LSo+Zm8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7B22FF8028D; Mon, 20 Jul 2020 03:26:19 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9000DF80290; Mon, 20 Jul 2020 03:26:17 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=disabled version=3.4.0 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C7A4EF8028C for ; Mon, 20 Jul 2020 03:26:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C7A4EF8028C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="mYO0qP11" Received: by mail-qt1-x849.google.com with SMTP id l53so10931753qtl.10 for ; Sun, 19 Jul 2020 18:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=N1R7Iv8+prmRawftnwOZRGmqcEKKQhaOMggPSM9IpoA=; b=mYO0qP11CQFDqUisgUr565rOMN289t4gYQ6xFU9DbQ8JlAK1HdOn2zwcso09gNeb5e szZnwZu4zHh3sh6jol7eHy4u/7O0DIF8YAPTHtCEJmp6Pc4COXwnwAcCSfbFJin0H1cr 787tIICATs0EMXTz8+SQsfyNQPJspwtXUxLbT7ZwCaUibzPGImmec6HX6KvdiH+BgAPI /Cg76GvFPdQJnvkVFtK9OZv4OnYC33ZEo02FChSnPm6BLUDaZRSwOEV3CIk+BL8HV2XP eJsiVyui+UAuczN5o0y7TYC8OUNt2s44UNBgHfrbyi1e6L0mMNmdZ2CxeYyrakvdoOtg zayw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=N1R7Iv8+prmRawftnwOZRGmqcEKKQhaOMggPSM9IpoA=; b=jyELXxsomFdbSgqhatJ2egjn9N5iPRUwPUl6DaTXNdsghLsdlvNPz5hBMVmcaTEwcN fracVBcjgd4MdFp9eo4vlIkNOjcSePKpJk7N3a/bnfC9u7eHxaIViM0x9BBm/IVWa3BY BbDXFMdLHAgJX0TToRQkDsmmQ8/rRbY0PXulDd/GSrnitc+pyK3Di7OKzrJILaHbkyqn QmIbabeQC4OLBCI0RfpExw+44o4PRPGhaWqG5nb4LjoFKiA5mSVTxs8AiMxskSrlwQZ9 hb5AyQXMwhc53ctd5rHzvoR1cgG5lPZ2afGr1CtxZpLVqLt+dv2o6RpiG2a+UOKsHMFD cAHw== X-Gm-Message-State: AOAM531DXTlThNWfzNSNJpU+Te0yl24gsCx3NukqtQqNrxyUNc/km1vU LNFztJEubgVCDCZ+9fOf8zYq8WlPCgQ+ X-Google-Smtp-Source: ABdhPJzYDlHDcoZiUMRRm+hOvmdWgycdFdnKZ6MtUrwV0mbo8VmLsG6dzhrO2WHp9Kgqxd+KyDTa5/u7IIvt X-Received: by 2002:a0c:db8a:: with SMTP id m10mr19568282qvk.21.1595208371892; Sun, 19 Jul 2020 18:26:11 -0700 (PDT) Date: Mon, 20 Jul 2020 09:25:58 +0800 In-Reply-To: <20200720012559.906088-1-tzungbi@google.com> Message-Id: <20200720012559.906088-3-tzungbi@google.com> Mime-Version: 1.0 References: <20200720012559.906088-1-tzungbi@google.com> X-Mailer: git-send-email 2.28.0.rc0.105.gf9edc3c819-goog Subject: [PATCH 2/3] ASoC: dt-bindings: mt8183: add compatible string for using max98357b From: Tzung-Bi Shih To: broonie@kernel.org Cc: tzungbi@google.com, alsa-devel@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Machines with max98357b should use the compatible string "mt8183-mt6358-ts3a227-max98357b". Signed-off-by: Tzung-Bi Shih --- .../devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt b/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt index 5e455129eb96..235eac8aea7b 100644 --- a/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +++ b/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt @@ -2,6 +2,7 @@ MT8183 with MT6358, TS3A227, MAX98357, and RT1015 CODECS Required properties: - compatible : "mediatek,mt8183_mt6358_ts3a227_max98357" for MAX98357A codec + "mediatek,mt8183_mt6358_ts3a227_max98357b" for MAX98357B codec "mediatek,mt8183_mt6358_ts3a227_rt1015" for RT1015 codec - mediatek,platform: the phandle of MT8183 ASoC platform From patchwork Mon Jul 20 01:25:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11672799 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D167B13B6 for ; Mon, 20 Jul 2020 01:37:59 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6410C20674 for ; Mon, 20 Jul 2020 01:37:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="ThWE5c/O"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="pHIY39Dq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6410C20674 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E1CC71672; Mon, 20 Jul 2020 03:37:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E1CC71672 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1595209078; bh=n/FBrR/55APODfh3D+V8OUPILhEJlNTPw4tB0ahXB2c=; h=Date:In-Reply-To:References:Subject:From:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ThWE5c/OC9kBYJnajOukaMkxF9sKRlZ75SqE9BkWLgtnNh1WcCVJicbyVqXJqI6hK EZPxAvQm68CvIxWF4sb5qZHa31D237xYrtIh4fbwKiLVvkRs7VIZemI9/N1WS/RaGe 3FHc0dnXxk5W+33Hjg+VybeZT0BAQPMJD85/WRA8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 83C3FF802DC; Mon, 20 Jul 2020 03:26:22 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7EBFFF802DC; Mon, 20 Jul 2020 03:26:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=disabled version=3.4.0 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4E423F800BF for ; Mon, 20 Jul 2020 03:26:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4E423F800BF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pHIY39Dq" Received: by mail-yb1-xb49.google.com with SMTP id d27so19673485ybe.20 for ; Sun, 19 Jul 2020 18:26:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=ijnscKktrIyDZbMh97WXOpXJGhaPunXqhCr29sw4Ckg=; b=pHIY39DqE+Jgj3zG+4h2gd+Bl3B2LEXLGVVowY0f8WGGztPxSG8OFTpS64qekVtRuU cyjyjsF9lKIZLPRQJYqHasJg9GExzn/+4EUdukzge3etSugTAuXX6CfFMxUO5L0x1qgi hpgZPXYEwm1EXFyVS614XCK/iueNiaMqUkgbuqXF4G2Vv2zxavf8vClWBP000Oe+ddl9 DOHJ/o2eQeBmy7+cb6LWDWcVMFhCFt0TW1lLb8iAox0JoDKuS4a+7nNjJunr9hIfH7iE sWmtcp3QL0fvTJiG4scM4u08RoTc8eWtB4MH0Iyq4r0+6aeGj195jPcHA/wKK0uAUtMc fLvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=ijnscKktrIyDZbMh97WXOpXJGhaPunXqhCr29sw4Ckg=; b=t0Oy8HOeQA/X5qDJL8Ui7u2bW2iOyXdJOxGtL5uJJT5iE7NqWuxrPoxb4BqKlEw1uq fQYBQODUkj3RJkINJFOQNHMuUgzpsH2Sv2jUXcNCz9Q9GdRoHcp6Tc+YJ37/7Lk3M+vs 21GMsRBt1eGYtDRf/Dn8Z88YmvpK3pf7TtLCWCY28X8orDqbPKnBGQmYb3RN3wa3BXX4 +TPDaeMSTdv616JXGpAlGt9BAqJ0qhxtNuaGr745bt5iqHln7MydbmjIyVW5KhW/yRKi GW2YBXcjLLQY2hA6+DbcM5H2GJD0e53WAbLw5j8XyptiSGfYOuP+hqV0ciawBgEvFmiq Y3HQ== X-Gm-Message-State: AOAM532jcq9H/p2IbovJ50ywSEblwR1sTK3ftYO0wpvHw3OHsqwRi/7k 5f6SWGlKnKvZjUwBwDJ1dd61+tXE2bm0 X-Google-Smtp-Source: ABdhPJzeM5tzMzIOt3wQVws/lhc+TumgGZdbgK6jWzFMVGYD3yr2sJ0VeFbDKLyvANZJq7gkE0akYDApKQRt X-Received: by 2002:a25:3155:: with SMTP id x82mr31207767ybx.492.1595208375891; Sun, 19 Jul 2020 18:26:15 -0700 (PDT) Date: Mon, 20 Jul 2020 09:25:59 +0800 In-Reply-To: <20200720012559.906088-1-tzungbi@google.com> Message-Id: <20200720012559.906088-4-tzungbi@google.com> Mime-Version: 1.0 References: <20200720012559.906088-1-tzungbi@google.com> X-Mailer: git-send-email 2.28.0.rc0.105.gf9edc3c819-goog Subject: [PATCH 3/3] ASoC: mediatek: mt8183: support machine driver with max98357b From: Tzung-Bi Shih To: broonie@kernel.org Cc: tzungbi@google.com, alsa-devel@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Supports machine driver with max98357b ("mt8183-mt6358-ts3a227-max98357b"). The key difference from max98357a: max98357b needs to use left justified format. Signed-off-by: Tzung-Bi Shih --- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c index bd04c4bd309b..5ec2789855a7 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -528,6 +528,13 @@ static struct snd_soc_card mt8183_mt6358_ts3a227_max98357_card = { .num_links = ARRAY_SIZE(mt8183_mt6358_ts3a227_dai_links), }; +static struct snd_soc_card mt8183_mt6358_ts3a227_max98357b_card = { + .name = "mt8183_mt6358_ts3a227_max98357b", + .owner = THIS_MODULE, + .dai_link = mt8183_mt6358_ts3a227_dai_links, + .num_links = ARRAY_SIZE(mt8183_mt6358_ts3a227_dai_links), +}; + static struct snd_soc_codec_conf mt8183_mt6358_ts3a227_rt1015_amp_conf[] = { { .dlc = COMP_CODEC_CONF(RT1015_DEV0_NAME), @@ -617,7 +624,8 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) } if (strcmp(dai_link->name, "I2S3") == 0) { - if (card == &mt8183_mt6358_ts3a227_max98357_card) { + if (card == &mt8183_mt6358_ts3a227_max98357_card || + card == &mt8183_mt6358_ts3a227_max98357b_card) { dai_link->be_hw_params_fixup = mt8183_i2s_hw_params_fixup; dai_link->ops = &mt8183_mt6358_i2s_ops; @@ -646,6 +654,14 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) } } + if (card == &mt8183_mt6358_ts3a227_max98357b_card) { + if (strcmp(dai_link->name, "I2S2") == 0 || + strcmp(dai_link->name, "I2S3") == 0) + dai_link->dai_fmt = SND_SOC_DAIFMT_LEFT_J | + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBM_CFM; + } + if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) dai_link->codecs->of_node = hdmi_codec; @@ -711,6 +727,10 @@ static const struct of_device_id mt8183_mt6358_ts3a227_max98357_dt_match[] = { .compatible = "mediatek,mt8183_mt6358_ts3a227_max98357", .data = &mt8183_mt6358_ts3a227_max98357_card, }, + { + .compatible = "mediatek,mt8183_mt6358_ts3a227_max98357b", + .data = &mt8183_mt6358_ts3a227_max98357b_card, + }, { .compatible = "mediatek,mt8183_mt6358_ts3a227_rt1015", .data = &mt8183_mt6358_ts3a227_rt1015_card,