linux/include/linux/mfd/twl4030-audio.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * MFD driver for twl4030 audio submodule
 *
 * Author: Peter Ujfalusi <[email protected]>
 *
 * Copyright:   (C) 2009 Nokia Corporation
 */

#ifndef __TWL4030_CODEC_H__
#define __TWL4030_CODEC_H__

/* Codec registers */
#define TWL4030_REG_CODEC_MODE
#define TWL4030_REG_OPTION
#define TWL4030_REG_UNKNOWN
#define TWL4030_REG_MICBIAS_CTL
#define TWL4030_REG_ANAMICL
#define TWL4030_REG_ANAMICR
#define TWL4030_REG_AVADC_CTL
#define TWL4030_REG_ADCMICSEL
#define TWL4030_REG_DIGMIXING
#define TWL4030_REG_ATXL1PGA
#define TWL4030_REG_ATXR1PGA
#define TWL4030_REG_AVTXL2PGA
#define TWL4030_REG_AVTXR2PGA
#define TWL4030_REG_AUDIO_IF
#define TWL4030_REG_VOICE_IF
#define TWL4030_REG_ARXR1PGA
#define TWL4030_REG_ARXL1PGA
#define TWL4030_REG_ARXR2PGA
#define TWL4030_REG_ARXL2PGA
#define TWL4030_REG_VRXPGA
#define TWL4030_REG_VSTPGA
#define TWL4030_REG_VRX2ARXPGA
#define TWL4030_REG_AVDAC_CTL
#define TWL4030_REG_ARX2VTXPGA
#define TWL4030_REG_ARXL1_APGA_CTL
#define TWL4030_REG_ARXR1_APGA_CTL
#define TWL4030_REG_ARXL2_APGA_CTL
#define TWL4030_REG_ARXR2_APGA_CTL
#define TWL4030_REG_ATX2ARXPGA
#define TWL4030_REG_BT_IF
#define TWL4030_REG_BTPGA
#define TWL4030_REG_BTSTPGA
#define TWL4030_REG_EAR_CTL
#define TWL4030_REG_HS_SEL
#define TWL4030_REG_HS_GAIN_SET
#define TWL4030_REG_HS_POPN_SET
#define TWL4030_REG_PREDL_CTL
#define TWL4030_REG_PREDR_CTL
#define TWL4030_REG_PRECKL_CTL
#define TWL4030_REG_PRECKR_CTL
#define TWL4030_REG_HFL_CTL
#define TWL4030_REG_HFR_CTL
#define TWL4030_REG_ALC_CTL
#define TWL4030_REG_ALC_SET1
#define TWL4030_REG_ALC_SET2
#define TWL4030_REG_BOOST_CTL
#define TWL4030_REG_SOFTVOL_CTL
#define TWL4030_REG_DTMF_FREQSEL
#define TWL4030_REG_DTMF_TONEXT1H
#define TWL4030_REG_DTMF_TONEXT1L
#define TWL4030_REG_DTMF_TONEXT2H
#define TWL4030_REG_DTMF_TONEXT2L
#define TWL4030_REG_DTMF_TONOFF
#define TWL4030_REG_DTMF_WANONOFF
#define TWL4030_REG_I2S_RX_SCRAMBLE_H
#define TWL4030_REG_I2S_RX_SCRAMBLE_M
#define TWL4030_REG_I2S_RX_SCRAMBLE_L
#define TWL4030_REG_APLL_CTL
#define TWL4030_REG_DTMF_CTL
#define TWL4030_REG_DTMF_PGA_CTL2
#define TWL4030_REG_DTMF_PGA_CTL1
#define TWL4030_REG_MISC_SET_1
#define TWL4030_REG_PCMBTMUX
#define TWL4030_REG_RX_PATH_SEL
#define TWL4030_REG_VDL_APGA_CTL
#define TWL4030_REG_VIBRA_CTL
#define TWL4030_REG_VIBRA_SET
#define TWL4030_REG_VIBRA_PWM_SET
#define TWL4030_REG_ANAMIC_GAIN
#define TWL4030_REG_MISC_SET_2

/* Bitfield Definitions */

/* TWL4030_CODEC_MODE (0x01) Fields */
#define TWL4030_APLL_RATE
#define TWL4030_APLL_RATE_8000
#define TWL4030_APLL_RATE_11025
#define TWL4030_APLL_RATE_12000
#define TWL4030_APLL_RATE_16000
#define TWL4030_APLL_RATE_22050
#define TWL4030_APLL_RATE_24000
#define TWL4030_APLL_RATE_32000
#define TWL4030_APLL_RATE_44100
#define TWL4030_APLL_RATE_48000
#define TWL4030_APLL_RATE_96000
#define TWL4030_SEL_16K
#define TWL4030_CODECPDZ
#define TWL4030_OPT_MODE
#define TWL4030_OPTION_1
#define TWL4030_OPTION_2

/* TWL4030_OPTION (0x02) Fields */
#define TWL4030_ATXL1_EN
#define TWL4030_ATXR1_EN
#define TWL4030_ATXL2_VTXL_EN
#define TWL4030_ATXR2_VTXR_EN
#define TWL4030_ARXL1_VRX_EN
#define TWL4030_ARXR1_EN
#define TWL4030_ARXL2_EN
#define TWL4030_ARXR2_EN

/* TWL4030_REG_MICBIAS_CTL (0x04) Fields */
#define TWL4030_MICBIAS2_CTL
#define TWL4030_MICBIAS1_CTL
#define TWL4030_HSMICBIAS_EN
#define TWL4030_MICBIAS2_EN
#define TWL4030_MICBIAS1_EN

/* ANAMICL (0x05) Fields */
#define TWL4030_CNCL_OFFSET_START
#define TWL4030_OFFSET_CNCL_SEL
#define TWL4030_OFFSET_CNCL_SEL_ARX1
#define TWL4030_OFFSET_CNCL_SEL_ARX2
#define TWL4030_OFFSET_CNCL_SEL_VRX
#define TWL4030_OFFSET_CNCL_SEL_ALL
#define TWL4030_MICAMPL_EN
#define TWL4030_CKMIC_EN
#define TWL4030_AUXL_EN
#define TWL4030_HSMIC_EN
#define TWL4030_MAINMIC_EN

/* ANAMICR (0x06) Fields */
#define TWL4030_MICAMPR_EN
#define TWL4030_AUXR_EN
#define TWL4030_SUBMIC_EN

/* AVADC_CTL (0x07) Fields */
#define TWL4030_ADCL_EN
#define TWL4030_AVADC_CLK_PRIORITY
#define TWL4030_ADCR_EN

/* TWL4030_REG_ADCMICSEL (0x08) Fields */
#define TWL4030_DIGMIC1_EN
#define TWL4030_TX2IN_SEL
#define TWL4030_DIGMIC0_EN
#define TWL4030_TX1IN_SEL

/* AUDIO_IF (0x0E) Fields */
#define TWL4030_AIF_SLAVE_EN
#define TWL4030_DATA_WIDTH
#define TWL4030_DATA_WIDTH_16S_16W
#define TWL4030_DATA_WIDTH_32S_16W
#define TWL4030_DATA_WIDTH_32S_24W
#define TWL4030_AIF_FORMAT
#define TWL4030_AIF_FORMAT_CODEC
#define TWL4030_AIF_FORMAT_LEFT
#define TWL4030_AIF_FORMAT_RIGHT
#define TWL4030_AIF_FORMAT_TDM
#define TWL4030_AIF_TRI_EN
#define TWL4030_CLK256FS_EN
#define TWL4030_AIF_EN

/* VOICE_IF (0x0F) Fields */
#define TWL4030_VIF_SLAVE_EN
#define TWL4030_VIF_DIN_EN
#define TWL4030_VIF_DOUT_EN
#define TWL4030_VIF_SWAP
#define TWL4030_VIF_FORMAT
#define TWL4030_VIF_TRI_EN
#define TWL4030_VIF_SUB_EN
#define TWL4030_VIF_EN

/* EAR_CTL (0x21) */
#define TWL4030_EAR_GAIN

/* HS_GAIN_SET (0x23) Fields */
#define TWL4030_HSR_GAIN
#define TWL4030_HSR_GAIN_PWR_DOWN
#define TWL4030_HSR_GAIN_PLUS_6DB
#define TWL4030_HSR_GAIN_0DB
#define TWL4030_HSR_GAIN_MINUS_6DB
#define TWL4030_HSL_GAIN
#define TWL4030_HSL_GAIN_PWR_DOWN
#define TWL4030_HSL_GAIN_PLUS_6DB
#define TWL4030_HSL_GAIN_0DB
#define TWL4030_HSL_GAIN_MINUS_6DB

/* HS_POPN_SET (0x24) Fields */
#define TWL4030_VMID_EN
#define TWL4030_EXTMUTE
#define TWL4030_RAMP_DELAY
#define TWL4030_RAMP_DELAY_20MS
#define TWL4030_RAMP_DELAY_40MS
#define TWL4030_RAMP_DELAY_81MS
#define TWL4030_RAMP_DELAY_161MS
#define TWL4030_RAMP_DELAY_323MS
#define TWL4030_RAMP_DELAY_645MS
#define TWL4030_RAMP_DELAY_1291MS
#define TWL4030_RAMP_DELAY_2581MS
#define TWL4030_RAMP_EN

/* PREDL_CTL (0x25) */
#define TWL4030_PREDL_GAIN

/* PREDR_CTL (0x26) */
#define TWL4030_PREDR_GAIN

/* PRECKL_CTL (0x27) */
#define TWL4030_PRECKL_GAIN

/* PRECKR_CTL (0x28) */
#define TWL4030_PRECKR_GAIN

/* HFL_CTL (0x29, 0x2A) Fields */
#define TWL4030_HF_CTL_HB_EN
#define TWL4030_HF_CTL_LOOP_EN
#define TWL4030_HF_CTL_RAMP_EN
#define TWL4030_HF_CTL_REF_EN

/* APLL_CTL (0x3A) Fields */
#define TWL4030_APLL_EN
#define TWL4030_APLL_INFREQ
#define TWL4030_APLL_INFREQ_19200KHZ
#define TWL4030_APLL_INFREQ_26000KHZ
#define TWL4030_APLL_INFREQ_38400KHZ

/* REG_MISC_SET_1 (0x3E) Fields */
#define TWL4030_CLK64_EN
#define TWL4030_SCRAMBLE_EN
#define TWL4030_FMLOOP_EN
#define TWL4030_SMOOTH_ANAVOL_EN
#define TWL4030_DIGMIC_LR_SWAP_EN

/* VIBRA_CTL (0x45) */
#define TWL4030_VIBRA_EN
#define TWL4030_VIBRA_DIR
#define TWL4030_VIBRA_AUDIO_SEL_L1
#define TWL4030_VIBRA_AUDIO_SEL_R1
#define TWL4030_VIBRA_AUDIO_SEL_L2
#define TWL4030_VIBRA_AUDIO_SEL_R2
#define TWL4030_VIBRA_SEL
#define TWL4030_VIBRA_DIR_SEL

/* TWL4030 codec resource IDs */
enum twl4030_audio_res {};

int twl4030_audio_disable_resource(enum twl4030_audio_res id);
int twl4030_audio_enable_resource(enum twl4030_audio_res id);
unsigned int twl4030_audio_get_mclk(void);

#endif	/* End of __TWL4030_CODEC_H__ */