xref: /linux/sound/soc/codecs/da732x.h (revision aa47746269b0f87b3c042db7453b9e461029aed7)
148e27874SAdam Thomson /*
248e27874SAdam Thomson  * da732x.h -- Dialog DA732X ALSA SoC Audio Driver Header File
348e27874SAdam Thomson  *
448e27874SAdam Thomson  * Copyright (C) 2012 Dialog Semiconductor GmbH
548e27874SAdam Thomson  *
648e27874SAdam Thomson  * Author: Michal Hajduk <Michal.Hajduk@diasemi.com>
748e27874SAdam Thomson  *
848e27874SAdam Thomson  * This program is free software; you can redistribute it and/or modify
948e27874SAdam Thomson  * it under the terms of the GNU General Public License version 2 as
1048e27874SAdam Thomson  * published by the Free Software Foundation.
1148e27874SAdam Thomson  */
1248e27874SAdam Thomson 
1348e27874SAdam Thomson #ifndef __DA732X_H_
14*aa477462SRasmus Villemoes #define __DA732X_H_
1548e27874SAdam Thomson 
1648e27874SAdam Thomson #include <sound/soc.h>
1748e27874SAdam Thomson 
1848e27874SAdam Thomson /* General */
1948e27874SAdam Thomson #define	DA732X_U8_MASK			0xFF
2048e27874SAdam Thomson #define	DA732X_4BYTES			4
2148e27874SAdam Thomson #define	DA732X_3BYTES			3
2248e27874SAdam Thomson #define	DA732X_2BYTES			2
2348e27874SAdam Thomson #define	DA732X_1BYTE			1
2448e27874SAdam Thomson #define	DA732X_1BYTE_SHIFT		8
2548e27874SAdam Thomson #define	DA732X_2BYTES_SHIFT		16
2648e27874SAdam Thomson #define	DA732X_3BYTES_SHIFT		24
2748e27874SAdam Thomson #define	DA732X_4BYTES_SHIFT		32
2848e27874SAdam Thomson 
2948e27874SAdam Thomson #define	DA732X_DACS_DIS			0x0
3048e27874SAdam Thomson #define	DA732X_HP_DIS			0x0
3148e27874SAdam Thomson #define	DA732X_CLEAR_REG		0x0
3248e27874SAdam Thomson 
3348e27874SAdam Thomson /* Calibration */
3448e27874SAdam Thomson #define	DA732X_DAC_OFFSET_STEP		0x20
3548e27874SAdam Thomson #define	DA732X_OUTPUT_OFFSET_STEP	0x80
3648e27874SAdam Thomson #define	DA732X_HP_OUT_TRIM_VAL		0x0
3748e27874SAdam Thomson #define	DA732X_WAIT_FOR_STABILIZATION	1
3848e27874SAdam Thomson #define	DA732X_HPL_DAC			0
3948e27874SAdam Thomson #define	DA732X_HPR_DAC			1
4048e27874SAdam Thomson #define	DA732X_HP_DACS			2
4148e27874SAdam Thomson #define	DA732X_HPL_AMP			0
4248e27874SAdam Thomson #define	DA732X_HPR_AMP			1
4348e27874SAdam Thomson #define	DA732X_HP_AMPS			2
4448e27874SAdam Thomson 
4548e27874SAdam Thomson /* Clock settings */
4648e27874SAdam Thomson #define DA732X_STARTUP_DELAY		100
4748e27874SAdam Thomson #define	DA732X_PLL_OUT_196608		196608000
4848e27874SAdam Thomson #define	DA732X_PLL_OUT_180634		180633600
4948e27874SAdam Thomson #define	DA732X_PLL_OUT_SRM		188620800
5048e27874SAdam Thomson #define	DA732X_MCLK_10MHZ		10000000
5148e27874SAdam Thomson #define	DA732X_MCLK_20MHZ		20000000
5248e27874SAdam Thomson #define	DA732X_MCLK_40MHZ		40000000
5348e27874SAdam Thomson #define	DA732X_MCLK_54MHZ		54000000
5448e27874SAdam Thomson #define	DA732X_MCLK_RET_0_10MHZ		0
5548e27874SAdam Thomson #define	DA732X_MCLK_VAL_0_10MHZ		1
5648e27874SAdam Thomson #define	DA732X_MCLK_RET_10_20MHZ	1
5748e27874SAdam Thomson #define	DA732X_MCLK_VAL_10_20MHZ	2
5848e27874SAdam Thomson #define	DA732X_MCLK_RET_20_40MHZ	2
5948e27874SAdam Thomson #define	DA732X_MCLK_VAL_20_40MHZ	4
6048e27874SAdam Thomson #define	DA732X_MCLK_RET_40_54MHZ	3
6148e27874SAdam Thomson #define	DA732X_MCLK_VAL_40_54MHZ	8
6248e27874SAdam Thomson #define	DA732X_DAI_ID1			0
6348e27874SAdam Thomson #define	DA732X_DAI_ID2			1
6448e27874SAdam Thomson #define	DA732X_SRCCLK_PLL		0
6548e27874SAdam Thomson #define	DA732X_SRCCLK_MCLK		1
6648e27874SAdam Thomson 
6748e27874SAdam Thomson #define	DA732X_LIN_LP_VOL		0x4F
6848e27874SAdam Thomson #define	DA732X_LP_VOL			0x40
6948e27874SAdam Thomson 
7048e27874SAdam Thomson /* Kcontrols */
7148e27874SAdam Thomson #define	DA732X_DAC_EN_MAX		2
7248e27874SAdam Thomson #define	DA732X_ADCL_MUX_MAX		2
7348e27874SAdam Thomson #define	DA732X_ADCR_MUX_MAX		3
7448e27874SAdam Thomson #define	DA732X_HPF_MODE_MAX		3
7548e27874SAdam Thomson #define	DA732X_HPF_MODE_SHIFT		4
7648e27874SAdam Thomson #define	DA732X_HPF_MUSIC_SHIFT		0
7748e27874SAdam Thomson #define	DA732X_HPF_MUSIC_MAX		4
7848e27874SAdam Thomson #define	DA732X_HPF_VOICE_SHIFT		4
7948e27874SAdam Thomson #define	DA732X_HPF_VOICE_MAX		8
8048e27874SAdam Thomson #define	DA732X_EQ_EN_MAX		1
8148e27874SAdam Thomson #define	DA732X_HPF_VOICE		1
8248e27874SAdam Thomson #define	DA732X_HPF_MUSIC		2
8348e27874SAdam Thomson #define	DA732X_HPF_DISABLED		0
8448e27874SAdam Thomson #define	DA732X_NO_INVERT		0
8548e27874SAdam Thomson #define	DA732X_INVERT			1
8648e27874SAdam Thomson #define	DA732X_SWITCH_MAX		1
8748e27874SAdam Thomson #define	DA732X_ENABLE_CP		1
8848e27874SAdam Thomson #define	DA732X_DISABLE_CP		0
8948e27874SAdam Thomson #define	DA732X_DISABLE_ALL_CLKS		0
9048e27874SAdam Thomson #define	DA732X_RESET_ADCS		0
9148e27874SAdam Thomson 
9248e27874SAdam Thomson /* dB values */
9348e27874SAdam Thomson #define DA732X_MIC_VOL_DB_MIN		0
9448e27874SAdam Thomson #define DA732X_MIC_VOL_DB_INC		50
9548e27874SAdam Thomson #define DA732X_MIC_PRE_VOL_DB_MIN	0
9648e27874SAdam Thomson #define DA732X_MIC_PRE_VOL_DB_INC	600
9748e27874SAdam Thomson #define DA732X_AUX_VOL_DB_MIN		-6000
9848e27874SAdam Thomson #define DA732X_AUX_VOL_DB_INC		150
9948e27874SAdam Thomson #define DA732X_HP_VOL_DB_MIN		-2250
10048e27874SAdam Thomson #define DA732X_HP_VOL_DB_INC		150
10148e27874SAdam Thomson #define	DA732X_LIN2_VOL_DB_MIN		-1650
10248e27874SAdam Thomson #define	DA732X_LIN2_VOL_DB_INC		150
10348e27874SAdam Thomson #define	DA732X_LIN3_VOL_DB_MIN		-1650
10448e27874SAdam Thomson #define DA732X_LIN3_VOL_DB_INC		150
10548e27874SAdam Thomson #define	DA732X_LIN4_VOL_DB_MIN		-2250
10648e27874SAdam Thomson #define DA732X_LIN4_VOL_DB_INC		150
10748e27874SAdam Thomson #define	DA732X_EQ_BAND_VOL_DB_MIN	-1050
10848e27874SAdam Thomson #define	DA732X_EQ_BAND_VOL_DB_INC	150
10948e27874SAdam Thomson #define DA732X_DAC_VOL_DB_MIN		-7725
11048e27874SAdam Thomson #define DA732X_DAC_VOL_DB_INC		75
11148e27874SAdam Thomson #define DA732X_ADC_VOL_DB_MIN		0
11248e27874SAdam Thomson #define DA732X_ADC_VOL_DB_INC		-1
11348e27874SAdam Thomson #define	DA732X_EQ_OVERALL_VOL_DB_MIN	-1800
11448e27874SAdam Thomson #define	DA732X_EQ_OVERALL_VOL_DB_INC	600
11548e27874SAdam Thomson 
11648e27874SAdam Thomson enum da732x_sysctl {
11748e27874SAdam Thomson 	DA732X_SR_8KHZ		= 0x1,
11848e27874SAdam Thomson 	DA732X_SR_11_025KHZ	= 0x2,
11948e27874SAdam Thomson 	DA732X_SR_12KHZ		= 0x3,
12048e27874SAdam Thomson 	DA732X_SR_16KHZ		= 0x5,
12148e27874SAdam Thomson 	DA732X_SR_22_05KHZ	= 0x6,
12248e27874SAdam Thomson 	DA732X_SR_24KHZ		= 0x7,
12348e27874SAdam Thomson 	DA732X_SR_32KHZ		= 0x9,
12448e27874SAdam Thomson 	DA732X_SR_44_1KHZ	= 0xA,
12548e27874SAdam Thomson 	DA732X_SR_48KHZ		= 0xB,
12648e27874SAdam Thomson 	DA732X_SR_88_1KHZ	= 0xE,
12748e27874SAdam Thomson 	DA732X_SR_96KHZ		= 0xF,
12848e27874SAdam Thomson };
12948e27874SAdam Thomson 
13048e27874SAdam Thomson #endif /* __DA732X_H_ */
131