LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v4 0/3] mfd: cros_ec: Instantiate CrOS FP and TP devices
@ 2019-05-08  9:19 Enric Balletbo i Serra
  2019-05-08  9:19 ` [PATCH v4 1/3] mfd: cros_ec: Update the EC feature codes Enric Balletbo i Serra
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Enric Balletbo i Serra @ 2019-05-08  9:19 UTC (permalink / raw)
  To: lee.jones
  Cc: gwendal, bleung, linux-kernel, groeck, kernel, dtor, rushikesh.s.kadam

Hi Lee,

Sorry for the delay, this is a new version rebased on top of
for-mfd-next tree solvind the conflicts with due the already applied
patches.

The first version depends on:

- mfd: cros: Update EC protocol to match current EC code
  - https://lore.kernel.org/patchwork/patch/1046363

But there were some concerns on how to update this file properly, so
meanwhile we figure out the proper way, let's introduce only the required
fields for this series.

The series adds support to instantiate two special CrOS EC devices, a
fingerprint and a touchpad.

Best regards,
 Enric

Changes in v4:
- Removed the patch to instantiate the ISH device as was already applied.
- Rebased on top of for-mfd-next branch.

Changes in v3:
- Fix Andy Shevchenko email.

Changes in v2:
- Add a patch to introduce the required enums to build.

Enric Balletbo i Serra (3):
  mfd: cros_ec: Update the EC feature codes
  mfd: cros_ec: instantiate properly CrOS FP MCU device
  mfd: cros_ec: instantiate properly CrOS Touchpad MCU device

 drivers/mfd/cros_ec_dev.c            | 20 +++++++++++++++++
 include/linux/mfd/cros_ec.h          |  2 ++
 include/linux/mfd/cros_ec_commands.h | 32 +++++++++++++++++++++++++++-
 3 files changed, 53 insertions(+), 1 deletion(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v4 1/3] mfd: cros_ec: Update the EC feature codes
  2019-05-08  9:19 [PATCH v4 0/3] mfd: cros_ec: Instantiate CrOS FP and TP devices Enric Balletbo i Serra
@ 2019-05-08  9:19 ` Enric Balletbo i Serra
  2019-05-08 12:00   ` Lee Jones
  2019-05-08  9:19 ` [PATCH v4 2/3] mfd: cros_ec: instantiate properly CrOS FP MCU device Enric Balletbo i Serra
  2019-05-08  9:19 ` [PATCH v4 3/3] mfd: cros_ec: instantiate properly CrOS Touchpad " Enric Balletbo i Serra
  2 siblings, 1 reply; 7+ messages in thread
From: Enric Balletbo i Serra @ 2019-05-08  9:19 UTC (permalink / raw)
  To: lee.jones
  Cc: gwendal, bleung, linux-kernel, groeck, kernel, dtor, rushikesh.s.kadam

Update the feature enum for the Chromebook Embedded Controller to the
latest version. Some of these enums are still not used in the kernel but
we might be also interested on have these enums up to date. Userspace
can use them to query the features to the EC via the cros-ec character
device.

While here, also fix a typo in one comment in the enum.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

Changes in v4:
- Removed the patch to instantiate the ISH device as was already applied.
- Rebased on top of for-mfd-next branch.

Changes in v3:
- Fix Andy Shevchenko email.

Changes in v2:
- Add a patch to introduce the required enums to build.

 include/linux/mfd/cros_ec_commands.h | 32 +++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 43bee4f7d137..d5bf909af661 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -840,7 +840,7 @@ enum ec_feature_code {
 	 * (Common Smart Battery System Interface Specification)
 	 */
 	EC_FEATURE_SMART_BATTERY = 18,
-	/* EC can dectect when the host hangs. */
+	/* EC can detect when the host hangs. */
 	EC_FEATURE_HANG_DETECT = 19,
 	/* Report power information, for pit only */
 	EC_FEATURE_PMU = 20,
@@ -852,10 +852,40 @@ enum ec_feature_code {
 	EC_FEATURE_USB_MUX = 23,
 	/* Motion Sensor code has an internal software FIFO */
 	EC_FEATURE_MOTION_SENSE_FIFO = 24,
+	/* Support temporary secure vstore */
+	EC_FEATURE_VSTORE = 25,
+	/* EC decides on USB-C SS mux state, muxes configured by host */
+	EC_FEATURE_USBC_SS_MUX_VIRTUAL = 26,
 	/* EC has RTC feature that can be controlled by host commands */
 	EC_FEATURE_RTC = 27,
+	/* The MCU exposes a Fingerprint sensor */
+	EC_FEATURE_FINGERPRINT = 28,
+	/* The MCU exposes a Touchpad */
+	EC_FEATURE_TOUCHPAD = 29,
+	/* The MCU has RWSIG task enabled */
+	EC_FEATURE_RWSIG = 30,
+	/* EC has device events support */
+	EC_FEATURE_DEVICE_EVENT = 31,
+	/* EC supports the unified wake masks for LPC/eSPI systems */
+	EC_FEATURE_UNIFIED_WAKE_MASKS = 32,
+	/* EC supports 64-bit host events */
+	EC_FEATURE_HOST_EVENT64 = 33,
+	/* EC runs code in RAM (not in place, a.k.a. XIP) */
+	EC_FEATURE_EXEC_IN_RAM = 34,
 	/* EC supports CEC commands */
 	EC_FEATURE_CEC = 35,
+	/* EC supports tight sensor timestamping. */
+	EC_FEATURE_MOTION_SENSE_TIGHT_TIMESTAMPS = 36,
+	/*
+	 * EC supports tablet mode detection aligned to Chrome and allows
+	 * setting of threshold by host command using
+	 * MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE.
+	 */
+	EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37,
+	/* EC supports audio codec. */
+	EC_FEATURE_AUDIO_CODEC = 38,
+	/* EC Supports SCP. */
+	EC_FEATURE_SCP = 39,
 	/* The MCU is an Integrated Sensor Hub */
 	EC_FEATURE_ISH = 40,
 };
-- 
2.20.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v4 2/3] mfd: cros_ec: instantiate properly CrOS FP MCU device
  2019-05-08  9:19 [PATCH v4 0/3] mfd: cros_ec: Instantiate CrOS FP and TP devices Enric Balletbo i Serra
  2019-05-08  9:19 ` [PATCH v4 1/3] mfd: cros_ec: Update the EC feature codes Enric Balletbo i Serra
@ 2019-05-08  9:19 ` Enric Balletbo i Serra
  2019-05-08 12:00   ` Lee Jones
  2019-05-08  9:19 ` [PATCH v4 3/3] mfd: cros_ec: instantiate properly CrOS Touchpad " Enric Balletbo i Serra
  2 siblings, 1 reply; 7+ messages in thread
From: Enric Balletbo i Serra @ 2019-05-08  9:19 UTC (permalink / raw)
  To: lee.jones
  Cc: gwendal, bleung, linux-kernel, groeck, kernel, dtor,
	rushikesh.s.kadam, Vincent Palatin

Support Fingerprint MCU as a special of CrOS EC devices. The current FP
MCU uses the same EC SPI protocol v3 as other CrOS EC devices on a SPI
bus.

When a MCU has fingerprint support (aka EC_FEATURE_FINGERPRINT), it is
instantiated as a special CrOS EC device with device name 'cros_fp'. So
regardless of the probing order between the actual cros_ec and cros_fp,
the userspace and other kernel drivers should not confuse them.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/mfd/cros_ec_dev.c   | 10 ++++++++++
 include/linux/mfd/cros_ec.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index a3b319913097..71a01a096595 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -419,6 +419,16 @@ static int ec_device_probe(struct platform_device *pdev)
 	device_initialize(&ec->class_dev);
 	cdev_init(&ec->cdev, &fops);
 
+	/* Check whether this is actually a Fingerprint MCU rather than an EC */
+	if (cros_ec_check_features(ec, EC_FEATURE_FINGERPRINT)) {
+		dev_info(dev, "CrOS Fingerprint MCU detected.\n");
+		/*
+		 * Help userspace differentiating ECs from FP MCU,
+		 * regardless of the probing order.
+		 */
+		ec_platform->ec_name = CROS_EC_DEV_FP_NAME;
+	}
+
 	/*
 	 * Check whether this is actually an Integrated Sensor Hub (ISH)
 	 * rather than an EC.
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 109292a60499..20fb5f298f73 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -23,6 +23,7 @@
 #include <linux/mutex.h>
 
 #define CROS_EC_DEV_NAME "cros_ec"
+#define CROS_EC_DEV_FP_NAME "cros_fp"
 #define CROS_EC_DEV_PD_NAME "cros_pd"
 #define CROS_EC_DEV_ISH_NAME "cros_ish"
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v4 3/3] mfd: cros_ec: instantiate properly CrOS Touchpad MCU device
  2019-05-08  9:19 [PATCH v4 0/3] mfd: cros_ec: Instantiate CrOS FP and TP devices Enric Balletbo i Serra
  2019-05-08  9:19 ` [PATCH v4 1/3] mfd: cros_ec: Update the EC feature codes Enric Balletbo i Serra
  2019-05-08  9:19 ` [PATCH v4 2/3] mfd: cros_ec: instantiate properly CrOS FP MCU device Enric Balletbo i Serra
@ 2019-05-08  9:19 ` Enric Balletbo i Serra
  2019-05-08 12:00   ` Lee Jones
  2 siblings, 1 reply; 7+ messages in thread
From: Enric Balletbo i Serra @ 2019-05-08  9:19 UTC (permalink / raw)
  To: lee.jones
  Cc: gwendal, bleung, linux-kernel, groeck, kernel, dtor,
	rushikesh.s.kadam, Wei-Ning Huang

Support Touchpad MCU as a special of CrOS EC devices. The current
Touchpad MCU is used on Eve Chromebook and used the same protocol as
other CrOS EC devices.

When a MCU has touchpad support (aka EC_FEATURE_TOUCHPAD), it is
instantiated as a special CrOS EC device with device name 'cros_tp'. So
regardless of the probing order between the actual cros_ec and cros_tp,
the userspace and other kernel drivers should not confuse them.

Signed-off-by: Wei-Ning Huang <wnhuang@google.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/mfd/cros_ec_dev.c   | 10 ++++++++++
 include/linux/mfd/cros_ec.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index 71a01a096595..54a58df571b6 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -442,6 +442,16 @@ static int ec_device_probe(struct platform_device *pdev)
 		ec_platform->ec_name = CROS_EC_DEV_ISH_NAME;
 	}
 
+	/* Check whether this is actually a Touchpad MCU rather than an EC */
+	if (cros_ec_check_features(ec, EC_FEATURE_TOUCHPAD)) {
+		dev_info(dev, "CrOS Touchpad MCU detected.\n");
+		/*
+		 * Help userspace differentiating ECs from TP MCU,
+		 * regardless of the probing order.
+		 */
+		ec_platform->ec_name = CROS_EC_DEV_TP_NAME;
+	}
+
 	/*
 	 * Add the class device
 	 * Link to the character device for creating the /dev entry
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 20fb5f298f73..2acbbec75eeb 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -25,6 +25,7 @@
 #define CROS_EC_DEV_NAME "cros_ec"
 #define CROS_EC_DEV_FP_NAME "cros_fp"
 #define CROS_EC_DEV_PD_NAME "cros_pd"
+#define CROS_EC_DEV_TP_NAME "cros_tp"
 #define CROS_EC_DEV_ISH_NAME "cros_ish"
 
 /*
-- 
2.20.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 1/3] mfd: cros_ec: Update the EC feature codes
  2019-05-08  9:19 ` [PATCH v4 1/3] mfd: cros_ec: Update the EC feature codes Enric Balletbo i Serra
@ 2019-05-08 12:00   ` Lee Jones
  0 siblings, 0 replies; 7+ messages in thread
From: Lee Jones @ 2019-05-08 12:00 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: gwendal, bleung, linux-kernel, groeck, kernel, dtor, rushikesh.s.kadam

On Wed, 08 May 2019, Enric Balletbo i Serra wrote:

> Update the feature enum for the Chromebook Embedded Controller to the
> latest version. Some of these enums are still not used in the kernel but
> we might be also interested on have these enums up to date. Userspace
> can use them to query the features to the EC via the cros-ec character
> device.
> 
> While here, also fix a typo in one comment in the enum.
> 
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> 
> Changes in v4:
> - Removed the patch to instantiate the ISH device as was already applied.
> - Rebased on top of for-mfd-next branch.
> 
> Changes in v3:
> - Fix Andy Shevchenko email.
> 
> Changes in v2:
> - Add a patch to introduce the required enums to build.
> 
>  include/linux/mfd/cros_ec_commands.h | 32 +++++++++++++++++++++++++++-
>  1 file changed, 31 insertions(+), 1 deletion(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 2/3] mfd: cros_ec: instantiate properly CrOS FP MCU device
  2019-05-08  9:19 ` [PATCH v4 2/3] mfd: cros_ec: instantiate properly CrOS FP MCU device Enric Balletbo i Serra
@ 2019-05-08 12:00   ` Lee Jones
  0 siblings, 0 replies; 7+ messages in thread
From: Lee Jones @ 2019-05-08 12:00 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: gwendal, bleung, linux-kernel, groeck, kernel, dtor,
	rushikesh.s.kadam, Vincent Palatin

On Wed, 08 May 2019, Enric Balletbo i Serra wrote:

> Support Fingerprint MCU as a special of CrOS EC devices. The current FP
> MCU uses the same EC SPI protocol v3 as other CrOS EC devices on a SPI
> bus.
> 
> When a MCU has fingerprint support (aka EC_FEATURE_FINGERPRINT), it is
> instantiated as a special CrOS EC device with device name 'cros_fp'. So
> regardless of the probing order between the actual cros_ec and cros_fp,
> the userspace and other kernel drivers should not confuse them.
> 
> Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> 
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
> 
>  drivers/mfd/cros_ec_dev.c   | 10 ++++++++++
>  include/linux/mfd/cros_ec.h |  1 +
>  2 files changed, 11 insertions(+)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 3/3] mfd: cros_ec: instantiate properly CrOS Touchpad MCU device
  2019-05-08  9:19 ` [PATCH v4 3/3] mfd: cros_ec: instantiate properly CrOS Touchpad " Enric Balletbo i Serra
@ 2019-05-08 12:00   ` Lee Jones
  0 siblings, 0 replies; 7+ messages in thread
From: Lee Jones @ 2019-05-08 12:00 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: gwendal, bleung, linux-kernel, groeck, kernel, dtor,
	rushikesh.s.kadam, Wei-Ning Huang

On Wed, 08 May 2019, Enric Balletbo i Serra wrote:

> Support Touchpad MCU as a special of CrOS EC devices. The current
> Touchpad MCU is used on Eve Chromebook and used the same protocol as
> other CrOS EC devices.
> 
> When a MCU has touchpad support (aka EC_FEATURE_TOUCHPAD), it is
> instantiated as a special CrOS EC device with device name 'cros_tp'. So
> regardless of the probing order between the actual cros_ec and cros_tp,
> the userspace and other kernel drivers should not confuse them.
> 
> Signed-off-by: Wei-Ning Huang <wnhuang@google.com>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> 
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
> 
>  drivers/mfd/cros_ec_dev.c   | 10 ++++++++++
>  include/linux/mfd/cros_ec.h |  1 +
>  2 files changed, 11 insertions(+)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-05-08 12:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08  9:19 [PATCH v4 0/3] mfd: cros_ec: Instantiate CrOS FP and TP devices Enric Balletbo i Serra
2019-05-08  9:19 ` [PATCH v4 1/3] mfd: cros_ec: Update the EC feature codes Enric Balletbo i Serra
2019-05-08 12:00   ` Lee Jones
2019-05-08  9:19 ` [PATCH v4 2/3] mfd: cros_ec: instantiate properly CrOS FP MCU device Enric Balletbo i Serra
2019-05-08 12:00   ` Lee Jones
2019-05-08  9:19 ` [PATCH v4 3/3] mfd: cros_ec: instantiate properly CrOS Touchpad " Enric Balletbo i Serra
2019-05-08 12:00   ` Lee Jones

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).