blob: b70cb8b9b0122308d6f16a9d56f765bd7514986d [file] [log] [blame]
Googler9398cc32022-12-02 17:21:52 +08001/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
Googler4f18c0c2022-09-20 17:23:36 +08002/*
Googler9398cc32022-12-02 17:21:52 +08003 * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
Googler4f18c0c2022-09-20 17:23:36 +08004 */
5
6#ifndef _TL1_ACODEC_H
7#define _TL1_ACODEC_H
8
9#define DEV_NAME "tl1_acodec"
10
11/* AML TL1 CODEC register space (in decimal to match datasheet) */
12//#define ACODEC_BASE_ADD 0xFF632000
13#define ACODEC_TOP_ADDR(x) (x)
14
Googler4f18c0c2022-09-20 17:23:36 +080015/* AML TL1 CODEC register define */
16#define ACODEC_0 ACODEC_TOP_ADDR(0x00)
17#define ACODEC_1 ACODEC_TOP_ADDR(0x04)
18#define ACODEC_2 ACODEC_TOP_ADDR(0x08)
19#define ACODEC_3 ACODEC_TOP_ADDR(0x0c)
20#define ACODEC_4 ACODEC_TOP_ADDR(0x10)
21#define ACODEC_5 ACODEC_TOP_ADDR(0x14)
22#define ACODEC_6 ACODEC_TOP_ADDR(0x18)
23#define ACODEC_7 ACODEC_TOP_ADDR(0x1C)
24
25/* AML TL1 CODEC register-bitfield define */
26
27// bitfield def of ACODEC_0
28#define MCLK_FREQ 31
29#define I2S_MODE 30
30#define ADC_HPF_EN 29
31#define ADC_HPF_MODE 28
32#define ADC_OVERLOAD_DET_EN 27
33#define ADC_DEM_EN 26
34#define ADC_CLK_TO_GPIO_EN 25
35#define DAC_CLK_TO_GPIO_EN 24
36#define DACL_DATA_SOURCE 23
37#define DACR_DATA_SOURCE 22
38#define DACL_INV 21
39#define DACR_INV 20
40#define ADCDATL_SOURCE 19
41#define ADCDATR_SOURCE 18
42#define ADCL_INV 17
43#define ADCR_INV 16
44#define VMID_GEN_EN 15
45#define VMID_GEN_FAST 14
46#define BIAS_CURRENT_EN 13
47#define REFP_BUF_EN 12
48#define PGAL_IN_EN 11
49#define PGAR_IN_EN 10
50#define PGAL_IN_ZC_EN 9
51#define PGAR_IN_ZC_EN 8
52#define ADCL_EN 7
53#define ADCR_EN 6
54//#define DACL_EN 5
55//#define DACR_EN 4
56#define LO1L_EN 3
57#define LO1R_EN 2
58#define LO2L_EN 1
59#define LO2R_EN 0
60
61// bitfield def of ACODEC_1
62#define REG_DAC_GAIN_SEL_1 31
63#define ADCL_VC 24 /* bit 30-24 */
64#define REG_DAC_GAIN_SEL_0 23
65#define ADCR_VC 16 /* bit 22-16 */
66#define PGAL_IN_SEL 13 /* bit 15-13 */
67#define PGAL_IN_GAIN 8 /* bit 12-8 */
68#define PGAR_IN_SEL 5 /* bit 7-5 */
69#define PGAR_IN_GAIN 0 /* bit 4-0 */
70
71// bitfield def of ACODEC_2
72#define DACL_VC 24 /* bit 31-24 */
73#define DACR_VC 16 /* bit 23-16 */
74#define DAC_SOFT_MUTE 15
75#define DAC_UNMUTE_MODE 14
76#define DAC_MUTE_MODE 13
77#define DAC_VC_RAMP_MODE 12
78#define DAC_RAMP_RATE 10 /* bit 11-10 */
79#define DAC_MONO 8
80#define MUTE_DAC_PD_EN 7
81
82// bitfield def of ACODEC_3
83#define REG_MICBIAS_EN 31
84#define REG_MICBIAS_SEL 29 /* bit 29, 30 */
85//#define REG_ANA_RESERVED 16 /* bit 16 ~ 28 */
86#define LO1L_SEL_DAC1R_INV 14
87#define LO1L_SEL_DAC1L 13
88#define LO1L_SEL_INL 12
89#define LO1R_SEL_DAC1L_INV 10
90#define LO1R_SEL_DAC1R 9
91#define LO1R_SEL_INR 8
92#define LO2L_SEL_DAC2R_INV 6
93#define LO2L_SEL_DAC2L 5
94#define LO2L_SEL_INL 4
95#define LO2R_SEL_DAC2L_INV 2
96#define LO2R_SEL_DAC2R 1
97#define LO2R_SEL_INR 0
98
99// bitfield def of ACODEC_4
100#define MUTE_DAC_WHEN_POWER_DOWN 31
101#define IB_CON 16 /* bit 16, 17 */
102#define REG_ADCL_SAT_SEL 2 /* bit 2, 3 */
103#define REG_ADCR_SAT_SEL 0 /* bit 0, 1 */
104
105// bitfield def of ACODEC_5
106#define DAC2L_VC 24 /* bit 24~31 */
107#define DAC2R_VC 16 /* bit 16~23 */
108#define DAC2L_EN 5
109#define DAC2R_EN 4
110#define DACL_EN 1
111#define DACR_EN 0
112
Googler4f18c0c2022-09-20 17:23:36 +0800113// bitfield def of ACODEC_6
114#define DAC2_SOFT_MUTE 31
115#define DAC2_UNMUTE_MODE 30
116#define DAC2_MUTE_MODE 29
117#define DAC2_VC_RAMP_MODE 28
118#define DAC2_RAMP_RATE 26 /* bit 27-26 */
119#define DAC2_MONO 24
120#define MUTE_DAC2_PD_EN 23
121#define DAC2_CLK_TO_GPIO_EN 8
122#define DAC2L_DATA_SOURCE 7
123#define DAC2R_DATA_SOURCE 6
124#define DAC2L_INV 5
125#define DAC2R_INV 4
126
127// bitfield def of ACODEC_7
128#define DEBUG_BUS_SEL 16 /* bit 16~18 */
129#define REG_DAC2_GAIN_SEL_1 15
130#define REG_DAC2_GAIN_SEL_0 7
131
132#endif /*_TL1_ACODEC_H*/