#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/device.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/initval.h>
#include <sound/tlv.h>
#include <sound/wm9081.h>
#include "wm9081.h"
static const struct reg_default wm9081_reg[] = …;
static struct { … } clk_sys_rates[] = …;
static struct { … } sample_rates[] = …;
static struct { … } bclk_divs[] = …;
struct wm9081_priv { … };
static bool wm9081_volatile_register(struct device *dev, unsigned int reg)
{ … }
static bool wm9081_readable_register(struct device *dev, unsigned int reg)
{ … }
static int wm9081_reset(struct regmap *map)
{ … }
static const DECLARE_TLV_DB_SCALE(drc_in_tlv, -4500, 75, 0);
static const DECLARE_TLV_DB_SCALE(drc_out_tlv, -2250, 75, 0);
static const DECLARE_TLV_DB_SCALE(drc_min_tlv, -1800, 600, 0);
static const DECLARE_TLV_DB_RANGE(drc_max_tlv,
0, 0, TLV_DB_SCALE_ITEM(1200, 0, 0),
1, 1, TLV_DB_SCALE_ITEM(1800, 0, 0),
2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0),
3, 3, TLV_DB_SCALE_ITEM(3600, 0, 0)
);
static const DECLARE_TLV_DB_SCALE(drc_qr_tlv, 1200, 600, 0);
static const DECLARE_TLV_DB_SCALE(drc_startup_tlv, -300, 50, 0);
static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
static const DECLARE_TLV_DB_SCALE(in_tlv, -600, 600, 0);
static const DECLARE_TLV_DB_SCALE(dac_tlv, -7200, 75, 1);
static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0);
static const char *drc_high_text[] = …;
static SOC_ENUM_SINGLE_DECL(drc_high, WM9081_DRC_3, 3, drc_high_text);
static const char *drc_low_text[] = …;
static SOC_ENUM_SINGLE_DECL(drc_low, WM9081_DRC_3, 0, drc_low_text);
static const char *drc_atk_text[] = …;
static SOC_ENUM_SINGLE_DECL(drc_atk, WM9081_DRC_2, 12, drc_atk_text);
static const char *drc_dcy_text[] = …;
static SOC_ENUM_SINGLE_DECL(drc_dcy, WM9081_DRC_2, 8, drc_dcy_text);
static const char *drc_qr_dcy_text[] = …;
static SOC_ENUM_SINGLE_DECL(drc_qr_dcy, WM9081_DRC_2, 4, drc_qr_dcy_text);
static const char *dac_deemph_text[] = …;
static SOC_ENUM_SINGLE_DECL(dac_deemph, WM9081_DAC_DIGITAL_2, 1,
dac_deemph_text);
static const char *speaker_mode_text[] = …;
static SOC_ENUM_SINGLE_DECL(speaker_mode, WM9081_ANALOGUE_SPEAKER_2, 6,
speaker_mode_text);
static int speaker_mode_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int speaker_mode_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new wm9081_snd_controls[] = …;
static const struct snd_kcontrol_new wm9081_eq_controls[] = …;
static const struct snd_kcontrol_new mixer[] = …;
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 wm9081_set_fll(struct snd_soc_component *component, int fll_id,
unsigned int Fref, unsigned int Fout)
{ … }
static int configure_clock(struct snd_soc_component *component)
{ … }
static int clk_sys_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const struct snd_soc_dapm_widget wm9081_dapm_widgets[] = …;
static const struct snd_soc_dapm_route wm9081_audio_paths[] = …;
static int wm9081_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static int wm9081_set_dai_fmt(struct snd_soc_dai *dai,
unsigned int fmt)
{ … }
static int wm9081_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int wm9081_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
{ … }
static int wm9081_set_sysclk(struct snd_soc_component *component, int clk_id,
int source, unsigned int freq, int dir)
{ … }
static int wm9081_set_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
{ … }
#define WM9081_RATES …
#define WM9081_FORMATS …
static const struct snd_soc_dai_ops wm9081_dai_ops = …;
static struct snd_soc_dai_driver wm9081_dai = …;
static int wm9081_probe(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_component_dev_wm9081 = …;
static const struct regmap_config wm9081_regmap = …;
static int wm9081_i2c_probe(struct i2c_client *i2c)
{ … }
static void wm9081_i2c_remove(struct i2c_client *client)
{ … }
static const struct i2c_device_id wm9081_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, wm9081_i2c_id);
static struct i2c_driver wm9081_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;