Skip to content

Commit

Permalink
drivers: haptics: drv2605: Pick up property defaults from DT
Browse files Browse the repository at this point in the history
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 <rriveram@opensource.cirrus.com>
  • Loading branch information
rriveramcrus authored and nashif committed Aug 20, 2024
1 parent 7d58579 commit 857b9df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/haptics/drv2605.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,9 +597,9 @@ static const struct haptics_driver_api drv2605_driver_api = {
.i2c = I2C_DT_SPEC_INST_GET(inst), \
.en_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, en_gpios, {}), \
.in_trig_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, in_trig_gpios, {}), \
.feedback_brake_factor = DT_INST_ENUM_IDX_OR(inst, feedback_brake_factor, 3), \
.loop_gain = DT_INST_ENUM_IDX_OR(inst, loop_gain, 2), \
.actuator_mode = DT_INST_ENUM_IDX_OR(inst, actuator_mode, 0), \
.feedback_brake_factor = DT_INST_ENUM_IDX(inst, feedback_brake_factor), \
.loop_gain = DT_INST_ENUM_IDX(inst, loop_gain), \
.actuator_mode = DT_INST_ENUM_IDX(inst, actuator_mode), \
}; \
\
static struct drv2605_data drv2605_data_##inst = { \
Expand Down
9 changes: 9 additions & 0 deletions dts/bindings/haptics/ti,drv2605.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,22 @@ properties:
- "8X"
- "16X"
- "DISABLED"
default: "3X"
description: |
Selects the feedback gain ratio between braking gain and driving gain.
According to the datasheet, a value of 2 ("3X") is valid for most
actuators.
loop-gain:
type: string
enum:
- "LOW"
- "MEDIUM"
- "HIGH"
- "VERY_HIGH"
default: "HIGH"
description: |
Selects a loop gain for the feedback control. According to the datasheet,
a value of 2 ("HIGH") is valid for most actuators.
en-gpios:
type: phandle-array
description: GPIO to enable and disable the device.
Expand Down

0 comments on commit 857b9df

Please sign in to comment.