Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4194251imc; Mon, 25 Feb 2019 00:06:14 -0800 (PST) X-Google-Smtp-Source: AHgI3IZbCwWlsGdKKtapyb8d7El8TFcIXZLc89Xt6P8nrU+CUWrQnTlrtGO+nU6nKdh5trgxr/ss X-Received: by 2002:a17:902:9a95:: with SMTP id w21mr16957004plp.118.1551081974615; Mon, 25 Feb 2019 00:06:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551081974; cv=none; d=google.com; s=arc-20160816; b=LfanZoZl8ePjYP8C6hzS1VUesS9z3+77LWhGigZcrGXAt+vRCYB7UP6j38iQbS+1h0 KEaOLnkLbnlz0lDWk7BSby5nm+dolDxoCY6RdfpQaKxUqAZ+LfCITAd6k0JmAeO7KtHD +TqnzZuQ2Loy7cRaS4XfE63NP4UyNIoFu3J1eUVrg7ojY9vhe8rrXqgVJGeyKsTmN/Nx hzm5HwJWbDT1aufCLzSTZ1fmgFE7tJDT1+j6mglP7u8KROOVCFLFZI9DR78G8skSfcFP CaynAu9yxcaEfxIscpzwzY5SGwgv22c6jXI8BD8LhK4O+M6ZnZdhbpHB2JjL1ceahzN1 urag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:dkim-filter :date; bh=Bhd7fGHDixOe6T2Ks9+BQBSDrDKpWJirsq996QZvXrE=; b=sPTTjXEFKtsiQqIEz8XOEjWNNEZLgEwVHc5tICFPbAjP9z2eWhyXCTKrVR+WzH602x tSM0yRJZ3C0BO+/6YLfcuOZxiXnPeFbTp0H4HrdLFAjCu+dnIU4eLvdJ8z6nDvm/xSXe 3Je+0ZTyihASE0PVucsz22CrltmLYuT7w0bV4zY64p2+sTDddu4bUKPO6Wa6j3aQicpH bJVqyHjshjxp3AayiVvKuKvOvreS7Ogk3kk4VQWIHf8LEx4ivZOVkkH52dJDN51GBiYh 0iFGN1EZCi1ZwE4RIdYS5Z08hsKccalBjjOaj6JI9DKjqrYXvYOKtMISSDfUUD+JvaLR iaFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@innovation.ch header.s=default header.b=grrfjANy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=innovation.ch Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v79si9120838pfa.207.2019.02.25.00.05.58; Mon, 25 Feb 2019 00:06:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@innovation.ch header.s=default header.b=grrfjANy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=innovation.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726035AbfBYIFb (ORCPT + 99 others); Mon, 25 Feb 2019 03:05:31 -0500 Received: from chill.innovation.ch ([216.218.245.220]:50470 "EHLO chill.innovation.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725941AbfBYIFb (ORCPT ); Mon, 25 Feb 2019 03:05:31 -0500 Date: Mon, 25 Feb 2019 00:05:29 -0800 DKIM-Filter: OpenDKIM Filter v2.10.3 chill.innovation.ch E41E1640194 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=innovation.ch; s=default; t=1551081929; bh=Bhd7fGHDixOe6T2Ks9+BQBSDrDKpWJirsq996QZvXrE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=grrfjANy2PT+e6VfWj9cVJUAuSJSVnKXErBHO5UPVTgHXXWzFL3lYNzpU22iVsQBA I0azUZIGbOfEzFCdiQ7IMY6MP8rgCCKWgt8GrPi/UpxiX17inPLnMFYTIjKougcHts wT3GRnG7IVhuU0nGM5QZnYf5MvH9H81gmIBe3xKIFU3fhcJnq1qwvobUO4UC6CPNV2 07MbvONtq+jCZqmO4XW5r+epqVZiYrliq4cUARQAh19NZvT44fDQQHHJgVMXpnXrL+ 2ks2rer2WYmYTbGBudH961cUPiczq7XNkxFCnjx0rIx4S1Wo9VYGMOfKxZPeWYvgOL 9MdzMNyYVEGpQ== From: "Life is hard, and then you die" To: Dmitry Torokhov , Henrik Rydberg Cc: Lukas Wunner , Federico Lorenzi , Andy Shevchenko , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] Input: add Apple SPI keyboard and trackpad driver. Message-ID: <20190225080529.GA26142@innovation.ch> References: <20190221105609.5710-1-ronald@innovation.ch> <20190221105609.5710-3-ronald@innovation.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190221105609.5710-3-ronald@innovation.ch> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 21, 2019 at 02:56:09AM -0800, Ronald Tschal?r wrote: > The keyboard and trackpad on recent MacBook's (since 8,1) and > MacBookPro's (13,* and 14,*) are attached to an SPI controller instead > of USB, as previously. The higher level protocol is not publicly > documented and hence has been reverse engineered. As a consequence there > are still a number of unknown fields and commands. However, the known > parts have been working well and received extensive testing and use. > > In order for this driver to work, the proper SPI drivers need to be > loaded too; for MB8,1 these are spi_pxa2xx_platform and spi_pxa2xx_pci; > for all others they are spi_pxa2xx_platform and intel_lpss_pci. For this > reason enabling this driver in the config implies enabling the above > drivers. > > CC: Federico Lorenzi > CC: Lukas Wunner > CC: Andy Shevchenko > Link: https://bugzilla.kernel.org/show_bug.cgi?id=99891 > Link: https://bugzilla.kernel.org/show_bug.cgi?id=108331 > Signed-off-by: Ronald Tschal?r > --- > drivers/input/keyboard/Kconfig | 14 + > drivers/input/keyboard/Makefile | 1 + > drivers/input/keyboard/applespi.c | 2003 +++++++++++++++++++++++++++++ > 3 files changed, 2018 insertions(+) > create mode 100644 drivers/input/keyboard/applespi.c [snip] > diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c > new file mode 100644 > index 000000000000..2a8d1786011d > --- /dev/null > +++ b/drivers/input/keyboard/applespi.c [snip] > +/** > + * This is a reduced version of print_hex_dump() that uses dev_printk(). > + */ > +static void dev_print_hex_dump(const char *level, const struct device *dev, > + const char *prefix_str, > + int rowsize, int groupsize, > + const void *buf, size_t len, bool ascii) > +{ > + const u8 *ptr = buf; > + int i, linelen, remaining = len; > + unsigned char linebuf[32 * 3 + 2 + 32 + 1]; > + > + if (rowsize != 16 && rowsize != 32) > + rowsize = 16; > + > + for (i = 0; i < len; i += rowsize) { > + linelen = min(remaining, rowsize); > + remaining -= rowsize; > + > + hex_dump_to_buffer(ptr + i, linelen, rowsize, groupsize, > + linebuf, sizeof(linebuf), ascii); > + > + dev_printk(level, dev, "%s%s\n", prefix_str, linebuf); > + } > +} Apologies, I should've have fixed this before posting v2: I'll introduce an additional patch to add this function to the core to avoid duplication and because I presume this may be useful for others too. Cheers, Ronald