drivers: sensor: Convert fxos8700 power mode Kconfigs to dts property
Converts fxos8700 power mode options (normal, low noise low power, high
resolution, low power) from Kconfigs to an optional device tree
property.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
diff --git a/drivers/sensor/fxos8700/Kconfig b/drivers/sensor/fxos8700/Kconfig
index 91ba306..3cd4e25 100644
--- a/drivers/sensor/fxos8700/Kconfig
+++ b/drivers/sensor/fxos8700/Kconfig
@@ -38,24 +38,6 @@
device to the next.
choice
- prompt "Power mode"
- default FXOS8700_PM_NORMAL
-
-config FXOS8700_PM_NORMAL
- bool "Normal power mode"
-
-config FXOS8700_PM_LOW_NOISE_LOW_POWER
- bool "Low noise low power mode"
-
-config FXOS8700_PM_HIGH_RESOLUTION
- bool "High resolution power mode"
-
-config FXOS8700_PM_LOW_POWER
- bool "Low power mode"
-
-endchoice
-
-choice
prompt "Trigger mode"
default FXOS8700_TRIGGER_NONE
diff --git a/drivers/sensor/fxos8700/fxos8700.c b/drivers/sensor/fxos8700/fxos8700.c
index 8851a74..6c81e62 100644
--- a/drivers/sensor/fxos8700/fxos8700.c
+++ b/drivers/sensor/fxos8700/fxos8700.c
@@ -555,15 +555,7 @@
.start_channel = FXOS8700_CHANNEL_ACCEL_X,
.num_channels = FXOS8700_NUM_HYBRID_CHANNELS,
#endif
-#if CONFIG_FXOS8700_PM_NORMAL
- .power_mode = FXOS8700_PM_NORMAL,
-#elif CONFIG_FXOS8700_PM_LOW_NOISE_LOW_POWER
- .power_mode = FXOS8700_PM_LOW_NOISE_LOW_POWER,
-#elif CONFIG_FXOS8700_PM_HIGH_RESOLUTION
- .power_mode = FXOS8700_PM_HIGH_RESOLUTION,
-#else
- .power_mode = FXOS8700_PM_LOW_POWER,
-#endif
+ .power_mode = DT_INST_PROP(0, power_mode),
.range = DT_INST_PROP(0, range),
#ifdef CONFIG_FXOS8700_TRIGGER
#ifdef CONFIG_FXOS8700_DRDY_INT1
diff --git a/dts/bindings/sensor/nxp,fxos8700.yaml b/dts/bindings/sensor/nxp,fxos8700.yaml
index 67c28aa..f5949e4 100644
--- a/dts/bindings/sensor/nxp,fxos8700.yaml
+++ b/dts/bindings/sensor/nxp,fxos8700.yaml
@@ -42,6 +42,17 @@
- 4 # 4g (0.488 mg/LSB)
- 2 # 2g (0.244 mg/LSB)
+ power-mode:
+ type: int
+ required: false
+ default: 0
+ description: Power mode
+ enum:
+ - 0 # Normal
+ - 1 # Low noise, low power
+ - 2 # High resolution
+ - 3 # Low power
+
pulse-cfg:
type: int
required: false
diff --git a/samples/sensor/fxos8700/overlay-motion.conf b/samples/sensor/fxos8700/overlay-motion.conf
index 85fdafa..47cfb93 100644
--- a/samples/sensor/fxos8700/overlay-motion.conf
+++ b/samples/sensor/fxos8700/overlay-motion.conf
@@ -1,2 +1 @@
CONFIG_FXOS8700_MOTION=y
-CONFIG_FXOS8700_PM_LOW_POWER=y
diff --git a/samples/sensor/fxos8700/sample.yaml b/samples/sensor/fxos8700/sample.yaml
index 4dc8588..b25b31d 100644
--- a/samples/sensor/fxos8700/sample.yaml
+++ b/samples/sensor/fxos8700/sample.yaml
@@ -14,7 +14,6 @@
- CONFIG_FXOS8700_PULSE_INT1=y
- CONFIG_FXOS8700_MOTION=y
- CONFIG_FXOS8700_MOTION_INT1=y
- - CONFIG_FXOS8700_PM_LOW_POWER=y
sample.sensor.fxos8700.accel:
platform_allow: frdm_kl25z bbc_microbit lpcxpresso55s69_cpu0 reel_board
mimxrt685_evk_cm33