All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM
@ 2016-07-15 23:28 ` Brian Norris
  0 siblings, 0 replies; 18+ messages in thread
From: Brian Norris @ 2016-07-15 23:28 UTC (permalink / raw)
  To: Lee Jones, Thierry Reding, Olof Johansson
  Cc: linux-kernel, Doug Anderson, Brian Norris, linux-pwm, devicetree,
	Boris Brezillon, Stephen Barber, Javier Martinez Canillas,
	Benson Leung, Enric Balletbo, Randall Spangler,
	Shawn Nematbakhsh, Dmitry Torokhov, Todd Broch, Gwendal Grignou,
	Tomeu Vizoso, Brian Norris

Hi,

This is the 4th (and final?) version of my series to support the new ChromeOS
EC PWM API, so we can control, e.g., a PWM backlight when its PWM is attached
to the EC. It uses Boris's latest "atomic" hooks for the PWM API (i.e., the
->apply() callback), which were recently merged.

Pulled and adapted the cros_ec_cmd_xfer_status() helper from this patch, with
some minor modifications:

https://lkml.org/lkml/2016/4/12/342

Note that after some style bikeshedding, I proposed to put off rewriting the
entire cros_ec_commands.h header at the moment, due to the shared nature of
this file. Follow up here:

https://bugs.chromium.org/p/chromium/issues/detail?id=621123

As this touches MFD (sort of), drivers/platform/chrome/, and drivers/pwm/, I'm
still not sure who it should all go through: Lee, Thierry, or Olof?

Please review.

Regards,
Brian

Change log (also documented in each patch):

v4:
 * return -EPROTO in cros_ec_cmd_xfer_status(), instead of (-EECRESULT - FOO)
 * log EC error results with dev_dbg()

v3:
 * fix some int->hex
 * fix a small bug in the handling of 'disabled' vs. 'duty_cycle == 0'
 * collect acks, tested-by

v2:
 * drop the "google,max-pwms" property
 * separate the cros_ec vs. PWM abstractions a little more clearly in the driver
 * remove dynamic kzalloc()'s and rely on on-stack memory instead



Brian Norris (3):
  mfd: cros_ec: add EC_PWM function definitions
  doc: dt: pwm: add binding for ChromeOS EC PWM
  pwm: add ChromeOS EC PWM driver

Tomeu Vizoso (1):
  mfd: cros_ec: Add cros_ec_cmd_xfer_status helper

 .../devicetree/bindings/pwm/google,cros-ec-pwm.txt |  23 ++
 drivers/platform/chrome/cros_ec_proto.c            |  17 ++
 drivers/pwm/Kconfig                                |   7 +
 drivers/pwm/Makefile                               |   1 +
 drivers/pwm/pwm-cros-ec.c                          | 260 +++++++++++++++++++++
 include/linux/mfd/cros_ec.h                        |  15 ++
 include/linux/mfd/cros_ec_commands.h               |  31 +++
 7 files changed, 354 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt
 create mode 100644 drivers/pwm/pwm-cros-ec.c

-- 
2.8.0.rc3.226.g39d4020

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

* [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM
@ 2016-07-15 23:28 ` Brian Norris
  0 siblings, 0 replies; 18+ messages in thread
From: Brian Norris @ 2016-07-15 23:28 UTC (permalink / raw)
  To: Lee Jones, Thierry Reding, Olof Johansson
  Cc: linux-kernel, Doug Anderson, Brian Norris, linux-pwm, devicetree,
	Boris Brezillon, Stephen Barber, Javier Martinez Canillas,
	Benson Leung, Enric Balletbo, Randall Spangler,
	Shawn Nematbakhsh, Dmitry Torokhov, Todd Broch, Gwendal Grignou,
	Tomeu Vizoso, Brian Norris

Hi,

This is the 4th (and final?) version of my series to support the new ChromeOS
EC PWM API, so we can control, e.g., a PWM backlight when its PWM is attached
to the EC. It uses Boris's latest "atomic" hooks for the PWM API (i.e., the
->apply() callback), which were recently merged.

Pulled and adapted the cros_ec_cmd_xfer_status() helper from this patch, with
some minor modifications:

https://lkml.org/lkml/2016/4/12/342

Note that after some style bikeshedding, I proposed to put off rewriting the
entire cros_ec_commands.h header at the moment, due to the shared nature of
this file. Follow up here:

https://bugs.chromium.org/p/chromium/issues/detail?id=621123

As this touches MFD (sort of), drivers/platform/chrome/, and drivers/pwm/, I'm
still not sure who it should all go through: Lee, Thierry, or Olof?

Please review.

Regards,
Brian

Change log (also documented in each patch):

v4:
 * return -EPROTO in cros_ec_cmd_xfer_status(), instead of (-EECRESULT - FOO)
 * log EC error results with dev_dbg()

v3:
 * fix some int->hex
 * fix a small bug in the handling of 'disabled' vs. 'duty_cycle == 0'
 * collect acks, tested-by

v2:
 * drop the "google,max-pwms" property
 * separate the cros_ec vs. PWM abstractions a little more clearly in the driver
 * remove dynamic kzalloc()'s and rely on on-stack memory instead



Brian Norris (3):
  mfd: cros_ec: add EC_PWM function definitions
  doc: dt: pwm: add binding for ChromeOS EC PWM
  pwm: add ChromeOS EC PWM driver

Tomeu Vizoso (1):
  mfd: cros_ec: Add cros_ec_cmd_xfer_status helper

 .../devicetree/bindings/pwm/google,cros-ec-pwm.txt |  23 ++
 drivers/platform/chrome/cros_ec_proto.c            |  17 ++
 drivers/pwm/Kconfig                                |   7 +
 drivers/pwm/Makefile                               |   1 +
 drivers/pwm/pwm-cros-ec.c                          | 260 +++++++++++++++++++++
 include/linux/mfd/cros_ec.h                        |  15 ++
 include/linux/mfd/cros_ec_commands.h               |  31 +++
 7 files changed, 354 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt
 create mode 100644 drivers/pwm/pwm-cros-ec.c

-- 
2.8.0.rc3.226.g39d4020

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

* [PATCH v4 1/4] mfd: cros_ec: Add cros_ec_cmd_xfer_status helper
  2016-07-15 23:28 ` Brian Norris
@ 2016-07-15 23:28   ` Brian Norris
  -1 siblings, 0 replies; 18+ messages in thread
From: Brian Norris @ 2016-07-15 23:28 UTC (permalink / raw)
  To: Lee Jones, Thierry Reding, Olof Johansson
  Cc: linux-kernel, Doug Anderson, Brian Norris, linux-pwm, devicetree,
	Boris Brezillon, Stephen Barber, Javier Martinez Canillas,
	Benson Leung, Enric Balletbo, Randall Spangler,
	Shawn Nematbakhsh, Dmitry Torokhov, Todd Broch, Gwendal Grignou,
	Tomeu Vizoso, Brian Norris

From: Tomeu Vizoso <tomeu.vizoso@collabora.com>

So that callers of cros_ec_cmd_xfer don't have to repeat boilerplate
code when checking for errors from the EC side.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
v4:
 * return -EPROTO instead of custom (-EECRESULT - foo)
 * log msg->result in dev_dbg() (TBD!)

v3:
 * successfully spell success

v2:
 * no change
---
 drivers/platform/chrome/cros_ec_proto.c | 17 +++++++++++++++++
 include/linux/mfd/cros_ec.h             | 15 +++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index b6e161f71b26..6c084b266651 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -380,3 +380,20 @@ int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
 	return ret;
 }
 EXPORT_SYMBOL(cros_ec_cmd_xfer);
+
+int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
+			    struct cros_ec_command *msg)
+{
+	int ret;
+
+	ret = cros_ec_cmd_xfer(ec_dev, msg);
+	if (ret < 0) {
+		dev_err(ec_dev->dev, "Command xfer error (err:%d)\n", ret);
+	} else if (msg->result != EC_RES_SUCCESS) {
+		dev_dbg(ec_dev->dev, "Command result (err: %d)\n", msg->result);
+		return -EPROTO;
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL(cros_ec_cmd_xfer_status);
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 64184d27e3cd..d641a18abacb 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -226,6 +226,21 @@ int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
 		     struct cros_ec_command *msg);
 
 /**
+ * cros_ec_cmd_xfer_status - Send a command to the ChromeOS EC
+ *
+ * This function is identical to cros_ec_cmd_xfer, except it returns success
+ * status only if both the command was transmitted successfully and the EC
+ * replied with success status. It's not necessary to check msg->result when
+ * using this function.
+ *
+ * @ec_dev: EC device
+ * @msg: Message to write
+ * @return: Num. of bytes transferred on success, <0 on failure
+ */
+int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
+			    struct cros_ec_command *msg);
+
+/**
  * cros_ec_remove - Remove a ChromeOS EC
  *
  * Call this to deregister a ChromeOS EC, then clean up any private data.
-- 
2.8.0.rc3.226.g39d4020

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

* [PATCH v4 1/4] mfd: cros_ec: Add cros_ec_cmd_xfer_status helper
@ 2016-07-15 23:28   ` Brian Norris
  0 siblings, 0 replies; 18+ messages in thread
From: Brian Norris @ 2016-07-15 23:28 UTC (permalink / raw)
  To: Lee Jones, Thierry Reding, Olof Johansson
  Cc: linux-kernel, Doug Anderson, Brian Norris, linux-pwm, devicetree,
	Boris Brezillon, Stephen Barber, Javier Martinez Canillas,
	Benson Leung, Enric Balletbo, Randall Spangler,
	Shawn Nematbakhsh, Dmitry Torokhov, Todd Broch, Gwendal Grignou,
	Tomeu Vizoso, Brian Norris

From: Tomeu Vizoso <tomeu.vizoso@collabora.com>

So that callers of cros_ec_cmd_xfer don't have to repeat boilerplate
code when checking for errors from the EC side.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
v4:
 * return -EPROTO instead of custom (-EECRESULT - foo)
 * log msg->result in dev_dbg() (TBD!)

v3:
 * successfully spell success

v2:
 * no change
---
 drivers/platform/chrome/cros_ec_proto.c | 17 +++++++++++++++++
 include/linux/mfd/cros_ec.h             | 15 +++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index b6e161f71b26..6c084b266651 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -380,3 +380,20 @@ int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
 	return ret;
 }
 EXPORT_SYMBOL(cros_ec_cmd_xfer);
+
+int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
+			    struct cros_ec_command *msg)
+{
+	int ret;
+
+	ret = cros_ec_cmd_xfer(ec_dev, msg);
+	if (ret < 0) {
+		dev_err(ec_dev->dev, "Command xfer error (err:%d)\n", ret);
+	} else if (msg->result != EC_RES_SUCCESS) {
+		dev_dbg(ec_dev->dev, "Command result (err: %d)\n", msg->result);
+		return -EPROTO;
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL(cros_ec_cmd_xfer_status);
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 64184d27e3cd..d641a18abacb 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -226,6 +226,21 @@ int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
 		     struct cros_ec_command *msg);
 
 /**
+ * cros_ec_cmd_xfer_status - Send a command to the ChromeOS EC
+ *
+ * This function is identical to cros_ec_cmd_xfer, except it returns success
+ * status only if both the command was transmitted successfully and the EC
+ * replied with success status. It's not necessary to check msg->result when
+ * using this function.
+ *
+ * @ec_dev: EC device
+ * @msg: Message to write
+ * @return: Num. of bytes transferred on success, <0 on failure
+ */
+int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
+			    struct cros_ec_command *msg);
+
+/**
  * cros_ec_remove - Remove a ChromeOS EC
  *
  * Call this to deregister a ChromeOS EC, then clean up any private data.
-- 
2.8.0.rc3.226.g39d4020

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

* [PATCH v4 2/4] mfd: cros_ec: add EC_PWM function definitions
  2016-07-15 23:28 ` Brian Norris
@ 2016-07-15 23:28   ` Brian Norris
  -1 siblings, 0 replies; 18+ messages in thread
From: Brian Norris @ 2016-07-15 23:28 UTC (permalink / raw)
  To: Lee Jones, Thierry Reding, Olof Johansson
  Cc: linux-kernel, Doug Anderson, Brian Norris, linux-pwm, devicetree,
	Boris Brezillon, Stephen Barber, Javier Martinez Canillas,
	Benson Leung, Enric Balletbo, Randall Spangler,
	Shawn Nematbakhsh, Dmitry Torokhov, Todd Broch, Gwendal Grignou,
	Tomeu Vizoso, Brian Norris

The EC_CMD_PWM_{GET,SET}_DUTY commands allow us to control a PWM that is
attached to the EC, rather than the main host SoC. The API provides
functionality-based (e.g., keyboard light, backlight) or index-based
addressing of the PWM(s). Duty cycles are represented by a 16-bit value,
where 0 maps to 0% duty cycle and U16_MAX maps to 100%. The period
cannot be controlled.

This command set is more generic than, e.g.,
EC_CMD_PWM_{GET,SET}_KEYBOARD_BACKLIGHT and could possibly used to
replace it on future products.

Let's update the command header to include the definitions.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
v4:
 * no change

v3:
 * convert from 65535 to 0xffff

v2:
 * no changes
---
 include/linux/mfd/cros_ec_commands.h | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 13b630c10d4c..7e7a8d4b4551 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -949,6 +949,37 @@ struct ec_params_pwm_set_fan_duty {
 	uint32_t percent;
 } __packed;
 
+#define EC_CMD_PWM_SET_DUTY 0x25
+/* 16 bit duty cycle, 0xffff = 100% */
+#define EC_PWM_MAX_DUTY 0xffff
+
+enum ec_pwm_type {
+	/* All types, indexed by board-specific enum pwm_channel */
+	EC_PWM_TYPE_GENERIC = 0,
+	/* Keyboard backlight */
+	EC_PWM_TYPE_KB_LIGHT,
+	/* Display backlight */
+	EC_PWM_TYPE_DISPLAY_LIGHT,
+	EC_PWM_TYPE_COUNT,
+};
+
+struct ec_params_pwm_set_duty {
+	uint16_t duty;     /* Duty cycle, EC_PWM_MAX_DUTY = 100% */
+	uint8_t pwm_type;  /* ec_pwm_type */
+	uint8_t index;     /* Type-specific index, or 0 if unique */
+} __packed;
+
+#define EC_CMD_PWM_GET_DUTY 0x26
+
+struct ec_params_pwm_get_duty {
+	uint8_t pwm_type;  /* ec_pwm_type */
+	uint8_t index;     /* Type-specific index, or 0 if unique */
+} __packed;
+
+struct ec_response_pwm_get_duty {
+	uint16_t duty;     /* Duty cycle, EC_PWM_MAX_DUTY = 100% */
+} __packed;
+
 /*****************************************************************************/
 /*
  * Lightbar commands. This looks worse than it is. Since we only use one HOST
-- 
2.8.0.rc3.226.g39d4020

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

* [PATCH v4 2/4] mfd: cros_ec: add EC_PWM function definitions
@ 2016-07-15 23:28   ` Brian Norris
  0 siblings, 0 replies; 18+ messages in thread
From: Brian Norris @ 2016-07-15 23:28 UTC (permalink / raw)
  To: Lee Jones, Thierry Reding, Olof Johansson
  Cc: linux-kernel, Doug Anderson, Brian Norris, linux-pwm, devicetree,
	Boris Brezillon, Stephen Barber, Javier Martinez Canillas,
	Benson Leung, Enric Balletbo, Randall Spangler,
	Shawn Nematbakhsh, Dmitry Torokhov, Todd Broch, Gwendal Grignou,
	Tomeu Vizoso, Brian Norris

The EC_CMD_PWM_{GET,SET}_DUTY commands allow us to control a PWM that is
attached to the EC, rather than the main host SoC. The API provides
functionality-based (e.g., keyboard light, backlight) or index-based
addressing of the PWM(s). Duty cycles are represented by a 16-bit value,
where 0 maps to 0% duty cycle and U16_MAX maps to 100%. The period
cannot be controlled.

This command set is more generic than, e.g.,
EC_CMD_PWM_{GET,SET}_KEYBOARD_BACKLIGHT and could possibly used to
replace it on future products.

Let's update the command header to include the definitions.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
v4:
 * no change

v3:
 * convert from 65535 to 0xffff

v2:
 * no changes
---
 include/linux/mfd/cros_ec_commands.h | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 13b630c10d4c..7e7a8d4b4551 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -949,6 +949,37 @@ struct ec_params_pwm_set_fan_duty {
 	uint32_t percent;
 } __packed;
 
+#define EC_CMD_PWM_SET_DUTY 0x25
+/* 16 bit duty cycle, 0xffff = 100% */
+#define EC_PWM_MAX_DUTY 0xffff
+
+enum ec_pwm_type {
+	/* All types, indexed by board-specific enum pwm_channel */
+	EC_PWM_TYPE_GENERIC = 0,
+	/* Keyboard backlight */
+	EC_PWM_TYPE_KB_LIGHT,
+	/* Display backlight */
+	EC_PWM_TYPE_DISPLAY_LIGHT,
+	EC_PWM_TYPE_COUNT,
+};
+
+struct ec_params_pwm_set_duty {
+	uint16_t duty;     /* Duty cycle, EC_PWM_MAX_DUTY = 100% */
+	uint8_t pwm_type;  /* ec_pwm_type */
+	uint8_t index;     /* Type-specific index, or 0 if unique */
+} __packed;
+
+#define EC_CMD_PWM_GET_DUTY 0x26
+
+struct ec_params_pwm_get_duty {
+	uint8_t pwm_type;  /* ec_pwm_type */
+	uint8_t index;     /* Type-specific index, or 0 if unique */
+} __packed;
+
+struct ec_response_pwm_get_duty {
+	uint16_t duty;     /* Duty cycle, EC_PWM_MAX_DUTY = 100% */
+} __packed;
+
 /*****************************************************************************/
 /*
  * Lightbar commands. This looks worse than it is. Since we only use one HOST
-- 
2.8.0.rc3.226.g39d4020

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

* [PATCH v4 3/4] doc: dt: pwm: add binding for ChromeOS EC PWM
@ 2016-07-15 23:28   ` Brian Norris
  0 siblings, 0 replies; 18+ messages in thread
From: Brian Norris @ 2016-07-15 23:28 UTC (permalink / raw)
  To: Lee Jones, Thierry Reding, Olof Johansson
  Cc: linux-kernel, Doug Anderson, Brian Norris, linux-pwm, devicetree,
	Boris Brezillon, Stephen Barber, Javier Martinez Canillas,
	Benson Leung, Enric Balletbo, Randall Spangler,
	Shawn Nematbakhsh, Dmitry Torokhov, Todd Broch, Gwendal Grignou,
	Tomeu Vizoso, Brian Norris

The ChromeOS Embedded Controller can support controlling its attached
PWMs via its host-command interface. The number of supported PWMs varies
on a per-board basis, but we can autodetect this by checking the error
codes, so we don't need an extra property for this. And because the EC
only allows specifying the duty cycle and not the period, we don't
specify the period via pwm-cells, and instead have only support 1 cell
-- to specify the index.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
---
v4:
 * no change

v3:
 * add Rob's ack

v2: dropped the "google,max-pwms" property
---
 .../devicetree/bindings/pwm/google,cros-ec-pwm.txt | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt

diff --git a/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt
new file mode 100644
index 000000000000..472bd46ab5a4
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt
@@ -0,0 +1,23 @@
+* PWM controlled by ChromeOS EC
+
+Google's ChromeOS EC PWM is a simple PWM attached to the Embedded Controller
+(EC) and controlled via a host-command interface.
+
+An EC PWM node should be only found as a sub-node of the EC node (see
+Documentation/devicetree/bindings/mfd/cros-ec.txt).
+
+Required properties:
+- compatible: Must contain "google,cros-ec-pwm"
+- #pwm-cells: Should be 1. The cell specifies the PWM index.
+
+Example:
+	cros-ec@0 {
+		compatible = "google,cros-ec-spi";
+
+		...
+
+		cros_ec_pwm: ec-pwm {
+			compatible = "google,cros-ec-pwm";
+			#pwm-cells = <1>;
+		};
+	};
-- 
2.8.0.rc3.226.g39d4020

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

* [PATCH v4 3/4] doc: dt: pwm: add binding for ChromeOS EC PWM
@ 2016-07-15 23:28   ` Brian Norris
  0 siblings, 0 replies; 18+ messages in thread
From: Brian Norris @ 2016-07-15 23:28 UTC (permalink / raw)
  To: Lee Jones, Thierry Reding, Olof Johansson
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Doug Anderson, Brian Norris,
	linux-pwm-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Boris Brezillon,
	Stephen Barber, Javier Martinez Canillas, Benson Leung,
	Enric Balletbo, Randall Spangler, Shawn Nematbakhsh,
	Dmitry Torokhov, Todd Broch, Gwendal Grignou, Tomeu Vizoso,
	Brian Norris

The ChromeOS Embedded Controller can support controlling its attached
PWMs via its host-command interface. The number of supported PWMs varies
on a per-board basis, but we can autodetect this by checking the error
codes, so we don't need an extra property for this. And because the EC
only allows specifying the duty cycle and not the period, we don't
specify the period via pwm-cells, and instead have only support 1 cell
-- to specify the index.

Signed-off-by: Brian Norris <briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
v4:
 * no change

v3:
 * add Rob's ack

v2: dropped the "google,max-pwms" property
---
 .../devicetree/bindings/pwm/google,cros-ec-pwm.txt | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt

diff --git a/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt
new file mode 100644
index 000000000000..472bd46ab5a4
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.txt
@@ -0,0 +1,23 @@
+* PWM controlled by ChromeOS EC
+
+Google's ChromeOS EC PWM is a simple PWM attached to the Embedded Controller
+(EC) and controlled via a host-command interface.
+
+An EC PWM node should be only found as a sub-node of the EC node (see
+Documentation/devicetree/bindings/mfd/cros-ec.txt).
+
+Required properties:
+- compatible: Must contain "google,cros-ec-pwm"
+- #pwm-cells: Should be 1. The cell specifies the PWM index.
+
+Example:
+	cros-ec@0 {
+		compatible = "google,cros-ec-spi";
+
+		...
+
+		cros_ec_pwm: ec-pwm {
+			compatible = "google,cros-ec-pwm";
+			#pwm-cells = <1>;
+		};
+	};
-- 
2.8.0.rc3.226.g39d4020

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v4 4/4] pwm: add ChromeOS EC PWM driver
  2016-07-15 23:28 ` Brian Norris
@ 2016-07-15 23:28   ` Brian Norris
  -1 siblings, 0 replies; 18+ messages in thread
From: Brian Norris @ 2016-07-15 23:28 UTC (permalink / raw)
  To: Lee Jones, Thierry Reding, Olof Johansson
  Cc: linux-kernel, Doug Anderson, Brian Norris, linux-pwm, devicetree,
	Boris Brezillon, Stephen Barber, Javier Martinez Canillas,
	Benson Leung, Enric Balletbo, Randall Spangler,
	Shawn Nematbakhsh, Dmitry Torokhov, Todd Broch, Gwendal Grignou,
	Tomeu Vizoso, Brian Norris

Use the new ChromeOS EC EC_CMD_PWM_{GET,SET}_DUTY commands to control
one or more PWMs attached to the Embedded Controller. Because the EC
allows us to modify the duty cycle (as a percentage, where U16_MAX is
100%) but not the period, we assign the period a fixed value of
EC_PWM_MAX_DUTY and reject all attempts to change it.

This driver supports only device tree at the moment, because that
provides a very flexible way of describing the relationship between PWMs
and their consumer devices (e.g., backlight). On a non-DT system, we'll
probably want to use the non-GENERIC addressing (i.e., we'll need to
make special device instances that will use EC_PWM_TYPE_KB_LIGHT or
EC_PWM_TYPE_DISPLAY_LIGHT), as well as the relatively inflexible
pwm_lookup infrastructure for matching devices. Defer that work for now.

Signed-off-by: Brian Norris <briannorris@chromium.org>
---
v4:
 * adapt to changed cros_ec_cmd_xfer_status() helper

v3:
 * handle 'disabled' properly in apply(), since EC conflates 0
   duty-cycle and disabled state

v2:
 * refactor some abstractions to separate the PWM layer handling from
   the cros_ec handling
 * remove dynamic kzalloc()'s and rely on on-stack memory instead
 * auto-probe the number of PWMs supported
---
 drivers/pwm/Kconfig       |   7 ++
 drivers/pwm/Makefile      |   1 +
 drivers/pwm/pwm-cros-ec.c | 260 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 268 insertions(+)
 create mode 100644 drivers/pwm/pwm-cros-ec.c

diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index c182efc62c7b..4f2b16a50f42 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -137,6 +137,13 @@ config PWM_CRC
 	  Generic PWM framework driver for Crystalcove (CRC) PMIC based PWM
 	  control.
 
+config PWM_CROS_EC
+	tristate "ChromeOS EC PWM driver"
+	depends on MFD_CROS_EC
+	help
+	  PWM driver for exposing a PWM attached to the ChromeOS Embedded
+	  Controller.
+
 config PWM_EP93XX
 	tristate "Cirrus Logic EP93xx PWM support"
 	depends on ARCH_EP93XX
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
index dd35bc121a18..ffde923cf3df 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_PWM_BFIN)		+= pwm-bfin.o
 obj-$(CONFIG_PWM_BRCMSTB)	+= pwm-brcmstb.o
 obj-$(CONFIG_PWM_CLPS711X)	+= pwm-clps711x.o
 obj-$(CONFIG_PWM_CRC)		+= pwm-crc.o
+obj-$(CONFIG_PWM_CROS_EC)	+= pwm-cros-ec.o
 obj-$(CONFIG_PWM_EP93XX)	+= pwm-ep93xx.o
 obj-$(CONFIG_PWM_FSL_FTM)	+= pwm-fsl-ftm.o
 obj-$(CONFIG_PWM_IMG)		+= pwm-img.o
diff --git a/drivers/pwm/pwm-cros-ec.c b/drivers/pwm/pwm-cros-ec.c
new file mode 100644
index 000000000000..99b9acc1a420
--- /dev/null
+++ b/drivers/pwm/pwm-cros-ec.c
@@ -0,0 +1,260 @@
+/*
+ * Copyright (C) 2016 Google, Inc
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2, as published by
+ * the Free Software Foundation.
+ *
+ * Expose a PWM controlled by the ChromeOS EC to the host processor.
+ */
+
+#include <linux/module.h>
+#include <linux/mfd/cros_ec.h>
+#include <linux/mfd/cros_ec_commands.h>
+#include <linux/platform_device.h>
+#include <linux/pwm.h>
+#include <linux/slab.h>
+
+/**
+ * struct cros_ec_pwm_device - Driver data for EC PWM
+ *
+ * @dev: Device node
+ * @ec: Pointer to EC device
+ * @chip: PWM controller chip
+ */
+struct cros_ec_pwm_device {
+	struct device *dev;
+	struct cros_ec_device *ec;
+	struct pwm_chip chip;
+};
+
+static inline struct cros_ec_pwm_device *pwm_to_cros_ec_pwm(struct pwm_chip *c)
+{
+	return container_of(c, struct cros_ec_pwm_device, chip);
+}
+
+static int cros_ec_pwm_set_duty(struct cros_ec_device *ec, u8 index, u16 duty)
+{
+	struct {
+		struct cros_ec_command msg;
+		struct ec_params_pwm_set_duty params;
+	} buf;
+	struct ec_params_pwm_set_duty *params = &buf.params;
+	struct cros_ec_command *msg = &buf.msg;
+
+	memset(&buf, 0, sizeof(buf));
+
+	msg->version = 0;
+	msg->command = EC_CMD_PWM_SET_DUTY;
+	msg->insize = 0;
+	msg->outsize = sizeof(*params);
+
+	params->duty = duty;
+	params->pwm_type = EC_PWM_TYPE_GENERIC;
+	params->index = index;
+
+	return cros_ec_cmd_xfer_status(ec, msg);
+}
+
+static int __cros_ec_pwm_get_duty(struct cros_ec_device *ec, u8 index,
+				  u32 *result)
+{
+	struct {
+		struct cros_ec_command msg;
+		union {
+			struct ec_params_pwm_get_duty params;
+			struct ec_response_pwm_get_duty resp;
+		};
+	} buf;
+	struct ec_params_pwm_get_duty *params = &buf.params;
+	struct ec_response_pwm_get_duty *resp = &buf.resp;
+	struct cros_ec_command *msg = &buf.msg;
+	int ret;
+
+	memset(&buf, 0, sizeof(buf));
+
+	msg->version = 0;
+	msg->command = EC_CMD_PWM_GET_DUTY;
+	msg->insize = sizeof(*params);
+	msg->outsize = sizeof(*resp);
+
+	params->pwm_type = EC_PWM_TYPE_GENERIC;
+	params->index = index;
+
+	ret = cros_ec_cmd_xfer_status(ec, msg);
+	if (result)
+		*result = msg->result;
+	if (ret < 0)
+		return ret;
+
+	return resp->duty;
+}
+
+static int cros_ec_pwm_get_duty(struct cros_ec_device *ec, u8 index)
+{
+	return __cros_ec_pwm_get_duty(ec, index, NULL);
+}
+
+static int cros_ec_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
+			     struct pwm_state *state)
+{
+	struct cros_ec_pwm_device *ec_pwm = pwm_to_cros_ec_pwm(chip);
+	int duty_cycle;
+
+	/* The EC won't let us change the period */
+	if (state->period != EC_PWM_MAX_DUTY)
+		return -EINVAL;
+
+	/*
+	 * EC doesn't separate the concept of duty cycle and enabled, but
+	 * kernel does. Translate.
+	 */
+	duty_cycle = state->enabled ? state->duty_cycle : 0;
+
+	return cros_ec_pwm_set_duty(ec_pwm->ec, pwm->hwpwm, duty_cycle);
+}
+
+static void cros_ec_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
+				  struct pwm_state *state)
+{
+	struct cros_ec_pwm_device *ec_pwm = pwm_to_cros_ec_pwm(chip);
+	int ret;
+
+	ret = cros_ec_pwm_get_duty(ec_pwm->ec, pwm->hwpwm);
+	if (ret < 0) {
+		dev_err(chip->dev, "error getting initial duty: %d\n", ret);
+		return;
+	}
+
+	state->enabled = (ret > 0);
+	state->period = EC_PWM_MAX_DUTY;
+
+	/* Note that "disabled" and "duty cycle == 0" are treated the same */
+	state->duty_cycle = ret;
+}
+
+static struct pwm_device *
+cros_ec_pwm_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
+{
+	struct pwm_device *pwm;
+
+	if (args->args[0] >= pc->npwm)
+		return ERR_PTR(-EINVAL);
+
+	pwm = pwm_request_from_chip(pc, args->args[0], NULL);
+	if (IS_ERR(pwm))
+		return pwm;
+
+	/* The EC won't let us change the period */
+	pwm->args.period = EC_PWM_MAX_DUTY;
+
+	return pwm;
+}
+
+static const struct pwm_ops cros_ec_pwm_ops = {
+	.get_state	= cros_ec_pwm_get_state,
+	.apply		= cros_ec_pwm_apply,
+	.owner		= THIS_MODULE,
+};
+
+static int cros_ec_num_pwms(struct cros_ec_device *ec)
+{
+	int i, ret;
+
+	/* The index field is only 8 bits */
+	for (i = 0; i <= U8_MAX; i++) {
+		u32 result = 0;
+
+		ret = __cros_ec_pwm_get_duty(ec, i, &result);
+		/* We want to parse EC protocol errors */
+		if (ret < 0 && !(ret == -EPROTO && result))
+			return ret;
+
+		/*
+		 * We look for SUCCESS, INVALID_COMMAND, or INVALID_PARAM
+		 * responses; everything else is treated as an error.
+		 */
+		if (result == EC_RES_INVALID_COMMAND)
+			return -ENODEV;
+		else if (result == EC_RES_INVALID_PARAM)
+			return i;
+		else if (result)
+			return -EPROTO;
+	}
+
+	return U8_MAX;
+}
+
+static int cros_ec_pwm_probe(struct platform_device *pdev)
+{
+	struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent);
+	struct device *dev = &pdev->dev;
+	struct cros_ec_pwm_device *ec_pwm;
+	struct pwm_chip *chip;
+	int ret;
+
+	if (!ec) {
+		dev_err(dev, "no parent EC device\n");
+		return -EINVAL;
+	}
+
+	ec_pwm = devm_kzalloc(dev, sizeof(*ec_pwm), GFP_KERNEL);
+	if (!ec_pwm)
+		return -ENOMEM;
+	chip = &ec_pwm->chip;
+	ec_pwm->ec = ec;
+
+	/* PWM chip */
+	chip->dev = dev;
+	chip->ops = &cros_ec_pwm_ops;
+	chip->of_xlate = cros_ec_pwm_xlate;
+	chip->of_pwm_n_cells = 1;
+	chip->base = -1;
+	ret = cros_ec_num_pwms(ec);
+	if (ret < 0) {
+		dev_err(dev, "Couldn't find PWMs: %d\n", ret);
+		return ret;
+	}
+	chip->npwm = ret;
+	dev_dbg(dev, "Probed %u PWMs\n", chip->npwm);
+
+	ret = pwmchip_add(chip);
+	if (ret < 0) {
+		dev_err(dev, "cannot register PWM: %d\n", ret);
+		return ret;
+	}
+
+	platform_set_drvdata(pdev, ec_pwm);
+
+	return ret;
+}
+
+static int cros_ec_pwm_remove(struct platform_device *dev)
+{
+	struct cros_ec_pwm_device *ec_pwm = platform_get_drvdata(dev);
+	struct pwm_chip *chip = &ec_pwm->chip;
+
+	return pwmchip_remove(chip);
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id cros_ec_pwm_of_match[] = {
+	{ .compatible = "google,cros-ec-pwm" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, cros_ec_pwm_of_match);
+#endif
+
+static struct platform_driver cros_ec_pwm_driver = {
+	.probe = cros_ec_pwm_probe,
+	.remove = cros_ec_pwm_remove,
+	.driver = {
+		.name = "cros-ec-pwm",
+		.of_match_table = of_match_ptr(cros_ec_pwm_of_match),
+	},
+};
+module_platform_driver(cros_ec_pwm_driver);
+
+MODULE_ALIAS("platform:cros-ec-pwm");
+MODULE_DESCRIPTION("ChromeOS EC PWM driver");
+MODULE_LICENSE("GPL v2");
-- 
2.8.0.rc3.226.g39d4020

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

* [PATCH v4 4/4] pwm: add ChromeOS EC PWM driver
@ 2016-07-15 23:28   ` Brian Norris
  0 siblings, 0 replies; 18+ messages in thread
From: Brian Norris @ 2016-07-15 23:28 UTC (permalink / raw)
  To: Lee Jones, Thierry Reding, Olof Johansson
  Cc: linux-kernel, Doug Anderson, Brian Norris, linux-pwm, devicetree,
	Boris Brezillon, Stephen Barber, Javier Martinez Canillas,
	Benson Leung, Enric Balletbo, Randall Spangler,
	Shawn Nematbakhsh, Dmitry Torokhov, Todd Broch, Gwendal Grignou,
	Tomeu Vizoso, Brian Norris

Use the new ChromeOS EC EC_CMD_PWM_{GET,SET}_DUTY commands to control
one or more PWMs attached to the Embedded Controller. Because the EC
allows us to modify the duty cycle (as a percentage, where U16_MAX is
100%) but not the period, we assign the period a fixed value of
EC_PWM_MAX_DUTY and reject all attempts to change it.

This driver supports only device tree at the moment, because that
provides a very flexible way of describing the relationship between PWMs
and their consumer devices (e.g., backlight). On a non-DT system, we'll
probably want to use the non-GENERIC addressing (i.e., we'll need to
make special device instances that will use EC_PWM_TYPE_KB_LIGHT or
EC_PWM_TYPE_DISPLAY_LIGHT), as well as the relatively inflexible
pwm_lookup infrastructure for matching devices. Defer that work for now.

Signed-off-by: Brian Norris <briannorris@chromium.org>
---
v4:
 * adapt to changed cros_ec_cmd_xfer_status() helper

v3:
 * handle 'disabled' properly in apply(), since EC conflates 0
   duty-cycle and disabled state

v2:
 * refactor some abstractions to separate the PWM layer handling from
   the cros_ec handling
 * remove dynamic kzalloc()'s and rely on on-stack memory instead
 * auto-probe the number of PWMs supported
---
 drivers/pwm/Kconfig       |   7 ++
 drivers/pwm/Makefile      |   1 +
 drivers/pwm/pwm-cros-ec.c | 260 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 268 insertions(+)
 create mode 100644 drivers/pwm/pwm-cros-ec.c

diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index c182efc62c7b..4f2b16a50f42 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -137,6 +137,13 @@ config PWM_CRC
 	  Generic PWM framework driver for Crystalcove (CRC) PMIC based PWM
 	  control.
 
+config PWM_CROS_EC
+	tristate "ChromeOS EC PWM driver"
+	depends on MFD_CROS_EC
+	help
+	  PWM driver for exposing a PWM attached to the ChromeOS Embedded
+	  Controller.
+
 config PWM_EP93XX
 	tristate "Cirrus Logic EP93xx PWM support"
 	depends on ARCH_EP93XX
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
index dd35bc121a18..ffde923cf3df 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_PWM_BFIN)		+= pwm-bfin.o
 obj-$(CONFIG_PWM_BRCMSTB)	+= pwm-brcmstb.o
 obj-$(CONFIG_PWM_CLPS711X)	+= pwm-clps711x.o
 obj-$(CONFIG_PWM_CRC)		+= pwm-crc.o
+obj-$(CONFIG_PWM_CROS_EC)	+= pwm-cros-ec.o
 obj-$(CONFIG_PWM_EP93XX)	+= pwm-ep93xx.o
 obj-$(CONFIG_PWM_FSL_FTM)	+= pwm-fsl-ftm.o
 obj-$(CONFIG_PWM_IMG)		+= pwm-img.o
diff --git a/drivers/pwm/pwm-cros-ec.c b/drivers/pwm/pwm-cros-ec.c
new file mode 100644
index 000000000000..99b9acc1a420
--- /dev/null
+++ b/drivers/pwm/pwm-cros-ec.c
@@ -0,0 +1,260 @@
+/*
+ * Copyright (C) 2016 Google, Inc
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2, as published by
+ * the Free Software Foundation.
+ *
+ * Expose a PWM controlled by the ChromeOS EC to the host processor.
+ */
+
+#include <linux/module.h>
+#include <linux/mfd/cros_ec.h>
+#include <linux/mfd/cros_ec_commands.h>
+#include <linux/platform_device.h>
+#include <linux/pwm.h>
+#include <linux/slab.h>
+
+/**
+ * struct cros_ec_pwm_device - Driver data for EC PWM
+ *
+ * @dev: Device node
+ * @ec: Pointer to EC device
+ * @chip: PWM controller chip
+ */
+struct cros_ec_pwm_device {
+	struct device *dev;
+	struct cros_ec_device *ec;
+	struct pwm_chip chip;
+};
+
+static inline struct cros_ec_pwm_device *pwm_to_cros_ec_pwm(struct pwm_chip *c)
+{
+	return container_of(c, struct cros_ec_pwm_device, chip);
+}
+
+static int cros_ec_pwm_set_duty(struct cros_ec_device *ec, u8 index, u16 duty)
+{
+	struct {
+		struct cros_ec_command msg;
+		struct ec_params_pwm_set_duty params;
+	} buf;
+	struct ec_params_pwm_set_duty *params = &buf.params;
+	struct cros_ec_command *msg = &buf.msg;
+
+	memset(&buf, 0, sizeof(buf));
+
+	msg->version = 0;
+	msg->command = EC_CMD_PWM_SET_DUTY;
+	msg->insize = 0;
+	msg->outsize = sizeof(*params);
+
+	params->duty = duty;
+	params->pwm_type = EC_PWM_TYPE_GENERIC;
+	params->index = index;
+
+	return cros_ec_cmd_xfer_status(ec, msg);
+}
+
+static int __cros_ec_pwm_get_duty(struct cros_ec_device *ec, u8 index,
+				  u32 *result)
+{
+	struct {
+		struct cros_ec_command msg;
+		union {
+			struct ec_params_pwm_get_duty params;
+			struct ec_response_pwm_get_duty resp;
+		};
+	} buf;
+	struct ec_params_pwm_get_duty *params = &buf.params;
+	struct ec_response_pwm_get_duty *resp = &buf.resp;
+	struct cros_ec_command *msg = &buf.msg;
+	int ret;
+
+	memset(&buf, 0, sizeof(buf));
+
+	msg->version = 0;
+	msg->command = EC_CMD_PWM_GET_DUTY;
+	msg->insize = sizeof(*params);
+	msg->outsize = sizeof(*resp);
+
+	params->pwm_type = EC_PWM_TYPE_GENERIC;
+	params->index = index;
+
+	ret = cros_ec_cmd_xfer_status(ec, msg);
+	if (result)
+		*result = msg->result;
+	if (ret < 0)
+		return ret;
+
+	return resp->duty;
+}
+
+static int cros_ec_pwm_get_duty(struct cros_ec_device *ec, u8 index)
+{
+	return __cros_ec_pwm_get_duty(ec, index, NULL);
+}
+
+static int cros_ec_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
+			     struct pwm_state *state)
+{
+	struct cros_ec_pwm_device *ec_pwm = pwm_to_cros_ec_pwm(chip);
+	int duty_cycle;
+
+	/* The EC won't let us change the period */
+	if (state->period != EC_PWM_MAX_DUTY)
+		return -EINVAL;
+
+	/*
+	 * EC doesn't separate the concept of duty cycle and enabled, but
+	 * kernel does. Translate.
+	 */
+	duty_cycle = state->enabled ? state->duty_cycle : 0;
+
+	return cros_ec_pwm_set_duty(ec_pwm->ec, pwm->hwpwm, duty_cycle);
+}
+
+static void cros_ec_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
+				  struct pwm_state *state)
+{
+	struct cros_ec_pwm_device *ec_pwm = pwm_to_cros_ec_pwm(chip);
+	int ret;
+
+	ret = cros_ec_pwm_get_duty(ec_pwm->ec, pwm->hwpwm);
+	if (ret < 0) {
+		dev_err(chip->dev, "error getting initial duty: %d\n", ret);
+		return;
+	}
+
+	state->enabled = (ret > 0);
+	state->period = EC_PWM_MAX_DUTY;
+
+	/* Note that "disabled" and "duty cycle == 0" are treated the same */
+	state->duty_cycle = ret;
+}
+
+static struct pwm_device *
+cros_ec_pwm_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
+{
+	struct pwm_device *pwm;
+
+	if (args->args[0] >= pc->npwm)
+		return ERR_PTR(-EINVAL);
+
+	pwm = pwm_request_from_chip(pc, args->args[0], NULL);
+	if (IS_ERR(pwm))
+		return pwm;
+
+	/* The EC won't let us change the period */
+	pwm->args.period = EC_PWM_MAX_DUTY;
+
+	return pwm;
+}
+
+static const struct pwm_ops cros_ec_pwm_ops = {
+	.get_state	= cros_ec_pwm_get_state,
+	.apply		= cros_ec_pwm_apply,
+	.owner		= THIS_MODULE,
+};
+
+static int cros_ec_num_pwms(struct cros_ec_device *ec)
+{
+	int i, ret;
+
+	/* The index field is only 8 bits */
+	for (i = 0; i <= U8_MAX; i++) {
+		u32 result = 0;
+
+		ret = __cros_ec_pwm_get_duty(ec, i, &result);
+		/* We want to parse EC protocol errors */
+		if (ret < 0 && !(ret == -EPROTO && result))
+			return ret;
+
+		/*
+		 * We look for SUCCESS, INVALID_COMMAND, or INVALID_PARAM
+		 * responses; everything else is treated as an error.
+		 */
+		if (result == EC_RES_INVALID_COMMAND)
+			return -ENODEV;
+		else if (result == EC_RES_INVALID_PARAM)
+			return i;
+		else if (result)
+			return -EPROTO;
+	}
+
+	return U8_MAX;
+}
+
+static int cros_ec_pwm_probe(struct platform_device *pdev)
+{
+	struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent);
+	struct device *dev = &pdev->dev;
+	struct cros_ec_pwm_device *ec_pwm;
+	struct pwm_chip *chip;
+	int ret;
+
+	if (!ec) {
+		dev_err(dev, "no parent EC device\n");
+		return -EINVAL;
+	}
+
+	ec_pwm = devm_kzalloc(dev, sizeof(*ec_pwm), GFP_KERNEL);
+	if (!ec_pwm)
+		return -ENOMEM;
+	chip = &ec_pwm->chip;
+	ec_pwm->ec = ec;
+
+	/* PWM chip */
+	chip->dev = dev;
+	chip->ops = &cros_ec_pwm_ops;
+	chip->of_xlate = cros_ec_pwm_xlate;
+	chip->of_pwm_n_cells = 1;
+	chip->base = -1;
+	ret = cros_ec_num_pwms(ec);
+	if (ret < 0) {
+		dev_err(dev, "Couldn't find PWMs: %d\n", ret);
+		return ret;
+	}
+	chip->npwm = ret;
+	dev_dbg(dev, "Probed %u PWMs\n", chip->npwm);
+
+	ret = pwmchip_add(chip);
+	if (ret < 0) {
+		dev_err(dev, "cannot register PWM: %d\n", ret);
+		return ret;
+	}
+
+	platform_set_drvdata(pdev, ec_pwm);
+
+	return ret;
+}
+
+static int cros_ec_pwm_remove(struct platform_device *dev)
+{
+	struct cros_ec_pwm_device *ec_pwm = platform_get_drvdata(dev);
+	struct pwm_chip *chip = &ec_pwm->chip;
+
+	return pwmchip_remove(chip);
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id cros_ec_pwm_of_match[] = {
+	{ .compatible = "google,cros-ec-pwm" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, cros_ec_pwm_of_match);
+#endif
+
+static struct platform_driver cros_ec_pwm_driver = {
+	.probe = cros_ec_pwm_probe,
+	.remove = cros_ec_pwm_remove,
+	.driver = {
+		.name = "cros-ec-pwm",
+		.of_match_table = of_match_ptr(cros_ec_pwm_of_match),
+	},
+};
+module_platform_driver(cros_ec_pwm_driver);
+
+MODULE_ALIAS("platform:cros-ec-pwm");
+MODULE_DESCRIPTION("ChromeOS EC PWM driver");
+MODULE_LICENSE("GPL v2");
-- 
2.8.0.rc3.226.g39d4020

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

* Re: [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM
  2016-07-15 23:28 ` Brian Norris
                   ` (4 preceding siblings ...)
  (?)
@ 2016-07-18  8:49 ` Lee Jones
  2016-07-18  9:10   ` Thierry Reding
  2016-07-18 18:45     ` Brian Norris
  -1 siblings, 2 replies; 18+ messages in thread
From: Lee Jones @ 2016-07-18  8:49 UTC (permalink / raw)
  To: Brian Norris
  Cc: Thierry Reding, Olof Johansson, linux-kernel, Doug Anderson,
	Brian Norris, linux-pwm, devicetree, Boris Brezillon,
	Stephen Barber, Javier Martinez Canillas, Benson Leung,
	Enric Balletbo, Randall Spangler, Shawn Nematbakhsh,
	Dmitry Torokhov, Todd Broch, Gwendal Grignou, Tomeu Vizoso

On Fri, 15 Jul 2016, Brian Norris wrote:
> This is the 4th (and final?) version of my series to support the new ChromeOS
> EC PWM API, so we can control, e.g., a PWM backlight when its PWM is attached
> to the EC. It uses Boris's latest "atomic" hooks for the PWM API (i.e., the
> ->apply() callback), which were recently merged.
> 
> Pulled and adapted the cros_ec_cmd_xfer_status() helper from this patch, with
> some minor modifications:
> 
> https://lkml.org/lkml/2016/4/12/342
> 
> Note that after some style bikeshedding, I proposed to put off rewriting the
> entire cros_ec_commands.h header at the moment, due to the shared nature of
> this file. Follow up here:
> 
> https://bugs.chromium.org/p/chromium/issues/detail?id=621123
> 
> As this touches MFD (sort of), drivers/platform/chrome/, and drivers/pwm/, I'm
> still not sure who it should all go through: Lee, Thierry, or Olof?

I usually take this type of submission through the MFD tree, although
it's too late in the day to make it into v4.8.

Which Acks are you missing?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM
  2016-07-18  8:49 ` [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM Lee Jones
@ 2016-07-18  9:10   ` Thierry Reding
  2016-07-18 13:24     ` Lee Jones
  2016-07-18 18:45     ` Brian Norris
  1 sibling, 1 reply; 18+ messages in thread
From: Thierry Reding @ 2016-07-18  9:10 UTC (permalink / raw)
  To: Lee Jones
  Cc: Brian Norris, Olof Johansson, linux-kernel, Doug Anderson,
	Brian Norris, linux-pwm, devicetree, Boris Brezillon,
	Stephen Barber, Javier Martinez Canillas, Benson Leung,
	Enric Balletbo, Randall Spangler, Shawn Nematbakhsh,
	Dmitry Torokhov, Todd Broch, Gwendal Grignou, Tomeu Vizoso

[-- Attachment #1: Type: text/plain, Size: 1463 bytes --]

On Mon, Jul 18, 2016 at 09:49:28AM +0100, Lee Jones wrote:
> On Fri, 15 Jul 2016, Brian Norris wrote:
> > This is the 4th (and final?) version of my series to support the new ChromeOS
> > EC PWM API, so we can control, e.g., a PWM backlight when its PWM is attached
> > to the EC. It uses Boris's latest "atomic" hooks for the PWM API (i.e., the
> > ->apply() callback), which were recently merged.
> > 
> > Pulled and adapted the cros_ec_cmd_xfer_status() helper from this patch, with
> > some minor modifications:
> > 
> > https://lkml.org/lkml/2016/4/12/342
> > 
> > Note that after some style bikeshedding, I proposed to put off rewriting the
> > entire cros_ec_commands.h header at the moment, due to the shared nature of
> > this file. Follow up here:
> > 
> > https://bugs.chromium.org/p/chromium/issues/detail?id=621123
> > 
> > As this touches MFD (sort of), drivers/platform/chrome/, and drivers/pwm/, I'm
> > still not sure who it should all go through: Lee, Thierry, or Olof?
> 
> I usually take this type of submission through the MFD tree, although
> it's too late in the day to make it into v4.8.
> 
> Which Acks are you missing?

I'm willing to take this through the PWM tree if you're okay with the
MFD changes. I can put the MFD changes into a separate branch and you
could pull that in if you needed to resolve any dependencies, which I
think would be quite unlikely if you've already closed your tree.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM
  2016-07-18  9:10   ` Thierry Reding
@ 2016-07-18 13:24     ` Lee Jones
  2016-07-18 14:04       ` Thierry Reding
  0 siblings, 1 reply; 18+ messages in thread
From: Lee Jones @ 2016-07-18 13:24 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Brian Norris, Olof Johansson, linux-kernel, Doug Anderson,
	Brian Norris, linux-pwm, devicetree, Boris Brezillon,
	Stephen Barber, Javier Martinez Canillas, Benson Leung,
	Enric Balletbo, Randall Spangler, Shawn Nematbakhsh,
	Dmitry Torokhov, Todd Broch, Gwendal Grignou, Tomeu Vizoso

On Mon, 18 Jul 2016, Thierry Reding wrote:

> On Mon, Jul 18, 2016 at 09:49:28AM +0100, Lee Jones wrote:
> > On Fri, 15 Jul 2016, Brian Norris wrote:
> > > This is the 4th (and final?) version of my series to support the new ChromeOS
> > > EC PWM API, so we can control, e.g., a PWM backlight when its PWM is attached
> > > to the EC. It uses Boris's latest "atomic" hooks for the PWM API (i.e., the
> > > ->apply() callback), which were recently merged.
> > > 
> > > Pulled and adapted the cros_ec_cmd_xfer_status() helper from this patch, with
> > > some minor modifications:
> > > 
> > > https://lkml.org/lkml/2016/4/12/342
> > > 
> > > Note that after some style bikeshedding, I proposed to put off rewriting the
> > > entire cros_ec_commands.h header at the moment, due to the shared nature of
> > > this file. Follow up here:
> > > 
> > > https://bugs.chromium.org/p/chromium/issues/detail?id=621123
> > > 
> > > As this touches MFD (sort of), drivers/platform/chrome/, and drivers/pwm/, I'm
> > > still not sure who it should all go through: Lee, Thierry, or Olof?
> > 
> > I usually take this type of submission through the MFD tree, although
> > it's too late in the day to make it into v4.8.
> > 
> > Which Acks are you missing?
> 
> I'm willing to take this through the PWM tree if you're okay with the
> MFD changes. I can put the MFD changes into a separate branch and you
> could pull that in if you needed to resolve any dependencies, which I
> think would be quite unlikely if you've already closed your tree.

Are you saying that you're willing to take these straight into the
merge-window, with no soak in -next?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM
  2016-07-18 13:24     ` Lee Jones
@ 2016-07-18 14:04       ` Thierry Reding
  2016-07-19  7:37         ` Lee Jones
  0 siblings, 1 reply; 18+ messages in thread
From: Thierry Reding @ 2016-07-18 14:04 UTC (permalink / raw)
  To: Lee Jones
  Cc: Brian Norris, Olof Johansson, linux-kernel, Doug Anderson,
	Brian Norris, linux-pwm, devicetree, Boris Brezillon,
	Stephen Barber, Javier Martinez Canillas, Benson Leung,
	Enric Balletbo, Randall Spangler, Shawn Nematbakhsh,
	Dmitry Torokhov, Todd Broch, Gwendal Grignou, Tomeu Vizoso

[-- Attachment #1: Type: text/plain, Size: 1974 bytes --]

On Mon, Jul 18, 2016 at 02:24:26PM +0100, Lee Jones wrote:
> On Mon, 18 Jul 2016, Thierry Reding wrote:
> 
> > On Mon, Jul 18, 2016 at 09:49:28AM +0100, Lee Jones wrote:
> > > On Fri, 15 Jul 2016, Brian Norris wrote:
> > > > This is the 4th (and final?) version of my series to support the new ChromeOS
> > > > EC PWM API, so we can control, e.g., a PWM backlight when its PWM is attached
> > > > to the EC. It uses Boris's latest "atomic" hooks for the PWM API (i.e., the
> > > > ->apply() callback), which were recently merged.
> > > > 
> > > > Pulled and adapted the cros_ec_cmd_xfer_status() helper from this patch, with
> > > > some minor modifications:
> > > > 
> > > > https://lkml.org/lkml/2016/4/12/342
> > > > 
> > > > Note that after some style bikeshedding, I proposed to put off rewriting the
> > > > entire cros_ec_commands.h header at the moment, due to the shared nature of
> > > > this file. Follow up here:
> > > > 
> > > > https://bugs.chromium.org/p/chromium/issues/detail?id=621123
> > > > 
> > > > As this touches MFD (sort of), drivers/platform/chrome/, and drivers/pwm/, I'm
> > > > still not sure who it should all go through: Lee, Thierry, or Olof?
> > > 
> > > I usually take this type of submission through the MFD tree, although
> > > it's too late in the day to make it into v4.8.
> > > 
> > > Which Acks are you missing?
> > 
> > I'm willing to take this through the PWM tree if you're okay with the
> > MFD changes. I can put the MFD changes into a separate branch and you
> > could pull that in if you needed to resolve any dependencies, which I
> > think would be quite unlikely if you've already closed your tree.
> 
> Are you saying that you're willing to take these straight into the
> merge-window, with no soak in -next?

There's still a bit of time to let it soak in -next, but I'm not overly
concerned given that this is purely additions of code, so there can't be
any regressions.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM
  2016-07-18  8:49 ` [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM Lee Jones
@ 2016-07-18 18:45     ` Brian Norris
  2016-07-18 18:45     ` Brian Norris
  1 sibling, 0 replies; 18+ messages in thread
From: Brian Norris @ 2016-07-18 18:45 UTC (permalink / raw)
  To: Lee Jones
  Cc: Thierry Reding, Olof Johansson, linux-kernel, Doug Anderson,
	Brian Norris, linux-pwm, devicetree, Boris Brezillon,
	Stephen Barber, Javier Martinez Canillas, Benson Leung,
	Enric Balletbo, Randall Spangler, Shawn Nematbakhsh,
	Dmitry Torokhov, Todd Broch, Gwendal Grignou, Tomeu Vizoso

On Mon, Jul 18, 2016 at 09:49:28AM +0100, Lee Jones wrote:
> On Fri, 15 Jul 2016, Brian Norris wrote:
> > As this touches MFD (sort of), drivers/platform/chrome/, and drivers/pwm/, I'm
> > still not sure who it should all go through: Lee, Thierry, or Olof?
> 
> I usually take this type of submission through the MFD tree, although
> it's too late in the day to make it into v4.8.
> 
> Which Acks are you missing?

I think I was only missing Thierry's. If he's planning to take it
through his tree, then that's fine. It's also fine if it waits for 4.9,
if that helps, although I agree it has practically zero chances of
regressions.

But most importantly, I think various parties would like patch 1, so if
it doesn't make 4.8-rc1, then it's probably important it makes it into a
branch others can pull from if necessary.

Regards,
Brian

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

* Re: [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM
@ 2016-07-18 18:45     ` Brian Norris
  0 siblings, 0 replies; 18+ messages in thread
From: Brian Norris @ 2016-07-18 18:45 UTC (permalink / raw)
  To: Lee Jones
  Cc: Thierry Reding, Olof Johansson,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Doug Anderson, Brian Norris,
	linux-pwm-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Boris Brezillon,
	Stephen Barber, Javier Martinez Canillas, Benson Leung,
	Enric Balletbo, Randall Spangler, Shawn Nematbakhsh,
	Dmitry Torokhov, Todd Broch, Gwendal Grignou, Tomeu Vizoso

On Mon, Jul 18, 2016 at 09:49:28AM +0100, Lee Jones wrote:
> On Fri, 15 Jul 2016, Brian Norris wrote:
> > As this touches MFD (sort of), drivers/platform/chrome/, and drivers/pwm/, I'm
> > still not sure who it should all go through: Lee, Thierry, or Olof?
> 
> I usually take this type of submission through the MFD tree, although
> it's too late in the day to make it into v4.8.
> 
> Which Acks are you missing?

I think I was only missing Thierry's. If he's planning to take it
through his tree, then that's fine. It's also fine if it waits for 4.9,
if that helps, although I agree it has practically zero chances of
regressions.

But most importantly, I think various parties would like patch 1, so if
it doesn't make 4.8-rc1, then it's probably important it makes it into a
branch others can pull from if necessary.

Regards,
Brian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM
  2016-07-18 14:04       ` Thierry Reding
@ 2016-07-19  7:37         ` Lee Jones
  2016-07-25 14:29           ` Thierry Reding
  0 siblings, 1 reply; 18+ messages in thread
From: Lee Jones @ 2016-07-19  7:37 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Brian Norris, Olof Johansson, linux-kernel, Doug Anderson,
	Brian Norris, linux-pwm, devicetree, Boris Brezillon,
	Stephen Barber, Javier Martinez Canillas, Benson Leung,
	Enric Balletbo, Randall Spangler, Shawn Nematbakhsh,
	Dmitry Torokhov, Todd Broch, Gwendal Grignou, Tomeu Vizoso

On Mon, 18 Jul 2016, Thierry Reding wrote:

> On Mon, Jul 18, 2016 at 02:24:26PM +0100, Lee Jones wrote:
> > On Mon, 18 Jul 2016, Thierry Reding wrote:
> > 
> > > On Mon, Jul 18, 2016 at 09:49:28AM +0100, Lee Jones wrote:
> > > > On Fri, 15 Jul 2016, Brian Norris wrote:
> > > > > This is the 4th (and final?) version of my series to support the new ChromeOS
> > > > > EC PWM API, so we can control, e.g., a PWM backlight when its PWM is attached
> > > > > to the EC. It uses Boris's latest "atomic" hooks for the PWM API (i.e., the
> > > > > ->apply() callback), which were recently merged.
> > > > > 
> > > > > Pulled and adapted the cros_ec_cmd_xfer_status() helper from this patch, with
> > > > > some minor modifications:
> > > > > 
> > > > > https://lkml.org/lkml/2016/4/12/342
> > > > > 
> > > > > Note that after some style bikeshedding, I proposed to put off rewriting the
> > > > > entire cros_ec_commands.h header at the moment, due to the shared nature of
> > > > > this file. Follow up here:
> > > > > 
> > > > > https://bugs.chromium.org/p/chromium/issues/detail?id=621123
> > > > > 
> > > > > As this touches MFD (sort of), drivers/platform/chrome/, and drivers/pwm/, I'm
> > > > > still not sure who it should all go through: Lee, Thierry, or Olof?
> > > > 
> > > > I usually take this type of submission through the MFD tree, although
> > > > it's too late in the day to make it into v4.8.
> > > > 
> > > > Which Acks are you missing?
> > > 
> > > I'm willing to take this through the PWM tree if you're okay with the
> > > MFD changes. I can put the MFD changes into a separate branch and you
> > > could pull that in if you needed to resolve any dependencies, which I
> > > think would be quite unlikely if you've already closed your tree.
> > 
> > Are you saying that you're willing to take these straight into the
> > merge-window, with no soak in -next?
> 
> There's still a bit of time to let it soak in -next, but I'm not overly
> concerned given that this is purely additions of code, so there can't be
> any regressions.

No problem my side then.  Apply away.

Before doing so, can you see if there are any clashes with my
mfd-for-next branch?  If conflicts occur, please construct an
immutable tag I can pull from.  That way, I can base my branch on it
and deal with the fallout myself.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM
  2016-07-19  7:37         ` Lee Jones
@ 2016-07-25 14:29           ` Thierry Reding
  0 siblings, 0 replies; 18+ messages in thread
From: Thierry Reding @ 2016-07-25 14:29 UTC (permalink / raw)
  To: Lee Jones
  Cc: Brian Norris, Olof Johansson, linux-kernel, Doug Anderson,
	Brian Norris, linux-pwm, devicetree, Boris Brezillon,
	Stephen Barber, Javier Martinez Canillas, Benson Leung,
	Enric Balletbo, Randall Spangler, Shawn Nematbakhsh,
	Dmitry Torokhov, Todd Broch, Gwendal Grignou, Tomeu Vizoso

[-- Attachment #1: Type: text/plain, Size: 2773 bytes --]

On Tue, Jul 19, 2016 at 08:37:17AM +0100, Lee Jones wrote:
> On Mon, 18 Jul 2016, Thierry Reding wrote:
> 
> > On Mon, Jul 18, 2016 at 02:24:26PM +0100, Lee Jones wrote:
> > > On Mon, 18 Jul 2016, Thierry Reding wrote:
> > > 
> > > > On Mon, Jul 18, 2016 at 09:49:28AM +0100, Lee Jones wrote:
> > > > > On Fri, 15 Jul 2016, Brian Norris wrote:
> > > > > > This is the 4th (and final?) version of my series to support the new ChromeOS
> > > > > > EC PWM API, so we can control, e.g., a PWM backlight when its PWM is attached
> > > > > > to the EC. It uses Boris's latest "atomic" hooks for the PWM API (i.e., the
> > > > > > ->apply() callback), which were recently merged.
> > > > > > 
> > > > > > Pulled and adapted the cros_ec_cmd_xfer_status() helper from this patch, with
> > > > > > some minor modifications:
> > > > > > 
> > > > > > https://lkml.org/lkml/2016/4/12/342
> > > > > > 
> > > > > > Note that after some style bikeshedding, I proposed to put off rewriting the
> > > > > > entire cros_ec_commands.h header at the moment, due to the shared nature of
> > > > > > this file. Follow up here:
> > > > > > 
> > > > > > https://bugs.chromium.org/p/chromium/issues/detail?id=621123
> > > > > > 
> > > > > > As this touches MFD (sort of), drivers/platform/chrome/, and drivers/pwm/, I'm
> > > > > > still not sure who it should all go through: Lee, Thierry, or Olof?
> > > > > 
> > > > > I usually take this type of submission through the MFD tree, although
> > > > > it's too late in the day to make it into v4.8.
> > > > > 
> > > > > Which Acks are you missing?
> > > > 
> > > > I'm willing to take this through the PWM tree if you're okay with the
> > > > MFD changes. I can put the MFD changes into a separate branch and you
> > > > could pull that in if you needed to resolve any dependencies, which I
> > > > think would be quite unlikely if you've already closed your tree.
> > > 
> > > Are you saying that you're willing to take these straight into the
> > > merge-window, with no soak in -next?
> > 
> > There's still a bit of time to let it soak in -next, but I'm not overly
> > concerned given that this is purely additions of code, so there can't be
> > any regressions.
> 
> No problem my side then.  Apply away.
> 
> Before doing so, can you see if there are any clashes with my
> mfd-for-next branch?  If conflicts occur, please construct an
> immutable tag I can pull from.  That way, I can base my branch on it
> and deal with the fallout myself.

It merges cleanly into your mfd-for-next branch, so I've gone and
applied patches 1 and 2 to a for-4.8/mfd branch, which I can provide a
stable tag from if you still need it, and patches 3 and 4 to the
for-4.8/drivers branch.

Thanks,
Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2016-07-25 14:29 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-15 23:28 [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM Brian Norris
2016-07-15 23:28 ` Brian Norris
2016-07-15 23:28 ` [PATCH v4 1/4] mfd: cros_ec: Add cros_ec_cmd_xfer_status helper Brian Norris
2016-07-15 23:28   ` Brian Norris
2016-07-15 23:28 ` [PATCH v4 2/4] mfd: cros_ec: add EC_PWM function definitions Brian Norris
2016-07-15 23:28   ` Brian Norris
2016-07-15 23:28 ` [PATCH v4 3/4] doc: dt: pwm: add binding for ChromeOS EC PWM Brian Norris
2016-07-15 23:28   ` Brian Norris
2016-07-15 23:28 ` [PATCH v4 4/4] pwm: add ChromeOS EC PWM driver Brian Norris
2016-07-15 23:28   ` Brian Norris
2016-07-18  8:49 ` [PATCH v4 0/4] pwm: add support for ChromeOS EC PWM Lee Jones
2016-07-18  9:10   ` Thierry Reding
2016-07-18 13:24     ` Lee Jones
2016-07-18 14:04       ` Thierry Reding
2016-07-19  7:37         ` Lee Jones
2016-07-25 14:29           ` Thierry Reding
2016-07-18 18:45   ` Brian Norris
2016-07-18 18:45     ` Brian Norris

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.