From patchwork Fri Oct 6 02:53:19 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: 9988301 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 6255060216 for ; Fri, 6 Oct 2017 02:54:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E05328B68 for ; Fri, 6 Oct 2017 02:54:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41E4C28CD4; Fri, 6 Oct 2017 02:54:01 +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 A37AD28B68 for ; Fri, 6 Oct 2017 02:54:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751901AbdJFCxq (ORCPT ); Thu, 5 Oct 2017 22:53:46 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:37037 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751782AbdJFCxo (ORCPT ); Thu, 5 Oct 2017 22:53:44 -0400 Received: by mail-pg0-f67.google.com with SMTP id o1so15795399pga.4; Thu, 05 Oct 2017 19:53:44 -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=IVJL44hyOls9pX+NRB2SI/D/qIkBCe1Ih7r7vUfv1Ag=; b=utyb0qIq8vvR11jb6kZ1rOIqiK5hHrjnEzZOAjxOCDsBlt75Nkp7zzHv3Z3s2Cw21o RpfrcRYaAP3g4IRRFvX3nRUsi5WO8M63ICRN23DSKyckYP9sQ5rV9K93MGgogd+uVGlV a8X4v1UbLdwbliZIqv/5q8Uwd3C57ie5Ih84F1R2a+WF0aL/Ive4Q7CpxZ0LV4MlNClh RkBWBhWewEgg+FbXvkG2r2Irb6RiWXcdk0fPNwNCVWP6RoA9E+Ppti2wQnmBvf4JtXll rXVYN8kKSbC2hupH7kUN7Lq5ewdSaRP86ynLmyf6y9AQgIet3noqI+zs0xxK0iIBzTyh NPug== 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=IVJL44hyOls9pX+NRB2SI/D/qIkBCe1Ih7r7vUfv1Ag=; b=d3Qea+CyVe+ESc9l1nkNHHxvC2/1hsrCURTO6RxbCOhYXZzWJq0pODeTIF75g7TpwR YiEtlciHYCJFddy7dd6fFZ13KyjyXC3vRGy+xbhHu9mQI0qnMYmlmLHGaJEryRWtny0W 8DsEGYXebDcTI8//Mo3zXpt+x5W/sGvQ9PlZEjNfAdMBDc5acIfTo7VNgHkqpHD+19q7 YNMg2hI4GykbliSmy3aHIp4SuUO7NU9um0PgFF8uORnGppXxtFcbD9eflAhCnHw36sU1 oQZ7fJZ7oV8uDZkTLvwb1UPiQbkxaqCPFCt1YnrtpppRq18TaBB/QFM2CGc361iGQSTY VmAw== X-Gm-Message-State: AMCzsaUqUKWxVoMD93z4dKu07PPK9kWhPPTkjbpxUoGDvYCUFZ1X7dDt uFIJP7H8mslmRK6pXDh7Ogg= X-Google-Smtp-Source: AOwi7QBETl3XRxt99AW50nGQcHNzSouw7SQNEhmVKbc/w2MtNhSCw1vfWiJAjCljrUYPJKfNPn4OtA== X-Received: by 10.99.101.70 with SMTP id z67mr643440pgb.178.1507258424221; Thu, 05 Oct 2017 19:53:44 -0700 (PDT) Received: from localhost (p2218-ipad303aobadori.miyagi.ocn.ne.jp. [123.216.73.218]) by smtp.gmail.com with ESMTPSA id n27sm523793pfi.11.2017.10.05.19.53.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Oct 2017 19:53:43 -0700 (PDT) From: Masaki Ota <012nexus@gmail.com> X-Google-Original-From: Masaki Ota To: jikos@kernel.org, benjamin.tissoires@redhat.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, masaki.ota@jp.alps.com Subject: [PATCH 7/7] Support Alps U1 USB Touchpad device Date: Fri, 6 Oct 2017 11:53:19 +0900 Message-Id: <20171006025319.2505-8-masaki.ota@jp.alps.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171006025319.2505-1-masaki.ota@jp.alps.com> References: <20171006025319.2505-1-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 -Add T4 USB device Product ID. (0x1216) -Separate T4 USB device initialization code from T4 Standard device code. -T4 USB device is used on HP Elite x2 series Signed-off-by: Masaki Ota --- drivers/hid/hid-alps.c | 35 +++++++++++++++++++++++++---------- drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 1 + 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c index b1eeb4839bfc..939ae8255805 100644 --- a/drivers/hid/hid-alps.c +++ b/drivers/hid/hid-alps.c @@ -440,6 +440,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: @@ -594,13 +595,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); + 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; @@ -609,11 +626,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) { @@ -764,6 +776,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: @@ -795,6 +808,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 779e26cb3ba9..13ded460885e 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 2b50d12b993e..71c2a021e296 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