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>
This commit is contained in:
Ricardo Rivera-Matos 2024-08-13 16:27:08 +00:00 committed by Anas Nashif
parent 38b827d18d
commit 6825fc3a9d
2 changed files with 14 additions and 0 deletions

View file

@ -461,6 +461,12 @@ static int drv2605_hw_config(const struct device *dev)
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 @@ static const struct haptics_driver_api drv2605_driver_api = {
.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 = { \

View file

@ -49,6 +49,12 @@ properties:
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.