Re: [PATCH] bt8xx: Add video4linux control V4L2_CID_COLOR_KILLER.
Oi Guilherme, Em Thu, 13 Sep 2012 14:12:11 -0300 Guilherme Herrmann Destefani linu...@destefani.eng.br escreveu: Added V4L2_CID_COLOR_KILLER control to the bt8xx driver. The control V4L2_CID_PRIVATE_CHROMA_AGC was changed too because with this change the bttv driver must touch two bits in the SC Loop Control Registers, for controls V4L2_CID_COLOR_KILLER and V4L2_CID_PRIVATE_CHROMA_AGC. --- Documentation/video4linux/bttv/Insmod-options | 1 + drivers/media/video/bt8xx/bttv-driver.c | 36 --- drivers/media/video/bt8xx/bttvp.h | 1 + 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Documentation/video4linux/bttv/Insmod-options b/Documentation/video4linux/bttv/Insmod-options index 14c065fa..089e961 100644 --- a/Documentation/video4linux/bttv/Insmod-options +++ b/Documentation/video4linux/bttv/Insmod-options @@ -53,6 +53,7 @@ bttv.o quality which leading to unwanted sound dropouts. chroma_agc=0/1 AGC of chroma signal, off by default. + color_killer=0/1 Low color detection and removal, off by default adc_crush=0/1 Luminance ADC crush, on by default. i2c_udelay= Allow reduce I2C speed. Default is 5 usecs (meaning 66,67 Kbps). The default is the diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index e581b37..7208d5a 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -93,6 +93,7 @@ static unsigned int combfilter; static unsigned int lumafilter; static unsigned int automute= 1; static unsigned int chroma_agc; +static unsigned int color_killer; static unsigned int adc_crush = 1; static unsigned int whitecrush_upper = 0xCF; static unsigned int whitecrush_lower = 0x7F; @@ -125,6 +126,7 @@ module_param(combfilter,int, 0444); module_param(lumafilter,int, 0444); module_param(automute, int, 0444); module_param(chroma_agc,int, 0444); +module_param(color_killer, int, 0444); module_param(adc_crush, int, 0444); module_param(whitecrush_upper, int, 0444); module_param(whitecrush_lower, int, 0444); @@ -151,6 +153,7 @@ MODULE_PARM_DESC(reset_crop,reset cropping parameters at open(), default is 1 (yes) for compatibility with older applications); MODULE_PARM_DESC(automute,mute audio on bad/missing video signal, default is 1 (yes)); MODULE_PARM_DESC(chroma_agc,enables the AGC of chroma signal, default is 0 (no)); +MODULE_PARM_DESC(color_killer,enables the low color detector and removal, default is 0 (no)); Why to add a parameter here? No other driver uses insmod parameter to configure controls. Ok, this driver is legacy, so, most of those stuff are there since nobody cared enough to remove those things, but let's not add more things here. MODULE_PARM_DESC(adc_crush,enables the luminance ADC crush, default is 1 (yes)); MODULE_PARM_DESC(whitecrush_upper,sets the white crush upper value, default is 207); MODULE_PARM_DESC(whitecrush_lower,sets the white crush lower value, default is 127); @@ -674,6 +677,12 @@ static const struct v4l2_queryctrl bttv_ctls[] = { .default_value = 32768, .type = V4L2_CTRL_TYPE_INTEGER, },{ + .id= V4L2_CID_COLOR_KILLER, + .name = Color killer, + .minimum = 0, + .maximum = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + },{ .id= V4L2_CID_HUE, .name = Hue, .minimum = 0, @@ -1412,6 +1421,8 @@ static void init_bt848(struct bttv *btv) BT848_GPIO_DMA_CTL); val = btv-opt_chroma_agc ? BT848_SCLOOP_CAGC : 0; + if (btv-opt_color_killer) + val |= BT848_SCLOOP_CKILL; btwrite(val, BT848_E_SCLOOP); btwrite(val, BT848_O_SCLOOP); @@ -1475,6 +1486,9 @@ static int bttv_g_ctrl(struct file *file, void *priv, case V4L2_CID_SATURATION: c-value = btv-saturation; break; + case V4L2_CID_COLOR_KILLER: + c-value = btv-opt_color_killer; + break; case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_VOLUME: @@ -1527,7 +1541,6 @@ static int bttv_s_ctrl(struct file *file, void *f, struct v4l2_control *c) { int err; - int val; struct bttv_fh *fh = f; struct bttv *btv = fh-btv; @@ -1548,6 +1561,16 @@ static int bttv_s_ctrl(struct file *file, void *f, case V4L2_CID_SATURATION: bt848_sat(btv, c-value); break; + case V4L2_CID_COLOR_KILLER: + btv-opt_color_killer = c-value; + if
[PATCH] bt8xx: Add video4linux control V4L2_CID_COLOR_KILLER.
Added V4L2_CID_COLOR_KILLER control to the bt8xx driver. The control V4L2_CID_PRIVATE_CHROMA_AGC was changed too because with this change the bttv driver must touch two bits in the SC Loop Control Registers, for controls V4L2_CID_COLOR_KILLER and V4L2_CID_PRIVATE_CHROMA_AGC. --- Documentation/video4linux/bttv/Insmod-options | 1 + drivers/media/video/bt8xx/bttv-driver.c | 36 --- drivers/media/video/bt8xx/bttvp.h | 1 + 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Documentation/video4linux/bttv/Insmod-options b/Documentation/video4linux/bttv/Insmod-options index 14c065fa..089e961 100644 --- a/Documentation/video4linux/bttv/Insmod-options +++ b/Documentation/video4linux/bttv/Insmod-options @@ -53,6 +53,7 @@ bttv.o quality which leading to unwanted sound dropouts. chroma_agc=0/1 AGC of chroma signal, off by default. + color_killer=0/1 Low color detection and removal, off by default adc_crush=0/1 Luminance ADC crush, on by default. i2c_udelay= Allow reduce I2C speed. Default is 5 usecs (meaning 66,67 Kbps). The default is the diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index e581b37..7208d5a 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -93,6 +93,7 @@ static unsigned int combfilter; static unsigned int lumafilter; static unsigned int automute= 1; static unsigned int chroma_agc; +static unsigned int color_killer; static unsigned int adc_crush = 1; static unsigned int whitecrush_upper = 0xCF; static unsigned int whitecrush_lower = 0x7F; @@ -125,6 +126,7 @@ module_param(combfilter,int, 0444); module_param(lumafilter,int, 0444); module_param(automute, int, 0444); module_param(chroma_agc,int, 0444); +module_param(color_killer, int, 0444); module_param(adc_crush, int, 0444); module_param(whitecrush_upper, int, 0444); module_param(whitecrush_lower, int, 0444); @@ -151,6 +153,7 @@ MODULE_PARM_DESC(reset_crop,reset cropping parameters at open(), default is 1 (yes) for compatibility with older applications); MODULE_PARM_DESC(automute,mute audio on bad/missing video signal, default is 1 (yes)); MODULE_PARM_DESC(chroma_agc,enables the AGC of chroma signal, default is 0 (no)); +MODULE_PARM_DESC(color_killer,enables the low color detector and removal, default is 0 (no)); MODULE_PARM_DESC(adc_crush,enables the luminance ADC crush, default is 1 (yes)); MODULE_PARM_DESC(whitecrush_upper,sets the white crush upper value, default is 207); MODULE_PARM_DESC(whitecrush_lower,sets the white crush lower value, default is 127); @@ -674,6 +677,12 @@ static const struct v4l2_queryctrl bttv_ctls[] = { .default_value = 32768, .type = V4L2_CTRL_TYPE_INTEGER, },{ + .id= V4L2_CID_COLOR_KILLER, + .name = Color killer, + .minimum = 0, + .maximum = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + },{ .id= V4L2_CID_HUE, .name = Hue, .minimum = 0, @@ -1412,6 +1421,8 @@ static void init_bt848(struct bttv *btv) BT848_GPIO_DMA_CTL); val = btv-opt_chroma_agc ? BT848_SCLOOP_CAGC : 0; + if (btv-opt_color_killer) + val |= BT848_SCLOOP_CKILL; btwrite(val, BT848_E_SCLOOP); btwrite(val, BT848_O_SCLOOP); @@ -1475,6 +1486,9 @@ static int bttv_g_ctrl(struct file *file, void *priv, case V4L2_CID_SATURATION: c-value = btv-saturation; break; + case V4L2_CID_COLOR_KILLER: + c-value = btv-opt_color_killer; + break; case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_VOLUME: @@ -1527,7 +1541,6 @@ static int bttv_s_ctrl(struct file *file, void *f, struct v4l2_control *c) { int err; - int val; struct bttv_fh *fh = f; struct bttv *btv = fh-btv; @@ -1548,6 +1561,16 @@ static int bttv_s_ctrl(struct file *file, void *f, case V4L2_CID_SATURATION: bt848_sat(btv, c-value); break; + case V4L2_CID_COLOR_KILLER: + btv-opt_color_killer = c-value; + if (btv-opt_color_killer) { + btor(BT848_SCLOOP_CKILL, BT848_E_SCLOOP); + btor(BT848_SCLOOP_CKILL, BT848_O_SCLOOP); + } else { + btand(~BT848_SCLOOP_CKILL, BT848_E_SCLOOP); + btand(~BT848_SCLOOP_CKILL, BT848_O_SCLOOP); + } + break; case