From ba4adf399f7098824c03f500ecd6e4cfb95d0603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 19 Nov 2019 15:10:44 +0100 Subject: [PATCH 1/2] boards: actinius_icarus: Update to use the new GPIO API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In initialization code, pairs of gpio_pin_configure/gpio_pin_write are replaced with calls to gpio_pin_configure that configure a given pin as output with the proper initial state. dts file for the board is also updated with the new GPIO flags. Signed-off-by: Andrzej Głąbek --- boards/arm/actinius_icarus/actinius_icarus_common.dts | 8 ++++---- boards/arm/actinius_icarus/board.c | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/boards/arm/actinius_icarus/actinius_icarus_common.dts b/boards/arm/actinius_icarus/actinius_icarus_common.dts index 6c1a3ba757585..e6f0f9aa13cb3 100644 --- a/boards/arm/actinius_icarus/actinius_icarus_common.dts +++ b/boards/arm/actinius_icarus/actinius_icarus_common.dts @@ -19,17 +19,17 @@ compatible = "gpio-leds"; red_led: led_0 { - gpios = <&gpio0 10 GPIO_INT_ACTIVE_LOW>; + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; label = "Red LED"; }; green_led: led_1 { - gpios = <&gpio0 11 GPIO_INT_ACTIVE_LOW>; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; label = "Green LED"; }; blue_led: led_2 { - gpios = <&gpio0 12 GPIO_INT_ACTIVE_LOW>; + gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; label = "Blue LED"; }; }; @@ -38,7 +38,7 @@ compatible = "gpio-keys"; button0: button_0 { - gpios = <&gpio0 5 (GPIO_PUD_PULL_UP | GPIO_INT_ACTIVE_LOW)>; + gpios = <&gpio0 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; label = "Push Button 1"; }; }; diff --git a/boards/arm/actinius_icarus/board.c b/boards/arm/actinius_icarus/board.c index c7c8eb86364e7..929654624f265 100644 --- a/boards/arm/actinius_icarus/board.c +++ b/boards/arm/actinius_icarus/board.c @@ -22,12 +22,11 @@ static void select_sim(void) return; } - gpio_pin_configure(port, SIM_SELECT_PIN, GPIO_DIR_OUT); #ifdef CONFIG_BOARD_SELECT_SIM_EXTERNAL - gpio_pin_write(port, SIM_SELECT_PIN, 0); + gpio_pin_configure(port, SIM_SELECT_PIN, GPIO_OUTPUT_LOW); LOG_INF("External SIM is selected"); #else - gpio_pin_write(port, SIM_SELECT_PIN, 1); + gpio_pin_configure(port, SIM_SELECT_PIN, GPIO_OUTPUT_HIGH); LOG_INF("eSIM is selected"); #endif } From 3e273c123fd0d8628006d3cb382eb8495dc98ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 19 Nov 2019 15:12:42 +0100 Subject: [PATCH 2/2] boards: degu_evk: Update to use the new GPIO API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In initialization code, pairs of gpio_pin_configure/gpio_pin_write are replaced with calls to gpio_pin_configure that configure a given pin as output with the proper initial state. dts file for the board is also updated with the new GPIO flags. Signed-off-by: Andrzej Głąbek --- boards/arm/degu_evk/board.c | 9 +++------ boards/arm/degu_evk/degu_evk.dts | 14 +++++++------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/boards/arm/degu_evk/board.c b/boards/arm/degu_evk/board.c index fa15bca6038ad..4b3b2944c7bfb 100644 --- a/boards/arm/degu_evk/board.c +++ b/boards/arm/degu_evk/board.c @@ -18,20 +18,17 @@ static int board_degu_evk_init(struct device *dev) * Degu Evaluation Kit has a TPS22916C power switch. * It is connected to GPIO0_26 so we must enable it. */ - gpio_pin_configure(gpio0, 26, GPIO_DIR_OUT); - gpio_pin_write(gpio0, 26, 1); + gpio_pin_configure(gpio0, 26, GPIO_OUTPUT_HIGH); /* * We must enable GPIO1_2 to use Secure Element. */ - gpio_pin_configure(gpio1, 2, GPIO_DIR_OUT); - gpio_pin_write(gpio1, 2, 1); + gpio_pin_configure(gpio1, 2, GPIO_OUTPUT_HIGH); /* * We must enable GPIO1_6 to read Vin voltage. */ - gpio_pin_configure(gpio1, 6, GPIO_DIR_OUT); - gpio_pin_write(gpio1, 6, 1); + gpio_pin_configure(gpio1, 6, GPIO_OUTPUT_HIGH); return 0; } diff --git a/boards/arm/degu_evk/degu_evk.dts b/boards/arm/degu_evk/degu_evk.dts index f7ed6c1c20582..0128b67bb5ea9 100644 --- a/boards/arm/degu_evk/degu_evk.dts +++ b/boards/arm/degu_evk/degu_evk.dts @@ -21,19 +21,19 @@ leds { compatible = "gpio-leds"; led0: led_0 { - gpios = <&gpio1 7 GPIO_INT_ACTIVE_LOW>; + gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; label = "LED1"; }; led1: led_1 { - gpios = <&gpio1 5 GPIO_INT_ACTIVE_LOW>; + gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; label = "LED2"; }; led2: led_2 { - gpios = <&gpio1 3 GPIO_INT_ACTIVE_LOW>; + gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; label = "LED3"; }; led3: led_3 { - gpios = <&gpio1 4 GPIO_INT_ACTIVE_LOW>; + gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; label = "LED4"; }; }; @@ -41,15 +41,15 @@ buttons { compatible = "gpio-keys"; button0: button_0 { - gpios = <&gpio1 0 GPIO_PUD_PULL_UP>; + gpios = <&gpio1 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; label = "SW2"; }; button1: button_1 { - gpios = <&gpio1 1 GPIO_PUD_PULL_UP>; + gpios = <&gpio1 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; label = "SW3"; }; button2: button_2 { - gpios = <&gpio1 14 GPIO_PUD_PULL_UP>; + gpios = <&gpio1 14 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; label = "SW4"; }; };