diff options
author | Mauro Carvalho Chehab <devnull@localhost> | 2005-09-23 11:58:27 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <devnull@localhost> | 2005-09-23 11:58:27 +0000 |
commit | 979e39a0d60f174bc227a34a8ae90ca57236a2cc (patch) | |
tree | f26f34c1632247f1e5e3e8983861a8e6aafc3111 /linux/drivers/media/video/tvp5150.c | |
parent | 5db127d622e8f1098378e424afe1f95603e47cbc (diff) | |
download | mediapointer-dvb-s2-979e39a0d60f174bc227a34a8ae90ca57236a2cc.tar.gz mediapointer-dvb-s2-979e39a0d60f174bc227a34a8ae90ca57236a2cc.tar.bz2 |
- Fixed input selection.
- Default now is to autodetect every video standard.
- Implemented interface to change video preferences.
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'linux/drivers/media/video/tvp5150.c')
-rw-r--r-- | linux/drivers/media/video/tvp5150.c | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/linux/drivers/media/video/tvp5150.c b/linux/drivers/media/video/tvp5150.c index 5bc543ae2..91b26507d 100644 --- a/linux/drivers/media/video/tvp5150.c +++ b/linux/drivers/media/video/tvp5150.c @@ -401,6 +401,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 */ @@ -419,11 +420,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 */ @@ -435,13 +441,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); @@ -450,7 +456,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); }; /**************************************************************************** @@ -563,7 +572,8 @@ static int tvp5150_command(struct i2c_client *client, return -EINVAL; } - tvp5150_selmux(client, *iarg); + decoder->input=*iarg; + tvp5150_selmux(client, decoder->input); break; } @@ -578,37 +588,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: -#if 0 + { struct video_picture *pic = arg; if (decoder->bright != pic->brightness) { /* We want 0 to 255 we get 0-65535 */ decoder->bright = pic->brightness; - saa7113_write(client, 0x0a, decoder->bright >> 8); + tvp5150_write(client, TVP5150_BRIGHT_CTL, decoder->bright >> 8); } if (decoder->contrast != pic->contrast) { - /* We want 0 to 127 we get 0-65535 */ + /* We want 0 to 255 we get 0-65535 */ decoder->contrast = pic->contrast; - saa7113_write(client, 0x0b, decoder->contrast >> 9); + tvp5150_write(client, TVP5150_CONTRAST_CTL, decoder->contrast >> 8); } if (decoder->sat != pic->colour) { - /* We want 0 to 127 we get 0-65535 */ + /* We want 0 to 255 we get 0-65535 */ decoder->sat = pic->colour; - saa7113_write(client, 0x0c, decoder->sat >> 9); + 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; - saa7113_write(client, 0x0d, - (decoder->hue - 32768) >> 8); + tvp5150_write(client, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8); } break; -#endif + } default: return -EINVAL; } @@ -664,6 +677,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); |