Skip to contentSkip to conversation

sandbox, test: change hog gpio

PATCH New Philippe Reynes 3 participants 4 messages Jul 24, 2020 – Jul 28, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sandbox, test: change hog gpio

Since commit 9ba84329dc45 ("sandbox, test: add test for GPIO_HOG function"), the gpio_a 0,1,2 and 3 are used by hog in test.dts. But 2 leds 'sandbox:red' and 'sandbox:green' are using gpio_a 0 and 1. As hog always request his gpios, the led command on both led is broken:

=> led sandbox:red
LED 'sandbox:red' not found (err=-16)

The gpio is already requested by hog, so it can't be enabled for led 'sandbox:red'.

This commit change the gpio used by hog to 10, 11, 12 and 13, so the led command could be used again with 'sandbox:red' and 'sandbox:green'.

---
 arch/sandbox/dts/test.dts |  8 ++++----
 test/dm/gpio.c            | 12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)
arch/sandbox/dts/test.dts +4 -4
index 2ae4239..2325ec6 100644
@@ -355,22 +355,22 @@
 			hog_input_active_low {
 				gpio-hog;
 				input;
-				gpios = <0 GPIO_ACTIVE_LOW>;
+				gpios = <10 GPIO_ACTIVE_LOW>;
 			};
 			hog_input_active_high {
 				gpio-hog;
 				input;
-				gpios = <1 GPIO_ACTIVE_HIGH>;
+				gpios = <11 GPIO_ACTIVE_HIGH>;
 			};
 			hog_output_low {
 				gpio-hog;
 				output-low;
-				gpios = <2 GPIO_ACTIVE_HIGH>;
+				gpios = <12 GPIO_ACTIVE_HIGH>;
 			};
 			hog_output_high {
 				gpio-hog;
 				output-high;
-				gpios = <3 GPIO_ACTIVE_HIGH>;
+				gpios = <13 GPIO_ACTIVE_HIGH>;
 			};
 		};
 
test/dm/gpio.c +6 -6
index 2970138..b7ee8fc 100644
@@ -114,21 +114,21 @@ static int dm_test_gpio(struct unit_test_state *uts)
 	/* add gpio hog tests */
 	ut_assertok(gpio_hog_lookup_name("hog_input_active_low", &desc));
 	ut_asserteq(GPIOD_IS_IN | GPIOD_ACTIVE_LOW, desc->flags);
-	ut_asserteq(0, desc->offset);
+	ut_asserteq(10, desc->offset);
 	ut_asserteq(1, dm_gpio_get_value(desc));
 	ut_assertok(gpio_hog_lookup_name("hog_input_active_high", &desc));
 	ut_asserteq(GPIOD_IS_IN, desc->flags);
-	ut_asserteq(1, desc->offset);
+	ut_asserteq(11, desc->offset);
 	ut_asserteq(0, dm_gpio_get_value(desc));
 	ut_assertok(gpio_hog_lookup_name("hog_output_low", &desc));
 	ut_asserteq(GPIOD_IS_OUT, desc->flags);
-	ut_asserteq(2, desc->offset);
+	ut_asserteq(12, desc->offset);
 	ut_asserteq(0, dm_gpio_get_value(desc));
 	ut_assertok(dm_gpio_set_value(desc, 1));
 	ut_asserteq(1, dm_gpio_get_value(desc));
 	ut_assertok(gpio_hog_lookup_name("hog_output_high", &desc));
 	ut_asserteq(GPIOD_IS_OUT, desc->flags);
-	ut_asserteq(3, desc->offset);
+	ut_asserteq(13, desc->offset);
 	ut_asserteq(1, dm_gpio_get_value(desc));
 	ut_assertok(dm_gpio_set_value(desc, 0));
 	ut_asserteq(0, dm_gpio_get_value(desc));
@@ -137,8 +137,8 @@ static int dm_test_gpio(struct unit_test_state *uts)
 	ut_assertok(gpio_lookup_name("hog_input_active_low", &dev, &offset,
 				     &gpio));
 	ut_asserteq_str(dev->name, "base-gpios");
-	ut_asserteq(0, offset);
-	ut_asserteq(CONFIG_SANDBOX_GPIO_COUNT + 0, gpio);
+	ut_asserteq(10, offset);
+	ut_asserteq(CONFIG_SANDBOX_GPIO_COUNT + 10, gpio);
 	ut_assert(gpio_lookup_name("hog_not_exist", &dev, &offset,
 				   &gpio));
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 sandbox, test: change hog gpio

Quoted 17 lines · Philippe Reynes

Since commit 9ba84329dc45 ("sandbox, test: add test for GPIO_HOG function"), the gpio_a 0,1,2 and 3 are used by hog in test.dts. But 2 leds 'sandbox:red' and 'sandbox:green' are using gpio_a 0 and 1. As hog always request his gpios, the led command on both led is broken:

=> led sandbox:red
LED 'sandbox:red' not found (err=-16)

The gpio is already requested by hog, so it can't be enabled for led 'sandbox:red'.

This commit change the gpio used by hog to 10, 11, 12 and 13, so the led command could be used again with 'sandbox:red' and 'sandbox:green'.

Quoted 6 lines
---
 arch/sandbox/dts/test.dts |  8 ++++----
 test/dm/gpio.c            | 12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)
#2 lore raw

PATCH 1/1 sandbox, test: change hog gpio

In reply to Philippe Reynes

Hello Philippe,

Am 24.07.2020 um 15:51 schrieb Philippe Reynes:

Quoted 16 lines

Since commit 9ba84329dc45 ("sandbox, test: add test for GPIO_HOG function"), the gpio_a 0,1,2 and 3 are used by hog in test.dts. But 2 leds 'sandbox:red' and 'sandbox:green' are using gpio_a 0 and 1. As hog always request his gpios, the led command on both led is broken:

=> led sandbox:red
LED 'sandbox:red' not found (err=-16)

The gpio is already requested by hog, so it can't be enabled for led 'sandbox:red'.

This commit change the gpio used by hog to 10, 11, 12 and 13, so the led command could be used again with 'sandbox:red' and 'sandbox:green'.

Quoted 5 lines
---
  arch/sandbox/dts/test.dts |  8 ++++----
  test/dm/gpio.c            | 12 ++++++------
  2 files changed, 10 insertions(+), 10 deletions(-)

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de
#3 lore raw

PATCH 1/1 sandbox, test: change hog gpio

Hello Philippe,

Am 24.07.2020 um 15:51 schrieb Philippe Reynes:

Quoted 16 lines

Since commit 9ba84329dc45 ("sandbox, test: add test for GPIO_HOG function"), the gpio_a 0,1,2 and 3 are used by hog in test.dts. But 2 leds 'sandbox:red' and 'sandbox:green' are using gpio_a 0 and 1. As hog always request his gpios, the led command on both led is broken:

=> led sandbox:red
LED 'sandbox:red' not found (err=-16)

The gpio is already requested by hog, so it can't be enabled for led 'sandbox:red'.

This commit change the gpio used by hog to 10, 11, 12 and 13, so the led command could be used again with 'sandbox:red' and 'sandbox:green'.

Quoted 5 lines
---
  arch/sandbox/dts/test.dts |  8 ++++----
  test/dm/gpio.c            | 12 ++++++------
  2 files changed, 10 insertions(+), 10 deletions(-)

Thanks!

bye,
Heiko

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de

Applied to u-boot-dm, thanks!