iio: imu: inv_icm42670: add drive-open-drain setting

Signed-off-by: LiuDiMing Lin <fenrir.lin@rock-chips.com>
Change-Id: I78727be0f7554afc4bc884bf0df27d31127c6c7a
This commit is contained in:
LiuDiMing Lin
2025-01-11 16:35:39 +08:00
committed by Tao Huang
parent 195855c2d1
commit 7566b06bc2
2 changed files with 7 additions and 2 deletions

View File

@@ -243,12 +243,12 @@
#define SHIFT_INT1_POLARITY 0x00
#define BIT_ONLY_INT1_ACTIVE_HIGH \
((1 << SHIFT_INT1_POLARITY) | \
(1 << SHIFT_INT1_DRIVE_CIRCUIT) | \
(0 << SHIFT_INT1_MODE))
#define BIT_ONLY_INT1_ACTIVE_LOW \
((0 << SHIFT_INT1_POLARITY) | \
(1 << SHIFT_INT1_DRIVE_CIRCUIT) | \
(0 << SHIFT_INT1_MODE))
#define BIT_ONLY_INT1_OPEN_DRAIN (0 << SHIFT_INT1_DRIVE_CIRCUIT)
#define BIT_ONLY_INT1_PUSH_PULL (1 << SHIFT_INT1_DRIVE_CIRCUIT)
/* Bank0 REG_PWR_MGMT_0 */
#define BIT_PWR_MGMTO_ACCEL_LP_CLK_SEL BIT(7)

View File

@@ -1071,6 +1071,11 @@ int icm42670_core_probe(struct regmap *regmap,
return -EINVAL;
}
if (device_property_read_bool(dev, "drive-open-drain"))
data->irq_mask |= BIT_ONLY_INT1_OPEN_DRAIN;
else
data->irq_mask |= BIT_ONLY_INT1_PUSH_PULL;
data->vdd_supply = devm_regulator_get(dev, "vcc_3v3_s0");
if (IS_ERR(data->vdd_supply)) {
dev_err(dev, "Could not find vdd_avdd!\n");