diff options
author | Cheng-Yi Chiang <cychiang@chromium.org> | 2018-12-18 04:06:26 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2019-01-03 03:32:42 -0500 |
commit | c1f3375be60c562e24460d41b75e564c0a429835 (patch) | |
tree | ed2fc1de512d9bf2331092e03956bc98e89121b2 | |
parent | 4bcb83e055033592e8672a8deb7b209eed936e11 (diff) |
mfd: cros_ec: Add commands to control codec
Add EC host commands to control codec on EC.
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r-- | include/linux/mfd/cros_ec_commands.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h index 9a9631f0559e..fc91082d4c35 100644 --- a/include/linux/mfd/cros_ec_commands.h +++ b/include/linux/mfd/cros_ec_commands.h | |||
@@ -2791,6 +2791,100 @@ struct ec_response_battery_vendor_param { | |||
2791 | } __packed; | 2791 | } __packed; |
2792 | 2792 | ||
2793 | /*****************************************************************************/ | 2793 | /*****************************************************************************/ |
2794 | /* Commands for I2S recording on audio codec. */ | ||
2795 | |||
2796 | #define EC_CMD_CODEC_I2S 0x00BC | ||
2797 | |||
2798 | enum ec_codec_i2s_subcmd { | ||
2799 | EC_CODEC_SET_SAMPLE_DEPTH = 0x0, | ||
2800 | EC_CODEC_SET_GAIN = 0x1, | ||
2801 | EC_CODEC_GET_GAIN = 0x2, | ||
2802 | EC_CODEC_I2S_ENABLE = 0x3, | ||
2803 | EC_CODEC_I2S_SET_CONFIG = 0x4, | ||
2804 | EC_CODEC_I2S_SET_TDM_CONFIG = 0x5, | ||
2805 | EC_CODEC_I2S_SET_BCLK = 0x6, | ||
2806 | }; | ||
2807 | |||
2808 | enum ec_sample_depth_value { | ||
2809 | EC_CODEC_SAMPLE_DEPTH_16 = 0, | ||
2810 | EC_CODEC_SAMPLE_DEPTH_24 = 1, | ||
2811 | }; | ||
2812 | |||
2813 | enum ec_i2s_config { | ||
2814 | EC_DAI_FMT_I2S = 0, | ||
2815 | EC_DAI_FMT_RIGHT_J = 1, | ||
2816 | EC_DAI_FMT_LEFT_J = 2, | ||
2817 | EC_DAI_FMT_PCM_A = 3, | ||
2818 | EC_DAI_FMT_PCM_B = 4, | ||
2819 | EC_DAI_FMT_PCM_TDM = 5, | ||
2820 | }; | ||
2821 | |||
2822 | struct ec_param_codec_i2s { | ||
2823 | /* | ||
2824 | * enum ec_codec_i2s_subcmd | ||
2825 | */ | ||
2826 | uint8_t cmd; | ||
2827 | union { | ||
2828 | /* | ||
2829 | * EC_CODEC_SET_SAMPLE_DEPTH | ||
2830 | * Value should be one of ec_sample_depth_value. | ||
2831 | */ | ||
2832 | uint8_t depth; | ||
2833 | |||
2834 | /* | ||
2835 | * EC_CODEC_SET_GAIN | ||
2836 | * Value should be 0~43 for both channels. | ||
2837 | */ | ||
2838 | struct ec_param_codec_i2s_set_gain { | ||
2839 | uint8_t left; | ||
2840 | uint8_t right; | ||
2841 | } __packed gain; | ||
2842 | |||
2843 | /* | ||
2844 | * EC_CODEC_I2S_ENABLE | ||
2845 | * 1 to enable, 0 to disable. | ||
2846 | */ | ||
2847 | uint8_t i2s_enable; | ||
2848 | |||
2849 | /* | ||
2850 | * EC_CODEC_I2S_SET_COFNIG | ||
2851 | * Value should be one of ec_i2s_config. | ||
2852 | */ | ||
2853 | uint8_t i2s_config; | ||
2854 | |||
2855 | /* | ||
2856 | * EC_CODEC_I2S_SET_TDM_CONFIG | ||
2857 | * Value should be one of ec_i2s_config. | ||
2858 | */ | ||
2859 | struct ec_param_codec_i2s_tdm { | ||
2860 | /* | ||
2861 | * 0 to 496 | ||
2862 | */ | ||
2863 | int16_t ch0_delay; | ||
2864 | /* | ||
2865 | * -1 to 496 | ||
2866 | */ | ||
2867 | int16_t ch1_delay; | ||
2868 | uint8_t adjacent_to_ch0; | ||
2869 | uint8_t adjacent_to_ch1; | ||
2870 | } __packed tdm_param; | ||
2871 | |||
2872 | /* | ||
2873 | * EC_CODEC_I2S_SET_BCLK | ||
2874 | */ | ||
2875 | uint32_t bclk; | ||
2876 | }; | ||
2877 | } __packed; | ||
2878 | |||
2879 | /* | ||
2880 | * For subcommand EC_CODEC_GET_GAIN. | ||
2881 | */ | ||
2882 | struct ec_response_codec_gain { | ||
2883 | uint8_t left; | ||
2884 | uint8_t right; | ||
2885 | } __packed; | ||
2886 | |||
2887 | /*****************************************************************************/ | ||
2794 | /* System commands */ | 2888 | /* System commands */ |
2795 | 2889 | ||
2796 | /* | 2890 | /* |