xref: /linux/sound/soc/codecs/cs42l42.h (revision 12451814496a5433f41843ca4e3d9961d69304f7)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
22c394ca7SJames Schulman /*
32c394ca7SJames Schulman  * cs42l42.h -- CS42L42 ALSA SoC audio driver header
42c394ca7SJames Schulman  *
52c394ca7SJames Schulman  * Copyright 2016 Cirrus Logic, Inc.
62c394ca7SJames Schulman  *
72c394ca7SJames Schulman  * Author: James Schulman <james.schulman@cirrus.com>
82c394ca7SJames Schulman  * Author: Brian Austin <brian.austin@cirrus.com>
92c394ca7SJames Schulman  * Author: Michael White <michael.white@cirrus.com>
102c394ca7SJames Schulman  */
112c394ca7SJames Schulman 
122c394ca7SJames Schulman #ifndef __CS42L42_H__
132c394ca7SJames Schulman #define __CS42L42_H__
142c394ca7SJames Schulman 
15c5b8ee08SLucas Tanure #include <sound/jack.h>
16c5b8ee08SLucas Tanure 
172c394ca7SJames Schulman #define CS42L42_PAGE_REGISTER	0x00	/* Page Select Register */
182c394ca7SJames Schulman #define CS42L42_WIN_START	0x00
192c394ca7SJames Schulman #define CS42L42_WIN_LEN		0x100
202c394ca7SJames Schulman #define CS42L42_RANGE_MIN	0x00
212c394ca7SJames Schulman #define CS42L42_RANGE_MAX	0x7F
222c394ca7SJames Schulman 
232c394ca7SJames Schulman #define CS42L42_PAGE_10		0x1000
242c394ca7SJames Schulman #define CS42L42_PAGE_11		0x1100
252c394ca7SJames Schulman #define CS42L42_PAGE_12		0x1200
262c394ca7SJames Schulman #define CS42L42_PAGE_13		0x1300
272c394ca7SJames Schulman #define CS42L42_PAGE_15		0x1500
282c394ca7SJames Schulman #define CS42L42_PAGE_19		0x1900
292c394ca7SJames Schulman #define CS42L42_PAGE_1B		0x1B00
302c394ca7SJames Schulman #define CS42L42_PAGE_1C		0x1C00
312c394ca7SJames Schulman #define CS42L42_PAGE_1D		0x1D00
322c394ca7SJames Schulman #define CS42L42_PAGE_1F		0x1F00
332c394ca7SJames Schulman #define CS42L42_PAGE_20		0x2000
342c394ca7SJames Schulman #define CS42L42_PAGE_21		0x2100
352c394ca7SJames Schulman #define CS42L42_PAGE_23		0x2300
362c394ca7SJames Schulman #define CS42L42_PAGE_24		0x2400
372c394ca7SJames Schulman #define CS42L42_PAGE_25		0x2500
382c394ca7SJames Schulman #define CS42L42_PAGE_26		0x2600
392c394ca7SJames Schulman #define CS42L42_PAGE_28		0x2800
402c394ca7SJames Schulman #define CS42L42_PAGE_29		0x2900
412c394ca7SJames Schulman #define CS42L42_PAGE_2A		0x2A00
422c394ca7SJames Schulman #define CS42L42_PAGE_30		0x3000
432c394ca7SJames Schulman 
442c394ca7SJames Schulman #define CS42L42_CHIP_ID		0x42A42
452c394ca7SJames Schulman 
462c394ca7SJames Schulman /* Page 0x10 Global Registers */
472c394ca7SJames Schulman #define CS42L42_DEVID_AB		(CS42L42_PAGE_10 + 0x01)
482c394ca7SJames Schulman #define CS42L42_DEVID_CD		(CS42L42_PAGE_10 + 0x02)
492c394ca7SJames Schulman #define CS42L42_DEVID_E			(CS42L42_PAGE_10 + 0x03)
502c394ca7SJames Schulman #define CS42L42_FABID			(CS42L42_PAGE_10 + 0x04)
512c394ca7SJames Schulman #define CS42L42_REVID			(CS42L42_PAGE_10 + 0x05)
522c394ca7SJames Schulman #define CS42L42_FRZ_CTL			(CS42L42_PAGE_10 + 0x06)
532c394ca7SJames Schulman 
542c394ca7SJames Schulman #define CS42L42_SRC_CTL			(CS42L42_PAGE_10 + 0x07)
552c394ca7SJames Schulman #define CS42L42_SRC_BYPASS_DAC_SHIFT	1
562c394ca7SJames Schulman #define CS42L42_SRC_BYPASS_DAC_MASK	(1 << CS42L42_SRC_BYPASS_DAC_SHIFT)
572c394ca7SJames Schulman 
582c394ca7SJames Schulman #define CS42L42_MCLK_STATUS		(CS42L42_PAGE_10 + 0x08)
592c394ca7SJames Schulman 
602c394ca7SJames Schulman #define CS42L42_MCLK_CTL		(CS42L42_PAGE_10 + 0x09)
612c394ca7SJames Schulman #define CS42L42_INTERNAL_FS_SHIFT	1
622c394ca7SJames Schulman #define CS42L42_INTERNAL_FS_MASK	(1 << CS42L42_INTERNAL_FS_SHIFT)
632c394ca7SJames Schulman 
642c394ca7SJames Schulman #define CS42L42_SFTRAMP_RATE		(CS42L42_PAGE_10 + 0x0A)
652c394ca7SJames Schulman #define CS42L42_I2C_DEBOUNCE		(CS42L42_PAGE_10 + 0x0E)
662c394ca7SJames Schulman #define CS42L42_I2C_STRETCH		(CS42L42_PAGE_10 + 0x0F)
672c394ca7SJames Schulman #define CS42L42_I2C_TIMEOUT		(CS42L42_PAGE_10 + 0x10)
682c394ca7SJames Schulman 
692c394ca7SJames Schulman /* Page 0x11 Power and Headset Detect Registers */
702c394ca7SJames Schulman #define CS42L42_PWR_CTL1		(CS42L42_PAGE_11 + 0x01)
712c394ca7SJames Schulman #define CS42L42_ASP_DAO_PDN_SHIFT	7
722c394ca7SJames Schulman #define CS42L42_ASP_DAO_PDN_MASK	(1 << CS42L42_ASP_DAO_PDN_SHIFT)
732c394ca7SJames Schulman #define CS42L42_ASP_DAI_PDN_SHIFT	6
742c394ca7SJames Schulman #define CS42L42_ASP_DAI_PDN_MASK	(1 << CS42L42_ASP_DAI_PDN_SHIFT)
752c394ca7SJames Schulman #define CS42L42_MIXER_PDN_SHIFT		5
762c394ca7SJames Schulman #define CS42L42_MIXER_PDN_MASK		(1 << CS42L42_MIXER_PDN_SHIFT)
772c394ca7SJames Schulman #define CS42L42_EQ_PDN_SHIFT		4
782c394ca7SJames Schulman #define CS42L42_EQ_PDN_MASK		(1 << CS42L42_EQ_PDN_SHIFT)
792c394ca7SJames Schulman #define CS42L42_HP_PDN_SHIFT		3
802c394ca7SJames Schulman #define CS42L42_HP_PDN_MASK		(1 << CS42L42_HP_PDN_SHIFT)
812c394ca7SJames Schulman #define CS42L42_ADC_PDN_SHIFT		2
82fac165f2SRichard Fitzgerald #define CS42L42_ADC_PDN_MASK		(1 << CS42L42_ADC_PDN_SHIFT)
832c394ca7SJames Schulman #define CS42L42_PDN_ALL_SHIFT		0
842c394ca7SJames Schulman #define CS42L42_PDN_ALL_MASK		(1 << CS42L42_PDN_ALL_SHIFT)
852c394ca7SJames Schulman 
862c394ca7SJames Schulman #define CS42L42_PWR_CTL2		(CS42L42_PAGE_11 + 0x02)
872c394ca7SJames Schulman #define CS42L42_ADC_SRC_PDNB_SHIFT	0
882c394ca7SJames Schulman #define CS42L42_ADC_SRC_PDNB_MASK	(1 << CS42L42_ADC_SRC_PDNB_SHIFT)
892c394ca7SJames Schulman #define CS42L42_DAC_SRC_PDNB_SHIFT	1
902c394ca7SJames Schulman #define CS42L42_DAC_SRC_PDNB_MASK	(1 << CS42L42_DAC_SRC_PDNB_SHIFT)
912c394ca7SJames Schulman #define CS42L42_ASP_DAI1_PDN_SHIFT	2
922c394ca7SJames Schulman #define CS42L42_ASP_DAI1_PDN_MASK	(1 << CS42L42_ASP_DAI1_PDN_SHIFT)
932c394ca7SJames Schulman #define CS42L42_SRC_PDN_OVERRIDE_SHIFT	3
942c394ca7SJames Schulman #define CS42L42_SRC_PDN_OVERRIDE_MASK	(1 << CS42L42_SRC_PDN_OVERRIDE_SHIFT)
952c394ca7SJames Schulman #define CS42L42_DISCHARGE_FILT_SHIFT	4
962c394ca7SJames Schulman #define CS42L42_DISCHARGE_FILT_MASK	(1 << CS42L42_DISCHARGE_FILT_SHIFT)
972c394ca7SJames Schulman 
982c394ca7SJames Schulman #define CS42L42_PWR_CTL3			(CS42L42_PAGE_11 + 0x03)
992c394ca7SJames Schulman #define CS42L42_RING_SENSE_PDNB_SHIFT		1
1002c394ca7SJames Schulman #define CS42L42_RING_SENSE_PDNB_MASK		(1 << \
1012c394ca7SJames Schulman 					CS42L42_RING_SENSE_PDNB_SHIFT)
1022c394ca7SJames Schulman #define CS42L42_VPMON_PDNB_SHIFT		2
1032c394ca7SJames Schulman #define CS42L42_VPMON_PDNB_MASK			(1 << \
1042c394ca7SJames Schulman 					CS42L42_VPMON_PDNB_SHIFT)
1052c394ca7SJames Schulman #define CS42L42_SW_CLK_STP_STAT_SEL_SHIFT	5
1062c394ca7SJames Schulman #define CS42L42_SW_CLK_STP_STAT_SEL_MASK	(3 << \
1072c394ca7SJames Schulman 					CS42L42_SW_CLK_STP_STAT_SEL_SHIFT)
1082c394ca7SJames Schulman 
1092c394ca7SJames Schulman #define CS42L42_RSENSE_CTL1			(CS42L42_PAGE_11 + 0x04)
1102c394ca7SJames Schulman #define CS42L42_RS_TRIM_R_SHIFT			0
1112c394ca7SJames Schulman #define CS42L42_RS_TRIM_R_MASK			(1 << \
1122c394ca7SJames Schulman 					CS42L42_RS_TRIM_R_SHIFT)
1132c394ca7SJames Schulman #define CS42L42_RS_TRIM_T_SHIFT			1
1142c394ca7SJames Schulman #define CS42L42_RS_TRIM_T_MASK			(1 << \
1152c394ca7SJames Schulman 					CS42L42_RS_TRIM_T_SHIFT)
1162c394ca7SJames Schulman #define CS42L42_HPREF_RS_SHIFT			2
1172c394ca7SJames Schulman #define CS42L42_HPREF_RS_MASK			(1 << \
1182c394ca7SJames Schulman 					CS42L42_HPREF_RS_SHIFT)
1192c394ca7SJames Schulman #define CS42L42_HSBIAS_FILT_REF_RS_SHIFT	3
1202c394ca7SJames Schulman #define CS42L42_HSBIAS_FILT_REF_RS_MASK		(1 << \
1212c394ca7SJames Schulman 					CS42L42_HSBIAS_FILT_REF_RS_SHIFT)
1222c394ca7SJames Schulman #define CS42L42_RING_SENSE_PU_HIZ_SHIFT		6
1232c394ca7SJames Schulman #define CS42L42_RING_SENSE_PU_HIZ_MASK		(1 << \
1242c394ca7SJames Schulman 					CS42L42_RING_SENSE_PU_HIZ_SHIFT)
1252c394ca7SJames Schulman 
1262c394ca7SJames Schulman #define CS42L42_RSENSE_CTL2		(CS42L42_PAGE_11 + 0x05)
1272c394ca7SJames Schulman #define CS42L42_TS_RS_GATE_SHIFT	7
1282c394ca7SJames Schulman #define CS42L42_TS_RS_GATE_MAS		(1 << CS42L42_TS_RS_GATE_SHIFT)
1292c394ca7SJames Schulman 
1302c394ca7SJames Schulman #define CS42L42_OSC_SWITCH		(CS42L42_PAGE_11 + 0x07)
1312c394ca7SJames Schulman #define CS42L42_SCLK_PRESENT_SHIFT	0
1322c394ca7SJames Schulman #define CS42L42_SCLK_PRESENT_MASK	(1 << CS42L42_SCLK_PRESENT_SHIFT)
1332c394ca7SJames Schulman 
1342c394ca7SJames Schulman #define CS42L42_OSC_SWITCH_STATUS	(CS42L42_PAGE_11 + 0x09)
1352c394ca7SJames Schulman #define CS42L42_OSC_SW_SEL_STAT_SHIFT	0
1362c394ca7SJames Schulman #define CS42L42_OSC_SW_SEL_STAT_MASK	(3 << CS42L42_OSC_SW_SEL_STAT_SHIFT)
1372c394ca7SJames Schulman #define CS42L42_OSC_PDNB_STAT_SHIFT	2
1382c394ca7SJames Schulman #define CS42L42_OSC_PDNB_STAT_MASK	(1 << CS42L42_OSC_SW_SEL_STAT_SHIFT)
1392c394ca7SJames Schulman 
1402c394ca7SJames Schulman #define CS42L42_RSENSE_CTL3			(CS42L42_PAGE_11 + 0x12)
1412c394ca7SJames Schulman #define CS42L42_RS_RISE_DBNCE_TIME_SHIFT	0
1422c394ca7SJames Schulman #define CS42L42_RS_RISE_DBNCE_TIME_MASK		(7 << \
1432c394ca7SJames Schulman 					CS42L42_RS_RISE_DBNCE_TIME_SHIFT)
1442c394ca7SJames Schulman #define CS42L42_RS_FALL_DBNCE_TIME_SHIFT	3
1452c394ca7SJames Schulman #define CS42L42_RS_FALL_DBNCE_TIME_MASK		(7 << \
1462c394ca7SJames Schulman 					CS42L42_RS_FALL_DBNCE_TIME_SHIFT)
1472c394ca7SJames Schulman #define CS42L42_RS_PU_EN_SHIFT			6
1482c394ca7SJames Schulman #define CS42L42_RS_PU_EN_MASK			(1 << \
1492c394ca7SJames Schulman 					CS42L42_RS_PU_EN_SHIFT)
1502c394ca7SJames Schulman #define CS42L42_RS_INV_SHIFT			7
1512c394ca7SJames Schulman #define CS42L42_RS_INV_MASK			(1 << \
1522c394ca7SJames Schulman 					CS42L42_RS_INV_SHIFT)
1532c394ca7SJames Schulman 
1542c394ca7SJames Schulman #define CS42L42_TSENSE_CTL			(CS42L42_PAGE_11 + 0x13)
1552c394ca7SJames Schulman #define CS42L42_TS_RISE_DBNCE_TIME_SHIFT	0
1562c394ca7SJames Schulman #define CS42L42_TS_RISE_DBNCE_TIME_MASK		(7 << \
1572c394ca7SJames Schulman 					CS42L42_TS_RISE_DBNCE_TIME_SHIFT)
1582c394ca7SJames Schulman #define CS42L42_TS_FALL_DBNCE_TIME_SHIFT	3
1592c394ca7SJames Schulman #define CS42L42_TS_FALL_DBNCE_TIME_MASK		(7 << \
1602c394ca7SJames Schulman 					CS42L42_TS_FALL_DBNCE_TIME_SHIFT)
1612c394ca7SJames Schulman #define CS42L42_TS_INV_SHIFT			7
1622c394ca7SJames Schulman #define CS42L42_TS_INV_MASK			(1 << \
1632c394ca7SJames Schulman 					CS42L42_TS_INV_SHIFT)
1642c394ca7SJames Schulman 
1652c394ca7SJames Schulman #define CS42L42_TSRS_INT_DISABLE	(CS42L42_PAGE_11 + 0x14)
1662c394ca7SJames Schulman #define CS42L42_D_RS_PLUG_DBNC_SHIFT	0
1672c394ca7SJames Schulman #define CS42L42_D_RS_PLUG_DBNC_MASK	(1 << CS42L42_D_RS_PLUG_DBNC_SHIFT)
1682c394ca7SJames Schulman #define CS42L42_D_RS_UNPLUG_DBNC_SHIFT	1
1692c394ca7SJames Schulman #define CS42L42_D_RS_UNPLUG_DBNC_MASK	(1 << CS42L42_D_RS_UNPLUG_DBNC_SHIFT)
1702c394ca7SJames Schulman #define CS42L42_D_TS_PLUG_DBNC_SHIFT	2
1712c394ca7SJames Schulman #define CS42L42_D_TS_PLUG_DBNC_MASK	(1 << CS42L42_D_TS_PLUG_DBNC_SHIFT)
1722c394ca7SJames Schulman #define CS42L42_D_TS_UNPLUG_DBNC_SHIFT	3
1732c394ca7SJames Schulman #define CS42L42_D_TS_UNPLUG_DBNC_MASK	(1 << CS42L42_D_TS_UNPLUG_DBNC_SHIFT)
1742c394ca7SJames Schulman 
1752c394ca7SJames Schulman #define CS42L42_TRSENSE_STATUS		(CS42L42_PAGE_11 + 0x15)
1762c394ca7SJames Schulman #define CS42L42_RS_PLUG_DBNC_SHIFT	0
1772c394ca7SJames Schulman #define CS42L42_RS_PLUG_DBNC_MASK	(1 << CS42L42_RS_PLUG_DBNC_SHIFT)
1782c394ca7SJames Schulman #define CS42L42_RS_UNPLUG_DBNC_SHIFT	1
1792c394ca7SJames Schulman #define CS42L42_RS_UNPLUG_DBNC_MASK	(1 << CS42L42_RS_UNPLUG_DBNC_SHIFT)
1802c394ca7SJames Schulman #define CS42L42_TS_PLUG_DBNC_SHIFT	2
1812c394ca7SJames Schulman #define CS42L42_TS_PLUG_DBNC_MASK	(1 << CS42L42_TS_PLUG_DBNC_SHIFT)
1822c394ca7SJames Schulman #define CS42L42_TS_UNPLUG_DBNC_SHIFT	3
1832c394ca7SJames Schulman #define CS42L42_TS_UNPLUG_DBNC_MASK	(1 << CS42L42_TS_UNPLUG_DBNC_SHIFT)
1842c394ca7SJames Schulman 
1852c394ca7SJames Schulman #define CS42L42_HSDET_CTL1		(CS42L42_PAGE_11 + 0x1F)
1862c394ca7SJames Schulman #define CS42L42_HSDET_COMP1_LVL_SHIFT	0
1872c394ca7SJames Schulman #define CS42L42_HSDET_COMP1_LVL_MASK	(15 << CS42L42_HSDET_COMP1_LVL_SHIFT)
1882c394ca7SJames Schulman #define CS42L42_HSDET_COMP2_LVL_SHIFT	4
1892c394ca7SJames Schulman #define CS42L42_HSDET_COMP2_LVL_MASK	(15 << CS42L42_HSDET_COMP2_LVL_SHIFT)
1902c394ca7SJames Schulman 
1912c394ca7SJames Schulman #define CS42L42_HSDET_CTL2		(CS42L42_PAGE_11 + 0x20)
1922c394ca7SJames Schulman #define CS42L42_HSDET_AUTO_TIME_SHIFT	0
1932c394ca7SJames Schulman #define CS42L42_HSDET_AUTO_TIME_MASK	(3 << CS42L42_HSDET_AUTO_TIME_SHIFT)
1942c394ca7SJames Schulman #define CS42L42_HSBIAS_REF_SHIFT	3
1952c394ca7SJames Schulman #define CS42L42_HSBIAS_REF_MASK		(1 << CS42L42_HSBIAS_REF_SHIFT)
1962c394ca7SJames Schulman #define CS42L42_HSDET_SET_SHIFT		4
1972c394ca7SJames Schulman #define CS42L42_HSDET_SET_MASK		(3 << CS42L42_HSDET_SET_SHIFT)
1982c394ca7SJames Schulman #define CS42L42_HSDET_CTRL_SHIFT	6
1992c394ca7SJames Schulman #define CS42L42_HSDET_CTRL_MASK		(3 << CS42L42_HSDET_CTRL_SHIFT)
2002c394ca7SJames Schulman 
2012c394ca7SJames Schulman #define CS42L42_HS_SWITCH_CTL		(CS42L42_PAGE_11 + 0x21)
2022c394ca7SJames Schulman #define CS42L42_SW_GNDHS_HS4_SHIFT	0
2032c394ca7SJames Schulman #define CS42L42_SW_GNDHS_HS4_MASK	(1 << CS42L42_SW_GNDHS_HS4_SHIFT)
2042c394ca7SJames Schulman #define CS42L42_SW_GNDHS_HS3_SHIFT	1
2052c394ca7SJames Schulman #define CS42L42_SW_GNDHS_HS3_MASK	(1 << CS42L42_SW_GNDHS_HS3_SHIFT)
2062c394ca7SJames Schulman #define CS42L42_SW_HSB_HS4_SHIFT	2
2072c394ca7SJames Schulman #define CS42L42_SW_HSB_HS4_MASK		(1 << CS42L42_SW_HSB_HS4_SHIFT)
2082c394ca7SJames Schulman #define CS42L42_SW_HSB_HS3_SHIFT	3
2092c394ca7SJames Schulman #define CS42L42_SW_HSB_HS3_MASK		(1 << CS42L42_SW_HSB_HS3_SHIFT)
2102c394ca7SJames Schulman #define CS42L42_SW_HSB_FILT_HS4_SHIFT	4
2112c394ca7SJames Schulman #define CS42L42_SW_HSB_FILT_HS4_MASK	(1 << CS42L42_SW_HSB_FILT_HS4_SHIFT)
2122c394ca7SJames Schulman #define CS42L42_SW_HSB_FILT_HS3_SHIFT	5
2132c394ca7SJames Schulman #define CS42L42_SW_HSB_FILT_HS3_MASK	(1 << CS42L42_SW_HSB_FILT_HS3_SHIFT)
2142c394ca7SJames Schulman #define CS42L42_SW_REF_HS4_SHIFT	6
2152c394ca7SJames Schulman #define CS42L42_SW_REF_HS4_MASK		(1 << CS42L42_SW_REF_HS4_SHIFT)
2162c394ca7SJames Schulman #define CS42L42_SW_REF_HS3_SHIFT	7
2172c394ca7SJames Schulman #define CS42L42_SW_REF_HS3_MASK		(1 << CS42L42_SW_REF_HS3_SHIFT)
2182c394ca7SJames Schulman 
2192c394ca7SJames Schulman #define CS42L42_HS_DET_STATUS		(CS42L42_PAGE_11 + 0x24)
2202c394ca7SJames Schulman #define CS42L42_HSDET_TYPE_SHIFT	0
2212c394ca7SJames Schulman #define CS42L42_HSDET_TYPE_MASK		(3 << CS42L42_HSDET_TYPE_SHIFT)
2222c394ca7SJames Schulman #define CS42L42_HSDET_COMP1_OUT_SHIFT	6
2232c394ca7SJames Schulman #define CS42L42_HSDET_COMP1_OUT_MASK	(1 << CS42L42_HSDET_COMP1_OUT_SHIFT)
2242c394ca7SJames Schulman #define CS42L42_HSDET_COMP2_OUT_SHIFT	7
2252c394ca7SJames Schulman #define CS42L42_HSDET_COMP2_OUT_MASK	(1 << CS42L42_HSDET_COMP2_OUT_SHIFT)
2262c394ca7SJames Schulman #define CS42L42_PLUG_CTIA		0
2272c394ca7SJames Schulman #define CS42L42_PLUG_OMTP		1
2282c394ca7SJames Schulman #define CS42L42_PLUG_HEADPHONE		2
2292c394ca7SJames Schulman #define CS42L42_PLUG_INVALID		3
2302c394ca7SJames Schulman 
231*12451814SStefan Binding #define CS42L42_HSDET_SW_COMP1		((0 << CS42L42_SW_GNDHS_HS4_SHIFT) | \
232*12451814SStefan Binding 					 (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \
233*12451814SStefan Binding 					 (1 << CS42L42_SW_HSB_HS4_SHIFT) | \
234*12451814SStefan Binding 					 (0 << CS42L42_SW_HSB_HS3_SHIFT) | \
235*12451814SStefan Binding 					 (0 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \
236*12451814SStefan Binding 					 (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \
237*12451814SStefan Binding 					 (0 << CS42L42_SW_REF_HS4_SHIFT) | \
238*12451814SStefan Binding 					 (1 << CS42L42_SW_REF_HS3_SHIFT))
239*12451814SStefan Binding #define CS42L42_HSDET_SW_COMP2		((1 << CS42L42_SW_GNDHS_HS4_SHIFT) | \
240*12451814SStefan Binding 					 (0 << CS42L42_SW_GNDHS_HS3_SHIFT) | \
241*12451814SStefan Binding 					 (0 << CS42L42_SW_HSB_HS4_SHIFT) | \
242*12451814SStefan Binding 					 (1 << CS42L42_SW_HSB_HS3_SHIFT) | \
243*12451814SStefan Binding 					 (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \
244*12451814SStefan Binding 					 (0 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \
245*12451814SStefan Binding 					 (1 << CS42L42_SW_REF_HS4_SHIFT) | \
246*12451814SStefan Binding 					 (0 << CS42L42_SW_REF_HS3_SHIFT))
247*12451814SStefan Binding #define CS42L42_HSDET_SW_TYPE1		((0 << CS42L42_SW_GNDHS_HS4_SHIFT) | \
248*12451814SStefan Binding 					 (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \
249*12451814SStefan Binding 					 (1 << CS42L42_SW_HSB_HS4_SHIFT) | \
250*12451814SStefan Binding 					 (0 << CS42L42_SW_HSB_HS3_SHIFT) | \
251*12451814SStefan Binding 					 (0 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \
252*12451814SStefan Binding 					 (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \
253*12451814SStefan Binding 					 (0 << CS42L42_SW_REF_HS4_SHIFT) | \
254*12451814SStefan Binding 					 (1 << CS42L42_SW_REF_HS3_SHIFT))
255*12451814SStefan Binding #define CS42L42_HSDET_SW_TYPE2		((1 << CS42L42_SW_GNDHS_HS4_SHIFT) | \
256*12451814SStefan Binding 					 (0 << CS42L42_SW_GNDHS_HS3_SHIFT) | \
257*12451814SStefan Binding 					 (0 << CS42L42_SW_HSB_HS4_SHIFT) | \
258*12451814SStefan Binding 					 (1 << CS42L42_SW_HSB_HS3_SHIFT) | \
259*12451814SStefan Binding 					 (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \
260*12451814SStefan Binding 					 (0 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \
261*12451814SStefan Binding 					 (1 << CS42L42_SW_REF_HS4_SHIFT) | \
262*12451814SStefan Binding 					 (0 << CS42L42_SW_REF_HS3_SHIFT))
263*12451814SStefan Binding #define CS42L42_HSDET_SW_TYPE3		((1 << CS42L42_SW_GNDHS_HS4_SHIFT) | \
264*12451814SStefan Binding 					 (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \
265*12451814SStefan Binding 					 (0 << CS42L42_SW_HSB_HS4_SHIFT) | \
266*12451814SStefan Binding 					 (0 << CS42L42_SW_HSB_HS3_SHIFT) | \
267*12451814SStefan Binding 					 (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \
268*12451814SStefan Binding 					 (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \
269*12451814SStefan Binding 					 (1 << CS42L42_SW_REF_HS4_SHIFT) | \
270*12451814SStefan Binding 					 (1 << CS42L42_SW_REF_HS3_SHIFT))
271*12451814SStefan Binding #define CS42L42_HSDET_SW_TYPE4		((0 << CS42L42_SW_GNDHS_HS4_SHIFT) | \
272*12451814SStefan Binding 					 (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \
273*12451814SStefan Binding 					 (1 << CS42L42_SW_HSB_HS4_SHIFT) | \
274*12451814SStefan Binding 					 (0 << CS42L42_SW_HSB_HS3_SHIFT) | \
275*12451814SStefan Binding 					 (0 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \
276*12451814SStefan Binding 					 (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \
277*12451814SStefan Binding 					 (0 << CS42L42_SW_REF_HS4_SHIFT) | \
278*12451814SStefan Binding 					 (1 << CS42L42_SW_REF_HS3_SHIFT))
279*12451814SStefan Binding 
280*12451814SStefan Binding #define CS42L42_HSDET_COMP_TYPE1	1
281*12451814SStefan Binding #define CS42L42_HSDET_COMP_TYPE2	2
282*12451814SStefan Binding #define CS42L42_HSDET_COMP_TYPE3	0
283*12451814SStefan Binding #define CS42L42_HSDET_COMP_TYPE4	3
284*12451814SStefan Binding 
2852c394ca7SJames Schulman #define CS42L42_HS_CLAMP_DISABLE	(CS42L42_PAGE_11 + 0x29)
2862c394ca7SJames Schulman #define CS42L42_HS_CLAMP_DISABLE_SHIFT	0
2872c394ca7SJames Schulman #define CS42L42_HS_CLAMP_DISABLE_MASK	(1 << CS42L42_HS_CLAMP_DISABLE_SHIFT)
2882c394ca7SJames Schulman 
2892c394ca7SJames Schulman /* Page 0x12 Clocking Registers */
2902c394ca7SJames Schulman #define CS42L42_MCLK_SRC_SEL		(CS42L42_PAGE_12 + 0x01)
2912c394ca7SJames Schulman #define CS42L42_MCLKDIV_SHIFT		1
2922c394ca7SJames Schulman #define CS42L42_MCLKDIV_MASK		(1 << CS42L42_MCLKDIV_SHIFT)
2932c394ca7SJames Schulman #define CS42L42_MCLK_SRC_SEL_SHIFT	0
2942c394ca7SJames Schulman #define CS42L42_MCLK_SRC_SEL_MASK	(1 << CS42L42_MCLK_SRC_SEL_SHIFT)
2952c394ca7SJames Schulman 
2962c394ca7SJames Schulman #define CS42L42_SPDIF_CLK_CFG		(CS42L42_PAGE_12 + 0x02)
2972c394ca7SJames Schulman #define CS42L42_FSYNC_PW_LOWER		(CS42L42_PAGE_12 + 0x03)
2982c394ca7SJames Schulman 
2992c394ca7SJames Schulman #define CS42L42_FSYNC_PW_UPPER			(CS42L42_PAGE_12 + 0x04)
3002c394ca7SJames Schulman #define CS42L42_FSYNC_PULSE_WIDTH_SHIFT		0
3012c394ca7SJames Schulman #define CS42L42_FSYNC_PULSE_WIDTH_MASK		(0xff << \
3022c394ca7SJames Schulman 					CS42L42_FSYNC_PULSE_WIDTH_SHIFT)
3032c394ca7SJames Schulman 
3042c394ca7SJames Schulman #define CS42L42_FSYNC_P_LOWER		(CS42L42_PAGE_12 + 0x05)
3052c394ca7SJames Schulman 
3062c394ca7SJames Schulman #define CS42L42_FSYNC_P_UPPER		(CS42L42_PAGE_12 + 0x06)
3072c394ca7SJames Schulman #define CS42L42_FSYNC_PERIOD_SHIFT	0
3082c394ca7SJames Schulman #define CS42L42_FSYNC_PERIOD_MASK	(0xff << CS42L42_FSYNC_PERIOD_SHIFT)
3092c394ca7SJames Schulman 
3102c394ca7SJames Schulman #define CS42L42_ASP_CLK_CFG		(CS42L42_PAGE_12 + 0x07)
3112c394ca7SJames Schulman #define CS42L42_ASP_SCLK_EN_SHIFT	5
3122c394ca7SJames Schulman #define CS42L42_ASP_SCLK_EN_MASK	(1 << CS42L42_ASP_SCLK_EN_SHIFT)
3132c394ca7SJames Schulman #define CS42L42_ASP_MASTER_MODE		0x01
3142c394ca7SJames Schulman #define CS42L42_ASP_SLAVE_MODE		0x00
3152c394ca7SJames Schulman #define CS42L42_ASP_MODE_SHIFT		4
3162c394ca7SJames Schulman #define CS42L42_ASP_MODE_MASK		(1 << CS42L42_ASP_MODE_SHIFT)
317e793c965SLucas Tanure #define CS42L42_ASP_SCPOL_SHIFT		2
318e793c965SLucas Tanure #define CS42L42_ASP_SCPOL_MASK		(3 << CS42L42_ASP_SCPOL_SHIFT)
319e793c965SLucas Tanure #define CS42L42_ASP_SCPOL_NOR		3
320e793c965SLucas Tanure #define CS42L42_ASP_LCPOL_SHIFT		0
321e793c965SLucas Tanure #define CS42L42_ASP_LCPOL_MASK		(3 << CS42L42_ASP_LCPOL_SHIFT)
322e793c965SLucas Tanure #define CS42L42_ASP_LCPOL_INV		3
3232c394ca7SJames Schulman 
3242c394ca7SJames Schulman #define CS42L42_ASP_FRM_CFG		(CS42L42_PAGE_12 + 0x08)
3252c394ca7SJames Schulman #define CS42L42_ASP_STP_SHIFT		4
3262c394ca7SJames Schulman #define CS42L42_ASP_STP_MASK		(1 << CS42L42_ASP_STP_SHIFT)
3272c394ca7SJames Schulman #define CS42L42_ASP_5050_SHIFT		3
3282c394ca7SJames Schulman #define CS42L42_ASP_5050_MASK		(1 << CS42L42_ASP_5050_SHIFT)
3292c394ca7SJames Schulman #define CS42L42_ASP_FSD_SHIFT		0
3302c394ca7SJames Schulman #define CS42L42_ASP_FSD_MASK		(7 << CS42L42_ASP_FSD_SHIFT)
3312c394ca7SJames Schulman #define CS42L42_ASP_FSD_0_5		1
3322c394ca7SJames Schulman #define CS42L42_ASP_FSD_1_0		2
3332c394ca7SJames Schulman #define CS42L42_ASP_FSD_1_5		3
3342c394ca7SJames Schulman #define CS42L42_ASP_FSD_2_0		4
3352c394ca7SJames Schulman 
3362c394ca7SJames Schulman #define CS42L42_FS_RATE_EN		(CS42L42_PAGE_12 + 0x09)
3372c394ca7SJames Schulman #define CS42L42_FS_EN_SHIFT		0
3382c394ca7SJames Schulman #define CS42L42_FS_EN_MASK		(0xf << CS42L42_FS_EN_SHIFT)
3392c394ca7SJames Schulman #define CS42L42_FS_EN_IASRC_96K		0x1
3402c394ca7SJames Schulman #define CS42L42_FS_EN_OASRC_96K		0x2
3412c394ca7SJames Schulman 
3422c394ca7SJames Schulman #define CS42L42_IN_ASRC_CLK		(CS42L42_PAGE_12 + 0x0A)
3432c394ca7SJames Schulman #define CS42L42_CLK_IASRC_SEL_SHIFT	0
3442c394ca7SJames Schulman #define CS42L42_CLK_IASRC_SEL_MASK	(1 << CS42L42_CLK_IASRC_SEL_SHIFT)
3452c394ca7SJames Schulman #define CS42L42_CLK_IASRC_SEL_12	1
3462c394ca7SJames Schulman 
3472c394ca7SJames Schulman #define CS42L42_OUT_ASRC_CLK		(CS42L42_PAGE_12 + 0x0B)
3482c394ca7SJames Schulman #define CS42L42_CLK_OASRC_SEL_SHIFT	0
3492c394ca7SJames Schulman #define CS42L42_CLK_OASRC_SEL_MASK	(1 << CS42L42_CLK_OASRC_SEL_SHIFT)
3502c394ca7SJames Schulman #define CS42L42_CLK_OASRC_SEL_12	1
3512c394ca7SJames Schulman 
3522c394ca7SJames Schulman #define CS42L42_PLL_DIV_CFG1		(CS42L42_PAGE_12 + 0x0C)
3532c394ca7SJames Schulman #define CS42L42_SCLK_PREDIV_SHIFT	0
3542c394ca7SJames Schulman #define CS42L42_SCLK_PREDIV_MASK	(3 << CS42L42_SCLK_PREDIV_SHIFT)
3552c394ca7SJames Schulman 
3562c394ca7SJames Schulman /* Page 0x13 Interrupt Registers */
3572c394ca7SJames Schulman /* Interrupts */
3582c394ca7SJames Schulman #define CS42L42_ADC_OVFL_STATUS		(CS42L42_PAGE_13 + 0x01)
3592c394ca7SJames Schulman #define CS42L42_MIXER_STATUS		(CS42L42_PAGE_13 + 0x02)
3602c394ca7SJames Schulman #define CS42L42_SRC_STATUS		(CS42L42_PAGE_13 + 0x03)
3612c394ca7SJames Schulman #define CS42L42_ASP_RX_STATUS		(CS42L42_PAGE_13 + 0x04)
3622c394ca7SJames Schulman #define CS42L42_ASP_TX_STATUS		(CS42L42_PAGE_13 + 0x05)
3632c394ca7SJames Schulman #define CS42L42_CODEC_STATUS		(CS42L42_PAGE_13 + 0x08)
3642c394ca7SJames Schulman #define CS42L42_DET_INT_STATUS1		(CS42L42_PAGE_13 + 0x09)
3652c394ca7SJames Schulman #define CS42L42_DET_INT_STATUS2		(CS42L42_PAGE_13 + 0x0A)
3662c394ca7SJames Schulman #define CS42L42_SRCPL_INT_STATUS	(CS42L42_PAGE_13 + 0x0B)
3672c394ca7SJames Schulman #define CS42L42_VPMON_STATUS		(CS42L42_PAGE_13 + 0x0D)
3682c394ca7SJames Schulman #define CS42L42_PLL_LOCK_STATUS		(CS42L42_PAGE_13 + 0x0E)
3692c394ca7SJames Schulman #define CS42L42_TSRS_PLUG_STATUS	(CS42L42_PAGE_13 + 0x0F)
3702c394ca7SJames Schulman /* Masks */
3712c394ca7SJames Schulman #define CS42L42_ADC_OVFL_INT_MASK	(CS42L42_PAGE_13 + 0x16)
3722c394ca7SJames Schulman #define CS42L42_ADC_OVFL_SHIFT		0
3732c394ca7SJames Schulman #define CS42L42_ADC_OVFL_MASK		(1 << CS42L42_ADC_OVFL_SHIFT)
3742c394ca7SJames Schulman #define CS42L42_ADC_OVFL_VAL_MASK	CS42L42_ADC_OVFL_MASK
3752c394ca7SJames Schulman 
3762c394ca7SJames Schulman #define CS42L42_MIXER_INT_MASK		(CS42L42_PAGE_13 + 0x17)
3772c394ca7SJames Schulman #define CS42L42_MIX_CHB_OVFL_SHIFT	0
3782c394ca7SJames Schulman #define CS42L42_MIX_CHB_OVFL_MASK	(1 << CS42L42_MIX_CHB_OVFL_SHIFT)
3792c394ca7SJames Schulman #define CS42L42_MIX_CHA_OVFL_SHIFT	1
3802c394ca7SJames Schulman #define CS42L42_MIX_CHA_OVFL_MASK	(1 << CS42L42_MIX_CHA_OVFL_SHIFT)
3812c394ca7SJames Schulman #define CS42L42_EQ_OVFL_SHIFT		2
3822c394ca7SJames Schulman #define CS42L42_EQ_OVFL_MASK		(1 << CS42L42_EQ_OVFL_SHIFT)
3832c394ca7SJames Schulman #define CS42L42_EQ_BIQUAD_OVFL_SHIFT	3
3842c394ca7SJames Schulman #define CS42L42_EQ_BIQUAD_OVFL_MASK	(1 << CS42L42_EQ_BIQUAD_OVFL_SHIFT)
3852c394ca7SJames Schulman #define CS42L42_MIXER_VAL_MASK		(CS42L42_MIX_CHB_OVFL_MASK | \
3862c394ca7SJames Schulman 					CS42L42_MIX_CHA_OVFL_MASK | \
3872c394ca7SJames Schulman 					CS42L42_EQ_OVFL_MASK | \
3882c394ca7SJames Schulman 					CS42L42_EQ_BIQUAD_OVFL_MASK)
3892c394ca7SJames Schulman 
3902c394ca7SJames Schulman #define CS42L42_SRC_INT_MASK		(CS42L42_PAGE_13 + 0x18)
3912c394ca7SJames Schulman #define CS42L42_SRC_ILK_SHIFT		0
3922c394ca7SJames Schulman #define CS42L42_SRC_ILK_MASK		(1 << CS42L42_SRC_ILK_SHIFT)
3932c394ca7SJames Schulman #define CS42L42_SRC_OLK_SHIFT		1
3942c394ca7SJames Schulman #define CS42L42_SRC_OLK_MASK		(1 << CS42L42_SRC_OLK_SHIFT)
3952c394ca7SJames Schulman #define CS42L42_SRC_IUNLK_SHIFT		2
3962c394ca7SJames Schulman #define CS42L42_SRC_IUNLK_MASK		(1 << CS42L42_SRC_IUNLK_SHIFT)
3972c394ca7SJames Schulman #define CS42L42_SRC_OUNLK_SHIFT		3
3982c394ca7SJames Schulman #define CS42L42_SRC_OUNLK_MASK		(1 << CS42L42_SRC_OUNLK_SHIFT)
3992c394ca7SJames Schulman #define CS42L42_SRC_VAL_MASK		(CS42L42_SRC_ILK_MASK | \
4002c394ca7SJames Schulman 					CS42L42_SRC_OLK_MASK | \
4012c394ca7SJames Schulman 					CS42L42_SRC_IUNLK_MASK | \
4022c394ca7SJames Schulman 					CS42L42_SRC_OUNLK_MASK)
4032c394ca7SJames Schulman 
4042c394ca7SJames Schulman #define CS42L42_ASP_RX_INT_MASK		(CS42L42_PAGE_13 + 0x19)
4052c394ca7SJames Schulman #define CS42L42_ASPRX_NOLRCK_SHIFT	0
4062c394ca7SJames Schulman #define CS42L42_ASPRX_NOLRCK_MASK	(1 << CS42L42_ASPRX_NOLRCK_SHIFT)
4072c394ca7SJames Schulman #define CS42L42_ASPRX_EARLY_SHIFT	1
4082c394ca7SJames Schulman #define CS42L42_ASPRX_EARLY_MASK	(1 << CS42L42_ASPRX_EARLY_SHIFT)
4092c394ca7SJames Schulman #define CS42L42_ASPRX_LATE_SHIFT	2
4102c394ca7SJames Schulman #define CS42L42_ASPRX_LATE_MASK		(1 << CS42L42_ASPRX_LATE_SHIFT)
4112c394ca7SJames Schulman #define CS42L42_ASPRX_ERROR_SHIFT	3
4122c394ca7SJames Schulman #define CS42L42_ASPRX_ERROR_MASK	(1 << CS42L42_ASPRX_ERROR_SHIFT)
4132c394ca7SJames Schulman #define CS42L42_ASPRX_OVLD_SHIFT	4
4142c394ca7SJames Schulman #define CS42L42_ASPRX_OVLD_MASK		(1 << CS42L42_ASPRX_OVLD_SHIFT)
4152c394ca7SJames Schulman #define CS42L42_ASP_RX_VAL_MASK		(CS42L42_ASPRX_NOLRCK_MASK | \
4162c394ca7SJames Schulman 					CS42L42_ASPRX_EARLY_MASK | \
4172c394ca7SJames Schulman 					CS42L42_ASPRX_LATE_MASK | \
4182c394ca7SJames Schulman 					CS42L42_ASPRX_ERROR_MASK | \
4192c394ca7SJames Schulman 					CS42L42_ASPRX_OVLD_MASK)
4202c394ca7SJames Schulman 
4212c394ca7SJames Schulman #define CS42L42_ASP_TX_INT_MASK		(CS42L42_PAGE_13 + 0x1A)
4222c394ca7SJames Schulman #define CS42L42_ASPTX_NOLRCK_SHIFT	0
4232c394ca7SJames Schulman #define CS42L42_ASPTX_NOLRCK_MASK	(1 << CS42L42_ASPTX_NOLRCK_SHIFT)
4242c394ca7SJames Schulman #define CS42L42_ASPTX_EARLY_SHIFT	1
4252c394ca7SJames Schulman #define CS42L42_ASPTX_EARLY_MASK	(1 << CS42L42_ASPTX_EARLY_SHIFT)
4262c394ca7SJames Schulman #define CS42L42_ASPTX_LATE_SHIFT	2
4272c394ca7SJames Schulman #define CS42L42_ASPTX_LATE_MASK		(1 << CS42L42_ASPTX_LATE_SHIFT)
4282c394ca7SJames Schulman #define CS42L42_ASPTX_SMERROR_SHIFT	3
4292c394ca7SJames Schulman #define CS42L42_ASPTX_SMERROR_MASK	(1 << CS42L42_ASPTX_SMERROR_SHIFT)
4302c394ca7SJames Schulman #define CS42L42_ASP_TX_VAL_MASK		(CS42L42_ASPTX_NOLRCK_MASK | \
4312c394ca7SJames Schulman 					CS42L42_ASPTX_EARLY_MASK | \
4322c394ca7SJames Schulman 					CS42L42_ASPTX_LATE_MASK | \
4332c394ca7SJames Schulman 					CS42L42_ASPTX_SMERROR_MASK)
4342c394ca7SJames Schulman 
4352c394ca7SJames Schulman #define CS42L42_CODEC_INT_MASK		(CS42L42_PAGE_13 + 0x1B)
4362c394ca7SJames Schulman #define CS42L42_PDN_DONE_SHIFT		0
4372c394ca7SJames Schulman #define CS42L42_PDN_DONE_MASK		(1 << CS42L42_PDN_DONE_SHIFT)
4382c394ca7SJames Schulman #define CS42L42_HSDET_AUTO_DONE_SHIFT	1
4392c394ca7SJames Schulman #define CS42L42_HSDET_AUTO_DONE_MASK	(1 << CS42L42_HSDET_AUTO_DONE_SHIFT)
4402c394ca7SJames Schulman #define CS42L42_CODEC_VAL_MASK		(CS42L42_PDN_DONE_MASK | \
4412c394ca7SJames Schulman 					CS42L42_HSDET_AUTO_DONE_MASK)
4422c394ca7SJames Schulman 
4432c394ca7SJames Schulman #define CS42L42_SRCPL_INT_MASK		(CS42L42_PAGE_13 + 0x1C)
4442c394ca7SJames Schulman #define CS42L42_SRCPL_ADC_LK_SHIFT	0
4452c394ca7SJames Schulman #define CS42L42_SRCPL_ADC_LK_MASK	(1 << CS42L42_SRCPL_ADC_LK_SHIFT)
4462c394ca7SJames Schulman #define CS42L42_SRCPL_DAC_LK_SHIFT	2
4472c394ca7SJames Schulman #define CS42L42_SRCPL_DAC_LK_MASK	(1 << CS42L42_SRCPL_DAC_LK_SHIFT)
4482c394ca7SJames Schulman #define CS42L42_SRCPL_ADC_UNLK_SHIFT	5
4492c394ca7SJames Schulman #define CS42L42_SRCPL_ADC_UNLK_MASK	(1 << CS42L42_SRCPL_ADC_UNLK_SHIFT)
4502c394ca7SJames Schulman #define CS42L42_SRCPL_DAC_UNLK_SHIFT	6
4512c394ca7SJames Schulman #define CS42L42_SRCPL_DAC_UNLK_MASK	(1 << CS42L42_SRCPL_DAC_UNLK_SHIFT)
4522c394ca7SJames Schulman #define CS42L42_SRCPL_VAL_MASK		(CS42L42_SRCPL_ADC_LK_MASK | \
4532c394ca7SJames Schulman 					CS42L42_SRCPL_DAC_LK_MASK | \
4542c394ca7SJames Schulman 					CS42L42_SRCPL_ADC_UNLK_MASK | \
4552c394ca7SJames Schulman 					CS42L42_SRCPL_DAC_UNLK_MASK)
4562c394ca7SJames Schulman 
4572c394ca7SJames Schulman #define CS42L42_VPMON_INT_MASK		(CS42L42_PAGE_13 + 0x1E)
4582c394ca7SJames Schulman #define CS42L42_VPMON_SHIFT		0
4592c394ca7SJames Schulman #define CS42L42_VPMON_MASK		(1 << CS42L42_VPMON_SHIFT)
4602c394ca7SJames Schulman #define CS42L42_VPMON_VAL_MASK		CS42L42_VPMON_MASK
4612c394ca7SJames Schulman 
4622c394ca7SJames Schulman #define CS42L42_PLL_LOCK_INT_MASK	(CS42L42_PAGE_13 + 0x1F)
4632c394ca7SJames Schulman #define CS42L42_PLL_LOCK_SHIFT		0
4642c394ca7SJames Schulman #define CS42L42_PLL_LOCK_MASK		(1 << CS42L42_PLL_LOCK_SHIFT)
4652c394ca7SJames Schulman #define CS42L42_PLL_LOCK_VAL_MASK	CS42L42_PLL_LOCK_MASK
4662c394ca7SJames Schulman 
4672c394ca7SJames Schulman #define CS42L42_TSRS_PLUG_INT_MASK	(CS42L42_PAGE_13 + 0x20)
4682c394ca7SJames Schulman #define CS42L42_RS_PLUG_SHIFT		0
4692c394ca7SJames Schulman #define CS42L42_RS_PLUG_MASK		(1 << CS42L42_RS_PLUG_SHIFT)
4702c394ca7SJames Schulman #define CS42L42_RS_UNPLUG_SHIFT		1
4712c394ca7SJames Schulman #define CS42L42_RS_UNPLUG_MASK		(1 << CS42L42_RS_UNPLUG_SHIFT)
4722c394ca7SJames Schulman #define CS42L42_TS_PLUG_SHIFT		2
4732c394ca7SJames Schulman #define CS42L42_TS_PLUG_MASK		(1 << CS42L42_TS_PLUG_SHIFT)
4742c394ca7SJames Schulman #define CS42L42_TS_UNPLUG_SHIFT		3
4752c394ca7SJames Schulman #define CS42L42_TS_UNPLUG_MASK		(1 << CS42L42_TS_UNPLUG_SHIFT)
4762c394ca7SJames Schulman #define CS42L42_TSRS_PLUG_VAL_MASK	(CS42L42_RS_PLUG_MASK | \
4772c394ca7SJames Schulman 					CS42L42_RS_UNPLUG_MASK | \
4782c394ca7SJames Schulman 					CS42L42_TS_PLUG_MASK | \
4792c394ca7SJames Schulman 					CS42L42_TS_UNPLUG_MASK)
4802c394ca7SJames Schulman #define CS42L42_TS_PLUG			3
4812c394ca7SJames Schulman #define CS42L42_TS_UNPLUG		0
4822c394ca7SJames Schulman #define CS42L42_TS_TRANS		1
4832c394ca7SJames Schulman 
4842c394ca7SJames Schulman /* Page 0x15 Fractional-N PLL Registers */
4852c394ca7SJames Schulman #define CS42L42_PLL_CTL1		(CS42L42_PAGE_15 + 0x01)
4862c394ca7SJames Schulman #define CS42L42_PLL_START_SHIFT		0
4872c394ca7SJames Schulman #define CS42L42_PLL_START_MASK		(1 << CS42L42_PLL_START_SHIFT)
4882c394ca7SJames Schulman 
4892c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC0		(CS42L42_PAGE_15 + 0x02)
4902c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC_SHIFT	0
4912c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC_MASK	(0xff << CS42L42_PLL_DIV_FRAC_SHIFT)
4922c394ca7SJames Schulman 
4932c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC1		(CS42L42_PAGE_15 + 0x03)
4942c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC2		(CS42L42_PAGE_15 + 0x04)
4952c394ca7SJames Schulman 
4962c394ca7SJames Schulman #define CS42L42_PLL_DIV_INT		(CS42L42_PAGE_15 + 0x05)
4972c394ca7SJames Schulman #define CS42L42_PLL_DIV_INT_SHIFT	0
4982c394ca7SJames Schulman #define CS42L42_PLL_DIV_INT_MASK	(0xff << CS42L42_PLL_DIV_INT_SHIFT)
4992c394ca7SJames Schulman 
5002c394ca7SJames Schulman #define CS42L42_PLL_CTL3		(CS42L42_PAGE_15 + 0x08)
5012c394ca7SJames Schulman #define CS42L42_PLL_DIVOUT_SHIFT	0
5022c394ca7SJames Schulman #define CS42L42_PLL_DIVOUT_MASK		(0xff << CS42L42_PLL_DIVOUT_SHIFT)
5032c394ca7SJames Schulman 
5042c394ca7SJames Schulman #define CS42L42_PLL_CAL_RATIO		(CS42L42_PAGE_15 + 0x0A)
5052c394ca7SJames Schulman #define CS42L42_PLL_CAL_RATIO_SHIFT	0
5062c394ca7SJames Schulman #define CS42L42_PLL_CAL_RATIO_MASK	(0xff << CS42L42_PLL_CAL_RATIO_SHIFT)
5072c394ca7SJames Schulman 
5082c394ca7SJames Schulman #define CS42L42_PLL_CTL4		(CS42L42_PAGE_15 + 0x1B)
5092c394ca7SJames Schulman #define CS42L42_PLL_MODE_SHIFT		0
5102c394ca7SJames Schulman #define CS42L42_PLL_MODE_MASK		(3 << CS42L42_PLL_MODE_SHIFT)
5112c394ca7SJames Schulman 
5122c394ca7SJames Schulman /* Page 0x19 HP Load Detect Registers */
5132c394ca7SJames Schulman #define CS42L42_LOAD_DET_RCSTAT		(CS42L42_PAGE_19 + 0x25)
5142c394ca7SJames Schulman #define CS42L42_RLA_STAT_SHIFT		0
5152c394ca7SJames Schulman #define CS42L42_RLA_STAT_MASK		(3 << CS42L42_RLA_STAT_SHIFT)
5162c394ca7SJames Schulman #define CS42L42_RLA_STAT_15_OHM		0
5172c394ca7SJames Schulman 
5182c394ca7SJames Schulman #define CS42L42_LOAD_DET_DONE		(CS42L42_PAGE_19 + 0x26)
5192c394ca7SJames Schulman #define CS42L42_HPLOAD_DET_DONE_SHIFT	0
5202c394ca7SJames Schulman #define CS42L42_HPLOAD_DET_DONE_MASK	(1 << CS42L42_HPLOAD_DET_DONE_SHIFT)
5212c394ca7SJames Schulman 
5222c394ca7SJames Schulman #define CS42L42_LOAD_DET_EN		(CS42L42_PAGE_19 + 0x27)
5232c394ca7SJames Schulman #define CS42L42_HP_LD_EN_SHIFT		0
5242c394ca7SJames Schulman #define CS42L42_HP_LD_EN_MASK		(1 << CS42L42_HP_LD_EN_SHIFT)
5252c394ca7SJames Schulman 
5262c394ca7SJames Schulman /* Page 0x1B Headset Interface Registers */
5272c394ca7SJames Schulman #define CS42L42_HSBIAS_SC_AUTOCTL		(CS42L42_PAGE_1B + 0x70)
5282c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_TRIP_SHIFT		0
5292c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_TRIP_MASK		(7 << \
5302c394ca7SJames Schulman 					CS42L42_HSBIAS_SENSE_TRIP_SHIFT)
5312c394ca7SJames Schulman #define CS42L42_TIP_SENSE_EN_SHIFT		5
5322c394ca7SJames Schulman #define CS42L42_TIP_SENSE_EN_MASK		(1 << \
5332c394ca7SJames Schulman 					CS42L42_TIP_SENSE_EN_SHIFT)
5342c394ca7SJames Schulman #define CS42L42_AUTO_HSBIAS_HIZ_SHIFT		6
5352c394ca7SJames Schulman #define CS42L42_AUTO_HSBIAS_HIZ_MASK		(1 << \
5362c394ca7SJames Schulman 					CS42L42_AUTO_HSBIAS_HIZ_SHIFT)
5372c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_EN_SHIFT		7
5382c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_EN_MASK		(1 << \
5392c394ca7SJames Schulman 					CS42L42_HSBIAS_SENSE_EN_SHIFT)
5402c394ca7SJames Schulman 
5412c394ca7SJames Schulman #define CS42L42_WAKE_CTL		(CS42L42_PAGE_1B + 0x71)
5422c394ca7SJames Schulman #define CS42L42_WAKEB_CLEAR_SHIFT	0
5432c394ca7SJames Schulman #define CS42L42_WAKEB_CLEAR_MASK	(1 << CS42L42_WAKEB_CLEAR_SHIFT)
5442c394ca7SJames Schulman #define CS42L42_WAKEB_MODE_SHIFT	5
5452c394ca7SJames Schulman #define CS42L42_WAKEB_MODE_MASK		(1 << CS42L42_WAKEB_MODE_SHIFT)
5462c394ca7SJames Schulman #define CS42L42_M_HP_WAKE_SHIFT		6
5472c394ca7SJames Schulman #define CS42L42_M_HP_WAKE_MASK		(1 << CS42L42_M_HP_WAKE_SHIFT)
5482c394ca7SJames Schulman #define CS42L42_M_MIC_WAKE_SHIFT	7
5492c394ca7SJames Schulman #define CS42L42_M_MIC_WAKE_MASK		(1 << CS42L42_M_MIC_WAKE_SHIFT)
5502c394ca7SJames Schulman 
5512c394ca7SJames Schulman #define CS42L42_ADC_DISABLE_MUTE		(CS42L42_PAGE_1B + 0x72)
5522c394ca7SJames Schulman #define CS42L42_ADC_DISABLE_S0_MUTE_SHIFT	7
5532c394ca7SJames Schulman #define CS42L42_ADC_DISABLE_S0_MUTE_MASK	(1 << \
5542c394ca7SJames Schulman 					CS42L42_ADC_DISABLE_S0_MUTE_SHIFT)
5552c394ca7SJames Schulman 
5562c394ca7SJames Schulman #define CS42L42_TIPSENSE_CTL			(CS42L42_PAGE_1B + 0x73)
5572c394ca7SJames Schulman #define CS42L42_TIP_SENSE_DEBOUNCE_SHIFT	0
5582c394ca7SJames Schulman #define CS42L42_TIP_SENSE_DEBOUNCE_MASK		(3 << \
5592c394ca7SJames Schulman 					CS42L42_TIP_SENSE_DEBOUNCE_SHIFT)
5602c394ca7SJames Schulman #define CS42L42_TIP_SENSE_INV_SHIFT		5
5612c394ca7SJames Schulman #define CS42L42_TIP_SENSE_INV_MASK		(1 << \
5622c394ca7SJames Schulman 					CS42L42_TIP_SENSE_INV_SHIFT)
5632c394ca7SJames Schulman #define CS42L42_TIP_SENSE_CTRL_SHIFT		6
5642c394ca7SJames Schulman #define CS42L42_TIP_SENSE_CTRL_MASK		(3 << \
5652c394ca7SJames Schulman 					CS42L42_TIP_SENSE_CTRL_SHIFT)
5662c394ca7SJames Schulman 
5672c394ca7SJames Schulman #define CS42L42_MISC_DET_CTL		(CS42L42_PAGE_1B + 0x74)
5682c394ca7SJames Schulman #define CS42L42_PDN_MIC_LVL_DET_SHIFT	0
5692c394ca7SJames Schulman #define CS42L42_PDN_MIC_LVL_DET_MASK	(1 << CS42L42_PDN_MIC_LVL_DET_SHIFT)
5702c394ca7SJames Schulman #define CS42L42_HSBIAS_CTL_SHIFT	1
5712c394ca7SJames Schulman #define CS42L42_HSBIAS_CTL_MASK		(3 << CS42L42_HSBIAS_CTL_SHIFT)
5722c394ca7SJames Schulman #define CS42L42_DETECT_MODE_SHIFT	3
5732c394ca7SJames Schulman #define CS42L42_DETECT_MODE_MASK	(3 << CS42L42_DETECT_MODE_SHIFT)
5742c394ca7SJames Schulman 
5752c394ca7SJames Schulman #define CS42L42_MIC_DET_CTL1		(CS42L42_PAGE_1B + 0x75)
5762c394ca7SJames Schulman #define CS42L42_HS_DET_LEVEL_SHIFT	0
5772c394ca7SJames Schulman #define CS42L42_HS_DET_LEVEL_MASK	(0x3F << CS42L42_HS_DET_LEVEL_SHIFT)
5782c394ca7SJames Schulman #define CS42L42_EVENT_STAT_SEL_SHIFT	6
5792c394ca7SJames Schulman #define CS42L42_EVENT_STAT_SEL_MASK	(1 << CS42L42_EVENT_STAT_SEL_SHIFT)
5802c394ca7SJames Schulman #define CS42L42_LATCH_TO_VP_SHIFT	7
5812c394ca7SJames Schulman #define CS42L42_LATCH_TO_VP_MASK	(1 << CS42L42_LATCH_TO_VP_SHIFT)
5822c394ca7SJames Schulman 
5832c394ca7SJames Schulman #define CS42L42_MIC_DET_CTL2		(CS42L42_PAGE_1B + 0x76)
5842c394ca7SJames Schulman #define CS42L42_DEBOUNCE_TIME_SHIFT	5
5852c394ca7SJames Schulman #define CS42L42_DEBOUNCE_TIME_MASK	(0x07 << CS42L42_DEBOUNCE_TIME_SHIFT)
5862c394ca7SJames Schulman 
5872c394ca7SJames Schulman #define CS42L42_DET_STATUS1		(CS42L42_PAGE_1B + 0x77)
5882c394ca7SJames Schulman #define CS42L42_HSBIAS_HIZ_MODE_SHIFT	6
5892c394ca7SJames Schulman #define CS42L42_HSBIAS_HIZ_MODE_MASK	(1 << CS42L42_HSBIAS_HIZ_MODE_SHIFT)
5902c394ca7SJames Schulman #define CS42L42_TIP_SENSE_SHIFT		7
5912c394ca7SJames Schulman #define CS42L42_TIP_SENSE_MASK		(1 << CS42L42_TIP_SENSE_SHIFT)
5922c394ca7SJames Schulman 
5932c394ca7SJames Schulman #define CS42L42_DET_STATUS2		(CS42L42_PAGE_1B + 0x78)
5942c394ca7SJames Schulman #define CS42L42_SHORT_TRUE_SHIFT	0
5952c394ca7SJames Schulman #define CS42L42_SHORT_TRUE_MASK		(1 << CS42L42_SHORT_TRUE_SHIFT)
5962c394ca7SJames Schulman #define CS42L42_HS_TRUE_SHIFT	1
5972c394ca7SJames Schulman #define CS42L42_HS_TRUE_MASK		(1 << CS42L42_HS_TRUE_SHIFT)
5982c394ca7SJames Schulman 
5992c394ca7SJames Schulman #define CS42L42_DET_INT1_MASK		(CS42L42_PAGE_1B + 0x79)
6002c394ca7SJames Schulman #define CS42L42_TIP_SENSE_UNPLUG_SHIFT	5
6012c394ca7SJames Schulman #define CS42L42_TIP_SENSE_UNPLUG_MASK	(1 << CS42L42_TIP_SENSE_UNPLUG_SHIFT)
6022c394ca7SJames Schulman #define CS42L42_TIP_SENSE_PLUG_SHIFT	6
6032c394ca7SJames Schulman #define CS42L42_TIP_SENSE_PLUG_MASK	(1 << CS42L42_TIP_SENSE_PLUG_SHIFT)
6042c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_SHIFT	7
6052c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_MASK	(1 << CS42L42_HSBIAS_SENSE_SHIFT)
6062c394ca7SJames Schulman #define CS42L42_DET_INT_VAL1_MASK	(CS42L42_TIP_SENSE_UNPLUG_MASK | \
6072c394ca7SJames Schulman 					CS42L42_TIP_SENSE_PLUG_MASK | \
6082c394ca7SJames Schulman 					CS42L42_HSBIAS_SENSE_MASK)
6092c394ca7SJames Schulman 
6102c394ca7SJames Schulman #define CS42L42_DET_INT2_MASK		(CS42L42_PAGE_1B + 0x7A)
6112c394ca7SJames Schulman #define CS42L42_M_SHORT_DET_SHIFT	0
6122c394ca7SJames Schulman #define CS42L42_M_SHORT_DET_MASK	(1 << \
6132c394ca7SJames Schulman 					CS42L42_M_SHORT_DET_SHIFT)
6142c394ca7SJames Schulman #define CS42L42_M_SHORT_RLS_SHIFT	1
6152c394ca7SJames Schulman #define CS42L42_M_SHORT_RLS_MASK	(1 << \
6162c394ca7SJames Schulman 					CS42L42_M_SHORT_RLS_SHIFT)
6172c394ca7SJames Schulman #define CS42L42_M_HSBIAS_HIZ_SHIFT	2
6182c394ca7SJames Schulman #define CS42L42_M_HSBIAS_HIZ_MASK	(1 << \
6192c394ca7SJames Schulman 					CS42L42_M_HSBIAS_HIZ_SHIFT)
6202c394ca7SJames Schulman #define CS42L42_M_DETECT_FT_SHIFT	6
6212c394ca7SJames Schulman #define CS42L42_M_DETECT_FT_MASK	(1 << \
6222c394ca7SJames Schulman 					CS42L42_M_DETECT_FT_SHIFT)
6232c394ca7SJames Schulman #define CS42L42_M_DETECT_TF_SHIFT	7
6242c394ca7SJames Schulman #define CS42L42_M_DETECT_TF_MASK	(1 << \
6252c394ca7SJames Schulman 					CS42L42_M_DETECT_TF_SHIFT)
6262c394ca7SJames Schulman #define CS42L42_DET_INT_VAL2_MASK	(CS42L42_M_SHORT_DET_MASK | \
6272c394ca7SJames Schulman 					CS42L42_M_SHORT_RLS_MASK | \
6282c394ca7SJames Schulman 					CS42L42_M_HSBIAS_HIZ_MASK | \
6292c394ca7SJames Schulman 					CS42L42_M_DETECT_FT_MASK | \
6302c394ca7SJames Schulman 					CS42L42_M_DETECT_TF_MASK)
6312c394ca7SJames Schulman 
6322c394ca7SJames Schulman /* Page 0x1C Headset Bias Registers */
6332c394ca7SJames Schulman #define CS42L42_HS_BIAS_CTL		(CS42L42_PAGE_1C + 0x03)
6342c394ca7SJames Schulman #define CS42L42_HSBIAS_RAMP_SHIFT	0
6352c394ca7SJames Schulman #define CS42L42_HSBIAS_RAMP_MASK	(3 << CS42L42_HSBIAS_RAMP_SHIFT)
6362c394ca7SJames Schulman #define CS42L42_HSBIAS_PD_SHIFT		4
6372c394ca7SJames Schulman #define CS42L42_HSBIAS_PD_MASK		(1 << CS42L42_HSBIAS_PD_SHIFT)
6382c394ca7SJames Schulman #define CS42L42_HSBIAS_CAPLESS_SHIFT	7
6392c394ca7SJames Schulman #define CS42L42_HSBIAS_CAPLESS_MASK	(1 << CS42L42_HSBIAS_CAPLESS_SHIFT)
6402c394ca7SJames Schulman 
6412c394ca7SJames Schulman /* Page 0x1D ADC Registers */
6422c394ca7SJames Schulman #define CS42L42_ADC_CTL			(CS42L42_PAGE_1D + 0x01)
6432c394ca7SJames Schulman #define CS42L42_ADC_NOTCH_DIS_SHIFT		5
6442c394ca7SJames Schulman #define CS42L42_ADC_FORCE_WEAK_VCM_SHIFT	4
6452c394ca7SJames Schulman #define CS42L42_ADC_INV_SHIFT			2
6462c394ca7SJames Schulman #define CS42L42_ADC_DIG_BOOST_SHIFT		0
6472c394ca7SJames Schulman 
6482c394ca7SJames Schulman #define CS42L42_ADC_VOLUME		(CS42L42_PAGE_1D + 0x03)
6492c394ca7SJames Schulman #define CS42L42_ADC_VOL_SHIFT		0
6502c394ca7SJames Schulman 
6512c394ca7SJames Schulman #define CS42L42_ADC_WNF_HPF_CTL		(CS42L42_PAGE_1D + 0x04)
6522c394ca7SJames Schulman #define CS42L42_ADC_WNF_CF_SHIFT	4
6532c394ca7SJames Schulman #define CS42L42_ADC_WNF_EN_SHIFT	3
6542c394ca7SJames Schulman #define CS42L42_ADC_HPF_CF_SHIFT	1
6552c394ca7SJames Schulman #define CS42L42_ADC_HPF_EN_SHIFT	0
6562c394ca7SJames Schulman 
6572c394ca7SJames Schulman /* Page 0x1F DAC Registers */
6582c394ca7SJames Schulman #define CS42L42_DAC_CTL1		(CS42L42_PAGE_1F + 0x01)
6592c394ca7SJames Schulman #define CS42L42_DACB_INV_SHIFT		1
6602c394ca7SJames Schulman #define CS42L42_DACA_INV_SHIFT		0
6612c394ca7SJames Schulman 
6622c394ca7SJames Schulman #define CS42L42_DAC_CTL2		(CS42L42_PAGE_1F + 0x06)
6632c394ca7SJames Schulman #define CS42L42_HPOUT_PULLDOWN_SHIFT	4
6642c394ca7SJames Schulman #define CS42L42_HPOUT_PULLDOWN_MASK	(15 << CS42L42_HPOUT_PULLDOWN_SHIFT)
6652c394ca7SJames Schulman #define CS42L42_HPOUT_LOAD_SHIFT	3
6662c394ca7SJames Schulman #define CS42L42_HPOUT_LOAD_MASK		(1 << CS42L42_HPOUT_LOAD_SHIFT)
6672c394ca7SJames Schulman #define CS42L42_HPOUT_CLAMP_SHIFT	2
6682c394ca7SJames Schulman #define CS42L42_HPOUT_CLAMP_MASK	(1 << CS42L42_HPOUT_CLAMP_SHIFT)
6692c394ca7SJames Schulman #define CS42L42_DAC_HPF_EN_SHIFT	1
6702c394ca7SJames Schulman #define CS42L42_DAC_HPF_EN_MASK		(1 << CS42L42_DAC_HPF_EN_SHIFT)
6712c394ca7SJames Schulman #define CS42L42_DAC_MON_EN_SHIFT	0
6722c394ca7SJames Schulman #define CS42L42_DAC_MON_EN_MASK		(1 << CS42L42_DAC_MON_EN_SHIFT)
6732c394ca7SJames Schulman 
6742c394ca7SJames Schulman /* Page 0x20 HP CTL Registers */
6752c394ca7SJames Schulman #define CS42L42_HP_CTL			(CS42L42_PAGE_20 + 0x01)
6762c394ca7SJames Schulman #define CS42L42_HP_ANA_BMUTE_SHIFT	3
6772c394ca7SJames Schulman #define CS42L42_HP_ANA_BMUTE_MASK	(1 << CS42L42_HP_ANA_BMUTE_SHIFT)
6782c394ca7SJames Schulman #define CS42L42_HP_ANA_AMUTE_SHIFT	2
6792c394ca7SJames Schulman #define CS42L42_HP_ANA_AMUTE_MASK	(1 << CS42L42_HP_ANA_AMUTE_SHIFT)
6802c394ca7SJames Schulman #define CS42L42_HP_FULL_SCALE_VOL_SHIFT	1
6812c394ca7SJames Schulman #define CS42L42_HP_FULL_SCALE_VOL_MASK	(1 << CS42L42_HP_FULL_SCALE_VOL_SHIFT)
6822c394ca7SJames Schulman 
6832c394ca7SJames Schulman /* Page 0x21 Class H Registers */
6842c394ca7SJames Schulman #define CS42L42_CLASSH_CTL		(CS42L42_PAGE_21 + 0x01)
6852c394ca7SJames Schulman 
6862c394ca7SJames Schulman /* Page 0x23 Mixer Volume Registers */
6872c394ca7SJames Schulman #define CS42L42_MIXER_CHA_VOL		(CS42L42_PAGE_23 + 0x01)
6882c394ca7SJames Schulman #define CS42L42_MIXER_ADC_VOL		(CS42L42_PAGE_23 + 0x02)
6892c394ca7SJames Schulman 
6902c394ca7SJames Schulman #define CS42L42_MIXER_CHB_VOL		(CS42L42_PAGE_23 + 0x03)
6912c394ca7SJames Schulman #define CS42L42_MIXER_CH_VOL_SHIFT	0
6922c394ca7SJames Schulman #define CS42L42_MIXER_CH_VOL_MASK	(0x3f << CS42L42_MIXER_CH_VOL_SHIFT)
6932c394ca7SJames Schulman 
6942c394ca7SJames Schulman /* Page 0x24 EQ Registers */
6952c394ca7SJames Schulman #define CS42L42_EQ_COEF_IN0		(CS42L42_PAGE_24 + 0x01)
6962c394ca7SJames Schulman #define CS42L42_EQ_COEF_IN1		(CS42L42_PAGE_24 + 0x02)
6972c394ca7SJames Schulman #define CS42L42_EQ_COEF_IN2		(CS42L42_PAGE_24 + 0x03)
6982c394ca7SJames Schulman #define CS42L42_EQ_COEF_IN3		(CS42L42_PAGE_24 + 0x04)
6992c394ca7SJames Schulman #define CS42L42_EQ_COEF_RW		(CS42L42_PAGE_24 + 0x06)
7002c394ca7SJames Schulman #define CS42L42_EQ_COEF_OUT0		(CS42L42_PAGE_24 + 0x07)
7012c394ca7SJames Schulman #define CS42L42_EQ_COEF_OUT1		(CS42L42_PAGE_24 + 0x08)
7022c394ca7SJames Schulman #define CS42L42_EQ_COEF_OUT2		(CS42L42_PAGE_24 + 0x09)
7032c394ca7SJames Schulman #define CS42L42_EQ_COEF_OUT3		(CS42L42_PAGE_24 + 0x0A)
7042c394ca7SJames Schulman #define CS42L42_EQ_INIT_STAT		(CS42L42_PAGE_24 + 0x0B)
7052c394ca7SJames Schulman #define CS42L42_EQ_START_FILT		(CS42L42_PAGE_24 + 0x0C)
7062c394ca7SJames Schulman #define CS42L42_EQ_MUTE_CTL		(CS42L42_PAGE_24 + 0x0E)
7072c394ca7SJames Schulman 
7082c394ca7SJames Schulman /* Page 0x25 Audio Port Registers */
7092c394ca7SJames Schulman #define CS42L42_SP_RX_CH_SEL		(CS42L42_PAGE_25 + 0x01)
710e5ada3f6SRichard Fitzgerald #define CS42L42_SP_RX_CHB_SEL_SHIFT	2
711e5ada3f6SRichard Fitzgerald #define CS42L42_SP_RX_CHB_SEL_MASK	(3 << CS42L42_SP_RX_CHB_SEL_SHIFT)
7122c394ca7SJames Schulman 
7132c394ca7SJames Schulman #define CS42L42_SP_RX_ISOC_CTL		(CS42L42_PAGE_25 + 0x02)
7142c394ca7SJames Schulman #define CS42L42_SP_RX_RSYNC_SHIFT	6
7152c394ca7SJames Schulman #define CS42L42_SP_RX_RSYNC_MASK	(1 << CS42L42_SP_RX_RSYNC_SHIFT)
7162c394ca7SJames Schulman #define CS42L42_SP_RX_NSB_POS_SHIFT	3
7172c394ca7SJames Schulman #define CS42L42_SP_RX_NSB_POS_MASK	(7 << CS42L42_SP_RX_NSB_POS_SHIFT)
7182c394ca7SJames Schulman #define CS42L42_SP_RX_NFS_NSBB_SHIFT	2
7192c394ca7SJames Schulman #define CS42L42_SP_RX_NFS_NSBB_MASK	(1 << CS42L42_SP_RX_NFS_NSBB_SHIFT)
7202c394ca7SJames Schulman #define CS42L42_SP_RX_ISOC_MODE_SHIFT	0
7212c394ca7SJames Schulman #define CS42L42_SP_RX_ISOC_MODE_MASK	(3 << CS42L42_SP_RX_ISOC_MODE_SHIFT)
7222c394ca7SJames Schulman 
7232c394ca7SJames Schulman #define CS42L42_SP_RX_FS		(CS42L42_PAGE_25 + 0x03)
7242c394ca7SJames Schulman #define CS42l42_SPDIF_CH_SEL		(CS42L42_PAGE_25 + 0x04)
7252c394ca7SJames Schulman #define CS42L42_SP_TX_ISOC_CTL		(CS42L42_PAGE_25 + 0x05)
7262c394ca7SJames Schulman #define CS42L42_SP_TX_FS		(CS42L42_PAGE_25 + 0x06)
7272c394ca7SJames Schulman #define CS42L42_SPDIF_SW_CTL1		(CS42L42_PAGE_25 + 0x07)
7282c394ca7SJames Schulman 
7292c394ca7SJames Schulman /* Page 0x26 SRC Registers */
7302c394ca7SJames Schulman #define CS42L42_SRC_SDIN_FS		(CS42L42_PAGE_26 + 0x01)
7312c394ca7SJames Schulman #define CS42L42_SRC_SDIN_FS_SHIFT	0
7322c394ca7SJames Schulman #define CS42L42_SRC_SDIN_FS_MASK	(0x1f << CS42L42_SRC_SDIN_FS_SHIFT)
7332c394ca7SJames Schulman 
7342c394ca7SJames Schulman #define CS42L42_SRC_SDOUT_FS		(CS42L42_PAGE_26 + 0x09)
7352c394ca7SJames Schulman 
7362c394ca7SJames Schulman /* Page 0x28 S/PDIF Registers */
7372c394ca7SJames Schulman #define CS42L42_SPDIF_CTL1		(CS42L42_PAGE_28 + 0x01)
7382c394ca7SJames Schulman #define CS42L42_SPDIF_CTL2		(CS42L42_PAGE_28 + 0x02)
7392c394ca7SJames Schulman #define CS42L42_SPDIF_CTL3		(CS42L42_PAGE_28 + 0x03)
7402c394ca7SJames Schulman #define CS42L42_SPDIF_CTL4		(CS42L42_PAGE_28 + 0x04)
7412c394ca7SJames Schulman 
7422c394ca7SJames Schulman /* Page 0x29 Serial Port TX Registers */
7432c394ca7SJames Schulman #define CS42L42_ASP_TX_SZ_EN		(CS42L42_PAGE_29 + 0x01)
744585e7079SLucas Tanure #define CS42L42_ASP_TX_EN_SHIFT		0
7452c394ca7SJames Schulman #define CS42L42_ASP_TX_CH_EN		(CS42L42_PAGE_29 + 0x02)
746585e7079SLucas Tanure #define CS42L42_ASP_TX0_CH2_SHIFT	1
747585e7079SLucas Tanure #define CS42L42_ASP_TX0_CH1_SHIFT	0
748585e7079SLucas Tanure 
7492c394ca7SJames Schulman #define CS42L42_ASP_TX_CH_AP_RES	(CS42L42_PAGE_29 + 0x03)
750585e7079SLucas Tanure #define CS42L42_ASP_TX_CH1_AP_SHIFT	7
751585e7079SLucas Tanure #define CS42L42_ASP_TX_CH1_AP_MASK	(1 << CS42L42_ASP_TX_CH1_AP_SHIFT)
752585e7079SLucas Tanure #define CS42L42_ASP_TX_CH2_AP_SHIFT	6
753585e7079SLucas Tanure #define CS42L42_ASP_TX_CH2_AP_MASK	(1 << CS42L42_ASP_TX_CH2_AP_SHIFT)
754585e7079SLucas Tanure #define CS42L42_ASP_TX_CH2_RES_SHIFT	2
755585e7079SLucas Tanure #define CS42L42_ASP_TX_CH2_RES_MASK	(3 << CS42L42_ASP_TX_CH2_RES_SHIFT)
756585e7079SLucas Tanure #define CS42L42_ASP_TX_CH1_RES_SHIFT	0
757585e7079SLucas Tanure #define CS42L42_ASP_TX_CH1_RES_MASK	(3 << CS42L42_ASP_TX_CH1_RES_SHIFT)
7582c394ca7SJames Schulman #define CS42L42_ASP_TX_CH1_BIT_MSB	(CS42L42_PAGE_29 + 0x04)
7592c394ca7SJames Schulman #define CS42L42_ASP_TX_CH1_BIT_LSB	(CS42L42_PAGE_29 + 0x05)
7602c394ca7SJames Schulman #define CS42L42_ASP_TX_HIZ_DLY_CFG	(CS42L42_PAGE_29 + 0x06)
7612c394ca7SJames Schulman #define CS42L42_ASP_TX_CH2_BIT_MSB	(CS42L42_PAGE_29 + 0x0A)
7622c394ca7SJames Schulman #define CS42L42_ASP_TX_CH2_BIT_LSB	(CS42L42_PAGE_29 + 0x0B)
7632c394ca7SJames Schulman 
7642c394ca7SJames Schulman /* Page 0x2A Serial Port RX Registers */
7652c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_EN		(CS42L42_PAGE_2A + 0x01)
7662c394ca7SJames Schulman #define CS42L42_ASP_RX0_CH_EN_SHIFT	2
7672c394ca7SJames Schulman #define CS42L42_ASP_RX0_CH_EN_MASK	(0xf << CS42L42_ASP_RX0_CH_EN_SHIFT)
768621d65f3SLucas Tanure #define CS42L42_ASP_RX0_CH1_SHIFT	2
769621d65f3SLucas Tanure #define CS42L42_ASP_RX0_CH2_SHIFT	3
770621d65f3SLucas Tanure #define CS42L42_ASP_RX0_CH3_SHIFT	4
771621d65f3SLucas Tanure #define CS42L42_ASP_RX0_CH4_SHIFT	5
7722c394ca7SJames Schulman 
7732c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH1_AP_RES	(CS42L42_PAGE_2A + 0x02)
7742c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH1_BIT_MSB	(CS42L42_PAGE_2A + 0x03)
7752c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH1_BIT_LSB	(CS42L42_PAGE_2A + 0x04)
7762c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH2_AP_RES	(CS42L42_PAGE_2A + 0x05)
7772c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH2_BIT_MSB	(CS42L42_PAGE_2A + 0x06)
7782c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH2_BIT_LSB	(CS42L42_PAGE_2A + 0x07)
7792c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH3_AP_RES	(CS42L42_PAGE_2A + 0x08)
7802c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH3_BIT_MSB	(CS42L42_PAGE_2A + 0x09)
7812c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH3_BIT_LSB	(CS42L42_PAGE_2A + 0x0A)
7822c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH4_AP_RES	(CS42L42_PAGE_2A + 0x0B)
7832c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH4_BIT_MSB	(CS42L42_PAGE_2A + 0x0C)
7842c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH4_BIT_LSB	(CS42L42_PAGE_2A + 0x0D)
7852c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH1_AP_RES	(CS42L42_PAGE_2A + 0x0E)
7862c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH1_BIT_MSB	(CS42L42_PAGE_2A + 0x0F)
7872c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH1_BIT_LSB	(CS42L42_PAGE_2A + 0x10)
7882c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH2_AP_RES	(CS42L42_PAGE_2A + 0x11)
7892c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH2_BIT_MSB	(CS42L42_PAGE_2A + 0x12)
7902c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH2_BIT_LSB	(CS42L42_PAGE_2A + 0x13)
7912c394ca7SJames Schulman 
7922c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_AP_SHIFT	6
7932c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_AP_MASK	(1 << CS42L42_ASP_RX_CH_AP_SHIFT)
7942c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_AP_LOW	0
7952c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_AP_HI		1
7962c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_RES_SHIFT	0
7972c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_RES_MASK	(3 << CS42L42_ASP_RX_CH_RES_SHIFT)
7982c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_RES_32	3
7992c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_RES_16	1
8002c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_BIT_ST_SHIFT	0
8012c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_BIT_ST_MASK	(0xff << CS42L42_ASP_RX_CH_BIT_ST_SHIFT)
8022c394ca7SJames Schulman 
8032c394ca7SJames Schulman /* Page 0x30 ID Registers */
8042c394ca7SJames Schulman #define CS42L42_SUB_REVID		(CS42L42_PAGE_30 + 0x14)
8052c394ca7SJames Schulman #define CS42L42_MAX_REGISTER		(CS42L42_PAGE_30 + 0x14)
8062c394ca7SJames Schulman 
8072c394ca7SJames Schulman /* Defines for fracturing values spread across multiple registers */
8082c394ca7SJames Schulman #define CS42L42_FRAC0_VAL(val)	((val) & 0x0000ff)
8092c394ca7SJames Schulman #define CS42L42_FRAC1_VAL(val)	(((val) & 0x00ff00) >> 8)
8102c394ca7SJames Schulman #define CS42L42_FRAC2_VAL(val)	(((val) & 0xff0000) >> 16)
8112c394ca7SJames Schulman 
8122c394ca7SJames Schulman #define CS42L42_NUM_SUPPLIES	5
81319325cfeSLucas Tanure #define CS42L42_BOOT_TIME_US	3000
8141c52825cSLucas Tanure #define CS42L42_PLL_DIVOUT_TIME_US	800
8150ea23660SRichard Fitzgerald #define CS42L42_CLOCK_SWITCH_DELAY_US 150
816b7d00776SRichard Fitzgerald #define CS42L42_PLL_LOCK_POLL_US	250
817b7d00776SRichard Fitzgerald #define CS42L42_PLL_LOCK_TIMEOUT_US	1250
8182c394ca7SJames Schulman 
8192c394ca7SJames Schulman static const char *const cs42l42_supply_names[CS42L42_NUM_SUPPLIES] = {
8202c394ca7SJames Schulman 	"VA",
8212c394ca7SJames Schulman 	"VP",
8222c394ca7SJames Schulman 	"VCP",
8232c394ca7SJames Schulman 	"VD_FILT",
8242c394ca7SJames Schulman 	"VL",
8252c394ca7SJames Schulman };
8262c394ca7SJames Schulman 
8272c394ca7SJames Schulman struct  cs42l42_private {
8282c394ca7SJames Schulman 	struct regmap *regmap;
829c9261402SKuninori Morimoto 	struct snd_soc_component *component;
8302c394ca7SJames Schulman 	struct regulator_bulk_data supplies[CS42L42_NUM_SUPPLIES];
8312c394ca7SJames Schulman 	struct gpio_desc *reset_gpio;
8322c394ca7SJames Schulman 	struct completion pdn_done;
833c26a5289SLucas Tanure 	struct snd_soc_jack *jack;
834f1040e86SRichard Fitzgerald 	int pll_config;
8352cdba9b0SLucas Tanure 	int bclk;
8362c394ca7SJames Schulman 	u32 sclk;
8372c394ca7SJames Schulman 	u32 srate;
8381c52825cSLucas Tanure 	u8 pll_divout;
8392c394ca7SJames Schulman 	u8 plug_state;
8402c394ca7SJames Schulman 	u8 hs_type;
8412c394ca7SJames Schulman 	u8 ts_inv;
8422c394ca7SJames Schulman 	u8 ts_dbnc_rise;
8432c394ca7SJames Schulman 	u8 ts_dbnc_fall;
8442c394ca7SJames Schulman 	u8 btn_det_init_dbnce;
8452c394ca7SJames Schulman 	u8 btn_det_event_dbnce;
8462c394ca7SJames Schulman 	u8 bias_thresholds[CS42L42_NUM_BIASES];
8472c394ca7SJames Schulman 	u8 hs_bias_ramp_rate;
8482c394ca7SJames Schulman 	u8 hs_bias_ramp_time;
849c9f2e3c3SVitaly Rodionov 	u8 hs_bias_sense_en;
85043fc3571SLucas Tanure 	u8 stream_use;
8512c394ca7SJames Schulman };
8522c394ca7SJames Schulman 
8532c394ca7SJames Schulman #endif /* __CS42L42_H__ */
854