1 /* SPDX-License-Identifier: GPL-2.0-or-later * << 2 /* 1 /* 3 * File: sound/soc/codecs/ssm2602.h 2 * File: sound/soc/codecs/ssm2602.h 4 * Author: Cliff Cai <Cliff.Cai@analog.c 3 * Author: Cliff Cai <Cliff.Cai@analog.com> 5 * 4 * 6 * Created: Tue June 06 2008 5 * Created: Tue June 06 2008 7 * 6 * 8 * Modified: 7 * Modified: 9 * Copyright 2008 Analog Devices 8 * Copyright 2008 Analog Devices Inc. 10 * 9 * 11 * Bugs: Enter bugs at http://blackfin 10 * Bugs: Enter bugs at http://blackfin.uclinux.org/ >> 11 * >> 12 * This program is free software; you can redistribute it and/or modify >> 13 * it under the terms of the GNU General Public License as published by >> 14 * the Free Software Foundation; either version 2 of the License, or >> 15 * (at your option) any later version. >> 16 * >> 17 * This program is distributed in the hope that it will be useful, >> 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of >> 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> 20 * GNU General Public License for more details. >> 21 * >> 22 * You should have received a copy of the GNU General Public License >> 23 * along with this program; if not, see the file COPYING, or write >> 24 * to the Free Software Foundation, Inc., >> 25 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 12 */ 26 */ 13 27 14 #ifndef _SSM2602_H 28 #ifndef _SSM2602_H 15 #define _SSM2602_H 29 #define _SSM2602_H 16 30 17 #include <linux/regmap.h> 31 #include <linux/regmap.h> 18 32 19 struct device; 33 struct device; 20 34 21 enum ssm2602_type { 35 enum ssm2602_type { 22 SSM2602, 36 SSM2602, 23 SSM2604, 37 SSM2604, 24 }; 38 }; 25 39 26 extern const struct regmap_config ssm2602_regm 40 extern const struct regmap_config ssm2602_regmap_config; 27 41 28 int ssm2602_probe(struct device *dev, enum ssm 42 int ssm2602_probe(struct device *dev, enum ssm2602_type type, 29 struct regmap *regmap); 43 struct regmap *regmap); 30 44 31 /* SSM2602 Codec Register definitions */ 45 /* SSM2602 Codec Register definitions */ 32 46 33 #define SSM2602_LINVOL 0x00 47 #define SSM2602_LINVOL 0x00 34 #define SSM2602_RINVOL 0x01 48 #define SSM2602_RINVOL 0x01 35 #define SSM2602_LOUT1V 0x02 49 #define SSM2602_LOUT1V 0x02 36 #define SSM2602_ROUT1V 0x03 50 #define SSM2602_ROUT1V 0x03 37 #define SSM2602_APANA 0x04 51 #define SSM2602_APANA 0x04 38 #define SSM2602_APDIGI 0x05 52 #define SSM2602_APDIGI 0x05 39 #define SSM2602_PWR 0x06 53 #define SSM2602_PWR 0x06 40 #define SSM2602_IFACE 0x07 54 #define SSM2602_IFACE 0x07 41 #define SSM2602_SRATE 0x08 55 #define SSM2602_SRATE 0x08 42 #define SSM2602_ACTIVE 0x09 56 #define SSM2602_ACTIVE 0x09 43 #define SSM2602_RESET 0x0f 57 #define SSM2602_RESET 0x0f 44 58 45 /*SSM2602 Codec Register Field definitions 59 /*SSM2602 Codec Register Field definitions 46 *(Mask value to extract the corresponding Reg 60 *(Mask value to extract the corresponding Register field) 47 */ 61 */ 48 62 49 /*Left ADC Volume Control (SSM2602_REG_LEFT_AD 63 /*Left ADC Volume Control (SSM2602_REG_LEFT_ADC_VOL)*/ 50 #define LINVOL_LIN_VOL 0x01 64 #define LINVOL_LIN_VOL 0x01F /* Left Channel PGA Volume control */ 51 #define LINVOL_LIN_ENABLE_MUTE 0x08 65 #define LINVOL_LIN_ENABLE_MUTE 0x080 /* Left Channel Input Mute */ 52 #define LINVOL_LRIN_BOTH 0x10 66 #define LINVOL_LRIN_BOTH 0x100 /* Left Channel Line Input Volume update */ 53 67 54 /*Right ADC Volume Control (SSM2602_REG_RIGHT_ 68 /*Right ADC Volume Control (SSM2602_REG_RIGHT_ADC_VOL)*/ 55 #define RINVOL_RIN_VOL 0x01 69 #define RINVOL_RIN_VOL 0x01F /* Right Channel PGA Volume control */ 56 #define RINVOL_RIN_ENABLE_MUTE 0x08 70 #define RINVOL_RIN_ENABLE_MUTE 0x080 /* Right Channel Input Mute */ 57 #define RINVOL_RLIN_BOTH 0x10 71 #define RINVOL_RLIN_BOTH 0x100 /* Right Channel Line Input Volume update */ 58 72 59 /*Left DAC Volume Control (SSM2602_REG_LEFT_DA 73 /*Left DAC Volume Control (SSM2602_REG_LEFT_DAC_VOL)*/ 60 #define LOUT1V_LHP_VOL 0x07 74 #define LOUT1V_LHP_VOL 0x07F /* Left Channel Headphone volume control */ 61 #define LOUT1V_ENABLE_LZC 0x08 75 #define LOUT1V_ENABLE_LZC 0x080 /* Left Channel Zero cross detect enable */ 62 #define LOUT1V_LRHP_BOTH 0x10 76 #define LOUT1V_LRHP_BOTH 0x100 /* Left Channel Headphone volume update */ 63 77 64 /*Right DAC Volume Control (SSM2602_REG_RIGHT_ 78 /*Right DAC Volume Control (SSM2602_REG_RIGHT_DAC_VOL)*/ 65 #define ROUT1V_RHP_VOL 0x07 79 #define ROUT1V_RHP_VOL 0x07F /* Right Channel Headphone volume control */ 66 #define ROUT1V_ENABLE_RZC 0x08 80 #define ROUT1V_ENABLE_RZC 0x080 /* Right Channel Zero cross detect enable */ 67 #define ROUT1V_RLHP_BOTH 0x10 81 #define ROUT1V_RLHP_BOTH 0x100 /* Right Channel Headphone volume update */ 68 82 69 /*Analogue Audio Path Control (SSM2602_REG_ANA 83 /*Analogue Audio Path Control (SSM2602_REG_ANALOGUE_PATH)*/ 70 #define APANA_ENABLE_MIC_BOOST 0x001 84 #define APANA_ENABLE_MIC_BOOST 0x001 /* Primary Microphone Amplifier gain booster control */ 71 #define APANA_ENABLE_MIC_MUTE 0x002 85 #define APANA_ENABLE_MIC_MUTE 0x002 /* Microphone Mute Control */ 72 #define APANA_ADC_IN_SELECT 0x004 86 #define APANA_ADC_IN_SELECT 0x004 /* Microphone/Line IN select to ADC (1=MIC, 0=Line In) */ 73 #define APANA_ENABLE_BYPASS 0x008 87 #define APANA_ENABLE_BYPASS 0x008 /* Line input bypass to line output */ 74 #define APANA_SELECT_DAC 0x010 88 #define APANA_SELECT_DAC 0x010 /* Select DAC (1=Select DAC, 0=Don't Select DAC) */ 75 #define APANA_ENABLE_SIDETONE 0x020 89 #define APANA_ENABLE_SIDETONE 0x020 /* Enable/Disable Side Tone */ 76 #define APANA_SIDETONE_ATTN 0x0C0 90 #define APANA_SIDETONE_ATTN 0x0C0 /* Side Tone Attenuation */ 77 #define APANA_ENABLE_MIC_BOOST2 0x100 91 #define APANA_ENABLE_MIC_BOOST2 0x100 /* Secondary Microphone Amplifier gain booster control */ 78 92 79 /*Digital Audio Path Control (SSM2602_REG_DIGI 93 /*Digital Audio Path Control (SSM2602_REG_DIGITAL_PATH)*/ 80 #define APDIGI_ENABLE_ADC_HPF 0x00 94 #define APDIGI_ENABLE_ADC_HPF 0x001 /* Enable/Disable ADC Highpass Filter */ 81 #define APDIGI_DE_EMPHASIS 0x00 95 #define APDIGI_DE_EMPHASIS 0x006 /* De-Emphasis Control */ 82 #define APDIGI_ENABLE_DAC_MUTE 0x00 96 #define APDIGI_ENABLE_DAC_MUTE 0x008 /* DAC Mute Control */ 83 #define APDIGI_STORE_OFFSET 0x01 97 #define APDIGI_STORE_OFFSET 0x010 /* Store/Clear DC offset when HPF is disabled */ 84 98 85 /*Power Down Control (SSM2602_REG_POWER) 99 /*Power Down Control (SSM2602_REG_POWER) 86 *(1=Enable PowerDown, 0=Disable PowerDown) 100 *(1=Enable PowerDown, 0=Disable PowerDown) 87 */ 101 */ 88 #define PWR_LINE_IN_PDN 0x001 102 #define PWR_LINE_IN_PDN 0x001 /* Line Input Power Down */ 89 #define PWR_MIC_PDN 0x002 103 #define PWR_MIC_PDN 0x002 /* Microphone Input & Bias Power Down */ 90 #define PWR_ADC_PDN 0x004 104 #define PWR_ADC_PDN 0x004 /* ADC Power Down */ 91 #define PWR_DAC_PDN 0x008 105 #define PWR_DAC_PDN 0x008 /* DAC Power Down */ 92 #define PWR_OUT_PDN 0x010 106 #define PWR_OUT_PDN 0x010 /* Outputs Power Down */ 93 #define PWR_OSC_PDN 0x020 107 #define PWR_OSC_PDN 0x020 /* Oscillator Power Down */ 94 #define PWR_CLK_OUT_PDN 0x040 108 #define PWR_CLK_OUT_PDN 0x040 /* CLKOUT Power Down */ 95 #define PWR_POWER_OFF 0x080 109 #define PWR_POWER_OFF 0x080 /* POWEROFF Mode */ 96 110 97 /*Digital Audio Interface Format (SSM2602_REG_ 111 /*Digital Audio Interface Format (SSM2602_REG_DIGITAL_IFACE)*/ 98 #define IFACE_IFACE_FORMAT 0x003 112 #define IFACE_IFACE_FORMAT 0x003 /* Digital Audio input format control */ 99 #define IFACE_AUDIO_DATA_LEN 0x00C 113 #define IFACE_AUDIO_DATA_LEN 0x00C /* Audio Data word length control */ 100 #define IFACE_DAC_LR_POLARITY 0x010 114 #define IFACE_DAC_LR_POLARITY 0x010 /* Polarity Control for clocks in RJ,LJ and I2S modes */ 101 #define IFACE_DAC_LR_SWAP 0x020 115 #define IFACE_DAC_LR_SWAP 0x020 /* Swap DAC data control */ 102 #define IFACE_ENABLE_MASTER 0x040 116 #define IFACE_ENABLE_MASTER 0x040 /* Enable/Disable Master Mode */ 103 #define IFACE_BCLK_INVERT 0x080 117 #define IFACE_BCLK_INVERT 0x080 /* Bit Clock Inversion control */ 104 118 105 /*Sampling Control (SSM2602_REG_SAMPLING_CTRL) 119 /*Sampling Control (SSM2602_REG_SAMPLING_CTRL)*/ 106 #define SRATE_ENABLE_USB_MODE 0x001 120 #define SRATE_ENABLE_USB_MODE 0x001 /* Enable/Disable USB Mode */ 107 #define SRATE_BOS_RATE 0x002 121 #define SRATE_BOS_RATE 0x002 /* Base Over-Sampling rate */ 108 #define SRATE_SAMPLE_RATE 0x03C 122 #define SRATE_SAMPLE_RATE 0x03C /* Clock setting condition (Sampling rate control) */ 109 #define SRATE_CORECLK_DIV2 0x040 123 #define SRATE_CORECLK_DIV2 0x040 /* Core Clock divider select */ 110 #define SRATE_CLKOUT_DIV2 0x080 124 #define SRATE_CLKOUT_DIV2 0x080 /* Clock Out divider select */ 111 125 112 /*Active Control (SSM2602_REG_ACTIVE_CTRL)*/ 126 /*Active Control (SSM2602_REG_ACTIVE_CTRL)*/ 113 #define ACTIVE_ACTIVATE_CODEC 0x00 127 #define ACTIVE_ACTIVATE_CODEC 0x001 /* Activate Codec Digital Audio Interface */ 114 128 115 /********************************************* 129 /*********************************************************************/ 116 130 117 #define SSM2602_CACHEREGNUM 10 131 #define SSM2602_CACHEREGNUM 10 118 132 119 enum ssm2602_clk { 133 enum ssm2602_clk { 120 SSM2602_SYSCLK, 134 SSM2602_SYSCLK, 121 SSM2602_CLK_CLKOUT, 135 SSM2602_CLK_CLKOUT, 122 SSM2602_CLK_XTO 136 SSM2602_CLK_XTO 123 }; 137 }; 124 138 125 #endif 139 #endif 126 140
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.