Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6709880rwb; Tue, 9 Aug 2022 22:52:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR4LG6RtXjm+/q5QfCnqRAb/QA+2bLtv1IbLyqUwZNbtqzYT26zd4p8xssZFu4UKdxjI4xSw X-Received: by 2002:a50:fc85:0:b0:43d:2284:1ea5 with SMTP id f5-20020a50fc85000000b0043d22841ea5mr25261511edq.105.1660110757376; Tue, 09 Aug 2022 22:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660110757; cv=none; d=google.com; s=arc-20160816; b=jS1DojLdOfL5ze9r71a6tDuCT/1TtkhSfHwbQ9f++qcJY9kwHHe7rp2DTqXSetFHtl Tg9FvWq21KDAUDb5k7ipyuhv27Ix03oZjE+B+izBScJ91V9EzRna/oT0x/m438tUjVvz SXR/CjvGBF8DloRNFPbdO2PgxrTDxcvp2YOFklZZmPlp7DjiJq5qXDfYcOKQM2w8b8Hj JTeX2Dei56pj3uxGB5jsl4q37C1X/hzMU5KOrczLk1fkyTU8GTve4IbyDtGF6W/S91h3 92vHDA9ceEzmYtzSThEZ+KzU7v+rAXYQm5XBsFI0l9qOvNiU7yNE/Vi+9Uv1VI1W3VZ9 SWbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:feedback-id:dkim-signature:dkim-signature; bh=BIhDR8QyFaEyZZyv2NBJxwbm+qAB3aLtVX5s9TTqwoA=; b=ym11QxGGghcUnkF4n0KEtlrXKb2Gy0VOBo9Xo9fDrDDvV+woj8QFQEaWv+twxCTSgV V1TYY6rhriz6M6jSEhGDRObPR+sE8IqQ6xShuCkwbFz8qLpEkTAUQWcFjSEQmDFKzEy4 8QMBwHxt5qk6GAOFMtaYAY4t+JFC9+k8EDyEMOhDldHJpNxZk7j+e0s7EKddXnL2Xhvo uLi8ruxXqdk/CtZvpKJgOq+LoyFv0NsiJietbveuxB6wH3VJ1JMbSOxjy9Wl8b/s+djS RvC6tUsnyAOQxli16PIRX21YVDfg4NKmaf4ilBcAUBEpsJ9Tlp34WHWYxLUqxOTKV0Kt OvtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm2 header.b="c+Wj0w/p"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=osy2ksPt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v21-20020aa7cd55000000b0043ba23f56a6si9295609edw.200.2022.08.09.22.52.11; Tue, 09 Aug 2022 22:52:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm2 header.b="c+Wj0w/p"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=osy2ksPt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230377AbiHJEoh (ORCPT + 99 others); Wed, 10 Aug 2022 00:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229513AbiHJEof (ORCPT ); Wed, 10 Aug 2022 00:44:35 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08F7382FA8; Tue, 9 Aug 2022 21:44:33 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 23D69320090A; Wed, 10 Aug 2022 00:44:31 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 10 Aug 2022 00:44:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ljones.dev; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1660106670; x= 1660193070; bh=BIhDR8QyFaEyZZyv2NBJxwbm+qAB3aLtVX5s9TTqwoA=; b=c +Wj0w/pXdOLqD9+xv4x9My7M7ELw1rwDcYlA3uuzRGE8LTRYSix+MnKGOP9P6nM/ YTyCgzuKbFvCd7AJ1Or52tddbrkti+ICgsR0yUNlK6JgE4c+uoSRFmEZqHyk5jE7 rKTFxWsMLL7eNgT+Ny7GlojVmHpLqKmuKSlO/ICJ3MFNs32PzM/TVwBRyTABrO/Z vLH/2gGsjSU72hUALAFuNlAEfXCaQ0WREibrMBGyKiVCwT3VHMvW+AawZ9ovfD+C +IF8GEX0dYgMBqmbIWIWIK2R2cI7kEEakrxs+xZzgTcbr5osWn+jfxWOi/SRkVuu bdKpKys1wKZV1PFXL+Fgg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1660106670; x= 1660193070; bh=BIhDR8QyFaEyZZyv2NBJxwbm+qAB3aLtVX5s9TTqwoA=; b=o sy2ksPtbF5E+r4gGopt81yCuclThFHt6gnoXKjTxMdoCyogCrJYVkkN5z21FV54I 7FaX01G6fkxDVmXz+hVWcM6xEzB3lbJY/o+OCRIzWEphT3ZWGvIPnpOqg8bZ2GUc g56xwdv58P2+XMef7/RZuh7eCwAbkOmUOmrcPTHEOKPk6mCv/Xgza2lfFvQujXvf W1lD2X/phBuQNxxBCYcuMWJBFj/cUvtczfY1jaw7Ug+Zy5dHIQuSYwphGNmDjIZw s/Itl+jGo4HGIl0B1/WlqcSE0bBo8TrS99Rt/bDUcrAJsELhqxeNVyN3SNSDE+/M jQheviTWtmyntoOZ3MrRw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdeguddgkeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkffuhffvveffjghftgfgfgggsehtqhertddtreejnecuhfhrohhmpefnuhhk vgculfhonhgvshcuoehluhhkvgeslhhjohhnvghsrdguvghvqeenucggtffrrghtthgvrh hnpeekfeffueejveeujeeugeelleehtdegvdeludektddtfffhieefledvudehfeejieen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehluhhkvg eslhhjohhnvghsrdguvghv X-ME-Proxy: Feedback-ID: i5ec1447f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Aug 2022 00:44:27 -0400 (EDT) Message-ID: Subject: Re: [PATCH v3 1/6] asus-wmi: Implement TUF laptop keyboard RGB control From: Luke Jones To: Pavel Machek Cc: hdegoede@redhat.com, andy.shevchenko@gmail.com, pobrn@protonmail.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 10 Aug 2022 16:44:20 +1200 In-Reply-To: <20220809105031.GA4971@duo.ucw.cz> References: <20220809025054.1626339-1-luke@ljones.dev> <20220809025054.1626339-2-luke@ljones.dev> <20220809105031.GA4971@duo.ucw.cz> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (by Flathub.org) MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pavel, Andy, Hans, > > > > > > > > +=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 * asus::kbd_backlight still controls a > > > > > > > > base > > > > > > 3-level backlight and when > > > > > > > > +=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 * it is on 0, the RGB is not visible > > > > > > > > at all. > > > > RGB > > should be treated as > > > > > > > > +=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 * an additional step. > > > > > > > > +=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 */ > > > >=20 > > > > Ouch. Lets not do that? If rgb interface is available, hide the > > > > 3 > > > > level one, or something. > > > >=20 I really don't think this is safe or sensible. There are some laptops that default the 3-stage method to off, and this means that the LEDs will not show regardless of multicolor brightness. > > > > > > > > +=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=A0mc_cdev->led_cdev.name =3D=C2=A0=C2=A0 > >= > > > > > > > > > > > > "asus::multicolour::kbd_backlight"; > > > >=20 > > > > Make this "rgb:kbd_backlight" or "inputX:rgb:kbd_backligh" and > > > > document it in Documentation/leds/well-known-leds.txt. Will do. -- 4 hours later -- I've spent a lot of time working on this now. I don't think multicolor LED is suitable for use with the way these keyboards work. The biggest issue is related to the brightness setting. 1. If the ASUS_WMI_DEVID_KBD_BACKLIGHT method defaults to 0 on boot then RGB is not visible I worked around this by setting it to "3" by default in module if ASUS_WMI_DEVID_TUF_RGB_MODE is found. And added a check in the button events to adjust multicolor brightness (+/- 17). This works but now I can't do led notify (led_classdev_notify_brightness_hw_changed). 2. Pattern trigger can't be used for these keyboard modes as the modes are done entirely in hardware via a single switch in the complete command packet. I don't see any way forward with this, and looking at the complexity I don't have time either. 3. Nodes everywhere.. To fully control control these keyboards there are two WMI methods, one for mode/rgb, one for power-state. Splitting each of these parameters out to individual nodes with sensible naming and expectations gives: - keyboard_rgb_apply, new WO node to actually write out data - keyboard_rgb_save, first parameter of packet, retain-on-boot - keyboard_rgb_mode, the factory built-in modes, - keyboard_rgb_speed, speed of certain modes And then for power-state: - keyboard_state_apply, new WO node to actually write out data - keyboard_state_save, first parameter of packet, retain-on-boot - keyboard_state_boot, play boot animation (on boot) - keyboard_state_awake, LEDs visible while awake - keyboard_state_sleep, play suspend animation (while suspended) - keyboard_state_keyboard, unknown effect Quite frankly I would rather use the method I had in the first patch I submitted where mode and state had two nodes each, - keyboard_rgb_mode, WO =3D "n n n n n n" - keyboard_rgb_mode_index, output =3D "save/apply, mode, r, g, b, speed" - keyboard_rgb_state, WO =3D "n n n n n" - keyboard_rgb_state_index, output =3D "save/apply, boot, awake, sleep, keyboard" A big benefit of this structure is that not being able to read settings back from the keyboard (not possible!) becomes a non-issue because users have to write a full input, not partial, and it will apply right away. Multicolor class could still be used, but from everything I've tried now it really isn't suitable when the proper method for brightness is a separate WMI method (0-3), and when that is 0 it means LEDs are fully off - there's potential for mistakes/issues. Losing led-notif is an issue for users for sure. In short, from dog-fooding the current state inlcuding the trial of using multicolor brightness (and hiding the proper WMI method) I can only conclude that multicolor is not suitable for how these keyboards work. Hans, Andy, can I please revert back to the node + _index pairs taking an array input. Everything will be cleaner and simpler. Cheers, Luke.