@@ -452,7 +452,7 @@ static int es8311_mute(struct snd_soc_dai *dai, int mute, int direction)
struct snd_soc_component *component = dai->component;
struct es8311_priv *es8311 = snd_soc_component_get_drvdata(component);
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
unsigned int mask = ES8311_DAC1_DAC_DSMMUTE |
ES8311_DAC1_DAC_DEMMUTE;
unsigned int val = mute ? mask : 0;
@@ -508,7 +508,7 @@ static int es8311_hw_params(struct snd_pcm_substream *substream,
}
unsigned int width = (unsigned int)par_width;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
snd_soc_component_update_bits(component, ES8311_SDP_IN,
ES8311_SDP_WL_MASK,
wl << ES8311_SDP_WL_SHIFT);
@@ -605,7 +605,7 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
unsigned int offset_l, offset_r;
if (mute) {
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_OFF);
regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
ES8326_MUTE_MASK, ES8326_MUTE);
@@ -627,7 +627,7 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
regmap_write(es8326->regmap, ES8326_HPR_OFFSET_INI, offset_r);
es8326->calibrated = true;
}
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x01);
usleep_range(1000, 5000);
regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00);
@@ -483,7 +483,7 @@ static int es8328_hw_params(struct snd_pcm_substream *substream,
int wl;
int ratio;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
reg = ES8328_DACCONTROL2;
else
reg = ES8328_ADCCONTROL5;
@@ -535,7 +535,7 @@ static int es8328_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
snd_soc_component_update_bits(component, ES8328_DACCONTROL1,
ES8328_DACCONTROL1_DACWL_MASK,
wl << ES8328_DACCONTROL1_DACWL_SHIFT);
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/es8311.c | 4 ++-- sound/soc/codecs/es8326.c | 4 ++-- sound/soc/codecs/es8328.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)