Commit 5e518edd authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: codecs: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87wo5e58j4.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 90a61a54
...@@ -725,7 +725,7 @@ static int adav80x_dai_startup(struct snd_pcm_substream *substream, ...@@ -725,7 +725,7 @@ static int adav80x_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_component *component = dai->component; struct snd_soc_component *component = dai->component;
struct adav80x *adav80x = snd_soc_component_get_drvdata(component); struct adav80x *adav80x = snd_soc_component_get_drvdata(component);
if (!snd_soc_component_is_active(component) || !adav80x->rate) if (!snd_soc_component_active(component) || !adav80x->rate)
return 0; return 0;
return snd_pcm_hw_constraint_single(substream->runtime, return snd_pcm_hw_constraint_single(substream->runtime,
...@@ -738,7 +738,7 @@ static void adav80x_dai_shutdown(struct snd_pcm_substream *substream, ...@@ -738,7 +738,7 @@ static void adav80x_dai_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_component *component = dai->component; struct snd_soc_component *component = dai->component;
struct adav80x *adav80x = snd_soc_component_get_drvdata(component); struct adav80x *adav80x = snd_soc_component_get_drvdata(component);
if (!snd_soc_component_is_active(component)) if (!snd_soc_component_active(component))
adav80x->rate = 0; adav80x->rate = 0;
} }
......
...@@ -1926,7 +1926,7 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai, ...@@ -1926,7 +1926,7 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai,
if (clk_id == dai_priv->clk) if (clk_id == dai_priv->clk)
return 0; return 0;
if (dai->active) { if (snd_soc_dai_active(dai)) {
dev_err(component->dev, "Can't change clock on active DAI %d\n", dev_err(component->dev, "Can't change clock on active DAI %d\n",
dai->id); dai->id);
return -EBUSY; return -EBUSY;
......
...@@ -356,9 +356,9 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream, ...@@ -356,9 +356,9 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream,
*/ */
if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK && if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
!dai->stream_active[SNDRV_PCM_STREAM_CAPTURE]) || !snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_CAPTURE)) ||
(substream->stream == SNDRV_PCM_STREAM_CAPTURE && (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
!dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK])) { !snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_PLAYBACK))) {
ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2,
CS4271_MODE2_PDN, CS4271_MODE2_PDN,
CS4271_MODE2_PDN); CS4271_MODE2_PDN);
......
...@@ -3279,7 +3279,7 @@ static int madera_dai_set_sysclk(struct snd_soc_dai *dai, ...@@ -3279,7 +3279,7 @@ static int madera_dai_set_sysclk(struct snd_soc_dai *dai,
if (is_sync == madera_is_syncclk(dai_priv->clk)) if (is_sync == madera_is_syncclk(dai_priv->clk))
return 0; return 0;
if (dai->active) { if (snd_soc_dai_active(dai)) {
dev_err(component->dev, "Can't change clock on active DAI %d\n", dev_err(component->dev, "Can't change clock on active DAI %d\n",
dai->id); dai->id);
return -EBUSY; return -EBUSY;
......
...@@ -2039,7 +2039,7 @@ static int max98090_dai_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -2039,7 +2039,7 @@ static int max98090_dai_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
if (!max98090->master && dai->active == 1) if (!max98090->master && snd_soc_dai_active(dai) == 1)
queue_delayed_work(system_power_efficient_wq, queue_delayed_work(system_power_efficient_wq,
&max98090->pll_det_enable_work, &max98090->pll_det_enable_work,
msecs_to_jiffies(10)); msecs_to_jiffies(10));
...@@ -2047,7 +2047,7 @@ static int max98090_dai_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -2047,7 +2047,7 @@ static int max98090_dai_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
if (!max98090->master && dai->active == 1) if (!max98090->master && snd_soc_dai_active(dai) == 1)
schedule_work(&max98090->pll_det_disable_work); schedule_work(&max98090->pll_det_disable_work);
break; break;
default: default:
...@@ -2109,7 +2109,7 @@ static void max98090_pll_work(struct max98090_priv *max98090) ...@@ -2109,7 +2109,7 @@ static void max98090_pll_work(struct max98090_priv *max98090)
unsigned int pll; unsigned int pll;
int i; int i;
if (!snd_soc_component_is_active(component)) if (!snd_soc_component_active(component))
return; return;
dev_info_ratelimited(component->dev, "PLL unlocked\n"); dev_info_ratelimited(component->dev, "PLL unlocked\n");
......
...@@ -394,7 +394,7 @@ static void tlv320aic23_shutdown(struct snd_pcm_substream *substream, ...@@ -394,7 +394,7 @@ static void tlv320aic23_shutdown(struct snd_pcm_substream *substream,
struct aic23 *aic23 = snd_soc_component_get_drvdata(component); struct aic23 *aic23 = snd_soc_component_get_drvdata(component);
/* deactivate */ /* deactivate */
if (!snd_soc_component_is_active(component)) { if (!snd_soc_component_active(component)) {
udelay(50); udelay(50);
snd_soc_component_write(component, TLV320AIC23_ACTIVE, 0x0); snd_soc_component_write(component, TLV320AIC23_ACTIVE, 0x0);
} }
......
...@@ -449,7 +449,7 @@ static int dac33_set_fifo_mode(struct snd_kcontrol *kcontrol, ...@@ -449,7 +449,7 @@ static int dac33_set_fifo_mode(struct snd_kcontrol *kcontrol,
if (dac33->fifo_mode == ucontrol->value.enumerated.item[0]) if (dac33->fifo_mode == ucontrol->value.enumerated.item[0])
return 0; return 0;
/* Do not allow changes while stream is running*/ /* Do not allow changes while stream is running*/
if (snd_soc_component_is_active(component)) if (snd_soc_component_active(component))
return -EPERM; return -EPERM;
if (ucontrol->value.enumerated.item[0] >= DAC33_FIFO_LAST_MODE) if (ucontrol->value.enumerated.item[0] >= DAC33_FIFO_LAST_MODE)
......
...@@ -110,7 +110,7 @@ static int uda1380_write(struct snd_soc_component *component, unsigned int reg, ...@@ -110,7 +110,7 @@ static int uda1380_write(struct snd_soc_component *component, unsigned int reg,
/* the interpolator & decimator regs must only be written when the /* the interpolator & decimator regs must only be written when the
* codec DAI is active. * codec DAI is active.
*/ */
if (!snd_soc_component_is_active(component) && (reg >= UDA1380_MVOL)) if (!snd_soc_component_active(component) && (reg >= UDA1380_MVOL))
return 0; return 0;
pr_debug("uda1380: hw write %x val %x\n", reg, value); pr_debug("uda1380: hw write %x val %x\n", reg, value);
if (i2c_master_send(uda1380->i2c, data, 3) == 3) { if (i2c_master_send(uda1380->i2c, data, 3) == 3) {
......
...@@ -183,7 +183,7 @@ static int snd_wl1273_set_audio_route(struct snd_kcontrol *kcontrol, ...@@ -183,7 +183,7 @@ static int snd_wl1273_set_audio_route(struct snd_kcontrol *kcontrol,
return 0; return 0;
/* Do not allow changes while stream is running */ /* Do not allow changes while stream is running */
if (snd_soc_component_is_active(component)) if (snd_soc_component_active(component))
return -EPERM; return -EPERM;
if (ucontrol->value.enumerated.item[0] >= ARRAY_SIZE(wl1273_audio_route)) if (ucontrol->value.enumerated.item[0] >= ARRAY_SIZE(wl1273_audio_route))
......
...@@ -198,7 +198,7 @@ static void wm8711_shutdown(struct snd_pcm_substream *substream, ...@@ -198,7 +198,7 @@ static void wm8711_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_component *component = dai->component; struct snd_soc_component *component = dai->component;
/* deactivate */ /* deactivate */
if (!snd_soc_component_is_active(component)) { if (!snd_soc_component_active(component)) {
udelay(50); udelay(50);
snd_soc_component_write(component, WM8711_ACTIVE, 0x0); snd_soc_component_write(component, WM8711_ACTIVE, 0x0);
} }
......
...@@ -241,7 +241,7 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol, ...@@ -241,7 +241,7 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol,
if (wm8753->dai_func == ucontrol->value.enumerated.item[0]) if (wm8753->dai_func == ucontrol->value.enumerated.item[0])
return 0; return 0;
if (snd_soc_component_is_active(component)) if (snd_soc_component_active(component))
return -EBUSY; return -EBUSY;
ioctl = snd_soc_component_read32(component, WM8753_IOCTL); ioctl = snd_soc_component_read32(component, WM8753_IOCTL);
...@@ -1304,7 +1304,7 @@ static int wm8753_mute(struct snd_soc_dai *dai, int mute) ...@@ -1304,7 +1304,7 @@ static int wm8753_mute(struct snd_soc_dai *dai, int mute)
/* the digital mute covers the HiFi and Voice DAC's on the WM8753. /* the digital mute covers the HiFi and Voice DAC's on the WM8753.
* make sure we check if they are not both active when we mute */ * make sure we check if they are not both active when we mute */
if (mute && wm8753->dai_func == 1) { if (mute && wm8753->dai_func == 1) {
if (!snd_soc_component_is_active(component)) if (!snd_soc_component_active(component))
snd_soc_component_write(component, WM8753_DAC, mute_reg | 0x8); snd_soc_component_write(component, WM8753_DAC, mute_reg | 0x8);
} else { } else {
if (mute) if (mute)
......
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