linux/sound/soc/ti/davinci-i2s.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * ALSA SoC I2S (McBSP) Audio Layer for TI DAVINCI processor
 *
 * Author:      Vladimir Barinov, <[email protected]>
 * Copyright:   (C) 2007 MontaVista Software, Inc., <[email protected]>
 *
 * DT support	(c) 2016 Petr Kulhavy, Barix AG <[email protected]>
 *		based on davinci-mcasp.c DT support
 *
 * TODO:
 * on DA850 implement HW FIFOs instead of DMA into DXR and DRR registers
 */

#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 <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 "davinci-i2s.h"

#define DRV_NAME

/*
 * NOTE:  terminology here is confusing.
 *
 *  - This driver supports the "Audio Serial Port" (ASP),
 *    found on dm6446, dm355, and other DaVinci chips.
 *
 *  - But it labels it a "Multi-channel Buffered Serial Port"
 *    (McBSP) as on older chips like the dm642 ... which was
 *    backward-compatible, possibly explaining that confusion.
 *
 *  - OMAP chips have a controller called McBSP, which is
 *    incompatible with the DaVinci flavor of McBSP.
 *
 *  - Newer DaVinci chips have a controller called McASP,
 *    incompatible with ASP and with either McBSP.
 *
 * In short:  this uses ASP to implement I2S, not McBSP.
 * And it won't be the only DaVinci implemention of I2S.
 */
#define DAVINCI_MCBSP_DRR_REG
#define DAVINCI_MCBSP_DXR_REG
#define DAVINCI_MCBSP_SPCR_REG
#define DAVINCI_MCBSP_RCR_REG
#define DAVINCI_MCBSP_XCR_REG
#define DAVINCI_MCBSP_SRGR_REG
#define DAVINCI_MCBSP_PCR_REG

#define DAVINCI_MCBSP_SPCR_RRST
#define DAVINCI_MCBSP_SPCR_RINTM(v)
#define DAVINCI_MCBSP_SPCR_RJUST(v)
#define DAVINCI_MCBSP_SPCR_RJUST_Z_LE
#define DAVINCI_MCBSP_SPCR_RJUST_S_LE
#define DAVINCI_MCBSP_SPCR_XRST
#define DAVINCI_MCBSP_SPCR_XINTM(v)
#define DAVINCI_MCBSP_SPCR_GRST
#define DAVINCI_MCBSP_SPCR_FRST
#define DAVINCI_MCBSP_SPCR_FREE

#define DAVINCI_MCBSP_RCR_RWDLEN1(v)
#define DAVINCI_MCBSP_RCR_RFRLEN1(v)
#define DAVINCI_MCBSP_RCR_RDATDLY(v)
#define DAVINCI_MCBSP_RCR_RFIG
#define DAVINCI_MCBSP_RCR_RWDLEN2(v)
#define DAVINCI_MCBSP_RCR_RFRLEN2(v)
#define DAVINCI_MCBSP_RCR_RPHASE

#define DAVINCI_MCBSP_XCR_XWDLEN1(v)
#define DAVINCI_MCBSP_XCR_XFRLEN1(v)
#define DAVINCI_MCBSP_XCR_XDATDLY(v)
#define DAVINCI_MCBSP_XCR_XFIG
#define DAVINCI_MCBSP_XCR_XWDLEN2(v)
#define DAVINCI_MCBSP_XCR_XFRLEN2(v)
#define DAVINCI_MCBSP_XCR_XPHASE

#define DAVINCI_MCBSP_SRGR_FWID(v)
#define DAVINCI_MCBSP_SRGR_FPER(v)
#define DAVINCI_MCBSP_SRGR_FSGM
#define DAVINCI_MCBSP_SRGR_CLKSM

#define DAVINCI_MCBSP_PCR_CLKRP
#define DAVINCI_MCBSP_PCR_CLKXP
#define DAVINCI_MCBSP_PCR_FSRP
#define DAVINCI_MCBSP_PCR_FSXP
#define DAVINCI_MCBSP_PCR_SCLKME
#define DAVINCI_MCBSP_PCR_CLKRM
#define DAVINCI_MCBSP_PCR_CLKXM
#define DAVINCI_MCBSP_PCR_FSRM
#define DAVINCI_MCBSP_PCR_FSXM

enum {};

static const unsigned char asp_word_length[SNDRV_PCM_FORMAT_S32_LE + 1] =;

static const unsigned char double_fmt[SNDRV_PCM_FORMAT_S32_LE + 1] =;

struct davinci_mcbsp_dev {};

static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev,
					   int reg, u32 val)
{}

static inline u32 davinci_mcbsp_read_reg(struct davinci_mcbsp_dev *dev, int reg)
{}

static void toggle_clock(struct davinci_mcbsp_dev *dev, int playback)
{}

static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev,
		struct snd_pcm_substream *substream)
{}

static void davinci_mcbsp_stop(struct davinci_mcbsp_dev *dev, int playback)
{}

static int davinci_i2s_tdm_word_length(int tdm_slot_width)
{}

static int davinci_i2s_set_tdm_slot(struct snd_soc_dai *cpu_dai,
				    unsigned int tx_mask,
				    unsigned int rx_mask,
				    int slots, int slot_width)
{}

#define DEFAULT_BITPERSAMPLE

static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
				   unsigned int fmt)
{}

static int davinci_i2s_dai_set_clkdiv(struct snd_soc_dai *cpu_dai,
				int div_id, int div)
{}

static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
				 struct snd_pcm_hw_params *params,
				 struct snd_soc_dai *dai)
{}

static int davinci_i2s_prepare(struct snd_pcm_substream *substream,
		struct snd_soc_dai *dai)
{}

static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
			       struct snd_soc_dai *dai)
{}

static void davinci_i2s_shutdown(struct snd_pcm_substream *substream,
		struct snd_soc_dai *dai)
{}

#define DAVINCI_I2S_RATES
#define DAVINCI_I2S_FORMATS

static int davinci_i2s_dai_probe(struct snd_soc_dai *dai)
{}

static const struct snd_soc_dai_ops davinci_i2s_dai_ops =;

static struct snd_soc_dai_driver davinci_i2s_dai =;

static const struct snd_soc_component_driver davinci_i2s_component =;

static int davinci_i2s_probe(struct platform_device *pdev)
{}

static void davinci_i2s_remove(struct platform_device *pdev)
{}

static const struct of_device_id davinci_i2s_match[] __maybe_unused =;
MODULE_DEVICE_TABLE(of, davinci_i2s_match);

static struct platform_driver davinci_mcbsp_driver =;

module_platform_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();