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