"Left", "Right", "LeftRightDiv2", }; static const char *const hpf_cutoff_txt[] = { "Disable", "DC Block", "50Hz", "100Hz", "200Hz", "400Hz", "800Hz", }; static SOC_ENUM_SINGLE_DECL(max98371_monomix, MAX98371_MONOMIX_CFG, 0, monomix_text); static SOC_ENUM_SINGLE_DECL(max98371_hpf_cutoff, MAX98371_HPF, 0, hpf_cutoff_txt); static const DECLARE_TLV_DB_RANGE(max98371_dht_min_gain, 0, 1, TLV_DB_SCALE_ITEM(537, 66, 0), 2, 3, TLV_DB_SCALE_ITEM(677, 82, 0), 4, 5, TLV_DB_SCALE_ITEM(852, 104, 0), 6, 7, TLV_DB_SCALE_ITEM(1072, 131, 0), 8, 9, TLV_DB_SCALE_ITEM(1350, 165, 0), 10, 11, TLV_DB_SCALE_ITEM(1699, 101, 0), ); static const DECLARE_TLV_DB_RANGE(max98371_dht_max_gain, 0, 1, TLV_DB_SCALE_ITEM(537, 66, 0), 2, 3, TLV_DB_SCALE_ITEM(677, 82, 0), 4, 5, TLV_DB_SCALE_ITEM(852, 104, 0), 6, 7, TLV_DB_SCALE_ITEM(1072, 131, 0), 8, 9, TLV_DB_SCALE_ITEM(1350, 165, 0), 10, 11, TLV_DB_SCALE_ITEM(1699, 208, 0), );
return 0; } /* * ALC5632 Controls */ /* -34.5db min scale, 1.5db steps, no mute */ static const DECLARE_TLV_DB_SCALE(vol_tlv, -3450, 150, 0); /* -46.5db min scale, 1.5db steps, no mute */ static const DECLARE_TLV_DB_SCALE(hp_tlv, -4650, 150, 0); /* -16.5db min scale, 1.5db steps, no mute */ static const DECLARE_TLV_DB_SCALE(adc_rec_tlv, -1650, 150, 0); static const unsigned int boost_tlv[] = { TLV_DB_RANGE_HEAD(2), 0, 1, TLV_DB_SCALE_ITEM(0, 2000, 0), 1, 3, TLV_DB_SCALE_ITEM(2000, 1000, 0), }; /* 0db min scale, 6 db steps, no mute */ static const DECLARE_TLV_DB_SCALE(dig_tlv, 0, 600, 0); /* 0db min scalem 0.75db steps, no mute */ static const DECLARE_TLV_DB_SCALE(vdac_tlv, -3525, 75, 0); static const struct snd_kcontrol_new alc5632_vol_snd_controls[] = { /* left starts at bit 8, right at bit 0 */ /* 31 steps (5 bit), -46.5db scale */ SOC_DOUBLE_TLV("Speaker Playback Volume", ALC5632_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv), /* bit 15 mutes left, bit 7 right */ SOC_DOUBLE("Speaker Playback Switch", ALC5632_SPK_OUT_VOL, 15, 7, 1, 1),
static const char *ssm2602_input_select[] = { "Line", "Mic", }; static const char *ssm2602_deemph[] = {"None", "32Khz", "44.1Khz", "48Khz"}; static const struct soc_enum ssm2602_enum[] = { SOC_ENUM_SINGLE(SSM2602_APANA, 2, ARRAY_SIZE(ssm2602_input_select), ssm2602_input_select), SOC_ENUM_SINGLE(SSM2602_APDIGI, 1, ARRAY_SIZE(ssm2602_deemph), ssm2602_deemph), }; static const unsigned int ssm260x_outmix_tlv[] = { TLV_DB_RANGE_HEAD(2), 0, 47, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 0), 48, 127, TLV_DB_SCALE_ITEM(-7400, 100, 0), }; static const DECLARE_TLV_DB_SCALE(ssm260x_inpga_tlv, -3450, 150, 0); static const DECLARE_TLV_DB_SCALE(ssm260x_sidetone_tlv, -1500, 300, 0); static const struct snd_kcontrol_new ssm260x_snd_controls[] = { SOC_DOUBLE_R_TLV("Capture Volume", SSM2602_LINVOL, SSM2602_RINVOL, 0, 45, 0, ssm260x_inpga_tlv), SOC_DOUBLE_R("Capture Switch", SSM2602_LINVOL, SSM2602_RINVOL, 7, 1, 1), SOC_SINGLE("ADC High Pass Filter Switch", SSM2602_APDIGI, 0, 1, 1), SOC_SINGLE("Store DC Offset Switch", SSM2602_APDIGI, 4, 1, 0), SOC_ENUM("Playback De-emphasis", ssm2602_enum[1]),
"None", "Left", "Right", "LeftRight", "LeftRightDiv2", }; static const char *const max9867_filter_text[] = {"IIR", "FIR"}; static SOC_ENUM_SINGLE_DECL(max9867_filter, MAX9867_CODECFLTR, 7, max9867_filter_text); static SOC_ENUM_SINGLE_DECL(max9867_spkmode, MAX9867_MODECONFIG, 0, max9867_spmode); static SOC_ENUM_SINGLE_DECL(max9867_sidetone, MAX9867_DACGAIN, 6, max9867_sidetone_text); static DECLARE_TLV_DB_SCALE(max9860_capture_tlv, -600, 200, 0); static DECLARE_TLV_DB_SCALE(max9860_mic_tlv, 2000, 100, 1); static DECLARE_TLV_DB_SCALE(max9860_adc_left_tlv, -1200, 100, 1); static DECLARE_TLV_DB_SCALE(max9860_adc_right_tlv, -1200, 100, 1); static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(max98088_micboost_tlv, 0, 1, TLV_DB_SCALE_ITEM(0, 2000, 0), 2, 2, TLV_DB_SCALE_ITEM(3000, 0, 0), ); static const struct snd_kcontrol_new max9867_snd_controls[] = { SOC_DOUBLE_R("Master Playback Volume", MAX9867_LEFTVOL, MAX9867_RIGHTVOL, 0, 63, 1), SOC_DOUBLE_R_TLV("Capture Volume", MAX9867_LEFTMICGAIN, MAX9867_RIGHTMICGAIN, 0, 15, 1, max9860_capture_tlv), SOC_DOUBLE_R_TLV("Mic Volume", MAX9867_LEFTMICGAIN, MAX9867_RIGHTMICGAIN, 0, 31, 1, max9860_mic_tlv), SOC_DOUBLE_R_TLV("Mic Boost Volume", MAX9867_LEFTMICGAIN, MAX9867_RIGHTMICGAIN, 5, 3, 0, max98088_micboost_tlv), SOC_ENUM("Digital Sidetone Src", max9867_sidetone), SOC_SINGLE("Sidetone Volume", MAX9867_DACGAIN, 0, 31, 1),
"Loudness 8", "Loudness 9", "Loudness 10", "Loudness 11", "Loudness 12", "Loudness 13", "Loudness 14", "Loudness 15", "Loudness 16" }; static const char *sta32x_limiter_select[] = { "Limiter Disabled", "Limiter #1", "Limiter #2" }; static const char *sta32x_limiter_attack_rate[] = { "3.1584", "2.7072", "2.2560", "1.8048", "1.3536", "0.9024", "0.4512", "0.2256", "0.1504", "0.1123", "0.0902", "0.0752", "0.0645", "0.0564", "0.0501", "0.0451" }; static const char *sta32x_limiter_release_rate[] = { "0.5116", "0.1370", "0.0744", "0.0499", "0.0360", "0.0299", "0.0264", "0.0208", "0.0198", "0.0172", "0.0147", "0.0137", "0.0134", "0.0117", "0.0110", "0.0104" }; static const unsigned int sta32x_limiter_ac_attack_tlv[] = { TLV_DB_RANGE_HEAD(2), 0, 7, TLV_DB_SCALE_ITEM(-1200, 200, 0), 8, 16, TLV_DB_SCALE_ITEM(300, 100, 0), }; static const unsigned int sta32x_limiter_ac_release_tlv[] = { TLV_DB_RANGE_HEAD(5), 0, 0, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 0), 1, 1, TLV_DB_SCALE_ITEM(-2900, 0, 0), 2, 2, TLV_DB_SCALE_ITEM(-2000, 0, 0), 3, 8, TLV_DB_SCALE_ITEM(-1400, 200, 0), 8, 16, TLV_DB_SCALE_ITEM(-700, 100, 0), }; static const unsigned int sta32x_limiter_drc_attack_tlv[] = { TLV_DB_RANGE_HEAD(3), 0, 7, TLV_DB_SCALE_ITEM(-3100, 200, 0),
i = 0; while (reg_table[i].count != 0) { for (j = 0; j < reg_table[i].count; j++) { int addr = j + reg_table[i].start; regmap_read(max98925->regmap, addr, &val_l); msg_maxim("%s: reg 0x%02X, val_l 0x%02X\n", __func__, addr, val_l); } i++; } } #endif static const unsigned int max98925_spk_tlv[] = { TLV_DB_RANGE_HEAD(1), 1, 31, TLV_DB_SCALE_ITEM(-600, 100, 0), }; static int max98925_spk_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct max98925_priv *max98925 = snd_soc_codec_get_drvdata(codec); ucontrol->value.integer.value[0] = max98925->volume; return 0; } static int max98925_spk_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
#define JZ4740_CODEC_2_SAMPLE_RATE_OFFSET 8 #define JZ4740_CODEC_2_MIC_BOOST_GAIN_OFFSET 4 #define JZ4740_CODEC_2_HEADPHONE_VOLUME_OFFSET 0 static const struct reg_default jz4740_codec_reg_defaults[] = { { JZ4740_REG_CODEC_1, 0x021b2302 }, { JZ4740_REG_CODEC_2, 0x00170803 }, }; struct jz4740_codec { struct regmap *regmap; }; static const unsigned int jz4740_mic_tlv[] = { TLV_DB_RANGE_HEAD(2), 0, 2, TLV_DB_SCALE_ITEM(0, 600, 0), 3, 3, TLV_DB_SCALE_ITEM(2000, 0, 0), }; static const DECLARE_TLV_DB_SCALE(jz4740_out_tlv, 0, 200, 0); static const DECLARE_TLV_DB_SCALE(jz4740_in_tlv, -3450, 150, 0); static const struct snd_kcontrol_new jz4740_codec_controls[] = { SOC_SINGLE_TLV("Master Playback Volume", JZ4740_REG_CODEC_2, JZ4740_CODEC_2_HEADPHONE_VOLUME_OFFSET, 3, 0, jz4740_out_tlv), SOC_SINGLE_TLV("Master Capture Volume", JZ4740_REG_CODEC_2, JZ4740_CODEC_2_INPUT_VOLUME_OFFSET, 31, 0, jz4740_in_tlv), SOC_SINGLE("Master Playback Switch", JZ4740_REG_CODEC_1, JZ4740_CODEC_1_HEADPHONE_DISABLE_OFFSET, 1, 1),
case M97236_REG_1A_AC_TEST_CONTROL: case M97236_REG_1D_ENABLE_1: case M97236_REG_1E_ENABLE_2: case M97236_REG_1F_TEST_ENABLE_1: case M97236_REG_20_TEST_ENABLE_2: case M97236_REG_21_TEST_DATA_1: case M97236_REG_23_TEST_DATA_3: return true; default: return false; } } static const unsigned int max97236_vol_tlv[] = { TLV_DB_RANGE_HEAD(2), 0, 3, TLV_DB_SCALE_ITEM(-6000, 200, 0), 4, 63, TLV_DB_SCALE_ITEM(-5300, 100, 0), }; static const DECLARE_TLV_DB_SCALE(max97236_gain_tlv, 1200, 1200, 0); static const char * const max97236_gnd_text[] = { "NONE", "RING2", "SLEEVE", "RING2 and SLEEVE" }; static const struct soc_enum max97236_gnd_enum = SOC_ENUM_SINGLE(M97236_REG_02_STATUS3, M97236_GND_SHIFT, ARRAY_SIZE(max97236_gnd_text), max97236_gnd_text); static const char * const max97236_micr_text[] = { "2.2k", "2.6k", "3.0k", "Bypassed", "High Z" };
SND_SOC_DAPM_AIF_OUT("Current Sense", "HiFi Capture", 0, MAX98373_R2047_IV_SENSE_ADC_EN, 1, 0), SND_SOC_DAPM_AIF_OUT("Speaker FB Sense", "HiFi Capture", 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_SWITCH("VI Sense", SND_SOC_NOPM, 0, 0, &max98373_vi_control), SND_SOC_DAPM_SWITCH("SpkFB Sense", SND_SOC_NOPM, 0, 0, &max98373_spkfb_control), SND_SOC_DAPM_SIGGEN("VMON"), SND_SOC_DAPM_SIGGEN("IMON"), SND_SOC_DAPM_SIGGEN("FBMON"), }; static DECLARE_TLV_DB_SCALE(max98373_digital_tlv, 0, -50, 0); static const DECLARE_TLV_DB_RANGE(max98373_spk_tlv, 0, 8, TLV_DB_SCALE_ITEM(0, 50, 0), 9, 10, TLV_DB_SCALE_ITEM(500, 100, 0), ); static const DECLARE_TLV_DB_RANGE(max98373_spkgain_max_tlv, 0, 9, TLV_DB_SCALE_ITEM(800, 100, 0), ); static const DECLARE_TLV_DB_RANGE(max98373_dht_step_size_tlv, 0, 1, TLV_DB_SCALE_ITEM(25, 25, 0), 2, 4, TLV_DB_SCALE_ITEM(100, 100, 0), ); static const DECLARE_TLV_DB_RANGE(max98373_dht_spkgain_min_tlv, 0, 9, TLV_DB_SCALE_ITEM(800, 100, 0), ); static const DECLARE_TLV_DB_RANGE(max98373_dht_rotation_point_tlv, 0, 1, TLV_DB_SCALE_ITEM(-50, -50, 0), 2, 7, TLV_DB_SCALE_ITEM(-200, -100, 0),
{13500000, 2822400, 0x1E, 0x33, 0x1B, 0}, /* MCLK=13.5Mhz */ {14400000, 2822400, 0x06, 0x50, 0x1A, 0}, /* MCLK=14.4Mhz */ {19200000, 2822400, 0x14, 0xBC, 0x13, 0}, /* MCLK=19.2Mhz */ {19680000, 2822400, 0x05, 0x66, 0x13, 0}, /* MCLK=19.68Mhz */ {19800000, 2822400, 0x01, 0xAE, 0x13, 0}, /* MCLK=19.8Mhz */ }; enum clk_src { DA9055_CLKSRC_MCLK }; /* Gain and Volume */ static const unsigned int aux_vol_tlv[] = { TLV_DB_RANGE_HEAD(2), 0x0, 0x10, TLV_DB_SCALE_ITEM(-5400, 0, 0), /* -54dB to 15dB */ 0x11, 0x3f, TLV_DB_SCALE_ITEM(-5400, 150, 0) }; static const unsigned int digital_gain_tlv[] = { TLV_DB_RANGE_HEAD(2), 0x0, 0x07, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1), /* -78dB to 12dB */ 0x08, 0x7f, TLV_DB_SCALE_ITEM(-7800, 75, 0) }; static const unsigned int alc_analog_gain_tlv[] = { TLV_DB_RANGE_HEAD(2), 0x0, 0x0, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1), /* 0dB to 36dB */
unsigned int mix_mode; struct mutex mix_mutex; }; /* default register values */ static u8 max9877_regs[MAX9877_CACHEREGNUM] = { 0x40, /* MAX9877_INPUT_MODE (0x00) */ 0x00, /* MAX9877_SPK_VOLUME (0x01) */ 0x00, /* MAX9877_HPL_VOLUME (0x02) */ 0x00, /* MAX9877_HPR_VOLUME (0x03) */ 0x09, /* MAX9877_OUTPUT_MODE (0x04) */ }; static const unsigned int max9877_pgain_tlv[] = { TLV_DB_RANGE_HEAD(2), 0, 1, TLV_DB_SCALE_ITEM(0, 900, 0), 2, 2, TLV_DB_SCALE_ITEM(2000, 0, 0), }; static const unsigned int max9877_output_tlv[] = { TLV_DB_RANGE_HEAD(4), 0, 7, TLV_DB_SCALE_ITEM(-7900, 400, 1), 8, 15, TLV_DB_SCALE_ITEM(-4700, 300, 0), 16, 23, TLV_DB_SCALE_ITEM(-2300, 200, 0), 24, 31, TLV_DB_SCALE_ITEM(-700, 100, 0), }; static const char *max9877_osc_mode[] = { "1176KHz", "1100KHz", "700KHz",
SOC_ENUM_SINGLE(WM8350_DAC_MUTE_VOLUME, 12, 2, wm8350_dacfilter), SOC_ENUM_SINGLE(WM8350_ADC_CONTROL, 15, 2, wm8350_adcfilter), SOC_ENUM_SINGLE(WM8350_ADC_CONTROL, 8, 4, wm8350_adchp), SOC_ENUM_SINGLE(WM8350_ADC_CONTROL, 0, 4, wm8350_pol), SOC_ENUM_SINGLE(WM8350_INPUT_MIXER_VOLUME, 15, 2, wm8350_lr), }; DECLARE_TLV_DB_LINEAR(pre_amp_tlv, -1200, 3525); DECLARE_TLV_DB_LINEAR(out_pga_tlv, -5700, 600); DECLARE_TLV_DB_SCALE(dac_pcm_tlv, -7163, 36, 1); DECLARE_TLV_DB_SCALE(adc_pcm_tlv, -12700, 50, 1); DECLARE_TLV_DB_SCALE(out_mix_tlv, -1200, 300, 1); static const unsigned int capture_sd_tlv[] = { TLV_DB_RANGE_HEAD(2), 0,12, TLV_DB_SCALE_ITEM(-3600, 300, 1), 13,15, TLV_DB_SCALE_ITEM(0, 0, 0), }; static const struct snd_kcontrol_new wm8350_snd_controls[] = { SOC_ENUM("Playback Deemphasis", wm8350_enum[0]), SOC_ENUM("Playback DAC Inversion", wm8350_enum[1]), SOC_WM8350_DOUBLE_R_TLV("Playback PCM Volume", WM8350_DAC_DIGITAL_VOLUME_L, WM8350_DAC_DIGITAL_VOLUME_R, 0, 255, 0, dac_pcm_tlv), SOC_ENUM("Playback PCM Mute Function", wm8350_enum[2]), SOC_ENUM("Playback PCM Mute Speed", wm8350_enum[3]), SOC_ENUM("Playback PCM Filter", wm8350_enum[4]), SOC_ENUM("Capture PCM Filter", wm8350_enum[5]), SOC_ENUM("Capture PCM HP Filter", wm8350_enum[6]), SOC_ENUM("Capture ADC Inversion", wm8350_enum[7]), SOC_WM8350_DOUBLE_R_TLV("Capture PCM Volume", WM8350_ADC_DIGITAL_VOLUME_L,
u32 reg_ctrl0, reg_ctrl1; }; static const char * const input_mode_mux[] = {"Single-ended", "Differential"}; static const struct soc_enum input_mode_mux_enum = SOC_ENUM_SINGLE(AUDIO_IC_CODEC_CTRL1, 4, 2, input_mode_mux); static const struct snd_kcontrol_new sirf_audio_codec_input_mode_control = SOC_DAPM_ENUM("Route", input_mode_mux_enum); static const DECLARE_TLV_DB_SCALE(playback_vol_tlv, -12400, 100, 0); static const DECLARE_TLV_DB_SCALE(capture_vol_tlv_prima2, 500, 100, 0); static const DECLARE_TLV_DB_RANGE(capture_vol_tlv_atlas6, 0, 7, TLV_DB_SCALE_ITEM(-100, 100, 0), 0x22, 0x3F, TLV_DB_SCALE_ITEM(700, 100, 0), ); static struct snd_kcontrol_new volume_controls_atlas6[] = { SOC_DOUBLE_TLV("Playback Volume", AUDIO_IC_CODEC_CTRL0, 21, 14, 0x7F, 0, playback_vol_tlv), SOC_DOUBLE_TLV("Capture Volume", AUDIO_IC_CODEC_CTRL1, 16, 10, 0x3F, 0, capture_vol_tlv_atlas6), }; static struct snd_kcontrol_new volume_controls_prima2[] = { SOC_DOUBLE_TLV("Speaker Volume", AUDIO_IC_CODEC_CTRL0, 21, 14, 0x7F, 0, playback_vol_tlv), SOC_DOUBLE_TLV("Capture Volume", AUDIO_IC_CODEC_CTRL1, 15, 10, 0x1F, 0, capture_vol_tlv_prima2),
{MAX98090_0x3D_JACK_DETECT, 0x00}, {MAX98090_0x3E_IN_ENABLE, 0x00}, {MAX98090_0x3F_OUT_ENABLE, 0x00}, {MAX98090_0x40_LVL_CTR, 0x00}, {MAX98090_0x41_DSP_FILTER_ENABLE, 0x00}, /* BIAS AND POWER MODE CONFIGURATION REGISTERS */ {MAX98090_0x42_BIAS_CTR, 0x00}, {MAX98090_0x43_DAC_CTR, 0x00}, {MAX98090_0x44_ADC_CTR, 0x06}, {MAX98090_0x45_DEV_SHUTDOWN, 0x00}, }; static const unsigned int max98090_hp_tlv[] = { TLV_DB_RANGE_HEAD(5), 0x0, 0x6, TLV_DB_SCALE_ITEM(-6700, 400, 0), 0x7, 0xE, TLV_DB_SCALE_ITEM(-4000, 300, 0), 0xF, 0x15, TLV_DB_SCALE_ITEM(-1700, 200, 0), 0x16, 0x1B, TLV_DB_SCALE_ITEM(-400, 100, 0), 0x1C, 0x1F, TLV_DB_SCALE_ITEM(150, 50, 0), }; static struct snd_kcontrol_new max98090_snd_controls[] = { SOC_DOUBLE_R_TLV("Headphone Volume", MAX98090_0x2C_L_HP_VOL, MAX98090_0x2D_R_HP_VOL, 0, 31, 0, max98090_hp_tlv), }; /* Left HeadPhone Mixer Switch */ static struct snd_kcontrol_new max98090_left_hp_mixer_controls[] = { SOC_DAPM_SINGLE("DACR Switch", MAX98090_0x29_L_HP_MIX, 1, 1, 0), SOC_DAPM_SINGLE("DACL Switch", MAX98090_0x29_L_HP_MIX, 0, 1, 0),
dev_err(codec->dev, "System clock not configured\n"); return -EINVAL; } dev_dbg(codec->dev, "CLK_SYS is %dHz\n", wm8993->sysclk_rate); return 0; } static const DECLARE_TLV_DB_SCALE(sidetone_tlv, -3600, 300, 0); static const DECLARE_TLV_DB_SCALE(drc_comp_threash, -4500, 75, 0); static const DECLARE_TLV_DB_SCALE(drc_comp_amp, -2250, 75, 0); static const DECLARE_TLV_DB_SCALE(drc_min_tlv, -1800, 600, 0); static const unsigned int drc_max_tlv[] = { TLV_DB_RANGE_HEAD(2), 0, 2, TLV_DB_SCALE_ITEM(1200, 600, 0), 3, 3, TLV_DB_SCALE_ITEM(3600, 0, 0), }; static const DECLARE_TLV_DB_SCALE(drc_qr_tlv, 1200, 600, 0); static const DECLARE_TLV_DB_SCALE(drc_startup_tlv, -1800, 300, 0); static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1); static const DECLARE_TLV_DB_SCALE(dac_boost_tlv, 0, 600, 0); static const char *dac_deemph_text[] = { "None", "32kHz", "44.1kHz", "48kHz", };
static const struct regmap_config tas5722_regmap_config = { .reg_bits = 8, .val_bits = 8, .max_register = TAS5722_MAX_REG, .cache_type = REGCACHE_RBTREE, .volatile_reg = tas5720_is_volatile_reg, }; /* * DAC analog gain. There are four discrete values to select from, ranging * from 19.2 dB to 26.3dB. */ static const DECLARE_TLV_DB_RANGE(dac_analog_tlv, 0x0, 0x0, TLV_DB_SCALE_ITEM(1920, 0, 0), 0x1, 0x1, TLV_DB_SCALE_ITEM(2070, 0, 0), 0x2, 0x2, TLV_DB_SCALE_ITEM(2350, 0, 0), 0x3, 0x3, TLV_DB_SCALE_ITEM(2630, 0, 0), ); /* * DAC digital volumes. From -103.5 to 24 dB in 0.5 dB steps. Note that * setting the gain below -100 dB (register value <0x7) is effectively a MUTE * as per device datasheet. */ static DECLARE_TLV_DB_SCALE(dac_tlv, -10350, 50, 0); static const struct snd_kcontrol_new tas5720_snd_controls[] = { SOC_SINGLE_TLV("Speaker Driver Playback Volume", TAS5720_VOLUME_CTRL_REG, 0, 0xff, 0, dac_tlv),
} static int max9768_set_gpio(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct max9768 *max9768 = snd_soc_codec_get_drvdata(codec); gpio_set_value_cansleep(max9768->mute_gpio, !ucontrol->value.integer.value[0]); return 0; } static const unsigned int volume_tlv[] = { TLV_DB_RANGE_HEAD(43), 0, 0, TLV_DB_SCALE_ITEM(-16150, 0, 0), 1, 1, TLV_DB_SCALE_ITEM(-9280, 0, 0), 2, 2, TLV_DB_SCALE_ITEM(-9030, 0, 0), 3, 3, TLV_DB_SCALE_ITEM(-8680, 0, 0), 4, 4, TLV_DB_SCALE_ITEM(-8430, 0, 0), 5, 5, TLV_DB_SCALE_ITEM(-8080, 0, 0), 6, 6, TLV_DB_SCALE_ITEM(-7830, 0, 0), 7, 7, TLV_DB_SCALE_ITEM(-7470, 0, 0), 8, 8, TLV_DB_SCALE_ITEM(-7220, 0, 0), 9, 9, TLV_DB_SCALE_ITEM(-6870, 0, 0), 10, 10, TLV_DB_SCALE_ITEM(-6620, 0, 0), 11, 11, TLV_DB_SCALE_ITEM(-6270, 0, 0), 12, 12, TLV_DB_SCALE_ITEM(-6020, 0, 0), 13, 13, TLV_DB_SCALE_ITEM(-5670, 0, 0), 14, 14, TLV_DB_SCALE_ITEM(-5420, 0, 0), 15, 17, TLV_DB_SCALE_ITEM(-5060, 250, 0),
static DECLARE_TLV_DB_SCALE(hpd_tlv, -9600, 50, 1); static DECLARE_TLV_DB_SCALE(ipd_tlv, -9600, 100, 0); static DECLARE_TLV_DB_SCALE(mic_tlv, 1600, 100, 0); static DECLARE_TLV_DB_SCALE(pga_tlv, -600, 50, 0); static DECLARE_TLV_DB_SCALE(mix_tlv, -50, 50, 0); static DECLARE_TLV_DB_SCALE(beep_tlv, -56, 200, 0); static const unsigned int limiter_tlv[] = { TLV_DB_RANGE_HEAD(2), 0, 2, TLV_DB_SCALE_ITEM(-3000, 600, 0), 3, 7, TLV_DB_SCALE_ITEM(-1200, 300, 0), }; static const char * const cs42l52_adca_text[] = { "Input1A", "Input2A", "Input3A", "Input4A", "PGA Input Left"}; static const char * const cs42l52_adcb_text[] = { "Input1B", "Input2B", "Input3B", "Input4B", "PGA Input Right"}; static SOC_ENUM_SINGLE_DECL(adca_enum, CS42L52_ADC_PGA_A, 5, cs42l52_adca_text); static SOC_ENUM_SINGLE_DECL(adcb_enum, CS42L52_ADC_PGA_B, 5, cs42l52_adcb_text);
struct pm860x_chip *chip; struct pm860x_det det; int irq[4]; unsigned char name[4][MAX_NAME_LEN+1]; }; /* -9450dB to 0dB in 150dB steps ( mute instead of -9450dB) */ static const DECLARE_TLV_DB_SCALE(dpga_tlv, -9450, 150, 1); /* -9dB to 0db in 3dB steps */ static const DECLARE_TLV_DB_SCALE(adc_tlv, -900, 300, 0); /* {-23, -17, -13.5, -11, -9, -6, -3, 0}dB */ static const DECLARE_TLV_DB_RANGE(mic_tlv, 0, 0, TLV_DB_SCALE_ITEM(-2300, 0, 0), 1, 1, TLV_DB_SCALE_ITEM(-1700, 0, 0), 2, 2, TLV_DB_SCALE_ITEM(-1350, 0, 0), 3, 3, TLV_DB_SCALE_ITEM(-1100, 0, 0), 4, 7, TLV_DB_SCALE_ITEM(-900, 300, 0) ); /* {0, 0, 0, -6, 0, 6, 12, 18}dB */ static const DECLARE_TLV_DB_RANGE(aux_tlv, 0, 2, TLV_DB_SCALE_ITEM(0, 0, 0), 3, 7, TLV_DB_SCALE_ITEM(-600, 600, 0) ); /* {-16, -13, -10, -7, -5.2, -3,3, -2.2, 0}dB, mute instead of -16dB */ static const DECLARE_TLV_DB_RANGE(out_tlv, 0, 3, TLV_DB_SCALE_ITEM(-1600, 300, 1),
{ 0x0d, 0x89 }, { 0x0e, 0x8c }, { 0x0f, 0x77 }, { 0x10, 0x26 }, { 0x11, 0x1c }, { 0x12, 0x97 }, }; static const DECLARE_TLV_DB_MINMAX_MUTE(ssm2518_vol_tlv, -7125, 2400); static const DECLARE_TLV_DB_SCALE(ssm2518_compressor_tlv, -3400, 200, 0); static const DECLARE_TLV_DB_SCALE(ssm2518_expander_tlv, -8100, 300, 0); static const DECLARE_TLV_DB_SCALE(ssm2518_noise_gate_tlv, -9600, 300, 0); static const DECLARE_TLV_DB_SCALE(ssm2518_post_drc_tlv, -2400, 300, 0); static const DECLARE_TLV_DB_RANGE(ssm2518_limiter_tlv, 0, 7, TLV_DB_SCALE_ITEM(-2200, 200, 0), 7, 15, TLV_DB_SCALE_ITEM(-800, 100, 0), ); static const char * const ssm2518_drc_peak_detector_attack_time_text[] = { "0 ms", "0.1 ms", "0.19 ms", "0.37 ms", "0.75 ms", "1.5 ms", "3 ms", "6 ms", "12 ms", "24 ms", "48 ms", "96 ms", "192 ms", "384 ms", "768 ms", "1536 ms", }; static const char * const ssm2518_drc_peak_detector_release_time_text[] = { "0 ms", "1.5 ms", "3 ms", "6 ms", "12 ms", "24 ms", "48 ms", "96 ms", "192 ms", "384 ms", "768 ms", "1536 ms", "3072 ms", "6144 ms", "12288 ms", "24576 ms" };
case RT5616_DUMMY3: return true; default: return false; } } static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0); static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0); static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0); static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(bst_tlv, 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0), 2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0), 3, 5, TLV_DB_SCALE_ITEM(3000, 500, 0), 6, 6, TLV_DB_SCALE_ITEM(4400, 0, 0), 7, 7, TLV_DB_SCALE_ITEM(5000, 0, 0), 8, 8, TLV_DB_SCALE_ITEM(5200, 0, 0), ); static const struct snd_kcontrol_new rt5616_snd_controls[] = { /* Headphone Output Volume */ SOC_DOUBLE("HP Playback Switch", RT5616_HP_VOL, RT5616_L_MUTE_SFT, RT5616_R_MUTE_SFT, 1, 1), SOC_DOUBLE("HPVOL Playback Switch", RT5616_HP_VOL, RT5616_VOL_L_SFT, RT5616_VOL_R_SFT, 1, 1), SOC_DOUBLE_TLV("HP Playback Volume", RT5616_HP_VOL,
default: return 0; } } static int wm9081_reset(struct snd_soc_codec *codec) { return snd_soc_write(codec, WM9081_SOFTWARE_RESET, 0); } static const DECLARE_TLV_DB_SCALE(drc_in_tlv, -4500, 75, 0); static const DECLARE_TLV_DB_SCALE(drc_out_tlv, -2250, 75, 0); static const DECLARE_TLV_DB_SCALE(drc_min_tlv, -1800, 600, 0); static unsigned int drc_max_tlv[] = { TLV_DB_RANGE_HEAD(4), 0, 0, TLV_DB_SCALE_ITEM(1200, 0, 0), 1, 1, TLV_DB_SCALE_ITEM(1800, 0, 0), 2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0), 3, 3, TLV_DB_SCALE_ITEM(3600, 0, 0), }; static const DECLARE_TLV_DB_SCALE(drc_qr_tlv, 1200, 600, 0); static const DECLARE_TLV_DB_SCALE(drc_startup_tlv, -300, 50, 0); static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); static const DECLARE_TLV_DB_SCALE(in_tlv, -600, 600, 0); static const DECLARE_TLV_DB_SCALE(dac_tlv, -7200, 75, 1); static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0); static const char *drc_high_text[] = { "1",
switch (reg) { case WM8737_RESET: return true; default: return false; } } static int wm8737_reset(struct snd_soc_codec *codec) { return snd_soc_write(codec, WM8737_RESET, 0); } static const unsigned int micboost_tlv[] = { TLV_DB_RANGE_HEAD(4), 0, 0, TLV_DB_SCALE_ITEM(1300, 0, 0), 1, 1, TLV_DB_SCALE_ITEM(1800, 0, 0), 2, 2, TLV_DB_SCALE_ITEM(2800, 0, 0), 3, 3, TLV_DB_SCALE_ITEM(3300, 0, 0), }; static const DECLARE_TLV_DB_SCALE(pga_tlv, -9750, 50, 1); static const DECLARE_TLV_DB_SCALE(adc_tlv, -600, 600, 0); static const DECLARE_TLV_DB_SCALE(ng_tlv, -7800, 600, 0); static const DECLARE_TLV_DB_SCALE(alc_max_tlv, -1200, 600, 0); static const DECLARE_TLV_DB_SCALE(alc_target_tlv, -1800, 100, 0); static const char *micbias_enum_text[] = { "25%", "50%", "75%", "100%",
* s2801x_rmix_tlv * * Range: * 0dB, -2.87dB, -6.02dB, -9.28dB, -12.04dB, -14.54dB, -18.06dB, -20.56dB * * This range is used for following controls * RMIX1_LVL, reg(0x0d), shift(0), width(3), invert(1), max(7) * RMIX2_LVL, reg(0x0d), shift(4), width(3), invert(1), max(7) * MIX1_LVL, reg(0x10), shift(0), width(3), invert(1), max(7) * MIX2_LVL, reg(0x10), shift(4), width(3), invert(1), max(7) * MIX3_LVL, reg(0x11), shift(0), width(3), invert(1), max(7) * MIX4_LVL, reg(0x11), shift(4), width(3), invert(1), max(7) */ static const unsigned int s2801x_mix_tlv[] = { TLV_DB_RANGE_HEAD(4), 0x0, 0x1, TLV_DB_SCALE_ITEM(0, 287, 0), 0x2, 0x3, TLV_DB_SCALE_ITEM(602, 326, 0), 0x4, 0x5, TLV_DB_SCALE_ITEM(1204, 250, 0), 0x6, 0x7, TLV_DB_SCALE_ITEM(1806, 250, 0), }; /** * s2801x_alc_ng_hys_tlv * * Range: 3dB to 12dB, step 3dB * * ALC_NG_HYS, reg(0x68), shift(6), width(2), invert(0), max(31) */ static const DECLARE_TLV_DB_SCALE(s2801x_alc_ng_hys_tlv, 300, 300, 0); /**
#include "wm8993.h" #include "wm_hubs.h" const DECLARE_TLV_DB_SCALE(wm_hubs_spkmix_tlv, -300, 300, 0); EXPORT_SYMBOL_GPL(wm_hubs_spkmix_tlv); static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1650, 150, 0); static const DECLARE_TLV_DB_SCALE(inmix_sw_tlv, 0, 3000, 0); static const DECLARE_TLV_DB_SCALE(inmix_tlv, -1500, 300, 1); static const DECLARE_TLV_DB_SCALE(earpiece_tlv, -600, 600, 0); static const DECLARE_TLV_DB_SCALE(outmix_tlv, -2100, 300, 0); static const DECLARE_TLV_DB_SCALE(spkmixout_tlv, -1800, 600, 1); static const DECLARE_TLV_DB_SCALE(outpga_tlv, -5700, 100, 0); static const unsigned int spkboost_tlv[] = { TLV_DB_RANGE_HEAD(7), 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), }; static const DECLARE_TLV_DB_SCALE(line_tlv, -600, 600, 0); static const char *speaker_ref_text[] = { "SPKVDD/2", "VMID", }; static const struct soc_enum speaker_ref = SOC_ENUM_SINGLE(WM8993_SPEAKER_MIXER, 8, 2, speaker_ref_text); static const char *speaker_mode_text[] = { "Class D", "Class AB",
do { count++; msleep(1); reg = snd_soc_read(codec, WM9090_DC_SERVO_READBACK_0); dev_dbg(codec->dev, "DC servo status: %x\n", reg); } while ((reg & WM9090_DCS_CAL_COMPLETE_MASK) != WM9090_DCS_CAL_COMPLETE_MASK && count < 1000); if ((reg & WM9090_DCS_CAL_COMPLETE_MASK) != WM9090_DCS_CAL_COMPLETE_MASK) dev_err(codec->dev, "Timed out waiting for DC Servo\n"); } static const unsigned int in_tlv[] = { TLV_DB_RANGE_HEAD(3), 0, 0, TLV_DB_SCALE_ITEM(-600, 0, 0), 1, 3, TLV_DB_SCALE_ITEM(-350, 350, 0), 4, 6, TLV_DB_SCALE_ITEM(600, 600, 0), }; static const unsigned int mix_tlv[] = { TLV_DB_RANGE_HEAD(2), 0, 2, TLV_DB_SCALE_ITEM(-1200, 300, 0), 3, 3, TLV_DB_SCALE_ITEM(0, 0, 0), }; static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0); static const unsigned int spkboost_tlv[] = { TLV_DB_RANGE_HEAD(2), 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), };
reg = snd_soc_read(w->codec, WM8400_SPEAKER_MIXER); if (reg & WM8400_RDSPK) { printk(KERN_WARNING "Cannot set as Speaker Mixer RDSPK Set\n"); ret = -1; } break; } return ret; } /* INMIX dB values */ static const unsigned int in_mix_tlv[] = { TLV_DB_RANGE_HEAD(1), 0,7, TLV_DB_SCALE_ITEM(-1200, 600, 0), }; /* Left In PGA Connections */ static const struct snd_kcontrol_new wm8400_dapm_lin12_pga_controls[] = { SOC_DAPM_SINGLE("LIN1 Switch", WM8400_INPUT_MIXER2, WM8400_LMN1_SHIFT, 1, 0), SOC_DAPM_SINGLE("LIN2 Switch", WM8400_INPUT_MIXER2, WM8400_LMP2_SHIFT, 1, 0), }; static const struct snd_kcontrol_new wm8400_dapm_lin34_pga_controls[] = { SOC_DAPM_SINGLE("LIN3 Switch", WM8400_INPUT_MIXER2, WM8400_LMN3_SHIFT, 1, 0), SOC_DAPM_SINGLE("LIN4 Switch", WM8400_INPUT_MIXER2, WM8400_LMP4_SHIFT, 1, 0), }; /* Right In PGA Connections */ static const struct snd_kcontrol_new wm8400_dapm_rin12_pga_controls[] = {
SOC_ENUM_SINGLE(WM8961_ADC_DAC_CONTROL_2, 7, 4, adc_hpf_text); static const char *dac_deemph_text[] = { "None", "32kHz", "44.1kHz", "48kHz", }; static const struct soc_enum dac_deemph = SOC_ENUM_SINGLE(WM8961_ADC_DAC_CONTROL_1, 1, 4, dac_deemph_text); static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1); static const DECLARE_TLV_DB_SCALE(hp_sec_tlv, -700, 100, 0); static const DECLARE_TLV_DB_SCALE(adc_tlv, -7200, 75, 1); static const DECLARE_TLV_DB_SCALE(sidetone_tlv, -3600, 300, 0); static unsigned int boost_tlv[] = { TLV_DB_RANGE_HEAD(4), 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), 1, 1, TLV_DB_SCALE_ITEM(13, 0, 0), 2, 2, TLV_DB_SCALE_ITEM(20, 0, 0), 3, 3, TLV_DB_SCALE_ITEM(29, 0, 0), }; static const DECLARE_TLV_DB_SCALE(pga_tlv, -2325, 75, 0); static const struct snd_kcontrol_new wm8961_snd_controls[] = { SOC_DOUBLE_R_TLV("Headphone Volume", WM8961_LOUT1_VOLUME, WM8961_ROUT1_VOLUME, 0, 127, 0, out_tlv), SOC_DOUBLE_TLV("Headphone Secondary Volume", WM8961_ANALOGUE_HP_2, 6, 3, 7, 0, hp_sec_tlv), SOC_DOUBLE_R("Headphone ZC Switch", WM8961_LOUT1_VOLUME, WM8961_ROUT1_VOLUME, 7, 1, 0), SOC_DOUBLE_R_TLV("Speaker Volume", WM8961_LOUT2_VOLUME, WM8961_ROUT2_VOLUME,
case CS42L73_SPKMVSPMA: case CS42L73_ESLMIPMA: case CS42L73_ESLMXSPA: case CS42L73_ESLMASPA: case CS42L73_ESLMVSPMA: case CS42L73_IM1: case CS42L73_IM2: return true; default: return false; } } static const unsigned int hpaloa_tlv[] = { TLV_DB_RANGE_HEAD(2), 0, 13, TLV_DB_SCALE_ITEM(-7600, 200, 0), 14, 75, TLV_DB_SCALE_ITEM(-4900, 100, 0), }; static DECLARE_TLV_DB_SCALE(adc_boost_tlv, 0, 2500, 0); static DECLARE_TLV_DB_SCALE(hl_tlv, -10200, 50, 0); static DECLARE_TLV_DB_SCALE(ipd_tlv, -9600, 100, 0); static DECLARE_TLV_DB_SCALE(micpga_tlv, -600, 50, 0); static const unsigned int limiter_tlv[] = { TLV_DB_RANGE_HEAD(2), 0, 2, TLV_DB_SCALE_ITEM(-3000, 600, 0), 3, 7, TLV_DB_SCALE_ITEM(-1200, 300, 0),
* * NOTE: The information is mostly for user-space consumption, to be viewed * alongwith amixer. */ /** * cod3022x_ctvol_bst_tlv * * Map: (0x0, 0dB), (0x1, 12dB), (0x2, 20dB) * * CTVOL_BST1, reg(0x20), shift(5), width(2) * CTVOL_BST2, reg(0x21), shift(5), width(2) */ static const unsigned int cod3022x_ctvol_bst_tlv[] = { TLV_DB_RANGE_HEAD(2), 0, 1, TLV_DB_SCALE_ITEM(0, 1200, 0), 2, 2, TLV_DB_SCALE_ITEM(2000, 0, 0), }; /** * cod3022x_ctvol_bst_pga_tlv * * Range: -16.5dB to +18dB, step 1.5dB * * CTVOL_BST_PGA1, reg(0x20), shift(0), width(5), invert(1), max(31) * CTVOL_BST_PGA2, reg(0x21), shift(0), width(5), invert(1), max(31) */ static const DECLARE_TLV_DB_SCALE(cod3022x_ctvol_bst_pga_tlv, -1650, 150, 0); /** * cod3022x_ctvol_line_tlv