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