ALSA: ASoC: Convert bitfields in ASoC into full int width
Convert bitfields in ASoC into full int width. This is a simple mechanical conversion. Two places in the DAPM code were fixed to properly use mask. Signed-off-by: Jon Smirl <jonsmirl@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
58cd33c0f3
commit
4eaa9819dc
3 changed files with 114 additions and 74 deletions
|
@ -26,10 +26,12 @@
|
||||||
/*
|
/*
|
||||||
* Convenience kcontrol builders
|
* Convenience kcontrol builders
|
||||||
*/
|
*/
|
||||||
#define SOC_SINGLE_VALUE(reg, shift, max, invert) ((reg) | ((shift) << 8) |\
|
#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
|
||||||
((shift) << 12) | ((max) << 16) | ((invert) << 24))
|
((unsigned long)&(struct soc_mixer_control) \
|
||||||
#define SOC_SINGLE_VALUE_EXT(reg, max, invert) ((reg) | ((max) << 16) |\
|
{.reg = xreg, .shift = xshift, .max = xmax, .invert = xinvert})
|
||||||
((invert) << 31))
|
#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
|
||||||
|
((unsigned long)&(struct soc_mixer_control) \
|
||||||
|
{.reg = xreg, .max = xmax, .invert = xinvert})
|
||||||
#define SOC_SINGLE(xname, reg, shift, max, invert) \
|
#define SOC_SINGLE(xname, reg, shift, max, invert) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||||
.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
|
.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
|
||||||
|
@ -43,45 +45,49 @@
|
||||||
.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
|
.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
|
||||||
.put = snd_soc_put_volsw, \
|
.put = snd_soc_put_volsw, \
|
||||||
.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
|
.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
|
||||||
#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
|
#define SOC_DOUBLE(xname, xreg, shift_left, shift_right, xmax, xinvert) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
|
||||||
.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
|
.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
|
||||||
.put = snd_soc_put_volsw, \
|
.put = snd_soc_put_volsw, \
|
||||||
.private_value = (reg) | ((shift_left) << 8) | \
|
.private_value = (unsigned long)&(struct soc_mixer_control) \
|
||||||
((shift_right) << 12) | ((max) << 16) | ((invert) << 24) }
|
{.reg = xreg, .shift = shift_left, .rshift = shift_right, \
|
||||||
#define SOC_DOUBLE_R(xname, reg_left, reg_right, shift, max, invert) \
|
.max = xmax, .invert = xinvert} }
|
||||||
|
#define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
|
||||||
.info = snd_soc_info_volsw_2r, \
|
.info = snd_soc_info_volsw_2r, \
|
||||||
.get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
|
.get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
|
||||||
.private_value = (reg_left) | ((shift) << 8) | \
|
.private_value = (unsigned long)&(struct soc_mixer_control) \
|
||||||
((max) << 12) | ((invert) << 20) | ((reg_right) << 24) }
|
{.reg = reg_left, .rreg = reg_right, .shift = xshift, \
|
||||||
#define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \
|
.max = xmax, .invert = xinvert} }
|
||||||
|
#define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
|
||||||
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
|
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
|
||||||
SNDRV_CTL_ELEM_ACCESS_READWRITE,\
|
SNDRV_CTL_ELEM_ACCESS_READWRITE,\
|
||||||
.tlv.p = (tlv_array), \
|
.tlv.p = (tlv_array), \
|
||||||
.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
|
.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
|
||||||
.put = snd_soc_put_volsw, \
|
.put = snd_soc_put_volsw, \
|
||||||
.private_value = (reg) | ((shift_left) << 8) | \
|
.private_value = (unsigned long)&(struct soc_mixer_control) \
|
||||||
((shift_right) << 12) | ((max) << 16) | ((invert) << 24) }
|
{.reg = xreg, .shift = shift_left, .rshift = shift_right,\
|
||||||
#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, shift, max, invert, tlv_array) \
|
.max = xmax, .invert = xinvert} }
|
||||||
|
#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
|
||||||
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
|
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
|
||||||
SNDRV_CTL_ELEM_ACCESS_READWRITE,\
|
SNDRV_CTL_ELEM_ACCESS_READWRITE,\
|
||||||
.tlv.p = (tlv_array), \
|
.tlv.p = (tlv_array), \
|
||||||
.info = snd_soc_info_volsw_2r, \
|
.info = snd_soc_info_volsw_2r, \
|
||||||
.get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
|
.get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
|
||||||
.private_value = (reg_left) | ((shift) << 8) | \
|
.private_value = (unsigned long)&(struct soc_mixer_control) \
|
||||||
((max) << 12) | ((invert) << 20) | ((reg_right) << 24) }
|
{.reg = reg_left, .rreg = reg_right, .shift = xshift, \
|
||||||
#define SOC_DOUBLE_S8_TLV(xname, reg, min, max, tlv_array) \
|
.max = xmax, .invert = xinvert} }
|
||||||
|
#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
|
||||||
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
|
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
|
||||||
SNDRV_CTL_ELEM_ACCESS_READWRITE, \
|
SNDRV_CTL_ELEM_ACCESS_READWRITE, \
|
||||||
.tlv.p = (tlv_array), \
|
.tlv.p = (tlv_array), \
|
||||||
.info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \
|
.info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \
|
||||||
.put = snd_soc_put_volsw_s8, \
|
.put = snd_soc_put_volsw_s8, \
|
||||||
.private_value = (reg) | (((signed char)max) << 16) | \
|
.private_value = (unsigned long)&(struct soc_mixer_control) \
|
||||||
(((signed char)min) << 24) }
|
{.reg = xreg, .min = xmin, .max = xmax} }
|
||||||
#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \
|
#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \
|
||||||
{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
|
{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
|
||||||
.mask = xmask, .texts = xtexts }
|
.mask = xmask, .texts = xtexts }
|
||||||
|
@ -518,6 +524,12 @@ struct snd_soc_pcm_runtime {
|
||||||
struct snd_soc_device *socdev;
|
struct snd_soc_device *socdev;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* mixer control */
|
||||||
|
struct soc_mixer_control {
|
||||||
|
int min, max;
|
||||||
|
uint reg, rreg, shift, rshift, invert;
|
||||||
|
};
|
||||||
|
|
||||||
/* enumerated kcontrol */
|
/* enumerated kcontrol */
|
||||||
struct soc_enum {
|
struct soc_enum {
|
||||||
unsigned short reg;
|
unsigned short reg;
|
||||||
|
|
|
@ -1454,9 +1454,11 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_ext);
|
||||||
int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
|
int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_info *uinfo)
|
struct snd_ctl_elem_info *uinfo)
|
||||||
{
|
{
|
||||||
int max = (kcontrol->private_value >> 16) & 0xff;
|
struct soc_mixer_control *mc =
|
||||||
int shift = (kcontrol->private_value >> 8) & 0x0f;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
int rshift = (kcontrol->private_value >> 12) & 0x0f;
|
int max = mc->max;
|
||||||
|
uint shift = mc->min;
|
||||||
|
uint rshift = mc->rshift;
|
||||||
|
|
||||||
if (max == 1)
|
if (max == 1)
|
||||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
|
||||||
|
@ -1482,13 +1484,15 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw);
|
||||||
int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
|
int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
|
struct soc_mixer_control *mc =
|
||||||
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||||
int reg = kcontrol->private_value & 0xff;
|
uint reg = mc->reg;
|
||||||
int shift = (kcontrol->private_value >> 8) & 0x0f;
|
uint shift = mc->shift;
|
||||||
int rshift = (kcontrol->private_value >> 12) & 0x0f;
|
uint rshift = mc->rshift;
|
||||||
int max = (kcontrol->private_value >> 16) & 0xff;
|
int max = mc->max;
|
||||||
int mask = (1 << fls(max)) - 1;
|
uint mask = (1 << fls(max)) - 1;
|
||||||
int invert = (kcontrol->private_value >> 24) & 0x01;
|
uint invert = mc->invert;
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.integer.value[0] =
|
||||||
(snd_soc_read(codec, reg) >> shift) & mask;
|
(snd_soc_read(codec, reg) >> shift) & mask;
|
||||||
|
@ -1519,13 +1523,15 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw);
|
||||||
int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
|
int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
|
struct soc_mixer_control *mc =
|
||||||
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||||
int reg = kcontrol->private_value & 0xff;
|
uint reg = mc->reg;
|
||||||
int shift = (kcontrol->private_value >> 8) & 0x0f;
|
uint shift = mc->shift;
|
||||||
int rshift = (kcontrol->private_value >> 12) & 0x0f;
|
uint rshift = mc->rshift;
|
||||||
int max = (kcontrol->private_value >> 16) & 0xff;
|
int max = mc->max;
|
||||||
int mask = (1 << fls(max)) - 1;
|
uint mask = (1 << fls(max)) - 1;
|
||||||
int invert = (kcontrol->private_value >> 24) & 0x01;
|
uint invert = mc->invert;
|
||||||
unsigned short val, val2, val_mask;
|
unsigned short val, val2, val_mask;
|
||||||
|
|
||||||
val = (ucontrol->value.integer.value[0] & mask);
|
val = (ucontrol->value.integer.value[0] & mask);
|
||||||
|
@ -1557,7 +1563,9 @@ EXPORT_SYMBOL_GPL(snd_soc_put_volsw);
|
||||||
int snd_soc_info_volsw_2r(struct snd_kcontrol *kcontrol,
|
int snd_soc_info_volsw_2r(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_info *uinfo)
|
struct snd_ctl_elem_info *uinfo)
|
||||||
{
|
{
|
||||||
int max = (kcontrol->private_value >> 12) & 0xff;
|
struct soc_mixer_control *mc =
|
||||||
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
|
int max = mc->max;
|
||||||
|
|
||||||
if (max == 1)
|
if (max == 1)
|
||||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
|
||||||
|
@ -1583,13 +1591,15 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_2r);
|
||||||
int snd_soc_get_volsw_2r(struct snd_kcontrol *kcontrol,
|
int snd_soc_get_volsw_2r(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
|
struct soc_mixer_control *mc =
|
||||||
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||||
int reg = kcontrol->private_value & 0xff;
|
uint reg = mc->reg;
|
||||||
int reg2 = (kcontrol->private_value >> 24) & 0xff;
|
uint reg2 = mc->rreg;
|
||||||
int shift = (kcontrol->private_value >> 8) & 0x0f;
|
uint shift = mc->shift;
|
||||||
int max = (kcontrol->private_value >> 12) & 0xff;
|
int max = mc->max;
|
||||||
int mask = (1<<fls(max))-1;
|
uint mask = (1<<fls(max))-1;
|
||||||
int invert = (kcontrol->private_value >> 20) & 0x01;
|
uint invert = mc->invert;
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.integer.value[0] =
|
||||||
(snd_soc_read(codec, reg) >> shift) & mask;
|
(snd_soc_read(codec, reg) >> shift) & mask;
|
||||||
|
@ -1618,13 +1628,15 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_2r);
|
||||||
int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol,
|
int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
|
struct soc_mixer_control *mc =
|
||||||
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||||
int reg = kcontrol->private_value & 0xff;
|
uint reg = mc->reg;
|
||||||
int reg2 = (kcontrol->private_value >> 24) & 0xff;
|
uint reg2 = mc->rreg;
|
||||||
int shift = (kcontrol->private_value >> 8) & 0x0f;
|
uint shift = mc->shift;
|
||||||
int max = (kcontrol->private_value >> 12) & 0xff;
|
int max = mc->max;
|
||||||
int mask = (1 << fls(max)) - 1;
|
uint mask = (1 << fls(max)) - 1;
|
||||||
int invert = (kcontrol->private_value >> 20) & 0x01;
|
uint invert = mc->invert;
|
||||||
int err;
|
int err;
|
||||||
unsigned short val, val2, val_mask;
|
unsigned short val, val2, val_mask;
|
||||||
|
|
||||||
|
@ -1661,8 +1673,10 @@ EXPORT_SYMBOL_GPL(snd_soc_put_volsw_2r);
|
||||||
int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol,
|
int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_info *uinfo)
|
struct snd_ctl_elem_info *uinfo)
|
||||||
{
|
{
|
||||||
int max = (signed char)((kcontrol->private_value >> 16) & 0xff);
|
struct soc_mixer_control *mc =
|
||||||
int min = (signed char)((kcontrol->private_value >> 24) & 0xff);
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
|
int max = mc->max;
|
||||||
|
int min = mc->min;
|
||||||
|
|
||||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
|
||||||
uinfo->count = 2;
|
uinfo->count = 2;
|
||||||
|
@ -1684,9 +1698,11 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_s8);
|
||||||
int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
|
int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
|
struct soc_mixer_control *mc =
|
||||||
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||||
int reg = kcontrol->private_value & 0xff;
|
uint reg = mc->reg;
|
||||||
int min = (signed char)((kcontrol->private_value >> 24) & 0xff);
|
int min = mc->min;
|
||||||
int val = snd_soc_read(codec, reg);
|
int val = snd_soc_read(codec, reg);
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.integer.value[0] =
|
||||||
|
@ -1709,9 +1725,11 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_s8);
|
||||||
int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
|
int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
|
struct soc_mixer_control *mc =
|
||||||
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||||
int reg = kcontrol->private_value & 0xff;
|
uint reg = mc->reg;
|
||||||
int min = (signed char)((kcontrol->private_value >> 24) & 0xff);
|
int min = mc->min;
|
||||||
unsigned short val;
|
unsigned short val;
|
||||||
|
|
||||||
val = (ucontrol->value.integer.value[0]+min) & 0xff;
|
val = (ucontrol->value.integer.value[0]+min) & 0xff;
|
||||||
|
|
|
@ -104,10 +104,13 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
|
||||||
case snd_soc_dapm_switch:
|
case snd_soc_dapm_switch:
|
||||||
case snd_soc_dapm_mixer: {
|
case snd_soc_dapm_mixer: {
|
||||||
int val;
|
int val;
|
||||||
int reg = w->kcontrols[i].private_value & 0xff;
|
struct soc_mixer_control *mc = (struct soc_mixer_control *)
|
||||||
int shift = (w->kcontrols[i].private_value >> 8) & 0x0f;
|
w->kcontrols[i].private_value;
|
||||||
int mask = (w->kcontrols[i].private_value >> 16) & 0xff;
|
uint reg = mc->reg;
|
||||||
int invert = (w->kcontrols[i].private_value >> 24) & 0x01;
|
uint shift = mc->shift;
|
||||||
|
int max = mc->max;
|
||||||
|
uint mask = (1 << fls(max)) - 1;
|
||||||
|
uint invert = mc->invert;
|
||||||
|
|
||||||
val = snd_soc_read(w->codec, reg);
|
val = snd_soc_read(w->codec, reg);
|
||||||
val = (val >> shift) & mask;
|
val = (val >> shift) & mask;
|
||||||
|
@ -247,16 +250,19 @@ static int dapm_set_pga(struct snd_soc_dapm_widget *widget, int power)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (widget->num_kcontrols && k) {
|
if (widget->num_kcontrols && k) {
|
||||||
int reg = k->private_value & 0xff;
|
struct soc_mixer_control *mc =
|
||||||
int shift = (k->private_value >> 8) & 0x0f;
|
(struct soc_mixer_control *)k->private_value;
|
||||||
int mask = (k->private_value >> 16) & 0xff;
|
uint reg = mc->reg;
|
||||||
int invert = (k->private_value >> 24) & 0x01;
|
uint shift = mc->shift;
|
||||||
|
int max = mc->max;
|
||||||
|
uint mask = (1 << fls(max)) - 1;
|
||||||
|
uint invert = mc->invert;
|
||||||
|
|
||||||
if (power) {
|
if (power) {
|
||||||
int i;
|
int i;
|
||||||
/* power up has happended, increase volume to last level */
|
/* power up has happended, increase volume to last level */
|
||||||
if (invert) {
|
if (invert) {
|
||||||
for (i = mask; i > widget->saved_value; i--)
|
for (i = max; i > widget->saved_value; i--)
|
||||||
snd_soc_update_bits(widget->codec, reg, mask, i);
|
snd_soc_update_bits(widget->codec, reg, mask, i);
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < widget->saved_value; i++)
|
for (i = 0; i < widget->saved_value; i++)
|
||||||
|
@ -1133,12 +1139,14 @@ 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_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
|
||||||
int reg = kcontrol->private_value & 0xff;
|
struct soc_mixer_control *mc =
|
||||||
int shift = (kcontrol->private_value >> 8) & 0x0f;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
int rshift = (kcontrol->private_value >> 12) & 0x0f;
|
uint reg = mc->reg;
|
||||||
int max = (kcontrol->private_value >> 16) & 0xff;
|
uint shift = mc->shift;
|
||||||
int invert = (kcontrol->private_value >> 24) & 0x01;
|
uint rshift = mc->rshift;
|
||||||
int mask = (1 << fls(max)) - 1;
|
int max = mc->max;
|
||||||
|
uint invert = mc->invert;
|
||||||
|
uint mask = (1 << fls(max)) - 1;
|
||||||
|
|
||||||
/* return the saved value if we are powered down */
|
/* return the saved value if we are powered down */
|
||||||
if (widget->id == snd_soc_dapm_pga && !widget->power) {
|
if (widget->id == snd_soc_dapm_pga && !widget->power) {
|
||||||
|
@ -1176,12 +1184,14 @@ 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_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
|
||||||
int reg = kcontrol->private_value & 0xff;
|
struct soc_mixer_control *mc =
|
||||||
int shift = (kcontrol->private_value >> 8) & 0x0f;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
int rshift = (kcontrol->private_value >> 12) & 0x0f;
|
uint reg = mc->reg;
|
||||||
int max = (kcontrol->private_value >> 16) & 0xff;
|
uint shift = mc->shift;
|
||||||
int mask = (1 << fls(max)) - 1;
|
uint rshift = mc->rshift;
|
||||||
int invert = (kcontrol->private_value >> 24) & 0x01;
|
int max = mc->max;
|
||||||
|
uint mask = (1 << fls(max)) - 1;
|
||||||
|
uint invert = mc->invert;
|
||||||
unsigned short val, val2, val_mask;
|
unsigned short val, val2, val_mask;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue