42917b93c7d715f6c22b362ad68f24f5bc547993
[openwrt/staging/rmilecki.git] /
1 From 21e7514e0fcc8036c675aa8e916fca8c8522b58d 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 @@ -764,6 +764,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 @@ -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 @@ -913,6 +915,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;