1 From 3df60f3d0615c011e91b7d6f39cb9123b2e96530 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Mon, 20 Sep 2021 14:37:17 +0100
4 Subject: [PATCH] staging: bcm2835-codec: Add support for H&V Flips to
7 The ISP can do H & V flips whilst resizing or converting
8 the image, so expose that via V4L2_CID_[H|V]FLIP.
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
12 .../bcm2835-codec/bcm2835-v4l2-codec.c | 48 +++++++++++++++++++
13 1 file changed, 48 insertions(+)
15 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
16 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
17 @@ -679,6 +679,9 @@ struct bcm2835_codec_ctx {
18 enum v4l2_xfer_func xfer_func;
19 enum v4l2_quantization quant;
24 /* Source and destination queue data */
25 struct bcm2835_codec_q_data q_data[2];
27 @@ -2202,6 +2205,34 @@ static int bcm2835_codec_s_ctrl(struct v
31 + case V4L2_CID_HFLIP:
32 + case V4L2_CID_VFLIP: {
35 + if (ctrl->id == V4L2_CID_HFLIP)
36 + ctx->hflip = ctrl->val;
38 + ctx->vflip = ctrl->val;
40 + if (!ctx->component)
43 + if (ctx->hflip && ctx->vflip)
44 + u32_value = MMAL_PARAM_MIRROR_BOTH;
45 + else if (ctx->hflip)
46 + u32_value = MMAL_PARAM_MIRROR_HORIZONTAL;
47 + else if (ctx->vflip)
48 + u32_value = MMAL_PARAM_MIRROR_VERTICAL;
50 + u32_value = MMAL_PARAM_MIRROR_NONE;
52 + ret = vchiq_mmal_port_parameter_set(ctx->dev->instance,
53 + &ctx->component->input[0],
54 + MMAL_PARAMETER_MIRROR,
61 v4l2_err(&ctx->dev->v4l2_dev, "Invalid control\n");
62 @@ -3152,6 +3183,23 @@ static int bcm2835_codec_open(struct fil
67 + v4l2_ctrl_handler_init(hdl, 2);
69 + v4l2_ctrl_new_std(hdl, &bcm2835_codec_ctrl_ops,
72 + v4l2_ctrl_new_std(hdl, &bcm2835_codec_ctrl_ops,
77 + goto free_ctrl_handler;
79 + ctx->fh.ctrl_handler = hdl;
80 + v4l2_ctrl_handler_setup(hdl);
85 v4l2_ctrl_handler_init(hdl, 0);