#include <linux/platform_device.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/kthread.h>
#include <linux/sched.h>
#include <linux/mfd/mt6397/core.h>
#include <linux/regulator/consumer.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include "mt6358.h"
enum { … };
enum { … };
enum { … };
enum { … };
enum { … };
#define REG_STRIDE …
struct mt6358_priv { … };
int mt6358_set_mtkaif_protocol(struct snd_soc_component *cmpnt,
int mtkaif_protocol)
{ … }
EXPORT_SYMBOL_GPL(…);
static void playback_gpio_set(struct mt6358_priv *priv)
{ … }
static void playback_gpio_reset(struct mt6358_priv *priv)
{ … }
static void capture_gpio_set(struct mt6358_priv *priv)
{ … }
static void capture_gpio_reset(struct mt6358_priv *priv)
{ … }
static int mt6358_set_dcxo(struct mt6358_priv *priv, bool enable)
{ … }
static int mt6358_set_clksq(struct mt6358_priv *priv, bool enable)
{ … }
static int mt6358_set_aud_global_bias(struct mt6358_priv *priv, bool enable)
{ … }
static int mt6358_set_topck(struct mt6358_priv *priv, bool enable)
{ … }
static int mt6358_mtkaif_tx_enable(struct mt6358_priv *priv)
{ … }
static int mt6358_mtkaif_tx_disable(struct mt6358_priv *priv)
{ … }
int mt6358_mtkaif_calibration_enable(struct snd_soc_component *cmpnt)
{ … }
EXPORT_SYMBOL_GPL(…);
int mt6358_mtkaif_calibration_disable(struct snd_soc_component *cmpnt)
{ … }
EXPORT_SYMBOL_GPL(…);
int mt6358_set_mtkaif_calibration_phase(struct snd_soc_component *cmpnt,
int phase_1, int phase_2)
{ … }
EXPORT_SYMBOL_GPL(…);
enum { … };
#define DL_GAIN_N_10DB_REG …
#define DL_GAIN_N_40DB_REG …
#define DL_GAIN_REG_MASK …
static void hp_zcd_disable(struct mt6358_priv *priv)
{ … }
static void hp_main_output_ramp(struct mt6358_priv *priv, bool up)
{ … }
static void hp_aux_feedback_loop_gain_ramp(struct mt6358_priv *priv, bool up)
{ … }
static void hp_pull_down(struct mt6358_priv *priv, bool enable)
{ … }
static bool is_valid_hp_pga_idx(int reg_idx)
{ … }
static void headset_volume_ramp(struct mt6358_priv *priv, int from, int to)
{ … }
static int mt6358_put_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static void mt6358_restore_pga(struct mt6358_priv *priv);
static int mt6358_enable_wov_phase2(struct mt6358_priv *priv)
{ … }
static int mt6358_disable_wov_phase2(struct mt6358_priv *priv)
{ … }
static int mt6358_get_wov(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int mt6358_put_wov(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int mt6358_dmic_mode_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int mt6358_dmic_mode_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const DECLARE_TLV_DB_SCALE(playback_tlv, -1000, 100, 0);
static const DECLARE_TLV_DB_SCALE(pga_tlv, 0, 600, 0);
static const struct snd_kcontrol_new mt6358_snd_controls[] = …;
static const char * const lo_in_mux_map[] = …;
static int lo_in_mux_map_value[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(lo_in_mux_map_enum,
MT6358_AUDDEC_ANA_CON7,
RG_AUDLOLMUXINPUTSEL_VAUDP15_SFT,
RG_AUDLOLMUXINPUTSEL_VAUDP15_MASK,
lo_in_mux_map,
lo_in_mux_map_value);
static const struct snd_kcontrol_new lo_in_mux_control = …;
enum { … };
static const char * const hp_in_mux_map[] = …;
static int hp_in_mux_map_value[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(hpl_in_mux_map_enum,
SND_SOC_NOPM,
0,
HP_MUX_MASK,
hp_in_mux_map,
hp_in_mux_map_value);
static const struct snd_kcontrol_new hpl_in_mux_control = …;
static SOC_VALUE_ENUM_SINGLE_DECL(hpr_in_mux_map_enum,
SND_SOC_NOPM,
0,
HP_MUX_MASK,
hp_in_mux_map,
hp_in_mux_map_value);
static const struct snd_kcontrol_new hpr_in_mux_control = …;
enum { … };
static const char * const rcv_in_mux_map[] = …;
static int rcv_in_mux_map_value[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(rcv_in_mux_map_enum,
SND_SOC_NOPM,
0,
RCV_MUX_MASK,
rcv_in_mux_map,
rcv_in_mux_map_value);
static const struct snd_kcontrol_new rcv_in_mux_control = …;
static const char * const dac_in_mux_map[] = …;
static int dac_in_mux_map_value[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(dac_in_mux_map_enum,
MT6358_AFE_TOP_CON0,
DL_SINE_ON_SFT,
DL_SINE_ON_MASK,
dac_in_mux_map,
dac_in_mux_map_value);
static const struct snd_kcontrol_new dac_in_mux_control = …;
static SOC_VALUE_ENUM_SINGLE_DECL(aif_out_mux_map_enum,
MT6358_AFE_TOP_CON0,
UL_SINE_ON_SFT,
UL_SINE_ON_MASK,
dac_in_mux_map,
dac_in_mux_map_value);
static const struct snd_kcontrol_new aif_out_mux_control = …;
enum { … };
#define IS_DCC_BASE(type) …
static const char * const mic_type_mux_map[] = …;
static int mic_type_mux_map_value[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(mic_type_mux_map_enum,
SND_SOC_NOPM,
0,
MIC_TYPE_MUX_MASK,
mic_type_mux_map,
mic_type_mux_map_value);
static const struct snd_kcontrol_new mic_type_mux_control = …;
enum { … };
static const char * const adc_left_mux_map[] = …;
static int adc_mux_map_value[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(adc_left_mux_map_enum,
SND_SOC_NOPM,
0,
ADC_MUX_MASK,
adc_left_mux_map,
adc_mux_map_value);
static const struct snd_kcontrol_new adc_left_mux_control = …;
static const char * const adc_right_mux_map[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(adc_right_mux_map_enum,
SND_SOC_NOPM,
0,
ADC_MUX_MASK,
adc_right_mux_map,
adc_mux_map_value);
static const struct snd_kcontrol_new adc_right_mux_control = …;
enum { … };
static const char * const pga_mux_map[] = …;
static int pga_mux_map_value[] = …;
static SOC_VALUE_ENUM_SINGLE_DECL(pga_left_mux_map_enum,
SND_SOC_NOPM,
0,
PGA_MUX_MASK,
pga_mux_map,
pga_mux_map_value);
static const struct snd_kcontrol_new pga_left_mux_control = …;
static SOC_VALUE_ENUM_SINGLE_DECL(pga_right_mux_map_enum,
SND_SOC_NOPM,
0,
PGA_MUX_MASK,
pga_mux_map,
pga_mux_map_value);
static const struct snd_kcontrol_new pga_right_mux_control = …;
static int mt_clksq_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mt_sgen_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mt_aif_in_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mtk_hp_enable(struct mt6358_priv *priv)
{ … }
static int mtk_hp_disable(struct mt6358_priv *priv)
{ … }
static int mtk_hp_spk_enable(struct mt6358_priv *priv)
{ … }
static int mtk_hp_spk_disable(struct mt6358_priv *priv)
{ … }
static int mt_hp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mt_rcv_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mt_aif_out_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mt_adc_supply_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mt6358_amic_enable(struct mt6358_priv *priv)
{ … }
static void mt6358_amic_disable(struct mt6358_priv *priv)
{ … }
static int mt6358_dmic_enable(struct mt6358_priv *priv)
{ … }
static void mt6358_dmic_disable(struct mt6358_priv *priv)
{ … }
static void mt6358_restore_pga(struct mt6358_priv *priv)
{ … }
static int mt_mic_type_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mt_adc_l_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mt_adc_r_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mt_pga_left_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mt_pga_right_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static int mt_delay_250_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static const struct snd_soc_dapm_widget mt6358_dapm_widgets[] = …;
static const struct snd_soc_dapm_route mt6358_dapm_routes[] = …;
static int mt6358_codec_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static const struct snd_soc_dai_ops mt6358_codec_dai_ops = …;
#define MT6358_FORMATS …
static struct snd_soc_dai_driver mt6358_dai_driver[] = …;
static void mt6358_codec_init_reg(struct mt6358_priv *priv)
{ … }
static int mt6358_codec_probe(struct snd_soc_component *cmpnt)
{ … }
static const struct snd_soc_component_driver mt6358_soc_component_driver = …;
static void mt6358_parse_dt(struct mt6358_priv *priv)
{ … }
static int mt6358_platform_driver_probe(struct platform_device *pdev)
{ … }
static const struct of_device_id mt6358_of_match[] = …;
MODULE_DEVICE_TABLE(of, mt6358_of_match);
static struct platform_driver mt6358_platform_driver = …;
module_platform_driver(…) …
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;