aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88
diff options
context:
space:
mode:
authoristvan_v@mailbox.hu <istvan_v@mailbox.hu>2011-07-11 10:02:19 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:56:01 -0400
commiteea16e3661f7177ba106780a2f6cbf373d73bab1 (patch)
tree11eaa4ca735b6e71081c53d09659ec02e6464a7d /drivers/media/video/cx88
parentfef1c8d01847f05f01bf04dbae4409d72ed9a2cd (diff)
[media] cx88: implemented sharpness control
This patch implements support for a sharpness control, using the luma peaking filter feature of cx2388x. [mchehab@redhat.com: use cx_andor instead of cx_write] Signed-off-by: Istvan Varga <istvan_v@mailbox.hu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r--drivers/media/video/cx88/cx88-core.c4
-rw-r--r--drivers/media/video/cx88/cx88-video.c29
2 files changed, 30 insertions, 3 deletions
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 2e145f0a5fd9..20ad809568cf 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -759,8 +759,8 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig
759 if (nocomb) 759 if (nocomb)
760 value |= (3 << 5); // disable comb filter 760 value |= (3 << 5); // disable comb filter
761 761
762 cx_write(MO_FILTER_EVEN, value); 762 cx_andor(MO_FILTER_EVEN, 0x7ffc7f, value); /* preserve PEAKEN, PSEL */
763 cx_write(MO_FILTER_ODD, value); 763 cx_andor(MO_FILTER_ODD, 0x7ffc7f, value);
764 dprintk(1,"set_scale: filter 0x%04x\n", value); 764 dprintk(1,"set_scale: filter 0x%04x\n", value);
765 765
766 return 0; 766 return 0;
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 1db97f3a1975..516aa6ec1e82 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -221,7 +221,23 @@ static const struct cx88_ctrl cx8800_ctls[] = {
221 .reg = MO_UV_SATURATION, 221 .reg = MO_UV_SATURATION,
222 .mask = 0x00ff, 222 .mask = 0x00ff,
223 .shift = 0, 223 .shift = 0,
224 },{ 224 }, {
225 .v = {
226 .id = V4L2_CID_SHARPNESS,
227 .name = "Sharpness",
228 .minimum = 0,
229 .maximum = 4,
230 .step = 1,
231 .default_value = 0x0,
232 .type = V4L2_CTRL_TYPE_INTEGER,
233 },
234 .off = 0,
235 /* NOTE: the value is converted and written to both even
236 and odd registers in the code */
237 .reg = MO_FILTER_ODD,
238 .mask = 7 << 7,
239 .shift = 7,
240 }, {
225 .v = { 241 .v = {
226 .id = V4L2_CID_CHROMA_AGC, 242 .id = V4L2_CID_CHROMA_AGC,
227 .name = "Chroma AGC", 243 .name = "Chroma AGC",
@@ -301,6 +317,7 @@ const u32 cx88_user_ctrls[] = {
301 V4L2_CID_AUDIO_VOLUME, 317 V4L2_CID_AUDIO_VOLUME,
302 V4L2_CID_AUDIO_BALANCE, 318 V4L2_CID_AUDIO_BALANCE,
303 V4L2_CID_AUDIO_MUTE, 319 V4L2_CID_AUDIO_MUTE,
320 V4L2_CID_SHARPNESS,
304 V4L2_CID_CHROMA_AGC, 321 V4L2_CID_CHROMA_AGC,
305 V4L2_CID_COLOR_KILLER, 322 V4L2_CID_COLOR_KILLER,
306 0 323 0
@@ -963,6 +980,10 @@ int cx88_get_control (struct cx88_core *core, struct v4l2_control *ctl)
963 case V4L2_CID_AUDIO_VOLUME: 980 case V4L2_CID_AUDIO_VOLUME:
964 ctl->value = 0x3f - (value & 0x3f); 981 ctl->value = 0x3f - (value & 0x3f);
965 break; 982 break;
983 case V4L2_CID_SHARPNESS:
984 ctl->value = ((value & 0x0200) ? (((value & 0x0180) >> 7) + 1)
985 : 0);
986 break;
966 default: 987 default:
967 ctl->value = ((value + (c->off << c->shift)) & c->mask) >> c->shift; 988 ctl->value = ((value + (c->off << c->shift)) & c->mask) >> c->shift;
968 break; 989 break;
@@ -1040,6 +1061,12 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
1040 } 1061 }
1041 mask=0xffff; 1062 mask=0xffff;
1042 break; 1063 break;
1064 case V4L2_CID_SHARPNESS:
1065 /* 0b000, 0b100, 0b101, 0b110, or 0b111 */
1066 value = (ctl->value < 1 ? 0 : ((ctl->value + 3) << 7));
1067 /* needs to be set for both fields */
1068 cx_andor(MO_FILTER_EVEN, mask, value);
1069 break;
1043 case V4L2_CID_CHROMA_AGC: 1070 case V4L2_CID_CHROMA_AGC:
1044 /* Do not allow chroma AGC to be enabled for SECAM */ 1071 /* Do not allow chroma AGC to be enabled for SECAM */
1045 value = ((ctl->value - c->off) << c->shift) & c->mask; 1072 value = ((ctl->value - c->off) << c->shift) & c->mask;