Re: [PATCH] iio: imu: st_lsm6dsx: deselect shub page before reading whoami

From: Andreas Kempe

Date: Thu Jun 04 2026 - 12:38:39 EST


On Thu, Jun 04, 2026 at 06:14:11PM +0200, David Lechner wrote:
> On Thu, Jun 4, 2026 at 5:29 PM Andreas Kempe <andreas.kempe@xxxxxxxx> wrote:
> >
> > On Thu, Jun 04, 2026 at 04:36:40PM +0200, Lorenzo Bianconi wrote:
> > > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > >
> > > >
> > > > > Is it enough, if the shub is available, to just always run
> > > > > st_lsm6dsx_set_page(, false) before checking the whoami?
> > > > >
> > > >
> > > > I think that should be fine, yes. I only added the readout to lessen
> > > > the risk of unnecessary writes to potentially unknown devices.
> > >
> > > I guess you just need to check the shub is supported, then it is fine to
> > > disable shub register access at that point (it is supposed to be that way).
> > >
> >
> > You are thinking of gating st_lsm6dsx_set_page() on
> > shub_settings.page_mux.addr like I do, but without the read? Or do you
> > want to gate on something else?
>
> How about setting the SW_RESET bit in the CTRL3_C register during
> probe too to ensure the rest of the registers are in a known state?
>

While the shub register file is selected, the reset register is
shadowed so it can't be written without first selecting the normal
register file. A reset is already called from probe in
st_lsm6dsx_init_device() after the whoami check has passed.

> >
> > I'm willing to submit a v2 if you want it.
> >
> >
> > Best regards,
> > Andreas Kempe
> >