From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5019724887E for ; Tue, 9 Dec 2025 07:10:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765264206; cv=none; b=NEcgHSZ3cDtWH0Wm+b10aZGclqfJ3oiYXBkyTuR+kC/2DSdno/NkSPAHpC4YbnCT4snmdQjntCLQJIiAMvfNvThpVj5dCWU/g7NbUVbarJIToeATEJyZm5zpqxet79JAhoqFoVgw5T+BL2ygtEo7uknEWH0iAC3y5x+f2YJXHvI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765264206; c=relaxed/simple; bh=GWUPZWPx87d+R5G1pL0rdruViGt7Dva8i9gC5jM5GW0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TFsM1DTnQF8ogGdU3knPZEvXSLLJlpcWfMZHpJRwsJ4a8HIzgQte9GwQgT6QXCg1jWKOky+bTW18dp7v3DhAuVM5Dh2g9Id2W5eEQ7ILJzSdLPfcjoME2is3WecFL46xhFDbbJb3KGiCddf9syX1lml8ZiLDu7CJJmQg13tebmo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nFWS9MoU; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nFWS9MoU" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-297e264528aso52728215ad.2 for ; Mon, 08 Dec 2025 23:10:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765264205; x=1765869005; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=xg55Tln+6DnfF2kSPt4sxJR4WZV7mWdktIHdBzmSnGA=; b=nFWS9MoU9pXA1gTpWehV9xHBECs5mi0WXUevYAb72p4x08+jCsKm4BKTR1EDu1uNYW kbcHwqwtUJuOG15IVFlkuVClGCTtdcYifMk9/ya77a0DDxs2KwNgemGjweRd5afWkcqi xXstyYMoPJ7/QtxhytwHXPranF2bzyYhO02hS2b8rJbZm6ztV/MosXo5TSOiKxDxwsap oIQ+i91T3T5WYx9HIs9fpnZ0LaCG6IMzWtF9wjVy4ERRY59u3V69gTSdmbQ08wF/Apez bE9S35xp4lz4rotyGTS/NoYorhgNl7Lv2kIGaZAlPnT8EghSFULTeMt0yT+UCryUUAbV K/fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765264205; x=1765869005; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xg55Tln+6DnfF2kSPt4sxJR4WZV7mWdktIHdBzmSnGA=; b=MEJUuDjDKbjoO0iatzvrhU5tOzIodYogplnDsbPC1ousSwuNgviF/klIZ3VlefFUcK S+9/9QsQmILPF7nfT02MWxUM09Flq9oigCg3SY+nODJrrrYHst5P1ib1u9jyfswIo7je PIL0qncO8jrZ437UWmKnGqxbwpJFeFiu03XVWQZ7BqjmGvihuZrHhPe8EZ0RqHzzs/05 fiY9+BeLHMnv1lpRPRUQR0GphsqTlKU63O0f9ZftOPdvJ7DHBdLLA4wIhYItCAHEa8TG weESQSwFWfiaW3/Oo7GsyEMQkRd0m/Cw6CwzxmOUObO5C6rK6LdrImfjQTPG6FkYzwzV lM+A== X-Forwarded-Encrypted: i=1; AJvYcCXm/tOuEXf66yM0BVVU46VTLRePgoILuK4iQzfq0DZ0StYro6CJUG+6w8S3ipo9saUJvbnKm5kWJscXBdA=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4kWJEMdCZfaJ5NZfV88REpnotzUzhXt/al1nLr94sNnfBc+f+ dNU9CqsJ/IEojayRQdTwSRky8ps9jWyuyjzJNDhI5Vm3k8tWHfB6ip72V+B8Cnn2ae4= X-Gm-Gg: ASbGncvF3ZbjMmc6I+ZaDj/huu04680kBmm+ZjAlDRDfN07p7Wf6riO+E2hTNlNuQd/ TBUq5XkhQCHYAxrCXi13AWQN6fT63pwvKHCB9Tcyi3MQMZUOQWHdvnOcbM+slYTrgVJRKZt7lDz lOlCY7ubylsIFrzVTX0yyV/DFA8e+2JXUywWI/DgnBf/QmV2SrhK2mOAR4g62N/Y2b++qzK5gqy G6nEDV+em/c0RUsj4I44Rl4plEMGsjGGrKL5yWGO6og8QHmMu6CJZr0iWCa0PpmYkNF2uCpKSwF N8fBXVpCs3yG1Qj2Tt5KijFkYUMzNDnpzFGhKPW4mxGjmREU+38KCsoRf8y1dfhWlCLVwhf4G4b z1PsTT+DaWXtsZuJAKwgqyb7QKtAtPYaUc9PWLufuEAkIi2zYT3LqzDGu2EzHCIFpoYucbelGmm D+qJQRsIu4IWbLprwJ+ISby6aoepdXP75oMdnt1hNP6ShlSPvTlI++HDGLPSCiU7WjcA== X-Google-Smtp-Source: AGHT+IH4xWkk+8tkFcAvGOYvd9507+UkaXMACCKUvjqSLoxEHfx36eSz/8egBxn9noqBt1eeILK0/Q== X-Received: by 2002:a05:701a:c952:b0:119:e56b:98b1 with SMTP id a92af1059eb24-11e032aa4a3mr5974342c88.24.1765264204406; Mon, 08 Dec 2025 23:10:04 -0800 (PST) Received: from [192.168.68.65] (104-12-136-65.lightspeed.irvnca.sbcglobal.net. [104.12.136.65]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11df7552211sm69916005c88.1.2025.12.08.23.10.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Dec 2025 23:10:04 -0800 (PST) Message-ID: <1e74b956-a45a-4d3e-b7fa-e4d5dc0390db@gmail.com> Date: Mon, 8 Dec 2025 23:10:03 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] ARM: dts: qcom: msm8960: expressatt: Add coreriver,tc360-touchkey To: Konrad Dybcio , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, beomho.seo@samsung.com, jcsing.lee@samsung.com References: <20251205-expressatt-touchkey-v1-1-1444b927c9f3@gmail.com> <532531d2-8f26-4ffa-9355-7821a4d64200@oss.qualcomm.com> Content-Language: en-US From: Rudraksha Gupta In-Reply-To: <532531d2-8f26-4ffa-9355-7821a4d64200@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit >> 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 "); MODULE_AUTHOR("Jaechul Lee "); 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.