xref: /linux/sound/soc/codecs/da7219.h (revision 2874c5fd284268364ece81a7bd936f3c8168e567)
1*2874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
26d817c0eSAdam Thomson /*
36d817c0eSAdam Thomson  * da7219.h - DA7219 ALSA SoC Codec Driver
46d817c0eSAdam Thomson  *
56d817c0eSAdam Thomson  * Copyright (c) 2015 Dialog Semiconductor
66d817c0eSAdam Thomson  *
76d817c0eSAdam Thomson  * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
86d817c0eSAdam Thomson  */
96d817c0eSAdam Thomson 
106d817c0eSAdam Thomson #ifndef __DA7219_H
116d817c0eSAdam Thomson #define __DA7219_H
126d817c0eSAdam Thomson 
13fc8f7ea2SAdam Thomson #include <linux/clk.h>
14fc8f7ea2SAdam Thomson #include <linux/clkdev.h>
15fc8f7ea2SAdam Thomson #include <linux/clk-provider.h>
166d817c0eSAdam Thomson #include <linux/regmap.h>
176d817c0eSAdam Thomson #include <linux/regulator/consumer.h>
186d817c0eSAdam Thomson #include <sound/da7219.h>
196d817c0eSAdam Thomson 
206d817c0eSAdam Thomson /*
216d817c0eSAdam Thomson  * Registers
226d817c0eSAdam Thomson  */
236d817c0eSAdam Thomson 
246d817c0eSAdam Thomson #define DA7219_MIC_1_GAIN_STATUS	0x6
256d817c0eSAdam Thomson #define DA7219_MIXIN_L_GAIN_STATUS	0x8
266d817c0eSAdam Thomson #define DA7219_ADC_L_GAIN_STATUS	0xA
276d817c0eSAdam Thomson #define DA7219_DAC_L_GAIN_STATUS	0xC
286d817c0eSAdam Thomson #define DA7219_DAC_R_GAIN_STATUS	0xD
296d817c0eSAdam Thomson #define DA7219_HP_L_GAIN_STATUS		0xE
306d817c0eSAdam Thomson #define DA7219_HP_R_GAIN_STATUS		0xF
316d817c0eSAdam Thomson #define DA7219_MIC_1_SELECT		0x10
326d817c0eSAdam Thomson #define DA7219_CIF_TIMEOUT_CTRL		0x12
336d817c0eSAdam Thomson #define DA7219_CIF_CTRL			0x13
346d817c0eSAdam Thomson #define DA7219_SR_24_48			0x16
356d817c0eSAdam Thomson #define DA7219_SR			0x17
366d817c0eSAdam Thomson #define DA7219_CIF_I2C_ADDR_CFG		0x1B
376d817c0eSAdam Thomson #define DA7219_PLL_CTRL			0x20
386d817c0eSAdam Thomson #define DA7219_PLL_FRAC_TOP		0x22
396d817c0eSAdam Thomson #define DA7219_PLL_FRAC_BOT		0x23
406d817c0eSAdam Thomson #define DA7219_PLL_INTEGER		0x24
416d817c0eSAdam Thomson #define DA7219_PLL_SRM_STS		0x25
426d817c0eSAdam Thomson #define DA7219_DIG_ROUTING_DAI		0x2A
436d817c0eSAdam Thomson #define DA7219_DAI_CLK_MODE		0x2B
446d817c0eSAdam Thomson #define DA7219_DAI_CTRL			0x2C
456d817c0eSAdam Thomson #define DA7219_DAI_TDM_CTRL		0x2D
466d817c0eSAdam Thomson #define DA7219_DIG_ROUTING_DAC		0x2E
476d817c0eSAdam Thomson #define DA7219_ALC_CTRL1		0x2F
486d817c0eSAdam Thomson #define DA7219_DAI_OFFSET_LOWER		0x30
496d817c0eSAdam Thomson #define DA7219_DAI_OFFSET_UPPER		0x31
506d817c0eSAdam Thomson #define DA7219_REFERENCES		0x32
516d817c0eSAdam Thomson #define DA7219_MIXIN_L_SELECT		0x33
526d817c0eSAdam Thomson #define DA7219_MIXIN_L_GAIN		0x34
536d817c0eSAdam Thomson #define DA7219_ADC_L_GAIN		0x36
546d817c0eSAdam Thomson #define DA7219_ADC_FILTERS1		0x38
556d817c0eSAdam Thomson #define DA7219_MIC_1_GAIN		0x39
566d817c0eSAdam Thomson #define DA7219_SIDETONE_CTRL		0x3A
576d817c0eSAdam Thomson #define DA7219_SIDETONE_GAIN		0x3B
586d817c0eSAdam Thomson #define DA7219_DROUTING_ST_OUTFILT_1L	0x3C
596d817c0eSAdam Thomson #define DA7219_DROUTING_ST_OUTFILT_1R	0x3D
606d817c0eSAdam Thomson #define DA7219_DAC_FILTERS5		0x40
616d817c0eSAdam Thomson #define DA7219_DAC_FILTERS2		0x41
626d817c0eSAdam Thomson #define DA7219_DAC_FILTERS3		0x42
636d817c0eSAdam Thomson #define DA7219_DAC_FILTERS4		0x43
646d817c0eSAdam Thomson #define DA7219_DAC_FILTERS1		0x44
656d817c0eSAdam Thomson #define DA7219_DAC_L_GAIN		0x45
666d817c0eSAdam Thomson #define DA7219_DAC_R_GAIN		0x46
676d817c0eSAdam Thomson #define DA7219_CP_CTRL			0x47
686d817c0eSAdam Thomson #define DA7219_HP_L_GAIN		0x48
696d817c0eSAdam Thomson #define DA7219_HP_R_GAIN		0x49
706d817c0eSAdam Thomson #define DA7219_MIXOUT_L_SELECT		0x4B
716d817c0eSAdam Thomson #define DA7219_MIXOUT_R_SELECT		0x4C
726d817c0eSAdam Thomson #define DA7219_SYSTEM_MODES_INPUT	0x50
736d817c0eSAdam Thomson #define DA7219_SYSTEM_MODES_OUTPUT	0x51
746d817c0eSAdam Thomson #define DA7219_MICBIAS_CTRL		0x62
756d817c0eSAdam Thomson #define DA7219_MIC_1_CTRL		0x63
766d817c0eSAdam Thomson #define DA7219_MIXIN_L_CTRL		0x65
776d817c0eSAdam Thomson #define DA7219_ADC_L_CTRL		0x67
786d817c0eSAdam Thomson #define DA7219_DAC_L_CTRL		0x69
796d817c0eSAdam Thomson #define DA7219_DAC_R_CTRL		0x6A
806d817c0eSAdam Thomson #define DA7219_HP_L_CTRL		0x6B
816d817c0eSAdam Thomson #define DA7219_HP_R_CTRL		0x6C
826d817c0eSAdam Thomson #define DA7219_MIXOUT_L_CTRL		0x6E
836d817c0eSAdam Thomson #define DA7219_MIXOUT_R_CTRL		0x6F
846d817c0eSAdam Thomson #define DA7219_CHIP_ID1			0x81
856d817c0eSAdam Thomson #define DA7219_CHIP_ID2			0x82
866d817c0eSAdam Thomson #define DA7219_CHIP_REVISION		0x83
876d817c0eSAdam Thomson #define DA7219_IO_CTRL			0x91
886d817c0eSAdam Thomson #define DA7219_GAIN_RAMP_CTRL		0x92
896d817c0eSAdam Thomson #define DA7219_PC_COUNT			0x94
906d817c0eSAdam Thomson #define DA7219_CP_VOL_THRESHOLD1	0x95
916d817c0eSAdam Thomson #define DA7219_CP_DELAY			0x96
926d817c0eSAdam Thomson #define DA7219_DIG_CTRL			0x99
936d817c0eSAdam Thomson #define DA7219_ALC_CTRL2		0x9A
946d817c0eSAdam Thomson #define DA7219_ALC_CTRL3		0x9B
956d817c0eSAdam Thomson #define DA7219_ALC_NOISE		0x9C
966d817c0eSAdam Thomson #define DA7219_ALC_TARGET_MIN		0x9D
976d817c0eSAdam Thomson #define DA7219_ALC_TARGET_MAX		0x9E
986d817c0eSAdam Thomson #define DA7219_ALC_GAIN_LIMITS		0x9F
996d817c0eSAdam Thomson #define DA7219_ALC_ANA_GAIN_LIMITS	0xA0
1006d817c0eSAdam Thomson #define DA7219_ALC_ANTICLIP_CTRL	0xA1
1016d817c0eSAdam Thomson #define DA7219_ALC_ANTICLIP_LEVEL	0xA2
1026d817c0eSAdam Thomson #define DA7219_ALC_OFFSET_AUTO_M_L	0xA3
1036d817c0eSAdam Thomson #define DA7219_ALC_OFFSET_AUTO_U_L	0xA4
1046d817c0eSAdam Thomson #define DA7219_DAC_NG_SETUP_TIME	0xAF
1056d817c0eSAdam Thomson #define DA7219_DAC_NG_OFF_THRESH	0xB0
1066d817c0eSAdam Thomson #define DA7219_DAC_NG_ON_THRESH		0xB1
1076d817c0eSAdam Thomson #define DA7219_DAC_NG_CTRL		0xB2
1086d817c0eSAdam Thomson #define DA7219_TONE_GEN_CFG1		0xB4
1096d817c0eSAdam Thomson #define DA7219_TONE_GEN_CFG2		0xB5
1106d817c0eSAdam Thomson #define DA7219_TONE_GEN_CYCLES		0xB6
1116d817c0eSAdam Thomson #define DA7219_TONE_GEN_FREQ1_L		0xB7
1126d817c0eSAdam Thomson #define DA7219_TONE_GEN_FREQ1_U		0xB8
1136d817c0eSAdam Thomson #define DA7219_TONE_GEN_FREQ2_L		0xB9
1146d817c0eSAdam Thomson #define DA7219_TONE_GEN_FREQ2_U		0xBA
1156d817c0eSAdam Thomson #define DA7219_TONE_GEN_ON_PER		0xBB
1166d817c0eSAdam Thomson #define DA7219_TONE_GEN_OFF_PER		0xBC
1176d817c0eSAdam Thomson #define DA7219_SYSTEM_STATUS		0xE0
1186d817c0eSAdam Thomson #define DA7219_SYSTEM_ACTIVE		0xFD
1196d817c0eSAdam Thomson 
1206d817c0eSAdam Thomson 
1216d817c0eSAdam Thomson /*
1226d817c0eSAdam Thomson  * Bit Fields
1236d817c0eSAdam Thomson  */
1246d817c0eSAdam Thomson 
1256d817c0eSAdam Thomson #define DA7219_SWITCH_EN_MAX		0x1
1266d817c0eSAdam Thomson 
1276d817c0eSAdam Thomson /* DA7219_MIC_1_GAIN_STATUS = 0x6 */
1286d817c0eSAdam Thomson #define DA7219_MIC_1_AMP_GAIN_STATUS_SHIFT	0
1296d817c0eSAdam Thomson #define DA7219_MIC_1_AMP_GAIN_STATUS_MASK	(0x7 << 0)
1306d817c0eSAdam Thomson #define DA7219_MIC_1_AMP_GAIN_MAX		0x7
1316d817c0eSAdam Thomson 
1326d817c0eSAdam Thomson /* DA7219_MIXIN_L_GAIN_STATUS = 0x8 */
1336d817c0eSAdam Thomson #define DA7219_MIXIN_L_AMP_GAIN_STATUS_SHIFT	0
1346d817c0eSAdam Thomson #define DA7219_MIXIN_L_AMP_GAIN_STATUS_MASK	(0xF << 0)
1356d817c0eSAdam Thomson 
1366d817c0eSAdam Thomson /* DA7219_ADC_L_GAIN_STATUS = 0xA */
1376d817c0eSAdam Thomson #define DA7219_ADC_L_DIGITAL_GAIN_STATUS_SHIFT	0
1386d817c0eSAdam Thomson #define DA7219_ADC_L_DIGITAL_GAIN_STATUS_MASK	(0x7F << 0)
1396d817c0eSAdam Thomson 
1406d817c0eSAdam Thomson /* DA7219_DAC_L_GAIN_STATUS = 0xC */
1416d817c0eSAdam Thomson #define DA7219_DAC_L_DIGITAL_GAIN_STATUS_SHIFT	0
1426d817c0eSAdam Thomson #define DA7219_DAC_L_DIGITAL_GAIN_STATUS_MASK	(0x7F << 0)
1436d817c0eSAdam Thomson 
1446d817c0eSAdam Thomson /* DA7219_DAC_R_GAIN_STATUS = 0xD */
1456d817c0eSAdam Thomson #define DA7219_DAC_R_DIGITAL_GAIN_STATUS_SHIFT	0
1466d817c0eSAdam Thomson #define DA7219_DAC_R_DIGITAL_GAIN_STATUS_MASK	(0x7F << 0)
1476d817c0eSAdam Thomson 
1486d817c0eSAdam Thomson /* DA7219_HP_L_GAIN_STATUS = 0xE */
1496d817c0eSAdam Thomson #define DA7219_HP_L_AMP_GAIN_STATUS_SHIFT	0
1506d817c0eSAdam Thomson #define DA7219_HP_L_AMP_GAIN_STATUS_MASK	(0x3F << 0)
1516d817c0eSAdam Thomson 
1526d817c0eSAdam Thomson /* DA7219_HP_R_GAIN_STATUS = 0xF */
1536d817c0eSAdam Thomson #define DA7219_HP_R_AMP_GAIN_STATUS_SHIFT	0
1546d817c0eSAdam Thomson #define DA7219_HP_R_AMP_GAIN_STATUS_MASK	(0x3F << 0)
1556d817c0eSAdam Thomson 
1566d817c0eSAdam Thomson /* DA7219_MIC_1_SELECT = 0x10 */
1576d817c0eSAdam Thomson #define DA7219_MIC_1_AMP_IN_SEL_SHIFT	0
1586d817c0eSAdam Thomson #define DA7219_MIC_1_AMP_IN_SEL_MASK	(0x3 << 0)
1596d817c0eSAdam Thomson 
1606d817c0eSAdam Thomson /* DA7219_CIF_TIMEOUT_CTRL = 0x12 */
1616d817c0eSAdam Thomson #define DA7219_I2C_TIMEOUT_EN_SHIFT	0
1626d817c0eSAdam Thomson #define DA7219_I2C_TIMEOUT_EN_MASK	(0x1 << 0)
1636d817c0eSAdam Thomson 
1646d817c0eSAdam Thomson /* DA7219_CIF_CTRL = 0x13 */
1656d817c0eSAdam Thomson #define DA7219_CIF_I2C_WRITE_MODE_SHIFT		0
1666d817c0eSAdam Thomson #define DA7219_CIF_I2C_WRITE_MODE_MASK		(0x1 << 0)
1676d817c0eSAdam Thomson #define DA7219_CIF_REG_SOFT_RESET_SHIFT		7
1686d817c0eSAdam Thomson #define DA7219_CIF_REG_SOFT_RESET_MASK		(0x1 << 7)
1696d817c0eSAdam Thomson 
1706d817c0eSAdam Thomson /* DA7219_SR_24_48 = 0x16 */
1716d817c0eSAdam Thomson #define DA7219_SR_24_48_SHIFT	0
1726d817c0eSAdam Thomson #define DA7219_SR_24_48_MASK	(0x1 << 0)
1736d817c0eSAdam Thomson 
1746d817c0eSAdam Thomson /* DA7219_SR = 0x17 */
1756d817c0eSAdam Thomson #define DA7219_SR_SHIFT		0
1766d817c0eSAdam Thomson #define DA7219_SR_MASK		(0xF << 0)
1776d817c0eSAdam Thomson #define DA7219_SR_8000		(0x01 << 0)
1786d817c0eSAdam Thomson #define DA7219_SR_11025		(0x02 << 0)
1796d817c0eSAdam Thomson #define DA7219_SR_12000		(0x03 << 0)
1806d817c0eSAdam Thomson #define DA7219_SR_16000		(0x05 << 0)
1816d817c0eSAdam Thomson #define DA7219_SR_22050		(0x06 << 0)
1826d817c0eSAdam Thomson #define DA7219_SR_24000		(0x07 << 0)
1836d817c0eSAdam Thomson #define DA7219_SR_32000		(0x09 << 0)
1846d817c0eSAdam Thomson #define DA7219_SR_44100		(0x0A << 0)
1856d817c0eSAdam Thomson #define DA7219_SR_48000		(0x0B << 0)
1866d817c0eSAdam Thomson #define DA7219_SR_88200		(0x0E << 0)
1876d817c0eSAdam Thomson #define DA7219_SR_96000		(0x0F << 0)
1886d817c0eSAdam Thomson 
1896d817c0eSAdam Thomson /* DA7219_CIF_I2C_ADDR_CFG = 0x1B */
1906d817c0eSAdam Thomson #define DA7219_CIF_I2C_ADDR_CFG_SHIFT	0
1916d817c0eSAdam Thomson #define DA7219_CIF_I2C_ADDR_CFG_MASK	(0x3 << 0)
1926d817c0eSAdam Thomson 
1936d817c0eSAdam Thomson /* DA7219_PLL_CTRL = 0x20 */
1946d817c0eSAdam Thomson #define DA7219_PLL_INDIV_SHIFT		2
1956d817c0eSAdam Thomson #define DA7219_PLL_INDIV_MASK		(0x7 << 2)
19663a450aaSAdam Thomson #define DA7219_PLL_INDIV_2_TO_4_5_MHZ	(0x0 << 2)
19763a450aaSAdam Thomson #define DA7219_PLL_INDIV_4_5_TO_9_MHZ	(0x1 << 2)
19863a450aaSAdam Thomson #define DA7219_PLL_INDIV_9_TO_18_MHZ	(0x2 << 2)
19963a450aaSAdam Thomson #define DA7219_PLL_INDIV_18_TO_36_MHZ	(0x3 << 2)
20063a450aaSAdam Thomson #define DA7219_PLL_INDIV_36_TO_54_MHZ	(0x4 << 2)
2016d817c0eSAdam Thomson #define DA7219_PLL_MCLK_SQR_EN_SHIFT	5
2026d817c0eSAdam Thomson #define DA7219_PLL_MCLK_SQR_EN_MASK	(0x1 << 5)
2036d817c0eSAdam Thomson #define DA7219_PLL_MODE_SHIFT		6
2046d817c0eSAdam Thomson #define DA7219_PLL_MODE_MASK		(0x3 << 6)
2056d817c0eSAdam Thomson #define DA7219_PLL_MODE_BYPASS		(0x0 << 6)
2066d817c0eSAdam Thomson #define DA7219_PLL_MODE_NORMAL		(0x1 << 6)
2076d817c0eSAdam Thomson #define DA7219_PLL_MODE_SRM		(0x2 << 6)
2086d817c0eSAdam Thomson 
2096d817c0eSAdam Thomson /* DA7219_PLL_FRAC_TOP = 0x22 */
2106d817c0eSAdam Thomson #define DA7219_PLL_FBDIV_FRAC_TOP_SHIFT	0
2116d817c0eSAdam Thomson #define DA7219_PLL_FBDIV_FRAC_TOP_MASK	(0x1F << 0)
2126d817c0eSAdam Thomson 
2136d817c0eSAdam Thomson /* DA7219_PLL_FRAC_BOT = 0x23 */
2146d817c0eSAdam Thomson #define DA7219_PLL_FBDIV_FRAC_BOT_SHIFT	0
2156d817c0eSAdam Thomson #define DA7219_PLL_FBDIV_FRAC_BOT_MASK	(0xFF << 0)
2166d817c0eSAdam Thomson 
2176d817c0eSAdam Thomson /* DA7219_PLL_INTEGER = 0x24 */
2186d817c0eSAdam Thomson #define DA7219_PLL_FBDIV_INTEGER_SHIFT	0
2196d817c0eSAdam Thomson #define DA7219_PLL_FBDIV_INTEGER_MASK	(0x7F << 0)
2206d817c0eSAdam Thomson 
2216d817c0eSAdam Thomson /* DA7219_PLL_SRM_STS = 0x25 */
2226d817c0eSAdam Thomson #define DA7219_PLL_SRM_STATE_SHIFT	0
2236d817c0eSAdam Thomson #define DA7219_PLL_SRM_STATE_MASK	(0xF << 0)
2246d817c0eSAdam Thomson #define DA7219_PLL_SRM_STATUS_SHIFT	4
2256d817c0eSAdam Thomson #define DA7219_PLL_SRM_STATUS_MASK	(0xF << 4)
2266a0b87c6SAdam Thomson #define DA7219_PLL_SRM_STS_MCLK		(0x1 << 4)
2276d817c0eSAdam Thomson #define DA7219_PLL_SRM_STS_SRM_LOCK	(0x1 << 7)
2286d817c0eSAdam Thomson 
2296d817c0eSAdam Thomson /* DA7219_DIG_ROUTING_DAI = 0x2A */
2306d817c0eSAdam Thomson #define DA7219_DAI_L_SRC_SHIFT	0
2316d817c0eSAdam Thomson #define DA7219_DAI_L_SRC_MASK	(0x3 << 0)
2326d817c0eSAdam Thomson #define DA7219_DAI_R_SRC_SHIFT	4
2336d817c0eSAdam Thomson #define DA7219_DAI_R_SRC_MASK	(0x3 << 4)
2346d817c0eSAdam Thomson #define DA7219_OUT_SRC_MAX	4
2356d817c0eSAdam Thomson 
2366d817c0eSAdam Thomson /* DA7219_DAI_CLK_MODE = 0x2B */
2376d817c0eSAdam Thomson #define DA7219_DAI_BCLKS_PER_WCLK_SHIFT	0
2386d817c0eSAdam Thomson #define DA7219_DAI_BCLKS_PER_WCLK_MASK	(0x3 << 0)
2396d817c0eSAdam Thomson #define DA7219_DAI_BCLKS_PER_WCLK_32	(0x0 << 0)
2406d817c0eSAdam Thomson #define DA7219_DAI_BCLKS_PER_WCLK_64	(0x1 << 0)
2416d817c0eSAdam Thomson #define DA7219_DAI_BCLKS_PER_WCLK_128	(0x2 << 0)
2426d817c0eSAdam Thomson #define DA7219_DAI_BCLKS_PER_WCLK_256	(0x3 << 0)
2436d817c0eSAdam Thomson #define DA7219_DAI_CLK_POL_SHIFT	2
2446d817c0eSAdam Thomson #define DA7219_DAI_CLK_POL_MASK		(0x1 << 2)
2456d817c0eSAdam Thomson #define DA7219_DAI_CLK_POL_INV		(0x1 << 2)
2466d817c0eSAdam Thomson #define DA7219_DAI_WCLK_POL_SHIFT	3
2476d817c0eSAdam Thomson #define DA7219_DAI_WCLK_POL_MASK	(0x1 << 3)
2486d817c0eSAdam Thomson #define DA7219_DAI_WCLK_POL_INV		(0x1 << 3)
2496d817c0eSAdam Thomson #define DA7219_DAI_WCLK_TRI_STATE_SHIFT	4
2506d817c0eSAdam Thomson #define DA7219_DAI_WCLK_TRI_STATE_MASK	(0x1 << 4)
2516d817c0eSAdam Thomson #define DA7219_DAI_CLK_EN_SHIFT		7
2526d817c0eSAdam Thomson #define DA7219_DAI_CLK_EN_MASK		(0x1 << 7)
2536d817c0eSAdam Thomson 
2546d817c0eSAdam Thomson /* DA7219_DAI_CTRL = 0x2C */
2556d817c0eSAdam Thomson #define DA7219_DAI_FORMAT_SHIFT		0
2566d817c0eSAdam Thomson #define DA7219_DAI_FORMAT_MASK		(0x3 << 0)
2576d817c0eSAdam Thomson #define DA7219_DAI_FORMAT_I2S		(0x0 << 0)
2586d817c0eSAdam Thomson #define DA7219_DAI_FORMAT_LEFT_J	(0x1 << 0)
2596d817c0eSAdam Thomson #define DA7219_DAI_FORMAT_RIGHT_J	(0x2 << 0)
2606d817c0eSAdam Thomson #define DA7219_DAI_FORMAT_DSP		(0x3 << 0)
2616d817c0eSAdam Thomson #define DA7219_DAI_WORD_LENGTH_SHIFT	2
2626d817c0eSAdam Thomson #define DA7219_DAI_WORD_LENGTH_MASK	(0x3 << 2)
2636d817c0eSAdam Thomson #define DA7219_DAI_WORD_LENGTH_S16_LE	(0x0 << 2)
2646d817c0eSAdam Thomson #define DA7219_DAI_WORD_LENGTH_S20_LE	(0x1 << 2)
2656d817c0eSAdam Thomson #define DA7219_DAI_WORD_LENGTH_S24_LE	(0x2 << 2)
2666d817c0eSAdam Thomson #define DA7219_DAI_WORD_LENGTH_S32_LE	(0x3 << 2)
2676d817c0eSAdam Thomson #define DA7219_DAI_CH_NUM_SHIFT		4
2686d817c0eSAdam Thomson #define DA7219_DAI_CH_NUM_MASK		(0x3 << 4)
2696d817c0eSAdam Thomson #define DA7219_DAI_CH_NUM_MAX		2
2706d817c0eSAdam Thomson #define DA7219_DAI_EN_SHIFT		7
2716d817c0eSAdam Thomson #define DA7219_DAI_EN_MASK		(0x1 << 7)
2726d817c0eSAdam Thomson 
2736d817c0eSAdam Thomson /* DA7219_DAI_TDM_CTRL = 0x2D */
2746d817c0eSAdam Thomson #define DA7219_DAI_TDM_CH_EN_SHIFT	0
2756d817c0eSAdam Thomson #define DA7219_DAI_TDM_CH_EN_MASK	(0x3 << 0)
2766d817c0eSAdam Thomson #define DA7219_DAI_OE_SHIFT		6
2776d817c0eSAdam Thomson #define DA7219_DAI_OE_MASK		(0x1 << 6)
2786d817c0eSAdam Thomson #define DA7219_DAI_TDM_MODE_EN_SHIFT	7
2796d817c0eSAdam Thomson #define DA7219_DAI_TDM_MODE_EN_MASK	(0x1 << 7)
2806d817c0eSAdam Thomson #define DA7219_DAI_TDM_MAX_SLOTS	2
2816d817c0eSAdam Thomson 
2826d817c0eSAdam Thomson /* DA7219_DIG_ROUTING_DAC = 0x2E */
2836d817c0eSAdam Thomson #define DA7219_DAC_L_SRC_SHIFT		0
2846d817c0eSAdam Thomson #define DA7219_DAC_L_SRC_MASK		(0x3 << 0)
2856d817c0eSAdam Thomson #define DA7219_DAC_L_SRC_TONEGEN	(0x1 << 0)
2866d817c0eSAdam Thomson #define DA7219_DAC_L_MONO_SHIFT		3
2876d817c0eSAdam Thomson #define DA7219_DAC_L_MONO_MASK		(0x1 << 3)
2886d817c0eSAdam Thomson #define DA7219_DAC_R_SRC_SHIFT		4
2896d817c0eSAdam Thomson #define DA7219_DAC_R_SRC_MASK		(0x3 << 4)
2906d817c0eSAdam Thomson #define DA7219_DAC_R_SRC_TONEGEN	(0x1 << 4)
2916d817c0eSAdam Thomson #define DA7219_DAC_R_MONO_SHIFT		7
2926d817c0eSAdam Thomson #define DA7219_DAC_R_MONO_MASK		(0x1 << 7)
2936d817c0eSAdam Thomson 
2946d817c0eSAdam Thomson /* DA7219_ALC_CTRL1 = 0x2F */
2956d817c0eSAdam Thomson #define DA7219_ALC_OFFSET_EN_SHIFT	0
2966d817c0eSAdam Thomson #define DA7219_ALC_OFFSET_EN_MASK	(0x1 << 0)
2976d817c0eSAdam Thomson #define DA7219_ALC_SYNC_MODE_SHIFT	1
2986d817c0eSAdam Thomson #define DA7219_ALC_SYNC_MODE_MASK	(0x1 << 1)
2996d817c0eSAdam Thomson #define DA7219_ALC_EN_SHIFT		3
3006d817c0eSAdam Thomson #define DA7219_ALC_EN_MASK		(0x1 << 3)
3016d817c0eSAdam Thomson #define DA7219_ALC_AUTO_CALIB_EN_SHIFT	4
3026d817c0eSAdam Thomson #define DA7219_ALC_AUTO_CALIB_EN_MASK	(0x1 << 4)
3036d817c0eSAdam Thomson #define DA7219_ALC_CALIB_OVERFLOW_SHIFT	5
3046d817c0eSAdam Thomson #define DA7219_ALC_CALIB_OVERFLOW_MASK	(0x1 << 5)
3056d817c0eSAdam Thomson 
3066d817c0eSAdam Thomson /* DA7219_DAI_OFFSET_LOWER = 0x30 */
3076d817c0eSAdam Thomson #define DA7219_DAI_OFFSET_LOWER_SHIFT	0
3086d817c0eSAdam Thomson #define DA7219_DAI_OFFSET_LOWER_MASK	(0xFF << 0)
3096d817c0eSAdam Thomson 
3106d817c0eSAdam Thomson /* DA7219_DAI_OFFSET_UPPER = 0x31 */
3116d817c0eSAdam Thomson #define DA7219_DAI_OFFSET_UPPER_SHIFT	0
3126d817c0eSAdam Thomson #define DA7219_DAI_OFFSET_UPPER_MASK	(0x7 << 0)
3136d817c0eSAdam Thomson #define DA7219_DAI_OFFSET_MAX		0x2FF
3146d817c0eSAdam Thomson 
3156d817c0eSAdam Thomson /* DA7219_REFERENCES = 0x32 */
3166d817c0eSAdam Thomson #define DA7219_BIAS_EN_SHIFT		3
3176d817c0eSAdam Thomson #define DA7219_BIAS_EN_MASK		(0x1 << 3)
3186d817c0eSAdam Thomson #define DA7219_VMID_FAST_CHARGE_SHIFT	4
3196d817c0eSAdam Thomson #define DA7219_VMID_FAST_CHARGE_MASK	(0x1 << 4)
3206d817c0eSAdam Thomson 
3216d817c0eSAdam Thomson /* DA7219_MIXIN_L_SELECT = 0x33 */
3226d817c0eSAdam Thomson #define DA7219_MIXIN_L_MIX_SELECT_SHIFT	0
3236d817c0eSAdam Thomson #define DA7219_MIXIN_L_MIX_SELECT_MASK	(0x1 << 0)
3246d817c0eSAdam Thomson 
3256d817c0eSAdam Thomson /* DA7219_MIXIN_L_GAIN = 0x34 */
3266d817c0eSAdam Thomson #define DA7219_MIXIN_L_AMP_GAIN_SHIFT	0
3276d817c0eSAdam Thomson #define DA7219_MIXIN_L_AMP_GAIN_MASK	(0xF << 0)
3286d817c0eSAdam Thomson #define DA7219_MIXIN_L_AMP_GAIN_MAX	0xF
3296d817c0eSAdam Thomson 
3306d817c0eSAdam Thomson /* DA7219_ADC_L_GAIN = 0x36 */
3316d817c0eSAdam Thomson #define DA7219_ADC_L_DIGITAL_GAIN_SHIFT	0
3326d817c0eSAdam Thomson #define DA7219_ADC_L_DIGITAL_GAIN_MASK	(0x7F << 0)
3336d817c0eSAdam Thomson #define DA7219_ADC_L_DIGITAL_GAIN_MAX	0x7F
3346d817c0eSAdam Thomson 
3356d817c0eSAdam Thomson /* DA7219_ADC_FILTERS1 = 0x38 */
3366d817c0eSAdam Thomson #define DA7219_ADC_VOICE_HPF_CORNER_SHIFT	0
3376d817c0eSAdam Thomson #define DA7219_ADC_VOICE_HPF_CORNER_MASK	(0x7 << 0)
3386d817c0eSAdam Thomson #define DA7219_VOICE_HPF_CORNER_MAX		8
3396d817c0eSAdam Thomson #define DA7219_ADC_VOICE_EN_SHIFT		3
3406d817c0eSAdam Thomson #define DA7219_ADC_VOICE_EN_MASK		(0x1 << 3)
3416d817c0eSAdam Thomson #define DA7219_ADC_AUDIO_HPF_CORNER_SHIFT	4
3426d817c0eSAdam Thomson #define DA7219_ADC_AUDIO_HPF_CORNER_MASK	(0x3 << 4)
3436d817c0eSAdam Thomson #define DA7219_AUDIO_HPF_CORNER_MAX		4
3446d817c0eSAdam Thomson #define DA7219_ADC_HPF_EN_SHIFT			7
3456d817c0eSAdam Thomson #define DA7219_ADC_HPF_EN_MASK			(0x1 << 7)
3466d817c0eSAdam Thomson #define DA7219_HPF_MODE_SHIFT			0
3476d817c0eSAdam Thomson #define DA7219_HPF_DISABLED			((0x0 << 3) | (0x0 << 7))
3486d817c0eSAdam Thomson #define DA7219_HPF_AUDIO_EN			((0x0 << 3) | (0x1 << 7))
3496d817c0eSAdam Thomson #define DA7219_HPF_VOICE_EN			((0x1 << 3) | (0x1 << 7))
3506d817c0eSAdam Thomson #define DA7219_HPF_MODE_MASK			((0x1 << 3) | (0x1 << 7))
3516d817c0eSAdam Thomson #define DA7219_HPF_MODE_MAX			3
3526d817c0eSAdam Thomson 
3536d817c0eSAdam Thomson /* DA7219_MIC_1_GAIN = 0x39 */
3546d817c0eSAdam Thomson #define DA7219_MIC_1_AMP_GAIN_SHIFT	0
3556d817c0eSAdam Thomson #define DA7219_MIC_1_AMP_GAIN_MASK	(0x7 << 0)
3566d817c0eSAdam Thomson 
3576d817c0eSAdam Thomson /* DA7219_SIDETONE_CTRL = 0x3A */
3586d817c0eSAdam Thomson #define DA7219_SIDETONE_MUTE_EN_SHIFT	6
3596d817c0eSAdam Thomson #define DA7219_SIDETONE_MUTE_EN_MASK	(0x1 << 6)
3606d817c0eSAdam Thomson #define DA7219_SIDETONE_EN_SHIFT	7
3616d817c0eSAdam Thomson #define DA7219_SIDETONE_EN_MASK		(0x1 << 7)
3626d817c0eSAdam Thomson 
3636d817c0eSAdam Thomson /* DA7219_SIDETONE_GAIN = 0x3B */
3646d817c0eSAdam Thomson #define DA7219_SIDETONE_GAIN_SHIFT	0
3656d817c0eSAdam Thomson #define DA7219_SIDETONE_GAIN_MASK	(0xF << 0)
3666d817c0eSAdam Thomson #define DA7219_SIDETONE_GAIN_MAX	0xE
3676d817c0eSAdam Thomson 
3686d817c0eSAdam Thomson /* DA7219_DROUTING_ST_OUTFILT_1L = 0x3C */
3696d817c0eSAdam Thomson #define DA7219_OUTFILT_ST_1L_SRC_SHIFT		0
3706d817c0eSAdam Thomson #define DA7219_OUTFILT_ST_1L_SRC_MASK		(0x7 << 0)
3716d817c0eSAdam Thomson #define DA7219_DMIX_ST_SRC_OUTFILT1L_SHIFT	0
3726d817c0eSAdam Thomson #define DA7219_DMIX_ST_SRC_OUTFILT1R_SHIFT	1
3736d817c0eSAdam Thomson #define DA7219_DMIX_ST_SRC_SIDETONE_SHIFT	2
3746d817c0eSAdam Thomson #define DA7219_DMIX_ST_SRC_OUTFILT1L		(0x1 << 0)
3756d817c0eSAdam Thomson #define DA7219_DMIX_ST_SRC_OUTFILT1R		(0x1 << 1)
3766d817c0eSAdam Thomson 
3776d817c0eSAdam Thomson /* DA7219_DROUTING_ST_OUTFILT_1R = 0x3D */
3786d817c0eSAdam Thomson #define DA7219_OUTFILT_ST_1R_SRC_SHIFT	0
3796d817c0eSAdam Thomson #define DA7219_OUTFILT_ST_1R_SRC_MASK	(0x7 << 0)
3806d817c0eSAdam Thomson 
3816d817c0eSAdam Thomson /* DA7219_DAC_FILTERS5 = 0x40 */
3826d817c0eSAdam Thomson #define DA7219_DAC_SOFTMUTE_RATE_SHIFT	4
3836d817c0eSAdam Thomson #define DA7219_DAC_SOFTMUTE_RATE_MASK	(0x7 << 4)
3846d817c0eSAdam Thomson #define DA7219_DAC_SOFTMUTE_RATE_MAX	7
3856d817c0eSAdam Thomson #define DA7219_DAC_SOFTMUTE_EN_SHIFT	7
3866d817c0eSAdam Thomson #define DA7219_DAC_SOFTMUTE_EN_MASK	(0x1 << 7)
3876d817c0eSAdam Thomson 
3886d817c0eSAdam Thomson /* DA7219_DAC_FILTERS2 = 0x41 */
3896d817c0eSAdam Thomson #define DA7219_DAC_EQ_BAND1_SHIFT	0
3906d817c0eSAdam Thomson #define DA7219_DAC_EQ_BAND1_MASK	(0xF << 0)
3916d817c0eSAdam Thomson #define DA7219_DAC_EQ_BAND2_SHIFT	4
3926d817c0eSAdam Thomson #define DA7219_DAC_EQ_BAND2_MASK	(0xF << 4)
3936d817c0eSAdam Thomson #define DA7219_DAC_EQ_BAND_MAX		0xF
3946d817c0eSAdam Thomson 
3956d817c0eSAdam Thomson /* DA7219_DAC_FILTERS3 = 0x42 */
3966d817c0eSAdam Thomson #define DA7219_DAC_EQ_BAND3_SHIFT	0
3976d817c0eSAdam Thomson #define DA7219_DAC_EQ_BAND3_MASK	(0xF << 0)
3986d817c0eSAdam Thomson #define DA7219_DAC_EQ_BAND4_SHIFT	4
3996d817c0eSAdam Thomson #define DA7219_DAC_EQ_BAND4_MASK	(0xF << 4)
4006d817c0eSAdam Thomson 
4016d817c0eSAdam Thomson /* DA7219_DAC_FILTERS4 = 0x43 */
4026d817c0eSAdam Thomson #define DA7219_DAC_EQ_BAND5_SHIFT	0
4036d817c0eSAdam Thomson #define DA7219_DAC_EQ_BAND5_MASK	(0xF << 0)
4046d817c0eSAdam Thomson #define DA7219_DAC_EQ_EN_SHIFT		7
4056d817c0eSAdam Thomson #define DA7219_DAC_EQ_EN_MASK		(0x1 << 7)
4066d817c0eSAdam Thomson 
4076d817c0eSAdam Thomson /* DA7219_DAC_FILTERS1 = 0x44 */
4086d817c0eSAdam Thomson #define DA7219_DAC_VOICE_HPF_CORNER_SHIFT	0
4096d817c0eSAdam Thomson #define DA7219_DAC_VOICE_HPF_CORNER_MASK	(0x7 << 0)
4106d817c0eSAdam Thomson #define DA7219_DAC_VOICE_EN_SHIFT		3
4116d817c0eSAdam Thomson #define DA7219_DAC_VOICE_EN_MASK		(0x1 << 3)
4126d817c0eSAdam Thomson #define DA7219_DAC_AUDIO_HPF_CORNER_SHIFT	4
4136d817c0eSAdam Thomson #define DA7219_DAC_AUDIO_HPF_CORNER_MASK	(0x3 << 4)
4146d817c0eSAdam Thomson #define DA7219_DAC_HPF_EN_SHIFT			7
4156d817c0eSAdam Thomson #define DA7219_DAC_HPF_EN_MASK			(0x1 << 7)
4166d817c0eSAdam Thomson 
4176d817c0eSAdam Thomson /* DA7219_DAC_L_GAIN = 0x45 */
4186d817c0eSAdam Thomson #define DA7219_DAC_L_DIGITAL_GAIN_SHIFT	0
4196d817c0eSAdam Thomson #define DA7219_DAC_L_DIGITAL_GAIN_MASK	(0x7F << 0)
4206d817c0eSAdam Thomson #define DA7219_DAC_DIGITAL_GAIN_MAX	0x7F
4216d817c0eSAdam Thomson #define DA7219_DAC_DIGITAL_GAIN_0DB	(0x6F << 0)
4226d817c0eSAdam Thomson 
4236d817c0eSAdam Thomson /* DA7219_DAC_R_GAIN = 0x46 */
4246d817c0eSAdam Thomson #define DA7219_DAC_R_DIGITAL_GAIN_SHIFT	0
4256d817c0eSAdam Thomson #define DA7219_DAC_R_DIGITAL_GAIN_MASK	(0x7F << 0)
4266d817c0eSAdam Thomson 
4276d817c0eSAdam Thomson /* DA7219_CP_CTRL = 0x47 */
4286d817c0eSAdam Thomson #define DA7219_CP_MCHANGE_SHIFT		4
4296d817c0eSAdam Thomson #define DA7219_CP_MCHANGE_MASK		(0x3 << 4)
4306d817c0eSAdam Thomson #define DA7219_CP_MCHANGE_REL_MASK	0x3
4316d817c0eSAdam Thomson #define DA7219_CP_MCHANGE_MAX		3
4326d817c0eSAdam Thomson #define DA7219_CP_MCHANGE_LARGEST_VOL	0x1
4336d817c0eSAdam Thomson #define DA7219_CP_MCHANGE_DAC_VOL	0x2
4346d817c0eSAdam Thomson #define DA7219_CP_MCHANGE_SIG_MAG	0x3
4356d817c0eSAdam Thomson #define DA7219_CP_EN_SHIFT		7
4366d817c0eSAdam Thomson #define DA7219_CP_EN_MASK		(0x1 << 7)
4376d817c0eSAdam Thomson 
4386d817c0eSAdam Thomson /* DA7219_HP_L_GAIN = 0x48 */
4396d817c0eSAdam Thomson #define DA7219_HP_L_AMP_GAIN_SHIFT	0
4406d817c0eSAdam Thomson #define DA7219_HP_L_AMP_GAIN_MASK	(0x3F << 0)
4416d817c0eSAdam Thomson #define DA7219_HP_AMP_GAIN_MAX		0x3F
4426d817c0eSAdam Thomson #define DA7219_HP_AMP_GAIN_0DB		(0x39 << 0)
4436d817c0eSAdam Thomson 
4446d817c0eSAdam Thomson /* DA7219_HP_R_GAIN = 0x49 */
4456d817c0eSAdam Thomson #define DA7219_HP_R_AMP_GAIN_SHIFT	0
4466d817c0eSAdam Thomson #define DA7219_HP_R_AMP_GAIN_MASK	(0x3F << 0)
4476d817c0eSAdam Thomson 
4486d817c0eSAdam Thomson /* DA7219_MIXOUT_L_SELECT = 0x4B */
4496d817c0eSAdam Thomson #define DA7219_MIXOUT_L_MIX_SELECT_SHIFT	0
4506d817c0eSAdam Thomson #define DA7219_MIXOUT_L_MIX_SELECT_MASK		(0x1 << 0)
4516d817c0eSAdam Thomson 
4526d817c0eSAdam Thomson /* DA7219_MIXOUT_R_SELECT = 0x4C */
4536d817c0eSAdam Thomson #define DA7219_MIXOUT_R_MIX_SELECT_SHIFT	0
4546d817c0eSAdam Thomson #define DA7219_MIXOUT_R_MIX_SELECT_MASK		(0x1 << 0)
4556d817c0eSAdam Thomson 
4566d817c0eSAdam Thomson /* DA7219_SYSTEM_MODES_INPUT = 0x50 */
4576d817c0eSAdam Thomson #define DA7219_MODE_SUBMIT_SHIFT	0
4586d817c0eSAdam Thomson #define DA7219_MODE_SUBMIT_MASK		(0x1 << 0)
4596d817c0eSAdam Thomson #define DA7219_ADC_MODE_SHIFT		1
4606d817c0eSAdam Thomson #define DA7219_ADC_MODE_MASK		(0x7F << 1)
4616d817c0eSAdam Thomson 
4626d817c0eSAdam Thomson /* DA7219_SYSTEM_MODES_OUTPUT = 0x51 */
4636d817c0eSAdam Thomson #define DA7219_MODE_SUBMIT_SHIFT	0
4646d817c0eSAdam Thomson #define DA7219_MODE_SUBMIT_MASK		(0x1 << 0)
4656d817c0eSAdam Thomson #define DA7219_DAC_MODE_SHIFT		1
4666d817c0eSAdam Thomson #define DA7219_DAC_MODE_MASK		(0x7F << 1)
4676d817c0eSAdam Thomson 
4686d817c0eSAdam Thomson /* DA7219_MICBIAS_CTRL = 0x62 */
4696d817c0eSAdam Thomson #define DA7219_MICBIAS1_LEVEL_SHIFT	0
4706d817c0eSAdam Thomson #define DA7219_MICBIAS1_LEVEL_MASK	(0x7 << 0)
4716d817c0eSAdam Thomson #define DA7219_MICBIAS1_EN_SHIFT	3
4726d817c0eSAdam Thomson #define DA7219_MICBIAS1_EN_MASK		(0x1 << 3)
4736d817c0eSAdam Thomson 
4746d817c0eSAdam Thomson /* DA7219_MIC_1_CTRL = 0x63 */
4756d817c0eSAdam Thomson #define DA7219_MIC_1_AMP_RAMP_EN_SHIFT	5
4766d817c0eSAdam Thomson #define DA7219_MIC_1_AMP_RAMP_EN_MASK	(0x1 << 5)
4776d817c0eSAdam Thomson #define DA7219_MIC_1_AMP_MUTE_EN_SHIFT	6
4786d817c0eSAdam Thomson #define DA7219_MIC_1_AMP_MUTE_EN_MASK	(0x1 << 6)
4796d817c0eSAdam Thomson #define DA7219_MIC_1_AMP_EN_SHIFT	7
4806d817c0eSAdam Thomson #define DA7219_MIC_1_AMP_EN_MASK	(0x1 << 7)
4816d817c0eSAdam Thomson 
4826d817c0eSAdam Thomson /* DA7219_MIXIN_L_CTRL = 0x65 */
4836d817c0eSAdam Thomson #define DA7219_MIXIN_L_MIX_EN_SHIFT		3
4846d817c0eSAdam Thomson #define DA7219_MIXIN_L_MIX_EN_MASK		(0x1 << 3)
4856d817c0eSAdam Thomson #define DA7219_MIXIN_L_AMP_ZC_EN_SHIFT		4
4866d817c0eSAdam Thomson #define DA7219_MIXIN_L_AMP_ZC_EN_MASK		(0x1 << 4)
4876d817c0eSAdam Thomson #define DA7219_MIXIN_L_AMP_RAMP_EN_SHIFT	5
4886d817c0eSAdam Thomson #define DA7219_MIXIN_L_AMP_RAMP_EN_MASK		(0x1 << 5)
4896d817c0eSAdam Thomson #define DA7219_MIXIN_L_AMP_MUTE_EN_SHIFT	6
4906d817c0eSAdam Thomson #define DA7219_MIXIN_L_AMP_MUTE_EN_MASK		(0x1 << 6)
4916d817c0eSAdam Thomson #define DA7219_MIXIN_L_AMP_EN_SHIFT		7
4926d817c0eSAdam Thomson #define DA7219_MIXIN_L_AMP_EN_MASK		(0x1 << 7)
4936d817c0eSAdam Thomson 
4946d817c0eSAdam Thomson /* DA7219_ADC_L_CTRL = 0x67 */
4956d817c0eSAdam Thomson #define DA7219_ADC_L_BIAS_SHIFT		0
4966d817c0eSAdam Thomson #define DA7219_ADC_L_BIAS_MASK		(0x3 << 0)
4976d817c0eSAdam Thomson #define DA7219_ADC_L_RAMP_EN_SHIFT	5
4986d817c0eSAdam Thomson #define DA7219_ADC_L_RAMP_EN_MASK	(0x1 << 5)
4996d817c0eSAdam Thomson #define DA7219_ADC_L_MUTE_EN_SHIFT	6
5006d817c0eSAdam Thomson #define DA7219_ADC_L_MUTE_EN_MASK	(0x1 << 6)
5016d817c0eSAdam Thomson #define DA7219_ADC_L_EN_SHIFT		7
5026d817c0eSAdam Thomson #define DA7219_ADC_L_EN_MASK		(0x1 << 7)
5036d817c0eSAdam Thomson 
5046d817c0eSAdam Thomson /* DA7219_DAC_L_CTRL = 0x69 */
5056d817c0eSAdam Thomson #define DA7219_DAC_L_RAMP_EN_SHIFT	5
5066d817c0eSAdam Thomson #define DA7219_DAC_L_RAMP_EN_MASK	(0x1 << 5)
5076d817c0eSAdam Thomson #define DA7219_DAC_L_MUTE_EN_SHIFT	6
5086d817c0eSAdam Thomson #define DA7219_DAC_L_MUTE_EN_MASK	(0x1 << 6)
5096d817c0eSAdam Thomson #define DA7219_DAC_L_EN_SHIFT		7
5106d817c0eSAdam Thomson #define DA7219_DAC_L_EN_MASK		(0x1 << 7)
5116d817c0eSAdam Thomson 
5126d817c0eSAdam Thomson /* DA7219_DAC_R_CTRL = 0x6A */
5136d817c0eSAdam Thomson #define DA7219_DAC_R_RAMP_EN_SHIFT	5
5146d817c0eSAdam Thomson #define DA7219_DAC_R_RAMP_EN_MASK	(0x1 << 5)
5156d817c0eSAdam Thomson #define DA7219_DAC_R_MUTE_EN_SHIFT	6
5166d817c0eSAdam Thomson #define DA7219_DAC_R_MUTE_EN_MASK	(0x1 << 6)
5176d817c0eSAdam Thomson #define DA7219_DAC_R_EN_SHIFT		7
5186d817c0eSAdam Thomson #define DA7219_DAC_R_EN_MASK		(0x1 << 7)
5196d817c0eSAdam Thomson 
5206d817c0eSAdam Thomson /* DA7219_HP_L_CTRL = 0x6B */
5216d817c0eSAdam Thomson #define DA7219_HP_L_AMP_MIN_GAIN_EN_SHIFT	2
5226d817c0eSAdam Thomson #define DA7219_HP_L_AMP_MIN_GAIN_EN_MASK	(0x1 << 2)
5236d817c0eSAdam Thomson #define DA7219_HP_L_AMP_OE_SHIFT		3
5246d817c0eSAdam Thomson #define DA7219_HP_L_AMP_OE_MASK			(0x1 << 3)
5256d817c0eSAdam Thomson #define DA7219_HP_L_AMP_ZC_EN_SHIFT		4
5266d817c0eSAdam Thomson #define DA7219_HP_L_AMP_ZC_EN_MASK		(0x1 << 4)
5276d817c0eSAdam Thomson #define DA7219_HP_L_AMP_RAMP_EN_SHIFT		5
5286d817c0eSAdam Thomson #define DA7219_HP_L_AMP_RAMP_EN_MASK		(0x1 << 5)
5296d817c0eSAdam Thomson #define DA7219_HP_L_AMP_MUTE_EN_SHIFT		6
5306d817c0eSAdam Thomson #define DA7219_HP_L_AMP_MUTE_EN_MASK		(0x1 << 6)
5316d817c0eSAdam Thomson #define DA7219_HP_L_AMP_EN_SHIFT		7
5326d817c0eSAdam Thomson #define DA7219_HP_L_AMP_EN_MASK			(0x1 << 7)
5336d817c0eSAdam Thomson 
5346d817c0eSAdam Thomson /* DA7219_HP_R_CTRL = 0x6C */
5356d817c0eSAdam Thomson #define DA7219_HP_R_AMP_MIN_GAIN_EN_SHIFT	2
5366d817c0eSAdam Thomson #define DA7219_HP_R_AMP_MIN_GAIN_EN_MASK	(0x1 << 2)
5376d817c0eSAdam Thomson #define DA7219_HP_R_AMP_OE_SHIFT		3
5386d817c0eSAdam Thomson #define DA7219_HP_R_AMP_OE_MASK			(0x1 << 3)
5396d817c0eSAdam Thomson #define DA7219_HP_R_AMP_ZC_EN_SHIFT		4
5406d817c0eSAdam Thomson #define DA7219_HP_R_AMP_ZC_EN_MASK		(0x1 << 4)
5416d817c0eSAdam Thomson #define DA7219_HP_R_AMP_RAMP_EN_SHIFT		5
5426d817c0eSAdam Thomson #define DA7219_HP_R_AMP_RAMP_EN_MASK		(0x1 << 5)
5436d817c0eSAdam Thomson #define DA7219_HP_R_AMP_MUTE_EN_SHIFT		6
5446d817c0eSAdam Thomson #define DA7219_HP_R_AMP_MUTE_EN_MASK		(0x1 << 6)
5456d817c0eSAdam Thomson #define DA7219_HP_R_AMP_EN_SHIFT		7
5466d817c0eSAdam Thomson #define DA7219_HP_R_AMP_EN_MASK			(0x1 << 7)
5476d817c0eSAdam Thomson 
5486d817c0eSAdam Thomson /* DA7219_MIXOUT_L_CTRL = 0x6E */
5496d817c0eSAdam Thomson #define DA7219_MIXOUT_L_AMP_EN_SHIFT	7
5506d817c0eSAdam Thomson #define DA7219_MIXOUT_L_AMP_EN_MASK	(0x1 << 7)
5516d817c0eSAdam Thomson 
5526d817c0eSAdam Thomson /* DA7219_MIXOUT_R_CTRL = 0x6F */
5536d817c0eSAdam Thomson #define DA7219_MIXOUT_R_AMP_EN_SHIFT	7
5546d817c0eSAdam Thomson #define DA7219_MIXOUT_R_AMP_EN_MASK	(0x1 << 7)
5556d817c0eSAdam Thomson 
5566d817c0eSAdam Thomson /* DA7219_CHIP_ID1 = 0x81 */
5576d817c0eSAdam Thomson #define DA7219_CHIP_ID1_SHIFT	0
5586d817c0eSAdam Thomson #define DA7219_CHIP_ID1_MASK	(0xFF << 0)
5596d817c0eSAdam Thomson 
5606d817c0eSAdam Thomson /* DA7219_CHIP_ID2 = 0x82 */
5616d817c0eSAdam Thomson #define DA7219_CHIP_ID2_SHIFT	0
5626d817c0eSAdam Thomson #define DA7219_CHIP_ID2_MASK	(0xFF << 0)
5636d817c0eSAdam Thomson 
5646d817c0eSAdam Thomson /* DA7219_CHIP_REVISION = 0x83 */
5656d817c0eSAdam Thomson #define DA7219_CHIP_MINOR_SHIFT	0
5666d817c0eSAdam Thomson #define DA7219_CHIP_MINOR_MASK	(0xF << 0)
5676d817c0eSAdam Thomson #define DA7219_CHIP_MAJOR_SHIFT	4
5686d817c0eSAdam Thomson #define DA7219_CHIP_MAJOR_MASK	(0xF << 4)
5696d817c0eSAdam Thomson 
5706d817c0eSAdam Thomson /* DA7219_IO_CTRL = 0x91 */
5716d817c0eSAdam Thomson #define DA7219_IO_VOLTAGE_LEVEL_SHIFT		0
5726d817c0eSAdam Thomson #define DA7219_IO_VOLTAGE_LEVEL_MASK		(0x1 << 0)
5736d817c0eSAdam Thomson #define DA7219_IO_VOLTAGE_LEVEL_2_5V_3_6V	0
5746d817c0eSAdam Thomson #define DA7219_IO_VOLTAGE_LEVEL_1_2V_2_8V	1
5756d817c0eSAdam Thomson 
5766d817c0eSAdam Thomson /* DA7219_GAIN_RAMP_CTRL = 0x92 */
5776d817c0eSAdam Thomson #define DA7219_GAIN_RAMP_RATE_SHIFT	0
5786d817c0eSAdam Thomson #define DA7219_GAIN_RAMP_RATE_MASK	(0x3 << 0)
5796a0b87c6SAdam Thomson #define DA7219_GAIN_RAMP_RATE_X8	(0x0 << 0)
580a7f16ea9SAdam Thomson #define DA7219_GAIN_RAMP_RATE_NOMINAL	(0x1 << 0)
5816d817c0eSAdam Thomson #define DA7219_GAIN_RAMP_RATE_MAX	4
5826d817c0eSAdam Thomson 
5836d817c0eSAdam Thomson /* DA7219_PC_COUNT = 0x94 */
5846d817c0eSAdam Thomson #define DA7219_PC_FREERUN_SHIFT		0
5856d817c0eSAdam Thomson #define DA7219_PC_FREERUN_MASK		(0x1 << 0)
5866d817c0eSAdam Thomson #define DA7219_PC_RESYNC_AUTO_SHIFT	1
5876d817c0eSAdam Thomson #define DA7219_PC_RESYNC_AUTO_MASK	(0x1 << 1)
5886d817c0eSAdam Thomson 
5896d817c0eSAdam Thomson /* DA7219_CP_VOL_THRESHOLD1 = 0x95 */
5906d817c0eSAdam Thomson #define DA7219_CP_THRESH_VDD2_SHIFT	0
5916d817c0eSAdam Thomson #define DA7219_CP_THRESH_VDD2_MASK	(0x3F << 0)
5926d817c0eSAdam Thomson #define DA7219_CP_THRESH_VDD2_MAX	0x3F
5936d817c0eSAdam Thomson 
5946d817c0eSAdam Thomson /* DA7219_DIG_CTRL = 0x99 */
5956d817c0eSAdam Thomson #define DA7219_DAC_L_INV_SHIFT	3
5966d817c0eSAdam Thomson #define DA7219_DAC_L_INV_MASK	(0x1 << 3)
5976d817c0eSAdam Thomson #define DA7219_DAC_R_INV_SHIFT	7
5986d817c0eSAdam Thomson #define DA7219_DAC_R_INV_MASK	(0x1 << 7)
5996d817c0eSAdam Thomson 
6006d817c0eSAdam Thomson /* DA7219_ALC_CTRL2 = 0x9A */
6016d817c0eSAdam Thomson #define DA7219_ALC_ATTACK_SHIFT		0
6026d817c0eSAdam Thomson #define DA7219_ALC_ATTACK_MASK		(0xF << 0)
6036d817c0eSAdam Thomson #define DA7219_ALC_ATTACK_MAX		13
6046d817c0eSAdam Thomson #define DA7219_ALC_RELEASE_SHIFT	4
6056d817c0eSAdam Thomson #define DA7219_ALC_RELEASE_MASK		(0xF << 4)
6066d817c0eSAdam Thomson #define DA7219_ALC_RELEASE_MAX		11
6076d817c0eSAdam Thomson 
6086d817c0eSAdam Thomson /* DA7219_ALC_CTRL3 = 0x9B */
6096d817c0eSAdam Thomson #define DA7219_ALC_HOLD_SHIFT		0
6106d817c0eSAdam Thomson #define DA7219_ALC_HOLD_MASK		(0xF << 0)
6116d817c0eSAdam Thomson #define DA7219_ALC_HOLD_MAX		16
6126d817c0eSAdam Thomson #define DA7219_ALC_INTEG_ATTACK_SHIFT	4
6136d817c0eSAdam Thomson #define DA7219_ALC_INTEG_ATTACK_MASK	(0x3 << 4)
6146d817c0eSAdam Thomson #define DA7219_ALC_INTEG_RELEASE_SHIFT	6
6156d817c0eSAdam Thomson #define DA7219_ALC_INTEG_RELEASE_MASK	(0x3 << 6)
6166d817c0eSAdam Thomson #define DA7219_ALC_INTEG_MAX		4
6176d817c0eSAdam Thomson 
6186d817c0eSAdam Thomson /* DA7219_ALC_NOISE = 0x9C */
6196d817c0eSAdam Thomson #define DA7219_ALC_NOISE_SHIFT		0
6206d817c0eSAdam Thomson #define DA7219_ALC_NOISE_MASK		(0x3F << 0)
6216d817c0eSAdam Thomson #define DA7219_ALC_THRESHOLD_MAX	0x3F
6226d817c0eSAdam Thomson 
6236d817c0eSAdam Thomson /* DA7219_ALC_TARGET_MIN = 0x9D */
6246d817c0eSAdam Thomson #define DA7219_ALC_THRESHOLD_MIN_SHIFT	0
6256d817c0eSAdam Thomson #define DA7219_ALC_THRESHOLD_MIN_MASK	(0x3F << 0)
6266d817c0eSAdam Thomson 
6276d817c0eSAdam Thomson /* DA7219_ALC_TARGET_MAX = 0x9E */
6286d817c0eSAdam Thomson #define DA7219_ALC_THRESHOLD_MAX_SHIFT	0
6296d817c0eSAdam Thomson #define DA7219_ALC_THRESHOLD_MAX_MASK	(0x3F << 0)
6306d817c0eSAdam Thomson 
6316d817c0eSAdam Thomson /* DA7219_ALC_GAIN_LIMITS = 0x9F */
6326d817c0eSAdam Thomson #define DA7219_ALC_ATTEN_MAX_SHIFT	0
6336d817c0eSAdam Thomson #define DA7219_ALC_ATTEN_MAX_MASK	(0xF << 0)
6346d817c0eSAdam Thomson #define DA7219_ALC_GAIN_MAX_SHIFT	4
6356d817c0eSAdam Thomson #define DA7219_ALC_GAIN_MAX_MASK	(0xF << 4)
6366d817c0eSAdam Thomson #define DA7219_ALC_ATTEN_GAIN_MAX	0xF
6376d817c0eSAdam Thomson 
6386d817c0eSAdam Thomson /* DA7219_ALC_ANA_GAIN_LIMITS = 0xA0 */
6396d817c0eSAdam Thomson #define DA7219_ALC_ANA_GAIN_MIN_SHIFT	0
6406d817c0eSAdam Thomson #define DA7219_ALC_ANA_GAIN_MIN_MASK	(0x7 << 0)
6416d817c0eSAdam Thomson #define DA7219_ALC_ANA_GAIN_MIN		0x1
6426d817c0eSAdam Thomson #define DA7219_ALC_ANA_GAIN_MAX_SHIFT	4
6436d817c0eSAdam Thomson #define DA7219_ALC_ANA_GAIN_MAX_MASK	(0x7 << 4)
6446d817c0eSAdam Thomson #define DA7219_ALC_ANA_GAIN_MAX		0x7
6456d817c0eSAdam Thomson 
6466d817c0eSAdam Thomson /* DA7219_ALC_ANTICLIP_CTRL = 0xA1 */
6476d817c0eSAdam Thomson #define DA7219_ALC_ANTICLIP_STEP_SHIFT	0
6486d817c0eSAdam Thomson #define DA7219_ALC_ANTICLIP_STEP_MASK	(0x3 << 0)
6496d817c0eSAdam Thomson #define DA7219_ALC_ANTICLIP_STEP_MAX	4
6506d817c0eSAdam Thomson #define DA7219_ALC_ANTIPCLIP_EN_SHIFT	7
6516d817c0eSAdam Thomson #define DA7219_ALC_ANTIPCLIP_EN_MASK	(0x1 << 7)
6526d817c0eSAdam Thomson 
6536d817c0eSAdam Thomson /* DA7219_ALC_ANTICLIP_LEVEL = 0xA2 */
6546d817c0eSAdam Thomson #define DA7219_ALC_ANTICLIP_LEVEL_SHIFT	0
6556d817c0eSAdam Thomson #define DA7219_ALC_ANTICLIP_LEVEL_MASK	(0x7F << 0)
6566d817c0eSAdam Thomson 
6576d817c0eSAdam Thomson /* DA7219_ALC_OFFSET_AUTO_M_L = 0xA3 */
6586d817c0eSAdam Thomson #define DA7219_ALC_OFFSET_AUTO_M_L_SHIFT	0
6596d817c0eSAdam Thomson #define DA7219_ALC_OFFSET_AUTO_M_L_MASK		(0xFF << 0)
6606d817c0eSAdam Thomson 
6616d817c0eSAdam Thomson /* DA7219_ALC_OFFSET_AUTO_U_L = 0xA4 */
6626d817c0eSAdam Thomson #define DA7219_ALC_OFFSET_AUTO_U_L_SHIFT	0
6636d817c0eSAdam Thomson #define DA7219_ALC_OFFSET_AUTO_U_L_MASK		(0xF << 0)
6646d817c0eSAdam Thomson 
6656d817c0eSAdam Thomson /* DA7219_DAC_NG_SETUP_TIME = 0xAF */
6666d817c0eSAdam Thomson #define DA7219_DAC_NG_SETUP_TIME_SHIFT	0
6676d817c0eSAdam Thomson #define DA7219_DAC_NG_SETUP_TIME_MASK	(0x3 << 0)
6686d817c0eSAdam Thomson #define DA7219_DAC_NG_SETUP_TIME_MAX	4
6696d817c0eSAdam Thomson #define DA7219_DAC_NG_RAMPUP_RATE_SHIFT	2
6706d817c0eSAdam Thomson #define DA7219_DAC_NG_RAMPUP_RATE_MASK	(0x1 << 2)
6716d817c0eSAdam Thomson #define DA7219_DAC_NG_RAMPDN_RATE_SHIFT	3
6726d817c0eSAdam Thomson #define DA7219_DAC_NG_RAMPDN_RATE_MASK	(0x1 << 3)
6736d817c0eSAdam Thomson #define DA7219_DAC_NG_RAMP_RATE_MAX	2
6746d817c0eSAdam Thomson 
6756d817c0eSAdam Thomson /* DA7219_DAC_NG_OFF_THRESH = 0xB0 */
6766d817c0eSAdam Thomson #define DA7219_DAC_NG_OFF_THRESHOLD_SHIFT	0
6776d817c0eSAdam Thomson #define DA7219_DAC_NG_OFF_THRESHOLD_MASK	(0x7 << 0)
6786d817c0eSAdam Thomson #define DA7219_DAC_NG_THRESHOLD_MAX		0x7
6796d817c0eSAdam Thomson 
6806d817c0eSAdam Thomson /* DA7219_DAC_NG_ON_THRESH = 0xB1 */
6816d817c0eSAdam Thomson #define DA7219_DAC_NG_ON_THRESHOLD_SHIFT	0
6826d817c0eSAdam Thomson #define DA7219_DAC_NG_ON_THRESHOLD_MASK		(0x7 << 0)
6836d817c0eSAdam Thomson 
6846d817c0eSAdam Thomson /* DA7219_DAC_NG_CTRL = 0xB2 */
6856d817c0eSAdam Thomson #define DA7219_DAC_NG_EN_SHIFT	7
6866d817c0eSAdam Thomson #define DA7219_DAC_NG_EN_MASK	(0x1 << 7)
6876d817c0eSAdam Thomson 
6886d817c0eSAdam Thomson /* DA7219_TONE_GEN_CFG1 = 0xB4 */
6896d817c0eSAdam Thomson #define DA7219_DTMF_REG_SHIFT		0
6906d817c0eSAdam Thomson #define DA7219_DTMF_REG_MASK		(0xF << 0)
6916d817c0eSAdam Thomson #define DA7219_DTMF_REG_MAX		16
6926d817c0eSAdam Thomson #define DA7219_DTMF_EN_SHIFT		4
6936d817c0eSAdam Thomson #define DA7219_DTMF_EN_MASK		(0x1 << 4)
6946d817c0eSAdam Thomson #define DA7219_START_STOPN_SHIFT	7
6956d817c0eSAdam Thomson #define DA7219_START_STOPN_MASK		(0x1 << 7)
6966d817c0eSAdam Thomson 
6976d817c0eSAdam Thomson /* DA7219_TONE_GEN_CFG2 = 0xB5 */
6986d817c0eSAdam Thomson #define DA7219_SWG_SEL_SHIFT		0
6996d817c0eSAdam Thomson #define DA7219_SWG_SEL_MASK		(0x3 << 0)
7006d817c0eSAdam Thomson #define DA7219_SWG_SEL_MAX		4
7016d817c0eSAdam Thomson #define DA7219_SWG_SEL_SRAMP		(0x3 << 0)
7026d817c0eSAdam Thomson #define DA7219_TONE_GEN_GAIN_SHIFT	4
7036d817c0eSAdam Thomson #define DA7219_TONE_GEN_GAIN_MASK	(0xF << 4)
7046d817c0eSAdam Thomson #define DA7219_TONE_GEN_GAIN_MAX	0xF
7056d817c0eSAdam Thomson #define DA7219_TONE_GEN_GAIN_MINUS_9DB	(0x3 << 4)
7066d817c0eSAdam Thomson #define DA7219_TONE_GEN_GAIN_MINUS_15DB	(0x5 << 4)
7076d817c0eSAdam Thomson 
7086d817c0eSAdam Thomson /* DA7219_TONE_GEN_CYCLES = 0xB6 */
7096d817c0eSAdam Thomson #define DA7219_BEEP_CYCLES_SHIFT	0
7106d817c0eSAdam Thomson #define DA7219_BEEP_CYCLES_MASK		(0x7 << 0)
7116d817c0eSAdam Thomson 
7126d817c0eSAdam Thomson /* DA7219_TONE_GEN_FREQ1_L = 0xB7 */
7136d817c0eSAdam Thomson #define DA7219_FREQ1_L_SHIFT	0
7146d817c0eSAdam Thomson #define DA7219_FREQ1_L_MASK	(0xFF << 0)
7156d817c0eSAdam Thomson #define DA7219_FREQ_MAX		0xFFFF
7166d817c0eSAdam Thomson 
7176d817c0eSAdam Thomson /* DA7219_TONE_GEN_FREQ1_U = 0xB8 */
7186d817c0eSAdam Thomson #define DA7219_FREQ1_U_SHIFT	0
7196d817c0eSAdam Thomson #define DA7219_FREQ1_U_MASK	(0xFF << 0)
7206d817c0eSAdam Thomson 
7216d817c0eSAdam Thomson /* DA7219_TONE_GEN_FREQ2_L = 0xB9 */
7226d817c0eSAdam Thomson #define DA7219_FREQ2_L_SHIFT	0
7236d817c0eSAdam Thomson #define DA7219_FREQ2_L_MASK	(0xFF << 0)
7246d817c0eSAdam Thomson 
7256d817c0eSAdam Thomson /* DA7219_TONE_GEN_FREQ2_U = 0xBA */
7266d817c0eSAdam Thomson #define DA7219_FREQ2_U_SHIFT	0
7276d817c0eSAdam Thomson #define DA7219_FREQ2_U_MASK	(0xFF << 0)
7286d817c0eSAdam Thomson 
7296d817c0eSAdam Thomson /* DA7219_TONE_GEN_ON_PER = 0xBB */
7306d817c0eSAdam Thomson #define DA7219_BEEP_ON_PER_SHIFT	0
7316d817c0eSAdam Thomson #define DA7219_BEEP_ON_PER_MASK		(0x3F << 0)
7326d817c0eSAdam Thomson #define DA7219_BEEP_ON_OFF_MAX		0x3F
7336d817c0eSAdam Thomson 
7346d817c0eSAdam Thomson /* DA7219_TONE_GEN_OFF_PER = 0xBC */
7356d817c0eSAdam Thomson #define DA7219_BEEP_OFF_PER_SHIFT	0
7366d817c0eSAdam Thomson #define DA7219_BEEP_OFF_PER_MASK	(0x3F << 0)
7376d817c0eSAdam Thomson 
7386d817c0eSAdam Thomson /* DA7219_SYSTEM_STATUS = 0xE0 */
7396d817c0eSAdam Thomson #define DA7219_SC1_BUSY_SHIFT	0
7406d817c0eSAdam Thomson #define DA7219_SC1_BUSY_MASK	(0x1 << 0)
7416d817c0eSAdam Thomson #define DA7219_SC2_BUSY_SHIFT	1
7426d817c0eSAdam Thomson #define DA7219_SC2_BUSY_MASK	(0x1 << 1)
7436d817c0eSAdam Thomson 
7446d817c0eSAdam Thomson /* DA7219_SYSTEM_ACTIVE = 0xFD */
7456d817c0eSAdam Thomson #define DA7219_SYSTEM_ACTIVE_SHIFT	0
7466d817c0eSAdam Thomson #define DA7219_SYSTEM_ACTIVE_MASK	(0x1 << 0)
7476d817c0eSAdam Thomson 
7486d817c0eSAdam Thomson 
7496d817c0eSAdam Thomson /*
7506d817c0eSAdam Thomson  * General defines & data
7516d817c0eSAdam Thomson  */
7526d817c0eSAdam Thomson 
7536d817c0eSAdam Thomson /* Register inversion */
7546d817c0eSAdam Thomson #define DA7219_NO_INVERT	0
7556d817c0eSAdam Thomson #define DA7219_INVERT		1
7566d817c0eSAdam Thomson 
7576d817c0eSAdam Thomson /* Byte related defines */
7586d817c0eSAdam Thomson #define DA7219_BYTE_SHIFT	8
7596d817c0eSAdam Thomson #define DA7219_BYTE_MASK	0xFF
7606d817c0eSAdam Thomson 
7616d817c0eSAdam Thomson /* PLL Output Frequencies */
7626d817c0eSAdam Thomson #define DA7219_PLL_FREQ_OUT_90316	90316800
7636d817c0eSAdam Thomson #define DA7219_PLL_FREQ_OUT_98304	98304000
7646d817c0eSAdam Thomson 
7656d817c0eSAdam Thomson /* PLL Frequency Dividers */
76663a450aaSAdam Thomson #define DA7219_PLL_INDIV_2_TO_4_5_MHZ_VAL	1
76763a450aaSAdam Thomson #define DA7219_PLL_INDIV_4_5_TO_9_MHZ_VAL	2
76863a450aaSAdam Thomson #define DA7219_PLL_INDIV_9_TO_18_MHZ_VAL	4
76963a450aaSAdam Thomson #define DA7219_PLL_INDIV_18_TO_36_MHZ_VAL	8
77063a450aaSAdam Thomson #define DA7219_PLL_INDIV_36_TO_54_MHZ_VAL	16
7716d817c0eSAdam Thomson 
7726d817c0eSAdam Thomson /* SRM */
7736d817c0eSAdam Thomson #define DA7219_SRM_CHECK_RETRIES	8
7746d817c0eSAdam Thomson 
775a7f16ea9SAdam Thomson /* System Controller */
776a7f16ea9SAdam Thomson #define DA7219_SYS_STAT_CHECK_RETRIES	6
777a7f16ea9SAdam Thomson #define DA7219_SYS_STAT_CHECK_DELAY	50
778a7f16ea9SAdam Thomson 
77986834511SAdam Thomson /* Power up/down Delays */
78086834511SAdam Thomson #define DA7219_SETTLING_DELAY		40
78186834511SAdam Thomson #define DA7219_MIN_GAIN_DELAY		30
78217c81d2fSAdam Thomson #define DA7219_MIC_PGA_BASE_DELAY	100
78317c81d2fSAdam Thomson #define DA7219_MIC_PGA_OFFSET_DELAY	40
78486834511SAdam Thomson 
7856d817c0eSAdam Thomson enum da7219_clk_src {
7866d817c0eSAdam Thomson 	DA7219_CLKSRC_MCLK = 0,
7876d817c0eSAdam Thomson 	DA7219_CLKSRC_MCLK_SQR,
7886d817c0eSAdam Thomson };
7896d817c0eSAdam Thomson 
7906d817c0eSAdam Thomson enum da7219_sys_clk {
7916d817c0eSAdam Thomson 	DA7219_SYSCLK_MCLK = 0,
7926d817c0eSAdam Thomson 	DA7219_SYSCLK_PLL,
7936d817c0eSAdam Thomson 	DA7219_SYSCLK_PLL_SRM,
7946d817c0eSAdam Thomson };
7956d817c0eSAdam Thomson 
7966d817c0eSAdam Thomson /* Regulators */
7976d817c0eSAdam Thomson enum da7219_supplies {
7986d817c0eSAdam Thomson 	DA7219_SUPPLY_VDD = 0,
7996d817c0eSAdam Thomson 	DA7219_SUPPLY_VDDMIC,
8006d817c0eSAdam Thomson 	DA7219_SUPPLY_VDDIO,
8016d817c0eSAdam Thomson 	DA7219_NUM_SUPPLIES,
8026d817c0eSAdam Thomson };
8036d817c0eSAdam Thomson 
8046d817c0eSAdam Thomson struct da7219_aad_priv;
8056d817c0eSAdam Thomson 
8066d817c0eSAdam Thomson /* Private data */
8076d817c0eSAdam Thomson struct da7219_priv {
808a58943abSAdam Thomson 	struct snd_soc_component *component;
8096d817c0eSAdam Thomson 	struct da7219_aad_priv *aad;
8106d817c0eSAdam Thomson 	struct da7219_pdata *pdata;
8116d817c0eSAdam Thomson 
812bb0c35fcSAdam Thomson 	bool wakeup_source;
8136d817c0eSAdam Thomson 	struct regulator_bulk_data supplies[DA7219_NUM_SUPPLIES];
8146d817c0eSAdam Thomson 	struct regmap *regmap;
8152a0c2189SAdam Thomson 	struct mutex ctrl_lock;
8162a0c2189SAdam Thomson 	struct mutex pll_lock;
8176d817c0eSAdam Thomson 
818fc8f7ea2SAdam Thomson #ifdef CONFIG_COMMON_CLK
819d90ba6c8SAdam Thomson 	struct clk_hw dai_clks_hw[DA7219_DAI_NUM_CLKS];
820fc8f7ea2SAdam Thomson #endif
821d90ba6c8SAdam Thomson 	struct clk_lookup *dai_clks_lookup[DA7219_DAI_NUM_CLKS];
822d90ba6c8SAdam Thomson 	struct clk *dai_clks[DA7219_DAI_NUM_CLKS];
823fc8f7ea2SAdam Thomson 
8246d817c0eSAdam Thomson 	struct clk *mclk;
8256d817c0eSAdam Thomson 	unsigned int mclk_rate;
8266d817c0eSAdam Thomson 	int clk_src;
8276d817c0eSAdam Thomson 
8286d817c0eSAdam Thomson 	bool master;
8299fd72954SAdam Thomson 	bool tdm_en;
8306d817c0eSAdam Thomson 	bool alc_en;
83117c81d2fSAdam Thomson 	bool micbias_on_event;
83217c81d2fSAdam Thomson 	unsigned int mic_pga_delay;
83386834511SAdam Thomson 	u8 gain_ramp_ctrl;
8346d817c0eSAdam Thomson };
8356d817c0eSAdam Thomson 
83645101122SKuninori Morimoto int da7219_set_pll(struct snd_soc_component *component, int source, unsigned int fout);
8372a0c2189SAdam Thomson 
8386d817c0eSAdam Thomson #endif /* __DA7219_H */
839