[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230916001026.315-21-quic_wcheng@quicinc.com>
Date: Fri, 15 Sep 2023 17:10:13 -0700
From: Wesley Cheng <quic_wcheng@...cinc.com>
To: <mathias.nyman@...el.com>, <gregkh@...uxfoundation.org>,
<lgirdwood@...il.com>, <broonie@...nel.org>, <perex@...ex.cz>,
<tiwai@...e.com>, <agross@...nel.org>, <andersson@...nel.org>,
<konrad.dybcio@...aro.org>, <robh+dt@...nel.org>,
<krzysztof.kozlowski+dt@...aro.org>, <conor+dt@...nel.org>,
<srinivas.kandagatla@...aro.org>, <bgoswami@...cinc.com>,
<Thinh.Nguyen@...opsys.com>
CC: <linux-kernel@...r.kernel.org>, <linux-usb@...r.kernel.org>,
<alsa-devel@...a-project.org>, <linux-arm-msm@...r.kernel.org>,
<devicetree@...r.kernel.org>,
Wesley Cheng <quic_wcheng@...cinc.com>
Subject: [PATCH v6 20/33] ASoC: usb: Add PCM format check API for USB backend
Introduce a check for if a particular PCM format is supported by the USB
audio device connected. If the USB audio device does not have an audio
profile which can support the requested format, then notify the USB
backend.
Signed-off-by: Wesley Cheng <quic_wcheng@...cinc.com>
---
include/sound/soc-usb.h | 3 +++
sound/soc/soc-usb.c | 13 +++++++++++++
2 files changed, 16 insertions(+)
diff --git a/include/sound/soc-usb.h b/include/sound/soc-usb.h
index 1fa671924018..4785ea165e2a 100644
--- a/include/sound/soc-usb.h
+++ b/include/sound/soc-usb.h
@@ -37,6 +37,9 @@ struct snd_soc_usb {
void *priv_data;
};
+int snd_soc_usb_find_format(int card_idx, struct snd_pcm_hw_params *params,
+ int direction);
+
int snd_soc_usb_connect(struct device *usbdev, struct snd_soc_usb_device *sdev);
int snd_soc_usb_disconnect(struct device *usbdev, struct snd_soc_usb_device *sdev);
void *snd_soc_usb_get_priv_data(struct device *usbdev);
diff --git a/sound/soc/soc-usb.c b/sound/soc/soc-usb.c
index b5ab2c1a6dd4..619f9bfd6999 100644
--- a/sound/soc/soc-usb.c
+++ b/sound/soc/soc-usb.c
@@ -74,6 +74,19 @@ void *snd_soc_usb_get_priv_data(struct device *dev)
}
EXPORT_SYMBOL_GPL(snd_soc_usb_get_priv_data);
+int snd_soc_usb_find_format(int card_idx, struct snd_pcm_hw_params *params,
+ int direction)
+{
+ struct snd_usb_stream *as;
+
+ as = snd_usb_find_suppported_substream(card_idx, params, direction);
+ if (!as)
+ return -EOPNOTSUPP;
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_usb_find_format);
+
/**
* snd_soc_usb_add_port() - Add a USB backend port
* @dev: USB backend device
Powered by blists - more mailing lists