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)
static void mpl3115_device_init(struct i2c_client *client)
{
u8 val[8];
+ struct device_node *np = client->dev.of_node;
+
+ /* set interrupt pin as open-drain */
+ if (of_get_property(np, "interrupt-open-drain", NULL)) {
+ val[0] = 0x11;
+ mpl3115_i2c_write(client, MPL3115_CTRL_REG3, val, 1);
+ }
val[0] = 0x28;
mpl3115_i2c_write(client, MPL3115_CTRL_REG1, val, 1);
struct input_dev *idev;
struct i2c_adapter *adapter;
struct mpl3115_data *pdata;
+
adapter = to_i2c_adapter(client->dev.parent);
result = i2c_check_functionality(adapter,
I2C_FUNC_SMBUS_BYTE |
{
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 */
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:
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)