linux/sound/soc/atmel/mchp-spdifrx.c

// SPDX-License-Identifier: GPL-2.0
//
// Driver for Microchip S/PDIF RX Controller
//
// Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries
//
// Author: Codrin Ciubotariu <[email protected]>

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

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

/*
 * ---- S/PDIF Receiver Controller Register map ----
 */
#define SPDIFRX_CR
#define SPDIFRX_MR

#define SPDIFRX_IER
#define SPDIFRX_IDR
#define SPDIFRX_IMR
#define SPDIFRX_ISR
#define SPDIFRX_RSR
#define SPDIFRX_RHR

#define SPDIFRX_CHSR(channel, reg)

#define SPDIFRX_CHUD(channel, reg)

#define SPDIFRX_WPMR
#define SPDIFRX_WPSR

#define SPDIFRX_VERSION

/*
 * ---- Control Register (Write-only) ----
 */
#define SPDIFRX_CR_SWRST

/*
 * ---- Mode Register (Read/Write) ----
 */
/* Receive Enable */
#define SPDIFRX_MR_RXEN_MASK
#define SPDIFRX_MR_RXEN_DISABLE
#define SPDIFRX_MR_RXEN_ENABLE

/* Validity Bit Mode */
#define SPDIFRX_MR_VBMODE_MASK
#define SPDIFRX_MR_VBMODE_ALWAYS_LOAD
#define SPDIFRX_MR_VBMODE_DISCARD_IF_VB1

/* Data Word Endian Mode */
#define SPDIFRX_MR_ENDIAN_MASK
#define SPDIFRX_MR_ENDIAN_LITTLE
#define SPDIFRX_MR_ENDIAN_BIG

/* Parity Bit Mode */
#define SPDIFRX_MR_PBMODE_MASK
#define SPDIFRX_MR_PBMODE_PARCHECK
#define SPDIFRX_MR_PBMODE_NOPARCHECK

/* Sample Data Width */
#define SPDIFRX_MR_DATAWIDTH_MASK
#define SPDIFRX_MR_DATAWIDTH(width)

/* Packed Data Mode in Receive Holding Register */
#define SPDIFRX_MR_PACK_MASK
#define SPDIFRX_MR_PACK_DISABLED
#define SPDIFRX_MR_PACK_ENABLED

/* Start of Block Bit Mode */
#define SPDIFRX_MR_SBMODE_MASK
#define SPDIFRX_MR_SBMODE_ALWAYS_LOAD
#define SPDIFRX_MR_SBMODE_DISCARD

/* Consecutive Preamble Error Threshold Automatic Restart */
#define SPDIFRX_MR_AUTORST_MASK
#define SPDIFRX_MR_AUTORST_NOACTION
#define SPDIFRX_MR_AUTORST_UNLOCK_ON_PRE_ERR

/*
 * ---- Interrupt Enable/Disable/Mask/Status Register (Write/Read-only) ----
 */
#define SPDIFRX_IR_RXRDY
#define SPDIFRX_IR_LOCKED
#define SPDIFRX_IR_LOSS
#define SPDIFRX_IR_BLOCKEND
#define SPDIFRX_IR_SFE
#define SPDIFRX_IR_PAR_ERR
#define SPDIFRX_IR_OVERRUN
#define SPDIFRX_IR_RXFULL
#define SPDIFRX_IR_CSC(ch)
#define SPDIFRX_IR_SECE
#define SPDIFRX_IR_BLOCKST
#define SPDIFRX_IR_NRZ_ERR
#define SPDIFRX_IR_PRE_ERR
#define SPDIFRX_IR_CP_ERR

/*
 * ---- Receiver Status Register (Read/Write) ----
 */
/* Enable Status */
#define SPDIFRX_RSR_ULOCK
#define SPDIFRX_RSR_BADF
#define SPDIFRX_RSR_LOWF
#define SPDIFRX_RSR_NOSIGNAL
#define SPDIFRX_RSR_IFS_MASK
#define SPDIFRX_RSR_IFS(reg)

/*
 *  ---- Version Register (Read-only) ----
 */
#define SPDIFRX_VERSION_MASK
#define SPDIFRX_VERSION_MFN_MASK
#define SPDIFRX_VERSION_MFN(reg)

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

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

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

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

static const struct regmap_config mchp_spdifrx_regmap_config =;

#define SPDIFRX_GCLK_RATIO_MIN

#define SPDIFRX_CS_BITS
#define SPDIFRX_UD_BITS

#define SPDIFRX_CHANNELS

/**
 * struct mchp_spdifrx_ch_stat: MCHP SPDIFRX channel status
 * @data: channel status bits
 * @done: completion to signal channel status bits acquisition done
 */
struct mchp_spdifrx_ch_stat {};

/**
 * struct mchp_spdifrx_user_data: MCHP SPDIFRX user data
 * @data: user data bits
 * @done: completion to signal user data bits acquisition done
 */
struct mchp_spdifrx_user_data {};

/**
 * struct mchp_spdifrx_mixer_control: MCHP SPDIFRX mixer control data structure
 * @ch_stat: array of channel statuses
 * @user_data: array of user data
 * @ulock: ulock bit status
 * @badf: badf bit status
 * @signal: signal bit status
 */
struct mchp_spdifrx_mixer_control {};

/**
 * struct mchp_spdifrx_dev: MCHP SPDIFRX device data structure
 * @capture: DAI DMA configuration data
 * @control: mixer controls
 * @mlock: mutex to protect concurency b/w configuration and control APIs
 * @dev: struct device
 * @regmap: regmap for this device
 * @pclk: peripheral clock
 * @gclk: generic clock
 * @trigger_enabled: true if enabled though trigger() ops
 */
struct mchp_spdifrx_dev {};

static void mchp_spdifrx_channel_status_read(struct mchp_spdifrx_dev *dev,
					     int channel)
{}

static void mchp_spdifrx_channel_user_data_read(struct mchp_spdifrx_dev *dev,
						int channel)
{}

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

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

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

#define MCHP_SPDIF_RATES

#define MCHP_SPDIF_FORMATS

static int mchp_spdifrx_info(struct snd_kcontrol *kcontrol,
			     struct snd_ctl_elem_info *uinfo)
{}

static int mchp_spdifrx_cs_get(struct mchp_spdifrx_dev *dev,
			       int channel,
			       struct snd_ctl_elem_value *uvalue)
{}

static int mchp_spdifrx_cs1_get(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *uvalue)
{}

static int mchp_spdifrx_cs2_get(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *uvalue)
{}

static int mchp_spdifrx_cs_mask(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *uvalue)
{}

static int mchp_spdifrx_subcode_ch_get(struct mchp_spdifrx_dev *dev,
				       int channel,
				       struct snd_ctl_elem_value *uvalue)
{}

static int mchp_spdifrx_subcode_ch1_get(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *uvalue)
{}

static int mchp_spdifrx_subcode_ch2_get(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *uvalue)
{}

static int mchp_spdifrx_boolean_info(struct snd_kcontrol *kcontrol,
				     struct snd_ctl_elem_info *uinfo)
{}

static int mchp_spdifrx_ulock_get(struct snd_kcontrol *kcontrol,
				  struct snd_ctl_elem_value *uvalue)
{}

static int mchp_spdifrx_badf_get(struct snd_kcontrol *kcontrol,
				 struct snd_ctl_elem_value *uvalue)
{}

static int mchp_spdifrx_signal_get(struct snd_kcontrol *kcontrol,
				   struct snd_ctl_elem_value *uvalue)
{}

static int mchp_spdifrx_rate_info(struct snd_kcontrol *kcontrol,
				  struct snd_ctl_elem_info *uinfo)
{}

static int mchp_spdifrx_rate_get(struct snd_kcontrol *kcontrol,
				 struct snd_ctl_elem_value *ucontrol)
{}

static struct snd_kcontrol_new mchp_spdifrx_ctrls[] =;

static int mchp_spdifrx_dai_probe(struct snd_soc_dai *dai)
{}

static int mchp_spdifrx_dai_remove(struct snd_soc_dai *dai)
{}

static const struct snd_soc_dai_ops mchp_spdifrx_dai_ops =;

static struct snd_soc_dai_driver mchp_spdifrx_dai =;

static const struct snd_soc_component_driver mchp_spdifrx_component =;

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

static int mchp_spdifrx_runtime_suspend(struct device *dev)
{}

static int mchp_spdifrx_runtime_resume(struct device *dev)
{}

static const struct dev_pm_ops mchp_spdifrx_pm_ops =;

static int mchp_spdifrx_probe(struct platform_device *pdev)
{}

static void mchp_spdifrx_remove(struct platform_device *pdev)
{}

static struct platform_driver mchp_spdifrx_driver =;

module_platform_driver();

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