[PATCH] v4l: bttv new insmod parameters

* bttv-driver.c, bttvp.h:

- New bttv module params:

- uv_ratio : allow a ratio of saturation between u and v. If you
have a ratio of 40 and a saturation of 100, usat will be 80 and
vstat 120. Useful to correct a bad color balance.
- full_luma_range : provide a better contrast in using the full
range 0-253 of values instead of 16-253.
- coring : to have a better black level.
- radio range is now defined on tuner-core.c. Cleaning up.

* bttvp.h:

- Fix gcc 4.0 compilation

Signed-off-by: Jorik Jonker <jorik@dnd.utwente.nl>
Signed-off-by: Sylvain Meyer <sylvain.meyer@worldonline.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Nickolay V Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Mauro Carvalho Chehab and committed by Linus Torvalds 060d3027 586b0cab

+68 -10
+64 -9
drivers/media/video/bttv-driver.c
··· 1 /* 2 - $Id: bttv-driver.c,v 1.38 2005/06/10 17:20:24 mchehab Exp $ 3 4 bttv - Bt848 frame grabber driver 5 ··· 76 static unsigned int whitecrush_lower = 0x7F; 77 static unsigned int vcr_hack = 0; 78 static unsigned int irq_iswitch = 0; 79 80 /* API features (turn on/off stuff for testing) */ 81 static unsigned int v4l2 = 1; ··· 109 module_param(whitecrush_upper, int, 0444); 110 module_param(whitecrush_lower, int, 0444); 111 module_param(vcr_hack, int, 0444); 112 113 module_param_array(radio, int, NULL, 0444); 114 ··· 130 MODULE_PARM_DESC(whitecrush_lower,"sets the white crush lower value, default is 127"); 131 MODULE_PARM_DESC(vcr_hack,"enables the VCR hack (improves synch on poor VCR tapes), default is 0 (no)"); 132 MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler"); 133 134 MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); 135 MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); ··· 493 #define V4L2_CID_PRIVATE_VCR_HACK (V4L2_CID_PRIVATE_BASE + 5) 494 #define V4L2_CID_PRIVATE_WHITECRUSH_UPPER (V4L2_CID_PRIVATE_BASE + 6) 495 #define V4L2_CID_PRIVATE_WHITECRUSH_LOWER (V4L2_CID_PRIVATE_BASE + 7) 496 - #define V4L2_CID_PRIVATE_LASTP1 (V4L2_CID_PRIVATE_BASE + 8) 497 498 static const struct v4l2_queryctrl no_ctl = { 499 .name = "42", ··· 630 .step = 1, 631 .default_value = 0x7F, 632 .type = V4L2_CTRL_TYPE_INTEGER, 633 } 634 635 }; 636 static const int BTTV_CTLS = ARRAY_SIZE(bttv_ctls); ··· 869 btv->saturation = color; 870 871 /* 0-511 for the color */ 872 - val_u = color >> 7; 873 - val_v = ((color>>7)*180L)/254; 874 hibits = (val_u >> 7) & 2; 875 hibits |= (val_v >> 8) & 1; 876 btwrite(val_u & 0xff, BT848_SAT_U_LO); ··· 1187 case V4L2_CID_PRIVATE_WHITECRUSH_LOWER: 1188 c->value = btv->opt_whitecrush_lower; 1189 break; 1190 default: 1191 return -EINVAL; 1192 } ··· 1291 case V4L2_CID_PRIVATE_WHITECRUSH_LOWER: 1292 btv->opt_whitecrush_lower = c->value; 1293 btwrite(c->value, BT848_WC_DOWN); 1294 break; 1295 default: 1296 return -EINVAL; ··· 3174 return -EINVAL; 3175 memset(v,0,sizeof(*v)); 3176 strcpy(v->name, "Radio"); 3177 - /* japan: 76.0 MHz - 89.9 MHz 3178 - western europe: 87.5 MHz - 108.0 MHz 3179 - russia: 65.0 MHz - 108.0 MHz */ 3180 - v->rangelow=(int)(65*16); 3181 - v->rangehigh=(int)(108*16); 3182 bttv_call_i2c_clients(btv,cmd,v); 3183 return 0; 3184 } ··· 3928 btv->opt_vcr_hack = vcr_hack; 3929 btv->opt_whitecrush_upper = whitecrush_upper; 3930 btv->opt_whitecrush_lower = whitecrush_lower; 3931 3932 /* fill struct bttv with some useful defaults */ 3933 btv->init.btv = btv;
··· 1 /* 2 + $Id: bttv-driver.c,v 1.40 2005/06/16 21:38:45 nsh Exp $ 3 4 bttv - Bt848 frame grabber driver 5 ··· 76 static unsigned int whitecrush_lower = 0x7F; 77 static unsigned int vcr_hack = 0; 78 static unsigned int irq_iswitch = 0; 79 + static unsigned int uv_ratio = 50; 80 + static unsigned int full_luma_range = 0; 81 + static unsigned int coring = 0; 82 83 /* API features (turn on/off stuff for testing) */ 84 static unsigned int v4l2 = 1; ··· 106 module_param(whitecrush_upper, int, 0444); 107 module_param(whitecrush_lower, int, 0444); 108 module_param(vcr_hack, int, 0444); 109 + module_param(uv_ratio, int, 0444); 110 + module_param(full_luma_range, int, 0444); 111 + module_param(coring, int, 0444); 112 113 module_param_array(radio, int, NULL, 0444); 114 ··· 124 MODULE_PARM_DESC(whitecrush_lower,"sets the white crush lower value, default is 127"); 125 MODULE_PARM_DESC(vcr_hack,"enables the VCR hack (improves synch on poor VCR tapes), default is 0 (no)"); 126 MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler"); 127 + MODULE_PARM_DESC(uv_ratio,"ratio between u and v gains, default is 50"); 128 + MODULE_PARM_DESC(full_luma_range,"use the full luma range, default is 0 (no)"); 129 + MODULE_PARM_DESC(coring,"set the luma coring level, default is 0 (no)"); 130 131 MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); 132 MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); ··· 484 #define V4L2_CID_PRIVATE_VCR_HACK (V4L2_CID_PRIVATE_BASE + 5) 485 #define V4L2_CID_PRIVATE_WHITECRUSH_UPPER (V4L2_CID_PRIVATE_BASE + 6) 486 #define V4L2_CID_PRIVATE_WHITECRUSH_LOWER (V4L2_CID_PRIVATE_BASE + 7) 487 + #define V4L2_CID_PRIVATE_UV_RATIO (V4L2_CID_PRIVATE_BASE + 8) 488 + #define V4L2_CID_PRIVATE_FULL_LUMA_RANGE (V4L2_CID_PRIVATE_BASE + 9) 489 + #define V4L2_CID_PRIVATE_CORING (V4L2_CID_PRIVATE_BASE + 10) 490 + #define V4L2_CID_PRIVATE_LASTP1 (V4L2_CID_PRIVATE_BASE + 11) 491 492 static const struct v4l2_queryctrl no_ctl = { 493 .name = "42", ··· 618 .step = 1, 619 .default_value = 0x7F, 620 .type = V4L2_CTRL_TYPE_INTEGER, 621 + },{ 622 + .id = V4L2_CID_PRIVATE_UV_RATIO, 623 + .name = "uv ratio", 624 + .minimum = 0, 625 + .maximum = 100, 626 + .step = 1, 627 + .default_value = 50, 628 + .type = V4L2_CTRL_TYPE_INTEGER, 629 + },{ 630 + .id = V4L2_CID_PRIVATE_FULL_LUMA_RANGE, 631 + .name = "full luma range", 632 + .minimum = 0, 633 + .maximum = 1, 634 + .type = V4L2_CTRL_TYPE_BOOLEAN, 635 + },{ 636 + .id = V4L2_CID_PRIVATE_CORING, 637 + .name = "coring", 638 + .minimum = 0, 639 + .maximum = 3, 640 + .step = 1, 641 + .default_value = 0, 642 + .type = V4L2_CTRL_TYPE_INTEGER, 643 } 644 + 645 + 646 647 }; 648 static const int BTTV_CTLS = ARRAY_SIZE(bttv_ctls); ··· 833 btv->saturation = color; 834 835 /* 0-511 for the color */ 836 + val_u = ((color * btv->opt_uv_ratio) / 50) >> 7; 837 + val_v = (((color * (100 - btv->opt_uv_ratio) / 50) >>7)*180L)/254; 838 hibits = (val_u >> 7) & 2; 839 hibits |= (val_v >> 8) & 1; 840 btwrite(val_u & 0xff, BT848_SAT_U_LO); ··· 1151 case V4L2_CID_PRIVATE_WHITECRUSH_LOWER: 1152 c->value = btv->opt_whitecrush_lower; 1153 break; 1154 + case V4L2_CID_PRIVATE_UV_RATIO: 1155 + c->value = btv->opt_uv_ratio; 1156 + break; 1157 + case V4L2_CID_PRIVATE_FULL_LUMA_RANGE: 1158 + c->value = btv->opt_full_luma_range; 1159 + break; 1160 + case V4L2_CID_PRIVATE_CORING: 1161 + c->value = btv->opt_coring; 1162 + break; 1163 default: 1164 return -EINVAL; 1165 } ··· 1246 case V4L2_CID_PRIVATE_WHITECRUSH_LOWER: 1247 btv->opt_whitecrush_lower = c->value; 1248 btwrite(c->value, BT848_WC_DOWN); 1249 + break; 1250 + case V4L2_CID_PRIVATE_UV_RATIO: 1251 + btv->opt_uv_ratio = c->value; 1252 + bt848_sat(btv, btv->saturation); 1253 + break; 1254 + case V4L2_CID_PRIVATE_FULL_LUMA_RANGE: 1255 + btv->opt_full_luma_range = c->value; 1256 + btaor((c->value<<7), ~BT848_OFORM_RANGE, BT848_OFORM); 1257 + break; 1258 + case V4L2_CID_PRIVATE_CORING: 1259 + btv->opt_coring = c->value; 1260 + btaor((c->value<<5), ~BT848_OFORM_CORE32, BT848_OFORM); 1261 break; 1262 default: 1263 return -EINVAL; ··· 3117 return -EINVAL; 3118 memset(v,0,sizeof(*v)); 3119 strcpy(v->name, "Radio"); 3120 bttv_call_i2c_clients(btv,cmd,v); 3121 return 0; 3122 } ··· 3876 btv->opt_vcr_hack = vcr_hack; 3877 btv->opt_whitecrush_upper = whitecrush_upper; 3878 btv->opt_whitecrush_lower = whitecrush_lower; 3879 + btv->opt_uv_ratio = uv_ratio; 3880 + btv->opt_full_luma_range = full_luma_range; 3881 + btv->opt_coring = coring; 3882 3883 /* fill struct bttv with some useful defaults */ 3884 btv->init.btv = btv;
+4 -1
drivers/media/video/bttvp.h
··· 1 /* 2 - $Id: bttvp.h,v 1.17 2005/02/16 12:14:10 kraxel Exp $ 3 4 bttv - Bt848 frame grabber driver 5 ··· 326 int opt_vcr_hack; 327 int opt_whitecrush_upper; 328 int opt_whitecrush_lower; 329 330 /* radio data/state */ 331 int has_radio;
··· 1 /* 2 + $Id: bttvp.h,v 1.19 2005/06/16 21:38:45 nsh Exp $ 3 4 bttv - Bt848 frame grabber driver 5 ··· 326 int opt_vcr_hack; 327 int opt_whitecrush_upper; 328 int opt_whitecrush_lower; 329 + int opt_uv_ratio; 330 + int opt_full_luma_range; 331 + int opt_coring; 332 333 /* radio data/state */ 334 int has_radio;