xref: /linux/sound/soc/codecs/sta350.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
12874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
22439ea1fSSven Brandau /*
32439ea1fSSven Brandau  * Codec driver for ST STA350 2.1-channel high-efficiency digital audio system
42439ea1fSSven Brandau  *
52439ea1fSSven Brandau  * Copyright: 2011 Raumfeld GmbH
62439ea1fSSven Brandau  * Author: Sven Brandau <info@brandau.biz>
72439ea1fSSven Brandau  *
82439ea1fSSven Brandau  * based on code from:
92439ea1fSSven Brandau  *      Raumfeld GmbH
102439ea1fSSven Brandau  *        Johannes Stezenbach <js@sig21.net>
112439ea1fSSven Brandau  *	Wolfson Microelectronics PLC.
122439ea1fSSven Brandau  *	  Mark Brown <broonie@opensource.wolfsonmicro.com>
132439ea1fSSven Brandau  */
142439ea1fSSven Brandau #ifndef _ASOC_STA_350_H
152439ea1fSSven Brandau #define _ASOC_STA_350_H
162439ea1fSSven Brandau 
17*d13a8f6dSChristophe JAILLET /* STA350 register addresses */
182439ea1fSSven Brandau 
192439ea1fSSven Brandau #define STA350_REGISTER_COUNT	0x4D
202439ea1fSSven Brandau #define STA350_COEF_COUNT 62
212439ea1fSSven Brandau 
222439ea1fSSven Brandau #define STA350_CONFA	0x00
232439ea1fSSven Brandau #define STA350_CONFB    0x01
242439ea1fSSven Brandau #define STA350_CONFC    0x02
252439ea1fSSven Brandau #define STA350_CONFD    0x03
262439ea1fSSven Brandau #define STA350_CONFE    0x04
272439ea1fSSven Brandau #define STA350_CONFF    0x05
282439ea1fSSven Brandau #define STA350_MMUTE    0x06
292439ea1fSSven Brandau #define STA350_MVOL     0x07
302439ea1fSSven Brandau #define STA350_C1VOL    0x08
312439ea1fSSven Brandau #define STA350_C2VOL    0x09
322439ea1fSSven Brandau #define STA350_C3VOL    0x0a
332439ea1fSSven Brandau #define STA350_AUTO1    0x0b
342439ea1fSSven Brandau #define STA350_AUTO2    0x0c
352439ea1fSSven Brandau #define STA350_AUTO3    0x0d
362439ea1fSSven Brandau #define STA350_C1CFG    0x0e
372439ea1fSSven Brandau #define STA350_C2CFG    0x0f
382439ea1fSSven Brandau #define STA350_C3CFG    0x10
392439ea1fSSven Brandau #define STA350_TONE     0x11
402439ea1fSSven Brandau #define STA350_L1AR     0x12
412439ea1fSSven Brandau #define STA350_L1ATRT   0x13
422439ea1fSSven Brandau #define STA350_L2AR     0x14
432439ea1fSSven Brandau #define STA350_L2ATRT   0x15
442439ea1fSSven Brandau #define STA350_CFADDR2  0x16
452439ea1fSSven Brandau #define STA350_B1CF1    0x17
462439ea1fSSven Brandau #define STA350_B1CF2    0x18
472439ea1fSSven Brandau #define STA350_B1CF3    0x19
482439ea1fSSven Brandau #define STA350_B2CF1    0x1a
492439ea1fSSven Brandau #define STA350_B2CF2    0x1b
502439ea1fSSven Brandau #define STA350_B2CF3    0x1c
512439ea1fSSven Brandau #define STA350_A1CF1    0x1d
522439ea1fSSven Brandau #define STA350_A1CF2    0x1e
532439ea1fSSven Brandau #define STA350_A1CF3    0x1f
542439ea1fSSven Brandau #define STA350_A2CF1    0x20
552439ea1fSSven Brandau #define STA350_A2CF2    0x21
562439ea1fSSven Brandau #define STA350_A2CF3    0x22
572439ea1fSSven Brandau #define STA350_B0CF1    0x23
582439ea1fSSven Brandau #define STA350_B0CF2    0x24
592439ea1fSSven Brandau #define STA350_B0CF3    0x25
602439ea1fSSven Brandau #define STA350_CFUD     0x26
612439ea1fSSven Brandau #define STA350_MPCC1    0x27
622439ea1fSSven Brandau #define STA350_MPCC2    0x28
632439ea1fSSven Brandau #define STA350_DCC1     0x29
642439ea1fSSven Brandau #define STA350_DCC2     0x2a
652439ea1fSSven Brandau #define STA350_FDRC1    0x2b
662439ea1fSSven Brandau #define STA350_FDRC2    0x2c
672439ea1fSSven Brandau #define STA350_STATUS   0x2d
682439ea1fSSven Brandau /* reserved: 0x2d - 0x30 */
692439ea1fSSven Brandau #define STA350_EQCFG    0x31
702439ea1fSSven Brandau #define STA350_EATH1    0x32
712439ea1fSSven Brandau #define STA350_ERTH1    0x33
722439ea1fSSven Brandau #define STA350_EATH2    0x34
732439ea1fSSven Brandau #define STA350_ERTH2    0x35
742439ea1fSSven Brandau #define STA350_CONFX    0x36
752439ea1fSSven Brandau #define STA350_SVCA     0x37
762439ea1fSSven Brandau #define STA350_SVCB     0x38
772439ea1fSSven Brandau #define STA350_RMS0A    0x39
782439ea1fSSven Brandau #define STA350_RMS0B    0x3a
792439ea1fSSven Brandau #define STA350_RMS0C    0x3b
802439ea1fSSven Brandau #define STA350_RMS1A    0x3c
812439ea1fSSven Brandau #define STA350_RMS1B    0x3d
822439ea1fSSven Brandau #define STA350_RMS1C    0x3e
832439ea1fSSven Brandau #define STA350_EVOLRES  0x3f
842439ea1fSSven Brandau /* reserved: 0x40 - 0x47 */
852439ea1fSSven Brandau #define STA350_NSHAPE   0x48
862439ea1fSSven Brandau #define STA350_CTXB4B1  0x49
872439ea1fSSven Brandau #define STA350_CTXB7B5  0x4a
882439ea1fSSven Brandau #define STA350_MISC1    0x4b
892439ea1fSSven Brandau #define STA350_MISC2    0x4c
902439ea1fSSven Brandau 
912439ea1fSSven Brandau /* 0x00 CONFA */
922439ea1fSSven Brandau #define STA350_CONFA_MCS_MASK	0x03
932439ea1fSSven Brandau #define STA350_CONFA_MCS_SHIFT	0
942439ea1fSSven Brandau #define STA350_CONFA_IR_MASK	0x18
952439ea1fSSven Brandau #define STA350_CONFA_IR_SHIFT	3
962439ea1fSSven Brandau #define STA350_CONFA_TWRB	BIT(5)
972439ea1fSSven Brandau #define STA350_CONFA_TWAB	BIT(6)
982439ea1fSSven Brandau #define STA350_CONFA_FDRB	BIT(7)
992439ea1fSSven Brandau 
1002439ea1fSSven Brandau /* 0x01 CONFB */
1012439ea1fSSven Brandau #define STA350_CONFB_SAI_MASK	0x0f
1022439ea1fSSven Brandau #define STA350_CONFB_SAI_SHIFT	0
1032439ea1fSSven Brandau #define STA350_CONFB_SAIFB	BIT(4)
1042439ea1fSSven Brandau #define STA350_CONFB_DSCKE	BIT(5)
1052439ea1fSSven Brandau #define STA350_CONFB_C1IM	BIT(6)
1062439ea1fSSven Brandau #define STA350_CONFB_C2IM	BIT(7)
1072439ea1fSSven Brandau 
1082439ea1fSSven Brandau /* 0x02 CONFC */
1092439ea1fSSven Brandau #define STA350_CONFC_OM_MASK	0x03
1102439ea1fSSven Brandau #define STA350_CONFC_OM_SHIFT	0
1112439ea1fSSven Brandau #define STA350_CONFC_CSZ_MASK	0x3c
1122439ea1fSSven Brandau #define STA350_CONFC_CSZ_SHIFT	2
1132439ea1fSSven Brandau #define STA350_CONFC_OCRB	BIT(7)
1142439ea1fSSven Brandau 
1152439ea1fSSven Brandau /* 0x03 CONFD */
1162439ea1fSSven Brandau #define STA350_CONFD_HPB_SHIFT	0
1172439ea1fSSven Brandau #define STA350_CONFD_DEMP_SHIFT	1
1182439ea1fSSven Brandau #define STA350_CONFD_DSPB_SHIFT	2
1192439ea1fSSven Brandau #define STA350_CONFD_PSL_SHIFT	3
1202439ea1fSSven Brandau #define STA350_CONFD_BQL_SHIFT	4
1212439ea1fSSven Brandau #define STA350_CONFD_DRC_SHIFT	5
1222439ea1fSSven Brandau #define STA350_CONFD_ZDE_SHIFT	6
1232439ea1fSSven Brandau #define STA350_CONFD_SME_SHIFT	7
1242439ea1fSSven Brandau 
1252439ea1fSSven Brandau /* 0x04 CONFE */
1262439ea1fSSven Brandau #define STA350_CONFE_MPCV	BIT(0)
1272439ea1fSSven Brandau #define STA350_CONFE_MPCV_SHIFT	0
1282439ea1fSSven Brandau #define STA350_CONFE_MPC	BIT(1)
1292439ea1fSSven Brandau #define STA350_CONFE_MPC_SHIFT	1
1302439ea1fSSven Brandau #define STA350_CONFE_NSBW	BIT(2)
1312439ea1fSSven Brandau #define STA350_CONFE_NSBW_SHIFT	2
1322439ea1fSSven Brandau #define STA350_CONFE_AME	BIT(3)
1332439ea1fSSven Brandau #define STA350_CONFE_AME_SHIFT	3
1342439ea1fSSven Brandau #define STA350_CONFE_PWMS	BIT(4)
1352439ea1fSSven Brandau #define STA350_CONFE_PWMS_SHIFT	4
1362439ea1fSSven Brandau #define STA350_CONFE_DCCV	BIT(5)
1372439ea1fSSven Brandau #define STA350_CONFE_DCCV_SHIFT	5
1382439ea1fSSven Brandau #define STA350_CONFE_ZCE	BIT(6)
1392439ea1fSSven Brandau #define STA350_CONFE_ZCE_SHIFT	6
1402439ea1fSSven Brandau #define STA350_CONFE_SVE	BIT(7)
1412439ea1fSSven Brandau #define STA350_CONFE_SVE_SHIFT	7
1422439ea1fSSven Brandau 
1432439ea1fSSven Brandau /* 0x05 CONFF */
1442439ea1fSSven Brandau #define STA350_CONFF_OCFG_MASK	0x03
1452439ea1fSSven Brandau #define STA350_CONFF_OCFG_SHIFT	0
1462439ea1fSSven Brandau #define STA350_CONFF_IDE	BIT(2)
1472439ea1fSSven Brandau #define STA350_CONFF_BCLE	BIT(3)
1482439ea1fSSven Brandau #define STA350_CONFF_LDTE	BIT(4)
1492439ea1fSSven Brandau #define STA350_CONFF_ECLE	BIT(5)
1502439ea1fSSven Brandau #define STA350_CONFF_PWDN	BIT(6)
1512439ea1fSSven Brandau #define STA350_CONFF_EAPD	BIT(7)
1522439ea1fSSven Brandau 
1532439ea1fSSven Brandau /* 0x06 MMUTE */
1542439ea1fSSven Brandau #define STA350_MMUTE_MMUTE		0x01
1552439ea1fSSven Brandau #define STA350_MMUTE_MMUTE_SHIFT	0
1562439ea1fSSven Brandau #define STA350_MMUTE_C1M		0x02
1572439ea1fSSven Brandau #define STA350_MMUTE_C1M_SHIFT		1
1582439ea1fSSven Brandau #define STA350_MMUTE_C2M		0x04
1592439ea1fSSven Brandau #define STA350_MMUTE_C2M_SHIFT		2
1602439ea1fSSven Brandau #define STA350_MMUTE_C3M		0x08
1612439ea1fSSven Brandau #define STA350_MMUTE_C3M_SHIFT		3
1622439ea1fSSven Brandau #define STA350_MMUTE_LOC_MASK		0xC0
1632439ea1fSSven Brandau #define STA350_MMUTE_LOC_SHIFT		6
1642439ea1fSSven Brandau 
1652439ea1fSSven Brandau /* 0x0b AUTO1 */
1662439ea1fSSven Brandau #define STA350_AUTO1_AMGC_MASK	0x30
1672439ea1fSSven Brandau #define STA350_AUTO1_AMGC_SHIFT	4
1682439ea1fSSven Brandau 
1692439ea1fSSven Brandau /* 0x0c AUTO2 */
1702439ea1fSSven Brandau #define STA350_AUTO2_AMAME	0x01
1712439ea1fSSven Brandau #define STA350_AUTO2_AMAM_MASK	0x0e
1722439ea1fSSven Brandau #define STA350_AUTO2_AMAM_SHIFT	1
1732439ea1fSSven Brandau #define STA350_AUTO2_XO_MASK	0xf0
1742439ea1fSSven Brandau #define STA350_AUTO2_XO_SHIFT	4
1752439ea1fSSven Brandau 
1762439ea1fSSven Brandau /* 0x0d AUTO3 */
1772439ea1fSSven Brandau #define STA350_AUTO3_PEQ_MASK	0x1f
1782439ea1fSSven Brandau #define STA350_AUTO3_PEQ_SHIFT	0
1792439ea1fSSven Brandau 
1802439ea1fSSven Brandau /* 0x0e 0x0f 0x10 CxCFG */
1812439ea1fSSven Brandau #define STA350_CxCFG_TCB_SHIFT	0
1822439ea1fSSven Brandau #define STA350_CxCFG_EQBP_SHIFT	1
1832439ea1fSSven Brandau #define STA350_CxCFG_VBP_SHIFT	2
1842439ea1fSSven Brandau #define STA350_CxCFG_BO_SHIFT	3
1852439ea1fSSven Brandau #define STA350_CxCFG_LS_SHIFT	4
1862439ea1fSSven Brandau #define STA350_CxCFG_OM_MASK	0xc0
1872439ea1fSSven Brandau #define STA350_CxCFG_OM_SHIFT	6
1882439ea1fSSven Brandau 
1892439ea1fSSven Brandau /* 0x11 TONE */
1902439ea1fSSven Brandau #define STA350_TONE_BTC_SHIFT	0
1912439ea1fSSven Brandau #define STA350_TONE_TTC_SHIFT	4
1922439ea1fSSven Brandau 
1932439ea1fSSven Brandau /* 0x12 0x13 0x14 0x15 limiter attack/release */
1942439ea1fSSven Brandau #define STA350_LxA_SHIFT	0
1952439ea1fSSven Brandau #define STA350_LxR_SHIFT	4
1962439ea1fSSven Brandau 
1972439ea1fSSven Brandau /* 0x26 CFUD */
1982439ea1fSSven Brandau #define STA350_CFUD_W1		0x01
1992439ea1fSSven Brandau #define STA350_CFUD_WA		0x02
2002439ea1fSSven Brandau #define STA350_CFUD_R1		0x04
2012439ea1fSSven Brandau #define STA350_CFUD_RA		0x08
2022439ea1fSSven Brandau 
2032439ea1fSSven Brandau 
2042439ea1fSSven Brandau /* biquad filter coefficient table offsets */
2052439ea1fSSven Brandau #define STA350_C1_BQ_BASE	0
2062439ea1fSSven Brandau #define STA350_C2_BQ_BASE	20
2072439ea1fSSven Brandau #define STA350_CH_BQ_NUM	4
2082439ea1fSSven Brandau #define STA350_BQ_NUM_COEF	5
2092439ea1fSSven Brandau #define STA350_XO_HP_BQ_BASE	40
2102439ea1fSSven Brandau #define STA350_XO_LP_BQ_BASE	45
2112439ea1fSSven Brandau #define STA350_C1_PRESCALE	50
2122439ea1fSSven Brandau #define STA350_C2_PRESCALE	51
2132439ea1fSSven Brandau #define STA350_C1_POSTSCALE	52
2142439ea1fSSven Brandau #define STA350_C2_POSTSCALE	53
2152439ea1fSSven Brandau #define STA350_C3_POSTSCALE	54
2162439ea1fSSven Brandau #define STA350_TW_POSTSCALE	55
2172439ea1fSSven Brandau #define STA350_C1_MIX1		56
2182439ea1fSSven Brandau #define STA350_C1_MIX2		57
2192439ea1fSSven Brandau #define STA350_C2_MIX1		58
2202439ea1fSSven Brandau #define STA350_C2_MIX2		59
2212439ea1fSSven Brandau #define STA350_C3_MIX1		60
2222439ea1fSSven Brandau #define STA350_C3_MIX2		61
2232439ea1fSSven Brandau 
2247c2fccccSDaniel Mack /* miscellaneous register 1 */
2257c2fccccSDaniel Mack #define STA350_MISC1_CPWMEN	BIT(2)
2267c2fccccSDaniel Mack #define STA350_MISC1_BRIDGOFF	BIT(5)
2277c2fccccSDaniel Mack #define STA350_MISC1_NSHHPEN	BIT(6)
2287c2fccccSDaniel Mack #define STA350_MISC1_RPDNEN	BIT(7)
2297c2fccccSDaniel Mack 
2307c2fccccSDaniel Mack /* miscellaneous register 2 */
2317c2fccccSDaniel Mack #define STA350_MISC2_PNDLSL_MASK	0x1c
2327c2fccccSDaniel Mack #define STA350_MISC2_PNDLSL_SHIFT	2
2337c2fccccSDaniel Mack 
2342439ea1fSSven Brandau #endif /* _ASOC_STA_350_H */
235