Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TOPIC: GPIO] documentation refinements, test conversion, and sx1509b conversion for new API #18689

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@
/tests/crypto/mbedtls/ @nashif @ceolin
/tests/drivers/can/ @alexanderwachter
/tests/drivers/flash_simulator/ @nvlsianpu
/tests/drivers/gpio/ @pabigot @mnkp
/tests/drivers/hwinfo/ @alexanderwachter
/tests/drivers/spi/ @tbursztyka
/tests/drivers/uart/uart_async_api/ @Mierunski
Expand Down
6 changes: 3 additions & 3 deletions boards/arm/nrf52_pca20020/nrf52_pca20020.dts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
compatible = "gpio-leds";
/* Lightwell RGB */
led0: led_0 {
gpios = <&sx1509b 5 0>;
gpios = <&sx1509b 5 GPIO_ACTIVE_LOW>;
label = "Green LED";
};
led1: led_1 {
gpios = <&sx1509b 6 0>;
gpios = <&sx1509b 6 GPIO_ACTIVE_LOW>;
label = "Blue LED";
};
led2: led_2 {
gpios = <&sx1509b 7 0>;
gpios = <&sx1509b 7 GPIO_ACTIVE_LOW>;
label = "Red LED";
};
};
Expand Down
12 changes: 6 additions & 6 deletions boards/arm/particle_argon/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ static inline void external_antenna(bool on)
}

gpio_pin_configure(ufl_gpio_dev, SKY_UFLn_GPIO_PIN,
GPIO_DIR_OUT | SKY_UFLn_GPIO_FLAGS);
GPIO_OUTPUT | SKY_UFLn_GPIO_FLAGS);
gpio_pin_configure(pcb_gpio_dev, SKY_PCBn_GPIO_PIN,
GPIO_DIR_OUT | SKY_PCBn_GPIO_FLAGS);
GPIO_OUTPUT | SKY_PCBn_GPIO_FLAGS);

if (on) {
gpio_pin_write(ufl_gpio_dev, SKY_UFLn_GPIO_PIN, 1);
gpio_pin_write(pcb_gpio_dev, SKY_PCBn_GPIO_PIN, 0);
gpio_pin_set(ufl_gpio_dev, SKY_UFLn_GPIO_PIN, 1);
gpio_pin_set(pcb_gpio_dev, SKY_PCBn_GPIO_PIN, 0);
} else {
gpio_pin_write(ufl_gpio_dev, SKY_UFLn_GPIO_PIN, 0);
gpio_pin_write(pcb_gpio_dev, SKY_PCBn_GPIO_PIN, 1);
gpio_pin_set(ufl_gpio_dev, SKY_UFLn_GPIO_PIN, 0);
gpio_pin_set(pcb_gpio_dev, SKY_PCBn_GPIO_PIN, 1);
}
}

Expand Down
12 changes: 6 additions & 6 deletions boards/arm/particle_argon/dts/mesh_feather.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,32 @@
leds {
compatible = "gpio-leds";
user_led: led_0 {
gpios = <&gpio1 12 0>;
gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
label = "User LED";
};
status_red: led_1 {
gpios = <&gpio0 13 0>;
gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
label = "Red LED";
};
status_green: led_2 {
gpios = <&gpio0 14 0>;
gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
label = "Green LED";
};
status_blue: led_3 {
gpios = <&gpio0 15 0>;
gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
label = "Blue LED";
};
};

gpio_keys {
compatible = "gpio-keys";
mode_button: button_0 {
gpios = <&gpio0 11 GPIO_PUD_PULL_UP>;
gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Mode Button";
};

reset_button: button_1 {
gpios = <&gpio0 18 GPIO_PUD_PULL_UP>;
gpios = <&gpio0 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Reset Button";
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/particle_argon/particle_argon.dts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

sky13351 {
compatible = "skyworks,sky13351";
vctl1-gpios = <&gpio0 25 0>;
vctl2-gpios = <&gpio0 2 0>;
vctl1-gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
vctl2-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
};
};

Expand Down
6 changes: 3 additions & 3 deletions boards/arm/particle_boron/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ static inline void external_antenna(bool on)
}

gpio_pin_configure(ant_sel_gpio_dev, ANT_SEL_GPIO_PIN,
GPIO_DIR_OUT | ANT_SEL_GPIO_FLAGS);
GPIO_OUTPUT | ANT_SEL_GPIO_FLAGS);

if (on) {
gpio_pin_write(ant_sel_gpio_dev, ANT_SEL_GPIO_PIN, 1);
gpio_pin_set(ant_sel_gpio_dev, ANT_SEL_GPIO_PIN, 1);
} else {
gpio_pin_write(ant_sel_gpio_dev, ANT_SEL_GPIO_PIN, 0);
gpio_pin_set(ant_sel_gpio_dev, ANT_SEL_GPIO_PIN, 0);
}
}

Expand Down
12 changes: 6 additions & 6 deletions boards/arm/particle_boron/dts/mesh_feather.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,32 @@
leds {
compatible = "gpio-leds";
user_led: led_0 {
gpios = <&gpio1 12 0>;
gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
label = "User LED";
};
status_red: led_1 {
gpios = <&gpio0 13 0>;
gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
label = "Red LED";
};
status_green: led_2 {
gpios = <&gpio0 14 0>;
gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
label = "Green LED";
};
status_blue: led_3 {
gpios = <&gpio0 15 0>;
gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
label = "Blue LED";
};
};

gpio_keys {
compatible = "gpio-keys";
mode_button: button_0 {
gpios = <&gpio0 11 GPIO_PUD_PULL_UP>;
gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Mode Button";
};

reset_button: button_1 {
gpios = <&gpio0 18 GPIO_PUD_PULL_UP>;
gpios = <&gpio0 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Reset Button";
};
};
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/particle_boron/particle_boron.dts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

sky13351 {
compatible = "skyworks,sky13351";
vctl1-gpios = <&gpio0 7 0>;
vctl1-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
/* on Boron VCTL2 is inverted VCTL1 signal via SN74LVC1G04
* single inverter gate -- requires a definition below,
* but is not used in board.c */
Expand Down
12 changes: 6 additions & 6 deletions boards/arm/particle_xenon/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ static inline void external_antenna(bool on)
}

gpio_pin_configure(ufl_gpio_dev, SKY_UFLn_GPIO_PIN,
GPIO_DIR_OUT | SKY_UFLn_GPIO_FLAGS);
GPIO_OUTPUT | SKY_UFLn_GPIO_FLAGS);
gpio_pin_configure(pcb_gpio_dev, SKY_PCBn_GPIO_PIN,
GPIO_DIR_OUT | SKY_PCBn_GPIO_FLAGS);
GPIO_OUTPUT | SKY_PCBn_GPIO_FLAGS);

if (on) {
gpio_pin_write(ufl_gpio_dev, SKY_UFLn_GPIO_PIN, 1);
gpio_pin_write(pcb_gpio_dev, SKY_PCBn_GPIO_PIN, 0);
gpio_pin_set(ufl_gpio_dev, SKY_UFLn_GPIO_PIN, 1);
gpio_pin_set(pcb_gpio_dev, SKY_PCBn_GPIO_PIN, 0);
} else {
gpio_pin_write(ufl_gpio_dev, SKY_UFLn_GPIO_PIN, 0);
gpio_pin_write(pcb_gpio_dev, SKY_PCBn_GPIO_PIN, 1);
gpio_pin_set(ufl_gpio_dev, SKY_UFLn_GPIO_PIN, 0);
gpio_pin_set(pcb_gpio_dev, SKY_PCBn_GPIO_PIN, 1);
}
}

Expand Down
12 changes: 6 additions & 6 deletions boards/arm/particle_xenon/dts/mesh_feather.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,32 @@
leds {
compatible = "gpio-leds";
user_led: led_0 {
gpios = <&gpio1 12 0>;
gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
label = "User LED";
};
status_red: led_1 {
gpios = <&gpio0 13 0>;
gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
label = "Red LED";
};
status_green: led_2 {
gpios = <&gpio0 14 0>;
gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
label = "Green LED";
};
status_blue: led_3 {
gpios = <&gpio0 15 0>;
gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
label = "Blue LED";
};
};

gpio_keys {
compatible = "gpio-keys";
mode_button: button_0 {
gpios = <&gpio0 11 GPIO_PUD_PULL_UP>;
gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Mode Button";
};

reset_button: button_1 {
gpios = <&gpio0 18 GPIO_PUD_PULL_UP>;
gpios = <&gpio0 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Reset Button";
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/particle_xenon/particle_xenon.dts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

sky13351 {
compatible = "skyworks,sky13351";
vctl1-gpios = <&gpio0 24 0>;
vctl2-gpios = <&gpio0 25 0>;
vctl1-gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
vctl2-gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
};
};
47 changes: 0 additions & 47 deletions drivers/gpio/gpio_gecko.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,51 +160,6 @@ static int gpio_gecko_configure(struct device *dev,
return 0;
}

static int gpio_gecko_write(struct device *dev,
int access_op, u32_t pin, u32_t value)
{
const struct gpio_gecko_config *config = dev->config->config_info;
GPIO_P_TypeDef *gpio_base = config->gpio_base;

if (access_op == GPIO_ACCESS_BY_PIN) {
if (value) {
/* Set the data output for the corresponding pin.
* Writing zeros to the other bits leaves the data
* output unchanged for the other pins.
*/
GPIO_PinOutSet(config->gpio_index, pin);
} else {
/* Clear the data output for the corresponding pin.
* Writing zeros to the other bits leaves the data
* output unchanged for the other pins.
*/
GPIO_PinOutClear(config->gpio_index, pin);
}
} else { /* GPIO_ACCESS_BY_PORT */
/* Write the data output for all the pins */
gpio_base->DOUT = value;
}

return 0;
}

static int gpio_gecko_read(struct device *dev,
int access_op, u32_t pin, u32_t *value)
{
const struct gpio_gecko_config *config = dev->config->config_info;
GPIO_P_TypeDef *gpio_base = config->gpio_base;

*value = gpio_base->DIN;

if (access_op == GPIO_ACCESS_BY_PIN) {
*value = (*value & BIT(pin)) >> pin;
}

/* nothing more to do for GPIO_ACCESS_BY_PORT */

return 0;
}

static int gpio_gecko_port_get_raw(struct device *dev, u32_t *value)
{
const struct gpio_gecko_config *config = dev->config->config_info;
Expand Down Expand Up @@ -373,8 +328,6 @@ static void gpio_gecko_common_isr(void *arg)

static const struct gpio_driver_api gpio_gecko_driver_api = {
.config = gpio_gecko_configure,
.write = gpio_gecko_write,
.read = gpio_gecko_read,
.port_get_raw = gpio_gecko_port_get_raw,
.port_set_masked_raw = gpio_gecko_port_set_masked_raw,
.port_set_bits_raw = gpio_gecko_port_set_bits_raw,
Expand Down
47 changes: 0 additions & 47 deletions drivers/gpio/gpio_mcux.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,51 +179,6 @@ static int gpio_mcux_configure(struct device *dev,
return 0;
}

static int gpio_mcux_write(struct device *dev,
int access_op, u32_t pin, u32_t value)
{
const struct gpio_mcux_config *config = dev->config->config_info;
GPIO_Type *gpio_base = config->gpio_base;

if (access_op == GPIO_ACCESS_BY_PIN) {
if (value) {
/* Set the data output for the corresponding pin.
* Writing zeros to the other bits leaves the data
* output unchanged for the other pins.
*/
gpio_base->PSOR = BIT(pin);
} else {
/* Clear the data output for the corresponding pin.
* Writing zeros to the other bits leaves the data
* output unchanged for the other pins.
*/
gpio_base->PCOR = BIT(pin);
}
} else { /* GPIO_ACCESS_BY_PORT */
/* Write the data output for all the pins */
gpio_base->PDOR = value;
}

return 0;
}

static int gpio_mcux_read(struct device *dev,
int access_op, u32_t pin, u32_t *value)
{
const struct gpio_mcux_config *config = dev->config->config_info;
GPIO_Type *gpio_base = config->gpio_base;

*value = gpio_base->PDIR;

if (access_op == GPIO_ACCESS_BY_PIN) {
*value = (*value & BIT(pin)) >> pin;
}

/* nothing more to do for GPIO_ACCESS_BY_PORT */

return 0;
}

static int gpio_mcux_port_get_raw(struct device *dev, u32_t *value)
{
const struct gpio_mcux_config *config = dev->config->config_info;
Expand Down Expand Up @@ -357,8 +312,6 @@ static void gpio_mcux_port_isr(void *arg)

static const struct gpio_driver_api gpio_mcux_driver_api = {
.config = gpio_mcux_configure,
.write = gpio_mcux_write,
.read = gpio_mcux_read,
.port_get_raw = gpio_mcux_port_get_raw,
.port_set_masked_raw = gpio_mcux_port_set_masked_raw,
.port_set_bits_raw = gpio_mcux_port_set_bits_raw,
Expand Down
Loading