29e5f423cfd64264aa30e7fbc72fe057c28ceaca
[openwrt/staging/pepe2k.git] /
1 From 19b66a5cc04a0f4dee17bbc862568e6c7e015963 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-isp-ctrls.h | 5 +++++
15 .../vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c | 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-isp-ctrls.h
20 +++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835-isp-ctrls.h
21 @@ -57,6 +57,11 @@ static const struct bcm2835_isp_custom_c
22 .size = sizeof(struct bcm2835_isp_denoise),
23 .flags = 0
24 }, {
25 + .name = "Colour Denoise",
26 + .id = V4L2_CID_USER_BCM2835_ISP_CDN,
27 + .size = sizeof(struct bcm2835_isp_cdn),
28 + .flags = 0
29 + }, {
30 .name = "Defective Pixel Correction",
31 .id = V4L2_CID_USER_BCM2835_ISP_DPC,
32 .size = sizeof(struct bcm2835_isp_dpc),
33 --- a/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c
34 +++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c
35 @@ -766,6 +766,11 @@ static int bcm2835_isp_s_ctrl(struct v4l
36 ctrl->p_new.p_u8,
37 sizeof(struct bcm2835_isp_denoise));
38 break;
39 + case V4L2_CID_USER_BCM2835_ISP_CDN:
40 + ret = set_isp_param(node, MMAL_PARAMETER_CDN,
41 + ctrl->p_new.p_u8,
42 + sizeof(struct bcm2835_isp_cdn));
43 + break;
44 case V4L2_CID_USER_BCM2835_ISP_SHARPEN:
45 ret = set_isp_param(node, MMAL_PARAMETER_SHARPEN,
46 ctrl->p_new.p_u8,
47 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h
48 +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h
49 @@ -279,6 +279,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 /**< Takes a @ref MMAL_PARAMETER_BOOLEAN_T */
56 MMAL_PARAMETER_JPEG_IJG_SCALING,
57 };
58 @@ -915,6 +917,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;