linux/sound/pci/hda/patch_hdmi.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *
 *  patch_hdmi.c - routines for HDMI/DisplayPort codecs
 *
 *  Copyright(c) 2008-2010 Intel Corporation
 *  Copyright (c) 2006 ATI Technologies Inc.
 *  Copyright (c) 2008 NVIDIA Corp.  All rights reserved.
 *  Copyright (c) 2008 Wei Ni <[email protected]>
 *  Copyright (c) 2013 Anssi Hannula <[email protected]>
 *
 *  Authors:
 *			Wu Fengguang <[email protected]>
 *
 *  Maintained by:
 *			Wu Fengguang <[email protected]>
 */

#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <sound/core.h>
#include <sound/jack.h>
#include <sound/asoundef.h>
#include <sound/tlv.h>
#include <sound/hdaudio.h>
#include <sound/hda_i915.h>
#include <sound/hda_chmap.h>
#include <sound/hda_codec.h>
#include "hda_local.h"
#include "hda_jack.h"
#include "hda_controller.h"

static bool static_hdmi_pcm;
module_param(static_hdmi_pcm, bool, 0644);
MODULE_PARM_DESC();

static bool enable_acomp =;
module_param(enable_acomp, bool, 0444);
MODULE_PARM_DESC();

static bool enable_silent_stream =
IS_ENABLED();
module_param(enable_silent_stream, bool, 0644);
MODULE_PARM_DESC();

static bool enable_all_pins;
module_param(enable_all_pins, bool, 0444);
MODULE_PARM_DESC();

struct hdmi_spec_per_cvt {};

/* max. connections to a widget */
#define HDA_MAX_CONNECTIONS

struct hdmi_spec_per_pin {};

/* operations used by generic code that can be overridden by patches */
struct hdmi_ops {};

struct hdmi_pcm {};

enum {};

struct hdmi_spec {};

#ifdef CONFIG_SND_HDA_COMPONENT
static inline bool codec_has_acomp(struct hda_codec *codec)
{}
#else
#define codec_has_acomp
#endif

struct hdmi_audio_infoframe {};

struct dp_audio_infoframe {};

audio_infoframe;

/*
 * HDMI routines
 */

#define get_pin(spec, idx)
#define get_cvt(spec, idx)
/* obtain hdmi_pcm object assigned to idx */
#define get_hdmi_pcm(spec, idx)
/* obtain hda_pcm object assigned to idx */
#define get_pcm_rec(spec, idx)

static int pin_id_to_pin_index(struct hda_codec *codec,
			       hda_nid_t pin_nid, int dev_id)
{}

static int hinfo_to_pcm_index(struct hda_codec *codec,
			struct hda_pcm_stream *hinfo)
{}

static int hinfo_to_pin_index(struct hda_codec *codec,
			      struct hda_pcm_stream *hinfo)
{}

static struct hdmi_spec_per_pin *pcm_idx_to_pin(struct hdmi_spec *spec,
						int pcm_idx)
{}

static int cvt_nid_to_cvt_index(struct hda_codec *codec, hda_nid_t cvt_nid)
{}

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 const struct snd_kcontrol_new eld_bytes_ctl =;

static int hdmi_create_eld_ctl(struct hda_codec *codec, int pcm_idx,
			int device)
{}

#ifdef BE_PARANOID
static void hdmi_get_dip_index(struct hda_codec *codec, hda_nid_t pin_nid,
				int *packet_index, int *byte_index)
{
	int val;

	val = snd_hda_codec_read(codec, pin_nid, 0,
				 AC_VERB_GET_HDMI_DIP_INDEX, 0);

	*packet_index = val >> 5;
	*byte_index = val & 0x1f;
}
#endif

static void hdmi_set_dip_index(struct hda_codec *codec, hda_nid_t pin_nid,
				int packet_index, int byte_index)
{}

static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t pin_nid,
				unsigned char val)
{}

static void hdmi_init_pin(struct hda_codec *codec, hda_nid_t pin_nid)
{}

/*
 * ELD proc files
 */

#ifdef CONFIG_SND_PROC_FS
static void print_eld_info(struct snd_info_entry *entry,
			   struct snd_info_buffer *buffer)
{}

static void write_eld_info(struct snd_info_entry *entry,
			   struct snd_info_buffer *buffer)
{}

static int eld_proc_new(struct hdmi_spec_per_pin *per_pin, int index)
{}

static void eld_proc_free(struct hdmi_spec_per_pin *per_pin)
{}
#else
static inline int eld_proc_new(struct hdmi_spec_per_pin *per_pin,
			       int index)
{
	return 0;
}
static inline void eld_proc_free(struct hdmi_spec_per_pin *per_pin)
{
}
#endif

/*
 * Audio InfoFrame routines
 */

/*
 * Enable Audio InfoFrame Transmission
 */
static void hdmi_start_infoframe_trans(struct hda_codec *codec,
				       hda_nid_t pin_nid)
{}

/*
 * Disable Audio InfoFrame Transmission
 */
static void hdmi_stop_infoframe_trans(struct hda_codec *codec,
				      hda_nid_t pin_nid)
{}

static void hdmi_debug_dip_size(struct hda_codec *codec, hda_nid_t pin_nid)
{}

static void hdmi_clear_dip_buffers(struct hda_codec *codec, hda_nid_t pin_nid)
{}

static void hdmi_checksum_audio_infoframe(struct hdmi_audio_infoframe *hdmi_ai)
{}

static void hdmi_fill_audio_infoframe(struct hda_codec *codec,
				      hda_nid_t pin_nid,
				      u8 *dip, int size)
{}

static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid,
				    u8 *dip, int size)
{}

static int hdmi_pin_get_eld(struct hda_codec *codec, hda_nid_t nid,
			    int dev_id, unsigned char *buf, int *eld_size)
{}

static void hdmi_pin_setup_infoframe(struct hda_codec *codec,
				     hda_nid_t pin_nid, int dev_id,
				     int ca, int active_channels,
				     int conn_type)
{}

static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
				       struct hdmi_spec_per_pin *per_pin,
				       bool non_pcm)
{}

/*
 * Unsolicited events
 */

static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll);

static void check_presence_and_report(struct hda_codec *codec, hda_nid_t nid,
				      int dev_id)
{}

static void jack_callback(struct hda_codec *codec,
			  struct hda_jack_callback *jack)
{}

static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res,
				 struct hda_jack_tbl *jack)
{}

static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res)
{}


static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res)
{}

static void haswell_verify_D0(struct hda_codec *codec,
		hda_nid_t cvt_nid, hda_nid_t nid)
{}

/*
 * Callbacks
 */

/* HBR should be Non-PCM, 8 channels */
#define is_hbr_format(format)

static int hdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
			      int dev_id, bool hbr)
{}

static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
			      hda_nid_t pin_nid, int dev_id,
			      u32 stream_tag, int format)
{}

/* Try to find an available converter
 * If pin_idx is less then zero, just try to find an available converter.
 * Otherwise, try to find an available converter and get the cvt mux index
 * of the pin.
 */
static int hdmi_choose_cvt(struct hda_codec *codec,
			   int pin_idx, int *cvt_id,
			   bool silent)
{}

/* Assure the pin select the right convetor */
static void intel_verify_pin_cvt_connect(struct hda_codec *codec,
			struct hdmi_spec_per_pin *per_pin)
{}

/* get the mux index for the converter of the pins
 * converter's mux index is the same for all pins on Intel platform
 */
static int intel_cvt_id_to_mux_idx(struct hdmi_spec *spec,
			hda_nid_t cvt_nid)
{}

/* Intel HDMI workaround to fix audio routing issue:
 * For some Intel display codecs, pins share the same connection list.
 * So a conveter can be selected by multiple pins and playback on any of these
 * pins will generate sound on the external display, because audio flows from
 * the same converter to the display pipeline. Also muting one pin may make
 * other pins have no sound output.
 * So this function assures that an assigned converter for a pin is not selected
 * by any other pins.
 */
static void intel_not_share_assigned_cvt(struct hda_codec *codec,
					 hda_nid_t pin_nid,
					 int dev_id, int mux_idx)
{}

/* A wrapper of intel_not_share_asigned_cvt() */
static void intel_not_share_assigned_cvt_nid(struct hda_codec *codec,
			hda_nid_t pin_nid, int dev_id, hda_nid_t cvt_nid)
{}

/* skeleton caller of pin_cvt_fixup ops */
static void pin_cvt_fixup(struct hda_codec *codec,
			  struct hdmi_spec_per_pin *per_pin,
			  hda_nid_t cvt_nid)
{}

/* called in hdmi_pcm_open when no pin is assigned to the PCM */
static int hdmi_pcm_open_no_pin(struct hda_pcm_stream *hinfo,
			 struct hda_codec *codec,
			 struct snd_pcm_substream *substream)
{}

/*
 * HDA PCM callbacks
 */
static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
			 struct hda_codec *codec,
			 struct snd_pcm_substream *substream)
{}

/*
 * HDA/HDMI auto parsing
 */
static int hdmi_read_pin_conn(struct hda_codec *codec, int pin_idx)
{}

static int hdmi_find_pcm_slot(struct hdmi_spec *spec,
			      struct hdmi_spec_per_pin *per_pin)
{}

static void hdmi_attach_hda_pcm(struct hdmi_spec *spec,
				struct hdmi_spec_per_pin *per_pin)
{}

static void hdmi_detach_hda_pcm(struct hdmi_spec *spec,
				struct hdmi_spec_per_pin *per_pin)
{}

static int hdmi_get_pin_cvt_mux(struct hdmi_spec *spec,
		struct hdmi_spec_per_pin *per_pin, hda_nid_t cvt_nid)
{}

static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid);

static void hdmi_pcm_setup_pin(struct hdmi_spec *spec,
			   struct hdmi_spec_per_pin *per_pin)
{}

static void hdmi_pcm_reset_pin(struct hdmi_spec *spec,
			   struct hdmi_spec_per_pin *per_pin)
{}

static struct snd_jack *pin_idx_to_pcm_jack(struct hda_codec *codec,
					    struct hdmi_spec_per_pin *per_pin)
{}

/* update per_pin ELD from the given new ELD;
 * setup info frame and notification accordingly
 * also notify ELD kctl and report jack status changes
 */
static void update_eld(struct hda_codec *codec,
		       struct hdmi_spec_per_pin *per_pin,
		       struct hdmi_eld *eld,
		       int repoll)
{}

/* update ELD and jack state via HD-audio verbs */
static void hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
					 int repoll)
{}

#define I915_SILENT_RATE
#define I915_SILENT_CHANNELS
#define I915_SILENT_FORMAT_BITS
#define I915_SILENT_FMT_MASK

static void silent_stream_enable_i915(struct hda_codec *codec,
				      struct hdmi_spec_per_pin *per_pin)
{}

static void silent_stream_set_kae(struct hda_codec *codec,
				  struct hdmi_spec_per_pin *per_pin,
				  bool enable)
{}

static void silent_stream_enable(struct hda_codec *codec,
				 struct hdmi_spec_per_pin *per_pin)
{}

static void silent_stream_disable(struct hda_codec *codec,
				  struct hdmi_spec_per_pin *per_pin)
{}

/* update ELD and jack state via audio component */
static void sync_eld_via_acomp(struct hda_codec *codec,
			       struct hdmi_spec_per_pin *per_pin)
{}

static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
{}

static void hdmi_repoll_eld(struct work_struct *work)
{}

static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
{}

static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid)
{}

static const struct snd_pci_quirk force_connect_list[] =;

static int hdmi_parse_codec(struct hda_codec *codec)
{}

/*
 */
static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid)
{}

/*
 * HDMI callbacks
 */

static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
					   struct hda_codec *codec,
					   unsigned int stream_tag,
					   unsigned int format,
					   struct snd_pcm_substream *substream)
{}

static int generic_hdmi_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
					     struct hda_codec *codec,
					     struct snd_pcm_substream *substream)
{}

static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
			  struct hda_codec *codec,
			  struct snd_pcm_substream *substream)
{}

static const struct hda_pcm_ops generic_ops =;

static int hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx)
{}

static void hdmi_get_chmap(struct hdac_device *hdac, int pcm_idx,
					unsigned char *chmap)
{}

static void hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx,
				unsigned char *chmap, int prepared)
{}

static bool is_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx)
{}

static int generic_hdmi_build_pcms(struct hda_codec *codec)
{}

static void free_hdmi_jack_priv(struct snd_jack *jack)
{}

static int generic_hdmi_build_jack(struct hda_codec *codec, int pcm_idx)
{}

static int generic_hdmi_build_controls(struct hda_codec *codec)
{}

static int generic_hdmi_init_per_pins(struct hda_codec *codec)
{}

static int generic_hdmi_init(struct hda_codec *codec)
{}

static void hdmi_array_init(struct hdmi_spec *spec, int nums)
{}

static void hdmi_array_free(struct hdmi_spec *spec)
{}

static void generic_spec_free(struct hda_codec *codec)
{}

static void generic_hdmi_free(struct hda_codec *codec)
{}

static int generic_hdmi_suspend(struct hda_codec *codec)
{}

static int generic_hdmi_resume(struct hda_codec *codec)
{}

static const struct hda_codec_ops generic_hdmi_patch_ops =;

static const struct hdmi_ops generic_standard_hdmi_ops =;

/* allocate codec->spec and assign/initialize generic parser ops */
static int alloc_generic_hdmi(struct hda_codec *codec)
{}

/* generic HDMI parser */
static int patch_generic_hdmi(struct hda_codec *codec)
{}

/*
 * generic audio component binding
 */

/* turn on / off the unsol event jack detection dynamically */
static void reprogram_jack_detect(struct hda_codec *codec, hda_nid_t nid,
				  int dev_id, bool use_acomp)
{}

/* set up / clear component notifier dynamically */
static void generic_acomp_notifier_set(struct drm_audio_component *acomp,
				       bool use_acomp)
{}

/* enable / disable the notifier via master bind / unbind */
static int generic_acomp_master_bind(struct device *dev,
				     struct drm_audio_component *acomp)
{}

static void generic_acomp_master_unbind(struct device *dev,
					struct drm_audio_component *acomp)
{}

/* check whether both HD-audio and DRM PCI devices belong to the same bus */
static int match_bound_vga(struct device *dev, int subtype, void *data)
{}

/* audio component notifier for AMD/Nvidia HDMI codecs */
static void generic_acomp_pin_eld_notify(void *audio_ptr, int port, int dev_id)
{}

/* set up the private drm_audio_ops from the template */
static void setup_drm_audio_ops(struct hda_codec *codec,
				const struct drm_audio_component_audio_ops *ops)
{}

/* initialize the generic HDMI audio component */
static void generic_acomp_init(struct hda_codec *codec,
			       const struct drm_audio_component_audio_ops *ops,
			       int (*port2pin)(struct hda_codec *, int))
{}

/*
 * Intel codec parsers and helpers
 */

#define INTEL_GET_VENDOR_VERB
#define INTEL_SET_VENDOR_VERB
#define INTEL_EN_DP12
#define INTEL_EN_ALL_PIN_CVTS

static void intel_haswell_enable_all_pins(struct hda_codec *codec,
					  bool update_tree)
{}

static void intel_haswell_fixup_enable_dp12(struct hda_codec *codec)
{}

/* Haswell needs to re-issue the vendor-specific verbs before turning to D0.
 * Otherwise you may get severe h/w communication errors.
 */
static void haswell_set_power_state(struct hda_codec *codec, hda_nid_t fg,
				unsigned int power_state)
{}

/* There is a fixed mapping between audio pin node and display port.
 * on SNB, IVY, HSW, BSW, SKL, BXT, KBL:
 * Pin Widget 5 - PORT B (port = 1 in i915 driver)
 * Pin Widget 6 - PORT C (port = 2 in i915 driver)
 * Pin Widget 7 - PORT D (port = 3 in i915 driver)
 *
 * on VLV, ILK:
 * Pin Widget 4 - PORT B (port = 1 in i915 driver)
 * Pin Widget 5 - PORT C (port = 2 in i915 driver)
 * Pin Widget 6 - PORT D (port = 3 in i915 driver)
 */
static int intel_base_nid(struct hda_codec *codec)
{}

static int intel_pin2port(void *audio_ptr, int pin_nid)
{}

static int intel_port2pin(struct hda_codec *codec, int port)
{}

static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe)
{}

static const struct drm_audio_component_audio_ops intel_audio_ops =;

/* register i915 component pin_eld_notify callback */
static void register_i915_notifier(struct hda_codec *codec)
{}

/* setup_stream ops override for HSW+ */
static int i915_hsw_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
				 hda_nid_t pin_nid, int dev_id, u32 stream_tag,
				 int format)
{}

/* pin_cvt_fixup ops override for HSW+ and VLV+ */
static void i915_pin_cvt_fixup(struct hda_codec *codec,
			       struct hdmi_spec_per_pin *per_pin,
			       hda_nid_t cvt_nid)
{}

static int i915_adlp_hdmi_suspend(struct hda_codec *codec)
{}

static int i915_adlp_hdmi_resume(struct hda_codec *codec)
{}

/* precondition and allocation for Intel codecs */
static int alloc_intel_hdmi(struct hda_codec *codec)
{}

/* parse and post-process for Intel codecs */
static int parse_intel_hdmi(struct hda_codec *codec)
{}

/* Intel Haswell and onwards; audio component with eld notifier */
static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid,
				 const int *port_map, int port_num, int dev_num,
				 bool send_silent_stream)
{}

static int patch_i915_hsw_hdmi(struct hda_codec *codec)
{}

static int patch_i915_glk_hdmi(struct hda_codec *codec)
{}

static int patch_i915_icl_hdmi(struct hda_codec *codec)
{}

static int patch_i915_tgl_hdmi(struct hda_codec *codec)
{}

static int patch_i915_adlp_hdmi(struct hda_codec *codec)
{}

/* Intel Baytrail and Braswell; with eld notifier */
static int patch_i915_byt_hdmi(struct hda_codec *codec)
{}

/* Intel IronLake, SandyBridge and IvyBridge; with eld notifier */
static int patch_i915_cpt_hdmi(struct hda_codec *codec)
{}

/*
 * Shared non-generic implementations
 */

static int simple_playback_build_pcms(struct hda_codec *codec)
{}

/* unsolicited event for jack sensing */
static void simple_hdmi_unsol_event(struct hda_codec *codec,
				    unsigned int res)
{}

/* generic_hdmi_build_jack can be used for simple_hdmi, too,
 * as long as spec->pins[] is set correctly
 */
#define simple_hdmi_build_jack

static int simple_playback_build_controls(struct hda_codec *codec)
{}

static int simple_playback_init(struct hda_codec *codec)
{}

static void simple_playback_free(struct hda_codec *codec)
{}

/*
 * Nvidia specific implementations
 */

#define Nv_VERB_SET_Channel_Allocation
#define Nv_VERB_SET_Info_Frame_Checksum
#define Nv_VERB_SET_Audio_Protection_On
#define Nv_VERB_SET_Audio_Protection_Off

#define nvhdmi_master_con_nid_7x
#define nvhdmi_master_pin_nid_7x

static const hda_nid_t nvhdmi_con_nids_7x[4] =;

static const struct hda_verb nvhdmi_basic_init_7x_2ch[] =;

static const struct hda_verb nvhdmi_basic_init_7x_8ch[] =;

#ifdef LIMITED_RATE_FMT_SUPPORT
/* support only the safe format and rate */
#define SUPPORTED_RATES
#define SUPPORTED_MAXBPS
#define SUPPORTED_FORMATS
#else
/* support all rates and formats */
#define SUPPORTED_RATES
#define SUPPORTED_MAXBPS
#define SUPPORTED_FORMATS
#endif

static int nvhdmi_7x_init_2ch(struct hda_codec *codec)
{}

static int nvhdmi_7x_init_8ch(struct hda_codec *codec)
{}

static const unsigned int channels_2_6_8[] =;

static const unsigned int channels_2_8[] =;

static const struct snd_pcm_hw_constraint_list hw_constraints_2_6_8_channels =;

static const struct snd_pcm_hw_constraint_list hw_constraints_2_8_channels =;

static int simple_playback_pcm_open(struct hda_pcm_stream *hinfo,
				    struct hda_codec *codec,
				    struct snd_pcm_substream *substream)
{}

static int simple_playback_pcm_close(struct hda_pcm_stream *hinfo,
				     struct hda_codec *codec,
				     struct snd_pcm_substream *substream)
{}

static int simple_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
				       struct hda_codec *codec,
				       unsigned int stream_tag,
				       unsigned int format,
				       struct snd_pcm_substream *substream)
{}

static const struct hda_pcm_stream simple_pcm_playback =;

static const struct hda_codec_ops simple_hdmi_patch_ops =;

static int patch_simple_hdmi(struct hda_codec *codec,
			     hda_nid_t cvt_nid, hda_nid_t pin_nid)
{}

static void nvhdmi_8ch_7x_set_info_frame_parameters(struct hda_codec *codec,
						    int channels)
{}

static int nvhdmi_8ch_7x_pcm_close(struct hda_pcm_stream *hinfo,
				   struct hda_codec *codec,
				   struct snd_pcm_substream *substream)
{}

static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo,
				     struct hda_codec *codec,
				     unsigned int stream_tag,
				     unsigned int format,
				     struct snd_pcm_substream *substream)
{}

static const struct hda_pcm_stream nvhdmi_pcm_playback_8ch_7x =;

static int patch_nvhdmi_2ch(struct hda_codec *codec)
{}

static int nvhdmi_7x_8ch_build_pcms(struct hda_codec *codec)
{}

static int nvhdmi_7x_8ch_build_controls(struct hda_codec *codec)
{}

static int patch_nvhdmi_8ch_7x(struct hda_codec *codec)
{}

/*
 * NVIDIA codecs ignore ASP mapping for 2ch - confirmed on:
 * - 0x10de0015
 * - 0x10de0040
 */
static int nvhdmi_chmap_cea_alloc_validate_get_type(struct hdac_chmap *chmap,
		struct hdac_cea_channel_speaker_allocation *cap, int channels)
{}

static int nvhdmi_chmap_validate(struct hdac_chmap *chmap,
		int ca, int chs, unsigned char *map)
{}

/* map from pin NID to port; port is 0-based */
/* for Nvidia: assume widget NID starting from 4, with step 1 (4, 5, 6, ...) */
static int nvhdmi_pin2port(void *audio_ptr, int pin_nid)
{}

/* reverse-map from port to pin NID: see above */
static int nvhdmi_port2pin(struct hda_codec *codec, int port)
{}

static const struct drm_audio_component_audio_ops nvhdmi_audio_ops =;

static int patch_nvhdmi(struct hda_codec *codec)
{}

static int patch_nvhdmi_legacy(struct hda_codec *codec)
{}

/*
 * The HDA codec on NVIDIA Tegra contains two scratch registers that are
 * accessed using vendor-defined verbs. These registers can be used for
 * interoperability between the HDA and HDMI drivers.
 */

/* Audio Function Group node */
#define NVIDIA_AFG_NID

/*
 * The SCRATCH0 register is used to notify the HDMI codec of changes in audio
 * format. On Tegra, bit 31 is used as a trigger that causes an interrupt to
 * be raised in the HDMI codec. The remainder of the bits is arbitrary. This
 * implementation stores the HDA format (see AC_FMT_*) in bits [15:0] and an
 * additional bit (at position 30) to signal the validity of the format.
 *
 * | 31      | 30    | 29  16 | 15   0 |
 * +---------+-------+--------+--------+
 * | TRIGGER | VALID | UNUSED | FORMAT |
 * +-----------------------------------|
 *
 * Note that for the trigger bit to take effect it needs to change value
 * (i.e. it needs to be toggled). The trigger bit is not applicable from
 * TEGRA234 chip onwards, as new verb id 0xf80 will be used for interrupt
 * trigger to hdmi.
 */
#define NVIDIA_SET_HOST_INTR
#define NVIDIA_GET_SCRATCH0
#define NVIDIA_SET_SCRATCH0_BYTE0
#define NVIDIA_SET_SCRATCH0_BYTE1
#define NVIDIA_SET_SCRATCH0_BYTE2
#define NVIDIA_SET_SCRATCH0_BYTE3
#define NVIDIA_SCRATCH_TRIGGER
#define NVIDIA_SCRATCH_VALID

#define NVIDIA_GET_SCRATCH1
#define NVIDIA_SET_SCRATCH1_BYTE0
#define NVIDIA_SET_SCRATCH1_BYTE1
#define NVIDIA_SET_SCRATCH1_BYTE2
#define NVIDIA_SET_SCRATCH1_BYTE3

/*
 * The format parameter is the HDA audio format (see AC_FMT_*). If set to 0,
 * the format is invalidated so that the HDMI codec can be disabled.
 */
static void tegra_hdmi_set_format(struct hda_codec *codec,
				  hda_nid_t cvt_nid,
				  unsigned int format)
{}

static int tegra_hdmi_pcm_prepare(struct hda_pcm_stream *hinfo,
				  struct hda_codec *codec,
				  unsigned int stream_tag,
				  unsigned int format,
				  struct snd_pcm_substream *substream)
{}

static int tegra_hdmi_pcm_cleanup(struct hda_pcm_stream *hinfo,
				  struct hda_codec *codec,
				  struct snd_pcm_substream *substream)
{}

static struct hda_pcm *hda_find_pcm_by_type(struct hda_codec *codec, int type)
{}

static int tegra_hdmi_build_pcms(struct hda_codec *codec)
{}

static int tegra_hdmi_init(struct hda_codec *codec)
{}

static int patch_tegra_hdmi(struct hda_codec *codec)
{}

static int patch_tegra234_hdmi(struct hda_codec *codec)
{}

/*
 * ATI/AMD-specific implementations
 */

#define is_amdhdmi_rev3_or_later(codec)
#define has_amd_full_remap_support(codec)

/* ATI/AMD specific HDA pin verbs, see the AMD HDA Verbs specification */
#define ATI_VERB_SET_CHANNEL_ALLOCATION
#define ATI_VERB_SET_DOWNMIX_INFO
#define ATI_VERB_SET_MULTICHANNEL_01
#define ATI_VERB_SET_MULTICHANNEL_23
#define ATI_VERB_SET_MULTICHANNEL_45
#define ATI_VERB_SET_MULTICHANNEL_67
#define ATI_VERB_SET_HBR_CONTROL
#define ATI_VERB_SET_MULTICHANNEL_1
#define ATI_VERB_SET_MULTICHANNEL_3
#define ATI_VERB_SET_MULTICHANNEL_5
#define ATI_VERB_SET_MULTICHANNEL_7
#define ATI_VERB_SET_MULTICHANNEL_MODE
#define ATI_VERB_GET_CHANNEL_ALLOCATION
#define ATI_VERB_GET_DOWNMIX_INFO
#define ATI_VERB_GET_MULTICHANNEL_01
#define ATI_VERB_GET_MULTICHANNEL_23
#define ATI_VERB_GET_MULTICHANNEL_45
#define ATI_VERB_GET_MULTICHANNEL_67
#define ATI_VERB_GET_HBR_CONTROL
#define ATI_VERB_GET_MULTICHANNEL_1
#define ATI_VERB_GET_MULTICHANNEL_3
#define ATI_VERB_GET_MULTICHANNEL_5
#define ATI_VERB_GET_MULTICHANNEL_7
#define ATI_VERB_GET_MULTICHANNEL_MODE

/* AMD specific HDA cvt verbs */
#define ATI_VERB_SET_RAMP_RATE
#define ATI_VERB_GET_RAMP_RATE

#define ATI_OUT_ENABLE

#define ATI_MULTICHANNEL_MODE_PAIRED
#define ATI_MULTICHANNEL_MODE_SINGLE

#define ATI_HBR_CAPABLE
#define ATI_HBR_ENABLE

static int atihdmi_pin_get_eld(struct hda_codec *codec, hda_nid_t nid,
			       int dev_id, unsigned char *buf, int *eld_size)
{}

static void atihdmi_pin_setup_infoframe(struct hda_codec *codec,
					hda_nid_t pin_nid, int dev_id, int ca,
					int active_channels, int conn_type)
{}

static int atihdmi_paired_swap_fc_lfe(int pos)
{}

static int atihdmi_paired_chmap_validate(struct hdac_chmap *chmap,
			int ca, int chs, unsigned char *map)
{}

static int atihdmi_pin_set_slot_channel(struct hdac_device *hdac,
		hda_nid_t pin_nid, int hdmi_slot, int stream_channel)
{}

static int atihdmi_pin_get_slot_channel(struct hdac_device *hdac,
				hda_nid_t pin_nid, int asp_slot)
{}

static int atihdmi_paired_chmap_cea_alloc_validate_get_type(
		struct hdac_chmap *chmap,
		struct hdac_cea_channel_speaker_allocation *cap,
		int channels)
{}

static void atihdmi_paired_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap,
		struct hdac_cea_channel_speaker_allocation *cap,
		unsigned int *chmap, int channels)
{}

static int atihdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
				 int dev_id, bool hbr)
{}

static int atihdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
				hda_nid_t pin_nid, int dev_id,
				u32 stream_tag, int format)
{}


static int atihdmi_init(struct hda_codec *codec)
{}

/* map from pin NID to port; port is 0-based */
/* for AMD: assume widget NID starting from 3, with step 2 (3, 5, 7, ...) */
static int atihdmi_pin2port(void *audio_ptr, int pin_nid)
{}

/* reverse-map from port to pin NID: see above */
static int atihdmi_port2pin(struct hda_codec *codec, int port)
{}

static const struct drm_audio_component_audio_ops atihdmi_audio_ops =;

static int patch_atihdmi(struct hda_codec *codec)
{}

/* VIA HDMI Implementation */
#define VIAHDMI_CVT_NID
#define VIAHDMI_PIN_NID

static int patch_via_hdmi(struct hda_codec *codec)
{}

static int patch_gf_hdmi(struct hda_codec *codec)
{}

/*
 * patch entries
 */
static const struct hda_device_id snd_hda_id_hdmi[] =;
MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_hdmi);

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

static struct hda_codec_driver hdmi_driver =;

module_hda_codec_driver();