From patchwork Fri Dec 28 02:15:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongye Yuan X-Patchwork-Id: 10744087 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA8CF6C2 for ; Fri, 28 Dec 2018 02:15:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9709E28C87 for ; Fri, 28 Dec 2018 02:15:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89B9428C8D; Fri, 28 Dec 2018 02:15:55 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 2937228C87 for ; Fri, 28 Dec 2018 02:15:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726900AbeL1CPw (ORCPT ); Thu, 27 Dec 2018 21:15:52 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:33876 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725910AbeL1CPw (ORCPT ); Thu, 27 Dec 2018 21:15:52 -0500 Received: by mail-lf1-f66.google.com with SMTP id p6so13771697lfc.1; Thu, 27 Dec 2018 18:15:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+oeNE994ddU4ESlpG4cF2e8+VGGg6eBkgvPAI2czDa0=; b=Z6FtGqF4WyEkrC4bjH6tK892tuJvjlmScj1xWeKom7zO2h/kzPvXmpuskJBhElNbRN xxMeQpDjli6PR1gpG84ToNLT5euKXh9v1+jiS+GlOcmJq0m1JGYDUD8837y0bRBtPs5F 01bppNLPYpVnZalLh0zY+R8LbDfWT2kv98Yh0JKw/mIMvx/gcZ9U+JY4Yc3O4cXkFh6U 3UgrlvKyt4QZJOUazM6HGsWIPM/CQGPdFKwhI/HKAntnIBLhHEsVZRQe7O5R5HUpGlRs e2HD7Ly6YqsWW6DA+4OCBQxKtunT7EmWrAPGUDRkb00JjXM4o5dHutrNepxA/5/ucPPQ WXcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+oeNE994ddU4ESlpG4cF2e8+VGGg6eBkgvPAI2czDa0=; b=thYZt3lRLC8Yn6nRW1U/AHYcg1MREW7MmbyZMaHUodRv31llkMuHztsqLxRpvAfik5 cYvwbhSlPPwEMFD/PXCY4tpNoK7LuE5Of21DzZjHx/Ps2adtiuD+YsNVPrjf7hV1Yi8i KkwhDAAaBhAwE3XbKD9JnnRVuiW/k1rRYJivca0ToC2WXLiAXOCsJL7UpuBOlDwWowTU jPtOnrbIOOenYeJr6wBNKR9+BWfYnd1IDO9n99VBXPZeoc2OXY8uw8SwY7ah7uOWEUqX WfRCUlKAZ2H8rvYR6Q29DWlc/fNQS5eYk9Md2ARjEKKK59ZxmGeGLqCq0rCdxFTInvUK gNbA== X-Gm-Message-State: AA+aEWZJfh3qoGZY3dxLOlO4FZdGkRF9wL2qC5yiYT7VuyfOzo9PUtE0 eJIBkNmC6tmFqdqHo2Jey/jA4o2/F8d8tLW//npEi1Op X-Google-Smtp-Source: AFSGD/UAgMBwvRCaig+p8jTWrM5y1r0hmTNKEpGnrMs6koFj9YT7JMx/PK8ARmTxcmfT4ryVABucsHqiTjcxuYZ+/ok= X-Received: by 2002:a19:d04d:: with SMTP id h74mr12564794lfg.52.1545963350435; Thu, 27 Dec 2018 18:15:50 -0800 (PST) MIME-Version: 1.0 References: <20181227094145.GB15340@kroah.com> <20181227121118.GA28577@kroah.com> In-Reply-To: From: liquid Date: Fri, 28 Dec 2018 10:15:38 +0800 Message-ID: Subject: [PATCH] HID: sony: Fix SHANWAN PS3 GamePad rumbling on USB again To: Greg KH Cc: Bastien Nocera , Jiri Kosina , linux-usb@vger.kernel.org, linux-input@vger.kernel.org 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 6323ffb83e23eab9a08208063f9dba27c6a0d228 Mon Sep 17 00:00:00 2001 From: Hongye Yuan Date: Thu, 27 Dec 2018 09:41:23 +0800 Subject: [PATCH] HID: sony: Fix SHANWAN PS3 GamePad rumbling on USB again - The SHANWAN DS3 clone joystick requires HID Output Reports via Interrupt EP. - Added a quirk for SHANWAN PS3 GamePad. Signed-off-by: Hongye Yuan --- drivers/hid/hid-sony.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) hid_info(hdev, "can't set operational mode: step 3, ignoring\n"); @@ -2097,9 +2099,13 @@ static void sixaxis_send_output_report(struct sony_sc *sc) } } - hid_hw_raw_request(sc->hdev, report->report_id, (u8 *)report, - sizeof(struct sixaxis_output_report), - HID_OUTPUT_REPORT, HID_REQ_SET_REPORT); + /* SHANWAN controllers require sending output reports via intr channel */ + if (sc->quirks & SHANWAN_GAMEPAD) + hid_hw_output_report(sc->hdev, (u8 *)report, + sizeof(struct sixaxis_output_report)); + else hid_hw_raw_request(sc->hdev, report->report_id, (u8 *)report, + sizeof(struct sixaxis_output_report), + HID_OUTPUT_REPORT, HID_REQ_SET_REPORT); } static void dualshock4_send_output_report(struct sony_sc *sc) @@ -2811,6 +2817,9 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) if (!strcmp(hdev->name, "FutureMax Dance Mat")) quirks |= FUTUREMAX_DANCE_MAT; + if (!strcmp(hdev->name, "SHANWAN PS3 GamePad")) + quirks |= SHANWAN_GAMEPAD; + sc = devm_kzalloc(&hdev->dev, sizeof(*sc), GFP_KERNEL); if (sc == NULL) { hid_err(hdev, "can't alloc sony descriptor\n"); diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 9671a4bad643..842f370cfec2 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -58,6 +58,7 @@ #define FUTUREMAX_DANCE_MAT BIT(13) #define NSG_MR5U_REMOTE_BT BIT(14) #define NSG_MR7U_REMOTE_BT BIT(15) +#define SHANWAN_GAMEPAD BIT(16) #define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT) #define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT) @@ -1490,6 +1491,7 @@ static int sony_register_sensors(struct sony_sc *sc) */ static int sixaxis_set_operational_usb(struct hid_device *hdev) { + struct sony_sc *sc = hid_get_drvdata(hdev); const int buf_size = max(SIXAXIS_REPORT_0xF2_SIZE, SIXAXIS_REPORT_0xF5_SIZE); u8 *buf; @@ -1521,7 +1523,7 @@ static int sixaxis_set_operational_usb(struct hid_device *hdev) * But the USB interrupt would cause SHANWAN controllers to * start rumbling non-stop. */ - if (strcmp(hdev->name, "SHANWAN PS3 GamePad")) { + if (sc->quirks & SHANWAN_GAMEPAD) { ret = hid_hw_output_report(hdev, buf, 1); if (ret < 0) {