#include <linux/module.h>
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/regmap.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/tlv.h>
#include <sound/jack.h>
#include "es8316.h"
static const unsigned int supported_mclk_lrck_ratios[] = …;
struct es8316_priv { … };
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(dac_vol_tlv, -9600, 50, 1);
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_vol_tlv, -9600, 50, 1);
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(alc_max_gain_tlv, -650, 150, 0);
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(alc_min_gain_tlv, -1200, 150, 0);
static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(alc_target_tlv,
0, 10, TLV_DB_SCALE_ITEM(-1650, 150, 0),
11, 11, TLV_DB_SCALE_ITEM(-150, 0, 0),
);
static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(hpmixer_gain_tlv,
0, 4, TLV_DB_SCALE_ITEM(-1200, 150, 0),
8, 11, TLV_DB_SCALE_ITEM(-450, 150, 0),
);
static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(adc_pga_gain_tlv,
0, 0, TLV_DB_SCALE_ITEM(-350, 0, 0),
1, 1, TLV_DB_SCALE_ITEM(0, 0, 0),
2, 2, TLV_DB_SCALE_ITEM(250, 0, 0),
3, 3, TLV_DB_SCALE_ITEM(450, 0, 0),
4, 7, TLV_DB_SCALE_ITEM(700, 300, 0),
8, 10, TLV_DB_SCALE_ITEM(1800, 300, 0),
);
static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(hpout_vol_tlv,
0, 0, TLV_DB_SCALE_ITEM(-4800, 0, 0),
1, 3, TLV_DB_SCALE_ITEM(-2400, 1200, 0),
);
static const char * const ng_type_txt[] = …;
static const struct soc_enum ng_type = …;
static const char * const adcpol_txt[] = …;
static const struct soc_enum adcpol = …;
static const char *const dacpol_txt[] = …;
static const struct soc_enum dacpol = …;
static const struct snd_kcontrol_new es8316_snd_controls[] = …;
static const char * const es8316_analog_in_txt[] = …;
static const unsigned int es8316_analog_in_values[] = …;
static const struct soc_enum es8316_analog_input_enum = …;
static const struct snd_kcontrol_new es8316_analog_in_mux_controls = …;
static const char * const es8316_dmic_txt[] = …;
static const unsigned int es8316_dmic_values[] = …;
static const struct soc_enum es8316_dmic_src_enum = …;
static const struct snd_kcontrol_new es8316_dmic_src_controls = …;
static const char * const es8316_hpmux_texts[] = …;
static SOC_ENUM_SINGLE_DECL(es8316_left_hpmux_enum, ES8316_HPMIX_SEL,
4, es8316_hpmux_texts);
static const struct snd_kcontrol_new es8316_left_hpmux_controls = …;
static SOC_ENUM_SINGLE_DECL(es8316_right_hpmux_enum, ES8316_HPMIX_SEL,
0, es8316_hpmux_texts);
static const struct snd_kcontrol_new es8316_right_hpmux_controls = …;
static const struct snd_kcontrol_new es8316_out_left_mix[] = …;
static const struct snd_kcontrol_new es8316_out_right_mix[] = …;
static const char * const es8316_dacsrc_texts[] = …;
static SOC_ENUM_SINGLE_DECL(es8316_dacsrc_mux_enum, ES8316_DAC_SET1,
6, es8316_dacsrc_texts);
static const struct snd_kcontrol_new es8316_dacsrc_mux_controls = …;
static const struct snd_soc_dapm_widget es8316_dapm_widgets[] = …;
static const struct snd_soc_dapm_route es8316_dapm_routes[] = …;
static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int es8316_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{ … }
static int es8316_pcm_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int es8316_mute(struct snd_soc_dai *dai, int mute, int direction)
{ … }
#define ES8316_FORMATS …
static const struct snd_soc_dai_ops es8316_ops = …;
static struct snd_soc_dai_driver es8316_dai = …;
static void es8316_enable_micbias_for_mic_gnd_short_detect(
struct snd_soc_component *component)
{ … }
static void es8316_disable_micbias_for_mic_gnd_short_detect(
struct snd_soc_component *component)
{ … }
static irqreturn_t es8316_irq(int irq, void *data)
{ … }
static void es8316_enable_jack_detect(struct snd_soc_component *component,
struct snd_soc_jack *jack)
{ … }
static void es8316_disable_jack_detect(struct snd_soc_component *component)
{ … }
static int es8316_set_jack(struct snd_soc_component *component,
struct snd_soc_jack *jack, void *data)
{ … }
static int es8316_probe(struct snd_soc_component *component)
{ … }
static void es8316_remove(struct snd_soc_component *component)
{ … }
static int es8316_resume(struct snd_soc_component *component)
{ … }
static int es8316_suspend(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_component_dev_es8316 = …;
static bool es8316_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config es8316_regmap = …;
static int es8316_i2c_probe(struct i2c_client *i2c_client)
{ … }
static const struct i2c_device_id es8316_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, es8316_i2c_id);
#ifdef CONFIG_OF
static const struct of_device_id es8316_of_match[] = …;
MODULE_DEVICE_TABLE(of, es8316_of_match);
#endif
#ifdef CONFIG_ACPI
static const struct acpi_device_id es8316_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, es8316_acpi_match);
#endif
static struct i2c_driver es8316_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;