#include <linux/module.h>
#include <linux/delay.h>
#include <linux/dmi.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/acpi.h>
#include <linux/math64.h>
#include <linux/semaphore.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/jack.h>
#include "nau8824.h"
#define NAU8824_JD_ACTIVE_HIGH …
#define NAU8824_MONO_SPEAKER …
static int nau8824_quirk;
static int quirk_override = …;
module_param_named(quirk, quirk_override, uint, 0444);
MODULE_PARM_DESC(…) …;
static int nau8824_config_sysclk(struct nau8824 *nau8824,
int clk_id, unsigned int freq);
static bool nau8824_is_jack_inserted(struct nau8824 *nau8824);
#define DMIC_CLK …
#define HEADSET_SARADC_THD …
#define NAU_FREF_MAX …
#define NAU_FVCO_MAX …
#define NAU_FVCO_MIN …
static const struct nau8824_fll_attr mclk_src_scaling[] = …;
static const struct nau8824_fll_attr fll_ratio[] = …;
static const struct nau8824_fll_attr fll_pre_scalar[] = …;
#define CLK_DA_AD_MAX …
static const struct nau8824_osr_attr osr_dac_sel[] = …;
static const struct nau8824_osr_attr osr_adc_sel[] = …;
static const struct reg_default nau8824_reg_defaults[] = …;
static int nau8824_sema_acquire(struct nau8824 *nau8824, long timeout)
{ … }
static inline void nau8824_sema_release(struct nau8824 *nau8824)
{ … }
static bool nau8824_readable_reg(struct device *dev, unsigned int reg)
{ … }
static bool nau8824_writeable_reg(struct device *dev, unsigned int reg)
{ … }
static bool nau8824_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static const char * const nau8824_companding[] = …;
static const struct soc_enum nau8824_companding_adc_enum = …;
static const struct soc_enum nau8824_companding_dac_enum = …;
static const char * const nau8824_adc_decimation[] = …;
static const struct soc_enum nau8824_adc_decimation_enum = …;
static const char * const nau8824_dac_oversampl[] = …;
static const struct soc_enum nau8824_dac_oversampl_enum = …;
static const char * const nau8824_input_channel[] = …;
static const struct soc_enum nau8824_adc_ch0_enum = …;
static const struct soc_enum nau8824_adc_ch1_enum = …;
static const struct soc_enum nau8824_adc_ch2_enum = …;
static const struct soc_enum nau8824_adc_ch3_enum = …;
static const char * const nau8824_tdm_slot[] = …;
static const struct soc_enum nau8824_dac_left_sel_enum = …;
static const struct soc_enum nau8824_dac_right_sel_enum = …;
static const DECLARE_TLV_DB_MINMAX_MUTE(spk_vol_tlv, 0, 2400);
static const DECLARE_TLV_DB_MINMAX(hp_vol_tlv, -3000, 0);
static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, 0, 200, 0);
static const DECLARE_TLV_DB_SCALE(dmic_vol_tlv, -12800, 50, 0);
static const struct snd_kcontrol_new nau8824_snd_controls[] = …;
static int nau8824_output_dac_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int nau8824_spk_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int nau8824_pump_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int system_clock_control(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{ … }
static int dmic_clock_control(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{ … }
static const struct snd_kcontrol_new nau8824_adc_ch0_dmic = …;
static const struct snd_kcontrol_new nau8824_adc_ch1_dmic = …;
static const struct snd_kcontrol_new nau8824_adc_ch2_dmic = …;
static const struct snd_kcontrol_new nau8824_adc_ch3_dmic = …;
static const struct snd_kcontrol_new nau8824_adc_left_mixer[] = …;
static const struct snd_kcontrol_new nau8824_adc_right_mixer[] = …;
static const struct snd_kcontrol_new nau8824_hp_left_mixer[] = …;
static const struct snd_kcontrol_new nau8824_hp_right_mixer[] = …;
static const char * const nau8824_dac_src[] = …;
static SOC_ENUM_SINGLE_DECL(
nau8824_dacl_enum, NAU8824_REG_DAC_CH0_DGAIN_CTRL,
NAU8824_DAC_CH0_SEL_SFT, nau8824_dac_src);
static SOC_ENUM_SINGLE_DECL(
nau8824_dacr_enum, NAU8824_REG_DAC_CH1_DGAIN_CTRL,
NAU8824_DAC_CH1_SEL_SFT, nau8824_dac_src);
static const struct snd_kcontrol_new nau8824_dacl_mux = …;
static const struct snd_kcontrol_new nau8824_dacr_mux = …;
static const struct snd_soc_dapm_widget nau8824_dapm_widgets[] = …;
static const struct snd_soc_dapm_route nau8824_dapm_routes[] = …;
static bool nau8824_is_jack_inserted(struct nau8824 *nau8824)
{ … }
static void nau8824_int_status_clear_all(struct regmap *regmap)
{ … }
static void nau8824_eject_jack(struct nau8824 *nau8824)
{ … }
static void nau8824_jdet_work(struct work_struct *work)
{ … }
static void nau8824_setup_auto_irq(struct nau8824 *nau8824)
{ … }
static int nau8824_button_decode(int value)
{ … }
#define NAU8824_BUTTONS …
static irqreturn_t nau8824_interrupt(int irq, void *data)
{ … }
static const struct nau8824_osr_attr *
nau8824_get_osr(struct nau8824 *nau8824, int stream)
{ … }
static int nau8824_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static int nau8824_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ … }
static int nau8824_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
static int nau8824_set_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
{ … }
static int nau8824_calc_fll_param(unsigned int fll_in,
unsigned int fs, struct nau8824_fll *fll_param)
{ … }
static void nau8824_fll_apply(struct regmap *regmap,
struct nau8824_fll *fll_param)
{ … }
static int nau8824_set_pll(struct snd_soc_component *component, int pll_id, int source,
unsigned int freq_in, unsigned int freq_out)
{ … }
static int nau8824_config_sysclk(struct nau8824 *nau8824,
int clk_id, unsigned int freq)
{ … }
static int nau8824_set_sysclk(struct snd_soc_component *component,
int clk_id, int source, unsigned int freq, int dir)
{ … }
static void nau8824_resume_setup(struct nau8824 *nau8824)
{ … }
static int nau8824_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static int nau8824_component_probe(struct snd_soc_component *component)
{ … }
static int __maybe_unused nau8824_suspend(struct snd_soc_component *component)
{ … }
static int __maybe_unused nau8824_resume(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver nau8824_component_driver = …;
static const struct snd_soc_dai_ops nau8824_dai_ops = …;
#define NAU8824_RATES …
#define NAU8824_FORMATS …
static struct snd_soc_dai_driver nau8824_dai = …;
static const struct regmap_config nau8824_regmap_config = …;
int nau8824_enable_jack_detect(struct snd_soc_component *component,
struct snd_soc_jack *jack)
{ … }
EXPORT_SYMBOL_GPL(…);
static void nau8824_reset_chip(struct regmap *regmap)
{ … }
static void nau8824_setup_buttons(struct nau8824 *nau8824)
{ … }
static void nau8824_init_regs(struct nau8824 *nau8824)
{ … }
static int nau8824_setup_irq(struct nau8824 *nau8824)
{ … }
static void nau8824_print_device_properties(struct nau8824 *nau8824)
{ … }
static int nau8824_read_device_properties(struct device *dev,
struct nau8824 *nau8824) { … }
static const struct dmi_system_id nau8824_quirk_table[] = …;
static void nau8824_check_quirks(void)
{ … }
const char *nau8824_components(void)
{ … }
EXPORT_SYMBOL_GPL(…);
static int nau8824_i2c_probe(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id nau8824_i2c_ids[] = …;
MODULE_DEVICE_TABLE(i2c, nau8824_i2c_ids);
#ifdef CONFIG_OF
static const struct of_device_id nau8824_of_ids[] = …;
MODULE_DEVICE_TABLE(of, nau8824_of_ids);
#endif
#ifdef CONFIG_ACPI
static const struct acpi_device_id nau8824_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, nau8824_acpi_match);
#endif
static struct i2c_driver nau8824_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;