6df7a0c49c881e7d36012e3b82b8f42523c0cd44
[openwrt/staging/ldir.git] / target / linux / bcm27xx / patches-5.4 / 950-1043-staging-vc04_services-ISP-Add-colour-denoise-control.patch
1 From 29ec709794ac2aae569c8d486dd19a7d731cfeeb Mon Sep 17 00:00:00 2001
2 From: Naushir Patuck <naush@raspberrypi.com>
3 Date: Thu, 14 Jan 2021 09:20:52 +0000
4 Subject: [PATCH] staging: vc04_services: ISP: Add colour denoise
5 control
6
7 Add colour denoise control to the bcm2835 driver through a new v4l2
8 control: V4L2_CID_USER_BCM2835_ISP_CDN.
9
10 Add the accompanying MMAL configuration structure definitions as well.
11
12 Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
13 ---
14 .../vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c | 5 +++++
15 .../vc04_services/bcm2835-isp/bcm2835_isp_ctrls.h | 5 +++++
16 .../vc04_services/vchiq-mmal/mmal-parameters.h | 13 +++++++++++++
17 3 files changed, 23 insertions(+)
18
19 --- a/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c
20 +++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c
21 @@ -776,6 +776,11 @@ static int bcm2835_isp_s_ctrl(struct v4l
22 ctrl->p_new.p_u8,
23 sizeof(struct bcm2835_isp_denoise));
24 break;
25 + case V4L2_CID_USER_BCM2835_ISP_CDN:
26 + ret = set_isp_param(node, MMAL_PARAMETER_CDN,
27 + ctrl->p_new.p_u8,
28 + sizeof(struct bcm2835_isp_cdn));
29 + break;
30 case V4L2_CID_USER_BCM2835_ISP_SHARPEN:
31 ret = set_isp_param(node, MMAL_PARAMETER_SHARPEN,
32 ctrl->p_new.p_u8,
33 --- a/drivers/staging/vc04_services/bcm2835-isp/bcm2835_isp_ctrls.h
34 +++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835_isp_ctrls.h
35 @@ -57,6 +57,11 @@ static const struct bcm2835_isp_custom_c
36 .size = sizeof(struct bcm2835_isp_denoise),
37 .flags = 0
38 }, {
39 + .name = "Colour Denoise",
40 + .id = V4L2_CID_USER_BCM2835_ISP_CDN,
41 + .size = sizeof(struct bcm2835_isp_cdn),
42 + .flags = 0
43 + }, {
44 .name = "Defective Pixel Correction",
45 .id = V4L2_CID_USER_BCM2835_ISP_DPC,
46 .size = sizeof(struct bcm2835_isp_dpc),
47 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h
48 +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h
49 @@ -277,6 +277,8 @@ enum mmal_parameter_camera_type {
50 MMAL_PARAMETER_DPC,
51 /**< Tales a @ref MMAP_PARAMETER_GAMMA_T */
52 MMAL_PARAMETER_GAMMA,
53 + /**< Takes a @ref MMAL_PARAMETER_CDN_T */
54 + MMAL_PARAMETER_CDN,
55 };
56
57 struct mmal_parameter_rational {
58 @@ -910,6 +912,17 @@ struct mmal_parameter_gamma {
59 u16 y[MMAL_NUM_GAMMA_PTS];
60 };
61
62 +enum mmal_parameter_cdn_mode {
63 + MMAL_PARAM_CDN_FAST = 0,
64 + MMAL_PARAM_CDN_HIGH_QUALITY = 1,
65 + MMAL_PARAM_CDN_DUMMY = 0x7FFFFFFF
66 +};
67 +
68 +struct mmal_parameter_colour_denoise {
69 + u32 enabled;
70 + enum mmal_parameter_cdn_mode mode;
71 +};
72 +
73 struct mmal_parameter_denoise {
74 u32 enabled;
75 u32 constant;