linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Life is hard, and then you die" <ronald@innovation.ch>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Henrik Rydberg <rydberg@bitmath.org>
Cc: Lukas Wunner <lukas@wunner.de>,
	Federico Lorenzi <federico@travelground.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] Input: add Apple SPI keyboard and trackpad driver.
Date: Mon, 25 Feb 2019 00:05:29 -0800	[thread overview]
Message-ID: <20190225080529.GA26142@innovation.ch> (raw)
In-Reply-To: <20190221105609.5710-3-ronald@innovation.ch>


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 <federico@travelground.com>
> CC: Lukas Wunner <lukas@wunner.de>
> CC: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 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 <ronald@innovation.ch>
> ---
>  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

  reply	other threads:[~2019-02-25  8:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21 10:56 [PATCH v2 0/2] Add Apple SPI keyboard and trackpad driver Ronald Tschalär
2019-02-21 10:56 ` [PATCH v2 1/2] drm/bridge: sil_sii8620: depend on INPUT instead of selecting it Ronald Tschalär
2019-02-21 10:56 ` [PATCH v2 2/2] Input: add Apple SPI keyboard and trackpad driver Ronald Tschalär
2019-02-25  8:05   ` Life is hard, and then you die [this message]
2019-02-26  8:51     ` Andy Shevchenko
2019-02-26  9:20   ` Andy Shevchenko
2019-02-27  7:29     ` Life is hard, and then you die
2019-03-19 14:59       ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190225080529.GA26142@innovation.ch \
    --to=ronald@innovation.ch \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=federico@travelground.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=rydberg@bitmath.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).