aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2016-08-01 05:54:37 -0400
committerJonathan Cameron <jic23@kernel.org>2016-10-25 13:20:29 -0400
commite4244ebddae27e9200146bba897f12a3950ce722 (patch)
tree950f21d391cfaa5409f38d3eb4aee0901f376fca /include/linux/mfd
parentc14dca07a31dac8bd91aa818df62fb3bf1d846c5 (diff)
platform/chrome: Introduce a new function to check EC features.
Use the EC_CMD_GET_FEATURES message to check the supported features for each MCU. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> [tomeu: adapted to changes in mainline] Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> [enric: remove references to USB PD feature and do it more generic] Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> For the MFD changes: Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'include/linux/mfd')
-rw-r--r--include/linux/mfd/cros_ec.h1
-rw-r--r--include/linux/mfd/cros_ec_commands.h84
2 files changed, 85 insertions, 0 deletions
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 1f85b7aff097..f62043a75f43 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -184,6 +184,7 @@ struct cros_ec_dev {
184 struct cros_ec_device *ec_dev; 184 struct cros_ec_device *ec_dev;
185 struct device *dev; 185 struct device *dev;
186 u16 cmd_offset; 186 u16 cmd_offset;
187 u32 features[2];
187}; 188};
188 189
189/** 190/**
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 8826e0f64b0e..1683003603f3 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -713,6 +713,90 @@ struct ec_response_get_set_value {
713/* More than one command can use these structs to get/set paramters. */ 713/* More than one command can use these structs to get/set paramters. */
714#define EC_CMD_GSV_PAUSE_IN_S5 0x0c 714#define EC_CMD_GSV_PAUSE_IN_S5 0x0c
715 715
716/*****************************************************************************/
717/* List the features supported by the firmware */
718#define EC_CMD_GET_FEATURES 0x0d
719
720/* Supported features */
721enum ec_feature_code {
722 /*
723 * This image contains a limited set of features. Another image
724 * in RW partition may support more features.
725 */
726 EC_FEATURE_LIMITED = 0,
727 /*
728 * Commands for probing/reading/writing/erasing the flash in the
729 * EC are present.
730 */
731 EC_FEATURE_FLASH = 1,
732 /*
733 * Can control the fan speed directly.
734 */
735 EC_FEATURE_PWM_FAN = 2,
736 /*
737 * Can control the intensity of the keyboard backlight.
738 */
739 EC_FEATURE_PWM_KEYB = 3,
740 /*
741 * Support Google lightbar, introduced on Pixel.
742 */
743 EC_FEATURE_LIGHTBAR = 4,
744 /* Control of LEDs */
745 EC_FEATURE_LED = 5,
746 /* Exposes an interface to control gyro and sensors.
747 * The host goes through the EC to access these sensors.
748 * In addition, the EC may provide composite sensors, like lid angle.
749 */
750 EC_FEATURE_MOTION_SENSE = 6,
751 /* The keyboard is controlled by the EC */
752 EC_FEATURE_KEYB = 7,
753 /* The AP can use part of the EC flash as persistent storage. */
754 EC_FEATURE_PSTORE = 8,
755 /* The EC monitors BIOS port 80h, and can return POST codes. */
756 EC_FEATURE_PORT80 = 9,
757 /*
758 * Thermal management: include TMP specific commands.
759 * Higher level than direct fan control.
760 */
761 EC_FEATURE_THERMAL = 10,
762 /* Can switch the screen backlight on/off */
763 EC_FEATURE_BKLIGHT_SWITCH = 11,
764 /* Can switch the wifi module on/off */
765 EC_FEATURE_WIFI_SWITCH = 12,
766 /* Monitor host events, through for example SMI or SCI */
767 EC_FEATURE_HOST_EVENTS = 13,
768 /* The EC exposes GPIO commands to control/monitor connected devices. */
769 EC_FEATURE_GPIO = 14,
770 /* The EC can send i2c messages to downstream devices. */
771 EC_FEATURE_I2C = 15,
772 /* Command to control charger are included */
773 EC_FEATURE_CHARGER = 16,
774 /* Simple battery support. */
775 EC_FEATURE_BATTERY = 17,
776 /*
777 * Support Smart battery protocol
778 * (Common Smart Battery System Interface Specification)
779 */
780 EC_FEATURE_SMART_BATTERY = 18,
781 /* EC can dectect when the host hangs. */
782 EC_FEATURE_HANG_DETECT = 19,
783 /* Report power information, for pit only */
784 EC_FEATURE_PMU = 20,
785 /* Another Cros EC device is present downstream of this one */
786 EC_FEATURE_SUB_MCU = 21,
787 /* Support USB Power delivery (PD) commands */
788 EC_FEATURE_USB_PD = 22,
789 /* Control USB multiplexer, for audio through USB port for instance. */
790 EC_FEATURE_USB_MUX = 23,
791 /* Motion Sensor code has an internal software FIFO */
792 EC_FEATURE_MOTION_SENSE_FIFO = 24,
793};
794
795#define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32))
796#define EC_FEATURE_MASK_1(event_code) (1UL << (event_code - 32))
797struct ec_response_get_features {
798 uint32_t flags[2];
799} __packed;
716 800
717/*****************************************************************************/ 801/*****************************************************************************/
718/* Flash commands */ 802/* Flash commands */