* [PATCH 001/113] ALSA: add snd_pcm_is_playback/capture() macro
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
@ 2024-08-05 0:33 ` Kuninori Morimoto
2024-08-05 0:34 ` [PATCH 002/113] slimbus: stream: use snd_pcm_is_playback/capture() Kuninori Morimoto
` (113 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:33 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
Many drivers are using below code to know the direction.
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
Add snd_pcm_is_playback/capture() macro to handle it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
include/sound/pcm.h | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index ac8f3aef92052..69e535aeb8e82 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -502,6 +502,35 @@ struct snd_pcm_substream {
#define SUBSTREAM_BUSY(substream) ((substream)->ref_count > 0)
+static inline int snd_pcm_direction_is_playback(const int stream)
+{
+ return stream == SNDRV_PCM_STREAM_PLAYBACK;
+}
+
+static inline int snd_pcm_direction_is_capture(const int stream)
+{
+ return stream == SNDRV_PCM_STREAM_CAPTURE;
+}
+
+static inline int snd_pcm_substream_is_playback(const struct snd_pcm_substream *substream)
+{
+ return snd_pcm_direction_is_playback(substream->stream);
+}
+
+static inline int snd_pcm_substream_is_capture(const struct snd_pcm_substream *substream)
+{
+ return snd_pcm_direction_is_capture(substream->stream);
+}
+
+#define snd_pcm_is_playback(x) _Generic((x), \
+ struct snd_pcm_substream *: snd_pcm_substream_is_playback, \
+ const struct snd_pcm_substream *: snd_pcm_substream_is_playback, \
+ default : snd_pcm_direction_is_playback)(x)
+
+#define snd_pcm_is_capture(x) _Generic((x), \
+ struct snd_pcm_substream *: snd_pcm_substream_is_capture, \
+ const struct snd_pcm_substream *: snd_pcm_substream_is_capture, \
+ default : snd_pcm_direction_is_capture)(x)
struct snd_pcm_str {
int stream; /* stream (direction) */
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 002/113] slimbus: stream: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
2024-08-05 0:33 ` [PATCH 001/113] " Kuninori Morimoto
@ 2024-08-05 0:34 ` Kuninori Morimoto
2024-08-05 0:34 ` [PATCH 003/113] staging: greybus: " Kuninori Morimoto
` (112 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:34 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/slimbus/stream.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/slimbus/stream.c b/drivers/slimbus/stream.c
index 863ab3075d7eb..e65a6bda2f5ba 100644
--- a/drivers/slimbus/stream.c
+++ b/drivers/slimbus/stream.c
@@ -6,6 +6,7 @@
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/slimbus.h>
+#include <sound/pcm.h>
#include <uapi/sound/asound.h>
#include "slimbus.h"
@@ -235,7 +236,7 @@ int slim_stream_prepare(struct slim_stream_runtime *rt,
* data rate not exactly multiple of super frame,
* use PUSH/PULL protocol
*/
- if (cfg->direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(cfg->direction))
rt->prot = SLIM_PROTO_PUSH;
else
rt->prot = SLIM_PROTO_PULL;
@@ -256,7 +257,7 @@ int slim_stream_prepare(struct slim_stream_runtime *rt,
port->ch.aux_fmt = SLIM_CH_AUX_FMT_NOT_APPLICABLE;
port->ch.state = SLIM_CH_STATE_ALLOCATED;
- if (cfg->direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(cfg->direction))
port->direction = SLIM_PORT_SINK;
else
port->direction = SLIM_PORT_SOURCE;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 003/113] staging: greybus: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
2024-08-05 0:33 ` [PATCH 001/113] " Kuninori Morimoto
2024-08-05 0:34 ` [PATCH 002/113] slimbus: stream: use snd_pcm_is_playback/capture() Kuninori Morimoto
@ 2024-08-05 0:34 ` Kuninori Morimoto
2024-08-05 0:34 ` [PATCH 004/113] soundwire: amd: " Kuninori Morimoto
` (111 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:34 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/staging/greybus/audio_codec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index 2f05e761fb9ad..3042a486c0c51 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -478,7 +478,7 @@ static int gbcodec_hw_params(struct snd_pcm_substream *substream,
gb_pm_runtime_put_noidle(bundle);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
sig_bits = dai->driver->playback.sig_bits;
else
sig_bits = dai->driver->capture.sig_bits;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 004/113] soundwire: amd: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (2 preceding siblings ...)
2024-08-05 0:34 ` [PATCH 003/113] staging: greybus: " Kuninori Morimoto
@ 2024-08-05 0:34 ` Kuninori Morimoto
2024-08-05 0:34 ` [PATCH 005/113] soundwire: qcom: " Kuninori Morimoto
` (110 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:34 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/soundwire/amd_manager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c
index 0d01849c35861..6f9e075b49979 100644
--- a/drivers/soundwire/amd_manager.c
+++ b/drivers/soundwire/amd_manager.c
@@ -612,7 +612,7 @@ static int amd_sdw_hw_params(struct snd_pcm_substream *substream,
return -EIO;
ch = params_channels(params);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
dir = SDW_DATA_DIR_RX;
else
dir = SDW_DATA_DIR_TX;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 005/113] soundwire: qcom: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (3 preceding siblings ...)
2024-08-05 0:34 ` [PATCH 004/113] soundwire: amd: " Kuninori Morimoto
@ 2024-08-05 0:34 ` Kuninori Morimoto
2024-08-05 0:34 ` [PATCH 006/113] soundwire: intel: " Kuninori Morimoto
` (109 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:34 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/soundwire/qcom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index aed57002fd0e6..0b86ee6a4d77c 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1168,7 +1168,7 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
int maxport, pn, nports = 0, ret = 0;
unsigned int m_port;
- if (direction == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(direction))
sconfig.direction = SDW_DATA_DIR_TX;
else
sconfig.direction = SDW_DATA_DIR_RX;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 006/113] soundwire: intel: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (4 preceding siblings ...)
2024-08-05 0:34 ` [PATCH 005/113] soundwire: qcom: " Kuninori Morimoto
@ 2024-08-05 0:34 ` Kuninori Morimoto
2024-08-05 0:34 ` [PATCH 007/113] soundwire: stream: " Kuninori Morimoto
` (108 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:34 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/soundwire/intel.c | 4 ++--
drivers/soundwire/intel_ace2x.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index 421da0f86fad6..17bad341f2336 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -734,7 +734,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
return -EIO;
ch = params_channels(params);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
dir = SDW_DATA_DIR_RX;
else
dir = SDW_DATA_DIR_TX;
@@ -819,7 +819,7 @@ static int intel_prepare(struct snd_pcm_substream *substream,
/* configure stream */
ch = params_channels(hw_params);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
dir = SDW_DATA_DIR_RX;
else
dir = SDW_DATA_DIR_TX;
diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
index 781fe0aefa68f..b1cc9041ff917 100644
--- a/drivers/soundwire/intel_ace2x.c
+++ b/drivers/soundwire/intel_ace2x.c
@@ -319,7 +319,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
return -EIO;
ch = params_channels(params);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
dir = SDW_DATA_DIR_RX;
else
dir = SDW_DATA_DIR_TX;
@@ -407,7 +407,7 @@ static int intel_prepare(struct snd_pcm_substream *substream,
/* configure stream */
ch = params_channels(hw_params);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
dir = SDW_DATA_DIR_RX;
else
dir = SDW_DATA_DIR_TX;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 007/113] soundwire: stream: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (5 preceding siblings ...)
2024-08-05 0:34 ` [PATCH 006/113] soundwire: intel: " Kuninori Morimoto
@ 2024-08-05 0:34 ` Kuninori Morimoto
2024-08-05 0:35 ` [PATCH 008/113] usb: gadget: use for_each_pcm_streams() Kuninori Morimoto
` (107 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:34 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/soundwire/stream.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index 7aa4900dcf317..d471506327579 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -1781,7 +1781,7 @@ int sdw_startup_stream(void *sdw_substream)
char *name;
int ret;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
name = kasprintf(GFP_KERNEL, "%s-Playback", substream->name);
else
name = kasprintf(GFP_KERNEL, "%s-Capture", substream->name);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 008/113] usb: gadget: use for_each_pcm_streams()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (6 preceding siblings ...)
2024-08-05 0:34 ` [PATCH 007/113] soundwire: stream: " Kuninori Morimoto
@ 2024-08-05 0:35 ` Kuninori Morimoto
2024-08-05 0:35 ` [PATCH 009/113] usb: gadget: use snd_pcm_is_playback/capture() Kuninori Morimoto
` (106 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:35 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We have for_each_pcm_streams() macro, let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/usb/gadget/function/u_audio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
index 89af0feb75120..40093fa1093d3 100644
--- a/drivers/usb/gadget/function/u_audio.c
+++ b/drivers/usb/gadget/function/u_audio.c
@@ -1290,7 +1290,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name,
goto snd_fail;
}
- for (i = 0; i <= SNDRV_PCM_STREAM_LAST; i++) {
+ for_each_pcm_streams(i) {
struct uac_rtd_params *prm;
struct uac_fu_params *fu;
char ctrl_name[24];
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 009/113] usb: gadget: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (7 preceding siblings ...)
2024-08-05 0:35 ` [PATCH 008/113] usb: gadget: use for_each_pcm_streams() Kuninori Morimoto
@ 2024-08-05 0:35 ` Kuninori Morimoto
2024-08-05 0:35 ` [PATCH 010/113] ALSA: isa: " Kuninori Morimoto
` (105 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:35 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/usb/gadget/function/u_audio.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
index 40093fa1093d3..09fbae35aea25 100644
--- a/drivers/usb/gadget/function/u_audio.c
+++ b/drivers/usb/gadget/function/u_audio.c
@@ -190,7 +190,7 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
goto exit;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
/*
* For each IN packet, take the quotient of the current data
* rate and the endpoint's interval as the base packet size.
@@ -244,7 +244,7 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
/* Pack USB load in ALSA ring buffer */
pending = runtime->dma_bytes - hw_ptr;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
if (unlikely(pending < req->actual)) {
memcpy(req->buf, runtime->dma_area + hw_ptr, pending);
memcpy(req->buf + pending, runtime->dma_area,
@@ -322,7 +322,7 @@ static int uac_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
audio_dev = uac->audio_dev;
params = &audio_dev->params;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
prm = &uac->p_prm;
else
prm = &uac->c_prm;
@@ -344,7 +344,7 @@ static int uac_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
}
/* Clear buffer after Play stops */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && !prm->ss)
+ if (snd_pcm_is_playback(substream) && !prm->ss)
memset(prm->rbuf, 0, prm->max_psize * params->req_number);
return err;
@@ -355,7 +355,7 @@ static snd_pcm_uframes_t uac_pcm_pointer(struct snd_pcm_substream *substream)
struct snd_uac_chip *uac = snd_pcm_substream_chip(substream);
struct uac_rtd_params *prm;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
prm = &uac->p_prm;
else
prm = &uac->c_prm;
@@ -402,7 +402,7 @@ static int uac_pcm_open(struct snd_pcm_substream *substream)
runtime->hw = uac_pcm_hardware;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
runtime->hw.formats = uac_ssize_to_fmt(p_ssize);
runtime->hw.channels_min = num_channels(p_chmask);
prm = &uac->p_prm;
@@ -1299,7 +1299,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name,
if (!pcm->streams[i].substream_count)
continue;
- if (i == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(i)) {
prm = &uac->p_prm;
fu = ¶ms->p_fu;
direction = "Playback";
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 010/113] ALSA: isa: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (8 preceding siblings ...)
2024-08-05 0:35 ` [PATCH 009/113] usb: gadget: use snd_pcm_is_playback/capture() Kuninori Morimoto
@ 2024-08-05 0:35 ` Kuninori Morimoto
2024-08-05 0:35 ` [PATCH 011/113] ALSA: arm: " Kuninori Morimoto
` (104 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:35 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/isa/sb/sb16_main.c | 4 ++--
sound/isa/sb/sb8_main.c | 6 +++---
sound/isa/wss/wss_lib.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/isa/sb/sb16_main.c b/sound/isa/sb/sb16_main.c
index a9b87e159b2d1..7145dcb4417a5 100644
--- a/sound/isa/sb/sb16_main.c
+++ b/sound/isa/sb/sb16_main.c
@@ -216,7 +216,7 @@ static void snd_sb16_setup_rate(struct snd_sb *chip,
unsigned long flags;
spin_lock_irqsave(&chip->reg_lock, flags);
- if (chip->mode & (channel == SNDRV_PCM_STREAM_PLAYBACK ? SB_MODE_PLAYBACK_16 : SB_MODE_CAPTURE_16))
+ if (chip->mode & (snd_pcm_is_playback(channel) ? SB_MODE_PLAYBACK_16 : SB_MODE_CAPTURE_16))
snd_sb_ack_16bit(chip);
else
snd_sb_ack_8bit(chip);
@@ -860,7 +860,7 @@ int snd_sb16dsp_pcm(struct snd_sb *chip, int device)
const struct snd_pcm_ops *snd_sb16dsp_get_pcm_ops(int direction)
{
- return direction == SNDRV_PCM_STREAM_PLAYBACK ?
+ return snd_pcm_is_playback(direction) ?
&snd_sb16_playback_ops : &snd_sb16_capture_ops;
}
diff --git a/sound/isa/sb/sb8_main.c b/sound/isa/sb/sb8_main.c
index 2ed176a5a5743..dbb08e9e0f367 100644
--- a/sound/isa/sb/sb8_main.c
+++ b/sound/isa/sb/sb8_main.c
@@ -473,7 +473,7 @@ static int snd_sb8_open(struct snd_pcm_substream *substream)
}
chip->open |= SB_OPEN_PCM;
spin_unlock_irqrestore(&chip->open_lock, flags);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
chip->playback_substream = substream;
runtime->hw = snd_sb8_playback;
} else {
@@ -501,7 +501,7 @@ static int snd_sb8_open(struct snd_pcm_substream *substream)
SNDRV_PCM_HW_PARAM_RATE, -1);
break;
case SB_HW_201:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
runtime->hw.rate_max = 44100;
} else {
runtime->hw.rate_max = 15000;
@@ -532,7 +532,7 @@ static int snd_sb8_close(struct snd_pcm_substream *substream)
chip->capture_substream = NULL;
spin_lock_irqsave(&chip->open_lock, flags);
chip->open &= ~SB_OPEN_PCM;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
chip->mode &= ~SB_MODE_PLAYBACK;
else
chip->mode &= ~SB_MODE_CAPTURE;
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c
index 026061b55ee94..d3f1a80c3a574 100644
--- a/sound/isa/wss/wss_lib.c
+++ b/sound/isa/wss/wss_lib.c
@@ -2196,7 +2196,7 @@ EXPORT_SYMBOL(snd_wss_mixer);
const struct snd_pcm_ops *snd_wss_get_pcm_ops(int direction)
{
- return direction == SNDRV_PCM_STREAM_PLAYBACK ?
+ return snd_pcm_is_playback(direction) ?
&snd_wss_playback_ops : &snd_wss_capture_ops;
}
EXPORT_SYMBOL(snd_wss_get_pcm_ops);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 011/113] ALSA: arm: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (9 preceding siblings ...)
2024-08-05 0:35 ` [PATCH 010/113] ALSA: isa: " Kuninori Morimoto
@ 2024-08-05 0:35 ` Kuninori Morimoto
2024-08-05 0:35 ` [PATCH 012/113] ALSA: xen: " Kuninori Morimoto
` (103 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:35 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/arm/aaci.c | 4 ++--
sound/arm/pxa2xx-ac97.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index c3340b8ff3daf..5542c18cf2191 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -403,7 +403,7 @@ static int aaci_pcm_open(struct snd_pcm_substream *substream)
struct aaci_runtime *aacirun;
int ret = 0;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
aacirun = &aaci->playback;
} else {
aacirun = &aaci->capture;
@@ -415,7 +415,7 @@ static int aaci_pcm_open(struct snd_pcm_substream *substream)
runtime->hw.rates = aacirun->pcm->rates;
snd_pcm_limit_hw_rates(runtime);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
runtime->hw.channels_max = 6;
/* Add rule describing channel dependency. */
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index 4c367e73b2c9b..bce0c7ca4b707 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -71,7 +71,7 @@ static int pxa2xx_ac97_pcm_open(struct snd_pcm_substream *substream)
runtime->hw.channels_min = 2;
runtime->hw.channels_max = 2;
- i = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+ i = (snd_pcm_is_playback(substream)) ?
AC97_RATES_FRONT_DAC : AC97_RATES_ADC;
runtime->hw.rates = pxa2xx_ac97_ac97->rates[i];
snd_pcm_limit_hw_rates(runtime);
@@ -100,7 +100,7 @@ static int pxa2xx_ac97_pcm_close(struct snd_pcm_substream *substream)
static int pxa2xx_ac97_pcm_prepare(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
- int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+ int reg = snd_pcm_is_playback(substream) ?
AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE;
int ret;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 012/113] ALSA: xen: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (10 preceding siblings ...)
2024-08-05 0:35 ` [PATCH 011/113] ALSA: arm: " Kuninori Morimoto
@ 2024-08-05 0:35 ` Kuninori Morimoto
2024-08-05 0:35 ` [PATCH 013/113] ALSA: usb: " Kuninori Morimoto
` (102 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:35 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/xen/xen_snd_front_alsa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/xen/xen_snd_front_alsa.c b/sound/xen/xen_snd_front_alsa.c
index b229eb6f70571..0f4f849bd20b3 100644
--- a/sound/xen/xen_snd_front_alsa.c
+++ b/sound/xen/xen_snd_front_alsa.c
@@ -240,7 +240,7 @@ stream_get(struct snd_pcm_substream *substream)
snd_pcm_substream_chip(substream);
struct xen_snd_front_pcm_stream_info *stream;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
stream = &pcm_instance->streams_pb[substream->number];
else
stream = &pcm_instance->streams_cap[substream->number];
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 013/113] ALSA: usb: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (11 preceding siblings ...)
2024-08-05 0:35 ` [PATCH 012/113] ALSA: xen: " Kuninori Morimoto
@ 2024-08-05 0:35 ` Kuninori Morimoto
2024-08-05 0:35 ` [PATCH 014/113] ALSA: pci: hda: " Kuninori Morimoto
` (101 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:35 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/usb/6fire/pcm.c | 8 ++++----
sound/usb/caiaq/audio.c | 14 +++++++-------
sound/usb/hiface/pcm.c | 4 ++--
sound/usb/line6/pcm.c | 16 ++++++++--------
sound/usb/media.c | 2 +-
sound/usb/pcm.c | 20 ++++++++++----------
sound/usb/quirks.c | 6 +++---
sound/usb/stream.c | 6 +++---
sound/usb/usx2y/usbusx2yaudio.c | 2 +-
sound/usb/usx2y/usx2yhwdeppcm.c | 6 +++---
10 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index 32c39d8bd2e55..fa3dfceab11cc 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -119,9 +119,9 @@ static struct pcm_substream *usb6fire_pcm_get_substream(
{
struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub);
- if (alsa_sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(alsa_sub))
return &rt->playback;
- else if (alsa_sub->stream == SNDRV_PCM_STREAM_CAPTURE)
+ else if (snd_pcm_is_capture(alsa_sub))
return &rt->capture;
dev_err(&rt->chip->dev->dev, "error getting pcm substream slot.\n");
return NULL;
@@ -395,12 +395,12 @@ static int usb6fire_pcm_open(struct snd_pcm_substream *alsa_sub)
mutex_lock(&rt->stream_mutex);
alsa_rt->hw = pcm_hw;
- if (alsa_sub->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(alsa_sub)) {
if (rt->rate < ARRAY_SIZE(rates))
alsa_rt->hw.rates = rates_alsaid[rt->rate];
alsa_rt->hw.channels_max = OUT_N_CHANNELS;
sub = &rt->playback;
- } else if (alsa_sub->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ } else if (snd_pcm_is_capture(alsa_sub)) {
if (rt->rate < ARRAY_SIZE(rates))
alsa_rt->hw.rates = rates_alsaid[rt->rate];
alsa_rt->hw.channels_max = IN_N_CHANNELS;
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
index 4981753652a7f..6996c5e07095f 100644
--- a/sound/usb/caiaq/audio.c
+++ b/sound/usb/caiaq/audio.c
@@ -53,7 +53,7 @@ activate_substream(struct snd_usb_caiaqdev *cdev,
{
spin_lock(&cdev->spinlock);
- if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(sub))
cdev->sub_playback[sub->number] = sub;
else
cdev->sub_capture[sub->number] = sub;
@@ -68,7 +68,7 @@ deactivate_substream(struct snd_usb_caiaqdev *cdev,
unsigned long flags;
spin_lock_irqsave(&cdev->spinlock, flags);
- if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(sub))
cdev->sub_playback[sub->number] = NULL;
else
cdev->sub_capture[sub->number] = NULL;
@@ -192,7 +192,7 @@ static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream)
dev_dbg(dev, "%s(%p)\n", __func__, substream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
int out_pos;
switch (cdev->spec.data_alignment) {
@@ -305,7 +305,7 @@ snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub)
goto unlock;
}
- if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(sub))
ptr = bytes_to_frames(sub->runtime,
cdev->audio_out_buf_pos[index]);
else
@@ -339,7 +339,7 @@ static void check_for_elapsed_periods(struct snd_usb_caiaqdev *cdev,
continue;
pb = snd_pcm_lib_period_bytes(sub);
- cnt = (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+ cnt = snd_pcm_is_playback(sub) ?
&cdev->period_out_count[stream] :
&cdev->period_in_count[stream];
@@ -701,7 +701,7 @@ static struct urb **alloc_urbs(struct snd_usb_caiaqdev *cdev, int dir, int *ret)
struct usb_device *usb_dev = cdev->chip.dev;
unsigned int pipe;
- pipe = (dir == SNDRV_PCM_STREAM_PLAYBACK) ?
+ pipe = snd_pcm_is_playback(dir) ?
usb_sndisocpipe(usb_dev, ENDPOINT_PLAYBACK) :
usb_rcvisocpipe(usb_dev, ENDPOINT_CAPTURE);
@@ -741,7 +741,7 @@ static struct urb **alloc_urbs(struct snd_usb_caiaqdev *cdev, int dir, int *ret)
urbs[i]->context = &cdev->data_cb_info[i];
urbs[i]->interval = 1;
urbs[i]->number_of_packets = FRAMES_PER_URB;
- urbs[i]->complete = (dir == SNDRV_PCM_STREAM_CAPTURE) ?
+ urbs[i]->complete = snd_pcm_is_capture(dir) ?
read_completed : write_completed;
}
diff --git a/sound/usb/hiface/pcm.c b/sound/usb/hiface/pcm.c
index cf650fab54d7e..178f70fd64d51 100644
--- a/sound/usb/hiface/pcm.c
+++ b/sound/usb/hiface/pcm.c
@@ -172,7 +172,7 @@ static struct pcm_substream *hiface_pcm_get_substream(struct snd_pcm_substream
struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub);
struct device *device = &rt->chip->dev->dev;
- if (alsa_sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(alsa_sub))
return &rt->playback;
dev_err(device, "Error getting pcm substream slot.\n");
@@ -359,7 +359,7 @@ static int hiface_pcm_open(struct snd_pcm_substream *alsa_sub)
mutex_lock(&rt->stream_mutex);
alsa_rt->hw = pcm_hw;
- if (alsa_sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(alsa_sub))
sub = &rt->playback;
if (!sub) {
diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c
index 6a4af725aedd2..db1d93de327fd 100644
--- a/sound/usb/line6/pcm.c
+++ b/sound/usb/line6/pcm.c
@@ -137,7 +137,7 @@ static void line6_wait_clear_audio_urbs(struct snd_line6_pcm *line6pcm,
static inline struct line6_pcm_stream *
get_stream(struct snd_line6_pcm *line6pcm, int direction)
{
- return (direction == SNDRV_PCM_STREAM_PLAYBACK) ?
+ return (snd_pcm_is_playback(direction)) ?
&line6pcm->out : &line6pcm->in;
}
@@ -148,7 +148,7 @@ static int line6_buffer_acquire(struct snd_line6_pcm *line6pcm,
struct line6_pcm_stream *pstr, int direction, int type)
{
const int pkt_size =
- (direction == SNDRV_PCM_STREAM_PLAYBACK) ?
+ snd_pcm_is_playback(direction) ?
line6pcm->max_packet_size_out :
line6pcm->max_packet_size_in;
@@ -191,7 +191,7 @@ static int line6_stream_start(struct snd_line6_pcm *line6pcm, int direction,
!(pstr->active_urbs || pstr->unlink_urbs)) {
pstr->count = 0;
/* Submit all currently available URBs */
- if (direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(direction))
ret = line6_submit_audio_out_all_urbs(line6pcm);
else
ret = line6_submit_audio_in_all_urbs(line6pcm);
@@ -216,7 +216,7 @@ static void line6_stream_stop(struct snd_line6_pcm *line6pcm, int direction,
spin_unlock_irqrestore(&pstr->lock, flags);
line6_unlink_audio_urbs(line6pcm, pstr);
spin_lock_irqsave(&pstr->lock, flags);
- if (direction == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(direction)) {
line6pcm->prev_fbuf = NULL;
line6pcm->prev_fsize = 0;
}
@@ -240,7 +240,7 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd)
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
- if (s->stream == SNDRV_PCM_STREAM_CAPTURE &&
+ if (snd_pcm_is_capture(s) &&
(line6pcm->line6->properties->capabilities &
LINE6_CAP_IN_NEEDS_OUT)) {
err = line6_stream_start(line6pcm, SNDRV_PCM_STREAM_PLAYBACK,
@@ -256,7 +256,7 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd)
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
- if (s->stream == SNDRV_PCM_STREAM_CAPTURE &&
+ if (snd_pcm_is_capture(s) &&
(line6pcm->line6->properties->capabilities &
LINE6_CAP_IN_NEEDS_OUT)) {
line6_stream_stop(line6pcm, SNDRV_PCM_STREAM_PLAYBACK,
@@ -267,13 +267,13 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd)
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- if (s->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(s))
return -EINVAL;
set_bit(LINE6_FLAG_PAUSE_PLAYBACK, &line6pcm->flags);
break;
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- if (s->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(s))
return -EINVAL;
clear_bit(LINE6_FLAG_PAUSE_PLAYBACK, &line6pcm->flags);
break;
diff --git a/sound/usb/media.c b/sound/usb/media.c
index d48db6f3ae659..3870df7214e53 100644
--- a/sound/usb/media.c
+++ b/sound/usb/media.c
@@ -54,7 +54,7 @@ int snd_media_stream_init(struct snd_usb_substream *subs, struct snd_pcm *pcm,
return -ENOMEM;
mctl->media_dev = mdev;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
intf_type = MEDIA_INTF_T_ALSA_PCM_PLAYBACK;
mctl->media_entity.function = MEDIA_ENT_F_AUDIO_PLAYBACK;
mctl->media_pad.flags = MEDIA_PAD_FL_SOURCE;
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 08bf535ed1632..18a0b55e4159f 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -37,7 +37,7 @@ static snd_pcm_uframes_t snd_usb_pcm_delay(struct snd_usb_substream *subs,
int est_delay;
int queued;
- if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(subs->direction)) {
queued = bytes_to_frames(runtime, subs->inflight_bytes);
if (!queued)
return 0;
@@ -57,7 +57,7 @@ static snd_pcm_uframes_t snd_usb_pcm_delay(struct snd_usb_substream *subs,
some truncation for 44.1 but the estimate is good enough */
est_delay = frame_diff * runtime->rate / 1000;
- if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(subs->direction)) {
est_delay = queued - est_delay;
if (est_delay < 0)
est_delay = 0;
@@ -126,14 +126,14 @@ find_format(struct list_head *fmt_list_head, snd_pcm_format_t format,
*/
if (subs && attr != cur_attr) {
if ((attr == USB_ENDPOINT_SYNC_ASYNC &&
- subs->direction == SNDRV_PCM_STREAM_PLAYBACK) ||
+ snd_pcm_is_playback(subs->direction)) ||
(attr == USB_ENDPOINT_SYNC_ADAPTIVE &&
- subs->direction == SNDRV_PCM_STREAM_CAPTURE))
+ snd_pcm_is_capture(subs->direction)))
continue;
if ((cur_attr == USB_ENDPOINT_SYNC_ASYNC &&
- subs->direction == SNDRV_PCM_STREAM_PLAYBACK) ||
+ snd_pcm_is_playback(subs->direction)) ||
(cur_attr == USB_ENDPOINT_SYNC_ADAPTIVE &&
- subs->direction == SNDRV_PCM_STREAM_CAPTURE)) {
+ snd_pcm_is_capture(subs->direction))) {
found = fp;
cur_attr = attr;
continue;
@@ -616,7 +616,7 @@ static int lowlatency_playback_available(struct snd_pcm_runtime *runtime,
{
struct snd_usb_audio *chip = subs->stream->chip;
- if (subs->direction == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(subs->direction))
return false;
/* disabled via module option? */
if (!chip->lowlatency)
@@ -678,7 +678,7 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
runtime->delay = 0;
subs->lowlatency_playback = lowlatency_playback_available(runtime, subs);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(substream) &&
!subs->lowlatency_playback) {
ret = start_endpoints(subs);
/* if XRUN happens at starting streams (possibly with implicit
@@ -1212,7 +1212,7 @@ static int snd_usb_pcm_open(struct snd_pcm_substream *substream)
runtime->hw = snd_usb_hardware;
/* need an explicit sync to catch applptr update in low-latency mode */
- if (direction == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(direction) &&
as->chip->lowlatency)
runtime->hw.info |= SNDRV_PCM_INFO_SYNC_APPLPTR;
runtime->private_data = subs;
@@ -1770,7 +1770,7 @@ void snd_usb_set_pcm_ops(struct snd_pcm *pcm, int stream)
{
const struct snd_pcm_ops *ops;
- ops = stream == SNDRV_PCM_STREAM_PLAYBACK ?
+ ops = snd_pcm_is_playback(stream) ?
&snd_usb_playback_ops : &snd_usb_capture_ops;
snd_pcm_set_ops(pcm, stream, ops);
}
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index ea063a14cdd8f..b26d1aa12a698 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1685,7 +1685,7 @@ static void set_format_emu_quirk(struct snd_usb_substream *subs,
* sample rate shouldn't be changed
* by playback substream
*/
- if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(subs->direction)) {
if (subs->stream->substream[SNDRV_PCM_STREAM_CAPTURE].cur_audiofmt)
return;
}
@@ -2017,7 +2017,7 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip,
* although it's really not...
*/
fp->ep_attr &= ~USB_ENDPOINT_SYNCTYPE;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
fp->ep_attr |= USB_ENDPOINT_SYNC_ADAPTIVE;
else
fp->ep_attr |= USB_ENDPOINT_SYNC_SYNC;
@@ -2036,7 +2036,7 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip,
break;
case USB_ID(0x3511, 0x2b1e): /* Opencomm2 UC USB Bluetooth dongle */
/* mic works only when ep pitch control is not set */
- if (stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(stream))
fp->attributes &= ~UAC_EP_CS_ATTR_PITCH_CONTROL;
break;
}
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index e14c725acebf2..b4096a2b53210 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -524,8 +524,8 @@ static int __snd_usb_add_audio_stream(struct snd_usb_audio *chip,
as->chip = chip;
as->fmt_type = fp->fmt_type;
err = snd_pcm_new(chip->card, "USB Audio", chip->pcm_devs,
- stream == SNDRV_PCM_STREAM_PLAYBACK ? 1 : 0,
- stream == SNDRV_PCM_STREAM_PLAYBACK ? 0 : 1,
+ snd_pcm_is_playback(stream),
+ !snd_pcm_is_playback(stream),
&pcm);
if (err < 0) {
kfree(as);
@@ -1058,7 +1058,7 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,
audioformat_free(fp);
return NULL;
}
- pd->pd_id = (stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+ pd->pd_id = snd_pcm_is_playback(stream) ?
UAC3_BADD_PD_ID10 : UAC3_BADD_PD_ID11;
pd->pd_d1d0_rec = UAC3_BADD_PD_RECOVER_D1D0;
pd->pd_d2d0_rec = UAC3_BADD_PD_RECOVER_D2D0;
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index ca7888495a9f4..7026e6a8f023b 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -816,7 +816,7 @@ static int snd_usx2y_pcm_hw_free(struct snd_pcm_substream *substream)
mutex_lock(&subs->usx2y->pcm_mutex);
snd_printdd("snd_usx2y_hw_free(%p)\n", substream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
cap_subs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE];
atomic_set(&subs->state, STATE_STOPPED);
usx2y_urbs_release(subs);
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index 36f2e31168fb0..56111336d71f7 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -368,7 +368,7 @@ static int snd_usx2y_usbpcm_hw_free(struct snd_pcm_substream *substream)
snd_printdd("%s(%p)\n", __func__, substream);
cap_subs2 = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE + 2];
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
cap_subs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE];
atomic_set(&subs->state, STATE_STOPPED);
usx2y_usbpcm_urbs_release(subs);
@@ -414,7 +414,7 @@ static int usx2y_usbpcm_urbs_start(struct snd_usx2y_substream *subs)
struct urb *urb;
unsigned long pack;
- if (stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(stream)) {
usx2y->hwdep_pcm_shm->captured_iso_head = -1;
usx2y->hwdep_pcm_shm->captured_iso_frames = 0;
}
@@ -592,7 +592,7 @@ static int snd_usx2y_usbpcm_open(struct snd_pcm_substream *substream)
if (!(subs->usx2y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS))
return -EBUSY;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
runtime->hw = snd_usx2y_2c;
else
runtime->hw = (subs->usx2y->subs[3] ? snd_usx2y_4c : snd_usx2y_2c);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 014/113] ALSA: pci: hda: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (12 preceding siblings ...)
2024-08-05 0:35 ` [PATCH 013/113] ALSA: usb: " Kuninori Morimoto
@ 2024-08-05 0:35 ` Kuninori Morimoto
2024-08-05 0:35 ` [PATCH 015/113] ALSA: pci: ac97: " Kuninori Morimoto
` (100 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:35 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/hda/hda_controller.c | 6 +++---
sound/pci/hda/hda_intel.c | 6 +++---
sound/pci/hda/patch_si3054.c | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 5d86e5a9c814a..9efa43afd0c16 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -75,7 +75,7 @@ static u64 azx_adjust_codec_delay(struct snd_pcm_substream *substream,
codec_nsecs = div_u64(codec_frames * 1000000000LL,
substream->runtime->rate);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
return nsec + codec_nsecs;
return (nsec > codec_nsecs) ? nsec - codec_nsecs : 0;
@@ -385,7 +385,7 @@ static int azx_get_sync_time(ktime_t *device,
runtime = substream->runtime;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
direction = 1;
else
direction = 0;
@@ -659,7 +659,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
/* disable LINK_ATIME timestamps for capture streams
until we figure out how to handle digital inputs */
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
runtime->hw.info &= ~SNDRV_PCM_INFO_HAS_WALL_CLOCK; /* legacy */
runtime->hw.info &= ~SNDRV_PCM_INFO_HAS_LINK_ATIME;
}
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b79020adce63b..c9552b71c0e9d 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -583,7 +583,7 @@ static int azx_get_delay_from_lpib(struct azx *chip, struct azx_dev *azx_dev,
unsigned int lpib_pos = azx_get_pos_lpib(chip, azx_dev);
int delay;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
delay = pos - lpib_pos;
else
delay = lpib_pos - pos;
@@ -800,7 +800,7 @@ static unsigned int azx_via_get_position(struct azx *chip,
unsigned int fifo_size;
link_pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev));
- if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(azx_dev->core.substream)) {
/* Playback, no problem using link position */
return link_pos;
}
@@ -869,7 +869,7 @@ static unsigned int azx_get_pos_fifo(struct azx *chip, struct azx_dev *azx_dev)
}
/* correct the DMA position for capture stream */
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
if (pos < delay)
pos += azx_dev->core.bufsize;
pos -= delay;
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c
index 763eae80a148e..9f13732a89064 100644
--- a/sound/pci/hda/patch_si3054.c
+++ b/sound/pci/hda/patch_si3054.c
@@ -142,8 +142,8 @@ static int si3054_pcm_prepare(struct hda_pcm_stream *hinfo,
SET_REG(codec, SI3054_LINE_RATE, substream->runtime->rate);
val = GET_REG(codec, SI3054_LINE_LEVEL);
- val &= 0xff << (8 * (substream->stream != SNDRV_PCM_STREAM_PLAYBACK));
- val |= ((stream_tag & 0xf) << 4) << (8 * (substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
+ val &= 0xff << (8 * (!snd_pcm_is_playback(substream)));
+ val |= ((stream_tag & 0xf) << 4) << (8 * (snd_pcm_is_playback(substream)));
SET_REG(codec, SI3054_LINE_LEVEL, val);
snd_hda_codec_setup_stream(codec, hinfo->nid,
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 015/113] ALSA: pci: ac97: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (13 preceding siblings ...)
2024-08-05 0:35 ` [PATCH 014/113] ALSA: pci: hda: " Kuninori Morimoto
@ 2024-08-05 0:35 ` Kuninori Morimoto
2024-08-05 0:35 ` [PATCH 016/113] ALSA: pci: nm256: " Kuninori Morimoto
` (99 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:35 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/ac97/ac97_pcm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/ac97/ac97_pcm.c b/sound/pci/ac97/ac97_pcm.c
index 5fee8e89790fb..0d29676a8ecfa 100644
--- a/sound/pci/ac97/ac97_pcm.c
+++ b/sound/pci/ac97/ac97_pcm.c
@@ -150,7 +150,7 @@ static unsigned char get_slot_reg(struct ac97_pcm *pcm, unsigned short cidx,
return 0xff;
if (pcm->spdif)
return AC97_SPDIF; /* pseudo register */
- if (pcm->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(pcm->stream))
return rate_reg_tables[dbl][pcm->r[dbl].rate_table[cidx]][slot - 3];
else
return rate_cregs[slot - 3];
@@ -512,7 +512,7 @@ int snd_ac97_pcm_assign(struct snd_ac97_bus *bus,
rpcm->rates &= rates;
}
/* for double rate, we check the first codec only */
- if (pcm->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(pcm->stream) &&
bus->codec[0] && (bus->codec[0]->flags & AC97_DOUBLE_RATE) &&
rate_table[pcm->stream][0] == 0) {
tmp = (1<<AC97_SLOT_PCM_LEFT) | (1<<AC97_SLOT_PCM_RIGHT) |
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 016/113] ALSA: pci: nm256: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (14 preceding siblings ...)
2024-08-05 0:35 ` [PATCH 015/113] ALSA: pci: ac97: " Kuninori Morimoto
@ 2024-08-05 0:35 ` Kuninori Morimoto
2024-08-05 0:35 ` [PATCH 017/113] ALSA: pci: pcxhr: " Kuninori Morimoto
` (98 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:35 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/nm256/nm256.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 11ba7d4eac2a4..4ad3734796ed6 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -332,7 +332,7 @@ snd_nm256_load_one_coefficient(struct nm256 *chip, int stream, u32 port, int whi
snd_nm256_write_buffer(chip, coefficients + offset, coeff_buf, size);
snd_nm256_writel(chip, port, coeff_buf);
/* ??? Record seems to behave differently than playback. */
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
size--;
snd_nm256_writel(chip, port + 4, coeff_buf + size);
}
@@ -341,11 +341,11 @@ static void
snd_nm256_load_coefficient(struct nm256 *chip, int stream, int number)
{
/* The enable register for the specified engine. */
- u32 poffset = (stream == SNDRV_PCM_STREAM_CAPTURE ?
+ u32 poffset = (snd_pcm_is_capture(stream) ?
NM_RECORD_ENABLE_REG : NM_PLAYBACK_ENABLE_REG);
u32 addr = NM_COEFF_START_OFFSET;
- addr += (stream == SNDRV_PCM_STREAM_CAPTURE ?
+ addr += (snd_pcm_is_capture(stream) ?
NM_RECORD_REG_OFFSET : NM_PLAYBACK_REG_OFFSET);
if (snd_nm256_readb(chip, poffset) & 1) {
@@ -356,7 +356,7 @@ snd_nm256_load_coefficient(struct nm256 *chip, int stream, int number)
/* The recording engine uses coefficient values 8-15. */
number &= 7;
- if (stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(stream))
number += 8;
if (! chip->use_cache) {
@@ -372,7 +372,7 @@ snd_nm256_load_coefficient(struct nm256 *chip, int stream, int number)
u32 offset = snd_nm256_get_start_offset(number);
u32 end_offset = offset + coefficient_sizes[number];
snd_nm256_writel(chip, addr, base + offset);
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
end_offset--;
snd_nm256_writel(chip, addr + 4, base + end_offset);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 017/113] ALSA: pci: pcxhr: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (15 preceding siblings ...)
2024-08-05 0:35 ` [PATCH 016/113] ALSA: pci: nm256: " Kuninori Morimoto
@ 2024-08-05 0:35 ` Kuninori Morimoto
2024-08-05 0:36 ` [PATCH 018/113] ALSA: pci: asihpi: " Kuninori Morimoto
` (97 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:35 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/pcxhr/pcxhr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index 242bd7e04b3e1..2de8ccb33d17e 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -626,7 +626,7 @@ static int pcxhr_update_r_buffer(struct pcxhr_stream *stream)
struct snd_pcm_substream *subs = stream->substream;
struct snd_pcxhr *chip = snd_pcm_substream_chip(subs);
- is_capture = (subs->stream == SNDRV_PCM_STREAM_CAPTURE);
+ is_capture = snd_pcm_is_capture(subs);
stream_num = is_capture ? 0 : subs->number;
dev_dbg(chip->card->dev,
@@ -995,7 +995,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs)
/* copy the struct snd_pcm_hardware struct */
runtime->hw = pcxhr_caps;
- if( subs->stream == SNDRV_PCM_STREAM_PLAYBACK ) {
+ if(snd_pcm_is_playback(subs)) {
dev_dbg(chip->card->dev, "%s playback chip%d subs%d\n",
__func__, chip->chip_idx, subs->number);
stream = &chip->playback_stream[subs->number];
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 018/113] ALSA: pci: asihpi: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (16 preceding siblings ...)
2024-08-05 0:35 ` [PATCH 017/113] ALSA: pci: pcxhr: " Kuninori Morimoto
@ 2024-08-05 0:36 ` Kuninori Morimoto
2024-08-05 0:36 ` [PATCH 019/113] ALSA: pci: au88x0: " Kuninori Morimoto
` (96 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:36 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/asihpi/asihpi.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index 001786e2aba13..69eb696012933 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -447,7 +447,7 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream,
params_channels(params),
format, params_rate(params), 0, 0));
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
if (hpi_instream_reset(dpcm->h_stream) != 0)
return -EINVAL;
@@ -582,7 +582,7 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
continue;
ds->drained_count = 0;
- if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(s)) {
/* How do I know how much valid data is present
* in buffer? Must be at least one period!
* Guessing 2 periods, but if
@@ -615,7 +615,7 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
}
/* start the master stream */
card->pcm_start(substream);
- if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE) ||
+ if (snd_pcm_is_capture(substream) ||
!card->can_dma)
hpi_handle_error(hpi_stream_start(dpcm->h_stream));
break;
@@ -643,7 +643,7 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
/* _prepare and _hwparams reset the stream */
hpi_handle_error(hpi_stream_stop(dpcm->h_stream));
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
hpi_handle_error(
hpi_outstream_reset(dpcm->h_stream));
@@ -755,7 +755,7 @@ static void snd_card_asihpi_timer_function(struct timer_list *t)
if (!card->can_dma)
on_card_bytes = bytes_avail;
- if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(s)) {
pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail;
if (state == HPI_STATE_STOPPED) {
if (bytes_avail == 0) {
@@ -837,7 +837,7 @@ static void snd_card_asihpi_timer_function(struct timer_list *t)
if (xfercount &&
/* Limit use of on card fifo for playback */
((on_card_bytes <= ds->period_bytes) ||
- (s->stream == SNDRV_PCM_STREAM_CAPTURE)))
+ (snd_pcm_is_capture(s))))
{
@@ -853,7 +853,7 @@ static void snd_card_asihpi_timer_function(struct timer_list *t)
xfer2 = xfercount - xfer1;
}
- if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(s)) {
snd_printddd("write1, P=%d, xfer=%d, buf_ofs=%d\n",
s->number, xfer1, buf_ofs);
hpi_handle_error(
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 019/113] ALSA: pci: au88x0: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (17 preceding siblings ...)
2024-08-05 0:36 ` [PATCH 018/113] ALSA: pci: asihpi: " Kuninori Morimoto
@ 2024-08-05 0:36 ` Kuninori Morimoto
2024-08-05 0:36 ` [PATCH 020/113] ALSA: pci: ca0106: " Kuninori Morimoto
` (95 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:36 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/au88x0/au88x0_core.c | 2 +-
sound/pci/au88x0/au88x0_pcm.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c
index e5d8676373368..192b5fe0d54d7 100644
--- a/sound/pci/au88x0/au88x0_core.c
+++ b/sound/pci/au88x0/au88x0_core.c
@@ -2132,7 +2132,7 @@ vortex_adb_allocroute(vortex_t *vortex, int dma, int nr_ch, int dir,
stream->type = type;
/* PLAYBACK ROUTES. */
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
int src[4], mix[4], ch_top;
#ifndef CHIP_AU8820
int a3d = 0;
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c
index 546f712206040..53000e486986c 100644
--- a/sound/pci/au88x0/au88x0_pcm.c
+++ b/sound/pci/au88x0/au88x0_pcm.c
@@ -167,7 +167,7 @@ static int snd_vortex_pcm_open(struct snd_pcm_substream *substream)
|| VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_I2S)
runtime->hw = snd_vortex_playback_hw_adb;
#ifdef CHIP_AU8830
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(substream) &&
VORTEX_IS_QUAD(vortex) &&
VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB) {
runtime->hw.channels_max = 4;
@@ -308,7 +308,7 @@ static int snd_vortex_pcm_prepare(struct snd_pcm_substream *substream)
int dma = stream->dma, fmt, dir;
// set up the hardware with the current configuration.
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dir = 1;
else
dir = 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 020/113] ALSA: pci: ca0106: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (18 preceding siblings ...)
2024-08-05 0:36 ` [PATCH 019/113] ALSA: pci: au88x0: " Kuninori Morimoto
@ 2024-08-05 0:36 ` Kuninori Morimoto
2024-08-05 0:36 ` [PATCH 021/113] ALSA: pci: mixart: " Kuninori Morimoto
` (94 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:36 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/ca0106/ca0106_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index cf1bac7a435f1..abee20e6dab39 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -943,7 +943,7 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream,
}
snd_pcm_group_for_each_entry(s, substream) {
if (snd_pcm_substream_chip(s) != emu ||
- s->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ !snd_pcm_is_playback(s))
continue;
runtime = s->runtime;
epcm = runtime->private_data;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 021/113] ALSA: pci: mixart: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (19 preceding siblings ...)
2024-08-05 0:36 ` [PATCH 020/113] ALSA: pci: ca0106: " Kuninori Morimoto
@ 2024-08-05 0:36 ` Kuninori Morimoto
2024-08-05 0:36 ` [PATCH 022/113] ALSA: pci: emu10k1: " Kuninori Morimoto
` (93 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:36 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/mixart/mixart.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 7ceaf6a7a77ea..ed4959c517d2d 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -391,7 +391,7 @@ static int mixart_set_stream_state(struct mixart_stream *stream, int start)
stream_state_req.stream_info.stream_desc.uid_pipe = stream->pipe->group_uid;
stream_state_req.stream_info.stream_desc.stream_idx = stream->substream->number;
- if (stream->substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream->substream))
request.message_id = start ? MSG_STREAM_START_INPUT_STAGE_PACKET : MSG_STREAM_STOP_INPUT_STAGE_PACKET;
else
request.message_id = start ? MSG_STREAM_START_OUTPUT_STAGE_PACKET : MSG_STREAM_STOP_OUTPUT_STAGE_PACKET;
@@ -608,7 +608,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,
/* update the stream levels */
if( stream->pcm_number <= MIXART_PCM_DIGITAL ) {
int is_aes = stream->pcm_number > MIXART_PCM_ANALOG;
- if( subs->stream == SNDRV_PCM_STREAM_PLAYBACK )
+ if(snd_pcm_is_playback(subs))
mixart_update_playback_stream_level(chip, is_aes, subs->number);
else
mixart_update_capture_stream_level( chip, is_aes);
@@ -626,7 +626,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,
if (subs->runtime->buffer_changed) {
struct mixart_bufferinfo *bufferinfo;
int i = (chip->chip_idx * MIXART_MAX_STREAM_PER_CARD) + (stream->pcm_number * (MIXART_PLAYBACK_STREAMS+MIXART_CAPTURE_STREAMS)) + subs->number;
- if( subs->stream == SNDRV_PCM_STREAM_CAPTURE ) {
+ if(snd_pcm_is_capture(subs)) {
i += MIXART_PLAYBACK_STREAMS; /* in array capture is behind playback */
}
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 022/113] ALSA: pci: emu10k1: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (20 preceding siblings ...)
2024-08-05 0:36 ` [PATCH 021/113] ALSA: pci: mixart: " Kuninori Morimoto
@ 2024-08-05 0:36 ` Kuninori Morimoto
2024-08-05 0:36 ` [PATCH 023/113] ALSA: pci: ice1712: " Kuninori Morimoto
` (92 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:36 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/emu10k1/p16v.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index a9a75891f1da4..b174b392b6aee 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -422,7 +422,7 @@ static int snd_p16v_pcm_trigger_playback(struct snd_pcm_substream *substream,
}
snd_pcm_group_for_each_entry(s, substream) {
if (snd_pcm_substream_chip(s) != emu ||
- s->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ !snd_pcm_is_playback(s))
continue;
runtime = s->runtime;
channel = substream->pcm->device-emu->p16v_device_offset;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 023/113] ALSA: pci: ice1712: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (21 preceding siblings ...)
2024-08-05 0:36 ` [PATCH 022/113] ALSA: pci: emu10k1: " Kuninori Morimoto
@ 2024-08-05 0:36 ` Kuninori Morimoto
2024-08-05 0:36 ` [PATCH 024/113] ALSA: pci: rme9652: " Kuninori Morimoto
` (91 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:36 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/ice1712/ice1712.c | 2 +-
sound/pci/ice1712/juli.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 3b0c3e70987b9..12f0cd9b8fbb1 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -907,7 +907,7 @@ static int snd_ice1712_pro_trigger(struct snd_pcm_substream *substream,
{
unsigned int what;
unsigned int old;
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return -EINVAL;
what = ICE1712_PLAYBACK_PAUSE;
snd_pcm_trigger_done(substream, substream);
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c
index d679842ae1bd7..b52426540c529 100644
--- a/sound/pci/ice1712/juli.c
+++ b/sound/pci/ice1712/juli.c
@@ -170,7 +170,7 @@ static void juli_spdif_in_open(struct snd_ice1712 *ice,
struct snd_pcm_runtime *runtime = substream->runtime;
int rate;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
+ if (snd_pcm_is_playback(substream) ||
!ice->is_spdif_master(ice))
return;
rate = snd_ak4114_external_rate(spec->ak4114);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 024/113] ALSA: pci: rme9652: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (22 preceding siblings ...)
2024-08-05 0:36 ` [PATCH 023/113] ALSA: pci: ice1712: " Kuninori Morimoto
@ 2024-08-05 0:36 ` Kuninori Morimoto
2024-08-05 0:36 ` [PATCH 025/113] ALSA: pci: korg1212: " Kuninori Morimoto
` (90 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:36 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/rme9652/hdsp.c | 14 +++++++-------
sound/pci/rme9652/hdspm.c | 23 +++++++++++------------
sound/pci/rme9652/rme9652.c | 14 +++++++-------
3 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index e7d1b43471a29..b99f32d24f7df 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -3953,7 +3953,7 @@ static signed char *hdsp_channel_buffer_location(struct hdsp *hdsp,
if (mapped_channel < 0)
return NULL;
- if (stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(stream))
return hdsp->capture_buffer + (mapped_channel * HDSP_CHANNEL_BUFFER_BYTES);
else
return hdsp->playback_buffer + (mapped_channel * HDSP_CHANNEL_BUFFER_BYTES);
@@ -4014,7 +4014,7 @@ static int snd_hdsp_reset(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct hdsp *hdsp = snd_pcm_substream_chip(substream);
struct snd_pcm_substream *other;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
other = hdsp->capture_substream;
else
other = hdsp->playback_substream;
@@ -4051,7 +4051,7 @@ static int snd_hdsp_hw_params(struct snd_pcm_substream *substream,
spin_lock_irq(&hdsp->lock);
- if (substream->pstr->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream->pstr->stream)) {
hdsp->control_register &= ~(HDSP_SPDIFProfessional | HDSP_SPDIFNonAudio | HDSP_SPDIFEmphasis);
hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register |= hdsp->creg_spdif_stream);
this_pid = hdsp->playback_pid;
@@ -4172,7 +4172,7 @@ static int snd_hdsp_trigger(struct snd_pcm_substream *substream, int cmd)
spin_unlock(&hdsp->lock);
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
other = hdsp->capture_substream;
else
other = hdsp->playback_substream;
@@ -4191,15 +4191,15 @@ static int snd_hdsp_trigger(struct snd_pcm_substream *substream, int cmd)
}
if (cmd == SNDRV_PCM_TRIGGER_START) {
if (!(running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) &&
- substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ snd_pcm_is_capture(substream))
hdsp_silence_playback(hdsp);
} else {
if (running &&
- substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ snd_pcm_is_playback(substream))
hdsp_silence_playback(hdsp);
}
} else {
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
hdsp_silence_playback(hdsp);
}
_ok:
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 56d335f0e1960..a85e09535636a 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -5465,7 +5465,7 @@ static int snd_hdspm_reset(struct snd_pcm_substream *substream)
struct hdspm *hdspm = snd_pcm_substream_chip(substream);
struct snd_pcm_substream *other;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
other = hdspm->capture_substream;
else
other = hdspm->playback_substream;
@@ -5499,7 +5499,7 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream,
spin_lock_irq(&hdspm->lock);
- if (substream->pstr->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream->pstr->stream)) {
this_pid = hdspm->playback_pid;
other_pid = hdspm->capture_pid;
} else {
@@ -5570,7 +5570,7 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream,
return err;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
for (i = 0; i < params_channels(params); ++i) {
int c = hdspm->channel_map_out[i];
@@ -5656,7 +5656,7 @@ static int snd_hdspm_hw_free(struct snd_pcm_substream *substream)
int i;
struct hdspm *hdspm = snd_pcm_substream_chip(substream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
/* Just disable all channels. The saving when disabling a */
/* smaller set is not worth the trouble. */
for (i = 0; i < HDSPM_MAX_CHANNELS; ++i)
@@ -5682,7 +5682,7 @@ static int snd_hdspm_channel_info(struct snd_pcm_substream *substream,
struct hdspm *hdspm = snd_pcm_substream_chip(substream);
unsigned int channel = info->channel;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
if (snd_BUG_ON(channel >= hdspm->max_channels_out)) {
dev_info(hdspm->card->dev,
"snd_hdspm_channel_info: output channel out of range (%d)\n",
@@ -5765,7 +5765,7 @@ static int snd_hdspm_trigger(struct snd_pcm_substream *substream, int cmd)
spin_unlock(&hdspm->lock);
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
other = hdspm->capture_substream;
else
other = hdspm->playback_substream;
@@ -5784,16 +5784,15 @@ static int snd_hdspm_trigger(struct snd_pcm_substream *substream, int cmd)
}
if (cmd == SNDRV_PCM_TRIGGER_START) {
if (!(running & (1 << SNDRV_PCM_STREAM_PLAYBACK))
- && substream->stream ==
- SNDRV_PCM_STREAM_CAPTURE)
+ && snd_pcm_is_capture(substream))
hdspm_silence_playback(hdspm);
} else {
if (running &&
- substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ snd_pcm_is_playback(substream))
hdspm_silence_playback(hdspm);
}
} else {
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
hdspm_silence_playback(hdspm);
}
_ok:
@@ -6046,7 +6045,7 @@ static int snd_hdspm_open(struct snd_pcm_substream *substream)
{
struct hdspm *hdspm = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
- bool playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ bool playback = snd_pcm_is_playback(substream);
spin_lock_irq(&hdspm->lock);
snd_pcm_set_sync(substream);
@@ -6121,7 +6120,7 @@ static int snd_hdspm_open(struct snd_pcm_substream *substream)
static int snd_hdspm_release(struct snd_pcm_substream *substream)
{
struct hdspm *hdspm = snd_pcm_substream_chip(substream);
- bool playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ bool playback = snd_pcm_is_playback(substream);
spin_lock_irq(&hdspm->lock);
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index d066c70ae1600..84e18197f26f7 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -1833,7 +1833,7 @@ static signed char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652,
if (mapped_channel < 0)
return NULL;
- if (stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(stream)) {
return rme9652->capture_buffer +
(mapped_channel * RME9652_CHANNEL_BUFFER_BYTES);
} else {
@@ -1903,7 +1903,7 @@ static int snd_rme9652_reset(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
struct snd_pcm_substream *other;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
other = rme9652->capture_substream;
else
other = rme9652->playback_substream;
@@ -1934,7 +1934,7 @@ static int snd_rme9652_hw_params(struct snd_pcm_substream *substream,
spin_lock_irq(&rme9652->lock);
- if (substream->pstr->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream->pstr->stream)) {
rme9652->control_register &= ~(RME9652_PRO | RME9652_Dolby | RME9652_EMP);
rme9652_write(rme9652, RME9652_control_register, rme9652->control_register |= rme9652->creg_spdif_stream);
this_pid = rme9652->playback_pid;
@@ -2056,7 +2056,7 @@ static int snd_rme9652_trigger(struct snd_pcm_substream *substream,
spin_unlock(&rme9652->lock);
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
other = rme9652->capture_substream;
else
other = rme9652->playback_substream;
@@ -2075,15 +2075,15 @@ static int snd_rme9652_trigger(struct snd_pcm_substream *substream,
}
if (cmd == SNDRV_PCM_TRIGGER_START) {
if (!(running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) &&
- substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ snd_pcm_is_capture(substream))
rme9652_silence_playback(rme9652);
} else {
if (running &&
- substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ snd_pcm_is_playback(substream))
rme9652_silence_playback(rme9652);
}
} else {
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
rme9652_silence_playback(rme9652);
}
_ok:
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 025/113] ALSA: pci: korg1212: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (23 preceding siblings ...)
2024-08-05 0:36 ` [PATCH 024/113] ALSA: pci: rme9652: " Kuninori Morimoto
@ 2024-08-05 0:36 ` Kuninori Morimoto
2024-08-05 0:36 ` [PATCH 026/113] ALSA: pci: lx6464es: " Kuninori Morimoto
` (89 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:36 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/korg1212/korg1212.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 5c2cac201a281..f6c7edd1f045b 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -1494,7 +1494,7 @@ static int snd_korg1212_hw_params(struct snd_pcm_substream *substream,
spin_lock_irqsave(&korg1212->lock, flags);
- if (substream->pstr->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream->pstr->stream)) {
this_pid = korg1212->playback_pid;
other_pid = korg1212->capture_pid;
} else {
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 026/113] ALSA: pci: lx6464es: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (24 preceding siblings ...)
2024-08-05 0:36 ` [PATCH 025/113] ALSA: pci: korg1212: " Kuninori Morimoto
@ 2024-08-05 0:36 ` Kuninori Morimoto
2024-08-05 0:37 ` [PATCH 027/113] ALSA: pci: " Kuninori Morimoto
` (88 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:36 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/lx6464es/lx6464es.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
index bd9b6148dd6fb..721b4ea3103ac 100644
--- a/sound/pci/lx6464es/lx6464es.c
+++ b/sound/pci/lx6464es/lx6464es.c
@@ -98,7 +98,7 @@ static int lx_hardware_open(struct lx6464es *chip,
int err = 0;
struct snd_pcm_runtime *runtime = substream->runtime;
int channels = runtime->channels;
- int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
+ int is_capture = snd_pcm_is_capture(substream);
snd_pcm_uframes_t period_size = runtime->period_size;
@@ -124,7 +124,7 @@ static int lx_hardware_start(struct lx6464es *chip,
{
int err = 0;
struct snd_pcm_runtime *runtime = substream->runtime;
- int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
+ int is_capture = snd_pcm_is_capture(substream);
dev_dbg(chip->card->dev, "setting stream format\n");
err = lx_stream_set_format(chip, runtime, 0, is_capture);
@@ -155,7 +155,7 @@ static int lx_hardware_stop(struct lx6464es *chip,
struct snd_pcm_substream *substream)
{
int err = 0;
- int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
+ int is_capture = snd_pcm_is_capture(substream);
dev_dbg(chip->card->dev, "pausing pipe\n");
err = lx_pipe_pause(chip, 0, is_capture);
@@ -186,7 +186,7 @@ static int lx_hardware_close(struct lx6464es *chip,
struct snd_pcm_substream *substream)
{
int err = 0;
- int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
+ int is_capture = snd_pcm_is_capture(substream);
dev_dbg(chip->card->dev, "releasing pipe\n");
err = lx_pipe_release(chip, 0, is_capture);
@@ -268,7 +268,7 @@ static snd_pcm_uframes_t lx_pcm_stream_pointer(struct snd_pcm_substream
{
struct lx6464es *chip = snd_pcm_substream_chip(substream);
snd_pcm_uframes_t pos;
- int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
+ int is_capture = snd_pcm_is_capture(substream);
struct lx_stream *lx_stream = is_capture ? &chip->capture_stream :
&chip->playback_stream;
@@ -287,7 +287,7 @@ static int lx_pcm_prepare(struct snd_pcm_substream *substream)
{
struct lx6464es *chip = snd_pcm_substream_chip(substream);
int err = 0;
- const int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
+ const int is_capture = snd_pcm_is_capture(substream);
dev_dbg(chip->card->dev, "->lx_pcm_prepare\n");
@@ -370,7 +370,7 @@ static int lx_pcm_hw_free(struct snd_pcm_substream *substream)
{
struct lx6464es *chip = snd_pcm_substream_chip(substream);
int err = 0;
- int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
+ int is_capture = snd_pcm_is_capture(substream);
dev_dbg(chip->card->dev, "->lx_pcm_hw_free\n");
mutex_lock(&chip->setup_mutex);
@@ -515,7 +515,7 @@ static int lx_pcm_trigger_dispatch(struct lx6464es *chip,
static int lx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{
struct lx6464es *chip = snd_pcm_substream_chip(substream);
- const int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
+ const int is_capture = snd_pcm_is_capture(substream);
struct lx_stream *stream = is_capture ? &chip->capture_stream :
&chip->playback_stream;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 027/113] ALSA: pci: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (25 preceding siblings ...)
2024-08-05 0:36 ` [PATCH 026/113] ALSA: pci: lx6464es: " Kuninori Morimoto
@ 2024-08-05 0:37 ` Kuninori Morimoto
2024-08-05 0:37 ` [PATCH 028/113] ALSA: ppc: " Kuninori Morimoto
` (87 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:37 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/pci/intel8x0.c | 2 +-
sound/pci/maestro3.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index dae3e15ba534d..d9a6a9477bccc 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -838,7 +838,7 @@ static int snd_intel8x0_ali_trigger(struct snd_pcm_substream *substream, int cmd
fallthrough;
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
/* clear FIFO for synchronization of channels */
fifo = igetdword(chip, fiforeg[ichdev->ali_slot / 4]);
fifo &= ~(0xff << (ichdev->ali_slot % 4));
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index f4d211970d7ec..28634b2d8e5bd 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -1130,7 +1130,7 @@ snd_m3_pcm_setup1(struct snd_m3 *chip, struct m3_dma *s, struct snd_pcm_substrea
int dsp_in_size, dsp_out_size, dsp_in_buffer, dsp_out_buffer;
struct snd_pcm_runtime *runtime = subs->runtime;
- if (subs->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(subs)) {
dsp_in_size = MINISRC_IN_BUFFER_SIZE - (0x20 * 2);
dsp_out_size = MINISRC_OUT_BUFFER_SIZE - (0x20 * 2);
} else {
@@ -1416,7 +1416,7 @@ snd_m3_pcm_prepare(struct snd_pcm_substream *subs)
snd_m3_pcm_setup1(chip, s, subs);
- if (subs->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(subs))
snd_m3_playback_setup(chip, s, subs);
else
snd_m3_capture_setup(chip, s, subs);
@@ -1724,7 +1724,7 @@ snd_m3_substream_open(struct snd_m3 *chip, struct snd_pcm_substream *subs)
s->substream = subs;
/* set list owners */
- if (subs->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(subs)) {
s->index_list[0] = &chip->mixer_list;
} else
s->index_list[0] = &chip->adc1_list;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 028/113] ALSA: ppc: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (26 preceding siblings ...)
2024-08-05 0:37 ` [PATCH 027/113] ALSA: pci: " Kuninori Morimoto
@ 2024-08-05 0:37 ` Kuninori Morimoto
2024-08-05 0:37 ` [PATCH 029/113] ALSA: mips: " Kuninori Morimoto
` (86 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:37 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/ppc/pmac.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 84058bbf9d127..168c1e2535faf 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -103,7 +103,7 @@ unsigned int snd_pmac_rate_index(struct snd_pmac *chip, struct pmac_stream *rec,
*/
static inline int another_stream(int stream)
{
- return (stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+ return snd_pcm_is_playback(stream) ?
SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
}
@@ -251,7 +251,7 @@ static int snd_pmac_pcm_trigger(struct snd_pmac *chip, struct pmac_stream *rec,
case SNDRV_PCM_TRIGGER_RESUME:
if (rec->running)
return -EBUSY;
- command = (subs->stream == SNDRV_PCM_STREAM_PLAYBACK ?
+ command = (snd_pcm_is_playback(subs) ?
OUTPUT_MORE : INPUT_MORE) + INTR_ALWAYS;
spin_lock(&chip->reg_lock);
snd_pmac_beep_stop(chip);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 029/113] ALSA: mips: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (27 preceding siblings ...)
2024-08-05 0:37 ` [PATCH 028/113] ALSA: ppc: " Kuninori Morimoto
@ 2024-08-05 0:37 ` Kuninori Morimoto
2024-08-05 0:37 ` [PATCH 030/113] ALSA: core: " Kuninori Morimoto
` (85 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:37 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/mips/sgio2audio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c
index a8551ccdd1bf8..a16f63f21dd18 100644
--- a/sound/mips/sgio2audio.c
+++ b/sound/mips/sgio2audio.c
@@ -447,7 +447,7 @@ static int snd_sgio2audio_dma_start(struct snd_pcm_substream *substream)
udelay(10);
writeq(0, &mace->perif.audio.chan[ch].control);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
/* push a full buffer */
snd_sgio2audio_dma_push_frag(chip, ch, CHANNEL_RING_SIZE - 32);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 030/113] ALSA: core: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (28 preceding siblings ...)
2024-08-05 0:37 ` [PATCH 029/113] ALSA: mips: " Kuninori Morimoto
@ 2024-08-05 0:37 ` Kuninori Morimoto
2024-08-05 0:37 ` [PATCH 031/113] ALSA: core: oss: " Kuninori Morimoto
` (84 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:37 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/core/pcm.c | 8 ++++----
sound/core/pcm_compat.c | 4 ++--
sound/core/pcm_dmaengine.c | 6 +++---
sound/core/pcm_lib.c | 14 +++++++-------
sound/core/pcm_local.h | 4 ++--
sound/core/pcm_memory.c | 2 +-
sound/core/pcm_native.c | 30 +++++++++++++++---------------
7 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index dc37f3508dc7a..fdbfb13e4d18f 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -497,7 +497,7 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
char name[16];
sprintf(name, "pcm%i%c", pcm->device,
- pstr->stream == SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c');
+ snd_pcm_is_playback(pstr->stream) ? 'p' : 'c');
entry = snd_info_create_card_entry(pcm->card, name,
pcm->card->proc_root);
if (!entry)
@@ -642,7 +642,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
if (err < 0)
return err;
dev_set_name(pstr->dev, "pcmC%iD%i%c", pcm->card->number, pcm->device,
- stream == SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c');
+ snd_pcm_is_playback(stream) ? 'p' : 'c');
pstr->dev->groups = pcm_dev_attr_groups;
pstr->dev->type = &pcm_dev_type;
dev_set_drvdata(pstr->dev, pstr);
@@ -884,8 +884,8 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
if (snd_BUG_ON(!pcm || !rsubstream))
return -ENXIO;
- if (snd_BUG_ON(stream != SNDRV_PCM_STREAM_PLAYBACK &&
- stream != SNDRV_PCM_STREAM_CAPTURE))
+ if (snd_BUG_ON(!snd_pcm_is_playback(stream) &&
+ !snd_pcm_is_capture(stream)))
return -EINVAL;
*rsubstream = NULL;
pstr = &pcm->streams[stream];
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index a42ec7f5a1daf..47fbbbdb5a8c7 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -300,7 +300,7 @@ static int snd_pcm_ioctl_xferi_compat(struct snd_pcm_substream *substream,
get_user(frames, &data32->frames))
return -EFAULT;
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
err = snd_pcm_lib_write(substream, compat_ptr(buf), frames);
else
err = snd_pcm_lib_read(substream, compat_ptr(buf), frames);
@@ -359,7 +359,7 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,
bufs[i] = compat_ptr(ptr);
bufptr++;
}
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
err = snd_pcm_lib_writev(substream, bufs, frames);
else
err = snd_pcm_lib_readv(substream, bufs, frames);
diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
index b134a51b3fd58..30db37652038f 100644
--- a/sound/core/pcm_dmaengine.c
+++ b/sound/core/pcm_dmaengine.c
@@ -72,7 +72,7 @@ int snd_hwparams_to_dma_slave_config(const struct snd_pcm_substream *substream,
else
buswidth = DMA_SLAVE_BUSWIDTH_8_BYTES;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
slave_config->direction = DMA_MEM_TO_DEV;
slave_config->dst_addr_width = buswidth;
} else {
@@ -108,7 +108,7 @@ void snd_dmaengine_pcm_set_config_from_dai_data(
const struct snd_dmaengine_dai_dma_data *dma_data,
struct dma_slave_config *slave_config)
{
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
slave_config->dst_addr = dma_data->addr;
slave_config->dst_maxburst = dma_data->maxburst;
if (dma_data->flags & SND_DMAENGINE_PCM_DAI_FLAG_PACK)
@@ -444,7 +444,7 @@ int snd_dmaengine_pcm_refine_runtime_hwparams(
if (dma_caps.residue_granularity <= DMA_RESIDUE_GRANULARITY_SEGMENT)
hw->info |= SNDRV_PCM_INFO_BATCH;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
addr_widths = dma_caps.dst_addr_widths;
else
addr_widths = dma_caps.src_addr_widths;
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 6e7905749c4a3..34f45deaf493b 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -253,7 +253,7 @@ static void update_audio_tstamp(struct snd_pcm_substream *substream,
audio_frames = runtime->hw_ptr_wrap + runtime->status->hw_ptr;
if (runtime->audio_tstamp_config.report_delay) {
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
audio_frames -= runtime->delay;
else
audio_frames += runtime->delay;
@@ -464,7 +464,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
return 0;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(substream) &&
runtime->silence_size > 0)
snd_pcm_playback_silence(substream, new_hw_ptr);
@@ -1947,7 +1947,7 @@ static int wait_for_avail(struct snd_pcm_substream *substream,
snd_pcm_uframes_t *availp)
{
struct snd_pcm_runtime *runtime = substream->runtime;
- int is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ int is_playback = snd_pcm_is_playback(substream);
wait_queue_entry_t wait;
int err = 0;
snd_pcm_uframes_t avail = 0;
@@ -2069,7 +2069,7 @@ static int fill_silence(struct snd_pcm_substream *substream, int channel,
{
struct snd_pcm_runtime *runtime = substream->runtime;
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return 0;
if (substream->ops->fill_silence)
return substream->ops->fill_silence(substream, channel,
@@ -2100,7 +2100,7 @@ static int do_transfer(struct snd_pcm_substream *substream, int c,
struct iov_iter iter;
int err, type;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
type = ITER_SOURCE;
else
type = ITER_DEST;
@@ -2283,7 +2283,7 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
if (err < 0)
return err;
- is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ is_playback = snd_pcm_is_playback(substream);
if (interleaved) {
if (runtime->access != SNDRV_PCM_ACCESS_RW_INTERLEAVED &&
runtime->channels > 1)
@@ -2605,7 +2605,7 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream,
info->stream = stream;
info->chmap = chmap;
info->max_channels = max_channels;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
knew.name = "Playback Channel Map";
else
knew.name = "Capture Channel Map";
diff --git a/sound/core/pcm_local.h b/sound/core/pcm_local.h
index ecb21697ae3a4..f08030e56aab6 100644
--- a/sound/core/pcm_local.h
+++ b/sound/core/pcm_local.h
@@ -35,7 +35,7 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream,
static inline snd_pcm_uframes_t
snd_pcm_avail(struct snd_pcm_substream *substream)
{
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return snd_pcm_playback_avail(substream->runtime);
else
return snd_pcm_capture_avail(substream->runtime);
@@ -44,7 +44,7 @@ snd_pcm_avail(struct snd_pcm_substream *substream)
static inline snd_pcm_uframes_t
snd_pcm_hw_avail(struct snd_pcm_substream *substream)
{
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return snd_pcm_playback_hw_avail(substream->runtime);
else
return snd_pcm_capture_hw_avail(substream->runtime);
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index 506386959f084..2d55d3bf72d5b 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -63,7 +63,7 @@ static int do_alloc_pages(struct snd_card *card, int type, struct device *dev,
__update_allocated_size(card, size);
}
- if (str == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(str))
dir = DMA_TO_DEVICE;
else
dir = DMA_FROM_DEVICE;
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 4057f9f10aeec..5e57ab50f4c0f 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -972,7 +972,7 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream,
runtime->silence_size = params->silence_size;
params->boundary = runtime->boundary;
if (snd_pcm_running(substream)) {
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(substream) &&
runtime->silence_size > 0)
snd_pcm_playback_silence(substream, ULONG_MAX);
err = snd_pcm_update_state(substream, runtime);
@@ -999,7 +999,7 @@ snd_pcm_calc_delay(struct snd_pcm_substream *substream)
{
snd_pcm_uframes_t delay;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
delay = snd_pcm_playback_hw_avail(substream->runtime);
else
delay = snd_pcm_capture_avail(substream->runtime);
@@ -1419,7 +1419,7 @@ static int snd_pcm_pre_start(struct snd_pcm_substream *substream,
struct snd_pcm_runtime *runtime = substream->runtime;
if (runtime->state != SNDRV_PCM_STATE_PREPARED)
return -EBADFD;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(substream) &&
!snd_pcm_playback_data(substream))
return -EPIPE;
runtime->trigger_tstamp_latched = false;
@@ -1459,7 +1459,7 @@ static void snd_pcm_post_start(struct snd_pcm_substream *substream,
runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) /
runtime->rate;
__snd_pcm_set_state(runtime, state);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(substream) &&
runtime->silence_size > 0)
snd_pcm_playback_silence(substream, ULONG_MAX);
snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MSTART);
@@ -1798,7 +1798,7 @@ static int snd_pcm_do_resume(struct snd_pcm_substream *substream,
/* DMA not running previously? */
if (runtime->suspended_state != SNDRV_PCM_STATE_RUNNING &&
(runtime->suspended_state != SNDRV_PCM_STATE_DRAINING ||
- substream->stream != SNDRV_PCM_STREAM_PLAYBACK))
+ !snd_pcm_is_playback(substream)))
return 0;
return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_RESUME);
}
@@ -1904,7 +1904,7 @@ static void snd_pcm_post_reset(struct snd_pcm_substream *substream,
struct snd_pcm_runtime *runtime = substream->runtime;
guard(pcm_stream_lock_irq)(substream);
runtime->control->appl_ptr = runtime->status->hw_ptr;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(substream) &&
runtime->silence_size > 0)
snd_pcm_playback_silence(substream, ULONG_MAX);
}
@@ -2021,7 +2021,7 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream,
snd_pcm_state_t state)
{
struct snd_pcm_runtime *runtime = substream->runtime;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (runtime->state) {
case SNDRV_PCM_STATE_PREPARED:
/* start playback stream if possible */
@@ -2130,7 +2130,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,
to_check = NULL;
group = snd_pcm_stream_group_ref(substream);
snd_pcm_group_for_each_entry(s, substream) {
- if (s->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(s))
continue;
runtime = s->runtime;
if (runtime->state == SNDRV_PCM_STATE_DRAINING) {
@@ -2916,7 +2916,7 @@ static int do_pcm_hwsync(struct snd_pcm_substream *substream)
{
switch (substream->runtime->state) {
case SNDRV_PCM_STATE_DRAINING:
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
return -EBADFD;
fallthrough;
case SNDRV_PCM_STATE_RUNNING:
@@ -3215,7 +3215,7 @@ static int snd_pcm_xferi_frames_ioctl(struct snd_pcm_substream *substream,
return -EFAULT;
if (copy_from_user(&xferi, _xferi, sizeof(xferi)))
return -EFAULT;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
result = snd_pcm_lib_write(substream, xferi.buf, xferi.frames);
else
result = snd_pcm_lib_read(substream, xferi.buf, xferi.frames);
@@ -3244,7 +3244,7 @@ static int snd_pcm_xfern_frames_ioctl(struct snd_pcm_substream *substream,
bufs = memdup_user(xfern.bufs, sizeof(void *) * runtime->channels);
if (IS_ERR(bufs))
return PTR_ERR(no_free_ptr(bufs));
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
result = snd_pcm_lib_writev(substream, bufs, xfern.frames);
else
result = snd_pcm_lib_readv(substream, bufs, xfern.frames);
@@ -3433,7 +3433,7 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,
case SNDRV_PCM_IOCTL_FORWARD:
{
/* provided only for OSS; capture-only and no value returned */
- if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
+ if (!snd_pcm_is_capture(substream))
return -EINVAL;
result = snd_pcm_forward(substream, *frames);
return result < 0 ? result : 0;
@@ -3596,7 +3596,7 @@ static __poll_t snd_pcm_poll(struct file *file, poll_table *wait)
pcm_file = file->private_data;
substream = pcm_file->substream;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
ok = EPOLLOUT | EPOLLWRNORM;
else
ok = EPOLLIN | EPOLLRDNORM;
@@ -3620,7 +3620,7 @@ static __poll_t snd_pcm_poll(struct file *file, poll_table *wait)
mask = ok;
break;
case SNDRV_PCM_STATE_DRAINING:
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
mask = ok;
if (!avail)
mask |= EPOLLERR;
@@ -3876,7 +3876,7 @@ int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file,
size_t dma_bytes;
int err;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
if (!(area->vm_flags & (VM_WRITE|VM_READ)))
return -EINVAL;
} else {
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 031/113] ALSA: core: oss: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (29 preceding siblings ...)
2024-08-05 0:37 ` [PATCH 030/113] ALSA: core: " Kuninori Morimoto
@ 2024-08-05 0:37 ` Kuninori Morimoto
2024-08-05 0:37 ` [PATCH 032/113] ALSA: virtio: " Kuninori Morimoto
` (83 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:37 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/core/oss/io.c | 2 +-
sound/core/oss/pcm_oss.c | 20 ++++++++++----------
sound/core/oss/pcm_plugin.c | 10 +++++-----
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/sound/core/oss/io.c b/sound/core/oss/io.c
index d870b2d93135d..86d25f2e01ea6 100644
--- a/sound/core/oss/io.c
+++ b/sound/core/oss/io.c
@@ -128,7 +128,7 @@ int snd_pcm_plugin_build_io(struct snd_pcm_substream *plug,
if (err < 0)
return err;
plugin->access = params_access(params);
- if (snd_pcm_plug_stream(plug) == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(snd_pcm_plug_stream(plug))) {
plugin->transfer = io_playback_transfer;
if (plugin->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED)
plugin->client_channels = io_src_channels;
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 7386982cf40ed..aeaf9c69e791f 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -986,7 +986,7 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
"snd_pcm_plugin_build_io failed: %i\n", err);
goto failure;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
err = snd_pcm_plugin_append(plugin);
} else {
err = snd_pcm_plugin_insert(plugin);
@@ -1003,13 +1003,13 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
sw_params->start_threshold = runtime->boundary;
}
if (atomic_read(&substream->mmap_count) ||
- substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ snd_pcm_is_capture(substream))
sw_params->stop_threshold = runtime->boundary;
else
sw_params->stop_threshold = runtime->buffer_size;
sw_params->tstamp_mode = SNDRV_PCM_TSTAMP_NONE;
sw_params->period_step = 1;
- sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
+ sw_params->avail_min = snd_pcm_is_playback(substream) ?
1 : runtime->period_size;
if (atomic_read(&substream->mmap_count) ||
substream->oss.setup.nosilence) {
@@ -2017,7 +2017,7 @@ static int snd_pcm_oss_get_caps1(struct snd_pcm_substream *substream, int res)
return res;
}
#ifdef DSP_CAP_MULTI
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
if (substream->pstr->substream_count > 1)
res |= DSP_CAP_MULTI;
#endif
@@ -2201,7 +2201,7 @@ static int snd_pcm_oss_get_ptr(struct snd_pcm_oss_file *pcm_oss_file, int stream
return -EFAULT;
return 0;
}
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay);
if (err == -EPIPE || err == -ESTRPIPE || (! err && delay < 0)) {
err = 0;
@@ -2225,12 +2225,12 @@ static int snd_pcm_oss_get_ptr(struct snd_pcm_oss_file *pcm_oss_file, int stream
n += runtime->boundary;
info.blocks = n / runtime->period_size;
runtime->oss.prev_hw_ptr_period = delay;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
snd_pcm_oss_simulate_fill(substream, delay);
info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX;
} else {
delay = snd_pcm_oss_bytes(substream, delay);
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
if (substream->oss.setup.buggyptr)
info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes;
else
@@ -2272,7 +2272,7 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre
info.fragsize = runtime->oss.period_bytes;
info.fragstotal = runtime->periods;
if (runtime->oss.prepare) {
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
info.bytes = runtime->oss.period_bytes * runtime->oss.periods;
info.fragments = runtime->oss.periods;
} else {
@@ -2280,7 +2280,7 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre
info.fragments = 0;
}
} else {
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &avail);
if (err == -EPIPE || err == -ESTRPIPE || (! err && avail < 0)) {
avail = runtime->buffer_size;
@@ -2429,7 +2429,7 @@ static int snd_pcm_oss_open_file(struct file *file,
continue;
if (! pcm->streams[idx].substream_count)
continue; /* no matching substream */
- if (idx == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(idx)) {
if (! (f_mode & FMODE_WRITE))
continue;
} else {
diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c
index 82e180c776ae1..47168e175c966 100644
--- a/sound/core/oss/pcm_plugin.c
+++ b/sound/core/oss/pcm_plugin.c
@@ -54,7 +54,7 @@ static int snd_pcm_plugin_alloc(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t
unsigned int channel;
struct snd_pcm_plugin_channel *c;
- if (plugin->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(plugin->stream)) {
format = &plugin->src_format;
} else {
format = &plugin->dst_format;
@@ -110,7 +110,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames)
int err;
if (snd_BUG_ON(!snd_pcm_plug_first(plug)))
return -ENXIO;
- if (snd_pcm_plug_stream(plug) == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(snd_pcm_plug_stream(plug))) {
struct snd_pcm_plugin *plugin = snd_pcm_plug_first(plug);
while (plugin->next) {
if (plugin->dst_frames)
@@ -174,7 +174,7 @@ int snd_pcm_plugin_build(struct snd_pcm_substream *plug,
plugin->dst_format = *dst_format;
plugin->dst_width = snd_pcm_format_physical_width(dst_format->format);
snd_BUG_ON(plugin->dst_width <= 0);
- if (plugin->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(plugin->stream))
channels = src_format->channels;
else
channels = dst_format->channels;
@@ -567,7 +567,7 @@ snd_pcm_sframes_t snd_pcm_plug_client_channels_buf(struct snd_pcm_substream *plu
if (snd_BUG_ON(!buf))
return -ENXIO;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
plugin = snd_pcm_plug_first(plug);
format = &plugin->src_format;
} else {
@@ -586,7 +586,7 @@ snd_pcm_sframes_t snd_pcm_plug_client_channels_buf(struct snd_pcm_substream *plu
for (channel = 0; channel < nchannels; channel++, v++) {
v->frames = count;
v->enabled = 1;
- v->wanted = (stream == SNDRV_PCM_STREAM_CAPTURE);
+ v->wanted = snd_pcm_is_capture(stream);
v->area.addr = buf;
v->area.first = channel * width;
v->area.step = nchannels * width;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 032/113] ALSA: virtio: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (30 preceding siblings ...)
2024-08-05 0:37 ` [PATCH 031/113] ALSA: core: oss: " Kuninori Morimoto
@ 2024-08-05 0:37 ` Kuninori Morimoto
2024-08-05 0:37 ` [PATCH 033/113] ALSA: include: " Kuninori Morimoto
` (82 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:37 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/virtio/virtio_card.h | 2 +-
sound/virtio/virtio_pcm_msg.c | 4 ++--
sound/virtio/virtio_pcm_ops.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/virtio/virtio_card.h b/sound/virtio/virtio_card.h
index 3ceee4e416fc7..db6d164fada99 100644
--- a/sound/virtio/virtio_card.h
+++ b/sound/virtio/virtio_card.h
@@ -107,7 +107,7 @@ virtsnd_rx_queue(struct virtio_snd *snd)
static inline struct virtio_snd_queue *
virtsnd_pcm_queue(struct virtio_pcm_substream *vss)
{
- if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(vss->direction))
return virtsnd_tx_queue(vss->snd);
else
return virtsnd_rx_queue(vss->snd);
diff --git a/sound/virtio/virtio_pcm_msg.c b/sound/virtio/virtio_pcm_msg.c
index 8c32efaf4c529..40e113a2de73f 100644
--- a/sound/virtio/virtio_pcm_msg.c
+++ b/sound/virtio/virtio_pcm_msg.c
@@ -230,7 +230,7 @@ int virtsnd_pcm_msg_send(struct virtio_pcm_substream *vss, unsigned long offset,
msg->xfer.stream_id = cpu_to_le32(vss->sid);
memset(&msg->status, 0, sizeof(msg->status));
- if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(vss->direction))
rc = virtqueue_add_sgs(vqueue, psgs, 2, 1, msg,
GFP_ATOMIC);
else
@@ -313,7 +313,7 @@ static void virtsnd_pcm_msg_complete(struct virtio_pcm_msg *msg,
* If the capture substream returned an incorrect status, then just
* increase the hw_ptr by the message size.
*/
- if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK ||
+ if (snd_pcm_is_playback(vss->direction) ||
written_bytes <= sizeof(msg->status))
vss->hw_ptr += msg->length;
else
diff --git a/sound/virtio/virtio_pcm_ops.c b/sound/virtio/virtio_pcm_ops.c
index ad12aae52fc32..5d93d50f24023 100644
--- a/sound/virtio/virtio_pcm_ops.c
+++ b/sound/virtio/virtio_pcm_ops.c
@@ -337,7 +337,7 @@ static int virtsnd_pcm_trigger(struct snd_pcm_substream *substream, int command)
spin_lock_irqsave(&queue->lock, flags);
spin_lock(&vss->lock);
- if (vss->direction == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(vss->direction))
rc = virtsnd_pcm_msg_send(vss, 0, vss->buffer_bytes);
if (!rc)
vss->xfer_enabled = true;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 033/113] ALSA: include: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (31 preceding siblings ...)
2024-08-05 0:37 ` [PATCH 032/113] ALSA: virtio: " Kuninori Morimoto
@ 2024-08-05 0:37 ` Kuninori Morimoto
2024-08-05 0:37 ` [PATCH 034/113] ALSA: drivers: " Kuninori Morimoto
` (81 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:37 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
include/sound/dmaengine_pcm.h | 2 +-
include/sound/pcm.h | 4 ++--
include/sound/sdw.h | 2 +-
include/sound/soc-dai.h | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
index f6baa9a018681..3b2e31922f0f1 100644
--- a/include/sound/dmaengine_pcm.h
+++ b/include/sound/dmaengine_pcm.h
@@ -21,7 +21,7 @@
static inline enum dma_transfer_direction
snd_pcm_substream_to_dma_direction(const struct snd_pcm_substream *substream)
{
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return DMA_MEM_TO_DEV;
else
return DMA_DEV_TO_MEM;
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 69e535aeb8e82..00603c0e568e1 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -734,7 +734,7 @@ static inline int snd_pcm_running(struct snd_pcm_substream *substream)
{
return (substream->runtime->state == SNDRV_PCM_STATE_RUNNING ||
(substream->runtime->state == SNDRV_PCM_STATE_DRAINING &&
- substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
+ snd_pcm_is_playback(substream)));
}
/**
@@ -1521,7 +1521,7 @@ const char *snd_pcm_format_name(snd_pcm_format_t format);
*/
static inline const char *snd_pcm_direction_name(int direction)
{
- if (direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(direction))
return "Playback";
else
return "Capture";
diff --git a/include/sound/sdw.h b/include/sound/sdw.h
index 6dcdb3228dba6..ab752dadea3bc 100644
--- a/include/sound/sdw.h
+++ b/include/sound/sdw.h
@@ -38,7 +38,7 @@ static inline void snd_sdw_params_to_config(struct snd_pcm_substream *substream,
stream_config->ch_count = params_channels(params);
stream_config->bps = snd_pcm_format_width(params_format(params));
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
stream_config->direction = SDW_DATA_DIR_RX;
else
stream_config->direction = SDW_DATA_DIR_TX;
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index bbb72ad4c9518..577bbaede90af 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -476,7 +476,7 @@ struct snd_soc_dai {
static inline const struct snd_soc_pcm_stream *
snd_soc_dai_get_pcm_stream(const struct snd_soc_dai *dai, int stream)
{
- return (stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+ return (snd_pcm_is_playback(stream)) ?
&dai->driver->playback : &dai->driver->capture;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 034/113] ALSA: drivers: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (32 preceding siblings ...)
2024-08-05 0:37 ` [PATCH 033/113] ALSA: include: " Kuninori Morimoto
@ 2024-08-05 0:37 ` Kuninori Morimoto
2024-08-05 0:37 ` [PATCH 035/113] ALSA: firewire: motu: " Kuninori Morimoto
` (80 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:37 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/drivers/aloop.c | 18 +++++++++---------
sound/drivers/dummy.c | 2 +-
sound/drivers/pcmtest.c | 4 ++--
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index 439d12ad87879..9d33aef59e95b 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -193,7 +193,7 @@ static inline struct loopback_setup *get_setup(struct loopback_pcm *dpcm)
{
int device = dpcm->substream->pstr->pcm->device;
- if (dpcm->substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dpcm->substream))
device ^= 1;
return &dpcm->loopback->setup[dpcm->substream->number][device];
}
@@ -341,7 +341,7 @@ static int loopback_check_format(struct loopback_cable *cable, int stream)
int check;
if (cable->valid != CABLE_VALID_BOTH) {
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
goto __notify;
return 0;
}
@@ -356,7 +356,7 @@ static int loopback_check_format(struct loopback_cable *cable, int stream)
is_access_interleaved(cruntime->access);
if (!check)
return 0;
- if (stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(stream)) {
return -EIO;
} else {
snd_pcm_stop(cable->streams[SNDRV_PCM_STREAM_CAPTURE]->
@@ -418,7 +418,7 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
cable->pause &= ~stream;
err = cable->ops->start(dpcm);
spin_unlock(&cable->lock);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
loopback_active_notify(dpcm);
break;
case SNDRV_PCM_TRIGGER_STOP:
@@ -427,7 +427,7 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
cable->pause &= ~stream;
err = cable->ops->stop(dpcm);
spin_unlock(&cable->lock);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
loopback_active_notify(dpcm);
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
@@ -436,7 +436,7 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
cable->pause |= stream;
err = cable->ops->stop(dpcm);
spin_unlock(&cable->lock);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
loopback_active_notify(dpcm);
break;
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
@@ -446,7 +446,7 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
cable->pause &= ~stream;
err = cable->ops->start(dpcm);
spin_unlock(&cable->lock);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
loopback_active_notify(dpcm);
break;
default:
@@ -497,7 +497,7 @@ static int loopback_prepare(struct snd_pcm_substream *substream)
dpcm->buf_pos = 0;
dpcm->pcm_buffer_size = frames_to_bytes(runtime, runtime->buffer_size);
dpcm->channel_buf_n = dpcm->pcm_buffer_size / runtime->channels;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
/* clear capture buffer */
dpcm->silent_size = dpcm->pcm_buffer_size;
snd_pcm_format_set_silence(runtime->format, runtime->dma_area,
@@ -513,7 +513,7 @@ static int loopback_prepare(struct snd_pcm_substream *substream)
mutex_lock(&dpcm->loopback->cable_lock);
if (!(cable->valid & ~(1 << substream->stream)) ||
(get_setup(dpcm)->notify &&
- substream->stream == SNDRV_PCM_STREAM_PLAYBACK))
+ snd_pcm_is_playback(substream)))
params_change(substream);
cable->valid |= 1 << substream->stream;
mutex_unlock(&dpcm->loopback->cable_lock);
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index 52ff6ac3f7435..5e440f952449e 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -570,7 +570,7 @@ static int dummy_pcm_open(struct snd_pcm_substream *substream)
if (model == NULL)
return 0;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
if (model->playback_constraints)
err = model->playback_constraints(substream->runtime);
} else {
diff --git a/sound/drivers/pcmtest.c b/sound/drivers/pcmtest.c
index 21cefaf5419aa..ae308ede80929 100644
--- a/sound/drivers/pcmtest.c
+++ b/sound/drivers/pcmtest.c
@@ -351,9 +351,9 @@ static void timer_timeout(struct timer_list *data)
if (v_iter->suspend)
return;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && !v_iter->is_buf_corrupted)
+ if (snd_pcm_is_playback(substream) && !v_iter->is_buf_corrupted)
check_buf_block(v_iter, substream->runtime);
- else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ else if (snd_pcm_is_capture(substream))
fill_block(v_iter, substream->runtime);
else
inc_buf_pos(v_iter, v_iter->b_rw, substream->runtime->dma_bytes);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 035/113] ALSA: firewire: motu: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (33 preceding siblings ...)
2024-08-05 0:37 ` [PATCH 034/113] ALSA: drivers: " Kuninori Morimoto
@ 2024-08-05 0:37 ` Kuninori Morimoto
2024-08-05 0:37 ` [PATCH 036/113] ALSA: firewire: oxfw: " Kuninori Morimoto
` (79 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:37 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/firewire/motu/motu-pcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/firewire/motu/motu-pcm.c b/sound/firewire/motu/motu-pcm.c
index d410c2efbde57..411d2b3dccbb8 100644
--- a/sound/firewire/motu/motu-pcm.c
+++ b/sound/firewire/motu/motu-pcm.c
@@ -101,7 +101,7 @@ static int init_hw_info(struct snd_motu *motu,
struct snd_motu_packet_format *formats;
int err;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
hw->formats = SNDRV_PCM_FMTBIT_S32;
stream = &motu->tx_stream;
formats = &motu->tx_packet_formats;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 036/113] ALSA: firewire: oxfw: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (34 preceding siblings ...)
2024-08-05 0:37 ` [PATCH 035/113] ALSA: firewire: motu: " Kuninori Morimoto
@ 2024-08-05 0:37 ` Kuninori Morimoto
2024-08-05 0:38 ` [PATCH 037/113] ALSA: firewire: dice: " Kuninori Morimoto
` (78 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:37 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/firewire/oxfw/oxfw-pcm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/firewire/oxfw/oxfw-pcm.c b/sound/firewire/oxfw/oxfw-pcm.c
index 5f43a0b826d2e..c0e67a0d10f1b 100644
--- a/sound/firewire/oxfw/oxfw-pcm.c
+++ b/sound/firewire/oxfw/oxfw-pcm.c
@@ -114,7 +114,7 @@ static int init_hw_params(struct snd_oxfw *oxfw,
struct amdtp_stream *stream;
int err;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
runtime->hw.formats = AM824_IN_PCM_FORMAT_BITS;
stream = &oxfw->tx_stream;
formats = oxfw->tx_stream_formats;
@@ -150,7 +150,7 @@ static int limit_to_current_params(struct snd_pcm_substream *substream)
enum avc_general_plug_dir dir;
int err;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
dir = AVC_GENERAL_PLUG_DIR_OUT;
else
dir = AVC_GENERAL_PLUG_DIR_IN;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 037/113] ALSA: firewire: dice: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (35 preceding siblings ...)
2024-08-05 0:37 ` [PATCH 036/113] ALSA: firewire: oxfw: " Kuninori Morimoto
@ 2024-08-05 0:38 ` Kuninori Morimoto
2024-08-05 0:38 ` [PATCH 038/113] ALSA: firewire: bebob: " Kuninori Morimoto
` (77 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:38 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/firewire/dice/dice-pcm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/firewire/dice/dice-pcm.c b/sound/firewire/dice/dice-pcm.c
index d64366217d572..063e16d153fa5 100644
--- a/sound/firewire/dice/dice-pcm.c
+++ b/sound/firewire/dice/dice-pcm.c
@@ -26,7 +26,7 @@ static int dice_rate_constraint(struct snd_pcm_hw_params *params,
enum snd_dice_rate_mode mode;
unsigned int i, rate;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
pcm_channels = dice->tx_pcm_chs[index];
else
pcm_channels = dice->rx_pcm_chs[index];
@@ -64,7 +64,7 @@ static int dice_channels_constraint(struct snd_pcm_hw_params *params,
enum snd_dice_rate_mode mode;
unsigned int i, rate;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
pcm_channels = dice->tx_pcm_chs[index];
else
pcm_channels = dice->rx_pcm_chs[index];
@@ -132,7 +132,7 @@ static int init_hw_info(struct snd_dice *dice,
struct amdtp_stream *stream;
int err;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
hw->formats = AM824_IN_PCM_FORMAT_BITS;
dir = AMDTP_IN_STREAM;
stream = &dice->tx_stream[index];
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 038/113] ALSA: firewire: bebob: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (36 preceding siblings ...)
2024-08-05 0:38 ` [PATCH 037/113] ALSA: firewire: dice: " Kuninori Morimoto
@ 2024-08-05 0:38 ` Kuninori Morimoto
2024-08-05 0:38 ` [PATCH 039/113] ALSA: firewire: tascam: " Kuninori Morimoto
` (76 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:38 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/firewire/bebob/bebob_pcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/firewire/bebob/bebob_pcm.c b/sound/firewire/bebob/bebob_pcm.c
index ce49eef0fcbaa..882aab28dd96d 100644
--- a/sound/firewire/bebob/bebob_pcm.c
+++ b/sound/firewire/bebob/bebob_pcm.c
@@ -100,7 +100,7 @@ pcm_init_hw_params(struct snd_bebob *bebob,
struct snd_bebob_stream_formation *formations;
int err;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
runtime->hw.formats = AM824_IN_PCM_FORMAT_BITS;
s = &bebob->tx_stream;
formations = bebob->tx_stream_formations;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 039/113] ALSA: firewire: tascam: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (37 preceding siblings ...)
2024-08-05 0:38 ` [PATCH 038/113] ALSA: firewire: bebob: " Kuninori Morimoto
@ 2024-08-05 0:38 ` Kuninori Morimoto
2024-08-05 0:38 ` [PATCH 040/113] ALSA: firewire: digi00x: " Kuninori Morimoto
` (75 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:38 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/firewire/tascam/tascam-pcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/firewire/tascam/tascam-pcm.c b/sound/firewire/tascam/tascam-pcm.c
index f6da571707ac2..29a8e7db7c30f 100644
--- a/sound/firewire/tascam/tascam-pcm.c
+++ b/sound/firewire/tascam/tascam-pcm.c
@@ -15,7 +15,7 @@ static int pcm_init_hw_params(struct snd_tscm *tscm,
struct amdtp_stream *stream;
unsigned int pcm_channels;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
runtime->hw.formats = SNDRV_PCM_FMTBIT_S32;
stream = &tscm->tx_stream;
pcm_channels = tscm->spec->pcm_capture_analog_channels;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 040/113] ALSA: firewire: digi00x: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (38 preceding siblings ...)
2024-08-05 0:38 ` [PATCH 039/113] ALSA: firewire: tascam: " Kuninori Morimoto
@ 2024-08-05 0:38 ` Kuninori Morimoto
2024-08-05 0:38 ` [PATCH 041/113] ALSA: firewire: fireface: " Kuninori Morimoto
` (74 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:38 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/firewire/digi00x/digi00x-pcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/firewire/digi00x/digi00x-pcm.c b/sound/firewire/digi00x/digi00x-pcm.c
index 3bd1575c9d9c1..42ffed7b19e36 100644
--- a/sound/firewire/digi00x/digi00x-pcm.c
+++ b/sound/firewire/digi00x/digi00x-pcm.c
@@ -63,7 +63,7 @@ static int pcm_init_hw_params(struct snd_dg00x *dg00x,
int err;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S32;
s = &dg00x->tx_stream;
} else {
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 041/113] ALSA: firewire: fireface: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (39 preceding siblings ...)
2024-08-05 0:38 ` [PATCH 040/113] ALSA: firewire: digi00x: " Kuninori Morimoto
@ 2024-08-05 0:38 ` Kuninori Morimoto
2024-08-05 0:38 ` [PATCH 042/113] ALSA: firewire: fireworks: " Kuninori Morimoto
` (73 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:38 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/firewire/fireface/ff-pcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/firewire/fireface/ff-pcm.c b/sound/firewire/fireface/ff-pcm.c
index ec915671a79b3..d17abff5bb1e0 100644
--- a/sound/firewire/fireface/ff-pcm.c
+++ b/sound/firewire/fireface/ff-pcm.c
@@ -109,7 +109,7 @@ static int pcm_init_hw_params(struct snd_ff *ff,
const unsigned int *pcm_channels;
int err;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
runtime->hw.formats = SNDRV_PCM_FMTBIT_S32;
s = &ff->tx_stream;
pcm_channels = ff->spec->pcm_capture_channels;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 042/113] ALSA: firewire: fireworks: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (40 preceding siblings ...)
2024-08-05 0:38 ` [PATCH 041/113] ALSA: firewire: fireface: " Kuninori Morimoto
@ 2024-08-05 0:38 ` Kuninori Morimoto
2024-08-05 0:38 ` [PATCH 043/113] ASoC: ti: " Kuninori Morimoto
` (72 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:38 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/firewire/fireworks/fireworks_pcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/firewire/fireworks/fireworks_pcm.c b/sound/firewire/fireworks/fireworks_pcm.c
index c3c21860b245b..7ab42a6903e40 100644
--- a/sound/firewire/fireworks/fireworks_pcm.c
+++ b/sound/firewire/fireworks/fireworks_pcm.c
@@ -137,7 +137,7 @@ pcm_init_hw_params(struct snd_efw *efw,
unsigned int *pcm_channels;
int err;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
runtime->hw.formats = AM824_IN_PCM_FORMAT_BITS;
s = &efw->tx_stream;
pcm_channels = efw->pcm_capture_channels;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 043/113] ASoC: ti: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (41 preceding siblings ...)
2024-08-05 0:38 ` [PATCH 042/113] ALSA: firewire: fireworks: " Kuninori Morimoto
@ 2024-08-05 0:38 ` Kuninori Morimoto
2024-08-05 0:38 ` [PATCH 044/113] ASoC: sh: " Kuninori Morimoto
` (71 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:38 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/ti/davinci-i2s.c | 12 ++++++------
sound/soc/ti/davinci-mcasp.c | 18 +++++++++---------
sound/soc/ti/omap-mcbsp.c | 18 +++++++++---------
sound/soc/ti/omap-mcpdm.c | 10 +++++-----
4 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/sound/soc/ti/davinci-i2s.c b/sound/soc/ti/davinci-i2s.c
index 0f15a743c7982..f509aaafa411f 100644
--- a/sound/soc/ti/davinci-i2s.c
+++ b/sound/soc/ti/davinci-i2s.c
@@ -190,7 +190,7 @@ static void toggle_clock(struct davinci_mcbsp_dev *dev, int playback)
static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev,
struct snd_pcm_substream *substream)
{
- int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ int playback = snd_pcm_is_playback(substream);
u32 spcr;
u32 mask = playback ? DAVINCI_MCBSP_SPCR_XRST : DAVINCI_MCBSP_SPCR_RRST;
@@ -485,7 +485,7 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
}
/* general line settings */
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
spcr |= DAVINCI_MCBSP_SPCR_RINTM(3);
davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, spcr);
} else {
@@ -641,7 +641,7 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
xcr |= DAVINCI_MCBSP_XCR_XWDLEN1(mcbsp_word_length) |
DAVINCI_MCBSP_XCR_XWDLEN2(mcbsp_word_length);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_XCR_REG, xcr);
else
davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_RCR_REG, rcr);
@@ -656,7 +656,7 @@ static int davinci_i2s_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai);
- int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ int playback = snd_pcm_is_playback(substream);
u32 spcr;
u32 mask = playback ? DAVINCI_MCBSP_SPCR_XRST : DAVINCI_MCBSP_SPCR_RRST;
@@ -700,7 +700,7 @@ static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
{
struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai);
int ret = 0;
- int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ int playback = snd_pcm_is_playback(substream);
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
@@ -723,7 +723,7 @@ static void davinci_i2s_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai);
- int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ int playback = snd_pcm_is_playback(substream);
davinci_mcbsp_stop(dev, playback);
}
diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index 2b1ed91a736c9..e7eabbd972e79 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -289,7 +289,7 @@ static void davinci_mcasp_start(struct davinci_mcasp *mcasp, int stream)
{
mcasp->streams++;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
mcasp_start_tx(mcasp);
else
mcasp_start_rx(mcasp);
@@ -354,7 +354,7 @@ static void davinci_mcasp_stop(struct davinci_mcasp *mcasp, int stream)
{
mcasp->streams--;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
mcasp_stop_tx(mcasp);
else
mcasp_stop_rx(mcasp);
@@ -873,7 +873,7 @@ static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
if (mcasp->version < MCASP_VERSION_3)
mcasp_set_bits(mcasp, DAVINCI_MCASP_PWREMUMGT_REG, MCASP_SOFT);
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
mcasp_set_reg(mcasp, DAVINCI_MCASP_TXSTAT_REG, 0xFFFFFFFF);
mcasp_clr_bits(mcasp, DAVINCI_MCASP_XEVTCTL_REG, TXDATADMADIS);
max_tx_serializers = max_active_serializers;
@@ -913,7 +913,7 @@ static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
}
}
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
active_serializers = tx_ser;
numevt = mcasp->txnumevt;
reg = mcasp->fifo_base + MCASP_WFIFOCTL_OFFSET;
@@ -1026,12 +1026,12 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream,
if (!mcasp->dat_port)
busel = TXSEL;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
mcasp_set_reg(mcasp, DAVINCI_MCASP_TXTDM_REG, mask);
mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, busel | TXORD);
mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG,
FSXMOD(total_slots), FSXMOD(0x1FF));
- } else if (stream == SNDRV_PCM_STREAM_CAPTURE) {
+ } else if (snd_pcm_is_capture(stream)) {
mcasp_set_reg(mcasp, DAVINCI_MCASP_RXTDM_REG, mask);
mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, busel | RXORD);
mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG,
@@ -1190,7 +1190,7 @@ static snd_pcm_sframes_t davinci_mcasp_delay(
struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(cpu_dai);
u32 fifo_use;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
fifo_use = davinci_mcasp_tx_delay(mcasp);
else
fifo_use = davinci_mcasp_rx_delay(mcasp);
@@ -1509,7 +1509,7 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
* Limit the maximum allowed channels for the first stream:
* number of serializers for the direction * tdm slots per serializer
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dir = TX_MODE;
else
dir = RX_MODE;
@@ -1591,7 +1591,7 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
return ret;
}
- numevt = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+ numevt = snd_pcm_is_playback(substream) ?
&mcasp->txnumevt :
&mcasp->rxnumevt;
snd_pcm_hw_rule_add(substream->runtime, 0,
diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c
index 2110ffe5281ce..bb6a01b41ac86 100644
--- a/sound/soc/ti/omap-mcbsp.c
+++ b/sound/soc/ti/omap-mcbsp.c
@@ -217,7 +217,7 @@ static int omap_mcbsp_dma_reg_params(struct omap_mcbsp *mcbsp,
{
int data_reg;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
if (mcbsp->pdata->reg_size == 2)
data_reg = OMAP_MCBSP_REG_DXR1;
else
@@ -413,7 +413,7 @@ static void omap_mcbsp_free(struct omap_mcbsp *mcbsp)
*/
static void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int stream)
{
- int tx = (stream == SNDRV_PCM_STREAM_PLAYBACK);
+ int tx = snd_pcm_is_playback(stream);
int rx = !tx;
int enable_srg = 0;
u16 w;
@@ -472,7 +472,7 @@ static void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int stream)
static void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int stream)
{
- int tx = (stream == SNDRV_PCM_STREAM_PLAYBACK);
+ int tx = snd_pcm_is_playback(stream);
int rx = !tx;
int idle;
u16 w;
@@ -742,7 +742,7 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream,
words = 1;
/* Configure McBSP internal buffer usage */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
omap_mcbsp_set_tx_threshold(mcbsp, words);
else
omap_mcbsp_set_rx_threshold(mcbsp, words);
@@ -797,7 +797,7 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
* smaller buffer than the FIFO size to avoid underruns.
* This applies only for the playback stream.
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
snd_pcm_hw_rule_add(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
omap_mcbsp_hwrule_min_buffersize,
@@ -816,7 +816,7 @@ static void omap_mcbsp_dai_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai)
{
struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
- int tx = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ int tx = snd_pcm_is_playback(substream);
int stream1 = tx ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
int stream2 = tx ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
@@ -839,7 +839,7 @@ static int omap_mcbsp_dai_prepare(struct snd_pcm_substream *substream,
{
struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
struct pm_qos_request *pm_qos_req = &mcbsp->pm_qos_req;
- int tx = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ int tx = snd_pcm_is_playback(substream);
int stream1 = tx ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
int stream2 = tx ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
int latency = mcbsp->latency[stream2];
@@ -896,7 +896,7 @@ static snd_pcm_sframes_t omap_mcbsp_dai_delay(
if (mcbsp->pdata->buffer_size == 0)
return 0;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
fifo_use = omap_mcbsp_get_tx_delay(mcbsp);
else
fifo_use = omap_mcbsp_get_rx_delay(mcbsp);
@@ -944,7 +944,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
int divider = 0;
period_words = params_period_bytes(params) / (wlen / 8);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
max_thrsh = mcbsp->max_tx_thres;
else
max_thrsh = mcbsp->max_rx_thres;
diff --git a/sound/soc/ti/omap-mcpdm.c b/sound/soc/ti/omap-mcpdm.c
index 1a5d19937c642..43637ce12b665 100644
--- a/sound/soc/ti/omap-mcpdm.c
+++ b/sound/soc/ti/omap-mcpdm.c
@@ -265,7 +265,7 @@ static void omap_mcpdm_dai_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
- int tx = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ int tx = snd_pcm_is_playback(substream);
int stream1 = tx ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
int stream2 = tx ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
@@ -305,13 +305,13 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
channels = params_channels(params);
switch (channels) {
case 5:
- if (stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(stream))
/* up to 3 channels for capture */
return -EINVAL;
link_mask |= 1 << 4;
fallthrough;
case 4:
- if (stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(stream))
/* up to 3 channels for capture */
return -EINVAL;
link_mask |= 1 << 3;
@@ -334,7 +334,7 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
threshold = mcpdm->config[stream].threshold;
/* Configure McPDM channels, and DMA packet size */
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
link_mask <<= 3;
/* If capture is not running assume a stereo stream to come */
@@ -377,7 +377,7 @@ static int omap_mcpdm_prepare(struct snd_pcm_substream *substream,
{
struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
struct pm_qos_request *pm_qos_req = &mcpdm->pm_qos_req;
- int tx = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ int tx = snd_pcm_is_playback(substream);
int stream1 = tx ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
int stream2 = tx ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
int latency = mcpdm->latency[stream2];
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 044/113] ASoC: sh: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (42 preceding siblings ...)
2024-08-05 0:38 ` [PATCH 043/113] ASoC: ti: " Kuninori Morimoto
@ 2024-08-05 0:38 ` Kuninori Morimoto
2024-08-05 0:38 ` [PATCH 045/113] ASoC: adi: " Kuninori Morimoto
` (70 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:38 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/sh/dma-sh7760.c | 12 ++++++------
sound/soc/sh/fsi.c | 7 +------
sound/soc/sh/hac.c | 2 +-
sound/soc/sh/rcar/core.c | 4 ++--
sound/soc/sh/rz-ssi.c | 14 ++++----------
sound/soc/sh/siu_dai.c | 4 ++--
sound/soc/sh/siu_pcm.c | 14 +++++++-------
sound/soc/sh/ssi.c | 2 +-
8 files changed, 24 insertions(+), 35 deletions(-)
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c
index c53539482c208..32b30bbfaa88f 100644
--- a/sound/soc/sh/dma-sh7760.c
+++ b/sound/soc/sh/dma-sh7760.c
@@ -120,7 +120,7 @@ static int camelot_pcm_open(struct snd_soc_component *component,
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct camelot_pcm *cam = &cam_pcm_data[snd_soc_rtd_to_cpu(rtd, 0)->id];
- int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1;
+ int recv = snd_pcm_is_capture(substream);
int ret, dmairq;
snd_soc_set_runtime_hwparams(substream, &camelot_pcm_hardware);
@@ -154,7 +154,7 @@ static int camelot_pcm_close(struct snd_soc_component *component,
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct camelot_pcm *cam = &cam_pcm_data[snd_soc_rtd_to_cpu(rtd, 0)->id];
- int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1;
+ int recv = snd_pcm_is_capture(substream);
int dmairq;
dmairq = (recv) ? cam->txid + 2 : cam->txid;
@@ -176,7 +176,7 @@ static int camelot_hw_params(struct snd_soc_component *component,
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct camelot_pcm *cam = &cam_pcm_data[snd_soc_rtd_to_cpu(rtd, 0)->id];
- int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1;
+ int recv = snd_pcm_is_capture(substream);
if (recv) {
cam->rx_period_size = params_period_bytes(hw_params);
@@ -198,7 +198,7 @@ static int camelot_prepare(struct snd_soc_component *component,
pr_debug("PCM data: addr %pad len %zu\n", &runtime->dma_addr,
runtime->dma_bytes);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
BRGREG(BRGATXSAR) = (unsigned long)runtime->dma_area;
BRGREG(BRGATXTCR) = runtime->dma_bytes;
} else {
@@ -242,7 +242,7 @@ static int camelot_trigger(struct snd_soc_component *component,
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct camelot_pcm *cam = &cam_pcm_data[snd_soc_rtd_to_cpu(rtd, 0)->id];
- int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1;
+ int recv = snd_pcm_is_capture(substream);
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
@@ -270,7 +270,7 @@ static snd_pcm_uframes_t camelot_pos(struct snd_soc_component *component,
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct camelot_pcm *cam = &cam_pcm_data[snd_soc_rtd_to_cpu(rtd, 0)->id];
- int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1;
+ int recv = snd_pcm_is_capture(substream);
unsigned long pos;
/* cannot use the DMABRG pointer register: under load, by the
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 087e379aa3bc4..59198f615ed6a 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -398,11 +398,6 @@ static int fsi_is_enable_stream(struct fsi_priv *fsi)
return fsi->enable_stream;
}
-static int fsi_is_play(struct snd_pcm_substream *substream)
-{
- return substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
-}
-
static struct snd_soc_dai *fsi_get_dai(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
@@ -492,7 +487,7 @@ static void fsi_count_fifo_err(struct fsi_priv *fsi)
static inline struct fsi_stream *fsi_stream_get(struct fsi_priv *fsi,
struct snd_pcm_substream *substream)
{
- return fsi_is_play(substream) ? &fsi->playback : &fsi->capture;
+ return snd_pcm_is_playback(substream) ? &fsi->playback : &fsi->capture;
}
static int fsi_stream_is_working(struct fsi_priv *fsi,
diff --git a/sound/soc/sh/hac.c b/sound/soc/sh/hac.c
index cc200f45826c3..dc724042d336e 100644
--- a/sound/soc/sh/hac.c
+++ b/sound/soc/sh/hac.c
@@ -237,7 +237,7 @@ static int hac_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct hac_priv *hac = &hac_cpu_data[dai->id];
- int d = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0 : 1;
+ int d = snd_pcm_is_capture(substream);
switch (params->msbits) {
case 16:
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 15cb5e7008f9f..9e719a01769ba 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -683,7 +683,7 @@ static
struct rsnd_dai_stream *rsnd_rdai_to_io(struct rsnd_dai *rdai,
struct snd_pcm_substream *substream)
{
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return &rdai->playback;
else
return &rdai->capture;
@@ -1004,7 +1004,7 @@ static int rsnd_soc_dai_startup(struct snd_pcm_substream *substream,
* It depends on Clock Master Mode
*/
if (rsnd_rdai_is_clk_master(rdai)) {
- int is_play = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ int is_play = snd_pcm_is_playback(substream);
snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
rsnd_soc_hw_rule_rate,
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index d0bf0487bf1bd..d0afc9ced950b 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -171,18 +171,12 @@ rz_ssi_get_dai(struct snd_pcm_substream *substream)
return snd_soc_rtd_to_cpu(rtd, 0);
}
-static inline bool rz_ssi_stream_is_play(struct rz_ssi_priv *ssi,
- struct snd_pcm_substream *substream)
-{
- return substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
-}
-
static inline struct rz_ssi_stream *
rz_ssi_stream_get(struct rz_ssi_priv *ssi, struct snd_pcm_substream *substream)
{
struct rz_ssi_stream *stream = &ssi->playback;
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
stream = &ssi->capture;
return stream;
@@ -349,7 +343,7 @@ static void rz_ssi_set_idle(struct rz_ssi_priv *ssi)
static int rz_ssi_start(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
{
- bool is_play = rz_ssi_stream_is_play(ssi, strm->substream);
+ bool is_play = snd_pcm_is_playback(strm->substream);
bool is_full_duplex;
u32 ssicr, ssifcr;
@@ -682,7 +676,7 @@ static int rz_ssi_dma_transfer(struct rz_ssi_priv *ssi,
*/
return 0;
- dir = rz_ssi_stream_is_play(ssi, substream) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+ dir = snd_pcm_is_playback(substream) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
/* Always transfer 1 period */
amount = runtime->period_size;
@@ -808,7 +802,7 @@ static int rz_ssi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
if (ssi->dma_rt) {
bool is_playback;
- is_playback = rz_ssi_stream_is_play(ssi, substream);
+ is_playback = snd_pcm_is_playback(substream);
ret = rz_ssi_dma_slave_config(ssi, ssi->playback.dma_ch,
is_playback);
/* Fallback to pio */
diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c
index d0b5c543fd2f8..e747d34b51580 100644
--- a/sound/soc/sh/siu_dai.c
+++ b/sound/soc/sh/siu_dai.c
@@ -521,7 +521,7 @@ static void siu_dai_shutdown(struct snd_pcm_substream *substream,
dev_dbg(substream->pcm->card->dev, "%s: port=%d@%p\n", __func__,
info->port_id, port_info);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
port_info->play_cap &= ~PLAYBACK_ENABLED;
else
port_info->play_cap &= ~CAPTURE_ENABLED;
@@ -550,7 +550,7 @@ static int siu_dai_prepare(struct snd_pcm_substream *substream,
"%s: port %d, active streams %lx, %d channels\n",
__func__, info->port_id, port_info->play_cap, rt->channels);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
self = PLAYBACK_ENABLED;
siu_stream = &port_info->playback;
} else {
diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c
index f15ff36e79345..27ee6fd6d35c2 100644
--- a/sound/soc/sh/siu_pcm.c
+++ b/sound/soc/sh/siu_pcm.c
@@ -214,7 +214,7 @@ static void siu_io_work(struct work_struct *work)
return;
}
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
dma_addr_t buff;
size_t count;
@@ -306,7 +306,7 @@ static int siu_pcm_open(struct snd_soc_component *component,
dev_dbg(dev, "%s, port=%d@%p\n", __func__, port, port_info);
- if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(ss)) {
siu_stream = &port_info->playback;
param = &siu_stream->param;
param->shdma_slave.slave_id = port ? pdata->dma_slave_tx_b :
@@ -340,7 +340,7 @@ static int siu_pcm_close(struct snd_soc_component *component,
dev_dbg(dev, "%s: port=%d\n", __func__, info->port_id);
- if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(ss))
siu_stream = &port_info->playback;
else
siu_stream = &port_info->capture;
@@ -363,7 +363,7 @@ static int siu_pcm_prepare(struct snd_soc_component *component,
struct siu_stream *siu_stream;
snd_pcm_sframes_t xfer_cnt;
- if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(ss))
siu_stream = &port_info->playback;
else
siu_stream = &port_info->capture;
@@ -413,7 +413,7 @@ static int siu_pcm_trigger(struct snd_soc_component *component,
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
- if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(ss))
ret = siu_pcm_stmwrite_start(port_info);
else
ret = siu_pcm_stmread_start(port_info);
@@ -424,7 +424,7 @@ static int siu_pcm_trigger(struct snd_soc_component *component,
break;
case SNDRV_PCM_TRIGGER_STOP:
- if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(ss))
siu_pcm_stmwrite_stop(port_info);
else
siu_pcm_stmread_stop(port_info);
@@ -455,7 +455,7 @@ siu_pcm_pointer_dma(struct snd_soc_component *component,
size_t ptr;
struct siu_stream *siu_stream;
- if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(ss))
siu_stream = &port_info->playback;
else
siu_stream = &port_info->capture;
diff --git a/sound/soc/sh/ssi.c b/sound/soc/sh/ssi.c
index 96cf523c22734..f77b4d9a4a205 100644
--- a/sound/soc/sh/ssi.c
+++ b/sound/soc/sh/ssi.c
@@ -135,7 +135,7 @@ static int ssi_hw_params(struct snd_pcm_substream *substream,
channels = params_channels(params);
bits = params->msbits;
- recv = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 0 : 1;
+ recv = snd_pcm_is_capture(substream);
pr_debug("ssi_hw_params() enter\nssicr was %08lx\n", ssicr);
pr_debug("bits: %u channels: %u\n", bits, channels);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 045/113] ASoC: adi: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (43 preceding siblings ...)
2024-08-05 0:38 ` [PATCH 044/113] ASoC: sh: " Kuninori Morimoto
@ 2024-08-05 0:38 ` Kuninori Morimoto
2024-08-05 0:38 ` [PATCH 046/113] ASoC: amd: " Kuninori Morimoto
` (69 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:38 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/adi/axi-i2s.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/adi/axi-i2s.c b/sound/soc/adi/axi-i2s.c
index 7b25630757436..7c950a7b71eec 100644
--- a/sound/soc/adi/axi-i2s.c
+++ b/sound/soc/adi/axi-i2s.c
@@ -60,7 +60,7 @@ static int axi_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
struct axi_i2s *i2s = snd_soc_dai_get_drvdata(dai);
unsigned int mask, val;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
mask = AXI_I2S_CTRL_RX_EN;
else
mask = AXI_I2S_CTRL_TX_EN;
@@ -110,7 +110,7 @@ static int axi_i2s_startup(struct snd_pcm_substream *substream,
uint32_t mask;
int ret;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
mask = AXI_I2S_RESET_RX_FIFO;
else
mask = AXI_I2S_RESET_TX_FIFO;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 046/113] ASoC: amd: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (44 preceding siblings ...)
2024-08-05 0:38 ` [PATCH 045/113] ASoC: adi: " Kuninori Morimoto
@ 2024-08-05 0:38 ` Kuninori Morimoto
2024-08-05 0:38 ` [PATCH 047/113] ASoC: bcm: " Kuninori Morimoto
` (68 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:38 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/amd/acp-pcm-dma.c | 24 ++++++++++++------------
sound/soc/amd/acp/acp-i2s.c | 24 ++++++++++++------------
sound/soc/amd/acp/acp-legacy-common.c | 8 ++++----
sound/soc/amd/acp/acp-platform.c | 2 +-
sound/soc/amd/acp/acp-sdw-sof-mach.c | 4 ++--
sound/soc/amd/acp/amd.h | 2 +-
sound/soc/amd/ps/ps-pdm-dma.c | 4 ++--
sound/soc/amd/ps/ps-sdw-dma.c | 4 ++--
sound/soc/amd/raven/acp3x-i2s.c | 8 ++++----
sound/soc/amd/raven/acp3x-pcm-dma.c | 10 +++++-----
sound/soc/amd/raven/acp3x.h | 2 +-
sound/soc/amd/renoir/acp3x-pdm-dma.c | 4 ++--
sound/soc/amd/vangogh/acp5x-i2s.c | 8 ++++----
sound/soc/amd/vangogh/acp5x-pcm-dma.c | 10 +++++-----
sound/soc/amd/vangogh/acp5x.h | 2 +-
sound/soc/amd/yc/acp6x-pdm-dma.c | 4 ++--
16 files changed, 60 insertions(+), 60 deletions(-)
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c
index b857e2676fe8c..39d2b1538b27b 100644
--- a/sound/soc/amd/acp-pcm-dma.c
+++ b/sound/soc/amd/acp-pcm-dma.c
@@ -210,7 +210,7 @@ static void set_acp_sysmem_dma_descriptors(void __iomem *acp_mmio,
for (i = 0; i < NUM_DSCRS_PER_CHANNEL; i++) {
dmadscr[i].xfer_val = 0;
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
dma_dscr_idx = dma_dscr_idx + i;
dmadscr[i].dest = sram_bank + (i * (size / 2));
dmadscr[i].src = ACP_INTERNAL_APERTURE_WINDOW_0_ADDRESS
@@ -268,7 +268,7 @@ static void set_acp_to_i2s_dma_descriptors(void __iomem *acp_mmio, u32 size,
for (i = 0; i < NUM_DSCRS_PER_CHANNEL; i++) {
dmadscr[i].xfer_val = 0;
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
dma_dscr_idx = dma_dscr_idx + i;
dmadscr[i].src = sram_bank + (i * (size / 2));
/* dmadscr[i].dest is unused by hardware. */
@@ -336,7 +336,7 @@ static void config_acp_dma(void __iomem *acp_mmio,
acp_pte_config(acp_mmio, rtd->dma_addr, rtd->num_of_pages,
rtd->pte_offset);
- if (rtd->direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(rtd->direction)) {
ch_acp_sysmem = rtd->ch1;
ch_acp_i2s = rtd->ch2;
} else {
@@ -779,7 +779,7 @@ static int acp_dma_open(struct snd_soc_component *component,
if (!adata)
return -ENOMEM;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (intr_data->asic_type) {
case CHIP_STONEY:
runtime->hw = acp_st_pcm_hardware_playback;
@@ -819,7 +819,7 @@ static int acp_dma_open(struct snd_soc_component *component,
!intr_data->play_i2s_micsp_stream)
acp_reg_write(1, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
/*
* For Stoney, Memory gating is disabled,i.e SRAM Banks
* won't be turned off. The default state for SRAM banks is ON.
@@ -861,7 +861,7 @@ static int acp_dma_hw_params(struct snd_soc_component *component,
return -EINVAL;
if (pinfo) {
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
rtd->i2s_instance = pinfo->play_i2s_instance;
} else {
rtd->i2s_instance = pinfo->cap_i2s_instance;
@@ -871,7 +871,7 @@ static int acp_dma_hw_params(struct snd_soc_component *component,
if (adata->asic_type == CHIP_STONEY) {
val = acp_reg_read(adata->acp_mmio,
mmACP_I2S_16BIT_RESOLUTION_EN);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
val |= ACP_I2S_BT_16BIT_RESOLUTION_EN;
@@ -898,7 +898,7 @@ static int acp_dma_hw_params(struct snd_soc_component *component,
mmACP_I2S_16BIT_RESOLUTION_EN);
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
rtd->pte_offset = ACP_ST_BT_PLAYBACK_PTE_OFFSET;
@@ -1043,7 +1043,7 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_soc_component *component,
if (!rtd)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
period_bytes = frames_to_bytes(runtime, runtime->period_size);
bytescount = acp_get_byte_count(rtd);
if (bytescount >= rtd->bytescount)
@@ -1092,7 +1092,7 @@ static int acp_dma_prepare(struct snd_soc_component *component,
if (!rtd)
return -EINVAL;
- if (rtd->direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(rtd->direction)) {
ch_acp_sysmem = rtd->ch1;
ch_acp_i2s = rtd->ch2;
} else {
@@ -1125,7 +1125,7 @@ static int acp_dma_trigger(struct snd_soc_component *component,
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
rtd->bytescount = acp_get_byte_count(rtd);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
if (rtd->capture_channel == CAP_CHANNEL0) {
acp_dma_cap_channel_disable(rtd->acp_mmio,
CAP_CHANNEL1);
@@ -1190,7 +1190,7 @@ static int acp_dma_close(struct snd_soc_component *component,
struct audio_substream_data *rtd = runtime->private_data;
struct audio_drv_data *adata = dev_get_drvdata(component->dev);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
adata->play_i2sbt_stream = NULL;
diff --git a/sound/soc/amd/acp/acp-i2s.c b/sound/soc/amd/acp/acp-i2s.c
index 97258b4cf89b0..eafa6262e6feb 100644
--- a/sound/soc/amd/acp/acp-i2s.c
+++ b/sound/soc/amd/acp/acp-i2s.c
@@ -132,10 +132,10 @@ static int acp_i2s_set_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, u32 rx_mas
spin_lock_irq(&adata->acp_lock);
list_for_each_entry(stream, &adata->stream_list, list) {
- if (tx_mask && stream->dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (tx_mask && snd_pcm_is_playback(stream->dir))
adata->tdm_tx_fmt[stream->dai_id - 1] =
FRM_LEN | (slots << 15) | (slot_len << 18);
- else if (rx_mask && stream->dir == SNDRV_PCM_STREAM_CAPTURE)
+ else if (rx_mask && snd_pcm_is_capture(stream->dir))
adata->tdm_rx_fmt[stream->dai_id - 1] =
FRM_LEN | (slots << 15) | (slot_len << 18);
}
@@ -176,7 +176,7 @@ static int acp_i2s_hwparams(struct snd_pcm_substream *substream, struct snd_pcm_
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (dai->driver->id) {
case I2S_BT_INSTANCE:
reg_val = ACP_BTTDM_ITER;
@@ -224,7 +224,7 @@ static int acp_i2s_hwparams(struct snd_pcm_substream *substream, struct snd_pcm_
if (adata->tdm_mode) {
val = readl(adata->acp_base + reg_val);
writel(val | BIT(1), adata->acp_base + reg_val);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
tdm_fmt = adata->tdm_tx_fmt[dai->driver->id - 1];
else
tdm_fmt = adata->tdm_rx_fmt[dai->driver->id - 1];
@@ -318,7 +318,7 @@ static int acp_i2s_trigger(struct snd_pcm_substream *substream, int cmd, struct
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
stream->bytescount = acp_get_byte_count(adata, stream->dai_id, substream->stream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (dai->driver->id) {
case I2S_BT_INSTANCE:
water_val = ACP_BT_TX_INTR_WATERMARK_SIZE;
@@ -379,7 +379,7 @@ static int acp_i2s_trigger(struct snd_pcm_substream *substream, int cmd, struct
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (dai->driver->id) {
case I2S_BT_INSTANCE:
reg_val = ACP_BTTDM_ITER;
@@ -444,7 +444,7 @@ static int acp_i2s_prepare(struct snd_pcm_substream *substream, struct snd_soc_d
switch (dai->driver->id) {
case I2S_SP_INSTANCE:
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
reg_dma_size = ACP_I2S_TX_DMA_SIZE;
acp_fifo_addr = rsrc->sram_pte_offset +
SP_PB_FIFO_ADDR_OFFSET;
@@ -464,7 +464,7 @@ static int acp_i2s_prepare(struct snd_pcm_substream *substream, struct snd_soc_d
}
break;
case I2S_BT_INSTANCE:
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
reg_dma_size = ACP_BT_TX_DMA_SIZE;
acp_fifo_addr = rsrc->sram_pte_offset +
BT_PB_FIFO_ADDR_OFFSET;
@@ -485,7 +485,7 @@ static int acp_i2s_prepare(struct snd_pcm_substream *substream, struct snd_soc_d
}
break;
case I2S_HS_INSTANCE:
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
reg_dma_size = ACP_HS_TX_DMA_SIZE;
acp_fifo_addr = rsrc->sram_pte_offset +
HS_PB_FIFO_ADDR_OFFSET;
@@ -538,7 +538,7 @@ static int acp_i2s_startup(struct snd_pcm_substream *substream, struct snd_soc_d
switch (dai->driver->id) {
case I2S_SP_INSTANCE:
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
irq_bit = BIT(I2S_TX_THRESHOLD(rsrc->offset));
stream->pte_offset = ACP_SRAM_SP_PB_PTE_OFFSET;
stream->fifo_offset = SP_PB_FIFO_ADDR_OFFSET;
@@ -549,7 +549,7 @@ static int acp_i2s_startup(struct snd_pcm_substream *substream, struct snd_soc_d
}
break;
case I2S_BT_INSTANCE:
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
irq_bit = BIT(BT_TX_THRESHOLD(rsrc->offset));
stream->pte_offset = ACP_SRAM_BT_PB_PTE_OFFSET;
stream->fifo_offset = BT_PB_FIFO_ADDR_OFFSET;
@@ -560,7 +560,7 @@ static int acp_i2s_startup(struct snd_pcm_substream *substream, struct snd_soc_d
}
break;
case I2S_HS_INSTANCE:
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
irq_bit = BIT(HS_TX_THRESHOLD(rsrc->offset));
stream->pte_offset = ACP_SRAM_HS_PB_PTE_OFFSET;
stream->fifo_offset = HS_PB_FIFO_ADDR_OFFSET;
diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c
index 4422cec81e3c4..35cd4b2b86cf2 100644
--- a/sound/soc/amd/acp/acp-legacy-common.c
+++ b/sound/soc/amd/acp/acp-legacy-common.c
@@ -112,7 +112,7 @@ static int set_acp_i2s_dma_fifo(struct snd_pcm_substream *substream,
switch (dai->driver->id) {
case I2S_SP_INSTANCE:
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
reg_dma_size = ACP_I2S_TX_DMA_SIZE;
acp_fifo_addr = rsrc->sram_pte_offset +
SP_PB_FIFO_ADDR_OFFSET;
@@ -131,7 +131,7 @@ static int set_acp_i2s_dma_fifo(struct snd_pcm_substream *substream,
}
break;
case I2S_BT_INSTANCE:
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
reg_dma_size = ACP_BT_TX_DMA_SIZE;
acp_fifo_addr = rsrc->sram_pte_offset +
BT_PB_FIFO_ADDR_OFFSET;
@@ -150,7 +150,7 @@ static int set_acp_i2s_dma_fifo(struct snd_pcm_substream *substream,
}
break;
case I2S_HS_INSTANCE:
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
reg_dma_size = ACP_HS_TX_DMA_SIZE;
acp_fifo_addr = rsrc->sram_pte_offset +
HS_PB_FIFO_ADDR_OFFSET;
@@ -199,7 +199,7 @@ int restore_acp_i2s_params(struct snd_pcm_substream *substream,
soc_runtime = snd_soc_substream_to_rtd(substream);
dai = snd_soc_rtd_to_cpu(soc_runtime, 0);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
tdm_fmt = adata->tdm_tx_fmt[stream->dai_id - 1];
switch (stream->dai_id) {
case I2S_BT_INSTANCE:
diff --git a/sound/soc/amd/acp/acp-platform.c b/sound/soc/amd/acp/acp-platform.c
index 4f409cd09c11c..d4b7355a1d989 100644
--- a/sound/soc/amd/acp/acp-platform.c
+++ b/sound/soc/amd/acp/acp-platform.c
@@ -192,7 +192,7 @@ static int acp_dma_open(struct snd_soc_component *component, struct snd_pcm_subs
stream->substream = substream;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
runtime->hw = acp_pcm_hardware_playback;
else
runtime->hw = acp_pcm_hardware_capture;
diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-sdw-sof-mach.c
index 3419675e45a98..85f9fcbfe822b 100644
--- a/sound/soc/amd/acp/acp-sdw-sof-mach.c
+++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c
@@ -450,8 +450,8 @@ static int create_sdw_dailink(struct snd_soc_card *card,
cpus[k].dai_name = cpu_name;
}
- playback = (stream == SNDRV_PCM_STREAM_PLAYBACK);
- capture = (stream == SNDRV_PCM_STREAM_CAPTURE);
+ playback = snd_pcm_is_playback(stream);
+ capture = snd_pcm_is_capture(stream);
asoc_sdw_init_dai_link(dev, *dai_links, be_id, name,
playback, capture,
cpus, cpu_dai_num,
diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h
index 87a4813783f91..90b0716e5f2f5 100644
--- a/sound/soc/amd/acp/amd.h
+++ b/sound/soc/amd/acp/amd.h
@@ -253,7 +253,7 @@ static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int
{
u64 byte_count = 0, low = 0, high = 0;
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
switch (dai_id) {
case I2S_BT_INSTANCE:
high = readl(adata->acp_base + ACP_BT_TX_LINEARPOSITIONCNTR_HIGH);
diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c
index 7bbacbab10950..256271a270286 100644
--- a/sound/soc/amd/ps/ps-pdm-dma.c
+++ b/sound/soc/amd/ps/ps-pdm-dma.c
@@ -193,7 +193,7 @@ static int acp63_pdm_dma_open(struct snd_soc_component *component,
if (!pdm_data)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
runtime->hw = acp63_pdm_hardware_capture;
ret = snd_pcm_hw_constraint_integer(runtime,
@@ -206,7 +206,7 @@ static int acp63_pdm_dma_open(struct snd_soc_component *component,
acp63_enable_pdm_interrupts(adata);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
adata->capture_stream = substream;
pdm_data->acp63_base = adata->acp63_base;
diff --git a/sound/soc/amd/ps/ps-sdw-dma.c b/sound/soc/amd/ps/ps-sdw-dma.c
index 2f630753278dc..0f253912f032e 100644
--- a/sound/soc/amd/ps/ps-sdw-dma.c
+++ b/sound/soc/amd/ps/ps-sdw-dma.c
@@ -228,7 +228,7 @@ static int acp63_sdw_dma_open(struct snd_soc_component *component,
if (!stream)
return -ENOMEM;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
runtime->hw = acp63_sdw_hardware_playback;
else
runtime->hw = acp63_sdw_hardware_capture;
@@ -270,7 +270,7 @@ static int acp63_sdw_dma_hw_params(struct snd_soc_component *component,
sdw_data->sdw0_dma_stream[stream_id] = substream;
water_mark_size_reg = sdw0_dma_ring_buf_reg[stream_id].water_mark_size_reg;
acp_ext_intr_cntl_reg = ACP_EXTERNAL_INTR_CNTL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
irq_mask = BIT(SDW0_DMA_TX_IRQ_MASK(stream_id));
else
irq_mask = BIT(SDW0_DMA_RX_IRQ_MASK(stream_id));
diff --git a/sound/soc/amd/raven/acp3x-i2s.c b/sound/soc/amd/raven/acp3x-i2s.c
index e7f2a05e802cf..8debcd2487fe6 100644
--- a/sound/soc/amd/raven/acp3x-i2s.c
+++ b/sound/soc/amd/raven/acp3x-i2s.c
@@ -86,7 +86,7 @@ static int acp3x_i2s_hwparams(struct snd_pcm_substream *substream,
adata = snd_soc_dai_get_drvdata(dai);
pinfo = snd_soc_card_get_drvdata(card);
if (pinfo) {
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
rtd->i2s_instance = pinfo->play_i2s_instance;
else
rtd->i2s_instance = pinfo->cap_i2s_instance;
@@ -110,7 +110,7 @@ static int acp3x_i2s_hwparams(struct snd_pcm_substream *substream,
default:
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
reg_val = mmACP_BTTDM_ITER;
@@ -163,7 +163,7 @@ static int acp3x_i2s_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
rtd->bytescount = acp_get_byte_count(rtd,
substream->stream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
water_val =
@@ -209,7 +209,7 @@ static int acp3x_i2s_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
reg_val = mmACP_BTTDM_ITER;
diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c
index 3a50558f67516..0a6d63db2e52f 100644
--- a/sound/soc/amd/raven/acp3x-pcm-dma.c
+++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
@@ -113,7 +113,7 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
addr = rtd->dma_addr;
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
val = ACP_SRAM_BT_PB_PTE_OFFSET;
@@ -152,7 +152,7 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
addr += PAGE_SIZE;
}
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
reg_dma_size = mmACP_BT_TX_DMA_SIZE;
@@ -222,7 +222,7 @@ static int acp3x_dma_open(struct snd_soc_component *component,
if (!i2s_data)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
runtime->hw = acp3x_pcm_hardware_playback;
else
runtime->hw = acp3x_pcm_hardware_capture;
@@ -261,7 +261,7 @@ static int acp3x_dma_hw_params(struct snd_soc_component *component,
return -EINVAL;
if (pinfo) {
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
rtd->i2s_instance = pinfo->play_i2s_instance;
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
@@ -334,7 +334,7 @@ static int acp3x_dma_close(struct snd_soc_component *component,
if (!ins)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (ins->i2s_instance) {
case I2S_BT_INSTANCE:
adata->play_stream = NULL;
diff --git a/sound/soc/amd/raven/acp3x.h b/sound/soc/amd/raven/acp3x.h
index 7702f628ecd68..2200c4f5ebfdd 100644
--- a/sound/soc/amd/raven/acp3x.h
+++ b/sound/soc/amd/raven/acp3x.h
@@ -126,7 +126,7 @@ static inline u64 acp_get_byte_count(struct i2s_stream_instance *rtd,
{
u64 byte_count;
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
byte_count = rv_readl(rtd->acp3x_base +
diff --git a/sound/soc/amd/renoir/acp3x-pdm-dma.c b/sound/soc/amd/renoir/acp3x-pdm-dma.c
index c3b47e9bd2392..0bcd20ec70a6e 100644
--- a/sound/soc/amd/renoir/acp3x-pdm-dma.c
+++ b/sound/soc/amd/renoir/acp3x-pdm-dma.c
@@ -215,7 +215,7 @@ static int acp_pdm_dma_open(struct snd_soc_component *component,
if (!pdm_data)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
runtime->hw = acp_pdm_hardware_capture;
ret = snd_pcm_hw_constraint_integer(runtime,
@@ -228,7 +228,7 @@ static int acp_pdm_dma_open(struct snd_soc_component *component,
enable_pdm_interrupts(adata->acp_base);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
adata->capture_stream = substream;
pdm_data->acp_base = adata->acp_base;
diff --git a/sound/soc/amd/vangogh/acp5x-i2s.c b/sound/soc/amd/vangogh/acp5x-i2s.c
index 7dbe33f4b8678..9e05816d4f5c1 100644
--- a/sound/soc/amd/vangogh/acp5x-i2s.c
+++ b/sound/soc/amd/vangogh/acp5x-i2s.c
@@ -101,7 +101,7 @@ static int acp5x_i2s_hwparams(struct snd_pcm_substream *substream,
adata = snd_soc_dai_get_drvdata(dai);
pinfo = snd_soc_card_get_drvdata(card);
if (pinfo) {
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
rtd->i2s_instance = pinfo->play_i2s_instance;
else
rtd->i2s_instance = pinfo->cap_i2s_instance;
@@ -125,7 +125,7 @@ static int acp5x_i2s_hwparams(struct snd_pcm_substream *substream,
default:
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (rtd->i2s_instance) {
case I2S_HS_INSTANCE:
reg_val = ACP_HSTDM_ITER;
@@ -249,7 +249,7 @@ static int acp5x_i2s_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
rtd->bytescount = acp_get_byte_count(rtd,
substream->stream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (rtd->i2s_instance) {
case I2S_HS_INSTANCE:
water_val =
@@ -297,7 +297,7 @@ static int acp5x_i2s_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (rtd->i2s_instance) {
case I2S_HS_INSTANCE:
reg_val = ACP_HSTDM_ITER;
diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
index 491b16e52a72a..73b4d879bbfcc 100644
--- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c
+++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
@@ -108,7 +108,7 @@ static void config_acp5x_dma(struct i2s_stream_instance *rtd, int direction)
dma_addr_t addr;
addr = rtd->dma_addr;
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
switch (rtd->i2s_instance) {
case I2S_HS_INSTANCE:
val = ACP_SRAM_HS_PB_PTE_OFFSET;
@@ -146,7 +146,7 @@ static void config_acp5x_dma(struct i2s_stream_instance *rtd, int direction)
addr += PAGE_SIZE;
}
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
switch (rtd->i2s_instance) {
case I2S_HS_INSTANCE:
reg_dma_size = ACP_HS_TX_DMA_SIZE;
@@ -217,7 +217,7 @@ static int acp5x_dma_open(struct snd_soc_component *component,
if (!i2s_data)
return -ENOMEM;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
runtime->hw = acp5x_pcm_hardware_playback;
else
runtime->hw = acp5x_pcm_hardware_capture;
@@ -255,7 +255,7 @@ static int acp5x_dma_hw_params(struct snd_soc_component *component,
return -EINVAL;
if (pinfo) {
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
rtd->i2s_instance = pinfo->play_i2s_instance;
switch (rtd->i2s_instance) {
case I2S_HS_INSTANCE:
@@ -328,7 +328,7 @@ static int acp5x_dma_close(struct snd_soc_component *component,
ins = substream->runtime->private_data;
if (!ins)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (ins->i2s_instance) {
case I2S_HS_INSTANCE:
adata->play_stream = NULL;
diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h
index ac1936a8c43ff..0d08e734f0db6 100644
--- a/sound/soc/amd/vangogh/acp5x.h
+++ b/sound/soc/amd/vangogh/acp5x.h
@@ -154,7 +154,7 @@ static inline u64 acp_get_byte_count(struct i2s_stream_instance *rtd,
{
union acp_dma_count byte_count;
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
switch (rtd->i2s_instance) {
case I2S_HS_INSTANCE:
byte_count.bcount.high =
diff --git a/sound/soc/amd/yc/acp6x-pdm-dma.c b/sound/soc/amd/yc/acp6x-pdm-dma.c
index 72c4591e451bd..74ecea36e3dd5 100644
--- a/sound/soc/amd/yc/acp6x-pdm-dma.c
+++ b/sound/soc/amd/yc/acp6x-pdm-dma.c
@@ -191,7 +191,7 @@ static int acp6x_pdm_dma_open(struct snd_soc_component *component,
if (!pdm_data)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
runtime->hw = acp6x_pdm_hardware_capture;
ret = snd_pcm_hw_constraint_integer(runtime,
@@ -204,7 +204,7 @@ static int acp6x_pdm_dma_open(struct snd_soc_component *component,
acp6x_enable_pdm_interrupts(adata->acp6x_base);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
adata->capture_stream = substream;
pdm_data->acp6x_base = adata->acp6x_base;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 047/113] ASoC: bcm: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (45 preceding siblings ...)
2024-08-05 0:38 ` [PATCH 046/113] ASoC: amd: " Kuninori Morimoto
@ 2024-08-05 0:38 ` Kuninori Morimoto
2024-08-05 0:39 ` [PATCH 048/113] ASoC: dwc: " Kuninori Morimoto
` (67 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:38 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/bcm/bcm2835-i2s.c | 8 ++++----
sound/soc/bcm/bcm63xx-i2s-whistler.c | 4 ++--
sound/soc/bcm/bcm63xx-pcm-whistler.c | 4 ++--
sound/soc/bcm/cygnus-pcm.c | 18 +++++++++---------
sound/soc/bcm/cygnus-ssp.c | 12 ++++++------
5 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
index 9bda6499e66e1..54fcf85a1158c 100644
--- a/sound/soc/bcm/bcm2835-i2s.c
+++ b/sound/soc/bcm/bcm2835-i2s.c
@@ -628,10 +628,10 @@ static int bcm2835_i2s_prepare(struct snd_pcm_substream *substream,
*/
regmap_read(dev->i2s_regmap, BCM2835_I2S_CS_A_REG, &cs_reg);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK
+ if (snd_pcm_is_playback(substream)
&& !(cs_reg & BCM2835_I2S_TXE))
bcm2835_i2s_clear_fifos(dev, true, false);
- else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE
+ else if (snd_pcm_is_capture(substream)
&& (cs_reg & BCM2835_I2S_RXD))
bcm2835_i2s_clear_fifos(dev, false, true);
@@ -644,7 +644,7 @@ static void bcm2835_i2s_stop(struct bcm2835_i2s_dev *dev,
{
uint32_t mask;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
mask = BCM2835_I2S_RXON;
else
mask = BCM2835_I2S_TXON;
@@ -669,7 +669,7 @@ static int bcm2835_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
bcm2835_i2s_start_clock(dev);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
mask = BCM2835_I2S_RXON;
else
mask = BCM2835_I2S_TXON;
diff --git a/sound/soc/bcm/bcm63xx-i2s-whistler.c b/sound/soc/bcm/bcm63xx-i2s-whistler.c
index c64609718738b..0980e35d12830 100644
--- a/sound/soc/bcm/bcm63xx-i2s-whistler.c
+++ b/sound/soc/bcm/bcm63xx-i2s-whistler.c
@@ -93,7 +93,7 @@ static int bcm63xx_i2s_startup(struct snd_pcm_substream *substream,
struct bcm_i2s_priv *i2s_priv = snd_soc_dai_get_drvdata(dai);
struct regmap *regmap_i2s = i2s_priv->regmap_i2s;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
regmap_update_bits(regmap_i2s, I2S_TX_CFG,
I2S_TX_OUT_R | I2S_TX_DATA_ALIGNMENT |
I2S_TX_DATA_ENABLE | I2S_TX_CLOCK_ENABLE,
@@ -146,7 +146,7 @@ static void bcm63xx_i2s_shutdown(struct snd_pcm_substream *substream,
struct bcm_i2s_priv *i2s_priv = snd_soc_dai_get_drvdata(dai);
struct regmap *regmap_i2s = i2s_priv->regmap_i2s;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
regmap_update_bits(regmap_i2s, I2S_TX_CFG,
I2S_TX_OUT_R | I2S_TX_DATA_ALIGNMENT |
I2S_TX_DATA_ENABLE | I2S_TX_CLOCK_ENABLE, 0);
diff --git a/sound/soc/bcm/bcm63xx-pcm-whistler.c b/sound/soc/bcm/bcm63xx-pcm-whistler.c
index 018f2372e892c..e8542b2009f63 100644
--- a/sound/soc/bcm/bcm63xx-pcm-whistler.c
+++ b/sound/soc/bcm/bcm63xx-pcm-whistler.c
@@ -81,7 +81,7 @@ static int bcm63xx_pcm_trigger(struct snd_soc_component *component,
i2s_priv = dev_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0)->dev);
regmap_i2s = i2s_priv->regmap_i2s;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
regmap_update_bits(regmap_i2s,
@@ -153,7 +153,7 @@ static int bcm63xx_pcm_prepare(struct snd_soc_component *component,
dma_desc->dma_addr = runtime->dma_addr;
dma_desc->dma_area = runtime->dma_area;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
regaddr_desclen = I2S_TX_DESC_IFF_LEN;
regaddr_descaddr = I2S_TX_DESC_IFF_ADDR;
} else {
diff --git a/sound/soc/bcm/cygnus-pcm.c b/sound/soc/bcm/cygnus-pcm.c
index 2d1e241d83673..3dc204d0a34c6 100644
--- a/sound/soc/bcm/cygnus-pcm.c
+++ b/sound/soc/bcm/cygnus-pcm.c
@@ -252,7 +252,7 @@ static int configure_ringbuf_regs(struct snd_pcm_substream *substream)
aio = cygnus_dai_get_dma_data(substream);
/* Map the ssp portnum to a set of ring buffers. */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
p_rbuf = &aio->play_rb_regs;
switch (aio->portnum) {
@@ -299,7 +299,7 @@ static struct ringbuf_regs *get_ringbuf(struct snd_pcm_substream *substream)
aio = cygnus_dai_get_dma_data(substream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
p_rbuf = &aio->play_rb_regs;
else
p_rbuf = &aio->capture_rb_regs;
@@ -317,7 +317,7 @@ static void enable_intr(struct snd_pcm_substream *substream)
/* The port number maps to the bit position to be cleared */
clear_mask = BIT(aio->portnum);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
/* Clear interrupt status before enabling them */
writel(clear_mask, aio->cygaud->audio + ESR0_STATUS_CLR_OFFSET);
writel(clear_mask, aio->cygaud->audio + ESR1_STATUS_CLR_OFFSET);
@@ -354,7 +354,7 @@ static void disable_intr(struct snd_pcm_substream *substream)
/* The port number maps to the bit position to be set */
set_mask = BIT(aio->portnum);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
/* Mask the interrupts of the given port*/
writel(set_mask, aio->cygaud->audio + ESR0_MASK_SET_OFFSET);
writel(set_mask, aio->cygaud->audio + ESR1_MASK_SET_OFFSET);
@@ -404,7 +404,7 @@ static void cygnus_pcm_period_elapsed(struct snd_pcm_substream *substream)
*/
snd_pcm_period_elapsed(substream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
/* Set the ring buffer to full */
regval = readl(aio->cygaud->audio + p_rbuf->rdaddr);
regval = regval ^ BIT(31);
@@ -597,7 +597,7 @@ static int cygnus_pcm_open(struct snd_soc_component *component,
* Keep track of which substream belongs to which port.
* This info is needed by snd_pcm_period_elapsed() in irq_handler
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
aio->play_stream = substream;
else
aio->capture_stream = substream;
@@ -615,7 +615,7 @@ static int cygnus_pcm_close(struct snd_soc_component *component,
dev_dbg(snd_soc_rtd_to_cpu(rtd, 0)->dev, "%s port %d\n", __func__, aio->portnum);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
aio->play_stream = NULL;
else
aio->capture_stream = NULL;
@@ -652,7 +652,7 @@ static int cygnus_pcm_prepare(struct snd_soc_component *component,
start = runtime->dma_addr;
- is_play = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 1 : 0;
+ is_play = snd_pcm_is_playback(substream);
ringbuf_set_initial(aio->cygaud->audio, p_rbuf, is_play, start,
periodsize, bufsize);
@@ -674,7 +674,7 @@ static snd_pcm_uframes_t cygnus_pcm_pointer(struct snd_soc_component *component,
* index (for capture). Report this value back to the asoc framework.
*/
p_rbuf = get_ringbuf(substream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
cur = readl(aio->cygaud->audio + p_rbuf->rdaddr);
else
cur = readl(aio->cygaud->audio + p_rbuf->wraddr);
diff --git a/sound/soc/bcm/cygnus-ssp.c b/sound/soc/bcm/cygnus-ssp.c
index 90088516fed01..73c231f5c1ed8 100644
--- a/sound/soc/bcm/cygnus-ssp.c
+++ b/sound/soc/bcm/cygnus-ssp.c
@@ -642,7 +642,7 @@ static int cygnus_ssp_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
value = readl(aio->cygaud->audio + aio->regs.bf_sourcech_cfg);
value &= ~BIT(BF_SRC_CFGX_BUFFER_PAIR_ENABLE);
value &= ~BIT(BF_SRC_CFGX_SAMPLE_CH_MODE);
@@ -736,7 +736,7 @@ static int cygnus_ssp_startup(struct snd_pcm_substream *substream,
struct cygnus_aio_port *aio = cygnus_dai_get_portinfo(dai);
snd_soc_dai_set_dma_data(dai, substream, aio);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
aio->clk_trace.play_en = true;
else
aio->clk_trace.cap_en = true;
@@ -754,7 +754,7 @@ static void cygnus_ssp_shutdown(struct snd_pcm_substream *substream,
{
struct cygnus_aio_port *aio = cygnus_dai_get_portinfo(dai);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
aio->clk_trace.play_en = false;
else
aio->clk_trace.cap_en = false;
@@ -770,7 +770,7 @@ static void cygnus_ssp_shutdown(struct snd_pcm_substream *substream,
return;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
if (aio->clk_trace.play_clk_en) {
clk_disable_unprepare(aio->cygaud->
audio_clk[val]);
@@ -932,7 +932,7 @@ static int cygnus_ssp_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
audio_ssp_out_enable(aio);
else
audio_ssp_in_enable(aio);
@@ -943,7 +943,7 @@ static int cygnus_ssp_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
audio_ssp_out_disable(aio);
else
audio_ssp_in_disable(aio);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 048/113] ASoC: dwc: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (46 preceding siblings ...)
2024-08-05 0:38 ` [PATCH 047/113] ASoC: bcm: " Kuninori Morimoto
@ 2024-08-05 0:39 ` Kuninori Morimoto
2024-08-05 0:39 ` [PATCH 049/113] ASoC: fsl: " Kuninori Morimoto
` (66 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/dwc/dwc-i2s.c | 20 ++++++++++----------
sound/soc/dwc/dwc-pcm.c | 6 +++---
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c
index c04466f5492e9..874d5bf2985e6 100644
--- a/sound/soc/dwc/dwc-i2s.c
+++ b/sound/soc/dwc/dwc-i2s.c
@@ -42,7 +42,7 @@ static inline void i2s_disable_channels(struct dw_i2s_dev *dev, u32 stream)
{
u32 i = 0;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
for (i = 0; i < 4; i++)
i2s_write_reg(dev->i2s_base, TER(i), 0);
} else {
@@ -55,7 +55,7 @@ static inline void i2s_clear_irqs(struct dw_i2s_dev *dev, u32 stream)
{
u32 i = 0;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
for (i = 0; i < 4; i++)
i2s_read_reg(dev->i2s_base, TOR(i));
} else {
@@ -69,7 +69,7 @@ static inline void i2s_disable_irqs(struct dw_i2s_dev *dev, u32 stream,
{
u32 i, irq;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
for (i = 0; i < (chan_nr / 2); i++) {
irq = i2s_read_reg(dev->i2s_base, IMR(i));
i2s_write_reg(dev->i2s_base, IMR(i), irq | 0x30);
@@ -87,7 +87,7 @@ static inline void i2s_enable_irqs(struct dw_i2s_dev *dev, u32 stream,
{
u32 i, irq;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
for (i = 0; i < (chan_nr / 2); i++) {
irq = i2s_read_reg(dev->i2s_base, IMR(i));
i2s_write_reg(dev->i2s_base, IMR(i), irq & ~0x30);
@@ -156,7 +156,7 @@ static void i2s_enable_dma(struct dw_i2s_dev *dev, u32 stream)
u32 dma_reg = i2s_read_reg(dev->i2s_base, I2S_DMACR);
/* Enable DMA handshake for stream */
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
dma_reg |= I2S_DMAEN_TXBLOCK;
else
dma_reg |= I2S_DMAEN_RXBLOCK;
@@ -169,7 +169,7 @@ static void i2s_disable_dma(struct dw_i2s_dev *dev, u32 stream)
u32 dma_reg = i2s_read_reg(dev->i2s_base, I2S_DMACR);
/* Disable DMA handshake for stream */
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
dma_reg &= ~I2S_DMAEN_TXBLOCK;
i2s_write_reg(dev->i2s_base, I2S_RTXDMA, 1);
} else {
@@ -194,7 +194,7 @@ static void i2s_start(struct dw_i2s_dev *dev,
i2s_write_reg(dev->i2s_base, IER, reg);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
i2s_write_reg(dev->i2s_base, ITER, 1);
else
i2s_write_reg(dev->i2s_base, IRER, 1);
@@ -213,7 +213,7 @@ static void i2s_stop(struct dw_i2s_dev *dev,
{
i2s_clear_irqs(dev, substream->stream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
i2s_write_reg(dev->i2s_base, ITER, 0);
else
i2s_write_reg(dev->i2s_base, IRER, 0);
@@ -253,7 +253,7 @@ static void dw_i2s_config(struct dw_i2s_dev *dev, int stream)
i2s_disable_channels(dev, stream);
for (ch_reg = 0; ch_reg < (config->chan_nr / 2); ch_reg++) {
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
i2s_write_reg(dev->i2s_base, TCR(ch_reg),
dev->xfer_resolution);
i2s_write_reg(dev->i2s_base, TFCR(ch_reg),
@@ -352,7 +352,7 @@ static int dw_i2s_prepare(struct snd_pcm_substream *substream,
{
struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
i2s_write_reg(dev->i2s_base, TXFFR, 1);
else
i2s_write_reg(dev->i2s_base, RXFFR, 1);
diff --git a/sound/soc/dwc/dwc-pcm.c b/sound/soc/dwc/dwc-pcm.c
index a418265c030a5..673218e010607 100644
--- a/sound/soc/dwc/dwc-pcm.c
+++ b/sound/soc/dwc/dwc-pcm.c
@@ -200,7 +200,7 @@ static int dw_pcm_trigger(struct snd_soc_component *component,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
WRITE_ONCE(dev->tx_ptr, 0);
rcu_assign_pointer(dev->tx_substream, substream);
} else {
@@ -211,7 +211,7 @@ static int dw_pcm_trigger(struct snd_soc_component *component,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
rcu_assign_pointer(dev->tx_substream, NULL);
else
rcu_assign_pointer(dev->rx_substream, NULL);
@@ -231,7 +231,7 @@ static snd_pcm_uframes_t dw_pcm_pointer(struct snd_soc_component *component,
struct dw_i2s_dev *dev = runtime->private_data;
snd_pcm_uframes_t pos;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
pos = READ_ONCE(dev->tx_ptr);
else
pos = READ_ONCE(dev->rx_ptr);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 049/113] ASoC: fsl: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (47 preceding siblings ...)
2024-08-05 0:39 ` [PATCH 048/113] ASoC: dwc: " Kuninori Morimoto
@ 2024-08-05 0:39 ` Kuninori Morimoto
2024-08-05 0:39 ` [PATCH 050/113] ASoC: mxs: " Kuninori Morimoto
` (65 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/fsl/fsl-asoc-card.c | 2 +-
sound/soc/fsl/fsl_asrc.c | 2 +-
sound/soc/fsl/fsl_asrc_dma.c | 8 ++++----
sound/soc/fsl/fsl_audmix.c | 2 +-
sound/soc/fsl/fsl_dma.c | 10 +++++-----
sound/soc/fsl/fsl_easrc.c | 2 +-
sound/soc/fsl/fsl_esai.c | 4 ++--
sound/soc/fsl/fsl_qmc_audio.c | 10 +++++-----
sound/soc/fsl/fsl_sai.c | 8 ++++----
sound/soc/fsl/fsl_spdif.c | 8 ++++----
sound/soc/fsl/fsl_ssi.c | 6 +++---
sound/soc/fsl/fsl_xcvr.c | 8 ++++----
sound/soc/fsl/imx-audmix.c | 4 ++--
sound/soc/fsl/imx-hdmi.c | 2 +-
sound/soc/fsl/imx-pcm-fiq.c | 8 ++++----
sound/soc/fsl/imx-pcm-rpmsg.c | 24 ++++++++++++------------
sound/soc/fsl/lpc3xxx-i2s.c | 10 +++++-----
sound/soc/fsl/mpc5200_dma.c | 10 +++++-----
sound/soc/fsl/mpc5200_dma.h | 2 +-
sound/soc/fsl/mpc5200_psc_ac97.c | 2 +-
20 files changed, 66 insertions(+), 66 deletions(-)
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index f6c3aeff0d8ea..29f32bf65c19f 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -171,7 +171,7 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
struct codec_priv *codec_priv;
struct snd_soc_dai *codec_dai;
struct cpu_priv *cpu_priv = &priv->cpu_priv;
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index b793263291dc8..42d08db984e17 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -719,7 +719,7 @@ static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream,
config.pair = pair->index;
config.channel_num = channels;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
config.input_format = params_format(params);
config.output_format = asrc->asrc_format;
config.input_sample_rate = rate;
diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c
index f501f47242fb0..abde5badf8383 100644
--- a/sound/soc/fsl/fsl_asrc_dma.c
+++ b/sound/soc/fsl/fsl_asrc_dma.c
@@ -55,7 +55,7 @@ static void fsl_asrc_dma_complete(void *arg)
static int fsl_asrc_dma_prepare_and_submit(struct snd_pcm_substream *substream,
struct snd_soc_component *component)
{
- u8 dir = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? OUT : IN;
+ u8 dir = snd_pcm_is_playback(substream) ? OUT : IN;
struct snd_pcm_runtime *runtime = substream->runtime;
struct fsl_asrc_pair *pair = runtime->private_data;
struct device *dev = component->dev;
@@ -131,7 +131,7 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component,
enum dma_slave_buswidth buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
enum sdma_peripheral_type be_peripheral_type = IMX_DMATYPE_SSI;
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
struct snd_dmaengine_dai_dma_data *dma_params_fe = NULL;
struct snd_dmaengine_dai_dma_data *dma_params_be = NULL;
struct snd_pcm_runtime *runtime = substream->runtime;
@@ -308,7 +308,7 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component,
static int fsl_asrc_dma_hw_free(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
struct fsl_asrc_pair *pair = runtime->private_data;
u8 dir = tx ? OUT : IN;
@@ -329,7 +329,7 @@ static int fsl_asrc_dma_hw_free(struct snd_soc_component *component,
static int fsl_asrc_dma_startup(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_dmaengine_dai_dma_data *dma_data;
diff --git a/sound/soc/fsl/fsl_audmix.c b/sound/soc/fsl/fsl_audmix.c
index 1671a3037c604..1ee3f8f919695 100644
--- a/sound/soc/fsl/fsl_audmix.c
+++ b/sound/soc/fsl/fsl_audmix.c
@@ -283,7 +283,7 @@ static int fsl_audmix_dai_trigger(struct snd_pcm_substream *substream, int cmd,
unsigned long lock_flags;
/* Capture stream shall not be handled */
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
return 0;
switch (cmd) {
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index c4bc9395dff7d..6754ea7372da0 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -166,7 +166,7 @@ static void fsl_dma_update_pointers(struct fsl_dma_private *dma_private)
* system, we also need to update the ESAD bits. We also set (keep) the
* snoop bits. See the comments in fsl_dma_hw_params() about snooping.
*/
- if (dma_private->substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dma_private->substream)) {
link->source_addr = cpu_to_be32(dma_private->dma_buf_next);
#ifdef CONFIG_PHYS_64BIT
link->source_attr = cpu_to_be32(CCSR_DMA_ATR_SNOOP |
@@ -395,7 +395,7 @@ static int fsl_dma_open(struct snd_soc_component *component,
dev_err(dev, "can't allocate dma private data\n");
return -ENOMEM;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dma_private->ssi_sxx_phys = dma->ssi_stx_phys;
else
dma_private->ssi_sxx_phys = dma->ssi_srx_phys;
@@ -473,7 +473,7 @@ static int fsl_dma_open(struct snd_soc_component *component,
/* For playback, we want the destination address to be held. For
capture, set the source address to be held. */
- mr |= (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+ mr |= (snd_pcm_is_playback(substream)) ?
CCSR_DMA_MR_DAHE : CCSR_DMA_MR_SAHE;
out_be32(&dma_channel->mr, mr);
@@ -633,7 +633,7 @@ static int fsl_dma_hw_params(struct snd_soc_component *component,
* get more performance by not snooping, and you'll still be
* okay. You'll need to update fsl_dma_update_pointers() also.
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
link->source_addr = cpu_to_be32(temp_addr);
link->source_attr = cpu_to_be32(CCSR_DMA_ATR_SNOOP |
upper_32_bits(temp_addr));
@@ -683,7 +683,7 @@ static snd_pcm_uframes_t fsl_dma_pointer(struct snd_soc_component *component,
* only have 32-bit DMA addresses. This function is typically called
* in interrupt context, so we need to optimize it.
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
position = in_be32(&dma_channel->sar);
#ifdef CONFIG_PHYS_64BIT
position |= (u64)(in_be32(&dma_channel->satr) &
diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index 962f309120918..ba577bd9ab477 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -1461,7 +1461,7 @@ static int fsl_easrc_hw_params(struct snd_pcm_substream *substream,
* Set the input and output ratio so we can compute
* the resampling ratio in RS_LOW/HIGH
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ctx_priv->in_params.sample_rate = rate;
ctx_priv->in_params.sample_format = format;
ctx_priv->out_params.sample_rate = easrc->asrc_rate;
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index d0d8a01da9bdd..000abee37d0da 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -537,7 +537,7 @@ static int fsl_esai_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
u32 width = params_width(params);
u32 channels = params_channels(params);
u32 pins = DIV_ROUND_UP(channels, esai_priv->slots);
@@ -758,7 +758,7 @@ static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{
struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
unsigned long lock_flags;
esai_priv->channels[tx] = substream->runtime->channels;
diff --git a/sound/soc/fsl/fsl_qmc_audio.c b/sound/soc/fsl/fsl_qmc_audio.c
index 8668abd352080..bc7eef100c8ad 100644
--- a/sound/soc/fsl/fsl_qmc_audio.c
+++ b/sound/soc/fsl/fsl_qmc_audio.c
@@ -250,7 +250,7 @@ static int qmc_audio_pcm_trigger(struct snd_soc_component *component,
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
bitmap_zero(prtd->chans_pending, 64);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
for (i = 0; i < prtd->channels; i++)
prtd->qmc_dai->chans[i].prtd_tx = prtd;
@@ -513,7 +513,7 @@ static int qmc_dai_constraints_interleaved(struct snd_pcm_substream *substream,
u64 access;
int ret;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
hw_rule_channels_by_format = qmc_dai_hw_rule_capture_channels_by_format;
hw_rule_format_by_channels = qmc_dai_hw_rule_capture_format_by_channels;
frame_bits = qmc_dai->nb_rx_ts * 8;
@@ -566,7 +566,7 @@ static int qmc_dai_constraints_noninterleaved(struct snd_pcm_substream *substrea
u64 access;
int ret;
- frame_bits = (substream->stream == SNDRV_PCM_STREAM_CAPTURE) ?
+ frame_bits = snd_pcm_is_capture(substream) ?
qmc_dai->nb_rx_ts * 8 : qmc_dai->nb_tx_ts * 8;
ret = snd_pcm_hw_constraint_single(substream->runtime,
SNDRV_PCM_HW_PARAM_FRAME_BITS,
@@ -637,7 +637,7 @@ static int qmc_dai_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
chan_param.mode = QMC_TRANSPARENT;
chan_param.transp.max_rx_buf_size = params_period_bytes(params) / nb_chans_used;
for (i = 0; i < nb_chans_used; i++) {
@@ -672,7 +672,7 @@ static int qmc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
direction = QMC_CHAN_WRITE;
nb_chans_used = qmc_dai->nb_chans_used_tx;
} else {
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index d03b0172b8ad2..c0bc992e22b5f 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -525,7 +525,7 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
{
struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
unsigned int ofs = sai->soc_data->reg_offset;
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
unsigned int channels = params_channels(params);
struct snd_dmaengine_dai_dma_data *dma_params;
struct fsl_sai_dl_cfg *dl_cfg = sai->dl_cfg;
@@ -721,7 +721,7 @@ static int fsl_sai_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai)
{
struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
unsigned int ofs = sai->soc_data->reg_offset;
/* Clear xMR to avoid channel swap with mclk_with_tere enabled case */
@@ -783,7 +783,7 @@ static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd,
struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
unsigned int ofs = sai->soc_data->reg_offset;
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
int adir = tx ? RX : TX;
int dir = tx ? TX : RX;
u32 xcsr;
@@ -868,7 +868,7 @@ static int fsl_sai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai)
{
struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
int ret;
/*
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index a63121c888e02..d860e54b1f5e6 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -622,7 +622,7 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream,
regmap_update_bits(regmap, REG_SPDIF_SIE, 0xffffff, 0);
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
scr = SCR_TXFIFO_AUTOSYNC | SCR_TXFIFO_CTRL_NORMAL |
SCR_TXSEL_NORMAL | SCR_USRC_SEL_CHIP |
SCR_TXFIFO_FSEL_IF8;
@@ -650,7 +650,7 @@ static void fsl_spdif_shutdown(struct snd_pcm_substream *substream,
struct regmap *regmap = spdif_priv->regmap;
u32 scr, mask;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
scr = 0;
mask = SCR_TXFIFO_AUTOSYNC_MASK | SCR_TXFIFO_CTRL_MASK |
SCR_TXSEL_MASK | SCR_USRC_SEL_MASK |
@@ -706,7 +706,7 @@ static int fsl_spdif_hw_params(struct snd_pcm_substream *substream,
u32 sample_rate = params_rate(params);
int ret = 0;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ret = spdif_reparent_rootclk(spdif_priv, sample_rate);
if (ret) {
dev_err(&pdev->dev, "%s: reparent root clk failed: %d\n",
@@ -737,7 +737,7 @@ static int fsl_spdif_trigger(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
struct regmap *regmap = spdif_priv->regmap;
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
u32 intr = SIE_INTR_FOR(tx);
u32 dmaen = SCR_DMA_xX_EN(tx);
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 4ca3a16f7ac0d..ad02a9e0154ac 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -680,7 +680,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai,
struct snd_pcm_hw_params *hw_params)
{
- bool tx2, tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx2, tx = snd_pcm_is_playback(substream);
struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(dai);
struct regmap *regs = ssi->regs;
u32 pm = 999, div2, psr, stccr, mask, afreq, factor, i;
@@ -805,7 +805,7 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params,
struct snd_soc_dai *dai)
{
- bool tx2, tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx2, tx = snd_pcm_is_playback(substream);
struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(dai);
struct fsl_ssi_regvals *vals = ssi->regvals;
struct regmap *regs = ssi->regs;
@@ -1109,7 +1109,7 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c
index bf9a4e90978ef..f89f778a0d89a 100644
--- a/sound/soc/fsl/fsl_xcvr.c
+++ b/sound/soc/fsl/fsl_xcvr.c
@@ -437,7 +437,7 @@ static int fsl_xcvr_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct fsl_xcvr *xcvr = snd_soc_dai_get_drvdata(dai);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
u32 m_ctl = 0, v_ctl = 0;
u32 r = substream->runtime->rate, ch = substream->runtime->channels;
u32 fout = 32 * r * ch * 10;
@@ -562,7 +562,7 @@ static int fsl_xcvr_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct fsl_xcvr *xcvr = snd_soc_dai_get_drvdata(dai);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
int ret = 0;
if (xcvr->streams & BIT(substream->stream)) {
@@ -614,7 +614,7 @@ static void fsl_xcvr_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct fsl_xcvr *xcvr = snd_soc_dai_get_drvdata(dai);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
u32 mask = 0, val = 0;
int ret;
@@ -662,7 +662,7 @@ static int fsl_xcvr_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{
struct fsl_xcvr *xcvr = snd_soc_dai_get_drvdata(dai);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
int ret;
switch (cmd) {
diff --git a/sound/soc/fsl/imx-audmix.c b/sound/soc/fsl/imx-audmix.c
index 6fbcf33fd0dea..8e03eadc33888 100644
--- a/sound/soc/fsl/imx-audmix.c
+++ b/sound/soc/fsl/imx-audmix.c
@@ -74,7 +74,7 @@ static int imx_audmix_fe_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct device *dev = rtd->card->dev;
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
unsigned int fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF;
u32 channels = params_channels(params);
int ret, dir;
@@ -113,7 +113,7 @@ static int imx_audmix_be_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct device *dev = rtd->card->dev;
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
unsigned int fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF;
int ret;
diff --git a/sound/soc/fsl/imx-hdmi.c b/sound/soc/fsl/imx-hdmi.c
index fe47b439a8183..b6ce395f91bbf 100644
--- a/sound/soc/fsl/imx-hdmi.c
+++ b/sound/soc/fsl/imx-hdmi.c
@@ -34,7 +34,7 @@ static int imx_hdmi_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct imx_hdmi_data *data = snd_soc_card_get_drvdata(rtd->card);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct snd_soc_card *card = rtd->card;
struct device *dev = card->dev;
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 3391430e42532..9005150012c15 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -53,7 +53,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
get_fiq_regs(®s);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
iprtd->offset = regs.ARM_r8 & 0xffff;
else
iprtd->offset = regs.ARM_r9 & 0xffff;
@@ -93,7 +93,7 @@ static int snd_imx_pcm_prepare(struct snd_soc_component *component,
struct pt_regs regs;
get_fiq_regs(®s);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
regs.ARM_r8 = (iprtd->period * iprtd->periods - 1) << 16;
else
regs.ARM_r9 = (iprtd->period * iprtd->periods - 1) << 16;
@@ -115,7 +115,7 @@ static int snd_imx_pcm_trigger(struct snd_soc_component *component,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
atomic_set(&iprtd->playing, 1);
else
atomic_set(&iprtd->capturing, 1);
@@ -127,7 +127,7 @@ static int snd_imx_pcm_trigger(struct snd_soc_component *component,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
atomic_set(&iprtd->playing, 0);
else
atomic_set(&iprtd->capturing, 0);
diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c
index b0944a07ab470..3653eed2d5bc9 100644
--- a/sound/soc/fsl/imx-pcm-rpmsg.c
+++ b/sound/soc/fsl/imx-pcm-rpmsg.c
@@ -142,7 +142,7 @@ static int imx_rpmsg_pcm_hw_params(struct snd_soc_component *component,
struct rpmsg_info *info = dev_get_drvdata(component->dev);
struct rpmsg_msg *msg;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
msg = &info->msg[TX_HW_PARAM];
msg->s_msg.header.cmd = TX_HW_PARAM;
} else {
@@ -195,7 +195,7 @@ static snd_pcm_uframes_t imx_rpmsg_pcm_pointer(struct snd_soc_component *compone
unsigned int pos = 0;
int buffer_tail = 0;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
msg = &info->msg[TX_PERIOD_DONE + MSG_TYPE_A_NUM];
else
msg = &info->msg[RX_PERIOD_DONE + MSG_TYPE_A_NUM];
@@ -214,7 +214,7 @@ static void imx_rpmsg_timer_callback(struct timer_list *t)
struct rpmsg_info *info = stream_timer->info;
struct rpmsg_msg *msg;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
msg = &info->msg[TX_PERIOD_DONE + MSG_TYPE_A_NUM];
msg->s_msg.header.cmd = TX_PERIOD_DONE;
} else {
@@ -237,7 +237,7 @@ static int imx_rpmsg_pcm_open(struct snd_soc_component *component,
int ret = 0;
int cmd;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
msg = &info->msg[TX_OPEN];
msg->s_msg.header.cmd = TX_OPEN;
@@ -291,7 +291,7 @@ static int imx_rpmsg_pcm_close(struct snd_soc_component *component,
/* Flush work in workqueue to make TX_CLOSE is the last message */
flush_workqueue(info->rpmsg_wq);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
msg = &info->msg[TX_CLOSE];
msg->s_msg.header.cmd = TX_CLOSE;
} else {
@@ -353,7 +353,7 @@ static int imx_rpmsg_prepare_and_submit(struct snd_soc_component *component,
struct rpmsg_info *info = dev_get_drvdata(component->dev);
struct rpmsg_msg *msg;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
msg = &info->msg[TX_BUFFER];
msg->s_msg.header.cmd = TX_BUFFER;
} else {
@@ -382,7 +382,7 @@ static int imx_rpmsg_async_issue_pending(struct snd_soc_component *component,
struct rpmsg_info *info = dev_get_drvdata(component->dev);
struct rpmsg_msg *msg;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
msg = &info->msg[TX_START];
msg->s_msg.header.cmd = TX_START;
} else {
@@ -399,7 +399,7 @@ static int imx_rpmsg_restart(struct snd_soc_component *component,
struct rpmsg_info *info = dev_get_drvdata(component->dev);
struct rpmsg_msg *msg;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
msg = &info->msg[TX_RESTART];
msg->s_msg.header.cmd = TX_RESTART;
} else {
@@ -416,7 +416,7 @@ static int imx_rpmsg_pause(struct snd_soc_component *component,
struct rpmsg_info *info = dev_get_drvdata(component->dev);
struct rpmsg_msg *msg;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
msg = &info->msg[TX_PAUSE];
msg->s_msg.header.cmd = TX_PAUSE;
} else {
@@ -434,7 +434,7 @@ static int imx_rpmsg_terminate_all(struct snd_soc_component *component,
struct rpmsg_msg *msg;
int cmd;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
msg = &info->msg[TX_TERMINATE];
msg->s_msg.header.cmd = TX_TERMINATE;
/* Clear buffer count*/
@@ -530,7 +530,7 @@ static int imx_rpmsg_pcm_ack(struct snd_soc_component *component,
if (!rpmsg->force_lpa)
return 0;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
msg = &info->msg[TX_PERIOD_DONE + MSG_TYPE_A_NUM];
msg->s_msg.header.cmd = TX_PERIOD_DONE;
} else {
@@ -559,7 +559,7 @@ static int imx_rpmsg_pcm_ack(struct snd_soc_component *component,
info->notify_updated[substream->stream] = true;
spin_unlock_irqrestore(&info->lock[substream->stream], flags);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
avail = snd_pcm_playback_hw_avail(runtime);
else
avail = snd_pcm_capture_hw_avail(runtime);
diff --git a/sound/soc/fsl/lpc3xxx-i2s.c b/sound/soc/fsl/lpc3xxx-i2s.c
index c65c17dfa1747..536ace6de0088 100644
--- a/sound/soc/fsl/lpc3xxx-i2s.c
+++ b/sound/soc/fsl/lpc3xxx-i2s.c
@@ -75,7 +75,7 @@ static int lpc3xxx_i2s_startup(struct snd_pcm_substream *substream, struct snd_s
guard(mutex)(&i2s_info_p->lock);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
flag = I2S_PLAYBACK_FLAG;
else
flag = I2S_CAPTURE_FLAG;
@@ -107,7 +107,7 @@ static void lpc3xxx_i2s_shutdown(struct snd_pcm_substream *substream, struct snd
guard(mutex)(&i2s_info_p->lock);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
flag = I2S_PLAYBACK_FLAG;
regmap_write(regs, LPC3XXX_REG_I2S_TX_RATE, 0);
regmap_update_bits(regs, LPC3XXX_REG_I2S_DAO, stop_bits, stop_bits);
@@ -197,7 +197,7 @@ static int lpc3xxx_i2s_hw_params(struct snd_pcm_substream *substream,
dev_dbg(dev, "Channels : %d\n", params_channels(params));
dev_dbg(dev, "Data format : %s\n", "I2S");
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
regmap_write(regs, LPC3XXX_REG_I2S_DMA1,
LPC3XXX_I2S_DMA1_TX_EN | LPC3XXX_I2S_DMA0_TX_DEPTH(4));
regmap_write(regs, LPC3XXX_REG_I2S_TX_RATE, (clkx << 8) | clky);
@@ -223,7 +223,7 @@ static int lpc3xxx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
regmap_update_bits(regs, LPC3XXX_REG_I2S_DAO,
LPC3XXX_I2S_STOP, LPC3XXX_I2S_STOP);
else
@@ -234,7 +234,7 @@ static int lpc3xxx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
regmap_update_bits(regs, LPC3XXX_REG_I2S_DAO,
(LPC3XXX_I2S_RESET | LPC3XXX_I2S_STOP), 0);
else
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index 345f338251ace..07ddc3cd31890 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -137,7 +137,7 @@ static int psc_dma_trigger(struct snd_soc_component *component,
*/
spin_lock_irqsave(&psc_dma->lock, flags);
- if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream->pstr->stream))
bcom_gen_bd_rx_reset(s->bcom_task);
else
bcom_gen_bd_tx_reset(s->bcom_task);
@@ -160,7 +160,7 @@ static int psc_dma_trigger(struct snd_soc_component *component,
spin_lock_irqsave(&psc_dma->lock, flags);
bcom_disable(s->bcom_task);
- if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream->pstr->stream))
bcom_gen_bd_rx_reset(s->bcom_task);
else
bcom_gen_bd_tx_reset(s->bcom_task);
@@ -219,7 +219,7 @@ static int psc_dma_open(struct snd_soc_component *component,
dev_dbg(psc_dma->dev, "psc_dma_open(substream=%p)\n", substream);
- if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream->pstr->stream))
s = &psc_dma->capture;
else
s = &psc_dma->playback;
@@ -246,7 +246,7 @@ static int psc_dma_close(struct snd_soc_component *component,
dev_dbg(psc_dma->dev, "psc_dma_close(substream=%p)\n", substream);
- if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream->pstr->stream))
s = &psc_dma->capture;
else
s = &psc_dma->playback;
@@ -271,7 +271,7 @@ psc_dma_pointer(struct snd_soc_component *component,
struct psc_dma_stream *s;
dma_addr_t count;
- if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream->pstr->stream))
s = &psc_dma->capture;
else
s = &psc_dma->playback;
diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h
index d7ee33b5b9a8d..42460f2b3906d 100644
--- a/sound/soc/fsl/mpc5200_dma.h
+++ b/sound/soc/fsl/mpc5200_dma.h
@@ -77,7 +77,7 @@ struct psc_dma {
static inline struct psc_dma_stream *
to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma)
{
- if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream->pstr->stream))
return &psc_dma->capture;
return &psc_dma->playback;
}
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 0423cf43c7a02..cb96b0ff74396 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -151,7 +151,7 @@ static int psc_ac97_hw_analog_params(struct snd_pcm_substream *substream,
/* Determine the set of enable bits to turn on */
s->ac97_slot_bits = (params_channels(params) == 1) ? 0x100 : 0x300;
- if (substream->pstr->stream != SNDRV_PCM_STREAM_CAPTURE)
+ if (!snd_pcm_is_capture(substream->pstr->stream))
s->ac97_slot_bits <<= 16;
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 050/113] ASoC: mxs: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (48 preceding siblings ...)
2024-08-05 0:39 ` [PATCH 049/113] ASoC: fsl: " Kuninori Morimoto
@ 2024-08-05 0:39 ` Kuninori Morimoto
2024-08-05 0:39 ` [PATCH 051/113] ASoC: pxa: " Kuninori Morimoto
` (64 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/mxs/mxs-saif.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 3e3a62df3d7e3..2a3d8038d4362 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -489,7 +489,7 @@ static int mxs_saif_hw_params(struct snd_pcm_substream *substream,
}
/* Tx/Rx config */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
/* enable TX mode */
scr &= ~BM_SAIF_CTRL_READ_MODE;
} else {
@@ -560,7 +560,7 @@ static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd,
__raw_writel(BM_SAIF_CTRL_RUN,
master_saif->base + SAIF_CTRL + MXS_SET_ADDR);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
/*
* write data to saif data register to trigger
* the transfer.
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 051/113] ASoC: pxa: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (49 preceding siblings ...)
2024-08-05 0:39 ` [PATCH 050/113] ASoC: mxs: " Kuninori Morimoto
@ 2024-08-05 0:39 ` Kuninori Morimoto
2024-08-05 0:39 ` [PATCH 052/113] ASoC: sti: " Kuninori Morimoto
` (63 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/pxa/mmp-sspa.c | 6 +++---
sound/soc/pxa/pxa-ssp.c | 6 +++---
sound/soc/pxa/pxa2xx-ac97.c | 6 +++---
sound/soc/pxa/pxa2xx-i2s.c | 8 ++++----
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c
index abfaf3cdf5bb6..229b1ebe720d9 100644
--- a/sound/soc/pxa/mmp-sspa.c
+++ b/sound/soc/pxa/mmp-sspa.c
@@ -266,7 +266,7 @@ static int mmp_sspa_hw_params(struct snd_pcm_substream *substream,
params_channels(params) * bits);
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
__raw_writel(sspa_ctrl, sspa->tx_base + SSPA_CTL);
__raw_writel(0x1, sspa->tx_base + SSPA_FIFO_UL);
} else {
@@ -296,7 +296,7 @@ static int mmp_sspa_trigger(struct snd_pcm_substream *substream, int cmd,
if (!sspa->running_cnt)
mmp_sspa_rx_enable(sspa);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
mmp_sspa_tx_enable(sspa);
sspa->running_cnt++;
@@ -307,7 +307,7 @@ static int mmp_sspa_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
sspa->running_cnt--;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
mmp_sspa_tx_disable(sspa);
/* have no capture stream, disable rx port */
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index b8a3cb8b75978..82f91f951619a 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -88,7 +88,7 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream,
dma = kzalloc(sizeof(struct snd_dmaengine_dai_dma_data), GFP_KERNEL);
if (!dma)
return -ENOMEM;
- dma->chan_name = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
+ dma->chan_name = snd_pcm_is_playback(substream) ?
"tx" : "rx";
snd_soc_dai_set_dma_data(cpu_dai, substream, dma);
@@ -551,7 +551,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
*/
pxa_ssp_set_dma_params(ssp,
((chn == 2) && (ttsa != 1)) || (width == 32),
- substream->stream == SNDRV_PCM_STREAM_PLAYBACK, dma_data);
+ snd_pcm_is_playback(substream), dma_data);
/* we can only change the settings if the port is not in use */
if (pxa_ssp_read_reg(ssp, SSCR0) & SSCR0_SSE)
@@ -683,7 +683,7 @@ static void pxa_ssp_set_running_bit(struct snd_pcm_substream *substream,
if (value && (sscr0 & SSCR0_SSE))
pxa_ssp_write_reg(ssp, SSCR0, sscr0 & ~SSCR0_SSE);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
if (value)
sscr1 |= SSCR1_TSRE;
else
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 80e0ea0ec9fb3..9a8e08b30ebfa 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -95,7 +95,7 @@ static int pxa2xx_ac97_hifi_startup(struct snd_pcm_substream *substream,
{
struct snd_dmaengine_dai_dma_data *dma_data;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dma_data = &pxa2xx_ac97_pcm_stereo_out;
else
dma_data = &pxa2xx_ac97_pcm_stereo_in;
@@ -110,7 +110,7 @@ static int pxa2xx_ac97_aux_startup(struct snd_pcm_substream *substream,
{
struct snd_dmaengine_dai_dma_data *dma_data;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dma_data = &pxa2xx_ac97_pcm_aux_mono_out;
else
dma_data = &pxa2xx_ac97_pcm_aux_mono_in;
@@ -123,7 +123,7 @@ static int pxa2xx_ac97_aux_startup(struct snd_pcm_substream *substream,
static int pxa2xx_ac97_mic_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai)
{
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return -ENODEV;
snd_soc_dai_set_dma_data(cpu_dai, substream,
&pxa2xx_ac97_pcm_mic_mono_in);
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index 849fbf176a70f..664116396e8ff 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -163,7 +163,7 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
clk_ena = 1;
pxa_i2s_wait();
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dma_data = &pxa2xx_i2s_pcm_stereo_out;
else
dma_data = &pxa2xx_i2s_pcm_stereo_in;
@@ -179,7 +179,7 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
writel(readl(i2s_reg_base + SACR0) | (SACR0_RFTH(14) | SACR0_TFTH(1)), i2s_reg_base + SACR0);
writel(readl(i2s_reg_base + SACR1) | (pxa_i2s.fmt), i2s_reg_base + SACR1);
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
writel(readl(i2s_reg_base + SAIMR) | (SAIMR_TFS), i2s_reg_base + SAIMR);
else
writel(readl(i2s_reg_base + SAIMR) | (SAIMR_RFS), i2s_reg_base + SAIMR);
@@ -218,7 +218,7 @@ static int pxa2xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
writel(readl(i2s_reg_base + SACR1) & (~SACR1_DRPL), i2s_reg_base + SACR1);
else
writel(readl(i2s_reg_base + SACR1) & (~SACR1_DREC), i2s_reg_base + SACR1);
@@ -240,7 +240,7 @@ static int pxa2xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
static void pxa2xx_i2s_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
writel(readl(i2s_reg_base + SACR1) | (SACR1_DRPL), i2s_reg_base + SACR1);
writel(readl(i2s_reg_base + SAIMR) & (~SAIMR_TFS), i2s_reg_base + SAIMR);
} else {
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 052/113] ASoC: sti: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (50 preceding siblings ...)
2024-08-05 0:39 ` [PATCH 051/113] ASoC: pxa: " Kuninori Morimoto
@ 2024-08-05 0:39 ` Kuninori Morimoto
2024-08-05 0:39 ` [PATCH 053/113] ASoC: stm: " Kuninori Morimoto
` (62 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/sti/sti_uniperif.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sti/sti_uniperif.c b/sound/soc/sti/sti_uniperif.c
index ba824f14a39cf..75520b8827ca1 100644
--- a/sound/soc/sti/sti_uniperif.c
+++ b/sound/soc/sti/sti_uniperif.c
@@ -337,7 +337,7 @@ static int sti_uniperiph_resume(struct snd_soc_component *component)
struct uniperif *uni = priv->dai_data.uni;
int ret;
- if (priv->dai_data.stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(priv->dai_data.stream)) {
ret = uni_player_resume(uni);
if (ret)
return ret;
@@ -358,7 +358,7 @@ static int sti_uniperiph_dai_probe(struct snd_soc_dai *dai)
struct sti_uniperiph_dai *dai_data = &priv->dai_data;
/* DMA settings*/
- if (priv->dai_data.stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(priv->dai_data.stream))
snd_soc_dai_init_dma_data(dai, &dai_data->dma_data, NULL);
else
snd_soc_dai_init_dma_data(dai, NULL, &dai_data->dma_data);
@@ -440,7 +440,7 @@ static int sti_uniperiph_cpu_dai_of(struct device_node *node,
dai_data->uni = uni;
dai_data->stream = dev_data->stream;
- if (priv->dai_data.stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(priv->dai_data.stream)) {
ret = uni_player_init(priv->pdev, uni);
stream = &dai->playback;
} else {
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 053/113] ASoC: stm: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (51 preceding siblings ...)
2024-08-05 0:39 ` [PATCH 052/113] ASoC: sti: " Kuninori Morimoto
@ 2024-08-05 0:39 ` Kuninori Morimoto
2024-08-05 0:39 ` [PATCH 054/113] ASoC: sof: " Kuninori Morimoto
` (61 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/stm/stm32_i2s.c | 2 +-
sound/soc/stm/stm32_sai_sub.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c
index a96aa308681a2..d6654fc9f1a7c 100644
--- a/sound/soc/stm/stm32_i2s.c
+++ b/sound/soc/stm/stm32_i2s.c
@@ -813,7 +813,7 @@ static int stm32_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *cpu_dai)
{
struct stm32_i2s_data *i2s = snd_soc_dai_get_drvdata(cpu_dai);
- bool playback_flg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ bool playback_flg = snd_pcm_is_playback(substream);
u32 cfg1_mask, ier;
int ret;
diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
index ad2492efb1cdc..ff8d98e574f2b 100644
--- a/sound/soc/stm/stm32_sai_sub.c
+++ b/sound/soc/stm/stm32_sai_sub.c
@@ -38,8 +38,8 @@
#define STM_SAI_DAI_NAME_SIZE 15
-#define STM_SAI_IS_PLAYBACK(ip) ((ip)->dir == SNDRV_PCM_STREAM_PLAYBACK)
-#define STM_SAI_IS_CAPTURE(ip) ((ip)->dir == SNDRV_PCM_STREAM_CAPTURE)
+#define STM_SAI_IS_PLAYBACK(ip) snd_pcm_is_playback((ip)->dir)
+#define STM_SAI_IS_CAPTURE(ip) snd_pcm_is_capture((ip)->dir)
#define STM_SAI_A_ID 0x0
#define STM_SAI_B_ID 0x1
@@ -1406,7 +1406,7 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev,
sai->spdif = false;
if (of_property_present(np, "st,iec60958")) {
if (!STM_SAI_HAS_SPDIF(sai) ||
- sai->dir == SNDRV_PCM_STREAM_CAPTURE) {
+ STM_SAI_IS_CAPTURE(sai)) {
dev_err(&pdev->dev, "S/PDIF IEC60958 not supported\n");
return -EINVAL;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 054/113] ASoC: sof: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (52 preceding siblings ...)
2024-08-05 0:39 ` [PATCH 053/113] ASoC: stm: " Kuninori Morimoto
@ 2024-08-05 0:39 ` Kuninori Morimoto
2024-08-05 0:39 ` [PATCH 055/113] ASoC: sof: intel: " Kuninori Morimoto
` (60 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/sof/ipc4-pcm.c | 6 +++---
sound/soc/sof/ipc4-topology.c | 10 +++++-----
sound/soc/sof/sof-audio.c | 8 ++++----
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/soc/sof/ipc4-pcm.c b/sound/soc/sof/ipc4-pcm.c
index 4df2be3d39eba..52e6983acba64 100644
--- a/sound/soc/sof/ipc4-pcm.c
+++ b/sound/soc/sof/ipc4-pcm.c
@@ -345,7 +345,7 @@ static int sof_ipc4_chain_dma_trigger(struct snd_sof_dev *sdev,
msg.extension |= pipeline->msg.extension;
}
- if (direction == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(direction)) {
/*
* For ChainDMA the DMA ids are unique with the following mapping:
* playback: 0 - (num_playback_streams - 1)
@@ -681,7 +681,7 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
if (pipeline->use_chain_dma)
return 0;
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
if (sof_ipc4_copier_is_single_bitdepth(sdev,
available_fmt->output_pin_fmts,
available_fmt->num_output_formats)) {
@@ -1044,7 +1044,7 @@ static int sof_ipc4_pcm_pointer(struct snd_soc_component *component,
/* Wrap the dai counter at the boundary where the host counter wraps */
div64_u64_rem(dai_cnt, time_info->boundary, &dai_cnt);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
head_cnt = host_cnt;
tail_cnt = dai_cnt;
} else {
diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index 87be7f16e8c2b..ce14acb6770eb 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -511,7 +511,7 @@ static int sof_ipc4_widget_setup_pcm(struct snd_sof_widget *swidget)
if (ret)
goto free_available_fmt;
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
struct snd_sof_pcm_stream *sps = &spcm->stream[dir];
sof_update_ipc_object(scomp, &sps->dsp_max_burst_size_in_ms,
@@ -1668,7 +1668,7 @@ sof_ipc4_prepare_dai_copier(struct snd_sof_dev *sdev, struct snd_sof_dai *dai,
* of the RATE, CHANNELS, bit depth is static among the formats then
* narrow the params to only allow that specific parameter value.
*/
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
pin_fmts = available_fmt->output_pin_fmts;
num_pin_fmts = available_fmt->num_output_formats;
} else {
@@ -1783,7 +1783,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
* Use the input_pin_fmts to match pcm params for playback and the output_pin_fmts
* for capture.
*/
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
ref_params = *fe_params;
else
ref_params = *pipeline_params;
@@ -1828,7 +1828,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
* For playback the pipeline_params needs to be used to find the
* input configuration of the copier.
*/
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
ref_params = *pipeline_params;
break;
@@ -2225,7 +2225,7 @@ static int sof_ipc4_prepare_src_module(struct snd_sof_widget *swidget,
* For playback, the SRC sink rate will be configured based on the requested output
* format, which is restricted to only deal with DAI's with a single format for now.
*/
- if (dir == SNDRV_PCM_STREAM_PLAYBACK && available_fmt->num_output_formats > 1) {
+ if (snd_pcm_is_playback(dir) && available_fmt->num_output_formats > 1) {
dev_err(sdev->dev, "Invalid number of output formats: %d for SRC %s\n",
available_fmt->num_output_formats, swidget->widget->name);
return -EINVAL;
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
index 9a52781bf8d8b..9ac03dc5a24d4 100644
--- a/sound/soc/sof/sof-audio.c
+++ b/sound/soc/sof/sof-audio.c
@@ -308,7 +308,7 @@ static int sof_setup_pipeline_connections(struct snd_sof_dev *sdev,
* purpose of connecting a pipeline from a host to a DAI in order to receive the DAPM
* events. But they are not handled by the firmware. So ignore them.
*/
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
for_each_dapm_widgets(list, i, widget) {
if (!widget->dobj.private)
continue;
@@ -623,11 +623,11 @@ sof_walk_widgets_in_order(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm,
continue;
/* starting widget for playback is AIF type */
- if (dir == SNDRV_PCM_STREAM_PLAYBACK && widget->id != snd_soc_dapm_aif_in)
+ if (snd_pcm_is_playback(dir) && widget->id != snd_soc_dapm_aif_in)
continue;
/* starting widget for capture is DAI type */
- if (dir == SNDRV_PCM_STREAM_CAPTURE && widget->id != snd_soc_dapm_dai_out)
+ if (snd_pcm_is_capture(dir) && widget->id != snd_soc_dapm_dai_out)
continue;
switch (op) {
@@ -950,7 +950,7 @@ snd_sof_find_swidget_sname(struct snd_soc_component *scomp,
struct snd_sof_widget *swidget;
enum snd_soc_dapm_type type;
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
type = snd_soc_dapm_aif_in;
else
type = snd_soc_dapm_aif_out;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 055/113] ASoC: sof: intel: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (53 preceding siblings ...)
2024-08-05 0:39 ` [PATCH 054/113] ASoC: sof: " Kuninori Morimoto
@ 2024-08-05 0:39 ` Kuninori Morimoto
2024-08-05 0:39 ` [PATCH 056/113] ASoC: qcom: " Kuninori Morimoto
` (59 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/sof/intel/hda-dai-ops.c | 2 +-
sound/soc/sof/intel/hda-dai.c | 4 ++--
sound/soc/sof/intel/hda-dsp.c | 2 +-
sound/soc/sof/intel/hda-loader.c | 2 +-
sound/soc/sof/intel/hda-pcm.c | 4 ++--
sound/soc/sof/intel/hda-stream.c | 6 +++---
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/soc/sof/intel/hda-dai-ops.c b/sound/soc/sof/intel/hda-dai-ops.c
index 484c761478853..c00fc981f8059 100644
--- a/sound/soc/sof/intel/hda-dai-ops.c
+++ b/sound/soc/sof/intel/hda-dai-ops.c
@@ -198,7 +198,7 @@ static unsigned int hda_calc_stream_format(struct snd_sof_dev *sdev,
unsigned int format_val;
unsigned int bits;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
link_bps = codec_dai->driver->playback.sig_bits;
else
link_bps = codec_dai->driver->capture.sig_bits;
diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c
index 1c823f9eea570..0b5d3c5693ab0 100644
--- a/sound/soc/sof/intel/hda-dai.c
+++ b/sound/soc/sof/intel/hda-dai.c
@@ -123,7 +123,7 @@ int hda_link_dma_cleanup(struct snd_pcm_substream *substream, struct hdac_ext_st
if (!hlink)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
stream_tag = hdac_stream(hext_stream)->stream_tag;
snd_hdac_ext_bus_link_clear_stream_id(hlink, stream_tag);
}
@@ -174,7 +174,7 @@ static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,
hstream = &hext_stream->hstream;
stream_tag = hstream->stream_tag;
- if (hext_stream->hstream.direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(hext_stream->hstream.direction))
snd_hdac_ext_bus_link_set_stream_id(hlink, stream_tag);
/* set the hdac_stream in the codec dai */
diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index 4c88522d40484..f5be61a6f4ba5 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -542,7 +542,7 @@ static bool hda_dsp_d0i3_streaming_applicable(struct snd_sof_dev *sdev)
if (!spcm->stream[dir].d0i3_compatible)
return false;
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
playback_active = true;
}
}
diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c
index 75f6240cf3e1d..ec46529974a5e 100644
--- a/sound/soc/sof/intel/hda-loader.c
+++ b/sound/soc/sof/intel/hda-loader.c
@@ -262,7 +262,7 @@ int hda_cl_cleanup(struct device *dev, struct snd_dma_buffer *dmab,
int sd_offset = SOF_STREAM_SD_OFFSET(hstream);
int ret = 0;
- if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(hstream->direction))
ret = hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_DISABLE, 0);
else
snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset,
diff --git a/sound/soc/sof/intel/hda-pcm.c b/sound/soc/sof/intel/hda-pcm.c
index f6e24edd7adbe..d5a630da5a218 100644
--- a/sound/soc/sof/intel/hda-pcm.c
+++ b/sound/soc/sof/intel/hda-pcm.c
@@ -237,11 +237,11 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
* All playback streams are DMI L1 capable, capture streams need
* pause push/release to be disabled
*/
- if (hda_always_enable_dmi_l1 && direction == SNDRV_PCM_STREAM_CAPTURE)
+ if (hda_always_enable_dmi_l1 && snd_pcm_is_capture(direction))
runtime->hw.info &= ~SNDRV_PCM_INFO_PAUSE;
if (hda_always_enable_dmi_l1 ||
- direction == SNDRV_PCM_STREAM_PLAYBACK ||
+ snd_pcm_is_playback(direction) ||
spcm->stream[substream->stream].d0i3_compatible)
flags |= SOF_HDA_STREAM_DMI_L1_COMPATIBLE;
diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c
index 3ac63ce67ab1c..c83b260c35f92 100644
--- a/sound/soc/sof/intel/hda-stream.c
+++ b/sound/soc/sof/intel/hda-stream.c
@@ -33,7 +33,7 @@ EXPORT_SYMBOL_NS(sof_hda_position_quirk, SND_SOC_SOF_INTEL_HDA_COMMON);
static inline const char *hda_hstream_direction_str(struct hdac_stream *hstream)
{
- if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(hstream->direction))
return "Playback";
else
return "Capture";
@@ -667,7 +667,7 @@ int hda_dsp_stream_hw_params(struct snd_sof_dev *sdev,
SOF_HDA_CL_DMA_SD_INT_MASK);
/* read FIFO size */
- if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(hstream->direction)) {
hstream->fifo_size =
snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR,
sd_offset +
@@ -1030,7 +1030,7 @@ snd_pcm_uframes_t hda_dsp_stream_get_position(struct hdac_stream *hstream,
* is not accurate enough, its update may be completed
* earlier than the data written to DDR.
*/
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
pos = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR,
AZX_REG_VS_SDXDPIB_XBASE +
(AZX_REG_VS_SDXDPIB_XINTERVAL *
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 056/113] ASoC: qcom: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (54 preceding siblings ...)
2024-08-05 0:39 ` [PATCH 055/113] ASoC: sof: intel: " Kuninori Morimoto
@ 2024-08-05 0:39 ` Kuninori Morimoto
2024-08-05 0:39 ` [PATCH 057/113] ASoC: sprd: " Kuninori Morimoto
` (58 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/qcom/apq8096.c | 2 +-
sound/soc/qcom/lpass-apq8016.c | 2 +-
sound/soc/qcom/lpass-cpu.c | 12 ++++++------
sound/soc/qcom/lpass-ipq806x.c | 2 +-
sound/soc/qcom/lpass-platform.c | 8 ++++----
sound/soc/qcom/lpass-sc7180.c | 4 ++--
sound/soc/qcom/lpass-sc7280.c | 2 +-
sound/soc/qcom/qdsp6/audioreach.c | 2 +-
sound/soc/qcom/qdsp6/q6apm-dai.c | 10 +++++-----
sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 6 +++---
sound/soc/qcom/qdsp6/q6apm.c | 12 ++++++------
sound/soc/qcom/qdsp6/q6asm-dai.c | 16 ++++++++--------
sound/soc/qcom/qdsp6/q6routing.c | 2 +-
sound/soc/qcom/sdm845.c | 4 ++--
14 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/sound/soc/qcom/apq8096.c b/sound/soc/qcom/apq8096.c
index 4f6594cc723ce..a5305f33c32c5 100644
--- a/sound/soc/qcom/apq8096.c
+++ b/sound/soc/qcom/apq8096.c
@@ -46,7 +46,7 @@ static int msm_snd_hw_params(struct snd_pcm_substream *substream,
return 0;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
ret = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL,
rx_ch_cnt, rx_ch);
else
diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index 9005c85f8c547..5dfcd547cfcd5 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -126,7 +126,7 @@ static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
const struct lpass_variant *v = drvdata->variant;
int chan = 0;
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
v->rdma_channels);
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 5a47f661e0c6f..81036c49bce1b 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -113,7 +113,7 @@ static void lpass_cpu_daiops_shutdown(struct snd_pcm_substream *substream,
* Will not impact if disabled in lpass_cpu_daiops_trigger()
* suspend.
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
regmap_fields_write(i2sctl->spken, id, LPAIF_I2SCTL_SPKEN_DISABLE);
else
regmap_fields_write(i2sctl->micen, id, LPAIF_I2SCTL_MICEN_DISABLE);
@@ -185,7 +185,7 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream,
return ret;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
mode = drvdata->mi2s_playback_sd_mode[id];
else
mode = drvdata->mi2s_capture_sd_mode[id];
@@ -249,7 +249,7 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ret = regmap_fields_write(i2sctl->spkmode, id,
LPAIF_I2SCTL_SPKMODE(mode));
if (ret) {
@@ -320,7 +320,7 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
* turn off the shared BCLK while other devices are using
* it.
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ret = regmap_fields_write(i2sctl->spken, id,
LPAIF_I2SCTL_SPKEN_ENABLE);
} else {
@@ -345,7 +345,7 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
* To ensure lpass BCLK/LRCLK is disabled during
* device suspend.
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ret = regmap_fields_write(i2sctl->spken, id,
LPAIF_I2SCTL_SPKEN_DISABLE);
} else {
@@ -378,7 +378,7 @@ static int lpass_cpu_daiops_prepare(struct snd_pcm_substream *substream,
* the data flow.
* (ex: to drop start up pop noise before capture starts).
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
ret = regmap_fields_write(i2sctl->spken, id, LPAIF_I2SCTL_SPKEN_ENABLE);
else
ret = regmap_fields_write(i2sctl->micen, id, LPAIF_I2SCTL_MICEN_ENABLE);
diff --git a/sound/soc/qcom/lpass-ipq806x.c b/sound/soc/qcom/lpass-ipq806x.c
index 5c874139f39d4..dbaaed1f3d8e3 100644
--- a/sound/soc/qcom/lpass-ipq806x.c
+++ b/sound/soc/qcom/lpass-ipq806x.c
@@ -97,7 +97,7 @@ static int ipq806x_lpass_exit(struct platform_device *pdev)
static int ipq806x_lpass_alloc_dma_channel(struct lpass_data *drvdata, int dir, unsigned int dai_id)
{
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
return IPQ806X_LPAIF_RDMA_CHAN_MI2S;
else /* Capture currently not implemented */
return -EINVAL;
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index addd2c4bdd3e8..f8e223e73fa02 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -329,7 +329,7 @@ static struct lpaif_dmactl *__lpass_get_dmactl_handle(const struct snd_pcm_subst
switch (cpu_dai->driver->id) {
case MI2S_PRIMARY ... MI2S_QUINARY:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dmactl = drvdata->rd_dmactl;
else
dmactl = drvdata->wr_dmactl;
@@ -364,7 +364,7 @@ static int __lpass_get_id(const struct snd_pcm_substream *substream,
switch (cpu_dai->driver->id) {
case MI2S_PRIMARY ... MI2S_QUINARY:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
id = pcm_data->dma_ch;
else
id = pcm_data->dma_ch - v->wrdma_channel_start;
@@ -1230,14 +1230,14 @@ static int lpass_platform_copy(struct snd_soc_component *component,
void __iomem *dma_buf = (void __iomem *) (rt->dma_area + pos +
channel * (rt->dma_bytes / rt->channels));
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
if (is_cdc_dma_port(dai_id)) {
ret = copy_from_iter_toio(dma_buf, buf, bytes);
} else {
if (copy_from_iter((void __force *)dma_buf, bytes, buf) != bytes)
ret = -EFAULT;
}
- } else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ } else if (snd_pcm_is_capture(substream)) {
if (is_cdc_dma_port(dai_id)) {
ret = copy_to_iter_fromio(buf, dma_buf, bytes);
} else {
diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
index e6bcdf6ed7965..6898e9254a78d 100644
--- a/sound/soc/qcom/lpass-sc7180.c
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -80,7 +80,7 @@ static int sc7180_lpass_alloc_dma_channel(struct lpass_data *drvdata,
int chan = 0;
if (dai_id == LPASS_DP_RX) {
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
chan = find_first_zero_bit(&drvdata->hdmi_dma_ch_bit_map,
v->hdmi_rdma_channels);
@@ -89,7 +89,7 @@ static int sc7180_lpass_alloc_dma_channel(struct lpass_data *drvdata,
}
set_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
} else {
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
v->rdma_channels);
diff --git a/sound/soc/qcom/lpass-sc7280.c b/sound/soc/qcom/lpass-sc7280.c
index 47c622327a8d3..d5a1c27652e48 100644
--- a/sound/soc/qcom/lpass-sc7280.c
+++ b/sound/soc/qcom/lpass-sc7280.c
@@ -115,7 +115,7 @@ static int sc7280_lpass_alloc_dma_channel(struct lpass_data *drvdata,
switch (dai_id) {
case MI2S_PRIMARY ... MI2S_QUINARY:
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
v->rdma_channels);
diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c
index 4ebaaf736fb98..cd7d99f9b8b40 100644
--- a/sound/soc/qcom/qdsp6/audioreach.c
+++ b/sound/soc/qcom/qdsp6/audioreach.c
@@ -1309,7 +1309,7 @@ int audioreach_map_memory_regions(struct q6apm_graph *graph, unsigned int dir, s
void *p;
int rc, i;
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
data = &graph->rx_data;
else
data = &graph->tx_data;
diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c
index c9404b5934c7e..26c6051a53a0a 100644
--- a/sound/soc/qcom/qdsp6/q6apm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6apm-dai.c
@@ -280,7 +280,7 @@ static int q6apm_dai_prepare(struct snd_soc_component *component,
return ret;
}
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
int i;
/* Queue the buffers for Capture ONLY after graph is started */
for (i = 0; i < runtime->periods; i++)
@@ -306,7 +306,7 @@ static int q6apm_dai_trigger(struct snd_soc_component *component,
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
/* start writing buffers for playback only as we already queued capture buffers */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
ret = q6apm_write_async(prtd->graph, prtd->pcm_count, 0, 0, 0);
break;
case SNDRV_PCM_TRIGGER_STOP:
@@ -356,9 +356,9 @@ static int q6apm_dai_open(struct snd_soc_component *component,
goto err;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
runtime->hw = q6apm_dai_hardware_playback;
- else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ else if (snd_pcm_is_capture(substream))
runtime->hw = q6apm_dai_hardware_capture;
/* Ensure that buffer size is a multiple of period size */
@@ -368,7 +368,7 @@ static int q6apm_dai_open(struct snd_soc_component *component,
goto err;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ret = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
BUFFER_BYTES_MIN, BUFFER_BYTES_MAX);
if (ret < 0) {
diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
index 9c98a35ad0994..3189a10b2f28a 100644
--- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
+++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
@@ -171,7 +171,7 @@ static int q6apm_lpass_dai_prepare(struct snd_pcm_substream *substream, struct s
q6apm_graph_stop(dai_data->graph[dai->id]);
dai_data->is_port_started[dai->id] = false;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
q6apm_graph_close(dai_data->graph[dai->id]);
dai_data->graph[dai->id] = NULL;
}
@@ -181,7 +181,7 @@ static int q6apm_lpass_dai_prepare(struct snd_pcm_substream *substream, struct s
* It is recommend to load DSP with source graph first and then sink
* graph, so sequence for playback and capture will be different
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
graph = q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id);
if (IS_ERR(graph)) {
dev_err(dai->dev, "Failed to open graph (%d)\n", graph_id);
@@ -224,7 +224,7 @@ static int q6apm_lpass_dai_startup(struct snd_pcm_substream *substream, struct s
struct q6apm_graph *graph;
int graph_id = dai->id;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
graph = q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id);
if (IS_ERR(graph)) {
dev_err(dai->dev, "Failed to open graph (%d)\n", graph_id);
diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c
index 2a2a5bd98110b..38d8aaab876d2 100644
--- a/sound/soc/qcom/qdsp6/q6apm.c
+++ b/sound/soc/qcom/qdsp6/q6apm.c
@@ -195,7 +195,7 @@ int q6apm_graph_media_format_shmem(struct q6apm_graph *graph,
{
struct audioreach_module *module;
- if (cfg->direction == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(cfg->direction))
module = q6apm_find_module_by_mid(graph, MODULE_ID_RD_SHARED_MEM_EP);
else
module = q6apm_find_module_by_mid(graph, MODULE_ID_WR_SHARED_MEM_EP);
@@ -218,7 +218,7 @@ int q6apm_map_memory_regions(struct q6apm_graph *graph, unsigned int dir, phys_a
int cnt;
int rc;
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
data = &graph->rx_data;
else
data = &graph->tx_data;
@@ -236,7 +236,7 @@ int q6apm_map_memory_regions(struct q6apm_graph *graph, unsigned int dir, phys_a
return -ENOMEM;
}
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
data = &graph->rx_data;
else
data = &graph->tx_data;
@@ -273,7 +273,7 @@ int q6apm_unmap_memory_regions(struct q6apm_graph *graph, unsigned int dir)
struct gpr_pkt *pkt;
int rc;
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
data = &graph->rx_data;
else
data = &graph->tx_data;
@@ -538,7 +538,7 @@ static int graph_callback(struct gpr_resp_pkt *data, void *priv, int op)
graph->result.status = 0;
rsp = data->payload;
- if (hdr->token == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(hdr->token))
graph->rx_data.mem_map_handle = rsp->mem_map_handle;
else
graph->tx_data.mem_map_handle = rsp->mem_map_handle;
@@ -575,7 +575,7 @@ static int graph_callback(struct gpr_resp_pkt *data, void *priv, int op)
case APM_CMD_SHARED_MEM_UNMAP_REGIONS:
graph->result.opcode = result->opcode;
graph->result.status = 0;
- if (hdr->token == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(hdr->token))
graph->rx_data.mem_map_handle = 0;
else
graph->tx_data.mem_map_handle = 0;
diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
index 3913706ccdc5f..3e3d2847f992b 100644
--- a/sound/soc/qcom/qdsp6/q6asm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
@@ -187,7 +187,7 @@ static void event_handler(uint32_t opcode, uint32_t token,
switch (opcode) {
case ASM_CLIENT_EVENT_CMD_RUN_DONE:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
q6asm_write_async(prtd->audio_client, prtd->stream_id,
prtd->pcm_count, 0, 0, 0);
break;
@@ -258,11 +258,11 @@ static int q6asm_dai_prepare(struct snd_soc_component *component,
return -ENOMEM;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ret = q6asm_open_write(prtd->audio_client, prtd->stream_id,
FORMAT_LINEAR_PCM,
0, prtd->bits_per_sample, false);
- } else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ } else if (snd_pcm_is_capture(substream)) {
ret = q6asm_open_read(prtd->audio_client, prtd->stream_id,
FORMAT_LINEAR_PCM,
prtd->bits_per_sample);
@@ -281,12 +281,12 @@ static int q6asm_dai_prepare(struct snd_soc_component *component,
goto routing_err;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ret = q6asm_media_format_block_multi_ch_pcm(
prtd->audio_client, prtd->stream_id,
runtime->rate, runtime->channels, NULL,
prtd->bits_per_sample);
- } else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ } else if (snd_pcm_is_capture(substream)) {
ret = q6asm_enc_cfg_blk_pcm_format_support(prtd->audio_client,
prtd->stream_id,
runtime->rate,
@@ -385,9 +385,9 @@ static int q6asm_dai_open(struct snd_soc_component *component,
/* DSP expects stream id from 1 */
prtd->stream_id = 1;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
runtime->hw = q6asm_dai_hardware_playback;
- else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ else if (snd_pcm_is_capture(substream))
runtime->hw = q6asm_dai_hardware_capture;
ret = snd_pcm_hw_constraint_list(runtime, 0,
@@ -401,7 +401,7 @@ static int q6asm_dai_open(struct snd_soc_component *component,
if (ret < 0)
dev_info(dev, "snd_pcm_hw_constraint_integer failed\n");
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ret = snd_pcm_hw_constraint_minmax(runtime,
SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
PLAYBACK_MIN_NUM_PERIODS * PLAYBACK_MIN_PERIOD_SIZE,
diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c
index 81fde0681f952..7e7ad072700d2 100644
--- a/sound/soc/qcom/qdsp6/q6routing.c
+++ b/sound/soc/qcom/qdsp6/q6routing.c
@@ -1055,7 +1055,7 @@ static int routing_hw_params(struct snd_soc_component *component,
struct session_data *session;
int path_type;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
path_type = ADM_PATH_PLAYBACK;
else
path_type = ADM_PATH_LIVE_REC;
diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c
index 75701546b6ea8..daa38d07a50f2 100644
--- a/sound/soc/qcom/sdm845.c
+++ b/sound/soc/qcom/sdm845.c
@@ -84,7 +84,7 @@ static int sdm845_slim_snd_hw_params(struct snd_pcm_substream *substream,
continue;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
ret = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL,
rx_ch_cnt, rx_ch);
else
@@ -115,7 +115,7 @@ static int sdm845_tdm_snd_hw_params(struct snd_pcm_substream *substream,
}
channels = params_channels(params);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0, 0x3,
8, slot_width);
if (ret < 0) {
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 057/113] ASoC: sprd: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (55 preceding siblings ...)
2024-08-05 0:39 ` [PATCH 056/113] ASoC: qcom: " Kuninori Morimoto
@ 2024-08-05 0:39 ` Kuninori Morimoto
2024-08-05 0:39 ` [PATCH 058/113] ASoC: au1x: " Kuninori Morimoto
` (57 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/sprd/sprd-pcm-dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/sprd/sprd-pcm-dma.c b/sound/soc/sprd/sprd-pcm-dma.c
index d6b96cc2f7087..b7149322b9858 100644
--- a/sound/soc/sprd/sprd-pcm-dma.c
+++ b/sound/soc/sprd/sprd-pcm-dma.c
@@ -195,7 +195,7 @@ static int sprd_pcm_hw_params(struct snd_soc_component *component,
size_t totsize = params_buffer_bytes(params);
size_t period = params_period_bytes(params);
int channels = params_channels(params);
- int is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ int is_playback = snd_pcm_is_playback(substream);
struct scatterlist *sg;
unsigned long flags;
int ret, i, j, sg_num;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 058/113] ASoC: au1x: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (56 preceding siblings ...)
2024-08-05 0:39 ` [PATCH 057/113] ASoC: sprd: " Kuninori Morimoto
@ 2024-08-05 0:39 ` Kuninori Morimoto
2024-08-05 0:39 ` [PATCH 059/113] ASoC: apple: " Kuninori Morimoto
` (56 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/au1x/dbdma2.c | 4 ++--
sound/soc/au1x/dma.c | 2 +-
sound/soc/au1x/psc-ac97.c | 10 +++++-----
sound/soc/au1x/psc-i2s.c | 8 ++++----
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c
index ea01d6490cec0..307cfbc7f713f 100644
--- a/sound/soc/au1x/dbdma2.c
+++ b/sound/soc/au1x/dbdma2.c
@@ -158,7 +158,7 @@ static int au1x_pcm_dbdma_realloc(struct au1xpsc_audio_dmadata *pcd,
au1x_pcm_dbdma_free(pcd);
- if (stype == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(stype))
pcd->ddma_chan = au1xxx_dbdma_chan_alloc(pcd->ddma_id,
DSCR_CMD0_ALWAYS,
au1x_pcm_dmarx_cb, (void *)pcd);
@@ -235,7 +235,7 @@ static int au1xpsc_pcm_prepare(struct snd_soc_component *component,
au1xxx_dbdma_reset(pcd->ddma_chan);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
au1x_pcm_queue_rx(pcd);
au1x_pcm_queue_rx(pcd);
} else {
diff --git a/sound/soc/au1x/dma.c b/sound/soc/au1x/dma.c
index d2fdebd8881bb..7a8ff759ab4b1 100644
--- a/sound/soc/au1x/dma.c
+++ b/sound/soc/au1x/dma.c
@@ -200,7 +200,7 @@ static int alchemy_pcm_open(struct snd_soc_component *component,
return -ENODEV; /* whoa, has ordering changed? */
/* DMA setup */
- name = (s == SNDRV_PCM_STREAM_PLAYBACK) ? "audio-tx" : "audio-rx";
+ name = snd_pcm_is_playback(s) ? "audio-tx" : "audio-rx";
ctx->stream[s].dma = request_au1000_dma(dmaids[s], name,
au1000_dma_interrupt, 0,
&ctx->stream[s]);
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c
index 1727eeb12b64e..62627ec731063 100644
--- a/sound/soc/au1x/psc-ac97.c
+++ b/sound/soc/au1x/psc-ac97.c
@@ -37,14 +37,14 @@
(SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3BE)
#define AC97PCR_START(stype) \
- ((stype) == SNDRV_PCM_STREAM_PLAYBACK ? PSC_AC97PCR_TS : PSC_AC97PCR_RS)
+ (snd_pcm_is_playback(stype) ? PSC_AC97PCR_TS : PSC_AC97PCR_RS)
#define AC97PCR_STOP(stype) \
- ((stype) == SNDRV_PCM_STREAM_PLAYBACK ? PSC_AC97PCR_TP : PSC_AC97PCR_RP)
+ (snd_pcm_is_playback(stype) ? PSC_AC97PCR_TP : PSC_AC97PCR_RP)
#define AC97PCR_CLRFIFO(stype) \
- ((stype) == SNDRV_PCM_STREAM_PLAYBACK ? PSC_AC97PCR_TC : PSC_AC97PCR_RC)
+ (snd_pcm_is_playback(stype) ? PSC_AC97PCR_TC : PSC_AC97PCR_RC)
#define AC97STAT_BUSY(stype) \
- ((stype) == SNDRV_PCM_STREAM_PLAYBACK ? PSC_AC97STAT_TB : PSC_AC97STAT_RB)
+ (snd_pcm_is_playback(stype) ? PSC_AC97STAT_TB : PSC_AC97STAT_RB)
/* instance data. There can be only one, MacLeod!!!! */
static struct au1xpsc_audio_data *au1xpsc_ac97_workdata;
@@ -230,7 +230,7 @@ static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream,
r |= PSC_AC97CFG_SET_LEN(params->msbits);
/* channels: enable slots for front L/R channel */
- if (stype == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stype)) {
r &= ~PSC_AC97CFG_TXSLOT_MASK;
r |= PSC_AC97CFG_TXSLOT_ENA(3);
r |= PSC_AC97CFG_TXSLOT_ENA(4);
diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c
index 52734dec82472..bd4a75fec9822 100644
--- a/sound/soc/au1x/psc-i2s.c
+++ b/sound/soc/au1x/psc-i2s.c
@@ -39,13 +39,13 @@
(SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
#define I2SSTAT_BUSY(stype) \
- ((stype) == SNDRV_PCM_STREAM_PLAYBACK ? PSC_I2SSTAT_TB : PSC_I2SSTAT_RB)
+ (snd_pcm_is_playback(stype) ? PSC_I2SSTAT_TB : PSC_I2SSTAT_RB)
#define I2SPCR_START(stype) \
- ((stype) == SNDRV_PCM_STREAM_PLAYBACK ? PSC_I2SPCR_TS : PSC_I2SPCR_RS)
+ (snd_pcm_is_playback(stype) ? PSC_I2SPCR_TS : PSC_I2SPCR_RS)
#define I2SPCR_STOP(stype) \
- ((stype) == SNDRV_PCM_STREAM_PLAYBACK ? PSC_I2SPCR_TP : PSC_I2SPCR_RP)
+ (snd_pcm_is_playback(stype) ? PSC_I2SPCR_TP : PSC_I2SPCR_RP)
#define I2SPCR_CLRFIFO(stype) \
- ((stype) == SNDRV_PCM_STREAM_PLAYBACK ? PSC_I2SPCR_TC : PSC_I2SPCR_RC)
+ (snd_pcm_is_playback(stype) ? PSC_I2SPCR_TC : PSC_I2SPCR_RC)
static int au1xpsc_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 059/113] ASoC: apple: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (57 preceding siblings ...)
2024-08-05 0:39 ` [PATCH 058/113] ASoC: au1x: " Kuninori Morimoto
@ 2024-08-05 0:39 ` Kuninori Morimoto
2024-08-05 0:40 ` [PATCH 060/113] ASoC: atmel: " Kuninori Morimoto
` (55 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/apple/mca.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/apple/mca.c b/sound/soc/apple/mca.c
index 3780aca710769..60a5ecbd5f756 100644
--- a/sound/soc/apple/mca.c
+++ b/sound/soc/apple/mca.c
@@ -193,7 +193,7 @@ static void mca_fe_early_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{
struct mca_cluster *cl = mca_dai_to_cluster(dai);
- bool is_tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool is_tx = snd_pcm_is_playback(substream);
int serdes_unit = is_tx ? CLUSTER_TX_OFF : CLUSTER_RX_OFF;
int serdes_conf =
serdes_unit + (is_tx ? REG_TX_SERDES_CONF : REG_RX_SERDES_CONF);
@@ -230,7 +230,7 @@ static int mca_fe_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{
struct mca_cluster *cl = mca_dai_to_cluster(dai);
- bool is_tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool is_tx = snd_pcm_is_playback(substream);
int serdes_unit = is_tx ? CLUSTER_TX_OFF : CLUSTER_RX_OFF;
switch (cmd) {
@@ -570,7 +570,7 @@ static int mca_fe_hw_params(struct snd_pcm_substream *substream,
struct mca_data *mca = cl->host;
struct device *dev = mca->dev;
unsigned int samp_rate = params_rate(params);
- bool is_tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool is_tx = snd_pcm_is_playback(substream);
bool refine_tdm = false;
unsigned long bclk_ratio;
unsigned int tdm_slots, tdm_slot_width, tdm_mask;
@@ -844,7 +844,7 @@ static int mca_hw_params(struct snd_soc_component *component,
if (ret < 0)
return ret;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
slave_config.dst_port_window_size =
min_t(u32, params_channels(params), 4);
else
@@ -895,7 +895,7 @@ static snd_pcm_uframes_t mca_pointer(struct snd_soc_component *component,
static struct dma_chan *mca_request_dma_channel(struct mca_cluster *cl, unsigned int stream)
{
- bool is_tx = (stream == SNDRV_PCM_STREAM_PLAYBACK);
+ bool is_tx = snd_pcm_is_playback(stream);
#ifndef USE_RXB_FOR_CAPTURE
char *name = devm_kasprintf(cl->host->dev, GFP_KERNEL,
is_tx ? "tx%da" : "rx%da", cl->no);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 060/113] ASoC: atmel: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (58 preceding siblings ...)
2024-08-05 0:39 ` [PATCH 059/113] ASoC: apple: " Kuninori Morimoto
@ 2024-08-05 0:40 ` Kuninori Morimoto
2024-08-05 0:40 ` [PATCH 061/113] ASoC: intel: avs: " Kuninori Morimoto
` (54 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/atmel/atmel-i2s.c | 6 +++---
sound/soc/atmel/atmel-pcm-dma.c | 2 +-
sound/soc/atmel/atmel-pcm-pdc.c | 2 +-
sound/soc/atmel/atmel_ssc_dai.c | 10 +++++-----
sound/soc/atmel/mchp-i2s-mcc.c | 6 +++---
sound/soc/atmel/mchp-spdifrx.c | 2 +-
sound/soc/atmel/mchp-spdiftx.c | 2 +-
7 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/sound/soc/atmel/atmel-i2s.c b/sound/soc/atmel/atmel-i2s.c
index 6c20c643f3218..97bf80ba45531 100644
--- a/sound/soc/atmel/atmel-i2s.c
+++ b/sound/soc/atmel/atmel-i2s.c
@@ -272,7 +272,7 @@ static int atmel_i2s_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct atmel_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
- bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ bool is_playback = snd_pcm_is_playback(substream);
unsigned int rhr, sr = 0;
if (is_playback) {
@@ -324,7 +324,7 @@ static int atmel_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct atmel_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
- bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ bool is_playback = snd_pcm_is_playback(substream);
unsigned int mr = 0, mr_mask;
int ret;
@@ -477,7 +477,7 @@ static int atmel_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{
struct atmel_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
- bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ bool is_playback = snd_pcm_is_playback(substream);
bool is_master, mck_enabled;
unsigned int cr, mr;
int err;
diff --git a/sound/soc/atmel/atmel-pcm-dma.c b/sound/soc/atmel/atmel-pcm-dma.c
index 7306e04da513b..f65c30a5dd4f7 100644
--- a/sound/soc/atmel/atmel-pcm-dma.c
+++ b/sound/soc/atmel/atmel-pcm-dma.c
@@ -60,7 +60,7 @@ static void atmel_pcm_dma_irq(u32 ssc_sr,
if (ssc_sr & prtd->mask->ssc_error) {
if (snd_pcm_running(substream))
pr_warn("atmel-pcm: buffer %s on %s (SSC_SR=%#x)\n",
- substream->stream == SNDRV_PCM_STREAM_PLAYBACK
+ snd_pcm_is_playback(substream)
? "underrun" : "overrun", prtd->name,
ssc_sr);
diff --git a/sound/soc/atmel/atmel-pcm-pdc.c b/sound/soc/atmel/atmel-pcm-pdc.c
index 7db8df85c54f3..81ad08d436a34 100644
--- a/sound/soc/atmel/atmel-pcm-pdc.c
+++ b/sound/soc/atmel/atmel-pcm-pdc.c
@@ -96,7 +96,7 @@ static void atmel_pcm_dma_irq(u32 ssc_sr,
if (ssc_sr & params->mask->ssc_endbuf) {
pr_warn("atmel-pcm: buffer %s on %s (SSC_SR=%#x, count=%d)\n",
- substream->stream == SNDRV_PCM_STREAM_PLAYBACK
+ snd_pcm_is_playback(substream)
? "underrun" : "overrun",
params->name, ssc_sr, count);
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index 3763454436c15..3a8dd39537db8 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -290,7 +290,7 @@ static int atmel_ssc_startup(struct snd_pcm_substream *substream,
if (!ssc_p->initialized)
ssc_writel(ssc_p->ssc->regs, CR, SSC_BIT(CR_SWRST));
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
dir = 0;
dir_mask = SSC_DIR_MASK_PLAYBACK;
} else {
@@ -337,7 +337,7 @@ static void atmel_ssc_shutdown(struct snd_pcm_substream *substream,
struct atmel_pcm_dma_params *dma_params;
int dir, dir_mask;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dir = 0;
else
dir = 1;
@@ -476,7 +476,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
* each direction. If more are added, this code will
* have to be changed to select the proper set.
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dir = 0;
else
dir = 1;
@@ -717,7 +717,7 @@ static int atmel_ssc_prepare(struct snd_pcm_substream *substream,
struct atmel_pcm_dma_params *dma_params;
int dir;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dir = 0;
else
dir = 1;
@@ -741,7 +741,7 @@ static int atmel_ssc_trigger(struct snd_pcm_substream *substream,
struct atmel_pcm_dma_params *dma_params;
int dir;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dir = 0;
else
dir = 1;
diff --git a/sound/soc/atmel/mchp-i2s-mcc.c b/sound/soc/atmel/mchp-i2s-mcc.c
index 193dd7acceb08..017f363ed389d 100644
--- a/sound/soc/atmel/mchp-i2s-mcc.c
+++ b/sound/soc/atmel/mchp-i2s-mcc.c
@@ -517,7 +517,7 @@ static int mchp_i2s_mcc_hw_params(struct snd_pcm_substream *substream,
unsigned int bclk_rate;
int set_divs = 0;
int ret;
- bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ bool is_playback = snd_pcm_is_playback(substream);
dev_dbg(dev->dev, "%s() rate=%u format=%#x width=%u channels=%u\n",
__func__, params_rate(params), params_format(params),
@@ -733,7 +733,7 @@ static int mchp_i2s_mcc_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct mchp_i2s_mcc_dev *dev = snd_soc_dai_get_drvdata(dai);
- bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ bool is_playback = snd_pcm_is_playback(substream);
long err;
if (is_playback) {
@@ -789,7 +789,7 @@ static int mchp_i2s_mcc_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{
struct mchp_i2s_mcc_dev *dev = snd_soc_dai_get_drvdata(dai);
- bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ bool is_playback = snd_pcm_is_playback(substream);
u32 cr = 0;
u32 iera = 0, ierb = 0;
u32 sr;
diff --git a/sound/soc/atmel/mchp-spdifrx.c b/sound/soc/atmel/mchp-spdifrx.c
index 33ce5e54482be..653c575e9a1f6 100644
--- a/sound/soc/atmel/mchp-spdifrx.c
+++ b/sound/soc/atmel/mchp-spdifrx.c
@@ -436,7 +436,7 @@ static int mchp_spdifrx_hw_params(struct snd_pcm_substream *substream,
__func__, params_rate(params), params_format(params),
params_width(params), params_channels(params));
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
dev_err(dev->dev, "Playback is not supported\n");
return -EINVAL;
}
diff --git a/sound/soc/atmel/mchp-spdiftx.c b/sound/soc/atmel/mchp-spdiftx.c
index a201a96fa6906..1e73a720ff6bb 100644
--- a/sound/soc/atmel/mchp-spdiftx.c
+++ b/sound/soc/atmel/mchp-spdiftx.c
@@ -358,7 +358,7 @@ static int mchp_spdiftx_hw_params(struct snd_pcm_substream *substream,
__func__, params_rate(params), params_format(params),
params_width(params), params_channels(params));
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
dev_err(dev->dev, "Capture is not supported\n");
return -EINVAL;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 061/113] ASoC: intel: avs: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (59 preceding siblings ...)
2024-08-05 0:40 ` [PATCH 060/113] ASoC: atmel: " Kuninori Morimoto
@ 2024-08-05 0:40 ` Kuninori Morimoto
2024-08-05 0:40 ` [PATCH 062/113] ASoC: intel: " Kuninori Morimoto
` (53 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/intel/avs/path.c | 2 +-
sound/soc/intel/avs/pcm.c | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index f31d5e2caa7b0..dab52a90f4c31 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -171,7 +171,7 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
if (t->cfg_ext->copier.blob_fmt)
fmt = t->cfg_ext->copier.blob_fmt;
- else if (direction == SNDRV_PCM_STREAM_CAPTURE)
+ else if (snd_pcm_is_capture(direction))
fmt = t->in_fmt;
else
fmt = t->cfg_ext->copier.out_fmt;
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index c76b86254a8b4..df71a0292d4a6 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -40,7 +40,7 @@ avs_dai_find_path_template(struct snd_soc_dai *dai, bool is_fe, int direction)
struct snd_soc_dapm_path *dp;
enum snd_soc_dapm_direction dir;
- if (direction == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(direction)) {
dir = is_fe ? SND_SOC_DAPM_DIR_OUT : SND_SOC_DAPM_DIR_IN;
} else {
dir = is_fe ? SND_SOC_DAPM_DIR_IN : SND_SOC_DAPM_DIR_OUT;
@@ -331,7 +331,7 @@ static int avs_dai_hda_be_hw_free(struct snd_pcm_substream *substream, struct sn
if (!link)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
snd_hdac_ext_bus_link_clear_stream_id(link, hdac_stream(link_stream)->stream_tag);
return 0;
@@ -372,7 +372,7 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn
if (!link)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
snd_hdac_ext_bus_link_set_stream_id(link, hdac_stream(link_stream)->stream_tag);
ret = avs_dai_prepare(substream, dai);
@@ -695,7 +695,7 @@ static void avs_hda_stream_start(struct hdac_bus *bus, struct hdac_ext_stream *h
* disable L1SEN to avoid sound clipping.
*/
if (!first_running) {
- if (hdac_stream(host_stream)->direction == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(hdac_stream(host_stream)->direction))
avs_hda_l1sen_enable(adev, false);
snd_hdac_stream_start(hdac_stream(host_stream));
return;
@@ -707,7 +707,7 @@ static void avs_hda_stream_start(struct hdac_bus *bus, struct hdac_ext_stream *h
* re-enable L1SEN.
*/
if (list_entry_is_head(pos, &bus->stream_list, list) &&
- first_running->direction == SNDRV_PCM_STREAM_CAPTURE)
+ snd_pcm_is_capture(first_running->direction))
avs_hda_l1sen_enable(adev, true);
}
@@ -733,7 +733,7 @@ static void avs_hda_stream_stop(struct hdac_bus *bus, struct hdac_ext_stream *ho
*/
if (!first_running) {
snd_hdac_stream_stop(hdac_stream(host_stream));
- if (hdac_stream(host_stream)->direction == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(hdac_stream(host_stream)->direction))
avs_hda_l1sen_enable(adev, true);
return;
}
@@ -743,7 +743,7 @@ static void avs_hda_stream_stop(struct hdac_bus *bus, struct hdac_ext_stream *ho
* left, disable L1SEN to avoid sound clipping.
*/
if (list_entry_is_head(pos, &bus->stream_list, list) &&
- first_running->direction == SNDRV_PCM_STREAM_CAPTURE)
+ snd_pcm_is_capture(first_running->direction))
avs_hda_l1sen_enable(adev, false);
snd_hdac_stream_stop(hdac_stream(host_stream));
@@ -1602,7 +1602,7 @@ static int avs_component_hda_open(struct snd_soc_component *component,
}
/* RESUME unsupported for de-coupled HD-Audio capture. */
- if (dir == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(dir))
hwparams.info &= ~SNDRV_PCM_INFO_RESUME;
return snd_soc_set_runtime_hwparams(substream, &hwparams);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 062/113] ASoC: intel: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (60 preceding siblings ...)
2024-08-05 0:40 ` [PATCH 061/113] ASoC: intel: avs: " Kuninori Morimoto
@ 2024-08-05 0:40 ` Kuninori Morimoto
2024-08-05 0:40 ` [PATCH 063/113] ASoC: soc-*: " Kuninori Morimoto
` (52 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/intel/atom/sst-atom-controls.c | 2 +-
sound/soc/intel/atom/sst/sst_drv_interface.c | 2 +-
sound/soc/intel/boards/bdw-rt5650.c | 2 +-
sound/soc/intel/boards/sof_maxim_common.c | 2 +-
sound/soc/intel/boards/sof_sdw.c | 4 +--
sound/soc/intel/catpt/pcm.c | 4 +--
sound/soc/intel/keembay/kmb_platform.c | 28 ++++++++++----------
sound/soc/intel/skylake/skl-pcm.c | 14 +++++-----
sound/soc/intel/skylake/skl-topology.c | 18 ++++++-------
9 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c
index 38116c7587174..0c6ce403148f8 100644
--- a/sound/soc/intel/atom/sst-atom-controls.c
+++ b/sound/soc/intel/atom/sst-atom-controls.c
@@ -1333,7 +1333,7 @@ int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute)
dev_dbg(dai->dev, "enter, dai-name=%s dir=%d\n", dai->name, stream);
dev_dbg(dai->dev, "Stream name=%s\n", w->name);
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
snd_soc_dapm_widget_for_each_sink_path(w, p) {
if (p->connected && !p->connected(w, p->sink))
continue;
diff --git a/sound/soc/intel/atom/sst/sst_drv_interface.c b/sound/soc/intel/atom/sst/sst_drv_interface.c
index dc31c2c8f54c8..f02ee7f48a2a4 100644
--- a/sound/soc/intel/atom/sst/sst_drv_interface.c
+++ b/sound/soc/intel/atom/sst/sst_drv_interface.c
@@ -487,7 +487,7 @@ static inline int sst_calc_tstamp(struct intel_sst_drv *ctx,
fw_tstamp->ring_buffer_counter);
dev_dbg(ctx->dev, "mrfld hardware_counter %llu in bytes\n",
fw_tstamp->hardware_counter);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
delay_bytes = (size_t) (fw_tstamp->ring_buffer_counter -
fw_tstamp->hardware_counter);
else
diff --git a/sound/soc/intel/boards/bdw-rt5650.c b/sound/soc/intel/boards/bdw-rt5650.c
index 3c7cee03a02e6..a5df4d3067d71 100644
--- a/sound/soc/intel/boards/bdw-rt5650.c
+++ b/sound/soc/intel/boards/bdw-rt5650.c
@@ -150,7 +150,7 @@ static int bdw_rt5650_fe_startup(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
/* Board supports stereo and quad configurations for capture */
- if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
+ if (!snd_pcm_is_capture(substream))
return 0;
runtime->hw.channels_max = 4;
diff --git a/sound/soc/intel/boards/sof_maxim_common.c b/sound/soc/intel/boards/sof_maxim_common.c
index fcc3b95e57a4f..f520442bbb096 100644
--- a/sound/soc/intel/boards/sof_maxim_common.c
+++ b/sound/soc/intel/boards/sof_maxim_common.c
@@ -196,7 +196,7 @@ static int max_98373_trigger(struct snd_pcm_substream *substream, int cmd)
int ret = 0;
/* set spk pin by playback only */
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
return 0;
cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index d258728d64cf5..5818c21173032 100644
--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -846,8 +846,8 @@ static int create_sdw_dailink(struct snd_soc_card *card,
WARN_ON(i != num_cpus || j != num_codecs);
- playback = (stream == SNDRV_PCM_STREAM_PLAYBACK);
- capture = (stream == SNDRV_PCM_STREAM_CAPTURE);
+ playback = snd_pcm_is_playback(stream);
+ capture = snd_pcm_is_capture(stream);
asoc_sdw_init_dai_link(dev, *dai_links, be_id, name, playback, capture,
cpus, num_cpus, platform_component,
diff --git a/sound/soc/intel/catpt/pcm.c b/sound/soc/intel/catpt/pcm.c
index 81a2f0339e055..c32c101e65b9c 100644
--- a/sound/soc/intel/catpt/pcm.c
+++ b/sound/soc/intel/catpt/pcm.c
@@ -83,11 +83,11 @@ catpt_get_stream_template(struct snd_pcm_substream *substream)
/* account for capture in bidirectional dais */
switch (type) {
case CATPT_STRM_TYPE_SYSTEM:
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
type = CATPT_STRM_TYPE_CAPTURE;
break;
case CATPT_STRM_TYPE_BLUETOOTH_RENDER:
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
type = CATPT_STRM_TYPE_BLUETOOTH_CAPTURE;
break;
default:
diff --git a/sound/soc/intel/keembay/kmb_platform.c b/sound/soc/intel/keembay/kmb_platform.c
index 37ea2e1d2e922..eab7b8223b51b 100644
--- a/sound/soc/intel/keembay/kmb_platform.c
+++ b/sound/soc/intel/keembay/kmb_platform.c
@@ -170,7 +170,7 @@ static inline void kmb_i2s_disable_channels(struct kmb_i2s_info *kmb_i2s,
u32 i;
/* Disable all channels regardless of configuration*/
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
for (i = 0; i < MAX_ISR; i++)
writel(0, kmb_i2s->i2s_base + TER(i));
} else {
@@ -184,7 +184,7 @@ static inline void kmb_i2s_clear_irqs(struct kmb_i2s_info *kmb_i2s, u32 stream)
struct i2s_clk_config_data *config = &kmb_i2s->config;
u32 i;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
for (i = 0; i < config->chan_nr / 2; i++)
readl(kmb_i2s->i2s_base + TOR(i));
} else {
@@ -199,7 +199,7 @@ static inline void kmb_i2s_irq_trigger(struct kmb_i2s_info *kmb_i2s,
u32 i, irq;
u32 flag;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
flag = TX_INT_FLAG;
else
flag = RX_INT_FLAG;
@@ -270,7 +270,7 @@ static int kmb_pcm_trigger(struct snd_soc_component *component,
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
kmb_i2s->tx_ptr = 0;
kmb_i2s->tx_substream = substream;
} else {
@@ -279,7 +279,7 @@ static int kmb_pcm_trigger(struct snd_soc_component *component,
}
break;
case SNDRV_PCM_TRIGGER_STOP:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
kmb_i2s->tx_substream = NULL;
else
kmb_i2s->rx_substream = NULL;
@@ -378,7 +378,7 @@ static snd_pcm_uframes_t kmb_pcm_pointer(struct snd_soc_component *component,
struct kmb_i2s_info *kmb_i2s = runtime->private_data;
snd_pcm_uframes_t pos;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
pos = kmb_i2s->tx_ptr;
else
pos = kmb_i2s->rx_ptr;
@@ -419,7 +419,7 @@ static inline void kmb_i2s_enable_dma(struct kmb_i2s_info *kmb_i2s, u32 stream)
dma_reg = readl(kmb_i2s->i2s_base + I2S_DMACR);
/* Enable DMA handshake for stream */
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
dma_reg |= I2S_DMAEN_TXBLOCK;
else
dma_reg |= I2S_DMAEN_RXBLOCK;
@@ -433,7 +433,7 @@ static inline void kmb_i2s_disable_dma(struct kmb_i2s_info *kmb_i2s, u32 stream)
dma_reg = readl(kmb_i2s->i2s_base + I2S_DMACR);
/* Disable DMA handshake for stream */
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
dma_reg &= ~I2S_DMAEN_TXBLOCK;
writel(1, kmb_i2s->i2s_base + I2S_RTXDMA);
} else {
@@ -451,7 +451,7 @@ static void kmb_i2s_start(struct kmb_i2s_info *kmb_i2s,
/* I2S Programming sequence in Keem_Bay_VPU_DB_v1.1 */
writel(1, kmb_i2s->i2s_base + IER);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
writel(1, kmb_i2s->i2s_base + ITER);
else
writel(1, kmb_i2s->i2s_base + IRER);
@@ -474,7 +474,7 @@ static void kmb_i2s_stop(struct kmb_i2s_info *kmb_i2s,
/* I2S Programming sequence in Keem_Bay_VPU_DB_v1.1 */
kmb_i2s_clear_irqs(kmb_i2s, substream->stream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
writel(0, kmb_i2s->i2s_base + ITER);
else
writel(0, kmb_i2s->i2s_base + IRER);
@@ -556,7 +556,7 @@ static void kmb_i2s_config(struct kmb_i2s_info *kmb_i2s, int stream)
kmb_i2s_disable_channels(kmb_i2s, stream);
for (ch_reg = 0; ch_reg < config->chan_nr / 2; ch_reg++) {
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
writel(kmb_i2s->xfer_resolution,
kmb_i2s->i2s_base + TCR(ch_reg));
@@ -678,7 +678,7 @@ static int kmb_dai_prepare(struct snd_pcm_substream *substream,
{
struct kmb_i2s_info *kmb_i2s = snd_soc_dai_get_drvdata(cpu_dai);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
writel(1, kmb_i2s->i2s_base + TXFFR);
else
writel(1, kmb_i2s->i2s_base + RXFFR);
@@ -695,7 +695,7 @@ static int kmb_dai_startup(struct snd_pcm_substream *substream,
if (kmb_i2s->use_pio)
return 0;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dma_data = &kmb_i2s->play_dma_data;
else
dma_data = &kmb_i2s->capture_dma_data;
@@ -713,7 +713,7 @@ static int kmb_dai_hw_free(struct snd_pcm_substream *substream,
if (kmb_i2s->use_pio)
kmb_i2s_clear_irqs(kmb_i2s, substream->stream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
writel(0, kmb_i2s->i2s_base + ITER);
else
writel(0, kmb_i2s->i2s_base + IRER);
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 613b27b8da134..2ffd511eedfe4 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -189,7 +189,7 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)
snd_hdac_ext_stream_setup(stream, format_val);
stream_tag = hstream->stream_tag;
- if (stream->hstream.direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream->hstream.direction)) {
list_for_each_entry(link, &bus->hlink_list, list) {
if (link->index == params->link_index)
snd_hdac_ext_bus_link_set_stream_id(link,
@@ -225,7 +225,7 @@ static int skl_pcm_open(struct snd_pcm_substream *substream,
* disable WALLCLOCK timestamps for capture streams
* until we figure out how to handle digital inputs
*/
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
runtime->hw.info &= ~SNDRV_PCM_INFO_HAS_WALL_CLOCK; /* legacy */
runtime->hw.info &= ~SNDRV_PCM_INFO_HAS_LINK_ATIME;
}
@@ -319,7 +319,7 @@ static int skl_pcm_hw_params(struct snd_pcm_substream *substream,
p_params.host_dma_id = dma_id;
p_params.stream = substream->stream;
p_params.format = params_format(params);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
p_params.host_bps = dai->driver->playback.sig_bits;
else
p_params.host_bps = dai->driver->capture.sig_bits;
@@ -574,7 +574,7 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,
p_params.link_index = link->index;
p_params.format = params_format(params);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
p_params.link_bps = codec_dai->driver->playback.sig_bits;
else
p_params.link_bps = codec_dai->driver->capture.sig_bits;
@@ -645,7 +645,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream,
if (!link)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
stream_tag = hdac_stream(link_dev)->stream_tag;
snd_hdac_ext_bus_link_clear_stream_id(link, stream_tag);
}
@@ -1193,7 +1193,7 @@ static snd_pcm_uframes_t skl_platform_soc_pointer(
* or greater than period boundary.
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
pos = readl(bus->remap_addr + AZX_REG_VS_SDXDPIB_XBASE +
(AZX_REG_VS_SDXDPIB_XINTERVAL *
hdac_stream(hstream)->index));
@@ -1226,7 +1226,7 @@ static u64 skl_adjust_codec_delay(struct snd_pcm_substream *substream,
codec_nsecs = div_u64(codec_frames * 1000000000LL,
substream->runtime->rate);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
return nsec + codec_nsecs;
return (nsec > codec_nsecs) ? nsec - codec_nsecs : 0;
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 602ef43211221..cb51b98b92c9a 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -198,7 +198,7 @@ static void skl_tplg_update_params_fixup(struct skl_module_cfg *m_cfg,
in_fmt = &m_cfg->module->formats[m_cfg->fmt_idx].inputs[0].fmt;
out_fmt = &m_cfg->module->formats[m_cfg->fmt_idx].outputs[0].fmt;
- if (params->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(params->stream)) {
if (is_fe) {
in_fixup = m_cfg->params_fixup;
out_fixup = (~m_cfg->converter) &
@@ -618,9 +618,9 @@ skl_tplg_get_pipe_config(struct skl_dev *skl, struct skl_module_cfg *mconfig)
}
if ((pipe->conn_type == SKL_PIPE_CONN_TYPE_FE &&
- pipe->direction == SNDRV_PCM_STREAM_PLAYBACK) ||
+ snd_pcm_is_playback(pipe->direction)) ||
(pipe->conn_type == SKL_PIPE_CONN_TYPE_BE &&
- pipe->direction == SNDRV_PCM_STREAM_CAPTURE))
+ snd_pcm_is_capture(pipe->direction)))
in_fmt = true;
for (i = 0; i < pipe->nr_cfgs; i++) {
@@ -1612,7 +1612,7 @@ int skl_tplg_update_pipe_params(struct device *dev,
if (skl->nr_modules)
return 0;
- if (params->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(params->stream))
format = &mconfig->module->formats[mconfig->fmt_idx].inputs[0].fmt;
else
format = &mconfig->module->formats[mconfig->fmt_idx].outputs[0].fmt;
@@ -1642,7 +1642,7 @@ int skl_tplg_update_pipe_params(struct device *dev,
return -EINVAL;
}
- if (params->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(params->stream)) {
res->ibs = (format->s_freq / 1000) *
(format->channels) *
(format->bit_depth >> 3);
@@ -1666,7 +1666,7 @@ skl_tplg_fe_get_cpr_module(struct snd_soc_dai *dai, int stream)
struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(dai, stream);
struct snd_soc_dapm_path *p = NULL;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
snd_soc_dapm_widget_for_each_sink_path(w, p) {
if (p->connect && p->sink->power &&
!is_skl_dsp_widget_type(p->sink, dai->dev))
@@ -1745,7 +1745,7 @@ skl_tplg_be_get_cpr_module(struct snd_soc_dai *dai, int stream)
struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(dai, stream);
struct skl_module_cfg *mconfig;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
mconfig = skl_get_mconfig_pb_cpr(dai, w);
} else {
mconfig = skl_get_mconfig_cap_cpr(dai, w);
@@ -1813,7 +1813,7 @@ static int skl_tplg_be_fill_pipe_params(struct snd_soc_dai *dai,
goto err;
dev_dbg(skl->dev, "%s using pipe config: %d\n", __func__, pipe->cur_config_idx);
- if (pipe->direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(pipe->direction))
pipe_fmt = &pipe->configs[pipe->cur_config_idx].out_fmt;
else
pipe_fmt = &pipe->configs[pipe->cur_config_idx].in_fmt;
@@ -1903,7 +1903,7 @@ int skl_tplg_be_update_params(struct snd_soc_dai *dai,
{
struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(dai, params->stream);
- if (params->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(params->stream)) {
return skl_tplg_be_set_src_pipe_params(dai, w, params);
} else {
return skl_tplg_be_set_sink_pipe_params(dai, w, params);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 063/113] ASoC: soc-*: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (61 preceding siblings ...)
2024-08-05 0:40 ` [PATCH 062/113] ASoC: intel: " Kuninori Morimoto
@ 2024-08-05 0:40 ` Kuninori Morimoto
2024-08-05 0:40 ` [PATCH 064/113] ASoC: spear: " Kuninori Morimoto
` (51 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/soc-core.c | 2 +-
sound/soc/soc-dai.c | 2 +-
sound/soc/soc-dapm.c | 4 ++--
sound/soc/soc-generic-dmaengine-pcm.c | 2 +-
sound/soc/soc-pcm.c | 6 +++---
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 20248a29d1674..286e872ae4547 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3456,7 +3456,7 @@ int snd_soc_get_stream_cpu(const struct snd_soc_dai_link *dai_link, int stream)
* CPU : SNDRV_PCM_STREAM_PLAYBACK
* Codec: SNDRV_PCM_STREAM_CAPTURE
*/
- if (stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(stream))
return SNDRV_PCM_STREAM_PLAYBACK;
return SNDRV_PCM_STREAM_CAPTURE;
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
index 9e47053419c16..28a0a7a0993af 100644
--- a/sound/soc/soc-dai.c
+++ b/sound/soc/soc-dai.c
@@ -379,7 +379,7 @@ int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
*/
if (dai->driver->ops &&
dai->driver->ops->mute_stream &&
- (direction == SNDRV_PCM_STREAM_PLAYBACK ||
+ (snd_pcm_is_playback(direction) ||
!dai->driver->ops->no_capture_mute))
ret = dai->driver->ops->mute_stream(dai, mute, direction);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index d7d6dbb9d9eae..0d60942f64113 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1312,7 +1312,7 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
snd_soc_dapm_mutex_lock(card);
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
invalidate_paths_ep(w, SND_SOC_DAPM_DIR_OUT);
paths = is_connected_output_ep(w, &widgets,
custom_stop_condition);
@@ -4539,7 +4539,7 @@ void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
void snd_soc_dapm_stream_stop(struct snd_soc_pcm_runtime *rtd, int stream)
{
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
if (snd_soc_runtime_ignore_pmdown_time(rtd)) {
/* powered down playback stream now */
snd_soc_dapm_stream_event(rtd,
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index a63e942fdc0b7..4265e8052d6bf 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -297,7 +297,7 @@ static int dmaengine_copy(struct snd_soc_component *component,
int (*process)(struct snd_pcm_substream *substream,
int channel, unsigned long hwoff,
unsigned long bytes) = pcm->config->process;
- bool is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool is_playback = snd_pcm_is_playback(substream);
void *dma_ptr = runtime->dma_area + hwoff +
channel * (runtime->dma_bytes / runtime->channels);
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 5520944ac9ddc..8f501178195e9 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -905,7 +905,7 @@ static int __soc_pcm_prepare(struct snd_soc_pcm_runtime *rtd,
goto out;
/* cancel any delayed stream shutdown that is pending */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(substream) &&
rtd->pop_wait) {
rtd->pop_wait = 0;
cancel_delayed_work(&rtd->delayed_work);
@@ -1517,11 +1517,11 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
switch (widget->id) {
case snd_soc_dapm_dai_in:
- if (stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(stream))
continue;
break;
case snd_soc_dapm_dai_out:
- if (stream != SNDRV_PCM_STREAM_CAPTURE)
+ if (!snd_pcm_is_capture(stream))
continue;
break;
default:
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 064/113] ASoC: spear: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (62 preceding siblings ...)
2024-08-05 0:40 ` [PATCH 063/113] ASoC: soc-*: " Kuninori Morimoto
@ 2024-08-05 0:40 ` Kuninori Morimoto
2024-08-05 0:40 ` [PATCH 065/113] ASoC: sunxi: " Kuninori Morimoto
` (50 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/spear/spdif_in.c | 6 +++---
sound/soc/spear/spdif_out.c | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c
index 4ad8b1fc713a7..fb1b54019194a 100644
--- a/sound/soc/spear/spdif_in.c
+++ b/sound/soc/spear/spdif_in.c
@@ -68,7 +68,7 @@ static void spdif_in_shutdown(struct snd_pcm_substream *substream,
{
struct spdif_in_dev *host = snd_soc_dai_get_drvdata(dai);
- if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
+ if (!snd_pcm_is_capture(substream))
return;
writel(0x0, host->io_base + SPDIF_IN_IRQ_MASK);
@@ -98,7 +98,7 @@ static int spdif_in_hw_params(struct snd_pcm_substream *substream,
struct spdif_in_dev *host = snd_soc_dai_get_drvdata(dai);
u32 format;
- if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
+ if (!snd_pcm_is_capture(substream))
return -EINVAL;
format = params_format(params);
@@ -114,7 +114,7 @@ static int spdif_in_trigger(struct snd_pcm_substream *substream, int cmd,
u32 ctrl;
int ret = 0;
- if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
+ if (!snd_pcm_is_capture(substream))
return -EINVAL;
switch (cmd) {
diff --git a/sound/soc/spear/spdif_out.c b/sound/soc/spear/spdif_out.c
index 469373d1bb418..a95a9b9e61e3b 100644
--- a/sound/soc/spear/spdif_out.c
+++ b/sound/soc/spear/spdif_out.c
@@ -63,7 +63,7 @@ static int spdif_out_startup(struct snd_pcm_substream *substream,
struct spdif_out_dev *host = snd_soc_dai_get_drvdata(cpu_dai);
int ret;
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return -EINVAL;
ret = clk_enable(host->clk);
@@ -81,7 +81,7 @@ static void spdif_out_shutdown(struct snd_pcm_substream *substream,
{
struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai);
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return;
clk_disable(host->clk);
@@ -109,7 +109,7 @@ static int spdif_out_hw_params(struct snd_pcm_substream *substream,
struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai);
u32 rate, core_freq;
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return -EINVAL;
rate = params_rate(params);
@@ -155,7 +155,7 @@ static int spdif_out_trigger(struct snd_pcm_substream *substream, int cmd,
u32 ctrl;
int ret = 0;
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return -EINVAL;
switch (cmd) {
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 065/113] ASoC: sunxi: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (63 preceding siblings ...)
2024-08-05 0:40 ` [PATCH 064/113] ASoC: spear: " Kuninori Morimoto
@ 2024-08-05 0:40 ` Kuninori Morimoto
2024-08-05 0:40 ` [PATCH 066/113] ASoC: tegra: " Kuninori Morimoto
` (49 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/sunxi/sun4i-codec.c | 8 ++++----
sound/soc/sunxi/sun4i-i2s.c | 4 ++--
sound/soc/sunxi/sun4i-spdif.c | 4 ++--
sound/soc/sunxi/sun50i-dmic.c | 4 ++--
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index a2618ed650b00..edde5cb84ab61 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -285,7 +285,7 @@ static int sun4i_codec_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
sun4i_codec_start_playback(scodec);
else
sun4i_codec_start_capture(scodec);
@@ -294,7 +294,7 @@ static int sun4i_codec_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
sun4i_codec_stop_playback(scodec);
else
sun4i_codec_stop_capture(scodec);
@@ -385,7 +385,7 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream,
static int sun4i_codec_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return sun4i_codec_prepare_playback(substream, dai);
return sun4i_codec_prepare_capture(substream, dai);
@@ -569,7 +569,7 @@ static int sun4i_codec_hw_params(struct snd_pcm_substream *substream,
if (hwrate < 0)
return hwrate;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return sun4i_codec_hw_params_playback(scodec, params,
hwrate);
diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c
index 5f8d979585b69..0b1bce325f04e 100644
--- a/sound/soc/sunxi/sun4i-i2s.c
+++ b/sound/soc/sunxi/sun4i-i2s.c
@@ -1033,7 +1033,7 @@ static int sun4i_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
sun4i_i2s_start_playback(i2s);
else
sun4i_i2s_start_capture(i2s);
@@ -1042,7 +1042,7 @@ static int sun4i_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
sun4i_i2s_stop_playback(i2s);
else
sun4i_i2s_stop_capture(i2s);
diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c
index f41c309558579..989cebb55798f 100644
--- a/sound/soc/sunxi/sun4i-spdif.c
+++ b/sound/soc/sunxi/sun4i-spdif.c
@@ -248,7 +248,7 @@ static int sun4i_spdif_startup(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct sun4i_spdif_dev *host = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return -EINVAL;
sun4i_spdif_configure(host);
@@ -364,7 +364,7 @@ static int sun4i_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
int ret = 0;
struct sun4i_spdif_dev *host = snd_soc_dai_get_drvdata(dai);
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return -EINVAL;
switch (cmd) {
diff --git a/sound/soc/sunxi/sun50i-dmic.c b/sound/soc/sunxi/sun50i-dmic.c
index 884394ddaf86b..1b662b40b7b6c 100644
--- a/sound/soc/sunxi/sun50i-dmic.c
+++ b/sound/soc/sunxi/sun50i-dmic.c
@@ -90,7 +90,7 @@ static int sun50i_dmic_startup(struct snd_pcm_substream *substream,
struct sun50i_dmic_dev *host = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
/* only support capture */
- if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
+ if (!snd_pcm_is_capture(substream))
return -EINVAL;
regmap_update_bits(host->regmap, SUN50I_DMIC_RXFIFO_CTL,
@@ -205,7 +205,7 @@ static int sun50i_dmic_trigger(struct snd_pcm_substream *substream, int cmd,
int ret = 0;
struct sun50i_dmic_dev *host = snd_soc_dai_get_drvdata(dai);
- if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
+ if (!snd_pcm_is_capture(substream))
return -EINVAL;
switch (cmd) {
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 066/113] ASoC: tegra: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (64 preceding siblings ...)
2024-08-05 0:40 ` [PATCH 065/113] ASoC: sunxi: " Kuninori Morimoto
@ 2024-08-05 0:40 ` Kuninori Morimoto
2024-08-05 0:40 ` [PATCH 067/113] ASoC: ux500: " Kuninori Morimoto
` (48 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/tegra/tegra20_ac97.c | 4 ++--
sound/soc/tegra/tegra20_i2s.c | 4 ++--
sound/soc/tegra/tegra210_admaif.c | 2 +-
sound/soc/tegra/tegra210_i2s.c | 6 +++---
sound/soc/tegra/tegra30_i2s.c | 6 +++---
sound/soc/tegra/tegra_pcm.c | 2 +-
6 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c
index 8011afe93c96e..0314402361558 100644
--- a/sound/soc/tegra/tegra20_ac97.c
+++ b/sound/soc/tegra/tegra20_ac97.c
@@ -182,7 +182,7 @@ static int tegra20_ac97_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
tegra20_ac97_start_playback(ac97);
else
tegra20_ac97_start_capture(ac97);
@@ -190,7 +190,7 @@ static int tegra20_ac97_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
tegra20_ac97_stop_playback(ac97);
else
tegra20_ac97_stop_capture(ac97);
diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c
index f11618e8f13ee..330400d0e530c 100644
--- a/sound/soc/tegra/tegra20_i2s.c
+++ b/sound/soc/tegra/tegra20_i2s.c
@@ -232,7 +232,7 @@ static int tegra20_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
tegra20_i2s_start_playback(i2s);
else
tegra20_i2s_start_capture(i2s);
@@ -240,7 +240,7 @@ static int tegra20_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
tegra20_i2s_stop_playback(i2s);
else
tegra20_i2s_stop_capture(i2s);
diff --git a/sound/soc/tegra/tegra210_admaif.c b/sound/soc/tegra/tegra210_admaif.c
index 9f9334e480490..e79711ea65dc9 100644
--- a/sound/soc/tegra/tegra210_admaif.c
+++ b/sound/soc/tegra/tegra210_admaif.c
@@ -299,7 +299,7 @@ static int tegra_admaif_hw_params(struct snd_pcm_substream *substream,
cif_conf.client_ch = channels;
cif_conf.audio_ch = channels;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
path = ADMAIF_TX_PATH;
reg = CH_TX_REG(TEGRA_ADMAIF_CH_ACIF_TX_CTRL, dai->id);
} else {
diff --git a/sound/soc/tegra/tegra210_i2s.c b/sound/soc/tegra/tegra210_i2s.c
index e93ceb7afb4c4..74a0ada1e98c7 100644
--- a/sound/soc/tegra/tegra210_i2s.c
+++ b/sound/soc/tegra/tegra210_i2s.c
@@ -95,7 +95,7 @@ static int tegra210_i2s_sw_reset(struct snd_soc_component *compnt,
unsigned int cif_ctrl, stream_ctrl, i2s_ctrl, val;
int err;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
reset_reg = TEGRA210_I2S_RX_SOFT_RESET;
cif_reg = TEGRA210_I2S_RX_CIF_CTRL;
stream_reg = TEGRA210_I2S_RX_CTRL;
@@ -673,12 +673,12 @@ static int tegra210_i2s_hw_params(struct snd_pcm_substream *substream,
srate = params_rate(params);
/* For playback I2S RX-CIF and for capture TX-CIF is used */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
path = I2S_RX_PATH;
else
path = I2S_TX_PATH;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
unsigned int max_th;
/* FIFO threshold in terms of frames */
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
index a8ff51d12edb5..edcb7095bf0ac 100644
--- a/sound/soc/tegra/tegra30_i2s.c
+++ b/sound/soc/tegra/tegra30_i2s.c
@@ -188,7 +188,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream,
cif_conf.truncate = 0;
cif_conf.mono_conv = 0;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
cif_conf.direction = TEGRA30_AUDIOCIF_DIRECTION_RX;
reg = TEGRA30_I2S_CIF_RX_CTRL;
} else {
@@ -244,7 +244,7 @@ static int tegra30_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
tegra30_i2s_start_playback(i2s);
else
tegra30_i2s_start_capture(i2s);
@@ -252,7 +252,7 @@ static int tegra30_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
tegra30_i2s_stop_playback(i2s);
else
tegra30_i2s_stop_capture(i2s);
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c
index 05d59e03b1c5e..1ed74f6b6431a 100644
--- a/sound/soc/tegra/tegra_pcm.c
+++ b/sound/soc/tegra/tegra_pcm.c
@@ -164,7 +164,7 @@ int tegra_pcm_hw_params(struct snd_soc_component *component,
return ret;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
slave_config.dst_addr = dmap->addr;
slave_config.dst_maxburst = 8;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 067/113] ASoC: ux500: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (65 preceding siblings ...)
2024-08-05 0:40 ` [PATCH 066/113] ASoC: tegra: " Kuninori Morimoto
@ 2024-08-05 0:40 ` Kuninori Morimoto
2024-08-05 0:40 ` [PATCH 068/113] ASoC: cirrus: " Kuninori Morimoto
` (47 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/ux500/mop500_ab8500.c | 4 ++--
sound/soc/ux500/ux500_msp_dai.c | 6 +++---
sound/soc/ux500/ux500_msp_i2s.c | 4 ++--
sound/soc/ux500/ux500_pcm.c | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/ux500/mop500_ab8500.c b/sound/soc/ux500/mop500_ab8500.c
index 710b6744e0136..102d4922d6e62 100644
--- a/sound/soc/ux500/mop500_ab8500.c
+++ b/sound/soc/ux500/mop500_ab8500.c
@@ -203,7 +203,7 @@ static void mop500_ab8500_shutdown(struct snd_pcm_substream *substream)
dev_dbg(dev, "%s: Enter\n", __func__);
/* Reset slots configuration to default(s) */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
tx_slots = DEF_TX_SLOTS;
else
rx_slots = DEF_RX_SLOTS;
@@ -291,7 +291,7 @@ static int mop500_ab8500_hw_params(struct snd_pcm_substream *substream,
/* Setup TDM-slots */
- is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ is_playback = snd_pcm_is_playback(substream);
switch (channels) {
case 1:
slots = 16;
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index 3fd13e8dd1107..1a02d66d45cd1 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -312,7 +312,7 @@ static int setup_msp_config(struct snd_pcm_substream *substream,
msp_config->tx_fifo_config = TX_FIFO_ENABLE;
msp_config->rx_fifo_config = RX_FIFO_ENABLE;
msp_config->def_elem_len = 1;
- msp_config->direction = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
+ msp_config->direction = snd_pcm_is_playback(substream) ?
MSP_DIR_TX : MSP_DIR_RX;
msp_config->data_size = MSP_DATA_BITS_32;
msp_config->frame_freq = runtime->rate;
@@ -423,7 +423,7 @@ static void ux500_msp_dai_shutdown(struct snd_pcm_substream *substream,
{
int ret;
struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev);
- bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ bool is_playback = snd_pcm_is_playback(substream);
dev_dbg(dai->dev, "%s: MSP %d (%s): Enter.\n", __func__, dai->id,
snd_pcm_stream_str(substream));
@@ -511,7 +511,7 @@ static int ux500_msp_dai_hw_params(struct snd_pcm_substream *substream,
case SND_SOC_DAIFMT_DSP_B:
case SND_SOC_DAIFMT_DSP_A:
- mask = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
+ mask = snd_pcm_is_playback(substream) ?
drvdata->tx_mask :
drvdata->rx_mask;
diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c
index fbfeefa418ca7..36819fbd66781 100644
--- a/sound/soc/ux500/ux500_msp_i2s.c
+++ b/sound/soc/ux500/ux500_msp_i2s.c
@@ -565,7 +565,7 @@ int ux500_msp_i2s_trigger(struct ux500_msp *msp, int cmd, int direction)
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- if (direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(direction))
enable_bit = TX_ENABLE;
else
enable_bit = RX_ENABLE;
@@ -576,7 +576,7 @@ int ux500_msp_i2s_trigger(struct ux500_msp *msp, int cmd, int direction)
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- if (direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(direction))
disable_msp_tx(msp);
else
disable_msp_rx(msp);
diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c
index b7f38873d2d8a..65a2125e36594 100644
--- a/sound/soc/ux500/ux500_pcm.c
+++ b/sound/soc/ux500/ux500_pcm.c
@@ -50,7 +50,7 @@ static int ux500_pcm_prepare_slave_config(struct snd_pcm_substream *substream,
slave_config->src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
slave_config->dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
slave_config->dst_addr = dma_addr;
else
slave_config->src_addr = dma_addr;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 068/113] ASoC: cirrus: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (66 preceding siblings ...)
2024-08-05 0:40 ` [PATCH 067/113] ASoC: ux500: " Kuninori Morimoto
@ 2024-08-05 0:40 ` Kuninori Morimoto
2024-08-05 0:40 ` [PATCH 069/113] ASoC: google: " Kuninori Morimoto
` (46 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/cirrus/ep93xx-i2s.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c
index 522de4b802939..cb652b273b7e7 100644
--- a/sound/soc/cirrus/ep93xx-i2s.c
+++ b/sound/soc/cirrus/ep93xx-i2s.c
@@ -121,7 +121,7 @@ static void ep93xx_i2s_enable(struct ep93xx_i2s_info *info, int stream)
}
/* Enable fifo */
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
base_reg = EP93XX_I2S_TX0EN;
else
base_reg = EP93XX_I2S_RX0EN;
@@ -129,7 +129,7 @@ static void ep93xx_i2s_enable(struct ep93xx_i2s_info *info, int stream)
/* Enable TX IRQs (FIFO empty or underflow) */
if (IS_ENABLED(CONFIG_SND_EP93XX_SOC_I2S_WATCHDOG) &&
- stream == SNDRV_PCM_STREAM_PLAYBACK)
+ snd_pcm_is_playback(stream))
ep93xx_i2s_write_reg(info, EP93XX_I2S_TXCTRL,
EP93XX_I2S_TXCTRL_TXEMPTY_LVL |
EP93XX_I2S_TXCTRL_TXUFIE);
@@ -141,11 +141,11 @@ static void ep93xx_i2s_disable(struct ep93xx_i2s_info *info, int stream)
/* Disable IRQs */
if (IS_ENABLED(CONFIG_SND_EP93XX_SOC_I2S_WATCHDOG) &&
- stream == SNDRV_PCM_STREAM_PLAYBACK)
+ snd_pcm_is_playback(stream))
ep93xx_i2s_write_reg(info, EP93XX_I2S_TXCTRL, 0);
/* Disable fifo */
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
base_reg = EP93XX_I2S_TX0EN;
else
base_reg = EP93XX_I2S_RX0EN;
@@ -328,7 +328,7 @@ static int ep93xx_i2s_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
ep93xx_i2s_write_reg(info, EP93XX_I2S_TXWRDLEN, word_len);
else
ep93xx_i2s_write_reg(info, EP93XX_I2S_RXWRDLEN, word_len);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 069/113] ASoC: google: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (67 preceding siblings ...)
2024-08-05 0:40 ` [PATCH 068/113] ASoC: cirrus: " Kuninori Morimoto
@ 2024-08-05 0:40 ` Kuninori Morimoto
2024-08-05 0:40 ` [PATCH 070/113] ASoC: jz4740: " Kuninori Morimoto
` (45 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/google/chv3-i2s.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/google/chv3-i2s.c b/sound/soc/google/chv3-i2s.c
index 08e558f24af86..1bda70bcf57b3 100644
--- a/sound/soc/google/chv3-i2s.c
+++ b/sound/soc/google/chv3-i2s.c
@@ -142,7 +142,7 @@ static int chv3_dma_open(struct snd_soc_component *component,
if (res)
return res;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
i2s->rx_substream = substream;
else
i2s->tx_substream = substream;
@@ -155,7 +155,7 @@ static int chv3_dma_close(struct snd_soc_component *component,
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct chv3_i2s_dev *i2s = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
- if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream->pstr->stream))
chv3_i2s_wr(i2s, I2S_RX_ENABLE, 0);
else
chv3_i2s_wr(i2s, I2S_TX_ENABLE, 0);
@@ -208,7 +208,7 @@ static int chv3_dma_prepare(struct snd_soc_component *component,
period_bytes = snd_pcm_lib_period_bytes(substream);
period_size = substream->runtime->period_size;
- if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream->pstr->stream)) {
chv3_i2s_wr(i2s, I2S_SOFT_RESET, I2S_SOFT_RESET_RX_BIT);
chv3_i2s_wr(i2s, I2S_RX_BASE_ADDR, substream->dma_buffer.addr);
chv3_i2s_wr(i2s, I2S_RX_BUFFER_SIZE, buffer_bytes);
@@ -237,7 +237,7 @@ static snd_pcm_uframes_t chv3_dma_pointer(struct snd_soc_component *component,
frame_bytes = substream->runtime->frame_bits * 8;
buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
- if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream->pstr->stream)) {
idx_bytes = chv3_i2s_rd(i2s, I2S_RX_PRODUCER_IDX);
} else {
idx_bytes = chv3_i2s_rd(i2s, I2S_TX_CONSUMER_IDX);
@@ -259,7 +259,7 @@ static int chv3_dma_ack(struct snd_soc_component *component,
bytes = frames_to_bytes(runtime, runtime->control->appl_ptr);
idx = bytes & (snd_pcm_lib_buffer_bytes(substream) - 1);
- if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream->pstr->stream))
chv3_i2s_wr(i2s, I2S_RX_CONSUMER_IDX, idx);
else
chv3_i2s_wr(i2s, I2S_TX_PRODUCER_IDX, idx);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 070/113] ASoC: jz4740: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (68 preceding siblings ...)
2024-08-05 0:40 ` [PATCH 069/113] ASoC: google: " Kuninori Morimoto
@ 2024-08-05 0:40 ` Kuninori Morimoto
2024-08-05 0:40 ` [PATCH 071/113] ASoC: xilinx: " Kuninori Morimoto
` (44 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/jz4740/jz4740-i2s.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c
index 5176195316158..6bce5c08ee45d 100644
--- a/sound/soc/jz4740/jz4740-i2s.c
+++ b/sound/soc/jz4740/jz4740-i2s.c
@@ -103,7 +103,7 @@ static int jz4740_i2s_startup(struct snd_pcm_substream *substream,
* because it does not disturb other active substreams.
*/
if (!i2s->soc_info->shared_fifo_flush) {
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
regmap_set_bits(i2s->regmap, JZ_REG_AIC_CTRL, JZ_AIC_CTRL_TFLUSH);
else
regmap_set_bits(i2s->regmap, JZ_REG_AIC_CTRL, JZ_AIC_CTRL_RFLUSH);
@@ -148,7 +148,7 @@ static int jz4740_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai);
uint32_t mask;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
mask = JZ_AIC_CTRL_ENABLE_PLAYBACK | JZ_AIC_CTRL_ENABLE_TX_DMA;
else
mask = JZ_AIC_CTRL_ENABLE_CAPTURE | JZ_AIC_CTRL_ENABLE_RX_DMA;
@@ -278,7 +278,7 @@ static int jz4740_i2s_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ctrl &= ~JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE;
ctrl |= FIELD_PREP(JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE, sample_size);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 071/113] ASoC: xilinx: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (69 preceding siblings ...)
2024-08-05 0:40 ` [PATCH 070/113] ASoC: jz4740: " Kuninori Morimoto
@ 2024-08-05 0:40 ` Kuninori Morimoto
2024-08-05 0:41 ` [PATCH 072/113] ASoC: codecs: cs*: " Kuninori Morimoto
` (43 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/xilinx/xlnx_formatter_pcm.c | 12 ++++++------
sound/soc/xilinx/xlnx_spdif.c | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c
index 158fc21a86c10..7076d0befb4be 100644
--- a/sound/soc/xilinx/xlnx_formatter_pcm.c
+++ b/sound/soc/xilinx/xlnx_formatter_pcm.c
@@ -271,7 +271,7 @@ static void xlnx_formatter_disable_irqs(void __iomem *mmio_base, int stream)
val = readl(mmio_base + XLNX_AUD_CTRL);
val &= ~AUD_CTRL_IOC_IRQ_MASK;
- if (stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(stream))
val &= ~AUD_CTRL_TOUT_IRQ_MASK;
writel(val, mmio_base + XLNX_AUD_CTRL);
@@ -334,10 +334,10 @@ static int xlnx_formatter_pcm_open(struct snd_soc_component *component,
struct snd_pcm_runtime *runtime = substream->runtime;
struct xlnx_pcm_drv_data *adata = dev_get_drvdata(component->dev);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(substream) &&
!adata->mm2s_presence)
return -ENODEV;
- else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
+ else if (snd_pcm_is_capture(substream) &&
!adata->s2mm_presence)
return -ENODEV;
@@ -345,7 +345,7 @@ static int xlnx_formatter_pcm_open(struct snd_soc_component *component,
if (!stream_data)
return -ENOMEM;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ch_count_mask = CFG_MM2S_CH_MASK;
ch_count_shift = CFG_MM2S_CH_SHIFT;
data_xfer_mode = CFG_MM2S_XFER_MASK;
@@ -466,7 +466,7 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component,
if (active_ch > stream_data->ch_limit)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(substream) &&
adata->sysclk) {
unsigned int mclk_fs = adata->sysclk / params_rate(params);
@@ -479,7 +479,7 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component,
writel(mclk_fs, stream_data->mmio + XLNX_AUD_FS_MULTIPLIER);
}
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
+ if (snd_pcm_is_capture(substream) &&
stream_data->xfer_mode == AES_TO_PCM) {
val = readl(stream_data->mmio + XLNX_AUD_STS);
if (val & AUD_STS_CH_STS_MASK) {
diff --git a/sound/soc/xilinx/xlnx_spdif.c b/sound/soc/xilinx/xlnx_spdif.c
index d52d5fc7b5b81..bf79639081ecc 100644
--- a/sound/soc/xilinx/xlnx_spdif.c
+++ b/sound/soc/xilinx/xlnx_spdif.c
@@ -84,7 +84,7 @@ static int xlnx_spdif_startup(struct snd_pcm_substream *substream,
val |= XSPDIF_FIFO_FLUSH_MASK;
writel(val, ctx->base + XSPDIF_CONTROL_REG);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
writel(XSPDIF_CH_STS_MASK,
ctx->base + XSPDIF_IRQ_ENABLE_REG);
writel(XSPDIF_GLOBAL_IRQ_ENABLE,
@@ -179,7 +179,7 @@ static int xlnx_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
val |= XSPDIF_CORE_ENABLE_MASK;
writel(val, ctx->base + XSPDIF_CONTROL_REG);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
ret = rx_stream_detect(dai);
break;
case SNDRV_PCM_TRIGGER_STOP:
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 072/113] ASoC: codecs: cs*: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (70 preceding siblings ...)
2024-08-05 0:40 ` [PATCH 071/113] ASoC: xilinx: " Kuninori Morimoto
@ 2024-08-05 0:41 ` Kuninori Morimoto
2024-08-05 0:41 ` [PATCH 073/113] ASoC: codecs: rt*: " Kuninori Morimoto
` (42 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:41 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/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
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 073/113] ASoC: codecs: rt*: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (71 preceding siblings ...)
2024-08-05 0:41 ` [PATCH 072/113] ASoC: codecs: cs*: " Kuninori Morimoto
@ 2024-08-05 0:41 ` Kuninori Morimoto
2024-08-05 0:41 ` [PATCH 074/113] ASoC: codecs: wm*: " Kuninori Morimoto
` (41 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:41 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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(-)
diff --git a/sound/soc/codecs/rt1017-sdca-sdw.c b/sound/soc/codecs/rt1017-sdca-sdw.c
index 7c8103a0d562a..986f3ab407a29 100644
--- a/sound/soc/codecs/rt1017-sdca-sdw.c
+++ b/sound/soc/codecs/rt1017-sdca-sdw.c
@@ -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 {
diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c
index 563df483a466c..aa7cbd8af2f5d 100644
--- a/sound/soc/codecs/rt1308-sdw.c
+++ b/sound/soc/codecs/rt1308-sdw.c
@@ -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;
diff --git a/sound/soc/codecs/rt1316-sdw.c b/sound/soc/codecs/rt1316-sdw.c
index 22f1ed4e03f1a..01a8ad0c4e943 100644
--- a/sound/soc/codecs/rt1316-sdw.c
+++ b/sound/soc/codecs/rt1316-sdw.c
@@ -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;
diff --git a/sound/soc/codecs/rt1318-sdw.c b/sound/soc/codecs/rt1318-sdw.c
index 319f71f5e60d3..60b29188aa642 100644
--- a/sound/soc/codecs/rt1318-sdw.c
+++ b/sound/soc/codecs/rt1318-sdw.c
@@ -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 {
diff --git a/sound/soc/codecs/rt1320-sdw.c b/sound/soc/codecs/rt1320-sdw.c
index 2916fa77b7915..563eb935751c7 100644
--- a/sound/soc/codecs/rt1320-sdw.c
+++ b/sound/soc/codecs/rt1320-sdw.c
@@ -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
diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c
index 5edf11e136b43..88258390afb7d 100644
--- a/sound/soc/codecs/rt5682-sdw.c
+++ b/sound/soc/codecs/rt5682-sdw.c
@@ -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,
diff --git a/sound/soc/codecs/rt700.c b/sound/soc/codecs/rt700.c
index 434b926f96c83..575bb6772c89d 100644
--- a/sound/soc/codecs/rt700.c
+++ b/sound/soc/codecs/rt700.c
@@ -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;
diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c
index dd6ccf17afd43..a8b29df666645 100644
--- a/sound/soc/codecs/rt711-sdca.c
+++ b/sound/soc/codecs/rt711-sdca.c
@@ -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)
diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c
index 5446f9506a167..49c595f2ae4c1 100644
--- a/sound/soc/codecs/rt711.c
+++ b/sound/soc/codecs/rt711.c
@@ -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)
diff --git a/sound/soc/codecs/rt712-sdca.c b/sound/soc/codecs/rt712-sdca.c
index e210c574bb74a..b36d4a61121e7 100644
--- a/sound/soc/codecs/rt712-sdca.c
+++ b/sound/soc/codecs/rt712-sdca.c
@@ -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;
diff --git a/sound/soc/codecs/rt722-sdca.c b/sound/soc/codecs/rt722-sdca.c
index e5bd9ef812de1..5e791a808b654 100644
--- a/sound/soc/codecs/rt722-sdca.c
+++ b/sound/soc/codecs/rt722-sdca.c
@@ -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;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 074/113] ASoC: codecs: wm*: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (72 preceding siblings ...)
2024-08-05 0:41 ` [PATCH 073/113] ASoC: codecs: rt*: " Kuninori Morimoto
@ 2024-08-05 0:41 ` Kuninori Morimoto
2024-08-05 0:41 ` [PATCH 075/113] ASoC: codecs: ac97: " Kuninori Morimoto
` (40 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:41 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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(-)
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index 841247173d98e..b755be789c4c7 100644
--- a/sound/soc/codecs/wm2200.c
+++ b/sound/soc/codecs/wm2200.c
@@ -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);
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index 11bbc94a282c7..b55c90f00ac5e 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -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);
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 66bd281095e1c..05178509bdfab 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -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);
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index 73a8edc797fb2..f00c3c1e62332 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -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:
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index e44fdf97796f3..f084143c8171e 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -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)
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index 8a532f7d750c8..cda6c4d8e129b 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -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);
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 00858b9c95686..9ba1edd5ba9a9 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -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;
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c
index d1c731e25777b..6b0e1f76358ec 100644
--- a/sound/soc/codecs/wm8961.c
+++ b/sound/soc/codecs/wm8961.c
@@ -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;
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index a99908582a50a..d4adbefae32be 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -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);
diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c
index 1f9a9b6369350..2c2074b9a6bdf 100644
--- a/sound/soc/codecs/wm8995.c
+++ b/sound/soc/codecs/wm8995.c
@@ -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 {
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index 5c06cea09bd18..d9c0bd6b09925 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -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;
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c
index 5c6aebe29cf13..97f3c9c7a4413 100644
--- a/sound/soc/codecs/wm9705.c
+++ b/sound/soc/codecs/wm9705.c
@@ -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;
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index e63921de0c37a..d3a190c06ea9c 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -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);
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 64b69316e4c70..bf2824be4f0d4 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -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);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 075/113] ASoC: codecs: ac97: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (73 preceding siblings ...)
2024-08-05 0:41 ` [PATCH 074/113] ASoC: codecs: wm*: " Kuninori Morimoto
@ 2024-08-05 0:41 ` Kuninori Morimoto
2024-08-05 0:41 ` [PATCH 076/113] ASoC: codecs: cpcap: " Kuninori Morimoto
` (39 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:41 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/ac97.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c
index 0e013edfe63d7..aceeeae518d29 100644
--- a/sound/soc/codecs/ac97.c
+++ b/sound/soc/codecs/ac97.c
@@ -35,7 +35,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream,
struct snd_soc_component *component = dai->component;
struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component);
- int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+ int reg = snd_pcm_is_playback(substream) ?
AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE;
return snd_ac97_set_rate(ac97, reg, substream->runtime->rate);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 076/113] ASoC: codecs: cpcap: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (74 preceding siblings ...)
2024-08-05 0:41 ` [PATCH 075/113] ASoC: codecs: ac97: " Kuninori Morimoto
@ 2024-08-05 0:41 ` Kuninori Morimoto
2024-08-05 0:41 ` [PATCH 077/113] ASoC: codecs: es83xx: " Kuninori Morimoto
` (38 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:41 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/cpcap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/cpcap.c b/sound/soc/codecs/cpcap.c
index 4f9dabd9d78a6..e8309458eb86e 100644
--- a/sound/soc/codecs/cpcap.c
+++ b/sound/soc/codecs/cpcap.c
@@ -1271,7 +1271,7 @@ static int cpcap_voice_hw_params(struct snd_pcm_substream *substream,
if (err)
return err;
- if (direction == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(direction)) {
mask = 0x0000;
mask |= BIT(CPCAP_BIT_MIC1_RX_TIMESLOT0);
mask |= BIT(CPCAP_BIT_MIC1_RX_TIMESLOT1);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 077/113] ASoC: codecs: es83xx: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (75 preceding siblings ...)
2024-08-05 0:41 ` [PATCH 076/113] ASoC: codecs: cpcap: " Kuninori Morimoto
@ 2024-08-05 0:41 ` Kuninori Morimoto
2024-08-05 0:41 ` [PATCH 078/113] ASoC: codecs: ad193x: " Kuninori Morimoto
` (37 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:41 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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(-)
diff --git a/sound/soc/codecs/es8311.c b/sound/soc/codecs/es8311.c
index f557e33c26ad9..6a839bd5ea3b9 100644
--- a/sound/soc/codecs/es8311.c
+++ b/sound/soc/codecs/es8311.c
@@ -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);
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 60877116c0ef6..fd3e89cc02862 100644
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -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);
diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c
index f3c97da798dc8..0c371da80c7e3 100644
--- a/sound/soc/codecs/es8328.c
+++ b/sound/soc/codecs/es8328.c
@@ -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);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 078/113] ASoC: codecs: ad193x: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (76 preceding siblings ...)
2024-08-05 0:41 ` [PATCH 077/113] ASoC: codecs: es83xx: " Kuninori Morimoto
@ 2024-08-05 0:41 ` Kuninori Morimoto
2024-08-05 0:41 ` [PATCH 079/113] ASoC: codecs: ak46xx: " Kuninori Morimoto
` (36 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:41 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/ad193x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c
index 1d3c4d94b4ae9..34c309c0d96ff 100644
--- a/sound/soc/codecs/ad193x.c
+++ b/sound/soc/codecs/ad193x.c
@@ -316,7 +316,7 @@ static int ad193x_hw_params(struct snd_pcm_substream *substream,
int word_len = 0, master_rate = 0;
struct snd_soc_component *component = dai->component;
struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(component);
- bool is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool is_playback = snd_pcm_is_playback(substream);
u8 dacc0;
dev_dbg(dai->dev, "%s() rate=%u format=%#x width=%u channels=%u\n",
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 079/113] ASoC: codecs: ak46xx: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (77 preceding siblings ...)
2024-08-05 0:41 ` [PATCH 078/113] ASoC: codecs: ad193x: " Kuninori Morimoto
@ 2024-08-05 0:41 ` Kuninori Morimoto
2024-08-05 0:42 ` [PATCH 080/113] ASoC: codecs: jz47xx: " Kuninori Morimoto
` (35 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:41 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/ak4613.c | 4 ++--
sound/soc/codecs/ak4619.c | 2 +-
sound/soc/codecs/ak4641.c | 2 +-
sound/soc/codecs/ak4642.c | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c
index de9e431855559..3d73c659545d1 100644
--- a/sound/soc/codecs/ak4613.c
+++ b/sound/soc/codecs/ak4613.c
@@ -434,7 +434,7 @@ static void ak4613_hw_constraints(struct ak4613_priv *priv,
unsigned int mask;
unsigned int mode;
unsigned int fs;
- int is_play = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ int is_play = snd_pcm_is_playback(substream);
int sdti_num;
int i;
@@ -739,7 +739,7 @@ static int ak4613_dai_trigger(struct snd_pcm_substream *substream, int cmd,
(cmd != SNDRV_PCM_TRIGGER_RESUME))
return 0;
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return 0;
priv->component = component;
diff --git a/sound/soc/codecs/ak4619.c b/sound/soc/codecs/ak4619.c
index 8f2442482f725..1d63e5c447e1b 100644
--- a/sound/soc/codecs/ak4619.c
+++ b/sound/soc/codecs/ak4619.c
@@ -538,7 +538,7 @@ static int ak4619_dai_hw_params(struct snd_pcm_substream *substream,
unsigned int width;
unsigned int rate;
unsigned int fs;
- bool is_play = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool is_play = snd_pcm_is_playback(substream);
u8 dai_ctrl = 0;
u8 clk_mode = 0;
diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c
index ec33e7d73c6c2..179d391083c57 100644
--- a/sound/soc/codecs/ak4641.c
+++ b/sound/soc/codecs/ak4641.c
@@ -344,7 +344,7 @@ static int ak4641_i2s_hw_params(struct snd_pcm_substream *substream,
snd_soc_component_update_bits(component, AK4641_MODE2, (0x3 << 5), mode2);
/* Update de-emphasis filter for the new rate */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ak4641->playback_fs = rate;
ak4641_set_deemph(component);
}
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index fe035d2fc9131..9cf3bc9387b13 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -277,7 +277,7 @@ static const struct reg_default ak4648_reg[] = {
static int ak4642_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
- int is_play = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ int is_play = snd_pcm_is_playback(substream);
struct snd_soc_component *component = dai->component;
if (is_play) {
@@ -320,7 +320,7 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream,
static void ak4642_dai_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
- int is_play = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ int is_play = snd_pcm_is_playback(substream);
struct snd_soc_component *component = dai->component;
if (is_play) {
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 080/113] ASoC: codecs: jz47xx: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (78 preceding siblings ...)
2024-08-05 0:41 ` [PATCH 079/113] ASoC: codecs: ak46xx: " Kuninori Morimoto
@ 2024-08-05 0:42 ` Kuninori Morimoto
2024-08-05 0:42 ` [PATCH 081/113] ASoC: codecs: mt635x: " Kuninori Morimoto
` (34 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:42 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/jz4725b.c | 2 +-
sound/soc/codecs/jz4760.c | 8 ++++----
sound/soc/codecs/jz4770.c | 8 ++++----
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/sound/soc/codecs/jz4725b.c b/sound/soc/codecs/jz4725b.c
index 39cebaa167beb..7add57e5c4bac 100644
--- a/sound/soc/codecs/jz4725b.c
+++ b/sound/soc/codecs/jz4725b.c
@@ -476,7 +476,7 @@ static int jz4725b_codec_hw_params(struct snd_pcm_substream *substream,
if (rate == ARRAY_SIZE(jz4725b_codec_sample_rates))
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
regmap_update_bits(icdc->regmap,
JZ4725B_CODEC_REG_CR2,
REG_CR2_DAC_ADWL_MASK,
diff --git a/sound/soc/codecs/jz4760.c b/sound/soc/codecs/jz4760.c
index 6217e611259fe..f39bb0dc93e02 100644
--- a/sound/soc/codecs/jz4760.c
+++ b/sound/soc/codecs/jz4760.c
@@ -205,7 +205,7 @@ static int jz4760_codec_startup(struct snd_pcm_substream *substream,
* DMA transfer going during playback when all audible outputs have
* been disabled.
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
ret = snd_soc_dapm_force_enable_pin(dapm, "SYSCLK");
return ret;
}
@@ -216,7 +216,7 @@ static void jz4760_codec_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_component *codec = dai->component;
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
snd_soc_dapm_disable_pin(dapm, "SYSCLK");
}
@@ -231,7 +231,7 @@ static int jz4760_codec_pcm_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
snd_soc_component_force_bias_level(codec, SND_SOC_BIAS_ON);
break;
case SNDRV_PCM_TRIGGER_STOP:
@@ -693,7 +693,7 @@ static int jz4760_codec_hw_params(struct snd_pcm_substream *substream,
if (rate == ARRAY_SIZE(jz4760_codec_sample_rates))
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
regmap_update_bits(codec->regmap, JZ4760_CODEC_REG_AICR,
REG_AICR_DAC_ADWL_MASK,
FIELD_PREP(REG_AICR_DAC_ADWL_MASK, bit_width));
diff --git a/sound/soc/codecs/jz4770.c b/sound/soc/codecs/jz4770.c
index acb9eaa7ea1c5..740b4e926c76c 100644
--- a/sound/soc/codecs/jz4770.c
+++ b/sound/soc/codecs/jz4770.c
@@ -224,7 +224,7 @@ static int jz4770_codec_startup(struct snd_pcm_substream *substream,
* DMA transfer going during playback when all audible outputs have
* been disabled.
*/
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
snd_soc_dapm_force_enable_pin(dapm, "SYSCLK");
return 0;
@@ -236,7 +236,7 @@ static void jz4770_codec_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_component *codec = dai->component;
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
snd_soc_dapm_disable_pin(dapm, "SYSCLK");
}
@@ -251,7 +251,7 @@ static int jz4770_codec_pcm_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
snd_soc_component_force_bias_level(codec,
SND_SOC_BIAS_ON);
break;
@@ -730,7 +730,7 @@ static int jz4770_codec_hw_params(struct snd_pcm_substream *substream,
if (rate == ARRAY_SIZE(jz4770_codec_sample_rates))
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
regmap_update_bits(codec->regmap, JZ4770_CODEC_REG_AICR_DAC,
REG_AICR_DAC_ADWL_MASK,
bit_width << REG_AICR_DAC_ADWL_OFFSET);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 081/113] ASoC: codecs: mt635x: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (79 preceding siblings ...)
2024-08-05 0:42 ` [PATCH 080/113] ASoC: codecs: jz47xx: " Kuninori Morimoto
@ 2024-08-05 0:42 ` Kuninori Morimoto
2024-08-05 0:42 ` [PATCH 082/113] ASoC: codecs: sta529: " Kuninori Morimoto
` (33 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:42 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/mt6351.c | 4 ++--
sound/soc/codecs/mt6358.c | 4 ++--
sound/soc/codecs/mt6359.c | 12 ++++++------
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/soc/codecs/mt6351.c b/sound/soc/codecs/mt6351.c
index 2a5e963fb2b57..7bc8a6fd88262 100644
--- a/sound/soc/codecs/mt6351.c
+++ b/sound/soc/codecs/mt6351.c
@@ -270,9 +270,9 @@ static int mt6351_codec_dai_hw_params(struct snd_pcm_substream *substream,
dev_dbg(priv->dev, "%s(), substream->stream %d, rate %d\n",
__func__, substream->stream, rate);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
priv->dl_rate = rate;
- else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ else if (snd_pcm_is_capture(substream))
priv->ul_rate = rate;
return 0;
diff --git a/sound/soc/codecs/mt6358.c b/sound/soc/codecs/mt6358.c
index 9247b90d1b99e..a0b34508f78f4 100644
--- a/sound/soc/codecs/mt6358.c
+++ b/sound/soc/codecs/mt6358.c
@@ -2363,9 +2363,9 @@ static int mt6358_codec_dai_hw_params(struct snd_pcm_substream *substream,
rate,
substream->number);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
priv->dl_rate = rate;
- else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ else if (snd_pcm_is_capture(substream))
priv->ul_rate = rate;
return 0;
diff --git a/sound/soc/codecs/mt6359.c b/sound/soc/codecs/mt6359.c
index 0b76a55664b03..8a302607316cc 100644
--- a/sound/soc/codecs/mt6359.c
+++ b/sound/soc/codecs/mt6359.c
@@ -2653,9 +2653,9 @@ static int mt6359_codec_dai_hw_params(struct snd_pcm_substream *substream,
dev_dbg(priv->dev, "%s(), id %d, substream->stream %d, rate %d, number %d\n",
__func__, id, substream->stream, rate, substream->number);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
priv->dl_rate[id] = rate;
- else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ else if (snd_pcm_is_capture(substream))
priv->ul_rate[id] = rate;
return 0;
@@ -2668,9 +2668,9 @@ static int mt6359_codec_dai_startup(struct snd_pcm_substream *substream,
struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt);
dev_dbg(priv->dev, "%s stream %d\n", __func__, substream->stream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
mt6359_set_playback_gpio(priv);
- else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ else if (snd_pcm_is_capture(substream))
mt6359_set_capture_gpio(priv);
return 0;
@@ -2683,9 +2683,9 @@ static void mt6359_codec_dai_shutdown(struct snd_pcm_substream *substream,
struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt);
dev_dbg(priv->dev, "%s stream %d\n", __func__, substream->stream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
mt6359_reset_playback_gpio(priv);
- else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ else if (snd_pcm_is_capture(substream))
mt6359_reset_capture_gpio(priv);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 082/113] ASoC: codecs: sta529: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (80 preceding siblings ...)
2024-08-05 0:42 ` [PATCH 081/113] ASoC: codecs: mt635x: " Kuninori Morimoto
@ 2024-08-05 0:42 ` Kuninori Morimoto
2024-08-05 0:42 ` [PATCH 083/113] ASoC: codecs: rk3308: " Kuninori Morimoto
` (32 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:42 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/sta529.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c
index f7718491c8996..e750536b1f740 100644
--- a/sound/soc/codecs/sta529.c
+++ b/sound/soc/codecs/sta529.c
@@ -232,7 +232,7 @@ static int sta529_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, STA529_S2PCFG1, PDATA_LEN_MSK,
pdata << 6);
snd_soc_component_update_bits(component, STA529_S2PCFG1, BCLK_TO_FS_MSK,
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 083/113] ASoC: codecs: rk3308: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (81 preceding siblings ...)
2024-08-05 0:42 ` [PATCH 082/113] ASoC: codecs: sta529: " Kuninori Morimoto
@ 2024-08-05 0:42 ` Kuninori Morimoto
2024-08-05 0:42 ` [PATCH 084/113] ASoC: codecs: wl1273: " Kuninori Morimoto
` (31 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:42 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/rk3308_codec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c
index 8b51e87a17115..7a36cffc4f3be 100644
--- a/sound/soc/codecs/rk3308_codec.c
+++ b/sound/soc/codecs/rk3308_codec.c
@@ -674,7 +674,7 @@ static int rk3308_codec_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_component *component = dai->component;
struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
- return (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+ return (snd_pcm_is_playback(substream)) ?
rk3308_codec_dac_dig_config(rk3308, params) :
rk3308_codec_adc_dig_config(rk3308, params);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 084/113] ASoC: codecs: wl1273: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (82 preceding siblings ...)
2024-08-05 0:42 ` [PATCH 083/113] ASoC: codecs: rk3308: " Kuninori Morimoto
@ 2024-08-05 0:42 ` Kuninori Morimoto
2024-08-05 0:42 ` [PATCH 085/113] ASoC: codecs: mc13783: " Kuninori Morimoto
` (30 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:42 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/wl1273.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/wl1273.c b/sound/soc/codecs/wl1273.c
index 737ca82cf9764..2ea7264a18d43 100644
--- a/sound/soc/codecs/wl1273.c
+++ b/sound/soc/codecs/wl1273.c
@@ -298,13 +298,13 @@ static int wl1273_startup(struct snd_pcm_substream *substream,
SNDRV_PCM_HW_PARAM_CHANNELS, 1);
break;
case WL1273_MODE_FM_RX:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
pr_err("Cannot play in RX mode.\n");
return -EINVAL;
}
break;
case WL1273_MODE_FM_TX:
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
pr_err("Cannot capture in TX mode.\n");
return -EINVAL;
}
@@ -348,13 +348,13 @@ static int wl1273_hw_params(struct snd_pcm_substream *substream,
}
if (wl1273->mode == WL1273_MODE_FM_TX &&
- substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ snd_pcm_is_capture(substream)) {
pr_err("Only playback supported with TX.\n");
return -EINVAL;
}
if (wl1273->mode == WL1273_MODE_FM_RX &&
- substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ snd_pcm_is_playback(substream)) {
pr_err("Only capture supported with RX.\n");
return -EINVAL;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 085/113] ASoC: codecs: mc13783: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (83 preceding siblings ...)
2024-08-05 0:42 ` [PATCH 084/113] ASoC: codecs: wl1273: " Kuninori Morimoto
@ 2024-08-05 0:42 ` Kuninori Morimoto
2024-08-05 0:42 ` [PATCH 086/113] ASoC: codecs: nau882x: " Kuninori Morimoto
` (29 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:42 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/mc13783.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index 086ac97e83866..77f9215699dbd 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -138,7 +138,7 @@ static int mc13783_pcm_hw_params_sync(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return mc13783_pcm_hw_params_dac(substream, params, dai);
else
return mc13783_pcm_hw_params_codec(substream, params, dai);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 086/113] ASoC: codecs: nau882x: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (84 preceding siblings ...)
2024-08-05 0:42 ` [PATCH 085/113] ASoC: codecs: mc13783: " Kuninori Morimoto
@ 2024-08-05 0:42 ` Kuninori Morimoto
2024-08-05 0:42 ` [PATCH 087/113] ASoC: codecs: peb2466: " Kuninori Morimoto
` (28 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:42 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/nau8821.c | 4 ++--
sound/soc/codecs/nau8824.c | 4 ++--
sound/soc/codecs/nau8825.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/nau8821.c b/sound/soc/codecs/nau8821.c
index de5c4db05c8f8..f887c192b87cf 100644
--- a/sound/soc/codecs/nau8821.c
+++ b/sound/soc/codecs/nau8821.c
@@ -803,7 +803,7 @@ nau8821_get_osr(struct nau8821 *nau8821, int stream)
{
unsigned int osr;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
regmap_read(nau8821->regmap, NAU8821_R2C_DAC_CTRL1, &osr);
osr &= NAU8821_DAC_OVERSAMPLE_MASK;
if (osr >= ARRAY_SIZE(osr_dac_sel))
@@ -854,7 +854,7 @@ static int nau8821_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
if (nau8821->fs * osr->osr > CLK_DA_AD_MAX)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
regmap_update_bits(nau8821->regmap, NAU8821_R03_CLK_DIVIDER,
NAU8821_CLK_DAC_SRC_MASK,
osr->clk_src << NAU8821_CLK_DAC_SRC_SFT);
diff --git a/sound/soc/codecs/nau8824.c b/sound/soc/codecs/nau8824.c
index 12540397fd4d5..21cda3b473bad 100644
--- a/sound/soc/codecs/nau8824.c
+++ b/sound/soc/codecs/nau8824.c
@@ -1038,7 +1038,7 @@ nau8824_get_osr(struct nau8824 *nau8824, int stream)
{
unsigned int osr;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
regmap_read(nau8824->regmap,
NAU8824_REG_DAC_FILTER_CTRL_1, &osr);
osr &= NAU8824_DAC_OVERSAMPLE_MASK;
@@ -1094,7 +1094,7 @@ static int nau8824_hw_params(struct snd_pcm_substream *substream,
goto error;
if (nau8824->fs * osr->osr > CLK_DA_AD_MAX)
goto error;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
regmap_update_bits(nau8824->regmap, NAU8824_REG_CLK_DIVIDER,
NAU8824_CLK_DAC_SRC_MASK,
osr->clk_src << NAU8824_CLK_DAC_SRC_SFT);
diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
index bde25bc6909d5..951406fa5d32f 100644
--- a/sound/soc/codecs/nau8825.c
+++ b/sound/soc/codecs/nau8825.c
@@ -1238,7 +1238,7 @@ nau8825_get_osr(struct nau8825 *nau8825, int stream)
{
unsigned int osr;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream)) {
regmap_read(nau8825->regmap,
NAU8825_REG_DAC_CTRL1, &osr);
osr &= NAU8825_DAC_OVERSAMPLE_MASK;
@@ -1294,7 +1294,7 @@ static int nau8825_hw_params(struct snd_pcm_substream *substream,
goto error;
if (params_rate(params) * osr->osr > CLK_DA_AD_MAX)
goto error;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
regmap_update_bits(nau8825->regmap, NAU8825_REG_CLK_DIVIDER,
NAU8825_CLK_DAC_SRC_MASK,
osr->clk_src << NAU8825_CLK_DAC_SRC_SFT);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 087/113] ASoC: codecs: peb2466: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (85 preceding siblings ...)
2024-08-05 0:42 ` [PATCH 086/113] ASoC: codecs: nau882x: " Kuninori Morimoto
@ 2024-08-05 0:42 ` Kuninori Morimoto
2024-08-05 0:42 ` [PATCH 088/113] ASoC: codecs: sma1303: " Kuninori Morimoto
` (27 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:42 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/peb2466.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/peb2466.c b/sound/soc/codecs/peb2466.c
index 76ee7e3f4d9b9..7c5c575300671 100644
--- a/sound/soc/codecs/peb2466.c
+++ b/sound/soc/codecs/peb2466.c
@@ -796,7 +796,7 @@ static int peb2466_dai_startup(struct snd_pcm_substream *substream,
unsigned int max_ch;
int ret;
- max_ch = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+ max_ch = snd_pcm_is_playback(substream) ?
peb2466->max_chan_playback : peb2466->max_chan_capture;
/*
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 088/113] ASoC: codecs: sma1303: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (86 preceding siblings ...)
2024-08-05 0:42 ` [PATCH 087/113] ASoC: codecs: peb2466: " Kuninori Morimoto
@ 2024-08-05 0:42 ` Kuninori Morimoto
2024-08-05 0:42 ` [PATCH 089/113] ASoC: codecs: adav80x: " Kuninori Morimoto
` (26 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:42 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/sma1303.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/sma1303.c b/sound/soc/codecs/sma1303.c
index 980c48cbc3482..4da80cbab7946 100644
--- a/sound/soc/codecs/sma1303.c
+++ b/sound/soc/codecs/sma1303.c
@@ -997,7 +997,7 @@ static int sma1303_dai_hw_params_amp(struct snd_pcm_substream *substream,
__func__, params_rate(params), params_width(params),
params_channels(params));
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
if (sma1303->sys_clk_id == SMA1303_PLL_CLKIN_BCLK) {
if (sma1303->last_bclk != bclk) {
sma1303_setup_pll(component, bclk);
@@ -1195,7 +1195,7 @@ static int sma1303_dai_mute(struct snd_soc_dai *dai, int mute, int stream)
struct sma1303_priv *sma1303 = snd_soc_component_get_drvdata(component);
int ret = 0;
- if (stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(stream))
return ret;
if (mute) {
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 089/113] ASoC: codecs: adav80x: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (87 preceding siblings ...)
2024-08-05 0:42 ` [PATCH 088/113] ASoC: codecs: sma1303: " Kuninori Morimoto
@ 2024-08-05 0:42 ` Kuninori Morimoto
2024-08-05 0:42 ` [PATCH 090/113] ASoC: codecs: twl4030: " Kuninori Morimoto
` (25 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:42 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/adav80x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
index c8c0fc9282116..21d20cb42d200 100644
--- a/sound/soc/codecs/adav80x.c
+++ b/sound/soc/codecs/adav80x.c
@@ -521,7 +521,7 @@ static int adav80x_hw_params(struct snd_pcm_substream *substream,
if (rate * 256 != adav80x->sysclk)
return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
adav80x_set_playback_pcm_format(component, dai, params);
adav80x_set_dac_clock(component, rate);
} else {
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 090/113] ASoC: codecs: twl4030: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (88 preceding siblings ...)
2024-08-05 0:42 ` [PATCH 089/113] ASoC: codecs: adav80x: " Kuninori Morimoto
@ 2024-08-05 0:42 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 091/113] ASoC: codecs: uda1380: " Kuninori Morimoto
` (24 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:42 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/twl4030.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 9c50ac356c895..a36b34b92adab 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -1629,7 +1629,7 @@ static void twl4030_tdm_enable(struct snd_soc_component *component, int directio
reg = twl4030_read(component, TWL4030_REG_OPTION);
- if (direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(direction))
mask = TWL4030_ARXL1_VRX_EN | TWL4030_ARXR1_EN;
else
mask = TWL4030_ATXL2_VTXL_EN | TWL4030_ATXR2_VTXR_EN;
@@ -1913,7 +1913,7 @@ static void twl4030_voice_enable(struct snd_soc_component *component, int direct
reg = twl4030_read(component, TWL4030_REG_OPTION);
- if (direction == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(direction))
mask = TWL4030_ARXL1_VRX_EN;
else
mask = TWL4030_ATXL2_VTXL_EN | TWL4030_ATXR2_VTXR_EN;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 091/113] ASoC: codecs: uda1380: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (89 preceding siblings ...)
2024-08-05 0:42 ` [PATCH 090/113] ASoC: codecs: twl4030: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 092/113] ASoC: codecs: wcd93xx: " Kuninori Morimoto
` (23 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/uda1380.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c
index 4f8fdd574585b..7ef7b5fc927f2 100644
--- a/sound/soc/codecs/uda1380.c
+++ b/sound/soc/codecs/uda1380.c
@@ -556,7 +556,7 @@ static int uda1380_pcm_hw_params(struct snd_pcm_substream *substream,
uda1380_write(component, UDA1380_PM, R02_PON_PLL | pm);
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
clk |= R00_EN_DAC | R00_EN_INT;
else
clk |= R00_EN_ADC | R00_EN_DEC;
@@ -577,7 +577,7 @@ static void uda1380_pcm_shutdown(struct snd_pcm_substream *substream,
uda1380_write(component, UDA1380_PM, ~R02_PON_PLL & pm);
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
clk &= ~(R00_EN_DAC | R00_EN_INT);
else
clk &= ~(R00_EN_ADC | R00_EN_DEC);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 092/113] ASoC: codecs: wcd93xx: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (90 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 091/113] ASoC: codecs: uda1380: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 093/113] ASoC: codecs: zl38060: " Kuninori Morimoto
` (22 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/wcd9335.c | 2 +-
sound/soc/codecs/wcd934x.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c
index 373a31ddccb2d..f66f4134af8f1 100644
--- a/sound/soc/codecs/wcd9335.c
+++ b/sound/soc/codecs/wcd9335.c
@@ -1732,7 +1732,7 @@ static int wcd9335_slim_set_hw_params(struct wcd9335_codec *wcd,
i = 0;
list_for_each_entry(ch, slim_ch_list, list) {
cfg->chs[i++] = ch->ch_num;
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
/* write to interface device */
ret = regmap_write(wcd->if_regmap,
WCD9335_SLIM_PGD_RX_PORT_MULTI_CHNL_0(ch->port),
diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c
index 291d0c80a6fcf..82894ec51a53a 100644
--- a/sound/soc/codecs/wcd934x.c
+++ b/sound/soc/codecs/wcd934x.c
@@ -1732,7 +1732,7 @@ static int wcd934x_slim_set_hw_params(struct wcd934x_codec *wcd,
i = 0;
list_for_each_entry(ch, slim_ch_list, list) {
cfg->chs[i++] = ch->ch_num;
- if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(direction)) {
/* write to interface device */
ret = regmap_write(wcd->if_regmap,
WCD934X_SLIM_PGD_RX_PORT_MULTI_CHNL_0(ch->port),
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 093/113] ASoC: codecs: zl38060: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (91 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 092/113] ASoC: codecs: wcd93xx: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 094/113] ASoC: codecs: adau17xx: " Kuninori Morimoto
` (21 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/zl38060.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/zl38060.c b/sound/soc/codecs/zl38060.c
index 28c92d90299e9..8650c9ca0cefd 100644
--- a/sound/soc/codecs/zl38060.c
+++ b/sound/soc/codecs/zl38060.c
@@ -271,7 +271,7 @@ static int zl38_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct zl38_codec_priv *priv = snd_soc_dai_get_drvdata(dai);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
unsigned int fsrate;
int err;
@@ -317,7 +317,7 @@ static int zl38_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct zl38_codec_priv *priv = snd_soc_dai_get_drvdata(dai);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
priv->is_stream_in_use[tx] = false;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 094/113] ASoC: codecs: adau17xx: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (92 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 093/113] ASoC: codecs: zl38060: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 095/113] ASoC: codecs: hdac_hda: " Kuninori Morimoto
` (20 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/adau1701.c | 2 +-
sound/soc/codecs/adau17x1.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c
index 8bd6067df7f75..8f97eaca0be59 100644
--- a/sound/soc/codecs/adau1701.c
+++ b/sound/soc/codecs/adau1701.c
@@ -469,7 +469,7 @@ static int adau1701_hw_params(struct snd_pcm_substream *substream,
regmap_update_bits(adau1701->regmap, ADAU1701_DSPCTRL,
ADAU1701_DSPCTRL_SR_MASK, val);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return adau1701_set_playback_pcm_format(component, params);
else
return adau1701_set_capture_pcm_format(component, params);
diff --git a/sound/soc/codecs/adau17x1.c b/sound/soc/codecs/adau17x1.c
index f2932713b4de9..2d3579bdc91d1 100644
--- a/sound/soc/codecs/adau17x1.c
+++ b/sound/soc/codecs/adau17x1.c
@@ -208,7 +208,7 @@ static int adau17x1_dsp_mux_enum_put(struct snd_kcontrol *kcontrol,
break;
}
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
reg = ADAU17X1_SERIAL_INPUT_ROUTE;
else
reg = ADAU17X1_SERIAL_OUTPUT_ROUTE;
@@ -237,7 +237,7 @@ static int adau17x1_dsp_mux_enum_get(struct snd_kcontrol *kcontrol,
unsigned int reg, val;
int ret;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
reg = ADAU17X1_SERIAL_INPUT_ROUTE;
else
reg = ADAU17X1_SERIAL_OUTPUT_ROUTE;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 095/113] ASoC: codecs: hdac_hda: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (93 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 094/113] ASoC: codecs: adau17xx: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 096/113] ASoC: codecs: max983xx: " Kuninori Morimoto
` (19 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/hdac_hda.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c
index 29c88de5508b8..d5b72afd82709 100644
--- a/sound/soc/codecs/hdac_hda.c
+++ b/sound/soc/codecs/hdac_hda.c
@@ -220,7 +220,7 @@ static int hdac_hda_dai_hw_params(struct snd_pcm_substream *substream,
unsigned int maxbps;
unsigned int bits;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
maxbps = dai->driver->playback.sig_bits;
else
maxbps = dai->driver->capture.sig_bits;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 096/113] ASoC: codecs: max983xx: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (94 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 095/113] ASoC: codecs: hdac_hda: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 097/113] ASoC: codecs: sgtl5000: " Kuninori Morimoto
` (18 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/max98363.c | 2 +-
sound/soc/codecs/max98373-sdw.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/max98363.c b/sound/soc/codecs/max98363.c
index 950105e5bffdc..5ea6b36941355 100644
--- a/sound/soc/codecs/max98363.c
+++ b/sound/soc/codecs/max98363.c
@@ -221,7 +221,7 @@ static int max98363_sdw_dai_hw_params(struct snd_pcm_substream *substream,
if (!max98363->slave)
return -EINVAL;
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return -EINVAL;
direction = SDW_DATA_DIR_RX;
diff --git a/sound/soc/codecs/max98373-sdw.c b/sound/soc/codecs/max98373-sdw.c
index 26860882fd91a..531c67023f922 100644
--- a/sound/soc/codecs/max98373-sdw.c
+++ b/sound/soc/codecs/max98373-sdw.c
@@ -534,7 +534,7 @@ static int max98373_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 = 1;
if (max98373->slot) {
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 097/113] ASoC: codecs: sgtl5000: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (95 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 096/113] ASoC: codecs: max983xx: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 098/113] ASoC: codecs: stac9766: " Kuninori Morimoto
` (17 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/sgtl5000.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 7aa89e34657ea..5b2544e05db7e 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1061,7 +1061,7 @@ static int sgtl5000_pcm_hw_params(struct snd_pcm_substream *substream,
return -EFAULT;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
stereo = SGTL5000_DAC_STEREO;
else
stereo = SGTL5000_ADC_STEREO;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 098/113] ASoC: codecs: stac9766: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (96 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 097/113] ASoC: codecs: sgtl5000: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 099/113] ASoC: codecs: tscs4xxx: " Kuninori Morimoto
` (16 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/stac9766.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c
index 2f9f10a4dfed9..3511776af8f95 100644
--- a/sound/soc/codecs/stac9766.c
+++ b/sound/soc/codecs/stac9766.c
@@ -171,7 +171,7 @@ static int ac97_analog_prepare(struct snd_pcm_substream *substream,
/* enable variable rate audio, disable SPDIF output */
snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x5, 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;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 099/113] ASoC: codecs: tscs4xxx: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (97 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 098/113] ASoC: codecs: stac9766: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 100/113] ASoC: codecs: idt821034: " Kuninori Morimoto
` (15 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/tscs42xx.c | 4 ++--
sound/soc/codecs/tscs454.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/tscs42xx.c b/sound/soc/codecs/tscs42xx.c
index f8a3d1b40990c..dd87a37b97854 100644
--- a/sound/soc/codecs/tscs42xx.c
+++ b/sound/soc/codecs/tscs42xx.c
@@ -1178,12 +1178,12 @@ static int tscs42xx_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
int ret;
if (mute)
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
ret = dac_mute(component);
else
ret = adc_mute(component);
else
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
ret = dac_unmute(component);
else
ret = adc_unmute(component);
diff --git a/sound/soc/codecs/tscs454.c b/sound/soc/codecs/tscs454.c
index 850e5de9271ed..b8ee1281db489 100644
--- a/sound/soc/codecs/tscs454.c
+++ b/sound/soc/codecs/tscs454.c
@@ -3221,7 +3221,7 @@ static int tscs454_hw_params(struct snd_pcm_substream *substream,
}
set_aif_status_active(&tscs454->aifs_status, aif->id,
- substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ snd_pcm_is_playback(substream));
dev_dbg(component->dev, "Set aif %d active. Streams status is 0x%x\n",
aif->id, tscs454->aifs_status.streams);
@@ -3241,7 +3241,7 @@ static int tscs454_hw_free(struct snd_pcm_substream *substream,
struct aif *aif = &tscs454->aifs[dai->id];
return aif_free(component, aif,
- substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+ snd_pcm_is_playback(substream));
}
static int tscs454_prepare(struct snd_pcm_substream *substream,
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 100/113] ASoC: codecs: idt821034: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (98 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 099/113] ASoC: codecs: tscs4xxx: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 101/113] ASoC: codecs: sdw-mockup: " Kuninori Morimoto
` (14 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/idt821034.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/idt821034.c b/sound/soc/codecs/idt821034.c
index cb7a68c799f8f..82279f6d3ce84 100644
--- a/sound/soc/codecs/idt821034.c
+++ b/sound/soc/codecs/idt821034.c
@@ -839,7 +839,7 @@ static int idt821034_dai_startup(struct snd_pcm_substream *substream,
unsigned int max_ch = 0;
int ret;
- max_ch = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+ max_ch = snd_pcm_is_playback(substream) ?
idt821034->max_ch_playback : idt821034->max_ch_capture;
/*
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 101/113] ASoC: codecs: sdw-mockup: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (99 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 100/113] ASoC: codecs: idt821034: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 102/113] ASoC: codecs: hdmi-codec: " Kuninori Morimoto
` (13 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/sdw-mockup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/sdw-mockup.c b/sound/soc/codecs/sdw-mockup.c
index 574c08b14f0c2..24fabd392d00b 100644
--- a/sound/soc/codecs/sdw-mockup.c
+++ b/sound/soc/codecs/sdw-mockup.c
@@ -72,7 +72,7 @@ static int sdw_mockup_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 = 1;
else
port_config.num = 8;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 102/113] ASoC: codecs: hdmi-codec: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (100 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 101/113] ASoC: codecs: sdw-mockup: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 103/113] ASoC: codecs: tlv320aic23: " Kuninori Morimoto
` (12 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/hdmi-codec.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 74caae52e1273..f8a4a1b62698e 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -428,7 +428,7 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
bool has_capture = !hcp->hcd.no_i2s_capture;
bool has_playback = !hcp->hcd.no_i2s_playback;
int ret = 0;
@@ -474,7 +474,7 @@ static void hdmi_codec_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
- bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ bool tx = snd_pcm_is_playback(substream);
bool has_capture = !hcp->hcd.no_i2s_capture;
bool has_playback = !hcp->hcd.no_i2s_playback;
@@ -699,7 +699,7 @@ static int hdmi_codec_mute(struct snd_soc_dai *dai, int mute, int direction)
* snd_soc_dai_digital_mute()
*/
if (hcp->hcd.ops->mute_stream &&
- (direction == SNDRV_PCM_STREAM_PLAYBACK ||
+ (snd_pcm_is_playback(direction) ||
!hcp->hcd.ops->no_capture_mute))
return hcp->hcd.ops->mute_stream(dai->dev->parent,
hcp->hcd.data,
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 103/113] ASoC: codecs: tlv320aic23: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (101 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 102/113] ASoC: codecs: hdmi-codec: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:43 ` [PATCH 104/113] ASoC: codecs: framer-codec: " Kuninori Morimoto
` (11 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/tlv320aic23.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index c47aa4d4162dd..06dab9d9b7576 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -342,7 +342,7 @@ static int tlv320aic23_hw_params(struct snd_pcm_substream *substream,
u32 sample_rate_dac = aic23->requested_dac;
u32 sample_rate = params_rate(params);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
aic23->requested_dac = sample_rate_dac = sample_rate;
if (!sample_rate_adc)
sample_rate_adc = sample_rate;
@@ -398,7 +398,7 @@ static void tlv320aic23_shutdown(struct snd_pcm_substream *substream,
udelay(50);
snd_soc_component_write(component, TLV320AIC23_ACTIVE, 0x0);
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
aic23->requested_dac = 0;
else
aic23->requested_adc = 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 104/113] ASoC: codecs: framer-codec: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (102 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 103/113] ASoC: codecs: tlv320aic23: " Kuninori Morimoto
@ 2024-08-05 0:43 ` Kuninori Morimoto
2024-08-05 0:44 ` [PATCH 105/113] ASoC: samsung: " Kuninori Morimoto
` (10 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
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/framer-codec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/framer-codec.c b/sound/soc/codecs/framer-codec.c
index 6f57a3aeecc89..10ad78e87a7cd 100644
--- a/sound/soc/codecs/framer-codec.c
+++ b/sound/soc/codecs/framer-codec.c
@@ -192,7 +192,7 @@ static int framer_dai_startup(struct snd_pcm_substream *substream,
u64 format;
int ret;
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
format = framer_formats(framer->max_chan_capture);
hw_rule_channels_by_format = framer_dai_hw_rule_capture_channels_by_format;
hw_rule_format_by_channels = framer_dai_hw_rule_capture_format_by_channels;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 105/113] ASoC: samsung: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (103 preceding siblings ...)
2024-08-05 0:43 ` [PATCH 104/113] ASoC: codecs: framer-codec: " Kuninori Morimoto
@ 2024-08-05 0:44 ` Kuninori Morimoto
2024-08-05 0:44 ` [PATCH 106/113] ASoC: kirkwood: " Kuninori Morimoto
` (9 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:44 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/samsung/i2s.c | 8 ++++----
sound/soc/samsung/pcm.c | 4 ++--
sound/soc/samsung/spdif.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 1bcabb114e29f..fdf494a49dd92 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -744,13 +744,13 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
val |= MOD_DC1_EN;
break;
case 2:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
i2s->dma_playback.addr_width = 4;
else
i2s->dma_capture.addr_width = 4;
break;
case 1:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
i2s->dma_playback.addr_width = 2;
else
i2s->dma_capture.addr_width = 2;
@@ -936,7 +936,7 @@ static int i2s_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_dai *dai)
{
struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
- int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
+ int capture = snd_pcm_is_capture(substream);
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct i2s_dai *i2s = to_info(snd_soc_rtd_to_cpu(rtd, 0));
unsigned long flags;
@@ -1026,7 +1026,7 @@ i2s_delay(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
WARN_ON(!pm_runtime_active(dai->dev));
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
delay = FIC_RXCOUNT(reg);
else if (is_secondary(i2s))
delay = FICS_TXCOUNT(readl(priv->addr + I2SFICS));
diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c
index 573b2dee7f07c..a9bcc2adb4403 100644
--- a/sound/soc/samsung/pcm.c
+++ b/sound/soc/samsung/pcm.c
@@ -228,7 +228,7 @@ static int s3c_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
spin_lock_irqsave(&pcm->lock, flags);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
s3c_pcm_snd_rxctrl(pcm, 1);
else
s3c_pcm_snd_txctrl(pcm, 1);
@@ -241,7 +241,7 @@ static int s3c_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
spin_lock_irqsave(&pcm->lock, flags);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
s3c_pcm_snd_rxctrl(pcm, 0);
else
s3c_pcm_snd_txctrl(pcm, 0);
diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c
index f44e3180e8d3d..d5eaeacefd230 100644
--- a/sound/soc/samsung/spdif.c
+++ b/sound/soc/samsung/spdif.c
@@ -187,7 +187,7 @@ static int spdif_hw_params(struct snd_pcm_substream *substream,
dev_dbg(spdif->dev, "Entered %s\n", __func__);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dma_data = spdif->dma_playback;
else {
dev_err(spdif->dev, "Capture is not supported\n");
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 106/113] ASoC: kirkwood: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (104 preceding siblings ...)
2024-08-05 0:44 ` [PATCH 105/113] ASoC: samsung: " Kuninori Morimoto
@ 2024-08-05 0:44 ` Kuninori Morimoto
2024-08-05 0:44 ` [PATCH 107/113] ASoC: loongson: " Kuninori Morimoto
` (8 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:44 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/kirkwood/kirkwood-dma.c | 10 +++++-----
sound/soc/kirkwood/kirkwood-i2s.c | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/kirkwood/kirkwood-dma.c b/sound/soc/kirkwood/kirkwood-dma.c
index 036b42058272f..1a3749b50d0be 100644
--- a/sound/soc/kirkwood/kirkwood-dma.c
+++ b/sound/soc/kirkwood/kirkwood-dma.c
@@ -140,7 +140,7 @@ static int kirkwood_dma_open(struct snd_soc_component *component,
writel((unsigned int)-1, priv->io + KIRKWOOD_ERR_MASK);
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
if (priv->substream_play)
return -EBUSY;
priv->substream_play = substream;
@@ -161,7 +161,7 @@ static int kirkwood_dma_close(struct snd_soc_component *component,
if (!priv)
return 0;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
priv->substream_play = NULL;
else
priv->substream_rec = NULL;
@@ -185,7 +185,7 @@ static int kirkwood_dma_hw_params(struct snd_soc_component *component,
if (!dram)
return 0;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
kirkwood_dma_conf_mbus_windows(priv->io,
KIRKWOOD_PLAYBACK_WIN, addr, dram);
else
@@ -206,7 +206,7 @@ static int kirkwood_dma_prepare(struct snd_soc_component *component,
size = (size>>2)-1;
count = snd_pcm_lib_period_bytes(substream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
writel(count, priv->io + KIRKWOOD_PLAY_BYTE_INT_COUNT);
writel(runtime->dma_addr, priv->io + KIRKWOOD_PLAY_BUF_ADDR);
writel(size, priv->io + KIRKWOOD_PLAY_BUF_SIZE);
@@ -227,7 +227,7 @@ static snd_pcm_uframes_t kirkwood_dma_pointer(
struct kirkwood_dma_data *priv = kirkwood_priv(substream);
snd_pcm_uframes_t count;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
count = bytes_to_frames(substream->runtime,
readl(priv->io + KIRKWOOD_PLAY_BYTE_COUNT));
else
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index d1eb90310afa2..5d43924bc1caf 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -258,7 +258,7 @@ static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream,
unsigned int i2s_reg;
unsigned long i2s_value;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
i2s_reg = KIRKWOOD_I2S_PLAYCTL;
} else {
i2s_reg = KIRKWOOD_I2S_RECCTL;
@@ -314,7 +314,7 @@ static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
if (params_channels(params) == 1)
ctl_play |= KIRKWOOD_PLAYCTL_MONO_BOTH;
else
@@ -501,7 +501,7 @@ static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream,
static int kirkwood_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return kirkwood_i2s_play_trigger(substream, cmd, dai);
else
return kirkwood_i2s_rec_trigger(substream, cmd, dai);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 107/113] ASoC: loongson: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (105 preceding siblings ...)
2024-08-05 0:44 ` [PATCH 106/113] ASoC: kirkwood: " Kuninori Morimoto
@ 2024-08-05 0:44 ` Kuninori Morimoto
2024-08-05 0:44 ` [PATCH 108/113] ASoC: mediatek: " Kuninori Morimoto
` (7 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:44 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/loongson/loongson_dma.c | 2 +-
sound/soc/loongson/loongson_i2s.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/loongson/loongson_dma.c b/sound/soc/loongson/loongson_dma.c
index 4fcc2868160bb..3a7018cae33e4 100644
--- a/sound/soc/loongson/loongson_dma.c
+++ b/sound/soc/loongson/loongson_dma.c
@@ -176,7 +176,7 @@ static int loongson_pcm_hw_params(struct snd_soc_component *component,
desc->daddr = prtd->dma_data->dev_addr;
desc->cmd = BIT(0);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
desc->cmd |= BIT(12);
desc->length = period_len >> 2;
diff --git a/sound/soc/loongson/loongson_i2s.c b/sound/soc/loongson/loongson_i2s.c
index d45228a3a558b..6b3a4d57a4b46 100644
--- a/sound/soc/loongson/loongson_i2s.c
+++ b/sound/soc/loongson/loongson_i2s.c
@@ -31,7 +31,7 @@ static int loongson_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
regmap_update_bits(i2s->regmap, LS_I2S_CTRL,
I2S_CTRL_TX_EN | I2S_CTRL_TX_DMA_EN,
I2S_CTRL_TX_EN | I2S_CTRL_TX_DMA_EN);
@@ -43,7 +43,7 @@ static int loongson_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
regmap_update_bits(i2s->regmap, LS_I2S_CTRL,
I2S_CTRL_TX_EN | I2S_CTRL_TX_DMA_EN, 0);
else
@@ -95,7 +95,7 @@ static int loongson_i2s_hw_params(struct snd_pcm_substream *substream,
regmap_read(i2s->regmap, LS_I2S_CFG, &val);
val |= (bits << 24);
val |= (bclk_ratio << 8);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
val |= (bits << 16);
else
val |= bits;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 108/113] ASoC: mediatek: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (106 preceding siblings ...)
2024-08-05 0:44 ` [PATCH 107/113] ASoC: loongson: " Kuninori Morimoto
@ 2024-08-05 0:44 ` Kuninori Morimoto
2024-08-05 0:44 ` [PATCH 109/113] ASoC: rockchip: " Kuninori Morimoto
` (6 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:44 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/mediatek/common/mtk-afe-fe-dai.c | 4 ++--
sound/soc/mediatek/common/mtk-btcvsd.c | 18 +++++++++---------
sound/soc/mediatek/common/mtk-dsp-sof-common.c | 4 ++--
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 10 +++++-----
sound/soc/mediatek/mt6797/mt6797-dai-adda.c | 2 +-
sound/soc/mediatek/mt8183/mt8183-dai-adda.c | 2 +-
sound/soc/mediatek/mt8186/mt8186-afe-pcm.c | 4 ++--
sound/soc/mediatek/mt8186/mt8186-dai-adda.c | 2 +-
sound/soc/mediatek/mt8186/mt8186-dai-src.c | 4 ++--
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 2 +-
sound/soc/mediatek/mt8188/mt8188-dai-adda.c | 2 +-
sound/soc/mediatek/mt8192/mt8192-dai-adda.c | 2 +-
sound/soc/mediatek/mt8195/mt8195-dai-adda.c | 2 +-
13 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c
index 3044d9ab3d4d9..71223feefa1af 100644
--- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c
+++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c
@@ -61,7 +61,7 @@ int mtk_afe_fe_startup(struct snd_pcm_substream *substream,
* This easily leads to overrun when avail_min is period_size.
* One more period can hold the possible unread buffer.
*/
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
int periods_max = mtk_afe_hardware->periods_max;
ret = snd_pcm_hw_constraint_minmax(runtime,
@@ -268,7 +268,7 @@ int mtk_afe_fe_prepare(struct snd_pcm_substream *substream,
int id = snd_soc_rtd_to_cpu(rtd, 0)->id;
int pbuf_size;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
if (afe->get_memif_pbuf_size) {
pbuf_size = afe->get_memif_pbuf_size(substream);
mtk_memif_set_pbuf_size(afe, id, pbuf_size);
diff --git a/sound/soc/mediatek/common/mtk-btcvsd.c b/sound/soc/mediatek/common/mtk-btcvsd.c
index c12d170fa1de6..a896f0c01e600 100644
--- a/sound/soc/mediatek/common/mtk-btcvsd.c
+++ b/sound/soc/mediatek/common/mtk-btcvsd.c
@@ -647,7 +647,7 @@ static int wait_for_bt_irq(struct mtk_btcvsd_snd *bt,
while (max_timeout_trial && !bt_stream->wait_flag) {
t1 = sched_clock();
- if (bt_stream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(bt_stream->stream)) {
ret = wait_event_interruptible_timeout(bt->tx_wait,
bt_stream->wait_flag,
nsecs_to_jiffies(timeout_limit));
@@ -850,7 +850,7 @@ static ssize_t mtk_btcvsd_snd_write(struct mtk_btcvsd_snd *bt,
static struct mtk_btcvsd_snd_stream *get_bt_stream
(struct mtk_btcvsd_snd *bt, struct snd_pcm_substream *substream)
{
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return bt->tx;
else
return bt->rx;
@@ -879,7 +879,7 @@ static int mtk_pcm_btcvsd_open(struct snd_soc_component *component,
snd_soc_set_runtime_hwparams(substream, &mtk_btcvsd_hardware);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ret = mtk_btcvsd_snd_tx_init(bt);
bt->tx->substream = substream;
} else {
@@ -909,7 +909,7 @@ static int mtk_pcm_btcvsd_hw_params(struct snd_soc_component *component,
{
struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(component);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(substream) &&
params_buffer_bytes(hw_params) % bt->tx->packet_size != 0) {
dev_warn(bt->dev, "%s(), error, buffer size %d not valid\n",
__func__,
@@ -926,7 +926,7 @@ static int mtk_pcm_btcvsd_hw_free(struct snd_soc_component *component,
{
struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(component);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
btcvsd_tx_clean_buffer(bt);
return 0;
@@ -958,7 +958,7 @@ static int mtk_pcm_btcvsd_trigger(struct snd_soc_component *component,
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
- hw_packet_ptr = stream == SNDRV_PCM_STREAM_PLAYBACK ?
+ hw_packet_ptr = snd_pcm_is_playback(stream) ?
bt_stream->packet_r : bt_stream->packet_w;
bt_stream->prev_packet_idx = hw_packet_ptr;
bt_stream->prev_frame = 0;
@@ -987,7 +987,7 @@ static snd_pcm_uframes_t mtk_pcm_btcvsd_pointer(
spinlock_t *lock; /* spinlock for bt stream control */
unsigned long flags;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
lock = &bt->tx_lock;
bt_stream = bt->tx;
} else {
@@ -996,7 +996,7 @@ static snd_pcm_uframes_t mtk_pcm_btcvsd_pointer(
}
spin_lock_irqsave(lock, flags);
- hw_packet_ptr = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
+ hw_packet_ptr = snd_pcm_is_playback(substream) ?
bt->tx->packet_r : bt->rx->packet_w;
/* get packet diff from last time */
@@ -1030,7 +1030,7 @@ static int mtk_pcm_btcvsd_copy(struct snd_soc_component *component,
{
struct mtk_btcvsd_snd *bt = snd_soc_component_get_drvdata(component);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return mtk_btcvsd_snd_write(bt, buf, count);
else
return mtk_btcvsd_snd_read(bt, buf, count);
diff --git a/sound/soc/mediatek/common/mtk-dsp-sof-common.c b/sound/soc/mediatek/common/mtk-dsp-sof-common.c
index bca758dca2c9a..050a72b5fc21e 100644
--- a/sound/soc/mediatek/common/mtk-dsp-sof-common.c
+++ b/sound/soc/mediatek/common/mtk-dsp-sof-common.c
@@ -200,13 +200,13 @@ int mtk_sof_card_late_probe(struct snd_soc_card *card)
struct snd_soc_dapm_widget *widget = snd_soc_dai_get_widget(cpu_dai, conn->stream_dir);
memset(&route, 0, sizeof(route));
- if (conn->stream_dir == SNDRV_PCM_STREAM_CAPTURE && widget) {
+ if (snd_pcm_is_capture(conn->stream_dir) && widget) {
snd_soc_dapm_widget_for_each_sink_path(widget, p) {
route.source = conn->sof_dma;
route.sink = p->sink->name;
snd_soc_dapm_add_routes(&card->dapm, &route, 1);
}
- } else if (conn->stream_dir == SNDRV_PCM_STREAM_PLAYBACK && widget) {
+ } else if (snd_pcm_is_playback(conn->stream_dir) && widget) {
snd_soc_dapm_widget_for_each_source_path(widget, p) {
route.source = p->source->name;
route.sink = conn->sof_dma;
diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
index 6a17deb874df7..6bad411dcf243 100644
--- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
+++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
@@ -160,7 +160,7 @@ static void mt2701_afe_i2s_shutdown(struct snd_pcm_substream *substream,
mt2701_afe_i2s_path_disable(afe, i2s_path, substream->stream);
/* need to disable i2s-out path when disable i2s-in */
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
mt2701_afe_i2s_path_disable(afe, i2s_path, !substream->stream);
exit:
@@ -192,7 +192,7 @@ static int mt2701_i2s_path_enable(struct mtk_base_afe *afe,
ASYS_I2S_CON_I2S_MODE |
ASYS_I2S_CON_WIDE_MODE_SET(w_len);
- if (stream_dir == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(stream_dir)) {
mask |= ASYS_I2S_IN_PHASE_FIX;
val |= ASYS_I2S_IN_PHASE_FIX;
reg = ASMI_TIMING_CON1;
@@ -250,7 +250,7 @@ static int mt2701_afe_i2s_prepare(struct snd_pcm_substream *substream,
i2s_path->occupied[substream->stream] = 1;
/* need to enable i2s-out path when enable i2s-in */
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
mt2701_i2s_path_enable(afe, i2s_path, !substream->stream,
substream->runtime->rate);
@@ -368,7 +368,7 @@ static int mt2701_simple_fe_startup(struct snd_pcm_substream *substream,
int stream_dir = substream->stream;
/* can't run single DL & DLM at the same time */
- if (stream_dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(stream_dir)) {
memif_tmp = &afe->memif[MT2701_MEMIF_DLM];
if (memif_tmp->substream) {
dev_warn(afe->dev, "memif is not available");
@@ -387,7 +387,7 @@ static int mt2701_simple_fe_hw_params(struct snd_pcm_substream *substream,
int stream_dir = substream->stream;
/* single DL use PAIR_INTERLEAVE */
- if (stream_dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream_dir))
regmap_update_bits(afe->regmap,
AFE_MEMIF_PBUF_SIZE,
AFE_MEMIF_PBUF_SIZE_DLM_MASK,
diff --git a/sound/soc/mediatek/mt6797/mt6797-dai-adda.c b/sound/soc/mediatek/mt6797/mt6797-dai-adda.c
index 78f3ad758c120..baf5a46781071 100644
--- a/sound/soc/mediatek/mt6797/mt6797-dai-adda.c
+++ b/sound/soc/mediatek/mt6797/mt6797-dai-adda.c
@@ -158,7 +158,7 @@ static int mtk_dai_adda_hw_params(struct snd_pcm_substream *substream,
dev_dbg(afe->dev, "%s(), id %d, stream %d, rate %d\n",
__func__, dai->id, substream->stream, rate);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
unsigned int dl_src2_con0 = 0;
unsigned int dl_src2_con1 = 0;
diff --git a/sound/soc/mediatek/mt8183/mt8183-dai-adda.c b/sound/soc/mediatek/mt8183/mt8183-dai-adda.c
index be69bcea2a786..8317fc1cc5e25 100644
--- a/sound/soc/mediatek/mt8183/mt8183-dai-adda.c
+++ b/sound/soc/mediatek/mt8183/mt8183-dai-adda.c
@@ -276,7 +276,7 @@ static int mtk_dai_adda_hw_params(struct snd_pcm_substream *substream,
dev_dbg(afe->dev, "%s(), id %d, stream %d, rate %d\n",
__func__, dai->id, substream->stream, rate);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
unsigned int dl_src2_con0 = 0;
unsigned int dl_src2_con1 = 0;
diff --git a/sound/soc/mediatek/mt8186/mt8186-afe-pcm.c b/sound/soc/mediatek/mt8186/mt8186-afe-pcm.c
index bafbef96a42da..08776982e44ff 100644
--- a/sound/soc/mediatek/mt8186/mt8186-afe-pcm.c
+++ b/sound/soc/mediatek/mt8186/mt8186-afe-pcm.c
@@ -184,7 +184,7 @@ static int mt8186_fe_trigger(struct snd_pcm_substream *substream, int cmd,
* for small latency record
* ul memif need read some data before irq enable
*/
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
+ if (snd_pcm_is_capture(substream) &&
((runtime->period_size * 1000) / rate <= 10))
udelay(300);
@@ -219,7 +219,7 @@ static int mt8186_fe_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
if (afe_priv->xrun_assert[id] > 0) {
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
int avail = snd_pcm_capture_avail(runtime);
/* alsa can trigger stop/start when occur xrun */
if (avail >= runtime->buffer_size)
diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-adda.c b/sound/soc/mediatek/mt8186/mt8186-dai-adda.c
index dbd157d1a1ea2..5243e263c105d 100644
--- a/sound/soc/mediatek/mt8186/mt8186-dai-adda.c
+++ b/sound/soc/mediatek/mt8186/mt8186-dai-adda.c
@@ -565,7 +565,7 @@ static int mtk_dai_adda_hw_params(struct snd_pcm_substream *substream,
dev_dbg(afe->dev, "%s(), id %d, stream %d, rate %d\n",
__func__, id, substream->stream, rate);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
unsigned int dl_src2_con0;
unsigned int dl_src2_con1;
diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-src.c b/sound/soc/mediatek/mt8186/mt8186-dai-src.c
index e475f4591aef5..5071fd69281c7 100644
--- a/sound/soc/mediatek/mt8186/mt8186-dai-src.c
+++ b/sound/soc/mediatek/mt8186/mt8186-dai-src.c
@@ -560,7 +560,7 @@ static int mtk_dai_src_hw_params(struct snd_pcm_substream *substream,
__func__, id, substream->stream, rate);
/* rate */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
src_priv->dl_rate = rate;
if (id == MT8186_DAI_SRC_1) {
sft = GENERAL1_ASRCIN_MODE_SFT;
@@ -596,7 +596,7 @@ static int mtk_dai_src_hw_free(struct snd_pcm_substream *substream,
dev_dbg(afe->dev, "%s(), id %d, stream %d\n",
__func__, id, substream->stream);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
src_priv->dl_rate = 0;
else
src_priv->ul_rate = 0;
diff --git a/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c b/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c
index ccb6c1f3adc7d..2058e0aa63993 100644
--- a/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c
+++ b/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c
@@ -397,7 +397,7 @@ static int mt8188_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd,
fs << irq_data->irq_fs_shift);
/* delay for uplink */
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
u32 sample_delay;
sample_delay = ((MEMIF_AXI_MINLEN + 1) * 64 +
diff --git a/sound/soc/mediatek/mt8188/mt8188-dai-adda.c b/sound/soc/mediatek/mt8188/mt8188-dai-adda.c
index 8a17d1935c48f..58e1795bfad92 100644
--- a/sound/soc/mediatek/mt8188/mt8188-dai-adda.c
+++ b/sound/soc/mediatek/mt8188/mt8188-dai-adda.c
@@ -414,7 +414,7 @@ static int mtk_dai_adda_hw_params(struct snd_pcm_substream *substream,
adda_priv->hires_required = (rate > ADDA_HIRES_THRES);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
ret = mtk_dai_da_configure(afe, rate, id);
else
ret = mtk_dai_ad_configure(afe, rate, id);
diff --git a/sound/soc/mediatek/mt8192/mt8192-dai-adda.c b/sound/soc/mediatek/mt8192/mt8192-dai-adda.c
index 99de85b876435..5fae5e877d449 100644
--- a/sound/soc/mediatek/mt8192/mt8192-dai-adda.c
+++ b/sound/soc/mediatek/mt8192/mt8192-dai-adda.c
@@ -1067,7 +1067,7 @@ static int mtk_dai_adda_hw_params(struct snd_pcm_substream *substream,
unsigned int rate = params_rate(params);
int id = dai->id;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
unsigned int dl_src2_con0 = 0;
unsigned int dl_src2_con1 = 0;
diff --git a/sound/soc/mediatek/mt8195/mt8195-dai-adda.c b/sound/soc/mediatek/mt8195/mt8195-dai-adda.c
index 8da1587128ccf..18c63f7fc5407 100644
--- a/sound/soc/mediatek/mt8195/mt8195-dai-adda.c
+++ b/sound/soc/mediatek/mt8195/mt8195-dai-adda.c
@@ -638,7 +638,7 @@ static int mtk_dai_adda_hw_params(struct snd_pcm_substream *substream,
else
adda_priv->hires_required = 0;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
ret = mtk_dai_da_configure(afe, rate, dai->id);
else
ret = mtk_dai_ad_configure(afe, rate, dai->id);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 109/113] ASoC: rockchip: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (107 preceding siblings ...)
2024-08-05 0:44 ` [PATCH 108/113] ASoC: mediatek: " Kuninori Morimoto
@ 2024-08-05 0:44 ` Kuninori Morimoto
2024-08-05 0:44 ` [PATCH 110/113] ASoC: starfive: " Kuninori Morimoto
` (5 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:44 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/rockchip/rockchip_i2s.c | 6 +++---
sound/soc/rockchip/rockchip_i2s_tdm.c | 20 ++++++++++----------
sound/soc/rockchip/rockchip_pdm.c | 6 +++---
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index b378f870b3ad2..09e4806071839 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -413,7 +413,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
regmap_update_bits(i2s->regmap, I2S_RXCR,
I2S_RXCR_VDW_MASK | I2S_RXCR_CSR_MASK,
val);
@@ -471,7 +471,7 @@ static int rockchip_i2s_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
ret = rockchip_snd_rxctrl(i2s, 1);
else
ret = rockchip_snd_txctrl(i2s, 1);
@@ -482,7 +482,7 @@ static int rockchip_i2s_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
if (!i2s->tx_start)
i2s_pinctrl_select_bclk_off(i2s);
ret = rockchip_snd_rxctrl(i2s, 0);
diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
index ee517d7b5b7bb..25d1a516962f6 100644
--- a/sound/soc/rockchip/rockchip_i2s_tdm.c
+++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
@@ -287,7 +287,7 @@ static void rockchip_snd_txrxctrl(struct snd_pcm_substream *substream,
spin_lock_irqsave(&i2s_tdm->lock, flags);
if (on) {
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
rockchip_enable_tde(i2s_tdm->regmap);
else
rockchip_enable_rde(i2s_tdm->regmap);
@@ -301,7 +301,7 @@ static void rockchip_snd_txrxctrl(struct snd_pcm_substream *substream,
I2S_XFER_RXS_START);
}
} else {
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
rockchip_disable_tde(i2s_tdm->regmap);
else
rockchip_disable_rde(i2s_tdm->regmap);
@@ -488,7 +488,7 @@ static void rockchip_i2s_tdm_xfer_pause(struct snd_pcm_substream *substream,
int stream;
stream = SNDRV_PCM_STREAM_LAST - substream->stream;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
rockchip_disable_tde(i2s_tdm->regmap);
else
rockchip_disable_rde(i2s_tdm->regmap);
@@ -502,7 +502,7 @@ static void rockchip_i2s_tdm_xfer_resume(struct snd_pcm_substream *substream,
int stream;
stream = SNDRV_PCM_STREAM_LAST - substream->stream;
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(stream))
rockchip_enable_tde(i2s_tdm->regmap);
else
rockchip_enable_rde(i2s_tdm->regmap);
@@ -557,7 +557,7 @@ static int rockchip_i2s_io_multiplex(struct snd_pcm_substream *substream,
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(substream)) {
struct snd_pcm_str *playback_str =
&substream->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK];
@@ -629,7 +629,7 @@ static int rockchip_i2s_trcm_mode(struct snd_pcm_substream *substream,
I2S_CKR_TSD_MASK | I2S_CKR_RSD_MASK,
I2S_CKR_TSD(div_lrck) | I2S_CKR_RSD(div_lrck));
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
regmap_update_bits(i2s_tdm->regmap, I2S_TXCR,
I2S_TXCR_VDW_MASK | I2S_TXCR_CSR_MASK,
fmt);
@@ -661,7 +661,7 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream,
mclk = i2s_tdm->mclk_tx;
} else if (i2s_tdm->clk_trcm == TRCM_RX) {
mclk = i2s_tdm->mclk_rx;
- } else if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ } else if (snd_pcm_is_playback(substream)) {
mclk = i2s_tdm->mclk_tx;
} else {
mclk = i2s_tdm->mclk_rx;
@@ -719,7 +719,7 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream,
if (i2s_tdm->clk_trcm) {
rockchip_i2s_trcm_mode(substream, dai, div_bclk, div_lrck, val);
- } else if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ } else if (snd_pcm_is_playback(substream)) {
regmap_update_bits(i2s_tdm->regmap, I2S_CLKDIV,
I2S_CLKDIV_TXM_MASK,
I2S_CLKDIV_TXM(div_bclk));
@@ -755,7 +755,7 @@ static int rockchip_i2s_tdm_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
if (i2s_tdm->clk_trcm)
rockchip_snd_txrxctrl(substream, dai, 1);
- else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ else if (snd_pcm_is_capture(substream))
rockchip_snd_rxctrl(i2s_tdm, 1);
else
rockchip_snd_txctrl(i2s_tdm, 1);
@@ -765,7 +765,7 @@ static int rockchip_i2s_tdm_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
if (i2s_tdm->clk_trcm)
rockchip_snd_txrxctrl(substream, dai, 0);
- else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ else if (snd_pcm_is_capture(substream))
rockchip_snd_rxctrl(i2s_tdm, 0);
else
rockchip_snd_txctrl(i2s_tdm, 0);
diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c
index d16a4a67a6a2c..2e97a9e842a89 100644
--- a/sound/soc/rockchip/rockchip_pdm.c
+++ b/sound/soc/rockchip/rockchip_pdm.c
@@ -204,7 +204,7 @@ static int rockchip_pdm_hw_params(struct snd_pcm_substream *substream,
bool change;
int ret;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return 0;
samplerate = params_rate(params);
@@ -351,13 +351,13 @@ static int rockchip_pdm_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
rockchip_pdm_rxctrl(pdm, 1);
break;
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
rockchip_pdm_rxctrl(pdm, 0);
break;
default:
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 110/113] ASoC: starfive: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (108 preceding siblings ...)
2024-08-05 0:44 ` [PATCH 109/113] ASoC: rockchip: " Kuninori Morimoto
@ 2024-08-05 0:44 ` Kuninori Morimoto
2024-08-05 0:44 ` [PATCH 111/113] ASoC: uniphier: " Kuninori Morimoto
` (4 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:44 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/starfive/jh7110_tdm.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/starfive/jh7110_tdm.c b/sound/soc/starfive/jh7110_tdm.c
index 1e0ff67207471..c2b307558bfb5 100644
--- a/sound/soc/starfive/jh7110_tdm.c
+++ b/sound/soc/starfive/jh7110_tdm.c
@@ -146,7 +146,7 @@ static inline void jh7110_tdm_writel(struct jh7110_tdm_dev *tdm, u16 reg, u32 va
static void jh7110_tdm_save_context(struct jh7110_tdm_dev *tdm,
struct snd_pcm_substream *substream)
{
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
tdm->saved_pcmtxcr = jh7110_tdm_readl(tdm, TDM_PCMTXCR);
else
tdm->saved_pcmrxcr = jh7110_tdm_readl(tdm, TDM_PCMRXCR);
@@ -161,7 +161,7 @@ static void jh7110_tdm_start(struct jh7110_tdm_dev *tdm,
jh7110_tdm_writel(tdm, TDM_PCMGBCR, data | PCMGBCR_ENABLE);
/* restore context */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
jh7110_tdm_writel(tdm, TDM_PCMTXCR, tdm->saved_pcmtxcr | PCMTXCR_TXEN);
else
jh7110_tdm_writel(tdm, TDM_PCMRXCR, tdm->saved_pcmrxcr | PCMRXCR_RXEN);
@@ -172,7 +172,7 @@ static void jh7110_tdm_stop(struct jh7110_tdm_dev *tdm,
{
unsigned int val;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
val = jh7110_tdm_readl(tdm, TDM_PCMTXCR);
val &= ~PCMTXCR_TXEN;
jh7110_tdm_writel(tdm, TDM_PCMTXCR, val);
@@ -237,7 +237,7 @@ static int jh7110_tdm_config(struct jh7110_tdm_dev *tdm,
(tdm->tx.sl << SL_BIT) |
(tdm->tx.lrj << LRJ_BIT);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
jh7110_tdm_writel(tdm, TDM_PCMTXCR, datatx);
else
jh7110_tdm_writel(tdm, TDM_PCMRXCR, datarx);
@@ -380,7 +380,7 @@ static int jh7110_tdm_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
tdm->tx.wl = chan_wl;
tdm->tx.sl = chan_sl;
tdm->tx.sscale = chan_nr;
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 111/113] ASoC: uniphier: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (109 preceding siblings ...)
2024-08-05 0:44 ` [PATCH 110/113] ASoC: starfive: " Kuninori Morimoto
@ 2024-08-05 0:44 ` Kuninori Morimoto
2024-08-05 0:44 ` [PATCH 112/113] ASoC: hisilicon: " Kuninori Morimoto
` (3 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:44 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/uniphier/aio-cpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/uniphier/aio-cpu.c b/sound/soc/uniphier/aio-cpu.c
index 470f129166a4c..8207e8fed2a80 100644
--- a/sound/soc/uniphier/aio-cpu.c
+++ b/sound/soc/uniphier/aio-cpu.c
@@ -64,12 +64,12 @@ static struct uniphier_aio_sub *find_volume(struct uniphier_aio_chip *chip,
static bool match_spec(const struct uniphier_aio_spec *spec,
const char *name, int dir)
{
- if (dir == SNDRV_PCM_STREAM_PLAYBACK &&
+ if (snd_pcm_is_playback(dir) &&
spec->swm.dir != PORT_DIR_OUTPUT) {
return false;
}
- if (dir == SNDRV_PCM_STREAM_CAPTURE &&
+ if (snd_pcm_is_capture(dir) &&
spec->swm.dir != PORT_DIR_INPUT) {
return false;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 112/113] ASoC: hisilicon: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (110 preceding siblings ...)
2024-08-05 0:44 ` [PATCH 111/113] ASoC: uniphier: " Kuninori Morimoto
@ 2024-08-05 0:44 ` Kuninori Morimoto
2024-08-05 0:44 ` [PATCH 113/113] ASoC: sdw_utils: " Kuninori Morimoto
` (2 subsequent siblings)
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:44 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/hisilicon/hi6210-i2s.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/hisilicon/hi6210-i2s.c b/sound/soc/hisilicon/hi6210-i2s.c
index 250ae3781d140..37ffec8ff721f 100644
--- a/sound/soc/hisilicon/hi6210-i2s.c
+++ b/sound/soc/hisilicon/hi6210-i2s.c
@@ -421,7 +421,7 @@ static int hi6210_i2s_hw_params(struct snd_pcm_substream *substream,
dma_data->maxburst = 2;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
dma_data->addr = i2s->base_phys + HII2S_ST_DL_CHANNEL;
else
dma_data->addr = i2s->base_phys + HII2S_STEREO_UPLINK_CHANNEL;
@@ -478,14 +478,14 @@ static int hi6210_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
hi6210_i2s_rxctrl(cpu_dai, 1);
else
hi6210_i2s_txctrl(cpu_dai, 1);
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
hi6210_i2s_rxctrl(cpu_dai, 0);
else
hi6210_i2s_txctrl(cpu_dai, 0);
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* [PATCH 113/113] ASoC: sdw_utils: use snd_pcm_is_playback/capture()
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (111 preceding siblings ...)
2024-08-05 0:44 ` [PATCH 112/113] ASoC: hisilicon: " Kuninori Morimoto
@ 2024-08-05 0:44 ` Kuninori Morimoto
2024-08-05 10:43 ` [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Mark Brown
2024-08-05 14:04 ` Jaroslav Kysela
114 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-08-05 0:44 UTC (permalink / raw)
To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/sdw_utils/soc_sdw_maxim.c | 2 +-
sound/soc/sdw_utils/soc_sdw_utils.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sdw_utils/soc_sdw_maxim.c b/sound/soc/sdw_utils/soc_sdw_maxim.c
index cdcd8df37e1d3..714dadd75eedd 100644
--- a/sound/soc/sdw_utils/soc_sdw_maxim.c
+++ b/sound/soc/sdw_utils/soc_sdw_maxim.c
@@ -54,7 +54,7 @@ static int asoc_sdw_mx8373_enable_spk_pin(struct snd_pcm_substream *substream, b
int j;
/* set spk pin by playback only */
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ if (snd_pcm_is_capture(substream))
return 0;
cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c
index 6183629d1754c..2b8f058450b25 100644
--- a/sound/soc/sdw_utils/soc_sdw_utils.c
+++ b/sound/soc/sdw_utils/soc_sdw_utils.c
@@ -750,7 +750,7 @@ int asoc_sdw_hw_params(struct snd_pcm_substream *substream,
return 0;
/* Identical data will be sent to all codecs in playback */
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
ch_mask = GENMASK(ch - 1, 0);
step = 0;
} else {
--
2.43.0
^ permalink raw reply related [flat|nested] 120+ messages in thread* Re: [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (112 preceding siblings ...)
2024-08-05 0:44 ` [PATCH 113/113] ASoC: sdw_utils: " Kuninori Morimoto
@ 2024-08-05 10:43 ` Mark Brown
2024-08-05 14:04 ` Jaroslav Kysela
114 siblings, 0 replies; 120+ messages in thread
From: Mark Brown @ 2024-08-05 10:43 UTC (permalink / raw)
To: Kuninori Morimoto
Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
[-- Attachment #1: Type: text/plain, Size: 309 bytes --]
On Mon, Aug 05, 2024 at 12:33:38AM +0000, Kuninori Morimoto wrote:
> Many drivers are using below code to know the Sound direction.
>
> if (direction == SNDRV_PCM_STREAM_PLAYBACK)
>
> This patch-set add snd_pcm_is_playback/capture() macro to handle it.
Acked-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 120+ messages in thread* Re: [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro
2024-08-05 0:33 [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Kuninori Morimoto
` (113 preceding siblings ...)
2024-08-05 10:43 ` [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro Mark Brown
@ 2024-08-05 14:04 ` Jaroslav Kysela
2024-08-05 19:37 ` Mark Brown
114 siblings, 1 reply; 120+ messages in thread
From: Jaroslav Kysela @ 2024-08-05 14:04 UTC (permalink / raw)
To: Kuninori Morimoto, Mark Brown
Cc: Greg Kroah-Hartman, linux-usb, linux-staging, Linux-ALSA
On 05. 08. 24 2:33, Kuninori Morimoto wrote:
>
> Hi ALSA-ML
> Cc Staging-ML, USB-ML
>
> Many drivers are using below code to know the Sound direction.
>
> if (direction == SNDRV_PCM_STREAM_PLAYBACK)
>
> This patch-set add snd_pcm_is_playback/capture() macro to handle it.
>
> Thank you for your help !!
NAK from my side (overdesign, no improved readability). The defines
(SNDRV_PCM_STREAM_*) are enough to check the stream type value correctly.
Jaroslav
--
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
^ permalink raw reply [flat|nested] 120+ messages in thread* Re: [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro
2024-08-05 14:04 ` Jaroslav Kysela
@ 2024-08-05 19:37 ` Mark Brown
2024-09-13 1:35 ` Kuninori Morimoto
0 siblings, 1 reply; 120+ messages in thread
From: Mark Brown @ 2024-08-05 19:37 UTC (permalink / raw)
To: Jaroslav Kysela
Cc: Kuninori Morimoto, Greg Kroah-Hartman, linux-usb, linux-staging,
Linux-ALSA
[-- Attachment #1: Type: text/plain, Size: 620 bytes --]
On Mon, Aug 05, 2024 at 04:04:39PM +0200, Jaroslav Kysela wrote:
> On 05. 08. 24 2:33, Kuninori Morimoto wrote:
> > Many drivers are using below code to know the Sound direction.
> > if (direction == SNDRV_PCM_STREAM_PLAYBACK)
> > This patch-set add snd_pcm_is_playback/capture() macro to handle it.
> NAK from my side (overdesign, no improved readability). The defines
> (SNDRV_PCM_STREAM_*) are enough to check the stream type value correctly.
I have to say I do remember this being a little bit of a confusing idiom
when I first stated looking at ALSA stuff, especially for capture only
cases.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 120+ messages in thread
* Re: [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro
2024-08-05 19:37 ` Mark Brown
@ 2024-09-13 1:35 ` Kuninori Morimoto
2024-09-13 7:14 ` Takashi Iwai
0 siblings, 1 reply; 120+ messages in thread
From: Kuninori Morimoto @ 2024-09-13 1:35 UTC (permalink / raw)
To: Mark Brown, Takashi Iwai
Cc: Linux-USB, Linux-ALSA, Jaroslav Kysela, Greg KH, linux-staging
Hi Takashi, Mark, Jaroslav
This is the reply for very old patch (almost 2 month ago).
> > > Many drivers are using below code to know the Sound direction.
>
> > > if (direction == SNDRV_PCM_STREAM_PLAYBACK)
>
> > > This patch-set add snd_pcm_is_playback/capture() macro to handle it.
>
> > NAK from my side (overdesign, no improved readability). The defines
> > (SNDRV_PCM_STREAM_*) are enough to check the stream type value correctly.
>
> I have to say I do remember this being a little bit of a confusing idiom
> when I first stated looking at ALSA stuff, especially for capture only
> cases.
This patch-set got both Ack and Nack.
I wonder can I re-post this after merge-window again ?
I'm asking because this is very huge patch-set.
Thank you for your help !!
Best regards
---
Kuninori Morimoto
^ permalink raw reply [flat|nested] 120+ messages in thread
* Re: [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro
2024-09-13 1:35 ` Kuninori Morimoto
@ 2024-09-13 7:14 ` Takashi Iwai
2024-09-16 23:41 ` Kuninori Morimoto
0 siblings, 1 reply; 120+ messages in thread
From: Takashi Iwai @ 2024-09-13 7:14 UTC (permalink / raw)
To: Kuninori Morimoto
Cc: Mark Brown, Linux-USB, Linux-ALSA, Jaroslav Kysela, Greg KH,
linux-staging
On Fri, 13 Sep 2024 03:35:28 +0200,
Kuninori Morimoto wrote:
>
>
> Hi Takashi, Mark, Jaroslav
>
> This is the reply for very old patch (almost 2 month ago).
>
> > > > Many drivers are using below code to know the Sound direction.
> >
> > > > if (direction == SNDRV_PCM_STREAM_PLAYBACK)
> >
> > > > This patch-set add snd_pcm_is_playback/capture() macro to handle it.
> >
> > > NAK from my side (overdesign, no improved readability). The defines
> > > (SNDRV_PCM_STREAM_*) are enough to check the stream type value correctly.
> >
> > I have to say I do remember this being a little bit of a confusing idiom
> > when I first stated looking at ALSA stuff, especially for capture only
> > cases.
>
> This patch-set got both Ack and Nack.
> I wonder can I re-post this after merge-window again ?
> I'm asking because this is very huge patch-set.
If we get a NACK for this kind of cleanups, it's rather negative.
Unless its' a mandatory preliminary change for other upcoming stuff,
I don't think it's worth to work on this further.
thanks,
Takashi
^ permalink raw reply [flat|nested] 120+ messages in thread
* Re: [PATCH 000/113] ALSA: add snd_pcm_is_playback/capture() macro
2024-09-13 7:14 ` Takashi Iwai
@ 2024-09-16 23:41 ` Kuninori Morimoto
0 siblings, 0 replies; 120+ messages in thread
From: Kuninori Morimoto @ 2024-09-16 23:41 UTC (permalink / raw)
To: Takashi Iwai
Cc: Mark Brown, Linux-USB, Linux-ALSA, Jaroslav Kysela, Greg KH,
linux-staging
Hi Takashi
> > This patch-set got both Ack and Nack.
> > I wonder can I re-post this after merge-window again ?
> > I'm asking because this is very huge patch-set.
>
> If we get a NACK for this kind of cleanups, it's rather negative.
> Unless its' a mandatory preliminary change for other upcoming stuff,
> I don't think it's worth to work on this further.
Hmm...
Thank you for your help !!
Best regards
---
Kuninori Morimoto
^ permalink raw reply [flat|nested] 120+ messages in thread