Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1556765 > unrolled thread
| Started by | Enric Balletbo i Serra <enric.balletbo@collabora.com> |
|---|---|
| First post | 2017-01-11 18:40 +0100 |
| Last post | 2017-01-11 18:40 +0100 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 0/4] platform/chrome: cros_ec_lightbar - Add new features Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2017-01-11 18:40 +0100
[PATCH v2 4/4] platform/chrome: cros_ec_lightbar - Avoid I2C xfer to EC during suspend Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2017-01-11 18:40 +0100
| From | Enric Balletbo i Serra <enric.balletbo@collabora.com> |
|---|---|
| Date | 2017-01-11 18:40 +0100 |
| Subject | [PATCH v2 0/4] platform/chrome: cros_ec_lightbar - Add new features |
| Message-ID | <sYv2p-1kC-9@gated-at.bofh.it> |
Dear all,
The following patches taken from the ChromeOS 4.4 tree adds more features to
the cros_ec_lightbar driver. The patches were forward ported to current
mainline and were tested on a Chromebook Pixel 2015.
Best regards,
Enric
Changes since v1:
- Rebase on top of mainline.
- Added Lee Jones ack for patch 1/4
Eric Caruso (3):
platform/chrome: cros_ec_lightbar - Add lightbar program feature to
sysfs
platform/chrome: cros_ec_lightbar - Control of suspend/resume lightbar
sequence
platform/chrome: cros_ec_lightbar - Add userspace lightbar control bit
to EC
Jeffery Yu (1):
platform/chrome: cros_ec_lightbar - Avoid I2C xfer to EC during
suspend
drivers/platform/chrome/cros_ec_dev.c | 34 +++++
drivers/platform/chrome/cros_ec_dev.h | 6 +
drivers/platform/chrome/cros_ec_lightbar.c | 197 ++++++++++++++++++++++++++++-
include/linux/mfd/cros_ec_commands.h | 21 ++-
4 files changed, 252 insertions(+), 6 deletions(-)
--
2.1.0
[toc] | [next] | [standalone]
| From | Enric Balletbo i Serra <enric.balletbo@collabora.com> |
|---|---|
| Date | 2017-01-11 18:40 +0100 |
| Subject | [PATCH v2 4/4] platform/chrome: cros_ec_lightbar - Avoid I2C xfer to EC during suspend |
| Message-ID | <sYv2p-1kC-29@gated-at.bofh.it> |
| In reply to | #1556765 |
From: Jeffery Yu <jefferyy@nvidia.com>
A Mutex lock in cros_ec_cmd_xfer which may be held by frozen
Userspace thread during system suspending. So should not
call this routine in suspend thread.
Signed-off-by: Jeffery Yu <jefferyy@nvidia.com>
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
drivers/platform/chrome/cros_ec_dev.c | 12 ++++--------
drivers/platform/chrome/cros_ec_lightbar.c | 13 +++++++++----
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/platform/chrome/cros_ec_dev.c b/drivers/platform/chrome/cros_ec_dev.c
index ef04523..df5894f 100644
--- a/drivers/platform/chrome/cros_ec_dev.c
+++ b/drivers/platform/chrome/cros_ec_dev.c
@@ -465,8 +465,7 @@ static int ec_device_probe(struct platform_device *pdev)
cros_ec_rtc_register(ec);
/* Take control of the lightbar from the EC. */
- if (ec_has_lightbar(ec))
- lb_manual_suspend_ctrl(ec, 1);
+ lb_manual_suspend_ctrl(ec, 1);
return 0;
@@ -484,8 +483,7 @@ static int ec_device_remove(struct platform_device *pdev)
struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev);
/* Let the EC take over the lightbar again. */
- if (ec_has_lightbar(ec))
- lb_manual_suspend_ctrl(ec, 0);
+ lb_manual_suspend_ctrl(ec, 0);
cdev_del(&ec->cdev);
device_unregister(&ec->class_dev);
@@ -502,8 +500,7 @@ static int ec_device_suspend(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);
- if (ec_has_lightbar(ec))
- lb_suspend(ec);
+ lb_suspend(ec);
return 0;
}
@@ -512,8 +509,7 @@ static int ec_device_resume(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);
- if (ec_has_lightbar(ec))
- lb_resume(ec);
+ lb_resume(ec);
return 0;
}
diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
index e570c1e..fd2b047 100644
--- a/drivers/platform/chrome/cros_ec_lightbar.c
+++ b/drivers/platform/chrome/cros_ec_lightbar.c
@@ -43,6 +43,7 @@ static unsigned long lb_interval_jiffies = 50 * HZ / 1000;
* If this is true, we won't do anything during suspend/resume.
*/
static bool userspace_control;
+static struct cros_ec_dev *ec_with_lightbar;
static ssize_t interval_msec_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -384,6 +385,9 @@ int lb_manual_suspend_ctrl(struct cros_ec_dev *ec, uint8_t enable)
struct cros_ec_command *msg;
int ret;
+ if (ec != ec_with_lightbar)
+ return 0;
+
msg = alloc_lightbar_cmd_msg(ec);
if (!msg)
return -ENOMEM;
@@ -413,7 +417,7 @@ int lb_manual_suspend_ctrl(struct cros_ec_dev *ec, uint8_t enable)
int lb_suspend(struct cros_ec_dev *ec)
{
- if (userspace_control)
+ if (userspace_control || ec != ec_with_lightbar)
return 0;
return lb_send_empty_cmd(ec, LIGHTBAR_CMD_SUSPEND);
@@ -421,7 +425,7 @@ int lb_suspend(struct cros_ec_dev *ec)
int lb_resume(struct cros_ec_dev *ec)
{
- if (userspace_control)
+ if (userspace_control || ec != ec_with_lightbar)
return 0;
return lb_send_empty_cmd(ec, LIGHTBAR_CMD_RESUME);
@@ -606,9 +610,10 @@ static umode_t cros_ec_lightbar_attrs_are_visible(struct kobject *kobj,
return 0;
/* Only instantiate this stuff if the EC has a lightbar */
- if (ec_has_lightbar(ec))
+ if (ec_has_lightbar(ec)) {
+ ec_with_lightbar = ec;
return a->mode;
-
+ }
return 0;
}
--
2.9.3
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web