#include <linux/clk.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/regulator/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/initval.h>
#include <sound/tlv.h>
#include <sound/wm8904.h>
#include "wm8904.h"
enum wm8904_type { … };
#define WM8904_NUM_DCS_CHANNELS …
#define WM8904_NUM_SUPPLIES …
static const char *wm8904_supply_names[WM8904_NUM_SUPPLIES] = …;
struct wm8904_priv { … };
static const struct reg_default wm8904_reg_defaults[] = …;
static bool wm8904_volatile_register(struct device *dev, unsigned int reg)
{ … }
static bool wm8904_readable_register(struct device *dev, unsigned int reg)
{ … }
static int wm8904_configure_clocking(struct snd_soc_component *component)
{ … }
static void wm8904_set_drc(struct snd_soc_component *component)
{ … }
static int wm8904_put_drc_enum(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int wm8904_get_drc_enum(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static void wm8904_set_retune_mobile(struct snd_soc_component *component)
{ … }
static int wm8904_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int wm8904_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int deemph_settings[] = …;
static int wm8904_set_deemph(struct snd_soc_component *component)
{ … }
static int wm8904_get_deemph(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int wm8904_put_deemph(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const DECLARE_TLV_DB_SCALE(dac_boost_tlv, 0, 600, 0);
static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1);
static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0);
static const DECLARE_TLV_DB_SCALE(sidetone_tlv, -3600, 300, 0);
static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
static const char *hpf_mode_text[] = …;
static SOC_ENUM_SINGLE_DECL(hpf_mode, WM8904_ADC_DIGITAL_0, 5,
hpf_mode_text);
static int wm8904_adc_osr_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new wm8904_adc_snd_controls[] = …;
static const char *drc_path_text[] = …;
static SOC_ENUM_SINGLE_DECL(drc_path, WM8904_DRC_0, 14, drc_path_text);
static const struct snd_kcontrol_new wm8904_dac_snd_controls[] = …;
static const struct snd_kcontrol_new wm8904_snd_controls[] = …;
static const struct snd_kcontrol_new wm8904_eq_controls[] = …;
static int cp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int sysclk_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 const char *input_mode_text[] = …;
static const char *lin_text[] = …;
static SOC_ENUM_SINGLE_DECL(lin_enum, WM8904_ANALOGUE_LEFT_INPUT_1, 2,
lin_text);
static const struct snd_kcontrol_new lin_mux = …;
static SOC_ENUM_SINGLE_DECL(lin_inv_enum, WM8904_ANALOGUE_LEFT_INPUT_1, 4,
lin_text);
static const struct snd_kcontrol_new lin_inv_mux = …;
static SOC_ENUM_SINGLE_DECL(lin_mode_enum,
WM8904_ANALOGUE_LEFT_INPUT_1, 0,
input_mode_text);
static const struct snd_kcontrol_new lin_mode = …;
static const char *rin_text[] = …;
static SOC_ENUM_SINGLE_DECL(rin_enum, WM8904_ANALOGUE_RIGHT_INPUT_1, 2,
rin_text);
static const struct snd_kcontrol_new rin_mux = …;
static SOC_ENUM_SINGLE_DECL(rin_inv_enum, WM8904_ANALOGUE_RIGHT_INPUT_1, 4,
rin_text);
static const struct snd_kcontrol_new rin_inv_mux = …;
static SOC_ENUM_SINGLE_DECL(rin_mode_enum,
WM8904_ANALOGUE_RIGHT_INPUT_1, 0,
input_mode_text);
static const struct snd_kcontrol_new rin_mode = …;
static const char *aif_text[] = …;
static SOC_ENUM_SINGLE_DECL(aifoutl_enum, WM8904_AUDIO_INTERFACE_0, 7,
aif_text);
static const struct snd_kcontrol_new aifoutl_mux = …;
static SOC_ENUM_SINGLE_DECL(aifoutr_enum, WM8904_AUDIO_INTERFACE_0, 6,
aif_text);
static const struct snd_kcontrol_new aifoutr_mux = …;
static SOC_ENUM_SINGLE_DECL(aifinl_enum, WM8904_AUDIO_INTERFACE_0, 5,
aif_text);
static const struct snd_kcontrol_new aifinl_mux = …;
static SOC_ENUM_SINGLE_DECL(aifinr_enum, WM8904_AUDIO_INTERFACE_0, 4,
aif_text);
static const struct snd_kcontrol_new aifinr_mux = …;
static const struct snd_soc_dapm_widget wm8904_core_dapm_widgets[] = …;
static const struct snd_soc_dapm_widget wm8904_adc_dapm_widgets[] = …;
static const struct snd_soc_dapm_widget wm8904_dac_dapm_widgets[] = …;
static const char *out_mux_text[] = …;
static SOC_ENUM_SINGLE_DECL(hpl_enum, WM8904_ANALOGUE_OUT12_ZC, 3,
out_mux_text);
static const struct snd_kcontrol_new hpl_mux = …;
static SOC_ENUM_SINGLE_DECL(hpr_enum, WM8904_ANALOGUE_OUT12_ZC, 2,
out_mux_text);
static const struct snd_kcontrol_new hpr_mux = …;
static SOC_ENUM_SINGLE_DECL(linel_enum, WM8904_ANALOGUE_OUT12_ZC, 1,
out_mux_text);
static const struct snd_kcontrol_new linel_mux = …;
static SOC_ENUM_SINGLE_DECL(liner_enum, WM8904_ANALOGUE_OUT12_ZC, 0,
out_mux_text);
static const struct snd_kcontrol_new liner_mux = …;
static const char *sidetone_text[] = …;
static SOC_ENUM_SINGLE_DECL(dacl_sidetone_enum, WM8904_DAC_DIGITAL_0, 2,
sidetone_text);
static const struct snd_kcontrol_new dacl_sidetone_mux = …;
static SOC_ENUM_SINGLE_DECL(dacr_sidetone_enum, WM8904_DAC_DIGITAL_0, 0,
sidetone_text);
static const struct snd_kcontrol_new dacr_sidetone_mux = …;
static const struct snd_soc_dapm_widget wm8904_dapm_widgets[] = …;
static const struct snd_soc_dapm_route core_intercon[] = …;
static const struct snd_soc_dapm_route adc_intercon[] = …;
static const struct snd_soc_dapm_route dac_intercon[] = …;
static const struct snd_soc_dapm_route wm8904_intercon[] = …;
static const struct snd_soc_dapm_route wm8912_intercon[] = …;
static int wm8904_add_widgets(struct snd_soc_component *component)
{ … }
static struct { … } clk_sys_rates[] = …;
static struct { … } sample_rates[] = …;
static struct { … } bclk_divs[] = …;
static int wm8904_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int wm8904_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
static int wm8904_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
unsigned int rx_mask, int slots, int slot_width)
{ … }
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 wm8904_set_fll(struct snd_soc_dai *dai, int fll_id, int source,
unsigned int Fref, unsigned int Fout)
{ … }
static int wm8904_set_sysclk(struct snd_soc_dai *dai, int clk_id,
unsigned int freq, int dir)
{ … }
static int wm8904_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
{ … }
static int wm8904_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
#define WM8904_RATES …
#define WM8904_FORMATS …
static const struct snd_soc_dai_ops wm8904_dai_ops = …;
static struct snd_soc_dai_driver wm8904_dai = …;
static void wm8904_handle_retune_mobile_pdata(struct snd_soc_component *component)
{ … }
static void wm8904_handle_pdata(struct snd_soc_component *component)
{ … }
static int wm8904_probe(struct snd_soc_component *component)
{ … }
static void wm8904_remove(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_component_dev_wm8904 = …;
static const struct regmap_config wm8904_regmap = …;
#ifdef CONFIG_OF
static const struct of_device_id wm8904_of_match[] = …;
MODULE_DEVICE_TABLE(of, wm8904_of_match);
#endif
static const struct i2c_device_id wm8904_i2c_id[];
static int wm8904_i2c_probe(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id wm8904_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, wm8904_i2c_id);
static struct i2c_driver wm8904_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;