linux/sound/soc/samsung/pcm.c

// SPDX-License-Identifier: GPL-2.0
//
// ALSA SoC Audio Layer - S3C PCM-Controller driver
//
// Copyright (c) 2009 Samsung Electronics Co. Ltd
// Author: Jaswinder Singh <[email protected]>
// based upon I2S drivers by Ben Dooks.

#include <linux/clk.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>

#include <sound/soc.h>
#include <sound/pcm_params.h>

#include <linux/platform_data/asoc-s3c.h>

#include "dma.h"
#include "pcm.h"

/*Register Offsets */
#define S3C_PCM_CTL
#define S3C_PCM_CLKCTL
#define S3C_PCM_TXFIFO
#define S3C_PCM_RXFIFO
#define S3C_PCM_IRQCTL
#define S3C_PCM_IRQSTAT
#define S3C_PCM_FIFOSTAT
#define S3C_PCM_CLRINT

/* PCM_CTL Bit-Fields */
#define S3C_PCM_CTL_TXDIPSTICK_MASK
#define S3C_PCM_CTL_TXDIPSTICK_SHIFT
#define S3C_PCM_CTL_RXDIPSTICK_MASK
#define S3C_PCM_CTL_RXDIPSTICK_SHIFT
#define S3C_PCM_CTL_TXDMA_EN
#define S3C_PCM_CTL_RXDMA_EN
#define S3C_PCM_CTL_TXMSB_AFTER_FSYNC
#define S3C_PCM_CTL_RXMSB_AFTER_FSYNC
#define S3C_PCM_CTL_TXFIFO_EN
#define S3C_PCM_CTL_RXFIFO_EN
#define S3C_PCM_CTL_ENABLE

/* PCM_CLKCTL Bit-Fields */
#define S3C_PCM_CLKCTL_SERCLK_EN
#define S3C_PCM_CLKCTL_SERCLKSEL_PCLK
#define S3C_PCM_CLKCTL_SCLKDIV_MASK
#define S3C_PCM_CLKCTL_SYNCDIV_MASK
#define S3C_PCM_CLKCTL_SCLKDIV_SHIFT
#define S3C_PCM_CLKCTL_SYNCDIV_SHIFT

/* PCM_TXFIFO Bit-Fields */
#define S3C_PCM_TXFIFO_DVALID
#define S3C_PCM_TXFIFO_DATA_MSK

/* PCM_RXFIFO Bit-Fields */
#define S3C_PCM_RXFIFO_DVALID
#define S3C_PCM_RXFIFO_DATA_MSK

/* PCM_IRQCTL Bit-Fields */
#define S3C_PCM_IRQCTL_IRQEN
#define S3C_PCM_IRQCTL_WRDEN
#define S3C_PCM_IRQCTL_TXEMPTYEN
#define S3C_PCM_IRQCTL_TXALMSTEMPTYEN
#define S3C_PCM_IRQCTL_TXFULLEN
#define S3C_PCM_IRQCTL_TXALMSTFULLEN
#define S3C_PCM_IRQCTL_TXSTARVEN
#define S3C_PCM_IRQCTL_TXERROVRFLEN
#define S3C_PCM_IRQCTL_RXEMPTEN
#define S3C_PCM_IRQCTL_RXALMSTEMPTEN
#define S3C_PCM_IRQCTL_RXFULLEN
#define S3C_PCM_IRQCTL_RXALMSTFULLEN
#define S3C_PCM_IRQCTL_RXSTARVEN
#define S3C_PCM_IRQCTL_RXERROVRFLEN

/* PCM_IRQSTAT Bit-Fields */
#define S3C_PCM_IRQSTAT_IRQPND
#define S3C_PCM_IRQSTAT_WRD_XFER
#define S3C_PCM_IRQSTAT_TXEMPTY
#define S3C_PCM_IRQSTAT_TXALMSTEMPTY
#define S3C_PCM_IRQSTAT_TXFULL
#define S3C_PCM_IRQSTAT_TXALMSTFULL
#define S3C_PCM_IRQSTAT_TXSTARV
#define S3C_PCM_IRQSTAT_TXERROVRFL
#define S3C_PCM_IRQSTAT_RXEMPT
#define S3C_PCM_IRQSTAT_RXALMSTEMPT
#define S3C_PCM_IRQSTAT_RXFULL
#define S3C_PCM_IRQSTAT_RXALMSTFULL
#define S3C_PCM_IRQSTAT_RXSTARV
#define S3C_PCM_IRQSTAT_RXERROVRFL

/* PCM_FIFOSTAT Bit-Fields */
#define S3C_PCM_FIFOSTAT_TXCNT_MSK
#define S3C_PCM_FIFOSTAT_TXFIFOEMPTY
#define S3C_PCM_FIFOSTAT_TXFIFOALMSTEMPTY
#define S3C_PCM_FIFOSTAT_TXFIFOFULL
#define S3C_PCM_FIFOSTAT_TXFIFOALMSTFULL
#define S3C_PCM_FIFOSTAT_RXCNT_MSK
#define S3C_PCM_FIFOSTAT_RXFIFOEMPTY
#define S3C_PCM_FIFOSTAT_RXFIFOALMSTEMPTY
#define S3C_PCM_FIFOSTAT_RXFIFOFULL
#define S3C_PCM_FIFOSTAT_RXFIFOALMSTFULL

/**
 * struct s3c_pcm_info - S3C PCM Controller information
 * @lock: Spin lock
 * @dev: The parent device passed to use from the probe.
 * @regs: The pointer to the device register block.
 * @sclk_per_fs: number of sclk per frame sync
 * @idleclk: Whether to keep PCMSCLK enabled even when idle (no active xfer)
 * @pclk: the PCLK_PCM (pcm) clock pointer
 * @cclk: the SCLK_AUDIO (audio-bus) clock pointer
 * @dma_playback: DMA information for playback channel.
 * @dma_capture: DMA information for capture channel.
 */
struct s3c_pcm_info {};

static struct snd_dmaengine_dai_dma_data s3c_pcm_stereo_out[] =;

static struct snd_dmaengine_dai_dma_data s3c_pcm_stereo_in[] =;

static struct s3c_pcm_info s3c_pcm[2];

static void s3c_pcm_snd_txctrl(struct s3c_pcm_info *pcm, int on)
{}

static void s3c_pcm_snd_rxctrl(struct s3c_pcm_info *pcm, int on)
{}

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

static int s3c_pcm_hw_params(struct snd_pcm_substream *substream,
				 struct snd_pcm_hw_params *params,
				 struct snd_soc_dai *socdai)
{}

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

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

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

static int s3c_pcm_dai_probe(struct snd_soc_dai *dai)
{}

static const struct snd_soc_dai_ops s3c_pcm_dai_ops =;

#define S3C_PCM_RATES

#define S3C_PCM_DAI_DECLARE

static struct snd_soc_dai_driver s3c_pcm_dai[] =;

static const struct snd_soc_component_driver s3c_pcm_component =;

static int s3c_pcm_dev_probe(struct platform_device *pdev)
{}

static void s3c_pcm_dev_remove(struct platform_device *pdev)
{}

static struct platform_driver s3c_pcm_driver =;

module_platform_driver();

/* Module information */
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS();