linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT
@ 2020-12-09 22:03 Evan Benn
  2020-12-09 22:03 ` [PATCH 2/2] platform/chrome: cros_ec_proto: Add LID and BATTERY to default mask Evan Benn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Evan Benn @ 2020-12-09 22:03 UTC (permalink / raw)
  To: LKML
  Cc: briannorris, Evan Benn, Benson Leung, Enric Balletbo i Serra,
	Guenter Roeck

The host_event_code enum is 1-based, use EC_HOST_EVENT_MASK not BIT to
generate the intended mask. This patch changes the behaviour of the
mask, a following patch will restore the intended behaviour:
'Add LID and BATTERY to default mask'

Fixes: c214e564acb2ad9463293ab9c109bfdae91fbeaf
Signed-off-by: Evan Benn <evanbenn@chromium.org>
---

 drivers/platform/chrome/cros_ec_proto.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index 0ecee8b8773d..4e442175612d 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -526,11 +526,11 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev)
 		 * power), not wake up.
 		 */
 		ec_dev->host_event_wake_mask = U32_MAX &
-			~(BIT(EC_HOST_EVENT_AC_DISCONNECTED) |
-			  BIT(EC_HOST_EVENT_BATTERY_LOW) |
-			  BIT(EC_HOST_EVENT_BATTERY_CRITICAL) |
-			  BIT(EC_HOST_EVENT_PD_MCU) |
-			  BIT(EC_HOST_EVENT_BATTERY_STATUS));
+			~(EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) |
+			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_LOW) |
+			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_CRITICAL) |
+			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_PD_MCU) |
+			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_STATUS));
 		/*
 		 * Old ECs may not support this command. Complain about all
 		 * other errors.
-- 
2.20.1


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

* [PATCH 2/2] platform/chrome: cros_ec_proto: Add LID and BATTERY to default mask
  2020-12-09 22:03 [PATCH 1/2] platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT Evan Benn
@ 2020-12-09 22:03 ` Evan Benn
  2020-12-09 22:37 ` [PATCH 1/2] platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT Brian Norris
  2021-01-20 15:14 ` Enric Balletbo i Serra
  2 siblings, 0 replies; 4+ messages in thread
From: Evan Benn @ 2020-12-09 22:03 UTC (permalink / raw)
  To: LKML
  Cc: briannorris, Evan Benn, Benson Leung, Enric Balletbo i Serra,
	Guenter Roeck

After 'platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT'
some of the flags are not quite correct.
LID_CLOSED is used to suspend the device, so it makes sense to ignore that.
BATTERY events are also frequent and causing spurious wakes on elm/hana
mt8173 devices.

Fixes: c214e564acb2ad9463293ab9c109bfdae91fbeaf
Signed-off-by: Evan Benn <evanbenn@chromium.org>
---

 drivers/platform/chrome/cros_ec_proto.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index 4e442175612d..ea5149efcbea 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -526,9 +526,11 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev)
 		 * power), not wake up.
 		 */
 		ec_dev->host_event_wake_mask = U32_MAX &
-			~(EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) |
+			~(EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED) |
+			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) |
 			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_LOW) |
 			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_CRITICAL) |
+			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY) |
 			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_PD_MCU) |
 			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_STATUS));
 		/*
-- 
2.20.1


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

* Re: [PATCH 1/2] platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT
  2020-12-09 22:03 [PATCH 1/2] platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT Evan Benn
  2020-12-09 22:03 ` [PATCH 2/2] platform/chrome: cros_ec_proto: Add LID and BATTERY to default mask Evan Benn
@ 2020-12-09 22:37 ` Brian Norris
  2021-01-20 15:14 ` Enric Balletbo i Serra
  2 siblings, 0 replies; 4+ messages in thread
From: Brian Norris @ 2020-12-09 22:37 UTC (permalink / raw)
  To: Evan Benn; +Cc: LKML, Benson Leung, Enric Balletbo i Serra, Guenter Roeck

On Wed, Dec 09, 2020 at 10:03:54PM +0000, Evan Benn wrote:
> The host_event_code enum is 1-based, use EC_HOST_EVENT_MASK not BIT to
> generate the intended mask. This patch changes the behaviour of the
> mask, a following patch will restore the intended behaviour:
> 'Add LID and BATTERY to default mask'
> 
> Fixes: c214e564acb2ad9463293ab9c109bfdae91fbeaf

Normally the short hash + commit title are used here, so:

Fixes: c214e564acb2 ("platform/chrome: cros_ec_proto: ignore unnecessary wakeups on old ECs")

https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-changes

With luck, maintainers can fix that up when applying, so you don't need
to resend.

Otherwise, both patches look good to me, thanks!

Reviewed-by: Brian Norris <briannorris@chromium.org>

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

* Re: [PATCH 1/2] platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT
  2020-12-09 22:03 [PATCH 1/2] platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT Evan Benn
  2020-12-09 22:03 ` [PATCH 2/2] platform/chrome: cros_ec_proto: Add LID and BATTERY to default mask Evan Benn
  2020-12-09 22:37 ` [PATCH 1/2] platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT Brian Norris
@ 2021-01-20 15:14 ` Enric Balletbo i Serra
  2 siblings, 0 replies; 4+ messages in thread
From: Enric Balletbo i Serra @ 2021-01-20 15:14 UTC (permalink / raw)
  To: LKML, Evan Benn; +Cc: Benson Leung, Guenter Roeck, briannorris

On Wed, 9 Dec 2020 22:03:54 +0000, Evan Benn wrote:
> The host_event_code enum is 1-based, use EC_HOST_EVENT_MASK not BIT to
> generate the intended mask. This patch changes the behaviour of the
> mask, a following patch will restore the intended behaviour:
> 'Add LID and BATTERY to default mask'

Applied, thanks!

[1/2] platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT
      commit: 9eb4f16a67245f7155148d9a400e0eab3cb0fe7b
[2/2] platform/chrome: cros_ec_proto: Add LID and BATTERY to default mask
      commit: b33539f0d9f341a765c6b9dc63f00e253c8595aa

Best regards,
-- 
Enric Balletbo i Serra <enric.balletbo@collabora.com>

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

end of thread, other threads:[~2021-01-20 15:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 22:03 [PATCH 1/2] platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT Evan Benn
2020-12-09 22:03 ` [PATCH 2/2] platform/chrome: cros_ec_proto: Add LID and BATTERY to default mask Evan Benn
2020-12-09 22:37 ` [PATCH 1/2] platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT Brian Norris
2021-01-20 15:14 ` Enric Balletbo i Serra

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