提交 ce0fc93a 编写于 作者: L Lars-Peter Clausen 提交者: Mark Brown

ASoC: Add DAPM support at the component level

This patch adds full DAPM support at the component level. Previously there was
only full DAPM support for CODECs and partial DAPM support (e.g. no Mixers nor
MUXs) for platforms. Having DAPM support at the component level will allow all
types of components to use DAPM and also help in consolidating the DAPM support
between CODECs and platforms.

Since the DAPM context is directly embedded into the snd_soc_codec and
snd_soc_platform struct and the 'dapm' field is directly referenced in a lot of
drivers moving the field just right now is not possible without causing code
churn. The approach this patch takes is to add two new fields to the component
struct. One field which is the pointer to the actual DAPM context used by the
component and one DAPM context that will be used as the default if no other
context was specified. For CODECs and platforms the pointer is initialized to
point to the CODEC or platform DAPM context. All generic code when referencing
a component's DAPM struct will go via the pointer. This will make it possible to
eventually seamlessly move the DAPM context from snd_soc_codec and
snd_soc_platform struct over once all direct references have been eliminated.
Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NMark Brown <broonie@linaro.org>
上级 68f831c2
...@@ -441,6 +441,8 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, ...@@ -441,6 +441,8 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
struct snd_soc_dapm_widget_list **list); struct snd_soc_dapm_widget_list **list);
struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol); struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol);
struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(
struct snd_kcontrol *kcontrol);
/* dapm widget types */ /* dapm widget types */
enum snd_soc_dapm_type { enum snd_soc_dapm_type {
......
...@@ -706,6 +706,10 @@ struct snd_soc_component { ...@@ -706,6 +706,10 @@ struct snd_soc_component {
int val_bytes; int val_bytes;
struct mutex io_mutex; struct mutex io_mutex;
/* Don't use these, use snd_soc_component_get_dapm() */
struct snd_soc_dapm_context dapm;
struct snd_soc_dapm_context *dapm_ptr;
}; };
/* SoC Audio Codec device */ /* SoC Audio Codec device */
...@@ -1160,6 +1164,21 @@ static inline struct snd_soc_platform *snd_soc_component_to_platform( ...@@ -1160,6 +1164,21 @@ static inline struct snd_soc_platform *snd_soc_component_to_platform(
return container_of(component, struct snd_soc_platform, component); return container_of(component, struct snd_soc_platform, component);
} }
/**
* snd_soc_dapm_to_component() - Casts a DAPM context to the component it is
* embedded in
* @dapm: The DAPM context to cast to the component
*
* This function must only be used on DAPM contexts that are known to be part of
* a component (e.g. in a component driver). Otherwise the behavior is
* undefined.
*/
static inline struct snd_soc_component *snd_soc_dapm_to_component(
struct snd_soc_dapm_context *dapm)
{
return container_of(dapm, struct snd_soc_component, dapm);
}
/** /**
* snd_soc_dapm_to_codec() - Casts a DAPM context to the CODEC it is embedded in * snd_soc_dapm_to_codec() - Casts a DAPM context to the CODEC it is embedded in
* @dapm: The DAPM context to cast to the CODEC * @dapm: The DAPM context to cast to the CODEC
...@@ -1187,6 +1206,17 @@ static inline struct snd_soc_platform *snd_soc_dapm_to_platform( ...@@ -1187,6 +1206,17 @@ static inline struct snd_soc_platform *snd_soc_dapm_to_platform(
return container_of(dapm, struct snd_soc_platform, dapm); return container_of(dapm, struct snd_soc_platform, dapm);
} }
/**
* snd_soc_component_get_dapm() - Returns the DAPM context associated with a
* component
* @component: The component for which to get the DAPM context
*/
static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
struct snd_soc_component *component)
{
return component->dapm_ptr;
}
/* codec IO */ /* codec IO */
unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg, int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
......
...@@ -3997,6 +3997,8 @@ static int snd_soc_register_dais(struct snd_soc_component *component, ...@@ -3997,6 +3997,8 @@ static int snd_soc_register_dais(struct snd_soc_component *component,
static int snd_soc_component_initialize(struct snd_soc_component *component, static int snd_soc_component_initialize(struct snd_soc_component *component,
const struct snd_soc_component_driver *driver, struct device *dev) const struct snd_soc_component_driver *driver, struct device *dev)
{ {
struct snd_soc_dapm_context *dapm;
component->name = fmt_single_name(dev, &component->id); component->name = fmt_single_name(dev, &component->id);
if (!component->name) { if (!component->name) {
dev_err(dev, "ASoC: Failed to allocate name\n"); 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,6 +4008,14 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
component->dev = dev; component->dev = dev;
component->driver = driver; component->driver = driver;
if (!component->dapm_ptr)
component->dapm_ptr = &component->dapm;
dapm = component->dapm_ptr;
dapm->dev = dev;
dapm->component = component;
dapm->bias_level = SND_SOC_BIAS_OFF;
INIT_LIST_HEAD(&component->dai_list); INIT_LIST_HEAD(&component->dai_list);
mutex_init(&component->io_mutex); mutex_init(&component->io_mutex);
...@@ -4131,6 +4141,8 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, ...@@ -4131,6 +4141,8 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
{ {
int ret; int ret;
platform->component.dapm_ptr = &platform->dapm;
ret = snd_soc_component_initialize(&platform->component, ret = snd_soc_component_initialize(&platform->component,
&platform_drv->component_driver, dev); &platform_drv->component_driver, dev);
if (ret) if (ret)
...@@ -4138,9 +4150,7 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, ...@@ -4138,9 +4150,7 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
platform->dev = dev; platform->dev = dev;
platform->driver = platform_drv; platform->driver = platform_drv;
platform->dapm.dev = dev;
platform->dapm.platform = platform; platform->dapm.platform = platform;
platform->dapm.component = &platform->component;
platform->dapm.stream_event = platform_drv->stream_event; platform->dapm.stream_event = platform_drv->stream_event;
if (platform_drv->write) if (platform_drv->write)
platform->component.write = snd_soc_platform_drv_write; platform->component.write = snd_soc_platform_drv_write;
...@@ -4314,6 +4324,8 @@ int snd_soc_register_codec(struct device *dev, ...@@ -4314,6 +4324,8 @@ int snd_soc_register_codec(struct device *dev,
if (codec == NULL) if (codec == NULL)
return -ENOMEM; return -ENOMEM;
codec->component.dapm_ptr = &codec->dapm;
ret = snd_soc_component_initialize(&codec->component, ret = snd_soc_component_initialize(&codec->component,
&codec_drv->component_driver, dev); &codec_drv->component_driver, dev);
if (ret) if (ret)
...@@ -4324,10 +4336,7 @@ int snd_soc_register_codec(struct device *dev, ...@@ -4324,10 +4336,7 @@ int snd_soc_register_codec(struct device *dev,
if (codec_drv->read) if (codec_drv->read)
codec->component.read = snd_soc_codec_drv_read; codec->component.read = snd_soc_codec_drv_read;
codec->component.ignore_pmdown_time = codec_drv->ignore_pmdown_time; codec->component.ignore_pmdown_time = codec_drv->ignore_pmdown_time;
codec->dapm.bias_level = SND_SOC_BIAS_OFF;
codec->dapm.dev = dev;
codec->dapm.codec = codec; codec->dapm.codec = codec;
codec->dapm.component = &codec->component;
codec->dapm.seq_notifier = codec_drv->seq_notifier; codec->dapm.seq_notifier = codec_drv->seq_notifier;
codec->dapm.stream_event = codec_drv->stream_event; codec->dapm.stream_event = codec_drv->stream_event;
if (codec_drv->set_bias_level) if (codec_drv->set_bias_level)
......
...@@ -349,13 +349,28 @@ static bool dapm_kcontrol_set_value(const struct snd_kcontrol *kcontrol, ...@@ -349,13 +349,28 @@ static bool dapm_kcontrol_set_value(const struct snd_kcontrol *kcontrol,
return true; return true;
} }
/**
* snd_soc_dapm_kcontrol_dapm() - Returns the dapm context associated to a
* kcontrol
* @kcontrol: The kcontrol
*
* Note: This function must only be used on kcontrols that are known to have
* been registered for a CODEC. Otherwise the behaviour is undefined.
*/
struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(
struct snd_kcontrol *kcontrol)
{
return dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->dapm;
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_dapm);
/** /**
* snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol
* @kcontrol: The kcontrol * @kcontrol: The kcontrol
*/ */
struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol) struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol)
{ {
return dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->codec; return snd_soc_dapm_to_codec(snd_soc_dapm_kcontrol_dapm(kcontrol));
} }
EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_codec); EXPORT_SYMBOL_GPL(snd_soc_dapm_kcontrol_codec);
...@@ -382,23 +397,31 @@ static const char *soc_dapm_prefix(struct snd_soc_dapm_context *dapm) ...@@ -382,23 +397,31 @@ static const char *soc_dapm_prefix(struct snd_soc_dapm_context *dapm)
return dapm->component->name_prefix; return dapm->component->name_prefix;
} }
static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg, static int soc_dapm_read(struct snd_soc_dapm_context *dapm, int reg,
unsigned int *value) unsigned int *value)
{ {
if (!w->dapm->component) if (!dapm->component)
return -EIO; return -EIO;
return snd_soc_component_read(w->dapm->component, reg, value); return snd_soc_component_read(dapm->component, reg, value);
} }
static int soc_widget_update_bits(struct snd_soc_dapm_widget *w, static int soc_dapm_update_bits(struct snd_soc_dapm_context *dapm,
int reg, unsigned int mask, unsigned int value) int reg, unsigned int mask, unsigned int value)
{ {
if (!w->dapm->component) if (!dapm->component)
return -EIO; return -EIO;
return snd_soc_component_update_bits_async(w->dapm->component, reg, return snd_soc_component_update_bits_async(dapm->component, reg,
mask, value); mask, value);
} }
static int soc_dapm_test_bits(struct snd_soc_dapm_context *dapm,
int reg, unsigned int mask, unsigned int value)
{
if (!dapm->component)
return -EIO;
return snd_soc_component_test_bits(dapm->component, reg, mask, value);
}
static void soc_dapm_async_complete(struct snd_soc_dapm_context *dapm) static void soc_dapm_async_complete(struct snd_soc_dapm_context *dapm)
{ {
if (dapm->component) if (dapm->component)
...@@ -454,7 +477,7 @@ static int dapm_connect_mux(struct snd_soc_dapm_context *dapm, ...@@ -454,7 +477,7 @@ static int dapm_connect_mux(struct snd_soc_dapm_context *dapm,
int i; int i;
if (e->reg != SND_SOC_NOPM) { if (e->reg != SND_SOC_NOPM) {
soc_widget_read(dest, e->reg, &val); soc_dapm_read(dapm, e->reg, &val);
val = (val >> e->shift_l) & e->mask; val = (val >> e->shift_l) & e->mask;
item = snd_soc_enum_val_to_item(e, val); item = snd_soc_enum_val_to_item(e, val);
} else { } else {
...@@ -498,7 +521,7 @@ static void dapm_set_mixer_path_status(struct snd_soc_dapm_widget *w, ...@@ -498,7 +521,7 @@ static void dapm_set_mixer_path_status(struct snd_soc_dapm_widget *w,
unsigned int val; unsigned int val;
if (reg != SND_SOC_NOPM) { if (reg != SND_SOC_NOPM) {
soc_widget_read(w, reg, &val); soc_dapm_read(w->dapm, reg, &val);
val = (val >> shift) & mask; val = (val >> shift) & mask;
if (invert) if (invert)
val = max - val; val = max - val;
...@@ -1306,16 +1329,18 @@ static void dapm_seq_check_event(struct snd_soc_card *card, ...@@ -1306,16 +1329,18 @@ static void dapm_seq_check_event(struct snd_soc_card *card,
static void dapm_seq_run_coalesced(struct snd_soc_card *card, static void dapm_seq_run_coalesced(struct snd_soc_card *card,
struct list_head *pending) struct list_head *pending)
{ {
struct snd_soc_dapm_context *dapm;
struct snd_soc_dapm_widget *w; struct snd_soc_dapm_widget *w;
int reg; int reg;
unsigned int value = 0; unsigned int value = 0;
unsigned int mask = 0; unsigned int mask = 0;
reg = list_first_entry(pending, struct snd_soc_dapm_widget, w = list_first_entry(pending, struct snd_soc_dapm_widget, power_list);
power_list)->reg; reg = w->reg;
dapm = w->dapm;
list_for_each_entry(w, pending, power_list) { list_for_each_entry(w, pending, power_list) {
WARN_ON(reg != w->reg); WARN_ON(reg != w->reg || dapm != w->dapm);
w->power = w->new_power; w->power = w->new_power;
mask |= w->mask << w->shift; mask |= w->mask << w->shift;
...@@ -1324,7 +1349,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card, ...@@ -1324,7 +1349,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card,
else else
value |= w->off_val << w->shift; value |= w->off_val << w->shift;
pop_dbg(w->dapm->dev, card->pop_time, pop_dbg(dapm->dev, card->pop_time,
"pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n", "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n",
w->name, reg, value, mask); w->name, reg, value, mask);
...@@ -1337,14 +1362,12 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card, ...@@ -1337,14 +1362,12 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card,
/* Any widget will do, they should all be updating the /* Any widget will do, they should all be updating the
* same register. * same register.
*/ */
w = list_first_entry(pending, struct snd_soc_dapm_widget,
power_list);
pop_dbg(w->dapm->dev, card->pop_time, pop_dbg(dapm->dev, card->pop_time,
"pop test : Applying 0x%x/0x%x to %x in %dms\n", "pop test : Applying 0x%x/0x%x to %x in %dms\n",
value, mask, reg, card->pop_time); value, mask, reg, card->pop_time);
pop_wait(card->pop_time); pop_wait(card->pop_time);
soc_widget_update_bits(w, reg, mask, value); soc_dapm_update_bits(dapm, reg, mask, value);
} }
list_for_each_entry(w, pending, power_list) { list_for_each_entry(w, pending, power_list) {
...@@ -1490,7 +1513,8 @@ static void dapm_widget_update(struct snd_soc_card *card) ...@@ -1490,7 +1513,8 @@ static void dapm_widget_update(struct snd_soc_card *card)
if (!w) if (!w)
return; return;
ret = soc_widget_update_bits(w, update->reg, update->mask, update->val); ret = soc_dapm_update_bits(w->dapm, update->reg, update->mask,
update->val);
if (ret < 0) if (ret < 0)
dev_err(w->dapm->dev, "ASoC: %s DAPM update failed: %d\n", dev_err(w->dapm->dev, "ASoC: %s DAPM update failed: %d\n",
w->name, ret); w->name, ret);
...@@ -2672,7 +2696,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card) ...@@ -2672,7 +2696,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card)
/* Read the initial power state from the device */ /* Read the initial power state from the device */
if (w->reg >= 0) { if (w->reg >= 0) {
soc_widget_read(w, w->reg, &val); soc_dapm_read(w->dapm, w->reg, &val);
val = val >> w->shift; val = val >> w->shift;
val &= w->mask; val &= w->mask;
if (val == w->on_val) if (val == w->on_val)
...@@ -2703,8 +2727,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets); ...@@ -2703,8 +2727,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets);
int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol, int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
struct snd_soc_card *card = codec->card; struct snd_soc_card *card = dapm->card;
struct soc_mixer_control *mc = struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value; (struct soc_mixer_control *)kcontrol->private_value;
int reg = mc->reg; int reg = mc->reg;
...@@ -2713,17 +2737,20 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol, ...@@ -2713,17 +2737,20 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
unsigned int mask = (1 << fls(max)) - 1; unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = mc->invert; unsigned int invert = mc->invert;
unsigned int val; unsigned int val;
int ret = 0;
if (snd_soc_volsw_is_stereo(mc)) if (snd_soc_volsw_is_stereo(mc))
dev_warn(codec->dapm.dev, dev_warn(dapm->dev,
"ASoC: Control '%s' is stereo, which is not supported\n", "ASoC: Control '%s' is stereo, which is not supported\n",
kcontrol->id.name); kcontrol->id.name);
mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
if (dapm_kcontrol_is_powered(kcontrol) && reg != SND_SOC_NOPM) if (dapm_kcontrol_is_powered(kcontrol) && reg != SND_SOC_NOPM) {
val = (snd_soc_read(codec, reg) >> shift) & mask; ret = soc_dapm_read(dapm, reg, &val);
else val = (val >> shift) & mask;
} else {
val = dapm_kcontrol_get_value(kcontrol); val = dapm_kcontrol_get_value(kcontrol);
}
mutex_unlock(&card->dapm_mutex); mutex_unlock(&card->dapm_mutex);
if (invert) if (invert)
...@@ -2731,7 +2758,7 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol, ...@@ -2731,7 +2758,7 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
else else
ucontrol->value.integer.value[0] = val; ucontrol->value.integer.value[0] = val;
return 0; return ret;
} }
EXPORT_SYMBOL_GPL(snd_soc_dapm_get_volsw); EXPORT_SYMBOL_GPL(snd_soc_dapm_get_volsw);
...@@ -2747,8 +2774,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_volsw); ...@@ -2747,8 +2774,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_volsw);
int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
struct snd_soc_card *card = codec->card; struct snd_soc_card *card = dapm->card;
struct soc_mixer_control *mc = struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value; (struct soc_mixer_control *)kcontrol->private_value;
int reg = mc->reg; int reg = mc->reg;
...@@ -2762,7 +2789,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, ...@@ -2762,7 +2789,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
int ret = 0; int ret = 0;
if (snd_soc_volsw_is_stereo(mc)) if (snd_soc_volsw_is_stereo(mc))
dev_warn(codec->dapm.dev, dev_warn(dapm->dev,
"ASoC: Control '%s' is stereo, which is not supported\n", "ASoC: Control '%s' is stereo, which is not supported\n",
kcontrol->id.name); kcontrol->id.name);
...@@ -2780,7 +2807,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, ...@@ -2780,7 +2807,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
mask = mask << shift; mask = mask << shift;
val = val << shift; val = val << shift;
reg_change = snd_soc_test_bits(codec, reg, mask, val); reg_change = soc_dapm_test_bits(dapm, reg, mask, val);
} }
if (change || reg_change) { if (change || reg_change) {
...@@ -2819,12 +2846,13 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw); ...@@ -2819,12 +2846,13 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw);
int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int reg_val, val; unsigned int reg_val, val;
int ret = 0;
if (e->reg != SND_SOC_NOPM) if (e->reg != SND_SOC_NOPM)
reg_val = snd_soc_read(codec, e->reg); ret = soc_dapm_read(dapm, e->reg, &reg_val);
else else
reg_val = dapm_kcontrol_get_value(kcontrol); reg_val = dapm_kcontrol_get_value(kcontrol);
...@@ -2836,7 +2864,7 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, ...@@ -2836,7 +2864,7 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
ucontrol->value.enumerated.item[1] = val; ucontrol->value.enumerated.item[1] = val;
} }
return 0; return ret;
} }
EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double); EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double);
...@@ -2852,8 +2880,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double); ...@@ -2852,8 +2880,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double);
int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
struct snd_soc_card *card = codec->card; struct snd_soc_card *card = dapm->card;
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int *item = ucontrol->value.enumerated.item; unsigned int *item = ucontrol->value.enumerated.item;
unsigned int val, change; unsigned int val, change;
...@@ -2876,7 +2904,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, ...@@ -2876,7 +2904,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
if (e->reg != SND_SOC_NOPM) if (e->reg != SND_SOC_NOPM)
change = snd_soc_test_bits(codec, e->reg, mask, val); change = soc_dapm_test_bits(dapm, e->reg, mask, val);
else else
change = dapm_kcontrol_set_value(kcontrol, val); change = dapm_kcontrol_set_value(kcontrol, val);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册