162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Codec driver for ST STA350 2.1-channel high-efficiency digital audio system
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright: 2011 Raumfeld GmbH
662306a36Sopenharmony_ci * Author: Sven Brandau <info@brandau.biz>
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * based on code from:
962306a36Sopenharmony_ci *      Raumfeld GmbH
1062306a36Sopenharmony_ci *        Johannes Stezenbach <js@sig21.net>
1162306a36Sopenharmony_ci *	Wolfson Microelectronics PLC.
1262306a36Sopenharmony_ci *	  Mark Brown <broonie@opensource.wolfsonmicro.com>
1362306a36Sopenharmony_ci */
1462306a36Sopenharmony_ci#ifndef _ASOC_STA_350_H
1562306a36Sopenharmony_ci#define _ASOC_STA_350_H
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/* STA350 register addresses */
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define STA350_REGISTER_COUNT	0x4D
2062306a36Sopenharmony_ci#define STA350_COEF_COUNT 62
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define STA350_CONFA	0x00
2362306a36Sopenharmony_ci#define STA350_CONFB    0x01
2462306a36Sopenharmony_ci#define STA350_CONFC    0x02
2562306a36Sopenharmony_ci#define STA350_CONFD    0x03
2662306a36Sopenharmony_ci#define STA350_CONFE    0x04
2762306a36Sopenharmony_ci#define STA350_CONFF    0x05
2862306a36Sopenharmony_ci#define STA350_MMUTE    0x06
2962306a36Sopenharmony_ci#define STA350_MVOL     0x07
3062306a36Sopenharmony_ci#define STA350_C1VOL    0x08
3162306a36Sopenharmony_ci#define STA350_C2VOL    0x09
3262306a36Sopenharmony_ci#define STA350_C3VOL    0x0a
3362306a36Sopenharmony_ci#define STA350_AUTO1    0x0b
3462306a36Sopenharmony_ci#define STA350_AUTO2    0x0c
3562306a36Sopenharmony_ci#define STA350_AUTO3    0x0d
3662306a36Sopenharmony_ci#define STA350_C1CFG    0x0e
3762306a36Sopenharmony_ci#define STA350_C2CFG    0x0f
3862306a36Sopenharmony_ci#define STA350_C3CFG    0x10
3962306a36Sopenharmony_ci#define STA350_TONE     0x11
4062306a36Sopenharmony_ci#define STA350_L1AR     0x12
4162306a36Sopenharmony_ci#define STA350_L1ATRT   0x13
4262306a36Sopenharmony_ci#define STA350_L2AR     0x14
4362306a36Sopenharmony_ci#define STA350_L2ATRT   0x15
4462306a36Sopenharmony_ci#define STA350_CFADDR2  0x16
4562306a36Sopenharmony_ci#define STA350_B1CF1    0x17
4662306a36Sopenharmony_ci#define STA350_B1CF2    0x18
4762306a36Sopenharmony_ci#define STA350_B1CF3    0x19
4862306a36Sopenharmony_ci#define STA350_B2CF1    0x1a
4962306a36Sopenharmony_ci#define STA350_B2CF2    0x1b
5062306a36Sopenharmony_ci#define STA350_B2CF3    0x1c
5162306a36Sopenharmony_ci#define STA350_A1CF1    0x1d
5262306a36Sopenharmony_ci#define STA350_A1CF2    0x1e
5362306a36Sopenharmony_ci#define STA350_A1CF3    0x1f
5462306a36Sopenharmony_ci#define STA350_A2CF1    0x20
5562306a36Sopenharmony_ci#define STA350_A2CF2    0x21
5662306a36Sopenharmony_ci#define STA350_A2CF3    0x22
5762306a36Sopenharmony_ci#define STA350_B0CF1    0x23
5862306a36Sopenharmony_ci#define STA350_B0CF2    0x24
5962306a36Sopenharmony_ci#define STA350_B0CF3    0x25
6062306a36Sopenharmony_ci#define STA350_CFUD     0x26
6162306a36Sopenharmony_ci#define STA350_MPCC1    0x27
6262306a36Sopenharmony_ci#define STA350_MPCC2    0x28
6362306a36Sopenharmony_ci#define STA350_DCC1     0x29
6462306a36Sopenharmony_ci#define STA350_DCC2     0x2a
6562306a36Sopenharmony_ci#define STA350_FDRC1    0x2b
6662306a36Sopenharmony_ci#define STA350_FDRC2    0x2c
6762306a36Sopenharmony_ci#define STA350_STATUS   0x2d
6862306a36Sopenharmony_ci/* reserved: 0x2d - 0x30 */
6962306a36Sopenharmony_ci#define STA350_EQCFG    0x31
7062306a36Sopenharmony_ci#define STA350_EATH1    0x32
7162306a36Sopenharmony_ci#define STA350_ERTH1    0x33
7262306a36Sopenharmony_ci#define STA350_EATH2    0x34
7362306a36Sopenharmony_ci#define STA350_ERTH2    0x35
7462306a36Sopenharmony_ci#define STA350_CONFX    0x36
7562306a36Sopenharmony_ci#define STA350_SVCA     0x37
7662306a36Sopenharmony_ci#define STA350_SVCB     0x38
7762306a36Sopenharmony_ci#define STA350_RMS0A    0x39
7862306a36Sopenharmony_ci#define STA350_RMS0B    0x3a
7962306a36Sopenharmony_ci#define STA350_RMS0C    0x3b
8062306a36Sopenharmony_ci#define STA350_RMS1A    0x3c
8162306a36Sopenharmony_ci#define STA350_RMS1B    0x3d
8262306a36Sopenharmony_ci#define STA350_RMS1C    0x3e
8362306a36Sopenharmony_ci#define STA350_EVOLRES  0x3f
8462306a36Sopenharmony_ci/* reserved: 0x40 - 0x47 */
8562306a36Sopenharmony_ci#define STA350_NSHAPE   0x48
8662306a36Sopenharmony_ci#define STA350_CTXB4B1  0x49
8762306a36Sopenharmony_ci#define STA350_CTXB7B5  0x4a
8862306a36Sopenharmony_ci#define STA350_MISC1    0x4b
8962306a36Sopenharmony_ci#define STA350_MISC2    0x4c
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci/* 0x00 CONFA */
9262306a36Sopenharmony_ci#define STA350_CONFA_MCS_MASK	0x03
9362306a36Sopenharmony_ci#define STA350_CONFA_MCS_SHIFT	0
9462306a36Sopenharmony_ci#define STA350_CONFA_IR_MASK	0x18
9562306a36Sopenharmony_ci#define STA350_CONFA_IR_SHIFT	3
9662306a36Sopenharmony_ci#define STA350_CONFA_TWRB	BIT(5)
9762306a36Sopenharmony_ci#define STA350_CONFA_TWAB	BIT(6)
9862306a36Sopenharmony_ci#define STA350_CONFA_FDRB	BIT(7)
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci/* 0x01 CONFB */
10162306a36Sopenharmony_ci#define STA350_CONFB_SAI_MASK	0x0f
10262306a36Sopenharmony_ci#define STA350_CONFB_SAI_SHIFT	0
10362306a36Sopenharmony_ci#define STA350_CONFB_SAIFB	BIT(4)
10462306a36Sopenharmony_ci#define STA350_CONFB_DSCKE	BIT(5)
10562306a36Sopenharmony_ci#define STA350_CONFB_C1IM	BIT(6)
10662306a36Sopenharmony_ci#define STA350_CONFB_C2IM	BIT(7)
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci/* 0x02 CONFC */
10962306a36Sopenharmony_ci#define STA350_CONFC_OM_MASK	0x03
11062306a36Sopenharmony_ci#define STA350_CONFC_OM_SHIFT	0
11162306a36Sopenharmony_ci#define STA350_CONFC_CSZ_MASK	0x3c
11262306a36Sopenharmony_ci#define STA350_CONFC_CSZ_SHIFT	2
11362306a36Sopenharmony_ci#define STA350_CONFC_OCRB	BIT(7)
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci/* 0x03 CONFD */
11662306a36Sopenharmony_ci#define STA350_CONFD_HPB_SHIFT	0
11762306a36Sopenharmony_ci#define STA350_CONFD_DEMP_SHIFT	1
11862306a36Sopenharmony_ci#define STA350_CONFD_DSPB_SHIFT	2
11962306a36Sopenharmony_ci#define STA350_CONFD_PSL_SHIFT	3
12062306a36Sopenharmony_ci#define STA350_CONFD_BQL_SHIFT	4
12162306a36Sopenharmony_ci#define STA350_CONFD_DRC_SHIFT	5
12262306a36Sopenharmony_ci#define STA350_CONFD_ZDE_SHIFT	6
12362306a36Sopenharmony_ci#define STA350_CONFD_SME_SHIFT	7
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci/* 0x04 CONFE */
12662306a36Sopenharmony_ci#define STA350_CONFE_MPCV	BIT(0)
12762306a36Sopenharmony_ci#define STA350_CONFE_MPCV_SHIFT	0
12862306a36Sopenharmony_ci#define STA350_CONFE_MPC	BIT(1)
12962306a36Sopenharmony_ci#define STA350_CONFE_MPC_SHIFT	1
13062306a36Sopenharmony_ci#define STA350_CONFE_NSBW	BIT(2)
13162306a36Sopenharmony_ci#define STA350_CONFE_NSBW_SHIFT	2
13262306a36Sopenharmony_ci#define STA350_CONFE_AME	BIT(3)
13362306a36Sopenharmony_ci#define STA350_CONFE_AME_SHIFT	3
13462306a36Sopenharmony_ci#define STA350_CONFE_PWMS	BIT(4)
13562306a36Sopenharmony_ci#define STA350_CONFE_PWMS_SHIFT	4
13662306a36Sopenharmony_ci#define STA350_CONFE_DCCV	BIT(5)
13762306a36Sopenharmony_ci#define STA350_CONFE_DCCV_SHIFT	5
13862306a36Sopenharmony_ci#define STA350_CONFE_ZCE	BIT(6)
13962306a36Sopenharmony_ci#define STA350_CONFE_ZCE_SHIFT	6
14062306a36Sopenharmony_ci#define STA350_CONFE_SVE	BIT(7)
14162306a36Sopenharmony_ci#define STA350_CONFE_SVE_SHIFT	7
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ci/* 0x05 CONFF */
14462306a36Sopenharmony_ci#define STA350_CONFF_OCFG_MASK	0x03
14562306a36Sopenharmony_ci#define STA350_CONFF_OCFG_SHIFT	0
14662306a36Sopenharmony_ci#define STA350_CONFF_IDE	BIT(2)
14762306a36Sopenharmony_ci#define STA350_CONFF_BCLE	BIT(3)
14862306a36Sopenharmony_ci#define STA350_CONFF_LDTE	BIT(4)
14962306a36Sopenharmony_ci#define STA350_CONFF_ECLE	BIT(5)
15062306a36Sopenharmony_ci#define STA350_CONFF_PWDN	BIT(6)
15162306a36Sopenharmony_ci#define STA350_CONFF_EAPD	BIT(7)
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ci/* 0x06 MMUTE */
15462306a36Sopenharmony_ci#define STA350_MMUTE_MMUTE		0x01
15562306a36Sopenharmony_ci#define STA350_MMUTE_MMUTE_SHIFT	0
15662306a36Sopenharmony_ci#define STA350_MMUTE_C1M		0x02
15762306a36Sopenharmony_ci#define STA350_MMUTE_C1M_SHIFT		1
15862306a36Sopenharmony_ci#define STA350_MMUTE_C2M		0x04
15962306a36Sopenharmony_ci#define STA350_MMUTE_C2M_SHIFT		2
16062306a36Sopenharmony_ci#define STA350_MMUTE_C3M		0x08
16162306a36Sopenharmony_ci#define STA350_MMUTE_C3M_SHIFT		3
16262306a36Sopenharmony_ci#define STA350_MMUTE_LOC_MASK		0xC0
16362306a36Sopenharmony_ci#define STA350_MMUTE_LOC_SHIFT		6
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci/* 0x0b AUTO1 */
16662306a36Sopenharmony_ci#define STA350_AUTO1_AMGC_MASK	0x30
16762306a36Sopenharmony_ci#define STA350_AUTO1_AMGC_SHIFT	4
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci/* 0x0c AUTO2 */
17062306a36Sopenharmony_ci#define STA350_AUTO2_AMAME	0x01
17162306a36Sopenharmony_ci#define STA350_AUTO2_AMAM_MASK	0x0e
17262306a36Sopenharmony_ci#define STA350_AUTO2_AMAM_SHIFT	1
17362306a36Sopenharmony_ci#define STA350_AUTO2_XO_MASK	0xf0
17462306a36Sopenharmony_ci#define STA350_AUTO2_XO_SHIFT	4
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ci/* 0x0d AUTO3 */
17762306a36Sopenharmony_ci#define STA350_AUTO3_PEQ_MASK	0x1f
17862306a36Sopenharmony_ci#define STA350_AUTO3_PEQ_SHIFT	0
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci/* 0x0e 0x0f 0x10 CxCFG */
18162306a36Sopenharmony_ci#define STA350_CxCFG_TCB_SHIFT	0
18262306a36Sopenharmony_ci#define STA350_CxCFG_EQBP_SHIFT	1
18362306a36Sopenharmony_ci#define STA350_CxCFG_VBP_SHIFT	2
18462306a36Sopenharmony_ci#define STA350_CxCFG_BO_SHIFT	3
18562306a36Sopenharmony_ci#define STA350_CxCFG_LS_SHIFT	4
18662306a36Sopenharmony_ci#define STA350_CxCFG_OM_MASK	0xc0
18762306a36Sopenharmony_ci#define STA350_CxCFG_OM_SHIFT	6
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci/* 0x11 TONE */
19062306a36Sopenharmony_ci#define STA350_TONE_BTC_SHIFT	0
19162306a36Sopenharmony_ci#define STA350_TONE_TTC_SHIFT	4
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci/* 0x12 0x13 0x14 0x15 limiter attack/release */
19462306a36Sopenharmony_ci#define STA350_LxA_SHIFT	0
19562306a36Sopenharmony_ci#define STA350_LxR_SHIFT	4
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_ci/* 0x26 CFUD */
19862306a36Sopenharmony_ci#define STA350_CFUD_W1		0x01
19962306a36Sopenharmony_ci#define STA350_CFUD_WA		0x02
20062306a36Sopenharmony_ci#define STA350_CFUD_R1		0x04
20162306a36Sopenharmony_ci#define STA350_CFUD_RA		0x08
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci/* biquad filter coefficient table offsets */
20562306a36Sopenharmony_ci#define STA350_C1_BQ_BASE	0
20662306a36Sopenharmony_ci#define STA350_C2_BQ_BASE	20
20762306a36Sopenharmony_ci#define STA350_CH_BQ_NUM	4
20862306a36Sopenharmony_ci#define STA350_BQ_NUM_COEF	5
20962306a36Sopenharmony_ci#define STA350_XO_HP_BQ_BASE	40
21062306a36Sopenharmony_ci#define STA350_XO_LP_BQ_BASE	45
21162306a36Sopenharmony_ci#define STA350_C1_PRESCALE	50
21262306a36Sopenharmony_ci#define STA350_C2_PRESCALE	51
21362306a36Sopenharmony_ci#define STA350_C1_POSTSCALE	52
21462306a36Sopenharmony_ci#define STA350_C2_POSTSCALE	53
21562306a36Sopenharmony_ci#define STA350_C3_POSTSCALE	54
21662306a36Sopenharmony_ci#define STA350_TW_POSTSCALE	55
21762306a36Sopenharmony_ci#define STA350_C1_MIX1		56
21862306a36Sopenharmony_ci#define STA350_C1_MIX2		57
21962306a36Sopenharmony_ci#define STA350_C2_MIX1		58
22062306a36Sopenharmony_ci#define STA350_C2_MIX2		59
22162306a36Sopenharmony_ci#define STA350_C3_MIX1		60
22262306a36Sopenharmony_ci#define STA350_C3_MIX2		61
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ci/* miscellaneous register 1 */
22562306a36Sopenharmony_ci#define STA350_MISC1_CPWMEN	BIT(2)
22662306a36Sopenharmony_ci#define STA350_MISC1_BRIDGOFF	BIT(5)
22762306a36Sopenharmony_ci#define STA350_MISC1_NSHHPEN	BIT(6)
22862306a36Sopenharmony_ci#define STA350_MISC1_RPDNEN	BIT(7)
22962306a36Sopenharmony_ci
23062306a36Sopenharmony_ci/* miscellaneous register 2 */
23162306a36Sopenharmony_ci#define STA350_MISC2_PNDLSL_MASK	0x1c
23262306a36Sopenharmony_ci#define STA350_MISC2_PNDLSL_SHIFT	2
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ci#endif /* _ASOC_STA_350_H */
235