@@ -1502,6 +1502,7 @@ int snd_soc_get_dai_name(struct of_phandle_args *args,
const char **dai_name);
int snd_soc_of_get_dai_name(struct device_node *of_node,
const char **dai_name);
+struct snd_soc_component *snd_soc_of_lookup_component(struct device_node *np);
int snd_soc_of_get_dai_link_codecs(struct device *dev,
struct device_node *of_node,
struct snd_soc_dai_link *dai_link);
@@ -3797,6 +3797,34 @@ int snd_soc_of_get_dai_name(struct device_node *of_node,
EXPORT_SYMBOL_GPL(snd_soc_of_get_dai_name);
/*
+ * snd_soc_of_lookup_component - Lookup component with device node
+ * @np: device node pointer
+ *
+ * This function looks up component based on given of_node
+ *
+ * Returns valid component pointer on success and NULL on failure to find one.
+ */
+struct snd_soc_component *snd_soc_of_lookup_component(struct device_node *np)
+{
+ struct snd_soc_component *component = NULL;
+ bool found = false;
+
+ if (!np)
+ return NULL;
+
+ mutex_lock(&client_mutex);
+ for_each_component(component)
+ if (component->dev->of_node == np) {
+ found = true;
+ break;
+ }
+ mutex_unlock(&client_mutex);
+
+ return found ? component : NULL;
+}
+EXPORT_SYMBOL_GPL(snd_soc_of_lookup_component);
+
+/*
* snd_soc_of_put_dai_link_codecs - Dereference device nodes in the codecs array
* @dai_link: DAI link
*