Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp342348pxb; Tue, 19 Oct 2021 04:09:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8vWh8uSfX6aUxB26+xsFaTYwMUDxweVf0rZCEYoFA4U4KgmeKwC7PN2CnSyUF8uvcGFZ1 X-Received: by 2002:a05:6402:2550:: with SMTP id l16mr53211371edb.229.1634641771283; Tue, 19 Oct 2021 04:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634641771; cv=none; d=google.com; s=arc-20160816; b=us49VLWAn3EsZ1nxqaqF0+WMaLFColD4z22bOOYqIQhOSrEh2PRsZdSRxf30TWnM4f /D0xIctrLHinLIVun7dGbxgaeUlgm9v7j1Nq4QCtZpnCC1zhxKycb1b731ogkRK2MrKE f3eYdh/SZpCFiGxynBsefLJHVX116G0zYQ6J3N2I1V0XM0wuj1OMsxiqdhyOUuUUcJlm pvBte2n6ixYEEv6Zbq8KVFgDXCbEH3OyEG0ko72FyHdF1AiC6p2nuRGzsKv2/BXbaQXS 0jFIwQ4n7D9XoktGTN1VXNZv5+jS7ozRzlu5x89JRcH4IR6wzHq1FNAl7cdWxKSpxbnX R2pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6BDkaBcz/yzbHOnclpjUYTbO/un5wm0+9+u0An6RVSY=; b=Q76NGleJ3tl3ANCJpaxKsQTxbmB/DHKnx29QAltIX5LMJiSRzeAUUfOb0gk84fny4a SB1zttD0pqgT7WW+htIjDIWwD+Es6sAQ/wFMZiVmeosa7t2O592yk86kmRjGnVebINRx KipRKEG5pNr/6+Ta850I0RCheSfU82yjVxcBc3v/nDxQYmyKbiq8kratPgyjU/vynXK9 po1byD6Wl1rIpXqBz5xuM8CnhzCZtUtbajY7HwxIsZTDpgUaHYbM4fyaxsuqJJKn7T9a /QWqLY5qwqZDvGjlSWguelN1Hpc0uUQNgUqtOatFPyIURzASJx8Iaa8u1LIhRgsoErPN BrTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb12si21671277ejb.188.2021.10.19.04.08.51; Tue, 19 Oct 2021 04:09:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235362AbhJSLGj (ORCPT + 99 others); Tue, 19 Oct 2021 07:06:39 -0400 Received: from 82-65-109-163.subs.proxad.net ([82.65.109.163]:52266 "EHLO luna.linkmauve.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235309AbhJSLGi (ORCPT ); Tue, 19 Oct 2021 07:06:38 -0400 Received: by luna.linkmauve.fr (Postfix, from userid 1000) id 719AAF40C30; Tue, 19 Oct 2021 13:04:22 +0200 (CEST) From: Emmanuel Gil Peyrot To: Jiri Kosina Cc: Emmanuel Gil Peyrot , linux-input@vger.kernel.org, Ash Logan , =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= , =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= , Benjamin Tissoires , linux-kernel@vger.kernel.org, "Daniel J . Ogorchock" Subject: [PATCH v4 0/5] HID: nintendo: Add support for the Wii U gamepad Date: Tue, 19 Oct 2021 13:04:13 +0200 Message-Id: <20211019110418.26874-1-linkmauve@linkmauve.fr> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20210519085924.1636-1-linkmauve@linkmauve.fr> References: <20210519085924.1636-1-linkmauve@linkmauve.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This driver is for the DRC (wireless gamepad) when plugged to the DRH of the Wii U, a chip exposing it as a USB device. I tried to use this driver on master over usbip on my laptop, but usbip disconnects the device right after the driver created the /dev/input/event* files, so instead I have only tested this driver on the 4.19 branch of the linux-wiiu[1] downstream. Other than that, pretty much all of the HID parts of the gamepad work, it’s only missing microphone, camera and NFC input now but those are mostly standard (read require quirks) and pertain to other subsystems, so I felt like this can be upstreamed already. [1] https://gitlab.com/linux-wiiu/linux-wiiu Changes since v1: - Rename interfaces to be less redundant. - Add comments for potentially unclear things. - Reword some commits to include more needed information. - Include all needed includes. - Use helpful helper functions instead of (badly) reimplementing them myself. - Always return the correct type for each function, to avoid some bool/int confusion, or returning 0 to mean error. - Use myself as the module author, even though Ash did most of the initial work, I’m the one who will be maintaining this module from now on. - Use input_set_capability() instead of set_bit(…, keybit) to also set BIT(EV_KEY) on evbit[0]. - Call hid_hw_start() before input_register_device() but after the setup functions, so that hid_hw_open() is never called before it. - Add missing spin_lock_init() for the battery lock. - Use a static atomic for the drc_num, and remove the comment about using the interface number. - Interpret battery report as the voltage coming from an ADC, instead of the completely wrong ENERGY_NOW it was before. So basically addressing Jonathan’s and Barnabás’ comments. :) Changes since v2: - Guard against the possibility of CONFIG_HID_BATTERY_STRENGTH not having been selected. - Include forgotten linux/fixp-arith.h header. - Fix a warning in clamp() due to comparing a s16 with a #define. Changes since v3: - Rebased on top of hid.git#for-5.16/nintendo. - Merged into hid-nintendo. - Make hid-nintendo mostly a stub, with sub-drivers implementing the actual controllers. - Introduced CONFIG_HID_NINTENDO_WIIU to enable support for this device now. Ash Logan (1): HID: nintendo: drc: add support for the Wii U gamepad Emmanuel Gil Peyrot (4): HID: nintendo: split switch support into its own file HID: nintendo: drc: implement touch reports HID: nintendo: drc: add accelerometer, gyroscope and magnetometer readings HID: nintendo: drc: add battery reporting drivers/hid/Kconfig | 31 +- drivers/hid/Makefile | 2 + drivers/hid/hid-ids.h | 1 + .../{hid-nintendo.c => hid-nintendo-switch.c} | 43 +- drivers/hid/hid-nintendo-wiiu.c | 550 ++++ drivers/hid/hid-nintendo.c | 2300 +---------------- drivers/hid/hid-nintendo.h | 22 + drivers/hid/hid-quirks.c | 3 + 8 files changed, 645 insertions(+), 2307 deletions(-) copy drivers/hid/{hid-nintendo.c => hid-nintendo-switch.c} (98%) create mode 100644 drivers/hid/hid-nintendo-wiiu.c create mode 100644 drivers/hid/hid-nintendo.h -- 2.33.1