#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/fs.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irqdomain.h>
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/spi/spi.h>
#include <linux/workqueue.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 "rt5677.h"
#include "rt5677-spi.h"
#define RT5677_DEVICE_ID …
#define RT5677_DSP_BOOT_VECTOR …
#define RT5677_MODEL_ADDR …
#define RT5677_PR_RANGE_BASE …
#define RT5677_PR_SPACING …
#define RT5677_PR_BASE …
static const struct regmap_range_cfg rt5677_ranges[] = …;
static const struct reg_sequence init_list[] = …;
#define RT5677_INIT_REG_LEN …
static const struct reg_default rt5677_reg[] = …;
static bool rt5677_volatile_register(struct device *dev, unsigned int reg)
{ … }
static bool rt5677_readable_register(struct device *dev, unsigned int reg)
{ … }
static int rt5677_dsp_mode_i2c_write_addr(struct rt5677_priv *rt5677,
unsigned int addr, unsigned int value, unsigned int opcode)
{ … }
static int rt5677_dsp_mode_i2c_read_addr(
struct rt5677_priv *rt5677, unsigned int addr, unsigned int *value)
{ … }
static int rt5677_dsp_mode_i2c_write(struct rt5677_priv *rt5677,
unsigned int reg, unsigned int value)
{ … }
static int rt5677_dsp_mode_i2c_read(
struct rt5677_priv *rt5677, unsigned int reg, unsigned int *value)
{ … }
static void rt5677_set_dsp_mode(struct rt5677_priv *rt5677, bool on)
{ … }
static unsigned int rt5677_set_vad_source(struct rt5677_priv *rt5677)
{ … }
static int rt5677_parse_and_load_dsp(struct rt5677_priv *rt5677, const u8 *buf,
unsigned int len)
{ … }
static int rt5677_load_dsp_from_file(struct rt5677_priv *rt5677)
{ … }
static int rt5677_set_dsp_vad(struct snd_soc_component *component, bool on)
{ … }
static void rt5677_dsp_work(struct work_struct *work)
{ … }
static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6525, 75, 0);
static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -1725, 75, 0);
static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);
static const DECLARE_TLV_DB_SCALE(st_vol_tlv, -4650, 150, 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 int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new rt5677_snd_controls[] = …;
static int set_dmic_clk(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
static int is_using_asrc(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
static int can_use_asrc(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
int rt5677_sel_asrc_clk_src(struct snd_soc_component *component,
unsigned int filter_mask, unsigned int clk_src)
{ … }
EXPORT_SYMBOL_GPL(…);
static int rt5677_dmic_use_asrc(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{ … }
static const struct snd_kcontrol_new rt5677_sto1_adc_l_mix[] = …;
static const struct snd_kcontrol_new rt5677_sto1_adc_r_mix[] = …;
static const struct snd_kcontrol_new rt5677_sto2_adc_l_mix[] = …;
static const struct snd_kcontrol_new rt5677_sto2_adc_r_mix[] = …;
static const struct snd_kcontrol_new rt5677_sto3_adc_l_mix[] = …;
static const struct snd_kcontrol_new rt5677_sto3_adc_r_mix[] = …;
static const struct snd_kcontrol_new rt5677_sto4_adc_l_mix[] = …;
static const struct snd_kcontrol_new rt5677_sto4_adc_r_mix[] = …;
static const struct snd_kcontrol_new rt5677_mono_adc_l_mix[] = …;
static const struct snd_kcontrol_new rt5677_mono_adc_r_mix[] = …;
static const struct snd_kcontrol_new rt5677_dac_l_mix[] = …;
static const struct snd_kcontrol_new rt5677_dac_r_mix[] = …;
static const struct snd_kcontrol_new rt5677_sto1_dac_l_mix[] = …;
static const struct snd_kcontrol_new rt5677_sto1_dac_r_mix[] = …;
static const struct snd_kcontrol_new rt5677_mono_dac_l_mix[] = …;
static const struct snd_kcontrol_new rt5677_mono_dac_r_mix[] = …;
static const struct snd_kcontrol_new rt5677_dd1_l_mix[] = …;
static const struct snd_kcontrol_new rt5677_dd1_r_mix[] = …;
static const struct snd_kcontrol_new rt5677_dd2_l_mix[] = …;
static const struct snd_kcontrol_new rt5677_dd2_r_mix[] = …;
static const struct snd_kcontrol_new rt5677_ob_01_mix[] = …;
static const struct snd_kcontrol_new rt5677_ob_23_mix[] = …;
static const struct snd_kcontrol_new rt5677_ob_4_mix[] = …;
static const struct snd_kcontrol_new rt5677_ob_5_mix[] = …;
static const struct snd_kcontrol_new rt5677_ob_6_mix[] = …;
static const struct snd_kcontrol_new rt5677_ob_7_mix[] = …;
static const char * const rt5677_dac1_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_dac1_enum, RT5677_ADC_IF_DSP_DAC1_MIXER,
RT5677_DAC1_L_SEL_SFT, rt5677_dac1_src);
static const struct snd_kcontrol_new rt5677_dac1_mux = …;
static const char * const rt5677_adda1_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_adda1_enum, RT5677_ADC_IF_DSP_DAC1_MIXER,
RT5677_ADDA1_SEL_SFT, rt5677_adda1_src);
static const struct snd_kcontrol_new rt5677_adda1_mux = …;
static const char * const rt5677_dac2l_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_dac2l_enum, RT5677_IF_DSP_DAC2_MIXER,
RT5677_SEL_DAC2_L_SRC_SFT, rt5677_dac2l_src);
static const struct snd_kcontrol_new rt5677_dac2_l_mux = …;
static const char * const rt5677_dac2r_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_dac2r_enum, RT5677_IF_DSP_DAC2_MIXER,
RT5677_SEL_DAC2_R_SRC_SFT, rt5677_dac2r_src);
static const struct snd_kcontrol_new rt5677_dac2_r_mux = …;
static const char * const rt5677_dac3l_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_dac3l_enum, RT5677_IF_DSP_DAC3_4_MIXER,
RT5677_SEL_DAC3_L_SRC_SFT, rt5677_dac3l_src);
static const struct snd_kcontrol_new rt5677_dac3_l_mux = …;
static const char * const rt5677_dac3r_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_dac3r_enum, RT5677_IF_DSP_DAC3_4_MIXER,
RT5677_SEL_DAC3_R_SRC_SFT, rt5677_dac3r_src);
static const struct snd_kcontrol_new rt5677_dac3_r_mux = …;
static const char * const rt5677_dac4l_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_dac4l_enum, RT5677_IF_DSP_DAC3_4_MIXER,
RT5677_SEL_DAC4_L_SRC_SFT, rt5677_dac4l_src);
static const struct snd_kcontrol_new rt5677_dac4_l_mux = …;
static const char * const rt5677_dac4r_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_dac4r_enum, RT5677_IF_DSP_DAC3_4_MIXER,
RT5677_SEL_DAC4_R_SRC_SFT, rt5677_dac4r_src);
static const struct snd_kcontrol_new rt5677_dac4_r_mux = …;
static const char * const rt5677_iob_bypass_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_ob01_bypass_src_enum, RT5677_DSP_IN_OUTB_CTRL,
RT5677_SEL_SRC_OB01_SFT, rt5677_iob_bypass_src);
static const struct snd_kcontrol_new rt5677_ob01_bypass_src_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_ob23_bypass_src_enum, RT5677_DSP_IN_OUTB_CTRL,
RT5677_SEL_SRC_OB23_SFT, rt5677_iob_bypass_src);
static const struct snd_kcontrol_new rt5677_ob23_bypass_src_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_ib01_bypass_src_enum, RT5677_DSP_IN_OUTB_CTRL,
RT5677_SEL_SRC_IB01_SFT, rt5677_iob_bypass_src);
static const struct snd_kcontrol_new rt5677_ib01_bypass_src_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_ib23_bypass_src_enum, RT5677_DSP_IN_OUTB_CTRL,
RT5677_SEL_SRC_IB23_SFT, rt5677_iob_bypass_src);
static const struct snd_kcontrol_new rt5677_ib23_bypass_src_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_ib45_bypass_src_enum, RT5677_DSP_IN_OUTB_CTRL,
RT5677_SEL_SRC_IB45_SFT, rt5677_iob_bypass_src);
static const struct snd_kcontrol_new rt5677_ib45_bypass_src_mux = …;
static const char * const rt5677_stereo_adc2_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_stereo1_adc2_enum, RT5677_STO1_ADC_MIXER,
RT5677_SEL_STO1_ADC2_SFT, rt5677_stereo_adc2_src);
static const struct snd_kcontrol_new rt5677_sto1_adc2_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_stereo2_adc2_enum, RT5677_STO2_ADC_MIXER,
RT5677_SEL_STO2_ADC2_SFT, rt5677_stereo_adc2_src);
static const struct snd_kcontrol_new rt5677_sto2_adc2_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_stereo3_adc2_enum, RT5677_STO3_ADC_MIXER,
RT5677_SEL_STO3_ADC2_SFT, rt5677_stereo_adc2_src);
static const struct snd_kcontrol_new rt5677_sto3_adc2_mux = …;
static const char * const rt5677_dmic_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_mono_dmic_l_enum, RT5677_MONO_ADC_MIXER,
RT5677_SEL_MONO_DMIC_L_SFT, rt5677_dmic_src);
static const struct snd_kcontrol_new rt5677_mono_dmic_l_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_mono_dmic_r_enum, RT5677_MONO_ADC_MIXER,
RT5677_SEL_MONO_DMIC_R_SFT, rt5677_dmic_src);
static const struct snd_kcontrol_new rt5677_mono_dmic_r_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_stereo1_dmic_enum, RT5677_STO1_ADC_MIXER,
RT5677_SEL_STO1_DMIC_SFT, rt5677_dmic_src);
static const struct snd_kcontrol_new rt5677_sto1_dmic_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_stereo2_dmic_enum, RT5677_STO2_ADC_MIXER,
RT5677_SEL_STO2_DMIC_SFT, rt5677_dmic_src);
static const struct snd_kcontrol_new rt5677_sto2_dmic_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_stereo3_dmic_enum, RT5677_STO3_ADC_MIXER,
RT5677_SEL_STO3_DMIC_SFT, rt5677_dmic_src);
static const struct snd_kcontrol_new rt5677_sto3_dmic_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_stereo4_dmic_enum, RT5677_STO4_ADC_MIXER,
RT5677_SEL_STO4_DMIC_SFT, rt5677_dmic_src);
static const struct snd_kcontrol_new rt5677_sto4_dmic_mux = …;
static const char * const rt5677_stereo2_adc_lr_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_stereo2_adc_lr_enum, RT5677_STO2_ADC_MIXER,
RT5677_SEL_STO2_LR_MIX_SFT, rt5677_stereo2_adc_lr_src);
static const struct snd_kcontrol_new rt5677_sto2_adc_lr_mux = …;
static const char * const rt5677_stereo_adc1_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_stereo1_adc1_enum, RT5677_STO1_ADC_MIXER,
RT5677_SEL_STO1_ADC1_SFT, rt5677_stereo_adc1_src);
static const struct snd_kcontrol_new rt5677_sto1_adc1_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_stereo2_adc1_enum, RT5677_STO2_ADC_MIXER,
RT5677_SEL_STO2_ADC1_SFT, rt5677_stereo_adc1_src);
static const struct snd_kcontrol_new rt5677_sto2_adc1_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_stereo3_adc1_enum, RT5677_STO3_ADC_MIXER,
RT5677_SEL_STO3_ADC1_SFT, rt5677_stereo_adc1_src);
static const struct snd_kcontrol_new rt5677_sto3_adc1_mux = …;
static const char * const rt5677_mono_adc2_l_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_mono_adc2_l_enum, RT5677_MONO_ADC_MIXER,
RT5677_SEL_MONO_ADC_L2_SFT, rt5677_mono_adc2_l_src);
static const struct snd_kcontrol_new rt5677_mono_adc2_l_mux = …;
static const char * const rt5677_mono_adc1_l_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_mono_adc1_l_enum, RT5677_MONO_ADC_MIXER,
RT5677_SEL_MONO_ADC_L1_SFT, rt5677_mono_adc1_l_src);
static const struct snd_kcontrol_new rt5677_mono_adc1_l_mux = …;
static const char * const rt5677_mono_adc2_r_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_mono_adc2_r_enum, RT5677_MONO_ADC_MIXER,
RT5677_SEL_MONO_ADC_R2_SFT, rt5677_mono_adc2_r_src);
static const struct snd_kcontrol_new rt5677_mono_adc2_r_mux = …;
static const char * const rt5677_mono_adc1_r_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_mono_adc1_r_enum, RT5677_MONO_ADC_MIXER,
RT5677_SEL_MONO_ADC_R1_SFT, rt5677_mono_adc1_r_src);
static const struct snd_kcontrol_new rt5677_mono_adc1_r_mux = …;
static const char * const rt5677_stereo4_adc2_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_stereo4_adc2_enum, RT5677_STO4_ADC_MIXER,
RT5677_SEL_STO4_ADC2_SFT, rt5677_stereo4_adc2_src);
static const struct snd_kcontrol_new rt5677_sto4_adc2_mux = …;
static const char * const rt5677_stereo4_adc1_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_stereo4_adc1_enum, RT5677_STO4_ADC_MIXER,
RT5677_SEL_STO4_ADC1_SFT, rt5677_stereo4_adc1_src);
static const struct snd_kcontrol_new rt5677_sto4_adc1_mux = …;
static const char * const rt5677_inbound01_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_inbound01_enum, RT5677_DSP_INB_CTRL1,
RT5677_IB01_SRC_SFT, rt5677_inbound01_src);
static const struct snd_kcontrol_new rt5677_ib01_src_mux = …;
static const char * const rt5677_inbound23_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_inbound23_enum, RT5677_DSP_INB_CTRL1,
RT5677_IB23_SRC_SFT, rt5677_inbound23_src);
static const struct snd_kcontrol_new rt5677_ib23_src_mux = …;
static const char * const rt5677_inbound45_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_inbound45_enum, RT5677_DSP_INB_CTRL1,
RT5677_IB45_SRC_SFT, rt5677_inbound45_src);
static const struct snd_kcontrol_new rt5677_ib45_src_mux = …;
static const char * const rt5677_inbound6_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_inbound6_enum, RT5677_DSP_INB_CTRL1,
RT5677_IB6_SRC_SFT, rt5677_inbound6_src);
static const struct snd_kcontrol_new rt5677_ib6_src_mux = …;
static const char * const rt5677_inbound7_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_inbound7_enum, RT5677_DSP_INB_CTRL2,
RT5677_IB7_SRC_SFT, rt5677_inbound7_src);
static const struct snd_kcontrol_new rt5677_ib7_src_mux = …;
static const char * const rt5677_inbound8_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_inbound8_enum, RT5677_DSP_INB_CTRL2,
RT5677_IB8_SRC_SFT, rt5677_inbound8_src);
static const struct snd_kcontrol_new rt5677_ib8_src_mux = …;
static const char * const rt5677_inbound9_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_inbound9_enum, RT5677_DSP_INB_CTRL2,
RT5677_IB9_SRC_SFT, rt5677_inbound9_src);
static const struct snd_kcontrol_new rt5677_ib9_src_mux = …;
static const char * const rt5677_vad_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_vad_enum, RT5677_VAD_CTRL4,
RT5677_VAD_SRC_SFT, rt5677_vad_src);
static const struct snd_kcontrol_new rt5677_vad_src_mux = …;
static const char * const rt5677_sidetone_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_sidetone_enum, RT5677_SIDETONE_CTRL,
RT5677_ST_SEL_SFT, rt5677_sidetone_src);
static const struct snd_kcontrol_new rt5677_sidetone_mux = …;
static const char * const rt5677_dac12_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_dac12_enum, RT5677_ANA_DAC1_2_3_SRC,
RT5677_ANA_DAC1_2_SRC_SEL_SFT, rt5677_dac12_src);
static const struct snd_kcontrol_new rt5677_dac12_mux = …;
static const char * const rt5677_dac3_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_dac3_enum, RT5677_ANA_DAC1_2_3_SRC,
RT5677_ANA_DAC3_SRC_SEL_SFT, rt5677_dac3_src);
static const struct snd_kcontrol_new rt5677_dac3_mux = …;
static const char * const rt5677_pdm_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_pdm1_l_enum, RT5677_PDM_OUT_CTRL,
RT5677_SEL_PDM1_L_SFT, rt5677_pdm_src);
static const struct snd_kcontrol_new rt5677_pdm1_l_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_pdm2_l_enum, RT5677_PDM_OUT_CTRL,
RT5677_SEL_PDM2_L_SFT, rt5677_pdm_src);
static const struct snd_kcontrol_new rt5677_pdm2_l_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_pdm1_r_enum, RT5677_PDM_OUT_CTRL,
RT5677_SEL_PDM1_R_SFT, rt5677_pdm_src);
static const struct snd_kcontrol_new rt5677_pdm1_r_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_pdm2_r_enum, RT5677_PDM_OUT_CTRL,
RT5677_SEL_PDM2_R_SFT, rt5677_pdm_src);
static const struct snd_kcontrol_new rt5677_pdm2_r_mux = …;
static const char * const rt5677_if12_adc1_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_adc1_enum, RT5677_TDM1_CTRL2,
RT5677_IF1_ADC1_SFT, rt5677_if12_adc1_src);
static const struct snd_kcontrol_new rt5677_if1_adc1_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_adc1_enum, RT5677_TDM2_CTRL2,
RT5677_IF2_ADC1_SFT, rt5677_if12_adc1_src);
static const struct snd_kcontrol_new rt5677_if2_adc1_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_slb_adc1_enum, RT5677_SLIMBUS_RX,
RT5677_SLB_ADC1_SFT, rt5677_if12_adc1_src);
static const struct snd_kcontrol_new rt5677_slb_adc1_mux = …;
static const char * const rt5677_if12_adc2_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_adc2_enum, RT5677_TDM1_CTRL2,
RT5677_IF1_ADC2_SFT, rt5677_if12_adc2_src);
static const struct snd_kcontrol_new rt5677_if1_adc2_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_adc2_enum, RT5677_TDM2_CTRL2,
RT5677_IF2_ADC2_SFT, rt5677_if12_adc2_src);
static const struct snd_kcontrol_new rt5677_if2_adc2_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_slb_adc2_enum, RT5677_SLIMBUS_RX,
RT5677_SLB_ADC2_SFT, rt5677_if12_adc2_src);
static const struct snd_kcontrol_new rt5677_slb_adc2_mux = …;
static const char * const rt5677_if12_adc3_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_adc3_enum, RT5677_TDM1_CTRL2,
RT5677_IF1_ADC3_SFT, rt5677_if12_adc3_src);
static const struct snd_kcontrol_new rt5677_if1_adc3_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_adc3_enum, RT5677_TDM2_CTRL2,
RT5677_IF2_ADC3_SFT, rt5677_if12_adc3_src);
static const struct snd_kcontrol_new rt5677_if2_adc3_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_slb_adc3_enum, RT5677_SLIMBUS_RX,
RT5677_SLB_ADC3_SFT, rt5677_if12_adc3_src);
static const struct snd_kcontrol_new rt5677_slb_adc3_mux = …;
static const char * const rt5677_if12_adc4_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_adc4_enum, RT5677_TDM1_CTRL2,
RT5677_IF1_ADC4_SFT, rt5677_if12_adc4_src);
static const struct snd_kcontrol_new rt5677_if1_adc4_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_adc4_enum, RT5677_TDM2_CTRL2,
RT5677_IF2_ADC4_SFT, rt5677_if12_adc4_src);
static const struct snd_kcontrol_new rt5677_if2_adc4_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_slb_adc4_enum, RT5677_SLIMBUS_RX,
RT5677_SLB_ADC4_SFT, rt5677_if12_adc4_src);
static const struct snd_kcontrol_new rt5677_slb_adc4_mux = …;
static const char * const rt5677_if34_adc_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if3_adc_enum, RT5677_IF3_DATA,
RT5677_IF3_ADC_IN_SFT, rt5677_if34_adc_src);
static const struct snd_kcontrol_new rt5677_if3_adc_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if4_adc_enum, RT5677_IF4_DATA,
RT5677_IF4_ADC_IN_SFT, rt5677_if34_adc_src);
static const struct snd_kcontrol_new rt5677_if4_adc_mux = …;
static const char * const rt5677_if12_adc_swap_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_adc1_swap_enum, RT5677_TDM1_CTRL1,
RT5677_IF1_ADC1_SWAP_SFT, rt5677_if12_adc_swap_src);
static const struct snd_kcontrol_new rt5677_if1_adc1_swap_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_adc2_swap_enum, RT5677_TDM1_CTRL1,
RT5677_IF1_ADC2_SWAP_SFT, rt5677_if12_adc_swap_src);
static const struct snd_kcontrol_new rt5677_if1_adc2_swap_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_adc3_swap_enum, RT5677_TDM1_CTRL1,
RT5677_IF1_ADC3_SWAP_SFT, rt5677_if12_adc_swap_src);
static const struct snd_kcontrol_new rt5677_if1_adc3_swap_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_adc4_swap_enum, RT5677_TDM1_CTRL1,
RT5677_IF1_ADC4_SWAP_SFT, rt5677_if12_adc_swap_src);
static const struct snd_kcontrol_new rt5677_if1_adc4_swap_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_adc1_swap_enum, RT5677_TDM2_CTRL1,
RT5677_IF1_ADC2_SWAP_SFT, rt5677_if12_adc_swap_src);
static const struct snd_kcontrol_new rt5677_if2_adc1_swap_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_adc2_swap_enum, RT5677_TDM2_CTRL1,
RT5677_IF2_ADC2_SWAP_SFT, rt5677_if12_adc_swap_src);
static const struct snd_kcontrol_new rt5677_if2_adc2_swap_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_adc3_swap_enum, RT5677_TDM2_CTRL1,
RT5677_IF2_ADC3_SWAP_SFT, rt5677_if12_adc_swap_src);
static const struct snd_kcontrol_new rt5677_if2_adc3_swap_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_adc4_swap_enum, RT5677_TDM2_CTRL1,
RT5677_IF2_ADC4_SWAP_SFT, rt5677_if12_adc_swap_src);
static const struct snd_kcontrol_new rt5677_if2_adc4_swap_mux = …;
static const char * const rt5677_if1_adc_tdm_swap_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_adc_tdm_swap_enum, RT5677_TDM1_CTRL2,
RT5677_IF1_ADC_CTRL_SFT, rt5677_if1_adc_tdm_swap_src);
static const struct snd_kcontrol_new rt5677_if1_adc_tdm_swap_mux = …;
static const char * const rt5677_if2_adc_tdm_swap_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_adc_tdm_swap_enum, RT5677_TDM2_CTRL2,
RT5677_IF2_ADC_CTRL_SFT, rt5677_if2_adc_tdm_swap_src);
static const struct snd_kcontrol_new rt5677_if2_adc_tdm_swap_mux = …;
static const char * const rt5677_if12_dac_tdm_sel_src[] = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_dac0_tdm_sel_enum, RT5677_TDM1_CTRL4,
RT5677_IF1_DAC0_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if1_dac0_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_dac1_tdm_sel_enum, RT5677_TDM1_CTRL4,
RT5677_IF1_DAC1_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if1_dac1_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_dac2_tdm_sel_enum, RT5677_TDM1_CTRL4,
RT5677_IF1_DAC2_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if1_dac2_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_dac3_tdm_sel_enum, RT5677_TDM1_CTRL4,
RT5677_IF1_DAC3_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if1_dac3_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_dac4_tdm_sel_enum, RT5677_TDM1_CTRL5,
RT5677_IF1_DAC4_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if1_dac4_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_dac5_tdm_sel_enum, RT5677_TDM1_CTRL5,
RT5677_IF1_DAC5_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if1_dac5_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_dac6_tdm_sel_enum, RT5677_TDM1_CTRL5,
RT5677_IF1_DAC6_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if1_dac6_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if1_dac7_tdm_sel_enum, RT5677_TDM1_CTRL5,
RT5677_IF1_DAC7_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if1_dac7_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_dac0_tdm_sel_enum, RT5677_TDM2_CTRL4,
RT5677_IF2_DAC0_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if2_dac0_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_dac1_tdm_sel_enum, RT5677_TDM2_CTRL4,
RT5677_IF2_DAC1_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if2_dac1_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_dac2_tdm_sel_enum, RT5677_TDM2_CTRL4,
RT5677_IF2_DAC2_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if2_dac2_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_dac3_tdm_sel_enum, RT5677_TDM2_CTRL4,
RT5677_IF2_DAC3_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if2_dac3_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_dac4_tdm_sel_enum, RT5677_TDM2_CTRL5,
RT5677_IF2_DAC4_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if2_dac4_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_dac5_tdm_sel_enum, RT5677_TDM2_CTRL5,
RT5677_IF2_DAC5_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if2_dac5_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_dac6_tdm_sel_enum, RT5677_TDM2_CTRL5,
RT5677_IF2_DAC6_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if2_dac6_tdm_sel_mux = …;
static SOC_ENUM_SINGLE_DECL(
rt5677_if2_dac7_tdm_sel_enum, RT5677_TDM2_CTRL5,
RT5677_IF2_DAC7_SFT, rt5677_if12_dac_tdm_sel_src);
static const struct snd_kcontrol_new rt5677_if2_dac7_tdm_sel_mux = …;
static int rt5677_bst1_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt5677_bst2_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt5677_set_micbias1_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt5677_if1_adc_tdm_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt5677_if2_adc_tdm_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt5677_vref_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt5677_filter_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = …;
static const struct snd_soc_dapm_route rt5677_dapm_routes[] = …;
static const struct snd_soc_dapm_route rt5677_dmic2_clk_1[] = …;
static const struct snd_soc_dapm_route rt5677_dmic2_clk_2[] = …;
static int rt5677_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ … }
static int rt5677_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
static int rt5677_set_dai_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int rt5677_pll_calc(const unsigned int freq_in,
const unsigned int freq_out, struct rl6231_pll_code *pll_code)
{ … }
static int rt5677_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
unsigned int freq_in, unsigned int freq_out)
{ … }
static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
unsigned int rx_mask, int slots, int slot_width)
{ … }
static int rt5677_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static int rt5677_update_gpio_bits(struct rt5677_priv *rt5677, unsigned offset, int m, int v)
{ … }
#ifdef CONFIG_GPIOLIB
static void rt5677_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{ … }
static int rt5677_gpio_direction_out(struct gpio_chip *chip,
unsigned offset, int value)
{ … }
static int rt5677_gpio_get(struct gpio_chip *chip, unsigned offset)
{ … }
static int rt5677_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
{ … }
static void rt5677_gpio_config(struct rt5677_priv *rt5677, unsigned offset,
int value)
{ … }
static int rt5677_to_irq(struct gpio_chip *chip, unsigned offset)
{ … }
static const struct gpio_chip rt5677_template_chip = …;
static void rt5677_init_gpio(struct i2c_client *i2c)
{ … }
static void rt5677_free_gpio(struct i2c_client *i2c)
{ … }
#else
static void rt5677_gpio_config(struct rt5677_priv *rt5677, unsigned offset,
int value)
{
}
static void rt5677_init_gpio(struct i2c_client *i2c)
{
}
static void rt5677_free_gpio(struct i2c_client *i2c)
{
}
#endif
static int rt5677_probe(struct snd_soc_component *component)
{ … }
static void rt5677_remove(struct snd_soc_component *component)
{ … }
#ifdef CONFIG_PM
static int rt5677_suspend(struct snd_soc_component *component)
{ … }
static int rt5677_resume(struct snd_soc_component *component)
{ … }
#else
#define rt5677_suspend …
#define rt5677_resume …
#endif
static int rt5677_read(void *context, unsigned int reg, unsigned int *val)
{ … }
static int rt5677_write(void *context, unsigned int reg, unsigned int val)
{ … }
#define RT5677_STEREO_RATES …
#define RT5677_FORMATS …
static const struct snd_soc_dai_ops rt5677_aif_dai_ops = …;
static const struct snd_soc_dai_ops rt5677_dsp_dai_ops = …;
static struct snd_soc_dai_driver rt5677_dai[] = …;
static const struct snd_soc_component_driver soc_component_dev_rt5677 = …;
static const struct regmap_config rt5677_regmap_physical = …;
static const struct regmap_config rt5677_regmap = …;
static const struct of_device_id rt5677_of_match[] = …;
MODULE_DEVICE_TABLE(of, rt5677_of_match);
static const struct acpi_device_id rt5677_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, rt5677_acpi_match);
static void rt5677_read_device_properties(struct rt5677_priv *rt5677,
struct device *dev)
{ … }
struct rt5677_irq_desc { … };
static const struct rt5677_irq_desc rt5677_irq_descs[] = …;
static bool rt5677_check_hotword(struct rt5677_priv *rt5677)
{ … }
static irqreturn_t rt5677_irq(int unused, void *data)
{ … }
static void rt5677_resume_irq_check(struct work_struct *work)
{ … }
static void rt5677_irq_bus_lock(struct irq_data *data)
{ … }
static void rt5677_irq_bus_sync_unlock(struct irq_data *data)
{ … }
static void rt5677_irq_enable(struct irq_data *data)
{ … }
static void rt5677_irq_disable(struct irq_data *data)
{ … }
static struct irq_chip rt5677_irq_chip = …;
static int rt5677_irq_map(struct irq_domain *h, unsigned int virq,
irq_hw_number_t hw)
{ … }
static const struct irq_domain_ops rt5677_domain_ops = …;
static int rt5677_init_irq(struct i2c_client *i2c)
{ … }
static int rt5677_i2c_probe(struct i2c_client *i2c)
{ … }
static void rt5677_i2c_remove(struct i2c_client *i2c)
{ … }
static struct i2c_driver rt5677_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_FIRMWARE(…) …;