-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve quirks detection for es8336 #4756
base: topic/sof-dev
Are you sure you want to change the base?
Conversation
Can one of the admins verify this patch?
|
Most of the ES83xx codec configuration is exposed in the DSDT table and accessible via a _DSM method. Start adding basic definitions and helpers to dump the information. Reviewed-by: Mauro Carvalho Chehab <[email protected]> Co-developed-by: David Yang <[email protected]> Signed-off-by: David Yang <[email protected]> Signed-off-by: Pierre-Louis Bossart <[email protected]>
Read jack detection information from _DSM and pre-set value. The value may be overridden with a property set by the machine driver. [mchehab: only override JD inverted from _DSM if quirks is enabled] Reviewed-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Pierre-Louis Bossart <[email protected]>
Read jack detection information from _DSM and pre-set value. The value may be overridden with a property set by the machine driver. [mchehab: only override JD inverted from _DSM if quirks is enabled] Reviewed-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Pierre-Louis Bossart <[email protected]>
The ACPI entry for es83xx should contain its configuration at _DSM. It is helpful to debug problems by looking on its contents. So, add a debug function that outputs its contents as read by the Kernel. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
The enable GPIOs can either be low or high level activated. Add a logic to detect it from _DSM. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
The _DSM method has an entry to detect the microphone type, and where they're attached. Add support for checking it. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Now that we can read GPIO enable level from ACPI _DSM, use it to properly set the right GPIO levels. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Sometimes, the ACPI _DSM may not have a valuet set for enable on low/high. So, a call to auto-detect it via: es83xx_dsm(dev, SPK_CTL_IO_LEVEL_ARG, &value); and: es83xx_dsm(dev, HP_CTL_IO_LEVEL_ARG, &value); returns 0xff. By default, when this is not defined, the logic sets to GPIO_CTL_IO_LEVEL_HIGH, which matches the expected behavior. However, at least on Huawei Matebook D15 (BOHB-WAX9), setting them both to GPIO_CTL_IO_LEVEL_HIGH is wrong. So, add a quirk to ignore BIOS value for such fields. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
5d2be2f
to
3ef3117
Compare
Btw, did a quick test today on a different notebook: Huawei 14 2021: BIOS DSM is also not reliable there: quirks are needed. I'll try to add a patch on the top of this series adding support for it, depending on weather I'll be able to keep such notebook long enough to write the patches and test it. |
Matebook 14 (2021) support for internal MIC is not trivial: it uses AMIC on TGL. Currently, it seems that this is not properly supported, as device probe is called with |
Trying to not enable DMIC on Huawei Matebook 14 (after some patches to address it) doesn't work, as sof-audio-pci-intel-tgl complains with: [ 4.303999] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:22:1 Kernel ABI 3:23:0 I opened a separate issue describing the problem at: #4757 |
We need that to retrieve data from _DSM table, on an early check at the driver probe time. So, move the code to the beginning of the function. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Use the _DSM data to fill the analog microphone ports, removing another quirk. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
As the headphone could be plugged or unplugged any time, including when not streaming, and the stop/suspend events may be turning GPIOs to disable both headphones and speakers, let the delayed workqueue to be called every time Speaker supply event happens. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Despite what DSM reports, jack detection is not inverted on this device. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
This notebook also requires quirks as BIOS is incorrect for speaker/headset GPIOs. According with _DSM: [ 4.027413] es8316 i2c-ESSX8336:00: PLATFORM_HPDET_INV_ARG=0x1 However, jack is not inverted on this device. The speaker/headphone output on this device is: speaker gpio 0 active high, headphone gpio 1 active low However, _DSM reports only: [ 4.030564] es8316 i2c-ESSX8336:00: SPK_CTL_IO_LEVEL_ARG=0x1 Missing information about headphone active on low. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
17cd3fa
to
64af6a2
Compare
Fixed a AMIC probing logic to better cope with AMIC. Still, TGL seems to be relying on having DMIC (perhaps due to UCM settings). |
@mchehab can you attach the log where the DMIC is used instead of AMIC? The SOF driver relies on the ACPI NHLT table to figure out when to enable the DMICs, if that information is incorrect then yet another quirk is needed. |
test this please |
Use _DSM table to detect GPIO level and AMIC. This change has @plbossart patches that apply, with some changes as discussed on #4112.
Tested on Huawei Matebook D15 ( BOHB-WAX9):
Pluging/unpluging jack events also work as expected, getting "jack unplugged" messages when removing the headset jack:
Also tested basic audio on Matebook 14, although UCM logic for this device very likely needs to be patched to be more generic.