summaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/accel/st_accel_core.c18
-rw-r--r--drivers/iio/common/st_sensors/st_sensors_core.c21
-rw-r--r--drivers/iio/pressure/st_pressure_core.c14
3 files changed, 36 insertions, 17 deletions
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index 731ec3a4c82b..c88db25a1aff 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -236,15 +236,17 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
.int1 = {
.addr = 0x22,
.mask = 0x02,
+ .addr_od = 0x22,
+ .mask_od = 0x40,
},
.int2 = {
.addr = 0x22,
.mask = 0x10,
+ .addr_od = 0x22,
+ .mask_od = 0x40,
},
.addr_ihl = 0x22,
.mask_ihl = 0x80,
- .addr_od = 0x22,
- .mask_od = 0x40,
.stat_drdy = {
.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
.mask = 0x07,
@@ -468,15 +470,17 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
.int1 = {
.addr = 0x22,
.mask = 0x04,
+ .addr_od = 0x22,
+ .mask_od = 0x40,
},
.int2 = {
.addr = 0x22,
.mask = 0x20,
+ .addr_od = 0x22,
+ .mask_od = 0x40,
},
.addr_ihl = 0x22,
.mask_ihl = 0x80,
- .addr_od = 0x22,
- .mask_od = 0x40,
.stat_drdy = {
.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
.mask = 0x07,
@@ -750,15 +754,17 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
.int1 = {
.addr = 0x23,
.mask = 0x01,
+ .addr_od = 0x22,
+ .mask_od = 0x20,
},
.int2 = {
.addr = 0x24,
.mask = 0x01,
+ .addr_od = 0x22,
+ .mask_od = 0x20,
},
.addr_ihl = 0x22,
.mask_ihl = 0x08,
- .addr_od = 0x22,
- .mask_od = 0x20,
.stat_drdy = {
.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
.mask = 0x01,
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 6657160b5a73..40dfdfc0906b 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -319,7 +319,8 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
}
if (pdata->open_drain) {
- if (!sdata->sensor_settings->drdy_irq.addr_od)
+ if (!sdata->sensor_settings->drdy_irq.int1.addr_od &&
+ !sdata->sensor_settings->drdy_irq.int2.addr_od)
dev_err(&indio_dev->dev,
"open drain requested but unsupported.\n");
else
@@ -446,11 +447,21 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
}
if (sdata->int_pin_open_drain) {
+ u8 addr, mask;
+
+ if (sdata->drdy_int_pin == 1) {
+ addr = sdata->sensor_settings->drdy_irq.int1.addr_od;
+ mask = sdata->sensor_settings->drdy_irq.int1.mask_od;
+ } else {
+ addr = sdata->sensor_settings->drdy_irq.int2.addr_od;
+ mask = sdata->sensor_settings->drdy_irq.int2.mask_od;
+ }
+
dev_info(&indio_dev->dev,
- "set interrupt line to open drain mode\n");
- err = st_sensors_write_data_with_mask(indio_dev,
- sdata->sensor_settings->drdy_irq.addr_od,
- sdata->sensor_settings->drdy_irq.mask_od, 1);
+ "set interrupt line to open drain mode on pin %d\n",
+ sdata->drdy_int_pin);
+ err = st_sensors_write_data_with_mask(indio_dev, addr,
+ mask, 1);
if (err < 0)
return err;
}
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 15ad6054d9f6..349e5c713c03 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -283,15 +283,17 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
.int1 = {
.addr = 0x22,
.mask = 0x04,
+ .addr_od = 0x22,
+ .mask_od = 0x40,
},
.int2 = {
.addr = 0x22,
.mask = 0x20,
+ .addr_od = 0x22,
+ .mask_od = 0x40,
},
.addr_ihl = 0x22,
.mask_ihl = 0x80,
- .addr_od = 0x22,
- .mask_od = 0x40,
.stat_drdy = {
.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
.mask = 0x03,
@@ -404,11 +406,11 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
.int1 = {
.addr = 0x23,
.mask = 0x01,
+ .addr_od = 0x22,
+ .mask_od = 0x40,
},
.addr_ihl = 0x22,
.mask_ihl = 0x80,
- .addr_od = 0x22,
- .mask_od = 0x40,
.stat_drdy = {
.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
.mask = 0x03,
@@ -473,11 +475,11 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
.int1 = {
.addr = 0x12,
.mask = 0x04,
+ .addr_od = 0x12,
+ .mask_od = 0x40,
},
.addr_ihl = 0x12,
.mask_ihl = 0x80,
- .addr_od = 0x12,
- .mask_od = 0x40,
.stat_drdy = {
.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
.mask = 0x03,