From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796172407; b=4IZn53o1Ao9eSwo7YzLnEE9RfMwN/owWpzhVubkOqQFmwqK9pBIn5TLzF0zy9zDnYl3u 7IOru5qbBRZeLtNEt7486ZIU3nAOeDfO7poW4KIPpjaO2yFyHgVGUrTvVdZDK9FiB1OQX Om+DxnvMTnF39+XvQUzjZ1dmJ3yiq0TNqS1+SDp0eYBDZqN8fWfZVgnJC2lkFJkXB2vZt uuDO7izYZ1PzppAAKu1+qnOH9I/usyt4BS4sBfCJA3gwElMkyO1DB9UoLSWho0WnmUh4C NIpD0dOBI89uvCs6NGihsIQZJMG3YMo3rgWHe/fNMT1jQZql8/pgZInhUFcJlMK17ug== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796172407; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=GiGnisFv8MdzX7ICi3IZOMwIpfOEUDaW2QWVfOKkiww=; b=wB10AeJ/zPk8V6av0CJIC7KhPQM6IwriO+h+JQDd2xqeinPkXNT4/OsfuoCIZf1RtaHz GMe1p3XeyKqAoHIEnF2ZsMJNmUiOAiCLUoO5x6G0wgIbmy2RA44LVW+T1JXxdRyXn5/zz pfpSi1Hje9TPTMiUgkmDuiuHoYdnmZXQCMpgDFXsqxfO3j74MjIA2oyjXEzZ35173K09Y QR8E9tG0hfexVm+qRrEU8dcby7oTOnhUckGqcGcTzUM+STX6LHmP2YRHsilw/DwYrrYQx 0qg7ZegrK4/SLQZ3AxkCOmbi42bxMFGU1SdbuajAZoclEpFeeINBnSHgaqao9Ag5PpA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=l2bZpnNe; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C94FB606A31A; Wed, 2 Dec 2026 00:46:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=l2bZpnNe Received: by smtp.kernel.org (Postfix) with ESMTPSA id 667AE1F00893; Wed, 2 Dec 2026 00:46:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796172407; bh=GiGnisFv8MdzX7ICi3IZOMwIpfOEUDaW2QWVfOKkiww=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=l2bZpnNetIAV1SPwLFMFPyqa9QWPOdwXg/426NwvwDKj4NvK7rSH/H/dO8qDwbBCi 3H0q+kHhSXIoN/fgJftnTqch65b+FN3e11FOxQdqY+PDkcHkQSHDs3J4AadazemN5k jJXkQonx8eBWYFkt/uiZGw2Bxz+7oEDbKUiPGue5Ja/oeZ4O/pTz2zIJ0VNJqQaLJu Tquxn8MEGESkM1UGL6Ub221Nn8EQRYTFauijVrikTyb2bgQlGT/Y3T6r/MrTToq+jU +Ll9bv7J5xfXDuLdro4l9ktrSl3NArgZJz4FpQ/95tW2BtIm+ihiHkG+3iMm9oiwse VK5EWHQ2Toi9Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 5/7] Input: novatek-nvt-ts - add NT36536 packet decoding Reply-To: sashiko-reviews@lists.linux.dev To: "Qianhui Xu" Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org, dmitry.torokhov@gmail.com In-Reply-To: <20261202003159.1321846-5-xiaqinghuan@mail.ustc.edu.cn> References: <20261202003159.1321846-1-xiaqinghuan@mail.ustc.edu.cn> <20261202003159.1321846-5-xiaqinghuan@mail.ustc.edu.cn> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 00:46:47 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] Input: novatek-nvt-ts - broken X/Y axis setup in nvt_ts_probe() - [High] Input: novatek-nvt-ts - missing dev_set_drvdata() in nvt_ts_probe() - [Medium] Input: novatek-nvt-ts - missing ABS_MT_TOUCH_MAJOR setup in nvt_ts_probe() -- commit 629485efc8c5bb9921461a8d9bf9ca2e03a38ccb Author: Qianhui Xu Input: novatek-nvt-ts - add NT36536 packet decoding This commit adds a per-chip touch report callback, implements the NT36xxx packet decoding and checksum verification, makes reading the parameter block conditional on chip_id, and registers SPI match entries for NT36536. > diff --git a/drivers/input/touchscreen/novatek-nvt-ts-core.c b/drivers/in= put/touchscreen/novatek-nvt-ts-core.c > index 227dc7eaed929..4303d0901c91d 100644 > --- a/drivers/input/touchscreen/novatek-nvt-ts-core.c > +++ b/drivers/input/touchscreen/novatek-nvt-ts-core.c [ ... ] > +/* > + * NT36xxx packet: 108 bytes of payload plus a checksum, records start at > + * offset 1, coordinates are 16 bit big endian and b[5] carries the widt= h. > + */ > +static int nvt_ts_report_nt36xxx(struct nvt_ts_data *data) > +{ > + struct device *dev =3D data->dev; > + int i, error; > + > + error =3D 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 =3D 0; i < data->max_touches; i++) { > + const u8 *touch =3D &data->buf[1 + i * NVT_TS_TOUCH_SIZE]; > + u8 state =3D FIELD_GET(NVT_TS_TOUCH_TYPE_MASK, touch[0]); > + unsigned int id =3D (touch[0] >> NVT_TS_TOUCH_SLOT_SHIFT) - 1; > + unsigned int x, y, width; > + > + if (state !=3D NVT_TS_TOUCH_NEW && state !=3D NVT_TS_TOUCH_UPDATE) > + continue; > + if (id >=3D data->max_touches) > + continue; > + > + x =3D get_unaligned_be16(&touch[1]); > + y =3D get_unaligned_be16(&touch[3]); > + width =3D 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] Does nvt_ts_probe() need to register ABS_MT_TOUCH_MAJOR with input_set_abs_params()? Without that, ABS_MT_TOUCH_MAJOR is not set in data->input->absbit and the input core silently drops every contact width event reported here. [ ... ] > @@ -159,6 +234,7 @@ int nvt_ts_probe(struct device *dev, const struct nvt= _ts_bus_ops *bus_ops, > =20 > data->dev =3D dev; > data->bus_ops =3D bus_ops; > + data->chip =3D chip; > data->irq =3D irq; [Severity: High] Should nvt_ts_probe() call dev_set_drvdata(dev, data) here? Only input_set_drvdata(input, data) is called later in nvt_ts_probe(), which sets driver_data on input->dev rather than on the bus device dev. When the system suspends or resumes, nvt_ts_suspend() and nvt_ts_resume() call dev_get_drvdata(dev), get NULL, and dereference it at &data->input->mutex. [ ... ] > @@ -225,9 +320,17 @@ int nvt_ts_probe(struct device *dev, const struct nv= t_ts_bus_ops *bus_ops, > input->open =3D nvt_ts_start; > input->close =3D nvt_ts_stop; > =20 > - 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 skipping input_set_abs_params() before touchscreen_parse_properties() leave ABS_MT_POSITION_X and ABS_MT_POSITION_Y unset when width and height are 0? touchscreen_parse_properties() calls touchscreen_set_params(), which requires the axis bit to already be set in dev->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; } } For chips without a parameter block (such as NT36536), width and height are 0, so touchscreen_set_params() warns and returns early without configuring the axes, leaving data->prop.max_x and data->prop.max_y at 0. The subsequent input_set_abs_params() calls then configure the X and Y maximums as -1. In addition, when touchscreen_parse_properties() succeeds it already sets the axis maximums (and any minimum, fuzz, resolution, or axis swap from DT), so calling input_set_abs_params() afterwards with data->prop.max_x - 1 would subtract 1 a second time and overwrite those properties; registering the capabilities with input_set_capability() before touchscreen_parse_properties() avoids both issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202003159.1321= 846-1-xiaqinghuan@mail.ustc.edu.cn?part=3D5