aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2009-03-15 16:53:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:40 -0400
commit2a6b627f8b4594987390ac35d3b344a96af3cfc9 (patch)
tree557e41183f3e99c073879dbb67ca29dbe7a839e8 /drivers/media/video/pvrusb2
parentbb65242aa374e7ebcd32672bc9a0b890bd9117bb (diff)
V4L/DVB (11207): pvrusb2: Add composite and s-video input support for OnAir devices
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pvrusb2')
-rw-r--r--drivers/media/video/pvrusb2/Makefile1
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c95
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-cs53l32a.h48
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-devattr.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-devattr.h1
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-video-v4l.c11
7 files changed, 160 insertions, 2 deletions
diff --git a/drivers/media/video/pvrusb2/Makefile b/drivers/media/video/pvrusb2/Makefile
index a4478618a7fc..de2fc14f043b 100644
--- a/drivers/media/video/pvrusb2/Makefile
+++ b/drivers/media/video/pvrusb2/Makefile
@@ -10,6 +10,7 @@ pvrusb2-objs := pvrusb2-i2c-core.o \
10 pvrusb2-ctrl.o pvrusb2-std.o pvrusb2-devattr.o \ 10 pvrusb2-ctrl.o pvrusb2-std.o pvrusb2-devattr.o \
11 pvrusb2-context.o pvrusb2-io.o pvrusb2-ioread.o \ 11 pvrusb2-context.o pvrusb2-io.o pvrusb2-ioread.o \
12 pvrusb2-cx2584x-v4l.o pvrusb2-wm8775.o \ 12 pvrusb2-cx2584x-v4l.o pvrusb2-wm8775.o \
13 pvrusb2-cs53l32a.o \
13 $(obj-pvrusb2-dvb-y) \ 14 $(obj-pvrusb2-dvb-y) \
14 $(obj-pvrusb2-sysfs-y) $(obj-pvrusb2-debugifc-y) 15 $(obj-pvrusb2-sysfs-y) $(obj-pvrusb2-debugifc-y)
15 16
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c b/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c
new file mode 100644
index 000000000000..b5c3428ebb9f
--- /dev/null
+++ b/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c
@@ -0,0 +1,95 @@
1/*
2 *
3 *
4 * Copyright (C) 2005 Mike Isely <isely@pobox.com>
5 * Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22/*
23
24 This source file is specifically designed to interface with the
25 v4l-dvb cs53l32a module.
26
27*/
28
29#include "pvrusb2-cs53l32a.h"
30
31
32#include "pvrusb2-hdw-internal.h"
33#include "pvrusb2-debug.h"
34#include <linux/videodev2.h>
35#include <media/v4l2-common.h>
36#include <linux/errno.h>
37#include <linux/slab.h>
38
39struct routing_scheme {
40 const int *def;
41 unsigned int cnt;
42};
43
44
45static const int routing_scheme1[] = {
46 [PVR2_CVAL_INPUT_TV] = 2, /* 1 or 2 seems to work here */
47 [PVR2_CVAL_INPUT_RADIO] = 2,
48 [PVR2_CVAL_INPUT_COMPOSITE] = 0,
49 [PVR2_CVAL_INPUT_SVIDEO] = 0,
50};
51
52static const struct routing_scheme routing_schemes[] = {
53 [PVR2_ROUTING_SCHEME_ONAIR] = {
54 .def = routing_scheme1,
55 .cnt = ARRAY_SIZE(routing_scheme1),
56 },
57};
58
59
60void pvr2_cs53l32a_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
61{
62 if (hdw->input_dirty || hdw->force_dirty) {
63 struct v4l2_routing route;
64 const struct routing_scheme *sp;
65 unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
66 pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)",
67 hdw->input_val);
68 if ((sid < ARRAY_SIZE(routing_schemes)) &&
69 ((sp = routing_schemes + sid) != NULL) &&
70 (hdw->input_val >= 0) &&
71 (hdw->input_val < sp->cnt)) {
72 route.input = sp->def[hdw->input_val];
73 } else {
74 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
75 "*** WARNING *** subdev v4l2 set_input:"
76 " Invalid routing scheme (%u)"
77 " and/or input (%d)",
78 sid, hdw->input_val);
79 return;
80 }
81 route.output = 0;
82 sd->ops->audio->s_routing(sd, &route);
83 }
84}
85
86
87/*
88 Stuff for Emacs to see, in order to encourage consistent editing style:
89 *** Local Variables: ***
90 *** mode: c ***
91 *** fill-column: 70 ***
92 *** tab-width: 8 ***
93 *** c-basic-offset: 8 ***
94 *** End: ***
95 */
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.h b/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.h
new file mode 100644
index 000000000000..53ba548b72a7
--- /dev/null
+++ b/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.h
@@ -0,0 +1,48 @@
1/*
2 *
3 *
4 * Copyright (C) 2005 Mike Isely <isely@pobox.com>
5 * Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#ifndef __PVRUSB2_CS53L32A_H
23#define __PVRUSB2_CS53L32A_H
24
25/*
26
27 This module connects the pvrusb2 driver to the I2C chip level
28 driver which handles device video processing. This interface is
29 used internally by the driver; higher level code should only
30 interact through the interface provided by pvrusb2-hdw.h.
31
32*/
33
34
35#include "pvrusb2-hdw-internal.h"
36void pvr2_cs53l32a_subdev_update(struct pvr2_hdw *, struct v4l2_subdev *);
37
38#endif /* __PVRUSB2_AUDIO_CS53L32A_H */
39
40/*
41 Stuff for Emacs to see, in order to encourage consistent editing style:
42 *** Local Variables: ***
43 *** mode: c ***
44 *** fill-column: 70 ***
45 *** tab-width: 8 ***
46 *** c-basic-offset: 8 ***
47 *** End: ***
48 */
diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.c b/drivers/media/video/pvrusb2/pvrusb2-devattr.c
index 7483c1746079..1cb6a260e8b0 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-devattr.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.c
@@ -205,7 +205,7 @@ static const struct pvr2_device_desc pvr2_device_onair_creator = {
205 .flag_has_composite = !0, 205 .flag_has_composite = !0,
206 .flag_has_svideo = !0, 206 .flag_has_svideo = !0,
207 .flag_digital_requires_cx23416 = !0, 207 .flag_digital_requires_cx23416 = !0,
208 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, 208 .signal_routing_scheme = PVR2_ROUTING_SCHEME_ONAIR,
209 .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR, 209 .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR,
210 .default_std_mask = V4L2_STD_NTSC_M, 210 .default_std_mask = V4L2_STD_NTSC_M,
211#ifdef CONFIG_VIDEO_PVRUSB2_DVB 211#ifdef CONFIG_VIDEO_PVRUSB2_DVB
@@ -265,7 +265,7 @@ static const struct pvr2_device_desc pvr2_device_onair_usb2 = {
265 .flag_has_composite = !0, 265 .flag_has_composite = !0,
266 .flag_has_svideo = !0, 266 .flag_has_svideo = !0,
267 .flag_digital_requires_cx23416 = !0, 267 .flag_digital_requires_cx23416 = !0,
268 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, 268 .signal_routing_scheme = PVR2_ROUTING_SCHEME_ONAIR,
269 .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR, 269 .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR,
270 .default_std_mask = V4L2_STD_NTSC_M, 270 .default_std_mask = V4L2_STD_NTSC_M,
271#ifdef CONFIG_VIDEO_PVRUSB2_DVB 271#ifdef CONFIG_VIDEO_PVRUSB2_DVB
diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.h b/drivers/media/video/pvrusb2/pvrusb2-devattr.h
index 13a59c4f9584..3e553389cbc3 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-devattr.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.h
@@ -68,6 +68,7 @@ struct pvr2_string_table {
68 68
69#define PVR2_ROUTING_SCHEME_HAUPPAUGE 0 69#define PVR2_ROUTING_SCHEME_HAUPPAUGE 0
70#define PVR2_ROUTING_SCHEME_GOTVIEW 1 70#define PVR2_ROUTING_SCHEME_GOTVIEW 1
71#define PVR2_ROUTING_SCHEME_ONAIR 2
71 72
72#define PVR2_DIGITAL_SCHEME_NONE 0 73#define PVR2_DIGITAL_SCHEME_NONE 0
73#define PVR2_DIGITAL_SCHEME_HAUPPAUGE 1 74#define PVR2_DIGITAL_SCHEME_HAUPPAUGE 1
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index b8a2d332c6d0..e35772125038 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -38,6 +38,7 @@
38#include "pvrusb2-wm8775.h" 38#include "pvrusb2-wm8775.h"
39#include "pvrusb2-video-v4l.h" 39#include "pvrusb2-video-v4l.h"
40#include "pvrusb2-cx2584x-v4l.h" 40#include "pvrusb2-cx2584x-v4l.h"
41#include "pvrusb2-cs53l32a.h"
41#include "pvrusb2-audio.h" 42#include "pvrusb2-audio.h"
42 43
43#define TV_MIN_FREQ 55250000L 44#define TV_MIN_FREQ 55250000L
@@ -116,6 +117,7 @@ static const pvr2_subdev_update_func pvr2_module_update_functions[] = {
116 [PVR2_CLIENT_ID_SAA7115] = pvr2_saa7115_subdev_update, 117 [PVR2_CLIENT_ID_SAA7115] = pvr2_saa7115_subdev_update,
117 [PVR2_CLIENT_ID_MSP3400] = pvr2_msp3400_subdev_update, 118 [PVR2_CLIENT_ID_MSP3400] = pvr2_msp3400_subdev_update,
118 [PVR2_CLIENT_ID_CX25840] = pvr2_cx25840_subdev_update, 119 [PVR2_CLIENT_ID_CX25840] = pvr2_cx25840_subdev_update,
120 [PVR2_CLIENT_ID_CS53L32A] = pvr2_cs53l32a_subdev_update,
119}; 121};
120 122
121static const char *module_names[] = { 123static const char *module_names[] = {
diff --git a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
index ce8332dd9cc9..b3862f5554bd 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
@@ -54,11 +54,22 @@ static const int routing_scheme0[] = {
54 [PVR2_CVAL_INPUT_SVIDEO] = SAA7115_SVIDEO2, 54 [PVR2_CVAL_INPUT_SVIDEO] = SAA7115_SVIDEO2,
55}; 55};
56 56
57static const int routing_scheme1[] = {
58 [PVR2_CVAL_INPUT_TV] = SAA7115_COMPOSITE4,
59 [PVR2_CVAL_INPUT_RADIO] = SAA7115_COMPOSITE5,
60 [PVR2_CVAL_INPUT_COMPOSITE] = SAA7115_COMPOSITE3,
61 [PVR2_CVAL_INPUT_SVIDEO] = SAA7115_SVIDEO2, /* or SVIDEO0, it seems */
62};
63
57static const struct routing_scheme routing_schemes[] = { 64static const struct routing_scheme routing_schemes[] = {
58 [PVR2_ROUTING_SCHEME_HAUPPAUGE] = { 65 [PVR2_ROUTING_SCHEME_HAUPPAUGE] = {
59 .def = routing_scheme0, 66 .def = routing_scheme0,
60 .cnt = ARRAY_SIZE(routing_scheme0), 67 .cnt = ARRAY_SIZE(routing_scheme0),
61 }, 68 },
69 [PVR2_ROUTING_SCHEME_ONAIR] = {
70 .def = routing_scheme1,
71 .cnt = ARRAY_SIZE(routing_scheme1),
72 },
62}; 73};
63 74
64void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) 75void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)