From patchwork Thu Jun 6 14:29: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: 1944732 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=iZfPUBlB; 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 4Vw90q3KrGz20KL for ; Fri, 7 Jun 2024 02:35:07 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1B7818848F; Thu, 6 Jun 2024 18:33:46 +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="iZfPUBlB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1E40188423; Thu, 6 Jun 2024 16:30: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,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 0DA4A88414 for ; Thu, 6 Jun 2024 16:30: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-lf1-x130.google.com with SMTP id 2adb3069b0e04-52b83225088so1241151e87.3 for ; Thu, 06 Jun 2024 07:30:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717684239; x=1718289039; 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=tFLs4djXMjy4iXY0nn18T3TiYUGeLDPIB6Xqyuip8VI=; b=iZfPUBlBbi8q3tiuW4xDEE/Hxb9nKRRRxLbyDriMZOzT0OzR+TjHyKoZhpMyK3IdML 5yK7t84WMxRLtYMnO4qr/ZBW3r67pxud8TUQqqiZalukaN6sS8RBvVDHEdiCXVNnChsG JftF6WO8HqUDj47PaukAq2Lxee0LI41Fi0dgmr0dRzA+AoHYsP2qDxZwyMs/p2m6/gkF Yhi54RnxfVvlp8kChLvAoI+SW8E/60bwLYJ+RNbcoM9s83EDN6B9cRsgfb7X/GHBYiI/ 8J0O3y/QavzeHOPKV3XJYbUb+Lxy+NrWIoNAlMrFkNR24FFW3HcLMX9aYCYr9VTkZoUI wRhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717684239; x=1718289039; 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=tFLs4djXMjy4iXY0nn18T3TiYUGeLDPIB6Xqyuip8VI=; b=Szb3mgrSPaxGuonSTnFc3wvloGa9AJcino1KpTBbxdYltk8yR6RM9Is1yDyTSzvxNU 7lyyLogOvSiZi3CEcagUX2aaAlywSHq8w6ounzuPgqabeoUvRrbQdAbvSsl/LnhD6179 cEJzVmUK7jknkJy0gGt39uFPNEdbPNYw1HkiZVJqvMRrvH0oZIMBhKTKRNWjupAjim6e GvEpwg3yX6H7nxwL7oynfQHRgXMS2kstI1BWuTwcdVJtpZl9IvmMATQ0GQcLMVh7urfg eXmJ9zLnmcm+HxFBjhCh1YXfsFEjePV/ZtnwaYC93cPpZgZMLtuHyzqoAaMlOxtumFaU pC9A== X-Forwarded-Encrypted: i=1; AJvYcCVhtJSCV2ajIpFl9C1i/EwFadHJLX/aVKqYcPaCrb7yfB3tQePXgQCFQt27W8bausWTpRtdynsWFVBsoV4qDrX3LL9JKg== X-Gm-Message-State: AOJu0YwvMZblWrzyyjyRAJOefUXbZcy2CFt+BKhXa0btZbVcMlxPTm6f E0CuFt8QVlFtImXIRFGKWtIKU41quuIlMc6pR+4A8VYixP/ocEtB X-Google-Smtp-Source: AGHT+IEqORuJ8vixJr9HFeAYU0+TjgIUR76cKsVrLm+kZKJ5VS0sRc0sfSPgWxpepGUw286qfQuCAw== X-Received: by 2002:a05:6512:39c7:b0:52b:7c7e:303 with SMTP id 2adb3069b0e04-52bab4fa592mr3983220e87.49.1717684238956; Thu, 06 Jun 2024 07:30:38 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-35ef5e989b3sm1718060f8f.71.2024.06.06.07.30.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 07:30:38 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Stefan Bosch , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , AKASHI Takahiro , u-boot@lists.denx.de, John Crispin Subject: [PATCH v2 1/8] misc: gpio_led: fix broken coloured LED status functions Date: Thu, 6 Jun 2024 16:29:22 +0200 Message-ID: <20240606143024.20024-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606143024.20024-1-ansuelsmth@gmail.com> References: <20240606143024.20024-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 06 Jun 2024 18:33:44 +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 30679f80cf1..0f3682e1465 100644 --- a/drivers/misc/gpio_led.c +++ b/drivers/misc/gpio_led.c @@ -52,56 +52,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 Thu Jun 6 14:29: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: 1944733 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=H7VQGzkX; 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 4Vw9124vxTz20PW for ; Fri, 7 Jun 2024 02:35:18 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 72B0A884A4; Thu, 6 Jun 2024 18:33:46 +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="H7VQGzkX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DBA8587D9B; Thu, 6 Jun 2024 16:30:43 +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-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (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 E32398840E for ; Thu, 6 Jun 2024 16:30: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=ansuelsmth@gmail.com Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-354dfe54738so862925f8f.3 for ; Thu, 06 Jun 2024 07:30:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717684241; x=1718289041; 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=USHF67Hvkkr6X6WZ90mIvVSk959Bhec2gU9xl0MKgOk=; b=H7VQGzkXwLxvUYSHrMiIDaEvY/Es/OmfpzNEJCU0XQCP0nokhLQRfGzxrgil11URFE NiXmBH1WvQNbI/fhqGFUXQ2D5MR208IN2EE6lvk8NcGUMvcMsBf1fZgnupaEzr/SifK4 NHPVDQY6Se2bSWPRfd/YGjBZBjfwHXvciFkkiRVBeL4Kh0PyMpSIyWlPi+xSl+lGau+x emK+8hoEwDmH320iZtZUKyiX3Bq4kQSQB9ov29hIiBRQBozjF63YGltYF86KAEt6HtiT Gc+1ZOgavg+6i1+oXVptohTk3rlS1FecYWOKiuDPJ/P9xdwPqVFI/WYe4nCYp4BCCRBr xdlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717684241; x=1718289041; 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=USHF67Hvkkr6X6WZ90mIvVSk959Bhec2gU9xl0MKgOk=; b=Naiwo/ujFVaXkHkkOVhKsoS9HIFYzVntn0JepkHNVnV0ntOtmcidJW8YgwG8Q3v6XI gjw6LfbCnnGqN0SuUxy5+caPmPwM/epSjaiR30StdKZfnfI8hwowdiPsRaFeYxJSj1Mz ms6dAslTiNshHrT72ey9iw0CWiqHRfbkWTgNB5/TtMUe7xix0VQSEiOfnpTvh9yeY6Ij qYEdGmZifZzqAu+Ak94KJsF1GoHjnD/0W0Vvg8qKsNBqqMxSg8Ii/2p7397DZEAIGLN2 /00InnE2y6oBktkNf0L8dP7F481I1YbPBNQfHEdfngbeWXMPacN3Sx3hp6KHPb4B3K/w drPA== X-Forwarded-Encrypted: i=1; AJvYcCUFZTry/h1yMbjRDcgbSF8WvGhr/3ISxGl3EjMeLE7S8EfZj2jlBpK/nd/KtmpMHeWMR2VxHeW4Psy5r5nHyms+HmkNEw== X-Gm-Message-State: AOJu0YyMp6pLxIYW9fI8HtY16imfxmj/fbRgrrz5WJOTjghoxc4w3Pfj ITNbx9BW47pkh1rlZ+B8I4hgeeiOqWFtvglHoI7bNxJNrelyr+MG X-Google-Smtp-Source: AGHT+IH+wQ61kXWbNkyd81Smk+da1DQcEldEA4IDbcZtXsfH6u4OZ7IsLPvhWdgslzHQrECXz44rCA== X-Received: by 2002:a05:6000:1047:b0:354:f515:431d with SMTP id ffacd0b85a97d-35e8404948bmr4406979f8f.11.1717684240714; Thu, 06 Jun 2024 07:30:40 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-35ef5e989b3sm1718060f8f.71.2024.06.06.07.30.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 07:30:40 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Stefan Bosch , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , AKASHI Takahiro , u-boot@lists.denx.de, John Crispin Subject: [PATCH v2 2/8] led: status_led: add support for white LED colour Date: Thu, 6 Jun 2024 16:29:23 +0200 Message-ID: <20240606143024.20024-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606143024.20024-1-ansuelsmth@gmail.com> References: <20240606143024.20024-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 06 Jun 2024 18:33:44 +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 5256255f052..40dbc05a651 100644 --- a/cmd/legacy_led.c +++ b/cmd/legacy_led.c @@ -57,6 +57,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 } }; @@ -180,6 +183,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 039d6d712d0..54e2009339e 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 0f3682e1465..de84c206b6b 100644 --- a/drivers/misc/gpio_led.c +++ b/drivers/misc/gpio_led.c @@ -112,3 +112,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 Thu Jun 6 14:29: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: 1944734 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=B2/JPV/B; 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 4Vw91F0ljGz20PW for ; Fri, 7 Jun 2024 02:35:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D02E6884B5; Thu, 6 Jun 2024 18:33:46 +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="B2/JPV/B"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CF00A881D3; Thu, 6 Jun 2024 16:30:44 +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-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (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 E754F88414 for ; Thu, 6 Jun 2024 16:30:42 +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-x42f.google.com with SMTP id ffacd0b85a97d-354be94c874so768925f8f.3 for ; Thu, 06 Jun 2024 07:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717684242; x=1718289042; 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=LiJxSrHUQxU7ezUE98DdkJgahWdu8Tg6y94tQni3u9Y=; b=B2/JPV/BFvWLmIGooYPnZeAZ5OxbpXsOITaumbrIA0EuezQOy1XkysmG/1ZDVdsRgD UgnHOsbRZLiZVNJv5O+Y/LhD/U8mE7/ssNPR3EMx7W9Y9WCXynNX/tuvc1zsTW667Hik 7+4J0wVy4G7piJeHXKl97k4TKQfWXKkBqTebqo0Xn0+SpU0MiD14D/Qm0EuUrKP5zv8y LslqFboi9LfFHaV2ABtJFnOYjV/RBVNqIqE4IHdXq46LVP2azZYQyVMqFriQO1I9ryzG H5zXerp0g5WQtEDqLtih4oypmgGC7thp8BAMFJAjePDYAKJcbNtKAfXLbZHC106xqGMJ hdMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717684242; x=1718289042; 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=LiJxSrHUQxU7ezUE98DdkJgahWdu8Tg6y94tQni3u9Y=; b=Gfcm0EG0pOF/EDzeXVci/i4AdBeGR8VhhXPoImgMSiteutp3zuQgBoWPaXldnznldx RZ5vbPJDsyLFhJ7hVaIWImNbnNEuY9UUxinaja40H4ImqzYqd8Zsrfu2enw/BcVh4l84 EZg4fC4bH9ZfugkTLXB9azGD9ueXLhhKzowcR+Rf+TbW8tqQ6Xe8aQDbLxNU7lTR2AiV AI/rqWkfVXj/AGorsxQy6rEB2B9mYb7a7KnO+Bj9+3cIKgS1KlGk/Z276MfjQzj5GKiq +nD99PoO6imDnI7gB/ueMTPzXAzCN3nKocqy37X0n6PtU5RIIimIggAvg7j2gzX9luOX Kvmg== X-Forwarded-Encrypted: i=1; AJvYcCWt9GWqmfsCKVz9HCduS/ZXcobl3h7Fo/lW0piUrGMHxonOQ5V/by8Ha8F3Pm4VwZfiWmWN3wEttKtgSeVdc7HGpVA6NQ== X-Gm-Message-State: AOJu0YysO96976sMY90ljiQW+3W5kb4TErLKqOu7pX5XASQNSTuyI3GU /t7NlCLoZwIK5+l7Y2KfWrZ0o4str2E8wyAK4nQFQlJgCDdK0BiY X-Google-Smtp-Source: AGHT+IHnffo12hwRkygdK+cMdsRLB7friUAatvD5ssf/WH/rUDgqdW55AoVf+XKPqwr21adqWGZcfg== X-Received: by 2002:adf:a3c2:0:b0:354:fbb6:1b16 with SMTP id ffacd0b85a97d-35e8ef8fecdmr4565191f8f.52.1717684242172; Thu, 06 Jun 2024 07:30:42 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-35ef5e989b3sm1718060f8f.71.2024.06.06.07.30.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 07:30:41 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Stefan Bosch , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , AKASHI Takahiro , u-boot@lists.denx.de, John Crispin Subject: [PATCH v2 3/8] led: status_led: add function to toggle a status LED Date: Thu, 6 Jun 2024 16:29:24 +0200 Message-ID: <20240606143024.20024-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606143024.20024-1-ansuelsmth@gmail.com> References: <20240606143024.20024-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 06 Jun 2024 18:33:44 +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 a6e9c03a02e..93bfb410662 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 Thu Jun 6 14:29: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: 1944735 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=jUEMxiJl; 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 4Vw91Q5PkFz20PW for ; Fri, 7 Jun 2024 02:35:38 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 38004884C0; Thu, 6 Jun 2024 18:33:47 +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="jUEMxiJl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2EE2988423; Thu, 6 Jun 2024 16:30:46 +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-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (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 2E95787D9B for ; Thu, 6 Jun 2024 16:30:44 +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-x434.google.com with SMTP id ffacd0b85a97d-35dce610207so1167462f8f.2 for ; Thu, 06 Jun 2024 07:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717684243; x=1718289043; 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=RUt1XdB6mSawd1Ij7o9mOYvIaDuwwQy604vSSdO7Xo0=; b=jUEMxiJlFaE55p9TBsuglv6WHdpKeclp3BbxJuWI2t2vtfp5EMu/eDOxAt7GIH8ec0 HrNapn6pJP732Cl0j+RcY+nEHMIbw5nLwCV75b3vcMehXzK2ABqEY5xOqcZDTN/TpPm9 muZZPbGeOaBnFlDTfCeresFm1XVJdoYackJT8tQR1a4LOHKE5IiVWU+p1Q63qeb6jN7U 36W9ZZhpww5EhhdBP/jg3eTDdx35gD+S/MLgXpkE6jmoJdiopDUXb+cKb08cHW77hUX1 WX4n4UrwP+Kw1tf/uTHukIQlWTFFc4AE2TZsdDz3IuNKTr6lX0iGT8yqaB5F1Q0SUNcc ALrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717684243; x=1718289043; 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=RUt1XdB6mSawd1Ij7o9mOYvIaDuwwQy604vSSdO7Xo0=; b=UfRZH+bWnA1UeJzbYKMrJIve6cVrWr2hLAgcgr06dAx3t2tgd8+s0pPOCBN1PiBJkW S8KCy+FOItxGkOAZA2NmZ9y1A2AyHO8rcIe16cSCi/auOD02P7HfFsl3DOLB22WjQ6gI ek19ezTWFu0aKqTLVjcGNb2UyoQFbalpUk6DxctYLUD2x4VVG7VYDO8p3alB4d9HTFW1 9iYWVOpUnVne8faclqDXwilfvH9x4r2g/PCcIaic/mJDDm874zwEW0HEukFARY+yoepx x3mZIPul3g1RDNETqTB5dFPpUejalHV37fFlphIc4kBPCM0wcMgJQiq0J/iH+ruzMQdJ d8vg== X-Forwarded-Encrypted: i=1; AJvYcCU4jq8TPC/f2h3M0iJw4rAby9oj8R2b6hUcK9JaPzBD/G1jeGjBr/ZKC4F9xEIt853bFStZ47345mn/dlvmueR42w51kg== X-Gm-Message-State: AOJu0YyI2P7jRYhk+ykElhBB1XjBUPtDmXXxzhccck/73cDe4sxW1CI3 Kxsy2e+TVD9PkFkzJbeTlRu5oLzxgjw8BrhhEEkWMLbSabkOZrBY X-Google-Smtp-Source: AGHT+IFK2UaBwxr8Ii2+/Wx/mXlIGaAUbYG2vZ12VMA4GtnMONuF0pmTmTSZhtCAutxaJj3ut73Qmg== X-Received: by 2002:a5d:4e87:0:b0:354:e0f0:2943 with SMTP id ffacd0b85a97d-35e8ef2c428mr5166159f8f.37.1717684243555; Thu, 06 Jun 2024 07:30:43 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-35ef5e989b3sm1718060f8f.71.2024.06.06.07.30.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 07:30:43 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Stefan Bosch , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , AKASHI Takahiro , u-boot@lists.denx.de, John Crispin Subject: [PATCH v2 4/8] led: status_led: add new activity LED config and functions Date: Thu, 6 Jun 2024 16:29:25 +0200 Message-ID: <20240606143024.20024-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606143024.20024-1-ansuelsmth@gmail.com> References: <20240606143024.20024-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 06 Jun 2024 18:33:44 +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 | 41 +++++++++++++++++++++++++++++++++++++++ include/status_led.h | 2 ++ 3 files changed, 59 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 93bfb410662..5ee68c7c77d 100644 --- a/drivers/misc/status_led.c +++ b/drivers/misc/status_led.c @@ -5,6 +5,7 @@ */ #include +#include #include /* @@ -23,6 +24,7 @@ typedef struct { int state; int period; int cnt; + struct cyclic_info *cyclic; } led_dev_t; led_dev_t led_dev[] = { @@ -140,3 +142,42 @@ void status_led_toggle(int led) __led_toggle(ld->mask); } + +static void status_led_activity_toggle(void *ctx) +{ + __led_toggle(*(led_id_t *)ctx); +} + +void status_led_activity_start(int led) +{ + led_dev_t *ld; + + ld = status_get_led_dev(led); + if (!ld) + return; + + if (ld->cyclic) { + printf("Cyclic for activity status LED already registered. THIS IS AN ERROR.\n"); + cyclic_unregister(ld->cyclic); + } + + status_led_set(led, CONFIG_LED_STATUS_BLINKING); + + ld->cyclic = cyclic_register(status_led_activity_toggle, + ld->period * 500, "activity", &ld->mask); + if (!ld->cyclic) + printf("Registering of cyclic function for activity status LED failed\n"); +} + +void status_led_activity_stop(int led) +{ + led_dev_t *ld; + + ld = status_get_led_dev(led); + if (!ld) + return; + + cyclic_unregister(ld->cyclic); + ld->cyclic = NULL + 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 Thu Jun 6 14:29: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: 1944736 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=htkmVV4t; 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 4Vw91c1Z6wz20PW for ; Fri, 7 Jun 2024 02:35:48 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 97DD0884C8; Thu, 6 Jun 2024 18:33:47 +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="htkmVV4t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7860988428; Thu, 6 Jun 2024 16:30:47 +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-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (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 8F55A87E1D for ; Thu, 6 Jun 2024 16:30:45 +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-x32b.google.com with SMTP id 5b1f17b1804b1-42108856c33so13029975e9.1 for ; Thu, 06 Jun 2024 07:30:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717684245; x=1718289045; 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=rtMC5JbP5BH/cFBWNtSST3rx9aK9f8wKNrTbXFX8p+0=; b=htkmVV4t9QDpk6wa3NkjJGlaymn1FdDPSBmleVKpCmKo5jqHtFTxiwslp2/AfI3Q5p GNlh29Vh45l2XST02n12LiX6inhdpPjFruniVEbik9184JzlM43eYnJkIjl7U8g+5ezK i8/psyrfZ+sWi13hzgfoeYLxSW5uuCpDvQfozqNwsb9LBtm7M1Bx+2FVoqWbUbANP8y0 rs10iDKXf5J33sXj2pjT6tNdtwJ/56UHLtff2P+jgQU9b6MMcU/hhD+7bn9QtZyePLtJ WucTxI/6A/JNLl+3z37EV7jLSfa1vy0Xtq30CfO8StivZDAkZHbJSkOQA8b3qJTT2Yji 9xKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717684245; x=1718289045; 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=rtMC5JbP5BH/cFBWNtSST3rx9aK9f8wKNrTbXFX8p+0=; b=U8X0mbqwa0edCMMY4mmDjItlT8s7k24YkckJa4Gx2Rg92JVooUhIqVzT79Y2DiPy0G RmcnVf//7zTyBgVnRSLezCLHyu6eIvj98P+T9k0GhseAK3SoW8sprlxeIbSZFEoXYa4R vJiloP9a5lRYJmeomBg8KBOFbNtbYTMi8mXxrk+yJoQAL+FGRQlC83l7BLwmDRRb/ZVN 6HfaGXkZfgWUM0yVkKcU9bO6TwrxBfs/7tsmsngdY3QbgoLUNsUVuwzfQ7aF85h7k6Fa yWmMhAfYn/JIIYO8viQmBXq+UXp0gmSllDijlwlVTcwgOT3aRoYcOdCdbIY7ZM9ImeOL zemw== X-Forwarded-Encrypted: i=1; AJvYcCWWKepZr1CxlG4pUsEYv2kGmAgw925cqYwSz92AUEX81JNouijGl7tC4FshsmP2nBgLVD9Yd7kvFLzzQmUfDTyiZe7tPg== X-Gm-Message-State: AOJu0YxkAg8SXC5reEur/J5UiBy5oXsZYTKwU6+4gqxf3+jcHQnIKMvh NqfDlIxleBgEzTSmydBECVw0//p8eOPo7FG5kklcrSrCk+Qn6wfT X-Google-Smtp-Source: AGHT+IHpy7C2AHXysN0PGfqHA421gqpvYARWPfWN5I/GXmNx5HNvQ1EK6Evysqohq42hD9XveE3LEA== X-Received: by 2002:a05:6000:4c5:b0:34f:8f7c:8fe2 with SMTP id ffacd0b85a97d-35ef0d7a266mr2527104f8f.10.1717684244855; Thu, 06 Jun 2024 07:30:44 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-35ef5e989b3sm1718060f8f.71.2024.06.06.07.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 07:30:44 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Stefan Bosch , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , AKASHI Takahiro , u-boot@lists.denx.de, John Crispin Subject: [PATCH v2 5/8] tftp: implement support for LED status activity Date: Thu, 6 Jun 2024 16:29:26 +0200 Message-ID: <20240606143024.20024-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606143024.20024-1-ansuelsmth@gmail.com> References: <20240606143024.20024-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 06 Jun 2024 18:33:44 +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 2e335413492..0515dc34d4b 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -19,6 +19,7 @@ #include #include #include "bootp.h" +#include DECLARE_GLOBAL_DATA_PTR; @@ -193,6 +194,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 @@ -302,6 +306,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 Thu Jun 6 14:29: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: 1944738 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=JqMQisCt; 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 4Vw91p3YjKz20PW for ; Fri, 7 Jun 2024 02:35:58 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 03320884D1; Thu, 6 Jun 2024 18:33:48 +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="JqMQisCt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B01628842A; Thu, 6 Jun 2024 16:30:48 +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-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (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 C0C9F87D9B for ; Thu, 6 Jun 2024 16:30:46 +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-x432.google.com with SMTP id ffacd0b85a97d-35dc984b3d2so750246f8f.1 for ; Thu, 06 Jun 2024 07:30:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717684246; x=1718289046; 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=m1ahcJL+QZVoz+jmkvnn70yF6uGU5cp9PXqRqWEqUY0=; b=JqMQisCtHhd8WxHrsirwEMwTiLwgfr0je+2Gm/Mi/OmuLQOnlcZpS07FzklUXAllK3 dI64ZVNUC8HEXo2xpDV6b3rROltcslDNMmRL9htTdZMVOcjCpUTvr1BomouUsL2ETh/u n05UaT3+nBVr1TGOXLTqdoPukatweIe7B+8YZxAmenebNzYcs+nf2j/QIX0YEJ2mo8mk hfRinpAOPfrZGRLw0KYgdw0sJFvX7azsmJaOvXtnacmWGTimtUmP+0Z+uVdOa61nSabY UeSAF+Nb4U5YYll42LkhZVuKN6dysS29gzBmYGp5KEs32DIUoDugTtRmVQilWOEFu8NX Isag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717684246; x=1718289046; 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=m1ahcJL+QZVoz+jmkvnn70yF6uGU5cp9PXqRqWEqUY0=; b=CiQYAOvC9vvfhukvae8DxvYL1G9X4IzEffLUtDGD78cWg3/gG62Yow4k1j++tNW1/E QVZ2OOO2tEttvtYEbUmKXUteQ/ofXCuSFrN07FuZudMtTLFNw1M6AZI4tOkSiX0AA8RC S073MR+bt3v2UAgJLryTNghwEpeyiSNa2ErpV1yjPQOIyWMe/4tnizzIQgsh8TJlIGjG R950zUYJ+D3o8tFbeGrcPgMPDgFbS5wV/4hTNT7vu828XQG5ILfKddOk7gKlpkyivS3G ceSB1zhUi+U3cjkK3ufoMV0393ViaLMppOXaWRrqNq+l4+TsXZHdeGIGnYKuJXkTLVxb JF+w== X-Forwarded-Encrypted: i=1; AJvYcCXcIfUDM13j/OL87zN51/hbsu1Lu6k887EhJ8E31jNzjqRPDsc1cHSe+keVVkHcu9WFALyOhHOU6l38/aSBQE7VAD8e8Q== X-Gm-Message-State: AOJu0YwAjDJopiNtU4eFpoMnrkXLCXXxs8y8Q3MLEeoVVq+MPFsH+DP6 g2yK8YYChGbQyexsrAzGzFrA52XKMxCRBuIAUd9o+8od7fRk4cLp X-Google-Smtp-Source: AGHT+IEcDaQMOG/pEO06gRZgkh8PtpjdaLJhpwnC2bDzFj5zuKBMeTsE+4Jp8rNyxQcNr8ib+2Y8eg== X-Received: by 2002:a05:6000:363:b0:35e:60f8:7ed8 with SMTP id ffacd0b85a97d-35e840688dcmr4666648f8f.11.1717684246207; Thu, 06 Jun 2024 07:30:46 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-35ef5e989b3sm1718060f8f.71.2024.06.06.07.30.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 07:30:45 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Stefan Bosch , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , AKASHI Takahiro , u-boot@lists.denx.de, John Crispin Subject: [PATCH v2 6/8] mtd: implement support for LED status activity Date: Thu, 6 Jun 2024 16:29:27 +0200 Message-ID: <20240606143024.20024-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606143024.20024-1-ansuelsmth@gmail.com> References: <20240606143024.20024-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 06 Jun 2024 18:33:44 +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 9189f45cabd..a10805d05a5 100644 --- a/cmd/mtd.c +++ b/cmd/mtd.c @@ -11,6 +11,7 @@ #include #include #include +#include #if CONFIG_IS_ENABLED(CMD_MTD_OTP) #include #endif @@ -559,6 +560,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 */ @@ -586,6 +592,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); @@ -653,6 +664,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); @@ -681,6 +696,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 Thu Jun 6 14:29:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1944739 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=aIpsd8NW; 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 4Vw9203X2mz20PW for ; Fri, 7 Jun 2024 02:36:08 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 60149884D5; Thu, 6 Jun 2024 18:33:48 +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="aIpsd8NW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 09E6B88423; Thu, 6 Jun 2024 16:30:50 +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-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 1C3E187E1D for ; Thu, 6 Jun 2024 16:30:48 +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-42122ac2f38so6159105e9.1 for ; Thu, 06 Jun 2024 07:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717684247; x=1718289047; 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=wTfHCeEdThYm0NrWUrNIMKGuPJLSBNhsTTFSCPR2st8=; b=aIpsd8NWb4SWOnM6fQAFJPNCRPvo9N8RaYcueRocOERk7tZKYYZf2b6B4zu027/0bn C5Gh8WWfRoAOBtMuVZLwcydam/4ykwplcfEZFZBpmeTY1asDVQJK6xiyDQF8BCcwIskv Eo6K4vjhCcy4KLCSkbynpX2d2Phx6hslgl8+0Ak5LuZ37noHlCSVoiQrsHnY1xU+VUHI uwy/xKbmUVXHA1NAck9JmNiDiG0zvbqHvoClvGblelemHxLa5JzLxylX71SfhoeJIPuG yYAnOByVBJ2CcFTSedLfGux7lZQbujniUSvRrsRGu0EOyvO2Scsci9WBC06zUxBBITzp lEfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717684247; x=1718289047; 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=wTfHCeEdThYm0NrWUrNIMKGuPJLSBNhsTTFSCPR2st8=; b=i/TQRlYwQI9CpuRayRAPhv5OQtvUvyjQmYIwYUIhU/TdzOYcKokQY6rk93ZpFxAr3M 6ZeZTbveFm/HrEwlS37ZsXT8mLuW9EayPYp55b5fpJoNdNh+U9UAoecVbqFuAbEWySSn ZfUEtvTJ46l98RpqBn/MI0pL5o/YSWiBRigKO68YcJgNNlJruD0aky5P0gfV0X1+4c0A VfnszmActLBZNZeTFb5/38nOZNjf4iHdo5tqIA6fixOCPLmLBW7tqSaoGVvVDuMfmUd7 GBT5OxnbIwE1x3FOkf4CL4OpqkA82wVf5LNh9XjngMAWsj5PVwpnAW0+OaPJcvPkOhKH P0xA== X-Forwarded-Encrypted: i=1; AJvYcCVPwjJQGFz8xAkSuhdqc2pGMuYTrv81UUTQ93terIt0/qkgj9P7YnIz2P4YTNOVc64ModNMwAJ7dM6TmqEMbhNmeIztEw== X-Gm-Message-State: AOJu0YwN0HpE898uJz69DpMtOXQsb1P+vgs94m+WcFPTTkphX77C58Wu mDLSIaPDOWRS2jdZWRRH1wmpB/NMNcRHfDOMaB8zFJ532YVzK47Y X-Google-Smtp-Source: AGHT+IF8d8iESoX0tuw0Z2mBRIjp5CcHgya6YFX8XfHulvMxA9dW3iSoXz5vSrSWV+GaQRjQKOiw3Q== X-Received: by 2002:a05:600c:35c2:b0:421:4b0a:5006 with SMTP id 5b1f17b1804b1-4215acd81e0mr27020265e9.7.1717684247521; Thu, 06 Jun 2024 07:30:47 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-35ef5e989b3sm1718060f8f.71.2024.06.06.07.30.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 07:30:47 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Stefan Bosch , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , AKASHI Takahiro , u-boot@lists.denx.de, John Crispin Subject: [PATCH v2 7/8] ubi: implement support for LED status activity Date: Thu, 6 Jun 2024 16:29:28 +0200 Message-ID: <20240606143024.20024-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606143024.20024-1-ansuelsmth@gmail.com> References: <20240606143024.20024-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 06 Jun 2024 18:33:44 +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 0a6a80bdd10..37c16048b19 100644 --- a/cmd/ubi.c +++ b/cmd/ubi.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -417,7 +418,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 Thu Jun 6 14:29:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1944740 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=VkfhJftV; 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 4Vw92C2YF7z20PW for ; Fri, 7 Jun 2024 02:36:19 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BB183884EA; Thu, 6 Jun 2024 18:33:48 +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="VkfhJftV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DA61F87E1D; Thu, 6 Jun 2024 16:30:51 +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-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (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 9AE6A88428 for ; Thu, 6 Jun 2024 16:30:49 +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-x429.google.com with SMTP id ffacd0b85a97d-35dd0c06577so1064623f8f.2 for ; Thu, 06 Jun 2024 07:30:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717684249; x=1718289049; 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=VkfhJftV/Y/IgEqmozQOyB4bfIvcUa6oj2M/f/lvPkc8wM/bLyiF6GP4o+6R2VrT6m 3mkJs3whrf6SEN/I0vl9wCB9jJYC822d5HoY5jDltbV9H5PBYoYl4MxTdvvDGiTKdsRg 5XB9qWseA7fK7UoDnPIj/SswGSRYWSZ9ZTeJwmEvh5yUwGhf8i0XiEh13WFGOqXNsrih KRQ3ZNJY3I7ed8z2MTowjvHrOZGNF0QaWNfwCZ+ZlasvKTzE0FR9rmUoOwbYBHSMgb71 tknFH3Q4l6GBiwh0PFB+/DD3cPkecd5K4qyYwpbIpK/M2sd03fCf9e476RgLjSgujlnr nNHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717684249; x=1718289049; 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=raGvyyMjrej0dsw89DuCb6f8bo9Kg5G1jYnHTYTazGLJ1nrmxc1Ccv6n4fmE1zO4A+ yggiKcNLp2f8d/E3sTX9Y/MILd5ScV6YjeBN0GvHcMsaufyMqF88QHkQA/oD+EwPBhla E1Eet0Z+NVA8IqLufDUXjwleX/h891VCLg3fQFUiz/Gc57dj0wxpJNQTEyQig+PwhehQ Kh7CE/axtTHq+zlPkqfVo4gRxVGlysFJd7ALR1crsgMA77l5ylXlzQGGmJeENz4BAeBd EXV+BkbJ55J98XmGQweeWWUImGeW+mTd6zbW9JhC5hghESe3pnDtmPQ6TaQi+Ej+TojU y7oA== X-Forwarded-Encrypted: i=1; AJvYcCVH1WaizNJjedqIa50KzAIhjfU17ZhyNaXGq+5KPAn6EsTXxdjWQp0D6Uomt7GSoksot48ZKLyVA9PFSYdTKPIpDSZnWA== X-Gm-Message-State: AOJu0YxfYzxepCZixq8WKKprZX11Mtl2WPc1I3NZbtlV+zw+L0ZJqrbZ OitgrZKEn0SxThvtkmZVASffDajjEtLExV446+sLU2dipxO8XHa2 X-Google-Smtp-Source: AGHT+IHdQVRcEnnaWi7drWG1rxMggzQKW2ohz3XJnImAkpIiPNxDRv40FmPbtIyJJFheOFPDmbIgxA== X-Received: by 2002:a5d:658d:0:b0:358:380:f44c with SMTP id ffacd0b85a97d-35e840582femr4390753f8f.5.1717684248884; Thu, 06 Jun 2024 07:30:48 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-35ef5e989b3sm1718060f8f.71.2024.06.06.07.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 07:30:48 -0700 (PDT) From: Christian Marangi To: Tom Rini , Joe Hershberger , Ramon Fried , Christian Marangi , Dario Binacchi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Stefan Bosch , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Leo Yu-Chi Liang , Rasmus Villemoes , Doug Zobel , AKASHI Takahiro , u-boot@lists.denx.de, John Crispin Subject: [PATCH v2 8/8] doc: convert README.LED to .rst documentation Date: Thu, 6 Jun 2024 16:29:29 +0200 Message-ID: <20240606143024.20024-9-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606143024.20024-1-ansuelsmth@gmail.com> References: <20240606143024.20024-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 06 Jun 2024 18:33:44 +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