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(max98505->regmap, addr, &val_l); pr_info("%s: reg 0x%02X, val_l 0x%02X\n", __func__, addr, val_l); } i++; } } #endif static const unsigned int max98505_spk_tlv[] = { TLV_DB_RANGE_HEAD(1), 1, 31, TLV_DB_SCALE_ITEM(-600, 100, 0), }; static int max98505_spk_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct max98505_priv *max98505 = snd_soc_codec_get_drvdata(codec); ucontrol->value.integer.value[0] = max98505->volume; return 0; } static int max98505_spk_vol_put(struct snd_kcontrol *kcontrol,
{13000000, 2822400, 0x00, 0x98, 0x1D, 0}, /* MCLK=13Mhz */ {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),
snd_soc_write(codec, ALC5623_HID_CTRL_DATA, 0); break; } return 0; } /* * ALC5623 Controls */ static const DECLARE_TLV_DB_SCALE(vol_tlv, -3450, 150, 0); static const DECLARE_TLV_DB_SCALE(hp_tlv, -4650, 150, 0); static const DECLARE_TLV_DB_SCALE(adc_rec_tlv, -1650, 150, 0); static const unsigned int boost_tlv[] = { TLV_DB_RANGE_HEAD(3), 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0), 2, 2, TLV_DB_SCALE_ITEM(3000, 0, 0), }; static const DECLARE_TLV_DB_SCALE(dig_tlv, 0, 600, 0); static const struct snd_kcontrol_new alc5621_vol_snd_controls[] = { SOC_DOUBLE_TLV("Speaker Playback Volume", ALC5623_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv), SOC_DOUBLE("Speaker Playback Switch", ALC5623_SPK_OUT_VOL, 15, 7, 1, 1), SOC_DOUBLE_TLV("Headphone Playback Volume", ALC5623_HP_OUT_VOL, 8, 0, 31, 1, hp_tlv), SOC_DOUBLE("Headphone Playback Switch", ALC5623_HP_OUT_VOL, 15, 7, 1, 1),
return 0; } static int max9768_set_gpio(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(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),
return true; default: return false; } } static int wm9081_reset(struct regmap *map) { return regmap_write(map, WM9081_SOFTWARE_RESET, 0x9081); } 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[] = {
#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",
struct pm860x_chip *chip; struct pm860x_det det; int irq[4]; unsigned char name[4][MAX_NAME_LEN]; }; /* -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 unsigned int mic_tlv[] = { TLV_DB_RANGE_HEAD(5), 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 unsigned int aux_tlv[] = { TLV_DB_RANGE_HEAD(2), 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 */
"Loudness 3", "Loudness 4", "Loudness 5", "Loudness 6", "Loudness 7", "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),
dev_dbg(codec->dev, "Waiting for DC servo...\n"); 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(6), 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(4), 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(7), 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), };
/* JACK DETECT AND ENABLE REGISTERS */ {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),
* published by the Free Software Foundation. */ #include <sound/soc.h> #include <sound/soc-dapm.h> #include <sound/tlv.h> #include "escore.h" #include "es-a300-reg.h" static DECLARE_TLV_DB_SCALE(spkr_tlv, -3600, 200, 1); static DECLARE_TLV_DB_SCALE(lo_tlv, -2200, 200, 1); static DECLARE_TLV_DB_SCALE(ep_tlv, -2200, 200, 1); static DECLARE_TLV_DB_SCALE(aux_tlv, 0, 150, 0); static DECLARE_TLV_DB_SCALE(mic_tlv, 0, 150, 0); static const unsigned int hp_tlv[] = { TLV_DB_RANGE_HEAD(6), 0, 0, TLV_DB_SCALE_ITEM(-6000, 0, 0), 1, 1, TLV_DB_SCALE_ITEM(-5100, 0, 0), 2, 2, TLV_DB_SCALE_ITEM(-4300, 0, 0), 3, 5, TLV_DB_SCALE_ITEM(-3700, 500, 0), 6, 11, TLV_DB_SCALE_ITEM(-2300, 300, 0), 12, 15, TLV_DB_SCALE_ITEM(-600, 200, 0), }; static const char * const aux_mono_text[] = { "Mono", "Stereo" }; static const struct soc_enum auxl_mono_enum = SOC_ENUM_SINGLE(ES_AUX_L_CTRL, ES_AUX_STEREO_SHIFT, ARRAY_SIZE(aux_mono_text), aux_mono_text);