add(media): add mipi switch and sensor sc202cs. [MIPI_SWITCH][CAMERA_V1.2]

This commit is contained in:
kangjun
2024-12-27 20:12:08 +08:00
parent fb4f7b3baf
commit a2ba6d78f2
32 changed files with 11557 additions and 182 deletions

View File

@@ -140,6 +140,10 @@ config SENSOR_SC2355_MIPI
tristate "use sc2355_mipi driver"
default n
config SENSOR_SC2356_MIPI
tristate "use sc2356_mipi driver"
default n
config SENSOR_SC031GS_MIPI
tristate "use sc031gs_mipi driver"
default n

View File

@@ -28,6 +28,7 @@ obj-$(CONFIG_SENSOR_GC5603_MIPI) += gc5603_mipi.o
obj-$(CONFIG_SENSOR_GC02M1_MIPI) += gc02m1_mipi.o
obj-$(CONFIG_SENSOR_SC2336_MIPI) += sc1346_mipi.o
obj-$(CONFIG_SENSOR_SC2336_MIPI) += sc2336_mipi.o
obj-$(CONFIG_SENSOR_SC2356_MIPI) += sc2356_mipi.o
obj-$(CONFIG_SENSOR_SC2232_MIPI) += sc2232_mipi.o
obj-$(CONFIG_SENSOR_SC5336_MIPI) += sc5336_mipi.o
obj-$(CONFIG_SENSOR_SC2355_MIPI) += sc2355_mipi.o

View File

@@ -143,6 +143,7 @@ struct sensor_info {
unsigned int act_fps;
void (*sensor_fps_chenge_callback)(int act_fps);
struct sensor_vysnc_config sensor_vysnc_cfg;
unsigned int isp_id[2];
};
#endif /*__CAMERA__H__*/

View File

@@ -43,6 +43,8 @@ typedef enum tag_CAMERA_IO_CMD {
GET_SENSOR_OUTPUT_BIT_WIDTH,
SET_SENSOR_OUTPUT_BIT_WIDTH,
SET_SWITCH_CHANGE,
SET_HFLIP,
SET_VFLIP,
} __camera_cmd_t;
struct sensor_exif_attribute {

File diff suppressed because it is too large Load Diff

View File

@@ -2584,6 +2584,10 @@ static int __vin_s_input(struct vin_core *vinc, unsigned int i)
vinc->exp_gain.exp_val = info->exp;
vinc->exp_gain.gain_val = info->gain;
vinc->stream_idx = info->stream_seq + 2;
/*check link of isp and mipi-vc when mipi-vc enable*/
if ((vinc->csi_ch != 0xff) && (vinc->csi_ch & 0x10)) {
info->isp_id[vinc->csi_ch & 0xf] = vinc->isp_sel;
}
}
if (cap->pipe.sd[VIN_IND_MIPI] != NULL) {
@@ -4309,8 +4313,28 @@ int sensor_flip_option(struct vin_vid_cap *cap, struct v4l2_control c)
int input_seq;
int sensor_fmt_code;
int ret, i;
struct sensor_vc_flip sensor_set_flip;
/*It need sent isp_id to sensor when enable mipi-vc, so filp cmd
* need to sent by v4l2_subdev_call not v4l2_s_ctrl*/
if ((cap->vinc->csi_ch != 0xff) && (cap->vinc->csi_ch & 0x10)) {
sensor_set_flip.isp_id = cap->vinc->isp_sel;
sensor_set_flip.value = c.value;
switch (c.id) {
case V4L2_CID_VFLIP:
ret = v4l2_subdev_call(sensor, core,
ioctl, SET_VFLIP, &sensor_set_flip);
break;
case V4L2_CID_HFLIP:
ret = v4l2_subdev_call(sensor, core,
ioctl, SET_HFLIP, &sensor_set_flip);
break;
}
} else {
/*not mipi-vc mode*/
ret = v4l2_s_ctrl(NULL, sensor->ctrl_handler, &c);
}
ret = v4l2_s_ctrl(NULL, sensor->ctrl_handler, &c);
ret = v4l2_subdev_call(sensor, core, ioctl, VIDIOC_VIN_GET_SENSOR_CODE, &sensor_fmt_code);
if (ret < 0) {
vin_err("get sensor mbus code fail");

View File

@@ -1029,8 +1029,9 @@ static int __vin_pipeline_s_stream(struct vin_pipeline *p, int on_idx)
else
vin_warn("large image mode not support isp%d\n", vinc->isp_sel);
} else {
if ((vinc->csi_ch != 0xff) && (vinc->csi_ch & 0x10))
if ((vinc->csi_ch != 0xff) && (vinc->csi_ch & 0x10)){
csic_isp_input_select(vind->id, vinc->isp_sel/ISP_VIRT_NUM, vinc->isp_sel%ISP_VIRT_NUM + 0, vinc->csi_sel, vinc->csi_ch & 0xf);
}
else {
for (i = 0; i < vinc->total_rx_ch; i++)
csic_isp_input_select(vind->id, vinc->isp_sel/ISP_VIRT_NUM, vinc->isp_sel%ISP_VIRT_NUM + i, vinc->csi_sel, i);
@@ -1710,6 +1711,7 @@ static int vin_create_media_links(struct vin_md *vind)
vin_log(VIN_LOG_MD, "created link [%s] %c> [%s]\n",
source->name, '=', sink->name);
} else {
#if defined CONFIG_MIPI_VC
source = &csi->entity;
sink = &isp->entity;
ret = media_create_pad_link(source, SCALER_PAD_SOURCE,
@@ -1717,6 +1719,7 @@ static int vin_create_media_links(struct vin_md *vind)
MEDIA_LNK_FL_ENABLED);
vin_log(VIN_LOG_MD, "created link [%s] %c> [%s]\n",
source->name, '=', sink->name);
#endif
}
#endif
cap_sd = &vinc->vid_cap.subdev;
@@ -1753,7 +1756,7 @@ static int vin_create_media_links(struct vin_md *vind)
vin_log(VIN_LOG_MD, "created link [%s] %c> [%s]\n",
source->name, '=', sink->name);
}
#if !defined CONFIG_MIPI_VC
for (i = 0; i < VIN_MAX_CSI; i++) {
#ifdef SUPPORT_ISP_TDM
struct vin_core *vinc = NULL;
@@ -1780,7 +1783,7 @@ static int vin_create_media_links(struct vin_md *vind)
source->name, '-', sink->name);
}
}
#endif
for (i = 0; i < VIN_MAX_ISP; i++) {
isp = vind->isp[i].sd;
if (isp == NULL)