summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2023-01-31 02:00:42 +0000
committerMark Brown <broonie@kernel.org>2023-01-31 11:05:01 +0000
commitec4b2099c6e01342e5c3289a906615c3abef85b8 (patch)
tree86e835e3dc81e99c77f3a7e8ae987df753744888
parente87abb83fc24a481ba490d8596969e1de3a16384 (diff)
downloadlinux-stable-ec4b2099c6e01342e5c3289a906615c3abef85b8.tar.gz
linux-stable-ec4b2099c6e01342e5c3289a906615c3abef85b8.tar.bz2
linux-stable-ec4b2099c6e01342e5c3289a906615c3abef85b8.zip
ASoC: intel: use helper function
Current ASoC has many helper function. This patch use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87tu07ea45.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/intel/atom/sst-atom-controls.c9
-rw-r--r--sound/soc/intel/avs/boards/nau8825.c5
-rw-r--r--sound/soc/intel/avs/pcm.c15
-rw-r--r--sound/soc/intel/skylake/skl-topology.c19
4 files changed, 17 insertions, 31 deletions
diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c
index fd59b35a62ba..38116c758717 100644
--- a/sound/soc/intel/atom/sst-atom-controls.c
+++ b/sound/soc/intel/atom/sst-atom-controls.c
@@ -1327,15 +1327,13 @@ static bool is_sst_dapm_widget(struct snd_soc_dapm_widget *w)
int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute)
{
struct sst_data *drv = snd_soc_dai_get_drvdata(dai);
- struct snd_soc_dapm_widget *w;
+ struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(dai, stream);
struct snd_soc_dapm_path *p;
dev_dbg(dai->dev, "enter, dai-name=%s dir=%d\n", dai->name, stream);
+ dev_dbg(dai->dev, "Stream name=%s\n", w->name);
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
- dev_dbg(dai->dev, "Stream name=%s\n",
- dai->playback_widget->name);
- w = dai->playback_widget;
snd_soc_dapm_widget_for_each_sink_path(w, p) {
if (p->connected && !p->connected(w, p->sink))
continue;
@@ -1352,9 +1350,6 @@ int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute)
}
}
} else {
- dev_dbg(dai->dev, "Stream name=%s\n",
- dai->capture_widget->name);
- w = dai->capture_widget;
snd_soc_dapm_widget_for_each_source_path(w, p) {
if (p->connected && !p->connected(w, p->source))
continue;
diff --git a/sound/soc/intel/avs/boards/nau8825.c b/sound/soc/intel/avs/boards/nau8825.c
index 6731d8a49076..b31fa931ba8b 100644
--- a/sound/soc/intel/avs/boards/nau8825.c
+++ b/sound/soc/intel/avs/boards/nau8825.c
@@ -258,14 +258,15 @@ static int avs_card_resume_post(struct snd_soc_card *card)
{
struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, SKL_NUVOTON_CODEC_DAI);
struct snd_soc_jack *jack = snd_soc_card_get_drvdata(card);
+ int stream = SNDRV_PCM_STREAM_PLAYBACK;
if (!codec_dai) {
dev_err(card->dev, "Codec dai not found\n");
return -EINVAL;
}
- if (codec_dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK] &&
- codec_dai->playback_widget->active)
+ if (snd_soc_dai_stream_active(codec_dai, stream) &&
+ snd_soc_dai_get_widget(codec_dai, stream)->active)
snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_FS, 0, SND_SOC_CLOCK_IN);
return snd_soc_component_set_jack(codec_dai->component, jack, NULL);
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index c4376c9c35ef..211edd51a896 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -35,15 +35,13 @@ struct avs_dma_data {
static struct avs_tplg_path_template *
avs_dai_find_path_template(struct snd_soc_dai *dai, bool is_fe, int direction)
{
- struct snd_soc_dapm_widget *dw;
+ struct snd_soc_dapm_widget *dw = snd_soc_dai_get_widget(dai, direction);
struct snd_soc_dapm_path *dp;
enum snd_soc_dapm_direction dir;
if (direction == SNDRV_PCM_STREAM_CAPTURE) {
- dw = dai->capture_widget;
dir = is_fe ? SND_SOC_DAPM_DIR_OUT : SND_SOC_DAPM_DIR_IN;
} else {
- dw = dai->playback_widget;
dir = is_fe ? SND_SOC_DAPM_DIR_IN : SND_SOC_DAPM_DIR_OUT;
}
@@ -929,7 +927,7 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be,
int ret;
for_each_component_dais(component, dai) {
- data = dai->playback_dma_data;
+ data = snd_soc_dai_dma_data_get_playback(dai);
if (data) {
rtd = asoc_substream_to_rtd(data->substream);
if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) {
@@ -942,7 +940,7 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be,
}
}
- data = dai->capture_dma_data;
+ data = snd_soc_dai_dma_data_get_capture(dai);
if (data) {
rtd = asoc_substream_to_rtd(data->substream);
if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) {
@@ -1291,11 +1289,14 @@ static void avs_component_hda_unregister_dais(struct snd_soc_component *componen
sprintf(name, "%s-cpu", dev_name(&codec->core.dev));
for_each_component_dais_safe(component, dai, save) {
+ int stream;
+
if (!strstr(dai->driver->name, name))
continue;
- snd_soc_dapm_free_widget(dai->playback_widget);
- snd_soc_dapm_free_widget(dai->capture_widget);
+ for_each_pcm_streams(stream)
+ snd_soc_dapm_free_widget(snd_soc_dai_get_widget(dai, stream));
+
snd_soc_unregister_dai(dai);
}
}
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index b20643b83401..96cfebded072 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -1663,11 +1663,10 @@ int skl_tplg_update_pipe_params(struct device *dev,
struct skl_module_cfg *
skl_tplg_fe_get_cpr_module(struct snd_soc_dai *dai, int stream)
{
- struct snd_soc_dapm_widget *w;
+ struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(dai, stream);
struct snd_soc_dapm_path *p = NULL;
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
- w = dai->playback_widget;
snd_soc_dapm_widget_for_each_sink_path(w, p) {
if (p->connect && p->sink->power &&
!is_skl_dsp_widget_type(p->sink, dai->dev))
@@ -1680,7 +1679,6 @@ skl_tplg_fe_get_cpr_module(struct snd_soc_dai *dai, int stream)
}
}
} else {
- w = dai->capture_widget;
snd_soc_dapm_widget_for_each_source_path(w, p) {
if (p->connect && p->source->power &&
!is_skl_dsp_widget_type(p->source, dai->dev))
@@ -1744,14 +1742,12 @@ static struct skl_module_cfg *skl_get_mconfig_cap_cpr(
struct skl_module_cfg *
skl_tplg_be_get_cpr_module(struct snd_soc_dai *dai, int stream)
{
- struct snd_soc_dapm_widget *w;
+ struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(dai, stream);
struct skl_module_cfg *mconfig;
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
- w = dai->playback_widget;
mconfig = skl_get_mconfig_pb_cpr(dai, w);
} else {
- w = dai->capture_widget;
mconfig = skl_get_mconfig_cap_cpr(dai, w);
}
return mconfig;
@@ -1905,20 +1901,13 @@ static int skl_tplg_be_set_sink_pipe_params(struct snd_soc_dai *dai,
int skl_tplg_be_update_params(struct snd_soc_dai *dai,
struct skl_pipe_params *params)
{
- struct snd_soc_dapm_widget *w;
+ struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(dai, params->stream);
if (params->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- w = dai->playback_widget;
-
return skl_tplg_be_set_src_pipe_params(dai, w, params);
-
} else {
- w = dai->capture_widget;
-
return skl_tplg_be_set_sink_pipe_params(dai, w, params);
}
-
- return 0;
}
static const struct snd_soc_tplg_widget_events skl_tplg_widget_ops[] = {
@@ -2978,7 +2967,7 @@ void skl_cleanup_resources(struct skl_dev *skl)
return;
card = soc_component->card;
- if (!card || !card->instantiated)
+ if (!snd_soc_card_is_instantiated(card))
return;
list_for_each_entry(w, &card->widgets, list) {