[PATCH 072/113] ASoC: codecs: cs*: use snd_pcm_is_playback/capture()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We can use snd_pcm_is_playback/capture(). Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
---
 sound/soc/codecs/cs35l35.c     | 2 +-
 sound/soc/codecs/cs35l36.c     | 2 +-
 sound/soc/codecs/cs35l41.c     | 2 +-
 sound/soc/codecs/cs35l45.c     | 2 +-
 sound/soc/codecs/cs35l56.c     | 4 ++--
 sound/soc/codecs/cs4234.c      | 4 ++--
 sound/soc/codecs/cs4265.c      | 2 +-
 sound/soc/codecs/cs4271.c      | 6 +++---
 sound/soc/codecs/cs42l42-sdw.c | 2 +-
 sound/soc/codecs/cs42l42.c     | 4 ++--
 sound/soc/codecs/cs42l43.c     | 2 +-
 sound/soc/codecs/cs42xx8.c     | 4 ++--
 12 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/sound/soc/codecs/cs35l35.c b/sound/soc/codecs/cs35l35.c
index 7a01b1d9fc9d7..133b38108ebfe 100644
--- a/sound/soc/codecs/cs35l35.c
+++ b/sound/soc/codecs/cs35l35.c
@@ -512,7 +512,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream,
 	 * You can pull more Monitor data from the SDOUT pin than going to SDIN
 	 * Just make sure your SCLK is fast enough to fill the frame
 	 */
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		switch (params_width(params)) {
 		case 8:
 			audin_format = CS35L35_SDIN_DEPTH_8;
diff --git a/sound/soc/codecs/cs35l36.c b/sound/soc/codecs/cs35l36.c
index cbea79bd89808..a3c49b5760c2e 100644
--- a/sound/soc/codecs/cs35l36.c
+++ b/sound/soc/codecs/cs35l36.c
@@ -891,7 +891,7 @@ static int cs35l36_pcm_hw_params(struct snd_pcm_substream *substream,
 		return -EINVAL;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		regmap_update_bits(cs35l36->regmap, CS35L36_ASP_FRAME_CTRL,
 				   CS35L36_ASP_RX_WIDTH_MASK,
 				   asp_width << CS35L36_ASP_RX_WIDTH_SHIFT);
diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c
index 1688c2c688f06..1ef19481c12d9 100644
--- a/sound/soc/codecs/cs35l41.c
+++ b/sound/soc/codecs/cs35l41.c
@@ -777,7 +777,7 @@ static int cs35l41_pcm_hw_params(struct snd_pcm_substream *substream,
 			   CS35L41_GLOBAL_FS_MASK,
 			   cs35l41_fs_rates[i].fs_cfg << CS35L41_GLOBAL_FS_SHIFT);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		regmap_update_bits(cs35l41->regmap, CS35L41_SP_FORMAT,
 				   CS35L41_ASP_WIDTH_RX_MASK,
 				   asp_wl << CS35L41_ASP_WIDTH_RX_SHIFT);
diff --git a/sound/soc/codecs/cs35l45.c b/sound/soc/codecs/cs35l45.c
index 2392c6effed85..114b4ffbfeede 100644
--- a/sound/soc/codecs/cs35l45.c
+++ b/sound/soc/codecs/cs35l45.c
@@ -741,7 +741,7 @@ static int cs35l45_asp_hw_params(struct snd_pcm_substream *substream,
 	else
 		asp_width = params_width(params);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		regmap_update_bits(cs35l45->regmap, CS35L45_ASP_CONTROL2,
 				   CS35L45_ASP_WIDTH_RX_MASK,
 				   asp_width << CS35L45_ASP_WIDTH_RX_SHIFT);
diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index 84c34f5b1a516..5ead5d568d05b 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -468,7 +468,7 @@ static int cs35l56_asp_dai_hw_params(struct snd_pcm_substream *substream,
 				   freq_id << CS35L56_ASP_BCLK_FREQ_SHIFT);
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		regmap_update_bits(cs35l56->base.regmap, CS35L56_ASP1_CONTROL2,
 				   CS35L56_ASP_RX_WIDTH_MASK, asp_width <<
 				   CS35L56_ASP_RX_WIDTH_SHIFT);
@@ -557,7 +557,7 @@ static int cs35l56_sdw_dai_hw_params(struct snd_pcm_substream *substream,
 	sconfig.frame_rate = params_rate(params);
 	sconfig.bps = snd_pcm_format_width(params_format(params));
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		sconfig.direction = SDW_DATA_DIR_RX;
 		pconfig.num = CS35L56_SDW1_PLAYBACK_PORT;
 		pconfig.ch_mask = cs35l56->rx_mask;
diff --git a/sound/soc/codecs/cs4234.c b/sound/soc/codecs/cs4234.c
index 69287ba7e9558..1095cce0ecff3 100644
--- a/sound/soc/codecs/cs4234.c
+++ b/sound/soc/codecs/cs4234.c
@@ -410,7 +410,7 @@ static int cs4234_dai_hw_params(struct snd_pcm_substream *sub,
 		dev_err(component->dev, "Unsupported sample width\n");
 		return -EINVAL;
 	}
-	if (sub->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(sub))
 		regmap_update_bits(cs4234->regmap, CS4234_SAMPLE_WIDTH,
 				   CS4234_SDOUTX_SW_MASK,
 				   sample_width << CS4234_SDOUTX_SW_SHIFT);
@@ -477,7 +477,7 @@ static int cs4234_dai_startup(struct snd_pcm_substream *sub, struct snd_soc_dai
 		 * Note: SNDRV_PCM_HW_PARAM_SAMPLE_BITS constrains the physical
 		 * width, which we don't care about, so constrain the format.
 		 */
-		if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(sub)) {
 			ret = snd_pcm_hw_constraint_mask64(
 						sub->runtime,
 						SNDRV_PCM_HW_PARAM_FORMAT,
diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c
index 78ffb7fa7fc5f..2a0121287b753 100644
--- a/sound/soc/codecs/cs4265.c
+++ b/sound/soc/codecs/cs4265.c
@@ -407,7 +407,7 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream,
 	struct cs4265_private *cs4265 = snd_soc_component_get_drvdata(component);
 	int index;
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
+	if (snd_pcm_is_capture(substream) &&
 		((cs4265->format & SND_SOC_DAIFMT_FORMAT_MASK)
 		== SND_SOC_DAIFMT_RIGHT_J))
 		return -EINVAL;
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index e864188ae5eb9..b31d06ddb463b 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -351,9 +351,9 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream,
 		 * registers every time.
 		 */
 
-		if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+		if ((snd_pcm_is_playback(substream) &&
 		     !snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_CAPTURE)) ||
-		    (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
+		    (snd_pcm_is_capture(substream) &&
 		     !snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_PLAYBACK))) {
 			ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2,
 						 CS4271_MODE2_PDN,
@@ -408,7 +408,7 @@ static int cs4271_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
 	int val_a = 0;
 	int val_b = 0;
 
-	if (stream != SNDRV_PCM_STREAM_PLAYBACK)
+	if (!snd_pcm_is_playback(stream))
 		return 0;
 
 	if (mute) {
diff --git a/sound/soc/codecs/cs42l42-sdw.c b/sound/soc/codecs/cs42l42-sdw.c
index 29891c1f6bece..92a110a841e13 100644
--- a/sound/soc/codecs/cs42l42-sdw.c
+++ b/sound/soc/codecs/cs42l42-sdw.c
@@ -78,7 +78,7 @@ static int cs42l42_sdw_dai_hw_params(struct snd_pcm_substream *substream,
 
 	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 = CS42L42_SDW_PLAYBACK_PORT;
 	else
 		port_config.num = CS42L42_SDW_CAPTURE_PORT;
diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
index 60d366e53526f..a06a0ed8ded49 100644
--- a/sound/soc/codecs/cs42l42.c
+++ b/sound/soc/codecs/cs42l42.c
@@ -1033,7 +1033,7 @@ int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
 
 	if (mute) {
 		/* Mute the headphone */
-		if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(stream))
 			snd_soc_component_update_bits(component, CS42L42_HP_CTL,
 						      CS42L42_HP_ANA_AMUTE_MASK |
 						      CS42L42_HP_ANA_BMUTE_MASK,
@@ -1106,7 +1106,7 @@ int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
 		}
 		cs42l42->stream_use |= 1 << stream;
 
-		if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(stream)) {
 			/* Un-mute the headphone */
 			snd_soc_component_update_bits(component, CS42L42_HP_CTL,
 						      CS42L42_HP_ANA_AMUTE_MASK |
diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c
index 92674314227c4..e2345e0cfdebc 100644
--- a/sound/soc/codecs/cs42l43.c
+++ b/sound/soc/codecs/cs42l43.c
@@ -426,7 +426,7 @@ static int cs42l43_asp_hw_params(struct snd_pcm_substream *substream,
 			   CS42L43_ASP_NUM_BCLKS_PER_FSYNC_MASK,
 			   frame << CS42L43_ASP_NUM_BCLKS_PER_FSYNC_SHIFT);
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	if (snd_pcm_is_capture(substream)) {
 		reg = CS42L43_ASP_TX_CH1_CTRL;
 		slots = priv->tx_slots;
 	} else {
diff --git a/sound/soc/codecs/cs42xx8.c b/sound/soc/codecs/cs42xx8.c
index 9c44b6283b8f9..7f619ee811836 100644
--- a/sound/soc/codecs/cs42xx8.c
+++ b/sound/soc/codecs/cs42xx8.c
@@ -262,7 +262,7 @@ static int cs42xx8_hw_params(struct snd_pcm_substream *substream,
 {
 	struct snd_soc_component *component = dai->component;
 	struct cs42xx8_priv *cs42xx8 = snd_soc_component_get_drvdata(component);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	u32 ratio[2];
 	u32 rate[2];
 	u32 fm[2];
@@ -350,7 +350,7 @@ static int cs42xx8_hw_free(struct snd_pcm_substream *substream,
 {
 	struct snd_soc_component *component = dai->component;
 	struct cs42xx8_priv *cs42xx8 = snd_soc_component_get_drvdata(component);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 
 	/* Clear stored rate */
 	cs42xx8->rate[tx] = 0;
-- 
2.43.0




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux