Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3904
b: refs/heads/master
c: 060d302
h: refs/heads/master
v: v3
  • Loading branch information
Mauro Carvalho Chehab authored and Linus Torvalds committed Jun 29, 2005
1 parent b691cd9 commit a0c1570
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 586b0cab2516640fec4dffc3049c4d8bca188f89
refs/heads/master: 060d3027f26aab9adeac8ff6d1184bca67c7d174
73 changes: 64 additions & 9 deletions trunk/drivers/media/video/bttv-driver.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
$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
Expand Down Expand Up @@ -76,6 +76,9 @@ static unsigned int whitecrush_upper = 0xCF;
static unsigned int whitecrush_lower = 0x7F;
static unsigned int vcr_hack = 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) */
static unsigned int v4l2 = 1;
Expand Down Expand Up @@ -106,6 +109,9 @@ module_param(adc_crush, int, 0444);
module_param(whitecrush_upper, int, 0444);
module_param(whitecrush_lower, 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);

Expand All @@ -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(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(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_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr");
Expand Down Expand Up @@ -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_WHITECRUSH_UPPER (V4L2_CID_PRIVATE_BASE + 6)
#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 = {
.name = "42",
Expand Down Expand Up @@ -618,8 +630,32 @@ static const struct v4l2_queryctrl bttv_ctls[] = {
.step = 1,
.default_value = 0x7F,
.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);

Expand Down Expand Up @@ -833,8 +869,8 @@ static void bt848_sat(struct bttv *btv, int color)
btv->saturation = color;

/* 0-511 for the color */
val_u = color >> 7;
val_v = ((color>>7)*180L)/254;
val_u = ((color * btv->opt_uv_ratio) / 50) >> 7;
val_v = (((color * (100 - btv->opt_uv_ratio) / 50) >>7)*180L)/254;
hibits = (val_u >> 7) & 2;
hibits |= (val_v >> 8) & 1;
btwrite(val_u & 0xff, BT848_SAT_U_LO);
Expand Down Expand Up @@ -1151,6 +1187,15 @@ static int get_control(struct bttv *btv, struct v4l2_control *c)
case V4L2_CID_PRIVATE_WHITECRUSH_LOWER:
c->value = btv->opt_whitecrush_lower;
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:
return -EINVAL;
}
Expand Down Expand Up @@ -1247,6 +1292,18 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
btv->opt_whitecrush_lower = c->value;
btwrite(c->value, BT848_WC_DOWN);
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:
return -EINVAL;
}
Expand Down Expand Up @@ -3117,11 +3174,6 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
return -EINVAL;
memset(v,0,sizeof(*v));
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);
return 0;
}
Expand Down Expand Up @@ -3876,6 +3928,9 @@ static int __devinit bttv_probe(struct pci_dev *dev,
btv->opt_vcr_hack = vcr_hack;
btv->opt_whitecrush_upper = whitecrush_upper;
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 */
btv->init.btv = btv;
Expand Down
5 changes: 4 additions & 1 deletion trunk/drivers/media/video/bttvp.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
$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
Expand Down Expand Up @@ -326,6 +326,9 @@ struct bttv {
int opt_vcr_hack;
int opt_whitecrush_upper;
int opt_whitecrush_lower;
int opt_uv_ratio;
int opt_full_luma_range;
int opt_coring;

/* radio data/state */
int has_radio;
Expand Down

0 comments on commit a0c1570

Please sign in to comment.