From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender4-op-o12.zoho.com (sender4-op-o12.zoho.com [136.143.188.12]) (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 D772A35A3B2; Fri, 27 Feb 2026 19:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.12 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772219216; cv=pass; b=hPgFDSdx13xHEIVzASuInKaPOWHBkcAdJ7XE8NnfXM4KnsskWagiQhQEgzPyYih4XhyqJs7C4j0bK6E1PbhDoL03r6XxxEKrFpRuUjnNhDHHXeoKJlybiTqYUnUErHP0qfsKaD7YsCnI8jX+/ZNBnT4pyetzyM8p0dxUL/35vZ8= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772219216; c=relaxed/simple; bh=YlEq2gwnQExHgAJN223Fj4oRWgQXFbjuRJlvwVDO+sE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X+rdF4xprKvno2Kt9K8zO5gc80qAeFq0fU5SmLV9559/yXoXHa8pLM5cwGiMMlLzwZl/V1rod3GPYFzuo5u0fSju8KaX0avgCynL8jxd4B22Yv4r4kxpc7fnhHj8aqKJU6U7+pWOz3iZUbIn8Li6q/AXlaa15U/cQQuL1o2JCwM= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=K8vWew11; arc=pass smtp.client-ip=136.143.188.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="K8vWew11" ARC-Seal: i=1; a=rsa-sha256; t=1772219195; cv=none; d=zohomail.com; s=zohoarc; b=DBQFXqgoqmH0Hjf+7cV+4COaPLJgcm0FEM+KFPO1l0eG6l2fkc+VjAAM5Rk3hkmbvlxnqdTOslDThyEYjfI2BXpGNvyBgqAEG9pVIJY+afMeLP7+lIx5vXk2R/XqZxVqTMzj59b9Afs8N/4jqiNrvRL7QT/CECfuCLpJZBqemcw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772219195; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=6HEv3x4ZyKN5PaiaRJ/PoMhUs2rC1x9QoWDYooM08oo=; b=D3UW4hrbEN8Z93q8Zx7d4dzqNbf+APPhqW4bgDwB9YcD1z940wFQ0luN1+RFTd3rfmDjQYgXk89moDcQUQUioBkZg4+aXjEMPSr4njNVXw2i21HZmUWwYcHX8eScB1GVDJSFQZlTjQfTyfuUrMLFXWImmoZTrL7vupcQfNS6znw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1772219195; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=6HEv3x4ZyKN5PaiaRJ/PoMhUs2rC1x9QoWDYooM08oo=; b=K8vWew11Ta1NHc3j/HfZ1KgfmdNPB21BX6TwjuXHb6KQ20t5mEywHvc3eLvWzTai SiyOZSw1iMJGcJCASGxwkUWizNmQ/K/vaFaPHTOCIUGhSgdlU7UxdFXY/Eth3AJKIwj HXGtD2TWTkxjHe89B+4TcXholtmItBv6lmGyZeo5mDFZk6Y5lApQtBM7HNkh/pCAscW 2KozBy+Eu9dspTuBneGyL/AAKlWRhCZfX/kbjx0lhxDeQvf6HAV9PwO3/6fTlohgwj5 i0zEnNMlzY5C9ML37eBMRuWny66V16l3ezDaPcmk/EeVUzjROteu1H++rnUCBwdtJ4E 5PtRPsNitQ== Received: by mx.zohomail.com with SMTPS id 1772219193143580.9193529328054; Fri, 27 Feb 2026 11:06:33 -0800 (PST) From: Rong Zhang To: Lee Jones , Pavel Machek , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Benson Leung , Guenter Roeck , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Mark Pearson , "Derek J. Clark" , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Ike Panhc Cc: Rong Zhang , Vishnu Sankar , vsankar@lenovo.com, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, chrome-platform@lists.linux.dev, platform-driver-x86@vger.kernel.org Subject: [RFC PATCH 2/9] leds: Add callback offloaded() to query the state of hw control trigger Date: Sat, 28 Feb 2026 03:05:59 +0800 Message-ID: <20260227190617.271388-3-i@rong.moe> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260227190617.271388-1-i@rong.moe> References: <20260227190617.271388-1-i@rong.moe> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-ZohoMailClient: External Currently, we have multiple triggers implementing hw control. However, the LED core doesn't really know the hw control state since the coordination is done directly between the hw control trigger and the LED device. In the following patches, we are about to support hardware initiated trigger transitions to/from hw control trigger. The hw control state is a fundamental factor of determining if a transition should be permitted. Add a callback offloaded() so that the LED core can query the hw control state and use it to make decisions in hw initiated trigger transitions. Signed-off-by: Rong Zhang --- Documentation/leds/leds-class.rst | 5 +++++ include/linux/leds.h | 1 + 2 files changed, 6 insertions(+) diff --git a/Documentation/leds/leds-class.rst b/Documentation/leds/leds-class.rst index 5db620ed27aa2..84665200a88dc 100644 --- a/Documentation/leds/leds-class.rst +++ b/Documentation/leds/leds-class.rst @@ -235,6 +235,11 @@ LED driver must implement the following API to support hw control: Returns a pointer to a struct device or NULL if nothing is currently attached. +LED trigger must implement the following API to support hw control: + - offloaded: + return a boolean indicating if the trigger is offloaded to + hardware. + LED driver can activate additional modes by default to workaround the impossibility of supporting each different mode on the supported trigger. Examples are hardcoding the blink speed to a set interval, enable special diff --git a/include/linux/leds.h b/include/linux/leds.h index b16b803cc1ac5..7332034a43c85 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -485,6 +485,7 @@ struct led_trigger { const char *name; int (*activate)(struct led_classdev *led_cdev); void (*deactivate)(struct led_classdev *led_cdev); + bool (*offloaded)(struct led_classdev *led_cdev); /* Brightness set by led_trigger_event */ enum led_brightness brightness; -- 2.51.0