|
@@ -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.
|
|
* If this is true, we won't do anything during suspend/resume.
|
|
*/
|
|
*/
|
|
static bool userspace_control;
|
|
static bool userspace_control;
|
|
|
|
+static struct cros_ec_dev *ec_with_lightbar;
|
|
|
|
|
|
static ssize_t interval_msec_show(struct device *dev,
|
|
static ssize_t interval_msec_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
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;
|
|
struct cros_ec_command *msg;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
|
|
+ if (ec != ec_with_lightbar)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
msg = alloc_lightbar_cmd_msg(ec);
|
|
msg = alloc_lightbar_cmd_msg(ec);
|
|
if (!msg)
|
|
if (!msg)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
@@ -413,7 +417,7 @@ error:
|
|
|
|
|
|
int lb_suspend(struct cros_ec_dev *ec)
|
|
int lb_suspend(struct cros_ec_dev *ec)
|
|
{
|
|
{
|
|
- if (userspace_control)
|
|
|
|
|
|
+ if (userspace_control || ec != ec_with_lightbar)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
return lb_send_empty_cmd(ec, LIGHTBAR_CMD_SUSPEND);
|
|
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)
|
|
int lb_resume(struct cros_ec_dev *ec)
|
|
{
|
|
{
|
|
- if (userspace_control)
|
|
|
|
|
|
+ if (userspace_control || ec != ec_with_lightbar)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
return lb_send_empty_cmd(ec, LIGHTBAR_CMD_RESUME);
|
|
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;
|
|
return 0;
|
|
|
|
|
|
/* Only instantiate this stuff if the EC has a lightbar */
|
|
/* 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 a->mode;
|
|
-
|
|
|
|
|
|
+ }
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|