aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video/tvp5150.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2005-11-08 21:36:43 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 07:56:11 -0800
commit4c86f973ba0f49af1f4c54ff3d1935093c173450 (patch)
treea2aa739d81861e081f04aa9cd9514596a20efefd /drivers/media/video/tvp5150.c
parent83331624aac006b615f6853aacd28aef3111ef07 (diff)
[PATCH] v4l: 678: fixed input selection
- Fixed input selection. Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/tvp5150.c')
-rw-r--r--drivers/media/video/tvp5150.c62
1 files changed, 54 insertions, 8 deletions
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index bd1201d7adf..6e3ba23104d 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -397,6 +397,7 @@ enum tvp5150_input {
static inline void tvp5150_selmux(struct i2c_client *c,
enum tvp5150_input input)
{
+ struct tvp5150 *decoder = i2c_get_clientdata(c);
int tvp_input;
/* FIXME: It is dependent of basic driver */
@@ -415,11 +416,16 @@ static inline void tvp5150_selmux(struct i2c_client *c,
tvp_input=TVP5150_BLACK_SCREEN;
}
+ if (!decoder->enable)
+ tvp_input|=TVP5150_BLACK_SCREEN;
+
tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, tvp_input);
};
static inline void tvp5150_reset(struct i2c_client *c)
{
+ struct tvp5150 *decoder = i2c_get_clientdata(c);
+
tvp5150_write(c, TVP5150_CONF_SHARED_PIN, 2);
/* Automatic offset and AGC enabled */
@@ -431,13 +437,13 @@ static inline void tvp5150_reset(struct i2c_client *c)
/* Activate YCrCb output 0x9 or 0xd ? */
tvp5150_write(c, TVP5150_MISC_CTL, 0x6f);
- /* Activates video std autodetection for PAL/M and PAL/N */
- tvp5150_write(c, TVP5150_AUTOSW_MSK, 0xf0);
+ /* Activates video std autodetection for all standards */
+ tvp5150_write(c, TVP5150_AUTOSW_MSK, 0x0);
/* Default format: 0x47, 4:2:2: 0x40 */
tvp5150_write(c, TVP5150_DATA_RATE_SEL, 0x47);
- tvp5150_selmux(c, TVP5150_ANALOG_CH0);
+ tvp5150_selmux(c, decoder->input);
tvp5150_write(c, TVP5150_CHROMA_PROC_CTL_1, 0x0c);
tvp5150_write(c, TVP5150_CHROMA_PROC_CTL_2, 0x54);
@@ -446,7 +452,10 @@ static inline void tvp5150_reset(struct i2c_client *c)
tvp5150_write(c, TVP5150_VIDEO_STD, 0x0); /* Auto switch */
- tvp5150_write(c, TVP5150_HUE_CTL, 0x0);
+ tvp5150_write(c, TVP5150_BRIGHT_CTL, decoder->bright >> 8);
+ tvp5150_write(c, TVP5150_CONTRAST_CTL, decoder->contrast >> 8);
+ tvp5150_write(c, TVP5150_SATURATION_CTL, decoder->contrast >> 8);
+ tvp5150_write(c, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8);
};
/****************************************************************************
@@ -523,7 +532,8 @@ static int tvp5150_command(struct i2c_client *client,
return -EINVAL;
}
- tvp5150_selmux(client, *iarg);
+ decoder->input=*iarg;
+ tvp5150_selmux(client, decoder->input);
break;
}
@@ -538,12 +548,40 @@ static int tvp5150_command(struct i2c_client *client,
break;
}
case DECODER_ENABLE_OUTPUT:
-// int *iarg = arg;
-// int enable = (*iarg != 0);
+ {
+ int *iarg = arg;
- break;
+ decoder->enable = (*iarg != 0);
+
+ tvp5150_selmux(client, decoder->input);
+ break;
+ }
case DECODER_SET_PICTURE:
+ {
+ struct video_picture *pic = arg;
+ if (decoder->bright != pic->brightness) {
+ /* We want 0 to 255 we get 0-65535 */
+ decoder->bright = pic->brightness;
+ tvp5150_write(client, TVP5150_BRIGHT_CTL, decoder->bright >> 8);
+ }
+ if (decoder->contrast != pic->contrast) {
+ /* We want 0 to 255 we get 0-65535 */
+ decoder->contrast = pic->contrast;
+ tvp5150_write(client, TVP5150_CONTRAST_CTL, decoder->contrast >> 8);
+ }
+ if (decoder->sat != pic->colour) {
+ /* We want 0 to 255 we get 0-65535 */
+ decoder->sat = pic->colour;
+ tvp5150_write(client, TVP5150_SATURATION_CTL, decoder->contrast >> 8);
+ }
+ if (decoder->hue != pic->hue) {
+ /* We want -128 to 127 we get 0-65535 */
+ decoder->hue = pic->hue;
+ tvp5150_write(client, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8);
+ }
+ break;
+ }
default:
return -EINVAL;
}
@@ -599,6 +637,14 @@ static int tvp5150_detect_client (struct i2c_adapter *adapter,
rv = i2c_attach_client(client);
+ core->norm = VIDEO_MODE_AUTO;
+ core->input = 2;
+ core->enable = 1;
+ core->bright = 32768;
+ core->contrast = 32768;
+ core->hue = 32768;
+ core->sat = 32768;
+
if (rv) {
kfree(client);
kfree(core);