1 /* SPDX-License-Identifier: GPL-2.0-only */ << 2 /* 1 /* 3 * tas2552.h - ALSA SoC Texas Instruments TAS2 2 * tas2552.h - ALSA SoC Texas Instruments TAS2552 Mono Audio Amplifier 4 * 3 * 5 * Copyright (C) 2014 Texas Instruments Incorp !! 4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com 6 * 5 * 7 * Author: Dan Murphy <dmurphy@ti.com> 6 * Author: Dan Murphy <dmurphy@ti.com> >> 7 * >> 8 * This program is free software; you can redistribute it and/or >> 9 * modify it under the terms of the GNU General Public License >> 10 * version 2 as published by the Free Software Foundation. >> 11 * >> 12 * This program is distributed in the hope that it will be useful, but >> 13 * WITHOUT ANY WARRANTY; without even the implied warranty of >> 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> 15 * General Public License for more details. 8 */ 16 */ 9 17 10 #ifndef __TAS2552_H__ 18 #ifndef __TAS2552_H__ 11 #define __TAS2552_H__ 19 #define __TAS2552_H__ 12 20 13 /* Register Address Map */ 21 /* Register Address Map */ 14 #define TAS2552_DEVICE_STATUS 0x00 22 #define TAS2552_DEVICE_STATUS 0x00 15 #define TAS2552_CFG_1 0x01 23 #define TAS2552_CFG_1 0x01 16 #define TAS2552_CFG_2 0x02 24 #define TAS2552_CFG_2 0x02 17 #define TAS2552_CFG_3 0x03 25 #define TAS2552_CFG_3 0x03 18 #define TAS2552_DOUT 0x04 26 #define TAS2552_DOUT 0x04 19 #define TAS2552_SER_CTRL_1 0x05 27 #define TAS2552_SER_CTRL_1 0x05 20 #define TAS2552_SER_CTRL_2 0x06 28 #define TAS2552_SER_CTRL_2 0x06 21 #define TAS2552_OUTPUT_DATA 0x07 29 #define TAS2552_OUTPUT_DATA 0x07 22 #define TAS2552_PLL_CTRL_1 0x08 30 #define TAS2552_PLL_CTRL_1 0x08 23 #define TAS2552_PLL_CTRL_2 0x09 31 #define TAS2552_PLL_CTRL_2 0x09 24 #define TAS2552_PLL_CTRL_3 0x0a 32 #define TAS2552_PLL_CTRL_3 0x0a 25 #define TAS2552_BTIP 0x0b 33 #define TAS2552_BTIP 0x0b 26 #define TAS2552_BTS_CTRL 0x0c 34 #define TAS2552_BTS_CTRL 0x0c 27 #define TAS2552_RESERVED_0D 0x0d 35 #define TAS2552_RESERVED_0D 0x0d 28 #define TAS2552_LIMIT_RATE_HYS 0x0e 36 #define TAS2552_LIMIT_RATE_HYS 0x0e 29 #define TAS2552_LIMIT_RELEASE 0x0f 37 #define TAS2552_LIMIT_RELEASE 0x0f 30 #define TAS2552_LIMIT_INT_COUNT 0x10 38 #define TAS2552_LIMIT_INT_COUNT 0x10 31 #define TAS2552_PDM_CFG 0x11 39 #define TAS2552_PDM_CFG 0x11 32 #define TAS2552_PGA_GAIN 0x12 40 #define TAS2552_PGA_GAIN 0x12 33 #define TAS2552_EDGE_RATE_CTRL 0x13 41 #define TAS2552_EDGE_RATE_CTRL 0x13 34 #define TAS2552_BOOST_APT_CTRL 0x14 42 #define TAS2552_BOOST_APT_CTRL 0x14 35 #define TAS2552_VER_NUM 0x16 43 #define TAS2552_VER_NUM 0x16 36 #define TAS2552_VBAT_DATA 0x19 44 #define TAS2552_VBAT_DATA 0x19 37 #define TAS2552_MAX_REG TAS255 45 #define TAS2552_MAX_REG TAS2552_VBAT_DATA 38 46 39 /* CFG1 Register Masks */ 47 /* CFG1 Register Masks */ 40 #define TAS2552_DEV_RESET (1 << 48 #define TAS2552_DEV_RESET (1 << 0) 41 #define TAS2552_SWS (1 << 49 #define TAS2552_SWS (1 << 1) 42 #define TAS2552_MUTE (1 << 50 #define TAS2552_MUTE (1 << 2) 43 #define TAS2552_PLL_SRC_MCLK (0x0 < 51 #define TAS2552_PLL_SRC_MCLK (0x0 << 4) 44 #define TAS2552_PLL_SRC_BCLK (0x1 < 52 #define TAS2552_PLL_SRC_BCLK (0x1 << 4) 45 #define TAS2552_PLL_SRC_IVCLKIN (0x2 < 53 #define TAS2552_PLL_SRC_IVCLKIN (0x2 << 4) 46 #define TAS2552_PLL_SRC_1_8_FIXED (0x3 < 54 #define TAS2552_PLL_SRC_1_8_FIXED (0x3 << 4) 47 #define TAS2552_PLL_SRC_MASK TAS255 55 #define TAS2552_PLL_SRC_MASK TAS2552_PLL_SRC_1_8_FIXED 48 56 49 /* CFG2 Register Masks */ 57 /* CFG2 Register Masks */ 50 #define TAS2552_CLASSD_EN (1 << 58 #define TAS2552_CLASSD_EN (1 << 7) 51 #define TAS2552_BOOST_EN (1 << 59 #define TAS2552_BOOST_EN (1 << 6) 52 #define TAS2552_APT_EN (1 << 60 #define TAS2552_APT_EN (1 << 5) 53 #define TAS2552_PLL_ENABLE (1 << 61 #define TAS2552_PLL_ENABLE (1 << 3) 54 #define TAS2552_LIM_EN (1 << 62 #define TAS2552_LIM_EN (1 << 2) 55 #define TAS2552_IVSENSE_EN (1 << 63 #define TAS2552_IVSENSE_EN (1 << 1) 56 64 57 /* CFG3 Register Masks */ 65 /* CFG3 Register Masks */ 58 #define TAS2552_WCLK_FREQ_8KHZ (0x0 < 66 #define TAS2552_WCLK_FREQ_8KHZ (0x0 << 0) 59 #define TAS2552_WCLK_FREQ_11_12KHZ (0x1 < 67 #define TAS2552_WCLK_FREQ_11_12KHZ (0x1 << 0) 60 #define TAS2552_WCLK_FREQ_16KHZ (0x2 < 68 #define TAS2552_WCLK_FREQ_16KHZ (0x2 << 0) 61 #define TAS2552_WCLK_FREQ_22_24KHZ (0x3 < 69 #define TAS2552_WCLK_FREQ_22_24KHZ (0x3 << 0) 62 #define TAS2552_WCLK_FREQ_32KHZ (0x4 < 70 #define TAS2552_WCLK_FREQ_32KHZ (0x4 << 0) 63 #define TAS2552_WCLK_FREQ_44_48KHZ (0x5 < 71 #define TAS2552_WCLK_FREQ_44_48KHZ (0x5 << 0) 64 #define TAS2552_WCLK_FREQ_88_96KHZ (0x6 < 72 #define TAS2552_WCLK_FREQ_88_96KHZ (0x6 << 0) 65 #define TAS2552_WCLK_FREQ_176_192KHZ (0x7 < 73 #define TAS2552_WCLK_FREQ_176_192KHZ (0x7 << 0) 66 #define TAS2552_WCLK_FREQ_MASK TAS255 74 #define TAS2552_WCLK_FREQ_MASK TAS2552_WCLK_FREQ_176_192KHZ 67 #define TAS2552_DIN_SRC_SEL_MUTED (0x0 < 75 #define TAS2552_DIN_SRC_SEL_MUTED (0x0 << 3) 68 #define TAS2552_DIN_SRC_SEL_LEFT (0x1 < 76 #define TAS2552_DIN_SRC_SEL_LEFT (0x1 << 3) 69 #define TAS2552_DIN_SRC_SEL_RIGHT (0x2 < 77 #define TAS2552_DIN_SRC_SEL_RIGHT (0x2 << 3) 70 #define TAS2552_DIN_SRC_SEL_AVG_L_R (0x3 < 78 #define TAS2552_DIN_SRC_SEL_AVG_L_R (0x3 << 3) 71 #define TAS2552_PDM_IN_SEL (1 << 79 #define TAS2552_PDM_IN_SEL (1 << 5) 72 #define TAS2552_I2S_OUT_SEL (1 << 80 #define TAS2552_I2S_OUT_SEL (1 << 6) 73 #define TAS2552_ANALOG_IN_SEL (1 << 81 #define TAS2552_ANALOG_IN_SEL (1 << 7) 74 82 75 /* DOUT Register Masks */ 83 /* DOUT Register Masks */ 76 #define TAS2552_SDOUT_TRISTATE (1 << 84 #define TAS2552_SDOUT_TRISTATE (1 << 2) 77 85 78 /* Serial Interface Control Register Masks */ 86 /* Serial Interface Control Register Masks */ 79 #define TAS2552_WORDLENGTH_16BIT (0x0 < 87 #define TAS2552_WORDLENGTH_16BIT (0x0 << 0) 80 #define TAS2552_WORDLENGTH_20BIT (0x1 < 88 #define TAS2552_WORDLENGTH_20BIT (0x1 << 0) 81 #define TAS2552_WORDLENGTH_24BIT (0x2 < 89 #define TAS2552_WORDLENGTH_24BIT (0x2 << 0) 82 #define TAS2552_WORDLENGTH_32BIT (0x3 < 90 #define TAS2552_WORDLENGTH_32BIT (0x3 << 0) 83 #define TAS2552_WORDLENGTH_MASK TAS255 91 #define TAS2552_WORDLENGTH_MASK TAS2552_WORDLENGTH_32BIT 84 #define TAS2552_DATAFORMAT_I2S (0x0 < 92 #define TAS2552_DATAFORMAT_I2S (0x0 << 2) 85 #define TAS2552_DATAFORMAT_DSP (0x1 < 93 #define TAS2552_DATAFORMAT_DSP (0x1 << 2) 86 #define TAS2552_DATAFORMAT_RIGHT_J (0x2 < 94 #define TAS2552_DATAFORMAT_RIGHT_J (0x2 << 2) 87 #define TAS2552_DATAFORMAT_LEFT_J (0x3 < 95 #define TAS2552_DATAFORMAT_LEFT_J (0x3 << 2) 88 #define TAS2552_DATAFORMAT_MASK TAS255 96 #define TAS2552_DATAFORMAT_MASK TAS2552_DATAFORMAT_LEFT_J 89 #define TAS2552_CLKSPERFRAME_32 (0x0 < 97 #define TAS2552_CLKSPERFRAME_32 (0x0 << 4) 90 #define TAS2552_CLKSPERFRAME_64 (0x1 < 98 #define TAS2552_CLKSPERFRAME_64 (0x1 << 4) 91 #define TAS2552_CLKSPERFRAME_128 (0x2 < 99 #define TAS2552_CLKSPERFRAME_128 (0x2 << 4) 92 #define TAS2552_CLKSPERFRAME_256 (0x3 < 100 #define TAS2552_CLKSPERFRAME_256 (0x3 << 4) 93 #define TAS2552_CLKSPERFRAME_MASK TAS255 101 #define TAS2552_CLKSPERFRAME_MASK TAS2552_CLKSPERFRAME_256 94 #define TAS2552_BCLKDIR (1 << 102 #define TAS2552_BCLKDIR (1 << 6) 95 #define TAS2552_WCLKDIR (1 << 103 #define TAS2552_WCLKDIR (1 << 7) 96 104 97 /* OUTPUT_DATA register */ 105 /* OUTPUT_DATA register */ 98 #define TAS2552_DATA_OUT_I_DATA (0x0) 106 #define TAS2552_DATA_OUT_I_DATA (0x0) 99 #define TAS2552_DATA_OUT_V_DATA (0x1) 107 #define TAS2552_DATA_OUT_V_DATA (0x1) 100 #define TAS2552_DATA_OUT_VBAT_DATA (0x2) 108 #define TAS2552_DATA_OUT_VBAT_DATA (0x2) 101 #define TAS2552_DATA_OUT_VBOOST_DATA (0x3) 109 #define TAS2552_DATA_OUT_VBOOST_DATA (0x3) 102 #define TAS2552_DATA_OUT_PGA_GAIN (0x4) 110 #define TAS2552_DATA_OUT_PGA_GAIN (0x4) 103 #define TAS2552_DATA_OUT_IV_DATA (0x5) 111 #define TAS2552_DATA_OUT_IV_DATA (0x5) 104 #define TAS2552_DATA_OUT_VBAT_VBOOST_GAIN 112 #define TAS2552_DATA_OUT_VBAT_VBOOST_GAIN (0x6) 105 #define TAS2552_DATA_OUT_DISABLED (0x7) 113 #define TAS2552_DATA_OUT_DISABLED (0x7) 106 #define TAS2552_L_DATA_OUT(x) ((x) < 114 #define TAS2552_L_DATA_OUT(x) ((x) << 0) 107 #define TAS2552_R_DATA_OUT(x) ((x) < 115 #define TAS2552_R_DATA_OUT(x) ((x) << 3) 108 #define TAS2552_PDM_DATA_SEL_I (0x0 < 116 #define TAS2552_PDM_DATA_SEL_I (0x0 << 6) 109 #define TAS2552_PDM_DATA_SEL_V (0x1 < 117 #define TAS2552_PDM_DATA_SEL_V (0x1 << 6) 110 #define TAS2552_PDM_DATA_SEL_I_V (0x2 < 118 #define TAS2552_PDM_DATA_SEL_I_V (0x2 << 6) 111 #define TAS2552_PDM_DATA_SEL_V_I (0x3 < 119 #define TAS2552_PDM_DATA_SEL_V_I (0x3 << 6) 112 #define TAS2552_PDM_DATA_SEL_MASK TAS255 120 #define TAS2552_PDM_DATA_SEL_MASK TAS2552_PDM_DATA_SEL_V_I 113 121 114 /* PDM CFG Register */ 122 /* PDM CFG Register */ 115 #define TAS2552_PDM_CLK_SEL_PLL (0x0 < 123 #define TAS2552_PDM_CLK_SEL_PLL (0x0 << 0) 116 #define TAS2552_PDM_CLK_SEL_IVCLKIN (0x1 < 124 #define TAS2552_PDM_CLK_SEL_IVCLKIN (0x1 << 0) 117 #define TAS2552_PDM_CLK_SEL_BCLK (0x2 < 125 #define TAS2552_PDM_CLK_SEL_BCLK (0x2 << 0) 118 #define TAS2552_PDM_CLK_SEL_MCLK (0x3 < 126 #define TAS2552_PDM_CLK_SEL_MCLK (0x3 << 0) 119 #define TAS2552_PDM_CLK_SEL_MASK TAS255 127 #define TAS2552_PDM_CLK_SEL_MASK TAS2552_PDM_CLK_SEL_MCLK 120 #define TAS2552_PDM_DATA_ES (1 << 128 #define TAS2552_PDM_DATA_ES (1 << 2) 121 129 122 /* Boost Auto-pass through register */ 130 /* Boost Auto-pass through register */ 123 #define TAS2552_APT_DELAY_50 (0x0 < 131 #define TAS2552_APT_DELAY_50 (0x0 << 0) 124 #define TAS2552_APT_DELAY_75 (0x1 < 132 #define TAS2552_APT_DELAY_75 (0x1 << 0) 125 #define TAS2552_APT_DELAY_125 (0x2 < 133 #define TAS2552_APT_DELAY_125 (0x2 << 0) 126 #define TAS2552_APT_DELAY_200 (0x3 < 134 #define TAS2552_APT_DELAY_200 (0x3 << 0) 127 #define TAS2552_APT_THRESH_05_02 (0x0 < 135 #define TAS2552_APT_THRESH_05_02 (0x0 << 2) 128 #define TAS2552_APT_THRESH_10_07 (0x1 < 136 #define TAS2552_APT_THRESH_10_07 (0x1 << 2) 129 #define TAS2552_APT_THRESH_14_11 (0x2 < 137 #define TAS2552_APT_THRESH_14_11 (0x2 << 2) 130 #define TAS2552_APT_THRESH_20_17 (0x3 < 138 #define TAS2552_APT_THRESH_20_17 (0x3 << 2) 131 139 132 /* PLL Control Register */ 140 /* PLL Control Register */ 133 #define TAS2552_PLL_J_MASK 0x7f 141 #define TAS2552_PLL_J_MASK 0x7f 134 #define TAS2552_PLL_D_UPPER(x) (((x) 142 #define TAS2552_PLL_D_UPPER(x) (((x) >> 8) & 0x3f) 135 #define TAS2552_PLL_D_LOWER(x) ((x) & 143 #define TAS2552_PLL_D_LOWER(x) ((x) & 0xff) 136 #define TAS2552_PLL_BYPASS (1 << 144 #define TAS2552_PLL_BYPASS (1 << 7) 137 145 138 #endif 146 #endif 139 147
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.