diff options
-rw-r--r-- | drivers/media/video/ov772x.c | 63 | ||||
-rw-r--r-- | include/media/ov772x.h | 35 |
2 files changed, 94 insertions, 4 deletions
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c index 34c981933780..c0d911252862 100644 --- a/drivers/media/video/ov772x.c +++ b/drivers/media/video/ov772x.c | |||
@@ -169,11 +169,11 @@ | |||
169 | #define GAM15 0x8C /* Gamma Curve 15th segment input end point */ | 169 | #define GAM15 0x8C /* Gamma Curve 15th segment input end point */ |
170 | #define SLOP 0x8D /* Gamma curve highest segment slope */ | 170 | #define SLOP 0x8D /* Gamma curve highest segment slope */ |
171 | #define DNSTH 0x8E /* De-noise threshold */ | 171 | #define DNSTH 0x8E /* De-noise threshold */ |
172 | #define EDGE0 0x8F /* Edge enhancement control 0 */ | 172 | #define EDGE_STRNGT 0x8F /* Edge strength control when manual mode */ |
173 | #define EDGE1 0x90 /* Edge enhancement control 1 */ | 173 | #define EDGE_TRSHLD 0x90 /* Edge threshold control when manual mode */ |
174 | #define DNSOFF 0x91 /* Auto De-noise threshold control */ | 174 | #define DNSOFF 0x91 /* Auto De-noise threshold control */ |
175 | #define EDGE2 0x92 /* Edge enhancement strength low point control */ | 175 | #define EDGE_UPPER 0x92 /* Edge strength upper limit when Auto mode */ |
176 | #define EDGE3 0x93 /* Edge enhancement strength high point control */ | 176 | #define EDGE_LOWER 0x93 /* Edge strength lower limit when Auto mode */ |
177 | #define MTX1 0x94 /* Matrix coefficient 1 */ | 177 | #define MTX1 0x94 /* Matrix coefficient 1 */ |
178 | #define MTX2 0x95 /* Matrix coefficient 2 */ | 178 | #define MTX2 0x95 /* Matrix coefficient 2 */ |
179 | #define MTX3 0x96 /* Matrix coefficient 3 */ | 179 | #define MTX3 0x96 /* Matrix coefficient 3 */ |
@@ -358,6 +358,14 @@ | |||
358 | #define VOSZ_VGA 0xF0 | 358 | #define VOSZ_VGA 0xF0 |
359 | #define VOSZ_QVGA 0x78 | 359 | #define VOSZ_QVGA 0x78 |
360 | 360 | ||
361 | /* DSPAUTO (DSP Auto Function ON/OFF Control) */ | ||
362 | #define AWB_ACTRL 0x80 /* AWB auto threshold control */ | ||
363 | #define DENOISE_ACTRL 0x40 /* De-noise auto threshold control */ | ||
364 | #define EDGE_ACTRL 0x20 /* Edge enhancement auto strength control */ | ||
365 | #define UV_ACTRL 0x10 /* UV adjust auto slope control */ | ||
366 | #define SCAL0_ACTRL 0x08 /* Auto scaling factor control */ | ||
367 | #define SCAL1_2_ACTRL 0x04 /* Auto scaling factor control */ | ||
368 | |||
361 | /* | 369 | /* |
362 | * ID | 370 | * ID |
363 | */ | 371 | */ |
@@ -816,6 +824,53 @@ static int ov772x_set_params(struct ov772x_priv *priv, u32 width, u32 height, | |||
816 | ov772x_reset(priv->client); | 824 | ov772x_reset(priv->client); |
817 | 825 | ||
818 | /* | 826 | /* |
827 | * Edge Ctrl | ||
828 | */ | ||
829 | if (priv->info->edgectrl.strength & OV772X_MANUAL_EDGE_CTRL) { | ||
830 | |||
831 | /* | ||
832 | * Manual Edge Control Mode | ||
833 | * | ||
834 | * Edge auto strength bit is set by default. | ||
835 | * Remove it when manual mode. | ||
836 | */ | ||
837 | |||
838 | ret = ov772x_mask_set(priv->client, DSPAUTO, EDGE_ACTRL, 0x00); | ||
839 | if (ret < 0) | ||
840 | goto ov772x_set_fmt_error; | ||
841 | |||
842 | ret = ov772x_mask_set(priv->client, | ||
843 | EDGE_TRSHLD, EDGE_THRESHOLD_MASK, | ||
844 | priv->info->edgectrl.threshold); | ||
845 | if (ret < 0) | ||
846 | goto ov772x_set_fmt_error; | ||
847 | |||
848 | ret = ov772x_mask_set(priv->client, | ||
849 | EDGE_STRNGT, EDGE_STRENGTH_MASK, | ||
850 | priv->info->edgectrl.strength); | ||
851 | if (ret < 0) | ||
852 | goto ov772x_set_fmt_error; | ||
853 | |||
854 | } else if (priv->info->edgectrl.upper > priv->info->edgectrl.lower) { | ||
855 | /* | ||
856 | * Auto Edge Control Mode | ||
857 | * | ||
858 | * set upper and lower limit | ||
859 | */ | ||
860 | ret = ov772x_mask_set(priv->client, | ||
861 | EDGE_UPPER, EDGE_UPPER_MASK, | ||
862 | priv->info->edgectrl.upper); | ||
863 | if (ret < 0) | ||
864 | goto ov772x_set_fmt_error; | ||
865 | |||
866 | ret = ov772x_mask_set(priv->client, | ||
867 | EDGE_LOWER, EDGE_LOWER_MASK, | ||
868 | priv->info->edgectrl.lower); | ||
869 | if (ret < 0) | ||
870 | goto ov772x_set_fmt_error; | ||
871 | } | ||
872 | |||
873 | /* | ||
819 | * set size format | 874 | * set size format |
820 | */ | 875 | */ |
821 | ret = ov772x_write_array(priv->client, priv->win->regs); | 876 | ret = ov772x_write_array(priv->client, priv->win->regs); |
diff --git a/include/media/ov772x.h b/include/media/ov772x.h index 57db48dd85b8..30d9629198ef 100644 --- a/include/media/ov772x.h +++ b/include/media/ov772x.h | |||
@@ -17,10 +17,45 @@ | |||
17 | #define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */ | 17 | #define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */ |
18 | #define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */ | 18 | #define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */ |
19 | 19 | ||
20 | /* | ||
21 | * for Edge ctrl | ||
22 | * | ||
23 | * strength also control Auto or Manual Edge Control Mode | ||
24 | * see also OV772X_MANUAL_EDGE_CTRL | ||
25 | */ | ||
26 | struct ov772x_edge_ctrl { | ||
27 | unsigned char strength; | ||
28 | unsigned char threshold; | ||
29 | unsigned char upper; | ||
30 | unsigned char lower; | ||
31 | }; | ||
32 | |||
33 | #define OV772X_MANUAL_EDGE_CTRL 0x80 /* un-used bit of strength */ | ||
34 | #define EDGE_STRENGTH_MASK 0x1F | ||
35 | #define EDGE_THRESHOLD_MASK 0x0F | ||
36 | #define EDGE_UPPER_MASK 0xFF | ||
37 | #define EDGE_LOWER_MASK 0xFF | ||
38 | |||
39 | #define OV772X_AUTO_EDGECTRL(u, l) \ | ||
40 | { \ | ||
41 | .upper = (u & EDGE_UPPER_MASK), \ | ||
42 | .lower = (l & EDGE_LOWER_MASK), \ | ||
43 | } | ||
44 | |||
45 | #define OV772X_MANUAL_EDGECTRL(s, t) \ | ||
46 | { \ | ||
47 | .strength = (s & EDGE_STRENGTH_MASK) | OV772X_MANUAL_EDGE_CTRL,\ | ||
48 | .threshold = (t & EDGE_THRESHOLD_MASK), \ | ||
49 | } | ||
50 | |||
51 | /* | ||
52 | * ov772x camera info | ||
53 | */ | ||
20 | struct ov772x_camera_info { | 54 | struct ov772x_camera_info { |
21 | unsigned long buswidth; | 55 | unsigned long buswidth; |
22 | unsigned long flags; | 56 | unsigned long flags; |
23 | struct soc_camera_link link; | 57 | struct soc_camera_link link; |
58 | struct ov772x_edge_ctrl edgectrl; | ||
24 | }; | 59 | }; |
25 | 60 | ||
26 | #endif /* __OV772X_H__ */ | 61 | #endif /* __OV772X_H__ */ |