Commit 57f23424 authored by Christian A. Ehrhardt's avatar Christian A. Ehrhardt Committed by Takashi Iwai

ALSA: hda/cs8409: Fix Jack detection after resume

The suspend code unconditionally sets ->hp_jack_in and ->mic_jack_in
to zero but without reporting this status change to the HDA core.
To compensate for this, always assume a status change on the
first unsol event after boot or resume.

Fixes: 424e531b ("ALSA: hda/cs8409: Ensure Type Detection is only run on startup when necessary")
Signed-off-by: default avatarChristian A. Ehrhardt <lk@c--e.de>
Link: https://lore.kernel.org/r/20211231134432.atwmuzeceqiklcoa@cae.in-ulm.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8cd07657
...@@ -252,6 +252,7 @@ struct sub_codec cs8409_cs42l42_codec = { ...@@ -252,6 +252,7 @@ struct sub_codec cs8409_cs42l42_codec = {
.init_seq_num = ARRAY_SIZE(cs42l42_init_reg_seq), .init_seq_num = ARRAY_SIZE(cs42l42_init_reg_seq),
.hp_jack_in = 0, .hp_jack_in = 0,
.mic_jack_in = 0, .mic_jack_in = 0,
.force_status_change = 1,
.paged = 1, .paged = 1,
.suspended = 1, .suspended = 1,
.no_type_dect = 0, .no_type_dect = 0,
...@@ -443,6 +444,7 @@ struct sub_codec dolphin_cs42l42_0 = { ...@@ -443,6 +444,7 @@ struct sub_codec dolphin_cs42l42_0 = {
.init_seq_num = ARRAY_SIZE(dolphin_c0_init_reg_seq), .init_seq_num = ARRAY_SIZE(dolphin_c0_init_reg_seq),
.hp_jack_in = 0, .hp_jack_in = 0,
.mic_jack_in = 0, .mic_jack_in = 0,
.force_status_change = 1,
.paged = 1, .paged = 1,
.suspended = 1, .suspended = 1,
.no_type_dect = 0, .no_type_dect = 0,
...@@ -456,6 +458,7 @@ struct sub_codec dolphin_cs42l42_1 = { ...@@ -456,6 +458,7 @@ struct sub_codec dolphin_cs42l42_1 = {
.init_seq_num = ARRAY_SIZE(dolphin_c1_init_reg_seq), .init_seq_num = ARRAY_SIZE(dolphin_c1_init_reg_seq),
.hp_jack_in = 0, .hp_jack_in = 0,
.mic_jack_in = 0, .mic_jack_in = 0,
.force_status_change = 1,
.paged = 1, .paged = 1,
.suspended = 1, .suspended = 1,
.no_type_dect = 1, .no_type_dect = 1,
......
...@@ -636,7 +636,9 @@ static void cs42l42_run_jack_detect(struct sub_codec *cs42l42) ...@@ -636,7 +636,9 @@ static void cs42l42_run_jack_detect(struct sub_codec *cs42l42)
static int cs42l42_handle_tip_sense(struct sub_codec *cs42l42, unsigned int reg_ts_status) static int cs42l42_handle_tip_sense(struct sub_codec *cs42l42, unsigned int reg_ts_status)
{ {
int status_changed = 0; int status_changed = cs42l42->force_status_change;
cs42l42->force_status_change = 0;
/* TIP_SENSE INSERT/REMOVE */ /* TIP_SENSE INSERT/REMOVE */
switch (reg_ts_status) { switch (reg_ts_status) {
...@@ -786,6 +788,7 @@ static void cs42l42_suspend(struct sub_codec *cs42l42) ...@@ -786,6 +788,7 @@ static void cs42l42_suspend(struct sub_codec *cs42l42)
cs42l42->last_page = 0; cs42l42->last_page = 0;
cs42l42->hp_jack_in = 0; cs42l42->hp_jack_in = 0;
cs42l42->mic_jack_in = 0; cs42l42->mic_jack_in = 0;
cs42l42->force_status_change = 1;
/* Put CS42L42 into Reset */ /* Put CS42L42 into Reset */
gpio_data = snd_hda_codec_read(codec, CS8409_PIN_AFG, 0, AC_VERB_GET_GPIO_DATA, 0); gpio_data = snd_hda_codec_read(codec, CS8409_PIN_AFG, 0, AC_VERB_GET_GPIO_DATA, 0);
......
...@@ -305,6 +305,7 @@ struct sub_codec { ...@@ -305,6 +305,7 @@ struct sub_codec {
unsigned int hp_jack_in:1; unsigned int hp_jack_in:1;
unsigned int mic_jack_in:1; unsigned int mic_jack_in:1;
unsigned int force_status_change:1;
unsigned int suspended:1; unsigned int suspended:1;
unsigned int paged:1; unsigned int paged:1;
unsigned int last_page; unsigned int last_page;
......
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