#include <linux/init.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/pm_runtime.h>
#include <linux/of.h>
#include <linux/platform_data/davinci_asp.h>
#include <linux/math64.h>
#include <linux/bitmap.h>
#include <linux/gpio/driver.h>
#include <sound/asoundef.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/initval.h>
#include <sound/soc.h>
#include <sound/dmaengine_pcm.h>
#include "edma-pcm.h"
#include "sdma-pcm.h"
#include "udma-pcm.h"
#include "davinci-mcasp.h"
#define MCASP_MAX_AFIFO_DEPTH …
#ifdef CONFIG_PM
static u32 context_regs[] = …;
struct davinci_mcasp_context { … };
#endif
struct davinci_mcasp_ruledata { … };
struct davinci_mcasp { … };
static inline void mcasp_set_bits(struct davinci_mcasp *mcasp, u32 offset,
u32 val)
{ … }
static inline void mcasp_clr_bits(struct davinci_mcasp *mcasp, u32 offset,
u32 val)
{ … }
static inline void mcasp_mod_bits(struct davinci_mcasp *mcasp, u32 offset,
u32 val, u32 mask)
{ … }
static inline void mcasp_set_reg(struct davinci_mcasp *mcasp, u32 offset,
u32 val)
{ … }
static inline u32 mcasp_get_reg(struct davinci_mcasp *mcasp, u32 offset)
{ … }
static void mcasp_set_ctl_reg(struct davinci_mcasp *mcasp, u32 ctl_reg, u32 val)
{ … }
static bool mcasp_is_synchronous(struct davinci_mcasp *mcasp)
{ … }
static inline void mcasp_set_clk_pdir(struct davinci_mcasp *mcasp, bool enable)
{ … }
static inline void mcasp_set_axr_pdir(struct davinci_mcasp *mcasp, bool enable)
{ … }
static void mcasp_start_rx(struct davinci_mcasp *mcasp)
{ … }
static void mcasp_start_tx(struct davinci_mcasp *mcasp)
{ … }
static void davinci_mcasp_start(struct davinci_mcasp *mcasp, int stream)
{ … }
static void mcasp_stop_rx(struct davinci_mcasp *mcasp)
{ … }
static void mcasp_stop_tx(struct davinci_mcasp *mcasp)
{ … }
static void davinci_mcasp_stop(struct davinci_mcasp *mcasp, int stream)
{ … }
static irqreturn_t davinci_mcasp_tx_irq_handler(int irq, void *data)
{ … }
static irqreturn_t davinci_mcasp_rx_irq_handler(int irq, void *data)
{ … }
static irqreturn_t davinci_mcasp_common_irq_handler(int irq, void *data)
{ … }
static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
unsigned int fmt)
{ … }
static int __davinci_mcasp_set_clkdiv(struct davinci_mcasp *mcasp, int div_id,
int div, bool explicit)
{ … }
static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id,
int div)
{ … }
static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id,
unsigned int freq, int dir)
{ … }
static int davinci_mcasp_ch_constraint(struct davinci_mcasp *mcasp, int stream,
int serializers)
{ … }
static int davinci_mcasp_set_ch_constraints(struct davinci_mcasp *mcasp)
{ … }
static int davinci_mcasp_set_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask,
unsigned int rx_mask,
int slots, int slot_width)
{ … }
static int davinci_config_channel_size(struct davinci_mcasp *mcasp,
int sample_width)
{ … }
static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
int period_words, int channels)
{ … }
static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream,
int channels)
{ … }
static int mcasp_dit_hw_param(struct davinci_mcasp *mcasp,
unsigned int rate)
{ … }
static int davinci_mcasp_calc_clk_div(struct davinci_mcasp *mcasp,
unsigned int sysclk_freq,
unsigned int bclk_freq, bool set)
{ … }
static inline u32 davinci_mcasp_tx_delay(struct davinci_mcasp *mcasp)
{ … }
static inline u32 davinci_mcasp_rx_delay(struct davinci_mcasp *mcasp)
{ … }
static snd_pcm_sframes_t davinci_mcasp_delay(
struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai)
{ … }
static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *cpu_dai)
{ … }
static int davinci_mcasp_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_dai *cpu_dai)
{ … }
static int davinci_mcasp_hw_rule_slot_width(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule)
{ … }
static int davinci_mcasp_hw_rule_format_width(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule)
{ … }
static const unsigned int davinci_mcasp_dai_rates[] = …;
#define DAVINCI_MAX_RATE_ERROR_PPM …
static int davinci_mcasp_hw_rule_rate(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule)
{ … }
static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule)
{ … }
static int davinci_mcasp_hw_rule_min_periodsize(
struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule)
{ … }
static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai)
{ … }
static void davinci_mcasp_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai)
{ … }
static int davinci_mcasp_iec958_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ … }
static int davinci_mcasp_iec958_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *uctl)
{ … }
static int davinci_mcasp_iec958_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *uctl)
{ … }
static int davinci_mcasp_iec958_con_mask_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static const struct snd_kcontrol_new davinci_mcasp_iec958_ctls[] = …;
static void davinci_mcasp_init_iec958_status(struct davinci_mcasp *mcasp)
{ … }
static int davinci_mcasp_dai_probe(struct snd_soc_dai *dai)
{ … }
static const struct snd_soc_dai_ops davinci_mcasp_dai_ops = …;
#define DAVINCI_MCASP_RATES …
#define DAVINCI_MCASP_PCM_FMTS …
static struct snd_soc_dai_driver davinci_mcasp_dai[] = …;
static const struct snd_soc_component_driver davinci_mcasp_component = …;
static struct davinci_mcasp_pdata dm646x_mcasp_pdata = …;
static struct davinci_mcasp_pdata da830_mcasp_pdata = …;
static struct davinci_mcasp_pdata am33xx_mcasp_pdata = …;
static struct davinci_mcasp_pdata dra7_mcasp_pdata = …;
static struct davinci_mcasp_pdata omap_mcasp_pdata = …;
static const struct of_device_id mcasp_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, mcasp_dt_ids);
static int mcasp_reparent_fck(struct platform_device *pdev)
{ … }
static bool davinci_mcasp_have_gpiochip(struct davinci_mcasp *mcasp)
{ … }
static int davinci_mcasp_get_config(struct davinci_mcasp *mcasp,
struct platform_device *pdev)
{ … }
enum { … };
static const char *sdma_prefix = …;
static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp)
{ … }
static u32 davinci_mcasp_txdma_offset(struct davinci_mcasp_pdata *pdata)
{ … }
static u32 davinci_mcasp_rxdma_offset(struct davinci_mcasp_pdata *pdata)
{ … }
#ifdef CONFIG_GPIOLIB
static int davinci_mcasp_gpio_request(struct gpio_chip *chip, unsigned offset)
{ … }
static void davinci_mcasp_gpio_free(struct gpio_chip *chip, unsigned offset)
{ … }
static int davinci_mcasp_gpio_direction_out(struct gpio_chip *chip,
unsigned offset, int value)
{ … }
static void davinci_mcasp_gpio_set(struct gpio_chip *chip, unsigned offset,
int value)
{ … }
static int davinci_mcasp_gpio_direction_in(struct gpio_chip *chip,
unsigned offset)
{ … }
static int davinci_mcasp_gpio_get(struct gpio_chip *chip, unsigned offset)
{ … }
static int davinci_mcasp_gpio_get_direction(struct gpio_chip *chip,
unsigned offset)
{ … }
static const struct gpio_chip davinci_mcasp_template_chip = …;
static int davinci_mcasp_init_gpiochip(struct davinci_mcasp *mcasp)
{ … }
#else
static inline int davinci_mcasp_init_gpiochip(struct davinci_mcasp *mcasp)
{
return 0;
}
#endif
static int davinci_mcasp_probe(struct platform_device *pdev)
{ … }
static void davinci_mcasp_remove(struct platform_device *pdev)
{ … }
#ifdef CONFIG_PM
static int davinci_mcasp_runtime_suspend(struct device *dev)
{ … }
static int davinci_mcasp_runtime_resume(struct device *dev)
{ … }
#endif
static const struct dev_pm_ops davinci_mcasp_pm_ops = …;
static struct platform_driver davinci_mcasp_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;