|
@@ -2139,7 +2139,6 @@ static int wm8962_put_spk_sw(struct snd_kcontrol *kcontrol,
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
{
|
|
{
|
|
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
|
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
|
- u16 *reg_cache = codec->reg_cache;
|
|
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
/* Apply the update (if any) */
|
|
/* Apply the update (if any) */
|
|
@@ -2148,16 +2147,19 @@ static int wm8962_put_spk_sw(struct snd_kcontrol *kcontrol,
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
/* If the left PGA is enabled hit that VU bit... */
|
|
/* If the left PGA is enabled hit that VU bit... */
|
|
- if (reg_cache[WM8962_PWR_MGMT_2] & WM8962_SPKOUTL_PGA_ENA)
|
|
|
|
- return snd_soc_write(codec, WM8962_SPKOUTL_VOLUME,
|
|
|
|
- reg_cache[WM8962_SPKOUTL_VOLUME]);
|
|
|
|
|
|
+ ret = snd_soc_read(codec, WM8962_PWR_MGMT_2);
|
|
|
|
+ if (ret & WM8962_SPKOUTL_PGA_ENA) {
|
|
|
|
+ snd_soc_write(codec, WM8962_SPKOUTL_VOLUME,
|
|
|
|
+ snd_soc_read(codec, WM8962_SPKOUTL_VOLUME));
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
|
|
/* ...otherwise the right. The VU is stereo. */
|
|
/* ...otherwise the right. The VU is stereo. */
|
|
- if (reg_cache[WM8962_PWR_MGMT_2] & WM8962_SPKOUTR_PGA_ENA)
|
|
|
|
- return snd_soc_write(codec, WM8962_SPKOUTR_VOLUME,
|
|
|
|
- reg_cache[WM8962_SPKOUTR_VOLUME]);
|
|
|
|
|
|
+ if (ret & WM8962_SPKOUTR_PGA_ENA)
|
|
|
|
+ snd_soc_write(codec, WM8962_SPKOUTR_VOLUME,
|
|
|
|
+ snd_soc_read(codec, WM8962_SPKOUTR_VOLUME));
|
|
|
|
|
|
- return 0;
|
|
|
|
|
|
+ return 1;
|
|
}
|
|
}
|
|
|
|
|
|
static const char *cap_hpf_mode_text[] = {
|
|
static const char *cap_hpf_mode_text[] = {
|
|
@@ -2498,7 +2500,6 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
|
|
struct snd_kcontrol *kcontrol, int event)
|
|
struct snd_kcontrol *kcontrol, int event)
|
|
{
|
|
{
|
|
struct snd_soc_codec *codec = w->codec;
|
|
struct snd_soc_codec *codec = w->codec;
|
|
- u16 *reg_cache = codec->reg_cache;
|
|
|
|
int reg;
|
|
int reg;
|
|
|
|
|
|
switch (w->shift) {
|
|
switch (w->shift) {
|
|
@@ -2521,7 +2522,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
|
|
|
|
|
|
switch (event) {
|
|
switch (event) {
|
|
case SND_SOC_DAPM_POST_PMU:
|
|
case SND_SOC_DAPM_POST_PMU:
|
|
- return snd_soc_write(codec, reg, reg_cache[reg]);
|
|
|
|
|
|
+ return snd_soc_write(codec, reg, snd_soc_read(codec, reg));
|
|
default:
|
|
default:
|
|
BUG();
|
|
BUG();
|
|
return -EINVAL;
|
|
return -EINVAL;
|