aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2007-12-08 15:20:06 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:03:26 -0500
commitd130fa8a05ee5f39c786df02dd75d1eebb12633b (patch)
tree230e68d3262f157690f04f79556ce0fb26301437 /drivers/media
parent066bba2d1ccdac2005a64f4c87f8b542744ed94c (diff)
V4L/DVB (6773): pvrusb2: rework device descriptor layout
The pvrusb2 driver tries to keep all device specific attributes in a single data structure in one source file. This change further cleans up how that table is set up. We now try to group everything together for each specific device, and the number of symbols exported from this module has now been reduced to a single global. Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-devattr.c155
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-devattr.h2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c9
3 files changed, 89 insertions, 77 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.c b/drivers/media/video/pvrusb2/pvrusb2-devattr.c
index 2d6519d20f0..9a08670d406 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-devattr.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.c
@@ -33,71 +33,22 @@ pvr2_device_desc structures.
33#include <linux/i2c.h> 33#include <linux/i2c.h>
34#include <media/tuner.h> 34#include <media/tuner.h>
35 35
36/* Known major hardware variants, keyed from device ID */
37#define PVR2_HDW_TYPE_29XXX 0
38#define PVR2_HDW_TYPE_24XXX 1
39#define PVR2_HDW_TYPE_GOTVIEW_2 2
40#ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_CREATOR
41#define PVR2_HDW_TYPE_ONAIR_CREATOR 3
42#endif
43#ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_USB2
44#define PVR2_HDW_TYPE_ONAIR_USB2 4
45#endif
46
47struct usb_device_id pvr2_device_table[] = {
48 [PVR2_HDW_TYPE_29XXX] = { USB_DEVICE(0x2040, 0x2900) },
49 [PVR2_HDW_TYPE_24XXX] = { USB_DEVICE(0x2040, 0x2400) },
50 [PVR2_HDW_TYPE_GOTVIEW_2] = { USB_DEVICE(0x1164, 0x0622) },
51#ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_CREATOR
52 [PVR2_HDW_TYPE_ONAIR_CREATOR] = { USB_DEVICE(0x11ba, 0x1003) },
53#endif
54#ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_USB2
55 [PVR2_HDW_TYPE_ONAIR_USB2] = { USB_DEVICE(0x11ba, 0x1001) },
56#endif
57 { }
58};
59#if defined(CONFIG_VIDEO_PVRUSB2_ONAIR_CREATOR) || defined(CONFIG_VIDEO_PVRUSB2_ONAIR_USB2)
60 36
61/* Names of other client modules to request for Creator model hardware */
62static const char *pvr2_client_onair[] = {
63 "saa7115",
64 "tuner",
65 "cs53l32a",
66};
67#endif
68 37
69/* Names of other client modules to request for 24xxx model hardware */ 38/*------------------------------------------------------------------------*/
70static const char *pvr2_client_24xxx[] = { 39/* Hauppauge PVR-USB2 Model 29xxx */
71 "cx25840",
72 "tuner",
73 "wm8775",
74};
75 40
76/* Names of other client modules to request for 29xxx model hardware */
77static const char *pvr2_client_29xxx[] = { 41static const char *pvr2_client_29xxx[] = {
78 "msp3400", 42 "msp3400",
79 "saa7115", 43 "saa7115",
80 "tuner", 44 "tuner",
81}; 45};
82 46
83// Names of other client modules to request for Gotview 2 model hardware
84static const char *pvr2_client_gotview_2[] = {
85 "cx25840",
86 "tuner",
87};
88
89/* Firmware file name(s) for 29xxx devices */
90static const char *pvr2_fw1_names_29xxx[] = { 47static const char *pvr2_fw1_names_29xxx[] = {
91 "v4l-pvrusb2-29xxx-01.fw", 48 "v4l-pvrusb2-29xxx-01.fw",
92}; 49};
93 50
94/* Firmware file name(s) for 24xxx devices */ 51static const struct pvr2_device_desc pvr2_device_29xxx = {
95static const char *pvr2_fw1_names_24xxx[] = {
96 "v4l-pvrusb2-24xxx-01.fw",
97};
98
99const struct pvr2_device_desc pvr2_device_descriptions[] = {
100 [PVR2_HDW_TYPE_29XXX] = {
101 .description = "WinTV PVR USB2 Model Category 29xxxx", 52 .description = "WinTV PVR USB2 Model Category 29xxxx",
102 .shortname = "29xxx", 53 .shortname = "29xxx",
103 .client_modules.lst = pvr2_client_29xxx, 54 .client_modules.lst = pvr2_client_29xxx,
@@ -106,8 +57,24 @@ const struct pvr2_device_desc pvr2_device_descriptions[] = {
106 .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_29xxx), 57 .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_29xxx),
107 .flag_has_hauppauge_rom = !0, 58 .flag_has_hauppauge_rom = !0,
108 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, 59 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
109 }, 60};
110 [PVR2_HDW_TYPE_24XXX] = { 61
62
63
64/*------------------------------------------------------------------------*/
65/* Hauppauge PVR-USB2 Model 24xxx */
66
67static const char *pvr2_client_24xxx[] = {
68 "cx25840",
69 "tuner",
70 "wm8775",
71};
72
73static const char *pvr2_fw1_names_24xxx[] = {
74 "v4l-pvrusb2-24xxx-01.fw",
75};
76
77static const struct pvr2_device_desc pvr2_device_24xxx = {
111 .description = "WinTV PVR USB2 Model Category 24xxxx", 78 .description = "WinTV PVR USB2 Model Category 24xxxx",
112 .shortname = "24xxx", 79 .shortname = "24xxx",
113 .client_modules.lst = pvr2_client_24xxx, 80 .client_modules.lst = pvr2_client_24xxx,
@@ -119,8 +86,19 @@ const struct pvr2_device_desc pvr2_device_descriptions[] = {
119 .flag_has_hauppauge_rom = !0, 86 .flag_has_hauppauge_rom = !0,
120 .flag_has_hauppauge_custom_ir = !0, 87 .flag_has_hauppauge_custom_ir = !0,
121 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, 88 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
122 }, 89};
123 [PVR2_HDW_TYPE_GOTVIEW_2] = { 90
91
92
93/*------------------------------------------------------------------------*/
94/* GOTVIEW USB2.0 DVD2 */
95
96static const char *pvr2_client_gotview_2[] = {
97 "cx25840",
98 "tuner",
99};
100
101static const struct pvr2_device_desc pvr2_device_gotview_2 = {
124 .description = "Gotview USB 2.0 DVD 2", 102 .description = "Gotview USB 2.0 DVD 2",
125 .shortname = "gv2", 103 .shortname = "gv2",
126 .client_modules.lst = pvr2_client_gotview_2, 104 .client_modules.lst = pvr2_client_gotview_2,
@@ -128,30 +106,73 @@ const struct pvr2_device_desc pvr2_device_descriptions[] = {
128 .flag_has_cx25840 = !0, 106 .flag_has_cx25840 = !0,
129 .default_tuner_type = TUNER_PHILIPS_FM1216ME_MK3, 107 .default_tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
130 .signal_routing_scheme = PVR2_ROUTING_SCHEME_GOTVIEW, 108 .signal_routing_scheme = PVR2_ROUTING_SCHEME_GOTVIEW,
131 }, 109};
110
111
112
132#ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_CREATOR 113#ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_CREATOR
133 [PVR2_HDW_TYPE_ONAIR_CREATOR] = { 114/*------------------------------------------------------------------------*/
115/* OnAir Creator */
116
117static const char *pvr2_client_onair_creator[] = {
118 "saa7115",
119 "tuner",
120 "cs53l32a",
121};
122
123static const struct pvr2_device_desc pvr2_device_onair_creator = {
134 .description = "OnAir Creator Hybrid USB tuner", 124 .description = "OnAir Creator Hybrid USB tuner",
135 .shortname = "oac", 125 .shortname = "oac",
136 .client_modules.lst = pvr2_client_onair, 126 .client_modules.lst = pvr2_client_onair_creator,
137 .client_modules.cnt = ARRAY_SIZE(pvr2_client_onair), 127 .client_modules.cnt = ARRAY_SIZE(pvr2_client_onair_creator),
138 .default_tuner_type = TUNER_LG_TDVS_H06XF, 128 .default_tuner_type = TUNER_LG_TDVS_H06XF,
139 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, 129 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
140 }, 130};
141#endif 131#endif
132
133
134
142#ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_USB2 135#ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_USB2
143 [PVR2_HDW_TYPE_ONAIR_USB2] = { 136/*------------------------------------------------------------------------*/
137/* OnAir USB 2.0 */
138
139static const char *pvr2_client_onair_usb2[] = {
140 "saa7115",
141 "tuner",
142 "cs53l32a",
143};
144
145static const struct pvr2_device_desc pvr2_device_onair_usb2 = {
144 .description = "OnAir USB2 Hybrid USB tuner", 146 .description = "OnAir USB2 Hybrid USB tuner",
145 .shortname = "oa2", 147 .shortname = "oa2",
146 .client_modules.lst = pvr2_client_onair, 148 .client_modules.lst = pvr2_client_onair_usb2,
147 .client_modules.cnt = ARRAY_SIZE(pvr2_client_onair), 149 .client_modules.cnt = ARRAY_SIZE(pvr2_client_onair_usb2),
148 .default_tuner_type = TUNER_PHILIPS_ATSC, 150 .default_tuner_type = TUNER_PHILIPS_ATSC,
149 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, 151 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
150 },
151#endif
152}; 152};
153#endif
154
155
153 156
154const unsigned int pvr2_device_count = ARRAY_SIZE(pvr2_device_descriptions); 157/*------------------------------------------------------------------------*/
158
159struct usb_device_id pvr2_device_table[] = {
160 { USB_DEVICE(0x2040, 0x2900),
161 .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
162 { USB_DEVICE(0x2040, 0x2400),
163 .driver_info = (kernel_ulong_t)&pvr2_device_24xxx},
164 { USB_DEVICE(0x1164, 0x0622),
165 .driver_info = (kernel_ulong_t)&pvr2_device_gotview_2},
166#ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_CREATOR
167 { USB_DEVICE(0x11ba, 0x1003),
168 .driver_info = (kernel_ulong_t)&pvr2_device_onair_creator},
169#endif
170#ifdef CONFIG_VIDEO_PVRUSB2_ONAIR_USB2
171 { USB_DEVICE(0x11ba, 0x1001),
172 .driver_info = (kernel_ulong_t)&pvr2_device_onair_usb2},
173#endif
174 { }
175};
155 176
156MODULE_DEVICE_TABLE(usb, pvr2_device_table); 177MODULE_DEVICE_TABLE(usb, pvr2_device_table);
157 178
diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.h b/drivers/media/video/pvrusb2/pvrusb2-devattr.h
index a9c3d99b602..64b467f0637 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-devattr.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.h
@@ -104,9 +104,7 @@ struct pvr2_device_desc {
104 char flag_has_hauppauge_custom_ir; 104 char flag_has_hauppauge_custom_ir;
105}; 105};
106 106
107extern const struct pvr2_device_desc pvr2_device_descriptions[];
108extern struct usb_device_id pvr2_device_table[]; 107extern struct usb_device_id pvr2_device_table[];
109extern const unsigned int pvr2_device_count;
110 108
111#endif /* __PVRUSB2_HDW_INTERNAL_H */ 109#endif /* __PVRUSB2_HDW_INTERNAL_H */
112 110
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 54d2c4ab7a3..41ae980405e 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -1813,7 +1813,6 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
1813{ 1813{
1814 unsigned int idx,cnt1,cnt2; 1814 unsigned int idx,cnt1,cnt2;
1815 struct pvr2_hdw *hdw; 1815 struct pvr2_hdw *hdw;
1816 unsigned int hdw_type;
1817 int valid_std_mask; 1816 int valid_std_mask;
1818 struct pvr2_ctrl *cptr; 1817 struct pvr2_ctrl *cptr;
1819 const struct pvr2_device_desc *hdw_desc; 1818 const struct pvr2_device_desc *hdw_desc;
@@ -1821,13 +1820,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
1821 struct v4l2_queryctrl qctrl; 1820 struct v4l2_queryctrl qctrl;
1822 struct pvr2_ctl_info *ciptr; 1821 struct pvr2_ctl_info *ciptr;
1823 1822
1824 hdw_type = devid - pvr2_device_table; 1823 hdw_desc = (const struct pvr2_device_desc *)(devid->driver_info);
1825 if (hdw_type >= pvr2_device_count) {
1826 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
1827 "Bogus device type of %u reported",hdw_type);
1828 return NULL;
1829 }
1830 hdw_desc = pvr2_device_descriptions + hdw_type;
1831 1824
1832 hdw = kzalloc(sizeof(*hdw),GFP_KERNEL); 1825 hdw = kzalloc(sizeof(*hdw),GFP_KERNEL);
1833 pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_create: hdw=%p, type \"%s\"", 1826 pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_create: hdw=%p, type \"%s\"",