summaryrefslogtreecommitdiffstats
path: root/drivers/iio/gyro
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2014-10-10 20:33:26 -0700
committerJonathan Cameron <jic23@kernel.org>2014-11-16 20:19:20 +0000
commit5af6b30788d4f745e62e5cb53850f80222571d3a (patch)
treec6888ba7332d5bdcb37715f7bc6652de74fd806f /drivers/iio/gyro
parent10bef28973071266e85fe7ea50e08ce8f46dc1ca (diff)
downloadtalos-obmc-linux-5af6b30788d4f745e62e5cb53850f80222571d3a.tar.gz
talos-obmc-linux-5af6b30788d4f745e62e5cb53850f80222571d3a.zip
iio: gyro: bmg160: Don't let interrupt mode to be open drain
Change the mode to push/pull type instead of open drain as some platforms fails to drive the GPIO pin with open drain. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/gyro')
-rw-r--r--drivers/iio/gyro/bmg160.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/iio/gyro/bmg160.c b/drivers/iio/gyro/bmg160.c
index 22bf9db538b3..fa2e3766d4a7 100644
--- a/drivers/iio/gyro/bmg160.c
+++ b/drivers/iio/gyro/bmg160.c
@@ -67,6 +67,9 @@
#define BMG160_REG_INT_EN_0 0x15
#define BMG160_DATA_ENABLE_INT BIT(7)
+#define BMG160_REG_INT_EN_1 0x16
+#define BMG160_INT1_BIT_OD BIT(1)
+
#define BMG160_REG_XOUT_L 0x02
#define BMG160_AXIS_TO_REG(axis) (BMG160_REG_XOUT_L + (axis * 2))
@@ -222,6 +225,19 @@ static int bmg160_chip_init(struct bmg160_data *data)
data->slope_thres = ret;
/* Set default interrupt mode */
+ ret = i2c_smbus_read_byte_data(data->client, BMG160_REG_INT_EN_1);
+ if (ret < 0) {
+ dev_err(&data->client->dev, "Error reading reg_int_en_1\n");
+ return ret;
+ }
+ ret &= ~BMG160_INT1_BIT_OD;
+ ret = i2c_smbus_write_byte_data(data->client,
+ BMG160_REG_INT_EN_1, ret);
+ if (ret < 0) {
+ dev_err(&data->client->dev, "Error writing reg_int_en_1\n");
+ return ret;
+ }
+
ret = i2c_smbus_write_byte_data(data->client,
BMG160_REG_INT_RST_LATCH,
BMG160_INT_MODE_LATCH_INT |
OpenPOWER on IntegriCloud