#include <linux/kernel.h>
#include <linux/clk.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 <sound/tlv.h>
#include <sound/pcm_params.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include "tscs454.h"
static const unsigned int PLL_44_1K_RATE = …;
#define COEFF_SIZE …
#define BIQUAD_COEFF_COUNT …
#define BIQUAD_SIZE …
#define COEFF_RAM_MAX_ADDR …
#define COEFF_RAM_COEFF_COUNT …
#define COEFF_RAM_SIZE …
enum { … };
struct pll { … };
static inline void pll_init(struct pll *pll, int id)
{ … }
struct internal_rate { … };
struct aif { … };
static inline void aif_init(struct aif *aif, unsigned int id)
{ … }
struct coeff_ram { … };
static inline void init_coeff_ram_cache(u8 *cache)
{ … }
static inline void coeff_ram_init(struct coeff_ram *ram)
{ … }
struct aifs_status { … };
static inline void set_aif_status_active(struct aifs_status *status,
int aif_id, bool playback)
{ … }
static inline void set_aif_status_inactive(struct aifs_status *status,
int aif_id, bool playback)
{ … }
static bool aifs_active(struct aifs_status *status)
{ … }
static bool aif_active(struct aifs_status *status, int aif_id)
{ … }
struct tscs454 { … };
struct coeff_ram_ctl { … };
static const struct reg_sequence tscs454_patch[] = …;
static bool tscs454_volatile(struct device *dev, unsigned int reg)
{ … }
static bool tscs454_writable(struct device *dev, unsigned int reg)
{ … }
static bool tscs454_readable(struct device *dev, unsigned int reg)
{ … }
static bool tscs454_precious(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_range_cfg tscs454_regmap_range_cfg = …;
static struct regmap_config const tscs454_regmap_cfg = …;
static inline int tscs454_data_init(struct tscs454 *tscs454,
struct i2c_client *i2c)
{ … }
struct reg_setting { … };
static int coeff_ram_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
#define DACCRSTAT_MAX_TRYS …
static int write_coeff_ram(struct snd_soc_component *component, u8 *coeff_ram,
unsigned int r_stat, unsigned int r_addr, unsigned int r_wr,
unsigned int coeff_addr, unsigned int coeff_cnt)
{ … }
static int coeff_ram_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static inline int coeff_ram_sync(struct snd_soc_component *component,
struct tscs454 *tscs454)
{ … }
#define PLL_REG_SETTINGS_COUNT …
struct pll_ctl { … };
#define PLL_CTL(f, t, c1, r1, o1, f1l, f1h, c2, r2, o2, f2l, f2h) …
static const struct pll_ctl pll_ctls[] = …;
static inline const struct pll_ctl *get_pll_ctl(unsigned long freq_in)
{ … }
enum { … };
static int set_sysclk(struct snd_soc_component *component)
{ … }
static inline void reserve_pll(struct pll *pll)
{ … }
static inline void free_pll(struct pll *pll)
{ … }
static int pll_connected(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
static int pll_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static inline int aif_set_provider(struct snd_soc_component *component,
unsigned int aif_id, bool provider)
{ … }
static inline
int aif_prepare(struct snd_soc_component *component, struct aif *aif)
{ … }
static inline int aif_free(struct snd_soc_component *component,
struct aif *aif, bool playback)
{ … }
static char const * const bclk_sel_txt[] = …;
static struct soc_enum const bclk_sel_enum = …;
static char const * const isrc_br_txt[] = …;
static struct soc_enum const isrc_br_enum = …;
static char const * const isrc_bm_txt[] = …;
static struct soc_enum const isrc_bm_enum = …;
static char const * const modular_rate_txt[] = …;
static struct soc_enum const adc_modular_rate_enum = …;
static struct soc_enum const dac_modular_rate_enum = …;
static char const * const data_ctrl_txt[] = …;
static struct soc_enum const data_in_ctrl_enums[] = …;
static struct soc_enum const data_out_ctrl_enums[] = …;
static char const * const asrc_mux_txt[] = …;
static struct soc_enum const asrc_in_mux_enum = …;
static char const * const dai_mux_txt[] = …;
static struct soc_enum const dai2_mux_enum = …;
static struct snd_kcontrol_new const dai2_mux_dapm_enum = …;
static struct soc_enum const dai1_mux_enum = …;
static struct snd_kcontrol_new const dai1_mux_dapm_enum = …;
static struct soc_enum const asrc_out_mux_enum = …;
static struct soc_enum const dac_mux_enum = …;
static struct snd_kcontrol_new const dac_mux_dapm_enum = …;
static struct soc_enum const dai3_mux_enum = …;
static struct snd_kcontrol_new const dai3_mux_dapm_enum = …;
static char const * const sub_mux_txt[] = …;
static struct soc_enum const sub_mux_enum = …;
static struct snd_kcontrol_new const sub_mux_dapm_enum = …;
static struct soc_enum const classd_mux_enum = …;
static struct snd_kcontrol_new const classd_mux_dapm_enum = …;
static char const * const jack_type_txt[] = …;
static struct soc_enum const hp_jack_type_enum = …;
static char const * const hs_det_pol_txt[] = …;
static struct soc_enum const hs_det_pol_enum = …;
static char const * const hs_mic_bias_force_txt[] = …;
static struct soc_enum const hs_mic_bias_force_enum = …;
static char const * const plug_type_txt[] = …;
static struct soc_enum const plug_type_force_enum = …;
static char const * const in_bst_mux_txt[] = …;
static struct soc_enum const in_bst_mux_ch0_enum = …;
static struct snd_kcontrol_new const in_bst_mux_ch0_dapm_enum = …;
static DECLARE_TLV_DB_SCALE(in_bst_vol_tlv_arr, 0, 1000, 0);
static char const * const adc_mux_txt[] = …;
static struct soc_enum const adc_mux_ch0_enum = …;
static struct snd_kcontrol_new const adc_mux_ch0_dapm_enum = …;
static char const * const in_proc_mux_txt[] = …;
static struct soc_enum const in_proc_ch0_enum = …;
static struct snd_kcontrol_new const in_proc_mux_ch0_dapm_enum = …;
static struct soc_enum const in_bst_mux_ch1_enum = …;
static struct snd_kcontrol_new const in_bst_mux_ch1_dapm_enum = …;
static struct soc_enum const adc_mux_ch1_enum = …;
static struct snd_kcontrol_new const adc_mux_ch1_dapm_enum = …;
static struct soc_enum const in_proc_ch1_enum = …;
static struct snd_kcontrol_new const in_proc_mux_ch1_dapm_enum = …;
static char const * const pol_txt[] = …;
static struct soc_enum const in_pol_ch1_enum = …;
static struct soc_enum const in_pol_ch0_enum = …;
static char const * const in_proc_ch_sel_txt[] = …;
static struct soc_enum const in_proc_ch01_sel_enum = …;
static struct soc_enum const in_pol_ch3_enum = …;
static struct soc_enum const in_pol_ch2_enum = …;
static struct soc_enum const in_proc_ch23_sel_enum = …;
static char const * const mic_bias_txt[] = …;
static struct soc_enum const mic_bias_2_enum = …;
static struct soc_enum const mic_bias_1_enum = …;
static DECLARE_TLV_DB_SCALE(in_pga_vol_tlv_arr, -1725, 75, 0);
static DECLARE_TLV_DB_MINMAX(in_vol_tlv_arr, -7125, 2400);
static DECLARE_TLV_DB_MINMAX(asrc_vol_tlv_arr, -9562, 600);
static char const * const alc_mode_txt[] = …;
static struct soc_enum const alc_mode_enum = …;
static char const * const alc_ref_text[] = …;
static struct soc_enum const alc_ref_enum = …;
static DECLARE_TLV_DB_SCALE(alc_max_gain_tlv_arr, -1200, 600, 0);
static DECLARE_TLV_DB_SCALE(alc_target_tlv_arr, -2850, 150, 0);
static DECLARE_TLV_DB_SCALE(alc_min_gain_tlv_arr, -1725, 600, 0);
static DECLARE_TLV_DB_SCALE(ngth_tlv_arr, -7650, 150, 0);
static char const * const ngate_type_txt[] = …;
static struct soc_enum const ngate_type_enum = …;
static char const * const dmic_mono_sel_txt[] = …;
static struct soc_enum const dmic_mono_sel_enum = …;
static struct soc_enum const dac_pol_r_enum = …;
static struct soc_enum const dac_pol_l_enum = …;
static char const * const dac_dith_txt[] = …;
static struct soc_enum const dac_dith_enum = …;
static struct soc_enum const spk_pol_r_enum = …;
static struct soc_enum const spk_pol_l_enum = …;
static struct soc_enum const sub_pol_enum = …;
static DECLARE_TLV_DB_MINMAX(mvol_tlv_arr, -9562, 0);
static DECLARE_TLV_DB_SCALE(hp_vol_tlv_arr, -8850, 75, 0);
static DECLARE_TLV_DB_SCALE(spk_vol_tlv_arr, -7725, 75, 0);
static char const * const eq_txt[] = …;
static struct soc_enum const spk_eq_enums[] = …;
static char const * const lvl_mode_txt[] = …;
static struct soc_enum const spk_mbc3_lvl_det_mode_enum = …;
static char const * const win_sel_txt[] = …;
static struct soc_enum const spk_mbc3_win_sel_enum = …;
static struct soc_enum const spk_mbc2_lvl_det_mode_enum = …;
static struct soc_enum const spk_mbc2_win_sel_enum = …;
static struct soc_enum const spk_mbc1_lvl_det_mode_enum = …;
static struct soc_enum const spk_mbc1_win_sel_enum = …;
static struct soc_enum const spk_mbc1_phase_pol_enum = …;
static DECLARE_TLV_DB_MINMAX(mbc_mug_tlv_arr, -4650, 0);
static DECLARE_TLV_DB_MINMAX(thr_tlv_arr, -9562, 0);
static char const * const comp_rat_txt[] = …;
static struct soc_enum const spk_mbc1_comp_rat_enum = …;
static struct soc_enum const spk_mbc2_phase_pol_enum = …;
static struct soc_enum const spk_mbc2_comp_rat_enum = …;
static struct soc_enum const spk_mbc3_phase_pol_enum = …;
static struct soc_enum const spk_mbc3_comp_rat_enum = …;
static struct soc_enum const spk_cle_lvl_mode_enum = …;
static struct soc_enum const spk_cle_win_sel_enum = …;
static DECLARE_TLV_DB_MINMAX(cle_mug_tlv_arr, 0, 4650);
static struct soc_enum const spk_comp_rat_enum = …;
static char const * const exp_rat_txt[] = …;
static struct soc_enum const spk_exp_rat_enum = …;
static struct soc_enum const dac_eq_enums[] = …;
static struct soc_enum const dac_mbc3_lvl_det_mode_enum = …;
static struct soc_enum const dac_mbc3_win_sel_enum = …;
static struct soc_enum const dac_mbc2_lvl_det_mode_enum = …;
static struct soc_enum const dac_mbc2_win_sel_enum = …;
static struct soc_enum const dac_mbc1_lvl_det_mode_enum = …;
static struct soc_enum const dac_mbc1_win_sel_enum = …;
static struct soc_enum const dac_mbc1_phase_pol_enum = …;
static struct soc_enum const dac_mbc1_comp_rat_enum = …;
static struct soc_enum const dac_mbc2_phase_pol_enum = …;
static struct soc_enum const dac_mbc2_comp_rat_enum = …;
static struct soc_enum const dac_mbc3_phase_pol_enum = …;
static struct soc_enum const dac_mbc3_comp_rat_enum = …;
static struct soc_enum const dac_cle_lvl_mode_enum = …;
static struct soc_enum const dac_cle_win_sel_enum = …;
static struct soc_enum const dac_comp_rat_enum = …;
static struct soc_enum const dac_exp_rat_enum = …;
static struct soc_enum const sub_eq_enums[] = …;
static struct soc_enum const sub_mbc3_lvl_det_mode_enum = …;
static struct soc_enum const sub_mbc3_win_sel_enum = …;
static struct soc_enum const sub_mbc2_lvl_det_mode_enum = …;
static struct soc_enum const sub_mbc2_win_sel_enum = …;
static struct soc_enum const sub_mbc1_lvl_det_mode_enum = …;
static struct soc_enum const sub_mbc1_win_sel_enum = …;
static struct soc_enum const sub_mbc1_phase_pol_enum = …;
static struct soc_enum const sub_mbc1_comp_rat_enum = …;
static struct soc_enum const sub_mbc2_phase_pol_enum = …;
static struct soc_enum const sub_mbc2_comp_rat_enum = …;
static struct soc_enum const sub_mbc3_phase_pol_enum = …;
static struct soc_enum const sub_mbc3_comp_rat_enum = …;
static struct soc_enum const sub_cle_lvl_mode_enum = …;
static struct soc_enum const sub_cle_win_sel_enum = …;
static struct soc_enum const sub_comp_rat_enum = …;
static struct soc_enum const sub_exp_rat_enum = …;
static int bytes_info_ext(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *ucontrol)
{ … }
static char const * const ch_0_1_mux_txt[] = …;
static struct soc_enum const ch_0_1_mux_enum = …;
static struct snd_kcontrol_new const ch_0_1_mux_dapm_enum = …;
static char const * const ch_2_3_mux_txt[] = …;
static struct soc_enum const ch_2_3_mux_enum = …;
static struct snd_kcontrol_new const ch_2_3_mux_dapm_enum = …;
static char const * const ch_4_5_mux_txt[] = …;
static struct soc_enum const ch_4_5_mux_enum = …;
static struct snd_kcontrol_new const ch_4_5_mux_dapm_enum = …;
#define COEFF_RAM_CTL(xname, xcount, xaddr) …
static struct snd_kcontrol_new const tscs454_snd_controls[] = …;
static struct snd_soc_dapm_widget const tscs454_dapm_widgets[] = …;
static struct snd_soc_dapm_route const tscs454_intercon[] = …;
static int tscs454_set_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int tscs454_set_bclk_ratio(struct snd_soc_dai *dai,
unsigned int ratio)
{ … }
static inline int set_aif_provider_from_fmt(struct snd_soc_component *component,
struct aif *aif, unsigned int fmt)
{ … }
static inline int set_aif_tdm_delay(struct snd_soc_component *component,
unsigned int dai_id, bool delay)
{ … }
static inline int set_aif_format_from_fmt(struct snd_soc_component *component,
unsigned int dai_id, unsigned int fmt)
{ … }
static inline int
set_aif_clock_format_from_fmt(struct snd_soc_component *component,
unsigned int dai_id, unsigned int fmt)
{ … }
static int tscs454_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
static int tscs454_dai1_set_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask, int slots,
int slot_width)
{ … }
static int tscs454_dai23_set_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask, int slots,
int slot_width)
{ … }
static int set_aif_fs(struct snd_soc_component *component,
unsigned int id,
unsigned int rate)
{ … }
static int set_aif_sample_format(struct snd_soc_component *component,
snd_pcm_format_t format,
int aif_id)
{ … }
static int tscs454_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int tscs454_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static int tscs454_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static struct snd_soc_dai_ops const tscs454_dai1_ops = …;
static struct snd_soc_dai_ops const tscs454_dai23_ops = …;
static int tscs454_probe(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_component_dev_tscs454 = …;
#define TSCS454_RATES …
#define TSCS454_FORMATS …
static struct snd_soc_dai_driver tscs454_dais[] = …;
static char const * const src_names[] = …;
static int tscs454_i2c_probe(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id tscs454_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, tscs454_i2c_id);
static const struct of_device_id tscs454_of_match[] = …;
MODULE_DEVICE_TABLE(of, tscs454_of_match);
static struct i2c_driver tscs454_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;