From bb9842f85863ea682b81ce0b60efa405e9f5a9e4 Mon Sep 17 00:00:00 2001 From: Ricardo Rivera-Matos Date: Tue, 13 Aug 2024 16:53:08 +0000 Subject: [PATCH] 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. (cherry picked from commit 857b9df26edcc1166bf062e065a191f630a01e93) Original-Signed-off-by: Ricardo Rivera-Matos GitOrigin-RevId: 857b9df26edcc1166bf062e065a191f630a01e93 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) Reviewed-by: Eric Yilun Lin Tested-by: Eric Yilun Lin Commit-Queue: Eric Yilun Lin --- drivers/haptics/drv2605.c | 6 +++--- dts/bindings/haptics/ti,drv2605.yaml | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/haptics/drv2605.c b/drivers/haptics/drv2605.c index 75a639e4c69..87eb4b7e442 100644 --- a/drivers/haptics/drv2605.c +++ b/drivers/haptics/drv2605.c @@ -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 = { \ diff --git a/dts/bindings/haptics/ti,drv2605.yaml b/dts/bindings/haptics/ti,drv2605.yaml index 1664a0f9379..6b3932feb61 100644 --- a/dts/bindings/haptics/ti,drv2605.yaml +++ b/dts/bindings/haptics/ti,drv2605.yaml @@ -27,6 +27,11 @@ 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: @@ -34,6 +39,10 @@ properties: - "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.