Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2904330lqp; Mon, 25 Mar 2024 12:33:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXmR8E0nF/XpQ8ad1FmNKoiJ9Z9ZSRrsf3Iuo4nhMrugYWGsBHgWUK01qXnatjIj3bHqmQbimcFZ+xGanavPjzP3Lm2LdvOp8bS1PUklA== X-Google-Smtp-Source: AGHT+IF8k5eDU1mkdKEue+sG/kv3eJabqi02kiRRTaAKeo0JneiKxiVPauDrpfEK6W7+xunI5xhY X-Received: by 2002:a05:6a20:1a23:b0:1a1:4aa9:96df with SMTP id cj35-20020a056a201a2300b001a14aa996dfmr5848744pzb.30.1711395238907; Mon, 25 Mar 2024 12:33:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711395238; cv=pass; d=google.com; s=arc-20160816; b=HTGMeIdGwxIQDgcsPJWsqv6tJmXsA03cingat7DvM27HtkXG1IZdFzsGx2CSzk8yG/ dnScugdvXKQ1j3Bf26vd0rC40ojZTOV6RsWEJtcg8NWT3oEK1afmRmXEtrFZlRHxgYQ/ N5ja15jennIF7j6WDIs8WWYzkVbzn37oZtHD7xjcFfs73oNm+N/jsr05Y58moSPnB9s7 95Nz5T2Ma0S20st+gbrrzRzgtnoTnWGTriWz6cjVFiBCm0hdIgfmHm/LpinuLBLjNm/n +BUY1rhCfqy7hhfYbsXS3FJ7hoGK0wdZRdmM+bZARnK8nX2CDZBlUD4F56s+7N9gc2jn WO6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=ATs5/OdHRjCY1h26TAv0lmEMtG2XpuU45F9t/lj+nys=; fh=osraw80b6b5kOJhWrlSmCWYGpGbFPkIVuQqPI0VpNTA=; b=aMw2rMwPcxeQUOwWw1FOpmyg9cFip54ftYm8ecGfoZipbmRv0R7Ykc89sihPkHSmbv 2ieCEprp0Np3saxhUpXGFc1VwaXRHHv1GIfZHZIYy2qFNXnXllYB6x+Ls/E+hmfMs2ro W2KvoEhnTB5D07AM8i65hivwYvQklsSJ2mV2nykoxbFb0Z7f117x1kzjSW702ps1amkn jzoRbw1dQMebSpny+ZbHvKMLmowaXCiktxh/VKpGt/j/mT5CxhiZQYeNrCmkSoa/j/kB CKeYja0p8FOETR3tGM97Nw6/VpKbz1tBVJUDge7BRlliaXWQ9EC3xgtPM/UlNHQZxnJ7 WLFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxedocomputers.com header.s=default header.b=A0GEY1B9; arc=pass (i=1 spf=pass spfdomain=tuxedocomputers.com dkim=pass dkdomain=tuxedocomputers.com dmarc=pass fromdomain=tuxedocomputers.com); spf=pass (google.com: domain of linux-kernel+bounces-117531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117531-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tuxedocomputers.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id v13-20020a63464d000000b005dd565d7626si7624898pgk.900.2024.03.25.12.33.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 12:33:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxedocomputers.com header.s=default header.b=A0GEY1B9; arc=pass (i=1 spf=pass spfdomain=tuxedocomputers.com dkim=pass dkdomain=tuxedocomputers.com dmarc=pass fromdomain=tuxedocomputers.com); spf=pass (google.com: domain of linux-kernel+bounces-117531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117531-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tuxedocomputers.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B7C40C210E3 for ; Mon, 25 Mar 2024 17:49:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8F2F6F50F; Mon, 25 Mar 2024 17:01:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=tuxedocomputers.com header.i=@tuxedocomputers.com header.b="A0GEY1B9" Received: from mail.tuxedocomputers.com (mail.tuxedocomputers.com [157.90.84.7]) (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 1B8366BFDD; Mon, 25 Mar 2024 17:01:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=157.90.84.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711386068; cv=none; b=CHOmwXZvXt54HrC7mNk3cc4FM0r413kD+Ei2i3qq00ctG3Dl3tuo7DKImVksWv5W4pJSSKdoCzHRfAbIvoc61GmSW4zqrROHN9oPeUvnoYqA7+TnX/lUa4PIt42Rf+HFxlPOi6TwUW1c5HhJ6alVBGaWcBDV4Tu7UR72P1xi8sc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711386068; c=relaxed/simple; bh=so55drc7BZofIQPnratz0hw9pejb7zJvlJgfkTj6+v0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=I/64QoI4HAT0k8RfQaPrZq810ZKWhko4qsc6y9hpQyKTHYHC0U2nHc75hAPsCpJDWXpOwjlGumXoNcvyo2JsS1BKRdBeOXxUR6X0XFYhAyJmGaYyW58ke8PTnLOCjYxNSu7Trs37nQAgeUGT9i5G0aAnBmPC5nL/6r82AEV0NO0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tuxedocomputers.com; spf=pass smtp.mailfrom=tuxedocomputers.com; dkim=pass (1024-bit key) header.d=tuxedocomputers.com header.i=@tuxedocomputers.com header.b=A0GEY1B9; arc=none smtp.client-ip=157.90.84.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tuxedocomputers.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxedocomputers.com Received: from [192.168.42.20] (p5de453e6.dip0.t-ipconnect.de [93.228.83.230]) (Authenticated sender: wse@tuxedocomputers.com) by mail.tuxedocomputers.com (Postfix) with ESMTPSA id AD8392FC005D; Mon, 25 Mar 2024 18:01:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxedocomputers.com; s=default; t=1711386062; 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=ATs5/OdHRjCY1h26TAv0lmEMtG2XpuU45F9t/lj+nys=; b=A0GEY1B9FnamydoebSttg0wlw+tkjTkGAiYySc6x/bPZJsR+vPSWJgPzqJhKk5Y18dsAd5 c3UQOE9aW2cGrY8llgV1BKDXZMtWtL+lmRcfJEmjHQL+yXBA98ptQObBA6jUbDYpAQvsyF ak1yM1tNx5Sa8TJrBEn5+6sjPYP93mA= Authentication-Results: mail.tuxedocomputers.com; auth=pass smtp.auth=wse@tuxedocomputers.com smtp.mailfrom=wse@tuxedocomputers.com Message-ID: <4df21921-a32c-41ad-b366-e75a5d4de5de@tuxedocomputers.com> Date: Mon, 25 Mar 2024 18:01:02 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Future handling of complex RGB devices on Linux v3 Content-Language: en-US To: Hans de Goede Cc: Lee Jones , jikos@kernel.org, linux-kernel@vger.kernel.org, Jelle van der Waa , Miguel Ojeda , "dri-devel@lists.freedesktop.org" , linux-input@vger.kernel.org, ojeda@kernel.org, linux-leds@vger.kernel.org, Pavel Machek , Gregor Riepl References: <0cdb78b1-7763-4bb6-9582-d70577781e61@tuxedocomputers.com> <7228f2c6-fbdd-4e19-b703-103b8535d77d@redhat.com> <730bead8-6e1d-4d21-90d2-4ee73155887a@tuxedocomputers.com> <952409e1-2f0e-4d7a-a7a9-3b78f2eafec7@redhat.com> <9851a06d-956e-4b57-be63-e10ff1fce8b4@tuxedocomputers.com> <1bc6d6f0-a13d-4148-80cb-9c13dec7ed32@redhat.com> <477d30ee-247e-47e6-bc74-515fd87fdc13@redhat.com> <247b5dcd-fda8-45a7-9896-eabc46568281@tuxedocomputers.com> <825129ea-d389-4c6c-8a23-39f05572e4b4@redhat.com> <281f9b71-a565-4ff3-8343-ca36d604584d@redhat.com> <93d70ac3-bb18-4732-abb4-134750a5b50c@tuxedocomputers.com> <8264bce7-eda0-4e1c-8c72-a6a78ee3a7bd@redhat.com> From: Werner Sembach In-Reply-To: <8264bce7-eda0-4e1c-8c72-a6a78ee3a7bd@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Hans, Am 25.03.24 um 15:18 schrieb Hans de Goede: > Hi Werner, > > On 3/19/24 4:18 PM, Werner Sembach wrote: >> Hi Hans, >> >> Am 18.03.24 um 12:11 schrieb Hans de Goede: >>> Hi Werner, >>> >>> Sorry for the late reply. >> np >>> On 2/22/24 2:14 PM, Werner Sembach wrote: >>>> Hi, >>>> >>>> Thanks everyone for the exhaustive feedback. And at least this thread is a good comprehesive reference for the future ^^. >>>> >>>> To recap the hopefully final UAPI for complex RGB lighting devices: >>>> >>>> - By default there is a singular /sys/class/leds/* entry that treats the device as if it was a single zone RGB keyboard backlight with no special effects. >>> Ack this sounds good. >>> >>>> - There is an accompanying misc device with the sysfs attributes "name", "device_type",  "firmware_version_string", "serial_number" for device identification and "use_leds_uapi" that defaults to 1. >>> You don't need a char misc device here, you can just make this sysfs attributes on the LED class device's parent device by using device_driver.dev_groups. Please don't use a char misc device just to attach sysfs attributes to it. >>> >>> Also I'm a bit unsure about most of these attributes, "use_leds_uapi" was discussed before >>> and makes sense. But at least for HID devices the rest of this info is already available >>> in sysfs attributes on the HID devices (things like vendor and product id) and since the >>> userspace code needs per device code to drive the kbd anyways it can also have device >>> specific code to retrieve all this info, so the other sysfs attributes just feel like >>> duplicating information. Also there already are a ton of existing hidraw userspace rgbkbd >>> drivers which already get this info from other places. >> The parent device can be a hid device, a wmi device, a platform device etc. so I thought it would be nice to have some unified way for identification. > I think that some shared ioctl for identifying devices which need a misc-device > makes sense. But for existing hidraw supported keyboards there already is existing > userspace support, which already retreives this in a hidraw specific manner. > > And I doubt that the existing userspace projects will add support for a new method > which is only available on new kernels, while they will also need to keep the old > method around to keep things working with older kernels. > > So at least for the hidraw case I see little value in exporting the same info > in another way. Ack on the no new device, but since we are adding use_leds_uapi to the parent device anyway, having the identification on non-HID devices wie sysfs entries would help even more in not creating a new device just to handle an ioctl. Just to note here. When we go the LampArray route, everything is a HID device anyway. > > >>>>      - If set to 0 the /sys/class/leds/* entry disappears. The driver should keep the last state the backlight was in active if possible. >>>> >>>>      - If set 1 it appears again. The driver should bring it back to a static 1 zone setting while avoiding flicker if possible. >>> Ack, if this finds it way into some documentation (which it should) please make it >>> clear that this is about the "use_leds_uapi" sysfs attribute. >> Ack >>>> - If the device is not controllable by for example hidraw, the misc device might also implement additional ioctls or sysfs attributes to allow a more complex low level control for the keyboard backlight. This is will be a highly vendor specific UAPI. >>> IMHO this is the only case where actually using a misc device makes sense, so that >>> you have a chardev to do the ioctls on. misc-device-s should really only be used >>> when you need a chardev under /dev . Since you don't need the chardev for the e.g. >>> hidraw case you should not use a miscdev there IMHO. >> My train of thought was that it would be nice to have the use_leds_uapi at a somewhat unified location in sysfs. The parent device can be of any kind, like I mentioned above, and while for deactivating it can easily be found via /sys/class/leds/*/device/. For reactivating, the leds entry doesn't exist. > That is an interesting point. But I would expect any process/daemon which wants to > reactivate the in kernel LED class support to be the same process as which > deactivated it. So that daemon can simply canonicalize the /sys/class/leds/*/device > symlink or canonicalize the entire /sys/class/leds/*/device/use_leds_uapi path > and store the canonicalized version for when the daemon wants to reactivate things. Ack Regards, Werner > > So I still think that having the miscdevice just for enumeration and > use_leds_uapi purposes is overkill. > > Regards, > > Hans > >