summaryrefslogtreecommitdiff
path: root/sound/soc/meson/axg-tdm-interface.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2023-01-31 02:00:57 +0000
committerMark Brown <broonie@kernel.org>2023-01-31 11:05:03 +0000
commitc765ceda78f0bd9df1217f9beaefea58ecf3865c (patch)
tree873ecf3fdd6f13f173a4270d537e7292f0f6e81e /sound/soc/meson/axg-tdm-interface.c
parent0df2ec8e4706a6adc36d12cc5cf8e1fa7485fbf5 (diff)
downloadlwn-c765ceda78f0bd9df1217f9beaefea58ecf3865c.tar.gz
lwn-c765ceda78f0bd9df1217f9beaefea58ecf3865c.zip
ASoC: meson: use helper function
Current ASoC has many helper function. This patch use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/87r0vbea3r.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/meson/axg-tdm-interface.c')
-rw-r--r--sound/soc/meson/axg-tdm-interface.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c
index c040c83637e0..7624aafe9009 100644
--- a/sound/soc/meson/axg-tdm-interface.c
+++ b/sound/soc/meson/axg-tdm-interface.c
@@ -37,10 +37,8 @@ int axg_tdm_set_tdm_slots(struct snd_soc_dai *dai, u32 *tx_mask,
unsigned int slot_width)
{
struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai);
- struct axg_tdm_stream *tx = (struct axg_tdm_stream *)
- dai->playback_dma_data;
- struct axg_tdm_stream *rx = (struct axg_tdm_stream *)
- dai->capture_dma_data;
+ struct axg_tdm_stream *tx = snd_soc_dai_dma_data_get_playback(dai);
+ struct axg_tdm_stream *rx = snd_soc_dai_dma_data_get_capture(dai);
unsigned int tx_slots, rx_slots;
unsigned int fmt = 0;
@@ -362,11 +360,14 @@ static int axg_tdm_iface_prepare(struct snd_pcm_substream *substream,
static int axg_tdm_iface_remove_dai(struct snd_soc_dai *dai)
{
- if (dai->capture_dma_data)
- axg_tdm_stream_free(dai->capture_dma_data);
+ int stream;
- if (dai->playback_dma_data)
- axg_tdm_stream_free(dai->playback_dma_data);
+ for_each_pcm_streams(stream) {
+ struct axg_tdm_stream *ts = snd_soc_dai_dma_data_get(dai, stream);
+
+ if (ts)
+ axg_tdm_stream_free(ts);
+ }
return 0;
}
@@ -374,19 +375,20 @@ static int axg_tdm_iface_remove_dai(struct snd_soc_dai *dai)
static int axg_tdm_iface_probe_dai(struct snd_soc_dai *dai)
{
struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai);
+ int stream;
- if (dai->capture_widget) {
- dai->capture_dma_data = axg_tdm_stream_alloc(iface);
- if (!dai->capture_dma_data)
- return -ENOMEM;
- }
+ for_each_pcm_streams(stream) {
+ struct axg_tdm_stream *ts;
+
+ if (!snd_soc_dai_get_widget(dai, stream))
+ continue;
- if (dai->playback_widget) {
- dai->playback_dma_data = axg_tdm_stream_alloc(iface);
- if (!dai->playback_dma_data) {
+ ts = axg_tdm_stream_alloc(iface);
+ if (!ts) {
axg_tdm_iface_remove_dai(dai);
return -ENOMEM;
}
+ snd_soc_dai_dma_data_set(dai, stream, ts);
}
return 0;