From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-iio@vger.kernel.org>,
<devicetree@vger.kernel.org>
Subject: Re: [PATCH 1/2] iio: light: add VEML6075 UVA and UVB light sensor driver
Date: Mon, 20 Nov 2023 17:01:13 +0000 [thread overview]
Message-ID: <20231120170113.00000992@Huawei.com> (raw)
In-Reply-To: <588dd3f4-bea5-4453-9ef6-f92fb42c7514@gmail.com>
On Sun, 19 Nov 2023 18:40:16 +0100
Javier Carrasco <javier.carrasco.cruz@gmail.com> wrote:
> On 19.11.23 16:02, Jonathan Cameron wrote:
> >> +
> >> +struct veml6075_data {
> >> + struct i2c_client *client;
> >> + struct regmap *regmap;
> >> + struct mutex lock; /* register access lock */
> >
> > regmap provides register locking as typically does the bus lock, so good to
> > say exactly what you mean here. Is there a Read Modify Write cycle you need
> > to protect for instance, or consistency across multiple register accesses?
> >
> What I want to avoid with this lock is an access to the measurement
> trigger or an integration time modification from different places while
> there is a measurement reading going on. "register access lock" is
> probably not the best name I could have chosen though.
>
> I was not aware of that guard(mutex) mechanism. I guess it is new
> because only one driver uses it in the iio subsystem (up to v6.7-rc1).
> I will have a look at it.
Yup. It is very new.
> >> +};
> >
> >> +
> >> +static const struct iio_chan_spec veml6075_channels[] = {
> >> + {
> >> + .type = IIO_INTENSITY,
> >> + .channel = CH_UVA,
> >> + .modified = 1,
> >> + .channel2 = IIO_MOD_LIGHT_UV,
> >> + .extend_name = "UVA",
> >> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> >> + BIT(IIO_CHAN_INFO_SCALE),
> >> + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_INT_TIME),
> >> + },
> >> + {
> >> + .type = IIO_INTENSITY,
> >> + .channel = CH_UVB,
> >> + .modified = 1,
> >> + .channel2 = IIO_MOD_LIGHT_UV,
> >> + .extend_name = "UVB",
> >
> > Extent name is very rarely used any more. It's a horrible userspace interface
> > and an old design mistake.
> > Instead we use the channel label infrastructure. Provide the read_label()
> > callback to use that instead.
> >
> > I'm not sure this is a great solution here though. For some similar cases
> > such as visible light colours we've just added additional modifiers, but that
> > doesn't really scale to lots of sensitive ranges.
> >
> > One thing we have talked about in the past, but I don't think we have done in
> > a driver yet, is to provide actual characteristics of the sensitivity graph.
> > Perhaps just a wavelength of maximum sensitivity?
> >
> > Visible light sensors often have hideous sensitivity curves, including sometimes
> > have multiple peaks, but in this case they look pretty good.
> > Do you think such an ABI would be more useful than A, B labelling?
> >
> My first idea was adding new modifiers because I saw that
> IIO_MOD_LIGHT_UV and IIO_MOD_LIGHT_DUV coexist, but then I thought _UVA
> and _UVB might not be used very often (wrong assumption?) and opted for
> a local solution with extended names. But any cleaner solution would be
> welcome because the label attributes are redundant.
>
> Maybe adding UV-A, UV-B and UV-C modifiers is not a big deal as these
> are fairly common bands. Actually DUV is pretty much UV-C and could be
> left as it is.
Ok. Add UV-A and UV-B as that's inline with other cases.
Always a guessing game for how often a modifier will turn up. We have
space and the list isn't growing that fast so should be fine.
>
> This sensor has a single peak per channel, but I do not know how I would
> provide that information to the core if that is better than adding UVA
> and UVB bands. Would that add attributes to sysfs for the wavelengths or
> extend the channel name? In that case two new modifiers might be a
> better and more obvious solution.
Would be attributes if we did add max sensitivity wavelengths.
Might be worth a revisit at somepoint, but not feeling like it's necessary
for this driver.
> > Jonathan
> >
> >
> I will work on the other issues you pointed out. Thanks a lot for your
> review.
>
> Best regards,
> Javier Carrasco
>
>
next prev parent reply other threads:[~2023-11-20 17:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-19 4:58 [PATCH 0/2] iio: light: add support for VEML6075 UVA and UVB light sensor Javier Carrasco
2023-11-19 4:58 ` [PATCH 1/2] iio: light: add VEML6075 UVA and UVB light sensor driver Javier Carrasco
2023-11-19 5:08 ` Javier Carrasco
2023-11-19 14:25 ` Jonathan Cameron
2023-11-19 15:02 ` Jonathan Cameron
2023-11-19 17:40 ` Javier Carrasco
2023-11-20 17:01 ` Jonathan Cameron [this message]
2023-11-19 22:21 ` kernel test robot
2023-11-19 4:58 ` [PATCH 2/2] dt-bindings: iio: light: add support for Vishay VEML6075 Javier Carrasco
2023-11-19 14:30 ` Jonathan Cameron
2023-11-20 10:24 ` Krzysztof Kozlowski
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=20231120170113.00000992@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).