From patchwork Wed Apr 26 05:51:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?VHJldm9yIFd1ICjlkLPmlofoia8p?= X-Patchwork-Id: 87614 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp30996vqo; Tue, 25 Apr 2023 23:07:28 -0700 (PDT) X-Google-Smtp-Source: AKy350bcVq/8v4dhtYVBmzKhljSR+hfgRHUBqqNs50/bb8evlWW+JMK0SZL1gX01nooAgII/4eXf X-Received: by 2002:a17:90a:fd87:b0:23f:9439:9a27 with SMTP id cx7-20020a17090afd8700b0023f94399a27mr19210557pjb.20.1682489248486; Tue, 25 Apr 2023 23:07:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682489248; cv=none; d=google.com; s=arc-20160816; b=JSd8EnoJADxnvoCAJCEt/Dg7Ys+PAPr3hef60k4RuW7qG6dZQkowEqbF42ysnnzcVD deg038Y37jsNnjMkZObaOq8H/cboC6GSOTTwTMlbnBwkz5tX0MdTGevESmcRIZYu8Ohf U61mtD+N2JfYPcKs97Y53K/dlR/IdTibRVQLYbPPm8lWBdDmJ5zhylYO+EBeGAdK7LLi tOGL+cjKzQLxlbX+OaSTqtwvMTbkUf2R3e7YNkdib1ePyxMM3GF16BPEkrbQ55HuC+jr dWlwFU8S86NPeq9EBtf3scle0GWW7cMdif4oEGpLUFhf+DASWIgRIdOROw6eqZ19fQou mxcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=iQxj2f8v6Hq2mM43K9p34deiZ+cOeCScETZMUSLPaL4=; b=UWvi7D9tJgzLUUbhsCukXNdFaWdXtHDMdZ2dtY7bUgA0Yp//dnYw22n+ucaw06rfW7 bOZNfNx3ys8Xag7mp1CxJC6NvXQDvZ0idHzFwbjXebgnI2MYYfi5zpUggCDaf5Nl9KWX VqY2I0vOg4HOSYG7s0Wh09jmGlpRnXsm4H69iyFJGsvG6R7HBEWmESqqWE8/u0nWrLZd AXNcinHAKt/UEpID/rhwpleRVrfYf9RXoNalRxz/A5mWFfyVBkn2SHpwIKHAeNOhg1bX GbOZs8cpznrQwKh6XSASiGyyFtr05RVhEf4D3c+rXTleip198QSNuIwffDgY3CK5D1xe pgVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=kiIuCLck; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm3-20020a17090b3ec300b00246bb27b5ffsi18964500pjb.109.2023.04.25.23.07.12; Tue, 25 Apr 2023 23:07:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=kiIuCLck; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239464AbjDZFwj (ORCPT + 99 others); Wed, 26 Apr 2023 01:52:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239485AbjDZFwc (ORCPT ); Wed, 26 Apr 2023 01:52:32 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90D053A9B; Tue, 25 Apr 2023 22:52:04 -0700 (PDT) X-UUID: 6235f4eae3f611edb6b9f13eb10bd0fe-20230426 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=iQxj2f8v6Hq2mM43K9p34deiZ+cOeCScETZMUSLPaL4=; b=kiIuCLckKOtluUlWv9w4O4pYIjgeulrzYmF4cPXRtyUKiaVwDFA8cgGFg8PQa6Ar6YgUEScvWvV1/5QaNCZtCElkmeBfrb56GJoKOZo5/GXDyXdgH9voY9v93e3kdQfcy5FP5QTSikif4aDrFCAi7hb41++RjJ8+4EM67saR1J8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:1d5a1158-31ac-4a8f-b758-8bc7bd345983,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.22,REQID:1d5a1158-31ac-4a8f-b758-8bc7bd345983,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:120426c,CLOUDID:5c472dec-db6f-41fe-8b83-13fe7ed1ef52,B ulkID:230426135128WJPHPIVF,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: 6235f4eae3f611edb6b9f13eb10bd0fe-20230426 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 792603456; Wed, 26 Apr 2023 13:51:26 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 26 Apr 2023 13:51:26 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Wed, 26 Apr 2023 13:51:26 +0800 From: Trevor Wu To: , , , , , , , CC: , , , , , Subject: [PATCH v3 5/7] ASoC: mediatek: mt8188: combine afe component registration Date: Wed, 26 Apr 2023 13:51:22 +0800 Message-ID: <20230426055124.16529-6-trevor.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230426055124.16529-1-trevor.wu@mediatek.com> References: <20230426055124.16529-1-trevor.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764217846031888532?= X-GMAIL-MSGID: =?utf-8?q?1764217846031888532?= There is no benefit to separate two components for AFE, so DAI driver registration is moved to dev_snd_soc_register_component to merge these two components. Signed-off-by: Trevor Wu --- sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 37 ++-------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c b/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c index e5f9373bed56..fecc891f892d 100644 --- a/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c +++ b/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c @@ -1898,10 +1898,6 @@ static const struct snd_kcontrol_new mt8188_memif_controls[] = { MT8188_AFE_MEMIF_UL10), }; -static const struct snd_soc_component_driver mt8188_afe_pcm_dai_component = { - .name = "mt8188-afe-pcm-dai", -}; - static const struct mtk_base_memif_data memif_data[MT8188_AFE_MEMIF_NUM] = { [MT8188_AFE_MEMIF_DL2] = { .name = "DL2", @@ -3142,9 +3138,8 @@ static int mt8188_afe_pcm_dev_probe(struct platform_device *pdev) struct mtk_base_afe *afe; struct mt8188_afe_private *afe_priv; struct device *dev; - int i, irq_id, ret; - struct snd_soc_component *component; struct reset_control *rstc; + int i, irq_id, ret; ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(33)); if (ret) @@ -3280,34 +3275,12 @@ static int mt8188_afe_pcm_dev_probe(struct platform_device *pdev) /* register component */ ret = devm_snd_soc_register_component(dev, &mt8188_afe_component, - NULL, 0); + afe->dai_drivers, afe->num_dai_drivers); if (ret) { dev_warn(dev, "err_platform\n"); goto err_pm_put; } - component = devm_kzalloc(&pdev->dev, sizeof(*component), GFP_KERNEL); - if (!component) { - ret = -ENOMEM; - goto err_pm_put; - } - - ret = snd_soc_component_initialize(component, - &mt8188_afe_pcm_dai_component, - &pdev->dev); - if (ret) - goto err_pm_put; -#ifdef CONFIG_DEBUG_FS - component->debugfs_prefix = "pcm"; -#endif - ret = snd_soc_add_component(component, - afe->dai_drivers, - afe->num_dai_drivers); - if (ret) { - dev_warn(dev, "err_add_component\n"); - goto err_pm_put; - } - mt8188_afe_init_registers(afe); pm_runtime_put_sync(&pdev->dev); @@ -3323,11 +3296,6 @@ static int mt8188_afe_pcm_dev_probe(struct platform_device *pdev) return ret; } -static void mt8188_afe_pcm_dev_remove(struct platform_device *pdev) -{ - snd_soc_unregister_component(&pdev->dev); -} - static const struct of_device_id mt8188_afe_pcm_dt_match[] = { { .compatible = "mediatek,mt8188-afe", }, {}, @@ -3346,7 +3314,6 @@ static struct platform_driver mt8188_afe_pcm_driver = { .pm = &mt8188_afe_pm_ops, }, .probe = mt8188_afe_pcm_dev_probe, - .remove_new = mt8188_afe_pcm_dev_remove, }; module_platform_driver(mt8188_afe_pcm_driver);