linux/sound/soc/codecs/hdmi-codec.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * ALSA SoC codec for HDMI encoder drivers
 * Copyright (C) 2015 Texas Instruments Incorporated - https://www.ti.com/
 * Author: Jyri Sarha <[email protected]>
 */
#include <linux/module.h>
#include <linux/string.h>
#include <sound/core.h>
#include <sound/jack.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include <sound/pcm_drm_eld.h>
#include <sound/hdmi-codec.h>
#include <sound/pcm_iec958.h>

#include <drm/drm_crtc.h> /* This is only to get MAX_ELD_BYTES */
#include <drm/drm_eld.h>

#define HDMI_CODEC_CHMAP_IDX_UNKNOWN

/*
 * CEA speaker placement for HDMI 1.4:
 *
 *  FL  FLC   FC   FRC   FR   FRW
 *
 *                                  LFE
 *
 *  RL  RLC   RC   RRC   RR
 *
 *  Speaker placement has to be extended to support HDMI 2.0
 */
enum hdmi_codec_cea_spk_placement {};

/*
 * cea Speaker allocation structure
 */
struct hdmi_codec_cea_spk_alloc {};

/* Channel maps  stereo HDMI */
static const struct snd_pcm_chmap_elem hdmi_codec_stereo_chmaps[] =;

/* Channel maps for multi-channel playbacks, up to 8 n_ch */
static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] =;

/*
 * hdmi_codec_channel_alloc: speaker configuration available for CEA
 *
 * This is an ordered list that must match with hdmi_codec_8ch_chmaps struct
 * The preceding ones have better chances to be selected by
 * hdmi_codec_get_ch_alloc_table_idx().
 */
static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] =;

struct hdmi_codec_priv {};

static const struct snd_soc_dapm_widget hdmi_widgets[] =;

enum {};

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

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

static unsigned long hdmi_codec_spk_mask_from_alloc(int spk_alloc)
{}

static void hdmi_codec_eld_chmap(struct hdmi_codec_priv *hcp)
{}

static int hdmi_codec_get_ch_alloc_table_idx(struct hdmi_codec_priv *hcp,
					     unsigned char channels)
{}
static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol,
			      struct snd_ctl_elem_value *ucontrol)
{}

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

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

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

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

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

static void hdmi_codec_shutdown(struct snd_pcm_substream *substream,
				struct snd_soc_dai *dai)
{}

static int hdmi_codec_fill_codec_params(struct snd_soc_dai *dai,
					unsigned int sample_width,
					unsigned int sample_rate,
					unsigned int channels,
					struct hdmi_codec_params *hp)
{}

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

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

static int hdmi_codec_i2s_set_fmt(struct snd_soc_dai *dai,
				  unsigned int fmt)
{}

static int hdmi_codec_mute(struct snd_soc_dai *dai, int mute, int direction)
{}

/*
 * This driver can select all SND_SOC_DAIFMT_CBx_CFx,
 * but need to be selected from Sound Card, not be auto selected.
 * Because it might be used from other driver.
 * For example,
 *	${LINUX}/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
 */
static const u64 hdmi_codec_formats =;

#define HDMI_RATES

#define SPDIF_FORMATS

/*
 * This list is only for formats allowed on the I2S bus. So there is
 * some formats listed that are not supported by HDMI interface. For
 * instance allowing the 32-bit formats enables 24-precision with CPU
 * DAIs that do not support 24-bit formats. If the extra formats cause
 * problems, we should add the video side driver an option to disable
 * them.
 */
#define I2S_FORMATS

static struct snd_kcontrol_new hdmi_codec_controls[] =;

static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd,
			      struct snd_soc_dai *dai)
{}

static int hdmi_dai_probe(struct snd_soc_dai *dai)
{}

static void hdmi_codec_jack_report(struct hdmi_codec_priv *hcp,
				   unsigned int jack_status)
{}

static void plugged_cb(struct device *dev, bool plugged)
{}

static int hdmi_codec_set_jack(struct snd_soc_component *component,
			       struct snd_soc_jack *jack,
			       void *data)
{}

static int hdmi_dai_spdif_probe(struct snd_soc_dai *dai)
{}

static const struct snd_soc_dai_ops hdmi_codec_i2s_dai_ops =;

static const struct snd_soc_dai_ops hdmi_codec_spdif_dai_ops =;

static const struct snd_soc_dai_driver hdmi_i2s_dai =;

static const struct snd_soc_dai_driver hdmi_spdif_dai =;

static int hdmi_of_xlate_dai_id(struct snd_soc_component *component,
				 struct device_node *endpoint)
{}

static int hdmi_probe(struct snd_soc_component *component)
{}

static void hdmi_remove(struct snd_soc_component *component)
{}

static const struct snd_soc_component_driver hdmi_driver =;

static int hdmi_codec_probe(struct platform_device *pdev)
{}

static struct platform_driver hdmi_codec_driver =;

module_platform_driver();

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