diff options
author | Tzung-Bi Shih <tzungbi@chromium.org> | 2019-04-13 20:49:26 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-09-17 14:57:00 +0000 |
commit | 4e9246ab4f7a2c512bd9b9e08860091d91cb3b6f (patch) | |
tree | 2596cc39876a6f383b8c8b1da5ab5a66e36c064c /include/audio_codec.h | |
parent | 6a159855aae92c3d98a4927babb4a8319d644c1e (diff) | |
download | chrome-ec-4e9246ab4f7a2c512bd9b9e08860091d91cb3b6f.tar.gz |
audio_codec: add I2S RX abstract layer
Common I2S RX host commands:
- set_sample_depth
- set_daifmt
- set_bclk
BRANCH=none
BUG=b:122027734, b:123268236
TEST=1. define CONFIG_AUDIO_CODEC in board.h
2. define CONFIG_AUDIO_CODEC_DMIC in board.h
3. define CONFIG_AUDIO_CODEC_DMIC_SOFTWARE_GAIN in board.h
4. define CONFIG_AUDIO_CODEC_DMIC_MAX_SOFTWARE_GAIN in board.h
5. define CONFIG_AUDIO_CODEC_I2S_RX in board.h
6. make BOARD=kukui_scp -j
Change-Id: I9031bad5429f51ab9f911098f38ed7eb0fa59d18
Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1564503
Commit-Queue: Sean Abraham <seanabraham@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'include/audio_codec.h')
-rw-r--r-- | include/audio_codec.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/include/audio_codec.h b/include/audio_codec.h index 29a61ed817..af64deb16d 100644 --- a/include/audio_codec.h +++ b/include/audio_codec.h @@ -115,4 +115,65 @@ int audio_codec_dmic_set_gain_idx(uint8_t channel, uint8_t gain); */ int audio_codec_dmic_get_gain_idx(uint8_t channel, uint8_t *gain); + +/* + * I2S RX abstract layer + */ + +/* + * Enables I2S RX. + * + * Returns: + * EC_SUCCESS if success. + * EC_ERROR_UNKNOWN if internal error. + * EC_ERROR_BUSY if has enabled. + */ +int audio_codec_i2s_rx_enable(void); + +/* + * Disables I2S RX. + * + * Returns: + * EC_SUCCESS if success. + * EC_ERROR_UNKNOWN if internal error. + * EC_ERROR_BUSY if has not enabled. + */ +int audio_codec_i2s_rx_disable(void); + +/* + * Sets I2S RX sample depth. + * + * @depth is an integer from enum ec_codec_i2s_rx_sample_depth. + * + * Returns: + * EC_SUCCESS if success. + * EC_ERROR_UNKNOWN if internal error. + * EC_ERROR_INVAL if depth does not look good. + */ +int audio_codec_i2s_rx_set_sample_depth(uint8_t depth); + +/* + * Sets I2S RX DAI format. + * + * @daifmt is an integer from enum ec_codec_i2s_rx_daifmt. + * + * Returns: + * EC_SUCCESS if success. + * EC_ERROR_UNKNOWN if internal error. + * EC_ERROR_INVAL if daifmt does not look good. + */ +int audio_codec_i2s_rx_set_daifmt(uint8_t daifmt); + +/* + * Sets I2S RX BCLK. + * + * @bclk is an integer to represent the bit clock rate. + * + * Returns: + * EC_SUCCESS if success. + * EC_ERROR_UNKNOWN if internal error. + * EC_ERROR_INVAL if bclk does not look good. + */ +int audio_codec_i2s_rx_set_bclk(uint32_t bclk); + #endif |