From: sashiko-bot@kernel.org
To: "Qianhui Xu" <xiaqinghuan@mail.ustc.edu.cn>
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2 6/7] dt-bindings: input: novatek,nvt-ts - add the NT36536 compatible
Date: Wed, 02 Dec 2026 01:15:34 +0000 [thread overview]
Message-ID: <sashiko-outbox-244583@kernel.org> (raw)
In-Reply-To: <20261202010542.2508257-6-xiaqinghuan@mail.ustc.edu.cn>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] Input: novatek-nvt-ts: broken DT axis setup in nvt_ts_probe()
- [High] Input: novatek-nvt-ts: missing linux/bitfield.h include for
FIELD_GET()
- [Medium] Input: novatek-nvt-ts: unregistered ABS_MT_TOUCH_MAJOR in
nvt_ts_probe()
--
commit 2354ad35fa28bbbffb01b63befc83c37b13ef941
Author: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
Input: novatek-nvt-ts - add NT36536 packet decoding
This commit adds packet decoding and SPI match entries for the NT36536
touchscreen controller, and makes the parameter block read in nvt_ts_probe()
conditional on chip_id.
> diff --git a/drivers/input/touchscreen/novatek-nvt-ts-core.c b/drivers/input/touchscreen/novatek-nvt-ts-core.c
> index 747fa8bbe3157..f67170474c76e 100644
> --- a/drivers/input/touchscreen/novatek-nvt-ts-core.c
> +++ b/drivers/input/touchscreen/novatek-nvt-ts-core.c
[ ... ]
> @@ -81,6 +85,76 @@ static irqreturn_t nvt_ts_irq(int irq, void *dev_id)
> input_mt_sync_frame(data->input);
> input_sync(data->input);
>
> + return 0;
> +}
> +
[ ... ]
> +static int nvt_ts_report_nt36xxx(struct nvt_ts_data *data)
> +{
> + struct device *dev = data->dev;
> + int i, error;
> +
> + error = nvt_ts_read_data(data, NVT_TS_TOUCH_START, data->buf,
> + NVT_TS_NT36XXX_PACKET_SIZE);
> + if (error)
> + return error;
> +
> + if (!nvt_ts_nt36xxx_checksum_ok(data->buf)) {
> + dev_dbg(dev, "bad touch packet checksum\n");
> + return -EIO;
> + }
> +
> + for (i = 0; i < data->max_touches; i++) {
> + const u8 *touch = &data->buf[1 + i * NVT_TS_TOUCH_SIZE];
> + u8 state = FIELD_GET(NVT_TS_TOUCH_TYPE_MASK, touch[0]);
[Severity: High]
Does this need to include linux/bitfield.h for FIELD_GET()? On architectures
such as x86 that do not pull it in transitively, the build fails with an
implicit function declaration.
> + unsigned int id = (touch[0] >> NVT_TS_TOUCH_SLOT_SHIFT) - 1;
> + unsigned int x, y, width;
> +
> + if (state != NVT_TS_TOUCH_NEW && state != NVT_TS_TOUCH_UPDATE)
> + continue;
> + if (id >= data->max_touches)
> + continue;
> +
> + x = get_unaligned_be16(&touch[1]);
> + y = get_unaligned_be16(&touch[3]);
> + width = touch[5] ?: 1;
> +
> + input_mt_slot(data->input, id);
> + input_mt_report_slot_state(data->input, MT_TOOL_FINGER, true);
> + touchscreen_report_pos(data->input, &data->prop, x, y, true);
> + input_report_abs(data->input, ABS_MT_TOUCH_MAJOR, width);
[Severity: Medium]
Are these ABS_MT_TOUCH_MAJOR events dropped by the input core? nvt_ts_probe()
only sets up ABS_MT_POSITION_X and ABS_MT_POSITION_Y via
input_set_abs_params(), so ABS_MT_TOUCH_MAJOR is never set in input->absbit.
[ ... ]
> @@ -223,9 +318,17 @@ int nvt_ts_probe(struct device *dev, const struct nvt_ts_bus_ops *bus_ops,
> input->open = nvt_ts_start;
> input->close = nvt_ts_stop;
>
> - input_set_abs_params(input, ABS_MT_POSITION_X, 0, width - 1, 0, 0);
> - input_set_abs_params(input, ABS_MT_POSITION_Y, 0, height - 1, 0, 0);
> + if (width)
> + input_set_abs_params(input, ABS_MT_POSITION_X, 0, width - 1, 0, 0);
> + if (height)
> + input_set_abs_params(input, ABS_MT_POSITION_Y, 0, height - 1, 0, 0);
> touchscreen_parse_properties(input, true, &data->prop);
> + if (!width)
> + input_set_abs_params(input, ABS_MT_POSITION_X, 0,
> + data->prop.max_x - 1, 0, 0);
> + if (!height)
> + input_set_abs_params(input, ABS_MT_POSITION_Y, 0,
> + data->prop.max_y - 1, 0, 0);
[Severity: High]
Does touchscreen_parse_properties() fail to set up the X and Y axes when
chip->chip_id is 0?
When width and height are 0, skipping input_set_abs_params() before
touchscreen_parse_properties() leaves ABS_MT_POSITION_X and ABS_MT_POSITION_Y
unset in input->absbit:
drivers/input/touchscreen.c:touchscreen_set_params() {
if (!test_bit(axis, dev->absbit)) {
dev_warn(&dev->dev,
"Parameters are specified but the axis %lu is not set up\n",
axis);
return;
}
...
}
As a result, touchscreen_parse_properties() logs a warning for both axes,
leaves data->prop.max_x and data->prop.max_y at 0, and the subsequent
input_set_abs_params() calls configure both axis maximums to -1.
Setting the capabilities with input_set_capability(input, EV_ABS,
ABS_MT_POSITION_X) and ABS_MT_POSITION_Y before touchscreen_parse_properties()
lets touchscreen_parse_properties() configure the axes directly from device
tree without calling input_set_abs_params() afterwards.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202010542.2508257-1-xiaqinghuan@mail.ustc.edu.cn?part=6
next prev parent reply other threads:[~2026-12-02 1:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 1:05 [PATCH v2 1/7] Input: novatek-nvt-ts - add transport ops abstraction Qianhui Xu
2026-12-02 1:05 ` [PATCH v2 2/7] Input: novatek-nvt-ts - split bus independent core out Qianhui Xu
2026-12-02 1:05 ` [PATCH v2 3/7] Input: novatek-nvt-ts - add SPI bus support Qianhui Xu
2026-12-02 1:05 ` [PATCH v2 4/7] dt-bindings: input: novatek,nvt-ts - allow SPI wiring Qianhui Xu
2026-12-02 1:05 ` [PATCH v2 5/7] Input: novatek-nvt-ts - add NT36536 packet decoding Qianhui Xu
2026-12-02 1:19 ` sashiko-bot
2026-12-02 1:05 ` [PATCH v2 6/7] dt-bindings: input: novatek,nvt-ts - add the NT36536 compatible Qianhui Xu
2026-12-02 1:15 ` sashiko-bot [this message]
2026-12-02 1:05 ` [PATCH v2 7/7] Input: novatek-nvt-ts - add no-flash firmware download Qianhui Xu
2026-12-02 1:18 ` sashiko-bot
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=sashiko-outbox-244583@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=xiaqinghuan@mail.ustc.edu.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.