#include <linux/module.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include <sound/tas5086.h>
#define TAS5086_PCM_FORMATS …
#define TAS5086_PCM_RATES …
#define TAS5086_CLOCK_CONTROL …
#define TAS5086_CLOCK_RATE(val) …
#define TAS5086_CLOCK_RATE_MASK …
#define TAS5086_CLOCK_RATIO(val) …
#define TAS5086_CLOCK_RATIO_MASK …
#define TAS5086_CLOCK_SCLK_RATIO_48 …
#define TAS5086_CLOCK_VALID …
#define TAS5086_DEEMPH_MASK …
#define TAS5086_SOFT_MUTE_ALL …
#define TAS5086_DEV_ID …
#define TAS5086_ERROR_STATUS …
#define TAS5086_SYS_CONTROL_1 …
#define TAS5086_SERIAL_DATA_IF …
#define TAS5086_SYS_CONTROL_2 …
#define TAS5086_SOFT_MUTE …
#define TAS5086_MASTER_VOL …
#define TAS5086_CHANNEL_VOL(X) …
#define TAS5086_VOLUME_CONTROL …
#define TAS5086_MOD_LIMIT …
#define TAS5086_PWM_START …
#define TAS5086_SURROUND …
#define TAS5086_SPLIT_CAP_CHARGE …
#define TAS5086_OSC_TRIM …
#define TAS5086_BKNDERR …
#define TAS5086_INPUT_MUX …
#define TAS5086_PWM_OUTPUT_MUX …
#define TAS5086_MAX_REGISTER …
#define TAS5086_PWM_START_MIDZ_FOR_START_1 …
#define TAS5086_PWM_START_MIDZ_FOR_START_2 …
#define TAS5086_PWM_START_CHANNEL_MASK …
static const struct reg_default tas5086_reg_defaults[] = …;
static int tas5086_register_size(struct device *dev, unsigned int reg)
{ … }
static bool tas5086_accessible_reg(struct device *dev, unsigned int reg)
{ … }
static bool tas5086_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static bool tas5086_writeable_reg(struct device *dev, unsigned int reg)
{ … }
static int tas5086_reg_write(void *context, unsigned int reg,
unsigned int value)
{ … }
static int tas5086_reg_read(void *context, unsigned int reg,
unsigned int *value)
{ … }
static const char * const supply_names[] = …;
struct tas5086_private { … };
static int tas5086_deemph[] = …;
static int tas5086_set_deemph(struct snd_soc_component *component)
{ … }
static int tas5086_get_deemph(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int tas5086_put_deemph(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int tas5086_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int tas5086_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int format)
{ … }
static const int tas5086_sample_rates[] = …;
static const int tas5086_ratios[] = …;
static int index_in_array(const int *array, int len, int needle)
{ … }
static int tas5086_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int tas5086_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
{ … }
static void tas5086_reset(struct tas5086_private *priv)
{ … }
static const int tas5086_charge_period[] = …;
static int tas5086_init(struct device *dev, struct tas5086_private *priv)
{ … }
static const DECLARE_TLV_DB_SCALE(tas5086_dac_tlv, -10350, 50, 1);
static const struct snd_kcontrol_new tas5086_controls[] = …;
static const char *tas5086_dapm_sdin_texts[] = …;
static const struct soc_enum tas5086_dapm_input_mux_enum[] = …;
static const struct snd_kcontrol_new tas5086_dapm_input_mux_controls[] = …;
static const char *tas5086_dapm_channel_texts[] = …;
static const struct soc_enum tas5086_dapm_output_mux_enum[] = …;
static const struct snd_kcontrol_new tas5086_dapm_output_mux_controls[] = …;
static const struct snd_soc_dapm_widget tas5086_dapm_widgets[] = …;
static const struct snd_soc_dapm_route tas5086_dapm_routes[] = …;
static const struct snd_soc_dai_ops tas5086_dai_ops = …;
static struct snd_soc_dai_driver tas5086_dai = …;
#ifdef CONFIG_PM
static int tas5086_soc_suspend(struct snd_soc_component *component)
{ … }
static int tas5086_soc_resume(struct snd_soc_component *component)
{ … }
#else
#define tas5086_soc_suspend …
#define tas5086_soc_resume …
#endif
#ifdef CONFIG_OF
static const struct of_device_id tas5086_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, tas5086_dt_ids);
#endif
static int tas5086_probe(struct snd_soc_component *component)
{ … }
static void tas5086_remove(struct snd_soc_component *component)
{
struct tas5086_private *priv = snd_soc_component_get_drvdata(component);
if (priv->reset)
gpiod_set_value(priv->reset, 1);
regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies);
};
static const struct snd_soc_component_driver soc_component_dev_tas5086 = …;
static const struct i2c_device_id tas5086_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, tas5086_i2c_id);
static const struct regmap_config tas5086_regmap = …;
static int tas5086_i2c_probe(struct i2c_client *i2c)
{ … }
static void tas5086_i2c_remove(struct i2c_client *i2c)
{ … }
static struct i2c_driver tas5086_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;