[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230126031424.14582-19-quic_wcheng@quicinc.com>
Date: Wed, 25 Jan 2023 19:14:20 -0800
From: Wesley Cheng <quic_wcheng@...cinc.com>
To: <srinivas.kandagatla@...aro.org>, <mathias.nyman@...el.com>,
<perex@...ex.cz>, <lgirdwood@...il.com>, <andersson@...nel.org>,
<krzysztof.kozlowski+dt@...aro.org>, <gregkh@...uxfoundation.org>,
<Thinh.Nguyen@...opsys.com>, <broonie@...nel.org>,
<bgoswami@...cinc.com>, <tiwai@...e.com>, <robh+dt@...nel.org>,
<agross@...nel.org>
CC: <linux-kernel@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>,
<alsa-devel@...a-project.org>, <devicetree@...r.kernel.org>,
<linux-usb@...r.kernel.org>, <quic_jackp@...cinc.com>,
<quic_plai@...cinc.com>, Wesley Cheng <quic_wcheng@...cinc.com>
Subject: [RFC PATCH v2 18/22] sound: soc: soc-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 ec422a8a834f..d6a0a1bd9c60 100644
--- a/include/sound/soc-usb.h
+++ b/include/sound/soc-usb.h
@@ -21,6 +21,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, int card_idx);
int snd_soc_usb_disconnect(struct device *usbdev);
void snd_soc_usb_set_priv_data(struct device *dev, void *priv);
diff --git a/sound/soc/soc-usb.c b/sound/soc/soc-usb.c
index bfce6c9609e1..130cf12505f3 100644
--- a/sound/soc/soc-usb.c
+++ b/sound/soc/soc-usb.c
@@ -94,6 +94,19 @@ void snd_soc_usb_set_priv_data(struct device *dev, void *priv)
}
EXPORT_SYMBOL_GPL(snd_soc_usb_set_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