#include <linux/clk.h>
#include <linux/component.h>
#include <linux/debugfs.h>
#include <linux/hdmi.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/reset.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_drv.h>
#include <drm/drm_edid.h>
#include <drm/drm_file.h>
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>
#include <sound/hdmi-codec.h>
#include "sti_hdmi.h"
#include "sti_hdmi_tx3g4c28phy.h"
#include "sti_vtg.h"
#define HDMI_CFG …
#define HDMI_INT_EN …
#define HDMI_INT_STA …
#define HDMI_INT_CLR …
#define HDMI_STA …
#define HDMI_ACTIVE_VID_XMIN …
#define HDMI_ACTIVE_VID_XMAX …
#define HDMI_ACTIVE_VID_YMIN …
#define HDMI_ACTIVE_VID_YMAX …
#define HDMI_DFLT_CHL0_DAT …
#define HDMI_DFLT_CHL1_DAT …
#define HDMI_DFLT_CHL2_DAT …
#define HDMI_AUDIO_CFG …
#define HDMI_SPDIF_FIFO_STATUS …
#define HDMI_SW_DI_1_HEAD_WORD …
#define HDMI_SW_DI_1_PKT_WORD0 …
#define HDMI_SW_DI_1_PKT_WORD1 …
#define HDMI_SW_DI_1_PKT_WORD2 …
#define HDMI_SW_DI_1_PKT_WORD3 …
#define HDMI_SW_DI_1_PKT_WORD4 …
#define HDMI_SW_DI_1_PKT_WORD5 …
#define HDMI_SW_DI_1_PKT_WORD6 …
#define HDMI_SW_DI_CFG …
#define HDMI_SAMPLE_FLAT_MASK …
#define HDMI_AUDN …
#define HDMI_AUD_CTS …
#define HDMI_SW_DI_2_HEAD_WORD …
#define HDMI_SW_DI_2_PKT_WORD0 …
#define HDMI_SW_DI_2_PKT_WORD1 …
#define HDMI_SW_DI_2_PKT_WORD2 …
#define HDMI_SW_DI_2_PKT_WORD3 …
#define HDMI_SW_DI_2_PKT_WORD4 …
#define HDMI_SW_DI_2_PKT_WORD5 …
#define HDMI_SW_DI_2_PKT_WORD6 …
#define HDMI_SW_DI_3_HEAD_WORD …
#define HDMI_SW_DI_3_PKT_WORD0 …
#define HDMI_SW_DI_3_PKT_WORD1 …
#define HDMI_SW_DI_3_PKT_WORD2 …
#define HDMI_SW_DI_3_PKT_WORD3 …
#define HDMI_SW_DI_3_PKT_WORD4 …
#define HDMI_SW_DI_3_PKT_WORD5 …
#define HDMI_SW_DI_3_PKT_WORD6 …
#define HDMI_IFRAME_SLOT_AVI …
#define HDMI_IFRAME_SLOT_AUDIO …
#define HDMI_IFRAME_SLOT_VENDOR …
#define XCAT(prefix, x, suffix) …
#define HDMI_SW_DI_N_HEAD_WORD(x) …
#define HDMI_SW_DI_N_PKT_WORD0(x) …
#define HDMI_SW_DI_N_PKT_WORD1(x) …
#define HDMI_SW_DI_N_PKT_WORD2(x) …
#define HDMI_SW_DI_N_PKT_WORD3(x) …
#define HDMI_SW_DI_N_PKT_WORD4(x) …
#define HDMI_SW_DI_N_PKT_WORD5(x) …
#define HDMI_SW_DI_N_PKT_WORD6(x) …
#define HDMI_SW_DI_MAX_WORD …
#define HDMI_IFRAME_DISABLED …
#define HDMI_IFRAME_SINGLE_SHOT …
#define HDMI_IFRAME_FIELD …
#define HDMI_IFRAME_FRAME …
#define HDMI_IFRAME_MASK …
#define HDMI_IFRAME_CFG_DI_N(x, n) …
#define HDMI_CFG_DEVICE_EN …
#define HDMI_CFG_HDMI_NOT_DVI …
#define HDMI_CFG_HDCP_EN …
#define HDMI_CFG_ESS_NOT_OESS …
#define HDMI_CFG_H_SYNC_POL_NEG …
#define HDMI_CFG_V_SYNC_POL_NEG …
#define HDMI_CFG_422_EN …
#define HDMI_CFG_FIFO_OVERRUN_CLR …
#define HDMI_CFG_FIFO_UNDERRUN_CLR …
#define HDMI_CFG_SW_RST_EN …
#define HDMI_INT_GLOBAL …
#define HDMI_INT_SW_RST …
#define HDMI_INT_PIX_CAP …
#define HDMI_INT_HOT_PLUG …
#define HDMI_INT_DLL_LCK …
#define HDMI_INT_NEW_FRAME …
#define HDMI_INT_GENCTRL_PKT …
#define HDMI_INT_AUDIO_FIFO_XRUN …
#define HDMI_INT_SINK_TERM_PRESENT …
#define HDMI_DEFAULT_INT …
#define HDMI_WORKING_INT …
#define HDMI_STA_SW_RST …
#define HDMI_AUD_CFG_8CH …
#define HDMI_AUD_CFG_SPDIF_DIV_2 …
#define HDMI_AUD_CFG_SPDIF_DIV_3 …
#define HDMI_AUD_CFG_SPDIF_CLK_DIV_4 …
#define HDMI_AUD_CFG_CTS_CLK_256FS …
#define HDMI_AUD_CFG_DTS_INVALID …
#define HDMI_AUD_CFG_ONE_BIT_INVALID …
#define HDMI_AUD_CFG_CH12_VALID …
#define HDMI_AUD_CFG_CH34_VALID …
#define HDMI_AUD_CFG_CH56_VALID …
#define HDMI_AUD_CFG_CH78_VALID …
#define HDMI_SAMPLE_FLAT_NO …
#define HDMI_SAMPLE_FLAT_SP0 …
#define HDMI_SAMPLE_FLAT_SP1 …
#define HDMI_SAMPLE_FLAT_SP2 …
#define HDMI_SAMPLE_FLAT_SP3 …
#define HDMI_SAMPLE_FLAT_ALL …
#define HDMI_INFOFRAME_HEADER_TYPE(x) …
#define HDMI_INFOFRAME_HEADER_VERSION(x) …
#define HDMI_INFOFRAME_HEADER_LEN(x) …
struct sti_hdmi_connector { … };
#define to_sti_hdmi_connector(x) …
static const struct drm_prop_enum_list colorspace_mode_names[] = …;
u32 hdmi_read(struct sti_hdmi *hdmi, int offset)
{ … }
void hdmi_write(struct sti_hdmi *hdmi, u32 val, int offset)
{ … }
static irqreturn_t hdmi_irq_thread(int irq, void *arg)
{ … }
static irqreturn_t hdmi_irq(int irq, void *arg)
{ … }
static void hdmi_active_area(struct sti_hdmi *hdmi)
{ … }
static void hdmi_config(struct sti_hdmi *hdmi)
{ … }
static void hdmi_infoframe_reset(struct sti_hdmi *hdmi,
u32 slot)
{ … }
static inline unsigned int hdmi_infoframe_subpack(const u8 *ptr, size_t size)
{ … }
static void hdmi_infoframe_write_infopack(struct sti_hdmi *hdmi,
const u8 *data,
size_t size)
{ … }
static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi)
{ … }
static int hdmi_audio_infoframe_config(struct sti_hdmi *hdmi)
{ … }
#define HDMI_VENDOR_INFOFRAME_MAX_SIZE …
static int hdmi_vendor_infoframe_config(struct sti_hdmi *hdmi)
{ … }
#define HDMI_TIMEOUT_SWRESET …
static void hdmi_swreset(struct sti_hdmi *hdmi)
{ … }
#define DBGFS_PRINT_STR(str1, str2) …
#define DBGFS_PRINT_INT(str1, int2) …
#define DBGFS_DUMP(str, reg) …
#define DBGFS_DUMP_DI(reg, slot) …
static void hdmi_dbg_cfg(struct seq_file *s, int val)
{ … }
static void hdmi_dbg_sta(struct seq_file *s, int val)
{ … }
static void hdmi_dbg_sw_di_cfg(struct seq_file *s, int val)
{ … }
static int hdmi_dbg_show(struct seq_file *s, void *data)
{ … }
static struct drm_info_list hdmi_debugfs_files[] = …;
static void hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_minor *minor)
{ … }
static void sti_hdmi_disable(struct drm_bridge *bridge)
{ … }
static int sti_hdmi_audio_get_non_coherent_n(unsigned int audio_fs)
{ … }
static int hdmi_audio_configure(struct sti_hdmi *hdmi)
{ … }
static void sti_hdmi_pre_enable(struct drm_bridge *bridge)
{ … }
static void sti_hdmi_set_mode(struct drm_bridge *bridge,
const struct drm_display_mode *mode,
const struct drm_display_mode *adjusted_mode)
{ … }
static void sti_hdmi_bridge_nope(struct drm_bridge *bridge)
{ … }
static const struct drm_bridge_funcs sti_hdmi_bridge_funcs = …;
static int sti_hdmi_connector_get_modes(struct drm_connector *connector)
{ … }
#define CLK_TOLERANCE_HZ …
static enum drm_mode_status
sti_hdmi_connector_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{ … }
static const
struct drm_connector_helper_funcs sti_hdmi_connector_helper_funcs = …;
static enum drm_connector_status
sti_hdmi_connector_detect(struct drm_connector *connector, bool force)
{ … }
static void sti_hdmi_connector_init_property(struct drm_device *drm_dev,
struct drm_connector *connector)
{ … }
static int
sti_hdmi_connector_set_property(struct drm_connector *connector,
struct drm_connector_state *state,
struct drm_property *property,
uint64_t val)
{ … }
static int
sti_hdmi_connector_get_property(struct drm_connector *connector,
const struct drm_connector_state *state,
struct drm_property *property,
uint64_t *val)
{ … }
static int sti_hdmi_late_register(struct drm_connector *connector)
{ … }
static const struct drm_connector_funcs sti_hdmi_connector_funcs = …;
static struct drm_encoder *sti_hdmi_find_encoder(struct drm_device *dev)
{ … }
static void hdmi_audio_shutdown(struct device *dev, void *data)
{ … }
static int hdmi_audio_hw_params(struct device *dev,
void *data,
struct hdmi_codec_daifmt *daifmt,
struct hdmi_codec_params *params)
{ … }
static int hdmi_audio_mute(struct device *dev, void *data,
bool enable, int direction)
{ … }
static int hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf, size_t len)
{ … }
static const struct hdmi_codec_ops audio_codec_ops = …;
static int sti_hdmi_register_audio_driver(struct device *dev,
struct sti_hdmi *hdmi)
{ … }
static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
{ … }
static void sti_hdmi_unbind(struct device *dev,
struct device *master, void *data)
{ … }
static const struct component_ops sti_hdmi_ops = …;
static const struct of_device_id hdmi_of_match[] = …;
MODULE_DEVICE_TABLE(of, hdmi_of_match);
static int sti_hdmi_probe(struct platform_device *pdev)
{ … }
static void sti_hdmi_remove(struct platform_device *pdev)
{ … }
struct platform_driver sti_hdmi_driver = …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;