linux/sound/soc/xtensa/xtfpga-i2s.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Xtfpga I2S controller driver
 *
 * Copyright (c) 2014 Cadence Design Systems Inc.
 */

#include <linux/clk.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>

#define DRV_NAME

#define XTFPGA_I2S_VERSION
#define XTFPGA_I2S_CONFIG
#define XTFPGA_I2S_INT_MASK
#define XTFPGA_I2S_INT_STATUS
#define XTFPGA_I2S_CHAN0_DATA
#define XTFPGA_I2S_CHAN1_DATA
#define XTFPGA_I2S_CHAN2_DATA
#define XTFPGA_I2S_CHAN3_DATA

#define XTFPGA_I2S_CONFIG_TX_ENABLE
#define XTFPGA_I2S_CONFIG_INT_ENABLE
#define XTFPGA_I2S_CONFIG_LEFT
#define XTFPGA_I2S_CONFIG_RATIO_BASE
#define XTFPGA_I2S_CONFIG_RATIO_MASK
#define XTFPGA_I2S_CONFIG_RES_BASE
#define XTFPGA_I2S_CONFIG_RES_MASK
#define XTFPGA_I2S_CONFIG_LEVEL_BASE
#define XTFPGA_I2S_CONFIG_LEVEL_MASK
#define XTFPGA_I2S_CONFIG_CHANNEL_BASE

#define XTFPGA_I2S_INT_UNDERRUN
#define XTFPGA_I2S_INT_LEVEL
#define XTFPGA_I2S_INT_VALID

#define XTFPGA_I2S_FIFO_SIZE

/*
 * I2S controller operation:
 *
 * Enabling TX: output 1 period of zeros (starting with left channel)
 * and then queued data.
 *
 * Level status and interrupt: whenever FIFO level is below FIFO trigger,
 * level status is 1 and an IRQ is asserted (if enabled).
 *
 * Underrun status and interrupt: whenever FIFO is empty, underrun status
 * is 1 and an IRQ is asserted (if enabled).
 */
struct xtfpga_i2s {};

static bool xtfpga_i2s_wr_reg(struct device *dev, unsigned int reg)
{}

static bool xtfpga_i2s_rd_reg(struct device *dev, unsigned int reg)
{}

static bool xtfpga_i2s_volatile_reg(struct device *dev, unsigned int reg)
{}

static const struct regmap_config xtfpga_i2s_regmap_config =;

/* Generate functions that do PIO from TX DMA area to FIFO for all supported
 * stream formats.
 * Functions will be called xtfpga_pcm_tx_<channels>x<sample bits>, e.g.
 * xtfpga_pcm_tx_2x16 for 16-bit stereo.
 *
 * FIFO consists of 32-bit words, one word per channel, always 2 channels.
 * If I2S interface is configured with smaller sample resolution, only
 * the LSB of each word is used.
 */
#define xtfpga_pcm_tx_fn

xtfpga_pcm_tx_fn(1, 16)
xtfpga_pcm_tx_fn(2, 16)
xtfpga_pcm_tx_fn(1, 32)
xtfpga_pcm_tx_fn(2, 32)

#undef xtfpga_pcm_tx_fn

static bool xtfpga_pcm_push_tx(struct xtfpga_i2s *i2s)
{}

static void xtfpga_pcm_refill_fifo(struct xtfpga_i2s *i2s)
{}

static irqreturn_t xtfpga_i2s_threaded_irq_handler(int irq, void *dev_id)
{}

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

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

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

/* PCM */

static const struct snd_pcm_hardware xtfpga_pcm_hardware =;

static int xtfpga_pcm_open(struct snd_soc_component *component,
			   struct snd_pcm_substream *substream)
{}

static int xtfpga_pcm_close(struct snd_soc_component *component,
			    struct snd_pcm_substream *substream)
{}

static int xtfpga_pcm_hw_params(struct snd_soc_component *component,
				struct snd_pcm_substream *substream,
				struct snd_pcm_hw_params *hw_params)
{}

static int xtfpga_pcm_trigger(struct snd_soc_component *component,
			      struct snd_pcm_substream *substream, int cmd)
{}

static snd_pcm_uframes_t xtfpga_pcm_pointer(struct snd_soc_component *component,
					    struct snd_pcm_substream *substream)
{}

static int xtfpga_pcm_new(struct snd_soc_component *component,
			  struct snd_soc_pcm_runtime *rtd)
{}

static const struct snd_soc_component_driver xtfpga_i2s_component =;

static const struct snd_soc_dai_ops xtfpga_i2s_dai_ops =;

static struct snd_soc_dai_driver xtfpga_i2s_dai[] =;

static int xtfpga_i2s_runtime_suspend(struct device *dev)
{}

static int xtfpga_i2s_runtime_resume(struct device *dev)
{}

static int xtfpga_i2s_probe(struct platform_device *pdev)
{}

static void xtfpga_i2s_remove(struct platform_device *pdev)
{}

#ifdef CONFIG_OF
static const struct of_device_id xtfpga_i2s_of_match[] =;
MODULE_DEVICE_TABLE(of, xtfpga_i2s_of_match);
#endif

static const struct dev_pm_ops xtfpga_i2s_pm_ops =;

static struct platform_driver xtfpga_i2s_driver =;

module_platform_driver();

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