#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <linux/acpi.h>
#include <linux/gpio/consumer.h>
#include <linux/regulator/consumer.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/jack.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <sound/rt5668.h>
#include "rl6231.h"
#include "rt5668.h"
#define RT5668_NUM_SUPPLIES …
static const char *rt5668_supply_names[RT5668_NUM_SUPPLIES] = …;
struct rt5668_priv { … };
static const struct reg_default rt5668_reg[] = …;
static bool rt5668_volatile_register(struct device *dev, unsigned int reg)
{ … }
static bool rt5668_readable_register(struct device *dev, unsigned int reg)
{ … }
static const DECLARE_TLV_DB_SCALE(hp_vol_tlv, -2250, 150, 0);
static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0);
static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0);
static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);
static const DECLARE_TLV_DB_RANGE(bst_tlv,
0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0),
2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0),
3, 5, TLV_DB_SCALE_ITEM(3000, 500, 0),
6, 6, TLV_DB_SCALE_ITEM(4400, 0, 0),
7, 7, TLV_DB_SCALE_ITEM(5000, 0, 0),
8, 8, TLV_DB_SCALE_ITEM(5200, 0, 0)
);
static const char * const rt5668_data_select[] = …;
static SOC_ENUM_SINGLE_DECL(rt5668_if2_adc_enum,
RT5668_DIG_INF2_DATA, RT5668_IF2_ADC_SEL_SFT, rt5668_data_select);
static SOC_ENUM_SINGLE_DECL(rt5668_if1_01_adc_enum,
RT5668_TDM_ADDA_CTRL_1, RT5668_IF1_ADC1_SEL_SFT, rt5668_data_select);
static SOC_ENUM_SINGLE_DECL(rt5668_if1_23_adc_enum,
RT5668_TDM_ADDA_CTRL_1, RT5668_IF1_ADC2_SEL_SFT, rt5668_data_select);
static SOC_ENUM_SINGLE_DECL(rt5668_if1_45_adc_enum,
RT5668_TDM_ADDA_CTRL_1, RT5668_IF1_ADC3_SEL_SFT, rt5668_data_select);
static SOC_ENUM_SINGLE_DECL(rt5668_if1_67_adc_enum,
RT5668_TDM_ADDA_CTRL_1, RT5668_IF1_ADC4_SEL_SFT, rt5668_data_select);
static const struct snd_kcontrol_new rt5668_if2_adc_swap_mux = …;
static const struct snd_kcontrol_new rt5668_if1_01_adc_swap_mux = …;
static const struct snd_kcontrol_new rt5668_if1_23_adc_swap_mux = …;
static const struct snd_kcontrol_new rt5668_if1_45_adc_swap_mux = …;
static const struct snd_kcontrol_new rt5668_if1_67_adc_swap_mux = …;
static void rt5668_reset(struct regmap *regmap)
{ … }
int rt5668_sel_asrc_clk_src(struct snd_soc_component *component,
unsigned int filter_mask, unsigned int clk_src)
{ … }
EXPORT_SYMBOL_GPL(…);
static int rt5668_button_detect(struct snd_soc_component *component)
{ … }
static void rt5668_enable_push_button_irq(struct snd_soc_component *component,
bool enable)
{ … }
static int rt5668_headset_detect(struct snd_soc_component *component,
int jack_insert)
{ … }
static irqreturn_t rt5668_irq(int irq, void *data)
{ … }
static void rt5668_jd_check_handler(struct work_struct *work)
{ … }
static int rt5668_set_jack_detect(struct snd_soc_component *component,
struct snd_soc_jack *hs_jack, void *data)
{ … }
static void rt5668_jack_detect_handler(struct work_struct *work)
{ … }
static const struct snd_kcontrol_new rt5668_snd_controls[] = …;
static int rt5668_div_sel(struct rt5668_priv *rt5668,
int target, const int div[], int size)
{ … }
static int set_dmic_clk(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int set_filter_clk(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int is_sys_clk_from_pll1(struct snd_soc_dapm_widget *w,
struct snd_soc_dapm_widget *sink)
{ … }
static int is_using_asrc(struct snd_soc_dapm_widget *w,
struct snd_soc_dapm_widget *sink)
{ … }
static const struct snd_kcontrol_new rt5668_sto1_adc_l_mix[] = …;
static const struct snd_kcontrol_new rt5668_sto1_adc_r_mix[] = …;
static const struct snd_kcontrol_new rt5668_dac_l_mix[] = …;
static const struct snd_kcontrol_new rt5668_dac_r_mix[] = …;
static const struct snd_kcontrol_new rt5668_sto1_dac_l_mix[] = …;
static const struct snd_kcontrol_new rt5668_sto1_dac_r_mix[] = …;
static const struct snd_kcontrol_new rt5668_rec1_l_mix[] = …;
static const char * const rt5668_sto1_adc1_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5668_sto1_adc1l_enum, RT5668_STO1_ADC_MIXER,
RT5668_STO1_ADC1L_SRC_SFT, rt5668_sto1_adc1_src);
static const struct snd_kcontrol_new rt5668_sto1_adc1l_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5668_sto1_adc1r_enum, RT5668_STO1_ADC_MIXER,
RT5668_STO1_ADC1R_SRC_SFT, rt5668_sto1_adc1_src);
static const struct snd_kcontrol_new rt5668_sto1_adc1r_mux = …;
static const char * const rt5668_sto1_adc_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5668_sto1_adcl_enum, RT5668_STO1_ADC_MIXER,
RT5668_STO1_ADCL_SRC_SFT, rt5668_sto1_adc_src);
static const struct snd_kcontrol_new rt5668_sto1_adcl_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5668_sto1_adcr_enum, RT5668_STO1_ADC_MIXER,
RT5668_STO1_ADCR_SRC_SFT, rt5668_sto1_adc_src);
static const struct snd_kcontrol_new rt5668_sto1_adcr_mux = …;
static const char * const rt5668_sto1_adc2_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5668_sto1_adc2l_enum, RT5668_STO1_ADC_MIXER,
RT5668_STO1_ADC2L_SRC_SFT, rt5668_sto1_adc2_src);
static const struct snd_kcontrol_new rt5668_sto1_adc2l_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5668_sto1_adc2r_enum, RT5668_STO1_ADC_MIXER,
RT5668_STO1_ADC2R_SRC_SFT, rt5668_sto1_adc2_src);
static const struct snd_kcontrol_new rt5668_sto1_adc2r_mux = …;
static const unsigned int rt5668_if1_adc_slot_values[] = …;
static const char * const rt5668_if1_adc_slot_src[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(rt5668_if1_adc_slot_enum,
RT5668_TDM_CTRL, RT5668_TDM_ADC_LCA_SFT, RT5668_TDM_ADC_LCA_MASK,
rt5668_if1_adc_slot_src, rt5668_if1_adc_slot_values);
static const struct snd_kcontrol_new rt5668_if1_adc_slot_mux = …;
static const char * const rt5668_alg_dac1_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5668_alg_dac_l1_enum, RT5668_A_DAC1_MUX,
RT5668_A_DACL1_SFT, rt5668_alg_dac1_src);
static const struct snd_kcontrol_new rt5668_alg_dac_l1_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5668_alg_dac_r1_enum, RT5668_A_DAC1_MUX,
RT5668_A_DACR1_SFT, rt5668_alg_dac1_src);
static const struct snd_kcontrol_new rt5668_alg_dac_r1_mux = …;
static const struct snd_kcontrol_new hpol_switch = …;
static const struct snd_kcontrol_new hpor_switch = …;
static int rt5668_hp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int set_dmic_power(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt5655_set_verf(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const unsigned int rt5668_adcdat_pin_values[] = …;
static const char * const rt5668_adcdat_pin_select[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(rt5668_adcdat_pin_enum,
RT5668_GPIO_CTRL_1, RT5668_GP4_PIN_SFT, RT5668_GP4_PIN_MASK,
rt5668_adcdat_pin_select, rt5668_adcdat_pin_values);
static const struct snd_kcontrol_new rt5668_adcdat_pin_ctrl = …;
static const struct snd_soc_dapm_widget rt5668_dapm_widgets[] = …;
static const struct snd_soc_dapm_route rt5668_dapm_routes[] = …;
static int rt5668_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
unsigned int rx_mask, int slots, int slot_width)
{ … }
static int rt5668_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ … }
static int rt5668_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
static int rt5668_set_component_sysclk(struct snd_soc_component *component,
int clk_id, int source, unsigned int freq, int dir)
{ … }
static int rt5668_set_component_pll(struct snd_soc_component *component,
int pll_id, int source, unsigned int freq_in,
unsigned int freq_out)
{ … }
static int rt5668_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio)
{ … }
static int rt5668_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static int rt5668_probe(struct snd_soc_component *component)
{ … }
static void rt5668_remove(struct snd_soc_component *component)
{ … }
#ifdef CONFIG_PM
static int rt5668_suspend(struct snd_soc_component *component)
{ … }
static int rt5668_resume(struct snd_soc_component *component)
{ … }
#else
#define rt5668_suspend …
#define rt5668_resume …
#endif
#define RT5668_STEREO_RATES …
#define RT5668_FORMATS …
static const struct snd_soc_dai_ops rt5668_aif1_dai_ops = …;
static const struct snd_soc_dai_ops rt5668_aif2_dai_ops = …;
static struct snd_soc_dai_driver rt5668_dai[] = …;
static const struct snd_soc_component_driver soc_component_dev_rt5668 = …;
static const struct regmap_config rt5668_regmap = …;
static const struct i2c_device_id rt5668_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, rt5668_i2c_id);
static int rt5668_parse_dt(struct rt5668_priv *rt5668, struct device *dev)
{ … }
static void rt5668_calibrate(struct rt5668_priv *rt5668)
{ … }
static int rt5668_i2c_probe(struct i2c_client *i2c)
{ … }
static void rt5668_i2c_shutdown(struct i2c_client *client)
{ … }
#ifdef CONFIG_OF
static const struct of_device_id rt5668_of_match[] = …;
MODULE_DEVICE_TABLE(of, rt5668_of_match);
#endif
#ifdef CONFIG_ACPI
static const struct acpi_device_id rt5668_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, rt5668_acpi_match);
#endif
static struct i2c_driver rt5668_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;