Skip to content

Commit 1213325

Browse files
committed
Merge tag 'tag-chrome-platform-for-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform
Pull chrome platform updates from Benson Leung: - Changes for EC_MKBP_EVENT_SENSOR_FIFO handling. - Also, maintainership changes. Olofj out, Enric balletbo in. * tag 'tag-chrome-platform-for-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform: MAINTAINERS: add maintainers for ChromeOS EC sub-drivers MAINTAINERS: platform/chrome: Add Enric as a maintainer MAINTAINERS: platform/chrome: remove myself as maintainer platform/chrome: don't report EC_MKBP_EVENT_SENSOR_FIFO as wakeup platform/chrome: straighten out cros_ec_get_{next,host}_event() error codes
2 parents 66e012f + cdd6a4a commit 1213325

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

MAINTAINERS

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3674,11 +3674,20 @@ F: drivers/input/touchscreen/chipone_icn8505.c
36743674

36753675
CHROME HARDWARE PLATFORM SUPPORT
36763676
M: Benson Leung <bleung@chromium.org>
3677-
M: Olof Johansson <olof@lixom.net>
3677+
M: Enric Balletbo i Serra <enric.balletbo@collabora.com>
36783678
S: Maintained
36793679
T: git git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform.git
36803680
F: drivers/platform/chrome/
36813681

3682+
CHROMEOS EC SUBDRIVERS
3683+
M: Benson Leung <bleung@chromium.org>
3684+
M: Enric Balletbo i Serra <enric.balletbo@collabora.com>
3685+
R: Guenter Roeck <groeck@chromium.org>
3686+
S: Maintained
3687+
N: cros_ec
3688+
N: cros-ec
3689+
F: drivers/power/supply/cros_usbpd-charger.c
3690+
36823691
CIRRUS LOGIC AUDIO CODEC DRIVERS
36833692
M: Brian Austin <brian.austin@cirrus.com>
36843693
M: Paul Handrigan <Paul.Handrigan@cirrus.com>

drivers/platform/chrome/cros_ec_proto.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,12 +575,13 @@ static int get_keyboard_state_event(struct cros_ec_device *ec_dev)
575575

576576
int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event)
577577
{
578+
u8 event_type;
578579
u32 host_event;
579580
int ret;
580581

581582
if (!ec_dev->mkbp_event_supported) {
582583
ret = get_keyboard_state_event(ec_dev);
583-
if (ret < 0)
584+
if (ret <= 0)
584585
return ret;
585586

586587
if (wake_event)
@@ -590,15 +591,26 @@ int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event)
590591
}
591592

592593
ret = get_next_event(ec_dev);
593-
if (ret < 0)
594+
if (ret <= 0)
594595
return ret;
595596

596597
if (wake_event) {
598+
event_type = ec_dev->event_data.event_type;
597599
host_event = cros_ec_get_host_event(ec_dev);
598600

599-
/* Consider non-host_event as wake event */
600-
*wake_event = !host_event ||
601-
!!(host_event & ec_dev->host_event_wake_mask);
601+
/*
602+
* Sensor events need to be parsed by the sensor sub-device.
603+
* Defer them, and don't report the wakeup here.
604+
*/
605+
if (event_type == EC_MKBP_EVENT_SENSOR_FIFO)
606+
*wake_event = false;
607+
/* Masked host-events should not count as wake events. */
608+
else if (host_event &&
609+
!(host_event & ec_dev->host_event_wake_mask))
610+
*wake_event = false;
611+
/* Consider all other events as wake events. */
612+
else
613+
*wake_event = true;
602614
}
603615

604616
return ret;

include/linux/mfd/cros_ec.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,9 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev);
317317
* @wake_event: Pointer to a bool set to true upon return if the event might be
318318
* treated as a wake event. Ignored if null.
319319
*
320-
* Return: 0 on success or negative error code.
320+
* Return: negative error code on errors; 0 for no data; or else number of
321+
* bytes received (i.e., an event was retrieved successfully). Event types are
322+
* written out to @ec_dev->event_data.event_type on success.
321323
*/
322324
int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event);
323325

@@ -329,7 +331,7 @@ int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event);
329331
* events raised and call the functions in the ec notifier. This function
330332
* is a helper to know which events are raised.
331333
*
332-
* Return: 0 on success or negative error code.
334+
* Return: 0 on error or non-zero bitmask of one or more EC_HOST_EVENT_*.
333335
*/
334336
u32 cros_ec_get_host_event(struct cros_ec_device *ec_dev);
335337

0 commit comments

Comments
 (0)