From patchwork Thu Jun 13 02:56:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Hackley X-Patchwork-Id: 803998 Received: from mail-40130.protonmail.ch (mail-40130.protonmail.ch [185.70.40.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D747C12C47A; Thu, 13 Jun 2024 02:57:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.40.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718247426; cv=none; b=BR6/iUThvTvkmJzODehbOApak5Cg3UyTBg740coBlPmSHZAlFbIXwmElL3pX+krYUhvEz88dpSxh6ZXJaJEVGsww5Y66lGmYUxxjh/L2znWn/s1vuOpW/CfYpHRzPJB7XQlomNaWcEW4h/+jEvFKhgRD/m3runtvbo48s0mlVxA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718247426; c=relaxed/simple; bh=4caMDJk1fymacmDutxXRaq4p+OusCKGUepMMnXhyzuE=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MJsC3xNuh+LOxDfO14jl47+YRdoZit/I+GN+8T6nWdBtQNAyGYrNU/Rjcm2h8wuIzLJvlOYVrg1VoD0psZ9iYlITRqb46nZ2r7czcuwfN5tUNyV5ITTYNvEtoHHuWnJ6jKprtDzDvb3TJwQe8C0g4+a5CGeofyttz7lpjtKXlOM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com; spf=pass smtp.mailfrom=protonmail.com; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b=gnjJoPkO; arc=none smtp.client-ip=185.70.40.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=protonmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b="gnjJoPkO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1718247417; x=1718506617; bh=v9+fU/3I0sW3EO1/uEtuQOuAAW/aw8IWkdBocAl5mAU=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=gnjJoPkOQ9grf+eAMoLWDYAYxEI3dNd7sUEO5WPg6WC3XPKbGceb5L3P5wWYPB9WJ 67uzBFXGd5jwsd+RCGiSk8bc8s8ERF6xsNA+J0u59PXufjSsbr1/UPDGA9ubomp4Zx essIN93KcXXJq/OUDyTxOTrgy8YLTy5eaJOAb+5rJFNsLAWDFHx+WBkN4ApYUneMQj a0OiqDhsWT9qx8cXEtdVq0ppU5EQGAqjveJLajZ10SMg8J4g6+OhPd4K8qxwgyA51O wDRzryZlBR08bwSsAX9E4dve0n1w4NEiVmP2JunbotZxnryop8+ZcnAKOiPxn1XKOV f0MPoGvqz/6EQ== Date: Thu, 13 Jun 2024 02:56:54 +0000 To: linux-kernel@vger.kernel.org From: Raymond Hackley Cc: Markuss Broks , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Stephan Gerhold , Nikita Travkin , linux-input@vger.kernel.org, devicetree@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht Subject: [PATCH v2 1/3] input/touchscreen: imagis: Clarify the usage of protocol_b Message-ID: <20240613025631.5425-2-raymondhackley@protonmail.com> In-Reply-To: <20240613025631.5425-1-raymondhackley@protonmail.com> References: <20240613025631.5425-1-raymondhackley@protonmail.com> Feedback-ID: 49437091:user:proton X-Pm-Message-ID: b8475f1b66fb1743f99407396eeefd71710f8969 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 protocol_b is a property, which tells Imagis panel to use a different format for coordinates. IST30XXC series is known for using protocol B, while the other series aren't. Note this could be confusing, unlike the model name implies. Adjust the usage of protocol_b to avoid confusion. Signed-off-by: Raymond Hackley --- drivers/input/touchscreen/imagis.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c index 074dd6c342ec..886bcfc8497a 100644 --- a/drivers/input/touchscreen/imagis.c +++ b/drivers/input/touchscreen/imagis.c @@ -120,12 +120,12 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id) for (i = 0; i < finger_count; i++) { if (ts->tdata->protocol_b) - error = imagis_i2c_read_reg(ts, - ts->tdata->touch_coord_cmd, &finger_status); - else error = imagis_i2c_read_reg(ts, ts->tdata->touch_coord_cmd + (i * 4), &finger_status); + else + error = imagis_i2c_read_reg(ts, + ts->tdata->touch_coord_cmd, &finger_status); if (error) { dev_err(&ts->client->dev, "failed to read coordinates for finger %d: %d\n", @@ -394,6 +394,7 @@ static const struct imagis_properties imagis_3032c_data = { .whoami_cmd = IST3038C_REG_CHIPID, .whoami_val = IST3032C_WHOAMI, .touch_keys_supported = true, + .protocol_b = true, }; static const struct imagis_properties imagis_3038b_data = { @@ -401,7 +402,6 @@ static const struct imagis_properties imagis_3038b_data = { .touch_coord_cmd = IST3038B_REG_STATUS, .whoami_cmd = IST3038B_REG_CHIPID, .whoami_val = IST3038B_WHOAMI, - .protocol_b = true, }; static const struct imagis_properties imagis_3038c_data = { @@ -409,6 +409,7 @@ static const struct imagis_properties imagis_3038c_data = { .touch_coord_cmd = IST3038C_REG_TOUCH_COORD, .whoami_cmd = IST3038C_REG_CHIPID, .whoami_val = IST3038C_WHOAMI, + .protocol_b = true, }; #ifdef CONFIG_OF From patchwork Thu Jun 13 02:57:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Hackley X-Patchwork-Id: 803997 Received: from mail-40130.protonmail.ch (mail-40130.protonmail.ch [185.70.40.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE00612C7E3 for ; Thu, 13 Jun 2024 02:57:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.40.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718247438; cv=none; b=a3zR36h3OYt00P4t9Byh6I0fjXUYFORClQ6iqud1Fb6Ax2zk8Vwee7ymS+Gv+DJnRfhd6KisIRa/WuH/YQR+OWwC4uaMPeVvccStwvqwte79CUpKU1j4MMgoumhskWxVa74YEWasnKB9A6UuAudnfUJnx2z0syDT30XXA1gJXQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718247438; c=relaxed/simple; bh=f0f6wp31zL2RwkHRjXOVz/EH4HhEHMCWvKWESd4pTcA=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lCVw9oYmajsgdOCYkcV8wHQNIY/s5yUld7ukhJXK23Rpqq6219t07Lo6osZZNjbwNOMOqf3mzZmAVPadvAPOzPrj0Nc/xT7Dddj+/9qiQ6cisycrMAjNy7zI2R+j7nVVK62FZ471Iwo2XImBhw3DIWiyOU2D7Fj1gAuW/82fYqw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com; spf=pass smtp.mailfrom=protonmail.com; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b=r+lqTVY7; arc=none smtp.client-ip=185.70.40.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=protonmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b="r+lqTVY7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1718247435; x=1718506635; bh=f0f6wp31zL2RwkHRjXOVz/EH4HhEHMCWvKWESd4pTcA=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=r+lqTVY7WHJsHcd3KfQF7BiczX9O3mP903LHB6xgqzmvbsiDZ2CcNtWGmAIRpmze0 78ZbJaCCO0BUC1HglrvpRBBFmJMHYObdGg7pmxCq9/ihWFBdKWzef/RuJ/UXApPBC6 qf+oZ2LLg/bDCFgtmoOq5YT+qESseW8BOFp3VTfF9F0MutckXsoFBBUp4xWWvqnKgF 7O9czbvgthXt4JmtaRpwKJX4HW27i8452qiONCA/8f+ctuWd+B5sOMSZKLKal3xMQV MSWCV90AtLThim8oW+msHS8L5kn6PKDTMaq4K6gHUsRnAO4MC409A6vda5jco23EAz LPp5zDniodh0A== Date: Thu, 13 Jun 2024 02:57:11 +0000 To: linux-kernel@vger.kernel.org From: Raymond Hackley Cc: Markuss Broks , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Stephan Gerhold , Nikita Travkin , linux-input@vger.kernel.org, devicetree@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht Subject: [PATCH v2 3/3] input/touchscreen: imagis: Add supports for Imagis IST3038 Message-ID: <20240613025631.5425-4-raymondhackley@protonmail.com> In-Reply-To: <20240613025631.5425-1-raymondhackley@protonmail.com> References: <20240613025631.5425-1-raymondhackley@protonmail.com> Feedback-ID: 49437091:user:proton X-Pm-Message-ID: dbec9617af97a207be017b2482ca9ba7250f143f Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Imagis IST3038 is another variant of Imagis IST3038 IC, which has a different register interface from IST3038C (possibly firmware defined). Unlike IST3038C/IST3032C, IST3038 has different registers for commands, which means IST3038 doesn't use protocol B. Similar to IST3032C and maybe the other variants, IST3038 has touch keys support, which provides KEY_APPSELECT and KEY_BACK. Add support for IST3038 with touch keys. Signed-off-by: Raymond Hackley --- drivers/input/touchscreen/imagis.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c index 886bcfc8497a..aeabf8d057de 100644 --- a/drivers/input/touchscreen/imagis.c +++ b/drivers/input/touchscreen/imagis.c @@ -12,9 +12,17 @@ #include #include +#define IST30XX_REG_STATUS 0x20 +#define IST30XX_REG_CHIPID (0x40000000 | IST3038C_DIRECT_ACCESS) + +#define IST30XX_WHOAMI 0x30003000 +#define IST30XXA_WHOAMI 0x300a300a +#define IST30XXB_WHOAMI 0x300b300b +#define IST3038_WHOAMI 0x30383038 + #define IST3032C_WHOAMI 0x32c +#define IST3038C_WHOAMI 0x38c -#define IST3038B_REG_STATUS 0x20 #define IST3038B_REG_CHIPID 0x30 #define IST3038B_WHOAMI 0x30380b @@ -25,7 +33,6 @@ #define IST3038C_REG_TOUCH_STATUS (IST3038C_REG_HIB_BASE | IST3038C_HIB_ACCESS) #define IST3038C_REG_TOUCH_COORD (IST3038C_REG_HIB_BASE | IST3038C_HIB_ACCESS | 0x8) #define IST3038C_REG_INTR_MESSAGE (IST3038C_REG_HIB_BASE | IST3038C_HIB_ACCESS | 0x4) -#define IST3038C_WHOAMI 0x38c #define IST3038C_CHIP_ON_DELAY_MS 60 #define IST3038C_I2C_RETRY_COUNT 3 #define IST3038C_MAX_FINGER_NUM 10 @@ -397,9 +404,17 @@ static const struct imagis_properties imagis_3032c_data = { .protocol_b = true, }; +static const struct imagis_properties imagis_3038_data = { + .interrupt_msg_cmd = IST30XX_REG_STATUS, + .touch_coord_cmd = IST30XX_REG_STATUS, + .whoami_cmd = IST30XX_REG_CHIPID, + .whoami_val = IST3038_WHOAMI, + .touch_keys_supported = true, +}; + static const struct imagis_properties imagis_3038b_data = { - .interrupt_msg_cmd = IST3038B_REG_STATUS, - .touch_coord_cmd = IST3038B_REG_STATUS, + .interrupt_msg_cmd = IST30XX_REG_STATUS, + .touch_coord_cmd = IST30XX_REG_STATUS, .whoami_cmd = IST3038B_REG_CHIPID, .whoami_val = IST3038B_WHOAMI, }; @@ -415,6 +430,7 @@ static const struct imagis_properties imagis_3038c_data = { #ifdef CONFIG_OF static const struct of_device_id imagis_of_match[] = { { .compatible = "imagis,ist3032c", .data = &imagis_3032c_data }, + { .compatible = "imagis,ist3038", .data = &imagis_3038_data }, { .compatible = "imagis,ist3038b", .data = &imagis_3038b_data }, { .compatible = "imagis,ist3038c", .data = &imagis_3038c_data }, { },