@@ -39,6 +39,9 @@ static int sm8250_snd_init(struct snd_soc_pcm_runtime *rtd)
&data->usb_offload_jack_setup);
else
ret = qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
+
+ qcom_snd_add_components_string(rtd);
+
return ret;
}
@@ -52,4 +52,26 @@ int qcom_snd_usb_offload_jack_remove(struct snd_soc_pcm_runtime *rtd,
return 0;
}
EXPORT_SYMBOL_GPL(qcom_snd_usb_offload_jack_remove);
+
+int qcom_snd_add_components_string(struct snd_soc_pcm_runtime *rtd)
+{
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ struct snd_soc_card *card = rtd->card;
+ const char *prev = card->components;
+
+ switch (cpu_dai->id) {
+ case USB_RX:
+ card->components = devm_kasprintf(card->dev, GFP_KERNEL, "%s %s",
+ card->components,
+ snd_soc_usb_get_components_tag(true));
+ default:
+ break;
+ }
+
+ if (prev && prev != card->components)
+ devm_kfree(card->dev, prev);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(qcom_snd_add_components_string);
MODULE_LICENSE("GPL");
@@ -13,6 +13,8 @@ int qcom_snd_usb_offload_jack_setup(struct snd_soc_pcm_runtime *rtd,
int qcom_snd_usb_offload_jack_remove(struct snd_soc_pcm_runtime *rtd,
bool *jack_setup);
+
+int qcom_snd_add_components_string(struct snd_soc_pcm_runtime *rtd);
#else
static inline int qcom_snd_usb_offload_jack_setup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_jack *jack, bool *jack_setup)
@@ -25,5 +27,10 @@ static inline int qcom_snd_usb_offload_jack_remove(struct snd_soc_pcm_runtime *r
{
return -ENODEV;
}
+
+static inline int qcom_snd_add_components_string(struct snd_soc_pcm_runtime *rtd)
+{
+ return -ENODEV;
+}
#endif /* IS_ENABLED(CONFIG_SND_SOC_QCOM_OFFLOAD_UTILS) */
#endif /* __QCOM_SND_USB_OFFLOAD_UTILS_H__ */
For userspace to know about certain capabilities of the current platform card, add tags to the components string that it can use to enable support for that audio path. In case of USB offloading, the "usboffldplybk: 1" tag is added to the string. Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com> --- sound/soc/qcom/sm8250.c | 3 +++ sound/soc/qcom/usb_offload_utils.c | 22 ++++++++++++++++++++++ sound/soc/qcom/usb_offload_utils.h | 7 +++++++ 3 files changed, 32 insertions(+)