By Date: <-- -->
By Thread: <-- -->

cx88 default picture controls values



This patch fixes default values for some picture controls:
 - brightness set to 50% by default (now is 0%)
 - hue set to 50% by default (now is 0%)
 - volume set to 0dB (now is -32dB)
and some left small fixes:
 - twice offset adding
 - balance didn't follow datasheet (bits[0:5] = attenuation;
   bit[6] = channel to provide attenuation)


This patch represents all pending fixes from old
"cx88_fix_controls_update.diff" sent "2006-01-21" by Ian.
It only doesn't include additional balance fix ("balance + volume <
-63dB" problem) and this will be covered in next patch.


Here are signs taken from original patch:
        Signed-off-by: Ian Pickworth <ian (at) pickworth.me.uk>
        Signed-off-by: Marcin Rudowski <mar_rud (at) poczta.onet.pl>
        Signed-off-by: Mauro Carvalho Chehab <mchehab (at) brturbo.com.br>


Regards,
Marcin
diff -rup v4l-dvb.orig/linux/drivers/media/video/cx88/cx88-video.c v4l-dvb/linux/drivers/media/video/cx88/cx88-video.c
--- v4l-dvb.orig/linux/drivers/media/video/cx88/cx88-video.c	2006-03-09 22:25:58.000000000 +0100
+++ v4l-dvb/linux/drivers/media/video/cx88/cx88-video.c	2006-03-09 22:15:23.000000000 +0100
 (at)  (at)  -253,7 +253,7  (at)  (at)  static struct cx88_ctrl cx8800_ctls[] = 
 			.minimum       = 0x00,
 			.maximum       = 0xff,
 			.step          = 1,
-			.default_value = 0,
+			.default_value = 0x7f,
 			.type          = V4L2_CTRL_TYPE_INTEGER,
 		},
 		.off                   = 128,
 (at)  (at)  -267,7 +267,7  (at)  (at)  static struct cx88_ctrl cx8800_ctls[] = 
 			.minimum       = 0,
 			.maximum       = 0xff,
 			.step          = 1,
-			.default_value = 0x3f,
+			.default_value = 0x39,
 			.type          = V4L2_CTRL_TYPE_INTEGER,
 		},
 		.off                   = 0,
 (at)  (at)  -281,7 +281,7  (at)  (at)  static struct cx88_ctrl cx8800_ctls[] = 
 			.minimum       = 0,
 			.maximum       = 0xff,
 			.step          = 1,
-			.default_value = 0,
+			.default_value = 0x7f,
 			.type          = V4L2_CTRL_TYPE_INTEGER,
 		},
 		.off                   = 128,
 (at)  (at)  -326,7 +326,7  (at)  (at)  static struct cx88_ctrl cx8800_ctls[] = 
 			.minimum       = 0,
 			.maximum       = 0x3f,
 			.step          = 1,
-			.default_value = 0x1f,
+			.default_value = 0x3f,
 			.type          = V4L2_CTRL_TYPE_INTEGER,
 		},
 		.reg                   = AUD_VOL_CTL,
 (at)  (at)  -1160,7 +1160,8  (at)  (at)  static int get_control(struct cx88_core 
 	value = c->sreg ? cx_sread(c->sreg) : cx_read(c->reg);
 	switch (ctl->id) {
 	case V4L2_CID_AUDIO_BALANCE:
-		ctl->value = (value & 0x40) ? (value & 0x3f) : (0x40 - (value & 0x3f));
+		ctl->value = ((value & 0x7f) < 0x40) ? ((value & 0x7f) + 0x40)
+					: (0x7f - (value & 0x7f));
 		break;
 	case V4L2_CID_AUDIO_VOLUME:
 		ctl->value = 0x3f - (value & 0x3f);
 (at)  (at)  -1205,7 +1206,7  (at)  (at)  static int set_control(struct cx88_core 
 	mask=c->mask;
 	switch (ctl->id) {
 	case V4L2_CID_AUDIO_BALANCE:
-		value = (ctl->value < 0x40) ? (0x40 - ctl->value) : ctl->value;
+		value = (ctl->value < 0x40) ? (0x7f - ctl->value) : (ctl->value - 0x40);
 		break;
 	case V4L2_CID_AUDIO_VOLUME:
 		value = 0x3f - (ctl->value & 0x3f);
 (at)  (at)  -1246,8 +1247,7  (at)  (at)  static void init_controls(struct cx88_co
 
 	for (i = 0; i < CX8800_CTLS; i++) {
 		ctrl.id=cx8800_ctls[i].v.id;
-		ctrl.value=cx8800_ctls[i].v.default_value
-				+cx8800_ctls[i].off;
+		ctrl.value=cx8800_ctls[i].v.default_value;
 		set_control(core, &ctrl);
 	}
 }
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request (at) redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list