[PATCH 24/30] mfd: cros_ec: Update I2S API

From: Gwendal Grignou
Date: Wed Apr 24 2019 - 19:30:26 EST


Improve I2S API.

Signed-off-by: Gwendal Grignou <gwendal@xxxxxxxxxxxx>
---
include/linux/mfd/cros_ec_commands.h | 44 +++++++++++++---------------
1 file changed, 20 insertions(+), 24 deletions(-)

diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 59ad6bae3f9b..c1fe64c0957b 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -4417,6 +4417,7 @@ enum mkbp_cec_event {
/* Commands for I2S recording on audio codec. */

#define EC_CMD_CODEC_I2S 0x00BC
+#define EC_WOV_I2S_SAMPLE_RATE 48000

enum ec_codec_i2s_subcmd {
EC_CODEC_SET_SAMPLE_DEPTH = 0x0,
@@ -4426,6 +4427,7 @@ enum ec_codec_i2s_subcmd {
EC_CODEC_I2S_SET_CONFIG = 0x4,
EC_CODEC_I2S_SET_TDM_CONFIG = 0x5,
EC_CODEC_I2S_SET_BCLK = 0x6,
+ EC_CODEC_I2S_SUBCMD_COUNT = 0x7,
};

enum ec_sample_depth_value {
@@ -4442,6 +4444,21 @@ enum ec_i2s_config {
EC_DAI_FMT_PCM_TDM = 5,
};

+/*
+ * For subcommand EC_CODEC_GET_GAIN.
+ */
+struct __ec_align1 ec_codec_i2s_gain {
+ uint8_t left;
+ uint8_t right;
+};
+
+struct __ec_todo_unpacked ec_param_codec_i2s_tdm {
+ int16_t ch0_delay; /* 0 to 496 */
+ int16_t ch1_delay; /* -1 to 496 */
+ uint8_t adjacent_to_ch0;
+ uint8_t adjacent_to_ch1;
+};
+
struct __ec_todo_packed ec_param_codec_i2s {
/* enum ec_codec_i2s_subcmd */
uint8_t cmd;
@@ -4456,10 +4473,7 @@ struct __ec_todo_packed ec_param_codec_i2s {
* EC_CODEC_SET_GAIN
* Value should be 0~43 for both channels.
*/
- struct __ec_align1 ec_param_codec_i2s_set_gain {
- uint8_t left;
- uint8_t right;
- } gain;
+ struct ec_codec_i2s_gain gain;

/*
* EC_CODEC_I2S_ENABLE
@@ -4468,7 +4482,7 @@ struct __ec_todo_packed ec_param_codec_i2s {
uint8_t i2s_enable;

/*
- * EC_CODEC_I2S_SET_COFNIG
+ * EC_CODEC_I2S_SET_CONFIG
* Value should be one of ec_i2s_config.
*/
uint8_t i2s_config;
@@ -4477,18 +4491,7 @@ struct __ec_todo_packed ec_param_codec_i2s {
* EC_CODEC_I2S_SET_TDM_CONFIG
* Value should be one of ec_i2s_config.
*/
- struct __ec_todo_unpacked ec_param_codec_i2s_tdm {
- /*
- * 0 to 496
- */
- int16_t ch0_delay;
- /*
- * -1 to 496
- */
- int16_t ch1_delay;
- uint8_t adjacent_to_ch0;
- uint8_t adjacent_to_ch1;
- } tdm_param;
+ struct ec_param_codec_i2s_tdm tdm_param;

/*
* EC_CODEC_I2S_SET_BCLK
@@ -4497,13 +4500,6 @@ struct __ec_todo_packed ec_param_codec_i2s {
};
};

-/*
- * For subcommand EC_CODEC_GET_GAIN.
- */
-struct ec_response_codec_gain {
- uint8_t left;
- uint8_t right;
-} __ec_align1;

/*****************************************************************************/
/* System commands */
--
2.21.0.593.g511ec345e18-goog