Commit 7f06db34 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'sound-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

sound fixes for 3.3-rc3

Most of commits are either regression fixes for varioud HD-audio
codecs or small ASoC fixes.  Also a trivial build fix is included.

* tag 'sound-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda - Disable dynamic-power control for VIA as default
  ALSA: hda - Allow analog low-current mode when dynamic power-control is on
  ALSA: hda - Fix the logic to detect VIA analog low-current mode
  ALSA: hda - Check power-state before changing in patch_via.c
  ALSA: HDA: Fix duplicated output to more than one codec
  ALSA: hda - Fix calling cs_automic twice for Cirrus codecs.
  ALSA: HDA: Remove quirk for Toshiba Qosmio G50
  ALSA: HDA: Fix jack creation for codecs with front and rear Line In
  ALSA: hda - Apply 0x0f-VREF fix to all ASUS laptops with ALC861/660
  ASoC: neo1973_wm8753: remove references to the neo1973-gta01 machine
  ALSA: Add #ifdef CONFIG_PCI guard for snd_pci_quirk_* functions
  ASoC: wm_hubs: fix wrong bits for LINEOUT2 N/P mixer
  ALSA: HDA: Remove quirk for Asus N53Jq
  ASoC: wm_hubs: Enable line out VMID buffer for single ended line outputs
  ASoC: wm5100: Mark register cache as dirty when regulators are disabled
  ASoC: wm8962: Mark register cache as dirty when regulators are disabled
  ASoC: wm8996: Mark register cache as dirty when regulators are disabled
  ASoC: wm5100: Fix microphone configuration
  ASoC: wm5100: Make sure we switch to button reporting mode
parents 6c073a7e b5bcc189
...@@ -417,6 +417,7 @@ static inline int __snd_bug_on(int cond) ...@@ -417,6 +417,7 @@ static inline int __snd_bug_on(int cond)
#define gameport_get_port_data(gp) (gp)->port_data #define gameport_get_port_data(gp) (gp)->port_data
#endif #endif
#ifdef CONFIG_PCI
/* PCI quirk list helper */ /* PCI quirk list helper */
struct snd_pci_quirk { struct snd_pci_quirk {
unsigned short subvendor; /* PCI subvendor ID */ unsigned short subvendor; /* PCI subvendor ID */
...@@ -456,5 +457,6 @@ snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list); ...@@ -456,5 +457,6 @@ snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list);
const struct snd_pci_quirk * const struct snd_pci_quirk *
snd_pci_quirk_lookup_id(u16 vendor, u16 device, snd_pci_quirk_lookup_id(u16 vendor, u16 device,
const struct snd_pci_quirk *list); const struct snd_pci_quirk *list);
#endif
#endif /* __SOUND_CORE_H */ #endif /* __SOUND_CORE_H */
...@@ -1447,7 +1447,7 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, ...@@ -1447,7 +1447,7 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,
for (i = 0; i < c->cvt_setups.used; i++) { for (i = 0; i < c->cvt_setups.used; i++) {
p = snd_array_elem(&c->cvt_setups, i); p = snd_array_elem(&c->cvt_setups, i);
if (!p->active && p->stream_tag == stream_tag && if (!p->active && p->stream_tag == stream_tag &&
get_wcaps_type(get_wcaps(codec, p->nid)) == type) get_wcaps_type(get_wcaps(c, p->nid)) == type)
p->dirty = 1; p->dirty = 1;
} }
} }
......
...@@ -282,7 +282,8 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, ...@@ -282,7 +282,8 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctl); EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctl);
static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,
const struct auto_pin_cfg *cfg) const struct auto_pin_cfg *cfg,
char *lastname, int *lastidx)
{ {
unsigned int def_conf, conn; unsigned int def_conf, conn;
char name[44]; char name[44];
...@@ -298,6 +299,10 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, ...@@ -298,6 +299,10 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,
return 0; return 0;
snd_hda_get_pin_label(codec, nid, cfg, name, sizeof(name), &idx); snd_hda_get_pin_label(codec, nid, cfg, name, sizeof(name), &idx);
if (!strcmp(name, lastname) && idx == *lastidx)
idx++;
strncpy(lastname, name, 44);
*lastidx = idx;
err = snd_hda_jack_add_kctl(codec, nid, name, idx); err = snd_hda_jack_add_kctl(codec, nid, name, idx);
if (err < 0) if (err < 0)
return err; return err;
...@@ -311,41 +316,42 @@ int snd_hda_jack_add_kctls(struct hda_codec *codec, ...@@ -311,41 +316,42 @@ int snd_hda_jack_add_kctls(struct hda_codec *codec,
const struct auto_pin_cfg *cfg) const struct auto_pin_cfg *cfg)
{ {
const hda_nid_t *p; const hda_nid_t *p;
int i, err; int i, err, lastidx = 0;
char lastname[44] = "";
for (i = 0, p = cfg->line_out_pins; i < cfg->line_outs; i++, p++) { for (i = 0, p = cfg->line_out_pins; i < cfg->line_outs; i++, p++) {
err = add_jack_kctl(codec, *p, cfg); err = add_jack_kctl(codec, *p, cfg, lastname, &lastidx);
if (err < 0) if (err < 0)
return err; return err;
} }
for (i = 0, p = cfg->hp_pins; i < cfg->hp_outs; i++, p++) { for (i = 0, p = cfg->hp_pins; i < cfg->hp_outs; i++, p++) {
if (*p == *cfg->line_out_pins) /* might be duplicated */ if (*p == *cfg->line_out_pins) /* might be duplicated */
break; break;
err = add_jack_kctl(codec, *p, cfg); err = add_jack_kctl(codec, *p, cfg, lastname, &lastidx);
if (err < 0) if (err < 0)
return err; return err;
} }
for (i = 0, p = cfg->speaker_pins; i < cfg->speaker_outs; i++, p++) { for (i = 0, p = cfg->speaker_pins; i < cfg->speaker_outs; i++, p++) {
if (*p == *cfg->line_out_pins) /* might be duplicated */ if (*p == *cfg->line_out_pins) /* might be duplicated */
break; break;
err = add_jack_kctl(codec, *p, cfg); err = add_jack_kctl(codec, *p, cfg, lastname, &lastidx);
if (err < 0) if (err < 0)
return err; return err;
} }
for (i = 0; i < cfg->num_inputs; i++) { for (i = 0; i < cfg->num_inputs; i++) {
err = add_jack_kctl(codec, cfg->inputs[i].pin, cfg); err = add_jack_kctl(codec, cfg->inputs[i].pin, cfg, lastname, &lastidx);
if (err < 0) if (err < 0)
return err; return err;
} }
for (i = 0, p = cfg->dig_out_pins; i < cfg->dig_outs; i++, p++) { for (i = 0, p = cfg->dig_out_pins; i < cfg->dig_outs; i++, p++) {
err = add_jack_kctl(codec, *p, cfg); err = add_jack_kctl(codec, *p, cfg, lastname, &lastidx);
if (err < 0) if (err < 0)
return err; return err;
} }
err = add_jack_kctl(codec, cfg->dig_in_pin, cfg); err = add_jack_kctl(codec, cfg->dig_in_pin, cfg, lastname, &lastidx);
if (err < 0) if (err < 0)
return err; return err;
err = add_jack_kctl(codec, cfg->mono_out_pin, cfg); err = add_jack_kctl(codec, cfg->mono_out_pin, cfg, lastname, &lastidx);
if (err < 0) if (err < 0)
return err; return err;
return 0; return 0;
......
...@@ -988,8 +988,10 @@ static void cs_automic(struct hda_codec *codec) ...@@ -988,8 +988,10 @@ static void cs_automic(struct hda_codec *codec)
change_cur_input(codec, !spec->automic_idx, 0); change_cur_input(codec, !spec->automic_idx, 0);
} else { } else {
if (present) { if (present) {
if (spec->cur_input != spec->automic_idx) {
spec->last_input = spec->cur_input; spec->last_input = spec->cur_input;
spec->cur_input = spec->automic_idx; spec->cur_input = spec->automic_idx;
}
} else { } else {
spec->cur_input = spec->last_input; spec->cur_input = spec->last_input;
} }
......
...@@ -177,6 +177,7 @@ struct alc_spec { ...@@ -177,6 +177,7 @@ struct alc_spec {
unsigned int detect_lo:1; /* Line-out detection enabled */ unsigned int detect_lo:1; /* Line-out detection enabled */
unsigned int automute_speaker_possible:1; /* there are speakers and either LO or HP */ unsigned int automute_speaker_possible:1; /* there are speakers and either LO or HP */
unsigned int automute_lo_possible:1; /* there are line outs and HP */ unsigned int automute_lo_possible:1; /* there are line outs and HP */
unsigned int keep_vref_in_automute:1; /* Don't clear VREF in automute */
/* other flags */ /* other flags */
unsigned int no_analog :1; /* digital I/O only */ unsigned int no_analog :1; /* digital I/O only */
...@@ -495,13 +496,24 @@ static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins, ...@@ -495,13 +496,24 @@ static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins,
for (i = 0; i < num_pins; i++) { for (i = 0; i < num_pins; i++) {
hda_nid_t nid = pins[i]; hda_nid_t nid = pins[i];
unsigned int val;
if (!nid) if (!nid)
break; break;
switch (spec->automute_mode) { switch (spec->automute_mode) {
case ALC_AUTOMUTE_PIN: case ALC_AUTOMUTE_PIN:
/* don't reset VREF value in case it's controlling
* the amp (see alc861_fixup_asus_amp_vref_0f())
*/
if (spec->keep_vref_in_automute) {
val = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
val &= ~PIN_HP;
} else
val = 0;
val |= pin_bits;
snd_hda_codec_write(codec, nid, 0, snd_hda_codec_write(codec, nid, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, AC_VERB_SET_PIN_WIDGET_CONTROL,
pin_bits); val);
break; break;
case ALC_AUTOMUTE_AMP: case ALC_AUTOMUTE_AMP:
snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
...@@ -4735,7 +4747,6 @@ enum { ...@@ -4735,7 +4747,6 @@ enum {
ALC262_FIXUP_FSC_H270, ALC262_FIXUP_FSC_H270,
ALC262_FIXUP_HP_Z200, ALC262_FIXUP_HP_Z200,
ALC262_FIXUP_TYAN, ALC262_FIXUP_TYAN,
ALC262_FIXUP_TOSHIBA_RX1,
ALC262_FIXUP_LENOVO_3000, ALC262_FIXUP_LENOVO_3000,
ALC262_FIXUP_BENQ, ALC262_FIXUP_BENQ,
ALC262_FIXUP_BENQ_T31, ALC262_FIXUP_BENQ_T31,
...@@ -4765,16 +4776,6 @@ static const struct alc_fixup alc262_fixups[] = { ...@@ -4765,16 +4776,6 @@ static const struct alc_fixup alc262_fixups[] = {
{ } { }
} }
}, },
[ALC262_FIXUP_TOSHIBA_RX1] = {
.type = ALC_FIXUP_PINS,
.v.pins = (const struct alc_pincfg[]) {
{ 0x14, 0x90170110 }, /* speaker */
{ 0x15, 0x0421101f }, /* HP */
{ 0x1a, 0x40f000f0 }, /* N/A */
{ 0x1b, 0x40f000f0 }, /* N/A */
{ 0x1e, 0x40f000f0 }, /* N/A */
}
},
[ALC262_FIXUP_LENOVO_3000] = { [ALC262_FIXUP_LENOVO_3000] = {
.type = ALC_FIXUP_VERBS, .type = ALC_FIXUP_VERBS,
.v.verbs = (const struct hda_verb[]) { .v.verbs = (const struct hda_verb[]) {
...@@ -4807,8 +4808,6 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = { ...@@ -4807,8 +4808,6 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = {
SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FIXUP_BENQ), SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FIXUP_BENQ),
SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ), SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN), SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
ALC262_FIXUP_TOSHIBA_RX1),
SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270), SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000), SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ), SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
...@@ -5377,7 +5376,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { ...@@ -5377,7 +5376,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
ALC269_FIXUP_AMIC), ALC269_FIXUP_AMIC),
SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC), SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269_FIXUP_AMIC),
SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC), SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC), SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC), SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
...@@ -5589,6 +5587,25 @@ enum { ...@@ -5589,6 +5587,25 @@ enum {
PINFIX_ASUS_A6RP, PINFIX_ASUS_A6RP,
}; };
/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
const struct alc_fixup *fix, int action)
{
struct alc_spec *spec = codec->spec;
unsigned int val;
if (action != ALC_FIXUP_ACT_INIT)
return;
val = snd_hda_codec_read(codec, 0x0f, 0,
AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
val |= AC_PINCTL_IN_EN;
val |= AC_PINCTL_VREF_50;
snd_hda_codec_write(codec, 0x0f, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, val);
spec->keep_vref_in_automute = 1;
}
static const struct alc_fixup alc861_fixups[] = { static const struct alc_fixup alc861_fixups[] = {
[PINFIX_FSC_AMILO_PI1505] = { [PINFIX_FSC_AMILO_PI1505] = {
.type = ALC_FIXUP_PINS, .type = ALC_FIXUP_PINS,
...@@ -5599,17 +5616,13 @@ static const struct alc_fixup alc861_fixups[] = { ...@@ -5599,17 +5616,13 @@ static const struct alc_fixup alc861_fixups[] = {
} }
}, },
[PINFIX_ASUS_A6RP] = { [PINFIX_ASUS_A6RP] = {
.type = ALC_FIXUP_VERBS, .type = ALC_FIXUP_FUNC,
.v.verbs = (const struct hda_verb[]) { .v.func = alc861_fixup_asus_amp_vref_0f,
/* node 0x0f VREF seems controlling the master output */
{ 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
{ }
},
}, },
}; };
static const struct snd_pci_quirk alc861_fixup_tbl[] = { static const struct snd_pci_quirk alc861_fixup_tbl[] = {
SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", PINFIX_ASUS_A6RP), SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", PINFIX_ASUS_A6RP),
SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", PINFIX_ASUS_A6RP), SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", PINFIX_ASUS_A6RP),
SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
{} {}
......
...@@ -199,6 +199,9 @@ struct via_spec { ...@@ -199,6 +199,9 @@ struct via_spec {
unsigned int no_pin_power_ctl; unsigned int no_pin_power_ctl;
enum VIA_HDA_CODEC codec_type; enum VIA_HDA_CODEC codec_type;
/* analog low-power control */
bool alc_mode;
/* smart51 setup */ /* smart51 setup */
unsigned int smart51_nums; unsigned int smart51_nums;
hda_nid_t smart51_pins[2]; hda_nid_t smart51_pins[2];
...@@ -687,6 +690,15 @@ static void via_auto_init_analog_input(struct hda_codec *codec) ...@@ -687,6 +690,15 @@ static void via_auto_init_analog_input(struct hda_codec *codec)
} }
} }
static void update_power_state(struct hda_codec *codec, hda_nid_t nid,
unsigned int parm)
{
if (snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_POWER_STATE, 0) == parm)
return;
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, parm);
}
static void set_pin_power_state(struct hda_codec *codec, hda_nid_t nid, static void set_pin_power_state(struct hda_codec *codec, hda_nid_t nid,
unsigned int *affected_parm) unsigned int *affected_parm)
{ {
...@@ -709,7 +721,7 @@ static void set_pin_power_state(struct hda_codec *codec, hda_nid_t nid, ...@@ -709,7 +721,7 @@ static void set_pin_power_state(struct hda_codec *codec, hda_nid_t nid,
} else } else
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, nid, parm);
} }
static int via_pin_power_ctl_info(struct snd_kcontrol *kcontrol, static int via_pin_power_ctl_info(struct snd_kcontrol *kcontrol,
...@@ -749,6 +761,7 @@ static int via_pin_power_ctl_put(struct snd_kcontrol *kcontrol, ...@@ -749,6 +761,7 @@ static int via_pin_power_ctl_put(struct snd_kcontrol *kcontrol,
return 0; return 0;
spec->no_pin_power_ctl = val; spec->no_pin_power_ctl = val;
set_widgets_power_state(codec); set_widgets_power_state(codec);
analog_low_current_mode(codec);
return 1; return 1;
} }
...@@ -1036,13 +1049,19 @@ static bool is_aa_path_mute(struct hda_codec *codec) ...@@ -1036,13 +1049,19 @@ static bool is_aa_path_mute(struct hda_codec *codec)
} }
/* enter/exit analog low-current mode */ /* enter/exit analog low-current mode */
static void analog_low_current_mode(struct hda_codec *codec) static void __analog_low_current_mode(struct hda_codec *codec, bool force)
{ {
struct via_spec *spec = codec->spec; struct via_spec *spec = codec->spec;
bool enable; bool enable;
unsigned int verb, parm; unsigned int verb, parm;
enable = is_aa_path_mute(codec) && (spec->opened_streams != 0); if (spec->no_pin_power_ctl)
enable = false;
else
enable = is_aa_path_mute(codec) && !spec->opened_streams;
if (enable == spec->alc_mode && !force)
return;
spec->alc_mode = enable;
/* decide low current mode's verb & parameter */ /* decide low current mode's verb & parameter */
switch (spec->codec_type) { switch (spec->codec_type) {
...@@ -1074,6 +1093,11 @@ static void analog_low_current_mode(struct hda_codec *codec) ...@@ -1074,6 +1093,11 @@ static void analog_low_current_mode(struct hda_codec *codec)
snd_hda_codec_write(codec, codec->afg, 0, verb, parm); snd_hda_codec_write(codec, codec->afg, 0, verb, parm);
} }
static void analog_low_current_mode(struct hda_codec *codec)
{
return __analog_low_current_mode(codec, false);
}
/* /*
* generic initialization of ADC, input mixers and output mixers * generic initialization of ADC, input mixers and output mixers
*/ */
...@@ -1446,6 +1470,7 @@ static int via_build_controls(struct hda_codec *codec) ...@@ -1446,6 +1470,7 @@ static int via_build_controls(struct hda_codec *codec)
struct snd_kcontrol *kctl; struct snd_kcontrol *kctl;
int err, i; int err, i;
spec->no_pin_power_ctl = 1;
if (spec->set_widgets_power_state) if (spec->set_widgets_power_state)
if (!via_clone_control(spec, &via_pin_power_ctl_enum)) if (!via_clone_control(spec, &via_pin_power_ctl_enum))
return -ENOMEM; return -ENOMEM;
...@@ -1499,10 +1524,6 @@ static int via_build_controls(struct hda_codec *codec) ...@@ -1499,10 +1524,6 @@ static int via_build_controls(struct hda_codec *codec)
return err; return err;
} }
/* init power states */
set_widgets_power_state(codec);
analog_low_current_mode(codec);
via_free_kctls(codec); /* no longer needed */ via_free_kctls(codec); /* no longer needed */
err = snd_hda_jack_add_kctls(codec, &spec->autocfg); err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
...@@ -2295,10 +2316,7 @@ static int via_mux_enum_put(struct snd_kcontrol *kcontrol, ...@@ -2295,10 +2316,7 @@ static int via_mux_enum_put(struct snd_kcontrol *kcontrol,
if (mux) { if (mux) {
/* switch to D0 beofre change index */ /* switch to D0 beofre change index */
if (snd_hda_codec_read(codec, mux, 0, update_power_state(codec, mux, AC_PWRST_D0);
AC_VERB_GET_POWER_STATE, 0x00) != AC_PWRST_D0)
snd_hda_codec_write(codec, mux, 0,
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
snd_hda_codec_write(codec, mux, 0, snd_hda_codec_write(codec, mux, 0,
AC_VERB_SET_CONNECT_SEL, AC_VERB_SET_CONNECT_SEL,
spec->inputs[cur].mux_idx); spec->inputs[cur].mux_idx);
...@@ -2776,6 +2794,10 @@ static int via_init(struct hda_codec *codec) ...@@ -2776,6 +2794,10 @@ static int via_init(struct hda_codec *codec)
for (i = 0; i < spec->num_iverbs; i++) for (i = 0; i < spec->num_iverbs; i++)
snd_hda_sequence_write(codec, spec->init_verbs[i]); snd_hda_sequence_write(codec, spec->init_verbs[i]);
/* init power states */
set_widgets_power_state(codec);
__analog_low_current_mode(codec, true);
via_auto_init_multi_out(codec); via_auto_init_multi_out(codec);
via_auto_init_hp_out(codec); via_auto_init_hp_out(codec);
via_auto_init_speaker_out(codec); via_auto_init_speaker_out(codec);
...@@ -2922,9 +2944,9 @@ static void set_widgets_power_state_vt1708B(struct hda_codec *codec) ...@@ -2922,9 +2944,9 @@ static void set_widgets_power_state_vt1708B(struct hda_codec *codec)
if (imux_is_smixer) if (imux_is_smixer)
parm = AC_PWRST_D0; parm = AC_PWRST_D0;
/* SW0 (17h), AIW 0/1 (13h/14h) */ /* SW0 (17h), AIW 0/1 (13h/14h) */
snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x17, parm);
snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x13, parm);
snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x14, parm);
/* outputs */ /* outputs */
/* PW0 (19h), SW1 (18h), AOW1 (11h) */ /* PW0 (19h), SW1 (18h), AOW1 (11h) */
...@@ -2932,8 +2954,8 @@ static void set_widgets_power_state_vt1708B(struct hda_codec *codec) ...@@ -2932,8 +2954,8 @@ static void set_widgets_power_state_vt1708B(struct hda_codec *codec)
set_pin_power_state(codec, 0x19, &parm); set_pin_power_state(codec, 0x19, &parm);
if (spec->smart51_enabled) if (spec->smart51_enabled)
set_pin_power_state(codec, 0x1b, &parm); set_pin_power_state(codec, 0x1b, &parm);
snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x18, parm);
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x11, parm);
/* PW6 (22h), SW2 (26h), AOW2 (24h) */ /* PW6 (22h), SW2 (26h), AOW2 (24h) */
if (is_8ch) { if (is_8ch) {
...@@ -2941,20 +2963,16 @@ static void set_widgets_power_state_vt1708B(struct hda_codec *codec) ...@@ -2941,20 +2963,16 @@ static void set_widgets_power_state_vt1708B(struct hda_codec *codec)
set_pin_power_state(codec, 0x22, &parm); set_pin_power_state(codec, 0x22, &parm);
if (spec->smart51_enabled) if (spec->smart51_enabled)
set_pin_power_state(codec, 0x1a, &parm); set_pin_power_state(codec, 0x1a, &parm);
snd_hda_codec_write(codec, 0x26, 0, update_power_state(codec, 0x26, parm);
AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x24, parm);
snd_hda_codec_write(codec, 0x24, 0,
AC_VERB_SET_POWER_STATE, parm);
} else if (codec->vendor_id == 0x11064397) { } else if (codec->vendor_id == 0x11064397) {
/* PW7(23h), SW2(27h), AOW2(25h) */ /* PW7(23h), SW2(27h), AOW2(25h) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x23, &parm); set_pin_power_state(codec, 0x23, &parm);
if (spec->smart51_enabled) if (spec->smart51_enabled)
set_pin_power_state(codec, 0x1a, &parm); set_pin_power_state(codec, 0x1a, &parm);
snd_hda_codec_write(codec, 0x27, 0, update_power_state(codec, 0x27, parm);
AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x25, parm);
snd_hda_codec_write(codec, 0x25, 0,
AC_VERB_SET_POWER_STATE, parm);
} }
/* PW 3/4/7 (1ch/1dh/23h) */ /* PW 3/4/7 (1ch/1dh/23h) */
...@@ -2966,17 +2984,13 @@ static void set_widgets_power_state_vt1708B(struct hda_codec *codec) ...@@ -2966,17 +2984,13 @@ static void set_widgets_power_state_vt1708B(struct hda_codec *codec)
set_pin_power_state(codec, 0x23, &parm); set_pin_power_state(codec, 0x23, &parm);
/* MW0 (16h), Sw3 (27h), AOW 0/3 (10h/25h) */ /* MW0 (16h), Sw3 (27h), AOW 0/3 (10h/25h) */
snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_POWER_STATE, update_power_state(codec, 0x16, imux_is_smixer ? AC_PWRST_D0 : parm);
imux_is_smixer ? AC_PWRST_D0 : parm); update_power_state(codec, 0x10, parm);
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm);
if (is_8ch) { if (is_8ch) {
snd_hda_codec_write(codec, 0x25, 0, update_power_state(codec, 0x25, parm);
AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x27, parm);
snd_hda_codec_write(codec, 0x27, 0,
AC_VERB_SET_POWER_STATE, parm);
} else if (codec->vendor_id == 0x11064397 && spec->hp_independent_mode) } else if (codec->vendor_id == 0x11064397 && spec->hp_independent_mode)
snd_hda_codec_write(codec, 0x25, 0, update_power_state(codec, 0x25, parm);
AC_VERB_SET_POWER_STATE, parm);
} }
static int patch_vt1708S(struct hda_codec *codec); static int patch_vt1708S(struct hda_codec *codec);
...@@ -3149,10 +3163,10 @@ static void set_widgets_power_state_vt1702(struct hda_codec *codec) ...@@ -3149,10 +3163,10 @@ static void set_widgets_power_state_vt1702(struct hda_codec *codec)
if (imux_is_smixer) if (imux_is_smixer)
parm = AC_PWRST_D0; /* SW0 (13h) = stereo mixer (idx 3) */ parm = AC_PWRST_D0; /* SW0 (13h) = stereo mixer (idx 3) */
/* SW0 (13h), AIW 0/1/2 (12h/1fh/20h) */ /* SW0 (13h), AIW 0/1/2 (12h/1fh/20h) */
snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x13, parm);
snd_hda_codec_write(codec, 0x12, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x12, parm);
snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x1f, parm);
snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x20, parm);
/* outputs */ /* outputs */
/* PW 3/4 (16h/17h) */ /* PW 3/4 (16h/17h) */
...@@ -3160,10 +3174,9 @@ static void set_widgets_power_state_vt1702(struct hda_codec *codec) ...@@ -3160,10 +3174,9 @@ static void set_widgets_power_state_vt1702(struct hda_codec *codec)
set_pin_power_state(codec, 0x17, &parm); set_pin_power_state(codec, 0x17, &parm);
set_pin_power_state(codec, 0x16, &parm); set_pin_power_state(codec, 0x16, &parm);
/* MW0 (1ah), AOW 0/1 (10h/1dh) */ /* MW0 (1ah), AOW 0/1 (10h/1dh) */
snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_POWER_STATE, update_power_state(codec, 0x1a, imux_is_smixer ? AC_PWRST_D0 : parm);
imux_is_smixer ? AC_PWRST_D0 : parm); update_power_state(codec, 0x10, parm);
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x1d, parm);
snd_hda_codec_write(codec, 0x1d, 0, AC_VERB_SET_POWER_STATE, parm);
} }
static int patch_vt1702(struct hda_codec *codec) static int patch_vt1702(struct hda_codec *codec)
...@@ -3228,52 +3241,48 @@ static void set_widgets_power_state_vt1718S(struct hda_codec *codec) ...@@ -3228,52 +3241,48 @@ static void set_widgets_power_state_vt1718S(struct hda_codec *codec)
if (imux_is_smixer) if (imux_is_smixer)
parm = AC_PWRST_D0; parm = AC_PWRST_D0;
/* MUX6/7 (1eh/1fh), AIW 0/1 (10h/11h) */ /* MUX6/7 (1eh/1fh), AIW 0/1 (10h/11h) */
snd_hda_codec_write(codec, 0x1e, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x1e, parm);
snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x1f, parm);
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x10, parm);
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x11, parm);
/* outputs */ /* outputs */
/* PW3 (27h), MW2 (1ah), AOW3 (bh) */ /* PW3 (27h), MW2 (1ah), AOW3 (bh) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x27, &parm); set_pin_power_state(codec, 0x27, &parm);
snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x1a, parm);
snd_hda_codec_write(codec, 0xb, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0xb, parm);
/* PW2 (26h), AOW2 (ah) */ /* PW2 (26h), AOW2 (ah) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x26, &parm); set_pin_power_state(codec, 0x26, &parm);
if (spec->smart51_enabled) if (spec->smart51_enabled)
set_pin_power_state(codec, 0x2b, &parm); set_pin_power_state(codec, 0x2b, &parm);
snd_hda_codec_write(codec, 0xa, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0xa, parm);
/* PW0 (24h), AOW0 (8h) */ /* PW0 (24h), AOW0 (8h) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x24, &parm); set_pin_power_state(codec, 0x24, &parm);
if (!spec->hp_independent_mode) /* check for redirected HP */ if (!spec->hp_independent_mode) /* check for redirected HP */
set_pin_power_state(codec, 0x28, &parm); set_pin_power_state(codec, 0x28, &parm);
snd_hda_codec_write(codec, 0x8, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x8, parm);
/* MW9 (21h), Mw2 (1ah), AOW0 (8h) */ /* MW9 (21h), Mw2 (1ah), AOW0 (8h) */
snd_hda_codec_write(codec, 0x21, 0, AC_VERB_SET_POWER_STATE, update_power_state(codec, 0x21, imux_is_smixer ? AC_PWRST_D0 : parm);
imux_is_smixer ? AC_PWRST_D0 : parm);
/* PW1 (25h), AOW1 (9h) */ /* PW1 (25h), AOW1 (9h) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x25, &parm); set_pin_power_state(codec, 0x25, &parm);
if (spec->smart51_enabled) if (spec->smart51_enabled)
set_pin_power_state(codec, 0x2a, &parm); set_pin_power_state(codec, 0x2a, &parm);
snd_hda_codec_write(codec, 0x9, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x9, parm);
if (spec->hp_independent_mode) { if (spec->hp_independent_mode) {
/* PW4 (28h), MW3 (1bh), MUX1(34h), AOW4 (ch) */ /* PW4 (28h), MW3 (1bh), MUX1(34h), AOW4 (ch) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x28, &parm); set_pin_power_state(codec, 0x28, &parm);
snd_hda_codec_write(codec, 0x1b, 0, update_power_state(codec, 0x1b, parm);
AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x34, parm);
snd_hda_codec_write(codec, 0x34, 0, update_power_state(codec, 0xc, parm);
AC_VERB_SET_POWER_STATE, parm);
snd_hda_codec_write(codec, 0xc, 0,
AC_VERB_SET_POWER_STATE, parm);
} }
} }
...@@ -3433,8 +3442,8 @@ static void set_widgets_power_state_vt1716S(struct hda_codec *codec) ...@@ -3433,8 +3442,8 @@ static void set_widgets_power_state_vt1716S(struct hda_codec *codec)
if (imux_is_smixer) if (imux_is_smixer)
parm = AC_PWRST_D0; parm = AC_PWRST_D0;
/* SW0 (17h), AIW0(13h) */ /* SW0 (17h), AIW0(13h) */
snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x17, parm);
snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x13, parm);
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x1e, &parm); set_pin_power_state(codec, 0x1e, &parm);
...@@ -3442,12 +3451,11 @@ static void set_widgets_power_state_vt1716S(struct hda_codec *codec) ...@@ -3442,12 +3451,11 @@ static void set_widgets_power_state_vt1716S(struct hda_codec *codec)
if (spec->dmic_enabled) if (spec->dmic_enabled)
set_pin_power_state(codec, 0x22, &parm); set_pin_power_state(codec, 0x22, &parm);
else else
snd_hda_codec_write(codec, 0x22, 0, update_power_state(codec, 0x22, AC_PWRST_D3);
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
/* SW2(26h), AIW1(14h) */ /* SW2(26h), AIW1(14h) */
snd_hda_codec_write(codec, 0x26, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x26, parm);
snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x14, parm);
/* outputs */ /* outputs */
/* PW0 (19h), SW1 (18h), AOW1 (11h) */ /* PW0 (19h), SW1 (18h), AOW1 (11h) */
...@@ -3456,8 +3464,8 @@ static void set_widgets_power_state_vt1716S(struct hda_codec *codec) ...@@ -3456,8 +3464,8 @@ static void set_widgets_power_state_vt1716S(struct hda_codec *codec)
/* Smart 5.1 PW2(1bh) */ /* Smart 5.1 PW2(1bh) */
if (spec->smart51_enabled) if (spec->smart51_enabled)
set_pin_power_state(codec, 0x1b, &parm); set_pin_power_state(codec, 0x1b, &parm);
snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x18, parm);
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x11, parm);
/* PW7 (23h), SW3 (27h), AOW3 (25h) */ /* PW7 (23h), SW3 (27h), AOW3 (25h) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
...@@ -3465,12 +3473,12 @@ static void set_widgets_power_state_vt1716S(struct hda_codec *codec) ...@@ -3465,12 +3473,12 @@ static void set_widgets_power_state_vt1716S(struct hda_codec *codec)
/* Smart 5.1 PW1(1ah) */ /* Smart 5.1 PW1(1ah) */
if (spec->smart51_enabled) if (spec->smart51_enabled)
set_pin_power_state(codec, 0x1a, &parm); set_pin_power_state(codec, 0x1a, &parm);
snd_hda_codec_write(codec, 0x27, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x27, parm);
/* Smart 5.1 PW5(1eh) */ /* Smart 5.1 PW5(1eh) */
if (spec->smart51_enabled) if (spec->smart51_enabled)
set_pin_power_state(codec, 0x1e, &parm); set_pin_power_state(codec, 0x1e, &parm);
snd_hda_codec_write(codec, 0x25, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x25, parm);
/* Mono out */ /* Mono out */
/* SW4(28h)->MW1(29h)-> PW12 (2ah)*/ /* SW4(28h)->MW1(29h)-> PW12 (2ah)*/
...@@ -3486,9 +3494,9 @@ static void set_widgets_power_state_vt1716S(struct hda_codec *codec) ...@@ -3486,9 +3494,9 @@ static void set_widgets_power_state_vt1716S(struct hda_codec *codec)
mono_out = 1; mono_out = 1;
} }
parm = mono_out ? AC_PWRST_D0 : AC_PWRST_D3; parm = mono_out ? AC_PWRST_D0 : AC_PWRST_D3;
snd_hda_codec_write(codec, 0x28, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x28, parm);
snd_hda_codec_write(codec, 0x29, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x29, parm);
snd_hda_codec_write(codec, 0x2a, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x2a, parm);
/* PW 3/4 (1ch/1dh) */ /* PW 3/4 (1ch/1dh) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
...@@ -3496,15 +3504,12 @@ static void set_widgets_power_state_vt1716S(struct hda_codec *codec) ...@@ -3496,15 +3504,12 @@ static void set_widgets_power_state_vt1716S(struct hda_codec *codec)
set_pin_power_state(codec, 0x1d, &parm); set_pin_power_state(codec, 0x1d, &parm);
/* HP Independent Mode, power on AOW3 */ /* HP Independent Mode, power on AOW3 */
if (spec->hp_independent_mode) if (spec->hp_independent_mode)
snd_hda_codec_write(codec, 0x25, 0, update_power_state(codec, 0x25, parm);
AC_VERB_SET_POWER_STATE, parm);
/* force to D0 for internal Speaker */ /* force to D0 for internal Speaker */
/* MW0 (16h), AOW0 (10h) */ /* MW0 (16h), AOW0 (10h) */
snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_POWER_STATE, update_power_state(codec, 0x16, imux_is_smixer ? AC_PWRST_D0 : parm);
imux_is_smixer ? AC_PWRST_D0 : parm); update_power_state(codec, 0x10, mono_out ? AC_PWRST_D0 : parm);
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE,
mono_out ? AC_PWRST_D0 : parm);
} }
static int patch_vt1716S(struct hda_codec *codec) static int patch_vt1716S(struct hda_codec *codec)
...@@ -3580,54 +3585,45 @@ static void set_widgets_power_state_vt2002P(struct hda_codec *codec) ...@@ -3580,54 +3585,45 @@ static void set_widgets_power_state_vt2002P(struct hda_codec *codec)
set_pin_power_state(codec, 0x2b, &parm); set_pin_power_state(codec, 0x2b, &parm);
parm = AC_PWRST_D0; parm = AC_PWRST_D0;
/* MUX9/10 (1eh/1fh), AIW 0/1 (10h/11h) */ /* MUX9/10 (1eh/1fh), AIW 0/1 (10h/11h) */
snd_hda_codec_write(codec, 0x1e, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x1e, parm);
snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x1f, parm);
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x10, parm);
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x11, parm);
/* outputs */ /* outputs */
/* AOW0 (8h)*/ /* AOW0 (8h)*/
snd_hda_codec_write(codec, 0x8, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x8, parm);
if (spec->codec_type == VT1802) { if (spec->codec_type == VT1802) {
/* PW4 (28h), MW4 (18h), MUX4(38h) */ /* PW4 (28h), MW4 (18h), MUX4(38h) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x28, &parm); set_pin_power_state(codec, 0x28, &parm);
snd_hda_codec_write(codec, 0x18, 0, update_power_state(codec, 0x18, parm);
AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x38, parm);
snd_hda_codec_write(codec, 0x38, 0,
AC_VERB_SET_POWER_STATE, parm);
} else { } else {
/* PW4 (26h), MW4 (1ch), MUX4(37h) */ /* PW4 (26h), MW4 (1ch), MUX4(37h) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x26, &parm); set_pin_power_state(codec, 0x26, &parm);
snd_hda_codec_write(codec, 0x1c, 0, update_power_state(codec, 0x1c, parm);
AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x37, parm);
snd_hda_codec_write(codec, 0x37, 0,
AC_VERB_SET_POWER_STATE, parm);
} }
if (spec->codec_type == VT1802) { if (spec->codec_type == VT1802) {
/* PW1 (25h), MW1 (15h), MUX1(35h), AOW1 (9h) */ /* PW1 (25h), MW1 (15h), MUX1(35h), AOW1 (9h) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x25, &parm); set_pin_power_state(codec, 0x25, &parm);
snd_hda_codec_write(codec, 0x15, 0, update_power_state(codec, 0x15, parm);
AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x35, parm);
snd_hda_codec_write(codec, 0x35, 0,
AC_VERB_SET_POWER_STATE, parm);
} else { } else {
/* PW1 (25h), MW1 (19h), MUX1(35h), AOW1 (9h) */ /* PW1 (25h), MW1 (19h), MUX1(35h), AOW1 (9h) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x25, &parm); set_pin_power_state(codec, 0x25, &parm);
snd_hda_codec_write(codec, 0x19, 0, update_power_state(codec, 0x19, parm);
AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x35, parm);
snd_hda_codec_write(codec, 0x35, 0,
AC_VERB_SET_POWER_STATE, parm);
} }
if (spec->hp_independent_mode) if (spec->hp_independent_mode)
snd_hda_codec_write(codec, 0x9, 0, update_power_state(codec, 0x9, AC_PWRST_D0);
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
/* Class-D */ /* Class-D */
/* PW0 (24h), MW0(18h/14h), MUX0(34h) */ /* PW0 (24h), MW0(18h/14h), MUX0(34h) */
...@@ -3637,12 +3633,10 @@ static void set_widgets_power_state_vt2002P(struct hda_codec *codec) ...@@ -3637,12 +3633,10 @@ static void set_widgets_power_state_vt2002P(struct hda_codec *codec)
set_pin_power_state(codec, 0x24, &parm); set_pin_power_state(codec, 0x24, &parm);
parm = present ? AC_PWRST_D3 : AC_PWRST_D0; parm = present ? AC_PWRST_D3 : AC_PWRST_D0;
if (spec->codec_type == VT1802) if (spec->codec_type == VT1802)
snd_hda_codec_write(codec, 0x14, 0, update_power_state(codec, 0x14, parm);
AC_VERB_SET_POWER_STATE, parm);
else else
snd_hda_codec_write(codec, 0x18, 0, update_power_state(codec, 0x18, parm);
AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x34, parm);
snd_hda_codec_write(codec, 0x34, 0, AC_VERB_SET_POWER_STATE, parm);
/* Mono Out */ /* Mono Out */
present = snd_hda_jack_detect(codec, 0x26); present = snd_hda_jack_detect(codec, 0x26);
...@@ -3650,28 +3644,20 @@ static void set_widgets_power_state_vt2002P(struct hda_codec *codec) ...@@ -3650,28 +3644,20 @@ static void set_widgets_power_state_vt2002P(struct hda_codec *codec)
parm = present ? AC_PWRST_D3 : AC_PWRST_D0; parm = present ? AC_PWRST_D3 : AC_PWRST_D0;
if (spec->codec_type == VT1802) { if (spec->codec_type == VT1802) {
/* PW15 (33h), MW8(1ch), MUX8(3ch) */ /* PW15 (33h), MW8(1ch), MUX8(3ch) */
snd_hda_codec_write(codec, 0x33, 0, update_power_state(codec, 0x33, parm);
AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x1c, parm);
snd_hda_codec_write(codec, 0x1c, 0, update_power_state(codec, 0x3c, parm);
AC_VERB_SET_POWER_STATE, parm);
snd_hda_codec_write(codec, 0x3c, 0,
AC_VERB_SET_POWER_STATE, parm);
} else { } else {
/* PW15 (31h), MW8(17h), MUX8(3bh) */ /* PW15 (31h), MW8(17h), MUX8(3bh) */
snd_hda_codec_write(codec, 0x31, 0, update_power_state(codec, 0x31, parm);
AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x17, parm);
snd_hda_codec_write(codec, 0x17, 0, update_power_state(codec, 0x3b, parm);
AC_VERB_SET_POWER_STATE, parm);
snd_hda_codec_write(codec, 0x3b, 0,
AC_VERB_SET_POWER_STATE, parm);
} }
/* MW9 (21h) */ /* MW9 (21h) */
if (imux_is_smixer || !is_aa_path_mute(codec)) if (imux_is_smixer || !is_aa_path_mute(codec))
snd_hda_codec_write(codec, 0x21, 0, update_power_state(codec, 0x21, AC_PWRST_D0);
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
else else
snd_hda_codec_write(codec, 0x21, 0, update_power_state(codec, 0x21, AC_PWRST_D3);
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
} }
/* patch for vt2002P */ /* patch for vt2002P */
...@@ -3731,30 +3717,28 @@ static void set_widgets_power_state_vt1812(struct hda_codec *codec) ...@@ -3731,30 +3717,28 @@ static void set_widgets_power_state_vt1812(struct hda_codec *codec)
set_pin_power_state(codec, 0x2b, &parm); set_pin_power_state(codec, 0x2b, &parm);
parm = AC_PWRST_D0; parm = AC_PWRST_D0;
/* MUX10/11 (1eh/1fh), AIW 0/1 (10h/11h) */ /* MUX10/11 (1eh/1fh), AIW 0/1 (10h/11h) */
snd_hda_codec_write(codec, 0x1e, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x1e, parm);
snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x1f, parm);
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x10, parm);
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x11, parm);
/* outputs */ /* outputs */
/* AOW0 (8h)*/ /* AOW0 (8h)*/
snd_hda_codec_write(codec, 0x8, 0, update_power_state(codec, 0x8, AC_PWRST_D0);
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
/* PW4 (28h), MW4 (18h), MUX4(38h) */ /* PW4 (28h), MW4 (18h), MUX4(38h) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x28, &parm); set_pin_power_state(codec, 0x28, &parm);
snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x18, parm);
snd_hda_codec_write(codec, 0x38, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x38, parm);
/* PW1 (25h), MW1 (15h), MUX1(35h), AOW1 (9h) */ /* PW1 (25h), MW1 (15h), MUX1(35h), AOW1 (9h) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x25, &parm); set_pin_power_state(codec, 0x25, &parm);
snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x15, parm);
snd_hda_codec_write(codec, 0x35, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x35, parm);
if (spec->hp_independent_mode) if (spec->hp_independent_mode)
snd_hda_codec_write(codec, 0x9, 0, update_power_state(codec, 0x9, AC_PWRST_D0);
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
/* Internal Speaker */ /* Internal Speaker */
/* PW0 (24h), MW0(14h), MUX0(34h) */ /* PW0 (24h), MW0(14h), MUX0(34h) */
...@@ -3763,15 +3747,11 @@ static void set_widgets_power_state_vt1812(struct hda_codec *codec) ...@@ -3763,15 +3747,11 @@ static void set_widgets_power_state_vt1812(struct hda_codec *codec)
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x24, &parm); set_pin_power_state(codec, 0x24, &parm);
if (present) { if (present) {
snd_hda_codec_write(codec, 0x14, 0, update_power_state(codec, 0x14, AC_PWRST_D3);
AC_VERB_SET_POWER_STATE, AC_PWRST_D3); update_power_state(codec, 0x34, AC_PWRST_D3);
snd_hda_codec_write(codec, 0x34, 0,
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
} else { } else {
snd_hda_codec_write(codec, 0x14, 0, update_power_state(codec, 0x14, AC_PWRST_D0);
AC_VERB_SET_POWER_STATE, AC_PWRST_D0); update_power_state(codec, 0x34, AC_PWRST_D0);
snd_hda_codec_write(codec, 0x34, 0,
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
} }
...@@ -3782,26 +3762,20 @@ static void set_widgets_power_state_vt1812(struct hda_codec *codec) ...@@ -3782,26 +3762,20 @@ static void set_widgets_power_state_vt1812(struct hda_codec *codec)
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x31, &parm); set_pin_power_state(codec, 0x31, &parm);
if (present) { if (present) {
snd_hda_codec_write(codec, 0x1c, 0, update_power_state(codec, 0x1c, AC_PWRST_D3);
AC_VERB_SET_POWER_STATE, AC_PWRST_D3); update_power_state(codec, 0x3c, AC_PWRST_D3);
snd_hda_codec_write(codec, 0x3c, 0, update_power_state(codec, 0x3e, AC_PWRST_D3);
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
snd_hda_codec_write(codec, 0x3e, 0,
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
} else { } else {
snd_hda_codec_write(codec, 0x1c, 0, update_power_state(codec, 0x1c, AC_PWRST_D0);
AC_VERB_SET_POWER_STATE, AC_PWRST_D0); update_power_state(codec, 0x3c, AC_PWRST_D0);
snd_hda_codec_write(codec, 0x3c, 0, update_power_state(codec, 0x3e, AC_PWRST_D0);
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
snd_hda_codec_write(codec, 0x3e, 0,
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
} }
/* PW15 (33h), MW15 (1dh), MUX15(3dh) */ /* PW15 (33h), MW15 (1dh), MUX15(3dh) */
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x33, &parm); set_pin_power_state(codec, 0x33, &parm);
snd_hda_codec_write(codec, 0x1d, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x1d, parm);
snd_hda_codec_write(codec, 0x3d, 0, AC_VERB_SET_POWER_STATE, parm); update_power_state(codec, 0x3d, parm);
} }
......
...@@ -1405,6 +1405,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec, ...@@ -1405,6 +1405,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
regcache_cache_only(wm5100->regmap, true); regcache_cache_only(wm5100->regmap, true);
regcache_mark_dirty(wm5100->regmap);
if (wm5100->pdata.ldo_ena) if (wm5100->pdata.ldo_ena)
gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0); gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0);
regulator_bulk_disable(ARRAY_SIZE(wm5100->core_supplies), regulator_bulk_disable(ARRAY_SIZE(wm5100->core_supplies),
...@@ -2183,6 +2184,7 @@ static void wm5100_micd_irq(struct snd_soc_codec *codec) ...@@ -2183,6 +2184,7 @@ static void wm5100_micd_irq(struct snd_soc_codec *codec)
if (wm5100->jack_detecting) { if (wm5100->jack_detecting) {
dev_dbg(codec->dev, "Microphone detected\n"); dev_dbg(codec->dev, "Microphone detected\n");
wm5100->jack_mic = true; wm5100->jack_mic = true;
wm5100->jack_detecting = false;
snd_soc_jack_report(wm5100->jack, snd_soc_jack_report(wm5100->jack,
SND_JACK_HEADSET, SND_JACK_HEADSET,
SND_JACK_HEADSET | SND_JACK_BTN_0); SND_JACK_HEADSET | SND_JACK_BTN_0);
...@@ -2221,6 +2223,7 @@ static void wm5100_micd_irq(struct snd_soc_codec *codec) ...@@ -2221,6 +2223,7 @@ static void wm5100_micd_irq(struct snd_soc_codec *codec)
SND_JACK_BTN_0); SND_JACK_BTN_0);
} else if (wm5100->jack_detecting) { } else if (wm5100->jack_detecting) {
dev_dbg(codec->dev, "Headphone detected\n"); dev_dbg(codec->dev, "Headphone detected\n");
wm5100->jack_detecting = false;
snd_soc_jack_report(wm5100->jack, SND_JACK_HEADPHONE, snd_soc_jack_report(wm5100->jack, SND_JACK_HEADPHONE,
SND_JACK_HEADPHONE); SND_JACK_HEADPHONE);
...@@ -2610,6 +2613,13 @@ static const struct regmap_config wm5100_regmap = { ...@@ -2610,6 +2613,13 @@ static const struct regmap_config wm5100_regmap = {
.cache_type = REGCACHE_RBTREE, .cache_type = REGCACHE_RBTREE,
}; };
static const unsigned int wm5100_mic_ctrl_reg[] = {
WM5100_IN1L_CONTROL,
WM5100_IN2L_CONTROL,
WM5100_IN3L_CONTROL,
WM5100_IN4L_CONTROL,
};
static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
...@@ -2742,7 +2752,7 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, ...@@ -2742,7 +2752,7 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
} }
for (i = 0; i < ARRAY_SIZE(wm5100->pdata.in_mode); i++) { for (i = 0; i < ARRAY_SIZE(wm5100->pdata.in_mode); i++) {
regmap_update_bits(wm5100->regmap, WM5100_IN1L_CONTROL, regmap_update_bits(wm5100->regmap, wm5100_mic_ctrl_reg[i],
WM5100_IN1_MODE_MASK | WM5100_IN1_MODE_MASK |
WM5100_IN1_DMIC_SUP_MASK, WM5100_IN1_DMIC_SUP_MASK,
(wm5100->pdata.in_mode[i] << (wm5100->pdata.in_mode[i] <<
......
...@@ -96,7 +96,7 @@ static int wm8962_regulator_event_##n(struct notifier_block *nb, \ ...@@ -96,7 +96,7 @@ static int wm8962_regulator_event_##n(struct notifier_block *nb, \
struct wm8962_priv *wm8962 = container_of(nb, struct wm8962_priv, \ struct wm8962_priv *wm8962 = container_of(nb, struct wm8962_priv, \
disable_nb[n]); \ disable_nb[n]); \
if (event & REGULATOR_EVENT_DISABLE) { \ if (event & REGULATOR_EVENT_DISABLE) { \
regcache_cache_only(wm8962->regmap, true); \ regcache_mark_dirty(wm8962->regmap); \
} \ } \
return 0; \ return 0; \
} }
......
...@@ -108,7 +108,7 @@ static int wm8996_regulator_event_##n(struct notifier_block *nb, \ ...@@ -108,7 +108,7 @@ static int wm8996_regulator_event_##n(struct notifier_block *nb, \
struct wm8996_priv *wm8996 = container_of(nb, struct wm8996_priv, \ struct wm8996_priv *wm8996 = container_of(nb, struct wm8996_priv, \
disable_nb[n]); \ disable_nb[n]); \
if (event & REGULATOR_EVENT_DISABLE) { \ if (event & REGULATOR_EVENT_DISABLE) { \
regcache_cache_only(wm8996->regmap, true); \ regcache_mark_dirty(wm8996->regmap); \
} \ } \
return 0; \ return 0; \
} }
......
...@@ -592,8 +592,8 @@ SOC_DAPM_SINGLE("Output Switch", WM8993_LINE_MIXER2, 0, 1, 0), ...@@ -592,8 +592,8 @@ SOC_DAPM_SINGLE("Output Switch", WM8993_LINE_MIXER2, 0, 1, 0),
}; };
static const struct snd_kcontrol_new line2n_mix[] = { static const struct snd_kcontrol_new line2n_mix[] = {
SOC_DAPM_SINGLE("Left Output Switch", WM8993_LINE_MIXER2, 6, 1, 0), SOC_DAPM_SINGLE("Left Output Switch", WM8993_LINE_MIXER2, 5, 1, 0),
SOC_DAPM_SINGLE("Right Output Switch", WM8993_LINE_MIXER2, 5, 1, 0), SOC_DAPM_SINGLE("Right Output Switch", WM8993_LINE_MIXER2, 6, 1, 0),
}; };
static const struct snd_kcontrol_new line2p_mix[] = { static const struct snd_kcontrol_new line2p_mix[] = {
...@@ -613,6 +613,8 @@ SND_SOC_DAPM_INPUT("IN2RP:VXRP"), ...@@ -613,6 +613,8 @@ SND_SOC_DAPM_INPUT("IN2RP:VXRP"),
SND_SOC_DAPM_SUPPLY("MICBIAS2", WM8993_POWER_MANAGEMENT_1, 5, 0, NULL, 0), SND_SOC_DAPM_SUPPLY("MICBIAS2", WM8993_POWER_MANAGEMENT_1, 5, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("MICBIAS1", WM8993_POWER_MANAGEMENT_1, 4, 0, NULL, 0), SND_SOC_DAPM_SUPPLY("MICBIAS1", WM8993_POWER_MANAGEMENT_1, 4, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("LINEOUT_VMID_BUF", WM8993_ANTIPOP1, 7, 0, NULL, 0),
SND_SOC_DAPM_MIXER("IN1L PGA", WM8993_POWER_MANAGEMENT_2, 6, 0, SND_SOC_DAPM_MIXER("IN1L PGA", WM8993_POWER_MANAGEMENT_2, 6, 0,
in1l_pga, ARRAY_SIZE(in1l_pga)), in1l_pga, ARRAY_SIZE(in1l_pga)),
SND_SOC_DAPM_MIXER("IN1R PGA", WM8993_POWER_MANAGEMENT_2, 4, 0, SND_SOC_DAPM_MIXER("IN1R PGA", WM8993_POWER_MANAGEMENT_2, 4, 0,
...@@ -834,9 +836,11 @@ static const struct snd_soc_dapm_route lineout1_diff_routes[] = { ...@@ -834,9 +836,11 @@ static const struct snd_soc_dapm_route lineout1_diff_routes[] = {
}; };
static const struct snd_soc_dapm_route lineout1_se_routes[] = { static const struct snd_soc_dapm_route lineout1_se_routes[] = {
{ "LINEOUT1N Mixer", NULL, "LINEOUT_VMID_BUF" },
{ "LINEOUT1N Mixer", "Left Output Switch", "Left Output PGA" }, { "LINEOUT1N Mixer", "Left Output Switch", "Left Output PGA" },
{ "LINEOUT1N Mixer", "Right Output Switch", "Right Output PGA" }, { "LINEOUT1N Mixer", "Right Output Switch", "Right Output PGA" },
{ "LINEOUT1P Mixer", NULL, "LINEOUT_VMID_BUF" },
{ "LINEOUT1P Mixer", "Left Output Switch", "Left Output PGA" }, { "LINEOUT1P Mixer", "Left Output Switch", "Left Output PGA" },
{ "LINEOUT1N Driver", NULL, "LINEOUT1N Mixer" }, { "LINEOUT1N Driver", NULL, "LINEOUT1N Mixer" },
...@@ -853,9 +857,11 @@ static const struct snd_soc_dapm_route lineout2_diff_routes[] = { ...@@ -853,9 +857,11 @@ static const struct snd_soc_dapm_route lineout2_diff_routes[] = {
}; };
static const struct snd_soc_dapm_route lineout2_se_routes[] = { static const struct snd_soc_dapm_route lineout2_se_routes[] = {
{ "LINEOUT2N Mixer", NULL, "LINEOUT_VMID_BUF" },
{ "LINEOUT2N Mixer", "Left Output Switch", "Left Output PGA" }, { "LINEOUT2N Mixer", "Left Output Switch", "Left Output PGA" },
{ "LINEOUT2N Mixer", "Right Output Switch", "Right Output PGA" }, { "LINEOUT2N Mixer", "Right Output Switch", "Right Output PGA" },
{ "LINEOUT2P Mixer", NULL, "LINEOUT_VMID_BUF" },
{ "LINEOUT2P Mixer", "Right Output Switch", "Right Output PGA" }, { "LINEOUT2P Mixer", "Right Output Switch", "Right Output PGA" },
{ "LINEOUT2N Driver", NULL, "LINEOUT2N Mixer" }, { "LINEOUT2N Driver", NULL, "LINEOUT2N Mixer" },
......
...@@ -230,8 +230,6 @@ static const struct snd_kcontrol_new neo1973_wm8753_controls[] = { ...@@ -230,8 +230,6 @@ static const struct snd_kcontrol_new neo1973_wm8753_controls[] = {
/* GTA02 specific routes and controls */ /* GTA02 specific routes and controls */
#ifdef CONFIG_MACH_NEO1973_GTA02
static int gta02_speaker_enabled; static int gta02_speaker_enabled;
static int lm4853_set_spk(struct snd_kcontrol *kcontrol, static int lm4853_set_spk(struct snd_kcontrol *kcontrol,
...@@ -311,10 +309,6 @@ static int neo1973_gta02_wm8753_init(struct snd_soc_codec *codec) ...@@ -311,10 +309,6 @@ static int neo1973_gta02_wm8753_init(struct snd_soc_codec *codec)
return 0; return 0;
} }
#else
static int neo1973_gta02_wm8753_init(struct snd_soc_code *codec) { return 0; }
#endif
static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd) static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
...@@ -322,10 +316,6 @@ static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd) ...@@ -322,10 +316,6 @@ static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd)
int ret; int ret;
/* set up NC codec pins */ /* set up NC codec pins */
if (machine_is_neo1973_gta01()) {
snd_soc_dapm_nc_pin(dapm, "LOUT2");
snd_soc_dapm_nc_pin(dapm, "ROUT2");
}
snd_soc_dapm_nc_pin(dapm, "OUT3"); snd_soc_dapm_nc_pin(dapm, "OUT3");
snd_soc_dapm_nc_pin(dapm, "OUT4"); snd_soc_dapm_nc_pin(dapm, "OUT4");
snd_soc_dapm_nc_pin(dapm, "LINE1"); snd_soc_dapm_nc_pin(dapm, "LINE1");
...@@ -370,50 +360,6 @@ static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd) ...@@ -370,50 +360,6 @@ static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd)
return 0; return 0;
} }
/* GTA01 specific controls */
#ifdef CONFIG_MACH_NEO1973_GTA01
static const struct snd_soc_dapm_route neo1973_lm4857_routes[] = {
{"Amp IN", NULL, "ROUT1"},
{"Amp IN", NULL, "LOUT1"},
{"Handset Spk", NULL, "Amp EP"},
{"Stereo Out", NULL, "Amp LS"},
{"Headphone", NULL, "Amp HP"},
};
static const struct snd_soc_dapm_widget neo1973_lm4857_dapm_widgets[] = {
SND_SOC_DAPM_SPK("Handset Spk", NULL),
SND_SOC_DAPM_SPK("Stereo Out", NULL),
SND_SOC_DAPM_HP("Headphone", NULL),
};
static int neo1973_lm4857_init(struct snd_soc_dapm_context *dapm)
{
int ret;
ret = snd_soc_dapm_new_controls(dapm, neo1973_lm4857_dapm_widgets,
ARRAY_SIZE(neo1973_lm4857_dapm_widgets));
if (ret)
return ret;
ret = snd_soc_dapm_add_routes(dapm, neo1973_lm4857_routes,
ARRAY_SIZE(neo1973_lm4857_routes));
if (ret)
return ret;
snd_soc_dapm_ignore_suspend(dapm, "Stereo Out");
snd_soc_dapm_ignore_suspend(dapm, "Handset Spk");
snd_soc_dapm_ignore_suspend(dapm, "Headphone");
return 0;
}
#else
static int neo1973_lm4857_init(struct snd_soc_dapm_context *dapm) { return 0; };
#endif
static struct snd_soc_dai_link neo1973_dai[] = { static struct snd_soc_dai_link neo1973_dai[] = {
{ /* Hifi Playback - for similatious use with voice below */ { /* Hifi Playback - for similatious use with voice below */
.name = "WM8753", .name = "WM8753",
...@@ -440,11 +386,6 @@ static struct snd_soc_aux_dev neo1973_aux_devs[] = { ...@@ -440,11 +386,6 @@ static struct snd_soc_aux_dev neo1973_aux_devs[] = {
.name = "dfbmcs320", .name = "dfbmcs320",
.codec_name = "dfbmcs320.0", .codec_name = "dfbmcs320.0",
}, },
{
.name = "lm4857",
.codec_name = "lm4857.0-007c",
.init = neo1973_lm4857_init,
},
}; };
static struct snd_soc_codec_conf neo1973_codec_conf[] = { static struct snd_soc_codec_conf neo1973_codec_conf[] = {
...@@ -454,14 +395,10 @@ static struct snd_soc_codec_conf neo1973_codec_conf[] = { ...@@ -454,14 +395,10 @@ static struct snd_soc_codec_conf neo1973_codec_conf[] = {
}, },
}; };
#ifdef CONFIG_MACH_NEO1973_GTA02
static const struct gpio neo1973_gta02_gpios[] = { static const struct gpio neo1973_gta02_gpios[] = {
{ GTA02_GPIO_HP_IN, GPIOF_OUT_INIT_HIGH, "GTA02_HP_IN" }, { GTA02_GPIO_HP_IN, GPIOF_OUT_INIT_HIGH, "GTA02_HP_IN" },
{ GTA02_GPIO_AMP_SHUT, GPIOF_OUT_INIT_HIGH, "GTA02_AMP_SHUT" }, { GTA02_GPIO_AMP_SHUT, GPIOF_OUT_INIT_HIGH, "GTA02_AMP_SHUT" },
}; };
#else
static const struct gpio neo1973_gta02_gpios[] = {};
#endif
static struct snd_soc_card neo1973 = { static struct snd_soc_card neo1973 = {
.name = "neo1973", .name = "neo1973",
...@@ -480,7 +417,7 @@ static int __init neo1973_init(void) ...@@ -480,7 +417,7 @@ static int __init neo1973_init(void)
{ {
int ret; int ret;
if (!machine_is_neo1973_gta01() && !machine_is_neo1973_gta02()) if (!machine_is_neo1973_gta02())
return -ENODEV; return -ENODEV;
if (machine_is_neo1973_gta02()) { if (machine_is_neo1973_gta02()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment