From: Rudraksha Gupta <guptarud@gmail.com>
To: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, beomho.seo@samsung.com,
jcsing.lee@samsung.com
Subject: Re: [PATCH] ARM: dts: qcom: msm8960: expressatt: Add coreriver,tc360-touchkey
Date: Mon, 8 Dec 2025 23:10:03 -0800 [thread overview]
Message-ID: <1e74b956-a45a-4d3e-b7fa-e4d5dc0390db@gmail.com> (raw)
In-Reply-To: <532531d2-8f26-4ffa-9355-7821a4d64200@oss.qualcomm.com>
>> Add the tc360 touchkey. It's unknown if this is the actual model of the
>> touchkey, as downstream doesn't mention a variant, but this works.
>>
>> Link:
>> https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/drivers/input/keyboard/cypress_touchkey_236/Makefile#L5
> This driver mentions a register called CYPRESS_MODULE_VER - maybe
> it could help confirm the model?
>
> Konrad
Here are the changes that Claude made to the tm2-touchkey driver, which
seems to do what you asked and matches downstream (I have never written
a driver before, so please free to provide corrections if necessary):
diff --git a/drivers/input/keyboard/tm2-touchkey.c
b/drivers/input/keyboard/tm2-touchkey.c
index 55d699d9037d..d1f435dc6b05 100644
--- a/drivers/input/keyboard/tm2-touchkey.c
+++ b/drivers/input/keyboard/tm2-touchkey.c
@@ -33,6 +33,9 @@
#define TM2_TOUCHKEY_LED_VOLTAGE_MIN 2500000
#define TM2_TOUCHKEY_LED_VOLTAGE_MAX 3300000
+#define CYPRESS_FW_VER 0x01
+#define CYPRESS_MODULE_VER 0x02
+
struct touchkey_variant {
u8 keycode_reg;
u8 base_reg;
@@ -180,6 +183,53 @@ static irqreturn_t tm2_touchkey_irq_handler(int
irq, void *devid)
return IRQ_HANDLED;
}
+static ssize_t module_version_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct tm2_touchkey_data *touchkey = i2c_get_clientdata(client);
+ int module_ver;
+
+ if (touchkey->variant->no_reg) {
+ /* Aries variant doesn't support register reads */
+ return sysfs_emit(buf, "unknown\n");
+ }
+
+ module_ver = i2c_smbus_read_byte_data(touchkey->client,
CYPRESS_MODULE_VER);
+ if (module_ver < 0)
+ return module_ver;
+
+ return sysfs_emit(buf, "0x%02x\n", module_ver);
+}
+static DEVICE_ATTR_RO(module_version);
+
+static ssize_t fw_version_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct tm2_touchkey_data *touchkey = i2c_get_clientdata(client);
+ int fw_ver;
+
+ if (touchkey->variant->no_reg) {
+ /* Aries variant doesn't support register reads */
+ return sysfs_emit(buf, "unknown\n");
+ }
+
+ fw_ver = i2c_smbus_read_byte_data(touchkey->client, CYPRESS_FW_VER);
+ if (fw_ver < 0)
+ return fw_ver;
+
+ return sysfs_emit(buf, "0x%02x\n", fw_ver);
+}
+static DEVICE_ATTR_RO(fw_version);
+
+static struct attribute *tm2_touchkey_attrs[] = {
+ &dev_attr_module_version.attr,
+ &dev_attr_fw_version.attr,
+ NULL
+};
+ATTRIBUTE_GROUPS(tm2_touchkey);
+
static int tm2_touchkey_probe(struct i2c_client *client)
{
struct device_node *np = client->dev.of_node;
@@ -354,6 +404,7 @@ static struct i2c_driver tm2_touchkey_driver = {
.name = TM2_TOUCHKEY_DEV_NAME,
.pm = pm_sleep_ptr(&tm2_touchkey_pm_ops),
.of_match_table = tm2_touchkey_of_match,
+ .dev_groups = tm2_touchkey_groups,
},
.probe = tm2_touchkey_probe,
.id_table = tm2_touchkey_id_table,
When run on mainline, this is what was outputted:
samsung-expressatt:~$ cat /sys/bus/i2c/devices/0-0020/module_version
0x06
samsung-expressatt:~$ cat /sys/bus/i2c/devices/0-0020/fw_version
0x09
fw_version matches downstream ClockworkMod Recovery dmesg:
~ # dmesg | grep "FW Ver"
<3>[ 2.201312] cypress_touchkey 16-0020: Touchkey FW Version: 0x09
<3>[ 2.206317] cypress_touchkey 16-0020: Touchkey FW Version: 0x09,
system_rev: 8
Unfortunately, I'm not to sure what the other variant versions are, so I
will CC the driver's maintainers:
MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>");
MODULE_AUTHOR("Jaechul Lee <jcsing.lee@samsung.com>");
It also seems like I forgot to mention that this patch was assisted with
Claude and cleaned up by me. Will update the patch's description if I
need to send a v2.
next prev parent reply other threads:[~2025-12-09 7:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-05 10:16 [PATCH] ARM: dts: qcom: msm8960: expressatt: Add coreriver,tc360-touchkey Rudraksha Gupta via B4 Relay
2025-12-06 2:18 ` Dmitry Baryshkov
2025-12-06 3:54 ` Rudraksha Gupta
2025-12-06 4:01 ` Dmitry Baryshkov
2025-12-08 16:35 ` Konrad Dybcio
2025-12-09 7:10 ` Rudraksha Gupta [this message]
2025-12-16 12:59 ` Konrad Dybcio
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=1e74b956-a45a-4d3e-b7fa-e4d5dc0390db@gmail.com \
--to=guptarud@gmail.com \
--cc=andersson@kernel.org \
--cc=beomho.seo@samsung.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jcsing.lee@samsung.com \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@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).