#include <linux/acpi.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/cdev.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <linux/gpio/consumer.h>
#include <sound/tlv.h>
#include "max98927.h"
static struct reg_default max98927_reg[] = …;
static int max98927_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
{ … }
static const int rate_table[] = …;
static const int bclk_sel_table[] = …;
static int max98927_get_bclk_sel(int bclk)
{ … }
static int max98927_set_clock(struct max98927_priv *max98927,
struct snd_pcm_hw_params *params)
{ … }
static int max98927_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int max98927_dai_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask,
int slots, int slot_width)
{ … }
#define MAX98927_RATES …
#define MAX98927_FORMATS …
static int max98927_dai_set_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir)
{ … }
static const struct snd_soc_dai_ops max98927_dai_ops = …;
static int max98927_dac_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
static const char * const max98927_switch_text[] = …;
static const struct soc_enum dai_sel_enum = …;
static const struct snd_kcontrol_new max98927_dai_controls = …;
static const struct snd_kcontrol_new max98927_vi_control = …;
static const struct snd_soc_dapm_widget max98927_dapm_widgets[] = …;
static DECLARE_TLV_DB_SCALE(max98927_spk_tlv, 300, 300, 0);
static DECLARE_TLV_DB_SCALE(max98927_digital_tlv, -1600, 25, 0);
static bool max98927_readable_register(struct device *dev, unsigned int reg)
{
switch (reg) {
case MAX98927_R0001_INT_RAW1 ... MAX98927_R0028_ICC_RX_EN_B:
case MAX98927_R002B_ICC_TX_EN_A ... MAX98927_R002C_ICC_TX_EN_B:
case MAX98927_R002E_ICC_HIZ_MANUAL_MODE
... MAX98927_R004E_MEAS_ADC_CH2_READ:
case MAX98927_R0051_BROWNOUT_STATUS
... MAX98927_R0055_BROWNOUT_LVL_HOLD:
case MAX98927_R005A_BROWNOUT_LVL1_THRESH
... MAX98927_R0061_BROWNOUT_AMP1_CLIP_MODE:
case MAX98927_R0072_BROWNOUT_LVL1_CUR_LIMIT
... MAX98927_R0087_ENV_TRACK_BOOST_VOUT_READ:
case MAX98927_R00FF_GLOBAL_SHDN:
case MAX98927_R0100_SOFT_RESET:
case MAX98927_R01FF_REV_ID:
return true;
default:
return false;
}
};
static bool max98927_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static const char * const max98927_boost_voltage_text[] = …;
static SOC_ENUM_SINGLE_DECL(max98927_boost_voltage,
MAX98927_R0040_BOOST_CTRL0, 0,
max98927_boost_voltage_text);
static const char * const max98927_current_limit_text[] = …;
static SOC_ENUM_SINGLE_DECL(max98927_current_limit,
MAX98927_R0042_BOOST_CTRL1, 1,
max98927_current_limit_text);
static const struct snd_kcontrol_new max98927_snd_controls[] = …;
static const struct snd_soc_dapm_route max98927_audio_map[] = …;
static struct snd_soc_dai_driver max98927_dai[] = …;
static int max98927_probe(struct snd_soc_component *component)
{ … }
#ifdef CONFIG_PM_SLEEP
static int max98927_suspend(struct device *dev)
{ … }
static int max98927_resume(struct device *dev)
{ … }
#endif
static const struct dev_pm_ops max98927_pm = …;
static const struct snd_soc_component_driver soc_component_dev_max98927 = …;
static const struct regmap_config max98927_regmap = …;
static void max98927_slot_config(struct i2c_client *i2c,
struct max98927_priv *max98927)
{ … }
static int max98927_i2c_probe(struct i2c_client *i2c)
{ … }
static void max98927_i2c_remove(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id max98927_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, max98927_i2c_id);
#if defined(CONFIG_OF)
static const struct of_device_id max98927_of_match[] = …;
MODULE_DEVICE_TABLE(of, max98927_of_match);
#endif
#ifdef CONFIG_ACPI
static const struct acpi_device_id max98927_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, max98927_acpi_match);
#endif
static struct i2c_driver max98927_i2c_driver = …;
module_i2c_driver(…) …
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;