#define pr_fmt(fmt) …
#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/of.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/gpio/consumer.h>
#include <linux/slab.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 <sound/sta350.h>
#include "sta350.h"
#define STA350_RATES …
#define STA350_FORMATS …
static const struct reg_default sta350_regs[] = …;
static const struct regmap_range sta350_write_regs_range[] = …;
static const struct regmap_range sta350_read_regs_range[] = …;
static const struct regmap_range sta350_volatile_regs_range[] = …;
static const struct regmap_access_table sta350_write_regs = …;
static const struct regmap_access_table sta350_read_regs = …;
static const struct regmap_access_table sta350_volatile_regs = …;
static const char * const sta350_supply_names[] = …;
struct sta350_priv { … };
static const DECLARE_TLV_DB_SCALE(mvol_tlv, -12750, 50, 1);
static const DECLARE_TLV_DB_SCALE(chvol_tlv, -7950, 50, 1);
static const DECLARE_TLV_DB_SCALE(tone_tlv, -1200, 200, 0);
static const char * const sta350_drc_ac[] = …;
static const char * const sta350_auto_gc_mode[] = …;
static const char * const sta350_auto_xo_mode[] = …;
static const char * const sta350_binary_output[] = …;
static const char * const sta350_limiter_select[] = …;
static const char * const sta350_limiter_attack_rate[] = …;
static const char * const sta350_limiter_release_rate[] = …;
static const char * const sta350_noise_shaper_type[] = …;
static DECLARE_TLV_DB_RANGE(sta350_limiter_ac_attack_tlv,
0, 7, TLV_DB_SCALE_ITEM(-1200, 200, 0),
8, 16, TLV_DB_SCALE_ITEM(300, 100, 0),
);
static DECLARE_TLV_DB_RANGE(sta350_limiter_ac_release_tlv,
0, 0, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 0),
1, 1, TLV_DB_SCALE_ITEM(-2900, 0, 0),
2, 2, TLV_DB_SCALE_ITEM(-2000, 0, 0),
3, 8, TLV_DB_SCALE_ITEM(-1400, 200, 0),
8, 16, TLV_DB_SCALE_ITEM(-700, 100, 0),
);
static DECLARE_TLV_DB_RANGE(sta350_limiter_drc_attack_tlv,
0, 7, TLV_DB_SCALE_ITEM(-3100, 200, 0),
8, 13, TLV_DB_SCALE_ITEM(-1600, 100, 0),
14, 16, TLV_DB_SCALE_ITEM(-1000, 300, 0),
);
static DECLARE_TLV_DB_RANGE(sta350_limiter_drc_release_tlv,
0, 0, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 0),
1, 2, TLV_DB_SCALE_ITEM(-3800, 200, 0),
3, 4, TLV_DB_SCALE_ITEM(-3300, 200, 0),
5, 12, TLV_DB_SCALE_ITEM(-3000, 200, 0),
13, 16, TLV_DB_SCALE_ITEM(-1500, 300, 0),
);
static SOC_ENUM_SINGLE_DECL(sta350_drc_ac_enum,
STA350_CONFD, STA350_CONFD_DRC_SHIFT,
sta350_drc_ac);
static SOC_ENUM_SINGLE_DECL(sta350_noise_shaper_enum,
STA350_CONFE, STA350_CONFE_NSBW_SHIFT,
sta350_noise_shaper_type);
static SOC_ENUM_SINGLE_DECL(sta350_auto_gc_enum,
STA350_AUTO1, STA350_AUTO1_AMGC_SHIFT,
sta350_auto_gc_mode);
static SOC_ENUM_SINGLE_DECL(sta350_auto_xo_enum,
STA350_AUTO2, STA350_AUTO2_XO_SHIFT,
sta350_auto_xo_mode);
static SOC_ENUM_SINGLE_DECL(sta350_binary_output_ch1_enum,
STA350_C1CFG, STA350_CxCFG_BO_SHIFT,
sta350_binary_output);
static SOC_ENUM_SINGLE_DECL(sta350_binary_output_ch2_enum,
STA350_C2CFG, STA350_CxCFG_BO_SHIFT,
sta350_binary_output);
static SOC_ENUM_SINGLE_DECL(sta350_binary_output_ch3_enum,
STA350_C3CFG, STA350_CxCFG_BO_SHIFT,
sta350_binary_output);
static SOC_ENUM_SINGLE_DECL(sta350_limiter_ch1_enum,
STA350_C1CFG, STA350_CxCFG_LS_SHIFT,
sta350_limiter_select);
static SOC_ENUM_SINGLE_DECL(sta350_limiter_ch2_enum,
STA350_C2CFG, STA350_CxCFG_LS_SHIFT,
sta350_limiter_select);
static SOC_ENUM_SINGLE_DECL(sta350_limiter_ch3_enum,
STA350_C3CFG, STA350_CxCFG_LS_SHIFT,
sta350_limiter_select);
static SOC_ENUM_SINGLE_DECL(sta350_limiter1_attack_rate_enum,
STA350_L1AR, STA350_LxA_SHIFT,
sta350_limiter_attack_rate);
static SOC_ENUM_SINGLE_DECL(sta350_limiter2_attack_rate_enum,
STA350_L2AR, STA350_LxA_SHIFT,
sta350_limiter_attack_rate);
static SOC_ENUM_SINGLE_DECL(sta350_limiter1_release_rate_enum,
STA350_L1AR, STA350_LxR_SHIFT,
sta350_limiter_release_rate);
static SOC_ENUM_SINGLE_DECL(sta350_limiter2_release_rate_enum,
STA350_L2AR, STA350_LxR_SHIFT,
sta350_limiter_release_rate);
static int sta350_coefficient_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ … }
static int sta350_coefficient_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int sta350_coefficient_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int sta350_sync_coef_shadow(struct snd_soc_component *component)
{ … }
static int sta350_cache_sync(struct snd_soc_component *component)
{ … }
#define SINGLE_COEF(xname, index) …
#define BIQUAD_COEFS(xname, index) …
static const struct snd_kcontrol_new sta350_snd_controls[] = …;
static const struct snd_soc_dapm_widget sta350_dapm_widgets[] = …;
static const struct snd_soc_dapm_route sta350_dapm_routes[] = …;
static struct { … } interpolation_ratios[] = …;
static int mcs_ratio_table[3][6] = …;
static int sta350_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int sta350_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{ … }
static int sta350_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int sta350_startup_sequence(struct sta350_priv *sta350)
{ … }
static int sta350_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static const struct snd_soc_dai_ops sta350_dai_ops = …;
static struct snd_soc_dai_driver sta350_dai = …;
static int sta350_probe(struct snd_soc_component *component)
{ … }
static void sta350_remove(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver sta350_component = …;
static const struct regmap_config sta350_regmap = …;
#ifdef CONFIG_OF
static const struct of_device_id st350_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, st350_dt_ids);
static const char * const sta350_ffx_modes[] = …;
static int sta350_probe_dt(struct device *dev, struct sta350_priv *sta350)
{ … }
#endif
static int sta350_i2c_probe(struct i2c_client *i2c)
{ … }
static void sta350_i2c_remove(struct i2c_client *client)
{ … }
static const struct i2c_device_id sta350_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, sta350_i2c_id);
static struct i2c_driver sta350_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;