#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include "max9867.h"
struct max9867_priv { … };
static const char *const max9867_spmode[] = …;
static const char *const max9867_filter_text[] = …;
static const char *const max9867_adc_dac_filter_text[] = …;
enum max9867_adc_dac { … };
static int max9867_adc_dac_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int max9867_filter_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int max9867_filter_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static SOC_ENUM_SINGLE_EXT_DECL(max9867_filter, max9867_filter_text);
static SOC_ENUM_SINGLE_DECL(max9867_dac_filter, MAX9867_CODECFLTR, 0,
max9867_adc_dac_filter_text);
static SOC_ENUM_SINGLE_DECL(max9867_adc_filter, MAX9867_CODECFLTR, 4,
max9867_adc_dac_filter_text);
static SOC_ENUM_SINGLE_DECL(max9867_spkmode, MAX9867_MODECONFIG, 0,
max9867_spmode);
static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(max9867_master_tlv,
0, 2, TLV_DB_SCALE_ITEM(-8600, 200, 1),
3, 17, TLV_DB_SCALE_ITEM(-7800, 400, 0),
18, 25, TLV_DB_SCALE_ITEM(-2000, 200, 0),
26, 34, TLV_DB_SCALE_ITEM( -500, 100, 0),
35, 40, TLV_DB_SCALE_ITEM( 350, 50, 0),
);
static DECLARE_TLV_DB_SCALE(max9867_mic_tlv, 0, 100, 0);
static DECLARE_TLV_DB_SCALE(max9867_line_tlv, -600, 200, 0);
static DECLARE_TLV_DB_SCALE(max9867_adc_tlv, -1200, 100, 0);
static DECLARE_TLV_DB_SCALE(max9867_dac_tlv, -1500, 100, 0);
static DECLARE_TLV_DB_SCALE(max9867_dacboost_tlv, 0, 600, 0);
static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(max9867_micboost_tlv,
0, 2, TLV_DB_SCALE_ITEM(-2000, 2000, 1),
3, 3, TLV_DB_SCALE_ITEM(3000, 0, 0),
);
static const struct snd_kcontrol_new max9867_snd_controls[] = …;
static const struct snd_kcontrol_new max9867_input_mixer_controls[] = …;
static const struct snd_kcontrol_new max9867_output_mixer_controls[] = …;
static const struct snd_kcontrol_new max9867_sidetone_mixer_controls[] = …;
static const struct snd_kcontrol_new max9867_line_out_control = …;
static const char *const dmic_mux_text[] = …;
static SOC_ENUM_SINGLE_DECL(left_dmic_mux_enum,
MAX9867_MICCONFIG, 5, dmic_mux_text);
static SOC_ENUM_SINGLE_DECL(right_dmic_mux_enum,
MAX9867_MICCONFIG, 4, dmic_mux_text);
static const struct snd_kcontrol_new max9867_left_dmic_mux = …;
static const struct snd_kcontrol_new max9867_right_dmic_mux = …;
static const struct snd_soc_dapm_widget max9867_dapm_widgets[] = …;
static const struct snd_soc_dapm_route max9867_audio_map[] = …;
static const unsigned int max9867_rates_44k1[] = …;
static const struct snd_pcm_hw_constraint_list max9867_constraints_44k1 = …;
static const unsigned int max9867_rates_48k[] = …;
static const struct snd_pcm_hw_constraint_list max9867_constraints_48k = …;
static int max9867_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static int max9867_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ … }
static int max9867_mute(struct snd_soc_dai *dai, int mute, int direction)
{ … }
static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int max9867_dai_set_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{ … }
static const struct snd_soc_dai_ops max9867_dai_ops = …;
static struct snd_soc_dai_driver max9867_dai[] = …;
#ifdef CONFIG_PM
static int max9867_suspend(struct snd_soc_component *component)
{ … }
static int max9867_resume(struct snd_soc_component *component)
{ … }
#else
#define max9867_suspend …
#define max9867_resume …
#endif
static int max9867_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static const struct snd_soc_component_driver max9867_component = …;
static bool max9867_volatile_register(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config max9867_regmap = …;
static int max9867_i2c_probe(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id max9867_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, max9867_i2c_id);
#ifdef CONFIG_OF
static const struct of_device_id max9867_of_match[] = …;
MODULE_DEVICE_TABLE(of, max9867_of_match);
#endif
static struct i2c_driver max9867_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;