linux/sound/soc/meson/axg-spdifin.c

// SPDX-License-Identifier: (GPL-2.0 OR MIT)
//
// Copyright (c) 2018 BayLibre, SAS.
// Author: Jerome Brunet <[email protected]>

#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/regmap.h>
#include <sound/soc.h>
#include <sound/soc-dai.h>
#include <sound/pcm_params.h>

#define SPDIFIN_CTRL0
#define SPDIFIN_CTRL0_EN
#define SPDIFIN_CTRL0_RST_OUT
#define SPDIFIN_CTRL0_RST_IN
#define SPDIFIN_CTRL0_WIDTH_SEL
#define SPDIFIN_CTRL0_STATUS_CH_SHIFT
#define SPDIFIN_CTRL0_STATUS_SEL
#define SPDIFIN_CTRL0_SRC_SEL
#define SPDIFIN_CTRL0_CHK_VALID
#define SPDIFIN_CTRL1
#define SPDIFIN_CTRL1_BASE_TIMER
#define SPDIFIN_CTRL1_IRQ_MASK
#define SPDIFIN_CTRL2
#define SPDIFIN_THRES_PER_REG
#define SPDIFIN_THRES_WIDTH
#define SPDIFIN_CTRL3
#define SPDIFIN_CTRL4
#define SPDIFIN_TIMER_PER_REG
#define SPDIFIN_TIMER_WIDTH
#define SPDIFIN_CTRL5
#define SPDIFIN_CTRL6
#define SPDIFIN_STAT0
#define SPDIFIN_STAT0_MODE
#define SPDIFIN_STAT0_MAXW
#define SPDIFIN_STAT0_IRQ
#define SPDIFIN_IRQ_MODE_CHANGED
#define SPDIFIN_STAT1
#define SPDIFIN_STAT2
#define SPDIFIN_MUTE_VAL

#define SPDIFIN_MODE_NUM

struct axg_spdifin_cfg {};

struct axg_spdifin {};

/*
 * TODO:
 * It would have been nice to check the actual rate against the sample rate
 * requested in hw_params(). Unfortunately, I was not able to make the mode
 * detection and IRQ work reliably:
 *
 * 1. IRQs are generated on mode change only, so there is no notification
 *    on transition between no signal and mode 0 (32kHz).
 * 2. Mode detection very often has glitches, and may detects the
 *    lowest or the highest mode before zeroing in on the actual mode.
 *
 * This makes calling snd_pcm_stop() difficult to get right. Even notifying
 * the kcontrol would be very unreliable at this point.
 * Let's keep things simple until the magic spell that makes this work is
 * found.
 */

static unsigned int axg_spdifin_get_rate(struct axg_spdifin *priv)
{}

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

static void axg_spdifin_write_mode_param(struct regmap *map, int mode,
					 unsigned int val,
					 unsigned int num_per_reg,
					 unsigned int base_reg,
					 unsigned int width)
{}

static void axg_spdifin_write_timer(struct regmap *map, int mode,
				    unsigned int val)
{}

static void axg_spdifin_write_threshold(struct regmap *map, int mode,
					unsigned int val)
{}

static unsigned int axg_spdifin_mode_timer(struct axg_spdifin *priv,
					   int mode,
					   unsigned int rate)
{}

static int axg_spdifin_sample_mode_config(struct snd_soc_dai *dai,
					  struct axg_spdifin *priv)
{}

static int axg_spdifin_dai_probe(struct snd_soc_dai *dai)
{}

static int axg_spdifin_dai_remove(struct snd_soc_dai *dai)
{}

static const struct snd_soc_dai_ops axg_spdifin_ops =;

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

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

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

#define AXG_SPDIFIN_IEC958_MASK

#define AXG_SPDIFIN_IEC958_STATUS

static const char * const spdifin_chsts_src_texts[] =;

static SOC_ENUM_SINGLE_DECL(axg_spdifin_chsts_src_enum, SPDIFIN_CTRL0,
			    SPDIFIN_CTRL0_STATUS_CH_SHIFT,
			    spdifin_chsts_src_texts);

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

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

#define AXG_SPDIFIN_LOCK_RATE(xname)

static const struct snd_kcontrol_new axg_spdifin_controls[] =;

static const struct snd_soc_component_driver axg_spdifin_component_drv =;

static const struct regmap_config axg_spdifin_regmap_cfg =;

static const unsigned int axg_spdifin_mode_rates[SPDIFIN_MODE_NUM] =;

static const struct axg_spdifin_cfg axg_cfg =;

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

static struct snd_soc_dai_driver *
axg_spdifin_get_dai_drv(struct device *dev, struct axg_spdifin *priv)
{}

static int axg_spdifin_probe(struct platform_device *pdev)
{}

static struct platform_driver axg_spdifin_pdrv =;
module_platform_driver();

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