linux/sound/soc/fsl/imx-card.c

// SPDX-License-Identifier: GPL-2.0+
// Copyright 2017-2021 NXP

#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/gpio/consumer.h>
#include <linux/of.h>
#include <linux/i2c.h>
#include <linux/clk.h>
#include <sound/soc.h>
#include <sound/pcm_params.h>
#include <sound/pcm.h>
#include <sound/soc-dapm.h>
#include <sound/simple_card_utils.h>

#include "fsl_sai.h"

#define IMX_CARD_MCLK_22P5792MHZ
#define IMX_CARD_MCLK_24P576MHZ

enum codec_type {};

/*
 * Mapping LRCK fs and frame width, table 3 & 4 in datasheet
 * @rmin: min rate
 * @rmax: max rate
 * @wmin: min frame ratio
 * @wmax: max frame ratio
 */
struct imx_akcodec_fs_mul {};

/*
 * Mapping TDM mode and frame width
 */
struct imx_akcodec_tdm_fs_mul {};

/*
 * struct imx_card_plat_data - specific info for codecs
 *
 * @fs_mul: ratio of mclk/fs for normal mode
 * @tdm_fs_mul: ratio of mclk/fs for tdm mode
 * @support_rates: supported sample rate
 * @support_tdm_rates: supported sample rate for tdm mode
 * @support_channels: supported channels
 * @support_tdm_channels: supported channels for tdm mode
 * @num_fs_mul: ARRAY_SIZE of fs_mul
 * @num_tdm_fs_mul: ARRAY_SIZE of tdm_fs_mul
 * @num_rates: ARRAY_SIZE of support_rates
 * @num_tdm_rates: ARRAY_SIZE of support_tdm_rates
 * @num_channels: ARRAY_SIZE of support_channels
 * @num_tdm_channels: ARRAY_SIZE of support_tdm_channels
 * @type: codec type
 */
struct imx_card_plat_data {};

/*
 * struct dai_link_data - specific info for dai link
 *
 * @slots: slot number
 * @slot_width: slot width value
 * @cpu_sysclk_id: sysclk id for cpu dai
 * @one2one_ratio: true if mclk equal to bclk
 */
struct dai_link_data {};

/*
 * struct imx_card_data - platform device data
 *
 * @plat_data: pointer of imx_card_plat_data
 * @dapm_routes: pointer of dapm_routes
 * @link_data: private data for dai link
 * @card: card instance
 * @num_dapm_routes: number of dapm_routes
 * @asrc_rate: asrc rates
 * @asrc_format: asrc format
 */
struct imx_card_data {};

static struct imx_akcodec_fs_mul ak4458_fs_mul[] =;

static struct imx_akcodec_tdm_fs_mul ak4458_tdm_fs_mul[] =;

static struct imx_akcodec_fs_mul ak4497_fs_mul[] =;

/*
 * Auto MCLK selection based on LRCK for Normal Mode
 * (Table 4 from datasheet)
 */
static struct imx_akcodec_fs_mul ak5558_fs_mul[] =;

/*
 * MCLK and BCLK selection based on TDM mode
 * because of SAI we also add the restriction: MCLK >= 2 * BCLK
 * (Table 9 from datasheet)
 */
static struct imx_akcodec_tdm_fs_mul ak5558_tdm_fs_mul[] =;

static const u32 akcodec_rates[] =;

static const u32 akcodec_tdm_rates[] =;

static const u32 ak4458_channels[] =;

static const u32 ak4458_tdm_channels[] =;

static const u32 ak5558_channels[] =;

static const u32 ak5558_tdm_channels[] =;

static bool format_is_dsd(struct snd_pcm_hw_params *params)
{}

static bool format_is_tdm(struct dai_link_data *link_data)
{}

static bool codec_is_akcodec(unsigned int type)
{}

static unsigned long akcodec_get_mclk_rate(struct snd_pcm_substream *substream,
					   struct snd_pcm_hw_params *params,
					   int slots, int slot_width)
{}

static int imx_aif_hw_params(struct snd_pcm_substream *substream,
			     struct snd_pcm_hw_params *params)
{}

static int ak5558_hw_rule_rate(struct snd_pcm_hw_params *p, struct snd_pcm_hw_rule *r)
{}

static int imx_aif_startup(struct snd_pcm_substream *substream)
{}

static const struct snd_soc_ops imx_aif_ops =;

static const struct snd_soc_ops imx_aif_ops_be =;

static int be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
			      struct snd_pcm_hw_params *params)
{}

static int imx_card_parse_of(struct imx_card_data *data)
{}

static int imx_card_probe(struct platform_device *pdev)
{}

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

static struct platform_driver imx_card_driver =;
module_platform_driver();

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