1 From 6f1696959ba011cda3138d0dac6ed587282606b6 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 19 May 2020 11:46:47 +0100
4 Subject: [PATCH] media: bcm2835-unicam: Retain packing information on
7 The change to retrieve the pixel format always on g_fmt didn't
8 check whether the native or unpacked version of the format
9 had been requested, and always returned the packed one.
10 Correct this so that the packing setting is retained whereever
13 Fixes "9d59e89 media: bcm2835-unicam: Re-fetch mbus code from subdev
16 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
18 .../media/platform/bcm2835/bcm2835-unicam.c | 19 +++++++++++++++++--
19 1 file changed, 17 insertions(+), 2 deletions(-)
21 --- a/drivers/media/platform/bcm2835/bcm2835-unicam.c
22 +++ b/drivers/media/platform/bcm2835/bcm2835-unicam.c
23 @@ -980,8 +980,23 @@ static int unicam_g_fmt_vid_cap(struct f
28 - node->v_fmt.fmt.pix.pixelformat = fmt->fourcc;
29 + if (node->fmt != fmt) {
31 + * The sensor format has changed so the pixelformat needs to
32 + * be updated. Try and retain the packed/unpacked choice if
35 + if (node->fmt->repacked_fourcc ==
36 + node->v_fmt.fmt.pix.pixelformat)
37 + /* Using the repacked format */
38 + node->v_fmt.fmt.pix.pixelformat = fmt->repacked_fourcc;
40 + /* Using the native format */
41 + node->v_fmt.fmt.pix.pixelformat = fmt->fourcc;