Commit 7ec6b431 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: mediatek: move .suspend/.resume to component

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: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/877e1nym4e.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent aa3c4765
...@@ -319,9 +319,9 @@ int mtk_dynamic_irq_release(struct mtk_base_afe *afe, int irq_id) ...@@ -319,9 +319,9 @@ int mtk_dynamic_irq_release(struct mtk_base_afe *afe, int irq_id)
} }
EXPORT_SYMBOL_GPL(mtk_dynamic_irq_release); 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 device *dev = afe->dev;
struct regmap *regmap = afe->regmap; struct regmap *regmap = afe->regmap;
int i; int i;
...@@ -342,11 +342,11 @@ int mtk_afe_dai_suspend(struct snd_soc_dai *dai) ...@@ -342,11 +342,11 @@ int mtk_afe_dai_suspend(struct snd_soc_dai *dai)
afe->runtime_suspend(dev); afe->runtime_suspend(dev);
return 0; 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 device *dev = afe->dev;
struct regmap *regmap = afe->regmap; struct regmap *regmap = afe->regmap;
int i = 0; int i = 0;
...@@ -366,7 +366,7 @@ int mtk_afe_dai_resume(struct snd_soc_dai *dai) ...@@ -366,7 +366,7 @@ int mtk_afe_dai_resume(struct snd_soc_dai *dai)
afe->suspended = false; afe->suspended = false;
return 0; 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) int mtk_memif_set_enable(struct mtk_base_afe *afe, int id)
{ {
......
...@@ -31,8 +31,8 @@ extern const struct snd_soc_dai_ops mtk_afe_fe_ops; ...@@ -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_acquire(struct mtk_base_afe *afe);
int mtk_dynamic_irq_release(struct mtk_base_afe *afe, int irq_id); 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_suspend(struct snd_soc_component *component);
int mtk_afe_dai_resume(struct snd_soc_dai *dai); 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_enable(struct mtk_base_afe *afe, int id);
int mtk_memif_set_disable(struct mtk_base_afe *afe, int id); int mtk_memif_set_disable(struct mtk_base_afe *afe, int id);
......
...@@ -549,8 +549,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = { ...@@ -549,8 +549,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = {
{ {
.name = "PCMO0", .name = "PCMO0",
.id = MT2701_MEMIF_DL1, .id = MT2701_MEMIF_DL1,
.suspend = mtk_afe_dai_suspend,
.resume = mtk_afe_dai_resume,
.playback = { .playback = {
.stream_name = "DL1", .stream_name = "DL1",
.channels_min = 1, .channels_min = 1,
...@@ -565,8 +563,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = { ...@@ -565,8 +563,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = {
{ {
.name = "PCM_multi", .name = "PCM_multi",
.id = MT2701_MEMIF_DLM, .id = MT2701_MEMIF_DLM,
.suspend = mtk_afe_dai_suspend,
.resume = mtk_afe_dai_resume,
.playback = { .playback = {
.stream_name = "DLM", .stream_name = "DLM",
.channels_min = 1, .channels_min = 1,
...@@ -582,8 +578,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = { ...@@ -582,8 +578,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = {
{ {
.name = "PCM0", .name = "PCM0",
.id = MT2701_MEMIF_UL1, .id = MT2701_MEMIF_UL1,
.suspend = mtk_afe_dai_suspend,
.resume = mtk_afe_dai_resume,
.capture = { .capture = {
.stream_name = "UL1", .stream_name = "UL1",
.channels_min = 1, .channels_min = 1,
...@@ -598,8 +592,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = { ...@@ -598,8 +592,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = {
{ {
.name = "PCM1", .name = "PCM1",
.id = MT2701_MEMIF_UL2, .id = MT2701_MEMIF_UL2,
.suspend = mtk_afe_dai_suspend,
.resume = mtk_afe_dai_resume,
.capture = { .capture = {
.stream_name = "UL2", .stream_name = "UL2",
.channels_min = 1, .channels_min = 1,
...@@ -615,8 +607,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = { ...@@ -615,8 +607,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = {
{ {
.name = "PCM_BT_DL", .name = "PCM_BT_DL",
.id = MT2701_MEMIF_DLBT, .id = MT2701_MEMIF_DLBT,
.suspend = mtk_afe_dai_suspend,
.resume = mtk_afe_dai_resume,
.playback = { .playback = {
.stream_name = "DLBT", .stream_name = "DLBT",
.channels_min = 1, .channels_min = 1,
...@@ -630,8 +620,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = { ...@@ -630,8 +620,6 @@ static struct snd_soc_dai_driver mt2701_afe_pcm_dais[] = {
{ {
.name = "PCM_BT_UL", .name = "PCM_BT_UL",
.id = MT2701_MEMIF_ULBT, .id = MT2701_MEMIF_ULBT,
.suspend = mtk_afe_dai_suspend,
.resume = mtk_afe_dai_resume,
.capture = { .capture = {
.stream_name = "ULBT", .stream_name = "ULBT",
.channels_min = 1, .channels_min = 1,
...@@ -982,6 +970,8 @@ static const struct snd_soc_component_driver mt2701_afe_pcm_dai_component = { ...@@ -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), .num_dapm_widgets = ARRAY_SIZE(mt2701_afe_pcm_widgets),
.dapm_routes = mt2701_afe_pcm_routes, .dapm_routes = mt2701_afe_pcm_routes,
.num_dapm_routes = ARRAY_SIZE(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] = { static const struct mtk_base_memif_data memif_data[MT2701_MEMIF_NUM] = {
......
...@@ -533,8 +533,6 @@ static struct snd_soc_dai_driver mt8173_afe_pcm_dais[] = { ...@@ -533,8 +533,6 @@ static struct snd_soc_dai_driver mt8173_afe_pcm_dais[] = {
{ {
.name = "DL1", /* downlink 1 */ .name = "DL1", /* downlink 1 */
.id = MT8173_AFE_MEMIF_DL1, .id = MT8173_AFE_MEMIF_DL1,
.suspend = mtk_afe_dai_suspend,
.resume = mtk_afe_dai_resume,
.playback = { .playback = {
.stream_name = "DL1", .stream_name = "DL1",
.channels_min = 1, .channels_min = 1,
...@@ -546,8 +544,6 @@ static struct snd_soc_dai_driver mt8173_afe_pcm_dais[] = { ...@@ -546,8 +544,6 @@ static struct snd_soc_dai_driver mt8173_afe_pcm_dais[] = {
}, { }, {
.name = "VUL", /* voice uplink */ .name = "VUL", /* voice uplink */
.id = MT8173_AFE_MEMIF_VUL, .id = MT8173_AFE_MEMIF_VUL,
.suspend = mtk_afe_dai_suspend,
.resume = mtk_afe_dai_resume,
.capture = { .capture = {
.stream_name = "VUL", .stream_name = "VUL",
.channels_min = 1, .channels_min = 1,
...@@ -584,8 +580,6 @@ static struct snd_soc_dai_driver mt8173_afe_hdmi_dais[] = { ...@@ -584,8 +580,6 @@ static struct snd_soc_dai_driver mt8173_afe_hdmi_dais[] = {
{ {
.name = "HDMI", .name = "HDMI",
.id = MT8173_AFE_MEMIF_HDMI, .id = MT8173_AFE_MEMIF_HDMI,
.suspend = mtk_afe_dai_suspend,
.resume = mtk_afe_dai_resume,
.playback = { .playback = {
.stream_name = "HDMI", .stream_name = "HDMI",
.channels_min = 2, .channels_min = 2,
...@@ -681,12 +675,16 @@ static const struct snd_soc_component_driver mt8173_afe_pcm_dai_component = { ...@@ -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), .num_dapm_widgets = ARRAY_SIZE(mt8173_afe_pcm_widgets),
.dapm_routes = mt8173_afe_pcm_routes, .dapm_routes = mt8173_afe_pcm_routes,
.num_dapm_routes = ARRAY_SIZE(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 = { static const struct snd_soc_component_driver mt8173_afe_hdmi_dai_component = {
.name = "mt8173-afe-hdmi-dai", .name = "mt8173-afe-hdmi-dai",
.dapm_routes = mt8173_afe_hdmi_routes, .dapm_routes = mt8173_afe_hdmi_routes,
.num_dapm_routes = ARRAY_SIZE(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] = { static const char *aud_clks[MT8173_CLK_NUM] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment