#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include "max98371.h"
static const char *const monomix_text[] = …;
static const char *const hpf_cutoff_txt[] = …;
static SOC_ENUM_SINGLE_DECL(max98371_monomix, MAX98371_MONOMIX_CFG, 0,
monomix_text);
static SOC_ENUM_SINGLE_DECL(max98371_hpf_cutoff, MAX98371_HPF, 0,
hpf_cutoff_txt);
static const DECLARE_TLV_DB_RANGE(max98371_dht_min_gain,
0, 1, TLV_DB_SCALE_ITEM(537, 66, 0),
2, 3, TLV_DB_SCALE_ITEM(677, 82, 0),
4, 5, TLV_DB_SCALE_ITEM(852, 104, 0),
6, 7, TLV_DB_SCALE_ITEM(1072, 131, 0),
8, 9, TLV_DB_SCALE_ITEM(1350, 165, 0),
10, 11, TLV_DB_SCALE_ITEM(1699, 101, 0),
);
static const DECLARE_TLV_DB_RANGE(max98371_dht_max_gain,
0, 1, TLV_DB_SCALE_ITEM(537, 66, 0),
2, 3, TLV_DB_SCALE_ITEM(677, 82, 0),
4, 5, TLV_DB_SCALE_ITEM(852, 104, 0),
6, 7, TLV_DB_SCALE_ITEM(1072, 131, 0),
8, 9, TLV_DB_SCALE_ITEM(1350, 165, 0),
10, 11, TLV_DB_SCALE_ITEM(1699, 208, 0),
);
static const DECLARE_TLV_DB_RANGE(max98371_dht_rot_gain,
0, 1, TLV_DB_SCALE_ITEM(-50, -50, 0),
2, 6, TLV_DB_SCALE_ITEM(-100, -100, 0),
7, 8, TLV_DB_SCALE_ITEM(-800, -200, 0),
9, 11, TLV_DB_SCALE_ITEM(-1200, -300, 0),
12, 13, TLV_DB_SCALE_ITEM(-2000, -200, 0),
14, 15, TLV_DB_SCALE_ITEM(-2500, -500, 0),
);
static const struct reg_default max98371_reg[] = …;
static bool max98371_volatile_register(struct device *dev, unsigned int reg)
{ … }
static bool max98371_readable_register(struct device *dev, unsigned int reg)
{
switch (reg) {
case MAX98371_SOFT_RESET:
return false;
default:
return true;
}
};
static const DECLARE_TLV_DB_RANGE(max98371_gain_tlv,
0, 7, TLV_DB_SCALE_ITEM(0, 50, 0),
8, 10, TLV_DB_SCALE_ITEM(400, 100, 0)
);
static const DECLARE_TLV_DB_SCALE(digital_tlv, -6300, 50, 1);
static const struct snd_kcontrol_new max98371_snd_controls[] = …;
static int max98371_dai_set_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{ … }
static int max98371_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static const struct snd_soc_dapm_widget max98371_dapm_widgets[] = …;
static const struct snd_soc_dapm_route max98371_audio_map[] = …;
#define MAX98371_RATES …
#define MAX98371_FORMATS …
static const struct snd_soc_dai_ops max98371_dai_ops = …;
static struct snd_soc_dai_driver max98371_dai[] = …;
static const struct snd_soc_component_driver max98371_component = …;
static const struct regmap_config max98371_regmap = …;
static int max98371_i2c_probe(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id max98371_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, max98371_i2c_id);
#ifdef CONFIG_OF
static const struct of_device_id max98371_of_match[] = …;
MODULE_DEVICE_TABLE(of, max98371_of_match);
#endif
static struct i2c_driver max98371_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;