aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-01-06 14:40:06 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-01-06 14:40:06 -0500
commit12133258d7fe309b42a35677549c606b15a0822d (patch)
tree1551465e4fd9b3409083c3e452405ba59da38f45
parent66e012f6188fb37b18c774277f34fb52278059c3 (diff)
parentcdd6a4a0e2ec590c30ad0e965fa08bf37461cadb (diff)
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
-rw-r--r--MAINTAINERS11
-rw-r--r--drivers/platform/chrome/cros_ec_proto.c22
-rw-r--r--include/linux/mfd/cros_ec.h6
3 files changed, 31 insertions, 8 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 37cc59350d45..32d444476a90 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3674,11 +3674,20 @@ F: drivers/input/touchscreen/chipone_icn8505.c
3674 3674
3675CHROME HARDWARE PLATFORM SUPPORT 3675CHROME HARDWARE PLATFORM SUPPORT
3676M: Benson Leung <bleung@chromium.org> 3676M: Benson Leung <bleung@chromium.org>
3677M: Olof Johansson <olof@lixom.net> 3677M: Enric Balletbo i Serra <enric.balletbo@collabora.com>
3678S: Maintained 3678S: Maintained
3679T: git git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform.git 3679T: git git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform.git
3680F: drivers/platform/chrome/ 3680F: drivers/platform/chrome/
3681 3681
3682CHROMEOS EC SUBDRIVERS
3683M: Benson Leung <bleung@chromium.org>
3684M: Enric Balletbo i Serra <enric.balletbo@collabora.com>
3685R: Guenter Roeck <groeck@chromium.org>
3686S: Maintained
3687N: cros_ec
3688N: cros-ec
3689F: drivers/power/supply/cros_usbpd-charger.c
3690
3682CIRRUS LOGIC AUDIO CODEC DRIVERS 3691CIRRUS LOGIC AUDIO CODEC DRIVERS
3683M: Brian Austin <brian.austin@cirrus.com> 3692M: Brian Austin <brian.austin@cirrus.com>
3684M: Paul Handrigan <Paul.Handrigan@cirrus.com> 3693M: Paul Handrigan <Paul.Handrigan@cirrus.com>
diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index b6fd4838f60f..cc7baf0ecb3c 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -575,12 +575,13 @@ static int get_keyboard_state_event(struct cros_ec_device *ec_dev)
575 575
576int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event) 576int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event)
577{ 577{
578 u8 event_type;
578 u32 host_event; 579 u32 host_event;
579 int ret; 580 int ret;
580 581
581 if (!ec_dev->mkbp_event_supported) { 582 if (!ec_dev->mkbp_event_supported) {
582 ret = get_keyboard_state_event(ec_dev); 583 ret = get_keyboard_state_event(ec_dev);
583 if (ret < 0) 584 if (ret <= 0)
584 return ret; 585 return ret;
585 586
586 if (wake_event) 587 if (wake_event)
@@ -590,15 +591,26 @@ int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event)
590 } 591 }
591 592
592 ret = get_next_event(ec_dev); 593 ret = get_next_event(ec_dev);
593 if (ret < 0) 594 if (ret <= 0)
594 return ret; 595 return ret;
595 596
596 if (wake_event) { 597 if (wake_event) {
598 event_type = ec_dev->event_data.event_type;
597 host_event = cros_ec_get_host_event(ec_dev); 599 host_event = cros_ec_get_host_event(ec_dev);
598 600
599 /* Consider non-host_event as wake event */ 601 /*
600 *wake_event = !host_event || 602 * Sensor events need to be parsed by the sensor sub-device.
601 !!(host_event & ec_dev->host_event_wake_mask); 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;
602 } 614 }
603 615
604 return ret; 616 return ret;
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index e44e3ec8a9c7..de8b588c8776 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -317,7 +317,9 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev);
317 * @wake_event: Pointer to a bool set to true upon return if the event might be 317 * @wake_event: Pointer to a bool set to true upon return if the event might be
318 * treated as a wake event. Ignored if null. 318 * treated as a wake event. Ignored if null.
319 * 319 *
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.
321 */ 323 */
322int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event); 324int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event);
323 325
@@ -329,7 +331,7 @@ int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event);
329 * events raised and call the functions in the ec notifier. This function 331 * events raised and call the functions in the ec notifier. This function
330 * is a helper to know which events are raised. 332 * is a helper to know which events are raised.
331 * 333 *
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_*.
333 */ 335 */
334u32 cros_ec_get_host_event(struct cros_ec_device *ec_dev); 336u32 cros_ec_get_host_event(struct cros_ec_device *ec_dev);
335 337