From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 5A928238C0A for ; Sun, 28 Dec 2025 18:23:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766946215; cv=none; b=oRIP7woj3KspZ9s04hzrXpEDN5xdkwai72nW/eh1zAXA5uWUdfI+mNxpvDPRIrFiZ41mV3OYnEsAwmNoyD4jT0NTxs9r4vbSuanJYXRnYi2bNfaMuaiByJpSSkrw4SRTaum0HYLdFvBADZ/UMaKOEjD5/fmKswprRkkBXN9ESqY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766946215; c=relaxed/simple; bh=qnxj1dC/cCFhtpEx9uTCMc00ugysyCX2y8hqP+/0TCU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dsva47Y1AnxWLgGThKZ0jR98VrKTpzuaKevD6u93g+C0aM/Vf1jZq1yExpRDedifNVQ6byFwGrEnHOWp46/mNNBtE09RW029p2jnYs0o3orougiEKdM9Zmf5666ktEvOAf5UOS4aTQa/L9PdumjmdZ+wiDdax0h7fanjqK4BrCY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=L/1iyM1y; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L/1iyM1y" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-7f89d0b37f0so4206195b3a.0 for ; Sun, 28 Dec 2025 10:23:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766946212; x=1767551012; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8J9+R8OyR5jrsym1MdOdINO4Sn7+ZiEPmIquYIfwATk=; b=L/1iyM1y81rNzdiAaEPs7Mg4WIWE+zpcuSDOrRmUaFXnY94o1l3d0puLyIekqi7oyW +I+ClxYWRUJVPCaUJ5gn/Alle6j4uWx6yUN5TO8QxzSXXtlX8LJcQwVALkb+/zT61KN2 pOTzYvU0o2Pvbhm/ZfImt9ld79k7O2qax4AYOfSMCoogDlsW5rmVGpi6XDYPMxkQNRgI mzznq3p5oXrLIcWQeNQQSNw0QYpwtttK+lyHiaMm+lC4iu3zRbnURHFcV7te5aiAKOe3 RwR0NDqR1mP+nLNfcOjfcsvDf9jukrLFWUioJZfLl50WZVbCXOmLJ1eIcAyDeKkcwXYl X18Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766946212; x=1767551012; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=8J9+R8OyR5jrsym1MdOdINO4Sn7+ZiEPmIquYIfwATk=; b=Z1XbVpnGqomubtDVTZtolDxh3UJJHtCGInmNAWLGMAFG3nONMv0JBUtL28rNtP4KJT nItqWvXWFhZKotIroUEVG891HWJqa/KMRBblkT2gwy5z8GQOQg17qi35kn0IDBOZWuOx rN+2FGfk4EMeysWwu3FcfFCVjO+QZ4I9rsP2ztVRSQrHr9jMpgr7PK8NSHI9Jv+ClBEe 5X9J7rWqUeoEvvHx639IlxgookD/EtDdXp/b1HlzaGFN5rRJOMy9rsujowH39ZDtRHSF AsclQl0IpjfzmrJ4Ddid5xD/kzXUvRFiv0o+S8cUWGYJG/nNf9sHlmFUmDYQk7Wr/L9K YpjQ== X-Forwarded-Encrypted: i=1; AJvYcCWIsUMG+2qcsadQQ+YPSI2IqTqyGjkx3Zwjut8TJmZ1rBdz/hWM1cqeuAu0RtOSyBdwcqphmGoslAXfPl8=@vger.kernel.org X-Gm-Message-State: AOJu0YxChQDvJbBZ0BmjUZNHPcAbprVThldoGgwwaXvdVYLSnuL2UbeO 6d460JfVWJ08vSndb30NTj8nWk6Q8VviyNUQxQkAFbk+BbZMvSTe+jKc X-Gm-Gg: AY/fxX76/fVyTpv/stXc730Lf9LQVlMcCgAKlnEjPiZX6dnIaGd5+dM9j+FI5YRaWDC wCV9ff17D0HCP+5Ki/GQgdSMeQI+9wBqss+sK7W2seUpAF9P1CnI9lbUIiDpKwEGuMs31JkbTZk c7nvWY3fJAv3s/m5nOJTBg0GHpSkDhdkv4xHc2R/SUVh94Xi2WFHJXX1t/EQvjYH20oMLU2mMqM kkZQwP/a8dr3owl+cMDk8h3eUWlaEf0oso1vp3H9dyVWNi0+Z6IjKBsdhF5HWDtd6kWZSdZgYKV kKIORqfRuaz3OB7AtgisL6uHFBFNcYDtimmJX0XkOmv3JGzgs9NTmIZ3DMWXCy2ykRDQtG/vDUj zGM8y/gZnWv/YkxhahUURCLdx3/Z9kJLw6vCWmywzBNSHgb8pulb8PG4aWsB9ciKXFSVWb+F+4t OdzbLAeiIHZpVqgXy5Op0dGaLPtmYB3vgfHrfzXVKTfnU= X-Google-Smtp-Source: AGHT+IFxu1X07rvxROoKTd47BW6KRbd9zLwIEqGQ6nrGR/rCPRoC8FEYxber7zuWsEXxprD0hpJ0EA== X-Received: by 2002:a05:6a21:328c:b0:342:fa5:8b20 with SMTP id adf61e73a8af0-3769f9332a1mr27553338637.30.1766946212430; Sun, 28 Dec 2025 10:23:32 -0800 (PST) Received: from MRSPARKLE.localdomain ([150.228.155.85]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7ff7e48f3d7sm27399695b3a.51.2025.12.28.10.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Dec 2025 10:23:32 -0800 (PST) From: Jonathan Brophy To: lee Jones , Pavel Machek , Andriy Shevencho , Jonathan Brophy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Radoslav Tsvetkov Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org Subject: [RFC PATCH 2/2] dt-bindings: leds: common: Add led-instance property Date: Mon, 29 Dec 2025 07:22:45 +1300 Message-ID: <20251228182252.1550173-3-professorjonny98@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251228182252.1550173-1-professorjonny98@gmail.com> References: <20251228182252.1550173-1-professorjonny98@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Jonathan Brophy Document the optional "led-instance" property for providing deterministic LED naming when multiple LEDs share the same function and color. Signed-off-by: Jonathan Brophy --- .../devicetree/bindings/leds/common.yaml | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/Documentation/devicetree/bindings/leds/common.yaml b/Documentation/devicetree/bindings/leds/common.yaml index f4e44b33f56d..0e9611662850 100644 --- a/Documentation/devicetree/bindings/leds/common.yaml +++ b/Documentation/devicetree/bindings/leds/common.yaml @@ -51,6 +51,33 @@ properties: needed, differing only with an ordinal number. $ref: /schemas/types.yaml#/definitions/uint32 + led-instance: + description: + Optional instance identifier for deterministic LED naming when multiple + LEDs share the same function and color. Without this property, the LED + core appends numerical suffixes (_1, _2) based on registration order, + which is non-deterministic and breaks userspace automation. + + The instance identifier becomes the third component in the LED name + using the format "function:color:instance" (or "color:function-N:instance" + when function-enumerator is present). + + This property is only used with the modern function and color based naming + scheme. It is ignored when the deprecated "label" property is present, as + "label" already provides full control over the LED name. + + Common use cases include multi-port network devices ("port0", "port1"), + multi-domain power indicators ("battery", "ac", "usb"), and system state + LEDs ("boot", "upgrade", "panic"). + + The identifier should be semantic (describes purpose), deterministic + (fixed in hardware description), and concise (under 32 characters). + Only alphanumeric characters, dashes, and underscores are allowed, and + the identifier must start with an alphanumeric character. + $ref: /schemas/types.yaml#/definitions/string + maxLength: 31 + pattern: "^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + label: description: The label for this LED. If omitted, the label is taken from the node name @@ -320,4 +347,70 @@ examples: }; }; + - | + #include + #include + + /* Example: 48-port network switch with deterministic port LEDs */ + ethernet-leds { + compatible = "gpio-leds"; + + led-port0 { + function = LED_FUNCTION_LAN; + color = ; + led-instance = "port0"; + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + /* Result: /sys/class/leds/green:lan:port0 */ + }; + + led-port1 { + function = LED_FUNCTION_LAN; + color = ; + led-instance = "port1"; + gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; + /* Result: /sys/class/leds/green:lan:port1 */ + }; + + led-port47 { + function = LED_FUNCTION_LAN; + color = ; + led-instance = "port47"; + gpios = <&gpio0 47 GPIO_ACTIVE_HIGH>; + /* Result: /sys/class/leds/green:lan:port47 */ + }; + }; + + - | + #include + #include + + /* Example: Multiple power domain LEDs */ + power-leds { + compatible = "gpio-leds"; + + led-ac-power { + function = LED_FUNCTION_POWER; + color = ; + led-instance = "ac"; + gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; + /* Result: /sys/class/leds/green:power:ac */ + }; + + led-battery-power { + function = LED_FUNCTION_POWER; + color = ; + led-instance = "battery"; + gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; + /* Result: /sys/class/leds/green:power:battery */ + }; + + led-usbc-power { + function = LED_FUNCTION_POWER; + color = ; + led-instance = "usbc"; + gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>; + /* Result: /sys/class/leds/green:power:usbc */ + }; + }; + ... -- 2.43.0