aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc-dapm.h2
-rw-r--r--include/sound/soc.h30
-rw-r--r--sound/soc/soc-core.c19
-rw-r--r--sound/soc/soc-dapm.c100
4 files changed, 110 insertions, 41 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 3a5c4f969c04..e292683ee694 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -441,6 +441,8 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
441 struct snd_soc_dapm_widget_list **list); 441 struct snd_soc_dapm_widget_list **list);
442 442
443struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol); 443struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol);
444struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(
445 struct snd_kcontrol *kcontrol);
444 446
445/* dapm widget types */ 447/* dapm widget types */
446enum snd_soc_dapm_type { 448enum snd_soc_dapm_type {
diff --git a/include/sound/soc.h b/include/sound/soc.h
index f64bf9452466..a21dfecba56b 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -706,6 +706,10 @@ struct snd_soc_component {
706 int val_bytes; 706 int val_bytes;
707 707
708 struct mutex io_mutex; 708 struct mutex io_mutex;
709
710 /* Don't use these, use snd_soc_component_get_dapm() */
711 struct snd_soc_dapm_context dapm;
712 struct snd_soc_dapm_context *dapm_ptr;
709}; 713};
710 714
711/* SoC Audio Codec device */ 715/* SoC Audio Codec device */
@@ -1161,6 +1165,21 @@ static inline struct snd_soc_platform *snd_soc_component_to_platform(
1161} 1165}
1162 1166
1163/** 1167/**
1168 * snd_soc_dapm_to_component() - Casts a DAPM context to the component it is
1169 * embedded in
1170 * @dapm: The DAPM context to cast to the component
1171 *
1172 * This function must only be used on DAPM contexts that are known to be part of
1173 * a component (e.g. in a component driver). Otherwise the behavior is
1174 * undefined.
1175 */
1176static inline struct snd_soc_component *snd_soc_dapm_to_component(
1177 struct snd_soc_dapm_context *dapm)
1178{
1179 return container_of(dapm, struct snd_soc_component, dapm);
1180}
1181
1182/**
1164 * snd_soc_dapm_to_codec() - Casts a DAPM context to the CODEC it is embedded in 1183 * snd_soc_dapm_to_codec() - Casts a DAPM context to the CODEC it is embedded in
1165 * @dapm: The DAPM context to cast to the CODEC 1184 * @dapm: The DAPM context to cast to the CODEC
1166 * 1185 *
@@ -1187,6 +1206,17 @@ static inline struct snd_soc_platform *snd_soc_dapm_to_platform(
1187 return container_of(dapm, struct snd_soc_platform, dapm); 1206 return container_of(dapm, struct snd_soc_platform, dapm);
1188} 1207}
1189 1208
1209/**
1210 * snd_soc_component_get_dapm() - Returns the DAPM context associated with a
1211 * component
1212 * @component: The component for which to get the DAPM context
1213 */
1214static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
1215 struct snd_soc_component *component)
1216{
1217 return component->dapm_ptr;
1218}
1219
1190/* codec IO */ 1220/* codec IO */
1191unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); 1221unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
1192int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg, 1222int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 10e13c43bc54..f519a9f7571c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3997,6 +3997,8 @@ err:
3997static int snd_soc_component_initialize(struct snd_soc_component *component, 3997static int snd_soc_component_initialize(struct snd_soc_component *component,
3998 const struct snd_soc_component_driver *driver, struct device *dev) 3998 const struct snd_soc_component_driver *driver, struct device *dev)
3999{ 3999{
4000 struct snd_soc_dapm_context *dapm;
4001
4000 component->name = fmt_single_name(dev, &component->id); 4002 component->name = fmt_single_name(dev, &component->id);
4001 if (!component->name) { 4003 if (!component->name) {
4002 dev_err(dev, "ASoC: Failed to allocate name\n"); 4004 dev_err(dev, "ASoC: Failed to allocate name\n");
@@ -4006,6 +4008,14 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
4006 component->dev = dev; 4008 component->dev = dev;
4007 component->driver = driver; 4009 component->driver = driver;
4008 4010
4011 if (!component->dapm_ptr)
4012 component->dapm_ptr = &component->dapm;
4013
4014 dapm = component->dapm_ptr;
4015 dapm->dev = dev;
4016 dapm->component = component;
4017 dapm->bias_level = SND_SOC_BIAS_OFF;
4018
4009 INIT_LIST_HEAD(&component->dai_list); 4019 INIT_LIST_HEAD(&component->dai_list);
4010 mutex_init(&component->io_mutex); 4020 mutex_init(&component->io_mutex);
4011 4021
@@ -4131,6 +4141,8 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
4131{ 4141{
4132 int ret; 4142 int ret;
4133 4143
4144 platform->component.dapm_ptr = &platform->dapm;
4145
4134 ret = snd_soc_component_initialize(&platform->component, 4146 ret = snd_soc_component_initialize(&platform->component,
4135 &platform_drv->component_driver, dev); 4147 &platform_drv->component_driver, dev);
4136 if (ret) 4148 if (ret)
@@ -4138,9 +4150,7 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
4138 4150
4139 platform->dev = dev; 4151 platform->dev = dev;
4140 platform->driver = platform_drv; 4152 platform->driver = platform_drv;
4141 platform->dapm.dev = dev;
4142 platform->dapm.platform = platform; 4153 platform->dapm.platform = platform;
4143 platform->dapm.component = &platform->component;
4144 platform->dapm.stream_event = platform_drv->stream_event; 4154 platform->dapm.stream_event = platform_drv->stream_event;
4145 if (platform_drv->write) 4155 if (platform_drv->write)
4146 platform->component.write = snd_soc_platform_drv_write; 4156 platform->component.write = snd_soc_platform_drv_write;
@@ -4314,6 +4324,8 @@ int snd_soc_register_codec(struct device *dev,
4314 if (codec == NULL) 4324 if (codec == NULL)
4315 return -ENOMEM; 4325 return -ENOMEM;
4316 4326
4327 codec->component.dapm_ptr = &codec->dapm;
4328
4317 ret = snd_soc_component_initialize(&codec->component, 4329 ret = snd_soc_component_initialize(&codec->component,
4318 &codec_drv->component_driver, dev); 4330 &codec_drv->component_driver, dev);
4319 if (ret) 4331 if (ret)
@@ -4324,10 +4336,7 @@ int snd_soc_register_codec(struct device *dev,
4324 if (codec_drv->read) 4336 if (codec_drv->read)
4325 codec->component.read = snd_soc_codec_drv_read; 4337 codec->component.read = snd_soc_codec_drv_read;
4326 codec->component.ignore_pmdown_time = codec_drv->ignore_pmdown_time; 4338 codec->component.ignore_pmdown_time = codec_drv->ignore_pmdown_time;
4327 codec->dapm.bias_level = SND_SOC_BIAS_OFF;
4328 codec->dapm.dev = dev;
4329 codec->dapm.codec = codec; 4339 codec->dapm.codec = codec;
4330 codec->dapm.component = &codec->component;
4331 codec->dapm.seq_notifier = codec_drv->seq_notifier; 4340 codec->dapm.seq_notifier = codec_drv->seq_notifier;
4332 codec->dapm.stream_event = codec_drv->stream_event; 4341 codec->dapm.stream_event = codec_drv->stream_event;
4333 if (codec_drv->set_bias_level) 4342 if (codec_drv->set_bias_level)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 6c94a6b3fce7..4702b926a6a0 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -350,12 +350,27 @@ static bool dapm_kcontrol_set_value(const struct snd_kcontrol *kcontrol,
350} 350}
351 351
352/** 352/**
353 * snd_soc_dapm_kcontrol_dapm() - Returns the dapm context associated to a
354 * kcontrol
355 * @kcontrol: The kcontrol
356 *
357 * Note: This function must only be used on kcontrols that are known to have
358 * been registered for a CODEC. Otherwise the behaviour is undefined.
359 */
360struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(
361 struct snd_kcontrol *kcontrol)
362{
363 return dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->dapm;
364}
365EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_dapm);
366
367/**
353 * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol 368 * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol
354 * @kcontrol: The kcontrol 369 * @kcontrol: The kcontrol
355 */ 370 */
356struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol) 371struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol)
357{ 372{
358 return dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->codec; 373 return snd_soc_dapm_to_codec(snd_soc_dapm_kcontrol_dapm(kcontrol));
359} 374}
360EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_codec); 375EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_codec);
361 376
@@ -382,23 +397,31 @@ static const char *soc_dapm_prefix(struct snd_soc_dapm_context *dapm)
382 return dapm->component->name_prefix; 397 return dapm->component->name_prefix;
383} 398}
384 399
385static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg, 400static int soc_dapm_read(struct snd_soc_dapm_context *dapm, int reg,
386 unsigned int *value) 401 unsigned int *value)
387{ 402{
388 if (!w->dapm->component) 403 if (!dapm->component)
389 return -EIO; 404 return -EIO;
390 return snd_soc_component_read(w->dapm->component, reg, value); 405 return snd_soc_component_read(dapm->component, reg, value);
391} 406}
392 407
393static int soc_widget_update_bits(struct snd_soc_dapm_widget *w, 408static int soc_dapm_update_bits(struct snd_soc_dapm_context *dapm,
394 int reg, unsigned int mask, unsigned int value) 409 int reg, unsigned int mask, unsigned int value)
395{ 410{
396 if (!w->dapm->component) 411 if (!dapm->component)
397 return -EIO; 412 return -EIO;
398 return snd_soc_component_update_bits_async(w->dapm->component, reg, 413 return snd_soc_component_update_bits_async(dapm->component, reg,
399 mask, value); 414 mask, value);
400} 415}
401 416
417static int soc_dapm_test_bits(struct snd_soc_dapm_context *dapm,
418 int reg, unsigned int mask, unsigned int value)
419{
420 if (!dapm->component)
421 return -EIO;
422 return snd_soc_component_test_bits(dapm->component, reg, mask, value);
423}
424
402static void soc_dapm_async_complete(struct snd_soc_dapm_context *dapm) 425static void soc_dapm_async_complete(struct snd_soc_dapm_context *dapm)
403{ 426{
404 if (dapm->component) 427 if (dapm->component)
@@ -454,7 +477,7 @@ static int dapm_connect_mux(struct snd_soc_dapm_context *dapm,
454 int i; 477 int i;
455 478
456 if (e->reg != SND_SOC_NOPM) { 479 if (e->reg != SND_SOC_NOPM) {
457 soc_widget_read(dest, e->reg, &val); 480 soc_dapm_read(dapm, e->reg, &val);
458 val = (val >> e->shift_l) & e->mask; 481 val = (val >> e->shift_l) & e->mask;
459 item = snd_soc_enum_val_to_item(e, val); 482 item = snd_soc_enum_val_to_item(e, val);
460 } else { 483 } else {
@@ -498,7 +521,7 @@ static void dapm_set_mixer_path_status(struct snd_soc_dapm_widget *w,
498 unsigned int val; 521 unsigned int val;
499 522
500 if (reg != SND_SOC_NOPM) { 523 if (reg != SND_SOC_NOPM) {
501 soc_widget_read(w, reg, &val); 524 soc_dapm_read(w->dapm, reg, &val);
502 val = (val >> shift) & mask; 525 val = (val >> shift) & mask;
503 if (invert) 526 if (invert)
504 val = max - val; 527 val = max - val;
@@ -1306,16 +1329,18 @@ static void dapm_seq_check_event(struct snd_soc_card *card,
1306static void dapm_seq_run_coalesced(struct snd_soc_card *card, 1329static void dapm_seq_run_coalesced(struct snd_soc_card *card,
1307 struct list_head *pending) 1330 struct list_head *pending)
1308{ 1331{
1332 struct snd_soc_dapm_context *dapm;
1309 struct snd_soc_dapm_widget *w; 1333 struct snd_soc_dapm_widget *w;
1310 int reg; 1334 int reg;
1311 unsigned int value = 0; 1335 unsigned int value = 0;
1312 unsigned int mask = 0; 1336 unsigned int mask = 0;
1313 1337
1314 reg = list_first_entry(pending, struct snd_soc_dapm_widget, 1338 w = list_first_entry(pending, struct snd_soc_dapm_widget, power_list);
1315 power_list)->reg; 1339 reg = w->reg;
1340 dapm = w->dapm;
1316 1341
1317 list_for_each_entry(w, pending, power_list) { 1342 list_for_each_entry(w, pending, power_list) {
1318 WARN_ON(reg != w->reg); 1343 WARN_ON(reg != w->reg || dapm != w->dapm);
1319 w->power = w->new_power; 1344 w->power = w->new_power;
1320 1345
1321 mask |= w->mask << w->shift; 1346 mask |= w->mask << w->shift;
@@ -1324,7 +1349,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card,
1324 else 1349 else
1325 value |= w->off_val << w->shift; 1350 value |= w->off_val << w->shift;
1326 1351
1327 pop_dbg(w->dapm->dev, card->pop_time, 1352 pop_dbg(dapm->dev, card->pop_time,
1328 "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n", 1353 "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n",
1329 w->name, reg, value, mask); 1354 w->name, reg, value, mask);
1330 1355
@@ -1337,14 +1362,12 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card,
1337 /* Any widget will do, they should all be updating the 1362 /* Any widget will do, they should all be updating the
1338 * same register. 1363 * same register.
1339 */ 1364 */
1340 w = list_first_entry(pending, struct snd_soc_dapm_widget,
1341 power_list);
1342 1365
1343 pop_dbg(w->dapm->dev, card->pop_time, 1366 pop_dbg(dapm->dev, card->pop_time,
1344 "pop test : Applying 0x%x/0x%x to %x in %dms\n", 1367 "pop test : Applying 0x%x/0x%x to %x in %dms\n",
1345 value, mask, reg, card->pop_time); 1368 value, mask, reg, card->pop_time);
1346 pop_wait(card->pop_time); 1369 pop_wait(card->pop_time);
1347 soc_widget_update_bits(w, reg, mask, value); 1370 soc_dapm_update_bits(dapm, reg, mask, value);
1348 } 1371 }
1349 1372
1350 list_for_each_entry(w, pending, power_list) { 1373 list_for_each_entry(w, pending, power_list) {
@@ -1490,7 +1513,8 @@ static void dapm_widget_update(struct snd_soc_card *card)
1490 if (!w) 1513 if (!w)
1491 return; 1514 return;
1492 1515
1493 ret = soc_widget_update_bits(w, update->reg, update->mask, update->val); 1516 ret = soc_dapm_update_bits(w->dapm, update->reg, update->mask,
1517 update->val);
1494 if (ret < 0) 1518 if (ret < 0)
1495 dev_err(w->dapm->dev, "ASoC: %s DAPM update failed: %d\n", 1519 dev_err(w->dapm->dev, "ASoC: %s DAPM update failed: %d\n",
1496 w->name, ret); 1520 w->name, ret);
@@ -2672,7 +2696,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card)
2672 2696
2673 /* Read the initial power state from the device */ 2697 /* Read the initial power state from the device */
2674 if (w->reg >= 0) { 2698 if (w->reg >= 0) {
2675 soc_widget_read(w, w->reg, &val); 2699 soc_dapm_read(w->dapm, w->reg, &val);
2676 val = val >> w->shift; 2700 val = val >> w->shift;
2677 val &= w->mask; 2701 val &= w->mask;
2678 if (val == w->on_val) 2702 if (val == w->on_val)
@@ -2703,8 +2727,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets);
2703int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol, 2727int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
2704 struct snd_ctl_elem_value *ucontrol) 2728 struct snd_ctl_elem_value *ucontrol)
2705{ 2729{
2706 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); 2730 struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
2707 struct snd_soc_card *card = codec->card; 2731 struct snd_soc_card *card = dapm->card;
2708 struct soc_mixer_control *mc = 2732 struct soc_mixer_control *mc =
2709 (struct soc_mixer_control *)kcontrol->private_value; 2733 (struct soc_mixer_control *)kcontrol->private_value;
2710 int reg = mc->reg; 2734 int reg = mc->reg;
@@ -2713,17 +2737,20 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
2713 unsigned int mask = (1 << fls(max)) - 1; 2737 unsigned int mask = (1 << fls(max)) - 1;
2714 unsigned int invert = mc->invert; 2738 unsigned int invert = mc->invert;
2715 unsigned int val; 2739 unsigned int val;
2740 int ret = 0;
2716 2741
2717 if (snd_soc_volsw_is_stereo(mc)) 2742 if (snd_soc_volsw_is_stereo(mc))
2718 dev_warn(codec->dapm.dev, 2743 dev_warn(dapm->dev,
2719 "ASoC: Control '%s' is stereo, which is not supported\n", 2744 "ASoC: Control '%s' is stereo, which is not supported\n",
2720 kcontrol->id.name); 2745 kcontrol->id.name);
2721 2746
2722 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 2747 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
2723 if (dapm_kcontrol_is_powered(kcontrol) && reg != SND_SOC_NOPM) 2748 if (dapm_kcontrol_is_powered(kcontrol) && reg != SND_SOC_NOPM) {
2724 val = (snd_soc_read(codec, reg) >> shift) & mask; 2749 ret = soc_dapm_read(dapm, reg, &val);
2725 else 2750 val = (val >> shift) & mask;
2751 } else {
2726 val = dapm_kcontrol_get_value(kcontrol); 2752 val = dapm_kcontrol_get_value(kcontrol);
2753 }
2727 mutex_unlock(&card->dapm_mutex); 2754 mutex_unlock(&card->dapm_mutex);
2728 2755
2729 if (invert) 2756 if (invert)
@@ -2731,7 +2758,7 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
2731 else 2758 else
2732 ucontrol->value.integer.value[0] = val; 2759 ucontrol->value.integer.value[0] = val;
2733 2760
2734 return 0; 2761 return ret;
2735} 2762}
2736EXPORT_SYMBOL_GPL(snd_soc_dapm_get_volsw); 2763EXPORT_SYMBOL_GPL(snd_soc_dapm_get_volsw);
2737 2764
@@ -2747,8 +2774,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_volsw);
2747int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, 2774int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
2748 struct snd_ctl_elem_value *ucontrol) 2775 struct snd_ctl_elem_value *ucontrol)
2749{ 2776{
2750 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); 2777 struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
2751 struct snd_soc_card *card = codec->card; 2778 struct snd_soc_card *card = dapm->card;
2752 struct soc_mixer_control *mc = 2779 struct soc_mixer_control *mc =
2753 (struct soc_mixer_control *)kcontrol->private_value; 2780 (struct soc_mixer_control *)kcontrol->private_value;
2754 int reg = mc->reg; 2781 int reg = mc->reg;
@@ -2762,7 +2789,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
2762 int ret = 0; 2789 int ret = 0;
2763 2790
2764 if (snd_soc_volsw_is_stereo(mc)) 2791 if (snd_soc_volsw_is_stereo(mc))
2765 dev_warn(codec->dapm.dev, 2792 dev_warn(dapm->dev,
2766 "ASoC: Control '%s' is stereo, which is not supported\n", 2793 "ASoC: Control '%s' is stereo, which is not supported\n",
2767 kcontrol->id.name); 2794 kcontrol->id.name);
2768 2795
@@ -2780,7 +2807,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
2780 mask = mask << shift; 2807 mask = mask << shift;
2781 val = val << shift; 2808 val = val << shift;
2782 2809
2783 reg_change = snd_soc_test_bits(codec, reg, mask, val); 2810 reg_change = soc_dapm_test_bits(dapm, reg, mask, val);
2784 } 2811 }
2785 2812
2786 if (change || reg_change) { 2813 if (change || reg_change) {
@@ -2819,12 +2846,13 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw);
2819int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, 2846int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
2820 struct snd_ctl_elem_value *ucontrol) 2847 struct snd_ctl_elem_value *ucontrol)
2821{ 2848{
2822 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); 2849 struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
2823 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 2850 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
2824 unsigned int reg_val, val; 2851 unsigned int reg_val, val;
2852 int ret = 0;
2825 2853
2826 if (e->reg != SND_SOC_NOPM) 2854 if (e->reg != SND_SOC_NOPM)
2827 reg_val = snd_soc_read(codec, e->reg); 2855 ret = soc_dapm_read(dapm, e->reg, &reg_val);
2828 else 2856 else
2829 reg_val = dapm_kcontrol_get_value(kcontrol); 2857 reg_val = dapm_kcontrol_get_value(kcontrol);
2830 2858
@@ -2836,7 +2864,7 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
2836 ucontrol->value.enumerated.item[1] = val; 2864 ucontrol->value.enumerated.item[1] = val;
2837 } 2865 }
2838 2866
2839 return 0; 2867 return ret;
2840} 2868}
2841EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double); 2869EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double);
2842 2870
@@ -2852,8 +2880,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double);
2852int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, 2880int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
2853 struct snd_ctl_elem_value *ucontrol) 2881 struct snd_ctl_elem_value *ucontrol)
2854{ 2882{
2855 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); 2883 struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
2856 struct snd_soc_card *card = codec->card; 2884 struct snd_soc_card *card = dapm->card;
2857 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 2885 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
2858 unsigned int *item = ucontrol->value.enumerated.item; 2886 unsigned int *item = ucontrol->value.enumerated.item;
2859 unsigned int val, change; 2887 unsigned int val, change;
@@ -2876,7 +2904,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
2876 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 2904 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
2877 2905
2878 if (e->reg != SND_SOC_NOPM) 2906 if (e->reg != SND_SOC_NOPM)
2879 change = snd_soc_test_bits(codec, e->reg, mask, val); 2907 change = soc_dapm_test_bits(dapm, e->reg, mask, val);
2880 else 2908 else
2881 change = dapm_kcontrol_set_value(kcontrol, val); 2909 change = dapm_kcontrol_set_value(kcontrol, val);
2882 2910