#include <linux/clk.h>
#include <linux/i2c.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/pm.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/regulator/consumer.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/jack.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <asm/div64.h>
#include <sound/da7218.h>
#include "da7218.h"
static const DECLARE_TLV_DB_SCALE(da7218_mic_gain_tlv, -600, 600, 0);
static const DECLARE_TLV_DB_SCALE(da7218_mixin_gain_tlv, -450, 150, 0);
static const DECLARE_TLV_DB_SCALE(da7218_in_dig_gain_tlv, -8325, 75, 0);
static const DECLARE_TLV_DB_SCALE(da7218_ags_trigger_tlv, -9000, 600, 0);
static const DECLARE_TLV_DB_SCALE(da7218_ags_att_max_tlv, 0, 600, 0);
static const DECLARE_TLV_DB_SCALE(da7218_alc_threshold_tlv, -9450, 150, 0);
static const DECLARE_TLV_DB_SCALE(da7218_alc_gain_tlv, 0, 600, 0);
static const DECLARE_TLV_DB_SCALE(da7218_alc_ana_gain_tlv, 0, 600, 0);
static const DECLARE_TLV_DB_SCALE(da7218_dmix_gain_tlv, -4200, 150, 0);
static const DECLARE_TLV_DB_SCALE(da7218_dgs_trigger_tlv, -9450, 150, 0);
static const DECLARE_TLV_DB_SCALE(da7218_dgs_anticlip_tlv, -4200, 600, 0);
static const DECLARE_TLV_DB_SCALE(da7218_dgs_signal_tlv, -9000, 600, 0);
static const DECLARE_TLV_DB_SCALE(da7218_out_eq_band_tlv, -1050, 150, 0);
static const DECLARE_TLV_DB_SCALE(da7218_out_dig_gain_tlv, -8325, 75, 0);
static const DECLARE_TLV_DB_SCALE(da7218_dac_ng_threshold_tlv, -10200, 600, 0);
static const DECLARE_TLV_DB_SCALE(da7218_mixout_gain_tlv, -100, 50, 0);
static const DECLARE_TLV_DB_SCALE(da7218_hp_gain_tlv, -5700, 150, 0);
static const char * const da7218_alc_attack_rate_txt[] = …;
static const struct soc_enum da7218_alc_attack_rate = …;
static const char * const da7218_alc_release_rate_txt[] = …;
static const struct soc_enum da7218_alc_release_rate = …;
static const char * const da7218_alc_hold_time_txt[] = …;
static const struct soc_enum da7218_alc_hold_time = …;
static const char * const da7218_alc_anticlip_step_txt[] = …;
static const struct soc_enum da7218_alc_anticlip_step = …;
static const char * const da7218_integ_rate_txt[] = …;
static const struct soc_enum da7218_integ_attack_rate = …;
static const struct soc_enum da7218_integ_release_rate = …;
static const char * const da7218_gain_ramp_rate_txt[] = …;
static const struct soc_enum da7218_gain_ramp_rate = …;
static const char * const da7218_hpf_mode_txt[] = …;
static const unsigned int da7218_hpf_mode_val[] = …;
static const struct soc_enum da7218_in1_hpf_mode = …;
static const struct soc_enum da7218_in2_hpf_mode = …;
static const struct soc_enum da7218_out1_hpf_mode = …;
static const char * const da7218_audio_hpf_corner_txt[] = …;
static const struct soc_enum da7218_in1_audio_hpf_corner = …;
static const struct soc_enum da7218_in2_audio_hpf_corner = …;
static const struct soc_enum da7218_out1_audio_hpf_corner = …;
static const char * const da7218_voice_hpf_corner_txt[] = …;
static const struct soc_enum da7218_in1_voice_hpf_corner = …;
static const struct soc_enum da7218_in2_voice_hpf_corner = …;
static const struct soc_enum da7218_out1_voice_hpf_corner = …;
static const char * const da7218_tonegen_dtmf_key_txt[] = …;
static const struct soc_enum da7218_tonegen_dtmf_key = …;
static const char * const da7218_tonegen_swg_sel_txt[] = …;
static const struct soc_enum da7218_tonegen_swg_sel = …;
static const char * const da7218_dgs_rise_coeff_txt[] = …;
static const struct soc_enum da7218_dgs_rise_coeff = …;
static const char * const da7218_dgs_fall_coeff_txt[] = …;
static const struct soc_enum da7218_dgs_fall_coeff = …;
static const char * const da7218_dac_ng_setup_time_txt[] = …;
static const struct soc_enum da7218_dac_ng_setup_time = …;
static const char * const da7218_dac_ng_rampup_txt[] = …;
static const struct soc_enum da7218_dac_ng_rampup_rate = …;
static const char * const da7218_dac_ng_rampdown_txt[] = …;
static const struct soc_enum da7218_dac_ng_rampdown_rate = …;
static const char * const da7218_cp_mchange_txt[] = …;
static const unsigned int da7218_cp_mchange_val[] = …;
static const struct soc_enum da7218_cp_mchange = …;
static const char * const da7218_cp_fcontrol_txt[] = …;
static const struct soc_enum da7218_cp_fcontrol = …;
static const char * const da7218_cp_tau_delay_txt[] = …;
static const struct soc_enum da7218_cp_tau_delay = …;
static void da7218_alc_calib(struct snd_soc_component *component)
{ … }
static int da7218_mixin_gain_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7218_alc_sw_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7218_tonegen_freq_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7218_tonegen_freq_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7218_mic_lvl_det_sw_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7218_mic_lvl_det_sw_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7218_biquad_coeff_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7218_biquad_coeff_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new da7218_snd_controls[] = …;
static const char * const da7218_mic_sel_text[] = …;
static const struct soc_enum da7218_mic1_sel = …;
static const struct snd_kcontrol_new da7218_mic1_sel_mux = …;
static const struct soc_enum da7218_mic2_sel = …;
static const struct snd_kcontrol_new da7218_mic2_sel_mux = …;
static const char * const da7218_sidetone_in_sel_txt[] = …;
static const struct soc_enum da7218_sidetone_in_sel = …;
static const struct snd_kcontrol_new da7218_sidetone_in_sel_mux = …;
static const char * const da7218_out_filt_biq_sel_txt[] = …;
static const struct soc_enum da7218_out_filtl_biq_sel = …;
static const struct snd_kcontrol_new da7218_out_filtl_biq_sel_mux = …;
static const struct soc_enum da7218_out_filtr_biq_sel = …;
static const struct snd_kcontrol_new da7218_out_filtr_biq_sel_mux = …;
#define DA7218_DMIX_CTRLS(reg) …
static const struct snd_kcontrol_new da7218_out_dai1l_mix_controls[] = …;
static const struct snd_kcontrol_new da7218_out_dai1r_mix_controls[] = …;
static const struct snd_kcontrol_new da7218_out_dai2l_mix_controls[] = …;
static const struct snd_kcontrol_new da7218_out_dai2r_mix_controls[] = …;
static const struct snd_kcontrol_new da7218_out_filtl_mix_controls[] = …;
static const struct snd_kcontrol_new da7218_out_filtr_mix_controls[] = …;
#define DA7218_DMIX_ST_CTRLS(reg) … \
static const struct snd_kcontrol_new da7218_st_out_filtl_mix_controls[] = …;
static const struct snd_kcontrol_new da7218_st_out_filtr_mix_controls[] = …;
static int da7218_in_filter_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int da7218_dai_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int da7218_cp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int da7218_hp_pga_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const struct snd_soc_dapm_widget da7218_dapm_widgets[] = …;
#define DA7218_DMIX_ROUTES(name) …
#define DA7218_DMIX_ST_ROUTES(name) …
static const struct snd_soc_dapm_route da7218_audio_map[] = …;
static int da7218_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int da7218_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
int source, unsigned int fref, unsigned int fout)
{ … }
static int da7218_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
{ … }
static int da7218_set_dai_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask,
int slots, int slot_width)
{ … }
static int da7218_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static const struct snd_soc_dai_ops da7218_dai_ops = …;
#define DA7218_FORMATS …
static struct snd_soc_dai_driver da7218_dai = …;
int da7218_hpldet(struct snd_soc_component *component, struct snd_soc_jack *jack)
{ … }
EXPORT_SYMBOL_GPL(…);
static void da7218_micldet_irq(struct snd_soc_component *component)
{ … }
static void da7218_hpldet_irq(struct snd_soc_component *component)
{ … }
static irqreturn_t da7218_irq_thread(int irq, void *data)
{ … }
static const struct of_device_id da7218_of_match[] = …;
MODULE_DEVICE_TABLE(of, da7218_of_match);
static enum da7218_micbias_voltage
da7218_of_micbias_lvl(struct snd_soc_component *component, u32 val)
{ … }
static enum da7218_mic_amp_in_sel
da7218_of_mic_amp_in_sel(struct snd_soc_component *component, const char *str)
{ … }
static enum da7218_dmic_data_sel
da7218_of_dmic_data_sel(struct snd_soc_component *component, const char *str)
{ … }
static enum da7218_dmic_samplephase
da7218_of_dmic_samplephase(struct snd_soc_component *component, const char *str)
{ … }
static enum da7218_dmic_clk_rate
da7218_of_dmic_clkrate(struct snd_soc_component *component, u32 val)
{ … }
static enum da7218_hpldet_jack_rate
da7218_of_jack_rate(struct snd_soc_component *component, u32 val)
{ … }
static enum da7218_hpldet_jack_debounce
da7218_of_jack_debounce(struct snd_soc_component *component, u32 val)
{ … }
static enum da7218_hpldet_jack_thr
da7218_of_jack_thr(struct snd_soc_component *component, u32 val)
{ … }
static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_component *component)
{ … }
static int da7218_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static const char *da7218_supply_names[DA7218_NUM_SUPPLIES] = …;
static int da7218_handle_supplies(struct snd_soc_component *component)
{ … }
static void da7218_handle_pdata(struct snd_soc_component *component)
{ … }
static int da7218_probe(struct snd_soc_component *component)
{ … }
static void da7218_remove(struct snd_soc_component *component)
{ … }
#ifdef CONFIG_PM
static int da7218_suspend(struct snd_soc_component *component)
{ … }
static int da7218_resume(struct snd_soc_component *component)
{ … }
#else
#define da7218_suspend …
#define da7218_resume …
#endif
static const struct snd_soc_component_driver soc_component_dev_da7218 = …;
static struct reg_default da7218_reg_defaults[] = …;
static bool da7218_volatile_register(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config da7218_regmap_config = …;
static int da7218_i2c_probe(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id da7218_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, da7218_i2c_id);
static struct i2c_driver da7218_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;