#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/pm.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/tlv.h>
#include <sound/soc.h>
#include "adau1372.h"
#include "adau-utils.h"
struct adau1372 { … };
#define ADAU1372_REG_CLK_CTRL …
#define ADAU1372_REG_PLL(x) …
#define ADAU1372_REG_DAC_SOURCE …
#define ADAU1372_REG_SOUT_SOURCE_0_1 …
#define ADAU1372_REG_SOUT_SOURCE_2_3 …
#define ADAU1372_REG_SOUT_SOURCE_4_5 …
#define ADAU1372_REG_SOUT_SOURCE_6_7 …
#define ADAU1372_REG_ADC_SDATA_CH …
#define ADAU1372_REG_ASRCO_SOURCE_0_1 …
#define ADAU1372_REG_ASRCO_SOURCE_2_3 …
#define ADAU1372_REG_ASRC_MODE …
#define ADAU1372_REG_ADC_CTRL0 …
#define ADAU1372_REG_ADC_CTRL1 …
#define ADAU1372_REG_ADC_CTRL2 …
#define ADAU1372_REG_ADC_CTRL3 …
#define ADAU1372_REG_ADC_VOL(x) …
#define ADAU1372_REG_PGA_CTRL(x) …
#define ADAU1372_REG_PGA_BOOST …
#define ADAU1372_REG_MICBIAS …
#define ADAU1372_REG_DAC_CTRL …
#define ADAU1372_REG_DAC_VOL(x) …
#define ADAU1372_REG_OP_STAGE_MUTE …
#define ADAU1372_REG_SAI0 …
#define ADAU1372_REG_SAI1 …
#define ADAU1372_REG_SOUT_CTRL …
#define ADAU1372_REG_MODE_MP(x) …
#define ADAU1372_REG_OP_STAGE_CTRL …
#define ADAU1372_REG_DECIM_PWR …
#define ADAU1372_REG_INTERP_PWR …
#define ADAU1372_REG_BIAS_CTRL0 …
#define ADAU1372_REG_BIAS_CTRL1 …
#define ADAU1372_CLK_CTRL_PLL_EN …
#define ADAU1372_CLK_CTRL_XTAL_DIS …
#define ADAU1372_CLK_CTRL_CLKSRC …
#define ADAU1372_CLK_CTRL_CC_MDIV …
#define ADAU1372_CLK_CTRL_MCLK_EN …
#define ADAU1372_SAI0_DELAY1 …
#define ADAU1372_SAI0_DELAY0 …
#define ADAU1372_SAI0_DELAY_MASK …
#define ADAU1372_SAI0_SAI_I2S …
#define ADAU1372_SAI0_SAI_TDM2 …
#define ADAU1372_SAI0_SAI_TDM4 …
#define ADAU1372_SAI0_SAI_TDM8 …
#define ADAU1372_SAI0_SAI_MASK …
#define ADAU1372_SAI0_FS_48 …
#define ADAU1372_SAI0_FS_8 …
#define ADAU1372_SAI0_FS_12 …
#define ADAU1372_SAI0_FS_16 …
#define ADAU1372_SAI0_FS_24 …
#define ADAU1372_SAI0_FS_32 …
#define ADAU1372_SAI0_FS_96 …
#define ADAU1372_SAI0_FS_192 …
#define ADAU1372_SAI0_FS_MASK …
#define ADAU1372_SAI1_TDM_TS …
#define ADAU1372_SAI1_BCLK_TDMC …
#define ADAU1372_SAI1_LR_MODE …
#define ADAU1372_SAI1_LR_POL …
#define ADAU1372_SAI1_BCLKRATE …
#define ADAU1372_SAI1_BCLKEDGE …
#define ADAU1372_SAI1_MS …
static const unsigned int adau1372_rates[] = …;
#define ADAU1372_RATE_MASK_TDM8 …
#define ADAU1372_RATE_MASK_TDM4_MASTER …
#define ADAU1372_RATE_MASK_TDM4 …
#define ADAU1372_RATE_MASK_TDM2 …
static const DECLARE_TLV_DB_MINMAX(adau1372_digital_tlv, -9563, 0);
static const DECLARE_TLV_DB_SCALE(adau1372_pga_tlv, -1200, 75, 0);
static const DECLARE_TLV_DB_SCALE(adau1372_pga_boost_tlv, 0, 1000, 0);
static const char * const adau1372_bias_text[] = …;
static const unsigned int adau1372_bias_adc_values[] = …;
static const char * const adau1372_bias_adc_text[] = …;
static const char * const adau1372_bias_dac_text[] = …;
static SOC_ENUM_SINGLE_DECL(adau1372_bias_hp_enum,
ADAU1372_REG_BIAS_CTRL0, 6, adau1372_bias_text);
static SOC_ENUM_SINGLE_DECL(adau1372_bias_afe0_1_enum,
ADAU1372_REG_BIAS_CTRL0, 4, adau1372_bias_text);
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_bias_adc2_3_enum,
ADAU1372_REG_BIAS_CTRL0, 2, 0x3, adau1372_bias_adc_text,
adau1372_bias_adc_values);
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_bias_adc0_1_enum,
ADAU1372_REG_BIAS_CTRL0, 0, 0x3, adau1372_bias_adc_text,
adau1372_bias_adc_values);
static SOC_ENUM_SINGLE_DECL(adau1372_bias_afe2_3_enum,
ADAU1372_REG_BIAS_CTRL1, 4, adau1372_bias_text);
static SOC_ENUM_SINGLE_DECL(adau1372_bias_mic_enum,
ADAU1372_REG_BIAS_CTRL1, 2, adau1372_bias_text);
static SOC_ENUM_SINGLE_DECL(adau1372_bias_dac_enum,
ADAU1372_REG_BIAS_CTRL1, 0, adau1372_bias_dac_text);
static const char * const adau1372_hpf_text[] = …;
static SOC_ENUM_SINGLE_DECL(adau1372_hpf0_1_enum, ADAU1372_REG_ADC_CTRL2, 5,
adau1372_hpf_text);
static SOC_ENUM_SINGLE_DECL(adau1372_hpf2_3_enum, ADAU1372_REG_ADC_CTRL3, 5,
adau1372_hpf_text);
static const struct snd_kcontrol_new adau1372_controls[] = …;
static const char * const adau1372_decimator_mux_text[] = …;
static SOC_ENUM_SINGLE_DECL(adau1372_decimator0_1_mux_enum, ADAU1372_REG_ADC_CTRL2,
2, adau1372_decimator_mux_text);
static const struct snd_kcontrol_new adau1372_decimator0_1_mux_control = …;
static SOC_ENUM_SINGLE_DECL(adau1372_decimator2_3_mux_enum, ADAU1372_REG_ADC_CTRL3,
2, adau1372_decimator_mux_text);
static const struct snd_kcontrol_new adau1372_decimator2_3_mux_control = …;
static const unsigned int adau1372_asrco_mux_values[] = …;
static const char * const adau1372_asrco_mux_text[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_asrco0_mux_enum, ADAU1372_REG_ASRCO_SOURCE_0_1,
0, 0xf, adau1372_asrco_mux_text, adau1372_asrco_mux_values);
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_asrco1_mux_enum, ADAU1372_REG_ASRCO_SOURCE_0_1,
4, 0xf, adau1372_asrco_mux_text, adau1372_asrco_mux_values);
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_asrco2_mux_enum, ADAU1372_REG_ASRCO_SOURCE_2_3,
0, 0xf, adau1372_asrco_mux_text, adau1372_asrco_mux_values);
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_asrco3_mux_enum, ADAU1372_REG_ASRCO_SOURCE_2_3,
4, 0xf, adau1372_asrco_mux_text, adau1372_asrco_mux_values);
static const struct snd_kcontrol_new adau1372_asrco0_mux_control = …;
static const struct snd_kcontrol_new adau1372_asrco1_mux_control = …;
static const struct snd_kcontrol_new adau1372_asrco2_mux_control = …;
static const struct snd_kcontrol_new adau1372_asrco3_mux_control = …;
static const unsigned int adau1372_sout_mux_values[] = …;
static const char * const adau1372_sout_mux_text[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_sout0_mux_enum, ADAU1372_REG_SOUT_SOURCE_0_1,
0, 0xf, adau1372_sout_mux_text, adau1372_sout_mux_values);
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_sout1_mux_enum, ADAU1372_REG_SOUT_SOURCE_0_1,
4, 0xf, adau1372_sout_mux_text, adau1372_sout_mux_values);
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_sout2_mux_enum, ADAU1372_REG_SOUT_SOURCE_2_3,
0, 0xf, adau1372_sout_mux_text, adau1372_sout_mux_values);
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_sout3_mux_enum, ADAU1372_REG_SOUT_SOURCE_2_3,
4, 0xf, adau1372_sout_mux_text, adau1372_sout_mux_values);
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_sout4_mux_enum, ADAU1372_REG_SOUT_SOURCE_4_5,
0, 0xf, adau1372_sout_mux_text, adau1372_sout_mux_values);
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_sout5_mux_enum, ADAU1372_REG_SOUT_SOURCE_4_5,
4, 0xf, adau1372_sout_mux_text, adau1372_sout_mux_values);
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_sout6_mux_enum, ADAU1372_REG_SOUT_SOURCE_6_7,
0, 0xf, adau1372_sout_mux_text, adau1372_sout_mux_values);
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_sout7_mux_enum, ADAU1372_REG_SOUT_SOURCE_6_7,
4, 0xf, adau1372_sout_mux_text, adau1372_sout_mux_values);
static const struct snd_kcontrol_new adau1372_sout0_mux_control = …;
static const struct snd_kcontrol_new adau1372_sout1_mux_control = …;
static const struct snd_kcontrol_new adau1372_sout2_mux_control = …;
static const struct snd_kcontrol_new adau1372_sout3_mux_control = …;
static const struct snd_kcontrol_new adau1372_sout4_mux_control = …;
static const struct snd_kcontrol_new adau1372_sout5_mux_control = …;
static const struct snd_kcontrol_new adau1372_sout6_mux_control = …;
static const struct snd_kcontrol_new adau1372_sout7_mux_control = …;
static const char * const adau1372_asrci_mux_text[] = …;
static SOC_ENUM_SINGLE_DECL(adau1372_asrci_mux_enum,
ADAU1372_REG_ASRC_MODE, 2, adau1372_asrci_mux_text);
static const struct snd_kcontrol_new adau1372_asrci_mux_control = …;
static const unsigned int adau1372_dac_mux_values[] = …;
static const char * const adau1372_dac_mux_text[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_dac0_mux_enum, ADAU1372_REG_DAC_SOURCE,
0, 0xf, adau1372_dac_mux_text, adau1372_dac_mux_values);
static SOC_VALUE_ENUM_SINGLE_DECL(adau1372_dac1_mux_enum, ADAU1372_REG_DAC_SOURCE,
4, 0xf, adau1372_dac_mux_text, adau1372_dac_mux_values);
static const struct snd_kcontrol_new adau1372_dac0_mux_control = …;
static const struct snd_kcontrol_new adau1372_dac1_mux_control = …;
static const struct snd_soc_dapm_widget adau1372_dapm_widgets[] = …;
#define ADAU1372_SOUT_ROUTES(x) …
#define ADAU1372_ASRCO_ROUTES(x) …
static const struct snd_soc_dapm_route adau1372_dapm_routes[] = …;
static int adau1372_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
static int adau1372_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ … }
static int adau1372_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
unsigned int rx_mask, int slots, int width)
{ … }
static int adau1372_set_tristate(struct snd_soc_dai *dai, int tristate)
{ … }
static int adau1372_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
{ … }
static void adau1372_enable_pll(struct adau1372 *adau1372)
{ … }
static void adau1372_set_power(struct adau1372 *adau1372, bool enable)
{ … }
static int adau1372_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static const struct snd_soc_component_driver adau1372_driver = …;
static const struct snd_soc_dai_ops adau1372_dai_ops = …;
#define ADAU1372_FORMATS …
static struct snd_soc_dai_driver adau1372_dai_driver = …;
static int adau1372_setup_pll(struct adau1372 *adau1372, unsigned int rate)
{ … }
int adau1372_probe(struct device *dev, struct regmap *regmap,
void (*switch_mode)(struct device *dev))
{ … }
EXPORT_SYMBOL(…);
static const struct reg_default adau1372_reg_defaults[] = …;
static bool adau1372_volatile_register(struct device *dev, unsigned int reg)
{ … }
const struct regmap_config adau1372_regmap_config = …;
EXPORT_SYMBOL_GPL(…);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;