static void dapm_assert_locked(struct snd_soc_dapm_context *dapm)
{
if (snd_soc_card_is_instantiated(dapm->card))
- lockdep_assert_held(&dapm->card->dapm_mutex);
+ snd_soc_dapm_mutex_assert_held(dapm);
}
static void pop_wait(u32 pop_time)
{
struct snd_soc_dapm_widget *w;
- mutex_lock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_lock_root(card);
for_each_card_widgets(card, w) {
if (w->is_ep) {
}
}
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(card);
}
EXPORT_SYMBOL_GPL(dapm_mark_endpoints_dirty);
{
struct snd_soc_dapm_widget *w;
- lockdep_assert_held(&card->dapm_mutex);
+ snd_soc_dapm_mutex_assert_held(card);
memset(&card->dapm_stats, 0, sizeof(card->dapm_stats));
int paths;
int ret;
- mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(card);
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
invalidate_paths_ep(w, SND_SOC_DAPM_DIR_OUT);
paths = ret;
trace_snd_soc_dapm_connected(paths, stream);
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(card);
return paths;
}
enum snd_soc_bias_level bias;
int ret;
- lockdep_assert_held(&card->dapm_mutex);
+ snd_soc_dapm_mutex_assert_held(card);
trace_snd_soc_dapm_start(card);
size_t count, loff_t *ppos)
{
struct snd_soc_dapm_widget *w = file->private_data;
- struct snd_soc_card *card = w->dapm->card;
enum snd_soc_dapm_direction dir, rdir;
char *buf;
int in, out;
if (!buf)
return -ENOMEM;
- mutex_lock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_lock_root(w->dapm);
/* Supply widgets are not handled by is_connected_{input,output}_ep() */
if (w->is_supply) {
}
}
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(w->dapm);
ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
int found = 0;
bool connect;
- lockdep_assert_held(&card->dapm_mutex);
+ snd_soc_dapm_mutex_assert_held(card);
/* find dapm widget path assoc with kcontrol */
dapm_kcontrol_for_each_path(path, kcontrol) {
struct snd_soc_card *card = dapm->card;
int ret;
- mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(card);
card->update = update;
ret = soc_dapm_mux_update_power(card, kcontrol, mux, e);
card->update = NULL;
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(card);
if (ret > 0)
snd_soc_dpcm_runtime_update(card);
return ret;
struct snd_soc_dapm_path *path;
int found = 0;
- lockdep_assert_held(&card->dapm_mutex);
+ snd_soc_dapm_mutex_assert_held(card);
/* find dapm widget path assoc with kcontrol */
dapm_kcontrol_for_each_path(path, kcontrol) {
struct snd_soc_card *card = dapm->card;
int ret;
- mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(card);
card->update = update;
ret = soc_dapm_mixer_update_power(card, kcontrol, connect, -1);
card->update = NULL;
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(card);
if (ret > 0)
snd_soc_dpcm_runtime_update(card);
return ret;
struct snd_soc_dai *codec_dai;
int i, count = 0;
- mutex_lock(&rtd->card->dapm_mutex);
+ snd_soc_dapm_mutex_lock_root(rtd->card);
for_each_rtd_codec_dais(rtd, i, codec_dai) {
struct snd_soc_component *cmpnt = codec_dai->component;
count = dapm_widget_show_component(cmpnt, buf, count);
}
- mutex_unlock(&rtd->card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(rtd->card);
return count;
}
{
int ret;
- mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(dapm);
ret = snd_soc_dapm_sync_unlocked(dapm);
- mutex_unlock(&dapm->card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(dapm);
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_sync);
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
int ret;
- mutex_lock_nested(&rtd->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(rtd->card);
ret = dapm_update_dai_unlocked(substream, params, dai);
- mutex_unlock(&rtd->card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(rtd->card);
return ret;
}
{
int i, ret = 0;
- mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(dapm);
for (i = 0; i < num; i++) {
int r = snd_soc_dapm_add_route(dapm, route);
if (r < 0)
ret = r;
route++;
}
- mutex_unlock(&dapm->card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(dapm);
return ret;
}
{
int i;
- mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(dapm);
for (i = 0; i < num; i++) {
snd_soc_dapm_del_route(dapm, route);
route++;
}
- mutex_unlock(&dapm->card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(dapm);
return 0;
}
int i;
int ret = 0;
- mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
+ snd_soc_dapm_mutex_lock_root(dapm);
for (i = 0; i < num; i++) {
int err = snd_soc_dapm_weak_route(dapm, route);
if (err)
ret = err;
route++;
}
- mutex_unlock(&dapm->card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(dapm);
return ret;
}
struct snd_soc_dapm_widget *w;
unsigned int val;
- mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
+ snd_soc_dapm_mutex_lock_root(card);
for_each_card_widgets(card, w)
{
sizeof(struct snd_kcontrol *),
GFP_KERNEL);
if (!w->kcontrols) {
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(card);
return -ENOMEM;
}
}
}
dapm_power_widgets(card, SND_SOC_DAPM_STREAM_NOP);
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(card);
return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets);
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
- struct snd_soc_card *card = dapm->card;
struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value;
int reg = mc->reg;
unsigned int invert = mc->invert;
unsigned int reg_val, val, rval = 0;
- mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(dapm);
if (dapm_kcontrol_is_powered(kcontrol) && reg != SND_SOC_NOPM) {
reg_val = soc_dapm_read(dapm, reg);
val = (reg_val >> shift) & mask;
if (snd_soc_volsw_is_stereo(mc))
rval = (reg_val >> width) & mask;
}
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(dapm);
if (invert)
ucontrol->value.integer.value[0] = max - val;
rval = max - rval;
}
- mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(card);
/* This assumes field width < (bits in unsigned int / 2) */
if (width > sizeof(unsigned int) * 8 / 2)
card->update = NULL;
}
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(card);
if (ret > 0)
snd_soc_dpcm_runtime_update(card);
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
- struct snd_soc_card *card = dapm->card;
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int reg_val, val;
- mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(dapm);
if (e->reg != SND_SOC_NOPM && dapm_kcontrol_is_powered(kcontrol)) {
reg_val = soc_dapm_read(dapm, e->reg);
} else {
reg_val = dapm_kcontrol_get_value(kcontrol);
}
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(dapm);
val = (reg_val >> e->shift_l) & e->mask;
ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(e, val);
mask |= e->mask << e->shift_r;
}
- mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(card);
change = dapm_kcontrol_set_value(kcontrol, val);
card->update = NULL;
}
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(card);
if (ret > 0)
snd_soc_dpcm_runtime_update(card);
struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
const char *pin = (const char *)kcontrol->private_value;
- mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(card);
ucontrol->value.integer.value[0] =
snd_soc_dapm_get_pin_status(&card->dapm, pin);
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(card);
return 0;
}
const char *pin = (const char *)kcontrol->private_value;
int ret;
- mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(card);
ret = __snd_soc_dapm_set_pin(&card->dapm, pin,
!!ucontrol->value.integer.value[0]);
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(card);
snd_soc_dapm_sync(&card->dapm);
return ret;
{
struct snd_soc_dapm_widget *w;
- mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(dapm);
w = snd_soc_dapm_new_control_unlocked(dapm, widget);
- mutex_unlock(&dapm->card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(dapm);
return w;
}
int i;
int ret = 0;
- mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
+ snd_soc_dapm_mutex_lock_root(dapm);
for (i = 0; i < num; i++) {
struct snd_soc_dapm_widget *w = snd_soc_dapm_new_control_unlocked(dapm, widget);
if (IS_ERR(w)) {
}
widget++;
}
- mutex_unlock(&dapm->card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(dapm);
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_new_controls);
{
struct snd_soc_card *card = rtd->card;
- mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(card);
soc_dapm_stream_event(rtd, stream, event);
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(card);
}
void snd_soc_dapm_stream_stop(struct snd_soc_pcm_runtime *rtd, int stream)
{
int ret;
- mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(dapm);
ret = snd_soc_dapm_set_pin(dapm, pin, 1);
- mutex_unlock(&dapm->card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(dapm);
return ret;
}
{
int ret;
- mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(dapm);
ret = snd_soc_dapm_force_enable_pin_unlocked(dapm, pin);
- mutex_unlock(&dapm->card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(dapm);
return ret;
}
{
int ret;
- mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(dapm);
ret = snd_soc_dapm_set_pin(dapm, pin, 0);
- mutex_unlock(&dapm->card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(dapm);
return ret;
}
{
int ret;
- mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+ snd_soc_dapm_mutex_lock(dapm);
ret = snd_soc_dapm_set_pin(dapm, pin, 0);
- mutex_unlock(&dapm->card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(dapm);
return ret;
}
LIST_HEAD(down_list);
int powerdown = 0;
- mutex_lock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_lock_root(card);
for_each_card_widgets(dapm->card, w) {
if (w->dapm != dapm)
SND_SOC_BIAS_STANDBY);
}
- mutex_unlock(&card->dapm_mutex);
+ snd_soc_dapm_mutex_unlock(card);
}
/*