From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795264997; b=MYJwFyASEnYYQQsJ7IjrxjRK8uwKn0ENULihn9L3ER0KBr4yJLNhaOZkC0Ype94Ho6IY Gd67+94n1ZPBHrvPy5vyxZku4Z9jNzZ3Hdzv9W9qDAO9eIAuaa/uRiY8/FiYnI7HYfVW9 TbB5gHoAdrV2YPgEdaGk073lyl5W1La7tSCKL/v+2u30hJqcofiY1/OCEdry+5NcBMEqm hbOlY850ge7OoTWGOPyWZZPldJD5aU1P6FAX3ouQCm7uzcRzgcJ99NHdNdmqYPmGzVmF2 8mXwB1nIym4Iv9xpkhaxsnwBn8THhTcKL/DW/DJIKOQqkHQG28dys8N6IAowgbcLoaQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795264997; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=W+f+hveyFt7h2GEzHdDvcPy2Fuv7F8dJuqe5vP7BOeg=; b=gN+Ln6ebTk+cPasLtwEfbnvIYWvkl5wUS2CjJVyc+sFlfdwX0IiVhSHLBCaYXJ7JgXNi zjd6MxNVXtSqnBqNsiZYzy+IgiuV6YXmOpo60lsDaips1K3ianihiNlFhXMXMUcJGWzmU 0jOmq14Xv5GQ0rnsjbvWZHmAyUwmvRT9cEdcQYZhx+0DCU9CRPwiYmyAtU+nihYeWbeqO 9XTBQlfBsQsYQZjGEfr8l1Uupx4wmra7Go4rpkxuDo/NkP0l2/408a+vFBZ5dRmyVbMbc BlBgGDjaXaRBDzwIoRAnhaGGMYz6lSt9JeGeT1FPu6GTyTc19XKPPDtXXJsYBkGmjug== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QywYXH0v; arc=pass header.oldest-pass=0 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 C6851606A6BF; Sat, 21 Nov 2026 12:43:17 +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=QywYXH0v Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1795264997; b=C4JX1pmcVUIwBW1+QYT3Mq1b2rgHzCCI4a4DNmrL+0rSXV0wByU1DJ5oSAXjjUj2NDQ3 9oGleFfaypbhBNjgdtOj5MahM5cMdbv8JPtcD7nGFFq8PRryxOFGYVwgkPQGqmrXD79x3 iBFxPgb4K5n9GOSdWzb1ypN9OdNI/PSzrBtEbuRDbyD/L5euXby7kFjpjZBXghMrevjuY 1CAkr9+4fDMCQKAP2pFWuMmSdcUGeIL1Q4UimaqRmQdpCvKKC1t2jxpV/Zd30MCcxw/OX sIlF4Xvq2c/ZeaV4w3xjbPQZ8nwVyhBzIofDgTRx/BedfKCF+bD0D7Y7jRo8uh231yQ== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1795264997; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=W+f+hveyFt7h2GEzHdDvcPy2Fuv7F8dJuqe5vP7BOeg=; b=vw4F33rMF5+hguLI6mlfkgbrJfvdk0EC01a8Z7JYWcBqB/jB7fMVD7Vg81SdeHmohyEw JTOaotnjHwO3Go9fqRsu1MEH5lFKPTqH55nT48/OlXKeWyiPfvycaGlhD4er3ipVZxYy4 VEXx3rrdyhQaclqXfz8vEUy4S5HoKFHr5DFlAQoUIrQCQSwCSS0Qe46rX0T5JoiibCOU2 X0kba2g3jf4+8xBzPnrbaoIxABz2zjrMt7sIRnW72NJSUYiTTtoYLJ+sDOs6S7UH0Fswr KNLtDJ6vu7ntNDePvB7DvkuUB+1XbXgTVH06T8S0+kMF6Ziwxc998UxZs/JARKOpDdQ== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 45C9A1F000D8; Sat, 21 Nov 2026 12:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795264997; bh=W+f+hveyFt7h2GEzHdDvcPy2Fuv7F8dJuqe5vP7BOeg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=QywYXH0vrtQ0WYrljuiDOY86TysjDPQbrgneVccor6aD2zTVESSzM7RN3WHvKZH6I B33zbTMOa+yq4bd7Uscze2AnGPS7Hh4ct9q0yU3x5dGL6iSj6qIaUT8/U89iBlEM/y ZxRDNMAoh7fb+a/szdSu+LKEc8BHIEm+oYe4vyC5bsbT6yJjkCYccuRN7IyK8inf9b hXTcr8LXBY97Dx57O/gq4g//zZglwNxFY3bMGeP4q8Gxyyax5nTTvasbWZTJNC6mnd Kex12+Gd0SJ+Fqst+PdGhP3K8FblQ9550wJRZfeqYUK8x2hCgABOf/6+5H+wqKJ/oo cjLllR7jSo3wQ== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id B41C14BC52; Sat, 21 Nov 2026 12:43:13 +0000 (UTC) From: Yuugo Yoneda via B4 Relay Date: Sat, 21 Nov 2026 21:43:18 +0900 Subject: [PATCH RFC v2 08/13] Input: add polled SiRF AT550 resistive touchscreen driver X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <20261121-at550-rfc-v1-v2-8-b0309d0789b2@gmail.com> References: <20261121-at550-rfc-v1-v2-0-b0309d0789b2@gmail.com> In-Reply-To: <20261121-at550-rfc-v1-v2-0-b0309d0789b2@gmail.com> To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Gleixner , Radu Rendec , Daniel Lezcano , Dmitry Torokhov , Ulf Hansson , Adrian Hunter , Jonathan Corbet , Shuah Khan , Randy Dunlap , Russell King , Arnd Bergmann , Alexandre Belloni , Linus Walleij , Drew Fustini , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-mmc@vger.kernel.org, linux-doc@vger.kernel.org, soc@lists.linux.dev X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1795264991; l=6386; i=yogo.0917.sabu@gmail.com; s=ypl514-20261117; h=from:subject:message-id; bh=bivtc3/plagvrQfVaPp1BcvAjec0DAYE+T6XoIbkumg=; b=O25c64lOHEXcHQWeBbg/TxF78uySpBOdifo+5DW1dkaYB41YmMi2sTRCCi6TF45MFrhq252fE mBRIOWxnSNcAdFP3qnXWX810wqcN1nu3VVOfzBKxw0CorKPB0c695rp X-Developer-Key: i=yogo.0917.sabu@gmail.com; a=ed25519; pk=TIQ8Tk4xQrxyn8rmk3GI2f5qg/kO6g2KZm7YOOyBHeg= X-Endpoint-Received: by B4 Relay for yogo.0917.sabu@gmail.com/ypl514-20261117 with auth_id=1550 X-Original-From: Yuugo Yoneda Reply-To: yogo.0917.sabu@gmail.com Content-Transfer-Encoding: 7bit From: Yuugo Yoneda Add a polled input driver for the SiRF AT550 resistive touchscreen controller reporting raw ABS_X, ABS_Y, and BTN_TOUCH events. Preserve firmware settling configuration, explicitly stop acquisition on close before clearing pending interrupts, reject streaming or AUX mode at probe, and rely on standard touchscreen properties with affine calibration handled in userspace. Signed-off-by: Yuugo Yoneda --- MAINTAINERS | 1 + drivers/input/touchscreen/Kconfig | 10 +++ drivers/input/touchscreen/Makefile | 2 + drivers/input/touchscreen/at550-ts.c | 124 +++++++++++++++++++++++++++++++++++ 4 files changed, 137 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index e8e239c7e..df3d38c6b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -25855,6 +25855,7 @@ F: Documentation/devicetree/bindings/input/touchscreen/sirf,at550-ts.yaml F: Documentation/devicetree/bindings/interrupt-controller/sirf,at550-intc.yaml F: Documentation/devicetree/bindings/timer/sirf,at550-timer.yaml F: drivers/clocksource/timer-at550.c +F: drivers/input/touchscreen/at550-ts.c F: drivers/irqchip/irq-at550.c SIS 190 ETHERNET DRIVER diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 9b9ae8ac3..e68af1dd6 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -1414,4 +1414,14 @@ config TOUCHSCREEN_HIMAX_HX83112B To compile this driver as a module, choose M here: the module will be called himax_hx83112b. +config TOUCHSCREEN_AT550 + tristate "SiRF AT550 resistive touchscreen" + depends on OF && HAS_IOMEM + help + Say Y to enable polled coordinate acquisition on the AT550. + Coordinates and pen state are exposed through the input subsystem. + Firmware must initialize the touchscreen peripheral clock. + Board-specific affine calibration belongs in userspace. + To build as a module, choose M; it will be called at550-ts. + endif diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index bfd9de833..6b8d09601 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -119,3 +119,5 @@ obj-$(CONFIG_TOUCHSCREEN_IQS5XX) += iqs5xx.o obj-$(CONFIG_TOUCHSCREEN_IQS7211) += iqs7211.o obj-$(CONFIG_TOUCHSCREEN_ZINITIX) += zinitix.o obj-$(CONFIG_TOUCHSCREEN_HIMAX_HX83112B) += himax_hx83112b.o + +obj-$(CONFIG_TOUCHSCREEN_AT550) += at550-ts.o diff --git a/drivers/input/touchscreen/at550-ts.c b/drivers/input/touchscreen/at550-ts.c new file mode 100644 index 000000000..89c2d2701 --- /dev/null +++ b/drivers/input/touchscreen/at550-ts.c @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* SiRF AT550 coordinate acquisition. Layout cross-checked with AT551 draft. */ +#include +#include +#include +#include +#include +#include +#include + +#define AT550_CTRL1 0x00 +#define AT550_CTRL2 0x04 +#define AT550_INTR 0x08 +#define AT550_COORD 0x0c +#define AT550_STREAM 0x44 +#define AT550_DOWN BIT(31) +#define AT550_VALID (BIT(29) | BIT(30)) + +struct at550_ts { + void __iomem *base; + struct touchscreen_properties prop; + u32 ctrl1; + u32 ctrl2; +}; + +static void at550_ts_poll(struct input_dev *input) +{ + struct at550_ts *ts = input_get_drvdata(input); + u32 data = readl(ts->base + AT550_COORD); + + if (!(data & AT550_DOWN)) { + input_report_key(input, BTN_TOUCH, 0); + input_sync(input); + return; + } + if ((data & AT550_VALID) != AT550_VALID) + return; + touchscreen_report_pos(input, &ts->prop, data & GENMASK(11, 0), + (data >> 12) & GENMASK(11, 0), false); + input_report_key(input, BTN_TOUCH, 1); + input_sync(input); +} + +static int at550_ts_open(struct input_dev *input) +{ + struct at550_ts *ts = input_get_drvdata(input); + + /* Polling keeps the interrupt sources disabled. Preserve CE settling. */ + writel(ts->ctrl2 | GENMASK(15, 14), ts->base + AT550_CTRL2); + writel((ts->ctrl1 & GENMASK(7, 4)) | BIT(11) | BIT(10), + ts->base + AT550_CTRL1); + writel(3, ts->base + AT550_INTR); + + return 0; +} + +static void at550_ts_close(struct input_dev *input) +{ + struct at550_ts *ts = input_get_drvdata(input); + + writel(ts->ctrl1 & GENMASK(7, 4), ts->base + AT550_CTRL1); + writel(ts->ctrl2 & ~GENMASK(15, 14), ts->base + AT550_CTRL2); + writel(3, ts->base + AT550_INTR); +} + +static int at550_ts_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct at550_ts *ts; + struct input_dev *input; + int error; + + ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL); + if (!ts) + return -ENOMEM; + ts->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(ts->base)) + return PTR_ERR(ts->base); + ts->ctrl1 = readl(ts->base + AT550_CTRL1); + ts->ctrl2 = readl(ts->base + AT550_CTRL2); + if ((ts->ctrl1 & ~0xffffU) || (ts->ctrl2 & ~0xc2ffU) || + readl(ts->base + AT550_STREAM)) + return dev_err_probe(dev, -ENODEV, "unexpected TSC state\n"); + input = devm_input_allocate_device(dev); + if (!input) + return -ENOMEM; + input->name = "SiRF AT550 touchscreen"; + input->id.bustype = BUS_HOST; + input->open = at550_ts_open; + input->close = at550_ts_close; + input_set_drvdata(input, ts); + input_set_capability(input, EV_KEY, BTN_TOUCH); + input_set_abs_params(input, ABS_X, 0, 4095, 2, 0); + input_set_abs_params(input, ABS_Y, 0, 4095, 2, 0); + touchscreen_parse_properties(input, false, &ts->prop); + error = input_setup_polling(input, at550_ts_poll); + if (error) + return error; + input_set_poll_interval(input, 10); + + error = input_register_device(input); + if (error) + return error; + + return 0; +} + +static const struct of_device_id at550_ts_of_match[] = { + { .compatible = "sirf,at550-ts" }, + { } +}; +MODULE_DEVICE_TABLE(of, at550_ts_of_match); + +static struct platform_driver at550_ts_driver = { + .probe = at550_ts_probe, + .driver = { + .name = "at550-ts", + .of_match_table = at550_ts_of_match, + }, +}; +module_platform_driver(at550_ts_driver); + +MODULE_DESCRIPTION("SiRF AT550 resistive touchscreen"); +MODULE_LICENSE("GPL"); -- 2.56.0