lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1e74b956-a45a-4d3e-b7fa-e4d5dc0390db@gmail.com>
Date: Mon, 8 Dec 2025 23:10:03 -0800
From: Rudraksha Gupta <guptarud@...il.com>
To: Konrad Dybcio <konrad.dybcio@....qualcomm.com>,
 Bjorn Andersson <andersson@...nel.org>,
 Konrad Dybcio <konradybcio@...nel.org>, Rob Herring <robh@...nel.org>,
 Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>
Cc: linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org,
 linux-kernel@...r.kernel.org, beomho.seo@...sung.com, jcsing.lee@...sung.com
Subject: Re: [PATCH] ARM: dts: qcom: msm8960: expressatt: Add
 coreriver,tc360-touchkey

>> 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@...sung.com>");
MODULE_AUTHOR("Jaechul Lee <jcsing.lee@...sung.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.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ