/* horizontal-timings from sensor */
#define OV5670_REG_HTS 0x380c
-#define OV5670_DEF_PPL 3360 /* Default pixels per line */
+
+/*
+ * Pixels-per-line(PPL) = Time-per-line * pixel-rate
+ * In OV5670, Time-per-line = HTS/SCLK.
+ * HTS is fixed for all resolutions, not recommended to change.
+ */
+#define OV5670_FIXED_PPL 2724 /* Pixels per line */
/* Exposure controls from sensor */
#define OV5670_REG_EXPOSURE 0x3500
};
/* Supported link frequencies */
-#define OV5670_LINK_FREQ_420MHZ 420000000
-#define OV5670_LINK_FREQ_420MHZ_INDEX 0
+#define OV5670_LINK_FREQ_422MHZ 422400000
+#define OV5670_LINK_FREQ_422MHZ_INDEX 0
static const struct ov5670_link_freq_config link_freq_configs[] = {
{
/* pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample */
- .pixel_rate = (OV5670_LINK_FREQ_420MHZ * 2 * 2) / 10,
+ .pixel_rate = (OV5670_LINK_FREQ_422MHZ * 2 * 2) / 10,
.reg_list = {
.num_of_regs = ARRAY_SIZE(mipi_data_rate_840mbps),
.regs = mipi_data_rate_840mbps,
};
static const s64 link_freq_menu_items[] = {
- OV5670_LINK_FREQ_420MHZ
+ OV5670_LINK_FREQ_422MHZ
};
/*
.num_of_regs = ARRAY_SIZE(mode_2592x1944_regs),
.regs = mode_2592x1944_regs,
},
- .link_freq_index = OV5670_LINK_FREQ_420MHZ_INDEX,
+ .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX,
},
{
.width = 1296,
.num_of_regs = ARRAY_SIZE(mode_1296x972_regs),
.regs = mode_1296x972_regs,
},
- .link_freq_index = OV5670_LINK_FREQ_420MHZ_INDEX,
+ .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX,
},
{
.width = 648,
.num_of_regs = ARRAY_SIZE(mode_648x486_regs),
.regs = mode_648x486_regs,
},
- .link_freq_index = OV5670_LINK_FREQ_420MHZ_INDEX,
+ .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX,
},
{
.width = 2560,
.num_of_regs = ARRAY_SIZE(mode_2560x1440_regs),
.regs = mode_2560x1440_regs,
},
- .link_freq_index = OV5670_LINK_FREQ_420MHZ_INDEX,
+ .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX,
},
{
.width = 1280,
.num_of_regs = ARRAY_SIZE(mode_1280x720_regs),
.regs = mode_1280x720_regs,
},
- .link_freq_index = OV5670_LINK_FREQ_420MHZ_INDEX,
+ .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX,
},
{
.width = 640,
.num_of_regs = ARRAY_SIZE(mode_640x360_regs),
.regs = mode_640x360_regs,
},
- .link_freq_index = OV5670_LINK_FREQ_420MHZ_INDEX,
+ .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX,
}
};
OV5670_REG_VALUE_16BIT,
ov5670->cur_mode->height + ctrl->val);
break;
- case V4L2_CID_HBLANK:
- /* Update HTS that meets expected horizontal blanking */
- ret = ov5670_write_reg(ov5670, OV5670_REG_HTS,
- OV5670_REG_VALUE_16BIT,
- (ov5670->cur_mode->width +
- ctrl->val) / 2);
- break;
case V4L2_CID_TEST_PATTERN:
ret = ov5670_enable_test_pattern(ov5670, ctrl->val);
break;
ov5670->hblank = v4l2_ctrl_new_std(
ctrl_hdlr, &ov5670_ctrl_ops, V4L2_CID_HBLANK,
- OV5670_DEF_PPL - ov5670->cur_mode->width,
- OV5670_DEF_PPL - ov5670->cur_mode->width, 1,
- OV5670_DEF_PPL - ov5670->cur_mode->width);
+ OV5670_FIXED_PPL - ov5670->cur_mode->width,
+ OV5670_FIXED_PPL - ov5670->cur_mode->width, 1,
+ OV5670_FIXED_PPL - ov5670->cur_mode->width);
+ if (ov5670->hblank)
+ ov5670->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
/* Get min, max, step, default from sensor */
v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops, V4L2_CID_ANALOGUE_GAIN,
OV5670_VTS_MAX - ov5670->cur_mode->height, 1,
vblank_def);
__v4l2_ctrl_s_ctrl(ov5670->vblank, vblank_def);
- h_blank = OV5670_DEF_PPL - ov5670->cur_mode->width;
+ h_blank = OV5670_FIXED_PPL - ov5670->cur_mode->width;
__v4l2_ctrl_modify_range(ov5670->hblank, h_blank, h_blank, 1,
h_blank);
}