From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Nikita Travkin <nikita@trvn.ru>, linux-input@vger.kernel.org
Subject: Re: [PATCH v2 2/2] Input: zinitix - Varying icon status registers
Date: Sat, 31 Aug 2024 19:09:29 -0700 [thread overview]
Message-ID: <ZtPM2Xf2Pk6p4QPk@google.com> (raw)
In-Reply-To: <20240830-zinitix-tk-versions-v2-2-90eae6817eda@linaro.org>
On Fri, Aug 30, 2024 at 04:04:28PM +0200, Linus Walleij wrote:
> The different revisions of the Zinitix BTXXX touchscreens place
> the icon status register (to read out touchkey status) in
> different places. Use the chip revision bits to discern
> between the different versions at runtime.
>
> This makes touchkeys work on the BT404 on the Samsung Codina
> GT-I8160 mobile phone.
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - No changes
> ---
> drivers/input/touchscreen/zinitix.c | 25 +++++++++++++++++++++++--
> 1 file changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/touchscreen/zinitix.c b/drivers/input/touchscreen/zinitix.c
> index e47e0bff80db..b6b380f5aed5 100644
> --- a/drivers/input/touchscreen/zinitix.c
> +++ b/drivers/input/touchscreen/zinitix.c
> @@ -35,7 +35,13 @@
> #define ZINITIX_DEBUG_REG 0x0115 /* 0~7 */
>
> #define ZINITIX_TOUCH_MODE 0x0010
> +
> #define ZINITIX_CHIP_REVISION 0x0011
> +#define ZINITIX_CHIP_BTX0X_MASK 0xF0F0
> +#define ZINITIX_CHIP_BT4X2 0x4020
> +#define ZINITIX_CHIP_BT4X3 0x4030
> +#define ZINITIX_CHIP_BT4X4 0x4040
> +
> #define ZINITIX_FIRMWARE_VERSION 0x0012
>
> #define ZINITIX_USB_DETECT 0x116
> @@ -63,7 +69,11 @@
> #define ZINITIX_Y_RESOLUTION 0x00C1
>
> #define ZINITIX_POINT_STATUS_REG 0x0080
> -#define ZINITIX_ICON_STATUS_REG 0x00AA
> +
> +#define ZINITIX_BT4X2_ICON_STATUS_REG 0x009A
> +#define ZINITIX_BT4X3_ICON_STATUS_REG 0x00A0
> +#define ZINITIX_BT4X4_ICON_STATUS_REG 0x00A0
> +#define ZINITIX_BT5XX_ICON_STATUS_REG 0x00AA
>
> #define ZINITIX_POINT_COORD_REG (ZINITIX_POINT_STATUS_REG + 2)
>
> @@ -425,7 +435,18 @@ static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler)
> }
>
> if (le16_to_cpu(touch_event.status) & BIT_ICON_EVENT) {
> - error = zinitix_read_data(bt541->client, ZINITIX_ICON_STATUS_REG,
> + u16 iconstatus;
> +
> + if ((bt541->chip_revision & ZINITIX_CHIP_BTX0X_MASK) == ZINITIX_CHIP_BT4X2)
> + iconstatus = ZINITIX_BT4X2_ICON_STATUS_REG;
> + else if ((bt541->chip_revision & ZINITIX_CHIP_BTX0X_MASK) == ZINITIX_CHIP_BT4X3)
> + iconstatus = ZINITIX_BT4X3_ICON_STATUS_REG;
> + else if ((bt541->chip_revision & ZINITIX_CHIP_BTX0X_MASK) == ZINITIX_CHIP_BT4X4)
> + iconstatus = ZINITIX_BT4X4_ICON_STATUS_REG;
> + else
> + iconstatus = ZINITIX_BT5XX_ICON_STATUS_REG;
This does not need to be re-calculated every interrupt. I move this into
zinitix_init_touch() and turned into a switch, and applied.
Thanks.
--
Dmitry
prev parent reply other threads:[~2024-09-01 2:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 14:04 [PATCH v2 0/2] Input: zinitix - Handle chip revisions for touchkeys Linus Walleij
2024-08-30 14:04 ` [PATCH v2 1/2] Input: zinitix - Read and cache device version numbers Linus Walleij
2024-09-01 2:07 ` Dmitry Torokhov
2024-08-30 14:04 ` [PATCH v2 2/2] Input: zinitix - Varying icon status registers Linus Walleij
2024-09-01 2:09 ` Dmitry Torokhov [this message]
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=ZtPM2Xf2Pk6p4QPk@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-input@vger.kernel.org \
--cc=nikita@trvn.ru \
/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).