summaryrefslogtreecommitdiff
path: root/common/audio_codec_i2s_rx.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /common/audio_codec_i2s_rx.c
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-252457d4b21f46889eebad61d4c0a65331919cec.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'common/audio_codec_i2s_rx.c')
-rw-r--r--common/audio_codec_i2s_rx.c132
1 files changed, 0 insertions, 132 deletions
diff --git a/common/audio_codec_i2s_rx.c b/common/audio_codec_i2s_rx.c
deleted file mode 100644
index aeae19bdca..0000000000
--- a/common/audio_codec_i2s_rx.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "audio_codec.h"
-#include "console.h"
-#include "host_command.h"
-
-#define CPRINTS(format, args...) cprints(CC_AUDIO_CODEC, format, ## args)
-
-static uint8_t i2s_rx_enabled;
-
-static enum ec_status i2s_rx_enable(struct host_cmd_handler_args *args)
-{
- if (i2s_rx_enabled)
- return EC_RES_BUSY;
-
- if (audio_codec_i2s_rx_enable() != EC_SUCCESS)
- return EC_RES_ERROR;
-
- i2s_rx_enabled = 1;
-
- return EC_RES_SUCCESS;
-}
-
-static enum ec_status i2s_rx_disable(struct host_cmd_handler_args *args)
-{
- if (!i2s_rx_enabled)
- return EC_RES_BUSY;
-
- if (audio_codec_i2s_rx_disable() != EC_SUCCESS)
- return EC_RES_ERROR;
-
- i2s_rx_enabled = 0;
-
- return EC_RES_SUCCESS;
-}
-
-static enum ec_status
-i2s_rx_set_sample_depth(struct host_cmd_handler_args *args)
-{
- const struct ec_param_ec_codec_i2s_rx *p = args->params;
- const uint8_t depth = p->set_sample_depth_param.depth;
-
- if (i2s_rx_enabled)
- return EC_RES_BUSY;
- if (depth >= EC_CODEC_I2S_RX_SAMPLE_DEPTH_COUNT)
- return EC_RES_INVALID_PARAM;
-
- if (audio_codec_i2s_rx_set_sample_depth(depth) != EC_SUCCESS)
- return EC_RES_ERROR;
-
- return EC_RES_SUCCESS;
-}
-
-static enum ec_status i2s_rx_set_daifmt(struct host_cmd_handler_args *args)
-{
- const struct ec_param_ec_codec_i2s_rx *p = args->params;
- const uint8_t daifmt = p->set_daifmt_param.daifmt;
-
- if (i2s_rx_enabled)
- return EC_RES_BUSY;
- if (daifmt >= EC_CODEC_I2S_RX_DAIFMT_COUNT)
- return EC_RES_INVALID_PARAM;
-
- if (audio_codec_i2s_rx_set_daifmt(daifmt) != EC_SUCCESS)
- return EC_RES_ERROR;
-
- return EC_RES_SUCCESS;
-}
-
-static enum ec_status i2s_rx_set_bclk(struct host_cmd_handler_args *args)
-{
- const struct ec_param_ec_codec_i2s_rx *p = args->params;
-
- if (i2s_rx_enabled)
- return EC_RES_BUSY;
-
- if (audio_codec_i2s_rx_set_bclk(p->set_bclk_param.bclk) != EC_SUCCESS)
- return EC_RES_ERROR;
-
- 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
-static char *strcmd[] = {
- [EC_CODEC_I2S_RX_ENABLE] = "EC_CODEC_I2S_RX_ENABLE",
- [EC_CODEC_I2S_RX_DISABLE] = "EC_CODEC_I2S_RX_DISABLE",
- [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
-
-static enum ec_status i2s_rx_host_command(struct host_cmd_handler_args *args)
-{
- const struct ec_param_ec_codec_i2s_rx *p = args->params;
-
-#ifdef DEBUG_AUDIO_CODEC
- CPRINTS("I2S RX subcommand: %s", strcmd[p->cmd]);
-#endif
-
- if (p->cmd < EC_CODEC_I2S_RX_SUBCMD_COUNT)
- return sub_cmds[p->cmd](args);
-
- return EC_RES_INVALID_PARAM;
-}
-DECLARE_HOST_COMMAND(EC_CMD_EC_CODEC_I2S_RX,
- i2s_rx_host_command, EC_VER_MASK(0));