[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<DM4PR12MB61095749195041654F6D560D8C5CA@DM4PR12MB6109.namprd12.prod.outlook.com>
Date: Tue, 22 Jul 2025 07:32:54 +0000
From: "Guntupalli, Manikanta" <manikanta.guntupalli@....com>
To: David Lechner <dlechner@...libre.com>, Andy Shevchenko
<andriy.shevchenko@...el.com>
CC: "git (AMD-Xilinx)" <git@....com>, "Simek, Michal" <michal.simek@....com>,
"lorenzo@...nel.org" <lorenzo@...nel.org>, "jic23@...nel.org"
<jic23@...nel.org>, "nuno.sa@...log.com" <nuno.sa@...log.com>,
"andy@...nel.org" <andy@...nel.org>, "linux-iio@...r.kernel.org"
<linux-iio@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "Pandey, Radhey Shyam"
<radhey.shyam.pandey@....com>, "Goud, Srinivas" <srinivas.goud@....com>,
"manion05gk@...il.com" <manion05gk@...il.com>
Subject: RE: [PATCH] iio: imu: lsm6dsx: Add shutdown callback support for I3C
interface
[AMD Official Use Only - AMD Internal Distribution Only]
Hi @David Lechner,
> -----Original Message-----
> From: David Lechner <dlechner@...libre.com>
> Sent: Tuesday, July 22, 2025 2:31 AM
> To: Andy Shevchenko <andriy.shevchenko@...el.com>; Guntupalli, Manikanta
> <manikanta.guntupalli@....com>
> Cc: git (AMD-Xilinx) <git@....com>; Simek, Michal <michal.simek@....com>;
> lorenzo@...nel.org; jic23@...nel.org; nuno.sa@...log.com; andy@...nel.org;
> linux-iio@...r.kernel.org; linux-kernel@...r.kernel.org; Pandey, Radhey Shyam
> <radhey.shyam.pandey@....com>; Goud, Srinivas <srinivas.goud@....com>;
> manion05gk@...il.com
> Subject: Re: [PATCH] iio: imu: lsm6dsx: Add shutdown callback support for I3C
> interface
>
> On 7/21/25 6:38 AM, Andy Shevchenko wrote:
> > On Mon, Jul 21, 2025 at 04:37:41PM +0530, Manikanta Guntupalli wrote:
> >> Add a shutdown handler for the ST LSM6DSx I3C driver to perform a
> >> hardware reset during system shutdown. This ensures the sensor is
> >> placed in a well-defined reset state, preventing issues during
> >> subsequent reboots, such as kexec, where the device may fail to
> >> respond correctly during enumeration.
> >
> > Do you imply that tons of device drivers missing this? I don't think
> > we have even 5% of the drivers implementing the feature.
> >
> In the IIO drivers I've worked on, we always do reset in the probe() function. The
> shutdown() function might not run, e.g. if the board loses power, so it doesn't fix
> 100% of the cases.
Thank you for the input.
You're absolutely right — shutdown() may not cover all cases like power loss. However, in scenarios such as a warm reboot (kexec), the situation is different.
Before the probe is called in the next boot, device enumeration takes place. During this process, the I3C framework compares the device’s PID, BCR, and DCR values against the ones registered in the driver:
static const struct i3c_device_id st_lsm6dsx_i3c_ids[] = {
I3C_DEVICE(0x0104, 0x006C, (void *)ST_LSM6DSO_ID),
I3C_DEVICE(0x0104, 0x006B, (void *)ST_LSM6DSR_ID),
{ }
};
Only if this matching succeeds, the probe will be invoked.
Since the sensor reset logic is placed inside the probe, the device must be in a responsive state during enumeration. In the case of kexec, we observed that the sensor does not respond correctly unless it is explicitly reset during shutdown(). Hence, adding the reset in shutdown() addresses this specific case where the probe isn't reached due to failed enumeration.
Thanks,
Manikanta.
Powered by blists - more mailing lists