#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <sound/core.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 "da732x.h"
#include "da732x_reg.h"
struct da732x_priv { … };
static const struct reg_default da732x_reg_cache[] = …;
static inline int da732x_get_input_div(struct snd_soc_component *component, int sysclk)
{ … }
static void da732x_set_charge_pump(struct snd_soc_component *component, int state)
{ … }
static const DECLARE_TLV_DB_SCALE(mic_boost_tlv, DA732X_MIC_PRE_VOL_DB_MIN,
DA732X_MIC_PRE_VOL_DB_INC, 0);
static const DECLARE_TLV_DB_SCALE(mic_pga_tlv, DA732X_MIC_VOL_DB_MIN,
DA732X_MIC_VOL_DB_INC, 0);
static const DECLARE_TLV_DB_SCALE(aux_pga_tlv, DA732X_AUX_VOL_DB_MIN,
DA732X_AUX_VOL_DB_INC, 0);
static const DECLARE_TLV_DB_SCALE(hp_pga_tlv, DA732X_HP_VOL_DB_MIN,
DA732X_AUX_VOL_DB_INC, 0);
static const DECLARE_TLV_DB_SCALE(lin2_pga_tlv, DA732X_LIN2_VOL_DB_MIN,
DA732X_LIN2_VOL_DB_INC, 0);
static const DECLARE_TLV_DB_SCALE(lin3_pga_tlv, DA732X_LIN3_VOL_DB_MIN,
DA732X_LIN3_VOL_DB_INC, 0);
static const DECLARE_TLV_DB_SCALE(lin4_pga_tlv, DA732X_LIN4_VOL_DB_MIN,
DA732X_LIN4_VOL_DB_INC, 0);
static const DECLARE_TLV_DB_SCALE(adc_pga_tlv, DA732X_ADC_VOL_DB_MIN,
DA732X_ADC_VOL_DB_INC, 0);
static const DECLARE_TLV_DB_SCALE(dac_pga_tlv, DA732X_DAC_VOL_DB_MIN,
DA732X_DAC_VOL_DB_INC, 0);
static const DECLARE_TLV_DB_SCALE(eq_band_pga_tlv, DA732X_EQ_BAND_VOL_DB_MIN,
DA732X_EQ_BAND_VOL_DB_INC, 0);
static const DECLARE_TLV_DB_SCALE(eq_overall_tlv, DA732X_EQ_OVERALL_VOL_DB_MIN,
DA732X_EQ_OVERALL_VOL_DB_INC, 0);
static const char *da732x_hpf_mode[] = …;
static const char *da732x_hpf_music[] = …;
static const char *da732x_hpf_voice[] = …;
static SOC_ENUM_SINGLE_DECL(da732x_dac1_hpf_mode_enum,
DA732X_REG_DAC1_HPF, DA732X_HPF_MODE_SHIFT,
da732x_hpf_mode);
static SOC_ENUM_SINGLE_DECL(da732x_dac2_hpf_mode_enum,
DA732X_REG_DAC2_HPF, DA732X_HPF_MODE_SHIFT,
da732x_hpf_mode);
static SOC_ENUM_SINGLE_DECL(da732x_dac3_hpf_mode_enum,
DA732X_REG_DAC3_HPF, DA732X_HPF_MODE_SHIFT,
da732x_hpf_mode);
static SOC_ENUM_SINGLE_DECL(da732x_adc1_hpf_mode_enum,
DA732X_REG_ADC1_HPF, DA732X_HPF_MODE_SHIFT,
da732x_hpf_mode);
static SOC_ENUM_SINGLE_DECL(da732x_adc2_hpf_mode_enum,
DA732X_REG_ADC2_HPF, DA732X_HPF_MODE_SHIFT,
da732x_hpf_mode);
static SOC_ENUM_SINGLE_DECL(da732x_dac1_hp_filter_enum,
DA732X_REG_DAC1_HPF, DA732X_HPF_MUSIC_SHIFT,
da732x_hpf_music);
static SOC_ENUM_SINGLE_DECL(da732x_dac2_hp_filter_enum,
DA732X_REG_DAC2_HPF, DA732X_HPF_MUSIC_SHIFT,
da732x_hpf_music);
static SOC_ENUM_SINGLE_DECL(da732x_dac3_hp_filter_enum,
DA732X_REG_DAC3_HPF, DA732X_HPF_MUSIC_SHIFT,
da732x_hpf_music);
static SOC_ENUM_SINGLE_DECL(da732x_adc1_hp_filter_enum,
DA732X_REG_ADC1_HPF, DA732X_HPF_MUSIC_SHIFT,
da732x_hpf_music);
static SOC_ENUM_SINGLE_DECL(da732x_adc2_hp_filter_enum,
DA732X_REG_ADC2_HPF, DA732X_HPF_MUSIC_SHIFT,
da732x_hpf_music);
static SOC_ENUM_SINGLE_DECL(da732x_dac1_voice_filter_enum,
DA732X_REG_DAC1_HPF, DA732X_HPF_VOICE_SHIFT,
da732x_hpf_voice);
static SOC_ENUM_SINGLE_DECL(da732x_dac2_voice_filter_enum,
DA732X_REG_DAC2_HPF, DA732X_HPF_VOICE_SHIFT,
da732x_hpf_voice);
static SOC_ENUM_SINGLE_DECL(da732x_dac3_voice_filter_enum,
DA732X_REG_DAC3_HPF, DA732X_HPF_VOICE_SHIFT,
da732x_hpf_voice);
static SOC_ENUM_SINGLE_DECL(da732x_adc1_voice_filter_enum,
DA732X_REG_ADC1_HPF, DA732X_HPF_VOICE_SHIFT,
da732x_hpf_voice);
static SOC_ENUM_SINGLE_DECL(da732x_adc2_voice_filter_enum,
DA732X_REG_ADC2_HPF, DA732X_HPF_VOICE_SHIFT,
da732x_hpf_voice);
static int da732x_hpf_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int da732x_hpf_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new da732x_snd_controls[] = …;
static int da732x_adc_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int da732x_out_pga_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const char *adcl_text[] = …;
static const char *adcr_text[] = …;
static const char *enable_text[] = …;
static SOC_ENUM_SINGLE_DECL(adc1l_enum,
DA732X_REG_INP_MUX, DA732X_ADC1L_MUX_SEL_SHIFT,
adcl_text);
static const struct snd_kcontrol_new adc1l_mux = …;
static SOC_ENUM_SINGLE_DECL(adc1r_enum,
DA732X_REG_INP_MUX, DA732X_ADC1R_MUX_SEL_SHIFT,
adcr_text);
static const struct snd_kcontrol_new adc1r_mux = …;
static SOC_ENUM_SINGLE_DECL(adc2l_enum,
DA732X_REG_INP_MUX, DA732X_ADC2L_MUX_SEL_SHIFT,
adcl_text);
static const struct snd_kcontrol_new adc2l_mux = …;
static SOC_ENUM_SINGLE_DECL(adc2r_enum,
DA732X_REG_INP_MUX, DA732X_ADC2R_MUX_SEL_SHIFT,
adcr_text);
static const struct snd_kcontrol_new adc2r_mux = …;
static SOC_ENUM_SINGLE_DECL(da732x_hp_left_output,
DA732X_REG_HPL, DA732X_HP_OUT_DAC_EN_SHIFT,
enable_text);
static const struct snd_kcontrol_new hpl_mux = …;
static SOC_ENUM_SINGLE_DECL(da732x_hp_right_output,
DA732X_REG_HPR, DA732X_HP_OUT_DAC_EN_SHIFT,
enable_text);
static const struct snd_kcontrol_new hpr_mux = …;
static SOC_ENUM_SINGLE_DECL(da732x_speaker_output,
DA732X_REG_LIN3, DA732X_LOUT_DAC_EN_SHIFT,
enable_text);
static const struct snd_kcontrol_new spk_mux = …;
static SOC_ENUM_SINGLE_DECL(da732x_lout4_output,
DA732X_REG_LIN4, DA732X_LOUT_DAC_EN_SHIFT,
enable_text);
static const struct snd_kcontrol_new lout4_mux = …;
static SOC_ENUM_SINGLE_DECL(da732x_lout2_output,
DA732X_REG_LIN2, DA732X_LOUT_DAC_EN_SHIFT,
enable_text);
static const struct snd_kcontrol_new lout2_mux = …;
static const struct snd_soc_dapm_widget da732x_dapm_widgets[] = …;
static const struct snd_soc_dapm_route da732x_dapm_routes[] = …;
static int da732x_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int da732x_set_dai_fmt(struct snd_soc_dai *dai, u32 fmt)
{ … }
static int da732x_set_dai_pll(struct snd_soc_component *component, int pll_id,
int source, unsigned int freq_in,
unsigned int freq_out)
{ … }
static int da732x_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
unsigned int freq, int dir)
{ … }
#define DA732X_RATES …
#define DA732X_FORMATS …
static const struct snd_soc_dai_ops da732x_dai_ops = …;
static struct snd_soc_dai_driver da732x_dai[] = …;
static bool da732x_volatile(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config da732x_regmap = …;
static void da732x_dac_offset_adjust(struct snd_soc_component *component)
{ … }
static void da732x_output_offset_adjust(struct snd_soc_component *component)
{ … }
static void da732x_hp_dc_offset_cancellation(struct snd_soc_component *component)
{ … }
static int da732x_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static const struct snd_soc_component_driver soc_component_dev_da732x = …;
static int da732x_i2c_probe(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id da732x_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, da732x_i2c_id);
static struct i2c_driver da732x_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;