drivers/sensor: lis2dw12: Move power Kconfig property into dts
Move lis2dw12 power-mode option from Kconfigs to Device Tree. Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
parent
56ce558094
commit
a783a062f8
3 changed files with 23 additions and 14 deletions
|
@ -115,16 +115,4 @@ config LIS2DW12_ODR_1600
|
|||
|
||||
endchoice
|
||||
|
||||
config LIS2DW12_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 # LIS2DW12
|
||||
|
|
|
@ -288,7 +288,8 @@ static int lis2dw12_init(const struct device *dev)
|
|||
}
|
||||
|
||||
/* set power mode */
|
||||
if (lis2dw12_set_power_mode(lis2dw12, CONFIG_LIS2DW12_POWER_MODE)) {
|
||||
LOG_DBG("power-mode is %d", cfg->pm);
|
||||
if (lis2dw12_set_power_mode(lis2dw12, cfg->pm)) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -318,7 +319,7 @@ static int lis2dw12_init(const struct device *dev)
|
|||
|
||||
const struct lis2dw12_device_config lis2dw12_cfg = {
|
||||
.bus_name = DT_INST_BUS_LABEL(0),
|
||||
.pm = CONFIG_LIS2DW12_POWER_MODE,
|
||||
.pm = DT_INST_PROP(0, power_mode),
|
||||
#ifdef CONFIG_LIS2DW12_TRIGGER
|
||||
.gpio_int = GPIO_DT_SPEC_INST_GET_OR(0, irq_gpios, {0}),
|
||||
.int_pin = DT_INST_PROP(0, int_pin),
|
||||
|
|
|
@ -30,6 +30,26 @@ properties:
|
|||
mandatory and if not present it defaults to 1 which is the
|
||||
configuration at power-up.
|
||||
|
||||
power-mode:
|
||||
type: int
|
||||
required: false
|
||||
default: 0
|
||||
description: |
|
||||
Specify the sensor power mode. Default is power-up configuration.
|
||||
|
||||
0 # Low Power M1
|
||||
1 # Low Power M2
|
||||
2 # Low Power M3
|
||||
3 # Low Power M4
|
||||
4 # High Performance
|
||||
|
||||
enum:
|
||||
- 0
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- 4
|
||||
|
||||
# tap and tap-tap configuration section
|
||||
# All default values are selected to match the power-up values.
|
||||
# tap and tap-tap events can be generated on INT1 only.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue