#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include "adav80x.h"
#define ADAV80X_PLAYBACK_CTRL …
#define ADAV80X_AUX_IN_CTRL …
#define ADAV80X_REC_CTRL …
#define ADAV80X_AUX_OUT_CTRL …
#define ADAV80X_DPATH_CTRL1 …
#define ADAV80X_DPATH_CTRL2 …
#define ADAV80X_DAC_CTRL1 …
#define ADAV80X_DAC_CTRL2 …
#define ADAV80X_DAC_CTRL3 …
#define ADAV80X_DAC_L_VOL …
#define ADAV80X_DAC_R_VOL …
#define ADAV80X_PGA_L_VOL …
#define ADAV80X_PGA_R_VOL …
#define ADAV80X_ADC_CTRL1 …
#define ADAV80X_ADC_CTRL2 …
#define ADAV80X_ADC_L_VOL …
#define ADAV80X_ADC_R_VOL …
#define ADAV80X_PLL_CTRL1 …
#define ADAV80X_PLL_CTRL2 …
#define ADAV80X_ICLK_CTRL1 …
#define ADAV80X_ICLK_CTRL2 …
#define ADAV80X_PLL_CLK_SRC …
#define ADAV80X_PLL_OUTE …
#define ADAV80X_PLL_CLK_SRC_PLL_XIN(pll) …
#define ADAV80X_PLL_CLK_SRC_PLL_MCLKI(pll) …
#define ADAV80X_PLL_CLK_SRC_PLL_MASK(pll) …
#define ADAV80X_ICLK_CTRL1_DAC_SRC(src) …
#define ADAV80X_ICLK_CTRL1_ADC_SRC(src) …
#define ADAV80X_ICLK_CTRL1_ICLK2_SRC(src) …
#define ADAV80X_ICLK_CTRL2_ICLK1_SRC(src) …
#define ADAV80X_PLL_CTRL1_PLLDIV …
#define ADAV80X_PLL_CTRL1_PLLPD(pll) …
#define ADAV80X_PLL_CTRL1_XTLPD …
#define ADAV80X_PLL_CTRL2_FIELD(pll, x) …
#define ADAV80X_PLL_CTRL2_FS_48(pll) …
#define ADAV80X_PLL_CTRL2_FS_32(pll) …
#define ADAV80X_PLL_CTRL2_FS_44(pll) …
#define ADAV80X_PLL_CTRL2_SEL(pll) …
#define ADAV80X_PLL_CTRL2_DOUB(pll) …
#define ADAV80X_PLL_CTRL2_PLL_MASK(pll) …
#define ADAV80X_ADC_CTRL1_MODULATOR_MASK …
#define ADAV80X_ADC_CTRL1_MODULATOR_128FS …
#define ADAV80X_ADC_CTRL1_MODULATOR_64FS …
#define ADAV80X_DAC_CTRL1_PD …
#define ADAV80X_DAC_CTRL2_DIV1 …
#define ADAV80X_DAC_CTRL2_DIV1_5 …
#define ADAV80X_DAC_CTRL2_DIV2 …
#define ADAV80X_DAC_CTRL2_DIV3 …
#define ADAV80X_DAC_CTRL2_DIV_MASK …
#define ADAV80X_DAC_CTRL2_INTERPOL_256FS …
#define ADAV80X_DAC_CTRL2_INTERPOL_128FS …
#define ADAV80X_DAC_CTRL2_INTERPOL_64FS …
#define ADAV80X_DAC_CTRL2_INTERPOL_MASK …
#define ADAV80X_DAC_CTRL2_DEEMPH_NONE …
#define ADAV80X_DAC_CTRL2_DEEMPH_44 …
#define ADAV80X_DAC_CTRL2_DEEMPH_32 …
#define ADAV80X_DAC_CTRL2_DEEMPH_48 …
#define ADAV80X_DAC_CTRL2_DEEMPH_MASK …
#define ADAV80X_CAPTURE_MODE_MASTER …
#define ADAV80X_CAPTURE_WORD_LEN24 …
#define ADAV80X_CAPTURE_WORD_LEN20 …
#define ADAV80X_CAPTRUE_WORD_LEN18 …
#define ADAV80X_CAPTURE_WORD_LEN16 …
#define ADAV80X_CAPTURE_WORD_LEN_MASK …
#define ADAV80X_CAPTURE_MODE_LEFT_J …
#define ADAV80X_CAPTURE_MODE_I2S …
#define ADAV80X_CAPTURE_MODE_RIGHT_J …
#define ADAV80X_CAPTURE_MODE_MASK …
#define ADAV80X_PLAYBACK_MODE_MASTER …
#define ADAV80X_PLAYBACK_MODE_LEFT_J …
#define ADAV80X_PLAYBACK_MODE_I2S …
#define ADAV80X_PLAYBACK_MODE_RIGHT_J_24 …
#define ADAV80X_PLAYBACK_MODE_RIGHT_J_20 …
#define ADAV80X_PLAYBACK_MODE_RIGHT_J_18 …
#define ADAV80X_PLAYBACK_MODE_RIGHT_J_16 …
#define ADAV80X_PLAYBACK_MODE_MASK …
#define ADAV80X_PLL_OUTE_SYSCLKPD(x) …
static const struct reg_default adav80x_reg_defaults[] = …;
struct adav80x { … };
static const char *adav80x_mux_text[] = …;
static const unsigned int adav80x_mux_values[] = …;
#define ADAV80X_MUX_ENUM_DECL(name, reg, shift) …
static ADAV80X_MUX_ENUM_DECL(adav80x_aux_capture_enum, ADAV80X_DPATH_CTRL1, 0);
static ADAV80X_MUX_ENUM_DECL(adav80x_capture_enum, ADAV80X_DPATH_CTRL1, 3);
static ADAV80X_MUX_ENUM_DECL(adav80x_dac_enum, ADAV80X_DPATH_CTRL2, 3);
static const struct snd_kcontrol_new adav80x_aux_capture_mux_ctrl = …;
static const struct snd_kcontrol_new adav80x_capture_mux_ctrl = …;
static const struct snd_kcontrol_new adav80x_dac_mux_ctrl = …;
#define ADAV80X_MUX(name, ctrl) …
static const struct snd_soc_dapm_widget adav80x_dapm_widgets[] = …;
static int adav80x_dapm_sysclk_check(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
static int adav80x_dapm_pll_check(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
static const struct snd_soc_dapm_route adav80x_dapm_routes[] = …;
static int adav80x_set_deemph(struct snd_soc_component *component)
{ … }
static int adav80x_put_deemph(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int adav80x_get_deemph(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct adav80x *adav80x = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = adav80x->deemph;
return 0;
};
static const DECLARE_TLV_DB_SCALE(adav80x_inpga_tlv, 0, 50, 0);
static const DECLARE_TLV_DB_MINMAX(adav80x_digital_tlv, -9563, 0);
static const struct snd_kcontrol_new adav80x_controls[] = …;
static unsigned int adav80x_port_ctrl_regs[2][2] = …;
static int adav80x_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
static int adav80x_set_adc_clock(struct snd_soc_component *component,
unsigned int sample_rate)
{ … }
static int adav80x_set_dac_clock(struct snd_soc_component *component,
unsigned int sample_rate)
{ … }
static int adav80x_set_capture_pcm_format(struct snd_soc_component *component,
struct snd_soc_dai *dai, struct snd_pcm_hw_params *params)
{ … }
static int adav80x_set_playback_pcm_format(struct snd_soc_component *component,
struct snd_soc_dai *dai, struct snd_pcm_hw_params *params)
{ … }
static int adav80x_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ … }
static int adav80x_set_sysclk(struct snd_soc_component *component,
int clk_id, int source,
unsigned int freq, int dir)
{ … }
static int adav80x_set_pll(struct snd_soc_component *component, int pll_id,
int source, unsigned int freq_in, unsigned int freq_out)
{ … }
static int adav80x_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static int adav80x_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static void adav80x_dai_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static const struct snd_soc_dai_ops adav80x_dai_ops = …;
#define ADAV80X_PLAYBACK_RATES …
#define ADAV80X_CAPTURE_RATES …
#define ADAV80X_FORMATS …
static struct snd_soc_dai_driver adav80x_dais[] = …;
static int adav80x_probe(struct snd_soc_component *component)
{ … }
static int adav80x_resume(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver adav80x_component_driver = …;
int adav80x_bus_probe(struct device *dev, struct regmap *regmap)
{ … }
EXPORT_SYMBOL_GPL(…);
const struct regmap_config adav80x_regmap_config = …;
EXPORT_SYMBOL_GPL(…);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;