Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp379926rdf; Tue, 21 Nov 2023 05:29:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IEffa39kx6PbutWNakiRt4SF3LbBxQFAYEX1BTGgNO8GIBkVJ+uRhg6FjAB/5MNCFi0QU/M X-Received: by 2002:a05:6a20:918e:b0:187:e3a5:b35d with SMTP id v14-20020a056a20918e00b00187e3a5b35dmr3433498pzd.13.1700573384745; Tue, 21 Nov 2023 05:29:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700573384; cv=none; d=google.com; s=arc-20160816; b=QjRJo9/kNC/UNbgQf8PS/DndZOJOmRuL7zzx83w+2l9jKFnXDao8Gg4A4GMhArBO7Z Pbepu8/YyGI/JoKrezLr5HQoD+W5pa1oiPZARQimqXjHhmNlzQyEJNgOmM95DaHyHwqc frCrR3iFR4LO3ameJNZYQX2Ez4jMnMZji208dmNK6UA+wNcuaBy6cRoAnozpkFAubDiw PUs/5rbO8MU1ZwNo2vJq/494O3UDHXxWmyHhTC++Ps2iU793IHu21imd+6nXtwo4vxCx 3p1c1jQyfy10CSKBY8wtzLiAC+Q6jnQnZiqN9JV4XQqGq4YwfWfvMii137uRziHJQdPy 1sBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=oJvMBifarv+hJKntJue/VPuBCrrPqYvgBBAEq0tUgBQ=; fh=U838RbPqRghFoswRBymFAo1BoNme3gQijSO33dHpp9Y=; b=ufetDoTTlCkWfuQRaitwSr4IRGQrtDd4y8WBUiFDaJ2hB7sYOMzvFsvpSWhT92Ei1W DPmOilAPWSAWLPyE5mftELwr1MAqFWkOIwJ4gLKgKwnLAmuHwHsn0roxjZ7CGX8IuW8j qSdo2SnVBExde+K2o+O76JVySWb2J2VTpCtJt+j4bLPXQKOR5l8VTRVK0swJVlK1HLUp 1GsmhJiDuK0nm8Xboj0YXtQ2jM+Ypiq1y45XaEO29dKWUQs4oK0OcH37mNY/3ahmYq2l JhS0yh4rIn66HpcmxZJpmsG6S4mCfOhCaKBr0zKAEc1v7LZ1gs7Xald1/HhgRxRKqCbq b9Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxedocomputers.com header.s=default header.b=Yt0RXSrB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tuxedocomputers.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id r74-20020a632b4d000000b0056433b221b9si10754314pgr.477.2023.11.21.05.29.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 05:29:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxedocomputers.com header.s=default header.b=Yt0RXSrB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tuxedocomputers.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9879F8116E6F; Tue, 21 Nov 2023 05:29:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233863AbjKUN3m (ORCPT + 99 others); Tue, 21 Nov 2023 08:29:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232235AbjKUN3l (ORCPT ); Tue, 21 Nov 2023 08:29:41 -0500 Received: from mail.tuxedocomputers.com (mail.tuxedocomputers.com [157.90.84.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA204D4C; Tue, 21 Nov 2023 05:29:35 -0800 (PST) Received: from [192.168.42.20] (p5b164862.dip0.t-ipconnect.de [91.22.72.98]) (Authenticated sender: wse@tuxedocomputers.com) by mail.tuxedocomputers.com (Postfix) with ESMTPSA id B65852FC01F9; Tue, 21 Nov 2023 14:29:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxedocomputers.com; s=default; t=1700573374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oJvMBifarv+hJKntJue/VPuBCrrPqYvgBBAEq0tUgBQ=; b=Yt0RXSrB8OTBqGx5lC1udvYoRk+uLncyJ6HykBuza5D5QHxSph0sgH15Zb4V4Uq6Yl7GiT 17ChoLECQ+17MS3IN080yzOB8bageGcjIq5h8MWDWwWqA1L50jEY/SZPn/qkuzCEPKGcbQ YGEgcmRpYLyQLZ1VbogozQIxsgZ3gOg= Authentication-Results: mail.tuxedocomputers.com; auth=pass smtp.auth=wse@tuxedocomputers.com smtp.mailfrom=wse@tuxedocomputers.com Message-ID: Date: Tue, 21 Nov 2023 14:29:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Implement per-key keyboard backlight as auxdisplay? Content-Language: en-US To: Hans de Goede , Pavel Machek , Jani Nikula , jikos@kernel.org Cc: Miguel Ojeda , Lee Jones , linux-kernel@vger.kernel.org, "dri-devel@lists.freedesktop.org" , linux-input@vger.kernel.org, ojeda@kernel.org, linux-leds@vger.kernel.org References: <20231011190017.1230898-1-wse@tuxedocomputers.com> <0440ed38-c53b-4aa1-8899-969e5193cfef@tuxedocomputers.com> <87sf61bm8t.fsf@intel.com> <8096a042-83bd-4b9f-b633-79e86995c9b8@redhat.com> From: Werner Sembach In-Reply-To: <8096a042-83bd-4b9f-b633-79e86995c9b8@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 05:29:43 -0800 (PST) Am 21.11.23 um 13:20 schrieb Hans de Goede: > Hi Werner, > > On 11/21/23 12:33, Werner Sembach wrote: >> Hi, >> >> Am 20.11.23 um 21:52 schrieb Pavel Machek: >>> Hi! >>> >>>>>> So... a bit of rationale. The keyboard does not really fit into the >>>>>> LED subsystem; LEDs are expected to be independent ("hdd led") and not >>>>>> a matrix of them. >>>>> Makes sense. >>>>> >>>>>> We do see various strange displays these days -- they commonly have >>>>>> rounded corners and holes in them. I'm not sure how that's currently >>>>>> supported, but I believe it is reasonable to view keyboard as a >>>>>> display with slightly weird placing of pixels. >>>>>> >>>>>> Plus, I'd really like to play tetris on one of those :-). >>>>>> >>>>>> So, would presenting them as auxdisplay be acceptable? Or are there >>>>>> better options? >>>>> It sounds like a fair use case -- auxdisplay are typically simple >>>>> character-based or small graphical displays, e.g. 128x64, that may not >>>>> be a "main" / usual screen as typically understood, but the concept is >>>>> a bit fuzzy and we are a bit of a catch-all. >>>>> >>>>> And "keyboard backlight display with a pixel/color per-key" does not >>>>> sound like a "main" screen, and having some cute effects displayed >>>>> there are the kind of thing that one could do in the usual small >>>>> graphical ones too. :) >>>>> >>>>> But if somebody prefers to create new categories (or subcategories >>>>> within auxdisplay) to hold these, that could be nice too (in the >>>>> latter case, I would perhaps suggest reorganizing all of the existing >>>>> ones while at it). >>>> One could also reasonably make the argument that controlling the >>>> individual keyboard key backlights should be part of the input >>>> subsystem. It's not a display per se. (Unless you actually have small >>>> displays on the keycaps, and I think that's a thing too.) >>> While it would not be completely crazy to do that... I believe the >>> backlight is more of a display and less of a keyboard. Plus input >>> subystem is very far away from supporting this, and we had no input >>> from input people here. >>> >>> I don't think LED subsystem is right place for this, and I believe >>> auxdisplay makes slightly more sense than input. >>> >>> Unless someone steps up, I'd suggest Werner tries to implement this as >>> an auxdisplay. [And yes, this will not be simple task. RGB on LED is >>> different from RGB on display. But there are other LED displays, so >>> auxdisplay should handle this. Plus pixels are really funnily >>> shaped. But displays with missing pixels -- aka holes for camera -- >>> are common in phones, and I believe we'll get variable pixel densities >>> -- less dense over camera -- too. So displays will have to deal with >>> these in the end.] >> Another idea I want to throw in the mix: >> >> Maybe the kernel is not the right place to implement this at all. RGB stuff is not at all standardized and every vendor is doing completely different interfaces, which does not fit the kernel userpsace apis desire to be uniformal and fixed. e.g. Auxdisplay might fit static setting of RGB values, but it does not fit the snake-effect mode, or the raindrops mode, or the 4-different-colors-in-the-edges-breathing-and-color-cycling mode. >> >> So my current idea: Implement these keyboards as a single zone RGB kbd_backlight in the leds interface to have something functional out of the box, but make it runtime disable-able if something like https://gitlab.com/CalcProgrammer1/OpenRGB wants to take over more fine granular control from userspace via hidraw. > That sounds like a good approach to me. We are seeing the same with game controllers where steam and wine/proton also sometimes use hidraw mode to get access to all the crazy^W interesting features. > > That would mean that all we need to standardize and the kernel <-> userspace API level is adding a standard way to disable the single zone RGB kbd_backlight support in the kernel. I would suggest a simple "enable" entry. Default is 1. When set to 0 the kernel driver no longer does anything. Questions: - Should the driver try to reset the settings to boot default? Or just leave the device in the current state? With the former I could see issues that they keyboard is flashing when changing from kernelspace control to userspace control. With the later the burden on bringing the device to a know state lies with the userspace driver. - Should this be a optional entry that only shows up on drivers supporting it, or could this implemented in a generic way affecting all current led entries? - I guess UPower integration for the userspace driver could be archived with https://www.kernel.org/doc/html/latest/leds/uleds.html however this limited to brightness atm, so when accent colors actually come to UPower this would also need some expansion to be able to pass a preferred color to the userspace driver (regardless of what that driver is then doing with that information). On a different note: This approach does currently not cover the older EC controlled 3 zone keyboards from clevo. Here only the kernel has access access to the device so the kernel driver has to expose all functionality somehow. Should this be done by an arbitrarily designed platform device? Kind regards, Werner > > Regards, > > Hans > >