#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/gpio/consumer.h>
#include <linux/regulator/consumer.h>
#include <linux/acpi.h>
#include <linux/of.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include "tlv320adcx140.h"
struct adcx140_priv { … };
static const char * const gpo_config_names[] = …;
static const struct reg_default adcx140_reg_defaults[] = …;
static const struct regmap_range_cfg adcx140_ranges[] = …;
static bool adcx140_volatile(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config adcx140_i2c_regmap = …;
static DECLARE_TLV_DB_SCALE(dig_vol_tlv, -10050, 50, 0);
static DECLARE_TLV_DB_SCALE(adc_tlv, 0, 100, 0);
static DECLARE_TLV_DB_SCALE(dre_thresh_tlv, -6600, 100, 0);
static DECLARE_TLV_DB_SCALE(dre_gain_tlv, 200, 200, 0);
static DECLARE_TLV_DB_SCALE(agc_thresh_tlv, -3600, 200, 0);
static DECLARE_TLV_DB_SCALE(agc_gain_tlv, 300, 300, 0);
static const char * const decimation_filter_text[] = …;
static SOC_ENUM_SINGLE_DECL(decimation_filter_enum, ADCX140_DSP_CFG0, 4,
decimation_filter_text);
static const struct snd_kcontrol_new decimation_filter_controls[] = …;
static const char * const pdmclk_text[] = …;
static SOC_ENUM_SINGLE_DECL(pdmclk_select_enum, ADCX140_PDMCLK_CFG, 0,
pdmclk_text);
static const struct snd_kcontrol_new pdmclk_div_controls[] = …;
static const char * const resistor_text[] = …;
static SOC_ENUM_SINGLE_DECL(in1_resistor_enum, ADCX140_CH1_CFG0, 2,
resistor_text);
static SOC_ENUM_SINGLE_DECL(in2_resistor_enum, ADCX140_CH2_CFG0, 2,
resistor_text);
static SOC_ENUM_SINGLE_DECL(in3_resistor_enum, ADCX140_CH3_CFG0, 2,
resistor_text);
static SOC_ENUM_SINGLE_DECL(in4_resistor_enum, ADCX140_CH4_CFG0, 2,
resistor_text);
static const struct snd_kcontrol_new in1_resistor_controls[] = …;
static const struct snd_kcontrol_new in2_resistor_controls[] = …;
static const struct snd_kcontrol_new in3_resistor_controls[] = …;
static const struct snd_kcontrol_new in4_resistor_controls[] = …;
static const char * const adcx140_mic_sel_text[] = …;
static const char * const adcx140_analog_sel_text[] = …;
static SOC_ENUM_SINGLE_DECL(adcx140_mic1p_enum,
ADCX140_CH1_CFG0, 5,
adcx140_mic_sel_text);
static const struct snd_kcontrol_new adcx140_dapm_mic1p_control = …;
static SOC_ENUM_SINGLE_DECL(adcx140_mic1_analog_enum,
ADCX140_CH1_CFG0, 7,
adcx140_analog_sel_text);
static const struct snd_kcontrol_new adcx140_dapm_mic1_analog_control = …;
static SOC_ENUM_SINGLE_DECL(adcx140_mic1m_enum,
ADCX140_CH1_CFG0, 5,
adcx140_mic_sel_text);
static const struct snd_kcontrol_new adcx140_dapm_mic1m_control = …;
static SOC_ENUM_SINGLE_DECL(adcx140_mic2p_enum,
ADCX140_CH2_CFG0, 5,
adcx140_mic_sel_text);
static const struct snd_kcontrol_new adcx140_dapm_mic2p_control = …;
static SOC_ENUM_SINGLE_DECL(adcx140_mic2_analog_enum,
ADCX140_CH2_CFG0, 7,
adcx140_analog_sel_text);
static const struct snd_kcontrol_new adcx140_dapm_mic2_analog_control = …;
static SOC_ENUM_SINGLE_DECL(adcx140_mic2m_enum,
ADCX140_CH2_CFG0, 5,
adcx140_mic_sel_text);
static const struct snd_kcontrol_new adcx140_dapm_mic2m_control = …;
static SOC_ENUM_SINGLE_DECL(adcx140_mic3p_enum,
ADCX140_CH3_CFG0, 5,
adcx140_mic_sel_text);
static const struct snd_kcontrol_new adcx140_dapm_mic3p_control = …;
static SOC_ENUM_SINGLE_DECL(adcx140_mic3_analog_enum,
ADCX140_CH3_CFG0, 7,
adcx140_analog_sel_text);
static const struct snd_kcontrol_new adcx140_dapm_mic3_analog_control = …;
static SOC_ENUM_SINGLE_DECL(adcx140_mic3m_enum,
ADCX140_CH3_CFG0, 5,
adcx140_mic_sel_text);
static const struct snd_kcontrol_new adcx140_dapm_mic3m_control = …;
static SOC_ENUM_SINGLE_DECL(adcx140_mic4p_enum,
ADCX140_CH4_CFG0, 5,
adcx140_mic_sel_text);
static const struct snd_kcontrol_new adcx140_dapm_mic4p_control = …;
static SOC_ENUM_SINGLE_DECL(adcx140_mic4_analog_enum,
ADCX140_CH4_CFG0, 7,
adcx140_analog_sel_text);
static const struct snd_kcontrol_new adcx140_dapm_mic4_analog_control = …;
static SOC_ENUM_SINGLE_DECL(adcx140_mic4m_enum,
ADCX140_CH4_CFG0, 5,
adcx140_mic_sel_text);
static const struct snd_kcontrol_new adcx140_dapm_mic4m_control = …;
static const struct snd_kcontrol_new adcx140_dapm_ch1_en_switch = …;
static const struct snd_kcontrol_new adcx140_dapm_ch2_en_switch = …;
static const struct snd_kcontrol_new adcx140_dapm_ch3_en_switch = …;
static const struct snd_kcontrol_new adcx140_dapm_ch4_en_switch = …;
static const struct snd_kcontrol_new adcx140_dapm_ch5_en_switch = …;
static const struct snd_kcontrol_new adcx140_dapm_ch6_en_switch = …;
static const struct snd_kcontrol_new adcx140_dapm_ch7_en_switch = …;
static const struct snd_kcontrol_new adcx140_dapm_ch8_en_switch = …;
static const struct snd_kcontrol_new adcx140_dapm_ch1_dre_en_switch = …;
static const struct snd_kcontrol_new adcx140_dapm_ch2_dre_en_switch = …;
static const struct snd_kcontrol_new adcx140_dapm_ch3_dre_en_switch = …;
static const struct snd_kcontrol_new adcx140_dapm_ch4_dre_en_switch = …;
static const struct snd_kcontrol_new adcx140_dapm_dre_en_switch = …;
static const struct snd_kcontrol_new adcx140_output_mixer_controls[] = …;
static const struct snd_soc_dapm_widget adcx140_dapm_widgets[] = …;
static const struct snd_soc_dapm_route adcx140_audio_map[] = …;
#define ADCX140_PHASE_CALIB_SWITCH(xname) …
static int adcx140_phase_calib_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ … }
static int adcx140_phase_calib_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *value)
{ … }
static int adcx140_phase_calib_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *value)
{ … }
static const struct snd_kcontrol_new adcx140_snd_controls[] = …;
static int adcx140_reset(struct adcx140_priv *adcx140)
{ … }
static void adcx140_pwr_ctrl(struct adcx140_priv *adcx140, bool power_state)
{ … }
static int adcx140_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int adcx140_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{ … }
static int adcx140_set_dai_tdm_slot(struct snd_soc_dai *codec_dai,
unsigned int tx_mask, unsigned int rx_mask,
int slots, int slot_width)
{ … }
static const struct snd_soc_dai_ops adcx140_dai_ops = …;
static int adcx140_configure_gpo(struct adcx140_priv *adcx140)
{ … }
static int adcx140_configure_gpio(struct adcx140_priv *adcx140)
{ … }
static int adcx140_codec_probe(struct snd_soc_component *component)
{ … }
static int adcx140_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static const struct snd_soc_component_driver soc_codec_driver_adcx140 = …;
static struct snd_soc_dai_driver adcx140_dai_driver[] = …;
#ifdef CONFIG_OF
static const struct of_device_id tlv320adcx140_of_match[] = …;
MODULE_DEVICE_TABLE(of, tlv320adcx140_of_match);
#endif
static void adcx140_disable_regulator(void *arg)
{ … }
static int adcx140_i2c_probe(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id adcx140_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, adcx140_i2c_id);
static struct i2c_driver adcx140_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;