#include <linux/module.h>
#include <linux/errno.h>
#include <linux/device.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/regulator/consumer.h>
#include <linux/delay.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/tlv.h>
#include "tas5720.h"
#define TAS5720_FAULT_CHECK_INTERVAL …
enum tas572x_type { … };
static const char * const tas5720_supply_names[] = …;
#define TAS5720_NUM_SUPPLIES …
struct tas5720_data { … };
static int tas5720_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int tas5720_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
static int tas5720_set_dai_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask,
int slots, int slot_width)
{ … }
static int tas5720_mute_soc_component(struct snd_soc_component *component, int mute)
{ … }
static int tas5720_mute(struct snd_soc_dai *dai, int mute, int direction)
{ … }
static void tas5720_fault_check_work(struct work_struct *work)
{ … }
static int tas5720_codec_probe(struct snd_soc_component *component)
{ … }
static void tas5720_codec_remove(struct snd_soc_component *component)
{
struct tas5720_data *tas5720 = snd_soc_component_get_drvdata(component);
int ret;
cancel_delayed_work_sync(&tas5720->fault_check_work);
ret = regulator_bulk_disable(ARRAY_SIZE(tas5720->supplies),
tas5720->supplies);
if (ret < 0)
dev_err(component->dev, "failed to disable supplies: %d\n", ret);
};
static int tas5720_dac_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
#ifdef CONFIG_PM
static int tas5720_suspend(struct snd_soc_component *component)
{ … }
static int tas5720_resume(struct snd_soc_component *component)
{ … }
#else
#define tas5720_suspend …
#define tas5720_resume …
#endif
static bool tas5720_is_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config tas5720_regmap_config = …;
static const struct regmap_config tas5720a_q1_regmap_config = …;
static const struct regmap_config tas5722_regmap_config = …;
static const DECLARE_TLV_DB_RANGE(dac_analog_tlv,
0x0, 0x0, TLV_DB_SCALE_ITEM(1920, 0, 0),
0x1, 0x1, TLV_DB_SCALE_ITEM(2070, 0, 0),
0x2, 0x2, TLV_DB_SCALE_ITEM(2350, 0, 0),
0x3, 0x3, TLV_DB_SCALE_ITEM(2630, 0, 0),
);
static const DECLARE_TLV_DB_RANGE(dac_analog_tlv_a_q1,
0x0, 0x0, TLV_DB_SCALE_ITEM(1920, 0, 0),
0x1, 0x1, TLV_DB_SCALE_ITEM(2260, 0, 0),
0x2, 0x2, TLV_DB_SCALE_ITEM(2500, 0, 0),
);
static DECLARE_TLV_DB_SCALE(tas5720_dac_tlv, -10350, 50, 0);
static DECLARE_TLV_DB_SCALE(tas5722_dac_tlv, -10350, 25, 0);
static int tas5722_volume_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int tas5722_volume_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new tas5720_snd_controls[] = …;
static const struct snd_kcontrol_new tas5720a_q1_snd_controls[] = …;
static const struct snd_kcontrol_new tas5722_snd_controls[] = …;
static const struct snd_soc_dapm_widget tas5720_dapm_widgets[] = …;
static const struct snd_soc_dapm_route tas5720_audio_map[] = …;
static const struct snd_soc_component_driver soc_component_dev_tas5720 = …;
static const struct snd_soc_component_driver soc_component_dev_tas5720_a_q1 = …;
static const struct snd_soc_component_driver soc_component_dev_tas5722 = …;
#define TAS5720_RATES …
#define TAS5720_FORMATS …
static const struct snd_soc_dai_ops tas5720_speaker_dai_ops = …;
static struct snd_soc_dai_driver tas5720_dai[] = …;
static const struct i2c_device_id tas5720_id[] = …;
MODULE_DEVICE_TABLE(i2c, tas5720_id);
static int tas5720_probe(struct i2c_client *client)
{ … }
#if IS_ENABLED(CONFIG_OF)
static const struct of_device_id tas5720_of_match[] = …;
MODULE_DEVICE_TABLE(of, tas5720_of_match);
#endif
static struct i2c_driver tas5720_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;