From patchwork Wed Jun 19 23:03:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1949899 X-Patchwork-Delegate: xypron.glpk@gmx.de 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=kOWEeaTc; 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 4W4NJT2S5Zz20X8 for ; Thu, 20 Jun 2024 11:32:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D2106884CA; Thu, 20 Jun 2024 03:31:56 +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="kOWEeaTc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EBF838846D; Thu, 20 Jun 2024 01:04:10 +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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (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 073C38846D for ; Thu, 20 Jun 2024 01:04:09 +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-x336.google.com with SMTP id 5b1f17b1804b1-4217dbeb4caso3107315e9.1 for ; Wed, 19 Jun 2024 16:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718838248; x=1719443048; 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=7KSsr5sd4Y0MY+zz8swijIctuwVPsy5JiwiZ7tE0uMw=; b=kOWEeaTc+kMpWiw70wVnm5EnduQShIcrufK8CJG20Ifu2x2JbSe/3COE/hd6tmFtAr SNxB3HIKv9161m9OSr2pxVtSbBiy6u0mOmq4bs2W3I/SPA12sacewWfXx7hZF5JJeRFn goosVSs68BrIiA5V+rxFvUpHqecB56/b6dzyCl1NkccVWBqGgdUFkhXYiCIlNOGll/fR rrMO93/XTGrw7FcVKqSzLIUE75uVJedzgngkrbp4o0Atbz8l3qtbsdfIDUjKSOpwDELn /3MuHURJMBLrDrDyf+rR1GYDONPiqpCPH+EtbZugQca0aYkSohzEKmlsIuAlWNx72F0o JqGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718838248; x=1719443048; 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=7KSsr5sd4Y0MY+zz8swijIctuwVPsy5JiwiZ7tE0uMw=; b=Y4hGtc8GeDThpefjbBdc7P08VFZKScgPBx0aTair8Oc9+Ug3H5PU7PViHbCEJhZSAx F/G998UDO7fTrGscMbmJmfKJj5JBdaKXLtcMpJcLCSQJocv8trLhR1j/y9dF0sqMbOOL IDInWaHz5JMQhjB5OlW0jLIxwJybPY6fuW9FWzoeFUXAlJrAjoZysjE4wv2CHKMGeyme 2l3qpXz7vN7OJeNj1D+39StRC63ibOeLqPDrLFAhiiykOrZaNW+l0N6H60PwD8YTpCuK 2wH4GuM9Bo20cimrIqIl6G4jtt755oU1Vk8/Q+K3BxoEy2r7PNNg3nu7poIGu50BP9Gm gthw== X-Forwarded-Encrypted: i=1; AJvYcCVF/8cg0EBhg6dkQwIXu4rnyiayJdkyZPV/Mj9GbwB151nPfyPgPA7T2z2TIR+zF2i51iy2ub4wofTHBXdB9ZnsAkPaqQ== X-Gm-Message-State: AOJu0YzPTfULrqvVDwXhUPZWljv93dMIbYXUzZnCsoQ/zfBkAuuKIJmG jQu6MOZcjb33lAzsyFdd+liJxpWzsL5tLxIo5gyxi77kDFWBFj3l X-Google-Smtp-Source: AGHT+IGiE8ntqrdMff90aNnkCT3mQfAg8UL8NV4R6dP/tT9M9VVealMWDJlE5aUIdUx4OKMB0L9oAA== X-Received: by 2002:a05:600c:2106:b0:421:79dc:56e4 with SMTP id 5b1f17b1804b1-424752a25f1mr25776465e9.41.1718838248397; Wed, 19 Jun 2024 16:04:08 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4247d0c54c9sm5410465e9.27.2024.06.19.16.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 16:04:08 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Heinrich Schuchardt , Arseniy Krasnov , Miquel Raynal , Dmitry Dunaev , Simon Glass , Devarsh Thakkar , Bin Meng , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , u-boot@lists.denx.de, John Crispin Subject: [PATCH v4 1/9] misc: gpio_led: fix broken coloured LED status functions Date: Thu, 20 Jun 2024 01:03:19 +0200 Message-ID: <20240619230400.8459-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619230400.8459-1-ansuelsmth@gmail.com> References: <20240619230400.8459-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 20 Jun 2024 03:31:55 +0200 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 The GPIO LED driver is a backend to provide LED status functions via the GPIO common functions. The coloured LED functions are currently broken and deviates from what is written in README.LED Quoting the README.LED: CONFIG_STATUS_LED_RED is the red LED. It is used to signal errors. This must be a valid LED number (0-5). Other similar color LED's macros are CONFIG_STATUS_LED_GREEN, CONFIG_STATUS_LED_YELLOW and CONFIG_STATUS_LED_BLUE. Hence the value of the config must refer to the ID. Currently this is not the case and the driver expect the GPIO ID to be put in these config. On top of this to actually have these functions, a never define in Kconfig config must be declared to actually compile them. (CONFIG_GPIO_LED_STUBS) To fix this and the GPIO problem, introduce some define that reference the LED_STATUS_BIT config to have the ID->BIT connection (as described in Docs) and drop the never defined config. The gpio_led already provide a wrapper to the functions and should not be enabled if the board provide their custom function hence it's ok to also provide the wrapper for the colour functions. Signed-off-by: Christian Marangi --- drivers/misc/gpio_led.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c index e63689967a7..6626b137087 100644 --- a/drivers/misc/gpio_led.c +++ b/drivers/misc/gpio_led.c @@ -51,56 +51,63 @@ void __led_toggle(led_id_t mask) gpio_set_value(mask, !gpio_get_value(mask)); } -#ifdef CONFIG_GPIO_LED_STUBS - /* 'generic' override of colored LED stubs, to use GPIO functions instead */ +/* We support up to 6 LEDs, LED 0 STATUS BIT doesn't have the number suffix */ +#define GPIO_BIT0 CONFIG_LED_STATUS_BIT +#define GPIO_BIT1 CONFIG_LED_STATUS_BIT1 +#define GPIO_BIT2 CONFIG_LED_STATUS_BIT2 +#define GPIO_BIT3 CONFIG_LED_STATUS_BIT3 +#define GPIO_BIT4 CONFIG_LED_STATUS_BIT4 +#define GPIO_BIT5 CONFIG_LED_STATUS_BIT5 +/* C preprocessor magic way to generate a GPIO_LED reference */ +#define GPIO_BIT(id) ___PASTE(GPIO_BIT, id) + #ifdef CONFIG_LED_STATUS_RED + void red_led_on(void) { - __led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_ON); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_RED), CONFIG_LED_STATUS_ON); } void red_led_off(void) { - __led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_OFF); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_RED), CONFIG_LED_STATUS_OFF); } #endif #ifdef CONFIG_LED_STATUS_GREEN void green_led_on(void) { - __led_set(CONFIG_LED_STATUS_GREEN, CONFIG_LED_STATUS_ON); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_GREEN), CONFIG_LED_STATUS_ON); } void green_led_off(void) { - __led_set(CONFIG_LED_STATUS_GREEN, CONFIG_LED_STATUS_OFF); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_GREEN), CONFIG_LED_STATUS_OFF); } #endif #ifdef CONFIG_LED_STATUS_YELLOW void yellow_led_on(void) { - __led_set(CONFIG_LED_STATUS_YELLOW, CONFIG_LED_STATUS_ON); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_YELLOW), CONFIG_LED_STATUS_ON); } void yellow_led_off(void) { - __led_set(CONFIG_LED_STATUS_YELLOW, CONFIG_LED_STATUS_OFF); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_YELLOW), CONFIG_LED_STATUS_OFF); } #endif #ifdef CONFIG_LED_STATUS_BLUE void blue_led_on(void) { - __led_set(CONFIG_LED_STATUS_BLUE, CONFIG_LED_STATUS_ON); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_BLUE), CONFIG_LED_STATUS_ON); } void blue_led_off(void) { - __led_set(CONFIG_LED_STATUS_BLUE, CONFIG_LED_STATUS_OFF); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_BLUE), CONFIG_LED_STATUS_OFF); } #endif - -#endif /* CONFIG_GPIO_LED_STUBS */ From patchwork Wed Jun 19 23:03:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1949900 X-Patchwork-Delegate: xypron.glpk@gmx.de 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=P0UuvCno; 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 4W4NJg0l8xz20X8 for ; Thu, 20 Jun 2024 11:32:19 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5214C884DB; Thu, 20 Jun 2024 03:31:57 +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="P0UuvCno"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E45668840C; Thu, 20 Jun 2024 01:04:12 +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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) (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 E0D5888427 for ; Thu, 20 Jun 2024 01:04:10 +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-lf1-x130.google.com with SMTP id 2adb3069b0e04-52c85a7f834so365792e87.0 for ; Wed, 19 Jun 2024 16:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718838250; x=1719443050; 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=Ixx02Xe74NaBl6w9rxIlJyhksnvnH4eo2kFSeBHCLmE=; b=P0UuvCnosSnYHpHPsZLyW9/wgXrvHyhEqFTAc98ZrC0rh8dDqVebn2vkEJohlGI508 39hUxWgvk22CI6B/IVrBObGVpd1I084x/LlFgoLcOZvBReC+LbAmMznJghk3k97FZnqI ZiupS+Sx/qrNq41ngRlF9kSE9N6G63NTT8T9CXN8PmAFJnFpsIW2r1hrQ8w8JwIHuf14 igg+PqdjvrGoIkGiyCRqkgaC9u8bxgde/MvXsY8ts6cPZJWMjE3rnRhgCJ9t7qBGCesr ouA9ghb3zKpHOo2Ja3PuV6pR80EBeP1r63ax6Bu/NTIdOyPsznaSaM7nUpcXt1WWCVY1 Lvhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718838250; x=1719443050; 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=Ixx02Xe74NaBl6w9rxIlJyhksnvnH4eo2kFSeBHCLmE=; b=VbKLSn31Itf4XU+PAwEE/cvcn40TTc6zYyJQroo7QnYyLAGWNHr1LRE1dUZi4+4qnp Dzk4lJWhw41R5Lx7ilhVPvjii/8Z9lDfHdA8NXpn7NJSfm7DzMwjiOOZNIqTC+o69vU/ 5Uqab2Kvf7FJQrdXmRgB6HjrWshe0pzVKi1od/T/vssdJpB3w4PhBULkzX0oFGSbTfLg juWYb/ozdrLVBYb/Utcenr+FV4BvzGBMNlwrjCW616NtC6rFl7xOqw1h5n8csEvAyk1m qPNCzU2RXgy5jmClvnfQU047CUoiZLD0f0bdg5EgNylYARFOnqnc8zLXwIX8D1MjQPE5 QWVg== X-Forwarded-Encrypted: i=1; AJvYcCVjfgRzxFfu6NJ4SksRIuhgorX+VILel06g/fJc0TeGCT5sthzXkCfgDeIwMrbvTRAm1YBq0TYzOMzRp0iHCf9+k6wisg== X-Gm-Message-State: AOJu0YzTsynQMgmEABh8mPzwIPOEwVhw+KH4NobZ6dsVLwrQonFsoiiA R0dWg5Hlw2OjYZIrBK1VN1x5jcTFATNScsoxSX1G04WTdFMn0UDu X-Google-Smtp-Source: AGHT+IEbJTrpI7c2bFelzB6QTHezRAE0+BlbZv0mbQziTh3EkjslrlQLDbHVBaWRB8iCMA54hQXfqA== X-Received: by 2002:a05:6512:138c:b0:51e:11d5:bca5 with SMTP id 2adb3069b0e04-52ccaa974c1mr2343182e87.54.1718838249725; Wed, 19 Jun 2024 16:04:09 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4247d0c54c9sm5410465e9.27.2024.06.19.16.04.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 16:04:09 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Heinrich Schuchardt , Arseniy Krasnov , Miquel Raynal , Dmitry Dunaev , Simon Glass , Devarsh Thakkar , Bin Meng , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , u-boot@lists.denx.de, John Crispin Subject: [PATCH v4 2/9] led: status_led: add support for white LED colour Date: Thu, 20 Jun 2024 01:03:20 +0200 Message-ID: <20240619230400.8459-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619230400.8459-1-ansuelsmth@gmail.com> References: <20240619230400.8459-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 20 Jun 2024 03:31:55 +0200 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 Add support for white LED colour present on many devices. Signed-off-by: Christian Marangi --- cmd/legacy_led.c | 6 ++++++ common/board_f.c | 2 ++ drivers/led/Kconfig | 14 ++++++++++++++ drivers/misc/gpio_led.c | 12 ++++++++++++ include/status_led.h | 4 ++++ 5 files changed, 38 insertions(+) diff --git a/cmd/legacy_led.c b/cmd/legacy_led.c index 50de7e89d8f..18f0c3472c4 100644 --- a/cmd/legacy_led.c +++ b/cmd/legacy_led.c @@ -56,6 +56,9 @@ static const led_tbl_t led_commands[] = { #endif #ifdef CONFIG_LED_STATUS_BLUE { "blue", CONFIG_LED_STATUS_BLUE, blue_led_off, blue_led_on, NULL }, +#endif +#ifdef CONFIG_LED_STATUS_WHITE + { "white", CONFIG_LED_STATUS_WHITE, white_led_off, white_led_on, NULL }, #endif { NULL, 0, NULL, NULL, NULL } }; @@ -179,6 +182,9 @@ U_BOOT_CMD( #endif #ifdef CONFIG_LED_STATUS_BLUE "blue|" +#endif +#ifdef CONFIG_LED_STATUS_WHITE + "white|" #endif "all] [on|off|toggle|blink] [blink-freq in ms]", "[led_name] [on|off|toggle|blink] sets or clears led(s)" diff --git a/common/board_f.c b/common/board_f.c index 212ffb3090b..af79ed9c776 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -72,6 +72,8 @@ __weak void yellow_led_on(void) {} __weak void yellow_led_off(void) {} __weak void blue_led_on(void) {} __weak void blue_led_off(void) {} +__weak void white_led_on(void) {} +__weak void white_led_off(void) {} /* * Why is gd allocated a register? Prior to reloc it might be better to diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index 9837960198d..6c4f02d71f2 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -415,6 +415,20 @@ config LED_STATUS_GREEN endif # LED_STATUS_GREEN_ENABLE +config LED_STATUS_WHITE_ENABLE + bool "Enable white LED" + help + Enable white status LED. + +if LED_STATUS_WHITE_ENABLE + +config LED_STATUS_WHITE + int "White LED identification" + help + Valid enabled LED device number (0-5). + +endif # LED_STATUS_WHITE_ENABLE + config LED_STATUS_CMD bool "Enable status LED commands" diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c index 6626b137087..dfc9b009570 100644 --- a/drivers/misc/gpio_led.c +++ b/drivers/misc/gpio_led.c @@ -111,3 +111,15 @@ void blue_led_off(void) __led_set(GPIO_BIT(CONFIG_LED_STATUS_BLUE), CONFIG_LED_STATUS_OFF); } #endif + +#ifdef CONFIG_LED_STATUS_WHITE +void white_led_on(void) +{ + __led_set(GPIO_BIT(CONFIG_LED_STATUS_WHITE), CONFIG_LED_STATUS_ON); +} + +void white_led_off(void) +{ + __led_set(GPIO_BIT(CONFIG_LED_STATUS_WHITE), CONFIG_LED_STATUS_OFF); +} +#endif diff --git a/include/status_led.h b/include/status_led.h index 6707ab1d29d..5ce4522b029 100644 --- a/include/status_led.h +++ b/include/status_led.h @@ -87,6 +87,8 @@ void yellow_led_on(void); void yellow_led_off(void); void blue_led_on(void); void blue_led_off(void); +void white_led_on(void); +void white_led_off(void); #else .extern LED_init .extern red_led_on @@ -97,6 +99,8 @@ void blue_led_off(void); .extern green_led_off .extern blue_led_on .extern blue_led_off + .extern white_led_on + .extern white_led_off #endif #endif /* _STATUS_LED_H_ */ From patchwork Wed Jun 19 23:03:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1949901 X-Patchwork-Delegate: xypron.glpk@gmx.de 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=faFbuv2V; 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 4W4NJs0lvsz20X8 for ; Thu, 20 Jun 2024 11:32:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BE459884F1; Thu, 20 Jun 2024 03:31:57 +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="faFbuv2V"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8B4B8884B8; Thu, 20 Jun 2024 01:04:13 +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,T_SCC_BODY_TEXT_LINE 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 9CA518846D for ; Thu, 20 Jun 2024 01:04:11 +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-4217990f8baso3461565e9.2 for ; Wed, 19 Jun 2024 16:04:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718838251; x=1719443051; 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=dL7hFHFmLjFbpbq57GZZpdbS1HS+ABxAkllXt+gP4F8=; b=faFbuv2Vgde2+O8jd0i5MPtn9Mg4xI+xCgraC08x9S1J72yNbBunW9bY9VB4/TPojY SIk+hYmZrQoeuN5fY1tsSTGr46HIFHJfa2RGNRcXazI5AxiAkWGJ9VQBescdGOQuSUUb 0Hk5V9FV7GDUjX6wT9k9U00gjXLHeYh/qCIY0S28j4L1nCN+qqiXmzs5RTpQpmi4mjeP 9WdKnCi3GZfdLgSQXVdyAAU0yQ12vQcH7zSX1d3JNWeCsHNefIG1i2HB3nu4xw1egfAk ELqh9y+w7oIYDPe0l9ob9kQhBbxqjU0MDO53j5TV4Kr84RSoaNE+Ye9/WglASRfsaHhZ yYrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718838251; x=1719443051; 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=dL7hFHFmLjFbpbq57GZZpdbS1HS+ABxAkllXt+gP4F8=; b=NxjoFNl6xpuma6F+5EwdB7DXSxJhGhG6Pxfr9IcPxBWtbuT4nztLSrybJvQ+EG7UZN qNCLYviv1mhriIdrR37ETGzS2fXNkpOsTdrZHBCh86HMmov7HXt8TLDVGSk/ttoSXveN pEL1gXBmChYVYrOFzqbqTGS+hi3Y+ojlvz5LdwpkdZiO9rRkBbhKBB3AdN1xymNctSq3 C2NWiq7IyBKrrDeuI6vdgV4OtbW/54kP+B2cmZLV1E2DXrC7LYAjg/b1M6T7EBcJNBZc OBF4xwxXIMMvhbZCUbh/FHEwXPrBMlEnKQC4k9KSIuRA4Z6E6hDcekUi0O4581F936T0 QneQ== X-Forwarded-Encrypted: i=1; AJvYcCUsu8dhfRRAh6CJhb5oIRxatAUD1ysDuRMNbk++GCAoNNl5k3HQPeJW5n9RuI8eIsmLRyrT1vH2buARquZQTFL+wfMndg== X-Gm-Message-State: AOJu0Yws/kQ2NJO8JXF7dOA7DLPYcsyJo2RjQ2E/VViLC3jmRfxSc5xc rIBrlC6EkNZ2X7kWeDWf+yu5OSft3x9s3NfaW2UNVmrr3AKNdvKa X-Google-Smtp-Source: AGHT+IHeRtvCq5fwE5x9wHLjxjiRyJmWq+wRYnFK4plyTrHhfiR5ptqEpq//yvrpRlbWN1PF9AFtdg== X-Received: by 2002:a05:600c:1d08:b0:422:4fcd:d4b3 with SMTP id 5b1f17b1804b1-4247529f03cmr24800325e9.37.1718838251053; Wed, 19 Jun 2024 16:04:11 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4247d0c54c9sm5410465e9.27.2024.06.19.16.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 16:04:10 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Heinrich Schuchardt , Arseniy Krasnov , Miquel Raynal , Dmitry Dunaev , Simon Glass , Devarsh Thakkar , Bin Meng , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , u-boot@lists.denx.de, John Crispin Subject: [PATCH v4 3/9] led: status_led: add function to toggle a status LED Date: Thu, 20 Jun 2024 01:03:21 +0200 Message-ID: <20240619230400.8459-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619230400.8459-1-ansuelsmth@gmail.com> References: <20240619230400.8459-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 20 Jun 2024 03:31:55 +0200 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 Add function to toggle a status LED by using the status LED ID reference configs. Signed-off-by: Christian Marangi --- drivers/misc/status_led.c | 28 +++++++++++++++++++++++----- include/status_led.h | 1 + 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/misc/status_led.c b/drivers/misc/status_led.c index 3b1baa4f840..2b904bfa9c2 100644 --- a/drivers/misc/status_led.c +++ b/drivers/misc/status_led.c @@ -103,17 +103,24 @@ void status_led_tick(ulong timestamp) } } -void status_led_set(int led, int state) +static led_dev_t *status_get_led_dev(int led) { - led_dev_t *ld; - if (led < 0 || led >= MAX_LED_DEV) - return; + return NULL; if (!status_led_init_done) status_led_init(); - ld = &led_dev[led]; + return &led_dev[led]; +} + +void status_led_set(int led, int state) +{ + led_dev_t *ld; + + ld = status_get_led_dev(led); + if (!ld) + return; ld->state = state; if (state == CONFIG_LED_STATUS_BLINKING) { @@ -122,3 +129,14 @@ void status_led_set(int led, int state) } __led_set (ld->mask, state); } + +void status_led_toggle(int led) +{ + led_dev_t *ld; + + ld = status_get_led_dev(led); + if (!ld) + return; + + __led_toggle(ld->mask); +} diff --git a/include/status_led.h b/include/status_led.h index 5ce4522b029..fe0c84fb4b4 100644 --- a/include/status_led.h +++ b/include/status_led.h @@ -38,6 +38,7 @@ void status_led_init(void); void status_led_tick(unsigned long timestamp); void status_led_set(int led, int state); +void status_led_toggle(int led); /***** MVS v1 **********************************************************/ #if (defined(CONFIG_MVS) && CONFIG_MVS < 2) From patchwork Wed Jun 19 23:03:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1949902 X-Patchwork-Delegate: xypron.glpk@gmx.de 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=gr6w51V0; 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 4W4NK32vwLz20X8 for ; Thu, 20 Jun 2024 11:32:39 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 467F7884FA; Thu, 20 Jun 2024 03:32:03 +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="gr6w51V0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 20F37884BA; Thu, 20 Jun 2024 01:04:15 +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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) (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 357AA8840C for ; Thu, 20 Jun 2024 01:04:13 +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-lf1-x12a.google.com with SMTP id 2adb3069b0e04-52bc274f438so406152e87.0 for ; Wed, 19 Jun 2024 16:04:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718838252; x=1719443052; 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=VpwCJAzbR9t2YTMLu+cq7xEgWJdpWYheYWlqF08EMJk=; b=gr6w51V0jD3IwmA1EXmVFhEK4xP8qiLSauWNJR+oQu3Oz9ElQC47DdGHDRS19cbxdO kJq5vR6OUMVCv7AjTxAOV0fyySWgwdFYLmrvKzBQEMNEJ7cy6owePHTl/hoP3cLF1p1P ImkTYxLvRcAb+iGivgpFng2XmNsj3shXtME4Iat61TI3u5fNTTZIYfF+3PLYDqklSbvO pHuIg9VxQuEJD8d4odt+076hFxtQ765kN9GCm2WIpBmSqf7gf7/jjoJRNt6tmp2N//nl WGMRcii5R7DS7e/UvroQkH1NC7nFaMncdqh1H63UZnYd/FViqsiKkhrLkIT1fuih6ZQ8 B9BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718838252; x=1719443052; 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=VpwCJAzbR9t2YTMLu+cq7xEgWJdpWYheYWlqF08EMJk=; b=dCBuhwBnIW90nwWiO5rsXStlbtfz3GkecUUMphyRNGvi4sJnu1ixoQduT5ByaSuiY2 uxR12k3pj5M6lckydoJAxVHnPKA65umq8Feo5dl1qPtyKw7D5meoaa21dL3xmUjNE+Yy HN8J1b4wug7MGJnHifkujz0kh9T75IbR//QeK7c9WfCrCZRYEhhRNC/5ju6OyadJsii5 PoiAlgXtl2rPKFQhe9h/KuQD0fnLJzj720eKWtaDKlbrcA8D22lnSvCZ4H1Y1R/XURuR ao7OLmxa9c5lW4y3Cr33BGuerneXxU5FvlLxd0Ky7TNzhpiltrFIHGStVmXhKEiHLz6Y 11Cg== X-Forwarded-Encrypted: i=1; AJvYcCWbPeFSLrUlZrfuSqJDxEo2hBCI45KjsU4Xoud0E+7VOukkdo+tyb2alv82VCPTSaQ8gSCIFG0ksf3aZwmmY4esIGnQZg== X-Gm-Message-State: AOJu0YznhKbaVOwyNc2y1XtW7x7S5fzJRvkjT2m7/STa82lVK1p9UoZl KU7OOxfCN/1bRVtVdlOcIzkC9dQh9ahbFJee4OuLII7IUW8wZsrK X-Google-Smtp-Source: AGHT+IFKypCAsNim0a5VmqYsm00zV1EsIHw3U/N6cdvXrzeKPJiAyQG9yxDCJ8aHNc+KIBrYdGzVzA== X-Received: by 2002:a05:6512:32c6:b0:52c:cd0b:f0a9 with SMTP id 2adb3069b0e04-52ccd0bf137mr2337909e87.58.1718838252275; Wed, 19 Jun 2024 16:04:12 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4247d0c54c9sm5410465e9.27.2024.06.19.16.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 16:04:11 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Heinrich Schuchardt , Arseniy Krasnov , Miquel Raynal , Dmitry Dunaev , Simon Glass , Devarsh Thakkar , Bin Meng , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , u-boot@lists.denx.de, John Crispin Subject: [PATCH v4 4/9] led: status_led: add warning when an invalid Status LED ID is used Date: Thu, 20 Jun 2024 01:03:22 +0200 Message-ID: <20240619230400.8459-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619230400.8459-1-ansuelsmth@gmail.com> References: <20240619230400.8459-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 20 Jun 2024 03:31:55 +0200 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 Add a warning when an invalid Status LED ID is used to make the user aware of bad configurations. Signed-off-by: Christian Marangi --- drivers/misc/status_led.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/misc/status_led.c b/drivers/misc/status_led.c index 2b904bfa9c2..7912b4a9448 100644 --- a/drivers/misc/status_led.c +++ b/drivers/misc/status_led.c @@ -105,8 +105,10 @@ void status_led_tick(ulong timestamp) static led_dev_t *status_get_led_dev(int led) { - if (led < 0 || led >= MAX_LED_DEV) + if (led < 0 || led >= MAX_LED_DEV) { + printf("Invalid Status LED ID %d.", led); return NULL; + } if (!status_led_init_done) status_led_init(); From patchwork Wed Jun 19 23:03:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1949903 X-Patchwork-Delegate: xypron.glpk@gmx.de 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=lyazKzf3; 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 4W4NKF6wgHz20X8 for ; Thu, 20 Jun 2024 11:32:49 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C8F778850B; Thu, 20 Jun 2024 03:32:03 +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="lyazKzf3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 632DF884BF; Thu, 20 Jun 2024 01:04:16 +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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 6A8A38846D for ; Thu, 20 Jun 2024 01:04:14 +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-wr1-x42c.google.com with SMTP id ffacd0b85a97d-36087277246so157963f8f.3 for ; Wed, 19 Jun 2024 16:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718838254; x=1719443054; 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=1W/OECgpXMCODNpR1v+dyEbiBLXkvDzchERvizWB0Hs=; b=lyazKzf3gYLPT+Jv4pfzKsJ85/46M/W46ujprcrNnLDixEABq1N1oDEPPPncoUjeHD UQlI4UtkyUXfLnVZaj9w3t+M4bEP/SN9HT53CiigK97ygbVL8bZAv6W3tAzvDLy8p2sI Km2rcS9GnYkyUuEaVo38IcbZlkzUh2lYjblTvoQJaSBH836WLOQH33ATnJKe1lVIOjza FSOcA8aOVM6oWaRmexYFmbOMPI2YmXdr7sVJIheCv6SH2cfiOhMZaQBGBJ/K0/0phjQ0 RLpFB0AXhnFmKeD+uGTNCYT+umYrf87j/khDSm8vzIGw54K2o+A9KW/xV9rt98LNmEVD bdVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718838254; x=1719443054; 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=1W/OECgpXMCODNpR1v+dyEbiBLXkvDzchERvizWB0Hs=; b=VL+HJ2BQYSNkpD5GTty08M2oSWnlq9AvaKpz3M0EVlEkWsxEwIqYfu3FK4kJ4oH9GY 12LH1Zi/kYapVlpa+li2nrpkyXkMYEKZ86pFzFjuilZkQaAQYFtg6drdMzlJt7J5CoZj tLEvS+ZKnIh/ppUzPI9BCKUpO1rqNYMEp8VX9LTlR0FsGR2BdCtPINwpTlBoQmCmigxH 5L703ZcaNYwmx00uwmt9cPEIYAPbBXRDqKJ6xlLidMH8WZz2D35hwBe0AT9cdRiQ3pLM GuKozrdMjBhvi8fWVO7Djx330pNsBEfFcRFSViXfbyXsN34DiGYeh5I4xOrxs1e6ysXn JMCg== X-Forwarded-Encrypted: i=1; AJvYcCX2TV0SfF7/nv9rjlCehqMDAHTah3ngQVNcBJsoBblkx48t9fvt1yqi6yPkqCOf8Hsg59zf/L9j8JX1hKeUhEin9IAVNQ== X-Gm-Message-State: AOJu0YzflLRkvUJvh9N0Jr2CAF3wrlEtw4ZgfTaCgR2Hr1kRhPuT7AV6 2ffQSEReyaL6T8aRs3wSjE1daR0jp//E6Cg3fr0DLMIOwHIH9bdL X-Google-Smtp-Source: AGHT+IE/G3bHkZiIPCUAWwCgM73gZdHkdpBx3eQK9yv/nIMngHnXqDv5MiNT8RgCUMOn+TE7+dIang== X-Received: by 2002:a05:6000:1bc1:b0:360:9bf5:1eab with SMTP id ffacd0b85a97d-36317c79ff7mr2609617f8f.36.1718838253607; Wed, 19 Jun 2024 16:04:13 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4247d0c54c9sm5410465e9.27.2024.06.19.16.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 16:04:13 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Heinrich Schuchardt , Arseniy Krasnov , Miquel Raynal , Dmitry Dunaev , Simon Glass , Devarsh Thakkar , Bin Meng , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , u-boot@lists.denx.de, John Crispin Subject: [PATCH v4 5/9] led: status_led: add new activity LED config and functions Date: Thu, 20 Jun 2024 01:03:23 +0200 Message-ID: <20240619230400.8459-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619230400.8459-1-ansuelsmth@gmail.com> References: <20240619230400.8459-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 20 Jun 2024 03:31:55 +0200 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 Add a new activity LED config and additional functions to implement a simple software blink feature to signal activity of any kind. Usual activity might be a file transfer with TFTP, a flash write... User of this API will call status_led_activity_start/stop() on each activity and LED will be toggled based on the defined FREQ config value. With this enabled, cyclic API are also enabled as this makes use of cyclic API to handle LED blink. Signed-off-by: Christian Marangi --- drivers/led/Kconfig | 16 +++++++++++++++ drivers/misc/status_led.c | 43 +++++++++++++++++++++++++++++++++++++++ include/status_led.h | 2 ++ 3 files changed, 61 insertions(+) diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index 6c4f02d71f2..869ed78e87f 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -359,6 +359,22 @@ config LED_STATUS_BOOT endif # LED_STATUS_BOOT_ENABLE +config LED_STATUS_ACTIVITY_ENABLE + bool "Enable BOOT LED" + select CYCLIC + help + Enable to turn an LED on when the board is doing some + activity (flash write, file download). + +if LED_STATUS_ACTIVITY_ENABLE + +config LED_STATUS_ACTIVITY + int "LED to light when the board is doing some activity" + help + Valid enabled LED device number. + +endif # LED_STATUS_ACTIVITY_ENABLE + config LED_STATUS_RED_ENABLE bool "Enable red LED" help diff --git a/drivers/misc/status_led.c b/drivers/misc/status_led.c index 7912b4a9448..019096562ca 100644 --- a/drivers/misc/status_led.c +++ b/drivers/misc/status_led.c @@ -4,7 +4,10 @@ * Wolfgang Denk, DENX Software Engineering, wd@denx.de. */ +#include #include +#include +#include #include /* @@ -23,6 +26,7 @@ typedef struct { int state; int period; int cnt; + struct cyclic_info cyclic; } led_dev_t; led_dev_t led_dev[] = { @@ -142,3 +146,42 @@ void status_led_toggle(int led) __led_toggle(ld->mask); } + +static void status_led_activity_toggle(struct cyclic_info *ctx) +{ + led_dev_t *ld = container_of(ctx, led_dev_t, cyclic); + __led_toggle(ld->mask); +} + +void status_led_activity_start(int led) +{ + led_dev_t *ld; + + ld = status_get_led_dev(led); + if (!ld) + return; + + /* Use status LED state to track if cyclic is already register */ + if (ld->state == CONFIG_LED_STATUS_BLINKING) { + printf("Cyclic for activity status LED %d already registered. THIS IS AN ERROR.\n", + led); + cyclic_unregister(&ld->cyclic); + } + + status_led_set(led, CONFIG_LED_STATUS_BLINKING); + + cyclic_register(&ld->cyclic, status_led_activity_toggle, + ld->period * 500, "activity"); +} + +void status_led_activity_stop(int led) +{ + led_dev_t *ld; + + ld = status_get_led_dev(led); + if (!ld) + return; + + cyclic_unregister(&ld->cyclic); + status_led_set(led, CONFIG_LED_STATUS_OFF); +} diff --git a/include/status_led.h b/include/status_led.h index fe0c84fb4b4..7de40551621 100644 --- a/include/status_led.h +++ b/include/status_led.h @@ -39,6 +39,8 @@ void status_led_init(void); void status_led_tick(unsigned long timestamp); void status_led_set(int led, int state); void status_led_toggle(int led); +void status_led_activity_start(int led); +void status_led_activity_stop(int led); /***** MVS v1 **********************************************************/ #if (defined(CONFIG_MVS) && CONFIG_MVS < 2) From patchwork Wed Jun 19 23:03:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1949904 X-Patchwork-Delegate: xypron.glpk@gmx.de 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=XQaRGxQl; 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 4W4NKS1JZ1z20X8 for ; Thu, 20 Jun 2024 11:33:00 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 386F48851D; Thu, 20 Jun 2024 03:32:04 +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="XQaRGxQl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5B609884B8; Thu, 20 Jun 2024 01:04:17 +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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (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 7581B884A9 for ; Thu, 20 Jun 2024 01:04:15 +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-wr1-x42a.google.com with SMTP id ffacd0b85a97d-35f27eed98aso247387f8f.2 for ; Wed, 19 Jun 2024 16:04:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718838255; x=1719443055; 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=b5LjNK/esDZdRRTnt9TAHNjYJvl21hCRveZYGfKaL6o=; b=XQaRGxQlKanyPv90HDpWQ4ePK+pdmTQe18CAdslvLqeMzkcn1IUpG5MYcB4sXDx/Oo N11/WJwRvBiU5PyHQXn1CdPiVdBlnJCbRYsWZv3HtH2BEuKyqPwrz0U4TnfZQ+bSsm5c 0lAJEDLV4TREitznI4IduvE6yRIwRbcCY4WwCkExRLC8Sz8GyQdSUCDOvMJLptR23Y8J NszhnvUDl8J+Es3vFHQbfrKEL0TzOTQeURrVboYPftxfFoVlsactl1JUMh3UUxbMr6yA uM0HQIkz09NVT8BWrtCcdHrSjdL2OFaQDiCSVbo72iYx8YKhS4u5L4aLl9qBazQAwG1x 6Yrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718838255; x=1719443055; 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=b5LjNK/esDZdRRTnt9TAHNjYJvl21hCRveZYGfKaL6o=; b=UCOrnnmG78gXOdHdrdmW2SxgCD8AqdmQtYqaszVRyNXNcbGAnatzBzXWNgm/dEO1YQ Tp769NXNFIcDf5rtzSrfu/7q4BBF2vnyZ2W+32DQT1QUe+tPb0QXt9ikdt74KITbA8Gy MwoEQRn4Syo+EQvwd2XeuUEFz9c9vAIcc40KTgTaITRQnp4qV0psSNlLMd3FpPa1BBSi SopAaOHGj++aEyfSdkshd2/L/pJaUHz+KeZPxqlzx5tJBNUHr7O7uEzxfEkpyjGzRtzb rj/NOr5DUo3ntvzHPoAcH8MrcSVPTzS/3Ov4cRJ3KidcHjXJvdGzdCVe9Ue879QEkjhf hyRw== X-Forwarded-Encrypted: i=1; AJvYcCVz9sLW+CCnC0CCghx4UpXlHNrRXkoHbynFKbE3u+VcgiJumT3FffIJ6xBU989T9WrQ6XIqHtbizbSbC2NNrpvFFZ6nFQ== X-Gm-Message-State: AOJu0YyzQ+CSAG8jMELK55qiFHhzkgszKVg7RXMk2S2AlepKmz+90YeR fmO2Cj4JyvkSrWTEjNsMZOSANZA6vCjd7adbgqlicQ/BkSDEIs1Q X-Google-Smtp-Source: AGHT+IEofKAiUOlXMjQKfDy2YsduyOyna+k37GKQAQhNRP61ygQBT2OVrUrY4Lu7ZHSLBUT9klLUxw== X-Received: by 2002:adf:fd08:0:b0:362:4d2a:7bea with SMTP id ffacd0b85a97d-3631998f66fmr2701042f8f.62.1718838254852; Wed, 19 Jun 2024 16:04:14 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4247d0c54c9sm5410465e9.27.2024.06.19.16.04.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 16:04:14 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Heinrich Schuchardt , Arseniy Krasnov , Miquel Raynal , Dmitry Dunaev , Simon Glass , Devarsh Thakkar , Bin Meng , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , u-boot@lists.denx.de, John Crispin Subject: [PATCH v4 6/9] tftp: implement support for LED status activity Date: Thu, 20 Jun 2024 01:03:24 +0200 Message-ID: <20240619230400.8459-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619230400.8459-1-ansuelsmth@gmail.com> References: <20240619230400.8459-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 20 Jun 2024 03:31:55 +0200 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 status 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 6b16bdcbe4c..bcc31face7a 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -18,6 +18,7 @@ #include #include #include "bootp.h" +#include DECLARE_GLOBAL_DATA_PTR; @@ -192,6 +193,9 @@ static void new_transfer(void) #ifdef CONFIG_CMD_TFTPPUT tftp_put_final_block_sent = 0; #endif +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_activity_start(CONFIG_LED_STATUS_ACTIVITY); +#endif } #ifdef CONFIG_CMD_TFTPPUT @@ -301,6 +305,9 @@ static void tftp_complete(void) time_start * 1000, "/s"); } puts("\ndone\n"); +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_activity_stop(CONFIG_LED_STATUS_ACTIVITY); +#endif if (!tftp_put_active) efi_set_bootdev("Net", "", tftp_filename, map_sysmem(tftp_load_addr, 0), From patchwork Wed Jun 19 23:03:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1949905 X-Patchwork-Delegate: xypron.glpk@gmx.de 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=Sou5CR6k; 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 4W4NKf367xz20X8 for ; Thu, 20 Jun 2024 11:33:10 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9CA9588524; Thu, 20 Jun 2024 03:32:04 +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="Sou5CR6k"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 81DB4884C5; Thu, 20 Jun 2024 01:04:18 +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,T_SCC_BODY_TEXT_LINE 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 A28EB8846D for ; Thu, 20 Jun 2024 01:04:16 +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-421d32fda86so4308805e9.0 for ; Wed, 19 Jun 2024 16:04:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718838256; x=1719443056; 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=FTNzwr9dxOJ4zY9jqHAKJxe1vUMNFnqS5tp4Lk+OX0s=; b=Sou5CR6kOPWZZp8d7aoE0xw83C8IflsAtYDi6agezBv5n/ez2blNNo5wjM0PRqAfs5 nEA3d56OYAwUIFH0X4R5NyUIfQ+XOu4Z/ahcmIW/q/LoO/h5DxP+3hPjCyTViNF1LmfL fLm2hoz5iLmLio45ycZ293qqqk6ls6O0t7OrHti74gTZHcYekjelIXYiI9xL0TQ5O3At avd9mk3HXHpHfYkLmYa2MW4QX8tFUYzVZ4PRVX49Auf0dYtw8rWQ2eTGizQKox/q2hAS Wdlk+k8xMruJV+7nhyzARNvc09FeaF2D9dg7usaiSQ7bbs5J7fhxetN7CTouF/KahRXr HuGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718838256; x=1719443056; 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=FTNzwr9dxOJ4zY9jqHAKJxe1vUMNFnqS5tp4Lk+OX0s=; b=q52eAUcWq9CDE3VqB0eLnPoPZ7TNFTkAGatdqBA1/95gaYXV3qOUHgaf5SUxkp+Ujy 2+09gNivvQmQiXgcuYgHRCPTgH2vNVnH2fIcC/CHaTVMosWbrlMcEloi2Xq4lf0VQFAB NyKV9EuHIIKMoKu7LVgmRCK9+2ANpruyHE2TaePfYHZNpuM2vEozCAQCC+VSVxEtzR7c E2JCs2e9zv+Ch0CHDiPmGtwjJzWMNs1U+3npr6+IAl3MB815/7zewFOuCudbjVfcZitH Gu18cYCTQHp8+0ngrCZh9X3ZId3hzxIEhEWj+gPRWLYgC93ROMGlSwsvjPEn71oQhbYZ lemQ== X-Forwarded-Encrypted: i=1; AJvYcCVD8q9Ycp7eFk2YZkOonNawm4MzBo5ZqRr8f36sYZ6S/ljmEatWj9NS3s15d49inR3sM3EoosRCqa52oNDkg38xbJeFEA== X-Gm-Message-State: AOJu0Yyv5bNUb3k6Vy/QhGZfykuhPIUoDQqFU1Ep1GNxGOBZOa/4czi6 4E1HuuaitvSD8wel9Hi/iFIhiYIkfE8+4UvCXmyizkvTieCEcbiZ X-Google-Smtp-Source: AGHT+IG8iaHjXIpOm4I4wyjmnLqBReehvd4QaCVfycCoDkRMWmuRvr3ZjkdmWOa5GroVV4q55L3LpQ== X-Received: by 2002:a05:600c:15c5:b0:422:aca:f87e with SMTP id 5b1f17b1804b1-42475182567mr34737015e9.19.1718838256119; Wed, 19 Jun 2024 16:04:16 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4247d0c54c9sm5410465e9.27.2024.06.19.16.04.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 16:04:15 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Heinrich Schuchardt , Arseniy Krasnov , Miquel Raynal , Dmitry Dunaev , Simon Glass , Devarsh Thakkar , Bin Meng , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , u-boot@lists.denx.de, John Crispin Subject: [PATCH v4 7/9] mtd: implement support for LED status activity Date: Thu, 20 Jun 2024 01:03:25 +0200 Message-ID: <20240619230400.8459-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619230400.8459-1-ansuelsmth@gmail.com> References: <20240619230400.8459-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 20 Jun 2024 03:31:55 +0200 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 status 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..d36dff7875c 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_STATUS_ACTIVITY_ENABLE + if (!read) + status_led_activity_start(CONFIG_LED_STATUS_ACTIVITY); +#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_STATUS_ACTIVITY_ENABLE + if (!read) + status_led_activity_stop(CONFIG_LED_STATUS_ACTIVITY); +#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_STATUS_ACTIVITY_ENABLE + status_led_activity_start(CONFIG_LED_STATUS_ACTIVITY); +#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_STATUS_ACTIVITY_ENABLE + status_led_activity_stop(CONFIG_LED_STATUS_ACTIVITY); +#endif + if (ret && ret != -EIO) ret = CMD_RET_FAILURE; else From patchwork Wed Jun 19 23:03:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1949906 X-Patchwork-Delegate: xypron.glpk@gmx.de 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=ZWWJleF5; 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 4W4NKs4d3gz20X8 for ; Thu, 20 Jun 2024 11:33:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 13ADB884D4; Thu, 20 Jun 2024 03:32:05 +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="ZWWJleF5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C2F78884CC; Thu, 20 Jun 2024 01:04:19 +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,T_SCC_BODY_TEXT_LINE 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 DFE3888427 for ; Thu, 20 Jun 2024 01:04:17 +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-42249a4f9e4so2311975e9.2 for ; Wed, 19 Jun 2024 16:04:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718838257; x=1719443057; 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=Vpk7Y89IwPKGsYMfO3IDA913TgBD4Hl0+Lmy6nIGugY=; b=ZWWJleF5hl3Bo36LFSrYF/fJx2Ywg2uE0xyz4xAp+JNrENZKW0H9gMvDrAvyP/IKqQ L5Seb1ruXWYn/yApi76qkacJ87p5S0OEHUWHmXVqr+G2/iAdQCdEBf74BztBIjpyaPrq PMUqTVp6YTMUF5aGU7y7ONCLHFzmUMNk1UOu2a/zTll2PLc4Dp3M6en0gMx3k2lZYI6H wnbfrni/4vykjrfE8dKLNdIhHKC/Z21W6n6G+ydy5otsmdP7UuQ4bgFvcc+ZTI6OW8zb tIvbTLPVUQ/vnuJYpEO4JPZDi6jh1eFqUex8dLs0PN8B8+DkucjKlBLvjp3ItdS3iTZc 8HWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718838257; x=1719443057; 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=Vpk7Y89IwPKGsYMfO3IDA913TgBD4Hl0+Lmy6nIGugY=; b=hZdedncZvARP4I+OfJFiPbx3+GULC3teyXP+tTsmskkq+5HtfPHNxgMaZ6JtIYHpmr Pw4WP7RYsQ9UliXOrCXa/0QlZqfSVmlpTj4LsaxYDew0/e3IeBEWoajmLLUGEJEYGwnq VEEdLJGxxQzZVePPakQsosnpdFadEBJ8YxqHziulF4owm6xa9ghqKIoQ4/Jgs7I3Si1R H1PZIxA02yD/Zqyi9N+XsmZ6L8xOpOUMOUcOomoTzqSMP2UvL8JTRdCEVVw1elbirMuK ye/lsOggCX/9QeCJ4GMr9BOK4GVX7lGAkBlScRxn8sXBokH8kl5swVcAX2Ja9KV/VsPX F6Jw== X-Forwarded-Encrypted: i=1; AJvYcCUhdXHt6BjAYFcwWm68qSaAOU4qr24ExbRK3Gys1a9hb3miQWljYllJECBDWbOuvnfHHkQK5+1xko6p31c2bcBt6JtkRw== X-Gm-Message-State: AOJu0Yzh6B1JV+vZMGLfCuD9nondeP7fHnXsvsAWRvpZ3lEPJ3UAHfpK A+EOxBLXXTsUGCJ9XKq/JEmpARqlur5+hDOiZYAmibFb6wlZbJ68 X-Google-Smtp-Source: AGHT+IE50uPX6/dsOm08GkWzu94yAfjMsAnMI1xcI1X3xPpLcHmeyNTtO5r9UujrnmnMgmXxZgqypg== X-Received: by 2002:a05:600c:3b16:b0:424:7c14:d184 with SMTP id 5b1f17b1804b1-4247c14d33cmr5247105e9.15.1718838257339; Wed, 19 Jun 2024 16:04:17 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4247d0c54c9sm5410465e9.27.2024.06.19.16.04.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 16:04:17 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Heinrich Schuchardt , Arseniy Krasnov , Miquel Raynal , Dmitry Dunaev , Simon Glass , Devarsh Thakkar , Bin Meng , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , u-boot@lists.denx.de, John Crispin Subject: [PATCH v4 8/9] ubi: implement support for LED status activity Date: Thu, 20 Jun 2024 01:03:26 +0200 Message-ID: <20240619230400.8459-9-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619230400.8459-1-ansuelsmth@gmail.com> References: <20240619230400.8459-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 20 Jun 2024 03:31:55 +0200 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 status 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 8c1b5df0572..cfc26d53d65 100644 --- a/cmd/ubi.c +++ b/cmd/ubi.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -416,7 +417,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_STATUS_ACTIVITY_ENABLE + status_led_activity_start(CONFIG_LED_STATUS_ACTIVITY); +#endif + + ret = ubi_volume_begin_write(volume, buf, size, size); + +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_activity_stop(CONFIG_LED_STATUS_ACTIVITY); +#endif + + return ret; } int ubi_volume_read(char *volume, char *buf, size_t size) From patchwork Wed Jun 19 23:03:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1949907 X-Patchwork-Delegate: xypron.glpk@gmx.de 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=kFXucMnk; 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 4W4NL12WFqz20X8 for ; Thu, 20 Jun 2024 11:33:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D136288543; Thu, 20 Jun 2024 03:32:05 +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="kFXucMnk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A7FF8884B8; Thu, 20 Jun 2024 01:04:21 +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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 700988840C for ; Thu, 20 Jun 2024 01:04:19 +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-x335.google.com with SMTP id 5b1f17b1804b1-4217136a74dso2982015e9.2 for ; Wed, 19 Jun 2024 16:04:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718838259; x=1719443059; 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=1SnK722UF5gQtV5gKPMHvDpazj/jDZqxf6MafxYMW7M=; b=kFXucMnkXn9Mma40aKl5h1zArfJWR1luuusimuxtY1vlwqFrf1sKwPjpkkibJsafSn Dk3r6BtQYWph87Vf7lJ9ZWS+YkIwQHxT3VqL05vjn/gqV96+AmbyfWZdApD/LmC0i1Mx jvWQcdDy2g018nDM6IrmxgQ3QlxAQkK1FaqpNtC4tqNkHh0as5D1sma1W9+qWp2EdPt9 Qt88E6mAMneOrqg6o99pNjKSe2evsSskBf51uqywvDNCJqJWh03VdEWHN/5hEZJt3dCR nhKqGph7FwQk1p0yhSWWjUK5qqwUH+YueQancNgPVxbjp3ZgQAZVYElvGqZqz2JoOFtn enOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718838259; x=1719443059; 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=1SnK722UF5gQtV5gKPMHvDpazj/jDZqxf6MafxYMW7M=; b=HH6R97QgVGLa+E1FOuANZf8Ngutms+YkOiM9C6jtKY8n9oBqNslVv3Pbu4Rq9Q2o82 MnZAVQqGFNkBouAf0WT4Xaqt4wX1U6UsjpzZxXpYc0nb4+xFU2ail5fg61ODbaBXdhrk +THNFZzfrhV5ivvt8eSLi68bXuz8ikceY12CLWLWdJfvW1vWFB2Rg2vwBtnUfjkvfMCs /kPNBMKE3A6pKNOAGnYexe1s5sClIu3gnQk/aapTZtPg63vmRu1LjfujYXXGQMpu1dwg 6qRz+Jric5Zmbzkds9MbnZ99qyWVnNxuvJ3lv0YmyNMZSKdURCM6y9wN8fDEm2wLtCKX AcxQ== X-Forwarded-Encrypted: i=1; AJvYcCUSZBjxOWlhZHFdm3ZgGuabXVz3OHD4dv2LfDO89B8qARuqb0eAiuEBv/pegs6DVwjLjslaAMHx1ZSf9zX2YOMbyE05sQ== X-Gm-Message-State: AOJu0YypnQ0WSnBwq+XYyWW/gHz86LKJoaTHNpLi5MKnYTg90J9Mf6Ne fEEu090uWGuBGiYxgOYCVCEf9Xvg3E2dTNl7sR72HNAq//otKbU8 X-Google-Smtp-Source: AGHT+IFHoAfWKpRkUaw0gxQz3xJwuskMepzryQ6szBNNq4YeWEuS/okSiAI1EECO/O9TxrkS+yTGNg== X-Received: by 2002:a05:600c:1c29:b0:421:8429:79ba with SMTP id 5b1f17b1804b1-42475016aedmr26716925e9.0.1718838258595; Wed, 19 Jun 2024 16:04:18 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4247d0c54c9sm5410465e9.27.2024.06.19.16.04.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 16:04:18 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Heinrich Schuchardt , Arseniy Krasnov , Miquel Raynal , Dmitry Dunaev , Simon Glass , Devarsh Thakkar , Bin Meng , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , u-boot@lists.denx.de, John Crispin Subject: [PATCH v4 9/9] doc: convert README.LED to .rst documentation Date: Thu, 20 Jun 2024 01:03:27 +0200 Message-ID: <20240619230400.8459-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619230400.8459-1-ansuelsmth@gmail.com> References: <20240619230400.8459-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 20 Jun 2024 03:31:55 +0200 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 Convert README.LED to .rst documentation and include all the relevant documentation in the status_led.h. Signed-off-by: Christian Marangi --- doc/README.LED | 77 -------------- doc/api/index.rst | 1 + doc/api/status_led.rst | 35 +++++++ include/status_led.h | 224 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 256 insertions(+), 81 deletions(-) delete mode 100644 doc/README.LED create mode 100644 doc/api/status_led.rst diff --git a/doc/README.LED b/doc/README.LED deleted file mode 100644 index c21c9d53ec3..00000000000 --- a/doc/README.LED +++ /dev/null @@ -1,77 +0,0 @@ -Status LED -======================================== - -This README describes the status LED API. - -The API is defined by the include file include/status_led.h - -The first step is to enable CONFIG_LED_STATUS in menuconfig: -> Device Drivers > LED Support. - -If the LED support is only for specific board, enable -CONFIG_LED_STATUS_BOARD_SPECIFIC in the menuconfig. - -Status LEDS 0 to 5 are enabled by the following configurations at menuconfig: -CONFIG_STATUS_LED0, CONFIG_STATUS_LED1, ... CONFIG_STATUS_LED5 - -The following should be configured for each of the enabled LEDs: -CONFIG_STATUS_LED_BIT -CONFIG_STATUS_LED_STATE -CONFIG_STATUS_LED_FREQ -Where is an integer 1 through 5 (empty for 0). - -CONFIG_STATUS_LED_BIT is passed into the __led_* functions to identify which LED -is being acted on. As such, the value choose must be unique with with respect to -the other CONFIG_STATUS_LED_BIT's. Mapping the value to a physical LED is the -reponsiblity of the __led_* function. - -CONFIG_STATUS_LED_STATE is the initial state of the LED. It should be set to one -of these values: CONFIG_LED_STATUS_OFF or CONFIG_LED_STATUS_ON. - -CONFIG_STATUS_LED_FREQ determines the LED blink frequency. -Values range from 2 to 10. - -Some other LED macros ---------------------- - -CONFIG_STATUS_LED_BOOT is the LED to light when the board is booting. -This must be a valid LED number (0-5). - -CONFIG_STATUS_LED_RED is the red LED. It is used to signal errors. This must be -a valid LED number (0-5). Other similar color LED's macros are -CONFIG_STATUS_LED_GREEN, CONFIG_STATUS_LED_YELLOW and CONFIG_STATUS_LED_BLUE. - -General LED functions ---------------------- -The following functions should be defined: - -__led_init is called once to initialize the LED to CONFIG_STATUS_LED_STATE. -One time start up code should be placed here. - -__led_set is called to change the state of the LED. - -__led_toggle is called to toggle the current state of the LED. - -Colour LED -======================================== - -Colour LED's are at present only used by ARM. - -The functions names explain their purpose. - -coloured_LED_init -red_LED_on -red_LED_off -green_LED_on -green_LED_off -yellow_LED_on -yellow_LED_off -blue_LED_on -blue_LED_off - -These are weakly defined in arch/arm/lib/board.c to noops. Where applicable, define -these functions in the board specific source. - -TBD : Describe older board dependent macros similar to what is done for - -TBD : Describe general support via asm/status_led.h diff --git a/doc/api/index.rst b/doc/api/index.rst index 51b2013af36..d40e90801d1 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -22,6 +22,7 @@ U-Boot API documentation rng sandbox serial + status_led sysreset timer unicode diff --git a/doc/api/status_led.rst b/doc/api/status_led.rst new file mode 100644 index 00000000000..44bbea47157 --- /dev/null +++ b/doc/api/status_led.rst @@ -0,0 +1,35 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Status LED +========== + +.. kernel-doc:: include/status_led.h + :doc: Overview + +CONFIG_STATUS_LED Description +----------------------------- + +.. kernel-doc:: include/status_led.h + :doc: CONFIG Description + +Special Status LED Configs +-------------------------- +.. kernel-doc:: include/status_led.h + :doc: LED Status Config + +Colour Status LED Configs +------------------------- +.. kernel-doc:: include/status_led.h + :doc: LED Colour Config + +Required API +------------ + +.. kernel-doc:: include/status_led.h + :doc: Required API + +Status LED API +-------------- + +.. kernel-doc:: include/status_led.h + :internal: diff --git a/include/status_led.h b/include/status_led.h index 7de40551621..6893d1d68e0 100644 --- a/include/status_led.h +++ b/include/status_led.h @@ -4,18 +4,102 @@ * Wolfgang Denk, DENX Software Engineering, wd@denx.de. */ -/* - * The purpose of this code is to signal the operational status of a +/** + * DOC: Overview + * + * Status LED is a Low-Level way to handle LEDs to signal state of the + * bootloader, for example boot progress, file transfer fail, activity + * of some sort like tftp transfer, mtd write/erase. + * + * The original usage these API were to signal the operational status of a * target which usually boots over the network; while running in * PCBoot, a status LED is blinking. As soon as a valid BOOTP reply * message has been received, the LED is turned off. The Linux * kernel, once it is running, will start blinking the LED again, * with another frequency. + * + * Status LED require support Low Level and the board to implement + * the specific functions to correctly works. */ #ifndef _STATUS_LED_H_ #define _STATUS_LED_H_ +/** + * DOC: CONFIG Description + * + * Enable `CONFIG_LED_STATUS` to support the Status LED under + * > Device Drivers > LED Support. + * + * The Status LED can be defined in various ways, but most of the time, + * specific functions will need to be defined in the board file. + * If this is the case, enable `CONFIG_LED_STATUS_BOARD_SPECIFIC`. + * + * If the LEDs are GPIO-driven, you can use the GPIO wrapper driver + * instead of defining specific board functions. + * If this is the case, enable `CONFIG_LED_STATUS_GPIO`. + * (Note that `CONFIG_LED_STATUS_BOARD_SPECIFIC` is also required.) + * + * The Status LED allows defining up to six different LEDs, from 0 to 5, + * with the following configurations: + * `CONFIG_STATUS_LED`, `CONFIG_STATUS_LED1`, ..., `CONFIG_STATUS_LED5`. + * + * For each LED, the following options are required: + * * `CONFIG_STATUS_LED_BIT` + * * `CONFIG_STATUS_LED_STATE` + * * `CONFIG_STATUS_LED_FREQ` + * + * Where `` is an integer from 1 through 5. (Note that LED 0 doesn't have the + * integer suffix.) + * + * `CONFIG_STATUS_LED_BIT` is passed into the `__led_*` functions to identify + * which LED is being acted on. The value is opaque, meaning it depends on how + * the low-level API handles this value. It can be an ID to reference the LED + * internally, or in the case of the GPIO wrapper, it's the GPIO number of the LED. + * Mapping the value to a physical LED is the responsibility of the `__led_*` function. + * + * `CONFIG_STATUS_LED_STATE` sets the initial state of the LED. It should be set + * to one of these values: `CONFIG_LED_STATUS_OFF` or `CONFIG_LED_STATUS_ON`. + * + * `CONFIG_STATUS_LED_FREQ` determines the LED blink frequency. + * Values range from 2 to 10. + */ +/** + * DOC: LED Status Config + * + * The Status LED uses two special configurations for common operations: + * + * * CONFIG_STATUS_LED_BOOT is the LED that lights up when the board is booting. + * * CONFIG_STATUS_LED_ACTIVITY is the LED that lights and blinks during activity + * (e.g., file transfer, flash write). + * + * The values set in these configurations refer to the LED ID previously set. + * + * - ``CONFIG_STATUS_LED_RED=0`` will refer to the option ``CONFIG_STATUS_LED_BIT``. + * - ``CONFIG_STATUS_LED_RED=1`` will refer to the option ``CONFIG_STATUS_LED_BIT1``. + * - ``CONFIG_STATUS_LED_RED=2`` will refer to the option ``CONFIG_STATUS_LED_BIT2``. + * - ... + */ +/** + * DOC: LED Colour Config + * + * The Status LED exposes specific configurations for LEDs of different colors. + * + * The values set in these configurations refer to the LED ID previously set. + * + * - ``CONFIG_STATUS_LED_RED=0`` will refer to the option ``CONFIG_STATUS_LED_BIT``. + * - ``CONFIG_STATUS_LED_RED=1`` will refer to the option ``CONFIG_STATUS_LED_BIT1``. + * - ``CONFIG_STATUS_LED_RED=2`` will refer to the option ``CONFIG_STATUS_LED_BIT2``. + * - ... + * + * Supported colors are: + * * red + * * green + * * yellow + * * blue + * * white + */ + #ifdef CONFIG_LED_STATUS #define LED_STATUS_PERIOD (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ) @@ -35,11 +119,49 @@ #define LED_STATUS_PERIOD5 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ5) #endif /* CONFIG_LED_STATUS5 */ +/** + * void status_led_init - Init the Status LED with all the required structs. + */ void status_led_init(void); +/** + * void status_led_tick - Blink each LED that is currently set in blinking + * mode + * @timestamp: currently unused + */ void status_led_tick(unsigned long timestamp); +/** + * void status_led_set - Set the LED ID passed as first arg to the mode set + * @led: reference to the Status LED ID + * @state: state to set the LED to + * + * Modes for state arE: + * * CONFIG_LED_STATUS_OFF (LED off) + * * CONFIG_LED_STATUS_ON (LED on) + * * CONFIG_LED_STATUS_BLINK (LED initially on, expected to blink) + */ void status_led_set(int led, int state); +/** + * void status_led_toggle - toggle the LED ID + * @led: reference to the Status LED ID + * + * Toggle the LED ID passed as first arg. If it's ON became OFF, if it's + * OFF became ON. + */ void status_led_toggle(int led); +/** + * void status_led_activity_start - start a LED activity + * @led: reference to the Status LED ID + * + * Set the Status LED ON and start the Cyclic to make the LED blink at + * the configured freq. + */ void status_led_activity_start(int led); +/** + * void status_led_activity_stop - stop a LED activity + * @led: reference to the Status LED ID + * + * Stop and free the Cyclic and turn the LED OFF. + */ void status_led_activity_stop(int led); /***** MVS v1 **********************************************************/ @@ -62,9 +184,61 @@ void status_led_activity_stop(int led); /* led_id_t is unsigned long mask */ typedef unsigned long led_id_t; +/** + * DOC: Required API + * + * The Status LED requires the following API functions to operate correctly + * and compile: + * + * - ``__led_toggle``: Low-level function to toggle the LED at the specified + * mask. + * - ``__led_init``: Initializes the Status LED, sets up required tables, and + * configures registers. + * - ``__led_set``: Low-level function to set the state of the LED at the + * specified mask. + * - ``__led_blink``: Low-level function to set the LED to blink at the + * specified frequency. + * + * The Status LED also provides optional functions to control colored LEDs. + * Each supported LED color has corresponding ``_on`` and ``_off`` functions. + * + * There is also support for ``coloured_LED_init`` for LEDs that provide + * multiple colors. (Currently, this is only used by ARM.) + * + * Each function is weakly defined and should be implemented in the + * board-specific source file. (This does not apply to the GPIO LED wrapper.) + */ +/** + * void __led_toggle - toggle LED at @mask + * @mask: opaque value to reference the LED + * + * Low-Level function to toggle the LED at mask. + */ extern void __led_toggle (led_id_t mask); +/** + * void __led_init - Init the LED at @mask + * @mask: opaque value to reference the LED + * @state: starting state of the LED + * + * Init the Status LED, init required tables, setup regs... + */ extern void __led_init (led_id_t mask, int state); +/** + * void __led_set - Set the LED at @mask + * @mask: opaque value to reference the LED + * @state: state to set the LED to + * + * Init the Status LED, init required tables, setup regs... + */ extern void __led_set (led_id_t mask, int state); +/** + * void __led_blink - Set the LED at @mask to HW blink + * @mask: opaque value to reference the LED + * @freq: freq to make the LED blink at + * + * Low-Level function to set the LED at HW blink by the + * passed freq. + */ void __led_blink(led_id_t mask, int freq); #else # error Status LED configuration missing @@ -77,20 +251,62 @@ void __led_blink(led_id_t mask, int freq); #endif /* CONFIG_LED_STATUS */ -/* - * Coloured LEDs API +/** + * DOC: Coloured LED API + * + * Status LED expose optional functions to control coloured LED. + * Each LED color supported expose _on and _off function. + * + * There is also support for coloured_LED_init for LED that provide + * multiple colours. (currently only used by ARM) + * + * Each function is weakly defined and should be defined in the board + * specific source. (doesn't apply for GPIO LED wrapper) */ #ifndef __ASSEMBLY__ +/** + * void coloured_LED_init - Init multi colour LED + */ void coloured_LED_init(void); +/** + * void red_led_on - Turn LED Red on + */ void red_led_on(void); +/** + * void red_led_off - Turn LED Red off + */ void red_led_off(void); +/** + * void green_led_on - Turn LED Green on + */ void green_led_on(void); +/** + * void green_led_off - Turn LED Green off + */ void green_led_off(void); +/** + * void yellow_led_on - Turn LED Yellow on + */ void yellow_led_on(void); +/** + * void yellow_led_off - Turn LED Yellow off + */ void yellow_led_off(void); +/** + * void blue_led_on - Turn LED Blue on + */ void blue_led_on(void); +/** + * void blue_led_off - Turn LED Blue off + */ void blue_led_off(void); +/** + * void white_led_on - Turn LED White on + */ void white_led_on(void); +/** + * void white_led_off - Turn LED White off + */ void white_led_off(void); #else .extern LED_init