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.

(cherry picked from commit 857b9df)

Original-Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
GitOrigin-RevId: 857b9df
Cr-Build-Id: 8739001010820476625
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8739001010820476625
Copybot-Job-Name: zephyr-main-copybot-downstream
Change-Id: I130e00f1fc267390ccf35b98f2509fbb2d93dff8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5803442
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Eric Yilun Lin <yllin@google.com>
Tested-by: Eric Yilun Lin <yllin@google.com>
Commit-Queue: Eric Yilun Lin <yllin@google.com>
  • Loading branch information
rriveramcrus authored and Chromeos LUCI committed Aug 21, 2024
1 parent fb830a4 commit bb9842f
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 bb9842f

Please sign in to comment.