From patchwork Thu Apr 27 07:40:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masaki Ota <012nexus@gmail.com> X-Patchwork-Id: 9702467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DE291601D3 for ; Thu, 27 Apr 2017 07:42:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1E931FFB7 for ; Thu, 27 Apr 2017 07:42:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C513C2029B; Thu, 27 Apr 2017 07:42:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,FROM_STARTS_WITH_NUMS,RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 375041FFB7 for ; Thu, 27 Apr 2017 07:42:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965785AbdD0Hlg (ORCPT ); Thu, 27 Apr 2017 03:41:36 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33798 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968111AbdD0HlK (ORCPT ); Thu, 27 Apr 2017 03:41:10 -0400 Received: by mail-pf0-f196.google.com with SMTP id g23so7273314pfj.1; Thu, 27 Apr 2017 00:41:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6s8XCyP7QZSEve7x99WJ0WEq9wF25lF36d30rYtvV9g=; b=CEMMUs96IyLj1EFWqyQ0BhUzoAN+zd8npz9aLAdFtA+gfoebpP55PhhzMPIO4ciVvd FG3tOmLFpJJWjlQsxA/z1uSlHXth6vEz/F3WnzfNQJ97Ely8sHcapmUObX3i3e2xxWUm eUCvQj/qYeLFZ9reJzY25fJw0YKXPxDLtFv8ayC46MftdyhKIs5VlWd2TdnE1uLgGpbb WOr+SqP8zHDwl7Y1ZErHEdW6fQ2Vh8tppa61wT6B2o+3tw88RsQqhSYGb/vL53dYoK7i f4yLxOxMbJpMVE/Jj7COEXWqXXL8irREctkSZm87S9tGrITEX4J1zPeGEQ7GZvjOZuYd VgpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6s8XCyP7QZSEve7x99WJ0WEq9wF25lF36d30rYtvV9g=; b=Ou9Wlgqt4Nbn5os5XHj/PGohuuwuTLwEreyEzbBOf3o3rcRcHp097wergKhJLvgOFN QpuvW16zFf7K3Y8LlZJwfNGtQFTcAsLgBc+JAMQy+H336nR98AZpQsR5AHQ73+IdGToI VdV7GVvCv+buDhzejfsqb5abHonLaKA/snqO0D4rA76ocmfP7wkQXaFzJ+IC9zU6PuEs Q4CtnRZL5aMCba0QIVHdYIX5frik91GeBlUr4/3aQOstPSmUhxWazNS8GodNJp/MPKU7 +sH6smQFidkYXOv41waWvRIOTPO/4EnoYv1XbrbPpLEALa0Ii1g8Iql62eTrf7tK9kLF COHQ== X-Gm-Message-State: AN3rC/7eBr3LZzRzENdT8IP7jYHGzF2HeuMNp8b1osxbfw9jjgTz7+5C eo9ikEH838wqtQ== X-Received: by 10.98.16.208 with SMTP id 77mr4180076pfq.105.1493278864262; Thu, 27 Apr 2017 00:41:04 -0700 (PDT) Received: from localhost (p2239-ipad303aobadori.miyagi.ocn.ne.jp. [123.216.73.239]) by smtp.gmail.com with ESMTPSA id n8sm2290360pgd.31.2017.04.27.00.41.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 00:41:03 -0700 (PDT) From: Masaki Ota <012nexus@gmail.com> X-Google-Original-From: Masaki Ota To: benjamin.tissoires@redhat.com, jikos@kernel.org Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, masaki.ota@jp.alps.com Subject: [PATCH 4/4] Add Alps T4 USB Touchpad device ID Date: Thu, 27 Apr 2017 16:40:34 +0900 Message-Id: <1493278834-8523-5-git-send-email-masaki.ota@jp.alps.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493278834-8523-1-git-send-email-masaki.ota@jp.alps.com> References: <1493278834-8523-1-git-send-email-masaki.ota@jp.alps.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Masaki Ota -Support Alps T4 USB Touchpad device -Laptop names that use this Touchpad:Elite x2 1012 G1 Tablet, HP Pro x2 612 G2 Signed-off-by: Masaki Ota --- drivers/hid/hid-alps.c | 37 ++++++++++++++++++++++++++----------- drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 1 + 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c index e7ae3a7..d2d34c4 100644 --- a/drivers/hid/hid-alps.c +++ b/drivers/hid/hid-alps.c @@ -444,6 +444,7 @@ static int alps_raw_event(struct hid_device *hdev, switch (hdev->product) { case HID_PRODUCT_ID_T4_BTNLESS: + case HID_DEVICE_ID_ALPS_T4_USB: ret = t4_raw_event(hdata, data, size); break; default: @@ -598,13 +599,29 @@ static int T4_init(struct hid_device *hdev, struct alps_dev *pri_data) int ret; u8 tmp, sen_line_num_x, sen_line_num_y; - ret = t4_read_write_register(hdev, T4_PRM_ID_CONFIG_3, &tmp, 0, true); - if (ret < 0) { - dev_err(&hdev->dev, "failed T4_PRM_ID_CONFIG_3 (%d)\n", ret); - goto exit; + if (hdev->product == HID_DEVICE_ID_ALPS_T4_BTNLESS) { + ret = t4_read_write_register(hdev, + T4_PRM_ID_CONFIG_3, &tmp, 0, true); + if (ret < 0) { + dev_err(&hdev->dev, + "failed T4_PRM_ID_CONFIG_3 (%d)\n", ret); + goto exit; + } + sen_line_num_x = + 16 + ((tmp & 0x0F) | (tmp & 0x08 ? 0xF0 : 0)); + sen_line_num_y = + 12 + (((tmp & 0xF0) >> 4) | (tmp & 0x80 ? 0xF0 : 0)); + ret = t4_read_write_register(hdev, + PRM_SYS_CONFIG_1, &tmp, 0, true); + if (ret < 0) { + dev_err(&hdev->dev, + "failed PRM_SYS_CONFIG_1 (%d)\n", ret); + goto exit; + } + } else { + sen_line_num_x = 20; + sen_line_num_y = 12; } - sen_line_num_x = 16 + ((tmp & 0x0F) | (tmp & 0x08 ? 0xF0 : 0)); - sen_line_num_y = 12 + (((tmp & 0xF0) >> 4) | (tmp & 0x80 ? 0xF0 : 0)); pri_data->x_max = sen_line_num_x * T4_COUNT_PER_ELECTRODE; pri_data->x_min = T4_COUNT_PER_ELECTRODE; @@ -613,11 +630,6 @@ static int T4_init(struct hid_device *hdev, struct alps_dev *pri_data) pri_data->x_active_len_mm = pri_data->y_active_len_mm = 0; pri_data->btn_cnt = 1; - ret = t4_read_write_register(hdev, PRM_SYS_CONFIG_1, &tmp, 0, true); - if (ret < 0) { - dev_err(&hdev->dev, "failed PRM_SYS_CONFIG_1 (%d)\n", ret); - goto exit; - } tmp |= 0x02; ret = t4_read_write_register(hdev, PRM_SYS_CONFIG_1, NULL, tmp, false); if (ret < 0) { @@ -768,6 +780,7 @@ static int alps_probe(struct hid_device *hdev, const struct hid_device_id *id) switch (hdev->product) { case HID_DEVICE_ID_ALPS_T4_BTNLESS: + case HID_DEVICE_ID_ALPS_T4_USB: data->dev_type = T4; break; case HID_DEVICE_ID_ALPS_U1_DUAL: @@ -799,6 +812,8 @@ static const struct hid_device_id alps_id[] = { USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1) }, { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_T4_BTNLESS) }, + { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, + USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_T4_USB) }, { } }; MODULE_DEVICE_TABLE(hid, alps_id); diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 779e26c..13ded46 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1777,6 +1777,7 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_I2C_DEVICE(USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_DUAL) }, { HID_I2C_DEVICE(USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1) }, { HID_I2C_DEVICE(USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_T4_BTNLESS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_T4_USB) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 2b50d12..71c2a02 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -76,6 +76,7 @@ #define USB_VENDOR_ID_ALPS_JP 0x044E #define HID_DEVICE_ID_ALPS_U1_DUAL 0x120B #define HID_DEVICE_ID_ALPS_U1 0x1215 +#define HID_DEVICE_ID_ALPS_T4_USB 0x1216 #define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C #define USB_VENDOR_ID_AMI 0x046b