public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: haibo.chen@nxp.com
To: jic23@kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org,
	pmeerw@pmeerw.net
Cc: haibo.chen@nxp.com, linux-imx@nxp.com
Subject: [PATCH] iio: accel: mma8452: remove the reset operation during driver probe
Date: Tue, 22 Feb 2022 12:45:51 +0800	[thread overview]
Message-ID: <1645505151-5789-1-git-send-email-haibo.chen@nxp.com> (raw)

From: Haibo Chen <haibo.chen@nxp.com>

Though Sensor Datasheet define this reset bit in it's CTRL_REG2
register, but seems the actual hardware behavior do not align with
the doc expect. Once the reset bit is set, sensor can’t give back
an I2C ack, which will cause the probe fail. So just remove this
reset operation.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/iio/accel/mma8452.c | 28 ----------------------------
 1 file changed, 28 deletions(-)

diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index 0016bb947c10..ec9e26fdfb2a 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -1481,30 +1481,6 @@ static void mma8452_trigger_cleanup(struct iio_dev *indio_dev)
 		iio_trigger_unregister(indio_dev->trig);
 }
 
-static int mma8452_reset(struct i2c_client *client)
-{
-	int i;
-	int ret;
-
-	ret = i2c_smbus_write_byte_data(client,	MMA8452_CTRL_REG2,
-					MMA8452_CTRL_REG2_RST);
-	if (ret < 0)
-		return ret;
-
-	for (i = 0; i < 10; i++) {
-		usleep_range(100, 200);
-		ret = i2c_smbus_read_byte_data(client, MMA8452_CTRL_REG2);
-		if (ret == -EIO)
-			continue; /* I2C comm reset */
-		if (ret < 0)
-			return ret;
-		if (!(ret & MMA8452_CTRL_REG2_RST))
-			return 0;
-	}
-
-	return -ETIMEDOUT;
-}
-
 static const struct of_device_id mma8452_dt_ids[] = {
 	{ .compatible = "fsl,mma8451", .data = &mma_chip_info_table[mma8451] },
 	{ .compatible = "fsl,mma8452", .data = &mma_chip_info_table[mma8452] },
@@ -1591,10 +1567,6 @@ static int mma8452_probe(struct i2c_client *client,
 	indio_dev->num_channels = data->chip_info->num_channels;
 	indio_dev->available_scan_masks = mma8452_scan_masks;
 
-	ret = mma8452_reset(client);
-	if (ret < 0)
-		goto disable_regulators;
-
 	data->data_cfg = MMA8452_DATA_CFG_FS_2G;
 	ret = i2c_smbus_write_byte_data(client, MMA8452_DATA_CFG,
 					data->data_cfg);
-- 
2.25.1


             reply	other threads:[~2022-02-22  5:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22  4:45 haibo.chen [this message]
2022-02-22 16:43 ` [PATCH] iio: accel: mma8452: remove the reset operation during driver probe Jonathan Cameron
2022-02-24 14:31   ` Bough Chen
2022-02-24 17:33     ` Wolfram Sang
2022-06-04 16:16       ` Jonathan Cameron
2022-06-06  2:06         ` Bough Chen
2022-06-15 11:26         ` Bough Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1645505151-5789-1-git-send-email-haibo.chen@nxp.com \
    --to=haibo.chen@nxp.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox