#include <linux/component.h>
#include <linux/kernel.h>
#include <drm/drm_edid.h>
#include <drm/drm_eld.h>
#include <drm/drm_fixed.h>
#include <drm/intel/i915_component.h>
#include "i915_drv.h"
#include "intel_atomic.h"
#include "intel_audio.h"
#include "intel_audio_regs.h"
#include "intel_cdclk.h"
#include "intel_crtc.h"
#include "intel_de.h"
#include "intel_display_types.h"
#include "intel_lpe_audio.h"
struct intel_audio_funcs { … };
struct hdmi_aud_ncts { … };
static const struct { … } hdmi_audio_clock[] = …;
#define TMDS_297M …
#define TMDS_296M …
#define TMDS_594M …
#define TMDS_593M …
static const struct hdmi_aud_ncts hdmi_aud_ncts_24bpp[] = …;
#define TMDS_371M …
#define TMDS_370M …
static const struct hdmi_aud_ncts hdmi_aud_ncts_30bpp[] = …;
#define TMDS_445_5M …
#define TMDS_445M …
static const struct hdmi_aud_ncts hdmi_aud_ncts_36bpp[] = …;
static bool needs_wa_14020863754(struct drm_i915_private *i915)
{ … }
static u32 audio_config_hdmi_pixel_clock(const struct intel_crtc_state *crtc_state)
{ … }
static int audio_config_hdmi_get_n(const struct intel_crtc_state *crtc_state,
int rate)
{ … }
static int g4x_eld_buffer_size(struct drm_i915_private *i915)
{ … }
static void g4x_audio_codec_get_config(struct intel_encoder *encoder,
struct intel_crtc_state *crtc_state)
{ … }
static void g4x_audio_codec_disable(struct intel_encoder *encoder,
const struct intel_crtc_state *old_crtc_state,
const struct drm_connector_state *old_conn_state)
{ … }
static void g4x_audio_codec_enable(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state)
{ … }
static void
hsw_dp_audio_config_update(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state)
{ … }
static void
hsw_hdmi_audio_config_update(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state)
{ … }
static void
hsw_audio_config_update(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state)
{ … }
static void hsw_audio_codec_disable(struct intel_encoder *encoder,
const struct intel_crtc_state *old_crtc_state,
const struct drm_connector_state *old_conn_state)
{ … }
static unsigned int calc_hblank_early_prog(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state)
{ … }
static unsigned int calc_samples_room(const struct intel_crtc_state *crtc_state)
{ … }
static void enable_audio_dsc_wa(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state)
{ … }
static void hsw_audio_codec_enable(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state)
{ … }
struct ibx_audio_regs { … };
static void ibx_audio_regs_init(struct drm_i915_private *i915,
enum pipe pipe,
struct ibx_audio_regs *regs)
{ … }
static void ibx_audio_codec_disable(struct intel_encoder *encoder,
const struct intel_crtc_state *old_crtc_state,
const struct drm_connector_state *old_conn_state)
{ … }
static void ibx_audio_codec_enable(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state)
{ … }
void intel_audio_sdp_split_update(const struct intel_crtc_state *crtc_state)
{ … }
bool intel_audio_compute_config(struct intel_encoder *encoder,
struct intel_crtc_state *crtc_state,
struct drm_connector_state *conn_state)
{ … }
void intel_audio_codec_enable(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state)
{ … }
void intel_audio_codec_disable(struct intel_encoder *encoder,
const struct intel_crtc_state *old_crtc_state,
const struct drm_connector_state *old_conn_state)
{ … }
static void intel_acomp_get_config(struct intel_encoder *encoder,
struct intel_crtc_state *crtc_state)
{ … }
void intel_audio_codec_get_config(struct intel_encoder *encoder,
struct intel_crtc_state *crtc_state)
{ … }
static const struct intel_audio_funcs g4x_audio_funcs = …;
static const struct intel_audio_funcs ibx_audio_funcs = …;
static const struct intel_audio_funcs hsw_audio_funcs = …;
void intel_audio_hooks_init(struct drm_i915_private *i915)
{ … }
struct aud_ts_cdclk_m_n { … };
void intel_audio_cdclk_change_pre(struct drm_i915_private *i915)
{ … }
static void get_aud_ts_cdclk_m_n(int refclk, int cdclk, struct aud_ts_cdclk_m_n *aud_ts)
{ … }
void intel_audio_cdclk_change_post(struct drm_i915_private *i915)
{ … }
static int glk_force_audio_cdclk_commit(struct intel_atomic_state *state,
struct intel_crtc *crtc,
bool enable)
{ … }
static void glk_force_audio_cdclk(struct drm_i915_private *i915,
bool enable)
{ … }
static unsigned long i915_audio_component_get_power(struct device *kdev)
{ … }
static void i915_audio_component_put_power(struct device *kdev,
unsigned long cookie)
{ … }
static void i915_audio_component_codec_wake_override(struct device *kdev,
bool enable)
{ … }
static int i915_audio_component_get_cdclk_freq(struct device *kdev)
{ … }
static struct intel_audio_state *find_audio_state(struct drm_i915_private *i915,
int port, int cpu_transcoder)
{ … }
static int i915_audio_component_sync_audio_rate(struct device *kdev, int port,
int cpu_transcoder, int rate)
{ … }
static int i915_audio_component_get_eld(struct device *kdev, int port,
int cpu_transcoder, bool *enabled,
unsigned char *buf, int max_bytes)
{ … }
static const struct drm_audio_component_ops i915_audio_component_ops = …;
static int i915_audio_component_bind(struct device *drv_kdev,
struct device *hda_kdev, void *data)
{ … }
static void i915_audio_component_unbind(struct device *drv_kdev,
struct device *hda_kdev, void *data)
{ … }
static const struct component_ops i915_audio_component_bind_ops = …;
#define AUD_FREQ_TMODE_SHIFT …
#define AUD_FREQ_4T …
#define AUD_FREQ_8T …
#define AUD_FREQ_PULLCLKS(x) …
#define AUD_FREQ_BCLK_96M …
#define AUD_FREQ_GEN12 …
#define AUD_FREQ_TGL_BROKEN …
static void i915_audio_component_init(struct drm_i915_private *i915)
{ … }
static void i915_audio_component_register(struct drm_i915_private *i915)
{ … }
static void i915_audio_component_cleanup(struct drm_i915_private *i915)
{ … }
void intel_audio_init(struct drm_i915_private *i915)
{ … }
void intel_audio_register(struct drm_i915_private *i915)
{ … }
void intel_audio_deinit(struct drm_i915_private *i915)
{ … }