666
#ifdef CONFIG_SND_HDA_POWER_SAVE
667
static int stac_vrefout_set(struct hda_codec *codec,
668
hda_nid_t nid, unsigned int new_vref)
672
snd_printdd("%s, nid %x ctl %x\n", __func__, nid, new_vref);
673
pinctl = snd_hda_codec_read(codec, nid, 0,
674
AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
680
pinctl &= ~AC_PINCTL_VREFEN;
681
pinctl |= (new_vref & AC_PINCTL_VREFEN);
683
error = snd_hda_codec_write_cache(codec, nid, 0,
684
AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl);
674
692
static unsigned int stac92xx_vref_set(struct hda_codec *codec,
675
693
hda_nid_t nid, unsigned int new_vref)
1158
1175
stac92xx_free_kctls(codec); /* no longer needed */
1160
/* create jack input elements */
1161
if (spec->hp_detect) {
1162
for (i = 0; i < cfg->hp_outs; i++) {
1163
int type = SND_JACK_HEADPHONE;
1164
nid = cfg->hp_pins[i];
1165
/* jack detection */
1166
if (cfg->hp_outs == i)
1167
type |= SND_JACK_LINEOUT;
1168
err = stac92xx_add_jack(codec, nid, type);
1173
for (i = 0; i < cfg->line_outs; i++) {
1174
err = stac92xx_add_jack(codec, cfg->line_out_pins[i],
1179
for (i = 0; i < cfg->num_inputs; i++) {
1180
nid = cfg->inputs[i].pin;
1181
err = stac92xx_add_jack(codec, nid, SND_JACK_MICROPHONE);
1177
err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
1628
1625
0x40f000f0, 0x40f000f0,
1628
static const unsigned int dell_vostro_3500_pin_configs[10] = {
1629
0x02a11020, 0x0221101f, 0x400000f0, 0x90170110,
1630
0x400000f1, 0x400000f2, 0x400000f3, 0x90a60160,
1631
0x400000f4, 0x400000f5,
1631
1634
static const unsigned int hp_dv7_4000_pin_configs[10] = {
1632
1635
0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110,
1633
1636
0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140,
1634
1637
0x40f000f0, 0x40f000f0,
1640
static const unsigned int hp_cNB11_intquad_pin_configs[10] = {
1641
0x40f000f0, 0x0221101f, 0x02a11020, 0x92170110,
1642
0x40f000f0, 0x92170110, 0x40f000f0, 0xd5a30130,
1643
0x40f000f0, 0x40f000f0,
1637
1646
static const unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1638
1647
[STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs,
1639
1648
[STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs,
1640
1649
[STAC_DELL_S14] = dell_s14_pin_configs,
1650
[STAC_DELL_VOSTRO_3500] = dell_vostro_3500_pin_configs,
1651
[STAC_92HD83XXX_HP_cNB11_INTQUAD] = hp_cNB11_intquad_pin_configs,
1641
1652
[STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs,
1658
1671
"DFI LanParty", STAC_92HD83XXX_REF),
1659
1672
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba,
1660
1673
"unknown Dell", STAC_DELL_S14),
1674
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028,
1675
"Dell Vostro 3500", STAC_DELL_VOSTRO_3500),
1661
1676
SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x3600,
1662
"HP", STAC_92HD83XXX_HP),
1677
"HP", STAC_92HD83XXX_HP),
1678
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656,
1679
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1680
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657,
1681
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1682
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658,
1683
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1684
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659,
1685
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1686
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A,
1687
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1688
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B,
1689
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1690
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388,
1691
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1692
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389,
1693
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1694
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355B,
1695
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1696
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355C,
1697
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1698
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355D,
1699
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1700
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355E,
1701
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1702
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355F,
1703
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1704
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3560,
1705
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1706
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358B,
1707
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1708
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358C,
1709
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1710
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358D,
1711
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1712
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3591,
1713
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1714
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3592,
1715
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1716
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3593,
1717
"HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1663
1718
{} /* terminator */
2923
2980
return conn[j];
2926
/* if all DACs are already assigned, connect to the primary DAC */
2984
/* if all DACs are already assigned, connect to the primary DAC,
2985
unless we're assigning a secondary headphone */
2986
fallback_dac = spec->multiout.dac_nids[0];
2987
if (spec->multiout.hp_nid) {
2988
for (j = 0; j < cfg->hp_outs; j++)
2989
if (cfg->hp_pins[j] == nid) {
2990
fallback_dac = spec->multiout.hp_nid;
2927
2995
if (conn_len > 1) {
2928
2996
for (j = 0; j < conn_len; j++) {
2929
if (conn[j] == spec->multiout.dac_nids[0]) {
2997
if (conn[j] == fallback_dac) {
2930
2998
snd_hda_codec_write_cache(codec, nid, 0,
2931
2999
AC_VERB_SET_CONNECT_SEL, j);
3409
static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
3412
hda_nid_t conn[HDA_MAX_NUM_INPUTS];
3415
if (!(get_wcaps(codec, mux) & AC_WCAP_CONN_LIST))
3418
nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
3419
for (i = 0; i < nums; i++)
3423
for (i = 0; i < nums; i++) {
3424
unsigned int wid_caps = get_wcaps(codec, conn[i]);
3425
unsigned int wid_type = get_wcaps_type(wid_caps);
3427
if (wid_type != AC_WID_PIN && wid_type != AC_WID_AUD_MIX)
3428
if (get_connection_index(codec, conn[i], nid) >= 0)
3477
/* look for NID recursively */
3478
#define get_connection_index(codec, mux, nid) \
3479
snd_hda_get_conn_index(codec, mux, nid, 1)
3434
3481
/* create a volume assigned to the given pin (only if supported) */
3435
3482
/* return 1 if the volume control is created */
4065
4132
AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
4068
static int stac92xx_add_jack(struct hda_codec *codec,
4069
hda_nid_t nid, int type)
4071
#ifdef CONFIG_SND_HDA_INPUT_JACK
4072
int def_conf = snd_hda_codec_get_pincfg(codec, nid);
4073
int connectivity = get_defcfg_connect(def_conf);
4077
if (connectivity && connectivity != AC_JACK_PORT_FIXED)
4080
snprintf(name, sizeof(name), "%s at %s %s Jack",
4081
snd_hda_get_jack_type(def_conf),
4082
snd_hda_get_jack_connectivity(def_conf),
4083
snd_hda_get_jack_location(def_conf));
4085
err = snd_hda_input_jack_add(codec, nid, type, name);
4088
#endif /* CONFIG_SND_HDA_INPUT_JACK */
4092
static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid,
4135
static int stac_add_event(struct hda_codec *codec, hda_nid_t nid,
4093
4136
unsigned char type, int data)
4095
struct sigmatel_event *event;
4138
struct hda_jack_tbl *event;
4097
snd_array_init(&spec->events, sizeof(*event), 32);
4098
event = snd_array_new(&spec->events);
4140
event = snd_hda_jack_tbl_new(codec, nid);
4100
4142
return -ENOMEM;
4103
event->tag = spec->events.used;
4109
static struct sigmatel_event *stac_get_event(struct hda_codec *codec,
4112
struct sigmatel_spec *spec = codec->spec;
4113
struct sigmatel_event *event = spec->events.list;
4116
for (i = 0; i < spec->events.used; i++, event++) {
4117
if (event->nid == nid)
4123
static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec,
4126
struct sigmatel_spec *spec = codec->spec;
4127
struct sigmatel_event *event = spec->events.list;
4130
for (i = 0; i < spec->events.used; i++, event++) {
4131
if (event->tag == tag)
4143
event->action = type;
4144
event->private_data = data;
4137
4149
/* check if given nid is a valid pin and no other events are assigned
4141
4153
static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
4142
4154
unsigned int type)
4144
struct sigmatel_event *event;
4156
struct hda_jack_tbl *event;
4147
4158
if (!is_jack_detectable(codec, nid))
4149
event = stac_get_event(codec, nid);
4151
if (event->type != type)
4155
tag = stac_add_event(codec->spec, nid, type, 0);
4159
snd_hda_codec_write_cache(codec, nid, 0,
4160
AC_VERB_SET_UNSOLICITED_ENABLE,
4160
event = snd_hda_jack_tbl_new(codec, nid);
4163
if (event->action && event->action != type)
4165
event->action = type;
4166
snd_hda_jack_detect_enable(codec, nid, 0);
4165
static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
4170
static int is_nid_out_jack_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
4168
4173
for (i = 0; i < cfg->hp_outs; i++)
4169
4174
if (cfg->hp_pins[i] == nid)
4170
4175
return 1; /* nid is a HP-Out */
4176
for (i = 0; i < cfg->line_outs; i++)
4177
if (cfg->line_out_pins[i] == nid)
4178
return 1; /* nid is a line-Out */
4172
4179
return 0; /* nid is not a HP-Out */
4245
static void stac_issue_unsol_events(struct hda_codec *codec, int num_pins,
4246
const hda_nid_t *pins)
4249
stac_issue_unsol_event(codec, *pins++);
4252
/* fake event to set up pins */
4253
static void stac_fake_hp_events(struct hda_codec *codec)
4255
struct sigmatel_spec *spec = codec->spec;
4257
if (spec->autocfg.hp_outs)
4258
stac_issue_unsol_events(codec, spec->autocfg.hp_outs,
4259
spec->autocfg.hp_pins);
4260
if (spec->autocfg.line_outs &&
4261
spec->autocfg.line_out_pins[0] != spec->autocfg.hp_pins[0])
4262
stac_issue_unsol_events(codec, spec->autocfg.line_outs,
4263
spec->autocfg.line_out_pins);
4238
4266
static int stac92xx_init(struct hda_codec *codec)
4240
4268
struct sigmatel_spec *spec = codec->spec;
4401
4434
snd_array_free(&spec->kctls);
4437
static void stac92xx_shutup_pins(struct hda_codec *codec)
4439
unsigned int i, def_conf;
4441
if (codec->bus->shutdown)
4443
for (i = 0; i < codec->init_pins.used; i++) {
4444
struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
4445
def_conf = snd_hda_codec_get_pincfg(codec, pin->nid);
4446
if (get_defcfg_connect(def_conf) != AC_JACK_PORT_NONE)
4447
snd_hda_codec_write(codec, pin->nid, 0,
4448
AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
4404
4452
static void stac92xx_shutup(struct hda_codec *codec)
4406
4454
struct sigmatel_spec *spec = codec->spec;
4408
snd_hda_shutup_pins(codec);
4456
stac92xx_shutup_pins(codec);
4410
4458
if (spec->eapd_mask)
4411
4459
stac_gpio_set(codec, spec->gpio_mask,
4752
4780
AC_VERB_GET_GPIO_DATA, 0);
4753
4781
/* toggle VREF state based on GPIOx status */
4754
4782
snd_hda_codec_write(codec, codec->afg, 0, 0x7e0,
4755
!!(data & (1 << event->data)));
4783
!!(data & (1 << event->private_data)));
4788
static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid)
4790
struct hda_jack_tbl *event = snd_hda_jack_tbl_get(codec, nid);
4793
handle_unsol_event(codec, event);
4796
static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4798
struct hda_jack_tbl *event;
4801
tag = (res >> 26) & 0x7f;
4802
event = snd_hda_jack_tbl_get_from_tag(codec, tag);
4805
event->jack_dirty = 1;
4806
handle_unsol_event(codec, event);
4807
snd_hda_jack_report_sync(codec);
4760
4810
static int hp_blike_system(u32 subsystem_id);
4762
4812
static void set_hp_led_gpio(struct hda_codec *codec)
4803
4853
if ((codec->subsystem_id >> 16) == PCI_VENDOR_ID_HP) {
4804
4854
while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING,
4806
if (sscanf(dev->name, "HP_Mute_LED_%d_%d",
4856
if (sscanf(dev->name, "HP_Mute_LED_%d_%x",
4807
4857
&spec->gpio_led_polarity,
4808
4858
&spec->gpio_led) == 2) {
4809
spec->gpio_led = 1 << spec->gpio_led;
4859
unsigned int max_gpio;
4860
max_gpio = snd_hda_param_read(codec, codec->afg,
4862
max_gpio &= AC_GPIO_IO_COUNT;
4863
if (spec->gpio_led < max_gpio)
4864
spec->gpio_led = 1 << spec->gpio_led;
4866
spec->vref_mute_led_nid = spec->gpio_led;
4812
4869
if (sscanf(dev->name, "HP_Mute_LED_%d",
4904
4974
#define stac927x_proc_hook NULL
4907
#ifdef SND_HDA_NEEDS_RESUME
4908
4978
static int stac92xx_resume(struct hda_codec *codec)
4910
struct sigmatel_spec *spec = codec->spec;
4912
4980
stac92xx_init(codec);
4913
4981
snd_hda_codec_resume_amp(codec);
4914
4982
snd_hda_codec_resume_cache(codec);
4915
4983
/* fake event to set up pins again to override cached values */
4916
if (spec->hp_detect) {
4917
if (spec->autocfg.hp_pins[0])
4918
stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0]);
4919
else if (spec->autocfg.line_out_pins[0])
4920
stac_issue_unsol_event(codec,
4921
spec->autocfg.line_out_pins[0]);
4984
stac_fake_hp_events(codec);
4988
static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
4990
stac92xx_shutup(codec);
4994
#ifdef CONFIG_SND_HDA_POWER_SAVE
4995
static int stac92xx_pre_resume(struct hda_codec *codec)
4997
struct sigmatel_spec *spec = codec->spec;
5000
if (spec->vref_mute_led_nid)
5001
stac_vrefout_set(codec, spec->vref_mute_led_nid,
5003
else if (spec->gpio_led)
5004
stac_gpio_set(codec, spec->gpio_mask,
5005
spec->gpio_dir, spec->gpio_data);
5009
static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg,
5010
unsigned int power_state)
5012
unsigned int afg_power_state = power_state;
5013
struct sigmatel_spec *spec = codec->spec;
5015
if (power_state == AC_PWRST_D3) {
5016
if (spec->vref_mute_led_nid) {
5017
/* with vref-out pin used for mute led control
5018
* codec AFG is prevented from D3 state
5020
afg_power_state = AC_PWRST_D1;
5022
/* this delay seems necessary to avoid click noise at power-down */
4925
hda_call_check_power_status(codec, 0x01);
5025
snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE,
5027
snd_hda_codec_set_power_to_all(codec, fg, power_state, true);
4930
* using power check for controlling mute led of HP notebooks
4931
* check for mute state only on Speakers (nid = 0x10)
4933
* For this feature CONFIG_SND_HDA_POWER_SAVE is needed, otherwise
4934
* the LED is NOT working properly !
4936
* Changed name to reflect that it now works for any designated
4937
* model, not just HP HDX.
5031
* For this feature CONFIG_SND_HDA_POWER_SAVE is needed
5032
* as mute LED state is updated in check_power_status hook
4940
#ifdef CONFIG_SND_HDA_POWER_SAVE
4941
static int stac92xx_hp_check_power_status(struct hda_codec *codec,
5034
static int stac92xx_update_led_status(struct hda_codec *codec)
4944
5036
struct sigmatel_spec *spec = codec->spec;
5037
int i, num_ext_dacs, muted = 1;
5038
unsigned int muted_lvl, notmtd_lvl;
5041
if (!spec->gpio_led)
4947
5044
for (i = 0; i < spec->multiout.num_dacs; i++) {
4948
5045
nid = spec->multiout.dac_nids[i];
4956
spec->gpio_data &= ~spec->gpio_led; /* orange */
4958
spec->gpio_data |= spec->gpio_led; /* white */
4960
if (!spec->gpio_led_polarity) {
4961
/* LED state is inverted on these systems */
4962
spec->gpio_data ^= spec->gpio_led;
4965
stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
5052
if (muted && spec->multiout.hp_nid)
5053
if (!(snd_hda_codec_amp_read(codec,
5054
spec->multiout.hp_nid, 0, HDA_OUTPUT, 0) &
5056
muted = 0; /* HP is not muted */
5058
num_ext_dacs = ARRAY_SIZE(spec->multiout.extra_out_nid);
5059
for (i = 0; muted && i < num_ext_dacs; i++) {
5060
nid = spec->multiout.extra_out_nid[i];
5063
if (!(snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) &
5065
muted = 0; /* extra output is not muted */
5068
/*polarity defines *not* muted state level*/
5069
if (!spec->vref_mute_led_nid) {
5071
spec->gpio_data &= ~spec->gpio_led; /* orange */
5073
spec->gpio_data |= spec->gpio_led; /* white */
5075
if (!spec->gpio_led_polarity) {
5076
/* LED state is inverted on these systems */
5077
spec->gpio_data ^= spec->gpio_led;
5079
stac_gpio_set(codec, spec->gpio_mask,
5080
spec->gpio_dir, spec->gpio_data);
5082
notmtd_lvl = spec->gpio_led_polarity ?
5083
AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_GRD;
5084
muted_lvl = spec->gpio_led_polarity ?
5085
AC_PINCTL_VREF_GRD : AC_PINCTL_VREF_HIZ;
5086
spec->vref_led = muted ? muted_lvl : notmtd_lvl;
5087
stac_vrefout_set(codec, spec->vref_mute_led_nid,
4970
static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
5094
* use power check for controlling mute led of HP notebooks
5096
static int stac92xx_check_power_status(struct hda_codec *codec,
4972
stac92xx_shutup(codec);
5099
stac92xx_update_led_status(codec);
5103
#endif /* CONFIG_SND_HDA_POWER_SAVE */
5104
#endif /* CONFIG_PM */
4977
5106
static const struct hda_codec_ops stac92xx_patch_ops = {
4978
5107
.build_controls = stac92xx_build_controls,
5478
5600
#ifdef CONFIG_SND_HDA_POWER_SAVE
5479
5601
if (spec->gpio_led) {
5480
spec->gpio_mask |= spec->gpio_led;
5481
spec->gpio_dir |= spec->gpio_led;
5482
spec->gpio_data |= spec->gpio_led;
5483
/* register check_power_status callback. */
5602
if (!spec->vref_mute_led_nid) {
5603
spec->gpio_mask |= spec->gpio_led;
5604
spec->gpio_dir |= spec->gpio_led;
5605
spec->gpio_data |= spec->gpio_led;
5607
codec->patch_ops.set_power_state =
5608
stac92xx_set_power_state;
5610
codec->patch_ops.pre_resume = stac92xx_pre_resume;
5484
5611
codec->patch_ops.check_power_status =
5485
stac92xx_hp_check_power_status;
5612
stac92xx_check_power_status;
5489
/* 92HD65/66 series has S/PDIF-IN */
5490
if (codec->vendor_id >= 0x111d76e8 && codec->vendor_id <= 0x111d76f3)
5491
err = stac92xx_parse_auto_config(codec, 0x1d, 0x22);
5493
err = stac92xx_parse_auto_config(codec, 0x1d, 0);
5616
err = stac92xx_parse_auto_config(codec);
5495
5618
if (spec->board_config < 0) {
5496
5619
printk(KERN_WARNING "hda_codec: No auto-config is "
5657
5780
switch (spec->board_config) {
5658
5781
case STAC_HP_M4:
5659
5782
/* Enable VREF power saving on GPIO1 detect */
5660
err = stac_add_event(spec, codec->afg,
5783
err = stac_add_event(codec, codec->afg,
5661
5784
STAC_VREF_EVENT, 0x02);
5664
5787
snd_hda_codec_write_cache(codec, codec->afg, 0,
5665
5788
AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
5666
snd_hda_codec_write_cache(codec, codec->afg, 0,
5667
AC_VERB_SET_UNSOLICITED_ENABLE,
5789
snd_hda_jack_detect_enable(codec, codec->afg, 0);
5669
5790
spec->gpio_mask |= 0x02;
5794
5911
#ifdef CONFIG_SND_HDA_POWER_SAVE
5795
5912
if (spec->gpio_led) {
5796
spec->gpio_mask |= spec->gpio_led;
5797
spec->gpio_dir |= spec->gpio_led;
5798
spec->gpio_data |= spec->gpio_led;
5799
/* register check_power_status callback. */
5913
if (!spec->vref_mute_led_nid) {
5914
spec->gpio_mask |= spec->gpio_led;
5915
spec->gpio_dir |= spec->gpio_led;
5916
spec->gpio_data |= spec->gpio_led;
5918
codec->patch_ops.set_power_state =
5919
stac92xx_set_power_state;
5921
codec->patch_ops.pre_resume = stac92xx_pre_resume;
5800
5922
codec->patch_ops.check_power_status =
5801
stac92xx_hp_check_power_status;
5923
stac92xx_check_power_status;
5805
5927
spec->multiout.dac_nids = spec->dac_nids;
5807
err = stac92xx_parse_auto_config(codec, 0x21, 0);
5929
err = stac92xx_parse_auto_config(codec);
5809
5931
if (spec->board_config < 0) {
5810
5932
printk(KERN_WARNING "hda_codec: No auto-config is "
6135
6257
snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030);
6137
6259
/* Enable unsol response for GPIO4/Dock HP connection */
6138
err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01);
6260
err = stac_add_event(codec, codec->afg, STAC_VREF_EVENT, 0x01);
6141
6263
snd_hda_codec_write_cache(codec, codec->afg, 0,
6142
6264
AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
6143
snd_hda_codec_write_cache(codec, codec->afg, 0,
6144
AC_VERB_SET_UNSOLICITED_ENABLE,
6265
snd_hda_jack_detect_enable(codec, codec->afg, 0);
6147
6267
spec->gpio_dir = 0x0b;
6148
6268
spec->eapd_mask = 0x01;