Commit e8834943 authored by Lad Prabhakar's avatar Lad Prabhakar Committed by Mauro Carvalho Chehab

media: rcar-vin: Enable YDS bit depending on bus_width and data_shift

Enable YDS bit if bus_width and data_shift is set to 8 in parallel mode
for MEDIA_BUS_FMT_UYVY8_2X8 format.
Signed-off-by: default avatarLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent fe98df32
...@@ -620,12 +620,11 @@ static int rvin_parallel_parse_v4l2(struct device *dev, ...@@ -620,12 +620,11 @@ static int rvin_parallel_parse_v4l2(struct device *dev,
switch (vin->parallel->mbus_type) { switch (vin->parallel->mbus_type) {
case V4L2_MBUS_PARALLEL: case V4L2_MBUS_PARALLEL:
vin_dbg(vin, "Found PARALLEL media bus\n");
vin->parallel->mbus_flags = vep->bus.parallel.flags;
break;
case V4L2_MBUS_BT656: case V4L2_MBUS_BT656:
vin_dbg(vin, "Found BT656 media bus\n"); vin_dbg(vin, "Found %s media bus\n",
vin->parallel->mbus_flags = 0; vin->parallel->mbus_type == V4L2_MBUS_PARALLEL ?
"PARALLEL" : "BT656");
vin->parallel->bus = vep->bus.parallel;
break; break;
default: default:
vin_err(vin, "Unknown media bus type\n"); vin_err(vin, "Unknown media bus type\n");
......
...@@ -125,6 +125,7 @@ ...@@ -125,6 +125,7 @@
#define VNDMR2_VPS (1 << 30) #define VNDMR2_VPS (1 << 30)
#define VNDMR2_HPS (1 << 29) #define VNDMR2_HPS (1 << 29)
#define VNDMR2_CES (1 << 28) #define VNDMR2_CES (1 << 28)
#define VNDMR2_YDS (1 << 22)
#define VNDMR2_FTEV (1 << 17) #define VNDMR2_FTEV (1 << 17)
#define VNDMR2_VLV(n) ((n & 0xf) << 12) #define VNDMR2_VLV(n) ((n & 0xf) << 12)
...@@ -698,16 +699,26 @@ static int rvin_setup(struct rvin_dev *vin) ...@@ -698,16 +699,26 @@ static int rvin_setup(struct rvin_dev *vin)
if (!vin->is_csi) { if (!vin->is_csi) {
/* Hsync Signal Polarity Select */ /* Hsync Signal Polarity Select */
if (!(vin->parallel->mbus_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) if (!(vin->parallel->bus.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW))
dmr2 |= VNDMR2_HPS; dmr2 |= VNDMR2_HPS;
/* Vsync Signal Polarity Select */ /* Vsync Signal Polarity Select */
if (!(vin->parallel->mbus_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) if (!(vin->parallel->bus.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW))
dmr2 |= VNDMR2_VPS; dmr2 |= VNDMR2_VPS;
/* Data Enable Polarity Select */ /* Data Enable Polarity Select */
if (vin->parallel->mbus_flags & V4L2_MBUS_DATA_ENABLE_LOW) if (vin->parallel->bus.flags & V4L2_MBUS_DATA_ENABLE_LOW)
dmr2 |= VNDMR2_CES; dmr2 |= VNDMR2_CES;
switch (vin->mbus_code) {
case MEDIA_BUS_FMT_UYVY8_2X8:
if (vin->parallel->bus.bus_width == 8 &&
vin->parallel->bus.data_shift == 8)
dmr2 |= VNDMR2_YDS;
break;
default:
break;
}
} }
/* /*
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <media/v4l2-ctrls.h> #include <media/v4l2-ctrls.h>
#include <media/v4l2-dev.h> #include <media/v4l2-dev.h>
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
#include <media/videobuf2-v4l2.h> #include <media/videobuf2-v4l2.h>
/* Number of HW buffers */ /* Number of HW buffers */
...@@ -92,7 +93,7 @@ struct rvin_video_format { ...@@ -92,7 +93,7 @@ struct rvin_video_format {
* @asd: sub-device descriptor for async framework * @asd: sub-device descriptor for async framework
* @subdev: subdevice matched using async framework * @subdev: subdevice matched using async framework
* @mbus_type: media bus type * @mbus_type: media bus type
* @mbus_flags: media bus configuration flags * @bus: media bus parallel configuration
* @source_pad: source pad of remote subdevice * @source_pad: source pad of remote subdevice
* @sink_pad: sink pad of remote subdevice * @sink_pad: sink pad of remote subdevice
* *
...@@ -102,7 +103,7 @@ struct rvin_parallel_entity { ...@@ -102,7 +103,7 @@ struct rvin_parallel_entity {
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
enum v4l2_mbus_type mbus_type; enum v4l2_mbus_type mbus_type;
unsigned int mbus_flags; struct v4l2_fwnode_bus_parallel bus;
unsigned int source_pad; unsigned int source_pad;
unsigned int sink_pad; unsigned int sink_pad;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment