|
@@ -58,6 +58,205 @@ int snd_soc_params_to_bclk(struct snd_pcm_hw_params *params)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk);
|
|
EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk);
|
|
|
|
|
|
|
|
+int snd_soc_component_enable_pin(struct snd_soc_component *component,
|
|
|
|
+ const char *pin)
|
|
|
|
+{
|
|
|
|
+ struct snd_soc_dapm_context *dapm =
|
|
|
|
+ snd_soc_component_get_dapm(component);
|
|
|
|
+ char *full_name;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ if (!component->name_prefix)
|
|
|
|
+ return snd_soc_dapm_enable_pin(dapm, pin);
|
|
|
|
+
|
|
|
|
+ full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin);
|
|
|
|
+ if (!full_name)
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+
|
|
|
|
+ ret = snd_soc_dapm_enable_pin(dapm, full_name);
|
|
|
|
+ kfree(full_name);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin);
|
|
|
|
+
|
|
|
|
+int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component,
|
|
|
|
+ const char *pin)
|
|
|
|
+{
|
|
|
|
+ struct snd_soc_dapm_context *dapm =
|
|
|
|
+ snd_soc_component_get_dapm(component);
|
|
|
|
+ char *full_name;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ if (!component->name_prefix)
|
|
|
|
+ return snd_soc_dapm_enable_pin_unlocked(dapm, pin);
|
|
|
|
+
|
|
|
|
+ full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin);
|
|
|
|
+ if (!full_name)
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+
|
|
|
|
+ ret = snd_soc_dapm_enable_pin_unlocked(dapm, full_name);
|
|
|
|
+ kfree(full_name);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin_unlocked);
|
|
|
|
+
|
|
|
|
+int snd_soc_component_disable_pin(struct snd_soc_component *component,
|
|
|
|
+ const char *pin)
|
|
|
|
+{
|
|
|
|
+ struct snd_soc_dapm_context *dapm =
|
|
|
|
+ snd_soc_component_get_dapm(component);
|
|
|
|
+ char *full_name;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ if (!component->name_prefix)
|
|
|
|
+ return snd_soc_dapm_disable_pin(dapm, pin);
|
|
|
|
+
|
|
|
|
+ full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin);
|
|
|
|
+ if (!full_name)
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+
|
|
|
|
+ ret = snd_soc_dapm_disable_pin(dapm, full_name);
|
|
|
|
+ kfree(full_name);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin);
|
|
|
|
+
|
|
|
|
+int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component,
|
|
|
|
+ const char *pin)
|
|
|
|
+{
|
|
|
|
+ struct snd_soc_dapm_context *dapm =
|
|
|
|
+ snd_soc_component_get_dapm(component);
|
|
|
|
+ char *full_name;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ if (!component->name_prefix)
|
|
|
|
+ return snd_soc_dapm_disable_pin_unlocked(dapm, pin);
|
|
|
|
+
|
|
|
|
+ full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin);
|
|
|
|
+ if (!full_name)
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+
|
|
|
|
+ ret = snd_soc_dapm_disable_pin_unlocked(dapm, full_name);
|
|
|
|
+ kfree(full_name);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin_unlocked);
|
|
|
|
+
|
|
|
|
+int snd_soc_component_nc_pin(struct snd_soc_component *component,
|
|
|
|
+ const char *pin)
|
|
|
|
+{
|
|
|
|
+ struct snd_soc_dapm_context *dapm =
|
|
|
|
+ snd_soc_component_get_dapm(component);
|
|
|
|
+ char *full_name;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ if (!component->name_prefix)
|
|
|
|
+ return snd_soc_dapm_nc_pin(dapm, pin);
|
|
|
|
+
|
|
|
|
+ full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin);
|
|
|
|
+ if (!full_name)
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+
|
|
|
|
+ ret = snd_soc_dapm_nc_pin(dapm, full_name);
|
|
|
|
+ kfree(full_name);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin);
|
|
|
|
+
|
|
|
|
+int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component,
|
|
|
|
+ const char *pin)
|
|
|
|
+{
|
|
|
|
+ struct snd_soc_dapm_context *dapm =
|
|
|
|
+ snd_soc_component_get_dapm(component);
|
|
|
|
+ char *full_name;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ if (!component->name_prefix)
|
|
|
|
+ return snd_soc_dapm_nc_pin_unlocked(dapm, pin);
|
|
|
|
+
|
|
|
|
+ full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin);
|
|
|
|
+ if (!full_name)
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+
|
|
|
|
+ ret = snd_soc_dapm_nc_pin_unlocked(dapm, full_name);
|
|
|
|
+ kfree(full_name);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin_unlocked);
|
|
|
|
+
|
|
|
|
+int snd_soc_component_get_pin_status(struct snd_soc_component *component,
|
|
|
|
+ const char *pin)
|
|
|
|
+{
|
|
|
|
+ struct snd_soc_dapm_context *dapm =
|
|
|
|
+ snd_soc_component_get_dapm(component);
|
|
|
|
+ char *full_name;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ if (!component->name_prefix)
|
|
|
|
+ return snd_soc_dapm_get_pin_status(dapm, pin);
|
|
|
|
+
|
|
|
|
+ full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin);
|
|
|
|
+ if (!full_name)
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+
|
|
|
|
+ ret = snd_soc_dapm_get_pin_status(dapm, full_name);
|
|
|
|
+ kfree(full_name);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(snd_soc_component_get_pin_status);
|
|
|
|
+
|
|
|
|
+int snd_soc_component_force_enable_pin(struct snd_soc_component *component,
|
|
|
|
+ const char *pin)
|
|
|
|
+{
|
|
|
|
+ struct snd_soc_dapm_context *dapm =
|
|
|
|
+ snd_soc_component_get_dapm(component);
|
|
|
|
+ char *full_name;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ if (!component->name_prefix)
|
|
|
|
+ return snd_soc_dapm_force_enable_pin(dapm, pin);
|
|
|
|
+
|
|
|
|
+ full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin);
|
|
|
|
+ if (!full_name)
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+
|
|
|
|
+ ret = snd_soc_dapm_force_enable_pin(dapm, full_name);
|
|
|
|
+ kfree(full_name);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin);
|
|
|
|
+
|
|
|
|
+int snd_soc_component_force_enable_pin_unlocked(
|
|
|
|
+ struct snd_soc_component *component,
|
|
|
|
+ const char *pin)
|
|
|
|
+{
|
|
|
|
+ struct snd_soc_dapm_context *dapm =
|
|
|
|
+ snd_soc_component_get_dapm(component);
|
|
|
|
+ char *full_name;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ if (!component->name_prefix)
|
|
|
|
+ return snd_soc_dapm_force_enable_pin_unlocked(dapm, pin);
|
|
|
|
+
|
|
|
|
+ full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin);
|
|
|
|
+ if (!full_name)
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+
|
|
|
|
+ ret = snd_soc_dapm_force_enable_pin_unlocked(dapm, full_name);
|
|
|
|
+ kfree(full_name);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin_unlocked);
|
|
|
|
+
|
|
static const struct snd_pcm_hardware dummy_dma_hardware = {
|
|
static const struct snd_pcm_hardware dummy_dma_hardware = {
|
|
/* Random values to keep userspace happy when checking constraints */
|
|
/* Random values to keep userspace happy when checking constraints */
|
|
.info = SNDRV_PCM_INFO_INTERLEAVED |
|
|
.info = SNDRV_PCM_INFO_INTERLEAVED |
|