All of lore.kernel.org
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
To: Lee Jones <lee.jones@linaro.org>
Cc: Olof Johansson <olof@lixom.net>,
	Doug Anderson <dianders@chromium.org>,
	Bill Richardson <wfrichar@chromium.org>,
	Simon Glass <sjg@google.com>,
	Gwendal Grignou <gwendal@google.com>,
	Jonathan Corbet <corbet@lwn.net>,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Subject: [PATCH RESEND v2 0/7] platform/chrome: Add user-space dev inferface support
Date: Fri,  2 Jan 2015 14:32:45 +0100	[thread overview]
Message-ID: <1420205572-2640-1-git-send-email-javier.martinez@collabora.co.uk> (raw)

Hello,

The mainline ChromeOS Embedded Controller (EC) driver is still missing some
features that are present in the downstream ChromiumOS tree. These are:

  - Low Pin Count (LPC) interface
  - User-space device interface
  - Access to vboot context stored on a block device
  - Access to vboot context stored on EC's nvram
  - Power Delivery Device
  - Support for multiple EC in a system

This is a second version of a series that adds support for the first two of
the missing features: the EC LPC and EC character device interfaces that
are used by user-space to access the ChromeOS EC. The support patches were
taken from the downstream ChromiumOS 3.14 tree with the fixes and cleanups
squashed to have a minimal patch-set.

The version of the ChromeOS EC chardev driver in this series still does not
reflect the latest one that is in the downstream ChromiumOS 3.14 kernel but
makes the delta shorter. Following patches will add the remaining missing
features until both trees are in sync. I preferred to first add the initial
support and then adding the other features to both maintain the original
patch history in the downstream kernel and so preserve the patch authorship
and also make the diff to have a working cros user-space interface smaller.

Version 1 of this series was [0] and added the Chrome EC chardev driver
and the sysfs interface to drivers/mfd since that is what is done in the
downstream ChromiumOS kernel but Lee Jones asked to find a better place
since those are not really multi-function device drivers. So this version
places them under drivers/platform/chrome since MAINTAINERS says that this
sub-directory is "CHROME HARDWARE PLATFORM SUPPORT" which seems a good fit.

A big change in this version is that the ioctl API is modified to make it
64-bit safe and compatible with both 64 and 32 bit user-space binaries.
The data structures passed as arguments to ioctl commands had pointers fields
and these have different byte boundaries alignment requirement so the previous
version had a compat ioctl interface. The feedback was that this had to be
avoided since this was a new ioctl API so the pointers fields were replaced
with a set of fixed-size arrays to be used instead. This has the drawback that
more data could be used and copied between user and kernel space so feedback
is welcomed if there is a better approach to solve this kind of issues.

The patches were tested on an Exynos5420 Peach Pit Chromebook and (thanks to
Bill Richardson) on an x86 Pixel Chromebook using an ectool [1] modified to
use the new ioctl API. The LPC interface driver and the lightbar sysfs driver
were also tested on the Pixel Chromebook.

The series is composed of the following patches:

Bill Richardson (4):
  mfd: cros_ec: Add cros_ec_lpc driver for x86 devices
  platform/chrome: Add Chrome OS EC userspace device interface
  platform/chrome: Create sysfs attributes for the ChromeOS EC.
  platform/chrome: Expose Chrome OS Lightbar to users

Javier Martinez Canillas (3):
  mfd: cros_ec: Use fixed size arrays to transfer data with the EC
  mfd: cros_ec: Add char dev and virtual dev pointers
  mfd: cros_ec: Instantiate ChromeOS EC character device

 Documentation/ioctl/ioctl-number.txt       |   1 +
 drivers/i2c/busses/i2c-cros-ec-tunnel.c    |  51 +---
 drivers/input/keyboard/cros_ec_keyb.c      |  13 +-
 drivers/mfd/Kconfig                        |  10 +
 drivers/mfd/Makefile                       |   1 +
 drivers/mfd/cros_ec.c                      |  19 +-
 drivers/mfd/cros_ec_lpc.c                  | 305 ++++++++++++++++++++++++
 drivers/platform/chrome/Kconfig            |  14 +-
 drivers/platform/chrome/Makefile           |   2 +
 drivers/platform/chrome/cros_ec_dev.c      | 274 +++++++++++++++++++++
 drivers/platform/chrome/cros_ec_dev.h      |  53 +++++
 drivers/platform/chrome/cros_ec_lightbar.c | 367 +++++++++++++++++++++++++++++
 drivers/platform/chrome/cros_ec_sysfs.c    | 271 +++++++++++++++++++++
 include/linux/mfd/cros_ec.h                |  23 +-
 14 files changed, 1342 insertions(+), 62 deletions(-)
 create mode 100644 drivers/mfd/cros_ec_lpc.c
 create mode 100644 drivers/platform/chrome/cros_ec_dev.c
 create mode 100644 drivers/platform/chrome/cros_ec_dev.h
 create mode 100644 drivers/platform/chrome/cros_ec_lightbar.c
 create mode 100644 drivers/platform/chrome/cros_ec_sysfs.c

Patch #1 modified the struct cros_ec_command structure so it can be used
as an ioctl argument and be 64 and 32 bit safe and patch #2 adds fields
to the struct cros_ec_device that will be needed by the EC chardev driver.

Patch #3 adds support for the EC LPC interface used on x86 Chromebooks.

Patch #4 adds the ChromeOS chardev driver and patch #5 instantiates it
from the mfd cros_ec driver.

Patch #6 exposes sysfs attributes that can be used by user space programs
to get information and control the ChromeOS EC.

Patch #7 exposes sysfs attributes that are used to control the lightbar
RGB LEDs found on the Pixel Chromebook.

The patches must be applied together and in that order due dependencies,
probably through the mfd tree.

Best regards,
Javier

[0]: https://lkml.org/lkml/2014/11/17/429
[1]: git://git.collabora.co.uk/git/user/javier/ec.git mainline-ioctl


             reply	other threads:[~2015-01-02 13:33 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-02 13:32 Javier Martinez Canillas [this message]
2015-01-02 13:32 ` [PATCH RESEND v2 1/7] mfd: cros_ec: Use fixed size arrays to transfer data with the EC Javier Martinez Canillas
2015-01-20  7:48   ` Lee Jones
2015-01-20 15:40     ` Javier Martinez Canillas
2015-01-02 13:32 ` [PATCH RESEND v2 2/7] mfd: cros_ec: Add char dev and virtual dev pointers Javier Martinez Canillas
2015-01-20  7:50   ` Lee Jones
2015-01-20 15:41     ` Javier Martinez Canillas
2015-01-20 16:36       ` Lee Jones
2015-01-20 16:45         ` Javier Martinez Canillas
2015-01-20 16:51           ` Lee Jones
2015-01-02 13:32 ` [PATCH RESEND v2 3/7] mfd: cros_ec: Add cros_ec_lpc driver for x86 devices Javier Martinez Canillas
2015-01-20  8:11   ` Lee Jones
2015-01-20 15:58     ` Javier Martinez Canillas
2015-01-20 16:34       ` Lee Jones
2015-01-20 16:52         ` Javier Martinez Canillas
2015-01-21 17:05           ` Javier Martinez Canillas
2015-01-22  8:42           ` Lee Jones
2015-01-22  9:08             ` Javier Martinez Canillas
2015-01-22  9:46               ` Lee Jones
2015-01-22 10:36                 ` Javier Martinez Canillas
2015-01-22 10:56                   ` Lee Jones
2015-01-22 11:17                     ` Javier Martinez Canillas
2015-01-02 13:32 ` [PATCH RESEND v2 4/7] platform/chrome: Add Chrome OS EC userspace device interface Javier Martinez Canillas
2015-01-13 23:40   ` Gwendal Grignou
2015-01-02 13:32 ` [PATCH RESEND v2 5/7] mfd: cros_ec: Instantiate ChromeOS EC character device Javier Martinez Canillas
2015-01-20  8:20   ` Lee Jones
2015-01-20 16:03     ` Javier Martinez Canillas
2015-01-20 16:29       ` Lee Jones
2015-01-20 16:36         ` Javier Martinez Canillas
2015-01-20 16:55           ` Lee Jones
2015-01-20 17:11             ` Javier Martinez Canillas
2015-01-21 16:56               ` Javier Martinez Canillas
2015-01-02 13:32 ` [PATCH RESEND v2 6/7] platform/chrome: Create sysfs attributes for the ChromeOS EC Javier Martinez Canillas
2015-01-02 13:32 ` [PATCH RESEND v2 7/7] platform/chrome: Expose Chrome OS Lightbar to users Javier Martinez Canillas
2015-01-12 10:18 ` [PATCH RESEND v2 0/7] platform/chrome: Add user-space dev inferface support Javier Martinez Canillas

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=1420205572-2640-1-git-send-email-javier.martinez@collabora.co.uk \
    --to=javier.martinez@collabora.co.uk \
    --cc=corbet@lwn.net \
    --cc=dianders@chromium.org \
    --cc=gwendal@google.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=sjg@google.com \
    --cc=wfrichar@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.