#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.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/soc-dapm.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <asm/div64.h>
#include "wm8991.h"
struct wm8991_priv { … };
static const struct reg_default wm8991_reg_defaults[] = …;
static bool wm8991_volatile(struct device *dev, unsigned int reg)
{ … }
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(in_pga_tlv, -1650, 150, 0);
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(out_mix_tlv, -2100, 300, 0);
static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(out_pga_tlv,
0x00, 0x2f, SNDRV_CTL_TLVD_DB_SCALE_ITEM(SNDRV_CTL_TLVD_DB_GAIN_MUTE, 0, 1),
0x30, 0x7f, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-7300, 100, 0),
);
static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(out_dac_tlv,
0x00, 0xbf, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-71625, 375, 1),
0xc0, 0xff, SNDRV_CTL_TLVD_DB_SCALE_ITEM(0, 0, 0),
);
static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(in_adc_tlv,
0x00, 0xef, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-71625, 375, 1),
0xf0, 0xff, SNDRV_CTL_TLVD_DB_SCALE_ITEM(17625, 0, 0),
);
static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(out_sidetone_tlv,
0x00, 0x0c, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-3600, 300, 0),
0x0d, 0x0f, SNDRV_CTL_TLVD_DB_SCALE_ITEM(0, 0, 0),
);
static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const char *wm8991_digital_sidetone[] = …;
static SOC_ENUM_SINGLE_DECL(wm8991_left_digital_sidetone_enum,
WM8991_DIGITAL_SIDE_TONE,
WM8991_ADC_TO_DACL_SHIFT,
wm8991_digital_sidetone);
static SOC_ENUM_SINGLE_DECL(wm8991_right_digital_sidetone_enum,
WM8991_DIGITAL_SIDE_TONE,
WM8991_ADC_TO_DACR_SHIFT,
wm8991_digital_sidetone);
static const char *wm8991_adcmode[] = …;
static SOC_ENUM_SINGLE_DECL(wm8991_right_adcmode_enum,
WM8991_ADC_CTRL,
WM8991_ADC_HPF_CUT_SHIFT,
wm8991_adcmode);
static const struct snd_kcontrol_new wm8991_snd_controls[] = …;
static int outmixer_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(in_mix_tlv, -1200, 300, 1);
static const struct snd_kcontrol_new wm8991_dapm_lin12_pga_controls[] = …;
static const struct snd_kcontrol_new wm8991_dapm_lin34_pga_controls[] = …;
static const struct snd_kcontrol_new wm8991_dapm_rin12_pga_controls[] = …;
static const struct snd_kcontrol_new wm8991_dapm_rin34_pga_controls[] = …;
static const struct snd_kcontrol_new wm8991_dapm_inmixl_controls[] = …;
static const struct snd_kcontrol_new wm8991_dapm_inmixr_controls[] = …;
static const char *wm8991_ainlmux[] = …;
static SOC_ENUM_SINGLE_DECL(wm8991_ainlmux_enum,
WM8991_INPUT_MIXER1, WM8991_AINLMODE_SHIFT,
wm8991_ainlmux);
static const struct snd_kcontrol_new wm8991_dapm_ainlmux_controls = …;
static const char *wm8991_ainrmux[] = …;
static SOC_ENUM_SINGLE_DECL(wm8991_ainrmux_enum,
WM8991_INPUT_MIXER1, WM8991_AINRMODE_SHIFT,
wm8991_ainrmux);
static const struct snd_kcontrol_new wm8991_dapm_ainrmux_controls = …;
static const struct snd_kcontrol_new wm8991_dapm_lomix_controls[] = …;
static const struct snd_kcontrol_new wm8991_dapm_romix_controls[] = …;
static const struct snd_kcontrol_new wm8991_dapm_lonmix_controls[] = …;
static const struct snd_kcontrol_new wm8991_dapm_lopmix_controls[] = …;
static const struct snd_kcontrol_new wm8991_dapm_ronmix_controls[] = …;
static const struct snd_kcontrol_new wm8991_dapm_ropmix_controls[] = …;
static const struct snd_kcontrol_new wm8991_dapm_out3mix_controls[] = …;
static const struct snd_kcontrol_new wm8991_dapm_out4mix_controls[] = …;
static const struct snd_kcontrol_new wm8991_dapm_spkmix_controls[] = …;
static const struct snd_soc_dapm_widget wm8991_dapm_widgets[] = …;
static const struct snd_soc_dapm_route wm8991_dapm_routes[] = …;
struct _pll_div { … };
#define FIXED_PLL_SIZE …
static void pll_factors(struct _pll_div *pll_div, unsigned int target,
unsigned int source)
{ … }
static int wm8991_set_dai_pll(struct snd_soc_dai *codec_dai,
int pll_id, int src, unsigned int freq_in, unsigned int freq_out)
{ … }
static int wm8991_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{ … }
static int wm8991_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
int div_id, int div)
{ … }
static int wm8991_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int wm8991_mute(struct snd_soc_dai *dai, int mute, int direction)
{ … }
static int wm8991_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
#define WM8991_FORMATS …
static const struct snd_soc_dai_ops wm8991_ops = …;
static struct snd_soc_dai_driver wm8991_dai = …;
static const struct snd_soc_component_driver soc_component_dev_wm8991 = …;
static const struct regmap_config wm8991_regmap = …;
static int wm8991_i2c_probe(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id wm8991_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, wm8991_i2c_id);
static struct i2c_driver wm8991_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;