All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: rofikkerneldev <rofikcoga@gmail.com>
Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-input@vger.kernel.org, robh@kernel.org,
	conor+dt@kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v1 07/11] Input: touchscreen: add Silicon Works SW42902 support
Date: Tue, 17 Nov 2026 13:01:27 +0000	[thread overview]
Message-ID: <sashiko-outbox-218826@kernel.org> (raw)
In-Reply-To: <20261117123946.668557-8-rofikcoga@gmail.com>

Thank you for your contribution! Sashiko AI review found 6 potential
issues to consider:
- [High] Input: sw42902: username handle in Signed-off-by trailer and
  MAINTAINERS
- [Medium] Input: sw42902: IRQ disable imbalance on sw42902_resume()
  error path
- [Low] Input: sw42902: use named initializer in struct i2c_device_id
  table
- [Low] Input: sw42902: follow Input error variable naming and return
  style
- [Low] Input: sw42902: partial MT events queued before palm cancel in
  sw42902_irq()
- [Low] Input: sw42902: redundant dev_err_probe() after
  devm_request_threaded_irq()
--

commit 7d934418330ef369d907f6e1ac22a2b5372028a3
Author: rofikkerneldev <rofikcoga@gmail.com>

> Input: touchscreen: add Silicon Works SW42902 support
>
> Add basic multitouch support for the SW42902 controller. Implement the
> GPIO power and reset sequence and use the firmware already present in
> controller flash; no firmware update is performed.
>
> Signed-off-by: rofikkerneldev <rofikcoga@gmail.com>

[Severity: High]
The Signed-off-by trailer, Author header, and MAINTAINERS entry for this
driver use an account handle (rofikkerneldev) instead of a real human
name, which does not meet the Developer's Certificate of Origin
requirements in Documentation/process/submitting-patches.rst.

> diff --git a/drivers/input/touchscreen/sw42902.c b/drivers/input/touchscreen/sw42902.c
> new file mode 100644
> index 0000000000000..7b39a97053c63
> --- /dev/null
> +++ b/drivers/input/touchscreen/sw42902.c

[ ... ]

> +	for (i = 0; i < count; i++) {
> +		const u8 *contact = ts->report + 36 + 12 * i;
> +		u32 a = get_unaligned_le32(contact);
> +		u32 b = get_unaligned_le32(contact + 4);
> +		u32 c = get_unaligned_le32(contact + 8);
> +		unsigned int id = a & 0x1f;
> +		unsigned int event = (a >> 16) & 3;
> +
> +		if (id == 15) {
> +			sw42902_release_contacts(ts);
> +			return IRQ_HANDLED;
> +		}
> +		if (id >= SW42902_MAX_CONTACTS || (event != 1 && event != 2))
> +			continue;
> +
> +		input_mt_slot(input, id);
> +		input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
> +		touchscreen_report_pos(input, &ts->prop, a >> 18, b & 0x3fff, true);
> +		input_report_abs(input, ABS_MT_PRESSURE, (b >> 14) & 0xff);
> +		input_report_abs(input, ABS_MT_TOUCH_MAJOR, (c >> 4) & 0x3fff);
> +		input_report_abs(input, ABS_MT_TOUCH_MINOR, c >> 18);
> +	}

[Severity: Low]
Can sw42902_irq() queue partial multitouch events before cancelling the
frame on a palm report?

If a report has active finger contacts at earlier indices followed by a
palm entry (id == 15), the loop already queues slot activation and
position events into input->vals[] for those earlier contacts before
calling sw42902_release_contacts(), flushing transient touch updates and
slot releases in the same SYN_REPORT frame.

[ ... ]

> +static int sw42902_start(struct sw42902 *ts)
> +{
> +	u8 version[4];
> +	int ret;
> +
> +	ret = sw42902_read(ts, SW42902_VERSION, version, sizeof(version));
> +	if (ret)
> +		return ret;
> +	if (version[2] != 10 || (version[3] & 0xf) != 4) {
> +		dev_err(&ts->client->dev, "unexpected chip/protocol: %u/%u\n",
> +			version[2], version[3] & 0xf);
> +		return -ENODEV;
> +	}
> +
> +	ret = sw42902_write(ts, SW42902_SERIAL_SPI_EN, 0);
> +	if (ret)
> +		return ret;
> +	ret = sw42902_write(ts, SW42902_DEVICE_CTL, 1);
> +	if (ret)
> +		return ret;
> +	ret = sw42902_write(ts, SW42902_INTERRUPT_CTL, 1);
> +	if (ret)
> +		return ret;
> +	ret = sw42902_write(ts, SW42902_DRIVING_CTL, SW42902_DRIVING_STOP);
> +	if (ret)
> +		return ret;
> +	msleep(30);
> +	return sw42902_write(ts, SW42902_DRIVING_CTL, SW42902_DRIVING_U3);
> +}

[Severity: Low]
This isn't a bug, but in the Input subsystem variables that only hold 0 or
a negative error code should be named error or err rather than ret (here
and in sw42902_irq(), sw42902_probe(), and sw42902_resume()).  Also,
since sw42902_start() has multiple failure points, the final
sw42902_write() call should check error and explicitly return 0 on
success.

> +static int sw42902_probe(struct i2c_client *client)
> +{

[ ... ]

> +	ret = devm_request_threaded_irq(dev, client->irq, NULL, sw42902_irq,
> +					IRQF_ONESHOT | IRQF_NO_AUTOEN,
> +					dev_name(dev), ts);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "interrupt request failed\n");

[Severity: Low]
This isn't a bug, but devm_request_threaded_irq() already calls
dev_err_probe() via devm_request_result() on failure, so wrapping its
return value in dev_err_probe() logs a duplicate error message and
overwrites the deferred probe reason.

[ ... ]

> +static int sw42902_suspend(struct device *dev)
> +{
> +	struct sw42902 *ts = i2c_get_clientdata(to_i2c_client(dev));
> +
> +	disable_irq(ts->client->irq);
> +	sw42902_release_contacts(ts);
> +	sw42902_write(ts, SW42902_DRIVING_CTL, SW42902_DRIVING_STOP);
> +	sw42902_power_off(ts);
> +	return 0;
> +}
> +
> +static int sw42902_resume(struct device *dev)
> +{
> +	struct sw42902 *ts = i2c_get_clientdata(to_i2c_client(dev));
> +	int ret;
> +
> +	sw42902_power_on(ts);
> +	ret = sw42902_start(ts);
> +	if (ret) {
> +		sw42902_power_off(ts);
> +		return ret;
> +	}
> +	enable_irq(ts->client->irq);
> +	return 0;
> +}

[Severity: Medium]
What happens on the next suspend if sw42902_start() fails during
sw42902_resume()?

When sw42902_start() fails, sw42902_resume() powers off the controller and
returns without calling enable_irq(ts->client->irq).  Because the PM core
clears dev->power.is_suspended before invoking the resume callback, the
next system suspend still calls sw42902_suspend(), which writes to the
powered-off chip over I2C and calls disable_irq(ts->client->irq) a second
time, leaving the IRQ disabled even if a later resume succeeds.

[ ... ]

> +static const struct i2c_device_id sw42902_ids[] = {
> +	{ "sw42902" },
> +	{ }
> +};

[Severity: Low]
This isn't a bug, but per I2C subsystem conventions new struct
i2c_device_id entries should use named initializers ({ .name = "sw42902" }).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117123946.668557-1-rofikcoga@gmail.com?part=7

  reply	other threads:[~2026-11-17 13:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 12:39 [PATCH v1 00/11] arm64: qcom: Add initial support for LG V60 ThinQ 5G (timelm) rofikkerneldev
2026-11-17 12:39 ` [PATCH v1 01/11] dt-bindings: arm: qcom: add " rofikkerneldev
2026-11-17 12:47   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 02/11] arm64: dts: qcom: add LG V60 ThinQ 5G (timelm) support rofikkerneldev
2026-11-17 13:06   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 03/11] arm64: dts: qcom: sm8250-lge-timelm: add reserved memory regions rofikkerneldev
2026-11-17 12:57   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 04/11] dt-bindings: display: panel: add LG SW43103 rofikkerneldev
2026-11-17 12:51   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 05/11] drm/panel: add LG SW43103 panel driver rofikkerneldev
2026-11-17 13:04   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 06/11] dt-bindings: input: touchscreen: add Silicon Works SW42902 rofikkerneldev
2026-11-17 12:51   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 07/11] Input: touchscreen: add Silicon Works SW42902 support rofikkerneldev
2026-11-17 13:01   ` sashiko-bot [this message]
2026-11-17 12:39 ` [PATCH v1 08/11] arm64: dts: qcom: sm8250-lge-timelm: enable SW43103 panel rofikkerneldev
2026-11-17 13:12   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 09/11] arm64: dts: qcom: sm8250-lge-timelm: add SW42902 touchscreen rofikkerneldev
2026-11-17 12:56   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 10/11] arm64: dts: qcom: sm8250-lge-timelm: enable USB Type-C rofikkerneldev
2026-11-17 13:12   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 11/11] arm64: dts: qcom: sm8250-lge-timelm: add QCA6390 Bluetooth rofikkerneldev
2026-11-17 13:09   ` 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-218826@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-input@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=rofikcoga@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.