#include <linux/acpi.h>
#include <linux/of.h>
#include <linux/property.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <linux/pm_runtime.h>
#include <sound/soc.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <sound/da7213.h>
#include "da7213.h"
static const DECLARE_TLV_DB_RANGE(aux_vol_tlv,
0x0, 0x11, TLV_DB_SCALE_ITEM(-5400, 0, 0),
0x12, 0x3f, TLV_DB_SCALE_ITEM(-5250, 150, 0)
);
static const DECLARE_TLV_DB_RANGE(digital_gain_tlv,
0x0, 0x07, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1),
0x08, 0x7f, TLV_DB_SCALE_ITEM(-7800, 75, 0)
);
static const DECLARE_TLV_DB_RANGE(alc_analog_gain_tlv,
0x0, 0x0, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1),
0x01, 0x07, TLV_DB_SCALE_ITEM(0, 600, 0)
);
static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, -600, 600, 0);
static const DECLARE_TLV_DB_SCALE(mixin_gain_tlv, -450, 150, 0);
static const DECLARE_TLV_DB_SCALE(eq_gain_tlv, -1050, 150, 0);
static const DECLARE_TLV_DB_SCALE(hp_vol_tlv, -5700, 100, 0);
static const DECLARE_TLV_DB_SCALE(lineout_vol_tlv, -4800, 100, 0);
static const DECLARE_TLV_DB_SCALE(alc_threshold_tlv, -9450, 150, 0);
static const DECLARE_TLV_DB_SCALE(alc_gain_tlv, 0, 600, 0);
static const DECLARE_TLV_DB_SCALE(da7213_tonegen_gain_tlv, -4500, 300, 0);
static const char * const da7213_voice_hpf_corner_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_dac_voice_hpf_corner,
DA7213_DAC_FILTERS1,
DA7213_VOICE_HPF_CORNER_SHIFT,
da7213_voice_hpf_corner_txt);
static SOC_ENUM_SINGLE_DECL(da7213_adc_voice_hpf_corner,
DA7213_ADC_FILTERS1,
DA7213_VOICE_HPF_CORNER_SHIFT,
da7213_voice_hpf_corner_txt);
static const char * const da7213_audio_hpf_corner_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_dac_audio_hpf_corner,
DA7213_DAC_FILTERS1
, DA7213_AUDIO_HPF_CORNER_SHIFT,
da7213_audio_hpf_corner_txt);
static SOC_ENUM_SINGLE_DECL(da7213_adc_audio_hpf_corner,
DA7213_ADC_FILTERS1,
DA7213_AUDIO_HPF_CORNER_SHIFT,
da7213_audio_hpf_corner_txt);
static const char * const da7213_tonegen_dtmf_key_txt[] = …;
static const struct soc_enum da7213_tonegen_dtmf_key = …;
static const char * const da7213_tonegen_swg_sel_txt[] = …;
static const struct soc_enum da7213_tonegen_swg_sel = …;
static const char * const da7213_gain_ramp_rate_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_gain_ramp_rate,
DA7213_GAIN_RAMP_CTRL,
DA7213_GAIN_RAMP_RATE_SHIFT,
da7213_gain_ramp_rate_txt);
static const char * const da7213_dac_ng_setup_time_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_dac_ng_setup_time,
DA7213_DAC_NG_SETUP_TIME,
DA7213_DAC_NG_SETUP_TIME_SHIFT,
da7213_dac_ng_setup_time_txt);
static const char * const da7213_dac_ng_rampup_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_dac_ng_rampup_rate,
DA7213_DAC_NG_SETUP_TIME,
DA7213_DAC_NG_RAMPUP_RATE_SHIFT,
da7213_dac_ng_rampup_txt);
static const char * const da7213_dac_ng_rampdown_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_dac_ng_rampdown_rate,
DA7213_DAC_NG_SETUP_TIME,
DA7213_DAC_NG_RAMPDN_RATE_SHIFT,
da7213_dac_ng_rampdown_txt);
static const char * const da7213_dac_soft_mute_rate_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_dac_soft_mute_rate,
DA7213_DAC_FILTERS5,
DA7213_DAC_SOFTMUTE_RATE_SHIFT,
da7213_dac_soft_mute_rate_txt);
static const char * const da7213_alc_attack_rate_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_alc_attack_rate,
DA7213_ALC_CTRL2,
DA7213_ALC_ATTACK_SHIFT,
da7213_alc_attack_rate_txt);
static const char * const da7213_alc_release_rate_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_alc_release_rate,
DA7213_ALC_CTRL2,
DA7213_ALC_RELEASE_SHIFT,
da7213_alc_release_rate_txt);
static const char * const da7213_alc_hold_time_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_alc_hold_time,
DA7213_ALC_CTRL3,
DA7213_ALC_HOLD_SHIFT,
da7213_alc_hold_time_txt);
static const char * const da7213_alc_integ_rate_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_alc_integ_attack_rate,
DA7213_ALC_CTRL3,
DA7213_ALC_INTEG_ATTACK_SHIFT,
da7213_alc_integ_rate_txt);
static SOC_ENUM_SINGLE_DECL(da7213_alc_integ_release_rate,
DA7213_ALC_CTRL3,
DA7213_ALC_INTEG_RELEASE_SHIFT,
da7213_alc_integ_rate_txt);
static int da7213_volsw_locked_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7213_volsw_locked_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7213_enum_locked_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7213_enum_locked_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7213_get_alc_data(struct snd_soc_component *component, u8 reg_val)
{ … }
static void da7213_alc_calib_man(struct snd_soc_component *component)
{ … }
static void da7213_alc_calib_auto(struct snd_soc_component *component)
{ … }
static void da7213_alc_calib(struct snd_soc_component *component)
{ … }
static int da7213_put_mixin_gain(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7213_put_alc_sw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7213_tonegen_freq_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da7213_tonegen_freq_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new da7213_snd_controls[] = …;
static const char * const da7213_mic_amp_in_sel_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_mic_1_amp_in_sel,
DA7213_MIC_1_CTRL,
DA7213_MIC_AMP_IN_SEL_SHIFT,
da7213_mic_amp_in_sel_txt);
static const struct snd_kcontrol_new da7213_mic_1_amp_in_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(da7213_mic_2_amp_in_sel,
DA7213_MIC_2_CTRL,
DA7213_MIC_AMP_IN_SEL_SHIFT,
da7213_mic_amp_in_sel_txt);
static const struct snd_kcontrol_new da7213_mic_2_amp_in_sel_mux = …;
static const char * const da7213_dai_src_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_dai_l_src,
DA7213_DIG_ROUTING_DAI,
DA7213_DAI_L_SRC_SHIFT,
da7213_dai_src_txt);
static const struct snd_kcontrol_new da7213_dai_l_src_mux = …;
static SOC_ENUM_SINGLE_DECL(da7213_dai_r_src,
DA7213_DIG_ROUTING_DAI,
DA7213_DAI_R_SRC_SHIFT,
da7213_dai_src_txt);
static const struct snd_kcontrol_new da7213_dai_r_src_mux = …;
static const char * const da7213_dac_src_txt[] = …;
static SOC_ENUM_SINGLE_DECL(da7213_dac_l_src,
DA7213_DIG_ROUTING_DAC,
DA7213_DAC_L_SRC_SHIFT,
da7213_dac_src_txt);
static const struct snd_kcontrol_new da7213_dac_l_src_mux = …;
static SOC_ENUM_SINGLE_DECL(da7213_dac_r_src,
DA7213_DIG_ROUTING_DAC,
DA7213_DAC_R_SRC_SHIFT,
da7213_dac_src_txt);
static const struct snd_kcontrol_new da7213_dac_r_src_mux = …;
static const struct snd_kcontrol_new da7213_dapm_mixinl_controls[] = …;
static const struct snd_kcontrol_new da7213_dapm_mixinr_controls[] = …;
static const struct snd_kcontrol_new da7213_dapm_mixoutl_controls[] = …;
static const struct snd_kcontrol_new da7213_dapm_mixoutr_controls[] = …;
static int da7213_dai_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const struct snd_soc_dapm_widget da7213_dapm_widgets[] = …;
static const struct snd_soc_dapm_route da7213_audio_map[] = …;
static const struct reg_default da7213_reg_defaults[] = …;
static bool da7213_volatile_register(struct device *dev, unsigned int reg)
{ … }
static int da7213_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int da7213_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
{ … }
static int da7213_mute(struct snd_soc_dai *dai, int mute, int direction)
{ … }
#define DA7213_FORMATS …
static int da7213_set_component_sysclk(struct snd_soc_component *component,
int clk_id, int source,
unsigned int freq, int dir)
{ … }
static int _da7213_set_component_pll(struct snd_soc_component *component,
int pll_id, int source,
unsigned int fref, unsigned int fout)
{ … }
static int da7213_set_component_pll(struct snd_soc_component *component,
int pll_id, int source,
unsigned int fref, unsigned int fout)
{ … }
static const u64 da7213_dai_formats = …;
static const struct snd_soc_dai_ops da7213_dai_ops = …;
static struct snd_soc_dai_driver da7213_dai = …;
static int da7213_set_auto_pll(struct snd_soc_component *component, bool enable)
{ … }
static int da7213_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
#if defined(CONFIG_OF)
static const struct of_device_id da7213_of_match[] = …;
MODULE_DEVICE_TABLE(of, da7213_of_match);
#endif
#ifdef CONFIG_ACPI
static const struct acpi_device_id da7213_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, da7213_acpi_match);
#endif
static enum da7213_micbias_voltage
da7213_of_micbias_lvl(struct snd_soc_component *component, u32 val)
{ … }
static enum da7213_dmic_data_sel
da7213_of_dmic_data_sel(struct snd_soc_component *component, const char *str)
{ … }
static enum da7213_dmic_samplephase
da7213_of_dmic_samplephase(struct snd_soc_component *component, const char *str)
{ … }
static enum da7213_dmic_clk_rate
da7213_of_dmic_clkrate(struct snd_soc_component *component, u32 val)
{ … }
static struct da7213_platform_data
*da7213_fw_to_pdata(struct snd_soc_component *component)
{ … }
static int da7213_probe(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_component_dev_da7213 = …;
static const struct regmap_config da7213_regmap_config = …;
static void da7213_power_off(void *data)
{ … }
static const char *da7213_supply_names[DA7213_NUM_SUPPLIES] = …;
static int da7213_i2c_probe(struct i2c_client *i2c)
{ … }
static void da7213_i2c_remove(struct i2c_client *i2c)
{ … }
static int __maybe_unused da7213_runtime_suspend(struct device *dev)
{ … }
static int __maybe_unused da7213_runtime_resume(struct device *dev)
{ … }
static const struct dev_pm_ops da7213_pm = …;
static const struct i2c_device_id da7213_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, da7213_i2c_id);
static struct i2c_driver da7213_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;