Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp328713rdb; Thu, 22 Feb 2024 05:15:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWpUD4Bz5sYSa4kIoVYYs+GkONwFCglokdsuHRxNTBXj57hY0IaYoyHlSQNKfNKwdHIJrbHICwDKdw7n6xmbB5wqrCYJVidVOTWtOIgyQ== X-Google-Smtp-Source: AGHT+IFfFKhgzKiHkf05P3Uo9uRTvrKK0QfycBlne3YOF+TrI3LfdeL87APziSw926oo/YrUIzgO X-Received: by 2002:a17:90a:5ae6:b0:299:879a:7da2 with SMTP id n93-20020a17090a5ae600b00299879a7da2mr11334400pji.11.1708607758117; Thu, 22 Feb 2024 05:15:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708607758; cv=pass; d=google.com; s=arc-20160816; b=F4OwxyFAiweVwGpMXYZepVNyI8B8IG4bZQRU84OZpda4BDupP8ZknJu4u1sFbPhB0f H37zUuumZ/03MPmrnx8S/DW+dyMATb5XEB3UDtOf2I067BCHBtDI7zkUWgYJ/V8iveko +E1ydmfXEL3lF9aCuPkRAAUWgUY3KHX99Gxk5ktmpZE3n9mdOzHEgCqVI+r6MG4hGcNt L2iEUnlsc2TNIAFJZiw2R+AVP5BXhISxXD/tWpXDHtyWQJlLAM3Zzs77rvR3y6+huZuc X7bLJdAG7500ejsCvgIyimkXRlPxtqdCuPig5IyKhiBD3tRLsNwbB1YSascYSjZ0Qv0N vdFQ== 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=9kEwJ6CVKjeTV/UU4ZV2snp8TyY3Zz/wXMxCmc/s4Y8=; fh=osraw80b6b5kOJhWrlSmCWYGpGbFPkIVuQqPI0VpNTA=; b=cMNF3ss/4DGKx3kIgBhu0VuhJHyZnNupR5k5VXy/bcVmxcPWqiKOzejol97u0sxfUK 9zmLAeKoG1Jx9DEsJ7/vM49s9Qym9L2esTn07EkaTmGAy+ArXkHSsz4HsC5KzDScktY3 EWQUWIs6zjYprWNLacw9Ar2mYJ4f8ztQQ+6oOApzP0WrIa5SM/kY3WBDUVLRfsMQm3+M w3nmLD8uWBVLa3B7dJBgPKIaHQSF/FzPpLag9JMbOGL0+OvMtxH/QCPPS/Uuruf891qE l7ogOiOPCirS1JN1Mg/tzl6UDgdY850gaGFdnCTkRPxtyKEUH1tAY7DqRJ5TvX+O0hUf BuBA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxedocomputers.com header.s=default header.b=jT4sZDQj; 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-76573-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76573-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tuxedocomputers.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g10-20020a17090a578a00b0029899e1d6d9si3432737pji.58.2024.02.22.05.15.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 05:15:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76573-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxedocomputers.com header.s=default header.b=jT4sZDQj; 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-76573-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76573-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 385E6287B52 for ; Thu, 22 Feb 2024 13:15:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A2191339AB; Thu, 22 Feb 2024 13:14:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=tuxedocomputers.com header.i=@tuxedocomputers.com header.b="jT4sZDQj" 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 ECE4A13341F; Thu, 22 Feb 2024 13:14:44 +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=1708607688; cv=none; b=gqBUNhX09X6bKbx08oY/aok34g432oT/XZeSAj0XTkk6PCytE19H/UdM9ZztCekUaUZ+Jnh80knTAZZFo/oruzkkW9IHIwAuu3mwv2D6/9xTocDcpZ82GRBw5QsEzjGwNpuv68DydPLAed1Y4p1evkUFdv77+KdJXgOgdZXMDBY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708607688; c=relaxed/simple; bh=7PbEL0xaSE2/nfsjSGjetHz7DwXTgQaYwcMTBucrhss=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=HVW93HEABAd23U4/x0jnmAilAGx44XejLN4w5zJbEknnnZQEmGlqhrrKe+082pYV0xLzw6pEacGDy3KQOOFtQMMJF4Qh5sfYUJDcT0DKSiHTd0qWtzupiqNvXIO/wa5c07QuA0sjYoLFNTDXelAcAQBcUfZnuIBQqb0XAmKO8pc= 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=jT4sZDQj; 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] (pd9e59c8a.dip0.t-ipconnect.de [217.229.156.138]) (Authenticated sender: wse@tuxedocomputers.com) by mail.tuxedocomputers.com (Postfix) with ESMTPSA id 100502FC0048; Thu, 22 Feb 2024 14:14:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxedocomputers.com; s=default; t=1708607676; 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=9kEwJ6CVKjeTV/UU4ZV2snp8TyY3Zz/wXMxCmc/s4Y8=; b=jT4sZDQjgVqsUv6H+vH93l0lNim+8BdierhwIrRCoqBC1LqB5KliVgLTF/Q6wzbltOPbK1 +Z84A6myGtJxl/WtgyOAD8fxeo6mhJoRjqGBpylu1ByBVDG+Z45lIBmKjLlt8NGof+RFCK qZhf597EmPiTKb7Uf2I38W6RbylvXg4= Authentication-Results: mail.tuxedocomputers.com; auth=pass smtp.auth=wse@tuxedocomputers.com smtp.mailfrom=wse@tuxedocomputers.com Message-ID: Date: Thu, 22 Feb 2024 14:14:35 +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> From: Werner Sembach In-Reply-To: <825129ea-d389-4c6c-8a23-39f05572e4b4@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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. - 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.     - 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. - 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.     - The actual logic interacting with this low level UAPI is implemented by a userspace driver Implementation wise: For the creation of the misc device with the use_leds_uapi switch a helper function/macro might be useful? Wonder if it should go into leds.h, led-class-multicolor.h, or a new header file? - Out of my head it would look something like this: led_classdev_add_optional_misc_control(     struct led_classdev *led_cdev,     char* name,     char* device_type,     char* firmware_version_string,     char* serial_number,     void (*deregister_led)(struct led_classdev *led_cdev),     void (*reregister_led)(struct led_classdev *led_cdev)) Let me know your thoughts and hopefully I can start implementing it soon for one of our devices. Kind regards, Werner Sembach