#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/regmap.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/string.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/clk.h>
#include <sound/tlv.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include "tscs42xx.h"
#define COEFF_SIZE …
#define BIQUAD_COEFF_COUNT …
#define BIQUAD_SIZE …
#define COEFF_RAM_MAX_ADDR …
#define COEFF_RAM_COEFF_COUNT …
#define COEFF_RAM_SIZE …
struct tscs42xx { … };
struct coeff_ram_ctl { … };
static bool tscs42xx_volatile(struct device *dev, unsigned int reg)
{ … }
static bool tscs42xx_precious(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config tscs42xx_regmap = …;
#define MAX_PLL_LOCK_20MS_WAITS …
static bool plls_locked(struct snd_soc_component *component)
{ … }
static int sample_rate_to_pll_freq_out(int sample_rate)
{ … }
#define DACCRSTAT_MAX_TRYS …
static int write_coeff_ram(struct snd_soc_component *component, u8 *coeff_ram,
unsigned int addr, unsigned int coeff_cnt)
{ … }
static int power_up_audio_plls(struct snd_soc_component *component)
{ … }
static int power_down_audio_plls(struct snd_soc_component *component)
{ … }
static int coeff_ram_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int coeff_ram_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static char const * const input_select_text[] = …;
static const struct soc_enum left_input_select_enum = …;
static const struct snd_kcontrol_new left_input_select = …;
static const struct soc_enum right_input_select_enum = …;
static const struct snd_kcontrol_new right_input_select = …;
static char const * const ch_map_select_text[] = …;
static const struct soc_enum ch_map_select_enum = …;
static int dapm_vref_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int dapm_micb_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int pll_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int dac_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const struct snd_soc_dapm_widget tscs42xx_dapm_widgets[] = …;
static const struct snd_soc_dapm_route tscs42xx_intercon[] = …;
static char const * const eq_band_enable_text[] = …;
static char const * const level_detection_text[] = …;
static char const * const level_detection_window_text[] = …;
static char const * const compressor_ratio_text[] = …;
static DECLARE_TLV_DB_SCALE(hpvol_scale, -8850, 75, 0);
static DECLARE_TLV_DB_SCALE(spkvol_scale, -7725, 75, 0);
static DECLARE_TLV_DB_SCALE(dacvol_scale, -9563, 38, 0);
static DECLARE_TLV_DB_SCALE(adcvol_scale, -7125, 38, 0);
static DECLARE_TLV_DB_SCALE(invol_scale, -1725, 75, 0);
static DECLARE_TLV_DB_SCALE(mic_boost_scale, 0, 1000, 0);
static DECLARE_TLV_DB_MINMAX(mugain_scale, 0, 4650);
static DECLARE_TLV_DB_MINMAX(compth_scale, -9562, 0);
static const struct soc_enum eq1_band_enable_enum = …;
static const struct soc_enum eq2_band_enable_enum = …;
static const struct soc_enum cle_level_detection_enum = …;
static const struct soc_enum cle_level_detection_window_enum = …;
static const struct soc_enum mbc_level_detection_enums[] = …;
static const struct soc_enum mbc_level_detection_window_enums[] = …;
static const struct soc_enum compressor_ratio_enum = …;
static const struct soc_enum dac_mbc1_compressor_ratio_enum = …;
static const struct soc_enum dac_mbc2_compressor_ratio_enum = …;
static const struct soc_enum dac_mbc3_compressor_ratio_enum = …;
static int bytes_info_ext(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *ucontrol)
{ … }
#define COEFF_RAM_CTL(xname, xcount, xaddr) …
static const struct snd_kcontrol_new tscs42xx_snd_controls[] = …;
static int setup_sample_format(struct snd_soc_component *component,
snd_pcm_format_t format)
{ … }
static int setup_sample_rate(struct snd_soc_component *component,
unsigned int rate)
{ … }
struct reg_setting { … };
#define PLL_REG_SETTINGS_COUNT …
struct pll_ctl { … };
#define PLL_CTL(f, rt, rd, r1b_l, r9, ra, rb, \
rc, r12, r1b_h, re, rf, r10, r11) …
static const struct pll_ctl pll_ctls[] = …;
static const struct pll_ctl *get_pll_ctl(int input_freq)
{ … }
static int set_pll_ctl_from_input_freq(struct snd_soc_component *component,
const int input_freq)
{ … }
static int tscs42xx_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *codec_dai)
{ … }
static inline int dac_mute(struct snd_soc_component *component)
{ … }
static inline int dac_unmute(struct snd_soc_component *component)
{ … }
static inline int adc_mute(struct snd_soc_component *component)
{ … }
static inline int adc_unmute(struct snd_soc_component *component)
{ … }
static int tscs42xx_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
{ … }
static int tscs42xx_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{ … }
static int tscs42xx_set_dai_bclk_ratio(struct snd_soc_dai *codec_dai,
unsigned int ratio)
{ … }
static const struct snd_soc_dai_ops tscs42xx_dai_ops = …;
static int part_is_valid(struct tscs42xx *tscs42xx)
{ … }
static int set_sysclk(struct snd_soc_component *component)
{ … }
static int tscs42xx_probe(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_codec_dev_tscs42xx = …;
static inline void init_coeff_ram_cache(struct tscs42xx *tscs42xx)
{ … }
#define TSCS42XX_RATES …
#define TSCS42XX_FORMATS …
static struct snd_soc_dai_driver tscs42xx_dai = …;
static const struct reg_sequence tscs42xx_patch[] = …;
static char const * const src_names[TSCS42XX_PLL_SRC_CNT] = …;
static int tscs42xx_i2c_probe(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id tscs42xx_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, tscs42xx_i2c_id);
static const struct of_device_id tscs42xx_of_match[] = …;
MODULE_DEVICE_TABLE(of, tscs42xx_of_match);
static struct i2c_driver tscs42xx_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;