linux/sound/soc/bcm/bcm2835-i2s.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * ALSA SoC I2S Audio Layer for Broadcom BCM2835 SoC
 *
 * Author:	Florian Meier <[email protected]>
 *		Copyright 2013
 *
 * Based on
 *	Raspberry Pi PCM I2S ALSA Driver
 *	Copyright (c) by Phil Poole 2013
 *
 *	ALSA SoC I2S (McBSP) Audio Layer for TI DAVINCI processor
 *      Vladimir Barinov, <[email protected]>
 *	Copyright (C) 2007 MontaVista Software, Inc., <[email protected]>
 *
 *	OMAP ALSA SoC DAI driver using McBSP port
 *	Copyright (C) 2008 Nokia Corporation
 *	Contact: Jarkko Nikula <[email protected]>
 *		 Peter Ujfalusi <[email protected]>
 *
 *	Freescale SSI ALSA SoC Digital Audio Interface (DAI) driver
 *	Author: Timur Tabi <[email protected]>
 *	Copyright 2007-2010 Freescale Semiconductor, Inc.
 */

#include <linux/bitops.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/slab.h>

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

/* I2S registers */
#define BCM2835_I2S_CS_A_REG
#define BCM2835_I2S_FIFO_A_REG
#define BCM2835_I2S_MODE_A_REG
#define BCM2835_I2S_RXC_A_REG
#define BCM2835_I2S_TXC_A_REG
#define BCM2835_I2S_DREQ_A_REG
#define BCM2835_I2S_INTEN_A_REG
#define BCM2835_I2S_INTSTC_A_REG
#define BCM2835_I2S_GRAY_REG

/* I2S register settings */
#define BCM2835_I2S_STBY
#define BCM2835_I2S_SYNC
#define BCM2835_I2S_RXSEX
#define BCM2835_I2S_RXF
#define BCM2835_I2S_TXE
#define BCM2835_I2S_RXD
#define BCM2835_I2S_TXD
#define BCM2835_I2S_RXR
#define BCM2835_I2S_TXW
#define BCM2835_I2S_CS_RXERR
#define BCM2835_I2S_CS_TXERR
#define BCM2835_I2S_RXSYNC
#define BCM2835_I2S_TXSYNC
#define BCM2835_I2S_DMAEN
#define BCM2835_I2S_RXTHR(v)
#define BCM2835_I2S_TXTHR(v)
#define BCM2835_I2S_RXCLR
#define BCM2835_I2S_TXCLR
#define BCM2835_I2S_TXON
#define BCM2835_I2S_RXON
#define BCM2835_I2S_EN

#define BCM2835_I2S_CLKDIS
#define BCM2835_I2S_PDMN
#define BCM2835_I2S_PDME
#define BCM2835_I2S_FRXP
#define BCM2835_I2S_FTXP
#define BCM2835_I2S_CLKM
#define BCM2835_I2S_CLKI
#define BCM2835_I2S_FSM
#define BCM2835_I2S_FSI
#define BCM2835_I2S_FLEN(v)
#define BCM2835_I2S_FSLEN(v)

#define BCM2835_I2S_CHWEX
#define BCM2835_I2S_CHEN
#define BCM2835_I2S_CHPOS(v)
#define BCM2835_I2S_CHWID(v)
#define BCM2835_I2S_CH1(v)
#define BCM2835_I2S_CH2(v)
#define BCM2835_I2S_CH1_POS(v)
#define BCM2835_I2S_CH2_POS(v)

#define BCM2835_I2S_TX_PANIC(v)
#define BCM2835_I2S_RX_PANIC(v)
#define BCM2835_I2S_TX(v)
#define BCM2835_I2S_RX(v)

#define BCM2835_I2S_INT_RXERR
#define BCM2835_I2S_INT_TXERR
#define BCM2835_I2S_INT_RXR
#define BCM2835_I2S_INT_TXW

/* Frame length register is 10 bit, maximum length 1024 */
#define BCM2835_I2S_MAX_FRAME_LENGTH

/* General device struct */
struct bcm2835_i2s_dev {};

static void bcm2835_i2s_start_clock(struct bcm2835_i2s_dev *dev)
{}

static void bcm2835_i2s_stop_clock(struct bcm2835_i2s_dev *dev)
{}

static void bcm2835_i2s_clear_fifos(struct bcm2835_i2s_dev *dev,
				    bool tx, bool rx)
{}

static int bcm2835_i2s_set_dai_fmt(struct snd_soc_dai *dai,
				      unsigned int fmt)
{}

static int bcm2835_i2s_set_dai_bclk_ratio(struct snd_soc_dai *dai,
				      unsigned int ratio)
{}

static int bcm2835_i2s_set_dai_tdm_slot(struct snd_soc_dai *dai,
	unsigned int tx_mask, unsigned int rx_mask,
	int slots, int width)
{}

/*
 * Convert logical slot number into physical slot number.
 *
 * If odd_offset is 0 sequential number is identical to logical number.
 * This is used for DSP modes with slot numbering 0 1 2 3 ...
 *
 * Otherwise odd_offset defines the physical offset for odd numbered
 * slots. This is used for I2S and left/right justified modes to
 * translate from logical slot numbers 0 1 2 3 ... into physical slot
 * numbers 0 2 ... 3 4 ...
 */
static int bcm2835_i2s_convert_slot(unsigned int slot, unsigned int odd_offset)
{}

/*
 * Calculate channel position from mask and slot width.
 *
 * Mask must contain exactly 2 set bits.
 * Lowest set bit is channel 1 position, highest set bit channel 2.
 * The constant offset is added to both channel positions.
 *
 * If odd_offset is > 0 slot positions are translated to
 * I2S-style TDM slot numbering ( 0 2 ... 3 4 ...) with odd
 * logical slot numbers starting at physical slot odd_offset.
 */
static void bcm2835_i2s_calc_channel_pos(
	unsigned int *ch1_pos, unsigned int *ch2_pos,
	unsigned int mask, unsigned int width,
	unsigned int bit_offset, unsigned int odd_offset)
{}

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

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

static void bcm2835_i2s_stop(struct bcm2835_i2s_dev *dev,
		struct snd_pcm_substream *substream,
		struct snd_soc_dai *dai)
{}

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

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

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

static int bcm2835_i2s_dai_probe(struct snd_soc_dai *dai)
{}

static const struct snd_soc_dai_ops bcm2835_i2s_dai_ops =;

static struct snd_soc_dai_driver bcm2835_i2s_dai =;

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

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

static const struct regmap_config bcm2835_regmap_config =;

static const struct snd_soc_component_driver bcm2835_i2s_component =;

static int bcm2835_i2s_probe(struct platform_device *pdev)
{}

static const struct of_device_id bcm2835_i2s_of_match[] =;

MODULE_DEVICE_TABLE(of, bcm2835_i2s_of_match);

static struct platform_driver bcm2835_i2s_driver =;

module_platform_driver();

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