#include <linux/err.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/gpio/consumer.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 "ssm2518.h"
#define SSM2518_REG_POWER1 …
#define SSM2518_REG_CLOCK …
#define SSM2518_REG_SAI_CTRL1 …
#define SSM2518_REG_SAI_CTRL2 …
#define SSM2518_REG_CHAN_MAP …
#define SSM2518_REG_LEFT_VOL …
#define SSM2518_REG_RIGHT_VOL …
#define SSM2518_REG_MUTE_CTRL …
#define SSM2518_REG_FAULT_CTRL …
#define SSM2518_REG_POWER2 …
#define SSM2518_REG_DRC_1 …
#define SSM2518_REG_DRC_2 …
#define SSM2518_REG_DRC_3 …
#define SSM2518_REG_DRC_4 …
#define SSM2518_REG_DRC_5 …
#define SSM2518_REG_DRC_6 …
#define SSM2518_REG_DRC_7 …
#define SSM2518_REG_DRC_8 …
#define SSM2518_REG_DRC_9 …
#define SSM2518_POWER1_RESET …
#define SSM2518_POWER1_NO_BCLK …
#define SSM2518_POWER1_MCS_MASK …
#define SSM2518_POWER1_MCS_64FS …
#define SSM2518_POWER1_MCS_128FS …
#define SSM2518_POWER1_MCS_256FS …
#define SSM2518_POWER1_MCS_384FS …
#define SSM2518_POWER1_MCS_512FS …
#define SSM2518_POWER1_MCS_768FS …
#define SSM2518_POWER1_MCS_100FS …
#define SSM2518_POWER1_MCS_200FS …
#define SSM2518_POWER1_MCS_400FS …
#define SSM2518_POWER1_SPWDN …
#define SSM2518_CLOCK_ASR …
#define SSM2518_SAI_CTRL1_FMT_MASK …
#define SSM2518_SAI_CTRL1_FMT_I2S …
#define SSM2518_SAI_CTRL1_FMT_LJ …
#define SSM2518_SAI_CTRL1_FMT_RJ_24BIT …
#define SSM2518_SAI_CTRL1_FMT_RJ_16BIT …
#define SSM2518_SAI_CTRL1_SAI_MASK …
#define SSM2518_SAI_CTRL1_SAI_I2S …
#define SSM2518_SAI_CTRL1_SAI_TDM_2 …
#define SSM2518_SAI_CTRL1_SAI_TDM_4 …
#define SSM2518_SAI_CTRL1_SAI_TDM_8 …
#define SSM2518_SAI_CTRL1_SAI_TDM_16 …
#define SSM2518_SAI_CTRL1_SAI_MONO …
#define SSM2518_SAI_CTRL1_FS_MASK …
#define SSM2518_SAI_CTRL1_FS_8000_12000 …
#define SSM2518_SAI_CTRL1_FS_16000_24000 …
#define SSM2518_SAI_CTRL1_FS_32000_48000 …
#define SSM2518_SAI_CTRL1_FS_64000_96000 …
#define SSM2518_SAI_CTRL2_BCLK_INTERAL …
#define SSM2518_SAI_CTRL2_LRCLK_PULSE …
#define SSM2518_SAI_CTRL2_LRCLK_INVERT …
#define SSM2518_SAI_CTRL2_MSB …
#define SSM2518_SAI_CTRL2_SLOT_WIDTH_MASK …
#define SSM2518_SAI_CTRL2_SLOT_WIDTH_32 …
#define SSM2518_SAI_CTRL2_SLOT_WIDTH_24 …
#define SSM2518_SAI_CTRL2_SLOT_WIDTH_16 …
#define SSM2518_SAI_CTRL2_BCLK_INVERT …
#define SSM2518_CHAN_MAP_RIGHT_SLOT_OFFSET …
#define SSM2518_CHAN_MAP_RIGHT_SLOT_MASK …
#define SSM2518_CHAN_MAP_LEFT_SLOT_OFFSET …
#define SSM2518_CHAN_MAP_LEFT_SLOT_MASK …
#define SSM2518_MUTE_CTRL_ANA_GAIN …
#define SSM2518_MUTE_CTRL_MUTE_MASTER …
#define SSM2518_POWER2_APWDN …
#define SSM2518_DAC_MUTE …
#define SSM2518_DAC_FS_MASK …
#define SSM2518_DAC_FS_8000 …
#define SSM2518_DAC_FS_16000 …
#define SSM2518_DAC_FS_32000 …
#define SSM2518_DAC_FS_64000 …
#define SSM2518_DAC_FS_128000 …
struct ssm2518 { … };
static const struct reg_default ssm2518_reg_defaults[] = …;
static const DECLARE_TLV_DB_MINMAX_MUTE(ssm2518_vol_tlv, -7125, 2400);
static const DECLARE_TLV_DB_SCALE(ssm2518_compressor_tlv, -3400, 200, 0);
static const DECLARE_TLV_DB_SCALE(ssm2518_expander_tlv, -8100, 300, 0);
static const DECLARE_TLV_DB_SCALE(ssm2518_noise_gate_tlv, -9600, 300, 0);
static const DECLARE_TLV_DB_SCALE(ssm2518_post_drc_tlv, -2400, 300, 0);
static const DECLARE_TLV_DB_RANGE(ssm2518_limiter_tlv,
0, 7, TLV_DB_SCALE_ITEM(-2200, 200, 0),
7, 15, TLV_DB_SCALE_ITEM(-800, 100, 0),
);
static const char * const ssm2518_drc_peak_detector_attack_time_text[] = …;
static const char * const ssm2518_drc_peak_detector_release_time_text[] = …;
static const char * const ssm2518_drc_hold_time_text[] = …;
static SOC_ENUM_SINGLE_DECL(ssm2518_drc_peak_detector_attack_time_enum,
SSM2518_REG_DRC_2, 4, ssm2518_drc_peak_detector_attack_time_text);
static SOC_ENUM_SINGLE_DECL(ssm2518_drc_peak_detector_release_time_enum,
SSM2518_REG_DRC_2, 0, ssm2518_drc_peak_detector_release_time_text);
static SOC_ENUM_SINGLE_DECL(ssm2518_drc_attack_time_enum,
SSM2518_REG_DRC_6, 4, ssm2518_drc_peak_detector_attack_time_text);
static SOC_ENUM_SINGLE_DECL(ssm2518_drc_decay_time_enum,
SSM2518_REG_DRC_6, 0, ssm2518_drc_peak_detector_release_time_text);
static SOC_ENUM_SINGLE_DECL(ssm2518_drc_hold_time_enum,
SSM2518_REG_DRC_7, 4, ssm2518_drc_hold_time_text);
static SOC_ENUM_SINGLE_DECL(ssm2518_drc_noise_gate_hold_time_enum,
SSM2518_REG_DRC_7, 0, ssm2518_drc_hold_time_text);
static SOC_ENUM_SINGLE_DECL(ssm2518_drc_rms_averaging_time_enum,
SSM2518_REG_DRC_9, 0, ssm2518_drc_peak_detector_release_time_text);
static const struct snd_kcontrol_new ssm2518_snd_controls[] = …;
static const struct snd_soc_dapm_widget ssm2518_dapm_widgets[] = …;
static const struct snd_soc_dapm_route ssm2518_routes[] = …;
struct ssm2518_mcs_lut { … };
static const unsigned int ssm2518_sysclks_2048000[] = …;
static const unsigned int ssm2518_sysclks_2822000[] = …;
static const unsigned int ssm2518_sysclks_3072000[] = …;
static const struct ssm2518_mcs_lut ssm2518_mcs_lut[] = …;
static const unsigned int ssm2518_rates_2048000[] = …;
static const struct snd_pcm_hw_constraint_list ssm2518_constraints_2048000 = …;
static const unsigned int ssm2518_rates_2822000[] = …;
static const struct snd_pcm_hw_constraint_list ssm2518_constraints_2822000 = …;
static const unsigned int ssm2518_rates_3072000[] = …;
static const struct snd_pcm_hw_constraint_list ssm2518_constraints_3072000 = …;
static const unsigned int ssm2518_rates_12288000[] = …;
static const struct snd_pcm_hw_constraint_list ssm2518_constraints_12288000 = …;
static int ssm2518_lookup_mcs(struct ssm2518 *ssm2518,
unsigned int rate)
{ … }
static int ssm2518_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ … }
static int ssm2518_mute(struct snd_soc_dai *dai, int mute, int direction)
{ … }
static int ssm2518_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ … }
static int ssm2518_set_power(struct ssm2518 *ssm2518, bool enable)
{ … }
static int ssm2518_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
static int ssm2518_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
unsigned int rx_mask, int slots, int width)
{ … }
static int ssm2518_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
#define SSM2518_FORMATS …
static const struct snd_soc_dai_ops ssm2518_dai_ops = …;
static struct snd_soc_dai_driver ssm2518_dai = …;
static int ssm2518_set_sysclk(struct snd_soc_component *component, int clk_id,
int source, unsigned int freq, int dir)
{ … }
static const struct snd_soc_component_driver ssm2518_component_driver = …;
static const struct regmap_config ssm2518_regmap_config = …;
static int ssm2518_i2c_probe(struct i2c_client *i2c)
{ … }
#ifdef CONFIG_OF
static const struct of_device_id ssm2518_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, ssm2518_dt_ids);
#endif
static const struct i2c_device_id ssm2518_i2c_ids[] = …;
MODULE_DEVICE_TABLE(i2c, ssm2518_i2c_ids);
static struct i2c_driver ssm2518_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;