#include <linux/delay.h>
#include <linux/gcd.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pm_runtime.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/tlv.h>
#include <linux/mfd/arizona/core.h>
#include <linux/mfd/arizona/registers.h>
#include "arizona.h"
#define ARIZONA_AIF_BCLK_CTRL …
#define ARIZONA_AIF_TX_PIN_CTRL …
#define ARIZONA_AIF_RX_PIN_CTRL …
#define ARIZONA_AIF_RATE_CTRL …
#define ARIZONA_AIF_FORMAT …
#define ARIZONA_AIF_TX_BCLK_RATE …
#define ARIZONA_AIF_RX_BCLK_RATE …
#define ARIZONA_AIF_FRAME_CTRL_1 …
#define ARIZONA_AIF_FRAME_CTRL_2 …
#define ARIZONA_AIF_FRAME_CTRL_3 …
#define ARIZONA_AIF_FRAME_CTRL_4 …
#define ARIZONA_AIF_FRAME_CTRL_5 …
#define ARIZONA_AIF_FRAME_CTRL_6 …
#define ARIZONA_AIF_FRAME_CTRL_7 …
#define ARIZONA_AIF_FRAME_CTRL_8 …
#define ARIZONA_AIF_FRAME_CTRL_9 …
#define ARIZONA_AIF_FRAME_CTRL_10 …
#define ARIZONA_AIF_FRAME_CTRL_11 …
#define ARIZONA_AIF_FRAME_CTRL_12 …
#define ARIZONA_AIF_FRAME_CTRL_13 …
#define ARIZONA_AIF_FRAME_CTRL_14 …
#define ARIZONA_AIF_FRAME_CTRL_15 …
#define ARIZONA_AIF_FRAME_CTRL_16 …
#define ARIZONA_AIF_FRAME_CTRL_17 …
#define ARIZONA_AIF_FRAME_CTRL_18 …
#define ARIZONA_AIF_TX_ENABLES …
#define ARIZONA_AIF_RX_ENABLES …
#define ARIZONA_AIF_FORCE_WRITE …
#define ARIZONA_FLL_VCO_CORNER …
#define ARIZONA_FLL_MAX_FREF …
#define ARIZONA_FLL_MIN_FVCO …
#define ARIZONA_FLL_MAX_FRATIO …
#define ARIZONA_FLL_MAX_REFDIV …
#define ARIZONA_FLL_MIN_OUTDIV …
#define ARIZONA_FLL_MAX_OUTDIV …
#define ARIZONA_FMT_DSP_MODE_A …
#define ARIZONA_FMT_DSP_MODE_B …
#define ARIZONA_FMT_I2S_MODE …
#define ARIZONA_FMT_LEFT_JUSTIFIED_MODE …
#define arizona_fll_err(_fll, fmt, ...) …
#define arizona_fll_warn(_fll, fmt, ...) …
#define arizona_fll_dbg(_fll, fmt, ...) …
#define arizona_aif_err(_dai, fmt, ...) …
#define arizona_aif_warn(_dai, fmt, ...) …
#define arizona_aif_dbg(_dai, fmt, ...) …
static int arizona_spk_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
static irqreturn_t arizona_thermal_warn(int irq, void *data)
{ … }
static irqreturn_t arizona_thermal_shutdown(int irq, void *data)
{ … }
static const struct snd_soc_dapm_widget arizona_spkl = …;
static const struct snd_soc_dapm_widget arizona_spkr = …;
int arizona_init_spk(struct snd_soc_component *component)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_init_spk_irqs(struct arizona *arizona)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_free_spk_irqs(struct arizona *arizona)
{ … }
EXPORT_SYMBOL_GPL(…);
static const struct snd_soc_dapm_route arizona_mono_routes[] = …;
int arizona_init_mono(struct snd_soc_component *component)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_init_gpio(struct snd_soc_component *component)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_init_common(struct arizona *arizona)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_init_vol_limit(struct arizona *arizona)
{ … }
EXPORT_SYMBOL_GPL(…);
const char * const arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS] = …;
EXPORT_SYMBOL_GPL(…);
unsigned int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS] = …;
EXPORT_SYMBOL_GPL(…);
const DECLARE_TLV_DB_SCALE(arizona_mixer_tlv, -3200, 100, 0);
EXPORT_SYMBOL_GPL(…);
const char * const arizona_sample_rate_text[ARIZONA_SAMPLE_RATE_ENUM_SIZE] = …;
EXPORT_SYMBOL_GPL(…);
const unsigned int arizona_sample_rate_val[ARIZONA_SAMPLE_RATE_ENUM_SIZE] = …;
EXPORT_SYMBOL_GPL(…);
const char *arizona_sample_rate_val_to_name(unsigned int rate_val)
{ … }
EXPORT_SYMBOL_GPL(…);
const char * const arizona_rate_text[ARIZONA_RATE_ENUM_SIZE] = …;
EXPORT_SYMBOL_GPL(…);
const unsigned int arizona_rate_val[ARIZONA_RATE_ENUM_SIZE] = …;
EXPORT_SYMBOL_GPL(…);
const struct soc_enum arizona_isrc_fsh[] = …;
EXPORT_SYMBOL_GPL(…);
const struct soc_enum arizona_isrc_fsl[] = …;
EXPORT_SYMBOL_GPL(…);
const struct soc_enum arizona_asrc_rate1 = …;
EXPORT_SYMBOL_GPL(…);
static const char * const arizona_vol_ramp_text[] = …;
SOC_ENUM_SINGLE_DECL(arizona_in_vd_ramp,
ARIZONA_INPUT_VOLUME_RAMP,
ARIZONA_IN_VD_RAMP_SHIFT,
arizona_vol_ramp_text);
EXPORT_SYMBOL_GPL(…);
SOC_ENUM_SINGLE_DECL(arizona_in_vi_ramp,
ARIZONA_INPUT_VOLUME_RAMP,
ARIZONA_IN_VI_RAMP_SHIFT,
arizona_vol_ramp_text);
EXPORT_SYMBOL_GPL(…);
SOC_ENUM_SINGLE_DECL(arizona_out_vd_ramp,
ARIZONA_OUTPUT_VOLUME_RAMP,
ARIZONA_OUT_VD_RAMP_SHIFT,
arizona_vol_ramp_text);
EXPORT_SYMBOL_GPL(…);
SOC_ENUM_SINGLE_DECL(arizona_out_vi_ramp,
ARIZONA_OUTPUT_VOLUME_RAMP,
ARIZONA_OUT_VI_RAMP_SHIFT,
arizona_vol_ramp_text);
EXPORT_SYMBOL_GPL(…);
static const char * const arizona_lhpf_mode_text[] = …;
SOC_ENUM_SINGLE_DECL(arizona_lhpf1_mode,
ARIZONA_HPLPF1_1,
ARIZONA_LHPF1_MODE_SHIFT,
arizona_lhpf_mode_text);
EXPORT_SYMBOL_GPL(…);
SOC_ENUM_SINGLE_DECL(arizona_lhpf2_mode,
ARIZONA_HPLPF2_1,
ARIZONA_LHPF2_MODE_SHIFT,
arizona_lhpf_mode_text);
EXPORT_SYMBOL_GPL(…);
SOC_ENUM_SINGLE_DECL(arizona_lhpf3_mode,
ARIZONA_HPLPF3_1,
ARIZONA_LHPF3_MODE_SHIFT,
arizona_lhpf_mode_text);
EXPORT_SYMBOL_GPL(…);
SOC_ENUM_SINGLE_DECL(arizona_lhpf4_mode,
ARIZONA_HPLPF4_1,
ARIZONA_LHPF4_MODE_SHIFT,
arizona_lhpf_mode_text);
EXPORT_SYMBOL_GPL(…);
static const char * const arizona_ng_hold_text[] = …;
SOC_ENUM_SINGLE_DECL(arizona_ng_hold,
ARIZONA_NOISE_GATE_CONTROL,
ARIZONA_NGATE_HOLD_SHIFT,
arizona_ng_hold_text);
EXPORT_SYMBOL_GPL(…);
static const char * const arizona_in_hpf_cut_text[] = …;
SOC_ENUM_SINGLE_DECL(arizona_in_hpf_cut_enum,
ARIZONA_HPF_CONTROL,
ARIZONA_IN_HPF_CUT_SHIFT,
arizona_in_hpf_cut_text);
EXPORT_SYMBOL_GPL(…);
static const char * const arizona_in_dmic_osr_text[] = …;
const struct soc_enum arizona_in_dmic_osr[] = …;
EXPORT_SYMBOL_GPL(…);
static const char * const arizona_anc_input_src_text[] = …;
static const char * const arizona_anc_channel_src_text[] = …;
const struct soc_enum arizona_anc_input_src[] = …;
EXPORT_SYMBOL_GPL(…);
static const char * const arizona_anc_ng_texts[] = …;
SOC_ENUM_SINGLE_DECL(arizona_anc_ng_enum, SND_SOC_NOPM, 0,
arizona_anc_ng_texts);
EXPORT_SYMBOL_GPL(…);
static const char * const arizona_output_anc_src_text[] = …;
const struct soc_enum arizona_output_anc_src[] = …;
EXPORT_SYMBOL_GPL(…);
const struct snd_kcontrol_new arizona_voice_trigger_switch[] = …;
EXPORT_SYMBOL_GPL(…);
static void arizona_in_set_vu(struct snd_soc_component *component, int ena)
{ … }
bool arizona_input_analog(struct snd_soc_component *component, int shift)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
int event)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_out_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_hp_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
int event)
{ … }
EXPORT_SYMBOL_GPL(…);
static int arizona_dvfs_enable(struct snd_soc_component *component)
{ … }
static int arizona_dvfs_disable(struct snd_soc_component *component)
{ … }
int arizona_dvfs_up(struct snd_soc_component *component, unsigned int flags)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_dvfs_down(struct snd_soc_component *component, unsigned int flags)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
EXPORT_SYMBOL_GPL(…);
void arizona_init_dvfs(struct arizona_priv *priv)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_anc_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
EXPORT_SYMBOL_GPL(…);
static unsigned int arizona_opclk_ref_48k_rates[] = …;
static unsigned int arizona_opclk_ref_44k1_rates[] = …;
static int arizona_set_opclk(struct snd_soc_component *component,
unsigned int clk, unsigned int freq)
{ … }
int arizona_clk_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_set_sysclk(struct snd_soc_component *component, int clk_id,
int source, unsigned int freq, int dir)
{ … }
EXPORT_SYMBOL_GPL(…);
static int arizona_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
static const int arizona_48k_bclk_rates[] = …;
static const int arizona_44k1_bclk_rates[] = …;
static const unsigned int arizona_sr_vals[] = …;
#define ARIZONA_48K_RATE_MASK …
#define ARIZONA_44K1_RATE_MASK …
#define ARIZONA_RATE_MASK …
static const struct snd_pcm_hw_constraint_list arizona_constraint = …;
static int arizona_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static void arizona_wm5102_set_dac_comp(struct snd_soc_component *component,
unsigned int rate)
{ … }
static int arizona_hw_params_rate(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static bool arizona_aif_cfg_changed(struct snd_soc_component *component,
int base, int bclk, int lrclk, int frame)
{ … }
static int arizona_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static const char *arizona_dai_clk_str(int clk_id)
{ … }
static int arizona_dai_set_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int arizona_set_tristate(struct snd_soc_dai *dai, int tristate)
{ … }
static void arizona_set_channels_to_mask(struct snd_soc_dai *dai,
unsigned int base,
int channels, unsigned int mask)
{ … }
static int arizona_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
unsigned int rx_mask, int slots, int slot_width)
{ … }
const struct snd_soc_dai_ops arizona_dai_ops = …;
EXPORT_SYMBOL_GPL(…);
const struct snd_soc_dai_ops arizona_simple_dai_ops = …;
EXPORT_SYMBOL_GPL(…);
int arizona_init_dai(struct arizona_priv *priv, int id)
{ … }
EXPORT_SYMBOL_GPL(…);
static struct { … } fll_fratios[] = …;
static const unsigned int pseudo_fref_max[ARIZONA_FLL_MAX_FRATIO] = …;
static struct { … } fll_gains[] = …;
struct arizona_fll_cfg { … };
static int arizona_validate_fll(struct arizona_fll *fll,
unsigned int Fref,
unsigned int Fout)
{ … }
static int arizona_find_fratio(unsigned int Fref, int *fratio)
{ … }
static int arizona_calc_fratio(struct arizona_fll *fll,
struct arizona_fll_cfg *cfg,
unsigned int target,
unsigned int Fref, bool sync)
{ … }
static int arizona_calc_fll(struct arizona_fll *fll,
struct arizona_fll_cfg *cfg,
unsigned int Fref, bool sync)
{ … }
static void arizona_apply_fll(struct arizona *arizona, unsigned int base,
struct arizona_fll_cfg *cfg, int source,
bool sync)
{ … }
static int arizona_is_enabled_fll(struct arizona_fll *fll, int base)
{ … }
static int arizona_set_fll_clks(struct arizona_fll *fll, int base, bool ena)
{ … }
static int arizona_enable_fll(struct arizona_fll *fll)
{ … }
static void arizona_disable_fll(struct arizona_fll *fll)
{ … }
int arizona_set_fll_refclk(struct arizona_fll *fll, int source,
unsigned int Fref, unsigned int Fout)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_set_fll(struct arizona_fll *fll, int source,
unsigned int Fref, unsigned int Fout)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_init_fll(struct arizona *arizona, int id, int base, int lock_irq,
int ok_irq, struct arizona_fll *fll)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_set_output_mode(struct snd_soc_component *component, int output,
bool diff)
{ … }
EXPORT_SYMBOL_GPL(…);
static const struct soc_enum arizona_adsp2_rate_enum[] = …;
const struct snd_kcontrol_new arizona_adsp2_rate_controls[] = …;
EXPORT_SYMBOL_GPL(…);
static bool arizona_eq_filter_unstable(bool mode, __be16 _a, __be16 _b)
{ … }
int arizona_eq_coeff_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
EXPORT_SYMBOL_GPL(…);
int arizona_of_get_audio_pdata(struct arizona *arizona)
{ … }
EXPORT_SYMBOL_GPL(…);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;