#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/input.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/platform_device.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/cs42l52.h>
#include "cs42l52.h"
struct sp_config { … };
struct cs42l52_private { … };
static const struct reg_default cs42l52_reg_defaults[] = …;
static bool cs42l52_readable_register(struct device *dev, unsigned int reg)
{ … }
static bool cs42l52_volatile_register(struct device *dev, unsigned int reg)
{ … }
static DECLARE_TLV_DB_SCALE(hl_tlv, -10200, 50, 0);
static DECLARE_TLV_DB_SCALE(hpd_tlv, -9600, 50, 1);
static DECLARE_TLV_DB_SCALE(ipd_tlv, -9600, 100, 0);
static DECLARE_TLV_DB_SCALE(mic_tlv, 1600, 100, 0);
static DECLARE_TLV_DB_SCALE(pga_tlv, -600, 50, 0);
static DECLARE_TLV_DB_SCALE(pass_tlv, -6000, 50, 0);
static DECLARE_TLV_DB_SCALE(mix_tlv, -5150, 50, 0);
static DECLARE_TLV_DB_SCALE(beep_tlv, -56, 200, 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 char * const cs42l52_adca_text[] = …;
static const char * const cs42l52_adcb_text[] = …;
static SOC_ENUM_SINGLE_DECL(adca_enum,
CS42L52_ADC_PGA_A, 5, cs42l52_adca_text);
static SOC_ENUM_SINGLE_DECL(adcb_enum,
CS42L52_ADC_PGA_B, 5, cs42l52_adcb_text);
static const struct snd_kcontrol_new adca_mux = …;
static const struct snd_kcontrol_new adcb_mux = …;
static const char * const mic_bias_level_text[] = …;
static SOC_ENUM_SINGLE_DECL(mic_bias_level_enum,
CS42L52_IFACE_CTL2, 0, mic_bias_level_text);
static const char * const cs42l52_mic_text[] = …;
static SOC_ENUM_SINGLE_DECL(mica_enum,
CS42L52_MICA_CTL, 5, cs42l52_mic_text);
static SOC_ENUM_SINGLE_DECL(micb_enum,
CS42L52_MICB_CTL, 5, cs42l52_mic_text);
static const char * const digital_output_mux_text[] = …;
static SOC_ENUM_SINGLE_DECL(digital_output_mux_enum,
CS42L52_ADC_MISC_CTL, 6,
digital_output_mux_text);
static const struct snd_kcontrol_new digital_output_mux = …;
static const char * const hp_gain_num_text[] = …;
static SOC_ENUM_SINGLE_DECL(hp_gain_enum,
CS42L52_PB_CTL1, 5,
hp_gain_num_text);
static const char * const beep_pitch_text[] = …;
static SOC_ENUM_SINGLE_DECL(beep_pitch_enum,
CS42L52_BEEP_FREQ, 4,
beep_pitch_text);
static const char * const beep_ontime_text[] = …;
static SOC_ENUM_SINGLE_DECL(beep_ontime_enum,
CS42L52_BEEP_FREQ, 0,
beep_ontime_text);
static const char * const beep_offtime_text[] = …;
static SOC_ENUM_SINGLE_DECL(beep_offtime_enum,
CS42L52_BEEP_VOL, 5,
beep_offtime_text);
static const char * const beep_config_text[] = …;
static SOC_ENUM_SINGLE_DECL(beep_config_enum,
CS42L52_BEEP_TONE_CTL, 6,
beep_config_text);
static const char * const beep_bass_text[] = …;
static SOC_ENUM_SINGLE_DECL(beep_bass_enum,
CS42L52_BEEP_TONE_CTL, 1,
beep_bass_text);
static const char * const beep_treble_text[] = …;
static SOC_ENUM_SINGLE_DECL(beep_treble_enum,
CS42L52_BEEP_TONE_CTL, 3,
beep_treble_text);
static const char * const ng_threshold_text[] = …;
static SOC_ENUM_SINGLE_DECL(ng_threshold_enum,
CS42L52_NOISE_GATE_CTL, 2,
ng_threshold_text);
static const char * const cs42l52_ng_delay_text[] = …;
static SOC_ENUM_SINGLE_DECL(ng_delay_enum,
CS42L52_NOISE_GATE_CTL, 0,
cs42l52_ng_delay_text);
static const char * const cs42l52_ng_type_text[] = …;
static SOC_ENUM_SINGLE_DECL(ng_type_enum,
CS42L52_NOISE_GATE_CTL, 6,
cs42l52_ng_type_text);
static const char * const left_swap_text[] = …;
static const char * const right_swap_text[] = …;
static const unsigned int swap_values[] = …;
static const struct soc_enum adca_swap_enum = …;
static const struct snd_kcontrol_new adca_mixer = …;
static const struct soc_enum pcma_swap_enum = …;
static const struct snd_kcontrol_new pcma_mixer = …;
static const struct soc_enum adcb_swap_enum = …;
static const struct snd_kcontrol_new adcb_mixer = …;
static const struct soc_enum pcmb_swap_enum = …;
static const struct snd_kcontrol_new pcmb_mixer = …;
static const struct snd_kcontrol_new passthrul_ctl = …;
static const struct snd_kcontrol_new passthrur_ctl = …;
static const struct snd_kcontrol_new spkl_ctl = …;
static const struct snd_kcontrol_new spkr_ctl = …;
static const struct snd_kcontrol_new hpl_ctl = …;
static const struct snd_kcontrol_new hpr_ctl = …;
static const struct snd_kcontrol_new cs42l52_snd_controls[] = …;
static const struct snd_kcontrol_new cs42l52_mica_controls[] = …;
static const struct snd_kcontrol_new cs42l52_micb_controls[] = …;
static int cs42l52_add_mic_controls(struct snd_soc_component *component)
{ … }
static const struct snd_soc_dapm_widget cs42l52_dapm_widgets[] = …;
static const struct snd_soc_dapm_route cs42l52_audio_map[] = …;
struct cs42l52_clk_para { … };
static const struct cs42l52_clk_para clk_map_table[] = …;
static int cs42l52_get_clk(int mclk, int rate)
{ … }
static int cs42l52_set_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int cs42l52_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
{ … }
static int cs42l52_mute(struct snd_soc_dai *dai, int mute, int direction)
{ … }
static int cs42l52_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int cs42l52_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
#define CS42L52_RATES …
#define CS42L52_FORMATS …
static const struct snd_soc_dai_ops cs42l52_ops = …;
static struct snd_soc_dai_driver cs42l52_dai = …;
static int beep_rates[] = …;
static void cs42l52_beep_work(struct work_struct *work)
{ … }
static int cs42l52_beep_event(struct input_dev *dev, unsigned int type,
unsigned int code, int hz)
{ … }
static ssize_t beep_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR_WO(beep);
static void cs42l52_init_beep(struct snd_soc_component *component)
{ … }
static void cs42l52_free_beep(struct snd_soc_component *component)
{ … }
static int cs42l52_probe(struct snd_soc_component *component)
{ … }
static void cs42l52_remove(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_component_dev_cs42l52 = …;
static const struct reg_sequence cs42l52_threshold_patch[] = …;
static const struct regmap_config cs42l52_regmap = …;
static int cs42l52_i2c_probe(struct i2c_client *i2c_client)
{ … }
static const struct of_device_id cs42l52_of_match[] = …;
MODULE_DEVICE_TABLE(of, cs42l52_of_match);
static const struct i2c_device_id cs42l52_id[] = …;
MODULE_DEVICE_TABLE(i2c, cs42l52_id);
static struct i2c_driver cs42l52_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;