diff options
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-devattr.c | 101 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-devattr.h | 87 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-encoder.c | 16 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | 6 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 91 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.h | 3 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | 8 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-main.c | 1 |
8 files changed, 219 insertions, 94 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.c b/drivers/media/video/pvrusb2/pvrusb2-devattr.c new file mode 100644 index 000000000000..aebcb846de6a --- /dev/null +++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.c | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * | ||
3 | * $Id$ | ||
4 | * | ||
5 | * Copyright (C) 2007 Mike Isely <isely@pobox.com> | ||
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 should encompass ALL per-device type information for the | ||
25 | driver. To define a new device, add elements to the pvr2_device_table and | ||
26 | pvr2_device_desc structures. | ||
27 | |||
28 | */ | ||
29 | |||
30 | #include "pvrusb2-devattr.h" | ||
31 | #include <linux/usb.h> | ||
32 | |||
33 | /* Known major hardware variants, keyed from device ID */ | ||
34 | #define PVR2_HDW_TYPE_29XXX 0 | ||
35 | #define PVR2_HDW_TYPE_24XXX 1 | ||
36 | |||
37 | struct usb_device_id pvr2_device_table[] = { | ||
38 | [PVR2_HDW_TYPE_29XXX] = { USB_DEVICE(0x2040, 0x2900) }, | ||
39 | [PVR2_HDW_TYPE_24XXX] = { USB_DEVICE(0x2040, 0x2400) }, | ||
40 | { } | ||
41 | }; | ||
42 | |||
43 | /* Names of other client modules to request for 24xxx model hardware */ | ||
44 | static const char *pvr2_client_24xxx[] = { | ||
45 | "cx25840", | ||
46 | "tuner", | ||
47 | "wm8775", | ||
48 | }; | ||
49 | |||
50 | /* Names of other client modules to request for 29xxx model hardware */ | ||
51 | static const char *pvr2_client_29xxx[] = { | ||
52 | "msp3400", | ||
53 | "saa7115", | ||
54 | "tuner", | ||
55 | }; | ||
56 | |||
57 | /* Firmware file name(s) for 29xxx devices */ | ||
58 | static const char *pvr2_fw1_names_29xxx[] = { | ||
59 | "v4l-pvrusb2-29xxx-01.fw", | ||
60 | }; | ||
61 | |||
62 | /* Firmware file name(s) for 29xxx devices */ | ||
63 | static const char *pvr2_fw1_names_24xxx[] = { | ||
64 | "v4l-pvrusb2-24xxx-01.fw", | ||
65 | }; | ||
66 | |||
67 | const struct pvr2_device_desc pvr2_device_descriptions[] = { | ||
68 | [PVR2_HDW_TYPE_29XXX] = { | ||
69 | .description = "WinTV PVR USB2 Model Category 29xxxx", | ||
70 | .shortname = "29xxx", | ||
71 | .client_modules.lst = pvr2_client_29xxx, | ||
72 | .client_modules.cnt = ARRAY_SIZE(pvr2_client_29xxx), | ||
73 | .fx2_firmware.lst = pvr2_fw1_names_29xxx, | ||
74 | .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_29xxx), | ||
75 | }, | ||
76 | [PVR2_HDW_TYPE_24XXX] = { | ||
77 | .description = "WinTV PVR USB2 Model Category 24xxxx", | ||
78 | .shortname = "24xxx", | ||
79 | .client_modules.lst = pvr2_client_24xxx, | ||
80 | .client_modules.cnt = ARRAY_SIZE(pvr2_client_24xxx), | ||
81 | .fx2_firmware.lst = pvr2_fw1_names_24xxx, | ||
82 | .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_24xxx), | ||
83 | .flag_has_cx25840 = !0, | ||
84 | .flag_has_wm8775 = !0, | ||
85 | }, | ||
86 | }; | ||
87 | |||
88 | const unsigned int pvr2_device_count = ARRAY_SIZE(pvr2_device_descriptions); | ||
89 | |||
90 | MODULE_DEVICE_TABLE(usb, pvr2_device_table); | ||
91 | |||
92 | |||
93 | /* | ||
94 | Stuff for Emacs to see, in order to encourage consistent editing style: | ||
95 | *** Local Variables: *** | ||
96 | *** mode: c *** | ||
97 | *** fill-column: 75 *** | ||
98 | *** tab-width: 8 *** | ||
99 | *** c-basic-offset: 8 *** | ||
100 | *** End: *** | ||
101 | */ | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.h b/drivers/media/video/pvrusb2/pvrusb2-devattr.h new file mode 100644 index 000000000000..6576aefd27c3 --- /dev/null +++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * | ||
3 | * $Id$ | ||
4 | * | ||
5 | * Copyright (C) 2005 Mike Isely <isely@pobox.com> | ||
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 | #ifndef __PVRUSB2_DEVATTR_H | ||
22 | #define __PVRUSB2_DEVATTR_H | ||
23 | |||
24 | #include <linux/mod_devicetable.h> | ||
25 | |||
26 | /* | ||
27 | |||
28 | This header defines structures used to describe attributes of a device. | ||
29 | |||
30 | */ | ||
31 | |||
32 | |||
33 | struct pvr2_string_table { | ||
34 | const char **lst; | ||
35 | unsigned int cnt; | ||
36 | }; | ||
37 | |||
38 | |||
39 | /* This describes a particular hardware type (except for the USB device ID | ||
40 | which must live in a separate structure due to environmental | ||
41 | constraints). See the top of pvrusb2-hdw.c for where this is | ||
42 | instantiated. */ | ||
43 | struct pvr2_device_desc { | ||
44 | /* Single line text description of hardware */ | ||
45 | const char *description; | ||
46 | |||
47 | /* Single token identifier for hardware */ | ||
48 | const char *shortname; | ||
49 | |||
50 | /* List of additional client modules we need to load */ | ||
51 | struct pvr2_string_table client_modules; | ||
52 | |||
53 | /* List of FX2 firmware file names we should search; if empty then | ||
54 | FX2 firmware check / load is skipped and we assume the device | ||
55 | was initialized from internal ROM. */ | ||
56 | struct pvr2_string_table fx2_firmware; | ||
57 | |||
58 | /* If set, we don't bother trying to load cx23416 firmware. */ | ||
59 | char flag_skip_cx23416_firmware; | ||
60 | |||
61 | /* Device does not require a powerup command to be issued. */ | ||
62 | char flag_no_powerup; | ||
63 | |||
64 | /* Device has a cx25840 - this enables special additional logic to | ||
65 | handle it. */ | ||
66 | char flag_has_cx25840; | ||
67 | |||
68 | /* Device has a wm8775 - this enables special additional logic to | ||
69 | ensure that it is found. */ | ||
70 | char flag_has_wm8775; | ||
71 | }; | ||
72 | |||
73 | extern const struct pvr2_device_desc pvr2_device_descriptions[]; | ||
74 | extern struct usb_device_id pvr2_device_table[]; | ||
75 | extern const unsigned int pvr2_device_count; | ||
76 | |||
77 | #endif /* __PVRUSB2_HDW_INTERNAL_H */ | ||
78 | |||
79 | /* | ||
80 | Stuff for Emacs to see, in order to encourage consistent editing style: | ||
81 | *** Local Variables: *** | ||
82 | *** mode: c *** | ||
83 | *** fill-column: 75 *** | ||
84 | *** tab-width: 8 *** | ||
85 | *** c-basic-offset: 8 *** | ||
86 | *** End: *** | ||
87 | */ | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/drivers/media/video/pvrusb2/pvrusb2-encoder.c index 5ca548cc7e7f..4271b4132664 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-encoder.c +++ b/drivers/media/video/pvrusb2/pvrusb2-encoder.c | |||
@@ -370,13 +370,13 @@ static int pvr2_encoder_prep_config(struct pvr2_hdw *hdw) | |||
370 | 370 | ||
371 | /* This ENC_MISC(3,encMisc3Arg) command is critical - without | 371 | /* This ENC_MISC(3,encMisc3Arg) command is critical - without |
372 | it there will eventually be video corruption. Also, the | 372 | it there will eventually be video corruption. Also, the |
373 | 29xxx case is strange - the Windows driver is passing 1 | 373 | saa7115 case is strange - the Windows driver is passing 1 |
374 | regardless of device type but if we have 1 for 29xxx device | 374 | regardless of device type but if we have 1 for saa7115 |
375 | the video turns sluggish. */ | 375 | devices the video turns sluggish. */ |
376 | switch (hdw->hdw_type) { | 376 | if (hdw->hdw_desc->flag_has_cx25840) { |
377 | case PVR2_HDW_TYPE_24XXX: encMisc3Arg = 1; break; | 377 | encMisc3Arg = 1; |
378 | case PVR2_HDW_TYPE_29XXX: encMisc3Arg = 0; break; | 378 | } else { |
379 | default: break; | 379 | encMisc3Arg = 0; |
380 | } | 380 | } |
381 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 3, | 381 | ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 3, |
382 | encMisc3Arg,0,0); | 382 | encMisc3Arg,0,0); |
@@ -434,7 +434,7 @@ int pvr2_encoder_configure(struct pvr2_hdw *hdw) | |||
434 | 434 | ||
435 | /* saa7115: 0xf0 */ | 435 | /* saa7115: 0xf0 */ |
436 | val = 0xf0; | 436 | val = 0xf0; |
437 | if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { | 437 | if (hdw->hdw_desc->flag_has_cx25840) { |
438 | /* ivtv cx25840: 0x140 */ | 438 | /* ivtv cx25840: 0x140 */ |
439 | val = 0x140; | 439 | val = 0x140; |
440 | } | 440 | } |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index 8ee4549b7a9f..8c2d222960f1 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "pvrusb2-hdw.h" | 40 | #include "pvrusb2-hdw.h" |
41 | #include "pvrusb2-io.h" | 41 | #include "pvrusb2-io.h" |
42 | #include <media/cx2341x.h> | 42 | #include <media/cx2341x.h> |
43 | #include "pvrusb2-devattr.h" | ||
43 | 44 | ||
44 | /* Legal values for PVR2_CID_HSM */ | 45 | /* Legal values for PVR2_CID_HSM */ |
45 | #define PVR2_CVAL_HSM_FAIL 0 | 46 | #define PVR2_CVAL_HSM_FAIL 0 |
@@ -162,10 +163,6 @@ struct pvr2_decoder_ctrl { | |||
162 | #define FW1_STATE_RELOAD 3 | 163 | #define FW1_STATE_RELOAD 3 |
163 | #define FW1_STATE_OK 4 | 164 | #define FW1_STATE_OK 4 |
164 | 165 | ||
165 | /* Known major hardware variants, keyed from device ID */ | ||
166 | #define PVR2_HDW_TYPE_29XXX 0 | ||
167 | #define PVR2_HDW_TYPE_24XXX 1 | ||
168 | |||
169 | typedef int (*pvr2_i2c_func)(struct pvr2_hdw *,u8,u8 *,u16,u8 *, u16); | 166 | typedef int (*pvr2_i2c_func)(struct pvr2_hdw *,u8,u8 *,u16,u8 *, u16); |
170 | #define PVR2_I2C_FUNC_CNT 128 | 167 | #define PVR2_I2C_FUNC_CNT 128 |
171 | 168 | ||
@@ -179,6 +176,7 @@ struct pvr2_hdw { | |||
179 | 176 | ||
180 | /* Device type, one of PVR2_HDW_TYPE_xxxxx */ | 177 | /* Device type, one of PVR2_HDW_TYPE_xxxxx */ |
181 | unsigned int hdw_type; | 178 | unsigned int hdw_type; |
179 | const struct pvr2_device_desc *hdw_desc; | ||
182 | 180 | ||
183 | /* Kernel worker thread handling */ | 181 | /* Kernel worker thread handling */ |
184 | struct workqueue_struct *workqueue; | 182 | struct workqueue_struct *workqueue; |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 4e55a2a84073..c56208456bc0 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -41,47 +41,6 @@ | |||
41 | #define TV_MIN_FREQ 55250000L | 41 | #define TV_MIN_FREQ 55250000L |
42 | #define TV_MAX_FREQ 850000000L | 42 | #define TV_MAX_FREQ 850000000L |
43 | 43 | ||
44 | struct usb_device_id pvr2_device_table[] = { | ||
45 | [PVR2_HDW_TYPE_29XXX] = { USB_DEVICE(0x2040, 0x2900) }, | ||
46 | [PVR2_HDW_TYPE_24XXX] = { USB_DEVICE(0x2040, 0x2400) }, | ||
47 | { } | ||
48 | }; | ||
49 | |||
50 | MODULE_DEVICE_TABLE(usb, pvr2_device_table); | ||
51 | |||
52 | static const char *pvr2_device_names[] = { | ||
53 | [PVR2_HDW_TYPE_29XXX] = "WinTV PVR USB2 Model Category 29xxxx", | ||
54 | [PVR2_HDW_TYPE_24XXX] = "WinTV PVR USB2 Model Category 24xxxx", | ||
55 | }; | ||
56 | |||
57 | struct pvr2_string_table { | ||
58 | const char **lst; | ||
59 | unsigned int cnt; | ||
60 | }; | ||
61 | |||
62 | // Names of other client modules to request for 24xxx model hardware | ||
63 | static const char *pvr2_client_24xxx[] = { | ||
64 | "cx25840", | ||
65 | "tuner", | ||
66 | "wm8775", | ||
67 | }; | ||
68 | |||
69 | // Names of other client modules to request for 29xxx model hardware | ||
70 | static const char *pvr2_client_29xxx[] = { | ||
71 | "msp3400", | ||
72 | "saa7115", | ||
73 | "tuner", | ||
74 | }; | ||
75 | |||
76 | static struct pvr2_string_table pvr2_client_lists[] = { | ||
77 | [PVR2_HDW_TYPE_29XXX] = { | ||
78 | pvr2_client_29xxx, ARRAY_SIZE(pvr2_client_29xxx) | ||
79 | }, | ||
80 | [PVR2_HDW_TYPE_24XXX] = { | ||
81 | pvr2_client_24xxx, ARRAY_SIZE(pvr2_client_24xxx) | ||
82 | }, | ||
83 | }; | ||
84 | |||
85 | static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; | 44 | static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; |
86 | static DEFINE_MUTEX(pvr2_unit_mtx); | 45 | static DEFINE_MUTEX(pvr2_unit_mtx); |
87 | 46 | ||
@@ -394,8 +353,8 @@ static int ctrl_vres_max_get(struct pvr2_ctrl *cptr,int *vp) | |||
394 | 353 | ||
395 | static int ctrl_vres_min_get(struct pvr2_ctrl *cptr,int *vp) | 354 | static int ctrl_vres_min_get(struct pvr2_ctrl *cptr,int *vp) |
396 | { | 355 | { |
397 | /* Actual minimum depends on device type. */ | 356 | /* Actual minimum depends on device digitizer type. */ |
398 | if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { | 357 | if (cptr->hdw->hdw_desc->flag_has_cx25840) { |
399 | *vp = 75; | 358 | *vp = 75; |
400 | } else { | 359 | } else { |
401 | *vp = 17; | 360 | *vp = 17; |
@@ -1131,23 +1090,8 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) | |||
1131 | unsigned int pipe; | 1090 | unsigned int pipe; |
1132 | int ret; | 1091 | int ret; |
1133 | u16 address; | 1092 | u16 address; |
1134 | static const char *fw_files_29xxx[] = { | ||
1135 | "v4l-pvrusb2-29xxx-01.fw", | ||
1136 | }; | ||
1137 | static const char *fw_files_24xxx[] = { | ||
1138 | "v4l-pvrusb2-24xxx-01.fw", | ||
1139 | }; | ||
1140 | static const struct pvr2_string_table fw_file_defs[] = { | ||
1141 | [PVR2_HDW_TYPE_29XXX] = { | ||
1142 | fw_files_29xxx, ARRAY_SIZE(fw_files_29xxx) | ||
1143 | }, | ||
1144 | [PVR2_HDW_TYPE_24XXX] = { | ||
1145 | fw_files_24xxx, ARRAY_SIZE(fw_files_24xxx) | ||
1146 | }, | ||
1147 | }; | ||
1148 | 1093 | ||
1149 | if ((hdw->hdw_type >= ARRAY_SIZE(fw_file_defs)) || | 1094 | if (!hdw->hdw_desc->fx2_firmware.cnt) { |
1150 | (!fw_file_defs[hdw->hdw_type].lst)) { | ||
1151 | hdw->fw1_state = FW1_STATE_OK; | 1095 | hdw->fw1_state = FW1_STATE_OK; |
1152 | return 0; | 1096 | return 0; |
1153 | } | 1097 | } |
@@ -1157,8 +1101,8 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) | |||
1157 | trace_firmware("pvr2_upload_firmware1"); | 1101 | trace_firmware("pvr2_upload_firmware1"); |
1158 | 1102 | ||
1159 | ret = pvr2_locate_firmware(hdw,&fw_entry,"fx2 controller", | 1103 | ret = pvr2_locate_firmware(hdw,&fw_entry,"fx2 controller", |
1160 | fw_file_defs[hdw->hdw_type].cnt, | 1104 | hdw->hdw_desc->fx2_firmware.cnt, |
1161 | fw_file_defs[hdw->hdw_type].lst); | 1105 | hdw->hdw_desc->fx2_firmware.lst); |
1162 | if (ret < 0) { | 1106 | if (ret < 0) { |
1163 | if (ret == -ENOENT) hdw->fw1_state = FW1_STATE_MISSING; | 1107 | if (ret == -ENOENT) hdw->fw1_state = FW1_STATE_MISSING; |
1164 | return ret; | 1108 | return ret; |
@@ -1233,8 +1177,7 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) | |||
1233 | CX2341X_FIRM_ENC_FILENAME, | 1177 | CX2341X_FIRM_ENC_FILENAME, |
1234 | }; | 1178 | }; |
1235 | 1179 | ||
1236 | if ((hdw->hdw_type != PVR2_HDW_TYPE_29XXX) && | 1180 | if (hdw->hdw_desc->flag_skip_cx23416_firmware) { |
1237 | (hdw->hdw_type != PVR2_HDW_TYPE_24XXX)) { | ||
1238 | return 0; | 1181 | return 0; |
1239 | } | 1182 | } |
1240 | 1183 | ||
@@ -1652,8 +1595,7 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) | |||
1652 | unsigned int idx; | 1595 | unsigned int idx; |
1653 | struct pvr2_ctrl *cptr; | 1596 | struct pvr2_ctrl *cptr; |
1654 | int reloadFl = 0; | 1597 | int reloadFl = 0; |
1655 | if ((hdw->hdw_type == PVR2_HDW_TYPE_29XXX) || | 1598 | if (hdw->hdw_desc->fx2_firmware.cnt) { |
1656 | (hdw->hdw_type == PVR2_HDW_TYPE_24XXX)) { | ||
1657 | if (!reloadFl) { | 1599 | if (!reloadFl) { |
1658 | reloadFl = | 1600 | reloadFl = |
1659 | (hdw->usb_intf->cur_altsetting->desc.bNumEndpoints | 1601 | (hdw->usb_intf->cur_altsetting->desc.bNumEndpoints |
@@ -1689,17 +1631,11 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) | |||
1689 | } | 1631 | } |
1690 | if (!pvr2_hdw_dev_ok(hdw)) return; | 1632 | if (!pvr2_hdw_dev_ok(hdw)) return; |
1691 | 1633 | ||
1692 | if (hdw->hdw_type < ARRAY_SIZE(pvr2_client_lists)) { | 1634 | for (idx = 0; idx < hdw->hdw_desc->client_modules.cnt; idx++) { |
1693 | for (idx = 0; | 1635 | request_module(hdw->hdw_desc->client_modules.lst[idx]); |
1694 | idx < pvr2_client_lists[hdw->hdw_type].cnt; | ||
1695 | idx++) { | ||
1696 | request_module( | ||
1697 | pvr2_client_lists[hdw->hdw_type].lst[idx]); | ||
1698 | } | ||
1699 | } | 1636 | } |
1700 | 1637 | ||
1701 | if ((hdw->hdw_type == PVR2_HDW_TYPE_29XXX) || | 1638 | if (!hdw->hdw_desc->flag_no_powerup) { |
1702 | (hdw->hdw_type == PVR2_HDW_TYPE_24XXX)) { | ||
1703 | pvr2_hdw_cmd_powerup(hdw); | 1639 | pvr2_hdw_cmd_powerup(hdw); |
1704 | if (!pvr2_hdw_dev_ok(hdw)) return; | 1640 | if (!pvr2_hdw_dev_ok(hdw)) return; |
1705 | } | 1641 | } |
@@ -1857,20 +1793,22 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, | |||
1857 | unsigned int hdw_type; | 1793 | unsigned int hdw_type; |
1858 | int valid_std_mask; | 1794 | int valid_std_mask; |
1859 | struct pvr2_ctrl *cptr; | 1795 | struct pvr2_ctrl *cptr; |
1796 | const struct pvr2_device_desc *hdw_desc; | ||
1860 | __u8 ifnum; | 1797 | __u8 ifnum; |
1861 | struct v4l2_queryctrl qctrl; | 1798 | struct v4l2_queryctrl qctrl; |
1862 | struct pvr2_ctl_info *ciptr; | 1799 | struct pvr2_ctl_info *ciptr; |
1863 | 1800 | ||
1864 | hdw_type = devid - pvr2_device_table; | 1801 | hdw_type = devid - pvr2_device_table; |
1865 | if (hdw_type >= ARRAY_SIZE(pvr2_device_names)) { | 1802 | if (hdw_type >= pvr2_device_count) { |
1866 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, | 1803 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
1867 | "Bogus device type of %u reported",hdw_type); | 1804 | "Bogus device type of %u reported",hdw_type); |
1868 | return NULL; | 1805 | return NULL; |
1869 | } | 1806 | } |
1807 | hdw_desc = pvr2_device_descriptions + hdw_type; | ||
1870 | 1808 | ||
1871 | hdw = kzalloc(sizeof(*hdw),GFP_KERNEL); | 1809 | hdw = kzalloc(sizeof(*hdw),GFP_KERNEL); |
1872 | pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_create: hdw=%p, type \"%s\"", | 1810 | pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_create: hdw=%p, type \"%s\"", |
1873 | hdw,pvr2_device_names[hdw_type]); | 1811 | hdw,hdw_desc->description); |
1874 | if (!hdw) goto fail; | 1812 | if (!hdw) goto fail; |
1875 | 1813 | ||
1876 | init_timer(&hdw->quiescent_timer); | 1814 | init_timer(&hdw->quiescent_timer); |
@@ -1894,6 +1832,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, | |||
1894 | GFP_KERNEL); | 1832 | GFP_KERNEL); |
1895 | if (!hdw->controls) goto fail; | 1833 | if (!hdw->controls) goto fail; |
1896 | hdw->hdw_type = hdw_type; | 1834 | hdw->hdw_type = hdw_type; |
1835 | hdw->hdw_desc = hdw_desc; | ||
1897 | for (idx = 0; idx < hdw->control_cnt; idx++) { | 1836 | for (idx = 0; idx < hdw->control_cnt; idx++) { |
1898 | cptr = hdw->controls + idx; | 1837 | cptr = hdw->controls + idx; |
1899 | cptr->hdw = hdw; | 1838 | cptr->hdw = hdw; |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h index 383685f7c81f..205fa03057e6 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h | |||
@@ -311,9 +311,6 @@ void pvr2_hdw_trigger_module_log(struct pvr2_hdw *hdw); | |||
311 | a debugging aid. */ | 311 | a debugging aid. */ |
312 | int pvr2_upload_firmware2(struct pvr2_hdw *hdw); | 312 | int pvr2_upload_firmware2(struct pvr2_hdw *hdw); |
313 | 313 | ||
314 | /* List of device types that we can match */ | ||
315 | extern struct usb_device_id pvr2_device_table[]; | ||
316 | |||
317 | #endif /* __PVRUSB2_HDW_H */ | 314 | #endif /* __PVRUSB2_HDW_H */ |
318 | 315 | ||
319 | /* | 316 | /* |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c index f8b7bd1e0d89..7721ec85d572 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | |||
@@ -980,14 +980,16 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw) | |||
980 | printk(KERN_INFO "%s: IR disabled\n",hdw->name); | 980 | printk(KERN_INFO "%s: IR disabled\n",hdw->name); |
981 | hdw->i2c_func[0x18] = i2c_black_hole; | 981 | hdw->i2c_func[0x18] = i2c_black_hole; |
982 | } else if (ir_mode[hdw->unit_number] == 1) { | 982 | } else if (ir_mode[hdw->unit_number] == 1) { |
983 | if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { | 983 | if (hdw->hdw_desc->flag_has_cx25840) { |
984 | hdw->i2c_func[0x18] = i2c_24xxx_ir; | 984 | hdw->i2c_func[0x18] = i2c_24xxx_ir; |
985 | } | 985 | } |
986 | } | 986 | } |
987 | if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { | 987 | if (hdw->hdw_desc->flag_has_cx25840) { |
988 | hdw->i2c_func[0x1b] = i2c_hack_wm8775; | ||
989 | hdw->i2c_func[0x44] = i2c_hack_cx25840; | 988 | hdw->i2c_func[0x44] = i2c_hack_cx25840; |
990 | } | 989 | } |
990 | if (hdw->hdw_desc->flag_has_wm8775) { | ||
991 | hdw->i2c_func[0x1b] = i2c_hack_wm8775; | ||
992 | } | ||
991 | 993 | ||
992 | // Configure the adapter and set up everything else related to it. | 994 | // Configure the adapter and set up everything else related to it. |
993 | memcpy(&hdw->i2c_adap,&pvr2_i2c_adap_template,sizeof(hdw->i2c_adap)); | 995 | memcpy(&hdw->i2c_adap,&pvr2_i2c_adap_template,sizeof(hdw->i2c_adap)); |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-main.c b/drivers/media/video/pvrusb2/pvrusb2-main.c index 11b3b2e84b90..a8370737b503 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-main.c +++ b/drivers/media/video/pvrusb2/pvrusb2-main.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/videodev2.h> | 28 | #include <linux/videodev2.h> |
29 | 29 | ||
30 | #include "pvrusb2-hdw.h" | 30 | #include "pvrusb2-hdw.h" |
31 | #include "pvrusb2-devattr.h" | ||
31 | #include "pvrusb2-context.h" | 32 | #include "pvrusb2-context.h" |
32 | #include "pvrusb2-debug.h" | 33 | #include "pvrusb2-debug.h" |
33 | #include "pvrusb2-v4l2.h" | 34 | #include "pvrusb2-v4l2.h" |