diff options
author | Yu-Hsuan Hsu <yuhsuan@google.com> | 2020-07-07 13:16:45 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-08 01:22:46 +0000 |
commit | bf700a37fa98fd6ed690ca75a3361313e07320ec (patch) | |
tree | 3d16cdd02f7c5561a1ae5c15eef8812fa5c2f846 /common/audio_codec_i2s_rx.c | |
parent | 6a1717f93421baa603179fba5037055699c4fbb0 (diff) | |
download | chrome-ec-bf700a37fa98fd6ed690ca75a3361313e07320ec.tar.gz |
audio_codec: add the command to reset I2S RX
Adds EC_CODEC_I2S_RX_RESET to reset I2S RX because it is not sure that
the I2S RX is always disabled when the kernel booting. For example, it
will keep enabled if the kernel crashes while cros_ec_codec is used.
BRANCH=none
BUG=b:158316196
TEST=Able to reset I2S RX from the kernel.
Change-Id: I461e5a3c73a4066a9ceb097fc5320aef98d81db4
Signed-off-by: Yu-Hsuan Hsu <yuhsuan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2284503
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@chromium.org>
Tested-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Commit-Queue: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'common/audio_codec_i2s_rx.c')
-rw-r--r-- | common/audio_codec_i2s_rx.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/common/audio_codec_i2s_rx.c b/common/audio_codec_i2s_rx.c index 700fc41024..aeae19bdca 100644 --- a/common/audio_codec_i2s_rx.c +++ b/common/audio_codec_i2s_rx.c @@ -84,12 +84,23 @@ static enum ec_status i2s_rx_set_bclk(struct host_cmd_handler_args *args) return EC_RES_SUCCESS; } +static enum ec_status i2s_rx_reset(struct host_cmd_handler_args *args) +{ + if (audio_codec_i2s_rx_disable() != EC_SUCCESS) + return EC_RES_ERROR; + + i2s_rx_enabled = 0; + + return EC_RES_SUCCESS; +} + static enum ec_status (*sub_cmds[])(struct host_cmd_handler_args *) = { [EC_CODEC_I2S_RX_ENABLE] = i2s_rx_enable, [EC_CODEC_I2S_RX_DISABLE] = i2s_rx_disable, [EC_CODEC_I2S_RX_SET_SAMPLE_DEPTH] = i2s_rx_set_sample_depth, [EC_CODEC_I2S_RX_SET_DAIFMT] = i2s_rx_set_daifmt, [EC_CODEC_I2S_RX_SET_BCLK] = i2s_rx_set_bclk, + [EC_CODEC_I2S_RX_RESET] = i2s_rx_reset, }; #ifdef DEBUG_AUDIO_CODEC @@ -99,6 +110,7 @@ static char *strcmd[] = { [EC_CODEC_I2S_RX_SET_SAMPLE_DEPTH] = "EC_CODEC_I2S_RX_SET_SAMPLE_DEPTH", [EC_CODEC_I2S_RX_SET_DAIFMT] = "EC_CODEC_I2S_RX_SET_DAIFMT", [EC_CODEC_I2S_RX_SET_BCLK] = "EC_CODEC_I2S_RX_SET_BCLK", + [EC_CODEC_I2S_RX_RESET] = "EC_CODEC_I2S_RESET", }; BUILD_ASSERT(ARRAY_SIZE(sub_cmds) == ARRAY_SIZE(strcmd)); #endif |