1 From bf722c887dd9d0d24493edd20c61b2fcde5f66dd 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
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 @@ -970,8 +970,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;