#include <linux/bitops.h>
#include <sound/core.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <sound/initval.h>
#include <sound/jack.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/pm_runtime.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <linux/soundwire/sdw_registers.h>
#include <linux/slab.h>
#include <sound/soc-dapm.h>
#include <sound/tlv.h>
#include "rt712-sdca.h"
static int rt712_sdca_index_write(struct rt712_sdca_priv *rt712,
unsigned int nid, unsigned int reg, unsigned int value)
{ … }
static int rt712_sdca_index_read(struct rt712_sdca_priv *rt712,
unsigned int nid, unsigned int reg, unsigned int *value)
{ … }
static int rt712_sdca_index_update_bits(struct rt712_sdca_priv *rt712,
unsigned int nid, unsigned int reg, unsigned int mask, unsigned int val)
{ … }
static int rt712_sdca_calibration(struct rt712_sdca_priv *rt712)
{ … }
static unsigned int rt712_sdca_button_detect(struct rt712_sdca_priv *rt712)
{ … }
static int rt712_sdca_headset_detect(struct rt712_sdca_priv *rt712)
{ … }
static void rt712_sdca_jack_detect_handler(struct work_struct *work)
{ … }
static void rt712_sdca_btn_check_handler(struct work_struct *work)
{ … }
static void rt712_sdca_jack_init(struct rt712_sdca_priv *rt712)
{ … }
static int rt712_sdca_set_jack_detect(struct snd_soc_component *component,
struct snd_soc_jack *hs_jack, void *data)
{ … }
static int rt712_sdca_set_gain_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int rt712_sdca_set_gain_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int rt712_sdca_set_fu0f_capture_ctl(struct rt712_sdca_priv *rt712)
{ … }
static int rt712_sdca_fu0f_capture_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int rt712_sdca_fu0f_capture_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -6525, 75, 0);
static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, -1725, 75, 0);
static const DECLARE_TLV_DB_SCALE(boost_vol_tlv, 0, 1000, 0);
static const struct snd_kcontrol_new rt712_sdca_controls[] = …;
static const struct snd_kcontrol_new rt712_sdca_spk_controls[] = …;
static int rt712_sdca_mux_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int rt712_sdca_mux_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const char * const adc_mux_text[] = …;
static SOC_ENUM_SINGLE_DECL(
rt712_adc23_enum, SND_SOC_NOPM, 0, adc_mux_text);
static const struct snd_kcontrol_new rt712_sdca_adc23_mux = …;
static int rt712_sdca_fu05_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt712_sdca_fu0f_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt712_sdca_pde40_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt712_sdca_pde12_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt712_sdca_pde23_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const struct snd_kcontrol_new rt712_spk_l_dac = …;
static const struct snd_kcontrol_new rt712_spk_r_dac = …;
static const struct snd_soc_dapm_widget rt712_sdca_dapm_widgets[] = …;
static const struct snd_soc_dapm_route rt712_sdca_audio_map[] = …;
static const struct snd_soc_dapm_widget rt712_sdca_spk_dapm_widgets[] = …;
static const struct snd_soc_dapm_route rt712_sdca_spk_dapm_routes[] = …;
static int rt712_sdca_parse_dt(struct rt712_sdca_priv *rt712, struct device *dev)
{ … }
static int rt712_sdca_probe(struct snd_soc_component *component)
{ … }
static int rt712_sdca_dmic_set_gain_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int rt712_sdca_dmic_set_gain_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int rt712_sdca_set_fu1e_capture_ctl(struct rt712_sdca_priv *rt712)
{ … }
static int rt712_sdca_dmic_fu1e_capture_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int rt712_sdca_dmic_fu1e_capture_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int rt712_sdca_fu_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ … }
#define RT712_SDCA_PR_VALUE(xreg_base, xcount, xmax, xinvert) …
#define RT712_SDCA_FU_CTRL(xname, reg_base, xmax, xinvert, xcount) …
#define RT712_SDCA_EXT_TLV(xname, reg_base, xhandler_get,\
xhandler_put, xcount, xmax, tlv_array) …
static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -1725, 75, 0);
static const DECLARE_TLV_DB_SCALE(dmic_vol_tlv, 0, 1000, 0);
static const struct snd_kcontrol_new rt712_sdca_dmic_snd_controls[] = …;
static int rt712_sdca_dmic_mux_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int rt712_sdca_dmic_mux_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const char * const adc_dmic_mux_text[] = …;
static SOC_ENUM_SINGLE_DECL(
rt712_adc0a_enum, SND_SOC_NOPM, 0, adc_dmic_mux_text);
static SOC_ENUM_SINGLE_DECL(
rt712_adc0b_enum, SND_SOC_NOPM, 0, adc_dmic_mux_text);
static const struct snd_kcontrol_new rt712_sdca_dmic_adc0a_mux = …;
static const struct snd_kcontrol_new rt712_sdca_dmic_adc0b_mux = …;
static int rt712_sdca_dmic_fu1e_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int rt712_sdca_dmic_pde11_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const struct snd_soc_dapm_widget rt712_sdca_dmic_dapm_widgets[] = …;
static const struct snd_soc_dapm_route rt712_sdca_dmic_audio_map[] = …;
static int rt712_sdca_dmic_probe(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_sdca_dev_rt712 = …;
static const struct snd_soc_component_driver soc_sdca_dev_rt712_dmic = …;
static int rt712_sdca_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
int direction)
{ … }
static void rt712_sdca_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static int rt712_sdca_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int rt712_sdca_pcm_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
#define RT712_STEREO_RATES …
#define RT712_FORMATS …
static const struct snd_soc_dai_ops rt712_sdca_ops = …;
static struct snd_soc_dai_driver rt712_sdca_dai[] = …;
static struct snd_soc_dai_driver rt712_sdca_dmic_dai[] = …;
int rt712_sdca_init(struct device *dev, struct regmap *regmap,
struct regmap *mbq_regmap, struct sdw_slave *slave)
{ … }
static void rt712_sdca_va_io_init(struct rt712_sdca_priv *rt712)
{ … }
static void rt712_sdca_vb_io_init(struct rt712_sdca_priv *rt712)
{ … }
int rt712_sdca_io_init(struct device *dev, struct sdw_slave *slave)
{ … }
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;