ASoC: cros_ec_codec: extract DMIC EC command from I2S RX

Extract DMIC EC command from I2S RX.  Setting and getting
microphone gains is common features.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Acked-By: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20191014180059.03.I93d9c65964f3c30f85a36d228e31150ff1917706@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Tzung-Bi Shih
2019-10-14 18:20:15 +08:00
committed by Mark Brown
parent 727f1c71c7
commit 8f731d4c92
3 changed files with 68 additions and 39 deletions

View File

@@ -4466,18 +4466,48 @@ enum mkbp_cec_event {
/*****************************************************************************/
/* Commands for DMIC on audio codec. */
#define EC_CMD_EC_CODEC_DMIC 0x00BC
enum ec_codec_dmic_subcmd {
EC_CODEC_DMIC_SET_GAIN = 0x0,
EC_CODEC_DMIC_GET_GAIN = 0x1,
EC_CODEC_DMIC_SUBCMD_COUNT,
};
struct __ec_align1 ec_param_ec_codec_dmic_set_gain {
uint8_t left;
uint8_t right;
uint8_t reserved[2];
};
struct __ec_align4 ec_param_ec_codec_dmic {
uint8_t cmd; /* enum ec_codec_dmic_subcmd */
uint8_t reserved[3];
union {
struct ec_param_ec_codec_dmic_set_gain
set_gain_param;
};
};
struct __ec_align1 ec_response_ec_codec_dmic_get_gain {
uint8_t left;
uint8_t right;
};
/*****************************************************************************/
/* Commands for I2S RX on audio codec. */
#define EC_CMD_EC_CODEC_I2S_RX 0x00BC
#define EC_CMD_EC_CODEC_I2S_RX 0x00BD
enum ec_codec_i2s_rx_subcmd {
EC_CODEC_I2S_RX_ENABLE = 0x0,
EC_CODEC_I2S_RX_DISABLE = 0x1,
EC_CODEC_I2S_RX_SET_GAIN = 0x2,
EC_CODEC_I2S_RX_GET_GAIN = 0x3,
EC_CODEC_I2S_RX_SET_SAMPLE_DEPTH = 0x4,
EC_CODEC_I2S_RX_SET_DAIFMT = 0x5,
EC_CODEC_I2S_RX_SET_BCLK = 0x6,
EC_CODEC_I2S_RX_SET_SAMPLE_DEPTH = 0x2,
EC_CODEC_I2S_RX_SET_DAIFMT = 0x3,
EC_CODEC_I2S_RX_SET_BCLK = 0x4,
EC_CODEC_I2S_RX_SUBCMD_COUNT,
};
@@ -4521,8 +4551,6 @@ struct __ec_align4 ec_param_ec_codec_i2s_rx {
union {
struct ec_param_ec_codec_i2s_rx_set_sample_depth
set_sample_depth_param;
struct ec_param_ec_codec_i2s_rx_set_gain
set_gain_param;
struct ec_param_ec_codec_i2s_rx_set_daifmt
set_daifmt_param;
struct ec_param_ec_codec_i2s_rx_set_bclk
@@ -4530,11 +4558,6 @@ struct __ec_align4 ec_param_ec_codec_i2s_rx {
};
};
struct __ec_align1 ec_response_ec_codec_i2s_rx_get_gain {
uint8_t left;
uint8_t right;
};
/*****************************************************************************/
/* System commands */