#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include <sound/initval.h>
#include "tlv320aic23.h"
static const struct reg_default tlv320aic23_reg[] = …;
const struct regmap_config tlv320aic23_regmap = …;
EXPORT_SYMBOL(…);
static const char *rec_src_text[] = …;
static const char *deemph_text[] = …;
static SOC_ENUM_SINGLE_DECL(rec_src_enum,
TLV320AIC23_ANLG, 2, rec_src_text);
static const struct snd_kcontrol_new tlv320aic23_rec_src_mux_controls = …;
static SOC_ENUM_SINGLE_DECL(tlv320aic23_deemph,
TLV320AIC23_DIGT, 1, deemph_text);
static const DECLARE_TLV_DB_SCALE(out_gain_tlv, -12100, 100, 0);
static const DECLARE_TLV_DB_SCALE(input_gain_tlv, -1725, 75, 0);
static const DECLARE_TLV_DB_SCALE(sidetone_vol_tlv, -1800, 300, 0);
static int snd_soc_tlv320aic23_put_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int snd_soc_tlv320aic23_get_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new tlv320aic23_snd_controls[] = …;
static const struct snd_kcontrol_new tlv320aic23_output_mixer_controls[] = …;
static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = …;
static const struct snd_soc_dapm_route tlv320aic23_intercon[] = …;
struct aic23 { … };
static const int bosr_usb_divisor_table[] = …;
#define LOWER_GROUP …
#define UPPER_GROUP …
static const unsigned short sr_valid_mask[] = …;
#define SR_MULT …
#define A(x) …
static const unsigned char sr_adc_mult_table[] = …;
static const unsigned char sr_dac_mult_table[] = …;
static unsigned get_score(int adc, int adc_l, int adc_h, int need_adc,
int dac, int dac_l, int dac_h, int need_dac)
{ … }
static int find_rate(int mclk, u32 need_adc, u32 need_dac)
{ … }
#ifdef DEBUG
static void get_current_sample_rates(struct snd_soc_component *component, int mclk,
u32 *sample_rate_adc, u32 *sample_rate_dac)
{
int src = snd_soc_component_read(component, TLV320AIC23_SRATE);
int sr = (src >> 2) & 0x0f;
int val = (mclk / bosr_usb_divisor_table[src & 3]);
int adc = (val * sr_adc_mult_table[sr]) / SR_MULT;
int dac = (val * sr_dac_mult_table[sr]) / SR_MULT;
if (src & TLV320AIC23_CLKIN_HALF) {
adc >>= 1;
dac >>= 1;
}
*sample_rate_adc = adc;
*sample_rate_dac = dac;
}
#endif
static int set_sample_rate_control(struct snd_soc_component *component, int mclk,
u32 sample_rate_adc, u32 sample_rate_dac)
{ … }
static int tlv320aic23_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int tlv320aic23_pcm_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static void tlv320aic23_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static int tlv320aic23_mute(struct snd_soc_dai *dai, int mute, int direction)
{ … }
static int tlv320aic23_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{ … }
static int tlv320aic23_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int tlv320aic23_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{ … }
#define AIC23_RATES …
#define AIC23_FORMATS …
static const struct snd_soc_dai_ops tlv320aic23_dai_ops = …;
static struct snd_soc_dai_driver tlv320aic23_dai = …;
static int tlv320aic23_resume(struct snd_soc_component *component)
{ … }
static int tlv320aic23_component_probe(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_component_dev_tlv320aic23 = …;
int tlv320aic23_probe(struct device *dev, struct regmap *regmap)
{ … }
EXPORT_SYMBOL(…);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;