[media] adv7180: rcar-vin: change mbus format to UYVY
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Fri, 2 Sep 2016 15:37:06 +0000 (12:37 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 19 Sep 2016 19:30:20 +0000 (16:30 -0300)
The media bus format reported by the adv7180 is wrong. Steve Longerbeam
posted a patch which changed the format to UYVY8_2X8 with the commit
message:

  Change the media bus format from YUYV8_2X8 to UYVY8_2X8. Colors
  now look correct when capturing with the i.mx6 backend. The other
  option is to set the SWPC bit in register 0x27 to swap the Cr and Cb
  output samples.

The rcar-vin driver was developed and tested with the adv7180 and
therefor suffers from the same issue, looking for the wrong media bus
format. The two errors corrected each other.

This patch takes Steve's patch and merge it with a fix for rcar-vin
driver. The rcar-vin driver is used used in together with the adv7180
och Koelsch and this ensures it will not break while fixing the adv7180
issue. I checked wit Steve and he was fine with me merging the patches.

ADV7180 parts:

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Suggested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/i2c/adv7180.c
drivers/media/platform/rcar-vin/rcar-core.c
drivers/media/platform/rcar-vin/rcar-dma.c

index 515ea6ae41d7385c303a6790234f5ef4b620653c..a6ac78bef4f660e11b4381b9de88a887a57f7201 100644 (file)
@@ -633,7 +633,7 @@ static int adv7180_enum_mbus_code(struct v4l2_subdev *sd,
        if (code->index != 0)
                return -EINVAL;
 
-       code->code = MEDIA_BUS_FMT_YUYV8_2X8;
+       code->code = MEDIA_BUS_FMT_UYVY8_2X8;
 
        return 0;
 }
@@ -643,7 +643,7 @@ static int adv7180_mbus_fmt(struct v4l2_subdev *sd,
 {
        struct adv7180_state *state = to_state(sd);
 
-       fmt->code = MEDIA_BUS_FMT_YUYV8_2X8;
+       fmt->code = MEDIA_BUS_FMT_UYVY8_2X8;
        fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
        fmt->width = 720;
        fmt->height = state->curr_norm & V4L2_STD_525_60 ? 480 : 576;
index 64999a2fba15ae9608e4e38a9a579dcc1abb9363..6219cbaea940d16bd499f3c4968c6b82360c5c3b 100644 (file)
@@ -43,8 +43,8 @@ static bool rvin_mbus_supported(struct rvin_graph_entity *entity)
                code.index++;
                switch (code.code) {
                case MEDIA_BUS_FMT_YUYV8_1X16:
-               case MEDIA_BUS_FMT_YUYV8_2X8:
-               case MEDIA_BUS_FMT_YUYV10_2X10:
+               case MEDIA_BUS_FMT_UYVY8_2X8:
+               case MEDIA_BUS_FMT_UYVY10_2X10:
                case MEDIA_BUS_FMT_RGB888_1X24:
                        entity->code = code.code;
                        return true;
index 9d9f02b1a4d91953fbdb0dfdd0bf3939aa0fb3d2..8397125a89684c932d0556c5355830a5b6a0a741 100644 (file)
@@ -169,7 +169,7 @@ static int rvin_setup(struct rvin_dev *vin)
                vnmc |= VNMC_INF_YUV16;
                input_is_yuv = true;
                break;
-       case MEDIA_BUS_FMT_YUYV8_2X8:
+       case MEDIA_BUS_FMT_UYVY8_2X8:
                /* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */
                vnmc |= vin->digital.mbus_cfg.type == V4L2_MBUS_BT656 ?
                        VNMC_INF_YUV8_BT656 : VNMC_INF_YUV8_BT601;
@@ -178,7 +178,7 @@ static int rvin_setup(struct rvin_dev *vin)
        case MEDIA_BUS_FMT_RGB888_1X24:
                vnmc |= VNMC_INF_RGB888;
                break;
-       case MEDIA_BUS_FMT_YUYV10_2X10:
+       case MEDIA_BUS_FMT_UYVY10_2X10:
                /* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */
                vnmc |= vin->digital.mbus_cfg.type == V4L2_MBUS_BT656 ?
                        VNMC_INF_YUV10_BT656 : VNMC_INF_YUV10_BT601;