#include <linux/of.h>
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <sound/core.h>
#include <sound/dmaengine_pcm.h>
#include <sound/pcm_params.h>
#include <sound/tlv.h>
#include "atmel-pdmic.h"
struct atmel_pdmic_pdata { … };
struct atmel_pdmic { … };
static const struct of_device_id atmel_pdmic_of_match[] = …;
MODULE_DEVICE_TABLE(of, atmel_pdmic_of_match);
#define PDMIC_OFFSET_MAX_VAL …
#define PDMIC_OFFSET_MIN_VAL …
static struct atmel_pdmic_pdata *atmel_pdmic_dt_init(struct device *dev)
{ … }
static int atmel_pdmic_cpu_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai)
{ … }
static void atmel_pdmic_cpu_dai_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai)
{ … }
static int atmel_pdmic_cpu_dai_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai)
{ … }
#define ATMEL_PDMIC_FORMATS …
#define ATMEL_PDMIC_MAX_BUF_SIZE …
#define ATMEL_PDMIC_PREALLOC_BUF_SIZE …
static const struct snd_pcm_hardware atmel_pdmic_hw = …;
static int
atmel_pdmic_platform_configure_dma(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct dma_slave_config *slave_config)
{ … }
static const struct snd_dmaengine_pcm_config
atmel_pdmic_dmaengine_pcm_config = …;
struct mic_gain { … };
static const struct mic_gain mic_gain_table[] = …;
static const DECLARE_TLV_DB_RANGE(mic_gain_tlv,
0, 1, TLV_DB_SCALE_ITEM(-9000, 600, 0),
2, 5, TLV_DB_SCALE_ITEM(-8100, 300, 0),
6, 7, TLV_DB_SCALE_ITEM(-7000, 200, 0),
8, ARRAY_SIZE(mic_gain_table)-1, TLV_DB_SCALE_ITEM(-6500, 100, 0),
);
static int pdmic_get_mic_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int pdmic_put_mic_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new atmel_pdmic_snd_controls[] = …;
static int atmel_pdmic_component_probe(struct snd_soc_component *component)
{ … }
#define PDMIC_MR_PRESCAL_MAX_VAL …
static int
atmel_pdmic_cpu_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *cpu_dai)
{ … }
static int atmel_pdmic_cpu_dai_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_dai *cpu_dai)
{ … }
static const struct snd_soc_dai_ops atmel_pdmic_cpu_dai_ops = …;
static struct snd_soc_dai_driver atmel_pdmic_cpu_dai = …;
static const struct snd_soc_component_driver atmel_pdmic_cpu_dai_component = …;
static int atmel_pdmic_asoc_card_init(struct device *dev,
struct snd_soc_card *card)
{ … }
static void atmel_pdmic_get_sample_rate(struct atmel_pdmic *dd,
unsigned int *rate_min, unsigned int *rate_max)
{ … }
static irqreturn_t atmel_pdmic_interrupt(int irq, void *dev_id)
{ … }
#define ATMEL_PDMIC_REG_MAX …
static const struct regmap_config atmel_pdmic_regmap_config = …;
static int atmel_pdmic_probe(struct platform_device *pdev)
{ … }
static struct platform_driver atmel_pdmic_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;