// SPDX-License-Identifier: GPL-2.0 // // ctu.c // // Copyright (c) 2015 Kuninori Morimoto <[email protected]> #include "rsnd.h" #define CTU_NAME_SIZE … #define CTU_NAME … /* * User needs to setup CTU by amixer, and its settings are * based on below registers * * CTUn_CPMDR : amixser set "CTU Pass" * CTUn_SV0xR : amixser set "CTU SV0" * CTUn_SV1xR : amixser set "CTU SV1" * CTUn_SV2xR : amixser set "CTU SV2" * CTUn_SV3xR : amixser set "CTU SV3" * * [CTU Pass] * 0000: default * 0001: Connect input data of channel 0 * 0010: Connect input data of channel 1 * 0011: Connect input data of channel 2 * 0100: Connect input data of channel 3 * 0101: Connect input data of channel 4 * 0110: Connect input data of channel 5 * 0111: Connect input data of channel 6 * 1000: Connect input data of channel 7 * 1001: Connect calculated data by scale values of matrix row 0 * 1010: Connect calculated data by scale values of matrix row 1 * 1011: Connect calculated data by scale values of matrix row 2 * 1100: Connect calculated data by scale values of matrix row 3 * * [CTU SVx] * [Output0] = [SV00, SV01, SV02, SV03, SV04, SV05, SV06, SV07] * [Output1] = [SV10, SV11, SV12, SV13, SV14, SV15, SV16, SV17] * [Output2] = [SV20, SV21, SV22, SV23, SV24, SV25, SV26, SV27] * [Output3] = [SV30, SV31, SV32, SV33, SV34, SV35, SV36, SV37] * [Output4] = [ 0, 0, 0, 0, 0, 0, 0, 0 ] * [Output5] = [ 0, 0, 0, 0, 0, 0, 0, 0 ] * [Output6] = [ 0, 0, 0, 0, 0, 0, 0, 0 ] * [Output7] = [ 0, 0, 0, 0, 0, 0, 0, 0 ] * * [SVxx] * Plus Minus * value time dB value time dB * ----------------------------------------------------------------------- * H'7F_FFFF 2 6 H'80_0000 2 6 * ... * H'40_0000 1 0 H'C0_0000 1 0 * ... * H'00_0001 2.38 x 10^-7 -132 * H'00_0000 0 Mute H'FF_FFFF 2.38 x 10^-7 -132 * * * Ex) Input ch -> Output ch * 1ch -> 0ch * 0ch -> 1ch * * amixer set "CTU Reset" on * amixer set "CTU Pass" 9,10 * amixer set "CTU SV0" 0,4194304 * amixer set "CTU SV1" 4194304,0 * or * amixer set "CTU Reset" on * amixer set "CTU Pass" 2,1 */ struct rsnd_ctu { … }; #define KCTRL_INITIALIZED … #define rsnd_ctu_nr(priv) … #define for_each_rsnd_ctu(pos, priv, i) … #define rsnd_mod_to_ctu(_mod) … #define rsnd_ctu_get(priv, id) … static void rsnd_ctu_activation(struct rsnd_mod *mod) { … } static void rsnd_ctu_halt(struct rsnd_mod *mod) { … } static int rsnd_ctu_probe_(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { … } static void rsnd_ctu_value_init(struct rsnd_dai_stream *io, struct rsnd_mod *mod) { … } static void rsnd_ctu_value_reset(struct rsnd_dai_stream *io, struct rsnd_mod *mod) { … } static int rsnd_ctu_init(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { … } static int rsnd_ctu_quit(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { … } static int rsnd_ctu_pcm_new(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct snd_soc_pcm_runtime *rtd) { … } static int rsnd_ctu_id(struct rsnd_mod *mod) { … } static int rsnd_ctu_id_sub(struct rsnd_mod *mod) { … } #ifdef CONFIG_DEBUG_FS static void rsnd_ctu_debug_info(struct seq_file *m, struct rsnd_dai_stream *io, struct rsnd_mod *mod) { … } #define DEBUG_INFO … #else #define DEBUG_INFO #endif static struct rsnd_mod_ops rsnd_ctu_ops = …; struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id) { … } int rsnd_ctu_probe(struct rsnd_priv *priv) { … } void rsnd_ctu_remove(struct rsnd_priv *priv) { … }