xref: /linux/sound/soc/codecs/sgtl5000.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
13c1d663bSFabio Estevam /* SPDX-License-Identifier: GPL-2.0 */
29b34e6ccSZeng Zhaoming /*
39b34e6ccSZeng Zhaoming  * sgtl5000.h - SGTL5000 audio codec interface
49b34e6ccSZeng Zhaoming  *
59b34e6ccSZeng Zhaoming  * Copyright 2010-2011 Freescale Semiconductor, Inc.
69b34e6ccSZeng Zhaoming  */
79b34e6ccSZeng Zhaoming 
89b34e6ccSZeng Zhaoming #ifndef _SGTL5000_H
99b34e6ccSZeng Zhaoming #define _SGTL5000_H
109b34e6ccSZeng Zhaoming 
119b34e6ccSZeng Zhaoming /*
12271f193dSFabio Estevam  * Registers addresses
139b34e6ccSZeng Zhaoming  */
149b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ID			0x0000
159b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_DIG_POWER			0x0002
169b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_CLK_CTRL			0x0004
179b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_I2S_CTRL			0x0006
189b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_SSS_CTRL			0x000a
199b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ADCDAC_CTRL		0x000e
209b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_DAC_VOL			0x0010
219b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_PAD_STRENGTH		0x0014
229b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ANA_ADC_CTRL		0x0020
239b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ANA_HP_CTRL		0x0022
249b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ANA_CTRL			0x0024
259b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_LINREG_CTRL		0x0026
269b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_REF_CTRL			0x0028
279b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_MIC_CTRL			0x002a
289b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_LINE_OUT_CTRL		0x002c
299b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_LINE_OUT_VOL		0x002e
309b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ANA_POWER			0x0030
319b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_PLL_CTRL			0x0032
329b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_CLK_TOP_CTRL		0x0034
339b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ANA_STATUS		0x0036
349b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_SHORT_CTRL		0x003c
359b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ANA_TEST2			0x003a
369b34e6ccSZeng Zhaoming #define SGTL5000_DAP_CTRL			0x0100
379b34e6ccSZeng Zhaoming #define SGTL5000_DAP_PEQ			0x0102
389b34e6ccSZeng Zhaoming #define SGTL5000_DAP_BASS_ENHANCE		0x0104
399b34e6ccSZeng Zhaoming #define SGTL5000_DAP_BASS_ENHANCE_CTRL		0x0106
409b34e6ccSZeng Zhaoming #define SGTL5000_DAP_AUDIO_EQ			0x0108
419b34e6ccSZeng Zhaoming #define SGTL5000_DAP_SURROUND			0x010a
429b34e6ccSZeng Zhaoming #define SGTL5000_DAP_FLT_COEF_ACCESS		0x010c
439b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_B0_MSB		0x010e
449b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_B0_LSB		0x0110
459b34e6ccSZeng Zhaoming #define SGTL5000_DAP_EQ_BASS_BAND0		0x0116
469b34e6ccSZeng Zhaoming #define SGTL5000_DAP_EQ_BASS_BAND1		0x0118
479b34e6ccSZeng Zhaoming #define SGTL5000_DAP_EQ_BASS_BAND2		0x011a
489b34e6ccSZeng Zhaoming #define SGTL5000_DAP_EQ_BASS_BAND3		0x011c
499b34e6ccSZeng Zhaoming #define SGTL5000_DAP_EQ_BASS_BAND4		0x011e
509b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MAIN_CHAN			0x0120
519b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_CHAN			0x0122
529b34e6ccSZeng Zhaoming #define SGTL5000_DAP_AVC_CTRL			0x0124
539b34e6ccSZeng Zhaoming #define SGTL5000_DAP_AVC_THRESHOLD		0x0126
549b34e6ccSZeng Zhaoming #define SGTL5000_DAP_AVC_ATTACK			0x0128
559b34e6ccSZeng Zhaoming #define SGTL5000_DAP_AVC_DECAY			0x012a
569b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_B1_MSB		0x012c
579b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_B1_LSB		0x012e
589b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_B2_MSB		0x0130
599b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_B2_LSB		0x0132
609b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_A1_MSB		0x0134
619b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_A1_LSB		0x0136
629b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_A2_MSB		0x0138
639b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_A2_LSB		0x013a
649b34e6ccSZeng Zhaoming 
659b34e6ccSZeng Zhaoming /*
669b34e6ccSZeng Zhaoming  * Field Definitions.
679b34e6ccSZeng Zhaoming  */
689b34e6ccSZeng Zhaoming 
699b34e6ccSZeng Zhaoming /*
709b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ID
719b34e6ccSZeng Zhaoming  */
729b34e6ccSZeng Zhaoming #define SGTL5000_PARTID_MASK			0xff00
739b34e6ccSZeng Zhaoming #define SGTL5000_PARTID_SHIFT			8
749b34e6ccSZeng Zhaoming #define SGTL5000_PARTID_WIDTH			8
759b34e6ccSZeng Zhaoming #define SGTL5000_PARTID_PART_ID			0xa0
769b34e6ccSZeng Zhaoming #define SGTL5000_REVID_MASK			0x00ff
779b34e6ccSZeng Zhaoming #define SGTL5000_REVID_SHIFT			0
789b34e6ccSZeng Zhaoming #define SGTL5000_REVID_WIDTH			8
799b34e6ccSZeng Zhaoming 
809b34e6ccSZeng Zhaoming /*
819b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_DIG_POWER
829b34e6ccSZeng Zhaoming  */
83*040e3360SFrancesco Dolcini #define SGTL5000_DIG_POWER_DEFAULT		0x0000
849b34e6ccSZeng Zhaoming #define SGTL5000_ADC_EN				0x0040
859b34e6ccSZeng Zhaoming #define SGTL5000_DAC_EN				0x0020
869b34e6ccSZeng Zhaoming #define SGTL5000_DAP_POWERUP			0x0010
879b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_POWERUP		0x0002
889b34e6ccSZeng Zhaoming #define SGTL5000_I2S_IN_POWERUP			0x0001
899b34e6ccSZeng Zhaoming 
909b34e6ccSZeng Zhaoming /*
919b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_CLK_CTRL
929b34e6ccSZeng Zhaoming  */
9308dea16eSEric Nelson #define SGTL5000_CHIP_CLK_CTRL_DEFAULT		0x0008
949b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_MASK			0x0030
959b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_SHIFT		4
969b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_WIDTH		2
979b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_DIV_1		0
989b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_DIV_2		1
999b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_DIV_4		2
1009b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_DIV_6		3
1019b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_MASK			0x000c
1029b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_SHIFT			2
1039b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_WIDTH			2
1049b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_32k			0x0
1059b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_44_1k			0x1
1069b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_48k			0x2
1079b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_96k			0x3
1089b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_MASK			0x0003
1099b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_SHIFT		0
1109b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_WIDTH		2
1119b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_256FS		0x0
1129b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_384FS		0x1
1139b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_512FS		0x2
1149b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_PLL			0x3
1159b34e6ccSZeng Zhaoming 
1169b34e6ccSZeng Zhaoming /*
1179b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_I2S_CTRL
1189b34e6ccSZeng Zhaoming  */
1199b34e6ccSZeng Zhaoming #define SGTL5000_I2S_SCLKFREQ_MASK		0x0100
1209b34e6ccSZeng Zhaoming #define SGTL5000_I2S_SCLKFREQ_SHIFT		8
1219b34e6ccSZeng Zhaoming #define SGTL5000_I2S_SCLKFREQ_WIDTH		1
1229b34e6ccSZeng Zhaoming #define SGTL5000_I2S_SCLKFREQ_64FS		0x0
1239b34e6ccSZeng Zhaoming #define SGTL5000_I2S_SCLKFREQ_32FS		0x1	/* Not for RJ mode */
1249b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MASTER			0x0080
1259b34e6ccSZeng Zhaoming #define SGTL5000_I2S_SCLK_INV			0x0040
1269b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_MASK			0x0030
1279b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_SHIFT			4
1289b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_WIDTH			2
1299b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_32			0x0
1309b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_24			0x1
1319b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_20			0x2
1329b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_16			0x3
1339b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MODE_MASK			0x000c
1349b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MODE_SHIFT			2
1359b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MODE_WIDTH			2
1369b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MODE_I2S_LJ		0x0
1379b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MODE_RJ			0x1
1389b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MODE_PCM			0x2
1399b34e6ccSZeng Zhaoming #define SGTL5000_I2S_LRALIGN			0x0002
1409b34e6ccSZeng Zhaoming #define SGTL5000_I2S_LRPOL			0x0001	/* set for which mode */
1419b34e6ccSZeng Zhaoming 
1429b34e6ccSZeng Zhaoming /*
1439b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_SSS_CTRL
1449b34e6ccSZeng Zhaoming  */
1459b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_LRSWAP			0x4000
1469b34e6ccSZeng Zhaoming #define SGTL5000_DAP_LRSWAP			0x2000
1479b34e6ccSZeng Zhaoming #define SGTL5000_DAC_LRSWAP			0x1000
1489b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_LRSWAP			0x0400
1499b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_SEL_MASK		0x0300
1509b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_SEL_SHIFT		8
1519b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_SEL_WIDTH		2
1529b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_SEL_ADC		0x0
1539b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_SEL_I2S_IN		0x1
1549b34e6ccSZeng Zhaoming #define SGTL5000_DAP_SEL_MASK			0x00c0
1559b34e6ccSZeng Zhaoming #define SGTL5000_DAP_SEL_SHIFT			6
1569b34e6ccSZeng Zhaoming #define SGTL5000_DAP_SEL_WIDTH			2
1579b34e6ccSZeng Zhaoming #define SGTL5000_DAP_SEL_ADC			0x0
1589b34e6ccSZeng Zhaoming #define SGTL5000_DAP_SEL_I2S_IN			0x1
1599b34e6ccSZeng Zhaoming #define SGTL5000_DAC_SEL_MASK			0x0030
1609b34e6ccSZeng Zhaoming #define SGTL5000_DAC_SEL_SHIFT			4
1619b34e6ccSZeng Zhaoming #define SGTL5000_DAC_SEL_WIDTH			2
1629b34e6ccSZeng Zhaoming #define SGTL5000_DAC_SEL_ADC			0x0
1639b34e6ccSZeng Zhaoming #define SGTL5000_DAC_SEL_I2S_IN			0x1
1649b34e6ccSZeng Zhaoming #define SGTL5000_DAC_SEL_DAP			0x3
1659b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_SEL_MASK		0x0003
1669b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_SEL_SHIFT		0
1679b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_SEL_WIDTH		2
1689b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_SEL_ADC		0x0
1699b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_SEL_I2S_IN		0x1
1709b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_SEL_DAP		0x3
1719b34e6ccSZeng Zhaoming 
1729b34e6ccSZeng Zhaoming /*
1739b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ADCDAC_CTRL
1749b34e6ccSZeng Zhaoming  */
1759b34e6ccSZeng Zhaoming #define SGTL5000_VOL_BUSY_DAC_RIGHT		0x2000
1769b34e6ccSZeng Zhaoming #define SGTL5000_VOL_BUSY_DAC_LEFT		0x1000
1779b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_RAMP_EN		0x0200
1789b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_RAMP_EXPO		0x0100
1799b34e6ccSZeng Zhaoming #define SGTL5000_DAC_MUTE_RIGHT			0x0008
1809b34e6ccSZeng Zhaoming #define SGTL5000_DAC_MUTE_LEFT			0x0004
1819b34e6ccSZeng Zhaoming #define SGTL5000_ADC_HPF_FREEZE			0x0002
1829b34e6ccSZeng Zhaoming #define SGTL5000_ADC_HPF_BYPASS			0x0001
1839b34e6ccSZeng Zhaoming 
1849b34e6ccSZeng Zhaoming /*
1859b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_DAC_VOL
1869b34e6ccSZeng Zhaoming  */
1879b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_RIGHT_MASK		0xff00
1889b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_RIGHT_SHIFT		8
1899b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_RIGHT_WIDTH		8
1909b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_LEFT_MASK		0x00ff
1919b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_LEFT_SHIFT		0
1929b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_LEFT_WIDTH		8
1939b34e6ccSZeng Zhaoming 
1949b34e6ccSZeng Zhaoming /*
1959b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_PAD_STRENGTH
1969b34e6ccSZeng Zhaoming  */
1979b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_LRCLK_MASK		0x0300
1989b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_LRCLK_SHIFT		8
1999b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_LRCLK_WIDTH		2
2009b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_SCLK_MASK		0x00c0
2019b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_SCLK_SHIFT		6
2029b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_SCLK_WIDTH		2
2039b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_DOUT_MASK		0x0030
2049b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_DOUT_SHIFT		4
2059b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_DOUT_WIDTH		2
2069b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2C_SDA_MASK		0x000c
2079b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2C_SDA_SHIFT		2
2089b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2C_SDA_WIDTH		2
2099b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2C_SCL_MASK		0x0003
2109b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2C_SCL_SHIFT		0
2119b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2C_SCL_WIDTH		2
2129b34e6ccSZeng Zhaoming 
2139b34e6ccSZeng Zhaoming /*
2149b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ANA_ADC_CTRL
2159b34e6ccSZeng Zhaoming  */
2169b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_M6DB			0x0100
2179b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_RIGHT_MASK		0x00f0
2189b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_RIGHT_SHIFT		4
2199b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_RIGHT_WIDTH		4
2209b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_LEFT_MASK		0x000f
2219b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_LEFT_SHIFT		0
2229b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_LEFT_WIDTH		4
2239b34e6ccSZeng Zhaoming 
2249b34e6ccSZeng Zhaoming /*
2259b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ANA_HP_CTRL
2269b34e6ccSZeng Zhaoming  */
2279b34e6ccSZeng Zhaoming #define SGTL5000_HP_VOL_RIGHT_MASK		0x7f00
2289b34e6ccSZeng Zhaoming #define SGTL5000_HP_VOL_RIGHT_SHIFT		8
2299b34e6ccSZeng Zhaoming #define SGTL5000_HP_VOL_RIGHT_WIDTH		7
2309b34e6ccSZeng Zhaoming #define SGTL5000_HP_VOL_LEFT_MASK		0x007f
2319b34e6ccSZeng Zhaoming #define SGTL5000_HP_VOL_LEFT_SHIFT		0
2329b34e6ccSZeng Zhaoming #define SGTL5000_HP_VOL_LEFT_WIDTH		7
2339b34e6ccSZeng Zhaoming 
2349b34e6ccSZeng Zhaoming /*
2359b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ANA_CTRL
2369b34e6ccSZeng Zhaoming  */
237aa781273SSebastian Reichel #define SGTL5000_CHIP_ANA_CTRL_DEFAULT		0x0133
2389b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_MUTE			0x0100
2399b34e6ccSZeng Zhaoming #define SGTL5000_HP_SEL_MASK			0x0040
2409b34e6ccSZeng Zhaoming #define SGTL5000_HP_SEL_SHIFT			6
2419b34e6ccSZeng Zhaoming #define SGTL5000_HP_SEL_WIDTH			1
2429b34e6ccSZeng Zhaoming #define SGTL5000_HP_SEL_DAC			0x0
2439b34e6ccSZeng Zhaoming #define SGTL5000_HP_SEL_LINE_IN			0x1
2449b34e6ccSZeng Zhaoming #define SGTL5000_HP_ZCD_EN			0x0020
2459b34e6ccSZeng Zhaoming #define SGTL5000_HP_MUTE			0x0010
2469b34e6ccSZeng Zhaoming #define SGTL5000_ADC_SEL_MASK			0x0004
2479b34e6ccSZeng Zhaoming #define SGTL5000_ADC_SEL_SHIFT			2
2489b34e6ccSZeng Zhaoming #define SGTL5000_ADC_SEL_WIDTH			1
2499b34e6ccSZeng Zhaoming #define SGTL5000_ADC_SEL_MIC			0x0
2509b34e6ccSZeng Zhaoming #define SGTL5000_ADC_SEL_LINE_IN		0x1
2519b34e6ccSZeng Zhaoming #define SGTL5000_ADC_ZCD_EN			0x0002
2529b34e6ccSZeng Zhaoming #define SGTL5000_ADC_MUTE			0x0001
2539b34e6ccSZeng Zhaoming 
2549b34e6ccSZeng Zhaoming /*
2559b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_LINREG_CTRL
2569b34e6ccSZeng Zhaoming  */
2579b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_MAN_ASSN_MASK		0x0040
2589b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_MAN_ASSN_SHIFT		6
2599b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_MAN_ASSN_WIDTH		1
2609b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_MAN_ASSN_VDDA		0x0
2619b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_MAN_ASSN_VDDIO		0x1
2629b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_ASSN_OVRD			0x0020
2639b34e6ccSZeng Zhaoming #define SGTL5000_LINREG_VDDD_MASK		0x000f
2649b34e6ccSZeng Zhaoming #define SGTL5000_LINREG_VDDD_SHIFT		0
2659b34e6ccSZeng Zhaoming #define SGTL5000_LINREG_VDDD_WIDTH		4
2669b34e6ccSZeng Zhaoming 
2679b34e6ccSZeng Zhaoming /*
2689b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_REF_CTRL
2699b34e6ccSZeng Zhaoming  */
2709b34e6ccSZeng Zhaoming #define SGTL5000_ANA_GND_MASK			0x01f0
2719b34e6ccSZeng Zhaoming #define SGTL5000_ANA_GND_SHIFT			4
2729b34e6ccSZeng Zhaoming #define SGTL5000_ANA_GND_WIDTH			5
2739b34e6ccSZeng Zhaoming #define SGTL5000_ANA_GND_BASE			800	/* mv */
2749b34e6ccSZeng Zhaoming #define SGTL5000_ANA_GND_STP			25	/*mv */
2759b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_CTRL_MASK			0x000e
2769b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_CTRL_SHIFT		1
2779b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_CTRL_WIDTH		3
278cadee10cSOleksandr Suvorov #define SGTL5000_SMALL_POP			0x0001
2799b34e6ccSZeng Zhaoming 
2809b34e6ccSZeng Zhaoming /*
2819b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_MIC_CTRL
2829b34e6ccSZeng Zhaoming  */
28356c09aa5SAxel Lin #define SGTL5000_BIAS_R_MASK			0x0300
2849b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_R_SHIFT			8
2859b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_R_WIDTH			2
2869b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_R_off			0x0
2879b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_R_2K			0x1
2889b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_R_4k			0x2
2899b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_R_8k			0x3
2909b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_VOLT_MASK			0x0070
2919b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_VOLT_SHIFT		4
2929b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_VOLT_WIDTH		3
2939b34e6ccSZeng Zhaoming #define SGTL5000_MIC_GAIN_MASK			0x0003
2949b34e6ccSZeng Zhaoming #define SGTL5000_MIC_GAIN_SHIFT			0
2959b34e6ccSZeng Zhaoming #define SGTL5000_MIC_GAIN_WIDTH			2
2969b34e6ccSZeng Zhaoming 
2979b34e6ccSZeng Zhaoming /*
2989b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_LINE_OUT_CTRL
2999b34e6ccSZeng Zhaoming  */
3009b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_MASK		0x0f00
3019b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_SHIFT		8
3029b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_WIDTH		4
3039b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_180u		0x0
3049b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_270u		0x1
3059b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_360u		0x3
3069b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_450u		0x7
3079b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_540u		0xf
3089b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_GND_MASK		0x003f
3099b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_GND_SHIFT		0
3109b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_GND_WIDTH		6
3119b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_GND_BASE		800	/* mv */
3129b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_GND_STP		25
3139b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_GND_MAX		0x23
3149b34e6ccSZeng Zhaoming 
3159b34e6ccSZeng Zhaoming /*
3169b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_LINE_OUT_VOL
3179b34e6ccSZeng Zhaoming  */
3189b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_VOL_RIGHT_MASK	0x1f00
3199b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_VOL_RIGHT_SHIFT	8
3209b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_VOL_RIGHT_WIDTH	5
3219b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_VOL_LEFT_MASK		0x001f
3229b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_VOL_LEFT_SHIFT	0
3239b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_VOL_LEFT_WIDTH	5
3249b34e6ccSZeng Zhaoming 
3259b34e6ccSZeng Zhaoming /*
3269b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ANA_POWER
3279b34e6ccSZeng Zhaoming  */
3283d632cc8SEric Nelson #define SGTL5000_ANA_POWER_DEFAULT		0x7060
3299b34e6ccSZeng Zhaoming #define SGTL5000_DAC_STEREO			0x4000
3309b34e6ccSZeng Zhaoming #define SGTL5000_LINREG_SIMPLE_POWERUP		0x2000
3319b34e6ccSZeng Zhaoming #define SGTL5000_STARTUP_POWERUP		0x1000
3329b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_CHRGPMP_POWERUP		0x0800
3339b34e6ccSZeng Zhaoming #define SGTL5000_PLL_POWERUP			0x0400
3349b34e6ccSZeng Zhaoming #define SGTL5000_LINEREG_D_POWERUP		0x0200
3359b34e6ccSZeng Zhaoming #define SGTL5000_VCOAMP_POWERUP			0x0100
3369b34e6ccSZeng Zhaoming #define SGTL5000_VAG_POWERUP			0x0080
3379b34e6ccSZeng Zhaoming #define SGTL5000_ADC_STEREO			0x0040
3389b34e6ccSZeng Zhaoming #define SGTL5000_REFTOP_POWERUP			0x0020
3399b34e6ccSZeng Zhaoming #define SGTL5000_HP_POWERUP			0x0010
3409b34e6ccSZeng Zhaoming #define SGTL5000_DAC_POWERUP			0x0008
3419b34e6ccSZeng Zhaoming #define SGTL5000_CAPLESS_HP_POWERUP		0x0004
3429b34e6ccSZeng Zhaoming #define SGTL5000_ADC_POWERUP			0x0002
3439b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_POWERUP		0x0001
3449b34e6ccSZeng Zhaoming 
3459b34e6ccSZeng Zhaoming /*
3469b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_PLL_CTRL
3479b34e6ccSZeng Zhaoming  */
3489b34e6ccSZeng Zhaoming #define SGTL5000_PLL_INT_DIV_MASK		0xf800
3499b34e6ccSZeng Zhaoming #define SGTL5000_PLL_INT_DIV_SHIFT		11
3509b34e6ccSZeng Zhaoming #define SGTL5000_PLL_INT_DIV_WIDTH		5
3515c78dfe8SFabio Estevam #define SGTL5000_PLL_FRAC_DIV_MASK		0x07ff
3529b34e6ccSZeng Zhaoming #define SGTL5000_PLL_FRAC_DIV_SHIFT		0
3539b34e6ccSZeng Zhaoming #define SGTL5000_PLL_FRAC_DIV_WIDTH		11
3549b34e6ccSZeng Zhaoming 
3559b34e6ccSZeng Zhaoming /*
3569b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_CLK_TOP_CTRL
3579b34e6ccSZeng Zhaoming  */
3589b34e6ccSZeng Zhaoming #define SGTL5000_INT_OSC_EN			0x0800
3599b34e6ccSZeng Zhaoming #define SGTL5000_INPUT_FREQ_DIV2		0x0008
3609b34e6ccSZeng Zhaoming 
3619b34e6ccSZeng Zhaoming /*
3629b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ANA_STATUS
3639b34e6ccSZeng Zhaoming  */
3649b34e6ccSZeng Zhaoming #define SGTL5000_HP_LRSHORT			0x0200
3659b34e6ccSZeng Zhaoming #define SGTL5000_CAPLESS_SHORT			0x0100
3669b34e6ccSZeng Zhaoming #define SGTL5000_PLL_LOCKED			0x0010
3679b34e6ccSZeng Zhaoming 
3689b34e6ccSZeng Zhaoming /*
3699b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_SHORT_CTRL
3709b34e6ccSZeng Zhaoming  */
3719b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJR_MASK			0x7000
3729b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJR_SHIFT			12
3739b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJR_WIDTH			3
3749b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJL_MASK			0x0700
3759b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJL_SHIFT			8
3769b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJL_WIDTH			3
3779b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJC_MASK			0x0070
3789b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJC_SHIFT			4
3799b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJC_WIDTH			3
3809b34e6ccSZeng Zhaoming #define SGTL5000_LR_SHORT_MOD_MASK		0x000c
3819b34e6ccSZeng Zhaoming #define SGTL5000_LR_SHORT_MOD_SHIFT		2
3829b34e6ccSZeng Zhaoming #define SGTL5000_LR_SHORT_MOD_WIDTH		2
3839b34e6ccSZeng Zhaoming #define SGTL5000_CM_SHORT_MOD_MASK		0x0003
3849b34e6ccSZeng Zhaoming #define SGTL5000_CM_SHORT_MOD_SHIFT		0
3859b34e6ccSZeng Zhaoming #define SGTL5000_CM_SHORT_MOD_WIDTH		2
3869b34e6ccSZeng Zhaoming 
3879b34e6ccSZeng Zhaoming /*
3889b34e6ccSZeng Zhaoming  *SGTL5000_CHIP_ANA_TEST2
3899b34e6ccSZeng Zhaoming  */
3909b34e6ccSZeng Zhaoming #define SGTL5000_MONO_DAC			0x1000
3919b34e6ccSZeng Zhaoming 
3929b34e6ccSZeng Zhaoming /*
3939b34e6ccSZeng Zhaoming  * SGTL5000_DAP_CTRL
3949b34e6ccSZeng Zhaoming  */
3959b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_EN			0x0010
3969b34e6ccSZeng Zhaoming #define SGTL5000_DAP_EN				0x0001
3979b34e6ccSZeng Zhaoming 
3989b34e6ccSZeng Zhaoming #define SGTL5000_SYSCLK				0x00
3999b34e6ccSZeng Zhaoming #define SGTL5000_LRCLK				0x01
4009b34e6ccSZeng Zhaoming 
40192a2742fSMichal Oleszczyk /*
40292a2742fSMichal Oleszczyk  * SGTL5000_DAP_AUDIO_EQ
40392a2742fSMichal Oleszczyk  */
40492a2742fSMichal Oleszczyk #define SGTL5000_DAP_SEL_PEQ			1
40592a2742fSMichal Oleszczyk #define SGTL5000_DAP_SEL_TONE_CTRL		2
40692a2742fSMichal Oleszczyk #define SGTL5000_DAP_SEL_GEQ			3
40792a2742fSMichal Oleszczyk 
4089b34e6ccSZeng Zhaoming #endif
409