linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PROBLEM]: Error during probing process in inv_icm42600_i2c driver
       [not found] <20211208135644.3523024-1-n.latmos@deepsea.ai>
@ 2021-12-08 14:33 ` Nikos Latmos
  2022-01-30 15:17   ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Nikos Latmos @ 2021-12-08 14:33 UTC (permalink / raw)
  To: jmaneyrol, jic23, lars, linux-iio, linux-kernel

Hello,

I have an ARM device based on the Broadcom BCM2837 processor (quad-core
ARM Cortex-A53, 1.2GHz), which has an Invensense ICM-42605 IMU chip
connected over I2C. I'm running an unmodified Linux 5.4.83 kernel. The I2C
driver for my device is in the following path:
drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c.

The problem is that the device driver cannot be probed. More specifically,
dmesg returns the following error message:

inv-icm42600-i2c 0-0068: mounting matrix not found: using identity...
inv-icm42600-i2c 0-0068: 0-0068 supply vdd not found, using dummy regulator
inv-icm42600-i2c 0-0068: 0-0068 supply vddio not found, using dummy regulator
inv-icm42600-i2c: probe of 0-0068 failed with error -121

During the debugging procedure, I found out that the failure occurred when
the driver tried to set up the I2C bus parameters. More precisely, by setting
the INV_ICM42600_REG_INTF_CONFIG6 register according to the values described
in the datasheet for the I2C communication, actually caused the probe function
to fail and return the error -121.

After I experimented with different values in the specific register bits,
I came to the conclusion, that the setting of the bit
INV_ICM42600_INTF_CONFIG6_I3C_SDR_EN caused the system to successfully
probe the driver. Any other bit setting combinations failed to do so.

Any hints on why would the driver behave so?

Here is a patch that I have so far and it seems to solve the issue.

Best regards,
Nick Latmos


From d7b3922cd0182ba880ff729edb4a156b55dfb6f0 Mon Sep 17 00:00:00 2001
From: nicklat <n.latmos@deepsea.ai>
Date: Wed, 8 Dec 2021 15:51:28 +0200
Subject: [PATCH] iio: imu: inv_icm42600: enable SDR mode

Add SDR (Single Data Rate) support.
In SDR mode, data is only clocked on one edge of the clock.

Without this option enabled, the probing process fails.

Signed-off-by: nicklat <n.latmos@deepsea.ai>
---
 drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
index 85b1934cec60..ea31f102fbca 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
@@ -21,7 +21,8 @@ static int inv_icm42600_i2c_bus_setup(struct
inv_icm42600_state *st)
        /* setup interface registers */
        ret = regmap_update_bits(st->map, INV_ICM42600_REG_INTF_CONFIG6,
                                 INV_ICM42600_INTF_CONFIG6_MASK,
-                                INV_ICM42600_INTF_CONFIG6_I3C_EN);
+                                INV_ICM42600_INTF_CONFIG6_I3C_EN |
+                                INV_ICM42600_INTF_CONFIG6_I3C_SDR_EN);
        if (ret)
                return ret;

--
2.25.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PROBLEM]: Error during probing process in inv_icm42600_i2c driver
  2021-12-08 14:33 ` [PROBLEM]: Error during probing process in inv_icm42600_i2c driver Nikos Latmos
@ 2022-01-30 15:17   ` Jonathan Cameron
  2022-01-31 12:44     ` Jean-Baptiste Maneyrol
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2022-01-30 15:17 UTC (permalink / raw)
  To: Nikos Latmos; +Cc: jmaneyrol, lars, linux-iio, linux-kernel

On Wed, 8 Dec 2021 16:33:52 +0200
Nikos Latmos <n.latmos@deepsea.ai> wrote:

> Hello,
> 
> I have an ARM device based on the Broadcom BCM2837 processor (quad-core
> ARM Cortex-A53, 1.2GHz), which has an Invensense ICM-42605 IMU chip
> connected over I2C. I'm running an unmodified Linux 5.4.83 kernel. The I2C
> driver for my device is in the following path:
> drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c.
> 
> The problem is that the device driver cannot be probed. More specifically,
> dmesg returns the following error message:
> 
> inv-icm42600-i2c 0-0068: mounting matrix not found: using identity...
> inv-icm42600-i2c 0-0068: 0-0068 supply vdd not found, using dummy regulator
> inv-icm42600-i2c 0-0068: 0-0068 supply vddio not found, using dummy regulator
> inv-icm42600-i2c: probe of 0-0068 failed with error -121
> 
> During the debugging procedure, I found out that the failure occurred when
> the driver tried to set up the I2C bus parameters. More precisely, by setting
> the INV_ICM42600_REG_INTF_CONFIG6 register according to the values described
> in the datasheet for the I2C communication, actually caused the probe function
> to fail and return the error -121.
> 
> After I experimented with different values in the specific register bits,
> I came to the conclusion, that the setting of the bit
> INV_ICM42600_INTF_CONFIG6_I3C_SDR_EN caused the system to successfully
> probe the driver. Any other bit setting combinations failed to do so.
> 
> Any hints on why would the driver behave so?
> 
> Here is a patch that I have so far and it seems to solve the issue.
> 
> Best regards,
> Nick Latmos

Hi All,

Anyone familiar with this part able to help Nick?

Thanks,

Jonathan

> 
> 
> From d7b3922cd0182ba880ff729edb4a156b55dfb6f0 Mon Sep 17 00:00:00 2001
> From: nicklat <n.latmos@deepsea.ai>
> Date: Wed, 8 Dec 2021 15:51:28 +0200
> Subject: [PATCH] iio: imu: inv_icm42600: enable SDR mode
> 
> Add SDR (Single Data Rate) support.
> In SDR mode, data is only clocked on one edge of the clock.
> 
> Without this option enabled, the probing process fails.
> 
> Signed-off-by: nicklat <n.latmos@deepsea.ai>
> ---
>  drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
> b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
> index 85b1934cec60..ea31f102fbca 100644
> --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
> +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
> @@ -21,7 +21,8 @@ static int inv_icm42600_i2c_bus_setup(struct
> inv_icm42600_state *st)
>         /* setup interface registers */
>         ret = regmap_update_bits(st->map, INV_ICM42600_REG_INTF_CONFIG6,
>                                  INV_ICM42600_INTF_CONFIG6_MASK,
> -                                INV_ICM42600_INTF_CONFIG6_I3C_EN);
> +                                INV_ICM42600_INTF_CONFIG6_I3C_EN |
> +                                INV_ICM42600_INTF_CONFIG6_I3C_SDR_EN);
>         if (ret)
>                 return ret;
> 
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PROBLEM]: Error during probing process in inv_icm42600_i2c driver
  2022-01-30 15:17   ` Jonathan Cameron
@ 2022-01-31 12:44     ` Jean-Baptiste Maneyrol
  2022-02-02 15:02       ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Baptiste Maneyrol @ 2022-01-31 12:44 UTC (permalink / raw)
  To: Jonathan Cameron, Nikos Latmos; +Cc: jmaneyrol, lars, linux-iio, linux-kernel

Hello,

this is a known issue. When setting I2C parameters, it enables some specific filter for improving transfer quality. These filters are by default disabled to enable I3C usage.

This operation creates a spike in the lines that make the transaction fails even if it is in fact doing OK.

Do not change the register value. The fix is to ignore the return value of the regmap_update_bits done on INV_ICM42600_REG_INTF_CONFIG6.

If you want to create a patch, it would be very welcomed I could review it.

Thanks,
JB


From: Jonathan Cameron <jic23@kernel.org>
Sent: Sunday, January 30, 2022 16:17
To: Nikos Latmos <n.latmos@deepsea.ai>
Cc: jmaneyrol@invensense.com <jmaneyrol@invensense.com>; lars@metafoo.de <lars@metafoo.de>; linux-iio@vger.kernel.org <linux-iio@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>
Subject: Re: [PROBLEM]: Error during probing process in inv_icm42600_i2c driver 
 
 CAUTION: This email originated from outside of the organization. Please make sure the sender is who they say they are and do not click links or open attachments unless you recognize the sender and know the content is safe.

On Wed, 8 Dec 2021 16:33:52 +0200
Nikos Latmos <n.latmos@deepsea.ai> wrote:

> Hello,
> 
> I have an ARM device based on the Broadcom BCM2837 processor (quad-core
> ARM Cortex-A53, 1.2GHz), which has an Invensense ICM-42605 IMU chip
> connected over I2C. I'm running an unmodified Linux 5.4.83 kernel. The I2C
> driver for my device is in the following path:
> drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c.
> 
> The problem is that the device driver cannot be probed. More specifically,
> dmesg returns the following error message:
> 
> inv-icm42600-i2c 0-0068: mounting matrix not found: using identity...
> inv-icm42600-i2c 0-0068: 0-0068 supply vdd not found, using dummy regulator
> inv-icm42600-i2c 0-0068: 0-0068 supply vddio not found, using dummy regulator
> inv-icm42600-i2c: probe of 0-0068 failed with error -121
> 
> During the debugging procedure, I found out that the failure occurred when
> the driver tried to set up the I2C bus parameters. More precisely, by setting
> the INV_ICM42600_REG_INTF_CONFIG6 register according to the values described
> in the datasheet for the I2C communication, actually caused the probe function
> to fail and return the error -121.
> 
> After I experimented with different values in the specific register bits,
> I came to the conclusion, that the setting of the bit
> INV_ICM42600_INTF_CONFIG6_I3C_SDR_EN caused the system to successfully
> probe the driver. Any other bit setting combinations failed to do so.
> 
> Any hints on why would the driver behave so?
> 
> Here is a patch that I have so far and it seems to solve the issue.
> 
> Best regards,
> Nick Latmos

Hi All,

Anyone familiar with this part able to help Nick?

Thanks,

Jonathan

> 
> 
> From d7b3922cd0182ba880ff729edb4a156b55dfb6f0 Mon Sep 17 00:00:00 2001
> From: nicklat <n.latmos@deepsea.ai>
> Date: Wed, 8 Dec 2021 15:51:28 +0200
> Subject: [PATCH] iio: imu: inv_icm42600: enable SDR mode
> 
> Add SDR (Single Data Rate) support.
> In SDR mode, data is only clocked on one edge of the clock.
> 
> Without this option enabled, the probing process fails.
> 
> Signed-off-by: nicklat <n.latmos@deepsea.ai>
> ---
>  drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
> b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
> index 85b1934cec60..ea31f102fbca 100644
> --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
> +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
> @@ -21,7 +21,8 @@ static int inv_icm42600_i2c_bus_setup(struct
> inv_icm42600_state *st)
>         /* setup interface registers */
>         ret = regmap_update_bits(st->map, INV_ICM42600_REG_INTF_CONFIG6,
>                                  INV_ICM42600_INTF_CONFIG6_MASK,
> -                                INV_ICM42600_INTF_CONFIG6_I3C_EN);
> +                                INV_ICM42600_INTF_CONFIG6_I3C_EN |
> +                                INV_ICM42600_INTF_CONFIG6_I3C_SDR_EN);
>         if (ret)
>                 return ret;
> 
> --
> 2.25.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PROBLEM]: Error during probing process in inv_icm42600_i2c driver
  2022-01-31 12:44     ` Jean-Baptiste Maneyrol
@ 2022-02-02 15:02       ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-02-02 15:02 UTC (permalink / raw)
  To: Jean-Baptiste Maneyrol
  Cc: Jonathan Cameron, Nikos Latmos, jmaneyrol, lars, linux-iio, linux-kernel

On Tue, Feb 1, 2022 at 10:17 PM Jean-Baptiste Maneyrol
<Jean-Baptiste.Maneyrol@tdk.com> wrote:
>
> Hello,
>
> this is a known issue. When setting I2C parameters, it enables some specific filter for improving transfer quality. These filters are by default disabled to enable I3C usage.
>
> This operation creates a spike in the lines that make the transaction fails even if it is in fact doing OK.
>
> Do not change the register value. The fix is to ignore the return value of the regmap_update_bits done on INV_ICM42600_REG_INTF_CONFIG6.
>
> If you want to create a patch, it would be very welcomed I could review it.

That patch should have a good comment to summarize the above.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-02 15:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20211208135644.3523024-1-n.latmos@deepsea.ai>
2021-12-08 14:33 ` [PROBLEM]: Error during probing process in inv_icm42600_i2c driver Nikos Latmos
2022-01-30 15:17   ` Jonathan Cameron
2022-01-31 12:44     ` Jean-Baptiste Maneyrol
2022-02-02 15:02       ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).