diff options
author | Gao Pan <pandy.gao@nxp.com> | 2017-12-04 13:27:00 +0800 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:29:35 +0800 |
commit | 1e03bfc519771f13749d5feff1915d3365c1023e (patch) | |
tree | 8e2f75ea832a5eadea4363292536e9b2eee7be8f /drivers/misc | |
parent | 172aa02e1dc10942ddf476e1e0bde0c9808d56c8 (diff) |
MLK-17061-1 sensor: set sensor interrupt pins as open-drain
The sensors share an interrupt pin on imx8qm/imx8qxp mek.
As a result, the interrupt signals will be interfered by
each other in default push-pull status.
This patch sets sensor interrupt pins as open-drain when
necessary.
Signed-off-by: Gao Pan <pandy.gao@nxp.com>
(cherry-picked from 48bcb7aafa2a3ced923d1a1753bb19d89a9fc273)
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/fxas2100x.c | 10 | ||||
-rw-r--r-- | drivers/misc/fxos8700.c | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/drivers/misc/fxas2100x.c b/drivers/misc/fxas2100x.c index 3ac718067a75..04541cfb5d14 100644 --- a/drivers/misc/fxas2100x.c +++ b/drivers/misc/fxas2100x.c @@ -147,6 +147,8 @@ static int fxas2100x_device_init(struct i2c_client *client) { int result; u8 val; + struct device_node *np = client->dev.of_node; + struct fxas2100x_data *pdata = i2c_get_clientdata(client); if (pdata->chip_id == FXAS21000_CHIP_ID) val = (0x01 << 2); /* fxas21000 dr 200HZ */ @@ -155,6 +157,14 @@ static int fxas2100x_device_init(struct i2c_client *client) result = i2c_smbus_write_byte_data(client, FXAS2100X_CTRL_REG1, val); if (result < 0) goto out; + + /* set interrupt pin as open-drain */ + if (of_get_property(np, "interrupt-open-drain", NULL)) { + result = i2c_smbus_write_byte_data(client, FXAS2100X_CTRL_REG2, 0x01); + if (result < 0) + goto out; + } + atomic_set(&pdata->active, STANDBY); return 0; out: diff --git a/drivers/misc/fxos8700.c b/drivers/misc/fxos8700.c index 326e2accde1b..e9a07113281f 100644 --- a/drivers/misc/fxos8700.c +++ b/drivers/misc/fxos8700.c @@ -283,8 +283,16 @@ static int fxos8700_set_odr(struct i2c_client *client, int type, int delay) static int fxos8700_device_init(struct i2c_client *client) { int result; + struct device_node *np = client->dev.of_node; struct fxos8700_data *pdata = i2c_get_clientdata(client); + /* set interrupt pin as open-drain */ + if (of_get_property(np, "interrupt-open-drain", NULL)) { + result = i2c_smbus_write_byte_data(client, FXOS8700_CTRL_REG3, 0x01); + if (result < 0) + goto out; + } + /* standby mode */ result = i2c_smbus_write_byte_data(client, FXOS8700_CTRL_REG1, 0x00); if (result < 0) |