drivers/sensor: iis2dlpc: Move power Kconfig property into dts

Move iis2dlpc power-mode option from Kconfigs to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
Armando Visconti 2020-11-27 13:53:38 +01:00 committed by Maureen Helm
commit 34a677d05a
3 changed files with 15 additions and 14 deletions

View file

@ -156,16 +156,4 @@ endif # IIS2DLPC_PULSE
endif # IIS2DLPC_TRIGGER endif # IIS2DLPC_TRIGGER
config IIS2DLPC_POWER_MODE
int "Sensor Power Modes"
range 0 4
default 0
help
Specify the sensor power mode
0: Low Power M1
1: Low Power M2
2: Low Power M3
3: Low Power M4
4: High Performance
endif # IIS2DLPC endif # IIS2DLPC

View file

@ -287,7 +287,8 @@ static int iis2dlpc_init(const struct device *dev)
} }
/* set power mode */ /* set power mode */
if (iis2dlpc_set_power_mode(iis2dlpc, CONFIG_IIS2DLPC_POWER_MODE)) { LOG_INF("power-mode is %d", cfg->pm);
if (iis2dlpc_set_power_mode(iis2dlpc, cfg->pm)) {
return -EIO; return -EIO;
} }
@ -373,7 +374,7 @@ static int iis2dlpc_init(const struct device *dev)
const struct iis2dlpc_device_config iis2dlpc_cfg = { const struct iis2dlpc_device_config iis2dlpc_cfg = {
.bus_name = DT_INST_BUS_LABEL(0), .bus_name = DT_INST_BUS_LABEL(0),
.pm = CONFIG_IIS2DLPC_POWER_MODE, .pm = DT_INST_PROP(0, power_mode),
.range = DT_INST_PROP(0, range), .range = DT_INST_PROP(0, range),
#ifdef CONFIG_IIS2DLPC_TRIGGER #ifdef CONFIG_IIS2DLPC_TRIGGER
.int_gpio_port = DT_INST_GPIO_LABEL(0, drdy_gpios), .int_gpio_port = DT_INST_GPIO_LABEL(0, drdy_gpios),

View file

@ -21,3 +21,15 @@ properties:
- 8 # 8g (0.976 mg/LSB) - 8 # 8g (0.976 mg/LSB)
- 4 # 4g (0.488 mg/LSB) - 4 # 4g (0.488 mg/LSB)
- 2 # 2g (0.244 mg/LSB) - 2 # 2g (0.244 mg/LSB)
power-mode:
type: int
required: false
default: 0
description: Specify the sensor power mode. Default is power-up configuration.
enum:
- 0 # Low Power M1
- 1 # Low Power M2
- 2 # Low Power M3
- 3 # Low Power M4
- 4 # High Performance