summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c93
1 files changed, 21 insertions, 72 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c612900c80ff..3d8cff629a18 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1090,7 +1090,6 @@ static int soc_probe_component(struct snd_soc_card *card,
struct snd_soc_component *component)
{
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
- struct snd_soc_component *dai_component, *component2;
struct snd_soc_dai *dai;
int ret;
@@ -1117,44 +1116,12 @@ static int soc_probe_component(struct snd_soc_card *card,
}
}
- /*
- * This is rather ugly, but certain platforms expect that the DAPM
- * widgets for the DAIs for components with the same parent device are
- * created in the platforms DAPM context. Until that is fixed we need to
- * keep this.
- */
- if (component->steal_sibling_dai_widgets) {
- dai_component = NULL;
- list_for_each_entry(component2, &component_list, list) {
- if (component == component2)
- continue;
-
- if (component2->dev == component->dev &&
- !list_empty(&component2->dai_list)) {
- dai_component = component2;
- break;
- }
- }
- } else {
- dai_component = component;
- list_for_each_entry(component2, &component_list, list) {
- if (component2->dev == component->dev &&
- component2->steal_sibling_dai_widgets) {
- dai_component = NULL;
- break;
- }
- }
- }
-
- if (dai_component) {
- list_for_each_entry(dai, &dai_component->dai_list, list) {
- snd_soc_dapm_new_dai_widgets(dapm, dai);
- if (ret != 0) {
- dev_err(component->dev,
- "Failed to create DAI widgets %d\n",
- ret);
- goto err_probe;
- }
+ list_for_each_entry(dai, &component->dai_list, list) {
+ ret = snd_soc_dapm_new_dai_widgets(dapm, dai);
+ if (ret != 0) {
+ dev_err(component->dev,
+ "Failed to create DAI widgets %d\n", ret);
+ goto err_probe;
}
}
@@ -1212,7 +1179,7 @@ static int soc_post_component_init(struct snd_soc_pcm_runtime *rtd,
device_initialize(rtd->dev);
rtd->dev->parent = rtd->card->dev;
rtd->dev->release = rtd_release;
- rtd->dev->init_name = name;
+ dev_set_name(rtd->dev, "%s", name);
dev_set_drvdata(rtd->dev, rtd);
mutex_init(&rtd->pcm_mutex);
INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients);
@@ -1992,19 +1959,14 @@ static struct platform_driver soc_driver = {
int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
struct snd_ac97_bus_ops *ops, int num)
{
- mutex_lock(&codec->mutex);
-
codec->ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL);
- if (codec->ac97 == NULL) {
- mutex_unlock(&codec->mutex);
+ if (codec->ac97 == NULL)
return -ENOMEM;
- }
codec->ac97->bus = kzalloc(sizeof(struct snd_ac97_bus), GFP_KERNEL);
if (codec->ac97->bus == NULL) {
kfree(codec->ac97);
codec->ac97 = NULL;
- mutex_unlock(&codec->mutex);
return -ENOMEM;
}
@@ -2017,7 +1979,6 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
*/
codec->ac97_created = 1;
- mutex_unlock(&codec->mutex);
return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_new_ac97_codec);
@@ -2187,7 +2148,6 @@ EXPORT_SYMBOL_GPL(snd_soc_set_ac97_ops_of_reset);
*/
void snd_soc_free_ac97_codec(struct snd_soc_codec *codec)
{
- mutex_lock(&codec->mutex);
#ifdef CONFIG_SND_SOC_AC97_BUS
soc_unregister_ac97_codec(codec);
#endif
@@ -2195,7 +2155,6 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec)
kfree(codec->ac97);
codec->ac97 = NULL;
codec->ac97_created = 0;
- mutex_unlock(&codec->mutex);
}
EXPORT_SYMBOL_GPL(snd_soc_free_ac97_codec);
@@ -2912,9 +2871,10 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
unsigned int val, val_mask;
int ret;
- val = ((ucontrol->value.integer.value[0] + min) & mask);
if (invert)
- val = max - val;
+ val = (max - ucontrol->value.integer.value[0]) & mask;
+ else
+ val = ((ucontrol->value.integer.value[0] + min) & mask);
val_mask = mask << shift;
val = val << shift;
@@ -2923,9 +2883,10 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
return ret;
if (snd_soc_volsw_is_stereo(mc)) {
- val = ((ucontrol->value.integer.value[1] + min) & mask);
if (invert)
- val = max - val;
+ val = (max - ucontrol->value.integer.value[1]) & mask;
+ else
+ val = ((ucontrol->value.integer.value[1] + min) & mask);
val_mask = mask << shift;
val = val << shift;
@@ -2970,8 +2931,9 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
if (invert)
ucontrol->value.integer.value[0] =
max - ucontrol->value.integer.value[0];
- ucontrol->value.integer.value[0] =
- ucontrol->value.integer.value[0] - min;
+ else
+ ucontrol->value.integer.value[0] =
+ ucontrol->value.integer.value[0] - min;
if (snd_soc_volsw_is_stereo(mc)) {
ret = snd_soc_component_read(component, rreg, &val);
@@ -2982,8 +2944,9 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
if (invert)
ucontrol->value.integer.value[1] =
max - ucontrol->value.integer.value[1];
- ucontrol->value.integer.value[1] =
- ucontrol->value.integer.value[1] - min;
+ else
+ ucontrol->value.integer.value[1] =
+ ucontrol->value.integer.value[1] - min;
}
return 0;
@@ -3088,7 +3051,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
unsigned int val, mask;
void *data;
- if (!component->regmap)
+ if (!component->regmap || !params->num_regs)
return -EINVAL;
len = params->num_regs * component->val_bytes;
@@ -4170,19 +4133,6 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
platform->dev = dev;
platform->driver = platform_drv;
- if (platform_drv->controls) {
- platform->component.controls = platform_drv->controls;
- platform->component.num_controls = platform_drv->num_controls;
- }
- if (platform_drv->dapm_widgets) {
- platform->component.dapm_widgets = platform_drv->dapm_widgets;
- platform->component.num_dapm_widgets = platform_drv->num_dapm_widgets;
- platform->component.steal_sibling_dai_widgets = true;
- }
- if (platform_drv->dapm_routes) {
- platform->component.dapm_routes = platform_drv->dapm_routes;
- platform->component.num_dapm_routes = platform_drv->num_dapm_routes;
- }
if (platform_drv->probe)
platform->component.probe = snd_soc_platform_drv_probe;
@@ -4403,7 +4353,6 @@ int snd_soc_register_codec(struct device *dev,
if (codec_drv->read)
codec->component.read = snd_soc_codec_drv_read;
codec->component.ignore_pmdown_time = codec_drv->ignore_pmdown_time;
- codec->dapm.codec = codec;
codec->dapm.idle_bias_off = codec_drv->idle_bias_off;
codec->dapm.suspend_bias_off = codec_drv->suspend_bias_off;
if (codec_drv->seq_notifier)