From patchwork Mon Jul 1 19:20:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 808928 Received: from IND01-BMX-obe.outbound.protection.outlook.com (mail-bmxind01olkn2064.outbound.protection.outlook.com [40.92.103.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1558115DBD6; Mon, 1 Jul 2024 19:20:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.103.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719861612; cv=fail; b=ULFodwZZWPChFd46eMHWsiCKi2le0782R9z8MVZY9YmxgB6uPL02He/v3umtfv+QfikHNC3XN5m/vOI73ZjnFiQWJYIkzZ2nlGwpFP88jtX2BKOqJf3IaYF7BcGCyp1zBXQ3GHKZ8Qq6CcgVnAeL4pcl64Uek2ODRxKbvPOC8SA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719861612; c=relaxed/simple; bh=Gx1HdONiuQnoJAJUCq46hz1xzjowdZyqsNfl2wR8HCU=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=ZvN2vYhsOO/elYKuafxwsIrCRMnlaUR29AGQk5YXcGAgcpgJsqpDuf5cmFW3FlSu9enUbNjN7EPUUl5OjI5K5blpeo1qRNIIy+8ceS/B5Ll+TcfJhAij/H/cHUMOCsoDUc4nI1zvK/t1ut9ht7jWraRM2ih2ppujZP+hGC6QkSw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=live.com; spf=pass smtp.mailfrom=live.com; dkim=pass (2048-bit key) header.d=live.com header.i=@live.com header.b=Cybsfms9; arc=fail smtp.client-ip=40.92.103.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=live.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=live.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=live.com header.i=@live.com header.b="Cybsfms9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OwCR8BVvY09Wluh3BHoZYTfOa7ZmltwxPjbrbsmxgkpd/IhRi2I/NZGWnpVt0WokIy194TxUelX0C+zQt5WxCJRg3YW+VNAjBabVDrLx5XTsPkNC1FxCJKOFBWSSzP2dvK5YWy2M/hnkbEA0GZN0juR/VdqeWerkoVIQ7idJwgLgyTZKm+v3aLGWkWTSwNU4dryDoVq7ALo+tHc9zTdfswgPa5I5jwarMhuuRlJWsGdkbpNkm5IR8OD4vmPz+xKQhzQs1qIauzu0SNaRkqNnhr/l5UjJraWqntCXKYaCHY/td9Roln3aL6pm1Otz6+ep4T0c9gdcwoHTpwJEDuYFnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Gx1HdONiuQnoJAJUCq46hz1xzjowdZyqsNfl2wR8HCU=; b=U3mVi6xYb6OU8ItaU9Hdm1zlM/NOqAQctoaHXDdUCg1/w1xOdRC9lcSVoeOcIvWhlgKnQLZITXzViOkuVknflPnd19okrgl0w7SwZ8b7EBO5ros/QJikODAu9i2g/SYlyhsl9fx3bC0yR/s9DSvfue77+kwcag2ilIToFhYAto8nWoCxkPYyz8HgoqInXRktN6J4zXCAJQLScFVExwe1NzxxE5xvgJS5ll8/xAb70zQQI0NQmDkq0WFxIBMRIN/TZIbrGySILJZEOIic4R24Q6Bj8dhqHLc//YgVsnKU08Yp9WExWkxDVwGbkXhQbhHMoEzpdxMLC2jlNYuPMYI6Aw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Gx1HdONiuQnoJAJUCq46hz1xzjowdZyqsNfl2wR8HCU=; b=Cybsfms90Jv6mBE7kgWor3rAzfkhMaCbli3tgIl1RDMMs86FsMBiYJd6iqysVxoVOWgELbu6QjT0TrBgNV9Zo0N0DkHTsuUVC72Ik0sq4RMj/J/84Hxv2CbsdYUfCGkLZkP3DzZK3fpVgpu1toaATxly+0H6IC5/65tbVrSqYEld24Fij04/vuNj0HFGhfi/isNxTUWQRrzrfDSazSF9a92FzHiWl1Ap9cqXwUfk2ClqBWtEA0e3mbgXSjtQTt1IbHLjtDk2O2QLWu6c25KaxRL7AZamb6bvyt2AKTIh+KNLfR4DDDOr/LLpmMdcB/+aeptKvXRNjNNTpph/P0u1KA== Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:b3::9) by PN2P287MB0651.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:157::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.33; Mon, 1 Jul 2024 19:20:04 +0000 Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM ([fe80::98d2:3610:b33c:435a]) by MA0P287MB0217.INDP287.PROD.OUTLOOK.COM ([fe80::98d2:3610:b33c:435a%7]) with mapi id 15.20.7719.029; Mon, 1 Jul 2024 19:20:04 +0000 From: Aditya Garg To: Pavel Machek , "lee@kernel.org" , Jonathan Corbet , Jiri Kosina , "bentiss@kernel.org" CC: "linux-leds@vger.kernel.org" , "linux-doc@vger.kernel.org" , Linux Kernel Mailing List , "linux-input@vger.kernel.org" , Orlando Chamberlain , Kerem Karabay , Andy Shevchenko , =?iso-8859-1?q?Thomas_Wei=DFsc?= =?iso-8859-1?q?huh?= Subject: [PATCH 1/2] Documentation: leds: standardise keyboard backlight led names Thread-Topic: [PATCH 1/2] Documentation: leds: standardise keyboard backlight led names Thread-Index: AQHay+utkJBjyo+8CEiDLNPducTfHQ== Date: Mon, 1 Jul 2024 19:20:04 +0000 Message-ID: <6F9E1BB7-5F25-4BE0-AE82-903B9B81109B@live.com> References: <3055BCC5-8F8B-4472-9E94-1319D1C6DEED@live.com> In-Reply-To: <3055BCC5-8F8B-4472-9E94-1319D1C6DEED@live.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [ML52K3w48FwAiGUncbC2RXt/kiKTx43LkeRP6IE65RXqbZrvXjar1TI5eJXOuSswgLmVo/bXz3U=] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MA0P287MB0217:EE_|PN2P287MB0651:EE_ x-ms-office365-filtering-correlation-id: 733347e5-e730-4592-a0e2-08dc9a02cfda x-microsoft-antispam: BCL:0; ARA:14566002|8060799006|461199028|102099032|440099028|3412199025; x-microsoft-antispam-message-info: oEYSt2JbgjZLIJpklHYyfXcdkbbvZ5iLlvJDNogGFQsWFzpLCRjx5pMbcQ2KviivvvWfu56BQKn3I0nAxvsrcH5W+PF7fbvjvH+a1hJdbLVdFenlaQ2AjPTJsb5Oh5vG9y69dgAZMa1Cs+GTo8+tR3ruZqKRew4dFPX+PiUiCL09Jctazl4wcVmFNNRbBR3hlDiQS38OQehhSAKi+wPcQv7Fe5A49QIhP3xw12fNblGxfpeVgSMd/XFLxhF/Yx7nly6BswmM3570cv2RPZwJMJRgSQ5He7ixI3rBfZOHGBqznHuRtjv2IcVgHpDNPncrWzvfkLW7opW9HP6H1OmtwRDfmt55JpWLr82euhOnslcE400zFMZmEF2OvtOQ9Deiodvu6xYE4OmCiXSQYFkVPEKOknSSaaT5LhUpUFCZH284Z58IXtsFNMS4q3ZHRddzjqlAI+RX8erKkvNPCy1562gYNTTiZBncJL0Xp4YB3x09yB3sVMmlEB92v0R1gRB28g8uAXkBSuzG9cdx+2xTc73I4FN2HADk8lteKKm28PjYYKEvoJj9ako5KLOs5beSRB0/B8Sv3E0KZEChhk5dmTiri5GOnKKPhdMe43hVithZrl7WtdzhabrZNfd+nXyY x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?XAukk7xQjNn4ubCa37t8WnO?= =?iso-8859-1?q?HDrvNZLRHAn/ZKhDt7bvnf0j2GC90rl5Ix1FXbKvQr2tLyeQbE3g9kQCMczt?= =?iso-8859-1?q?a15LlMsS4sGPtAeIWsdeadAFufAvlg8QCcZzoDyLvFnw0gzEpZPQwMc+3jmL?= =?iso-8859-1?q?oiG08zoZ1aJQVrKF1igwslai5WkzX5Dal/+6CbgYGV0Pltjd96bJp/KTQaVH?= =?iso-8859-1?q?zvzXQ6o8DLvIlO6cLq4YJLg+pyDMEcYEzLpjTtLrkaESe9uduFY0NfQ2I1F9?= =?iso-8859-1?q?7BVULE2w7m51FXUoAtb05ldlt9dFvxGjP1Z0mXQYsHL/VGSxPFE1ABAfmr6Y?= =?iso-8859-1?q?uOkEdwuiRDt1/xH3o0gpFKZPbPeh9awVvCb71hhho6UwjV861yadWQFFxpQq?= =?iso-8859-1?q?TGyhYWtl3qBXPv+f/RB8m79cnft3EzmonOtKnGkj7lBAfCB+czS5s7ahdptp?= =?iso-8859-1?q?q0t90SZHqiYqjdNLP34NhUDSpoTvAMDPZDCeVsdl/t/tzFHE/lnPYLLPN/vV?= =?iso-8859-1?q?d7IMCRtfK2fxtFYjY9SQ/qPJ5dEloiyHfLTZD9Kvg7mTDMbLWEtaXejwPKTl?= =?iso-8859-1?q?Pjf4m+tn7w88/GsE2CRCy+XPYZ0uwzjJX/mOremR1tx7z7TxC2LEFGch7Hi0?= =?iso-8859-1?q?1ydqtUX59PCUe/q2obUgrQyRpIMOtuYPbRXjh/+dGoToXP80Gj4/ZjNJviBA?= =?iso-8859-1?q?WzllGZCZRhnJ4o9pMs43CCWuJGL4mJ7dcO+Eu043fqnJ1wc5cP9tqCXzwbYH?= =?iso-8859-1?q?Hy0HtOTy+UQn0lOXvPNTu+mfRCoBVu5tDnoWweIYxvdIF24dDBXQw50ATaWI?= =?iso-8859-1?q?w9ABum6EdwcvHd2UvAxVj376B9qwiVZvytxECD2iKmNRRvO3J5kMzgxdEplw?= =?iso-8859-1?q?qXRENMFEHHpL/W7Hj9d0ukiYc+S0o+RqlQXudr9c/E0J+e1rQ4i2Qmro49gw?= =?iso-8859-1?q?pMfEkd09iVTwYIjUMts4wkPOfKIsbtwpI7qNdXLzWiiguKM3u+j/PZAs/VNp?= =?iso-8859-1?q?wc7ts6GI81Qq9ic5ZkSXDXt+PxbLIqSetn8TJV8Eky5bQU+kTq0O2LcdDxvx?= =?iso-8859-1?q?zwwAFslY/HvwF1RkY+1oxdL0JFtu+se+ZnbWsjKJq/UZh21ni8bFlTNJv2X1?= =?iso-8859-1?q?ZM9U6woXCvGNDLj7HD8XVmLWgdXQ84Q8RAyhAze/SPRR0hCjOX4XORDXVZhs?= =?iso-8859-1?q?bm3jX2mCqpbkDm+7l48jaNkMXE5ERGzmm3MH1i3ozzH8MZ3cSEq2E/3B/nLF?= =?iso-8859-1?q?krXHqXBeQGytEi3Us3JmtUGBFmfIz1oveG/QXo5LzulsVrmGTmxZsGk1JgIo?= =?iso-8859-1?q?oSYUZT/kEbE3KQGkyTwRnH3PgtmTJBGsUfrt+s+LrMWF71hXUNMkLU35HlYs?= =?iso-8859-1?q?f?= Content-ID: <26C120190C045C429D8101BAA7E2B394@INDP287.PROD.OUTLOOK.COM> Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-bafef.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MA0P287MB0217.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 733347e5-e730-4592-a0e2-08dc9a02cfda X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jul 2024 19:20:04.7096 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN2P287MB0651 From: Orlando Chamberlain Advice use of either "input*:*:kbd_backlight" or ":*:kbd_backlight". We don't want people using vendor or product name (e.g. "smc", "apple", "asus") as this information is available from sysfs anyway, and it made the folder names inconsistent. Signed-off-by: Orlando Chamberlain Signed-off-by: Aditya Garg --- Documentation/leds/well-known-leds.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/leds/well-known-leds.txt b/Documentation/leds/well-known-leds.txt index 2160382c86be..4e5429fce4d8 100644 --- a/Documentation/leds/well-known-leds.txt +++ b/Documentation/leds/well-known-leds.txt @@ -44,6 +44,14 @@ Legacy: "lp5523:kb{1,2,3,4,5,6}" (Nokia N900) Frontlight/backlight of main keyboard. +Good: ":*:kbd_backlight" +Good: "input*:*:kbd_backlight" +Legacy: "*:*:kbd_backlight" + +Many drivers have the vendor or product name as the first field of the led name, +this makes names inconsistent and is redundant as that information is already in +sysfs. + Legacy: "button-backlight" (Motorola Droid 4) Some phones have touch buttons below screen; it is different from main From patchwork Mon Jul 1 19:21:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 810202 Received: from IND01-BMX-obe.outbound.protection.outlook.com (mail-bmxind01olkn2049.outbound.protection.outlook.com [40.92.103.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75A7B15DBD6; Mon, 1 Jul 2024 19:21:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.103.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719861677; cv=fail; b=lNmjtwo7sEYGEhjE691MZ782M7FOKT6gnlJkzVq5t7zAykXRBc4tmxY0iu8olTNciOqof7wqZfVGj2cIIoM6Ekw4iCF/RWX4EdW6LDxj+H+d6hsHpAHxkL76i7XJBRGBn2vADVym6QTw5hhWj9xAtN5vQXI7WlkpyaROkKo4DqE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719861677; c=relaxed/simple; bh=tNK5uNApPoaCMYsWvAqfJwqS0ClVlae2pBy1RxdRuOY=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=dJ55u/gjjeXAFmlE2xEaS5t8oXMEalB6fsGb59bIf51TynoQG9FPTJ02INWIdBHj0lKxhfnIPOLugSVx4hIf8C2KBaCgM4xWbQJzVsLzxdRjnYTDfC7yonH1xJmE1l/2FwEmhIz2esKlnq2KZ+rxicRluMkP6o0nShY4Cbwb4/U= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=live.com; spf=pass smtp.mailfrom=live.com; dkim=pass (2048-bit key) header.d=live.com header.i=@live.com header.b=s+7Edcu4; arc=fail smtp.client-ip=40.92.103.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=live.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=live.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=live.com header.i=@live.com header.b="s+7Edcu4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YJqP5TX4cq0M7Ej/KtTZnTCvAtC9ElNbRAvYfMsFYr1PRm+tqn0rZ4hHe4GLLlQt0PlSf1LxR4K1cpuKutsMpSLhzXbhBcSMD6VaNCIUwIiPmdqw3g2hLXu7kBl9V3ozJnCM5jRlC//fWc6MmzCapCz92XVfG++/MNdGwMDPP4Un+064A31Pe7NCbjQYRovBHqWrG24Yq9Qcv6cEkZQbZY0GUEiWAYnAJ9IuDkWWPx1hSae2yZMWpfUZRF66J1JQ1GE2VJ87xCx1eeI/O2EtZi9vMQix4ggsv15MxkA7gfL5gcCH78pRQeWnC55cQGdfbMP/M42ojAjA6BUcs8Yo6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tNK5uNApPoaCMYsWvAqfJwqS0ClVlae2pBy1RxdRuOY=; b=KKbhc4KrLdn76KTzBgs1Bf50DmuHTK0iXKbOeQr/Z7m1vSofiuKCE1U+qJr2YbjKibA9W9KXD4RsViqBSddejXxrfdz8fHYcpycI06xHB9gCb2KVjgQdfcu4b7nGrHck5n/Gb8YhybVsqLErzrRHNwxfrdd6bMxkvUjahXLbQCwDGxekJ5ZEAcGc1Q2g2obIn+ClZrzNlwFDQJrgkMAUbLlQw4nobIFbS76FfnGr+8hEu8Y/DFPziH6kOXyVLqvokZ+z+0eDK4O19HTA9EU6o6amNqhLV/PZR0FR1JCIitg79O+apXDEMDwucT1IZGklSlwgpQ0wBDaEXR26wBKN0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tNK5uNApPoaCMYsWvAqfJwqS0ClVlae2pBy1RxdRuOY=; b=s+7Edcu4CzmZTG6PFSGFZ7l/foePzJII9hml2yJ2mw43Jt7qrh8xyxOJ3md76/9PiEfuw7O+wHTSZPyPgMEu3kEHK2gPBhhzp4Cx0D4r3IaF+WoCSPeR96v0K/XiAROzHzn6XdJ5O286OX2rO1QrufgdKmh6U0f79NWu3nPAiWkDDQnvBTCYMfuMfr+kivystoxUQ33wZofr3icZWsSGTx1XqW+AnXcShE6J5xNTLyTOKSTyQz4ZwgX61G+fdqJw7kBz5qn2sKSU73SN/+o4fsdeETtyDSGIAwrlZtMH8XQQ7Gm3/iGjxGWsWJDq3K4bJkRqRG65EhtCYD/YYvqTqA== Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:b3::9) by PN2P287MB0651.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:157::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.33; Mon, 1 Jul 2024 19:21:08 +0000 Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM ([fe80::98d2:3610:b33c:435a]) by MA0P287MB0217.INDP287.PROD.OUTLOOK.COM ([fe80::98d2:3610:b33c:435a%7]) with mapi id 15.20.7719.029; Mon, 1 Jul 2024 19:21:08 +0000 From: Aditya Garg To: Pavel Machek , "lee@kernel.org" , Jonathan Corbet , Jiri Kosina , "bentiss@kernel.org" CC: "linux-leds@vger.kernel.org" , "linux-doc@vger.kernel.org" , Linux Kernel Mailing List , "linux-input@vger.kernel.org" , Orlando Chamberlain , Kerem Karabay , Andy Shevchenko , =?utf-8?q?Thomas_Wei=C3=9Fschu?= =?utf-8?q?h?= Subject: [PATCH 2/2] HID: hid-apple-magic-backlight: Add driver for keyboard backlight on internal Magic Keyboards Thread-Topic: [PATCH 2/2] HID: hid-apple-magic-backlight: Add driver for keyboard backlight on internal Magic Keyboards Thread-Index: AQHay+vToRglfdtmWEK87X0z27KIJA== Date: Mon, 1 Jul 2024 19:21:08 +0000 Message-ID: References: <3055BCC5-8F8B-4472-9E94-1319D1C6DEED@live.com> <6F9E1BB7-5F25-4BE0-AE82-903B9B81109B@live.com> In-Reply-To: <6F9E1BB7-5F25-4BE0-AE82-903B9B81109B@live.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [SMuELsR2mrKgx56pLNi64LziRtxKumx9smo2hR5DOpm3GelMROCGEzlNMbWD2u+P59JDWE1wXMQ=] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MA0P287MB0217:EE_|PN2P287MB0651:EE_ x-ms-office365-filtering-correlation-id: 7f917ffb-4dcf-420a-7a11-08dc9a02f5f4 x-microsoft-antispam: BCL:0; ARA:14566002|8060799006|461199028|102099032|440099028|3412199025; x-microsoft-antispam-message-info: Nk8PcY1LtaXwf4gj2SzbgWQqG2e8fr/qDelnCaxT/EqLpA1hN7bNacN8AEOVFobhY7WjSMjUY4NWHQ74bHZBRrWfNN6y9UU1WZ+HNZQMqBSkCVvZxkRsYrXH+G7P88NqlFfP+NWJNFgsSq5ZztqRMIYeZSwXROpOLDzo9LIt/2P+HPnPVEguXHoQ6WfvQiaOZyHNK+lNiqy67Pw5NLvyJx89RtwC8jxpet11hGDRtjJOyg3/Aqy5guqPwfwTvBbqEqREFEYrNc+RsdUcHgT8q2odNN6847GJ5PoBB6GvXIpkf4lnafjOkkWCmwQA8VSGhM252zBhxXs9UF6vs15AlFAGTP3XHQsRkTkHPUAvpUic0Wx/Cq1BaK4nQHr5iVISgFRX/NMU6C1P8OfMTKrz5UKdnYCPbOjF9IFTrlxsqICsk+dtxYl6SSK4vEX6auMlZJ2OeOv46XEeCfxGN343gKugu6wtBRKZgFDGm6Zo/Kk/5YboqAM79QZXHuJf0cWQv1eEAPulcXb+jkYkDiPvPbnho2ufgq0cLg1fEc1OKzIa8CXw3DQupRRUS1TBG1qYPg7Z6lkTh0ThIQ75/Hv+lQbVGQanE1SxH+YnOJzfA8fO2I0Zc5lDgmDdhK4Gus1Z x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?uK4Ikptg+JrED6oZTMpMS1exMhla?= =?utf-8?q?j7j/c3fSUg1bQIpgcaKlGXKSwgbq1gKbW7GN5cpd8/zkksZuddCYuaUTfhEmAtJp0?= =?utf-8?q?R/PYkoKTETbUOlHTh6zttt2XXKX7t3zUswgXmul2aJjp6sH1Srv0nT/e55hZtvAdd?= =?utf-8?q?937u8YK41femK20oyl+n+ldmgXcyYpdAga2mSYCYUQmQuJptwli9XvaEzHS1FPSWG?= =?utf-8?q?H7i0L3wzZtoI/yCFyJzUuNADbOkE6gXSiVW52PrFffQyHlY4rFwSgMgfRsKNEY0Wz?= =?utf-8?q?Wz6PD3Kzk8xZJaSxspnQKjqaNphNqiHP9ou4Lmci1Tro4qcZ01wUT/UNOe5GL4WYo?= =?utf-8?q?y/qeVNDOK2dRphfCYMaH4TyTSuHQ0Noj1RYUu8mqIPVNRouWUF0PckE8EjmdBX/EZ?= =?utf-8?q?n5qTywg/IfyiCHWMj2qOZdJ2Bq47Ttao2qwZYzPYdFtUuUjo801mh8bFQ00S9cA04?= =?utf-8?q?oiufkWHr02TbdECBRf7PM+WYhbZGreNmPJzp09C4SQjbdr8G9fYh6WLlXBC1ggszV?= =?utf-8?q?VsrB1QBUKXD/qVXV/vccPvARcpbMy4MrhfOjP6zIbjBYAKUNRWJJ7EMQYfp73Ym0+?= =?utf-8?q?gmHMy67gnU5vdYyj39LZFg+4qla7CV//bmUoGg5+BE2z3deHLsg9kOWpGM37Kano+?= =?utf-8?q?+e5VH9JOMZ2YnnauqTyOWY2gGzcpTM1vFy/PnzDhMWbyR/wJ+7kUlLLE2cN8L+4j6?= =?utf-8?q?1MsnSW6vArUqZSq7C7/K2ju3Sf2xIfbk+CKmDzlpaLR2nYkqs3azXTQls1vOqQ1J6?= =?utf-8?q?xnovkGQ2pH1h3z8cPbPHN3++voHnATZbCZnVaxLUuAZDStT88eF4Fkuz68FzU/Pko?= =?utf-8?q?7CY+Wqf4eApLrVSQSxb5wgCFrq5k6xk0iSzgQPgMHJtHiGsPWEJZwIJ6l+JDBZtJs?= =?utf-8?q?8IXQpQuKZ8OYx+oRmq8ntXRrX0FaFRQvMrWq9/77WK8aSGhI6YO6ikS9Ped4aMd/f?= =?utf-8?q?Yfg4KfL9i52eu38JFw5Tdu2ZGyzwsu0emaQAZA3jUr/pITtzdjeOzyCtDE3v5ntjx?= =?utf-8?q?fft97wnT4yWE7A49ILMvjfL31EsTyq6leV0h9CmqO9tChKOEcNwbraXJBEHRopG2r?= =?utf-8?q?lcE2Qk4NwlIoKar5zDMEywxZv6Syvao/ONmTInugfG+NO+3pePbmNhbqs+NTTOWDe?= =?utf-8?q?zNsiN7zdyx/0Pb9iuCyyi0H4DJ5/loXe4ZFxmFbRTz0+8fAJFFyF6AhDJmuoDlYPW?= =?utf-8?q?qaFYfHnz1PdDB4sr0a3M+pXtr74Jh16OAJMFCRBqGMOw06kttu6pLo+DA3C4QxcZ+?= =?utf-8?q?gaqkrXU/wSOB6Svb?= Content-ID: <976A82FAFA8484478BB049748E2A66E7@INDP287.PROD.OUTLOOK.COM> Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-bafef.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MA0P287MB0217.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 7f917ffb-4dcf-420a-7a11-08dc9a02f5f4 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jul 2024 19:21:08.6397 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN2P287MB0651 From: Orlando Chamberlain This driver adds support for the keyboard backlight on Intel T2 Macs with internal Magic Keyboards (MacBookPro16,x and MacBookAir9,1) Co-developed-by: Kerem Karabay Signed-off-by: Kerem Karabay Signed-off-by: Orlando Chamberlain Signed-off-by: Aditya Garg Reviewed-by: Andy Shevchenko Reviewed-by: Thomas Weißschuh --- MAINTAINERS | 6 ++ drivers/hid/Kconfig | 13 +++ drivers/hid/Makefile | 1 + drivers/hid/hid-apple-magic-backlight.c | 120 ++++++++++++++++++++++++ 4 files changed, 140 insertions(+) create mode 100644 drivers/hid/hid-apple-magic-backlight.c diff --git a/MAINTAINERS b/MAINTAINERS index dfc63d257..9148bda0a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9169,6 +9169,12 @@ F: include/linux/pm.h F: include/linux/suspend.h F: kernel/power/ +HID APPLE MAGIC BACKLIGHT DRIVER +M: Orlando Chamberlain +L: linux-input@vger.kernel.org +S: Maintained +F: drivers/hid/hid-apple-magic-backlight.c + HID CORE LAYER M: Jiri Kosina M: Benjamin Tissoires diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 4e238df87..83fbab6d4 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -169,6 +169,19 @@ config HID_APPLE Say Y here if you want support for keyboards of Apple iBooks, PowerBooks, MacBooks, MacBook Pros and Apple Aluminum. +config HID_APPLE_MAGIC_BACKLIGHT + tristate "Apple Magic Keyboard Backlight" + depends on USB_HID + depends on LEDS_CLASS + depends on NEW_LEDS + help + Say Y here if you want support for the keyboard backlight on Macs with + the magic keyboard (MacBookPro16,x and MacBookAir9,1). Note that this + driver is not for external magic keyboards. + + To compile this driver as a module, choose M here: the + module will be called hid-apple-magic-backlight. + config HID_APPLEIR tristate "Apple infrared receiver" depends on (USB_HID) diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 5b60015fd..581f5e720 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -31,6 +31,7 @@ obj-$(CONFIG_HID_ACCUTOUCH) += hid-accutouch.o obj-$(CONFIG_HID_ALPS) += hid-alps.o obj-$(CONFIG_HID_ACRUX) += hid-axff.o obj-$(CONFIG_HID_APPLE) += hid-apple.o +obj-$(CONFIG_HID_APPLE_MAGIC_BACKLIGHT) += hid-apple-magic-backlight.o obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o obj-$(CONFIG_HID_CREATIVE_SB0540) += hid-creative-sb0540.o obj-$(CONFIG_HID_ASUS) += hid-asus.o diff --git a/drivers/hid/hid-apple-magic-backlight.c b/drivers/hid/hid-apple-magic-backlight.c new file mode 100644 index 000000000..f0fc02ff3 --- /dev/null +++ b/drivers/hid/hid-apple-magic-backlight.c @@ -0,0 +1,120 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Apple Magic Keyboard Backlight Driver + * + * For Intel Macs with internal Magic Keyboard (MacBookPro16,1-4 and MacBookAir9,1) + * + * Copyright (c) 2022 Kerem Karabay + * Copyright (c) 2023 Orlando Chamberlain + */ + +#include +#include +#include +#include +#include + +#include "hid-ids.h" + +#define HID_USAGE_MAGIC_BL 0xff00000f + +#define APPLE_MAGIC_REPORT_ID_POWER 3 +#define APPLE_MAGIC_REPORT_ID_BRIGHTNESS 1 + +struct apple_magic_backlight { + struct led_classdev cdev; + struct hid_report *brightness; + struct hid_report *power; +}; + +static void apple_magic_backlight_report_set(struct hid_report *rep, s32 value, u8 rate) +{ + rep->field[0]->value[0] = value; + rep->field[1]->value[0] = 0x5e; /* Mimic Windows */ + rep->field[1]->value[0] |= rate << 8; + + hid_hw_request(rep->device, rep, HID_REQ_SET_REPORT); +} + +static void apple_magic_backlight_set(struct apple_magic_backlight *backlight, + int brightness, char rate) +{ + apple_magic_backlight_report_set(backlight->power, brightness ? 1 : 0, rate); + if (brightness) + apple_magic_backlight_report_set(backlight->brightness, brightness, rate); +} + +static int apple_magic_backlight_led_set(struct led_classdev *led_cdev, + enum led_brightness brightness) +{ + struct apple_magic_backlight *backlight = container_of(led_cdev, + struct apple_magic_backlight, cdev); + + apple_magic_backlight_set(backlight, brightness, 1); + return 0; +} + +static int apple_magic_backlight_probe(struct hid_device *hdev, + const struct hid_device_id *id) +{ + struct apple_magic_backlight *backlight; + int rc; + + rc = hid_parse(hdev); + if (rc) + return rc; + + /* + * Ensure this usb endpoint is for the keyboard backlight, not touchbar + * backlight. + */ + if (hdev->collection[0].usage != HID_USAGE_MAGIC_BL) + return -ENODEV; + + backlight = devm_kzalloc(&hdev->dev, sizeof(*backlight), GFP_KERNEL); + if (!backlight) + return -ENOMEM; + + rc = hid_hw_start(hdev, HID_CONNECT_DEFAULT); + if (rc) + return rc; + + backlight->brightness = hid_register_report(hdev, HID_FEATURE_REPORT, + APPLE_MAGIC_REPORT_ID_BRIGHTNESS, 0); + backlight->power = hid_register_report(hdev, HID_FEATURE_REPORT, + APPLE_MAGIC_REPORT_ID_POWER, 0); + + if (!backlight->brightness || !backlight->power) { + rc = -ENODEV; + goto hw_stop; + } + + backlight->cdev.name = ":white:" LED_FUNCTION_KBD_BACKLIGHT; + backlight->cdev.max_brightness = backlight->brightness->field[0]->logical_maximum; + backlight->cdev.brightness_set_blocking = apple_magic_backlight_led_set; + + apple_magic_backlight_set(backlight, 0, 0); + + return devm_led_classdev_register(&hdev->dev, &backlight->cdev); + +hw_stop: + hid_hw_stop(hdev); + return rc; +} + +static const struct hid_device_id apple_magic_backlight_hid_ids[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT) }, + { } +}; +MODULE_DEVICE_TABLE(hid, apple_magic_backlight_hid_ids); + +static struct hid_driver apple_magic_backlight_hid_driver = { + .name = "hid-apple-magic-backlight", + .id_table = apple_magic_backlight_hid_ids, + .probe = apple_magic_backlight_probe, +}; +module_hid_driver(apple_magic_backlight_hid_driver); + +MODULE_DESCRIPTION("MacBook Magic Keyboard Backlight"); +MODULE_AUTHOR("Orlando Chamberlain "); +MODULE_LICENSE("GPL");