#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/clkdev.h>
#include <linux/clk-provider.h>
#include <linux/i2c.h>
#include <linux/of.h>
#include <linux/property.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/initval.h>
#include <sound/tlv.h>
#include <asm/div64.h>
#include <sound/da7219.h>
#include "da7219.h"
#include "da7219-aad.h"
static const DECLARE_TLV_DB_SCALE(da7219_mic_gain_tlv, -600, 600, 0);
static const DECLARE_TLV_DB_SCALE(da7219_mixin_gain_tlv, -450, 150, 0);
static const DECLARE_TLV_DB_SCALE(da7219_adc_dig_gain_tlv, -8325, 75, 0);
static const DECLARE_TLV_DB_SCALE(da7219_alc_threshold_tlv, -9450, 150, 0);
static const DECLARE_TLV_DB_SCALE(da7219_alc_gain_tlv, 0, 600, 0);
static const DECLARE_TLV_DB_SCALE(da7219_alc_ana_gain_tlv, 0, 600, 0);
static const DECLARE_TLV_DB_SCALE(da7219_sidetone_gain_tlv, -4200, 300, 0);
static const DECLARE_TLV_DB_SCALE(da7219_tonegen_gain_tlv, -4500, 300, 0);
static const DECLARE_TLV_DB_SCALE(da7219_dac_eq_band_tlv, -1050, 150, 0);
static const DECLARE_TLV_DB_RANGE(da7219_dac_dig_gain_tlv,
0x0, 0x07, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1),
0x08, 0x7f, TLV_DB_SCALE_ITEM(-7725, 75, 0)
);
static const DECLARE_TLV_DB_SCALE(da7219_dac_ng_threshold_tlv, -10200, 600, 0);
static const DECLARE_TLV_DB_SCALE(da7219_hp_gain_tlv, -5700, 100, 0);
static const char * const da7219_alc_attack_rate_txt[] = …;
static const struct soc_enum da7219_alc_attack_rate = …;
static const char * const da7219_alc_release_rate_txt[] = …;
static const struct soc_enum da7219_alc_release_rate = …;
static const char * const da7219_alc_hold_time_txt[] = …;
static const struct soc_enum da7219_alc_hold_time = …;
static const char * const da7219_alc_env_rate_txt[] = …;
static const struct soc_enum da7219_alc_env_attack_rate = …;
static const struct soc_enum da7219_alc_env_release_rate = …;
static const char * const da7219_alc_anticlip_step_txt[] = …;
static const struct soc_enum da7219_alc_anticlip_step = …;
static const char * const da7219_gain_ramp_rate_txt[] = …;
static const struct soc_enum da7219_gain_ramp_rate = …;
static const char * const da7219_hpf_mode_txt[] = …;
static const unsigned int da7219_hpf_mode_val[] = …;
static const struct soc_enum da7219_adc_hpf_mode = …;
static const struct soc_enum da7219_dac_hpf_mode = …;
static const char * const da7219_audio_hpf_corner_txt[] = …;
static const struct soc_enum da7219_adc_audio_hpf_corner = …;
static const struct soc_enum da7219_dac_audio_hpf_corner = …;
static const char * const da7219_voice_hpf_corner_txt[] = …;
static const struct soc_enum da7219_adc_voice_hpf_corner = …;
static const struct soc_enum da7219_dac_voice_hpf_corner = …;
static const char * const da7219_tonegen_dtmf_key_txt[] = …;
static const struct soc_enum da7219_tonegen_dtmf_key = …;
static const char * const da7219_tonegen_swg_sel_txt[] = …;
static const struct soc_enum da7219_tonegen_swg_sel = …;
static const char * const da7219_dac_softmute_rate_txt[] = …;
static const struct soc_enum da7219_dac_softmute_rate = …;
static const char * const da7219_dac_ng_setup_time_txt[] = …;
static const struct soc_enum da7219_dac_ng_setup_time = …;
static const char * const da7219_dac_ng_rampup_txt[] = …;
static const struct soc_enum da7219_dac_ng_rampup_rate = …;
static const char * const da7219_dac_ng_rampdown_txt[] = …;
static const struct soc_enum da7219_dac_ng_rampdown_rate = …;
static const char * const da7219_cp_track_mode_txt[] = …;
static const unsigned int da7219_cp_track_mode_val[] = …;
static const struct soc_enum da7219_cp_track_mode = …;
static int da7219_volsw_locked_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7219_volsw_locked_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7219_enum_locked_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7219_enum_locked_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static void da7219_alc_calib(struct snd_soc_component *component)
{ … }
static int da7219_mixin_gain_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7219_alc_sw_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7219_tonegen_freq_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7219_tonegen_freq_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new da7219_snd_controls[] = …;
static const char * const da7219_out_sel_txt[] = …;
static const struct soc_enum da7219_out_dail_sel = …;
static const struct snd_kcontrol_new da7219_out_dail_sel_mux = …;
static const struct soc_enum da7219_out_dair_sel = …;
static const struct snd_kcontrol_new da7219_out_dair_sel_mux = …;
static const struct soc_enum da7219_out_dacl_sel = …;
static const struct snd_kcontrol_new da7219_out_dacl_sel_mux = …;
static const struct soc_enum da7219_out_dacr_sel = …;
static const struct snd_kcontrol_new da7219_out_dacr_sel_mux = …;
static const struct snd_kcontrol_new da7219_mixin_controls[] = …;
static const struct snd_kcontrol_new da7219_mixout_l_controls[] = …;
static const struct snd_kcontrol_new da7219_mixout_r_controls[] = …;
#define DA7219_DMIX_ST_CTRLS(reg) … \
static const struct snd_kcontrol_new da7219_st_out_filtl_mix_controls[] = …;
static const struct snd_kcontrol_new da7219_st_out_filtr_mix_controls[] = …;
static int da7219_mic_pga_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int da7219_dai_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int da7219_settling_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int da7219_mixout_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int da7219_gain_ramp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const struct snd_soc_dapm_widget da7219_dapm_widgets[] = …;
#define DA7219_OUT_DAI_MUX_ROUTES(name) …
#define DA7219_OUT_DAC_MUX_ROUTES(name) …
#define DA7219_DMIX_ST_ROUTES(name) …
static const struct snd_soc_dapm_route da7219_audio_map[] = …;
static int da7219_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{ … }
int da7219_set_pll(struct snd_soc_component *component, int source, unsigned int fout)
{ … }
static int da7219_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
int source, unsigned int fref, unsigned int fout)
{ … }
static int da7219_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
{ … }
static int da7219_set_bclks_per_wclk(struct snd_soc_component *component,
unsigned long factor)
{ … }
static int da7219_set_dai_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask,
int slots, int slot_width)
{ … }
static int da7219_set_sr(struct snd_soc_component *component,
unsigned long rate)
{ … }
static int da7219_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 da7219_dai_ops = …;
#define DA7219_FORMATS …
#define DA7219_RATES …
static struct snd_soc_dai_driver da7219_dai = …;
#ifdef CONFIG_OF
static const struct of_device_id da7219_of_match[] = …;
MODULE_DEVICE_TABLE(of, da7219_of_match);
#endif
#ifdef CONFIG_ACPI
static const struct acpi_device_id da7219_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, da7219_acpi_match);
#endif
static enum da7219_micbias_voltage
da7219_fw_micbias_lvl(struct device *dev, u32 val)
{ … }
static enum da7219_mic_amp_in_sel
da7219_fw_mic_amp_in_sel(struct device *dev, const char *str)
{ … }
static struct da7219_pdata *da7219_fw_to_pdata(struct device *dev)
{ … }
static int da7219_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static const char *da7219_supply_names[DA7219_NUM_SUPPLIES] = …;
static int da7219_handle_supplies(struct snd_soc_component *component,
u8 *io_voltage_lvl)
{ … }
#ifdef CONFIG_COMMON_CLK
static int da7219_wclk_prepare(struct clk_hw *hw)
{ … }
static void da7219_wclk_unprepare(struct clk_hw *hw)
{ … }
static int da7219_wclk_is_prepared(struct clk_hw *hw)
{ … }
static unsigned long da7219_wclk_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{ … }
static long da7219_wclk_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate)
{ … }
static int da7219_wclk_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ … }
static unsigned long da7219_bclk_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{ … }
static unsigned long da7219_bclk_get_factor(unsigned long rate,
unsigned long parent_rate)
{ … }
static long da7219_bclk_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate)
{ … }
static int da7219_bclk_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ … }
static const struct clk_ops da7219_dai_clk_ops[DA7219_DAI_NUM_CLKS] = …;
static int da7219_register_dai_clks(struct snd_soc_component *component)
{ … }
static void da7219_free_dai_clks(struct snd_soc_component *component)
{ … }
#else
static inline int da7219_register_dai_clks(struct snd_soc_component *component)
{
return 0;
}
static void da7219_free_dai_clks(struct snd_soc_component *component) {}
#endif
static void da7219_handle_pdata(struct snd_soc_component *component)
{ … }
static struct reg_default da7219_reg_defaults[] = …;
static bool da7219_volatile_register(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config da7219_regmap_config = …;
static struct reg_sequence da7219_rev_aa_patch[] = …;
static int da7219_probe(struct snd_soc_component *component)
{ … }
static void da7219_remove(struct snd_soc_component *component)
{ … }
#ifdef CONFIG_PM
static int da7219_suspend(struct snd_soc_component *component)
{ … }
static int da7219_resume(struct snd_soc_component *component)
{ … }
#else
#define da7219_suspend …
#define da7219_resume …
#endif
static int da7219_set_jack(struct snd_soc_component *component, struct snd_soc_jack *jack,
void *data)
{ … }
static const struct snd_soc_component_driver soc_component_dev_da7219 = …;
static int da7219_i2c_probe(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id da7219_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, da7219_i2c_id);
static struct i2c_driver da7219_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;