Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys

From: Hans de Goede
Date: Fri Jun 24 2022 - 05:25:08 EST


Hi,

On 6/24/22 07:14, Kenneth Chan wrote:
> Hi Hans,
>
>
> On Tue, 21 Jun 2022 at 17:34, Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>>
>>
>>> The mute, volume up/down keys are still duplicated by atkbd after
>>> applying 0005-platform-x86-panasonic-laptop-filter-out-duplicate-v.patch.
>>
>> Hmm, can you add a couple of:
>>
>> pr_info("data 0x%02x\n", data);
>>
>> at the top of the new panasonic_i8042_filter() function
>> and then check in dmesg what is output for the volume keys.
>>
>
> Volume Down 0xe0 0x2e / 0xe0 0xae
> Mute 0xe0 0x20 / 0xe0 0xa0
> Volume Up 0xe0 0x30 / 0xe0 0xb0
>
> I replaced those values with these and it filters out the duplicate keys. Yay!!!

That is great.

>> The patch should filter out those duplicate keys, unless
>> I got the codes wrong somehow.
>>
>> Also can you please try the attached 2 patches on top of my
>> last series, this should hide the broken panasonic backlight
>> device and otherwise it should make no difference (but maybe
>> double check the duplicate brightness keys are not back.
>>
>
> The last 2 patches crash as soon as the panasonic-laptop module is
> loaded. It's compiled against kernel v5.18.5. Please see the
> attachment. I'm going to compile it against the latest and see if it
> works.

No need to compile against the latest, I messed things up, sorry.

To fix the crash the following diff is necessary:

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 0fa7695089e2..b8fa0a64698b 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -1011,10 +1011,10 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
result = PTR_ERR(pcc->backlight);
goto out_input;
}
- }

- /* read the initial brightness setting from the hardware */
- pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT];
+ /* read the initial brightness setting from the hardware */
+ pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT];
+ }

/* Reset initial sticky key mode since the hardware register state is not consistent */
acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, 0);

I'm going to send out a whole new version of my entire series, including
an updated i8042 filter. Please drop all my previous patches and try
the new version (I'll put on you in the Cc of the upstream submission of
the series).

Regards,

Hans