linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gwendal Grignou <gwendal@chromium.org>
To: enric.balletbo@collabora.com, bleung@chromium.org,
	groeck@chromium.org, lee.jones@linaro.org, jic23@kernel.org,
	broonie@kernel.org, cychiang@chromium.org, tiwai@suse.com
Cc: linux-iio@vger.kernel.org, alsa-devel@alsa-project.org,
	Gwendal Grignou <gwendal@chromium.org>
Subject: [PATCH v2 12/30] mfd: cros_ec: Add lightbar v2 API
Date: Fri,  3 May 2019 15:02:15 -0700	[thread overview]
Message-ID: <20190503220233.64546-13-gwendal@chromium.org> (raw)
In-Reply-To: <20190503220233.64546-1-gwendal@chromium.org>

New API split commands, improve EC command latency.

Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
 include/linux/mfd/cros_ec_commands.h | 124 ++++++++++++++++++++++++++-
 1 file changed, 120 insertions(+), 4 deletions(-)

diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 5747bbcfa45f..d55f155eb735 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -1628,7 +1628,10 @@ struct lightbar_params_v1 {
 	int32_t s3_sleep_for;
 	int32_t s3_ramp_up;
 	int32_t s3_ramp_down;
+	int32_t s5_ramp_up;
+	int32_t s5_ramp_down;
 	int32_t tap_tick_delay;
+	int32_t tap_gate_delay;
 	int32_t tap_display_time;
 
 	/* Tap-for-battery params */
@@ -1656,11 +1659,82 @@ struct lightbar_params_v1 {
 	uint8_t s0_idx[2][LB_BATTERY_LEVELS];	/* AP is running */
 	uint8_t s3_idx[2][LB_BATTERY_LEVELS];	/* AP is sleeping */
 
+	/* s5: single color pulse on inhibited power-up */
+	uint8_t s5_idx;
+
 	/* Color palette */
 	struct rgb_s color[8];			/* 0-3 are Google colors */
 } __ec_todo_packed;
 
-/* Lightbar program */
+/* Lightbar command params v2
+ * crbug.com/467716
+ *
+ * lightbar_parms_v1 was too big for i2c, therefore in v2, we split them up by
+ * logical groups to make it more manageable ( < 120 bytes).
+ *
+ * NOTE: Each of these groups must be less than 120 bytes.
+ */
+
+struct lightbar_params_v2_timing {
+	/* Timing */
+	int32_t google_ramp_up;
+	int32_t google_ramp_down;
+	int32_t s3s0_ramp_up;
+	int32_t s0_tick_delay[2];		/* AC=0/1 */
+	int32_t s0a_tick_delay[2];		/* AC=0/1 */
+	int32_t s0s3_ramp_down;
+	int32_t s3_sleep_for;
+	int32_t s3_ramp_up;
+	int32_t s3_ramp_down;
+	int32_t s5_ramp_up;
+	int32_t s5_ramp_down;
+	int32_t tap_tick_delay;
+	int32_t tap_gate_delay;
+	int32_t tap_display_time;
+} __ec_todo_packed;
+
+struct lightbar_params_v2_tap {
+	/* Tap-for-battery params */
+	uint8_t tap_pct_red;
+	uint8_t tap_pct_green;
+	uint8_t tap_seg_min_on;
+	uint8_t tap_seg_max_on;
+	uint8_t tap_seg_osc;
+	uint8_t tap_idx[3];
+} __ec_todo_packed;
+
+struct lightbar_params_v2_oscillation {
+	/* Oscillation */
+	uint8_t osc_min[2];			/* AC=0/1 */
+	uint8_t osc_max[2];			/* AC=0/1 */
+	uint8_t w_ofs[2];			/* AC=0/1 */
+} __ec_todo_packed;
+
+struct lightbar_params_v2_brightness {
+	/* Brightness limits based on the backlight and AC. */
+	uint8_t bright_bl_off_fixed[2];		/* AC=0/1 */
+	uint8_t bright_bl_on_min[2];		/* AC=0/1 */
+	uint8_t bright_bl_on_max[2];		/* AC=0/1 */
+} __ec_todo_packed;
+
+struct lightbar_params_v2_thresholds {
+	/* Battery level thresholds */
+	uint8_t battery_threshold[LB_BATTERY_LEVELS - 1];
+} __ec_todo_packed;
+
+struct lightbar_params_v2_colors {
+	/* Map [AC][battery_level] to color index */
+	uint8_t s0_idx[2][LB_BATTERY_LEVELS];	/* AP is running */
+	uint8_t s3_idx[2][LB_BATTERY_LEVELS];	/* AP is sleeping */
+
+	/* s5: single color pulse on inhibited power-up */
+	uint8_t s5_idx;
+
+	/* Color palette */
+	struct rgb_s color[8];			/* 0-3 are Google colors */
+} __ec_todo_packed;
+
+/* Lightbar program. */
 #define EC_LB_PROG_LEN 192
 struct lightbar_program {
 	uint8_t size;
@@ -1674,7 +1748,10 @@ struct ec_params_lightbar {
 		 * The following commands have no args:
 		 *
 		 * dump, off, on, init, get_seq, get_params_v0, get_params_v1,
-		 * version, get_brightness, get_demo, suspend, resume
+		 * version, get_brightness, get_demo, suspend, resume,
+		 * get_params_v2_timing, get_params_v2_tap, get_params_v2_osc,
+		 * get_params_v2_bright, get_params_v2_thlds,
+		 * get_params_v2_colors
 		 *
 		 * Don't use an empty struct, because C++ hates that.
 		 */
@@ -1701,6 +1778,14 @@ struct ec_params_lightbar {
 
 		struct lightbar_params_v0 set_params_v0;
 		struct lightbar_params_v1 set_params_v1;
+
+		struct lightbar_params_v2_timing set_v2par_timing;
+		struct lightbar_params_v2_tap set_v2par_tap;
+		struct lightbar_params_v2_oscillation set_v2par_osc;
+		struct lightbar_params_v2_brightness set_v2par_bright;
+		struct lightbar_params_v2_thresholds set_v2par_thlds;
+		struct lightbar_params_v2_colors set_v2par_colors;
+
 		struct lightbar_program set_program;
 	};
 } __ec_todo_packed;
@@ -1722,6 +1807,14 @@ struct ec_response_lightbar {
 		struct lightbar_params_v0 get_params_v0;
 		struct lightbar_params_v1 get_params_v1;
 
+
+		struct lightbar_params_v2_timing get_params_v2_timing;
+		struct lightbar_params_v2_tap get_params_v2_tap;
+		struct lightbar_params_v2_oscillation get_params_v2_osc;
+		struct lightbar_params_v2_brightness get_params_v2_bright;
+		struct lightbar_params_v2_thresholds get_params_v2_thlds;
+		struct lightbar_params_v2_colors get_params_v2_colors;
+
 		struct __ec_todo_unpacked {
 			uint32_t num;
 			uint32_t flags;
@@ -1734,9 +1827,11 @@ struct ec_response_lightbar {
 		/*
 		 * The following commands have no response:
 		 *
-		 * off, on, init, set_brightness, seq, reg, set_rgb,
+		 * off, on, init, set_brightness, seq, reg, set_rgb, demo,
 		 * set_params_v0, set_params_v1, set_program,
-		 * manual_suspend_ctrl, suspend, resume
+		 * manual_suspend_ctrl, suspend, resume, set_v2par_timing,
+		 * set_v2par_tap, set_v2par_osc, set_v2par_bright,
+		 * set_v2par_thlds, set_v2par_colors
 		 */
 	};
 } __ec_todo_packed;
@@ -1765,6 +1860,18 @@ enum lightbar_command {
 	LIGHTBAR_CMD_MANUAL_SUSPEND_CTRL = 19,
 	LIGHTBAR_CMD_SUSPEND = 20,
 	LIGHTBAR_CMD_RESUME = 21,
+	LIGHTBAR_CMD_GET_PARAMS_V2_TIMING = 22,
+	LIGHTBAR_CMD_SET_PARAMS_V2_TIMING = 23,
+	LIGHTBAR_CMD_GET_PARAMS_V2_TAP = 24,
+	LIGHTBAR_CMD_SET_PARAMS_V2_TAP = 25,
+	LIGHTBAR_CMD_GET_PARAMS_V2_OSCILLATION = 26,
+	LIGHTBAR_CMD_SET_PARAMS_V2_OSCILLATION = 27,
+	LIGHTBAR_CMD_GET_PARAMS_V2_BRIGHTNESS = 28,
+	LIGHTBAR_CMD_SET_PARAMS_V2_BRIGHTNESS = 29,
+	LIGHTBAR_CMD_GET_PARAMS_V2_THRESHOLDS = 30,
+	LIGHTBAR_CMD_SET_PARAMS_V2_THRESHOLDS = 31,
+	LIGHTBAR_CMD_GET_PARAMS_V2_COLORS = 32,
+	LIGHTBAR_CMD_SET_PARAMS_V2_COLORS = 33,
 	LIGHTBAR_NUM_CMDS
 };
 
@@ -1783,6 +1890,14 @@ enum ec_led_id {
 	EC_LED_ID_POWER_LED,
 	/* LED on power adapter or its plug */
 	EC_LED_ID_ADAPTER_LED,
+	/* LED to indicate left side */
+	EC_LED_ID_LEFT_LED,
+	/* LED to indicate right side */
+	EC_LED_ID_RIGHT_LED,
+	/* LED to indicate recovery mode with HW_REINIT */
+	EC_LED_ID_RECOVERY_HW_REINIT_LED,
+	/* LED to indicate sysrq debug mode. */
+	EC_LED_ID_SYSRQ_DEBUG_LED,
 
 	EC_LED_ID_COUNT
 };
@@ -1797,6 +1912,7 @@ enum ec_led_colors {
 	EC_LED_COLOR_BLUE,
 	EC_LED_COLOR_YELLOW,
 	EC_LED_COLOR_WHITE,
+	EC_LED_COLOR_AMBER,
 
 	EC_LED_COLOR_COUNT
 };
-- 
2.21.0.1020.gf2820cf01a-goog


  parent reply	other threads:[~2019-05-03 22:03 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 22:02 [PATCH v2 00/30] Update cros_ec_commands.h Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 01/30] mfd: cros_ec: Update license term Gwendal Grignou
2019-05-05 15:46   ` Jonathan Cameron
2019-05-03 22:02 ` [PATCH v2 02/30] mfd: cros_ec: Zero BUILD_ macro Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 03/30] mfd: cros_ec: set comments properly Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 04/30] mfd: cros_ec: add ec_align macros Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 05/30] mfd: cros_ec: Define commands as 4-digit UPPER CASE hex values Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 06/30] mfd: cros_ec: use BIT macro Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 07/30] mfd: cros_ec: Update ACPI interface definition Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 08/30] mfd: cros_ec: move HDMI CEC API definition Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 09/30] mfd: cros_ec: Remove zero-size structs Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 10/30] mfd: cros_ec: Add Flash V2 commands API Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 11/30] mfd: cros_ec: Add PWM_SET_DUTY API Gwendal Grignou
2019-05-03 22:02 ` Gwendal Grignou [this message]
2019-05-03 22:02 ` [PATCH v2 13/30] mfd: cros_ec: Expand hash API Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 14/30] mfd: cros_ec: Add EC transport protocol v4 Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 15/30] mfd: cros_ec: Complete MEMS sensor API Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 16/30] mfd: cros_ec: Fix event processing API Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 17/30] mfd: cros_ec: Add fingerprint API Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 18/30] mfd: cros_ec: Fix temperature API Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 19/30] mfd: cros_ec: Complete Power and USB PD API Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 20/30] mfd: cros_ec: Add API for keyboard testing Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 21/30] mfd: cros_ec: Add Hibernate API Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 22/30] mfd: cros_ec: Add Smart Battery Firmware update API Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 23/30] mfd: cros_ec: Add I2C passthru protection API Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 24/30] mfd: cros_ec: Add API for EC-EC communication Gwendal Grignou
2019-05-08 23:22   ` Benson Leung
2019-05-03 22:02 ` [PATCH v2 25/30] mfd: cros_ec: Add API for Touchpad support Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 26/30] mfd: cros_ec: Add API for Fingerprint support Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 27/30] mfd: cros_ec: Add API for rwsig Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 28/30] mfd: cros_ec: Add SKU ID and Secure storage API Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 29/30] mfd: cros_ec: Add Management API entry points Gwendal Grignou
2019-05-03 22:02 ` [PATCH v2 30/30] mfd: cros_ec: Update I2S API Gwendal Grignou
2019-05-07  9:50   ` Cheng-yi Chiang
2019-05-07  9:44 ` [PATCH v2 00/30] Update cros_ec_commands.h Lee Jones
2019-05-08 23:19   ` Benson Leung
2019-05-09  6:11     ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190503220233.64546-13-gwendal@chromium.org \
    --to=gwendal@chromium.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=bleung@chromium.org \
    --cc=broonie@kernel.org \
    --cc=cychiang@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=jic23@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).