@@ -1749,7 +1749,7 @@ static int wm2200_hw_params(struct snd_pcm_substream *substream,
lrclk = bclk_rates[bclk] / params_rate(params);
dev_dbg(component->dev, "Setting %dHz LRCLK\n", bclk_rates[bclk] / lrclk);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
+ if (snd_pcm_is_playback(substream) ||
wm2200->symmetric_rates)
snd_soc_component_update_bits(component, WM2200_AUDIO_IF_1_7,
WM2200_AIF1RX_BCPF_MASK, lrclk);
@@ -1758,7 +1758,7 @@ static int wm2200_hw_params(struct snd_pcm_substream *substream,
WM2200_AIF1TX_BCPF_MASK, lrclk);
i = (wl << WM2200_AIF1TX_WL_SHIFT) | wl;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
snd_soc_component_update_bits(component, WM2200_AUDIO_IF_1_9,
WM2200_AIF1RX_WL_MASK |
WM2200_AIF1RX_SLOT_LEN_MASK, i);
@@ -1478,7 +1478,7 @@ static int wm5100_hw_params(struct snd_pcm_substream *substream,
lrclk = bclk_rates[bclk] / params_rate(params);
dev_dbg(component->dev, "Setting %dHz LRCLK\n", bclk_rates[bclk] / lrclk);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
+ if (snd_pcm_is_playback(substream) ||
wm5100->aif_symmetric[dai->id])
snd_soc_component_update_bits(component, base + 7,
WM5100_AIF1RX_BCPF_MASK, lrclk);
@@ -1487,7 +1487,7 @@ static int wm5100_hw_params(struct snd_pcm_substream *substream,
WM5100_AIF1TX_BCPF_MASK, lrclk);
i = (wl << WM5100_AIF1TX_WL_SHIFT) | fl;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
snd_soc_component_update_bits(component, base + 9,
WM5100_AIF1RX_WL_MASK |
WM5100_AIF1RX_SLOT_LEN_MASK, i);
@@ -931,7 +931,7 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream,
/* The sloping stopband filter is recommended for use with
* lower sample rates to improve performance.
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
if (params_rate(params) < 24000)
wm8350_set_bits(wm8350, WM8350_DAC_MUTE_VOLUME,
WM8350_DAC_SB_FILT);
@@ -576,7 +576,7 @@ static int wm8580_paif_hw_params(struct snd_pcm_substream *substream,
dev_dbg(component->dev, "Running at %dfs with %dHz clock\n",
wm8580_sysclk_ratios[i], wm8580->sysclk[dai->driver->id]);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (ratio) {
case 128:
case 192:
@@ -649,7 +649,7 @@ static int wm8900_hw_params(struct snd_pcm_substream *substream,
snd_soc_component_write(component, WM8900_REG_AUDIO1, reg);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
reg = snd_soc_component_read(component, WM8900_REG_DACCTRL);
if (params_rate(params) <= 24000)
@@ -408,7 +408,7 @@ static int wm8940_i2s_hw_params(struct snd_pcm_substream *substream,
return ret;
/* LoutR control */
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE
+ if (snd_pcm_is_capture(substream)
&& params_channels(params) == 2)
iface |= (1 << 9);
@@ -833,7 +833,7 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_component *component = dai->component;
struct wm8960_priv *wm8960 = snd_soc_component_get_drvdata(component);
u16 iface = snd_soc_component_read(component, WM8960_IFACE1) & 0xfff3;
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
int i;
wm8960->bclk = snd_soc_params_to_bclk(params);
@@ -891,7 +891,7 @@ static int wm8960_hw_free(struct snd_pcm_substream *substream,
{
struct snd_soc_component *component = dai->component;
struct wm8960_priv *wm8960 = snd_soc_component_get_drvdata(component);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
wm8960->is_stream_in_use[tx] = false;
@@ -531,12 +531,12 @@ static int wm8961_hw_params(struct snd_pcm_substream *substream,
/* Select a CLK_SYS/fs ratio equal to or higher than required */
target = wm8961->sysclk / fs;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && target < 64) {
+ if (snd_pcm_is_playback(substream) && target < 64) {
dev_err(component->dev,
"SYSCLK must be at least 64*fs for DAC\n");
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && target < 256) {
+ if (snd_pcm_is_capture(substream) && target < 256) {
dev_err(component->dev,
"SYSCLK must be at least 256*fs for ADC\n");
return -EINVAL;
@@ -2934,7 +2934,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream,
aif2_reg = WM8994_AIF1_CONTROL_2;
bclk_reg = WM8994_AIF1_BCLK;
rate_reg = WM8994_AIF1_RATE;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
+ if (snd_pcm_is_playback(substream) ||
wm8994->lrclk_shared[0]) {
lrclk_reg = WM8994_AIF1DAC_LRCLK;
} else {
@@ -2947,7 +2947,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream,
aif2_reg = WM8994_AIF2_CONTROL_2;
bclk_reg = WM8994_AIF2_BCLK;
rate_reg = WM8994_AIF2_RATE;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
+ if (snd_pcm_is_playback(substream) ||
wm8994->lrclk_shared[1]) {
lrclk_reg = WM8994_AIF2DAC_LRCLK;
} else {
@@ -3069,7 +3069,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream,
snd_soc_component_update_bits(component, rate_reg, WM8994_AIF1_SR_MASK |
WM8994_AIF1CLK_RATE_MASK, rate_val);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (dai->id) {
case 1:
wm8994->dac_rates[0] = params_rate(params);
@@ -1563,7 +1563,7 @@ static int wm8995_hw_params(struct snd_pcm_substream *substream,
aif1_reg = WM8995_AIF1_CONTROL_1;
bclk_reg = WM8995_AIF1_BCLK;
rate_reg = WM8995_AIF1_RATE;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK /* ||
+ if (snd_pcm_is_playback(substream) /* ||
wm8995->lrclk_shared[0] */) {
lrclk_reg = WM8995_AIF1DAC_LRCLK;
} else {
@@ -1575,7 +1575,7 @@ static int wm8995_hw_params(struct snd_pcm_substream *substream,
aif1_reg = WM8995_AIF2_CONTROL_1;
bclk_reg = WM8995_AIF2_BCLK;
rate_reg = WM8995_AIF2_RATE;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK /* ||
+ if (snd_pcm_is_playback(substream) /* ||
wm8995->lrclk_shared[1] */) {
lrclk_reg = WM8995_AIF2DAC_LRCLK;
} else {
@@ -1740,7 +1740,7 @@ static int wm8996_hw_params(struct snd_pcm_substream *substream,
switch (dai->id) {
case 0:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
+ if (snd_pcm_is_playback(substream) ||
(snd_soc_component_read(component, WM8996_GPIO_1)) & WM8996_GP1_FN_MASK) {
aifdata_reg = WM8996_AIF1RX_DATA_CONFIGURATION;
lrclk_reg = WM8996_AIF1_RX_LRCLK_1;
@@ -1751,7 +1751,7 @@ static int wm8996_hw_params(struct snd_pcm_substream *substream,
dsp_shift = 0;
break;
case 1:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
+ if (snd_pcm_is_playback(substream) ||
(snd_soc_component_read(component, WM8996_GPIO_2)) & WM8996_GP2_FN_MASK) {
aifdata_reg = WM8996_AIF2RX_DATA_CONFIGURATION;
lrclk_reg = WM8996_AIF2_RX_LRCLK_1;
@@ -236,7 +236,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream,
snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x1, 0x1);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
reg = AC97_PCM_FRONT_DAC_RATE;
else
reg = AC97_PCM_LR_ADC_RATE;
@@ -529,7 +529,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream,
snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x1, 0x1);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
reg = AC97_PCM_FRONT_DAC_RATE;
else
reg = AC97_PCM_LR_ADC_RATE;
@@ -546,7 +546,7 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream,
snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x1, 0x1);
snd_soc_component_update_bits(component, AC97_PCI_SID, 0x8000, 0x8000);
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return -ENODEV;
return snd_soc_component_write(component, AC97_PCM_SURR_DAC_RATE, runtime->rate);
@@ -1032,7 +1032,7 @@ static int ac97_hifi_prepare(struct snd_pcm_substream *substream,
snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x0001, 0x0001);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
reg = AC97_PCM_FRONT_DAC_RATE;
else
reg = AC97_PCM_LR_ADC_RATE;
@@ -1049,7 +1049,7 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream,
snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x0001, 0x0001);
snd_soc_component_update_bits(component, AC97_PCI_SID, 0x8000, 0x8000);
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return -ENODEV;
return snd_soc_component_write(component, AC97_PCM_SURR_DAC_RATE, runtime->rate);
We can use snd_pcm_is_playback/capture(). Let's use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> --- sound/soc/codecs/wm2200.c | 4 ++-- sound/soc/codecs/wm5100.c | 4 ++-- sound/soc/codecs/wm8350.c | 2 +- sound/soc/codecs/wm8580.c | 2 +- sound/soc/codecs/wm8900.c | 2 +- sound/soc/codecs/wm8940.c | 2 +- sound/soc/codecs/wm8960.c | 4 ++-- sound/soc/codecs/wm8961.c | 4 ++-- sound/soc/codecs/wm8994.c | 6 +++--- sound/soc/codecs/wm8995.c | 4 ++-- sound/soc/codecs/wm8996.c | 4 ++-- sound/soc/codecs/wm9705.c | 2 +- sound/soc/codecs/wm9712.c | 4 ++-- sound/soc/codecs/wm9713.c | 4 ++-- 14 files changed, 24 insertions(+), 24 deletions(-)