Skip to content

Commit 857b9df

Browse files
rriveramcrusnashif
authored andcommitted
drivers: haptics: drv2605: Pick up property defaults from DT
Adds the default value for the existing properties to the device tree and fall back on those values at initialization if necessary. Signed-off-by: Ricardo Rivera-Matos <[email protected]>
1 parent 7d58579 commit 857b9df

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

drivers/haptics/drv2605.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,9 @@ static const struct haptics_driver_api drv2605_driver_api = {
597597
.i2c = I2C_DT_SPEC_INST_GET(inst), \
598598
.en_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, en_gpios, {}), \
599599
.in_trig_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, in_trig_gpios, {}), \
600-
.feedback_brake_factor = DT_INST_ENUM_IDX_OR(inst, feedback_brake_factor, 3), \
601-
.loop_gain = DT_INST_ENUM_IDX_OR(inst, loop_gain, 2), \
602-
.actuator_mode = DT_INST_ENUM_IDX_OR(inst, actuator_mode, 0), \
600+
.feedback_brake_factor = DT_INST_ENUM_IDX(inst, feedback_brake_factor), \
601+
.loop_gain = DT_INST_ENUM_IDX(inst, loop_gain), \
602+
.actuator_mode = DT_INST_ENUM_IDX(inst, actuator_mode), \
603603
}; \
604604
\
605605
static struct drv2605_data drv2605_data_##inst = { \

dts/bindings/haptics/ti,drv2605.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,22 @@ properties:
2727
- "8X"
2828
- "16X"
2929
- "DISABLED"
30+
default: "3X"
31+
description: |
32+
Selects the feedback gain ratio between braking gain and driving gain.
33+
According to the datasheet, a value of 2 ("3X") is valid for most
34+
actuators.
3035
loop-gain:
3136
type: string
3237
enum:
3338
- "LOW"
3439
- "MEDIUM"
3540
- "HIGH"
3641
- "VERY_HIGH"
42+
default: "HIGH"
43+
description: |
44+
Selects a loop gain for the feedback control. According to the datasheet,
45+
a value of 2 ("HIGH") is valid for most actuators.
3746
en-gpios:
3847
type: phandle-array
3948
description: GPIO to enable and disable the device.

0 commit comments

Comments
 (0)