aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2005-06-28 23:45:25 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-29 00:20:36 -0400
commit060d3027f26aab9adeac8ff6d1184bca67c7d174 (patch)
tree256942348be4c308f9f17e74dd9753a6fdbcb238 /drivers/media/video
parent586b0cab2516640fec4dffc3049c4d8bca188f89 (diff)
[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>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/bttv-driver.c73
-rw-r--r--drivers/media/video/bttvp.h5
2 files changed, 68 insertions, 10 deletions
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index 290289a99757..7d62b394c509 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: bttv-driver.c,v 1.38 2005/06/10 17:20:24 mchehab Exp $ 2 $Id: bttv-driver.c,v 1.40 2005/06/16 21:38:45 nsh Exp $
3 3
4 bttv - Bt848 frame grabber driver 4 bttv - Bt848 frame grabber driver
5 5
@@ -76,6 +76,9 @@ static unsigned int whitecrush_upper = 0xCF;
76static unsigned int whitecrush_lower = 0x7F; 76static unsigned int whitecrush_lower = 0x7F;
77static unsigned int vcr_hack = 0; 77static unsigned int vcr_hack = 0;
78static unsigned int irq_iswitch = 0; 78static unsigned int irq_iswitch = 0;
79static unsigned int uv_ratio = 50;
80static unsigned int full_luma_range = 0;
81static unsigned int coring = 0;
79 82
80/* API features (turn on/off stuff for testing) */ 83/* API features (turn on/off stuff for testing) */
81static unsigned int v4l2 = 1; 84static unsigned int v4l2 = 1;
@@ -106,6 +109,9 @@ module_param(adc_crush, int, 0444);
106module_param(whitecrush_upper, int, 0444); 109module_param(whitecrush_upper, int, 0444);
107module_param(whitecrush_lower, int, 0444); 110module_param(whitecrush_lower, int, 0444);
108module_param(vcr_hack, int, 0444); 111module_param(vcr_hack, int, 0444);
112module_param(uv_ratio, int, 0444);
113module_param(full_luma_range, int, 0444);
114module_param(coring, int, 0444);
109 115
110module_param_array(radio, int, NULL, 0444); 116module_param_array(radio, int, NULL, 0444);
111 117
@@ -124,6 +130,9 @@ MODULE_PARM_DESC(whitecrush_upper,"sets the white crush upper value, default is
124MODULE_PARM_DESC(whitecrush_lower,"sets the white crush lower value, default is 127"); 130MODULE_PARM_DESC(whitecrush_lower,"sets the white crush lower value, default is 127");
125MODULE_PARM_DESC(vcr_hack,"enables the VCR hack (improves synch on poor VCR tapes), default is 0 (no)"); 131MODULE_PARM_DESC(vcr_hack,"enables the VCR hack (improves synch on poor VCR tapes), default is 0 (no)");
126MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler"); 132MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler");
133MODULE_PARM_DESC(uv_ratio,"ratio between u and v gains, default is 50");
134MODULE_PARM_DESC(full_luma_range,"use the full luma range, default is 0 (no)");
135MODULE_PARM_DESC(coring,"set the luma coring level, default is 0 (no)");
127 136
128MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); 137MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards");
129MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); 138MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr");
@@ -484,7 +493,10 @@ static const unsigned int BTTV_FORMATS = ARRAY_SIZE(bttv_formats);
484#define V4L2_CID_PRIVATE_VCR_HACK (V4L2_CID_PRIVATE_BASE + 5) 493#define V4L2_CID_PRIVATE_VCR_HACK (V4L2_CID_PRIVATE_BASE + 5)
485#define V4L2_CID_PRIVATE_WHITECRUSH_UPPER (V4L2_CID_PRIVATE_BASE + 6) 494#define V4L2_CID_PRIVATE_WHITECRUSH_UPPER (V4L2_CID_PRIVATE_BASE + 6)
486#define V4L2_CID_PRIVATE_WHITECRUSH_LOWER (V4L2_CID_PRIVATE_BASE + 7) 495#define V4L2_CID_PRIVATE_WHITECRUSH_LOWER (V4L2_CID_PRIVATE_BASE + 7)
487#define V4L2_CID_PRIVATE_LASTP1 (V4L2_CID_PRIVATE_BASE + 8) 496#define V4L2_CID_PRIVATE_UV_RATIO (V4L2_CID_PRIVATE_BASE + 8)
497#define V4L2_CID_PRIVATE_FULL_LUMA_RANGE (V4L2_CID_PRIVATE_BASE + 9)
498#define V4L2_CID_PRIVATE_CORING (V4L2_CID_PRIVATE_BASE + 10)
499#define V4L2_CID_PRIVATE_LASTP1 (V4L2_CID_PRIVATE_BASE + 11)
488 500
489static const struct v4l2_queryctrl no_ctl = { 501static const struct v4l2_queryctrl no_ctl = {
490 .name = "42", 502 .name = "42",
@@ -618,8 +630,32 @@ static const struct v4l2_queryctrl bttv_ctls[] = {
618 .step = 1, 630 .step = 1,
619 .default_value = 0x7F, 631 .default_value = 0x7F,
620 .type = V4L2_CTRL_TYPE_INTEGER, 632 .type = V4L2_CTRL_TYPE_INTEGER,
633 },{
634 .id = V4L2_CID_PRIVATE_UV_RATIO,
635 .name = "uv ratio",
636 .minimum = 0,
637 .maximum = 100,
638 .step = 1,
639 .default_value = 50,
640 .type = V4L2_CTRL_TYPE_INTEGER,
641 },{
642 .id = V4L2_CID_PRIVATE_FULL_LUMA_RANGE,
643 .name = "full luma range",
644 .minimum = 0,
645 .maximum = 1,
646 .type = V4L2_CTRL_TYPE_BOOLEAN,
647 },{
648 .id = V4L2_CID_PRIVATE_CORING,
649 .name = "coring",
650 .minimum = 0,
651 .maximum = 3,
652 .step = 1,
653 .default_value = 0,
654 .type = V4L2_CTRL_TYPE_INTEGER,
621 } 655 }
622 656
657
658
623}; 659};
624static const int BTTV_CTLS = ARRAY_SIZE(bttv_ctls); 660static const int BTTV_CTLS = ARRAY_SIZE(bttv_ctls);
625 661
@@ -833,8 +869,8 @@ static void bt848_sat(struct bttv *btv, int color)
833 btv->saturation = color; 869 btv->saturation = color;
834 870
835 /* 0-511 for the color */ 871 /* 0-511 for the color */
836 val_u = color >> 7; 872 val_u = ((color * btv->opt_uv_ratio) / 50) >> 7;
837 val_v = ((color>>7)*180L)/254; 873 val_v = (((color * (100 - btv->opt_uv_ratio) / 50) >>7)*180L)/254;
838 hibits = (val_u >> 7) & 2; 874 hibits = (val_u >> 7) & 2;
839 hibits |= (val_v >> 8) & 1; 875 hibits |= (val_v >> 8) & 1;
840 btwrite(val_u & 0xff, BT848_SAT_U_LO); 876 btwrite(val_u & 0xff, BT848_SAT_U_LO);
@@ -1151,6 +1187,15 @@ static int get_control(struct bttv *btv, struct v4l2_control *c)
1151 case V4L2_CID_PRIVATE_WHITECRUSH_LOWER: 1187 case V4L2_CID_PRIVATE_WHITECRUSH_LOWER:
1152 c->value = btv->opt_whitecrush_lower; 1188 c->value = btv->opt_whitecrush_lower;
1153 break; 1189 break;
1190 case V4L2_CID_PRIVATE_UV_RATIO:
1191 c->value = btv->opt_uv_ratio;
1192 break;
1193 case V4L2_CID_PRIVATE_FULL_LUMA_RANGE:
1194 c->value = btv->opt_full_luma_range;
1195 break;
1196 case V4L2_CID_PRIVATE_CORING:
1197 c->value = btv->opt_coring;
1198 break;
1154 default: 1199 default:
1155 return -EINVAL; 1200 return -EINVAL;
1156 } 1201 }
@@ -1247,6 +1292,18 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
1247 btv->opt_whitecrush_lower = c->value; 1292 btv->opt_whitecrush_lower = c->value;
1248 btwrite(c->value, BT848_WC_DOWN); 1293 btwrite(c->value, BT848_WC_DOWN);
1249 break; 1294 break;
1295 case V4L2_CID_PRIVATE_UV_RATIO:
1296 btv->opt_uv_ratio = c->value;
1297 bt848_sat(btv, btv->saturation);
1298 break;
1299 case V4L2_CID_PRIVATE_FULL_LUMA_RANGE:
1300 btv->opt_full_luma_range = c->value;
1301 btaor((c->value<<7), ~BT848_OFORM_RANGE, BT848_OFORM);
1302 break;
1303 case V4L2_CID_PRIVATE_CORING:
1304 btv->opt_coring = c->value;
1305 btaor((c->value<<5), ~BT848_OFORM_CORE32, BT848_OFORM);
1306 break;
1250 default: 1307 default:
1251 return -EINVAL; 1308 return -EINVAL;
1252 } 1309 }
@@ -3117,11 +3174,6 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
3117 return -EINVAL; 3174 return -EINVAL;
3118 memset(v,0,sizeof(*v)); 3175 memset(v,0,sizeof(*v));
3119 strcpy(v->name, "Radio"); 3176 strcpy(v->name, "Radio");
3120 /* japan: 76.0 MHz - 89.9 MHz
3121 western europe: 87.5 MHz - 108.0 MHz
3122 russia: 65.0 MHz - 108.0 MHz */
3123 v->rangelow=(int)(65*16);
3124 v->rangehigh=(int)(108*16);
3125 bttv_call_i2c_clients(btv,cmd,v); 3177 bttv_call_i2c_clients(btv,cmd,v);
3126 return 0; 3178 return 0;
3127 } 3179 }
@@ -3876,6 +3928,9 @@ static int __devinit bttv_probe(struct pci_dev *dev,
3876 btv->opt_vcr_hack = vcr_hack; 3928 btv->opt_vcr_hack = vcr_hack;
3877 btv->opt_whitecrush_upper = whitecrush_upper; 3929 btv->opt_whitecrush_upper = whitecrush_upper;
3878 btv->opt_whitecrush_lower = whitecrush_lower; 3930 btv->opt_whitecrush_lower = whitecrush_lower;
3931 btv->opt_uv_ratio = uv_ratio;
3932 btv->opt_full_luma_range = full_luma_range;
3933 btv->opt_coring = coring;
3879 3934
3880 /* fill struct bttv with some useful defaults */ 3935 /* fill struct bttv with some useful defaults */
3881 btv->init.btv = btv; 3936 btv->init.btv = btv;
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h
index 7b6f1e856028..f3293e4a15ad 100644
--- a/drivers/media/video/bttvp.h
+++ b/drivers/media/video/bttvp.h
@@ -1,5 +1,5 @@
1/* 1/*
2 $Id: bttvp.h,v 1.17 2005/02/16 12:14:10 kraxel Exp $ 2 $Id: bttvp.h,v 1.19 2005/06/16 21:38:45 nsh Exp $
3 3
4 bttv - Bt848 frame grabber driver 4 bttv - Bt848 frame grabber driver
5 5
@@ -326,6 +326,9 @@ struct bttv {
326 int opt_vcr_hack; 326 int opt_vcr_hack;
327 int opt_whitecrush_upper; 327 int opt_whitecrush_upper;
328 int opt_whitecrush_lower; 328 int opt_whitecrush_lower;
329 int opt_uv_ratio;
330 int opt_full_luma_range;
331 int opt_coring;
329 332
330 /* radio data/state */ 333 /* radio data/state */
331 int has_radio; 334 int has_radio;