Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170203
b: refs/heads/master
c: 6c508c6
h: refs/heads/master
i:
  170201: f78479b
  170199: 379b9b2
v: v3
  • Loading branch information
Eero Nurkkala authored and Mark Brown committed Oct 30, 2009
1 parent 816ae5f commit 8322bce
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8538a119bfb9031c402a33fc65c276ab9bfafdd5
refs/heads/master: 6c508c62f90240ef58300a5e12093ee769a44364
36 changes: 30 additions & 6 deletions trunk/sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,30 @@ int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
}
EXPORT_SYMBOL_GPL(snd_soc_update_bits);

/**
* snd_soc_update_bits_locked - update codec register bits
* @codec: audio codec
* @reg: codec register
* @mask: register mask
* @value: new value
*
* Writes new register value, and takes the codec mutex.
*
* Returns 1 for change else 0.
*/
static int snd_soc_update_bits_locked(struct snd_soc_codec *codec,
unsigned short reg, unsigned int mask,
unsigned int value)
{
int change;

mutex_lock(&codec->mutex);
change = snd_soc_update_bits(codec, reg, mask, value);
mutex_unlock(&codec->mutex);

return change;
}

/**
* snd_soc_test_bits - test register for change
* @codec: audio codec
Expand Down Expand Up @@ -1706,7 +1730,7 @@ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
mask |= (bitmask - 1) << e->shift_r;
}

return snd_soc_update_bits(codec, e->reg, mask, val);
return snd_soc_update_bits_locked(codec, e->reg, mask, val);
}
EXPORT_SYMBOL_GPL(snd_soc_put_enum_double);

Expand Down Expand Up @@ -1780,7 +1804,7 @@ int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
mask |= e->mask << e->shift_r;
}

return snd_soc_update_bits(codec, e->reg, mask, val);
return snd_soc_update_bits_locked(codec, e->reg, mask, val);
}
EXPORT_SYMBOL_GPL(snd_soc_put_value_enum_double);

Expand Down Expand Up @@ -1941,7 +1965,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
val_mask |= mask << rshift;
val |= val2 << rshift;
}
return snd_soc_update_bits(codec, reg, val_mask, val);
return snd_soc_update_bits_locked(codec, reg, val_mask, val);
}
EXPORT_SYMBOL_GPL(snd_soc_put_volsw);

Expand Down Expand Up @@ -2047,11 +2071,11 @@ int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol,
val = val << shift;
val2 = val2 << shift;

err = snd_soc_update_bits(codec, reg, val_mask, val);
err = snd_soc_update_bits_locked(codec, reg, val_mask, val);
if (err < 0)
return err;

err = snd_soc_update_bits(codec, reg2, val_mask, val2);
err = snd_soc_update_bits_locked(codec, reg2, val_mask, val2);
return err;
}
EXPORT_SYMBOL_GPL(snd_soc_put_volsw_2r);
Expand Down Expand Up @@ -2130,7 +2154,7 @@ int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
val = (ucontrol->value.integer.value[0]+min) & 0xff;
val |= ((ucontrol->value.integer.value[1]+min) & 0xff) << 8;

return snd_soc_update_bits(codec, reg, 0xffff, val);
return snd_soc_update_bits_locked(codec, reg, 0xffff, val);
}
EXPORT_SYMBOL_GPL(snd_soc_put_volsw_s8);

Expand Down

0 comments on commit 8322bce

Please sign in to comment.