#include <linux/gpio/consumer.h>
#include <linux/i2c-mux.h>
#include <linux/i2c.h>
#include <linux/media-bus-format.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/clk.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
#include <drm/drm_drv.h>
#include <drm/drm_edid.h>
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>
#include <sound/hdmi-codec.h>
#define SII902X_TPI_VIDEO_DATA …
#define SII902X_TPI_PIXEL_REPETITION …
#define SII902X_TPI_AVI_PIXEL_REP_BUS_24BIT …
#define SII902X_TPI_AVI_PIXEL_REP_RISING_EDGE …
#define SII902X_TPI_AVI_PIXEL_REP_4X …
#define SII902X_TPI_AVI_PIXEL_REP_2X …
#define SII902X_TPI_AVI_PIXEL_REP_NONE …
#define SII902X_TPI_CLK_RATIO_HALF …
#define SII902X_TPI_CLK_RATIO_1X …
#define SII902X_TPI_CLK_RATIO_2X …
#define SII902X_TPI_CLK_RATIO_4X …
#define SII902X_TPI_AVI_IN_FORMAT …
#define SII902X_TPI_AVI_INPUT_BITMODE_12BIT …
#define SII902X_TPI_AVI_INPUT_DITHER …
#define SII902X_TPI_AVI_INPUT_RANGE_LIMITED …
#define SII902X_TPI_AVI_INPUT_RANGE_FULL …
#define SII902X_TPI_AVI_INPUT_RANGE_AUTO …
#define SII902X_TPI_AVI_INPUT_COLORSPACE_BLACK …
#define SII902X_TPI_AVI_INPUT_COLORSPACE_YUV422 …
#define SII902X_TPI_AVI_INPUT_COLORSPACE_YUV444 …
#define SII902X_TPI_AVI_INPUT_COLORSPACE_RGB …
#define SII902X_TPI_AVI_INFOFRAME …
#define SII902X_SYS_CTRL_DATA …
#define SII902X_SYS_CTRL_PWR_DWN …
#define SII902X_SYS_CTRL_AV_MUTE …
#define SII902X_SYS_CTRL_DDC_BUS_REQ …
#define SII902X_SYS_CTRL_DDC_BUS_GRTD …
#define SII902X_SYS_CTRL_OUTPUT_MODE …
#define SII902X_SYS_CTRL_OUTPUT_HDMI …
#define SII902X_SYS_CTRL_OUTPUT_DVI …
#define SII902X_REG_CHIPID(n) …
#define SII902X_PWR_STATE_CTRL …
#define SII902X_AVI_POWER_STATE_MSK …
#define SII902X_AVI_POWER_STATE_D(l) …
#define SII902X_TPI_I2S_ENABLE_MAPPING_REG …
#define SII902X_TPI_I2S_CONFIG_FIFO0 …
#define SII902X_TPI_I2S_CONFIG_FIFO1 …
#define SII902X_TPI_I2S_CONFIG_FIFO2 …
#define SII902X_TPI_I2S_CONFIG_FIFO3 …
#define SII902X_TPI_I2S_LEFT_RIGHT_SWAP …
#define SII902X_TPI_I2S_AUTO_DOWNSAMPLE …
#define SII902X_TPI_I2S_SELECT_SD0 …
#define SII902X_TPI_I2S_SELECT_SD1 …
#define SII902X_TPI_I2S_SELECT_SD2 …
#define SII902X_TPI_I2S_SELECT_SD3 …
#define SII902X_TPI_I2S_FIFO_ENABLE …
#define SII902X_TPI_I2S_INPUT_CONFIG_REG …
#define SII902X_TPI_I2S_FIRST_BIT_SHIFT_YES …
#define SII902X_TPI_I2S_FIRST_BIT_SHIFT_NO …
#define SII902X_TPI_I2S_SD_DIRECTION_MSB_FIRST …
#define SII902X_TPI_I2S_SD_DIRECTION_LSB_FIRST …
#define SII902X_TPI_I2S_SD_JUSTIFY_LEFT …
#define SII902X_TPI_I2S_SD_JUSTIFY_RIGHT …
#define SII902X_TPI_I2S_WS_POLARITY_LOW …
#define SII902X_TPI_I2S_WS_POLARITY_HIGH …
#define SII902X_TPI_I2S_MCLK_MULTIPLIER_128 …
#define SII902X_TPI_I2S_MCLK_MULTIPLIER_256 …
#define SII902X_TPI_I2S_MCLK_MULTIPLIER_384 …
#define SII902X_TPI_I2S_MCLK_MULTIPLIER_512 …
#define SII902X_TPI_I2S_MCLK_MULTIPLIER_768 …
#define SII902X_TPI_I2S_MCLK_MULTIPLIER_1024 …
#define SII902X_TPI_I2S_MCLK_MULTIPLIER_1152 …
#define SII902X_TPI_I2S_MCLK_MULTIPLIER_192 …
#define SII902X_TPI_I2S_SCK_EDGE_FALLING …
#define SII902X_TPI_I2S_SCK_EDGE_RISING …
#define SII902X_TPI_I2S_STRM_HDR_BASE …
#define SII902X_TPI_I2S_STRM_HDR_SIZE …
#define SII902X_TPI_AUDIO_CONFIG_BYTE2_REG …
#define SII902X_TPI_AUDIO_CODING_STREAM_HEADER …
#define SII902X_TPI_AUDIO_CODING_PCM …
#define SII902X_TPI_AUDIO_CODING_AC3 …
#define SII902X_TPI_AUDIO_CODING_MPEG1 …
#define SII902X_TPI_AUDIO_CODING_MP3 …
#define SII902X_TPI_AUDIO_CODING_MPEG2 …
#define SII902X_TPI_AUDIO_CODING_AAC …
#define SII902X_TPI_AUDIO_CODING_DTS …
#define SII902X_TPI_AUDIO_CODING_ATRAC …
#define SII902X_TPI_AUDIO_MUTE_DISABLE …
#define SII902X_TPI_AUDIO_MUTE_ENABLE …
#define SII902X_TPI_AUDIO_LAYOUT_2_CHANNELS …
#define SII902X_TPI_AUDIO_LAYOUT_8_CHANNELS …
#define SII902X_TPI_AUDIO_INTERFACE_DISABLE …
#define SII902X_TPI_AUDIO_INTERFACE_SPDIF …
#define SII902X_TPI_AUDIO_INTERFACE_I2S …
#define SII902X_TPI_AUDIO_CONFIG_BYTE3_REG …
#define SII902X_TPI_AUDIO_FREQ_STREAM …
#define SII902X_TPI_AUDIO_FREQ_32KHZ …
#define SII902X_TPI_AUDIO_FREQ_44KHZ …
#define SII902X_TPI_AUDIO_FREQ_48KHZ …
#define SII902X_TPI_AUDIO_FREQ_88KHZ …
#define SII902X_TPI_AUDIO_FREQ_96KHZ …
#define SII902X_TPI_AUDIO_FREQ_176KHZ …
#define SII902X_TPI_AUDIO_FREQ_192KHZ …
#define SII902X_TPI_AUDIO_SAMPLE_SIZE_STREAM …
#define SII902X_TPI_AUDIO_SAMPLE_SIZE_16 …
#define SII902X_TPI_AUDIO_SAMPLE_SIZE_20 …
#define SII902X_TPI_AUDIO_SAMPLE_SIZE_24 …
#define SII902X_TPI_AUDIO_CONFIG_BYTE4_REG …
#define SII902X_INT_ENABLE …
#define SII902X_INT_STATUS …
#define SII902X_HOTPLUG_EVENT …
#define SII902X_PLUGGED_STATUS …
#define SII902X_REG_TPI_RQB …
#define SII902X_IND_SET_PAGE …
#define SII902X_IND_OFFSET …
#define SII902X_IND_VALUE …
#define SII902X_TPI_MISC_INFOFRAME_BASE …
#define SII902X_TPI_MISC_INFOFRAME_END …
#define SII902X_TPI_MISC_INFOFRAME_SIZE …
#define SII902X_I2C_BUS_ACQUISITION_TIMEOUT_MS …
#define SII902X_AUDIO_PORT_INDEX …
#define SII902X_MIN_PIXEL_CLOCK_KHZ …
#define SII902X_MAX_PIXEL_CLOCK_KHZ …
struct sii902x { … };
static int sii902x_read_unlocked(struct i2c_client *i2c, u8 reg, u8 *val)
{ … }
static int sii902x_write_unlocked(struct i2c_client *i2c, u8 reg, u8 val)
{ … }
static int sii902x_update_bits_unlocked(struct i2c_client *i2c, u8 reg, u8 mask,
u8 val)
{ … }
static inline struct sii902x *bridge_to_sii902x(struct drm_bridge *bridge)
{ … }
static inline struct sii902x *connector_to_sii902x(struct drm_connector *con)
{ … }
static void sii902x_reset(struct sii902x *sii902x)
{ … }
static enum drm_connector_status sii902x_detect(struct sii902x *sii902x)
{ … }
static enum drm_connector_status
sii902x_connector_detect(struct drm_connector *connector, bool force)
{ … }
static const struct drm_connector_funcs sii902x_connector_funcs = …;
static const struct drm_edid *sii902x_edid_read(struct sii902x *sii902x,
struct drm_connector *connector)
{ … }
static int sii902x_get_modes(struct drm_connector *connector)
{ … }
static const struct drm_connector_helper_funcs sii902x_connector_helper_funcs = …;
static void sii902x_bridge_atomic_disable(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state)
{ … }
static void sii902x_bridge_atomic_enable(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state)
{ … }
static void sii902x_bridge_mode_set(struct drm_bridge *bridge,
const struct drm_display_mode *mode,
const struct drm_display_mode *adj)
{ … }
static int sii902x_bridge_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
{ … }
static enum drm_connector_status sii902x_bridge_detect(struct drm_bridge *bridge)
{ … }
static const struct drm_edid *sii902x_bridge_edid_read(struct drm_bridge *bridge,
struct drm_connector *connector)
{ … }
static u32 *sii902x_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
struct drm_bridge_state *bridge_state,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state,
u32 output_fmt,
unsigned int *num_input_fmts)
{ … }
static int sii902x_bridge_atomic_check(struct drm_bridge *bridge,
struct drm_bridge_state *bridge_state,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state)
{ … }
static enum drm_mode_status
sii902x_bridge_mode_valid(struct drm_bridge *bridge,
const struct drm_display_info *info,
const struct drm_display_mode *mode)
{ … }
static const struct drm_bridge_funcs sii902x_bridge_funcs = …;
static int sii902x_mute(struct sii902x *sii902x, bool mute)
{ … }
static const int sii902x_mclk_div_table[] = …;
static int sii902x_select_mclk_div(u8 *i2s_config_reg, unsigned int rate,
unsigned int mclk)
{ … }
static const struct sii902x_sample_freq { … } sii902x_sample_freq[] = …;
static int sii902x_audio_hw_params(struct device *dev, void *data,
struct hdmi_codec_daifmt *daifmt,
struct hdmi_codec_params *params)
{ … }
static void sii902x_audio_shutdown(struct device *dev, void *data)
{ … }
static int sii902x_audio_mute(struct device *dev, void *data,
bool enable, int direction)
{ … }
static int sii902x_audio_get_eld(struct device *dev, void *data,
uint8_t *buf, size_t len)
{ … }
static int sii902x_audio_get_dai_id(struct snd_soc_component *component,
struct device_node *endpoint)
{ … }
static const struct hdmi_codec_ops sii902x_audio_codec_ops = …;
static int sii902x_audio_codec_init(struct sii902x *sii902x,
struct device *dev)
{ … }
static const struct regmap_range sii902x_volatile_ranges[] = …;
static const struct regmap_access_table sii902x_volatile_table = …;
static const struct regmap_config sii902x_regmap_config = …;
static irqreturn_t sii902x_interrupt(int irq, void *data)
{ … }
static int sii902x_i2c_bypass_select(struct i2c_mux_core *mux, u32 chan_id)
{ … }
static int sii902x_i2c_bypass_deselect(struct i2c_mux_core *mux, u32 chan_id)
{ … }
static const struct drm_bridge_timings default_sii902x_timings = …;
static int sii902x_init(struct sii902x *sii902x)
{ … }
static int sii902x_probe(struct i2c_client *client)
{ … }
static void sii902x_remove(struct i2c_client *client)
{ … }
static const struct of_device_id sii902x_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, sii902x_dt_ids);
static const struct i2c_device_id sii902x_i2c_ids[] = …;
MODULE_DEVICE_TABLE(i2c, sii902x_i2c_ids);
static struct i2c_driver sii902x_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;