#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/export.h>
#include <linux/pm.h>
#include <linux/gcd.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/fixed.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/jack.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <sound/wm5100.h>
#include "wm5100.h"
#define WM5100_NUM_CORE_SUPPLIES …
static const char *wm5100_core_supply_names[WM5100_NUM_CORE_SUPPLIES] = …;
#define WM5100_AIFS …
#define WM5100_SYNC_SRS …
struct wm5100_fll { … };
struct wm5100_priv { … };
static int wm5100_sr_code[] = …;
static int wm5100_sr_regs[WM5100_SYNC_SRS] = …;
static int wm5100_alloc_sr(struct snd_soc_component *component, int rate)
{ … }
static void wm5100_free_sr(struct snd_soc_component *component, int rate)
{ … }
static int wm5100_reset(struct wm5100_priv *wm5100)
{ … }
static DECLARE_TLV_DB_SCALE(in_tlv, -6300, 100, 0);
static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
static DECLARE_TLV_DB_SCALE(mixer_tlv, -3200, 100, 0);
static DECLARE_TLV_DB_SCALE(out_tlv, -6400, 100, 0);
static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
static const char *wm5100_mixer_texts[] = …;
static int wm5100_mixer_values[] = …;
#define WM5100_MIXER_CONTROLS(name, base) …
#define WM5100_MUX_ENUM_DECL(name, reg) …
#define WM5100_MUX_CTL_DECL(name) …
#define WM5100_MIXER_ENUMS(name, base_reg) …
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
WM5100_MIXER_ENUMS(…);
#define WM5100_MUX(name, ctrl) …
#define WM5100_MIXER_WIDGETS(name, name_str) …
#define WM5100_MIXER_INPUT_ROUTES(name) …
#define WM5100_MIXER_ROUTES(widget, name) …
static const char *wm5100_lhpf_mode_text[] = …;
static SOC_ENUM_SINGLE_DECL(wm5100_lhpf1_mode,
WM5100_HPLPF1_1, WM5100_LHPF1_MODE_SHIFT,
wm5100_lhpf_mode_text);
static SOC_ENUM_SINGLE_DECL(wm5100_lhpf2_mode,
WM5100_HPLPF2_1, WM5100_LHPF2_MODE_SHIFT,
wm5100_lhpf_mode_text);
static SOC_ENUM_SINGLE_DECL(wm5100_lhpf3_mode,
WM5100_HPLPF3_1, WM5100_LHPF3_MODE_SHIFT,
wm5100_lhpf_mode_text);
static SOC_ENUM_SINGLE_DECL(wm5100_lhpf4_mode,
WM5100_HPLPF4_1, WM5100_LHPF4_MODE_SHIFT,
wm5100_lhpf_mode_text);
static const struct snd_kcontrol_new wm5100_snd_controls[] = …;
static void wm5100_seq_notifier(struct snd_soc_component *component,
enum snd_soc_dapm_type event, int subseq)
{ … }
static int wm5100_out_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static void wm5100_log_status3(struct wm5100_priv *wm5100, int val)
{ … }
static void wm5100_log_status4(struct wm5100_priv *wm5100, int val)
{ … }
static int wm5100_post_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static const struct snd_soc_dapm_widget wm5100_dapm_widgets[] = …;
static const struct snd_soc_dapm_widget wm5100_dapm_widgets_noirq[] = …;
static const struct snd_soc_dapm_route wm5100_dapm_routes[] = …;
static const struct reg_sequence wm5100_reva_patches[] = …;
static int wm5100_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
#define WM5100_NUM_BCLK_RATES …
static int wm5100_bclk_rates_dat[WM5100_NUM_BCLK_RATES] = …;
static int wm5100_bclk_rates_cd[WM5100_NUM_BCLK_RATES] = …;
static int wm5100_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static const struct snd_soc_dai_ops wm5100_dai_ops = …;
static int wm5100_set_sysclk(struct snd_soc_component *component, int clk_id,
int source, unsigned int freq, int dir)
{ … }
struct _fll_div { … };
static struct { … } fll_fratios[] = …;
static int fll_factors(struct _fll_div *fll_div, unsigned int Fref,
unsigned int Fout)
{ … }
static int wm5100_set_fll(struct snd_soc_component *component, int fll_id, int source,
unsigned int Fref, unsigned int Fout)
{ … }
#define WM5100_RATES …
#define WM5100_FORMATS …
static struct snd_soc_dai_driver wm5100_dai[] = …;
static int wm5100_dig_vu[] = …;
static void wm5100_set_detect_mode(struct wm5100_priv *wm5100, int the_mode)
{ … }
static void wm5100_report_headphone(struct wm5100_priv *wm5100)
{ … }
static void wm5100_micd_irq(struct wm5100_priv *wm5100)
{ … }
int wm5100_detect(struct snd_soc_component *component, struct snd_soc_jack *jack)
{ … }
EXPORT_SYMBOL_GPL(…);
static irqreturn_t wm5100_irq(int irq, void *data)
{ … }
static irqreturn_t wm5100_edge_irq(int irq, void *data)
{ … }
#ifdef CONFIG_GPIOLIB
static void wm5100_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{ … }
static int wm5100_gpio_direction_out(struct gpio_chip *chip,
unsigned offset, int value)
{ … }
static int wm5100_gpio_get(struct gpio_chip *chip, unsigned offset)
{ … }
static int wm5100_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
{ … }
static const struct gpio_chip wm5100_template_chip = …;
static void wm5100_init_gpio(struct i2c_client *i2c)
{ … }
static void wm5100_free_gpio(struct i2c_client *i2c)
{ … }
#else
static void wm5100_init_gpio(struct i2c_client *i2c)
{
}
static void wm5100_free_gpio(struct i2c_client *i2c)
{
}
#endif
static int wm5100_probe(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_component_dev_wm5100 = …;
static const struct regmap_config wm5100_regmap = …;
static const unsigned int wm5100_mic_ctrl_reg[] = …;
static int wm5100_i2c_probe(struct i2c_client *i2c)
{ … }
static void wm5100_i2c_remove(struct i2c_client *i2c)
{ … }
#ifdef CONFIG_PM
static int wm5100_runtime_suspend(struct device *dev)
{ … }
static int wm5100_runtime_resume(struct device *dev)
{ … }
#endif
static const struct dev_pm_ops wm5100_pm = …;
static const struct i2c_device_id wm5100_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, wm5100_i2c_id);
static struct i2c_driver wm5100_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;