linux/sound/soc/stm/stm32_sai_sub.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * STM32 ALSA SoC Digital Audio Interface (SAI) driver.
 *
 * Copyright (C) 2016, STMicroelectronics - All Rights Reserved
 * Author(s): Olivier Moysan <[email protected]> for STMicroelectronics.
 */

#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>

#include <sound/asoundef.h>
#include <sound/core.h>
#include <sound/dmaengine_pcm.h>
#include <sound/pcm_params.h>

#include "stm32_sai.h"

#define SAI_FREE_PROTOCOL
#define SAI_SPDIF_PROTOCOL

#define SAI_SLOT_SIZE_AUTO
#define SAI_SLOT_SIZE_16
#define SAI_SLOT_SIZE_32

#define SAI_DATASIZE_8
#define SAI_DATASIZE_10
#define SAI_DATASIZE_16
#define SAI_DATASIZE_20
#define SAI_DATASIZE_24
#define SAI_DATASIZE_32

#define STM_SAI_DAI_NAME_SIZE

#define STM_SAI_IS_PLAYBACK(ip)
#define STM_SAI_IS_CAPTURE(ip)

#define STM_SAI_A_ID
#define STM_SAI_B_ID

#define STM_SAI_IS_SUB_A(x)

#define SAI_SYNC_NONE
#define SAI_SYNC_INTERNAL
#define SAI_SYNC_EXTERNAL

#define STM_SAI_PROTOCOL_IS_SPDIF(ip)
#define STM_SAI_HAS_SPDIF(x)
#define STM_SAI_HAS_PDM(x)
#define STM_SAI_HAS_EXT_SYNC(x)

#define SAI_IEC60958_BLOCK_FRAMES
#define SAI_IEC60958_STATUS_BYTES

#define SAI_MCLK_NAME_LEN
#define SAI_RATE_11K

/**
 * struct stm32_sai_sub_data - private data of SAI sub block (block A or B)
 * @pdev: device data pointer
 * @regmap: SAI register map pointer
 * @regmap_config: SAI sub block register map configuration pointer
 * @dma_params: dma configuration data for rx or tx channel
 * @cpu_dai_drv: DAI driver data pointer
 * @cpu_dai: DAI runtime data pointer
 * @substream: PCM substream data pointer
 * @pdata: SAI block parent data pointer
 * @np_sync_provider: synchronization provider node
 * @sai_ck: kernel clock feeding the SAI clock generator
 * @sai_mclk: master clock from SAI mclk provider
 * @phys_addr: SAI registers physical base address
 * @mclk_rate: SAI block master clock frequency (Hz). set at init
 * @id: SAI sub block id corresponding to sub-block A or B
 * @dir: SAI block direction (playback or capture). set at init
 * @master: SAI block mode flag. (true=master, false=slave) set at init
 * @spdif: SAI S/PDIF iec60958 mode flag. set at init
 * @fmt: SAI block format. relevant only for custom protocols. set at init
 * @sync: SAI block synchronization mode. (none, internal or external)
 * @synco: SAI block ext sync source (provider setting). (none, sub-block A/B)
 * @synci: SAI block ext sync source (client setting). (SAI sync provider index)
 * @fs_length: frame synchronization length. depends on protocol settings
 * @slots: rx or tx slot number
 * @slot_width: rx or tx slot width in bits
 * @slot_mask: rx or tx active slots mask. set at init or at runtime
 * @data_size: PCM data width. corresponds to PCM substream width.
 * @spdif_frm_cnt: S/PDIF playback frame counter
 * @iec958: iec958 data
 * @ctrl_lock: control lock
 * @irq_lock: prevent race condition with IRQ
 */
struct stm32_sai_sub_data {};

enum stm32_sai_fifo_th {};

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

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

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

static int stm32_sai_sub_reg_up(struct stm32_sai_sub_data *sai,
				unsigned int reg, unsigned int mask,
				unsigned int val)
{}

static int stm32_sai_sub_reg_wr(struct stm32_sai_sub_data *sai,
				unsigned int reg, unsigned int mask,
				unsigned int val)
{}

static int stm32_sai_sub_reg_rd(struct stm32_sai_sub_data *sai,
				unsigned int reg, unsigned int *val)
{}

static const struct regmap_config stm32_sai_sub_regmap_config_f4 =;

static const struct regmap_config stm32_sai_sub_regmap_config_h7 =;

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

static int snd_pcm_iec958_get(struct snd_kcontrol *kcontrol,
			      struct snd_ctl_elem_value *uctl)
{}

static int snd_pcm_iec958_put(struct snd_kcontrol *kcontrol,
			      struct snd_ctl_elem_value *uctl)
{}

static const struct snd_kcontrol_new iec958_ctls =;

struct stm32_sai_mclk_data {};

#define to_mclk_data(_hw)
#define STM32_SAI_MAX_CLKS

static int stm32_sai_get_clk_div(struct stm32_sai_sub_data *sai,
				 unsigned long input_rate,
				 unsigned long output_rate)
{}

static int stm32_sai_set_clk_div(struct stm32_sai_sub_data *sai,
				 unsigned int div)
{}

static int stm32_sai_set_parent_clock(struct stm32_sai_sub_data *sai,
				      unsigned int rate)
{}

static long stm32_sai_mclk_round_rate(struct clk_hw *hw, unsigned long rate,
				      unsigned long *prate)
{}

static unsigned long stm32_sai_mclk_recalc_rate(struct clk_hw *hw,
						unsigned long parent_rate)
{}

static int stm32_sai_mclk_set_rate(struct clk_hw *hw, unsigned long rate,
				   unsigned long parent_rate)
{}

static int stm32_sai_mclk_enable(struct clk_hw *hw)
{}

static void stm32_sai_mclk_disable(struct clk_hw *hw)
{}

static const struct clk_ops mclk_ops =;

static int stm32_sai_add_mclk_provider(struct stm32_sai_sub_data *sai)
{}

static irqreturn_t stm32_sai_isr(int irq, void *devid)
{}

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

static int stm32_sai_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask,
				      u32 rx_mask, int slots, int slot_width)
{}

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

static int stm32_sai_startup(struct snd_pcm_substream *substream,
			     struct snd_soc_dai *cpu_dai)
{}

static int stm32_sai_set_config(struct snd_soc_dai *cpu_dai,
				struct snd_pcm_substream *substream,
				struct snd_pcm_hw_params *params)
{}

static int stm32_sai_set_slots(struct snd_soc_dai *cpu_dai)
{}

static void stm32_sai_set_frame(struct snd_soc_dai *cpu_dai)
{}

static void stm32_sai_init_iec958_status(struct stm32_sai_sub_data *sai)
{}

static void stm32_sai_set_iec958_status(struct stm32_sai_sub_data *sai,
					struct snd_pcm_runtime *runtime)
{}

static int stm32_sai_configure_clock(struct snd_soc_dai *cpu_dai,
				     struct snd_pcm_hw_params *params)
{}

static int stm32_sai_hw_params(struct snd_pcm_substream *substream,
			       struct snd_pcm_hw_params *params,
			       struct snd_soc_dai *cpu_dai)
{}

static int stm32_sai_trigger(struct snd_pcm_substream *substream, int cmd,
			     struct snd_soc_dai *cpu_dai)
{}

static void stm32_sai_shutdown(struct snd_pcm_substream *substream,
			       struct snd_soc_dai *cpu_dai)
{}

static int stm32_sai_pcm_new(struct snd_soc_pcm_runtime *rtd,
			     struct snd_soc_dai *cpu_dai)
{}

static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai)
{}

static const struct snd_soc_dai_ops stm32_sai_pcm_dai_ops =;

static const struct snd_soc_dai_ops stm32_sai_pcm_dai_ops2 =;

static int stm32_sai_pcm_process_spdif(struct snd_pcm_substream *substream,
				       int channel, unsigned long hwoff,
				       unsigned long bytes)
{}

/* No support of mmap in S/PDIF mode */
static const struct snd_pcm_hardware stm32_sai_pcm_hw_spdif =;

static const struct snd_pcm_hardware stm32_sai_pcm_hw =;

static struct snd_soc_dai_driver stm32_sai_playback_dai =;

static struct snd_soc_dai_driver stm32_sai_capture_dai =;

static const struct snd_dmaengine_pcm_config stm32_sai_pcm_config =;

static const struct snd_dmaengine_pcm_config stm32_sai_pcm_config_spdif =;

static const struct snd_soc_component_driver stm32_component =;

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

static int stm32_sai_sub_parse_of(struct platform_device *pdev,
				  struct stm32_sai_sub_data *sai)
{}

static int stm32_sai_sub_probe(struct platform_device *pdev)
{}

static void stm32_sai_sub_remove(struct platform_device *pdev)
{}

#ifdef CONFIG_PM_SLEEP
static int stm32_sai_sub_suspend(struct device *dev)
{}

static int stm32_sai_sub_resume(struct device *dev)
{}
#endif /* CONFIG_PM_SLEEP */

static const struct dev_pm_ops stm32_sai_sub_pm_ops =;

static struct platform_driver stm32_sai_sub_driver =;

module_platform_driver();

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