drivers: led_strip: ws2812_gpio: Rename in-gpios property to gpios

ws2812-gpio's `in-gpios` property is not used as an input pin.
Renaming it to `gpios` to reflect the actual situation.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
This commit is contained in:
TOKITA Hiroshi 2024-02-05 21:48:58 +09:00 committed by Henrik Brix Andersen
parent 8b9464089c
commit 0702f0eb45
5 changed files with 14 additions and 8 deletions

View file

@ -95,6 +95,12 @@ Input
Interrupt Controller Interrupt Controller
==================== ====================
LED Strip
=========
* The property ``in-gpios`` defined in :dtcompatible:`worldsemi,ws2812-gpio` has been
renamed to ``gpios``.
Sensors Sensors
======= =======

View file

@ -25,7 +25,7 @@ LOG_MODULE_REGISTER(ws2812_gpio);
#include <zephyr/dt-bindings/led/led.h> #include <zephyr/dt-bindings/led/led.h>
struct ws2812_gpio_cfg { struct ws2812_gpio_cfg {
struct gpio_dt_spec in_gpio; struct gpio_dt_spec gpio;
uint8_t num_colors; uint8_t num_colors;
const uint8_t *color_mapping; const uint8_t *color_mapping;
}; };
@ -91,7 +91,7 @@ static int send_buf(const struct device *dev, uint8_t *buf, size_t len)
{ {
const struct ws2812_gpio_cfg *config = dev->config; const struct ws2812_gpio_cfg *config = dev->config;
volatile uint32_t *base = (uint32_t *)&NRF_GPIO->OUTSET; volatile uint32_t *base = (uint32_t *)&NRF_GPIO->OUTSET;
const uint32_t val = BIT(config->in_gpio.pin); const uint32_t val = BIT(config->gpio.pin);
struct onoff_manager *mgr = struct onoff_manager *mgr =
z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF); z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF);
struct onoff_client cli; struct onoff_client cli;
@ -216,7 +216,7 @@ static const uint8_t ws2812_gpio_##idx##_color_mapping[] = \
const struct ws2812_gpio_cfg *cfg = dev->config; \ const struct ws2812_gpio_cfg *cfg = dev->config; \
uint8_t i; \ uint8_t i; \
\ \
if (!gpio_is_ready_dt(&cfg->in_gpio)) { \ if (!gpio_is_ready_dt(&cfg->gpio)) { \
LOG_ERR("GPIO device not ready"); \ LOG_ERR("GPIO device not ready"); \
return -ENODEV; \ return -ENODEV; \
} \ } \
@ -236,13 +236,13 @@ static const uint8_t ws2812_gpio_##idx##_color_mapping[] = \
} \ } \
} \ } \
\ \
return gpio_pin_configure_dt(&cfg->in_gpio, GPIO_OUTPUT); \ return gpio_pin_configure_dt(&cfg->gpio, GPIO_OUTPUT); \
} \ } \
\ \
WS2812_COLOR_MAPPING(idx); \ WS2812_COLOR_MAPPING(idx); \
\ \
static const struct ws2812_gpio_cfg ws2812_gpio_##idx##_cfg = { \ static const struct ws2812_gpio_cfg ws2812_gpio_##idx##_cfg = { \
.in_gpio = GPIO_DT_SPEC_INST_GET(idx, in_gpios), \ .gpio = GPIO_DT_SPEC_INST_GET(idx, gpios), \
.num_colors = WS2812_NUM_COLORS(idx), \ .num_colors = WS2812_NUM_COLORS(idx), \
.color_mapping = ws2812_gpio_##idx##_color_mapping, \ .color_mapping = ws2812_gpio_##idx##_color_mapping, \
}; \ }; \

View file

@ -14,7 +14,7 @@ compatible: "worldsemi,ws2812-gpio"
include: [base.yaml, ws2812.yaml] include: [base.yaml, ws2812.yaml]
properties: properties:
in-gpios: gpios:
type: phandle-array type: phandle-array
required: true required: true
description: | description: |

View file

@ -16,7 +16,7 @@
LED_COLOR_ID_RED LED_COLOR_ID_RED
LED_COLOR_ID_BLUE>; LED_COLOR_ID_BLUE>;
/* P0: */ /* P0: */
in-gpios = <&gpio0 3 0>; gpios = <&gpio0 3 0>;
}; };
aliases { aliases {

View file

@ -19,7 +19,7 @@
* Arduino D11 / P0.25, which was chosen to match the pin * Arduino D11 / P0.25, which was chosen to match the pin
* used in nrf52dk_nrf52832.overlay. * used in nrf52dk_nrf52832.overlay.
*/ */
in-gpios = <&gpio0 25 0>; gpios = <&gpio0 25 0>;
}; };
aliases { aliases {