Commit a983b9e5 authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'fix/hda-samsung-p50' into topic/hda

parents b7b51141 c912e7a5
...@@ -240,6 +240,7 @@ AD1986A ...@@ -240,6 +240,7 @@ AD1986A
laptop-automute 2-channel with EAPD and HP-automute (Lenovo N100) laptop-automute 2-channel with EAPD and HP-automute (Lenovo N100)
ultra 2-channel with EAPD (Samsung Ultra tablet PC) ultra 2-channel with EAPD (Samsung Ultra tablet PC)
samsung 2-channel with EAPD (Samsung R65) samsung 2-channel with EAPD (Samsung R65)
samsung-p50 2-channel with HP-automute (Samsung P50)
AD1988/AD1988B/AD1989A/AD1989B AD1988/AD1988B/AD1989A/AD1989B
============================== ==============================
......
...@@ -72,6 +72,7 @@ struct ad198x_spec { ...@@ -72,6 +72,7 @@ struct ad198x_spec {
hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
unsigned int jack_present :1; unsigned int jack_present :1;
unsigned int inv_jack_detect:1;
#ifdef CONFIG_SND_HDA_POWER_SAVE #ifdef CONFIG_SND_HDA_POWER_SAVE
struct hda_loopback_check loopback; struct hda_loopback_check loopback;
...@@ -669,39 +670,13 @@ static struct hda_input_mux ad1986a_automic_capture_source = { ...@@ -669,39 +670,13 @@ static struct hda_input_mux ad1986a_automic_capture_source = {
}, },
}; };
static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { static struct snd_kcontrol_new ad1986a_laptop_master_mixers[] = {
HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw), HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT),
HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT),
HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT),
HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT),
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Capture Source",
.info = ad198x_mux_enum_info,
.get = ad198x_mux_enum_get,
.put = ad198x_mux_enum_put,
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "External Amplifier",
.info = ad198x_eapd_info,
.get = ad198x_eapd_get,
.put = ad198x_eapd_put,
.private_value = 0x1b | (1 << 8), /* port-D, inversed */
},
{ } /* end */ { } /* end */
}; };
static struct snd_kcontrol_new ad1986a_samsung_mixers[] = { static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
...@@ -727,6 +702,12 @@ static struct snd_kcontrol_new ad1986a_samsung_mixers[] = { ...@@ -727,6 +702,12 @@ static struct snd_kcontrol_new ad1986a_samsung_mixers[] = {
{ } /* end */ { } /* end */
}; };
static struct snd_kcontrol_new ad1986a_laptop_intmic_mixers[] = {
HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT),
HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT),
{ } /* end */
};
/* re-connect the mic boost input according to the jack sensing */ /* re-connect the mic boost input according to the jack sensing */
static void ad1986a_automic(struct hda_codec *codec) static void ad1986a_automic(struct hda_codec *codec)
{ {
...@@ -776,8 +757,9 @@ static void ad1986a_hp_automute(struct hda_codec *codec) ...@@ -776,8 +757,9 @@ static void ad1986a_hp_automute(struct hda_codec *codec)
unsigned int present; unsigned int present;
present = snd_hda_codec_read(codec, 0x1a, 0, AC_VERB_GET_PIN_SENSE, 0); present = snd_hda_codec_read(codec, 0x1a, 0, AC_VERB_GET_PIN_SENSE, 0);
/* Lenovo N100 seems to report the reversed bit for HP jack-sensing */ spec->jack_present = !!(present & 0x80000000);
spec->jack_present = !(present & 0x80000000); if (spec->inv_jack_detect)
spec->jack_present = !spec->jack_present;
ad1986a_update_hp(codec); ad1986a_update_hp(codec);
} }
...@@ -816,7 +798,7 @@ static int ad1986a_hp_master_sw_put(struct snd_kcontrol *kcontrol, ...@@ -816,7 +798,7 @@ static int ad1986a_hp_master_sw_put(struct snd_kcontrol *kcontrol,
return change; return change;
} }
static struct snd_kcontrol_new ad1986a_laptop_automute_mixers[] = { static struct snd_kcontrol_new ad1986a_automute_master_mixers[] = {
HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
...@@ -826,33 +808,10 @@ static struct snd_kcontrol_new ad1986a_laptop_automute_mixers[] = { ...@@ -826,33 +808,10 @@ static struct snd_kcontrol_new ad1986a_laptop_automute_mixers[] = {
.put = ad1986a_hp_master_sw_put, .put = ad1986a_hp_master_sw_put,
.private_value = HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT), .private_value = HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT),
}, },
HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x0, HDA_OUTPUT),
HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0x0, HDA_OUTPUT),
HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT),
HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT),
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Capture Source",
.info = ad198x_mux_enum_info,
.get = ad198x_mux_enum_get,
.put = ad198x_mux_enum_put,
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "External Amplifier",
.info = ad198x_eapd_info,
.get = ad198x_eapd_get,
.put = ad198x_eapd_put,
.private_value = 0x1b | (1 << 8), /* port-D, inversed */
},
{ } /* end */ { } /* end */
}; };
/* /*
* initialization verbs * initialization verbs
*/ */
...@@ -981,6 +940,27 @@ static struct hda_verb ad1986a_hp_init_verbs[] = { ...@@ -981,6 +940,27 @@ static struct hda_verb ad1986a_hp_init_verbs[] = {
{} {}
}; };
static void ad1986a_samsung_p50_unsol_event(struct hda_codec *codec,
unsigned int res)
{
switch (res >> 26) {
case AD1986A_HP_EVENT:
ad1986a_hp_automute(codec);
break;
case AD1986A_MIC_EVENT:
ad1986a_automic(codec);
break;
}
}
static int ad1986a_samsung_p50_init(struct hda_codec *codec)
{
ad198x_init(codec);
ad1986a_hp_automute(codec);
ad1986a_automic(codec);
return 0;
}
/* models */ /* models */
enum { enum {
...@@ -991,6 +971,7 @@ enum { ...@@ -991,6 +971,7 @@ enum {
AD1986A_LAPTOP_AUTOMUTE, AD1986A_LAPTOP_AUTOMUTE,
AD1986A_ULTRA, AD1986A_ULTRA,
AD1986A_SAMSUNG, AD1986A_SAMSUNG,
AD1986A_SAMSUNG_P50,
AD1986A_MODELS AD1986A_MODELS
}; };
...@@ -1002,6 +983,7 @@ static const char *ad1986a_models[AD1986A_MODELS] = { ...@@ -1002,6 +983,7 @@ static const char *ad1986a_models[AD1986A_MODELS] = {
[AD1986A_LAPTOP_AUTOMUTE] = "laptop-automute", [AD1986A_LAPTOP_AUTOMUTE] = "laptop-automute",
[AD1986A_ULTRA] = "ultra", [AD1986A_ULTRA] = "ultra",
[AD1986A_SAMSUNG] = "samsung", [AD1986A_SAMSUNG] = "samsung",
[AD1986A_SAMSUNG_P50] = "samsung-p50",
}; };
static struct snd_pci_quirk ad1986a_cfg_tbl[] = { static struct snd_pci_quirk ad1986a_cfg_tbl[] = {
...@@ -1024,6 +1006,7 @@ static struct snd_pci_quirk ad1986a_cfg_tbl[] = { ...@@ -1024,6 +1006,7 @@ static struct snd_pci_quirk ad1986a_cfg_tbl[] = {
SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD), SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD),
SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK), SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK),
SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP),
SND_PCI_QUIRK(0x144d, 0xc024, "Samsung P50", AD1986A_SAMSUNG_P50),
SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA), SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA),
SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_SAMSUNG), SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_SAMSUNG),
SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK), SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK),
...@@ -1111,7 +1094,10 @@ static int patch_ad1986a(struct hda_codec *codec) ...@@ -1111,7 +1094,10 @@ static int patch_ad1986a(struct hda_codec *codec)
spec->multiout.dac_nids = ad1986a_laptop_dac_nids; spec->multiout.dac_nids = ad1986a_laptop_dac_nids;
break; break;
case AD1986A_LAPTOP_EAPD: case AD1986A_LAPTOP_EAPD:
spec->mixers[0] = ad1986a_laptop_eapd_mixers; spec->num_mixers = 3;
spec->mixers[0] = ad1986a_laptop_master_mixers;
spec->mixers[1] = ad1986a_laptop_eapd_mixers;
spec->mixers[2] = ad1986a_laptop_intmic_mixers;
spec->num_init_verbs = 2; spec->num_init_verbs = 2;
spec->init_verbs[1] = ad1986a_eapd_init_verbs; spec->init_verbs[1] = ad1986a_eapd_init_verbs;
spec->multiout.max_channels = 2; spec->multiout.max_channels = 2;
...@@ -1122,7 +1108,9 @@ static int patch_ad1986a(struct hda_codec *codec) ...@@ -1122,7 +1108,9 @@ static int patch_ad1986a(struct hda_codec *codec)
spec->input_mux = &ad1986a_laptop_eapd_capture_source; spec->input_mux = &ad1986a_laptop_eapd_capture_source;
break; break;
case AD1986A_SAMSUNG: case AD1986A_SAMSUNG:
spec->mixers[0] = ad1986a_samsung_mixers; spec->num_mixers = 2;
spec->mixers[0] = ad1986a_laptop_master_mixers;
spec->mixers[1] = ad1986a_laptop_eapd_mixers;
spec->num_init_verbs = 3; spec->num_init_verbs = 3;
spec->init_verbs[1] = ad1986a_eapd_init_verbs; spec->init_verbs[1] = ad1986a_eapd_init_verbs;
spec->init_verbs[2] = ad1986a_automic_verbs; spec->init_verbs[2] = ad1986a_automic_verbs;
...@@ -1135,8 +1123,28 @@ static int patch_ad1986a(struct hda_codec *codec) ...@@ -1135,8 +1123,28 @@ static int patch_ad1986a(struct hda_codec *codec)
codec->patch_ops.unsol_event = ad1986a_automic_unsol_event; codec->patch_ops.unsol_event = ad1986a_automic_unsol_event;
codec->patch_ops.init = ad1986a_automic_init; codec->patch_ops.init = ad1986a_automic_init;
break; break;
case AD1986A_SAMSUNG_P50:
spec->num_mixers = 2;
spec->mixers[0] = ad1986a_automute_master_mixers;
spec->mixers[1] = ad1986a_laptop_eapd_mixers;
spec->num_init_verbs = 4;
spec->init_verbs[1] = ad1986a_eapd_init_verbs;
spec->init_verbs[2] = ad1986a_automic_verbs;
spec->init_verbs[3] = ad1986a_hp_init_verbs;
spec->multiout.max_channels = 2;
spec->multiout.num_dacs = 1;
spec->multiout.dac_nids = ad1986a_laptop_dac_nids;
if (!is_jack_available(codec, 0x25))
spec->multiout.dig_out_nid = 0;
spec->input_mux = &ad1986a_automic_capture_source;
codec->patch_ops.unsol_event = ad1986a_samsung_p50_unsol_event;
codec->patch_ops.init = ad1986a_samsung_p50_init;
break;
case AD1986A_LAPTOP_AUTOMUTE: case AD1986A_LAPTOP_AUTOMUTE:
spec->mixers[0] = ad1986a_laptop_automute_mixers; spec->num_mixers = 3;
spec->mixers[0] = ad1986a_automute_master_mixers;
spec->mixers[1] = ad1986a_laptop_eapd_mixers;
spec->mixers[2] = ad1986a_laptop_intmic_mixers;
spec->num_init_verbs = 3; spec->num_init_verbs = 3;
spec->init_verbs[1] = ad1986a_eapd_init_verbs; spec->init_verbs[1] = ad1986a_eapd_init_verbs;
spec->init_verbs[2] = ad1986a_hp_init_verbs; spec->init_verbs[2] = ad1986a_hp_init_verbs;
...@@ -1148,6 +1156,10 @@ static int patch_ad1986a(struct hda_codec *codec) ...@@ -1148,6 +1156,10 @@ static int patch_ad1986a(struct hda_codec *codec)
spec->input_mux = &ad1986a_laptop_eapd_capture_source; spec->input_mux = &ad1986a_laptop_eapd_capture_source;
codec->patch_ops.unsol_event = ad1986a_hp_unsol_event; codec->patch_ops.unsol_event = ad1986a_hp_unsol_event;
codec->patch_ops.init = ad1986a_hp_init; codec->patch_ops.init = ad1986a_hp_init;
/* Lenovo N100 seems to report the reversed bit
* for HP jack-sensing
*/
spec->inv_jack_detect = 1;
break; break;
case AD1986A_ULTRA: case AD1986A_ULTRA:
spec->mixers[0] = ad1986a_laptop_eapd_mixers; spec->mixers[0] = ad1986a_laptop_eapd_mixers;
......
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