From: Jonathan Cameron <jic23@kernel.org>
To: Yasin Lee <yasin.lee.x@gmail.com>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
yasin.lee.x@outlook.com, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org
Subject: Re: [PATCH v6 3/3] iio: proximity: Add driver support for TYHX's HX9023S capacitive proximity sensor
Date: Sun, 23 Jun 2024 12:56:21 +0100 [thread overview]
Message-ID: <20240623125621.07d1617c@jic23-huawei> (raw)
In-Reply-To: <20240621-add-tyhx-hx9023s-sensor-driver-v6-3-65196a9020f1@gmail.com>
On Fri, 21 Jun 2024 15:40:51 +0800
Yasin Lee <yasin.lee.x@gmail.com> wrote:
> A SAR sensor from NanjingTianyihexin Electronics Ltd.
>
> The device has the following entry points:
>
> Usual frequency:
> - sampling_frequency
>
> Instant reading of current values for different sensors:
> - in_proximity0_raw
> - in_proximity1_raw
> - in_proximity2_raw
> - in_proximity3_raw
> - in_proximity4_raw
> and associated events in events/
>
> Signed-off-by: Yasin Lee <yasin.lee.x@gmail.com>
Hi Yasin,
Some good reviews in already for this version, so I only took a quick look
this time. It seems to be in a reasonable state now.
Jonathan
> diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
> new file mode 100644
> index 000000000000..1d8cb9a05d8a
> --- /dev/null
> +++ b/drivers/iio/proximity/hx9023s.c
>
> +struct hx9023s_data {
> + struct iio_trigger *trig;
> + struct regmap *regmap;
> + unsigned long chan_prox_stat;
> + unsigned long chan_read;
> + unsigned long chan_event;
> + unsigned long ch_en_stat;
> + unsigned long chan_in_use;
> + unsigned int prox_state_reg;
> + bool trigger_enabled;
> +
> + struct {
> + __le16 channels[HX9023S_CH_NUM];
> + s64 ts __aligned(8);
> + } buffer;
> +
> + struct mutex mutex;
Add a comment explaining the data this mutex is protecting
(that may be in this structure, or for example on the device)
> + struct hx9023s_ch_data ch_data[HX9023S_CH_NUM];
> +};
> +
> +static int hx9023s_sample(struct hx9023s_data *data)
> +{
...
> +
> + for (i = 0; i < HX9023S_CH_NUM; i++) {
> + value = get_unaligned_le16(&rx_buf[i * data_size + 1]);
> + value = sign_extend32(value, 15);
> + data->ch_data[i].lp = 0;
> + data->ch_data[i].diff = 0;
> + if (data->ch_data[i].sel_lp == true)
> + data->ch_data[i].lp = value;
> + if (data->ch_data[i].sel_diff == true)
>
Run checkpatch.pl --strict and it will probably moan about these.
if (data->ch_data[i].sel_diff) is the same thing so just use that.
next prev parent reply other threads:[~2024-06-23 11:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 7:40 [PATCH v6 0/3] iio: proximity: Add TYHX HX9023S sensor driver Yasin Lee
2024-06-21 7:40 ` [PATCH v6 1/3] dt-bindings: vendor-prefixes: add tyhx Yasin Lee
2024-06-21 10:07 ` Krzysztof Kozlowski
2024-06-21 7:40 ` [PATCH v6 2/3] dt-bindings: iio: proximity: Add TYHX HX9023S Yasin Lee
2024-06-21 10:12 ` Krzysztof Kozlowski
2024-06-22 5:56 ` Yasin Lee
2024-06-22 10:51 ` Conor Dooley
2024-06-22 12:35 ` Yasin Lee
2024-06-22 18:04 ` Krzysztof Kozlowski
2024-06-23 0:50 ` Yasin Lee
2024-06-21 7:40 ` [PATCH v6 3/3] iio: proximity: Add driver support for TYHX's HX9023S capacitive proximity sensor Yasin Lee
2024-06-21 14:09 ` Alexandru Ardelean
2024-06-22 12:15 ` Yasin Lee
2024-06-23 11:56 ` Jonathan Cameron [this message]
2024-06-25 2:06 ` Yasin Lee
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=20240623125621.07d1617c@jic23-huawei \
--to=jic23@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=yasin.lee.x@gmail.com \
--cc=yasin.lee.x@outlook.com \
/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).