@@ -36,6 +36,11 @@ struct snd_soc_usb_device {
* @list - list head for SND SOC struct list
* @component - reference to ASoC component
* @connection_status_cb - callback to notify connection events
+ * @update_offload_route_info - callback to fetch mapped ASoC card and pcm
+ * device pair. This is unrelated to the concept
+ * of DAPM route. The "route" argument carries
+ * an array used for a kcontrol output and should
+ * contain two integers, card and pcm device index
* @priv_data - driver data
**/
struct snd_soc_usb {
@@ -44,6 +49,9 @@ struct snd_soc_usb {
int (*connection_status_cb)(struct snd_soc_usb *usb,
struct snd_soc_usb_device *sdev,
bool connected);
+ int (*update_offload_route_info)(struct snd_soc_component *component,
+ int card, int pcm, int direction,
+ long *route);
void *priv_data;
};
@@ -59,6 +67,8 @@ void *snd_soc_usb_find_priv_data(struct device *usbdev);
int snd_soc_usb_setup_offload_jack(struct snd_soc_component *component,
struct snd_soc_jack *jack);
int snd_soc_usb_disable_offload_jack(struct snd_soc_component *component);
+int snd_soc_usb_update_offload_route(struct device *dev, int card, int pcm,
+ int direction, long *route);
struct snd_soc_usb *snd_soc_usb_allocate_port(struct snd_soc_component *component,
void *data);
@@ -101,6 +111,12 @@ static inline int snd_soc_usb_disable_offload_jack(struct snd_soc_component *com
return 0;
}
+static int snd_soc_usb_update_offload_route(struct device *dev, int card, int pcm,
+ int direction, long *route)
+{
+ return -ENODEV;
+}
+
static inline struct snd_soc_usb *
snd_soc_usb_allocate_port(struct snd_soc_component *component, void *data)
{
@@ -118,6 +118,40 @@ int snd_soc_usb_disable_offload_jack(struct snd_soc_component *component)
}
EXPORT_SYMBOL_GPL(snd_soc_usb_disable_offload_jack);
+/**
+ * snd_soc_usb_update_offload_route - Find active USB offload path
+ * @dev - USB device to get offload status
+ * @card - USB card index
+ * @pcm - USB PCM device index
+ * @direction - playback or capture direction
+ * @route - pointer to route output array
+ *
+ * Fetch the current status for the USB SND card and PCM device indexes
+ * specified. The "route" argument should be an array of integers being
+ * used for a kcontrol output. The first element should have the selected
+ * card index, and the second element should have the selected pcm device
+ * index.
+ */
+int snd_soc_usb_update_offload_route(struct device *dev, int card, int pcm,
+ int direction, long *route)
+{
+ struct snd_soc_usb *ctx;
+ int ret;
+
+ ctx = snd_soc_find_usb_ctx(dev);
+ if (!ctx)
+ return -ENODEV;
+
+ mutex_lock(&ctx_mutex);
+ if (ctx && ctx->update_offload_route_info)
+ ret = ctx->update_offload_route_info(ctx->component, card, pcm,
+ direction, route);
+ mutex_unlock(&ctx_mutex);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(snd_soc_usb_update_offload_route);
+
/**
* snd_soc_usb_find_priv_data() - Retrieve private data stored
* @usbdev: device reference