drivers: pwm_nrf5_sw: Remove PWM_NRF5_SW_0_DEV_NAME Kconfig option

This option determines the name under which the device represented by
the `sw_pwm` node is registered in the system. But when the value of
this option does not match the `label` property of the `sw_pwm` node,
a problem arises when the `sw_pwm` node is referenced by a "pwm-leds"
compatible node, since the `*_PWMS_CONTROLLER` macro that is generated
for this referencing node contains a non-existing device name (as it is
the `label` property value, not the Kconfig option value).
This commit solves the issue described above by removing the Kconfig
option and replacing all of its occurrences in sample applications
by the standard macro generated for the `sw_pwm` node, containing
the value of the `label` property of this node.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2019-10-03 10:54:27 +02:00 committed by Carles Cufí
commit 5239bef610
5 changed files with 4 additions and 15 deletions

View file

@ -14,14 +14,3 @@ menuconfig PWM_NRF5_SW
Enable driver to utilize PWM on the Nordic Semiconductor nRF5x series.
This implementation provides up to 3 pins using one HF timer, two PPI
channels per pin and one GPIOTE config per pin.
if PWM_NRF5_SW
config PWM_NRF5_SW_0_DEV_NAME
string "Nordic Semiconductor nRF5x series S/W PWM Device Name"
default "PWM_0"
help
Specify the device name for the Nordic Semiconductor nRF5x series S/W
PWM driver.
endif # PWM_NRF5_SW

View file

@ -255,7 +255,7 @@ static const struct pwm_config pwm_nrf5_sw_0_config = {
static struct pwm_data pwm_nrf5_sw_0_data;
DEVICE_AND_API_INIT(pwm_nrf5_sw_0,
CONFIG_PWM_NRF5_SW_0_DEV_NAME,
DT_INST_0_NORDIC_NRF_SW_PWM_LABEL,
pwm_nrf5_sw_init,
&pwm_nrf5_sw_0_data,
&pwm_nrf5_sw_0_config,

View file

@ -249,7 +249,7 @@ void board_init(u16_t *addr)
struct mb_display *disp = mb_display_get();
nvm = device_get_binding(DT_FLASH_DEV_NAME);
pwm = device_get_binding(CONFIG_PWM_NRF5_SW_0_DEV_NAME);
pwm = device_get_binding(DT_INST_0_NORDIC_NRF_SW_PWM_LABEL);
*addr = NRF_UICR->CUSTOMER[0];
if (!*addr || *addr == 0xffff) {

View file

@ -510,7 +510,7 @@ void main(void)
k_delayed_work_init(&refresh, game_refresh);
pwm = device_get_binding(CONFIG_PWM_NRF5_SW_0_DEV_NAME);
pwm = device_get_binding(DT_INST_0_NORDIC_NRF_SW_PWM_LABEL);
ble_init();

View file

@ -94,7 +94,7 @@ void main(void)
BIT(DT_ALIAS_SW0_GPIOS_PIN) | BIT(DT_ALIAS_SW1_GPIOS_PIN));
gpio_add_callback(gpio, &button_cb);
pwm = device_get_binding(CONFIG_PWM_NRF5_SW_0_DEV_NAME);
pwm = device_get_binding(DT_INST_0_NORDIC_NRF_SW_PWM_LABEL);
k_work_init(&beep_work, beep);
/* Notify with a beep that we've started */