Enable AMD Sensor Fusion HUB on kernel 5.11 snapshot

2021-01-03 Thread Luya Tshimbalanga
Hello team,

AMD Sensor Fusion HUB finally landed on kernel 5.11 which is yet enabled on the 
main repository. After a rebuilt from the 20201223 snapshot by setting the hub 
as a module, the sensor failed to start.
From the test:

- Kernel: 5.11.0-0.rc0.20201223git614cb5894306.107.amdsfh.fc33.x86_64
- AMD_SFH_HID enabled as a module
- lsmod | grep amd: amd_sfh36864  0

Revisitng the closed upstream bug 
https://bugzilla.redhat.com/show_bug.cgi?id=1651886 ,

lspci -nn | grep VGA

03:00.7 Non-VGA unclassified device []: Advanced Micro Devices, Inc. [AMD] 
Raven/Raven2/Renoir Sensor Fusion Hub [1022:15e4]

It seems the firmware lacks support of the sensor as iio is unlisted. Will it 
be possible to fully enable the sensor and update the linux-firmware? Thanks
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org


Re: Testing AMD Sensors Fusion HUB

2020-02-12 Thread Luya Tshimbalanga
Thanks for looking at the updated patches: 
https://lore.kernel.org/lkml/1581476197-25854-1-git-send-email-sandeep.si...@amd.com/

I built custom kernel with these patches [1] which confirm the HID sensors are 
left unused on my HP Envy x360 Ryzen 2500u.

ls -l /sys/bus/hid/devices/
total 0
lrwxrwxrwx. 1 root root 0 Feb 11 17:03 0018:04F3:264C.0001 -> 
../../../devices/platform/AMDI0010:00/i2c-0/i2c-ELAN0732:00/0018:04F3:264C.0001


References:
[1] https://copr.fedorainfracloud.org/coprs/luya/kernel-amdsfh/build/1237128/.
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org


Re: Testing AMD Sensors Fusion HUB

2020-02-07 Thread Luya Tshimbalanga
> Hi,
> 
> I'm afraid I do not have enough knowledge about the AMD Sensors Fusion HUB 
> stuff to
> be able to help you with this, you could try reaching out the developers of 
> the
> patches, or wait for this to land upstream.
> 
I think the developers are working on an update based on review at this time. 
It seems the HID components drivers for the sensors hub failed to build for 
some odd reasons. I will test again once new updated patches come with the fix. 

Thanks for the help and assistance.

Sincerely,

Luya
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org


Re: Testing AMD Sensors Fusion HUB

2020-02-05 Thread Luya Tshimbalanga
According to the latest patch [1], the sensor should be identifed by 
"AMDI0080". Apparently, some drivers or modules aren't built:
- AMD_SFH_HID_CLIENT : AMD(R) PCIe MP2 Communication Client Driver
- AMD_MP2_SENSORS_TRANSPORT : AMD MP2 Sensors transport  driver

Test done with with this custom kernel with available SRPM: 
https://copr.fedorainfracloud.org/coprs/luya/kernel-amdsfh/build/180/

References
---
[1] https://patchwork.kernel.org/patch/11355497/
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org


Re: Testing AMD Sensors Fusion HUB

2020-02-05 Thread Luya Tshimbalanga


On 2020-02-05 12:29 a.m., Hans de Goede wrote:


The kernel driver in use here shows that the new sensor fusion hub 
driver is loading,
I believe it is supposed to work as a HID driver, so I wonder what 
your output of:


ls /sys/bus/hid/devices

is now?


ls /sys/bus/hid/devices/
0018:04F3:264C.0001

ls -l /sys/bus/hid/devices/
total 0
lrwxrwxrwx. 1 root root 0 Feb  4 15:56 0018:04F3:264C.0001 -> 
../../../devices/platform/AMDI0010:00/i2c-0/i2c-ELAN0732:00/0018:04F3:264C.0001


It seems the sensors wrongly detect a stylus.

--
Luya Tshimbalanga
Fedora Design Team
Fedora Design Suite maintainer
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org


Re: Testing AMD Sensors Fusion HUB

2020-02-04 Thread Luya Tshimbalanga
The build was successful based on kernel 5.6.0 rc0 git1.9. compiling the AMD 
Sensors Fusion HUB as modules. From the lsmod:

 32768  0
kvm_amd   110592  0
kvm   802816  1 kvm_amd
ccp   106496  1 kvm_amd
amdgpu   5308416  8
amd_iommu_v2   20480  1 amdgpu
gpu_sched  40960  1 amdgpu
i2c_algo_bit   16384  1 amdgpu
ttm   122880  1 amdgpu
drm_kms_helper233472  1 amdgpu
drm   585728  11 gpu_sched,drm_kms_helper,amdgpu,ttm
amd_sfhtp_hid  24576  0
pinctrl_amd32768  1
amd_mp2_pcie   20480  1 amd_sfhtp_hid

One issue is how to enable amd_mp2_pcie from:
03:00.7 Non-VGA unclassified device: Advanced Micro Devices, Inc. [AMD] 
Raven/Raven2/Renoir Sensor Fusion Hub
Subsystem: Hewlett-Packard Company Device 8497
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- 
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- 
Kernel driver in use: pcie_mp2_amd
Kernel modules: amd_mp2_pcie


___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org


Testing AMD Sensors Fusion HUB

2020-02-02 Thread Luya Tshimbalanga
Hello team,
I set up a COPR [1] for testing kernel with enabled AMD Sensors Fusion HUB 
(AMD_SFH_HID) [2] straight from the patchwork  and also did a scratch build 
(https://koji.fedoraproject.org/koji/taskinfo?taskID=41333949) . After reboot, 
it seems the amd_sfh_hid driver failed to get detected. Is there a way to make 
it work?
The SRPM is on the COPR repository.

References
---
[1] https://copr.fedorainfracloud.org/coprs/luya/kernel-amdsfh/
[2] https://patchwork.kernel.org/project/linux-iio/list/?submitter=175589
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org


Re: [PATCH] Upstream fix for Raven Ridge

2019-11-29 Thread Luya Tshimbalanga
I tested kernel-5.4.0-2.fc32 for rawhide with the fix which works as intended 
and solved the freezing issue related on AMD Raven Ridge running radeontop. The 
kernel regression test passed as well.
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org


Re: [PATCH] Upstream fix for Raven Ridge

2019-11-26 Thread Luya Tshimbalanga
Yes, the fixes apply cleaning on 5.3 except the revert change. Here is an 
extract:

Applying: drm/amdgpu: disable gfxoff on original raven
Applying: drm/amdgpu: disable gfxoff when using register read interface
Applying: Revert "drm/amd/display: enable S/G for RAVEN chip"
error: patch failed: drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:511
error: drivers/gpu/drm/amd/amdgpu/amdgpu_display.c: patch does not apply
error: patch failed: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:688
error: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c: patch does not apply
Patch failed at 0094 Revert "drm/amd/display: enable S/G for RAVEN chip"
 
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org


[PATCH] Upstream fix for Raven Ridge

2019-11-23 Thread Luya Tshimbalanga

Hello team,

Upstream provided several bug fix related to AMD APU Raven Ridge which 
hangs when using some applications like radeontop to read its interface 
[1]. Test model was 2018 HP Envy x360 Ryzen 2500U (device id 15dd):


drm/amdgpu: disable gfxoff when using register read interface
--

https://cgit.freedesktop.org/~agd5f/linux/commit/?h=drm-fixes-5.4&id=c57040d333c6729ce99c2cb95061045ff84c89ea

Original Raven Ridge (15d8) becomes unstable when using gfxoff. The test 
model  Ryzen 2500U with id 15dd and above is unaffected


drm/amdgpu: disable gfxoff on original raven
-

https://cgit.freedesktop.org/~agd5f/linux/commit/?h=drm-fixes-5.4&id=941a0a7945c39f36a16634bc65c2649a1b94eee1


Revert "drm/amd/display: enable S/G for RAVEN chip"



https://cgit.freedesktop.org/~agd5f/linux/commit/?h=drm-fixes-5.4&id=a0184d71163aab258d73141a8839675d6cbdcf40


It will be nice to backport for the current kernel 5.3. Thanks in advance.


Reference:

---

[1]https://bugzilla.kernel.org/show_bug.cgi?id=205497

--
Luya Tshimbalanga
Fedora Design Team
Fedora Design Suite maintainer

___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org


[PATCH] ALSA hda realtek: Add quirk for HP Envy x360

2019-08-13 Thread Luya Tshimbalanga
As highlighted on the bug report [1], the proposed patch [2] from Linux Kernel 
team on behalf of Takashi Iwai restores the functionality of LED mute button on 
HP Envy x360 notably AMD Ryzen models

Here is the extract:

From 190d03814eb3b49d4f87ff38fef26d36f3568a60 Mon Sep 17 00:00:00 2001
From: Takashi Iwai 
Date: Tue, 13 Aug 2019 17:39:56 +0200
Subject: [PATCH] ALSA: hda/realtek - Add quirk for HP Envy x360

HP Envy x360 (AMD Ryzen-based model) with 103c:8497 needs the same
quirk like HP Spectre x360 for enabling the mute LED over Mic3 pin.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204373
Cc: 
Signed-off-by: Takashi Iwai 
---
 sound/pci/hda/patch_realtek.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index de224cbea7a0..8aaf1d9c55cf 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6987,6 +6987,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", 
ALC221_FIXUP_HP_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", 
ALC221_FIXUP_HP_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", 
ALC269_FIXUP_HP_MUTE_LED_MIC3),
+   SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", 
ALC269_FIXUP_HP_MUTE_LED_MIC3),
SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", 
ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
-- 
2.16.4




References
---
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1734195
[2] https://bugzilla.kernel.org/show_bug.cgi?id=204373#c6
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org


Touchscreen support on HP laptops broken due misconfiguration on ACPI

2018-11-11 Thread Luya Tshimbalanga

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Few months ago, I brought a HP Envy x360 Ryzen 2500u [1] to try the
touchscreen and stylus functions. Unfortunately that support is
currently broken and unresolved  inside the kernel for years on previous
models as revealed on the upstream bug report [2].

One of users provided a workaround [3] which needs refinement from
upstream which seems very busy given the time of submitted patch. I
vainly attempted to build a new kernel using the latest snapshot [4]
before filing the bug report on bugzilla[5] linking upstream issue.

What would be great is one of maintainers knowing the field either
building a kernel-test to verify the workaround restoring the
touchscreen support on HP touchscreen laptops running on AMD processors
or build a rawhide version with that patch.

Thanks in advance,

Luya

References:

[1] https://fedoraproject.org/wiki/User:Luya/Laptops/HP_Envy_x360

[2] https://bugzilla.kernel.org/show_bug.cgi?id=198715

[3] https://bugzilla.kernel.org/show_bug.cgi?id=198715#c14

[4] https://copr.fedorainfracloud.org/coprs/luya/kernel-hp-acpi-hack/

[5] https://bugzilla.redhat.com/show_bug.cgi?id=1644013

-BEGIN PGP SIGNATURE-

iQEzBAEBCAAdFiEEWyB+BQtYiFz4GUNDXlKBdNiiYJoFAlvo92gACgkQXlKBdNii
YJqoRgf8DSbnQPTGXikFjK9vu473NzYPa01ELTcushUqiU+QztpDy1wn78OeWmr2
aUCd5j5DXyW79cuKw5s1HJZcVbyVDbbfYzk0HBIxKlCOlMWqnGnxsstiDPLrfGtc
YFKV40CHs2I2+ZYY8ZmRY1aQyEZHBHZNU/v+Gu2wrSL9/zDRwDYlK1uoOipItN/Q
vdRtq9Y4HjV7Oderk1CeUIXwkGd3qfwHBKpqFKUnPrZqZ08jXabD5JOs0m2zFwBb
Jy0Mz6+gDsoTlJSzf1nyIh00mdWkH7xDRFExUW/88jjt/payjQjFXCmM/gtdXjtg
zhA112dfHAHTTA02sjBOhRiOnbejrw==
=2kYI
-END PGP SIGNATURE-
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org


Patches related to ECDT in the kernel

2017-10-05 Thread Luya Tshimbalanga
Hello team,

Upstream kernel provided the patches needed to address bug 
(https://bugzilla.kernel.org/show_bug.cgi?id=196847) while waiting for the 
merge to the mainline:
https://patchwork.kernel.org/patch/9971553/
https://patchwork.kernel.org/patch/9971557/

It is currently made for latest 4.14 snapshot as it resolves a resume issues 
causing lockup on some laptop models having ECDT EC, and invalid DSDT EC.

Thanks in advance.
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org


Re: Assistance to built a kernel with patches

2017-09-08 Thread Luya Tshimbalanga
On 08/09/17 05:16 AM, Josh Boyer wrote:
> On Fri, Sep 8, 2017 at 2:48 AM, Luya Tshimbalanga
>  wrote:
>> Hello team,
>>
>> I attemptedt o build a patched kernel from the Fedora repo using the 
>> tutorial[1] and hit a roadblock as seen from COPR repository:
>> https://copr.fedorainfracloud.org/coprs/luya/kernel-acpi-ec/builds/
>>
>> You can check the details of the bug on
>> https://bugzilla.kernel.org/show_bug.cgi?id=196847
>>
>> along the needed patches for testing
>> https://patchwork.kernel.org/patch/9931477/
>> https://patchwork.kernel.org/patch/9931481/
>> https://patchwork.kernel.org/patch/9931473/
>>
>> Could someone provide a guide for addressing the issue?
> The patches you included in the srpm are all raw diffs.  The
> kernel.spec applies patches with git, which means the patches need to
> be in a format that 'git am' can take.  If you download the mbox
> format of the patches, it should work.
>
> josh
Thank you Josh. Using the mbox format of the patches solved the issue.

Luya

-- 
Luya Tshimbalanga
Graphic & Web Designer
E: l...@fedoraproject.org
W: http://www.coolest-storm.net


___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org


Re: Assistance to built a kernel with patches

2017-09-08 Thread Luya Tshimbalanga
On 08/09/17 05:16 AM, Josh Boyer wrote:
> On Fri, Sep 8, 2017 at 2:48 AM, Luya Tshimbalanga
>  wrote:
>> Hello team,
>>
>> I attemptedt o build a patched kernel from the Fedora repo using the 
>> tutorial[1] and hit a roadblock as seen from COPR repository:
>> https://copr.fedorainfracloud.org/coprs/luya/kernel-acpi-ec/builds/
>>
>> You can check the details of the bug on
>> https://bugzilla.kernel.org/show_bug.cgi?id=196847
>>
>> along the needed patches for testing
>> https://patchwork.kernel.org/patch/9931477/
>> https://patchwork.kernel.org/patch/9931481/
>> https://patchwork.kernel.org/patch/9931473/
>>
>> Could someone provide a guide for addressing the issue?
> The patches you included in the srpm are all raw diffs.  The
> kernel.spec applies patches with git, which means the patches need to
> be in a format that 'git am' can take.  If you download the mbox
> format of the patches, it should work.
>
> josh
Thank you Josh. Using the mbox format of the patches solved the issue.

Luya

-- 
Luya Tshimbalanga
Graphic & Web Designer
E: l...@fedoraproject.org
W: http://www.coolest-storm.net


___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org


Assistance to built a kernel with patches

2017-09-07 Thread Luya Tshimbalanga
Hello team,

I attemptedt o build a patched kernel from the Fedora repo using the 
tutorial[1] and hit a roadblock as seen from COPR repository:
https://copr.fedorainfracloud.org/coprs/luya/kernel-acpi-ec/builds/

You can check the details of the bug on 
https://bugzilla.kernel.org/show_bug.cgi?id=196847

along the needed patches for testing
https://patchwork.kernel.org/patch/9931477/
https://patchwork.kernel.org/patch/9931481/
https://patchwork.kernel.org/patch/9931473/

Could someone provide a guide for addressing the issue?

Thank you,


Luya


Reference
-
[1] https://fedoramagazine.org/building-fedora-kernel/
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org


Re: [PATCH] ACPI / EC: Add fully functioning ECDT EC

2016-08-31 Thread Luya Tshimbalanga
Below is the patch


From: Lv Zheng 
Subject: [PATCH] ACPI / EC: Add fully functioning ECDT EC

It is possible to register _Qxx from namespace and use the ECDT EC to
do further handling. The reported bug reveals that Windows is using
ECDT in this way.
This patch extends Linux to support ECDT in this way.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=115021
Reported-by: Peter Wu 
Reported-by: Luya Tshimbalanga 
Signed-off-by: Lv Zheng 
---
Index: linux-acpica/drivers/acpi/ec.c
===
--- linux-acpica.orig/drivers/acpi/ec.c
+++ linux-acpica/drivers/acpi/ec.c
@@ -112,6 +112,8 @@ enum {
EC_FLAGS_STOPPED,   /* Driver is stopped */
EC_FLAGS_COMMAND_STORM, /* GPE storms occurred to the
 * current command processing */
+   EC_FLAGS_QUERY_HANDLER_INSTALLED,
+   /* _Qxx handlers installed */
 };
 
 #define ACPI_EC_COMMAND_POLL   0x01 /* Available for command byte */
@@ -1228,6 +1230,15 @@ acpi_ec_space_handler(u32 function, acpi
 static acpi_status
 ec_parse_io_ports(struct acpi_resource *resource, void *context);
 
+static void free_acpi_ec(struct acpi_ec *ec)
+{
+   if (first_ec == ec)
+   first_ec = NULL;
+   if (boot_ec == ec)
+   boot_ec = NULL;
+   kfree(ec);
+}
+
 static struct acpi_ec *make_acpi_ec(void)
 {
struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL);
@@ -1290,7 +1301,7 @@ ec_parse_device(acpi_handle handle, u32 
return AE_CTRL_TERMINATE;
 }
 
-static int ec_install_handlers(struct acpi_ec *ec)
+static int ec_install_handlers(struct acpi_ec *ec, bool handle_events)
 {
acpi_status status;
 
@@ -1319,6 +1330,9 @@ static int ec_install_handlers(struct ac
set_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags);
}
 
+   if (!handle_events)
+   return 0;
+
if (!test_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags)) {
status = acpi_install_gpe_raw_handler(NULL, ec->gpe,
  ACPI_GPE_EDGE_TRIGGERED,
@@ -1331,7 +1345,16 @@ static int ec_install_handlers(struct ac
acpi_ec_enable_gpe(ec, true);
}
}
+   if (!test_bit(EC_FLAGS_QUERY_HANDLER_INSTALLED, &ec->flags)) {
+   /* Find and register all query methods */
+   acpi_walk_namespace(ACPI_TYPE_METHOD, ec->handle, 1,
+   acpi_ec_register_query_methods,
+   NULL, ec, NULL);
+   set_bit(EC_FLAGS_QUERY_HANDLER_INSTALLED, &ec->flags);
+   }
 
+   /* EC is fully operational, allow queries */
+   clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
return 0;
 }
 
@@ -1365,21 +1388,35 @@ static void ec_remove_handlers(struct ac
}
 }
 
-static struct acpi_ec *acpi_ec_alloc(void)
+static int acpi_set_boot_ec(struct acpi_ec *ec, bool refresh_globals,
+   bool handle_events)
 {
-   struct acpi_ec *ec;
+   int ret;
 
-   /* Check for boot EC */
-   if (boot_ec) {
-   ec = boot_ec;
-   boot_ec = NULL;
-   ec_remove_handlers(ec);
-   if (first_ec == ec)
-   first_ec = NULL;
-   } else {
-   ec = make_acpi_ec();
+   /* Release old boot EC */
+   if (refresh_globals) {
+   if (boot_ec) {
+   ec_remove_handlers(boot_ec);
+   free_acpi_ec(boot_ec);
+   }
}
-   return ec;
+
+   /* Switch boot EC to use new EC */
+   ret = ec_install_handlers(ec, handle_events);
+   if (!ret) {
+   if (refresh_globals) {
+   boot_ec = ec;
+   if (!first_ec)
+   first_ec = ec;
+   }
+   acpi_handle_info(ec->handle, "used as boot EC to handle %s\n",
+handle_events ?
+"events and transactions" : "transactions");
+   acpi_handle_info(ec->handle,
+"GPE=0x%lx, I/O: CMD/SC=0x%lx, DATA=0x%lx\n",
+ec->gpe, ec->command_addr, ec->data_addr);
+   }
+   return ret;
 }
 
 static int acpi_ec_add(struct acpi_device *device)
@@ -1390,21 +1427,15 @@ static int acpi_ec_add(struct acpi_devic
strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_EC_CLASS);
 
-   ec = acpi_ec_alloc();
+   ec = make_acpi_ec();
if (!ec)
return -ENOMEM;
if (ec_parse_device(device->handle, 0, ec, NULL) !=
AE_CTRL_TERMINATE) {
-  

[PATCH] ACPI / EC: Add fully functioning ECDT EC

2016-08-30 Thread Luya Tshimbalanga
This patch made by upstream kernel addresses an ACPI EC issue on modern laptops 
notably recent ASUS models due to the way
Windows 8.1 and recently 10 handle ECDT. It will be nice to implement it on 
Fedora kernel until upstream merges it .
Here is the link of the patch: 
https://bugzilla.kernel.org/attachment.cgi?id=231401

I tested the patch following the guideline to build custom kernel (4.8.0rc4) 
and confirmed the affected laptop ASUS X550ZE[1] got its hotkeys
fully restored.

Reference
-
[0] https://bugzilla.kernel.org/show_bug.cgi?id=115021
[1] https://www.asus.com/Notebooks/X550ZE/specifications/


Luya
___
kernel mailing list
kernel@lists.fedoraproject.org
https://lists.fedoraproject.org/admin/lists/kernel@lists.fedoraproject.org