From patchwork Wed Jun 12 08:33:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Life is hard, and then you die" X-Patchwork-Id: 10988951 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 B2EEE1398 for ; Wed, 12 Jun 2019 08:34:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A39B5289B4 for ; Wed, 12 Jun 2019 08:34:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97C9A289B7; Wed, 12 Jun 2019 08:34:29 +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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 43833289B4 for ; Wed, 12 Jun 2019 08:34:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731657AbfFLIeL (ORCPT ); Wed, 12 Jun 2019 04:34:11 -0400 Received: from chill.innovation.ch ([216.218.245.220]:35508 "EHLO chill.innovation.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731634AbfFLIeJ (ORCPT ); Wed, 12 Jun 2019 04:34:09 -0400 Received: from localhost (localhost [127.0.0.1]) by chill.innovation.ch (Postfix) with ESMTP id E76D064018A; Wed, 12 Jun 2019 01:34:07 -0700 (PDT) X-Virus-Scanned: amavisd-new at Received: from chill.innovation.ch ([127.0.0.1]) by localhost (chill.innovation.ch [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ynWuYposjBek; Wed, 12 Jun 2019 01:34:06 -0700 (PDT) From: =?utf-8?q?Ronald_Tschal=C3=A4r?= DKIM-Filter: OpenDKIM Filter v2.10.3 chill.innovation.ch E43566400E3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=innovation.ch; s=default; t=1560328446; bh=cpbIwpjc0S7uU5oxd8Zrd5ncqR9RhfgakrkuHbEEQqo=; h=From:To:Cc:Subject:Date:From; b=ci7ykCT8CY23B45eSwtZDpc489RJ40VioN4w3aE0Rpi3BRVgYFnOgfW+cPNRjD9Jp 1A1JLZfXldgmt2aLeSKI4h4pVpV25DTuiBjXFF62QlwnY8oVh8eB8HmC33CzRG8Tqa GAVgBRBvEHNYTy8Coyv4nFEkaUhq9+W1T8CsRlM8ZZ+moTW2DPiGttoloFOPGAb08v q3FrzJDR0kBKs90i67NlqtvtrkDK/rw67beMLxPpBGZh35xsoD4bkbTySw8PPngsjh j92JkQ2HUTJ9aA68PtBH3OMWj+uX2DlEpuaC8XMQRA5KD02zTtuUh5JO/K5T/QHIF9 KBmIEo0DZztjg== To: Jiri Kosina , Benjamin Tissoires , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/3] Apple iBridge support Date: Wed, 12 Jun 2019 01:33:57 -0700 Message-Id: <20190612083400.1015-1-ronald@innovation.ch> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 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 2016 and 2017 MacBook Pro's have a T1 chip that drives the Touch Bar, ambient light sensor, webcam, and fingerprint sensor; this shows up as an iBridge USB device in the system. These patches provide initial support for the Touch Bar and ALS - the webcam is already handled by existing drivers, and no information is currently known on how to access the fingerprint sensor (other than it's apparently via one of the extra interfaces available in the OS X USB configuration). One thing of note here is that both the ALS and (some of) the Touch Bar functionality are exposed via the same USB interface (and hence same hid_device), so both drivers need to share this device. This is solved by having the iBridge driver create multiple virtual HID devices for each real HID device to which the Touch Bar and ALS drivers attach, and then forwarding the calls between the real and virtual HID devices, so we end up with a structure like this: iBridge (HID) driver Sub drivers -- vhdev0 -- (unbound) / hdev1 --- vhdev1 --- tb-drv / -- vhdev2 -- / hdev2 --- vhdev3 --- als-drv Changes in v2: - Changed iBridge driver from an MFD driver to a HID driver. Instead of creating virtual HID drivers and (de)multiplexing their calls, this now create virtual HID devices and (de)multiplexing the operations on them. This is from the feedback by Benjamin Tissoires. - Applied all feedback on ALS driver from Jonathan Cameron - Applied all feedback on Touch Bar driver from Jonathan Cameron and Peter Meerwald-Stadler - various smaller cleanups Ronald Tschalär (3): HID: apple-ibridge: Add Apple iBridge HID driver. HID: apple-ib-tb: Add driver for the Touch Bar on MacBook Pro's. iio: light: apple-ib-als: Add driver for ALS on iBridge chip. drivers/hid/Kconfig | 24 + drivers/hid/Makefile | 2 + drivers/hid/apple-ib-tb.c | 1389 ++++++++++++++++++++++++++++++ drivers/hid/apple-ibridge.c | 588 +++++++++++++ drivers/hid/hid-ids.h | 1 + drivers/iio/light/Kconfig | 12 + drivers/iio/light/Makefile | 1 + drivers/iio/light/apple-ib-als.c | 607 +++++++++++++ include/linux/apple-ibridge.h | 23 + 9 files changed, 2647 insertions(+) create mode 100644 drivers/hid/apple-ib-tb.c create mode 100644 drivers/hid/apple-ibridge.c create mode 100644 drivers/iio/light/apple-ib-als.c create mode 100644 include/linux/apple-ibridge.h