Commit 44954e13 authored by Kailang Yang's avatar Kailang Yang Committed by Sasha Levin

ALSA: hda/realtek - Support headset mode for ALC286/288

[ Upstream commit f3b70332 ]

Support headset mode for ALC286 and ALC288 platforms.
Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent e0422326
...@@ -3476,6 +3476,14 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) ...@@ -3476,6 +3476,14 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
WRITE_COEF(0x32, 0x42a3), WRITE_COEF(0x32, 0x42a3),
{} {}
}; };
static struct coef_fw coef0288[] = {
UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
UPDATE_COEF(0x50, 0x2000, 0x2000),
UPDATE_COEF(0x56, 0x0006, 0x0006),
UPDATE_COEF(0x66, 0x0008, 0),
UPDATE_COEF(0x67, 0x2000, 0),
{}
};
static struct coef_fw coef0292[] = { static struct coef_fw coef0292[] = {
WRITE_COEF(0x76, 0x000e), WRITE_COEF(0x76, 0x000e),
WRITE_COEF(0x6c, 0x2400), WRITE_COEF(0x6c, 0x2400),
...@@ -3507,6 +3515,10 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) ...@@ -3507,6 +3515,10 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
case 0x10ec0283: case 0x10ec0283:
alc_process_coef_fw(codec, coef0233); alc_process_coef_fw(codec, coef0233);
break; break;
case 0x10ec0286:
case 0x10ec0288:
alc_process_coef_fw(codec, coef0288);
break;
case 0x10ec0292: case 0x10ec0292:
alc_process_coef_fw(codec, coef0292); alc_process_coef_fw(codec, coef0292);
break; break;
...@@ -3536,6 +3548,14 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, ...@@ -3536,6 +3548,14 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
WRITE_COEF(0x26, 0x008c), WRITE_COEF(0x26, 0x008c),
{} {}
}; };
static struct coef_fw coef0288[] = {
UPDATE_COEF(0x50, 0x2000, 0),
UPDATE_COEF(0x56, 0x0006, 0),
UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
UPDATE_COEF(0x66, 0x0008, 0x0008),
UPDATE_COEF(0x67, 0x2000, 0x2000),
{}
};
static struct coef_fw coef0292[] = { static struct coef_fw coef0292[] = {
WRITE_COEF(0x19, 0xa208), WRITE_COEF(0x19, 0xa208),
WRITE_COEF(0x2e, 0xacf0), WRITE_COEF(0x2e, 0xacf0),
...@@ -3569,6 +3589,13 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, ...@@ -3569,6 +3589,13 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
alc_process_coef_fw(codec, coef0233); alc_process_coef_fw(codec, coef0233);
snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
break; break;
case 0x10ec0286:
case 0x10ec0288:
alc_update_coef_idx(codec, 0x4f, 0x000c, 0);
snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
alc_process_coef_fw(codec, coef0288);
snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
break;
case 0x10ec0292: case 0x10ec0292:
snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
alc_process_coef_fw(codec, coef0292); alc_process_coef_fw(codec, coef0292);
...@@ -3604,6 +3631,14 @@ static void alc_headset_mode_default(struct hda_codec *codec) ...@@ -3604,6 +3631,14 @@ static void alc_headset_mode_default(struct hda_codec *codec)
WRITE_COEF(0x32, 0x4ea3), WRITE_COEF(0x32, 0x4ea3),
{} {}
}; };
static struct coef_fw coef0288[] = {
UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
UPDATE_COEF(0x50, 0x2000, 0x2000),
UPDATE_COEF(0x56, 0x0006, 0x0006),
UPDATE_COEF(0x66, 0x0008, 0),
UPDATE_COEF(0x67, 0x2000, 0),
{}
};
static struct coef_fw coef0292[] = { static struct coef_fw coef0292[] = {
WRITE_COEF(0x76, 0x000e), WRITE_COEF(0x76, 0x000e),
WRITE_COEF(0x6c, 0x2400), WRITE_COEF(0x6c, 0x2400),
...@@ -3633,6 +3668,11 @@ static void alc_headset_mode_default(struct hda_codec *codec) ...@@ -3633,6 +3668,11 @@ static void alc_headset_mode_default(struct hda_codec *codec)
case 0x10ec0283: case 0x10ec0283:
alc_process_coef_fw(codec, coef0233); alc_process_coef_fw(codec, coef0233);
break; break;
case 0x10ec0286:
case 0x10ec0288:
alc_process_coef_fw(codec, coef0288);
break;
break;
case 0x10ec0292: case 0x10ec0292:
alc_process_coef_fw(codec, coef0292); alc_process_coef_fw(codec, coef0292);
break; break;
...@@ -3661,6 +3701,13 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) ...@@ -3661,6 +3701,13 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
WRITE_COEF(0x32, 0x4ea3), WRITE_COEF(0x32, 0x4ea3),
{} {}
}; };
static struct coef_fw coef0288[] = {
UPDATE_COEF(0x50, 0x2000, 0x2000),
UPDATE_COEF(0x56, 0x0006, 0x0006),
UPDATE_COEF(0x66, 0x0008, 0),
UPDATE_COEF(0x67, 0x2000, 0),
{}
};
static struct coef_fw coef0292[] = { static struct coef_fw coef0292[] = {
WRITE_COEF(0x6b, 0xd429), WRITE_COEF(0x6b, 0xd429),
WRITE_COEF(0x76, 0x0008), WRITE_COEF(0x76, 0x0008),
...@@ -3688,6 +3735,12 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) ...@@ -3688,6 +3735,12 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
case 0x10ec0283: case 0x10ec0283:
alc_process_coef_fw(codec, coef0233); alc_process_coef_fw(codec, coef0233);
break; break;
case 0x10ec0286:
case 0x10ec0288:
alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
msleep(300);
alc_process_coef_fw(codec, coef0288);
break;
case 0x10ec0292: case 0x10ec0292:
alc_process_coef_fw(codec, coef0292); alc_process_coef_fw(codec, coef0292);
break; break;
...@@ -3716,6 +3769,13 @@ static void alc_headset_mode_omtp(struct hda_codec *codec) ...@@ -3716,6 +3769,13 @@ static void alc_headset_mode_omtp(struct hda_codec *codec)
WRITE_COEF(0x32, 0x4ea3), WRITE_COEF(0x32, 0x4ea3),
{} {}
}; };
static struct coef_fw coef0288[] = {
UPDATE_COEF(0x50, 0x2000, 0x2000),
UPDATE_COEF(0x56, 0x0006, 0x0006),
UPDATE_COEF(0x66, 0x0008, 0),
UPDATE_COEF(0x67, 0x2000, 0),
{}
};
static struct coef_fw coef0292[] = { static struct coef_fw coef0292[] = {
WRITE_COEF(0x6b, 0xe429), WRITE_COEF(0x6b, 0xe429),
WRITE_COEF(0x76, 0x0008), WRITE_COEF(0x76, 0x0008),
...@@ -3743,6 +3803,12 @@ static void alc_headset_mode_omtp(struct hda_codec *codec) ...@@ -3743,6 +3803,12 @@ static void alc_headset_mode_omtp(struct hda_codec *codec)
case 0x10ec0283: case 0x10ec0283:
alc_process_coef_fw(codec, coef0233); alc_process_coef_fw(codec, coef0233);
break; break;
case 0x10ec0286:
case 0x10ec0288:
alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
msleep(300);
alc_process_coef_fw(codec, coef0288);
break;
case 0x10ec0292: case 0x10ec0292:
alc_process_coef_fw(codec, coef0292); alc_process_coef_fw(codec, coef0292);
break; break;
...@@ -3767,6 +3833,10 @@ static void alc_determine_headset_type(struct hda_codec *codec) ...@@ -3767,6 +3833,10 @@ static void alc_determine_headset_type(struct hda_codec *codec)
conteol) */ conteol) */
{} {}
}; };
static struct coef_fw coef0288[] = {
UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
{}
};
static struct coef_fw coef0293[] = { static struct coef_fw coef0293[] = {
UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */ UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
WRITE_COEF(0x45, 0xD429), /* Set to ctia type */ WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
...@@ -3795,6 +3865,13 @@ static void alc_determine_headset_type(struct hda_codec *codec) ...@@ -3795,6 +3865,13 @@ static void alc_determine_headset_type(struct hda_codec *codec)
val = alc_read_coef_idx(codec, 0x46); val = alc_read_coef_idx(codec, 0x46);
is_ctia = (val & 0x0070) == 0x0070; is_ctia = (val & 0x0070) == 0x0070;
break; break;
case 0x10ec0286:
case 0x10ec0288:
alc_process_coef_fw(codec, coef0288);
msleep(350);
val = alc_read_coef_idx(codec, 0x50);
is_ctia = (val & 0x0070) == 0x0070;
break;
case 0x10ec0292: case 0x10ec0292:
alc_write_coef_idx(codec, 0x6b, 0xd429); alc_write_coef_idx(codec, 0x6b, 0xd429);
msleep(300); msleep(300);
......
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