From patchwork Mon Jan 20 01:04:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 193811 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03CA4C33CAF for ; Mon, 20 Jan 2020 01:07:29 +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 85A7920714 for ; Mon, 20 Jan 2020 01:07:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="fsp3q2p+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 85A7920714 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 D1341166B; Mon, 20 Jan 2020 02:06:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D1341166B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1579482446; bh=YeNcyO4dLQ+0jqBVWGQXqU6/eX0ZVIfMGnTWKtpDa3o=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=fsp3q2p+74SRorSx7iRddcLRDyxFnte8U349+zy6IalT2x4gxfBExmm48ikl6sgim +xj9McaPyTIpk71dhyflOYbXJFUWxn8ZiQhWrxxovLHoABUWht+HLb42a620ctkOYX UtLiI+6xiWzcj5wuq/Gg+u1BKZ4i8MdHLt6bkAf0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 04912F80292; Mon, 20 Jan 2020 02:04:14 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9BE9AF80299; Mon, 20 Jan 2020 02:04:08 +0100 (CET) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id A23C6F80272 for ; Mon, 20 Jan 2020 02:04:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A23C6F80272 Date: 20 Jan 2020 10:04:01 +0900 X-IronPort-AV: E=Sophos;i="5.70,340,1574089200"; d="scan'208";a="36865447" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 20 Jan 2020 10:04:01 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 7A9DA40083F0; Mon, 20 Jan 2020 10:04:01 +0900 (JST) Message-ID: <877e1nym4e.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87eevvym6s.wl-kuninori.morimoto.gx@renesas.com> References: <87eevvym6s.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA Subject: [alsa-devel] [PATCH v2 05/17] ASoC: mediatek: move .suspend/.resume to component 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" From: Kuninori Morimoto There is no big difference at implementation for .suspend/.resume between DAI driver and Component driver. But because some driver is using DAI version, thus ALSA SoC needs to keep supporting it, hence, framework becoming verbose. If we can switch all DAI driver .suspend/.resume to Component driver, we can remove verbose code from ALSA SoC. Driver is getting its private data via dai->dev. But dai->dev and component->dev are same dev, thus, we can convert these. For same reason, we can convert dai->active to component->active if necessary. This patch moves DAI driver .suspend/.resume to Component driver Signed-off-by: Kuninori Morimoto --- sound/soc/mediatek/common/mtk-afe-fe-dai.c | 12 ++++++------ sound/soc/mediatek/common/mtk-afe-fe-dai.h | 4 ++-- sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 14 ++------------ sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 10 ++++------ 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c index 8f314e1..4254f3a 100644 --- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c +++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c @@ -319,9 +319,9 @@ int mtk_dynamic_irq_release(struct mtk_base_afe *afe, int irq_id) } EXPORT_SYMBOL_GPL(mtk_dynamic_irq_release); -int mtk_afe_dai_suspend(struct snd_soc_dai *dai) +int mtk_afe_suspend(struct snd_soc_component *component) { - struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); + struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); struct device *dev = afe->dev; struct regmap *regmap = afe->regmap; int i; @@ -342,11 +342,11 @@ int mtk_afe_dai_suspend(struct snd_soc_dai *dai) afe->runtime_suspend(dev); return 0; } -EXPORT_SYMBOL_GPL(mtk_afe_dai_suspend); +EXPORT_SYMBOL_GPL(mtk_afe_suspend); -int mtk_afe_dai_resume(struct snd_soc_dai *dai) +int mtk_afe_resume(struct snd_soc_component *component) { - struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); + struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); struct device *dev = afe->dev; struct regmap *regmap = afe->regmap; int i = 0; @@ -366,7 +366,7 @@ int mtk_afe_dai_resume(struct snd_soc_dai *dai) afe->suspended = false; return 0; } -EXPORT_SYMBOL_GPL(mtk_afe_dai_resume); +EXPORT_SYMBOL_GPL(mtk_afe_resume); int mtk_memif_set_enable(struct mtk_base_afe *afe, int id) { diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.h b/sound/soc/mediatek/common/mtk-afe-fe-dai.h index 507e3e7..8cec906 100644 --- a/sound/soc/mediatek/common/mtk-afe-fe-dai.h +++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.h @@ -31,8 +31,8 @@ extern const struct snd_soc_dai_ops mtk_afe_fe_ops; int mtk_dynamic_irq_acquire(struct mtk_base_afe *afe); int mtk_dynamic_irq_release(struct mtk_base_afe *afe, int irq_id); -int mtk_afe_dai_suspend(struct snd_soc_dai *dai); -int mtk_afe_dai_resume(struct snd_soc_dai *dai); +int mtk_afe_suspend(struct snd_soc_component *component); +int mtk_afe_resume(struct snd_soc_component *component); int mtk_memif_set_enable(struct mtk_base_afe *afe, int id); int mtk_memif_set_disable(struct mtk_base_afe *afe, int id); diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c index 76502ba..488603a 100644 --- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c +++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c @@ -549,8 +549,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = { { .name = "PCMO0", .id = MT2701_MEMIF_DL1, - .suspend = mtk_afe_dai_suspend, - .resume = mtk_afe_dai_resume, .playback = { .stream_name = "DL1", .channels_min = 1, @@ -565,8 +563,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = { { .name = "PCM_multi", .id = MT2701_MEMIF_DLM, - .suspend = mtk_afe_dai_suspend, - .resume = mtk_afe_dai_resume, .playback = { .stream_name = "DLM", .channels_min = 1, @@ -582,8 +578,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = { { .name = "PCM0", .id = MT2701_MEMIF_UL1, - .suspend = mtk_afe_dai_suspend, - .resume = mtk_afe_dai_resume, .capture = { .stream_name = "UL1", .channels_min = 1, @@ -598,8 +592,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = { { .name = "PCM1", .id = MT2701_MEMIF_UL2, - .suspend = mtk_afe_dai_suspend, - .resume = mtk_afe_dai_resume, .capture = { .stream_name = "UL2", .channels_min = 1, @@ -615,8 +607,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = { { .name = "PCM_BT_DL", .id = MT2701_MEMIF_DLBT, - .suspend = mtk_afe_dai_suspend, - .resume = mtk_afe_dai_resume, .playback = { .stream_name = "DLBT", .channels_min = 1, @@ -630,8 +620,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = { { .name = "PCM_BT_UL", .id = MT2701_MEMIF_ULBT, - .suspend = mtk_afe_dai_suspend, - .resume = mtk_afe_dai_resume, .capture = { .stream_name = "ULBT", .channels_min = 1, @@ -982,6 +970,8 @@ static const struct snd_soc_component_driver mt2701_afe_pcm_dai_component = { .num_dapm_widgets = ARRAY_SIZE(mt2701_afe_pcm_widgets), .dapm_routes = mt2701_afe_pcm_routes, .num_dapm_routes = ARRAY_SIZE(mt2701_afe_pcm_routes), + .suspend = mtk_afe_suspend, + .resume = mtk_afe_resume, }; static const struct mtk_base_memif_data memif_data[MT2701_MEMIF_NUM] = { diff --git a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c index 0ee2925..461e4de 100644 --- a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c +++ b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c @@ -533,8 +533,6 @@ static struct snd_soc_dai_driver mt8173_afe_pcm_dais[] = { { .name = "DL1", /* downlink 1 */ .id = MT8173_AFE_MEMIF_DL1, - .suspend = mtk_afe_dai_suspend, - .resume = mtk_afe_dai_resume, .playback = { .stream_name = "DL1", .channels_min = 1, @@ -546,8 +544,6 @@ static struct snd_soc_dai_driver mt8173_afe_pcm_dais[] = { }, { .name = "VUL", /* voice uplink */ .id = MT8173_AFE_MEMIF_VUL, - .suspend = mtk_afe_dai_suspend, - .resume = mtk_afe_dai_resume, .capture = { .stream_name = "VUL", .channels_min = 1, @@ -584,8 +580,6 @@ static struct snd_soc_dai_driver mt8173_afe_hdmi_dais[] = { { .name = "HDMI", .id = MT8173_AFE_MEMIF_HDMI, - .suspend = mtk_afe_dai_suspend, - .resume = mtk_afe_dai_resume, .playback = { .stream_name = "HDMI", .channels_min = 2, @@ -681,12 +675,16 @@ static const struct snd_soc_component_driver mt8173_afe_pcm_dai_component = { .num_dapm_widgets = ARRAY_SIZE(mt8173_afe_pcm_widgets), .dapm_routes = mt8173_afe_pcm_routes, .num_dapm_routes = ARRAY_SIZE(mt8173_afe_pcm_routes), + .suspend = mtk_afe_suspend, + .resume = mtk_afe_resume, }; static const struct snd_soc_component_driver mt8173_afe_hdmi_dai_component = { .name = "mt8173-afe-hdmi-dai", .dapm_routes = mt8173_afe_hdmi_routes, .num_dapm_routes = ARRAY_SIZE(mt8173_afe_hdmi_routes), + .suspend = mtk_afe_suspend, + .resume = mtk_afe_resume, }; static const char *aud_clks[MT8173_CLK_NUM] = {