#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <media/media-entity.h>
#include <media/v4l2-async.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <media/v4l2-subdev.h>
#define TW9900_REG_CHIP_ID …
#define TW9900_REG_CHIP_STATUS …
#define TW9900_REG_CHIP_STATUS_VDLOSS …
#define TW9900_REG_CHIP_STATUS_HLOCK …
#define TW9900_REG_OUT_FMT_CTL …
#define TW9900_REG_OUT_FMT_CTL_STANDBY …
#define TW9900_REG_OUT_FMT_CTL_STREAMING …
#define TW9900_REG_CKHY_HSDLY …
#define TW9900_REG_OUT_CTRL_I …
#define TW9900_REG_ANALOG_CTL …
#define TW9900_REG_CROP_HI …
#define TW9900_REG_VDELAY_LO …
#define TW9900_REG_VACTIVE_LO …
#define TW9900_REG_HACTIVE_LO …
#define TW9900_REG_CNTRL1 …
#define TW9900_REG_BRIGHT_CTL …
#define TW9900_REG_CONTRAST_CTL …
#define TW9900_REG_VBI_CNTL …
#define TW9900_REG_ANAL_CTL_II …
#define TW9900_REG_OUT_CTRL_II …
#define TW9900_REG_STD …
#define TW9900_REG_STD_AUTO_PROGRESS …
#define TW9900_STDNOW_MASK …
#define TW9900_REG_STDR …
#define TW9900_REG_MISSCNT …
#define TW9900_REG_MISC_CTL_II …
#define TW9900_REG_VVBI …
#define TW9900_CHIP_ID …
#define TW9900_STD_NTSC_M …
#define TW9900_STD_PAL_BDGHI …
#define TW9900_STD_AUTO …
#define TW9900_VIDEO_POLL_TRIES …
struct regval { … };
struct tw9900_mode { … };
struct tw9900 { … };
#define to_tw9900(sd) …
static const struct regval tw9900_init_regs[] = …;
static const struct regval tw9900_pal_regs[] = …;
static const struct regval tw9900_ntsc_regs[] = …;
static const struct tw9900_mode supported_modes[] = …;
static int tw9900_write_reg(struct i2c_client *client, u8 reg, u8 val)
{ … }
static int tw9900_write_array(struct i2c_client *client,
const struct regval *regs, int n_regs)
{ … }
static int tw9900_read_reg(struct i2c_client *client, u8 reg)
{ … }
static void tw9900_fill_fmt(const struct tw9900_mode *mode,
struct v4l2_mbus_framefmt *fmt)
{ … }
static int tw9900_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
static int tw9900_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
static int tw9900_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{ … }
static int tw9900_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static int tw9900_s_stream(struct v4l2_subdev *sd, int on)
{ … }
static int tw9900_subscribe_event(struct v4l2_subdev *sd,
struct v4l2_fh *fh,
struct v4l2_event_subscription *sub)
{ … }
static int tw9900_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
{ … }
static int tw9900_get_stream_std(struct tw9900 *tw9900,
v4l2_std_id *std)
{ … }
static int tw9900_g_std(struct v4l2_subdev *sd, v4l2_std_id *std)
{ … }
static int tw9900_start_autodetect(struct tw9900 *tw9900)
{ … }
static int tw9900_detect_done(struct tw9900 *tw9900, bool *done)
{ … }
static int tw9900_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
{ … }
static int tw9900_g_tvnorms(struct v4l2_subdev *sd, v4l2_std_id *std)
{ … }
static int tw9900_g_input_status(struct v4l2_subdev *sd, u32 *status)
{ … }
static const struct v4l2_subdev_core_ops tw9900_core_ops = …;
static const struct v4l2_subdev_video_ops tw9900_video_ops = …;
static const struct v4l2_subdev_pad_ops tw9900_pad_ops = …;
static const struct v4l2_subdev_ops tw9900_subdev_ops = …;
static const struct v4l2_ctrl_ops tw9900_ctrl_ops = …;
static int tw9900_check_id(struct tw9900 *tw9900,
struct i2c_client *client)
{ … }
static int tw9900_runtime_resume(struct device *dev)
{ … }
static int tw9900_runtime_suspend(struct device *dev)
{ … }
static int tw9900_probe(struct i2c_client *client)
{ … }
static void tw9900_remove(struct i2c_client *client)
{ … }
static const struct dev_pm_ops tw9900_pm_ops = …;
static const struct i2c_device_id tw9900_id[] = …;
MODULE_DEVICE_TABLE(i2c, tw9900_id);
static const struct of_device_id tw9900_of_match[] = …;
MODULE_DEVICE_TABLE(of, tw9900_of_match);
static struct i2c_driver tw9900_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;