From patchwork Wed Aug 7 19:54:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1970215 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Z0BVhOR/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WfLVR4t0Gz1ydt for ; Thu, 8 Aug 2024 05:54:39 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B123B88BC6; Wed, 7 Aug 2024 21:54:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Z0BVhOR/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A6F7B88C0E; Wed, 7 Aug 2024 21:54:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A9660889D4 for ; Wed, 7 Aug 2024 21:54:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ansuelsmth@gmail.com Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-428e3129851so1682255e9.3 for ; Wed, 07 Aug 2024 12:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723060464; x=1723665264; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=7MItkl2Z+Jt8Mvb5HInZTEP3uAkqW6OJugrf2S9IW4A=; b=Z0BVhOR/eVh6OI+9UukcxRAa06dG6+AzYDvE5/y6+rNtUI6SDv4TeTw32rw95BrRII TFEksozfb2KWMUqQeP3xFJnwY9BM4TWWxdvkyDfH5UgCAPTha0HeL0NaESbNM6luzA7s tVIbJnnYmL2xs4pEn+uk50YFwp9usLHcGAXBn1MwKRKT3wzVVSEC9D7x4IrHqKJM/U5d jsH404yOUM+ceVlKj9CyPLZw7BqjeWDDZGjdtMiaEPjRxxKNUxNov+mDs+4eTWgNNRmK z5OSdFOtZfRyIcXW23w9S1yxBKRSpirMB+kJsvbRsRx4w94Mwcs4fh9bumPUyqkmkKo6 /Sbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723060464; x=1723665264; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7MItkl2Z+Jt8Mvb5HInZTEP3uAkqW6OJugrf2S9IW4A=; b=Ajqsqs1lfG5BTc2OFRS08VqcKQmCaX2te4O6cHgZyr6TlSvX/ZM41mr0Z3PTcvhmab dYCERvm7F6DXmI128jObm8fT2jWVPdB+W7QdLsCIiY7M3Z/1vxDc3fLHFc1TppJyYqDO TPQYzfNR5CcF/cojS8Z8kwe08tNJdKpj4yanD5ps9VGNBiPr+ecxvSA3OYOWdqpHKDOW EJpZCoeT2dyLJUQo15c6dBqownUeiWjseml6inX+rdtwE/BQ5LxojME/14mJWViEVXvU BbnGtMBUPhnsheRBleX2wVt9z94rX7zmUC9S11/A1LAJF2R25R636ZlOd+gkYG5qadQx sGGQ== X-Forwarded-Encrypted: i=1; AJvYcCWDJbajbwEb4TpCiOeL+z7Hpxyvs2VPNtOchZz9C+9cUvia4s39JOWbCB83IoKlQ/fwOR6KxdWw+pz31yMPmeS7tg+IoQ== X-Gm-Message-State: AOJu0YwT5EdSkvUheCam7JDCAAiAqB4NLOctyYH1otPpD6jl/gIjvobh Ch2oSvUPv26/lhtIesZhg8pAMDYOH3ezUkI8ef5t1V9aeRP/OvK2 X-Google-Smtp-Source: AGHT+IECrUW4YimfG0yYeXPC80HW1cpGAeaIYdKPviJzzJq21nPal7gC1PTNvvAtL9ADaQBJ+8fgTQ== X-Received: by 2002:a05:600c:35d2:b0:427:ff7a:79e with SMTP id 5b1f17b1804b1-428e6b08baemr128345175e9.16.1723060463758; Wed, 07 Aug 2024 12:54:23 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429057a8802sm44383765e9.21.2024.08.07.12.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 12:54:23 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Dario Binacchi , Christian Marangi , Miquel Raynal , Heinrich Schuchardt , Arseniy Krasnov , Martin Kurbanov , Dmitry Dunaev , Simon Glass , Marek Vasut , Rasmus Villemoes , Sean Anderson , Shiji Yang , Vasileios Amoiridis , Leo Yu-Chi Liang , Mikhail Kshevetskiy , Michael Polyntsov , Doug Zobel , u-boot@lists.denx.de Subject: [PATCH v2 1/9] led: turn LED ON on initial SW blink Date: Wed, 7 Aug 2024 21:54:04 +0200 Message-ID: <20240807195413.30456-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807195413.30456-1-ansuelsmth@gmail.com> References: <20240807195413.30456-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean We currently init the LED OFF when SW blink is triggered when on_state_change() is called. This can be problematic for very short period as the ON/OFF blink might never trigger. Turn LED ON on initial SW blink to handle this corner case and better display a LED blink from the user. Signed-off-by: Christian Marangi --- drivers/led/led_sw_blink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/led/led_sw_blink.c b/drivers/led/led_sw_blink.c index 9e36edbee47..853278670b9 100644 --- a/drivers/led/led_sw_blink.c +++ b/drivers/led/led_sw_blink.c @@ -103,8 +103,11 @@ bool led_sw_on_state_change(struct udevice *dev, enum led_state_t state) return false; if (state == LEDST_BLINK) { + struct led_ops *ops = led_get_ops(dev); + + ops->set_state(dev, LEDST_ON); /* start blinking on next led_sw_blink() call */ - sw_blink->state = LED_SW_BLINK_ST_OFF; + sw_blink->state = LED_SW_BLINK_ST_ON; return true; } From patchwork Wed Aug 7 19:54:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1970217 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=kXFgxapE; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WfLVf2Znrz1ydt for ; Thu, 8 Aug 2024 05:54:50 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2023588C29; Wed, 7 Aug 2024 21:54:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kXFgxapE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B6E1A88BF9; Wed, 7 Aug 2024 21:54:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A72DB88BF9 for ; Wed, 7 Aug 2024 21:54:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ansuelsmth@gmail.com Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-428e0d18666so1620205e9.3 for ; Wed, 07 Aug 2024 12:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723060466; x=1723665266; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=FZwEhbDpC3QRsL4OcntQ5ExiSIPebNKwOaMYQduXGxg=; b=kXFgxapEshltzGYgmlvNkp8n+ECn7hjnVq7xR4I4T1tkD+P6mZiSZk7eZZBJujRMh4 qfcrFZrQF0DFLoXpDlstAD0HxWijSpi8eYjn6hQ4R8I5SgEAOg32PWjGwZnBWkiJXOtr RB8s7LgHEPeNDE/AOsMcZKB701k540FAfeROfyGutgd2I3tPz4IpcgSgfIKBT4kY0WPT JtHN96F/7X8b/H1d4yhLrfoupTdh+4RfqD6LNosUFmfPgoMvgWn5W9lob6kQjF9uOgDM K6N2RmsMaUuZUTVFW1VwdH5DsifyowK9AYVc5b6qbqsJ329YPgrLRo7T1BIpMc6LecLu Wf+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723060466; x=1723665266; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FZwEhbDpC3QRsL4OcntQ5ExiSIPebNKwOaMYQduXGxg=; b=fysRlkajmWy5v7fkFJtkBLPm2CXE+drFVraZix9CjFRFynq09ALq7hk2BLlJUxQlJr VfoaKI5X1WQawq3EDScTwvmd/J1DWXOoaLPRqLSSEuHhe4a40LifyFZINbczRHJCx+jN iAkU6xlyWNmzwjuu1Piok3fOHAzx4stkoOLxYqEZDv5gp/pCM8x6xsXCllTvjK5Xgdvt JtdpwQ3UwT7L8xaWruSm8j5+w+bE4UkfQvpDofd2mA1wheN3q//RW01g8l7klkxa7HHM G+Gpe4CzwquUrh1PCsYE0g25POWZv72g6r2DCahlfELMWErpnOcLEL6HwTDy2ir7R0lK 8LDQ== X-Forwarded-Encrypted: i=1; AJvYcCX54JsUYYyp0o5bucNQZi5fO+HcDkF2XwgZKFq5ZQ7Htcvm+VJ0seDcyfYssiR2xKcHV/gm9Ujm+GeyzHyk9uzQnitsMw== X-Gm-Message-State: AOJu0Yycgfwp07zJTO/69+Gfudu6FeMTaxih9qh3g2Z5TP+BunVBIq9e FIDQRUSMpZU/9NB+C3NuCvxY5IE1+37WozAu12EIwtdGlc6N2TJb X-Google-Smtp-Source: AGHT+IEOY6iOgDzabyO6wcqyyKi0d4lYbp7OxP4pFzrlARLT2i/yKjfhK+2foK9W/1I6xf1Oq+e8HA== X-Received: by 2002:a05:600c:4449:b0:426:6618:146a with SMTP id 5b1f17b1804b1-428e6af1afcmr134945775e9.2.1723060465615; Wed, 07 Aug 2024 12:54:25 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429057a8802sm44383765e9.21.2024.08.07.12.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 12:54:25 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Dario Binacchi , Christian Marangi , Miquel Raynal , Heinrich Schuchardt , Arseniy Krasnov , Martin Kurbanov , Dmitry Dunaev , Simon Glass , Marek Vasut , Rasmus Villemoes , Sean Anderson , Shiji Yang , Vasileios Amoiridis , Leo Yu-Chi Liang , Mikhail Kshevetskiy , Michael Polyntsov , Doug Zobel , u-boot@lists.denx.de Subject: [PATCH v2 2/9] led: implement led_set_state/period_by_label Date: Wed, 7 Aug 2024 21:54:05 +0200 Message-ID: <20240807195413.30456-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807195413.30456-1-ansuelsmth@gmail.com> References: <20240807195413.30456-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Introduce new API led_set_state/period_by label as a shorthand to set LED state and LED blink period by referencing them by label. This is needed for the upcoming additional API that will declare LED in .confg and reference them by their LED label name. Signed-off-by: Christian Marangi --- drivers/led/led-uclass.c | 28 ++++++++++++++++++++++++++++ include/led.h | 18 ++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c index 199d68bc25a..b2b96d7d48b 100644 --- a/drivers/led/led-uclass.c +++ b/drivers/led/led-uclass.c @@ -65,6 +65,20 @@ int led_set_state(struct udevice *dev, enum led_state_t state) return ops->set_state(dev, state); } +int led_set_state_by_label(const char *label, enum led_state_t state) +{ + struct udevice *dev; + int ret; + + ret = led_get_by_label(label, &dev); + if (ret) { + printf("Failed to get LED by label %s\n", label); + return ret; + } + + return led_set_state(dev, state); +} + enum led_state_t led_get_state(struct udevice *dev) { struct led_ops *ops = led_get_ops(dev); @@ -94,6 +108,20 @@ int led_set_period(struct udevice *dev, int period_ms) return -ENOSYS; } +int led_set_period_by_label(const char *label, int period_ms) +{ + struct udevice *dev; + int ret; + + ret = led_get_by_label(label, &dev); + if (ret) { + printf("Failed to get LED by label %s\n", label); + return ret; + } + + return led_set_period(dev, period_ms); +} + static int led_post_bind(struct udevice *dev) { struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); diff --git a/include/led.h b/include/led.h index 99f93c5ef86..c1f3380f253 100644 --- a/include/led.h +++ b/include/led.h @@ -111,6 +111,15 @@ int led_get_by_label(const char *label, struct udevice **devp); */ int led_set_state(struct udevice *dev, enum led_state_t state); +/** + * led_set_state_by_label - set the state of an LED referenced by Label + * + * @label: LED label + * @state: LED state to set + * Return: 0 if OK, -ve on error + */ +int led_set_state_by_label(const char *label, enum led_state_t state); + /** * led_get_state() - get the state of an LED * @@ -128,6 +137,15 @@ enum led_state_t led_get_state(struct udevice *dev); */ int led_set_period(struct udevice *dev, int period_ms); +/** + * led_set_period_by_label - set the blink period of an LED referenced by Label + * + * @label: LED label + * @period_ms: LED blink period in milliseconds + * Return: 0 if OK, -ve on error + */ +int led_set_period_by_label(const char *label, int period_ms); + /** * led_bind_generic() - bind children of parent to given driver * From patchwork Wed Aug 7 19:54:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1970218 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=gzF8yuWr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WfLVq5Trwz1ydt for ; Thu, 8 Aug 2024 05:54:59 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8440188BF9; Wed, 7 Aug 2024 21:54:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="gzF8yuWr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EF5C1889D4; Wed, 7 Aug 2024 21:54:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DE2EF88BF9 for ; Wed, 7 Aug 2024 21:54:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ansuelsmth@gmail.com Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4257d5fc9b7so2400145e9.2 for ; Wed, 07 Aug 2024 12:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723060467; x=1723665267; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=hYvK2I9nvof/73nSjBfyzMimiE25coX9dBrpUO5rafE=; b=gzF8yuWrY8O1nJ9L2cU6slH9RkYotPlWOl8qnw/TbjgOt8RvX74/BBZZE34NHhVsm2 eUVm7y5MXrSr4mwBrygh1mL9T45qnPiKb7vQmC5rB3T90zzniKvZZ6sWR0KQyQ1J1Lmk BAy4cxpoGIoY2pdWehyaJ81p+qrdQSdIohFpflyCYH++0mXFc3hDBgaaTQKAiS4GmFa5 nKP2VaFiNSLVulY7FDohyAEZNCIt/d5dEmTvXKfgaNnieMcMMEE6zXkeyBZDSKjc0jAB hDOPt8TUjR7Ld5ZTy4i+m9KTG3JVWbNlQY8uJrYwqvv72Q2IekYI06l8PHnPoDaU7p3x UoCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723060467; x=1723665267; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hYvK2I9nvof/73nSjBfyzMimiE25coX9dBrpUO5rafE=; b=VXacDRDvRJmduLn4hYICMJyuRpsKPtK467H3s1b/wxCcSLjnS6CrSzRgpX2j8aefxy ZYQWwmliEhpQ1U4684zTJkJosONkdsp4+suYe/wfRe3FQf2A2OMjnHApZp9ysJUjpC4y iE94CbDpVE5pJIVpHAQjeOLkcMuM+A7i/rwXvqfYLbROwx/oU0eefZuX3RvNW31aGtIf 3Tos5cQ6NQN8VYPE1OtmO9lYIdeKsXcTslt3Q2X/lTDk8FjtS0mhvJntHHyJdnGKn1oO Q6kdbJzeKB3tZuAv7uX4CoOg9mMMfmiLdeaD9/xSmBbbe08etkPyAOACpv04yyYN1KmY 7BSw== X-Forwarded-Encrypted: i=1; AJvYcCWAH2ULhqwFRXg/d5t1nRjG4AnENENI8hDLcH278HToSbGyeEQ0DL11nirEa/VlE8kuhgYM4SpnVnLv4fQlI6iHGwC+6g== X-Gm-Message-State: AOJu0Ywfzc9lLQ1bXs6+xOLjZaX+FVLK2VnPv7hWvuUmQ38oNMbFbq1S iDNoJFlE61YhupQXwJ1ruusqhTH3+qbmzspLTNh1DX78IK6PG/zk X-Google-Smtp-Source: AGHT+IFux2EvhMFcJx18f21iQI69cROesVB9DYgPagBBlT9JCI3SDn8tBIdSFA35eDGEsb5rDAXSTg== X-Received: by 2002:a05:600c:35ca:b0:426:545b:ec00 with SMTP id 5b1f17b1804b1-428e6b2f0c5mr177132375e9.19.1723060467442; Wed, 07 Aug 2024 12:54:27 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429057a8802sm44383765e9.21.2024.08.07.12.54.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 12:54:27 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Dario Binacchi , Christian Marangi , Miquel Raynal , Heinrich Schuchardt , Arseniy Krasnov , Martin Kurbanov , Dmitry Dunaev , Simon Glass , Marek Vasut , Rasmus Villemoes , Sean Anderson , Shiji Yang , Vasileios Amoiridis , Leo Yu-Chi Liang , Mikhail Kshevetskiy , Michael Polyntsov , Doug Zobel , u-boot@lists.denx.de Subject: [PATCH v2 3/9] led: implement LED boot API Date: Wed, 7 Aug 2024 21:54:06 +0200 Message-ID: <20240807195413.30456-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807195413.30456-1-ansuelsmth@gmail.com> References: <20240807195413.30456-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Implement LED boot API to signal correct boot of the system. led_boot_on/off/blink() are introduced to turn ON, OFF and BLINK the designated boot LED. New Kconfig are introduced, CONFIG_LED_BOOT_ENABLE to enable the feature, CONFIG_LED_BOOT_LABEL to declare the LED label in DT to reference the LED for BOOT usage and CONFIG_LED_BOOT_PERIOD to declare the blinking period. If CONFIG_LED_BLINK or CONFIG_LED_SW_BLINK is not enabled, led_boot_blink call will fallback to simple LED ON. Signed-off-by: Christian Marangi --- drivers/led/Kconfig | 20 ++++++++++++++++++++ include/led.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index bee74b25751..fd9442edaf3 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -9,6 +9,26 @@ config LED can provide access to board-specific LEDs. Use of the device tree for configuration is encouraged. +config LED_BOOT_ENABLE + bool "Enable LED boot support" + help + Enable LED boot support. + + LED boot is a specific LED assigned to signal boot operation status. + +config LED_BOOT_LABEL + string "LED boot label" + depends on LED_BOOT_ENABLE + help + LED label defined in DT to assign for LED boot usage. + +config LED_BOOT_PERIOD + int "LED boot period" + depends on LED_BOOT_ENABLE && (LED_BLINK || LED_SW_BLINK) + default 2 + help + LED boot blink period in ms. + config LED_BCM6328 bool "LED Support for BCM6328" depends on LED && ARCH_BMIPS diff --git a/include/led.h b/include/led.h index c1f3380f253..7bbe165d838 100644 --- a/include/led.h +++ b/include/led.h @@ -159,4 +159,48 @@ int led_sw_set_period(struct udevice *dev, int period_ms); bool led_sw_is_blinking(struct udevice *dev); bool led_sw_on_state_change(struct udevice *dev, enum led_state_t state); +#ifdef CONFIG_LED_BOOT_ENABLE + +/** + * led_boot_on() - turn ON the designated LED for booting + * + * Return: 0 if OK, -ve on error + */ +static inline int led_boot_on(void) +{ + return led_set_state_by_label(CONFIG_LED_BOOT_LABEL, LEDST_ON); +} + +/** + * led_boot_off() - turn OFF the designated LED for booting + * + * Return: 0 if OK, -ve on error + */ +static inline int led_boot_off(void) +{ + return led_set_state_by_label(CONFIG_LED_BOOT_LABEL, LEDST_OFF); +} + +#if defined(CONFIG_LED_BLINK) || defined(CONFIG_LED_SW_BLINK) +/** + * led_boot_blink() - turn ON the designated LED for booting + * + * Return: 0 if OK, -ve on error + */ +static inline int led_boot_blink(void) +{ + int ret; + + ret = led_set_period_by_label(CONFIG_LED_BOOT_LABEL, CONFIG_LED_BOOT_PERIOD); + if (ret) + return ret; + + return led_set_state_by_label(CONFIG_LED_BOOT_LABEL, LEDST_BLINK); +} +#else +/* If LED BLINK is not supported/enabled, fallback to LED ON */ +#define led_boot_blink led_boot_on +#endif +#endif + #endif From patchwork Wed Aug 7 19:54:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1970220 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=EGon7hVx; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WfLW364f3z1yXs for ; Thu, 8 Aug 2024 05:55:11 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E0F4F88D67; Wed, 7 Aug 2024 21:54:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="EGon7hVx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0550988C23; Wed, 7 Aug 2024 21:54:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 77D1388D39 for ; Wed, 7 Aug 2024 21:54:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ansuelsmth@gmail.com Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-42803bbf842so2488045e9.1 for ; Wed, 07 Aug 2024 12:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723060469; x=1723665269; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=F7EzSifg9g5UstZpOxR5pGveBAvWbwJf3eidWqN+PFY=; b=EGon7hVxfkHQEfNdzq14d0ICQdJ1n7By9Y1kgqx7//lSHXKHPhsLHC0e506iibXVQ3 Q6iJ8zo5w87S05jY0G/pZaVKKloAGbpbq44WuJIuciFkzDM9fWcBY4PeJGiIZpW4E8dO Xlvnqp3iximx7X51Ys18xnYI4huFFdRQwm6gkWjHCH0l4seKisFVNB9LXq+RIQm3GTGt FtU9RFidt80I1LyxjQHcS29tdv/wAeRyX3DzR2NTa8Ag/mOT1tJpLZYNw2CYnKsJMMIj KTpwdOX8qP1xvwLYHVJ+q/zecv8wNVk4TiCqiKWt9q8yBA8JqUpTrfg59sfEESHvbqzI 60EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723060469; x=1723665269; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F7EzSifg9g5UstZpOxR5pGveBAvWbwJf3eidWqN+PFY=; b=WNsRTkq9aI8Cn4Indk5LI7Fujo2jM0/uj5Wyxsu8kPaCPLeT3WHBdZbGD2FN2rKI6g zL+uKlKBqi/suLdhb3tcZg3EPqD6fs/LEprzFqV3YW8BWpKyqDqMnoJDwoyTNIaRjYgY 8XLelQdRfP35pwCFGADTDArwMgX7nHSUxTXdLAni9etT0811H3vTCgG6ydmNLxUtkL5x e4bwhY3WjfxiMzlIcFg5+0o4kYr2QRNIIiNdc9Fmevqm5IqhiizRqqhtqBA2gGVzOr5k g2iuYkGF7FHPS+j4OVJW1+Udsh7tAmyOWW2ivgdynacZ4SCaSKsExZLTR0q1hShFmnkB px3Q== X-Forwarded-Encrypted: i=1; AJvYcCW7jhTw0Xu324Nr1QR1/S4BLx4GBTlui6rwgj3Oj52baJOcyyGzkbmy+fbJ00xUwbXY0nhg3fr93FaXaDROfPHYnnq9TQ== X-Gm-Message-State: AOJu0YzezVNjIcmUWHEaXYCz1m+CfaknKbbB7dPLcOZa+LBCousI13o7 awjB+VwYet1klw1Ha3GjFKQRr/Q7m9cGdOoAaBTCuuf7HtLiolXe X-Google-Smtp-Source: AGHT+IHgUX43Gh+Wvr1BFIIzz6Jw1RfKmNvlJBi3nWvD7Kl03OwbPKFI5U7zu/r/CWBgofjTv6MGGg== X-Received: by 2002:a05:600c:4588:b0:428:15b0:c8dd with SMTP id 5b1f17b1804b1-428e6b2f14emr185108825e9.20.1723060469322; Wed, 07 Aug 2024 12:54:29 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429057a8802sm44383765e9.21.2024.08.07.12.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 12:54:28 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Dario Binacchi , Christian Marangi , Miquel Raynal , Heinrich Schuchardt , Arseniy Krasnov , Martin Kurbanov , Dmitry Dunaev , Simon Glass , Marek Vasut , Rasmus Villemoes , Sean Anderson , Shiji Yang , Vasileios Amoiridis , Leo Yu-Chi Liang , Mikhail Kshevetskiy , Michael Polyntsov , Doug Zobel , u-boot@lists.denx.de Subject: [PATCH v2 4/9] common: board_r: rework BOOT LED handling Date: Wed, 7 Aug 2024 21:54:07 +0200 Message-ID: <20240807195413.30456-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807195413.30456-1-ansuelsmth@gmail.com> References: <20240807195413.30456-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Rework BOOT LED handling. There is currently one legacy implementation for BOOT LED from Status Led API. This work on ancient implementation wused by BOOTP by setting the LED to Blink on boot and to turn it OFF when the firmware was correctly received by network. Now that we new LED implementation have support for LED boot, rework this by also set the new BOOT LED to blink and also set it to ON before entering main loop to confirm successful boot. Signed-off-by: Christian Marangi --- common/board_r.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index d4ba245ac69..57957b4e99b 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -462,14 +463,30 @@ static int initr_malloc_bootparams(void) #if defined(CONFIG_LED_STATUS) static int initr_status_led(void) { -#if defined(CONFIG_LED_STATUS_BOOT) - status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_BLINKING); -#else status_led_init(); + + return 0; +} +#endif + +static int initr_boot_led_blink(void) +{ +#ifdef CONFIG_LED_STATUS_BOOT + status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_BLINKING); +#endif +#ifdef CONFIG_LED_BOOT_ENABLE + led_boot_blink(); #endif return 0; } + +static int initr_boot_led_on(void) +{ +#ifdef CONFIG_LED_BOOT_ENABLE + led_boot_on(); #endif + return 0; +} #ifdef CONFIG_CMD_NET static int initr_net(void) @@ -716,6 +733,7 @@ static init_fnc_t init_sequence_r[] = { #if defined(CONFIG_LED_STATUS) initr_status_led, #endif + initr_boot_led_blink, /* PPC has a udelay(20) here dating from 2002. Why? */ #ifdef CONFIG_BOARD_LATE_INIT board_late_init, @@ -738,6 +756,7 @@ static init_fnc_t init_sequence_r[] = { #if defined(CFG_PRAM) initr_mem, #endif + initr_boot_led_on, run_main_loop, }; From patchwork Wed Aug 7 19:54:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1970225 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=SnA9H64r; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WfLWM5TQ7z1yXs for ; Thu, 8 Aug 2024 05:55:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 156B188C25; Wed, 7 Aug 2024 21:54:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SnA9H64r"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3974C88BCC; Wed, 7 Aug 2024 21:54:36 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8D97588D64 for ; Wed, 7 Aug 2024 21:54:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ansuelsmth@gmail.com Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42817bee9e8so1605135e9.3 for ; Wed, 07 Aug 2024 12:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723060472; x=1723665272; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=3vrCt0ijs6fK3vz97R5dEjaLgyd9RHDevZjmK3tYKxg=; b=SnA9H64r/r2xDkwDKPnFDr6vcQfxp0XU0iv379SpJ0oFz5muUlqULhCDN364fYiTl4 dEvp38KwqFpxlMHuJ7m4ovBR7A7qI3kO+PYr7FpTWOamLU6Mq0tjygnUkwS6WY5tI0L6 ELV7p9NuLR0mC96g4Xbwj55amQpgBn5ugxepP8nuJtDJt+ZFj47RSocBtMtOELT/SyNF tOzze6qgz1oYlMsb6QYXIC4QXhan2jqyQeY5/MAbZcVv9xBxi/4bdlFF+J4Vgus0Fs36 GwKpiI0oJWKvFZ22FekENRT0B1TwoIgDGhec44f8FMOiTxjVxg5yHLg36wIm1qLGsKUK 3Apw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723060472; x=1723665272; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3vrCt0ijs6fK3vz97R5dEjaLgyd9RHDevZjmK3tYKxg=; b=VKnbMgwwwnXoxvUlsEe44tjuVanCDJt8LEMhzmPOTXQ9u0sPh9Kwi7HK8OlUs9G3kz 6czyXxGzC6r+7z4pSx/k6duu9IQpDEHsD2alQ8pATuJ/+NARm8c35Db7WiIQCxeS6a6A VRbMIoBpTD47bAiyhKNLSD1423RO3p9mY8xhNtuXbgCsELvUSv1nLzsKm8cFMglx2zUL +URVC48g9HS6ABk7I833pkUtr2XKEk5FgH4j6u0MTiwzGJmKwdp5DovyXJBilL0btPIp zbkcP6H27UdHxYlV1yP68BfGGmgElVzP7g8rQyRy4DeXhDQRx3bAj27+wN+eH3KwKvFW SXZQ== X-Forwarded-Encrypted: i=1; AJvYcCW3x/taDTyy092swGVP2GXpJa5U5qdlxDK1wvDj3WwEepg4yMt0mye1acux2nyK/5Rm9qRjwJh3zMlz2gsjNLU+nLOg7w== X-Gm-Message-State: AOJu0Yyk+iKHJp1DV4U0tMMUKttbM3Ezx56lb5E+U/Z2EDtwG8zFrXXg II3bvMVHkE2SP7TclmU8+qc1/ShORcX54H+LCL5Sub+SzaHGlknl X-Google-Smtp-Source: AGHT+IH0lZcqmaTdcwbeGrGBa4PXeWugTOlYAD3NEEA50PcAzkCcOzvONJCfE8pFdZ8Y3XmF45N3Ug== X-Received: by 2002:a05:600c:1c27:b0:426:62c5:4741 with SMTP id 5b1f17b1804b1-428e6af7a3amr133244155e9.2.1723060471290; Wed, 07 Aug 2024 12:54:31 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429057a8802sm44383765e9.21.2024.08.07.12.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 12:54:30 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Dario Binacchi , Christian Marangi , Miquel Raynal , Heinrich Schuchardt , Arseniy Krasnov , Martin Kurbanov , Dmitry Dunaev , Simon Glass , Marek Vasut , Rasmus Villemoes , Sean Anderson , Shiji Yang , Vasileios Amoiridis , Leo Yu-Chi Liang , Mikhail Kshevetskiy , Michael Polyntsov , Doug Zobel , u-boot@lists.denx.de Subject: [PATCH v2 5/9] led: implement LED activity API Date: Wed, 7 Aug 2024 21:54:08 +0200 Message-ID: <20240807195413.30456-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807195413.30456-1-ansuelsmth@gmail.com> References: <20240807195413.30456-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Implement LED activity API similar to BOOT LED API. Usual activity might be a file transfer with TFTP, a flash write... User of this API will call led_activity_on/off/blink() to signal these kind of activity. New Kconfig are implemented similar to BOOT LED, LED_ACTIVITY_ENABLE to enable support for it, LED_ACTIVITY_LABEL to assign the LED in DT for activity usage and LED_ACTIVITY_PERIOD to set the blinking period. Signed-off-by: Christian Marangi --- drivers/led/Kconfig | 21 +++++++++++++++++++++ include/led.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index fd9442edaf3..1336f943dab 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -29,6 +29,27 @@ config LED_BOOT_PERIOD help LED boot blink period in ms. +config LED_ACTIVITY_ENABLE + bool "Enable LED activity support" + help + Enable LED activity support. + + LED activity is a specific LED assigned to signal activity operation + like file trasnfer, flash write/erase... + +config LED_ACTIVITY_LABEL + string "LED activity label" + depends on LED_ACTIVITY_ENABLE + help + LED label defined in DT to assign for LED activity usage. + +config LED_ACTIVITY_PERIOD + int "LED activity period" + depends on LED_ACTIVITY_ENABLE && (LED_BLINK || LED_SW_BLINK) + default 2 + help + LED activity blink period in ms. + config LED_BCM6328 bool "LED Support for BCM6328" depends on LED && ARCH_BMIPS diff --git a/include/led.h b/include/led.h index 7bbe165d838..61ece70a975 100644 --- a/include/led.h +++ b/include/led.h @@ -203,4 +203,48 @@ static inline int led_boot_blink(void) #endif #endif +#ifdef CONFIG_LED_ACTIVITY_ENABLE + +/** + * led_activity_on() - turn ON the designated LED for activity + * + * Return: 0 if OK, -ve on error + */ +static inline int led_activity_on(void) +{ + return led_set_state_by_label(CONFIG_LED_ACTIVITY_LABEL, LEDST_ON); +} + +/** + * led_activity_off() - turn OFF the designated LED for activity + * + * Return: 0 if OK, -ve on error + */ +static inline int led_activity_off(void) +{ + return led_set_state_by_label(CONFIG_LED_ACTIVITY_LABEL, LEDST_OFF); +} + +#if defined(CONFIG_LED_BLINK) || defined(CONFIG_LED_SW_BLINK) +/** + * led_activity_blink() - turn ON the designated LED for activity + * + * Return: 0 if OK, -ve on error + */ +static inline int led_activity_blink(void) +{ + int ret; + + ret = led_set_period_by_label(CONFIG_LED_ACTIVITY_LABEL, CONFIG_LED_BOOT_PERIOD); + if (ret) + return ret; + + return led_set_state_by_label(CONFIG_LED_ACTIVITY_LABEL, LEDST_BLINK); +} +#else +/* If LED BLINK is not supported/enabled, fallback to LED ON */ +#define led_activity_blink led_activity_on +#endif +#endif + #endif From patchwork Wed Aug 7 19:54:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1970227 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Qdo55iUM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WfLWb0nqLz1yXs for ; Thu, 8 Aug 2024 05:55:39 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 76D4A88D58; Wed, 7 Aug 2024 21:54:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Qdo55iUM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6919F889D4; Wed, 7 Aug 2024 21:54:36 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 54F1D88D73 for ; Wed, 7 Aug 2024 21:54:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ansuelsmth@gmail.com Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4266f3e0df8so1481775e9.2 for ; Wed, 07 Aug 2024 12:54:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723060473; x=1723665273; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=c7wvb87HMZERBTWLcE0Zw9te/52TrDk6pCneIGETCws=; b=Qdo55iUMLY+LW4qRnup0bNKSB/Vi03DTyXZMhx/36W0BG27D9u6F9iXvEcehKnC8Vp FDddhvSi23zfxRzUTQuVYOY9wwLVO0RNdc5zHKu2pcOrjeMCWXwywh8jBur69rsncEeY ylopcshDTlyoNWL2tjN8brVSYeKXhJkn9NYa3m8G5DEWkfUwiDwSX2nl+xiLK92CUdtJ djJ5MhEqiaiDP1fgjLT0ZaQ/nbteaILs6rdZ/gbZOmPvLuY51LAFiyTD7bdBTgguDCv9 6Xy2fc9NSJmwEIeMQC/UaBj/ZQdkbQRSTGtzew2eQicRnFmk/+RLFnhwsS0SVgZ4XeR8 d+qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723060473; x=1723665273; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c7wvb87HMZERBTWLcE0Zw9te/52TrDk6pCneIGETCws=; b=PNLylOkGXFetqtVNIYvh97uXNIoUh6hGJ6LHpQxYboeVYanPZBSRJdR83GX7U5q4mS YapgcEgik6w5LTMXzrpkpMIqgrIZtGgVHc5Mk4NHdIYLsMIQdjoDbiIaSfKttZFZnidZ diIzWM5qsTh3dH4YtmRTniZ2E77bFXJoJCCkZOGJSCZJH2eBLOGW9zwbv9hoVTVLMi83 TLBJfFW82zlT5XZ1GFGZaG0Ztl4gHCNr7rp1+G+WBjU1T0sxPGXqjSxjMovDRmZF/dIW Fo7sNPBb9I+7h6RrcUXY7rkENjmtGLPtW9CSMMaTXSX2fYATzjXtPB/nR4oaBm0QJyQY PIwA== X-Forwarded-Encrypted: i=1; AJvYcCX/lmWJV7/LGN+JVD1Q9jI0GwLKCtAEG17LU8foOaO0n4R5YdEmKd0cTMwJsD0cDQOUHol+ESi+VXUkCxXi/FcARL9dOg== X-Gm-Message-State: AOJu0YyHz37z5hLw9WL5cMlNhUxA6IC5A4swJv49LcBKSaMeO7MHaVJh Na+IQax+yP05Vd9wpXfZ3b0SYTw0YeVVt4NapApTcrFYcvy0ilc1 X-Google-Smtp-Source: AGHT+IFuN32Moz15ghAS3lV/R74VAVxfBWb7iC3I/FMeZTv85L8xs1Dlm+4mg4J70evVQVtB2MDomw== X-Received: by 2002:a05:600c:3d8d:b0:426:6710:223c with SMTP id 5b1f17b1804b1-428e6b03f2cmr134820975e9.9.1723060473137; Wed, 07 Aug 2024 12:54:33 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429057a8802sm44383765e9.21.2024.08.07.12.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 12:54:32 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Dario Binacchi , Christian Marangi , Miquel Raynal , Heinrich Schuchardt , Arseniy Krasnov , Martin Kurbanov , Dmitry Dunaev , Simon Glass , Marek Vasut , Rasmus Villemoes , Sean Anderson , Shiji Yang , Vasileios Amoiridis , Leo Yu-Chi Liang , Mikhail Kshevetskiy , Michael Polyntsov , Doug Zobel , u-boot@lists.denx.de Subject: [PATCH v2 6/9] tftp: implement support for LED activity Date: Wed, 7 Aug 2024 21:54:09 +0200 Message-ID: <20240807195413.30456-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807195413.30456-1-ansuelsmth@gmail.com> References: <20240807195413.30456-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Implement support for LED activity. If the feature is enabled, make the defined ACTIVITY LED to signal traffic. Signed-off-by: Christian Marangi --- net/tftp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/tftp.c b/net/tftp.c index 2e073183d5a..45c2455336a 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -192,6 +193,9 @@ static void new_transfer(void) #ifdef CONFIG_CMD_TFTPPUT tftp_put_final_block_sent = 0; #endif +#ifdef CONFIG_LED_ACTIVITY_ENABLE + led_activity_blink(); +#endif } #ifdef CONFIG_CMD_TFTPPUT @@ -301,6 +305,9 @@ static void tftp_complete(void) time_start * 1000, "/s"); } puts("\ndone\n"); +#ifdef CONFIG_LED_ACTIVITY_ENABLE + led_activity_off(); +#endif if (!tftp_put_active) efi_set_bootdev("Net", "", tftp_filename, map_sysmem(tftp_load_addr, 0), From patchwork Wed Aug 7 19:54:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1970232 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=J883HRlO; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WfLWn3DKkz1yXs for ; Thu, 8 Aug 2024 05:55:49 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D539A88D54; Wed, 7 Aug 2024 21:54:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="J883HRlO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E89F688D74; Wed, 7 Aug 2024 21:54:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8DE1A889D4 for ; Wed, 7 Aug 2024 21:54:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ansuelsmth@gmail.com Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4266dc7591fso1869365e9.0 for ; Wed, 07 Aug 2024 12:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723060475; x=1723665275; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=YDsR5hsQOVbKzYtajp2w9J7akkZ2dMTxwqymOi6BTj4=; b=J883HRlOvkc/WflQVanaTl9UucUz63NH+60dmigl89pn5KK4URlANIwteLQvb7VYwv pzFDf9zBULY8Xt1We5EKV5VI2YuRK/yhV5IF513GfZGsIKWV8idUYqLE9/4lRlTBWB79 6TP+2pJFsa65qD9JLRlReK0ArO5nAGxO+nEOORDWkLx8vyw7H/Da0xZ+GBP474+B3fQL ih2Zq3Lyw9BcO7qPZBAapCXQ/lBaq/MnBPttiHedes+/fvTVzzdbiWYI0wVlQwwSYEJs PURkQQjA8fzy5qvLf+1d7TT9egBizaXwn7z6LzRV1myGt8jFJTG174DLMTqoUpqn/bae lPag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723060475; x=1723665275; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YDsR5hsQOVbKzYtajp2w9J7akkZ2dMTxwqymOi6BTj4=; b=mGXR3es9CKGhf47oRIzmEvi+RqFajqVtEzrT5SthXxERxR3eAkDU9FHhusZMIofB2v vbVdfz0lgGMkq/9YLkAQBLtFcJvWtvQ26tyz6c5xhEmN4i8G426ki86v0hA9T2hfuYz9 qSl03zm/kmq1d6Q+GMBJj1Ck7MQ8oMIwqC7hM1ugrxMmo3VtEg2aXhy+nn0Lsk3DPjCn TbuRSs4E1IqwU6p68aCpqqpKiY8r7vjQlKBC0gKD1mVRk7Uggpe8IQINSQP37JhG//OK /tu8COeLuGQh7zq9zfg4SMl+WRBdKo2C46IpQW7tQSt2H71Qg9WBHxRC+CKOwDEUTxtj BZMQ== X-Forwarded-Encrypted: i=1; AJvYcCUavFUwQ5sik5e46TGLnX1UFkf4y/JAZ2SkefQZOO8NFU6nFBroeJaiNheh9WFcpXvyivLT6HIaSiEZfCkpJT9zBY7+oA== X-Gm-Message-State: AOJu0YzWi6J+0Ghu9B1uHE6s9e/8zUy+XGcGglJIp159qoXZbCcgPrvf fOpmaBSeSW1IpB9QKmoIeboKNGdAMebi5RwCxoULGem4Agc/mS/E X-Google-Smtp-Source: AGHT+IGf5hmqQjKQZ/pr9DDpE/vVfuHBNeRwGpH7Zv6kx2c1sEvi8VorYnEvDqWVQbs2gb9xVXgUtw== X-Received: by 2002:a05:600c:1d10:b0:426:67dd:e9e9 with SMTP id 5b1f17b1804b1-428e6aebc2bmr128412405e9.3.1723060474973; Wed, 07 Aug 2024 12:54:34 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429057a8802sm44383765e9.21.2024.08.07.12.54.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 12:54:34 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Dario Binacchi , Christian Marangi , Miquel Raynal , Heinrich Schuchardt , Arseniy Krasnov , Martin Kurbanov , Dmitry Dunaev , Simon Glass , Marek Vasut , Rasmus Villemoes , Sean Anderson , Shiji Yang , Vasileios Amoiridis , Leo Yu-Chi Liang , Mikhail Kshevetskiy , Michael Polyntsov , Doug Zobel , u-boot@lists.denx.de Subject: [PATCH v2 7/9] mtd: implement support for LED activity Date: Wed, 7 Aug 2024 21:54:10 +0200 Message-ID: <20240807195413.30456-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807195413.30456-1-ansuelsmth@gmail.com> References: <20240807195413.30456-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Implement support for LED activity. If the feature is enabled, make the defined ACTIVITY LED to signal mtd write or erase operations. Signed-off-by: Christian Marangi --- cmd/mtd.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cmd/mtd.c b/cmd/mtd.c index 795aaa2b37d..ba5ee0d4d71 100644 --- a/cmd/mtd.c +++ b/cmd/mtd.c @@ -10,6 +10,7 @@ #include #include +#include #if CONFIG_IS_ENABLED(CMD_MTD_OTP) #include #endif @@ -558,6 +559,11 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc, while (mtd_block_isbad(mtd, off)) off += mtd->erasesize; +#ifdef CONFIG_LED_ACTIVITY_ENABLE + if (!read) + led_activity_blink(); +#endif + /* Loop over the pages to do the actual read/write */ while (remaining) { /* Skip the block if it is bad */ @@ -585,6 +591,11 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc, io_op.oobbuf += io_op.oobretlen; } +#ifdef CONFIG_LED_ACTIVITY_ENABLE + if (!read) + led_activity_off(); +#endif + if (!ret && dump) mtd_dump_device_buf(mtd, start_off, buf, len, woob); @@ -652,6 +663,10 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, erase_op.addr = off; erase_op.len = mtd->erasesize; +#ifdef CONFIG_LED_ACTIVITY_ENABLE + led_activity_blink(); +#endif + while (len) { if (!scrub) { ret = mtd_block_isbad(mtd, erase_op.addr); @@ -680,6 +695,10 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, erase_op.addr += mtd->erasesize; } +#ifdef CONFIG_LED_ACTIVITY_ENABLE + led_activity_off(); +#endif + if (ret && ret != -EIO) ret = CMD_RET_FAILURE; else From patchwork Wed Aug 7 19:54:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1970235 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=OvVPsD6D; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WfLWz3bGGz1yXs for ; Thu, 8 Aug 2024 05:55:59 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 35D8488D87; Wed, 7 Aug 2024 21:54:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OvVPsD6D"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8D5FA88D85; Wed, 7 Aug 2024 21:54:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7333488D54 for ; Wed, 7 Aug 2024 21:54:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ansuelsmth@gmail.com Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2f1870c355cso1849421fa.1 for ; Wed, 07 Aug 2024 12:54:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723060477; x=1723665277; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=FDYXU4/tzHwKGwwfuyp0dk4rPQr8M+VUZCOjilnaZkc=; b=OvVPsD6DeTXnk+ygEuDzJr0aLWo9zxS3CzmEPaO8MnnGM6jMEVjXvj+STSahIVHfbj rlE/eKoPcbJaPvv+T4CkKM+2LVjDXSqKeK4A3Bz1wA8PPGQ2h5OI/f6amKgjVwNqFBJh x+OLAWPegE70kWOGaeevpr0vY40D3beo7kIBsEvDIuVhWf7NxI6og31o1FUdYmyiFevb fL7smCSoXclIeK2T27ZvHfBp3fk6xIax1Kau8CmG8kPORzg80m9UQzj+VMpO7woe4vOY JoEhn0f4roY6xbo3AClhP2ZZiRDTEn71q2d1UwOuAiiUz5HAG1xFhcG1xh9ansYCwLDI 3duQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723060477; x=1723665277; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FDYXU4/tzHwKGwwfuyp0dk4rPQr8M+VUZCOjilnaZkc=; b=iYPhUhX7GwAt8BUhHToX8p0JE1NSdZDCafAOsCGLUYdv73i64gnYVu5vEPsV6eMTAb HSaGRhhtEfhqnlM9tSGthDHNKDu4feFUxlKYcHAyhAoZhLzQYSHREaSC5Svns1R7y4ep QDNycvIHISCkQNdBw9weicKRZyNa1O+Sq4fJQ+3cQh3j2ePUHuydeECqnAKCXhk/x47S FLVJte+fUhfCQoDPxC1ZIi4X0246CRRlk8Cb1jdgtEgD3uSsPIGqmWJNEgoqA6cN4Vrf niKMgJSSTpA0JqJVfpM1fG/hVTBB5oU/JITsKW2TgPDBPWjTddXjiFd3HQcHlPqWJePW /i+g== X-Forwarded-Encrypted: i=1; AJvYcCVDvxjDq6pQG2i6BEiLJtT+uYv7pXVe8eDj7LBGXvME/s0DWXmvlvBN5IGjcbcJXoexhDOEp49yoPehZqowuLDLL28Cig== X-Gm-Message-State: AOJu0YxXlRF8bLqR+n9Cbu8KK6YPfWhOmutjZNm1JRJkEnCkn1HOq/CO sJvFC2KFeFX8riDkTOubHC8m3iYX2edLbMdPg6LnLWlYW42tM76v X-Google-Smtp-Source: AGHT+IFh/gqis7PwSJSrxSN4yGB5Xrt12fQMk6matIcis7jO4paBkmK/OlT9gIqccYdXGBqBKxvyhA== X-Received: by 2002:a2e:9f0b:0:b0:2ef:2e3f:35da with SMTP id 38308e7fff4ca-2f15ab399bamr126846351fa.45.1723060476972; Wed, 07 Aug 2024 12:54:36 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429057a8802sm44383765e9.21.2024.08.07.12.54.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 12:54:36 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Dario Binacchi , Christian Marangi , Miquel Raynal , Heinrich Schuchardt , Arseniy Krasnov , Martin Kurbanov , Dmitry Dunaev , Simon Glass , Marek Vasut , Rasmus Villemoes , Sean Anderson , Shiji Yang , Vasileios Amoiridis , Leo Yu-Chi Liang , Mikhail Kshevetskiy , Michael Polyntsov , Doug Zobel , u-boot@lists.denx.de Subject: [PATCH v2 8/9] ubi: implement support for LED activity Date: Wed, 7 Aug 2024 21:54:11 +0200 Message-ID: <20240807195413.30456-9-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807195413.30456-1-ansuelsmth@gmail.com> References: <20240807195413.30456-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Implement support for LED activity. If the feature is enabled, make the defined ACTIVITY LED to signal ubi write operation. Signed-off-by: Christian Marangi --- cmd/ubi.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cmd/ubi.c b/cmd/ubi.c index 92998af2b02..e663e6dfafb 100644 --- a/cmd/ubi.c +++ b/cmd/ubi.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -425,7 +426,19 @@ int ubi_volume_begin_write(char *volume, void *buf, size_t size, int ubi_volume_write(char *volume, void *buf, size_t size) { - return ubi_volume_begin_write(volume, buf, size, size); + int ret; + +#ifdef CONFIG_LED_ACTIVITY_ENABLE + led_activity_blink(); +#endif + + ret = ubi_volume_begin_write(volume, buf, size, size); + +#ifdef CONFIG_LED_ACTIVITY_ENABLE + led_activity_off(); +#endif + + return ret; } int ubi_volume_read(char *volume, char *buf, size_t size) From patchwork Wed Aug 7 19:54:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1970238 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=h6n6j1D3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WfLXB3DGYz1yXs for ; Thu, 8 Aug 2024 05:56:10 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8803488D8D; Wed, 7 Aug 2024 21:54:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="h6n6j1D3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6FD7488BE0; Wed, 7 Aug 2024 21:54:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 59A7988D74 for ; Wed, 7 Aug 2024 21:54:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ansuelsmth@gmail.com Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4257d5fc9b7so2402355e9.2 for ; Wed, 07 Aug 2024 12:54:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723060479; x=1723665279; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=L3shv0mqVno8ExTRpKcG8NYIykVr1ivHiHnRmpP2dz0=; b=h6n6j1D3p66w/ES9LEmkyuwkV6rTXbqGJjyv8SXqGAH1a3pu1WVQL0TPbWmf7X5R4r JHZMosCvSIwDBBlLBAAfuIjNACMfSaorKttWGTFBeiE2yN/QTBMY1i+ifED7dqK20oV3 021tukVKfUvhUfCRiXOCb+3nQ47/KepkzwdJDvYhDiKVPR9zZOrv3tDqpQBP7Ba2K2Vp ePrvk+pKGI9dnrdfBUOgTQIVeIPluTbbJ7OgAIcqOIuZwcNOlmFabuWUzHt22av35td5 Eoo04s9y0SrtuHiTYuRYxs/3MFn1qVK9MyNHF+Wgr8MYM3PZ/2Xrqm+TbCifI0DfmUuW 5+3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723060479; x=1723665279; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L3shv0mqVno8ExTRpKcG8NYIykVr1ivHiHnRmpP2dz0=; b=JfZAL5cJV25rT8mT/Zq3K4bBftjrnI4fEOxQ9H6wWoAt3gZ7RhlbfxIG7aObZXP7Sz Gg3ZJTJKVA9SE75FwKgJYaH6hBrZd6eptUPkjBpDnAixYoLUNNFwz26adxFReqdX6zHP G10+ijZiquqS3zNVMHr0+6OEo4rCxnFZ0qWAh9ciMufFCxQ0D/RdVM9bhCoQdckWCNM4 3xA9Zv7eyRtP6fcS7ghQv1BfYgAEU2iJYH3Qj9U6OuicHkXUE+HQ+zIzX9k/xLfzUMns Q/nnyVNpXsbD8pFF3+1l7ZxAwEcE1p9A6uODyBaDKFX7hmzUZyrWS+tQJZPa3Za5nBm3 qdcQ== X-Forwarded-Encrypted: i=1; AJvYcCWx3QBj0RaobuwtHNJ/p7tgU5LXR6A9rv0z++8fPkPQGIDdxQy42G+blyZpwos9AOrmgR04vdRWfltT86x2EKUK0+zU8g== X-Gm-Message-State: AOJu0YwwtZ6JTuZ6brd4WKFiCd3JlaIZo+WL5Adzw15YsmNBrIWqhUzT XGqF7KJjOQUIcNG8iozTojnba1LHTCPpqAn9seywpjkBW9KsYVmL X-Google-Smtp-Source: AGHT+IFex5pEo8ENBvuwr7+EI3w/h8XtpsvYi9tke1lBjaiqXaGjArcwVUfucaCsifwaaqeNBZL+VQ== X-Received: by 2002:a05:600c:4588:b0:428:15b0:c8dd with SMTP id 5b1f17b1804b1-428e6b2f14emr185113635e9.20.1723060478903; Wed, 07 Aug 2024 12:54:38 -0700 (PDT) Received: from localhost.localdomain (host-87-6-196-30.retail.telecomitalia.it. [87.6.196.30]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429057a8802sm44383765e9.21.2024.08.07.12.54.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 12:54:38 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Dario Binacchi , Christian Marangi , Miquel Raynal , Heinrich Schuchardt , Arseniy Krasnov , Martin Kurbanov , Dmitry Dunaev , Simon Glass , Marek Vasut , Rasmus Villemoes , Sean Anderson , Shiji Yang , Vasileios Amoiridis , Leo Yu-Chi Liang , Mikhail Kshevetskiy , Michael Polyntsov , Doug Zobel , u-boot@lists.denx.de Subject: [PATCH v2 9/9] doc: introduce led.rst documentation Date: Wed, 7 Aug 2024 21:54:12 +0200 Message-ID: <20240807195413.30456-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240807195413.30456-1-ansuelsmth@gmail.com> References: <20240807195413.30456-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Introduce simple led.rst documentation to document all the additional Kconfig and the current limitation of LED_BLINK and GPIO software blink. Signed-off-by: Christian Marangi --- doc/api/index.rst | 1 + doc/api/led.rst | 10 ++++++++++ include/led.h | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 doc/api/led.rst diff --git a/doc/api/index.rst b/doc/api/index.rst index ec0b8adb2cf..9f7f23f868f 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -14,6 +14,7 @@ U-Boot API documentation event getopt interrupt + led linker_lists lmb logging diff --git a/doc/api/led.rst b/doc/api/led.rst new file mode 100644 index 00000000000..e52e350d1bb --- /dev/null +++ b/doc/api/led.rst @@ -0,0 +1,10 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +LED +=== + +.. kernel-doc:: include/led.h + :doc: Overview + +.. kernel-doc:: include/led.h + :internal: \ No newline at end of file diff --git a/include/led.h b/include/led.h index 61ece70a975..77b18ddffbf 100644 --- a/include/led.h +++ b/include/led.h @@ -10,6 +10,44 @@ #include #include +/** + * DOC: Overview + * + * Generic LED API provided when a supported compatible is defined in DeviceTree. + * + * To enable support for LEDs, enable the `CONFIG_LED` Kconfig option. + * + * The most common implementation is for GPIO-connected LEDs. If using GPIO-connected LEDs, + * enable the `LED_GPIO` Kconfig option. + * + * `LED_BLINK` support requires LED driver support and is therefore optional. If LED blink + * functionality is needed, enable the `LED_BLINK` Kconfig option. If LED driver doesn't + * support HW Blink, SW Blink can be used with the Cyclic framework by enabling the + * CONFIG_LED_SW_BLINK. + * + * Boot and Activity LEDs are also supported. These LEDs can signal various system operations + * during runtime, such as boot initialization, file transfers, and flash write/erase operations. + * + * To enable a Boot LED, enable `CONFIG_LED_BOOT_ENABLE` and define `CONFIG_LED_BOOT_LABEL`. This + * will enable the specified LED to blink and turn ON when the bootloader initializes correctly. + * + * To enable an Activity LED, enable `CONFIG_LED_ACTIVITY_ENABLE` and define + * `CONFIG_LED_ACTIVITY_LABEL`. + * This will enable the specified LED to blink and turn ON during file transfers or flash + * write/erase operations. + * + * Both Boot and Activity LEDs provide a simple API to turn the LED ON or OFF: + * `led_boot_on()`, `led_boot_off()`, `led_activity_on()`, and `led_activity_off()`. + * + * Both configurations can optionally define a `_PERIOD` option if `CONFIG_LED_BLINK` or + * `CONFIG_LED_SW_BLINK` is enabled for LED blink operations, which is usually used by + * the Activity LED. + * + * When `CONFIG_LED_BLINK` or `CONFIG_LED_SW_BLINK` is enabled, additional APIs are exposed: + * `led_boot_blink()` and `led_activity_blink()`. Note that if `CONFIG_LED_BLINK` is disabled, + * these APIs will behave like the `led_boot_on()` and `led_activity_on()` APIs, respectively. + */ + struct udevice; enum led_state_t {