From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sonic312-26.consmr.mail.ne1.yahoo.com (sonic312-26.consmr.mail.ne1.yahoo.com [66.163.191.207]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D61471C6B4 for ; Sun, 5 Jan 2025 14:55:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.163.191.207 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736088959; cv=none; b=GNZfanISf90PDbWQw/M8eA60lMlpLJCOUUTxU0rgSNKZimqQQfYeFnTGebOjavLDdbwXs/4scuOtmUQHCdXwm2EwFlFVwayO5u7UQsr9Ddxc/NExZ4Qxfccd63IcyedsAMuCFY9oUQjWClHKUIl4Xq3dZrxHMpKh/rGW+x0W53E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736088959; c=relaxed/simple; bh=EjZ6Gtou3V2Pj9xAYS4s0a7wvTgwZfsJZtDs1Z4/ES4=; h=Date:From:To:Cc:Message-ID:Subject:MIME-Version:Content-Type: References; b=PC3NpaxmQPel+ZpXe6/fmd5yUandBNTJHbCFoxGIIhY6VosNLUQshZSnHnbTmOlo96eVeRGeaZ04cYN4Cvq3HiB7MG06zM80ArG4Zrp3eXQbZwsGsfs9h2Mm16RU6+cUP3Kty4q49ouTybTxigkA2kBeT0/F8G9X8G5EdgITGno= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=att.net; spf=none smtp.mailfrom=att.net; dkim=pass (1024-bit key) header.d=att.net header.i=@att.net header.b=oeszvRjA; arc=none smtp.client-ip=66.163.191.207 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=att.net Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=att.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=att.net header.i=@att.net header.b="oeszvRjA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=att.net; s=s1024; t=1736088957; bh=EjZ6Gtou3V2Pj9xAYS4s0a7wvTgwZfsJZtDs1Z4/ES4=; h=Date:From:To:Cc:Subject:References:From:Subject:Reply-To; b=oeszvRjAoMOP4WiURA+mKcpqQ6TN32jXFRJHh4juOjO9c0O4dp5akud1g/ZmpAX06wem036id4RIWSlNWeC5hIkdK8u8FhJmEMKRbVTy3ca3WG6biCRq4tXX8HvCgOTU4CuUvYjokAHRWKrNIX/03vBWlbE1lGWt8tpuh/2DSss= X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1736088957; bh=pFja2jj6kGW07mDn5WF33Q9j1I9Bz35EwfqvE6WZJ/5=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=kDF16OPAvZpFwU+lW5+YDpEiAl95lPK4SVCRpCs8wtBsuGSTNXsdZ7QQq0+yFV1EQfiq8aZBGB3K69Qr6QJzYt/5rWfndBGDXDfj63BdNwXk5WzR3S1w8ypUn6fp+f3nU+t3NpghartRvj7QvfyTjj8CBQcTliEFM1B6wBdetbJovF3N9TglqVIl3o/E4dpAIlHqqs0uM1ArmpLXwaA67gj0uPoehVgSGopwf8zhl1E/jcHGKgdqO07S7juVGmzVrwAz3idyz/PZs2j0Wzwe/d57bTojyCHFPNWPnA4SEHR96Pqa8sU7dtTrn5j9c8LAAsxvC0ZC++xct3zJRQercQ== X-YMail-OSG: IVe3fzMVM1mB6VuVc7yqYxo9z1jrJnJ0XgSqDDRU9Qkvgkv19l.11iQYiaINPdk ZvSnw.7svozUSJb4pEfmWnQ3LGJ9QvoHTEbpEw9reTcryHhz70c0Iz6Nyyoo9dUJiJdiTz.22J.n oboaatIaCKDU8phFTRcUjQc5jinmc9cAFeMy0S1cNbTze3psPFC54IJsgG3INwRGG0su9_QJwV.n nG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 5 Jan 2025 14:55:57 +0000 Date: Sun, 5 Jan 2025 14:31:21 +0000 (UTC) From: Stuart Balfour To: "chiu@endlessm.com" , "luca.stefani.ge1@gmail.com" , "corentin.chary@gmail.com" , "hdegoede@redhat.com" , "mgross@linux.intel.com" Cc: "acpi4asus-user@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" , "platform-driver-x86@vger.kernel.org" Message-ID: <814215714.9758748.1736087481257@mail.yahoo.com> Subject: asus-wmi fnlock review Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable References: <814215714.9758748.1736087481257.ref@mail.yahoo.com> X-Mailer: WebService/1.1.23040 YMailNorrin On Asus laptops starting about 2019, a new ACPI device id 0x100023 associat= ed with fnlock was added. The BIOS option "Fn Lock Option [enabled/disabled]" = under advanced tab sets the start up value for the device. When enabled, Fn+ESC toggles the fnlock mode; when disabled, Fn+ESC has no effect. Two ACPI Meth= odIds, one for device_set and one for device_status (DSTS) are defined. Device_sta= tus returns presence bit, external bit (device is set by hardware, not in ACPI)= and status bit (bit 0).=C2=A0 Bit 0 is 0 when the option is enabled and 1 when = disabled. The device_set method ignores its argument, does nothing and returns 1 (put= ative success). Asus specifies that fnlock state cannot be read or set directly by WMI.=C2= =A0 Its initial (default) setting is by the BIOS, though that does not appear in th= e GUI. Thereafter, its state may be toggled by Fn+ESC if enabled. That toggles a h= ard- ware line to the EC0 keyboard controller, and issues a WMI event 0x4E (NOTIFY_FNLOCK_TOGGLE). The asus-wmi driver has a local boolean which tracks the state of fnlock.= =C2=A0 The initial value is ostensibly set from the asus-wmi module_param boolean fnlock_default (if present), otherwise an assigned default value.=C2=A0 The= reafter, whenever a toggle event is received, it toggles the tracking boolean, then = calls the ACPI device_set method via asus_wmi_fnlock_update() with the boolean as argument. There are two problems: 1) if the driver sets the initial fnlock state to o= ther than the true state set by the BIOS; 2) calling the ACPI device_set method = for device 0x100023 has nil effect. (1) implies that the asus-wmi module option fnlock_default cannot be effectuated on at least some recent Asus platforms= . (2) means the asus-wmi driver has confounding dummy code associated with AC= PI device 0x100023.=C2=A0 The ECO flag bit XKTM that would've been overwritten= had the driver been enabled to set the device state belongs to the BIOS 'Fn Lock Op= tion', not fnlock. fnlock is not an ACPI device. There is an overarching conceptual problem: the semantics of device 0x10002= 3, which is not settable by the WMI, are to communicate the state of the Fn Lo= ck Option in the BIOS, not the state of fnlock itself, to user space. When we = query the device, we are asking: "does Fn+ESC toggle fnlock mode?"=C2=A0 The inef= fectual attempts by the driver to set the device to the actual fnlock state usurp t= he defined semantics.=C2=A0 Further, this reverse feed to the ACPI is not some= thing I see for other devices, except in cases where the device state is actually set synchronously by the ACPI. In case you don't have access to a relevant platform, here's the ACPI Metho= dIDs for device 0x100023 on Asus Proart P16 model H7606WV (BIOS version H7606WV.= 312, the latest and only version listed on Asus support site as of 12/20/24): =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 /* device_status (DSTS) */ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 If ((IIA0 =3D=3D 0x00100023)) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 If ((^^PCI0.SBRG.EC0.XKTM =3D=3D Ze= ro)) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C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A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 If ((IIA0 =3D=3D 0x00100023)) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Return (One) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 } Here's the enigmatic code in asus-wmi.c from kernel version 6.12.6: #define ASUS_WMI_DEVID_FNLOCK=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 0x00100023 struct asus_wmi { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ... =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bool fnlock_locked; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ... } static bool fnlock_default =3D true; module_param(fnlock_default, bool, 0444); static bool asus_wmi_has_fnlock_key(struct asus_wmi *asus) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 u32 result; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 asus_wmi_get_devstate(asus, ASUS= _WMI_DEVID_FNLOCK, &result); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return (result & ASUS_WMI_DSTS_P= RESENCE_BIT) && =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 !(result & ASUS_WMI_FNLOCK_BIOS_DISABLED); } static void asus_wmi_fnlock_update(struct asus_wmi *asus) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 int mode =3D asus->fnlock_locked= ; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 asus_wmi_set_devstate(ASUS_WMI_D= EVID_FNLOCK, mode, NULL); } static int asus_wmi_add(struct platform_device *pdev) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ... =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (asus_wmi_has_fnlock_key(asus= )) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 asus->fnlock_locked =3D fnlock_default; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 asus_wmi_fnlock_update(asus); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ... } static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ... =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (code =3D=3D NOTIFY_FNLOCK_TO= GGLE) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 asus->fnlock_locked =3D !asus->fnlock_locked; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 asus_wmi_fnlock_update(asus); =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 return; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ... } Here's a link to the original patch: https://lore.kernel.org/lkml/20190418064648.25706-1-chiu@endlessm.com/ A later patch added the module_param fnlock_default: https://lore.kernel.org/lkml/20210323202505.141496-1-luca.stefani.ge1@gmail= .com/T/ I'll be addressing this issue as part of a larger update for recent (24H2 a= nd later) Asus laptop platforms. But I'd prefer the original authors and revie= wers, if they are available, review the situation before we decide what to do. "If it ain't broke, don't fix it".