Alsa-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: [alsa-devel] [PATCH 11/16] ASoC: dwc: dwc-i2s: move .suspend/.resume to component
Date: 14 Jan 2020 10:32:33 +0900
Message-ID: <87zheqg6vi.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87ftgihlic.wl-kuninori.morimoto.gx@renesas.com>


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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 <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/dwc/dwc-i2s.c | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c
index 65112b9..7eeca21 100644
--- a/sound/soc/dwc/dwc-i2s.c
+++ b/sound/soc/dwc/dwc-i2s.c
@@ -390,10 +390,6 @@ static const struct snd_soc_dai_ops dw_i2s_dai_ops = {
 	.set_fmt	= dw_i2s_set_fmt,
 };
 
-static const struct snd_soc_component_driver dw_i2s_component = {
-	.name		= "dw-i2s",
-};
-
 #ifdef CONFIG_PM
 static int dw_i2s_runtime_suspend(struct device *dev)
 {
@@ -413,26 +409,30 @@ static int dw_i2s_runtime_resume(struct device *dev)
 	return 0;
 }
 
-static int dw_i2s_suspend(struct snd_soc_dai *dai)
+static int dw_i2s_suspend(struct snd_soc_component *component)
 {
-	struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
+	struct dw_i2s_dev *dev = snd_soc_component_get_drvdata(component);
 
 	if (dev->capability & DW_I2S_MASTER)
 		clk_disable(dev->clk);
 	return 0;
 }
 
-static int dw_i2s_resume(struct snd_soc_dai *dai)
+static int dw_i2s_resume(struct snd_soc_component *component)
 {
-	struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
+	struct dw_i2s_dev *dev = snd_soc_component_get_drvdata(component);
+	struct snd_soc_dai *dai;
 
 	if (dev->capability & DW_I2S_MASTER)
 		clk_enable(dev->clk);
 
-	if (dai->playback_active)
-		dw_i2s_config(dev, SNDRV_PCM_STREAM_PLAYBACK);
-	if (dai->capture_active)
-		dw_i2s_config(dev, SNDRV_PCM_STREAM_CAPTURE);
+	for_each_component_dais(component, dai) {
+		if (dai->playback_active)
+			dw_i2s_config(dev, SNDRV_PCM_STREAM_PLAYBACK);
+		if (dai->capture_active)
+			dw_i2s_config(dev, SNDRV_PCM_STREAM_CAPTURE);
+	}
+
 	return 0;
 }
 
@@ -441,6 +441,12 @@ static int dw_i2s_resume(struct snd_soc_dai *dai)
 #define dw_i2s_resume	NULL
 #endif
 
+static const struct snd_soc_component_driver dw_i2s_component = {
+	.name		= "dw-i2s",
+	.suspend	= dw_i2s_suspend,
+	.resume		= dw_i2s_resume,
+};
+
 /*
  * The following tables allow a direct lookup of various parameters
  * defined in the I2S block's configuration in terms of sound system
@@ -629,8 +635,6 @@ static int dw_i2s_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	dw_i2s_dai->ops = &dw_i2s_dai_ops;
-	dw_i2s_dai->suspend = dw_i2s_suspend;
-	dw_i2s_dai->resume = dw_i2s_resume;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	dev->i2s_base = devm_ioremap_resource(&pdev->dev, res);
-- 
2.7.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply index

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14  1:31 [alsa-devel] [PATCH 00/16] ASoC: remove DAI suspend/resume Kuninori Morimoto
2020-01-14  1:31 ` [alsa-devel] [PATCH 01/16] ASoC: atmel: atmel_ssc_dai: move .suspend/.resume to component Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:31 ` [alsa-devel] [PATCH 02/16] ASoC: bcm: cygnus-ssp: " Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:31 ` [alsa-devel] [PATCH 03/16] ASoC: cirrus: ep93xx-i2s: " Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:31 ` [alsa-devel] [PATCH 04/16] ASoC: jz4740: jz4740-i2s: " Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:32 ` [alsa-devel] [PATCH 05/16] ASoC: mediatek: " Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:32 ` [alsa-devel] [PATCH 06/16] ASoC: samsung: s3c24xx-i2s: " Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:32 ` [alsa-devel] [PATCH 07/16] ASoC: samsung: spdif: " Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:32 ` [alsa-devel] [PATCH 08/16] ASoC: sti: sti_uniperif: " Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:32 ` [alsa-devel] [PATCH 09/16] ASoC: ti: omap-mcpdm: " Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:32 ` [alsa-devel] [PATCH 10/16] ASoC: uniphier: " Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:32 ` Kuninori Morimoto, Kuninori Morimoto [this message]
2020-01-14  1:32 ` [alsa-devel] [PATCH 12/16] ASoC: samsung: i2s: " Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:32 ` [alsa-devel] [PATCH 13/16] ASoC: ux500: ux500_msp_dai: remove unused DAI .suspend/.resume Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:32 ` [alsa-devel] [PATCH 14/16] ASoC: pxa: pxa-ssp: move .suspend/.resume to component Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:32 ` [alsa-devel] [PATCH 15/16] ASoC: pxa: pxa2xx-i2s: " Kuninori Morimoto, Kuninori Morimoto
2020-01-14  1:33 ` [alsa-devel] [PATCH 16/16] ASoC: soc-core: remove DAI suspend/resume Kuninori Morimoto, Kuninori Morimoto
2020-01-14  6:51 ` [alsa-devel] [PATCH 17/16] ASoC: soc-core: remove bus_control Kuninori Morimoto
2020-01-14  8:10   ` Kuninori Morimoto
2020-01-14 15:13     ` Mark Brown

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zheqg6vi.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Alsa-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/alsa-devel/0 alsa-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 alsa-devel alsa-devel/ https://lore.kernel.org/alsa-devel \
		alsa-devel@alsa-project.org
	public-inbox-index alsa-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.alsa-project.alsa-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git