linux/sound/soc/cirrus/ep93xx-i2s.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * linux/sound/soc/ep93xx-i2s.c
 * EP93xx I2S driver
 *
 * Copyright (C) 2010 Ryan Mallon
 *
 * Based on the original driver by:
 *   Copyright (C) 2007 Chase Douglas <chasedouglas@gmail>
 *   Copyright (C) 2006 Lennert Buytenhek <[email protected]>
 */

#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/of.h>

#include <sound/core.h>
#include <sound/dmaengine_pcm.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/initval.h>
#include <sound/soc.h>

#include <linux/platform_data/dma-ep93xx.h>
#include <linux/soc/cirrus/ep93xx.h>

#include "ep93xx-pcm.h"

#define EP93XX_I2S_TXCLKCFG
#define EP93XX_I2S_RXCLKCFG
#define EP93XX_I2S_GLSTS
#define EP93XX_I2S_GLCTRL

#define EP93XX_I2S_I2STX0LFT
#define EP93XX_I2S_I2STX0RT

#define EP93XX_I2S_TXLINCTRLDATA
#define EP93XX_I2S_TXCTRL
#define EP93XX_I2S_TXWRDLEN
#define EP93XX_I2S_TX0EN

#define EP93XX_I2S_RXLINCTRLDATA
#define EP93XX_I2S_RXCTRL
#define EP93XX_I2S_RXWRDLEN
#define EP93XX_I2S_RX0EN

#define EP93XX_I2S_WRDLEN_16
#define EP93XX_I2S_WRDLEN_24
#define EP93XX_I2S_WRDLEN_32

#define EP93XX_I2S_RXLINCTRLDATA_R_JUST

#define EP93XX_I2S_TXLINCTRLDATA_R_JUST

/*
 * Transmit empty interrupt level select:
 * 0 - Generate interrupt when FIFO is half empty
 * 1 - Generate interrupt when FIFO is empty
 */
#define EP93XX_I2S_TXCTRL_TXEMPTY_LVL
#define EP93XX_I2S_TXCTRL_TXUFIE

#define EP93XX_I2S_CLKCFG_LRS
#define EP93XX_I2S_CLKCFG_CKP
#define EP93XX_I2S_CLKCFG_REL
#define EP93XX_I2S_CLKCFG_MASTER
#define EP93XX_I2S_CLKCFG_NBCG

#define EP93XX_I2S_GLSTS_TX0_FIFO_FULL

struct ep93xx_i2s_info {};

static struct ep93xx_dma_data ep93xx_i2s_dma_data[] =;

static inline void ep93xx_i2s_write_reg(struct ep93xx_i2s_info *info,
					unsigned reg, unsigned val)
{}

static inline unsigned ep93xx_i2s_read_reg(struct ep93xx_i2s_info *info,
					   unsigned reg)
{}

static void ep93xx_i2s_enable(struct ep93xx_i2s_info *info, int stream)
{}

static void ep93xx_i2s_disable(struct ep93xx_i2s_info *info, int stream)
{}

/*
 * According to documentation I2S controller can handle underflow conditions
 * just fine, but in reality the state machine is sometimes confused so that
 * the whole stream is shifted by one byte. The watchdog below disables the TX
 * FIFO, fills the buffer with zeroes and re-enables the FIFO. State machine
 * is being reset and by filling the buffer we get some time before next
 * underflow happens.
 */
static irqreturn_t ep93xx_i2s_interrupt(int irq, void *dev_id)
{}

static int ep93xx_i2s_dai_probe(struct snd_soc_dai *dai)
{}

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

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

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

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

static int ep93xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id,
				 unsigned int freq, int dir)
{}

#ifdef CONFIG_PM
static int ep93xx_i2s_suspend(struct snd_soc_component *component)
{}

static int ep93xx_i2s_resume(struct snd_soc_component *component)
{}
#else
#define ep93xx_i2s_suspend
#define ep93xx_i2s_resume
#endif

static const struct snd_soc_dai_ops ep93xx_i2s_dai_ops =;

#define EP93XX_I2S_FORMATS

static struct snd_soc_dai_driver ep93xx_i2s_dai =;

static const struct snd_soc_component_driver ep93xx_i2s_component =;

static int ep93xx_i2s_probe(struct platform_device *pdev)
{}

static void ep93xx_i2s_remove(struct platform_device *pdev)
{}

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

static struct platform_driver ep93xx_i2s_driver =;

module_platform_driver();

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