@@ -593,7 +593,7 @@ static int rt1017_sdca_pcm_hw_params(struct snd_pcm_substream *substream,
/* SoundWire specific configuration */
/* port 1 for playback */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
direction = SDW_DATA_DIR_RX;
port = 1;
} else {
@@ -550,7 +550,7 @@ static int rt1308_sdw_hw_params(struct snd_pcm_substream *substream,
snd_sdw_params_to_config(substream, params, &stream_config, &port_config);
/* port 1 for playback */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
port_config.num = 1;
else
return -EINVAL;
@@ -529,7 +529,7 @@ static int rt1316_sdw_hw_params(struct snd_pcm_substream *substream,
snd_sdw_params_to_config(substream, params, &stream_config, &port_config);
/* port 1 for playback */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
port_config.num = 1;
else
port_config.num = 2;
@@ -584,7 +584,7 @@ static int rt1318_sdw_hw_params(struct snd_pcm_substream *substream,
/* SoundWire specific configuration */
/* port 1 for playback */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
direction = SDW_DATA_DIR_RX;
port = 1;
} else {
@@ -1967,7 +1967,7 @@ static int rt1320_sdw_hw_params(struct snd_pcm_substream *substream,
/* SoundWire specific configuration */
snd_sdw_params_to_config(substream, params, &stream_config, &port_config);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
if (dai->id == RT1320_AIF1)
port_config.num = 1;
else
@@ -124,7 +124,7 @@ static int rt5682_sdw_hw_params(struct snd_pcm_substream *substream,
/* SoundWire specific configuration */
snd_sdw_params_to_config(substream, params, &stream_config, &port_config);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
port_config.num = 1;
else
port_config.num = 2;
@@ -204,7 +204,7 @@ static int rt5682_sdw_hw_params(struct snd_pcm_substream *substream,
osr_c = RT5682_ADC_OSR_D_2;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
regmap_update_bits(rt5682->regmap, RT5682_SDW_REF_CLK,
RT5682_SDW_REF_1_MASK, val_p);
regmap_update_bits(rt5682->regmap, RT5682_ADDA_CLK_1,
@@ -918,7 +918,7 @@ static int rt700_pcm_hw_params(struct snd_pcm_substream *substream,
snd_sdw_params_to_config(substream, params, &stream_config, &port_config);
/* This code assumes port 1 for playback and port 2 for capture */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
port_config.num = 1;
else
port_config.num = 2;
@@ -1351,7 +1351,7 @@ static int rt711_sdca_pcm_hw_params(struct snd_pcm_substream *substream,
/* SoundWire specific configuration */
snd_sdw_params_to_config(substream, params, &stream_config, &port_config);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
port_config.num = 3;
} else {
if (dai->id == RT711_AIF1)
@@ -1006,7 +1006,7 @@ static int rt711_pcm_hw_params(struct snd_pcm_substream *substream,
/* SoundWire specific configuration */
snd_sdw_params_to_config(substream, params, &stream_config, &port_config);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
port_config.num = 3;
} else {
if (dai->id == RT711_AIF1)
@@ -1437,7 +1437,7 @@ static int rt712_sdca_pcm_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
/* SoundWire specific configuration */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
direction = SDW_DATA_DIR_RX;
if (dai->id == RT712_AIF1)
port = 1;
@@ -1183,7 +1183,7 @@ static int rt722_sdca_pcm_hw_params(struct snd_pcm_substream *substream,
* RT722_AIF2 with port = 3 for speaker playback
* RT722_AIF3 with port = 6 for digital-mic capture
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
direction = SDW_DATA_DIR_RX;
if (dai->id == RT722_AIF1)
port = 1;
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/rt1017-sdca-sdw.c | 2 +- sound/soc/codecs/rt1308-sdw.c | 2 +- sound/soc/codecs/rt1316-sdw.c | 2 +- sound/soc/codecs/rt1318-sdw.c | 2 +- sound/soc/codecs/rt1320-sdw.c | 2 +- sound/soc/codecs/rt5682-sdw.c | 4 ++-- sound/soc/codecs/rt700.c | 2 +- sound/soc/codecs/rt711-sdca.c | 2 +- sound/soc/codecs/rt711.c | 2 +- sound/soc/codecs/rt712-sdca.c | 2 +- sound/soc/codecs/rt722-sdca.c | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-)