diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-04-02 12:35:00 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 00:57:38 -0400 |
commit | c7c0b34c27bbf0671807e902fbfea6270c8f138d (patch) | |
tree | 2d44aae2ae76ee47ca12262967ac5711bcc047b6 /drivers/media/video/tvp5150.c | |
parent | b7f8292c96463810edfecff70dd4631d47e5a36b (diff) |
V4L/DVB (3712): Fix video input setting of em28xx, use _INT_S_VIDEO_ROUTING in tvp5150
- Use new routing input defines in em28xx-cards.c
- Fix S-Video settings for tvp5150-based cards (input was copied from saa7115
based cards and worked only because S-Video was selected in the default: case)
- Replace VIDIOC_S_INPUT by VIDIOC_INT_S_VIDEO_ROUTING in em28xx-video.c
- Remove the now obsolete VIDIOC_S_INPUT handler in saa7115.c
- Add VIDIOC_INT_G/S_VIDEO_ROUTING in tvp5150.c
- Add new media/tvp5150.h with the routing defines.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tvp5150.c')
-rw-r--r-- | drivers/media/video/tvp5150.c | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index dab4973bcf82..b167ffab2520 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/delay.h> | 10 | #include <linux/delay.h> |
11 | #include <linux/video_decoder.h> | 11 | #include <linux/video_decoder.h> |
12 | #include <media/v4l2-common.h> | 12 | #include <media/v4l2-common.h> |
13 | #include <media/tvp5150.h> | ||
13 | 14 | ||
14 | #include "tvp5150_reg.h" | 15 | #include "tvp5150_reg.h" |
15 | 16 | ||
@@ -89,7 +90,7 @@ struct tvp5150 { | |||
89 | struct i2c_client *client; | 90 | struct i2c_client *client; |
90 | 91 | ||
91 | v4l2_std_id norm; /* Current set standard */ | 92 | v4l2_std_id norm; /* Current set standard */ |
92 | int input; | 93 | struct v4l2_routing route; |
93 | int enable; | 94 | int enable; |
94 | int bright; | 95 | int bright; |
95 | int contrast; | 96 | int contrast; |
@@ -283,29 +284,26 @@ static void dump_reg(struct i2c_client *c) | |||
283 | /**************************************************************************** | 284 | /**************************************************************************** |
284 | Basic functions | 285 | Basic functions |
285 | ****************************************************************************/ | 286 | ****************************************************************************/ |
286 | enum tvp5150_input { | ||
287 | TVP5150_ANALOG_CH0 = 0, | ||
288 | TVP5150_SVIDEO = 1, | ||
289 | TVP5150_ANALOG_CH1 = 2, | ||
290 | TVP5150_BLACK_SCREEN = 8 | ||
291 | }; | ||
292 | 287 | ||
293 | static inline void tvp5150_selmux(struct i2c_client *c, | 288 | static inline void tvp5150_selmux(struct i2c_client *c) |
294 | enum tvp5150_input input) | ||
295 | { | 289 | { |
296 | int opmode=0; | 290 | int opmode=0; |
297 | |||
298 | struct tvp5150 *decoder = i2c_get_clientdata(c); | 291 | struct tvp5150 *decoder = i2c_get_clientdata(c); |
292 | int input = 0; | ||
299 | 293 | ||
300 | if (!decoder->enable) | 294 | if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable) |
301 | input |= TVP5150_BLACK_SCREEN; | 295 | input = 8; |
302 | 296 | ||
303 | switch (input) { | 297 | switch (input) { |
304 | case TVP5150_ANALOG_CH0: | 298 | case TVP5150_COMPOSITE1: |
305 | case TVP5150_ANALOG_CH1: | 299 | input |= 2; |
300 | /* fall through */ | ||
301 | case TVP5150_COMPOSITE0: | ||
306 | opmode=0x30; /* TV Mode */ | 302 | opmode=0x30; /* TV Mode */ |
307 | break; | 303 | break; |
304 | case TVP5150_SVIDEO: | ||
308 | default: | 305 | default: |
306 | input |= 1; | ||
309 | opmode=0; /* Auto Mode */ | 307 | opmode=0; /* Auto Mode */ |
310 | break; | 308 | break; |
311 | } | 309 | } |
@@ -790,7 +788,7 @@ static inline void tvp5150_reset(struct i2c_client *c) | |||
790 | tvp5150_vdp_init(c, vbi_ram_default); | 788 | tvp5150_vdp_init(c, vbi_ram_default); |
791 | 789 | ||
792 | /* Selects decoder input */ | 790 | /* Selects decoder input */ |
793 | tvp5150_selmux(c, decoder->input); | 791 | tvp5150_selmux(c); |
794 | 792 | ||
795 | /* Initializes TVP5150 to stream enabled values */ | 793 | /* Initializes TVP5150 to stream enabled values */ |
796 | tvp5150_write_inittab(c, tvp5150_init_enable); | 794 | tvp5150_write_inittab(c, tvp5150_init_enable); |
@@ -860,6 +858,21 @@ static int tvp5150_command(struct i2c_client *c, | |||
860 | case VIDIOC_INT_RESET: | 858 | case VIDIOC_INT_RESET: |
861 | tvp5150_reset(c); | 859 | tvp5150_reset(c); |
862 | break; | 860 | break; |
861 | case VIDIOC_INT_G_VIDEO_ROUTING: | ||
862 | { | ||
863 | struct v4l2_routing *route = arg; | ||
864 | |||
865 | *route = decoder->route; | ||
866 | break; | ||
867 | } | ||
868 | case VIDIOC_INT_S_VIDEO_ROUTING: | ||
869 | { | ||
870 | struct v4l2_routing *route = arg; | ||
871 | |||
872 | decoder->route = *route; | ||
873 | tvp5150_selmux(c); | ||
874 | break; | ||
875 | } | ||
863 | case VIDIOC_S_STD: | 876 | case VIDIOC_S_STD: |
864 | if (decoder->norm == *(v4l2_std_id *)arg) | 877 | if (decoder->norm == *(v4l2_std_id *)arg) |
865 | break; | 878 | break; |
@@ -1063,7 +1076,7 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter, | |||
1063 | rv = i2c_attach_client(c); | 1076 | rv = i2c_attach_client(c); |
1064 | 1077 | ||
1065 | core->norm = V4L2_STD_ALL; /* Default is autodetect */ | 1078 | core->norm = V4L2_STD_ALL; /* Default is autodetect */ |
1066 | core->input = 2; | 1079 | core->route.input = TVP5150_COMPOSITE1; |
1067 | core->enable = 1; | 1080 | core->enable = 1; |
1068 | core->bright = 32768; | 1081 | core->bright = 32768; |
1069 | core->contrast = 32768; | 1082 | core->contrast = 32768; |