[SRU][Bionic][PATCH 0/2] HDMI/DP audio can't work on the laptop of Dell Latitude 5495
Hui Wang
hui.wang at canonical.com
Mon Jul 30 00:48:42 UTC 2018
Sorry, I met the same building error before I sent the patches to
review. Since the patch neither touch get_client_id definition nor
get_client_id implementation, I thought it is a problem of building
environment, then I just made a change like below to make the building
process pass:
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -119,7 +119,7 @@ struct vga_switcheroo_handler {
int (*switch_ddc)(enum vga_switcheroo_client_id id);
int (*power_state)(enum vga_switcheroo_client_id id,
enum vga_switcheroo_state state);
- enum vga_switcheroo_client_id (*get_client_id)(struct pci_dev
*pdev);
+ int (*get_client_id)(struct pci_dev *pdev);
};
Now the building error happens again on your machine, it doesn't look
like a problem of building environment. So I took some time to
investigate this issue.
The declaration of "enum vga_switcheroo_client_id
(*get_client_id)(struct pci_dev *pdev);" and the implementation of
"static int nouveau_dsm_get_client_id(struct pci_dev *pdev)" exist in
the kernel (bionic, artful) for a long time, but
"-Werror=incompatible-pointer-types" didn't report it as an error, after
applied these 2 patches, it is reported as an error, that is because the
patch touches the definition of "enum vga_switcheroo_client_id", before
applying these 2 patches, the vga_switcheroo_client_id includes a
negative numer: VGA_SWITCHEROO_UNKNOWN_ID = -1, but after applying the
patches, there is no negative number anymore in the "enum
vga_swicheroo_client_id".
I guess if the definition of enum includes negative number, the c
compiler treat it as int type, that is why artful and bionic did not
expose building error before.
To fix it, we also need to cherry-pick 4 patches:
f43cda5c76922777f4fe5026ee5984364ae5a918 drm/nouveau: fix
nouveau_dsm_get_client_id()'s return type
4a8f264a8a8756bb7d3a478d08e449c67d291ab9 drm/radeon: fix
radeon_atpx_get_client_id()'s return type
09daf474d27aeb9fbd2f665b613d98c76f1e84f0 drm/amdgpu: fix
amdgpu_atpx_get_client_id()'s return type
19e752052b9dd5b1ab901f1982b5d2ae7c188ca2 platform/x86: apple-gmux: fix
gmux_get_client_id()'s return type
And I will send the new patchset of V2 to review.
Thanks,
Hui.
On 2018年07月26日 16:08, Khaled Elmously wrote:
> Hui, this seems to break the build for me. Could you please confirm that it builds fine for you?
>
> This is what I get:
>
> /tmp/kernel-kmously-60a6102-lUVu/build/drivers/gpu/drm/nouveau/nouveau_acpi.c:212:19: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
> .get_client_id = nouveau_dsm_get_client_id,
> ^~~~~~~~~~~~~~~~~~~~~~~~~
> /tmp/kernel-kmously-60a6102-lUVu/build/drivers/gpu/drm/nouveau/nouveau_acpi.c:212:19: note: (near initialization for 'nouveau_dsm_handler.get_client_id')
> cc1: some warnings being treated as errors
> /tmp/kernel-kmously-60a6102-lUVu/build/scripts/Makefile.build:332: recipe for target 'drivers/gpu/drm/nouveau/nouveau_acpi.o' failed
> make[6]: *** [drivers/gpu/drm/nouveau/nouveau_acpi.o] Error 1
> make[6]: *** Waiting for unfinished jobs....
> /tmp/kernel-kmously-60a6102-lUVu/build/scripts/Makefile.build:606: recipe for target 'drivers/gpu/drm/nouveau' failed
> make[5]: *** [drivers/gpu/drm/nouveau] Error 2
> /tmp/kernel-kmously-60a6102-lUVu/build/scripts/Makefile.build:606: recipe for target 'drivers/gpu/drm' failed
> make[4]: *** [drivers/gpu/drm] Error 2
> /tmp/kernel-kmously-60a6102-lUVu/build/scripts/Makefile.build:606: recipe for target 'drivers/gpu' failed
> make[3]: *** [drivers/gpu] Error 2
> /tmp/kernel-kmously-60a6102-lUVu/build/Makefile:1060: recipe for target 'drivers' failed
> make[2]: *** [drivers] Error 2
> make[2]: Leaving directory '/tmp/kernel-kmously-60a6102-lUVu/build/debian/build/build-generic'
> Makefile:146: recipe for target 'sub-make' failed
> make[1]: *** [sub-make] Error 2
> make[1]: Leaving directory '/tmp/kernel-kmously-60a6102-lUVu/build'
> debian/rules.d/2-binary-arch.mk:70: recipe for target '/tmp/kernel-kmously-60a6102-lUVu/build/debian/stamps/stamp-build-generic' failed
> make: *** [/tmp/kernel-kmously-60a6102-lUVu/build/debian/stamps/stamp-build-generic] Error 2
> +++gbk++++ build exit status was 2
>
>
>
> On 2018-07-20 14:41:21 , Hui Wang wrote:
>> BugLink: https://bugs.launchpad.net/bugs/1782689
>>
>> This bug comes from the OEM project, and the engineer Jim Qu from AMD took
>> almost 2 weeks to investigate this problem, then he worte these two patches to
>> fix this problem and now the patches are merged to sound repository.
>>
>> According to Jim Qu's investigation, the root cause of this problem is:
>> 1. there is two GPU on the system. iGPU has a audio codec for HDMI output,
>> and dGPU is without audio codec it is only for offload rendering.
>> 2. under runtime pm, when dGPU suspend, amdgpu will also call vgaswitchroo
>> driver to power off audio which vgaswitchroo client is VGA_SWITCHEROO_DIS.
>> 3. In current HDA audio driver, the iGPU's audio will register to vgaswitchroo
>> as VGA_SWITCHEROO_DIS, therefore, the audio will be selected and powered off
>> by runtime pm.
>>
>> [Impact]
>> On the Dell Latitude 5495, If we plug a monitor with audio capability to the
>> HDMI/DP ports, we can't find HDMI/DP audio sinks as expected, then we can't
>> play any sound through HDMI/DP audio.
>>
>> [Fix]
>> With these two patches, the driver will not always set vgaswicheroo clients of
>> HDA audio as VGA_SWITCHEROO_DIS, it will set it to _DIS or _IGD with the help
>> of callback function of DRM drivers. So on this machine, the vgaswicheroo client
>> will be set _IGD, then it will not be powered off when discrete gpu is powered off.
>>
>> [Test Case]
>> We tested plug/unplug detection and playback through HDMI/DP audio, everything works
>> well.
>>
>> [Regression Potential]
>> Very low, without these two patches, the vgaswitchroo client of audio will be
>> set to _DIS unconditionally, it did not expose any problem because in the past,
>> all the HDMI/DP audio codecs are in the discreate GPU. But on Latitude 5495, the
>> HDMI/DP audio codec is in the integrated GPU, so we need to change the driver to
>> let DRM driver decide if it is _DIS or _IGD, it will not introduce regression for
>> old mahcines on old machines, the client will be set to _DIS as before.
>>
>> And we have tested these two patches on some old machines with two gpus like A+A
>> , I+A and I+N, all of them worked well as before.
>>
>>
>> Jim Qu (2):
>> ALSA: hda: use PCI_BASE_CLASS_DISPLAY to replace PCI_CLASS_DISPLAY_VGA
>> vga_switcheroo: set audio client id according to bound GPU id
>>
>> drivers/gpu/vga/vga_switcheroo.c | 62 +++++++++++++++++++++++++++++++++-------
>> include/linux/vga_switcheroo.h | 8 +++---
>> sound/pci/hda/hda_intel.c | 13 +++++----
>> 3 files changed, 62 insertions(+), 21 deletions(-)
>>
>> --
>> 2.7.4
>>
>>
>> --
>> kernel-team mailing list
>> kernel-team at lists.ubuntu.com
>> https://lists.ubuntu.com/mailman/listinfo/kernel-team
More information about the kernel-team
mailing list