#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/clk.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <linux/slab.h>
#include <asm/div64.h>
#include <sound/max98095.h>
#include <sound/jack.h>
#include "max98095.h"
enum max98095_type { … };
struct max98095_cdata { … };
struct max98095_priv { … };
static const struct reg_default max98095_reg_def[] = …;
static bool max98095_readable(struct device *dev, unsigned int reg)
{ … }
static bool max98095_writeable(struct device *dev, unsigned int reg)
{ … }
static bool max98095_volatile(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config max98095_regmap = …;
static void m98095_eq_band(struct snd_soc_component *component, unsigned int dai,
unsigned int band, u16 *coefs)
{ … }
static void m98095_biquad_band(struct snd_soc_component *component, unsigned int dai,
unsigned int band, u16 *coefs)
{ … }
static const char * const max98095_fltr_mode[] = …;
static SOC_ENUM_SINGLE_DECL(max98095_dai1_filter_mode_enum,
M98095_02E_DAI1_FILTERS, 7,
max98095_fltr_mode);
static SOC_ENUM_SINGLE_DECL(max98095_dai2_filter_mode_enum,
M98095_038_DAI2_FILTERS, 7,
max98095_fltr_mode);
static const char * const max98095_extmic_text[] = …;
static SOC_ENUM_SINGLE_DECL(max98095_extmic_enum,
M98095_087_CFG_MIC, 0,
max98095_extmic_text);
static const struct snd_kcontrol_new max98095_extmic_mux = …;
static const char * const max98095_linein_text[] = …;
static SOC_ENUM_SINGLE_DECL(max98095_linein_enum,
M98095_086_CFG_LINE, 6,
max98095_linein_text);
static const struct snd_kcontrol_new max98095_linein_mux = …;
static const char * const max98095_line_mode_text[] = …;
static SOC_ENUM_SINGLE_DECL(max98095_linein_mode_enum,
M98095_086_CFG_LINE, 7,
max98095_line_mode_text);
static SOC_ENUM_SINGLE_DECL(max98095_lineout_mode_enum,
M98095_086_CFG_LINE, 4,
max98095_line_mode_text);
static const char * const max98095_dai_fltr[] = …;
static SOC_ENUM_SINGLE_DECL(max98095_dai1_dac_filter_enum,
M98095_02E_DAI1_FILTERS, 0,
max98095_dai_fltr);
static SOC_ENUM_SINGLE_DECL(max98095_dai2_dac_filter_enum,
M98095_038_DAI2_FILTERS, 0,
max98095_dai_fltr);
static SOC_ENUM_SINGLE_DECL(max98095_dai3_dac_filter_enum,
M98095_042_DAI3_FILTERS, 0,
max98095_dai_fltr);
static int max98095_mic1pre_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int max98095_mic1pre_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int max98095_mic2pre_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int max98095_mic2pre_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const DECLARE_TLV_DB_RANGE(max98095_micboost_tlv,
0, 1, TLV_DB_SCALE_ITEM(0, 2000, 0),
2, 2, TLV_DB_SCALE_ITEM(3000, 0, 0)
);
static const DECLARE_TLV_DB_SCALE(max98095_mic_tlv, 0, 100, 0);
static const DECLARE_TLV_DB_SCALE(max98095_adc_tlv, -1200, 100, 0);
static const DECLARE_TLV_DB_SCALE(max98095_adcboost_tlv, 0, 600, 0);
static const DECLARE_TLV_DB_RANGE(max98095_hp_tlv,
0, 6, TLV_DB_SCALE_ITEM(-6700, 400, 0),
7, 14, TLV_DB_SCALE_ITEM(-4000, 300, 0),
15, 21, TLV_DB_SCALE_ITEM(-1700, 200, 0),
22, 27, TLV_DB_SCALE_ITEM(-400, 100, 0),
28, 31, TLV_DB_SCALE_ITEM(150, 50, 0)
);
static const DECLARE_TLV_DB_RANGE(max98095_spk_tlv,
0, 10, TLV_DB_SCALE_ITEM(-5900, 400, 0),
11, 18, TLV_DB_SCALE_ITEM(-1700, 200, 0),
19, 27, TLV_DB_SCALE_ITEM(-200, 100, 0),
28, 39, TLV_DB_SCALE_ITEM(650, 50, 0)
);
static const DECLARE_TLV_DB_RANGE(max98095_rcv_lout_tlv,
0, 6, TLV_DB_SCALE_ITEM(-6200, 400, 0),
7, 14, TLV_DB_SCALE_ITEM(-3500, 300, 0),
15, 21, TLV_DB_SCALE_ITEM(-1200, 200, 0),
22, 27, TLV_DB_SCALE_ITEM(100, 100, 0),
28, 31, TLV_DB_SCALE_ITEM(650, 50, 0)
);
static const DECLARE_TLV_DB_RANGE(max98095_lin_tlv,
0, 2, TLV_DB_SCALE_ITEM(-600, 300, 0),
3, 3, TLV_DB_SCALE_ITEM(300, 1100, 0),
4, 5, TLV_DB_SCALE_ITEM(1400, 600, 0)
);
static const struct snd_kcontrol_new max98095_snd_controls[] = …;
static const struct snd_kcontrol_new max98095_left_speaker_mixer_controls[] = …;
static const struct snd_kcontrol_new max98095_right_speaker_mixer_controls[] = …;
static const struct snd_kcontrol_new max98095_left_hp_mixer_controls[] = …;
static const struct snd_kcontrol_new max98095_right_hp_mixer_controls[] = …;
static const struct snd_kcontrol_new max98095_mono_rcv_mixer_controls[] = …;
static const struct snd_kcontrol_new max98095_left_lineout_mixer_controls[] = …;
static const struct snd_kcontrol_new max98095_right_lineout_mixer_controls[] = …;
static const struct snd_kcontrol_new max98095_left_ADC_mixer_controls[] = …;
static const struct snd_kcontrol_new max98095_right_ADC_mixer_controls[] = …;
static int max98095_mic_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static int max98095_line_pga(struct snd_soc_dapm_widget *w,
int event, u8 channel)
{ … }
static int max98095_pga_in1_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{ … }
static int max98095_pga_in2_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{ … }
static int max98095_lineout_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const struct snd_soc_dapm_widget max98095_dapm_widgets[] = …;
static const struct snd_soc_dapm_route max98095_audio_map[] = …;
static const struct { … } rate_table[] = …;
static int rate_value(int rate, u8 *value)
{ … }
static int max98095_dai1_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int max98095_dai2_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int max98095_dai3_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int max98095_dai_set_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int max98095_dai1_set_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{ … }
static int max98095_dai2_set_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{ … }
static int max98095_dai3_set_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{ … }
static int max98095_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
#define MAX98095_RATES …
#define MAX98095_FORMATS …
static const struct snd_soc_dai_ops max98095_dai1_ops = …;
static const struct snd_soc_dai_ops max98095_dai2_ops = …;
static const struct snd_soc_dai_ops max98095_dai3_ops = …;
static struct snd_soc_dai_driver max98095_dai[] = …;
static int max98095_get_eq_channel(const char *name)
{ … }
static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int max98095_get_eq_enum(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static void max98095_handle_eq_pdata(struct snd_soc_component *component)
{ … }
static const char *bq_mode_name[] = …;
static int max98095_get_bq_channel(struct snd_soc_component *component,
const char *name)
{ … }
static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int max98095_get_bq_enum(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static void max98095_handle_bq_pdata(struct snd_soc_component *component)
{ … }
static void max98095_handle_pdata(struct snd_soc_component *component)
{ … }
static irqreturn_t max98095_report_jack(int irq, void *data)
{ … }
static int max98095_jack_detect_enable(struct snd_soc_component *component)
{ … }
static int max98095_jack_detect_disable(struct snd_soc_component *component)
{ … }
int max98095_jack_detect(struct snd_soc_component *component,
struct snd_soc_jack *hp_jack, struct snd_soc_jack *mic_jack)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifdef CONFIG_PM
static int max98095_suspend(struct snd_soc_component *component)
{ … }
static int max98095_resume(struct snd_soc_component *component)
{ … }
#else
#define max98095_suspend …
#define max98095_resume …
#endif
static int max98095_reset(struct snd_soc_component *component)
{ … }
static int max98095_probe(struct snd_soc_component *component)
{ … }
static void max98095_remove(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_component_dev_max98095 = …;
static const struct i2c_device_id max98095_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, max98095_i2c_id);
static int max98095_i2c_probe(struct i2c_client *i2c)
{ … }
#ifdef CONFIG_OF
static const struct of_device_id max98095_of_match[] = …;
MODULE_DEVICE_TABLE(of, max98095_of_match);
#endif
static struct i2c_driver max98095_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;