Merge branch 'fix/hda' into topic/hda

The changes for slave controls in patch_realtek.c must be merged for the
further works.
This commit is contained in:
Takashi Iwai 2012-02-03 14:06:36 +01:00
commit 1299d33020
21 changed files with 350 additions and 348 deletions

View File

@ -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);
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 */

View File

@ -441,19 +441,22 @@ snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
params = kmalloc(sizeof(*params), GFP_KERNEL); params = kmalloc(sizeof(*params), GFP_KERNEL);
if (!params) if (!params)
return -ENOMEM; return -ENOMEM;
if (copy_from_user(params, (void __user *)arg, sizeof(*params))) if (copy_from_user(params, (void __user *)arg, sizeof(*params))) {
return -EFAULT; retval = -EFAULT;
goto out;
}
retval = snd_compr_allocate_buffer(stream, params); retval = snd_compr_allocate_buffer(stream, params);
if (retval) { if (retval) {
kfree(params); retval = -ENOMEM;
return -ENOMEM; goto out;
} }
retval = stream->ops->set_params(stream, params); retval = stream->ops->set_params(stream, params);
if (retval) if (retval)
goto out; goto out;
stream->runtime->state = SNDRV_PCM_STATE_SETUP; stream->runtime->state = SNDRV_PCM_STATE_SETUP;
} else } else {
return -EPERM; return -EPERM;
}
out: out:
kfree(params); kfree(params);
return retval; return retval;

View File

@ -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;
} }
} }

View File

@ -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,
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,
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;

View File

@ -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) {
spec->last_input = spec->cur_input; if (spec->cur_input != spec->automic_idx) {
spec->cur_input = spec->automic_idx; spec->last_input = spec->cur_input;
spec->cur_input = spec->automic_idx;
}
} else { } else {
spec->cur_input = spec->last_input; spec->cur_input = spec->last_input;
} }

View File

@ -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,
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,
@ -1843,6 +1855,8 @@ static const char * const alc_slave_vols[] = {
"Speaker Playback Volume", "Speaker Playback Volume",
"Mono Playback Volume", "Mono Playback Volume",
"Line-Out Playback Volume", "Line-Out Playback Volume",
"CLFE Playback Volume",
"Bass Speaker Playback Volume",
"PCM Playback Volume", "PCM Playback Volume",
NULL, NULL,
}; };
@ -1858,6 +1872,8 @@ static const char * const alc_slave_sws[] = {
"Mono Playback Switch", "Mono Playback Switch",
"IEC958 Playback Switch", "IEC958 Playback Switch",
"Line-Out Playback Switch", "Line-Out Playback Switch",
"CLFE Playback Switch",
"Bass Speaker Playback Switch",
"PCM Playback Switch", "PCM Playback Switch",
NULL, NULL,
}; };
@ -4735,7 +4751,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 +4780,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 +4812,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 +5380,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),
@ -5586,8 +5588,28 @@ static const struct hda_amp_list alc861_loopbacks[] = {
/* Pin config fixes */ /* Pin config fixes */
enum { enum {
PINFIX_FSC_AMILO_PI1505, PINFIX_FSC_AMILO_PI1505,
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,
@ -5597,9 +5619,15 @@ static const struct alc_fixup alc861_fixups[] = {
{ } { }
} }
}, },
[PINFIX_ASUS_A6RP] = {
.type = ALC_FIXUP_FUNC,
.v.func = alc861_fixup_asus_amp_vref_0f,
},
}; };
static const struct snd_pci_quirk alc861_fixup_tbl[] = { static const struct snd_pci_quirk alc861_fixup_tbl[] = {
SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", 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),
{} {}
}; };

View File

@ -4163,13 +4163,15 @@ static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
return 1; return 1;
} }
static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid) static int is_nid_out_jack_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
{ {
int i; int i;
for (i = 0; i < cfg->hp_outs; i++) for (i = 0; i < cfg->hp_outs; i++)
if (cfg->hp_pins[i] == nid) if (cfg->hp_pins[i] == nid)
return 1; /* nid is a HP-Out */ return 1; /* nid is a HP-Out */
for (i = 0; i < cfg->line_outs; i++)
if (cfg->line_out_pins[i] == nid)
return 1; /* nid is a line-Out */
return 0; /* nid is not a HP-Out */ return 0; /* nid is not a HP-Out */
}; };
@ -4375,7 +4377,7 @@ static int stac92xx_init(struct hda_codec *codec)
continue; continue;
} }
if (is_nid_hp_pin(cfg, nid)) if (is_nid_out_jack_pin(cfg, nid))
continue; /* already has an unsol event */ continue; /* already has an unsol event */
pinctl = snd_hda_codec_read(codec, nid, 0, pinctl = snd_hda_codec_read(codec, nid, 0,
@ -4868,7 +4870,14 @@ static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
/* BIOS bug: unfilled OEM string */ /* BIOS bug: unfilled OEM string */
if (strstr(dev->name, "HP_Mute_LED_P_G")) { if (strstr(dev->name, "HP_Mute_LED_P_G")) {
set_hp_led_gpio(codec); set_hp_led_gpio(codec);
spec->gpio_led_polarity = 1; switch (codec->subsystem_id) {
case 0x103c148a:
spec->gpio_led_polarity = 0;
break;
default:
spec->gpio_led_polarity = 1;
break;
}
return 1; return 1;
} }
} }

View File

@ -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)
} }
} }
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,
} 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,
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)
} }
/* 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)
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)
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)
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,
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
/* 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)
/* 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)
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)
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)
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)
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)
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)
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)
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)
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);
} }

View File

@ -286,17 +286,22 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
if ((err = snd_ymfpci_pcm_4ch(chip, 2, NULL)) < 0) { err = snd_ymfpci_mixer(chip, rear_switch[dev]);
if (err < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
if ((err = snd_ymfpci_pcm2(chip, 3, NULL)) < 0) { if (chip->ac97->ext_id & AC97_EI_SDAC) {
snd_card_free(card); err = snd_ymfpci_pcm_4ch(chip, 2, NULL);
return err; if (err < 0) {
} snd_card_free(card);
if ((err = snd_ymfpci_mixer(chip, rear_switch[dev])) < 0) { return err;
snd_card_free(card); }
return err; err = snd_ymfpci_pcm2(chip, 3, NULL);
if (err < 0) {
snd_card_free(card);
return err;
}
} }
if ((err = snd_ymfpci_timer(chip, 0)) < 0) { if ((err = snd_ymfpci_timer(chip, 0)) < 0) {
snd_card_free(card); snd_card_free(card);

View File

@ -1614,6 +1614,14 @@ static int snd_ymfpci_put_dup4ch(struct snd_kcontrol *kcontrol, struct snd_ctl_e
return change; return change;
} }
static struct snd_kcontrol_new snd_ymfpci_dup4ch __devinitdata = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "4ch Duplication",
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
.info = snd_ymfpci_info_dup4ch,
.get = snd_ymfpci_get_dup4ch,
.put = snd_ymfpci_put_dup4ch,
};
static struct snd_kcontrol_new snd_ymfpci_controls[] __devinitdata = { static struct snd_kcontrol_new snd_ymfpci_controls[] __devinitdata = {
{ {
@ -1642,13 +1650,6 @@ YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,VOLUME), 1, YDSXGR_SPDIFLOOPVOL),
YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL, 0), YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL, 0),
YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL, 0), YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL, 0),
YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("Loop",NONE,NONE), 0, YDSXGR_SPDIFINCTRL, 4), YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("Loop",NONE,NONE), 0, YDSXGR_SPDIFINCTRL, 4),
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "4ch Duplication",
.info = snd_ymfpci_info_dup4ch,
.get = snd_ymfpci_get_dup4ch,
.put = snd_ymfpci_put_dup4ch,
},
}; };
@ -1838,6 +1839,12 @@ int __devinit snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch)
if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_controls[idx], chip))) < 0) if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_controls[idx], chip))) < 0)
return err; return err;
} }
if (chip->ac97->ext_id & AC97_EI_SDAC) {
kctl = snd_ctl_new1(&snd_ymfpci_dup4ch, chip);
err = snd_ctl_add(chip->card, kctl);
if (err < 0)
return err;
}
/* add S/PDIF control */ /* add S/PDIF control */
if (snd_BUG_ON(!chip->pcm_spdif)) if (snd_BUG_ON(!chip->pcm_spdif))

View File

@ -987,12 +987,12 @@ static int sgtl5000_restore_regs(struct snd_soc_codec *codec)
/* restore regular registers */ /* restore regular registers */
for (reg = 0; reg <= SGTL5000_CHIP_SHORT_CTRL; reg += 2) { for (reg = 0; reg <= SGTL5000_CHIP_SHORT_CTRL; reg += 2) {
/* this regs depends on the others */ /* These regs should restore in particular order */
if (reg == SGTL5000_CHIP_ANA_POWER || if (reg == SGTL5000_CHIP_ANA_POWER ||
reg == SGTL5000_CHIP_CLK_CTRL || reg == SGTL5000_CHIP_CLK_CTRL ||
reg == SGTL5000_CHIP_LINREG_CTRL || reg == SGTL5000_CHIP_LINREG_CTRL ||
reg == SGTL5000_CHIP_LINE_OUT_CTRL || reg == SGTL5000_CHIP_LINE_OUT_CTRL ||
reg == SGTL5000_CHIP_CLK_CTRL) reg == SGTL5000_CHIP_REF_CTRL)
continue; continue;
snd_soc_write(codec, reg, cache[reg]); snd_soc_write(codec, reg, cache[reg]);
@ -1003,8 +1003,17 @@ static int sgtl5000_restore_regs(struct snd_soc_codec *codec)
snd_soc_write(codec, reg, cache[reg]); snd_soc_write(codec, reg, cache[reg]);
/* /*
* restore power and other regs according * restore these regs according to the power setting sequence in
* to set_power() and set_clock() * sgtl5000_set_power_regs() and clock setting sequence in
* sgtl5000_set_clock().
*
* The order of restore is:
* 1. SGTL5000_CHIP_CLK_CTRL MCLK_FREQ bits (1:0) should be restore after
* SGTL5000_CHIP_ANA_POWER PLL bits set
* 2. SGTL5000_CHIP_LINREG_CTRL should be set before
* SGTL5000_CHIP_ANA_POWER LINREG_D restored
* 3. SGTL5000_CHIP_REF_CTRL controls Analog Ground Voltage,
* prefer to resotre it after SGTL5000_CHIP_ANA_POWER restored
*/ */
snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL, snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL,
cache[SGTL5000_CHIP_LINREG_CTRL]); cache[SGTL5000_CHIP_LINREG_CTRL]);

View File

@ -60,7 +60,6 @@ struct aic32x4_rate_divs {
struct aic32x4_priv { struct aic32x4_priv {
u32 sysclk; u32 sysclk;
s32 master;
u8 page_no; u8 page_no;
void *control_data; void *control_data;
u32 power_cfg; u32 power_cfg;
@ -369,7 +368,6 @@ static int aic32x4_set_dai_sysclk(struct snd_soc_dai *codec_dai,
static int aic32x4_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) static int aic32x4_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_codec *codec = codec_dai->codec;
struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec);
u8 iface_reg_1; u8 iface_reg_1;
u8 iface_reg_2; u8 iface_reg_2;
u8 iface_reg_3; u8 iface_reg_3;
@ -384,11 +382,9 @@ static int aic32x4_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
/* set master/slave audio interface */ /* set master/slave audio interface */
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBM_CFM: case SND_SOC_DAIFMT_CBM_CFM:
aic32x4->master = 1;
iface_reg_1 |= AIC32X4_BCLKMASTER | AIC32X4_WCLKMASTER; iface_reg_1 |= AIC32X4_BCLKMASTER | AIC32X4_WCLKMASTER;
break; break;
case SND_SOC_DAIFMT_CBS_CFS: case SND_SOC_DAIFMT_CBS_CFS:
aic32x4->master = 0;
break; break;
default: default:
printk(KERN_ERR "aic32x4: invalid DAI master/slave interface\n"); printk(KERN_ERR "aic32x4: invalid DAI master/slave interface\n");
@ -526,64 +522,58 @@ static int aic32x4_mute(struct snd_soc_dai *dai, int mute)
static int aic32x4_set_bias_level(struct snd_soc_codec *codec, static int aic32x4_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec);
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
if (aic32x4->master) { /* Switch on PLL */
/* Switch on PLL */ snd_soc_update_bits(codec, AIC32X4_PLLPR,
snd_soc_update_bits(codec, AIC32X4_PLLPR, AIC32X4_PLLEN, AIC32X4_PLLEN);
AIC32X4_PLLEN, AIC32X4_PLLEN);
/* Switch on NDAC Divider */ /* Switch on NDAC Divider */
snd_soc_update_bits(codec, AIC32X4_NDAC, snd_soc_update_bits(codec, AIC32X4_NDAC,
AIC32X4_NDACEN, AIC32X4_NDACEN); AIC32X4_NDACEN, AIC32X4_NDACEN);
/* Switch on MDAC Divider */ /* Switch on MDAC Divider */
snd_soc_update_bits(codec, AIC32X4_MDAC, snd_soc_update_bits(codec, AIC32X4_MDAC,
AIC32X4_MDACEN, AIC32X4_MDACEN); AIC32X4_MDACEN, AIC32X4_MDACEN);
/* Switch on NADC Divider */ /* Switch on NADC Divider */
snd_soc_update_bits(codec, AIC32X4_NADC, snd_soc_update_bits(codec, AIC32X4_NADC,
AIC32X4_NADCEN, AIC32X4_NADCEN); AIC32X4_NADCEN, AIC32X4_NADCEN);
/* Switch on MADC Divider */ /* Switch on MADC Divider */
snd_soc_update_bits(codec, AIC32X4_MADC, snd_soc_update_bits(codec, AIC32X4_MADC,
AIC32X4_MADCEN, AIC32X4_MADCEN); AIC32X4_MADCEN, AIC32X4_MADCEN);
/* Switch on BCLK_N Divider */ /* Switch on BCLK_N Divider */
snd_soc_update_bits(codec, AIC32X4_BCLKN, snd_soc_update_bits(codec, AIC32X4_BCLKN,
AIC32X4_BCLKEN, AIC32X4_BCLKEN); AIC32X4_BCLKEN, AIC32X4_BCLKEN);
}
break; break;
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (aic32x4->master) { /* Switch off PLL */
/* Switch off PLL */ snd_soc_update_bits(codec, AIC32X4_PLLPR,
snd_soc_update_bits(codec, AIC32X4_PLLPR, AIC32X4_PLLEN, 0);
AIC32X4_PLLEN, 0);
/* Switch off NDAC Divider */ /* Switch off NDAC Divider */
snd_soc_update_bits(codec, AIC32X4_NDAC, snd_soc_update_bits(codec, AIC32X4_NDAC,
AIC32X4_NDACEN, 0); AIC32X4_NDACEN, 0);
/* Switch off MDAC Divider */ /* Switch off MDAC Divider */
snd_soc_update_bits(codec, AIC32X4_MDAC, snd_soc_update_bits(codec, AIC32X4_MDAC,
AIC32X4_MDACEN, 0); AIC32X4_MDACEN, 0);
/* Switch off NADC Divider */ /* Switch off NADC Divider */
snd_soc_update_bits(codec, AIC32X4_NADC, snd_soc_update_bits(codec, AIC32X4_NADC,
AIC32X4_NADCEN, 0); AIC32X4_NADCEN, 0);
/* Switch off MADC Divider */ /* Switch off MADC Divider */
snd_soc_update_bits(codec, AIC32X4_MADC, snd_soc_update_bits(codec, AIC32X4_MADC,
AIC32X4_MADCEN, 0); AIC32X4_MADCEN, 0);
/* Switch off BCLK_N Divider */ /* Switch off BCLK_N Divider */
snd_soc_update_bits(codec, AIC32X4_BCLKN, snd_soc_update_bits(codec, AIC32X4_BCLKN,
AIC32X4_BCLKEN, 0); AIC32X4_BCLKEN, 0);
}
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
break; break;
@ -651,9 +641,11 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
if (aic32x4->power_cfg & AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE) { if (aic32x4->power_cfg & AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE) {
snd_soc_write(codec, AIC32X4_PWRCFG, AIC32X4_AVDDWEAKDISABLE); snd_soc_write(codec, AIC32X4_PWRCFG, AIC32X4_AVDDWEAKDISABLE);
} }
if (aic32x4->power_cfg & AIC32X4_PWR_AIC32X4_LDO_ENABLE) {
snd_soc_write(codec, AIC32X4_LDOCTL, AIC32X4_LDOCTLEN); tmp_reg = (aic32x4->power_cfg & AIC32X4_PWR_AIC32X4_LDO_ENABLE) ?
} AIC32X4_LDOCTLEN : 0;
snd_soc_write(codec, AIC32X4_LDOCTL, tmp_reg);
tmp_reg = snd_soc_read(codec, AIC32X4_CMMODE); tmp_reg = snd_soc_read(codec, AIC32X4_CMMODE);
if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36) { if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36) {
tmp_reg |= AIC32X4_LDOIN_18_36; tmp_reg |= AIC32X4_LDOIN_18_36;

View File

@ -733,8 +733,9 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
struct wm2000_priv *wm2000; struct wm2000_priv *wm2000;
struct wm2000_platform_data *pdata; struct wm2000_platform_data *pdata;
const char *filename; const char *filename;
const struct firmware *fw; const struct firmware *fw = NULL;
int reg, ret; int ret;
int reg;
u16 id; u16 id;
wm2000 = devm_kzalloc(&i2c->dev, sizeof(struct wm2000_priv), wm2000 = devm_kzalloc(&i2c->dev, sizeof(struct wm2000_priv),
@ -751,7 +752,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
ret = PTR_ERR(wm2000->regmap); ret = PTR_ERR(wm2000->regmap);
dev_err(&i2c->dev, "Failed to allocate register map: %d\n", dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
ret); ret);
goto err; goto out;
} }
/* Verify that this is a WM2000 */ /* Verify that this is a WM2000 */
@ -763,7 +764,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
if (id != 0x2000) { if (id != 0x2000) {
dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id); dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id);
ret = -ENODEV; ret = -ENODEV;
goto err_regmap; goto out_regmap_exit;
} }
reg = wm2000_read(i2c, WM2000_REG_REVISON); reg = wm2000_read(i2c, WM2000_REG_REVISON);
@ -782,7 +783,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
ret = request_firmware(&fw, filename, &i2c->dev); ret = request_firmware(&fw, filename, &i2c->dev);
if (ret != 0) { if (ret != 0) {
dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret); dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret);
goto err_regmap; goto out_regmap_exit;
} }
/* Pre-cook the concatenation of the register address onto the image */ /* Pre-cook the concatenation of the register address onto the image */
@ -793,15 +794,13 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
if (wm2000->anc_download == NULL) { if (wm2000->anc_download == NULL) {
dev_err(&i2c->dev, "Out of memory\n"); dev_err(&i2c->dev, "Out of memory\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_fw; goto out_regmap_exit;
} }
wm2000->anc_download[0] = 0x80; wm2000->anc_download[0] = 0x80;
wm2000->anc_download[1] = 0x00; wm2000->anc_download[1] = 0x00;
memcpy(wm2000->anc_download + 2, fw->data, fw->size); memcpy(wm2000->anc_download + 2, fw->data, fw->size);
release_firmware(fw);
wm2000->anc_eng_ena = 1; wm2000->anc_eng_ena = 1;
wm2000->anc_active = 1; wm2000->anc_active = 1;
wm2000->spk_ena = 1; wm2000->spk_ena = 1;
@ -809,18 +808,14 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
wm2000_reset(wm2000); wm2000_reset(wm2000);
ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, NULL, 0);
NULL, 0); if (!ret)
if (ret != 0) goto out;
goto err_fw;
return 0; out_regmap_exit:
err_fw:
release_firmware(fw);
err_regmap:
regmap_exit(wm2000->regmap); regmap_exit(wm2000->regmap);
err: out:
release_firmware(fw);
return ret; return ret;
} }

View File

@ -1377,6 +1377,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
switch (wm5100->rev) { switch (wm5100->rev) {
case 0: case 0:
regcache_cache_bypass(wm5100->regmap, true);
snd_soc_write(codec, 0x11, 0x3); snd_soc_write(codec, 0x11, 0x3);
snd_soc_write(codec, 0x203, 0xc); snd_soc_write(codec, 0x203, 0xc);
snd_soc_write(codec, 0x206, 0); snd_soc_write(codec, 0x206, 0);
@ -1392,6 +1393,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
snd_soc_write(codec, snd_soc_write(codec,
wm5100_reva_patches[i].reg, wm5100_reva_patches[i].reg,
wm5100_reva_patches[i].val); wm5100_reva_patches[i].val);
regcache_cache_bypass(wm5100->regmap, false);
break; break;
default: default:
break; break;
@ -1402,6 +1404,8 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
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),
@ -2180,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);
@ -2218,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);
@ -2607,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)
{ {
@ -2739,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] <<

View File

@ -55,7 +55,7 @@ static int wm8958_dsp2_fw(struct snd_soc_codec *codec, const char *name,
return 0; return 0;
if (fw->size < 32) { if (fw->size < 32) {
dev_err(codec->dev, "%s: firmware too short (%d bytes)\n", dev_err(codec->dev, "%s: firmware too short (%zd bytes)\n",
name, fw->size); name, fw->size);
goto err; goto err;
} }

View File

@ -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; \
} }

View File

@ -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; \
} }
@ -1120,7 +1120,8 @@ SND_SOC_DAPM_SUPPLY_S("SYSCLK", 1, WM8996_AIF_CLOCKING_1, 0, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY_S("SYSDSPCLK", 2, WM8996_CLOCKING_1, 1, 0, NULL, 0), SND_SOC_DAPM_SUPPLY_S("SYSDSPCLK", 2, WM8996_CLOCKING_1, 1, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY_S("AIFCLK", 2, WM8996_CLOCKING_1, 2, 0, NULL, 0), SND_SOC_DAPM_SUPPLY_S("AIFCLK", 2, WM8996_CLOCKING_1, 2, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY_S("Charge Pump", 2, WM8996_CHARGE_PUMP_1, 15, 0, cp_event, SND_SOC_DAPM_SUPPLY_S("Charge Pump", 2, WM8996_CHARGE_PUMP_1, 15, 0, cp_event,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_SUPPLY("Bandgap", SND_SOC_NOPM, 0, 0, bg_event, SND_SOC_DAPM_SUPPLY("Bandgap", SND_SOC_NOPM, 0, 0, bg_event,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_SUPPLY("LDO2", WM8996_POWER_MANAGEMENT_2, 1, 0, NULL, 0), SND_SOC_DAPM_SUPPLY("LDO2", WM8996_POWER_MANAGEMENT_2, 1, 0, NULL, 0),
@ -2007,6 +2008,7 @@ static int wm8996_set_sysclk(struct snd_soc_dai *dai,
struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
int lfclk = 0; int lfclk = 0;
int ratediv = 0; int ratediv = 0;
int sync = WM8996_REG_SYNC;
int src; int src;
int old; int old;
@ -2051,6 +2053,7 @@ static int wm8996_set_sysclk(struct snd_soc_dai *dai,
case 32000: case 32000:
case 32768: case 32768:
lfclk = WM8996_LFCLK_ENA; lfclk = WM8996_LFCLK_ENA;
sync = 0;
break; break;
default: default:
dev_warn(codec->dev, "Unsupported clock rate %dHz\n", dev_warn(codec->dev, "Unsupported clock rate %dHz\n",
@ -2064,6 +2067,8 @@ static int wm8996_set_sysclk(struct snd_soc_dai *dai,
WM8996_SYSCLK_SRC_MASK | WM8996_SYSCLK_DIV_MASK, WM8996_SYSCLK_SRC_MASK | WM8996_SYSCLK_DIV_MASK,
src << WM8996_SYSCLK_SRC_SHIFT | ratediv); src << WM8996_SYSCLK_SRC_SHIFT | ratediv);
snd_soc_update_bits(codec, WM8996_CLOCKING_1, WM8996_LFCLK_ENA, lfclk); snd_soc_update_bits(codec, WM8996_CLOCKING_1, WM8996_LFCLK_ENA, lfclk);
snd_soc_update_bits(codec, WM8996_CONTROL_INTERFACE_1,
WM8996_REG_SYNC, sync);
snd_soc_update_bits(codec, WM8996_AIF_CLOCKING_1, snd_soc_update_bits(codec, WM8996_AIF_CLOCKING_1,
WM8996_SYSCLK_ENA, old); WM8996_SYSCLK_ENA, old);

View File

@ -1567,6 +1567,10 @@ int wm8996_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
/* /*
* R257 (0x101) - Control Interface (1) * R257 (0x101) - Control Interface (1)
*/ */
#define WM8996_REG_SYNC 0x8000 /* REG_SYNC */
#define WM8996_REG_SYNC_MASK 0x8000 /* REG_SYNC */
#define WM8996_REG_SYNC_SHIFT 15 /* REG_SYNC */
#define WM8996_REG_SYNC_WIDTH 1 /* REG_SYNC */
#define WM8996_AUTO_INC 0x0004 /* AUTO_INC */ #define WM8996_AUTO_INC 0x0004 /* AUTO_INC */
#define WM8996_AUTO_INC_MASK 0x0004 /* AUTO_INC */ #define WM8996_AUTO_INC_MASK 0x0004 /* AUTO_INC */
#define WM8996_AUTO_INC_SHIFT 2 /* AUTO_INC */ #define WM8996_AUTO_INC_SHIFT 2 /* AUTO_INC */

View File

@ -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"),
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[] = {
}; };
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[] = {
}; };
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" },

View File

@ -124,6 +124,8 @@ static int mxs_saif_set_clk(struct mxs_saif *saif,
* *
* If MCLK is not used, we just set saif clk to 512*fs. * If MCLK is not used, we just set saif clk to 512*fs.
*/ */
clk_prepare_enable(master_saif->clk);
if (master_saif->mclk_in_use) { if (master_saif->mclk_in_use) {
if (mclk % 32 == 0) { if (mclk % 32 == 0) {
scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE; scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE;
@ -133,6 +135,7 @@ static int mxs_saif_set_clk(struct mxs_saif *saif,
ret = clk_set_rate(master_saif->clk, 384 * rate); ret = clk_set_rate(master_saif->clk, 384 * rate);
} else { } else {
/* SAIF MCLK should be either 32x or 48x */ /* SAIF MCLK should be either 32x or 48x */
clk_disable_unprepare(master_saif->clk);
return -EINVAL; return -EINVAL;
} }
} else { } else {
@ -140,6 +143,8 @@ static int mxs_saif_set_clk(struct mxs_saif *saif,
scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE; scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE;
} }
clk_disable_unprepare(master_saif->clk);
if (ret) if (ret)
return ret; return ret;

View File

@ -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)
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)
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)
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[] = {
.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[] = {
}, },
}; };
#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)
{ {
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()) {