aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Anderson <dianders@chromium.org>2017-01-20 05:14:14 -0500
committerLee Jones <lee.jones@linaro.org>2017-02-08 06:15:50 -0500
commitb44c4d3f1ee77e7947c525d6a907c0057fa238d2 (patch)
tree466794bb797e36b490b1a4675d3c71378ae3fd14
parent7ce7d89f48834cefece7804d38fc5d85382edf77 (diff)
mfd: cros-ec: Update cros_ec_commands.h for buttons and switches
Add the defines for the new buttons and switches connected to the CrosEC. Signed-off-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r--include/linux/mfd/cros_ec_commands.h73
1 files changed, 71 insertions, 2 deletions
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 1683003603f3..004dcf3560fb 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -1839,18 +1839,69 @@ struct ec_response_tmp006_get_raw {
1839 * 1839 *
1840 * Returns raw data for keyboard cols; see ec_response_mkbp_info.cols for 1840 * Returns raw data for keyboard cols; see ec_response_mkbp_info.cols for
1841 * expected response size. 1841 * expected response size.
1842 *
1843 * NOTE: This has been superseded by EC_CMD_MKBP_GET_NEXT_EVENT. If you wish
1844 * to obtain the instantaneous state, use EC_CMD_MKBP_INFO with the type
1845 * EC_MKBP_INFO_CURRENT and event EC_MKBP_EVENT_KEY_MATRIX.
1842 */ 1846 */
1843#define EC_CMD_MKBP_STATE 0x60 1847#define EC_CMD_MKBP_STATE 0x60
1844 1848
1845/* Provide information about the matrix : number of rows and columns */ 1849/*
1850 * Provide information about various MKBP things. See enum ec_mkbp_info_type.
1851 */
1846#define EC_CMD_MKBP_INFO 0x61 1852#define EC_CMD_MKBP_INFO 0x61
1847 1853
1848struct ec_response_mkbp_info { 1854struct ec_response_mkbp_info {
1849 uint32_t rows; 1855 uint32_t rows;
1850 uint32_t cols; 1856 uint32_t cols;
1851 uint8_t switches; 1857 /* Formerly "switches", which was 0. */
1858 uint8_t reserved;
1852} __packed; 1859} __packed;
1853 1860
1861struct ec_params_mkbp_info {
1862 uint8_t info_type;
1863 uint8_t event_type;
1864} __packed;
1865
1866enum ec_mkbp_info_type {
1867 /*
1868 * Info about the keyboard matrix: number of rows and columns.
1869 *
1870 * Returns struct ec_response_mkbp_info.
1871 */
1872 EC_MKBP_INFO_KBD = 0,
1873
1874 /*
1875 * For buttons and switches, info about which specifically are
1876 * supported. event_type must be set to one of the values in enum
1877 * ec_mkbp_event.
1878 *
1879 * For EC_MKBP_EVENT_BUTTON and EC_MKBP_EVENT_SWITCH, returns a 4 byte
1880 * bitmask indicating which buttons or switches are present. See the
1881 * bit inidices below.
1882 */
1883 EC_MKBP_INFO_SUPPORTED = 1,
1884
1885 /*
1886 * Instantaneous state of buttons and switches.
1887 *
1888 * event_type must be set to one of the values in enum ec_mkbp_event.
1889 *
1890 * For EC_MKBP_EVENT_KEY_MATRIX, returns uint8_t key_matrix[13]
1891 * indicating the current state of the keyboard matrix.
1892 *
1893 * For EC_MKBP_EVENT_HOST_EVENT, return uint32_t host_event, the raw
1894 * event state.
1895 *
1896 * For EC_MKBP_EVENT_BUTTON, returns uint32_t buttons, indicating the
1897 * state of supported buttons.
1898 *
1899 * For EC_MKBP_EVENT_SWITCH, returns uint32_t switches, indicating the
1900 * state of supported switches.
1901 */
1902 EC_MKBP_INFO_CURRENT = 2,
1903};
1904
1854/* Simulate key press */ 1905/* Simulate key press */
1855#define EC_CMD_MKBP_SIMULATE_KEY 0x62 1906#define EC_CMD_MKBP_SIMULATE_KEY 0x62
1856 1907
@@ -1983,6 +2034,12 @@ enum ec_mkbp_event {
1983 /* New Sensor FIFO data. The event data is fifo_info structure. */ 2034 /* New Sensor FIFO data. The event data is fifo_info structure. */
1984 EC_MKBP_EVENT_SENSOR_FIFO = 2, 2035 EC_MKBP_EVENT_SENSOR_FIFO = 2,
1985 2036
2037 /* The state of the non-matrixed buttons have changed. */
2038 EC_MKBP_EVENT_BUTTON = 3,
2039
2040 /* The state of the switches have changed. */
2041 EC_MKBP_EVENT_SWITCH = 4,
2042
1986 /* Number of MKBP events */ 2043 /* Number of MKBP events */
1987 EC_MKBP_EVENT_COUNT, 2044 EC_MKBP_EVENT_COUNT,
1988}; 2045};
@@ -1992,6 +2049,9 @@ union ec_response_get_next_data {
1992 2049
1993 /* Unaligned */ 2050 /* Unaligned */
1994 uint32_t host_event; 2051 uint32_t host_event;
2052
2053 uint32_t buttons;
2054 uint32_t switches;
1995} __packed; 2055} __packed;
1996 2056
1997struct ec_response_get_next_event { 2057struct ec_response_get_next_event {
@@ -2000,6 +2060,15 @@ struct ec_response_get_next_event {
2000 union ec_response_get_next_data data; 2060 union ec_response_get_next_data data;
2001} __packed; 2061} __packed;
2002 2062
2063/* Bit indices for buttons and switches.*/
2064/* Buttons */
2065#define EC_MKBP_POWER_BUTTON 0
2066#define EC_MKBP_VOL_UP 1
2067#define EC_MKBP_VOL_DOWN 2
2068
2069/* Switches */
2070#define EC_MKBP_LID_OPEN 0
2071
2003/*****************************************************************************/ 2072/*****************************************************************************/
2004/* Temperature sensor commands */ 2073/* Temperature sensor commands */
2005 2074