mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
drivers: platform: rockchip: cif: fix dvp camera fails to link with cif on rk1808
support yuv format for cif and let dvp camera link to cif on rk1808 Change-Id: Idb078a909522f0e98fdc5319411a923e818fc128 Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
This commit is contained in:
@@ -409,6 +409,9 @@ static unsigned char get_data_type(u32 pixelformat, u8 cmd_mode_en)
|
||||
return 0x2b;
|
||||
/* csi uyvy 422 */
|
||||
case MEDIA_BUS_FMT_UYVY8_2X8:
|
||||
case MEDIA_BUS_FMT_VYUY8_2X8:
|
||||
case MEDIA_BUS_FMT_YUYV8_2X8:
|
||||
case MEDIA_BUS_FMT_YVYU8_2X8:
|
||||
return 0x1e;
|
||||
case MEDIA_BUS_FMT_RGB888_1X24: {
|
||||
if (cmd_mode_en) /* dsi command mode*/
|
||||
@@ -996,7 +999,7 @@ static void rkcif_stop_streaming(struct vb2_queue *queue)
|
||||
struct rkcif_vdev_node *node = &stream->vnode;
|
||||
struct rkcif_device *dev = stream->cifdev;
|
||||
struct v4l2_device *v4l2_dev = &dev->v4l2_dev;
|
||||
struct rkcif_buffer *buf;
|
||||
struct rkcif_buffer *buf = NULL;
|
||||
int ret;
|
||||
|
||||
stream->stopping = true;
|
||||
@@ -1016,21 +1019,16 @@ static void rkcif_stop_streaming(struct vb2_queue *queue)
|
||||
ret);
|
||||
|
||||
/* release buffers */
|
||||
if (stream->curr_buf) {
|
||||
list_add_tail(&stream->curr_buf->queue, &stream->buf_head);
|
||||
stream->curr_buf = NULL;
|
||||
}
|
||||
if (stream->next_buf) {
|
||||
list_add_tail(&stream->next_buf->queue, &stream->buf_head);
|
||||
stream->next_buf = NULL;
|
||||
}
|
||||
|
||||
if (stream->next_buf)
|
||||
vb2_buffer_done(&stream->next_buf->vb.vb2_buf,
|
||||
VB2_BUF_STATE_QUEUED);
|
||||
if (stream->curr_buf)
|
||||
vb2_buffer_done(&stream->curr_buf->vb.vb2_buf,
|
||||
VB2_BUF_STATE_QUEUED);
|
||||
list_add_tail(&stream->curr_buf->queue, &stream->buf_head);
|
||||
|
||||
if (stream->next_buf &&
|
||||
stream->next_buf != stream->curr_buf)
|
||||
list_add_tail(&stream->next_buf->queue, &stream->buf_head);
|
||||
|
||||
stream->curr_buf = NULL;
|
||||
stream->next_buf = NULL;
|
||||
|
||||
while (!list_empty(&stream->buf_head)) {
|
||||
buf = list_first_entry(&stream->buf_head,
|
||||
struct rkcif_buffer, queue);
|
||||
@@ -2179,7 +2177,7 @@ void rkcif_irq_pingpong(struct rkcif_device *cif_dev)
|
||||
intstat = read_cif_reg(base, CIF_INTSTAT);
|
||||
cif_frmst = read_cif_reg(base, CIF_FRAME_STATUS);
|
||||
lastline = CIF_FETCH_Y_LAST_LINE(read_cif_reg(base, CIF_LAST_LINE));
|
||||
lastpix = read_cif_reg(base, CIF_LAST_PIX);
|
||||
lastpix = CIF_FETCH_Y_LAST_LINE(read_cif_reg(base, CIF_LAST_PIX));
|
||||
ctl = read_cif_reg(base, CIF_CTRL);
|
||||
|
||||
if (cif_dev->chip_id == CHIP_RK1808_CIF)
|
||||
|
||||
@@ -203,8 +203,9 @@ err_stream_off:
|
||||
/***************************** media controller *******************************/
|
||||
static int rkcif_create_links(struct rkcif_device *dev)
|
||||
{
|
||||
unsigned int s, pad, id, stream_num = 0;
|
||||
int ret;
|
||||
u32 flags;
|
||||
unsigned int s, pad, id, stream_num = 0;
|
||||
|
||||
if (dev->chip_id == CHIP_RK1808_CIF)
|
||||
stream_num = RKCIF_MULTI_STREAMS_NUM;
|
||||
@@ -214,31 +215,53 @@ static int rkcif_create_links(struct rkcif_device *dev)
|
||||
/* sensor links(or mipi-phy) */
|
||||
for (s = 0; s < dev->num_sensors; ++s) {
|
||||
struct rkcif_sensor_info *sensor = &dev->sensors[s];
|
||||
struct media_entity *source_entity, *sink_entity;
|
||||
|
||||
for (pad = 0; pad < sensor->sd->entity.num_pads; pad++) {
|
||||
if (sensor->sd->entity.pads[pad].flags &
|
||||
MEDIA_PAD_FL_SOURCE) {
|
||||
MEDIA_PAD_FL_SOURCE) {
|
||||
if (pad == sensor->sd->entity.num_pads) {
|
||||
dev_err(dev->dev,
|
||||
"failed to find src pad for %s\n",
|
||||
sensor->sd->name);
|
||||
|
||||
return -ENXIO;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((sensor->mbus.type == V4L2_MBUS_BT656 ||
|
||||
sensor->mbus.type == V4L2_MBUS_PARALLEL) &&
|
||||
dev->chip_id == CHIP_RK1808_CIF) {
|
||||
source_entity = &sensor->sd->entity;
|
||||
sink_entity = &dev->stream[RKCIF_STREAM_DVP].vnode.vdev.entity;
|
||||
|
||||
ret = media_entity_create_link(source_entity,
|
||||
pad,
|
||||
sink_entity,
|
||||
0,
|
||||
MEDIA_LNK_FL_ENABLED);
|
||||
if (ret)
|
||||
dev_err(dev->dev, "failed to create link for %s\n",
|
||||
sensor->sd->name);
|
||||
break;
|
||||
}
|
||||
|
||||
for (id = 0; id < stream_num; id++) {
|
||||
ret = media_entity_create_link(&sensor->sd->entity,
|
||||
source_entity = &sensor->sd->entity;
|
||||
sink_entity = &dev->stream[id].vnode.vdev.entity;
|
||||
|
||||
(dev->chip_id != CHIP_RK1808_CIF) | (id == pad - 1) ?
|
||||
(flags = MEDIA_LNK_FL_ENABLED) : (flags = 0);
|
||||
|
||||
ret = media_entity_create_link(source_entity,
|
||||
pad,
|
||||
&dev->stream[id].vnode.vdev.entity,
|
||||
sink_entity,
|
||||
0,
|
||||
(dev->chip_id != CHIP_RK1808_CIF) |
|
||||
(id == pad - 1) ?
|
||||
MEDIA_LNK_FL_ENABLED : 0);
|
||||
flags);
|
||||
if (ret) {
|
||||
dev_err(dev->dev,
|
||||
"failed to create link for %s\n",
|
||||
sensor->sd->name);
|
||||
return ret;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*5. Support sampling raw data for cif
|
||||
*6. fix the bug that dummpy buffer size is error
|
||||
*7. Add framesizes and frmintervals callback
|
||||
*8. fix dvp camera fails to link with cif on rk1808
|
||||
*/
|
||||
|
||||
#define RKCIF_DRIVER_VERSION KERNEL_VERSION(0, 1, 0x2)
|
||||
|
||||
Reference in New Issue
Block a user