#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/dma/imx-dma.h>
#include <linux/pm_runtime.h>
#include <sound/dmaengine_pcm.h>
#include <sound/pcm_params.h>
#include "fsl_asrc.h"
#define IDEAL_RATIO_DECIMAL_DEPTH …
#define DIVIDER_NUM …
#define INIT_RETRY_NUM …
#define pair_err(fmt, ...) …
#define pair_dbg(fmt, ...) …
#define pair_warn(fmt, ...) …
static unsigned int supported_asrc_rate[] = …;
static struct snd_pcm_hw_constraint_list fsl_asrc_rate_constraints = …;
static unsigned char input_clk_map_imx35[ASRC_CLK_MAP_LEN] = …;
static unsigned char output_clk_map_imx35[ASRC_CLK_MAP_LEN] = …;
static unsigned char input_clk_map_imx53[ASRC_CLK_MAP_LEN] = …;
static unsigned char output_clk_map_imx53[ASRC_CLK_MAP_LEN] = …;
static unsigned char clk_map_imx8qm[2][ASRC_CLK_MAP_LEN] = …;
static unsigned char clk_map_imx8qxp[2][ASRC_CLK_MAP_LEN] = …;
static int asrc_clk_divider[DIVIDER_NUM] = …;
static bool fsl_asrc_divider_avail(int clk_rate, int rate, int *div)
{ … }
static void fsl_asrc_sel_proc(int inrate, int outrate,
int *pre_proc, int *post_proc)
{ … }
static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair)
{ … }
static void fsl_asrc_release_pair(struct fsl_asrc_pair *pair)
{ … }
static void fsl_asrc_set_watermarks(struct fsl_asrc_pair *pair, u32 in, u32 out)
{ … }
static u32 fsl_asrc_cal_asrck_divisor(struct fsl_asrc_pair *pair, u32 div)
{ … }
static int fsl_asrc_set_ideal_ratio(struct fsl_asrc_pair *pair,
int inrate, int outrate)
{ … }
static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate)
{ … }
static void fsl_asrc_start_pair(struct fsl_asrc_pair *pair)
{ … }
static void fsl_asrc_stop_pair(struct fsl_asrc_pair *pair)
{ … }
static struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair,
bool dir)
{ … }
static int fsl_asrc_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static void fsl_asrc_select_clk(struct fsl_asrc_priv *asrc_priv,
struct fsl_asrc_pair *pair,
int in_rate,
int out_rate)
{ … }
static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ … }
static int fsl_asrc_dai_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static int fsl_asrc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{ … }
static int fsl_asrc_dai_probe(struct snd_soc_dai *dai)
{ … }
static const struct snd_soc_dai_ops fsl_asrc_dai_ops = …;
#define FSL_ASRC_FORMATS …
static struct snd_soc_dai_driver fsl_asrc_dai = …;
static bool fsl_asrc_readable_reg(struct device *dev, unsigned int reg)
{ … }
static bool fsl_asrc_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static bool fsl_asrc_writeable_reg(struct device *dev, unsigned int reg)
{ … }
static struct reg_default fsl_asrc_reg[] = …;
static const struct regmap_config fsl_asrc_regmap_config = …;
static int fsl_asrc_init(struct fsl_asrc *asrc)
{ … }
static irqreturn_t fsl_asrc_isr(int irq, void *dev_id)
{ … }
static int fsl_asrc_get_fifo_addr(u8 dir, enum asrc_pair_index index)
{ … }
static int fsl_asrc_runtime_resume(struct device *dev);
static int fsl_asrc_runtime_suspend(struct device *dev);
static int fsl_asrc_probe(struct platform_device *pdev)
{ … }
static void fsl_asrc_remove(struct platform_device *pdev)
{ … }
static int fsl_asrc_runtime_resume(struct device *dev)
{ … }
static int fsl_asrc_runtime_suspend(struct device *dev)
{ … }
static const struct dev_pm_ops fsl_asrc_pm = …;
static const struct fsl_asrc_soc_data fsl_asrc_imx35_data = …;
static const struct fsl_asrc_soc_data fsl_asrc_imx53_data = …;
static const struct fsl_asrc_soc_data fsl_asrc_imx8qm_data = …;
static const struct fsl_asrc_soc_data fsl_asrc_imx8qxp_data = …;
static const struct of_device_id fsl_asrc_ids[] = …;
MODULE_DEVICE_TABLE(of, fsl_asrc_ids);
static struct platform_driver fsl_asrc_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_ALIAS(…) …;
MODULE_LICENSE(…) …;