#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/timer.h>
#include <linux/of_graph.h>
#include <linux/videodev2.h>
#include <linux/workqueue.h>
#include <linux/v4l2-dv-timings.h>
#include <linux/hdmi.h>
#include <media/cec.h>
#include <media/v4l2-dv-timings.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
#include <media/i2c/tc358743.h>
#include "tc358743_regs.h"
static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
#define EDID_NUM_BLOCKS_MAX …
#define EDID_BLOCK_SIZE …
#define I2C_MAX_XFER_SIZE …
#define POLL_INTERVAL_CEC_MS …
#define POLL_INTERVAL_MS …
static const struct v4l2_dv_timings_cap tc358743_timings_cap = …;
struct tc358743_state { … };
static void tc358743_enable_interrupts(struct v4l2_subdev *sd,
bool cable_connected);
static int tc358743_s_ctrl_detect_tx_5v(struct v4l2_subdev *sd);
static inline struct tc358743_state *to_state(struct v4l2_subdev *sd)
{ … }
static void i2c_rd(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n)
{ … }
static void i2c_wr(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n)
{ … }
static noinline u32 i2c_rdreg(struct v4l2_subdev *sd, u16 reg, u32 n)
{ … }
static noinline void i2c_wrreg(struct v4l2_subdev *sd, u16 reg, u32 val, u32 n)
{ … }
static u8 i2c_rd8(struct v4l2_subdev *sd, u16 reg)
{ … }
static void i2c_wr8(struct v4l2_subdev *sd, u16 reg, u8 val)
{ … }
static void i2c_wr8_and_or(struct v4l2_subdev *sd, u16 reg,
u8 mask, u8 val)
{ … }
static u16 i2c_rd16(struct v4l2_subdev *sd, u16 reg)
{ … }
static void i2c_wr16(struct v4l2_subdev *sd, u16 reg, u16 val)
{ … }
static void i2c_wr16_and_or(struct v4l2_subdev *sd, u16 reg, u16 mask, u16 val)
{ … }
static u32 i2c_rd32(struct v4l2_subdev *sd, u16 reg)
{ … }
static void i2c_wr32(struct v4l2_subdev *sd, u16 reg, u32 val)
{ … }
static inline bool is_hdmi(struct v4l2_subdev *sd)
{ … }
static inline bool tx_5v_power_present(struct v4l2_subdev *sd)
{ … }
static inline bool no_signal(struct v4l2_subdev *sd)
{ … }
static inline bool no_sync(struct v4l2_subdev *sd)
{ … }
static inline bool audio_present(struct v4l2_subdev *sd)
{ … }
static int get_audio_sampling_rate(struct v4l2_subdev *sd)
{ … }
static inline unsigned fps(const struct v4l2_bt_timings *t)
{ … }
static int tc358743_get_detected_timings(struct v4l2_subdev *sd,
struct v4l2_dv_timings *timings)
{ … }
static void tc358743_delayed_work_enable_hotplug(struct work_struct *work)
{ … }
static void tc358743_set_hdmi_hdcp(struct v4l2_subdev *sd, bool enable)
{ … }
static void tc358743_disable_edid(struct v4l2_subdev *sd)
{ … }
static void tc358743_enable_edid(struct v4l2_subdev *sd)
{ … }
static void tc358743_erase_bksv(struct v4l2_subdev *sd)
{ … }
static void print_avi_infoframe(struct v4l2_subdev *sd)
{ … }
static int tc358743_s_ctrl_detect_tx_5v(struct v4l2_subdev *sd)
{ … }
static int tc358743_s_ctrl_audio_sampling_rate(struct v4l2_subdev *sd)
{ … }
static int tc358743_s_ctrl_audio_present(struct v4l2_subdev *sd)
{ … }
static int tc358743_update_controls(struct v4l2_subdev *sd)
{ … }
static void tc358743_reset_phy(struct v4l2_subdev *sd)
{ … }
static void tc358743_reset(struct v4l2_subdev *sd, uint16_t mask)
{ … }
static inline void tc358743_sleep_mode(struct v4l2_subdev *sd, bool enable)
{ … }
static inline void enable_stream(struct v4l2_subdev *sd, bool enable)
{ … }
static void tc358743_set_pll(struct v4l2_subdev *sd)
{ … }
static void tc358743_set_ref_clk(struct v4l2_subdev *sd)
{ … }
static void tc358743_set_csi_color_space(struct v4l2_subdev *sd)
{ … }
static unsigned tc358743_num_csi_lanes_needed(struct v4l2_subdev *sd)
{ … }
static void tc358743_set_csi(struct v4l2_subdev *sd)
{ … }
static void tc358743_set_hdmi_phy(struct v4l2_subdev *sd)
{ … }
static void tc358743_set_hdmi_audio(struct v4l2_subdev *sd)
{ … }
static void tc358743_set_hdmi_info_frame_mode(struct v4l2_subdev *sd)
{ … }
static void tc358743_initial_setup(struct v4l2_subdev *sd)
{ … }
#ifdef CONFIG_VIDEO_TC358743_CEC
static int tc358743_cec_adap_enable(struct cec_adapter *adap, bool enable)
{ … }
static int tc358743_cec_adap_monitor_all_enable(struct cec_adapter *adap,
bool enable)
{ … }
static int tc358743_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr)
{ … }
static int tc358743_cec_adap_transmit(struct cec_adapter *adap, u8 attempts,
u32 signal_free_time, struct cec_msg *msg)
{ … }
static const struct cec_adap_ops tc358743_cec_adap_ops = …;
static void tc358743_cec_handler(struct v4l2_subdev *sd, u16 intstatus,
bool *handled)
{ … }
#endif
static void tc358743_format_change(struct v4l2_subdev *sd)
{ … }
static void tc358743_init_interrupts(struct v4l2_subdev *sd)
{ … }
static void tc358743_enable_interrupts(struct v4l2_subdev *sd,
bool cable_connected)
{ … }
static void tc358743_hdmi_audio_int_handler(struct v4l2_subdev *sd,
bool *handled)
{ … }
static void tc358743_csi_err_int_handler(struct v4l2_subdev *sd, bool *handled)
{ … }
static void tc358743_hdmi_misc_int_handler(struct v4l2_subdev *sd,
bool *handled)
{ … }
static void tc358743_hdmi_cbit_int_handler(struct v4l2_subdev *sd,
bool *handled)
{ … }
static void tc358743_hdmi_clk_int_handler(struct v4l2_subdev *sd, bool *handled)
{ … }
static void tc358743_hdmi_sys_int_handler(struct v4l2_subdev *sd, bool *handled)
{ … }
static int tc358743_log_status(struct v4l2_subdev *sd)
{ … }
#ifdef CONFIG_VIDEO_ADV_DEBUG
static void tc358743_print_register_map(struct v4l2_subdev *sd)
{ … }
static int tc358743_get_reg_size(u16 address)
{ … }
static int tc358743_g_register(struct v4l2_subdev *sd,
struct v4l2_dbg_register *reg)
{ … }
static int tc358743_s_register(struct v4l2_subdev *sd,
const struct v4l2_dbg_register *reg)
{ … }
#endif
static int tc358743_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
{ … }
static irqreturn_t tc358743_irq_handler(int irq, void *dev_id)
{ … }
static void tc358743_irq_poll_timer(struct timer_list *t)
{ … }
static void tc358743_work_i2c_poll(struct work_struct *work)
{ … }
static int tc358743_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
struct v4l2_event_subscription *sub)
{ … }
static int tc358743_g_input_status(struct v4l2_subdev *sd, u32 *status)
{ … }
static int tc358743_s_dv_timings(struct v4l2_subdev *sd, unsigned int pad,
struct v4l2_dv_timings *timings)
{ … }
static int tc358743_g_dv_timings(struct v4l2_subdev *sd, unsigned int pad,
struct v4l2_dv_timings *timings)
{ … }
static int tc358743_enum_dv_timings(struct v4l2_subdev *sd,
struct v4l2_enum_dv_timings *timings)
{ … }
static int tc358743_query_dv_timings(struct v4l2_subdev *sd, unsigned int pad,
struct v4l2_dv_timings *timings)
{ … }
static int tc358743_dv_timings_cap(struct v4l2_subdev *sd,
struct v4l2_dv_timings_cap *cap)
{ … }
static int tc358743_get_mbus_config(struct v4l2_subdev *sd,
unsigned int pad,
struct v4l2_mbus_config *cfg)
{ … }
static int tc358743_s_stream(struct v4l2_subdev *sd, int enable)
{ … }
static int tc358743_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{ … }
static int tc358743_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format)
{ … }
static int tc358743_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format)
{ … }
static int tc358743_g_edid(struct v4l2_subdev *sd,
struct v4l2_subdev_edid *edid)
{ … }
static int tc358743_s_edid(struct v4l2_subdev *sd,
struct v4l2_subdev_edid *edid)
{ … }
static const struct v4l2_subdev_core_ops tc358743_core_ops = …;
static const struct v4l2_subdev_video_ops tc358743_video_ops = …;
static const struct v4l2_subdev_pad_ops tc358743_pad_ops = …;
static const struct v4l2_subdev_ops tc358743_ops = …;
static const struct v4l2_ctrl_config tc358743_ctrl_audio_sampling_rate = …;
static const struct v4l2_ctrl_config tc358743_ctrl_audio_present = …;
#ifdef CONFIG_OF
static void tc358743_gpio_reset(struct tc358743_state *state)
{ … }
static int tc358743_probe_of(struct tc358743_state *state)
{ … }
#else
static inline int tc358743_probe_of(struct tc358743_state *state)
{
return -ENODEV;
}
#endif
static int tc358743_probe(struct i2c_client *client)
{ … }
static void tc358743_remove(struct i2c_client *client)
{ … }
static const struct i2c_device_id tc358743_id[] = …;
MODULE_DEVICE_TABLE(i2c, tc358743_id);
#if IS_ENABLED(CONFIG_OF)
static const struct of_device_id tc358743_of_match[] = …;
MODULE_DEVICE_TABLE(of, tc358743_of_match);
#endif
static struct i2c_driver tc358743_driver = …;
module_i2c_driver(…) …;