aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2019-06-03 14:34:01 -0400
committerLee Jones <lee.jones@linaro.org>2019-06-10 04:15:08 -0400
commit3aa6be30da899619c44aa654313ba66eb44e7291 (patch)
tree35cf3d9edda31e4427af6f8e27adbe5bfecc685a /include/linux/mfd
parent2f2e6d14866e34b0982460760f770265215f08c5 (diff)
mfd: cros_ec: Update I2S API
Improve I2S API. Rename ec_response_codec_gain into ec_codec_i2s_gain, update caller accordlingly. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Benson Leung <bleung@chromium.org> Reviewed-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'include/linux/mfd')
-rw-r--r--include/linux/mfd/cros_ec_commands.h44
1 files changed, 20 insertions, 24 deletions
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index fc8babce1576..fa397722f17e 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -4471,6 +4471,7 @@ enum mkbp_cec_event {
4471/* Commands for I2S recording on audio codec. */ 4471/* Commands for I2S recording on audio codec. */
4472 4472
4473#define EC_CMD_CODEC_I2S 0x00BC 4473#define EC_CMD_CODEC_I2S 0x00BC
4474#define EC_WOV_I2S_SAMPLE_RATE 48000
4474 4475
4475enum ec_codec_i2s_subcmd { 4476enum ec_codec_i2s_subcmd {
4476 EC_CODEC_SET_SAMPLE_DEPTH = 0x0, 4477 EC_CODEC_SET_SAMPLE_DEPTH = 0x0,
@@ -4480,6 +4481,7 @@ enum ec_codec_i2s_subcmd {
4480 EC_CODEC_I2S_SET_CONFIG = 0x4, 4481 EC_CODEC_I2S_SET_CONFIG = 0x4,
4481 EC_CODEC_I2S_SET_TDM_CONFIG = 0x5, 4482 EC_CODEC_I2S_SET_TDM_CONFIG = 0x5,
4482 EC_CODEC_I2S_SET_BCLK = 0x6, 4483 EC_CODEC_I2S_SET_BCLK = 0x6,
4484 EC_CODEC_I2S_SUBCMD_COUNT = 0x7,
4483}; 4485};
4484 4486
4485enum ec_sample_depth_value { 4487enum ec_sample_depth_value {
@@ -4496,6 +4498,21 @@ enum ec_i2s_config {
4496 EC_DAI_FMT_PCM_TDM = 5, 4498 EC_DAI_FMT_PCM_TDM = 5,
4497}; 4499};
4498 4500
4501/*
4502 * For subcommand EC_CODEC_GET_GAIN.
4503 */
4504struct __ec_align1 ec_codec_i2s_gain {
4505 uint8_t left;
4506 uint8_t right;
4507};
4508
4509struct __ec_todo_unpacked ec_param_codec_i2s_tdm {
4510 int16_t ch0_delay; /* 0 to 496 */
4511 int16_t ch1_delay; /* -1 to 496 */
4512 uint8_t adjacent_to_ch0;
4513 uint8_t adjacent_to_ch1;
4514};
4515
4499struct __ec_todo_packed ec_param_codec_i2s { 4516struct __ec_todo_packed ec_param_codec_i2s {
4500 /* enum ec_codec_i2s_subcmd */ 4517 /* enum ec_codec_i2s_subcmd */
4501 uint8_t cmd; 4518 uint8_t cmd;
@@ -4510,10 +4527,7 @@ struct __ec_todo_packed ec_param_codec_i2s {
4510 * EC_CODEC_SET_GAIN 4527 * EC_CODEC_SET_GAIN
4511 * Value should be 0~43 for both channels. 4528 * Value should be 0~43 for both channels.
4512 */ 4529 */
4513 struct __ec_align1 ec_param_codec_i2s_set_gain { 4530 struct ec_codec_i2s_gain gain;
4514 uint8_t left;
4515 uint8_t right;
4516 } gain;
4517 4531
4518 /* 4532 /*
4519 * EC_CODEC_I2S_ENABLE 4533 * EC_CODEC_I2S_ENABLE
@@ -4522,7 +4536,7 @@ struct __ec_todo_packed ec_param_codec_i2s {
4522 uint8_t i2s_enable; 4536 uint8_t i2s_enable;
4523 4537
4524 /* 4538 /*
4525 * EC_CODEC_I2S_SET_COFNIG 4539 * EC_CODEC_I2S_SET_CONFIG
4526 * Value should be one of ec_i2s_config. 4540 * Value should be one of ec_i2s_config.
4527 */ 4541 */
4528 uint8_t i2s_config; 4542 uint8_t i2s_config;
@@ -4531,18 +4545,7 @@ struct __ec_todo_packed ec_param_codec_i2s {
4531 * EC_CODEC_I2S_SET_TDM_CONFIG 4545 * EC_CODEC_I2S_SET_TDM_CONFIG
4532 * Value should be one of ec_i2s_config. 4546 * Value should be one of ec_i2s_config.
4533 */ 4547 */
4534 struct __ec_todo_unpacked ec_param_codec_i2s_tdm { 4548 struct ec_param_codec_i2s_tdm tdm_param;
4535 /*
4536 * 0 to 496
4537 */
4538 int16_t ch0_delay;
4539 /*
4540 * -1 to 496
4541 */
4542 int16_t ch1_delay;
4543 uint8_t adjacent_to_ch0;
4544 uint8_t adjacent_to_ch1;
4545 } tdm_param;
4546 4549
4547 /* 4550 /*
4548 * EC_CODEC_I2S_SET_BCLK 4551 * EC_CODEC_I2S_SET_BCLK
@@ -4551,13 +4554,6 @@ struct __ec_todo_packed ec_param_codec_i2s {
4551 }; 4554 };
4552}; 4555};
4553 4556
4554/*
4555 * For subcommand EC_CODEC_GET_GAIN.
4556 */
4557struct ec_response_codec_gain {
4558 uint8_t left;
4559 uint8_t right;
4560} __ec_align1;
4561 4557
4562/*****************************************************************************/ 4558/*****************************************************************************/
4563/* System commands */ 4559/* System commands */