linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Hilliard <james.hilliard1@gmail.com>
To: Alistair Francis <alistair@alistair23.me>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-input@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org,
	linus.walleij@linaro.org, robh+dt@kernel.org,
	dmitry.torokhov@gmail.com, shawnguo@kernel.org,
	rydberg@bitmath.org, alistair23@gmail.com,
	s.hauer@pengutronix.de, andreas@kemnade.info,
	"Maxime Ripard" <maxime.ripard@bootlin.com>,
	"Mylène Josserand" <mylene.josserand@bootlin.com>,
	"Peter Geis" <pgwipeout@gmail.com>
Subject: Re: [PATCH v10 1/4] Input: Add driver for Cypress Generation 5 touchscreen
Date: Mon, 25 Sep 2023 05:05:32 -0600	[thread overview]
Message-ID: <CADvTj4pdSkg5RWGThmj8Z_gOL5g2Ovhvfc-XtYTU88_0ve4NPw@mail.gmail.com> (raw)
In-Reply-To: <20221026114908.191472-2-alistair@alistair23.me>

On Wed, Oct 26, 2022 at 6:05 AM Alistair Francis <alistair@alistair23.me> wrote:
>
> This is the basic driver for the Cypress TrueTouch Gen5 touchscreen
> controllers. This driver supports only the I2C bus but it uses regmap
> so SPI support could be added later.
> The touchscreen can retrieve some defined zone that are handled as
> buttons (according to the hardware). That is why it handles
> button and multitouch events.
>
> Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>
> Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
> Signed-off-by: Alistair Francis <alistair@alistair23.me>
> Tested-by: Andreas Kemnade <andreas@kemnade.info> # Kobo Clara HD
> Tested-by: Peter Geis <pgwipeout@gmail.com>
> ---
>  drivers/input/touchscreen/Kconfig   |  16 +
>  drivers/input/touchscreen/Makefile  |   1 +
>  drivers/input/touchscreen/cyttsp5.c | 902 ++++++++++++++++++++++++++++
>  3 files changed, 919 insertions(+)
>  create mode 100644 drivers/input/touchscreen/cyttsp5.c
>
> +
> +static int cyttsp5_hid_output_bl_launch_app(struct cyttsp5 *ts)
> +{
> +       int rc;
> +       u8 cmd[HID_OUTPUT_BL_LAUNCH_APP];
> +       u16 crc;
> +
> +       put_unaligned_le16(HID_OUTPUT_BL_LAUNCH_APP_SIZE, cmd);
> +       cmd[2] = HID_BL_OUTPUT_REPORT_ID;
> +       cmd[3] = 0x0; /* Reserved */
> +       cmd[4] = HID_OUTPUT_BL_SOP;
> +       cmd[5] = HID_OUTPUT_BL_LAUNCH_APP;
> +       put_unaligned_le16(0x00, &cmd[6]);
> +       crc = crc_itu_t(0xFFFF, &cmd[4], 4);
> +       put_unaligned_le16(crc, &cmd[8]);
> +       cmd[10] = HID_OUTPUT_BL_EOP;
> +
> +       rc = cyttsp5_write(ts, HID_OUTPUT_REG, cmd,
> +                          HID_OUTPUT_BL_LAUNCH_APP_SIZE);
> +       if (rc) {
> +               dev_err(ts->dev, "Failed to write command %d", rc);
> +               return rc;
> +       }
> +
> +       rc = wait_for_completion_interruptible_timeout(&ts->cmd_done,
> +                                               msecs_to_jiffies(CY_HID_OUTPUT_TIMEOUT_MS));
> +       if (rc <= 0) {
> +               dev_err(ts->dev, "HID output cmd execution timed out\n");
> +               rc = -ETIMEDOUT;
> +               return rc;
> +       }

I've been seeing this timeout error somewhat randomly on a Variscite i.MX6
QUAD/DUAL VAR-SOM-MX6 Custom Board based device at startup:

[    2.234089] cyttsp5 2-0024: HID output cmd execution timed out
[    2.239957] cyttsp5 2-0024: Error on launch app r=-110
[    2.245150] cyttsp5 2-0024: Fail initial startup r=-110
[    2.257502] cyttsp5: probe of 2-0024 failed with error -110

When it doesn't error I just see this:

[    2.061176] input: cyttsp5 as
/devices/platform/soc/2100000.bus/21a8000.i2c/i2c-2/2-0024/input/input0

I'm not sure if this is a driver issue or potentially a device tree issue, the
upstream kernel device tree node looks like this:

touchscreen@24 {
    compatible = "cypress,tt21000";
    reg = <0x24>;
    interrupt-parent = <&gpio3>;
    interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
    reset-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
    vdd-supply = <&reg_3p3v>;
    touchscreen-size-x = <880>;
    touchscreen-size-y = <1280>;
};

Full device tree here:
https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git/tree/arch/arm/boot/dts/nxp/imx/imx6q-var-mx6customboard.dts?h=for-next

The original vendor device tree node for the downstream kernel looked like this:
tsc@0x24 {
    compatible = "cy,cyttsp5_i2c_adapter";
    reg = <0x24>;
    interrupts = <0x07 0x02>;
    interrupt-parent = <0x07>;
    cy,adapter_id = "cyttsp5_i2c_adapter";

    cy,core {
        cy,name = "cyttsp5_core";

        cy,irq_gpio = <71>;
        cy,rst_gpio = <141>;
        cy,hid_desc_register = <0x01>;
        /* CY_CORE_FLAG_RESTORE_PARAMETERS */
        cy,flags = <4>;
        /* CY_CORE_EWG_NONE */
        cy,easy_wakeup_gesture = <0>;
        cy,btn_keys-tag = <0>;

        cy,mt {
            cy,name = "cyttsp5_mt";

            cy,inp_dev_name = "cyttsp5_mt";
            /* CY_MT_FLAG_NONE */
            cy,flags = <0x00>;
            cy,abs =
                /* ABS_MT_POSITION_X, CY_ABS_MIN_X, CY_ABS_MAX_X, 0, 0 */
                <0x35 0 880 0 0
                /* ABS_MT_POSITION_Y, CY_ABS_MIN_Y, CY_ABS_MAX_Y, 0, 0 */
                0x36 0 1280 0 0
                /* ABS_MT_PRESSURE, CY_ABS_MIN_P, CY_ABS_MAX_P, 0, 0 */
                0x3a 0 255 0 0
                /* CY_IGNORE_VALUE, CY_ABS_MIN_W, CY_ABS_MAX_W, 0, 0 */
                0xffff 0 255 0 0
                /* ABS_MT_TRACKING_ID, CY_ABS_MIN_T, CY_ABS_MAX_T, 0, 0 */
                0x39 0 15 0 0
                /* ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0 */
                0x30 0 255 0 0
                /* ABS_MT_TOUCH_MINOR, 0, 255, 0, 0 */
                0x31 0 255 0 0
                /* ABS_MT_ORIENTATION, -127, 127, 0, 0 */
                0x34 0xffffff81 127 0 0
                /* ABS_MT_TOOL_TYPE, 0, MT_TOOL_MAX, 0, 0 */
                0x37 0 1 0 0
                /* ABS_MT_DISTANCE, 0, 255, 0, 0 */
                0x3b 0 255 0 0>;
        };
    };
};

  parent reply	other threads:[~2023-09-25 11:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 11:49 [PATCH v10 0/4] Add support for the Cypress cyttsp5 Alistair Francis
2022-10-26 11:49 ` [PATCH v10 1/4] Input: Add driver for Cypress Generation 5 touchscreen Alistair Francis
2022-10-31 23:52   ` Dmitry Torokhov
2023-09-25 11:05   ` James Hilliard [this message]
2022-10-26 11:49 ` [PATCH v10 2/4] dt-bindings: input: Add Cypress TT21000 touchscreen controller Alistair Francis
2022-10-31 23:49   ` Dmitry Torokhov
2022-11-01 11:50     ` Rob Herring
2022-11-01 15:00       ` Dmitry Torokhov
2022-10-26 11:49 ` [PATCH v10 3/4] ARM: imx_v6_v7_defconfig: Enable the cyttsp5 touchscreen Alistair Francis
2022-11-10  7:18   ` Shawn Guo
2022-10-26 11:49 ` [PATCH v10 4/4] ARM: dts: imx7d-remarkable2: Enable the cyttsp5 Alistair Francis
2022-11-11  2:29   ` Shawn Guo

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=CADvTj4pdSkg5RWGThmj8Z_gOL5g2Ovhvfc-XtYTU88_0ve4NPw@mail.gmail.com \
    --to=james.hilliard1@gmail.com \
    --cc=alistair23@gmail.com \
    --cc=alistair@alistair23.me \
    --cc=andreas@kemnade.info \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=mylene.josserand@bootlin.com \
    --cc=pgwipeout@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=rydberg@bitmath.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /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).