Devicetree
 help / color / mirror / Atom feed
From: "Adil Hüsrev Tepe" <tadilhusrev@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Joshua Crofts" <crofts@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] iio: proximity: add Imagis ISG5320A SAR sensor driver
Date: Sun, 22 Nov 2026 10:52:51 +0300	[thread overview]
Message-ID: <20261122075251.2918277-1-tadilhusrev@gmail.com> (raw)
In-Reply-To: <20261122024459.2c30cf99@jic23-hlaptop>

On Sun, 22 Nov 2026 02:44:59 +0000
Jonathan Cameron <jic23@kernel.org> 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

  reply	other threads:[~2026-11-22  7:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  7:40 [PATCH v1 0/2] iio: proximity: add Imagis ISG5320A (Samsung Galaxy XCover5) Adil Hüsrev Tepe
2026-11-16  7:40 ` [PATCH v1 1/2] dt-bindings: iio: proximity: add Imagis ISG5320A Adil Hüsrev Tepe
2026-11-16  7:51   ` sashiko-bot
2026-11-16  7:40 ` [PATCH v1 2/2] iio: proximity: add Imagis ISG5320A SAR sensor driver Adil Hüsrev Tepe
2026-11-16  7:58   ` sashiko-bot
2026-11-16 10:53   ` Andy Shevchenko
2026-11-16 10:48 ` [PATCH v1 0/2] iio: proximity: add Imagis ISG5320A (Samsung Galaxy XCover5) Andy Shevchenko
2026-11-17 10:44 ` [PATCH v2 1/2] dt-bindings: iio: proximity: add Imagis ISG5320A Adil Hüsrev Tepe
2026-11-17 10:44   ` [PATCH v2 2/2] iio: proximity: add Imagis ISG5320A SAR sensor driver Adil Hüsrev Tepe
2026-11-17 11:08     ` sashiko-bot
2026-11-17 13:56     ` Andy Shevchenko
2026-11-17 10:54   ` [PATCH v2 1/2] dt-bindings: iio: proximity: add Imagis ISG5320A sashiko-bot
2026-11-17 17:33 ` [PATCH v3 0/2] iio: proximity: add Imagis ISG5320A (Samsung Galaxy XCover5) Adil Hüsrev Tepe
2026-11-17 17:33   ` [PATCH v3 1/2] dt-bindings: iio: proximity: add Imagis ISG5320A Adil Hüsrev Tepe
2026-11-21 12:23     ` Krzysztof Kozlowski
2026-11-22  7:52       ` Adil Hüsrev Tepe
2026-11-17 17:33   ` [PATCH v3 2/2] iio: proximity: add Imagis ISG5320A SAR sensor driver Adil Hüsrev Tepe
2026-11-17 17:55     ` sashiko-bot
2026-11-18  9:53     ` Joshua Crofts
2026-11-22  7:53       ` Adil Hüsrev Tepe
2026-11-22  2:44     ` Jonathan Cameron
2026-11-22  7:52       ` Adil Hüsrev Tepe [this message]
2026-11-18  9:00   ` [PATCH v3 0/2] iio: proximity: add Imagis ISG5320A (Samsung Galaxy XCover5) Joshua Crofts

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=20261122075251.2918277-1-tadilhusrev@gmail.com \
    --to=tadilhusrev@gmail.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=crofts@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    /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