Skip to content

Conversation

@kv2019i
Copy link
Collaborator

@kv2019i kv2019i commented Apr 6, 2020

One more attempt to fix this bug. This is a combination of patches from @jason77-wang and @juimonen . We set a non-zero value for codecs after ASoC registration is done, to mimic to programming flow of the legacy driver.

This is alternative to:

On some Lenovo and HP laptops, if both codec driver and SOF driver
are in runtime suspend mode, we plug a headset to the audio jack,
the headphone could be detected but Mic couldn't.

That is because when plugging, the headphone triggers a unsol event
first, and about 0.7s later (on the Lenovo X1 Carbon 7th), the Mic
triggers a unsol event. But if the codec driver enters runtime suspend
within 0.7s, the Mic can't trigger the unsol event.

If we don't set autosuspend_delay to a non-zero value for the hda codec
driver, it will enter runtime suspend immediately after the headphone
triggers the unsol event.

Follow the sequence of legacy hda driver and set a autosuspend delay
of 1sec after card registration (refer to pci/hda/hda_intel.c and
pci/hda/hda_codec.c).

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Co-developed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Co-developed-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
@ranj063
Copy link
Collaborator

ranj063 commented Apr 7, 2020

SOFCI TEST

@kv2019i
Copy link
Collaborator Author

kv2019i commented Apr 7, 2020

@ClarexZhou or @juimonen , could you double-check this works ok on Mantis? It seems this is otherwise good to go -- we do need ack from you @jason77-wang as well before merging.

@Liviali155
Copy link

Test on Mantis,jack detection is pass and has no side effect

@ClarexZhou
Copy link

ClarexZhou commented Apr 7, 2020

Tested this PR on lenovo. Mic jack detection works. Still has issue "Trigger again when runtime PM enter suspend" and it's caused by one upstream commit. See #1837 (comment). On sof-dev branch, revert that commit directly failed.

@Liviali155 also verified on Mantis. All works ok. Also no side effect.

@plbossart
Copy link
Member

Can we update this PR to cherry-pick 476c02e ("ALSA: hda/realtek - a fake key event is triggered by running shutup") and redo the tests?

Copy link

@jason77-wang jason77-wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kv2019i
Copy link
Collaborator Author

kv2019i commented Apr 8, 2020

@plbossart wrote:

Can we update this PR to cherry-pick 476c02e ("ALSA: hda/realtek - a fake key event is triggered by running shutup") and redo the tests?

I reviewed that again and that seems orthogonal. As this fix helps with so many machines and has taken so long already, let's go ahead and merge this and fix any follow-ups after the rebase. We anyways still have more issues (like the CML regression #1938).

@kv2019i kv2019i merged commit 22d5e98 into thesofproject:topic/sof-dev Apr 8, 2020
@plbossart
Copy link
Member

@plbossart wrote:

Can we update this PR to cherry-pick 476c02e ("ALSA: hda/realtek - a fake key event is triggered by running shutup") and redo the tests?

I reviewed that again and that seems orthogonal. As this fix helps with so many machines and has taken so long already, let's go ahead and merge this and fix any follow-ups after the rebase. We anyways still have more issues (like the CML regression #1938).

@kv2019i I wasn't making this up, this patch was listed in #1837 (comment)

@kv2019i
Copy link
Collaborator Author

kv2019i commented Apr 8, 2020

@plbossart wrote:

@kv2019i I wasn't making this up, this patch was listed in #1837 (comment)

Aa, my bad, I didn't check that comment anymore. But alas, it's a regression that also shows up with legacy driver, and now that we align with legacy driver, we hit the regression as well. But it's fixed in upstream, so we should be good once we do the upstream rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants