linux/sound/soc/fsl/fsl_sai.c

// SPDX-License-Identifier: GPL-2.0+
//
// Freescale ALSA SoC Digital Audio Interface (SAI) driver.
//
// Copyright 2012-2015 Freescale Semiconductor, Inc.

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/dmaengine.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pm_qos.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <sound/core.h>
#include <sound/dmaengine_pcm.h>
#include <sound/pcm_params.h>
#include <linux/mfd/syscon.h>
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>

#include "fsl_sai.h"
#include "fsl_utils.h"
#include "imx-pcm.h"

#define FSL_SAI_FLAGS

static const unsigned int fsl_sai_rates[] =;

static const struct snd_pcm_hw_constraint_list fsl_sai_rate_constraints =;

/**
 * fsl_sai_dir_is_synced - Check if stream is synced by the opposite stream
 *
 * SAI supports synchronous mode using bit/frame clocks of either Transmitter's
 * or Receiver's for both streams. This function is used to check if clocks of
 * the stream's are synced by the opposite stream.
 *
 * @sai: SAI context
 * @dir: stream direction
 */
static inline bool fsl_sai_dir_is_synced(struct fsl_sai *sai, int dir)
{}

static struct pinctrl_state *fsl_sai_get_pins_state(struct fsl_sai *sai, u32 bclk)
{}

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

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

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

static int fsl_sai_set_dai_sysclk_tr(struct snd_soc_dai *cpu_dai,
		int clk_id, unsigned int freq, bool tx)
{}

static int fsl_sai_set_mclk_rate(struct snd_soc_dai *dai, int clk_id, unsigned int freq)
{}

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

static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
				unsigned int fmt, bool tx)
{}

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

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

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

static int fsl_sai_set_bclk(struct snd_soc_dai *dai, bool tx, u32 freq)
{}

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

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

static void fsl_sai_config_disable(struct fsl_sai *sai, int dir)
{}

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

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

static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai)
{}

static const struct snd_soc_dai_ops fsl_sai_pcm_dai_ops =;

static const struct snd_soc_dai_ops fsl_sai_pcm_dai_tx_ops =;

static const struct snd_soc_dai_ops fsl_sai_pcm_dai_rx_ops =;

static int fsl_sai_dai_resume(struct snd_soc_component *component)
{}

static struct snd_soc_dai_driver fsl_sai_dai_template[] =;

static const struct snd_soc_component_driver fsl_component =;

static struct reg_default fsl_sai_reg_defaults_ofs0[] =;

static struct reg_default fsl_sai_reg_defaults_ofs8[] =;

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

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

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

static struct regmap_config fsl_sai_regmap_config =;

static int fsl_sai_check_version(struct device *dev)
{}

/*
 * Calculate the offset between first two datalines, don't
 * different offset in one case.
 */
static unsigned int fsl_sai_calc_dl_off(unsigned long dl_mask)
{}

/*
 * read the fsl,dataline property from dts file.
 * It has 3 value for each configuration, first one means the type:
 * I2S(1) or PDM(2), second one is dataline mask for 'rx', third one is
 * dataline mask for 'tx'. for example
 *
 * fsl,dataline = <1 0xff 0xff 2 0xff 0x11>,
 *
 * It means I2S type rx mask is 0xff, tx mask is 0xff, PDM type
 * rx mask is 0xff, tx mask is 0x11 (dataline 1 and 4 enabled).
 *
 */
static int fsl_sai_read_dlcfg(struct fsl_sai *sai)
{}

static int fsl_sai_runtime_suspend(struct device *dev);
static int fsl_sai_runtime_resume(struct device *dev);

static int fsl_sai_probe(struct platform_device *pdev)
{}

static void fsl_sai_remove(struct platform_device *pdev)
{}

static const struct fsl_sai_soc_data fsl_sai_vf610_data =;

static const struct fsl_sai_soc_data fsl_sai_imx6sx_data =;

static const struct fsl_sai_soc_data fsl_sai_imx7ulp_data =;

static const struct fsl_sai_soc_data fsl_sai_imx8mq_data =;

static const struct fsl_sai_soc_data fsl_sai_imx8qm_data =;

static const struct fsl_sai_soc_data fsl_sai_imx8mm_data =;

static const struct fsl_sai_soc_data fsl_sai_imx8mn_data =;

static const struct fsl_sai_soc_data fsl_sai_imx8mp_data =;

static const struct fsl_sai_soc_data fsl_sai_imx8ulp_data =;

static const struct fsl_sai_soc_data fsl_sai_imx93_data =;

static const struct fsl_sai_soc_data fsl_sai_imx95_data =;

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

static int fsl_sai_runtime_suspend(struct device *dev)
{}

static int fsl_sai_runtime_resume(struct device *dev)
{}

static const struct dev_pm_ops fsl_sai_pm_ops =;

static struct platform_driver fsl_sai_driver =;
module_platform_driver();

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