Commit 060d3027 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Linus Torvalds

[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: default avatarJorik Jonker <jorik@dnd.utwente.nl>
Signed-off-by: default avatarSylvain Meyer <sylvain.meyer@worldonline.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: default avatarNickolay V Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 586b0cab
/* /*
$Id: bttv-driver.c,v 1.38 2005/06/10 17:20:24 mchehab Exp $ $Id: bttv-driver.c,v 1.40 2005/06/16 21:38:45 nsh Exp $
bttv - Bt848 frame grabber driver bttv - Bt848 frame grabber driver
...@@ -76,6 +76,9 @@ static unsigned int whitecrush_upper = 0xCF; ...@@ -76,6 +76,9 @@ static unsigned int whitecrush_upper = 0xCF;
static unsigned int whitecrush_lower = 0x7F; static unsigned int whitecrush_lower = 0x7F;
static unsigned int vcr_hack = 0; static unsigned int vcr_hack = 0;
static unsigned int irq_iswitch = 0; static unsigned int irq_iswitch = 0;
static unsigned int uv_ratio = 50;
static unsigned int full_luma_range = 0;
static unsigned int coring = 0;
/* API features (turn on/off stuff for testing) */ /* API features (turn on/off stuff for testing) */
static unsigned int v4l2 = 1; static unsigned int v4l2 = 1;
...@@ -106,6 +109,9 @@ module_param(adc_crush, int, 0444); ...@@ -106,6 +109,9 @@ module_param(adc_crush, int, 0444);
module_param(whitecrush_upper, int, 0444); module_param(whitecrush_upper, int, 0444);
module_param(whitecrush_lower, int, 0444); module_param(whitecrush_lower, int, 0444);
module_param(vcr_hack, int, 0444); module_param(vcr_hack, int, 0444);
module_param(uv_ratio, int, 0444);
module_param(full_luma_range, int, 0444);
module_param(coring, int, 0444);
module_param_array(radio, int, NULL, 0444); module_param_array(radio, int, NULL, 0444);
...@@ -124,6 +130,9 @@ MODULE_PARM_DESC(whitecrush_upper,"sets the white crush upper value, default is ...@@ -124,6 +130,9 @@ MODULE_PARM_DESC(whitecrush_upper,"sets the white crush upper value, default is
MODULE_PARM_DESC(whitecrush_lower,"sets the white crush lower value, default is 127"); MODULE_PARM_DESC(whitecrush_lower,"sets the white crush lower value, default is 127");
MODULE_PARM_DESC(vcr_hack,"enables the VCR hack (improves synch on poor VCR tapes), default is 0 (no)"); MODULE_PARM_DESC(vcr_hack,"enables the VCR hack (improves synch on poor VCR tapes), default is 0 (no)");
MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler"); MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler");
MODULE_PARM_DESC(uv_ratio,"ratio between u and v gains, default is 50");
MODULE_PARM_DESC(full_luma_range,"use the full luma range, default is 0 (no)");
MODULE_PARM_DESC(coring,"set the luma coring level, default is 0 (no)");
MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards");
MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr");
...@@ -484,7 +493,10 @@ static const unsigned int BTTV_FORMATS = ARRAY_SIZE(bttv_formats); ...@@ -484,7 +493,10 @@ static const unsigned int BTTV_FORMATS = ARRAY_SIZE(bttv_formats);
#define V4L2_CID_PRIVATE_VCR_HACK (V4L2_CID_PRIVATE_BASE + 5) #define V4L2_CID_PRIVATE_VCR_HACK (V4L2_CID_PRIVATE_BASE + 5)
#define V4L2_CID_PRIVATE_WHITECRUSH_UPPER (V4L2_CID_PRIVATE_BASE + 6) #define V4L2_CID_PRIVATE_WHITECRUSH_UPPER (V4L2_CID_PRIVATE_BASE + 6)
#define V4L2_CID_PRIVATE_WHITECRUSH_LOWER (V4L2_CID_PRIVATE_BASE + 7) #define V4L2_CID_PRIVATE_WHITECRUSH_LOWER (V4L2_CID_PRIVATE_BASE + 7)
#define V4L2_CID_PRIVATE_LASTP1 (V4L2_CID_PRIVATE_BASE + 8) #define V4L2_CID_PRIVATE_UV_RATIO (V4L2_CID_PRIVATE_BASE + 8)
#define V4L2_CID_PRIVATE_FULL_LUMA_RANGE (V4L2_CID_PRIVATE_BASE + 9)
#define V4L2_CID_PRIVATE_CORING (V4L2_CID_PRIVATE_BASE + 10)
#define V4L2_CID_PRIVATE_LASTP1 (V4L2_CID_PRIVATE_BASE + 11)
static const struct v4l2_queryctrl no_ctl = { static const struct v4l2_queryctrl no_ctl = {
.name = "42", .name = "42",
...@@ -618,8 +630,32 @@ static const struct v4l2_queryctrl bttv_ctls[] = { ...@@ -618,8 +630,32 @@ static const struct v4l2_queryctrl bttv_ctls[] = {
.step = 1, .step = 1,
.default_value = 0x7F, .default_value = 0x7F,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
},{
.id = V4L2_CID_PRIVATE_UV_RATIO,
.name = "uv ratio",
.minimum = 0,
.maximum = 100,
.step = 1,
.default_value = 50,
.type = V4L2_CTRL_TYPE_INTEGER,
},{
.id = V4L2_CID_PRIVATE_FULL_LUMA_RANGE,
.name = "full luma range",
.minimum = 0,
.maximum = 1,
.type = V4L2_CTRL_TYPE_BOOLEAN,
},{
.id = V4L2_CID_PRIVATE_CORING,
.name = "coring",
.minimum = 0,
.maximum = 3,
.step = 1,
.default_value = 0,
.type = V4L2_CTRL_TYPE_INTEGER,
} }
}; };
static const int BTTV_CTLS = ARRAY_SIZE(bttv_ctls); static const int BTTV_CTLS = ARRAY_SIZE(bttv_ctls);
...@@ -833,8 +869,8 @@ static void bt848_sat(struct bttv *btv, int color) ...@@ -833,8 +869,8 @@ static void bt848_sat(struct bttv *btv, int color)
btv->saturation = color; btv->saturation = color;
/* 0-511 for the color */ /* 0-511 for the color */
val_u = color >> 7; val_u = ((color * btv->opt_uv_ratio) / 50) >> 7;
val_v = ((color>>7)*180L)/254; val_v = (((color * (100 - btv->opt_uv_ratio) / 50) >>7)*180L)/254;
hibits = (val_u >> 7) & 2; hibits = (val_u >> 7) & 2;
hibits |= (val_v >> 8) & 1; hibits |= (val_v >> 8) & 1;
btwrite(val_u & 0xff, BT848_SAT_U_LO); btwrite(val_u & 0xff, BT848_SAT_U_LO);
...@@ -1151,6 +1187,15 @@ static int get_control(struct bttv *btv, struct v4l2_control *c) ...@@ -1151,6 +1187,15 @@ static int get_control(struct bttv *btv, struct v4l2_control *c)
case V4L2_CID_PRIVATE_WHITECRUSH_LOWER: case V4L2_CID_PRIVATE_WHITECRUSH_LOWER:
c->value = btv->opt_whitecrush_lower; c->value = btv->opt_whitecrush_lower;
break; break;
case V4L2_CID_PRIVATE_UV_RATIO:
c->value = btv->opt_uv_ratio;
break;
case V4L2_CID_PRIVATE_FULL_LUMA_RANGE:
c->value = btv->opt_full_luma_range;
break;
case V4L2_CID_PRIVATE_CORING:
c->value = btv->opt_coring;
break;
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -1247,6 +1292,18 @@ static int set_control(struct bttv *btv, struct v4l2_control *c) ...@@ -1247,6 +1292,18 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
btv->opt_whitecrush_lower = c->value; btv->opt_whitecrush_lower = c->value;
btwrite(c->value, BT848_WC_DOWN); btwrite(c->value, BT848_WC_DOWN);
break; break;
case V4L2_CID_PRIVATE_UV_RATIO:
btv->opt_uv_ratio = c->value;
bt848_sat(btv, btv->saturation);
break;
case V4L2_CID_PRIVATE_FULL_LUMA_RANGE:
btv->opt_full_luma_range = c->value;
btaor((c->value<<7), ~BT848_OFORM_RANGE, BT848_OFORM);
break;
case V4L2_CID_PRIVATE_CORING:
btv->opt_coring = c->value;
btaor((c->value<<5), ~BT848_OFORM_CORE32, BT848_OFORM);
break;
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -3117,11 +3174,6 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, ...@@ -3117,11 +3174,6 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
return -EINVAL; return -EINVAL;
memset(v,0,sizeof(*v)); memset(v,0,sizeof(*v));
strcpy(v->name, "Radio"); strcpy(v->name, "Radio");
/* japan: 76.0 MHz - 89.9 MHz
western europe: 87.5 MHz - 108.0 MHz
russia: 65.0 MHz - 108.0 MHz */
v->rangelow=(int)(65*16);
v->rangehigh=(int)(108*16);
bttv_call_i2c_clients(btv,cmd,v); bttv_call_i2c_clients(btv,cmd,v);
return 0; return 0;
} }
...@@ -3876,6 +3928,9 @@ static int __devinit bttv_probe(struct pci_dev *dev, ...@@ -3876,6 +3928,9 @@ static int __devinit bttv_probe(struct pci_dev *dev,
btv->opt_vcr_hack = vcr_hack; btv->opt_vcr_hack = vcr_hack;
btv->opt_whitecrush_upper = whitecrush_upper; btv->opt_whitecrush_upper = whitecrush_upper;
btv->opt_whitecrush_lower = whitecrush_lower; btv->opt_whitecrush_lower = whitecrush_lower;
btv->opt_uv_ratio = uv_ratio;
btv->opt_full_luma_range = full_luma_range;
btv->opt_coring = coring;
/* fill struct bttv with some useful defaults */ /* fill struct bttv with some useful defaults */
btv->init.btv = btv; btv->init.btv = btv;
......
/* /*
$Id: bttvp.h,v 1.17 2005/02/16 12:14:10 kraxel Exp $ $Id: bttvp.h,v 1.19 2005/06/16 21:38:45 nsh Exp $
bttv - Bt848 frame grabber driver bttv - Bt848 frame grabber driver
...@@ -326,6 +326,9 @@ struct bttv { ...@@ -326,6 +326,9 @@ struct bttv {
int opt_vcr_hack; int opt_vcr_hack;
int opt_whitecrush_upper; int opt_whitecrush_upper;
int opt_whitecrush_lower; int opt_whitecrush_lower;
int opt_uv_ratio;
int opt_full_luma_range;
int opt_coring;
/* radio data/state */ /* radio data/state */
int has_radio; int has_radio;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment