Re: [PATCH v3 2/2] iio: proximity: add Imagis ISG5320A SAR sensor driver
From: Adil Hüsrev Tepe
Date: Sun Nov 22 2026 - 02:53:02 EST
On Sun, 22 Nov 2026 02:44:59 +0000
Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> Unfortunately this looks a bit too much like an aged vendor driver.
> I've called out a few things but Andy's earlier comment about
> making sure you read other recent drivers and threads will get you
> a long way.
>
> + as others have mentioned, for a new driver at least 1 week is
> appropriate between versions whether or sashiko is making noise.
Thanks for the thorough review, and point taken on the pacing. v4 won't
go out before the end of the week, and it will be a new thread.
I'll take all the style and structure comments: no vendor line
references, no dev_info()/dev_dbg() noise, fsleep(), dev from the
regmap, regmap_multi_reg_write() for the constant sequences,
get_unaligned_be16(), guard() held to the end of the function instead
of scoped_guard(), consistent pm_runtime get/put,
devm_pm_runtime_enable() without the manual dance, no
IRQF_TRIGGER_FALLING fallback, and the teardown split up. I'll also
check which init-table writes are reset defaults and drop those. A few
answers inline:
> > + .cache_type = REGCACHE_NONE,
> Why? I'd expect a brief note if caching can't be used for some reason.
I don't have a reason beyond following the vendor driver. v4 will
either use a cache with the status/data registers marked volatile, or
say why it can't.
> > + ret = devm_regulator_get_enable_optional(dev, "vdd");
> vdd isn't optional. Devices tend not to work great without power..
Agreed. On the XCover5 the sensor is on an always-on rail that isn't
in its DT yet. I'll describe that rail as a fixed regulator there and
make vdd required, with the power-up delay applied unconditionally.
> > + *val = (int)data->thresh - (int)data->far_hyst;
> Does negative make sense? Any idea what the device does if we
> get to that?
I don't know what the chip does there, and I have no datasheet to check
it against. I'll clamp at 0 rather than report a value the hardware may
not honour.
> > + disable_irq(data->irq);
> You've just written a register that sounds like it is preventing them at source.
> Why do you need to disable the irq?
I don't think it's needed; the IRQFUNC write stops them at the chip.
v4 drops it, keeping only a synchronize_irq() where resources go away.
> > +static void isg5320a_shutdown(struct i2c_client *client)
> Why do you care about shutdown?
It mirrors the vendor driver; I don't have a hardware reason for it, so
v4 drops it. That also removes the shutdown vs runtime-resume race
Sashiko flagged on v3.
> Ignore the vendor driver (which is doing it wrong) and research how
> wakeup sources work. They need to be deliberately registered rather
> than just relying on leaving stuff on and hoping right thing happens.
> Until that is in place, I would at least use the DEFINE_RUNTIME_DEV_PM_OPS
> so we get some power saving on suspend.
Ok. v4 uses DEFINE_RUNTIME_DEV_PM_OPS and has no wakeup support; I'll
add that later as a separate patch once it's done properly.
Thanks,
Adil