media: platform: vicap: get dsi cmd or video mode from sensor

Change-Id: I8a436399932468a0b4135c8fc27e3b9aacfe059e
Signed-off-by: Jianwei Fan <jianwei.fan@rock-chips.com>
This commit is contained in:
Jianwei Fan 2023-12-04 09:43:00 +00:00 committed by Zefa Chen
commit 7d65dab0e2
3 changed files with 25 additions and 1 deletions

View file

@ -3526,7 +3526,7 @@ static int rkcif_csi_channel_init(struct rkcif_stream *stream,
channel->fmt_val = stream->cif_fmt_out->csi_fmt_val;
channel->cmd_mode_en = 0; /* default use DSI Video Mode */
channel->cmd_mode_en = dev->terminal_sensor.dsi_mode;; /* default use DSI Video Mode */
channel->dsi_input = dev->terminal_sensor.dsi_input_en;
if (stream->crop_enable) {
@ -6100,6 +6100,17 @@ int rkcif_update_sensor_info(struct rkcif_stream *stream)
__func__, terminal_sensor->sd->name);
terminal_sensor->dsi_input_en = 0;
}
if (terminal_sensor->dsi_input_en) {
if (v4l2_subdev_call(terminal_sensor->sd, core, ioctl,
RKMODULE_GET_DSI_MODE, &terminal_sensor->dsi_mode)) {
v4l2_dbg(1, rkcif_debug, &stream->cifdev->v4l2_dev,
"%s: get terminal %s DSI mode failed, set video mode!\n",
__func__, terminal_sensor->sd->name);
terminal_sensor->dsi_mode = 0;
}
} else {
terminal_sensor->dsi_mode = 0;
}
} else {
v4l2_err(&stream->cifdev->v4l2_dev,
"%s: stream[%d] get remote terminal sensor failed!\n",

View file

@ -226,6 +226,7 @@ struct rkcif_sensor_info {
struct v4l2_rect raw_rect;
struct v4l2_subdev_selection selection;
int dsi_input_en;
int dsi_mode;
};
enum cif_fmt_type {
@ -291,6 +292,7 @@ struct csi_channel_info {
unsigned int crop_st_x;
unsigned int crop_st_y;
unsigned int dsi_input;
unsigned int dsi_mode;
struct rkmodule_lvds_cfg lvds_cfg;
struct rkmodule_capture_info capture_info;
};

View file

@ -186,6 +186,9 @@
#define RKMODULE_GET_SKIP_FRAME \
_IOR('V', BASE_VIDIOC_PRIVATE + 41, __u32)
#define RKMODULE_GET_DSI_MODE \
_IOR('V', BASE_VIDIOC_PRIVATE + 42, __u32)
struct rkmodule_i2cdev_info {
__u8 slave_addr;
} __attribute__ ((packed));
@ -454,6 +457,14 @@ enum rkmodule_csi_dsi_seq {
RKMODULE_DSI_INPUT,
};
/*
* DSI input mode
*/
enum rkmodule_dsi_mode {
RKMODULE_DSI_VIDEO = 0,
RKMODULE_DSI_COMMAND,
};
/**
* lcnt: line counter
* padnum: the pixels of padding row