sensor: nrf5: Convert name to come from device tree

Update the binding for nordic,nrf-temp to require the label property and
use the generated define (DT_INST_0_NORDIC_NRF_TEMP_LABEL) instead of
Kconfig symbol (CONFIG_TEMP_NRF5_NAME).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2019-11-05 08:50:48 -06:00 committed by Carles Cufí
parent 57695b6650
commit b09b773bb5
4 changed files with 6 additions and 13 deletions

View File

@ -25,7 +25,7 @@ LOG_MODULE_DECLARE(clock_control, CONFIG_CLOCK_CONTROL_LOG_LEVEL);
#endif
#define TEMP_SENSOR_NAME \
COND_CODE_1(CONFIG_TEMP_NRF5, (CONFIG_TEMP_NRF5_NAME), (NULL))
COND_CODE_1(CONFIG_TEMP_NRF5, (DT_INST_0_NORDIC_NRF_TEMP_LABEL), (NULL))
/* Calibration state enum */
enum nrf_cal_state {

View File

@ -3,18 +3,8 @@
# Copyright (c) 2016 ARM Ltd.
# SPDX-License-Identifier: Apache-2.0
menuconfig TEMP_NRF5
config TEMP_NRF5
bool "nRF5 Temperature Sensor"
depends on SOC_FAMILY_NRF
help
Enable driver for nRF5 temperature sensor.
if TEMP_NRF5
config TEMP_NRF5_NAME
string "Driver name"
default "TEMP_0"
help
Device name with which the nRF5 temperature sensor is identified.
endif # TEMP_NRF5

View File

@ -123,7 +123,7 @@ static int temp_nrf5_init(struct device *dev)
static struct temp_nrf5_data temp_nrf5_driver;
DEVICE_AND_API_INIT(temp_nrf5,
CONFIG_TEMP_NRF5_NAME,
DT_INST_0_NORDIC_NRF_TEMP_LABEL,
temp_nrf5_init,
&temp_nrf5_driver,
NULL,

View File

@ -16,3 +16,6 @@ properties:
interrupts:
required: true
label:
required: true