All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Delaunay <patrick.delaunay@st.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 5/5] sandbox: led: use new function to configure default state
Date: Mon, 23 Jul 2018 11:41:31 +0200	[thread overview]
Message-ID: <1532338891-6848-6-git-send-email-patrick.delaunay@st.com> (raw)
In-Reply-To: <1532338891-6848-1-git-send-email-patrick.delaunay@st.com>

Initialize the led with the default state defined in device tree
in board_init and solve issue with test for led default state.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---
Led default-state is correctly handle in Sandbox, tested with:
  ./u-boot -d ./arch/sandbox/dts/test.dtb
  => led list
  sandbox:red     <inactive>
  sandbox:green   <inactive>
  sandbox:default_on on
  sandbox:default_off off

This patch solve "make tests" issue introduced by
http://patchwork.ozlabs.org/patch/943651/

Changes in v2:
  - add sandbox impact and test update

 board/sandbox/sandbox.c | 9 +++++++++
 common/board_r.c        | 3 ++-
 test/dm/led.c           | 3 +++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c
index 195f620..66b5f24 100644
--- a/board/sandbox/sandbox.c
+++ b/board/sandbox/sandbox.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <cros_ec.h>
 #include <dm.h>
+#include <led.h>
 #include <os.h>
 #include <asm/test.h>
 #include <asm/u-boot-sandbox.h>
@@ -47,6 +48,14 @@ int dram_init(void)
 	return 0;
 }
 
+int board_init(void)
+{
+#ifdef CONFIG_LED
+	led_default_state();
+#endif /* CONFIG_LED */
+	return 0;
+}
+
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
diff --git a/common/board_r.c b/common/board_r.c
index 64f2574..9402c0e 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -690,7 +690,8 @@ static init_fnc_t init_sequence_r[] = {
 #ifdef CONFIG_DM
 	initr_dm,
 #endif
-#if defined(CONFIG_ARM) || defined(CONFIG_NDS32) || defined(CONFIG_RISCV)
+#if defined(CONFIG_ARM) || defined(CONFIG_NDS32) || defined(CONFIG_RISCV) || \
+	defined(CONFIG_SANDBOX)
 	board_init,	/* Setup chipselects */
 #endif
 	/*
diff --git a/test/dm/led.c b/test/dm/led.c
index 0071f21..00de7b3 100644
--- a/test/dm/led.c
+++ b/test/dm/led.c
@@ -32,6 +32,9 @@ static int dm_test_led_default_state(struct unit_test_state *uts)
 {
 	struct udevice *dev;
 
+	/* configure the default state (auto-probe) */
+	led_default_state();
+
 	/* Check that we handle the default-state property correctly. */
 	ut_assertok(led_get_by_label("sandbox:default_on", &dev));
 	ut_asserteq(LEDST_ON, led_get_state(dev));
-- 
2.7.4

  parent reply	other threads:[~2018-07-23  9:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23  9:41 [U-Boot] [PATCH v2 0/5] dm: led: remove auto probe in binding function Patrick Delaunay
2018-07-23  9:41 ` [U-Boot] [PATCH v2 1/5] stm32mp1: add gpio led support Patrick Delaunay
2018-07-23  9:41 ` [U-Boot] [PATCH v2 2/5] Revert "dm: led: auto probe() LEDs with "default-state"" Patrick Delaunay
2018-07-23 23:47   ` Simon Glass
2018-07-24  7:52     ` Patrick DELAUNAY
2018-07-23  9:41 ` [U-Boot] [PATCH v2 3/5] dm: led: move default state support in led uclass Patrick Delaunay
2018-07-23  9:41 ` [U-Boot] [PATCH v2 4/5] stm32mp1: use new function led default state Patrick Delaunay
2018-07-23 23:47   ` Simon Glass
2018-07-23  9:41 ` Patrick Delaunay [this message]
2018-07-23 23:47   ` [U-Boot] [PATCH v2 5/5] sandbox: led: use new function to configure " Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1532338891-6848-6-git-send-email-patrick.delaunay@st.com \
    --to=patrick.delaunay@st.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.