History

mfd: cros_ec: Add lightbar v2 API

New API split commands, improve EC command latency.

Gwendal Grignou committed 7 years ago

Commit de83db51 parent 89193a01 file · +120 −4Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/mfd/cros_ec_commands.h+120−4
@@ -1658,7 +1658,10 @@ struct lightbar_params_v1 { · 1657 unmodified lines
16581658 int32_t s3_sleep_for;
16591659 int32_t s3_ramp_up;
16601660 int32_t s3_ramp_down;
1661+ int32_t s5_ramp_up;
1662+ int32_t s5_ramp_down;
16611663 int32_t tap_tick_delay;
1664+ int32_t tap_gate_delay;
16621665 int32_t tap_display_time;
16631666
16641667 /* Tap-for-battery params */
@@ -1686,11 +1689,82 @@ struct lightbar_params_v1 { · 21 unmodified lines
16861689 uint8_t s0_idx[2][LB_BATTERY_LEVELS]; /* AP is running */
16871690 uint8_t s3_idx[2][LB_BATTERY_LEVELS]; /* AP is sleeping */
16881691
1692+ /* s5: single color pulse on inhibited power-up */
1693+ uint8_t s5_idx;
1694+
16891695 /* Color palette */
16901696 struct rgb_s color[8]; /* 0-3 are Google colors */
16911697 } __ec_todo_packed;
16921698
1693−/* Lightbar program */
1699+/* Lightbar command params v2
1700+ * crbug.com/467716
1701+ *
1702+ * lightbar_parms_v1 was too big for i2c, therefore in v2, we split them up by
1703+ * logical groups to make it more manageable ( < 120 bytes).
1704+ *
1705+ * NOTE: Each of these groups must be less than 120 bytes.
1706+ */
1707+
1708+struct lightbar_params_v2_timing {
1709+ /* Timing */
1710+ int32_t google_ramp_up;
1711+ int32_t google_ramp_down;
1712+ int32_t s3s0_ramp_up;
1713+ int32_t s0_tick_delay[2]; /* AC=0/1 */
1714+ int32_t s0a_tick_delay[2]; /* AC=0/1 */
1715+ int32_t s0s3_ramp_down;
1716+ int32_t s3_sleep_for;
1717+ int32_t s3_ramp_up;
1718+ int32_t s3_ramp_down;
1719+ int32_t s5_ramp_up;
1720+ int32_t s5_ramp_down;
1721+ int32_t tap_tick_delay;
1722+ int32_t tap_gate_delay;
1723+ int32_t tap_display_time;
1724+} __ec_todo_packed;
1725+
1726+struct lightbar_params_v2_tap {
1727+ /* Tap-for-battery params */
1728+ uint8_t tap_pct_red;
1729+ uint8_t tap_pct_green;
1730+ uint8_t tap_seg_min_on;
1731+ uint8_t tap_seg_max_on;
1732+ uint8_t tap_seg_osc;
1733+ uint8_t tap_idx[3];
1734+} __ec_todo_packed;
1735+
1736+struct lightbar_params_v2_oscillation {
1737+ /* Oscillation */
1738+ uint8_t osc_min[2]; /* AC=0/1 */
1739+ uint8_t osc_max[2]; /* AC=0/1 */
1740+ uint8_t w_ofs[2]; /* AC=0/1 */
1741+} __ec_todo_packed;
1742+
1743+struct lightbar_params_v2_brightness {
1744+ /* Brightness limits based on the backlight and AC. */
1745+ uint8_t bright_bl_off_fixed[2]; /* AC=0/1 */
1746+ uint8_t bright_bl_on_min[2]; /* AC=0/1 */
1747+ uint8_t bright_bl_on_max[2]; /* AC=0/1 */
1748+} __ec_todo_packed;
1749+
1750+struct lightbar_params_v2_thresholds {
1751+ /* Battery level thresholds */
1752+ uint8_t battery_threshold[LB_BATTERY_LEVELS - 1];
1753+} __ec_todo_packed;
1754+
1755+struct lightbar_params_v2_colors {
1756+ /* Map [AC][battery_level] to color index */
1757+ uint8_t s0_idx[2][LB_BATTERY_LEVELS]; /* AP is running */
1758+ uint8_t s3_idx[2][LB_BATTERY_LEVELS]; /* AP is sleeping */
1759+
1760+ /* s5: single color pulse on inhibited power-up */
1761+ uint8_t s5_idx;
1762+
1763+ /* Color palette */
1764+ struct rgb_s color[8]; /* 0-3 are Google colors */
1765+} __ec_todo_packed;
1766+
1767+/* Lightbar program. */
16941768 #define EC_LB_PROG_LEN 192
16951769 struct lightbar_program {
16961770 uint8_t size;
@@ -1704,7 +1778,10 @@ struct ec_params_lightbar { · 7 unmodified lines
17041778 * The following commands have no args:
17051779 *
17061780 * dump, off, on, init, get_seq, get_params_v0, get_params_v1,
1707− * version, get_brightness, get_demo, suspend, resume
1781+ * version, get_brightness, get_demo, suspend, resume,
1782+ * get_params_v2_timing, get_params_v2_tap, get_params_v2_osc,
1783+ * get_params_v2_bright, get_params_v2_thlds,
1784+ * get_params_v2_colors
17081785 *
17091786 * Don't use an empty struct, because C++ hates that.
17101787 */
@@ -1731,6 +1808,14 @@ struct ec_params_lightbar { · 20 unmodified lines
17311808
17321809 struct lightbar_params_v0 set_params_v0;
17331810 struct lightbar_params_v1 set_params_v1;
1811+
1812+ struct lightbar_params_v2_timing set_v2par_timing;
1813+ struct lightbar_params_v2_tap set_v2par_tap;
1814+ struct lightbar_params_v2_oscillation set_v2par_osc;
1815+ struct lightbar_params_v2_brightness set_v2par_bright;
1816+ struct lightbar_params_v2_thresholds set_v2par_thlds;
1817+ struct lightbar_params_v2_colors set_v2par_colors;
1818+
17341819 struct lightbar_program set_program;
17351820 };
17361821 } __ec_todo_packed;
@@ -1752,6 +1837,14 @@ struct ec_response_lightbar { · 15 unmodified lines
17521837 struct lightbar_params_v0 get_params_v0;
17531838 struct lightbar_params_v1 get_params_v1;
17541839
1840+
1841+ struct lightbar_params_v2_timing get_params_v2_timing;
1842+ struct lightbar_params_v2_tap get_params_v2_tap;
1843+ struct lightbar_params_v2_oscillation get_params_v2_osc;
1844+ struct lightbar_params_v2_brightness get_params_v2_bright;
1845+ struct lightbar_params_v2_thresholds get_params_v2_thlds;
1846+ struct lightbar_params_v2_colors get_params_v2_colors;
1847+
17551848 struct __ec_todo_unpacked {
17561849 uint32_t num;
17571850 uint32_t flags;
@@ -1764,9 +1857,11 @@ struct ec_response_lightbar { · 6 unmodified lines
17641857 /*
17651858 * The following commands have no response:
17661859 *
1767− * off, on, init, set_brightness, seq, reg, set_rgb,
1860+ * off, on, init, set_brightness, seq, reg, set_rgb, demo,
17681861 * set_params_v0, set_params_v1, set_program,
1769− * manual_suspend_ctrl, suspend, resume
1862+ * manual_suspend_ctrl, suspend, resume, set_v2par_timing,
1863+ * set_v2par_tap, set_v2par_osc, set_v2par_bright,
1864+ * set_v2par_thlds, set_v2par_colors
17701865 */
17711866 };
17721867 } __ec_todo_packed;
@@ -1795,6 +1890,18 @@ enum lightbar_command { · 22 unmodified lines
17951890 LIGHTBAR_CMD_MANUAL_SUSPEND_CTRL = 19,
17961891 LIGHTBAR_CMD_SUSPEND = 20,
17971892 LIGHTBAR_CMD_RESUME = 21,
1893+ LIGHTBAR_CMD_GET_PARAMS_V2_TIMING = 22,
1894+ LIGHTBAR_CMD_SET_PARAMS_V2_TIMING = 23,
1895+ LIGHTBAR_CMD_GET_PARAMS_V2_TAP = 24,
1896+ LIGHTBAR_CMD_SET_PARAMS_V2_TAP = 25,
1897+ LIGHTBAR_CMD_GET_PARAMS_V2_OSCILLATION = 26,
1898+ LIGHTBAR_CMD_SET_PARAMS_V2_OSCILLATION = 27,
1899+ LIGHTBAR_CMD_GET_PARAMS_V2_BRIGHTNESS = 28,
1900+ LIGHTBAR_CMD_SET_PARAMS_V2_BRIGHTNESS = 29,
1901+ LIGHTBAR_CMD_GET_PARAMS_V2_THRESHOLDS = 30,
1902+ LIGHTBAR_CMD_SET_PARAMS_V2_THRESHOLDS = 31,
1903+ LIGHTBAR_CMD_GET_PARAMS_V2_COLORS = 32,
1904+ LIGHTBAR_CMD_SET_PARAMS_V2_COLORS = 33,
17981905 LIGHTBAR_NUM_CMDS
17991906 };
18001907
@@ -1813,6 +1920,14 @@ enum ec_led_id { · 12 unmodified lines
18131920 EC_LED_ID_POWER_LED,
18141921 /* LED on power adapter or its plug */
18151922 EC_LED_ID_ADAPTER_LED,
1923+ /* LED to indicate left side */
1924+ EC_LED_ID_LEFT_LED,
1925+ /* LED to indicate right side */
1926+ EC_LED_ID_RIGHT_LED,
1927+ /* LED to indicate recovery mode with HW_REINIT */
1928+ EC_LED_ID_RECOVERY_HW_REINIT_LED,
1929+ /* LED to indicate sysrq debug mode. */
1930+ EC_LED_ID_SYSRQ_DEBUG_LED,
18161931
18171932 EC_LED_ID_COUNT
18181933 };
@@ -1827,6 +1942,7 @@ enum ec_led_colors { · 8 unmodified lines
18271942 EC_LED_COLOR_BLUE,
18281943 EC_LED_COLOR_YELLOW,
18291944 EC_LED_COLOR_WHITE,
1945+ EC_LED_COLOR_AMBER,
18301946
18311947 EC_LED_COLOR_COUNT
18321948 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t