#include <linux/acpi.h>
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/regmap.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/firmware.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 "rl6231.h"
#include "rt5514.h"
#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI)
#include "rt5514-spi.h"
#endif
static const struct reg_sequence rt5514_i2c_patch[] = …;
static const struct reg_sequence rt5514_patch[] = …;
static const struct reg_default rt5514_reg[] = …;
static void rt5514_enable_dsp_prepare(struct rt5514_priv *rt5514)
{ … }
static bool rt5514_volatile_register(struct device *dev, unsigned int reg)
{ … }
static bool rt5514_readable_register(struct device *dev, unsigned int reg)
{ … }
static bool rt5514_i2c_readable_register(struct device *dev,
unsigned int reg)
{ … }
static const DECLARE_TLV_DB_RANGE(bst_tlv,
0, 2, TLV_DB_SCALE_ITEM(-300, 300, 0),
3, 3, TLV_DB_SCALE_ITEM(450, 0, 0),
4, 4, TLV_DB_SCALE_ITEM(750, 0, 0),
5, 5, TLV_DB_SCALE_ITEM(950, 0, 0),
6, 6, TLV_DB_SCALE_ITEM(1200, 0, 0),
7, 7, TLV_DB_SCALE_ITEM(1400, 0, 0),
8, 8, TLV_DB_SCALE_ITEM(1700, 0, 0)
);
static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -1725, 75, 0);
static int rt5514_dsp_voice_wake_up_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int rt5514_calibration(struct rt5514_priv *rt5514, bool on)
{ … }
static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new rt5514_snd_controls[] = …;
static const struct snd_kcontrol_new rt5514_sto1_adc_l_mix[] = …;
static const struct snd_kcontrol_new rt5514_sto1_adc_r_mix[] = …;
static const struct snd_kcontrol_new rt5514_sto2_adc_l_mix[] = …;
static const struct snd_kcontrol_new rt5514_sto2_adc_r_mix[] = …;
static const char * const rt5514_dmic_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5514_stereo1_dmic_enum, RT5514_DIG_SOURCE_CTRL,
RT5514_AD0_DMIC_INPUT_SEL_SFT, rt5514_dmic_src);
static const struct snd_kcontrol_new rt5514_sto1_dmic_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5514_stereo2_dmic_enum, RT5514_DIG_SOURCE_CTRL,
RT5514_AD1_DMIC_INPUT_SEL_SFT, rt5514_dmic_src);
static const struct snd_kcontrol_new rt5514_sto2_dmic_mux = …;
static int rt5514_calc_dmic_clk(struct snd_soc_component *component, int rate)
{ … }
static int rt5514_set_dmic_clk(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt5514_is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
static int rt5514_i2s_use_asrc(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
static const struct snd_soc_dapm_widget rt5514_dapm_widgets[] = …;
static const struct snd_soc_dapm_route rt5514_dapm_routes[] = …;
static int rt5514_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ … }
static int rt5514_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
static int rt5514_set_dai_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int rt5514_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
unsigned int freq_in, unsigned int freq_out)
{ … }
static int rt5514_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
unsigned int rx_mask, int slots, int slot_width)
{ … }
static int rt5514_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static int rt5514_probe(struct snd_soc_component *component)
{ … }
static int rt5514_i2c_read(void *context, unsigned int reg, unsigned int *val)
{ … }
static int rt5514_i2c_write(void *context, unsigned int reg, unsigned int val)
{ … }
#define RT5514_STEREO_RATES …
#define RT5514_FORMATS …
static const struct snd_soc_dai_ops rt5514_aif_dai_ops = …;
static struct snd_soc_dai_driver rt5514_dai[] = …;
static const struct snd_soc_component_driver soc_component_dev_rt5514 = …;
static const struct regmap_config rt5514_i2c_regmap = …;
static const struct regmap_config rt5514_regmap = …;
static const struct i2c_device_id rt5514_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, rt5514_i2c_id);
#if defined(CONFIG_OF)
static const struct of_device_id rt5514_of_match[] = …;
MODULE_DEVICE_TABLE(of, rt5514_of_match);
#endif
#ifdef CONFIG_ACPI
static const struct acpi_device_id rt5514_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, rt5514_acpi_match);
#endif
static int rt5514_parse_dp(struct rt5514_priv *rt5514, struct device *dev)
{ … }
static __maybe_unused int rt5514_i2c_resume(struct device *dev)
{ … }
static int rt5514_i2c_probe(struct i2c_client *i2c)
{ … }
static const struct dev_pm_ops rt5514_i2_pm_ops = …;
static struct i2c_driver rt5514_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;