media: spi: rk1608: synchronize interface with preisp side

Change-Id: I7845e855e3377a41c3363683baca4587a387dc3c
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
This commit is contained in:
Hu Kejun
2019-05-29 19:10:05 +08:00
committed by Tao Huang
parent acb94a9e10
commit eaa7df72ab
4 changed files with 28 additions and 7 deletions

View File

@@ -583,9 +583,9 @@ static int rk1608_msg_set_output_size(struct rk1608_state *pdata,
msg->head.msg_head.type = id_msg_set_output_size_t;
msg->head.msg_head.id.camera_id = id;
msg->head.msg_head.mux.sync = 1;
msg->head.width = fmt_inf->mf.width;
msg->head.height = fmt_inf->mf.height;
msg->head.mipi_clk = pdata->dphy[id]->link_freqs;
msg->head.width = fmt_inf->hactive;
msg->head.height = fmt_inf->vactive;
msg->head.mipi_clk = 2 * pdata->dphy[id]->link_freqs;
msg->head.line_length_pclk = fmt_inf->htotal;
msg->head.frame_length_lines = fmt_inf->vtotal;
msg->head.mipi_lane = fmt_inf->mipi_lane;
@@ -978,6 +978,7 @@ static int rk1608_s_stream(struct v4l2_subdev *sd, int enable)
int ret;
struct rk1608_state *pdata = to_state(sd);
pdata->msg_num = 0;
if (enable) {
v4l2_subdev_call(pdata->sensor[sd->grp_id], core, s_power, enable);
ret = rk1608_stream_on(pdata);

View File

@@ -14,7 +14,7 @@
#include <linux/version.h>
#include "rk1608_dphy.h"
#define RK1608_VERSION KERNEL_VERSION(0, 0x01, 0x02)
#define RK1608_VERSION KERNEL_VERSION(0, 0x01, 0x03)
#define RK1608_OP_TRY_MAX 3
#define RK1608_OP_TRY_DELAY 10
@@ -225,7 +225,8 @@ struct msg_out_size_head {
u32 mipi_clk;
u16 line_length_pclk;
u16 frame_length_lines;
u8 mipi_lane;
u16 mipi_lane;
u16 reserved;
};
struct msg_set_output_size {

View File

@@ -123,7 +123,7 @@ static int rk1608_enum_mbus_code(struct v4l2_subdev *sd,
{
struct rk1608_dphy *pdata = to_state(sd);
if (code->index > pdata->fmt_inf_num)
if (code->index >= pdata->fmt_inf_num)
return -EINVAL;
code->code = pdata->fmt_inf[code->index].mf.code;
@@ -137,7 +137,7 @@ static int rk1608_enum_frame_sizes(struct v4l2_subdev *sd,
{
struct rk1608_dphy *pdata = to_state(sd);
if (fse->index > pdata->fmt_inf_num)
if (fse->index >= pdata->fmt_inf_num)
return -EINVAL;
if (fse->code != pdata->fmt_inf[fse->index].mf.code)
@@ -242,6 +242,12 @@ static int rk1608_g_frame_interval(struct v4l2_subdev *sd,
return 0;
}
static int rk1608_s_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_frame_interval *fi)
{
return 0;
}
static long rk1608_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct rk1608_dphy *pdata = to_state(sd);
@@ -458,6 +464,7 @@ static const struct v4l2_subdev_internal_ops dphy_subdev_internal_ops = {
static const struct v4l2_subdev_video_ops rk1608_subdev_video_ops = {
.s_stream = rk1608_s_stream,
.g_frame_interval = rk1608_g_frame_interval,
.s_frame_interval = rk1608_s_frame_interval,
};
static const struct v4l2_subdev_pad_ops rk1608_subdev_pad_ops = {
@@ -562,6 +569,16 @@ static int rk1608_dphy_dt_property(struct rk1608_dphy *dphy)
if (ret)
dev_warn(dphy->dev, "Can not get height!");
ret = of_property_read_u32(node, "hactive",
&dphy->fmt_inf[idx].hactive);
if (ret)
dev_warn(dphy->dev, "Can not get hactive!");
ret = of_property_read_u32(node, "vactive",
&dphy->fmt_inf[idx].vactive);
if (ret)
dev_warn(dphy->dev, "Can not get vactive!");
ret = of_property_read_u32(node, "htotal",
&dphy->fmt_inf[idx].htotal);
if (ret)

View File

@@ -13,6 +13,8 @@ struct rk1608_chinf {
struct rk1608_fmt_inf {
u32 data_type;
u32 mipi_lane;
u32 hactive;
u32 vactive;
u32 htotal;
u32 vtotal;
struct v4l2_mbus_framefmt mf;