#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/of_gpio.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/regmap.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/cs42l73.h>
#include "cs42l73.h"
#include "cirrus_legacy.h"
struct sp_config { … };
struct cs42l73_private { … };
static const struct reg_default cs42l73_reg_defaults[] = …;
static bool cs42l73_volatile_register(struct device *dev, unsigned int reg)
{ … }
static bool cs42l73_readable_register(struct device *dev, unsigned int reg)
{ … }
static const DECLARE_TLV_DB_RANGE(hpaloa_tlv,
0, 13, TLV_DB_SCALE_ITEM(-7600, 200, 0),
14, 75, TLV_DB_SCALE_ITEM(-4900, 100, 0)
);
static DECLARE_TLV_DB_SCALE(adc_boost_tlv, 0, 2500, 0);
static DECLARE_TLV_DB_SCALE(hl_tlv, -10200, 50, 0);
static DECLARE_TLV_DB_SCALE(ipd_tlv, -9600, 100, 0);
static DECLARE_TLV_DB_SCALE(micpga_tlv, -600, 50, 0);
static const DECLARE_TLV_DB_RANGE(limiter_tlv,
0, 2, TLV_DB_SCALE_ITEM(-3000, 600, 0),
3, 7, TLV_DB_SCALE_ITEM(-1200, 300, 0)
);
static const DECLARE_TLV_DB_SCALE(attn_tlv, -6300, 100, 1);
static const char * const cs42l73_pgaa_text[] = …;
static const char * const cs42l73_pgab_text[] = …;
static SOC_ENUM_SINGLE_DECL(pgaa_enum,
CS42L73_ADCIPC, 3,
cs42l73_pgaa_text);
static SOC_ENUM_SINGLE_DECL(pgab_enum,
CS42L73_ADCIPC, 7,
cs42l73_pgab_text);
static const struct snd_kcontrol_new pgaa_mux = …;
static const struct snd_kcontrol_new pgab_mux = …;
static const struct snd_kcontrol_new input_left_mixer[] = …;
static const struct snd_kcontrol_new input_right_mixer[] = …;
static const char * const cs42l73_ng_delay_text[] = …;
static SOC_ENUM_SINGLE_DECL(ng_delay_enum,
CS42L73_NGCAB, 0,
cs42l73_ng_delay_text);
static const char * const cs42l73_mono_mix_texts[] = …;
static const unsigned int cs42l73_mono_mix_values[] = …;
static const struct soc_enum spk_asp_enum = …;
static const struct snd_kcontrol_new spk_asp_mixer = …;
static const struct soc_enum spk_xsp_enum = …;
static const struct snd_kcontrol_new spk_xsp_mixer = …;
static const struct soc_enum esl_asp_enum = …;
static const struct snd_kcontrol_new esl_asp_mixer = …;
static const struct soc_enum esl_xsp_enum = …;
static const struct snd_kcontrol_new esl_xsp_mixer = …;
static const char * const cs42l73_ip_swap_text[] = …;
static SOC_ENUM_SINGLE_DECL(ip_swap_enum,
CS42L73_MIOPC, 6,
cs42l73_ip_swap_text);
static const char * const cs42l73_spo_mixer_text[] = …;
static SOC_ENUM_SINGLE_DECL(vsp_output_mux_enum,
CS42L73_MIXERCTL, 5,
cs42l73_spo_mixer_text);
static SOC_ENUM_SINGLE_DECL(xsp_output_mux_enum,
CS42L73_MIXERCTL, 4,
cs42l73_spo_mixer_text);
static const struct snd_kcontrol_new hp_amp_ctl = …;
static const struct snd_kcontrol_new lo_amp_ctl = …;
static const struct snd_kcontrol_new spk_amp_ctl = …;
static const struct snd_kcontrol_new spklo_amp_ctl = …;
static const struct snd_kcontrol_new ear_amp_ctl = …;
static const struct snd_kcontrol_new cs42l73_snd_controls[] = …;
static int cs42l73_spklo_spk_amp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int cs42l73_ear_amp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int cs42l73_hp_amp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = …;
static const struct snd_soc_dapm_route cs42l73_audio_map[] = …;
struct cs42l73_mclk_div { … };
static const struct cs42l73_mclk_div cs42l73_mclk_coeffs[] = …;
struct cs42l73_mclkx_div { … };
static const struct cs42l73_mclkx_div cs42l73_mclkx_coeffs[] = …;
static int cs42l73_get_mclkx_coeff(int mclkx)
{ … }
static int cs42l73_get_mclk_coeff(int mclk, int srate)
{ … }
static int cs42l73_set_mclk(struct snd_soc_dai *dai, unsigned int freq)
{ … }
static int cs42l73_set_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
{ … }
static const unsigned int cs42l73_asrc_rates[] = …;
static unsigned int cs42l73_get_xspfs_coeff(u32 rate)
{ … }
static void cs42l73_update_asrc(struct snd_soc_component *component, int id, int srate)
{ … }
static int cs42l73_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int cs42l73_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static int cs42l73_set_tristate(struct snd_soc_dai *dai, int tristate)
{ … }
static const struct snd_pcm_hw_constraint_list constraints_12_24 = …;
static int cs42l73_pcm_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
#define CS42L73_FORMATS …
static const struct snd_soc_dai_ops cs42l73_ops = …;
static struct snd_soc_dai_driver cs42l73_dai[] = …;
static int cs42l73_probe(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_component_dev_cs42l73 = …;
static const struct regmap_config cs42l73_regmap = …;
static int cs42l73_i2c_probe(struct i2c_client *i2c_client)
{ … }
static const struct of_device_id cs42l73_of_match[] = …;
MODULE_DEVICE_TABLE(of, cs42l73_of_match);
static const struct i2c_device_id cs42l73_id[] = …;
MODULE_DEVICE_TABLE(i2c, cs42l73_id);
static struct i2c_driver cs42l73_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;