From patchwork Thu Jul 9 12:24:41 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: 11654331 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 23DB460D for ; Thu, 9 Jul 2020 12:26:38 +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 AE8BF20708 for ; Thu, 9 Jul 2020 12:26:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="EbubqppI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="Jfb4IgnK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE8BF20708 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 A84E31654; Thu, 9 Jul 2020 14:25:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A84E31654 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1594297595; bh=qoOAg7ch7muNeH92NWlyT5ZLa8rWX7q7dL8EsCCK4N8=; h=Date:In-Reply-To:References:Subject:From:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=EbubqppIdc1JgbnSnGbOo+cFkqYjvpqAmRUxo7ppEMyMaqpXxjQKv6oipP9tLhXnE nyD7HMY67aGFDlRu+s5YiuB/U+kvvgTvgc/gl/yGjNxbzx1yi/0GOeYFErSPY52Mgl SmkBE8KHowB0gl/MpuNYWhpdzyRuH2rNrsR6AmJ0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1D624F802A0; Thu, 9 Jul 2020 14:25:10 +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 826F8F8025A; Thu, 9 Jul 2020 14:25:06 +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 D8708F80117 for ; Thu, 9 Jul 2020 14:24:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D8708F80117 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Jfb4IgnK" Received: by mail-yb1-xb4a.google.com with SMTP id 132so2672554ybg.8 for ; Thu, 09 Jul 2020 05:24:58 -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=qCyFeC980jB+4SOM6Rks3z7aJS41ao21bCwAzdZGowU=; b=Jfb4IgnKeJnYuvXPKmDYfSfTYZ43Hmd6XjY6GowlvqO0n2MoejSc6ooMJog3/X9S3/ hnUX9OKXF9LMNFpb1q7lXjNQzV9xLoZd3RenRkteQe2/up+rOIF4GOPacWXh8xgzz1BH tPMYIvT0cz0nwQ3Z85jCytxLFFj/lDEL+kzYr5GbgfNDMox5zt+zB8YmgqiDZllGJZoX lf+1XTB/lisFmQVB3D00wtQyp7Pud2apJBM3tci/cpAuOsEufdWtE6CRSg1uGjwIilIx Ar2qGeFwWSR2RPZA8BUre0fe32solrpYvlWYW/BNYdhaEgp23z2zUiaDVZ8QmiQVAaRT ZSMQ== 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=qCyFeC980jB+4SOM6Rks3z7aJS41ao21bCwAzdZGowU=; b=MtXMdPb6LgdnUAUC/rwxqoGOlbygbKSe9m5QwXgwkbw7zBkWdC7nV2CSASG9hooTIk L13qwBkkWD5VD0CDv+0tKQ37VHm50B6MfeEud/KPqpet6+UuvdGvqdZ5ySPbo91vzsN+ G2AEA7AEpygFEw5loNgQl+37/ymYATz6gDAwDAoWSMud/1TkfeQQFeCXIe3dLmBByPxh XDe/WqVQ49cCIhglc5WcFRO9osmvAUQoIAwKiw+uzzK59n5M4FxMYcZdhVm2sQdElO+1 VWkB3DpmNF2urt1jlbEd6AYyVGCkGPNxhcVRAp7pBspEfjiK3v82ckPy7reR2GhSIpa3 ZsZg== X-Gm-Message-State: AOAM533QE7BHPr/daO+mD5T+OatDxG/ZaVjKy5PC5oLJ0G6ptTYTWyaY JspyHC01YvDShKe3x0JIPYz3HW4SjvuA X-Google-Smtp-Source: ABdhPJxbPyQCYnast7EOHjo8ITrS6x8hHFOr+PwGzmqFMNxhvDM4ikb45Utp+ivtBSrP9F59hBv0P/DR6YXa X-Received: by 2002:a25:9782:: with SMTP id i2mr16925318ybo.277.1594297496655; Thu, 09 Jul 2020 05:24:56 -0700 (PDT) Date: Thu, 9 Jul 2020 20:24:41 +0800 In-Reply-To: <20200709122445.1584497-1-tzungbi@google.com> Message-Id: <20200709122445.1584497-2-tzungbi@google.com> Mime-Version: 1.0 References: <20200709122445.1584497-1-tzungbi@google.com> X-Mailer: git-send-email 2.27.0.383.g050319c2ae-goog Subject: [PATCH 1/5] ASoC: mediatek: mt8183-da7219: sort header inclusions in alphabetical 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" Sorts header inclusions in alphabetical. Signed-off-by: Tzung-Bi Shih --- sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c index b61bb2de4ec3..4cffe7daf33c 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -13,9 +13,9 @@ #include #include -#include "mt8183-afe-common.h" #include "../../codecs/da7219-aad.h" #include "../../codecs/da7219.h" +#include "mt8183-afe-common.h" struct mt8183_da7219_max98357_priv { struct snd_soc_jack headset_jack; From patchwork Thu Jul 9 12:24:42 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: 11654341 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 A1F8460D for ; Thu, 9 Jul 2020 12:27:38 +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 3840820708 for ; Thu, 9 Jul 2020 12:27:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Lrqay9Xa"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="V34mfSd+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3840820708 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 C2EAD15E0; Thu, 9 Jul 2020 14:26:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C2EAD15E0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1594297656; bh=KAjTiJ2UKvlLX91fk1dQ998phd02LGCWF3E3vMjcPTQ=; h=Date:In-Reply-To:References:Subject:From:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Lrqay9XaRm0hn6O22wpIl5kskmkHgyS5fqRKZoXR96GqIud1QMGxirTYczD5DQP+a TaMXtU+fGJ2zNnu/ko91LFV26tXImJFyZ5ihEVle49O4VskOggEVGz74YwEzz4+516 XFmNz5gDqiRlzpOJdmNBZAeitsNlj3zeIuZM+MlY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DA315F802D2; Thu, 9 Jul 2020 14:25: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 C97C0F802BD; Thu, 9 Jul 2020 14:25:11 +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 4DD76F80216 for ; Thu, 9 Jul 2020 14:25:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4DD76F80216 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="V34mfSd+" Received: by mail-yb1-xb49.google.com with SMTP id d202so2643911ybh.12 for ; Thu, 09 Jul 2020 05:25:01 -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=iN6AMgjebh5ttSunoTyBZvzZ1AdBhEV/5hqARnWvgG0=; b=V34mfSd+xCol1IDsUVrqxEEcIIvarJToDbvlYlKp8+hAqyWcs1tWcLVOpOhWSj6ClQ 3ePIX220ioq5Pcnr5++HSGAhUWAT77TrIO3d6GuA5S3AB9AgHPjrEt1UzICzufir72zk C42HVotEjh/OoNfMLhOFLR2d1iYvO7xTF+3yn+wKOW+nUR1FPmbyMsSbaI7vUVD4Nzjz +m5WiyLSvWUAKYRTbWAy/fq0OcyAtnTauMRKV8Y0B6n8v/1VQ9ofA0LSuovnbPjrKXmu OWi6p5TxBDdyJ+sUpKs0C0sn/N7fxHPJrn4bUde/p1hVDLNbtupyKZHWWD0JKCSuutB5 x1dA== 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=iN6AMgjebh5ttSunoTyBZvzZ1AdBhEV/5hqARnWvgG0=; b=f4yOr6Hr5gEI2SeMfrG/V4mOiM3oHI//YckWytcW8tgAmWMF/w+WmyNENXrqGTtBGT s5sLYG81E07Hbqu815dr/4wTAB9ggvHnCp8AIfIydTmHEssGC67c8pbREeScZuqEjql3 E7MnxDSo/M54s9j5y9QUd3U4rpsXxOfZpOjBjOKdpkIatCR8ERrixmQKozdpY83XxlU8 qEZe8A1RsyxMtIox4wxH1MarirVmwc02iX1maDNu/DuwwCyWfI6hLzVvGnm2CUjCnly3 4+NQMSOM560Yh5izSa0lw8MzJ9o5ecxpD7MsBvY/ulHk61/u8OfcuLIHqNBsVdPEHYi/ rXiQ== X-Gm-Message-State: AOAM532M0gMhx3Tq/+nXM1iUNNM8avzrCAe+kX44PnsCCNGUvtoLOXwn QDRL2mS5VGWzHcfFYKwPqyi2ykV+40U5 X-Google-Smtp-Source: ABdhPJwbF+zynCh0TwXUPC0JjIsYL9xAFfS5BreeMFHEwPE+fKZODAHc1He6dBu8sNwWoGYRxnGuzRbVJzeg X-Received: by 2002:a25:cb42:: with SMTP id b63mr39593168ybg.266.1594297500635; Thu, 09 Jul 2020 05:25:00 -0700 (PDT) Date: Thu, 9 Jul 2020 20:24:42 +0800 In-Reply-To: <20200709122445.1584497-1-tzungbi@google.com> Message-Id: <20200709122445.1584497-3-tzungbi@google.com> Mime-Version: 1.0 References: <20200709122445.1584497-1-tzungbi@google.com> X-Mailer: git-send-email 2.27.0.383.g050319c2ae-goog Subject: [PATCH 2/5] ASoC: mediatek: mt8183-da7219: remove forward declaration of headset_init 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" In headset_init(), it can access card by component->card. Removes the forward declaration. Signed-off-by: Tzung-Bi Shih --- .../mediatek/mt8183/mt8183-da7219-max98357.c | 63 +++++++++---------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c index 4cffe7daf33c..9636771ce9a2 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -449,7 +449,36 @@ static struct snd_soc_dai_link mt8183_da7219_max98357_dai_links[] = { }; static int -mt8183_da7219_max98357_headset_init(struct snd_soc_component *component); +mt8183_da7219_max98357_headset_init(struct snd_soc_component *component) +{ + int ret; + struct mt8183_da7219_max98357_priv *priv = + snd_soc_card_get_drvdata(component->card); + + /* Enable Headset and 4 Buttons Jack detection */ + ret = snd_soc_card_jack_new(component->card, + "Headset Jack", + SND_JACK_HEADSET | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &priv->headset_jack, + NULL, 0); + if (ret) + return ret; + + snd_jack_set_key( + priv->headset_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); + snd_jack_set_key( + priv->headset_jack.jack, SND_JACK_BTN_1, KEY_VOLUMEUP); + snd_jack_set_key( + priv->headset_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN); + snd_jack_set_key( + priv->headset_jack.jack, SND_JACK_BTN_3, KEY_VOICECOMMAND); + + da7219_aad_jack_det(component, &priv->headset_jack); + + return 0; +} static struct snd_soc_aux_dev mt8183_da7219_max98357_headset_dev = { .dlc = COMP_EMPTY(), @@ -496,38 +525,6 @@ static struct snd_soc_card mt8183_da7219_max98357_card = { .num_configs = ARRAY_SIZE(mt6358_codec_conf), }; -static int -mt8183_da7219_max98357_headset_init(struct snd_soc_component *component) -{ - int ret; - struct mt8183_da7219_max98357_priv *priv = - snd_soc_card_get_drvdata(component->card); - - /* Enable Headset and 4 Buttons Jack detection */ - ret = snd_soc_card_jack_new(&mt8183_da7219_max98357_card, - "Headset Jack", - SND_JACK_HEADSET | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | - SND_JACK_BTN_2 | SND_JACK_BTN_3, - &priv->headset_jack, - NULL, 0); - if (ret) - return ret; - - snd_jack_set_key( - priv->headset_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); - snd_jack_set_key( - priv->headset_jack.jack, SND_JACK_BTN_1, KEY_VOLUMEUP); - snd_jack_set_key( - priv->headset_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN); - snd_jack_set_key( - priv->headset_jack.jack, SND_JACK_BTN_3, KEY_VOICECOMMAND); - - da7219_aad_jack_det(component, &priv->headset_jack); - - return 0; -} - static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) { struct snd_soc_card *card = &mt8183_da7219_max98357_card; From patchwork Thu Jul 9 12:24:43 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: 11654339 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 0485C92A for ; Thu, 9 Jul 2020 12:27:13 +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 8C48720708 for ; Thu, 9 Jul 2020 12:27:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="gqmLAPeN"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="NMUZB5T+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C48720708 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 0CDE615F2; Thu, 9 Jul 2020 14:26:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0CDE615F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1594297631; bh=Uyzyw0ozb7UCNGvwdIF2MFoBYSiKTAt8UpfRQBEFuXk=; h=Date:In-Reply-To:References:Subject:From:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gqmLAPeNinVLDZLc4I69VRsvD2vX+/hQeb/GWwDMV26fk8KuSYXdD3KiO6Vxgx/M/ MMboiWkEeDPVGojNqGCi1dncTeN8lpV8AgID6/nRA17JWdlAcisumeraCwP7MNJaT4 5O5WfuKWbrEyps+HwWF7ACYEtlcRdsicsBxnu0SU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D9CD7F802BC; Thu, 9 Jul 2020 14:25:12 +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 491C5F801F9; Thu, 9 Jul 2020 14:25:09 +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 B50ECF801F9 for ; Thu, 9 Jul 2020 14:25:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B50ECF801F9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="NMUZB5T+" Received: by mail-yb1-xb49.google.com with SMTP id t7so2691988ybk.2 for ; Thu, 09 Jul 2020 05:25:05 -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=HmvZ1z9U4n6rR7duFi81k3VPNqIpG1EH8iqhWp8tRD0=; b=NMUZB5T+5+tZYKaW3KsvajVKg4SeF9Lcg4pFSz6wo8KXD3Z9kB+1WbD/vpUvM7D65v tUKSpikUYY8WS8t1SN/65/40WNin4EGk2FSVwT/GEIpACY102e38LJvcFxAOmd5zIQI6 s0vw/6T/DLrcx6pwihtcIZuJCZlZdJZFrCX8Np/64a8M+alpKKsl49+lnjGE39+2Y8J4 fxaUnls46I6jtt3A9ftMr1GPKpHo9lGVHxMJtDFSFOJBSXv4AsWnMLcuj37zflETo9FI UmiZ+e6ManBto71mnnmp610chzumQaN6WLVk2GScKr86iDwjqpEEeuxU9abV8HHkuzvw ST3g== 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=HmvZ1z9U4n6rR7duFi81k3VPNqIpG1EH8iqhWp8tRD0=; b=EgdqSr/VD8MRDUPp582HMAEbTCLSCLXtOe+GcAsdaXcLlKO6gMVTLzmPJCkGQ+2b3I Y87/w1cB6olkwZAmfLnqo3NpUCmsAXGG3JMNxbtVKNbxQSTmb316Dj2WxhxdYvuLZOo4 CMjiruMM1dEge3g0UwlAiDi7qSb5pK45gfYWgsI7GAyi7yzQQYI/CHYo9n0zL9KDctJN yHJyRrTwbpwwPWHg7ZNrRbH/Rq30llzX8za6d6/2iqUH7Iosn+2QB+q9BWqd3prtVAST aRWI/hIux3r5jR8dSok9D7NdFNWxAAfqflOvuTQm7yglpOOKBG61ZHobpHZ2bizcKgeM VRYA== X-Gm-Message-State: AOAM532kLvmLFUTvVK97Xf9b40nAI+n6pb8zAsfWYlvSp/r59pwArEAK E/UiRtIgBdGFldmecutu+gkFIawahcd+ X-Google-Smtp-Source: ABdhPJw/Jmifs746HEdEzjZzKb0bIfF3JLHoGixRoD/ggWNV2NU6nJujZftNAzmWotbqocrFajPzZrK1zG5r X-Received: by 2002:a25:2805:: with SMTP id o5mr53760242ybo.97.1594297504413; Thu, 09 Jul 2020 05:25:04 -0700 (PDT) Date: Thu, 9 Jul 2020 20:24:43 +0800 In-Reply-To: <20200709122445.1584497-1-tzungbi@google.com> Message-Id: <20200709122445.1584497-4-tzungbi@google.com> Mime-Version: 1.0 References: <20200709122445.1584497-1-tzungbi@google.com> X-Mailer: git-send-email 2.27.0.383.g050319c2ae-goog Subject: [PATCH 3/5] ASoC: mediatek: mt8183-da7219: extract codec and DAI names 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" Extracts codec and DAI names of DA7219. Signed-off-by: Tzung-Bi Shih --- sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c index 9636771ce9a2..17c8e4ac18a9 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -17,6 +17,9 @@ #include "../../codecs/da7219.h" #include "mt8183-afe-common.h" +#define DA7219_CODEC_DAI "da7219-hifi" +#define DA7219_DEV_NAME "da7219.5-001a" + struct mt8183_da7219_max98357_priv { struct snd_soc_jack headset_jack; }; @@ -54,8 +57,7 @@ static int mt8183_da7219_i2s_hw_params(struct snd_pcm_substream *substream, dev_err(rtd->dev, "failed to set cpu dai sysclk\n"); for_each_rtd_codec_dais(rtd, j, codec_dai) { - - if (!strcmp(codec_dai->component->name, "da7219.5-001a")) { + if (!strcmp(codec_dai->component->name, DA7219_DEV_NAME)) { ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, mclk_fs, @@ -87,8 +89,7 @@ static int mt8183_da7219_hw_free(struct snd_pcm_substream *substream) int ret = 0, j; for_each_rtd_codec_dais(rtd, j, codec_dai) { - - if (!strcmp(codec_dai->component->name, "da7219.5-001a")) { + if (!strcmp(codec_dai->component->name, DA7219_DEV_NAME)) { ret = snd_soc_dai_set_pll(codec_dai, 0, DA7219_SYSCLK_MCLK, 0, 0); if (ret < 0) { @@ -268,13 +269,13 @@ SND_SOC_DAILINK_DEFS(i2s1, SND_SOC_DAILINK_DEFS(i2s2, DAILINK_COMP_ARRAY(COMP_CPU("I2S2")), - DAILINK_COMP_ARRAY(COMP_CODEC("da7219.5-001a", "da7219-hifi")), + DAILINK_COMP_ARRAY(COMP_CODEC(DA7219_DEV_NAME, DA7219_CODEC_DAI)), DAILINK_COMP_ARRAY(COMP_EMPTY())); SND_SOC_DAILINK_DEFS(i2s3, DAILINK_COMP_ARRAY(COMP_CPU("I2S3")), DAILINK_COMP_ARRAY(COMP_CODEC("max98357a", "HiFi"), - COMP_CODEC("da7219.5-001a", "da7219-hifi")), + COMP_CODEC(DA7219_DEV_NAME, DA7219_CODEC_DAI)), DAILINK_COMP_ARRAY(COMP_EMPTY())); SND_SOC_DAILINK_DEFS(i2s5, From patchwork Thu Jul 9 12:24:44 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: 11654343 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 D8DA392A for ; Thu, 9 Jul 2020 12:28:17 +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 6C9F820708 for ; Thu, 9 Jul 2020 12:28:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="kK4IFjxL"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="CLw2CpHL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C9F820708 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 E62E71612; Thu, 9 Jul 2020 14:27:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E62E71612 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1594297696; bh=MLmVpOT3NmAYjwPxCzTZI0VnkhBSuNRF3QfYs5MTW/Y=; h=Date:In-Reply-To:References:Subject:From:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=kK4IFjxLXTyXvlxkJqjirrLk9fxz4547rkeQXblwp/CwC4xKHF7WXk9L7VJXfDYeW lea21ilGhi21EpDuNtdO+JeNLpaIHjJJV+TGA845AWy2d/v7BXyLzSK4VYe/rVSuxh ttP7+TYebKW3+3dABAIiO0wOQkAmXyz5HhOz9hCo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 92AF2F802DF; Thu, 9 Jul 2020 14:25:21 +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 6436FF802DF; Thu, 9 Jul 2020 14:25:19 +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-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) (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 A5AEBF802BE for ; Thu, 9 Jul 2020 14:25:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A5AEBF802BE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CLw2CpHL" Received: by mail-qk1-x74a.google.com with SMTP id 13so1601142qks.11 for ; Thu, 09 Jul 2020 05:25:09 -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=aRLqd94FjwTnJjMFb6sQjFqDeuwXUgkuPrQ9FAsWwfc=; b=CLw2CpHLjsT25R5w5WjTZJCEufjaYYe7vTI+p1qg2qOcznzdNf9660UUs94EZQV899 +nzXPofL4EK9Iz5FeNGiL54HJ7/9mVCrpp3cafPzt0W0Z1FOqw2LyWp0b/Qv4dKaATf6 9/M5tIS4W2qMr7O17TOcx5KeJDFjtJXJJrJJshPp45rq5bB6luweiBuQxOKOTJZA+ROK O9UoHTwJ4qpk84LPl06LnuMPtyv6H+T8o47LnGr7DJ5Fdl2lbcfygAKCXZP7w+JBxahB svS/macbagKWHbEAOS/GWKSp8xBe3Qzar3/etw9ZEUzvgwuNN/ehbWdMup2YBPzu6UN4 Txlw== 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=aRLqd94FjwTnJjMFb6sQjFqDeuwXUgkuPrQ9FAsWwfc=; b=BX8ZW4IfWvZQR2GDui5PpjgMT4vaYqx+BzIahc8oXgiw8L7A8XGfJAMMjMBAHdzhli w+p18vPBI3srDmSJx9nOyND1Xi2D4zqyKDrmJ8Zg0KL7q3Pi5S3gtXcdMZEMC8mlWohE 7Knlm5dpsRRbGoojkFXuP+1Q4HDnwafY+9knEmUbT+r8aeCPE8yp1o/6tkutTncWrZJk VvETs8qw2IFhOjpOKWfBz398DXLSLSSE0PM2O7maJoVoShx7agjHLtL28qcK8A44cKLE q+QGqTbfo5jlvZZBHS9jGHMDkA7wUeaUk0SPf+gQqjBFBEMMPzUno5knZVsyS5SGjUyV Im4A== X-Gm-Message-State: AOAM530uz9AadzOVNQzPI9vf9gUImUnWbcuuuqQleTskirFTm8xZ/dBE mn4gjcuuTkp+7TPAbK9ORLR/UHttSADg X-Google-Smtp-Source: ABdhPJz8cckKXdB/d6dj9QL687QGZxSlWNpAyt5bbCVzqVKD4zh3djQNdd0VodzlUlIeI4ItguSG3NCX3ey6 X-Received: by 2002:a05:6214:612:: with SMTP id z18mr61686337qvw.46.1594297507702; Thu, 09 Jul 2020 05:25:07 -0700 (PDT) Date: Thu, 9 Jul 2020 20:24:44 +0800 In-Reply-To: <20200709122445.1584497-1-tzungbi@google.com> Message-Id: <20200709122445.1584497-5-tzungbi@google.com> Mime-Version: 1.0 References: <20200709122445.1584497-1-tzungbi@google.com> X-Mailer: git-send-email 2.27.0.383.g050319c2ae-goog Subject: [PATCH 4/5] ASoC: mediatek: mt8183-da7219: add compatible string for using rt1015 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 rt1015 should use the compatible string "mt8183-da7219-rt1015". Signed-off-by: Tzung-Bi Shih --- .../devicetree/bindings/sound/mt8183-da7219-max98357.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/mt8183-da7219-max98357.txt b/Documentation/devicetree/bindings/sound/mt8183-da7219-max98357.txt index 92ac86f83822..f7f3b83da630 100644 --- a/Documentation/devicetree/bindings/sound/mt8183-da7219-max98357.txt +++ b/Documentation/devicetree/bindings/sound/mt8183-da7219-max98357.txt @@ -1,7 +1,8 @@ -MT8183 with MT6358, DA7219 and MAX98357 CODECS +MT8183 with MT6358, DA7219, MAX98357, and RT1015 CODECS Required properties: -- compatible : "mediatek,mt8183_da7219_max98357" +- compatible : "mediatek,mt8183_da7219_max98357" for MAX98357A codec + "mediatek,mt8183_da7219_rt1015" for RT1015 codec - mediatek,headset-codec: the phandles of da7219 codecs - mediatek,platform: the phandle of MT8183 ASoC platform From patchwork Thu Jul 9 12:24:45 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: 11654345 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 9478E92A for ; Thu, 9 Jul 2020 12:29:00 +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 2617520708 for ; Thu, 9 Jul 2020 12:29:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="KOzceAog"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="sLSTE/LF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2617520708 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 7622086F; Thu, 9 Jul 2020 14:28:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7622086F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1594297738; bh=EWDsQdn3GDOxfGKiCl7T8XDJbdAAJ9gz6drkQ4IhTVQ=; h=Date:In-Reply-To:References:Subject:From:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KOzceAogIKLIBOVe/U6M4jhOG34Yt8MvHJXTWXnID3M/9Ao4Z/Qa6euF3K78ZfoJx N5QqGIXt1/CKTn732r3Ss6Sl84nuQF6zRkvcn4yJVBzzOK1QL/hF6kcbEzNYeQofBD GGBvumXZiM4cVZmZ+roO1HYGFMy2MJ922W6vpE74= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 51EC4F802EB; Thu, 9 Jul 2020 14:25:28 +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 DD42EF802EC; Thu, 9 Jul 2020 14:25:26 +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 8FD80F802DD for ; Thu, 9 Jul 2020 14:25:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8FD80F802DD Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sLSTE/LF" Received: by mail-yb1-xb4a.google.com with SMTP id i203so2649467yba.9 for ; Thu, 09 Jul 2020 05:25: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=9A1xWv5PcetWLDv17nyjEyWHMq2fVkUg/EnnDj/J8IE=; b=sLSTE/LFjK9O2CAv0xFboVwWfTF0PVAx0LflUK1E5pc2b9FjBRl9QVUFeYrtIG7jyh EoiG/hnd4emriS6kaJhTtgL7jWv0P6/IEZtK/JYco5N3cc4XlzYU4/E9CdFHa5f7/+QP txIeMIxWYEP0P29L0/XbIva/3jT1bczqCtnEInxZqG6P6VeMrmRq1o8O3MvtOiUIE/bi xk7eWfrxAwlO7FCMdoVN7QNryxWYak/+uq0Rlby6moZNiEmnzO7SOrF2DIEsNXUfrQis tVhGjkq6utQJ2Te5iv/KEo9COlBsQLwo24wz1N5/5+xrQW6wUIAK+qfBYoiZuqL4sBHj jT8A== 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=9A1xWv5PcetWLDv17nyjEyWHMq2fVkUg/EnnDj/J8IE=; b=eC45LmvrKMI4/afoGOzHuHJdaCIJiAgQ9M2+bpKvKZXibUO7YjAqACnNBbSD0YuJ6h h4q4Ed+1vz5Z9neCVes1NNmtq2XYcmV71yGVNmJWKM7ZAwFHWpUNQx3gLQI4CYSDbqvt 7/qoVwYNIThCeiOZwv9UkIwmP9tIh5bGGM0F3ldEFmkytpNuimYSemjAriP0qS180gFe 01YEXPB+Fngs0JXCfMdctTmvrrn3gog+K+4ATRf1odO8ZF0J/gG4Pje0cCkmtlL9ftz4 JGJ8H1sATVJ1mx5TbblREJVbRy13zQ7Z2rMJMBd1xl7r0DXIi6c/fboLaL6PL7BKkZ4a CMWQ== X-Gm-Message-State: AOAM532abPHJtRnloLrDRcnNGu+9H3KjrroQxQv6E+qKV1SEn1RfRjal RSmRuwmGBspclzLdu4JFpMh9ajeVBME6 X-Google-Smtp-Source: ABdhPJw7LhFEWDQkmmUEKM3pX/o3JZn8M+N/r+E1RXC8w6USlbStIJ23UcTTapP+1Isy4aSC0S9vcZ4Dovyi X-Received: by 2002:a25:cfd7:: with SMTP id f206mr9264630ybg.289.1594297511427; Thu, 09 Jul 2020 05:25:11 -0700 (PDT) Date: Thu, 9 Jul 2020 20:24:45 +0800 In-Reply-To: <20200709122445.1584497-1-tzungbi@google.com> Message-Id: <20200709122445.1584497-6-tzungbi@google.com> Mime-Version: 1.0 References: <20200709122445.1584497-1-tzungbi@google.com> X-Mailer: git-send-email 2.27.0.383.g050319c2ae-goog Subject: [PATCH 5/5] ASoC: mediatek: mt8183-da7219: support machine driver with rt1015 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 rt1015 ("mt8183-da7219-rt1015"). Embeds in existing mt8183-da7219-max98357.c because they share most of the code. Signed-off-by: Tzung-Bi Shih --- sound/soc/mediatek/Kconfig | 5 +- .../mediatek/mt8183/mt8183-da7219-max98357.c | 170 ++++++++++++++++-- 2 files changed, 158 insertions(+), 17 deletions(-) diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig index 238e4871678a..786a8d5031e4 100644 --- a/sound/soc/mediatek/Kconfig +++ b/sound/soc/mediatek/Kconfig @@ -134,15 +134,16 @@ config SND_SOC_MT8183_MT6358_TS3A227E_MAX98357A If unsure select "N". config SND_SOC_MT8183_DA7219_MAX98357A - tristate "ASoC Audio driver for MT8183 with DA7219 MAX98357A codec" + tristate "ASoC Audio driver for MT8183 with DA7219 MAX98357A RT1015 codec" depends on SND_SOC_MT8183 && I2C select SND_SOC_MT6358 select SND_SOC_MAX98357A + select SND_SOC_RT1015 select SND_SOC_DA7219 select SND_SOC_BT_SCO help This adds ASoC driver for Mediatek MT8183 boards - with the DA7219 MAX98357A audio codec. + with the DA7219 MAX98357A RT1015 audio codec. Select Y if you have such device. If unsure select "N". diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c index 17c8e4ac18a9..bc551a4af25f 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -15,10 +16,14 @@ #include "../../codecs/da7219-aad.h" #include "../../codecs/da7219.h" +#include "../../codecs/rt1015.h" #include "mt8183-afe-common.h" #define DA7219_CODEC_DAI "da7219-hifi" #define DA7219_DEV_NAME "da7219.5-001a" +#define RT1015_CODEC_DAI "rt1015-aif" +#define RT1015_DEV0_NAME "rt1015.6-0028" +#define RT1015_DEV1_NAME "rt1015.6-0029" struct mt8183_da7219_max98357_priv { struct snd_soc_jack headset_jack; @@ -108,6 +113,51 @@ static const struct snd_soc_ops mt8183_da7219_i2s_ops = { .hw_free = mt8183_da7219_hw_free, }; +static int +mt8183_da7219_rt1015_i2s_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + unsigned int rate = params_rate(params); + struct snd_soc_dai *codec_dai; + int ret = 0, i; + + for_each_rtd_codec_dais(rtd, i, codec_dai) { + if (!strcmp(codec_dai->component->name, RT1015_DEV0_NAME) || + !strcmp(codec_dai->component->name, RT1015_DEV1_NAME)) { + ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64); + if (ret) { + dev_err(rtd->dev, "failed to set bclk ratio\n"); + return ret; + } + + ret = snd_soc_dai_set_pll(codec_dai, 0, + RT1015_PLL_S_BCLK, + rate * 64, rate * 256); + if (ret) { + dev_err(rtd->dev, "failed to set pll\n"); + return ret; + } + + ret = snd_soc_dai_set_sysclk(codec_dai, + RT1015_SCLK_S_PLL, + rate * 256, + SND_SOC_CLOCK_IN); + if (ret) { + dev_err(rtd->dev, "failed to set sysclk\n"); + return ret; + } + } + } + + return mt8183_da7219_i2s_hw_params(substream, params); +} + +static const struct snd_soc_ops mt8183_da7219_rt1015_i2s_ops = { + .hw_params = mt8183_da7219_rt1015_i2s_hw_params, + .hw_free = mt8183_da7219_hw_free, +}; + static int mt8183_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { @@ -120,6 +170,18 @@ static int mt8183_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, return 0; } +static int mt8183_rt1015_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params) +{ + /* fix BE i2s format to 32bit, clean param mask first */ + snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), + 0, SNDRV_PCM_FORMAT_LAST); + + params_set_format(params, SNDRV_PCM_FORMAT_S24_LE); + + return 0; +} + static int mt8183_da7219_max98357_startup( struct snd_pcm_substream *substream) @@ -272,12 +334,19 @@ SND_SOC_DAILINK_DEFS(i2s2, DAILINK_COMP_ARRAY(COMP_CODEC(DA7219_DEV_NAME, DA7219_CODEC_DAI)), DAILINK_COMP_ARRAY(COMP_EMPTY())); -SND_SOC_DAILINK_DEFS(i2s3, +SND_SOC_DAILINK_DEFS(i2s3_max98357a, DAILINK_COMP_ARRAY(COMP_CPU("I2S3")), DAILINK_COMP_ARRAY(COMP_CODEC("max98357a", "HiFi"), COMP_CODEC(DA7219_DEV_NAME, DA7219_CODEC_DAI)), DAILINK_COMP_ARRAY(COMP_EMPTY())); +SND_SOC_DAILINK_DEFS(i2s3_rt1015, + DAILINK_COMP_ARRAY(COMP_CPU("I2S3")), + DAILINK_COMP_ARRAY(COMP_CODEC(RT1015_DEV0_NAME, RT1015_CODEC_DAI), + COMP_CODEC(RT1015_DEV1_NAME, RT1015_CODEC_DAI), + COMP_CODEC(DA7219_DEV_NAME, DA7219_CODEC_DAI)), + DAILINK_COMP_ARRAY(COMP_EMPTY())); + SND_SOC_DAILINK_DEFS(i2s5, DAILINK_COMP_ARRAY(COMP_CPU("I2S5")), DAILINK_COMP_ARRAY(COMP_CODEC("bt-sco", "bt-sco-pcm")), @@ -288,7 +357,7 @@ SND_SOC_DAILINK_DEFS(tdm, DAILINK_COMP_ARRAY(COMP_DUMMY()), DAILINK_COMP_ARRAY(COMP_EMPTY())); -static struct snd_soc_dai_link mt8183_da7219_max98357_dai_links[] = { +static struct snd_soc_dai_link mt8183_da7219_dai_links[] = { /* FE */ { .name = "Playback_1", @@ -423,9 +492,6 @@ static struct snd_soc_dai_link mt8183_da7219_max98357_dai_links[] = { .no_pcm = 1, .dpcm_playback = 1, .ignore_suspend = 1, - .be_hw_params_fixup = mt8183_i2s_hw_params_fixup, - .ops = &mt8183_da7219_i2s_ops, - SND_SOC_DAILINK_REG(i2s3), }, { .name = "I2S5", @@ -518,25 +584,56 @@ static struct snd_soc_card mt8183_da7219_max98357_card = { .num_dapm_widgets = ARRAY_SIZE(mt8183_da7219_max98357_dapm_widgets), .dapm_routes = mt8183_da7219_max98357_dapm_routes, .num_dapm_routes = ARRAY_SIZE(mt8183_da7219_max98357_dapm_routes), - .dai_link = mt8183_da7219_max98357_dai_links, - .num_links = ARRAY_SIZE(mt8183_da7219_max98357_dai_links), + .dai_link = mt8183_da7219_dai_links, + .num_links = ARRAY_SIZE(mt8183_da7219_dai_links), .aux_dev = &mt8183_da7219_max98357_headset_dev, .num_aux_devs = 1, .codec_conf = mt6358_codec_conf, .num_configs = ARRAY_SIZE(mt6358_codec_conf), }; +static struct snd_soc_codec_conf mt8183_da7219_rt1015_codec_conf[] = { + { + .dlc = COMP_CODEC_CONF("mt6358-sound"), + .name_prefix = "Mt6358", + }, + { + .dlc = COMP_CODEC_CONF(RT1015_DEV0_NAME), + .name_prefix = "Left", + }, + { + .dlc = COMP_CODEC_CONF(RT1015_DEV1_NAME), + .name_prefix = "Right", + }, +}; + +static struct snd_soc_card mt8183_da7219_rt1015_card = { + .name = "mt8183_da7219_rt1015", + .owner = THIS_MODULE, + .controls = mt8183_da7219_max98357_snd_controls, + .num_controls = ARRAY_SIZE(mt8183_da7219_max98357_snd_controls), + .dapm_widgets = mt8183_da7219_max98357_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(mt8183_da7219_max98357_dapm_widgets), + .dapm_routes = mt8183_da7219_max98357_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(mt8183_da7219_max98357_dapm_routes), + .dai_link = mt8183_da7219_dai_links, + .num_links = ARRAY_SIZE(mt8183_da7219_dai_links), + .aux_dev = &mt8183_da7219_max98357_headset_dev, + .num_aux_devs = 1, + .codec_conf = mt8183_da7219_rt1015_codec_conf, + .num_configs = ARRAY_SIZE(mt8183_da7219_rt1015_codec_conf), +}; + static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) { - struct snd_soc_card *card = &mt8183_da7219_max98357_card; + struct snd_soc_card *card; struct device_node *platform_node; struct snd_soc_dai_link *dai_link; struct mt8183_da7219_max98357_priv *priv; struct pinctrl *pinctrl; + const struct of_device_id *match; int ret, i; - card->dev = &pdev->dev; - platform_node = of_parse_phandle(pdev->dev.of_node, "mediatek,platform", 0); if (!platform_node) { @@ -544,10 +641,46 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) return -EINVAL; } + match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev); + if (!match || !match->data) + return -EINVAL; + + card = (struct snd_soc_card *)match->data; + card->dev = &pdev->dev; + for_each_card_prelinks(card, i, dai_link) { - if (dai_link->platforms->name) - continue; - dai_link->platforms->of_node = platform_node; + if (strcmp(dai_link->name, "I2S3") == 0) { + if (card == &mt8183_da7219_max98357_card) { + dai_link->be_hw_params_fixup = + mt8183_i2s_hw_params_fixup; + dai_link->ops = &mt8183_mt6358_i2s_ops; + dai_link->cpus = i2s3_max98357a_cpus; + dai_link->num_cpus = + ARRAY_SIZE(i2s3_max98357a_cpus); + dai_link->codecs = i2s3_max98357a_codecs; + dai_link->num_codecs = + ARRAY_SIZE(i2s3_max98357a_codecs); + dai_link->platforms = i2s3_max98357a_platforms; + dai_link->num_platforms = + ARRAY_SIZE(i2s3_max98357a_platforms); + } else if (card == &mt8183_da7219_rt1015_card) { + dai_link->be_hw_params_fixup = + mt8183_rt1015_i2s_hw_params_fixup; + dai_link->ops = &mt8183_da7219_rt1015_i2s_ops; + dai_link->cpus = i2s3_rt1015_cpus; + dai_link->num_cpus = + ARRAY_SIZE(i2s3_rt1015_cpus); + dai_link->codecs = i2s3_rt1015_codecs; + dai_link->num_codecs = + ARRAY_SIZE(i2s3_rt1015_codecs); + dai_link->platforms = i2s3_rt1015_platforms; + dai_link->num_platforms = + ARRAY_SIZE(i2s3_rt1015_platforms); + } + } + + if (!dai_link->platforms->name) + dai_link->platforms->of_node = platform_node; } mt8183_da7219_max98357_headset_dev.dlc.of_node = @@ -578,14 +711,21 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id mt8183_da7219_max98357_dt_match[] = { - {.compatible = "mediatek,mt8183_da7219_max98357",}, + { + .compatible = "mediatek,mt8183_da7219_max98357", + .data = &mt8183_da7219_max98357_card, + }, + { + .compatible = "mediatek,mt8183_da7219_rt1015", + .data = &mt8183_da7219_rt1015_card, + }, {} }; #endif static struct platform_driver mt8183_da7219_max98357_driver = { .driver = { - .name = "mt8183_da7219_max98357", + .name = "mt8183_da7219", #ifdef CONFIG_OF .of_match_table = mt8183_da7219_max98357_dt_match, #endif