drivers: haptics: drv2605: Introduces overdrive clamp prop Adds "vib-overdrive-mv" device tree property to configure the overdrive clamp at initialization. Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
diff --git a/drivers/haptics/drv2605.c b/drivers/haptics/drv2605.c index 30306a0..bc8c2f3 100644 --- a/drivers/haptics/drv2605.c +++ b/drivers/haptics/drv2605.c
@@ -461,6 +461,12 @@ return ret; } + ret = i2c_reg_write_byte_dt(&config->i2c, DRV2605_REG_OVERDRIVE_CLAMP_VOLTAGE, + config->overdrive_clamp_voltage); + if (ret < 0) { + return ret; + } + return 0; } @@ -610,6 +616,8 @@ .loop_gain = DT_INST_ENUM_IDX(inst, loop_gain), \ .actuator_mode = DT_INST_ENUM_IDX(inst, actuator_mode), \ .rated_voltage = DRV2605_CALCULATE_VOLTAGE(DT_INST_PROP(inst, vib_rated_mv)), \ + .overdrive_clamp_voltage = \ + DRV2605_CALCULATE_VOLTAGE(DT_INST_PROP(inst, vib_overdrive_mv)), \ }; \ \ static struct drv2605_data drv2605_data_##inst = { \
diff --git a/dts/bindings/haptics/ti,drv2605.yaml b/dts/bindings/haptics/ti,drv2605.yaml index f27a241..484267c 100644 --- a/dts/bindings/haptics/ti,drv2605.yaml +++ b/dts/bindings/haptics/ti,drv2605.yaml
@@ -49,6 +49,12 @@ description: | Sets the reference voltage for full-scale output during closed-loop operation. The default value is inherited from ti,drv260x.yaml in Linux. + vib-overdrive-mv: + type: int + default: 3200 + description: | + Sets a clamp so that the automatic overdrive is bounded. The default + value is inherited from ti,drv260x.yaml in Linux. en-gpios: type: phandle-array description: GPIO to enable and disable the device.