#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/gcd.h>
#include <linux/gpio/driver.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/jack.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <sound/wm8962.h>
#include <trace/events/asoc.h>
#include "wm8962.h"
#define WM8962_NUM_SUPPLIES …
static const char *wm8962_supply_names[WM8962_NUM_SUPPLIES] = …;
struct wm8962_priv { … };
#define WM8962_REGULATOR_EVENT(n) …
WM8962_REGULATOR_EVENT(…)
WM8962_REGULATOR_EVENT(…)
WM8962_REGULATOR_EVENT(…)
WM8962_REGULATOR_EVENT(…)
WM8962_REGULATOR_EVENT(…)
WM8962_REGULATOR_EVENT(…)
WM8962_REGULATOR_EVENT(…)
WM8962_REGULATOR_EVENT(…)
static const struct reg_default wm8962_reg[] = …;
static bool wm8962_volatile_register(struct device *dev, unsigned int reg)
{ … }
static bool wm8962_readable_register(struct device *dev, unsigned int reg)
{ … }
static int wm8962_reset(struct wm8962_priv *wm8962)
{ … }
static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0);
static const DECLARE_TLV_DB_SCALE(mixin_tlv, -1500, 300, 0);
static const DECLARE_TLV_DB_RANGE(mixinpga_tlv,
0, 1, TLV_DB_SCALE_ITEM(0, 600, 0),
2, 2, TLV_DB_SCALE_ITEM(1300, 1300, 0),
3, 4, TLV_DB_SCALE_ITEM(1800, 200, 0),
5, 5, TLV_DB_SCALE_ITEM(2400, 0, 0),
6, 7, TLV_DB_SCALE_ITEM(2700, 300, 0)
);
static const DECLARE_TLV_DB_SCALE(beep_tlv, -9600, 600, 1);
static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1);
static const DECLARE_TLV_DB_SCALE(st_tlv, -3600, 300, 0);
static const DECLARE_TLV_DB_SCALE(inmix_tlv, -600, 600, 0);
static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0);
static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
static const DECLARE_TLV_DB_SCALE(hp_tlv, -700, 100, 0);
static const DECLARE_TLV_DB_RANGE(classd_tlv,
0, 6, TLV_DB_SCALE_ITEM(0, 150, 0),
7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0)
);
static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
static int wm8962_dsp2_write_config(struct snd_soc_component *component)
{ … }
static int wm8962_dsp2_set_enable(struct snd_soc_component *component, u16 val)
{ … }
static int wm8962_dsp2_start(struct snd_soc_component *component)
{ … }
static int wm8962_dsp2_stop(struct snd_soc_component *component)
{ … }
#define WM8962_DSP2_ENABLE(xname, xshift) …
static int wm8962_dsp2_ena_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ … }
static int wm8962_dsp2_ena_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int wm8962_dsp2_ena_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int wm8962_put_hp_sw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int wm8962_put_spk_sw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const char *cap_hpf_mode_text[] = …;
static SOC_ENUM_SINGLE_DECL(cap_hpf_mode,
WM8962_ADC_DAC_CONTROL_2, 10, cap_hpf_mode_text);
static const char *cap_lhpf_mode_text[] = …;
static SOC_ENUM_SINGLE_DECL(cap_lhpf_mode,
WM8962_LHPF1, 1, cap_lhpf_mode_text);
static const struct snd_kcontrol_new wm8962_snd_controls[] = …;
static const struct snd_kcontrol_new wm8962_spk_mono_controls[] = …;
static const struct snd_kcontrol_new wm8962_spk_stereo_controls[] = …;
static int tp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int cp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int hp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int out_pga_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int dsp2_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const char *st_text[] = …;
static SOC_ENUM_SINGLE_DECL(str_enum,
WM8962_DAC_DSP_MIXING_1, 2, st_text);
static const struct snd_kcontrol_new str_mux = …;
static SOC_ENUM_SINGLE_DECL(stl_enum,
WM8962_DAC_DSP_MIXING_2, 2, st_text);
static const struct snd_kcontrol_new stl_mux = …;
static const char *outmux_text[] = …;
static SOC_ENUM_SINGLE_DECL(spkoutr_enum,
WM8962_SPEAKER_MIXER_2, 7, outmux_text);
static const struct snd_kcontrol_new spkoutr_mux = …;
static SOC_ENUM_SINGLE_DECL(spkoutl_enum,
WM8962_SPEAKER_MIXER_1, 7, outmux_text);
static const struct snd_kcontrol_new spkoutl_mux = …;
static SOC_ENUM_SINGLE_DECL(hpoutr_enum,
WM8962_HEADPHONE_MIXER_2, 7, outmux_text);
static const struct snd_kcontrol_new hpoutr_mux = …;
static SOC_ENUM_SINGLE_DECL(hpoutl_enum,
WM8962_HEADPHONE_MIXER_1, 7, outmux_text);
static const struct snd_kcontrol_new hpoutl_mux = …;
static const char * const input_mode_text[] = …;
static SOC_ENUM_SINGLE_VIRT_DECL(input_mode_enum, input_mode_text);
static const struct snd_kcontrol_new input_mode_mux = …;
static const struct snd_kcontrol_new inpgal[] = …;
static const struct snd_kcontrol_new inpgar[] = …;
static const struct snd_kcontrol_new mixinl[] = …;
static const struct snd_kcontrol_new mixinr[] = …;
static const struct snd_kcontrol_new hpmixl[] = …;
static const struct snd_kcontrol_new hpmixr[] = …;
static const struct snd_kcontrol_new spkmixl[] = …;
static const struct snd_kcontrol_new spkmixr[] = …;
static const struct snd_soc_dapm_widget wm8962_dapm_widgets[] = …;
static const struct snd_soc_dapm_widget wm8962_dapm_spk_mono_widgets[] = …;
static const struct snd_soc_dapm_widget wm8962_dapm_spk_stereo_widgets[] = …;
static const struct snd_soc_dapm_route wm8962_intercon[] = …;
static const struct snd_soc_dapm_route wm8962_spk_mono_intercon[] = …;
static const struct snd_soc_dapm_route wm8962_spk_stereo_intercon[] = …;
static int wm8962_add_widgets(struct snd_soc_component *component)
{ … }
static const int bclk_divs[] = …;
static const int sysclk_rates[] = …;
static void wm8962_configure_bclk(struct snd_soc_component *component)
{ … }
static int wm8962_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static const struct { … } sr_vals[] = …;
static int wm8962_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int wm8962_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
unsigned int freq, int dir)
{ … }
static int wm8962_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
struct _fll_div { … };
#define FIXED_FLL_SIZE …
static struct { … } fll_fratios[] = …;
static int fll_factors(struct _fll_div *fll_div, unsigned int Fref,
unsigned int Fout)
{ … }
static int wm8962_set_fll(struct snd_soc_component *component, int fll_id, int source,
unsigned int Fref, unsigned int Fout)
{ … }
static int wm8962_mute(struct snd_soc_dai *dai, int mute, int direction)
{ … }
#define WM8962_RATES …
#define WM8962_FORMATS …
static const struct snd_soc_dai_ops wm8962_dai_ops = …;
static struct snd_soc_dai_driver wm8962_dai = …;
static void wm8962_mic_work(struct work_struct *work)
{ … }
static irqreturn_t wm8962_irq(int irq, void *data)
{ … }
int wm8962_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack)
{ … }
EXPORT_SYMBOL_GPL(…);
static int beep_rates[] = …;
static void wm8962_beep_work(struct work_struct *work)
{ … }
static int wm8962_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 wm8962_init_beep(struct snd_soc_component *component)
{ … }
static void wm8962_free_beep(struct snd_soc_component *component)
{ … }
static void wm8962_set_gpio_mode(struct wm8962_priv *wm8962, int gpio)
{ … }
#ifdef CONFIG_GPIOLIB
static int wm8962_gpio_request(struct gpio_chip *chip, unsigned offset)
{ … }
static void wm8962_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{ … }
static int wm8962_gpio_direction_out(struct gpio_chip *chip,
unsigned offset, int value)
{ … }
static const struct gpio_chip wm8962_template_chip = …;
static void wm8962_init_gpio(struct snd_soc_component *component)
{ … }
static void wm8962_free_gpio(struct snd_soc_component *component)
{ … }
#else
static void wm8962_init_gpio(struct snd_soc_component *component)
{
}
static void wm8962_free_gpio(struct snd_soc_component *component)
{
}
#endif
static int wm8962_probe(struct snd_soc_component *component)
{ … }
static void wm8962_remove(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_component_dev_wm8962 = …;
static const struct reg_sequence wm8962_dc_measure[] = …;
static const struct regmap_config wm8962_regmap = …;
static int wm8962_set_pdata_from_of(struct i2c_client *i2c,
struct wm8962_pdata *pdata)
{ … }
static int wm8962_i2c_probe(struct i2c_client *i2c)
{ … }
static void wm8962_i2c_remove(struct i2c_client *client)
{ … }
#ifdef CONFIG_PM
static int wm8962_runtime_resume(struct device *dev)
{ … }
static int wm8962_runtime_suspend(struct device *dev)
{ … }
#endif
static const struct dev_pm_ops wm8962_pm = …;
static const struct i2c_device_id wm8962_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, wm8962_i2c_id);
static const struct of_device_id wm8962_of_match[] = …;
MODULE_DEVICE_TABLE(of, wm8962_of_match);
static struct i2c_driver wm8962_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;