diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-08-10 13:46:28 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-08-10 13:46:28 -0400 |
commit | 2f058256cb64e346f4fb4499ff4e0f1c2791a4b4 (patch) | |
tree | 91e06602f4d3abb6812ea8c9bc9ba4501e14c84e /drivers/media | |
parent | 0274aa2506fd2fe89a58dd6cd64d3b3f7b976af8 (diff) | |
parent | 86b3786078d63242d3194ffc58ae8dae1d1bbef3 (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'drivers/media')
178 files changed, 16329 insertions, 9634 deletions
diff --git a/drivers/media/common/ir-common.c b/drivers/media/common/ir-common.c index 84a49d2ec919..ab7a1fba4427 100644 --- a/drivers/media/common/ir-common.c +++ b/drivers/media/common/ir-common.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ir-common.c,v 1.8 2005/02/22 12:28:40 kraxel Exp $ | 2 | * $Id: ir-common.c,v 1.11 2005/07/07 14:44:43 mchehab Exp $ |
3 | * | 3 | * |
4 | * some common structs and functions to handle infrared remotes via | 4 | * some common structs and functions to handle infrared remotes via |
5 | * input layer ... | 5 | * input layer ... |
@@ -46,79 +46,49 @@ module_param(debug, int, 0644); | |||
46 | /* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ | 46 | /* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ |
47 | /* used by old (black) Hauppauge remotes */ | 47 | /* used by old (black) Hauppauge remotes */ |
48 | IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE] = { | 48 | IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE] = { |
49 | [ 0x00 ] = KEY_KP0, // 0 | 49 | /* Keys 0 to 9 */ |
50 | [ 0x01 ] = KEY_KP1, // 1 | 50 | [ 0x00 ] = KEY_KP0, |
51 | [ 0x02 ] = KEY_KP2, // 2 | 51 | [ 0x01 ] = KEY_KP1, |
52 | [ 0x03 ] = KEY_KP3, // 3 | 52 | [ 0x02 ] = KEY_KP2, |
53 | [ 0x04 ] = KEY_KP4, // 4 | 53 | [ 0x03 ] = KEY_KP3, |
54 | [ 0x05 ] = KEY_KP5, // 5 | 54 | [ 0x04 ] = KEY_KP4, |
55 | [ 0x06 ] = KEY_KP6, // 6 | 55 | [ 0x05 ] = KEY_KP5, |
56 | [ 0x07 ] = KEY_KP7, // 7 | 56 | [ 0x06 ] = KEY_KP6, |
57 | [ 0x08 ] = KEY_KP8, // 8 | 57 | [ 0x07 ] = KEY_KP7, |
58 | [ 0x09 ] = KEY_KP9, // 9 | 58 | [ 0x08 ] = KEY_KP8, |
59 | 59 | [ 0x09 ] = KEY_KP9, | |
60 | [ 0x0b ] = KEY_CHANNEL, // channel / program (japan: 11) | 60 | |
61 | [ 0x0c ] = KEY_POWER, // standby | 61 | [ 0x0b ] = KEY_CHANNEL, /* channel / program (japan: 11) */ |
62 | [ 0x0d ] = KEY_MUTE, // mute / demute | 62 | [ 0x0c ] = KEY_POWER, /* standby */ |
63 | [ 0x0f ] = KEY_TV, // display | 63 | [ 0x0d ] = KEY_MUTE, /* mute / demute */ |
64 | [ 0x10 ] = KEY_VOLUMEUP, // volume + | 64 | [ 0x0f ] = KEY_TV, /* display */ |
65 | [ 0x11 ] = KEY_VOLUMEDOWN, // volume - | 65 | [ 0x10 ] = KEY_VOLUMEUP, |
66 | [ 0x12 ] = KEY_BRIGHTNESSUP, // brightness + | 66 | [ 0x11 ] = KEY_VOLUMEDOWN, |
67 | [ 0x13 ] = KEY_BRIGHTNESSDOWN, // brightness - | 67 | [ 0x12 ] = KEY_BRIGHTNESSUP, |
68 | [ 0x1e ] = KEY_SEARCH, // search + | 68 | [ 0x13 ] = KEY_BRIGHTNESSDOWN, |
69 | [ 0x20 ] = KEY_CHANNELUP, // channel / program + | 69 | [ 0x1e ] = KEY_SEARCH, /* search + */ |
70 | [ 0x21 ] = KEY_CHANNELDOWN, // channel / program - | 70 | [ 0x20 ] = KEY_CHANNELUP, /* channel / program + */ |
71 | [ 0x22 ] = KEY_CHANNEL, // alt / channel | 71 | [ 0x21 ] = KEY_CHANNELDOWN, /* channel / program - */ |
72 | [ 0x23 ] = KEY_LANGUAGE, // 1st / 2nd language | 72 | [ 0x22 ] = KEY_CHANNEL, /* alt / channel */ |
73 | [ 0x26 ] = KEY_SLEEP, // sleeptimer | 73 | [ 0x23 ] = KEY_LANGUAGE, /* 1st / 2nd language */ |
74 | [ 0x2e ] = KEY_MENU, // 2nd controls (USA: menu) | 74 | [ 0x26 ] = KEY_SLEEP, /* sleeptimer */ |
75 | [ 0x30 ] = KEY_PAUSE, // pause | 75 | [ 0x2e ] = KEY_MENU, /* 2nd controls (USA: menu) */ |
76 | [ 0x32 ] = KEY_REWIND, // rewind | 76 | [ 0x30 ] = KEY_PAUSE, |
77 | [ 0x33 ] = KEY_GOTO, // go to | 77 | [ 0x32 ] = KEY_REWIND, |
78 | [ 0x35 ] = KEY_PLAY, // play | 78 | [ 0x33 ] = KEY_GOTO, |
79 | [ 0x36 ] = KEY_STOP, // stop | 79 | [ 0x35 ] = KEY_PLAY, |
80 | [ 0x37 ] = KEY_RECORD, // recording | 80 | [ 0x36 ] = KEY_STOP, |
81 | [ 0x3c ] = KEY_TEXT, // teletext submode (Japan: 12) | 81 | [ 0x37 ] = KEY_RECORD, /* recording */ |
82 | [ 0x3d ] = KEY_SUSPEND, // system standby | 82 | [ 0x3c ] = KEY_TEXT, /* teletext submode (Japan: 12) */ |
83 | 83 | [ 0x3d ] = KEY_SUSPEND, /* system standby */ | |
84 | #if 0 /* FIXME */ | 84 | |
85 | [ 0x0a ] = KEY_RESERVED, // 1/2/3 digits (japan: 10) | ||
86 | [ 0x0e ] = KEY_RESERVED, // P.P. (personal preference) | ||
87 | [ 0x14 ] = KEY_RESERVED, // colour saturation + | ||
88 | [ 0x15 ] = KEY_RESERVED, // colour saturation - | ||
89 | [ 0x16 ] = KEY_RESERVED, // bass + | ||
90 | [ 0x17 ] = KEY_RESERVED, // bass - | ||
91 | [ 0x18 ] = KEY_RESERVED, // treble + | ||
92 | [ 0x19 ] = KEY_RESERVED, // treble - | ||
93 | [ 0x1a ] = KEY_RESERVED, // balance right | ||
94 | [ 0x1b ] = KEY_RESERVED, // balance left | ||
95 | [ 0x1c ] = KEY_RESERVED, // contrast + | ||
96 | [ 0x1d ] = KEY_RESERVED, // contrast - | ||
97 | [ 0x1f ] = KEY_RESERVED, // tint/hue + | ||
98 | [ 0x24 ] = KEY_RESERVED, // spacial stereo on/off | ||
99 | [ 0x25 ] = KEY_RESERVED, // mono / stereo (USA) | ||
100 | [ 0x27 ] = KEY_RESERVED, // tint / hue - | ||
101 | [ 0x28 ] = KEY_RESERVED, // RF switch/PIP select | ||
102 | [ 0x29 ] = KEY_RESERVED, // vote | ||
103 | [ 0x2a ] = KEY_RESERVED, // timed page/channel clck | ||
104 | [ 0x2b ] = KEY_RESERVED, // increment (USA) | ||
105 | [ 0x2c ] = KEY_RESERVED, // decrement (USA) | ||
106 | [ 0x2d ] = KEY_RESERVED, // | ||
107 | [ 0x2f ] = KEY_RESERVED, // PIP shift | ||
108 | [ 0x31 ] = KEY_RESERVED, // erase | ||
109 | [ 0x34 ] = KEY_RESERVED, // wind | ||
110 | [ 0x38 ] = KEY_RESERVED, // external 1 | ||
111 | [ 0x39 ] = KEY_RESERVED, // external 2 | ||
112 | [ 0x3a ] = KEY_RESERVED, // PIP display mode | ||
113 | [ 0x3b ] = KEY_RESERVED, // view data mode / advance | ||
114 | [ 0x3e ] = KEY_RESERVED, // crispener on/off | ||
115 | [ 0x3f ] = KEY_RESERVED, // system select | ||
116 | #endif | ||
117 | }; | 85 | }; |
118 | EXPORT_SYMBOL_GPL(ir_codes_rc5_tv); | 86 | EXPORT_SYMBOL_GPL(ir_codes_rc5_tv); |
119 | 87 | ||
120 | /* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */ | 88 | /* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */ |
121 | IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = { | 89 | IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = { |
90 | /* Keys 0 to 9 */ | ||
91 | [ 18 ] = KEY_KP0, | ||
122 | [ 5 ] = KEY_KP1, | 92 | [ 5 ] = KEY_KP1, |
123 | [ 6 ] = KEY_KP2, | 93 | [ 6 ] = KEY_KP2, |
124 | [ 7 ] = KEY_KP3, | 94 | [ 7 ] = KEY_KP3, |
@@ -128,39 +98,31 @@ IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = { | |||
128 | [ 13 ] = KEY_KP7, | 98 | [ 13 ] = KEY_KP7, |
129 | [ 14 ] = KEY_KP8, | 99 | [ 14 ] = KEY_KP8, |
130 | [ 15 ] = KEY_KP9, | 100 | [ 15 ] = KEY_KP9, |
131 | [ 18 ] = KEY_KP0, | ||
132 | 101 | ||
133 | [ 0 ] = KEY_POWER, | 102 | [ 0 ] = KEY_POWER, |
134 | [ 27 ] = KEY_LANGUAGE, //MTS button | 103 | [ 2 ] = KEY_TUNER, /* TV/FM */ |
135 | [ 2 ] = KEY_TUNER, // TV/FM | ||
136 | [ 30 ] = KEY_VIDEO, | 104 | [ 30 ] = KEY_VIDEO, |
137 | [ 22 ] = KEY_INFO, //display button | ||
138 | [ 4 ] = KEY_VOLUMEUP, | 105 | [ 4 ] = KEY_VOLUMEUP, |
139 | [ 8 ] = KEY_VOLUMEDOWN, | 106 | [ 8 ] = KEY_VOLUMEDOWN, |
140 | [ 12 ] = KEY_CHANNELUP, | 107 | [ 12 ] = KEY_CHANNELUP, |
141 | [ 16 ] = KEY_CHANNELDOWN, | 108 | [ 16 ] = KEY_CHANNELDOWN, |
142 | [ 3 ] = KEY_ZOOM, // fullscreen | 109 | [ 3 ] = KEY_ZOOM, /* fullscreen */ |
143 | [ 31 ] = KEY_SUBTITLE, // closed caption/teletext | 110 | [ 31 ] = KEY_SUBTITLE, /* closed caption/teletext */ |
144 | [ 32 ] = KEY_SLEEP, | 111 | [ 32 ] = KEY_SLEEP, |
145 | [ 41 ] = KEY_SEARCH, //boss key | ||
146 | [ 20 ] = KEY_MUTE, | 112 | [ 20 ] = KEY_MUTE, |
147 | [ 43 ] = KEY_RED, | 113 | [ 43 ] = KEY_RED, |
148 | [ 44 ] = KEY_GREEN, | 114 | [ 44 ] = KEY_GREEN, |
149 | [ 45 ] = KEY_YELLOW, | 115 | [ 45 ] = KEY_YELLOW, |
150 | [ 46 ] = KEY_BLUE, | 116 | [ 46 ] = KEY_BLUE, |
151 | [ 24 ] = KEY_KPPLUS, //fine tune + | 117 | [ 24 ] = KEY_KPPLUS, /* fine tune + */ |
152 | [ 25 ] = KEY_KPMINUS, //fine tune - | 118 | [ 25 ] = KEY_KPMINUS, /* fine tune - */ |
153 | [ 42 ] = KEY_ANGLE, //picture in picture | 119 | [ 33 ] = KEY_KPDOT, |
154 | [ 33 ] = KEY_KPDOT, | ||
155 | [ 19 ] = KEY_KPENTER, | 120 | [ 19 ] = KEY_KPENTER, |
156 | [ 17 ] = KEY_AGAIN, //recall | ||
157 | [ 34 ] = KEY_BACK, | 121 | [ 34 ] = KEY_BACK, |
158 | [ 35 ] = KEY_PLAYPAUSE, | 122 | [ 35 ] = KEY_PLAYPAUSE, |
159 | [ 36 ] = KEY_NEXT, | 123 | [ 36 ] = KEY_NEXT, |
160 | [ 37 ] = KEY_T, //time shifting | ||
161 | [ 38 ] = KEY_STOP, | 124 | [ 38 ] = KEY_STOP, |
162 | [ 39 ] = KEY_RECORD, | 125 | [ 39 ] = KEY_RECORD |
163 | [ 40 ] = KEY_SHUFFLE //snapshot | ||
164 | }; | 126 | }; |
165 | EXPORT_SYMBOL_GPL(ir_codes_winfast); | 127 | EXPORT_SYMBOL_GPL(ir_codes_winfast); |
166 | 128 | ||
@@ -174,45 +136,97 @@ EXPORT_SYMBOL_GPL(ir_codes_empty); | |||
174 | * slightly different versions), shipped with cx88+ivtv cards. | 136 | * slightly different versions), shipped with cx88+ivtv cards. |
175 | * almost rc5 coding, but some non-standard keys */ | 137 | * almost rc5 coding, but some non-standard keys */ |
176 | IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = { | 138 | IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = { |
177 | [ 0x00 ] = KEY_KP0, // 0 | 139 | /* Keys 0 to 9 */ |
178 | [ 0x01 ] = KEY_KP1, // 1 | 140 | [ 0x00 ] = KEY_KP0, |
179 | [ 0x02 ] = KEY_KP2, // 2 | 141 | [ 0x01 ] = KEY_KP1, |
180 | [ 0x03 ] = KEY_KP3, // 3 | 142 | [ 0x02 ] = KEY_KP2, |
181 | [ 0x04 ] = KEY_KP4, // 4 | 143 | [ 0x03 ] = KEY_KP3, |
182 | [ 0x05 ] = KEY_KP5, // 5 | 144 | [ 0x04 ] = KEY_KP4, |
183 | [ 0x06 ] = KEY_KP6, // 6 | 145 | [ 0x05 ] = KEY_KP5, |
184 | [ 0x07 ] = KEY_KP7, // 7 | 146 | [ 0x06 ] = KEY_KP6, |
185 | [ 0x08 ] = KEY_KP8, // 8 | 147 | [ 0x07 ] = KEY_KP7, |
186 | [ 0x09 ] = KEY_KP9, // 9 | 148 | [ 0x08 ] = KEY_KP8, |
187 | [ 0x0b ] = KEY_RED, // red button | 149 | [ 0x09 ] = KEY_KP9, |
188 | [ 0x0c ] = KEY_OPTION, // black key without text | 150 | |
189 | [ 0x0d ] = KEY_MENU, // menu | 151 | [ 0x0a ] = KEY_TEXT, /* keypad asterisk as well */ |
190 | [ 0x0f ] = KEY_MUTE, // mute | 152 | [ 0x0b ] = KEY_RED, /* red button */ |
191 | [ 0x10 ] = KEY_VOLUMEUP, // volume + | 153 | [ 0x0c ] = KEY_RADIO, |
192 | [ 0x11 ] = KEY_VOLUMEDOWN, // volume - | 154 | [ 0x0d ] = KEY_MENU, |
193 | [ 0x1e ] = KEY_NEXT, // skip >| | 155 | [ 0x0e ] = KEY_SUBTITLE, /* also the # key */ |
194 | [ 0x1f ] = KEY_EXIT, // back/exit | 156 | [ 0x0f ] = KEY_MUTE, |
195 | [ 0x20 ] = KEY_CHANNELUP, // channel / program + | 157 | [ 0x10 ] = KEY_VOLUMEUP, |
196 | [ 0x21 ] = KEY_CHANNELDOWN, // channel / program - | 158 | [ 0x11 ] = KEY_VOLUMEDOWN, |
197 | [ 0x22 ] = KEY_CHANNEL, // source (old black remote) | 159 | [ 0x12 ] = KEY_PREVIOUS, /* previous channel */ |
198 | [ 0x24 ] = KEY_PREVIOUS, // replay |< | 160 | [ 0x14 ] = KEY_UP, |
199 | [ 0x25 ] = KEY_ENTER, // OK | 161 | [ 0x15 ] = KEY_DOWN, |
200 | [ 0x26 ] = KEY_SLEEP, // minimize (old black remote) | 162 | [ 0x16 ] = KEY_LEFT, |
201 | [ 0x29 ] = KEY_BLUE, // blue key | 163 | [ 0x17 ] = KEY_RIGHT, |
202 | [ 0x2e ] = KEY_GREEN, // green button | 164 | [ 0x18 ] = KEY_VIDEO, /* Videos */ |
203 | [ 0x30 ] = KEY_PAUSE, // pause | 165 | [ 0x19 ] = KEY_AUDIO, /* Music */ |
204 | [ 0x32 ] = KEY_REWIND, // backward << | 166 | /* 0x1a: Pictures - presume this means |
205 | [ 0x34 ] = KEY_FASTFORWARD, // forward >> | 167 | "Multimedia Home Platform" - |
206 | [ 0x35 ] = KEY_PLAY, // play | 168 | no "PICTURES" key in input.h |
207 | [ 0x36 ] = KEY_STOP, // stop | 169 | */ |
208 | [ 0x37 ] = KEY_RECORD, // recording | 170 | [ 0x1a ] = KEY_MHP, |
209 | [ 0x38 ] = KEY_YELLOW, // yellow key | 171 | |
210 | [ 0x3b ] = KEY_SELECT, // top right button | 172 | [ 0x1b ] = KEY_EPG, /* Guide */ |
211 | [ 0x3c ] = KEY_ZOOM, // full | 173 | [ 0x1c ] = KEY_TV, |
212 | [ 0x3d ] = KEY_POWER, // system power (green button) | 174 | [ 0x1e ] = KEY_NEXTSONG, /* skip >| */ |
175 | [ 0x1f ] = KEY_EXIT, /* back/exit */ | ||
176 | [ 0x20 ] = KEY_CHANNELUP, /* channel / program + */ | ||
177 | [ 0x21 ] = KEY_CHANNELDOWN, /* channel / program - */ | ||
178 | [ 0x22 ] = KEY_CHANNEL, /* source (old black remote) */ | ||
179 | [ 0x24 ] = KEY_PREVIOUSSONG, /* replay |< */ | ||
180 | [ 0x25 ] = KEY_ENTER, /* OK */ | ||
181 | [ 0x26 ] = KEY_SLEEP, /* minimize (old black remote) */ | ||
182 | [ 0x29 ] = KEY_BLUE, /* blue key */ | ||
183 | [ 0x2e ] = KEY_GREEN, /* green button */ | ||
184 | [ 0x30 ] = KEY_PAUSE, /* pause */ | ||
185 | [ 0x32 ] = KEY_REWIND, /* backward << */ | ||
186 | [ 0x34 ] = KEY_FASTFORWARD, /* forward >> */ | ||
187 | [ 0x35 ] = KEY_PLAY, | ||
188 | [ 0x36 ] = KEY_STOP, | ||
189 | [ 0x37 ] = KEY_RECORD, /* recording */ | ||
190 | [ 0x38 ] = KEY_YELLOW, /* yellow key */ | ||
191 | [ 0x3b ] = KEY_SELECT, /* top right button */ | ||
192 | [ 0x3c ] = KEY_ZOOM, /* full */ | ||
193 | [ 0x3d ] = KEY_POWER, /* system power (green button) */ | ||
213 | }; | 194 | }; |
214 | EXPORT_SYMBOL(ir_codes_hauppauge_new); | 195 | EXPORT_SYMBOL(ir_codes_hauppauge_new); |
215 | 196 | ||
197 | IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE] = { | ||
198 | [ 2 ] = KEY_KP0, | ||
199 | [ 1 ] = KEY_KP1, | ||
200 | [ 11 ] = KEY_KP2, | ||
201 | [ 27 ] = KEY_KP3, | ||
202 | [ 5 ] = KEY_KP4, | ||
203 | [ 9 ] = KEY_KP5, | ||
204 | [ 21 ] = KEY_KP6, | ||
205 | [ 6 ] = KEY_KP7, | ||
206 | [ 10 ] = KEY_KP8, | ||
207 | [ 18 ] = KEY_KP9, | ||
208 | |||
209 | [ 3 ] = KEY_TUNER, /* TV/FM */ | ||
210 | [ 7 ] = KEY_SEARCH, /* scan */ | ||
211 | [ 28 ] = KEY_ZOOM, /* full screen */ | ||
212 | [ 30 ] = KEY_POWER, | ||
213 | [ 23 ] = KEY_VOLUMEDOWN, | ||
214 | [ 31 ] = KEY_VOLUMEUP, | ||
215 | [ 20 ] = KEY_CHANNELDOWN, | ||
216 | [ 22 ] = KEY_CHANNELUP, | ||
217 | [ 24 ] = KEY_MUTE, | ||
218 | |||
219 | [ 0 ] = KEY_LIST, /* source */ | ||
220 | [ 19 ] = KEY_INFO, /* loop */ | ||
221 | [ 16 ] = KEY_LAST, /* +100 */ | ||
222 | [ 13 ] = KEY_CLEAR, /* reset */ | ||
223 | [ 12 ] = BTN_RIGHT, /* fun++ */ | ||
224 | [ 4 ] = BTN_LEFT, /* fun-- */ | ||
225 | [ 14 ] = KEY_GOTO, /* function */ | ||
226 | [ 15 ] = KEY_STOP, /* freeze */ | ||
227 | }; | ||
228 | EXPORT_SYMBOL(ir_codes_pixelview); | ||
229 | |||
216 | /* -------------------------------------------------------------------------- */ | 230 | /* -------------------------------------------------------------------------- */ |
217 | 231 | ||
218 | static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) | 232 | static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) |
@@ -276,10 +290,6 @@ void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, | |||
276 | ir->keypressed = 1; | 290 | ir->keypressed = 1; |
277 | ir_input_key_event(dev,ir); | 291 | ir_input_key_event(dev,ir); |
278 | } | 292 | } |
279 | #if 0 | ||
280 | /* maybe do something like this ??? */ | ||
281 | input_event(a, EV_IR, ir->ir_type, ir->ir_raw); | ||
282 | #endif | ||
283 | } | 293 | } |
284 | 294 | ||
285 | /* -------------------------------------------------------------------------- */ | 295 | /* -------------------------------------------------------------------------- */ |
@@ -379,3 +389,4 @@ EXPORT_SYMBOL_GPL(ir_decode_biphase); | |||
379 | * c-basic-offset: 8 | 389 | * c-basic-offset: 8 |
380 | * End: | 390 | * End: |
381 | */ | 391 | */ |
392 | |||
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index 50e8b8654018..cd5828b5e9e3 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c | |||
@@ -62,13 +62,15 @@ void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data) | |||
62 | int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop) | 62 | int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop) |
63 | { | 63 | { |
64 | unsigned long start; | 64 | unsigned long start; |
65 | int err; | ||
65 | 66 | ||
66 | /* wait for registers to be programmed */ | 67 | /* wait for registers to be programmed */ |
67 | start = jiffies; | 68 | start = jiffies; |
68 | while (1) { | 69 | while (1) { |
69 | if (saa7146_read(dev, MC2) & 2) | 70 | err = time_after(jiffies, start + HZ/20); |
70 | break; | 71 | if (saa7146_read(dev, MC2) & 2) |
71 | if (time_after(jiffies, start + HZ/20)) { | 72 | break; |
73 | if (err) { | ||
72 | DEB_S(("timed out while waiting for registers getting programmed\n")); | 74 | DEB_S(("timed out while waiting for registers getting programmed\n")); |
73 | return -ETIMEDOUT; | 75 | return -ETIMEDOUT; |
74 | } | 76 | } |
@@ -79,10 +81,11 @@ int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop) | |||
79 | /* wait for transfer to complete */ | 81 | /* wait for transfer to complete */ |
80 | start = jiffies; | 82 | start = jiffies; |
81 | while (1) { | 83 | while (1) { |
84 | err = time_after(jiffies, start + HZ/4); | ||
82 | if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S)) | 85 | if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S)) |
83 | break; | 86 | break; |
84 | saa7146_read(dev, MC2); | 87 | saa7146_read(dev, MC2); |
85 | if (time_after(jiffies, start + HZ/4)) { | 88 | if (err) { |
86 | DEB_S(("timed out while waiting for transfer completion\n")); | 89 | DEB_S(("timed out while waiting for transfer completion\n")); |
87 | return -ETIMEDOUT; | 90 | return -ETIMEDOUT; |
88 | } | 91 | } |
@@ -512,7 +515,7 @@ int saa7146_register_extension(struct saa7146_extension* ext) | |||
512 | ext->driver.remove = saa7146_remove_one; | 515 | ext->driver.remove = saa7146_remove_one; |
513 | 516 | ||
514 | printk("saa7146: register extension '%s'.\n",ext->name); | 517 | printk("saa7146: register extension '%s'.\n",ext->name); |
515 | return pci_module_init(&ext->driver); | 518 | return pci_register_driver(&ext->driver); |
516 | } | 519 | } |
517 | 520 | ||
518 | int saa7146_unregister_extension(struct saa7146_extension* ext) | 521 | int saa7146_unregister_extension(struct saa7146_extension* ext) |
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index cb826c9adfe7..c04fd11526e0 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
@@ -403,7 +403,7 @@ static struct file_operations video_fops = | |||
403 | .llseek = no_llseek, | 403 | .llseek = no_llseek, |
404 | }; | 404 | }; |
405 | 405 | ||
406 | void vv_callback(struct saa7146_dev *dev, unsigned long status) | 406 | static void vv_callback(struct saa7146_dev *dev, unsigned long status) |
407 | { | 407 | { |
408 | u32 isr = status; | 408 | u32 isr = status; |
409 | 409 | ||
diff --git a/drivers/media/dvb/Kconfig b/drivers/media/dvb/Kconfig index 4983e1b1bb1d..3f0ec6be03ae 100644 --- a/drivers/media/dvb/Kconfig +++ b/drivers/media/dvb/Kconfig | |||
@@ -27,9 +27,9 @@ source "drivers/media/dvb/ttpci/Kconfig" | |||
27 | 27 | ||
28 | comment "Supported USB Adapters" | 28 | comment "Supported USB Adapters" |
29 | depends on DVB_CORE && USB | 29 | depends on DVB_CORE && USB |
30 | source "drivers/media/dvb/dvb-usb/Kconfig" | ||
30 | source "drivers/media/dvb/ttusb-budget/Kconfig" | 31 | source "drivers/media/dvb/ttusb-budget/Kconfig" |
31 | source "drivers/media/dvb/ttusb-dec/Kconfig" | 32 | source "drivers/media/dvb/ttusb-dec/Kconfig" |
32 | source "drivers/media/dvb/dibusb/Kconfig" | ||
33 | source "drivers/media/dvb/cinergyT2/Kconfig" | 33 | source "drivers/media/dvb/cinergyT2/Kconfig" |
34 | 34 | ||
35 | comment "Supported FlexCopII (B2C2) Adapters" | 35 | comment "Supported FlexCopII (B2C2) Adapters" |
@@ -40,6 +40,10 @@ comment "Supported BT878 Adapters" | |||
40 | depends on DVB_CORE && PCI | 40 | depends on DVB_CORE && PCI |
41 | source "drivers/media/dvb/bt8xx/Kconfig" | 41 | source "drivers/media/dvb/bt8xx/Kconfig" |
42 | 42 | ||
43 | comment "Supported Pluto2 Adapters" | ||
44 | depends on DVB_CORE && PCI | ||
45 | source "drivers/media/dvb/pluto2/Kconfig" | ||
46 | |||
43 | comment "Supported DVB Frontends" | 47 | comment "Supported DVB Frontends" |
44 | depends on DVB_CORE | 48 | depends on DVB_CORE |
45 | source "drivers/media/dvb/frontends/Kconfig" | 49 | source "drivers/media/dvb/frontends/Kconfig" |
diff --git a/drivers/media/dvb/Makefile b/drivers/media/dvb/Makefile index 520fc3902819..a7ad0841e6fc 100644 --- a/drivers/media/dvb/Makefile +++ b/drivers/media/dvb/Makefile | |||
@@ -2,4 +2,4 @@ | |||
2 | # Makefile for the kernel multimedia device drivers. | 2 | # Makefile for the kernel multimedia device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := dvb-core/ frontends/ ttpci/ ttusb-dec/ ttusb-budget/ b2c2/ bt8xx/ dibusb/ cinergyT2/ | 5 | obj-y := dvb-core/ frontends/ ttpci/ ttusb-dec/ ttusb-budget/ b2c2/ bt8xx/ cinergyT2/ dvb-usb/ pluto2/ |
diff --git a/drivers/media/dvb/b2c2/Kconfig b/drivers/media/dvb/b2c2/Kconfig index 99bd675df955..d7417eac2aba 100644 --- a/drivers/media/dvb/b2c2/Kconfig +++ b/drivers/media/dvb/b2c2/Kconfig | |||
@@ -6,6 +6,7 @@ config DVB_B2C2_FLEXCOP | |||
6 | select DVB_MT312 | 6 | select DVB_MT312 |
7 | select DVB_NXT2002 | 7 | select DVB_NXT2002 |
8 | select DVB_STV0297 | 8 | select DVB_STV0297 |
9 | select DVB_BCM3510 | ||
9 | help | 10 | help |
10 | Support for the digital TV receiver chip made by B2C2 Inc. included in | 11 | Support for the digital TV receiver chip made by B2C2 Inc. included in |
11 | Technisats PCI cards and USB boxes. | 12 | Technisats PCI cards and USB boxes. |
@@ -34,17 +35,3 @@ config DVB_B2C2_FLEXCOP_DEBUG | |||
34 | help | 35 | help |
35 | Say Y if you want to enable the module option to control debug messages | 36 | Say Y if you want to enable the module option to control debug messages |
36 | of all B2C2 FlexCop drivers. | 37 | of all B2C2 FlexCop drivers. |
37 | |||
38 | config DVB_B2C2_SKYSTAR | ||
39 | tristate "B2C2/Technisat Air/Sky/CableStar 2 PCI" | ||
40 | depends on DVB_CORE && PCI | ||
41 | select DVB_STV0299 | ||
42 | select DVB_MT352 | ||
43 | select DVB_MT312 | ||
44 | select DVB_NXT2002 | ||
45 | help | ||
46 | Support for the Skystar2 PCI DVB card by Technisat, which | ||
47 | is equipped with the FlexCopII chipset by B2C2, and | ||
48 | for the B2C2/BBTI Air2PC-ATSC card. | ||
49 | |||
50 | Say Y if you own such a device and want to use it. | ||
diff --git a/drivers/media/dvb/b2c2/Makefile b/drivers/media/dvb/b2c2/Makefile index 7703812af34f..1a1c3bca55fa 100644 --- a/drivers/media/dvb/b2c2/Makefile +++ b/drivers/media/dvb/b2c2/Makefile | |||
@@ -9,6 +9,4 @@ obj-$(CONFIG_DVB_B2C2_FLEXCOP_PCI) += b2c2-flexcop-pci.o | |||
9 | b2c2-flexcop-usb-objs = flexcop-usb.o | 9 | b2c2-flexcop-usb-objs = flexcop-usb.o |
10 | obj-$(CONFIG_DVB_B2C2_FLEXCOP_USB) += b2c2-flexcop-usb.o | 10 | obj-$(CONFIG_DVB_B2C2_FLEXCOP_USB) += b2c2-flexcop-usb.o |
11 | 11 | ||
12 | obj-$(CONFIG_DVB_B2C2_SKYSTAR) += skystar2.o | ||
13 | |||
14 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | 12 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ |
diff --git a/drivers/media/dvb/b2c2/flexcop-common.h b/drivers/media/dvb/b2c2/flexcop-common.h index 773d158032df..a94912ac1872 100644 --- a/drivers/media/dvb/b2c2/flexcop-common.h +++ b/drivers/media/dvb/b2c2/flexcop-common.h | |||
@@ -108,6 +108,8 @@ void flexcop_device_kfree(struct flexcop_device*); | |||
108 | int flexcop_device_initialize(struct flexcop_device*); | 108 | int flexcop_device_initialize(struct flexcop_device*); |
109 | void flexcop_device_exit(struct flexcop_device *fc); | 109 | void flexcop_device_exit(struct flexcop_device *fc); |
110 | 110 | ||
111 | void flexcop_reset_block_300(struct flexcop_device *fc); | ||
112 | |||
111 | /* from flexcop-dma.c */ | 113 | /* from flexcop-dma.c */ |
112 | int flexcop_dma_allocate(struct pci_dev *pdev, struct flexcop_dma *dma, u32 size); | 114 | int flexcop_dma_allocate(struct pci_dev *pdev, struct flexcop_dma *dma, u32 size); |
113 | void flexcop_dma_free(struct flexcop_dma *dma); | 115 | void flexcop_dma_free(struct flexcop_dma *dma); |
@@ -115,7 +117,8 @@ void flexcop_dma_free(struct flexcop_dma *dma); | |||
115 | int flexcop_dma_control_timer_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); | 117 | int flexcop_dma_control_timer_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); |
116 | int flexcop_dma_control_size_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); | 118 | int flexcop_dma_control_size_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); |
117 | int flexcop_dma_control_packet_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); | 119 | int flexcop_dma_control_packet_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); |
118 | int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma, flexcop_dma_index_t dma_idx,flexcop_dma_addr_index_t index); | 120 | int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma, flexcop_dma_index_t dma_idx); |
121 | int flexcop_dma_xfer_control(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, flexcop_dma_addr_index_t index, int onoff); | ||
119 | int flexcop_dma_config_timer(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 cycles); | 122 | int flexcop_dma_config_timer(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 cycles); |
120 | int flexcop_dma_config_packet_count(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 packets); | 123 | int flexcop_dma_config_packet_count(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 packets); |
121 | 124 | ||
@@ -151,6 +154,7 @@ int flexcop_sram_init(struct flexcop_device *fc); | |||
151 | /* from flexcop-misc.c */ | 154 | /* from flexcop-misc.c */ |
152 | void flexcop_determine_revision(struct flexcop_device *fc); | 155 | void flexcop_determine_revision(struct flexcop_device *fc); |
153 | void flexcop_device_name(struct flexcop_device *fc,const char *prefix,const char *suffix); | 156 | void flexcop_device_name(struct flexcop_device *fc,const char *prefix,const char *suffix); |
157 | void flexcop_dump_reg(struct flexcop_device *fc, flexcop_ibi_register reg, int num); | ||
154 | 158 | ||
155 | /* from flexcop-hw-filter.c */ | 159 | /* from flexcop-hw-filter.c */ |
156 | int flexcop_pid_feed_control(struct flexcop_device *fc, struct dvb_demux_feed *dvbdmxfeed, int onoff); | 160 | int flexcop_pid_feed_control(struct flexcop_device *fc, struct dvb_demux_feed *dvbdmxfeed, int onoff); |
diff --git a/drivers/media/dvb/b2c2/flexcop-dma.c b/drivers/media/dvb/b2c2/flexcop-dma.c index 8d2706075360..cf4ed1df6086 100644 --- a/drivers/media/dvb/b2c2/flexcop-dma.c +++ b/drivers/media/dvb/b2c2/flexcop-dma.c | |||
@@ -37,22 +37,90 @@ void flexcop_dma_free(struct flexcop_dma *dma) | |||
37 | } | 37 | } |
38 | EXPORT_SYMBOL(flexcop_dma_free); | 38 | EXPORT_SYMBOL(flexcop_dma_free); |
39 | 39 | ||
40 | int flexcop_dma_control_timer_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff) | 40 | int flexcop_dma_config(struct flexcop_device *fc, |
41 | struct flexcop_dma *dma, | ||
42 | flexcop_dma_index_t dma_idx) | ||
41 | { | 43 | { |
42 | flexcop_ibi_value v = fc->read_ibi_reg(fc,ctrl_208); | 44 | flexcop_ibi_value v0x0,v0x4,v0xc; |
45 | v0x0.raw = v0x4.raw = v0xc.raw = 0; | ||
43 | 46 | ||
44 | if (no & FC_DMA_1) | 47 | v0x0.dma_0x0.dma_address0 = dma->dma_addr0 >> 2; |
45 | v.ctrl_208.DMA1_Timer_Enable_sig = onoff; | 48 | v0xc.dma_0xc.dma_address1 = dma->dma_addr1 >> 2; |
49 | v0x4.dma_0x4_write.dma_addr_size = dma->size / 4; | ||
46 | 50 | ||
47 | if (no & FC_DMA_2) | 51 | if ((dma_idx & FC_DMA_1) == dma_idx) { |
48 | v.ctrl_208.DMA2_Timer_Enable_sig = onoff; | 52 | fc->write_ibi_reg(fc,dma1_000,v0x0); |
53 | fc->write_ibi_reg(fc,dma1_004,v0x4); | ||
54 | fc->write_ibi_reg(fc,dma1_00c,v0xc); | ||
55 | } else if ((dma_idx & FC_DMA_2) == dma_idx) { | ||
56 | fc->write_ibi_reg(fc,dma2_010,v0x0); | ||
57 | fc->write_ibi_reg(fc,dma2_014,v0x4); | ||
58 | fc->write_ibi_reg(fc,dma2_01c,v0xc); | ||
59 | } else { | ||
60 | err("either DMA1 or DMA2 can be configured at the within one flexcop_dma_config call."); | ||
61 | return -EINVAL; | ||
62 | } | ||
49 | 63 | ||
50 | fc->write_ibi_reg(fc,ctrl_208,v); | ||
51 | return 0; | 64 | return 0; |
52 | } | 65 | } |
53 | EXPORT_SYMBOL(flexcop_dma_control_timer_irq); | 66 | EXPORT_SYMBOL(flexcop_dma_config); |
67 | |||
68 | /* start the DMA transfers, but not the DMA IRQs */ | ||
69 | int flexcop_dma_xfer_control(struct flexcop_device *fc, | ||
70 | flexcop_dma_index_t dma_idx, | ||
71 | flexcop_dma_addr_index_t index, | ||
72 | int onoff) | ||
73 | { | ||
74 | flexcop_ibi_value v0x0,v0xc; | ||
75 | flexcop_ibi_register r0x0,r0xc; | ||
76 | |||
77 | if ((dma_idx & FC_DMA_1) == dma_idx) { | ||
78 | r0x0 = dma1_000; | ||
79 | r0xc = dma1_00c; | ||
80 | } else if ((dma_idx & FC_DMA_2) == dma_idx) { | ||
81 | r0x0 = dma2_010; | ||
82 | r0xc = dma2_01c; | ||
83 | } else { | ||
84 | err("either transfer DMA1 or DMA2 can be started within one flexcop_dma_xfer_control call."); | ||
85 | return -EINVAL; | ||
86 | } | ||
87 | |||
88 | v0x0 = fc->read_ibi_reg(fc,r0x0); | ||
89 | v0xc = fc->read_ibi_reg(fc,r0xc); | ||
90 | |||
91 | deb_rdump("reg: %03x: %x\n",r0x0,v0x0.raw); | ||
92 | deb_rdump("reg: %03x: %x\n",r0xc,v0xc.raw); | ||
93 | |||
94 | if (index & FC_DMA_SUBADDR_0) | ||
95 | v0x0.dma_0x0.dma_0start = onoff; | ||
96 | |||
97 | if (index & FC_DMA_SUBADDR_1) | ||
98 | v0xc.dma_0xc.dma_1start = onoff; | ||
99 | |||
100 | fc->write_ibi_reg(fc,r0x0,v0x0); | ||
101 | fc->write_ibi_reg(fc,r0xc,v0xc); | ||
102 | |||
103 | deb_rdump("reg: %03x: %x\n",r0x0,v0x0.raw); | ||
104 | deb_rdump("reg: %03x: %x\n",r0xc,v0xc.raw); | ||
105 | return 0; | ||
106 | } | ||
107 | EXPORT_SYMBOL(flexcop_dma_xfer_control); | ||
108 | |||
109 | static int flexcop_dma_remap(struct flexcop_device *fc, | ||
110 | flexcop_dma_index_t dma_idx, | ||
111 | int onoff) | ||
112 | { | ||
113 | flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_00c : dma2_01c; | ||
114 | flexcop_ibi_value v = fc->read_ibi_reg(fc,r); | ||
115 | deb_info("%s\n",__FUNCTION__); | ||
116 | v.dma_0xc.remap_enable = onoff; | ||
117 | fc->write_ibi_reg(fc,r,v); | ||
118 | return 0; | ||
119 | } | ||
54 | 120 | ||
55 | int flexcop_dma_control_size_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff) | 121 | int flexcop_dma_control_size_irq(struct flexcop_device *fc, |
122 | flexcop_dma_index_t no, | ||
123 | int onoff) | ||
56 | { | 124 | { |
57 | flexcop_ibi_value v = fc->read_ibi_reg(fc,ctrl_208); | 125 | flexcop_ibi_value v = fc->read_ibi_reg(fc,ctrl_208); |
58 | 126 | ||
@@ -67,75 +135,64 @@ int flexcop_dma_control_size_irq(struct flexcop_device *fc, flexcop_dma_index_t | |||
67 | } | 135 | } |
68 | EXPORT_SYMBOL(flexcop_dma_control_size_irq); | 136 | EXPORT_SYMBOL(flexcop_dma_control_size_irq); |
69 | 137 | ||
70 | int flexcop_dma_control_packet_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff) | 138 | int flexcop_dma_control_timer_irq(struct flexcop_device *fc, |
139 | flexcop_dma_index_t no, | ||
140 | int onoff) | ||
71 | { | 141 | { |
72 | flexcop_ibi_value v = fc->read_ibi_reg(fc,ctrl_208); | 142 | flexcop_ibi_value v = fc->read_ibi_reg(fc,ctrl_208); |
73 | 143 | ||
74 | if (no & FC_DMA_1) | 144 | if (no & FC_DMA_1) |
75 | v.ctrl_208.DMA1_Size_IRQ_Enable_sig = onoff; | 145 | v.ctrl_208.DMA1_Timer_Enable_sig = onoff; |
76 | 146 | ||
77 | if (no & FC_DMA_2) | 147 | if (no & FC_DMA_2) |
78 | v.ctrl_208.DMA2_Size_IRQ_Enable_sig = onoff; | 148 | v.ctrl_208.DMA2_Timer_Enable_sig = onoff; |
79 | 149 | ||
80 | fc->write_ibi_reg(fc,ctrl_208,v); | 150 | fc->write_ibi_reg(fc,ctrl_208,v); |
81 | return 0; | 151 | return 0; |
82 | } | 152 | } |
83 | EXPORT_SYMBOL(flexcop_dma_control_packet_irq); | 153 | EXPORT_SYMBOL(flexcop_dma_control_timer_irq); |
84 | 154 | ||
85 | int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma, flexcop_dma_index_t dma_idx,flexcop_dma_addr_index_t index) | 155 | /* 1 cycles = 1.97 msec */ |
156 | int flexcop_dma_config_timer(struct flexcop_device *fc, | ||
157 | flexcop_dma_index_t dma_idx, | ||
158 | u8 cycles) | ||
86 | { | 159 | { |
160 | flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_004 : dma2_014; | ||
161 | flexcop_ibi_value v = fc->read_ibi_reg(fc,r); | ||
87 | 162 | ||
88 | flexcop_ibi_value v0x0,v0x4,v0xc; | 163 | flexcop_dma_remap(fc,dma_idx,0); |
89 | v0x0.raw = v0x4.raw = v0xc.raw = 0; | ||
90 | |||
91 | v0x0.dma_0x0.dma_address0 = dma->dma_addr0 >> 2; | ||
92 | v0xc.dma_0xc.dma_address1 = dma->dma_addr1 >> 2; | ||
93 | v0x4.dma_0x4_write.dma_addr_size = dma->size / 4; | ||
94 | |||
95 | if (index & FC_DMA_SUBADDR_0) | ||
96 | v0x0.dma_0x0.dma_0start = 1; | ||
97 | |||
98 | if (index & FC_DMA_SUBADDR_1) | ||
99 | v0xc.dma_0xc.dma_1start = 1; | ||
100 | |||
101 | if (dma_idx & FC_DMA_1) { | ||
102 | fc->write_ibi_reg(fc,dma1_000,v0x0); | ||
103 | fc->write_ibi_reg(fc,dma1_004,v0x4); | ||
104 | fc->write_ibi_reg(fc,dma1_00c,v0xc); | ||
105 | } else { /* (dma_idx & FC_DMA_2) */ | ||
106 | fc->write_ibi_reg(fc,dma2_010,v0x0); | ||
107 | fc->write_ibi_reg(fc,dma2_014,v0x4); | ||
108 | fc->write_ibi_reg(fc,dma2_01c,v0xc); | ||
109 | } | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | EXPORT_SYMBOL(flexcop_dma_config); | ||
114 | 164 | ||
115 | static int flexcop_dma_remap(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, int onoff) | 165 | deb_info("%s\n",__FUNCTION__); |
116 | { | 166 | v.dma_0x4_write.dmatimer = cycles; |
117 | flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_00c : dma2_01c; | ||
118 | flexcop_ibi_value v = fc->read_ibi_reg(fc,r); | ||
119 | v.dma_0xc.remap_enable = onoff; | ||
120 | fc->write_ibi_reg(fc,r,v); | 167 | fc->write_ibi_reg(fc,r,v); |
121 | return 0; | 168 | return 0; |
122 | } | 169 | } |
170 | EXPORT_SYMBOL(flexcop_dma_config_timer); | ||
123 | 171 | ||
124 | /* 1 cycles = 1.97 msec */ | 172 | /* packet IRQ does not exist in FCII or FCIIb - according to data book and tests */ |
125 | int flexcop_dma_config_timer(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 cycles) | 173 | int flexcop_dma_control_packet_irq(struct flexcop_device *fc, |
174 | flexcop_dma_index_t no, | ||
175 | int onoff) | ||
126 | { | 176 | { |
127 | flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_004 : dma2_014; | 177 | flexcop_ibi_value v = fc->read_ibi_reg(fc,ctrl_208); |
128 | flexcop_ibi_value v = fc->read_ibi_reg(fc,r); | ||
129 | 178 | ||
130 | flexcop_dma_remap(fc,dma_idx,0); | 179 | deb_rdump("reg: %03x: %x\n",ctrl_208,v.raw); |
180 | if (no & FC_DMA_1) | ||
181 | v.ctrl_208.DMA1_Size_IRQ_Enable_sig = onoff; | ||
182 | |||
183 | if (no & FC_DMA_2) | ||
184 | v.ctrl_208.DMA2_Size_IRQ_Enable_sig = onoff; | ||
185 | |||
186 | fc->write_ibi_reg(fc,ctrl_208,v); | ||
187 | deb_rdump("reg: %03x: %x\n",ctrl_208,v.raw); | ||
131 | 188 | ||
132 | v.dma_0x4_write.dmatimer = cycles >> 1; | ||
133 | fc->write_ibi_reg(fc,r,v); | ||
134 | return 0; | 189 | return 0; |
135 | } | 190 | } |
136 | EXPORT_SYMBOL(flexcop_dma_config_timer); | 191 | EXPORT_SYMBOL(flexcop_dma_control_packet_irq); |
137 | 192 | ||
138 | int flexcop_dma_config_packet_count(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 packets) | 193 | int flexcop_dma_config_packet_count(struct flexcop_device *fc, |
194 | flexcop_dma_index_t dma_idx, | ||
195 | u8 packets) | ||
139 | { | 196 | { |
140 | flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_004 : dma2_014; | 197 | flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_004 : dma2_014; |
141 | flexcop_ibi_value v = fc->read_ibi_reg(fc,r); | 198 | flexcop_ibi_value v = fc->read_ibi_reg(fc,r); |
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c index 71be400e9aeb..0410cc96a48e 100644 --- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include "stv0299.h" | 10 | #include "stv0299.h" |
11 | #include "mt352.h" | 11 | #include "mt352.h" |
12 | #include "nxt2002.h" | 12 | #include "nxt2002.h" |
13 | #include "bcm3510.h" | ||
13 | #include "stv0297.h" | 14 | #include "stv0297.h" |
14 | #include "mt312.h" | 15 | #include "mt312.h" |
15 | 16 | ||
@@ -285,21 +286,25 @@ static int samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct dvb_front | |||
285 | } | 286 | } |
286 | 287 | ||
287 | static struct mt352_config samsung_tdtc9251dh0_config = { | 288 | static struct mt352_config samsung_tdtc9251dh0_config = { |
288 | |||
289 | .demod_address = 0x0f, | 289 | .demod_address = 0x0f, |
290 | .demod_init = samsung_tdtc9251dh0_demod_init, | 290 | .demod_init = samsung_tdtc9251dh0_demod_init, |
291 | .pll_set = samsung_tdtc9251dh0_pll_set, | 291 | .pll_set = samsung_tdtc9251dh0_pll_set, |
292 | }; | 292 | }; |
293 | 293 | ||
294 | static int nxt2002_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name) | 294 | static int flexcop_fe_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name) |
295 | { | 295 | { |
296 | struct flexcop_device *fc = fe->dvb->priv; | 296 | struct flexcop_device *fc = fe->dvb->priv; |
297 | return request_firmware(fw, name, fc->dev); | 297 | return request_firmware(fw, name, fc->dev); |
298 | } | 298 | } |
299 | 299 | ||
300 | static struct nxt2002_config samsung_tbmv_config = { | 300 | static struct nxt2002_config samsung_tbmv_config = { |
301 | .demod_address = 0x0a, | 301 | .demod_address = 0x0a, |
302 | .request_firmware = nxt2002_request_firmware, | 302 | .request_firmware = flexcop_fe_request_firmware, |
303 | }; | ||
304 | |||
305 | static struct bcm3510_config air2pc_atsc_first_gen_config = { | ||
306 | .demod_address = 0x0f, | ||
307 | .request_firmware = flexcop_fe_request_firmware, | ||
303 | }; | 308 | }; |
304 | 309 | ||
305 | static int skystar23_samsung_tbdu18132_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 310 | static int skystar23_samsung_tbdu18132_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
@@ -354,11 +359,16 @@ int flexcop_frontend_init(struct flexcop_device *fc) | |||
354 | fc->dev_type = FC_AIR_DVB; | 359 | fc->dev_type = FC_AIR_DVB; |
355 | info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address); | 360 | info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address); |
356 | } else | 361 | } else |
357 | /* try the air atsc (nxt2002) */ | 362 | /* try the air atsc 2nd generation (nxt2002) */ |
358 | if ((fc->fe = nxt2002_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) { | 363 | if ((fc->fe = nxt2002_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) { |
359 | fc->dev_type = FC_AIR_ATSC; | 364 | fc->dev_type = FC_AIR_ATSC2; |
360 | info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address); | 365 | info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address); |
361 | } else | 366 | } else |
367 | /* try the air atsc 1nd generation (bcm3510)/panasonic ct10s */ | ||
368 | if ((fc->fe = bcm3510_attach(&air2pc_atsc_first_gen_config, &fc->i2c_adap)) != NULL) { | ||
369 | fc->dev_type = FC_AIR_ATSC1; | ||
370 | info("found the bcm3510 at i2c address: 0x%02x",air2pc_atsc_first_gen_config.demod_address); | ||
371 | } else | ||
362 | /* try the cable dvb (stv0297) */ | 372 | /* try the cable dvb (stv0297) */ |
363 | if ((fc->fe = stv0297_attach(&alps_tdee4_stv0297_config, &fc->i2c_adap, 0xf8)) != NULL) { | 373 | if ((fc->fe = stv0297_attach(&alps_tdee4_stv0297_config, &fc->i2c_adap, 0xf8)) != NULL) { |
364 | fc->dev_type = FC_CABLE; | 374 | fc->dev_type = FC_CABLE; |
diff --git a/drivers/media/dvb/b2c2/flexcop-hw-filter.c b/drivers/media/dvb/b2c2/flexcop-hw-filter.c index 2baf43d3ce8f..75cf237196eb 100644 --- a/drivers/media/dvb/b2c2/flexcop-hw-filter.c +++ b/drivers/media/dvb/b2c2/flexcop-hw-filter.c | |||
@@ -10,6 +10,8 @@ | |||
10 | static void flexcop_rcv_data_ctrl(struct flexcop_device *fc, int onoff) | 10 | static void flexcop_rcv_data_ctrl(struct flexcop_device *fc, int onoff) |
11 | { | 11 | { |
12 | flexcop_set_ibi_value(ctrl_208,Rcv_Data_sig,onoff); | 12 | flexcop_set_ibi_value(ctrl_208,Rcv_Data_sig,onoff); |
13 | |||
14 | deb_ts("rcv_data is now: '%s'\n",onoff ? "on" : "off"); | ||
13 | } | 15 | } |
14 | 16 | ||
15 | void flexcop_smc_ctrl(struct flexcop_device *fc, int onoff) | 17 | void flexcop_smc_ctrl(struct flexcop_device *fc, int onoff) |
@@ -151,7 +153,7 @@ int flexcop_pid_feed_control(struct flexcop_device *fc, struct dvb_demux_feed *d | |||
151 | { | 153 | { |
152 | int max_pid_filter = 6 + fc->has_32_hw_pid_filter*32; | 154 | int max_pid_filter = 6 + fc->has_32_hw_pid_filter*32; |
153 | 155 | ||
154 | fc->feedcount += onoff ? 1 : -1; | 156 | fc->feedcount += onoff ? 1 : -1; /* the number of PIDs/Feed currently requested */ |
155 | if (dvbdmxfeed->index >= max_pid_filter) | 157 | if (dvbdmxfeed->index >= max_pid_filter) |
156 | fc->extra_feedcount += onoff ? 1 : -1; | 158 | fc->extra_feedcount += onoff ? 1 : -1; |
157 | 159 | ||
@@ -178,8 +180,14 @@ int flexcop_pid_feed_control(struct flexcop_device *fc, struct dvb_demux_feed *d | |||
178 | /* if it was the first or last feed request change the stream-status */ | 180 | /* if it was the first or last feed request change the stream-status */ |
179 | if (fc->feedcount == onoff) { | 181 | if (fc->feedcount == onoff) { |
180 | flexcop_rcv_data_ctrl(fc,onoff); | 182 | flexcop_rcv_data_ctrl(fc,onoff); |
181 | if (fc->stream_control) | 183 | if (fc->stream_control) /* device specific stream control */ |
182 | fc->stream_control(fc,onoff); | 184 | fc->stream_control(fc,onoff); |
185 | |||
186 | /* feeding stopped -> reset the flexcop filter*/ | ||
187 | if (onoff == 0) { | ||
188 | flexcop_reset_block_300(fc); | ||
189 | flexcop_hw_filter_init(fc); | ||
190 | } | ||
183 | } | 191 | } |
184 | 192 | ||
185 | return 0; | 193 | return 0; |
diff --git a/drivers/media/dvb/b2c2/flexcop-misc.c b/drivers/media/dvb/b2c2/flexcop-misc.c index 19e06da46774..3a08d38b318a 100644 --- a/drivers/media/dvb/b2c2/flexcop-misc.c +++ b/drivers/media/dvb/b2c2/flexcop-misc.c | |||
@@ -45,11 +45,12 @@ const char *flexcop_revision_names[] = { | |||
45 | 45 | ||
46 | const char *flexcop_device_names[] = { | 46 | const char *flexcop_device_names[] = { |
47 | "Unkown device", | 47 | "Unkown device", |
48 | "AirStar 2 DVB-T", | 48 | "Air2PC/AirStar 2 DVB-T", |
49 | "AirStar 2 ATSC", | 49 | "Air2PC/AirStar 2 ATSC 1st generation", |
50 | "SkyStar 2 DVB-S", | 50 | "Air2PC/AirStar 2 ATSC 2nd generation", |
51 | "SkyStar 2 DVB-S (old version)", | 51 | "Sky2PC/SkyStar 2 DVB-S", |
52 | "CableStar 2 DVB-C", | 52 | "Sky2PC/SkyStar 2 DVB-S (old version)", |
53 | "Cable2PC/CableStar 2 DVB-C", | ||
53 | }; | 54 | }; |
54 | 55 | ||
55 | const char *flexcop_bus_names[] = { | 56 | const char *flexcop_bus_names[] = { |
@@ -64,3 +65,15 @@ void flexcop_device_name(struct flexcop_device *fc,const char *prefix,const | |||
64 | flexcop_device_names[fc->dev_type],flexcop_bus_names[fc->bus_type], | 65 | flexcop_device_names[fc->dev_type],flexcop_bus_names[fc->bus_type], |
65 | flexcop_revision_names[fc->rev],suffix); | 66 | flexcop_revision_names[fc->rev],suffix); |
66 | } | 67 | } |
68 | |||
69 | void flexcop_dump_reg(struct flexcop_device *fc, flexcop_ibi_register reg, int num) | ||
70 | { | ||
71 | flexcop_ibi_value v; | ||
72 | int i; | ||
73 | for (i = 0; i < num; i++) { | ||
74 | v = fc->read_ibi_reg(fc,reg+4*i); | ||
75 | deb_rdump("0x%03x: %08x, ",reg+4*i, v.raw); | ||
76 | } | ||
77 | deb_rdump("\n"); | ||
78 | } | ||
79 | EXPORT_SYMBOL(flexcop_dump_reg); | ||
diff --git a/drivers/media/dvb/b2c2/flexcop-pci.c b/drivers/media/dvb/b2c2/flexcop-pci.c index ed717c0073d5..2f76eb3fea40 100644 --- a/drivers/media/dvb/b2c2/flexcop-pci.c +++ b/drivers/media/dvb/b2c2/flexcop-pci.c | |||
@@ -13,6 +13,10 @@ static int enable_pid_filtering = 1; | |||
13 | module_param(enable_pid_filtering, int, 0444); | 13 | module_param(enable_pid_filtering, int, 0444); |
14 | MODULE_PARM_DESC(enable_pid_filtering, "enable hardware pid filtering: supported values: 0 (fullts), 1"); | 14 | MODULE_PARM_DESC(enable_pid_filtering, "enable hardware pid filtering: supported values: 0 (fullts), 1"); |
15 | 15 | ||
16 | static int irq_chk_intv; | ||
17 | module_param(irq_chk_intv, int, 0644); | ||
18 | MODULE_PARM_DESC(irq_chk_intv, "set the interval for IRQ watchdog (currently just debugging)."); | ||
19 | |||
16 | #ifdef CONFIG_DVB_B2C2_FLEXCOP_DEBUG | 20 | #ifdef CONFIG_DVB_B2C2_FLEXCOP_DEBUG |
17 | #define dprintk(level,args...) \ | 21 | #define dprintk(level,args...) \ |
18 | do { if ((debug & level)) printk(args); } while (0) | 22 | do { if ((debug & level)) printk(args); } while (0) |
@@ -26,6 +30,7 @@ MODULE_PARM_DESC(enable_pid_filtering, "enable hardware pid filtering: supported | |||
26 | #define deb_reg(args...) dprintk(0x02,args) | 30 | #define deb_reg(args...) dprintk(0x02,args) |
27 | #define deb_ts(args...) dprintk(0x04,args) | 31 | #define deb_ts(args...) dprintk(0x04,args) |
28 | #define deb_irq(args...) dprintk(0x08,args) | 32 | #define deb_irq(args...) dprintk(0x08,args) |
33 | #define deb_chk(args...) dprintk(0x10,args) | ||
29 | 34 | ||
30 | static int debug = 0; | 35 | static int debug = 0; |
31 | module_param(debug, int, 0644); | 36 | module_param(debug, int, 0644); |
@@ -56,6 +61,10 @@ struct flexcop_pci { | |||
56 | 61 | ||
57 | spinlock_t irq_lock; | 62 | spinlock_t irq_lock; |
58 | 63 | ||
64 | unsigned long last_irq; | ||
65 | |||
66 | struct work_struct irq_check_work; | ||
67 | |||
59 | struct flexcop_device *fc_dev; | 68 | struct flexcop_device *fc_dev; |
60 | }; | 69 | }; |
61 | 70 | ||
@@ -88,18 +97,55 @@ static int flexcop_pci_write_ibi_reg(struct flexcop_device *fc, flexcop_ibi_regi | |||
88 | return 0; | 97 | return 0; |
89 | } | 98 | } |
90 | 99 | ||
100 | static void flexcop_pci_irq_check_work(void *data) | ||
101 | { | ||
102 | struct flexcop_pci *fc_pci = data; | ||
103 | struct flexcop_device *fc = fc_pci->fc_dev; | ||
104 | |||
105 | flexcop_ibi_value v = fc->read_ibi_reg(fc,sram_dest_reg_714); | ||
106 | |||
107 | flexcop_dump_reg(fc_pci->fc_dev,dma1_000,4); | ||
108 | |||
109 | if (v.sram_dest_reg_714.net_ovflow_error) | ||
110 | deb_chk("sram net_ovflow_error\n"); | ||
111 | if (v.sram_dest_reg_714.media_ovflow_error) | ||
112 | deb_chk("sram media_ovflow_error\n"); | ||
113 | if (v.sram_dest_reg_714.cai_ovflow_error) | ||
114 | deb_chk("sram cai_ovflow_error\n"); | ||
115 | if (v.sram_dest_reg_714.cai_ovflow_error) | ||
116 | deb_chk("sram cai_ovflow_error\n"); | ||
117 | |||
118 | schedule_delayed_work(&fc_pci->irq_check_work, | ||
119 | msecs_to_jiffies(irq_chk_intv < 100 ? 100 : irq_chk_intv)); | ||
120 | } | ||
121 | |||
91 | /* When PID filtering is turned on, we use the timer IRQ, because small amounts | 122 | /* When PID filtering is turned on, we use the timer IRQ, because small amounts |
92 | * of data need to be passed to the user space instantly as well. When PID | 123 | * of data need to be passed to the user space instantly as well. When PID |
93 | * filtering is turned off, we use the page-change-IRQ */ | 124 | * filtering is turned off, we use the page-change-IRQ */ |
94 | static irqreturn_t flexcop_pci_irq(int irq, void *dev_id, struct pt_regs *regs) | 125 | static irqreturn_t flexcop_pci_isr(int irq, void *dev_id, struct pt_regs *regs) |
95 | { | 126 | { |
96 | struct flexcop_pci *fc_pci = dev_id; | 127 | struct flexcop_pci *fc_pci = dev_id; |
97 | struct flexcop_device *fc = fc_pci->fc_dev; | 128 | struct flexcop_device *fc = fc_pci->fc_dev; |
98 | flexcop_ibi_value v = fc->read_ibi_reg(fc,irq_20c); | 129 | flexcop_ibi_value v; |
99 | irqreturn_t ret = IRQ_HANDLED; | 130 | irqreturn_t ret = IRQ_HANDLED; |
100 | 131 | ||
101 | spin_lock_irq(&fc_pci->irq_lock); | 132 | spin_lock_irq(&fc_pci->irq_lock); |
102 | 133 | ||
134 | v = fc->read_ibi_reg(fc,irq_20c); | ||
135 | |||
136 | /* errors */ | ||
137 | if (v.irq_20c.Data_receiver_error) | ||
138 | deb_chk("data receiver error\n"); | ||
139 | if (v.irq_20c.Continuity_error_flag) | ||
140 | deb_chk("Contunuity error flag is set\n"); | ||
141 | if (v.irq_20c.LLC_SNAP_FLAG_set) | ||
142 | deb_chk("LLC_SNAP_FLAG_set is set\n"); | ||
143 | if (v.irq_20c.Transport_Error) | ||
144 | deb_chk("Transport error\n"); | ||
145 | |||
146 | if ((fc_pci->count % 1000) == 0) | ||
147 | deb_chk("%d valid irq took place so far\n",fc_pci->count); | ||
148 | |||
103 | if (v.irq_20c.DMA1_IRQ_Status == 1) { | 149 | if (v.irq_20c.DMA1_IRQ_Status == 1) { |
104 | if (fc_pci->active_dma1_addr == 0) | 150 | if (fc_pci->active_dma1_addr == 0) |
105 | flexcop_pass_dmx_packets(fc_pci->fc_dev,fc_pci->dma[0].cpu_addr0,fc_pci->dma[0].size / 188); | 151 | flexcop_pass_dmx_packets(fc_pci->fc_dev,fc_pci->dma[0].cpu_addr0,fc_pci->dma[0].size / 188); |
@@ -115,8 +161,9 @@ static irqreturn_t flexcop_pci_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
115 | fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2; | 161 | fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2; |
116 | u32 cur_pos = cur_addr - fc_pci->dma[0].dma_addr0; | 162 | u32 cur_pos = cur_addr - fc_pci->dma[0].dma_addr0; |
117 | 163 | ||
118 | deb_irq("irq: %08x cur_addr: %08x: cur_pos: %08x, last_cur_pos: %08x ", | 164 | deb_irq("%u irq: %08x cur_addr: %08x: cur_pos: %08x, last_cur_pos: %08x ", |
119 | v.raw,cur_addr,cur_pos,fc_pci->last_dma1_cur_pos); | 165 | jiffies_to_usecs(jiffies - fc_pci->last_irq),v.raw,cur_addr,cur_pos,fc_pci->last_dma1_cur_pos); |
166 | fc_pci->last_irq = jiffies; | ||
120 | 167 | ||
121 | /* buffer end was reached, restarted from the beginning | 168 | /* buffer end was reached, restarted from the beginning |
122 | * pass the data from last_cur_pos to the buffer end to the demux | 169 | * pass the data from last_cur_pos to the buffer end to the demux |
@@ -127,7 +174,6 @@ static irqreturn_t flexcop_pci_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
127 | fc_pci->dma[0].cpu_addr0 + fc_pci->last_dma1_cur_pos, | 174 | fc_pci->dma[0].cpu_addr0 + fc_pci->last_dma1_cur_pos, |
128 | (fc_pci->dma[0].size*2) - fc_pci->last_dma1_cur_pos); | 175 | (fc_pci->dma[0].size*2) - fc_pci->last_dma1_cur_pos); |
129 | fc_pci->last_dma1_cur_pos = 0; | 176 | fc_pci->last_dma1_cur_pos = 0; |
130 | fc_pci->count = 0; | ||
131 | } | 177 | } |
132 | 178 | ||
133 | if (cur_pos > fc_pci->last_dma1_cur_pos) { | 179 | if (cur_pos > fc_pci->last_dma1_cur_pos) { |
@@ -139,16 +185,14 @@ static irqreturn_t flexcop_pci_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
139 | deb_irq("\n"); | 185 | deb_irq("\n"); |
140 | 186 | ||
141 | fc_pci->last_dma1_cur_pos = cur_pos; | 187 | fc_pci->last_dma1_cur_pos = cur_pos; |
142 | } else | 188 | fc_pci->count++; |
189 | } else { | ||
190 | deb_irq("isr for flexcop called, apparently without reason (%08x)\n",v.raw); | ||
143 | ret = IRQ_NONE; | 191 | ret = IRQ_NONE; |
192 | } | ||
144 | 193 | ||
145 | spin_unlock_irq(&fc_pci->irq_lock); | 194 | spin_unlock_irq(&fc_pci->irq_lock); |
146 | 195 | ||
147 | /* packet count would be ideal for hw filtering, but it isn't working. Either | ||
148 | * the data book is wrong, or I'm unable to read it correctly */ | ||
149 | |||
150 | /* if (v.irq_20c.DMA1_Size_IRQ_Status == 1) { packet counter */ | ||
151 | |||
152 | return ret; | 196 | return ret; |
153 | } | 197 | } |
154 | 198 | ||
@@ -156,30 +200,35 @@ static int flexcop_pci_stream_control(struct flexcop_device *fc, int onoff) | |||
156 | { | 200 | { |
157 | struct flexcop_pci *fc_pci = fc->bus_specific; | 201 | struct flexcop_pci *fc_pci = fc->bus_specific; |
158 | if (onoff) { | 202 | if (onoff) { |
159 | flexcop_dma_config(fc,&fc_pci->dma[0],FC_DMA_1,FC_DMA_SUBADDR_0 | FC_DMA_SUBADDR_1); | 203 | flexcop_dma_config(fc,&fc_pci->dma[0],FC_DMA_1); |
160 | flexcop_dma_config(fc,&fc_pci->dma[1],FC_DMA_2,FC_DMA_SUBADDR_0 | FC_DMA_SUBADDR_1); | 204 | flexcop_dma_config(fc,&fc_pci->dma[1],FC_DMA_2); |
161 | flexcop_dma_config_timer(fc,FC_DMA_1,1); | ||
162 | 205 | ||
163 | if (fc_pci->fc_dev->pid_filtering) { | 206 | flexcop_dma_config_timer(fc,FC_DMA_1,0); |
164 | fc_pci->last_dma1_cur_pos = 0; | ||
165 | flexcop_dma_control_timer_irq(fc,FC_DMA_1,1); | ||
166 | } else { | ||
167 | fc_pci->active_dma1_addr = 0; | ||
168 | flexcop_dma_control_size_irq(fc,FC_DMA_1,1); | ||
169 | } | ||
170 | 207 | ||
171 | /* flexcop_dma_config_packet_count(fc,FC_DMA_1,0xc0); | 208 | flexcop_dma_xfer_control(fc,FC_DMA_1,FC_DMA_SUBADDR_0 | FC_DMA_SUBADDR_1,1); |
172 | flexcop_dma_control_packet_irq(fc,FC_DMA_1,1); */ | 209 | deb_irq("DMA xfer enabled\n"); |
173 | 210 | ||
174 | deb_irq("irqs enabled\n"); | 211 | fc_pci->last_dma1_cur_pos = 0; |
212 | flexcop_dma_control_timer_irq(fc,FC_DMA_1,1); | ||
213 | deb_irq("IRQ enabled\n"); | ||
214 | |||
215 | // fc_pci->active_dma1_addr = 0; | ||
216 | // flexcop_dma_control_size_irq(fc,FC_DMA_1,1); | ||
217 | |||
218 | if (irq_chk_intv > 0) | ||
219 | schedule_delayed_work(&fc_pci->irq_check_work, | ||
220 | msecs_to_jiffies(irq_chk_intv < 100 ? 100 : irq_chk_intv)); | ||
175 | } else { | 221 | } else { |
176 | if (fc_pci->fc_dev->pid_filtering) | 222 | if (irq_chk_intv > 0) |
177 | flexcop_dma_control_timer_irq(fc,FC_DMA_1,0); | 223 | cancel_delayed_work(&fc_pci->irq_check_work); |
178 | else | 224 | |
179 | flexcop_dma_control_size_irq(fc,FC_DMA_1,0); | 225 | flexcop_dma_control_timer_irq(fc,FC_DMA_1,0); |
226 | deb_irq("IRQ disabled\n"); | ||
180 | 227 | ||
181 | // flexcop_dma_control_packet_irq(fc,FC_DMA_1,0); | 228 | // flexcop_dma_control_size_irq(fc,FC_DMA_1,0); |
182 | deb_irq("irqs disabled\n"); | 229 | |
230 | flexcop_dma_xfer_control(fc,FC_DMA_1,FC_DMA_SUBADDR_0 | FC_DMA_SUBADDR_1,0); | ||
231 | deb_irq("DMA xfer disabled\n"); | ||
183 | } | 232 | } |
184 | 233 | ||
185 | return 0; | 234 | return 0; |
@@ -198,6 +247,7 @@ static int flexcop_pci_dma_init(struct flexcop_pci *fc_pci) | |||
198 | flexcop_sram_set_dest(fc_pci->fc_dev,FC_SRAM_DEST_CAO | FC_SRAM_DEST_CAI, FC_SRAM_DEST_TARGET_DMA2); | 247 | flexcop_sram_set_dest(fc_pci->fc_dev,FC_SRAM_DEST_CAO | FC_SRAM_DEST_CAI, FC_SRAM_DEST_TARGET_DMA2); |
199 | 248 | ||
200 | fc_pci->init_state |= FC_PCI_DMA_INIT; | 249 | fc_pci->init_state |= FC_PCI_DMA_INIT; |
250 | |||
201 | goto success; | 251 | goto success; |
202 | dma1_free: | 252 | dma1_free: |
203 | flexcop_dma_free(&fc_pci->dma[0]); | 253 | flexcop_dma_free(&fc_pci->dma[0]); |
@@ -244,7 +294,7 @@ static int flexcop_pci_init(struct flexcop_pci *fc_pci) | |||
244 | 294 | ||
245 | pci_set_drvdata(fc_pci->pdev, fc_pci); | 295 | pci_set_drvdata(fc_pci->pdev, fc_pci); |
246 | 296 | ||
247 | if ((ret = request_irq(fc_pci->pdev->irq, flexcop_pci_irq, | 297 | if ((ret = request_irq(fc_pci->pdev->irq, flexcop_pci_isr, |
248 | SA_SHIRQ, DRIVER_NAME, fc_pci)) != 0) | 298 | SA_SHIRQ, DRIVER_NAME, fc_pci)) != 0) |
249 | goto err_pci_iounmap; | 299 | goto err_pci_iounmap; |
250 | 300 | ||
@@ -324,6 +374,8 @@ static int flexcop_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
324 | if ((ret = flexcop_pci_dma_init(fc_pci)) != 0) | 374 | if ((ret = flexcop_pci_dma_init(fc_pci)) != 0) |
325 | goto err_fc_exit; | 375 | goto err_fc_exit; |
326 | 376 | ||
377 | INIT_WORK(&fc_pci->irq_check_work, flexcop_pci_irq_check_work, fc_pci); | ||
378 | |||
327 | goto success; | 379 | goto success; |
328 | err_fc_exit: | 380 | err_fc_exit: |
329 | flexcop_device_exit(fc); | 381 | flexcop_device_exit(fc); |
@@ -350,17 +402,17 @@ static void flexcop_pci_remove(struct pci_dev *pdev) | |||
350 | 402 | ||
351 | static struct pci_device_id flexcop_pci_tbl[] = { | 403 | static struct pci_device_id flexcop_pci_tbl[] = { |
352 | { PCI_DEVICE(0x13d0, 0x2103) }, | 404 | { PCI_DEVICE(0x13d0, 0x2103) }, |
353 | /* { PCI_DEVICE(0x13d0, 0x2200) }, PCI FlexCopIII ? */ | 405 | /* { PCI_DEVICE(0x13d0, 0x2200) }, ? */ |
354 | { }, | 406 | { }, |
355 | }; | 407 | }; |
356 | 408 | ||
357 | MODULE_DEVICE_TABLE(pci, flexcop_pci_tbl); | 409 | MODULE_DEVICE_TABLE(pci, flexcop_pci_tbl); |
358 | 410 | ||
359 | static struct pci_driver flexcop_pci_driver = { | 411 | static struct pci_driver flexcop_pci_driver = { |
360 | .name = "Technisat/B2C2 FlexCop II/IIb/III PCI", | 412 | .name = "b2c2_flexcop_pci", |
361 | .id_table = flexcop_pci_tbl, | 413 | .id_table = flexcop_pci_tbl, |
362 | .probe = flexcop_pci_probe, | 414 | .probe = flexcop_pci_probe, |
363 | .remove = flexcop_pci_remove, | 415 | .remove = flexcop_pci_remove, |
364 | }; | 416 | }; |
365 | 417 | ||
366 | static int __init flexcop_pci_module_init(void) | 418 | static int __init flexcop_pci_module_init(void) |
diff --git a/drivers/media/dvb/b2c2/flexcop-reg.h b/drivers/media/dvb/b2c2/flexcop-reg.h index 5e131be55cb3..4ae1eb5bfe98 100644 --- a/drivers/media/dvb/b2c2/flexcop-reg.h +++ b/drivers/media/dvb/b2c2/flexcop-reg.h | |||
@@ -21,7 +21,8 @@ extern const char *flexcop_revision_names[]; | |||
21 | typedef enum { | 21 | typedef enum { |
22 | FC_UNK = 0, | 22 | FC_UNK = 0, |
23 | FC_AIR_DVB, | 23 | FC_AIR_DVB, |
24 | FC_AIR_ATSC, | 24 | FC_AIR_ATSC1, |
25 | FC_AIR_ATSC2, | ||
25 | FC_SKY, | 26 | FC_SKY, |
26 | FC_SKY_OLD, | 27 | FC_SKY_OLD, |
27 | FC_CABLE, | 28 | FC_CABLE, |
@@ -35,555 +36,21 @@ typedef enum { | |||
35 | extern const char *flexcop_device_names[]; | 36 | extern const char *flexcop_device_names[]; |
36 | 37 | ||
37 | /* FlexCop IBI Registers */ | 38 | /* FlexCop IBI Registers */ |
39 | #if defined(__LITTLE_ENDIAN) | ||
40 | #include "flexcop_ibi_value_le.h" | ||
41 | #elif defined(__BIG_ENDIAN) | ||
42 | #include "flexcop_ibi_value_be.h" | ||
43 | #else | ||
44 | #error no endian defined | ||
45 | #endif | ||
38 | 46 | ||
39 | /* flexcop_ibi_reg - a huge union representing the register structure */ | ||
40 | typedef union { | ||
41 | u32 raw; | ||
42 | |||
43 | /* DMA 0x000 to 0x01c | ||
44 | * DMA1 0x000 to 0x00c | ||
45 | * DMA2 0x010 to 0x01c | ||
46 | */ | ||
47 | struct { | ||
48 | u32 dma_0start : 1; /* set: data will be delivered to dma1_address0 */ | ||
49 | u32 dma_0No_update : 1; /* set: dma1_cur_address will be updated, unset: no update */ | ||
50 | u32 dma_address0 :30; /* physical/virtual host memory address0 DMA */ | ||
51 | } dma_0x0; | ||
52 | |||
53 | struct { | ||
54 | u32 DMA_maxpackets : 8; /* (remapped) PCI DMA1 Packet Count Interrupt. This variable | ||
55 | is able to be read and written while bit(1) of register | ||
56 | 0x00c (remap_enable) is set. This variable represents | ||
57 | the number of packets that will be transmitted to the PCI | ||
58 | host using PCI DMA1 before an interrupt to the PCI is | ||
59 | asserted. This functionality may be enabled using bit(20) | ||
60 | of register 0x208. N=0 disables the IRQ. */ | ||
61 | u32 dma_addr_size :24; /* size of memory buffer in DWORDs (bytesize / 4) for DMA */ | ||
62 | } dma_0x4_remap; | ||
63 | |||
64 | struct { | ||
65 | u32 dma1timer : 7; /* reading PCI DMA1 timer ... when remap_enable is 0 */ | ||
66 | u32 unused : 1; | ||
67 | u32 dma_addr_size :24; | ||
68 | } dma_0x4_read; | ||
69 | |||
70 | struct { | ||
71 | u32 unused : 1; | ||
72 | u32 dmatimer : 7; /* writing PCI DMA1 timer ... when remap_enable is 0 */ | ||
73 | u32 dma_addr_size :24; | ||
74 | } dma_0x4_write; | ||
75 | |||
76 | struct { | ||
77 | u32 unused : 2; | ||
78 | u32 dma_cur_addr :30; /* current physical host memory address pointer for DMA */ | ||
79 | } dma_0x8; | ||
80 | |||
81 | struct { | ||
82 | u32 dma_1start : 1; /* set: data will be delivered to dma_address1, when dma_address0 is full */ | ||
83 | u32 remap_enable : 1; /* remap enable for 0x0x4(7:0) */ | ||
84 | u32 dma_address1 :30; /* Physical/virtual address 1 on DMA */ | ||
85 | } dma_0xc; | ||
86 | |||
87 | /* Two-wire Serial Master and Clock 0x100-0x110 */ | ||
88 | struct { | ||
89 | // u32 slave_transmitter : 1; /* ???*/ | ||
90 | u32 chipaddr : 7; /* two-line serial address of the target slave */ | ||
91 | u32 reserved1 : 1; | ||
92 | u32 baseaddr : 8; /* address of the location of the read/write operation */ | ||
93 | u32 data1_reg : 8; /* first byte in two-line serial read/write operation */ | ||
94 | u32 working_start : 1; /* when doing a write operation this indicator is 0 when ready | ||
95 | * set to 1 when doing a write operation */ | ||
96 | u32 twoWS_rw : 1; /* read/write indicator (1 = read, 0 write) */ | ||
97 | u32 total_bytes : 2; /* number of data bytes in each two-line serial transaction (0 = 1 byte, 11 = 4byte)*/ | ||
98 | u32 twoWS_port_reg : 2; /* port selection: 01 - Front End/Demod, 10 - EEPROM, 11 - Tuner */ | ||
99 | u32 no_base_addr_ack_error : 1; /* writing: write-req: frame is produced w/o baseaddr, read-req: read-cycles w/o | ||
100 | * preceding address assignment write frame | ||
101 | * ACK_ERROR = 1 when no ACK from slave in the last transaction */ | ||
102 | u32 st_done : 1; /* indicator for transaction is done */ | ||
103 | } tw_sm_c_100; | ||
104 | |||
105 | struct { | ||
106 | u32 data2_reg : 8; /* 2nd data byte */ | ||
107 | u32 data3_reg : 8; /* 3rd data byte */ | ||
108 | u32 data4_reg : 8; /* 4th data byte */ | ||
109 | u32 exlicit_stops : 1; /* when set, transactions are produced w/o trailing STOP flag, then send isolated STOP flags */ | ||
110 | u32 force_stop : 1; /* isolated stop flag */ | ||
111 | u32 unused : 6; | ||
112 | } tw_sm_c_104; | ||
113 | |||
114 | /* Clock. The register allows the FCIII to convert an incoming Master clock | ||
115 | * (MCLK) signal into a lower frequency clock through the use of a LowCounter | ||
116 | * (TLO) and a High- Counter (THI). The time counts for THI and TLO are | ||
117 | * measured in MCLK; each count represents 4 MCLK input clock cycles. | ||
118 | * | ||
119 | * The default output for port #1 is set for Front End Demod communication. (0x108) | ||
120 | * The default output for port #2 is set for EEPROM communication. (0x10c) | ||
121 | * The default output for port #3 is set for Tuner communication. (0x110) | ||
122 | */ | ||
123 | struct { | ||
124 | u32 thi1 : 6; /* Thi for port #1 (def: 100110b; 38) */ | ||
125 | u32 reserved1 : 2; | ||
126 | u32 tlo1 : 5; /* Tlo for port #1 (def: 11100b; 28) */ | ||
127 | u32 reserved2 :19; | ||
128 | } tw_sm_c_108; | ||
129 | |||
130 | struct { | ||
131 | u32 thi1 : 6; /* Thi for port #2 (def: 111001b; 57) */ | ||
132 | u32 reserved1 : 2; | ||
133 | u32 tlo1 : 5; /* Tlo for port #2 (def: 11100b; 28) */ | ||
134 | u32 reserved2 :19; | ||
135 | } tw_sm_c_10c; | ||
136 | |||
137 | struct { | ||
138 | u32 thi1 : 6; /* Thi for port #3 (def: 111001b; 57) */ | ||
139 | u32 reserved1 : 2; | ||
140 | u32 tlo1 : 5; /* Tlo for port #3 (def: 11100b; 28) */ | ||
141 | u32 reserved2 :19; | ||
142 | } tw_sm_c_110; | ||
143 | |||
144 | /* LNB Switch Frequency 0x200 | ||
145 | * Clock that creates the LNB switch tone. The default is set to have a fixed | ||
146 | * low output (not oscillating) to the LNB_CTL line. | ||
147 | */ | ||
148 | struct { | ||
149 | u32 LNB_CTLHighCount_sig :15; /* It is the number of pre-scaled clock cycles that will be low. */ | ||
150 | u32 LNB_CTLLowCount_sig :15; /* For example, to obtain a 22KHz output given a 45 Mhz Master | ||
151 | Clock signal (MCLK), set PreScalar=01 and LowCounter value to 0x1ff. */ | ||
152 | u32 LNB_CTLPrescaler_sig : 2; /* pre-scaler divides MCLK: 00 (no division), 01 by 2, 10 by 4, 11 by 12 */ | ||
153 | } lnb_switch_freq_200; | ||
154 | |||
155 | /* ACPI, Peripheral Reset, LNB Polarity | ||
156 | * ACPI power conservation mode, LNB polarity selection (low or high voltage), | ||
157 | * and peripheral reset. | ||
158 | */ | ||
159 | struct { | ||
160 | u32 ACPI1_sig : 1; /* turn of the power of tuner and LNB, not implemented in FCIII */ | ||
161 | u32 ACPI3_sig : 1; /* turn of power of the complete satelite receiver board (except FCIII) */ | ||
162 | u32 LNB_L_H_sig : 1; /* low or high voltage for LNB. (0 = low, 1 = high) */ | ||
163 | u32 Per_reset_sig : 1; /* misc. init reset (default: 1), to reset set to low and back to high */ | ||
164 | u32 reserved :20; | ||
165 | u32 Rev_N_sig_revision_hi : 4;/* 0xc in case of FCIII */ | ||
166 | u32 Rev_N_sig_reserved1 : 2; | ||
167 | u32 Rev_N_sig_caps : 1; /* if 1, FCIII has 32 PID- and MAC-filters and is capable of IP multicast */ | ||
168 | u32 Rev_N_sig_reserved2 : 1; | ||
169 | } misc_204; | ||
170 | |||
171 | /* Control and Status 0x208 to 0x21c */ | ||
172 | /* Gross enable and disable control */ | ||
173 | struct { | ||
174 | u32 Stream1_filter_sig : 1; /* Stream1 PID filtering */ | ||
175 | u32 Stream2_filter_sig : 1; /* Stream2 PID filtering */ | ||
176 | u32 PCR_filter_sig : 1; /* PCR PID filter */ | ||
177 | u32 PMT_filter_sig : 1; /* PMT PID filter */ | ||
178 | |||
179 | u32 EMM_filter_sig : 1; /* EMM PID filter */ | ||
180 | u32 ECM_filter_sig : 1; /* ECM PID filter */ | ||
181 | u32 Null_filter_sig : 1; /* Filters null packets, PID=0x1fff. */ | ||
182 | u32 Mask_filter_sig : 1; /* mask PID filter */ | ||
183 | |||
184 | u32 WAN_Enable_sig : 1; /* WAN output line through V8 memory space is activated. */ | ||
185 | u32 WAN_CA_Enable_sig : 1; /* not in FCIII */ | ||
186 | u32 CA_Enable_sig : 1; /* not in FCIII */ | ||
187 | u32 SMC_Enable_sig : 1; /* CI stream data (CAI) goes directly to the smart card intf (opposed IBI 0x600 or SC-cmd buf). */ | ||
188 | |||
189 | u32 Per_CA_Enable_sig : 1; /* not in FCIII */ | ||
190 | u32 Multi2_Enable_sig : 1; /* ? */ | ||
191 | u32 MAC_filter_Mode_sig : 1; /* (MAC_filter_enable) Globally enables MAC filters for Net PID filteres. */ | ||
192 | u32 Rcv_Data_sig : 1; /* PID filtering module enable. When this bit is a one, the PID filter will | ||
193 | examine and process packets according to all other (individual) PID | ||
194 | filtering controls. If it a zero, no packet processing of any kind will | ||
195 | take place. All data from the tuner will be thrown away. */ | ||
196 | |||
197 | u32 DMA1_IRQ_Enable_sig : 1; /* When set, a DWORD counter is enabled on PCI DMA1 that asserts the PCI | ||
198 | * interrupt after the specified count for filling the buffer. */ | ||
199 | u32 DMA1_Timer_Enable_sig : 1; /* When set, a timer is enabled on PCI DMA1 that asserts the PCI interrupt | ||
200 | after a specified amount of time. */ | ||
201 | u32 DMA2_IRQ_Enable_sig : 1; /* same as DMA1_IRQ_Enable_sig but for DMA2 */ | ||
202 | u32 DMA2_Timer_Enable_sig : 1; /* same as DMA1_Timer_Enable_sig but for DMA2 */ | ||
203 | |||
204 | u32 DMA1_Size_IRQ_Enable_sig : 1; /* When set, a packet count detector is enabled on PCI DMA1 that asserts the PCI interrupt. */ | ||
205 | u32 DMA2_Size_IRQ_Enable_sig : 1; /* When set, a packet count detector is enabled on PCI DMA2 that asserts the PCI interrupt. */ | ||
206 | u32 Mailbox_from_V8_Enable_sig: 1; /* When set, writes to the mailbox register produce an interrupt to the | ||
207 | PCI host to indicate that mailbox data is available. */ | ||
208 | |||
209 | u32 unused : 9; | ||
210 | } ctrl_208; | ||
211 | |||
212 | /* General status. When a PCI interrupt occurs, this register is read to | ||
213 | * discover the reason for the interrupt. | ||
214 | */ | ||
215 | struct { | ||
216 | u32 DMA1_IRQ_Status : 1; /* When set(1) the DMA1 counter had generated an IRQ. Read Only. */ | ||
217 | u32 DMA1_Timer_Status : 1; /* When set(1) the DMA1 timer had generated an IRQ. Read Only. */ | ||
218 | u32 DMA2_IRQ_Status : 1; /* When set(1) the DMA2 counter had generated an IRQ. Read Only. */ | ||
219 | u32 DMA2_Timer_Status : 1; /* When set(1) the DMA2 timer had generated an IRQ. Read Only. */ | ||
220 | u32 DMA1_Size_IRQ_Status : 1; /* (Read only). This register is read after an interrupt to */ | ||
221 | u32 DMA2_Size_IRQ_Status : 1; /* find out why we had an IRQ. Reading this register will clear this bit. Packet count*/ | ||
222 | u32 Mailbox_from_V8_Status_sig: 1; /* Same as above. Reading this register will clear this bit. */ | ||
223 | u32 Data_receiver_error : 1; /* 1 indicate an error in the receiver Front End (Tuner module) */ | ||
224 | u32 Continuity_error_flag : 1; /* 1 indicates a continuity error in the TS stream. */ | ||
225 | u32 LLC_SNAP_FLAG_set : 1; /* 1 indicates that the LCC_SNAP_FLAG was set. */ | ||
226 | u32 Transport_Error : 1; /* When set indicates that an unexpected packet was received. */ | ||
227 | u32 reserved :21; | ||
228 | } irq_20c; | ||
229 | |||
230 | |||
231 | /* Software reset register */ | ||
232 | struct { | ||
233 | u32 reset_blocks : 8; /* Enabled when Block_reset_enable = 0xB2 and 0x208 bits 15:8 = 0x00. | ||
234 | Each bit location represents a 0x100 block of registers. Writing | ||
235 | a one in a bit location resets that block of registers and the logic | ||
236 | that it controls. */ | ||
237 | u32 Block_reset_enable : 8; /* This variable is set to 0xB2 when the register is written. */ | ||
238 | u32 Special_controls :16; /* Asserts Reset_V8 => 0xC258; Turns on pci encryption => 0xC25A; | ||
239 | Turns off pci encryption => 0xC259 Note: pci_encryption default | ||
240 | at power-up is ON. */ | ||
241 | } sw_reset_210; | ||
242 | |||
243 | struct { | ||
244 | u32 vuart_oe_sig : 1; /* When clear, the V8 processor has sole control of the serial UART | ||
245 | (RS-232 Smart Card interface). When set, the IBI interface | ||
246 | defined by register 0x600 controls the serial UART. */ | ||
247 | u32 v2WS_oe_sig : 1; /* When clear, the V8 processor has direct control of the Two-line | ||
248 | Serial Master EEPROM target. When set, the Two-line Serial Master | ||
249 | EEPROM target interface is controlled by IBI register 0x100. */ | ||
250 | u32 halt_V8_sig : 1; /* When set, contiguous wait states are applied to the V8-space | ||
251 | bus masters. Once this signal is cleared, normal V8-space | ||
252 | operations resume. */ | ||
253 | u32 section_pkg_enable_sig: 1; /* When set, this signal enables the front end translation circuitry | ||
254 | to process section packed transport streams. */ | ||
255 | u32 s2p_sel_sig : 1; /* Serial to parallel conversion. When set, polarized transport data | ||
256 | within the FlexCop3 front end circuitry is converted from a serial | ||
257 | stream into parallel data before downstream processing otherwise | ||
258 | interprets the data. */ | ||
259 | u32 unused1 : 3; | ||
260 | u32 polarity_PS_CLK_sig: 1; /* This signal is used to invert the input polarity of the tranport | ||
261 | stream CLOCK signal before any processing occurs on the transport | ||
262 | stream within FlexCop3. */ | ||
263 | u32 polarity_PS_VALID_sig: 1; /* This signal is used to invert the input polarity of the tranport | ||
264 | stream VALID signal before any processing occurs on the transport | ||
265 | stream within FlexCop3. */ | ||
266 | u32 polarity_PS_SYNC_sig: 1; /* This signal is used to invert the input polarity of the tranport | ||
267 | stream SYNC signal before any processing occurs on the transport | ||
268 | stream within FlexCop3. */ | ||
269 | u32 polarity_PS_ERR_sig: 1; /* This signal is used to invert the input polarity of the tranport | ||
270 | stream ERROR signal before any processing occurs on the transport | ||
271 | stream within FlexCop3. */ | ||
272 | u32 unused2 :20; | ||
273 | } misc_214; | ||
274 | |||
275 | /* Mailbox from V8 to host */ | ||
276 | struct { | ||
277 | u32 Mailbox_from_V8 :32; /* When this register is written by either the V8 processor or by an | ||
278 | end host, an interrupt is generated to the PCI host to indicate | ||
279 | that mailbox data is available. Reading register 20c will clear | ||
280 | the IRQ. */ | ||
281 | } mbox_v8_to_host_218; | ||
282 | |||
283 | /* Mailbox from host to v8 Mailbox_to_V8 | ||
284 | * Mailbox_to_V8 mailbox storage register | ||
285 | * used to send messages from PCI to V8. Writing to this register will send an | ||
286 | * IRQ to the V8. Then it can read the data from here. Reading this register | ||
287 | * will clear the IRQ. If the V8 is halted and bit 31 of this register is set, | ||
288 | * then this register is used instead as a direct interface to access the | ||
289 | * V8space memory. | ||
290 | */ | ||
291 | struct { | ||
292 | u32 sysramaccess_data : 8; /* Data byte written or read from the specified address in V8 SysRAM. */ | ||
293 | u32 sysramaccess_addr :15; /* 15 bit address used to access V8 Sys-RAM. */ | ||
294 | u32 unused : 7; | ||
295 | u32 sysramaccess_write: 1; /* Write flag used to latch data into the V8 SysRAM. */ | ||
296 | u32 sysramaccess_busmuster: 1; /* Setting this bit when the V8 is halted at 0x214 Bit(2) allows | ||
297 | this IBI register interface to directly drive the V8-space memory. */ | ||
298 | } mbox_host_to_v8_21c; | ||
299 | |||
300 | |||
301 | /* PIDs, Translation Bit, SMC Filter Select 0x300 to 0x31c */ | ||
302 | struct { | ||
303 | u32 Stream1_PID :13; /* Primary use is receiving Net data, so these 13 bits normally | ||
304 | hold the PID value for the desired network stream. */ | ||
305 | u32 Stream1_trans : 1; /* When set, Net translation will take place for Net data ferried in TS packets. */ | ||
306 | u32 MAC_Multicast_filter : 1; /* When clear, multicast MAC filtering is not allowed for Stream1 and PID_n filters. */ | ||
307 | u32 debug_flag_pid_saved : 1; | ||
308 | u32 Stream2_PID :13; /* 13 bits for Stream 2 PID filter value. General use. */ | ||
309 | u32 Stream2_trans : 1; /* When set Tables/CAI translation will take place for the data ferried in | ||
310 | Stream2_PID TS packets. */ | ||
311 | u32 debug_flag_write_status00 : 1; | ||
312 | u32 debug_fifo_problem : 1; | ||
313 | } pid_filter_300; | ||
314 | |||
315 | struct { | ||
316 | u32 PCR_PID :13; /* PCR stream PID filter value. Primary use is Program Clock Reference stream filtering. */ | ||
317 | u32 PCR_trans : 1; /* When set, Tables/CAI translation will take place for these packets. */ | ||
318 | u32 debug_overrun3 : 1; | ||
319 | u32 debug_overrun2 : 1; | ||
320 | u32 PMT_PID :13; /* stream PID filter value. Primary use is Program Management Table segment filtering. */ | ||
321 | u32 PMT_trans : 1; /* When set, Tables/CAI translation will take place for these packets. */ | ||
322 | u32 reserved : 2; | ||
323 | } pid_filter_304; | ||
324 | |||
325 | struct { | ||
326 | u32 EMM_PID :13; /* EMM PID filter value. Primary use is Entitlement Management Messaging for | ||
327 | conditional access-related data. */ | ||
328 | u32 EMM_trans : 1; /* When set, Tables/CAI translation will take place for these packets. */ | ||
329 | u32 EMM_filter_4 : 1; /* When set will pass only EMM data possessing the same ID code as the | ||
330 | first four bytes (32 bits) of the end-user s 6-byte Smart Card ID number Select */ | ||
331 | u32 EMM_filter_6 : 1; /* When set will pass only EMM data possessing the same 6-byte code as the end-users | ||
332 | complete 6-byte Smart Card ID number. */ | ||
333 | u32 ECM_PID :13; /* ECM PID filter value. Primary use is Entitlement Control Messaging for conditional | ||
334 | access-related data. */ | ||
335 | u32 ECM_trans : 1; /* When set, Tables/CAI translation will take place for these packets. */ | ||
336 | u32 reserved : 2; | ||
337 | } pid_filter_308; | ||
338 | |||
339 | struct { | ||
340 | u32 Group_PID :13; /* PID value for group filtering. */ | ||
341 | u32 Group_trans : 1; /* When set, Tables/CAI translation will take place for these packets. */ | ||
342 | u32 unused1 : 2; | ||
343 | u32 Group_mask :13; /* Mask value used in logical "and" equation that defines group filtering */ | ||
344 | u32 unused2 : 3; | ||
345 | } pid_filter_30c_ext_ind_0_7; | ||
346 | |||
347 | struct { | ||
348 | u32 net_master_read :17; | ||
349 | u32 unused :15; | ||
350 | } pid_filter_30c_ext_ind_1; | ||
351 | |||
352 | struct { | ||
353 | u32 net_master_write :17; | ||
354 | u32 unused :15; | ||
355 | } pid_filter_30c_ext_ind_2; | ||
356 | |||
357 | struct { | ||
358 | u32 next_net_master_write :17; | ||
359 | u32 unused :15; | ||
360 | } pid_filter_30c_ext_ind_3; | ||
361 | |||
362 | struct { | ||
363 | u32 unused1 : 1; | ||
364 | u32 state_write :10; | ||
365 | u32 reserved1 : 6; /* default: 000100 */ | ||
366 | u32 stack_read :10; | ||
367 | u32 reserved2 : 5; /* default: 00100 */ | ||
368 | } pid_filter_30c_ext_ind_4; | ||
369 | |||
370 | struct { | ||
371 | u32 stack_cnt :10; | ||
372 | u32 unused :22; | ||
373 | } pid_filter_30c_ext_ind_5; | ||
374 | |||
375 | struct { | ||
376 | u32 pid_fsm_save_reg0 : 2; | ||
377 | u32 pid_fsm_save_reg1 : 2; | ||
378 | u32 pid_fsm_save_reg2 : 2; | ||
379 | u32 pid_fsm_save_reg3 : 2; | ||
380 | u32 pid_fsm_save_reg4 : 2; | ||
381 | u32 pid_fsm_save_reg300 : 2; | ||
382 | u32 write_status1 : 2; | ||
383 | u32 write_status4 : 2; | ||
384 | u32 data_size_reg :12; | ||
385 | u32 unused : 4; | ||
386 | } pid_filter_30c_ext_ind_6; | ||
387 | |||
388 | struct { | ||
389 | u32 index_reg : 5; /* (Index pointer) Points at an internal PIDn register. A binary code | ||
390 | representing one of 32 internal PIDn registers as well as its | ||
391 | corresponding internal MAC_lown register. */ | ||
392 | u32 extra_index_reg : 3; /* This vector is used to select between sets of debug signals routed to register 0x30c. */ | ||
393 | u32 AB_select : 1; /* Used in conjunction with 0x31c. read/write to the MAC_highA or MAC_highB register | ||
394 | 0=MAC_highB register, 1=MAC_highA */ | ||
395 | u32 pass_alltables : 1; /* 1=Net packets are not filtered against the Network Table ID found in register 0x400. | ||
396 | All types of networks (DVB, ATSC, ISDB) are passed. */ | ||
397 | u32 unused :22; | ||
398 | } index_reg_310; | ||
399 | |||
400 | struct { | ||
401 | u32 PID :13; /* PID value */ | ||
402 | u32 PID_trans : 1; /* translation will take place for packets filtered */ | ||
403 | u32 PID_enable_bit : 1; /* When set this PID filter is enabled */ | ||
404 | u32 reserved :17; | ||
405 | } pid_n_reg_314; | ||
406 | |||
407 | struct { | ||
408 | u32 A4_byte : 8; | ||
409 | u32 A5_byte : 8; | ||
410 | u32 A6_byte : 8; | ||
411 | u32 Enable_bit : 1; /* enabled (1) or disabled (1) */ | ||
412 | u32 HighAB_bit : 1; /* use MAC_highA (1) or MAC_highB (0) as MSB */ | ||
413 | u32 reserved : 6; | ||
414 | } mac_low_reg_318; | ||
415 | |||
416 | struct { | ||
417 | u32 A1_byte : 8; | ||
418 | u32 A2_byte : 8; | ||
419 | u32 A3_byte : 8; | ||
420 | u32 reserved : 8; | ||
421 | } mac_high_reg_31c; | ||
422 | |||
423 | /* Table, SMCID,MACDestination Filters 0x400 to 0x41c */ | ||
424 | struct { | ||
425 | u32 reserved :16; | ||
426 | #define fc_data_Tag_ID_DVB 0x3e | 47 | #define fc_data_Tag_ID_DVB 0x3e |
427 | #define fc_data_Tag_ID_ATSC 0x3f | 48 | #define fc_data_Tag_ID_ATSC 0x3f |
428 | #define fc_data_Tag_ID_IDSB 0x8b | 49 | #define fc_data_Tag_ID_IDSB 0x8b |
429 | u32 data_Tag_ID :16; | ||
430 | } data_tag_400; | ||
431 | |||
432 | struct { | ||
433 | u32 Card_IDbyte6 : 8; | ||
434 | u32 Card_IDbyte5 : 8; | ||
435 | u32 Card_IDbyte4 : 8; | ||
436 | u32 Card_IDbyte3 : 8; | ||
437 | } card_id_408; | ||
438 | |||
439 | struct { | ||
440 | u32 Card_IDbyte2 : 8; | ||
441 | u32 Card_IDbyte1 : 8; | ||
442 | } card_id_40c; | ||
443 | |||
444 | /* holding the unique mac address of the receiver which houses the FlexCopIII */ | ||
445 | struct { | ||
446 | u32 MAC1 : 8; | ||
447 | u32 MAC2 : 8; | ||
448 | u32 MAC3 : 8; | ||
449 | u32 MAC6 : 8; | ||
450 | } mac_address_418; | ||
451 | |||
452 | struct { | ||
453 | u32 MAC7 : 8; | ||
454 | u32 MAC8 : 8; | ||
455 | u32 reserved : 16; | ||
456 | } mac_address_41c; | ||
457 | |||
458 | struct { | ||
459 | u32 transmitter_data_byte : 8; | ||
460 | u32 ReceiveDataReady : 1; | ||
461 | u32 ReceiveByteFrameError: 1; | ||
462 | u32 txbuffempty : 1; | ||
463 | u32 reserved :21; | ||
464 | } ci_600; | ||
465 | |||
466 | struct { | ||
467 | u32 pi_d : 8; | ||
468 | u32 pi_ha :20; | ||
469 | u32 pi_rw : 1; | ||
470 | u32 pi_component_reg : 3; | ||
471 | } pi_604; | ||
472 | |||
473 | struct { | ||
474 | u32 serialReset : 1; | ||
475 | u32 oncecycle_read : 1; | ||
476 | u32 Timer_Read_req : 1; | ||
477 | u32 Timer_Load_req : 1; | ||
478 | u32 timer_data : 7; | ||
479 | u32 unused : 1; /* ??? not mentioned in data book */ | ||
480 | u32 Timer_addr : 5; | ||
481 | u32 reserved : 3; | ||
482 | u32 pcmcia_a_mod_pwr_n : 1; | ||
483 | u32 pcmcia_b_mod_pwr_n : 1; | ||
484 | u32 config_Done_stat : 1; | ||
485 | u32 config_Init_stat : 1; | ||
486 | u32 config_Prog_n : 1; | ||
487 | u32 config_wr_n : 1; | ||
488 | u32 config_cs_n : 1; | ||
489 | u32 config_cclk : 1; | ||
490 | u32 pi_CiMax_IRQ_n : 1; | ||
491 | u32 pi_timeout_status : 1; | ||
492 | u32 pi_wait_n : 1; | ||
493 | u32 pi_busy_n : 1; | ||
494 | } pi_608; | ||
495 | 50 | ||
496 | struct { | ||
497 | u32 PID :13; | ||
498 | u32 key_enable : 1; | ||
499 | #define fc_key_code_default 0x1 | 51 | #define fc_key_code_default 0x1 |
500 | #define fc_key_code_even 0x2 | 52 | #define fc_key_code_even 0x2 |
501 | #define fc_key_code_odd 0x3 | 53 | #define fc_key_code_odd 0x3 |
502 | u32 key_code : 2; | ||
503 | u32 key_array_col : 3; | ||
504 | u32 key_array_row : 5; | ||
505 | u32 dvb_en : 1; /* 0=TS bypasses the Descrambler */ | ||
506 | u32 rw_flag : 1; | ||
507 | u32 reserved : 6; | ||
508 | } dvb_reg_60c; | ||
509 | |||
510 | /* SRAM and Output Destination 0x700 to 0x714 */ | ||
511 | struct { | ||
512 | u32 sram_addr :15; | ||
513 | u32 sram_rw : 1; /* 0=write, 1=read */ | ||
514 | u32 sram_data : 8; | ||
515 | u32 sc_xfer_bit : 1; | ||
516 | u32 reserved1 : 3; | ||
517 | u32 oe_pin_reg : 1; | ||
518 | u32 ce_pin_reg : 1; | ||
519 | u32 reserved2 : 1; | ||
520 | u32 start_sram_ibi : 1; | ||
521 | } sram_ctrl_reg_700; | ||
522 | |||
523 | struct { | ||
524 | u32 net_addr_read :16; | ||
525 | u32 net_addr_write :16; | ||
526 | } net_buf_reg_704; | ||
527 | |||
528 | struct { | ||
529 | u32 cai_read :11; | ||
530 | u32 reserved1 : 5; | ||
531 | u32 cai_write :11; | ||
532 | u32 reserved2 : 6; | ||
533 | u32 cai_cnt : 4; | ||
534 | } cai_buf_reg_708; | ||
535 | |||
536 | struct { | ||
537 | u32 cao_read :11; | ||
538 | u32 reserved1 : 5; | ||
539 | u32 cap_write :11; | ||
540 | u32 reserved2 : 6; | ||
541 | u32 cao_cnt : 4; | ||
542 | } cao_buf_reg_70c; | ||
543 | |||
544 | struct { | ||
545 | u32 media_read :11; | ||
546 | u32 reserved1 : 5; | ||
547 | u32 media_write :11; | ||
548 | u32 reserved2 : 6; | ||
549 | u32 media_cnt : 4; | ||
550 | } media_buf_reg_710; | ||
551 | |||
552 | struct { | ||
553 | u32 NET_Dest : 2; | ||
554 | u32 CAI_Dest : 2; | ||
555 | u32 CAO_Dest : 2; | ||
556 | u32 MEDIA_Dest : 2; | ||
557 | u32 net_ovflow_error : 1; | ||
558 | u32 media_ovflow_error : 1; | ||
559 | u32 cai_ovflow_error : 1; | ||
560 | u32 cao_ovflow_error : 1; | ||
561 | u32 ctrl_usb_wan : 1; | ||
562 | u32 ctrl_sramdma : 1; | ||
563 | u32 ctrl_maximumfill : 1; | ||
564 | u32 reserved :17; | ||
565 | } sram_dest_reg_714; | ||
566 | |||
567 | struct { | ||
568 | u32 net_cnt :12; | ||
569 | u32 reserved1 : 4; | ||
570 | u32 net_addr_read : 1; | ||
571 | u32 reserved2 : 3; | ||
572 | u32 net_addr_write : 1; | ||
573 | u32 reserved3 :11; | ||
574 | } net_buf_reg_718; | ||
575 | |||
576 | struct { | ||
577 | u32 wan_speed_sig : 2; | ||
578 | u32 reserved1 : 6; | ||
579 | u32 wan_wait_state : 8; | ||
580 | u32 sram_chip : 2; | ||
581 | u32 sram_memmap : 2; | ||
582 | u32 reserved2 : 4; | ||
583 | u32 wan_pkt_frame : 4; | ||
584 | u32 reserved3 : 4; | ||
585 | } wan_ctrl_reg_71c; | ||
586 | } flexcop_ibi_value; | ||
587 | 54 | ||
588 | extern flexcop_ibi_value ibi_zero; | 55 | extern flexcop_ibi_value ibi_zero; |
589 | 56 | ||
diff --git a/drivers/media/dvb/b2c2/flexcop-usb.c b/drivers/media/dvb/b2c2/flexcop-usb.c index 0113449abd15..0a78ba3737a5 100644 --- a/drivers/media/dvb/b2c2/flexcop-usb.c +++ b/drivers/media/dvb/b2c2/flexcop-usb.c | |||
@@ -545,7 +545,7 @@ static struct usb_device_id flexcop_usb_table [] = { | |||
545 | /* usb specific object needed to register this driver with the usb subsystem */ | 545 | /* usb specific object needed to register this driver with the usb subsystem */ |
546 | static struct usb_driver flexcop_usb_driver = { | 546 | static struct usb_driver flexcop_usb_driver = { |
547 | .owner = THIS_MODULE, | 547 | .owner = THIS_MODULE, |
548 | .name = "Technisat/B2C2 FlexCop II/IIb/III USB", | 548 | .name = "b2c2_flexcop_usb", |
549 | .probe = flexcop_usb_probe, | 549 | .probe = flexcop_usb_probe, |
550 | .disconnect = flexcop_usb_disconnect, | 550 | .disconnect = flexcop_usb_disconnect, |
551 | .id_table = flexcop_usb_table, | 551 | .id_table = flexcop_usb_table, |
diff --git a/drivers/media/dvb/b2c2/flexcop.c b/drivers/media/dvb/b2c2/flexcop.c index 8b5d14dd36e3..12873d435406 100644 --- a/drivers/media/dvb/b2c2/flexcop.c +++ b/drivers/media/dvb/b2c2/flexcop.c | |||
@@ -46,7 +46,7 @@ | |||
46 | 46 | ||
47 | int b2c2_flexcop_debug; | 47 | int b2c2_flexcop_debug; |
48 | module_param_named(debug, b2c2_flexcop_debug, int, 0644); | 48 | module_param_named(debug, b2c2_flexcop_debug, int, 0644); |
49 | MODULE_PARM_DESC(debug, "set debug level (1=info,2=tuner,4=i2c,8=ts,16=sram (|-able))." DEBSTATUS); | 49 | MODULE_PARM_DESC(debug, "set debug level (1=info,2=tuner,4=i2c,8=ts,16=sram,32=reg (|-able))." DEBSTATUS); |
50 | #undef DEBSTATUS | 50 | #undef DEBSTATUS |
51 | 51 | ||
52 | /* global zero for ibi values */ | 52 | /* global zero for ibi values */ |
@@ -173,9 +173,20 @@ static void flexcop_reset(struct flexcop_device *fc) | |||
173 | fc->write_ibi_reg(fc,ctrl_208,ibi_zero); | 173 | fc->write_ibi_reg(fc,ctrl_208,ibi_zero); |
174 | 174 | ||
175 | v210.raw = 0; | 175 | v210.raw = 0; |
176 | v210.sw_reset_210.reset_blocks = 0xff; | 176 | v210.sw_reset_210.reset_block_000 = 1; |
177 | v210.sw_reset_210.reset_block_100 = 1; | ||
178 | v210.sw_reset_210.reset_block_200 = 1; | ||
179 | v210.sw_reset_210.reset_block_300 = 1; | ||
180 | v210.sw_reset_210.reset_block_400 = 1; | ||
181 | v210.sw_reset_210.reset_block_500 = 1; | ||
182 | v210.sw_reset_210.reset_block_600 = 1; | ||
183 | v210.sw_reset_210.reset_block_700 = 1; | ||
177 | v210.sw_reset_210.Block_reset_enable = 0xb2; | 184 | v210.sw_reset_210.Block_reset_enable = 0xb2; |
185 | |||
186 | v210.sw_reset_210.Special_controls = 0xc259; | ||
187 | |||
178 | fc->write_ibi_reg(fc,sw_reset_210,v210); | 188 | fc->write_ibi_reg(fc,sw_reset_210,v210); |
189 | msleep(1); | ||
179 | 190 | ||
180 | /* reset the periphical devices */ | 191 | /* reset the periphical devices */ |
181 | 192 | ||
@@ -186,6 +197,25 @@ static void flexcop_reset(struct flexcop_device *fc) | |||
186 | fc->write_ibi_reg(fc,misc_204,v204); | 197 | fc->write_ibi_reg(fc,misc_204,v204); |
187 | } | 198 | } |
188 | 199 | ||
200 | void flexcop_reset_block_300(struct flexcop_device *fc) | ||
201 | { | ||
202 | flexcop_ibi_value v208_save = fc->read_ibi_reg(fc,ctrl_208), | ||
203 | v210 = fc->read_ibi_reg(fc,sw_reset_210); | ||
204 | |||
205 | deb_rdump("208: %08x, 210: %08x\n",v208_save.raw,v210.raw); | ||
206 | |||
207 | fc->write_ibi_reg(fc,ctrl_208,ibi_zero); | ||
208 | |||
209 | v210.sw_reset_210.reset_block_300 = 1; | ||
210 | v210.sw_reset_210.Block_reset_enable = 0xb2; | ||
211 | |||
212 | fc->write_ibi_reg(fc,sw_reset_210,v210); | ||
213 | msleep(1); | ||
214 | |||
215 | fc->write_ibi_reg(fc,ctrl_208,v208_save); | ||
216 | } | ||
217 | EXPORT_SYMBOL(flexcop_reset_block_300); | ||
218 | |||
189 | struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len) | 219 | struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len) |
190 | { | 220 | { |
191 | void *bus; | 221 | void *bus; |
diff --git a/drivers/media/dvb/b2c2/flexcop.h b/drivers/media/dvb/b2c2/flexcop.h index caa343a97bdc..0cebe1d92e0b 100644 --- a/drivers/media/dvb/b2c2/flexcop.h +++ b/drivers/media/dvb/b2c2/flexcop.h | |||
@@ -26,5 +26,6 @@ extern int b2c2_flexcop_debug; | |||
26 | #define deb_i2c(args...) dprintk(0x04,args) | 26 | #define deb_i2c(args...) dprintk(0x04,args) |
27 | #define deb_ts(args...) dprintk(0x08,args) | 27 | #define deb_ts(args...) dprintk(0x08,args) |
28 | #define deb_sram(args...) dprintk(0x10,args) | 28 | #define deb_sram(args...) dprintk(0x10,args) |
29 | #define deb_rdump(args...) dprintk(0x20,args) | ||
29 | 30 | ||
30 | #endif | 31 | #endif |
diff --git a/drivers/media/dvb/b2c2/flexcop_ibi_value_be.h b/drivers/media/dvb/b2c2/flexcop_ibi_value_be.h new file mode 100644 index 000000000000..ed9a6756b194 --- /dev/null +++ b/drivers/media/dvb/b2c2/flexcop_ibi_value_be.h | |||
@@ -0,0 +1,458 @@ | |||
1 | /* This file is part of linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III | ||
2 | * | ||
3 | * register descriptions | ||
4 | * | ||
5 | * see flexcop.c for copyright information. | ||
6 | */ | ||
7 | |||
8 | /* This file is automatically generated, do not edit things here. */ | ||
9 | #ifndef __FLEXCOP_IBI_VALUE_INCLUDED__ | ||
10 | #define __FLEXCOP_IBI_VALUE_INCLUDED__ | ||
11 | |||
12 | typedef union { | ||
13 | u32 raw; | ||
14 | |||
15 | struct { | ||
16 | u32 dma_address0 :30; | ||
17 | u32 dma_0No_update : 1; | ||
18 | u32 dma_0start : 1; | ||
19 | } dma_0x0; | ||
20 | |||
21 | struct { | ||
22 | u32 dma_addr_size :24; | ||
23 | u32 DMA_maxpackets : 8; | ||
24 | } dma_0x4_remap; | ||
25 | |||
26 | struct { | ||
27 | u32 dma_addr_size :24; | ||
28 | u32 unused : 1; | ||
29 | u32 dma1timer : 7; | ||
30 | } dma_0x4_read; | ||
31 | |||
32 | struct { | ||
33 | u32 dma_addr_size :24; | ||
34 | u32 dmatimer : 7; | ||
35 | u32 unused : 1; | ||
36 | } dma_0x4_write; | ||
37 | |||
38 | struct { | ||
39 | u32 dma_cur_addr :30; | ||
40 | u32 unused : 2; | ||
41 | } dma_0x8; | ||
42 | |||
43 | struct { | ||
44 | u32 dma_address1 :30; | ||
45 | u32 remap_enable : 1; | ||
46 | u32 dma_1start : 1; | ||
47 | } dma_0xc; | ||
48 | |||
49 | struct { | ||
50 | u32 st_done : 1; | ||
51 | u32 no_base_addr_ack_error : 1; | ||
52 | u32 twoWS_port_reg : 2; | ||
53 | u32 total_bytes : 2; | ||
54 | u32 twoWS_rw : 1; | ||
55 | u32 working_start : 1; | ||
56 | u32 data1_reg : 8; | ||
57 | u32 baseaddr : 8; | ||
58 | u32 reserved1 : 1; | ||
59 | u32 chipaddr : 7; | ||
60 | } tw_sm_c_100; | ||
61 | |||
62 | struct { | ||
63 | u32 unused : 6; | ||
64 | u32 force_stop : 1; | ||
65 | u32 exlicit_stops : 1; | ||
66 | u32 data4_reg : 8; | ||
67 | u32 data3_reg : 8; | ||
68 | u32 data2_reg : 8; | ||
69 | } tw_sm_c_104; | ||
70 | |||
71 | struct { | ||
72 | u32 reserved2 :19; | ||
73 | u32 tlo1 : 5; | ||
74 | u32 reserved1 : 2; | ||
75 | u32 thi1 : 6; | ||
76 | } tw_sm_c_108; | ||
77 | |||
78 | struct { | ||
79 | u32 reserved2 :19; | ||
80 | u32 tlo1 : 5; | ||
81 | u32 reserved1 : 2; | ||
82 | u32 thi1 : 6; | ||
83 | } tw_sm_c_10c; | ||
84 | |||
85 | struct { | ||
86 | u32 reserved2 :19; | ||
87 | u32 tlo1 : 5; | ||
88 | u32 reserved1 : 2; | ||
89 | u32 thi1 : 6; | ||
90 | } tw_sm_c_110; | ||
91 | |||
92 | struct { | ||
93 | u32 LNB_CTLPrescaler_sig : 2; | ||
94 | u32 LNB_CTLLowCount_sig :15; | ||
95 | u32 LNB_CTLHighCount_sig :15; | ||
96 | } lnb_switch_freq_200; | ||
97 | |||
98 | struct { | ||
99 | u32 Rev_N_sig_reserved2 : 1; | ||
100 | u32 Rev_N_sig_caps : 1; | ||
101 | u32 Rev_N_sig_reserved1 : 2; | ||
102 | u32 Rev_N_sig_revision_hi : 4; | ||
103 | u32 reserved :20; | ||
104 | u32 Per_reset_sig : 1; | ||
105 | u32 LNB_L_H_sig : 1; | ||
106 | u32 ACPI3_sig : 1; | ||
107 | u32 ACPI1_sig : 1; | ||
108 | } misc_204; | ||
109 | |||
110 | struct { | ||
111 | u32 unused : 9; | ||
112 | u32 Mailbox_from_V8_Enable_sig : 1; | ||
113 | u32 DMA2_Size_IRQ_Enable_sig : 1; | ||
114 | u32 DMA1_Size_IRQ_Enable_sig : 1; | ||
115 | u32 DMA2_Timer_Enable_sig : 1; | ||
116 | u32 DMA2_IRQ_Enable_sig : 1; | ||
117 | u32 DMA1_Timer_Enable_sig : 1; | ||
118 | u32 DMA1_IRQ_Enable_sig : 1; | ||
119 | u32 Rcv_Data_sig : 1; | ||
120 | u32 MAC_filter_Mode_sig : 1; | ||
121 | u32 Multi2_Enable_sig : 1; | ||
122 | u32 Per_CA_Enable_sig : 1; | ||
123 | u32 SMC_Enable_sig : 1; | ||
124 | u32 CA_Enable_sig : 1; | ||
125 | u32 WAN_CA_Enable_sig : 1; | ||
126 | u32 WAN_Enable_sig : 1; | ||
127 | u32 Mask_filter_sig : 1; | ||
128 | u32 Null_filter_sig : 1; | ||
129 | u32 ECM_filter_sig : 1; | ||
130 | u32 EMM_filter_sig : 1; | ||
131 | u32 PMT_filter_sig : 1; | ||
132 | u32 PCR_filter_sig : 1; | ||
133 | u32 Stream2_filter_sig : 1; | ||
134 | u32 Stream1_filter_sig : 1; | ||
135 | } ctrl_208; | ||
136 | |||
137 | struct { | ||
138 | u32 reserved :21; | ||
139 | u32 Transport_Error : 1; | ||
140 | u32 LLC_SNAP_FLAG_set : 1; | ||
141 | u32 Continuity_error_flag : 1; | ||
142 | u32 Data_receiver_error : 1; | ||
143 | u32 Mailbox_from_V8_Status_sig : 1; | ||
144 | u32 DMA2_Size_IRQ_Status : 1; | ||
145 | u32 DMA1_Size_IRQ_Status : 1; | ||
146 | u32 DMA2_Timer_Status : 1; | ||
147 | u32 DMA2_IRQ_Status : 1; | ||
148 | u32 DMA1_Timer_Status : 1; | ||
149 | u32 DMA1_IRQ_Status : 1; | ||
150 | } irq_20c; | ||
151 | |||
152 | struct { | ||
153 | u32 Special_controls :16; | ||
154 | u32 Block_reset_enable : 8; | ||
155 | u32 reset_block_700 : 1; | ||
156 | u32 reset_block_600 : 1; | ||
157 | u32 reset_block_500 : 1; | ||
158 | u32 reset_block_400 : 1; | ||
159 | u32 reset_block_300 : 1; | ||
160 | u32 reset_block_200 : 1; | ||
161 | u32 reset_block_100 : 1; | ||
162 | u32 reset_block_000 : 1; | ||
163 | } sw_reset_210; | ||
164 | |||
165 | struct { | ||
166 | u32 unused2 :20; | ||
167 | u32 polarity_PS_ERR_sig : 1; | ||
168 | u32 polarity_PS_SYNC_sig : 1; | ||
169 | u32 polarity_PS_VALID_sig : 1; | ||
170 | u32 polarity_PS_CLK_sig : 1; | ||
171 | u32 unused1 : 3; | ||
172 | u32 s2p_sel_sig : 1; | ||
173 | u32 section_pkg_enable_sig : 1; | ||
174 | u32 halt_V8_sig : 1; | ||
175 | u32 v2WS_oe_sig : 1; | ||
176 | u32 vuart_oe_sig : 1; | ||
177 | } misc_214; | ||
178 | |||
179 | struct { | ||
180 | u32 Mailbox_from_V8 :32; | ||
181 | } mbox_v8_to_host_218; | ||
182 | |||
183 | struct { | ||
184 | u32 sysramaccess_busmuster : 1; | ||
185 | u32 sysramaccess_write : 1; | ||
186 | u32 unused : 7; | ||
187 | u32 sysramaccess_addr :15; | ||
188 | u32 sysramaccess_data : 8; | ||
189 | } mbox_host_to_v8_21c; | ||
190 | |||
191 | struct { | ||
192 | u32 debug_fifo_problem : 1; | ||
193 | u32 debug_flag_write_status00 : 1; | ||
194 | u32 Stream2_trans : 1; | ||
195 | u32 Stream2_PID :13; | ||
196 | u32 debug_flag_pid_saved : 1; | ||
197 | u32 MAC_Multicast_filter : 1; | ||
198 | u32 Stream1_trans : 1; | ||
199 | u32 Stream1_PID :13; | ||
200 | } pid_filter_300; | ||
201 | |||
202 | struct { | ||
203 | u32 reserved : 2; | ||
204 | u32 PMT_trans : 1; | ||
205 | u32 PMT_PID :13; | ||
206 | u32 debug_overrun2 : 1; | ||
207 | u32 debug_overrun3 : 1; | ||
208 | u32 PCR_trans : 1; | ||
209 | u32 PCR_PID :13; | ||
210 | } pid_filter_304; | ||
211 | |||
212 | struct { | ||
213 | u32 reserved : 2; | ||
214 | u32 ECM_trans : 1; | ||
215 | u32 ECM_PID :13; | ||
216 | u32 EMM_filter_6 : 1; | ||
217 | u32 EMM_filter_4 : 1; | ||
218 | u32 EMM_trans : 1; | ||
219 | u32 EMM_PID :13; | ||
220 | } pid_filter_308; | ||
221 | |||
222 | struct { | ||
223 | u32 unused2 : 3; | ||
224 | u32 Group_mask :13; | ||
225 | u32 unused1 : 2; | ||
226 | u32 Group_trans : 1; | ||
227 | u32 Group_PID :13; | ||
228 | } pid_filter_30c_ext_ind_0_7; | ||
229 | |||
230 | struct { | ||
231 | u32 unused :15; | ||
232 | u32 net_master_read :17; | ||
233 | } pid_filter_30c_ext_ind_1; | ||
234 | |||
235 | struct { | ||
236 | u32 unused :15; | ||
237 | u32 net_master_write :17; | ||
238 | } pid_filter_30c_ext_ind_2; | ||
239 | |||
240 | struct { | ||
241 | u32 unused :15; | ||
242 | u32 next_net_master_write :17; | ||
243 | } pid_filter_30c_ext_ind_3; | ||
244 | |||
245 | struct { | ||
246 | u32 reserved2 : 5; | ||
247 | u32 stack_read :10; | ||
248 | u32 reserved1 : 6; | ||
249 | u32 state_write :10; | ||
250 | u32 unused1 : 1; | ||
251 | } pid_filter_30c_ext_ind_4; | ||
252 | |||
253 | struct { | ||
254 | u32 unused :22; | ||
255 | u32 stack_cnt :10; | ||
256 | } pid_filter_30c_ext_ind_5; | ||
257 | |||
258 | struct { | ||
259 | u32 unused : 4; | ||
260 | u32 data_size_reg :12; | ||
261 | u32 write_status4 : 2; | ||
262 | u32 write_status1 : 2; | ||
263 | u32 pid_fsm_save_reg300 : 2; | ||
264 | u32 pid_fsm_save_reg4 : 2; | ||
265 | u32 pid_fsm_save_reg3 : 2; | ||
266 | u32 pid_fsm_save_reg2 : 2; | ||
267 | u32 pid_fsm_save_reg1 : 2; | ||
268 | u32 pid_fsm_save_reg0 : 2; | ||
269 | } pid_filter_30c_ext_ind_6; | ||
270 | |||
271 | struct { | ||
272 | u32 unused :22; | ||
273 | u32 pass_alltables : 1; | ||
274 | u32 AB_select : 1; | ||
275 | u32 extra_index_reg : 3; | ||
276 | u32 index_reg : 5; | ||
277 | } index_reg_310; | ||
278 | |||
279 | struct { | ||
280 | u32 reserved :17; | ||
281 | u32 PID_enable_bit : 1; | ||
282 | u32 PID_trans : 1; | ||
283 | u32 PID :13; | ||
284 | } pid_n_reg_314; | ||
285 | |||
286 | struct { | ||
287 | u32 reserved : 6; | ||
288 | u32 HighAB_bit : 1; | ||
289 | u32 Enable_bit : 1; | ||
290 | u32 A6_byte : 8; | ||
291 | u32 A5_byte : 8; | ||
292 | u32 A4_byte : 8; | ||
293 | } mac_low_reg_318; | ||
294 | |||
295 | struct { | ||
296 | u32 reserved : 8; | ||
297 | u32 A3_byte : 8; | ||
298 | u32 A2_byte : 8; | ||
299 | u32 A1_byte : 8; | ||
300 | } mac_high_reg_31c; | ||
301 | |||
302 | struct { | ||
303 | u32 data_Tag_ID :16; | ||
304 | u32 reserved :16; | ||
305 | } data_tag_400; | ||
306 | |||
307 | struct { | ||
308 | u32 Card_IDbyte3 : 8; | ||
309 | u32 Card_IDbyte4 : 8; | ||
310 | u32 Card_IDbyte5 : 8; | ||
311 | u32 Card_IDbyte6 : 8; | ||
312 | } card_id_408; | ||
313 | |||
314 | struct { | ||
315 | u32 Card_IDbyte1 : 8; | ||
316 | u32 Card_IDbyte2 : 8; | ||
317 | } card_id_40c; | ||
318 | |||
319 | struct { | ||
320 | u32 MAC6 : 8; | ||
321 | u32 MAC3 : 8; | ||
322 | u32 MAC2 : 8; | ||
323 | u32 MAC1 : 8; | ||
324 | } mac_address_418; | ||
325 | |||
326 | struct { | ||
327 | u32 reserved :16; | ||
328 | u32 MAC8 : 8; | ||
329 | u32 MAC7 : 8; | ||
330 | } mac_address_41c; | ||
331 | |||
332 | struct { | ||
333 | u32 reserved :21; | ||
334 | u32 txbuffempty : 1; | ||
335 | u32 ReceiveByteFrameError : 1; | ||
336 | u32 ReceiveDataReady : 1; | ||
337 | u32 transmitter_data_byte : 8; | ||
338 | } ci_600; | ||
339 | |||
340 | struct { | ||
341 | u32 pi_component_reg : 3; | ||
342 | u32 pi_rw : 1; | ||
343 | u32 pi_ha :20; | ||
344 | u32 pi_d : 8; | ||
345 | } pi_604; | ||
346 | |||
347 | struct { | ||
348 | u32 pi_busy_n : 1; | ||
349 | u32 pi_wait_n : 1; | ||
350 | u32 pi_timeout_status : 1; | ||
351 | u32 pi_CiMax_IRQ_n : 1; | ||
352 | u32 config_cclk : 1; | ||
353 | u32 config_cs_n : 1; | ||
354 | u32 config_wr_n : 1; | ||
355 | u32 config_Prog_n : 1; | ||
356 | u32 config_Init_stat : 1; | ||
357 | u32 config_Done_stat : 1; | ||
358 | u32 pcmcia_b_mod_pwr_n : 1; | ||
359 | u32 pcmcia_a_mod_pwr_n : 1; | ||
360 | u32 reserved : 3; | ||
361 | u32 Timer_addr : 5; | ||
362 | u32 unused : 1; | ||
363 | u32 timer_data : 7; | ||
364 | u32 Timer_Load_req : 1; | ||
365 | u32 Timer_Read_req : 1; | ||
366 | u32 oncecycle_read : 1; | ||
367 | u32 serialReset : 1; | ||
368 | } pi_608; | ||
369 | |||
370 | struct { | ||
371 | u32 reserved : 6; | ||
372 | u32 rw_flag : 1; | ||
373 | u32 dvb_en : 1; | ||
374 | u32 key_array_row : 5; | ||
375 | u32 key_array_col : 3; | ||
376 | u32 key_code : 2; | ||
377 | u32 key_enable : 1; | ||
378 | u32 PID :13; | ||
379 | } dvb_reg_60c; | ||
380 | |||
381 | struct { | ||
382 | u32 start_sram_ibi : 1; | ||
383 | u32 reserved2 : 1; | ||
384 | u32 ce_pin_reg : 1; | ||
385 | u32 oe_pin_reg : 1; | ||
386 | u32 reserved1 : 3; | ||
387 | u32 sc_xfer_bit : 1; | ||
388 | u32 sram_data : 8; | ||
389 | u32 sram_rw : 1; | ||
390 | u32 sram_addr :15; | ||
391 | } sram_ctrl_reg_700; | ||
392 | |||
393 | struct { | ||
394 | u32 net_addr_write :16; | ||
395 | u32 net_addr_read :16; | ||
396 | } net_buf_reg_704; | ||
397 | |||
398 | struct { | ||
399 | u32 cai_cnt : 4; | ||
400 | u32 reserved2 : 6; | ||
401 | u32 cai_write :11; | ||
402 | u32 reserved1 : 5; | ||
403 | u32 cai_read :11; | ||
404 | } cai_buf_reg_708; | ||
405 | |||
406 | struct { | ||
407 | u32 cao_cnt : 4; | ||
408 | u32 reserved2 : 6; | ||
409 | u32 cap_write :11; | ||
410 | u32 reserved1 : 5; | ||
411 | u32 cao_read :11; | ||
412 | } cao_buf_reg_70c; | ||
413 | |||
414 | struct { | ||
415 | u32 media_cnt : 4; | ||
416 | u32 reserved2 : 6; | ||
417 | u32 media_write :11; | ||
418 | u32 reserved1 : 5; | ||
419 | u32 media_read :11; | ||
420 | } media_buf_reg_710; | ||
421 | |||
422 | struct { | ||
423 | u32 reserved :17; | ||
424 | u32 ctrl_maximumfill : 1; | ||
425 | u32 ctrl_sramdma : 1; | ||
426 | u32 ctrl_usb_wan : 1; | ||
427 | u32 cao_ovflow_error : 1; | ||
428 | u32 cai_ovflow_error : 1; | ||
429 | u32 media_ovflow_error : 1; | ||
430 | u32 net_ovflow_error : 1; | ||
431 | u32 MEDIA_Dest : 2; | ||
432 | u32 CAO_Dest : 2; | ||
433 | u32 CAI_Dest : 2; | ||
434 | u32 NET_Dest : 2; | ||
435 | } sram_dest_reg_714; | ||
436 | |||
437 | struct { | ||
438 | u32 reserved3 :11; | ||
439 | u32 net_addr_write : 1; | ||
440 | u32 reserved2 : 3; | ||
441 | u32 net_addr_read : 1; | ||
442 | u32 reserved1 : 4; | ||
443 | u32 net_cnt :12; | ||
444 | } net_buf_reg_718; | ||
445 | |||
446 | struct { | ||
447 | u32 reserved3 : 4; | ||
448 | u32 wan_pkt_frame : 4; | ||
449 | u32 reserved2 : 4; | ||
450 | u32 sram_memmap : 2; | ||
451 | u32 sram_chip : 2; | ||
452 | u32 wan_wait_state : 8; | ||
453 | u32 reserved1 : 6; | ||
454 | u32 wan_speed_sig : 2; | ||
455 | } wan_ctrl_reg_71c; | ||
456 | } flexcop_ibi_value; | ||
457 | |||
458 | #endif | ||
diff --git a/drivers/media/dvb/b2c2/flexcop_ibi_value_le.h b/drivers/media/dvb/b2c2/flexcop_ibi_value_le.h new file mode 100644 index 000000000000..49f2315b6e58 --- /dev/null +++ b/drivers/media/dvb/b2c2/flexcop_ibi_value_le.h | |||
@@ -0,0 +1,458 @@ | |||
1 | /* This file is part of linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III | ||
2 | * | ||
3 | * register descriptions | ||
4 | * | ||
5 | * see flexcop.c for copyright information. | ||
6 | */ | ||
7 | |||
8 | /* This file is automatically generated, do not edit things here. */ | ||
9 | #ifndef __FLEXCOP_IBI_VALUE_INCLUDED__ | ||
10 | #define __FLEXCOP_IBI_VALUE_INCLUDED__ | ||
11 | |||
12 | typedef union { | ||
13 | u32 raw; | ||
14 | |||
15 | struct { | ||
16 | u32 dma_0start : 1; | ||
17 | u32 dma_0No_update : 1; | ||
18 | u32 dma_address0 :30; | ||
19 | } dma_0x0; | ||
20 | |||
21 | struct { | ||
22 | u32 DMA_maxpackets : 8; | ||
23 | u32 dma_addr_size :24; | ||
24 | } dma_0x4_remap; | ||
25 | |||
26 | struct { | ||
27 | u32 dma1timer : 7; | ||
28 | u32 unused : 1; | ||
29 | u32 dma_addr_size :24; | ||
30 | } dma_0x4_read; | ||
31 | |||
32 | struct { | ||
33 | u32 unused : 1; | ||
34 | u32 dmatimer : 7; | ||
35 | u32 dma_addr_size :24; | ||
36 | } dma_0x4_write; | ||
37 | |||
38 | struct { | ||
39 | u32 unused : 2; | ||
40 | u32 dma_cur_addr :30; | ||
41 | } dma_0x8; | ||
42 | |||
43 | struct { | ||
44 | u32 dma_1start : 1; | ||
45 | u32 remap_enable : 1; | ||
46 | u32 dma_address1 :30; | ||
47 | } dma_0xc; | ||
48 | |||
49 | struct { | ||
50 | u32 chipaddr : 7; | ||
51 | u32 reserved1 : 1; | ||
52 | u32 baseaddr : 8; | ||
53 | u32 data1_reg : 8; | ||
54 | u32 working_start : 1; | ||
55 | u32 twoWS_rw : 1; | ||
56 | u32 total_bytes : 2; | ||
57 | u32 twoWS_port_reg : 2; | ||
58 | u32 no_base_addr_ack_error : 1; | ||
59 | u32 st_done : 1; | ||
60 | } tw_sm_c_100; | ||
61 | |||
62 | struct { | ||
63 | u32 data2_reg : 8; | ||
64 | u32 data3_reg : 8; | ||
65 | u32 data4_reg : 8; | ||
66 | u32 exlicit_stops : 1; | ||
67 | u32 force_stop : 1; | ||
68 | u32 unused : 6; | ||
69 | } tw_sm_c_104; | ||
70 | |||
71 | struct { | ||
72 | u32 thi1 : 6; | ||
73 | u32 reserved1 : 2; | ||
74 | u32 tlo1 : 5; | ||
75 | u32 reserved2 :19; | ||
76 | } tw_sm_c_108; | ||
77 | |||
78 | struct { | ||
79 | u32 thi1 : 6; | ||
80 | u32 reserved1 : 2; | ||
81 | u32 tlo1 : 5; | ||
82 | u32 reserved2 :19; | ||
83 | } tw_sm_c_10c; | ||
84 | |||
85 | struct { | ||
86 | u32 thi1 : 6; | ||
87 | u32 reserved1 : 2; | ||
88 | u32 tlo1 : 5; | ||
89 | u32 reserved2 :19; | ||
90 | } tw_sm_c_110; | ||
91 | |||
92 | struct { | ||
93 | u32 LNB_CTLHighCount_sig :15; | ||
94 | u32 LNB_CTLLowCount_sig :15; | ||
95 | u32 LNB_CTLPrescaler_sig : 2; | ||
96 | } lnb_switch_freq_200; | ||
97 | |||
98 | struct { | ||
99 | u32 ACPI1_sig : 1; | ||
100 | u32 ACPI3_sig : 1; | ||
101 | u32 LNB_L_H_sig : 1; | ||
102 | u32 Per_reset_sig : 1; | ||
103 | u32 reserved :20; | ||
104 | u32 Rev_N_sig_revision_hi : 4; | ||
105 | u32 Rev_N_sig_reserved1 : 2; | ||
106 | u32 Rev_N_sig_caps : 1; | ||
107 | u32 Rev_N_sig_reserved2 : 1; | ||
108 | } misc_204; | ||
109 | |||
110 | struct { | ||
111 | u32 Stream1_filter_sig : 1; | ||
112 | u32 Stream2_filter_sig : 1; | ||
113 | u32 PCR_filter_sig : 1; | ||
114 | u32 PMT_filter_sig : 1; | ||
115 | u32 EMM_filter_sig : 1; | ||
116 | u32 ECM_filter_sig : 1; | ||
117 | u32 Null_filter_sig : 1; | ||
118 | u32 Mask_filter_sig : 1; | ||
119 | u32 WAN_Enable_sig : 1; | ||
120 | u32 WAN_CA_Enable_sig : 1; | ||
121 | u32 CA_Enable_sig : 1; | ||
122 | u32 SMC_Enable_sig : 1; | ||
123 | u32 Per_CA_Enable_sig : 1; | ||
124 | u32 Multi2_Enable_sig : 1; | ||
125 | u32 MAC_filter_Mode_sig : 1; | ||
126 | u32 Rcv_Data_sig : 1; | ||
127 | u32 DMA1_IRQ_Enable_sig : 1; | ||
128 | u32 DMA1_Timer_Enable_sig : 1; | ||
129 | u32 DMA2_IRQ_Enable_sig : 1; | ||
130 | u32 DMA2_Timer_Enable_sig : 1; | ||
131 | u32 DMA1_Size_IRQ_Enable_sig : 1; | ||
132 | u32 DMA2_Size_IRQ_Enable_sig : 1; | ||
133 | u32 Mailbox_from_V8_Enable_sig : 1; | ||
134 | u32 unused : 9; | ||
135 | } ctrl_208; | ||
136 | |||
137 | struct { | ||
138 | u32 DMA1_IRQ_Status : 1; | ||
139 | u32 DMA1_Timer_Status : 1; | ||
140 | u32 DMA2_IRQ_Status : 1; | ||
141 | u32 DMA2_Timer_Status : 1; | ||
142 | u32 DMA1_Size_IRQ_Status : 1; | ||
143 | u32 DMA2_Size_IRQ_Status : 1; | ||
144 | u32 Mailbox_from_V8_Status_sig : 1; | ||
145 | u32 Data_receiver_error : 1; | ||
146 | u32 Continuity_error_flag : 1; | ||
147 | u32 LLC_SNAP_FLAG_set : 1; | ||
148 | u32 Transport_Error : 1; | ||
149 | u32 reserved :21; | ||
150 | } irq_20c; | ||
151 | |||
152 | struct { | ||
153 | u32 reset_block_000 : 1; | ||
154 | u32 reset_block_100 : 1; | ||
155 | u32 reset_block_200 : 1; | ||
156 | u32 reset_block_300 : 1; | ||
157 | u32 reset_block_400 : 1; | ||
158 | u32 reset_block_500 : 1; | ||
159 | u32 reset_block_600 : 1; | ||
160 | u32 reset_block_700 : 1; | ||
161 | u32 Block_reset_enable : 8; | ||
162 | u32 Special_controls :16; | ||
163 | } sw_reset_210; | ||
164 | |||
165 | struct { | ||
166 | u32 vuart_oe_sig : 1; | ||
167 | u32 v2WS_oe_sig : 1; | ||
168 | u32 halt_V8_sig : 1; | ||
169 | u32 section_pkg_enable_sig : 1; | ||
170 | u32 s2p_sel_sig : 1; | ||
171 | u32 unused1 : 3; | ||
172 | u32 polarity_PS_CLK_sig : 1; | ||
173 | u32 polarity_PS_VALID_sig : 1; | ||
174 | u32 polarity_PS_SYNC_sig : 1; | ||
175 | u32 polarity_PS_ERR_sig : 1; | ||
176 | u32 unused2 :20; | ||
177 | } misc_214; | ||
178 | |||
179 | struct { | ||
180 | u32 Mailbox_from_V8 :32; | ||
181 | } mbox_v8_to_host_218; | ||
182 | |||
183 | struct { | ||
184 | u32 sysramaccess_data : 8; | ||
185 | u32 sysramaccess_addr :15; | ||
186 | u32 unused : 7; | ||
187 | u32 sysramaccess_write : 1; | ||
188 | u32 sysramaccess_busmuster : 1; | ||
189 | } mbox_host_to_v8_21c; | ||
190 | |||
191 | struct { | ||
192 | u32 Stream1_PID :13; | ||
193 | u32 Stream1_trans : 1; | ||
194 | u32 MAC_Multicast_filter : 1; | ||
195 | u32 debug_flag_pid_saved : 1; | ||
196 | u32 Stream2_PID :13; | ||
197 | u32 Stream2_trans : 1; | ||
198 | u32 debug_flag_write_status00 : 1; | ||
199 | u32 debug_fifo_problem : 1; | ||
200 | } pid_filter_300; | ||
201 | |||
202 | struct { | ||
203 | u32 PCR_PID :13; | ||
204 | u32 PCR_trans : 1; | ||
205 | u32 debug_overrun3 : 1; | ||
206 | u32 debug_overrun2 : 1; | ||
207 | u32 PMT_PID :13; | ||
208 | u32 PMT_trans : 1; | ||
209 | u32 reserved : 2; | ||
210 | } pid_filter_304; | ||
211 | |||
212 | struct { | ||
213 | u32 EMM_PID :13; | ||
214 | u32 EMM_trans : 1; | ||
215 | u32 EMM_filter_4 : 1; | ||
216 | u32 EMM_filter_6 : 1; | ||
217 | u32 ECM_PID :13; | ||
218 | u32 ECM_trans : 1; | ||
219 | u32 reserved : 2; | ||
220 | } pid_filter_308; | ||
221 | |||
222 | struct { | ||
223 | u32 Group_PID :13; | ||
224 | u32 Group_trans : 1; | ||
225 | u32 unused1 : 2; | ||
226 | u32 Group_mask :13; | ||
227 | u32 unused2 : 3; | ||
228 | } pid_filter_30c_ext_ind_0_7; | ||
229 | |||
230 | struct { | ||
231 | u32 net_master_read :17; | ||
232 | u32 unused :15; | ||
233 | } pid_filter_30c_ext_ind_1; | ||
234 | |||
235 | struct { | ||
236 | u32 net_master_write :17; | ||
237 | u32 unused :15; | ||
238 | } pid_filter_30c_ext_ind_2; | ||
239 | |||
240 | struct { | ||
241 | u32 next_net_master_write :17; | ||
242 | u32 unused :15; | ||
243 | } pid_filter_30c_ext_ind_3; | ||
244 | |||
245 | struct { | ||
246 | u32 unused1 : 1; | ||
247 | u32 state_write :10; | ||
248 | u32 reserved1 : 6; | ||
249 | u32 stack_read :10; | ||
250 | u32 reserved2 : 5; | ||
251 | } pid_filter_30c_ext_ind_4; | ||
252 | |||
253 | struct { | ||
254 | u32 stack_cnt :10; | ||
255 | u32 unused :22; | ||
256 | } pid_filter_30c_ext_ind_5; | ||
257 | |||
258 | struct { | ||
259 | u32 pid_fsm_save_reg0 : 2; | ||
260 | u32 pid_fsm_save_reg1 : 2; | ||
261 | u32 pid_fsm_save_reg2 : 2; | ||
262 | u32 pid_fsm_save_reg3 : 2; | ||
263 | u32 pid_fsm_save_reg4 : 2; | ||
264 | u32 pid_fsm_save_reg300 : 2; | ||
265 | u32 write_status1 : 2; | ||
266 | u32 write_status4 : 2; | ||
267 | u32 data_size_reg :12; | ||
268 | u32 unused : 4; | ||
269 | } pid_filter_30c_ext_ind_6; | ||
270 | |||
271 | struct { | ||
272 | u32 index_reg : 5; | ||
273 | u32 extra_index_reg : 3; | ||
274 | u32 AB_select : 1; | ||
275 | u32 pass_alltables : 1; | ||
276 | u32 unused :22; | ||
277 | } index_reg_310; | ||
278 | |||
279 | struct { | ||
280 | u32 PID :13; | ||
281 | u32 PID_trans : 1; | ||
282 | u32 PID_enable_bit : 1; | ||
283 | u32 reserved :17; | ||
284 | } pid_n_reg_314; | ||
285 | |||
286 | struct { | ||
287 | u32 A4_byte : 8; | ||
288 | u32 A5_byte : 8; | ||
289 | u32 A6_byte : 8; | ||
290 | u32 Enable_bit : 1; | ||
291 | u32 HighAB_bit : 1; | ||
292 | u32 reserved : 6; | ||
293 | } mac_low_reg_318; | ||
294 | |||
295 | struct { | ||
296 | u32 A1_byte : 8; | ||
297 | u32 A2_byte : 8; | ||
298 | u32 A3_byte : 8; | ||
299 | u32 reserved : 8; | ||
300 | } mac_high_reg_31c; | ||
301 | |||
302 | struct { | ||
303 | u32 reserved :16; | ||
304 | u32 data_Tag_ID :16; | ||
305 | } data_tag_400; | ||
306 | |||
307 | struct { | ||
308 | u32 Card_IDbyte6 : 8; | ||
309 | u32 Card_IDbyte5 : 8; | ||
310 | u32 Card_IDbyte4 : 8; | ||
311 | u32 Card_IDbyte3 : 8; | ||
312 | } card_id_408; | ||
313 | |||
314 | struct { | ||
315 | u32 Card_IDbyte2 : 8; | ||
316 | u32 Card_IDbyte1 : 8; | ||
317 | } card_id_40c; | ||
318 | |||
319 | struct { | ||
320 | u32 MAC1 : 8; | ||
321 | u32 MAC2 : 8; | ||
322 | u32 MAC3 : 8; | ||
323 | u32 MAC6 : 8; | ||
324 | } mac_address_418; | ||
325 | |||
326 | struct { | ||
327 | u32 MAC7 : 8; | ||
328 | u32 MAC8 : 8; | ||
329 | u32 reserved :16; | ||
330 | } mac_address_41c; | ||
331 | |||
332 | struct { | ||
333 | u32 transmitter_data_byte : 8; | ||
334 | u32 ReceiveDataReady : 1; | ||
335 | u32 ReceiveByteFrameError : 1; | ||
336 | u32 txbuffempty : 1; | ||
337 | u32 reserved :21; | ||
338 | } ci_600; | ||
339 | |||
340 | struct { | ||
341 | u32 pi_d : 8; | ||
342 | u32 pi_ha :20; | ||
343 | u32 pi_rw : 1; | ||
344 | u32 pi_component_reg : 3; | ||
345 | } pi_604; | ||
346 | |||
347 | struct { | ||
348 | u32 serialReset : 1; | ||
349 | u32 oncecycle_read : 1; | ||
350 | u32 Timer_Read_req : 1; | ||
351 | u32 Timer_Load_req : 1; | ||
352 | u32 timer_data : 7; | ||
353 | u32 unused : 1; | ||
354 | u32 Timer_addr : 5; | ||
355 | u32 reserved : 3; | ||
356 | u32 pcmcia_a_mod_pwr_n : 1; | ||
357 | u32 pcmcia_b_mod_pwr_n : 1; | ||
358 | u32 config_Done_stat : 1; | ||
359 | u32 config_Init_stat : 1; | ||
360 | u32 config_Prog_n : 1; | ||
361 | u32 config_wr_n : 1; | ||
362 | u32 config_cs_n : 1; | ||
363 | u32 config_cclk : 1; | ||
364 | u32 pi_CiMax_IRQ_n : 1; | ||
365 | u32 pi_timeout_status : 1; | ||
366 | u32 pi_wait_n : 1; | ||
367 | u32 pi_busy_n : 1; | ||
368 | } pi_608; | ||
369 | |||
370 | struct { | ||
371 | u32 PID :13; | ||
372 | u32 key_enable : 1; | ||
373 | u32 key_code : 2; | ||
374 | u32 key_array_col : 3; | ||
375 | u32 key_array_row : 5; | ||
376 | u32 dvb_en : 1; | ||
377 | u32 rw_flag : 1; | ||
378 | u32 reserved : 6; | ||
379 | } dvb_reg_60c; | ||
380 | |||
381 | struct { | ||
382 | u32 sram_addr :15; | ||
383 | u32 sram_rw : 1; | ||
384 | u32 sram_data : 8; | ||
385 | u32 sc_xfer_bit : 1; | ||
386 | u32 reserved1 : 3; | ||
387 | u32 oe_pin_reg : 1; | ||
388 | u32 ce_pin_reg : 1; | ||
389 | u32 reserved2 : 1; | ||
390 | u32 start_sram_ibi : 1; | ||
391 | } sram_ctrl_reg_700; | ||
392 | |||
393 | struct { | ||
394 | u32 net_addr_read :16; | ||
395 | u32 net_addr_write :16; | ||
396 | } net_buf_reg_704; | ||
397 | |||
398 | struct { | ||
399 | u32 cai_read :11; | ||
400 | u32 reserved1 : 5; | ||
401 | u32 cai_write :11; | ||
402 | u32 reserved2 : 6; | ||
403 | u32 cai_cnt : 4; | ||
404 | } cai_buf_reg_708; | ||
405 | |||
406 | struct { | ||
407 | u32 cao_read :11; | ||
408 | u32 reserved1 : 5; | ||
409 | u32 cap_write :11; | ||
410 | u32 reserved2 : 6; | ||
411 | u32 cao_cnt : 4; | ||
412 | } cao_buf_reg_70c; | ||
413 | |||
414 | struct { | ||
415 | u32 media_read :11; | ||
416 | u32 reserved1 : 5; | ||
417 | u32 media_write :11; | ||
418 | u32 reserved2 : 6; | ||
419 | u32 media_cnt : 4; | ||
420 | } media_buf_reg_710; | ||
421 | |||
422 | struct { | ||
423 | u32 NET_Dest : 2; | ||
424 | u32 CAI_Dest : 2; | ||
425 | u32 CAO_Dest : 2; | ||
426 | u32 MEDIA_Dest : 2; | ||
427 | u32 net_ovflow_error : 1; | ||
428 | u32 media_ovflow_error : 1; | ||
429 | u32 cai_ovflow_error : 1; | ||
430 | u32 cao_ovflow_error : 1; | ||
431 | u32 ctrl_usb_wan : 1; | ||
432 | u32 ctrl_sramdma : 1; | ||
433 | u32 ctrl_maximumfill : 1; | ||
434 | u32 reserved :17; | ||
435 | } sram_dest_reg_714; | ||
436 | |||
437 | struct { | ||
438 | u32 net_cnt :12; | ||
439 | u32 reserved1 : 4; | ||
440 | u32 net_addr_read : 1; | ||
441 | u32 reserved2 : 3; | ||
442 | u32 net_addr_write : 1; | ||
443 | u32 reserved3 :11; | ||
444 | } net_buf_reg_718; | ||
445 | |||
446 | struct { | ||
447 | u32 wan_speed_sig : 2; | ||
448 | u32 reserved1 : 6; | ||
449 | u32 wan_wait_state : 8; | ||
450 | u32 sram_chip : 2; | ||
451 | u32 sram_memmap : 2; | ||
452 | u32 reserved2 : 4; | ||
453 | u32 wan_pkt_frame : 4; | ||
454 | u32 reserved3 : 4; | ||
455 | } wan_ctrl_reg_71c; | ||
456 | } flexcop_ibi_value; | ||
457 | |||
458 | #endif | ||
diff --git a/drivers/media/dvb/b2c2/skystar2.c b/drivers/media/dvb/b2c2/skystar2.c deleted file mode 100644 index acbc4c34f72a..000000000000 --- a/drivers/media/dvb/b2c2/skystar2.c +++ /dev/null | |||
@@ -1,2644 +0,0 @@ | |||
1 | /* | ||
2 | * skystar2.c - driver for the Technisat SkyStar2 PCI DVB card | ||
3 | * based on the FlexCopII by B2C2,Inc. | ||
4 | * | ||
5 | * Copyright (C) 2003 Vadim Catana, skystar@moldova.cc | ||
6 | * | ||
7 | * FIX: DISEQC Tone Burst in flexcop_diseqc_ioctl() | ||
8 | * FIX: FULL soft DiSEqC for skystar2 (FlexCopII rev 130) VP310 equipped | ||
9 | * Vincenzo Di Massa, hawk.it at tiscalinet.it | ||
10 | * | ||
11 | * Converted to Linux coding style | ||
12 | * Misc reorganization, polishing, restyling | ||
13 | * Roberto Ragusa, skystar2-c5b8 at robertoragusa dot it | ||
14 | * | ||
15 | * Added hardware filtering support, | ||
16 | * Niklas Peinecke, peinecke at gdv.uni-hannover.de | ||
17 | * | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or | ||
20 | * modify it under the terms of the GNU Lesser General Public License | ||
21 | * as published by the Free Software Foundation; either version 2.1 | ||
22 | * of the License, or (at your option) any later version. | ||
23 | * | ||
24 | * This program is distributed in the hope that it will be useful, | ||
25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
27 | * GNU General Public License for more details. | ||
28 | * | ||
29 | * You should have received a copy of the GNU Lesser General Public License | ||
30 | * along with this program; if not, write to the Free Software | ||
31 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
32 | */ | ||
33 | |||
34 | #include <linux/module.h> | ||
35 | #include <linux/moduleparam.h> | ||
36 | #include <linux/delay.h> | ||
37 | #include <linux/pci.h> | ||
38 | #include <linux/init.h> | ||
39 | #include <linux/version.h> | ||
40 | |||
41 | #include <asm/io.h> | ||
42 | |||
43 | #include "dvb_frontend.h" | ||
44 | |||
45 | #include <linux/dvb/frontend.h> | ||
46 | #include <linux/dvb/dmx.h> | ||
47 | #include "dvb_demux.h" | ||
48 | #include "dmxdev.h" | ||
49 | #include "dvb_filter.h" | ||
50 | #include "dvbdev.h" | ||
51 | #include "demux.h" | ||
52 | #include "dvb_net.h" | ||
53 | #include "stv0299.h" | ||
54 | #include "mt352.h" | ||
55 | #include "mt312.h" | ||
56 | #include "nxt2002.h" | ||
57 | |||
58 | static int debug; | ||
59 | static int enable_hw_filters = 2; | ||
60 | |||
61 | module_param(debug, int, 0644); | ||
62 | MODULE_PARM_DESC(debug, "Set debugging level (0 = default, 1 = most messages, 2 = all messages)."); | ||
63 | module_param(enable_hw_filters, int, 0444); | ||
64 | MODULE_PARM_DESC(enable_hw_filters, "enable hardware filters: supported values: 0 (none), 1, 2"); | ||
65 | |||
66 | #define dprintk(x...) do { if (debug>=1) printk(x); } while (0) | ||
67 | #define ddprintk(x...) do { if (debug>=2) printk(x); } while (0) | ||
68 | |||
69 | #define SIZE_OF_BUF_DMA1 0x3ac00 | ||
70 | #define SIZE_OF_BUF_DMA2 0x758 | ||
71 | |||
72 | #define MAX_N_HW_FILTERS (6+32) | ||
73 | #define N_PID_SLOTS 256 | ||
74 | |||
75 | struct dmaq { | ||
76 | u32 bus_addr; | ||
77 | u32 head; | ||
78 | u32 tail; | ||
79 | u32 buffer_size; | ||
80 | u8 *buffer; | ||
81 | }; | ||
82 | |||
83 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) | ||
84 | #define __iomem | ||
85 | #endif | ||
86 | |||
87 | struct adapter { | ||
88 | struct pci_dev *pdev; | ||
89 | |||
90 | u8 card_revision; | ||
91 | u32 b2c2_revision; | ||
92 | u32 pid_filter_max; | ||
93 | u32 mac_filter_max; | ||
94 | u32 irq; | ||
95 | void __iomem *io_mem; | ||
96 | unsigned long io_port; | ||
97 | u8 mac_addr[8]; | ||
98 | u32 dw_sram_type; | ||
99 | |||
100 | struct dvb_adapter dvb_adapter; | ||
101 | struct dvb_demux demux; | ||
102 | struct dmxdev dmxdev; | ||
103 | struct dmx_frontend hw_frontend; | ||
104 | struct dmx_frontend mem_frontend; | ||
105 | struct i2c_adapter i2c_adap; | ||
106 | struct dvb_net dvbnet; | ||
107 | |||
108 | struct semaphore i2c_sem; | ||
109 | |||
110 | struct dmaq dmaq1; | ||
111 | struct dmaq dmaq2; | ||
112 | |||
113 | u32 dma_ctrl; | ||
114 | u32 dma_status; | ||
115 | |||
116 | int capturing; | ||
117 | |||
118 | spinlock_t lock; | ||
119 | |||
120 | int useable_hw_filters; | ||
121 | u16 hw_pids[MAX_N_HW_FILTERS]; | ||
122 | u16 pid_list[N_PID_SLOTS]; | ||
123 | int pid_rc[N_PID_SLOTS]; // ref counters for the pids | ||
124 | int pid_count; | ||
125 | int whole_bandwidth_count; | ||
126 | u32 mac_filter; | ||
127 | |||
128 | struct dvb_frontend* fe; | ||
129 | int (*fe_sleep)(struct dvb_frontend* fe); | ||
130 | }; | ||
131 | |||
132 | #define write_reg_dw(adapter,reg,value) writel(value, adapter->io_mem + reg) | ||
133 | #define read_reg_dw(adapter,reg) readl(adapter->io_mem + reg) | ||
134 | |||
135 | static void write_reg_bitfield(struct adapter *adapter, u32 reg, u32 zeromask, u32 orvalue) | ||
136 | { | ||
137 | u32 tmp; | ||
138 | |||
139 | tmp = read_reg_dw(adapter, reg); | ||
140 | tmp = (tmp & ~zeromask) | orvalue; | ||
141 | write_reg_dw(adapter, reg, tmp); | ||
142 | } | ||
143 | |||
144 | /* i2c functions */ | ||
145 | static int i2c_main_write_for_flex2(struct adapter *adapter, u32 command, u8 *buf, int retries) | ||
146 | { | ||
147 | int i; | ||
148 | u32 value; | ||
149 | |||
150 | write_reg_dw(adapter, 0x100, 0); | ||
151 | write_reg_dw(adapter, 0x100, command); | ||
152 | |||
153 | for (i = 0; i < retries; i++) { | ||
154 | value = read_reg_dw(adapter, 0x100); | ||
155 | |||
156 | if ((value & 0x40000000) == 0) { | ||
157 | if ((value & 0x81000000) == 0x80000000) { | ||
158 | if (buf != 0) | ||
159 | *buf = (value >> 0x10) & 0xff; | ||
160 | |||
161 | return 1; | ||
162 | } | ||
163 | } else { | ||
164 | write_reg_dw(adapter, 0x100, 0); | ||
165 | write_reg_dw(adapter, 0x100, command); | ||
166 | } | ||
167 | } | ||
168 | |||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | /* device = 0x10000000 for tuner, 0x20000000 for eeprom */ | ||
173 | static void i2c_main_setup(u32 device, u32 chip_addr, u8 op, u8 addr, u32 value, u32 len, u32 *command) | ||
174 | { | ||
175 | *command = device | ((len - 1) << 26) | (value << 16) | (addr << 8) | chip_addr; | ||
176 | |||
177 | if (op != 0) | ||
178 | *command = *command | 0x03000000; | ||
179 | else | ||
180 | *command = *command | 0x01000000; | ||
181 | } | ||
182 | |||
183 | static int flex_i2c_read4(struct adapter *adapter, u32 device, u32 chip_addr, u16 addr, u8 *buf, u8 len) | ||
184 | { | ||
185 | u32 command; | ||
186 | u32 value; | ||
187 | |||
188 | int result, i; | ||
189 | |||
190 | i2c_main_setup(device, chip_addr, 1, addr, 0, len, &command); | ||
191 | |||
192 | result = i2c_main_write_for_flex2(adapter, command, buf, 100000); | ||
193 | |||
194 | if ((result & 0xff) != 0) { | ||
195 | if (len > 1) { | ||
196 | value = read_reg_dw(adapter, 0x104); | ||
197 | |||
198 | for (i = 1; i < len; i++) { | ||
199 | buf[i] = value & 0xff; | ||
200 | value = value >> 8; | ||
201 | } | ||
202 | } | ||
203 | } | ||
204 | |||
205 | return result; | ||
206 | } | ||
207 | |||
208 | static int flex_i2c_write4(struct adapter *adapter, u32 device, u32 chip_addr, u32 addr, u8 *buf, u8 len) | ||
209 | { | ||
210 | u32 command; | ||
211 | u32 value; | ||
212 | int i; | ||
213 | |||
214 | if (len > 1) { | ||
215 | value = 0; | ||
216 | |||
217 | for (i = len; i > 1; i--) { | ||
218 | value = value << 8; | ||
219 | value = value | buf[i - 1]; | ||
220 | } | ||
221 | |||
222 | write_reg_dw(adapter, 0x104, value); | ||
223 | } | ||
224 | |||
225 | i2c_main_setup(device, chip_addr, 0, addr, buf[0], len, &command); | ||
226 | |||
227 | return i2c_main_write_for_flex2(adapter, command, NULL, 100000); | ||
228 | } | ||
229 | |||
230 | static void fixchipaddr(u32 device, u32 bus, u32 addr, u32 *ret) | ||
231 | { | ||
232 | if (device == 0x20000000) | ||
233 | *ret = bus | ((addr >> 8) & 3); | ||
234 | else | ||
235 | *ret = bus; | ||
236 | } | ||
237 | |||
238 | static u32 flex_i2c_read(struct adapter *adapter, u32 device, u32 bus, u32 addr, u8 *buf, u32 len) | ||
239 | { | ||
240 | u32 chipaddr; | ||
241 | u32 bytes_to_transfer; | ||
242 | u8 *start; | ||
243 | |||
244 | ddprintk("%s:\n", __FUNCTION__); | ||
245 | |||
246 | start = buf; | ||
247 | |||
248 | while (len != 0) { | ||
249 | bytes_to_transfer = len; | ||
250 | |||
251 | if (bytes_to_transfer > 4) | ||
252 | bytes_to_transfer = 4; | ||
253 | |||
254 | fixchipaddr(device, bus, addr, &chipaddr); | ||
255 | |||
256 | if (flex_i2c_read4(adapter, device, chipaddr, addr, buf, bytes_to_transfer) == 0) | ||
257 | return buf - start; | ||
258 | |||
259 | buf = buf + bytes_to_transfer; | ||
260 | addr = addr + bytes_to_transfer; | ||
261 | len = len - bytes_to_transfer; | ||
262 | }; | ||
263 | |||
264 | return buf - start; | ||
265 | } | ||
266 | |||
267 | static u32 flex_i2c_write(struct adapter *adapter, u32 device, u32 bus, u32 addr, u8 *buf, u32 len) | ||
268 | { | ||
269 | u32 chipaddr; | ||
270 | u32 bytes_to_transfer; | ||
271 | u8 *start; | ||
272 | |||
273 | ddprintk("%s:\n", __FUNCTION__); | ||
274 | |||
275 | start = buf; | ||
276 | |||
277 | while (len != 0) { | ||
278 | bytes_to_transfer = len; | ||
279 | |||
280 | if (bytes_to_transfer > 4) | ||
281 | bytes_to_transfer = 4; | ||
282 | |||
283 | fixchipaddr(device, bus, addr, &chipaddr); | ||
284 | |||
285 | if (flex_i2c_write4(adapter, device, chipaddr, addr, buf, bytes_to_transfer) == 0) | ||
286 | return buf - start; | ||
287 | |||
288 | buf = buf + bytes_to_transfer; | ||
289 | addr = addr + bytes_to_transfer; | ||
290 | len = len - bytes_to_transfer; | ||
291 | } | ||
292 | |||
293 | return buf - start; | ||
294 | } | ||
295 | |||
296 | static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msgs, int num) | ||
297 | { | ||
298 | struct adapter *tmp = i2c_get_adapdata(adapter); | ||
299 | int i, ret = 0; | ||
300 | |||
301 | if (down_interruptible(&tmp->i2c_sem)) | ||
302 | return -ERESTARTSYS; | ||
303 | |||
304 | ddprintk("%s: %d messages to transfer\n", __FUNCTION__, num); | ||
305 | |||
306 | for (i = 0; i < num; i++) { | ||
307 | ddprintk("message %d: flags=0x%x, addr=0x%x, buf=0x%x, len=%d \n", i, | ||
308 | msgs[i].flags, msgs[i].addr, msgs[i].buf[0], msgs[i].len); | ||
309 | } | ||
310 | |||
311 | // read command | ||
312 | if ((num == 2) && (msgs[0].flags == 0) && (msgs[1].flags == I2C_M_RD) && (msgs[0].buf != NULL) && (msgs[1].buf != NULL)) { | ||
313 | |||
314 | ret = flex_i2c_read(tmp, 0x10000000, msgs[0].addr, msgs[0].buf[0], msgs[1].buf, msgs[1].len); | ||
315 | |||
316 | up(&tmp->i2c_sem); | ||
317 | |||
318 | if (ret != msgs[1].len) { | ||
319 | dprintk("%s: read error !\n", __FUNCTION__); | ||
320 | |||
321 | for (i = 0; i < 2; i++) { | ||
322 | dprintk("message %d: flags=0x%x, addr=0x%x, buf=0x%x, len=%d \n", i, | ||
323 | msgs[i].flags, msgs[i].addr, msgs[i].buf[0], msgs[i].len); | ||
324 | } | ||
325 | |||
326 | return -EREMOTEIO; | ||
327 | } | ||
328 | |||
329 | return num; | ||
330 | } | ||
331 | // write command | ||
332 | for (i = 0; i < num; i++) { | ||
333 | |||
334 | if ((msgs[i].flags != 0) || (msgs[i].buf == NULL) || (msgs[i].len < 2)) | ||
335 | return -EINVAL; | ||
336 | |||
337 | ret = flex_i2c_write(tmp, 0x10000000, msgs[i].addr, msgs[i].buf[0], &msgs[i].buf[1], msgs[i].len - 1); | ||
338 | |||
339 | up(&tmp->i2c_sem); | ||
340 | |||
341 | if (ret != msgs[0].len - 1) { | ||
342 | dprintk("%s: write error %i !\n", __FUNCTION__, ret); | ||
343 | |||
344 | dprintk("message %d: flags=0x%x, addr=0x%x, buf[0]=0x%x, len=%d \n", i, | ||
345 | msgs[i].flags, msgs[i].addr, msgs[i].buf[0], msgs[i].len); | ||
346 | |||
347 | return -EREMOTEIO; | ||
348 | } | ||
349 | |||
350 | return num; | ||
351 | } | ||
352 | |||
353 | printk("%s: unknown command format !\n", __FUNCTION__); | ||
354 | |||
355 | return -EINVAL; | ||
356 | } | ||
357 | |||
358 | /* SRAM (Skystar2 rev2.3 has one "ISSI IS61LV256" chip on board, | ||
359 | but it seems that FlexCopII can work with more than one chip) */ | ||
360 | static void sram_set_net_dest(struct adapter *adapter, u8 dest) | ||
361 | { | ||
362 | u32 tmp; | ||
363 | |||
364 | udelay(1000); | ||
365 | |||
366 | tmp = (read_reg_dw(adapter, 0x714) & 0xfffffffc) | (dest & 3); | ||
367 | |||
368 | udelay(1000); | ||
369 | |||
370 | write_reg_dw(adapter, 0x714, tmp); | ||
371 | write_reg_dw(adapter, 0x714, tmp); | ||
372 | |||
373 | udelay(1000); | ||
374 | |||
375 | /* return value is never used? */ | ||
376 | /* return tmp; */ | ||
377 | } | ||
378 | |||
379 | static void sram_set_cai_dest(struct adapter *adapter, u8 dest) | ||
380 | { | ||
381 | u32 tmp; | ||
382 | |||
383 | udelay(1000); | ||
384 | |||
385 | tmp = (read_reg_dw(adapter, 0x714) & 0xfffffff3) | ((dest & 3) << 2); | ||
386 | |||
387 | udelay(1000); | ||
388 | udelay(1000); | ||
389 | |||
390 | write_reg_dw(adapter, 0x714, tmp); | ||
391 | write_reg_dw(adapter, 0x714, tmp); | ||
392 | |||
393 | udelay(1000); | ||
394 | |||
395 | /* return value is never used? */ | ||
396 | /* return tmp; */ | ||
397 | } | ||
398 | |||
399 | static void sram_set_cao_dest(struct adapter *adapter, u8 dest) | ||
400 | { | ||
401 | u32 tmp; | ||
402 | |||
403 | udelay(1000); | ||
404 | |||
405 | tmp = (read_reg_dw(adapter, 0x714) & 0xffffffcf) | ((dest & 3) << 4); | ||
406 | |||
407 | udelay(1000); | ||
408 | udelay(1000); | ||
409 | |||
410 | write_reg_dw(adapter, 0x714, tmp); | ||
411 | write_reg_dw(adapter, 0x714, tmp); | ||
412 | |||
413 | udelay(1000); | ||
414 | |||
415 | /* return value is never used? */ | ||
416 | /* return tmp; */ | ||
417 | } | ||
418 | |||
419 | static void sram_set_media_dest(struct adapter *adapter, u8 dest) | ||
420 | { | ||
421 | u32 tmp; | ||
422 | |||
423 | udelay(1000); | ||
424 | |||
425 | tmp = (read_reg_dw(adapter, 0x714) & 0xffffff3f) | ((dest & 3) << 6); | ||
426 | |||
427 | udelay(1000); | ||
428 | udelay(1000); | ||
429 | |||
430 | write_reg_dw(adapter, 0x714, tmp); | ||
431 | write_reg_dw(adapter, 0x714, tmp); | ||
432 | |||
433 | udelay(1000); | ||
434 | |||
435 | /* return value is never used? */ | ||
436 | /* return tmp; */ | ||
437 | } | ||
438 | |||
439 | /* SRAM memory is accessed through a buffer register in the FlexCop | ||
440 | chip (0x700). This register has the following structure: | ||
441 | bits 0-14 : address | ||
442 | bit 15 : read/write flag | ||
443 | bits 16-23 : 8-bit word to write | ||
444 | bits 24-27 : = 4 | ||
445 | bits 28-29 : memory bank selector | ||
446 | bit 31 : busy flag | ||
447 | */ | ||
448 | static void flex_sram_write(struct adapter *adapter, u32 bank, u32 addr, u8 *buf, u32 len) | ||
449 | { | ||
450 | int i, retries; | ||
451 | u32 command; | ||
452 | |||
453 | for (i = 0; i < len; i++) { | ||
454 | command = bank | addr | 0x04000000 | (*buf << 0x10); | ||
455 | |||
456 | retries = 2; | ||
457 | |||
458 | while (((read_reg_dw(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) { | ||
459 | mdelay(1); | ||
460 | retries--; | ||
461 | }; | ||
462 | |||
463 | if (retries == 0) | ||
464 | printk("%s: SRAM timeout\n", __FUNCTION__); | ||
465 | |||
466 | write_reg_dw(adapter, 0x700, command); | ||
467 | |||
468 | buf++; | ||
469 | addr++; | ||
470 | } | ||
471 | } | ||
472 | |||
473 | static void flex_sram_read(struct adapter *adapter, u32 bank, u32 addr, u8 *buf, u32 len) | ||
474 | { | ||
475 | int i, retries; | ||
476 | u32 command, value; | ||
477 | |||
478 | for (i = 0; i < len; i++) { | ||
479 | command = bank | addr | 0x04008000; | ||
480 | |||
481 | retries = 10000; | ||
482 | |||
483 | while (((read_reg_dw(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) { | ||
484 | mdelay(1); | ||
485 | retries--; | ||
486 | }; | ||
487 | |||
488 | if (retries == 0) | ||
489 | printk("%s: SRAM timeout\n", __FUNCTION__); | ||
490 | |||
491 | write_reg_dw(adapter, 0x700, command); | ||
492 | |||
493 | retries = 10000; | ||
494 | |||
495 | while (((read_reg_dw(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) { | ||
496 | mdelay(1); | ||
497 | retries--; | ||
498 | }; | ||
499 | |||
500 | if (retries == 0) | ||
501 | printk("%s: SRAM timeout\n", __FUNCTION__); | ||
502 | |||
503 | value = read_reg_dw(adapter, 0x700) >> 0x10; | ||
504 | |||
505 | *buf = (value & 0xff); | ||
506 | |||
507 | addr++; | ||
508 | buf++; | ||
509 | } | ||
510 | } | ||
511 | |||
512 | static void sram_write_chunk(struct adapter *adapter, u32 addr, u8 *buf, u16 len) | ||
513 | { | ||
514 | u32 bank; | ||
515 | |||
516 | bank = 0; | ||
517 | |||
518 | if (adapter->dw_sram_type == 0x20000) { | ||
519 | bank = (addr & 0x18000) << 0x0d; | ||
520 | } | ||
521 | |||
522 | if (adapter->dw_sram_type == 0x00000) { | ||
523 | if ((addr >> 0x0f) == 0) | ||
524 | bank = 0x20000000; | ||
525 | else | ||
526 | bank = 0x10000000; | ||
527 | } | ||
528 | |||
529 | flex_sram_write(adapter, bank, addr & 0x7fff, buf, len); | ||
530 | } | ||
531 | |||
532 | static void sram_read_chunk(struct adapter *adapter, u32 addr, u8 *buf, u16 len) | ||
533 | { | ||
534 | u32 bank; | ||
535 | |||
536 | bank = 0; | ||
537 | |||
538 | if (adapter->dw_sram_type == 0x20000) { | ||
539 | bank = (addr & 0x18000) << 0x0d; | ||
540 | } | ||
541 | |||
542 | if (adapter->dw_sram_type == 0x00000) { | ||
543 | if ((addr >> 0x0f) == 0) | ||
544 | bank = 0x20000000; | ||
545 | else | ||
546 | bank = 0x10000000; | ||
547 | } | ||
548 | |||
549 | flex_sram_read(adapter, bank, addr & 0x7fff, buf, len); | ||
550 | } | ||
551 | |||
552 | static void sram_read(struct adapter *adapter, u32 addr, u8 *buf, u32 len) | ||
553 | { | ||
554 | u32 length; | ||
555 | |||
556 | while (len != 0) { | ||
557 | length = len; | ||
558 | |||
559 | // check if the address range belongs to the same | ||
560 | // 32K memory chip. If not, the data is read from | ||
561 | // one chip at a time. | ||
562 | if ((addr >> 0x0f) != ((addr + len - 1) >> 0x0f)) { | ||
563 | length = (((addr >> 0x0f) + 1) << 0x0f) - addr; | ||
564 | } | ||
565 | |||
566 | sram_read_chunk(adapter, addr, buf, length); | ||
567 | |||
568 | addr = addr + length; | ||
569 | buf = buf + length; | ||
570 | len = len - length; | ||
571 | } | ||
572 | } | ||
573 | |||
574 | static void sram_write(struct adapter *adapter, u32 addr, u8 *buf, u32 len) | ||
575 | { | ||
576 | u32 length; | ||
577 | |||
578 | while (len != 0) { | ||
579 | length = len; | ||
580 | |||
581 | // check if the address range belongs to the same | ||
582 | // 32K memory chip. If not, the data is written to | ||
583 | // one chip at a time. | ||
584 | if ((addr >> 0x0f) != ((addr + len - 1) >> 0x0f)) { | ||
585 | length = (((addr >> 0x0f) + 1) << 0x0f) - addr; | ||
586 | } | ||
587 | |||
588 | sram_write_chunk(adapter, addr, buf, length); | ||
589 | |||
590 | addr = addr + length; | ||
591 | buf = buf + length; | ||
592 | len = len - length; | ||
593 | } | ||
594 | } | ||
595 | |||
596 | static void sram_set_size(struct adapter *adapter, u32 mask) | ||
597 | { | ||
598 | write_reg_dw(adapter, 0x71c, (mask | (~0x30000 & read_reg_dw(adapter, 0x71c)))); | ||
599 | } | ||
600 | |||
601 | static void sram_init(struct adapter *adapter) | ||
602 | { | ||
603 | u32 tmp; | ||
604 | |||
605 | tmp = read_reg_dw(adapter, 0x71c); | ||
606 | |||
607 | write_reg_dw(adapter, 0x71c, 1); | ||
608 | |||
609 | if (read_reg_dw(adapter, 0x71c) != 0) { | ||
610 | write_reg_dw(adapter, 0x71c, tmp); | ||
611 | |||
612 | adapter->dw_sram_type = tmp & 0x30000; | ||
613 | |||
614 | ddprintk("%s: dw_sram_type = %x\n", __FUNCTION__, adapter->dw_sram_type); | ||
615 | |||
616 | } else { | ||
617 | |||
618 | adapter->dw_sram_type = 0x10000; | ||
619 | |||
620 | ddprintk("%s: dw_sram_type = %x\n", __FUNCTION__, adapter->dw_sram_type); | ||
621 | } | ||
622 | |||
623 | /* return value is never used? */ | ||
624 | /* return adapter->dw_sram_type; */ | ||
625 | } | ||
626 | |||
627 | static int sram_test_location(struct adapter *adapter, u32 mask, u32 addr) | ||
628 | { | ||
629 | u8 tmp1, tmp2; | ||
630 | |||
631 | dprintk("%s: mask = %x, addr = %x\n", __FUNCTION__, mask, addr); | ||
632 | |||
633 | sram_set_size(adapter, mask); | ||
634 | sram_init(adapter); | ||
635 | |||
636 | tmp2 = 0xa5; | ||
637 | tmp1 = 0x4f; | ||
638 | |||
639 | sram_write(adapter, addr, &tmp2, 1); | ||
640 | sram_write(adapter, addr + 4, &tmp1, 1); | ||
641 | |||
642 | tmp2 = 0; | ||
643 | |||
644 | mdelay(20); | ||
645 | |||
646 | sram_read(adapter, addr, &tmp2, 1); | ||
647 | sram_read(adapter, addr, &tmp2, 1); | ||
648 | |||
649 | dprintk("%s: wrote 0xa5, read 0x%2x\n", __FUNCTION__, tmp2); | ||
650 | |||
651 | if (tmp2 != 0xa5) | ||
652 | return 0; | ||
653 | |||
654 | tmp2 = 0x5a; | ||
655 | tmp1 = 0xf4; | ||
656 | |||
657 | sram_write(adapter, addr, &tmp2, 1); | ||
658 | sram_write(adapter, addr + 4, &tmp1, 1); | ||
659 | |||
660 | tmp2 = 0; | ||
661 | |||
662 | mdelay(20); | ||
663 | |||
664 | sram_read(adapter, addr, &tmp2, 1); | ||
665 | sram_read(adapter, addr, &tmp2, 1); | ||
666 | |||
667 | dprintk("%s: wrote 0x5a, read 0x%2x\n", __FUNCTION__, tmp2); | ||
668 | |||
669 | if (tmp2 != 0x5a) | ||
670 | return 0; | ||
671 | |||
672 | return 1; | ||
673 | } | ||
674 | |||
675 | static u32 sram_length(struct adapter *adapter) | ||
676 | { | ||
677 | if (adapter->dw_sram_type == 0x10000) | ||
678 | return 32768; // 32K | ||
679 | if (adapter->dw_sram_type == 0x00000) | ||
680 | return 65536; // 64K | ||
681 | if (adapter->dw_sram_type == 0x20000) | ||
682 | return 131072; // 128K | ||
683 | |||
684 | return 32768; // 32K | ||
685 | } | ||
686 | |||
687 | /* FlexcopII can work with 32K, 64K or 128K of external SRAM memory. | ||
688 | - for 128K there are 4x32K chips at bank 0,1,2,3. | ||
689 | - for 64K there are 2x32K chips at bank 1,2. | ||
690 | - for 32K there is one 32K chip at bank 0. | ||
691 | |||
692 | FlexCop works only with one bank at a time. The bank is selected | ||
693 | by bits 28-29 of the 0x700 register. | ||
694 | |||
695 | bank 0 covers addresses 0x00000-0x07fff | ||
696 | bank 1 covers addresses 0x08000-0x0ffff | ||
697 | bank 2 covers addresses 0x10000-0x17fff | ||
698 | bank 3 covers addresses 0x18000-0x1ffff | ||
699 | */ | ||
700 | static int sram_detect_for_flex2(struct adapter *adapter) | ||
701 | { | ||
702 | u32 tmp, tmp2, tmp3; | ||
703 | |||
704 | dprintk("%s:\n", __FUNCTION__); | ||
705 | |||
706 | tmp = read_reg_dw(adapter, 0x208); | ||
707 | write_reg_dw(adapter, 0x208, 0); | ||
708 | |||
709 | tmp2 = read_reg_dw(adapter, 0x71c); | ||
710 | |||
711 | dprintk("%s: tmp2 = %x\n", __FUNCTION__, tmp2); | ||
712 | |||
713 | write_reg_dw(adapter, 0x71c, 1); | ||
714 | |||
715 | tmp3 = read_reg_dw(adapter, 0x71c); | ||
716 | |||
717 | dprintk("%s: tmp3 = %x\n", __FUNCTION__, tmp3); | ||
718 | |||
719 | write_reg_dw(adapter, 0x71c, tmp2); | ||
720 | |||
721 | // check for internal SRAM ??? | ||
722 | tmp3--; | ||
723 | if (tmp3 != 0) { | ||
724 | sram_set_size(adapter, 0x10000); | ||
725 | sram_init(adapter); | ||
726 | write_reg_dw(adapter, 0x208, tmp); | ||
727 | |||
728 | dprintk("%s: sram size = 32K\n", __FUNCTION__); | ||
729 | |||
730 | return 32; | ||
731 | } | ||
732 | |||
733 | if (sram_test_location(adapter, 0x20000, 0x18000) != 0) { | ||
734 | sram_set_size(adapter, 0x20000); | ||
735 | sram_init(adapter); | ||
736 | write_reg_dw(adapter, 0x208, tmp); | ||
737 | |||
738 | dprintk("%s: sram size = 128K\n", __FUNCTION__); | ||
739 | |||
740 | return 128; | ||
741 | } | ||
742 | |||
743 | if (sram_test_location(adapter, 0x00000, 0x10000) != 0) { | ||
744 | sram_set_size(adapter, 0x00000); | ||
745 | sram_init(adapter); | ||
746 | write_reg_dw(adapter, 0x208, tmp); | ||
747 | |||
748 | dprintk("%s: sram size = 64K\n", __FUNCTION__); | ||
749 | |||
750 | return 64; | ||
751 | } | ||
752 | |||
753 | if (sram_test_location(adapter, 0x10000, 0x00000) != 0) { | ||
754 | sram_set_size(adapter, 0x10000); | ||
755 | sram_init(adapter); | ||
756 | write_reg_dw(adapter, 0x208, tmp); | ||
757 | |||
758 | dprintk("%s: sram size = 32K\n", __FUNCTION__); | ||
759 | |||
760 | return 32; | ||
761 | } | ||
762 | |||
763 | sram_set_size(adapter, 0x10000); | ||
764 | sram_init(adapter); | ||
765 | write_reg_dw(adapter, 0x208, tmp); | ||
766 | |||
767 | dprintk("%s: SRAM detection failed. Set to 32K \n", __FUNCTION__); | ||
768 | |||
769 | return 0; | ||
770 | } | ||
771 | |||
772 | static void sll_detect_sram_size(struct adapter *adapter) | ||
773 | { | ||
774 | sram_detect_for_flex2(adapter); | ||
775 | } | ||
776 | |||
777 | /* EEPROM (Skystar2 has one "24LC08B" chip on board) */ | ||
778 | /* | ||
779 | static int eeprom_write(struct adapter *adapter, u16 addr, u8 *buf, u16 len) | ||
780 | { | ||
781 | return flex_i2c_write(adapter, 0x20000000, 0x50, addr, buf, len); | ||
782 | } | ||
783 | */ | ||
784 | |||
785 | static int eeprom_read(struct adapter *adapter, u16 addr, u8 *buf, u16 len) | ||
786 | { | ||
787 | return flex_i2c_read(adapter, 0x20000000, 0x50, addr, buf, len); | ||
788 | } | ||
789 | |||
790 | static u8 calc_lrc(u8 *buf, int len) | ||
791 | { | ||
792 | int i; | ||
793 | u8 sum; | ||
794 | |||
795 | sum = 0; | ||
796 | |||
797 | for (i = 0; i < len; i++) | ||
798 | sum = sum ^ buf[i]; | ||
799 | |||
800 | return sum; | ||
801 | } | ||
802 | |||
803 | static int eeprom_lrc_read(struct adapter *adapter, u32 addr, u32 len, u8 *buf, int retries) | ||
804 | { | ||
805 | int i; | ||
806 | |||
807 | for (i = 0; i < retries; i++) { | ||
808 | if (eeprom_read(adapter, addr, buf, len) == len) { | ||
809 | if (calc_lrc(buf, len - 1) == buf[len - 1]) | ||
810 | return 1; | ||
811 | } | ||
812 | } | ||
813 | |||
814 | return 0; | ||
815 | } | ||
816 | |||
817 | /* | ||
818 | static int eeprom_lrc_write(struct adapter *adapter, u32 addr, u32 len, u8 *wbuf, u8 *rbuf, int retries) | ||
819 | { | ||
820 | int i; | ||
821 | |||
822 | for (i = 0; i < retries; i++) { | ||
823 | if (eeprom_write(adapter, addr, wbuf, len) == len) { | ||
824 | if (eeprom_lrc_read(adapter, addr, len, rbuf, retries) == 1) | ||
825 | return 1; | ||
826 | } | ||
827 | } | ||
828 | |||
829 | return 0; | ||
830 | } | ||
831 | */ | ||
832 | |||
833 | |||
834 | /* These functions could be used to unlock SkyStar2 cards. */ | ||
835 | |||
836 | /* | ||
837 | static int eeprom_writeKey(struct adapter *adapter, u8 *key, u32 len) | ||
838 | { | ||
839 | u8 rbuf[20]; | ||
840 | u8 wbuf[20]; | ||
841 | |||
842 | if (len != 16) | ||
843 | return 0; | ||
844 | |||
845 | memcpy(wbuf, key, len); | ||
846 | |||
847 | wbuf[16] = 0; | ||
848 | wbuf[17] = 0; | ||
849 | wbuf[18] = 0; | ||
850 | wbuf[19] = calc_lrc(wbuf, 19); | ||
851 | |||
852 | return eeprom_lrc_write(adapter, 0x3e4, 20, wbuf, rbuf, 4); | ||
853 | } | ||
854 | |||
855 | static int eeprom_readKey(struct adapter *adapter, u8 *key, u32 len) | ||
856 | { | ||
857 | u8 buf[20]; | ||
858 | |||
859 | if (len != 16) | ||
860 | return 0; | ||
861 | |||
862 | if (eeprom_lrc_read(adapter, 0x3e4, 20, buf, 4) == 0) | ||
863 | return 0; | ||
864 | |||
865 | memcpy(key, buf, len); | ||
866 | |||
867 | return 1; | ||
868 | } | ||
869 | */ | ||
870 | |||
871 | static int eeprom_get_mac_addr(struct adapter *adapter, char type, u8 *mac) | ||
872 | { | ||
873 | u8 tmp[8]; | ||
874 | |||
875 | if (eeprom_lrc_read(adapter, 0x3f8, 8, tmp, 4) != 0) { | ||
876 | if (type != 0) { | ||
877 | mac[0] = tmp[0]; | ||
878 | mac[1] = tmp[1]; | ||
879 | mac[2] = tmp[2]; | ||
880 | mac[3] = 0xfe; | ||
881 | mac[4] = 0xff; | ||
882 | mac[5] = tmp[3]; | ||
883 | mac[6] = tmp[4]; | ||
884 | mac[7] = tmp[5]; | ||
885 | |||
886 | } else { | ||
887 | |||
888 | mac[0] = tmp[0]; | ||
889 | mac[1] = tmp[1]; | ||
890 | mac[2] = tmp[2]; | ||
891 | mac[3] = tmp[3]; | ||
892 | mac[4] = tmp[4]; | ||
893 | mac[5] = tmp[5]; | ||
894 | } | ||
895 | |||
896 | return 1; | ||
897 | |||
898 | } else { | ||
899 | |||
900 | if (type == 0) { | ||
901 | memset(mac, 0, 6); | ||
902 | |||
903 | } else { | ||
904 | |||
905 | memset(mac, 0, 8); | ||
906 | } | ||
907 | |||
908 | return 0; | ||
909 | } | ||
910 | } | ||
911 | |||
912 | /* | ||
913 | static char eeprom_set_mac_addr(struct adapter *adapter, char type, u8 *mac) | ||
914 | { | ||
915 | u8 tmp[8]; | ||
916 | |||
917 | if (type != 0) { | ||
918 | tmp[0] = mac[0]; | ||
919 | tmp[1] = mac[1]; | ||
920 | tmp[2] = mac[2]; | ||
921 | tmp[3] = mac[5]; | ||
922 | tmp[4] = mac[6]; | ||
923 | tmp[5] = mac[7]; | ||
924 | |||
925 | } else { | ||
926 | |||
927 | tmp[0] = mac[0]; | ||
928 | tmp[1] = mac[1]; | ||
929 | tmp[2] = mac[2]; | ||
930 | tmp[3] = mac[3]; | ||
931 | tmp[4] = mac[4]; | ||
932 | tmp[5] = mac[5]; | ||
933 | } | ||
934 | |||
935 | tmp[6] = 0; | ||
936 | tmp[7] = calc_lrc(tmp, 7); | ||
937 | |||
938 | if (eeprom_write(adapter, 0x3f8, tmp, 8) == 8) | ||
939 | return 1; | ||
940 | |||
941 | return 0; | ||
942 | } | ||
943 | */ | ||
944 | |||
945 | /* PID filter */ | ||
946 | |||
947 | /* every flexcop has 6 "lower" hw PID filters */ | ||
948 | /* these are enabled by setting bits 0-5 of 0x208 */ | ||
949 | /* for the 32 additional filters we have to select one */ | ||
950 | /* of them through 0x310 and modify through 0x314 */ | ||
951 | /* op: 0=disable, 1=enable */ | ||
952 | static void filter_enable_hw_filter(struct adapter *adapter, int id, u8 op) | ||
953 | { | ||
954 | dprintk("%s: id=%d op=%d\n", __FUNCTION__, id, op); | ||
955 | if (id <= 5) { | ||
956 | u32 mask = (0x00000001 << id); | ||
957 | write_reg_bitfield(adapter, 0x208, mask, op ? mask : 0); | ||
958 | } else { | ||
959 | /* select */ | ||
960 | write_reg_bitfield(adapter, 0x310, 0x1f, (id - 6) & 0x1f); | ||
961 | /* modify */ | ||
962 | write_reg_bitfield(adapter, 0x314, 0x00006000, op ? 0x00004000 : 0); | ||
963 | } | ||
964 | } | ||
965 | |||
966 | /* this sets the PID that should pass the specified filter */ | ||
967 | static void pid_set_hw_pid(struct adapter *adapter, int id, u16 pid) | ||
968 | { | ||
969 | dprintk("%s: id=%d pid=%d\n", __FUNCTION__, id, pid); | ||
970 | if (id <= 5) { | ||
971 | u32 adr = 0x300 + ((id & 6) << 1); | ||
972 | int shift = (id & 1) ? 16 : 0; | ||
973 | dprintk("%s: id=%d addr=%x %c pid=%d\n", __FUNCTION__, id, adr, (id & 1) ? 'h' : 'l', pid); | ||
974 | write_reg_bitfield(adapter, adr, (0x7fff) << shift, (pid & 0x1fff) << shift); | ||
975 | } else { | ||
976 | /* select */ | ||
977 | write_reg_bitfield(adapter, 0x310, 0x1f, (id - 6) & 0x1f); | ||
978 | /* modify */ | ||
979 | write_reg_bitfield(adapter, 0x314, 0x1fff, pid & 0x1fff); | ||
980 | } | ||
981 | } | ||
982 | |||
983 | |||
984 | /* | ||
985 | static void filter_enable_null_filter(struct adapter *adapter, u32 op) | ||
986 | { | ||
987 | dprintk("%s: op=%x\n", __FUNCTION__, op); | ||
988 | |||
989 | write_reg_bitfield(adapter, 0x208, 0x00000040, op?0x00000040:0); | ||
990 | } | ||
991 | */ | ||
992 | |||
993 | static void filter_enable_mask_filter(struct adapter *adapter, u32 op) | ||
994 | { | ||
995 | dprintk("%s: op=%x\n", __FUNCTION__, op); | ||
996 | |||
997 | write_reg_bitfield(adapter, 0x208, 0x00000080, op ? 0x00000080 : 0); | ||
998 | } | ||
999 | |||
1000 | |||
1001 | static void ctrl_enable_mac(struct adapter *adapter, u32 op) | ||
1002 | { | ||
1003 | write_reg_bitfield(adapter, 0x208, 0x00004000, op ? 0x00004000 : 0); | ||
1004 | } | ||
1005 | |||
1006 | static int ca_set_mac_dst_addr_filter(struct adapter *adapter, u8 *mac) | ||
1007 | { | ||
1008 | u32 tmp1, tmp2; | ||
1009 | |||
1010 | tmp1 = (mac[3] << 0x18) | (mac[2] << 0x10) | (mac[1] << 0x08) | mac[0]; | ||
1011 | tmp2 = (mac[5] << 0x08) | mac[4]; | ||
1012 | |||
1013 | write_reg_dw(adapter, 0x418, tmp1); | ||
1014 | write_reg_dw(adapter, 0x41c, tmp2); | ||
1015 | |||
1016 | return 0; | ||
1017 | } | ||
1018 | |||
1019 | /* | ||
1020 | static void set_ignore_mac_filter(struct adapter *adapter, u8 op) | ||
1021 | { | ||
1022 | if (op != 0) { | ||
1023 | write_reg_bitfield(adapter, 0x208, 0x00004000, 0); | ||
1024 | adapter->mac_filter = 1; | ||
1025 | } else { | ||
1026 | if (adapter->mac_filter != 0) { | ||
1027 | adapter->mac_filter = 0; | ||
1028 | write_reg_bitfield(adapter, 0x208, 0x00004000, 0x00004000); | ||
1029 | } | ||
1030 | } | ||
1031 | } | ||
1032 | */ | ||
1033 | |||
1034 | /* | ||
1035 | static void check_null_filter_enable(struct adapter *adapter) | ||
1036 | { | ||
1037 | filter_enable_null_filter(adapter, 1); | ||
1038 | filter_enable_mask_filter(adapter, 1); | ||
1039 | } | ||
1040 | */ | ||
1041 | |||
1042 | static void pid_set_group_pid(struct adapter *adapter, u16 pid) | ||
1043 | { | ||
1044 | u32 value; | ||
1045 | |||
1046 | dprintk("%s: pid=%x\n", __FUNCTION__, pid); | ||
1047 | value = (pid & 0x3fff) | (read_reg_dw(adapter, 0x30c) & 0xffff0000); | ||
1048 | write_reg_dw(adapter, 0x30c, value); | ||
1049 | } | ||
1050 | |||
1051 | static void pid_set_group_mask(struct adapter *adapter, u16 pid) | ||
1052 | { | ||
1053 | u32 value; | ||
1054 | |||
1055 | dprintk("%s: pid=%x\n", __FUNCTION__, pid); | ||
1056 | value = ((pid & 0x3fff) << 0x10) | (read_reg_dw(adapter, 0x30c) & 0xffff); | ||
1057 | write_reg_dw(adapter, 0x30c, value); | ||
1058 | } | ||
1059 | |||
1060 | /* | ||
1061 | static int pid_get_group_pid(struct adapter *adapter) | ||
1062 | { | ||
1063 | return read_reg_dw(adapter, 0x30c) & 0x00001fff; | ||
1064 | } | ||
1065 | |||
1066 | static int pid_get_group_mask(struct adapter *adapter) | ||
1067 | { | ||
1068 | return (read_reg_dw(adapter, 0x30c) >> 0x10)& 0x00001fff; | ||
1069 | } | ||
1070 | */ | ||
1071 | |||
1072 | /* | ||
1073 | static void reset_hardware_pid_filter(struct adapter *adapter) | ||
1074 | { | ||
1075 | pid_set_stream1_pid(adapter, 0x1fff); | ||
1076 | |||
1077 | pid_set_stream2_pid(adapter, 0x1fff); | ||
1078 | filter_enable_stream2_filter(adapter, 0); | ||
1079 | |||
1080 | pid_set_pcr_pid(adapter, 0x1fff); | ||
1081 | filter_enable_pcr_filter(adapter, 0); | ||
1082 | |||
1083 | pid_set_pmt_pid(adapter, 0x1fff); | ||
1084 | filter_enable_pmt_filter(adapter, 0); | ||
1085 | |||
1086 | pid_set_ecm_pid(adapter, 0x1fff); | ||
1087 | filter_enable_ecm_filter(adapter, 0); | ||
1088 | |||
1089 | pid_set_emm_pid(adapter, 0x1fff); | ||
1090 | filter_enable_emm_filter(adapter, 0); | ||
1091 | } | ||
1092 | */ | ||
1093 | |||
1094 | static void init_pids(struct adapter *adapter) | ||
1095 | { | ||
1096 | int i; | ||
1097 | |||
1098 | adapter->pid_count = 0; | ||
1099 | adapter->whole_bandwidth_count = 0; | ||
1100 | for (i = 0; i < adapter->useable_hw_filters; i++) { | ||
1101 | dprintk("%s: setting filter %d to 0x1fff\n", __FUNCTION__, i); | ||
1102 | adapter->hw_pids[i] = 0x1fff; | ||
1103 | pid_set_hw_pid(adapter, i, 0x1fff); | ||
1104 | } | ||
1105 | |||
1106 | pid_set_group_pid(adapter, 0); | ||
1107 | pid_set_group_mask(adapter, 0x1fe0); | ||
1108 | } | ||
1109 | |||
1110 | static void open_whole_bandwidth(struct adapter *adapter) | ||
1111 | { | ||
1112 | dprintk("%s:\n", __FUNCTION__); | ||
1113 | pid_set_group_pid(adapter, 0); | ||
1114 | pid_set_group_mask(adapter, 0); | ||
1115 | /* | ||
1116 | filter_enable_mask_filter(adapter, 1); | ||
1117 | */ | ||
1118 | } | ||
1119 | |||
1120 | static void close_whole_bandwidth(struct adapter *adapter) | ||
1121 | { | ||
1122 | dprintk("%s:\n", __FUNCTION__); | ||
1123 | pid_set_group_pid(adapter, 0); | ||
1124 | pid_set_group_mask(adapter, 0x1fe0); | ||
1125 | /* | ||
1126 | filter_enable_mask_filter(adapter, 1); | ||
1127 | */ | ||
1128 | } | ||
1129 | |||
1130 | static void whole_bandwidth_inc(struct adapter *adapter) | ||
1131 | { | ||
1132 | if (adapter->whole_bandwidth_count++ == 0) | ||
1133 | open_whole_bandwidth(adapter); | ||
1134 | } | ||
1135 | |||
1136 | static void whole_bandwidth_dec(struct adapter *adapter) | ||
1137 | { | ||
1138 | if (--adapter->whole_bandwidth_count <= 0) | ||
1139 | close_whole_bandwidth(adapter); | ||
1140 | } | ||
1141 | |||
1142 | /* The specified PID has to be let through the | ||
1143 | hw filters. | ||
1144 | We try to allocate an hardware filter and open whole | ||
1145 | bandwidth when allocation is impossible. | ||
1146 | All pids<=0x1f pass through the group filter. | ||
1147 | Returns 1 on success, -1 on error */ | ||
1148 | static int add_hw_pid(struct adapter *adapter, u16 pid) | ||
1149 | { | ||
1150 | int i; | ||
1151 | |||
1152 | dprintk("%s: pid=%d\n", __FUNCTION__, pid); | ||
1153 | |||
1154 | if (pid <= 0x1f) | ||
1155 | return 1; | ||
1156 | |||
1157 | /* we can't use a filter for 0x2000, so no search */ | ||
1158 | if (pid != 0x2000) { | ||
1159 | /* find an unused hardware filter */ | ||
1160 | for (i = 0; i < adapter->useable_hw_filters; i++) { | ||
1161 | dprintk("%s: pid=%d searching slot=%d\n", __FUNCTION__, pid, i); | ||
1162 | if (adapter->hw_pids[i] == 0x1fff) { | ||
1163 | dprintk("%s: pid=%d slot=%d\n", __FUNCTION__, pid, i); | ||
1164 | adapter->hw_pids[i] = pid; | ||
1165 | pid_set_hw_pid(adapter, i, pid); | ||
1166 | filter_enable_hw_filter(adapter, i, 1); | ||
1167 | return 1; | ||
1168 | } | ||
1169 | } | ||
1170 | } | ||
1171 | /* if we have not used a filter, this pid depends on whole bandwidth */ | ||
1172 | dprintk("%s: pid=%d whole_bandwidth\n", __FUNCTION__, pid); | ||
1173 | whole_bandwidth_inc(adapter); | ||
1174 | return 1; | ||
1175 | } | ||
1176 | |||
1177 | /* returns -1 if the pid was not present in the filters */ | ||
1178 | static int remove_hw_pid(struct adapter *adapter, u16 pid) | ||
1179 | { | ||
1180 | int i; | ||
1181 | |||
1182 | dprintk("%s: pid=%d\n", __FUNCTION__, pid); | ||
1183 | |||
1184 | if (pid <= 0x1f) | ||
1185 | return 1; | ||
1186 | |||
1187 | /* we can't use a filter for 0x2000, so no search */ | ||
1188 | if (pid != 0x2000) { | ||
1189 | for (i = 0; i < adapter->useable_hw_filters; i++) { | ||
1190 | dprintk("%s: pid=%d searching slot=%d\n", __FUNCTION__, pid, i); | ||
1191 | if (adapter->hw_pids[i] == pid) { // find the pid slot | ||
1192 | dprintk("%s: pid=%d slot=%d\n", __FUNCTION__, pid, i); | ||
1193 | adapter->hw_pids[i] = 0x1fff; | ||
1194 | pid_set_hw_pid(adapter, i, 0x1fff); | ||
1195 | filter_enable_hw_filter(adapter, i, 0); | ||
1196 | return 1; | ||
1197 | } | ||
1198 | } | ||
1199 | } | ||
1200 | /* if we have not used a filter, this pid depended on whole bandwith */ | ||
1201 | dprintk("%s: pid=%d whole_bandwidth\n", __FUNCTION__, pid); | ||
1202 | whole_bandwidth_dec(adapter); | ||
1203 | return 1; | ||
1204 | } | ||
1205 | |||
1206 | /* Adds a PID to the filters. | ||
1207 | Adding a pid more than once is possible, we keep reference counts. | ||
1208 | Whole stream available through pid==0x2000. | ||
1209 | Returns 1 on success, -1 on error */ | ||
1210 | static int add_pid(struct adapter *adapter, u16 pid) | ||
1211 | { | ||
1212 | int i; | ||
1213 | |||
1214 | dprintk("%s: pid=%d\n", __FUNCTION__, pid); | ||
1215 | |||
1216 | if (pid > 0x1ffe && pid != 0x2000) | ||
1217 | return -1; | ||
1218 | |||
1219 | // check if the pid is already present | ||
1220 | for (i = 0; i < adapter->pid_count; i++) | ||
1221 | if (adapter->pid_list[i] == pid) { | ||
1222 | adapter->pid_rc[i]++; // increment ref counter | ||
1223 | return 1; | ||
1224 | } | ||
1225 | |||
1226 | if (adapter->pid_count == N_PID_SLOTS) | ||
1227 | return -1; // no more pids can be added | ||
1228 | adapter->pid_list[adapter->pid_count] = pid; // register pid | ||
1229 | adapter->pid_rc[adapter->pid_count] = 1; | ||
1230 | adapter->pid_count++; | ||
1231 | // hardware setting | ||
1232 | add_hw_pid(adapter, pid); | ||
1233 | |||
1234 | return 1; | ||
1235 | } | ||
1236 | |||
1237 | /* Removes a PID from the filters. */ | ||
1238 | static int remove_pid(struct adapter *adapter, u16 pid) | ||
1239 | { | ||
1240 | int i; | ||
1241 | |||
1242 | dprintk("%s: pid=%d\n", __FUNCTION__, pid); | ||
1243 | |||
1244 | if (pid > 0x1ffe && pid != 0x2000) | ||
1245 | return -1; | ||
1246 | |||
1247 | // check if the pid is present (it must be!) | ||
1248 | for (i = 0; i < adapter->pid_count; i++) { | ||
1249 | if (adapter->pid_list[i] == pid) { | ||
1250 | adapter->pid_rc[i]--; | ||
1251 | if (adapter->pid_rc[i] <= 0) { | ||
1252 | // remove from the list | ||
1253 | adapter->pid_count--; | ||
1254 | adapter->pid_list[i]=adapter->pid_list[adapter->pid_count]; | ||
1255 | adapter->pid_rc[i] = adapter->pid_rc[adapter->pid_count]; | ||
1256 | // hardware setting | ||
1257 | remove_hw_pid(adapter, pid); | ||
1258 | } | ||
1259 | return 1; | ||
1260 | } | ||
1261 | } | ||
1262 | |||
1263 | return -1; | ||
1264 | } | ||
1265 | |||
1266 | |||
1267 | /* dma & irq */ | ||
1268 | static void ctrl_enable_smc(struct adapter *adapter, u32 op) | ||
1269 | { | ||
1270 | write_reg_bitfield(adapter, 0x208, 0x00000800, op ? 0x00000800 : 0); | ||
1271 | } | ||
1272 | |||
1273 | static void dma_enable_disable_irq(struct adapter *adapter, u32 flag1, u32 flag2, u32 flag3) | ||
1274 | { | ||
1275 | adapter->dma_ctrl = adapter->dma_ctrl & 0x000f0000; | ||
1276 | |||
1277 | if (flag1 == 0) { | ||
1278 | if (flag2 == 0) | ||
1279 | adapter->dma_ctrl = adapter->dma_ctrl & ~0x00010000; | ||
1280 | else | ||
1281 | adapter->dma_ctrl = adapter->dma_ctrl | 0x00010000; | ||
1282 | |||
1283 | if (flag3 == 0) | ||
1284 | adapter->dma_ctrl = adapter->dma_ctrl & ~0x00020000; | ||
1285 | else | ||
1286 | adapter->dma_ctrl = adapter->dma_ctrl | 0x00020000; | ||
1287 | |||
1288 | } else { | ||
1289 | |||
1290 | if (flag2 == 0) | ||
1291 | adapter->dma_ctrl = adapter->dma_ctrl & ~0x00040000; | ||
1292 | else | ||
1293 | adapter->dma_ctrl = adapter->dma_ctrl | 0x00040000; | ||
1294 | |||
1295 | if (flag3 == 0) | ||
1296 | adapter->dma_ctrl = adapter->dma_ctrl & ~0x00080000; | ||
1297 | else | ||
1298 | adapter->dma_ctrl = adapter->dma_ctrl | 0x00080000; | ||
1299 | } | ||
1300 | } | ||
1301 | |||
1302 | static void irq_dma_enable_disable_irq(struct adapter *adapter, u32 op) | ||
1303 | { | ||
1304 | u32 value; | ||
1305 | |||
1306 | value = read_reg_dw(adapter, 0x208) & 0xfff0ffff; | ||
1307 | |||
1308 | if (op != 0) | ||
1309 | value = value | (adapter->dma_ctrl & 0x000f0000); | ||
1310 | |||
1311 | write_reg_dw(adapter, 0x208, value); | ||
1312 | } | ||
1313 | |||
1314 | /* FlexCopII has 2 dma channels. DMA1 is used to transfer TS data to | ||
1315 | system memory. | ||
1316 | |||
1317 | The DMA1 buffer is divided in 2 subbuffers of equal size. | ||
1318 | FlexCopII will transfer TS data to one subbuffer, signal an interrupt | ||
1319 | when the subbuffer is full and continue fillig the second subbuffer. | ||
1320 | |||
1321 | For DMA1: | ||
1322 | subbuffer size in 32-bit words is stored in the first 24 bits of | ||
1323 | register 0x004. The last 8 bits of register 0x004 contain the number | ||
1324 | of subbuffers. | ||
1325 | |||
1326 | the first 30 bits of register 0x000 contain the address of the first | ||
1327 | subbuffer. The last 2 bits contain 0, when dma1 is disabled and 1, | ||
1328 | when dma1 is enabled. | ||
1329 | |||
1330 | the first 30 bits of register 0x00c contain the address of the second | ||
1331 | subbuffer. the last 2 bits contain 1. | ||
1332 | |||
1333 | register 0x008 will contain the address of the subbuffer that was filled | ||
1334 | with TS data, when FlexCopII will generate an interrupt. | ||
1335 | |||
1336 | For DMA2: | ||
1337 | subbuffer size in 32-bit words is stored in the first 24 bits of | ||
1338 | register 0x014. The last 8 bits of register 0x014 contain the number | ||
1339 | of subbuffers. | ||
1340 | |||
1341 | the first 30 bits of register 0x010 contain the address of the first | ||
1342 | subbuffer. The last 2 bits contain 0, when dma1 is disabled and 1, | ||
1343 | when dma1 is enabled. | ||
1344 | |||
1345 | the first 30 bits of register 0x01c contain the address of the second | ||
1346 | subbuffer. the last 2 bits contain 1. | ||
1347 | |||
1348 | register 0x018 contains the address of the subbuffer that was filled | ||
1349 | with TS data, when FlexCopII generates an interrupt. | ||
1350 | */ | ||
1351 | static int dma_init_dma(struct adapter *adapter, u32 dma_channel) | ||
1352 | { | ||
1353 | u32 subbuffers, subbufsize, subbuf0, subbuf1; | ||
1354 | |||
1355 | if (dma_channel == 0) { | ||
1356 | dprintk("%s: Initializing DMA1 channel\n", __FUNCTION__); | ||
1357 | |||
1358 | subbuffers = 2; | ||
1359 | |||
1360 | subbufsize = (((adapter->dmaq1.buffer_size / 2) / 4) << 8) | subbuffers; | ||
1361 | |||
1362 | subbuf0 = adapter->dmaq1.bus_addr & 0xfffffffc; | ||
1363 | |||
1364 | subbuf1 = ((adapter->dmaq1.bus_addr + adapter->dmaq1.buffer_size / 2) & 0xfffffffc) | 1; | ||
1365 | |||
1366 | dprintk("%s: first subbuffer address = 0x%x\n", __FUNCTION__, subbuf0); | ||
1367 | udelay(1000); | ||
1368 | write_reg_dw(adapter, 0x000, subbuf0); | ||
1369 | |||
1370 | dprintk("%s: subbuffer size = 0x%x\n", __FUNCTION__, (subbufsize >> 8) * 4); | ||
1371 | udelay(1000); | ||
1372 | write_reg_dw(adapter, 0x004, subbufsize); | ||
1373 | |||
1374 | dprintk("%s: second subbuffer address = 0x%x\n", __FUNCTION__, subbuf1); | ||
1375 | udelay(1000); | ||
1376 | write_reg_dw(adapter, 0x00c, subbuf1); | ||
1377 | |||
1378 | dprintk("%s: counter = 0x%x\n", __FUNCTION__, adapter->dmaq1.bus_addr & 0xfffffffc); | ||
1379 | write_reg_dw(adapter, 0x008, adapter->dmaq1.bus_addr & 0xfffffffc); | ||
1380 | udelay(1000); | ||
1381 | |||
1382 | dma_enable_disable_irq(adapter, 0, 1, subbuffers ? 1 : 0); | ||
1383 | |||
1384 | irq_dma_enable_disable_irq(adapter, 1); | ||
1385 | |||
1386 | sram_set_media_dest(adapter, 1); | ||
1387 | sram_set_net_dest(adapter, 1); | ||
1388 | sram_set_cai_dest(adapter, 2); | ||
1389 | sram_set_cao_dest(adapter, 2); | ||
1390 | } | ||
1391 | |||
1392 | if (dma_channel == 1) { | ||
1393 | dprintk("%s: Initializing DMA2 channel\n", __FUNCTION__); | ||
1394 | |||
1395 | subbuffers = 2; | ||
1396 | |||
1397 | subbufsize = (((adapter->dmaq2.buffer_size / 2) / 4) << 8) | subbuffers; | ||
1398 | |||
1399 | subbuf0 = adapter->dmaq2.bus_addr & 0xfffffffc; | ||
1400 | |||
1401 | subbuf1 = ((adapter->dmaq2.bus_addr + adapter->dmaq2.buffer_size / 2) & 0xfffffffc) | 1; | ||
1402 | |||
1403 | dprintk("%s: first subbuffer address = 0x%x\n", __FUNCTION__, subbuf0); | ||
1404 | udelay(1000); | ||
1405 | write_reg_dw(adapter, 0x010, subbuf0); | ||
1406 | |||
1407 | dprintk("%s: subbuffer size = 0x%x\n", __FUNCTION__, (subbufsize >> 8) * 4); | ||
1408 | udelay(1000); | ||
1409 | write_reg_dw(adapter, 0x014, subbufsize); | ||
1410 | |||
1411 | dprintk("%s: second buffer address = 0x%x\n", __FUNCTION__, subbuf1); | ||
1412 | udelay(1000); | ||
1413 | write_reg_dw(adapter, 0x01c, subbuf1); | ||
1414 | |||
1415 | sram_set_cai_dest(adapter, 2); | ||
1416 | } | ||
1417 | |||
1418 | return 0; | ||
1419 | } | ||
1420 | |||
1421 | static void ctrl_enable_receive_data(struct adapter *adapter, u32 op) | ||
1422 | { | ||
1423 | if (op == 0) { | ||
1424 | write_reg_bitfield(adapter, 0x208, 0x00008000, 0); | ||
1425 | adapter->dma_status = adapter->dma_status & ~0x00000004; | ||
1426 | } else { | ||
1427 | write_reg_bitfield(adapter, 0x208, 0x00008000, 0x00008000); | ||
1428 | adapter->dma_status = adapter->dma_status | 0x00000004; | ||
1429 | } | ||
1430 | } | ||
1431 | |||
1432 | /* bit 0 of dma_mask is set to 1 if dma1 channel has to be enabled/disabled | ||
1433 | bit 1 of dma_mask is set to 1 if dma2 channel has to be enabled/disabled | ||
1434 | */ | ||
1435 | static void dma_start_stop(struct adapter *adapter, u32 dma_mask, int start_stop) | ||
1436 | { | ||
1437 | u32 dma_enable, dma1_enable, dma2_enable; | ||
1438 | |||
1439 | dprintk("%s: dma_mask=%x\n", __FUNCTION__, dma_mask); | ||
1440 | |||
1441 | if (start_stop == 1) { | ||
1442 | dprintk("%s: starting dma\n", __FUNCTION__); | ||
1443 | |||
1444 | dma1_enable = 0; | ||
1445 | dma2_enable = 0; | ||
1446 | |||
1447 | if (((dma_mask & 1) != 0) && ((adapter->dma_status & 1) == 0) && (adapter->dmaq1.bus_addr != 0)) { | ||
1448 | adapter->dma_status = adapter->dma_status | 1; | ||
1449 | dma1_enable = 1; | ||
1450 | } | ||
1451 | |||
1452 | if (((dma_mask & 2) != 0) && ((adapter->dma_status & 2) == 0) && (adapter->dmaq2.bus_addr != 0)) { | ||
1453 | adapter->dma_status = adapter->dma_status | 2; | ||
1454 | dma2_enable = 1; | ||
1455 | } | ||
1456 | // enable dma1 and dma2 | ||
1457 | if ((dma1_enable == 1) && (dma2_enable == 1)) { | ||
1458 | write_reg_dw(adapter, 0x000, adapter->dmaq1.bus_addr | 1); | ||
1459 | write_reg_dw(adapter, 0x00c, (adapter->dmaq1.bus_addr + adapter->dmaq1.buffer_size / 2) | 1); | ||
1460 | write_reg_dw(adapter, 0x010, adapter->dmaq2.bus_addr | 1); | ||
1461 | |||
1462 | ctrl_enable_receive_data(adapter, 1); | ||
1463 | |||
1464 | return; | ||
1465 | } | ||
1466 | // enable dma1 | ||
1467 | if ((dma1_enable == 1) && (dma2_enable == 0)) { | ||
1468 | write_reg_dw(adapter, 0x000, adapter->dmaq1.bus_addr | 1); | ||
1469 | write_reg_dw(adapter, 0x00c, (adapter->dmaq1.bus_addr + adapter->dmaq1.buffer_size / 2) | 1); | ||
1470 | |||
1471 | ctrl_enable_receive_data(adapter, 1); | ||
1472 | |||
1473 | return; | ||
1474 | } | ||
1475 | // enable dma2 | ||
1476 | if ((dma1_enable == 0) && (dma2_enable == 1)) { | ||
1477 | write_reg_dw(adapter, 0x010, adapter->dmaq2.bus_addr | 1); | ||
1478 | |||
1479 | ctrl_enable_receive_data(adapter, 1); | ||
1480 | |||
1481 | return; | ||
1482 | } | ||
1483 | // start dma | ||
1484 | if ((dma1_enable == 0) && (dma2_enable == 0)) { | ||
1485 | ctrl_enable_receive_data(adapter, 1); | ||
1486 | |||
1487 | return; | ||
1488 | } | ||
1489 | |||
1490 | } else { | ||
1491 | |||
1492 | dprintk("%s: stopping dma\n", __FUNCTION__); | ||
1493 | |||
1494 | dma_enable = adapter->dma_status & 0x00000003; | ||
1495 | |||
1496 | if (((dma_mask & 1) != 0) && ((adapter->dma_status & 1) != 0)) { | ||
1497 | dma_enable = dma_enable & 0xfffffffe; | ||
1498 | } | ||
1499 | |||
1500 | if (((dma_mask & 2) != 0) && ((adapter->dma_status & 2) != 0)) { | ||
1501 | dma_enable = dma_enable & 0xfffffffd; | ||
1502 | } | ||
1503 | //stop dma | ||
1504 | if ((dma_enable == 0) && ((adapter->dma_status & 4) != 0)) { | ||
1505 | ctrl_enable_receive_data(adapter, 0); | ||
1506 | |||
1507 | udelay(3000); | ||
1508 | } | ||
1509 | //disable dma1 | ||
1510 | if (((dma_mask & 1) != 0) && ((adapter->dma_status & 1) != 0) && (adapter->dmaq1.bus_addr != 0)) { | ||
1511 | write_reg_dw(adapter, 0x000, adapter->dmaq1.bus_addr); | ||
1512 | write_reg_dw(adapter, 0x00c, (adapter->dmaq1.bus_addr + adapter->dmaq1.buffer_size / 2) | 1); | ||
1513 | |||
1514 | adapter->dma_status = adapter->dma_status & ~0x00000001; | ||
1515 | } | ||
1516 | //disable dma2 | ||
1517 | if (((dma_mask & 2) != 0) && ((adapter->dma_status & 2) != 0) && (adapter->dmaq2.bus_addr != 0)) { | ||
1518 | write_reg_dw(adapter, 0x010, adapter->dmaq2.bus_addr); | ||
1519 | |||
1520 | adapter->dma_status = adapter->dma_status & ~0x00000002; | ||
1521 | } | ||
1522 | } | ||
1523 | } | ||
1524 | |||
1525 | static void open_stream(struct adapter *adapter, u16 pid) | ||
1526 | { | ||
1527 | u32 dma_mask; | ||
1528 | |||
1529 | ++adapter->capturing; | ||
1530 | |||
1531 | filter_enable_mask_filter(adapter, 1); | ||
1532 | |||
1533 | add_pid(adapter, pid); | ||
1534 | |||
1535 | dprintk("%s: adapter->dma_status=%x\n", __FUNCTION__, adapter->dma_status); | ||
1536 | |||
1537 | if ((adapter->dma_status & 7) != 7) { | ||
1538 | dma_mask = 0; | ||
1539 | |||
1540 | if (((adapter->dma_status & 0x10000000) != 0) && ((adapter->dma_status & 1) == 0)) { | ||
1541 | dma_mask = dma_mask | 1; | ||
1542 | |||
1543 | adapter->dmaq1.head = 0; | ||
1544 | adapter->dmaq1.tail = 0; | ||
1545 | |||
1546 | memset(adapter->dmaq1.buffer, 0, adapter->dmaq1.buffer_size); | ||
1547 | } | ||
1548 | |||
1549 | if (((adapter->dma_status & 0x20000000) != 0) && ((adapter->dma_status & 2) == 0)) { | ||
1550 | dma_mask = dma_mask | 2; | ||
1551 | |||
1552 | adapter->dmaq2.head = 0; | ||
1553 | adapter->dmaq2.tail = 0; | ||
1554 | } | ||
1555 | |||
1556 | if (dma_mask != 0) { | ||
1557 | irq_dma_enable_disable_irq(adapter, 1); | ||
1558 | |||
1559 | dma_start_stop(adapter, dma_mask, 1); | ||
1560 | } | ||
1561 | } | ||
1562 | } | ||
1563 | |||
1564 | static void close_stream(struct adapter *adapter, u16 pid) | ||
1565 | { | ||
1566 | if (adapter->capturing > 0) | ||
1567 | --adapter->capturing; | ||
1568 | |||
1569 | dprintk("%s: dma_status=%x\n", __FUNCTION__, adapter->dma_status); | ||
1570 | |||
1571 | if (adapter->capturing == 0) { | ||
1572 | u32 dma_mask = 0; | ||
1573 | |||
1574 | if ((adapter->dma_status & 1) != 0) | ||
1575 | dma_mask = dma_mask | 0x00000001; | ||
1576 | if ((adapter->dma_status & 2) != 0) | ||
1577 | dma_mask = dma_mask | 0x00000002; | ||
1578 | |||
1579 | if (dma_mask != 0) { | ||
1580 | dma_start_stop(adapter, dma_mask, 0); | ||
1581 | } | ||
1582 | } | ||
1583 | remove_pid(adapter, pid); | ||
1584 | } | ||
1585 | |||
1586 | static void interrupt_service_dma1(struct adapter *adapter) | ||
1587 | { | ||
1588 | struct dvb_demux *dvbdmx = &adapter->demux; | ||
1589 | |||
1590 | int n_cur_dma_counter; | ||
1591 | u32 n_num_bytes_parsed; | ||
1592 | u32 n_num_new_bytes_transferred; | ||
1593 | u32 dw_default_packet_size = 188; | ||
1594 | u8 gb_tmp_buffer[188]; | ||
1595 | u8 *pb_dma_buf_cur_pos; | ||
1596 | |||
1597 | n_cur_dma_counter = readl(adapter->io_mem + 0x008) - adapter->dmaq1.bus_addr; | ||
1598 | n_cur_dma_counter = (n_cur_dma_counter / dw_default_packet_size) * dw_default_packet_size; | ||
1599 | |||
1600 | if ((n_cur_dma_counter < 0) || (n_cur_dma_counter > adapter->dmaq1.buffer_size)) { | ||
1601 | dprintk("%s: dma counter outside dma buffer\n", __FUNCTION__); | ||
1602 | return; | ||
1603 | } | ||
1604 | |||
1605 | adapter->dmaq1.head = n_cur_dma_counter; | ||
1606 | |||
1607 | if (adapter->dmaq1.tail <= n_cur_dma_counter) { | ||
1608 | n_num_new_bytes_transferred = n_cur_dma_counter - adapter->dmaq1.tail; | ||
1609 | |||
1610 | } else { | ||
1611 | |||
1612 | n_num_new_bytes_transferred = (adapter->dmaq1.buffer_size - adapter->dmaq1.tail) + n_cur_dma_counter; | ||
1613 | } | ||
1614 | |||
1615 | ddprintk("%s: n_cur_dma_counter = %d\n", __FUNCTION__, n_cur_dma_counter); | ||
1616 | ddprintk("%s: dmaq1.tail = %d\n", __FUNCTION__, adapter->dmaq1.tail); | ||
1617 | ddprintk("%s: bytes_transferred = %d\n", __FUNCTION__, n_num_new_bytes_transferred); | ||
1618 | |||
1619 | if (n_num_new_bytes_transferred < dw_default_packet_size) | ||
1620 | return; | ||
1621 | |||
1622 | n_num_bytes_parsed = 0; | ||
1623 | |||
1624 | while (n_num_bytes_parsed < n_num_new_bytes_transferred) { | ||
1625 | pb_dma_buf_cur_pos = adapter->dmaq1.buffer + adapter->dmaq1.tail; | ||
1626 | |||
1627 | if (adapter->dmaq1.buffer + adapter->dmaq1.buffer_size < adapter->dmaq1.buffer + adapter->dmaq1.tail + 188) { | ||
1628 | memcpy(gb_tmp_buffer, adapter->dmaq1.buffer + adapter->dmaq1.tail, | ||
1629 | adapter->dmaq1.buffer_size - adapter->dmaq1.tail); | ||
1630 | memcpy(gb_tmp_buffer + (adapter->dmaq1.buffer_size - adapter->dmaq1.tail), adapter->dmaq1.buffer, | ||
1631 | (188 - (adapter->dmaq1.buffer_size - adapter->dmaq1.tail))); | ||
1632 | |||
1633 | pb_dma_buf_cur_pos = gb_tmp_buffer; | ||
1634 | } | ||
1635 | |||
1636 | if (adapter->capturing != 0) { | ||
1637 | dvb_dmx_swfilter_packets(dvbdmx, pb_dma_buf_cur_pos, dw_default_packet_size / 188); | ||
1638 | } | ||
1639 | |||
1640 | n_num_bytes_parsed = n_num_bytes_parsed + dw_default_packet_size; | ||
1641 | |||
1642 | adapter->dmaq1.tail = adapter->dmaq1.tail + dw_default_packet_size; | ||
1643 | |||
1644 | if (adapter->dmaq1.tail >= adapter->dmaq1.buffer_size) | ||
1645 | adapter->dmaq1.tail = adapter->dmaq1.tail - adapter->dmaq1.buffer_size; | ||
1646 | }; | ||
1647 | } | ||
1648 | |||
1649 | static void interrupt_service_dma2(struct adapter *adapter) | ||
1650 | { | ||
1651 | printk("%s:\n", __FUNCTION__); | ||
1652 | } | ||
1653 | |||
1654 | static irqreturn_t isr(int irq, void *dev_id, struct pt_regs *regs) | ||
1655 | { | ||
1656 | struct adapter *tmp = dev_id; | ||
1657 | |||
1658 | u32 value; | ||
1659 | |||
1660 | ddprintk("%s:\n", __FUNCTION__); | ||
1661 | |||
1662 | spin_lock_irq(&tmp->lock); | ||
1663 | |||
1664 | if (0 == ((value = read_reg_dw(tmp, 0x20c)) & 0x0f)) { | ||
1665 | spin_unlock_irq(&tmp->lock); | ||
1666 | return IRQ_NONE; | ||
1667 | } | ||
1668 | |||
1669 | while (value != 0) { | ||
1670 | if ((value & 0x03) != 0) | ||
1671 | interrupt_service_dma1(tmp); | ||
1672 | if ((value & 0x0c) != 0) | ||
1673 | interrupt_service_dma2(tmp); | ||
1674 | value = read_reg_dw(tmp, 0x20c) & 0x0f; | ||
1675 | } | ||
1676 | |||
1677 | spin_unlock_irq(&tmp->lock); | ||
1678 | return IRQ_HANDLED; | ||
1679 | } | ||
1680 | |||
1681 | static int init_dma_queue_one(struct adapter *adapter, struct dmaq *dmaq, | ||
1682 | int size, int dmaq_offset) | ||
1683 | { | ||
1684 | struct pci_dev *pdev = adapter->pdev; | ||
1685 | dma_addr_t dma_addr; | ||
1686 | |||
1687 | dmaq->head = 0; | ||
1688 | dmaq->tail = 0; | ||
1689 | |||
1690 | dmaq->buffer = pci_alloc_consistent(pdev, size + 0x80, &dma_addr); | ||
1691 | if (!dmaq->buffer) | ||
1692 | return -ENOMEM; | ||
1693 | |||
1694 | dmaq->bus_addr = dma_addr; | ||
1695 | dmaq->buffer_size = size; | ||
1696 | |||
1697 | dma_init_dma(adapter, dmaq_offset); | ||
1698 | |||
1699 | ddprintk("%s: allocated dma buffer at 0x%p, length=%d\n", | ||
1700 | __FUNCTION__, dmaq->buffer, size); | ||
1701 | |||
1702 | return 0; | ||
1703 | } | ||
1704 | |||
1705 | static int init_dma_queue(struct adapter *adapter) | ||
1706 | { | ||
1707 | struct { | ||
1708 | struct dmaq *dmaq; | ||
1709 | u32 dma_status; | ||
1710 | int size; | ||
1711 | } dmaq_desc[] = { | ||
1712 | { &adapter->dmaq1, 0x10000000, SIZE_OF_BUF_DMA1 }, | ||
1713 | { &adapter->dmaq2, 0x20000000, SIZE_OF_BUF_DMA2 } | ||
1714 | }, *p = dmaq_desc; | ||
1715 | int i; | ||
1716 | |||
1717 | for (i = 0; i < 2; i++, p++) { | ||
1718 | if (init_dma_queue_one(adapter, p->dmaq, p->size, i) < 0) | ||
1719 | adapter->dma_status &= ~p->dma_status; | ||
1720 | else | ||
1721 | adapter->dma_status |= p->dma_status; | ||
1722 | } | ||
1723 | return (adapter->dma_status & 0x30000000) ? 0 : -ENOMEM; | ||
1724 | } | ||
1725 | |||
1726 | static void free_dma_queue_one(struct adapter *adapter, struct dmaq *dmaq) | ||
1727 | { | ||
1728 | if (dmaq->buffer) { | ||
1729 | pci_free_consistent(adapter->pdev, dmaq->buffer_size + 0x80, | ||
1730 | dmaq->buffer, dmaq->bus_addr); | ||
1731 | memset(dmaq, 0, sizeof(*dmaq)); | ||
1732 | } | ||
1733 | } | ||
1734 | |||
1735 | static void free_dma_queue(struct adapter *adapter) | ||
1736 | { | ||
1737 | struct dmaq *dmaq[] = { | ||
1738 | &adapter->dmaq1, | ||
1739 | &adapter->dmaq2, | ||
1740 | NULL | ||
1741 | }, **p; | ||
1742 | |||
1743 | for (p = dmaq; *p; p++) | ||
1744 | free_dma_queue_one(adapter, *p); | ||
1745 | } | ||
1746 | |||
1747 | static void release_adapter(struct adapter *adapter) | ||
1748 | { | ||
1749 | struct pci_dev *pdev = adapter->pdev; | ||
1750 | |||
1751 | iounmap(adapter->io_mem); | ||
1752 | pci_disable_device(pdev); | ||
1753 | pci_release_region(pdev, 0); | ||
1754 | pci_release_region(pdev, 1); | ||
1755 | } | ||
1756 | |||
1757 | static void free_adapter_object(struct adapter *adapter) | ||
1758 | { | ||
1759 | dprintk("%s:\n", __FUNCTION__); | ||
1760 | |||
1761 | close_stream(adapter, 0); | ||
1762 | free_irq(adapter->irq, adapter); | ||
1763 | free_dma_queue(adapter); | ||
1764 | release_adapter(adapter); | ||
1765 | kfree(adapter); | ||
1766 | } | ||
1767 | |||
1768 | static struct pci_driver skystar2_pci_driver; | ||
1769 | |||
1770 | static int claim_adapter(struct adapter *adapter) | ||
1771 | { | ||
1772 | struct pci_dev *pdev = adapter->pdev; | ||
1773 | u16 var; | ||
1774 | int ret; | ||
1775 | |||
1776 | ret = pci_request_region(pdev, 1, skystar2_pci_driver.name); | ||
1777 | if (ret < 0) | ||
1778 | goto out; | ||
1779 | |||
1780 | ret = pci_request_region(pdev, 0, skystar2_pci_driver.name); | ||
1781 | if (ret < 0) | ||
1782 | goto err_pci_release_1; | ||
1783 | |||
1784 | pci_read_config_byte(pdev, PCI_CLASS_REVISION, &adapter->card_revision); | ||
1785 | |||
1786 | dprintk("%s: card revision %x \n", __FUNCTION__, adapter->card_revision); | ||
1787 | |||
1788 | ret = pci_enable_device(pdev); | ||
1789 | if (ret < 0) | ||
1790 | goto err_pci_release_0; | ||
1791 | |||
1792 | pci_read_config_word(pdev, 4, &var); | ||
1793 | |||
1794 | if ((var & 4) == 0) | ||
1795 | pci_set_master(pdev); | ||
1796 | |||
1797 | adapter->io_port = pdev->resource[1].start; | ||
1798 | |||
1799 | adapter->io_mem = ioremap(pdev->resource[0].start, 0x800); | ||
1800 | |||
1801 | if (!adapter->io_mem) { | ||
1802 | dprintk("%s: can not map io memory\n", __FUNCTION__); | ||
1803 | ret = -EIO; | ||
1804 | goto err_pci_disable; | ||
1805 | } | ||
1806 | |||
1807 | dprintk("%s: io memory maped at %p\n", __FUNCTION__, adapter->io_mem); | ||
1808 | |||
1809 | ret = 1; | ||
1810 | out: | ||
1811 | return ret; | ||
1812 | |||
1813 | err_pci_disable: | ||
1814 | pci_disable_device(pdev); | ||
1815 | err_pci_release_0: | ||
1816 | pci_release_region(pdev, 0); | ||
1817 | err_pci_release_1: | ||
1818 | pci_release_region(pdev, 1); | ||
1819 | goto out; | ||
1820 | } | ||
1821 | |||
1822 | /* | ||
1823 | static int sll_reset_flexcop(struct adapter *adapter) | ||
1824 | { | ||
1825 | write_reg_dw(adapter, 0x208, 0); | ||
1826 | write_reg_dw(adapter, 0x210, 0xb2ff); | ||
1827 | |||
1828 | return 0; | ||
1829 | } | ||
1830 | */ | ||
1831 | |||
1832 | static void decide_how_many_hw_filters(struct adapter *adapter) | ||
1833 | { | ||
1834 | int hw_filters; | ||
1835 | int mod_option_hw_filters; | ||
1836 | |||
1837 | // FlexCop IIb & III have 6+32 hw filters | ||
1838 | // FlexCop II has 6 hw filters, every other should have at least 6 | ||
1839 | switch (adapter->b2c2_revision) { | ||
1840 | case 0x82: /* II */ | ||
1841 | hw_filters = 6; | ||
1842 | break; | ||
1843 | case 0xc3: /* IIB */ | ||
1844 | hw_filters = 6 + 32; | ||
1845 | break; | ||
1846 | case 0xc0: /* III */ | ||
1847 | hw_filters = 6 + 32; | ||
1848 | break; | ||
1849 | default: | ||
1850 | hw_filters = 6; | ||
1851 | break; | ||
1852 | } | ||
1853 | printk("%s: the chip has %i hardware filters", __FILE__, hw_filters); | ||
1854 | |||
1855 | mod_option_hw_filters = 0; | ||
1856 | if (enable_hw_filters >= 1) | ||
1857 | mod_option_hw_filters += 6; | ||
1858 | if (enable_hw_filters >= 2) | ||
1859 | mod_option_hw_filters += 32; | ||
1860 | |||
1861 | if (mod_option_hw_filters >= hw_filters) { | ||
1862 | adapter->useable_hw_filters = hw_filters; | ||
1863 | } else { | ||
1864 | adapter->useable_hw_filters = mod_option_hw_filters; | ||
1865 | printk(", but only %d will be used because of module option", mod_option_hw_filters); | ||
1866 | } | ||
1867 | printk("\n"); | ||
1868 | dprintk("%s: useable_hardware_filters set to %i\n", __FILE__, adapter->useable_hw_filters); | ||
1869 | } | ||
1870 | |||
1871 | static int driver_initialize(struct pci_dev *pdev) | ||
1872 | { | ||
1873 | struct adapter *adapter; | ||
1874 | u32 tmp; | ||
1875 | int ret = -ENOMEM; | ||
1876 | |||
1877 | adapter = kmalloc(sizeof(struct adapter), GFP_KERNEL); | ||
1878 | if (!adapter) { | ||
1879 | dprintk("%s: out of memory!\n", __FUNCTION__); | ||
1880 | goto out; | ||
1881 | } | ||
1882 | |||
1883 | memset(adapter, 0, sizeof(struct adapter)); | ||
1884 | |||
1885 | pci_set_drvdata(pdev,adapter); | ||
1886 | |||
1887 | adapter->pdev = pdev; | ||
1888 | adapter->irq = pdev->irq; | ||
1889 | |||
1890 | ret = claim_adapter(adapter); | ||
1891 | if (ret < 0) | ||
1892 | goto err_kfree; | ||
1893 | |||
1894 | irq_dma_enable_disable_irq(adapter, 0); | ||
1895 | |||
1896 | ret = request_irq(pdev->irq, isr, 0x4000000, "Skystar2", adapter); | ||
1897 | if (ret < 0) { | ||
1898 | dprintk("%s: unable to allocate irq=%d !\n", __FUNCTION__, pdev->irq); | ||
1899 | goto err_release_adapter; | ||
1900 | } | ||
1901 | |||
1902 | read_reg_dw(adapter, 0x208); | ||
1903 | write_reg_dw(adapter, 0x208, 0); | ||
1904 | write_reg_dw(adapter, 0x210, 0xb2ff); | ||
1905 | write_reg_dw(adapter, 0x208, 0x40); | ||
1906 | |||
1907 | ret = init_dma_queue(adapter); | ||
1908 | if (ret < 0) | ||
1909 | goto err_free_irq; | ||
1910 | |||
1911 | adapter->b2c2_revision = (read_reg_dw(adapter, 0x204) >> 0x18); | ||
1912 | |||
1913 | switch (adapter->b2c2_revision) { | ||
1914 | case 0x82: | ||
1915 | printk("%s: FlexCopII(rev.130) chip found\n", __FILE__); | ||
1916 | break; | ||
1917 | case 0xc3: | ||
1918 | printk("%s: FlexCopIIB(rev.195) chip found\n", __FILE__); | ||
1919 | break; | ||
1920 | case 0xc0: | ||
1921 | printk("%s: FlexCopIII(rev.192) chip found\n", __FILE__); | ||
1922 | break; | ||
1923 | default: | ||
1924 | printk("%s: The revision of the FlexCop chip on your card is %d\n", __FILE__, adapter->b2c2_revision); | ||
1925 | printk("%s: This driver works only with FlexCopII(rev.130), FlexCopIIB(rev.195) and FlexCopIII(rev.192).\n", __FILE__); | ||
1926 | ret = -ENODEV; | ||
1927 | goto err_free_dma_queue; | ||
1928 | } | ||
1929 | |||
1930 | decide_how_many_hw_filters(adapter); | ||
1931 | |||
1932 | init_pids(adapter); | ||
1933 | |||
1934 | tmp = read_reg_dw(adapter, 0x204); | ||
1935 | |||
1936 | write_reg_dw(adapter, 0x204, 0); | ||
1937 | mdelay(20); | ||
1938 | |||
1939 | write_reg_dw(adapter, 0x204, tmp); | ||
1940 | mdelay(10); | ||
1941 | |||
1942 | tmp = read_reg_dw(adapter, 0x308); | ||
1943 | write_reg_dw(adapter, 0x308, 0x4000 | tmp); | ||
1944 | |||
1945 | adapter->dw_sram_type = 0x10000; | ||
1946 | |||
1947 | sll_detect_sram_size(adapter); | ||
1948 | |||
1949 | dprintk("%s sram length = %d, sram type= %x\n", __FUNCTION__, sram_length(adapter), adapter->dw_sram_type); | ||
1950 | |||
1951 | sram_set_media_dest(adapter, 1); | ||
1952 | sram_set_net_dest(adapter, 1); | ||
1953 | |||
1954 | ctrl_enable_smc(adapter, 0); | ||
1955 | |||
1956 | sram_set_cai_dest(adapter, 2); | ||
1957 | sram_set_cao_dest(adapter, 2); | ||
1958 | |||
1959 | dma_enable_disable_irq(adapter, 1, 0, 0); | ||
1960 | |||
1961 | if (eeprom_get_mac_addr(adapter, 0, adapter->mac_addr) != 0) { | ||
1962 | printk("%s MAC address = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x \n", __FUNCTION__, adapter->mac_addr[0], | ||
1963 | adapter->mac_addr[1], adapter->mac_addr[2], adapter->mac_addr[3], adapter->mac_addr[4], adapter->mac_addr[5], | ||
1964 | adapter->mac_addr[6], adapter->mac_addr[7] | ||
1965 | ); | ||
1966 | |||
1967 | ca_set_mac_dst_addr_filter(adapter, adapter->mac_addr); | ||
1968 | ctrl_enable_mac(adapter, 1); | ||
1969 | } | ||
1970 | |||
1971 | spin_lock_init(&adapter->lock); | ||
1972 | |||
1973 | out: | ||
1974 | return ret; | ||
1975 | |||
1976 | err_free_dma_queue: | ||
1977 | free_dma_queue(adapter); | ||
1978 | err_free_irq: | ||
1979 | free_irq(pdev->irq, adapter); | ||
1980 | err_release_adapter: | ||
1981 | release_adapter(adapter); | ||
1982 | err_kfree: | ||
1983 | pci_set_drvdata(pdev, NULL); | ||
1984 | kfree(adapter); | ||
1985 | goto out; | ||
1986 | } | ||
1987 | |||
1988 | static void driver_halt(struct pci_dev *pdev) | ||
1989 | { | ||
1990 | struct adapter *adapter = pci_get_drvdata(pdev); | ||
1991 | |||
1992 | irq_dma_enable_disable_irq(adapter, 0); | ||
1993 | |||
1994 | ctrl_enable_receive_data(adapter, 0); | ||
1995 | |||
1996 | free_adapter_object(adapter); | ||
1997 | |||
1998 | pci_set_drvdata(pdev, NULL); | ||
1999 | } | ||
2000 | |||
2001 | static int dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed) | ||
2002 | { | ||
2003 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; | ||
2004 | struct adapter *adapter = (struct adapter *) dvbdmx->priv; | ||
2005 | |||
2006 | dprintk("%s: PID=%d, type=%d\n", __FUNCTION__, dvbdmxfeed->pid, dvbdmxfeed->type); | ||
2007 | |||
2008 | open_stream(adapter, dvbdmxfeed->pid); | ||
2009 | |||
2010 | return 0; | ||
2011 | } | ||
2012 | |||
2013 | static int dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | ||
2014 | { | ||
2015 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; | ||
2016 | struct adapter *adapter = (struct adapter *) dvbdmx->priv; | ||
2017 | |||
2018 | dprintk("%s: PID=%d, type=%d\n", __FUNCTION__, dvbdmxfeed->pid, dvbdmxfeed->type); | ||
2019 | |||
2020 | close_stream(adapter, dvbdmxfeed->pid); | ||
2021 | |||
2022 | return 0; | ||
2023 | } | ||
2024 | |||
2025 | /* lnb control */ | ||
2026 | static void set_tuner_tone(struct adapter *adapter, u8 tone) | ||
2027 | { | ||
2028 | u16 wz_half_period_for_45_mhz[] = { 0x01ff, 0x0154, 0x00ff, 0x00cc }; | ||
2029 | u16 ax; | ||
2030 | |||
2031 | dprintk("%s: %u\n", __FUNCTION__, tone); | ||
2032 | |||
2033 | switch (tone) { | ||
2034 | case 1: | ||
2035 | ax = wz_half_period_for_45_mhz[0]; | ||
2036 | break; | ||
2037 | case 2: | ||
2038 | ax = wz_half_period_for_45_mhz[1]; | ||
2039 | break; | ||
2040 | case 3: | ||
2041 | ax = wz_half_period_for_45_mhz[2]; | ||
2042 | break; | ||
2043 | case 4: | ||
2044 | ax = wz_half_period_for_45_mhz[3]; | ||
2045 | break; | ||
2046 | |||
2047 | default: | ||
2048 | ax = 0; | ||
2049 | } | ||
2050 | |||
2051 | if (ax != 0) { | ||
2052 | write_reg_dw(adapter, 0x200, ((ax << 0x0f) + (ax & 0x7fff)) | 0x40000000); | ||
2053 | |||
2054 | } else { | ||
2055 | |||
2056 | write_reg_dw(adapter, 0x200, 0x40ff8000); | ||
2057 | } | ||
2058 | } | ||
2059 | |||
2060 | static void set_tuner_polarity(struct adapter *adapter, u8 polarity) | ||
2061 | { | ||
2062 | u32 var; | ||
2063 | |||
2064 | dprintk("%s : polarity = %u \n", __FUNCTION__, polarity); | ||
2065 | |||
2066 | var = read_reg_dw(adapter, 0x204); | ||
2067 | |||
2068 | if (polarity == 0) { | ||
2069 | dprintk("%s: LNB power off\n", __FUNCTION__); | ||
2070 | var = var | 1; | ||
2071 | }; | ||
2072 | |||
2073 | if (polarity == 1) { | ||
2074 | var = var & ~1; | ||
2075 | var = var & ~4; | ||
2076 | }; | ||
2077 | |||
2078 | if (polarity == 2) { | ||
2079 | var = var & ~1; | ||
2080 | var = var | 4; | ||
2081 | } | ||
2082 | |||
2083 | write_reg_dw(adapter, 0x204, var); | ||
2084 | } | ||
2085 | |||
2086 | static void diseqc_send_bit(struct adapter *adapter, int data) | ||
2087 | { | ||
2088 | set_tuner_tone(adapter, 1); | ||
2089 | udelay(data ? 500 : 1000); | ||
2090 | set_tuner_tone(adapter, 0); | ||
2091 | udelay(data ? 1000 : 500); | ||
2092 | } | ||
2093 | |||
2094 | |||
2095 | static void diseqc_send_byte(struct adapter *adapter, int data) | ||
2096 | { | ||
2097 | int i, par = 1, d; | ||
2098 | |||
2099 | for (i = 7; i >= 0; i--) { | ||
2100 | d = (data >> i) & 1; | ||
2101 | par ^= d; | ||
2102 | diseqc_send_bit(adapter, d); | ||
2103 | } | ||
2104 | |||
2105 | diseqc_send_bit(adapter, par); | ||
2106 | } | ||
2107 | |||
2108 | |||
2109 | static int send_diseqc_msg(struct adapter *adapter, int len, u8 *msg, unsigned long burst) | ||
2110 | { | ||
2111 | int i; | ||
2112 | |||
2113 | set_tuner_tone(adapter, 0); | ||
2114 | mdelay(16); | ||
2115 | |||
2116 | for (i = 0; i < len; i++) | ||
2117 | diseqc_send_byte(adapter, msg[i]); | ||
2118 | |||
2119 | mdelay(16); | ||
2120 | |||
2121 | if (burst != -1) { | ||
2122 | if (burst) | ||
2123 | diseqc_send_byte(adapter, 0xff); | ||
2124 | else { | ||
2125 | set_tuner_tone(adapter, 1); | ||
2126 | udelay(12500); | ||
2127 | set_tuner_tone(adapter, 0); | ||
2128 | } | ||
2129 | msleep(20); | ||
2130 | } | ||
2131 | |||
2132 | return 0; | ||
2133 | } | ||
2134 | |||
2135 | static int flexcop_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | ||
2136 | { | ||
2137 | struct adapter* adapter = (struct adapter*) fe->dvb->priv; | ||
2138 | |||
2139 | switch(tone) { | ||
2140 | case SEC_TONE_ON: | ||
2141 | set_tuner_tone(adapter, 1); | ||
2142 | break; | ||
2143 | case SEC_TONE_OFF: | ||
2144 | set_tuner_tone(adapter, 0); | ||
2145 | break; | ||
2146 | default: | ||
2147 | return -EINVAL; | ||
2148 | }; | ||
2149 | |||
2150 | return 0; | ||
2151 | } | ||
2152 | |||
2153 | static int flexcop_diseqc_send_master_cmd(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd) | ||
2154 | { | ||
2155 | struct adapter* adapter = (struct adapter*) fe->dvb->priv; | ||
2156 | |||
2157 | send_diseqc_msg(adapter, cmd->msg_len, cmd->msg, 0); | ||
2158 | |||
2159 | return 0; | ||
2160 | } | ||
2161 | |||
2162 | static int flexcop_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd) | ||
2163 | { | ||
2164 | struct adapter* adapter = (struct adapter*) fe->dvb->priv; | ||
2165 | |||
2166 | send_diseqc_msg(adapter, 0, NULL, minicmd); | ||
2167 | |||
2168 | return 0; | ||
2169 | } | ||
2170 | |||
2171 | static int flexcop_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) | ||
2172 | { | ||
2173 | struct adapter* adapter = (struct adapter*) fe->dvb->priv; | ||
2174 | |||
2175 | dprintk("%s: FE_SET_VOLTAGE\n", __FUNCTION__); | ||
2176 | |||
2177 | switch (voltage) { | ||
2178 | case SEC_VOLTAGE_13: | ||
2179 | dprintk("%s: SEC_VOLTAGE_13, %x\n", __FUNCTION__, SEC_VOLTAGE_13); | ||
2180 | set_tuner_polarity(adapter, 1); | ||
2181 | return 0; | ||
2182 | |||
2183 | case SEC_VOLTAGE_18: | ||
2184 | dprintk("%s: SEC_VOLTAGE_18, %x\n", __FUNCTION__, SEC_VOLTAGE_18); | ||
2185 | set_tuner_polarity(adapter, 2); | ||
2186 | return 0; | ||
2187 | |||
2188 | default: | ||
2189 | return -EINVAL; | ||
2190 | } | ||
2191 | } | ||
2192 | |||
2193 | static int flexcop_sleep(struct dvb_frontend* fe) | ||
2194 | { | ||
2195 | struct adapter* adapter = (struct adapter*) fe->dvb->priv; | ||
2196 | |||
2197 | dprintk("%s: FE_SLEEP\n", __FUNCTION__); | ||
2198 | set_tuner_polarity(adapter, 0); | ||
2199 | |||
2200 | if (adapter->fe_sleep) return adapter->fe_sleep(fe); | ||
2201 | return 0; | ||
2202 | } | ||
2203 | |||
2204 | static u32 flexcop_i2c_func(struct i2c_adapter *adapter) | ||
2205 | { | ||
2206 | printk("flexcop_i2c_func\n"); | ||
2207 | |||
2208 | return I2C_FUNC_I2C; | ||
2209 | } | ||
2210 | |||
2211 | static struct i2c_algorithm flexcop_algo = { | ||
2212 | .name = "flexcop i2c algorithm", | ||
2213 | .id = I2C_ALGO_BIT, | ||
2214 | .master_xfer = master_xfer, | ||
2215 | .functionality = flexcop_i2c_func, | ||
2216 | }; | ||
2217 | |||
2218 | |||
2219 | |||
2220 | |||
2221 | static int samsung_tbmu24112_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ratio) | ||
2222 | { | ||
2223 | u8 aclk = 0; | ||
2224 | u8 bclk = 0; | ||
2225 | |||
2226 | if (srate < 1500000) { aclk = 0xb7; bclk = 0x47; } | ||
2227 | else if (srate < 3000000) { aclk = 0xb7; bclk = 0x4b; } | ||
2228 | else if (srate < 7000000) { aclk = 0xb7; bclk = 0x4f; } | ||
2229 | else if (srate < 14000000) { aclk = 0xb7; bclk = 0x53; } | ||
2230 | else if (srate < 30000000) { aclk = 0xb6; bclk = 0x53; } | ||
2231 | else if (srate < 45000000) { aclk = 0xb4; bclk = 0x51; } | ||
2232 | |||
2233 | stv0299_writereg (fe, 0x13, aclk); | ||
2234 | stv0299_writereg (fe, 0x14, bclk); | ||
2235 | stv0299_writereg (fe, 0x1f, (ratio >> 16) & 0xff); | ||
2236 | stv0299_writereg (fe, 0x20, (ratio >> 8) & 0xff); | ||
2237 | stv0299_writereg (fe, 0x21, (ratio ) & 0xf0); | ||
2238 | |||
2239 | return 0; | ||
2240 | } | ||
2241 | |||
2242 | static int samsung_tbmu24112_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | ||
2243 | { | ||
2244 | u8 buf[4]; | ||
2245 | u32 div; | ||
2246 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; | ||
2247 | struct adapter* adapter = (struct adapter*) fe->dvb->priv; | ||
2248 | |||
2249 | div = params->frequency / 125; | ||
2250 | |||
2251 | buf[0] = (div >> 8) & 0x7f; | ||
2252 | buf[1] = div & 0xff; | ||
2253 | buf[2] = 0x84; // 0xC4 | ||
2254 | buf[3] = 0x08; | ||
2255 | |||
2256 | if (params->frequency < 1500000) buf[3] |= 0x10; | ||
2257 | |||
2258 | if (i2c_transfer (&adapter->i2c_adap, &msg, 1) != 1) return -EIO; | ||
2259 | return 0; | ||
2260 | } | ||
2261 | |||
2262 | static u8 samsung_tbmu24112_inittab[] = { | ||
2263 | 0x01, 0x15, | ||
2264 | 0x02, 0x30, | ||
2265 | 0x03, 0x00, | ||
2266 | 0x04, 0x7D, | ||
2267 | 0x05, 0x35, | ||
2268 | 0x06, 0x02, | ||
2269 | 0x07, 0x00, | ||
2270 | 0x08, 0xC3, | ||
2271 | 0x0C, 0x00, | ||
2272 | 0x0D, 0x81, | ||
2273 | 0x0E, 0x23, | ||
2274 | 0x0F, 0x12, | ||
2275 | 0x10, 0x7E, | ||
2276 | 0x11, 0x84, | ||
2277 | 0x12, 0xB9, | ||
2278 | 0x13, 0x88, | ||
2279 | 0x14, 0x89, | ||
2280 | 0x15, 0xC9, | ||
2281 | 0x16, 0x00, | ||
2282 | 0x17, 0x5C, | ||
2283 | 0x18, 0x00, | ||
2284 | 0x19, 0x00, | ||
2285 | 0x1A, 0x00, | ||
2286 | 0x1C, 0x00, | ||
2287 | 0x1D, 0x00, | ||
2288 | 0x1E, 0x00, | ||
2289 | 0x1F, 0x3A, | ||
2290 | 0x20, 0x2E, | ||
2291 | 0x21, 0x80, | ||
2292 | 0x22, 0xFF, | ||
2293 | 0x23, 0xC1, | ||
2294 | 0x28, 0x00, | ||
2295 | 0x29, 0x1E, | ||
2296 | 0x2A, 0x14, | ||
2297 | 0x2B, 0x0F, | ||
2298 | 0x2C, 0x09, | ||
2299 | 0x2D, 0x05, | ||
2300 | 0x31, 0x1F, | ||
2301 | 0x32, 0x19, | ||
2302 | 0x33, 0xFE, | ||
2303 | 0x34, 0x93, | ||
2304 | 0xff, 0xff, | ||
2305 | }; | ||
2306 | |||
2307 | static struct stv0299_config samsung_tbmu24112_config = { | ||
2308 | .demod_address = 0x68, | ||
2309 | .inittab = samsung_tbmu24112_inittab, | ||
2310 | .mclk = 88000000UL, | ||
2311 | .invert = 0, | ||
2312 | .enhanced_tuning = 0, | ||
2313 | .skip_reinit = 0, | ||
2314 | .lock_output = STV0229_LOCKOUTPUT_LK, | ||
2315 | .volt13_op0_op1 = STV0299_VOLT13_OP1, | ||
2316 | .min_delay_ms = 100, | ||
2317 | .set_symbol_rate = samsung_tbmu24112_set_symbol_rate, | ||
2318 | .pll_set = samsung_tbmu24112_pll_set, | ||
2319 | }; | ||
2320 | |||
2321 | |||
2322 | |||
2323 | static int nxt2002_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name) | ||
2324 | { | ||
2325 | struct adapter* adapter = (struct adapter*) fe->dvb->priv; | ||
2326 | |||
2327 | return request_firmware(fw, name, &adapter->pdev->dev); | ||
2328 | } | ||
2329 | |||
2330 | |||
2331 | static struct nxt2002_config samsung_tbmv_config = { | ||
2332 | .demod_address = 0x0A, | ||
2333 | .request_firmware = nxt2002_request_firmware, | ||
2334 | }; | ||
2335 | |||
2336 | static int samsung_tdtc9251dh0_demod_init(struct dvb_frontend* fe) | ||
2337 | { | ||
2338 | static u8 mt352_clock_config [] = { 0x89, 0x18, 0x2d }; | ||
2339 | static u8 mt352_reset [] = { 0x50, 0x80 }; | ||
2340 | static u8 mt352_adc_ctl_1_cfg [] = { 0x8E, 0x40 }; | ||
2341 | static u8 mt352_agc_cfg [] = { 0x67, 0x28, 0xa1 }; | ||
2342 | static u8 mt352_capt_range_cfg[] = { 0x75, 0x32 }; | ||
2343 | |||
2344 | mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config)); | ||
2345 | udelay(2000); | ||
2346 | mt352_write(fe, mt352_reset, sizeof(mt352_reset)); | ||
2347 | mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg)); | ||
2348 | |||
2349 | mt352_write(fe, mt352_agc_cfg, sizeof(mt352_agc_cfg)); | ||
2350 | mt352_write(fe, mt352_capt_range_cfg, sizeof(mt352_capt_range_cfg)); | ||
2351 | |||
2352 | return 0; | ||
2353 | } | ||
2354 | |||
2355 | static int samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf) | ||
2356 | { | ||
2357 | u32 div; | ||
2358 | unsigned char bs = 0; | ||
2359 | |||
2360 | #define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */ | ||
2361 | div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6; | ||
2362 | |||
2363 | if (params->frequency >= 48000000 && params->frequency <= 154000000) bs = 0x09; | ||
2364 | if (params->frequency >= 161000000 && params->frequency <= 439000000) bs = 0x0a; | ||
2365 | if (params->frequency >= 447000000 && params->frequency <= 863000000) bs = 0x08; | ||
2366 | |||
2367 | pllbuf[0] = 0xc2; // Note: non-linux standard PLL i2c address | ||
2368 | pllbuf[1] = div >> 8; | ||
2369 | pllbuf[2] = div & 0xff; | ||
2370 | pllbuf[3] = 0xcc; | ||
2371 | pllbuf[4] = bs; | ||
2372 | |||
2373 | return 0; | ||
2374 | } | ||
2375 | |||
2376 | static struct mt352_config samsung_tdtc9251dh0_config = { | ||
2377 | |||
2378 | .demod_address = 0x0f, | ||
2379 | .demod_init = samsung_tdtc9251dh0_demod_init, | ||
2380 | .pll_set = samsung_tdtc9251dh0_pll_set, | ||
2381 | }; | ||
2382 | |||
2383 | static int skystar23_samsung_tbdu18132_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | ||
2384 | { | ||
2385 | u8 buf[4]; | ||
2386 | u32 div; | ||
2387 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; | ||
2388 | struct adapter* adapter = (struct adapter*) fe->dvb->priv; | ||
2389 | |||
2390 | div = (params->frequency + (125/2)) / 125; | ||
2391 | |||
2392 | buf[0] = (div >> 8) & 0x7f; | ||
2393 | buf[1] = (div >> 0) & 0xff; | ||
2394 | buf[2] = 0x84 | ((div >> 10) & 0x60); | ||
2395 | buf[3] = 0x80; | ||
2396 | |||
2397 | if (params->frequency < 1550000) | ||
2398 | buf[3] |= 0x02; | ||
2399 | |||
2400 | if (i2c_transfer (&adapter->i2c_adap, &msg, 1) != 1) return -EIO; | ||
2401 | return 0; | ||
2402 | } | ||
2403 | |||
2404 | static struct mt312_config skystar23_samsung_tbdu18132_config = { | ||
2405 | |||
2406 | .demod_address = 0x0e, | ||
2407 | .pll_set = skystar23_samsung_tbdu18132_pll_set, | ||
2408 | }; | ||
2409 | |||
2410 | |||
2411 | |||
2412 | |||
2413 | static void frontend_init(struct adapter *skystar2) | ||
2414 | { | ||
2415 | switch(skystar2->pdev->device) { | ||
2416 | case 0x2103: // Technisat Skystar2 OR Technisat Airstar2 (DVB-T or ATSC) | ||
2417 | |||
2418 | // Attempt to load the Nextwave nxt2002 for ATSC support | ||
2419 | skystar2->fe = nxt2002_attach(&samsung_tbmv_config, &skystar2->i2c_adap); | ||
2420 | if (skystar2->fe != NULL) { | ||
2421 | skystar2->fe_sleep = skystar2->fe->ops->sleep; | ||
2422 | skystar2->fe->ops->sleep = flexcop_sleep; | ||
2423 | break; | ||
2424 | } | ||
2425 | |||
2426 | // try the skystar2 v2.6 first (stv0299/Samsung tbmu24112(sl1935)) | ||
2427 | skystar2->fe = stv0299_attach(&samsung_tbmu24112_config, &skystar2->i2c_adap); | ||
2428 | if (skystar2->fe != NULL) { | ||
2429 | skystar2->fe->ops->set_voltage = flexcop_set_voltage; | ||
2430 | skystar2->fe_sleep = skystar2->fe->ops->sleep; | ||
2431 | skystar2->fe->ops->sleep = flexcop_sleep; | ||
2432 | break; | ||
2433 | } | ||
2434 | |||
2435 | // try the airstar2 (mt352/Samsung tdtc9251dh0(??)) | ||
2436 | skystar2->fe = mt352_attach(&samsung_tdtc9251dh0_config, &skystar2->i2c_adap); | ||
2437 | if (skystar2->fe != NULL) { | ||
2438 | skystar2->fe->ops->info.frequency_min = 474000000; | ||
2439 | skystar2->fe->ops->info.frequency_max = 858000000; | ||
2440 | break; | ||
2441 | } | ||
2442 | |||
2443 | // try the skystar2 v2.3 (vp310/Samsung tbdu18132(tsa5059)) | ||
2444 | skystar2->fe = vp310_attach(&skystar23_samsung_tbdu18132_config, &skystar2->i2c_adap); | ||
2445 | if (skystar2->fe != NULL) { | ||
2446 | skystar2->fe->ops->diseqc_send_master_cmd = flexcop_diseqc_send_master_cmd; | ||
2447 | skystar2->fe->ops->diseqc_send_burst = flexcop_diseqc_send_burst; | ||
2448 | skystar2->fe->ops->set_tone = flexcop_set_tone; | ||
2449 | skystar2->fe->ops->set_voltage = flexcop_set_voltage; | ||
2450 | skystar2->fe_sleep = skystar2->fe->ops->sleep; | ||
2451 | skystar2->fe->ops->sleep = flexcop_sleep; | ||
2452 | break; | ||
2453 | } | ||
2454 | break; | ||
2455 | } | ||
2456 | |||
2457 | if (skystar2->fe == NULL) { | ||
2458 | printk("skystar2: A frontend driver was not found for device %04x/%04x subsystem %04x/%04x\n", | ||
2459 | skystar2->pdev->vendor, | ||
2460 | skystar2->pdev->device, | ||
2461 | skystar2->pdev->subsystem_vendor, | ||
2462 | skystar2->pdev->subsystem_device); | ||
2463 | } else { | ||
2464 | if (dvb_register_frontend(&skystar2->dvb_adapter, skystar2->fe)) { | ||
2465 | printk("skystar2: Frontend registration failed!\n"); | ||
2466 | if (skystar2->fe->ops->release) | ||
2467 | skystar2->fe->ops->release(skystar2->fe); | ||
2468 | skystar2->fe = NULL; | ||
2469 | } | ||
2470 | } | ||
2471 | } | ||
2472 | |||
2473 | |||
2474 | static int skystar2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
2475 | { | ||
2476 | struct adapter *adapter; | ||
2477 | struct dvb_adapter *dvb_adapter; | ||
2478 | struct dvb_demux *dvbdemux; | ||
2479 | struct dmx_demux *dmx; | ||
2480 | int ret = -ENODEV; | ||
2481 | |||
2482 | if (!pdev) | ||
2483 | goto out; | ||
2484 | |||
2485 | ret = driver_initialize(pdev); | ||
2486 | if (ret < 0) | ||
2487 | goto out; | ||
2488 | |||
2489 | adapter = pci_get_drvdata(pdev); | ||
2490 | dvb_adapter = &adapter->dvb_adapter; | ||
2491 | |||
2492 | ret = dvb_register_adapter(dvb_adapter, skystar2_pci_driver.name, | ||
2493 | THIS_MODULE); | ||
2494 | if (ret < 0) { | ||
2495 | printk("%s: Error registering DVB adapter\n", __FUNCTION__); | ||
2496 | goto err_halt; | ||
2497 | } | ||
2498 | |||
2499 | dvb_adapter->priv = adapter; | ||
2500 | |||
2501 | |||
2502 | init_MUTEX(&adapter->i2c_sem); | ||
2503 | |||
2504 | |||
2505 | memset(&adapter->i2c_adap, 0, sizeof(struct i2c_adapter)); | ||
2506 | strcpy(adapter->i2c_adap.name, "SkyStar2"); | ||
2507 | |||
2508 | i2c_set_adapdata(&adapter->i2c_adap, adapter); | ||
2509 | |||
2510 | #ifdef I2C_ADAP_CLASS_TV_DIGITAL | ||
2511 | adapter->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL; | ||
2512 | #else | ||
2513 | adapter->i2c_adap.class = I2C_CLASS_TV_DIGITAL; | ||
2514 | #endif | ||
2515 | adapter->i2c_adap.algo = &flexcop_algo; | ||
2516 | adapter->i2c_adap.algo_data = NULL; | ||
2517 | adapter->i2c_adap.id = I2C_ALGO_BIT; | ||
2518 | |||
2519 | ret = i2c_add_adapter(&adapter->i2c_adap); | ||
2520 | if (ret < 0) | ||
2521 | goto err_dvb_unregister; | ||
2522 | |||
2523 | dvbdemux = &adapter->demux; | ||
2524 | |||
2525 | dvbdemux->priv = adapter; | ||
2526 | dvbdemux->filternum = N_PID_SLOTS; | ||
2527 | dvbdemux->feednum = N_PID_SLOTS; | ||
2528 | dvbdemux->start_feed = dvb_start_feed; | ||
2529 | dvbdemux->stop_feed = dvb_stop_feed; | ||
2530 | dvbdemux->write_to_decoder = NULL; | ||
2531 | dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING); | ||
2532 | |||
2533 | ret = dvb_dmx_init(&adapter->demux); | ||
2534 | if (ret < 0) | ||
2535 | goto err_i2c_del; | ||
2536 | |||
2537 | dmx = &dvbdemux->dmx; | ||
2538 | |||
2539 | adapter->hw_frontend.source = DMX_FRONTEND_0; | ||
2540 | adapter->dmxdev.filternum = N_PID_SLOTS; | ||
2541 | adapter->dmxdev.demux = dmx; | ||
2542 | adapter->dmxdev.capabilities = 0; | ||
2543 | |||
2544 | ret = dvb_dmxdev_init(&adapter->dmxdev, &adapter->dvb_adapter); | ||
2545 | if (ret < 0) | ||
2546 | goto err_dmx_release; | ||
2547 | |||
2548 | ret = dmx->add_frontend(dmx, &adapter->hw_frontend); | ||
2549 | if (ret < 0) | ||
2550 | goto err_dmxdev_release; | ||
2551 | |||
2552 | adapter->mem_frontend.source = DMX_MEMORY_FE; | ||
2553 | |||
2554 | ret = dmx->add_frontend(dmx, &adapter->mem_frontend); | ||
2555 | if (ret < 0) | ||
2556 | goto err_remove_hw_frontend; | ||
2557 | |||
2558 | ret = dmx->connect_frontend(dmx, &adapter->hw_frontend); | ||
2559 | if (ret < 0) | ||
2560 | goto err_remove_mem_frontend; | ||
2561 | |||
2562 | dvb_net_init(&adapter->dvb_adapter, &adapter->dvbnet, &dvbdemux->dmx); | ||
2563 | |||
2564 | frontend_init(adapter); | ||
2565 | out: | ||
2566 | return ret; | ||
2567 | |||
2568 | err_remove_mem_frontend: | ||
2569 | dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &adapter->mem_frontend); | ||
2570 | err_remove_hw_frontend: | ||
2571 | dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &adapter->hw_frontend); | ||
2572 | err_dmxdev_release: | ||
2573 | dvb_dmxdev_release(&adapter->dmxdev); | ||
2574 | err_dmx_release: | ||
2575 | dvb_dmx_release(&adapter->demux); | ||
2576 | err_i2c_del: | ||
2577 | i2c_del_adapter(&adapter->i2c_adap); | ||
2578 | err_dvb_unregister: | ||
2579 | dvb_unregister_adapter(&adapter->dvb_adapter); | ||
2580 | err_halt: | ||
2581 | driver_halt(pdev); | ||
2582 | goto out; | ||
2583 | } | ||
2584 | |||
2585 | static void skystar2_remove(struct pci_dev *pdev) | ||
2586 | { | ||
2587 | struct adapter *adapter = pci_get_drvdata(pdev); | ||
2588 | struct dvb_demux *dvbdemux; | ||
2589 | struct dmx_demux *dmx; | ||
2590 | |||
2591 | if (!adapter) | ||
2592 | return; | ||
2593 | |||
2594 | dvb_net_release(&adapter->dvbnet); | ||
2595 | dvbdemux = &adapter->demux; | ||
2596 | dmx = &dvbdemux->dmx; | ||
2597 | |||
2598 | dmx->close(dmx); | ||
2599 | dmx->remove_frontend(dmx, &adapter->hw_frontend); | ||
2600 | dmx->remove_frontend(dmx, &adapter->mem_frontend); | ||
2601 | |||
2602 | dvb_dmxdev_release(&adapter->dmxdev); | ||
2603 | dvb_dmx_release(dvbdemux); | ||
2604 | |||
2605 | if (adapter->fe != NULL) | ||
2606 | dvb_unregister_frontend(adapter->fe); | ||
2607 | |||
2608 | dvb_unregister_adapter(&adapter->dvb_adapter); | ||
2609 | |||
2610 | i2c_del_adapter(&adapter->i2c_adap); | ||
2611 | |||
2612 | driver_halt(pdev); | ||
2613 | } | ||
2614 | |||
2615 | static struct pci_device_id skystar2_pci_tbl[] = { | ||
2616 | {0x000013d0, 0x00002103, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000}, | ||
2617 | /* {0x000013d0, 0x00002200, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000}, UNDEFINED HARDWARE - mail linuxtv.org list */ //FCIII | ||
2618 | {0,}, | ||
2619 | }; | ||
2620 | |||
2621 | MODULE_DEVICE_TABLE(pci, skystar2_pci_tbl); | ||
2622 | |||
2623 | static struct pci_driver skystar2_pci_driver = { | ||
2624 | .name = "SkyStar2", | ||
2625 | .id_table = skystar2_pci_tbl, | ||
2626 | .probe = skystar2_probe, | ||
2627 | .remove = skystar2_remove, | ||
2628 | }; | ||
2629 | |||
2630 | static int skystar2_init(void) | ||
2631 | { | ||
2632 | return pci_register_driver(&skystar2_pci_driver); | ||
2633 | } | ||
2634 | |||
2635 | static void skystar2_cleanup(void) | ||
2636 | { | ||
2637 | pci_unregister_driver(&skystar2_pci_driver); | ||
2638 | } | ||
2639 | |||
2640 | module_init(skystar2_init); | ||
2641 | module_exit(skystar2_cleanup); | ||
2642 | |||
2643 | MODULE_DESCRIPTION("Technisat SkyStar2 DVB PCI Driver"); | ||
2644 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index 1339912c308b..07a0b0a968a6 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c | |||
@@ -258,10 +258,10 @@ int write_dst(struct dst_state *state, u8 *data, u8 len) | |||
258 | if (debug && (verbose > 4)) { | 258 | if (debug && (verbose > 4)) { |
259 | u8 i; | 259 | u8 i; |
260 | if (verbose > 4) { | 260 | if (verbose > 4) { |
261 | dprintk("%s writing", __FUNCTION__); | 261 | dprintk("%s writing [ ", __FUNCTION__); |
262 | for (i = 0; i < len; i++) | 262 | for (i = 0; i < len; i++) |
263 | dprintk(" %02x", data[i]); | 263 | dprintk("%02x ", data[i]); |
264 | dprintk("\n"); | 264 | dprintk("]\n"); |
265 | } | 265 | } |
266 | } | 266 | } |
267 | for (cnt = 0; cnt < 2; cnt++) { | 267 | for (cnt = 0; cnt < 2; cnt++) { |
@@ -320,10 +320,29 @@ int read_dst(struct dst_state *state, u8 * ret, u8 len) | |||
320 | } | 320 | } |
321 | EXPORT_SYMBOL(read_dst); | 321 | EXPORT_SYMBOL(read_dst); |
322 | 322 | ||
323 | static int dst_set_freq(struct dst_state *state, u32 freq) | 323 | static int dst_set_polarization(struct dst_state *state) |
324 | { | 324 | { |
325 | u8 *val; | 325 | switch (state->voltage) { |
326 | case SEC_VOLTAGE_13: // vertical | ||
327 | printk("%s: Polarization=[Vertical]\n", __FUNCTION__); | ||
328 | state->tx_tuna[8] &= ~0x40; //1 | ||
329 | break; | ||
330 | |||
331 | case SEC_VOLTAGE_18: // horizontal | ||
332 | printk("%s: Polarization=[Horizontal]\n", __FUNCTION__); | ||
333 | state->tx_tuna[8] |= 0x40; // 0 | ||
334 | break; | ||
335 | |||
336 | case SEC_VOLTAGE_OFF: | ||
337 | |||
338 | break; | ||
339 | } | ||
340 | |||
341 | return 0; | ||
342 | } | ||
326 | 343 | ||
344 | static int dst_set_freq(struct dst_state *state, u32 freq) | ||
345 | { | ||
327 | state->frequency = freq; | 346 | state->frequency = freq; |
328 | if (debug > 4) | 347 | if (debug > 4) |
329 | dprintk("%s: set Frequency %u\n", __FUNCTION__, freq); | 348 | dprintk("%s: set Frequency %u\n", __FUNCTION__, freq); |
@@ -332,46 +351,30 @@ static int dst_set_freq(struct dst_state *state, u32 freq) | |||
332 | freq = freq / 1000; | 351 | freq = freq / 1000; |
333 | if (freq < 950 || freq > 2150) | 352 | if (freq < 950 || freq > 2150) |
334 | return -EINVAL; | 353 | return -EINVAL; |
335 | val = &state->tx_tuna[0]; | 354 | |
336 | val[2] = (freq >> 8) & 0x7f; | 355 | state->tx_tuna[2] = (freq >> 8); |
337 | val[3] = (u8) freq; | 356 | state->tx_tuna[3] = (u8) freq; |
338 | val[4] = 1; | 357 | state->tx_tuna[4] = 0x01; |
339 | val[8] &= ~4; | 358 | state->tx_tuna[8] &= ~0x04; |
340 | if (freq < 1531) | 359 | if (state->type_flags & DST_TYPE_HAS_OBS_REGS) { |
341 | val[8] |= 4; | 360 | if (freq < 1531) |
361 | state->tx_tuna[8] |= 0x04; | ||
362 | } | ||
363 | |||
342 | } else if (state->dst_type == DST_TYPE_IS_TERR) { | 364 | } else if (state->dst_type == DST_TYPE_IS_TERR) { |
343 | freq = freq / 1000; | 365 | freq = freq / 1000; |
344 | if (freq < 137000 || freq > 858000) | 366 | if (freq < 137000 || freq > 858000) |
345 | return -EINVAL; | 367 | return -EINVAL; |
346 | val = &state->tx_tuna[0]; | ||
347 | val[2] = (freq >> 16) & 0xff; | ||
348 | val[3] = (freq >> 8) & 0xff; | ||
349 | val[4] = (u8) freq; | ||
350 | val[5] = 0; | ||
351 | switch (state->bandwidth) { | ||
352 | case BANDWIDTH_6_MHZ: | ||
353 | val[6] = 6; | ||
354 | break; | ||
355 | 368 | ||
356 | case BANDWIDTH_7_MHZ: | 369 | state->tx_tuna[2] = (freq >> 16) & 0xff; |
357 | case BANDWIDTH_AUTO: | 370 | state->tx_tuna[3] = (freq >> 8) & 0xff; |
358 | val[6] = 7; | 371 | state->tx_tuna[4] = (u8) freq; |
359 | break; | ||
360 | 372 | ||
361 | case BANDWIDTH_8_MHZ: | ||
362 | val[6] = 8; | ||
363 | break; | ||
364 | } | ||
365 | |||
366 | val[7] = 0; | ||
367 | val[8] = 0; | ||
368 | } else if (state->dst_type == DST_TYPE_IS_CABLE) { | 373 | } else if (state->dst_type == DST_TYPE_IS_CABLE) { |
369 | /* guess till will get one */ | 374 | state->tx_tuna[2] = (freq >> 16) & 0xff; |
370 | freq = freq / 1000; | 375 | state->tx_tuna[3] = (freq >> 8) & 0xff; |
371 | val = &state->tx_tuna[0]; | 376 | state->tx_tuna[4] = (u8) freq; |
372 | val[2] = (freq >> 16) & 0xff; | 377 | |
373 | val[3] = (freq >> 8) & 0xff; | ||
374 | val[4] = (u8) freq; | ||
375 | } else | 378 | } else |
376 | return -EINVAL; | 379 | return -EINVAL; |
377 | return 0; | 380 | return 0; |
@@ -379,51 +382,58 @@ static int dst_set_freq(struct dst_state *state, u32 freq) | |||
379 | 382 | ||
380 | static int dst_set_bandwidth(struct dst_state* state, fe_bandwidth_t bandwidth) | 383 | static int dst_set_bandwidth(struct dst_state* state, fe_bandwidth_t bandwidth) |
381 | { | 384 | { |
382 | u8 *val; | ||
383 | |||
384 | state->bandwidth = bandwidth; | 385 | state->bandwidth = bandwidth; |
385 | 386 | ||
386 | if (state->dst_type != DST_TYPE_IS_TERR) | 387 | if (state->dst_type != DST_TYPE_IS_TERR) |
387 | return 0; | 388 | return 0; |
388 | 389 | ||
389 | val = &state->tx_tuna[0]; | ||
390 | switch (bandwidth) { | 390 | switch (bandwidth) { |
391 | case BANDWIDTH_6_MHZ: | 391 | case BANDWIDTH_6_MHZ: |
392 | val[6] = 6; | 392 | if (state->dst_hw_cap & DST_TYPE_HAS_CA) |
393 | break; | 393 | state->tx_tuna[7] = 0x06; |
394 | else { | ||
395 | state->tx_tuna[6] = 0x06; | ||
396 | state->tx_tuna[7] = 0x00; | ||
397 | } | ||
398 | break; | ||
394 | 399 | ||
395 | case BANDWIDTH_7_MHZ: | 400 | case BANDWIDTH_7_MHZ: |
396 | val[6] = 7; | 401 | if (state->dst_hw_cap & DST_TYPE_HAS_CA) |
397 | break; | 402 | state->tx_tuna[7] = 0x07; |
403 | else { | ||
404 | state->tx_tuna[6] = 0x07; | ||
405 | state->tx_tuna[7] = 0x00; | ||
406 | } | ||
407 | break; | ||
398 | 408 | ||
399 | case BANDWIDTH_8_MHZ: | 409 | case BANDWIDTH_8_MHZ: |
400 | val[6] = 8; | 410 | if (state->dst_hw_cap & DST_TYPE_HAS_CA) |
401 | break; | 411 | state->tx_tuna[7] = 0x08; |
412 | else { | ||
413 | state->tx_tuna[6] = 0x08; | ||
414 | state->tx_tuna[7] = 0x00; | ||
415 | } | ||
416 | break; | ||
402 | 417 | ||
403 | default: | 418 | default: |
404 | return -EINVAL; | 419 | return -EINVAL; |
405 | } | 420 | } |
406 | return 0; | 421 | return 0; |
407 | } | 422 | } |
408 | 423 | ||
409 | static int dst_set_inversion(struct dst_state* state, fe_spectral_inversion_t inversion) | 424 | static int dst_set_inversion(struct dst_state* state, fe_spectral_inversion_t inversion) |
410 | { | 425 | { |
411 | u8 *val; | ||
412 | |||
413 | state->inversion = inversion; | 426 | state->inversion = inversion; |
414 | |||
415 | val = &state->tx_tuna[0]; | ||
416 | |||
417 | val[8] &= ~0x80; | ||
418 | |||
419 | switch (inversion) { | 427 | switch (inversion) { |
420 | case INVERSION_OFF: | 428 | case INVERSION_OFF: // Inversion = Normal |
421 | break; | 429 | state->tx_tuna[8] &= ~0x80; |
422 | case INVERSION_ON: | 430 | break; |
423 | val[8] |= 0x80; | 431 | |
424 | break; | 432 | case INVERSION_ON: |
425 | default: | 433 | state->tx_tuna[8] |= 0x80; |
426 | return -EINVAL; | 434 | break; |
435 | default: | ||
436 | return -EINVAL; | ||
427 | } | 437 | } |
428 | return 0; | 438 | return 0; |
429 | } | 439 | } |
@@ -478,6 +488,52 @@ static int dst_set_symbolrate(struct dst_state* state, u32 srate) | |||
478 | return 0; | 488 | return 0; |
479 | } | 489 | } |
480 | 490 | ||
491 | |||
492 | static int dst_set_modulation(struct dst_state *state, fe_modulation_t modulation) | ||
493 | { | ||
494 | if (state->dst_type != DST_TYPE_IS_CABLE) | ||
495 | return 0; | ||
496 | |||
497 | state->modulation = modulation; | ||
498 | switch (modulation) { | ||
499 | case QAM_16: | ||
500 | state->tx_tuna[8] = 0x10; | ||
501 | break; | ||
502 | |||
503 | case QAM_32: | ||
504 | state->tx_tuna[8] = 0x20; | ||
505 | break; | ||
506 | |||
507 | case QAM_64: | ||
508 | state->tx_tuna[8] = 0x40; | ||
509 | break; | ||
510 | |||
511 | case QAM_128: | ||
512 | state->tx_tuna[8] = 0x80; | ||
513 | break; | ||
514 | |||
515 | case QAM_256: | ||
516 | state->tx_tuna[8] = 0x00; | ||
517 | break; | ||
518 | |||
519 | case QPSK: | ||
520 | case QAM_AUTO: | ||
521 | case VSB_8: | ||
522 | case VSB_16: | ||
523 | default: | ||
524 | return -EINVAL; | ||
525 | |||
526 | } | ||
527 | |||
528 | return 0; | ||
529 | } | ||
530 | |||
531 | static fe_modulation_t dst_get_modulation(struct dst_state *state) | ||
532 | { | ||
533 | return state->modulation; | ||
534 | } | ||
535 | |||
536 | |||
481 | u8 dst_check_sum(u8 * buf, u32 len) | 537 | u8 dst_check_sum(u8 * buf, u32 len) |
482 | { | 538 | { |
483 | u32 i; | 539 | u32 i; |
@@ -577,7 +633,7 @@ struct dst_types dst_tlist[] = { | |||
577 | .device_id = "200103A", | 633 | .device_id = "200103A", |
578 | .offset = 0, | 634 | .offset = 0, |
579 | .dst_type = DST_TYPE_IS_SAT, | 635 | .dst_type = DST_TYPE_IS_SAT, |
580 | .type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_FW_1, | 636 | .type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_FW_1 | DST_TYPE_HAS_OBS_REGS, |
581 | .dst_feature = 0 | 637 | .dst_feature = 0 |
582 | }, /* obsolete */ | 638 | }, /* obsolete */ |
583 | 639 | ||
@@ -626,7 +682,7 @@ struct dst_types dst_tlist[] = { | |||
626 | .device_id = "DSTMCI", | 682 | .device_id = "DSTMCI", |
627 | .offset = 1, | 683 | .offset = 1, |
628 | .dst_type = DST_TYPE_IS_SAT, | 684 | .dst_type = DST_TYPE_IS_SAT, |
629 | .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD, | 685 | .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD | DST_TYPE_HAS_INC_COUNT, |
630 | .dst_feature = DST_TYPE_HAS_CA | DST_TYPE_HAS_DISEQC3 | DST_TYPE_HAS_DISEQC4 | 686 | .dst_feature = DST_TYPE_HAS_CA | DST_TYPE_HAS_DISEQC3 | DST_TYPE_HAS_DISEQC4 |
631 | | DST_TYPE_HAS_MOTO | DST_TYPE_HAS_MAC | 687 | | DST_TYPE_HAS_MOTO | DST_TYPE_HAS_MAC |
632 | }, | 688 | }, |
@@ -872,7 +928,7 @@ static int dst_get_signal(struct dst_state* state) | |||
872 | { | 928 | { |
873 | int retval; | 929 | int retval; |
874 | u8 get_signal[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb }; | 930 | u8 get_signal[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb }; |
875 | 931 | dprintk("%s: Getting Signal strength and other parameters\n", __FUNCTION__); | |
876 | if ((state->diseq_flags & ATTEMPT_TUNE) == 0) { | 932 | if ((state->diseq_flags & ATTEMPT_TUNE) == 0) { |
877 | state->decode_lock = state->decode_strength = state->decode_snr = 0; | 933 | state->decode_lock = state->decode_strength = state->decode_snr = 0; |
878 | return 0; | 934 | return 0; |
@@ -954,15 +1010,8 @@ static int dst_get_tuna(struct dst_state* state) | |||
954 | state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 8) + state->rx_tuna[3]; | 1010 | state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 8) + state->rx_tuna[3]; |
955 | 1011 | ||
956 | state->decode_lock = 1; | 1012 | state->decode_lock = 1; |
957 | /* | ||
958 | dst->decode_n1 = (dst->rx_tuna[4] << 8) + | ||
959 | (dst->rx_tuna[5]); | ||
960 | |||
961 | dst->decode_n2 = (dst->rx_tuna[8] << 8) + | ||
962 | (dst->rx_tuna[7]); | ||
963 | */ | ||
964 | state->diseq_flags |= HAS_LOCK; | 1013 | state->diseq_flags |= HAS_LOCK; |
965 | /* dst->cur_jiff = jiffies; */ | 1014 | |
966 | return 1; | 1015 | return 1; |
967 | } | 1016 | } |
968 | 1017 | ||
@@ -1098,7 +1147,11 @@ static int dst_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
1098 | 1147 | ||
1099 | switch (tone) { | 1148 | switch (tone) { |
1100 | case SEC_TONE_OFF: | 1149 | case SEC_TONE_OFF: |
1101 | state->tx_tuna[2] = 0xff; | 1150 | if (state->type_flags & DST_TYPE_HAS_OBS_REGS) |
1151 | state->tx_tuna[2] = 0x00; | ||
1152 | else | ||
1153 | state->tx_tuna[2] = 0xff; | ||
1154 | |||
1102 | break; | 1155 | break; |
1103 | 1156 | ||
1104 | case SEC_TONE_ON: | 1157 | case SEC_TONE_ON: |
@@ -1145,7 +1198,8 @@ static int dst_init(struct dvb_frontend* fe) | |||
1145 | static u8 ini_tvci_tuna[] = { 9, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 }; | 1198 | static u8 ini_tvci_tuna[] = { 9, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 }; |
1146 | static u8 ini_cabfta_tuna[] = { 0, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 }; | 1199 | static u8 ini_cabfta_tuna[] = { 0, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 }; |
1147 | static u8 ini_cabci_tuna[] = { 9, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 }; | 1200 | static u8 ini_cabci_tuna[] = { 9, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 }; |
1148 | state->inversion = INVERSION_ON; | 1201 | // state->inversion = INVERSION_ON; |
1202 | state->inversion = INVERSION_OFF; | ||
1149 | state->voltage = SEC_VOLTAGE_13; | 1203 | state->voltage = SEC_VOLTAGE_13; |
1150 | state->tone = SEC_TONE_OFF; | 1204 | state->tone = SEC_TONE_OFF; |
1151 | state->symbol_rate = 29473000; | 1205 | state->symbol_rate = 29473000; |
@@ -1174,7 +1228,7 @@ static int dst_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
1174 | 1228 | ||
1175 | *status = 0; | 1229 | *status = 0; |
1176 | if (state->diseq_flags & HAS_LOCK) { | 1230 | if (state->diseq_flags & HAS_LOCK) { |
1177 | dst_get_signal(state); | 1231 | // dst_get_signal(state); // don't require(?) to ask MCU |
1178 | if (state->decode_lock) | 1232 | if (state->decode_lock) |
1179 | *status |= FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC | FE_HAS_VITERBI; | 1233 | *status |= FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC | FE_HAS_VITERBI; |
1180 | } | 1234 | } |
@@ -1208,20 +1262,25 @@ static int dst_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
1208 | 1262 | ||
1209 | dst_set_freq(state, p->frequency); | 1263 | dst_set_freq(state, p->frequency); |
1210 | if (verbose > 4) | 1264 | if (verbose > 4) |
1211 | dprintk("Set Frequency = [%d]\n", p->frequency); | 1265 | dprintk("Set Frequency=[%d]\n", p->frequency); |
1212 | 1266 | ||
1213 | dst_set_inversion(state, p->inversion); | 1267 | // dst_set_inversion(state, p->inversion); |
1214 | if (state->dst_type == DST_TYPE_IS_SAT) { | 1268 | if (state->dst_type == DST_TYPE_IS_SAT) { |
1269 | if (state->type_flags & DST_TYPE_HAS_OBS_REGS) | ||
1270 | dst_set_inversion(state, p->inversion); | ||
1271 | |||
1215 | dst_set_fec(state, p->u.qpsk.fec_inner); | 1272 | dst_set_fec(state, p->u.qpsk.fec_inner); |
1216 | dst_set_symbolrate(state, p->u.qpsk.symbol_rate); | 1273 | dst_set_symbolrate(state, p->u.qpsk.symbol_rate); |
1274 | dst_set_polarization(state); | ||
1217 | if (verbose > 4) | 1275 | if (verbose > 4) |
1218 | dprintk("Set Symbolrate = [%d]\n", p->u.qpsk.symbol_rate); | 1276 | dprintk("Set Symbolrate=[%d]\n", p->u.qpsk.symbol_rate); |
1219 | 1277 | ||
1220 | } else if (state->dst_type == DST_TYPE_IS_TERR) { | 1278 | } else if (state->dst_type == DST_TYPE_IS_TERR) { |
1221 | dst_set_bandwidth(state, p->u.ofdm.bandwidth); | 1279 | dst_set_bandwidth(state, p->u.ofdm.bandwidth); |
1222 | } else if (state->dst_type == DST_TYPE_IS_CABLE) { | 1280 | } else if (state->dst_type == DST_TYPE_IS_CABLE) { |
1223 | dst_set_fec(state, p->u.qam.fec_inner); | 1281 | dst_set_fec(state, p->u.qam.fec_inner); |
1224 | dst_set_symbolrate(state, p->u.qam.symbol_rate); | 1282 | dst_set_symbolrate(state, p->u.qam.symbol_rate); |
1283 | dst_set_modulation(state, p->u.qam.modulation); | ||
1225 | } | 1284 | } |
1226 | dst_write_tuna(fe); | 1285 | dst_write_tuna(fe); |
1227 | 1286 | ||
@@ -1233,8 +1292,11 @@ static int dst_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
1233 | struct dst_state* state = fe->demodulator_priv; | 1292 | struct dst_state* state = fe->demodulator_priv; |
1234 | 1293 | ||
1235 | p->frequency = state->decode_freq; | 1294 | p->frequency = state->decode_freq; |
1236 | p->inversion = state->inversion; | 1295 | // p->inversion = state->inversion; |
1237 | if (state->dst_type == DST_TYPE_IS_SAT) { | 1296 | if (state->dst_type == DST_TYPE_IS_SAT) { |
1297 | if (state->type_flags & DST_TYPE_HAS_OBS_REGS) | ||
1298 | p->inversion = state->inversion; | ||
1299 | |||
1238 | p->u.qpsk.symbol_rate = state->symbol_rate; | 1300 | p->u.qpsk.symbol_rate = state->symbol_rate; |
1239 | p->u.qpsk.fec_inner = dst_get_fec(state); | 1301 | p->u.qpsk.fec_inner = dst_get_fec(state); |
1240 | } else if (state->dst_type == DST_TYPE_IS_TERR) { | 1302 | } else if (state->dst_type == DST_TYPE_IS_TERR) { |
@@ -1242,7 +1304,8 @@ static int dst_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
1242 | } else if (state->dst_type == DST_TYPE_IS_CABLE) { | 1304 | } else if (state->dst_type == DST_TYPE_IS_CABLE) { |
1243 | p->u.qam.symbol_rate = state->symbol_rate; | 1305 | p->u.qam.symbol_rate = state->symbol_rate; |
1244 | p->u.qam.fec_inner = dst_get_fec(state); | 1306 | p->u.qam.fec_inner = dst_get_fec(state); |
1245 | p->u.qam.modulation = QAM_AUTO; | 1307 | // p->u.qam.modulation = QAM_AUTO; |
1308 | p->u.qam.modulation = dst_get_modulation(state); | ||
1246 | } | 1309 | } |
1247 | 1310 | ||
1248 | return 0; | 1311 | return 0; |
diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index d781504cc2fa..bfaacd5fc20f 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "dst_ca.h" | 32 | #include "dst_ca.h" |
33 | #include "dst_common.h" | 33 | #include "dst_common.h" |
34 | 34 | ||
35 | static unsigned int verbose = 1; | 35 | static unsigned int verbose = 5; |
36 | module_param(verbose, int, 0644); | 36 | module_param(verbose, int, 0644); |
37 | MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)"); | 37 | MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)"); |
38 | 38 | ||
@@ -295,34 +295,28 @@ static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, | |||
295 | return 0; | 295 | return 0; |
296 | } | 296 | } |
297 | 297 | ||
298 | static int handle_en50221_tag(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer) | 298 | static int handle_dst_tag(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u32 length) |
299 | { | 299 | { |
300 | if (state->dst_hw_cap & DST_TYPE_HAS_SESSION) { | 300 | if (state->dst_hw_cap & DST_TYPE_HAS_SESSION) { |
301 | hw_buffer->msg[2] = p_ca_message->msg[1]; /* MSB */ | 301 | hw_buffer->msg[2] = p_ca_message->msg[1]; /* MSB */ |
302 | hw_buffer->msg[3] = p_ca_message->msg[2]; /* LSB */ | 302 | hw_buffer->msg[3] = p_ca_message->msg[2]; /* LSB */ |
303 | } | 303 | } |
304 | else { | 304 | else { |
305 | hw_buffer->msg[0] = (length & 0xff) + 7; | ||
306 | hw_buffer->msg[1] = 0x40; | ||
305 | hw_buffer->msg[2] = 0x03; | 307 | hw_buffer->msg[2] = 0x03; |
306 | hw_buffer->msg[3] = 0x00; | 308 | hw_buffer->msg[3] = 0x00; |
309 | hw_buffer->msg[4] = 0x03; | ||
310 | hw_buffer->msg[5] = length & 0xff; | ||
311 | hw_buffer->msg[6] = 0x00; | ||
307 | } | 312 | } |
308 | return 0; | 313 | return 0; |
309 | } | 314 | } |
310 | 315 | ||
311 | static int debug_8820_buffer(struct ca_msg *hw_buffer) | ||
312 | { | ||
313 | unsigned int i; | ||
314 | |||
315 | dprintk("%s:Debug=[", __FUNCTION__); | ||
316 | for (i = 0; i < (hw_buffer->msg[0] + 1); i++) | ||
317 | dprintk(" %02x", hw_buffer->msg[i]); | ||
318 | dprintk("]\n"); | ||
319 | |||
320 | return 0; | ||
321 | } | ||
322 | 316 | ||
323 | static int write_to_8820(struct dst_state *state, struct ca_msg *hw_buffer, u8 reply) | 317 | static int write_to_8820(struct dst_state *state, struct ca_msg *hw_buffer, u8 length, u8 reply) |
324 | { | 318 | { |
325 | if ((dst_put_ci(state, hw_buffer->msg, (hw_buffer->length + 1), hw_buffer->msg, reply)) < 0) { | 319 | if ((dst_put_ci(state, hw_buffer->msg, length, hw_buffer->msg, reply)) < 0) { |
326 | dprintk("%s: DST-CI Command failed.\n", __FUNCTION__); | 320 | dprintk("%s: DST-CI Command failed.\n", __FUNCTION__); |
327 | dprintk("%s: Resetting DST.\n", __FUNCTION__); | 321 | dprintk("%s: Resetting DST.\n", __FUNCTION__); |
328 | rdc_reset_state(state); | 322 | rdc_reset_state(state); |
@@ -334,234 +328,141 @@ static int write_to_8820(struct dst_state *state, struct ca_msg *hw_buffer, u8 r | |||
334 | return 0; | 328 | return 0; |
335 | } | 329 | } |
336 | 330 | ||
337 | 331 | u32 asn_1_decode(u8 *asn_1_array) | |
338 | static int ca_set_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u8 reply, u8 query) | ||
339 | { | 332 | { |
340 | u32 hw_offset, buf_offset, i, k; | 333 | u8 length_field = 0, word_count = 0, count = 0; |
341 | u32 program_info_length = 0, es_info_length = 0, length = 0, words = 0; | 334 | u32 length = 0; |
342 | u8 found_prog_ca_desc = 0, found_stream_ca_desc = 0, error_condition = 0, hw_buffer_length = 0; | 335 | |
343 | 336 | length_field = asn_1_array[0]; | |
344 | if (verbose > 3) | 337 | dprintk("%s: Length field=[%02x]\n", __FUNCTION__, length_field); |
345 | dprintk("%s, p_ca_message length %d (0x%x)\n", __FUNCTION__,p_ca_message->length,p_ca_message->length ); | 338 | if (length_field < 0x80) { |
346 | 339 | length = length_field & 0x7f; | |
347 | handle_en50221_tag(state, p_ca_message, hw_buffer); /* EN50221 tag */ | 340 | dprintk("%s: Length=[%02x]\n", __FUNCTION__, length); |
348 | 341 | } else { | |
349 | /* Handle the length field (variable) */ | 342 | word_count = length_field & 0x7f; |
350 | if (!(p_ca_message->msg[3] & 0x80)) { /* Length = 1 */ | 343 | for (count = 0; count < word_count; count++) { |
351 | length = p_ca_message->msg[3] & 0x7f; | 344 | length = (length | asn_1_array[count + 1]) << 8; |
352 | words = 0; /* domi's suggestion */ | 345 | dprintk("%s: Length=[%04x]\n", __FUNCTION__, length); |
353 | } | ||
354 | else { /* Length = words */ | ||
355 | words = p_ca_message->msg[3] & 0x7f; | ||
356 | for (i = 0; i < words; i++) { | ||
357 | length = length << 8; | ||
358 | length = length | p_ca_message->msg[4 + i]; | ||
359 | } | 346 | } |
360 | } | 347 | } |
361 | if (verbose > 4) { | 348 | return length; |
362 | dprintk("%s:Length=[%d (0x%x)], Words=[%d]\n", __FUNCTION__, length,length, words); | 349 | } |
363 | |||
364 | /* Debug Input string */ | ||
365 | for (i = 0; i < length; i++) | ||
366 | dprintk(" %02x", p_ca_message->msg[i]); | ||
367 | dprintk("]\n"); | ||
368 | } | ||
369 | |||
370 | hw_offset = 7; | ||
371 | buf_offset = words + 4; | ||
372 | |||
373 | /* Program Header */ | ||
374 | if (verbose > 4) | ||
375 | dprintk("\n%s:Program Header=[", __FUNCTION__); | ||
376 | for (i = 0; i < 6; i++) { | ||
377 | hw_buffer->msg[hw_offset] = p_ca_message->msg[buf_offset]; | ||
378 | if (verbose > 4) | ||
379 | dprintk(" %02x", p_ca_message->msg[buf_offset]); | ||
380 | hw_offset++, buf_offset++, hw_buffer_length++; | ||
381 | } | ||
382 | if (verbose > 4) | ||
383 | dprintk("]\n"); | ||
384 | 350 | ||
385 | program_info_length = 0; | 351 | static int init_buffer(u8 *buffer, u32 length) |
386 | program_info_length = (((program_info_length | p_ca_message->msg[words + 8]) & 0x0f) << 8) | p_ca_message->msg[words + 9]; | 352 | { |
387 | if (verbose > 4) | 353 | u32 i; |
388 | dprintk("%s:Program info Length=[%d][%02x], hw_offset=[%d], buf_offset=[%d] \n", | 354 | for (i = 0; i < length; i++) |
389 | __FUNCTION__, program_info_length, program_info_length, hw_offset, buf_offset); | 355 | buffer[i] = 0; |
390 | 356 | ||
391 | if (program_info_length && (program_info_length < 256)) { /* If program_info_length */ | 357 | return 0; |
392 | hw_buffer->msg[11] = hw_buffer->msg[11] & 0x0f; /* req only 4 bits */ | 358 | } |
393 | hw_buffer->msg[12] = hw_buffer->msg[12] + 1; /* increment! ASIC bug! */ | ||
394 | 359 | ||
395 | if (p_ca_message->msg[buf_offset + 1] == 0x09) { /* Check CA descriptor */ | 360 | static int debug_string(u8 *msg, u32 length, u32 offset) |
396 | found_prog_ca_desc = 1; | 361 | { |
397 | if (verbose > 4) | 362 | u32 i; |
398 | dprintk("%s: Found CA descriptor @ Program level\n", __FUNCTION__); | ||
399 | } | ||
400 | 363 | ||
401 | if (found_prog_ca_desc) { /* Command only if CA descriptor */ | 364 | dprintk(" String=[ "); |
402 | hw_buffer->msg[13] = p_ca_message->msg[buf_offset]; /* CA PMT command ID */ | 365 | for (i = offset; i < length; i++) |
403 | hw_offset++, buf_offset++, hw_buffer_length++; | 366 | dprintk("%02x ", msg[i]); |
404 | } | 367 | dprintk("]\n"); |
405 | 368 | ||
406 | /* Program descriptors */ | 369 | return 0; |
407 | if (verbose > 4) { | 370 | } |
408 | dprintk("%s:**********>buf_offset=[%d], hw_offset=[%d]\n", __FUNCTION__, buf_offset, hw_offset); | ||
409 | dprintk("%s:Program descriptors=[", __FUNCTION__); | ||
410 | } | ||
411 | while (program_info_length && !error_condition) { /* Copy prog descriptors */ | ||
412 | if (program_info_length > p_ca_message->length) { /* Error situation */ | ||
413 | dprintk ("%s:\"WARNING\" Length error, line=[%d], prog_info_length=[%d]\n", | ||
414 | __FUNCTION__, __LINE__, program_info_length); | ||
415 | dprintk("%s:\"WARNING\" Bailing out of possible loop\n", __FUNCTION__); | ||
416 | error_condition = 1; | ||
417 | break; | ||
418 | } | ||
419 | 371 | ||
420 | hw_buffer->msg[hw_offset] = p_ca_message->msg[buf_offset]; | 372 | static int copy_string(u8 *destination, u8 *source, u32 dest_offset, u32 source_offset, u32 length) |
421 | dprintk(" %02x", p_ca_message->msg[buf_offset]); | 373 | { |
422 | hw_offset++, buf_offset++, hw_buffer_length++, program_info_length--; | 374 | u32 i; |
423 | } | 375 | dprintk("%s: Copying [", __FUNCTION__); |
424 | if (verbose > 4) { | 376 | for (i = 0; i < length; i++) { |
425 | dprintk("]\n"); | 377 | destination[i + dest_offset] = source[i + source_offset]; |
426 | dprintk("%s:**********>buf_offset=[%d], hw_offset=[%d]\n", __FUNCTION__, buf_offset, hw_offset); | 378 | dprintk(" %02x", source[i + source_offset]); |
427 | } | ||
428 | if (found_prog_ca_desc) { | ||
429 | if (!reply) { | ||
430 | hw_buffer->msg[13] = 0x01; /* OK descrambling */ | ||
431 | if (verbose > 1) | ||
432 | dprintk("CA PMT Command = OK Descrambling\n"); | ||
433 | } | ||
434 | else { | ||
435 | hw_buffer->msg[13] = 0x02; /* Ok MMI */ | ||
436 | if (verbose > 1) | ||
437 | dprintk("CA PMT Command = Ok MMI\n"); | ||
438 | } | ||
439 | if (query) { | ||
440 | hw_buffer->msg[13] = 0x03; /* Query */ | ||
441 | if (verbose > 1) | ||
442 | dprintk("CA PMT Command = CA PMT query\n"); | ||
443 | } | ||
444 | } | ||
445 | } | ||
446 | else { | ||
447 | hw_buffer->msg[11] = hw_buffer->msg[11] & 0xf0; /* Don't write to ASIC */ | ||
448 | hw_buffer->msg[12] = hw_buffer->msg[12] = 0x00; | ||
449 | } | 379 | } |
450 | if (verbose > 4) | 380 | dprintk("]\n"); |
451 | dprintk("%s:**********>p_ca_message->length=[%d], buf_offset=[%d], hw_offset=[%d]\n", | ||
452 | __FUNCTION__, p_ca_message->length, buf_offset, hw_offset); | ||
453 | |||
454 | while ((buf_offset < p_ca_message->length) && !error_condition) { | ||
455 | /* Bail out in case of an indefinite loop */ | ||
456 | if ((es_info_length > p_ca_message->length) || (buf_offset > p_ca_message->length)) { | ||
457 | dprintk("%s:\"WARNING\" Length error, line=[%d], prog_info_length=[%d], buf_offset=[%d]\n", | ||
458 | __FUNCTION__, __LINE__, program_info_length, buf_offset); | ||
459 | |||
460 | dprintk("%s:\"WARNING\" Bailing out of possible loop\n", __FUNCTION__); | ||
461 | error_condition = 1; | ||
462 | break; | ||
463 | } | ||
464 | |||
465 | /* Stream Header */ | ||
466 | |||
467 | for (k = 0; k < 5; k++) { | ||
468 | hw_buffer->msg[hw_offset + k] = p_ca_message->msg[buf_offset + k]; | ||
469 | } | ||
470 | 381 | ||
471 | es_info_length = 0; | 382 | return i; |
472 | es_info_length = (es_info_length | (p_ca_message->msg[buf_offset + 3] & 0x0f)) << 8 | p_ca_message->msg[buf_offset + 4]; | 383 | } |
473 | 384 | ||
474 | if (verbose > 4) { | 385 | static int modify_4_bits(u8 *message, u32 pos) |
475 | dprintk("\n%s:----->Stream header=[%02x %02x %02x %02x %02x]\n", __FUNCTION__, | 386 | { |
476 | p_ca_message->msg[buf_offset + 0], p_ca_message->msg[buf_offset + 1], | 387 | message[pos] &= 0x0f; |
477 | p_ca_message->msg[buf_offset + 2], p_ca_message->msg[buf_offset + 3], | ||
478 | p_ca_message->msg[buf_offset + 4]); | ||
479 | 388 | ||
480 | dprintk("%s:----->Stream type=[%02x], es length=[%d (0x%x)], Chars=[%02x] [%02x], buf_offset=[%d]\n", __FUNCTION__, | 389 | return 0; |
481 | p_ca_message->msg[buf_offset + 0], es_info_length, es_info_length, | 390 | } |
482 | p_ca_message->msg[buf_offset + 3], p_ca_message->msg[buf_offset + 4], buf_offset); | ||
483 | } | ||
484 | 391 | ||
485 | hw_buffer->msg[hw_offset + 3] &= 0x0f; /* req only 4 bits */ | ||
486 | 392 | ||
487 | if (found_prog_ca_desc) { | ||
488 | hw_buffer->msg[hw_offset + 3] = 0x00; | ||
489 | hw_buffer->msg[hw_offset + 4] = 0x00; | ||
490 | } | ||
491 | 393 | ||
492 | hw_offset += 5, buf_offset += 5, hw_buffer_length += 5; | 394 | static int ca_set_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u8 reply, u8 query) |
395 | { | ||
396 | u32 length = 0, count = 0; | ||
397 | u8 asn_1_words, program_header_length; | ||
398 | u16 program_info_length = 0, es_info_length = 0; | ||
399 | u32 hw_offset = 0, buf_offset = 0, i; | ||
400 | u8 dst_tag_length; | ||
493 | 401 | ||
494 | /* Check for CA descriptor */ | 402 | length = asn_1_decode(&p_ca_message->msg[3]); |
495 | if (p_ca_message->msg[buf_offset + 1] == 0x09) { | 403 | dprintk("%s: CA Message length=[%d]\n", __FUNCTION__, length); |
496 | if (verbose > 4) | 404 | dprintk("%s: ASN.1 ", __FUNCTION__); |
497 | dprintk("%s:Found CA descriptor @ Stream level\n", __FUNCTION__); | 405 | debug_string(&p_ca_message->msg[4], length, 0); // length does not include tag and length |
498 | found_stream_ca_desc = 1; | ||
499 | } | ||
500 | 406 | ||
501 | /* ES descriptors */ | 407 | init_buffer(hw_buffer->msg, length); |
502 | 408 | handle_dst_tag(state, p_ca_message, hw_buffer, length); | |
503 | if (es_info_length && !error_condition && !found_prog_ca_desc && found_stream_ca_desc) { | ||
504 | // if (!ca_pmt_done) { | ||
505 | hw_buffer->msg[hw_offset] = p_ca_message->msg[buf_offset]; /* CA PMT cmd(es) */ | ||
506 | if (verbose > 4) | ||
507 | printk("%s:----->CA PMT Command ID=[%02x]\n", __FUNCTION__, p_ca_message->msg[buf_offset]); | ||
508 | // hw_offset++, buf_offset++, hw_buffer_length++, es_info_length--, ca_pmt_done = 1; | ||
509 | hw_offset++, buf_offset++, hw_buffer_length++, es_info_length--; | ||
510 | // } | ||
511 | if (verbose > 4) | ||
512 | dprintk("%s:----->ES descriptors=[", __FUNCTION__); | ||
513 | |||
514 | while (es_info_length && !error_condition) { /* ES descriptors */ | ||
515 | if ((es_info_length > p_ca_message->length) || (buf_offset > p_ca_message->length)) { | ||
516 | if (verbose > 4) { | ||
517 | dprintk("%s:\"WARNING\" ES Length error, line=[%d], es_info_length=[%d], buf_offset=[%d]\n", | ||
518 | __FUNCTION__, __LINE__, es_info_length, buf_offset); | ||
519 | |||
520 | dprintk("%s:\"WARNING\" Bailing out of possible loop\n", __FUNCTION__); | ||
521 | } | ||
522 | error_condition = 1; | ||
523 | break; | ||
524 | } | ||
525 | 409 | ||
526 | hw_buffer->msg[hw_offset] = p_ca_message->msg[buf_offset]; | 410 | hw_offset = 7; |
527 | if (verbose > 3) | 411 | asn_1_words = 1; // just a hack to test, should compute this one |
528 | dprintk("%02x ", hw_buffer->msg[hw_offset]); | 412 | buf_offset = 3; |
529 | hw_offset++, buf_offset++, hw_buffer_length++, es_info_length--; | 413 | program_header_length = 6; |
530 | } | 414 | dst_tag_length = 7; |
531 | found_stream_ca_desc = 0; /* unset for new streams */ | 415 | |
532 | dprintk("]\n"); | 416 | // debug_twinhan_ca_params(state, p_ca_message, hw_buffer, reply, query, length, hw_offset, buf_offset); |
417 | // dprintk("%s: Program Header(BUF)", __FUNCTION__); | ||
418 | // debug_string(&p_ca_message->msg[4], program_header_length, 0); | ||
419 | // dprintk("%s: Copying Program header\n", __FUNCTION__); | ||
420 | copy_string(hw_buffer->msg, p_ca_message->msg, hw_offset, (buf_offset + asn_1_words), program_header_length); | ||
421 | buf_offset += program_header_length, hw_offset += program_header_length; | ||
422 | modify_4_bits(hw_buffer->msg, (hw_offset - 2)); | ||
423 | if (state->type_flags & DST_TYPE_HAS_INC_COUNT) { // workaround | ||
424 | dprintk("%s: Probably an ASIC bug !!!\n", __FUNCTION__); | ||
425 | debug_string(hw_buffer->msg, (hw_offset + program_header_length), 0); | ||
426 | hw_buffer->msg[hw_offset - 1] += 1; | ||
427 | } | ||
428 | |||
429 | // dprintk("%s: Program Header(HW), Count=[%d]", __FUNCTION__, count); | ||
430 | // debug_string(hw_buffer->msg, hw_offset, 0); | ||
431 | |||
432 | program_info_length = ((program_info_length | (p_ca_message->msg[buf_offset - 1] & 0x0f)) << 8) | p_ca_message->msg[buf_offset]; | ||
433 | dprintk("%s: Program info length=[%02x]\n", __FUNCTION__, program_info_length); | ||
434 | if (program_info_length) { | ||
435 | count = copy_string(hw_buffer->msg, p_ca_message->msg, hw_offset, (buf_offset + 1), (program_info_length + 1) ); // copy next elem, not current | ||
436 | buf_offset += count, hw_offset += count; | ||
437 | // dprintk("%s: Program level ", __FUNCTION__); | ||
438 | // debug_string(hw_buffer->msg, hw_offset, 0); | ||
439 | } | ||
440 | |||
441 | buf_offset += 1;// hw_offset += 1; | ||
442 | for (i = buf_offset; i < length; i++) { | ||
443 | // dprintk("%s: Stream Header ", __FUNCTION__); | ||
444 | count = copy_string(hw_buffer->msg, p_ca_message->msg, hw_offset, buf_offset, 5); | ||
445 | modify_4_bits(hw_buffer->msg, (hw_offset + 3)); | ||
446 | |||
447 | hw_offset += 5, buf_offset += 5, i += 4; | ||
448 | // debug_string(hw_buffer->msg, hw_offset, (hw_offset - 5)); | ||
449 | es_info_length = ((es_info_length | (p_ca_message->msg[buf_offset - 1] & 0x0f)) << 8) | p_ca_message->msg[buf_offset]; | ||
450 | dprintk("%s: ES info length=[%02x]\n", __FUNCTION__, es_info_length); | ||
451 | if (es_info_length) { | ||
452 | // copy descriptors @ STREAM level | ||
453 | dprintk("%s: Descriptors @ STREAM level...!!! \n", __FUNCTION__); | ||
533 | } | 454 | } |
534 | } | ||
535 | |||
536 | /* MCU Magic words */ | ||
537 | |||
538 | hw_buffer_length += 7; | ||
539 | hw_buffer->msg[0] = hw_buffer_length; | ||
540 | hw_buffer->msg[1] = 64; | ||
541 | hw_buffer->msg[4] = 3; | ||
542 | hw_buffer->msg[5] = hw_buffer->msg[0] - 7; | ||
543 | hw_buffer->msg[6] = 0; | ||
544 | |||
545 | 455 | ||
546 | /* Fix length */ | ||
547 | hw_buffer->length = hw_buffer->msg[0]; | ||
548 | |||
549 | put_checksum(&hw_buffer->msg[0], hw_buffer->msg[0]); | ||
550 | /* Do the actual write */ | ||
551 | if (verbose > 4) { | ||
552 | dprintk("%s:======================DEBUGGING================================\n", __FUNCTION__); | ||
553 | dprintk("%s: Actual Length=[%d]\n", __FUNCTION__, hw_buffer_length); | ||
554 | } | 456 | } |
555 | /* Only for debugging! */ | 457 | hw_buffer->msg[length + dst_tag_length] = dst_check_sum(hw_buffer->msg, (length + dst_tag_length)); |
556 | if (verbose > 2) | 458 | // dprintk("%s: Total length=[%d], Checksum=[%02x]\n", __FUNCTION__, (length + dst_tag_length), hw_buffer->msg[length + dst_tag_length]); |
557 | debug_8820_buffer(hw_buffer); | 459 | debug_string(hw_buffer->msg, (length + dst_tag_length + 1), 0); // dst tags also |
558 | if (verbose > 3) | 460 | write_to_8820(state, hw_buffer, (length + dst_tag_length + 1), reply); // checksum |
559 | dprintk("%s: Reply = [%d]\n", __FUNCTION__, reply); | ||
560 | write_to_8820(state, hw_buffer, reply); | ||
561 | 461 | ||
562 | return 0; | 462 | return 0; |
563 | } | 463 | } |
564 | 464 | ||
465 | |||
565 | /* Board supports CA PMT reply ? */ | 466 | /* Board supports CA PMT reply ? */ |
566 | static int dst_check_ca_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer) | 467 | static int dst_check_ca_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer) |
567 | { | 468 | { |
@@ -605,7 +506,7 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, | |||
605 | struct ca_msg *hw_buffer; | 506 | struct ca_msg *hw_buffer; |
606 | 507 | ||
607 | if ((hw_buffer = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { | 508 | if ((hw_buffer = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { |
608 | printk("%s: Memory allocation failure\n", __FUNCTION__); | 509 | dprintk("%s: Memory allocation failure\n", __FUNCTION__); |
609 | return -ENOMEM; | 510 | return -ENOMEM; |
610 | } | 511 | } |
611 | if (verbose > 3) | 512 | if (verbose > 3) |
@@ -630,8 +531,10 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, | |||
630 | switch (command) { | 531 | switch (command) { |
631 | case CA_PMT: | 532 | case CA_PMT: |
632 | if (verbose > 3) | 533 | if (verbose > 3) |
534 | // dprintk("Command = SEND_CA_PMT\n"); | ||
633 | dprintk("Command = SEND_CA_PMT\n"); | 535 | dprintk("Command = SEND_CA_PMT\n"); |
634 | if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) { | 536 | // if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) { |
537 | if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) { // code simplification started | ||
635 | dprintk("%s: -->CA_PMT Failed !\n", __FUNCTION__); | 538 | dprintk("%s: -->CA_PMT Failed !\n", __FUNCTION__); |
636 | return -1; | 539 | return -1; |
637 | } | 540 | } |
@@ -664,7 +567,7 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, | |||
664 | return -1; | 567 | return -1; |
665 | } | 568 | } |
666 | if (verbose > 3) | 569 | if (verbose > 3) |
667 | printk("%s: -->CA_APP_INFO_ENQUIRY Success !\n", __FUNCTION__); | 570 | dprintk("%s: -->CA_APP_INFO_ENQUIRY Success !\n", __FUNCTION__); |
668 | 571 | ||
669 | break; | 572 | break; |
670 | } | 573 | } |
@@ -681,17 +584,17 @@ static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
681 | struct ca_msg *p_ca_message; | 584 | struct ca_msg *p_ca_message; |
682 | 585 | ||
683 | if ((p_ca_message = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { | 586 | if ((p_ca_message = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { |
684 | printk("%s: Memory allocation failure\n", __FUNCTION__); | 587 | dprintk("%s: Memory allocation failure\n", __FUNCTION__); |
685 | return -ENOMEM; | 588 | return -ENOMEM; |
686 | } | 589 | } |
687 | 590 | ||
688 | if ((p_ca_slot_info = (struct ca_slot_info *) kmalloc(sizeof (struct ca_slot_info), GFP_KERNEL)) == NULL) { | 591 | if ((p_ca_slot_info = (struct ca_slot_info *) kmalloc(sizeof (struct ca_slot_info), GFP_KERNEL)) == NULL) { |
689 | printk("%s: Memory allocation failure\n", __FUNCTION__); | 592 | dprintk("%s: Memory allocation failure\n", __FUNCTION__); |
690 | return -ENOMEM; | 593 | return -ENOMEM; |
691 | } | 594 | } |
692 | 595 | ||
693 | if ((p_ca_caps = (struct ca_caps *) kmalloc(sizeof (struct ca_caps), GFP_KERNEL)) == NULL) { | 596 | if ((p_ca_caps = (struct ca_caps *) kmalloc(sizeof (struct ca_caps), GFP_KERNEL)) == NULL) { |
694 | printk("%s: Memory allocation failure\n", __FUNCTION__); | 597 | dprintk("%s: Memory allocation failure\n", __FUNCTION__); |
695 | return -ENOMEM; | 598 | return -ENOMEM; |
696 | } | 599 | } |
697 | 600 | ||
diff --git a/drivers/media/dvb/bt8xx/dst_common.h b/drivers/media/dvb/bt8xx/dst_common.h index 0b3da29245fb..ef532a6aceaa 100644 --- a/drivers/media/dvb/bt8xx/dst_common.h +++ b/drivers/media/dvb/bt8xx/dst_common.h | |||
@@ -47,6 +47,8 @@ | |||
47 | #define DST_TYPE_HAS_FW_2 16 | 47 | #define DST_TYPE_HAS_FW_2 16 |
48 | #define DST_TYPE_HAS_FW_3 32 | 48 | #define DST_TYPE_HAS_FW_3 32 |
49 | #define DST_TYPE_HAS_FW_BUILD 64 | 49 | #define DST_TYPE_HAS_FW_BUILD 64 |
50 | #define DST_TYPE_HAS_OBS_REGS 128 | ||
51 | #define DST_TYPE_HAS_INC_COUNT 256 | ||
50 | 52 | ||
51 | /* Card capability list */ | 53 | /* Card capability list */ |
52 | 54 | ||
@@ -110,6 +112,7 @@ struct dst_state { | |||
110 | u32 dst_hw_cap; | 112 | u32 dst_hw_cap; |
111 | u8 dst_fw_version; | 113 | u8 dst_fw_version; |
112 | fe_sec_mini_cmd_t minicmd; | 114 | fe_sec_mini_cmd_t minicmd; |
115 | fe_modulation_t modulation; | ||
113 | u8 messages[256]; | 116 | u8 messages[256]; |
114 | }; | 117 | }; |
115 | 118 | ||
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index 96c57fde95a0..7d8b3cad350b 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -699,6 +699,8 @@ static void cinergyt2_query_rc (void *data) | |||
699 | for (n=0; len>0 && n<(len/sizeof(rc_events[0])); n++) { | 699 | for (n=0; len>0 && n<(len/sizeof(rc_events[0])); n++) { |
700 | int i; | 700 | int i; |
701 | 701 | ||
702 | /* dprintk(1,"rc_events[%d].value = %x, type=%x\n",n,le32_to_cpu(rc_events[n].value),rc_events[n].type);*/ | ||
703 | |||
702 | if (rc_events[n].type == CINERGYT2_RC_EVENT_TYPE_NEC && | 704 | if (rc_events[n].type == CINERGYT2_RC_EVENT_TYPE_NEC && |
703 | rc_events[n].value == ~0) | 705 | rc_events[n].value == ~0) |
704 | { | 706 | { |
@@ -714,7 +716,7 @@ static void cinergyt2_query_rc (void *data) | |||
714 | cinergyt2->rc_input_event = KEY_MAX; | 716 | cinergyt2->rc_input_event = KEY_MAX; |
715 | for (i=0; i<sizeof(rc_keys)/sizeof(rc_keys[0]); i+=3) { | 717 | for (i=0; i<sizeof(rc_keys)/sizeof(rc_keys[0]); i+=3) { |
716 | if (rc_keys[i+0] == rc_events[n].type && | 718 | if (rc_keys[i+0] == rc_events[n].type && |
717 | rc_keys[i+1] == rc_events[n].value) | 719 | rc_keys[i+1] == le32_to_cpu(rc_events[n].value)) |
718 | { | 720 | { |
719 | cinergyt2->rc_input_event = rc_keys[i+2]; | 721 | cinergyt2->rc_input_event = rc_keys[i+2]; |
720 | break; | 722 | break; |
diff --git a/drivers/media/dvb/dibusb/Kconfig b/drivers/media/dvb/dibusb/Kconfig deleted file mode 100644 index 74dfc73ae5b0..000000000000 --- a/drivers/media/dvb/dibusb/Kconfig +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | config DVB_DIBUSB | ||
2 | tristate "DiBcom USB DVB-T devices (see help for a complete device list)" | ||
3 | depends on DVB_CORE && USB | ||
4 | select FW_LOADER | ||
5 | select DVB_DIB3000MB | ||
6 | select DVB_DIB3000MC | ||
7 | select DVB_MT352 | ||
8 | help | ||
9 | Support for USB 1.1 and 2.0 DVB-T devices based on reference designs made by | ||
10 | DiBcom (http://www.dibcom.fr) and C&E. | ||
11 | |||
12 | Devices supported by this driver: | ||
13 | |||
14 | TwinhanDTV USB-Ter (VP7041) | ||
15 | TwinhanDTV Magic Box (VP7041e) | ||
16 | KWorld/JetWay/ADSTech V-Stream XPERT DTV - DVB-T USB1.1 and USB2.0 | ||
17 | Hama DVB-T USB-Box | ||
18 | DiBcom reference devices (non-public) | ||
19 | Ultima Electronic/Artec T1 USB TVBOX | ||
20 | Compro Videomate DVB-U2000 - DVB-T USB | ||
21 | Grandtec DVB-T USB | ||
22 | Avermedia AverTV DVBT USB | ||
23 | Artec T1 USB1.1 and USB2.0 boxes | ||
24 | Yakumo/Typhoon DVB-T USB2.0 | ||
25 | Hanftek UMT-010 USB2.0 | ||
26 | Hauppauge WinTV NOVA-T USB2 | ||
27 | |||
28 | The VP7041 seems to be identical to "CTS Portable" (Chinese | ||
29 | Television System). | ||
30 | |||
31 | These devices can be understood as budget ones, they "only" deliver | ||
32 | (a part of) the MPEG2 transport stream. | ||
33 | |||
34 | A firmware is needed to get the device working. See Documentation/dvb/README.dibusb | ||
35 | details. | ||
36 | |||
37 | Say Y if you own such a device and want to use it. You should build it as | ||
38 | a module. | ||
39 | |||
40 | config DVB_DIBUSB_MISDESIGNED_DEVICES | ||
41 | bool "Enable support for some misdesigned (see help) devices, which identify with wrong IDs" | ||
42 | depends on DVB_DIBUSB | ||
43 | help | ||
44 | Somehow Artec/Ultima Electronic forgot to program the eeprom of some of their | ||
45 | USB1.1/USB2.0 devices. | ||
46 | So comes that they identify with the default Vendor and Product ID of the Cypress | ||
47 | CY7C64613 (AN2235) or Cypress FX2. | ||
48 | |||
49 | Affected device IDs: | ||
50 | 0x0574:0x2235 (Artec T1 USB1.1, cold) | ||
51 | 0x04b4:0x8613 (Artec T1 USB2.0, cold) | ||
52 | 0x0574:0x1002 (Artec T1 USB2.0, warm) | ||
53 | 0x0574:0x2131 (aged DiBcom USB1.1 test device) | ||
54 | |||
55 | Say Y if your device has one of the mentioned IDs. | ||
56 | |||
57 | config DVB_DIBCOM_DEBUG | ||
58 | bool "Enable extended debug support for DiBcom USB device" | ||
59 | depends on DVB_DIBUSB | ||
60 | help | ||
61 | Say Y if you want to enable debuging. See modinfo dvb-dibusb for | ||
62 | debug levels. | ||
diff --git a/drivers/media/dvb/dibusb/Makefile b/drivers/media/dvb/dibusb/Makefile deleted file mode 100644 index e941c508624e..000000000000 --- a/drivers/media/dvb/dibusb/Makefile +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | dvb-dibusb-objs = dvb-dibusb-core.o \ | ||
2 | dvb-dibusb-dvb.o \ | ||
3 | dvb-dibusb-fe-i2c.o \ | ||
4 | dvb-dibusb-firmware.o \ | ||
5 | dvb-dibusb-remote.o \ | ||
6 | dvb-dibusb-usb.o \ | ||
7 | dvb-fe-dtt200u.o | ||
8 | |||
9 | obj-$(CONFIG_DVB_DIBUSB) += dvb-dibusb.o | ||
10 | |||
11 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb-core.c b/drivers/media/dvb/dibusb/dvb-dibusb-core.c deleted file mode 100644 index 26235f9247e4..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb-core.c +++ /dev/null | |||
@@ -1,558 +0,0 @@ | |||
1 | /* | ||
2 | * Driver for mobile USB Budget DVB-T devices based on reference | ||
3 | * design made by DiBcom (http://www.dibcom.fr/) | ||
4 | * | ||
5 | * dvb-dibusb-core.c | ||
6 | * | ||
7 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
8 | * | ||
9 | * based on GPL code from DiBcom, which has | ||
10 | * Copyright (C) 2004 Amaury Demol for DiBcom (ademol@dibcom.fr) | ||
11 | * | ||
12 | * Remote control code added by David Matthews (dm@prolingua.co.uk) | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License as | ||
16 | * published by the Free Software Foundation, version 2. | ||
17 | * | ||
18 | * Acknowledgements | ||
19 | * | ||
20 | * Amaury Demol (ademol@dibcom.fr) from DiBcom for providing specs and driver | ||
21 | * sources, on which this driver (and the dib3000mb/mc/p frontends) are based. | ||
22 | * | ||
23 | * see Documentation/dvb/README.dibusb for more information | ||
24 | */ | ||
25 | #include "dvb-dibusb.h" | ||
26 | |||
27 | #include <linux/moduleparam.h> | ||
28 | |||
29 | /* debug */ | ||
30 | int dvb_dibusb_debug; | ||
31 | module_param_named(debug, dvb_dibusb_debug, int, 0644); | ||
32 | |||
33 | #ifdef CONFIG_DVB_DIBCOM_DEBUG | ||
34 | #define DBSTATUS "" | ||
35 | #else | ||
36 | #define DBSTATUS " (debugging is not enabled)" | ||
37 | #endif | ||
38 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=alotmore,8=ts,16=err,32=rc (|-able))." DBSTATUS); | ||
39 | #undef DBSTATUS | ||
40 | |||
41 | static int pid_parse; | ||
42 | module_param(pid_parse, int, 0644); | ||
43 | MODULE_PARM_DESC(pid_parse, "enable pid parsing (filtering) when running at USB2.0"); | ||
44 | |||
45 | static int rc_query_interval = 100; | ||
46 | module_param(rc_query_interval, int, 0644); | ||
47 | MODULE_PARM_DESC(rc_query_interval, "interval in msecs for remote control query (default: 100; min: 40)"); | ||
48 | |||
49 | static int rc_key_repeat_count = 2; | ||
50 | module_param(rc_key_repeat_count, int, 0644); | ||
51 | MODULE_PARM_DESC(rc_key_repeat_count, "how many key repeats will be dropped before passing the key event again (default: 2)"); | ||
52 | |||
53 | /* Vendor IDs */ | ||
54 | #define USB_VID_ADSTECH 0x06e1 | ||
55 | #define USB_VID_ANCHOR 0x0547 | ||
56 | #define USB_VID_AVERMEDIA 0x14aa | ||
57 | #define USB_VID_COMPRO 0x185b | ||
58 | #define USB_VID_COMPRO_UNK 0x145f | ||
59 | #define USB_VID_CYPRESS 0x04b4 | ||
60 | #define USB_VID_DIBCOM 0x10b8 | ||
61 | #define USB_VID_EMPIA 0xeb1a | ||
62 | #define USB_VID_GRANDTEC 0x5032 | ||
63 | #define USB_VID_HANFTEK 0x15f4 | ||
64 | #define USB_VID_HAUPPAUGE 0x2040 | ||
65 | #define USB_VID_HYPER_PALTEK 0x1025 | ||
66 | #define USB_VID_IMC_NETWORKS 0x13d3 | ||
67 | #define USB_VID_TWINHAN 0x1822 | ||
68 | #define USB_VID_ULTIMA_ELECTRONIC 0x05d8 | ||
69 | |||
70 | /* Product IDs */ | ||
71 | #define USB_PID_ADSTECH_USB2_COLD 0xa333 | ||
72 | #define USB_PID_ADSTECH_USB2_WARM 0xa334 | ||
73 | #define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001 | ||
74 | #define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002 | ||
75 | #define USB_PID_COMPRO_DVBU2000_COLD 0xd000 | ||
76 | #define USB_PID_COMPRO_DVBU2000_WARM 0xd001 | ||
77 | #define USB_PID_COMPRO_DVBU2000_UNK_COLD 0x010c | ||
78 | #define USB_PID_COMPRO_DVBU2000_UNK_WARM 0x010d | ||
79 | #define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8 | ||
80 | #define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9 | ||
81 | #define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6 | ||
82 | #define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7 | ||
83 | #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 | ||
84 | #define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 | ||
85 | #define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 | ||
86 | #define USB_PID_KWORLD_VSTREAM_COLD 0x17de | ||
87 | #define USB_PID_KWORLD_VSTREAM_WARM 0x17df | ||
88 | #define USB_PID_TWINHAN_VP7041_COLD 0x3201 | ||
89 | #define USB_PID_TWINHAN_VP7041_WARM 0x3202 | ||
90 | #define USB_PID_ULTIMA_TVBOX_COLD 0x8105 | ||
91 | #define USB_PID_ULTIMA_TVBOX_WARM 0x8106 | ||
92 | #define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107 | ||
93 | #define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108 | ||
94 | #define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235 | ||
95 | #define USB_PID_ULTIMA_TVBOX_USB2_COLD 0x8109 | ||
96 | #define USB_PID_ULTIMA_TVBOX_USB2_FX_COLD 0x8613 | ||
97 | #define USB_PID_ULTIMA_TVBOX_USB2_FX_WARM 0x1002 | ||
98 | #define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e | ||
99 | #define USB_PID_UNK_HYPER_PALTEK_WARM 0x005f | ||
100 | #define USB_PID_HANFTEK_UMT_010_COLD 0x0001 | ||
101 | #define USB_PID_HANFTEK_UMT_010_WARM 0x0015 | ||
102 | #define USB_PID_YAKUMO_DTT200U_COLD 0x0201 | ||
103 | #define USB_PID_YAKUMO_DTT200U_WARM 0x0301 | ||
104 | #define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 | ||
105 | #define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 | ||
106 | |||
107 | /* USB Driver stuff | ||
108 | * table of devices that this driver is working with | ||
109 | * | ||
110 | * ATTENTION: Never ever change the order of this table, the particular | ||
111 | * devices depend on this order | ||
112 | * | ||
113 | * Each entry is used as a reference in the device_struct. Currently this is | ||
114 | * the only non-redundant way of assigning USB ids to actual devices I'm aware | ||
115 | * of, because there is only one place in the code where the assignment of | ||
116 | * vendor and product id is done, here. | ||
117 | */ | ||
118 | static struct usb_device_id dib_table [] = { | ||
119 | /* 00 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_COLD)}, | ||
120 | /* 01 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_WARM)}, | ||
121 | /* 02 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_COLD) }, | ||
122 | /* 03 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_WARM) }, | ||
123 | |||
124 | /* 04 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_COLD) }, | ||
125 | /* 05 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_WARM) }, | ||
126 | /* 06 */ { USB_DEVICE(USB_VID_COMPRO_UNK, USB_PID_COMPRO_DVBU2000_UNK_COLD) }, | ||
127 | /* 07 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_COLD) }, | ||
128 | /* 08 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_WARM) }, | ||
129 | /* 09 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_COLD) }, | ||
130 | /* 10 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_WARM) }, | ||
131 | /* 11 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_COLD) }, | ||
132 | /* 12 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_WARM) }, | ||
133 | /* 13 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_COLD) }, | ||
134 | /* 14 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_WARM) }, | ||
135 | /* 15 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_COLD) }, | ||
136 | /* 16 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_WARM) }, | ||
137 | /* 17 */ { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_COLD) }, | ||
138 | /* 18 */ { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_WARM) }, | ||
139 | /* 19 */ { USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_COLD) }, | ||
140 | /* 20 */ { USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_WARM) }, | ||
141 | /* 21 */ { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_COLD) }, | ||
142 | /* 22 */ { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_WARM) }, | ||
143 | /* 23 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_COLD) }, | ||
144 | /* 24 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_WARM) }, | ||
145 | /* 25 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_COLD) }, | ||
146 | /* 26 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_WARM) }, | ||
147 | /* 27 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_COLD) }, | ||
148 | |||
149 | /* 28 */ { USB_DEVICE(USB_VID_HANFTEK, USB_PID_HANFTEK_UMT_010_COLD) }, | ||
150 | /* 29 */ { USB_DEVICE(USB_VID_HANFTEK, USB_PID_HANFTEK_UMT_010_WARM) }, | ||
151 | |||
152 | /* 30 */ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_WINTV_NOVA_T_USB2_COLD) }, | ||
153 | /* 31 */ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_WINTV_NOVA_T_USB2_WARM) }, | ||
154 | /* 32 */ { USB_DEVICE(USB_VID_ADSTECH, USB_PID_ADSTECH_USB2_COLD) }, | ||
155 | /* 33 */ { USB_DEVICE(USB_VID_ADSTECH, USB_PID_ADSTECH_USB2_WARM) }, | ||
156 | /* | ||
157 | * activate the following define when you have one of the devices and want to | ||
158 | * build it from build-2.6 in dvb-kernel | ||
159 | */ | ||
160 | // #define CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES | ||
161 | #ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES | ||
162 | /* 34 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) }, | ||
163 | /* 35 */ { USB_DEVICE(USB_VID_CYPRESS, USB_PID_ULTIMA_TVBOX_USB2_FX_COLD) }, | ||
164 | /* 36 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_USB2_FX_WARM) }, | ||
165 | /* 37 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_DIBCOM_ANCHOR_2135_COLD) }, | ||
166 | #endif | ||
167 | { } /* Terminating entry */ | ||
168 | }; | ||
169 | |||
170 | MODULE_DEVICE_TABLE (usb, dib_table); | ||
171 | |||
172 | static struct dibusb_usb_controller dibusb_usb_ctrl[] = { | ||
173 | { .name = "Cypress AN2135", .cpu_cs_register = 0x7f92 }, | ||
174 | { .name = "Cypress AN2235", .cpu_cs_register = 0x7f92 }, | ||
175 | { .name = "Cypress FX2", .cpu_cs_register = 0xe600 }, | ||
176 | }; | ||
177 | |||
178 | struct dibusb_tuner dibusb_tuner[] = { | ||
179 | { DIBUSB_TUNER_CABLE_THOMSON, | ||
180 | 0x61 | ||
181 | }, | ||
182 | { DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5, | ||
183 | 0x60 | ||
184 | }, | ||
185 | { DIBUSB_TUNER_CABLE_LG_TDTP_E102P, | ||
186 | 0x61 | ||
187 | }, | ||
188 | { DIBUSB_TUNER_COFDM_PANASONIC_ENV77H11D5, | ||
189 | 0x60 | ||
190 | }, | ||
191 | }; | ||
192 | |||
193 | static struct dibusb_demod dibusb_demod[] = { | ||
194 | { DIBUSB_DIB3000MB, | ||
195 | 16, | ||
196 | { 0x8, 0 }, | ||
197 | }, | ||
198 | { DIBUSB_DIB3000MC, | ||
199 | 32, | ||
200 | { 0x9, 0xa, 0xb, 0xc }, | ||
201 | }, | ||
202 | { DIBUSB_MT352, | ||
203 | 254, | ||
204 | { 0xf, 0 }, | ||
205 | }, | ||
206 | { DTT200U_FE, | ||
207 | 8, | ||
208 | { 0xff,0 }, /* there is no i2c bus in this device */ | ||
209 | } | ||
210 | }; | ||
211 | |||
212 | static struct dibusb_device_class dibusb_device_classes[] = { | ||
213 | { .id = DIBUSB1_1, .usb_ctrl = &dibusb_usb_ctrl[0], | ||
214 | .firmware = "dvb-dibusb-5.0.0.11.fw", | ||
215 | .pipe_cmd = 0x01, .pipe_data = 0x02, | ||
216 | .urb_count = 7, .urb_buffer_size = 4096, | ||
217 | DIBUSB_RC_NEC_PROTOCOL, | ||
218 | &dibusb_demod[DIBUSB_DIB3000MB], | ||
219 | &dibusb_tuner[DIBUSB_TUNER_CABLE_THOMSON], | ||
220 | }, | ||
221 | { DIBUSB1_1_AN2235, &dibusb_usb_ctrl[1], | ||
222 | "dvb-dibusb-an2235-1.fw", | ||
223 | 0x01, 0x02, | ||
224 | 7, 4096, | ||
225 | DIBUSB_RC_NEC_PROTOCOL, | ||
226 | &dibusb_demod[DIBUSB_DIB3000MB], | ||
227 | &dibusb_tuner[DIBUSB_TUNER_CABLE_THOMSON], | ||
228 | }, | ||
229 | { DIBUSB2_0,&dibusb_usb_ctrl[2], | ||
230 | "dvb-dibusb-6.0.0.5.fw", | ||
231 | 0x01, 0x06, | ||
232 | 7, 4096, | ||
233 | DIBUSB_RC_NEC_PROTOCOL, | ||
234 | &dibusb_demod[DIBUSB_DIB3000MC], | ||
235 | &dibusb_tuner[DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5], | ||
236 | }, | ||
237 | { UMT2_0, &dibusb_usb_ctrl[2], | ||
238 | "dvb-dibusb-umt-2.fw", | ||
239 | 0x01, 0x06, | ||
240 | 20, 512, | ||
241 | DIBUSB_RC_NO, | ||
242 | &dibusb_demod[DIBUSB_MT352], | ||
243 | &dibusb_tuner[DIBUSB_TUNER_CABLE_LG_TDTP_E102P], | ||
244 | }, | ||
245 | { DIBUSB2_0B,&dibusb_usb_ctrl[2], | ||
246 | "dvb-dibusb-adstech-usb2-1.fw", | ||
247 | 0x01, 0x06, | ||
248 | 7, 4096, | ||
249 | DIBUSB_RC_NEC_PROTOCOL, | ||
250 | &dibusb_demod[DIBUSB_DIB3000MB], | ||
251 | &dibusb_tuner[DIBUSB_TUNER_CABLE_THOMSON], | ||
252 | }, | ||
253 | { NOVAT_USB2,&dibusb_usb_ctrl[2], | ||
254 | "dvb-dibusb-nova-t-1.fw", | ||
255 | 0x01, 0x06, | ||
256 | 7, 4096, | ||
257 | DIBUSB_RC_HAUPPAUGE_PROTO, | ||
258 | &dibusb_demod[DIBUSB_DIB3000MC], | ||
259 | &dibusb_tuner[DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5], | ||
260 | }, | ||
261 | { DTT200U,&dibusb_usb_ctrl[2], | ||
262 | "dvb-dtt200u-1.fw", | ||
263 | 0x01, 0x02, | ||
264 | 7, 4096, | ||
265 | DIBUSB_RC_NO, | ||
266 | &dibusb_demod[DTT200U_FE], | ||
267 | NULL, /* no explicit tuner/pll-programming necessary (it has the ENV57H1XD5) */ | ||
268 | }, | ||
269 | }; | ||
270 | |||
271 | static struct dibusb_usb_device dibusb_devices[] = { | ||
272 | { "TwinhanDTV USB1.1 / Magic Box / HAMA USB1.1 DVB-T device", | ||
273 | &dibusb_device_classes[DIBUSB1_1], | ||
274 | { &dib_table[19], &dib_table[21], NULL}, | ||
275 | { &dib_table[20], &dib_table[22], NULL}, | ||
276 | }, | ||
277 | { "KWorld V-Stream XPERT DTV - DVB-T USB1.1", | ||
278 | &dibusb_device_classes[DIBUSB1_1], | ||
279 | { &dib_table[11], NULL }, | ||
280 | { &dib_table[12], NULL }, | ||
281 | }, | ||
282 | { "Grandtec USB1.1 DVB-T", | ||
283 | &dibusb_device_classes[DIBUSB1_1], | ||
284 | { &dib_table[13], &dib_table[15], NULL }, | ||
285 | { &dib_table[14], &dib_table[16], NULL }, | ||
286 | }, | ||
287 | { "DiBcom USB1.1 DVB-T reference design (MOD3000)", | ||
288 | &dibusb_device_classes[DIBUSB1_1], | ||
289 | { &dib_table[7], NULL }, | ||
290 | { &dib_table[8], NULL }, | ||
291 | }, | ||
292 | { "Artec T1 USB1.1 TVBOX with AN2135", | ||
293 | &dibusb_device_classes[DIBUSB1_1], | ||
294 | { &dib_table[23], NULL }, | ||
295 | { &dib_table[24], NULL }, | ||
296 | }, | ||
297 | { "Artec T1 USB1.1 TVBOX with AN2235", | ||
298 | &dibusb_device_classes[DIBUSB1_1_AN2235], | ||
299 | { &dib_table[25], NULL }, | ||
300 | { &dib_table[26], NULL }, | ||
301 | }, | ||
302 | { "Avermedia AverTV DVBT USB1.1", | ||
303 | &dibusb_device_classes[DIBUSB1_1], | ||
304 | { &dib_table[0], NULL }, | ||
305 | { &dib_table[1], NULL }, | ||
306 | }, | ||
307 | { "Compro Videomate DVB-U2000 - DVB-T USB1.1 (please confirm to linux-dvb)", | ||
308 | &dibusb_device_classes[DIBUSB1_1], | ||
309 | { &dib_table[4], &dib_table[6], NULL}, | ||
310 | { &dib_table[5], NULL }, | ||
311 | }, | ||
312 | { "Unkown USB1.1 DVB-T device ???? please report the name to the author", | ||
313 | &dibusb_device_classes[DIBUSB1_1], | ||
314 | { &dib_table[17], NULL }, | ||
315 | { &dib_table[18], NULL }, | ||
316 | }, | ||
317 | { "DiBcom USB2.0 DVB-T reference design (MOD3000P)", | ||
318 | &dibusb_device_classes[DIBUSB2_0], | ||
319 | { &dib_table[9], NULL }, | ||
320 | { &dib_table[10], NULL }, | ||
321 | }, | ||
322 | { "Artec T1 USB2.0 TVBOX (please report the warm ID)", | ||
323 | &dibusb_device_classes[DIBUSB2_0], | ||
324 | { &dib_table[27], NULL }, | ||
325 | { NULL }, | ||
326 | }, | ||
327 | { "Hauppauge WinTV NOVA-T USB2", | ||
328 | &dibusb_device_classes[NOVAT_USB2], | ||
329 | { &dib_table[30], NULL }, | ||
330 | { &dib_table[31], NULL }, | ||
331 | }, | ||
332 | { "DTT200U (Yakumo/Hama/Typhoon) DVB-T USB2.0", | ||
333 | &dibusb_device_classes[DTT200U], | ||
334 | { &dib_table[2], NULL }, | ||
335 | { &dib_table[3], NULL }, | ||
336 | }, | ||
337 | { "Hanftek UMT-010 DVB-T USB2.0", | ||
338 | &dibusb_device_classes[UMT2_0], | ||
339 | { &dib_table[28], NULL }, | ||
340 | { &dib_table[29], NULL }, | ||
341 | }, | ||
342 | { "KWorld/ADSTech Instant DVB-T USB 2.0", | ||
343 | &dibusb_device_classes[DIBUSB2_0B], | ||
344 | { &dib_table[32], NULL }, | ||
345 | { &dib_table[33], NULL }, /* device ID with default DIBUSB2_0-firmware */ | ||
346 | }, | ||
347 | #ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES | ||
348 | { "Artec T1 USB1.1 TVBOX with AN2235 (misdesigned)", | ||
349 | &dibusb_device_classes[DIBUSB1_1_AN2235], | ||
350 | { &dib_table[34], NULL }, | ||
351 | { NULL }, | ||
352 | }, | ||
353 | { "Artec T1 USB2.0 TVBOX with FX2 IDs (misdesigned, please report the warm ID)", | ||
354 | &dibusb_device_classes[DTT200U], | ||
355 | { &dib_table[35], NULL }, | ||
356 | { &dib_table[36], NULL }, /* undefined, it could be that the device will get another USB ID in warm state */ | ||
357 | }, | ||
358 | { "DiBcom USB1.1 DVB-T reference design (MOD3000) with AN2135 default IDs", | ||
359 | &dibusb_device_classes[DIBUSB1_1], | ||
360 | { &dib_table[37], NULL }, | ||
361 | { NULL }, | ||
362 | }, | ||
363 | #endif | ||
364 | }; | ||
365 | |||
366 | static int dibusb_exit(struct usb_dibusb *dib) | ||
367 | { | ||
368 | deb_info("init_state before exiting everything: %x\n",dib->init_state); | ||
369 | dibusb_remote_exit(dib); | ||
370 | dibusb_fe_exit(dib); | ||
371 | dibusb_i2c_exit(dib); | ||
372 | dibusb_dvb_exit(dib); | ||
373 | dibusb_urb_exit(dib); | ||
374 | deb_info("init_state should be zero now: %x\n",dib->init_state); | ||
375 | dib->init_state = DIBUSB_STATE_INIT; | ||
376 | kfree(dib); | ||
377 | return 0; | ||
378 | } | ||
379 | |||
380 | static int dibusb_init(struct usb_dibusb *dib) | ||
381 | { | ||
382 | int ret = 0; | ||
383 | sema_init(&dib->usb_sem, 1); | ||
384 | sema_init(&dib->i2c_sem, 1); | ||
385 | |||
386 | dib->init_state = DIBUSB_STATE_INIT; | ||
387 | |||
388 | if ((ret = dibusb_urb_init(dib)) || | ||
389 | (ret = dibusb_dvb_init(dib)) || | ||
390 | (ret = dibusb_i2c_init(dib))) { | ||
391 | dibusb_exit(dib); | ||
392 | return ret; | ||
393 | } | ||
394 | |||
395 | if ((ret = dibusb_fe_init(dib))) | ||
396 | err("could not initialize a frontend."); | ||
397 | |||
398 | if ((ret = dibusb_remote_init(dib))) | ||
399 | err("could not initialize remote control."); | ||
400 | |||
401 | return 0; | ||
402 | } | ||
403 | |||
404 | static struct dibusb_usb_device * dibusb_device_class_quirk(struct usb_device *udev, struct dibusb_usb_device *dev) | ||
405 | { | ||
406 | int i; | ||
407 | |||
408 | /* Quirk for the Kworld/ADSTech Instant USB2.0 device. It has the same USB | ||
409 | * IDs like the USB1.1 KWorld after loading the firmware. Which is a bad | ||
410 | * idea and make this quirk necessary. | ||
411 | */ | ||
412 | if (dev->dev_cl->id == DIBUSB1_1 && udev->speed == USB_SPEED_HIGH) { | ||
413 | info("this seems to be the Kworld/ADSTech Instant USB2.0 device or equal."); | ||
414 | for (i = 0; i < sizeof(dibusb_devices)/sizeof(struct dibusb_usb_device); i++) { | ||
415 | if (dibusb_devices[i].dev_cl->id == DIBUSB2_0B) { | ||
416 | dev = &dibusb_devices[i]; | ||
417 | break; | ||
418 | } | ||
419 | } | ||
420 | } | ||
421 | |||
422 | return dev; | ||
423 | } | ||
424 | |||
425 | static struct dibusb_usb_device * dibusb_find_device (struct usb_device *udev,int *cold) | ||
426 | { | ||
427 | int i,j; | ||
428 | struct dibusb_usb_device *dev = NULL; | ||
429 | *cold = -1; | ||
430 | |||
431 | for (i = 0; i < sizeof(dibusb_devices)/sizeof(struct dibusb_usb_device); i++) { | ||
432 | for (j = 0; j < DIBUSB_ID_MAX_NUM && dibusb_devices[i].cold_ids[j] != NULL; j++) { | ||
433 | deb_info("check for cold %x %x\n",dibusb_devices[i].cold_ids[j]->idVendor, dibusb_devices[i].cold_ids[j]->idProduct); | ||
434 | if (dibusb_devices[i].cold_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && | ||
435 | dibusb_devices[i].cold_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { | ||
436 | *cold = 1; | ||
437 | dev = &dibusb_devices[i]; | ||
438 | break; | ||
439 | } | ||
440 | } | ||
441 | |||
442 | if (dev != NULL) | ||
443 | break; | ||
444 | |||
445 | for (j = 0; j < DIBUSB_ID_MAX_NUM && dibusb_devices[i].warm_ids[j] != NULL; j++) { | ||
446 | deb_info("check for warm %x %x\n",dibusb_devices[i].warm_ids[j]->idVendor, dibusb_devices[i].warm_ids[j]->idProduct); | ||
447 | if (dibusb_devices[i].warm_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && | ||
448 | dibusb_devices[i].warm_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { | ||
449 | *cold = 0; | ||
450 | dev = &dibusb_devices[i]; | ||
451 | break; | ||
452 | } | ||
453 | } | ||
454 | } | ||
455 | |||
456 | if (dev != NULL) | ||
457 | dev = dibusb_device_class_quirk(udev,dev); | ||
458 | |||
459 | return dev; | ||
460 | } | ||
461 | |||
462 | /* | ||
463 | * USB | ||
464 | */ | ||
465 | static int dibusb_probe(struct usb_interface *intf, | ||
466 | const struct usb_device_id *id) | ||
467 | { | ||
468 | struct usb_device *udev = interface_to_usbdev(intf); | ||
469 | struct usb_dibusb *dib = NULL; | ||
470 | struct dibusb_usb_device *dibdev = NULL; | ||
471 | |||
472 | int ret = -ENOMEM,cold=0; | ||
473 | |||
474 | if ((dibdev = dibusb_find_device(udev,&cold)) == NULL) { | ||
475 | err("something went very wrong, " | ||
476 | "unknown product ID: %.4x",le16_to_cpu(udev->descriptor.idProduct)); | ||
477 | return -ENODEV; | ||
478 | } | ||
479 | |||
480 | if (cold == 1) { | ||
481 | info("found a '%s' in cold state, will try to load a firmware",dibdev->name); | ||
482 | ret = dibusb_loadfirmware(udev,dibdev); | ||
483 | } else { | ||
484 | info("found a '%s' in warm state.",dibdev->name); | ||
485 | dib = kmalloc(sizeof(struct usb_dibusb),GFP_KERNEL); | ||
486 | if (dib == NULL) { | ||
487 | err("no memory"); | ||
488 | return ret; | ||
489 | } | ||
490 | memset(dib,0,sizeof(struct usb_dibusb)); | ||
491 | |||
492 | dib->udev = udev; | ||
493 | dib->dibdev = dibdev; | ||
494 | |||
495 | /* store parameters to structures */ | ||
496 | dib->rc_query_interval = rc_query_interval; | ||
497 | dib->pid_parse = pid_parse; | ||
498 | dib->rc_key_repeat_count = rc_key_repeat_count; | ||
499 | |||
500 | usb_set_intfdata(intf, dib); | ||
501 | |||
502 | ret = dibusb_init(dib); | ||
503 | } | ||
504 | |||
505 | if (ret == 0) | ||
506 | info("%s successfully initialized and connected.",dibdev->name); | ||
507 | else | ||
508 | info("%s error while loading driver (%d)",dibdev->name,ret); | ||
509 | return ret; | ||
510 | } | ||
511 | |||
512 | static void dibusb_disconnect(struct usb_interface *intf) | ||
513 | { | ||
514 | struct usb_dibusb *dib = usb_get_intfdata(intf); | ||
515 | const char *name = DRIVER_DESC; | ||
516 | |||
517 | usb_set_intfdata(intf,NULL); | ||
518 | if (dib != NULL && dib->dibdev != NULL) { | ||
519 | name = dib->dibdev->name; | ||
520 | dibusb_exit(dib); | ||
521 | } | ||
522 | info("%s successfully deinitialized and disconnected.",name); | ||
523 | |||
524 | } | ||
525 | |||
526 | /* usb specific object needed to register this driver with the usb subsystem */ | ||
527 | static struct usb_driver dibusb_driver = { | ||
528 | .owner = THIS_MODULE, | ||
529 | .name = DRIVER_DESC, | ||
530 | .probe = dibusb_probe, | ||
531 | .disconnect = dibusb_disconnect, | ||
532 | .id_table = dib_table, | ||
533 | }; | ||
534 | |||
535 | /* module stuff */ | ||
536 | static int __init usb_dibusb_init(void) | ||
537 | { | ||
538 | int result; | ||
539 | if ((result = usb_register(&dibusb_driver))) { | ||
540 | err("usb_register failed. Error number %d",result); | ||
541 | return result; | ||
542 | } | ||
543 | |||
544 | return 0; | ||
545 | } | ||
546 | |||
547 | static void __exit usb_dibusb_exit(void) | ||
548 | { | ||
549 | /* deregister this driver from the USB subsystem */ | ||
550 | usb_deregister(&dibusb_driver); | ||
551 | } | ||
552 | |||
553 | module_init (usb_dibusb_init); | ||
554 | module_exit (usb_dibusb_exit); | ||
555 | |||
556 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
557 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
558 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c b/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c deleted file mode 100644 index 400b439e804e..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c +++ /dev/null | |||
@@ -1,185 +0,0 @@ | |||
1 | /* | ||
2 | * dvb-dibusb-dvb.c is part of the driver for mobile USB Budget DVB-T devices | ||
3 | * based on reference design made by DiBcom (http://www.dibcom.fr/) | ||
4 | * | ||
5 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
6 | * | ||
7 | * see dvb-dibusb-core.c for more copyright details. | ||
8 | * | ||
9 | * This file contains functions for initializing and handling the | ||
10 | * linux-dvb API. | ||
11 | */ | ||
12 | #include "dvb-dibusb.h" | ||
13 | |||
14 | #include <linux/usb.h> | ||
15 | #include <linux/version.h> | ||
16 | |||
17 | static u32 urb_compl_count; | ||
18 | |||
19 | /* | ||
20 | * MPEG2 TS DVB stuff | ||
21 | */ | ||
22 | void dibusb_urb_complete(struct urb *urb, struct pt_regs *ptregs) | ||
23 | { | ||
24 | struct usb_dibusb *dib = urb->context; | ||
25 | |||
26 | deb_ts("urb complete feedcount: %d, status: %d, length: %d\n",dib->feedcount,urb->status, | ||
27 | urb->actual_length); | ||
28 | |||
29 | urb_compl_count++; | ||
30 | if (urb_compl_count % 1000 == 0) | ||
31 | deb_info("%d urbs completed so far.\n",urb_compl_count); | ||
32 | |||
33 | switch (urb->status) { | ||
34 | case 0: /* success */ | ||
35 | case -ETIMEDOUT: /* NAK */ | ||
36 | break; | ||
37 | case -ECONNRESET: /* kill */ | ||
38 | case -ENOENT: | ||
39 | case -ESHUTDOWN: | ||
40 | return; | ||
41 | default: /* error */ | ||
42 | deb_ts("urb completition error %d.", urb->status); | ||
43 | break; | ||
44 | } | ||
45 | |||
46 | if (dib->feedcount > 0 && urb->actual_length > 0) { | ||
47 | if (dib->init_state & DIBUSB_STATE_DVB) | ||
48 | dvb_dmx_swfilter(&dib->demux, (u8*) urb->transfer_buffer,urb->actual_length); | ||
49 | } else | ||
50 | deb_ts("URB dropped because of feedcount.\n"); | ||
51 | |||
52 | usb_submit_urb(urb,GFP_ATOMIC); | ||
53 | } | ||
54 | |||
55 | static int dibusb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) | ||
56 | { | ||
57 | struct usb_dibusb *dib = dvbdmxfeed->demux->priv; | ||
58 | int newfeedcount; | ||
59 | |||
60 | if (dib == NULL) | ||
61 | return -ENODEV; | ||
62 | |||
63 | newfeedcount = dib->feedcount + (onoff ? 1 : -1); | ||
64 | |||
65 | /* | ||
66 | * stop feed before setting a new pid if there will be no pid anymore | ||
67 | */ | ||
68 | if (newfeedcount == 0) { | ||
69 | deb_ts("stop feeding\n"); | ||
70 | if (dib->xfer_ops.fifo_ctrl != NULL) { | ||
71 | if (dib->xfer_ops.fifo_ctrl(dib->fe,0)) { | ||
72 | err("error while inhibiting fifo."); | ||
73 | return -ENODEV; | ||
74 | } | ||
75 | } | ||
76 | dibusb_streaming(dib,0); | ||
77 | } | ||
78 | |||
79 | dib->feedcount = newfeedcount; | ||
80 | |||
81 | /* activate the pid on the device specific pid_filter */ | ||
82 | deb_ts("setting pid: %5d %04x at index %d '%s'\n",dvbdmxfeed->pid,dvbdmxfeed->pid,dvbdmxfeed->index,onoff ? "on" : "off"); | ||
83 | if (dib->pid_parse && dib->xfer_ops.pid_ctrl != NULL) | ||
84 | dib->xfer_ops.pid_ctrl(dib->fe,dvbdmxfeed->index,dvbdmxfeed->pid,onoff); | ||
85 | |||
86 | /* | ||
87 | * start the feed if this was the first pid to set and there is still a pid | ||
88 | * for reception. | ||
89 | */ | ||
90 | if (dib->feedcount == onoff && dib->feedcount > 0) { | ||
91 | |||
92 | deb_ts("controlling pid parser\n"); | ||
93 | if (dib->xfer_ops.pid_parse != NULL) { | ||
94 | if (dib->xfer_ops.pid_parse(dib->fe,dib->pid_parse) < 0) { | ||
95 | err("could not handle pid_parser"); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | deb_ts("start feeding\n"); | ||
100 | if (dib->xfer_ops.fifo_ctrl != NULL) { | ||
101 | if (dib->xfer_ops.fifo_ctrl(dib->fe,1)) { | ||
102 | err("error while enabling fifo."); | ||
103 | return -ENODEV; | ||
104 | } | ||
105 | } | ||
106 | dibusb_streaming(dib,1); | ||
107 | } | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static int dibusb_start_feed(struct dvb_demux_feed *dvbdmxfeed) | ||
112 | { | ||
113 | deb_ts("start pid: 0x%04x, feedtype: %d\n", dvbdmxfeed->pid,dvbdmxfeed->type); | ||
114 | return dibusb_ctrl_feed(dvbdmxfeed,1); | ||
115 | } | ||
116 | |||
117 | static int dibusb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | ||
118 | { | ||
119 | deb_ts("stop pid: 0x%04x, feedtype: %d\n", dvbdmxfeed->pid, dvbdmxfeed->type); | ||
120 | return dibusb_ctrl_feed(dvbdmxfeed,0); | ||
121 | } | ||
122 | |||
123 | int dibusb_dvb_init(struct usb_dibusb *dib) | ||
124 | { | ||
125 | int ret; | ||
126 | |||
127 | urb_compl_count = 0; | ||
128 | |||
129 | if ((ret = dvb_register_adapter(&dib->adapter, DRIVER_DESC, | ||
130 | THIS_MODULE)) < 0) { | ||
131 | deb_info("dvb_register_adapter failed: error %d", ret); | ||
132 | goto err; | ||
133 | } | ||
134 | dib->adapter.priv = dib; | ||
135 | |||
136 | /* i2c is done in dibusb_i2c_init */ | ||
137 | |||
138 | dib->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING; | ||
139 | |||
140 | dib->demux.priv = (void *)dib; | ||
141 | /* get pidcount from demod */ | ||
142 | dib->demux.feednum = dib->demux.filternum = 255; | ||
143 | dib->demux.start_feed = dibusb_start_feed; | ||
144 | dib->demux.stop_feed = dibusb_stop_feed; | ||
145 | dib->demux.write_to_decoder = NULL; | ||
146 | if ((ret = dvb_dmx_init(&dib->demux)) < 0) { | ||
147 | err("dvb_dmx_init failed: error %d",ret); | ||
148 | goto err_dmx; | ||
149 | } | ||
150 | |||
151 | dib->dmxdev.filternum = dib->demux.filternum; | ||
152 | dib->dmxdev.demux = &dib->demux.dmx; | ||
153 | dib->dmxdev.capabilities = 0; | ||
154 | if ((ret = dvb_dmxdev_init(&dib->dmxdev, &dib->adapter)) < 0) { | ||
155 | err("dvb_dmxdev_init failed: error %d",ret); | ||
156 | goto err_dmx_dev; | ||
157 | } | ||
158 | |||
159 | dvb_net_init(&dib->adapter, &dib->dvb_net, &dib->demux.dmx); | ||
160 | |||
161 | goto success; | ||
162 | err_dmx_dev: | ||
163 | dvb_dmx_release(&dib->demux); | ||
164 | err_dmx: | ||
165 | dvb_unregister_adapter(&dib->adapter); | ||
166 | err: | ||
167 | return ret; | ||
168 | success: | ||
169 | dib->init_state |= DIBUSB_STATE_DVB; | ||
170 | return 0; | ||
171 | } | ||
172 | |||
173 | int dibusb_dvb_exit(struct usb_dibusb *dib) | ||
174 | { | ||
175 | if (dib->init_state & DIBUSB_STATE_DVB) { | ||
176 | dib->init_state &= ~DIBUSB_STATE_DVB; | ||
177 | deb_info("unregistering DVB part\n"); | ||
178 | dvb_net_release(&dib->dvb_net); | ||
179 | dib->demux.dmx.close(&dib->demux.dmx); | ||
180 | dvb_dmxdev_release(&dib->dmxdev); | ||
181 | dvb_dmx_release(&dib->demux); | ||
182 | dvb_unregister_adapter(&dib->adapter); | ||
183 | } | ||
184 | return 0; | ||
185 | } | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c b/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c deleted file mode 100644 index 5a71b88797d9..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c +++ /dev/null | |||
@@ -1,582 +0,0 @@ | |||
1 | /* | ||
2 | * dvb-dibusb-fe-i2c.c is part of the driver for mobile USB Budget DVB-T devices | ||
3 | * based on reference design made by DiBcom (http://www.dibcom.fr/) | ||
4 | * | ||
5 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
6 | * | ||
7 | * see dvb-dibusb-core.c for more copyright details. | ||
8 | * | ||
9 | * This file contains functions for attaching, initializing of an appropriate | ||
10 | * demodulator/frontend. I2C-stuff is also located here. | ||
11 | * | ||
12 | */ | ||
13 | #include "dvb-dibusb.h" | ||
14 | |||
15 | #include <linux/usb.h> | ||
16 | |||
17 | static int dibusb_i2c_msg(struct usb_dibusb *dib, u8 addr, | ||
18 | u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) | ||
19 | { | ||
20 | u8 sndbuf[wlen+4]; /* lead(1) devaddr,direction(1) addr(2) data(wlen) (len(2) (when reading)) */ | ||
21 | /* write only ? */ | ||
22 | int wo = (rbuf == NULL || rlen == 0), | ||
23 | len = 2 + wlen + (wo ? 0 : 2); | ||
24 | |||
25 | sndbuf[0] = wo ? DIBUSB_REQ_I2C_WRITE : DIBUSB_REQ_I2C_READ; | ||
26 | sndbuf[1] = (addr << 1) | (wo ? 0 : 1); | ||
27 | |||
28 | memcpy(&sndbuf[2],wbuf,wlen); | ||
29 | |||
30 | if (!wo) { | ||
31 | sndbuf[wlen+2] = (rlen >> 8) & 0xff; | ||
32 | sndbuf[wlen+3] = rlen & 0xff; | ||
33 | } | ||
34 | |||
35 | return dibusb_readwrite_usb(dib,sndbuf,len,rbuf,rlen); | ||
36 | } | ||
37 | |||
38 | /* | ||
39 | * I2C master xfer function | ||
40 | */ | ||
41 | static int dibusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg *msg,int num) | ||
42 | { | ||
43 | struct usb_dibusb *dib = i2c_get_adapdata(adap); | ||
44 | int i; | ||
45 | |||
46 | if (down_interruptible(&dib->i2c_sem) < 0) | ||
47 | return -EAGAIN; | ||
48 | |||
49 | if (num > 2) | ||
50 | warn("more than 2 i2c messages at a time is not handled yet. TODO."); | ||
51 | |||
52 | for (i = 0; i < num; i++) { | ||
53 | /* write/read request */ | ||
54 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | ||
55 | if (dibusb_i2c_msg(dib, msg[i].addr, msg[i].buf,msg[i].len, | ||
56 | msg[i+1].buf,msg[i+1].len) < 0) | ||
57 | break; | ||
58 | i++; | ||
59 | } else | ||
60 | if (dibusb_i2c_msg(dib, msg[i].addr, msg[i].buf,msg[i].len,NULL,0) < 0) | ||
61 | break; | ||
62 | } | ||
63 | |||
64 | up(&dib->i2c_sem); | ||
65 | return i; | ||
66 | } | ||
67 | |||
68 | static u32 dibusb_i2c_func(struct i2c_adapter *adapter) | ||
69 | { | ||
70 | return I2C_FUNC_I2C; | ||
71 | } | ||
72 | |||
73 | static struct i2c_algorithm dibusb_algo = { | ||
74 | .name = "DiBcom USB i2c algorithm", | ||
75 | .id = I2C_ALGO_BIT, | ||
76 | .master_xfer = dibusb_i2c_xfer, | ||
77 | .functionality = dibusb_i2c_func, | ||
78 | }; | ||
79 | |||
80 | static int dibusb_general_demod_init(struct dvb_frontend *fe); | ||
81 | static u8 dibusb_general_pll_addr(struct dvb_frontend *fe); | ||
82 | static int dibusb_general_pll_init(struct dvb_frontend *fe, u8 pll_buf[5]); | ||
83 | static int dibusb_general_pll_set(struct dvb_frontend *fe, | ||
84 | struct dvb_frontend_parameters* params, u8 pll_buf[5]); | ||
85 | |||
86 | static struct mt352_config mt352_hanftek_umt_010_config = { | ||
87 | .demod_address = 0x1e, | ||
88 | .demod_init = dibusb_general_demod_init, | ||
89 | .pll_set = dibusb_general_pll_set, | ||
90 | }; | ||
91 | |||
92 | static int dibusb_tuner_quirk(struct usb_dibusb *dib) | ||
93 | { | ||
94 | switch (dib->dibdev->dev_cl->id) { | ||
95 | case DIBUSB1_1: /* some these device have the ENV77H11D5 and some the THOMSON CABLE */ | ||
96 | case DIBUSB1_1_AN2235: { /* actually its this device, but in warm state they are indistinguishable */ | ||
97 | struct dibusb_tuner *t; | ||
98 | u8 b[2] = { 0,0 } ,b2[1]; | ||
99 | struct i2c_msg msg[2] = { | ||
100 | { .flags = 0, .buf = b, .len = 2 }, | ||
101 | { .flags = I2C_M_RD, .buf = b2, .len = 1}, | ||
102 | }; | ||
103 | |||
104 | t = &dibusb_tuner[DIBUSB_TUNER_COFDM_PANASONIC_ENV77H11D5]; | ||
105 | |||
106 | msg[0].addr = msg[1].addr = t->pll_addr; | ||
107 | |||
108 | if (dib->xfer_ops.tuner_pass_ctrl != NULL) | ||
109 | dib->xfer_ops.tuner_pass_ctrl(dib->fe,1,t->pll_addr); | ||
110 | dibusb_i2c_xfer(&dib->i2c_adap,msg,2); | ||
111 | if (dib->xfer_ops.tuner_pass_ctrl != NULL) | ||
112 | dib->xfer_ops.tuner_pass_ctrl(dib->fe,0,t->pll_addr); | ||
113 | |||
114 | if (b2[0] == 0xfe) | ||
115 | info("this device has the Thomson Cable onboard. Which is default."); | ||
116 | else { | ||
117 | dib->tuner = t; | ||
118 | info("this device has the Panasonic ENV77H11D5 onboard."); | ||
119 | } | ||
120 | break; | ||
121 | } | ||
122 | default: | ||
123 | break; | ||
124 | } | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | int dibusb_fe_init(struct usb_dibusb* dib) | ||
129 | { | ||
130 | struct dib3000_config demod_cfg; | ||
131 | int i; | ||
132 | |||
133 | if (dib->init_state & DIBUSB_STATE_I2C) { | ||
134 | for (i = 0; i < sizeof(dib->dibdev->dev_cl->demod->i2c_addrs) / sizeof(unsigned char) && | ||
135 | dib->dibdev->dev_cl->demod->i2c_addrs[i] != 0; i++) { | ||
136 | |||
137 | demod_cfg.demod_address = dib->dibdev->dev_cl->demod->i2c_addrs[i]; | ||
138 | demod_cfg.pll_addr = dibusb_general_pll_addr; | ||
139 | demod_cfg.pll_set = dibusb_general_pll_set; | ||
140 | demod_cfg.pll_init = dibusb_general_pll_init; | ||
141 | |||
142 | deb_info("demod id: %d %d\n",dib->dibdev->dev_cl->demod->id,DTT200U_FE); | ||
143 | |||
144 | switch (dib->dibdev->dev_cl->demod->id) { | ||
145 | case DIBUSB_DIB3000MB: | ||
146 | dib->fe = dib3000mb_attach(&demod_cfg,&dib->i2c_adap,&dib->xfer_ops); | ||
147 | break; | ||
148 | case DIBUSB_DIB3000MC: | ||
149 | dib->fe = dib3000mc_attach(&demod_cfg,&dib->i2c_adap,&dib->xfer_ops); | ||
150 | break; | ||
151 | case DIBUSB_MT352: | ||
152 | mt352_hanftek_umt_010_config.demod_address = dib->dibdev->dev_cl->demod->i2c_addrs[i]; | ||
153 | dib->fe = mt352_attach(&mt352_hanftek_umt_010_config, &dib->i2c_adap); | ||
154 | break; | ||
155 | case DTT200U_FE: | ||
156 | dib->fe = dtt200u_fe_attach(dib,&dib->xfer_ops); | ||
157 | break; | ||
158 | } | ||
159 | if (dib->fe != NULL) { | ||
160 | info("found demodulator at i2c address 0x%x",dib->dibdev->dev_cl->demod->i2c_addrs[i]); | ||
161 | break; | ||
162 | } | ||
163 | } | ||
164 | /* if a frontend was found */ | ||
165 | if (dib->fe != NULL) { | ||
166 | if (dib->fe->ops->sleep != NULL) | ||
167 | dib->fe_sleep = dib->fe->ops->sleep; | ||
168 | dib->fe->ops->sleep = dibusb_hw_sleep; | ||
169 | |||
170 | if (dib->fe->ops->init != NULL ) | ||
171 | dib->fe_init = dib->fe->ops->init; | ||
172 | dib->fe->ops->init = dibusb_hw_wakeup; | ||
173 | |||
174 | /* setting the default tuner */ | ||
175 | dib->tuner = dib->dibdev->dev_cl->tuner; | ||
176 | |||
177 | /* check which tuner is mounted on this device, in case this is unsure */ | ||
178 | dibusb_tuner_quirk(dib); | ||
179 | } | ||
180 | } | ||
181 | if (dib->fe == NULL) { | ||
182 | err("A frontend driver was not found for device '%s'.", | ||
183 | dib->dibdev->name); | ||
184 | return -ENODEV; | ||
185 | } else { | ||
186 | if (dvb_register_frontend(&dib->adapter, dib->fe)) { | ||
187 | err("Frontend registration failed."); | ||
188 | if (dib->fe->ops->release) | ||
189 | dib->fe->ops->release(dib->fe); | ||
190 | dib->fe = NULL; | ||
191 | return -ENODEV; | ||
192 | } | ||
193 | } | ||
194 | |||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | int dibusb_fe_exit(struct usb_dibusb *dib) | ||
199 | { | ||
200 | if (dib->fe != NULL) | ||
201 | dvb_unregister_frontend(dib->fe); | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | int dibusb_i2c_init(struct usb_dibusb *dib) | ||
206 | { | ||
207 | int ret = 0; | ||
208 | |||
209 | dib->adapter.priv = dib; | ||
210 | |||
211 | strncpy(dib->i2c_adap.name,dib->dibdev->name,I2C_NAME_SIZE); | ||
212 | #ifdef I2C_ADAP_CLASS_TV_DIGITAL | ||
213 | dib->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL, | ||
214 | #else | ||
215 | dib->i2c_adap.class = I2C_CLASS_TV_DIGITAL, | ||
216 | #endif | ||
217 | dib->i2c_adap.algo = &dibusb_algo; | ||
218 | dib->i2c_adap.algo_data = NULL; | ||
219 | dib->i2c_adap.id = I2C_ALGO_BIT; | ||
220 | |||
221 | i2c_set_adapdata(&dib->i2c_adap, dib); | ||
222 | |||
223 | if ((ret = i2c_add_adapter(&dib->i2c_adap)) < 0) | ||
224 | err("could not add i2c adapter"); | ||
225 | |||
226 | dib->init_state |= DIBUSB_STATE_I2C; | ||
227 | |||
228 | return ret; | ||
229 | } | ||
230 | |||
231 | int dibusb_i2c_exit(struct usb_dibusb *dib) | ||
232 | { | ||
233 | if (dib->init_state & DIBUSB_STATE_I2C) | ||
234 | i2c_del_adapter(&dib->i2c_adap); | ||
235 | dib->init_state &= ~DIBUSB_STATE_I2C; | ||
236 | return 0; | ||
237 | } | ||
238 | |||
239 | |||
240 | /* pll stuff, maybe removed soon (thx to Gerd/Andrew in advance) */ | ||
241 | static int thomson_cable_eu_pll_set(struct dvb_frontend_parameters *fep, u8 pllbuf[4]) | ||
242 | { | ||
243 | u32 tfreq = (fep->frequency + 36125000) / 62500; | ||
244 | int vu,p0,p1,p2; | ||
245 | |||
246 | if (fep->frequency > 403250000) | ||
247 | vu = 1, p2 = 1, p1 = 0, p0 = 1; | ||
248 | else if (fep->frequency > 115750000) | ||
249 | vu = 0, p2 = 1, p1 = 1, p0 = 0; | ||
250 | else if (fep->frequency > 44250000) | ||
251 | vu = 0, p2 = 0, p1 = 1, p0 = 1; | ||
252 | else | ||
253 | return -EINVAL; | ||
254 | |||
255 | pllbuf[0] = (tfreq >> 8) & 0x7f; | ||
256 | pllbuf[1] = tfreq & 0xff; | ||
257 | pllbuf[2] = 0x8e; | ||
258 | pllbuf[3] = (vu << 7) | (p2 << 2) | (p1 << 1) | p0; | ||
259 | return 0; | ||
260 | } | ||
261 | |||
262 | static int panasonic_cofdm_env57h1xd5_pll_set(struct dvb_frontend_parameters *fep, u8 pllbuf[4]) | ||
263 | { | ||
264 | u32 freq_khz = fep->frequency / 1000; | ||
265 | u32 tfreq = ((freq_khz + 36125)*6 + 500) / 1000; | ||
266 | u8 TA, T210, R210, ctrl1, cp210, p4321; | ||
267 | if (freq_khz > 858000) { | ||
268 | err("frequency cannot be larger than 858 MHz."); | ||
269 | return -EINVAL; | ||
270 | } | ||
271 | |||
272 | // contol data 1 : 1 | T/A=1 | T2,T1,T0 = 0,0,0 | R2,R1,R0 = 0,1,0 | ||
273 | TA = 1; | ||
274 | T210 = 0; | ||
275 | R210 = 0x2; | ||
276 | ctrl1 = (1 << 7) | (TA << 6) | (T210 << 3) | R210; | ||
277 | |||
278 | // ******** CHARGE PUMP CONFIG vs RF FREQUENCIES ***************** | ||
279 | if (freq_khz < 470000) | ||
280 | cp210 = 2; // VHF Low and High band ch E12 to E4 to E12 | ||
281 | else if (freq_khz < 526000) | ||
282 | cp210 = 4; // UHF band Ch E21 to E27 | ||
283 | else // if (freq < 862000000) | ||
284 | cp210 = 5; // UHF band ch E28 to E69 | ||
285 | |||
286 | //********************* BW select ******************************* | ||
287 | if (freq_khz < 153000) | ||
288 | p4321 = 1; // BW selected for VHF low | ||
289 | else if (freq_khz < 470000) | ||
290 | p4321 = 2; // BW selected for VHF high E5 to E12 | ||
291 | else // if (freq < 862000000) | ||
292 | p4321 = 4; // BW selection for UHF E21 to E69 | ||
293 | |||
294 | pllbuf[0] = (tfreq >> 8) & 0xff; | ||
295 | pllbuf[1] = (tfreq >> 0) & 0xff; | ||
296 | pllbuf[2] = 0xff & ctrl1; | ||
297 | pllbuf[3] = (cp210 << 5) | (p4321); | ||
298 | |||
299 | return 0; | ||
300 | } | ||
301 | |||
302 | /* | ||
303 | * 7 6 5 4 3 2 1 0 | ||
304 | * Address Byte 1 1 0 0 0 MA1 MA0 R/~W=0 | ||
305 | * | ||
306 | * Program divider byte 1 0 n14 n13 n12 n11 n10 n9 n8 | ||
307 | * Program divider byte 2 n7 n6 n5 n4 n3 n2 n1 n0 | ||
308 | * | ||
309 | * Control byte 1 1 T/A=1 T2 T1 T0 R2 R1 R0 | ||
310 | * 1 T/A=0 0 0 ATC AL2 AL1 AL0 | ||
311 | * | ||
312 | * Control byte 2 CP2 CP1 CP0 BS5 BS4 BS3 BS2 BS1 | ||
313 | * | ||
314 | * MA0/1 = programmable address bits | ||
315 | * R/~W = read/write bit (0 for writing) | ||
316 | * N14-0 = programmable LO frequency | ||
317 | * | ||
318 | * T/A = test AGC bit (0 = next 6 bits AGC setting, | ||
319 | * 1 = next 6 bits test and reference divider ratio settings) | ||
320 | * T2-0 = test bits | ||
321 | * R2-0 = reference divider ratio and programmable frequency step | ||
322 | * ATC = AGC current setting and time constant | ||
323 | * ATC = 0: AGC current = 220nA, AGC time constant = 2s | ||
324 | * ATC = 1: AGC current = 9uA, AGC time constant = 50ms | ||
325 | * AL2-0 = AGC take-over point bits | ||
326 | * CP2-0 = charge pump current | ||
327 | * BS5-1 = PMOS ports control bits; | ||
328 | * BSn = 0 corresponding port is off, high-impedance state (at power-on) | ||
329 | * BSn = 1 corresponding port is on | ||
330 | */ | ||
331 | static int panasonic_cofdm_env77h11d5_tda6650_init(struct dvb_frontend *fe, u8 pllbuf[4]) | ||
332 | { | ||
333 | pllbuf[0] = 0x0b; | ||
334 | pllbuf[1] = 0xf5; | ||
335 | pllbuf[2] = 0x85; | ||
336 | pllbuf[3] = 0xab; | ||
337 | return 0; | ||
338 | } | ||
339 | |||
340 | static int panasonic_cofdm_env77h11d5_tda6650_set (struct dvb_frontend_parameters *fep,u8 pllbuf[4]) | ||
341 | { | ||
342 | int tuner_frequency = 0; | ||
343 | u8 band, cp, filter; | ||
344 | |||
345 | // determine charge pump | ||
346 | tuner_frequency = fep->frequency + 36166000; | ||
347 | if (tuner_frequency < 87000000) | ||
348 | return -EINVAL; | ||
349 | else if (tuner_frequency < 130000000) | ||
350 | cp = 3; | ||
351 | else if (tuner_frequency < 160000000) | ||
352 | cp = 5; | ||
353 | else if (tuner_frequency < 200000000) | ||
354 | cp = 6; | ||
355 | else if (tuner_frequency < 290000000) | ||
356 | cp = 3; | ||
357 | else if (tuner_frequency < 420000000) | ||
358 | cp = 5; | ||
359 | else if (tuner_frequency < 480000000) | ||
360 | cp = 6; | ||
361 | else if (tuner_frequency < 620000000) | ||
362 | cp = 3; | ||
363 | else if (tuner_frequency < 830000000) | ||
364 | cp = 5; | ||
365 | else if (tuner_frequency < 895000000) | ||
366 | cp = 7; | ||
367 | else | ||
368 | return -EINVAL; | ||
369 | |||
370 | // determine band | ||
371 | if (fep->frequency < 49000000) | ||
372 | return -EINVAL; | ||
373 | else if (fep->frequency < 161000000) | ||
374 | band = 1; | ||
375 | else if (fep->frequency < 444000000) | ||
376 | band = 2; | ||
377 | else if (fep->frequency < 861000000) | ||
378 | band = 4; | ||
379 | else | ||
380 | return -EINVAL; | ||
381 | |||
382 | // setup PLL filter | ||
383 | switch (fep->u.ofdm.bandwidth) { | ||
384 | case BANDWIDTH_6_MHZ: | ||
385 | case BANDWIDTH_7_MHZ: | ||
386 | filter = 0; | ||
387 | break; | ||
388 | case BANDWIDTH_8_MHZ: | ||
389 | filter = 1; | ||
390 | break; | ||
391 | default: | ||
392 | return -EINVAL; | ||
393 | } | ||
394 | |||
395 | // calculate divisor | ||
396 | // ((36166000+((1000000/6)/2)) + Finput)/(1000000/6) | ||
397 | tuner_frequency = (((fep->frequency / 1000) * 6) + 217496) / 1000; | ||
398 | |||
399 | // setup tuner buffer | ||
400 | pllbuf[0] = (tuner_frequency >> 8) & 0x7f; | ||
401 | pllbuf[1] = tuner_frequency & 0xff; | ||
402 | pllbuf[2] = 0xca; | ||
403 | pllbuf[3] = (cp << 5) | (filter << 3) | band; | ||
404 | return 0; | ||
405 | } | ||
406 | |||
407 | /* | ||
408 | * 7 6 5 4 3 2 1 0 | ||
409 | * Address Byte 1 1 0 0 0 MA1 MA0 R/~W=0 | ||
410 | * | ||
411 | * Program divider byte 1 0 n14 n13 n12 n11 n10 n9 n8 | ||
412 | * Program divider byte 2 n7 n6 n5 n4 n3 n2 n1 n0 | ||
413 | * | ||
414 | * Control byte 1 CP T2 T1 T0 RSA RSB OS | ||
415 | * | ||
416 | * Band Switch byte X X X P4 P3 P2 P1 P0 | ||
417 | * | ||
418 | * Auxiliary byte ATC AL2 AL1 AL0 0 0 0 0 | ||
419 | * | ||
420 | * Address: MA1 MA0 Address | ||
421 | * 0 0 c0 | ||
422 | * 0 1 c2 (always valid) | ||
423 | * 1 0 c4 | ||
424 | * 1 1 c6 | ||
425 | */ | ||
426 | static int lg_tdtp_e102p_tua6034(struct dvb_frontend_parameters* fep, u8 pllbuf[4]) | ||
427 | { | ||
428 | u32 div; | ||
429 | u8 p210, p3; | ||
430 | |||
431 | #define TUNER_MUL 62500 | ||
432 | |||
433 | div = (fep->frequency + 36125000 + TUNER_MUL / 2) / TUNER_MUL; | ||
434 | // div = ((fep->frequency/1000 + 36166) * 6) / 1000; | ||
435 | |||
436 | if (fep->frequency < 174500000) | ||
437 | p210 = 1; // not supported by the tdtp_e102p | ||
438 | else if (fep->frequency < 230000000) // VHF | ||
439 | p210 = 2; | ||
440 | else | ||
441 | p210 = 4; | ||
442 | |||
443 | if (fep->u.ofdm.bandwidth == BANDWIDTH_7_MHZ) | ||
444 | p3 = 0; | ||
445 | else | ||
446 | p3 = 1; | ||
447 | |||
448 | pllbuf[0] = (div >> 8) & 0x7f; | ||
449 | pllbuf[1] = div & 0xff; | ||
450 | pllbuf[2] = 0xce; | ||
451 | // pllbuf[2] = 0xcc; | ||
452 | pllbuf[3] = (p3 << 3) | p210; | ||
453 | |||
454 | return 0; | ||
455 | } | ||
456 | |||
457 | static int lg_tdtp_e102p_mt352_demod_init(struct dvb_frontend *fe) | ||
458 | { | ||
459 | static u8 mt352_clock_config[] = { 0x89, 0xb8, 0x2d }; | ||
460 | static u8 mt352_reset[] = { 0x50, 0x80 }; | ||
461 | static u8 mt352_mclk_ratio[] = { 0x8b, 0x00 }; | ||
462 | static u8 mt352_adc_ctl_1_cfg[] = { 0x8E, 0x40 }; | ||
463 | static u8 mt352_agc_cfg[] = { 0x67, 0x10, 0xa0 }; | ||
464 | |||
465 | static u8 mt352_sec_agc_cfg1[] = { 0x6a, 0xff }; | ||
466 | static u8 mt352_sec_agc_cfg2[] = { 0x6d, 0xff }; | ||
467 | static u8 mt352_sec_agc_cfg3[] = { 0x70, 0x40 }; | ||
468 | static u8 mt352_sec_agc_cfg4[] = { 0x7b, 0x03 }; | ||
469 | static u8 mt352_sec_agc_cfg5[] = { 0x7d, 0x0f }; | ||
470 | |||
471 | static u8 mt352_acq_ctl[] = { 0x53, 0x50 }; | ||
472 | static u8 mt352_input_freq_1[] = { 0x56, 0x31, 0x06 }; | ||
473 | |||
474 | mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config)); | ||
475 | udelay(2000); | ||
476 | mt352_write(fe, mt352_reset, sizeof(mt352_reset)); | ||
477 | mt352_write(fe, mt352_mclk_ratio, sizeof(mt352_mclk_ratio)); | ||
478 | |||
479 | mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg)); | ||
480 | mt352_write(fe, mt352_agc_cfg, sizeof(mt352_agc_cfg)); | ||
481 | |||
482 | mt352_write(fe, mt352_sec_agc_cfg1, sizeof(mt352_sec_agc_cfg1)); | ||
483 | mt352_write(fe, mt352_sec_agc_cfg2, sizeof(mt352_sec_agc_cfg2)); | ||
484 | mt352_write(fe, mt352_sec_agc_cfg3, sizeof(mt352_sec_agc_cfg3)); | ||
485 | mt352_write(fe, mt352_sec_agc_cfg4, sizeof(mt352_sec_agc_cfg4)); | ||
486 | mt352_write(fe, mt352_sec_agc_cfg5, sizeof(mt352_sec_agc_cfg5)); | ||
487 | |||
488 | mt352_write(fe, mt352_acq_ctl, sizeof(mt352_acq_ctl)); | ||
489 | mt352_write(fe, mt352_input_freq_1, sizeof(mt352_input_freq_1)); | ||
490 | |||
491 | return 0; | ||
492 | } | ||
493 | |||
494 | static int dibusb_general_demod_init(struct dvb_frontend *fe) | ||
495 | { | ||
496 | struct usb_dibusb* dib = (struct usb_dibusb*) fe->dvb->priv; | ||
497 | switch (dib->dibdev->dev_cl->id) { | ||
498 | case UMT2_0: | ||
499 | return lg_tdtp_e102p_mt352_demod_init(fe); | ||
500 | default: /* other device classes do not have device specific demod inits */ | ||
501 | break; | ||
502 | } | ||
503 | return 0; | ||
504 | } | ||
505 | |||
506 | static u8 dibusb_general_pll_addr(struct dvb_frontend *fe) | ||
507 | { | ||
508 | struct usb_dibusb* dib = (struct usb_dibusb*) fe->dvb->priv; | ||
509 | return dib->tuner->pll_addr; | ||
510 | } | ||
511 | |||
512 | static int dibusb_pll_i2c_helper(struct usb_dibusb *dib, u8 pll_buf[5], u8 buf[4]) | ||
513 | { | ||
514 | if (pll_buf == NULL) { | ||
515 | struct i2c_msg msg = { | ||
516 | .addr = dib->tuner->pll_addr, | ||
517 | .flags = 0, | ||
518 | .buf = buf, | ||
519 | .len = sizeof(buf) | ||
520 | }; | ||
521 | if (i2c_transfer (&dib->i2c_adap, &msg, 1) != 1) | ||
522 | return -EIO; | ||
523 | msleep(1); | ||
524 | } else { | ||
525 | pll_buf[0] = dib->tuner->pll_addr << 1; | ||
526 | memcpy(&pll_buf[1],buf,4); | ||
527 | } | ||
528 | |||
529 | return 0; | ||
530 | } | ||
531 | |||
532 | static int dibusb_general_pll_init(struct dvb_frontend *fe, | ||
533 | u8 pll_buf[5]) | ||
534 | { | ||
535 | struct usb_dibusb* dib = (struct usb_dibusb*) fe->dvb->priv; | ||
536 | u8 buf[4]; | ||
537 | int ret=0; | ||
538 | switch (dib->tuner->id) { | ||
539 | case DIBUSB_TUNER_COFDM_PANASONIC_ENV77H11D5: | ||
540 | ret = panasonic_cofdm_env77h11d5_tda6650_init(fe,buf); | ||
541 | break; | ||
542 | default: | ||
543 | break; | ||
544 | } | ||
545 | |||
546 | if (ret) | ||
547 | return ret; | ||
548 | |||
549 | return dibusb_pll_i2c_helper(dib,pll_buf,buf); | ||
550 | } | ||
551 | |||
552 | static int dibusb_general_pll_set(struct dvb_frontend *fe, | ||
553 | struct dvb_frontend_parameters *fep, u8 pll_buf[5]) | ||
554 | { | ||
555 | struct usb_dibusb* dib = (struct usb_dibusb*) fe->dvb->priv; | ||
556 | u8 buf[4]; | ||
557 | int ret=0; | ||
558 | |||
559 | switch (dib->tuner->id) { | ||
560 | case DIBUSB_TUNER_CABLE_THOMSON: | ||
561 | ret = thomson_cable_eu_pll_set(fep, buf); | ||
562 | break; | ||
563 | case DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5: | ||
564 | ret = panasonic_cofdm_env57h1xd5_pll_set(fep, buf); | ||
565 | break; | ||
566 | case DIBUSB_TUNER_CABLE_LG_TDTP_E102P: | ||
567 | ret = lg_tdtp_e102p_tua6034(fep, buf); | ||
568 | break; | ||
569 | case DIBUSB_TUNER_COFDM_PANASONIC_ENV77H11D5: | ||
570 | ret = panasonic_cofdm_env77h11d5_tda6650_set(fep,buf); | ||
571 | break; | ||
572 | default: | ||
573 | warn("no pll programming routine found for tuner %d.\n",dib->tuner->id); | ||
574 | ret = -ENODEV; | ||
575 | break; | ||
576 | } | ||
577 | |||
578 | if (ret) | ||
579 | return ret; | ||
580 | |||
581 | return dibusb_pll_i2c_helper(dib,pll_buf,buf); | ||
582 | } | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb-firmware.c b/drivers/media/dvb/dibusb/dvb-dibusb-firmware.c deleted file mode 100644 index 504ba47afdf3..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb-firmware.c +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | /* | ||
2 | * dvb-dibusb-firmware.c is part of the driver for mobile USB Budget DVB-T devices | ||
3 | * based on reference design made by DiBcom (http://www.dibcom.fr/) | ||
4 | * | ||
5 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
6 | * | ||
7 | * see dvb-dibusb-core.c for more copyright details. | ||
8 | * | ||
9 | * This file contains functions for downloading the firmware to the device. | ||
10 | */ | ||
11 | #include "dvb-dibusb.h" | ||
12 | |||
13 | #include <linux/firmware.h> | ||
14 | #include <linux/usb.h> | ||
15 | |||
16 | /* | ||
17 | * load a firmware packet to the device | ||
18 | */ | ||
19 | static int dibusb_writemem(struct usb_device *udev,u16 addr,u8 *data, u8 len) | ||
20 | { | ||
21 | return usb_control_msg(udev, usb_sndctrlpipe(udev,0), | ||
22 | 0xa0, USB_TYPE_VENDOR, addr, 0x00, data, len, 5000); | ||
23 | } | ||
24 | |||
25 | int dibusb_loadfirmware(struct usb_device *udev, struct dibusb_usb_device *dibdev) | ||
26 | { | ||
27 | const struct firmware *fw = NULL; | ||
28 | u16 addr; | ||
29 | u8 *b,*p; | ||
30 | int ret = 0,i; | ||
31 | |||
32 | if ((ret = request_firmware(&fw, dibdev->dev_cl->firmware, &udev->dev)) != 0) { | ||
33 | err("did not find the firmware file. (%s) " | ||
34 | "Please see linux/Documentation/dvb/ for more details on firmware-problems.", | ||
35 | dibdev->dev_cl->firmware); | ||
36 | return ret; | ||
37 | } | ||
38 | |||
39 | info("downloading firmware from file '%s'.",dibdev->dev_cl->firmware); | ||
40 | |||
41 | p = kmalloc(fw->size,GFP_KERNEL); | ||
42 | if (p != NULL) { | ||
43 | u8 reset; | ||
44 | /* | ||
45 | * you cannot use the fw->data as buffer for | ||
46 | * usb_control_msg, a new buffer has to be | ||
47 | * created | ||
48 | */ | ||
49 | memcpy(p,fw->data,fw->size); | ||
50 | |||
51 | /* stop the CPU */ | ||
52 | reset = 1; | ||
53 | if ((ret = dibusb_writemem(udev,dibdev->dev_cl->usb_ctrl->cpu_cs_register,&reset,1)) != 1) | ||
54 | err("could not stop the USB controller CPU."); | ||
55 | for(i = 0; p[i+3] == 0 && i < fw->size; ) { | ||
56 | b = (u8 *) &p[i]; | ||
57 | addr = *((u16 *) &b[1]); | ||
58 | |||
59 | ret = dibusb_writemem(udev,addr,&b[4],b[0]); | ||
60 | |||
61 | if (ret != b[0]) { | ||
62 | err("error while transferring firmware " | ||
63 | "(transferred size: %d, block size: %d)", | ||
64 | ret,b[0]); | ||
65 | ret = -EINVAL; | ||
66 | break; | ||
67 | } | ||
68 | i += 5 + b[0]; | ||
69 | } | ||
70 | /* length in ret */ | ||
71 | if (ret > 0) | ||
72 | ret = 0; | ||
73 | /* restart the CPU */ | ||
74 | reset = 0; | ||
75 | if (ret || dibusb_writemem(udev,dibdev->dev_cl->usb_ctrl->cpu_cs_register,&reset,1) != 1) { | ||
76 | err("could not restart the USB controller CPU."); | ||
77 | ret = -EINVAL; | ||
78 | } | ||
79 | |||
80 | kfree(p); | ||
81 | } else { | ||
82 | ret = -ENOMEM; | ||
83 | } | ||
84 | release_firmware(fw); | ||
85 | |||
86 | return ret; | ||
87 | } | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb-remote.c b/drivers/media/dvb/dibusb/dvb-dibusb-remote.c deleted file mode 100644 index 9dc8b15517b7..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb-remote.c +++ /dev/null | |||
@@ -1,316 +0,0 @@ | |||
1 | /* | ||
2 | * dvb-dibusb-remote.c is part of the driver for mobile USB Budget DVB-T devices | ||
3 | * based on reference design made by DiBcom (http://www.dibcom.fr/) | ||
4 | * | ||
5 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
6 | * | ||
7 | * see dvb-dibusb-core.c for more copyright details. | ||
8 | * | ||
9 | * This file contains functions for handling the event device on the software | ||
10 | * side and the remote control on the hardware side. | ||
11 | */ | ||
12 | #include "dvb-dibusb.h" | ||
13 | |||
14 | /* Table to map raw key codes to key events. This should not be hard-wired | ||
15 | into the kernel. */ | ||
16 | static const struct { u8 c0, c1, c2; uint32_t key; } nec_rc_keys [] = | ||
17 | { | ||
18 | /* Key codes for the little Artec T1/Twinhan/HAMA/ remote. */ | ||
19 | { 0x00, 0xff, 0x16, KEY_POWER }, | ||
20 | { 0x00, 0xff, 0x10, KEY_MUTE }, | ||
21 | { 0x00, 0xff, 0x03, KEY_1 }, | ||
22 | { 0x00, 0xff, 0x01, KEY_2 }, | ||
23 | { 0x00, 0xff, 0x06, KEY_3 }, | ||
24 | { 0x00, 0xff, 0x09, KEY_4 }, | ||
25 | { 0x00, 0xff, 0x1d, KEY_5 }, | ||
26 | { 0x00, 0xff, 0x1f, KEY_6 }, | ||
27 | { 0x00, 0xff, 0x0d, KEY_7 }, | ||
28 | { 0x00, 0xff, 0x19, KEY_8 }, | ||
29 | { 0x00, 0xff, 0x1b, KEY_9 }, | ||
30 | { 0x00, 0xff, 0x15, KEY_0 }, | ||
31 | { 0x00, 0xff, 0x05, KEY_CHANNELUP }, | ||
32 | { 0x00, 0xff, 0x02, KEY_CHANNELDOWN }, | ||
33 | { 0x00, 0xff, 0x1e, KEY_VOLUMEUP }, | ||
34 | { 0x00, 0xff, 0x0a, KEY_VOLUMEDOWN }, | ||
35 | { 0x00, 0xff, 0x11, KEY_RECORD }, | ||
36 | { 0x00, 0xff, 0x17, KEY_FAVORITES }, /* Heart symbol - Channel list. */ | ||
37 | { 0x00, 0xff, 0x14, KEY_PLAY }, | ||
38 | { 0x00, 0xff, 0x1a, KEY_STOP }, | ||
39 | { 0x00, 0xff, 0x40, KEY_REWIND }, | ||
40 | { 0x00, 0xff, 0x12, KEY_FASTFORWARD }, | ||
41 | { 0x00, 0xff, 0x0e, KEY_PREVIOUS }, /* Recall - Previous channel. */ | ||
42 | { 0x00, 0xff, 0x4c, KEY_PAUSE }, | ||
43 | { 0x00, 0xff, 0x4d, KEY_SCREEN }, /* Full screen mode. */ | ||
44 | { 0x00, 0xff, 0x54, KEY_AUDIO }, /* MTS - Switch to secondary audio. */ | ||
45 | /* additional keys TwinHan VisionPlus, the Artec seemingly not have */ | ||
46 | { 0x00, 0xff, 0x0c, KEY_CANCEL }, /* Cancel */ | ||
47 | { 0x00, 0xff, 0x1c, KEY_EPG }, /* EPG */ | ||
48 | { 0x00, 0xff, 0x00, KEY_TAB }, /* Tab */ | ||
49 | { 0x00, 0xff, 0x48, KEY_INFO }, /* Preview */ | ||
50 | { 0x00, 0xff, 0x04, KEY_LIST }, /* RecordList */ | ||
51 | { 0x00, 0xff, 0x0f, KEY_TEXT }, /* Teletext */ | ||
52 | /* Key codes for the KWorld/ADSTech/JetWay remote. */ | ||
53 | { 0x86, 0x6b, 0x12, KEY_POWER }, | ||
54 | { 0x86, 0x6b, 0x0f, KEY_SELECT }, /* source */ | ||
55 | { 0x86, 0x6b, 0x0c, KEY_UNKNOWN }, /* scan */ | ||
56 | { 0x86, 0x6b, 0x0b, KEY_EPG }, | ||
57 | { 0x86, 0x6b, 0x10, KEY_MUTE }, | ||
58 | { 0x86, 0x6b, 0x01, KEY_1 }, | ||
59 | { 0x86, 0x6b, 0x02, KEY_2 }, | ||
60 | { 0x86, 0x6b, 0x03, KEY_3 }, | ||
61 | { 0x86, 0x6b, 0x04, KEY_4 }, | ||
62 | { 0x86, 0x6b, 0x05, KEY_5 }, | ||
63 | { 0x86, 0x6b, 0x06, KEY_6 }, | ||
64 | { 0x86, 0x6b, 0x07, KEY_7 }, | ||
65 | { 0x86, 0x6b, 0x08, KEY_8 }, | ||
66 | { 0x86, 0x6b, 0x09, KEY_9 }, | ||
67 | { 0x86, 0x6b, 0x0a, KEY_0 }, | ||
68 | { 0x86, 0x6b, 0x18, KEY_ZOOM }, | ||
69 | { 0x86, 0x6b, 0x1c, KEY_UNKNOWN }, /* preview */ | ||
70 | { 0x86, 0x6b, 0x13, KEY_UNKNOWN }, /* snap */ | ||
71 | { 0x86, 0x6b, 0x00, KEY_UNDO }, | ||
72 | { 0x86, 0x6b, 0x1d, KEY_RECORD }, | ||
73 | { 0x86, 0x6b, 0x0d, KEY_STOP }, | ||
74 | { 0x86, 0x6b, 0x0e, KEY_PAUSE }, | ||
75 | { 0x86, 0x6b, 0x16, KEY_PLAY }, | ||
76 | { 0x86, 0x6b, 0x11, KEY_BACK }, | ||
77 | { 0x86, 0x6b, 0x19, KEY_FORWARD }, | ||
78 | { 0x86, 0x6b, 0x14, KEY_UNKNOWN }, /* pip */ | ||
79 | { 0x86, 0x6b, 0x15, KEY_ESC }, | ||
80 | { 0x86, 0x6b, 0x1a, KEY_UP }, | ||
81 | { 0x86, 0x6b, 0x1e, KEY_DOWN }, | ||
82 | { 0x86, 0x6b, 0x1f, KEY_LEFT }, | ||
83 | { 0x86, 0x6b, 0x1b, KEY_RIGHT }, | ||
84 | }; | ||
85 | |||
86 | /* Hauppauge NOVA-T USB2 keys */ | ||
87 | static const struct { u16 raw; uint32_t key; } haupp_rc_keys [] = { | ||
88 | { 0xddf, KEY_GOTO }, | ||
89 | { 0xdef, KEY_POWER }, | ||
90 | { 0xce7, KEY_TV }, | ||
91 | { 0xcc7, KEY_VIDEO }, | ||
92 | { 0xccf, KEY_AUDIO }, | ||
93 | { 0xcd7, KEY_MEDIA }, | ||
94 | { 0xcdf, KEY_EPG }, | ||
95 | { 0xca7, KEY_UP }, | ||
96 | { 0xc67, KEY_RADIO }, | ||
97 | { 0xcb7, KEY_LEFT }, | ||
98 | { 0xd2f, KEY_OK }, | ||
99 | { 0xcbf, KEY_RIGHT }, | ||
100 | { 0xcff, KEY_BACK }, | ||
101 | { 0xcaf, KEY_DOWN }, | ||
102 | { 0xc6f, KEY_MENU }, | ||
103 | { 0xc87, KEY_VOLUMEUP }, | ||
104 | { 0xc8f, KEY_VOLUMEDOWN }, | ||
105 | { 0xc97, KEY_CHANNEL }, | ||
106 | { 0xc7f, KEY_MUTE }, | ||
107 | { 0xd07, KEY_CHANNELUP }, | ||
108 | { 0xd0f, KEY_CHANNELDOWN }, | ||
109 | { 0xdbf, KEY_RECORD }, | ||
110 | { 0xdb7, KEY_STOP }, | ||
111 | { 0xd97, KEY_REWIND }, | ||
112 | { 0xdaf, KEY_PLAY }, | ||
113 | { 0xda7, KEY_FASTFORWARD }, | ||
114 | { 0xd27, KEY_LAST }, /* Skip backwards */ | ||
115 | { 0xd87, KEY_PAUSE }, | ||
116 | { 0xcf7, KEY_NEXT }, | ||
117 | { 0xc07, KEY_0 }, | ||
118 | { 0xc0f, KEY_1 }, | ||
119 | { 0xc17, KEY_2 }, | ||
120 | { 0xc1f, KEY_3 }, | ||
121 | { 0xc27, KEY_4 }, | ||
122 | { 0xc2f, KEY_5 }, | ||
123 | { 0xc37, KEY_6 }, | ||
124 | { 0xc3f, KEY_7 }, | ||
125 | { 0xc47, KEY_8 }, | ||
126 | { 0xc4f, KEY_9 }, | ||
127 | { 0xc57, KEY_KPASTERISK }, | ||
128 | { 0xc77, KEY_GRAVE }, /* # */ | ||
129 | { 0xc5f, KEY_RED }, | ||
130 | { 0xd77, KEY_GREEN }, | ||
131 | { 0xdc7, KEY_YELLOW }, | ||
132 | { 0xd4f, KEY_BLUE}, | ||
133 | }; | ||
134 | |||
135 | static int dibusb_key2event_nec(struct usb_dibusb *dib,u8 rb[5]) | ||
136 | { | ||
137 | int i; | ||
138 | switch (rb[0]) { | ||
139 | case DIBUSB_RC_NEC_KEY_PRESSED: | ||
140 | /* rb[1-3] is the actual key, rb[4] is a checksum */ | ||
141 | deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x, 0x%02x\n", | ||
142 | rb[1], rb[2], rb[3], rb[4]); | ||
143 | |||
144 | if ((0xff - rb[3]) != rb[4]) { | ||
145 | deb_rc("remote control checksum failed.\n"); | ||
146 | break; | ||
147 | } | ||
148 | |||
149 | /* See if we can match the raw key code. */ | ||
150 | for (i = 0; i < sizeof(nec_rc_keys)/sizeof(nec_rc_keys[0]); i++) { | ||
151 | if (nec_rc_keys[i].c0 == rb[1] && | ||
152 | nec_rc_keys[i].c1 == rb[2] && | ||
153 | nec_rc_keys[i].c2 == rb[3]) { | ||
154 | |||
155 | dib->last_event = nec_rc_keys[i].key; | ||
156 | return 1; | ||
157 | } | ||
158 | } | ||
159 | break; | ||
160 | case DIBUSB_RC_NEC_KEY_REPEATED: | ||
161 | /* rb[1]..rb[4] are always zero.*/ | ||
162 | /* Repeats often seem to occur so for the moment just ignore this. */ | ||
163 | return 0; | ||
164 | case DIBUSB_RC_NEC_EMPTY: /* No (more) remote control keys. */ | ||
165 | default: | ||
166 | break; | ||
167 | } | ||
168 | return -1; | ||
169 | } | ||
170 | |||
171 | static int dibusb_key2event_hauppauge(struct usb_dibusb *dib,u8 rb[4]) | ||
172 | { | ||
173 | u16 raw; | ||
174 | int i,state; | ||
175 | switch (rb[0]) { | ||
176 | case DIBUSB_RC_HAUPPAUGE_KEY_PRESSED: | ||
177 | raw = ((rb[1] & 0x0f) << 8) | rb[2]; | ||
178 | |||
179 | state = !!(rb[1] & 0x40); | ||
180 | |||
181 | deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to %04x state: %d\n",rb[1],rb[2],rb[3],raw,state); | ||
182 | for (i = 0; i < sizeof(haupp_rc_keys)/sizeof(haupp_rc_keys[0]); i++) { | ||
183 | if (haupp_rc_keys[i].raw == raw) { | ||
184 | if (dib->last_event == haupp_rc_keys[i].key && | ||
185 | dib->last_state == state) { | ||
186 | deb_rc("key repeat\n"); | ||
187 | return 0; | ||
188 | } else { | ||
189 | dib->last_event = haupp_rc_keys[i].key; | ||
190 | dib->last_state = state; | ||
191 | return 1; | ||
192 | } | ||
193 | } | ||
194 | } | ||
195 | |||
196 | break; | ||
197 | case DIBUSB_RC_HAUPPAUGE_KEY_EMPTY: | ||
198 | default: | ||
199 | break; | ||
200 | } | ||
201 | return -1; | ||
202 | } | ||
203 | |||
204 | /* | ||
205 | * Read the remote control and feed the appropriate event. | ||
206 | * NEC protocol is used for remote controls | ||
207 | */ | ||
208 | static int dibusb_read_remote_control(struct usb_dibusb *dib) | ||
209 | { | ||
210 | u8 b[1] = { DIBUSB_REQ_POLL_REMOTE }, rb[5]; | ||
211 | int ret,event = 0; | ||
212 | |||
213 | if ((ret = dibusb_readwrite_usb(dib,b,1,rb,5))) | ||
214 | return ret; | ||
215 | |||
216 | switch (dib->dibdev->dev_cl->remote_type) { | ||
217 | case DIBUSB_RC_NEC_PROTOCOL: | ||
218 | event = dibusb_key2event_nec(dib,rb); | ||
219 | break; | ||
220 | case DIBUSB_RC_HAUPPAUGE_PROTO: | ||
221 | event = dibusb_key2event_hauppauge(dib,rb); | ||
222 | default: | ||
223 | break; | ||
224 | } | ||
225 | |||
226 | /* key repeat */ | ||
227 | if (event == 0) | ||
228 | if (++dib->repeat_key_count < dib->rc_key_repeat_count) { | ||
229 | deb_rc("key repeat dropped. (%d)\n",dib->repeat_key_count); | ||
230 | event = -1; /* skip this key repeat */ | ||
231 | } | ||
232 | |||
233 | if (event == 1 || event == 0) { | ||
234 | deb_rc("Translated key 0x%04x\n",event); | ||
235 | |||
236 | /* Signal down and up events for this key. */ | ||
237 | input_report_key(&dib->rc_input_dev, dib->last_event, 1); | ||
238 | input_report_key(&dib->rc_input_dev, dib->last_event, 0); | ||
239 | input_sync(&dib->rc_input_dev); | ||
240 | |||
241 | if (event == 1) | ||
242 | dib->repeat_key_count = 0; | ||
243 | } | ||
244 | return 0; | ||
245 | } | ||
246 | |||
247 | /* Remote-control poll function - called every dib->rc_query_interval ms to see | ||
248 | whether the remote control has received anything. */ | ||
249 | static void dibusb_remote_query(void *data) | ||
250 | { | ||
251 | struct usb_dibusb *dib = (struct usb_dibusb *) data; | ||
252 | /* TODO: need a lock here. We can simply skip checking for the remote control | ||
253 | if we're busy. */ | ||
254 | dibusb_read_remote_control(dib); | ||
255 | schedule_delayed_work(&dib->rc_query_work, | ||
256 | msecs_to_jiffies(dib->rc_query_interval)); | ||
257 | } | ||
258 | |||
259 | int dibusb_remote_init(struct usb_dibusb *dib) | ||
260 | { | ||
261 | int i; | ||
262 | |||
263 | if (dib->dibdev->dev_cl->remote_type == DIBUSB_RC_NO) | ||
264 | return 0; | ||
265 | |||
266 | /* Initialise the remote-control structures.*/ | ||
267 | init_input_dev(&dib->rc_input_dev); | ||
268 | |||
269 | dib->rc_input_dev.evbit[0] = BIT(EV_KEY); | ||
270 | dib->rc_input_dev.keycodesize = sizeof(unsigned char); | ||
271 | dib->rc_input_dev.keycodemax = KEY_MAX; | ||
272 | dib->rc_input_dev.name = DRIVER_DESC " remote control"; | ||
273 | |||
274 | switch (dib->dibdev->dev_cl->remote_type) { | ||
275 | case DIBUSB_RC_NEC_PROTOCOL: | ||
276 | for (i=0; i<sizeof(nec_rc_keys)/sizeof(nec_rc_keys[0]); i++) | ||
277 | set_bit(nec_rc_keys[i].key, dib->rc_input_dev.keybit); | ||
278 | break; | ||
279 | case DIBUSB_RC_HAUPPAUGE_PROTO: | ||
280 | for (i=0; i<sizeof(haupp_rc_keys)/sizeof(haupp_rc_keys[0]); i++) | ||
281 | set_bit(haupp_rc_keys[i].key, dib->rc_input_dev.keybit); | ||
282 | break; | ||
283 | default: | ||
284 | break; | ||
285 | } | ||
286 | |||
287 | |||
288 | input_register_device(&dib->rc_input_dev); | ||
289 | |||
290 | INIT_WORK(&dib->rc_query_work, dibusb_remote_query, dib); | ||
291 | |||
292 | /* Start the remote-control polling. */ | ||
293 | if (dib->rc_query_interval < 40) | ||
294 | dib->rc_query_interval = 100; /* default */ | ||
295 | |||
296 | info("schedule remote query interval to %d msecs.",dib->rc_query_interval); | ||
297 | schedule_delayed_work(&dib->rc_query_work,msecs_to_jiffies(dib->rc_query_interval)); | ||
298 | |||
299 | dib->init_state |= DIBUSB_STATE_REMOTE; | ||
300 | |||
301 | return 0; | ||
302 | } | ||
303 | |||
304 | int dibusb_remote_exit(struct usb_dibusb *dib) | ||
305 | { | ||
306 | if (dib->dibdev->dev_cl->remote_type == DIBUSB_RC_NO) | ||
307 | return 0; | ||
308 | |||
309 | if (dib->init_state & DIBUSB_STATE_REMOTE) { | ||
310 | cancel_delayed_work(&dib->rc_query_work); | ||
311 | flush_scheduled_work(); | ||
312 | input_unregister_device(&dib->rc_input_dev); | ||
313 | } | ||
314 | dib->init_state &= ~DIBUSB_STATE_REMOTE; | ||
315 | return 0; | ||
316 | } | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb-usb.c b/drivers/media/dvb/dibusb/dvb-dibusb-usb.c deleted file mode 100644 index 642f0596a5ba..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb-usb.c +++ /dev/null | |||
@@ -1,303 +0,0 @@ | |||
1 | /* | ||
2 | * dvb-dibusb-usb.c is part of the driver for mobile USB Budget DVB-T devices | ||
3 | * based on reference design made by DiBcom (http://www.dibcom.fr/) | ||
4 | * | ||
5 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
6 | * | ||
7 | * see dvb-dibusb-core.c for more copyright details. | ||
8 | * | ||
9 | * This file contains functions for initializing and handling the | ||
10 | * usb specific stuff. | ||
11 | */ | ||
12 | #include "dvb-dibusb.h" | ||
13 | |||
14 | #include <linux/version.h> | ||
15 | #include <linux/pci.h> | ||
16 | |||
17 | int dibusb_readwrite_usb(struct usb_dibusb *dib, u8 *wbuf, u16 wlen, u8 *rbuf, | ||
18 | u16 rlen) | ||
19 | { | ||
20 | int actlen,ret = -ENOMEM; | ||
21 | |||
22 | if (wbuf == NULL || wlen == 0) | ||
23 | return -EINVAL; | ||
24 | |||
25 | if ((ret = down_interruptible(&dib->usb_sem))) | ||
26 | return ret; | ||
27 | |||
28 | debug_dump(wbuf,wlen); | ||
29 | |||
30 | ret = usb_bulk_msg(dib->udev,usb_sndbulkpipe(dib->udev, | ||
31 | dib->dibdev->dev_cl->pipe_cmd), wbuf,wlen,&actlen, | ||
32 | DIBUSB_I2C_TIMEOUT); | ||
33 | |||
34 | if (ret) | ||
35 | err("bulk message failed: %d (%d/%d)",ret,wlen,actlen); | ||
36 | else | ||
37 | ret = actlen != wlen ? -1 : 0; | ||
38 | |||
39 | /* an answer is expected, and no error before */ | ||
40 | if (!ret && rbuf && rlen) { | ||
41 | ret = usb_bulk_msg(dib->udev,usb_rcvbulkpipe(dib->udev, | ||
42 | dib->dibdev->dev_cl->pipe_cmd),rbuf,rlen,&actlen, | ||
43 | DIBUSB_I2C_TIMEOUT); | ||
44 | |||
45 | if (ret) | ||
46 | err("recv bulk message failed: %d",ret); | ||
47 | else { | ||
48 | deb_alot("rlen: %d\n",rlen); | ||
49 | debug_dump(rbuf,actlen); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | up(&dib->usb_sem); | ||
54 | return ret; | ||
55 | } | ||
56 | |||
57 | /* | ||
58 | * Cypress controls | ||
59 | */ | ||
60 | int dibusb_write_usb(struct usb_dibusb *dib, u8 *buf, u16 len) | ||
61 | { | ||
62 | return dibusb_readwrite_usb(dib,buf,len,NULL,0); | ||
63 | } | ||
64 | |||
65 | #if 0 | ||
66 | /* | ||
67 | * #if 0'ing the following functions as they are not in use _now_, | ||
68 | * but probably will be sometime. | ||
69 | */ | ||
70 | /* | ||
71 | * do not use this, just a workaround for a bug, | ||
72 | * which will hopefully never occur :). | ||
73 | */ | ||
74 | int dibusb_interrupt_read_loop(struct usb_dibusb *dib) | ||
75 | { | ||
76 | u8 b[1] = { DIBUSB_REQ_INTR_READ }; | ||
77 | return dibusb_write_usb(dib,b,1); | ||
78 | } | ||
79 | #endif | ||
80 | |||
81 | /* | ||
82 | * ioctl for the firmware | ||
83 | */ | ||
84 | static int dibusb_ioctl_cmd(struct usb_dibusb *dib, u8 cmd, u8 *param, int plen) | ||
85 | { | ||
86 | u8 b[34]; | ||
87 | int size = plen > 32 ? 32 : plen; | ||
88 | memset(b,0,34); | ||
89 | b[0] = DIBUSB_REQ_SET_IOCTL; | ||
90 | b[1] = cmd; | ||
91 | |||
92 | if (size > 0) | ||
93 | memcpy(&b[2],param,size); | ||
94 | |||
95 | return dibusb_write_usb(dib,b,34); //2+size); | ||
96 | } | ||
97 | |||
98 | /* | ||
99 | * ioctl for power control | ||
100 | */ | ||
101 | int dibusb_hw_wakeup(struct dvb_frontend *fe) | ||
102 | { | ||
103 | struct usb_dibusb *dib = (struct usb_dibusb *) fe->dvb->priv; | ||
104 | u8 b[1] = { DIBUSB_IOCTL_POWER_WAKEUP }; | ||
105 | deb_info("dibusb-device is getting up.\n"); | ||
106 | |||
107 | switch (dib->dibdev->dev_cl->id) { | ||
108 | case DTT200U: | ||
109 | break; | ||
110 | default: | ||
111 | dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1); | ||
112 | break; | ||
113 | } | ||
114 | |||
115 | if (dib->fe_init) | ||
116 | return dib->fe_init(fe); | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | int dibusb_hw_sleep(struct dvb_frontend *fe) | ||
122 | { | ||
123 | struct usb_dibusb *dib = (struct usb_dibusb *) fe->dvb->priv; | ||
124 | u8 b[1] = { DIBUSB_IOCTL_POWER_SLEEP }; | ||
125 | deb_info("dibusb-device is going to bed.\n"); | ||
126 | /* workaround, something is wrong, when dibusb 1.1 device are going to bed too late */ | ||
127 | switch (dib->dibdev->dev_cl->id) { | ||
128 | case DIBUSB1_1: | ||
129 | case NOVAT_USB2: | ||
130 | case DTT200U: | ||
131 | break; | ||
132 | default: | ||
133 | dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1); | ||
134 | break; | ||
135 | } | ||
136 | if (dib->fe_sleep) | ||
137 | return dib->fe_sleep(fe); | ||
138 | |||
139 | return 0; | ||
140 | } | ||
141 | |||
142 | int dibusb_set_streaming_mode(struct usb_dibusb *dib,u8 mode) | ||
143 | { | ||
144 | u8 b[2] = { DIBUSB_REQ_SET_STREAMING_MODE, mode }; | ||
145 | return dibusb_readwrite_usb(dib,b,2,NULL,0); | ||
146 | } | ||
147 | |||
148 | static int dibusb_urb_kill(struct usb_dibusb *dib) | ||
149 | { | ||
150 | int i; | ||
151 | deb_info("trying to kill urbs\n"); | ||
152 | if (dib->init_state & DIBUSB_STATE_URB_SUBMIT) { | ||
153 | for (i = 0; i < dib->dibdev->dev_cl->urb_count; i++) { | ||
154 | deb_info("killing URB no. %d.\n",i); | ||
155 | |||
156 | /* stop the URB */ | ||
157 | usb_kill_urb(dib->urb_list[i]); | ||
158 | } | ||
159 | } else | ||
160 | deb_info(" URBs not killed.\n"); | ||
161 | dib->init_state &= ~DIBUSB_STATE_URB_SUBMIT; | ||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | static int dibusb_urb_submit(struct usb_dibusb *dib) | ||
166 | { | ||
167 | int i,ret; | ||
168 | if (dib->init_state & DIBUSB_STATE_URB_INIT) { | ||
169 | for (i = 0; i < dib->dibdev->dev_cl->urb_count; i++) { | ||
170 | deb_info("submitting URB no. %d\n",i); | ||
171 | if ((ret = usb_submit_urb(dib->urb_list[i],GFP_ATOMIC))) { | ||
172 | err("could not submit buffer urb no. %d - get them all back\n",i); | ||
173 | dibusb_urb_kill(dib); | ||
174 | return ret; | ||
175 | } | ||
176 | dib->init_state |= DIBUSB_STATE_URB_SUBMIT; | ||
177 | } | ||
178 | } | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | int dibusb_streaming(struct usb_dibusb *dib,int onoff) | ||
183 | { | ||
184 | if (onoff) | ||
185 | dibusb_urb_submit(dib); | ||
186 | else | ||
187 | dibusb_urb_kill(dib); | ||
188 | |||
189 | switch (dib->dibdev->dev_cl->id) { | ||
190 | case DIBUSB2_0: | ||
191 | case DIBUSB2_0B: | ||
192 | case NOVAT_USB2: | ||
193 | case UMT2_0: | ||
194 | if (onoff) | ||
195 | return dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_ENABLE_STREAM,NULL,0); | ||
196 | else | ||
197 | return dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_DISABLE_STREAM,NULL,0); | ||
198 | break; | ||
199 | default: | ||
200 | break; | ||
201 | } | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | int dibusb_urb_init(struct usb_dibusb *dib) | ||
206 | { | ||
207 | int i,bufsize,def_pid_parse = 1; | ||
208 | |||
209 | /* | ||
210 | * when reloading the driver w/o replugging the device | ||
211 | * a timeout occures, this helps | ||
212 | */ | ||
213 | usb_clear_halt(dib->udev,usb_sndbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_cmd)); | ||
214 | usb_clear_halt(dib->udev,usb_rcvbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_cmd)); | ||
215 | usb_clear_halt(dib->udev,usb_rcvbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_data)); | ||
216 | |||
217 | /* allocate the array for the data transfer URBs */ | ||
218 | dib->urb_list = kmalloc(dib->dibdev->dev_cl->urb_count*sizeof(struct urb *),GFP_KERNEL); | ||
219 | if (dib->urb_list == NULL) | ||
220 | return -ENOMEM; | ||
221 | memset(dib->urb_list,0,dib->dibdev->dev_cl->urb_count*sizeof(struct urb *)); | ||
222 | |||
223 | dib->init_state |= DIBUSB_STATE_URB_LIST; | ||
224 | |||
225 | bufsize = dib->dibdev->dev_cl->urb_count*dib->dibdev->dev_cl->urb_buffer_size; | ||
226 | deb_info("allocate %d bytes as buffersize for all URBs\n",bufsize); | ||
227 | /* allocate the actual buffer for the URBs */ | ||
228 | if ((dib->buffer = pci_alloc_consistent(NULL,bufsize,&dib->dma_handle)) == NULL) { | ||
229 | deb_info("not enough memory.\n"); | ||
230 | return -ENOMEM; | ||
231 | } | ||
232 | deb_info("allocation complete\n"); | ||
233 | memset(dib->buffer,0,bufsize); | ||
234 | |||
235 | dib->init_state |= DIBUSB_STATE_URB_BUF; | ||
236 | |||
237 | /* allocate and submit the URBs */ | ||
238 | for (i = 0; i < dib->dibdev->dev_cl->urb_count; i++) { | ||
239 | if (!(dib->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC))) { | ||
240 | return -ENOMEM; | ||
241 | } | ||
242 | |||
243 | usb_fill_bulk_urb( dib->urb_list[i], dib->udev, | ||
244 | usb_rcvbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_data), | ||
245 | &dib->buffer[i*dib->dibdev->dev_cl->urb_buffer_size], | ||
246 | dib->dibdev->dev_cl->urb_buffer_size, | ||
247 | dibusb_urb_complete, dib); | ||
248 | |||
249 | dib->urb_list[i]->transfer_flags = 0; | ||
250 | |||
251 | dib->init_state |= DIBUSB_STATE_URB_INIT; | ||
252 | } | ||
253 | |||
254 | /* dib->pid_parse here contains the value of the module parameter */ | ||
255 | /* decide if pid parsing can be deactivated: | ||
256 | * is possible (by device type) and wanted (by user) | ||
257 | */ | ||
258 | switch (dib->dibdev->dev_cl->id) { | ||
259 | case DIBUSB2_0: | ||
260 | case DIBUSB2_0B: | ||
261 | if (dib->udev->speed == USB_SPEED_HIGH && !dib->pid_parse) { | ||
262 | def_pid_parse = 0; | ||
263 | info("running at HIGH speed, will deliver the complete TS."); | ||
264 | } else | ||
265 | info("will use pid_parsing."); | ||
266 | break; | ||
267 | default: | ||
268 | break; | ||
269 | } | ||
270 | /* from here on it contains the device and user decision */ | ||
271 | dib->pid_parse = def_pid_parse; | ||
272 | |||
273 | return 0; | ||
274 | } | ||
275 | |||
276 | int dibusb_urb_exit(struct usb_dibusb *dib) | ||
277 | { | ||
278 | int i; | ||
279 | |||
280 | dibusb_urb_kill(dib); | ||
281 | |||
282 | if (dib->init_state & DIBUSB_STATE_URB_LIST) { | ||
283 | for (i = 0; i < dib->dibdev->dev_cl->urb_count; i++) { | ||
284 | if (dib->urb_list[i] != NULL) { | ||
285 | deb_info("freeing URB no. %d.\n",i); | ||
286 | /* free the URBs */ | ||
287 | usb_free_urb(dib->urb_list[i]); | ||
288 | } | ||
289 | } | ||
290 | /* free the urb array */ | ||
291 | kfree(dib->urb_list); | ||
292 | dib->init_state &= ~DIBUSB_STATE_URB_LIST; | ||
293 | } | ||
294 | |||
295 | if (dib->init_state & DIBUSB_STATE_URB_BUF) | ||
296 | pci_free_consistent(NULL, | ||
297 | dib->dibdev->dev_cl->urb_buffer_size*dib->dibdev->dev_cl->urb_count, | ||
298 | dib->buffer,dib->dma_handle); | ||
299 | |||
300 | dib->init_state &= ~DIBUSB_STATE_URB_BUF; | ||
301 | dib->init_state &= ~DIBUSB_STATE_URB_INIT; | ||
302 | return 0; | ||
303 | } | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb.h b/drivers/media/dvb/dibusb/dvb-dibusb.h deleted file mode 100644 index c965b64fb1ab..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb.h +++ /dev/null | |||
@@ -1,327 +0,0 @@ | |||
1 | /* | ||
2 | * dvb-dibusb.h | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation, version 2. | ||
9 | * | ||
10 | * for more information see dvb-dibusb-core.c . | ||
11 | */ | ||
12 | #ifndef __DVB_DIBUSB_H__ | ||
13 | #define __DVB_DIBUSB_H__ | ||
14 | |||
15 | #include <linux/input.h> | ||
16 | #include <linux/config.h> | ||
17 | #include <linux/usb.h> | ||
18 | |||
19 | #include "dvb_frontend.h" | ||
20 | #include "dvb_demux.h" | ||
21 | #include "dvb_net.h" | ||
22 | #include "dmxdev.h" | ||
23 | |||
24 | #include "dib3000.h" | ||
25 | #include "mt352.h" | ||
26 | |||
27 | /* debug */ | ||
28 | #ifdef CONFIG_DVB_DIBCOM_DEBUG | ||
29 | #define dprintk(level,args...) \ | ||
30 | do { if ((dvb_dibusb_debug & level)) { printk(args); } } while (0) | ||
31 | |||
32 | #define debug_dump(b,l) {\ | ||
33 | int i; \ | ||
34 | for (i = 0; i < l; i++) deb_xfer("%02x ", b[i]); \ | ||
35 | deb_xfer("\n");\ | ||
36 | } | ||
37 | |||
38 | #else | ||
39 | #define dprintk(args...) | ||
40 | #define debug_dump(b,l) | ||
41 | #endif | ||
42 | |||
43 | extern int dvb_dibusb_debug; | ||
44 | |||
45 | /* Version information */ | ||
46 | #define DRIVER_VERSION "0.3" | ||
47 | #define DRIVER_DESC "DiBcom based USB Budget DVB-T device" | ||
48 | #define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de" | ||
49 | |||
50 | #define deb_info(args...) dprintk(0x01,args) | ||
51 | #define deb_xfer(args...) dprintk(0x02,args) | ||
52 | #define deb_alot(args...) dprintk(0x04,args) | ||
53 | #define deb_ts(args...) dprintk(0x08,args) | ||
54 | #define deb_err(args...) dprintk(0x10,args) | ||
55 | #define deb_rc(args...) dprintk(0x20,args) | ||
56 | |||
57 | /* generic log methods - taken from usb.h */ | ||
58 | #undef err | ||
59 | #define err(format, arg...) printk(KERN_ERR "dvb-dibusb: " format "\n" , ## arg) | ||
60 | #undef info | ||
61 | #define info(format, arg...) printk(KERN_INFO "dvb-dibusb: " format "\n" , ## arg) | ||
62 | #undef warn | ||
63 | #define warn(format, arg...) printk(KERN_WARNING "dvb-dibusb: " format "\n" , ## arg) | ||
64 | |||
65 | struct dibusb_usb_controller { | ||
66 | const char *name; /* name of the usb controller */ | ||
67 | u16 cpu_cs_register; /* needs to be restarted, when the firmware has been downloaded. */ | ||
68 | }; | ||
69 | |||
70 | typedef enum { | ||
71 | DIBUSB1_1 = 0, | ||
72 | DIBUSB1_1_AN2235, | ||
73 | DIBUSB2_0, | ||
74 | UMT2_0, | ||
75 | DIBUSB2_0B, | ||
76 | NOVAT_USB2, | ||
77 | DTT200U, | ||
78 | } dibusb_class_t; | ||
79 | |||
80 | typedef enum { | ||
81 | DIBUSB_TUNER_CABLE_THOMSON = 0, | ||
82 | DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5, | ||
83 | DIBUSB_TUNER_CABLE_LG_TDTP_E102P, | ||
84 | DIBUSB_TUNER_COFDM_PANASONIC_ENV77H11D5, | ||
85 | } dibusb_tuner_t; | ||
86 | |||
87 | typedef enum { | ||
88 | DIBUSB_DIB3000MB = 0, | ||
89 | DIBUSB_DIB3000MC, | ||
90 | DIBUSB_MT352, | ||
91 | DTT200U_FE, | ||
92 | } dibusb_demodulator_t; | ||
93 | |||
94 | typedef enum { | ||
95 | DIBUSB_RC_NO = 0, | ||
96 | DIBUSB_RC_NEC_PROTOCOL, | ||
97 | DIBUSB_RC_HAUPPAUGE_PROTO, | ||
98 | } dibusb_remote_t; | ||
99 | |||
100 | struct dibusb_tuner { | ||
101 | dibusb_tuner_t id; | ||
102 | |||
103 | u8 pll_addr; /* tuner i2c address */ | ||
104 | }; | ||
105 | extern struct dibusb_tuner dibusb_tuner[]; | ||
106 | |||
107 | #define DIBUSB_POSSIBLE_I2C_ADDR_NUM 4 | ||
108 | struct dibusb_demod { | ||
109 | dibusb_demodulator_t id; | ||
110 | |||
111 | int pid_filter_count; /* counter of the internal pid_filter */ | ||
112 | u8 i2c_addrs[DIBUSB_POSSIBLE_I2C_ADDR_NUM]; /* list of possible i2c addresses of the demod */ | ||
113 | }; | ||
114 | |||
115 | #define DIBUSB_MAX_TUNER_NUM 2 | ||
116 | struct dibusb_device_class { | ||
117 | dibusb_class_t id; | ||
118 | |||
119 | const struct dibusb_usb_controller *usb_ctrl; /* usb controller */ | ||
120 | const char *firmware; /* valid firmware filenames */ | ||
121 | |||
122 | int pipe_cmd; /* command pipe (read/write) */ | ||
123 | int pipe_data; /* data pipe */ | ||
124 | |||
125 | int urb_count; /* number of data URBs to be submitted */ | ||
126 | int urb_buffer_size; /* the size of the buffer for each URB */ | ||
127 | |||
128 | dibusb_remote_t remote_type; /* does this device have a ir-receiver */ | ||
129 | |||
130 | struct dibusb_demod *demod; /* which demodulator is mount */ | ||
131 | struct dibusb_tuner *tuner; /* which tuner can be found here */ | ||
132 | }; | ||
133 | |||
134 | #define DIBUSB_ID_MAX_NUM 15 | ||
135 | struct dibusb_usb_device { | ||
136 | const char *name; /* real name of the box */ | ||
137 | struct dibusb_device_class *dev_cl; /* which dibusb_device_class is this device part of */ | ||
138 | |||
139 | struct usb_device_id *cold_ids[DIBUSB_ID_MAX_NUM]; /* list of USB ids when this device is at pre firmware state */ | ||
140 | struct usb_device_id *warm_ids[DIBUSB_ID_MAX_NUM]; /* list of USB ids when this device is at post firmware state */ | ||
141 | }; | ||
142 | |||
143 | /* a PID for the pid_filter list, when in use */ | ||
144 | struct dibusb_pid | ||
145 | { | ||
146 | int index; | ||
147 | u16 pid; | ||
148 | int active; | ||
149 | }; | ||
150 | |||
151 | struct usb_dibusb { | ||
152 | /* usb */ | ||
153 | struct usb_device * udev; | ||
154 | |||
155 | struct dibusb_usb_device * dibdev; | ||
156 | |||
157 | #define DIBUSB_STATE_INIT 0x000 | ||
158 | #define DIBUSB_STATE_URB_LIST 0x001 | ||
159 | #define DIBUSB_STATE_URB_BUF 0x002 | ||
160 | #define DIBUSB_STATE_URB_INIT 0x004 | ||
161 | #define DIBUSB_STATE_DVB 0x008 | ||
162 | #define DIBUSB_STATE_I2C 0x010 | ||
163 | #define DIBUSB_STATE_REMOTE 0x020 | ||
164 | #define DIBUSB_STATE_URB_SUBMIT 0x040 | ||
165 | int init_state; | ||
166 | |||
167 | int feedcount; | ||
168 | struct dib_fe_xfer_ops xfer_ops; | ||
169 | |||
170 | struct dibusb_tuner *tuner; | ||
171 | |||
172 | struct urb **urb_list; | ||
173 | u8 *buffer; | ||
174 | dma_addr_t dma_handle; | ||
175 | |||
176 | /* I2C */ | ||
177 | struct i2c_adapter i2c_adap; | ||
178 | |||
179 | /* locking */ | ||
180 | struct semaphore usb_sem; | ||
181 | struct semaphore i2c_sem; | ||
182 | |||
183 | /* dvb */ | ||
184 | struct dvb_adapter adapter; | ||
185 | struct dmxdev dmxdev; | ||
186 | struct dvb_demux demux; | ||
187 | struct dvb_net dvb_net; | ||
188 | struct dvb_frontend* fe; | ||
189 | |||
190 | int (*fe_sleep) (struct dvb_frontend *); | ||
191 | int (*fe_init) (struct dvb_frontend *); | ||
192 | |||
193 | /* remote control */ | ||
194 | struct input_dev rc_input_dev; | ||
195 | struct work_struct rc_query_work; | ||
196 | int last_event; | ||
197 | int last_state; /* for Hauppauge RC protocol */ | ||
198 | int repeat_key_count; | ||
199 | int rc_key_repeat_count; /* module parameter */ | ||
200 | |||
201 | /* module parameters */ | ||
202 | int pid_parse; | ||
203 | int rc_query_interval; | ||
204 | }; | ||
205 | |||
206 | /* commonly used functions in the separated files */ | ||
207 | |||
208 | /* dvb-dibusb-firmware.c */ | ||
209 | int dibusb_loadfirmware(struct usb_device *udev, struct dibusb_usb_device *dibdev); | ||
210 | |||
211 | /* dvb-dibusb-remote.c */ | ||
212 | int dibusb_remote_exit(struct usb_dibusb *dib); | ||
213 | int dibusb_remote_init(struct usb_dibusb *dib); | ||
214 | |||
215 | /* dvb-dibusb-fe-i2c.c */ | ||
216 | int dibusb_fe_init(struct usb_dibusb* dib); | ||
217 | int dibusb_fe_exit(struct usb_dibusb *dib); | ||
218 | int dibusb_i2c_init(struct usb_dibusb *dib); | ||
219 | int dibusb_i2c_exit(struct usb_dibusb *dib); | ||
220 | |||
221 | /* dvb-dibusb-dvb.c */ | ||
222 | void dibusb_urb_complete(struct urb *urb, struct pt_regs *ptregs); | ||
223 | int dibusb_dvb_init(struct usb_dibusb *dib); | ||
224 | int dibusb_dvb_exit(struct usb_dibusb *dib); | ||
225 | |||
226 | /* dvb-dibusb-usb.c */ | ||
227 | int dibusb_readwrite_usb(struct usb_dibusb *dib, u8 *wbuf, u16 wlen, u8 *rbuf, | ||
228 | u16 rlen); | ||
229 | int dibusb_write_usb(struct usb_dibusb *dib, u8 *buf, u16 len); | ||
230 | |||
231 | int dibusb_hw_wakeup(struct dvb_frontend *); | ||
232 | int dibusb_hw_sleep(struct dvb_frontend *); | ||
233 | int dibusb_set_streaming_mode(struct usb_dibusb *,u8); | ||
234 | int dibusb_streaming(struct usb_dibusb *,int); | ||
235 | |||
236 | int dibusb_urb_init(struct usb_dibusb *); | ||
237 | int dibusb_urb_exit(struct usb_dibusb *); | ||
238 | |||
239 | /* dvb-fe-dtt200u.c */ | ||
240 | struct dvb_frontend* dtt200u_fe_attach(struct usb_dibusb *,struct dib_fe_xfer_ops *); | ||
241 | |||
242 | /* i2c and transfer stuff */ | ||
243 | #define DIBUSB_I2C_TIMEOUT 5000 | ||
244 | |||
245 | /* | ||
246 | * protocol of all dibusb related devices | ||
247 | */ | ||
248 | |||
249 | /* | ||
250 | * bulk msg to/from endpoint 0x01 | ||
251 | * | ||
252 | * general structure: | ||
253 | * request_byte parameter_bytes | ||
254 | */ | ||
255 | |||
256 | #define DIBUSB_REQ_START_READ 0x00 | ||
257 | #define DIBUSB_REQ_START_DEMOD 0x01 | ||
258 | |||
259 | /* | ||
260 | * i2c read | ||
261 | * bulk write: 0x02 ((7bit i2c_addr << 1) & 0x01) register_bytes length_word | ||
262 | * bulk read: byte_buffer (length_word bytes) | ||
263 | */ | ||
264 | #define DIBUSB_REQ_I2C_READ 0x02 | ||
265 | |||
266 | /* | ||
267 | * i2c write | ||
268 | * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes | ||
269 | */ | ||
270 | #define DIBUSB_REQ_I2C_WRITE 0x03 | ||
271 | |||
272 | /* | ||
273 | * polling the value of the remote control | ||
274 | * bulk write: 0x04 | ||
275 | * bulk read: byte_buffer (5 bytes) | ||
276 | * | ||
277 | * first byte of byte_buffer shows the status (0x00, 0x01, 0x02) | ||
278 | */ | ||
279 | #define DIBUSB_REQ_POLL_REMOTE 0x04 | ||
280 | |||
281 | #define DIBUSB_RC_NEC_EMPTY 0x00 | ||
282 | #define DIBUSB_RC_NEC_KEY_PRESSED 0x01 | ||
283 | #define DIBUSB_RC_NEC_KEY_REPEATED 0x02 | ||
284 | |||
285 | /* additional status values for Hauppauge Remote Control Protocol */ | ||
286 | #define DIBUSB_RC_HAUPPAUGE_KEY_PRESSED 0x01 | ||
287 | #define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY 0x03 | ||
288 | |||
289 | /* streaming mode: | ||
290 | * bulk write: 0x05 mode_byte | ||
291 | * | ||
292 | * mode_byte is mostly 0x00 | ||
293 | */ | ||
294 | #define DIBUSB_REQ_SET_STREAMING_MODE 0x05 | ||
295 | |||
296 | /* interrupt the internal read loop, when blocking */ | ||
297 | #define DIBUSB_REQ_INTR_READ 0x06 | ||
298 | |||
299 | /* io control | ||
300 | * 0x07 cmd_byte param_bytes | ||
301 | * | ||
302 | * param_bytes can be up to 32 bytes | ||
303 | * | ||
304 | * cmd_byte function parameter name | ||
305 | * 0x00 power mode | ||
306 | * 0x00 sleep | ||
307 | * 0x01 wakeup | ||
308 | * | ||
309 | * 0x01 enable streaming | ||
310 | * 0x02 disable streaming | ||
311 | * | ||
312 | * | ||
313 | */ | ||
314 | #define DIBUSB_REQ_SET_IOCTL 0x07 | ||
315 | |||
316 | /* IOCTL commands */ | ||
317 | |||
318 | /* change the power mode in firmware */ | ||
319 | #define DIBUSB_IOCTL_CMD_POWER_MODE 0x00 | ||
320 | #define DIBUSB_IOCTL_POWER_SLEEP 0x00 | ||
321 | #define DIBUSB_IOCTL_POWER_WAKEUP 0x01 | ||
322 | |||
323 | /* modify streaming of the FX2 */ | ||
324 | #define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01 | ||
325 | #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02 | ||
326 | |||
327 | #endif | ||
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c index c225de7ffd82..68050cd527cb 100644 --- a/drivers/media/dvb/dvb-core/dmxdev.c +++ b/drivers/media/dvb/dvb-core/dmxdev.c | |||
@@ -42,12 +42,6 @@ MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); | |||
42 | 42 | ||
43 | #define dprintk if (debug) printk | 43 | #define dprintk if (debug) printk |
44 | 44 | ||
45 | static inline struct dmxdev_filter * | ||
46 | dvb_dmxdev_file_to_filter(struct file *file) | ||
47 | { | ||
48 | return (struct dmxdev_filter *) file->private_data; | ||
49 | } | ||
50 | |||
51 | static inline void dvb_dmxdev_buffer_init(struct dmxdev_buffer *buffer) | 45 | static inline void dvb_dmxdev_buffer_init(struct dmxdev_buffer *buffer) |
52 | { | 46 | { |
53 | buffer->data=NULL; | 47 | buffer->data=NULL; |
@@ -669,8 +663,10 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) | |||
669 | 663 | ||
670 | ret = filter->feed.ts->start_filtering(filter->feed.ts); | 664 | ret = filter->feed.ts->start_filtering(filter->feed.ts); |
671 | 665 | ||
672 | if (ret < 0) | 666 | if (ret < 0) { |
667 | dmxdev->demux->release_ts_feed(dmxdev->demux, *tsfeed); | ||
673 | return ret; | 668 | return ret; |
669 | } | ||
674 | 670 | ||
675 | break; | 671 | break; |
676 | } | 672 | } |
@@ -842,7 +838,7 @@ static ssize_t dvb_dmxdev_read_sec(struct dmxdev_filter *dfil, | |||
842 | static ssize_t | 838 | static ssize_t |
843 | dvb_demux_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 839 | dvb_demux_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) |
844 | { | 840 | { |
845 | struct dmxdev_filter *dmxdevfilter=dvb_dmxdev_file_to_filter(file); | 841 | struct dmxdev_filter *dmxdevfilter= file->private_data; |
846 | int ret=0; | 842 | int ret=0; |
847 | 843 | ||
848 | if (down_interruptible(&dmxdevfilter->mutex)) | 844 | if (down_interruptible(&dmxdevfilter->mutex)) |
@@ -863,7 +859,7 @@ dvb_demux_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
863 | static int dvb_demux_do_ioctl(struct inode *inode, struct file *file, | 859 | static int dvb_demux_do_ioctl(struct inode *inode, struct file *file, |
864 | unsigned int cmd, void *parg) | 860 | unsigned int cmd, void *parg) |
865 | { | 861 | { |
866 | struct dmxdev_filter *dmxdevfilter=dvb_dmxdev_file_to_filter(file); | 862 | struct dmxdev_filter *dmxdevfilter = file->private_data; |
867 | struct dmxdev *dmxdev=dmxdevfilter->dev; | 863 | struct dmxdev *dmxdev=dmxdevfilter->dev; |
868 | unsigned long arg=(unsigned long) parg; | 864 | unsigned long arg=(unsigned long) parg; |
869 | int ret=0; | 865 | int ret=0; |
@@ -960,7 +956,7 @@ static int dvb_demux_ioctl(struct inode *inode, struct file *file, | |||
960 | 956 | ||
961 | static unsigned int dvb_demux_poll (struct file *file, poll_table *wait) | 957 | static unsigned int dvb_demux_poll (struct file *file, poll_table *wait) |
962 | { | 958 | { |
963 | struct dmxdev_filter *dmxdevfilter = dvb_dmxdev_file_to_filter(file); | 959 | struct dmxdev_filter *dmxdevfilter = file->private_data; |
964 | unsigned int mask = 0; | 960 | unsigned int mask = 0; |
965 | 961 | ||
966 | if (!dmxdevfilter) | 962 | if (!dmxdevfilter) |
@@ -985,7 +981,7 @@ static unsigned int dvb_demux_poll (struct file *file, poll_table *wait) | |||
985 | 981 | ||
986 | static int dvb_demux_release(struct inode *inode, struct file *file) | 982 | static int dvb_demux_release(struct inode *inode, struct file *file) |
987 | { | 983 | { |
988 | struct dmxdev_filter *dmxdevfilter = dvb_dmxdev_file_to_filter(file); | 984 | struct dmxdev_filter *dmxdevfilter = file->private_data; |
989 | struct dmxdev *dmxdev = dmxdevfilter->dev; | 985 | struct dmxdev *dmxdev = dmxdevfilter->dev; |
990 | 986 | ||
991 | return dvb_dmxdev_filter_free(dmxdev, dmxdevfilter); | 987 | return dvb_dmxdev_filter_free(dmxdev, dmxdevfilter); |
@@ -1109,7 +1105,6 @@ dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) | |||
1109 | dvb_dmxdev_filter_state_set(&dmxdev->filter[i], DMXDEV_STATE_FREE); | 1105 | dvb_dmxdev_filter_state_set(&dmxdev->filter[i], DMXDEV_STATE_FREE); |
1110 | dmxdev->dvr[i].dev=dmxdev; | 1106 | dmxdev->dvr[i].dev=dmxdev; |
1111 | dmxdev->dvr[i].buffer.data=NULL; | 1107 | dmxdev->dvr[i].buffer.data=NULL; |
1112 | dvb_dmxdev_filter_state_set(&dmxdev->filter[i], DMXDEV_STATE_FREE); | ||
1113 | dvb_dmxdev_dvr_state_set(&dmxdev->dvr[i], DMXDEV_STATE_FREE); | 1108 | dvb_dmxdev_dvr_state_set(&dmxdev->dvr[i], DMXDEV_STATE_FREE); |
1114 | } | 1109 | } |
1115 | 1110 | ||
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index d19301d90a09..a8bc84240b50 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -35,12 +35,15 @@ | |||
35 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
36 | #include <linux/list.h> | 36 | #include <linux/list.h> |
37 | #include <linux/suspend.h> | 37 | #include <linux/suspend.h> |
38 | #include <linux/jiffies.h> | ||
38 | #include <asm/processor.h> | 39 | #include <asm/processor.h> |
39 | #include <asm/semaphore.h> | 40 | #include <asm/semaphore.h> |
40 | 41 | ||
41 | #include "dvb_frontend.h" | 42 | #include "dvb_frontend.h" |
42 | #include "dvbdev.h" | 43 | #include "dvbdev.h" |
43 | 44 | ||
45 | // #define DEBUG_LOCKLOSS 1 | ||
46 | |||
44 | static int dvb_frontend_debug; | 47 | static int dvb_frontend_debug; |
45 | static int dvb_shutdown_timeout = 5; | 48 | static int dvb_shutdown_timeout = 5; |
46 | static int dvb_force_auto_inversion; | 49 | static int dvb_force_auto_inversion; |
@@ -112,6 +115,7 @@ struct dvb_frontend_private { | |||
112 | int exit; | 115 | int exit; |
113 | int wakeup; | 116 | int wakeup; |
114 | fe_status_t status; | 117 | fe_status_t status; |
118 | fe_sec_tone_mode_t tone; | ||
115 | }; | 119 | }; |
116 | 120 | ||
117 | 121 | ||
@@ -327,7 +331,8 @@ static int dvb_frontend_is_exiting(struct dvb_frontend *fe) | |||
327 | return 1; | 331 | return 1; |
328 | 332 | ||
329 | if (fepriv->dvbdev->writers == 1) | 333 | if (fepriv->dvbdev->writers == 1) |
330 | if (jiffies - fepriv->release_jiffies > dvb_shutdown_timeout * HZ) | 334 | if (time_after(jiffies, fepriv->release_jiffies + |
335 | dvb_shutdown_timeout * HZ)) | ||
331 | return 1; | 336 | return 1; |
332 | 337 | ||
333 | return 0; | 338 | return 0; |
@@ -389,8 +394,7 @@ static int dvb_frontend_thread(void *data) | |||
389 | break; | 394 | break; |
390 | } | 395 | } |
391 | 396 | ||
392 | if (current->flags & PF_FREEZE) | 397 | try_to_freeze(); |
393 | refrigerator(PF_FREEZE); | ||
394 | 398 | ||
395 | if (down_interruptible(&fepriv->sem)) | 399 | if (down_interruptible(&fepriv->sem)) |
396 | break; | 400 | break; |
@@ -433,9 +437,26 @@ static int dvb_frontend_thread(void *data) | |||
433 | /* we're tuned, and the lock is still good... */ | 437 | /* we're tuned, and the lock is still good... */ |
434 | if (s & FE_HAS_LOCK) | 438 | if (s & FE_HAS_LOCK) |
435 | continue; | 439 | continue; |
436 | else { | 440 | else { /* if we _WERE_ tuned, but now don't have a lock */ |
437 | /* if we _WERE_ tuned, but now don't have a lock, | 441 | #ifdef DEBUG_LOCKLOSS |
438 | * need to zigzag */ | 442 | /* first of all try setting the tone again if it was on - this |
443 | * sometimes works around problems with noisy power supplies */ | ||
444 | if (fe->ops->set_tone && (fepriv->tone == SEC_TONE_ON)) { | ||
445 | fe->ops->set_tone(fe, fepriv->tone); | ||
446 | mdelay(100); | ||
447 | s = 0; | ||
448 | fe->ops->read_status(fe, &s); | ||
449 | if (s & FE_HAS_LOCK) { | ||
450 | printk("DVB%i: Lock was lost, but regained by setting " | ||
451 | "the tone. This may indicate your power supply " | ||
452 | "is noisy/slightly incompatable with this DVB-S " | ||
453 | "adapter\n", fe->dvb->num); | ||
454 | fepriv->state = FESTATE_TUNED; | ||
455 | continue; | ||
456 | } | ||
457 | } | ||
458 | #endif | ||
459 | /* some other reason for losing the lock - start zigzagging */ | ||
439 | fepriv->state = FESTATE_ZIGZAG_FAST; | 460 | fepriv->state = FESTATE_ZIGZAG_FAST; |
440 | fepriv->started_auto_step = fepriv->auto_step; | 461 | fepriv->started_auto_step = fepriv->auto_step; |
441 | check_wrapped = 0; | 462 | check_wrapped = 0; |
@@ -625,11 +646,21 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, | |||
625 | break; | 646 | break; |
626 | } | 647 | } |
627 | 648 | ||
628 | case FE_READ_STATUS: | 649 | case FE_READ_STATUS: { |
650 | fe_status_t* status = parg; | ||
651 | |||
652 | /* if retune was requested but hasn't occured yet, prevent | ||
653 | * that user get signal state from previous tuning */ | ||
654 | if(fepriv->state == FESTATE_RETUNE) { | ||
655 | err=0; | ||
656 | *status = 0; | ||
657 | break; | ||
658 | } | ||
659 | |||
629 | if (fe->ops->read_status) | 660 | if (fe->ops->read_status) |
630 | err = fe->ops->read_status(fe, (fe_status_t*) parg); | 661 | err = fe->ops->read_status(fe, status); |
631 | break; | 662 | break; |
632 | 663 | } | |
633 | case FE_READ_BER: | 664 | case FE_READ_BER: |
634 | if (fe->ops->read_ber) | 665 | if (fe->ops->read_ber) |
635 | err = fe->ops->read_ber(fe, (__u32*) parg); | 666 | err = fe->ops->read_ber(fe, (__u32*) parg); |
@@ -680,6 +711,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, | |||
680 | err = fe->ops->set_tone(fe, (fe_sec_tone_mode_t) parg); | 711 | err = fe->ops->set_tone(fe, (fe_sec_tone_mode_t) parg); |
681 | fepriv->state = FESTATE_DISEQC; | 712 | fepriv->state = FESTATE_DISEQC; |
682 | fepriv->status = 0; | 713 | fepriv->status = 0; |
714 | fepriv->tone = (fe_sec_tone_mode_t) parg; | ||
683 | } | 715 | } |
684 | break; | 716 | break; |
685 | 717 | ||
@@ -882,6 +914,7 @@ int dvb_register_frontend(struct dvb_adapter* dvb, | |||
882 | init_MUTEX (&fepriv->events.sem); | 914 | init_MUTEX (&fepriv->events.sem); |
883 | fe->dvb = dvb; | 915 | fe->dvb = dvb; |
884 | fepriv->inversion = INVERSION_OFF; | 916 | fepriv->inversion = INVERSION_OFF; |
917 | fepriv->tone = SEC_TONE_OFF; | ||
885 | 918 | ||
886 | printk ("DVB: registering frontend %i (%s)...\n", | 919 | printk ("DVB: registering frontend %i (%s)...\n", |
887 | fe->dvb->num, | 920 | fe->dvb->num, |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h b/drivers/media/dvb/dvb-core/dvb_frontend.h index d2b021792791..9c2c1d1136bd 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.h +++ b/drivers/media/dvb/dvb-core/dvb_frontend.h | |||
@@ -40,28 +40,6 @@ | |||
40 | 40 | ||
41 | #include "dvbdev.h" | 41 | #include "dvbdev.h" |
42 | 42 | ||
43 | /* FIXME: Move to i2c-id.h */ | ||
44 | #define I2C_DRIVERID_DVBFE_SP8870 I2C_DRIVERID_EXP2 | ||
45 | #define I2C_DRIVERID_DVBFE_CX22700 I2C_DRIVERID_EXP2 | ||
46 | #define I2C_DRIVERID_DVBFE_AT76C651 I2C_DRIVERID_EXP2 | ||
47 | #define I2C_DRIVERID_DVBFE_CX24110 I2C_DRIVERID_EXP2 | ||
48 | #define I2C_DRIVERID_DVBFE_CX22702 I2C_DRIVERID_EXP2 | ||
49 | #define I2C_DRIVERID_DVBFE_DIB3000MB I2C_DRIVERID_EXP2 | ||
50 | #define I2C_DRIVERID_DVBFE_DST I2C_DRIVERID_EXP2 | ||
51 | #define I2C_DRIVERID_DVBFE_DUMMY I2C_DRIVERID_EXP2 | ||
52 | #define I2C_DRIVERID_DVBFE_L64781 I2C_DRIVERID_EXP2 | ||
53 | #define I2C_DRIVERID_DVBFE_MT312 I2C_DRIVERID_EXP2 | ||
54 | #define I2C_DRIVERID_DVBFE_MT352 I2C_DRIVERID_EXP2 | ||
55 | #define I2C_DRIVERID_DVBFE_NXT6000 I2C_DRIVERID_EXP2 | ||
56 | #define I2C_DRIVERID_DVBFE_SP887X I2C_DRIVERID_EXP2 | ||
57 | #define I2C_DRIVERID_DVBFE_STV0299 I2C_DRIVERID_EXP2 | ||
58 | #define I2C_DRIVERID_DVBFE_TDA1004X I2C_DRIVERID_EXP2 | ||
59 | #define I2C_DRIVERID_DVBFE_TDA8083 I2C_DRIVERID_EXP2 | ||
60 | #define I2C_DRIVERID_DVBFE_VES1820 I2C_DRIVERID_EXP2 | ||
61 | #define I2C_DRIVERID_DVBFE_VES1X93 I2C_DRIVERID_EXP2 | ||
62 | #define I2C_DRIVERID_DVBFE_TDA80XX I2C_DRIVERID_EXP2 | ||
63 | |||
64 | |||
65 | struct dvb_frontend_tune_settings { | 43 | struct dvb_frontend_tune_settings { |
66 | int min_delay_ms; | 44 | int min_delay_ms; |
67 | int step_size; | 45 | int step_size; |
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig new file mode 100644 index 000000000000..612e5b087b1c --- /dev/null +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -0,0 +1,119 @@ | |||
1 | config DVB_USB | ||
2 | tristate "Support for various USB DVB devices" | ||
3 | depends on DVB_CORE && USB | ||
4 | select FW_LOADER | ||
5 | help | ||
6 | By enabling this you will be able to choose the various supported | ||
7 | USB1.1 and USB2.0 DVB devices. | ||
8 | |||
9 | Almost every USB device needs a firmware, please look into | ||
10 | <file:Documentation/dvb/README.dvb-usb>. | ||
11 | |||
12 | For a complete list of supported USB devices see the LinuxTV DVB Wiki: | ||
13 | <http://www.linuxtv.org/wiki/index.php/DVB_USB> | ||
14 | |||
15 | Say Y if you own a USB DVB device. | ||
16 | |||
17 | config DVB_USB_DEBUG | ||
18 | bool "Enable extended debug support for all DVB-USB devices" | ||
19 | depends on DVB_USB | ||
20 | help | ||
21 | Say Y if you want to enable debugging. See modinfo dvb-usb (and the | ||
22 | appropriate drivers) for debug levels. | ||
23 | |||
24 | config DVB_USB_A800 | ||
25 | tristate "AVerMedia AverTV DVB-T USB 2.0 (A800)" | ||
26 | depends on DVB_USB | ||
27 | select DVB_DIB3000MC | ||
28 | help | ||
29 | Say Y here to support the AVerMedia AverTV DVB-T USB 2.0 (A800) receiver. | ||
30 | |||
31 | config DVB_USB_DIBUSB_MB | ||
32 | tristate "DiBcom USB DVB-T devices (based on the DiB3000M-B) (see help for device list)" | ||
33 | depends on DVB_USB | ||
34 | select DVB_DIB3000MB | ||
35 | help | ||
36 | Support for USB 1.1 and 2.0 DVB-T receivers based on reference designs made by | ||
37 | DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-B demodulator. | ||
38 | |||
39 | Devices supported by this driver: | ||
40 | TwinhanDTV USB-Ter (VP7041) | ||
41 | TwinhanDTV Magic Box (VP7041e) | ||
42 | KWorld/JetWay/ADSTech V-Stream XPERT DTV - DVB-T USB1.1 and USB2.0 | ||
43 | Hama DVB-T USB1.1-Box | ||
44 | DiBcom USB1.1 reference devices (non-public) | ||
45 | Ultima Electronic/Artec T1 USB TVBOX | ||
46 | Compro Videomate DVB-U2000 - DVB-T USB | ||
47 | Grandtec DVB-T USB | ||
48 | Avermedia AverTV DVBT USB1.1 | ||
49 | Artec T1 USB1.1 boxes | ||
50 | |||
51 | The VP7041 seems to be identical to "CTS Portable" (Chinese | ||
52 | Television System). | ||
53 | |||
54 | Say Y if you own such a device and want to use it. You should build it as | ||
55 | a module. | ||
56 | |||
57 | config DVB_USB_DIBUSB_MC | ||
58 | tristate "DiBcom USB DVB-T devices (based on the DiB3000M-C/P) (see help for device list)" | ||
59 | depends on DVB_USB | ||
60 | select DVB_DIB3000MC | ||
61 | help | ||
62 | Support for 2.0 DVB-T receivers based on reference designs made by | ||
63 | DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-C/P demodulator. | ||
64 | |||
65 | Devices supported by this driver: | ||
66 | DiBcom USB2.0 reference devices (non-public) | ||
67 | Artec T1 USB2.0 boxes | ||
68 | |||
69 | Say Y if you own such a device and want to use it. You should build it as | ||
70 | a module. | ||
71 | |||
72 | config DVB_USB_UMT_010 | ||
73 | tristate "HanfTek UMT-010 DVB-T USB2.0 support" | ||
74 | depends on DVB_USB | ||
75 | select DVB_DIB3000MC | ||
76 | help | ||
77 | Say Y here to support the HanfTek UMT-010 USB2.0 stick-sized DVB-T receiver. | ||
78 | |||
79 | config DVB_USB_CXUSB | ||
80 | tristate "Medion MD95700 hybrid USB2.0 (Conexant) support" | ||
81 | depends on DVB_USB | ||
82 | select DVB_CX22702 | ||
83 | help | ||
84 | Say Y here to support the Medion MD95700 hybrid USB2.0 device. Currently | ||
85 | only the DVB-T part is supported. | ||
86 | |||
87 | config DVB_USB_DIGITV | ||
88 | tristate "Nebula Electronics uDigiTV DVB-T USB2.0 support" | ||
89 | depends on DVB_USB | ||
90 | select DVB_NXT6000 | ||
91 | select DVB_MT352 | ||
92 | help | ||
93 | Say Y here to support the Nebula Electronics uDigitV USB2.0 DVB-T receiver. | ||
94 | |||
95 | config DVB_USB_VP7045 | ||
96 | tristate "TwinhanDTV Alpha/MagicBoxII and DNTV tinyUSB2 DVB-T USB2.0 support" | ||
97 | depends on DVB_USB | ||
98 | help | ||
99 | Say Y here to support the | ||
100 | TwinhanDTV Alpha (stick) (VP-7045), | ||
101 | TwinhanDTV MagicBox II (VP-7046) and | ||
102 | DigitalNow TinyUSB 2 DVB-t DVB-T USB2.0 receivers. | ||
103 | |||
104 | config DVB_USB_NOVA_T_USB2 | ||
105 | tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support" | ||
106 | depends on DVB_USB | ||
107 | select DVB_DIB3000MC | ||
108 | help | ||
109 | Say Y here to support the Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 receiver. | ||
110 | |||
111 | config DVB_USB_DTT200U | ||
112 | tristate "WideView WT-200U and WT-220U (pen) DVB-T USB2.0 support (Yakumo/Hama/Typhoon/Yuan)" | ||
113 | depends on DVB_USB | ||
114 | help | ||
115 | Say Y here to support the WideView/Yakumo/Hama/Typhoon/Yuan DVB-T USB2.0 receiver. | ||
116 | |||
117 | The receivers are also known as DTT200U (Yakumo) and UB300 (Yuan). | ||
118 | |||
119 | The WT-220U and its clones are pen-sized. | ||
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile new file mode 100644 index 000000000000..746d87ed6f32 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/Makefile | |||
@@ -0,0 +1,33 @@ | |||
1 | dvb-usb-objs = dvb-usb-firmware.o dvb-usb-init.o dvb-usb-urb.o dvb-usb-i2c.o dvb-usb-dvb.o dvb-usb-remote.o | ||
2 | obj-$(CONFIG_DVB_USB) += dvb-usb.o | ||
3 | |||
4 | dvb-usb-vp7045-objs = vp7045.o vp7045-fe.o | ||
5 | obj-$(CONFIG_DVB_USB_VP7045) += dvb-usb-vp7045.o | ||
6 | |||
7 | dvb-usb-dtt200u-objs = dtt200u.o dtt200u-fe.o | ||
8 | obj-$(CONFIG_DVB_USB_DTT200U) += dvb-usb-dtt200u.o | ||
9 | |||
10 | dvb-usb-dibusb-common-objs = dibusb-common.o | ||
11 | |||
12 | dvb-usb-a800-objs = a800.o | ||
13 | obj-$(CONFIG_DVB_USB_A800) += dvb-usb-dibusb-common.o dvb-usb-a800.o | ||
14 | |||
15 | dvb-usb-dibusb-mb-objs = dibusb-mb.o | ||
16 | obj-$(CONFIG_DVB_USB_DIBUSB_MB) += dvb-usb-dibusb-common.o dvb-usb-dibusb-mb.o | ||
17 | |||
18 | dvb-usb-dibusb-mc-objs = dibusb-mc.o | ||
19 | obj-$(CONFIG_DVB_USB_DIBUSB_MC) += dvb-usb-dibusb-common.o dvb-usb-dibusb-mc.o | ||
20 | |||
21 | dvb-usb-nova-t-usb2-objs = nova-t-usb2.o | ||
22 | obj-$(CONFIG_DVB_USB_NOVA_T_USB2) += dvb-usb-dibusb-common.o dvb-usb-nova-t-usb2.o | ||
23 | |||
24 | dvb-usb-umt-010-objs = umt-010.o | ||
25 | obj-$(CONFIG_DVB_USB_UMT_010) += dvb-usb-dibusb-common.o dvb-usb-umt-010.o | ||
26 | |||
27 | dvb-usb-digitv-objs = digitv.o | ||
28 | obj-$(CONFIG_DVB_USB_DIGITV) += dvb-usb-digitv.o | ||
29 | |||
30 | dvb-usb-cxusb-objs = cxusb.o | ||
31 | obj-$(CONFIG_DVB_USB_CXUSB) += dvb-usb-cxusb.o | ||
32 | |||
33 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | ||
diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c new file mode 100644 index 000000000000..f2fcc2f1f846 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/a800.c | |||
@@ -0,0 +1,182 @@ | |||
1 | /* DVB USB framework compliant Linux driver for the AVerMedia AverTV DVB-T | ||
2 | * USB2.0 (A800) DVB-T receiver. | ||
3 | * | ||
4 | * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * Thanks to | ||
7 | * - AVerMedia who kindly provided information and | ||
8 | * - Glen Harris who suffered from my mistakes during development. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the Free | ||
12 | * Software Foundation, version 2. | ||
13 | * | ||
14 | * see Documentation/dvb/README.dvb-usb for more information | ||
15 | */ | ||
16 | #include "dibusb.h" | ||
17 | |||
18 | static int debug; | ||
19 | module_param(debug, int, 0644); | ||
20 | MODULE_PARM_DESC(debug, "set debugging level (rc=1 (or-able))." DVB_USB_DEBUG_STATUS); | ||
21 | #define deb_rc(args...) dprintk(debug,0x01,args) | ||
22 | |||
23 | static int a800_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
24 | { | ||
25 | /* do nothing for the AVerMedia */ | ||
26 | return 0; | ||
27 | } | ||
28 | |||
29 | static struct dvb_usb_rc_key a800_rc_keys[] = { | ||
30 | { 0x02, 0x01, KEY_PROG1 }, /* SOURCE */ | ||
31 | { 0x02, 0x00, KEY_POWER }, /* POWER */ | ||
32 | { 0x02, 0x05, KEY_1 }, /* 1 */ | ||
33 | { 0x02, 0x06, KEY_2 }, /* 2 */ | ||
34 | { 0x02, 0x07, KEY_3 }, /* 3 */ | ||
35 | { 0x02, 0x09, KEY_4 }, /* 4 */ | ||
36 | { 0x02, 0x0a, KEY_5 }, /* 5 */ | ||
37 | { 0x02, 0x0b, KEY_6 }, /* 6 */ | ||
38 | { 0x02, 0x0d, KEY_7 }, /* 7 */ | ||
39 | { 0x02, 0x0e, KEY_8 }, /* 8 */ | ||
40 | { 0x02, 0x0f, KEY_9 }, /* 9 */ | ||
41 | { 0x02, 0x12, KEY_LEFT }, /* L / DISPLAY */ | ||
42 | { 0x02, 0x11, KEY_0 }, /* 0 */ | ||
43 | { 0x02, 0x13, KEY_RIGHT }, /* R / CH RTN */ | ||
44 | { 0x02, 0x17, KEY_PROG2 }, /* SNAP SHOT */ | ||
45 | { 0x02, 0x10, KEY_PROG3 }, /* 16-CH PREV */ | ||
46 | { 0x02, 0x03, KEY_CHANNELUP }, /* CH UP */ | ||
47 | { 0x02, 0x1e, KEY_VOLUMEDOWN }, /* VOL DOWN */ | ||
48 | { 0x02, 0x0c, KEY_ZOOM }, /* FULL SCREEN */ | ||
49 | { 0x02, 0x1f, KEY_VOLUMEUP }, /* VOL UP */ | ||
50 | { 0x02, 0x02, KEY_CHANNELDOWN }, /* CH DOWN */ | ||
51 | { 0x02, 0x14, KEY_MUTE }, /* MUTE */ | ||
52 | { 0x02, 0x08, KEY_AUDIO }, /* AUDIO */ | ||
53 | { 0x02, 0x19, KEY_RECORD }, /* RECORD */ | ||
54 | { 0x02, 0x18, KEY_PLAY }, /* PLAY */ | ||
55 | { 0x02, 0x1b, KEY_STOP }, /* STOP */ | ||
56 | { 0x02, 0x1a, KEY_PLAYPAUSE }, /* TIMESHIFT / PAUSE */ | ||
57 | { 0x02, 0x1d, KEY_BACK }, /* << / RED */ | ||
58 | { 0x02, 0x1c, KEY_FORWARD }, /* >> / YELLOW */ | ||
59 | { 0x02, 0x03, KEY_TEXT }, /* TELETEXT */ | ||
60 | { 0x02, 0x01, KEY_FIRST }, /* |<< / GREEN */ | ||
61 | { 0x02, 0x00, KEY_LAST }, /* >>| / BLUE */ | ||
62 | { 0x02, 0x04, KEY_EPG }, /* EPG */ | ||
63 | { 0x02, 0x15, KEY_MENU }, /* MENU */ | ||
64 | |||
65 | { 0x03, 0x03, KEY_CHANNELUP }, /* CH UP */ | ||
66 | { 0x03, 0x02, KEY_CHANNELDOWN }, /* CH DOWN */ | ||
67 | { 0x03, 0x01, KEY_FIRST }, /* |<< / GREEN */ | ||
68 | { 0x03, 0x00, KEY_LAST }, /* >>| / BLUE */ | ||
69 | |||
70 | }; | ||
71 | |||
72 | int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
73 | { | ||
74 | u8 key[5]; | ||
75 | if (usb_control_msg(d->udev,usb_rcvctrlpipe(d->udev,0), | ||
76 | 0x04, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, key, 5, | ||
77 | 2000) != 5) | ||
78 | return -ENODEV; | ||
79 | |||
80 | /* call the universal NEC remote processor, to find out the key's state and event */ | ||
81 | dvb_usb_nec_rc_key_to_event(d,key,event,state); | ||
82 | if (key[0] != 0) | ||
83 | deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); | ||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | /* USB Driver stuff */ | ||
88 | static struct dvb_usb_properties a800_properties; | ||
89 | |||
90 | static int a800_probe(struct usb_interface *intf, | ||
91 | const struct usb_device_id *id) | ||
92 | { | ||
93 | return dvb_usb_device_init(intf,&a800_properties,THIS_MODULE); | ||
94 | } | ||
95 | |||
96 | /* do not change the order of the ID table */ | ||
97 | static struct usb_device_id a800_table [] = { | ||
98 | /* 00 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB2_COLD) }, | ||
99 | /* 01 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB2_WARM) }, | ||
100 | { } /* Terminating entry */ | ||
101 | }; | ||
102 | MODULE_DEVICE_TABLE (usb, a800_table); | ||
103 | |||
104 | static struct dvb_usb_properties a800_properties = { | ||
105 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, | ||
106 | .pid_filter_count = 32, | ||
107 | |||
108 | .usb_ctrl = CYPRESS_FX2, | ||
109 | |||
110 | .firmware = "dvb-usb-avertv-a800-02.fw", | ||
111 | |||
112 | .size_of_priv = sizeof(struct dibusb_state), | ||
113 | |||
114 | .streaming_ctrl = dibusb2_0_streaming_ctrl, | ||
115 | .pid_filter = dibusb_pid_filter, | ||
116 | .pid_filter_ctrl = dibusb_pid_filter_ctrl, | ||
117 | .power_ctrl = a800_power_ctrl, | ||
118 | .frontend_attach = dibusb_dib3000mc_frontend_attach, | ||
119 | .tuner_attach = dibusb_dib3000mc_tuner_attach, | ||
120 | |||
121 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
122 | .rc_key_map = a800_rc_keys, | ||
123 | .rc_key_map_size = ARRAY_SIZE(a800_rc_keys), | ||
124 | .rc_query = a800_rc_query, | ||
125 | |||
126 | .i2c_algo = &dibusb_i2c_algo, | ||
127 | |||
128 | .generic_bulk_ctrl_endpoint = 0x01, | ||
129 | /* parameter for the MPEG2-data transfer */ | ||
130 | .urb = { | ||
131 | .type = DVB_USB_BULK, | ||
132 | .count = 7, | ||
133 | .endpoint = 0x06, | ||
134 | .u = { | ||
135 | .bulk = { | ||
136 | .buffersize = 4096, | ||
137 | } | ||
138 | } | ||
139 | }, | ||
140 | |||
141 | .num_device_descs = 1, | ||
142 | .devices = { | ||
143 | { "AVerMedia AverTV DVB-T USB 2.0 (A800)", | ||
144 | { &a800_table[0], NULL }, | ||
145 | { &a800_table[1], NULL }, | ||
146 | }, | ||
147 | } | ||
148 | }; | ||
149 | |||
150 | static struct usb_driver a800_driver = { | ||
151 | .owner = THIS_MODULE, | ||
152 | .name = "dvb_usb_a800", | ||
153 | .probe = a800_probe, | ||
154 | .disconnect = dvb_usb_device_exit, | ||
155 | .id_table = a800_table, | ||
156 | }; | ||
157 | |||
158 | /* module stuff */ | ||
159 | static int __init a800_module_init(void) | ||
160 | { | ||
161 | int result; | ||
162 | if ((result = usb_register(&a800_driver))) { | ||
163 | err("usb_register failed. Error number %d",result); | ||
164 | return result; | ||
165 | } | ||
166 | |||
167 | return 0; | ||
168 | } | ||
169 | |||
170 | static void __exit a800_module_exit(void) | ||
171 | { | ||
172 | /* deregister this driver from the USB subsystem */ | ||
173 | usb_deregister(&a800_driver); | ||
174 | } | ||
175 | |||
176 | module_init (a800_module_init); | ||
177 | module_exit (a800_module_exit); | ||
178 | |||
179 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
180 | MODULE_DESCRIPTION("AVerMedia AverTV DVB-T USB 2.0 (A800)"); | ||
181 | MODULE_VERSION("1.0"); | ||
182 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c new file mode 100644 index 000000000000..c3e1b661aae6 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -0,0 +1,295 @@ | |||
1 | /* DVB USB compliant linux driver for Conexant USB reference design. | ||
2 | * | ||
3 | * The Conexant reference design I saw on their website was only for analogue | ||
4 | * capturing (using the cx25842). The box I took to write this driver (reverse | ||
5 | * engineered) is the one labeled Medion MD95700. In addition to the cx25842 | ||
6 | * for analogue capturing it also has a cx22702 DVB-T demodulator on the main | ||
7 | * board. Besides it has a atiremote (X10) and a USB2.0 hub onboard. | ||
8 | * | ||
9 | * Maybe it is a little bit premature to call this driver cxusb, but I assume | ||
10 | * the USB protocol is identical or at least inherited from the reference | ||
11 | * design, so it can be reused for the "analogue-only" device (if it will | ||
12 | * appear at all). | ||
13 | * | ||
14 | * TODO: check if the cx25840-driver (from ivtv) can be used for the analogue | ||
15 | * part | ||
16 | * | ||
17 | * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or modify it | ||
20 | * under the terms of the GNU General Public License as published by the Free | ||
21 | * Software Foundation, version 2. | ||
22 | * | ||
23 | * see Documentation/dvb/README.dvb-usb for more information | ||
24 | */ | ||
25 | #include "cxusb.h" | ||
26 | |||
27 | #include "cx22702.h" | ||
28 | |||
29 | /* debug */ | ||
30 | int dvb_usb_cxusb_debug; | ||
31 | module_param_named(debug,dvb_usb_cxusb_debug, int, 0644); | ||
32 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); | ||
33 | |||
34 | static int cxusb_ctrl_msg(struct dvb_usb_device *d, | ||
35 | u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) | ||
36 | { | ||
37 | int wo = (rbuf == NULL || rlen == 0); /* write-only */ | ||
38 | u8 sndbuf[1+wlen]; | ||
39 | memset(sndbuf,0,1+wlen); | ||
40 | |||
41 | sndbuf[0] = cmd; | ||
42 | memcpy(&sndbuf[1],wbuf,wlen); | ||
43 | if (wo) | ||
44 | dvb_usb_generic_write(d,sndbuf,1+wlen); | ||
45 | else | ||
46 | dvb_usb_generic_rw(d,sndbuf,1+wlen,rbuf,rlen,0); | ||
47 | |||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | /* I2C */ | ||
52 | static void cxusb_set_i2c_path(struct dvb_usb_device *d, enum cxusb_i2c_pathes path) | ||
53 | { | ||
54 | struct cxusb_state *st = d->priv; | ||
55 | u8 o[2],i; | ||
56 | |||
57 | if (path == st->cur_i2c_path) | ||
58 | return; | ||
59 | |||
60 | o[0] = IOCTL_SET_I2C_PATH; | ||
61 | switch (path) { | ||
62 | case PATH_CX22702: | ||
63 | o[1] = 0; | ||
64 | break; | ||
65 | case PATH_TUNER_OTHER: | ||
66 | o[1] = 1; | ||
67 | break; | ||
68 | default: | ||
69 | err("unkown i2c path"); | ||
70 | return; | ||
71 | } | ||
72 | cxusb_ctrl_msg(d,CMD_IOCTL,o,2,&i,1); | ||
73 | |||
74 | if (i != 0x01) | ||
75 | deb_info("i2c_path setting failed.\n"); | ||
76 | |||
77 | st->cur_i2c_path = path; | ||
78 | } | ||
79 | |||
80 | static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | ||
81 | { | ||
82 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | ||
83 | int i; | ||
84 | |||
85 | if (down_interruptible(&d->i2c_sem) < 0) | ||
86 | return -EAGAIN; | ||
87 | |||
88 | if (num > 2) | ||
89 | warn("more than 2 i2c messages at a time is not handled yet. TODO."); | ||
90 | |||
91 | for (i = 0; i < num; i++) { | ||
92 | |||
93 | switch (msg[i].addr) { | ||
94 | case 0x63: | ||
95 | cxusb_set_i2c_path(d,PATH_CX22702); | ||
96 | break; | ||
97 | default: | ||
98 | cxusb_set_i2c_path(d,PATH_TUNER_OTHER); | ||
99 | break; | ||
100 | } | ||
101 | |||
102 | /* read request */ | ||
103 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | ||
104 | u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len]; | ||
105 | obuf[0] = msg[i].len; | ||
106 | obuf[1] = msg[i+1].len; | ||
107 | obuf[2] = msg[i].addr; | ||
108 | memcpy(&obuf[3],msg[i].buf,msg[i].len); | ||
109 | |||
110 | if (cxusb_ctrl_msg(d, CMD_I2C_READ, | ||
111 | obuf, 3+msg[i].len, | ||
112 | ibuf, 1+msg[i+1].len) < 0) | ||
113 | break; | ||
114 | |||
115 | if (ibuf[0] != 0x08) | ||
116 | deb_info("i2c read could have been failed\n"); | ||
117 | |||
118 | memcpy(msg[i+1].buf,&ibuf[1],msg[i+1].len); | ||
119 | |||
120 | i++; | ||
121 | } else { /* write */ | ||
122 | u8 obuf[2+msg[i].len], ibuf; | ||
123 | obuf[0] = msg[i].addr; | ||
124 | obuf[1] = msg[i].len; | ||
125 | memcpy(&obuf[2],msg[i].buf,msg[i].len); | ||
126 | |||
127 | if (cxusb_ctrl_msg(d,CMD_I2C_WRITE, obuf, 2+msg[i].len, &ibuf,1) < 0) | ||
128 | break; | ||
129 | if (ibuf != 0x08) | ||
130 | deb_info("i2c write could have been failed\n"); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | up(&d->i2c_sem); | ||
135 | return i; | ||
136 | } | ||
137 | |||
138 | static u32 cxusb_i2c_func(struct i2c_adapter *adapter) | ||
139 | { | ||
140 | return I2C_FUNC_I2C; | ||
141 | } | ||
142 | |||
143 | static struct i2c_algorithm cxusb_i2c_algo = { | ||
144 | .name = "Conexant USB I2C algorithm", | ||
145 | .id = I2C_ALGO_BIT, | ||
146 | .master_xfer = cxusb_i2c_xfer, | ||
147 | .functionality = cxusb_i2c_func, | ||
148 | }; | ||
149 | |||
150 | static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
151 | { | ||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) | ||
156 | { | ||
157 | u8 buf[2] = { 0x03, 0x00 }; | ||
158 | if (onoff) | ||
159 | cxusb_ctrl_msg(d,0x36, buf, 2, NULL, 0); | ||
160 | else | ||
161 | cxusb_ctrl_msg(d,0x37, NULL, 0, NULL, 0); | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | struct cx22702_config cxusb_cx22702_config = { | ||
167 | .demod_address = 0x63, | ||
168 | |||
169 | .output_mode = CX22702_PARALLEL_OUTPUT, | ||
170 | |||
171 | .pll_init = dvb_usb_pll_init_i2c, | ||
172 | .pll_set = dvb_usb_pll_set_i2c, | ||
173 | }; | ||
174 | |||
175 | /* Callbacks for DVB USB */ | ||
176 | static int cxusb_tuner_attach(struct dvb_usb_device *d) | ||
177 | { | ||
178 | u8 bpll[4] = { 0x0b, 0xdc, 0x9c, 0xa0 }; | ||
179 | d->pll_addr = 0x61; | ||
180 | memcpy(d->pll_init,bpll,4); | ||
181 | d->pll_desc = &dvb_pll_fmd1216me; | ||
182 | return 0; | ||
183 | } | ||
184 | |||
185 | static int cxusb_frontend_attach(struct dvb_usb_device *d) | ||
186 | { | ||
187 | u8 buf[2] = { 0x03, 0x00 }; | ||
188 | u8 b = 0; | ||
189 | |||
190 | if (usb_set_interface(d->udev,0,0) < 0) | ||
191 | err("set interface to alts=0 failed"); | ||
192 | |||
193 | cxusb_ctrl_msg(d,0xde,&b,0,NULL,0); | ||
194 | cxusb_set_i2c_path(d,PATH_TUNER_OTHER); | ||
195 | cxusb_ctrl_msg(d,CMD_POWER_OFF, NULL, 0, &b, 1); | ||
196 | |||
197 | if (usb_set_interface(d->udev,0,6) < 0) | ||
198 | err("set interface failed"); | ||
199 | |||
200 | cxusb_ctrl_msg(d,0x36, buf, 2, NULL, 0); | ||
201 | cxusb_set_i2c_path(d,PATH_CX22702); | ||
202 | cxusb_ctrl_msg(d,CMD_POWER_ON, NULL, 0, &b, 1); | ||
203 | |||
204 | if ((d->fe = cx22702_attach(&cxusb_cx22702_config, &d->i2c_adap)) != NULL) | ||
205 | return 0; | ||
206 | |||
207 | return -EIO; | ||
208 | } | ||
209 | |||
210 | /* DVB USB Driver stuff */ | ||
211 | static struct dvb_usb_properties cxusb_properties; | ||
212 | |||
213 | static int cxusb_probe(struct usb_interface *intf, | ||
214 | const struct usb_device_id *id) | ||
215 | { | ||
216 | return dvb_usb_device_init(intf,&cxusb_properties,THIS_MODULE); | ||
217 | } | ||
218 | |||
219 | static struct usb_device_id cxusb_table [] = { | ||
220 | { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) }, | ||
221 | {} /* Terminating entry */ | ||
222 | }; | ||
223 | MODULE_DEVICE_TABLE (usb, cxusb_table); | ||
224 | |||
225 | static struct dvb_usb_properties cxusb_properties = { | ||
226 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
227 | |||
228 | .usb_ctrl = CYPRESS_FX2, | ||
229 | |||
230 | .size_of_priv = sizeof(struct cxusb_state), | ||
231 | |||
232 | .streaming_ctrl = cxusb_streaming_ctrl, | ||
233 | .power_ctrl = cxusb_power_ctrl, | ||
234 | .frontend_attach = cxusb_frontend_attach, | ||
235 | .tuner_attach = cxusb_tuner_attach, | ||
236 | |||
237 | .i2c_algo = &cxusb_i2c_algo, | ||
238 | |||
239 | .generic_bulk_ctrl_endpoint = 0x01, | ||
240 | /* parameter for the MPEG2-data transfer */ | ||
241 | .urb = { | ||
242 | .type = DVB_USB_ISOC, | ||
243 | .count = 5, | ||
244 | .endpoint = 0x02, | ||
245 | .u = { | ||
246 | .isoc = { | ||
247 | .framesperurb = 32, | ||
248 | .framesize = 940, | ||
249 | .interval = 5, | ||
250 | } | ||
251 | } | ||
252 | }, | ||
253 | |||
254 | .num_device_descs = 1, | ||
255 | .devices = { | ||
256 | { "Medion MD95700 (MDUSBTV-HYBRID)", | ||
257 | { NULL }, | ||
258 | { &cxusb_table[0], NULL }, | ||
259 | }, | ||
260 | } | ||
261 | }; | ||
262 | |||
263 | static struct usb_driver cxusb_driver = { | ||
264 | .owner = THIS_MODULE, | ||
265 | .name = "dvb_usb_cxusb", | ||
266 | .probe = cxusb_probe, | ||
267 | .disconnect = dvb_usb_device_exit, | ||
268 | .id_table = cxusb_table, | ||
269 | }; | ||
270 | |||
271 | /* module stuff */ | ||
272 | static int __init cxusb_module_init(void) | ||
273 | { | ||
274 | int result; | ||
275 | if ((result = usb_register(&cxusb_driver))) { | ||
276 | err("usb_register failed. Error number %d",result); | ||
277 | return result; | ||
278 | } | ||
279 | |||
280 | return 0; | ||
281 | } | ||
282 | |||
283 | static void __exit cxusb_module_exit(void) | ||
284 | { | ||
285 | /* deregister this driver from the USB subsystem */ | ||
286 | usb_deregister(&cxusb_driver); | ||
287 | } | ||
288 | |||
289 | module_init (cxusb_module_init); | ||
290 | module_exit (cxusb_module_exit); | ||
291 | |||
292 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
293 | MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design"); | ||
294 | MODULE_VERSION("1.0-alpha"); | ||
295 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/cxusb.h b/drivers/media/dvb/dvb-usb/cxusb.h new file mode 100644 index 000000000000..1d79016e3195 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/cxusb.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef _DVB_USB_CXUSB_H_ | ||
2 | #define _DVB_USB_CXUSB_H_ | ||
3 | |||
4 | #define DVB_USB_LOG_PREFIX "digitv" | ||
5 | #include "dvb-usb.h" | ||
6 | |||
7 | extern int dvb_usb_cxusb_debug; | ||
8 | #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) | ||
9 | |||
10 | /* usb commands - some of it are guesses, don't have a reference yet */ | ||
11 | #define CMD_I2C_WRITE 0x08 | ||
12 | #define CMD_I2C_READ 0x09 | ||
13 | |||
14 | #define CMD_IOCTL 0x0e | ||
15 | #define IOCTL_SET_I2C_PATH 0x02 | ||
16 | |||
17 | #define CMD_POWER_OFF 0x50 | ||
18 | #define CMD_POWER_ON 0x51 | ||
19 | |||
20 | enum cxusb_i2c_pathes { | ||
21 | PATH_UNDEF = 0x00, | ||
22 | PATH_CX22702 = 0x01, | ||
23 | PATH_TUNER_OTHER = 0x02, | ||
24 | }; | ||
25 | |||
26 | struct cxusb_state { | ||
27 | enum cxusb_i2c_pathes cur_i2c_path; | ||
28 | }; | ||
29 | |||
30 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c new file mode 100644 index 000000000000..63b626f70c81 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dibusb-common.c | |||
@@ -0,0 +1,272 @@ | |||
1 | /* Common methods for dibusb-based-receivers. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the Free | ||
7 | * Software Foundation, version 2. | ||
8 | * | ||
9 | * see Documentation/dvb/README.dvb-usb for more information | ||
10 | */ | ||
11 | #include "dibusb.h" | ||
12 | |||
13 | static int debug; | ||
14 | module_param(debug, int, 0644); | ||
15 | MODULE_PARM_DESC(debug, "set debugging level (1=info (|-able))." DVB_USB_DEBUG_STATUS); | ||
16 | MODULE_LICENSE("GPL"); | ||
17 | |||
18 | #define deb_info(args...) dprintk(debug,0x01,args) | ||
19 | |||
20 | /* common stuff used by the different dibusb modules */ | ||
21 | int dibusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) | ||
22 | { | ||
23 | if (d->priv != NULL) { | ||
24 | struct dib_fe_xfer_ops *ops = d->priv; | ||
25 | if (ops->fifo_ctrl != NULL) | ||
26 | if (ops->fifo_ctrl(d->fe,onoff)) { | ||
27 | err("error while controlling the fifo of the demod."); | ||
28 | return -ENODEV; | ||
29 | } | ||
30 | } | ||
31 | return 0; | ||
32 | } | ||
33 | EXPORT_SYMBOL(dibusb_streaming_ctrl); | ||
34 | |||
35 | int dibusb_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int onoff) | ||
36 | { | ||
37 | if (d->priv != NULL) { | ||
38 | struct dib_fe_xfer_ops *ops = d->priv; | ||
39 | if (d->pid_filtering && ops->pid_ctrl != NULL) | ||
40 | ops->pid_ctrl(d->fe,index,pid,onoff); | ||
41 | } | ||
42 | return 0; | ||
43 | } | ||
44 | EXPORT_SYMBOL(dibusb_pid_filter); | ||
45 | |||
46 | int dibusb_pid_filter_ctrl(struct dvb_usb_device *d, int onoff) | ||
47 | { | ||
48 | if (d->priv != NULL) { | ||
49 | struct dib_fe_xfer_ops *ops = d->priv; | ||
50 | if (ops->pid_parse != NULL) | ||
51 | if (ops->pid_parse(d->fe,onoff) < 0) | ||
52 | err("could not handle pid_parser"); | ||
53 | } | ||
54 | return 0; | ||
55 | } | ||
56 | EXPORT_SYMBOL(dibusb_pid_filter_ctrl); | ||
57 | |||
58 | int dibusb_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
59 | { | ||
60 | u8 b[3]; | ||
61 | int ret; | ||
62 | b[0] = DIBUSB_REQ_SET_IOCTL; | ||
63 | b[1] = DIBUSB_IOCTL_CMD_POWER_MODE; | ||
64 | b[2] = onoff ? DIBUSB_IOCTL_POWER_WAKEUP : DIBUSB_IOCTL_POWER_SLEEP; | ||
65 | ret = dvb_usb_generic_write(d,b,3); | ||
66 | msleep(10); | ||
67 | return ret; | ||
68 | } | ||
69 | EXPORT_SYMBOL(dibusb_power_ctrl); | ||
70 | |||
71 | int dibusb2_0_streaming_ctrl(struct dvb_usb_device *d, int onoff) | ||
72 | { | ||
73 | u8 b[2]; | ||
74 | b[0] = DIBUSB_REQ_SET_IOCTL; | ||
75 | b[1] = onoff ? DIBUSB_IOCTL_CMD_ENABLE_STREAM : DIBUSB_IOCTL_CMD_DISABLE_STREAM; | ||
76 | |||
77 | dvb_usb_generic_write(d,b,3); | ||
78 | |||
79 | return dibusb_streaming_ctrl(d,onoff); | ||
80 | } | ||
81 | EXPORT_SYMBOL(dibusb2_0_streaming_ctrl); | ||
82 | |||
83 | int dibusb2_0_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
84 | { | ||
85 | if (onoff) { | ||
86 | u8 b[3] = { DIBUSB_REQ_SET_IOCTL, DIBUSB_IOCTL_CMD_POWER_MODE, DIBUSB_IOCTL_POWER_WAKEUP }; | ||
87 | return dvb_usb_generic_write(d,b,3); | ||
88 | } else | ||
89 | return 0; | ||
90 | } | ||
91 | EXPORT_SYMBOL(dibusb2_0_power_ctrl); | ||
92 | |||
93 | static int dibusb_i2c_msg(struct dvb_usb_device *d, u8 addr, | ||
94 | u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) | ||
95 | { | ||
96 | u8 sndbuf[wlen+4]; /* lead(1) devaddr,direction(1) addr(2) data(wlen) (len(2) (when reading)) */ | ||
97 | /* write only ? */ | ||
98 | int wo = (rbuf == NULL || rlen == 0), | ||
99 | len = 2 + wlen + (wo ? 0 : 2); | ||
100 | |||
101 | sndbuf[0] = wo ? DIBUSB_REQ_I2C_WRITE : DIBUSB_REQ_I2C_READ; | ||
102 | sndbuf[1] = (addr << 1) | (wo ? 0 : 1); | ||
103 | |||
104 | memcpy(&sndbuf[2],wbuf,wlen); | ||
105 | |||
106 | if (!wo) { | ||
107 | sndbuf[wlen+2] = (rlen >> 8) & 0xff; | ||
108 | sndbuf[wlen+3] = rlen & 0xff; | ||
109 | } | ||
110 | |||
111 | return dvb_usb_generic_rw(d,sndbuf,len,rbuf,rlen,0); | ||
112 | } | ||
113 | |||
114 | /* | ||
115 | * I2C master xfer function | ||
116 | */ | ||
117 | static int dibusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | ||
118 | { | ||
119 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | ||
120 | int i; | ||
121 | |||
122 | if (down_interruptible(&d->i2c_sem) < 0) | ||
123 | return -EAGAIN; | ||
124 | |||
125 | if (num > 2) | ||
126 | warn("more than 2 i2c messages at a time is not handled yet. TODO."); | ||
127 | |||
128 | for (i = 0; i < num; i++) { | ||
129 | /* write/read request */ | ||
130 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | ||
131 | if (dibusb_i2c_msg(d, msg[i].addr, msg[i].buf,msg[i].len, | ||
132 | msg[i+1].buf,msg[i+1].len) < 0) | ||
133 | break; | ||
134 | i++; | ||
135 | } else | ||
136 | if (dibusb_i2c_msg(d, msg[i].addr, msg[i].buf,msg[i].len,NULL,0) < 0) | ||
137 | break; | ||
138 | } | ||
139 | |||
140 | up(&d->i2c_sem); | ||
141 | return i; | ||
142 | } | ||
143 | |||
144 | static u32 dibusb_i2c_func(struct i2c_adapter *adapter) | ||
145 | { | ||
146 | return I2C_FUNC_I2C; | ||
147 | } | ||
148 | |||
149 | struct i2c_algorithm dibusb_i2c_algo = { | ||
150 | .name = "DiBcom USB I2C algorithm", | ||
151 | .id = I2C_ALGO_BIT, | ||
152 | .master_xfer = dibusb_i2c_xfer, | ||
153 | .functionality = dibusb_i2c_func, | ||
154 | }; | ||
155 | EXPORT_SYMBOL(dibusb_i2c_algo); | ||
156 | |||
157 | int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val) | ||
158 | { | ||
159 | u8 wbuf[1] = { offs }; | ||
160 | return dibusb_i2c_msg(d, 0x50, wbuf, 1, val, 1); | ||
161 | } | ||
162 | EXPORT_SYMBOL(dibusb_read_eeprom_byte); | ||
163 | |||
164 | int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d) | ||
165 | { | ||
166 | struct dib3000_config demod_cfg; | ||
167 | struct dibusb_state *st = d->priv; | ||
168 | |||
169 | demod_cfg.pll_set = dvb_usb_pll_set_i2c; | ||
170 | demod_cfg.pll_init = dvb_usb_pll_init_i2c; | ||
171 | |||
172 | for (demod_cfg.demod_address = 0x8; demod_cfg.demod_address < 0xd; demod_cfg.demod_address++) | ||
173 | if ((d->fe = dib3000mc_attach(&demod_cfg,&d->i2c_adap,&st->ops)) != NULL) { | ||
174 | d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; | ||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | return -ENODEV; | ||
179 | } | ||
180 | EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach); | ||
181 | |||
182 | int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d) | ||
183 | { | ||
184 | d->pll_addr = 0x60; | ||
185 | d->pll_desc = &dvb_pll_env57h1xd5; | ||
186 | return 0; | ||
187 | } | ||
188 | EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); | ||
189 | |||
190 | /* | ||
191 | * common remote control stuff | ||
192 | */ | ||
193 | struct dvb_usb_rc_key dibusb_rc_keys[] = { | ||
194 | /* Key codes for the little Artec T1/Twinhan/HAMA/ remote. */ | ||
195 | { 0x00, 0x16, KEY_POWER }, | ||
196 | { 0x00, 0x10, KEY_MUTE }, | ||
197 | { 0x00, 0x03, KEY_1 }, | ||
198 | { 0x00, 0x01, KEY_2 }, | ||
199 | { 0x00, 0x06, KEY_3 }, | ||
200 | { 0x00, 0x09, KEY_4 }, | ||
201 | { 0x00, 0x1d, KEY_5 }, | ||
202 | { 0x00, 0x1f, KEY_6 }, | ||
203 | { 0x00, 0x0d, KEY_7 }, | ||
204 | { 0x00, 0x19, KEY_8 }, | ||
205 | { 0x00, 0x1b, KEY_9 }, | ||
206 | { 0x00, 0x15, KEY_0 }, | ||
207 | { 0x00, 0x05, KEY_CHANNELUP }, | ||
208 | { 0x00, 0x02, KEY_CHANNELDOWN }, | ||
209 | { 0x00, 0x1e, KEY_VOLUMEUP }, | ||
210 | { 0x00, 0x0a, KEY_VOLUMEDOWN }, | ||
211 | { 0x00, 0x11, KEY_RECORD }, | ||
212 | { 0x00, 0x17, KEY_FAVORITES }, /* Heart symbol - Channel list. */ | ||
213 | { 0x00, 0x14, KEY_PLAY }, | ||
214 | { 0x00, 0x1a, KEY_STOP }, | ||
215 | { 0x00, 0x40, KEY_REWIND }, | ||
216 | { 0x00, 0x12, KEY_FASTFORWARD }, | ||
217 | { 0x00, 0x0e, KEY_PREVIOUS }, /* Recall - Previous channel. */ | ||
218 | { 0x00, 0x4c, KEY_PAUSE }, | ||
219 | { 0x00, 0x4d, KEY_SCREEN }, /* Full screen mode. */ | ||
220 | { 0x00, 0x54, KEY_AUDIO }, /* MTS - Switch to secondary audio. */ | ||
221 | /* additional keys TwinHan VisionPlus, the Artec seemingly not have */ | ||
222 | { 0x00, 0x0c, KEY_CANCEL }, /* Cancel */ | ||
223 | { 0x00, 0x1c, KEY_EPG }, /* EPG */ | ||
224 | { 0x00, 0x00, KEY_TAB }, /* Tab */ | ||
225 | { 0x00, 0x48, KEY_INFO }, /* Preview */ | ||
226 | { 0x00, 0x04, KEY_LIST }, /* RecordList */ | ||
227 | { 0x00, 0x0f, KEY_TEXT }, /* Teletext */ | ||
228 | /* Key codes for the KWorld/ADSTech/JetWay remote. */ | ||
229 | { 0x86, 0x12, KEY_POWER }, | ||
230 | { 0x86, 0x0f, KEY_SELECT }, /* source */ | ||
231 | { 0x86, 0x0c, KEY_UNKNOWN }, /* scan */ | ||
232 | { 0x86, 0x0b, KEY_EPG }, | ||
233 | { 0x86, 0x10, KEY_MUTE }, | ||
234 | { 0x86, 0x01, KEY_1 }, | ||
235 | { 0x86, 0x02, KEY_2 }, | ||
236 | { 0x86, 0x03, KEY_3 }, | ||
237 | { 0x86, 0x04, KEY_4 }, | ||
238 | { 0x86, 0x05, KEY_5 }, | ||
239 | { 0x86, 0x06, KEY_6 }, | ||
240 | { 0x86, 0x07, KEY_7 }, | ||
241 | { 0x86, 0x08, KEY_8 }, | ||
242 | { 0x86, 0x09, KEY_9 }, | ||
243 | { 0x86, 0x0a, KEY_0 }, | ||
244 | { 0x86, 0x18, KEY_ZOOM }, | ||
245 | { 0x86, 0x1c, KEY_UNKNOWN }, /* preview */ | ||
246 | { 0x86, 0x13, KEY_UNKNOWN }, /* snap */ | ||
247 | { 0x86, 0x00, KEY_UNDO }, | ||
248 | { 0x86, 0x1d, KEY_RECORD }, | ||
249 | { 0x86, 0x0d, KEY_STOP }, | ||
250 | { 0x86, 0x0e, KEY_PAUSE }, | ||
251 | { 0x86, 0x16, KEY_PLAY }, | ||
252 | { 0x86, 0x11, KEY_BACK }, | ||
253 | { 0x86, 0x19, KEY_FORWARD }, | ||
254 | { 0x86, 0x14, KEY_UNKNOWN }, /* pip */ | ||
255 | { 0x86, 0x15, KEY_ESC }, | ||
256 | { 0x86, 0x1a, KEY_UP }, | ||
257 | { 0x86, 0x1e, KEY_DOWN }, | ||
258 | { 0x86, 0x1f, KEY_LEFT }, | ||
259 | { 0x86, 0x1b, KEY_RIGHT }, | ||
260 | }; | ||
261 | EXPORT_SYMBOL(dibusb_rc_keys); | ||
262 | |||
263 | int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
264 | { | ||
265 | u8 key[5],cmd = DIBUSB_REQ_POLL_REMOTE; | ||
266 | dvb_usb_generic_rw(d,&cmd,1,key,5,0); | ||
267 | dvb_usb_nec_rc_key_to_event(d,key,event,state); | ||
268 | if (key[0] != 0) | ||
269 | deb_info("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); | ||
270 | return 0; | ||
271 | } | ||
272 | EXPORT_SYMBOL(dibusb_rc_query); | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c new file mode 100644 index 000000000000..828b5182e16c --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c | |||
@@ -0,0 +1,350 @@ | |||
1 | /* DVB USB compliant linux driver for mobile DVB-T USB devices based on | ||
2 | * reference designs made by DiBcom (http://www.dibcom.fr/) (DiB3000M-B) | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * based on GPL code from DiBcom, which has | ||
7 | * Copyright (C) 2004 Amaury Demol for DiBcom (ademol@dibcom.fr) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the Free | ||
11 | * Software Foundation, version 2. | ||
12 | * | ||
13 | * see Documentation/dvb/README.dvb-usb for more information | ||
14 | */ | ||
15 | #include "dibusb.h" | ||
16 | |||
17 | static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_device *d) | ||
18 | { | ||
19 | struct dib3000_config demod_cfg; | ||
20 | struct dibusb_state *st = d->priv; | ||
21 | |||
22 | demod_cfg.demod_address = 0x8; | ||
23 | demod_cfg.pll_set = dvb_usb_pll_set_i2c; | ||
24 | demod_cfg.pll_init = dvb_usb_pll_init_i2c; | ||
25 | |||
26 | if ((d->fe = dib3000mb_attach(&demod_cfg,&d->i2c_adap,&st->ops)) == NULL) | ||
27 | return -ENODEV; | ||
28 | |||
29 | d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; | ||
30 | |||
31 | return 0; | ||
32 | } | ||
33 | |||
34 | static int dibusb_thomson_tuner_attach(struct dvb_usb_device *d) | ||
35 | { | ||
36 | d->pll_addr = 0x61; | ||
37 | d->pll_desc = &dvb_pll_tua6010xs; | ||
38 | return 0; | ||
39 | } | ||
40 | |||
41 | /* Some of the Artec 1.1 device aren't equipped with the default tuner | ||
42 | * (Thomson Cable), but with a Panasonic ENV77H11D5. This function figures | ||
43 | * this out. */ | ||
44 | static int dibusb_tuner_probe_and_attach(struct dvb_usb_device *d) | ||
45 | { | ||
46 | u8 b[2] = { 0,0 }, b2[1]; | ||
47 | int ret = 0; | ||
48 | struct i2c_msg msg[2] = { | ||
49 | { .flags = 0, .buf = b, .len = 2 }, | ||
50 | { .flags = I2C_M_RD, .buf = b2, .len = 1 }, | ||
51 | }; | ||
52 | |||
53 | /* the Panasonic sits on I2C addrass 0x60, the Thomson on 0x61 */ | ||
54 | msg[0].addr = msg[1].addr = 0x60; | ||
55 | |||
56 | if (d->tuner_pass_ctrl) | ||
57 | d->tuner_pass_ctrl(d->fe,1,msg[0].addr); | ||
58 | |||
59 | if (i2c_transfer (&d->i2c_adap, msg, 2) != 2) { | ||
60 | err("tuner i2c write failed."); | ||
61 | ret = -EREMOTEIO; | ||
62 | } | ||
63 | |||
64 | if (d->tuner_pass_ctrl) | ||
65 | d->tuner_pass_ctrl(d->fe,0,msg[0].addr); | ||
66 | |||
67 | if (b2[0] == 0xfe) { | ||
68 | info("this device has the Thomson Cable onboard. Which is default."); | ||
69 | dibusb_thomson_tuner_attach(d); | ||
70 | } else { | ||
71 | u8 bpll[4] = { 0x0b, 0xf5, 0x85, 0xab }; | ||
72 | info("this device has the Panasonic ENV77H11D5 onboard."); | ||
73 | d->pll_addr = 0x60; | ||
74 | memcpy(d->pll_init,bpll,4); | ||
75 | d->pll_desc = &dvb_pll_tda665x; | ||
76 | } | ||
77 | |||
78 | return ret; | ||
79 | } | ||
80 | |||
81 | /* USB Driver stuff */ | ||
82 | static struct dvb_usb_properties dibusb1_1_properties; | ||
83 | static struct dvb_usb_properties dibusb1_1_an2235_properties; | ||
84 | static struct dvb_usb_properties dibusb2_0b_properties; | ||
85 | |||
86 | static int dibusb_probe(struct usb_interface *intf, | ||
87 | const struct usb_device_id *id) | ||
88 | { | ||
89 | if (dvb_usb_device_init(intf,&dibusb1_1_properties,THIS_MODULE) == 0 || | ||
90 | dvb_usb_device_init(intf,&dibusb1_1_an2235_properties,THIS_MODULE) == 0 || | ||
91 | dvb_usb_device_init(intf,&dibusb2_0b_properties,THIS_MODULE) == 0) | ||
92 | return 0; | ||
93 | |||
94 | return -EINVAL; | ||
95 | } | ||
96 | |||
97 | /* do not change the order of the ID table */ | ||
98 | static struct usb_device_id dibusb_dib3000mb_table [] = { | ||
99 | /* 00 */ { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_AVERMEDIA_DVBT_USB_COLD)}, | ||
100 | /* 01 */ { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_AVERMEDIA_DVBT_USB_WARM)}, | ||
101 | /* 02 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_COLD) }, | ||
102 | /* 03 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_WARM) }, | ||
103 | /* 04 */ { USB_DEVICE(USB_VID_COMPRO_UNK, USB_PID_COMPRO_DVBU2000_UNK_COLD) }, | ||
104 | /* 05 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_COLD) }, | ||
105 | /* 06 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_WARM) }, | ||
106 | /* 07 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_COLD) }, | ||
107 | /* 08 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_WARM) }, | ||
108 | /* 09 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_COLD) }, | ||
109 | /* 10 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_WARM) }, | ||
110 | /* 11 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_COLD) }, | ||
111 | /* 12 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_WARM) }, | ||
112 | /* 13 */ { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_COLD) }, | ||
113 | /* 14 */ { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_WARM) }, | ||
114 | /* 15 */ { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7041_COLD) }, | ||
115 | /* 16 */ { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7041_WARM) }, | ||
116 | /* 17 */ { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_COLD) }, | ||
117 | /* 18 */ { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_WARM) }, | ||
118 | /* 19 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_COLD) }, | ||
119 | /* 20 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_WARM) }, | ||
120 | /* 21 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_COLD) }, | ||
121 | /* 22 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_WARM) }, | ||
122 | /* 23 */ { USB_DEVICE(USB_VID_ADSTECH, USB_PID_ADSTECH_USB2_COLD) }, | ||
123 | |||
124 | /* device ID with default DIBUSB2_0-firmware and with the hacked firmware */ | ||
125 | /* 24 */ { USB_DEVICE(USB_VID_ADSTECH, USB_PID_ADSTECH_USB2_WARM) }, | ||
126 | /* 25 */ { USB_DEVICE(USB_VID_KYE, USB_PID_KYE_DVB_T_COLD) }, | ||
127 | /* 26 */ { USB_DEVICE(USB_VID_KYE, USB_PID_KYE_DVB_T_WARM) }, | ||
128 | |||
129 | // #define DVB_USB_DIBUSB_MB_FAULTY_USB_IDs | ||
130 | |||
131 | #ifdef DVB_USB_DIBUSB_MB_FAULTY_USB_IDs | ||
132 | /* 27 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) }, | ||
133 | #endif | ||
134 | { } /* Terminating entry */ | ||
135 | }; | ||
136 | MODULE_DEVICE_TABLE (usb, dibusb_dib3000mb_table); | ||
137 | |||
138 | static struct dvb_usb_properties dibusb1_1_properties = { | ||
139 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, | ||
140 | .pid_filter_count = 16, | ||
141 | |||
142 | .usb_ctrl = CYPRESS_AN2135, | ||
143 | |||
144 | .firmware = "dvb-usb-dibusb-5.0.0.11.fw", | ||
145 | |||
146 | .size_of_priv = sizeof(struct dibusb_state), | ||
147 | |||
148 | .streaming_ctrl = dibusb_streaming_ctrl, | ||
149 | .pid_filter = dibusb_pid_filter, | ||
150 | .pid_filter_ctrl = dibusb_pid_filter_ctrl, | ||
151 | .power_ctrl = dibusb_power_ctrl, | ||
152 | .frontend_attach = dibusb_dib3000mb_frontend_attach, | ||
153 | .tuner_attach = dibusb_tuner_probe_and_attach, | ||
154 | |||
155 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
156 | .rc_key_map = dibusb_rc_keys, | ||
157 | .rc_key_map_size = 63, /* wow, that is ugly ... I want to load it to the driver dynamically */ | ||
158 | .rc_query = dibusb_rc_query, | ||
159 | |||
160 | .i2c_algo = &dibusb_i2c_algo, | ||
161 | |||
162 | .generic_bulk_ctrl_endpoint = 0x01, | ||
163 | /* parameter for the MPEG2-data transfer */ | ||
164 | .urb = { | ||
165 | .type = DVB_USB_BULK, | ||
166 | .count = 7, | ||
167 | .endpoint = 0x02, | ||
168 | .u = { | ||
169 | .bulk = { | ||
170 | .buffersize = 4096, | ||
171 | } | ||
172 | } | ||
173 | }, | ||
174 | |||
175 | .num_device_descs = 9, | ||
176 | .devices = { | ||
177 | { "AVerMedia AverTV DVBT USB1.1", | ||
178 | { &dibusb_dib3000mb_table[0], NULL }, | ||
179 | { &dibusb_dib3000mb_table[1], NULL }, | ||
180 | }, | ||
181 | { "Compro Videomate DVB-U2000 - DVB-T USB1.1 (please confirm to linux-dvb)", | ||
182 | { &dibusb_dib3000mb_table[2], &dibusb_dib3000mb_table[4], NULL}, | ||
183 | { &dibusb_dib3000mb_table[3], NULL }, | ||
184 | }, | ||
185 | { "DiBcom USB1.1 DVB-T reference design (MOD3000)", | ||
186 | { &dibusb_dib3000mb_table[5], NULL }, | ||
187 | { &dibusb_dib3000mb_table[6], NULL }, | ||
188 | }, | ||
189 | { "KWorld V-Stream XPERT DTV - DVB-T USB1.1", | ||
190 | { &dibusb_dib3000mb_table[7], NULL }, | ||
191 | { &dibusb_dib3000mb_table[8], NULL }, | ||
192 | }, | ||
193 | { "Grandtec USB1.1 DVB-T", | ||
194 | { &dibusb_dib3000mb_table[9], &dibusb_dib3000mb_table[11], NULL }, | ||
195 | { &dibusb_dib3000mb_table[10], &dibusb_dib3000mb_table[12], NULL }, | ||
196 | }, | ||
197 | { "Unkown USB1.1 DVB-T device ???? please report the name to the author", | ||
198 | { &dibusb_dib3000mb_table[13], NULL }, | ||
199 | { &dibusb_dib3000mb_table[14], NULL }, | ||
200 | }, | ||
201 | { "TwinhanDTV USB-Ter USB1.1 / Magic Box I / HAMA USB1.1 DVB-T device", | ||
202 | { &dibusb_dib3000mb_table[15], &dibusb_dib3000mb_table[17], NULL}, | ||
203 | { &dibusb_dib3000mb_table[16], &dibusb_dib3000mb_table[18], NULL}, | ||
204 | }, | ||
205 | { "Artec T1 USB1.1 TVBOX with AN2135", | ||
206 | { &dibusb_dib3000mb_table[19], NULL }, | ||
207 | { &dibusb_dib3000mb_table[20], NULL }, | ||
208 | }, | ||
209 | { "VideoWalker DVB-T USB", | ||
210 | { &dibusb_dib3000mb_table[25], NULL }, | ||
211 | { &dibusb_dib3000mb_table[26], NULL }, | ||
212 | }, | ||
213 | } | ||
214 | }; | ||
215 | |||
216 | static struct dvb_usb_properties dibusb1_1_an2235_properties = { | ||
217 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, | ||
218 | .pid_filter_count = 16, | ||
219 | |||
220 | .usb_ctrl = CYPRESS_AN2235, | ||
221 | |||
222 | .firmware = "dvb-usb-dibusb-an2235-01.fw", | ||
223 | |||
224 | .size_of_priv = sizeof(struct dibusb_state), | ||
225 | |||
226 | .streaming_ctrl = dibusb_streaming_ctrl, | ||
227 | .pid_filter = dibusb_pid_filter, | ||
228 | .pid_filter_ctrl = dibusb_pid_filter_ctrl, | ||
229 | .power_ctrl = dibusb_power_ctrl, | ||
230 | .frontend_attach = dibusb_dib3000mb_frontend_attach, | ||
231 | .tuner_attach = dibusb_tuner_probe_and_attach, | ||
232 | |||
233 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
234 | .rc_key_map = dibusb_rc_keys, | ||
235 | .rc_key_map_size = 63, /* wow, that is ugly ... I want to load it to the driver dynamically */ | ||
236 | .rc_query = dibusb_rc_query, | ||
237 | |||
238 | .i2c_algo = &dibusb_i2c_algo, | ||
239 | |||
240 | .generic_bulk_ctrl_endpoint = 0x01, | ||
241 | /* parameter for the MPEG2-data transfer */ | ||
242 | .urb = { | ||
243 | .type = DVB_USB_BULK, | ||
244 | .count = 7, | ||
245 | .endpoint = 0x02, | ||
246 | .u = { | ||
247 | .bulk = { | ||
248 | .buffersize = 4096, | ||
249 | } | ||
250 | } | ||
251 | }, | ||
252 | |||
253 | #ifdef DVB_USB_DIBUSB_MB_FAULTY_USB_IDs | ||
254 | .num_device_descs = 2, | ||
255 | #else | ||
256 | .num_device_descs = 1, | ||
257 | #endif | ||
258 | .devices = { | ||
259 | { "Artec T1 USB1.1 TVBOX with AN2235", | ||
260 | { &dibusb_dib3000mb_table[20], NULL }, | ||
261 | { &dibusb_dib3000mb_table[21], NULL }, | ||
262 | }, | ||
263 | #ifdef DVB_USB_DIBUSB_MB_FAULTY_USB_IDs | ||
264 | { "Artec T1 USB1.1 TVBOX with AN2235 (faulty USB IDs)", | ||
265 | { &dibusb_dib3000mb_table[27], NULL }, | ||
266 | { NULL }, | ||
267 | }, | ||
268 | #endif | ||
269 | } | ||
270 | }; | ||
271 | |||
272 | static struct dvb_usb_properties dibusb2_0b_properties = { | ||
273 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, | ||
274 | .pid_filter_count = 32, | ||
275 | |||
276 | .usb_ctrl = CYPRESS_FX2, | ||
277 | |||
278 | .firmware = "dvb-usb-adstech-usb2-02.fw", | ||
279 | |||
280 | .size_of_priv = sizeof(struct dibusb_state), | ||
281 | |||
282 | .streaming_ctrl = dibusb2_0_streaming_ctrl, | ||
283 | .pid_filter = dibusb_pid_filter, | ||
284 | .pid_filter_ctrl = dibusb_pid_filter_ctrl, | ||
285 | .power_ctrl = dibusb2_0_power_ctrl, | ||
286 | .frontend_attach = dibusb_dib3000mb_frontend_attach, | ||
287 | .tuner_attach = dibusb_thomson_tuner_attach, | ||
288 | |||
289 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
290 | .rc_key_map = dibusb_rc_keys, | ||
291 | .rc_key_map_size = 63, /* wow, that is ugly ... I want to load it to the driver dynamically */ | ||
292 | .rc_query = dibusb_rc_query, | ||
293 | |||
294 | .i2c_algo = &dibusb_i2c_algo, | ||
295 | |||
296 | .generic_bulk_ctrl_endpoint = 0x01, | ||
297 | /* parameter for the MPEG2-data transfer */ | ||
298 | .urb = { | ||
299 | .type = DVB_USB_BULK, | ||
300 | .count = 7, | ||
301 | .endpoint = 0x06, | ||
302 | .u = { | ||
303 | .bulk = { | ||
304 | .buffersize = 4096, | ||
305 | } | ||
306 | } | ||
307 | }, | ||
308 | |||
309 | .num_device_descs = 1, | ||
310 | .devices = { | ||
311 | { "KWorld/ADSTech Instant DVB-T USB 2.0", | ||
312 | { &dibusb_dib3000mb_table[23], NULL }, | ||
313 | { &dibusb_dib3000mb_table[24], NULL }, | ||
314 | }, | ||
315 | } | ||
316 | }; | ||
317 | |||
318 | static struct usb_driver dibusb_driver = { | ||
319 | .owner = THIS_MODULE, | ||
320 | .name = "dvb_usb_dibusb_mb", | ||
321 | .probe = dibusb_probe, | ||
322 | .disconnect = dvb_usb_device_exit, | ||
323 | .id_table = dibusb_dib3000mb_table, | ||
324 | }; | ||
325 | |||
326 | /* module stuff */ | ||
327 | static int __init dibusb_module_init(void) | ||
328 | { | ||
329 | int result; | ||
330 | if ((result = usb_register(&dibusb_driver))) { | ||
331 | err("usb_register failed. Error number %d",result); | ||
332 | return result; | ||
333 | } | ||
334 | |||
335 | return 0; | ||
336 | } | ||
337 | |||
338 | static void __exit dibusb_module_exit(void) | ||
339 | { | ||
340 | /* deregister this driver from the USB subsystem */ | ||
341 | usb_deregister(&dibusb_driver); | ||
342 | } | ||
343 | |||
344 | module_init (dibusb_module_init); | ||
345 | module_exit (dibusb_module_exit); | ||
346 | |||
347 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
348 | MODULE_DESCRIPTION("Driver for DiBcom USB DVB-T devices (DiB3000M-B based)"); | ||
349 | MODULE_VERSION("1.0"); | ||
350 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c new file mode 100644 index 000000000000..e9dac430f37d --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c | |||
@@ -0,0 +1,116 @@ | |||
1 | /* DVB USB compliant linux driver for mobile DVB-T USB devices based on | ||
2 | * reference designs made by DiBcom (http://www.dibcom.fr/) (DiB3000M-C/P) | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * based on GPL code from DiBcom, which has | ||
7 | * Copyright (C) 2004 Amaury Demol for DiBcom (ademol@dibcom.fr) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the Free | ||
11 | * Software Foundation, version 2. | ||
12 | * | ||
13 | * see Documentation/dvb/README.dvb-usb for more information | ||
14 | */ | ||
15 | #include "dibusb.h" | ||
16 | |||
17 | /* USB Driver stuff */ | ||
18 | static struct dvb_usb_properties dibusb_mc_properties; | ||
19 | |||
20 | static int dibusb_mc_probe(struct usb_interface *intf, | ||
21 | const struct usb_device_id *id) | ||
22 | { | ||
23 | return dvb_usb_device_init(intf,&dibusb_mc_properties,THIS_MODULE); | ||
24 | } | ||
25 | |||
26 | /* do not change the order of the ID table */ | ||
27 | static struct usb_device_id dibusb_dib3000mc_table [] = { | ||
28 | /* 00 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_COLD) }, | ||
29 | /* 01 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_WARM) }, | ||
30 | /* 02 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_COLD) }, | ||
31 | { } /* Terminating entry */ | ||
32 | }; | ||
33 | MODULE_DEVICE_TABLE (usb, dibusb_dib3000mc_table); | ||
34 | |||
35 | static struct dvb_usb_properties dibusb_mc_properties = { | ||
36 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, | ||
37 | .pid_filter_count = 32, | ||
38 | |||
39 | .usb_ctrl = CYPRESS_FX2, | ||
40 | .firmware = "dvb-usb-dibusb-6.0.0.8.fw", | ||
41 | |||
42 | .size_of_priv = sizeof(struct dibusb_state), | ||
43 | |||
44 | .streaming_ctrl = dibusb2_0_streaming_ctrl, | ||
45 | .pid_filter = dibusb_pid_filter, | ||
46 | .pid_filter_ctrl = dibusb_pid_filter_ctrl, | ||
47 | .power_ctrl = dibusb2_0_power_ctrl, | ||
48 | .frontend_attach = dibusb_dib3000mc_frontend_attach, | ||
49 | .tuner_attach = dibusb_dib3000mc_tuner_attach, | ||
50 | |||
51 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
52 | .rc_key_map = dibusb_rc_keys, | ||
53 | .rc_key_map_size = 63, /* FIXME */ | ||
54 | .rc_query = dibusb_rc_query, | ||
55 | |||
56 | .i2c_algo = &dibusb_i2c_algo, | ||
57 | |||
58 | .generic_bulk_ctrl_endpoint = 0x01, | ||
59 | /* parameter for the MPEG2-data transfer */ | ||
60 | .urb = { | ||
61 | .type = DVB_USB_BULK, | ||
62 | .count = 7, | ||
63 | .endpoint = 0x06, | ||
64 | .u = { | ||
65 | .bulk = { | ||
66 | .buffersize = 4096, | ||
67 | } | ||
68 | } | ||
69 | }, | ||
70 | |||
71 | .num_device_descs = 2, | ||
72 | .devices = { | ||
73 | { "DiBcom USB2.0 DVB-T reference design (MOD3000P)", | ||
74 | { &dibusb_dib3000mc_table[0], NULL }, | ||
75 | { &dibusb_dib3000mc_table[1], NULL }, | ||
76 | }, | ||
77 | { "Artec T1 USB2.0 TVBOX (please report the warm ID)", | ||
78 | { &dibusb_dib3000mc_table[2], NULL }, | ||
79 | { NULL }, | ||
80 | }, | ||
81 | } | ||
82 | }; | ||
83 | |||
84 | static struct usb_driver dibusb_mc_driver = { | ||
85 | .owner = THIS_MODULE, | ||
86 | .name = "dvb_usb_dibusb_mc", | ||
87 | .probe = dibusb_mc_probe, | ||
88 | .disconnect = dvb_usb_device_exit, | ||
89 | .id_table = dibusb_dib3000mc_table, | ||
90 | }; | ||
91 | |||
92 | /* module stuff */ | ||
93 | static int __init dibusb_mc_module_init(void) | ||
94 | { | ||
95 | int result; | ||
96 | if ((result = usb_register(&dibusb_mc_driver))) { | ||
97 | err("usb_register failed. Error number %d",result); | ||
98 | return result; | ||
99 | } | ||
100 | |||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static void __exit dibusb_mc_module_exit(void) | ||
105 | { | ||
106 | /* deregister this driver from the USB subsystem */ | ||
107 | usb_deregister(&dibusb_mc_driver); | ||
108 | } | ||
109 | |||
110 | module_init (dibusb_mc_module_init); | ||
111 | module_exit (dibusb_mc_module_exit); | ||
112 | |||
113 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
114 | MODULE_DESCRIPTION("Driver for DiBcom USB2.0 DVB-T (DiB3000M-C/P based) devices"); | ||
115 | MODULE_VERSION("1.0"); | ||
116 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb.h b/drivers/media/dvb/dvb-usb/dibusb.h new file mode 100644 index 000000000000..6611f62977c0 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dibusb.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* Header file for all dibusb-based-receivers. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the Free | ||
7 | * Software Foundation, version 2. | ||
8 | * | ||
9 | * see Documentation/dvb/README.dvb-usb for more information | ||
10 | */ | ||
11 | #ifndef _DVB_USB_DIBUSB_H_ | ||
12 | #define _DVB_USB_DIBUSB_H_ | ||
13 | |||
14 | #define DVB_USB_LOG_PREFIX "dibusb" | ||
15 | #include "dvb-usb.h" | ||
16 | |||
17 | #include "dib3000.h" | ||
18 | |||
19 | /* | ||
20 | * protocol of all dibusb related devices | ||
21 | */ | ||
22 | |||
23 | /* | ||
24 | * bulk msg to/from endpoint 0x01 | ||
25 | * | ||
26 | * general structure: | ||
27 | * request_byte parameter_bytes | ||
28 | */ | ||
29 | |||
30 | #define DIBUSB_REQ_START_READ 0x00 | ||
31 | #define DIBUSB_REQ_START_DEMOD 0x01 | ||
32 | |||
33 | /* | ||
34 | * i2c read | ||
35 | * bulk write: 0x02 ((7bit i2c_addr << 1) & 0x01) register_bytes length_word | ||
36 | * bulk read: byte_buffer (length_word bytes) | ||
37 | */ | ||
38 | #define DIBUSB_REQ_I2C_READ 0x02 | ||
39 | |||
40 | /* | ||
41 | * i2c write | ||
42 | * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes | ||
43 | */ | ||
44 | #define DIBUSB_REQ_I2C_WRITE 0x03 | ||
45 | |||
46 | /* | ||
47 | * polling the value of the remote control | ||
48 | * bulk write: 0x04 | ||
49 | * bulk read: byte_buffer (5 bytes) | ||
50 | */ | ||
51 | #define DIBUSB_REQ_POLL_REMOTE 0x04 | ||
52 | |||
53 | /* additional status values for Hauppauge Remote Control Protocol */ | ||
54 | #define DIBUSB_RC_HAUPPAUGE_KEY_PRESSED 0x01 | ||
55 | #define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY 0x03 | ||
56 | |||
57 | /* streaming mode: | ||
58 | * bulk write: 0x05 mode_byte | ||
59 | * | ||
60 | * mode_byte is mostly 0x00 | ||
61 | */ | ||
62 | #define DIBUSB_REQ_SET_STREAMING_MODE 0x05 | ||
63 | |||
64 | /* interrupt the internal read loop, when blocking */ | ||
65 | #define DIBUSB_REQ_INTR_READ 0x06 | ||
66 | |||
67 | /* io control | ||
68 | * 0x07 cmd_byte param_bytes | ||
69 | * | ||
70 | * param_bytes can be up to 32 bytes | ||
71 | * | ||
72 | * cmd_byte function parameter name | ||
73 | * 0x00 power mode | ||
74 | * 0x00 sleep | ||
75 | * 0x01 wakeup | ||
76 | * | ||
77 | * 0x01 enable streaming | ||
78 | * 0x02 disable streaming | ||
79 | * | ||
80 | * | ||
81 | */ | ||
82 | #define DIBUSB_REQ_SET_IOCTL 0x07 | ||
83 | |||
84 | /* IOCTL commands */ | ||
85 | |||
86 | /* change the power mode in firmware */ | ||
87 | #define DIBUSB_IOCTL_CMD_POWER_MODE 0x00 | ||
88 | #define DIBUSB_IOCTL_POWER_SLEEP 0x00 | ||
89 | #define DIBUSB_IOCTL_POWER_WAKEUP 0x01 | ||
90 | |||
91 | /* modify streaming of the FX2 */ | ||
92 | #define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01 | ||
93 | #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02 | ||
94 | |||
95 | struct dibusb_state { | ||
96 | struct dib_fe_xfer_ops ops; | ||
97 | |||
98 | /* for RC5 remote control */ | ||
99 | int old_toggle; | ||
100 | int last_repeat_count; | ||
101 | }; | ||
102 | |||
103 | extern struct i2c_algorithm dibusb_i2c_algo; | ||
104 | |||
105 | extern int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *); | ||
106 | extern int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *); | ||
107 | |||
108 | extern int dibusb_streaming_ctrl(struct dvb_usb_device *, int); | ||
109 | extern int dibusb_pid_filter(struct dvb_usb_device *, int, u16, int); | ||
110 | extern int dibusb_pid_filter_ctrl(struct dvb_usb_device *, int); | ||
111 | extern int dibusb_power_ctrl(struct dvb_usb_device *, int); | ||
112 | extern int dibusb2_0_streaming_ctrl(struct dvb_usb_device *, int); | ||
113 | extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int); | ||
114 | |||
115 | #define DEFAULT_RC_INTERVAL 150 | ||
116 | //#define DEFAULT_RC_INTERVAL 100000 | ||
117 | |||
118 | extern struct dvb_usb_rc_key dibusb_rc_keys[]; | ||
119 | extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *); | ||
120 | extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *); | ||
121 | |||
122 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c new file mode 100644 index 000000000000..9a676afc1d6e --- /dev/null +++ b/drivers/media/dvb/dvb-usb/digitv.c | |||
@@ -0,0 +1,261 @@ | |||
1 | /* DVB USB compliant linux driver for Nebula Electronics uDigiTV DVB-T USB2.0 | ||
2 | * receiver | ||
3 | * | ||
4 | * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * partly based on the SDK published by Nebula Electronics | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the Free | ||
10 | * Software Foundation, version 2. | ||
11 | * | ||
12 | * see Documentation/dvb/README.dvb-usb for more information | ||
13 | */ | ||
14 | #include "digitv.h" | ||
15 | |||
16 | #include "mt352.h" | ||
17 | #include "nxt6000.h" | ||
18 | |||
19 | /* debug */ | ||
20 | int dvb_usb_digitv_debug; | ||
21 | module_param_named(debug,dvb_usb_digitv_debug, int, 0644); | ||
22 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); | ||
23 | |||
24 | static int digitv_ctrl_msg(struct dvb_usb_device *d, | ||
25 | u8 cmd, u8 vv, u8 *wbuf, int wlen, u8 *rbuf, int rlen) | ||
26 | { | ||
27 | int wo = (rbuf == NULL || rlen == 0); /* write-only */ | ||
28 | u8 sndbuf[7],rcvbuf[7]; | ||
29 | memset(sndbuf,0,7); memset(rcvbuf,0,7); | ||
30 | |||
31 | sndbuf[0] = cmd; | ||
32 | sndbuf[1] = vv; | ||
33 | sndbuf[2] = wo ? wlen : rlen; | ||
34 | |||
35 | if (!wo) { | ||
36 | memcpy(&sndbuf[3],wbuf,wlen); | ||
37 | dvb_usb_generic_write(d,sndbuf,7); | ||
38 | } else { | ||
39 | dvb_usb_generic_rw(d,sndbuf,7,rcvbuf,7,10); | ||
40 | memcpy(rbuf,&rcvbuf[3],rlen); | ||
41 | } | ||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | /* I2C */ | ||
46 | static int digitv_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | ||
47 | { | ||
48 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | ||
49 | int i; | ||
50 | |||
51 | if (down_interruptible(&d->i2c_sem) < 0) | ||
52 | return -EAGAIN; | ||
53 | |||
54 | if (num > 2) | ||
55 | warn("more than 2 i2c messages at a time is not handled yet. TODO."); | ||
56 | |||
57 | for (i = 0; i < num; i++) { | ||
58 | /* write/read request */ | ||
59 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | ||
60 | if (digitv_ctrl_msg(d, USB_READ_COFDM, msg[i].buf[0], NULL, 0, | ||
61 | msg[i+1].buf,msg[i+1].len) < 0) | ||
62 | break; | ||
63 | i++; | ||
64 | } else | ||
65 | if (digitv_ctrl_msg(d,USB_WRITE_COFDM, msg[i].buf[0], | ||
66 | &msg[i].buf[1],msg[i].len-1,NULL,0) < 0) | ||
67 | break; | ||
68 | } | ||
69 | |||
70 | up(&d->i2c_sem); | ||
71 | return i; | ||
72 | } | ||
73 | |||
74 | static u32 digitv_i2c_func(struct i2c_adapter *adapter) | ||
75 | { | ||
76 | return I2C_FUNC_I2C; | ||
77 | } | ||
78 | |||
79 | static struct i2c_algorithm digitv_i2c_algo = { | ||
80 | .name = "Nebula DigiTV USB I2C algorithm", | ||
81 | .id = I2C_ALGO_BIT, | ||
82 | .master_xfer = digitv_i2c_xfer, | ||
83 | .functionality = digitv_i2c_func, | ||
84 | }; | ||
85 | |||
86 | /* Callbacks for DVB USB */ | ||
87 | static int digitv_identify_state (struct usb_device *udev, struct | ||
88 | dvb_usb_properties *props, struct dvb_usb_device_description **desc, | ||
89 | int *cold) | ||
90 | { | ||
91 | *cold = udev->descriptor.iManufacturer == 0 && udev->descriptor.iProduct == 0; | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | static int digitv_mt352_demod_init(struct dvb_frontend *fe) | ||
96 | { | ||
97 | static u8 reset_buf[] = { 0x89, 0x38, 0x8a, 0x2d, 0x50, 0x80 }; | ||
98 | static u8 init_buf[] = { 0x68, 0xa0, 0x8e, 0x40, 0x53, 0x50, | ||
99 | 0x67, 0x20, 0x7d, 0x01, 0x7c, 0x00, 0x7a, 0x00, | ||
100 | 0x79, 0x20, 0x57, 0x05, 0x56, 0x31, 0x88, 0x0f, | ||
101 | 0x75, 0x32 }; | ||
102 | int i; | ||
103 | |||
104 | for (i = 0; i < ARRAY_SIZE(reset_buf); i += 2) | ||
105 | mt352_write(fe, &reset_buf[i], 2); | ||
106 | |||
107 | msleep(1); | ||
108 | |||
109 | for (i = 0; i < ARRAY_SIZE(init_buf); i += 2) | ||
110 | mt352_write(fe, &init_buf[i], 2); | ||
111 | |||
112 | return 0; | ||
113 | } | ||
114 | |||
115 | static struct mt352_config digitv_mt352_config = { | ||
116 | .demod_address = 0x0, /* ignored by the digitv anyway */ | ||
117 | .demod_init = digitv_mt352_demod_init, | ||
118 | .pll_set = dvb_usb_pll_set, | ||
119 | }; | ||
120 | |||
121 | static struct nxt6000_config digitv_nxt6000_config = { | ||
122 | .demod_address = 0x0, /* ignored by the digitv anyway */ | ||
123 | .clock_inversion = 0x0, | ||
124 | |||
125 | .pll_init = NULL, | ||
126 | .pll_set = NULL, | ||
127 | }; | ||
128 | |||
129 | static int digitv_frontend_attach(struct dvb_usb_device *d) | ||
130 | { | ||
131 | if ((d->fe = mt352_attach(&digitv_mt352_config, &d->i2c_adap)) != NULL) | ||
132 | return 0; | ||
133 | if ((d->fe = nxt6000_attach(&digitv_nxt6000_config, &d->i2c_adap)) != NULL) { | ||
134 | |||
135 | warn("nxt6000 support is not done yet, in fact you are one of the first " | ||
136 | "person who wants to use this device in Linux. Please report to " | ||
137 | "linux-dvb@linuxtv.org"); | ||
138 | |||
139 | return 0; | ||
140 | } | ||
141 | return -EIO; | ||
142 | } | ||
143 | |||
144 | static int digitv_tuner_attach(struct dvb_usb_device *d) | ||
145 | { | ||
146 | d->pll_addr = 0x60; | ||
147 | d->pll_desc = &dvb_pll_tded4; | ||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | static struct dvb_usb_rc_key digitv_rc_keys[] = { | ||
152 | { 0x00, 0x16, KEY_POWER }, /* dummy key */ | ||
153 | }; | ||
154 | |||
155 | /* TODO is it really the NEC protocol ? */ | ||
156 | int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
157 | { | ||
158 | u8 key[5]; | ||
159 | |||
160 | digitv_ctrl_msg(d,USB_READ_REMOTE,0,NULL,0,&key[1],4); | ||
161 | /* TODO state, maybe it is VV ? */ | ||
162 | if (key[1] != 0) | ||
163 | key[0] = 0x01; /* if something is inside the buffer, simulate key press */ | ||
164 | |||
165 | /* call the universal NEC remote processor, to find out the key's state and event */ | ||
166 | dvb_usb_nec_rc_key_to_event(d,key,event,state); | ||
167 | if (key[0] != 0) | ||
168 | deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); | ||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | /* DVB USB Driver stuff */ | ||
173 | static struct dvb_usb_properties digitv_properties; | ||
174 | |||
175 | static int digitv_probe(struct usb_interface *intf, | ||
176 | const struct usb_device_id *id) | ||
177 | { | ||
178 | return dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE); | ||
179 | } | ||
180 | |||
181 | static struct usb_device_id digitv_table [] = { | ||
182 | { USB_DEVICE(USB_VID_ANCHOR, USB_PID_NEBULA_DIGITV) }, | ||
183 | { } /* Terminating entry */ | ||
184 | }; | ||
185 | MODULE_DEVICE_TABLE (usb, digitv_table); | ||
186 | |||
187 | static struct dvb_usb_properties digitv_properties = { | ||
188 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
189 | |||
190 | .usb_ctrl = CYPRESS_FX2, | ||
191 | .firmware = "dvb-usb-digitv-01.fw", | ||
192 | |||
193 | .size_of_priv = 0, | ||
194 | |||
195 | .frontend_attach = digitv_frontend_attach, | ||
196 | .tuner_attach = digitv_tuner_attach, | ||
197 | |||
198 | .rc_interval = 1000, | ||
199 | .rc_key_map = digitv_rc_keys, | ||
200 | .rc_key_map_size = ARRAY_SIZE(digitv_rc_keys), | ||
201 | .rc_query = digitv_rc_query, | ||
202 | |||
203 | .identify_state = digitv_identify_state, | ||
204 | |||
205 | .i2c_algo = &digitv_i2c_algo, | ||
206 | |||
207 | .generic_bulk_ctrl_endpoint = 0x01, | ||
208 | /* parameter for the MPEG2-data transfer */ | ||
209 | .urb = { | ||
210 | .type = DVB_USB_BULK, | ||
211 | .count = 7, | ||
212 | .endpoint = 0x02, | ||
213 | .u = { | ||
214 | .bulk = { | ||
215 | .buffersize = 4096, | ||
216 | } | ||
217 | } | ||
218 | }, | ||
219 | |||
220 | .num_device_descs = 1, | ||
221 | .devices = { | ||
222 | { "Nebula Electronics uDigiTV DVB-T USB2.0)", | ||
223 | { &digitv_table[0], NULL }, | ||
224 | { NULL }, | ||
225 | }, | ||
226 | } | ||
227 | }; | ||
228 | |||
229 | static struct usb_driver digitv_driver = { | ||
230 | .owner = THIS_MODULE, | ||
231 | .name = "dvb_usb_digitv", | ||
232 | .probe = digitv_probe, | ||
233 | .disconnect = dvb_usb_device_exit, | ||
234 | .id_table = digitv_table, | ||
235 | }; | ||
236 | |||
237 | /* module stuff */ | ||
238 | static int __init digitv_module_init(void) | ||
239 | { | ||
240 | int result; | ||
241 | if ((result = usb_register(&digitv_driver))) { | ||
242 | err("usb_register failed. Error number %d",result); | ||
243 | return result; | ||
244 | } | ||
245 | |||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | static void __exit digitv_module_exit(void) | ||
250 | { | ||
251 | /* deregister this driver from the USB subsystem */ | ||
252 | usb_deregister(&digitv_driver); | ||
253 | } | ||
254 | |||
255 | module_init (digitv_module_init); | ||
256 | module_exit (digitv_module_exit); | ||
257 | |||
258 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
259 | MODULE_DESCRIPTION("Driver for Nebula Electronics uDigiTV DVB-T USB2.0"); | ||
260 | MODULE_VERSION("1.0-alpha"); | ||
261 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/digitv.h b/drivers/media/dvb/dvb-usb/digitv.h new file mode 100644 index 000000000000..477ee428a70e --- /dev/null +++ b/drivers/media/dvb/dvb-usb/digitv.h | |||
@@ -0,0 +1,65 @@ | |||
1 | #ifndef _DVB_USB_DIGITV_H_ | ||
2 | #define _DVB_USB_DIGITV_H_ | ||
3 | |||
4 | #define DVB_USB_LOG_PREFIX "digitv" | ||
5 | #include "dvb-usb.h" | ||
6 | |||
7 | extern int dvb_usb_digitv_debug; | ||
8 | #define deb_rc(args...) dprintk(dvb_usb_digitv_debug,0x01,args) | ||
9 | |||
10 | /* protocol (from usblogging and the SDK: | ||
11 | * | ||
12 | * Always 7 bytes bulk message(s) for controlling | ||
13 | * | ||
14 | * First byte describes the command. Reads are 2 consecutive transfer (as always). | ||
15 | * | ||
16 | * General structure: | ||
17 | * | ||
18 | * write or first message of a read: | ||
19 | * <cmdbyte> VV <len> B0 B1 B2 B3 | ||
20 | * | ||
21 | * second message of a read | ||
22 | * <cmdbyte> VV <len> R0 R1 R2 R3 | ||
23 | * | ||
24 | * whereas 0 < len <= 4 | ||
25 | * | ||
26 | * I2C address is stored somewhere inside the device. | ||
27 | * | ||
28 | * 0x01 read from EEPROM | ||
29 | * VV = offset; B* = 0; R* = value(s) | ||
30 | * | ||
31 | * 0x02 read register of the COFDM | ||
32 | * VV = register; B* = 0; R* = value(s) | ||
33 | * | ||
34 | * 0x05 write register of the COFDM | ||
35 | * VV = register; B* = value(s); | ||
36 | * | ||
37 | * 0x06 write to the tuner (only for NXT6000) | ||
38 | * VV = 0; B* = PLL data; len = 4; | ||
39 | * | ||
40 | * 0x03 read remote control | ||
41 | * VV = 0; B* = 0; len = 4; R* = key | ||
42 | * | ||
43 | * 0x07 write to the remote (don't know why one should this, resetting ?) | ||
44 | * VV = 0; B* = key; len = 4; | ||
45 | * | ||
46 | * 0x08 write remote type | ||
47 | * VV = 0; B[0] = 0x01, len = 4 | ||
48 | * | ||
49 | * 0x09 write device init | ||
50 | * TODO | ||
51 | */ | ||
52 | #define USB_READ_EEPROM 1 | ||
53 | |||
54 | #define USB_READ_COFDM 2 | ||
55 | #define USB_WRITE_COFDM 5 | ||
56 | |||
57 | #define USB_WRITE_TUNER 6 | ||
58 | |||
59 | #define USB_READ_REMOTE 3 | ||
60 | #define USB_WRITE_REMOTE 7 | ||
61 | #define USB_WRITE_REMOTE_TYPE 8 | ||
62 | |||
63 | #define USB_DEV_INIT 9 | ||
64 | |||
65 | #endif | ||
diff --git a/drivers/media/dvb/dibusb/dvb-fe-dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u-fe.c index 1872aa6d200a..b032523b07bc 100644 --- a/drivers/media/dvb/dibusb/dvb-fe-dtt200u.c +++ b/drivers/media/dvb/dvb-usb/dtt200u-fe.c | |||
@@ -1,100 +1,72 @@ | |||
1 | /* | 1 | /* Frontend part of the Linux driver for the WideView/ Yakumo/ Hama/ |
2 | * dvb-dtt200u-fe.c is a driver which implements the frontend-part of the | 2 | * Typhoon/ Yuan DVB-T USB2.0 receiver. |
3 | * Yakumo/Typhoon/Hama USB2.0 boxes. It is hard-wired to the dibusb-driver as | ||
4 | * it uses the usb-transfer functions directly (maybe creating a | ||
5 | * generic-dvb-usb-lib for all usb-drivers will be reduce some more code.) | ||
6 | * | 3 | * |
7 | * Copyright (C) 2005 Patrick Boettcher <patrick.boettcher@desy.de> | 4 | * Copyright (C) 2005 Patrick Boettcher <patrick.boettcher@desy.de> |
8 | * | 5 | * |
9 | * see dvb-dibusb-core.c for copyright details. | 6 | * This program is free software; you can redistribute it and/or modify it |
10 | */ | 7 | * under the terms of the GNU General Public License as published by the Free |
11 | 8 | * Software Foundation, version 2. | |
12 | /* guessed protocol description (reverse engineered): | ||
13 | * read | ||
14 | * 00 - USB type 0x02 for usb2.0, 0x01 for usb1.1 | ||
15 | * 81 - <TS_LOCK> <current frequency divided by 250000> | ||
16 | * 82 - crash - do not touch | ||
17 | * 83 - crash - do not touch | ||
18 | * 84 - remote control | ||
19 | * 85 - crash - do not touch (OK, stop testing here) | ||
20 | * 88 - locking 2 bytes (0x80 0x40 == no signal, 0x89 0x20 == nice signal) | ||
21 | * 89 - noise-to-signal | ||
22 | * 8a - unkown 1 byte - signal_strength | ||
23 | * 8c - ber ??? | ||
24 | * 8d - ber | ||
25 | * 8e - unc | ||
26 | * | 9 | * |
27 | * write | 10 | * see Documentation/dvb/README.dvb-usb for more information |
28 | * 02 - bandwidth | ||
29 | * 03 - frequency (divided by 250000) | ||
30 | * 04 - pid table (index pid(7:0) pid(12:8)) | ||
31 | * 05 - reset the pid table | ||
32 | * 08 - demod transfer enabled or not (FX2 transfer is enabled by default) | ||
33 | */ | 11 | */ |
34 | 12 | #include "dtt200u.h" | |
35 | #include "dvb-dibusb.h" | ||
36 | #include "dvb_frontend.h" | ||
37 | 13 | ||
38 | struct dtt200u_fe_state { | 14 | struct dtt200u_fe_state { |
39 | struct usb_dibusb *dib; | 15 | struct dvb_usb_device *d; |
16 | |||
17 | fe_status_t stat; | ||
40 | 18 | ||
41 | struct dvb_frontend_parameters fep; | 19 | struct dvb_frontend_parameters fep; |
42 | struct dvb_frontend frontend; | 20 | struct dvb_frontend frontend; |
43 | }; | 21 | }; |
44 | 22 | ||
45 | #define moan(which,what) info("unexpected value in '%s' for cmd '%02x' - please report to linux-dvb@linuxtv.org",which,what) | ||
46 | |||
47 | static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) | 23 | static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) |
48 | { | 24 | { |
49 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 25 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
50 | u8 bw[1] = { 0x81 }; | 26 | u8 st = GET_TUNE_STATUS, b[3]; |
51 | u8 br[3] = { 0 }; | 27 | |
52 | // u8 bdeb[5] = { 0 }; | 28 | dvb_usb_generic_rw(state->d,&st,1,b,3,0); |
53 | 29 | ||
54 | dibusb_readwrite_usb(state->dib,bw,1,br,3); | 30 | switch (b[0]) { |
55 | switch (br[0]) { | ||
56 | case 0x01: | 31 | case 0x01: |
57 | *stat = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; | 32 | *stat = FE_HAS_SIGNAL | FE_HAS_CARRIER | |
33 | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; | ||
58 | break; | 34 | break; |
59 | case 0x00: | 35 | case 0x00: /* pending */ |
60 | *stat = 0; | 36 | *stat = FE_TIMEDOUT; /* during set_frontend */ |
61 | break; | 37 | break; |
62 | default: | 38 | default: |
63 | moan("br[0]",0x81); | 39 | case 0x02: /* failed */ |
40 | *stat = 0; | ||
64 | break; | 41 | break; |
65 | } | 42 | } |
66 | |||
67 | // bw[0] = 0x88; | ||
68 | // dibusb_readwrite_usb(state->dib,bw,1,bdeb,5); | ||
69 | |||
70 | // deb_info("%02x: %02x %02x %02x %02x %02x\n",bw[0],bdeb[0],bdeb[1],bdeb[2],bdeb[3],bdeb[4]); | ||
71 | |||
72 | return 0; | 43 | return 0; |
73 | } | 44 | } |
45 | |||
74 | static int dtt200u_fe_read_ber(struct dvb_frontend* fe, u32 *ber) | 46 | static int dtt200u_fe_read_ber(struct dvb_frontend* fe, u32 *ber) |
75 | { | 47 | { |
76 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 48 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
77 | u8 bw[1] = { 0x8d }; | 49 | u8 bw = GET_VIT_ERR_CNT,b[3]; |
78 | *ber = 0; | 50 | dvb_usb_generic_rw(state->d,&bw,1,b,3,0); |
79 | dibusb_readwrite_usb(state->dib,bw,1,(u8*) ber, 3); | 51 | *ber = (b[0] << 16) | (b[1] << 8) | b[2]; |
80 | return 0; | 52 | return 0; |
81 | } | 53 | } |
82 | 54 | ||
83 | static int dtt200u_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | 55 | static int dtt200u_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) |
84 | { | 56 | { |
85 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 57 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
86 | u8 bw[1] = { 0x8c }; | 58 | u8 bw = GET_RS_UNCOR_BLK_CNT,b[2]; |
87 | *unc = 0; | 59 | |
88 | dibusb_readwrite_usb(state->dib,bw,1,(u8*) unc, 3); | 60 | dvb_usb_generic_rw(state->d,&bw,1,b,2,0); |
61 | *unc = (b[0] << 8) | b[1]; | ||
89 | return 0; | 62 | return 0; |
90 | } | 63 | } |
91 | 64 | ||
92 | static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength) | 65 | static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength) |
93 | { | 66 | { |
94 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 67 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
95 | u8 bw[1] = { 0x8a }; | 68 | u8 bw = GET_AGC, b; |
96 | u8 b; | 69 | dvb_usb_generic_rw(state->d,&bw,1,&b,1,0); |
97 | dibusb_readwrite_usb(state->dib,bw,1,&b, 1); | ||
98 | *strength = (b << 8) | b; | 70 | *strength = (b << 8) | b; |
99 | return 0; | 71 | return 0; |
100 | } | 72 | } |
@@ -102,18 +74,17 @@ static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strengt | |||
102 | static int dtt200u_fe_read_snr(struct dvb_frontend* fe, u16 *snr) | 74 | static int dtt200u_fe_read_snr(struct dvb_frontend* fe, u16 *snr) |
103 | { | 75 | { |
104 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 76 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
105 | u8 bw[1] = { 0x89 }; | 77 | u8 bw = GET_SNR,br; |
106 | u8 br[1] = { 0 }; | 78 | dvb_usb_generic_rw(state->d,&bw,1,&br,1,0); |
107 | dibusb_readwrite_usb(state->dib,bw,1,br,1); | 79 | *snr = ~((br << 8) | br); |
108 | *snr = ((0xff - br[0]) << 8) | (0xff - br[0]); | ||
109 | return 0; | 80 | return 0; |
110 | } | 81 | } |
111 | 82 | ||
112 | static int dtt200u_fe_init(struct dvb_frontend* fe) | 83 | static int dtt200u_fe_init(struct dvb_frontend* fe) |
113 | { | 84 | { |
114 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 85 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
115 | u8 b[] = { 0x01 }; | 86 | u8 b = SET_INIT; |
116 | return dibusb_write_usb(state->dib,b,1); | 87 | return dvb_usb_generic_write(state->d,&b,1); |
117 | } | 88 | } |
118 | 89 | ||
119 | static int dtt200u_fe_sleep(struct dvb_frontend* fe) | 90 | static int dtt200u_fe_sleep(struct dvb_frontend* fe) |
@@ -124,8 +95,8 @@ static int dtt200u_fe_sleep(struct dvb_frontend* fe) | |||
124 | static int dtt200u_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) | 95 | static int dtt200u_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) |
125 | { | 96 | { |
126 | tune->min_delay_ms = 1500; | 97 | tune->min_delay_ms = 1500; |
127 | tune->step_size = 166667; | 98 | tune->step_size = 0; |
128 | tune->max_drift = 166667 * 2; | 99 | tune->max_drift = 0; |
129 | return 0; | 100 | return 0; |
130 | } | 101 | } |
131 | 102 | ||
@@ -133,27 +104,32 @@ static int dtt200u_fe_set_frontend(struct dvb_frontend* fe, | |||
133 | struct dvb_frontend_parameters *fep) | 104 | struct dvb_frontend_parameters *fep) |
134 | { | 105 | { |
135 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 106 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
107 | int i; | ||
108 | fe_status_t st; | ||
136 | u16 freq = fep->frequency / 250000; | 109 | u16 freq = fep->frequency / 250000; |
137 | u8 bw,bwbuf[2] = { 0x03, 0 }, freqbuf[3] = { 0x02, 0, 0 }; | 110 | u8 bwbuf[2] = { SET_BANDWIDTH, 0 },freqbuf[3] = { SET_RF_FREQ, 0, 0 }; |
138 | 111 | ||
139 | switch (fep->u.ofdm.bandwidth) { | 112 | switch (fep->u.ofdm.bandwidth) { |
140 | case BANDWIDTH_8_MHZ: bw = 8; break; | 113 | case BANDWIDTH_8_MHZ: bwbuf[1] = 8; break; |
141 | case BANDWIDTH_7_MHZ: bw = 7; break; | 114 | case BANDWIDTH_7_MHZ: bwbuf[1] = 7; break; |
142 | case BANDWIDTH_6_MHZ: bw = 6; break; | 115 | case BANDWIDTH_6_MHZ: bwbuf[1] = 6; break; |
143 | case BANDWIDTH_AUTO: return -EOPNOTSUPP; | 116 | case BANDWIDTH_AUTO: return -EOPNOTSUPP; |
144 | default: | 117 | default: |
145 | return -EINVAL; | 118 | return -EINVAL; |
146 | } | 119 | } |
147 | deb_info("set_frontend\n"); | ||
148 | 120 | ||
149 | bwbuf[1] = bw; | 121 | dvb_usb_generic_write(state->d,bwbuf,2); |
150 | dibusb_write_usb(state->dib,bwbuf,2); | ||
151 | 122 | ||
152 | freqbuf[1] = freq & 0xff; | 123 | freqbuf[1] = freq & 0xff; |
153 | freqbuf[2] = (freq >> 8) & 0xff; | 124 | freqbuf[2] = (freq >> 8) & 0xff; |
154 | dibusb_write_usb(state->dib,freqbuf,3); | 125 | dvb_usb_generic_write(state->d,freqbuf,3); |
155 | 126 | ||
156 | memcpy(&state->fep,fep,sizeof(struct dvb_frontend_parameters)); | 127 | for (i = 0; i < 30; i++) { |
128 | msleep(20); | ||
129 | dtt200u_fe_read_status(fe, &st); | ||
130 | if (st & FE_TIMEDOUT) | ||
131 | continue; | ||
132 | } | ||
157 | 133 | ||
158 | return 0; | 134 | return 0; |
159 | } | 135 | } |
@@ -172,37 +148,9 @@ static void dtt200u_fe_release(struct dvb_frontend* fe) | |||
172 | kfree(state); | 148 | kfree(state); |
173 | } | 149 | } |
174 | 150 | ||
175 | static int dtt200u_pid_control(struct dvb_frontend *fe,int index, int pid,int onoff) | ||
176 | { | ||
177 | struct dtt200u_fe_state *state = (struct dtt200u_fe_state*) fe->demodulator_priv; | ||
178 | u8 b_pid[4]; | ||
179 | pid = onoff ? pid : 0; | ||
180 | |||
181 | b_pid[0] = 0x04; | ||
182 | b_pid[1] = index; | ||
183 | b_pid[2] = pid & 0xff; | ||
184 | b_pid[3] = (pid >> 8) & 0xff; | ||
185 | |||
186 | dibusb_write_usb(state->dib,b_pid,4); | ||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | static int dtt200u_fifo_control(struct dvb_frontend *fe, int onoff) | ||
191 | { | ||
192 | struct dtt200u_fe_state *state = (struct dtt200u_fe_state*) fe->demodulator_priv; | ||
193 | u8 b_streaming[2] = { 0x08, onoff }; | ||
194 | u8 b_rst_pid[1] = { 0x05 }; | ||
195 | |||
196 | dibusb_write_usb(state->dib,b_streaming,2); | ||
197 | |||
198 | if (!onoff) | ||
199 | dibusb_write_usb(state->dib,b_rst_pid,1); | ||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | static struct dvb_frontend_ops dtt200u_fe_ops; | 151 | static struct dvb_frontend_ops dtt200u_fe_ops; |
204 | 152 | ||
205 | struct dvb_frontend* dtt200u_fe_attach(struct usb_dibusb *dib, struct dib_fe_xfer_ops *xfer_ops) | 153 | struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d) |
206 | { | 154 | { |
207 | struct dtt200u_fe_state* state = NULL; | 155 | struct dtt200u_fe_state* state = NULL; |
208 | 156 | ||
@@ -214,14 +162,11 @@ struct dvb_frontend* dtt200u_fe_attach(struct usb_dibusb *dib, struct dib_fe_xfe | |||
214 | 162 | ||
215 | deb_info("attaching frontend dtt200u\n"); | 163 | deb_info("attaching frontend dtt200u\n"); |
216 | 164 | ||
217 | state->dib = dib; | 165 | state->d = d; |
218 | 166 | ||
219 | state->frontend.ops = &dtt200u_fe_ops; | 167 | state->frontend.ops = &dtt200u_fe_ops; |
220 | state->frontend.demodulator_priv = state; | 168 | state->frontend.demodulator_priv = state; |
221 | 169 | ||
222 | xfer_ops->fifo_ctrl = dtt200u_fifo_control; | ||
223 | xfer_ops->pid_ctrl = dtt200u_pid_control; | ||
224 | |||
225 | goto success; | 170 | goto success; |
226 | error: | 171 | error: |
227 | return NULL; | 172 | return NULL; |
@@ -231,7 +176,7 @@ success: | |||
231 | 176 | ||
232 | static struct dvb_frontend_ops dtt200u_fe_ops = { | 177 | static struct dvb_frontend_ops dtt200u_fe_ops = { |
233 | .info = { | 178 | .info = { |
234 | .name = "DTT200U (Yakumo/Typhoon/Hama) DVB-T", | 179 | .name = "WideView USB DVB-T", |
235 | .type = FE_OFDM, | 180 | .type = FE_OFDM, |
236 | .frequency_min = 44250000, | 181 | .frequency_min = 44250000, |
237 | .frequency_max = 867250000, | 182 | .frequency_max = 867250000, |
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c new file mode 100644 index 000000000000..47dba6e45968 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dtt200u.c | |||
@@ -0,0 +1,233 @@ | |||
1 | /* DVB USB library compliant Linux driver for the WideView/ Yakumo/ Hama/ | ||
2 | * Typhoon/ Yuan DVB-T USB2.0 receiver. | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * Thanks to Steve Chang from WideView for providing support for the WT-220U. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the Free | ||
10 | * Software Foundation, version 2. | ||
11 | * | ||
12 | * see Documentation/dvb/README.dvb-usb for more information | ||
13 | */ | ||
14 | #include "dtt200u.h" | ||
15 | |||
16 | /* debug */ | ||
17 | int dvb_usb_dtt200u_debug; | ||
18 | module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644); | ||
19 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS); | ||
20 | |||
21 | static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
22 | { | ||
23 | u8 b = SET_INIT; | ||
24 | |||
25 | if (onoff) | ||
26 | dvb_usb_generic_write(d,&b,2); | ||
27 | |||
28 | return 0; | ||
29 | } | ||
30 | |||
31 | static int dtt200u_streaming_ctrl(struct dvb_usb_device *d, int onoff) | ||
32 | { | ||
33 | u8 b_streaming[2] = { SET_STREAMING, onoff }; | ||
34 | u8 b_rst_pid = RESET_PID_FILTER; | ||
35 | |||
36 | dvb_usb_generic_write(d,b_streaming,2); | ||
37 | |||
38 | if (onoff == 0) | ||
39 | dvb_usb_generic_write(d,&b_rst_pid,1); | ||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | static int dtt200u_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int onoff) | ||
44 | { | ||
45 | u8 b_pid[4]; | ||
46 | pid = onoff ? pid : 0; | ||
47 | |||
48 | b_pid[0] = SET_PID_FILTER; | ||
49 | b_pid[1] = index; | ||
50 | b_pid[2] = pid & 0xff; | ||
51 | b_pid[3] = (pid >> 8) & 0x1f; | ||
52 | |||
53 | return dvb_usb_generic_write(d,b_pid,4); | ||
54 | } | ||
55 | |||
56 | /* remote control */ | ||
57 | /* key list for the tiny remote control (Yakumo, don't know about the others) */ | ||
58 | static struct dvb_usb_rc_key dtt200u_rc_keys[] = { | ||
59 | { 0x80, 0x01, KEY_MUTE }, | ||
60 | { 0x80, 0x02, KEY_CHANNELDOWN }, | ||
61 | { 0x80, 0x03, KEY_VOLUMEDOWN }, | ||
62 | { 0x80, 0x04, KEY_1 }, | ||
63 | { 0x80, 0x05, KEY_2 }, | ||
64 | { 0x80, 0x06, KEY_3 }, | ||
65 | { 0x80, 0x07, KEY_4 }, | ||
66 | { 0x80, 0x08, KEY_5 }, | ||
67 | { 0x80, 0x09, KEY_6 }, | ||
68 | { 0x80, 0x0a, KEY_7 }, | ||
69 | { 0x80, 0x0c, KEY_ZOOM }, | ||
70 | { 0x80, 0x0d, KEY_0 }, | ||
71 | { 0x80, 0x0e, KEY_SELECT }, | ||
72 | { 0x80, 0x12, KEY_POWER }, | ||
73 | { 0x80, 0x1a, KEY_CHANNELUP }, | ||
74 | { 0x80, 0x1b, KEY_8 }, | ||
75 | { 0x80, 0x1e, KEY_VOLUMEUP }, | ||
76 | { 0x80, 0x1f, KEY_9 }, | ||
77 | }; | ||
78 | |||
79 | static int dtt200u_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
80 | { | ||
81 | u8 key[5],cmd = GET_RC_CODE; | ||
82 | dvb_usb_generic_rw(d,&cmd,1,key,5,0); | ||
83 | dvb_usb_nec_rc_key_to_event(d,key,event,state); | ||
84 | if (key[0] != 0) | ||
85 | deb_info("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); | ||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | static int dtt200u_frontend_attach(struct dvb_usb_device *d) | ||
90 | { | ||
91 | d->fe = dtt200u_fe_attach(d); | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | static struct dvb_usb_properties dtt200u_properties; | ||
96 | static struct dvb_usb_properties wt220u_properties; | ||
97 | |||
98 | static int dtt200u_usb_probe(struct usb_interface *intf, | ||
99 | const struct usb_device_id *id) | ||
100 | { | ||
101 | if (dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE) == 0 || | ||
102 | dvb_usb_device_init(intf,&wt220u_properties,THIS_MODULE) == 0) | ||
103 | return 0; | ||
104 | |||
105 | return -ENODEV; | ||
106 | } | ||
107 | |||
108 | static struct usb_device_id dtt200u_usb_table [] = { | ||
109 | // { USB_DEVICE(0x04b4,0x8613) }, | ||
110 | { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_COLD) }, | ||
111 | { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_WARM) }, | ||
112 | { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_COLD) }, | ||
113 | { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_WARM) }, | ||
114 | { 0 }, | ||
115 | }; | ||
116 | MODULE_DEVICE_TABLE(usb, dtt200u_usb_table); | ||
117 | |||
118 | static struct dvb_usb_properties dtt200u_properties = { | ||
119 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING, | ||
120 | .pid_filter_count = 15, | ||
121 | |||
122 | .usb_ctrl = CYPRESS_FX2, | ||
123 | .firmware = "dvb-usb-dtt200u-01.fw", | ||
124 | |||
125 | .power_ctrl = dtt200u_power_ctrl, | ||
126 | .streaming_ctrl = dtt200u_streaming_ctrl, | ||
127 | .pid_filter = dtt200u_pid_filter, | ||
128 | .frontend_attach = dtt200u_frontend_attach, | ||
129 | |||
130 | .rc_interval = 300, | ||
131 | .rc_key_map = dtt200u_rc_keys, | ||
132 | .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), | ||
133 | .rc_query = dtt200u_rc_query, | ||
134 | |||
135 | .generic_bulk_ctrl_endpoint = 0x01, | ||
136 | |||
137 | /* parameter for the MPEG2-data transfer */ | ||
138 | .urb = { | ||
139 | .type = DVB_USB_BULK, | ||
140 | .count = 7, | ||
141 | .endpoint = 0x02, | ||
142 | .u = { | ||
143 | .bulk = { | ||
144 | .buffersize = 4096, | ||
145 | } | ||
146 | } | ||
147 | }, | ||
148 | |||
149 | .num_device_descs = 1, | ||
150 | .devices = { | ||
151 | { .name = "WideView/Yuan/Yakumo/Hama/Typhoon DVB-T USB2.0 (WT-200U)", | ||
152 | .cold_ids = { &dtt200u_usb_table[0], NULL }, | ||
153 | .warm_ids = { &dtt200u_usb_table[1], NULL }, | ||
154 | }, | ||
155 | { 0 }, | ||
156 | } | ||
157 | }; | ||
158 | |||
159 | static struct dvb_usb_properties wt220u_properties = { | ||
160 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING, | ||
161 | .pid_filter_count = 15, | ||
162 | |||
163 | .usb_ctrl = CYPRESS_FX2, | ||
164 | .firmware = "dvb-usb-wt220u-01.fw", | ||
165 | |||
166 | .power_ctrl = dtt200u_power_ctrl, | ||
167 | .streaming_ctrl = dtt200u_streaming_ctrl, | ||
168 | .pid_filter = dtt200u_pid_filter, | ||
169 | .frontend_attach = dtt200u_frontend_attach, | ||
170 | |||
171 | .rc_interval = 300, | ||
172 | .rc_key_map = dtt200u_rc_keys, | ||
173 | .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), | ||
174 | .rc_query = dtt200u_rc_query, | ||
175 | |||
176 | .generic_bulk_ctrl_endpoint = 0x01, | ||
177 | |||
178 | /* parameter for the MPEG2-data transfer */ | ||
179 | .urb = { | ||
180 | .type = DVB_USB_BULK, | ||
181 | .count = 7, | ||
182 | .endpoint = 0x02, | ||
183 | .u = { | ||
184 | .bulk = { | ||
185 | .buffersize = 4096, | ||
186 | } | ||
187 | } | ||
188 | }, | ||
189 | |||
190 | .num_device_descs = 1, | ||
191 | .devices = { | ||
192 | { .name = "WideView WT-220U PenType Receiver (and clones)", | ||
193 | .cold_ids = { &dtt200u_usb_table[2], NULL }, | ||
194 | .warm_ids = { &dtt200u_usb_table[3], NULL }, | ||
195 | }, | ||
196 | { 0 }, | ||
197 | } | ||
198 | }; | ||
199 | |||
200 | /* usb specific object needed to register this driver with the usb subsystem */ | ||
201 | static struct usb_driver dtt200u_usb_driver = { | ||
202 | .owner = THIS_MODULE, | ||
203 | .name = "dvb_usb_dtt200u", | ||
204 | .probe = dtt200u_usb_probe, | ||
205 | .disconnect = dvb_usb_device_exit, | ||
206 | .id_table = dtt200u_usb_table, | ||
207 | }; | ||
208 | |||
209 | /* module stuff */ | ||
210 | static int __init dtt200u_usb_module_init(void) | ||
211 | { | ||
212 | int result; | ||
213 | if ((result = usb_register(&dtt200u_usb_driver))) { | ||
214 | err("usb_register failed. (%d)",result); | ||
215 | return result; | ||
216 | } | ||
217 | |||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | static void __exit dtt200u_usb_module_exit(void) | ||
222 | { | ||
223 | /* deregister this driver from the USB subsystem */ | ||
224 | usb_deregister(&dtt200u_usb_driver); | ||
225 | } | ||
226 | |||
227 | module_init(dtt200u_usb_module_init); | ||
228 | module_exit(dtt200u_usb_module_exit); | ||
229 | |||
230 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
231 | MODULE_DESCRIPTION("Driver for the WideView/Yakumo/Hama/Typhoon DVB-T USB2.0 devices"); | ||
232 | MODULE_VERSION("1.0"); | ||
233 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.h b/drivers/media/dvb/dvb-usb/dtt200u.h new file mode 100644 index 000000000000..6f1f3042e21a --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dtt200u.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* Common header file of Linux driver for the WideView/ Yakumo/ Hama/ | ||
2 | * Typhoon/ Yuan DVB-T USB2.0 receiver. | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation, version 2. | ||
9 | * | ||
10 | * see Documentation/dvb/README.dvb-usb for more information | ||
11 | */ | ||
12 | #ifndef _DVB_USB_DTT200U_H_ | ||
13 | #define _DVB_USB_DTT200U_H_ | ||
14 | |||
15 | #define DVB_USB_LOG_PREFIX "dtt200u" | ||
16 | #include "dvb-usb.h" | ||
17 | |||
18 | extern int dvb_usb_dtt200u_debug; | ||
19 | #define deb_info(args...) dprintk(dvb_usb_dtt200u_debug,0x01,args) | ||
20 | #define deb_xfer(args...) dprintk(dvb_usb_dtt200u_debug,0x02,args) | ||
21 | |||
22 | /* guessed protocol description (reverse engineered): | ||
23 | * read | ||
24 | * 00 - USB type 0x02 for usb2.0, 0x01 for usb1.1 | ||
25 | * 88 - locking 2 bytes (0x80 0x40 == no signal, 0x89 0x20 == nice signal) | ||
26 | */ | ||
27 | |||
28 | #define GET_SPEED 0x00 | ||
29 | #define GET_TUNE_STATUS 0x81 | ||
30 | #define GET_RC_CODE 0x84 | ||
31 | #define GET_CONFIGURATION 0x88 | ||
32 | #define GET_AGC 0x89 | ||
33 | #define GET_SNR 0x8a | ||
34 | #define GET_VIT_ERR_CNT 0x8c | ||
35 | #define GET_RS_ERR_CNT 0x8d | ||
36 | #define GET_RS_UNCOR_BLK_CNT 0x8e | ||
37 | |||
38 | /* write | ||
39 | * 01 - init | ||
40 | * 02 - frequency (divided by 250000) | ||
41 | * 03 - bandwidth | ||
42 | * 04 - pid table (index pid(7:0) pid(12:8)) | ||
43 | * 05 - reset the pid table | ||
44 | * 08 - transfer switch | ||
45 | */ | ||
46 | |||
47 | #define SET_INIT 0x01 | ||
48 | #define SET_RF_FREQ 0x02 | ||
49 | #define SET_BANDWIDTH 0x03 | ||
50 | #define SET_PID_FILTER 0x04 | ||
51 | #define RESET_PID_FILTER 0x05 | ||
52 | #define SET_STREAMING 0x08 | ||
53 | |||
54 | extern struct dvb_frontend * dtt200u_fe_attach(struct dvb_usb_device *d); | ||
55 | |||
56 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-common.h b/drivers/media/dvb/dvb-usb/dvb-usb-common.h new file mode 100644 index 000000000000..7300489d3e24 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-common.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* dvb-usb-common.h is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * a header file containing prototypes and types for internal use of the dvb-usb-lib | ||
7 | */ | ||
8 | #ifndef _DVB_USB_COMMON_H_ | ||
9 | #define _DVB_USB_COMMON_H_ | ||
10 | |||
11 | #define DVB_USB_LOG_PREFIX "dvb-usb" | ||
12 | #include "dvb-usb.h" | ||
13 | |||
14 | extern int dvb_usb_debug; | ||
15 | extern int dvb_usb_disable_rc_polling; | ||
16 | |||
17 | #define deb_info(args...) dprintk(dvb_usb_debug,0x01,args) | ||
18 | #define deb_xfer(args...) dprintk(dvb_usb_debug,0x02,args) | ||
19 | #define deb_pll(args...) dprintk(dvb_usb_debug,0x04,args) | ||
20 | #define deb_ts(args...) dprintk(dvb_usb_debug,0x08,args) | ||
21 | #define deb_err(args...) dprintk(dvb_usb_debug,0x10,args) | ||
22 | #define deb_rc(args...) dprintk(dvb_usb_debug,0x20,args) | ||
23 | #define deb_fw(args...) dprintk(dvb_usb_debug,0x40,args) | ||
24 | #define deb_mem(args...) dprintk(dvb_usb_debug,0x80,args) | ||
25 | |||
26 | /* commonly used methods */ | ||
27 | extern int usb_cypress_load_firmware(struct usb_device *, const char *, int); | ||
28 | |||
29 | extern int dvb_usb_urb_submit(struct dvb_usb_device *); | ||
30 | extern int dvb_usb_urb_kill(struct dvb_usb_device *); | ||
31 | extern int dvb_usb_urb_init(struct dvb_usb_device *); | ||
32 | extern int dvb_usb_urb_exit(struct dvb_usb_device *); | ||
33 | |||
34 | extern int dvb_usb_i2c_init(struct dvb_usb_device *); | ||
35 | extern int dvb_usb_i2c_exit(struct dvb_usb_device *); | ||
36 | |||
37 | extern int dvb_usb_dvb_init(struct dvb_usb_device *); | ||
38 | extern int dvb_usb_dvb_exit(struct dvb_usb_device *); | ||
39 | |||
40 | extern int dvb_usb_fe_init(struct dvb_usb_device *); | ||
41 | extern int dvb_usb_fe_exit(struct dvb_usb_device *); | ||
42 | |||
43 | extern int dvb_usb_remote_init(struct dvb_usb_device *); | ||
44 | extern int dvb_usb_remote_exit(struct dvb_usb_device *); | ||
45 | |||
46 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c new file mode 100644 index 000000000000..3491ff40885c --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c | |||
@@ -0,0 +1,210 @@ | |||
1 | /* dvb-usb-dvb.c is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * This file contains functions for initializing and handling the | ||
7 | * linux-dvb API. | ||
8 | */ | ||
9 | #include "dvb-usb-common.h" | ||
10 | |||
11 | static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) | ||
12 | { | ||
13 | struct dvb_usb_device *d = dvbdmxfeed->demux->priv; | ||
14 | int newfeedcount,ret; | ||
15 | |||
16 | if (d == NULL) | ||
17 | return -ENODEV; | ||
18 | |||
19 | newfeedcount = d->feedcount + (onoff ? 1 : -1); | ||
20 | |||
21 | /* | ||
22 | * stop feed before setting a new pid if there will be no pid anymore | ||
23 | */ | ||
24 | if (newfeedcount == 0) { | ||
25 | deb_ts("stop feeding\n"); | ||
26 | |||
27 | if (d->props.streaming_ctrl != NULL) | ||
28 | if ((ret = d->props.streaming_ctrl(d,0))) | ||
29 | err("error while stopping stream."); | ||
30 | |||
31 | dvb_usb_urb_kill(d); | ||
32 | } | ||
33 | |||
34 | d->feedcount = newfeedcount; | ||
35 | |||
36 | /* activate the pid on the device specific pid_filter */ | ||
37 | deb_ts("setting pid: %5d %04x at index %d '%s'\n",dvbdmxfeed->pid,dvbdmxfeed->pid,dvbdmxfeed->index,onoff ? "on" : "off"); | ||
38 | if (d->props.caps & DVB_USB_HAS_PID_FILTER && | ||
39 | d->pid_filtering && | ||
40 | d->props.pid_filter != NULL) | ||
41 | d->props.pid_filter(d,dvbdmxfeed->index,dvbdmxfeed->pid,onoff); | ||
42 | |||
43 | /* start the feed if this was the first feed and there is still a feed | ||
44 | * for reception. | ||
45 | */ | ||
46 | if (d->feedcount == onoff && d->feedcount > 0) { | ||
47 | |||
48 | deb_ts("controlling pid parser\n"); | ||
49 | if (d->props.caps & DVB_USB_HAS_PID_FILTER && | ||
50 | d->props.caps & DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF && | ||
51 | d->props.pid_filter_ctrl != NULL) | ||
52 | if (d->props.pid_filter_ctrl(d,d->pid_filtering) < 0) | ||
53 | err("could not handle pid_parser"); | ||
54 | |||
55 | deb_ts("start feeding\n"); | ||
56 | if (d->props.streaming_ctrl != NULL) | ||
57 | if (d->props.streaming_ctrl(d,1)) { | ||
58 | err("error while enabling fifo."); | ||
59 | return -ENODEV; | ||
60 | } | ||
61 | |||
62 | dvb_usb_urb_submit(d); | ||
63 | } | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static int dvb_usb_start_feed(struct dvb_demux_feed *dvbdmxfeed) | ||
68 | { | ||
69 | deb_ts("start pid: 0x%04x, feedtype: %d\n", dvbdmxfeed->pid,dvbdmxfeed->type); | ||
70 | return dvb_usb_ctrl_feed(dvbdmxfeed,1); | ||
71 | } | ||
72 | |||
73 | static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | ||
74 | { | ||
75 | deb_ts("stop pid: 0x%04x, feedtype: %d\n", dvbdmxfeed->pid, dvbdmxfeed->type); | ||
76 | return dvb_usb_ctrl_feed(dvbdmxfeed,0); | ||
77 | } | ||
78 | |||
79 | int dvb_usb_dvb_init(struct dvb_usb_device *d) | ||
80 | { | ||
81 | int ret; | ||
82 | |||
83 | if ((ret = dvb_register_adapter(&d->dvb_adap, d->desc->name, | ||
84 | d->owner)) < 0) { | ||
85 | deb_info("dvb_register_adapter failed: error %d", ret); | ||
86 | goto err; | ||
87 | } | ||
88 | d->dvb_adap.priv = d; | ||
89 | |||
90 | if (d->props.read_mac_address) { | ||
91 | if (d->props.read_mac_address(d,d->dvb_adap.proposed_mac) == 0) | ||
92 | info("MAC address: %02x:%02x:%02x:%02x:%02x:%02x",d->dvb_adap.proposed_mac[0], | ||
93 | d->dvb_adap.proposed_mac[1],d->dvb_adap.proposed_mac[2], | ||
94 | d->dvb_adap.proposed_mac[3],d->dvb_adap.proposed_mac[4], | ||
95 | d->dvb_adap.proposed_mac[5]); | ||
96 | else | ||
97 | err("MAC address reading failed."); | ||
98 | } | ||
99 | |||
100 | |||
101 | d->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING; | ||
102 | d->demux.priv = d; | ||
103 | |||
104 | d->demux.feednum = d->demux.filternum = d->max_feed_count; | ||
105 | d->demux.start_feed = dvb_usb_start_feed; | ||
106 | d->demux.stop_feed = dvb_usb_stop_feed; | ||
107 | d->demux.write_to_decoder = NULL; | ||
108 | if ((ret = dvb_dmx_init(&d->demux)) < 0) { | ||
109 | err("dvb_dmx_init failed: error %d",ret); | ||
110 | goto err_dmx; | ||
111 | } | ||
112 | |||
113 | d->dmxdev.filternum = d->demux.filternum; | ||
114 | d->dmxdev.demux = &d->demux.dmx; | ||
115 | d->dmxdev.capabilities = 0; | ||
116 | if ((ret = dvb_dmxdev_init(&d->dmxdev, &d->dvb_adap)) < 0) { | ||
117 | err("dvb_dmxdev_init failed: error %d",ret); | ||
118 | goto err_dmx_dev; | ||
119 | } | ||
120 | |||
121 | dvb_net_init(&d->dvb_adap, &d->dvb_net, &d->demux.dmx); | ||
122 | |||
123 | goto success; | ||
124 | err_dmx_dev: | ||
125 | dvb_dmx_release(&d->demux); | ||
126 | err_dmx: | ||
127 | dvb_unregister_adapter(&d->dvb_adap); | ||
128 | err: | ||
129 | return ret; | ||
130 | success: | ||
131 | d->state |= DVB_USB_STATE_DVB; | ||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | int dvb_usb_dvb_exit(struct dvb_usb_device *d) | ||
136 | { | ||
137 | if (d->state & DVB_USB_STATE_DVB) { | ||
138 | deb_info("unregistering DVB part\n"); | ||
139 | dvb_net_release(&d->dvb_net); | ||
140 | d->demux.dmx.close(&d->demux.dmx); | ||
141 | dvb_dmxdev_release(&d->dmxdev); | ||
142 | dvb_dmx_release(&d->demux); | ||
143 | dvb_unregister_adapter(&d->dvb_adap); | ||
144 | d->state &= ~DVB_USB_STATE_DVB; | ||
145 | } | ||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | static int dvb_usb_fe_wakeup(struct dvb_frontend *fe) | ||
150 | { | ||
151 | struct dvb_usb_device *d = fe->dvb->priv; | ||
152 | |||
153 | if (d->props.power_ctrl) | ||
154 | d->props.power_ctrl(d,1); | ||
155 | |||
156 | if (d->fe_init) | ||
157 | d->fe_init(fe); | ||
158 | |||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | static int dvb_usb_fe_sleep(struct dvb_frontend *fe) | ||
163 | { | ||
164 | struct dvb_usb_device *d = fe->dvb->priv; | ||
165 | |||
166 | if (d->fe_sleep) | ||
167 | d->fe_sleep(fe); | ||
168 | |||
169 | if (d->props.power_ctrl) | ||
170 | d->props.power_ctrl(d,0); | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | int dvb_usb_fe_init(struct dvb_usb_device* d) | ||
176 | { | ||
177 | if (d->props.frontend_attach == NULL) { | ||
178 | err("strange '%s' doesn't want to attach a frontend.",d->desc->name); | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | d->props.frontend_attach(d); | ||
183 | |||
184 | /* re-assign sleep and wakeup functions */ | ||
185 | if (d->fe != NULL) { | ||
186 | d->fe_init = d->fe->ops->init; d->fe->ops->init = dvb_usb_fe_wakeup; | ||
187 | d->fe_sleep = d->fe->ops->sleep; d->fe->ops->sleep = dvb_usb_fe_sleep; | ||
188 | |||
189 | if (dvb_register_frontend(&d->dvb_adap, d->fe)) { | ||
190 | err("Frontend registration failed."); | ||
191 | if (d->fe->ops->release) | ||
192 | d->fe->ops->release(d->fe); | ||
193 | d->fe = NULL; | ||
194 | return -ENODEV; | ||
195 | } | ||
196 | } else | ||
197 | err("no frontend was attached by '%s'",d->desc->name); | ||
198 | |||
199 | if (d->props.tuner_attach != NULL) | ||
200 | d->props.tuner_attach(d); | ||
201 | |||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | int dvb_usb_fe_exit(struct dvb_usb_device *d) | ||
206 | { | ||
207 | if (d->fe != NULL) | ||
208 | dvb_unregister_frontend(d->fe); | ||
209 | return 0; | ||
210 | } | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c new file mode 100644 index 000000000000..5244e39770a0 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c | |||
@@ -0,0 +1,100 @@ | |||
1 | /* dvb-usb-firmware.c is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * This file contains functions for downloading the firmware to Cypress FX 1 and 2 based devices. | ||
7 | * | ||
8 | * FIXME: This part does actually not belong to dvb-usb, but to the usb-subsystem. | ||
9 | */ | ||
10 | #include "dvb-usb-common.h" | ||
11 | |||
12 | #include <linux/firmware.h> | ||
13 | #include <linux/usb.h> | ||
14 | |||
15 | struct usb_cypress_controller { | ||
16 | int id; | ||
17 | const char *name; /* name of the usb controller */ | ||
18 | u16 cpu_cs_register; /* needs to be restarted, when the firmware has been downloaded. */ | ||
19 | }; | ||
20 | |||
21 | static struct usb_cypress_controller cypress[] = { | ||
22 | { .id = CYPRESS_AN2135, .name = "Cypress AN2135", .cpu_cs_register = 0x7f92 }, | ||
23 | { .id = CYPRESS_AN2235, .name = "Cypress AN2235", .cpu_cs_register = 0x7f92 }, | ||
24 | { .id = CYPRESS_FX2, .name = "Cypress FX2", .cpu_cs_register = 0xe600 }, | ||
25 | }; | ||
26 | |||
27 | /* | ||
28 | * load a firmware packet to the device | ||
29 | */ | ||
30 | static int usb_cypress_writemem(struct usb_device *udev,u16 addr,u8 *data, u8 len) | ||
31 | { | ||
32 | return usb_control_msg(udev, usb_sndctrlpipe(udev,0), | ||
33 | 0xa0, USB_TYPE_VENDOR, addr, 0x00, data, len, 5*HZ); | ||
34 | } | ||
35 | |||
36 | int usb_cypress_load_firmware(struct usb_device *udev, const char *filename, int type) | ||
37 | { | ||
38 | const struct firmware *fw = NULL; | ||
39 | u16 addr; | ||
40 | u8 *b,*p; | ||
41 | int ret = 0,i; | ||
42 | |||
43 | if ((ret = request_firmware(&fw, filename, &udev->dev)) != 0) { | ||
44 | err("did not find the firmware file. (%s) " | ||
45 | "Please see linux/Documentation/dvb/ for more details on firmware-problems.", | ||
46 | filename); | ||
47 | return ret; | ||
48 | } | ||
49 | |||
50 | info("downloading firmware from file '%s' to the '%s'",filename,cypress[type].name); | ||
51 | |||
52 | p = kmalloc(fw->size,GFP_KERNEL); | ||
53 | if (p != NULL) { | ||
54 | u8 reset; | ||
55 | /* | ||
56 | * you cannot use the fw->data as buffer for | ||
57 | * usb_control_msg, a new buffer has to be | ||
58 | * created | ||
59 | */ | ||
60 | memcpy(p,fw->data,fw->size); | ||
61 | |||
62 | /* stop the CPU */ | ||
63 | reset = 1; | ||
64 | if ((ret = usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1)) != 1) | ||
65 | err("could not stop the USB controller CPU."); | ||
66 | for(i = 0; p[i+3] == 0 && i < fw->size; ) { | ||
67 | b = (u8 *) &p[i]; | ||
68 | addr = cpu_to_le16( *((u16 *) &b[1]) ); | ||
69 | |||
70 | deb_fw("writing to address 0x%04x (buffer: 0x%02x%02x)\n",addr,b[1],b[2]); | ||
71 | |||
72 | ret = usb_cypress_writemem(udev,addr,&b[4],b[0]); | ||
73 | |||
74 | if (ret != b[0]) { | ||
75 | err("error while transferring firmware " | ||
76 | "(transferred size: %d, block size: %d)", | ||
77 | ret,b[0]); | ||
78 | ret = -EINVAL; | ||
79 | break; | ||
80 | } | ||
81 | i += 5 + b[0]; | ||
82 | } | ||
83 | /* length in ret */ | ||
84 | if (ret > 0) | ||
85 | ret = 0; | ||
86 | /* restart the CPU */ | ||
87 | reset = 0; | ||
88 | if (ret || usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1) != 1) { | ||
89 | err("could not restart the USB controller CPU."); | ||
90 | ret = -EINVAL; | ||
91 | } | ||
92 | |||
93 | kfree(p); | ||
94 | } else { | ||
95 | ret = -ENOMEM; | ||
96 | } | ||
97 | release_firmware(fw); | ||
98 | |||
99 | return ret; | ||
100 | } | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c new file mode 100644 index 000000000000..9f0a8d90d146 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c | |||
@@ -0,0 +1,118 @@ | |||
1 | /* dvb-usb-i2c.c is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * This file contains functions for (de-)initializing an I2C adapter. | ||
7 | */ | ||
8 | #include "dvb-usb-common.h" | ||
9 | |||
10 | int dvb_usb_i2c_init(struct dvb_usb_device *d) | ||
11 | { | ||
12 | int ret = 0; | ||
13 | |||
14 | if (!(d->props.caps & DVB_USB_IS_AN_I2C_ADAPTER)) | ||
15 | return 0; | ||
16 | |||
17 | if (d->props.i2c_algo == NULL) { | ||
18 | err("no i2c algorithm specified"); | ||
19 | return -EINVAL; | ||
20 | } | ||
21 | |||
22 | strncpy(d->i2c_adap.name,d->desc->name,I2C_NAME_SIZE); | ||
23 | #ifdef I2C_ADAP_CLASS_TV_DIGITAL | ||
24 | d->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL, | ||
25 | #else | ||
26 | d->i2c_adap.class = I2C_CLASS_TV_DIGITAL, | ||
27 | #endif | ||
28 | d->i2c_adap.algo = d->props.i2c_algo; | ||
29 | d->i2c_adap.algo_data = NULL; | ||
30 | d->i2c_adap.id = I2C_ALGO_BIT; | ||
31 | |||
32 | i2c_set_adapdata(&d->i2c_adap, d); | ||
33 | |||
34 | if ((ret = i2c_add_adapter(&d->i2c_adap)) < 0) | ||
35 | err("could not add i2c adapter"); | ||
36 | |||
37 | d->state |= DVB_USB_STATE_I2C; | ||
38 | |||
39 | return ret; | ||
40 | } | ||
41 | |||
42 | int dvb_usb_i2c_exit(struct dvb_usb_device *d) | ||
43 | { | ||
44 | if (d->state & DVB_USB_STATE_I2C) | ||
45 | i2c_del_adapter(&d->i2c_adap); | ||
46 | d->state &= ~DVB_USB_STATE_I2C; | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | int dvb_usb_pll_init_i2c(struct dvb_frontend *fe) | ||
51 | { | ||
52 | struct dvb_usb_device *d = fe->dvb->priv; | ||
53 | struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = d->pll_init, .len = 4 }; | ||
54 | int ret = 0; | ||
55 | |||
56 | /* if there is nothing to initialize */ | ||
57 | if (d->pll_init[0] == 0x00 && d->pll_init[1] == 0x00 && | ||
58 | d->pll_init[2] == 0x00 && d->pll_init[3] == 0x00) | ||
59 | return 0; | ||
60 | |||
61 | if (d->tuner_pass_ctrl) | ||
62 | d->tuner_pass_ctrl(fe,1,d->pll_addr); | ||
63 | |||
64 | deb_pll("pll init: %x\n",d->pll_addr); | ||
65 | deb_pll("pll-buf: %x %x %x %x\n",d->pll_init[0],d->pll_init[1], | ||
66 | d->pll_init[2],d->pll_init[3]); | ||
67 | |||
68 | if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { | ||
69 | err("tuner i2c write failed for pll_init."); | ||
70 | ret = -EREMOTEIO; | ||
71 | } | ||
72 | msleep(1); | ||
73 | |||
74 | if (d->tuner_pass_ctrl) | ||
75 | d->tuner_pass_ctrl(fe,0,d->pll_addr); | ||
76 | return ret; | ||
77 | } | ||
78 | EXPORT_SYMBOL(dvb_usb_pll_init_i2c); | ||
79 | |||
80 | int dvb_usb_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep, u8 b[5]) | ||
81 | { | ||
82 | struct dvb_usb_device *d = fe->dvb->priv; | ||
83 | |||
84 | deb_pll("pll addr: %x, freq: %d %p\n",d->pll_addr,fep->frequency,d->pll_desc); | ||
85 | |||
86 | b[0] = d->pll_addr << 1; | ||
87 | dvb_pll_configure(d->pll_desc,&b[1],fep->frequency,fep->u.ofdm.bandwidth); | ||
88 | |||
89 | deb_pll("pll-buf: %x %x %x %x %x\n",b[0],b[1],b[2],b[3],b[4]); | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | EXPORT_SYMBOL(dvb_usb_pll_set); | ||
94 | |||
95 | int dvb_usb_pll_set_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) | ||
96 | { | ||
97 | struct dvb_usb_device *d = fe->dvb->priv; | ||
98 | int ret = 0; | ||
99 | u8 b[5]; | ||
100 | struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = &b[1], .len = 4 }; | ||
101 | |||
102 | dvb_usb_pll_set(fe,fep,b); | ||
103 | |||
104 | if (d->tuner_pass_ctrl) | ||
105 | d->tuner_pass_ctrl(fe,1,d->pll_addr); | ||
106 | |||
107 | if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { | ||
108 | err("tuner i2c write failed for pll_set."); | ||
109 | ret = -EREMOTEIO; | ||
110 | } | ||
111 | msleep(1); | ||
112 | |||
113 | if (d->tuner_pass_ctrl) | ||
114 | d->tuner_pass_ctrl(fe,0,d->pll_addr); | ||
115 | |||
116 | return ret; | ||
117 | } | ||
118 | EXPORT_SYMBOL(dvb_usb_pll_set_i2c); | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h new file mode 100644 index 000000000000..794d513a8480 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /* dvb-usb-ids.h is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) see | ||
4 | * dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * a header file containing define's for the USB device supported by the | ||
7 | * various drivers. | ||
8 | */ | ||
9 | #ifndef _DVB_USB_IDS_H_ | ||
10 | #define _DVB_USB_IDS_H_ | ||
11 | |||
12 | /* Vendor IDs */ | ||
13 | #define USB_VID_ADSTECH 0x06e1 | ||
14 | #define USB_VID_ANCHOR 0x0547 | ||
15 | #define USB_VID_WIDEVIEW 0x14aa | ||
16 | #define USB_VID_AVERMEDIA 0x07ca | ||
17 | #define USB_VID_COMPRO 0x185b | ||
18 | #define USB_VID_COMPRO_UNK 0x145f | ||
19 | #define USB_VID_CYPRESS 0x04b4 | ||
20 | #define USB_VID_DIBCOM 0x10b8 | ||
21 | #define USB_VID_DVICO 0x0fe9 | ||
22 | #define USB_VID_EMPIA 0xeb1a | ||
23 | #define USB_VID_GRANDTEC 0x5032 | ||
24 | #define USB_VID_HANFTEK 0x15f4 | ||
25 | #define USB_VID_HAUPPAUGE 0x2040 | ||
26 | #define USB_VID_HYPER_PALTEK 0x1025 | ||
27 | #define USB_VID_KYE 0x0458 | ||
28 | #define USB_VID_MEDION 0x1660 | ||
29 | #define USB_VID_VISIONPLUS 0x13d3 | ||
30 | #define USB_VID_TWINHAN 0x1822 | ||
31 | #define USB_VID_ULTIMA_ELECTRONIC 0x05d8 | ||
32 | |||
33 | /* Product IDs */ | ||
34 | #define USB_PID_ADSTECH_USB2_COLD 0xa333 | ||
35 | #define USB_PID_ADSTECH_USB2_WARM 0xa334 | ||
36 | #define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001 | ||
37 | #define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002 | ||
38 | #define USB_PID_AVERMEDIA_DVBT_USB2_COLD 0xa800 | ||
39 | #define USB_PID_AVERMEDIA_DVBT_USB2_WARM 0xa801 | ||
40 | #define USB_PID_COMPRO_DVBU2000_COLD 0xd000 | ||
41 | #define USB_PID_COMPRO_DVBU2000_WARM 0xd001 | ||
42 | #define USB_PID_COMPRO_DVBU2000_UNK_COLD 0x010c | ||
43 | #define USB_PID_COMPRO_DVBU2000_UNK_WARM 0x010d | ||
44 | #define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8 | ||
45 | #define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9 | ||
46 | #define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6 | ||
47 | #define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7 | ||
48 | #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 | ||
49 | #define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 | ||
50 | #define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 | ||
51 | #define USB_PID_KWORLD_VSTREAM_COLD 0x17de | ||
52 | #define USB_PID_KWORLD_VSTREAM_WARM 0x17df | ||
53 | #define USB_PID_TWINHAN_VP7041_COLD 0x3201 | ||
54 | #define USB_PID_TWINHAN_VP7041_WARM 0x3202 | ||
55 | #define USB_PID_TWINHAN_VP7045_COLD 0x3205 | ||
56 | #define USB_PID_TWINHAN_VP7045_WARM 0x3206 | ||
57 | #define USB_PID_DNTV_TINYUSB2_COLD 0x3223 | ||
58 | #define USB_PID_DNTV_TINYUSB2_WARM 0x3224 | ||
59 | #define USB_PID_TWINHAN_VP7021_COLD 0x3207 | ||
60 | #define USB_PID_TWINHAN_VP7021_WARM 0x3208 | ||
61 | #define USB_PID_ULTIMA_TVBOX_COLD 0x8105 | ||
62 | #define USB_PID_ULTIMA_TVBOX_WARM 0x8106 | ||
63 | #define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107 | ||
64 | #define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108 | ||
65 | #define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235 | ||
66 | #define USB_PID_ULTIMA_TVBOX_USB2_COLD 0x8109 | ||
67 | #define USB_PID_ULTIMA_TVBOX_USB2_FX_COLD 0x8613 | ||
68 | #define USB_PID_ULTIMA_TVBOX_USB2_FX_WARM 0x1002 | ||
69 | #define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e | ||
70 | #define USB_PID_UNK_HYPER_PALTEK_WARM 0x005f | ||
71 | #define USB_PID_HANFTEK_UMT_010_COLD 0x0001 | ||
72 | #define USB_PID_HANFTEK_UMT_010_WARM 0x0015 | ||
73 | #define USB_PID_DTT200U_COLD 0x0201 | ||
74 | #define USB_PID_DTT200U_WARM 0x0301 | ||
75 | #define USB_PID_WT220U_COLD 0x0222 | ||
76 | #define USB_PID_WT220U_WARM 0x0221 | ||
77 | #define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 | ||
78 | #define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 | ||
79 | #define USB_PID_NEBULA_DIGITV 0x0201 | ||
80 | #define USB_PID_DVICO_BLUEBIRD_LGZ201 0xdb00 | ||
81 | #define USB_PID_DVICO_BLUEBIRD_TH7579 0xdb10 | ||
82 | #define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820 | ||
83 | #define USB_PID_DVICO_BLUEBIRD_LGZ201_1 0xdb01 | ||
84 | #define USB_PID_DVICO_BLUEBIRD_TH7579_2 0xdb11 | ||
85 | #define USB_PID_MEDION_MD95700 0x0932 | ||
86 | #define USB_PID_KYE_DVB_T_COLD 0x701e | ||
87 | #define USB_PID_KYE_DVB_T_WARM 0x701f | ||
88 | |||
89 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c new file mode 100644 index 000000000000..65f0c095abc9 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c | |||
@@ -0,0 +1,215 @@ | |||
1 | /* | ||
2 | * DVB USB library - provides a generic interface for a DVB USB device driver. | ||
3 | * | ||
4 | * dvb-usb-init.c | ||
5 | * | ||
6 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the Free | ||
10 | * Software Foundation, version 2. | ||
11 | * | ||
12 | * see Documentation/dvb/README.dvb-usb for more information | ||
13 | */ | ||
14 | #include "dvb-usb-common.h" | ||
15 | |||
16 | /* debug */ | ||
17 | int dvb_usb_debug; | ||
18 | module_param_named(debug,dvb_usb_debug, int, 0644); | ||
19 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64 (or-able))." DVB_USB_DEBUG_STATUS); | ||
20 | |||
21 | int dvb_usb_disable_rc_polling; | ||
22 | module_param_named(disable_rc_polling, dvb_usb_disable_rc_polling, int, 0644); | ||
23 | MODULE_PARM_DESC(disable_rc_polling, "disable remote control polling (default: 0)."); | ||
24 | |||
25 | /* general initialization functions */ | ||
26 | int dvb_usb_exit(struct dvb_usb_device *d) | ||
27 | { | ||
28 | deb_info("state before exiting everything: %x\n",d->state); | ||
29 | dvb_usb_remote_exit(d); | ||
30 | dvb_usb_fe_exit(d); | ||
31 | dvb_usb_i2c_exit(d); | ||
32 | dvb_usb_dvb_exit(d); | ||
33 | dvb_usb_urb_exit(d); | ||
34 | deb_info("state should be zero now: %x\n",d->state); | ||
35 | d->state = DVB_USB_STATE_INIT; | ||
36 | kfree(d->priv); | ||
37 | kfree(d); | ||
38 | return 0; | ||
39 | } | ||
40 | |||
41 | static int dvb_usb_init(struct dvb_usb_device *d) | ||
42 | { | ||
43 | int ret = 0; | ||
44 | |||
45 | sema_init(&d->usb_sem, 1); | ||
46 | sema_init(&d->i2c_sem, 1); | ||
47 | |||
48 | d->state = DVB_USB_STATE_INIT; | ||
49 | |||
50 | /* check the capabilites and set appropriate variables */ | ||
51 | |||
52 | /* speed - when running at FULL speed we need a HW PID filter */ | ||
53 | if (d->udev->speed == USB_SPEED_FULL && !(d->props.caps & DVB_USB_HAS_PID_FILTER)) { | ||
54 | err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a hardware PID filter)"); | ||
55 | return -ENODEV; | ||
56 | } | ||
57 | |||
58 | if ((d->udev->speed == USB_SPEED_FULL && d->props.caps & DVB_USB_HAS_PID_FILTER) || | ||
59 | (d->props.caps & DVB_USB_NEED_PID_FILTERING)) { | ||
60 | info("will use the device's hardware PID filter (table count: %d).",d->props.pid_filter_count); | ||
61 | d->pid_filtering = 1; | ||
62 | d->max_feed_count = d->props.pid_filter_count; | ||
63 | } else { | ||
64 | info("will pass the complete MPEG2 transport stream to the software demuxer."); | ||
65 | d->pid_filtering = 0; | ||
66 | d->max_feed_count = 255; | ||
67 | } | ||
68 | |||
69 | if (d->props.power_ctrl) | ||
70 | d->props.power_ctrl(d,1); | ||
71 | |||
72 | if ((ret = dvb_usb_urb_init(d)) || | ||
73 | (ret = dvb_usb_dvb_init(d)) || | ||
74 | (ret = dvb_usb_i2c_init(d)) || | ||
75 | (ret = dvb_usb_fe_init(d))) { | ||
76 | dvb_usb_exit(d); | ||
77 | return ret; | ||
78 | } | ||
79 | |||
80 | if ((ret = dvb_usb_remote_init(d))) | ||
81 | err("could not initialize remote control."); | ||
82 | |||
83 | if (d->props.power_ctrl) | ||
84 | d->props.power_ctrl(d,0); | ||
85 | |||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | /* determine the name and the state of the just found USB device */ | ||
90 | static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device *udev,struct dvb_usb_properties *props, int *cold) | ||
91 | { | ||
92 | int i,j; | ||
93 | struct dvb_usb_device_description *desc = NULL; | ||
94 | *cold = -1; | ||
95 | |||
96 | for (i = 0; i < props->num_device_descs; i++) { | ||
97 | |||
98 | for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].cold_ids[j] != NULL; j++) { | ||
99 | deb_info("check for cold %x %x\n",props->devices[i].cold_ids[j]->idVendor, props->devices[i].cold_ids[j]->idProduct); | ||
100 | if (props->devices[i].cold_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && | ||
101 | props->devices[i].cold_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { | ||
102 | *cold = 1; | ||
103 | desc = &props->devices[i]; | ||
104 | break; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | if (desc != NULL) | ||
109 | break; | ||
110 | |||
111 | for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].warm_ids[j] != NULL; j++) { | ||
112 | deb_info("check for warm %x %x\n",props->devices[i].warm_ids[j]->idVendor, props->devices[i].warm_ids[j]->idProduct); | ||
113 | if (props->devices[i].warm_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && | ||
114 | props->devices[i].warm_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { | ||
115 | *cold = 0; | ||
116 | desc = &props->devices[i]; | ||
117 | break; | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | |||
122 | if (desc != NULL && props->identify_state != NULL) | ||
123 | props->identify_state(udev,props,&desc,cold); | ||
124 | |||
125 | return desc; | ||
126 | } | ||
127 | |||
128 | /* | ||
129 | * USB | ||
130 | */ | ||
131 | int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties *props, struct module *owner) | ||
132 | { | ||
133 | struct usb_device *udev = interface_to_usbdev(intf); | ||
134 | struct dvb_usb_device *d = NULL; | ||
135 | struct dvb_usb_device_description *desc = NULL; | ||
136 | |||
137 | int ret = -ENOMEM,cold=0; | ||
138 | |||
139 | if ((desc = dvb_usb_find_device(udev,props,&cold)) == NULL) { | ||
140 | deb_err("something went very wrong, device was not found in current device list - let's see what comes next.\n"); | ||
141 | return -ENODEV; | ||
142 | } | ||
143 | |||
144 | if (cold) { | ||
145 | info("found a '%s' in cold state, will try to load a firmware",desc->name); | ||
146 | ret = usb_cypress_load_firmware(udev,props->firmware,props->usb_ctrl); | ||
147 | } else { | ||
148 | info("found a '%s' in warm state.",desc->name); | ||
149 | d = kmalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); | ||
150 | if (d == NULL) { | ||
151 | err("no memory for 'struct dvb_usb_device'"); | ||
152 | return ret; | ||
153 | } | ||
154 | memset(d,0,sizeof(struct dvb_usb_device)); | ||
155 | |||
156 | d->udev = udev; | ||
157 | memcpy(&d->props,props,sizeof(struct dvb_usb_properties)); | ||
158 | d->desc = desc; | ||
159 | d->owner = owner; | ||
160 | |||
161 | if (d->props.size_of_priv > 0) { | ||
162 | d->priv = kmalloc(d->props.size_of_priv,GFP_KERNEL); | ||
163 | if (d->priv == NULL) { | ||
164 | err("no memory for priv in 'struct dvb_usb_device'"); | ||
165 | kfree(d); | ||
166 | return -ENOMEM; | ||
167 | } | ||
168 | memset(d->priv,0,d->props.size_of_priv); | ||
169 | } | ||
170 | |||
171 | usb_set_intfdata(intf, d); | ||
172 | |||
173 | ret = dvb_usb_init(d); | ||
174 | } | ||
175 | |||
176 | if (ret == 0) | ||
177 | info("%s successfully initialized and connected.",desc->name); | ||
178 | else | ||
179 | info("%s error while loading driver (%d)",desc->name,ret); | ||
180 | return ret; | ||
181 | } | ||
182 | EXPORT_SYMBOL(dvb_usb_device_init); | ||
183 | |||
184 | void dvb_usb_device_exit(struct usb_interface *intf) | ||
185 | { | ||
186 | struct dvb_usb_device *d = usb_get_intfdata(intf); | ||
187 | const char *name = "generic DVB-USB module"; | ||
188 | |||
189 | usb_set_intfdata(intf,NULL); | ||
190 | if (d != NULL && d->desc != NULL) { | ||
191 | name = d->desc->name; | ||
192 | dvb_usb_exit(d); | ||
193 | } | ||
194 | info("%s successfully deinitialized and disconnected.",name); | ||
195 | |||
196 | } | ||
197 | EXPORT_SYMBOL(dvb_usb_device_exit); | ||
198 | |||
199 | /* module stuff */ | ||
200 | static int __init dvb_usb_module_init(void) | ||
201 | { | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | static void __exit dvb_usb_module_exit(void) | ||
206 | { | ||
207 | } | ||
208 | |||
209 | module_init (dvb_usb_module_init); | ||
210 | module_exit (dvb_usb_module_exit); | ||
211 | |||
212 | MODULE_VERSION("0.3"); | ||
213 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
214 | MODULE_DESCRIPTION("A library module containing commonly used USB and DVB function USB DVB devices"); | ||
215 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c new file mode 100644 index 000000000000..fc7800f1743e --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c | |||
@@ -0,0 +1,181 @@ | |||
1 | /* dvb-usb-remote.c is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * This file contains functions for initializing the the input-device and for handling remote-control-queries. | ||
7 | */ | ||
8 | #include "dvb-usb-common.h" | ||
9 | |||
10 | /* Remote-control poll function - called every dib->rc_query_interval ms to see | ||
11 | * whether the remote control has received anything. | ||
12 | * | ||
13 | * TODO: Fix the repeat rate of the input device. | ||
14 | */ | ||
15 | static void dvb_usb_read_remote_control(void *data) | ||
16 | { | ||
17 | struct dvb_usb_device *d = data; | ||
18 | u32 event; | ||
19 | int state; | ||
20 | |||
21 | /* TODO: need a lock here. We can simply skip checking for the remote control | ||
22 | if we're busy. */ | ||
23 | |||
24 | /* when the parameter has been set to 1 via sysfs while the driver was running */ | ||
25 | if (dvb_usb_disable_rc_polling) | ||
26 | return; | ||
27 | |||
28 | if (d->props.rc_query(d,&event,&state)) { | ||
29 | err("error while querying for an remote control event."); | ||
30 | goto schedule; | ||
31 | } | ||
32 | |||
33 | |||
34 | switch (state) { | ||
35 | case REMOTE_NO_KEY_PRESSED: | ||
36 | break; | ||
37 | case REMOTE_KEY_PRESSED: | ||
38 | deb_rc("key pressed\n"); | ||
39 | d->last_event = event; | ||
40 | case REMOTE_KEY_REPEAT: | ||
41 | deb_rc("key repeated\n"); | ||
42 | input_event(&d->rc_input_dev, EV_KEY, d->last_event, 1); | ||
43 | input_event(&d->rc_input_dev, EV_KEY, d->last_event, 0); | ||
44 | input_sync(&d->rc_input_dev); | ||
45 | break; | ||
46 | default: | ||
47 | break; | ||
48 | } | ||
49 | |||
50 | /* improved repeat handling ??? | ||
51 | switch (state) { | ||
52 | case REMOTE_NO_KEY_PRESSED: | ||
53 | deb_rc("NO KEY PRESSED\n"); | ||
54 | if (d->last_state != REMOTE_NO_KEY_PRESSED) { | ||
55 | deb_rc("releasing event %d\n",d->last_event); | ||
56 | input_event(&d->rc_input_dev, EV_KEY, d->last_event, 0); | ||
57 | input_sync(&d->rc_input_dev); | ||
58 | } | ||
59 | d->last_state = REMOTE_NO_KEY_PRESSED; | ||
60 | d->last_event = 0; | ||
61 | break; | ||
62 | case REMOTE_KEY_PRESSED: | ||
63 | deb_rc("KEY PRESSED\n"); | ||
64 | deb_rc("pressing event %d\n",event); | ||
65 | |||
66 | input_event(&d->rc_input_dev, EV_KEY, event, 1); | ||
67 | input_sync(&d->rc_input_dev); | ||
68 | |||
69 | d->last_event = event; | ||
70 | d->last_state = REMOTE_KEY_PRESSED; | ||
71 | break; | ||
72 | case REMOTE_KEY_REPEAT: | ||
73 | deb_rc("KEY_REPEAT\n"); | ||
74 | if (d->last_state != REMOTE_NO_KEY_PRESSED) { | ||
75 | deb_rc("repeating event %d\n",d->last_event); | ||
76 | input_event(&d->rc_input_dev, EV_KEY, d->last_event, 2); | ||
77 | input_sync(&d->rc_input_dev); | ||
78 | d->last_state = REMOTE_KEY_REPEAT; | ||
79 | } | ||
80 | default: | ||
81 | break; | ||
82 | } | ||
83 | */ | ||
84 | |||
85 | schedule: | ||
86 | schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc_interval)); | ||
87 | } | ||
88 | |||
89 | int dvb_usb_remote_init(struct dvb_usb_device *d) | ||
90 | { | ||
91 | int i; | ||
92 | if (d->props.rc_key_map == NULL || | ||
93 | d->props.rc_query == NULL || | ||
94 | dvb_usb_disable_rc_polling) | ||
95 | return 0; | ||
96 | |||
97 | /* Initialise the remote-control structures.*/ | ||
98 | init_input_dev(&d->rc_input_dev); | ||
99 | |||
100 | d->rc_input_dev.evbit[0] = BIT(EV_KEY); | ||
101 | d->rc_input_dev.keycodesize = sizeof(unsigned char); | ||
102 | d->rc_input_dev.keycodemax = KEY_MAX; | ||
103 | d->rc_input_dev.name = "IR-receiver inside an USB DVB receiver"; | ||
104 | |||
105 | /* set the bits for the keys */ | ||
106 | deb_rc("key map size: %d\n",d->props.rc_key_map_size); | ||
107 | for (i = 0; i < d->props.rc_key_map_size; i++) { | ||
108 | deb_rc("setting bit for event %d item %d\n",d->props.rc_key_map[i].event, i); | ||
109 | set_bit(d->props.rc_key_map[i].event, d->rc_input_dev.keybit); | ||
110 | } | ||
111 | |||
112 | /* Start the remote-control polling. */ | ||
113 | if (d->props.rc_interval < 40) | ||
114 | d->props.rc_interval = 100; /* default */ | ||
115 | |||
116 | /* setting these two values to non-zero, we have to manage key repeats */ | ||
117 | d->rc_input_dev.rep[REP_PERIOD] = d->props.rc_interval; | ||
118 | d->rc_input_dev.rep[REP_DELAY] = d->props.rc_interval + 150; | ||
119 | |||
120 | input_register_device(&d->rc_input_dev); | ||
121 | |||
122 | INIT_WORK(&d->rc_query_work, dvb_usb_read_remote_control, d); | ||
123 | |||
124 | info("schedule remote query interval to %d msecs.",d->props.rc_interval); | ||
125 | schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc_interval)); | ||
126 | |||
127 | d->state |= DVB_USB_STATE_REMOTE; | ||
128 | |||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | int dvb_usb_remote_exit(struct dvb_usb_device *d) | ||
133 | { | ||
134 | if (d->state & DVB_USB_STATE_REMOTE) { | ||
135 | cancel_delayed_work(&d->rc_query_work); | ||
136 | flush_scheduled_work(); | ||
137 | input_unregister_device(&d->rc_input_dev); | ||
138 | } | ||
139 | d->state &= ~DVB_USB_STATE_REMOTE; | ||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | #define DVB_USB_RC_NEC_EMPTY 0x00 | ||
144 | #define DVB_USB_RC_NEC_KEY_PRESSED 0x01 | ||
145 | #define DVB_USB_RC_NEC_KEY_REPEATED 0x02 | ||
146 | int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d, | ||
147 | u8 keybuf[5], u32 *event, int *state) | ||
148 | { | ||
149 | int i; | ||
150 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | ||
151 | *event = 0; | ||
152 | *state = REMOTE_NO_KEY_PRESSED; | ||
153 | switch (keybuf[0]) { | ||
154 | case DVB_USB_RC_NEC_EMPTY: | ||
155 | break; | ||
156 | case DVB_USB_RC_NEC_KEY_PRESSED: | ||
157 | if ((u8) ~keybuf[1] != keybuf[2] || | ||
158 | (u8) ~keybuf[3] != keybuf[4]) { | ||
159 | deb_err("remote control checksum failed.\n"); | ||
160 | break; | ||
161 | } | ||
162 | /* See if we can match the raw key code. */ | ||
163 | for (i = 0; i < d->props.rc_key_map_size; i++) | ||
164 | if (keymap[i].custom == keybuf[1] && | ||
165 | keymap[i].data == keybuf[3]) { | ||
166 | *event = keymap[i].event; | ||
167 | *state = REMOTE_KEY_PRESSED; | ||
168 | return 0; | ||
169 | } | ||
170 | deb_err("key mapping failed - no appropriate key found in keymapping\n"); | ||
171 | break; | ||
172 | case DVB_USB_RC_NEC_KEY_REPEATED: | ||
173 | *state = REMOTE_KEY_REPEAT; | ||
174 | break; | ||
175 | default: | ||
176 | deb_err("unkown type of remote status: %d\n",keybuf[0]); | ||
177 | break; | ||
178 | } | ||
179 | return 0; | ||
180 | } | ||
181 | EXPORT_SYMBOL(dvb_usb_nec_rc_key_to_event); | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c new file mode 100644 index 000000000000..f5799a4c228e --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c | |||
@@ -0,0 +1,325 @@ | |||
1 | /* dvb-usb-urb.c is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * This file contains functions for initializing and handling the | ||
7 | * USB and URB stuff. | ||
8 | */ | ||
9 | #include "dvb-usb-common.h" | ||
10 | |||
11 | int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf, | ||
12 | u16 rlen, int delay_ms) | ||
13 | { | ||
14 | int actlen,ret = -ENOMEM; | ||
15 | |||
16 | if (d->props.generic_bulk_ctrl_endpoint == 0) { | ||
17 | err("endpoint for generic control not specified."); | ||
18 | return -EINVAL; | ||
19 | } | ||
20 | |||
21 | if (wbuf == NULL || wlen == 0) | ||
22 | return -EINVAL; | ||
23 | |||
24 | if ((ret = down_interruptible(&d->usb_sem))) | ||
25 | return ret; | ||
26 | |||
27 | deb_xfer(">>> "); | ||
28 | debug_dump(wbuf,wlen,deb_xfer); | ||
29 | |||
30 | ret = usb_bulk_msg(d->udev,usb_sndbulkpipe(d->udev, | ||
31 | d->props.generic_bulk_ctrl_endpoint), wbuf,wlen,&actlen, | ||
32 | 2000); | ||
33 | |||
34 | if (ret) | ||
35 | err("bulk message failed: %d (%d/%d)",ret,wlen,actlen); | ||
36 | else | ||
37 | ret = actlen != wlen ? -1 : 0; | ||
38 | |||
39 | /* an answer is expected, and no error before */ | ||
40 | if (!ret && rbuf && rlen) { | ||
41 | if (delay_ms) | ||
42 | msleep(delay_ms); | ||
43 | |||
44 | ret = usb_bulk_msg(d->udev,usb_rcvbulkpipe(d->udev, | ||
45 | d->props.generic_bulk_ctrl_endpoint),rbuf,rlen,&actlen, | ||
46 | 2000); | ||
47 | |||
48 | if (ret) | ||
49 | err("recv bulk message failed: %d",ret); | ||
50 | else { | ||
51 | deb_xfer("<<< "); | ||
52 | debug_dump(rbuf,actlen,deb_xfer); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | up(&d->usb_sem); | ||
57 | return ret; | ||
58 | } | ||
59 | EXPORT_SYMBOL(dvb_usb_generic_rw); | ||
60 | |||
61 | int dvb_usb_generic_write(struct dvb_usb_device *d, u8 *buf, u16 len) | ||
62 | { | ||
63 | return dvb_usb_generic_rw(d,buf,len,NULL,0,0); | ||
64 | } | ||
65 | EXPORT_SYMBOL(dvb_usb_generic_write); | ||
66 | |||
67 | |||
68 | /* URB stuff for streaming */ | ||
69 | static void dvb_usb_urb_complete(struct urb *urb, struct pt_regs *ptregs) | ||
70 | { | ||
71 | struct dvb_usb_device *d = urb->context; | ||
72 | int ptype = usb_pipetype(urb->pipe); | ||
73 | int i; | ||
74 | u8 *b; | ||
75 | |||
76 | deb_ts("'%s' urb completed. feedcount: %d, status: %d, length: %d/%d, pack_num: %d, errors: %d\n", | ||
77 | ptype == PIPE_ISOCHRONOUS ? "isoc" : "bulk", d->feedcount, | ||
78 | urb->status,urb->actual_length,urb->transfer_buffer_length, | ||
79 | urb->number_of_packets,urb->error_count); | ||
80 | |||
81 | switch (urb->status) { | ||
82 | case 0: /* success */ | ||
83 | case -ETIMEDOUT: /* NAK */ | ||
84 | break; | ||
85 | case -ECONNRESET: /* kill */ | ||
86 | case -ENOENT: | ||
87 | case -ESHUTDOWN: | ||
88 | return; | ||
89 | default: /* error */ | ||
90 | deb_ts("urb completition error %d.", urb->status); | ||
91 | break; | ||
92 | } | ||
93 | |||
94 | if (d->feedcount > 0) { | ||
95 | if (d->state & DVB_USB_STATE_DVB) { | ||
96 | switch (ptype) { | ||
97 | case PIPE_ISOCHRONOUS: | ||
98 | b = (u8 *) urb->transfer_buffer; | ||
99 | for (i = 0; i < urb->number_of_packets; i++) { | ||
100 | if (urb->iso_frame_desc[i].status != 0) | ||
101 | deb_ts("iso frame descriptor has an error: %d\n",urb->iso_frame_desc[i].status); | ||
102 | else if (urb->iso_frame_desc[i].actual_length > 0) { | ||
103 | dvb_dmx_swfilter(&d->demux,b + urb->iso_frame_desc[i].offset, | ||
104 | urb->iso_frame_desc[i].actual_length); | ||
105 | } | ||
106 | urb->iso_frame_desc[i].status = 0; | ||
107 | urb->iso_frame_desc[i].actual_length = 0; | ||
108 | } | ||
109 | debug_dump(b,20,deb_ts); | ||
110 | break; | ||
111 | case PIPE_BULK: | ||
112 | if (urb->actual_length > 0) | ||
113 | dvb_dmx_swfilter(&d->demux, (u8 *) urb->transfer_buffer,urb->actual_length); | ||
114 | break; | ||
115 | default: | ||
116 | err("unkown endpoint type in completition handler."); | ||
117 | return; | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | |||
122 | usb_submit_urb(urb,GFP_ATOMIC); | ||
123 | } | ||
124 | |||
125 | int dvb_usb_urb_kill(struct dvb_usb_device *d) | ||
126 | { | ||
127 | int i; | ||
128 | for (i = 0; i < d->urbs_submitted; i++) { | ||
129 | deb_ts("killing URB no. %d.\n",i); | ||
130 | |||
131 | /* stop the URB */ | ||
132 | usb_kill_urb(d->urb_list[i]); | ||
133 | } | ||
134 | d->urbs_submitted = 0; | ||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | int dvb_usb_urb_submit(struct dvb_usb_device *d) | ||
139 | { | ||
140 | int i,ret; | ||
141 | for (i = 0; i < d->urbs_initialized; i++) { | ||
142 | deb_ts("submitting URB no. %d\n",i); | ||
143 | if ((ret = usb_submit_urb(d->urb_list[i],GFP_ATOMIC))) { | ||
144 | err("could not submit URB no. %d - get them all back",i); | ||
145 | dvb_usb_urb_kill(d); | ||
146 | return ret; | ||
147 | } | ||
148 | d->urbs_submitted++; | ||
149 | } | ||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static int dvb_usb_free_stream_buffers(struct dvb_usb_device *d) | ||
154 | { | ||
155 | if (d->state & DVB_USB_STATE_URB_BUF) { | ||
156 | while (d->buf_num) { | ||
157 | d->buf_num--; | ||
158 | deb_mem("freeing buffer %d\n",d->buf_num); | ||
159 | usb_buffer_free(d->udev, d->buf_size, | ||
160 | d->buf_list[d->buf_num], d->dma_addr[d->buf_num]); | ||
161 | } | ||
162 | kfree(d->buf_list); | ||
163 | kfree(d->dma_addr); | ||
164 | } | ||
165 | |||
166 | d->state &= ~DVB_USB_STATE_URB_BUF; | ||
167 | |||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static int dvb_usb_allocate_stream_buffers(struct dvb_usb_device *d, int num, unsigned long size) | ||
172 | { | ||
173 | d->buf_num = 0; | ||
174 | d->buf_size = size; | ||
175 | |||
176 | deb_mem("all in all I will use %lu bytes for streaming\n",num*size); | ||
177 | |||
178 | if ((d->buf_list = kmalloc(num*sizeof(u8 *), GFP_ATOMIC)) == NULL) | ||
179 | return -ENOMEM; | ||
180 | |||
181 | if ((d->dma_addr = kmalloc(num*sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) { | ||
182 | kfree(d->buf_list); | ||
183 | return -ENOMEM; | ||
184 | } | ||
185 | memset(d->buf_list,0,num*sizeof(u8 *)); | ||
186 | memset(d->dma_addr,0,num*sizeof(dma_addr_t)); | ||
187 | |||
188 | d->state |= DVB_USB_STATE_URB_BUF; | ||
189 | |||
190 | for (d->buf_num = 0; d->buf_num < num; d->buf_num++) { | ||
191 | deb_mem("allocating buffer %d\n",d->buf_num); | ||
192 | if (( d->buf_list[d->buf_num] = | ||
193 | usb_buffer_alloc(d->udev, size, SLAB_ATOMIC, | ||
194 | &d->dma_addr[d->buf_num]) ) == NULL) { | ||
195 | deb_mem("not enough memory for urb-buffer allocation.\n"); | ||
196 | dvb_usb_free_stream_buffers(d); | ||
197 | return -ENOMEM; | ||
198 | } | ||
199 | deb_mem("buffer %d: %p (dma: %d)\n",d->buf_num,d->buf_list[d->buf_num],d->dma_addr[d->buf_num]); | ||
200 | memset(d->buf_list[d->buf_num],0,size); | ||
201 | } | ||
202 | deb_mem("allocation successful\n"); | ||
203 | |||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | static int dvb_usb_bulk_urb_init(struct dvb_usb_device *d) | ||
208 | { | ||
209 | int i; | ||
210 | |||
211 | if ((i = dvb_usb_allocate_stream_buffers(d,d->props.urb.count, | ||
212 | d->props.urb.u.bulk.buffersize)) < 0) | ||
213 | return i; | ||
214 | |||
215 | /* allocate the URBs */ | ||
216 | for (i = 0; i < d->props.urb.count; i++) { | ||
217 | if ((d->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC)) == NULL) | ||
218 | return -ENOMEM; | ||
219 | |||
220 | usb_fill_bulk_urb( d->urb_list[i], d->udev, | ||
221 | usb_rcvbulkpipe(d->udev,d->props.urb.endpoint), | ||
222 | d->buf_list[i], | ||
223 | d->props.urb.u.bulk.buffersize, | ||
224 | dvb_usb_urb_complete, d); | ||
225 | |||
226 | d->urb_list[i]->transfer_flags = 0; | ||
227 | d->urbs_initialized++; | ||
228 | } | ||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | static int dvb_usb_isoc_urb_init(struct dvb_usb_device *d) | ||
233 | { | ||
234 | int i,j; | ||
235 | |||
236 | if ((i = dvb_usb_allocate_stream_buffers(d,d->props.urb.count, | ||
237 | d->props.urb.u.isoc.framesize*d->props.urb.u.isoc.framesperurb)) < 0) | ||
238 | return i; | ||
239 | |||
240 | /* allocate the URBs */ | ||
241 | for (i = 0; i < d->props.urb.count; i++) { | ||
242 | struct urb *urb; | ||
243 | int frame_offset = 0; | ||
244 | if ((d->urb_list[i] = | ||
245 | usb_alloc_urb(d->props.urb.u.isoc.framesperurb,GFP_ATOMIC)) == NULL) | ||
246 | return -ENOMEM; | ||
247 | |||
248 | urb = d->urb_list[i]; | ||
249 | |||
250 | urb->dev = d->udev; | ||
251 | urb->context = d; | ||
252 | urb->complete = dvb_usb_urb_complete; | ||
253 | urb->pipe = usb_rcvisocpipe(d->udev,d->props.urb.endpoint); | ||
254 | urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; | ||
255 | urb->interval = d->props.urb.u.isoc.interval; | ||
256 | urb->number_of_packets = d->props.urb.u.isoc.framesperurb; | ||
257 | urb->transfer_buffer_length = d->buf_size; | ||
258 | urb->transfer_buffer = d->buf_list[i]; | ||
259 | urb->transfer_dma = d->dma_addr[i]; | ||
260 | |||
261 | for (j = 0; j < d->props.urb.u.isoc.framesperurb; j++) { | ||
262 | urb->iso_frame_desc[j].offset = frame_offset; | ||
263 | urb->iso_frame_desc[j].length = d->props.urb.u.isoc.framesize; | ||
264 | frame_offset += d->props.urb.u.isoc.framesize; | ||
265 | } | ||
266 | |||
267 | d->urbs_initialized++; | ||
268 | } | ||
269 | return 0; | ||
270 | |||
271 | } | ||
272 | |||
273 | int dvb_usb_urb_init(struct dvb_usb_device *d) | ||
274 | { | ||
275 | /* | ||
276 | * when reloading the driver w/o replugging the device | ||
277 | * sometimes a timeout occures, this helps | ||
278 | */ | ||
279 | if (d->props.generic_bulk_ctrl_endpoint != 0) { | ||
280 | usb_clear_halt(d->udev,usb_sndbulkpipe(d->udev,d->props.generic_bulk_ctrl_endpoint)); | ||
281 | usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.generic_bulk_ctrl_endpoint)); | ||
282 | } | ||
283 | usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.urb.endpoint)); | ||
284 | |||
285 | /* allocate the array for the data transfer URBs */ | ||
286 | d->urb_list = kmalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL); | ||
287 | if (d->urb_list == NULL) | ||
288 | return -ENOMEM; | ||
289 | memset(d->urb_list,0,d->props.urb.count * sizeof(struct urb *)); | ||
290 | d->state |= DVB_USB_STATE_URB_LIST; | ||
291 | |||
292 | switch (d->props.urb.type) { | ||
293 | case DVB_USB_BULK: | ||
294 | return dvb_usb_bulk_urb_init(d); | ||
295 | case DVB_USB_ISOC: | ||
296 | return dvb_usb_isoc_urb_init(d); | ||
297 | default: | ||
298 | err("unkown URB-type for data transfer."); | ||
299 | return -EINVAL; | ||
300 | } | ||
301 | } | ||
302 | |||
303 | int dvb_usb_urb_exit(struct dvb_usb_device *d) | ||
304 | { | ||
305 | int i; | ||
306 | |||
307 | dvb_usb_urb_kill(d); | ||
308 | |||
309 | if (d->state & DVB_USB_STATE_URB_LIST) { | ||
310 | for (i = 0; i < d->urbs_initialized; i++) { | ||
311 | if (d->urb_list[i] != NULL) { | ||
312 | deb_mem("freeing URB no. %d.\n",i); | ||
313 | /* free the URBs */ | ||
314 | usb_free_urb(d->urb_list[i]); | ||
315 | } | ||
316 | } | ||
317 | d->urbs_initialized = 0; | ||
318 | /* free the urb array */ | ||
319 | kfree(d->urb_list); | ||
320 | d->state &= ~DVB_USB_STATE_URB_LIST; | ||
321 | } | ||
322 | |||
323 | dvb_usb_free_stream_buffers(d); | ||
324 | return 0; | ||
325 | } | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h new file mode 100644 index 000000000000..a80567caf508 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h | |||
@@ -0,0 +1,329 @@ | |||
1 | /* dvb-usb.h is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * the headerfile, all dvb-usb-drivers have to include. | ||
7 | */ | ||
8 | #ifndef __DVB_USB_H__ | ||
9 | #define __DVB_USB_H__ | ||
10 | |||
11 | #include <linux/config.h> | ||
12 | #include <linux/input.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/usb.h> | ||
15 | |||
16 | #include "dvb_frontend.h" | ||
17 | #include "dvb_demux.h" | ||
18 | #include "dvb_net.h" | ||
19 | #include "dmxdev.h" | ||
20 | |||
21 | #include "dvb-pll.h" | ||
22 | |||
23 | #include "dvb-usb-ids.h" | ||
24 | |||
25 | /* debug */ | ||
26 | #ifdef CONFIG_DVB_USB_DEBUG | ||
27 | #define dprintk(var,level,args...) \ | ||
28 | do { if ((var & level)) { printk(args); } } while (0) | ||
29 | |||
30 | #define debug_dump(b,l,func) {\ | ||
31 | int loop_; \ | ||
32 | for (loop_ = 0; loop_ < l; loop_++) func("%02x ", b[loop_]); \ | ||
33 | func("\n");\ | ||
34 | } | ||
35 | #define DVB_USB_DEBUG_STATUS | ||
36 | #else | ||
37 | #define dprintk(args...) | ||
38 | #define debug_dump(b,l,func) | ||
39 | |||
40 | #define DVB_USB_DEBUG_STATUS " (debugging is not enabled)" | ||
41 | |||
42 | #endif | ||
43 | |||
44 | /* generic log methods - taken from usb.h */ | ||
45 | #ifndef DVB_USB_LOG_PREFIX | ||
46 | #define DVB_USB_LOG_PREFIX "dvb-usb (please define a log prefix)" | ||
47 | #endif | ||
48 | |||
49 | #undef err | ||
50 | #define err(format, arg...) printk(KERN_ERR DVB_USB_LOG_PREFIX ": " format "\n" , ## arg) | ||
51 | #undef info | ||
52 | #define info(format, arg...) printk(KERN_INFO DVB_USB_LOG_PREFIX ": " format "\n" , ## arg) | ||
53 | #undef warn | ||
54 | #define warn(format, arg...) printk(KERN_WARNING DVB_USB_LOG_PREFIX ": " format "\n" , ## arg) | ||
55 | |||
56 | /** | ||
57 | * struct dvb_usb_device_description - name and its according USB IDs | ||
58 | * @name: real name of the box, regardless which DVB USB device class is in use | ||
59 | * @cold_ids: array of struct usb_device_id which describe the device in | ||
60 | * pre-firmware state | ||
61 | * @warm_ids: array of struct usb_device_id which describe the device in | ||
62 | * post-firmware state | ||
63 | * | ||
64 | * Each DVB USB device class can have one or more actual devices, this struct | ||
65 | * assigns a name to it. | ||
66 | */ | ||
67 | struct dvb_usb_device_description { | ||
68 | const char *name; | ||
69 | |||
70 | #define DVB_USB_ID_MAX_NUM 15 | ||
71 | struct usb_device_id *cold_ids[DVB_USB_ID_MAX_NUM]; | ||
72 | struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM]; | ||
73 | }; | ||
74 | |||
75 | /** | ||
76 | * struct dvb_usb_rc_key - a remote control key and its input-event | ||
77 | * @custom: the vendor/custom part of the key | ||
78 | * @data: the actual key part | ||
79 | * @event: the input event assigned to key identified by custom and data | ||
80 | */ | ||
81 | struct dvb_usb_rc_key { | ||
82 | u8 custom,data; | ||
83 | u32 event; | ||
84 | }; | ||
85 | |||
86 | struct dvb_usb_device; | ||
87 | |||
88 | /** | ||
89 | * struct dvb_usb_properties - properties of a dvb-usb-device | ||
90 | * @caps: capabilites of the DVB USB device. | ||
91 | * @pid_filter_count: number of PID filter position in the optional hardware | ||
92 | * PID-filter. | ||
93 | * | ||
94 | * @usb_ctrl: which USB device-side controller is in use. Needed for firmware | ||
95 | * download. | ||
96 | * @firmware: name of the firmware file. | ||
97 | * | ||
98 | * @size_of_priv: how many bytes shall be allocated for the private field | ||
99 | * of struct dvb_usb_device. | ||
100 | * | ||
101 | * @power_ctrl: called to enable/disable power of the device. | ||
102 | * @streaming_crtl: called to start and stop the MPEG2-TS streaming of the | ||
103 | * device (not URB submitting/killing). | ||
104 | * @pid_filter_ctrl: called to en/disable the PID filter, if any. | ||
105 | * @pid_filter: called to set/unset a PID for filtering. | ||
106 | * | ||
107 | * @read_mac_address: called to read the MAC address of the device. | ||
108 | * | ||
109 | * @frontend_attach: called to attach the possible frontends (fill fe-field | ||
110 | * of struct dvb_usb_device). | ||
111 | * @tuner_attach: called to attach the correct tuner and to fill pll_addr, | ||
112 | * pll_desc and pll_init_buf of struct dvb_usb_device). | ||
113 | * @identify_state: called to determine the state (cold or warm), when it | ||
114 | * is not distinguishable by the USB IDs. | ||
115 | * | ||
116 | * @rc_key_map: a hard-wired array of struct dvb_usb_rc_key (NULL to disable | ||
117 | * remote control handling). | ||
118 | * @rc_key_map_size: number of items in @rc_key_map. | ||
119 | * @rc_query: called to query an event event. | ||
120 | * @rc_interval: time in ms between two queries. | ||
121 | * | ||
122 | * @i2c_algo: i2c_algorithm if the device has I2CoverUSB. | ||
123 | * | ||
124 | * @generic_bulk_ctrl_endpoint: most of the DVB USB devices have a generic | ||
125 | * endpoint which received control messages with bulk transfers. When this | ||
126 | * is non-zero, one can use dvb_usb_generic_rw and dvb_usb_generic_write- | ||
127 | * helper functions. | ||
128 | * | ||
129 | * @urb: describes the kind of USB transfer used for MPEG2-TS-streaming. | ||
130 | * Currently only BULK is implemented | ||
131 | * | ||
132 | * @num_device_descs: number of struct dvb_usb_device_description in @devices | ||
133 | * @devices: array of struct dvb_usb_device_description compatibles with these | ||
134 | * properties. | ||
135 | */ | ||
136 | struct dvb_usb_properties { | ||
137 | |||
138 | #define DVB_USB_HAS_PID_FILTER 0x01 | ||
139 | #define DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF 0x02 | ||
140 | #define DVB_USB_NEED_PID_FILTERING 0x04 | ||
141 | #define DVB_USB_IS_AN_I2C_ADAPTER 0x08 | ||
142 | int caps; | ||
143 | int pid_filter_count; | ||
144 | |||
145 | #define CYPRESS_AN2135 0 | ||
146 | #define CYPRESS_AN2235 1 | ||
147 | #define CYPRESS_FX2 2 | ||
148 | int usb_ctrl; | ||
149 | const char *firmware; | ||
150 | |||
151 | int size_of_priv; | ||
152 | |||
153 | int (*power_ctrl) (struct dvb_usb_device *, int); | ||
154 | int (*streaming_ctrl) (struct dvb_usb_device *, int); | ||
155 | int (*pid_filter_ctrl) (struct dvb_usb_device *, int); | ||
156 | int (*pid_filter) (struct dvb_usb_device *, int, u16, int); | ||
157 | |||
158 | int (*read_mac_address) (struct dvb_usb_device *, u8 []); | ||
159 | int (*frontend_attach) (struct dvb_usb_device *); | ||
160 | int (*tuner_attach) (struct dvb_usb_device *); | ||
161 | |||
162 | int (*identify_state) (struct usb_device *, struct dvb_usb_properties *, | ||
163 | struct dvb_usb_device_description **, int *); | ||
164 | |||
165 | /* remote control properties */ | ||
166 | #define REMOTE_NO_KEY_PRESSED 0x00 | ||
167 | #define REMOTE_KEY_PRESSED 0x01 | ||
168 | #define REMOTE_KEY_REPEAT 0x02 | ||
169 | struct dvb_usb_rc_key *rc_key_map; | ||
170 | int rc_key_map_size; | ||
171 | int (*rc_query) (struct dvb_usb_device *, u32 *, int *); | ||
172 | int rc_interval; | ||
173 | |||
174 | struct i2c_algorithm *i2c_algo; | ||
175 | |||
176 | int generic_bulk_ctrl_endpoint; | ||
177 | |||
178 | struct { | ||
179 | #define DVB_USB_BULK 1 | ||
180 | #define DVB_USB_ISOC 2 | ||
181 | int type; | ||
182 | int count; | ||
183 | int endpoint; | ||
184 | |||
185 | union { | ||
186 | struct { | ||
187 | int buffersize; /* per URB */ | ||
188 | } bulk; | ||
189 | struct { | ||
190 | int framesperurb; | ||
191 | int framesize; | ||
192 | int interval; | ||
193 | } isoc; | ||
194 | } u; | ||
195 | } urb; | ||
196 | |||
197 | int num_device_descs; | ||
198 | struct dvb_usb_device_description devices[9]; | ||
199 | }; | ||
200 | |||
201 | |||
202 | /** | ||
203 | * struct dvb_usb_device - object of a DVB USB device | ||
204 | * @props: copy of the struct dvb_usb_properties this device belongs to. | ||
205 | * @desc: pointer to the device's struct dvb_usb_device_description. | ||
206 | * @state: initialization and runtime state of the device. | ||
207 | * | ||
208 | * @udev: pointer to the device's struct usb_device. | ||
209 | * @urb_list: array of dynamically allocated struct urb for the MPEG2-TS- | ||
210 | * streaming. | ||
211 | * | ||
212 | * @buf_num: number of buffer allocated. | ||
213 | * @buf_size: size of each buffer in buf_list. | ||
214 | * @buf_list: array containing all allocate buffers for streaming. | ||
215 | * @dma_addr: list of dma_addr_t for each buffer in buf_list. | ||
216 | * | ||
217 | * @urbs_initialized: number of URBs initialized. | ||
218 | * @urbs_submitted: number of URBs submitted. | ||
219 | * | ||
220 | * @feedcount: number of reqested feeds (used for streaming-activation) | ||
221 | * @pid_filtering: is hardware pid_filtering used or not. | ||
222 | * | ||
223 | * @usb_sem: semaphore of USB control messages (reading needs two messages) | ||
224 | * @i2c_sem: semaphore for i2c-transfers | ||
225 | * | ||
226 | * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB | ||
227 | * @pll_addr: I2C address of the tuner for programming | ||
228 | * @pll_init: array containing the initialization buffer | ||
229 | * @pll_desc: pointer to the appropriate struct dvb_pll_desc | ||
230 | * | ||
231 | * @tuner_pass_ctrl: called to (de)activate tuner passthru of the demod or the board | ||
232 | * | ||
233 | * @dvb_adap: device's dvb_adapter. | ||
234 | * @dmxdev: device's dmxdev. | ||
235 | * @demux: device's software demuxer. | ||
236 | * @dvb_net: device's dvb_net interfaces. | ||
237 | * @dvb_frontend: device's frontend. | ||
238 | * @max_feed_count: how many feeds can be handled simultaneously by this | ||
239 | * device | ||
240 | * @fe_sleep: rerouted frontend-sleep function. | ||
241 | * @fe_init: rerouted frontend-init (wakeup) function. | ||
242 | * @rc_input_dev: input device for the remote control. | ||
243 | * @rc_query_work: struct work_struct frequent rc queries | ||
244 | * @last_event: last triggered event | ||
245 | * @last_state: last state (no, pressed, repeat) | ||
246 | * @owner: owner of the dvb_adapter | ||
247 | * @priv: private data of the actual driver (allocate by dvb-usb, size defined | ||
248 | * in size_of_priv of dvb_usb_properties). | ||
249 | */ | ||
250 | struct dvb_usb_device { | ||
251 | struct dvb_usb_properties props; | ||
252 | struct dvb_usb_device_description *desc; | ||
253 | |||
254 | #define DVB_USB_STATE_INIT 0x000 | ||
255 | #define DVB_USB_STATE_URB_LIST 0x001 | ||
256 | #define DVB_USB_STATE_URB_BUF 0x002 | ||
257 | #define DVB_USB_STATE_DVB 0x004 | ||
258 | #define DVB_USB_STATE_I2C 0x008 | ||
259 | #define DVB_USB_STATE_REMOTE 0x010 | ||
260 | #define DVB_USB_STATE_URB_SUBMIT 0x020 | ||
261 | int state; | ||
262 | |||
263 | /* usb */ | ||
264 | struct usb_device *udev; | ||
265 | struct urb **urb_list; | ||
266 | |||
267 | int buf_num; | ||
268 | unsigned long buf_size; | ||
269 | u8 **buf_list; | ||
270 | dma_addr_t *dma_addr; | ||
271 | |||
272 | int urbs_initialized; | ||
273 | int urbs_submitted; | ||
274 | |||
275 | int feedcount; | ||
276 | int pid_filtering; | ||
277 | |||
278 | /* locking */ | ||
279 | struct semaphore usb_sem; | ||
280 | |||
281 | /* i2c */ | ||
282 | struct semaphore i2c_sem; | ||
283 | struct i2c_adapter i2c_adap; | ||
284 | |||
285 | /* tuner programming information */ | ||
286 | u8 pll_addr; | ||
287 | u8 pll_init[4]; | ||
288 | struct dvb_pll_desc *pll_desc; | ||
289 | int (*tuner_pass_ctrl)(struct dvb_frontend *, int, u8); | ||
290 | |||
291 | /* dvb */ | ||
292 | struct dvb_adapter dvb_adap; | ||
293 | struct dmxdev dmxdev; | ||
294 | struct dvb_demux demux; | ||
295 | struct dvb_net dvb_net; | ||
296 | struct dvb_frontend* fe; | ||
297 | int max_feed_count; | ||
298 | |||
299 | int (*fe_sleep) (struct dvb_frontend *); | ||
300 | int (*fe_init) (struct dvb_frontend *); | ||
301 | |||
302 | /* remote control */ | ||
303 | struct input_dev rc_input_dev; | ||
304 | struct work_struct rc_query_work; | ||
305 | u32 last_event; | ||
306 | int last_state; | ||
307 | |||
308 | struct module *owner; | ||
309 | |||
310 | void *priv; | ||
311 | }; | ||
312 | |||
313 | extern int dvb_usb_device_init(struct usb_interface *, struct dvb_usb_properties *, struct module *); | ||
314 | extern void dvb_usb_device_exit(struct usb_interface *); | ||
315 | |||
316 | /* the generic read/write method for device control */ | ||
317 | extern int dvb_usb_generic_rw(struct dvb_usb_device *, u8 *, u16, u8 *, u16,int); | ||
318 | extern int dvb_usb_generic_write(struct dvb_usb_device *, u8 *, u16); | ||
319 | |||
320 | /* commonly used remote control parsing */ | ||
321 | extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[], u32 *, int *); | ||
322 | |||
323 | /* commonly used pll init and set functions */ | ||
324 | extern int dvb_usb_pll_init_i2c(struct dvb_frontend *); | ||
325 | extern int dvb_usb_pll_set(struct dvb_frontend *, struct dvb_frontend_parameters *, u8[]); | ||
326 | extern int dvb_usb_pll_set_i2c(struct dvb_frontend *, struct dvb_frontend_parameters *); | ||
327 | |||
328 | |||
329 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c new file mode 100644 index 000000000000..258a92bfbcc7 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c | |||
@@ -0,0 +1,236 @@ | |||
1 | /* DVB USB framework compliant Linux driver for the Hauppauge WinTV-NOVA-T usb2 | ||
2 | * DVB-T receiver. | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation, version 2. | ||
9 | * | ||
10 | * see Documentation/dvb/README.dvb-usb for more information | ||
11 | */ | ||
12 | #include "dibusb.h" | ||
13 | |||
14 | static int debug; | ||
15 | module_param(debug, int, 0644); | ||
16 | MODULE_PARM_DESC(debug, "set debugging level (1=rc,2=eeprom (|-able))." DVB_USB_DEBUG_STATUS); | ||
17 | |||
18 | #define deb_rc(args...) dprintk(debug,0x01,args) | ||
19 | #define deb_ee(args...) dprintk(debug,0x02,args) | ||
20 | |||
21 | /* Hauppauge NOVA-T USB2 keys */ | ||
22 | static struct dvb_usb_rc_key haupp_rc_keys [] = { | ||
23 | { 0x1e, 0x00, KEY_0 }, | ||
24 | { 0x1e, 0x01, KEY_1 }, | ||
25 | { 0x1e, 0x02, KEY_2 }, | ||
26 | { 0x1e, 0x03, KEY_3 }, | ||
27 | { 0x1e, 0x04, KEY_4 }, | ||
28 | { 0x1e, 0x05, KEY_5 }, | ||
29 | { 0x1e, 0x06, KEY_6 }, | ||
30 | { 0x1e, 0x07, KEY_7 }, | ||
31 | { 0x1e, 0x08, KEY_8 }, | ||
32 | { 0x1e, 0x09, KEY_9 }, | ||
33 | { 0x1e, 0x0a, KEY_KPASTERISK }, | ||
34 | { 0x1e, 0x0b, KEY_RED }, | ||
35 | { 0x1e, 0x0c, KEY_RADIO }, | ||
36 | { 0x1e, 0x0d, KEY_MENU }, | ||
37 | { 0x1e, 0x0e, KEY_GRAVE }, /* # */ | ||
38 | { 0x1e, 0x0f, KEY_MUTE }, | ||
39 | { 0x1e, 0x10, KEY_VOLUMEUP }, | ||
40 | { 0x1e, 0x11, KEY_VOLUMEDOWN }, | ||
41 | { 0x1e, 0x12, KEY_CHANNEL }, | ||
42 | { 0x1e, 0x14, KEY_UP }, | ||
43 | { 0x1e, 0x15, KEY_DOWN }, | ||
44 | { 0x1e, 0x16, KEY_LEFT }, | ||
45 | { 0x1e, 0x17, KEY_RIGHT }, | ||
46 | { 0x1e, 0x18, KEY_VIDEO }, | ||
47 | { 0x1e, 0x19, KEY_AUDIO }, | ||
48 | { 0x1e, 0x1a, KEY_MEDIA }, | ||
49 | { 0x1e, 0x1b, KEY_EPG }, | ||
50 | { 0x1e, 0x1c, KEY_TV }, | ||
51 | { 0x1e, 0x1e, KEY_NEXT }, | ||
52 | { 0x1e, 0x1f, KEY_BACK }, | ||
53 | { 0x1e, 0x20, KEY_CHANNELUP }, | ||
54 | { 0x1e, 0x21, KEY_CHANNELDOWN }, | ||
55 | { 0x1e, 0x24, KEY_LAST }, /* Skip backwards */ | ||
56 | { 0x1e, 0x25, KEY_OK }, | ||
57 | { 0x1e, 0x29, KEY_BLUE}, | ||
58 | { 0x1e, 0x2e, KEY_GREEN }, | ||
59 | { 0x1e, 0x30, KEY_PAUSE }, | ||
60 | { 0x1e, 0x32, KEY_REWIND }, | ||
61 | { 0x1e, 0x34, KEY_FASTFORWARD }, | ||
62 | { 0x1e, 0x35, KEY_PLAY }, | ||
63 | { 0x1e, 0x36, KEY_STOP }, | ||
64 | { 0x1e, 0x37, KEY_RECORD }, | ||
65 | { 0x1e, 0x38, KEY_YELLOW }, | ||
66 | { 0x1e, 0x3b, KEY_GOTO }, | ||
67 | { 0x1e, 0x3d, KEY_POWER }, | ||
68 | }; | ||
69 | |||
70 | /* Firmware bug? sometimes, when a new key is pressed, the previous pressed key | ||
71 | * is delivered. No workaround yet, maybe a new firmware. | ||
72 | */ | ||
73 | static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
74 | { | ||
75 | u8 key[5],cmd[2] = { DIBUSB_REQ_POLL_REMOTE, 0x35 }, data,toggle,custom; | ||
76 | u16 raw; | ||
77 | int i; | ||
78 | struct dibusb_state *st = d->priv; | ||
79 | |||
80 | dvb_usb_generic_rw(d,cmd,2,key,5,0); | ||
81 | |||
82 | *state = REMOTE_NO_KEY_PRESSED; | ||
83 | switch (key[0]) { | ||
84 | case DIBUSB_RC_HAUPPAUGE_KEY_PRESSED: | ||
85 | raw = ((key[1] << 8) | key[2]) >> 3; | ||
86 | toggle = !!(raw & 0x800); | ||
87 | data = raw & 0x3f; | ||
88 | custom = (raw >> 6) & 0x1f; | ||
89 | |||
90 | deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to c: %02x d: %02x toggle: %d\n",key[1],key[2],key[3],custom,data,toggle); | ||
91 | |||
92 | for (i = 0; i < ARRAY_SIZE(haupp_rc_keys); i++) { | ||
93 | deb_rc("c: %x, d: %x\n",haupp_rc_keys[i].data,haupp_rc_keys[i].custom); | ||
94 | if (haupp_rc_keys[i].data == data && | ||
95 | haupp_rc_keys[i].custom == custom) { | ||
96 | *event = haupp_rc_keys[i].event; | ||
97 | *state = REMOTE_KEY_PRESSED; | ||
98 | if (st->old_toggle == toggle) { | ||
99 | if (st->last_repeat_count++ < 2) | ||
100 | *state = REMOTE_NO_KEY_PRESSED; | ||
101 | } else { | ||
102 | st->last_repeat_count = 0; | ||
103 | st->old_toggle = toggle; | ||
104 | } | ||
105 | break; | ||
106 | } | ||
107 | } | ||
108 | |||
109 | break; | ||
110 | case DIBUSB_RC_HAUPPAUGE_KEY_EMPTY: | ||
111 | default: | ||
112 | break; | ||
113 | } | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6]) | ||
119 | { | ||
120 | int i; | ||
121 | u8 b; | ||
122 | |||
123 | mac[0] = 0x00; | ||
124 | mac[1] = 0x0d; | ||
125 | mac[2] = 0xfe; | ||
126 | |||
127 | /* this is a complete guess, but works for my box */ | ||
128 | for (i = 136; i < 139; i++) { | ||
129 | dibusb_read_eeprom_byte(d,i, &b); | ||
130 | |||
131 | mac[5 - (i - 136)] = b; | ||
132 | |||
133 | /* deb_ee("%02x ",b); | ||
134 | if ((i+1) % 16 == 0) | ||
135 | deb_ee("\n");*/ | ||
136 | } | ||
137 | |||
138 | return 0; | ||
139 | } | ||
140 | |||
141 | /* USB Driver stuff */ | ||
142 | static struct dvb_usb_properties nova_t_properties; | ||
143 | |||
144 | static int nova_t_probe(struct usb_interface *intf, | ||
145 | const struct usb_device_id *id) | ||
146 | { | ||
147 | return dvb_usb_device_init(intf,&nova_t_properties,THIS_MODULE); | ||
148 | } | ||
149 | |||
150 | /* do not change the order of the ID table */ | ||
151 | static struct usb_device_id nova_t_table [] = { | ||
152 | /* 00 */ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_WINTV_NOVA_T_USB2_COLD) }, | ||
153 | /* 01 */ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_WINTV_NOVA_T_USB2_WARM) }, | ||
154 | { } /* Terminating entry */ | ||
155 | }; | ||
156 | MODULE_DEVICE_TABLE (usb, nova_t_table); | ||
157 | |||
158 | static struct dvb_usb_properties nova_t_properties = { | ||
159 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, | ||
160 | .pid_filter_count = 32, | ||
161 | |||
162 | .usb_ctrl = CYPRESS_FX2, | ||
163 | .firmware = "dvb-usb-nova-t-usb2-01.fw", | ||
164 | |||
165 | .size_of_priv = sizeof(struct dibusb_state), | ||
166 | |||
167 | .streaming_ctrl = dibusb2_0_streaming_ctrl, | ||
168 | .pid_filter = dibusb_pid_filter, | ||
169 | .pid_filter_ctrl = dibusb_pid_filter_ctrl, | ||
170 | .power_ctrl = dibusb2_0_power_ctrl, | ||
171 | .frontend_attach = dibusb_dib3000mc_frontend_attach, | ||
172 | .tuner_attach = dibusb_dib3000mc_tuner_attach, | ||
173 | .read_mac_address = nova_t_read_mac_address, | ||
174 | |||
175 | .rc_interval = 100, | ||
176 | .rc_key_map = haupp_rc_keys, | ||
177 | .rc_key_map_size = ARRAY_SIZE(haupp_rc_keys), | ||
178 | .rc_query = nova_t_rc_query, | ||
179 | |||
180 | .i2c_algo = &dibusb_i2c_algo, | ||
181 | |||
182 | .generic_bulk_ctrl_endpoint = 0x01, | ||
183 | /* parameter for the MPEG2-data transfer */ | ||
184 | .urb = { | ||
185 | .type = DVB_USB_BULK, | ||
186 | .count = 7, | ||
187 | .endpoint = 0x06, | ||
188 | .u = { | ||
189 | .bulk = { | ||
190 | .buffersize = 4096, | ||
191 | } | ||
192 | } | ||
193 | }, | ||
194 | |||
195 | .num_device_descs = 1, | ||
196 | .devices = { | ||
197 | { "Hauppauge WinTV-NOVA-T usb2", | ||
198 | { &nova_t_table[0], NULL }, | ||
199 | { &nova_t_table[1], NULL }, | ||
200 | }, | ||
201 | } | ||
202 | }; | ||
203 | |||
204 | static struct usb_driver nova_t_driver = { | ||
205 | .owner = THIS_MODULE, | ||
206 | .name = "dvb_usb_nova_t_usb2", | ||
207 | .probe = nova_t_probe, | ||
208 | .disconnect = dvb_usb_device_exit, | ||
209 | .id_table = nova_t_table, | ||
210 | }; | ||
211 | |||
212 | /* module stuff */ | ||
213 | static int __init nova_t_module_init(void) | ||
214 | { | ||
215 | int result; | ||
216 | if ((result = usb_register(&nova_t_driver))) { | ||
217 | err("usb_register failed. Error number %d",result); | ||
218 | return result; | ||
219 | } | ||
220 | |||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | static void __exit nova_t_module_exit(void) | ||
225 | { | ||
226 | /* deregister this driver from the USB subsystem */ | ||
227 | usb_deregister(&nova_t_driver); | ||
228 | } | ||
229 | |||
230 | module_init (nova_t_module_init); | ||
231 | module_exit (nova_t_module_exit); | ||
232 | |||
233 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
234 | MODULE_DESCRIPTION("Hauppauge WinTV-NOVA-T usb2"); | ||
235 | MODULE_VERSION("1.0"); | ||
236 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/umt-010.c b/drivers/media/dvb/dvb-usb/umt-010.c new file mode 100644 index 000000000000..2112ac3cf5e2 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/umt-010.c | |||
@@ -0,0 +1,162 @@ | |||
1 | /* DVB USB framework compliant Linux driver for the HanfTek UMT-010 USB2.0 | ||
2 | * DVB-T receiver. | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation, version 2. | ||
9 | * | ||
10 | * see Documentation/dvb/README.dvb-usb for more information | ||
11 | */ | ||
12 | #include "dibusb.h" | ||
13 | |||
14 | #include "mt352.h" | ||
15 | |||
16 | static int umt_mt352_demod_init(struct dvb_frontend *fe) | ||
17 | { | ||
18 | static u8 mt352_clock_config[] = { 0x89, 0xb8, 0x2d }; | ||
19 | static u8 mt352_reset[] = { 0x50, 0x80 }; | ||
20 | static u8 mt352_mclk_ratio[] = { 0x8b, 0x00 }; | ||
21 | static u8 mt352_adc_ctl_1_cfg[] = { 0x8E, 0x40 }; | ||
22 | static u8 mt352_agc_cfg[] = { 0x67, 0x10, 0xa0 }; | ||
23 | |||
24 | static u8 mt352_sec_agc_cfg1[] = { 0x6a, 0xff }; | ||
25 | static u8 mt352_sec_agc_cfg2[] = { 0x6d, 0xff }; | ||
26 | static u8 mt352_sec_agc_cfg3[] = { 0x70, 0x40 }; | ||
27 | static u8 mt352_sec_agc_cfg4[] = { 0x7b, 0x03 }; | ||
28 | static u8 mt352_sec_agc_cfg5[] = { 0x7d, 0x0f }; | ||
29 | |||
30 | static u8 mt352_acq_ctl[] = { 0x53, 0x50 }; | ||
31 | static u8 mt352_input_freq_1[] = { 0x56, 0x31, 0x06 }; | ||
32 | |||
33 | mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config)); | ||
34 | udelay(2000); | ||
35 | mt352_write(fe, mt352_reset, sizeof(mt352_reset)); | ||
36 | mt352_write(fe, mt352_mclk_ratio, sizeof(mt352_mclk_ratio)); | ||
37 | |||
38 | mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg)); | ||
39 | mt352_write(fe, mt352_agc_cfg, sizeof(mt352_agc_cfg)); | ||
40 | |||
41 | mt352_write(fe, mt352_sec_agc_cfg1, sizeof(mt352_sec_agc_cfg1)); | ||
42 | mt352_write(fe, mt352_sec_agc_cfg2, sizeof(mt352_sec_agc_cfg2)); | ||
43 | mt352_write(fe, mt352_sec_agc_cfg3, sizeof(mt352_sec_agc_cfg3)); | ||
44 | mt352_write(fe, mt352_sec_agc_cfg4, sizeof(mt352_sec_agc_cfg4)); | ||
45 | mt352_write(fe, mt352_sec_agc_cfg5, sizeof(mt352_sec_agc_cfg5)); | ||
46 | |||
47 | mt352_write(fe, mt352_acq_ctl, sizeof(mt352_acq_ctl)); | ||
48 | mt352_write(fe, mt352_input_freq_1, sizeof(mt352_input_freq_1)); | ||
49 | |||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | static int umt_mt352_frontend_attach(struct dvb_usb_device *d) | ||
54 | { | ||
55 | struct mt352_config umt_config; | ||
56 | |||
57 | memset(&umt_config,0,sizeof(struct mt352_config)); | ||
58 | umt_config.demod_init = umt_mt352_demod_init; | ||
59 | umt_config.demod_address = 0xf; | ||
60 | umt_config.pll_set = dvb_usb_pll_set; | ||
61 | |||
62 | d->fe = mt352_attach(&umt_config, &d->i2c_adap); | ||
63 | |||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static int umt_tuner_attach (struct dvb_usb_device *d) | ||
68 | { | ||
69 | d->pll_addr = 0x61; | ||
70 | d->pll_desc = &dvb_pll_tua6034; | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | /* USB Driver stuff */ | ||
75 | static struct dvb_usb_properties umt_properties; | ||
76 | |||
77 | static int umt_probe(struct usb_interface *intf, | ||
78 | const struct usb_device_id *id) | ||
79 | { | ||
80 | if (dvb_usb_device_init(intf,&umt_properties,THIS_MODULE) == 0) | ||
81 | return 0; | ||
82 | return -EINVAL; | ||
83 | } | ||
84 | |||
85 | /* do not change the order of the ID table */ | ||
86 | static struct usb_device_id umt_table [] = { | ||
87 | /* 00 */ { USB_DEVICE(USB_VID_HANFTEK, USB_PID_HANFTEK_UMT_010_COLD) }, | ||
88 | /* 01 */ { USB_DEVICE(USB_VID_HANFTEK, USB_PID_HANFTEK_UMT_010_WARM) }, | ||
89 | { } /* Terminating entry */ | ||
90 | }; | ||
91 | MODULE_DEVICE_TABLE (usb, umt_table); | ||
92 | |||
93 | static struct dvb_usb_properties umt_properties = { | ||
94 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
95 | |||
96 | .usb_ctrl = CYPRESS_FX2, | ||
97 | .firmware = "dvb-usb-umt-010-02.fw", | ||
98 | |||
99 | .size_of_priv = sizeof(struct dibusb_state), | ||
100 | |||
101 | .streaming_ctrl = dibusb2_0_streaming_ctrl, | ||
102 | .power_ctrl = dibusb_power_ctrl, | ||
103 | .frontend_attach = umt_mt352_frontend_attach, | ||
104 | .tuner_attach = umt_tuner_attach, | ||
105 | |||
106 | .i2c_algo = &dibusb_i2c_algo, | ||
107 | |||
108 | .generic_bulk_ctrl_endpoint = 0x01, | ||
109 | /* parameter for the MPEG2-data transfer */ | ||
110 | .urb = { | ||
111 | .type = DVB_USB_BULK, | ||
112 | .count = 20, | ||
113 | .endpoint = 0x06, | ||
114 | .u = { | ||
115 | .bulk = { | ||
116 | .buffersize = 512, | ||
117 | } | ||
118 | } | ||
119 | }, | ||
120 | |||
121 | .num_device_descs = 1, | ||
122 | .devices = { | ||
123 | { "Hanftek UMT-010 DVB-T USB2.0", | ||
124 | { &umt_table[0], NULL }, | ||
125 | { &umt_table[1], NULL }, | ||
126 | }, | ||
127 | } | ||
128 | }; | ||
129 | |||
130 | static struct usb_driver umt_driver = { | ||
131 | .owner = THIS_MODULE, | ||
132 | .name = "dvb_usb_umt_010", | ||
133 | .probe = umt_probe, | ||
134 | .disconnect = dvb_usb_device_exit, | ||
135 | .id_table = umt_table, | ||
136 | }; | ||
137 | |||
138 | /* module stuff */ | ||
139 | static int __init umt_module_init(void) | ||
140 | { | ||
141 | int result; | ||
142 | if ((result = usb_register(&umt_driver))) { | ||
143 | err("usb_register failed. Error number %d",result); | ||
144 | return result; | ||
145 | } | ||
146 | |||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | static void __exit umt_module_exit(void) | ||
151 | { | ||
152 | /* deregister this driver from the USB subsystem */ | ||
153 | usb_deregister(&umt_driver); | ||
154 | } | ||
155 | |||
156 | module_init (umt_module_init); | ||
157 | module_exit (umt_module_exit); | ||
158 | |||
159 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
160 | MODULE_DESCRIPTION("Driver for HanfTek UMT 010 USB2.0 DVB-T device"); | ||
161 | MODULE_VERSION("1.0"); | ||
162 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/vp7045-fe.c b/drivers/media/dvb/dvb-usb/vp7045-fe.c new file mode 100644 index 000000000000..2746edfeccba --- /dev/null +++ b/drivers/media/dvb/dvb-usb/vp7045-fe.c | |||
@@ -0,0 +1,196 @@ | |||
1 | /* DVB frontend part of the Linux driver for TwinhanDTV Alpha/MagicBoxII USB2.0 | ||
2 | * DVB-T receiver. | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * Thanks to Twinhan who kindly provided hardware and information. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the Free | ||
10 | * Software Foundation, version 2. | ||
11 | * | ||
12 | * see Documentation/dvb/README.dvb-usb for more information | ||
13 | * | ||
14 | */ | ||
15 | #include "vp7045.h" | ||
16 | |||
17 | /* It is a Zarlink MT352 within a Samsung Tuner (DNOS404ZH102A) - 040929 - AAT | ||
18 | * | ||
19 | * Programming is hidden inside the firmware, so set_frontend is very easy. | ||
20 | * Even though there is a Firmware command that one can use to access the demod | ||
21 | * via its registers. This is used for status information. | ||
22 | */ | ||
23 | |||
24 | struct vp7045_fe_state { | ||
25 | struct dvb_frontend fe; | ||
26 | struct dvb_usb_device *d; | ||
27 | }; | ||
28 | |||
29 | |||
30 | static int vp7045_fe_read_status(struct dvb_frontend* fe, fe_status_t *status) | ||
31 | { | ||
32 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
33 | u8 s0 = vp7045_read_reg(state->d,0x00), | ||
34 | s1 = vp7045_read_reg(state->d,0x01), | ||
35 | s3 = vp7045_read_reg(state->d,0x03); | ||
36 | |||
37 | *status = 0; | ||
38 | if (s0 & (1 << 4)) | ||
39 | *status |= FE_HAS_CARRIER; | ||
40 | if (s0 & (1 << 1)) | ||
41 | *status |= FE_HAS_VITERBI; | ||
42 | if (s0 & (1 << 5)) | ||
43 | *status |= FE_HAS_LOCK; | ||
44 | if (s1 & (1 << 1)) | ||
45 | *status |= FE_HAS_SYNC; | ||
46 | if (s3 & (1 << 6)) | ||
47 | *status |= FE_HAS_SIGNAL; | ||
48 | |||
49 | if ((*status & (FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC)) != | ||
50 | (FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC)) | ||
51 | *status &= ~FE_HAS_LOCK; | ||
52 | |||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | static int vp7045_fe_read_ber(struct dvb_frontend* fe, u32 *ber) | ||
57 | { | ||
58 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
59 | *ber = (vp7045_read_reg(state->d, 0x0D) << 16) | | ||
60 | (vp7045_read_reg(state->d, 0x0E) << 8) | | ||
61 | vp7045_read_reg(state->d, 0x0F); | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | static int vp7045_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | ||
66 | { | ||
67 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
68 | *unc = (vp7045_read_reg(state->d, 0x10) << 8) | | ||
69 | vp7045_read_reg(state->d, 0x11); | ||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static int vp7045_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength) | ||
74 | { | ||
75 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
76 | u16 signal = (vp7045_read_reg(state->d, 0x14) << 8) | | ||
77 | vp7045_read_reg(state->d, 0x15); | ||
78 | |||
79 | *strength = ~signal; | ||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static int vp7045_fe_read_snr(struct dvb_frontend* fe, u16 *snr) | ||
84 | { | ||
85 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
86 | u8 _snr = vp7045_read_reg(state->d, 0x09); | ||
87 | *snr = (_snr << 8) | _snr; | ||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | static int vp7045_fe_init(struct dvb_frontend* fe) | ||
92 | { | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | static int vp7045_fe_sleep(struct dvb_frontend* fe) | ||
97 | { | ||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | static int vp7045_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) | ||
102 | { | ||
103 | tune->min_delay_ms = 800; | ||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | static int vp7045_fe_set_frontend(struct dvb_frontend* fe, | ||
108 | struct dvb_frontend_parameters *fep) | ||
109 | { | ||
110 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
111 | u8 buf[5]; | ||
112 | u32 freq = fep->frequency / 1000; | ||
113 | |||
114 | buf[0] = (freq >> 16) & 0xff; | ||
115 | buf[1] = (freq >> 8) & 0xff; | ||
116 | buf[2] = freq & 0xff; | ||
117 | buf[3] = 0; | ||
118 | |||
119 | switch (fep->u.ofdm.bandwidth) { | ||
120 | case BANDWIDTH_8_MHZ: buf[4] = 8; break; | ||
121 | case BANDWIDTH_7_MHZ: buf[4] = 7; break; | ||
122 | case BANDWIDTH_6_MHZ: buf[4] = 6; break; | ||
123 | case BANDWIDTH_AUTO: return -EOPNOTSUPP; | ||
124 | default: | ||
125 | return -EINVAL; | ||
126 | } | ||
127 | |||
128 | vp7045_usb_op(state->d,LOCK_TUNER_COMMAND,buf,5,NULL,0,200); | ||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | static int vp7045_fe_get_frontend(struct dvb_frontend* fe, | ||
133 | struct dvb_frontend_parameters *fep) | ||
134 | { | ||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | static void vp7045_fe_release(struct dvb_frontend* fe) | ||
139 | { | ||
140 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
141 | kfree(state); | ||
142 | } | ||
143 | |||
144 | static struct dvb_frontend_ops vp7045_fe_ops; | ||
145 | |||
146 | struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) | ||
147 | { | ||
148 | struct vp7045_fe_state *s = kmalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL); | ||
149 | if (s == NULL) | ||
150 | goto error; | ||
151 | memset(s,0,sizeof(struct vp7045_fe_state)); | ||
152 | |||
153 | s->d = d; | ||
154 | s->fe.ops = &vp7045_fe_ops; | ||
155 | s->fe.demodulator_priv = s; | ||
156 | |||
157 | goto success; | ||
158 | error: | ||
159 | return NULL; | ||
160 | success: | ||
161 | return &s->fe; | ||
162 | } | ||
163 | |||
164 | |||
165 | static struct dvb_frontend_ops vp7045_fe_ops = { | ||
166 | .info = { | ||
167 | .name = "Twinhan VP7045/46 USB DVB-T", | ||
168 | .type = FE_OFDM, | ||
169 | .frequency_min = 44250000, | ||
170 | .frequency_max = 867250000, | ||
171 | .frequency_stepsize = 1000, | ||
172 | .caps = FE_CAN_INVERSION_AUTO | | ||
173 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | ||
174 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | | ||
175 | FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | | ||
176 | FE_CAN_TRANSMISSION_MODE_AUTO | | ||
177 | FE_CAN_GUARD_INTERVAL_AUTO | | ||
178 | FE_CAN_RECOVER | | ||
179 | FE_CAN_HIERARCHY_AUTO, | ||
180 | }, | ||
181 | |||
182 | .release = vp7045_fe_release, | ||
183 | |||
184 | .init = vp7045_fe_init, | ||
185 | .sleep = vp7045_fe_sleep, | ||
186 | |||
187 | .set_frontend = vp7045_fe_set_frontend, | ||
188 | .get_frontend = vp7045_fe_get_frontend, | ||
189 | .get_tune_settings = vp7045_fe_get_tune_settings, | ||
190 | |||
191 | .read_status = vp7045_fe_read_status, | ||
192 | .read_ber = vp7045_fe_read_ber, | ||
193 | .read_signal_strength = vp7045_fe_read_signal_strength, | ||
194 | .read_snr = vp7045_fe_read_snr, | ||
195 | .read_ucblocks = vp7045_fe_read_unc_blocks, | ||
196 | }; | ||
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c new file mode 100644 index 000000000000..9ac95f54f9fc --- /dev/null +++ b/drivers/media/dvb/dvb-usb/vp7045.c | |||
@@ -0,0 +1,288 @@ | |||
1 | /* DVB USB compliant Linux driver for the | ||
2 | * - TwinhanDTV Alpha/MagicBoxII USB2.0 DVB-T receiver | ||
3 | * - DigitalNow TinyUSB2 DVB-t receiver | ||
4 | * | ||
5 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
6 | * | ||
7 | * Thanks to Twinhan who kindly provided hardware and information. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the Free | ||
11 | * Software Foundation, version 2. | ||
12 | * | ||
13 | * see Documentation/dvb/README.dvb-usb for more information | ||
14 | */ | ||
15 | #include "vp7045.h" | ||
16 | |||
17 | /* debug */ | ||
18 | int dvb_usb_vp7045_debug; | ||
19 | module_param_named(debug,dvb_usb_vp7045_debug, int, 0644); | ||
20 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); | ||
21 | |||
22 | int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, int inlen, int msec) | ||
23 | { | ||
24 | int ret = 0; | ||
25 | u8 inbuf[12] = { 0 }, outbuf[20] = { 0 }; | ||
26 | |||
27 | outbuf[0] = cmd; | ||
28 | |||
29 | if (outlen > 19) | ||
30 | outlen = 19; | ||
31 | |||
32 | if (inlen > 11) | ||
33 | inlen = 11; | ||
34 | |||
35 | if (out != NULL && outlen > 0) | ||
36 | memcpy(&outbuf[1], out, outlen); | ||
37 | |||
38 | deb_xfer("out buffer: "); | ||
39 | debug_dump(outbuf,outlen+1,deb_xfer); | ||
40 | |||
41 | if ((ret = down_interruptible(&d->usb_sem))) | ||
42 | return ret; | ||
43 | |||
44 | if (usb_control_msg(d->udev, | ||
45 | usb_sndctrlpipe(d->udev,0), | ||
46 | TH_COMMAND_OUT, USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, | ||
47 | outbuf, 20, 2000) != 20) { | ||
48 | err("USB control message 'out' went wrong."); | ||
49 | ret = -EIO; | ||
50 | goto unlock; | ||
51 | } | ||
52 | |||
53 | msleep(msec); | ||
54 | |||
55 | if (usb_control_msg(d->udev, | ||
56 | usb_rcvctrlpipe(d->udev,0), | ||
57 | TH_COMMAND_IN, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, | ||
58 | inbuf, 12, 2000) != 12) { | ||
59 | err("USB control message 'in' went wrong."); | ||
60 | ret = -EIO; | ||
61 | goto unlock; | ||
62 | } | ||
63 | |||
64 | deb_xfer("in buffer: "); | ||
65 | debug_dump(inbuf,12,deb_xfer); | ||
66 | |||
67 | if (in != NULL && inlen > 0) | ||
68 | memcpy(in,&inbuf[1],inlen); | ||
69 | |||
70 | unlock: | ||
71 | up(&d->usb_sem); | ||
72 | |||
73 | return ret; | ||
74 | } | ||
75 | |||
76 | u8 vp7045_read_reg(struct dvb_usb_device *d, u8 reg) | ||
77 | { | ||
78 | u8 obuf[2] = { 0 },v; | ||
79 | obuf[1] = reg; | ||
80 | |||
81 | vp7045_usb_op(d,TUNER_REG_READ,obuf,2,&v,1,30); | ||
82 | |||
83 | return v; | ||
84 | } | ||
85 | |||
86 | static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
87 | { | ||
88 | u8 v = onoff; | ||
89 | return vp7045_usb_op(d,SET_TUNER_POWER,&v,1,NULL,0,150); | ||
90 | } | ||
91 | |||
92 | /* remote control stuff */ | ||
93 | |||
94 | /* The keymapping struct. Somehow this should be loaded to the driver, but | ||
95 | * currently it is hardcoded. */ | ||
96 | static struct dvb_usb_rc_key vp7045_rc_keys[] = { | ||
97 | { 0x00, 0x16, KEY_POWER }, | ||
98 | { 0x00, 0x10, KEY_MUTE }, | ||
99 | { 0x00, 0x03, KEY_1 }, | ||
100 | { 0x00, 0x01, KEY_2 }, | ||
101 | { 0x00, 0x06, KEY_3 }, | ||
102 | { 0x00, 0x09, KEY_4 }, | ||
103 | { 0x00, 0x1d, KEY_5 }, | ||
104 | { 0x00, 0x1f, KEY_6 }, | ||
105 | { 0x00, 0x0d, KEY_7 }, | ||
106 | { 0x00, 0x19, KEY_8 }, | ||
107 | { 0x00, 0x1b, KEY_9 }, | ||
108 | { 0x00, 0x15, KEY_0 }, | ||
109 | { 0x00, 0x05, KEY_CHANNELUP }, | ||
110 | { 0x00, 0x02, KEY_CHANNELDOWN }, | ||
111 | { 0x00, 0x1e, KEY_VOLUMEUP }, | ||
112 | { 0x00, 0x0a, KEY_VOLUMEDOWN }, | ||
113 | { 0x00, 0x11, KEY_RECORD }, | ||
114 | { 0x00, 0x17, KEY_FAVORITES }, /* Heart symbol - Channel list. */ | ||
115 | { 0x00, 0x14, KEY_PLAY }, | ||
116 | { 0x00, 0x1a, KEY_STOP }, | ||
117 | { 0x00, 0x40, KEY_REWIND }, | ||
118 | { 0x00, 0x12, KEY_FASTFORWARD }, | ||
119 | { 0x00, 0x0e, KEY_PREVIOUS }, /* Recall - Previous channel. */ | ||
120 | { 0x00, 0x4c, KEY_PAUSE }, | ||
121 | { 0x00, 0x4d, KEY_SCREEN }, /* Full screen mode. */ | ||
122 | { 0x00, 0x54, KEY_AUDIO }, /* MTS - Switch to secondary audio. */ | ||
123 | { 0x00, 0x0c, KEY_CANCEL }, /* Cancel */ | ||
124 | { 0x00, 0x1c, KEY_EPG }, /* EPG */ | ||
125 | { 0x00, 0x00, KEY_TAB }, /* Tab */ | ||
126 | { 0x00, 0x48, KEY_INFO }, /* Preview */ | ||
127 | { 0x00, 0x04, KEY_LIST }, /* RecordList */ | ||
128 | { 0x00, 0x0f, KEY_TEXT } /* Teletext */ | ||
129 | }; | ||
130 | |||
131 | static int vp7045_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
132 | { | ||
133 | u8 key; | ||
134 | int i; | ||
135 | vp7045_usb_op(d,RC_VAL_READ,NULL,0,&key,1,20); | ||
136 | |||
137 | deb_rc("remote query key: %x %d\n",key,key); | ||
138 | |||
139 | if (key == 0x44) { | ||
140 | *state = REMOTE_NO_KEY_PRESSED; | ||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | for (i = 0; i < sizeof(vp7045_rc_keys)/sizeof(struct dvb_usb_rc_key); i++) | ||
145 | if (vp7045_rc_keys[i].data == key) { | ||
146 | *state = REMOTE_KEY_PRESSED; | ||
147 | *event = vp7045_rc_keys[i].event; | ||
148 | break; | ||
149 | } | ||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static int vp7045_read_eeprom(struct dvb_usb_device *d,u8 *buf, int len, int offset) | ||
154 | { | ||
155 | int i = 0; | ||
156 | u8 v,br[2]; | ||
157 | for (i=0; i < len; i++) { | ||
158 | v = offset + i; | ||
159 | vp7045_usb_op(d,GET_EE_VALUE,&v,1,br,2,5); | ||
160 | buf[i] = br[1]; | ||
161 | } | ||
162 | deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ",offset, i); | ||
163 | debug_dump(buf,i,deb_info); | ||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | |||
168 | static int vp7045_read_mac_addr(struct dvb_usb_device *d,u8 mac[6]) | ||
169 | { | ||
170 | return vp7045_read_eeprom(d,mac, 6, MAC_0_ADDR); | ||
171 | } | ||
172 | |||
173 | static int vp7045_frontend_attach(struct dvb_usb_device *d) | ||
174 | { | ||
175 | u8 buf[255] = { 0 }; | ||
176 | |||
177 | vp7045_usb_op(d,VENDOR_STRING_READ,NULL,0,buf,20,0); | ||
178 | buf[10] = '\0'; | ||
179 | deb_info("firmware says: %s ",buf); | ||
180 | |||
181 | vp7045_usb_op(d,PRODUCT_STRING_READ,NULL,0,buf,20,0); | ||
182 | buf[10] = '\0'; | ||
183 | deb_info("%s ",buf); | ||
184 | |||
185 | vp7045_usb_op(d,FW_VERSION_READ,NULL,0,buf,20,0); | ||
186 | buf[10] = '\0'; | ||
187 | deb_info("v%s\n",buf); | ||
188 | |||
189 | /* Dump the EEPROM */ | ||
190 | /* vp7045_read_eeprom(d,buf, 255, FX2_ID_ADDR); */ | ||
191 | |||
192 | d->fe = vp7045_fe_attach(d); | ||
193 | |||
194 | return 0; | ||
195 | } | ||
196 | |||
197 | static struct dvb_usb_properties vp7045_properties; | ||
198 | |||
199 | static int vp7045_usb_probe(struct usb_interface *intf, | ||
200 | const struct usb_device_id *id) | ||
201 | { | ||
202 | return dvb_usb_device_init(intf,&vp7045_properties,THIS_MODULE); | ||
203 | } | ||
204 | |||
205 | static struct usb_device_id vp7045_usb_table [] = { | ||
206 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7045_COLD) }, | ||
207 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7045_WARM) }, | ||
208 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_DNTV_TINYUSB2_COLD) }, | ||
209 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_DNTV_TINYUSB2_WARM) }, | ||
210 | { 0 }, | ||
211 | }; | ||
212 | MODULE_DEVICE_TABLE(usb, vp7045_usb_table); | ||
213 | |||
214 | static struct dvb_usb_properties vp7045_properties = { | ||
215 | .caps = 0, | ||
216 | |||
217 | .usb_ctrl = CYPRESS_FX2, | ||
218 | .firmware = "dvb-usb-vp7045-01.fw", | ||
219 | |||
220 | .power_ctrl = vp7045_power_ctrl, | ||
221 | .frontend_attach = vp7045_frontend_attach, | ||
222 | .read_mac_address = vp7045_read_mac_addr, | ||
223 | |||
224 | .rc_interval = 400, | ||
225 | .rc_key_map = vp7045_rc_keys, | ||
226 | .rc_key_map_size = ARRAY_SIZE(vp7045_rc_keys), | ||
227 | .rc_query = vp7045_rc_query, | ||
228 | |||
229 | /* parameter for the MPEG2-data transfer */ | ||
230 | .urb = { | ||
231 | .type = DVB_USB_BULK, | ||
232 | .count = 7, | ||
233 | .endpoint = 0x02, | ||
234 | .u = { | ||
235 | .bulk = { | ||
236 | .buffersize = 4096, | ||
237 | } | ||
238 | } | ||
239 | }, | ||
240 | |||
241 | .num_device_descs = 2, | ||
242 | .devices = { | ||
243 | { .name = "Twinhan USB2.0 DVB-T receiver (TwinhanDTV Alpha/MagicBox II)", | ||
244 | .cold_ids = { &vp7045_usb_table[0], NULL }, | ||
245 | .warm_ids = { &vp7045_usb_table[1], NULL }, | ||
246 | }, | ||
247 | { .name = "DigitalNow TinyUSB 2 DVB-t Receiver", | ||
248 | .cold_ids = { &vp7045_usb_table[2], NULL }, | ||
249 | .warm_ids = { &vp7045_usb_table[3], NULL }, | ||
250 | }, | ||
251 | { 0 }, | ||
252 | } | ||
253 | }; | ||
254 | |||
255 | /* usb specific object needed to register this driver with the usb subsystem */ | ||
256 | static struct usb_driver vp7045_usb_driver = { | ||
257 | .owner = THIS_MODULE, | ||
258 | .name = "dvb_usb_vp7045", | ||
259 | .probe = vp7045_usb_probe, | ||
260 | .disconnect = dvb_usb_device_exit, | ||
261 | .id_table = vp7045_usb_table, | ||
262 | }; | ||
263 | |||
264 | /* module stuff */ | ||
265 | static int __init vp7045_usb_module_init(void) | ||
266 | { | ||
267 | int result; | ||
268 | if ((result = usb_register(&vp7045_usb_driver))) { | ||
269 | err("usb_register failed. (%d)",result); | ||
270 | return result; | ||
271 | } | ||
272 | |||
273 | return 0; | ||
274 | } | ||
275 | |||
276 | static void __exit vp7045_usb_module_exit(void) | ||
277 | { | ||
278 | /* deregister this driver from the USB subsystem */ | ||
279 | usb_deregister(&vp7045_usb_driver); | ||
280 | } | ||
281 | |||
282 | module_init(vp7045_usb_module_init); | ||
283 | module_exit(vp7045_usb_module_exit); | ||
284 | |||
285 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
286 | MODULE_DESCRIPTION("Driver for Twinhan MagicBox/Alpha and DNTV tinyUSB2 DVB-T USB2.0"); | ||
287 | MODULE_VERSION("1.0"); | ||
288 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/vp7045.h b/drivers/media/dvb/dvb-usb/vp7045.h new file mode 100644 index 000000000000..9ce21a20fa86 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/vp7045.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /* Common header-file of the Linux driver for the TwinhanDTV Alpha/MagicBoxII | ||
2 | * USB2.0 DVB-T receiver. | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * Thanks to Twinhan who kindly provided hardware and information. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the Free | ||
10 | * Software Foundation, version 2. | ||
11 | * | ||
12 | * see Documentation/dvb/README.dvb-usb for more information | ||
13 | */ | ||
14 | #ifndef _DVB_USB_VP7045_H_ | ||
15 | #define _DVB_USB_VP7045_H_ | ||
16 | |||
17 | #define DVB_USB_LOG_PREFIX "vp7045" | ||
18 | #include "dvb-usb.h" | ||
19 | |||
20 | extern int dvb_usb_vp7045_debug; | ||
21 | #define deb_info(args...) dprintk(dvb_usb_vp7045_debug,0x01,args) | ||
22 | #define deb_xfer(args...) dprintk(dvb_usb_vp7045_debug,0x02,args) | ||
23 | #define deb_rc(args...) dprintk(dvb_usb_vp7045_debug,0x04,args) | ||
24 | |||
25 | /* vp7045 commands */ | ||
26 | |||
27 | /* Twinhan Vendor requests */ | ||
28 | #define TH_COMMAND_IN 0xC0 | ||
29 | #define TH_COMMAND_OUT 0xC1 | ||
30 | |||
31 | /* command bytes */ | ||
32 | #define TUNER_REG_READ 0x03 | ||
33 | #define TUNER_REG_WRITE 0x04 | ||
34 | |||
35 | #define RC_VAL_READ 0x05 | ||
36 | #define RC_NO_KEY 0x44 | ||
37 | |||
38 | #define SET_TUNER_POWER 0x06 | ||
39 | #define CHECK_TUNER_POWER 0x12 | ||
40 | #define Tuner_Power_ON 1 | ||
41 | #define Tuner_Power_OFF 0 | ||
42 | |||
43 | #define GET_USB_SPEED 0x07 | ||
44 | #define USB_SPEED_LOW 0 | ||
45 | #define USB_SPEED_FULL 1 | ||
46 | #define USB_SPEED_HIGH 2 | ||
47 | |||
48 | #define LOCK_TUNER_COMMAND 0x09 | ||
49 | |||
50 | #define TUNER_SIGNAL_READ 0x0A | ||
51 | |||
52 | /* FX2 eeprom */ | ||
53 | #define SET_EE_VALUE 0x10 | ||
54 | #define GET_EE_VALUE 0x11 | ||
55 | #define FX2_ID_ADDR 0x00 | ||
56 | #define VID_MSB_ADDR 0x02 | ||
57 | #define VID_LSB_ADDR 0x01 | ||
58 | #define PID_MSB_ADDR 0x04 | ||
59 | #define PID_LSB_ADDR 0x03 | ||
60 | #define MAC_0_ADDR 0x07 | ||
61 | #define MAC_1_ADDR 0x08 | ||
62 | #define MAC_2_ADDR 0x09 | ||
63 | #define MAC_3_ADDR 0x0a | ||
64 | #define MAC_4_ADDR 0x0b | ||
65 | #define MAC_5_ADDR 0x0c | ||
66 | |||
67 | #define RESET_FX2 0x13 | ||
68 | |||
69 | #define FW_VERSION_READ 0x0B | ||
70 | #define VENDOR_STRING_READ 0x0C | ||
71 | #define PRODUCT_STRING_READ 0x0D | ||
72 | #define FW_BCD_VERSION_READ 0x14 | ||
73 | |||
74 | extern struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d); | ||
75 | extern int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, int inlen,int msec); | ||
76 | extern u8 vp7045_read_reg(struct dvb_usb_device *d, u8 reg); | ||
77 | |||
78 | #endif | ||
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index 75fb556ec01f..a50a41f6f79d 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig | |||
@@ -40,6 +40,12 @@ config DVB_VES1X93 | |||
40 | help | 40 | help |
41 | A DVB-S tuner module. Say Y when you want to support this frontend. | 41 | A DVB-S tuner module. Say Y when you want to support this frontend. |
42 | 42 | ||
43 | config DVB_S5H1420 | ||
44 | tristate "Samsung S5H1420 based" | ||
45 | depends on DVB_CORE | ||
46 | help | ||
47 | A DVB-S tuner module. Say Y when you want to support this frontend. | ||
48 | |||
43 | comment "DVB-T (terrestrial) frontends" | 49 | comment "DVB-T (terrestrial) frontends" |
44 | depends on DVB_CORE | 50 | depends on DVB_CORE |
45 | 51 | ||
@@ -173,4 +179,19 @@ config DVB_OR51132 | |||
173 | An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want | 179 | An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want |
174 | to support this frontend. | 180 | to support this frontend. |
175 | 181 | ||
182 | config DVB_BCM3510 | ||
183 | tristate "Broadcom BCM3510" | ||
184 | depends on DVB_CORE | ||
185 | select FW_LOADER | ||
186 | help | ||
187 | An ATSC 8VSB/16VSB and QAM64/256 tuner module. Say Y when you want to | ||
188 | support this frontend. | ||
189 | |||
190 | config DVB_LGDT330X | ||
191 | tristate "LG Electronics LGDT3302/LGDT3303 based" | ||
192 | depends on DVB_CORE | ||
193 | help | ||
194 | An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want | ||
195 | to support this frontend. | ||
196 | |||
176 | endmenu | 197 | endmenu |
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile index 7f8784870eab..ad8658ffd60a 100644 --- a/drivers/media/dvb/frontends/Makefile +++ b/drivers/media/dvb/frontends/Makefile | |||
@@ -28,3 +28,6 @@ obj-$(CONFIG_DVB_STV0297) += stv0297.o | |||
28 | obj-$(CONFIG_DVB_NXT2002) += nxt2002.o | 28 | obj-$(CONFIG_DVB_NXT2002) += nxt2002.o |
29 | obj-$(CONFIG_DVB_OR51211) += or51211.o | 29 | obj-$(CONFIG_DVB_OR51211) += or51211.o |
30 | obj-$(CONFIG_DVB_OR51132) += or51132.o | 30 | obj-$(CONFIG_DVB_OR51132) += or51132.o |
31 | obj-$(CONFIG_DVB_BCM3510) += bcm3510.o | ||
32 | obj-$(CONFIG_DVB_S5H1420) += s5h1420.o | ||
33 | obj-$(CONFIG_DVB_LGDT330X) += lgdt330x.o | ||
diff --git a/drivers/media/dvb/frontends/bcm3510.c b/drivers/media/dvb/frontends/bcm3510.c new file mode 100644 index 000000000000..f5fdc5c3e605 --- /dev/null +++ b/drivers/media/dvb/frontends/bcm3510.c | |||
@@ -0,0 +1,853 @@ | |||
1 | /* | ||
2 | * Support for the Broadcom BCM3510 ATSC demodulator (1st generation Air2PC) | ||
3 | * | ||
4 | * Copyright (C) 2001-5, B2C2 inc. | ||
5 | * | ||
6 | * GPL/Linux driver written by Patrick Boettcher <patrick.boettcher@desy.de> | ||
7 | * | ||
8 | * This driver is "hard-coded" to be used with the 1st generation of | ||
9 | * Technisat/B2C2's Air2PC ATSC PCI/USB cards/boxes. The pll-programming | ||
10 | * (Panasonic CT10S) is located here, which is actually wrong. Unless there is | ||
11 | * another device with a BCM3510, this is no problem. | ||
12 | * | ||
13 | * The driver works also with QAM64 DVB-C, but had an unreasonable high | ||
14 | * UNC. (Tested with the Air2PC ATSC 1st generation) | ||
15 | * | ||
16 | * You'll need a firmware for this driver in order to get it running. It is | ||
17 | * called "dvb-fe-bcm3510-01.fw". | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or modify it | ||
20 | * under the terms of the GNU General Public License as published by the Free | ||
21 | * Software Foundation; either version 2 of the License, or (at your option) | ||
22 | * any later version. | ||
23 | * | ||
24 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
25 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
26 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
27 | * more details. | ||
28 | * | ||
29 | * You should have received a copy of the GNU General Public License along with | ||
30 | * this program; if not, write to the Free Software Foundation, Inc., 675 Mass | ||
31 | * Ave, Cambridge, MA 02139, USA. | ||
32 | */ | ||
33 | |||
34 | #include <linux/init.h> | ||
35 | #include <linux/module.h> | ||
36 | #include <linux/moduleparam.h> | ||
37 | #include <linux/device.h> | ||
38 | #include <linux/firmware.h> | ||
39 | |||
40 | #include "dvb_frontend.h" | ||
41 | #include "bcm3510.h" | ||
42 | #include "bcm3510_priv.h" | ||
43 | |||
44 | struct bcm3510_state { | ||
45 | |||
46 | struct i2c_adapter* i2c; | ||
47 | struct dvb_frontend_ops ops; | ||
48 | const struct bcm3510_config* config; | ||
49 | struct dvb_frontend frontend; | ||
50 | |||
51 | /* demodulator private data */ | ||
52 | struct semaphore hab_sem; | ||
53 | u8 firmware_loaded:1; | ||
54 | |||
55 | unsigned long next_status_check; | ||
56 | unsigned long status_check_interval; | ||
57 | struct bcm3510_hab_cmd_status1 status1; | ||
58 | struct bcm3510_hab_cmd_status2 status2; | ||
59 | }; | ||
60 | |||
61 | static int debug; | ||
62 | module_param(debug, int, 0644); | ||
63 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=i2c (|-able))."); | ||
64 | |||
65 | #define dprintk(level,x...) if (level & debug) printk(x) | ||
66 | #define dbufout(b,l,m) {\ | ||
67 | int i; \ | ||
68 | for (i = 0; i < l; i++) \ | ||
69 | m("%02x ",b[i]); \ | ||
70 | } | ||
71 | #define deb_info(args...) dprintk(0x01,args) | ||
72 | #define deb_i2c(args...) dprintk(0x02,args) | ||
73 | #define deb_hab(args...) dprintk(0x04,args) | ||
74 | |||
75 | /* transfer functions */ | ||
76 | static int bcm3510_writebytes (struct bcm3510_state *state, u8 reg, u8 *buf, u8 len) | ||
77 | { | ||
78 | u8 b[256]; | ||
79 | int err; | ||
80 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = b, .len = len + 1 }; | ||
81 | |||
82 | b[0] = reg; | ||
83 | memcpy(&b[1],buf,len); | ||
84 | |||
85 | deb_i2c("i2c wr %02x: ",reg); | ||
86 | dbufout(buf,len,deb_i2c); | ||
87 | deb_i2c("\n"); | ||
88 | |||
89 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { | ||
90 | |||
91 | deb_info("%s: i2c write error (addr %02x, reg %02x, err == %i)\n", | ||
92 | __FUNCTION__, state->config->demod_address, reg, err); | ||
93 | return -EREMOTEIO; | ||
94 | } | ||
95 | |||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | static int bcm3510_readbytes (struct bcm3510_state *state, u8 reg, u8 *buf, u8 len) | ||
100 | { | ||
101 | struct i2c_msg msg[] = { | ||
102 | { .addr = state->config->demod_address, .flags = 0, .buf = ®, .len = 1 }, | ||
103 | { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = buf, .len = len } | ||
104 | }; | ||
105 | int err; | ||
106 | |||
107 | memset(buf,0,len); | ||
108 | |||
109 | if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) { | ||
110 | deb_info("%s: i2c read error (addr %02x, reg %02x, err == %i)\n", | ||
111 | __FUNCTION__, state->config->demod_address, reg, err); | ||
112 | return -EREMOTEIO; | ||
113 | } | ||
114 | deb_i2c("i2c rd %02x: ",reg); | ||
115 | dbufout(buf,len,deb_i2c); | ||
116 | deb_i2c("\n"); | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | static int bcm3510_writeB(struct bcm3510_state *state, u8 reg, bcm3510_register_value v) | ||
122 | { | ||
123 | return bcm3510_writebytes(state,reg,&v.raw,1); | ||
124 | } | ||
125 | |||
126 | static int bcm3510_readB(struct bcm3510_state *state, u8 reg, bcm3510_register_value *v) | ||
127 | { | ||
128 | return bcm3510_readbytes(state,reg,&v->raw,1); | ||
129 | } | ||
130 | |||
131 | /* Host Access Buffer transfers */ | ||
132 | static int bcm3510_hab_get_response(struct bcm3510_state *st, u8 *buf, int len) | ||
133 | { | ||
134 | bcm3510_register_value v; | ||
135 | int ret,i; | ||
136 | |||
137 | v.HABADR_a6.HABADR = 0; | ||
138 | if ((ret = bcm3510_writeB(st,0xa6,v)) < 0) | ||
139 | return ret; | ||
140 | |||
141 | for (i = 0; i < len; i++) { | ||
142 | if ((ret = bcm3510_readB(st,0xa7,&v)) < 0) | ||
143 | return ret; | ||
144 | buf[i] = v.HABDATA_a7; | ||
145 | } | ||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | static int bcm3510_hab_send_request(struct bcm3510_state *st, u8 *buf, int len) | ||
150 | { | ||
151 | bcm3510_register_value v,hab; | ||
152 | int ret,i; | ||
153 | unsigned long t; | ||
154 | |||
155 | /* Check if any previous HAB request still needs to be serviced by the | ||
156 | * Aquisition Processor before sending new request */ | ||
157 | if ((ret = bcm3510_readB(st,0xa8,&v)) < 0) | ||
158 | return ret; | ||
159 | if (v.HABSTAT_a8.HABR) { | ||
160 | deb_info("HAB is running already - clearing it.\n"); | ||
161 | v.HABSTAT_a8.HABR = 0; | ||
162 | bcm3510_writeB(st,0xa8,v); | ||
163 | // return -EBUSY; | ||
164 | } | ||
165 | |||
166 | /* Send the start HAB Address (automatically incremented after write of | ||
167 | * HABDATA) and write the HAB Data */ | ||
168 | hab.HABADR_a6.HABADR = 0; | ||
169 | if ((ret = bcm3510_writeB(st,0xa6,hab)) < 0) | ||
170 | return ret; | ||
171 | |||
172 | for (i = 0; i < len; i++) { | ||
173 | hab.HABDATA_a7 = buf[i]; | ||
174 | if ((ret = bcm3510_writeB(st,0xa7,hab)) < 0) | ||
175 | return ret; | ||
176 | } | ||
177 | |||
178 | /* Set the HABR bit to indicate AP request in progress (LBHABR allows HABR to | ||
179 | * be written) */ | ||
180 | v.raw = 0; v.HABSTAT_a8.HABR = 1; v.HABSTAT_a8.LDHABR = 1; | ||
181 | if ((ret = bcm3510_writeB(st,0xa8,v)) < 0) | ||
182 | return ret; | ||
183 | |||
184 | /* Polling method: Wait until the AP finishes processing the HAB request */ | ||
185 | t = jiffies + 1*HZ; | ||
186 | while (time_before(jiffies, t)) { | ||
187 | deb_info("waiting for HAB to complete\n"); | ||
188 | msleep(10); | ||
189 | if ((ret = bcm3510_readB(st,0xa8,&v)) < 0) | ||
190 | return ret; | ||
191 | |||
192 | if (!v.HABSTAT_a8.HABR) | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | deb_info("send_request execution timed out.\n"); | ||
197 | return -ETIMEDOUT; | ||
198 | } | ||
199 | |||
200 | static int bcm3510_do_hab_cmd(struct bcm3510_state *st, u8 cmd, u8 msgid, u8 *obuf, u8 olen, u8 *ibuf, u8 ilen) | ||
201 | { | ||
202 | u8 ob[olen+2],ib[ilen+2]; | ||
203 | int ret = 0; | ||
204 | |||
205 | ob[0] = cmd; | ||
206 | ob[1] = msgid; | ||
207 | memcpy(&ob[2],obuf,olen); | ||
208 | |||
209 | deb_hab("hab snd: "); | ||
210 | dbufout(ob,olen+2,deb_hab); | ||
211 | deb_hab("\n"); | ||
212 | |||
213 | if (down_interruptible(&st->hab_sem) < 0) | ||
214 | return -EAGAIN; | ||
215 | |||
216 | if ((ret = bcm3510_hab_send_request(st, ob, olen+2)) < 0 || | ||
217 | (ret = bcm3510_hab_get_response(st, ib, ilen+2)) < 0) | ||
218 | goto error; | ||
219 | |||
220 | deb_hab("hab get: "); | ||
221 | dbufout(ib,ilen+2,deb_hab); | ||
222 | deb_hab("\n"); | ||
223 | |||
224 | memcpy(ibuf,&ib[2],ilen); | ||
225 | error: | ||
226 | up(&st->hab_sem); | ||
227 | return ret; | ||
228 | } | ||
229 | |||
230 | #if 0 | ||
231 | /* not needed, we use a semaphore to prevent HAB races */ | ||
232 | static int bcm3510_is_ap_ready(struct bcm3510_state *st) | ||
233 | { | ||
234 | bcm3510_register_value ap,hab; | ||
235 | int ret; | ||
236 | |||
237 | if ((ret = bcm3510_readB(st,0xa8,&hab)) < 0 || | ||
238 | (ret = bcm3510_readB(st,0xa2,&ap) < 0)) | ||
239 | return ret; | ||
240 | |||
241 | if (ap.APSTAT1_a2.RESET || ap.APSTAT1_a2.IDLE || ap.APSTAT1_a2.STOP || hab.HABSTAT_a8.HABR) { | ||
242 | deb_info("AP is busy\n"); | ||
243 | return -EBUSY; | ||
244 | } | ||
245 | |||
246 | return 0; | ||
247 | } | ||
248 | #endif | ||
249 | |||
250 | static int bcm3510_bert_reset(struct bcm3510_state *st) | ||
251 | { | ||
252 | bcm3510_register_value b; | ||
253 | int ret; | ||
254 | |||
255 | if ((ret < bcm3510_readB(st,0xfa,&b)) < 0) | ||
256 | return ret; | ||
257 | |||
258 | b.BERCTL_fa.RESYNC = 0; bcm3510_writeB(st,0xfa,b); | ||
259 | b.BERCTL_fa.RESYNC = 1; bcm3510_writeB(st,0xfa,b); | ||
260 | b.BERCTL_fa.RESYNC = 0; bcm3510_writeB(st,0xfa,b); | ||
261 | b.BERCTL_fa.CNTCTL = 1; b.BERCTL_fa.BITCNT = 1; bcm3510_writeB(st,0xfa,b); | ||
262 | |||
263 | /* clear residual bit counter TODO */ | ||
264 | return 0; | ||
265 | } | ||
266 | |||
267 | static int bcm3510_refresh_state(struct bcm3510_state *st) | ||
268 | { | ||
269 | if (time_after(jiffies,st->next_status_check)) { | ||
270 | bcm3510_do_hab_cmd(st, CMD_STATUS, MSGID_STATUS1, NULL,0, (u8 *)&st->status1, sizeof(st->status1)); | ||
271 | bcm3510_do_hab_cmd(st, CMD_STATUS, MSGID_STATUS2, NULL,0, (u8 *)&st->status2, sizeof(st->status2)); | ||
272 | st->next_status_check = jiffies + (st->status_check_interval*HZ)/1000; | ||
273 | } | ||
274 | return 0; | ||
275 | } | ||
276 | |||
277 | static int bcm3510_read_status(struct dvb_frontend *fe, fe_status_t *status) | ||
278 | { | ||
279 | struct bcm3510_state* st = fe->demodulator_priv; | ||
280 | bcm3510_refresh_state(st); | ||
281 | |||
282 | *status = 0; | ||
283 | if (st->status1.STATUS1.RECEIVER_LOCK) | ||
284 | *status |= FE_HAS_LOCK | FE_HAS_SYNC; | ||
285 | |||
286 | if (st->status1.STATUS1.FEC_LOCK) | ||
287 | *status |= FE_HAS_VITERBI; | ||
288 | |||
289 | if (st->status1.STATUS1.OUT_PLL_LOCK) | ||
290 | *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER; | ||
291 | |||
292 | if (*status & FE_HAS_LOCK) | ||
293 | st->status_check_interval = 1500; | ||
294 | else /* more frequently checks if no lock has been achieved yet */ | ||
295 | st->status_check_interval = 500; | ||
296 | |||
297 | deb_info("real_status: %02x\n",*status); | ||
298 | return 0; | ||
299 | } | ||
300 | |||
301 | static int bcm3510_read_ber(struct dvb_frontend* fe, u32* ber) | ||
302 | { | ||
303 | struct bcm3510_state* st = fe->demodulator_priv; | ||
304 | bcm3510_refresh_state(st); | ||
305 | |||
306 | *ber = (st->status2.LDBER0 << 16) | (st->status2.LDBER1 << 8) | st->status2.LDBER2; | ||
307 | return 0; | ||
308 | } | ||
309 | |||
310 | static int bcm3510_read_unc(struct dvb_frontend* fe, u32* unc) | ||
311 | { | ||
312 | struct bcm3510_state* st = fe->demodulator_priv; | ||
313 | bcm3510_refresh_state(st); | ||
314 | *unc = (st->status2.LDUERC0 << 8) | st->status2.LDUERC1; | ||
315 | return 0; | ||
316 | } | ||
317 | |||
318 | static int bcm3510_read_signal_strength(struct dvb_frontend* fe, u16* strength) | ||
319 | { | ||
320 | struct bcm3510_state* st = fe->demodulator_priv; | ||
321 | s32 t; | ||
322 | |||
323 | bcm3510_refresh_state(st); | ||
324 | t = st->status2.SIGNAL; | ||
325 | |||
326 | if (t > 190) | ||
327 | t = 190; | ||
328 | if (t < 90) | ||
329 | t = 90; | ||
330 | |||
331 | t -= 90; | ||
332 | t = t * 0xff / 100; | ||
333 | /* normalize if necessary */ | ||
334 | *strength = (t << 8) | t; | ||
335 | return 0; | ||
336 | } | ||
337 | |||
338 | static int bcm3510_read_snr(struct dvb_frontend* fe, u16* snr) | ||
339 | { | ||
340 | struct bcm3510_state* st = fe->demodulator_priv; | ||
341 | bcm3510_refresh_state(st); | ||
342 | |||
343 | *snr = st->status1.SNR_EST0*1000 + ((st->status1.SNR_EST1*1000) >> 8); | ||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | /* tuner frontend programming */ | ||
348 | static int bcm3510_tuner_cmd(struct bcm3510_state* st,u8 bc, u16 n, u8 a) | ||
349 | { | ||
350 | struct bcm3510_hab_cmd_tune c; | ||
351 | memset(&c,0,sizeof(struct bcm3510_hab_cmd_tune)); | ||
352 | |||
353 | /* I2C Mode disabled, set 16 control / Data pairs */ | ||
354 | c.length = 0x10; | ||
355 | c.clock_width = 0; | ||
356 | /* CS1, CS0, DATA, CLK bits control the tuner RF_AGC_SEL pin is set to | ||
357 | * logic high (as Configuration) */ | ||
358 | c.misc = 0x10; | ||
359 | /* Set duration of the initial state of TUNCTL = 3.34 micro Sec */ | ||
360 | c.TUNCTL_state = 0x40; | ||
361 | |||
362 | /* PRESCALER DEVIDE RATIO | BC1_2_3_4; (band switch), 1stosc REFERENCE COUNTER REF_S12 and REF_S11 */ | ||
363 | c.ctl_dat[0].ctrl.size = BITS_8; | ||
364 | c.ctl_dat[0].data = 0x80 | bc; | ||
365 | |||
366 | /* Control DATA pin, 1stosc REFERENCE COUNTER REF_S10 to REF_S3 */ | ||
367 | c.ctl_dat[1].ctrl.size = BITS_8; | ||
368 | c.ctl_dat[1].data = 4; | ||
369 | |||
370 | /* set CONTROL BIT 1 to 1, 1stosc REFERENCE COUNTER REF_S2 to REF_S1 */ | ||
371 | c.ctl_dat[2].ctrl.size = BITS_3; | ||
372 | c.ctl_dat[2].data = 0x20; | ||
373 | |||
374 | /* control CS0 pin, pulse byte ? */ | ||
375 | c.ctl_dat[3].ctrl.size = BITS_3; | ||
376 | c.ctl_dat[3].ctrl.clk_off = 1; | ||
377 | c.ctl_dat[3].ctrl.cs0 = 1; | ||
378 | c.ctl_dat[3].data = 0x40; | ||
379 | |||
380 | /* PGM_S18 to PGM_S11 */ | ||
381 | c.ctl_dat[4].ctrl.size = BITS_8; | ||
382 | c.ctl_dat[4].data = n >> 3; | ||
383 | |||
384 | /* PGM_S10 to PGM_S8, SWL_S7 to SWL_S3 */ | ||
385 | c.ctl_dat[5].ctrl.size = BITS_8; | ||
386 | c.ctl_dat[5].data = ((n & 0x7) << 5) | (a >> 2); | ||
387 | |||
388 | /* SWL_S2 and SWL_S1, set CONTROL BIT 2 to 0 */ | ||
389 | c.ctl_dat[6].ctrl.size = BITS_3; | ||
390 | c.ctl_dat[6].data = (a << 6) & 0xdf; | ||
391 | |||
392 | /* control CS0 pin, pulse byte ? */ | ||
393 | c.ctl_dat[7].ctrl.size = BITS_3; | ||
394 | c.ctl_dat[7].ctrl.clk_off = 1; | ||
395 | c.ctl_dat[7].ctrl.cs0 = 1; | ||
396 | c.ctl_dat[7].data = 0x40; | ||
397 | |||
398 | /* PRESCALER DEVIDE RATIO, 2ndosc REFERENCE COUNTER REF_S12 and REF_S11 */ | ||
399 | c.ctl_dat[8].ctrl.size = BITS_8; | ||
400 | c.ctl_dat[8].data = 0x80; | ||
401 | |||
402 | /* 2ndosc REFERENCE COUNTER REF_S10 to REF_S3 */ | ||
403 | c.ctl_dat[9].ctrl.size = BITS_8; | ||
404 | c.ctl_dat[9].data = 0x10; | ||
405 | |||
406 | /* set CONTROL BIT 1 to 1, 2ndosc REFERENCE COUNTER REF_S2 to REF_S1 */ | ||
407 | c.ctl_dat[10].ctrl.size = BITS_3; | ||
408 | c.ctl_dat[10].data = 0x20; | ||
409 | |||
410 | /* pulse byte */ | ||
411 | c.ctl_dat[11].ctrl.size = BITS_3; | ||
412 | c.ctl_dat[11].ctrl.clk_off = 1; | ||
413 | c.ctl_dat[11].ctrl.cs1 = 1; | ||
414 | c.ctl_dat[11].data = 0x40; | ||
415 | |||
416 | /* PGM_S18 to PGM_S11 */ | ||
417 | c.ctl_dat[12].ctrl.size = BITS_8; | ||
418 | c.ctl_dat[12].data = 0x2a; | ||
419 | |||
420 | /* PGM_S10 to PGM_S8 and SWL_S7 to SWL_S3 */ | ||
421 | c.ctl_dat[13].ctrl.size = BITS_8; | ||
422 | c.ctl_dat[13].data = 0x8e; | ||
423 | |||
424 | /* SWL_S2 and SWL_S1 and set CONTROL BIT 2 to 0 */ | ||
425 | c.ctl_dat[14].ctrl.size = BITS_3; | ||
426 | c.ctl_dat[14].data = 0; | ||
427 | |||
428 | /* Pulse Byte */ | ||
429 | c.ctl_dat[15].ctrl.size = BITS_3; | ||
430 | c.ctl_dat[15].ctrl.clk_off = 1; | ||
431 | c.ctl_dat[15].ctrl.cs1 = 1; | ||
432 | c.ctl_dat[15].data = 0x40; | ||
433 | |||
434 | return bcm3510_do_hab_cmd(st,CMD_TUNE, MSGID_TUNE,(u8 *) &c,sizeof(c), NULL, 0); | ||
435 | } | ||
436 | |||
437 | static int bcm3510_set_freq(struct bcm3510_state* st,u32 freq) | ||
438 | { | ||
439 | u8 bc,a; | ||
440 | u16 n; | ||
441 | s32 YIntercept,Tfvco1; | ||
442 | |||
443 | freq /= 1000; | ||
444 | |||
445 | deb_info("%dkHz:",freq); | ||
446 | /* set Band Switch */ | ||
447 | if (freq <= 168000) | ||
448 | bc = 0x1c; | ||
449 | else if (freq <= 378000) | ||
450 | bc = 0x2c; | ||
451 | else | ||
452 | bc = 0x30; | ||
453 | |||
454 | if (freq >= 470000) { | ||
455 | freq -= 470001; | ||
456 | YIntercept = 18805; | ||
457 | } else if (freq >= 90000) { | ||
458 | freq -= 90001; | ||
459 | YIntercept = 15005; | ||
460 | } else if (freq >= 76000){ | ||
461 | freq -= 76001; | ||
462 | YIntercept = 14865; | ||
463 | } else { | ||
464 | freq -= 54001; | ||
465 | YIntercept = 14645; | ||
466 | } | ||
467 | |||
468 | Tfvco1 = (((freq/6000)*60 + YIntercept)*4)/10; | ||
469 | |||
470 | n = Tfvco1 >> 6; | ||
471 | a = Tfvco1 & 0x3f; | ||
472 | |||
473 | deb_info(" BC1_2_3_4: %x, N: %x A: %x\n", bc, n, a); | ||
474 | if (n >= 16 && n <= 2047) | ||
475 | return bcm3510_tuner_cmd(st,bc,n,a); | ||
476 | |||
477 | return -EINVAL; | ||
478 | } | ||
479 | |||
480 | static int bcm3510_set_frontend(struct dvb_frontend* fe, | ||
481 | struct dvb_frontend_parameters *p) | ||
482 | { | ||
483 | struct bcm3510_state* st = fe->demodulator_priv; | ||
484 | struct bcm3510_hab_cmd_ext_acquire cmd; | ||
485 | struct bcm3510_hab_cmd_bert_control bert; | ||
486 | int ret; | ||
487 | |||
488 | memset(&cmd,0,sizeof(cmd)); | ||
489 | switch (p->u.vsb.modulation) { | ||
490 | case QAM_256: | ||
491 | cmd.ACQUIRE0.MODE = 0x1; | ||
492 | cmd.ACQUIRE1.SYM_RATE = 0x1; | ||
493 | cmd.ACQUIRE1.IF_FREQ = 0x1; | ||
494 | break; | ||
495 | case QAM_64: | ||
496 | cmd.ACQUIRE0.MODE = 0x2; | ||
497 | cmd.ACQUIRE1.SYM_RATE = 0x2; | ||
498 | cmd.ACQUIRE1.IF_FREQ = 0x1; | ||
499 | break; | ||
500 | /* case QAM_256: | ||
501 | cmd.ACQUIRE0.MODE = 0x3; | ||
502 | break; | ||
503 | case QAM_128: | ||
504 | cmd.ACQUIRE0.MODE = 0x4; | ||
505 | break; | ||
506 | case QAM_64: | ||
507 | cmd.ACQUIRE0.MODE = 0x5; | ||
508 | break; | ||
509 | case QAM_32: | ||
510 | cmd.ACQUIRE0.MODE = 0x6; | ||
511 | break; | ||
512 | case QAM_16: | ||
513 | cmd.ACQUIRE0.MODE = 0x7; | ||
514 | break;*/ | ||
515 | case VSB_8: | ||
516 | cmd.ACQUIRE0.MODE = 0x8; | ||
517 | cmd.ACQUIRE1.SYM_RATE = 0x0; | ||
518 | cmd.ACQUIRE1.IF_FREQ = 0x0; | ||
519 | break; | ||
520 | case VSB_16: | ||
521 | cmd.ACQUIRE0.MODE = 0x9; | ||
522 | cmd.ACQUIRE1.SYM_RATE = 0x0; | ||
523 | cmd.ACQUIRE1.IF_FREQ = 0x0; | ||
524 | default: | ||
525 | return -EINVAL; | ||
526 | }; | ||
527 | cmd.ACQUIRE0.OFFSET = 0; | ||
528 | cmd.ACQUIRE0.NTSCSWEEP = 1; | ||
529 | cmd.ACQUIRE0.FA = 1; | ||
530 | cmd.ACQUIRE0.BW = 0; | ||
531 | |||
532 | /* if (enableOffset) { | ||
533 | cmd.IF_OFFSET0 = xx; | ||
534 | cmd.IF_OFFSET1 = xx; | ||
535 | |||
536 | cmd.SYM_OFFSET0 = xx; | ||
537 | cmd.SYM_OFFSET1 = xx; | ||
538 | if (enableNtscSweep) { | ||
539 | cmd.NTSC_OFFSET0; | ||
540 | cmd.NTSC_OFFSET1; | ||
541 | } | ||
542 | } */ | ||
543 | bcm3510_do_hab_cmd(st, CMD_ACQUIRE, MSGID_EXT_TUNER_ACQUIRE, (u8 *) &cmd, sizeof(cmd), NULL, 0); | ||
544 | |||
545 | /* doing it with different MSGIDs, data book and source differs */ | ||
546 | bert.BE = 0; | ||
547 | bert.unused = 0; | ||
548 | bcm3510_do_hab_cmd(st, CMD_STATE_CONTROL, MSGID_BERT_CONTROL, (u8 *) &bert, sizeof(bert), NULL, 0); | ||
549 | bcm3510_do_hab_cmd(st, CMD_STATE_CONTROL, MSGID_BERT_SET, (u8 *) &bert, sizeof(bert), NULL, 0); | ||
550 | |||
551 | bcm3510_bert_reset(st); | ||
552 | |||
553 | if ((ret = bcm3510_set_freq(st,p->frequency)) < 0) | ||
554 | return ret; | ||
555 | |||
556 | memset(&st->status1,0,sizeof(st->status1)); | ||
557 | memset(&st->status2,0,sizeof(st->status2)); | ||
558 | st->status_check_interval = 500; | ||
559 | |||
560 | /* Give the AP some time */ | ||
561 | msleep(200); | ||
562 | |||
563 | return 0; | ||
564 | } | ||
565 | |||
566 | static int bcm3510_sleep(struct dvb_frontend* fe) | ||
567 | { | ||
568 | return 0; | ||
569 | } | ||
570 | |||
571 | static int bcm3510_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *s) | ||
572 | { | ||
573 | s->min_delay_ms = 1000; | ||
574 | s->step_size = 0; | ||
575 | s->max_drift = 0; | ||
576 | return 0; | ||
577 | } | ||
578 | |||
579 | static void bcm3510_release(struct dvb_frontend* fe) | ||
580 | { | ||
581 | struct bcm3510_state* state = fe->demodulator_priv; | ||
582 | kfree(state); | ||
583 | } | ||
584 | |||
585 | /* firmware download: | ||
586 | * firmware file is build up like this: | ||
587 | * 16bit addr, 16bit length, 8byte of length | ||
588 | */ | ||
589 | #define BCM3510_DEFAULT_FIRMWARE "dvb-fe-bcm3510-01.fw" | ||
590 | |||
591 | static int bcm3510_write_ram(struct bcm3510_state *st, u16 addr, u8 *b, u16 len) | ||
592 | { | ||
593 | int ret = 0,i; | ||
594 | bcm3510_register_value vH, vL,vD; | ||
595 | |||
596 | vH.MADRH_a9 = addr >> 8; | ||
597 | vL.MADRL_aa = addr; | ||
598 | if ((ret = bcm3510_writeB(st,0xa9,vH)) < 0) return ret; | ||
599 | if ((ret = bcm3510_writeB(st,0xaa,vL)) < 0) return ret; | ||
600 | |||
601 | for (i = 0; i < len; i++) { | ||
602 | vD.MDATA_ab = b[i]; | ||
603 | if ((ret = bcm3510_writeB(st,0xab,vD)) < 0) | ||
604 | return ret; | ||
605 | } | ||
606 | |||
607 | return 0; | ||
608 | } | ||
609 | |||
610 | static int bcm3510_download_firmware(struct dvb_frontend* fe) | ||
611 | { | ||
612 | struct bcm3510_state* st = fe->demodulator_priv; | ||
613 | const struct firmware *fw; | ||
614 | u16 addr,len; | ||
615 | u8 *b; | ||
616 | int ret,i; | ||
617 | |||
618 | deb_info("requesting firmware\n"); | ||
619 | if ((ret = st->config->request_firmware(fe, &fw, BCM3510_DEFAULT_FIRMWARE)) < 0) { | ||
620 | err("could not load firmware (%s): %d",BCM3510_DEFAULT_FIRMWARE,ret); | ||
621 | return ret; | ||
622 | } | ||
623 | deb_info("got firmware: %d\n",fw->size); | ||
624 | |||
625 | b = fw->data; | ||
626 | for (i = 0; i < fw->size;) { | ||
627 | addr = le16_to_cpu( *( (u16 *)&b[i] ) ); | ||
628 | len = le16_to_cpu( *( (u16 *)&b[i+2] ) ); | ||
629 | deb_info("firmware chunk, addr: 0x%04x, len: 0x%04x, total length: 0x%04x\n",addr,len,fw->size); | ||
630 | if ((ret = bcm3510_write_ram(st,addr,&b[i+4],len)) < 0) { | ||
631 | err("firmware download failed: %d\n",ret); | ||
632 | return ret; | ||
633 | } | ||
634 | i += 4 + len; | ||
635 | } | ||
636 | release_firmware(fw); | ||
637 | deb_info("firmware download successfully completed\n"); | ||
638 | return 0; | ||
639 | } | ||
640 | |||
641 | static int bcm3510_check_firmware_version(struct bcm3510_state *st) | ||
642 | { | ||
643 | struct bcm3510_hab_cmd_get_version_info ver; | ||
644 | bcm3510_do_hab_cmd(st,CMD_GET_VERSION_INFO,MSGID_GET_VERSION_INFO,NULL,0,(u8*)&ver,sizeof(ver)); | ||
645 | |||
646 | deb_info("Version information: 0x%02x 0x%02x 0x%02x 0x%02x\n", | ||
647 | ver.microcode_version, ver.script_version, ver.config_version, ver.demod_version); | ||
648 | |||
649 | if (ver.script_version == BCM3510_DEF_SCRIPT_VERSION && | ||
650 | ver.config_version == BCM3510_DEF_CONFIG_VERSION && | ||
651 | ver.demod_version == BCM3510_DEF_DEMOD_VERSION) | ||
652 | return 0; | ||
653 | |||
654 | deb_info("version check failed\n"); | ||
655 | return -ENODEV; | ||
656 | } | ||
657 | |||
658 | /* (un)resetting the AP */ | ||
659 | static int bcm3510_reset(struct bcm3510_state *st) | ||
660 | { | ||
661 | int ret; | ||
662 | unsigned long t; | ||
663 | bcm3510_register_value v; | ||
664 | |||
665 | bcm3510_readB(st,0xa0,&v); v.HCTL1_a0.RESET = 1; | ||
666 | if ((ret = bcm3510_writeB(st,0xa0,v)) < 0) | ||
667 | return ret; | ||
668 | |||
669 | t = jiffies + 3*HZ; | ||
670 | while (time_before(jiffies, t)) { | ||
671 | msleep(10); | ||
672 | if ((ret = bcm3510_readB(st,0xa2,&v)) < 0) | ||
673 | return ret; | ||
674 | |||
675 | if (v.APSTAT1_a2.RESET) | ||
676 | return 0; | ||
677 | } | ||
678 | deb_info("reset timed out\n"); | ||
679 | return -ETIMEDOUT; | ||
680 | } | ||
681 | |||
682 | static int bcm3510_clear_reset(struct bcm3510_state *st) | ||
683 | { | ||
684 | bcm3510_register_value v; | ||
685 | int ret; | ||
686 | unsigned long t; | ||
687 | |||
688 | v.raw = 0; | ||
689 | if ((ret = bcm3510_writeB(st,0xa0,v)) < 0) | ||
690 | return ret; | ||
691 | |||
692 | t = jiffies + 3*HZ; | ||
693 | while (time_before(jiffies, t)) { | ||
694 | msleep(10); | ||
695 | if ((ret = bcm3510_readB(st,0xa2,&v)) < 0) | ||
696 | return ret; | ||
697 | |||
698 | /* verify that reset is cleared */ | ||
699 | if (!v.APSTAT1_a2.RESET) | ||
700 | return 0; | ||
701 | } | ||
702 | deb_info("reset clear timed out\n"); | ||
703 | return -ETIMEDOUT; | ||
704 | } | ||
705 | |||
706 | static int bcm3510_init_cold(struct bcm3510_state *st) | ||
707 | { | ||
708 | int ret; | ||
709 | bcm3510_register_value v; | ||
710 | |||
711 | /* read Acquisation Processor status register and check it is not in RUN mode */ | ||
712 | if ((ret = bcm3510_readB(st,0xa2,&v)) < 0) | ||
713 | return ret; | ||
714 | if (v.APSTAT1_a2.RUN) { | ||
715 | deb_info("AP is already running - firmware already loaded.\n"); | ||
716 | return 0; | ||
717 | } | ||
718 | |||
719 | deb_info("reset?\n"); | ||
720 | if ((ret = bcm3510_reset(st)) < 0) | ||
721 | return ret; | ||
722 | |||
723 | deb_info("tristate?\n"); | ||
724 | /* tri-state */ | ||
725 | v.TSTCTL_2e.CTL = 0; | ||
726 | if ((ret = bcm3510_writeB(st,0x2e,v)) < 0) | ||
727 | return ret; | ||
728 | |||
729 | deb_info("firmware?\n"); | ||
730 | if ((ret = bcm3510_download_firmware(&st->frontend)) < 0 || | ||
731 | (ret = bcm3510_clear_reset(st)) < 0) | ||
732 | return ret; | ||
733 | |||
734 | /* anything left here to Let the acquisition processor begin execution at program counter 0000 ??? */ | ||
735 | |||
736 | return 0; | ||
737 | } | ||
738 | |||
739 | static int bcm3510_init(struct dvb_frontend* fe) | ||
740 | { | ||
741 | struct bcm3510_state* st = fe->demodulator_priv; | ||
742 | bcm3510_register_value j; | ||
743 | struct bcm3510_hab_cmd_set_agc c; | ||
744 | int ret; | ||
745 | |||
746 | if ((ret = bcm3510_readB(st,0xca,&j)) < 0) | ||
747 | return ret; | ||
748 | |||
749 | deb_info("JDEC: %02x\n",j.raw); | ||
750 | |||
751 | switch (j.JDEC_ca.JDEC) { | ||
752 | case JDEC_WAIT_AT_RAM: | ||
753 | deb_info("attempting to download firmware\n"); | ||
754 | if ((ret = bcm3510_init_cold(st)) < 0) | ||
755 | return ret; | ||
756 | case JDEC_EEPROM_LOAD_WAIT: /* fall-through is wanted */ | ||
757 | deb_info("firmware is loaded\n"); | ||
758 | bcm3510_check_firmware_version(st); | ||
759 | break; | ||
760 | default: | ||
761 | return -ENODEV; | ||
762 | } | ||
763 | |||
764 | memset(&c,0,1); | ||
765 | c.SEL = 1; | ||
766 | bcm3510_do_hab_cmd(st,CMD_AUTO_PARAM,MSGID_SET_RF_AGC_SEL,(u8 *)&c,sizeof(c),NULL,0); | ||
767 | |||
768 | return 0; | ||
769 | } | ||
770 | |||
771 | |||
772 | static struct dvb_frontend_ops bcm3510_ops; | ||
773 | |||
774 | struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config, | ||
775 | struct i2c_adapter *i2c) | ||
776 | { | ||
777 | struct bcm3510_state* state = NULL; | ||
778 | int ret; | ||
779 | bcm3510_register_value v; | ||
780 | |||
781 | /* allocate memory for the internal state */ | ||
782 | state = kmalloc(sizeof(struct bcm3510_state), GFP_KERNEL); | ||
783 | if (state == NULL) | ||
784 | goto error; | ||
785 | memset(state,0,sizeof(struct bcm3510_state)); | ||
786 | |||
787 | /* setup the state */ | ||
788 | |||
789 | state->config = config; | ||
790 | state->i2c = i2c; | ||
791 | memcpy(&state->ops, &bcm3510_ops, sizeof(struct dvb_frontend_ops)); | ||
792 | |||
793 | /* create dvb_frontend */ | ||
794 | state->frontend.ops = &state->ops; | ||
795 | state->frontend.demodulator_priv = state; | ||
796 | |||
797 | sema_init(&state->hab_sem, 1); | ||
798 | |||
799 | if ((ret = bcm3510_readB(state,0xe0,&v)) < 0) | ||
800 | goto error; | ||
801 | |||
802 | deb_info("Revision: 0x%1x, Layer: 0x%1x.\n",v.REVID_e0.REV,v.REVID_e0.LAYER); | ||
803 | |||
804 | if ((v.REVID_e0.REV != 0x1 && v.REVID_e0.LAYER != 0xb) && /* cold */ | ||
805 | (v.REVID_e0.REV != 0x8 && v.REVID_e0.LAYER != 0x0)) /* warm */ | ||
806 | goto error; | ||
807 | |||
808 | info("Revision: 0x%1x, Layer: 0x%1x.",v.REVID_e0.REV,v.REVID_e0.LAYER); | ||
809 | |||
810 | bcm3510_reset(state); | ||
811 | |||
812 | return &state->frontend; | ||
813 | |||
814 | error: | ||
815 | kfree(state); | ||
816 | return NULL; | ||
817 | } | ||
818 | EXPORT_SYMBOL(bcm3510_attach); | ||
819 | |||
820 | static struct dvb_frontend_ops bcm3510_ops = { | ||
821 | |||
822 | .info = { | ||
823 | .name = "Broadcom BCM3510 VSB/QAM frontend", | ||
824 | .type = FE_ATSC, | ||
825 | .frequency_min = 54000000, | ||
826 | .frequency_max = 803000000, | ||
827 | /* stepsize is just a guess */ | ||
828 | .frequency_stepsize = 0, | ||
829 | .caps = | ||
830 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | ||
831 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | | ||
832 | FE_CAN_8VSB | FE_CAN_16VSB | | ||
833 | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_128 | FE_CAN_QAM_256 | ||
834 | }, | ||
835 | |||
836 | .release = bcm3510_release, | ||
837 | |||
838 | .init = bcm3510_init, | ||
839 | .sleep = bcm3510_sleep, | ||
840 | |||
841 | .set_frontend = bcm3510_set_frontend, | ||
842 | .get_tune_settings = bcm3510_get_tune_settings, | ||
843 | |||
844 | .read_status = bcm3510_read_status, | ||
845 | .read_ber = bcm3510_read_ber, | ||
846 | .read_signal_strength = bcm3510_read_signal_strength, | ||
847 | .read_snr = bcm3510_read_snr, | ||
848 | .read_ucblocks = bcm3510_read_unc, | ||
849 | }; | ||
850 | |||
851 | MODULE_DESCRIPTION("Broadcom BCM3510 ATSC (8VSB/16VSB & ITU J83 AnnexB FEC QAM64/256) demodulator driver"); | ||
852 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
853 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/frontends/bcm3510.h b/drivers/media/dvb/frontends/bcm3510.h new file mode 100644 index 000000000000..80f5d0953d02 --- /dev/null +++ b/drivers/media/dvb/frontends/bcm3510.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Support for the Broadcom BCM3510 ATSC demodulator (1st generation Air2PC) | ||
3 | * | ||
4 | * Copyright (C) 2001-5, B2C2 inc. | ||
5 | * | ||
6 | * GPL/Linux driver written by Patrick Boettcher <patrick.boettcher@desy.de> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | #ifndef BCM3510_H | ||
23 | #define BCM3510_H | ||
24 | |||
25 | #include <linux/dvb/frontend.h> | ||
26 | #include <linux/firmware.h> | ||
27 | |||
28 | struct bcm3510_config | ||
29 | { | ||
30 | /* the demodulator's i2c address */ | ||
31 | u8 demod_address; | ||
32 | |||
33 | /* request firmware for device */ | ||
34 | int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); | ||
35 | }; | ||
36 | |||
37 | extern struct dvb_frontend* bcm3510_attach(const struct bcm3510_config* config, | ||
38 | struct i2c_adapter* i2c); | ||
39 | |||
40 | #endif | ||
diff --git a/drivers/media/dvb/frontends/bcm3510_priv.h b/drivers/media/dvb/frontends/bcm3510_priv.h new file mode 100644 index 000000000000..3bb1bc2a04f0 --- /dev/null +++ b/drivers/media/dvb/frontends/bcm3510_priv.h | |||
@@ -0,0 +1,460 @@ | |||
1 | /* | ||
2 | * Support for the Broadcom BCM3510 ATSC demodulator (1st generation Air2PC) | ||
3 | * | ||
4 | * Copyright (C) 2001-5, B2C2 inc. | ||
5 | * | ||
6 | * GPL/Linux driver written by Patrick Boettcher <patrick.boettcher@desy.de> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | #ifndef __BCM3510_PRIV_H__ | ||
23 | #define __BCM3510_PRIV_H__ | ||
24 | |||
25 | #define PACKED __attribute__((packed)) | ||
26 | |||
27 | #undef err | ||
28 | #define err(format, arg...) printk(KERN_ERR "bcm3510: " format "\n" , ## arg) | ||
29 | #undef info | ||
30 | #define info(format, arg...) printk(KERN_INFO "bcm3510: " format "\n" , ## arg) | ||
31 | #undef warn | ||
32 | #define warn(format, arg...) printk(KERN_WARNING "bcm3510: " format "\n" , ## arg) | ||
33 | |||
34 | |||
35 | #define PANASONIC_FIRST_IF_BASE_IN_KHz 1407500 | ||
36 | #define BCM3510_SYMBOL_RATE 5381000 | ||
37 | |||
38 | typedef union { | ||
39 | u8 raw; | ||
40 | |||
41 | struct { | ||
42 | u8 CTL :8; | ||
43 | } TSTCTL_2e; | ||
44 | |||
45 | u8 LDCERC_4e; | ||
46 | u8 LDUERC_4f; | ||
47 | u8 LD_BER0_65; | ||
48 | u8 LD_BER1_66; | ||
49 | u8 LD_BER2_67; | ||
50 | u8 LD_BER3_68; | ||
51 | |||
52 | struct { | ||
53 | u8 RESET :1; | ||
54 | u8 IDLE :1; | ||
55 | u8 STOP :1; | ||
56 | u8 HIRQ0 :1; | ||
57 | u8 HIRQ1 :1; | ||
58 | u8 na0 :1; | ||
59 | u8 HABAV :1; | ||
60 | u8 na1 :1; | ||
61 | } HCTL1_a0; | ||
62 | |||
63 | struct { | ||
64 | u8 na0 :1; | ||
65 | u8 IDLMSK :1; | ||
66 | u8 STMSK :1; | ||
67 | u8 I0MSK :1; | ||
68 | u8 I1MSK :1; | ||
69 | u8 na1 :1; | ||
70 | u8 HABMSK :1; | ||
71 | u8 na2 :1; | ||
72 | } HCTLMSK_a1; | ||
73 | |||
74 | struct { | ||
75 | u8 RESET :1; | ||
76 | u8 IDLE :1; | ||
77 | u8 STOP :1; | ||
78 | u8 RUN :1; | ||
79 | u8 HABAV :1; | ||
80 | u8 MEMAV :1; | ||
81 | u8 ALDONE :1; | ||
82 | u8 REIRQ :1; | ||
83 | } APSTAT1_a2; | ||
84 | |||
85 | struct { | ||
86 | u8 RSTMSK :1; | ||
87 | u8 IMSK :1; | ||
88 | u8 SMSK :1; | ||
89 | u8 RMSK :1; | ||
90 | u8 HABMSK :1; | ||
91 | u8 MAVMSK :1; | ||
92 | u8 ALDMSK :1; | ||
93 | u8 REMSK :1; | ||
94 | } APMSK1_a3; | ||
95 | |||
96 | u8 APSTAT2_a4; | ||
97 | u8 APMSK2_a5; | ||
98 | |||
99 | struct { | ||
100 | u8 HABADR :7; | ||
101 | u8 na :1; | ||
102 | } HABADR_a6; | ||
103 | |||
104 | u8 HABDATA_a7; | ||
105 | |||
106 | struct { | ||
107 | u8 HABR :1; | ||
108 | u8 LDHABR :1; | ||
109 | u8 APMSK :1; | ||
110 | u8 HMSK :1; | ||
111 | u8 LDMSK :1; | ||
112 | u8 na :3; | ||
113 | } HABSTAT_a8; | ||
114 | |||
115 | u8 MADRH_a9; | ||
116 | u8 MADRL_aa; | ||
117 | u8 MDATA_ab; | ||
118 | |||
119 | struct { | ||
120 | #define JDEC_WAIT_AT_RAM 0x7 | ||
121 | #define JDEC_EEPROM_LOAD_WAIT 0x4 | ||
122 | u8 JDEC :3; | ||
123 | u8 na :5; | ||
124 | } JDEC_ca; | ||
125 | |||
126 | struct { | ||
127 | u8 REV :4; | ||
128 | u8 LAYER :4; | ||
129 | } REVID_e0; | ||
130 | |||
131 | struct { | ||
132 | u8 unk0 :1; | ||
133 | u8 CNTCTL :1; | ||
134 | u8 BITCNT :1; | ||
135 | u8 unk1 :1; | ||
136 | u8 RESYNC :1; | ||
137 | u8 unk2 :3; | ||
138 | } BERCTL_fa; | ||
139 | |||
140 | struct { | ||
141 | u8 CSEL0 :1; | ||
142 | u8 CLKED0 :1; | ||
143 | u8 CSEL1 :1; | ||
144 | u8 CLKED1 :1; | ||
145 | u8 CLKLEV :1; | ||
146 | u8 SPIVAR :1; | ||
147 | u8 na :2; | ||
148 | } TUNSET_fc; | ||
149 | |||
150 | struct { | ||
151 | u8 CLK :1; | ||
152 | u8 DATA :1; | ||
153 | u8 CS0 :1; | ||
154 | u8 CS1 :1; | ||
155 | u8 AGCSEL :1; | ||
156 | u8 na0 :1; | ||
157 | u8 TUNSEL :1; | ||
158 | u8 na1 :1; | ||
159 | } TUNCTL_fd; | ||
160 | |||
161 | u8 TUNSEL0_fe; | ||
162 | u8 TUNSEL1_ff; | ||
163 | |||
164 | } bcm3510_register_value; | ||
165 | |||
166 | /* HAB commands */ | ||
167 | |||
168 | /* version */ | ||
169 | #define CMD_GET_VERSION_INFO 0x3D | ||
170 | #define MSGID_GET_VERSION_INFO 0x15 | ||
171 | struct bcm3510_hab_cmd_get_version_info { | ||
172 | u8 microcode_version; | ||
173 | u8 script_version; | ||
174 | u8 config_version; | ||
175 | u8 demod_version; | ||
176 | } PACKED; | ||
177 | |||
178 | #define BCM3510_DEF_MICROCODE_VERSION 0x0E | ||
179 | #define BCM3510_DEF_SCRIPT_VERSION 0x06 | ||
180 | #define BCM3510_DEF_CONFIG_VERSION 0x01 | ||
181 | #define BCM3510_DEF_DEMOD_VERSION 0xB1 | ||
182 | |||
183 | /* acquire */ | ||
184 | #define CMD_ACQUIRE 0x38 | ||
185 | |||
186 | #define MSGID_EXT_TUNER_ACQUIRE 0x0A | ||
187 | struct bcm3510_hab_cmd_ext_acquire { | ||
188 | struct { | ||
189 | u8 MODE :4; | ||
190 | u8 BW :1; | ||
191 | u8 FA :1; | ||
192 | u8 NTSCSWEEP :1; | ||
193 | u8 OFFSET :1; | ||
194 | } PACKED ACQUIRE0; /* control_byte */ | ||
195 | |||
196 | struct { | ||
197 | u8 IF_FREQ :3; | ||
198 | u8 zero0 :1; | ||
199 | u8 SYM_RATE :3; | ||
200 | u8 zero1 :1; | ||
201 | } PACKED ACQUIRE1; /* sym_if */ | ||
202 | |||
203 | u8 IF_OFFSET0; /* IF_Offset_10hz */ | ||
204 | u8 IF_OFFSET1; | ||
205 | u8 SYM_OFFSET0; /* SymbolRateOffset */ | ||
206 | u8 SYM_OFFSET1; | ||
207 | u8 NTSC_OFFSET0; /* NTSC_Offset_10hz */ | ||
208 | u8 NTSC_OFFSET1; | ||
209 | } PACKED; | ||
210 | |||
211 | #define MSGID_INT_TUNER_ACQUIRE 0x0B | ||
212 | struct bcm3510_hab_cmd_int_acquire { | ||
213 | struct { | ||
214 | u8 MODE :4; | ||
215 | u8 BW :1; | ||
216 | u8 FA :1; | ||
217 | u8 NTSCSWEEP :1; | ||
218 | u8 OFFSET :1; | ||
219 | } PACKED ACQUIRE0; /* control_byte */ | ||
220 | |||
221 | struct { | ||
222 | u8 IF_FREQ :3; | ||
223 | u8 zero0 :1; | ||
224 | u8 SYM_RATE :3; | ||
225 | u8 zero1 :1; | ||
226 | } PACKED ACQUIRE1; /* sym_if */ | ||
227 | |||
228 | u8 TUNER_FREQ0; | ||
229 | u8 TUNER_FREQ1; | ||
230 | u8 TUNER_FREQ2; | ||
231 | u8 TUNER_FREQ3; | ||
232 | u8 IF_OFFSET0; /* IF_Offset_10hz */ | ||
233 | u8 IF_OFFSET1; | ||
234 | u8 SYM_OFFSET0; /* SymbolRateOffset */ | ||
235 | u8 SYM_OFFSET1; | ||
236 | u8 NTSC_OFFSET0; /* NTSC_Offset_10hz */ | ||
237 | u8 NTSC_OFFSET1; | ||
238 | } PACKED; | ||
239 | |||
240 | /* modes */ | ||
241 | #define BCM3510_QAM16 = 0x01 | ||
242 | #define BCM3510_QAM32 = 0x02 | ||
243 | #define BCM3510_QAM64 = 0x03 | ||
244 | #define BCM3510_QAM128 = 0x04 | ||
245 | #define BCM3510_QAM256 = 0x05 | ||
246 | #define BCM3510_8VSB = 0x0B | ||
247 | #define BCM3510_16VSB = 0x0D | ||
248 | |||
249 | /* IF_FREQS */ | ||
250 | #define BCM3510_IF_TERRESTRIAL 0x0 | ||
251 | #define BCM3510_IF_CABLE 0x1 | ||
252 | #define BCM3510_IF_USE_CMD 0x7 | ||
253 | |||
254 | /* SYM_RATE */ | ||
255 | #define BCM3510_SR_8VSB 0x0 /* 5381119 s/sec */ | ||
256 | #define BCM3510_SR_256QAM 0x1 /* 5360537 s/sec */ | ||
257 | #define BCM3510_SR_16QAM 0x2 /* 5056971 s/sec */ | ||
258 | #define BCM3510_SR_MISC 0x3 /* 5000000 s/sec */ | ||
259 | #define BCM3510_SR_USE_CMD 0x7 | ||
260 | |||
261 | /* special symbol rate */ | ||
262 | #define CMD_SET_VALUE_NOT_LISTED 0x2d | ||
263 | #define MSGID_SET_SYMBOL_RATE_NOT_LISTED 0x0c | ||
264 | struct bcm3510_hab_cmd_set_sr_not_listed { | ||
265 | u8 HOST_SYM_RATE0; | ||
266 | u8 HOST_SYM_RATE1; | ||
267 | u8 HOST_SYM_RATE2; | ||
268 | u8 HOST_SYM_RATE3; | ||
269 | } PACKED; | ||
270 | |||
271 | /* special IF */ | ||
272 | #define MSGID_SET_IF_FREQ_NOT_LISTED 0x0d | ||
273 | struct bcm3510_hab_cmd_set_if_freq_not_listed { | ||
274 | u8 HOST_IF_FREQ0; | ||
275 | u8 HOST_IF_FREQ1; | ||
276 | u8 HOST_IF_FREQ2; | ||
277 | u8 HOST_IF_FREQ3; | ||
278 | } PACKED; | ||
279 | |||
280 | /* auto reacquire */ | ||
281 | #define CMD_AUTO_PARAM 0x2a | ||
282 | #define MSGID_AUTO_REACQUIRE 0x0e | ||
283 | struct bcm3510_hab_cmd_auto_reacquire { | ||
284 | u8 ACQ :1; /* on/off*/ | ||
285 | u8 unused :7; | ||
286 | } PACKED; | ||
287 | |||
288 | #define MSGID_SET_RF_AGC_SEL 0x12 | ||
289 | struct bcm3510_hab_cmd_set_agc { | ||
290 | u8 LVL :1; | ||
291 | u8 unused :6; | ||
292 | u8 SEL :1; | ||
293 | } PACKED; | ||
294 | |||
295 | #define MSGID_SET_AUTO_INVERSION 0x14 | ||
296 | struct bcm3510_hab_cmd_auto_inversion { | ||
297 | u8 AI :1; | ||
298 | u8 unused :7; | ||
299 | } PACKED; | ||
300 | |||
301 | |||
302 | /* bert control */ | ||
303 | #define CMD_STATE_CONTROL 0x12 | ||
304 | #define MSGID_BERT_CONTROL 0x0e | ||
305 | #define MSGID_BERT_SET 0xfa | ||
306 | struct bcm3510_hab_cmd_bert_control { | ||
307 | u8 BE :1; | ||
308 | u8 unused :7; | ||
309 | } PACKED; | ||
310 | |||
311 | #define MSGID_TRI_STATE 0x2e | ||
312 | struct bcm3510_hab_cmd_tri_state { | ||
313 | u8 RE :1; /* a/d ram port pins */ | ||
314 | u8 PE :1; /* baud clock pin */ | ||
315 | u8 AC :1; /* a/d clock pin */ | ||
316 | u8 BE :1; /* baud clock pin */ | ||
317 | u8 unused :4; | ||
318 | } PACKED; | ||
319 | |||
320 | |||
321 | /* tune */ | ||
322 | #define CMD_TUNE 0x38 | ||
323 | #define MSGID_TUNE 0x16 | ||
324 | struct bcm3510_hab_cmd_tune_ctrl_data_pair { | ||
325 | struct { | ||
326 | #define BITS_8 0x07 | ||
327 | #define BITS_7 0x06 | ||
328 | #define BITS_6 0x05 | ||
329 | #define BITS_5 0x04 | ||
330 | #define BITS_4 0x03 | ||
331 | #define BITS_3 0x02 | ||
332 | #define BITS_2 0x01 | ||
333 | #define BITS_1 0x00 | ||
334 | u8 size :3; | ||
335 | u8 unk :2; | ||
336 | u8 clk_off :1; | ||
337 | u8 cs0 :1; | ||
338 | u8 cs1 :1; | ||
339 | |||
340 | } PACKED ctrl; | ||
341 | |||
342 | u8 data; | ||
343 | } PACKED; | ||
344 | |||
345 | struct bcm3510_hab_cmd_tune { | ||
346 | u8 length; | ||
347 | u8 clock_width; | ||
348 | u8 misc; | ||
349 | u8 TUNCTL_state; | ||
350 | |||
351 | struct bcm3510_hab_cmd_tune_ctrl_data_pair ctl_dat[16]; | ||
352 | } PACKED; | ||
353 | |||
354 | #define CMD_STATUS 0x38 | ||
355 | #define MSGID_STATUS1 0x08 | ||
356 | struct bcm3510_hab_cmd_status1 { | ||
357 | struct { | ||
358 | u8 EQ_MODE :4; | ||
359 | u8 reserved :2; | ||
360 | u8 QRE :1; /* if QSE and the spectrum is inversed */ | ||
361 | u8 QSE :1; /* automatic spectral inversion */ | ||
362 | } PACKED STATUS0; | ||
363 | |||
364 | struct { | ||
365 | u8 RECEIVER_LOCK :1; | ||
366 | u8 FEC_LOCK :1; | ||
367 | u8 OUT_PLL_LOCK :1; | ||
368 | u8 reserved :5; | ||
369 | } PACKED STATUS1; | ||
370 | |||
371 | struct { | ||
372 | u8 reserved :2; | ||
373 | u8 BW :1; | ||
374 | u8 NTE :1; /* NTSC filter sweep enabled */ | ||
375 | u8 AQI :1; /* currently acquiring */ | ||
376 | u8 FA :1; /* fast acquisition */ | ||
377 | u8 ARI :1; /* auto reacquire */ | ||
378 | u8 TI :1; /* programming the tuner */ | ||
379 | } PACKED STATUS2; | ||
380 | u8 STATUS3; | ||
381 | u8 SNR_EST0; | ||
382 | u8 SNR_EST1; | ||
383 | u8 TUNER_FREQ0; | ||
384 | u8 TUNER_FREQ1; | ||
385 | u8 TUNER_FREQ2; | ||
386 | u8 TUNER_FREQ3; | ||
387 | u8 SYM_RATE0; | ||
388 | u8 SYM_RATE1; | ||
389 | u8 SYM_RATE2; | ||
390 | u8 SYM_RATE3; | ||
391 | u8 SYM_OFFSET0; | ||
392 | u8 SYM_OFFSET1; | ||
393 | u8 SYM_ERROR0; | ||
394 | u8 SYM_ERROR1; | ||
395 | u8 IF_FREQ0; | ||
396 | u8 IF_FREQ1; | ||
397 | u8 IF_FREQ2; | ||
398 | u8 IF_FREQ3; | ||
399 | u8 IF_OFFSET0; | ||
400 | u8 IF_OFFSET1; | ||
401 | u8 IF_ERROR0; | ||
402 | u8 IF_ERROR1; | ||
403 | u8 NTSC_FILTER0; | ||
404 | u8 NTSC_FILTER1; | ||
405 | u8 NTSC_FILTER2; | ||
406 | u8 NTSC_FILTER3; | ||
407 | u8 NTSC_OFFSET0; | ||
408 | u8 NTSC_OFFSET1; | ||
409 | u8 NTSC_ERROR0; | ||
410 | u8 NTSC_ERROR1; | ||
411 | u8 INT_AGC_LEVEL0; | ||
412 | u8 INT_AGC_LEVEL1; | ||
413 | u8 EXT_AGC_LEVEL0; | ||
414 | u8 EXT_AGC_LEVEL1; | ||
415 | } PACKED; | ||
416 | |||
417 | #define MSGID_STATUS2 0x14 | ||
418 | struct bcm3510_hab_cmd_status2 { | ||
419 | struct { | ||
420 | u8 EQ_MODE :4; | ||
421 | u8 reserved :2; | ||
422 | u8 QRE :1; | ||
423 | u8 QSR :1; | ||
424 | } PACKED STATUS0; | ||
425 | struct { | ||
426 | u8 RL :1; | ||
427 | u8 FL :1; | ||
428 | u8 OL :1; | ||
429 | u8 reserved :5; | ||
430 | } PACKED STATUS1; | ||
431 | u8 SYMBOL_RATE0; | ||
432 | u8 SYMBOL_RATE1; | ||
433 | u8 SYMBOL_RATE2; | ||
434 | u8 SYMBOL_RATE3; | ||
435 | u8 LDCERC0; | ||
436 | u8 LDCERC1; | ||
437 | u8 LDCERC2; | ||
438 | u8 LDCERC3; | ||
439 | u8 LDUERC0; | ||
440 | u8 LDUERC1; | ||
441 | u8 LDUERC2; | ||
442 | u8 LDUERC3; | ||
443 | u8 LDBER0; | ||
444 | u8 LDBER1; | ||
445 | u8 LDBER2; | ||
446 | u8 LDBER3; | ||
447 | struct { | ||
448 | u8 MODE_TYPE :4; /* acquire mode 0 */ | ||
449 | u8 reservd :4; | ||
450 | } MODE_TYPE; | ||
451 | u8 SNR_EST0; | ||
452 | u8 SNR_EST1; | ||
453 | u8 SIGNAL; | ||
454 | } PACKED; | ||
455 | |||
456 | #define CMD_SET_RF_BW_NOT_LISTED 0x3f | ||
457 | #define MSGID_SET_RF_BW_NOT_LISTED 0x11 | ||
458 | /* TODO */ | ||
459 | |||
460 | #endif | ||
diff --git a/drivers/media/dvb/frontends/cx22702.c b/drivers/media/dvb/frontends/cx22702.c index f4aa44136c7c..9f639297a9f2 100644 --- a/drivers/media/dvb/frontends/cx22702.c +++ b/drivers/media/dvb/frontends/cx22702.c | |||
@@ -76,7 +76,6 @@ static u8 init_tab [] = { | |||
76 | 0x49, 0x56, | 76 | 0x49, 0x56, |
77 | 0x6b, 0x1e, | 77 | 0x6b, 0x1e, |
78 | 0xc8, 0x02, | 78 | 0xc8, 0x02, |
79 | 0xf8, 0x02, | ||
80 | 0xf9, 0x00, | 79 | 0xf9, 0x00, |
81 | 0xfa, 0x00, | 80 | 0xfa, 0x00, |
82 | 0xfb, 0x00, | 81 | 0xfb, 0x00, |
@@ -203,7 +202,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
203 | struct cx22702_state* state = fe->demodulator_priv; | 202 | struct cx22702_state* state = fe->demodulator_priv; |
204 | 203 | ||
205 | /* set PLL */ | 204 | /* set PLL */ |
206 | cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) &0xfe); | 205 | cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) &0xfe); |
207 | if (state->config->pll_set) { | 206 | if (state->config->pll_set) { |
208 | state->config->pll_set(fe, p); | 207 | state->config->pll_set(fe, p); |
209 | } else if (state->config->pll_desc) { | 208 | } else if (state->config->pll_desc) { |
@@ -217,7 +216,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
217 | } else { | 216 | } else { |
218 | BUG(); | 217 | BUG(); |
219 | } | 218 | } |
220 | cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1); | 219 | cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1); |
221 | 220 | ||
222 | /* set inversion */ | 221 | /* set inversion */ |
223 | cx22702_set_inversion (state, p->inversion); | 222 | cx22702_set_inversion (state, p->inversion); |
@@ -256,7 +255,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
256 | cx22702_writereg(state, 0x0B, cx22702_readreg(state, 0x0B) & 0xfc ); | 255 | cx22702_writereg(state, 0x0B, cx22702_readreg(state, 0x0B) & 0xfc ); |
257 | cx22702_writereg(state, 0x0C, (cx22702_readreg(state, 0x0C) & 0xBF) | 0x40 ); | 256 | cx22702_writereg(state, 0x0C, (cx22702_readreg(state, 0x0C) & 0xBF) | 0x40 ); |
258 | cx22702_writereg(state, 0x00, 0x01); /* Begin aquisition */ | 257 | cx22702_writereg(state, 0x00, 0x01); /* Begin aquisition */ |
259 | printk("%s: Autodetecting\n",__FUNCTION__); | 258 | dprintk("%s: Autodetecting\n",__FUNCTION__); |
260 | return 0; | 259 | return 0; |
261 | } | 260 | } |
262 | 261 | ||
@@ -347,10 +346,11 @@ static int cx22702_init (struct dvb_frontend* fe) | |||
347 | for (i=0; i<sizeof(init_tab); i+=2) | 346 | for (i=0; i<sizeof(init_tab); i+=2) |
348 | cx22702_writereg (state, init_tab[i], init_tab[i+1]); | 347 | cx22702_writereg (state, init_tab[i], init_tab[i+1]); |
349 | 348 | ||
349 | cx22702_writereg (state, 0xf8, (state->config->output_mode << 1) & 0x02); | ||
350 | 350 | ||
351 | /* init PLL */ | 351 | /* init PLL */ |
352 | if (state->config->pll_init) { | 352 | if (state->config->pll_init) { |
353 | cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) &0xfe); | 353 | cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) & 0xfe); |
354 | state->config->pll_init(fe); | 354 | state->config->pll_init(fe); |
355 | cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1); | 355 | cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1); |
356 | } | 356 | } |
@@ -440,8 +440,10 @@ static int cx22702_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
440 | 440 | ||
441 | /* RS Uncorrectable Packet Count then reset */ | 441 | /* RS Uncorrectable Packet Count then reset */ |
442 | _ucblocks = cx22702_readreg (state, 0xE3); | 442 | _ucblocks = cx22702_readreg (state, 0xE3); |
443 | if (state->prevUCBlocks < _ucblocks) *ucblocks = (_ucblocks - state->prevUCBlocks); | 443 | if (state->prevUCBlocks < _ucblocks) |
444 | else *ucblocks = state->prevUCBlocks - _ucblocks; | 444 | *ucblocks = (_ucblocks - state->prevUCBlocks); |
445 | else | ||
446 | *ucblocks = state->prevUCBlocks - _ucblocks; | ||
445 | state->prevUCBlocks = _ucblocks; | 447 | state->prevUCBlocks = _ucblocks; |
446 | 448 | ||
447 | return 0; | 449 | return 0; |
@@ -457,6 +459,12 @@ static int cx22702_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
457 | return cx22702_get_tps (state, &p->u.ofdm); | 459 | return cx22702_get_tps (state, &p->u.ofdm); |
458 | } | 460 | } |
459 | 461 | ||
462 | static int cx22702_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) | ||
463 | { | ||
464 | tune->min_delay_ms = 1000; | ||
465 | return 0; | ||
466 | } | ||
467 | |||
460 | static void cx22702_release(struct dvb_frontend* fe) | 468 | static void cx22702_release(struct dvb_frontend* fe) |
461 | { | 469 | { |
462 | struct cx22702_state* state = fe->demodulator_priv; | 470 | struct cx22702_state* state = fe->demodulator_priv; |
@@ -472,7 +480,8 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, | |||
472 | 480 | ||
473 | /* allocate memory for the internal state */ | 481 | /* allocate memory for the internal state */ |
474 | state = kmalloc(sizeof(struct cx22702_state), GFP_KERNEL); | 482 | state = kmalloc(sizeof(struct cx22702_state), GFP_KERNEL); |
475 | if (state == NULL) goto error; | 483 | if (state == NULL) |
484 | goto error; | ||
476 | 485 | ||
477 | /* setup the state */ | 486 | /* setup the state */ |
478 | state->config = config; | 487 | state->config = config; |
@@ -481,7 +490,8 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, | |||
481 | state->prevUCBlocks = 0; | 490 | state->prevUCBlocks = 0; |
482 | 491 | ||
483 | /* check if the demod is there */ | 492 | /* check if the demod is there */ |
484 | if (cx22702_readreg(state, 0x1f) != 0x3) goto error; | 493 | if (cx22702_readreg(state, 0x1f) != 0x3) |
494 | goto error; | ||
485 | 495 | ||
486 | /* create dvb_frontend */ | 496 | /* create dvb_frontend */ |
487 | state->frontend.ops = &state->ops; | 497 | state->frontend.ops = &state->ops; |
@@ -514,6 +524,7 @@ static struct dvb_frontend_ops cx22702_ops = { | |||
514 | 524 | ||
515 | .set_frontend = cx22702_set_tps, | 525 | .set_frontend = cx22702_set_tps, |
516 | .get_frontend = cx22702_get_frontend, | 526 | .get_frontend = cx22702_get_frontend, |
527 | .get_tune_settings = cx22702_get_tune_settings, | ||
517 | 528 | ||
518 | .read_status = cx22702_read_status, | 529 | .read_status = cx22702_read_status, |
519 | .read_ber = cx22702_read_ber, | 530 | .read_ber = cx22702_read_ber, |
diff --git a/drivers/media/dvb/frontends/cx22702.h b/drivers/media/dvb/frontends/cx22702.h index 559fdb906669..11f86806756e 100644 --- a/drivers/media/dvb/frontends/cx22702.h +++ b/drivers/media/dvb/frontends/cx22702.h | |||
@@ -35,6 +35,11 @@ struct cx22702_config | |||
35 | /* the demodulator's i2c address */ | 35 | /* the demodulator's i2c address */ |
36 | u8 demod_address; | 36 | u8 demod_address; |
37 | 37 | ||
38 | /* serial/parallel output */ | ||
39 | #define CX22702_PARALLEL_OUTPUT 0 | ||
40 | #define CX22702_SERIAL_OUTPUT 1 | ||
41 | u8 output_mode; | ||
42 | |||
38 | /* PLL maintenance */ | 43 | /* PLL maintenance */ |
39 | u8 pll_address; | 44 | u8 pll_address; |
40 | struct dvb_pll_desc *pll_desc; | 45 | struct dvb_pll_desc *pll_desc; |
diff --git a/drivers/media/dvb/frontends/dib3000-common.c b/drivers/media/dvb/frontends/dib3000-common.c index 47ab02e133d1..1a4f1f7c228a 100644 --- a/drivers/media/dvb/frontends/dib3000-common.c +++ b/drivers/media/dvb/frontends/dib3000-common.c | |||
@@ -73,7 +73,7 @@ u16 dib3000_seq[2][2][2] = /* fft,gua, inv */ | |||
73 | }; | 73 | }; |
74 | 74 | ||
75 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de"); | 75 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de"); |
76 | MODULE_DESCRIPTION("Common functions for the dib3000mb/dib3000mc dvb-frontend drivers"); | 76 | MODULE_DESCRIPTION("Common functions for the dib3000mb/dib3000mc dvb frontend drivers"); |
77 | MODULE_LICENSE("GPL"); | 77 | MODULE_LICENSE("GPL"); |
78 | 78 | ||
79 | EXPORT_SYMBOL(dib3000_seq); | 79 | EXPORT_SYMBOL(dib3000_seq); |
diff --git a/drivers/media/dvb/frontends/dib3000.h b/drivers/media/dvb/frontends/dib3000.h index 80687c130836..2d5475b5c063 100644 --- a/drivers/media/dvb/frontends/dib3000.h +++ b/drivers/media/dvb/frontends/dib3000.h | |||
@@ -32,9 +32,8 @@ struct dib3000_config | |||
32 | u8 demod_address; | 32 | u8 demod_address; |
33 | 33 | ||
34 | /* PLL maintenance and the i2c address of the PLL */ | 34 | /* PLL maintenance and the i2c address of the PLL */ |
35 | u8 (*pll_addr)(struct dvb_frontend *fe); | 35 | int (*pll_init)(struct dvb_frontend *fe); |
36 | int (*pll_init)(struct dvb_frontend *fe, u8 pll_buf[5]); | 36 | int (*pll_set)(struct dvb_frontend *fe, struct dvb_frontend_parameters* params); |
37 | int (*pll_set)(struct dvb_frontend *fe, struct dvb_frontend_parameters* params, u8 pll_buf[5]); | ||
38 | }; | 37 | }; |
39 | 38 | ||
40 | struct dib_fe_xfer_ops | 39 | struct dib_fe_xfer_ops |
diff --git a/drivers/media/dvb/frontends/dib3000mb.c b/drivers/media/dvb/frontends/dib3000mb.c index 6f52d649e97e..cd434b7cf9db 100644 --- a/drivers/media/dvb/frontends/dib3000mb.c +++ b/drivers/media/dvb/frontends/dib3000mb.c | |||
@@ -48,8 +48,6 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe (|-a | |||
48 | #define deb_setf(args...) dprintk(0x04,args) | 48 | #define deb_setf(args...) dprintk(0x04,args) |
49 | #define deb_getf(args...) dprintk(0x08,args) | 49 | #define deb_getf(args...) dprintk(0x08,args) |
50 | 50 | ||
51 | static int dib3000mb_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_addr); | ||
52 | |||
53 | static int dib3000mb_get_frontend(struct dvb_frontend* fe, | 51 | static int dib3000mb_get_frontend(struct dvb_frontend* fe, |
54 | struct dvb_frontend_parameters *fep); | 52 | struct dvb_frontend_parameters *fep); |
55 | 53 | ||
@@ -61,10 +59,8 @@ static int dib3000mb_set_frontend(struct dvb_frontend* fe, | |||
61 | fe_code_rate_t fe_cr = FEC_NONE; | 59 | fe_code_rate_t fe_cr = FEC_NONE; |
62 | int search_state, seq; | 60 | int search_state, seq; |
63 | 61 | ||
64 | if (tuner && state->config.pll_addr && state->config.pll_set) { | 62 | if (tuner && state->config.pll_set) { |
65 | dib3000mb_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); | 63 | state->config.pll_set(fe, fep); |
66 | state->config.pll_set(fe, fep, NULL); | ||
67 | dib3000mb_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); | ||
68 | 64 | ||
69 | deb_setf("bandwidth: "); | 65 | deb_setf("bandwidth: "); |
70 | switch (ofdm->bandwidth) { | 66 | switch (ofdm->bandwidth) { |
@@ -389,11 +385,8 @@ static int dib3000mb_fe_init(struct dvb_frontend* fe, int mobile_mode) | |||
389 | 385 | ||
390 | wr(DIB3000MB_REG_DATA_IN_DIVERSITY, DIB3000MB_DATA_DIVERSITY_IN_OFF); | 386 | wr(DIB3000MB_REG_DATA_IN_DIVERSITY, DIB3000MB_DATA_DIVERSITY_IN_OFF); |
391 | 387 | ||
392 | if (state->config.pll_init) { | 388 | if (state->config.pll_init) |
393 | dib3000mb_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); | 389 | state->config.pll_init(fe); |
394 | state->config.pll_init(fe,NULL); | ||
395 | dib3000mb_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); | ||
396 | } | ||
397 | 390 | ||
398 | return 0; | 391 | return 0; |
399 | } | 392 | } |
@@ -623,7 +616,7 @@ static int dib3000mb_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | |||
623 | { | 616 | { |
624 | struct dib3000_state* state = fe->demodulator_priv; | 617 | struct dib3000_state* state = fe->demodulator_priv; |
625 | 618 | ||
626 | *unc = rd(DIB3000MB_REG_UNC); | 619 | *unc = rd(DIB3000MB_REG_PACKET_ERROR_RATE); |
627 | return 0; | 620 | return 0; |
628 | } | 621 | } |
629 | 622 | ||
@@ -638,9 +631,6 @@ static int dib3000mb_sleep(struct dvb_frontend* fe) | |||
638 | static int dib3000mb_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) | 631 | static int dib3000mb_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) |
639 | { | 632 | { |
640 | tune->min_delay_ms = 800; | 633 | tune->min_delay_ms = 800; |
641 | tune->step_size = 166667; | ||
642 | tune->max_drift = 166667 * 2; | ||
643 | |||
644 | return 0; | 634 | return 0; |
645 | } | 635 | } |
646 | 636 | ||
diff --git a/drivers/media/dvb/frontends/dib3000mb_priv.h b/drivers/media/dvb/frontends/dib3000mb_priv.h index 57e61aa5b07b..999b19047816 100644 --- a/drivers/media/dvb/frontends/dib3000mb_priv.h +++ b/drivers/media/dvb/frontends/dib3000mb_priv.h | |||
@@ -294,7 +294,7 @@ static u16 dib3000mb_reg_filter_coeffs[] = { | |||
294 | 294 | ||
295 | static u16 dib3000mb_filter_coeffs[] = { | 295 | static u16 dib3000mb_filter_coeffs[] = { |
296 | 226, 160, 29, | 296 | 226, 160, 29, |
297 | 979, 998, 19, | 297 | 979, 998, 19, |
298 | 22, 1019, 1006, | 298 | 22, 1019, 1006, |
299 | 1022, 12, 6, | 299 | 1022, 12, 6, |
300 | 1017, 1017, 3, | 300 | 1017, 1017, 3, |
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index 888f10a5e96b..cd33705a4320 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c | |||
@@ -48,8 +48,6 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe,16=s | |||
48 | #define deb_getf(args...) dprintk(0x08,args) | 48 | #define deb_getf(args...) dprintk(0x08,args) |
49 | #define deb_stat(args...) dprintk(0x10,args) | 49 | #define deb_stat(args...) dprintk(0x10,args) |
50 | 50 | ||
51 | static int dib3000mc_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_addr); | ||
52 | |||
53 | static int dib3000mc_set_impulse_noise(struct dib3000_state * state, int mode, | 51 | static int dib3000mc_set_impulse_noise(struct dib3000_state * state, int mode, |
54 | fe_transmit_mode_t transmission_mode, fe_bandwidth_t bandwidth) | 52 | fe_transmit_mode_t transmission_mode, fe_bandwidth_t bandwidth) |
55 | { | 53 | { |
@@ -463,10 +461,8 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, | |||
463 | int search_state,auto_val; | 461 | int search_state,auto_val; |
464 | u16 val; | 462 | u16 val; |
465 | 463 | ||
466 | if (tuner && state->config.pll_addr && state->config.pll_set) { /* initial call from dvb */ | 464 | if (tuner && state->config.pll_set) { /* initial call from dvb */ |
467 | dib3000mc_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); | 465 | state->config.pll_set(fe,fep); |
468 | state->config.pll_set(fe,fep,NULL); | ||
469 | dib3000mc_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); | ||
470 | 466 | ||
471 | state->last_tuned_freq = fep->frequency; | 467 | state->last_tuned_freq = fep->frequency; |
472 | // if (!scanboost) { | 468 | // if (!scanboost) { |
@@ -554,19 +550,15 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, | |||
554 | dib3000mc_set_adp_cfg(state,ofdm->constellation); | 550 | dib3000mc_set_adp_cfg(state,ofdm->constellation); |
555 | wr_foreach(dib3000mc_reg_offset, | 551 | wr_foreach(dib3000mc_reg_offset, |
556 | dib3000mc_offset[(ofdm->transmission_mode == TRANSMISSION_MODE_8K)+1]); | 552 | dib3000mc_offset[(ofdm->transmission_mode == TRANSMISSION_MODE_8K)+1]); |
557 | |||
558 | |||
559 | } | 553 | } |
560 | return 0; | 554 | return 0; |
561 | } | 555 | } |
562 | 556 | ||
563 | static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) | 557 | static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) |
564 | { | 558 | { |
565 | struct dib3000_state *state; | 559 | struct dib3000_state *state = fe->demodulator_priv; |
566 | |||
567 | deb_info("init start\n"); | 560 | deb_info("init start\n"); |
568 | 561 | ||
569 | state = fe->demodulator_priv; | ||
570 | state->timing_offset = 0; | 562 | state->timing_offset = 0; |
571 | state->timing_offset_comp_done = 0; | 563 | state->timing_offset_comp_done = 0; |
572 | 564 | ||
@@ -649,11 +641,9 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) | |||
649 | 641 | ||
650 | set_or(DIB3000MC_REG_CLK_CFG_7,DIB3000MC_CLK_CFG_7_DIV_IN_OFF); | 642 | set_or(DIB3000MC_REG_CLK_CFG_7,DIB3000MC_CLK_CFG_7_DIV_IN_OFF); |
651 | 643 | ||
652 | /* if (state->config->pll_init) { | 644 | if (state->config.pll_init) |
653 | dib3000mc_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); | 645 | state->config.pll_init(fe); |
654 | state->config->pll_init(fe,NULL); | 646 | |
655 | dib3000mc_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); | ||
656 | }*/ | ||
657 | deb_info("init end\n"); | 647 | deb_info("init end\n"); |
658 | return 0; | 648 | return 0; |
659 | } | 649 | } |
@@ -688,7 +678,7 @@ static int dib3000mc_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | |||
688 | { | 678 | { |
689 | struct dib3000_state* state = fe->demodulator_priv; | 679 | struct dib3000_state* state = fe->demodulator_priv; |
690 | 680 | ||
691 | *unc = rd(DIB3000MC_REG_PACKET_ERROR_COUNT); | 681 | *unc = rd(DIB3000MC_REG_PACKET_ERRORS); |
692 | return 0; | 682 | return 0; |
693 | } | 683 | } |
694 | 684 | ||
@@ -737,10 +727,7 @@ static int dib3000mc_sleep(struct dvb_frontend* fe) | |||
737 | 727 | ||
738 | static int dib3000mc_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) | 728 | static int dib3000mc_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) |
739 | { | 729 | { |
740 | tune->min_delay_ms = 2000; | 730 | tune->min_delay_ms = 1000; |
741 | tune->step_size = 166667; | ||
742 | tune->max_drift = 166667 * 2; | ||
743 | |||
744 | return 0; | 731 | return 0; |
745 | } | 732 | } |
746 | 733 | ||
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index 2a3c2ce7b2aa..536c35d969b7 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: dvb-pll.c,v 1.7 2005/02/10 11:52:02 kraxel Exp $ | ||
3 | * | ||
4 | * descriptions + helper functions for simple dvb plls. | 2 | * descriptions + helper functions for simple dvb plls. |
5 | * | 3 | * |
6 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] | 4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
@@ -57,7 +55,7 @@ struct dvb_pll_desc dvb_pll_thomson_dtt7610 = { | |||
57 | }; | 55 | }; |
58 | EXPORT_SYMBOL(dvb_pll_thomson_dtt7610); | 56 | EXPORT_SYMBOL(dvb_pll_thomson_dtt7610); |
59 | 57 | ||
60 | static void thomson_dtt759x_bw(u8 *buf, int bandwidth) | 58 | static void thomson_dtt759x_bw(u8 *buf, u32 freq, int bandwidth) |
61 | { | 59 | { |
62 | if (BANDWIDTH_7_MHZ == bandwidth) | 60 | if (BANDWIDTH_7_MHZ == bandwidth) |
63 | buf[3] |= 0x10; | 61 | buf[3] |= 0x10; |
@@ -84,17 +82,44 @@ struct dvb_pll_desc dvb_pll_lg_z201 = { | |||
84 | .name = "LG z201", | 82 | .name = "LG z201", |
85 | .min = 174000000, | 83 | .min = 174000000, |
86 | .max = 862000000, | 84 | .max = 862000000, |
87 | .count = 5, | 85 | .count = 6, |
88 | .entries = { | 86 | .entries = { |
89 | { 0, 36166667, 166666, 0xbc, 0x03 }, | 87 | { 0, 36166667, 166666, 0xbc, 0x03 }, |
90 | { 443250000, 36166667, 166666, 0xbc, 0x01 }, | 88 | { 157500000, 36166667, 166666, 0xbc, 0x01 }, |
91 | { 542000000, 36166667, 166666, 0xbc, 0x02 }, | 89 | { 443250000, 36166667, 166666, 0xbc, 0x02 }, |
92 | { 830000000, 36166667, 166666, 0xf4, 0x02 }, | 90 | { 542000000, 36166667, 166666, 0xbc, 0x04 }, |
93 | { 999999999, 36166667, 166666, 0xfc, 0x02 }, | 91 | { 830000000, 36166667, 166666, 0xf4, 0x04 }, |
92 | { 999999999, 36166667, 166666, 0xfc, 0x04 }, | ||
94 | }, | 93 | }, |
95 | }; | 94 | }; |
96 | EXPORT_SYMBOL(dvb_pll_lg_z201); | 95 | EXPORT_SYMBOL(dvb_pll_lg_z201); |
97 | 96 | ||
97 | struct dvb_pll_desc dvb_pll_microtune_4042 = { | ||
98 | .name = "Microtune 4042 FI5", | ||
99 | .min = 57000000, | ||
100 | .max = 858000000, | ||
101 | .count = 3, | ||
102 | .entries = { | ||
103 | { 162000000, 44000000, 62500, 0x8e, 0xa1 }, | ||
104 | { 457000000, 44000000, 62500, 0x8e, 0x91 }, | ||
105 | { 999999999, 44000000, 62500, 0x8e, 0x31 }, | ||
106 | }, | ||
107 | }; | ||
108 | EXPORT_SYMBOL(dvb_pll_microtune_4042); | ||
109 | |||
110 | struct dvb_pll_desc dvb_pll_thomson_dtt7611 = { | ||
111 | .name = "Thomson dtt7611", | ||
112 | .min = 44000000, | ||
113 | .max = 958000000, | ||
114 | .count = 3, | ||
115 | .entries = { | ||
116 | { 157250000, 44000000, 62500, 0x8e, 0x39 }, | ||
117 | { 454000000, 44000000, 62500, 0x8e, 0x3a }, | ||
118 | { 999999999, 44000000, 62500, 0x8e, 0x3c }, | ||
119 | }, | ||
120 | }; | ||
121 | EXPORT_SYMBOL(dvb_pll_thomson_dtt7611); | ||
122 | |||
98 | struct dvb_pll_desc dvb_pll_unknown_1 = { | 123 | struct dvb_pll_desc dvb_pll_unknown_1 = { |
99 | .name = "unknown 1", /* used by dntv live dvb-t */ | 124 | .name = "unknown 1", /* used by dntv live dvb-t */ |
100 | .min = 174000000, | 125 | .min = 174000000, |
@@ -114,6 +139,159 @@ struct dvb_pll_desc dvb_pll_unknown_1 = { | |||
114 | }; | 139 | }; |
115 | EXPORT_SYMBOL(dvb_pll_unknown_1); | 140 | EXPORT_SYMBOL(dvb_pll_unknown_1); |
116 | 141 | ||
142 | /* Infineon TUA6010XS | ||
143 | * used in Thomson Cable Tuner | ||
144 | */ | ||
145 | struct dvb_pll_desc dvb_pll_tua6010xs = { | ||
146 | .name = "Infineon TUA6010XS", | ||
147 | .min = 44250000, | ||
148 | .max = 858000000, | ||
149 | .count = 3, | ||
150 | .entries = { | ||
151 | { 115750000, 36125000, 62500, 0x8e, 0x03 }, | ||
152 | { 403250000, 36125000, 62500, 0x8e, 0x06 }, | ||
153 | { 999999999, 36125000, 62500, 0x8e, 0x85 }, | ||
154 | }, | ||
155 | }; | ||
156 | EXPORT_SYMBOL(dvb_pll_tua6010xs); | ||
157 | |||
158 | /* Panasonic env57h1xd5 (some Philips PLL ?) */ | ||
159 | struct dvb_pll_desc dvb_pll_env57h1xd5 = { | ||
160 | .name = "Panasonic ENV57H1XD5", | ||
161 | .min = 44250000, | ||
162 | .max = 858000000, | ||
163 | .count = 4, | ||
164 | .entries = { | ||
165 | { 153000000, 36291666, 166666, 0xc2, 0x41 }, | ||
166 | { 470000000, 36291666, 166666, 0xc2, 0x42 }, | ||
167 | { 526000000, 36291666, 166666, 0xc2, 0x84 }, | ||
168 | { 999999999, 36291666, 166666, 0xc2, 0xa4 }, | ||
169 | }, | ||
170 | }; | ||
171 | EXPORT_SYMBOL(dvb_pll_env57h1xd5); | ||
172 | |||
173 | /* Philips TDA6650/TDA6651 | ||
174 | * used in Panasonic ENV77H11D5 | ||
175 | */ | ||
176 | static void tda665x_bw(u8 *buf, u32 freq, int bandwidth) | ||
177 | { | ||
178 | if (bandwidth == BANDWIDTH_8_MHZ) | ||
179 | buf[3] |= 0x08; | ||
180 | } | ||
181 | |||
182 | struct dvb_pll_desc dvb_pll_tda665x = { | ||
183 | .name = "Philips TDA6650/TDA6651", | ||
184 | .min = 44250000, | ||
185 | .max = 858000000, | ||
186 | .setbw = tda665x_bw, | ||
187 | .count = 12, | ||
188 | .entries = { | ||
189 | { 93834000, 36249333, 166667, 0xca, 0x61 /* 011 0 0 0 01 */ }, | ||
190 | { 123834000, 36249333, 166667, 0xca, 0xa1 /* 101 0 0 0 01 */ }, | ||
191 | { 161000000, 36249333, 166667, 0xca, 0xa1 /* 101 0 0 0 01 */ }, | ||
192 | { 163834000, 36249333, 166667, 0xca, 0xc2 /* 110 0 0 0 10 */ }, | ||
193 | { 253834000, 36249333, 166667, 0xca, 0x62 /* 011 0 0 0 10 */ }, | ||
194 | { 383834000, 36249333, 166667, 0xca, 0xa2 /* 101 0 0 0 10 */ }, | ||
195 | { 443834000, 36249333, 166667, 0xca, 0xc2 /* 110 0 0 0 10 */ }, | ||
196 | { 444000000, 36249333, 166667, 0xca, 0xc3 /* 110 0 0 0 11 */ }, | ||
197 | { 583834000, 36249333, 166667, 0xca, 0x63 /* 011 0 0 0 11 */ }, | ||
198 | { 793834000, 36249333, 166667, 0xca, 0xa3 /* 101 0 0 0 11 */ }, | ||
199 | { 444834000, 36249333, 166667, 0xca, 0xc3 /* 110 0 0 0 11 */ }, | ||
200 | { 861000000, 36249333, 166667, 0xca, 0xe3 /* 111 0 0 0 11 */ }, | ||
201 | } | ||
202 | }; | ||
203 | EXPORT_SYMBOL(dvb_pll_tda665x); | ||
204 | |||
205 | /* Infineon TUA6034 | ||
206 | * used in LG TDTP E102P | ||
207 | */ | ||
208 | static void tua6034_bw(u8 *buf, u32 freq, int bandwidth) | ||
209 | { | ||
210 | if (BANDWIDTH_7_MHZ != bandwidth) | ||
211 | buf[3] |= 0x08; | ||
212 | } | ||
213 | |||
214 | struct dvb_pll_desc dvb_pll_tua6034 = { | ||
215 | .name = "Infineon TUA6034", | ||
216 | .min = 44250000, | ||
217 | .max = 858000000, | ||
218 | .count = 3, | ||
219 | .setbw = tua6034_bw, | ||
220 | .entries = { | ||
221 | { 174500000, 36166667, 62500, 0xce, 0x01 }, | ||
222 | { 230000000, 36166667, 62500, 0xce, 0x02 }, | ||
223 | { 999999999, 36166667, 62500, 0xce, 0x04 }, | ||
224 | }, | ||
225 | }; | ||
226 | EXPORT_SYMBOL(dvb_pll_tua6034); | ||
227 | |||
228 | /* Infineon TUA6034 | ||
229 | * used in LG Innotek TDVS-H062F | ||
230 | */ | ||
231 | struct dvb_pll_desc dvb_pll_tdvs_tua6034 = { | ||
232 | .name = "LG/Infineon TUA6034", | ||
233 | .min = 54000000, | ||
234 | .max = 863000000, | ||
235 | .count = 3, | ||
236 | .entries = { | ||
237 | { 160000000, 44000000, 62500, 0xce, 0x01 }, | ||
238 | { 455000000, 44000000, 62500, 0xce, 0x02 }, | ||
239 | { 999999999, 44000000, 62500, 0xce, 0x04 }, | ||
240 | }, | ||
241 | }; | ||
242 | EXPORT_SYMBOL(dvb_pll_tdvs_tua6034); | ||
243 | |||
244 | /* Philips FMD1216ME | ||
245 | * used in Medion Hybrid PCMCIA card and USB Box | ||
246 | */ | ||
247 | static void fmd1216me_bw(u8 *buf, u32 freq, int bandwidth) | ||
248 | { | ||
249 | if (bandwidth == BANDWIDTH_8_MHZ && freq >= 158870000) | ||
250 | buf[3] |= 0x08; | ||
251 | } | ||
252 | |||
253 | struct dvb_pll_desc dvb_pll_fmd1216me = { | ||
254 | .name = "Philips FMD1216ME", | ||
255 | .min = 50870000, | ||
256 | .max = 858000000, | ||
257 | .setbw = fmd1216me_bw, | ||
258 | .count = 7, | ||
259 | .entries = { | ||
260 | { 143870000, 36213333, 166667, 0xbc, 0x41 }, | ||
261 | { 158870000, 36213333, 166667, 0xf4, 0x41 }, | ||
262 | { 329870000, 36213333, 166667, 0xbc, 0x42 }, | ||
263 | { 441870000, 36213333, 166667, 0xf4, 0x42 }, | ||
264 | { 625870000, 36213333, 166667, 0xbc, 0x44 }, | ||
265 | { 803870000, 36213333, 166667, 0xf4, 0x44 }, | ||
266 | { 999999999, 36213333, 166667, 0xfc, 0x44 }, | ||
267 | } | ||
268 | }; | ||
269 | EXPORT_SYMBOL(dvb_pll_fmd1216me); | ||
270 | |||
271 | /* ALPS TDED4 | ||
272 | * used in Nebula-Cards and USB boxes | ||
273 | */ | ||
274 | static void tded4_bw(u8 *buf, u32 freq, int bandwidth) | ||
275 | { | ||
276 | if (bandwidth == BANDWIDTH_8_MHZ) | ||
277 | buf[3] |= 0x04; | ||
278 | } | ||
279 | |||
280 | struct dvb_pll_desc dvb_pll_tded4 = { | ||
281 | .name = "ALPS TDED4", | ||
282 | .min = 47000000, | ||
283 | .max = 863000000, | ||
284 | .setbw = tded4_bw, | ||
285 | .count = 4, | ||
286 | .entries = { | ||
287 | { 153000000, 36166667, 166667, 0x85, 0x01 }, | ||
288 | { 470000000, 36166667, 166667, 0x85, 0x02 }, | ||
289 | { 823000000, 36166667, 166667, 0x85, 0x08 }, | ||
290 | { 999999999, 36166667, 166667, 0x85, 0x88 }, | ||
291 | } | ||
292 | }; | ||
293 | EXPORT_SYMBOL(dvb_pll_tded4); | ||
294 | |||
117 | /* ----------------------------------------------------------- */ | 295 | /* ----------------------------------------------------------- */ |
118 | /* code */ | 296 | /* code */ |
119 | 297 | ||
@@ -147,7 +325,7 @@ int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, | |||
147 | buf[3] = desc->entries[i].cb2; | 325 | buf[3] = desc->entries[i].cb2; |
148 | 326 | ||
149 | if (desc->setbw) | 327 | if (desc->setbw) |
150 | desc->setbw(buf, bandwidth); | 328 | desc->setbw(buf, freq, bandwidth); |
151 | 329 | ||
152 | if (debug) | 330 | if (debug) |
153 | printk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n", | 331 | printk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n", |
@@ -160,9 +338,3 @@ EXPORT_SYMBOL(dvb_pll_configure); | |||
160 | MODULE_DESCRIPTION("dvb pll library"); | 338 | MODULE_DESCRIPTION("dvb pll library"); |
161 | MODULE_AUTHOR("Gerd Knorr"); | 339 | MODULE_AUTHOR("Gerd Knorr"); |
162 | MODULE_LICENSE("GPL"); | 340 | MODULE_LICENSE("GPL"); |
163 | |||
164 | /* | ||
165 | * Local variables: | ||
166 | * c-basic-offset: 8 | ||
167 | * End: | ||
168 | */ | ||
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h index c4c3c56c4a81..205b2d1a8852 100644 --- a/drivers/media/dvb/frontends/dvb-pll.h +++ b/drivers/media/dvb/frontends/dvb-pll.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: dvb-pll.h,v 1.2 2005/02/10 11:43:41 kraxel Exp $ | 2 | * descriptions + helper functions for simple dvb plls. |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef __DVB_PLL_H__ | 5 | #ifndef __DVB_PLL_H__ |
@@ -9,7 +9,7 @@ struct dvb_pll_desc { | |||
9 | char *name; | 9 | char *name; |
10 | u32 min; | 10 | u32 min; |
11 | u32 max; | 11 | u32 max; |
12 | void (*setbw)(u8 *buf, int bandwidth); | 12 | void (*setbw)(u8 *buf, u32 freq, int bandwidth); |
13 | int count; | 13 | int count; |
14 | struct { | 14 | struct { |
15 | u32 limit; | 15 | u32 limit; |
@@ -17,15 +17,25 @@ struct dvb_pll_desc { | |||
17 | u32 stepsize; | 17 | u32 stepsize; |
18 | u8 cb1; | 18 | u8 cb1; |
19 | u8 cb2; | 19 | u8 cb2; |
20 | } entries[9]; | 20 | } entries[12]; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | extern struct dvb_pll_desc dvb_pll_thomson_dtt7579; | 23 | extern struct dvb_pll_desc dvb_pll_thomson_dtt7579; |
24 | extern struct dvb_pll_desc dvb_pll_thomson_dtt759x; | 24 | extern struct dvb_pll_desc dvb_pll_thomson_dtt759x; |
25 | extern struct dvb_pll_desc dvb_pll_thomson_dtt7610; | 25 | extern struct dvb_pll_desc dvb_pll_thomson_dtt7610; |
26 | extern struct dvb_pll_desc dvb_pll_lg_z201; | 26 | extern struct dvb_pll_desc dvb_pll_lg_z201; |
27 | extern struct dvb_pll_desc dvb_pll_microtune_4042; | ||
28 | extern struct dvb_pll_desc dvb_pll_thomson_dtt7611; | ||
27 | extern struct dvb_pll_desc dvb_pll_unknown_1; | 29 | extern struct dvb_pll_desc dvb_pll_unknown_1; |
28 | 30 | ||
31 | extern struct dvb_pll_desc dvb_pll_tua6010xs; | ||
32 | extern struct dvb_pll_desc dvb_pll_env57h1xd5; | ||
33 | extern struct dvb_pll_desc dvb_pll_tua6034; | ||
34 | extern struct dvb_pll_desc dvb_pll_tdvs_tua6034; | ||
35 | extern struct dvb_pll_desc dvb_pll_tda665x; | ||
36 | extern struct dvb_pll_desc dvb_pll_fmd1216me; | ||
37 | extern struct dvb_pll_desc dvb_pll_tded4; | ||
38 | |||
29 | int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, | 39 | int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, |
30 | u32 freq, int bandwidth); | 40 | u32 freq, int bandwidth); |
31 | 41 | ||
diff --git a/drivers/media/dvb/frontends/l64781.c b/drivers/media/dvb/frontends/l64781.c index 031a1ddc7d11..faaad1ae8559 100644 --- a/drivers/media/dvb/frontends/l64781.c +++ b/drivers/media/dvb/frontends/l64781.c | |||
@@ -474,11 +474,12 @@ static int l64781_init(struct dvb_frontend* fe) | |||
474 | return 0; | 474 | return 0; |
475 | } | 475 | } |
476 | 476 | ||
477 | static int l64781_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) | 477 | static int l64781_get_tune_settings(struct dvb_frontend* fe, |
478 | struct dvb_frontend_tune_settings* fesettings) | ||
478 | { | 479 | { |
479 | fesettings->min_delay_ms = 200; | 480 | fesettings->min_delay_ms = 4000; |
480 | fesettings->step_size = 166667; | 481 | fesettings->step_size = 0; |
481 | fesettings->max_drift = 166667*2; | 482 | fesettings->max_drift = 0; |
482 | return 0; | 483 | return 0; |
483 | } | 484 | } |
484 | 485 | ||
diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c new file mode 100644 index 000000000000..1f1cd7a8d500 --- /dev/null +++ b/drivers/media/dvb/frontends/lgdt330x.c | |||
@@ -0,0 +1,796 @@ | |||
1 | /* | ||
2 | * Support for LGDT3302 and LGDT3303 - VSB/QAM | ||
3 | * | ||
4 | * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | /* | ||
23 | * NOTES ABOUT THIS DRIVER | ||
24 | * | ||
25 | * This Linux driver supports: | ||
26 | * DViCO FusionHDTV 3 Gold-Q | ||
27 | * DViCO FusionHDTV 3 Gold-T | ||
28 | * DViCO FusionHDTV 5 Gold | ||
29 | * | ||
30 | * TODO: | ||
31 | * signal strength always returns 0. | ||
32 | * | ||
33 | */ | ||
34 | |||
35 | #include <linux/kernel.h> | ||
36 | #include <linux/module.h> | ||
37 | #include <linux/moduleparam.h> | ||
38 | #include <linux/init.h> | ||
39 | #include <linux/delay.h> | ||
40 | #include <asm/byteorder.h> | ||
41 | |||
42 | #include "dvb_frontend.h" | ||
43 | #include "lgdt330x_priv.h" | ||
44 | #include "lgdt330x.h" | ||
45 | |||
46 | static int debug = 0; | ||
47 | module_param(debug, int, 0644); | ||
48 | MODULE_PARM_DESC(debug,"Turn on/off lgdt330x frontend debugging (default:off)."); | ||
49 | #define dprintk(args...) \ | ||
50 | do { \ | ||
51 | if (debug) printk(KERN_DEBUG "lgdt330x: " args); \ | ||
52 | } while (0) | ||
53 | |||
54 | struct lgdt330x_state | ||
55 | { | ||
56 | struct i2c_adapter* i2c; | ||
57 | struct dvb_frontend_ops ops; | ||
58 | |||
59 | /* Configuration settings */ | ||
60 | const struct lgdt330x_config* config; | ||
61 | |||
62 | struct dvb_frontend frontend; | ||
63 | |||
64 | /* Demodulator private data */ | ||
65 | fe_modulation_t current_modulation; | ||
66 | |||
67 | /* Tuner private data */ | ||
68 | u32 current_frequency; | ||
69 | }; | ||
70 | |||
71 | static int i2c_write_demod_bytes (struct lgdt330x_state* state, | ||
72 | u8 *buf, /* data bytes to send */ | ||
73 | int len /* number of bytes to send */ ) | ||
74 | { | ||
75 | struct i2c_msg msg = | ||
76 | { .addr = state->config->demod_address, | ||
77 | .flags = 0, | ||
78 | .buf = buf, | ||
79 | .len = 2 }; | ||
80 | int i; | ||
81 | int err; | ||
82 | |||
83 | for (i=0; i<len-1; i+=2){ | ||
84 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | ||
85 | printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n", __FUNCTION__, msg.buf[0], msg.buf[1], err); | ||
86 | if (err < 0) | ||
87 | return err; | ||
88 | else | ||
89 | return -EREMOTEIO; | ||
90 | } | ||
91 | msg.buf += 2; | ||
92 | } | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | /* | ||
97 | * This routine writes the register (reg) to the demod bus | ||
98 | * then reads the data returned for (len) bytes. | ||
99 | */ | ||
100 | |||
101 | static u8 i2c_read_demod_bytes (struct lgdt330x_state* state, | ||
102 | enum I2C_REG reg, u8* buf, int len) | ||
103 | { | ||
104 | u8 wr [] = { reg }; | ||
105 | struct i2c_msg msg [] = { | ||
106 | { .addr = state->config->demod_address, | ||
107 | .flags = 0, .buf = wr, .len = 1 }, | ||
108 | { .addr = state->config->demod_address, | ||
109 | .flags = I2C_M_RD, .buf = buf, .len = len }, | ||
110 | }; | ||
111 | int ret; | ||
112 | ret = i2c_transfer(state->i2c, msg, 2); | ||
113 | if (ret != 2) { | ||
114 | printk(KERN_WARNING "lgdt330x: %s: addr 0x%02x select 0x%02x error (ret == %i)\n", __FUNCTION__, state->config->demod_address, reg, ret); | ||
115 | } else { | ||
116 | ret = 0; | ||
117 | } | ||
118 | return ret; | ||
119 | } | ||
120 | |||
121 | /* Software reset */ | ||
122 | static int lgdt3302_SwReset(struct lgdt330x_state* state) | ||
123 | { | ||
124 | u8 ret; | ||
125 | u8 reset[] = { | ||
126 | IRQ_MASK, | ||
127 | 0x00 /* bit 6 is active low software reset | ||
128 | * bits 5-0 are 1 to mask interrupts */ | ||
129 | }; | ||
130 | |||
131 | ret = i2c_write_demod_bytes(state, | ||
132 | reset, sizeof(reset)); | ||
133 | if (ret == 0) { | ||
134 | |||
135 | /* force reset high (inactive) and unmask interrupts */ | ||
136 | reset[1] = 0x7f; | ||
137 | ret = i2c_write_demod_bytes(state, | ||
138 | reset, sizeof(reset)); | ||
139 | } | ||
140 | return ret; | ||
141 | } | ||
142 | |||
143 | static int lgdt3303_SwReset(struct lgdt330x_state* state) | ||
144 | { | ||
145 | u8 ret; | ||
146 | u8 reset[] = { | ||
147 | 0x02, | ||
148 | 0x00 /* bit 0 is active low software reset */ | ||
149 | }; | ||
150 | |||
151 | ret = i2c_write_demod_bytes(state, | ||
152 | reset, sizeof(reset)); | ||
153 | if (ret == 0) { | ||
154 | |||
155 | /* force reset high (inactive) */ | ||
156 | reset[1] = 0x01; | ||
157 | ret = i2c_write_demod_bytes(state, | ||
158 | reset, sizeof(reset)); | ||
159 | } | ||
160 | return ret; | ||
161 | } | ||
162 | |||
163 | static int lgdt330x_SwReset(struct lgdt330x_state* state) | ||
164 | { | ||
165 | switch (state->config->demod_chip) { | ||
166 | case LGDT3302: | ||
167 | return lgdt3302_SwReset(state); | ||
168 | case LGDT3303: | ||
169 | return lgdt3303_SwReset(state); | ||
170 | default: | ||
171 | return -ENODEV; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | |||
176 | static int lgdt330x_init(struct dvb_frontend* fe) | ||
177 | { | ||
178 | /* Hardware reset is done using gpio[0] of cx23880x chip. | ||
179 | * I'd like to do it here, but don't know how to find chip address. | ||
180 | * cx88-cards.c arranges for the reset bit to be inactive (high). | ||
181 | * Maybe there needs to be a callable function in cx88-core or | ||
182 | * the caller of this function needs to do it. */ | ||
183 | |||
184 | /* | ||
185 | * Array of byte pairs <address, value> | ||
186 | * to initialize each different chip | ||
187 | */ | ||
188 | static u8 lgdt3302_init_data[] = { | ||
189 | /* Use 50MHz parameter values from spec sheet since xtal is 50 */ | ||
190 | /* Change the value of NCOCTFV[25:0] of carrier | ||
191 | recovery center frequency register */ | ||
192 | VSB_CARRIER_FREQ0, 0x00, | ||
193 | VSB_CARRIER_FREQ1, 0x87, | ||
194 | VSB_CARRIER_FREQ2, 0x8e, | ||
195 | VSB_CARRIER_FREQ3, 0x01, | ||
196 | /* Change the TPCLK pin polarity | ||
197 | data is valid on falling clock */ | ||
198 | DEMUX_CONTROL, 0xfb, | ||
199 | /* Change the value of IFBW[11:0] of | ||
200 | AGC IF/RF loop filter bandwidth register */ | ||
201 | AGC_RF_BANDWIDTH0, 0x40, | ||
202 | AGC_RF_BANDWIDTH1, 0x93, | ||
203 | AGC_RF_BANDWIDTH2, 0x00, | ||
204 | /* Change the value of bit 6, 'nINAGCBY' and | ||
205 | 'NSSEL[1:0] of ACG function control register 2 */ | ||
206 | AGC_FUNC_CTRL2, 0xc6, | ||
207 | /* Change the value of bit 6 'RFFIX' | ||
208 | of AGC function control register 3 */ | ||
209 | AGC_FUNC_CTRL3, 0x40, | ||
210 | /* Set the value of 'INLVTHD' register 0x2a/0x2c | ||
211 | to 0x7fe */ | ||
212 | AGC_DELAY0, 0x07, | ||
213 | AGC_DELAY2, 0xfe, | ||
214 | /* Change the value of IAGCBW[15:8] | ||
215 | of inner AGC loop filter bandwith */ | ||
216 | AGC_LOOP_BANDWIDTH0, 0x08, | ||
217 | AGC_LOOP_BANDWIDTH1, 0x9a | ||
218 | }; | ||
219 | |||
220 | static u8 lgdt3303_init_data[] = { | ||
221 | 0x4c, 0x14 | ||
222 | }; | ||
223 | |||
224 | struct lgdt330x_state* state = fe->demodulator_priv; | ||
225 | char *chip_name; | ||
226 | int err; | ||
227 | |||
228 | switch (state->config->demod_chip) { | ||
229 | case LGDT3302: | ||
230 | chip_name = "LGDT3302"; | ||
231 | err = i2c_write_demod_bytes(state, lgdt3302_init_data, | ||
232 | sizeof(lgdt3302_init_data)); | ||
233 | break; | ||
234 | case LGDT3303: | ||
235 | chip_name = "LGDT3303"; | ||
236 | err = i2c_write_demod_bytes(state, lgdt3303_init_data, | ||
237 | sizeof(lgdt3303_init_data)); | ||
238 | break; | ||
239 | default: | ||
240 | chip_name = "undefined"; | ||
241 | printk (KERN_WARNING "Only LGDT3302 and LGDT3303 are supported chips.\n"); | ||
242 | err = -ENODEV; | ||
243 | } | ||
244 | dprintk("%s entered as %s\n", __FUNCTION__, chip_name); | ||
245 | if (err < 0) | ||
246 | return err; | ||
247 | return lgdt330x_SwReset(state); | ||
248 | } | ||
249 | |||
250 | static int lgdt330x_read_ber(struct dvb_frontend* fe, u32* ber) | ||
251 | { | ||
252 | *ber = 0; /* Not supplied by the demod chips */ | ||
253 | return 0; | ||
254 | } | ||
255 | |||
256 | static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | ||
257 | { | ||
258 | struct lgdt330x_state* state = fe->demodulator_priv; | ||
259 | int err; | ||
260 | u8 buf[2]; | ||
261 | |||
262 | switch (state->config->demod_chip) { | ||
263 | case LGDT3302: | ||
264 | err = i2c_read_demod_bytes(state, LGDT3302_PACKET_ERR_COUNTER1, | ||
265 | buf, sizeof(buf)); | ||
266 | break; | ||
267 | case LGDT3303: | ||
268 | err = i2c_read_demod_bytes(state, LGDT3303_PACKET_ERR_COUNTER1, | ||
269 | buf, sizeof(buf)); | ||
270 | break; | ||
271 | default: | ||
272 | printk(KERN_WARNING | ||
273 | "Only LGDT3302 and LGDT3303 are supported chips.\n"); | ||
274 | err = -ENODEV; | ||
275 | } | ||
276 | |||
277 | *ucblocks = (buf[0] << 8) | buf[1]; | ||
278 | return 0; | ||
279 | } | ||
280 | |||
281 | static int lgdt330x_set_parameters(struct dvb_frontend* fe, | ||
282 | struct dvb_frontend_parameters *param) | ||
283 | { | ||
284 | /* | ||
285 | * Array of byte pairs <address, value> | ||
286 | * to initialize 8VSB for lgdt3303 chip 50 MHz IF | ||
287 | */ | ||
288 | static u8 lgdt3303_8vsb_44_data[] = { | ||
289 | 0x04, 0x00, | ||
290 | 0x0d, 0x40, | ||
291 | 0x0e, 0x87, | ||
292 | 0x0f, 0x8e, | ||
293 | 0x10, 0x01, | ||
294 | 0x47, 0x8b }; | ||
295 | |||
296 | /* | ||
297 | * Array of byte pairs <address, value> | ||
298 | * to initialize QAM for lgdt3303 chip | ||
299 | */ | ||
300 | static u8 lgdt3303_qam_data[] = { | ||
301 | 0x04, 0x00, | ||
302 | 0x0d, 0x00, | ||
303 | 0x0e, 0x00, | ||
304 | 0x0f, 0x00, | ||
305 | 0x10, 0x00, | ||
306 | 0x51, 0x63, | ||
307 | 0x47, 0x66, | ||
308 | 0x48, 0x66, | ||
309 | 0x4d, 0x1a, | ||
310 | 0x49, 0x08, | ||
311 | 0x4a, 0x9b }; | ||
312 | |||
313 | struct lgdt330x_state* state = fe->demodulator_priv; | ||
314 | |||
315 | static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 }; | ||
316 | |||
317 | int err; | ||
318 | /* Change only if we are actually changing the modulation */ | ||
319 | if (state->current_modulation != param->u.vsb.modulation) { | ||
320 | switch(param->u.vsb.modulation) { | ||
321 | case VSB_8: | ||
322 | dprintk("%s: VSB_8 MODE\n", __FUNCTION__); | ||
323 | |||
324 | /* Select VSB mode */ | ||
325 | top_ctrl_cfg[1] = 0x03; | ||
326 | |||
327 | /* Select ANT connector if supported by card */ | ||
328 | if (state->config->pll_rf_set) | ||
329 | state->config->pll_rf_set(fe, 1); | ||
330 | |||
331 | if (state->config->demod_chip == LGDT3303) { | ||
332 | err = i2c_write_demod_bytes(state, lgdt3303_8vsb_44_data, | ||
333 | sizeof(lgdt3303_8vsb_44_data)); | ||
334 | } | ||
335 | break; | ||
336 | |||
337 | case QAM_64: | ||
338 | dprintk("%s: QAM_64 MODE\n", __FUNCTION__); | ||
339 | |||
340 | /* Select QAM_64 mode */ | ||
341 | top_ctrl_cfg[1] = 0x00; | ||
342 | |||
343 | /* Select CABLE connector if supported by card */ | ||
344 | if (state->config->pll_rf_set) | ||
345 | state->config->pll_rf_set(fe, 0); | ||
346 | |||
347 | if (state->config->demod_chip == LGDT3303) { | ||
348 | err = i2c_write_demod_bytes(state, lgdt3303_qam_data, | ||
349 | sizeof(lgdt3303_qam_data)); | ||
350 | } | ||
351 | break; | ||
352 | |||
353 | case QAM_256: | ||
354 | dprintk("%s: QAM_256 MODE\n", __FUNCTION__); | ||
355 | |||
356 | /* Select QAM_256 mode */ | ||
357 | top_ctrl_cfg[1] = 0x01; | ||
358 | |||
359 | /* Select CABLE connector if supported by card */ | ||
360 | if (state->config->pll_rf_set) | ||
361 | state->config->pll_rf_set(fe, 0); | ||
362 | |||
363 | if (state->config->demod_chip == LGDT3303) { | ||
364 | err = i2c_write_demod_bytes(state, lgdt3303_qam_data, | ||
365 | sizeof(lgdt3303_qam_data)); | ||
366 | } | ||
367 | break; | ||
368 | default: | ||
369 | printk(KERN_WARNING "lgdt330x: %s: Modulation type(%d) UNSUPPORTED\n", __FUNCTION__, param->u.vsb.modulation); | ||
370 | return -1; | ||
371 | } | ||
372 | /* | ||
373 | * select serial or parallel MPEG harware interface | ||
374 | * Serial: 0x04 for LGDT3302 or 0x40 for LGDT3303 | ||
375 | * Parallel: 0x00 | ||
376 | */ | ||
377 | top_ctrl_cfg[1] |= state->config->serial_mpeg; | ||
378 | |||
379 | /* Select the requested mode */ | ||
380 | i2c_write_demod_bytes(state, top_ctrl_cfg, | ||
381 | sizeof(top_ctrl_cfg)); | ||
382 | state->config->set_ts_params(fe, 0); | ||
383 | state->current_modulation = param->u.vsb.modulation; | ||
384 | } | ||
385 | |||
386 | /* Change only if we are actually changing the channel */ | ||
387 | if (state->current_frequency != param->frequency) { | ||
388 | /* Tune to the new frequency */ | ||
389 | state->config->pll_set(fe, param); | ||
390 | /* Keep track of the new frequency */ | ||
391 | state->current_frequency = param->frequency; | ||
392 | } | ||
393 | lgdt330x_SwReset(state); | ||
394 | return 0; | ||
395 | } | ||
396 | |||
397 | static int lgdt330x_get_frontend(struct dvb_frontend* fe, | ||
398 | struct dvb_frontend_parameters* param) | ||
399 | { | ||
400 | struct lgdt330x_state *state = fe->demodulator_priv; | ||
401 | param->frequency = state->current_frequency; | ||
402 | return 0; | ||
403 | } | ||
404 | |||
405 | static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status) | ||
406 | { | ||
407 | struct lgdt330x_state* state = fe->demodulator_priv; | ||
408 | u8 buf[3]; | ||
409 | |||
410 | *status = 0; /* Reset status result */ | ||
411 | |||
412 | /* AGC status register */ | ||
413 | i2c_read_demod_bytes(state, AGC_STATUS, buf, 1); | ||
414 | dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]); | ||
415 | if ((buf[0] & 0x0c) == 0x8){ | ||
416 | /* Test signal does not exist flag */ | ||
417 | /* as well as the AGC lock flag. */ | ||
418 | *status |= FE_HAS_SIGNAL; | ||
419 | } else { | ||
420 | /* Without a signal all other status bits are meaningless */ | ||
421 | return 0; | ||
422 | } | ||
423 | |||
424 | /* | ||
425 | * You must set the Mask bits to 1 in the IRQ_MASK in order | ||
426 | * to see that status bit in the IRQ_STATUS register. | ||
427 | * This is done in SwReset(); | ||
428 | */ | ||
429 | /* signal status */ | ||
430 | i2c_read_demod_bytes(state, TOP_CONTROL, buf, sizeof(buf)); | ||
431 | dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __FUNCTION__, buf[0], buf[1], buf[2]); | ||
432 | |||
433 | |||
434 | /* sync status */ | ||
435 | if ((buf[2] & 0x03) == 0x01) { | ||
436 | *status |= FE_HAS_SYNC; | ||
437 | } | ||
438 | |||
439 | /* FEC error status */ | ||
440 | if ((buf[2] & 0x0c) == 0x08) { | ||
441 | *status |= FE_HAS_LOCK; | ||
442 | *status |= FE_HAS_VITERBI; | ||
443 | } | ||
444 | |||
445 | /* Carrier Recovery Lock Status Register */ | ||
446 | i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1); | ||
447 | dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]); | ||
448 | switch (state->current_modulation) { | ||
449 | case QAM_256: | ||
450 | case QAM_64: | ||
451 | /* Need to undestand why there are 3 lock levels here */ | ||
452 | if ((buf[0] & 0x07) == 0x07) | ||
453 | *status |= FE_HAS_CARRIER; | ||
454 | break; | ||
455 | case VSB_8: | ||
456 | if ((buf[0] & 0x80) == 0x80) | ||
457 | *status |= FE_HAS_CARRIER; | ||
458 | break; | ||
459 | default: | ||
460 | printk("KERN_WARNING lgdt330x: %s: Modulation set to unsupported value\n", __FUNCTION__); | ||
461 | } | ||
462 | |||
463 | return 0; | ||
464 | } | ||
465 | |||
466 | static int lgdt3303_read_status(struct dvb_frontend* fe, fe_status_t* status) | ||
467 | { | ||
468 | struct lgdt330x_state* state = fe->demodulator_priv; | ||
469 | int err; | ||
470 | u8 buf[3]; | ||
471 | |||
472 | *status = 0; /* Reset status result */ | ||
473 | |||
474 | /* lgdt3303 AGC status register */ | ||
475 | err = i2c_read_demod_bytes(state, 0x58, buf, 1); | ||
476 | if (err < 0) | ||
477 | return err; | ||
478 | |||
479 | dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]); | ||
480 | if ((buf[0] & 0x21) == 0x01){ | ||
481 | /* Test input signal does not exist flag */ | ||
482 | /* as well as the AGC lock flag. */ | ||
483 | *status |= FE_HAS_SIGNAL; | ||
484 | } else { | ||
485 | /* Without a signal all other status bits are meaningless */ | ||
486 | return 0; | ||
487 | } | ||
488 | |||
489 | /* Carrier Recovery Lock Status Register */ | ||
490 | i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1); | ||
491 | dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]); | ||
492 | switch (state->current_modulation) { | ||
493 | case QAM_256: | ||
494 | case QAM_64: | ||
495 | /* Need to undestand why there are 3 lock levels here */ | ||
496 | if ((buf[0] & 0x07) == 0x07) | ||
497 | *status |= FE_HAS_CARRIER; | ||
498 | else | ||
499 | break; | ||
500 | i2c_read_demod_bytes(state, 0x8a, buf, 1); | ||
501 | if ((buf[0] & 0x04) == 0x04) | ||
502 | *status |= FE_HAS_SYNC; | ||
503 | if ((buf[0] & 0x01) == 0x01) | ||
504 | *status |= FE_HAS_LOCK; | ||
505 | if ((buf[0] & 0x08) == 0x08) | ||
506 | *status |= FE_HAS_VITERBI; | ||
507 | break; | ||
508 | case VSB_8: | ||
509 | if ((buf[0] & 0x80) == 0x80) | ||
510 | *status |= FE_HAS_CARRIER; | ||
511 | else | ||
512 | break; | ||
513 | i2c_read_demod_bytes(state, 0x38, buf, 1); | ||
514 | if ((buf[0] & 0x02) == 0x00) | ||
515 | *status |= FE_HAS_SYNC; | ||
516 | if ((buf[0] & 0x01) == 0x01) { | ||
517 | *status |= FE_HAS_LOCK; | ||
518 | *status |= FE_HAS_VITERBI; | ||
519 | } | ||
520 | break; | ||
521 | default: | ||
522 | printk("KERN_WARNING lgdt330x: %s: Modulation set to unsupported value\n", __FUNCTION__); | ||
523 | } | ||
524 | return 0; | ||
525 | } | ||
526 | |||
527 | static int lgdt330x_read_signal_strength(struct dvb_frontend* fe, u16* strength) | ||
528 | { | ||
529 | /* not directly available. */ | ||
530 | *strength = 0; | ||
531 | return 0; | ||
532 | } | ||
533 | |||
534 | static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr) | ||
535 | { | ||
536 | #ifdef SNR_IN_DB | ||
537 | /* | ||
538 | * Spec sheet shows formula for SNR_EQ = 10 log10(25 * 24**2 / noise) | ||
539 | * and SNR_PH = 10 log10(25 * 32**2 / noise) for equalizer and phase tracker | ||
540 | * respectively. The following tables are built on these formulas. | ||
541 | * The usual definition is SNR = 20 log10(signal/noise) | ||
542 | * If the specification is wrong the value retuned is 1/2 the actual SNR in db. | ||
543 | * | ||
544 | * This table is a an ordered list of noise values computed by the | ||
545 | * formula from the spec sheet such that the index into the table | ||
546 | * starting at 43 or 45 is the SNR value in db. There are duplicate noise | ||
547 | * value entries at the beginning because the SNR varies more than | ||
548 | * 1 db for a change of 1 digit in noise at very small values of noise. | ||
549 | * | ||
550 | * Examples from SNR_EQ table: | ||
551 | * noise SNR | ||
552 | * 0 43 | ||
553 | * 1 42 | ||
554 | * 2 39 | ||
555 | * 3 37 | ||
556 | * 4 36 | ||
557 | * 5 35 | ||
558 | * 6 34 | ||
559 | * 7 33 | ||
560 | * 8 33 | ||
561 | * 9 32 | ||
562 | * 10 32 | ||
563 | * 11 31 | ||
564 | * 12 31 | ||
565 | * 13 30 | ||
566 | */ | ||
567 | |||
568 | static const u32 SNR_EQ[] = | ||
569 | { 1, 2, 2, 2, 3, 3, 4, 4, 5, 7, | ||
570 | 9, 11, 13, 17, 21, 26, 33, 41, 52, 65, | ||
571 | 81, 102, 129, 162, 204, 257, 323, 406, 511, 644, | ||
572 | 810, 1020, 1284, 1616, 2035, 2561, 3224, 4059, 5110, 6433, | ||
573 | 8098, 10195, 12835, 16158, 20341, 25608, 32238, 40585, 51094, 64323, | ||
574 | 80978, 101945, 128341, 161571, 203406, 256073, 0x40000 | ||
575 | }; | ||
576 | |||
577 | static const u32 SNR_PH[] = | ||
578 | { 1, 2, 2, 2, 3, 3, 4, 5, 6, 8, | ||
579 | 10, 12, 15, 19, 23, 29, 37, 46, 58, 73, | ||
580 | 91, 115, 144, 182, 229, 288, 362, 456, 574, 722, | ||
581 | 909, 1144, 1440, 1813, 2282, 2873, 3617, 4553, 5732, 7216, | ||
582 | 9084, 11436, 14396, 18124, 22817, 28724, 36161, 45524, 57312, 72151, | ||
583 | 90833, 114351, 143960, 181235, 228161, 0x080000 | ||
584 | }; | ||
585 | |||
586 | static u8 buf[5];/* read data buffer */ | ||
587 | static u32 noise; /* noise value */ | ||
588 | static u32 snr_db; /* index into SNR_EQ[] */ | ||
589 | struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; | ||
590 | |||
591 | /* read both equalizer and phase tracker noise data */ | ||
592 | i2c_read_demod_bytes(state, EQPH_ERR0, buf, sizeof(buf)); | ||
593 | |||
594 | if (state->current_modulation == VSB_8) { | ||
595 | /* Equalizer Mean-Square Error Register for VSB */ | ||
596 | noise = ((buf[0] & 7) << 16) | (buf[1] << 8) | buf[2]; | ||
597 | |||
598 | /* | ||
599 | * Look up noise value in table. | ||
600 | * A better search algorithm could be used... | ||
601 | * watch out there are duplicate entries. | ||
602 | */ | ||
603 | for (snr_db = 0; snr_db < sizeof(SNR_EQ); snr_db++) { | ||
604 | if (noise < SNR_EQ[snr_db]) { | ||
605 | *snr = 43 - snr_db; | ||
606 | break; | ||
607 | } | ||
608 | } | ||
609 | } else { | ||
610 | /* Phase Tracker Mean-Square Error Register for QAM */ | ||
611 | noise = ((buf[0] & 7<<3) << 13) | (buf[3] << 8) | buf[4]; | ||
612 | |||
613 | /* Look up noise value in table. */ | ||
614 | for (snr_db = 0; snr_db < sizeof(SNR_PH); snr_db++) { | ||
615 | if (noise < SNR_PH[snr_db]) { | ||
616 | *snr = 45 - snr_db; | ||
617 | break; | ||
618 | } | ||
619 | } | ||
620 | } | ||
621 | #else | ||
622 | /* Return the raw noise value */ | ||
623 | static u8 buf[5];/* read data buffer */ | ||
624 | static u32 noise; /* noise value */ | ||
625 | struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; | ||
626 | |||
627 | /* read both equalizer and pase tracker noise data */ | ||
628 | i2c_read_demod_bytes(state, EQPH_ERR0, buf, sizeof(buf)); | ||
629 | |||
630 | if (state->current_modulation == VSB_8) { | ||
631 | /* Phase Tracker Mean-Square Error Register for VSB */ | ||
632 | noise = ((buf[0] & 7<<3) << 13) | (buf[3] << 8) | buf[4]; | ||
633 | } else { | ||
634 | |||
635 | /* Carrier Recovery Mean-Square Error for QAM */ | ||
636 | i2c_read_demod_bytes(state, 0x1a, buf, 2); | ||
637 | noise = ((buf[0] & 3) << 8) | buf[1]; | ||
638 | } | ||
639 | |||
640 | /* Small values for noise mean signal is better so invert noise */ | ||
641 | *snr = ~noise; | ||
642 | #endif | ||
643 | |||
644 | dprintk("%s: noise = 0x%05x, snr = %idb\n",__FUNCTION__, noise, *snr); | ||
645 | |||
646 | return 0; | ||
647 | } | ||
648 | |||
649 | static int lgdt3303_read_snr(struct dvb_frontend* fe, u16* snr) | ||
650 | { | ||
651 | /* Return the raw noise value */ | ||
652 | static u8 buf[5];/* read data buffer */ | ||
653 | static u32 noise; /* noise value */ | ||
654 | struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; | ||
655 | |||
656 | if (state->current_modulation == VSB_8) { | ||
657 | |||
658 | /* Phase Tracker Mean-Square Error Register for VSB */ | ||
659 | noise = ((buf[0] & 7) << 16) | (buf[3] << 8) | buf[4]; | ||
660 | } else { | ||
661 | |||
662 | /* Carrier Recovery Mean-Square Error for QAM */ | ||
663 | i2c_read_demod_bytes(state, 0x1a, buf, 2); | ||
664 | noise = (buf[0] << 8) | buf[1]; | ||
665 | } | ||
666 | |||
667 | /* Small values for noise mean signal is better so invert noise */ | ||
668 | *snr = ~noise; | ||
669 | |||
670 | dprintk("%s: noise = 0x%05x, snr = %idb\n",__FUNCTION__, noise, *snr); | ||
671 | |||
672 | return 0; | ||
673 | } | ||
674 | |||
675 | static int lgdt330x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fe_tune_settings) | ||
676 | { | ||
677 | /* I have no idea about this - it may not be needed */ | ||
678 | fe_tune_settings->min_delay_ms = 500; | ||
679 | fe_tune_settings->step_size = 0; | ||
680 | fe_tune_settings->max_drift = 0; | ||
681 | return 0; | ||
682 | } | ||
683 | |||
684 | static void lgdt330x_release(struct dvb_frontend* fe) | ||
685 | { | ||
686 | struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv; | ||
687 | kfree(state); | ||
688 | } | ||
689 | |||
690 | static struct dvb_frontend_ops lgdt3302_ops; | ||
691 | static struct dvb_frontend_ops lgdt3303_ops; | ||
692 | |||
693 | struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, | ||
694 | struct i2c_adapter* i2c) | ||
695 | { | ||
696 | struct lgdt330x_state* state = NULL; | ||
697 | u8 buf[1]; | ||
698 | |||
699 | /* Allocate memory for the internal state */ | ||
700 | state = (struct lgdt330x_state*) kmalloc(sizeof(struct lgdt330x_state), GFP_KERNEL); | ||
701 | if (state == NULL) | ||
702 | goto error; | ||
703 | memset(state,0,sizeof(*state)); | ||
704 | |||
705 | /* Setup the state */ | ||
706 | state->config = config; | ||
707 | state->i2c = i2c; | ||
708 | switch (config->demod_chip) { | ||
709 | case LGDT3302: | ||
710 | memcpy(&state->ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops)); | ||
711 | break; | ||
712 | case LGDT3303: | ||
713 | memcpy(&state->ops, &lgdt3303_ops, sizeof(struct dvb_frontend_ops)); | ||
714 | break; | ||
715 | default: | ||
716 | goto error; | ||
717 | } | ||
718 | |||
719 | /* Verify communication with demod chip */ | ||
720 | if (i2c_read_demod_bytes(state, 2, buf, 1)) | ||
721 | goto error; | ||
722 | |||
723 | state->current_frequency = -1; | ||
724 | state->current_modulation = -1; | ||
725 | |||
726 | /* Create dvb_frontend */ | ||
727 | state->frontend.ops = &state->ops; | ||
728 | state->frontend.demodulator_priv = state; | ||
729 | return &state->frontend; | ||
730 | |||
731 | error: | ||
732 | if (state) | ||
733 | kfree(state); | ||
734 | dprintk("%s: ERROR\n",__FUNCTION__); | ||
735 | return NULL; | ||
736 | } | ||
737 | |||
738 | static struct dvb_frontend_ops lgdt3302_ops = { | ||
739 | .info = { | ||
740 | .name= "LG Electronics LGDT3302 VSB/QAM Frontend", | ||
741 | .type = FE_ATSC, | ||
742 | .frequency_min= 54000000, | ||
743 | .frequency_max= 858000000, | ||
744 | .frequency_stepsize= 62500, | ||
745 | /* Symbol rate is for all VSB modes need to check QAM */ | ||
746 | .symbol_rate_min = 10762000, | ||
747 | .symbol_rate_max = 10762000, | ||
748 | .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB | ||
749 | }, | ||
750 | .init = lgdt330x_init, | ||
751 | .set_frontend = lgdt330x_set_parameters, | ||
752 | .get_frontend = lgdt330x_get_frontend, | ||
753 | .get_tune_settings = lgdt330x_get_tune_settings, | ||
754 | .read_status = lgdt3302_read_status, | ||
755 | .read_ber = lgdt330x_read_ber, | ||
756 | .read_signal_strength = lgdt330x_read_signal_strength, | ||
757 | .read_snr = lgdt3302_read_snr, | ||
758 | .read_ucblocks = lgdt330x_read_ucblocks, | ||
759 | .release = lgdt330x_release, | ||
760 | }; | ||
761 | |||
762 | static struct dvb_frontend_ops lgdt3303_ops = { | ||
763 | .info = { | ||
764 | .name= "LG Electronics LGDT3303 VSB/QAM Frontend", | ||
765 | .type = FE_ATSC, | ||
766 | .frequency_min= 54000000, | ||
767 | .frequency_max= 858000000, | ||
768 | .frequency_stepsize= 62500, | ||
769 | /* Symbol rate is for all VSB modes need to check QAM */ | ||
770 | .symbol_rate_min = 10762000, | ||
771 | .symbol_rate_max = 10762000, | ||
772 | .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB | ||
773 | }, | ||
774 | .init = lgdt330x_init, | ||
775 | .set_frontend = lgdt330x_set_parameters, | ||
776 | .get_frontend = lgdt330x_get_frontend, | ||
777 | .get_tune_settings = lgdt330x_get_tune_settings, | ||
778 | .read_status = lgdt3303_read_status, | ||
779 | .read_ber = lgdt330x_read_ber, | ||
780 | .read_signal_strength = lgdt330x_read_signal_strength, | ||
781 | .read_snr = lgdt3303_read_snr, | ||
782 | .read_ucblocks = lgdt330x_read_ucblocks, | ||
783 | .release = lgdt330x_release, | ||
784 | }; | ||
785 | |||
786 | MODULE_DESCRIPTION("LGDT330X (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver"); | ||
787 | MODULE_AUTHOR("Wilson Michaels"); | ||
788 | MODULE_LICENSE("GPL"); | ||
789 | |||
790 | EXPORT_SYMBOL(lgdt330x_attach); | ||
791 | |||
792 | /* | ||
793 | * Local variables: | ||
794 | * c-basic-offset: 8 | ||
795 | * End: | ||
796 | */ | ||
diff --git a/drivers/media/dvb/frontends/lgdt330x.h b/drivers/media/dvb/frontends/lgdt330x.h new file mode 100644 index 000000000000..e209ba1e47c5 --- /dev/null +++ b/drivers/media/dvb/frontends/lgdt330x.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Support for LGDT3302 and LGDT3303 - VSB/QAM | ||
3 | * | ||
4 | * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #ifndef LGDT330X_H | ||
23 | #define LGDT330X_H | ||
24 | |||
25 | #include <linux/dvb/frontend.h> | ||
26 | |||
27 | typedef enum lg_chip_t { | ||
28 | UNDEFINED, | ||
29 | LGDT3302, | ||
30 | LGDT3303 | ||
31 | }lg_chip_type; | ||
32 | |||
33 | struct lgdt330x_config | ||
34 | { | ||
35 | /* The demodulator's i2c address */ | ||
36 | u8 demod_address; | ||
37 | |||
38 | /* LG demodulator chip LGDT3302 or LGDT3303 */ | ||
39 | lg_chip_type demod_chip; | ||
40 | |||
41 | /* MPEG hardware interface - 0:parallel 1:serial */ | ||
42 | int serial_mpeg; | ||
43 | |||
44 | /* PLL interface */ | ||
45 | int (*pll_rf_set) (struct dvb_frontend* fe, int index); | ||
46 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); | ||
47 | |||
48 | /* Need to set device param for start_dma */ | ||
49 | int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); | ||
50 | }; | ||
51 | |||
52 | extern struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, | ||
53 | struct i2c_adapter* i2c); | ||
54 | |||
55 | #endif /* LGDT330X_H */ | ||
56 | |||
57 | /* | ||
58 | * Local variables: | ||
59 | * c-basic-offset: 8 | ||
60 | * End: | ||
61 | */ | ||
diff --git a/drivers/media/dvb/frontends/lgdt330x_priv.h b/drivers/media/dvb/frontends/lgdt330x_priv.h new file mode 100644 index 000000000000..59b7c5b9012d --- /dev/null +++ b/drivers/media/dvb/frontends/lgdt330x_priv.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Support for LGDT3302 and LGDT3303 - VSB/QAM | ||
3 | * | ||
4 | * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #ifndef _LGDT330X_PRIV_ | ||
23 | #define _LGDT330X_PRIV_ | ||
24 | |||
25 | /* i2c control register addresses */ | ||
26 | enum I2C_REG { | ||
27 | TOP_CONTROL= 0x00, | ||
28 | IRQ_MASK= 0x01, | ||
29 | IRQ_STATUS= 0x02, | ||
30 | VSB_CARRIER_FREQ0= 0x16, | ||
31 | VSB_CARRIER_FREQ1= 0x17, | ||
32 | VSB_CARRIER_FREQ2= 0x18, | ||
33 | VSB_CARRIER_FREQ3= 0x19, | ||
34 | CARRIER_MSEQAM1= 0x1a, | ||
35 | CARRIER_MSEQAM2= 0x1b, | ||
36 | CARRIER_LOCK= 0x1c, | ||
37 | TIMING_RECOVERY= 0x1d, | ||
38 | AGC_DELAY0= 0x2a, | ||
39 | AGC_DELAY1= 0x2b, | ||
40 | AGC_DELAY2= 0x2c, | ||
41 | AGC_RF_BANDWIDTH0= 0x2d, | ||
42 | AGC_RF_BANDWIDTH1= 0x2e, | ||
43 | AGC_RF_BANDWIDTH2= 0x2f, | ||
44 | AGC_LOOP_BANDWIDTH0= 0x30, | ||
45 | AGC_LOOP_BANDWIDTH1= 0x31, | ||
46 | AGC_FUNC_CTRL1= 0x32, | ||
47 | AGC_FUNC_CTRL2= 0x33, | ||
48 | AGC_FUNC_CTRL3= 0x34, | ||
49 | AGC_RFIF_ACC0= 0x39, | ||
50 | AGC_RFIF_ACC1= 0x3a, | ||
51 | AGC_RFIF_ACC2= 0x3b, | ||
52 | AGC_STATUS= 0x3f, | ||
53 | SYNC_STATUS_VSB= 0x43, | ||
54 | EQPH_ERR0= 0x47, | ||
55 | EQ_ERR1= 0x48, | ||
56 | EQ_ERR2= 0x49, | ||
57 | PH_ERR1= 0x4a, | ||
58 | PH_ERR2= 0x4b, | ||
59 | DEMUX_CONTROL= 0x66, | ||
60 | LGDT3302_PACKET_ERR_COUNTER1= 0x6a, | ||
61 | LGDT3302_PACKET_ERR_COUNTER2= 0x6b, | ||
62 | LGDT3303_PACKET_ERR_COUNTER1= 0x8b, | ||
63 | LGDT3303_PACKET_ERR_COUNTER2= 0x8c, | ||
64 | }; | ||
65 | |||
66 | #endif /* _LGDT330X_PRIV_ */ | ||
67 | |||
68 | /* | ||
69 | * Local variables: | ||
70 | * c-basic-offset: 8 | ||
71 | * End: | ||
72 | */ | ||
diff --git a/drivers/media/dvb/frontends/s5h1420.c b/drivers/media/dvb/frontends/s5h1420.c new file mode 100644 index 000000000000..4f396ac8de77 --- /dev/null +++ b/drivers/media/dvb/frontends/s5h1420.c | |||
@@ -0,0 +1,800 @@ | |||
1 | /* | ||
2 | Driver for Samsung S5H1420 QPSK Demodulator | ||
3 | |||
4 | Copyright (C) 2005 Andrew de Quincey <adq_dvb@lidskialf.net> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
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 | |||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | |||
21 | */ | ||
22 | |||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/string.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/delay.h> | ||
29 | |||
30 | #include "dvb_frontend.h" | ||
31 | #include "s5h1420.h" | ||
32 | |||
33 | |||
34 | |||
35 | #define TONE_FREQ 22000 | ||
36 | |||
37 | struct s5h1420_state { | ||
38 | struct i2c_adapter* i2c; | ||
39 | struct dvb_frontend_ops ops; | ||
40 | const struct s5h1420_config* config; | ||
41 | struct dvb_frontend frontend; | ||
42 | |||
43 | u8 postlocked:1; | ||
44 | u32 fclk; | ||
45 | u32 tunedfreq; | ||
46 | fe_code_rate_t fec_inner; | ||
47 | u32 symbol_rate; | ||
48 | }; | ||
49 | |||
50 | static u32 s5h1420_getsymbolrate(struct s5h1420_state* state); | ||
51 | static int s5h1420_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings); | ||
52 | |||
53 | |||
54 | static int debug = 0; | ||
55 | #define dprintk if (debug) printk | ||
56 | |||
57 | static int s5h1420_writereg (struct s5h1420_state* state, u8 reg, u8 data) | ||
58 | { | ||
59 | u8 buf [] = { reg, data }; | ||
60 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; | ||
61 | int err; | ||
62 | |||
63 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { | ||
64 | dprintk ("%s: writereg error (err == %i, reg == 0x%02x, data == 0x%02x)\n", __FUNCTION__, err, reg, data); | ||
65 | return -EREMOTEIO; | ||
66 | } | ||
67 | |||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | static u8 s5h1420_readreg (struct s5h1420_state* state, u8 reg) | ||
72 | { | ||
73 | int ret; | ||
74 | u8 b0 [] = { reg }; | ||
75 | u8 b1 [] = { 0 }; | ||
76 | struct i2c_msg msg1 = { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }; | ||
77 | struct i2c_msg msg2 = { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 }; | ||
78 | |||
79 | if ((ret = i2c_transfer (state->i2c, &msg1, 1)) != 1) | ||
80 | return ret; | ||
81 | |||
82 | if ((ret = i2c_transfer (state->i2c, &msg2, 1)) != 1) | ||
83 | return ret; | ||
84 | |||
85 | return b1[0]; | ||
86 | } | ||
87 | |||
88 | static int s5h1420_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage) | ||
89 | { | ||
90 | struct s5h1420_state* state = fe->demodulator_priv; | ||
91 | |||
92 | switch(voltage) { | ||
93 | case SEC_VOLTAGE_13: | ||
94 | s5h1420_writereg(state, 0x3c, (s5h1420_readreg(state, 0x3c) & 0xfe) | 0x02); | ||
95 | break; | ||
96 | |||
97 | case SEC_VOLTAGE_18: | ||
98 | s5h1420_writereg(state, 0x3c, s5h1420_readreg(state, 0x3c) | 0x03); | ||
99 | break; | ||
100 | |||
101 | case SEC_VOLTAGE_OFF: | ||
102 | s5h1420_writereg(state, 0x3c, s5h1420_readreg(state, 0x3c) & 0xfd); | ||
103 | break; | ||
104 | } | ||
105 | |||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | static int s5h1420_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | ||
110 | { | ||
111 | struct s5h1420_state* state = fe->demodulator_priv; | ||
112 | |||
113 | switch(tone) { | ||
114 | case SEC_TONE_ON: | ||
115 | s5h1420_writereg(state, 0x3b, (s5h1420_readreg(state, 0x3b) & 0x74) | 0x08); | ||
116 | break; | ||
117 | |||
118 | case SEC_TONE_OFF: | ||
119 | s5h1420_writereg(state, 0x3b, (s5h1420_readreg(state, 0x3b) & 0x74) | 0x01); | ||
120 | break; | ||
121 | } | ||
122 | |||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | static int s5h1420_send_master_cmd (struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd) | ||
127 | { | ||
128 | struct s5h1420_state* state = fe->demodulator_priv; | ||
129 | u8 val; | ||
130 | int i; | ||
131 | unsigned long timeout; | ||
132 | int result = 0; | ||
133 | |||
134 | /* setup for DISEQC */ | ||
135 | val = s5h1420_readreg(state, 0x3b); | ||
136 | s5h1420_writereg(state, 0x3b, 0x02); | ||
137 | msleep(15); | ||
138 | |||
139 | /* write the DISEQC command bytes */ | ||
140 | for(i=0; i< cmd->msg_len; i++) { | ||
141 | s5h1420_writereg(state, 0x3c + i, cmd->msg[i]); | ||
142 | } | ||
143 | |||
144 | /* kick off transmission */ | ||
145 | s5h1420_writereg(state, 0x3b, s5h1420_readreg(state, 0x3b) | ((cmd->msg_len-1) << 4) | 0x08); | ||
146 | |||
147 | /* wait for transmission to complete */ | ||
148 | timeout = jiffies + ((100*HZ) / 1000); | ||
149 | while(time_before(jiffies, timeout)) { | ||
150 | if (s5h1420_readreg(state, 0x3b) & 0x08) | ||
151 | break; | ||
152 | |||
153 | msleep(5); | ||
154 | } | ||
155 | if (time_after(jiffies, timeout)) | ||
156 | result = -ETIMEDOUT; | ||
157 | |||
158 | /* restore original settings */ | ||
159 | s5h1420_writereg(state, 0x3b, val); | ||
160 | msleep(15); | ||
161 | return result; | ||
162 | } | ||
163 | |||
164 | static int s5h1420_recv_slave_reply (struct dvb_frontend* fe, struct dvb_diseqc_slave_reply* reply) | ||
165 | { | ||
166 | struct s5h1420_state* state = fe->demodulator_priv; | ||
167 | u8 val; | ||
168 | int i; | ||
169 | int length; | ||
170 | unsigned long timeout; | ||
171 | int result = 0; | ||
172 | |||
173 | /* setup for DISEQC recieve */ | ||
174 | val = s5h1420_readreg(state, 0x3b); | ||
175 | s5h1420_writereg(state, 0x3b, 0x82); /* FIXME: guess - do we need to set DIS_RDY(0x08) in receive mode? */ | ||
176 | msleep(15); | ||
177 | |||
178 | /* wait for reception to complete */ | ||
179 | timeout = jiffies + ((reply->timeout*HZ) / 1000); | ||
180 | while(time_before(jiffies, timeout)) { | ||
181 | if (!(s5h1420_readreg(state, 0x3b) & 0x80)) /* FIXME: do we test DIS_RDY(0x08) or RCV_EN(0x80)? */ | ||
182 | break; | ||
183 | |||
184 | msleep(5); | ||
185 | } | ||
186 | if (time_after(jiffies, timeout)) { | ||
187 | result = -ETIMEDOUT; | ||
188 | goto exit; | ||
189 | } | ||
190 | |||
191 | /* check error flag - FIXME: not sure what this does - docs do not describe | ||
192 | * beyond "error flag for diseqc receive data :( */ | ||
193 | if (s5h1420_readreg(state, 0x49)) { | ||
194 | result = -EIO; | ||
195 | goto exit; | ||
196 | } | ||
197 | |||
198 | /* check length */ | ||
199 | length = (s5h1420_readreg(state, 0x3b) & 0x70) >> 4; | ||
200 | if (length > sizeof(reply->msg)) { | ||
201 | result = -EOVERFLOW; | ||
202 | goto exit; | ||
203 | } | ||
204 | reply->msg_len = length; | ||
205 | |||
206 | /* extract data */ | ||
207 | for(i=0; i< length; i++) { | ||
208 | reply->msg[i] = s5h1420_readreg(state, 0x3c + i); | ||
209 | } | ||
210 | |||
211 | exit: | ||
212 | /* restore original settings */ | ||
213 | s5h1420_writereg(state, 0x3b, val); | ||
214 | msleep(15); | ||
215 | return result; | ||
216 | } | ||
217 | |||
218 | static int s5h1420_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd) | ||
219 | { | ||
220 | struct s5h1420_state* state = fe->demodulator_priv; | ||
221 | u8 val; | ||
222 | int result = 0; | ||
223 | unsigned long timeout; | ||
224 | |||
225 | /* setup for tone burst */ | ||
226 | val = s5h1420_readreg(state, 0x3b); | ||
227 | s5h1420_writereg(state, 0x3b, (s5h1420_readreg(state, 0x3b) & 0x70) | 0x01); | ||
228 | |||
229 | /* set value for B position if requested */ | ||
230 | if (minicmd == SEC_MINI_B) { | ||
231 | s5h1420_writereg(state, 0x3b, s5h1420_readreg(state, 0x3b) | 0x04); | ||
232 | } | ||
233 | msleep(15); | ||
234 | |||
235 | /* start transmission */ | ||
236 | s5h1420_writereg(state, 0x3b, s5h1420_readreg(state, 0x3b) | 0x08); | ||
237 | |||
238 | /* wait for transmission to complete */ | ||
239 | timeout = jiffies + ((20*HZ) / 1000); | ||
240 | while(time_before(jiffies, timeout)) { | ||
241 | if (!(s5h1420_readreg(state, 0x3b) & 0x08)) | ||
242 | break; | ||
243 | |||
244 | msleep(5); | ||
245 | } | ||
246 | if (time_after(jiffies, timeout)) | ||
247 | result = -ETIMEDOUT; | ||
248 | |||
249 | /* restore original settings */ | ||
250 | s5h1420_writereg(state, 0x3b, val); | ||
251 | msleep(15); | ||
252 | return result; | ||
253 | } | ||
254 | |||
255 | static fe_status_t s5h1420_get_status_bits(struct s5h1420_state* state) | ||
256 | { | ||
257 | u8 val; | ||
258 | fe_status_t status = 0; | ||
259 | |||
260 | val = s5h1420_readreg(state, 0x14); | ||
261 | if (val & 0x02) | ||
262 | status |= FE_HAS_SIGNAL; // FIXME: not sure if this is right | ||
263 | if (val & 0x01) | ||
264 | status |= FE_HAS_CARRIER; // FIXME: not sure if this is right | ||
265 | val = s5h1420_readreg(state, 0x36); | ||
266 | if (val & 0x01) | ||
267 | status |= FE_HAS_VITERBI; | ||
268 | if (val & 0x20) | ||
269 | status |= FE_HAS_SYNC; | ||
270 | if (status == (FE_HAS_SIGNAL|FE_HAS_CARRIER|FE_HAS_VITERBI|FE_HAS_SYNC)) | ||
271 | status |= FE_HAS_LOCK; | ||
272 | |||
273 | return status; | ||
274 | } | ||
275 | |||
276 | static int s5h1420_read_status(struct dvb_frontend* fe, fe_status_t* status) | ||
277 | { | ||
278 | struct s5h1420_state* state = fe->demodulator_priv; | ||
279 | u8 val; | ||
280 | |||
281 | if (status == NULL) | ||
282 | return -EINVAL; | ||
283 | |||
284 | /* determine lock state */ | ||
285 | *status = s5h1420_get_status_bits(state); | ||
286 | |||
287 | /* fix for FEC 5/6 inversion issue - if it doesn't quite lock, invert the inversion, | ||
288 | wait a bit and check again */ | ||
289 | if (*status == (FE_HAS_SIGNAL|FE_HAS_CARRIER|FE_HAS_VITERBI)) { | ||
290 | val = s5h1420_readreg(state, 0x32); | ||
291 | if ((val & 0x07) == 0x03) { | ||
292 | if (val & 0x08) | ||
293 | s5h1420_writereg(state, 0x31, 0x13); | ||
294 | else | ||
295 | s5h1420_writereg(state, 0x31, 0x1b); | ||
296 | |||
297 | /* wait a bit then update lock status */ | ||
298 | mdelay(200); | ||
299 | *status = s5h1420_get_status_bits(state); | ||
300 | } | ||
301 | } | ||
302 | |||
303 | /* perform post lock setup */ | ||
304 | if ((*status & FE_HAS_LOCK) && (!state->postlocked)) { | ||
305 | |||
306 | /* calculate the data rate */ | ||
307 | u32 tmp = s5h1420_getsymbolrate(state); | ||
308 | switch(s5h1420_readreg(state, 0x32) & 0x07) { | ||
309 | case 0: | ||
310 | tmp = (tmp * 2 * 1) / 2; | ||
311 | break; | ||
312 | |||
313 | case 1: | ||
314 | tmp = (tmp * 2 * 2) / 3; | ||
315 | break; | ||
316 | |||
317 | case 2: | ||
318 | tmp = (tmp * 2 * 3) / 4; | ||
319 | break; | ||
320 | |||
321 | case 3: | ||
322 | tmp = (tmp * 2 * 5) / 6; | ||
323 | break; | ||
324 | |||
325 | case 4: | ||
326 | tmp = (tmp * 2 * 6) / 7; | ||
327 | break; | ||
328 | |||
329 | case 5: | ||
330 | tmp = (tmp * 2 * 7) / 8; | ||
331 | break; | ||
332 | } | ||
333 | tmp = state->fclk / tmp; | ||
334 | |||
335 | /* set the MPEG_CLK_INTL for the calculated data rate */ | ||
336 | if (tmp < 4) | ||
337 | val = 0x00; | ||
338 | else if (tmp < 8) | ||
339 | val = 0x01; | ||
340 | else if (tmp < 12) | ||
341 | val = 0x02; | ||
342 | else if (tmp < 16) | ||
343 | val = 0x03; | ||
344 | else if (tmp < 24) | ||
345 | val = 0x04; | ||
346 | else if (tmp < 32) | ||
347 | val = 0x05; | ||
348 | else | ||
349 | val = 0x06; | ||
350 | s5h1420_writereg(state, 0x22, val); | ||
351 | |||
352 | /* DC freeze */ | ||
353 | s5h1420_writereg(state, 0x1f, s5h1420_readreg(state, 0x1f) | 0x01); | ||
354 | |||
355 | /* kicker disable + remove DC offset */ | ||
356 | s5h1420_writereg(state, 0x05, s5h1420_readreg(state, 0x05) & 0x6f); | ||
357 | |||
358 | /* post-lock processing has been done! */ | ||
359 | state->postlocked = 1; | ||
360 | } | ||
361 | |||
362 | return 0; | ||
363 | } | ||
364 | |||
365 | static int s5h1420_read_ber(struct dvb_frontend* fe, u32* ber) | ||
366 | { | ||
367 | struct s5h1420_state* state = fe->demodulator_priv; | ||
368 | |||
369 | s5h1420_writereg(state, 0x46, 0x1d); | ||
370 | mdelay(25); | ||
371 | return (s5h1420_readreg(state, 0x48) << 8) | s5h1420_readreg(state, 0x47); | ||
372 | } | ||
373 | |||
374 | static int s5h1420_read_signal_strength(struct dvb_frontend* fe, u16* strength) | ||
375 | { | ||
376 | struct s5h1420_state* state = fe->demodulator_priv; | ||
377 | |||
378 | u8 val = 0xff - s5h1420_readreg(state, 0x15); | ||
379 | |||
380 | return (int) ((val << 8) | val); | ||
381 | } | ||
382 | |||
383 | static int s5h1420_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | ||
384 | { | ||
385 | struct s5h1420_state* state = fe->demodulator_priv; | ||
386 | |||
387 | s5h1420_writereg(state, 0x46, 0x1f); | ||
388 | mdelay(25); | ||
389 | return (s5h1420_readreg(state, 0x48) << 8) | s5h1420_readreg(state, 0x47); | ||
390 | } | ||
391 | |||
392 | static void s5h1420_reset(struct s5h1420_state* state) | ||
393 | { | ||
394 | s5h1420_writereg (state, 0x01, 0x08); | ||
395 | s5h1420_writereg (state, 0x01, 0x00); | ||
396 | udelay(10); | ||
397 | } | ||
398 | |||
399 | static void s5h1420_setsymbolrate(struct s5h1420_state* state, struct dvb_frontend_parameters *p) | ||
400 | { | ||
401 | u64 val; | ||
402 | |||
403 | val = (p->u.qpsk.symbol_rate / 1000) * (1<<24); | ||
404 | if (p->u.qpsk.symbol_rate <= 21000000) { | ||
405 | val *= 2; | ||
406 | } | ||
407 | do_div(val, (state->fclk / 1000)); | ||
408 | |||
409 | s5h1420_writereg(state, 0x09, s5h1420_readreg(state, 0x09) & 0x7f); | ||
410 | s5h1420_writereg(state, 0x11, val >> 16); | ||
411 | s5h1420_writereg(state, 0x12, val >> 8); | ||
412 | s5h1420_writereg(state, 0x13, val & 0xff); | ||
413 | s5h1420_writereg(state, 0x09, s5h1420_readreg(state, 0x09) | 0x80); | ||
414 | } | ||
415 | |||
416 | static u32 s5h1420_getsymbolrate(struct s5h1420_state* state) | ||
417 | { | ||
418 | u64 val; | ||
419 | int sampling = 2; | ||
420 | |||
421 | if (s5h1420_readreg(state, 0x05) & 0x2) | ||
422 | sampling = 1; | ||
423 | |||
424 | s5h1420_writereg(state, 0x06, s5h1420_readreg(state, 0x06) | 0x08); | ||
425 | val = s5h1420_readreg(state, 0x11) << 16; | ||
426 | val |= s5h1420_readreg(state, 0x12) << 8; | ||
427 | val |= s5h1420_readreg(state, 0x13); | ||
428 | s5h1420_writereg(state, 0x06, s5h1420_readreg(state, 0x06) & 0xf7); | ||
429 | |||
430 | val *= (state->fclk / 1000); | ||
431 | do_div(val, ((1<<24) * sampling)); | ||
432 | |||
433 | return (u32) (val * 1000); | ||
434 | } | ||
435 | |||
436 | static void s5h1420_setfreqoffset(struct s5h1420_state* state, int freqoffset) | ||
437 | { | ||
438 | int val; | ||
439 | |||
440 | /* remember freqoffset is in kHz, but the chip wants the offset in Hz, so | ||
441 | * divide fclk by 1000000 to get the correct value. */ | ||
442 | val = -(int) ((freqoffset * (1<<24)) / (state->fclk / 1000000)); | ||
443 | |||
444 | s5h1420_writereg(state, 0x09, s5h1420_readreg(state, 0x09) & 0xbf); | ||
445 | s5h1420_writereg(state, 0x0e, val >> 16); | ||
446 | s5h1420_writereg(state, 0x0f, val >> 8); | ||
447 | s5h1420_writereg(state, 0x10, val & 0xff); | ||
448 | s5h1420_writereg(state, 0x09, s5h1420_readreg(state, 0x09) | 0x40); | ||
449 | } | ||
450 | |||
451 | static int s5h1420_getfreqoffset(struct s5h1420_state* state) | ||
452 | { | ||
453 | int val; | ||
454 | |||
455 | s5h1420_writereg(state, 0x06, s5h1420_readreg(state, 0x06) | 0x08); | ||
456 | val = s5h1420_readreg(state, 0x0e) << 16; | ||
457 | val |= s5h1420_readreg(state, 0x0f) << 8; | ||
458 | val |= s5h1420_readreg(state, 0x10); | ||
459 | s5h1420_writereg(state, 0x06, s5h1420_readreg(state, 0x06) & 0xf7); | ||
460 | |||
461 | if (val & 0x800000) | ||
462 | val |= 0xff000000; | ||
463 | |||
464 | /* remember freqoffset is in kHz, but the chip wants the offset in Hz, so | ||
465 | * divide fclk by 1000000 to get the correct value. */ | ||
466 | val = - ((val * (state->fclk/1000000)) / (1<<24)); | ||
467 | |||
468 | return val; | ||
469 | } | ||
470 | |||
471 | static void s5h1420_setfec(struct s5h1420_state* state, struct dvb_frontend_parameters *p) | ||
472 | { | ||
473 | if ((p->u.qpsk.fec_inner == FEC_AUTO) || (p->inversion == INVERSION_AUTO)) { | ||
474 | s5h1420_writereg(state, 0x31, 0x00); | ||
475 | s5h1420_writereg(state, 0x30, 0x3f); | ||
476 | } else { | ||
477 | switch(p->u.qpsk.fec_inner) { | ||
478 | case FEC_1_2: | ||
479 | s5h1420_writereg(state, 0x31, 0x10); | ||
480 | s5h1420_writereg(state, 0x30, 0x01); | ||
481 | break; | ||
482 | |||
483 | case FEC_2_3: | ||
484 | s5h1420_writereg(state, 0x31, 0x11); | ||
485 | s5h1420_writereg(state, 0x30, 0x02); | ||
486 | break; | ||
487 | |||
488 | case FEC_3_4: | ||
489 | s5h1420_writereg(state, 0x31, 0x12); | ||
490 | s5h1420_writereg(state, 0x30, 0x04); | ||
491 | break; | ||
492 | |||
493 | case FEC_5_6: | ||
494 | s5h1420_writereg(state, 0x31, 0x13); | ||
495 | s5h1420_writereg(state, 0x30, 0x08); | ||
496 | break; | ||
497 | |||
498 | case FEC_6_7: | ||
499 | s5h1420_writereg(state, 0x31, 0x14); | ||
500 | s5h1420_writereg(state, 0x30, 0x10); | ||
501 | break; | ||
502 | |||
503 | case FEC_7_8: | ||
504 | s5h1420_writereg(state, 0x31, 0x15); | ||
505 | s5h1420_writereg(state, 0x30, 0x20); | ||
506 | break; | ||
507 | |||
508 | default: | ||
509 | return; | ||
510 | } | ||
511 | } | ||
512 | } | ||
513 | |||
514 | static fe_code_rate_t s5h1420_getfec(struct s5h1420_state* state) | ||
515 | { | ||
516 | switch(s5h1420_readreg(state, 0x32) & 0x07) { | ||
517 | case 0: | ||
518 | return FEC_1_2; | ||
519 | |||
520 | case 1: | ||
521 | return FEC_2_3; | ||
522 | |||
523 | case 2: | ||
524 | return FEC_3_4; | ||
525 | |||
526 | case 3: | ||
527 | return FEC_5_6; | ||
528 | |||
529 | case 4: | ||
530 | return FEC_6_7; | ||
531 | |||
532 | case 5: | ||
533 | return FEC_7_8; | ||
534 | } | ||
535 | |||
536 | return FEC_NONE; | ||
537 | } | ||
538 | |||
539 | static void s5h1420_setinversion(struct s5h1420_state* state, struct dvb_frontend_parameters *p) | ||
540 | { | ||
541 | if ((p->u.qpsk.fec_inner == FEC_AUTO) || (p->inversion == INVERSION_AUTO)) { | ||
542 | s5h1420_writereg(state, 0x31, 0x00); | ||
543 | s5h1420_writereg(state, 0x30, 0x3f); | ||
544 | } else { | ||
545 | u8 tmp = s5h1420_readreg(state, 0x31) & 0xf7; | ||
546 | tmp |= 0x10; | ||
547 | |||
548 | if (p->inversion == INVERSION_ON) | ||
549 | tmp |= 0x80; | ||
550 | |||
551 | s5h1420_writereg(state, 0x31, tmp); | ||
552 | } | ||
553 | } | ||
554 | |||
555 | static fe_spectral_inversion_t s5h1420_getinversion(struct s5h1420_state* state) | ||
556 | { | ||
557 | if (s5h1420_readreg(state, 0x32) & 0x08) | ||
558 | return INVERSION_ON; | ||
559 | |||
560 | return INVERSION_OFF; | ||
561 | } | ||
562 | |||
563 | static int s5h1420_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | ||
564 | { | ||
565 | struct s5h1420_state* state = fe->demodulator_priv; | ||
566 | u32 frequency_delta; | ||
567 | struct dvb_frontend_tune_settings fesettings; | ||
568 | |||
569 | /* check if we should do a fast-tune */ | ||
570 | memcpy(&fesettings.parameters, p, sizeof(struct dvb_frontend_parameters)); | ||
571 | s5h1420_get_tune_settings(fe, &fesettings); | ||
572 | frequency_delta = p->frequency - state->tunedfreq; | ||
573 | if ((frequency_delta > -fesettings.max_drift) && (frequency_delta < fesettings.max_drift) && | ||
574 | (frequency_delta != 0) && | ||
575 | (state->fec_inner == p->u.qpsk.fec_inner) && | ||
576 | (state->symbol_rate == p->u.qpsk.symbol_rate)) { | ||
577 | |||
578 | s5h1420_setfreqoffset(state, frequency_delta); | ||
579 | return 0; | ||
580 | } | ||
581 | |||
582 | /* first of all, software reset */ | ||
583 | s5h1420_reset(state); | ||
584 | |||
585 | /* set tuner PLL */ | ||
586 | if (state->config->pll_set) { | ||
587 | s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1); | ||
588 | state->config->pll_set(fe, p, &state->tunedfreq); | ||
589 | s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) & 0xfe); | ||
590 | } | ||
591 | |||
592 | /* set s5h1420 fclk PLL according to desired symbol rate */ | ||
593 | if (p->u.qpsk.symbol_rate > 28000000) { | ||
594 | state->fclk = 88000000; | ||
595 | s5h1420_writereg(state, 0x03, 0x50); | ||
596 | s5h1420_writereg(state, 0x04, 0x40); | ||
597 | s5h1420_writereg(state, 0x05, 0xae); | ||
598 | } else if (p->u.qpsk.symbol_rate > 21000000) { | ||
599 | state->fclk = 59000000; | ||
600 | s5h1420_writereg(state, 0x03, 0x33); | ||
601 | s5h1420_writereg(state, 0x04, 0x40); | ||
602 | s5h1420_writereg(state, 0x05, 0xae); | ||
603 | } else { | ||
604 | state->fclk = 88000000; | ||
605 | s5h1420_writereg(state, 0x03, 0x50); | ||
606 | s5h1420_writereg(state, 0x04, 0x40); | ||
607 | s5h1420_writereg(state, 0x05, 0xac); | ||
608 | } | ||
609 | |||
610 | /* set misc registers */ | ||
611 | s5h1420_writereg(state, 0x02, 0x00); | ||
612 | s5h1420_writereg(state, 0x07, 0xb0); | ||
613 | s5h1420_writereg(state, 0x0a, 0x67); | ||
614 | s5h1420_writereg(state, 0x0b, 0x78); | ||
615 | s5h1420_writereg(state, 0x0c, 0x48); | ||
616 | s5h1420_writereg(state, 0x0d, 0x6b); | ||
617 | s5h1420_writereg(state, 0x2e, 0x8e); | ||
618 | s5h1420_writereg(state, 0x35, 0x33); | ||
619 | s5h1420_writereg(state, 0x38, 0x01); | ||
620 | s5h1420_writereg(state, 0x39, 0x7d); | ||
621 | s5h1420_writereg(state, 0x3a, (state->fclk + (TONE_FREQ * 32) - 1) / (TONE_FREQ * 32)); | ||
622 | s5h1420_writereg(state, 0x3c, 0x00); | ||
623 | s5h1420_writereg(state, 0x45, 0x61); | ||
624 | s5h1420_writereg(state, 0x46, 0x1d); | ||
625 | |||
626 | /* start QPSK */ | ||
627 | s5h1420_writereg(state, 0x05, s5h1420_readreg(state, 0x05) | 1); | ||
628 | |||
629 | /* set the frequency offset to adjust for PLL inaccuracy */ | ||
630 | s5h1420_setfreqoffset(state, p->frequency - state->tunedfreq); | ||
631 | |||
632 | /* set the reset of the parameters */ | ||
633 | s5h1420_setsymbolrate(state, p); | ||
634 | s5h1420_setinversion(state, p); | ||
635 | s5h1420_setfec(state, p); | ||
636 | |||
637 | state->fec_inner = p->u.qpsk.fec_inner; | ||
638 | state->symbol_rate = p->u.qpsk.symbol_rate; | ||
639 | state->postlocked = 0; | ||
640 | return 0; | ||
641 | } | ||
642 | |||
643 | static int s5h1420_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | ||
644 | { | ||
645 | struct s5h1420_state* state = fe->demodulator_priv; | ||
646 | |||
647 | p->frequency = state->tunedfreq + s5h1420_getfreqoffset(state); | ||
648 | p->inversion = s5h1420_getinversion(state); | ||
649 | p->u.qpsk.symbol_rate = s5h1420_getsymbolrate(state); | ||
650 | p->u.qpsk.fec_inner = s5h1420_getfec(state); | ||
651 | |||
652 | return 0; | ||
653 | } | ||
654 | |||
655 | static int s5h1420_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) | ||
656 | { | ||
657 | if (fesettings->parameters.u.qpsk.symbol_rate > 20000000) { | ||
658 | fesettings->min_delay_ms = 50; | ||
659 | fesettings->step_size = 2000; | ||
660 | fesettings->max_drift = 8000; | ||
661 | } else if (fesettings->parameters.u.qpsk.symbol_rate > 12000000) { | ||
662 | fesettings->min_delay_ms = 100; | ||
663 | fesettings->step_size = 1500; | ||
664 | fesettings->max_drift = 9000; | ||
665 | } else if (fesettings->parameters.u.qpsk.symbol_rate > 8000000) { | ||
666 | fesettings->min_delay_ms = 100; | ||
667 | fesettings->step_size = 1000; | ||
668 | fesettings->max_drift = 8000; | ||
669 | } else if (fesettings->parameters.u.qpsk.symbol_rate > 4000000) { | ||
670 | fesettings->min_delay_ms = 100; | ||
671 | fesettings->step_size = 500; | ||
672 | fesettings->max_drift = 7000; | ||
673 | } else if (fesettings->parameters.u.qpsk.symbol_rate > 2000000) { | ||
674 | fesettings->min_delay_ms = 200; | ||
675 | fesettings->step_size = (fesettings->parameters.u.qpsk.symbol_rate / 8000); | ||
676 | fesettings->max_drift = 14 * fesettings->step_size; | ||
677 | } else { | ||
678 | fesettings->min_delay_ms = 200; | ||
679 | fesettings->step_size = (fesettings->parameters.u.qpsk.symbol_rate / 8000); | ||
680 | fesettings->max_drift = 18 * fesettings->step_size; | ||
681 | } | ||
682 | |||
683 | return 0; | ||
684 | } | ||
685 | |||
686 | static int s5h1420_init (struct dvb_frontend* fe) | ||
687 | { | ||
688 | struct s5h1420_state* state = fe->demodulator_priv; | ||
689 | |||
690 | /* disable power down and do reset */ | ||
691 | s5h1420_writereg(state, 0x02, 0x10); | ||
692 | msleep(10); | ||
693 | s5h1420_reset(state); | ||
694 | |||
695 | /* init PLL */ | ||
696 | if (state->config->pll_init) { | ||
697 | s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1); | ||
698 | state->config->pll_init(fe); | ||
699 | s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) & 0xfe); | ||
700 | } | ||
701 | |||
702 | return 0; | ||
703 | } | ||
704 | |||
705 | static int s5h1420_sleep(struct dvb_frontend* fe) | ||
706 | { | ||
707 | struct s5h1420_state* state = fe->demodulator_priv; | ||
708 | |||
709 | return s5h1420_writereg(state, 0x02, 0x12); | ||
710 | } | ||
711 | |||
712 | static void s5h1420_release(struct dvb_frontend* fe) | ||
713 | { | ||
714 | struct s5h1420_state* state = fe->demodulator_priv; | ||
715 | kfree(state); | ||
716 | } | ||
717 | |||
718 | static struct dvb_frontend_ops s5h1420_ops; | ||
719 | |||
720 | struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config, struct i2c_adapter* i2c) | ||
721 | { | ||
722 | struct s5h1420_state* state = NULL; | ||
723 | u8 identity; | ||
724 | |||
725 | /* allocate memory for the internal state */ | ||
726 | state = kmalloc(sizeof(struct s5h1420_state), GFP_KERNEL); | ||
727 | if (state == NULL) | ||
728 | goto error; | ||
729 | |||
730 | /* setup the state */ | ||
731 | state->config = config; | ||
732 | state->i2c = i2c; | ||
733 | memcpy(&state->ops, &s5h1420_ops, sizeof(struct dvb_frontend_ops)); | ||
734 | state->postlocked = 0; | ||
735 | state->fclk = 88000000; | ||
736 | state->tunedfreq = 0; | ||
737 | state->fec_inner = FEC_NONE; | ||
738 | state->symbol_rate = 0; | ||
739 | |||
740 | /* check if the demod is there + identify it */ | ||
741 | identity = s5h1420_readreg(state, 0x00); | ||
742 | if (identity != 0x03) | ||
743 | goto error; | ||
744 | |||
745 | /* create dvb_frontend */ | ||
746 | state->frontend.ops = &state->ops; | ||
747 | state->frontend.demodulator_priv = state; | ||
748 | return &state->frontend; | ||
749 | |||
750 | error: | ||
751 | kfree(state); | ||
752 | return NULL; | ||
753 | } | ||
754 | |||
755 | static struct dvb_frontend_ops s5h1420_ops = { | ||
756 | |||
757 | .info = { | ||
758 | .name = "Samsung S5H1420 DVB-S", | ||
759 | .type = FE_QPSK, | ||
760 | .frequency_min = 950000, | ||
761 | .frequency_max = 2150000, | ||
762 | .frequency_stepsize = 125, /* kHz for QPSK frontends */ | ||
763 | .frequency_tolerance = 29500, | ||
764 | .symbol_rate_min = 1000000, | ||
765 | .symbol_rate_max = 45000000, | ||
766 | /* .symbol_rate_tolerance = ???,*/ | ||
767 | .caps = FE_CAN_INVERSION_AUTO | | ||
768 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | ||
769 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | | ||
770 | FE_CAN_QPSK | ||
771 | }, | ||
772 | |||
773 | .release = s5h1420_release, | ||
774 | |||
775 | .init = s5h1420_init, | ||
776 | .sleep = s5h1420_sleep, | ||
777 | |||
778 | .set_frontend = s5h1420_set_frontend, | ||
779 | .get_frontend = s5h1420_get_frontend, | ||
780 | .get_tune_settings = s5h1420_get_tune_settings, | ||
781 | |||
782 | .read_status = s5h1420_read_status, | ||
783 | .read_ber = s5h1420_read_ber, | ||
784 | .read_signal_strength = s5h1420_read_signal_strength, | ||
785 | .read_ucblocks = s5h1420_read_ucblocks, | ||
786 | |||
787 | .diseqc_send_master_cmd = s5h1420_send_master_cmd, | ||
788 | .diseqc_recv_slave_reply = s5h1420_recv_slave_reply, | ||
789 | .diseqc_send_burst = s5h1420_send_burst, | ||
790 | .set_tone = s5h1420_set_tone, | ||
791 | .set_voltage = s5h1420_set_voltage, | ||
792 | }; | ||
793 | |||
794 | module_param(debug, int, 0644); | ||
795 | |||
796 | MODULE_DESCRIPTION("Samsung S5H1420 DVB-S Demodulator driver"); | ||
797 | MODULE_AUTHOR("Andrew de Quincey"); | ||
798 | MODULE_LICENSE("GPL"); | ||
799 | |||
800 | EXPORT_SYMBOL(s5h1420_attach); | ||
diff --git a/drivers/media/dvb/frontends/s5h1420.h b/drivers/media/dvb/frontends/s5h1420.h new file mode 100644 index 000000000000..b687fc77ceb3 --- /dev/null +++ b/drivers/media/dvb/frontends/s5h1420.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | Driver for S5H1420 QPSK Demodulators | ||
3 | |||
4 | Copyright (C) 2005 Andrew de Quincey <adq_dvb@lidskialf.net> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
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 | |||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | |||
21 | */ | ||
22 | |||
23 | #ifndef S5H1420_H | ||
24 | #define S5H1420_H | ||
25 | |||
26 | #include <linux/dvb/frontend.h> | ||
27 | |||
28 | struct s5h1420_config | ||
29 | { | ||
30 | /* the demodulator's i2c address */ | ||
31 | u8 demod_address; | ||
32 | |||
33 | /* PLL maintenance */ | ||
34 | int (*pll_init)(struct dvb_frontend* fe); | ||
35 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u32* freqout); | ||
36 | }; | ||
37 | |||
38 | extern struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config, | ||
39 | struct i2c_adapter* i2c); | ||
40 | |||
41 | #endif // S5H1420_H | ||
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c index e681263bf079..928aca052afe 100644 --- a/drivers/media/dvb/frontends/stv0297.c +++ b/drivers/media/dvb/frontends/stv0297.c | |||
@@ -617,7 +617,7 @@ static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par | |||
617 | 617 | ||
618 | /* wait for WGAGC lock */ | 618 | /* wait for WGAGC lock */ |
619 | starttime = jiffies; | 619 | starttime = jiffies; |
620 | timeout = jiffies + (200 * HZ) / 1000; | 620 | timeout = jiffies + msecs_to_jiffies(2000); |
621 | while (time_before(jiffies, timeout)) { | 621 | while (time_before(jiffies, timeout)) { |
622 | msleep(10); | 622 | msleep(10); |
623 | if (stv0297_readreg(state, 0x43) & 0x08) | 623 | if (stv0297_readreg(state, 0x43) & 0x08) |
@@ -629,7 +629,7 @@ static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par | |||
629 | msleep(20); | 629 | msleep(20); |
630 | 630 | ||
631 | /* wait for equaliser partial convergence */ | 631 | /* wait for equaliser partial convergence */ |
632 | timeout = jiffies + (50 * HZ) / 1000; | 632 | timeout = jiffies + msecs_to_jiffies(500); |
633 | while (time_before(jiffies, timeout)) { | 633 | while (time_before(jiffies, timeout)) { |
634 | msleep(10); | 634 | msleep(10); |
635 | 635 | ||
@@ -642,7 +642,7 @@ static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par | |||
642 | } | 642 | } |
643 | 643 | ||
644 | /* wait for equaliser full convergence */ | 644 | /* wait for equaliser full convergence */ |
645 | timeout = jiffies + (delay * HZ) / 1000; | 645 | timeout = jiffies + msecs_to_jiffies(delay); |
646 | while (time_before(jiffies, timeout)) { | 646 | while (time_before(jiffies, timeout)) { |
647 | msleep(10); | 647 | msleep(10); |
648 | 648 | ||
@@ -659,7 +659,7 @@ static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par | |||
659 | stv0297_writereg_mask(state, 0x88, 8, 0); | 659 | stv0297_writereg_mask(state, 0x88, 8, 0); |
660 | 660 | ||
661 | /* wait for main lock */ | 661 | /* wait for main lock */ |
662 | timeout = jiffies + (20 * HZ) / 1000; | 662 | timeout = jiffies + msecs_to_jiffies(20); |
663 | while (time_before(jiffies, timeout)) { | 663 | while (time_before(jiffies, timeout)) { |
664 | msleep(10); | 664 | msleep(10); |
665 | 665 | ||
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c index 0beb370792ae..ab0c032472cc 100644 --- a/drivers/media/dvb/frontends/tda1004x.c +++ b/drivers/media/dvb/frontends/tda1004x.c | |||
@@ -49,10 +49,8 @@ struct tda1004x_state { | |||
49 | /* private demod data */ | 49 | /* private demod data */ |
50 | u8 initialised; | 50 | u8 initialised; |
51 | enum tda1004x_demod demod_type; | 51 | enum tda1004x_demod demod_type; |
52 | u8 fw_version; | ||
53 | }; | 52 | }; |
54 | 53 | ||
55 | |||
56 | static int debug; | 54 | static int debug; |
57 | #define dprintk(args...) \ | 55 | #define dprintk(args...) \ |
58 | do { \ | 56 | do { \ |
@@ -122,6 +120,8 @@ static int debug; | |||
122 | #define TDA10046H_GPIO_OUT_SEL 0x41 | 120 | #define TDA10046H_GPIO_OUT_SEL 0x41 |
123 | #define TDA10046H_GPIO_SELECT 0x42 | 121 | #define TDA10046H_GPIO_SELECT 0x42 |
124 | #define TDA10046H_AGC_CONF 0x43 | 122 | #define TDA10046H_AGC_CONF 0x43 |
123 | #define TDA10046H_AGC_THR 0x44 | ||
124 | #define TDA10046H_AGC_RENORM 0x45 | ||
125 | #define TDA10046H_AGC_GAINS 0x46 | 125 | #define TDA10046H_AGC_GAINS 0x46 |
126 | #define TDA10046H_AGC_TUN_MIN 0x47 | 126 | #define TDA10046H_AGC_TUN_MIN 0x47 |
127 | #define TDA10046H_AGC_TUN_MAX 0x48 | 127 | #define TDA10046H_AGC_TUN_MAX 0x48 |
@@ -274,14 +274,26 @@ static int tda10046h_set_bandwidth(struct tda1004x_state *state, | |||
274 | switch (bandwidth) { | 274 | switch (bandwidth) { |
275 | case BANDWIDTH_6_MHZ: | 275 | case BANDWIDTH_6_MHZ: |
276 | tda1004x_write_buf(state, TDA10046H_TIME_WREF1, bandwidth_6mhz, sizeof(bandwidth_6mhz)); | 276 | tda1004x_write_buf(state, TDA10046H_TIME_WREF1, bandwidth_6mhz, sizeof(bandwidth_6mhz)); |
277 | if (state->config->if_freq == TDA10046_FREQ_045) { | ||
278 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0x09); | ||
279 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0x4f); | ||
280 | } | ||
277 | break; | 281 | break; |
278 | 282 | ||
279 | case BANDWIDTH_7_MHZ: | 283 | case BANDWIDTH_7_MHZ: |
280 | tda1004x_write_buf(state, TDA10046H_TIME_WREF1, bandwidth_7mhz, sizeof(bandwidth_7mhz)); | 284 | tda1004x_write_buf(state, TDA10046H_TIME_WREF1, bandwidth_7mhz, sizeof(bandwidth_7mhz)); |
285 | if (state->config->if_freq == TDA10046_FREQ_045) { | ||
286 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0x0a); | ||
287 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0x79); | ||
288 | } | ||
281 | break; | 289 | break; |
282 | 290 | ||
283 | case BANDWIDTH_8_MHZ: | 291 | case BANDWIDTH_8_MHZ: |
284 | tda1004x_write_buf(state, TDA10046H_TIME_WREF1, bandwidth_8mhz, sizeof(bandwidth_8mhz)); | 292 | tda1004x_write_buf(state, TDA10046H_TIME_WREF1, bandwidth_8mhz, sizeof(bandwidth_8mhz)); |
293 | if (state->config->if_freq == TDA10046_FREQ_045) { | ||
294 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0x0b); | ||
295 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0xa3); | ||
296 | } | ||
285 | break; | 297 | break; |
286 | 298 | ||
287 | default: | 299 | default: |
@@ -315,20 +327,35 @@ static int tda1004x_do_upload(struct tda1004x_state *state, | |||
315 | memcpy(buf + 1, mem + pos, tx_size); | 327 | memcpy(buf + 1, mem + pos, tx_size); |
316 | fw_msg.len = tx_size + 1; | 328 | fw_msg.len = tx_size + 1; |
317 | if (i2c_transfer(state->i2c, &fw_msg, 1) != 1) { | 329 | if (i2c_transfer(state->i2c, &fw_msg, 1) != 1) { |
318 | printk("tda1004x: Error during firmware upload\n"); | 330 | printk(KERN_ERR "tda1004x: Error during firmware upload\n"); |
319 | return -EIO; | 331 | return -EIO; |
320 | } | 332 | } |
321 | pos += tx_size; | 333 | pos += tx_size; |
322 | 334 | ||
323 | dprintk("%s: fw_pos=0x%x\n", __FUNCTION__, pos); | 335 | dprintk("%s: fw_pos=0x%x\n", __FUNCTION__, pos); |
324 | } | 336 | } |
337 | // give the DSP a chance to settle 03/10/05 Hac | ||
338 | msleep(100); | ||
325 | 339 | ||
326 | return 0; | 340 | return 0; |
327 | } | 341 | } |
328 | 342 | ||
329 | static int tda1004x_check_upload_ok(struct tda1004x_state *state, u8 dspVersion) | 343 | static int tda1004x_check_upload_ok(struct tda1004x_state *state) |
330 | { | 344 | { |
331 | u8 data1, data2; | 345 | u8 data1, data2; |
346 | unsigned long timeout; | ||
347 | |||
348 | if (state->demod_type == TDA1004X_DEMOD_TDA10046) { | ||
349 | timeout = jiffies + 2 * HZ; | ||
350 | while(!(tda1004x_read_byte(state, TDA1004X_STATUS_CD) & 0x20)) { | ||
351 | if (time_after(jiffies, timeout)) { | ||
352 | printk(KERN_ERR "tda1004x: timeout waiting for DSP ready\n"); | ||
353 | break; | ||
354 | } | ||
355 | msleep(1); | ||
356 | } | ||
357 | } else | ||
358 | msleep(100); | ||
332 | 359 | ||
333 | // check upload was OK | 360 | // check upload was OK |
334 | tda1004x_write_mask(state, TDA1004X_CONFC4, 0x10, 0); // we want to read from the DSP | 361 | tda1004x_write_mask(state, TDA1004X_CONFC4, 0x10, 0); // we want to read from the DSP |
@@ -336,9 +363,11 @@ static int tda1004x_check_upload_ok(struct tda1004x_state *state, u8 dspVersion) | |||
336 | 363 | ||
337 | data1 = tda1004x_read_byte(state, TDA1004X_DSP_DATA1); | 364 | data1 = tda1004x_read_byte(state, TDA1004X_DSP_DATA1); |
338 | data2 = tda1004x_read_byte(state, TDA1004X_DSP_DATA2); | 365 | data2 = tda1004x_read_byte(state, TDA1004X_DSP_DATA2); |
339 | if ((data1 != 0x67) || (data2 != dspVersion)) | 366 | if (data1 != 0x67 || data2 < 0x20 || data2 > 0x2e) { |
367 | printk(KERN_INFO "tda1004x: found firmware revision %x -- invalid\n", data2); | ||
340 | return -EIO; | 368 | return -EIO; |
341 | 369 | } | |
370 | printk(KERN_INFO "tda1004x: found firmware revision %x -- ok\n", data2); | ||
342 | return 0; | 371 | return 0; |
343 | } | 372 | } |
344 | 373 | ||
@@ -349,14 +378,14 @@ static int tda10045_fwupload(struct dvb_frontend* fe) | |||
349 | const struct firmware *fw; | 378 | const struct firmware *fw; |
350 | 379 | ||
351 | /* don't re-upload unless necessary */ | 380 | /* don't re-upload unless necessary */ |
352 | if (tda1004x_check_upload_ok(state, 0x2c) == 0) | 381 | if (tda1004x_check_upload_ok(state) == 0) |
353 | return 0; | 382 | return 0; |
354 | 383 | ||
355 | /* request the firmware, this will block until someone uploads it */ | 384 | /* request the firmware, this will block until someone uploads it */ |
356 | printk("tda1004x: waiting for firmware upload (%s)...\n", TDA10045_DEFAULT_FIRMWARE); | 385 | printk(KERN_INFO "tda1004x: waiting for firmware upload (%s)...\n", TDA10045_DEFAULT_FIRMWARE); |
357 | ret = state->config->request_firmware(fe, &fw, TDA10045_DEFAULT_FIRMWARE); | 386 | ret = state->config->request_firmware(fe, &fw, TDA10045_DEFAULT_FIRMWARE); |
358 | if (ret) { | 387 | if (ret) { |
359 | printk("tda1004x: no firmware upload (timeout or file not found?)\n"); | 388 | printk(KERN_ERR "tda1004x: no firmware upload (timeout or file not found?)\n"); |
360 | return ret; | 389 | return ret; |
361 | } | 390 | } |
362 | 391 | ||
@@ -370,95 +399,93 @@ static int tda10045_fwupload(struct dvb_frontend* fe) | |||
370 | tda10045h_set_bandwidth(state, BANDWIDTH_8_MHZ); | 399 | tda10045h_set_bandwidth(state, BANDWIDTH_8_MHZ); |
371 | 400 | ||
372 | ret = tda1004x_do_upload(state, fw->data, fw->size, TDA10045H_FWPAGE, TDA10045H_CODE_IN); | 401 | ret = tda1004x_do_upload(state, fw->data, fw->size, TDA10045H_FWPAGE, TDA10045H_CODE_IN); |
402 | release_firmware(fw); | ||
373 | if (ret) | 403 | if (ret) |
374 | return ret; | 404 | return ret; |
375 | printk("tda1004x: firmware upload complete\n"); | 405 | printk(KERN_INFO "tda1004x: firmware upload complete\n"); |
376 | 406 | ||
377 | /* wait for DSP to initialise */ | 407 | /* wait for DSP to initialise */ |
378 | /* DSPREADY doesn't seem to work on the TDA10045H */ | 408 | /* DSPREADY doesn't seem to work on the TDA10045H */ |
379 | msleep(100); | 409 | msleep(100); |
380 | 410 | ||
381 | return tda1004x_check_upload_ok(state, 0x2c); | 411 | return tda1004x_check_upload_ok(state); |
382 | } | 412 | } |
383 | 413 | ||
384 | static int tda10046_get_fw_version(struct tda1004x_state *state, | 414 | static void tda10046_init_plls(struct dvb_frontend* fe) |
385 | const struct firmware *fw) | ||
386 | { | 415 | { |
387 | const unsigned char pattern[] = { 0x67, 0x00, 0x50, 0x62, 0x5e, 0x18, 0x67 }; | 416 | struct tda1004x_state* state = fe->demodulator_priv; |
388 | unsigned int i; | ||
389 | |||
390 | /* area guessed from firmware v20, v21 and v25 */ | ||
391 | for (i = 0x660; i < 0x700; i++) { | ||
392 | if (!memcmp(&fw->data[i], pattern, sizeof(pattern))) { | ||
393 | state->fw_version = fw->data[i + sizeof(pattern)]; | ||
394 | printk(KERN_INFO "tda1004x: using firmware v%02x\n", | ||
395 | state->fw_version); | ||
396 | return 0; | ||
397 | } | ||
398 | } | ||
399 | 417 | ||
400 | return -EINVAL; | 418 | tda1004x_write_byteI(state, TDA10046H_CONFPLL1, 0xf0); |
419 | tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 10); // PLL M = 10 | ||
420 | if (state->config->xtal_freq == TDA10046_XTAL_4M ) { | ||
421 | dprintk("%s: setting up PLLs for a 4 MHz Xtal\n", __FUNCTION__); | ||
422 | tda1004x_write_byteI(state, TDA10046H_CONFPLL3, 0); // PLL P = N = 0 | ||
423 | } else { | ||
424 | dprintk("%s: setting up PLLs for a 16 MHz Xtal\n", __FUNCTION__); | ||
425 | tda1004x_write_byteI(state, TDA10046H_CONFPLL3, 3); // PLL P = 0, N = 3 | ||
426 | } | ||
427 | tda1004x_write_byteI(state, TDA10046H_FREQ_OFFSET, 99); | ||
428 | switch (state->config->if_freq) { | ||
429 | case TDA10046_FREQ_3617: | ||
430 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0xd4); | ||
431 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0x2c); | ||
432 | break; | ||
433 | case TDA10046_FREQ_3613: | ||
434 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0xd4); | ||
435 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0x13); | ||
436 | break; | ||
437 | case TDA10046_FREQ_045: | ||
438 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0x0b); | ||
439 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0xa3); | ||
440 | break; | ||
441 | case TDA10046_FREQ_052: | ||
442 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0x0c); | ||
443 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0x06); | ||
444 | break; | ||
445 | } | ||
446 | tda10046h_set_bandwidth(state, BANDWIDTH_8_MHZ); // default bandwidth 8 MHz | ||
401 | } | 447 | } |
402 | 448 | ||
403 | static int tda10046_fwupload(struct dvb_frontend* fe) | 449 | static int tda10046_fwupload(struct dvb_frontend* fe) |
404 | { | 450 | { |
405 | struct tda1004x_state* state = fe->demodulator_priv; | 451 | struct tda1004x_state* state = fe->demodulator_priv; |
406 | unsigned long timeout; | ||
407 | int ret; | 452 | int ret; |
408 | const struct firmware *fw; | 453 | const struct firmware *fw; |
409 | 454 | ||
410 | /* reset + wake up chip */ | 455 | /* reset + wake up chip */ |
411 | tda1004x_write_mask(state, TDA1004X_CONFC4, 1, 0); | 456 | tda1004x_write_byteI(state, TDA1004X_CONFC4, 0); |
412 | tda1004x_write_mask(state, TDA10046H_CONF_TRISTATE1, 1, 0); | 457 | tda1004x_write_mask(state, TDA10046H_CONF_TRISTATE1, 1, 0); |
413 | msleep(100); | 458 | /* let the clocks recover from sleep */ |
459 | msleep(5); | ||
414 | 460 | ||
415 | /* don't re-upload unless necessary */ | 461 | /* don't re-upload unless necessary */ |
416 | if (tda1004x_check_upload_ok(state, state->fw_version) == 0) | 462 | if (tda1004x_check_upload_ok(state) == 0) |
417 | return 0; | 463 | return 0; |
418 | 464 | ||
419 | /* request the firmware, this will block until someone uploads it */ | ||
420 | printk("tda1004x: waiting for firmware upload (%s)...\n", TDA10046_DEFAULT_FIRMWARE); | ||
421 | ret = state->config->request_firmware(fe, &fw, TDA10046_DEFAULT_FIRMWARE); | ||
422 | if (ret) { | ||
423 | printk("tda1004x: no firmware upload (timeout or file not found?)\n"); | ||
424 | return ret; | ||
425 | } | ||
426 | |||
427 | if (fw->size < 24478) { /* size of firmware v20, which is the smallest of v20, v21 and v25 */ | ||
428 | printk("tda1004x: firmware file seems to be too small (%d bytes)\n", fw->size); | ||
429 | return -EINVAL; | ||
430 | } | ||
431 | |||
432 | ret = tda10046_get_fw_version(state, fw); | ||
433 | if (ret < 0) { | ||
434 | printk("tda1004x: unable to find firmware version\n"); | ||
435 | return ret; | ||
436 | } | ||
437 | |||
438 | /* set parameters */ | 465 | /* set parameters */ |
439 | tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 10); | 466 | tda10046_init_plls(fe); |
440 | tda1004x_write_byteI(state, TDA10046H_CONFPLL3, state->config->n_i2c); | 467 | |
441 | tda1004x_write_byteI(state, TDA10046H_FREQ_OFFSET, 99); | 468 | if (state->config->request_firmware != NULL) { |
442 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0xd4); | 469 | /* request the firmware, this will block until someone uploads it */ |
443 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0x2c); | 470 | printk(KERN_INFO "tda1004x: waiting for firmware upload...\n"); |
444 | tda1004x_write_mask(state, TDA1004X_CONFC4, 8, 8); // going to boot from HOST | 471 | ret = state->config->request_firmware(fe, &fw, TDA10046_DEFAULT_FIRMWARE); |
445 | 472 | if (ret) { | |
446 | ret = tda1004x_do_upload(state, fw->data, fw->size, TDA10046H_CODE_CPT, TDA10046H_CODE_IN); | 473 | printk(KERN_ERR "tda1004x: no firmware upload (timeout or file not found?)\n"); |
447 | if (ret) | 474 | return ret; |
448 | return ret; | ||
449 | printk("tda1004x: firmware upload complete\n"); | ||
450 | |||
451 | /* wait for DSP to initialise */ | ||
452 | timeout = jiffies + HZ; | ||
453 | while (!(tda1004x_read_byte(state, TDA1004X_STATUS_CD) & 0x20)) { | ||
454 | if (time_after(jiffies, timeout)) { | ||
455 | printk("tda1004x: DSP failed to initialised.\n"); | ||
456 | return -EIO; | ||
457 | } | 475 | } |
458 | msleep(1); | 476 | tda1004x_write_mask(state, TDA1004X_CONFC4, 8, 8); // going to boot from HOST |
477 | ret = tda1004x_do_upload(state, fw->data, fw->size, TDA10046H_CODE_CPT, TDA10046H_CODE_IN); | ||
478 | release_firmware(fw); | ||
479 | if (ret) | ||
480 | return ret; | ||
481 | } else { | ||
482 | /* boot from firmware eeprom */ | ||
483 | /* Hac Note: we might need to do some GPIO Magic here */ | ||
484 | printk(KERN_INFO "tda1004x: booting from eeprom\n"); | ||
485 | tda1004x_write_mask(state, TDA1004X_CONFC4, 4, 4); | ||
486 | msleep(300); | ||
459 | } | 487 | } |
460 | 488 | return tda1004x_check_upload_ok(state); | |
461 | return tda1004x_check_upload_ok(state, state->fw_version); | ||
462 | } | 489 | } |
463 | 490 | ||
464 | static int tda1004x_encode_fec(int fec) | 491 | static int tda1004x_encode_fec(int fec) |
@@ -560,12 +587,10 @@ static int tda10046_init(struct dvb_frontend* fe) | |||
560 | 587 | ||
561 | if (tda10046_fwupload(fe)) { | 588 | if (tda10046_fwupload(fe)) { |
562 | printk("tda1004x: firmware upload failed\n"); | 589 | printk("tda1004x: firmware upload failed\n"); |
563 | return -EIO; | 590 | return -EIO; |
564 | } | 591 | } |
565 | 592 | ||
566 | tda1004x_write_mask(state, TDA1004X_CONFC4, 1, 0); // wake up the chip | 593 | // Init the tuner PLL |
567 | |||
568 | // Init the PLL | ||
569 | if (state->config->pll_init) { | 594 | if (state->config->pll_init) { |
570 | tda1004x_enable_tuner_i2c(state); | 595 | tda1004x_enable_tuner_i2c(state); |
571 | state->config->pll_init(fe); | 596 | state->config->pll_init(fe); |
@@ -574,32 +599,44 @@ static int tda10046_init(struct dvb_frontend* fe) | |||
574 | 599 | ||
575 | // tda setup | 600 | // tda setup |
576 | tda1004x_write_mask(state, TDA1004X_CONFC4, 0x20, 0); // disable DSP watchdog timer | 601 | tda1004x_write_mask(state, TDA1004X_CONFC4, 0x20, 0); // disable DSP watchdog timer |
577 | tda1004x_write_mask(state, TDA1004X_CONFC1, 0x40, 0x40); | 602 | tda1004x_write_byteI(state, TDA1004X_AUTO, 7); // select HP stream |
578 | tda1004x_write_mask(state, TDA1004X_AUTO, 8, 0); // select HP stream | 603 | tda1004x_write_byteI(state, TDA1004X_CONFC1, 8); // disable pulse killer |
579 | tda1004x_write_mask(state, TDA1004X_CONFC1, 0x80, 0); // disable pulse killer | 604 | |
580 | tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 10); // PLL M = 10 | 605 | tda10046_init_plls(fe); |
581 | tda1004x_write_byteI(state, TDA10046H_CONFPLL3, state->config->n_i2c); // PLL P = N = 0 | 606 | switch (state->config->agc_config) { |
582 | tda1004x_write_byteI(state, TDA10046H_FREQ_OFFSET, 99); // FREQOFFS = 99 | 607 | case TDA10046_AGC_DEFAULT: |
583 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0xd4); // } PHY2 = -11221 | 608 | tda1004x_write_byteI(state, TDA10046H_AGC_CONF, 0x00); // AGC setup |
584 | tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0x2c); // } | 609 | tda1004x_write_byteI(state, TDA10046H_CONF_POLARITY, 0x60); // set AGC polarities |
585 | tda1004x_write_byteI(state, TDA10046H_AGC_CONF, 0); // AGC setup | 610 | break; |
586 | tda1004x_write_mask(state, TDA10046H_CONF_POLARITY, 0x60, 0x60); // set AGC polarities | 611 | case TDA10046_AGC_IFO_AUTO_NEG: |
612 | tda1004x_write_byteI(state, TDA10046H_AGC_CONF, 0x0a); // AGC setup | ||
613 | tda1004x_write_byteI(state, TDA10046H_CONF_POLARITY, 0x60); // set AGC polarities | ||
614 | break; | ||
615 | case TDA10046_AGC_IFO_AUTO_POS: | ||
616 | tda1004x_write_byteI(state, TDA10046H_AGC_CONF, 0x0a); // AGC setup | ||
617 | tda1004x_write_byteI(state, TDA10046H_CONF_POLARITY, 0x00); // set AGC polarities | ||
618 | break; | ||
619 | case TDA10046_AGC_TDA827X: | ||
620 | tda1004x_write_byteI(state, TDA10046H_AGC_CONF, 0x02); // AGC setup | ||
621 | tda1004x_write_byteI(state, TDA10046H_AGC_THR, 0x70); // AGC Threshold | ||
622 | tda1004x_write_byteI(state, TDA10046H_AGC_RENORM, 0x0E); // Gain Renormalize | ||
623 | tda1004x_write_byteI(state, TDA10046H_CONF_POLARITY, 0x60); // set AGC polarities | ||
624 | break; | ||
625 | } | ||
626 | tda1004x_write_byteI(state, TDA10046H_CONF_TRISTATE1, 0x61); // Turn both AGC outputs on | ||
587 | tda1004x_write_byteI(state, TDA10046H_AGC_TUN_MIN, 0); // } | 627 | tda1004x_write_byteI(state, TDA10046H_AGC_TUN_MIN, 0); // } |
588 | tda1004x_write_byteI(state, TDA10046H_AGC_TUN_MAX, 0xff); // } AGC min/max values | 628 | tda1004x_write_byteI(state, TDA10046H_AGC_TUN_MAX, 0xff); // } AGC min/max values |
589 | tda1004x_write_byteI(state, TDA10046H_AGC_IF_MIN, 0); // } | 629 | tda1004x_write_byteI(state, TDA10046H_AGC_IF_MIN, 0); // } |
590 | tda1004x_write_byteI(state, TDA10046H_AGC_IF_MAX, 0xff); // } | 630 | tda1004x_write_byteI(state, TDA10046H_AGC_IF_MAX, 0xff); // } |
591 | tda1004x_write_mask(state, TDA10046H_CVBER_CTRL, 0x30, 0x10); // 10^6 VBER measurement bits | ||
592 | tda1004x_write_byteI(state, TDA10046H_AGC_GAINS, 1); // IF gain 2, TUN gain 1 | 631 | tda1004x_write_byteI(state, TDA10046H_AGC_GAINS, 1); // IF gain 2, TUN gain 1 |
593 | tda1004x_write_mask(state, TDA1004X_AUTO, 0x80, 0); // crystal is 50ppm | 632 | tda1004x_write_byteI(state, TDA10046H_CVBER_CTRL, 0x1a); // 10^6 VBER measurement bits |
594 | tda1004x_write_byteI(state, TDA1004X_CONF_TS1, 7); // MPEG2 interface config | 633 | tda1004x_write_byteI(state, TDA1004X_CONF_TS1, 7); // MPEG2 interface config |
595 | tda1004x_write_mask(state, TDA1004X_CONF_TS2, 0x31, 0); // MPEG2 interface config | 634 | tda1004x_write_byteI(state, TDA1004X_CONF_TS2, 0xc0); // MPEG2 interface config |
596 | tda1004x_write_mask(state, TDA10046H_CONF_TRISTATE1, 0x9e, 0); // disable AGC_TUN | 635 | tda1004x_write_mask(state, 0x3a, 0x80, state->config->invert_oclk << 7); |
636 | |||
597 | tda1004x_write_byteI(state, TDA10046H_CONF_TRISTATE2, 0xe1); // tristate setup | 637 | tda1004x_write_byteI(state, TDA10046H_CONF_TRISTATE2, 0xe1); // tristate setup |
598 | tda1004x_write_byteI(state, TDA10046H_GPIO_OUT_SEL, 0xcc); // GPIO output config | 638 | tda1004x_write_byteI(state, TDA10046H_GPIO_OUT_SEL, 0xcc); // GPIO output config |
599 | tda1004x_write_mask(state, TDA10046H_GPIO_SELECT, 8, 8); // GPIO select | 639 | tda1004x_write_byteI(state, TDA10046H_GPIO_SELECT, 8); // GPIO select |
600 | tda10046h_set_bandwidth(state, BANDWIDTH_8_MHZ); // default bandwidth 8 MHz | ||
601 | |||
602 | tda1004x_write_mask(state, 0x3a, 0x80, state->config->invert_oclk << 7); | ||
603 | 640 | ||
604 | state->initialised = 1; | 641 | state->initialised = 1; |
605 | return 0; | 642 | return 0; |
@@ -629,9 +666,6 @@ static int tda1004x_set_fe(struct dvb_frontend* fe, | |||
629 | state->config->pll_set(fe, fe_params); | 666 | state->config->pll_set(fe, fe_params); |
630 | tda1004x_disable_tuner_i2c(state); | 667 | tda1004x_disable_tuner_i2c(state); |
631 | 668 | ||
632 | if (state->demod_type == TDA1004X_DEMOD_TDA10046) | ||
633 | tda1004x_write_mask(state, TDA10046H_AGC_CONF, 4, 4); | ||
634 | |||
635 | // Hardcoded to use auto as much as possible on the TDA10045 as it | 669 | // Hardcoded to use auto as much as possible on the TDA10045 as it |
636 | // is very unreliable if AUTO mode is _not_ used. | 670 | // is very unreliable if AUTO mode is _not_ used. |
637 | if (state->demod_type == TDA1004X_DEMOD_TDA10045) { | 671 | if (state->demod_type == TDA1004X_DEMOD_TDA10045) { |
@@ -1089,6 +1123,11 @@ static int tda1004x_sleep(struct dvb_frontend* fe) | |||
1089 | break; | 1123 | break; |
1090 | 1124 | ||
1091 | case TDA1004X_DEMOD_TDA10046: | 1125 | case TDA1004X_DEMOD_TDA10046: |
1126 | if (state->config->pll_sleep != NULL) { | ||
1127 | tda1004x_enable_tuner_i2c(state); | ||
1128 | state->config->pll_sleep(fe); | ||
1129 | tda1004x_disable_tuner_i2c(state); | ||
1130 | } | ||
1092 | tda1004x_write_mask(state, TDA1004X_CONFC4, 1, 1); | 1131 | tda1004x_write_mask(state, TDA1004X_CONFC4, 1, 1); |
1093 | break; | 1132 | break; |
1094 | } | 1133 | } |
@@ -1100,8 +1139,9 @@ static int tda1004x_sleep(struct dvb_frontend* fe) | |||
1100 | static int tda1004x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) | 1139 | static int tda1004x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) |
1101 | { | 1140 | { |
1102 | fesettings->min_delay_ms = 800; | 1141 | fesettings->min_delay_ms = 800; |
1103 | fesettings->step_size = 166667; | 1142 | /* Drift compensation makes no sense for DVB-T */ |
1104 | fesettings->max_drift = 166667*2; | 1143 | fesettings->step_size = 0; |
1144 | fesettings->max_drift = 0; | ||
1105 | return 0; | 1145 | return 0; |
1106 | } | 1146 | } |
1107 | 1147 | ||
@@ -1216,7 +1256,6 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config, | |||
1216 | memcpy(&state->ops, &tda10046_ops, sizeof(struct dvb_frontend_ops)); | 1256 | memcpy(&state->ops, &tda10046_ops, sizeof(struct dvb_frontend_ops)); |
1217 | state->initialised = 0; | 1257 | state->initialised = 0; |
1218 | state->demod_type = TDA1004X_DEMOD_TDA10046; | 1258 | state->demod_type = TDA1004X_DEMOD_TDA10046; |
1219 | state->fw_version = 0x20; /* dummy default value */ | ||
1220 | 1259 | ||
1221 | /* check if the demod is there */ | 1260 | /* check if the demod is there */ |
1222 | if (tda1004x_read_byte(state, TDA1004X_CHIPID) != 0x46) { | 1261 | if (tda1004x_read_byte(state, TDA1004X_CHIPID) != 0x46) { |
diff --git a/drivers/media/dvb/frontends/tda1004x.h b/drivers/media/dvb/frontends/tda1004x.h index c8e1d54ff262..8659c52647ad 100644 --- a/drivers/media/dvb/frontends/tda1004x.h +++ b/drivers/media/dvb/frontends/tda1004x.h | |||
@@ -26,6 +26,25 @@ | |||
26 | #include <linux/dvb/frontend.h> | 26 | #include <linux/dvb/frontend.h> |
27 | #include <linux/firmware.h> | 27 | #include <linux/firmware.h> |
28 | 28 | ||
29 | enum tda10046_xtal { | ||
30 | TDA10046_XTAL_4M, | ||
31 | TDA10046_XTAL_16M, | ||
32 | }; | ||
33 | |||
34 | enum tda10046_agc { | ||
35 | TDA10046_AGC_DEFAULT, /* original configuration */ | ||
36 | TDA10046_AGC_IFO_AUTO_NEG, /* IF AGC only, automatic, negtive */ | ||
37 | TDA10046_AGC_IFO_AUTO_POS, /* IF AGC only, automatic, positive */ | ||
38 | TDA10046_AGC_TDA827X, /* IF AGC only, special setup for tda827x */ | ||
39 | }; | ||
40 | |||
41 | enum tda10046_if { | ||
42 | TDA10046_FREQ_3617, /* original config, 36,166 MHZ */ | ||
43 | TDA10046_FREQ_3613, /* 36,13 MHZ */ | ||
44 | TDA10046_FREQ_045, /* low IF, 4.0, 4.5, or 5.0 MHZ */ | ||
45 | TDA10046_FREQ_052, /* low IF, 5.1667 MHZ for tda9889 */ | ||
46 | }; | ||
47 | |||
29 | struct tda1004x_config | 48 | struct tda1004x_config |
30 | { | 49 | { |
31 | /* the demodulator's i2c address */ | 50 | /* the demodulator's i2c address */ |
@@ -37,14 +56,22 @@ struct tda1004x_config | |||
37 | /* Does the OCLK signal need inverted? */ | 56 | /* Does the OCLK signal need inverted? */ |
38 | u8 invert_oclk; | 57 | u8 invert_oclk; |
39 | 58 | ||
40 | /* value of N_I2C of the CONF_PLL3 register */ | 59 | /* Xtal frequency, 4 or 16MHz*/ |
41 | u8 n_i2c; | 60 | enum tda10046_xtal xtal_freq; |
61 | |||
62 | /* IF frequency */ | ||
63 | enum tda10046_if if_freq; | ||
64 | |||
65 | /* AGC configuration */ | ||
66 | enum tda10046_agc agc_config; | ||
42 | 67 | ||
43 | /* PLL maintenance */ | 68 | /* PLL maintenance */ |
44 | int (*pll_init)(struct dvb_frontend* fe); | 69 | int (*pll_init)(struct dvb_frontend* fe); |
70 | void (*pll_sleep)(struct dvb_frontend* fe); | ||
45 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); | 71 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); |
46 | 72 | ||
47 | /* request firmware for device */ | 73 | /* request firmware for device */ |
74 | /* set this to NULL if the card has a firmware EEPROM */ | ||
48 | int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); | 75 | int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); |
49 | }; | 76 | }; |
50 | 77 | ||
diff --git a/drivers/media/dvb/frontends/tda80xx.c b/drivers/media/dvb/frontends/tda80xx.c index 032d348dafb7..88e125079ca1 100644 --- a/drivers/media/dvb/frontends/tda80xx.c +++ b/drivers/media/dvb/frontends/tda80xx.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/threads.h> | 28 | #include <linux/threads.h> |
29 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
30 | #include <linux/irq.h> | ||
31 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
32 | #include <linux/module.h> | 31 | #include <linux/module.h> |
33 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
diff --git a/drivers/media/dvb/pluto2/Kconfig b/drivers/media/dvb/pluto2/Kconfig new file mode 100644 index 000000000000..f02842be0d60 --- /dev/null +++ b/drivers/media/dvb/pluto2/Kconfig | |||
@@ -0,0 +1,16 @@ | |||
1 | config DVB_PLUTO2 | ||
2 | tristate "Pluto2 cards" | ||
3 | depends on DVB_CORE && PCI | ||
4 | select I2C | ||
5 | select I2C_ALGOBIT | ||
6 | select DVB_TDA1004X | ||
7 | help | ||
8 | Support for PCI cards based on the Pluto2 FPGA like the Satelco | ||
9 | Easywatch Mobile Terrestrial DVB-T Receiver. | ||
10 | |||
11 | Since these cards have no MPEG decoder onboard, they transmit | ||
12 | only compressed MPEG data over the PCI bus, so you need | ||
13 | an external software decoder to watch TV on your computer. | ||
14 | |||
15 | Say Y or M if you own such a device and want to use it. | ||
16 | |||
diff --git a/drivers/media/dvb/pluto2/Makefile b/drivers/media/dvb/pluto2/Makefile new file mode 100644 index 000000000000..86ca84b2be6e --- /dev/null +++ b/drivers/media/dvb/pluto2/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | obj-$(CONFIG_DVB_PLUTO2) = pluto2.o | ||
2 | |||
3 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | ||
diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c new file mode 100644 index 000000000000..706e0bcb5ede --- /dev/null +++ b/drivers/media/dvb/pluto2/pluto2.c | |||
@@ -0,0 +1,809 @@ | |||
1 | /* | ||
2 | * pluto2.c - Satelco Easywatch Mobile Terrestrial Receiver [DVB-T] | ||
3 | * | ||
4 | * Copyright (C) 2005 Andreas Oberritter <obi@linuxtv.org> | ||
5 | * | ||
6 | * based on pluto2.c 1.10 - http://instinct-wp8.no-ip.org/pluto/ | ||
7 | * by Dany Salman <salmandany@yahoo.fr> | ||
8 | * Copyright (c) 2004 TDF | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
23 | * | ||
24 | */ | ||
25 | |||
26 | #include <linux/i2c.h> | ||
27 | #include <linux/i2c-algo-bit.h> | ||
28 | #include <linux/init.h> | ||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/pci.h> | ||
32 | #include <linux/dma-mapping.h> | ||
33 | |||
34 | #include "demux.h" | ||
35 | #include "dmxdev.h" | ||
36 | #include "dvb_demux.h" | ||
37 | #include "dvb_frontend.h" | ||
38 | #include "dvb_net.h" | ||
39 | #include "dvbdev.h" | ||
40 | #include "tda1004x.h" | ||
41 | |||
42 | #define DRIVER_NAME "pluto2" | ||
43 | |||
44 | #define REG_PIDn(n) ((n) << 2) /* PID n pattern registers */ | ||
45 | #define REG_PCAR 0x0020 /* PC address register */ | ||
46 | #define REG_TSCR 0x0024 /* TS ctrl & status */ | ||
47 | #define REG_MISC 0x0028 /* miscellaneous */ | ||
48 | #define REG_MMAC 0x002c /* MSB MAC address */ | ||
49 | #define REG_IMAC 0x0030 /* ISB MAC address */ | ||
50 | #define REG_LMAC 0x0034 /* LSB MAC address */ | ||
51 | #define REG_SPID 0x0038 /* SPI data */ | ||
52 | #define REG_SLCS 0x003c /* serial links ctrl/status */ | ||
53 | |||
54 | #define PID0_NOFIL (0x0001 << 16) | ||
55 | #define PIDn_ENP (0x0001 << 15) | ||
56 | #define PID0_END (0x0001 << 14) | ||
57 | #define PID0_AFIL (0x0001 << 13) | ||
58 | #define PIDn_PID (0x1fff << 0) | ||
59 | |||
60 | #define TSCR_NBPACKETS (0x00ff << 24) | ||
61 | #define TSCR_DEM (0x0001 << 17) | ||
62 | #define TSCR_DE (0x0001 << 16) | ||
63 | #define TSCR_RSTN (0x0001 << 15) | ||
64 | #define TSCR_MSKO (0x0001 << 14) | ||
65 | #define TSCR_MSKA (0x0001 << 13) | ||
66 | #define TSCR_MSKL (0x0001 << 12) | ||
67 | #define TSCR_OVR (0x0001 << 11) | ||
68 | #define TSCR_AFUL (0x0001 << 10) | ||
69 | #define TSCR_LOCK (0x0001 << 9) | ||
70 | #define TSCR_IACK (0x0001 << 8) | ||
71 | #define TSCR_ADEF (0x007f << 0) | ||
72 | |||
73 | #define MISC_DVR (0x0fff << 4) | ||
74 | #define MISC_ALED (0x0001 << 3) | ||
75 | #define MISC_FRST (0x0001 << 2) | ||
76 | #define MISC_LED1 (0x0001 << 1) | ||
77 | #define MISC_LED0 (0x0001 << 0) | ||
78 | |||
79 | #define SPID_SPIDR (0x00ff << 0) | ||
80 | |||
81 | #define SLCS_SCL (0x0001 << 7) | ||
82 | #define SLCS_SDA (0x0001 << 6) | ||
83 | #define SLCS_CSN (0x0001 << 2) | ||
84 | #define SLCS_OVR (0x0001 << 1) | ||
85 | #define SLCS_SWC (0x0001 << 0) | ||
86 | |||
87 | #define TS_DMA_PACKETS (8) | ||
88 | #define TS_DMA_BYTES (188 * TS_DMA_PACKETS) | ||
89 | |||
90 | #define I2C_ADDR_TDA10046 0x10 | ||
91 | #define I2C_ADDR_TUA6034 0xc2 | ||
92 | #define NHWFILTERS 8 | ||
93 | |||
94 | struct pluto { | ||
95 | /* pci */ | ||
96 | struct pci_dev *pdev; | ||
97 | u8 __iomem *io_mem; | ||
98 | |||
99 | /* dvb */ | ||
100 | struct dmx_frontend hw_frontend; | ||
101 | struct dmx_frontend mem_frontend; | ||
102 | struct dmxdev dmxdev; | ||
103 | struct dvb_adapter dvb_adapter; | ||
104 | struct dvb_demux demux; | ||
105 | struct dvb_frontend *fe; | ||
106 | struct dvb_net dvbnet; | ||
107 | unsigned int full_ts_users; | ||
108 | unsigned int users; | ||
109 | |||
110 | /* i2c */ | ||
111 | struct i2c_algo_bit_data i2c_bit; | ||
112 | struct i2c_adapter i2c_adap; | ||
113 | unsigned int i2cbug; | ||
114 | |||
115 | /* irq */ | ||
116 | unsigned int overflow; | ||
117 | |||
118 | /* dma */ | ||
119 | dma_addr_t dma_addr; | ||
120 | u8 dma_buf[TS_DMA_BYTES]; | ||
121 | u8 dummy[4096]; | ||
122 | }; | ||
123 | |||
124 | static inline struct pluto *feed_to_pluto(struct dvb_demux_feed *feed) | ||
125 | { | ||
126 | return container_of(feed->demux, struct pluto, demux); | ||
127 | } | ||
128 | |||
129 | static inline struct pluto *frontend_to_pluto(struct dvb_frontend *fe) | ||
130 | { | ||
131 | return container_of(fe->dvb, struct pluto, dvb_adapter); | ||
132 | } | ||
133 | |||
134 | static inline u32 pluto_readreg(struct pluto *pluto, u32 reg) | ||
135 | { | ||
136 | return readl(&pluto->io_mem[reg]); | ||
137 | } | ||
138 | |||
139 | static inline void pluto_writereg(struct pluto *pluto, u32 reg, u32 val) | ||
140 | { | ||
141 | writel(val, &pluto->io_mem[reg]); | ||
142 | } | ||
143 | |||
144 | static inline void pluto_rw(struct pluto *pluto, u32 reg, u32 mask, u32 bits) | ||
145 | { | ||
146 | u32 val = readl(&pluto->io_mem[reg]); | ||
147 | val &= ~mask; | ||
148 | val |= bits; | ||
149 | writel(val, &pluto->io_mem[reg]); | ||
150 | } | ||
151 | |||
152 | static void pluto_setsda(void *data, int state) | ||
153 | { | ||
154 | struct pluto *pluto = data; | ||
155 | |||
156 | if (state) | ||
157 | pluto_rw(pluto, REG_SLCS, SLCS_SDA, SLCS_SDA); | ||
158 | else | ||
159 | pluto_rw(pluto, REG_SLCS, SLCS_SDA, 0); | ||
160 | } | ||
161 | |||
162 | static void pluto_setscl(void *data, int state) | ||
163 | { | ||
164 | struct pluto *pluto = data; | ||
165 | |||
166 | if (state) | ||
167 | pluto_rw(pluto, REG_SLCS, SLCS_SCL, SLCS_SCL); | ||
168 | else | ||
169 | pluto_rw(pluto, REG_SLCS, SLCS_SCL, 0); | ||
170 | |||
171 | /* try to detect i2c_inb() to workaround hardware bug: | ||
172 | * reset SDA to high after SCL has been set to low */ | ||
173 | if ((state) && (pluto->i2cbug == 0)) { | ||
174 | pluto->i2cbug = 1; | ||
175 | } else { | ||
176 | if ((!state) && (pluto->i2cbug == 1)) | ||
177 | pluto_setsda(pluto, 1); | ||
178 | pluto->i2cbug = 0; | ||
179 | } | ||
180 | } | ||
181 | |||
182 | static int pluto_getsda(void *data) | ||
183 | { | ||
184 | struct pluto *pluto = data; | ||
185 | |||
186 | return pluto_readreg(pluto, REG_SLCS) & SLCS_SDA; | ||
187 | } | ||
188 | |||
189 | static int pluto_getscl(void *data) | ||
190 | { | ||
191 | struct pluto *pluto = data; | ||
192 | |||
193 | return pluto_readreg(pluto, REG_SLCS) & SLCS_SCL; | ||
194 | } | ||
195 | |||
196 | static void pluto_reset_frontend(struct pluto *pluto, int reenable) | ||
197 | { | ||
198 | u32 val = pluto_readreg(pluto, REG_MISC); | ||
199 | |||
200 | if (val & MISC_FRST) { | ||
201 | val &= ~MISC_FRST; | ||
202 | pluto_writereg(pluto, REG_MISC, val); | ||
203 | } | ||
204 | if (reenable) { | ||
205 | val |= MISC_FRST; | ||
206 | pluto_writereg(pluto, REG_MISC, val); | ||
207 | } | ||
208 | } | ||
209 | |||
210 | static void pluto_reset_ts(struct pluto *pluto, int reenable) | ||
211 | { | ||
212 | u32 val = pluto_readreg(pluto, REG_TSCR); | ||
213 | |||
214 | if (val & TSCR_RSTN) { | ||
215 | val &= ~TSCR_RSTN; | ||
216 | pluto_writereg(pluto, REG_TSCR, val); | ||
217 | } | ||
218 | if (reenable) { | ||
219 | val |= TSCR_RSTN; | ||
220 | pluto_writereg(pluto, REG_TSCR, val); | ||
221 | } | ||
222 | } | ||
223 | |||
224 | static void pluto_set_dma_addr(struct pluto *pluto) | ||
225 | { | ||
226 | pluto_writereg(pluto, REG_PCAR, cpu_to_le32(pluto->dma_addr)); | ||
227 | } | ||
228 | |||
229 | static int __devinit pluto_dma_map(struct pluto *pluto) | ||
230 | { | ||
231 | pluto->dma_addr = pci_map_single(pluto->pdev, pluto->dma_buf, | ||
232 | TS_DMA_BYTES, PCI_DMA_FROMDEVICE); | ||
233 | |||
234 | return pci_dma_mapping_error(pluto->dma_addr); | ||
235 | } | ||
236 | |||
237 | static void pluto_dma_unmap(struct pluto *pluto) | ||
238 | { | ||
239 | pci_unmap_single(pluto->pdev, pluto->dma_addr, | ||
240 | TS_DMA_BYTES, PCI_DMA_FROMDEVICE); | ||
241 | } | ||
242 | |||
243 | static int pluto_start_feed(struct dvb_demux_feed *f) | ||
244 | { | ||
245 | struct pluto *pluto = feed_to_pluto(f); | ||
246 | |||
247 | /* enable PID filtering */ | ||
248 | if (pluto->users++ == 0) | ||
249 | pluto_rw(pluto, REG_PIDn(0), PID0_AFIL | PID0_NOFIL, 0); | ||
250 | |||
251 | if ((f->pid < 0x2000) && (f->index < NHWFILTERS)) | ||
252 | pluto_rw(pluto, REG_PIDn(f->index), PIDn_ENP | PIDn_PID, PIDn_ENP | f->pid); | ||
253 | else if (pluto->full_ts_users++ == 0) | ||
254 | pluto_rw(pluto, REG_PIDn(0), PID0_NOFIL, PID0_NOFIL); | ||
255 | |||
256 | return 0; | ||
257 | } | ||
258 | |||
259 | static int pluto_stop_feed(struct dvb_demux_feed *f) | ||
260 | { | ||
261 | struct pluto *pluto = feed_to_pluto(f); | ||
262 | |||
263 | /* disable PID filtering */ | ||
264 | if (--pluto->users == 0) | ||
265 | pluto_rw(pluto, REG_PIDn(0), PID0_AFIL, PID0_AFIL); | ||
266 | |||
267 | if ((f->pid < 0x2000) && (f->index < NHWFILTERS)) | ||
268 | pluto_rw(pluto, REG_PIDn(f->index), PIDn_ENP | PIDn_PID, 0x1fff); | ||
269 | else if (--pluto->full_ts_users == 0) | ||
270 | pluto_rw(pluto, REG_PIDn(0), PID0_NOFIL, 0); | ||
271 | |||
272 | return 0; | ||
273 | } | ||
274 | |||
275 | static void pluto_dma_end(struct pluto *pluto, unsigned int nbpackets) | ||
276 | { | ||
277 | /* synchronize the DMA transfer with the CPU | ||
278 | * first so that we see updated contents. */ | ||
279 | pci_dma_sync_single_for_cpu(pluto->pdev, pluto->dma_addr, | ||
280 | TS_DMA_BYTES, PCI_DMA_FROMDEVICE); | ||
281 | |||
282 | /* Workaround for broken hardware: | ||
283 | * [1] On startup NBPACKETS seems to contain an uninitialized value, | ||
284 | * but no packets have been transfered. | ||
285 | * [2] Sometimes (actually very often) NBPACKETS stays at zero | ||
286 | * although one packet has been transfered. | ||
287 | */ | ||
288 | if ((nbpackets == 0) || (nbpackets > TS_DMA_PACKETS)) { | ||
289 | unsigned int i = 0, valid; | ||
290 | while (pluto->dma_buf[i] == 0x47) | ||
291 | i += 188; | ||
292 | valid = i / 188; | ||
293 | if (nbpackets != valid) { | ||
294 | dev_err(&pluto->pdev->dev, "nbpackets=%u valid=%u\n", | ||
295 | nbpackets, valid); | ||
296 | nbpackets = valid; | ||
297 | } | ||
298 | } | ||
299 | |||
300 | dvb_dmx_swfilter_packets(&pluto->demux, pluto->dma_buf, nbpackets); | ||
301 | |||
302 | /* clear the dma buffer. this is needed to be able to identify | ||
303 | * new valid ts packets above */ | ||
304 | memset(pluto->dma_buf, 0, nbpackets * 188); | ||
305 | |||
306 | /* reset the dma address */ | ||
307 | pluto_set_dma_addr(pluto); | ||
308 | |||
309 | /* sync the buffer and give it back to the card */ | ||
310 | pci_dma_sync_single_for_device(pluto->pdev, pluto->dma_addr, | ||
311 | TS_DMA_BYTES, PCI_DMA_FROMDEVICE); | ||
312 | } | ||
313 | |||
314 | static irqreturn_t pluto_irq(int irq, void *dev_id, struct pt_regs *regs) | ||
315 | { | ||
316 | struct pluto *pluto = dev_id; | ||
317 | u32 tscr; | ||
318 | |||
319 | /* check whether an interrupt occured on this device */ | ||
320 | tscr = pluto_readreg(pluto, REG_TSCR); | ||
321 | if (!(tscr & (TSCR_DE | TSCR_OVR))) | ||
322 | return IRQ_NONE; | ||
323 | |||
324 | if (tscr == 0xffffffff) { | ||
325 | // FIXME: maybe recover somehow | ||
326 | dev_err(&pluto->pdev->dev, "card hung up :(\n"); | ||
327 | return IRQ_HANDLED; | ||
328 | } | ||
329 | |||
330 | /* dma end interrupt */ | ||
331 | if (tscr & TSCR_DE) { | ||
332 | pluto_dma_end(pluto, (tscr & TSCR_NBPACKETS) >> 24); | ||
333 | /* overflow interrupt */ | ||
334 | if (tscr & TSCR_OVR) | ||
335 | pluto->overflow++; | ||
336 | if (pluto->overflow) { | ||
337 | dev_err(&pluto->pdev->dev, "overflow irq (%d)\n", | ||
338 | pluto->overflow); | ||
339 | pluto_reset_ts(pluto, 1); | ||
340 | pluto->overflow = 0; | ||
341 | } | ||
342 | } else if (tscr & TSCR_OVR) { | ||
343 | pluto->overflow++; | ||
344 | } | ||
345 | |||
346 | /* ACK the interrupt */ | ||
347 | pluto_writereg(pluto, REG_TSCR, tscr | TSCR_IACK); | ||
348 | |||
349 | return IRQ_HANDLED; | ||
350 | } | ||
351 | |||
352 | static void __devinit pluto_enable_irqs(struct pluto *pluto) | ||
353 | { | ||
354 | u32 val = pluto_readreg(pluto, REG_TSCR); | ||
355 | |||
356 | /* set the number of packets */ | ||
357 | val &= ~TSCR_ADEF; | ||
358 | val |= TS_DMA_PACKETS / 2; | ||
359 | /* disable AFUL and LOCK interrupts */ | ||
360 | val |= (TSCR_MSKA | TSCR_MSKL); | ||
361 | /* enable DMA and OVERFLOW interrupts */ | ||
362 | val &= ~(TSCR_DEM | TSCR_MSKO); | ||
363 | /* clear pending interrupts */ | ||
364 | val |= TSCR_IACK; | ||
365 | |||
366 | pluto_writereg(pluto, REG_TSCR, val); | ||
367 | } | ||
368 | |||
369 | static void pluto_disable_irqs(struct pluto *pluto) | ||
370 | { | ||
371 | u32 val = pluto_readreg(pluto, REG_TSCR); | ||
372 | |||
373 | /* disable all interrupts */ | ||
374 | val |= (TSCR_DEM | TSCR_MSKO | TSCR_MSKA | TSCR_MSKL); | ||
375 | /* clear pending interrupts */ | ||
376 | val |= TSCR_IACK; | ||
377 | |||
378 | pluto_writereg(pluto, REG_TSCR, val); | ||
379 | } | ||
380 | |||
381 | static int __devinit pluto_hw_init(struct pluto *pluto) | ||
382 | { | ||
383 | pluto_reset_frontend(pluto, 1); | ||
384 | |||
385 | /* set automatic LED control by FPGA */ | ||
386 | pluto_rw(pluto, REG_MISC, MISC_ALED, MISC_ALED); | ||
387 | |||
388 | /* set data endianess */ | ||
389 | #ifdef __LITTLE_ENDIAN | ||
390 | pluto_rw(pluto, REG_PIDn(0), PID0_END, PID0_END); | ||
391 | #else | ||
392 | pluto_rw(pluto, REG_PIDn(0), PID0_END, 0); | ||
393 | #endif | ||
394 | /* map DMA and set address */ | ||
395 | pluto_dma_map(pluto); | ||
396 | pluto_set_dma_addr(pluto); | ||
397 | |||
398 | /* enable interrupts */ | ||
399 | pluto_enable_irqs(pluto); | ||
400 | |||
401 | /* reset TS logic */ | ||
402 | pluto_reset_ts(pluto, 1); | ||
403 | |||
404 | return 0; | ||
405 | } | ||
406 | |||
407 | static void pluto_hw_exit(struct pluto *pluto) | ||
408 | { | ||
409 | /* disable interrupts */ | ||
410 | pluto_disable_irqs(pluto); | ||
411 | |||
412 | pluto_reset_ts(pluto, 0); | ||
413 | |||
414 | /* LED: disable automatic control, enable yellow, disable green */ | ||
415 | pluto_rw(pluto, REG_MISC, MISC_ALED | MISC_LED1 | MISC_LED0, MISC_LED1); | ||
416 | |||
417 | /* unmap DMA */ | ||
418 | pluto_dma_unmap(pluto); | ||
419 | |||
420 | pluto_reset_frontend(pluto, 0); | ||
421 | } | ||
422 | |||
423 | static inline u32 divide(u32 numerator, u32 denominator) | ||
424 | { | ||
425 | if (denominator == 0) | ||
426 | return ~0; | ||
427 | |||
428 | return (numerator + denominator / 2) / denominator; | ||
429 | } | ||
430 | |||
431 | /* LG Innotek TDTE-E001P (Infineon TUA6034) */ | ||
432 | static int lg_tdtpe001p_pll_set(struct dvb_frontend *fe, | ||
433 | struct dvb_frontend_parameters *p) | ||
434 | { | ||
435 | struct pluto *pluto = frontend_to_pluto(fe); | ||
436 | struct i2c_msg msg; | ||
437 | int ret; | ||
438 | u8 buf[4]; | ||
439 | u32 div; | ||
440 | |||
441 | // Fref = 166.667 Hz | ||
442 | // Fref * 3 = 500.000 Hz | ||
443 | // IF = 36166667 | ||
444 | // IF / Fref = 217 | ||
445 | //div = divide(p->frequency + 36166667, 166667); | ||
446 | div = divide(p->frequency * 3, 500000) + 217; | ||
447 | buf[0] = (div >> 8) & 0x7f; | ||
448 | buf[1] = (div >> 0) & 0xff; | ||
449 | |||
450 | if (p->frequency < 611000000) | ||
451 | buf[2] = 0xb4; | ||
452 | else if (p->frequency < 811000000) | ||
453 | buf[2] = 0xbc; | ||
454 | else | ||
455 | buf[2] = 0xf4; | ||
456 | |||
457 | // VHF: 174-230 MHz | ||
458 | // center: 350 MHz | ||
459 | // UHF: 470-862 MHz | ||
460 | if (p->frequency < 350000000) | ||
461 | buf[3] = 0x02; | ||
462 | else | ||
463 | buf[3] = 0x04; | ||
464 | |||
465 | if (p->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) | ||
466 | buf[3] |= 0x08; | ||
467 | |||
468 | if (sizeof(buf) == 6) { | ||
469 | buf[4] = buf[2]; | ||
470 | buf[4] &= ~0x1c; | ||
471 | buf[4] |= 0x18; | ||
472 | |||
473 | buf[5] = (0 << 7) | (2 << 4); | ||
474 | } | ||
475 | |||
476 | msg.addr = I2C_ADDR_TUA6034 >> 1; | ||
477 | msg.flags = 0; | ||
478 | msg.buf = buf; | ||
479 | msg.len = sizeof(buf); | ||
480 | |||
481 | ret = i2c_transfer(&pluto->i2c_adap, &msg, 1); | ||
482 | if (ret < 0) | ||
483 | return ret; | ||
484 | else if (ret == 0) | ||
485 | return -EREMOTEIO; | ||
486 | |||
487 | return 0; | ||
488 | } | ||
489 | |||
490 | static int pluto2_request_firmware(struct dvb_frontend *fe, | ||
491 | const struct firmware **fw, char *name) | ||
492 | { | ||
493 | struct pluto *pluto = frontend_to_pluto(fe); | ||
494 | |||
495 | return request_firmware(fw, name, &pluto->pdev->dev); | ||
496 | } | ||
497 | |||
498 | static struct tda1004x_config pluto2_fe_config __devinitdata = { | ||
499 | .demod_address = I2C_ADDR_TDA10046 >> 1, | ||
500 | .invert = 1, | ||
501 | .invert_oclk = 0, | ||
502 | .xtal_freq = TDA10046_XTAL_16M, | ||
503 | .agc_config = TDA10046_AGC_DEFAULT, | ||
504 | .if_freq = TDA10046_FREQ_3617, | ||
505 | .pll_set = lg_tdtpe001p_pll_set, | ||
506 | .pll_sleep = NULL, | ||
507 | .request_firmware = pluto2_request_firmware, | ||
508 | }; | ||
509 | |||
510 | static int __devinit frontend_init(struct pluto *pluto) | ||
511 | { | ||
512 | int ret; | ||
513 | |||
514 | pluto->fe = tda10046_attach(&pluto2_fe_config, &pluto->i2c_adap); | ||
515 | if (!pluto->fe) { | ||
516 | dev_err(&pluto->pdev->dev, "could not attach frontend\n"); | ||
517 | return -ENODEV; | ||
518 | } | ||
519 | |||
520 | ret = dvb_register_frontend(&pluto->dvb_adapter, pluto->fe); | ||
521 | if (ret < 0) { | ||
522 | if (pluto->fe->ops->release) | ||
523 | pluto->fe->ops->release(pluto->fe); | ||
524 | return ret; | ||
525 | } | ||
526 | |||
527 | return 0; | ||
528 | } | ||
529 | |||
530 | static void __devinit pluto_read_rev(struct pluto *pluto) | ||
531 | { | ||
532 | u32 val = pluto_readreg(pluto, REG_MISC) & MISC_DVR; | ||
533 | dev_info(&pluto->pdev->dev, "board revision %d.%d\n", | ||
534 | (val >> 12) & 0x0f, (val >> 4) & 0xff); | ||
535 | } | ||
536 | |||
537 | static void __devinit pluto_read_mac(struct pluto *pluto, u8 *mac) | ||
538 | { | ||
539 | u32 val = pluto_readreg(pluto, REG_MMAC); | ||
540 | mac[0] = (val >> 8) & 0xff; | ||
541 | mac[1] = (val >> 0) & 0xff; | ||
542 | |||
543 | val = pluto_readreg(pluto, REG_IMAC); | ||
544 | mac[2] = (val >> 8) & 0xff; | ||
545 | mac[3] = (val >> 0) & 0xff; | ||
546 | |||
547 | val = pluto_readreg(pluto, REG_LMAC); | ||
548 | mac[4] = (val >> 8) & 0xff; | ||
549 | mac[5] = (val >> 0) & 0xff; | ||
550 | |||
551 | dev_info(&pluto->pdev->dev, "MAC %02x:%02x:%02x:%02x:%02x:%02x\n", | ||
552 | mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); | ||
553 | } | ||
554 | |||
555 | static int __devinit pluto_read_serial(struct pluto *pluto) | ||
556 | { | ||
557 | struct pci_dev *pdev = pluto->pdev; | ||
558 | unsigned int i, j; | ||
559 | u8 __iomem *cis; | ||
560 | |||
561 | cis = pci_iomap(pdev, 1, 0); | ||
562 | if (!cis) | ||
563 | return -EIO; | ||
564 | |||
565 | dev_info(&pdev->dev, "S/N "); | ||
566 | |||
567 | for (i = 0xe0; i < 0x100; i += 4) { | ||
568 | u32 val = readl(&cis[i]); | ||
569 | for (j = 0; j < 32; j += 8) { | ||
570 | if ((val & 0xff) == 0xff) | ||
571 | goto out; | ||
572 | printk("%c", val & 0xff); | ||
573 | val >>= 8; | ||
574 | } | ||
575 | } | ||
576 | out: | ||
577 | printk("\n"); | ||
578 | pci_iounmap(pdev, cis); | ||
579 | |||
580 | return 0; | ||
581 | } | ||
582 | |||
583 | static int __devinit pluto2_probe(struct pci_dev *pdev, | ||
584 | const struct pci_device_id *ent) | ||
585 | { | ||
586 | struct pluto *pluto; | ||
587 | struct dvb_adapter *dvb_adapter; | ||
588 | struct dvb_demux *dvbdemux; | ||
589 | struct dmx_demux *dmx; | ||
590 | int ret = -ENOMEM; | ||
591 | |||
592 | pluto = kmalloc(sizeof(struct pluto), GFP_KERNEL); | ||
593 | if (!pluto) | ||
594 | goto out; | ||
595 | |||
596 | memset(pluto, 0, sizeof(struct pluto)); | ||
597 | pluto->pdev = pdev; | ||
598 | |||
599 | ret = pci_enable_device(pdev); | ||
600 | if (ret < 0) | ||
601 | goto err_kfree; | ||
602 | |||
603 | /* enable interrupts */ | ||
604 | pci_write_config_dword(pdev, 0x6c, 0x8000); | ||
605 | |||
606 | ret = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | ||
607 | if (ret < 0) | ||
608 | goto err_pci_disable_device; | ||
609 | |||
610 | pci_set_master(pdev); | ||
611 | |||
612 | ret = pci_request_regions(pdev, DRIVER_NAME); | ||
613 | if (ret < 0) | ||
614 | goto err_pci_disable_device; | ||
615 | |||
616 | pluto->io_mem = pci_iomap(pdev, 0, 0x40); | ||
617 | if (!pluto->io_mem) { | ||
618 | ret = -EIO; | ||
619 | goto err_pci_release_regions; | ||
620 | } | ||
621 | |||
622 | pci_set_drvdata(pdev, pluto); | ||
623 | |||
624 | ret = request_irq(pdev->irq, pluto_irq, SA_SHIRQ, DRIVER_NAME, pluto); | ||
625 | if (ret < 0) | ||
626 | goto err_pci_iounmap; | ||
627 | |||
628 | ret = pluto_hw_init(pluto); | ||
629 | if (ret < 0) | ||
630 | goto err_free_irq; | ||
631 | |||
632 | /* i2c */ | ||
633 | i2c_set_adapdata(&pluto->i2c_adap, pluto); | ||
634 | strcpy(pluto->i2c_adap.name, DRIVER_NAME); | ||
635 | pluto->i2c_adap.owner = THIS_MODULE; | ||
636 | pluto->i2c_adap.id = I2C_ALGO_BIT; | ||
637 | pluto->i2c_adap.class = I2C_CLASS_TV_DIGITAL; | ||
638 | pluto->i2c_adap.dev.parent = &pdev->dev; | ||
639 | pluto->i2c_adap.algo_data = &pluto->i2c_bit; | ||
640 | pluto->i2c_bit.data = pluto; | ||
641 | pluto->i2c_bit.setsda = pluto_setsda; | ||
642 | pluto->i2c_bit.setscl = pluto_setscl; | ||
643 | pluto->i2c_bit.getsda = pluto_getsda; | ||
644 | pluto->i2c_bit.getscl = pluto_getscl; | ||
645 | pluto->i2c_bit.udelay = 10; | ||
646 | pluto->i2c_bit.timeout = 10; | ||
647 | |||
648 | /* Raise SCL and SDA */ | ||
649 | pluto_setsda(pluto, 1); | ||
650 | pluto_setscl(pluto, 1); | ||
651 | |||
652 | ret = i2c_bit_add_bus(&pluto->i2c_adap); | ||
653 | if (ret < 0) | ||
654 | goto err_pluto_hw_exit; | ||
655 | |||
656 | /* dvb */ | ||
657 | ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME, THIS_MODULE); | ||
658 | if (ret < 0) | ||
659 | goto err_i2c_bit_del_bus; | ||
660 | |||
661 | dvb_adapter = &pluto->dvb_adapter; | ||
662 | |||
663 | pluto_read_rev(pluto); | ||
664 | pluto_read_serial(pluto); | ||
665 | pluto_read_mac(pluto, dvb_adapter->proposed_mac); | ||
666 | |||
667 | dvbdemux = &pluto->demux; | ||
668 | dvbdemux->filternum = 256; | ||
669 | dvbdemux->feednum = 256; | ||
670 | dvbdemux->start_feed = pluto_start_feed; | ||
671 | dvbdemux->stop_feed = pluto_stop_feed; | ||
672 | dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | | ||
673 | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING); | ||
674 | ret = dvb_dmx_init(dvbdemux); | ||
675 | if (ret < 0) | ||
676 | goto err_dvb_unregister_adapter; | ||
677 | |||
678 | dmx = &dvbdemux->dmx; | ||
679 | |||
680 | pluto->hw_frontend.source = DMX_FRONTEND_0; | ||
681 | pluto->mem_frontend.source = DMX_MEMORY_FE; | ||
682 | pluto->dmxdev.filternum = NHWFILTERS; | ||
683 | pluto->dmxdev.demux = dmx; | ||
684 | |||
685 | ret = dvb_dmxdev_init(&pluto->dmxdev, dvb_adapter); | ||
686 | if (ret < 0) | ||
687 | goto err_dvb_dmx_release; | ||
688 | |||
689 | ret = dmx->add_frontend(dmx, &pluto->hw_frontend); | ||
690 | if (ret < 0) | ||
691 | goto err_dvb_dmxdev_release; | ||
692 | |||
693 | ret = dmx->add_frontend(dmx, &pluto->mem_frontend); | ||
694 | if (ret < 0) | ||
695 | goto err_remove_hw_frontend; | ||
696 | |||
697 | ret = dmx->connect_frontend(dmx, &pluto->hw_frontend); | ||
698 | if (ret < 0) | ||
699 | goto err_remove_mem_frontend; | ||
700 | |||
701 | ret = frontend_init(pluto); | ||
702 | if (ret < 0) | ||
703 | goto err_disconnect_frontend; | ||
704 | |||
705 | dvb_net_init(dvb_adapter, &pluto->dvbnet, dmx); | ||
706 | out: | ||
707 | return ret; | ||
708 | |||
709 | err_disconnect_frontend: | ||
710 | dmx->disconnect_frontend(dmx); | ||
711 | err_remove_mem_frontend: | ||
712 | dmx->remove_frontend(dmx, &pluto->mem_frontend); | ||
713 | err_remove_hw_frontend: | ||
714 | dmx->remove_frontend(dmx, &pluto->hw_frontend); | ||
715 | err_dvb_dmxdev_release: | ||
716 | dvb_dmxdev_release(&pluto->dmxdev); | ||
717 | err_dvb_dmx_release: | ||
718 | dvb_dmx_release(dvbdemux); | ||
719 | err_dvb_unregister_adapter: | ||
720 | dvb_unregister_adapter(dvb_adapter); | ||
721 | err_i2c_bit_del_bus: | ||
722 | i2c_bit_del_bus(&pluto->i2c_adap); | ||
723 | err_pluto_hw_exit: | ||
724 | pluto_hw_exit(pluto); | ||
725 | err_free_irq: | ||
726 | free_irq(pdev->irq, pluto); | ||
727 | err_pci_iounmap: | ||
728 | pci_iounmap(pdev, pluto->io_mem); | ||
729 | err_pci_release_regions: | ||
730 | pci_release_regions(pdev); | ||
731 | err_pci_disable_device: | ||
732 | pci_disable_device(pdev); | ||
733 | err_kfree: | ||
734 | pci_set_drvdata(pdev, NULL); | ||
735 | kfree(pluto); | ||
736 | goto out; | ||
737 | } | ||
738 | |||
739 | static void __devexit pluto2_remove(struct pci_dev *pdev) | ||
740 | { | ||
741 | struct pluto *pluto = pci_get_drvdata(pdev); | ||
742 | struct dvb_adapter *dvb_adapter = &pluto->dvb_adapter; | ||
743 | struct dvb_demux *dvbdemux = &pluto->demux; | ||
744 | struct dmx_demux *dmx = &dvbdemux->dmx; | ||
745 | |||
746 | dmx->close(dmx); | ||
747 | dvb_net_release(&pluto->dvbnet); | ||
748 | if (pluto->fe) | ||
749 | dvb_unregister_frontend(pluto->fe); | ||
750 | |||
751 | dmx->disconnect_frontend(dmx); | ||
752 | dmx->remove_frontend(dmx, &pluto->mem_frontend); | ||
753 | dmx->remove_frontend(dmx, &pluto->hw_frontend); | ||
754 | dvb_dmxdev_release(&pluto->dmxdev); | ||
755 | dvb_dmx_release(dvbdemux); | ||
756 | dvb_unregister_adapter(dvb_adapter); | ||
757 | i2c_bit_del_bus(&pluto->i2c_adap); | ||
758 | pluto_hw_exit(pluto); | ||
759 | free_irq(pdev->irq, pluto); | ||
760 | pci_iounmap(pdev, pluto->io_mem); | ||
761 | pci_release_regions(pdev); | ||
762 | pci_disable_device(pdev); | ||
763 | pci_set_drvdata(pdev, NULL); | ||
764 | kfree(pluto); | ||
765 | } | ||
766 | |||
767 | #ifndef PCI_VENDOR_ID_SCM | ||
768 | #define PCI_VENDOR_ID_SCM 0x0432 | ||
769 | #endif | ||
770 | #ifndef PCI_DEVICE_ID_PLUTO2 | ||
771 | #define PCI_DEVICE_ID_PLUTO2 0x0001 | ||
772 | #endif | ||
773 | |||
774 | static struct pci_device_id pluto2_id_table[] __devinitdata = { | ||
775 | { | ||
776 | .vendor = PCI_VENDOR_ID_SCM, | ||
777 | .device = PCI_DEVICE_ID_PLUTO2, | ||
778 | .subvendor = PCI_ANY_ID, | ||
779 | .subdevice = PCI_ANY_ID, | ||
780 | }, { | ||
781 | /* empty */ | ||
782 | }, | ||
783 | }; | ||
784 | |||
785 | MODULE_DEVICE_TABLE(pci, pluto2_id_table); | ||
786 | |||
787 | static struct pci_driver pluto2_driver = { | ||
788 | .name = DRIVER_NAME, | ||
789 | .id_table = pluto2_id_table, | ||
790 | .probe = pluto2_probe, | ||
791 | .remove = __devexit_p(pluto2_remove), | ||
792 | }; | ||
793 | |||
794 | static int __init pluto2_init(void) | ||
795 | { | ||
796 | return pci_register_driver(&pluto2_driver); | ||
797 | } | ||
798 | |||
799 | static void __exit pluto2_exit(void) | ||
800 | { | ||
801 | pci_unregister_driver(&pluto2_driver); | ||
802 | } | ||
803 | |||
804 | module_init(pluto2_init); | ||
805 | module_exit(pluto2_exit); | ||
806 | |||
807 | MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>"); | ||
808 | MODULE_DESCRIPTION("Pluto2 driver"); | ||
809 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig index 7ffa2c7315b3..bf3c011d2cfb 100644 --- a/drivers/media/dvb/ttpci/Kconfig +++ b/drivers/media/dvb/ttpci/Kconfig | |||
@@ -12,7 +12,7 @@ config DVB_AV7110 | |||
12 | select DVB_STV0297 | 12 | select DVB_STV0297 |
13 | select DVB_L64781 | 13 | select DVB_L64781 |
14 | help | 14 | help |
15 | Support for SAA7146 and AV7110 based DVB cards as produced | 15 | Support for SAA7146 and AV7110 based DVB cards as produced |
16 | by Fujitsu-Siemens, Technotrend, Hauppauge and others. | 16 | by Fujitsu-Siemens, Technotrend, Hauppauge and others. |
17 | 17 | ||
18 | This driver only supports the fullfeatured cards with | 18 | This driver only supports the fullfeatured cards with |
@@ -33,7 +33,7 @@ config DVB_AV7110_FIRMWARE | |||
33 | If you want to compile the firmware into the driver you need to say | 33 | If you want to compile the firmware into the driver you need to say |
34 | Y here and provide the correct path of the firmware. You need this | 34 | Y here and provide the correct path of the firmware. You need this |
35 | option if you want to compile the whole driver statically into the | 35 | option if you want to compile the whole driver statically into the |
36 | kernel. | 36 | kernel. |
37 | 37 | ||
38 | All other people say N. | 38 | All other people say N. |
39 | 39 | ||
@@ -66,6 +66,7 @@ config DVB_BUDGET | |||
66 | select DVB_L64781 | 66 | select DVB_L64781 |
67 | select DVB_TDA8083 | 67 | select DVB_TDA8083 |
68 | select DVB_TDA10021 | 68 | select DVB_TDA10021 |
69 | select DVB_S5H1420 | ||
69 | help | 70 | help |
70 | Support for simple SAA7146 based DVB cards | 71 | Support for simple SAA7146 based DVB cards |
71 | (so called Budget- or Nova-PCI cards) without onboard | 72 | (so called Budget- or Nova-PCI cards) without onboard |
@@ -119,9 +120,9 @@ config DVB_BUDGET_PATCH | |||
119 | select DVB_VES1X93 | 120 | select DVB_VES1X93 |
120 | select DVB_TDA8083 | 121 | select DVB_TDA8083 |
121 | help | 122 | help |
122 | Support for Budget Patch (full TS) modification on | 123 | Support for Budget Patch (full TS) modification on |
123 | SAA7146+AV7110 based cards (DVB-S cards). This | 124 | SAA7146+AV7110 based cards (DVB-S cards). This |
124 | driver doesn't use onboard MPEG2 decoder. The | 125 | driver doesn't use onboard MPEG2 decoder. The |
125 | card is driven in Budget-only mode. Card is | 126 | card is driven in Budget-only mode. Card is |
126 | required to have loaded firmware to tune properly. | 127 | required to have loaded firmware to tune properly. |
127 | Firmware can be loaded by insertion and removal of | 128 | Firmware can be loaded by insertion and removal of |
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index 8e33a850e13e..e4c6e87f6c5d 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -116,13 +116,18 @@ static int av7110_num = 0; | |||
116 | 116 | ||
117 | static void init_av7110_av(struct av7110 *av7110) | 117 | static void init_av7110_av(struct av7110 *av7110) |
118 | { | 118 | { |
119 | int ret; | ||
119 | struct saa7146_dev *dev = av7110->dev; | 120 | struct saa7146_dev *dev = av7110->dev; |
120 | 121 | ||
121 | /* set internal volume control to maximum */ | 122 | /* set internal volume control to maximum */ |
122 | av7110->adac_type = DVB_ADAC_TI; | 123 | av7110->adac_type = DVB_ADAC_TI; |
123 | av7110_set_volume(av7110, av7110->mixer.volume_left, av7110->mixer.volume_right); | 124 | ret = av7110_set_volume(av7110, av7110->mixer.volume_left, av7110->mixer.volume_right); |
125 | if (ret < 0) | ||
126 | printk("dvb-ttpci:cannot set internal volume to maximum:%d\n",ret); | ||
124 | 127 | ||
125 | av7710_set_video_mode(av7110, vidmode); | 128 | ret = av7710_set_video_mode(av7110, vidmode); |
129 | if (ret < 0) | ||
130 | printk("dvb-ttpci:cannot set video mode:%d\n",ret); | ||
126 | 131 | ||
127 | /* handle different card types */ | 132 | /* handle different card types */ |
128 | /* remaining inits according to card and frontend type */ | 133 | /* remaining inits according to card and frontend type */ |
@@ -156,8 +161,12 @@ static void init_av7110_av(struct av7110 *av7110) | |||
156 | 161 | ||
157 | if (av7110->adac_type == DVB_ADAC_NONE || av7110->adac_type == DVB_ADAC_MSP) { | 162 | if (av7110->adac_type == DVB_ADAC_NONE || av7110->adac_type == DVB_ADAC_MSP) { |
158 | // switch DVB SCART on | 163 | // switch DVB SCART on |
159 | av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, MainSwitch, 1, 0); | 164 | ret = av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, MainSwitch, 1, 0); |
160 | av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, ADSwitch, 1, 1); | 165 | if (ret < 0) |
166 | printk("dvb-ttpci:cannot switch on SCART(Main):%d\n",ret); | ||
167 | ret = av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, ADSwitch, 1, 1); | ||
168 | if (ret < 0) | ||
169 | printk("dvb-ttpci:cannot switch on SCART(AD):%d\n",ret); | ||
161 | if (rgb_on && | 170 | if (rgb_on && |
162 | (av7110->dev->pci->subsystem_vendor == 0x110a) && (av7110->dev->pci->subsystem_device == 0x0000)) { | 171 | (av7110->dev->pci->subsystem_vendor == 0x110a) && (av7110->dev->pci->subsystem_device == 0x0000)) { |
163 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // RGB on, SCART pin 16 | 172 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // RGB on, SCART pin 16 |
@@ -165,8 +174,12 @@ static void init_av7110_av(struct av7110 *av7110) | |||
165 | } | 174 | } |
166 | } | 175 | } |
167 | 176 | ||
168 | av7110_set_volume(av7110, av7110->mixer.volume_left, av7110->mixer.volume_right); | 177 | ret = av7110_set_volume(av7110, av7110->mixer.volume_left, av7110->mixer.volume_right); |
169 | av7110_setup_irc_config(av7110, 0); | 178 | if (ret < 0) |
179 | printk("dvb-ttpci:cannot set volume :%d\n",ret); | ||
180 | ret = av7110_setup_irc_config(av7110, 0); | ||
181 | if (ret < 0) | ||
182 | printk("dvb-ttpci:cannot setup irc config :%d\n",ret); | ||
170 | } | 183 | } |
171 | 184 | ||
172 | static void recover_arm(struct av7110 *av7110) | 185 | static void recover_arm(struct av7110 *av7110) |
@@ -258,8 +271,9 @@ static int arm_thread(void *data) | |||
258 | * | 271 | * |
259 | * If we want to support multiple controls we would have to do much more... | 272 | * If we want to support multiple controls we would have to do much more... |
260 | */ | 273 | */ |
261 | void av7110_setup_irc_config(struct av7110 *av7110, u32 ir_config) | 274 | int av7110_setup_irc_config(struct av7110 *av7110, u32 ir_config) |
262 | { | 275 | { |
276 | int ret = 0; | ||
263 | static struct av7110 *last; | 277 | static struct av7110 *last; |
264 | 278 | ||
265 | dprintk(4, "%p\n", av7110); | 279 | dprintk(4, "%p\n", av7110); |
@@ -270,9 +284,10 @@ void av7110_setup_irc_config(struct av7110 *av7110, u32 ir_config) | |||
270 | last = av7110; | 284 | last = av7110; |
271 | 285 | ||
272 | if (av7110) { | 286 | if (av7110) { |
273 | av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, SetIR, 1, ir_config); | 287 | ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, SetIR, 1, ir_config); |
274 | av7110->ir_config = ir_config; | 288 | av7110->ir_config = ir_config; |
275 | } | 289 | } |
290 | return ret; | ||
276 | } | 291 | } |
277 | 292 | ||
278 | static void (*irc_handler)(u32); | 293 | static void (*irc_handler)(u32); |
@@ -765,13 +780,14 @@ static inline int SetPIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, | |||
765 | pcrpid, vpid, apid, ttpid, subpid); | 780 | pcrpid, vpid, apid, ttpid, subpid); |
766 | } | 781 | } |
767 | 782 | ||
768 | void ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, | 783 | int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, |
769 | u16 subpid, u16 pcrpid) | 784 | u16 subpid, u16 pcrpid) |
770 | { | 785 | { |
786 | int ret = 0; | ||
771 | dprintk(4, "%p\n", av7110); | 787 | dprintk(4, "%p\n", av7110); |
772 | 788 | ||
773 | if (down_interruptible(&av7110->pid_mutex)) | 789 | if (down_interruptible(&av7110->pid_mutex)) |
774 | return; | 790 | return -ERESTARTSYS; |
775 | 791 | ||
776 | if (!(vpid & 0x8000)) | 792 | if (!(vpid & 0x8000)) |
777 | av7110->pids[DMX_PES_VIDEO] = vpid; | 793 | av7110->pids[DMX_PES_VIDEO] = vpid; |
@@ -786,10 +802,11 @@ void ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, | |||
786 | 802 | ||
787 | if (av7110->fe_synced) { | 803 | if (av7110->fe_synced) { |
788 | pcrpid = av7110->pids[DMX_PES_PCR]; | 804 | pcrpid = av7110->pids[DMX_PES_PCR]; |
789 | SetPIDs(av7110, vpid, apid, ttpid, subpid, pcrpid); | 805 | ret = SetPIDs(av7110, vpid, apid, ttpid, subpid, pcrpid); |
790 | } | 806 | } |
791 | 807 | ||
792 | up(&av7110->pid_mutex); | 808 | up(&av7110->pid_mutex); |
809 | return ret; | ||
793 | } | 810 | } |
794 | 811 | ||
795 | 812 | ||
@@ -832,11 +849,13 @@ static int StartHWFilter(struct dvb_demux_filter *dvbdmxfilter) | |||
832 | ret = av7110_fw_request(av7110, buf, 20, &handle, 1); | 849 | ret = av7110_fw_request(av7110, buf, 20, &handle, 1); |
833 | if (ret != 0 || handle >= 32) { | 850 | if (ret != 0 || handle >= 32) { |
834 | printk("dvb-ttpci: %s error buf %04x %04x %04x %04x " | 851 | printk("dvb-ttpci: %s error buf %04x %04x %04x %04x " |
835 | "ret %x handle %04x\n", | 852 | "ret %d handle %04x\n", |
836 | __FUNCTION__, buf[0], buf[1], buf[2], buf[3], | 853 | __FUNCTION__, buf[0], buf[1], buf[2], buf[3], |
837 | ret, handle); | 854 | ret, handle); |
838 | dvbdmxfilter->hw_handle = 0xffff; | 855 | dvbdmxfilter->hw_handle = 0xffff; |
839 | return -1; | 856 | if (!ret) |
857 | ret = -1; | ||
858 | return ret; | ||
840 | } | 859 | } |
841 | 860 | ||
842 | av7110->handle2filter[handle] = dvbdmxfilter; | 861 | av7110->handle2filter[handle] = dvbdmxfilter; |
@@ -859,7 +878,7 @@ static int StopHWFilter(struct dvb_demux_filter *dvbdmxfilter) | |||
859 | if (handle >= 32) { | 878 | if (handle >= 32) { |
860 | printk("%s tried to stop invalid filter %04x, filter type = %x\n", | 879 | printk("%s tried to stop invalid filter %04x, filter type = %x\n", |
861 | __FUNCTION__, handle, dvbdmxfilter->type); | 880 | __FUNCTION__, handle, dvbdmxfilter->type); |
862 | return 0; | 881 | return -EINVAL; |
863 | } | 882 | } |
864 | 883 | ||
865 | av7110->handle2filter[handle] = NULL; | 884 | av7110->handle2filter[handle] = NULL; |
@@ -873,18 +892,20 @@ static int StopHWFilter(struct dvb_demux_filter *dvbdmxfilter) | |||
873 | "resp %04x %04x pid %d\n", | 892 | "resp %04x %04x pid %d\n", |
874 | __FUNCTION__, buf[0], buf[1], buf[2], ret, | 893 | __FUNCTION__, buf[0], buf[1], buf[2], ret, |
875 | answ[0], answ[1], dvbdmxfilter->feed->pid); | 894 | answ[0], answ[1], dvbdmxfilter->feed->pid); |
876 | ret = -1; | 895 | if (!ret) |
896 | ret = -1; | ||
877 | } | 897 | } |
878 | return ret; | 898 | return ret; |
879 | } | 899 | } |
880 | 900 | ||
881 | 901 | ||
882 | static void dvb_feed_start_pid(struct dvb_demux_feed *dvbdmxfeed) | 902 | static int dvb_feed_start_pid(struct dvb_demux_feed *dvbdmxfeed) |
883 | { | 903 | { |
884 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; | 904 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; |
885 | struct av7110 *av7110 = (struct av7110 *) dvbdmx->priv; | 905 | struct av7110 *av7110 = (struct av7110 *) dvbdmx->priv; |
886 | u16 *pid = dvbdmx->pids, npids[5]; | 906 | u16 *pid = dvbdmx->pids, npids[5]; |
887 | int i; | 907 | int i; |
908 | int ret = 0; | ||
888 | 909 | ||
889 | dprintk(4, "%p\n", av7110); | 910 | dprintk(4, "%p\n", av7110); |
890 | 911 | ||
@@ -893,36 +914,49 @@ static void dvb_feed_start_pid(struct dvb_demux_feed *dvbdmxfeed) | |||
893 | npids[i] = (pid[i]&0x8000) ? 0 : pid[i]; | 914 | npids[i] = (pid[i]&0x8000) ? 0 : pid[i]; |
894 | if ((i == 2) && npids[i] && (dvbdmxfeed->ts_type & TS_PACKET)) { | 915 | if ((i == 2) && npids[i] && (dvbdmxfeed->ts_type & TS_PACKET)) { |
895 | npids[i] = 0; | 916 | npids[i] = 0; |
896 | ChangePIDs(av7110, npids[1], npids[0], npids[2], npids[3], npids[4]); | 917 | ret = ChangePIDs(av7110, npids[1], npids[0], npids[2], npids[3], npids[4]); |
897 | StartHWFilter(dvbdmxfeed->filter); | 918 | if (!ret) |
898 | return; | 919 | ret = StartHWFilter(dvbdmxfeed->filter); |
920 | return ret; | ||
921 | } | ||
922 | if (dvbdmxfeed->pes_type <= 2 || dvbdmxfeed->pes_type == 4) { | ||
923 | ret = ChangePIDs(av7110, npids[1], npids[0], npids[2], npids[3], npids[4]); | ||
924 | if (ret) | ||
925 | return ret; | ||
899 | } | 926 | } |
900 | if (dvbdmxfeed->pes_type <= 2 || dvbdmxfeed->pes_type == 4) | ||
901 | ChangePIDs(av7110, npids[1], npids[0], npids[2], npids[3], npids[4]); | ||
902 | 927 | ||
903 | if (dvbdmxfeed->pes_type < 2 && npids[0]) | 928 | if (dvbdmxfeed->pes_type < 2 && npids[0]) |
904 | if (av7110->fe_synced) | 929 | if (av7110->fe_synced) |
905 | av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, Scan, 0); | 930 | { |
931 | ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, Scan, 0); | ||
932 | if (ret) | ||
933 | return ret; | ||
934 | } | ||
906 | 935 | ||
907 | if ((dvbdmxfeed->ts_type & TS_PACKET)) { | 936 | if ((dvbdmxfeed->ts_type & TS_PACKET)) { |
908 | if (dvbdmxfeed->pes_type == 0 && !(dvbdmx->pids[0] & 0x8000)) | 937 | if (dvbdmxfeed->pes_type == 0 && !(dvbdmx->pids[0] & 0x8000)) |
909 | av7110_av_start_record(av7110, RP_AUDIO, dvbdmxfeed); | 938 | ret = av7110_av_start_record(av7110, RP_AUDIO, dvbdmxfeed); |
910 | if (dvbdmxfeed->pes_type == 1 && !(dvbdmx->pids[1] & 0x8000)) | 939 | if (dvbdmxfeed->pes_type == 1 && !(dvbdmx->pids[1] & 0x8000)) |
911 | av7110_av_start_record(av7110, RP_VIDEO, dvbdmxfeed); | 940 | ret = av7110_av_start_record(av7110, RP_VIDEO, dvbdmxfeed); |
912 | } | 941 | } |
942 | return ret; | ||
913 | } | 943 | } |
914 | 944 | ||
915 | static void dvb_feed_stop_pid(struct dvb_demux_feed *dvbdmxfeed) | 945 | static int dvb_feed_stop_pid(struct dvb_demux_feed *dvbdmxfeed) |
916 | { | 946 | { |
917 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; | 947 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; |
918 | struct av7110 *av7110 = (struct av7110 *) dvbdmx->priv; | 948 | struct av7110 *av7110 = (struct av7110 *) dvbdmx->priv; |
919 | u16 *pid = dvbdmx->pids, npids[5]; | 949 | u16 *pid = dvbdmx->pids, npids[5]; |
920 | int i; | 950 | int i; |
921 | 951 | ||
952 | int ret = 0; | ||
953 | |||
922 | dprintk(4, "%p\n", av7110); | 954 | dprintk(4, "%p\n", av7110); |
923 | 955 | ||
924 | if (dvbdmxfeed->pes_type <= 1) { | 956 | if (dvbdmxfeed->pes_type <= 1) { |
925 | av7110_av_stop(av7110, dvbdmxfeed->pes_type ? RP_VIDEO : RP_AUDIO); | 957 | ret = av7110_av_stop(av7110, dvbdmxfeed->pes_type ? RP_VIDEO : RP_AUDIO); |
958 | if (ret) | ||
959 | return ret; | ||
926 | if (!av7110->rec_mode) | 960 | if (!av7110->rec_mode) |
927 | dvbdmx->recording = 0; | 961 | dvbdmx->recording = 0; |
928 | if (!av7110->playing) | 962 | if (!av7110->playing) |
@@ -933,24 +967,27 @@ static void dvb_feed_stop_pid(struct dvb_demux_feed *dvbdmxfeed) | |||
933 | switch (i) { | 967 | switch (i) { |
934 | case 2: //teletext | 968 | case 2: //teletext |
935 | if (dvbdmxfeed->ts_type & TS_PACKET) | 969 | if (dvbdmxfeed->ts_type & TS_PACKET) |
936 | StopHWFilter(dvbdmxfeed->filter); | 970 | ret = StopHWFilter(dvbdmxfeed->filter); |
937 | npids[2] = 0; | 971 | npids[2] = 0; |
938 | break; | 972 | break; |
939 | case 0: | 973 | case 0: |
940 | case 1: | 974 | case 1: |
941 | case 4: | 975 | case 4: |
942 | if (!pids_off) | 976 | if (!pids_off) |
943 | return; | 977 | return 0; |
944 | npids[i] = (pid[i]&0x8000) ? 0 : pid[i]; | 978 | npids[i] = (pid[i]&0x8000) ? 0 : pid[i]; |
945 | break; | 979 | break; |
946 | } | 980 | } |
947 | ChangePIDs(av7110, npids[1], npids[0], npids[2], npids[3], npids[4]); | 981 | if (!ret) |
982 | ret = ChangePIDs(av7110, npids[1], npids[0], npids[2], npids[3], npids[4]); | ||
983 | return ret; | ||
948 | } | 984 | } |
949 | 985 | ||
950 | static int av7110_start_feed(struct dvb_demux_feed *feed) | 986 | static int av7110_start_feed(struct dvb_demux_feed *feed) |
951 | { | 987 | { |
952 | struct dvb_demux *demux = feed->demux; | 988 | struct dvb_demux *demux = feed->demux; |
953 | struct av7110 *av7110 = demux->priv; | 989 | struct av7110 *av7110 = demux->priv; |
990 | int ret = 0; | ||
954 | 991 | ||
955 | dprintk(4, "%p\n", av7110); | 992 | dprintk(4, "%p\n", av7110); |
956 | 993 | ||
@@ -971,21 +1008,22 @@ static int av7110_start_feed(struct dvb_demux_feed *feed) | |||
971 | !(demux->pids[1] & 0x8000)) { | 1008 | !(demux->pids[1] & 0x8000)) { |
972 | dvb_ringbuffer_flush_spinlock_wakeup(&av7110->avout); | 1009 | dvb_ringbuffer_flush_spinlock_wakeup(&av7110->avout); |
973 | dvb_ringbuffer_flush_spinlock_wakeup(&av7110->aout); | 1010 | dvb_ringbuffer_flush_spinlock_wakeup(&av7110->aout); |
974 | av7110_av_start_play(av7110,RP_AV); | 1011 | ret = av7110_av_start_play(av7110,RP_AV); |
975 | demux->playing = 1; | 1012 | if (!ret) |
1013 | demux->playing = 1; | ||
976 | } | 1014 | } |
977 | break; | 1015 | break; |
978 | default: | 1016 | default: |
979 | dvb_feed_start_pid(feed); | 1017 | ret = dvb_feed_start_pid(feed); |
980 | break; | 1018 | break; |
981 | } | 1019 | } |
982 | } else if ((feed->ts_type & TS_PACKET) && | 1020 | } else if ((feed->ts_type & TS_PACKET) && |
983 | (demux->dmx.frontend->source != DMX_MEMORY_FE)) { | 1021 | (demux->dmx.frontend->source != DMX_MEMORY_FE)) { |
984 | StartHWFilter(feed->filter); | 1022 | ret = StartHWFilter(feed->filter); |
985 | } | 1023 | } |
986 | } | 1024 | } |
987 | 1025 | ||
988 | if (feed->type == DMX_TYPE_SEC) { | 1026 | else if (feed->type == DMX_TYPE_SEC) { |
989 | int i; | 1027 | int i; |
990 | 1028 | ||
991 | for (i = 0; i < demux->filternum; i++) { | 1029 | for (i = 0; i < demux->filternum; i++) { |
@@ -996,12 +1034,15 @@ static int av7110_start_feed(struct dvb_demux_feed *feed) | |||
996 | if (demux->filter[i].filter.parent != &feed->feed.sec) | 1034 | if (demux->filter[i].filter.parent != &feed->feed.sec) |
997 | continue; | 1035 | continue; |
998 | demux->filter[i].state = DMX_STATE_GO; | 1036 | demux->filter[i].state = DMX_STATE_GO; |
999 | if (demux->dmx.frontend->source != DMX_MEMORY_FE) | 1037 | if (demux->dmx.frontend->source != DMX_MEMORY_FE) { |
1000 | StartHWFilter(&demux->filter[i]); | 1038 | ret = StartHWFilter(&demux->filter[i]); |
1039 | if (ret) | ||
1040 | break; | ||
1041 | } | ||
1001 | } | 1042 | } |
1002 | } | 1043 | } |
1003 | 1044 | ||
1004 | return 0; | 1045 | return ret; |
1005 | } | 1046 | } |
1006 | 1047 | ||
1007 | 1048 | ||
@@ -1009,7 +1050,7 @@ static int av7110_stop_feed(struct dvb_demux_feed *feed) | |||
1009 | { | 1050 | { |
1010 | struct dvb_demux *demux = feed->demux; | 1051 | struct dvb_demux *demux = feed->demux; |
1011 | struct av7110 *av7110 = demux->priv; | 1052 | struct av7110 *av7110 = demux->priv; |
1012 | 1053 | int i, rc, ret = 0; | |
1013 | dprintk(4, "%p\n", av7110); | 1054 | dprintk(4, "%p\n", av7110); |
1014 | 1055 | ||
1015 | if (feed->type == DMX_TYPE_TS) { | 1056 | if (feed->type == DMX_TYPE_TS) { |
@@ -1022,26 +1063,29 @@ static int av7110_stop_feed(struct dvb_demux_feed *feed) | |||
1022 | } | 1063 | } |
1023 | if (feed->ts_type & TS_DECODER && | 1064 | if (feed->ts_type & TS_DECODER && |
1024 | feed->pes_type < DMX_TS_PES_OTHER) { | 1065 | feed->pes_type < DMX_TS_PES_OTHER) { |
1025 | dvb_feed_stop_pid(feed); | 1066 | ret = dvb_feed_stop_pid(feed); |
1026 | } else | 1067 | } else |
1027 | if ((feed->ts_type & TS_PACKET) && | 1068 | if ((feed->ts_type & TS_PACKET) && |
1028 | (demux->dmx.frontend->source != DMX_MEMORY_FE)) | 1069 | (demux->dmx.frontend->source != DMX_MEMORY_FE)) |
1029 | StopHWFilter(feed->filter); | 1070 | ret = StopHWFilter(feed->filter); |
1030 | } | 1071 | } |
1031 | 1072 | ||
1032 | if (feed->type == DMX_TYPE_SEC) { | 1073 | if (!ret && feed->type == DMX_TYPE_SEC) { |
1033 | int i; | 1074 | for (i = 0; i<demux->filternum; i++) { |
1034 | |||
1035 | for (i = 0; i<demux->filternum; i++) | ||
1036 | if (demux->filter[i].state == DMX_STATE_GO && | 1075 | if (demux->filter[i].state == DMX_STATE_GO && |
1037 | demux->filter[i].filter.parent == &feed->feed.sec) { | 1076 | demux->filter[i].filter.parent == &feed->feed.sec) { |
1038 | demux->filter[i].state = DMX_STATE_READY; | 1077 | demux->filter[i].state = DMX_STATE_READY; |
1039 | if (demux->dmx.frontend->source != DMX_MEMORY_FE) | 1078 | if (demux->dmx.frontend->source != DMX_MEMORY_FE) { |
1040 | StopHWFilter(&demux->filter[i]); | 1079 | rc = StopHWFilter(&demux->filter[i]); |
1080 | if (!ret) | ||
1081 | ret = rc; | ||
1082 | /* keep going, stop as many filters as possible */ | ||
1083 | } | ||
1084 | } | ||
1041 | } | 1085 | } |
1042 | } | 1086 | } |
1043 | 1087 | ||
1044 | return 0; | 1088 | return ret; |
1045 | } | 1089 | } |
1046 | 1090 | ||
1047 | 1091 | ||
@@ -1093,7 +1137,7 @@ static int dvb_get_stc(struct dmx_demux *demux, unsigned int num, | |||
1093 | ret = av7110_fw_request(av7110, &tag, 0, fwstc, 4); | 1137 | ret = av7110_fw_request(av7110, &tag, 0, fwstc, 4); |
1094 | if (ret) { | 1138 | if (ret) { |
1095 | printk(KERN_ERR "%s: av7110_fw_request error\n", __FUNCTION__); | 1139 | printk(KERN_ERR "%s: av7110_fw_request error\n", __FUNCTION__); |
1096 | return -EIO; | 1140 | return ret; |
1097 | } | 1141 | } |
1098 | dprintk(2, "fwstc = %04hx %04hx %04hx %04hx\n", | 1142 | dprintk(2, "fwstc = %04hx %04hx %04hx %04hx\n", |
1099 | fwstc[0], fwstc[1], fwstc[2], fwstc[3]); | 1143 | fwstc[0], fwstc[1], fwstc[2], fwstc[3]); |
@@ -1119,18 +1163,14 @@ static int av7110_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
1119 | 1163 | ||
1120 | switch (tone) { | 1164 | switch (tone) { |
1121 | case SEC_TONE_ON: | 1165 | case SEC_TONE_ON: |
1122 | Set22K(av7110, 1); | 1166 | return Set22K(av7110, 1); |
1123 | break; | ||
1124 | 1167 | ||
1125 | case SEC_TONE_OFF: | 1168 | case SEC_TONE_OFF: |
1126 | Set22K(av7110, 0); | 1169 | return Set22K(av7110, 0); |
1127 | break; | ||
1128 | 1170 | ||
1129 | default: | 1171 | default: |
1130 | return -EINVAL; | 1172 | return -EINVAL; |
1131 | } | 1173 | } |
1132 | |||
1133 | return 0; | ||
1134 | } | 1174 | } |
1135 | 1175 | ||
1136 | static int av7110_diseqc_send_master_cmd(struct dvb_frontend* fe, | 1176 | static int av7110_diseqc_send_master_cmd(struct dvb_frontend* fe, |
@@ -1138,9 +1178,7 @@ static int av7110_diseqc_send_master_cmd(struct dvb_frontend* fe, | |||
1138 | { | 1178 | { |
1139 | struct av7110* av7110 = fe->dvb->priv; | 1179 | struct av7110* av7110 = fe->dvb->priv; |
1140 | 1180 | ||
1141 | av7110_diseqc_send(av7110, cmd->msg_len, cmd->msg, -1); | 1181 | return av7110_diseqc_send(av7110, cmd->msg_len, cmd->msg, -1); |
1142 | |||
1143 | return 0; | ||
1144 | } | 1182 | } |
1145 | 1183 | ||
1146 | static int av7110_diseqc_send_burst(struct dvb_frontend* fe, | 1184 | static int av7110_diseqc_send_burst(struct dvb_frontend* fe, |
@@ -1148,9 +1186,7 @@ static int av7110_diseqc_send_burst(struct dvb_frontend* fe, | |||
1148 | { | 1186 | { |
1149 | struct av7110* av7110 = fe->dvb->priv; | 1187 | struct av7110* av7110 = fe->dvb->priv; |
1150 | 1188 | ||
1151 | av7110_diseqc_send(av7110, 0, NULL, minicmd); | 1189 | return av7110_diseqc_send(av7110, 0, NULL, minicmd); |
1152 | |||
1153 | return 0; | ||
1154 | } | 1190 | } |
1155 | 1191 | ||
1156 | /* simplified code from budget-core.c */ | 1192 | /* simplified code from budget-core.c */ |
@@ -1992,76 +2028,85 @@ static struct l64781_config grundig_29504_401_config = { | |||
1992 | 2028 | ||
1993 | 2029 | ||
1994 | 2030 | ||
1995 | static void av7110_fe_lock_fix(struct av7110* av7110, fe_status_t status) | 2031 | static int av7110_fe_lock_fix(struct av7110* av7110, fe_status_t status) |
1996 | { | 2032 | { |
2033 | int ret = 0; | ||
1997 | int synced = (status & FE_HAS_LOCK) ? 1 : 0; | 2034 | int synced = (status & FE_HAS_LOCK) ? 1 : 0; |
1998 | 2035 | ||
1999 | av7110->fe_status = status; | 2036 | av7110->fe_status = status; |
2000 | 2037 | ||
2001 | if (av7110->fe_synced == synced) | 2038 | if (av7110->fe_synced == synced) |
2002 | return; | 2039 | return 0; |
2003 | |||
2004 | av7110->fe_synced = synced; | ||
2005 | 2040 | ||
2006 | if (av7110->playing) | 2041 | if (av7110->playing) |
2007 | return; | 2042 | return 0; |
2008 | 2043 | ||
2009 | if (down_interruptible(&av7110->pid_mutex)) | 2044 | if (down_interruptible(&av7110->pid_mutex)) |
2010 | return; | 2045 | return -ERESTARTSYS; |
2011 | 2046 | ||
2012 | if (av7110->fe_synced) { | 2047 | if (synced) { |
2013 | SetPIDs(av7110, av7110->pids[DMX_PES_VIDEO], | 2048 | ret = SetPIDs(av7110, av7110->pids[DMX_PES_VIDEO], |
2014 | av7110->pids[DMX_PES_AUDIO], | 2049 | av7110->pids[DMX_PES_AUDIO], |
2015 | av7110->pids[DMX_PES_TELETEXT], 0, | 2050 | av7110->pids[DMX_PES_TELETEXT], 0, |
2016 | av7110->pids[DMX_PES_PCR]); | 2051 | av7110->pids[DMX_PES_PCR]); |
2017 | av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, Scan, 0); | 2052 | if (!ret) |
2053 | ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, Scan, 0); | ||
2018 | } else { | 2054 | } else { |
2019 | SetPIDs(av7110, 0, 0, 0, 0, 0); | 2055 | ret = SetPIDs(av7110, 0, 0, 0, 0, 0); |
2020 | av7110_fw_cmd(av7110, COMTYPE_PID_FILTER, FlushTSQueue, 0); | 2056 | if (!ret) { |
2021 | av7110_wait_msgstate(av7110, GPMQBusy); | 2057 | ret = av7110_fw_cmd(av7110, COMTYPE_PID_FILTER, FlushTSQueue, 0); |
2058 | if (!ret) | ||
2059 | ret = av7110_wait_msgstate(av7110, GPMQBusy); | ||
2060 | } | ||
2022 | } | 2061 | } |
2023 | 2062 | ||
2063 | if (!ret) | ||
2064 | av7110->fe_synced = synced; | ||
2065 | |||
2024 | up(&av7110->pid_mutex); | 2066 | up(&av7110->pid_mutex); |
2067 | return ret; | ||
2025 | } | 2068 | } |
2026 | 2069 | ||
2027 | static int av7110_fe_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 2070 | static int av7110_fe_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
2028 | { | 2071 | { |
2029 | struct av7110* av7110 = fe->dvb->priv; | 2072 | struct av7110* av7110 = fe->dvb->priv; |
2030 | av7110_fe_lock_fix(av7110, 0); | 2073 | |
2031 | return av7110->fe_set_frontend(fe, params); | 2074 | int ret = av7110_fe_lock_fix(av7110, 0); |
2075 | if (!ret) | ||
2076 | ret = av7110->fe_set_frontend(fe, params); | ||
2077 | return ret; | ||
2032 | } | 2078 | } |
2033 | 2079 | ||
2034 | static int av7110_fe_init(struct dvb_frontend* fe) | 2080 | static int av7110_fe_init(struct dvb_frontend* fe) |
2035 | { | 2081 | { |
2036 | struct av7110* av7110 = fe->dvb->priv; | 2082 | struct av7110* av7110 = fe->dvb->priv; |
2037 | 2083 | ||
2038 | av7110_fe_lock_fix(av7110, 0); | 2084 | int ret = av7110_fe_lock_fix(av7110, 0); |
2039 | return av7110->fe_init(fe); | 2085 | if (!ret) |
2086 | ret = av7110->fe_init(fe); | ||
2087 | return ret; | ||
2040 | } | 2088 | } |
2041 | 2089 | ||
2042 | static int av7110_fe_read_status(struct dvb_frontend* fe, fe_status_t* status) | 2090 | static int av7110_fe_read_status(struct dvb_frontend* fe, fe_status_t* status) |
2043 | { | 2091 | { |
2044 | struct av7110* av7110 = fe->dvb->priv; | 2092 | struct av7110* av7110 = fe->dvb->priv; |
2045 | int ret; | ||
2046 | 2093 | ||
2047 | /* call the real implementation */ | 2094 | /* call the real implementation */ |
2048 | ret = av7110->fe_read_status(fe, status); | 2095 | int ret = av7110->fe_read_status(fe, status); |
2049 | if (ret) | 2096 | if (!ret) |
2050 | return ret; | 2097 | if (((*status ^ av7110->fe_status) & FE_HAS_LOCK) && (*status & FE_HAS_LOCK)) |
2051 | 2098 | ret = av7110_fe_lock_fix(av7110, *status); | |
2052 | if (((*status ^ av7110->fe_status) & FE_HAS_LOCK) && (*status & FE_HAS_LOCK)) { | 2099 | return ret; |
2053 | av7110_fe_lock_fix(av7110, *status); | ||
2054 | } | ||
2055 | |||
2056 | return 0; | ||
2057 | } | 2100 | } |
2058 | 2101 | ||
2059 | static int av7110_fe_diseqc_reset_overload(struct dvb_frontend* fe) | 2102 | static int av7110_fe_diseqc_reset_overload(struct dvb_frontend* fe) |
2060 | { | 2103 | { |
2061 | struct av7110* av7110 = fe->dvb->priv; | 2104 | struct av7110* av7110 = fe->dvb->priv; |
2062 | 2105 | ||
2063 | av7110_fe_lock_fix(av7110, 0); | 2106 | int ret = av7110_fe_lock_fix(av7110, 0); |
2064 | return av7110->fe_diseqc_reset_overload(fe); | 2107 | if (!ret) |
2108 | ret = av7110->fe_diseqc_reset_overload(fe); | ||
2109 | return ret; | ||
2065 | } | 2110 | } |
2066 | 2111 | ||
2067 | static int av7110_fe_diseqc_send_master_cmd(struct dvb_frontend* fe, | 2112 | static int av7110_fe_diseqc_send_master_cmd(struct dvb_frontend* fe, |
@@ -2069,40 +2114,50 @@ static int av7110_fe_diseqc_send_master_cmd(struct dvb_frontend* fe, | |||
2069 | { | 2114 | { |
2070 | struct av7110* av7110 = fe->dvb->priv; | 2115 | struct av7110* av7110 = fe->dvb->priv; |
2071 | 2116 | ||
2072 | av7110_fe_lock_fix(av7110, 0); | 2117 | int ret = av7110_fe_lock_fix(av7110, 0); |
2073 | return av7110->fe_diseqc_send_master_cmd(fe, cmd); | 2118 | if (!ret) |
2119 | ret = av7110->fe_diseqc_send_master_cmd(fe, cmd); | ||
2120 | return ret; | ||
2074 | } | 2121 | } |
2075 | 2122 | ||
2076 | static int av7110_fe_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd) | 2123 | static int av7110_fe_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd) |
2077 | { | 2124 | { |
2078 | struct av7110* av7110 = fe->dvb->priv; | 2125 | struct av7110* av7110 = fe->dvb->priv; |
2079 | 2126 | ||
2080 | av7110_fe_lock_fix(av7110, 0); | 2127 | int ret = av7110_fe_lock_fix(av7110, 0); |
2081 | return av7110->fe_diseqc_send_burst(fe, minicmd); | 2128 | if (!ret) |
2129 | ret = av7110->fe_diseqc_send_burst(fe, minicmd); | ||
2130 | return ret; | ||
2082 | } | 2131 | } |
2083 | 2132 | ||
2084 | static int av7110_fe_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | 2133 | static int av7110_fe_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) |
2085 | { | 2134 | { |
2086 | struct av7110* av7110 = fe->dvb->priv; | 2135 | struct av7110* av7110 = fe->dvb->priv; |
2087 | 2136 | ||
2088 | av7110_fe_lock_fix(av7110, 0); | 2137 | int ret = av7110_fe_lock_fix(av7110, 0); |
2089 | return av7110->fe_set_tone(fe, tone); | 2138 | if (!ret) |
2139 | ret = av7110->fe_set_tone(fe, tone); | ||
2140 | return ret; | ||
2090 | } | 2141 | } |
2091 | 2142 | ||
2092 | static int av7110_fe_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) | 2143 | static int av7110_fe_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) |
2093 | { | 2144 | { |
2094 | struct av7110* av7110 = fe->dvb->priv; | 2145 | struct av7110* av7110 = fe->dvb->priv; |
2095 | 2146 | ||
2096 | av7110_fe_lock_fix(av7110, 0); | 2147 | int ret = av7110_fe_lock_fix(av7110, 0); |
2097 | return av7110->fe_set_voltage(fe, voltage); | 2148 | if (!ret) |
2149 | ret = av7110->fe_set_voltage(fe, voltage); | ||
2150 | return ret; | ||
2098 | } | 2151 | } |
2099 | 2152 | ||
2100 | static int av7110_fe_dishnetwork_send_legacy_command(struct dvb_frontend* fe, unsigned int cmd) | 2153 | static int av7110_fe_dishnetwork_send_legacy_command(struct dvb_frontend* fe, unsigned int cmd) |
2101 | { | 2154 | { |
2102 | struct av7110* av7110 = fe->dvb->priv; | 2155 | struct av7110* av7110 = fe->dvb->priv; |
2103 | 2156 | ||
2104 | av7110_fe_lock_fix(av7110, 0); | 2157 | int ret = av7110_fe_lock_fix(av7110, 0); |
2105 | return av7110->fe_dishnetwork_send_legacy_command(fe, cmd); | 2158 | if (!ret) |
2159 | ret = av7110->fe_dishnetwork_send_legacy_command(fe, cmd); | ||
2160 | return ret; | ||
2106 | } | 2161 | } |
2107 | 2162 | ||
2108 | static u8 read_pwm(struct av7110* av7110) | 2163 | static u8 read_pwm(struct av7110* av7110) |
diff --git a/drivers/media/dvb/ttpci/av7110.h b/drivers/media/dvb/ttpci/av7110.h index 4f69b4d01479..508b7739c609 100644 --- a/drivers/media/dvb/ttpci/av7110.h +++ b/drivers/media/dvb/ttpci/av7110.h | |||
@@ -119,8 +119,7 @@ struct av7110 { | |||
119 | volatile int bmp_state; | 119 | volatile int bmp_state; |
120 | #define BMP_NONE 0 | 120 | #define BMP_NONE 0 |
121 | #define BMP_LOADING 1 | 121 | #define BMP_LOADING 1 |
122 | #define BMP_LOADINGS 2 | 122 | #define BMP_LOADED 2 |
123 | #define BMP_LOADED 3 | ||
124 | wait_queue_head_t bmpq; | 123 | wait_queue_head_t bmpq; |
125 | 124 | ||
126 | 125 | ||
@@ -255,12 +254,12 @@ struct av7110 { | |||
255 | }; | 254 | }; |
256 | 255 | ||
257 | 256 | ||
258 | extern void ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, | 257 | extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, |
259 | u16 subpid, u16 pcrpid); | 258 | u16 subpid, u16 pcrpid); |
260 | 259 | ||
261 | extern void av7110_register_irc_handler(void (*func)(u32)); | 260 | extern void av7110_register_irc_handler(void (*func)(u32)); |
262 | extern void av7110_unregister_irc_handler(void (*func)(u32)); | 261 | extern void av7110_unregister_irc_handler(void (*func)(u32)); |
263 | extern void av7110_setup_irc_config (struct av7110 *av7110, u32 ir_config); | 262 | extern int av7110_setup_irc_config (struct av7110 *av7110, u32 ir_config); |
264 | 263 | ||
265 | extern int av7110_ir_init (void); | 264 | extern int av7110_ir_init (void); |
266 | extern void av7110_ir_exit (void); | 265 | extern void av7110_ir_exit (void); |
diff --git a/drivers/media/dvb/ttpci/av7110_av.c b/drivers/media/dvb/ttpci/av7110_av.c index ccf946125d02..0696a5a4f855 100644 --- a/drivers/media/dvb/ttpci/av7110_av.c +++ b/drivers/media/dvb/ttpci/av7110_av.c | |||
@@ -121,6 +121,7 @@ static int dvb_filter_pes2ts_cb(void *priv, unsigned char *data) | |||
121 | int av7110_av_start_record(struct av7110 *av7110, int av, | 121 | int av7110_av_start_record(struct av7110 *av7110, int av, |
122 | struct dvb_demux_feed *dvbdmxfeed) | 122 | struct dvb_demux_feed *dvbdmxfeed) |
123 | { | 123 | { |
124 | int ret = 0; | ||
124 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; | 125 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; |
125 | 126 | ||
126 | dprintk(2, "av7110:%p, , dvb_demux_feed:%p\n", av7110, dvbdmxfeed); | 127 | dprintk(2, "av7110:%p, , dvb_demux_feed:%p\n", av7110, dvbdmxfeed); |
@@ -137,7 +138,7 @@ int av7110_av_start_record(struct av7110 *av7110, int av, | |||
137 | dvbdmx->pesfilter[0]->pid, | 138 | dvbdmx->pesfilter[0]->pid, |
138 | dvb_filter_pes2ts_cb, | 139 | dvb_filter_pes2ts_cb, |
139 | (void *) dvbdmx->pesfilter[0]); | 140 | (void *) dvbdmx->pesfilter[0]); |
140 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Record, 2, AudioPES, 0); | 141 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Record, 2, AudioPES, 0); |
141 | break; | 142 | break; |
142 | 143 | ||
143 | case RP_VIDEO: | 144 | case RP_VIDEO: |
@@ -145,7 +146,7 @@ int av7110_av_start_record(struct av7110 *av7110, int av, | |||
145 | dvbdmx->pesfilter[1]->pid, | 146 | dvbdmx->pesfilter[1]->pid, |
146 | dvb_filter_pes2ts_cb, | 147 | dvb_filter_pes2ts_cb, |
147 | (void *) dvbdmx->pesfilter[1]); | 148 | (void *) dvbdmx->pesfilter[1]); |
148 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Record, 2, VideoPES, 0); | 149 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Record, 2, VideoPES, 0); |
149 | break; | 150 | break; |
150 | 151 | ||
151 | case RP_AV: | 152 | case RP_AV: |
@@ -157,14 +158,15 @@ int av7110_av_start_record(struct av7110 *av7110, int av, | |||
157 | dvbdmx->pesfilter[1]->pid, | 158 | dvbdmx->pesfilter[1]->pid, |
158 | dvb_filter_pes2ts_cb, | 159 | dvb_filter_pes2ts_cb, |
159 | (void *) dvbdmx->pesfilter[1]); | 160 | (void *) dvbdmx->pesfilter[1]); |
160 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Record, 2, AV_PES, 0); | 161 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Record, 2, AV_PES, 0); |
161 | break; | 162 | break; |
162 | } | 163 | } |
163 | return 0; | 164 | return ret; |
164 | } | 165 | } |
165 | 166 | ||
166 | int av7110_av_start_play(struct av7110 *av7110, int av) | 167 | int av7110_av_start_play(struct av7110 *av7110, int av) |
167 | { | 168 | { |
169 | int ret = 0; | ||
168 | dprintk(2, "av7110:%p, \n", av7110); | 170 | dprintk(2, "av7110:%p, \n", av7110); |
169 | 171 | ||
170 | if (av7110->rec_mode) | 172 | if (av7110->rec_mode) |
@@ -182,54 +184,57 @@ int av7110_av_start_play(struct av7110 *av7110, int av) | |||
182 | av7110->playing |= av; | 184 | av7110->playing |= av; |
183 | switch (av7110->playing) { | 185 | switch (av7110->playing) { |
184 | case RP_AUDIO: | 186 | case RP_AUDIO: |
185 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Play, 2, AudioPES, 0); | 187 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Play, 2, AudioPES, 0); |
186 | break; | 188 | break; |
187 | case RP_VIDEO: | 189 | case RP_VIDEO: |
188 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Play, 2, VideoPES, 0); | 190 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Play, 2, VideoPES, 0); |
189 | av7110->sinfo = 0; | 191 | av7110->sinfo = 0; |
190 | break; | 192 | break; |
191 | case RP_AV: | 193 | case RP_AV: |
192 | av7110->sinfo = 0; | 194 | av7110->sinfo = 0; |
193 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Play, 2, AV_PES, 0); | 195 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Play, 2, AV_PES, 0); |
194 | break; | 196 | break; |
195 | } | 197 | } |
196 | return av7110->playing; | 198 | if (!ret) |
199 | ret = av7110->playing; | ||
200 | return ret; | ||
197 | } | 201 | } |
198 | 202 | ||
199 | void av7110_av_stop(struct av7110 *av7110, int av) | 203 | int av7110_av_stop(struct av7110 *av7110, int av) |
200 | { | 204 | { |
205 | int ret = 0; | ||
201 | dprintk(2, "av7110:%p, \n", av7110); | 206 | dprintk(2, "av7110:%p, \n", av7110); |
202 | 207 | ||
203 | if (!(av7110->playing & av) && !(av7110->rec_mode & av)) | 208 | if (!(av7110->playing & av) && !(av7110->rec_mode & av)) |
204 | return; | 209 | return 0; |
205 | |||
206 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Stop, 0); | 210 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Stop, 0); |
207 | if (av7110->playing) { | 211 | if (av7110->playing) { |
208 | av7110->playing &= ~av; | 212 | av7110->playing &= ~av; |
209 | switch (av7110->playing) { | 213 | switch (av7110->playing) { |
210 | case RP_AUDIO: | 214 | case RP_AUDIO: |
211 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Play, 2, AudioPES, 0); | 215 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Play, 2, AudioPES, 0); |
212 | break; | 216 | break; |
213 | case RP_VIDEO: | 217 | case RP_VIDEO: |
214 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Play, 2, VideoPES, 0); | 218 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Play, 2, VideoPES, 0); |
215 | break; | 219 | break; |
216 | case RP_NONE: | 220 | case RP_NONE: |
217 | av7110_set_vidmode(av7110, av7110->vidmode); | 221 | ret = av7110_set_vidmode(av7110, av7110->vidmode); |
218 | break; | 222 | break; |
219 | } | 223 | } |
220 | } else { | 224 | } else { |
221 | av7110->rec_mode &= ~av; | 225 | av7110->rec_mode &= ~av; |
222 | switch (av7110->rec_mode) { | 226 | switch (av7110->rec_mode) { |
223 | case RP_AUDIO: | 227 | case RP_AUDIO: |
224 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Record, 2, AudioPES, 0); | 228 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Record, 2, AudioPES, 0); |
225 | break; | 229 | break; |
226 | case RP_VIDEO: | 230 | case RP_VIDEO: |
227 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Record, 2, VideoPES, 0); | 231 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Record, 2, VideoPES, 0); |
228 | break; | 232 | break; |
229 | case RP_NONE: | 233 | case RP_NONE: |
230 | break; | 234 | break; |
231 | } | 235 | } |
232 | } | 236 | } |
237 | return ret; | ||
233 | } | 238 | } |
234 | 239 | ||
235 | 240 | ||
@@ -317,19 +322,22 @@ int av7110_set_volume(struct av7110 *av7110, int volleft, int volright) | |||
317 | return 0; | 322 | return 0; |
318 | } | 323 | } |
319 | 324 | ||
320 | void av7110_set_vidmode(struct av7110 *av7110, int mode) | 325 | int av7110_set_vidmode(struct av7110 *av7110, int mode) |
321 | { | 326 | { |
327 | int ret; | ||
322 | dprintk(2, "av7110:%p, \n", av7110); | 328 | dprintk(2, "av7110:%p, \n", av7110); |
323 | 329 | ||
324 | av7110_fw_cmd(av7110, COMTYPE_ENCODER, LoadVidCode, 1, mode); | 330 | ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, LoadVidCode, 1, mode); |
325 | 331 | ||
326 | if (!av7110->playing) { | 332 | if (!ret && !av7110->playing) { |
327 | ChangePIDs(av7110, av7110->pids[DMX_PES_VIDEO], | 333 | ret = ChangePIDs(av7110, av7110->pids[DMX_PES_VIDEO], |
328 | av7110->pids[DMX_PES_AUDIO], | 334 | av7110->pids[DMX_PES_AUDIO], |
329 | av7110->pids[DMX_PES_TELETEXT], | 335 | av7110->pids[DMX_PES_TELETEXT], |
330 | 0, av7110->pids[DMX_PES_PCR]); | 336 | 0, av7110->pids[DMX_PES_PCR]); |
331 | av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, Scan, 0); | 337 | if (!ret) |
338 | ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, Scan, 0); | ||
332 | } | 339 | } |
340 | return ret; | ||
333 | } | 341 | } |
334 | 342 | ||
335 | 343 | ||
@@ -340,17 +348,18 @@ static int sw2mode[16] = { | |||
340 | VIDEO_MODE_PAL, VIDEO_MODE_PAL, VIDEO_MODE_PAL, VIDEO_MODE_PAL, | 348 | VIDEO_MODE_PAL, VIDEO_MODE_PAL, VIDEO_MODE_PAL, VIDEO_MODE_PAL, |
341 | }; | 349 | }; |
342 | 350 | ||
343 | static void get_video_format(struct av7110 *av7110, u8 *buf, int count) | 351 | static int get_video_format(struct av7110 *av7110, u8 *buf, int count) |
344 | { | 352 | { |
345 | int i; | 353 | int i; |
346 | int hsize, vsize; | 354 | int hsize, vsize; |
347 | int sw; | 355 | int sw; |
348 | u8 *p; | 356 | u8 *p; |
357 | int ret = 0; | ||
349 | 358 | ||
350 | dprintk(2, "av7110:%p, \n", av7110); | 359 | dprintk(2, "av7110:%p, \n", av7110); |
351 | 360 | ||
352 | if (av7110->sinfo) | 361 | if (av7110->sinfo) |
353 | return; | 362 | return 0; |
354 | for (i = 7; i < count - 10; i++) { | 363 | for (i = 7; i < count - 10; i++) { |
355 | p = buf + i; | 364 | p = buf + i; |
356 | if (p[0] || p[1] || p[2] != 0x01 || p[3] != 0xb3) | 365 | if (p[0] || p[1] || p[2] != 0x01 || p[3] != 0xb3) |
@@ -359,11 +368,14 @@ static void get_video_format(struct av7110 *av7110, u8 *buf, int count) | |||
359 | hsize = ((p[1] &0xF0) >> 4) | (p[0] << 4); | 368 | hsize = ((p[1] &0xF0) >> 4) | (p[0] << 4); |
360 | vsize = ((p[1] &0x0F) << 8) | (p[2]); | 369 | vsize = ((p[1] &0x0F) << 8) | (p[2]); |
361 | sw = (p[3] & 0x0F); | 370 | sw = (p[3] & 0x0F); |
362 | av7110_set_vidmode(av7110, sw2mode[sw]); | 371 | ret = av7110_set_vidmode(av7110, sw2mode[sw]); |
363 | dprintk(2, "playback %dx%d fr=%d\n", hsize, vsize, sw); | 372 | if (!ret) { |
364 | av7110->sinfo = 1; | 373 | dprintk(2, "playback %dx%d fr=%d\n", hsize, vsize, sw); |
374 | av7110->sinfo = 1; | ||
375 | } | ||
365 | break; | 376 | break; |
366 | } | 377 | } |
378 | return ret; | ||
367 | } | 379 | } |
368 | 380 | ||
369 | 381 | ||
@@ -974,7 +986,7 @@ static int dvb_video_ioctl(struct inode *inode, struct file *file, | |||
974 | unsigned long arg = (unsigned long) parg; | 986 | unsigned long arg = (unsigned long) parg; |
975 | int ret = 0; | 987 | int ret = 0; |
976 | 988 | ||
977 | dprintk(2, "av7110:%p, \n", av7110); | 989 | dprintk(1, "av7110:%p, cmd=%04x\n", av7110,cmd); |
978 | 990 | ||
979 | if ((file->f_flags & O_ACCMODE) == O_RDONLY) { | 991 | if ((file->f_flags & O_ACCMODE) == O_RDONLY) { |
980 | if ( cmd != VIDEO_GET_STATUS && cmd != VIDEO_GET_EVENT && | 992 | if ( cmd != VIDEO_GET_STATUS && cmd != VIDEO_GET_EVENT && |
@@ -987,49 +999,57 @@ static int dvb_video_ioctl(struct inode *inode, struct file *file, | |||
987 | case VIDEO_STOP: | 999 | case VIDEO_STOP: |
988 | av7110->videostate.play_state = VIDEO_STOPPED; | 1000 | av7110->videostate.play_state = VIDEO_STOPPED; |
989 | if (av7110->videostate.stream_source == VIDEO_SOURCE_MEMORY) | 1001 | if (av7110->videostate.stream_source == VIDEO_SOURCE_MEMORY) |
990 | av7110_av_stop(av7110, RP_VIDEO); | 1002 | ret = av7110_av_stop(av7110, RP_VIDEO); |
991 | else | 1003 | else |
992 | vidcom(av7110, VIDEO_CMD_STOP, | 1004 | ret = vidcom(av7110, VIDEO_CMD_STOP, |
993 | av7110->videostate.video_blank ? 0 : 1); | 1005 | av7110->videostate.video_blank ? 0 : 1); |
994 | av7110->trickmode = TRICK_NONE; | 1006 | if (!ret) |
1007 | av7110->trickmode = TRICK_NONE; | ||
995 | break; | 1008 | break; |
996 | 1009 | ||
997 | case VIDEO_PLAY: | 1010 | case VIDEO_PLAY: |
998 | av7110->trickmode = TRICK_NONE; | 1011 | av7110->trickmode = TRICK_NONE; |
999 | if (av7110->videostate.play_state == VIDEO_FREEZED) { | 1012 | if (av7110->videostate.play_state == VIDEO_FREEZED) { |
1000 | av7110->videostate.play_state = VIDEO_PLAYING; | 1013 | av7110->videostate.play_state = VIDEO_PLAYING; |
1001 | vidcom(av7110, VIDEO_CMD_PLAY, 0); | 1014 | ret = vidcom(av7110, VIDEO_CMD_PLAY, 0); |
1015 | if (ret) | ||
1016 | break; | ||
1002 | } | 1017 | } |
1003 | 1018 | ||
1004 | if (av7110->videostate.stream_source == VIDEO_SOURCE_MEMORY) { | 1019 | if (av7110->videostate.stream_source == VIDEO_SOURCE_MEMORY) { |
1005 | if (av7110->playing == RP_AV) { | 1020 | if (av7110->playing == RP_AV) { |
1006 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Stop, 0); | 1021 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Stop, 0); |
1022 | if (ret) | ||
1023 | break; | ||
1007 | av7110->playing &= ~RP_VIDEO; | 1024 | av7110->playing &= ~RP_VIDEO; |
1008 | } | 1025 | } |
1009 | av7110_av_start_play(av7110, RP_VIDEO); | 1026 | ret = av7110_av_start_play(av7110, RP_VIDEO); |
1010 | vidcom(av7110, VIDEO_CMD_PLAY, 0); | ||
1011 | } else { | ||
1012 | //av7110_av_stop(av7110, RP_VIDEO); | ||
1013 | vidcom(av7110, VIDEO_CMD_PLAY, 0); | ||
1014 | } | 1027 | } |
1015 | av7110->videostate.play_state = VIDEO_PLAYING; | 1028 | if (!ret) |
1029 | ret = vidcom(av7110, VIDEO_CMD_PLAY, 0); | ||
1030 | if (!ret) | ||
1031 | av7110->videostate.play_state = VIDEO_PLAYING; | ||
1016 | break; | 1032 | break; |
1017 | 1033 | ||
1018 | case VIDEO_FREEZE: | 1034 | case VIDEO_FREEZE: |
1019 | av7110->videostate.play_state = VIDEO_FREEZED; | 1035 | av7110->videostate.play_state = VIDEO_FREEZED; |
1020 | if (av7110->playing & RP_VIDEO) | 1036 | if (av7110->playing & RP_VIDEO) |
1021 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Pause, 0); | 1037 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Pause, 0); |
1022 | else | 1038 | else |
1023 | vidcom(av7110, VIDEO_CMD_FREEZE, 1); | 1039 | ret = vidcom(av7110, VIDEO_CMD_FREEZE, 1); |
1024 | av7110->trickmode = TRICK_FREEZE; | 1040 | if (!ret) |
1041 | av7110->trickmode = TRICK_FREEZE; | ||
1025 | break; | 1042 | break; |
1026 | 1043 | ||
1027 | case VIDEO_CONTINUE: | 1044 | case VIDEO_CONTINUE: |
1028 | if (av7110->playing & RP_VIDEO) | 1045 | if (av7110->playing & RP_VIDEO) |
1029 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Continue, 0); | 1046 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Continue, 0); |
1030 | vidcom(av7110, VIDEO_CMD_PLAY, 0); | 1047 | if (!ret) |
1031 | av7110->videostate.play_state = VIDEO_PLAYING; | 1048 | ret = vidcom(av7110, VIDEO_CMD_PLAY, 0); |
1032 | av7110->trickmode = TRICK_NONE; | 1049 | if (!ret) { |
1050 | av7110->videostate.play_state = VIDEO_PLAYING; | ||
1051 | av7110->trickmode = TRICK_NONE; | ||
1052 | } | ||
1033 | break; | 1053 | break; |
1034 | 1054 | ||
1035 | case VIDEO_SELECT_SOURCE: | 1055 | case VIDEO_SELECT_SOURCE: |
@@ -1045,7 +1065,7 @@ static int dvb_video_ioctl(struct inode *inode, struct file *file, | |||
1045 | break; | 1065 | break; |
1046 | 1066 | ||
1047 | case VIDEO_GET_EVENT: | 1067 | case VIDEO_GET_EVENT: |
1048 | ret=dvb_video_get_event(av7110, parg, file->f_flags); | 1068 | ret = dvb_video_get_event(av7110, parg, file->f_flags); |
1049 | break; | 1069 | break; |
1050 | 1070 | ||
1051 | case VIDEO_GET_SIZE: | 1071 | case VIDEO_GET_SIZE: |
@@ -1105,25 +1125,32 @@ static int dvb_video_ioctl(struct inode *inode, struct file *file, | |||
1105 | case VIDEO_FAST_FORWARD: | 1125 | case VIDEO_FAST_FORWARD: |
1106 | //note: arg is ignored by firmware | 1126 | //note: arg is ignored by firmware |
1107 | if (av7110->playing & RP_VIDEO) | 1127 | if (av7110->playing & RP_VIDEO) |
1108 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, | 1128 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, |
1109 | __Scan_I, 2, AV_PES, 0); | 1129 | __Scan_I, 2, AV_PES, 0); |
1110 | else | 1130 | else |
1111 | vidcom(av7110, VIDEO_CMD_FFWD, arg); | 1131 | ret = vidcom(av7110, VIDEO_CMD_FFWD, arg); |
1112 | av7110->trickmode = TRICK_FAST; | 1132 | if (!ret) { |
1113 | av7110->videostate.play_state = VIDEO_PLAYING; | 1133 | av7110->trickmode = TRICK_FAST; |
1134 | av7110->videostate.play_state = VIDEO_PLAYING; | ||
1135 | } | ||
1114 | break; | 1136 | break; |
1115 | 1137 | ||
1116 | case VIDEO_SLOWMOTION: | 1138 | case VIDEO_SLOWMOTION: |
1117 | if (av7110->playing&RP_VIDEO) { | 1139 | if (av7110->playing&RP_VIDEO) { |
1118 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Slow, 2, 0, 0); | 1140 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, __Slow, 2, 0, 0); |
1119 | vidcom(av7110, VIDEO_CMD_SLOW, arg); | 1141 | if (!ret) |
1142 | ret = vidcom(av7110, VIDEO_CMD_SLOW, arg); | ||
1120 | } else { | 1143 | } else { |
1121 | vidcom(av7110, VIDEO_CMD_PLAY, 0); | 1144 | ret = vidcom(av7110, VIDEO_CMD_PLAY, 0); |
1122 | vidcom(av7110, VIDEO_CMD_STOP, 0); | 1145 | if (!ret) |
1123 | vidcom(av7110, VIDEO_CMD_SLOW, arg); | 1146 | ret = vidcom(av7110, VIDEO_CMD_STOP, 0); |
1147 | if (!ret) | ||
1148 | ret = vidcom(av7110, VIDEO_CMD_SLOW, arg); | ||
1149 | } | ||
1150 | if (!ret) { | ||
1151 | av7110->trickmode = TRICK_SLOW; | ||
1152 | av7110->videostate.play_state = VIDEO_PLAYING; | ||
1124 | } | 1153 | } |
1125 | av7110->trickmode = TRICK_SLOW; | ||
1126 | av7110->videostate.play_state = VIDEO_PLAYING; | ||
1127 | break; | 1154 | break; |
1128 | 1155 | ||
1129 | case VIDEO_GET_CAPABILITIES: | 1156 | case VIDEO_GET_CAPABILITIES: |
@@ -1136,18 +1163,21 @@ static int dvb_video_ioctl(struct inode *inode, struct file *file, | |||
1136 | av7110_ipack_reset(&av7110->ipack[1]); | 1163 | av7110_ipack_reset(&av7110->ipack[1]); |
1137 | 1164 | ||
1138 | if (av7110->playing == RP_AV) { | 1165 | if (av7110->playing == RP_AV) { |
1139 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, | 1166 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, |
1140 | __Play, 2, AV_PES, 0); | 1167 | __Play, 2, AV_PES, 0); |
1168 | if (ret) | ||
1169 | break; | ||
1141 | if (av7110->trickmode == TRICK_FAST) | 1170 | if (av7110->trickmode == TRICK_FAST) |
1142 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, | 1171 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, |
1143 | __Scan_I, 2, AV_PES, 0); | 1172 | __Scan_I, 2, AV_PES, 0); |
1144 | if (av7110->trickmode == TRICK_SLOW) { | 1173 | if (av7110->trickmode == TRICK_SLOW) { |
1145 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, | 1174 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, |
1146 | __Slow, 2, 0, 0); | 1175 | __Slow, 2, 0, 0); |
1147 | vidcom(av7110, VIDEO_CMD_SLOW, arg); | 1176 | if (!ret) |
1177 | ret = vidcom(av7110, VIDEO_CMD_SLOW, arg); | ||
1148 | } | 1178 | } |
1149 | if (av7110->trickmode == TRICK_FREEZE) | 1179 | if (av7110->trickmode == TRICK_FREEZE) |
1150 | vidcom(av7110, VIDEO_CMD_STOP, 1); | 1180 | ret = vidcom(av7110, VIDEO_CMD_STOP, 1); |
1151 | } | 1181 | } |
1152 | break; | 1182 | break; |
1153 | 1183 | ||
@@ -1170,7 +1200,7 @@ static int dvb_audio_ioctl(struct inode *inode, struct file *file, | |||
1170 | unsigned long arg = (unsigned long) parg; | 1200 | unsigned long arg = (unsigned long) parg; |
1171 | int ret = 0; | 1201 | int ret = 0; |
1172 | 1202 | ||
1173 | dprintk(2, "av7110:%p, \n", av7110); | 1203 | dprintk(1, "av7110:%p, cmd=%04x\n", av7110,cmd); |
1174 | 1204 | ||
1175 | if (((file->f_flags & O_ACCMODE) == O_RDONLY) && | 1205 | if (((file->f_flags & O_ACCMODE) == O_RDONLY) && |
1176 | (cmd != AUDIO_GET_STATUS)) | 1206 | (cmd != AUDIO_GET_STATUS)) |
@@ -1179,28 +1209,32 @@ static int dvb_audio_ioctl(struct inode *inode, struct file *file, | |||
1179 | switch (cmd) { | 1209 | switch (cmd) { |
1180 | case AUDIO_STOP: | 1210 | case AUDIO_STOP: |
1181 | if (av7110->audiostate.stream_source == AUDIO_SOURCE_MEMORY) | 1211 | if (av7110->audiostate.stream_source == AUDIO_SOURCE_MEMORY) |
1182 | av7110_av_stop(av7110, RP_AUDIO); | 1212 | ret = av7110_av_stop(av7110, RP_AUDIO); |
1183 | else | 1213 | else |
1184 | audcom(av7110, AUDIO_CMD_MUTE); | 1214 | ret = audcom(av7110, AUDIO_CMD_MUTE); |
1185 | av7110->audiostate.play_state = AUDIO_STOPPED; | 1215 | if (!ret) |
1216 | av7110->audiostate.play_state = AUDIO_STOPPED; | ||
1186 | break; | 1217 | break; |
1187 | 1218 | ||
1188 | case AUDIO_PLAY: | 1219 | case AUDIO_PLAY: |
1189 | if (av7110->audiostate.stream_source == AUDIO_SOURCE_MEMORY) | 1220 | if (av7110->audiostate.stream_source == AUDIO_SOURCE_MEMORY) |
1190 | av7110_av_start_play(av7110, RP_AUDIO); | 1221 | ret = av7110_av_start_play(av7110, RP_AUDIO); |
1191 | audcom(av7110, AUDIO_CMD_UNMUTE); | 1222 | if (!ret) |
1192 | av7110->audiostate.play_state = AUDIO_PLAYING; | 1223 | ret = audcom(av7110, AUDIO_CMD_UNMUTE); |
1224 | if (!ret) | ||
1225 | av7110->audiostate.play_state = AUDIO_PLAYING; | ||
1193 | break; | 1226 | break; |
1194 | 1227 | ||
1195 | case AUDIO_PAUSE: | 1228 | case AUDIO_PAUSE: |
1196 | audcom(av7110, AUDIO_CMD_MUTE); | 1229 | ret = audcom(av7110, AUDIO_CMD_MUTE); |
1197 | av7110->audiostate.play_state = AUDIO_PAUSED; | 1230 | if (!ret) |
1231 | av7110->audiostate.play_state = AUDIO_PAUSED; | ||
1198 | break; | 1232 | break; |
1199 | 1233 | ||
1200 | case AUDIO_CONTINUE: | 1234 | case AUDIO_CONTINUE: |
1201 | if (av7110->audiostate.play_state == AUDIO_PAUSED) { | 1235 | if (av7110->audiostate.play_state == AUDIO_PAUSED) { |
1202 | av7110->audiostate.play_state = AUDIO_PLAYING; | 1236 | av7110->audiostate.play_state = AUDIO_PLAYING; |
1203 | audcom(av7110, AUDIO_CMD_MUTE | AUDIO_CMD_PCM16); | 1237 | ret = audcom(av7110, AUDIO_CMD_UNMUTE | AUDIO_CMD_PCM16); |
1204 | } | 1238 | } |
1205 | break; | 1239 | break; |
1206 | 1240 | ||
@@ -1210,14 +1244,15 @@ static int dvb_audio_ioctl(struct inode *inode, struct file *file, | |||
1210 | 1244 | ||
1211 | case AUDIO_SET_MUTE: | 1245 | case AUDIO_SET_MUTE: |
1212 | { | 1246 | { |
1213 | audcom(av7110, arg ? AUDIO_CMD_MUTE : AUDIO_CMD_UNMUTE); | 1247 | ret = audcom(av7110, arg ? AUDIO_CMD_MUTE : AUDIO_CMD_UNMUTE); |
1214 | av7110->audiostate.mute_state = (int) arg; | 1248 | if (!ret) |
1249 | av7110->audiostate.mute_state = (int) arg; | ||
1215 | break; | 1250 | break; |
1216 | } | 1251 | } |
1217 | 1252 | ||
1218 | case AUDIO_SET_AV_SYNC: | 1253 | case AUDIO_SET_AV_SYNC: |
1219 | av7110->audiostate.AV_sync_state = (int) arg; | 1254 | av7110->audiostate.AV_sync_state = (int) arg; |
1220 | audcom(av7110, arg ? AUDIO_CMD_SYNC_ON : AUDIO_CMD_SYNC_OFF); | 1255 | ret = audcom(av7110, arg ? AUDIO_CMD_SYNC_ON : AUDIO_CMD_SYNC_OFF); |
1221 | break; | 1256 | break; |
1222 | 1257 | ||
1223 | case AUDIO_SET_BYPASS_MODE: | 1258 | case AUDIO_SET_BYPASS_MODE: |
@@ -1229,21 +1264,24 @@ static int dvb_audio_ioctl(struct inode *inode, struct file *file, | |||
1229 | 1264 | ||
1230 | switch(av7110->audiostate.channel_select) { | 1265 | switch(av7110->audiostate.channel_select) { |
1231 | case AUDIO_STEREO: | 1266 | case AUDIO_STEREO: |
1232 | audcom(av7110, AUDIO_CMD_STEREO); | 1267 | ret = audcom(av7110, AUDIO_CMD_STEREO); |
1233 | if (av7110->adac_type == DVB_ADAC_CRYSTAL) | 1268 | if (!ret) |
1234 | i2c_writereg(av7110, 0x20, 0x02, 0x49); | 1269 | if (av7110->adac_type == DVB_ADAC_CRYSTAL) |
1270 | i2c_writereg(av7110, 0x20, 0x02, 0x49); | ||
1235 | break; | 1271 | break; |
1236 | 1272 | ||
1237 | case AUDIO_MONO_LEFT: | 1273 | case AUDIO_MONO_LEFT: |
1238 | audcom(av7110, AUDIO_CMD_MONO_L); | 1274 | ret = audcom(av7110, AUDIO_CMD_MONO_L); |
1239 | if (av7110->adac_type == DVB_ADAC_CRYSTAL) | 1275 | if (!ret) |
1240 | i2c_writereg(av7110, 0x20, 0x02, 0x4a); | 1276 | if (av7110->adac_type == DVB_ADAC_CRYSTAL) |
1277 | i2c_writereg(av7110, 0x20, 0x02, 0x4a); | ||
1241 | break; | 1278 | break; |
1242 | 1279 | ||
1243 | case AUDIO_MONO_RIGHT: | 1280 | case AUDIO_MONO_RIGHT: |
1244 | audcom(av7110, AUDIO_CMD_MONO_R); | 1281 | ret = audcom(av7110, AUDIO_CMD_MONO_R); |
1245 | if (av7110->adac_type == DVB_ADAC_CRYSTAL) | 1282 | if (!ret) |
1246 | i2c_writereg(av7110, 0x20, 0x02, 0x45); | 1283 | if (av7110->adac_type == DVB_ADAC_CRYSTAL) |
1284 | i2c_writereg(av7110, 0x20, 0x02, 0x45); | ||
1247 | break; | 1285 | break; |
1248 | 1286 | ||
1249 | default: | 1287 | default: |
@@ -1264,8 +1302,8 @@ static int dvb_audio_ioctl(struct inode *inode, struct file *file, | |||
1264 | dvb_ringbuffer_flush_spinlock_wakeup(&av7110->aout); | 1302 | dvb_ringbuffer_flush_spinlock_wakeup(&av7110->aout); |
1265 | av7110_ipack_reset(&av7110->ipack[0]); | 1303 | av7110_ipack_reset(&av7110->ipack[0]); |
1266 | if (av7110->playing == RP_AV) | 1304 | if (av7110->playing == RP_AV) |
1267 | av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, | 1305 | ret = av7110_fw_cmd(av7110, COMTYPE_REC_PLAY, |
1268 | __Play, 2, AV_PES, 0); | 1306 | __Play, 2, AV_PES, 0); |
1269 | break; | 1307 | break; |
1270 | case AUDIO_SET_ID: | 1308 | case AUDIO_SET_ID: |
1271 | 1309 | ||
@@ -1274,7 +1312,7 @@ static int dvb_audio_ioctl(struct inode *inode, struct file *file, | |||
1274 | { | 1312 | { |
1275 | struct audio_mixer *amix = (struct audio_mixer *)parg; | 1313 | struct audio_mixer *amix = (struct audio_mixer *)parg; |
1276 | 1314 | ||
1277 | av7110_set_volume(av7110, amix->volume_left, amix->volume_right); | 1315 | ret = av7110_set_volume(av7110, amix->volume_left, amix->volume_right); |
1278 | break; | 1316 | break; |
1279 | } | 1317 | } |
1280 | case AUDIO_SET_STREAMTYPE: | 1318 | case AUDIO_SET_STREAMTYPE: |
diff --git a/drivers/media/dvb/ttpci/av7110_av.h b/drivers/media/dvb/ttpci/av7110_av.h index cc5e7a7e87c3..45dc144b8b43 100644 --- a/drivers/media/dvb/ttpci/av7110_av.h +++ b/drivers/media/dvb/ttpci/av7110_av.h | |||
@@ -3,14 +3,14 @@ | |||
3 | 3 | ||
4 | struct av7110; | 4 | struct av7110; |
5 | 5 | ||
6 | extern void av7110_set_vidmode(struct av7110 *av7110, int mode); | 6 | extern int av7110_set_vidmode(struct av7110 *av7110, int mode); |
7 | 7 | ||
8 | extern int av7110_record_cb(struct dvb_filter_pes2ts *p2t, u8 *buf, size_t len); | 8 | extern int av7110_record_cb(struct dvb_filter_pes2ts *p2t, u8 *buf, size_t len); |
9 | extern int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen); | 9 | extern int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen); |
10 | extern int av7110_write_to_decoder(struct dvb_demux_feed *feed, const u8 *buf, size_t len); | 10 | extern int av7110_write_to_decoder(struct dvb_demux_feed *feed, const u8 *buf, size_t len); |
11 | 11 | ||
12 | extern int av7110_set_volume(struct av7110 *av7110, int volleft, int volright); | 12 | extern int av7110_set_volume(struct av7110 *av7110, int volleft, int volright); |
13 | extern void av7110_av_stop(struct av7110 *av7110, int av); | 13 | extern int av7110_av_stop(struct av7110 *av7110, int av); |
14 | extern int av7110_av_start_record(struct av7110 *av7110, int av, | 14 | extern int av7110_av_start_record(struct av7110 *av7110, int av, |
15 | struct dvb_demux_feed *dvbdmxfeed); | 15 | struct dvb_demux_feed *dvbdmxfeed); |
16 | extern int av7110_av_start_play(struct av7110 *av7110, int av); | 16 | extern int av7110_av_start_play(struct av7110 *av7110, int av); |
diff --git a/drivers/media/dvb/ttpci/av7110_hw.c b/drivers/media/dvb/ttpci/av7110_hw.c index 7fa4a0ebe133..1220826696c5 100644 --- a/drivers/media/dvb/ttpci/av7110_hw.c +++ b/drivers/media/dvb/ttpci/av7110_hw.c | |||
@@ -137,7 +137,7 @@ static int waitdebi(struct av7110 *av7110, int adr, int state) | |||
137 | return 0; | 137 | return 0; |
138 | udelay(5); | 138 | udelay(5); |
139 | } | 139 | } |
140 | return -1; | 140 | return -ETIMEDOUT; |
141 | } | 141 | } |
142 | 142 | ||
143 | static int load_dram(struct av7110 *av7110, u32 *data, int len) | 143 | static int load_dram(struct av7110 *av7110, u32 *data, int len) |
@@ -155,7 +155,7 @@ static int load_dram(struct av7110 *av7110, u32 *data, int len) | |||
155 | for (i = 0; i < blocks; i++) { | 155 | for (i = 0; i < blocks; i++) { |
156 | if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { | 156 | if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { |
157 | printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at block %d\n", i); | 157 | printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at block %d\n", i); |
158 | return -1; | 158 | return -ETIMEDOUT; |
159 | } | 159 | } |
160 | dprintk(4, "writing DRAM block %d\n", i); | 160 | dprintk(4, "writing DRAM block %d\n", i); |
161 | mwdebi(av7110, DEBISWAB, bootblock, | 161 | mwdebi(av7110, DEBISWAB, bootblock, |
@@ -170,7 +170,7 @@ static int load_dram(struct av7110 *av7110, u32 *data, int len) | |||
170 | if (rest > 0) { | 170 | if (rest > 0) { |
171 | if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { | 171 | if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { |
172 | printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at last block\n"); | 172 | printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at last block\n"); |
173 | return -1; | 173 | return -ETIMEDOUT; |
174 | } | 174 | } |
175 | if (rest > 4) | 175 | if (rest > 4) |
176 | mwdebi(av7110, DEBISWAB, bootblock, | 176 | mwdebi(av7110, DEBISWAB, bootblock, |
@@ -185,13 +185,13 @@ static int load_dram(struct av7110 *av7110, u32 *data, int len) | |||
185 | } | 185 | } |
186 | if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { | 186 | if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { |
187 | printk(KERN_ERR "dvb-ttpci: load_dram(): timeout after last block\n"); | 187 | printk(KERN_ERR "dvb-ttpci: load_dram(): timeout after last block\n"); |
188 | return -1; | 188 | return -ETIMEDOUT; |
189 | } | 189 | } |
190 | iwdebi(av7110, DEBINOSWAP, BOOT_SIZE, 0, 2); | 190 | iwdebi(av7110, DEBINOSWAP, BOOT_SIZE, 0, 2); |
191 | iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); | 191 | iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); |
192 | if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BOOT_COMPLETE) < 0) { | 192 | if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BOOT_COMPLETE) < 0) { |
193 | printk(KERN_ERR "dvb-ttpci: load_dram(): final handshake timeout\n"); | 193 | printk(KERN_ERR "dvb-ttpci: load_dram(): final handshake timeout\n"); |
194 | return -1; | 194 | return -ETIMEDOUT; |
195 | } | 195 | } |
196 | return 0; | 196 | return 0; |
197 | } | 197 | } |
@@ -263,7 +263,7 @@ int av7110_bootarm(struct av7110 *av7110) | |||
263 | if (saa7146_wait_for_debi_done(av7110->dev, 1)) { | 263 | if (saa7146_wait_for_debi_done(av7110->dev, 1)) { |
264 | printk(KERN_ERR "dvb-ttpci: av7110_bootarm(): " | 264 | printk(KERN_ERR "dvb-ttpci: av7110_bootarm(): " |
265 | "saa7146_wait_for_debi_done() timed out\n"); | 265 | "saa7146_wait_for_debi_done() timed out\n"); |
266 | return -1; | 266 | return -ETIMEDOUT; |
267 | } | 267 | } |
268 | saa7146_setgpio(dev, RESET_LINE, SAA7146_GPIO_OUTHI); | 268 | saa7146_setgpio(dev, RESET_LINE, SAA7146_GPIO_OUTHI); |
269 | mdelay(1); | 269 | mdelay(1); |
@@ -284,7 +284,7 @@ int av7110_bootarm(struct av7110 *av7110) | |||
284 | if (saa7146_wait_for_debi_done(av7110->dev, 1)) { | 284 | if (saa7146_wait_for_debi_done(av7110->dev, 1)) { |
285 | printk(KERN_ERR "dvb-ttpci: av7110_bootarm(): " | 285 | printk(KERN_ERR "dvb-ttpci: av7110_bootarm(): " |
286 | "saa7146_wait_for_debi_done() timed out after loading DRAM\n"); | 286 | "saa7146_wait_for_debi_done() timed out after loading DRAM\n"); |
287 | return -1; | 287 | return -ETIMEDOUT; |
288 | } | 288 | } |
289 | saa7146_setgpio(dev, RESET_LINE, SAA7146_GPIO_OUTHI); | 289 | saa7146_setgpio(dev, RESET_LINE, SAA7146_GPIO_OUTHI); |
290 | msleep(30); /* the firmware needs some time to initialize */ | 290 | msleep(30); /* the firmware needs some time to initialize */ |
@@ -308,6 +308,7 @@ int av7110_wait_msgstate(struct av7110 *av7110, u16 flags) | |||
308 | { | 308 | { |
309 | unsigned long start; | 309 | unsigned long start; |
310 | u32 stat; | 310 | u32 stat; |
311 | int err; | ||
311 | 312 | ||
312 | if (FW_VERSION(av7110->arm_app) <= 0x261c) { | 313 | if (FW_VERSION(av7110->arm_app) <= 0x261c) { |
313 | /* not supported by old firmware */ | 314 | /* not supported by old firmware */ |
@@ -318,17 +319,17 @@ int av7110_wait_msgstate(struct av7110 *av7110, u16 flags) | |||
318 | /* new firmware */ | 319 | /* new firmware */ |
319 | start = jiffies; | 320 | start = jiffies; |
320 | for (;;) { | 321 | for (;;) { |
322 | err = time_after(jiffies, start + ARM_WAIT_FREE); | ||
321 | if (down_interruptible(&av7110->dcomlock)) | 323 | if (down_interruptible(&av7110->dcomlock)) |
322 | return -ERESTARTSYS; | 324 | return -ERESTARTSYS; |
323 | stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); | 325 | stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); |
324 | up(&av7110->dcomlock); | 326 | up(&av7110->dcomlock); |
325 | if ((stat & flags) == 0) { | 327 | if ((stat & flags) == 0) |
326 | break; | 328 | break; |
327 | } | 329 | if (err) { |
328 | if (time_after(jiffies, start + ARM_WAIT_FREE)) { | ||
329 | printk(KERN_ERR "%s: timeout waiting for MSGSTATE %04x\n", | 330 | printk(KERN_ERR "%s: timeout waiting for MSGSTATE %04x\n", |
330 | __FUNCTION__, stat & flags); | 331 | __FUNCTION__, stat & flags); |
331 | return -1; | 332 | return -ETIMEDOUT; |
332 | } | 333 | } |
333 | msleep(1); | 334 | msleep(1); |
334 | } | 335 | } |
@@ -342,6 +343,7 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
342 | char *type = NULL; | 343 | char *type = NULL; |
343 | u16 flags[2] = {0, 0}; | 344 | u16 flags[2] = {0, 0}; |
344 | u32 stat; | 345 | u32 stat; |
346 | int err; | ||
345 | 347 | ||
346 | // dprintk(4, "%p\n", av7110); | 348 | // dprintk(4, "%p\n", av7110); |
347 | 349 | ||
@@ -351,24 +353,30 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
351 | } | 353 | } |
352 | 354 | ||
353 | start = jiffies; | 355 | start = jiffies; |
354 | while (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2 )) { | 356 | while (1) { |
355 | msleep(1); | 357 | err = time_after(jiffies, start + ARM_WAIT_FREE); |
356 | if (time_after(jiffies, start + ARM_WAIT_FREE)) { | 358 | if (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2) == 0) |
359 | break; | ||
360 | if (err) { | ||
357 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for COMMAND idle\n", __FUNCTION__); | 361 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for COMMAND idle\n", __FUNCTION__); |
358 | return -ETIMEDOUT; | 362 | return -ETIMEDOUT; |
359 | } | 363 | } |
364 | msleep(1); | ||
360 | } | 365 | } |
361 | 366 | ||
362 | wdebi(av7110, DEBINOSWAP, COM_IF_LOCK, 0xffff, 2); | 367 | wdebi(av7110, DEBINOSWAP, COM_IF_LOCK, 0xffff, 2); |
363 | 368 | ||
364 | #ifndef _NOHANDSHAKE | 369 | #ifndef _NOHANDSHAKE |
365 | start = jiffies; | 370 | start = jiffies; |
366 | while (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2 )) { | 371 | while (1) { |
367 | msleep(1); | 372 | err = time_after(jiffies, start + ARM_WAIT_SHAKE); |
368 | if (time_after(jiffies, start + ARM_WAIT_SHAKE)) { | 373 | if (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2) == 0) |
374 | break; | ||
375 | if (err) { | ||
369 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for HANDSHAKE_REG\n", __FUNCTION__); | 376 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for HANDSHAKE_REG\n", __FUNCTION__); |
370 | return -ETIMEDOUT; | 377 | return -ETIMEDOUT; |
371 | } | 378 | } |
379 | msleep(1); | ||
372 | } | 380 | } |
373 | #endif | 381 | #endif |
374 | 382 | ||
@@ -401,6 +409,7 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
401 | /* non-immediate COMMAND type */ | 409 | /* non-immediate COMMAND type */ |
402 | start = jiffies; | 410 | start = jiffies; |
403 | for (;;) { | 411 | for (;;) { |
412 | err = time_after(jiffies, start + ARM_WAIT_FREE); | ||
404 | stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); | 413 | stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); |
405 | if (stat & flags[0]) { | 414 | if (stat & flags[0]) { |
406 | printk(KERN_ERR "%s: %s QUEUE overflow\n", | 415 | printk(KERN_ERR "%s: %s QUEUE overflow\n", |
@@ -409,10 +418,10 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
409 | } | 418 | } |
410 | if ((stat & flags[1]) == 0) | 419 | if ((stat & flags[1]) == 0) |
411 | break; | 420 | break; |
412 | if (time_after(jiffies, start + ARM_WAIT_FREE)) { | 421 | if (err) { |
413 | printk(KERN_ERR "%s: timeout waiting on busy %s QUEUE\n", | 422 | printk(KERN_ERR "%s: timeout waiting on busy %s QUEUE\n", |
414 | __FUNCTION__, type); | 423 | __FUNCTION__, type); |
415 | return -1; | 424 | return -ETIMEDOUT; |
416 | } | 425 | } |
417 | msleep(1); | 426 | msleep(1); |
418 | } | 427 | } |
@@ -432,13 +441,16 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
432 | 441 | ||
433 | #ifdef COM_DEBUG | 442 | #ifdef COM_DEBUG |
434 | start = jiffies; | 443 | start = jiffies; |
435 | while (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2 )) { | 444 | while (1) { |
436 | msleep(1); | 445 | err = time_after(jiffies, start + ARM_WAIT_FREE); |
437 | if (time_after(jiffies, start + ARM_WAIT_FREE)) { | 446 | if (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2) == 0) |
438 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for COMMAND to complete\n", | 447 | break; |
439 | __FUNCTION__); | 448 | if (err) { |
449 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for COMMAND %d to complete\n", | ||
450 | __FUNCTION__, (buf[0] >> 8) & 0xff); | ||
440 | return -ETIMEDOUT; | 451 | return -ETIMEDOUT; |
441 | } | 452 | } |
453 | msleep(1); | ||
442 | } | 454 | } |
443 | 455 | ||
444 | stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); | 456 | stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); |
@@ -470,7 +482,7 @@ static int av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
470 | 482 | ||
471 | ret = __av7110_send_fw_cmd(av7110, buf, length); | 483 | ret = __av7110_send_fw_cmd(av7110, buf, length); |
472 | up(&av7110->dcomlock); | 484 | up(&av7110->dcomlock); |
473 | if (ret) | 485 | if (ret && ret!=-ERESTARTSYS) |
474 | printk(KERN_ERR "dvb-ttpci: %s(): av7110_send_fw_cmd error %d\n", | 486 | printk(KERN_ERR "dvb-ttpci: %s(): av7110_send_fw_cmd error %d\n", |
475 | __FUNCTION__, ret); | 487 | __FUNCTION__, ret); |
476 | return ret; | 488 | return ret; |
@@ -495,7 +507,7 @@ int av7110_fw_cmd(struct av7110 *av7110, int type, int com, int num, ...) | |||
495 | } | 507 | } |
496 | 508 | ||
497 | ret = av7110_send_fw_cmd(av7110, buf, num + 2); | 509 | ret = av7110_send_fw_cmd(av7110, buf, num + 2); |
498 | if (ret) | 510 | if (ret && ret != -ERESTARTSYS) |
499 | printk(KERN_ERR "dvb-ttpci: av7110_fw_cmd error %d\n", ret); | 511 | printk(KERN_ERR "dvb-ttpci: av7110_fw_cmd error %d\n", ret); |
500 | return ret; | 512 | return ret; |
501 | } | 513 | } |
@@ -518,7 +530,7 @@ int av7110_send_ci_cmd(struct av7110 *av7110, u8 subcom, u8 *buf, u8 len) | |||
518 | } | 530 | } |
519 | 531 | ||
520 | ret = av7110_send_fw_cmd(av7110, cmd, 18); | 532 | ret = av7110_send_fw_cmd(av7110, cmd, 18); |
521 | if (ret) | 533 | if (ret && ret != -ERESTARTSYS) |
522 | printk(KERN_ERR "dvb-ttpci: av7110_send_ci_cmd error %d\n", ret); | 534 | printk(KERN_ERR "dvb-ttpci: av7110_send_ci_cmd error %d\n", ret); |
523 | return ret; | 535 | return ret; |
524 | } | 536 | } |
@@ -551,26 +563,32 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf, | |||
551 | } | 563 | } |
552 | 564 | ||
553 | start = jiffies; | 565 | start = jiffies; |
554 | while (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2)) { | 566 | while (1) { |
555 | #ifdef _NOHANDSHAKE | 567 | err = time_after(jiffies, start + ARM_WAIT_FREE); |
556 | msleep(1); | 568 | if (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2) == 0) |
557 | #endif | 569 | break; |
558 | if (time_after(jiffies, start + ARM_WAIT_FREE)) { | 570 | if (err) { |
559 | printk(KERN_ERR "%s: timeout waiting for COMMAND to complete\n", __FUNCTION__); | 571 | printk(KERN_ERR "%s: timeout waiting for COMMAND to complete\n", __FUNCTION__); |
560 | up(&av7110->dcomlock); | 572 | up(&av7110->dcomlock); |
561 | return -1; | 573 | return -ETIMEDOUT; |
562 | } | 574 | } |
575 | #ifdef _NOHANDSHAKE | ||
576 | msleep(1); | ||
577 | #endif | ||
563 | } | 578 | } |
564 | 579 | ||
565 | #ifndef _NOHANDSHAKE | 580 | #ifndef _NOHANDSHAKE |
566 | start = jiffies; | 581 | start = jiffies; |
567 | while (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2 )) { | 582 | while (1) { |
568 | msleep(1); | 583 | err = time_after(jiffies, start + ARM_WAIT_SHAKE); |
569 | if (time_after(jiffies, start + ARM_WAIT_SHAKE)) { | 584 | if (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2) == 0) |
585 | break; | ||
586 | if (err) { | ||
570 | printk(KERN_ERR "%s: timeout waiting for HANDSHAKE_REG\n", __FUNCTION__); | 587 | printk(KERN_ERR "%s: timeout waiting for HANDSHAKE_REG\n", __FUNCTION__); |
571 | up(&av7110->dcomlock); | 588 | up(&av7110->dcomlock); |
572 | return -1; | 589 | return -ETIMEDOUT; |
573 | } | 590 | } |
591 | msleep(1); | ||
574 | } | 592 | } |
575 | #endif | 593 | #endif |
576 | 594 | ||
@@ -667,10 +685,10 @@ int av7110_diseqc_send(struct av7110 *av7110, int len, u8 *msg, unsigned long bu | |||
667 | for (i = 0; i < len; i++) | 685 | for (i = 0; i < len; i++) |
668 | buf[i + 4] = msg[i]; | 686 | buf[i + 4] = msg[i]; |
669 | 687 | ||
670 | if ((ret = av7110_send_fw_cmd(av7110, buf, 18))) | 688 | ret = av7110_send_fw_cmd(av7110, buf, 18); |
689 | if (ret && ret!=-ERESTARTSYS) | ||
671 | printk(KERN_ERR "dvb-ttpci: av7110_diseqc_send error %d\n", ret); | 690 | printk(KERN_ERR "dvb-ttpci: av7110_diseqc_send error %d\n", ret); |
672 | 691 | return ret; | |
673 | return 0; | ||
674 | } | 692 | } |
675 | 693 | ||
676 | 694 | ||
@@ -705,18 +723,22 @@ static inline int SetFont(struct av7110 *av7110, u8 windownr, u8 fontsize, | |||
705 | static int FlushText(struct av7110 *av7110) | 723 | static int FlushText(struct av7110 *av7110) |
706 | { | 724 | { |
707 | unsigned long start; | 725 | unsigned long start; |
726 | int err; | ||
708 | 727 | ||
709 | if (down_interruptible(&av7110->dcomlock)) | 728 | if (down_interruptible(&av7110->dcomlock)) |
710 | return -ERESTARTSYS; | 729 | return -ERESTARTSYS; |
711 | start = jiffies; | 730 | start = jiffies; |
712 | while (rdebi(av7110, DEBINOSWAP, BUFF1_BASE, 0, 2)) { | 731 | while (1) { |
713 | msleep(1); | 732 | err = time_after(jiffies, start + ARM_WAIT_OSD); |
714 | if (time_after(jiffies, start + ARM_WAIT_OSD)) { | 733 | if (rdebi(av7110, DEBINOSWAP, BUFF1_BASE, 0, 2) == 0) |
734 | break; | ||
735 | if (err) { | ||
715 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for BUFF1_BASE == 0\n", | 736 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for BUFF1_BASE == 0\n", |
716 | __FUNCTION__); | 737 | __FUNCTION__); |
717 | up(&av7110->dcomlock); | 738 | up(&av7110->dcomlock); |
718 | return -1; | 739 | return -ETIMEDOUT; |
719 | } | 740 | } |
741 | msleep(1); | ||
720 | } | 742 | } |
721 | up(&av7110->dcomlock); | 743 | up(&av7110->dcomlock); |
722 | return 0; | 744 | return 0; |
@@ -733,25 +755,31 @@ static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, u8* buf) | |||
733 | return -ERESTARTSYS; | 755 | return -ERESTARTSYS; |
734 | 756 | ||
735 | start = jiffies; | 757 | start = jiffies; |
736 | while (rdebi(av7110, DEBINOSWAP, BUFF1_BASE, 0, 2)) { | 758 | while (1) { |
737 | msleep(1); | 759 | ret = time_after(jiffies, start + ARM_WAIT_OSD); |
738 | if (time_after(jiffies, start + ARM_WAIT_OSD)) { | 760 | if (rdebi(av7110, DEBINOSWAP, BUFF1_BASE, 0, 2) == 0) |
761 | break; | ||
762 | if (ret) { | ||
739 | printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for BUFF1_BASE == 0\n", | 763 | printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for BUFF1_BASE == 0\n", |
740 | __FUNCTION__); | 764 | __FUNCTION__); |
741 | up(&av7110->dcomlock); | 765 | up(&av7110->dcomlock); |
742 | return -1; | 766 | return -ETIMEDOUT; |
743 | } | 767 | } |
768 | msleep(1); | ||
744 | } | 769 | } |
745 | #ifndef _NOHANDSHAKE | 770 | #ifndef _NOHANDSHAKE |
746 | start = jiffies; | 771 | start = jiffies; |
747 | while (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2)) { | 772 | while (1) { |
748 | msleep(1); | 773 | ret = time_after(jiffies, start + ARM_WAIT_SHAKE); |
749 | if (time_after(jiffies, start + ARM_WAIT_SHAKE)) { | 774 | if (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2) == 0) |
775 | break; | ||
776 | if (ret) { | ||
750 | printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for HANDSHAKE_REG\n", | 777 | printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for HANDSHAKE_REG\n", |
751 | __FUNCTION__); | 778 | __FUNCTION__); |
752 | up(&av7110->dcomlock); | 779 | up(&av7110->dcomlock); |
753 | return -1; | 780 | return -ETIMEDOUT; |
754 | } | 781 | } |
782 | msleep(1); | ||
755 | } | 783 | } |
756 | #endif | 784 | #endif |
757 | for (i = 0; i < length / 2; i++) | 785 | for (i = 0; i < length / 2; i++) |
@@ -761,7 +789,7 @@ static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, u8* buf) | |||
761 | wdebi(av7110, DEBINOSWAP, BUFF1_BASE + i * 2, 0, 2); | 789 | wdebi(av7110, DEBINOSWAP, BUFF1_BASE + i * 2, 0, 2); |
762 | ret = __av7110_send_fw_cmd(av7110, cbuf, 5); | 790 | ret = __av7110_send_fw_cmd(av7110, cbuf, 5); |
763 | up(&av7110->dcomlock); | 791 | up(&av7110->dcomlock); |
764 | if (ret) | 792 | if (ret && ret!=-ERESTARTSYS) |
765 | printk(KERN_ERR "dvb-ttpci: WriteText error %d\n", ret); | 793 | printk(KERN_ERR "dvb-ttpci: WriteText error %d\n", ret); |
766 | return ret; | 794 | return ret; |
767 | } | 795 | } |
@@ -816,9 +844,25 @@ static osd_raw_window_t bpp2bit[8] = { | |||
816 | OSD_BITMAP1, OSD_BITMAP2, 0, OSD_BITMAP4, 0, 0, 0, OSD_BITMAP8 | 844 | OSD_BITMAP1, OSD_BITMAP2, 0, OSD_BITMAP4, 0, 0, 0, OSD_BITMAP8 |
817 | }; | 845 | }; |
818 | 846 | ||
819 | static inline int LoadBitmap(struct av7110 *av7110, u16 format, | 847 | static inline int WaitUntilBmpLoaded(struct av7110 *av7110) |
848 | { | ||
849 | int ret = wait_event_interruptible_timeout(av7110->bmpq, | ||
850 | av7110->bmp_state != BMP_LOADING, 10*HZ); | ||
851 | if (ret == -ERESTARTSYS) | ||
852 | return ret; | ||
853 | if (ret == 0) { | ||
854 | printk("dvb-ttpci: warning: timeout waiting in LoadBitmap: %d, %d\n", | ||
855 | ret, av7110->bmp_state); | ||
856 | av7110->bmp_state = BMP_NONE; | ||
857 | return -ETIMEDOUT; | ||
858 | } | ||
859 | return 0; | ||
860 | } | ||
861 | |||
862 | static inline int LoadBitmap(struct av7110 *av7110, | ||
820 | u16 dx, u16 dy, int inc, u8 __user * data) | 863 | u16 dx, u16 dy, int inc, u8 __user * data) |
821 | { | 864 | { |
865 | u16 format; | ||
822 | int bpp; | 866 | int bpp; |
823 | int i; | 867 | int i; |
824 | int d, delta; | 868 | int d, delta; |
@@ -827,14 +871,7 @@ static inline int LoadBitmap(struct av7110 *av7110, u16 format, | |||
827 | 871 | ||
828 | dprintk(4, "%p\n", av7110); | 872 | dprintk(4, "%p\n", av7110); |
829 | 873 | ||
830 | ret = wait_event_interruptible_timeout(av7110->bmpq, av7110->bmp_state != BMP_LOADING, HZ); | 874 | format = bpp2bit[av7110->osdbpp[av7110->osdwin]]; |
831 | if (ret == -ERESTARTSYS || ret == 0) { | ||
832 | printk("dvb-ttpci: warning: timeout waiting in LoadBitmap: %d, %d\n", | ||
833 | ret, av7110->bmp_state); | ||
834 | av7110->bmp_state = BMP_NONE; | ||
835 | return -1; | ||
836 | } | ||
837 | BUG_ON (av7110->bmp_state == BMP_LOADING); | ||
838 | 875 | ||
839 | av7110->bmp_state = BMP_LOADING; | 876 | av7110->bmp_state = BMP_LOADING; |
840 | if (format == OSD_BITMAP8) { | 877 | if (format == OSD_BITMAP8) { |
@@ -847,18 +884,18 @@ static inline int LoadBitmap(struct av7110 *av7110, u16 format, | |||
847 | bpp=1; delta = 8; | 884 | bpp=1; delta = 8; |
848 | } else { | 885 | } else { |
849 | av7110->bmp_state = BMP_NONE; | 886 | av7110->bmp_state = BMP_NONE; |
850 | return -1; | 887 | return -EINVAL; |
851 | } | 888 | } |
852 | av7110->bmplen = ((dx * dy * bpp + 7) & ~7) / 8; | 889 | av7110->bmplen = ((dx * dy * bpp + 7) & ~7) / 8; |
853 | av7110->bmpp = 0; | 890 | av7110->bmpp = 0; |
854 | if (av7110->bmplen > 32768) { | 891 | if (av7110->bmplen > 32768) { |
855 | av7110->bmp_state = BMP_NONE; | 892 | av7110->bmp_state = BMP_NONE; |
856 | return -1; | 893 | return -EINVAL; |
857 | } | 894 | } |
858 | for (i = 0; i < dy; i++) { | 895 | for (i = 0; i < dy; i++) { |
859 | if (copy_from_user(av7110->bmpbuf + 1024 + i * dx, data + i * inc, dx)) { | 896 | if (copy_from_user(av7110->bmpbuf + 1024 + i * dx, data + i * inc, dx)) { |
860 | av7110->bmp_state = BMP_NONE; | 897 | av7110->bmp_state = BMP_NONE; |
861 | return -1; | 898 | return -EINVAL; |
862 | } | 899 | } |
863 | } | 900 | } |
864 | if (format != OSD_BITMAP8) { | 901 | if (format != OSD_BITMAP8) { |
@@ -873,37 +910,27 @@ static inline int LoadBitmap(struct av7110 *av7110, u16 format, | |||
873 | } | 910 | } |
874 | av7110->bmplen += 1024; | 911 | av7110->bmplen += 1024; |
875 | dprintk(4, "av7110_fw_cmd: LoadBmp size %d\n", av7110->bmplen); | 912 | dprintk(4, "av7110_fw_cmd: LoadBmp size %d\n", av7110->bmplen); |
876 | return av7110_fw_cmd(av7110, COMTYPE_OSD, LoadBmp, 3, format, dx, dy); | 913 | ret = av7110_fw_cmd(av7110, COMTYPE_OSD, LoadBmp, 3, format, dx, dy); |
914 | if (!ret) | ||
915 | ret = WaitUntilBmpLoaded(av7110); | ||
916 | return ret; | ||
877 | } | 917 | } |
878 | 918 | ||
879 | static int BlitBitmap(struct av7110 *av7110, u16 win, u16 x, u16 y, u16 trans) | 919 | static int BlitBitmap(struct av7110 *av7110, u16 x, u16 y) |
880 | { | 920 | { |
881 | int ret; | ||
882 | |||
883 | dprintk(4, "%p\n", av7110); | 921 | dprintk(4, "%p\n", av7110); |
884 | 922 | ||
885 | BUG_ON (av7110->bmp_state == BMP_NONE); | 923 | return av7110_fw_cmd(av7110, COMTYPE_OSD, BlitBmp, 4, av7110->osdwin, x, y, 0); |
886 | |||
887 | ret = wait_event_interruptible_timeout(av7110->bmpq, | ||
888 | av7110->bmp_state != BMP_LOADING, 10*HZ); | ||
889 | if (ret == -ERESTARTSYS || ret == 0) { | ||
890 | printk("dvb-ttpci: warning: timeout waiting in BlitBitmap: %d, %d\n", | ||
891 | ret, av7110->bmp_state); | ||
892 | av7110->bmp_state = BMP_NONE; | ||
893 | return (ret == 0) ? -ETIMEDOUT : ret; | ||
894 | } | ||
895 | |||
896 | BUG_ON (av7110->bmp_state != BMP_LOADED); | ||
897 | |||
898 | return av7110_fw_cmd(av7110, COMTYPE_OSD, BlitBmp, 4, win, x, y, trans); | ||
899 | } | 924 | } |
900 | 925 | ||
901 | static inline int ReleaseBitmap(struct av7110 *av7110) | 926 | static inline int ReleaseBitmap(struct av7110 *av7110) |
902 | { | 927 | { |
903 | dprintk(4, "%p\n", av7110); | 928 | dprintk(4, "%p\n", av7110); |
904 | 929 | ||
905 | if (av7110->bmp_state != BMP_LOADED) | 930 | if (av7110->bmp_state != BMP_LOADED && FW_VERSION(av7110->arm_app) < 0x261e) |
906 | return -1; | 931 | return -1; |
932 | if (av7110->bmp_state == BMP_LOADING) | ||
933 | dprintk(1,"ReleaseBitmap called while BMP_LOADING\n"); | ||
907 | av7110->bmp_state = BMP_NONE; | 934 | av7110->bmp_state = BMP_NONE; |
908 | return av7110_fw_cmd(av7110, COMTYPE_OSD, ReleaseBmp, 0); | 935 | return av7110_fw_cmd(av7110, COMTYPE_OSD, ReleaseBmp, 0); |
909 | } | 936 | } |
@@ -924,18 +951,22 @@ static u32 RGB2YUV(u16 R, u16 G, u16 B) | |||
924 | return Cr | (Cb << 16) | (Y << 8); | 951 | return Cr | (Cb << 16) | (Y << 8); |
925 | } | 952 | } |
926 | 953 | ||
927 | static void OSDSetColor(struct av7110 *av7110, u8 color, u8 r, u8 g, u8 b, u8 blend) | 954 | static int OSDSetColor(struct av7110 *av7110, u8 color, u8 r, u8 g, u8 b, u8 blend) |
928 | { | 955 | { |
956 | int ret; | ||
957 | |||
929 | u16 ch, cl; | 958 | u16 ch, cl; |
930 | u32 yuv; | 959 | u32 yuv; |
931 | 960 | ||
932 | yuv = blend ? RGB2YUV(r,g,b) : 0; | 961 | yuv = blend ? RGB2YUV(r,g,b) : 0; |
933 | cl = (yuv & 0xffff); | 962 | cl = (yuv & 0xffff); |
934 | ch = ((yuv >> 16) & 0xffff); | 963 | ch = ((yuv >> 16) & 0xffff); |
935 | SetColor_(av7110, av7110->osdwin, bpp2pal[av7110->osdbpp[av7110->osdwin]], | 964 | ret = SetColor_(av7110, av7110->osdwin, bpp2pal[av7110->osdbpp[av7110->osdwin]], |
936 | color, ch, cl); | 965 | color, ch, cl); |
937 | SetBlend_(av7110, av7110->osdwin, bpp2pal[av7110->osdbpp[av7110->osdwin]], | 966 | if (!ret) |
938 | color, ((blend >> 4) & 0x0f)); | 967 | ret = SetBlend_(av7110, av7110->osdwin, bpp2pal[av7110->osdbpp[av7110->osdwin]], |
968 | color, ((blend >> 4) & 0x0f)); | ||
969 | return ret; | ||
939 | } | 970 | } |
940 | 971 | ||
941 | static int OSDSetPalette(struct av7110 *av7110, u32 __user * colors, u8 first, u8 last) | 972 | static int OSDSetPalette(struct av7110 *av7110, u32 __user * colors, u8 first, u8 last) |
@@ -968,14 +999,14 @@ static int OSDSetBlock(struct av7110 *av7110, int x0, int y0, | |||
968 | { | 999 | { |
969 | uint w, h, bpp, bpl, size, lpb, bnum, brest; | 1000 | uint w, h, bpp, bpl, size, lpb, bnum, brest; |
970 | int i; | 1001 | int i; |
971 | int rc; | 1002 | int rc,release_rc; |
972 | 1003 | ||
973 | w = x1 - x0 + 1; | 1004 | w = x1 - x0 + 1; |
974 | h = y1 - y0 + 1; | 1005 | h = y1 - y0 + 1; |
975 | if (inc <= 0) | 1006 | if (inc <= 0) |
976 | inc = w; | 1007 | inc = w; |
977 | if (w <= 0 || w > 720 || h <= 0 || h > 576) | 1008 | if (w <= 0 || w > 720 || h <= 0 || h > 576) |
978 | return -1; | 1009 | return -EINVAL; |
979 | bpp = av7110->osdbpp[av7110->osdwin] + 1; | 1010 | bpp = av7110->osdbpp[av7110->osdwin] + 1; |
980 | bpl = ((w * bpp + 7) & ~7) / 8; | 1011 | bpl = ((w * bpp + 7) & ~7) / 8; |
981 | size = h * bpl; | 1012 | size = h * bpl; |
@@ -983,176 +1014,186 @@ static int OSDSetBlock(struct av7110 *av7110, int x0, int y0, | |||
983 | bnum = size / (lpb * bpl); | 1014 | bnum = size / (lpb * bpl); |
984 | brest = size - bnum * lpb * bpl; | 1015 | brest = size - bnum * lpb * bpl; |
985 | 1016 | ||
986 | for (i = 0; i < bnum; i++) { | 1017 | if (av7110->bmp_state == BMP_LOADING) { |
987 | rc = LoadBitmap(av7110, bpp2bit[av7110->osdbpp[av7110->osdwin]], | 1018 | /* possible if syscall is repeated by -ERESTARTSYS and if firmware cannot abort */ |
988 | w, lpb, inc, data); | 1019 | BUG_ON (FW_VERSION(av7110->arm_app) >= 0x261e); |
989 | if (rc) | 1020 | rc = WaitUntilBmpLoaded(av7110); |
990 | return rc; | ||
991 | rc = BlitBitmap(av7110, av7110->osdwin, x0, y0 + i * lpb, 0); | ||
992 | if (rc) | 1021 | if (rc) |
993 | return rc; | 1022 | return rc; |
994 | data += lpb * inc; | 1023 | /* just continue. This should work for all fw versions |
1024 | * if bnum==1 && !brest && LoadBitmap was successful | ||
1025 | */ | ||
995 | } | 1026 | } |
996 | if (brest) { | 1027 | |
997 | rc = LoadBitmap(av7110, bpp2bit[av7110->osdbpp[av7110->osdwin]], | 1028 | rc = 0; |
998 | w, brest / bpl, inc, data); | 1029 | for (i = 0; i < bnum; i++) { |
1030 | rc = LoadBitmap(av7110, w, lpb, inc, data); | ||
999 | if (rc) | 1031 | if (rc) |
1000 | return rc; | 1032 | break; |
1001 | rc = BlitBitmap(av7110, av7110->osdwin, x0, y0 + bnum * lpb, 0); | 1033 | rc = BlitBitmap(av7110, x0, y0 + i * lpb); |
1002 | if (rc) | 1034 | if (rc) |
1003 | return rc; | 1035 | break; |
1036 | data += lpb * inc; | ||
1004 | } | 1037 | } |
1005 | ReleaseBitmap(av7110); | 1038 | if (!rc && brest) { |
1006 | return 0; | 1039 | rc = LoadBitmap(av7110, w, brest / bpl, inc, data); |
1040 | if (!rc) | ||
1041 | rc = BlitBitmap(av7110, x0, y0 + bnum * lpb); | ||
1042 | } | ||
1043 | release_rc = ReleaseBitmap(av7110); | ||
1044 | if (!rc) | ||
1045 | rc = release_rc; | ||
1046 | if (rc) | ||
1047 | dprintk(1,"returns %d\n",rc); | ||
1048 | return rc; | ||
1007 | } | 1049 | } |
1008 | 1050 | ||
1009 | int av7110_osd_cmd(struct av7110 *av7110, osd_cmd_t *dc) | 1051 | int av7110_osd_cmd(struct av7110 *av7110, osd_cmd_t *dc) |
1010 | { | 1052 | { |
1011 | int ret; | 1053 | int ret; |
1012 | 1054 | ||
1013 | ret = down_interruptible(&av7110->osd_sema); | 1055 | if (down_interruptible(&av7110->osd_sema)) |
1014 | if (ret) | ||
1015 | return -ERESTARTSYS; | 1056 | return -ERESTARTSYS; |
1016 | 1057 | ||
1017 | /* stupid, but OSD functions don't provide a return code anyway */ | ||
1018 | ret = 0; | ||
1019 | |||
1020 | switch (dc->cmd) { | 1058 | switch (dc->cmd) { |
1021 | case OSD_Close: | 1059 | case OSD_Close: |
1022 | DestroyOSDWindow(av7110, av7110->osdwin); | 1060 | ret = DestroyOSDWindow(av7110, av7110->osdwin); |
1023 | goto out; | 1061 | break; |
1024 | case OSD_Open: | 1062 | case OSD_Open: |
1025 | av7110->osdbpp[av7110->osdwin] = (dc->color - 1) & 7; | 1063 | av7110->osdbpp[av7110->osdwin] = (dc->color - 1) & 7; |
1026 | CreateOSDWindow(av7110, av7110->osdwin, | 1064 | ret = CreateOSDWindow(av7110, av7110->osdwin, |
1027 | bpp2bit[av7110->osdbpp[av7110->osdwin]], | 1065 | bpp2bit[av7110->osdbpp[av7110->osdwin]], |
1028 | dc->x1 - dc->x0 + 1, dc->y1 - dc->y0 + 1); | 1066 | dc->x1 - dc->x0 + 1, dc->y1 - dc->y0 + 1); |
1067 | if (ret) | ||
1068 | break; | ||
1029 | if (!dc->data) { | 1069 | if (!dc->data) { |
1030 | MoveWindowAbs(av7110, av7110->osdwin, dc->x0, dc->y0); | 1070 | ret = MoveWindowAbs(av7110, av7110->osdwin, dc->x0, dc->y0); |
1031 | SetColorBlend(av7110, av7110->osdwin); | 1071 | if (ret) |
1072 | break; | ||
1073 | ret = SetColorBlend(av7110, av7110->osdwin); | ||
1032 | } | 1074 | } |
1033 | goto out; | 1075 | break; |
1034 | case OSD_Show: | 1076 | case OSD_Show: |
1035 | MoveWindowRel(av7110, av7110->osdwin, 0, 0); | 1077 | ret = MoveWindowRel(av7110, av7110->osdwin, 0, 0); |
1036 | goto out; | 1078 | break; |
1037 | case OSD_Hide: | 1079 | case OSD_Hide: |
1038 | HideWindow(av7110, av7110->osdwin); | 1080 | ret = HideWindow(av7110, av7110->osdwin); |
1039 | goto out; | 1081 | break; |
1040 | case OSD_Clear: | 1082 | case OSD_Clear: |
1041 | DrawBlock(av7110, av7110->osdwin, 0, 0, 720, 576, 0); | 1083 | ret = DrawBlock(av7110, av7110->osdwin, 0, 0, 720, 576, 0); |
1042 | goto out; | 1084 | break; |
1043 | case OSD_Fill: | 1085 | case OSD_Fill: |
1044 | DrawBlock(av7110, av7110->osdwin, 0, 0, 720, 576, dc->color); | 1086 | ret = DrawBlock(av7110, av7110->osdwin, 0, 0, 720, 576, dc->color); |
1045 | goto out; | 1087 | break; |
1046 | case OSD_SetColor: | 1088 | case OSD_SetColor: |
1047 | OSDSetColor(av7110, dc->color, dc->x0, dc->y0, dc->x1, dc->y1); | 1089 | ret = OSDSetColor(av7110, dc->color, dc->x0, dc->y0, dc->x1, dc->y1); |
1048 | goto out; | 1090 | break; |
1049 | case OSD_SetPalette: | 1091 | case OSD_SetPalette: |
1050 | { | 1092 | if (FW_VERSION(av7110->arm_app) >= 0x2618) |
1051 | if (FW_VERSION(av7110->arm_app) >= 0x2618) { | ||
1052 | ret = OSDSetPalette(av7110, dc->data, dc->color, dc->x0); | 1093 | ret = OSDSetPalette(av7110, dc->data, dc->color, dc->x0); |
1053 | goto out; | 1094 | else { |
1054 | } else { | ||
1055 | int i, len = dc->x0-dc->color+1; | 1095 | int i, len = dc->x0-dc->color+1; |
1056 | u8 __user *colors = (u8 __user *)dc->data; | 1096 | u8 __user *colors = (u8 __user *)dc->data; |
1057 | u8 r, g, b, blend; | 1097 | u8 r, g, b, blend; |
1058 | 1098 | ret = 0; | |
1059 | for (i = 0; i<len; i++) { | 1099 | for (i = 0; i<len; i++) { |
1060 | if (get_user(r, colors + i * 4) || | 1100 | if (get_user(r, colors + i * 4) || |
1061 | get_user(g, colors + i * 4 + 1) || | 1101 | get_user(g, colors + i * 4 + 1) || |
1062 | get_user(b, colors + i * 4 + 2) || | 1102 | get_user(b, colors + i * 4 + 2) || |
1063 | get_user(blend, colors + i * 4 + 3)) { | 1103 | get_user(blend, colors + i * 4 + 3)) { |
1064 | ret = -EFAULT; | 1104 | ret = -EFAULT; |
1065 | goto out; | 1105 | break; |
1066 | } | 1106 | } |
1067 | OSDSetColor(av7110, dc->color + i, r, g, b, blend); | 1107 | ret = OSDSetColor(av7110, dc->color + i, r, g, b, blend); |
1108 | if (ret) | ||
1109 | break; | ||
1068 | } | 1110 | } |
1069 | } | 1111 | } |
1070 | ret = 0; | 1112 | break; |
1071 | goto out; | ||
1072 | } | ||
1073 | case OSD_SetTrans: | ||
1074 | goto out; | ||
1075 | case OSD_SetPixel: | 1113 | case OSD_SetPixel: |
1076 | DrawLine(av7110, av7110->osdwin, | 1114 | ret = DrawLine(av7110, av7110->osdwin, |
1077 | dc->x0, dc->y0, 0, 0, dc->color); | 1115 | dc->x0, dc->y0, 0, 0, dc->color); |
1078 | goto out; | 1116 | break; |
1079 | case OSD_GetPixel: | ||
1080 | goto out; | ||
1081 | case OSD_SetRow: | 1117 | case OSD_SetRow: |
1082 | dc->y1 = dc->y0; | 1118 | dc->y1 = dc->y0; |
1083 | /* fall through */ | 1119 | /* fall through */ |
1084 | case OSD_SetBlock: | 1120 | case OSD_SetBlock: |
1085 | ret = OSDSetBlock(av7110, dc->x0, dc->y0, dc->x1, dc->y1, dc->color, dc->data); | 1121 | ret = OSDSetBlock(av7110, dc->x0, dc->y0, dc->x1, dc->y1, dc->color, dc->data); |
1086 | goto out; | 1122 | break; |
1087 | case OSD_FillRow: | 1123 | case OSD_FillRow: |
1088 | DrawBlock(av7110, av7110->osdwin, dc->x0, dc->y0, | 1124 | ret = DrawBlock(av7110, av7110->osdwin, dc->x0, dc->y0, |
1089 | dc->x1-dc->x0+1, dc->y1, dc->color); | 1125 | dc->x1-dc->x0+1, dc->y1, dc->color); |
1090 | goto out; | 1126 | break; |
1091 | case OSD_FillBlock: | 1127 | case OSD_FillBlock: |
1092 | DrawBlock(av7110, av7110->osdwin, dc->x0, dc->y0, | 1128 | ret = DrawBlock(av7110, av7110->osdwin, dc->x0, dc->y0, |
1093 | dc->x1 - dc->x0 + 1, dc->y1 - dc->y0 + 1, dc->color); | 1129 | dc->x1 - dc->x0 + 1, dc->y1 - dc->y0 + 1, dc->color); |
1094 | goto out; | 1130 | break; |
1095 | case OSD_Line: | 1131 | case OSD_Line: |
1096 | DrawLine(av7110, av7110->osdwin, | 1132 | ret = DrawLine(av7110, av7110->osdwin, |
1097 | dc->x0, dc->y0, dc->x1 - dc->x0, dc->y1 - dc->y0, dc->color); | 1133 | dc->x0, dc->y0, dc->x1 - dc->x0, dc->y1 - dc->y0, dc->color); |
1098 | goto out; | 1134 | break; |
1099 | case OSD_Query: | ||
1100 | goto out; | ||
1101 | case OSD_Test: | ||
1102 | goto out; | ||
1103 | case OSD_Text: | 1135 | case OSD_Text: |
1104 | { | 1136 | { |
1105 | char textbuf[240]; | 1137 | char textbuf[240]; |
1106 | 1138 | ||
1107 | if (strncpy_from_user(textbuf, dc->data, 240) < 0) { | 1139 | if (strncpy_from_user(textbuf, dc->data, 240) < 0) { |
1108 | ret = -EFAULT; | 1140 | ret = -EFAULT; |
1109 | goto out; | 1141 | break; |
1110 | } | 1142 | } |
1111 | textbuf[239] = 0; | 1143 | textbuf[239] = 0; |
1112 | if (dc->x1 > 3) | 1144 | if (dc->x1 > 3) |
1113 | dc->x1 = 3; | 1145 | dc->x1 = 3; |
1114 | SetFont(av7110, av7110->osdwin, dc->x1, | 1146 | ret = SetFont(av7110, av7110->osdwin, dc->x1, |
1115 | (u16) (dc->color & 0xffff), (u16) (dc->color >> 16)); | 1147 | (u16) (dc->color & 0xffff), (u16) (dc->color >> 16)); |
1116 | FlushText(av7110); | 1148 | if (!ret) |
1117 | WriteText(av7110, av7110->osdwin, dc->x0, dc->y0, textbuf); | 1149 | ret = FlushText(av7110); |
1118 | goto out; | 1150 | if (!ret) |
1151 | ret = WriteText(av7110, av7110->osdwin, dc->x0, dc->y0, textbuf); | ||
1152 | break; | ||
1119 | } | 1153 | } |
1120 | case OSD_SetWindow: | 1154 | case OSD_SetWindow: |
1121 | if (dc->x0 < 1 || dc->x0 > 7) { | 1155 | if (dc->x0 < 1 || dc->x0 > 7) |
1122 | ret = -EINVAL; | 1156 | ret = -EINVAL; |
1123 | goto out; | 1157 | else { |
1158 | av7110->osdwin = dc->x0; | ||
1159 | ret = 0; | ||
1124 | } | 1160 | } |
1125 | av7110->osdwin = dc->x0; | 1161 | break; |
1126 | goto out; | ||
1127 | case OSD_MoveWindow: | 1162 | case OSD_MoveWindow: |
1128 | MoveWindowAbs(av7110, av7110->osdwin, dc->x0, dc->y0); | 1163 | ret = MoveWindowAbs(av7110, av7110->osdwin, dc->x0, dc->y0); |
1129 | SetColorBlend(av7110, av7110->osdwin); | 1164 | if (!ret) |
1130 | goto out; | 1165 | ret = SetColorBlend(av7110, av7110->osdwin); |
1166 | break; | ||
1131 | case OSD_OpenRaw: | 1167 | case OSD_OpenRaw: |
1132 | if (dc->color < OSD_BITMAP1 || dc->color > OSD_CURSOR) { | 1168 | if (dc->color < OSD_BITMAP1 || dc->color > OSD_CURSOR) { |
1133 | ret = -EINVAL; | 1169 | ret = -EINVAL; |
1134 | goto out; | 1170 | break; |
1135 | } | 1171 | } |
1136 | if (dc->color >= OSD_BITMAP1 && dc->color <= OSD_BITMAP8HR) { | 1172 | if (dc->color >= OSD_BITMAP1 && dc->color <= OSD_BITMAP8HR) |
1137 | av7110->osdbpp[av7110->osdwin] = (1 << (dc->color & 3)) - 1; | 1173 | av7110->osdbpp[av7110->osdwin] = (1 << (dc->color & 3)) - 1; |
1138 | } | 1174 | else |
1139 | else { | ||
1140 | av7110->osdbpp[av7110->osdwin] = 0; | 1175 | av7110->osdbpp[av7110->osdwin] = 0; |
1141 | } | 1176 | ret = CreateOSDWindow(av7110, av7110->osdwin, (osd_raw_window_t)dc->color, |
1142 | CreateOSDWindow(av7110, av7110->osdwin, (osd_raw_window_t)dc->color, | ||
1143 | dc->x1 - dc->x0 + 1, dc->y1 - dc->y0 + 1); | 1177 | dc->x1 - dc->x0 + 1, dc->y1 - dc->y0 + 1); |
1178 | if (ret) | ||
1179 | break; | ||
1144 | if (!dc->data) { | 1180 | if (!dc->data) { |
1145 | MoveWindowAbs(av7110, av7110->osdwin, dc->x0, dc->y0); | 1181 | ret = MoveWindowAbs(av7110, av7110->osdwin, dc->x0, dc->y0); |
1146 | SetColorBlend(av7110, av7110->osdwin); | 1182 | if (!ret) |
1183 | ret = SetColorBlend(av7110, av7110->osdwin); | ||
1147 | } | 1184 | } |
1148 | goto out; | 1185 | break; |
1149 | default: | 1186 | default: |
1150 | ret = -EINVAL; | 1187 | ret = -EINVAL; |
1151 | goto out; | 1188 | break; |
1152 | } | 1189 | } |
1153 | 1190 | ||
1154 | out: | ||
1155 | up(&av7110->osd_sema); | 1191 | up(&av7110->osd_sema); |
1192 | if (ret==-ERESTARTSYS) | ||
1193 | dprintk(1, "av7110_osd_cmd(%d) returns with -ERESTARTSYS\n",dc->cmd); | ||
1194 | else if (ret) | ||
1195 | dprintk(1, "av7110_osd_cmd(%d) returns with %d\n",dc->cmd,ret); | ||
1196 | |||
1156 | return ret; | 1197 | return ret; |
1157 | } | 1198 | } |
1158 | 1199 | ||
diff --git a/drivers/media/dvb/ttpci/av7110_hw.h b/drivers/media/dvb/ttpci/av7110_hw.h index 52061e17c6dd..fedd20f9815d 100644 --- a/drivers/media/dvb/ttpci/av7110_hw.h +++ b/drivers/media/dvb/ttpci/av7110_hw.h | |||
@@ -458,27 +458,27 @@ static inline int SendDAC(struct av7110 *av7110, u8 addr, u8 data) | |||
458 | return av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, AudioDAC, 2, addr, data); | 458 | return av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, AudioDAC, 2, addr, data); |
459 | } | 459 | } |
460 | 460 | ||
461 | static inline void av7710_set_video_mode(struct av7110 *av7110, int mode) | 461 | static inline int av7710_set_video_mode(struct av7110 *av7110, int mode) |
462 | { | 462 | { |
463 | av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetVidMode, 1, mode); | 463 | return av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetVidMode, 1, mode); |
464 | } | 464 | } |
465 | 465 | ||
466 | static int inline vidcom(struct av7110 *av7110, u32 com, u32 arg) | 466 | static inline int vidcom(struct av7110 *av7110, u32 com, u32 arg) |
467 | { | 467 | { |
468 | return av7110_fw_cmd(av7110, COMTYPE_MISC, AV7110_FW_VIDEO_COMMAND, 4, | 468 | return av7110_fw_cmd(av7110, COMTYPE_MISC, AV7110_FW_VIDEO_COMMAND, 4, |
469 | (com>>16), (com&0xffff), | 469 | (com>>16), (com&0xffff), |
470 | (arg>>16), (arg&0xffff)); | 470 | (arg>>16), (arg&0xffff)); |
471 | } | 471 | } |
472 | 472 | ||
473 | static int inline audcom(struct av7110 *av7110, u32 com) | 473 | static inline int audcom(struct av7110 *av7110, u32 com) |
474 | { | 474 | { |
475 | return av7110_fw_cmd(av7110, COMTYPE_MISC, AV7110_FW_AUDIO_COMMAND, 2, | 475 | return av7110_fw_cmd(av7110, COMTYPE_MISC, AV7110_FW_AUDIO_COMMAND, 2, |
476 | (com>>16), (com&0xffff)); | 476 | (com>>16), (com&0xffff)); |
477 | } | 477 | } |
478 | 478 | ||
479 | static inline void Set22K(struct av7110 *av7110, int state) | 479 | static inline int Set22K(struct av7110 *av7110, int state) |
480 | { | 480 | { |
481 | av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, (state ? ON22K : OFF22K), 0); | 481 | return av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, (state ? ON22K : OFF22K), 0); |
482 | } | 482 | } |
483 | 483 | ||
484 | 484 | ||
diff --git a/drivers/media/dvb/ttpci/av7110_ipack.c b/drivers/media/dvb/ttpci/av7110_ipack.c index 246640741888..699ef8b5b99a 100644 --- a/drivers/media/dvb/ttpci/av7110_ipack.c +++ b/drivers/media/dvb/ttpci/av7110_ipack.c | |||
@@ -24,7 +24,7 @@ int av7110_ipack_init(struct ipack *p, int size, | |||
24 | void (*func)(u8 *buf, int size, void *priv)) | 24 | void (*func)(u8 *buf, int size, void *priv)) |
25 | { | 25 | { |
26 | if (!(p->buf = vmalloc(size*sizeof(u8)))) { | 26 | if (!(p->buf = vmalloc(size*sizeof(u8)))) { |
27 | printk ("Couldn't allocate memory for ipack\n"); | 27 | printk(KERN_WARNING "Couldn't allocate memory for ipack\n"); |
28 | return -ENOMEM; | 28 | return -ENOMEM; |
29 | } | 29 | } |
30 | p->size = size; | 30 | p->size = size; |
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 6e0f5d307c52..9746d2bb916f 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -570,9 +570,9 @@ static int philips_cu1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_p | |||
570 | 570 | ||
571 | buf[0] = (div >> 8) & 0x7f; | 571 | buf[0] = (div >> 8) & 0x7f; |
572 | buf[1] = div & 0xff; | 572 | buf[1] = div & 0xff; |
573 | buf[2] = 0x8e; | 573 | buf[2] = 0x86; |
574 | buf[3] = (params->frequency < 174500000 ? 0xa1 : | 574 | buf[3] = (params->frequency < 150000000 ? 0x01 : |
575 | params->frequency < 454000000 ? 0x92 : 0x34); | 575 | params->frequency < 445000000 ? 0x02 : 0x04); |
576 | 576 | ||
577 | if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) | 577 | if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) |
578 | return -EIO; | 578 | return -EIO; |
@@ -695,8 +695,12 @@ static struct tda1004x_config philips_tu1216_config = { | |||
695 | .demod_address = 0x8, | 695 | .demod_address = 0x8, |
696 | .invert = 1, | 696 | .invert = 1, |
697 | .invert_oclk = 1, | 697 | .invert_oclk = 1, |
698 | .xtal_freq = TDA10046_XTAL_4M, | ||
699 | .agc_config = TDA10046_AGC_DEFAULT, | ||
700 | .if_freq = TDA10046_FREQ_3617, | ||
698 | .pll_init = philips_tu1216_pll_init, | 701 | .pll_init = philips_tu1216_pll_init, |
699 | .pll_set = philips_tu1216_pll_set, | 702 | .pll_set = philips_tu1216_pll_set, |
703 | .pll_sleep = NULL, | ||
700 | .request_firmware = philips_tu1216_request_firmware, | 704 | .request_firmware = philips_tu1216_request_firmware, |
701 | }; | 705 | }; |
702 | 706 | ||
@@ -1018,7 +1022,7 @@ static struct pci_device_id pci_tbl[] = { | |||
1018 | MODULE_DEVICE_TABLE(pci, pci_tbl); | 1022 | MODULE_DEVICE_TABLE(pci, pci_tbl); |
1019 | 1023 | ||
1020 | static struct saa7146_extension budget_extension = { | 1024 | static struct saa7146_extension budget_extension = { |
1021 | .name = "budget dvb /w video in\0", | 1025 | .name = "budget_av", |
1022 | .pci_tbl = pci_tbl, | 1026 | .pci_tbl = pci_tbl, |
1023 | 1027 | ||
1024 | .module = THIS_MODULE, | 1028 | .module = THIS_MODULE, |
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index dce116111376..a1267054bc01 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -69,6 +69,7 @@ struct budget_ci { | |||
69 | int slot_status; | 69 | int slot_status; |
70 | struct dvb_ca_en50221 ca; | 70 | struct dvb_ca_en50221 ca; |
71 | char ir_dev_name[50]; | 71 | char ir_dev_name[50]; |
72 | u8 tuner_pll_address; /* used for philips_tdm1316l configs */ | ||
72 | }; | 73 | }; |
73 | 74 | ||
74 | /* from reading the following remotes: | 75 | /* from reading the following remotes: |
@@ -723,7 +724,7 @@ static int philips_tdm1316l_pll_init(struct dvb_frontend *fe) | |||
723 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | 724 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; |
724 | static u8 td1316_init[] = { 0x0b, 0xf5, 0x85, 0xab }; | 725 | static u8 td1316_init[] = { 0x0b, 0xf5, 0x85, 0xab }; |
725 | static u8 disable_mc44BC374c[] = { 0x1d, 0x74, 0xa0, 0x68 }; | 726 | static u8 disable_mc44BC374c[] = { 0x1d, 0x74, 0xa0, 0x68 }; |
726 | struct i2c_msg tuner_msg = {.addr = 0x63,.flags = 0,.buf = td1316_init,.len = | 727 | struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address,.flags = 0,.buf = td1316_init,.len = |
727 | sizeof(td1316_init) }; | 728 | sizeof(td1316_init) }; |
728 | 729 | ||
729 | // setup PLL configuration | 730 | // setup PLL configuration |
@@ -746,7 +747,7 @@ static int philips_tdm1316l_pll_set(struct dvb_frontend *fe, struct dvb_frontend | |||
746 | { | 747 | { |
747 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | 748 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; |
748 | u8 tuner_buf[4]; | 749 | u8 tuner_buf[4]; |
749 | struct i2c_msg tuner_msg = {.addr = 0x63,.flags = 0,.buf = tuner_buf,.len = sizeof(tuner_buf) }; | 750 | struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address,.flags = 0,.buf = tuner_buf,.len = sizeof(tuner_buf) }; |
750 | int tuner_frequency = 0; | 751 | int tuner_frequency = 0; |
751 | u8 band, cp, filter; | 752 | u8 band, cp, filter; |
752 | 753 | ||
@@ -838,8 +839,12 @@ static struct tda1004x_config philips_tdm1316l_config = { | |||
838 | .demod_address = 0x8, | 839 | .demod_address = 0x8, |
839 | .invert = 0, | 840 | .invert = 0, |
840 | .invert_oclk = 0, | 841 | .invert_oclk = 0, |
842 | .xtal_freq = TDA10046_XTAL_4M, | ||
843 | .agc_config = TDA10046_AGC_DEFAULT, | ||
844 | .if_freq = TDA10046_FREQ_3617, | ||
841 | .pll_init = philips_tdm1316l_pll_init, | 845 | .pll_init = philips_tdm1316l_pll_init, |
842 | .pll_set = philips_tdm1316l_pll_set, | 846 | .pll_set = philips_tdm1316l_pll_set, |
847 | .pll_sleep = NULL, | ||
843 | .request_firmware = philips_tdm1316l_request_firmware, | 848 | .request_firmware = philips_tdm1316l_request_firmware, |
844 | }; | 849 | }; |
845 | 850 | ||
@@ -865,12 +870,22 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
865 | break; | 870 | break; |
866 | 871 | ||
867 | case 0x1011: // Hauppauge/TT Nova-T budget (tda10045/Philips tdm1316l(tda6651tt) + TDA9889) | 872 | case 0x1011: // Hauppauge/TT Nova-T budget (tda10045/Philips tdm1316l(tda6651tt) + TDA9889) |
873 | budget_ci->tuner_pll_address = 0x63; | ||
868 | budget_ci->budget.dvb_frontend = | 874 | budget_ci->budget.dvb_frontend = |
869 | tda10045_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | 875 | tda10045_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); |
870 | if (budget_ci->budget.dvb_frontend) { | 876 | if (budget_ci->budget.dvb_frontend) { |
871 | break; | 877 | break; |
872 | } | 878 | } |
873 | break; | 879 | break; |
880 | |||
881 | case 0x1012: // Hauppauge/TT Nova-T CI budget (tda10045/Philips tdm1316l(tda6651tt) + TDA9889) | ||
882 | budget_ci->tuner_pll_address = 0x60; | ||
883 | budget_ci->budget.dvb_frontend = | ||
884 | tda10046_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | ||
885 | if (budget_ci->budget.dvb_frontend) { | ||
886 | break; | ||
887 | } | ||
888 | break; | ||
874 | } | 889 | } |
875 | 890 | ||
876 | if (budget_ci->budget.dvb_frontend == NULL) { | 891 | if (budget_ci->budget.dvb_frontend == NULL) { |
@@ -950,11 +965,13 @@ static struct saa7146_extension budget_extension; | |||
950 | 965 | ||
951 | MAKE_BUDGET_INFO(ttbci, "TT-Budget/WinTV-NOVA-CI PCI", BUDGET_TT_HW_DISEQC); | 966 | MAKE_BUDGET_INFO(ttbci, "TT-Budget/WinTV-NOVA-CI PCI", BUDGET_TT_HW_DISEQC); |
952 | MAKE_BUDGET_INFO(ttbt2, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT); | 967 | MAKE_BUDGET_INFO(ttbt2, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT); |
968 | MAKE_BUDGET_INFO(ttbtci, "TT-Budget-T-CI PCI", BUDGET_TT); | ||
953 | 969 | ||
954 | static struct pci_device_id pci_tbl[] = { | 970 | static struct pci_device_id pci_tbl[] = { |
955 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100c), | 971 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100c), |
956 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100f), | 972 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100f), |
957 | MAKE_EXTENSION_PCI(ttbt2, 0x13c2, 0x1011), | 973 | MAKE_EXTENSION_PCI(ttbt2, 0x13c2, 0x1011), |
974 | MAKE_EXTENSION_PCI(ttbtci, 0x13c2, 0x1012), | ||
958 | { | 975 | { |
959 | .vendor = 0, | 976 | .vendor = 0, |
960 | } | 977 | } |
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 083fd44e5f90..9961917e8a7f 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "ves1820.h" | 40 | #include "ves1820.h" |
41 | #include "l64781.h" | 41 | #include "l64781.h" |
42 | #include "tda8083.h" | 42 | #include "tda8083.h" |
43 | #include "s5h1420.h" | ||
43 | 44 | ||
44 | static void Set22K (struct budget *budget, int state) | 45 | static void Set22K (struct budget *budget, int state) |
45 | { | 46 | { |
@@ -177,6 +178,62 @@ static int budget_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t m | |||
177 | return 0; | 178 | return 0; |
178 | } | 179 | } |
179 | 180 | ||
181 | static int lnbp21_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) | ||
182 | { | ||
183 | struct budget* budget = (struct budget*) fe->dvb->priv; | ||
184 | u8 buf; | ||
185 | struct i2c_msg msg = { .addr = 0x08, .flags = I2C_M_RD, .buf = &buf, .len = sizeof(buf) }; | ||
186 | |||
187 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | ||
188 | |||
189 | switch(voltage) { | ||
190 | case SEC_VOLTAGE_13: | ||
191 | buf = (buf & 0xf7) | 0x04; | ||
192 | break; | ||
193 | |||
194 | case SEC_VOLTAGE_18: | ||
195 | buf = (buf & 0xf7) | 0x0c; | ||
196 | break; | ||
197 | |||
198 | case SEC_VOLTAGE_OFF: | ||
199 | buf = buf & 0xf0; | ||
200 | break; | ||
201 | } | ||
202 | |||
203 | msg.flags = 0; | ||
204 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | ||
205 | |||
206 | return 0; | ||
207 | } | ||
208 | |||
209 | static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend* fe, int arg) | ||
210 | { | ||
211 | struct budget* budget = (struct budget*) fe->dvb->priv; | ||
212 | u8 buf; | ||
213 | struct i2c_msg msg = { .addr = 0x08, .flags = I2C_M_RD, .buf = &buf, .len = sizeof(buf) }; | ||
214 | |||
215 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | ||
216 | |||
217 | if (arg) { | ||
218 | buf = buf | 0x10; | ||
219 | } else { | ||
220 | buf = buf & 0xef; | ||
221 | } | ||
222 | |||
223 | msg.flags = 0; | ||
224 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | ||
225 | |||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | static void lnbp21_init(struct budget* budget) | ||
230 | { | ||
231 | u8 buf = 0x00; | ||
232 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = &buf, .len = sizeof(buf) }; | ||
233 | |||
234 | i2c_transfer (&budget->i2c_adap, &msg, 1); | ||
235 | } | ||
236 | |||
180 | static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 237 | static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
181 | { | 238 | { |
182 | struct budget* budget = (struct budget*) fe->dvb->priv; | 239 | struct budget* budget = (struct budget*) fe->dvb->priv; |
@@ -395,6 +452,38 @@ static struct tda8083_config grundig_29504_451_config = { | |||
395 | .pll_set = grundig_29504_451_pll_set, | 452 | .pll_set = grundig_29504_451_pll_set, |
396 | }; | 453 | }; |
397 | 454 | ||
455 | static int s5h1420_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u32* freqout) | ||
456 | { | ||
457 | struct budget* budget = (struct budget*) fe->dvb->priv; | ||
458 | u32 div; | ||
459 | u8 data[4]; | ||
460 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; | ||
461 | |||
462 | div = params->frequency / 1000; | ||
463 | data[0] = (div >> 8) & 0x7f; | ||
464 | data[1] = div & 0xff; | ||
465 | data[2] = 0xc2; | ||
466 | |||
467 | if (div < 1450) | ||
468 | data[3] = 0x00; | ||
469 | else if (div < 1850) | ||
470 | data[3] = 0x40; | ||
471 | else if (div < 2000) | ||
472 | data[3] = 0x80; | ||
473 | else | ||
474 | data[3] = 0xc0; | ||
475 | |||
476 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | ||
477 | |||
478 | *freqout = div * 1000; | ||
479 | return 0; | ||
480 | } | ||
481 | |||
482 | static struct s5h1420_config s5h1420_config = { | ||
483 | .demod_address = 0x53, | ||
484 | .pll_set = s5h1420_pll_set, | ||
485 | }; | ||
486 | |||
398 | static u8 read_pwm(struct budget* budget) | 487 | static u8 read_pwm(struct budget* budget) |
399 | { | 488 | { |
400 | u8 b = 0xff; | 489 | u8 b = 0xff; |
@@ -459,6 +548,15 @@ static void frontend_init(struct budget *budget) | |||
459 | break; | 548 | break; |
460 | } | 549 | } |
461 | break; | 550 | break; |
551 | |||
552 | case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260)) | ||
553 | budget->dvb_frontend = s5h1420_attach(&s5h1420_config, &budget->i2c_adap); | ||
554 | if (budget->dvb_frontend) { | ||
555 | budget->dvb_frontend->ops->set_voltage = lnbp21_set_voltage; | ||
556 | budget->dvb_frontend->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; | ||
557 | lnbp21_init(budget); | ||
558 | break; | ||
559 | } | ||
462 | } | 560 | } |
463 | 561 | ||
464 | if (budget->dvb_frontend == NULL) { | 562 | if (budget->dvb_frontend == NULL) { |
@@ -532,6 +630,7 @@ static struct pci_device_id pci_tbl[] = { | |||
532 | MAKE_EXTENSION_PCI(ttbc, 0x13c2, 0x1004), | 630 | MAKE_EXTENSION_PCI(ttbc, 0x13c2, 0x1004), |
533 | MAKE_EXTENSION_PCI(ttbt, 0x13c2, 0x1005), | 631 | MAKE_EXTENSION_PCI(ttbt, 0x13c2, 0x1005), |
534 | MAKE_EXTENSION_PCI(satel, 0x13c2, 0x1013), | 632 | MAKE_EXTENSION_PCI(satel, 0x13c2, 0x1013), |
633 | MAKE_EXTENSION_PCI(ttbs, 0x13c2, 0x1016), | ||
535 | MAKE_EXTENSION_PCI(fsacs1,0x1131, 0x4f60), | 634 | MAKE_EXTENSION_PCI(fsacs1,0x1131, 0x4f60), |
536 | MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61), | 635 | MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61), |
537 | { | 636 | { |
diff --git a/drivers/media/dvb/ttusb-budget/Kconfig b/drivers/media/dvb/ttusb-budget/Kconfig index 4aa714ab4c28..c6c1d41a2efb 100644 --- a/drivers/media/dvb/ttusb-budget/Kconfig +++ b/drivers/media/dvb/ttusb-budget/Kconfig | |||
@@ -3,6 +3,7 @@ config DVB_TTUSB_BUDGET | |||
3 | depends on DVB_CORE && USB | 3 | depends on DVB_CORE && USB |
4 | select DVB_CX22700 | 4 | select DVB_CX22700 |
5 | select DVB_TDA1004X | 5 | select DVB_TDA1004X |
6 | select DVB_VES1820 | ||
6 | select DVB_TDA8083 | 7 | select DVB_TDA8083 |
7 | select DVB_STV0299 | 8 | select DVB_STV0299 |
8 | help | 9 | help |
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index afa0e7a0e506..aa43b5fcb8e7 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "dmxdev.h" | 24 | #include "dmxdev.h" |
25 | #include "dvb_demux.h" | 25 | #include "dvb_demux.h" |
26 | #include "dvb_net.h" | 26 | #include "dvb_net.h" |
27 | #include "ves1820.h" | ||
27 | #include "cx22700.h" | 28 | #include "cx22700.h" |
28 | #include "tda1004x.h" | 29 | #include "tda1004x.h" |
29 | #include "stv0299.h" | 30 | #include "stv0299.h" |
@@ -1367,6 +1368,47 @@ static struct tda8083_config ttusb_novas_grundig_29504_491_config = { | |||
1367 | .pll_set = ttusb_novas_grundig_29504_491_pll_set, | 1368 | .pll_set = ttusb_novas_grundig_29504_491_pll_set, |
1368 | }; | 1369 | }; |
1369 | 1370 | ||
1371 | static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | ||
1372 | { | ||
1373 | struct ttusb* ttusb = fe->dvb->priv; | ||
1374 | u32 div; | ||
1375 | u8 data[4]; | ||
1376 | struct i2c_msg msg = { .addr = 0x62, .flags = 0, .buf = data, .len = sizeof(data) }; | ||
1377 | |||
1378 | div = (params->frequency + 35937500 + 31250) / 62500; | ||
1379 | |||
1380 | data[0] = (div >> 8) & 0x7f; | ||
1381 | data[1] = div & 0xff; | ||
1382 | data[2] = 0x85 | ((div >> 10) & 0x60); | ||
1383 | data[3] = (params->frequency < 174000000 ? 0x88 : params->frequency < 470000000 ? 0x84 : 0x81); | ||
1384 | |||
1385 | if (i2c_transfer (&ttusb->i2c_adap, &msg, 1) != 1) | ||
1386 | return -EIO; | ||
1387 | |||
1388 | return 0; | ||
1389 | } | ||
1390 | |||
1391 | |||
1392 | static struct ves1820_config alps_tdbe2_config = { | ||
1393 | .demod_address = 0x09, | ||
1394 | .xin = 57840000UL, | ||
1395 | .invert = 1, | ||
1396 | .selagc = VES1820_SELAGC_SIGNAMPERR, | ||
1397 | .pll_set = alps_tdbe2_pll_set, | ||
1398 | }; | ||
1399 | |||
1400 | static u8 read_pwm(struct ttusb* ttusb) | ||
1401 | { | ||
1402 | u8 b = 0xff; | ||
1403 | u8 pwm; | ||
1404 | struct i2c_msg msg[] = { { .addr = 0x50,.flags = 0,.buf = &b,.len = 1 }, | ||
1405 | { .addr = 0x50,.flags = I2C_M_RD,.buf = &pwm,.len = 1} }; | ||
1406 | |||
1407 | if ((i2c_transfer(&ttusb->i2c_adap, msg, 2) != 2) || (pwm == 0xff)) | ||
1408 | pwm = 0x48; | ||
1409 | |||
1410 | return pwm; | ||
1411 | } | ||
1370 | 1412 | ||
1371 | 1413 | ||
1372 | static void frontend_init(struct ttusb* ttusb) | 1414 | static void frontend_init(struct ttusb* ttusb) |
@@ -1394,6 +1436,12 @@ static void frontend_init(struct ttusb* ttusb) | |||
1394 | 1436 | ||
1395 | break; | 1437 | break; |
1396 | 1438 | ||
1439 | case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659)) | ||
1440 | ttusb->fe = ves1820_attach(&alps_tdbe2_config, &ttusb->i2c_adap, read_pwm(ttusb)); | ||
1441 | if (ttusb->fe != NULL) | ||
1442 | break; | ||
1443 | break; | ||
1444 | |||
1397 | case 0x1005: // Hauppauge/TT Nova-USB-t budget (tda10046/Philips td1316(tda6651tt) OR cx22700/ALPS TDMB7(??)) | 1445 | case 0x1005: // Hauppauge/TT Nova-USB-t budget (tda10046/Philips td1316(tda6651tt) OR cx22700/ALPS TDMB7(??)) |
1398 | // try the ALPS TDMB7 first | 1446 | // try the ALPS TDMB7 first |
1399 | ttusb->fe = cx22700_attach(&alps_tdmb7_config, &ttusb->i2c_adap); | 1447 | ttusb->fe = cx22700_attach(&alps_tdmb7_config, &ttusb->i2c_adap); |
@@ -1570,7 +1618,7 @@ static void ttusb_disconnect(struct usb_interface *intf) | |||
1570 | 1618 | ||
1571 | static struct usb_device_id ttusb_table[] = { | 1619 | static struct usb_device_id ttusb_table[] = { |
1572 | {USB_DEVICE(0xb48, 0x1003)}, | 1620 | {USB_DEVICE(0xb48, 0x1003)}, |
1573 | /* {USB_DEVICE(0xb48, 0x1004)},UNDEFINED HARDWARE - mail linuxtv.org list*/ /* to be confirmed ???? */ | 1621 | {USB_DEVICE(0xb48, 0x1004)}, |
1574 | {USB_DEVICE(0xb48, 0x1005)}, | 1622 | {USB_DEVICE(0xb48, 0x1005)}, |
1575 | {} | 1623 | {} |
1576 | }; | 1624 | }; |
@@ -1578,7 +1626,7 @@ static struct usb_device_id ttusb_table[] = { | |||
1578 | MODULE_DEVICE_TABLE(usb, ttusb_table); | 1626 | MODULE_DEVICE_TABLE(usb, ttusb_table); |
1579 | 1627 | ||
1580 | static struct usb_driver ttusb_driver = { | 1628 | static struct usb_driver ttusb_driver = { |
1581 | .name = "Technotrend/Hauppauge USB-Nova", | 1629 | .name = "ttusb", |
1582 | .probe = ttusb_probe, | 1630 | .probe = ttusb_probe, |
1583 | .disconnect = ttusb_disconnect, | 1631 | .disconnect = ttusb_disconnect, |
1584 | .id_table = ttusb_table, | 1632 | .id_table = ttusb_table, |
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 505bdaff5a7e..45c9a9a08e4d 100644 --- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c | |||
@@ -1281,6 +1281,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) | |||
1281 | if (firmware_size < 60) { | 1281 | if (firmware_size < 60) { |
1282 | printk("%s: firmware size too small for DSP code (%zu < 60).\n", | 1282 | printk("%s: firmware size too small for DSP code (%zu < 60).\n", |
1283 | __FUNCTION__, firmware_size); | 1283 | __FUNCTION__, firmware_size); |
1284 | release_firmware(fw_entry); | ||
1284 | return -1; | 1285 | return -1; |
1285 | } | 1286 | } |
1286 | 1287 | ||
@@ -1294,6 +1295,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) | |||
1294 | printk("%s: crc32 check of DSP code failed (calculated " | 1295 | printk("%s: crc32 check of DSP code failed (calculated " |
1295 | "0x%08x != 0x%08x in file), file invalid.\n", | 1296 | "0x%08x != 0x%08x in file), file invalid.\n", |
1296 | __FUNCTION__, crc32_csum, crc32_check); | 1297 | __FUNCTION__, crc32_csum, crc32_check); |
1298 | release_firmware(fw_entry); | ||
1297 | return -1; | 1299 | return -1; |
1298 | } | 1300 | } |
1299 | memcpy(idstring, &firmware[36], 20); | 1301 | memcpy(idstring, &firmware[36], 20); |
@@ -1308,15 +1310,19 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) | |||
1308 | 1310 | ||
1309 | result = ttusb_dec_send_command(dec, 0x41, sizeof(b0), b0, NULL, NULL); | 1311 | result = ttusb_dec_send_command(dec, 0x41, sizeof(b0), b0, NULL, NULL); |
1310 | 1312 | ||
1311 | if (result) | 1313 | if (result) { |
1314 | release_firmware(fw_entry); | ||
1312 | return result; | 1315 | return result; |
1316 | } | ||
1313 | 1317 | ||
1314 | trans_count = 0; | 1318 | trans_count = 0; |
1315 | j = 0; | 1319 | j = 0; |
1316 | 1320 | ||
1317 | b = kmalloc(ARM_PACKET_SIZE, GFP_KERNEL); | 1321 | b = kmalloc(ARM_PACKET_SIZE, GFP_KERNEL); |
1318 | if (b == NULL) | 1322 | if (b == NULL) { |
1323 | release_firmware(fw_entry); | ||
1319 | return -ENOMEM; | 1324 | return -ENOMEM; |
1325 | } | ||
1320 | 1326 | ||
1321 | for (i = 0; i < firmware_size; i += COMMAND_PACKET_SIZE) { | 1327 | for (i = 0; i < firmware_size; i += COMMAND_PACKET_SIZE) { |
1322 | size = firmware_size - i; | 1328 | size = firmware_size - i; |
@@ -1345,6 +1351,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) | |||
1345 | 1351 | ||
1346 | result = ttusb_dec_send_command(dec, 0x43, sizeof(b1), b1, NULL, NULL); | 1352 | result = ttusb_dec_send_command(dec, 0x43, sizeof(b1), b1, NULL, NULL); |
1347 | 1353 | ||
1354 | release_firmware(fw_entry); | ||
1348 | kfree(b); | 1355 | kfree(b); |
1349 | 1356 | ||
1350 | return result; | 1357 | return result; |
diff --git a/drivers/media/dvb/ttusb-dec/ttusbdecfe.c b/drivers/media/dvb/ttusb-dec/ttusbdecfe.c index 1699cc9f6bb0..725af3af5b27 100644 --- a/drivers/media/dvb/ttusb-dec/ttusbdecfe.c +++ b/drivers/media/dvb/ttusb-dec/ttusbdecfe.c | |||
@@ -157,7 +157,8 @@ struct dvb_frontend* ttusbdecfe_dvbt_attach(const struct ttusbdecfe_config* conf | |||
157 | 157 | ||
158 | /* allocate memory for the internal state */ | 158 | /* allocate memory for the internal state */ |
159 | state = (struct ttusbdecfe_state*) kmalloc(sizeof(struct ttusbdecfe_state), GFP_KERNEL); | 159 | state = (struct ttusbdecfe_state*) kmalloc(sizeof(struct ttusbdecfe_state), GFP_KERNEL); |
160 | if (state == NULL) goto error; | 160 | if (state == NULL) |
161 | return NULL; | ||
161 | 162 | ||
162 | /* setup the state */ | 163 | /* setup the state */ |
163 | state->config = config; | 164 | state->config = config; |
@@ -167,10 +168,6 @@ struct dvb_frontend* ttusbdecfe_dvbt_attach(const struct ttusbdecfe_config* conf | |||
167 | state->frontend.ops = &state->ops; | 168 | state->frontend.ops = &state->ops; |
168 | state->frontend.demodulator_priv = state; | 169 | state->frontend.demodulator_priv = state; |
169 | return &state->frontend; | 170 | return &state->frontend; |
170 | |||
171 | error: | ||
172 | kfree(state); | ||
173 | return NULL; | ||
174 | } | 171 | } |
175 | 172 | ||
176 | static struct dvb_frontend_ops ttusbdecfe_dvbs_ops; | 173 | static struct dvb_frontend_ops ttusbdecfe_dvbs_ops; |
@@ -181,7 +178,8 @@ struct dvb_frontend* ttusbdecfe_dvbs_attach(const struct ttusbdecfe_config* conf | |||
181 | 178 | ||
182 | /* allocate memory for the internal state */ | 179 | /* allocate memory for the internal state */ |
183 | state = (struct ttusbdecfe_state*) kmalloc(sizeof(struct ttusbdecfe_state), GFP_KERNEL); | 180 | state = (struct ttusbdecfe_state*) kmalloc(sizeof(struct ttusbdecfe_state), GFP_KERNEL); |
184 | if (state == NULL) goto error; | 181 | if (state == NULL) |
182 | return NULL; | ||
185 | 183 | ||
186 | /* setup the state */ | 184 | /* setup the state */ |
187 | state->config = config; | 185 | state->config = config; |
@@ -193,10 +191,6 @@ struct dvb_frontend* ttusbdecfe_dvbs_attach(const struct ttusbdecfe_config* conf | |||
193 | state->frontend.ops = &state->ops; | 191 | state->frontend.ops = &state->ops; |
194 | state->frontend.demodulator_priv = state; | 192 | state->frontend.demodulator_priv = state; |
195 | return &state->frontend; | 193 | return &state->frontend; |
196 | |||
197 | error: | ||
198 | kfree(state); | ||
199 | return NULL; | ||
200 | } | 194 | } |
201 | 195 | ||
202 | static struct dvb_frontend_ops ttusbdecfe_dvbt_ops = { | 196 | static struct dvb_frontend_ops ttusbdecfe_dvbt_ops = { |
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c index e62147e4ed1b..e5e2021a7312 100644 --- a/drivers/media/radio/radio-maestro.c +++ b/drivers/media/radio/radio-maestro.c | |||
@@ -154,7 +154,7 @@ static void radio_bits_set(struct radio_device *dev, __u32 data) | |||
154 | msleep(125); | 154 | msleep(125); |
155 | } | 155 | } |
156 | 156 | ||
157 | inline static int radio_function(struct inode *inode, struct file *file, | 157 | static inline int radio_function(struct inode *inode, struct file *file, |
158 | unsigned int cmd, void *arg) | 158 | unsigned int cmd, void *arg) |
159 | { | 159 | { |
160 | struct video_device *dev = video_devdata(file); | 160 | struct video_device *dev = video_devdata(file); |
@@ -283,7 +283,7 @@ static int __init maestro_radio_init(void) | |||
283 | module_init(maestro_radio_init); | 283 | module_init(maestro_radio_init); |
284 | module_exit(maestro_radio_exit); | 284 | module_exit(maestro_radio_exit); |
285 | 285 | ||
286 | inline static __u16 radio_power_on(struct radio_device *dev) | 286 | static inline __u16 radio_power_on(struct radio_device *dev) |
287 | { | 287 | { |
288 | register __u16 io=dev->io; | 288 | register __u16 io=dev->io; |
289 | register __u32 ofreq; | 289 | register __u32 ofreq; |
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index 5b748a48ce72..02d39a50d5ed 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c | |||
@@ -166,7 +166,7 @@ static int get_tune(__u16 io) | |||
166 | } | 166 | } |
167 | 167 | ||
168 | 168 | ||
169 | inline static int radio_function(struct inode *inode, struct file *file, | 169 | static inline int radio_function(struct inode *inode, struct file *file, |
170 | unsigned int cmd, void *arg) | 170 | unsigned int cmd, void *arg) |
171 | { | 171 | { |
172 | struct video_device *dev = video_devdata(file); | 172 | struct video_device *dev = video_devdata(file); |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 6c05fddb69ab..ac81e5e01a9a 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -236,7 +236,7 @@ config VIDEO_MEYE | |||
236 | 236 | ||
237 | config VIDEO_SAA7134 | 237 | config VIDEO_SAA7134 |
238 | tristate "Philips SAA7134 support" | 238 | tristate "Philips SAA7134 support" |
239 | depends on VIDEO_DEV && PCI && I2C | 239 | depends on VIDEO_DEV && PCI && I2C && SOUND |
240 | select VIDEO_BUF | 240 | select VIDEO_BUF |
241 | select VIDEO_IR | 241 | select VIDEO_IR |
242 | select VIDEO_TUNER | 242 | select VIDEO_TUNER |
@@ -330,6 +330,8 @@ config VIDEO_CX88_DVB | |||
330 | select VIDEO_BUF_DVB | 330 | select VIDEO_BUF_DVB |
331 | select DVB_MT352 | 331 | select DVB_MT352 |
332 | select DVB_OR51132 | 332 | select DVB_OR51132 |
333 | select DVB_CX22702 | ||
334 | select DVB_LGDT330X | ||
333 | ---help--- | 335 | ---help--- |
334 | This adds support for DVB/ATSC cards based on the | 336 | This adds support for DVB/ATSC cards based on the |
335 | Connexant 2388x chip. | 337 | Connexant 2388x chip. |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 2dc906fdfa55..810e7aac0a53 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -7,8 +7,7 @@ bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ | |||
7 | zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o | 7 | zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o |
8 | zr36067-objs := zoran_procfs.o zoran_device.o \ | 8 | zr36067-objs := zoran_procfs.o zoran_device.o \ |
9 | zoran_driver.o zoran_card.o | 9 | zoran_driver.o zoran_card.o |
10 | tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o | 10 | tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o |
11 | |||
12 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o | 11 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o |
13 | 12 | ||
14 | obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \ | 13 | obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \ |
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index 80254caa444c..48989eda2400 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c | |||
@@ -384,22 +384,14 @@ static unsigned short normal_i2c[] = | |||
384 | I2C_ADV7171 >> 1, (I2C_ADV7171 >> 1) + 1, | 384 | I2C_ADV7171 >> 1, (I2C_ADV7171 >> 1) + 1, |
385 | I2C_CLIENT_END | 385 | I2C_CLIENT_END |
386 | }; | 386 | }; |
387 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | ||
388 | 387 | ||
389 | static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | 388 | static unsigned short ignore = I2C_CLIENT_END; |
390 | static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
391 | static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
392 | static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
393 | static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END }; | ||
394 | 389 | ||
395 | static struct i2c_client_address_data addr_data = { | 390 | static struct i2c_client_address_data addr_data = { |
396 | .normal_i2c = normal_i2c, | 391 | .normal_i2c = normal_i2c, |
397 | .normal_i2c_range = normal_i2c_range, | 392 | .probe = &ignore, |
398 | .probe = probe, | 393 | .ignore = &ignore, |
399 | .probe_range = probe_range, | 394 | .force = &ignore, |
400 | .ignore = ignore, | ||
401 | .ignore_range = ignore_range, | ||
402 | .force = force | ||
403 | }; | 395 | }; |
404 | 396 | ||
405 | static struct i2c_driver i2c_driver_adv7170; | 397 | static struct i2c_driver i2c_driver_adv7170; |
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index 95d0974b0ab5..f898b6586374 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c | |||
@@ -434,22 +434,14 @@ static unsigned short normal_i2c[] = | |||
434 | I2C_ADV7176 >> 1, (I2C_ADV7176 >> 1) + 1, | 434 | I2C_ADV7176 >> 1, (I2C_ADV7176 >> 1) + 1, |
435 | I2C_CLIENT_END | 435 | I2C_CLIENT_END |
436 | }; | 436 | }; |
437 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | ||
438 | 437 | ||
439 | static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | 438 | static unsigned short ignore = I2C_CLIENT_END; |
440 | static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
441 | static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
442 | static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
443 | static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END }; | ||
444 | 439 | ||
445 | static struct i2c_client_address_data addr_data = { | 440 | static struct i2c_client_address_data addr_data = { |
446 | .normal_i2c = normal_i2c, | 441 | .normal_i2c = normal_i2c, |
447 | .normal_i2c_range = normal_i2c_range, | 442 | .probe = &ignore, |
448 | .probe = probe, | 443 | .ignore = &ignore, |
449 | .probe_range = probe_range, | 444 | .force = &ignore, |
450 | .ignore = ignore, | ||
451 | .ignore_range = ignore_range, | ||
452 | .force = force | ||
453 | }; | 445 | }; |
454 | 446 | ||
455 | static struct i2c_driver i2c_driver_adv7175; | 447 | static struct i2c_driver i2c_driver_adv7175; |
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index cf0db2554a80..8733588f6db3 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c | |||
@@ -500,22 +500,14 @@ static unsigned short normal_i2c[] = { | |||
500 | I2C_BT819 >> 1, | 500 | I2C_BT819 >> 1, |
501 | I2C_CLIENT_END, | 501 | I2C_CLIENT_END, |
502 | }; | 502 | }; |
503 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | ||
504 | 503 | ||
505 | static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | 504 | static unsigned short ignore = I2C_CLIENT_END; |
506 | static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
507 | static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
508 | static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
509 | static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END }; | ||
510 | 505 | ||
511 | static struct i2c_client_address_data addr_data = { | 506 | static struct i2c_client_address_data addr_data = { |
512 | .normal_i2c = normal_i2c, | 507 | .normal_i2c = normal_i2c, |
513 | .normal_i2c_range = normal_i2c_range, | 508 | .probe = &ignore, |
514 | .probe = probe, | 509 | .ignore = &ignore, |
515 | .probe_range = probe_range, | 510 | .force = &ignore, |
516 | .ignore = ignore, | ||
517 | .ignore_range = ignore_range, | ||
518 | .force = force | ||
519 | }; | 511 | }; |
520 | 512 | ||
521 | static struct i2c_driver i2c_driver_bt819; | 513 | static struct i2c_driver i2c_driver_bt819; |
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index efe605a113a1..a070417e65e6 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c | |||
@@ -6,7 +6,7 @@ | |||
6 | It outputs an 8-bit 4:2:2 YUV or YCrCb video signal which can be directly | 6 | It outputs an 8-bit 4:2:2 YUV or YCrCb video signal which can be directly |
7 | connected to bt848/bt878 GPIO pins on this purpose. | 7 | connected to bt848/bt878 GPIO pins on this purpose. |
8 | (see: VLSI Vision Ltd. www.vvl.co.uk for camera datasheets) | 8 | (see: VLSI Vision Ltd. www.vvl.co.uk for camera datasheets) |
9 | 9 | ||
10 | Supported Cards: | 10 | Supported Cards: |
11 | - Pixelview Rev.4E: 0x8a | 11 | - Pixelview Rev.4E: 0x8a |
12 | GPIO 0x400000 toggles Bt832 RESET, and the chip changes to i2c 0x88 ! | 12 | GPIO 0x400000 toggles Bt832 RESET, and the chip changes to i2c 0x88 ! |
@@ -31,16 +31,16 @@ | |||
31 | #include <linux/errno.h> | 31 | #include <linux/errno.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | 33 | ||
34 | #include "id.h" | 34 | #include <media/audiochip.h> |
35 | #include "audiochip.h" | 35 | #include <media/id.h> |
36 | #include "bttv.h" | 36 | #include "bttv.h" |
37 | #include "bt832.h" | 37 | #include "bt832.h" |
38 | 38 | ||
39 | MODULE_LICENSE("GPL"); | 39 | MODULE_LICENSE("GPL"); |
40 | 40 | ||
41 | /* Addresses to scan */ | 41 | /* Addresses to scan */ |
42 | static unsigned short normal_i2c[] = {I2C_CLIENT_END}; | 42 | static unsigned short normal_i2c[] = { I2C_BT832_ALT1>>1, I2C_BT832_ALT2>>1, |
43 | static unsigned short normal_i2c_range[] = {I2C_BT832_ALT1>>1,I2C_BT832_ALT2>>1,I2C_CLIENT_END}; | 43 | I2C_CLIENT_END }; |
44 | I2C_CLIENT_INSMOD; | 44 | I2C_CLIENT_INSMOD; |
45 | 45 | ||
46 | /* ---------------------------------------------------------------------- */ | 46 | /* ---------------------------------------------------------------------- */ |
@@ -95,7 +95,7 @@ int bt832_init(struct i2c_client *i2c_client_s) | |||
95 | 95 | ||
96 | buf=kmalloc(65,GFP_KERNEL); | 96 | buf=kmalloc(65,GFP_KERNEL); |
97 | bt832_hexdump(i2c_client_s,buf); | 97 | bt832_hexdump(i2c_client_s,buf); |
98 | 98 | ||
99 | if(buf[0x40] != 0x31) { | 99 | if(buf[0x40] != 0x31) { |
100 | printk("bt832: this i2c chip is no bt832 (id=%02x). Detaching.\n",buf[0x40]); | 100 | printk("bt832: this i2c chip is no bt832 (id=%02x). Detaching.\n",buf[0x40]); |
101 | kfree(buf); | 101 | kfree(buf); |
@@ -135,28 +135,16 @@ int bt832_init(struct i2c_client *i2c_client_s) | |||
135 | buf[1]= 0x27 & (~0x01); // Default | !skip | 135 | buf[1]= 0x27 & (~0x01); // Default | !skip |
136 | if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) | 136 | if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) |
137 | printk("bt832: i2c i/o error EO: rc == %d (should be 2)\n",rc); | 137 | printk("bt832: i2c i/o error EO: rc == %d (should be 2)\n",rc); |
138 | |||
139 | bt832_hexdump(i2c_client_s,buf); | ||
140 | |||
141 | #if 0 | ||
142 | // Full 30/25 Frame rate | ||
143 | printk("Full 30/25 Frame rate\n"); | ||
144 | buf[0]=BT832_VP_CONTROL0; // Reg.39 | ||
145 | buf[1]= 0x00; | ||
146 | if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) | ||
147 | printk("bt832: i2c i/o error FFR: rc == %d (should be 2)\n",rc); | ||
148 | 138 | ||
149 | bt832_hexdump(i2c_client_s,buf); | 139 | bt832_hexdump(i2c_client_s,buf); |
150 | #endif | ||
151 | 140 | ||
152 | #if 1 | 141 | |
153 | // for testing (even works when no camera attached) | 142 | // for testing (even works when no camera attached) |
154 | printk("bt832: *** Generate NTSC M Bars *****\n"); | 143 | printk("bt832: *** Generate NTSC M Bars *****\n"); |
155 | buf[0]=BT832_VP_TESTCONTROL0; // Reg. 42 | 144 | buf[0]=BT832_VP_TESTCONTROL0; // Reg. 42 |
156 | buf[1]=3; // Generate NTSC System M bars, Generate Frame timing internally | 145 | buf[1]=3; // Generate NTSC System M bars, Generate Frame timing internally |
157 | if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) | 146 | if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) |
158 | printk("bt832: i2c i/o error MBAR: rc == %d (should be 2)\n",rc); | 147 | printk("bt832: i2c i/o error MBAR: rc == %d (should be 2)\n",rc); |
159 | #endif | ||
160 | 148 | ||
161 | printk("Bt832: Camera Present: %s\n", | 149 | printk("Bt832: Camera Present: %s\n", |
162 | (buf[1+BT832_CAM_STATUS] & BT832_56_CAMERA_PRESENT) ? "yes":"no"); | 150 | (buf[1+BT832_CAM_STATUS] & BT832_56_CAMERA_PRESENT) ? "yes":"no"); |
@@ -168,8 +156,7 @@ int bt832_init(struct i2c_client *i2c_client_s) | |||
168 | 156 | ||
169 | 157 | ||
170 | 158 | ||
171 | static int bt832_attach(struct i2c_adapter *adap, int addr, | 159 | static int bt832_attach(struct i2c_adapter *adap, int addr, int kind) |
172 | unsigned short flags, int kind) | ||
173 | { | 160 | { |
174 | struct bt832 *t; | 161 | struct bt832 *t; |
175 | 162 | ||
@@ -184,27 +171,32 @@ static int bt832_attach(struct i2c_adapter *adap, int addr, | |||
184 | return -ENOMEM; | 171 | return -ENOMEM; |
185 | memset(t,0,sizeof(*t)); | 172 | memset(t,0,sizeof(*t)); |
186 | t->client = client_template; | 173 | t->client = client_template; |
187 | t->client.data = t; | 174 | i2c_set_clientdata(&t->client, t); |
188 | i2c_attach_client(&t->client); | 175 | i2c_attach_client(&t->client); |
189 | 176 | ||
190 | if(! bt832_init(&t->client)) { | 177 | if(! bt832_init(&t->client)) { |
191 | bt832_detach(&t->client); | 178 | bt832_detach(&t->client); |
192 | return -1; | 179 | return -1; |
193 | } | 180 | } |
194 | 181 | ||
195 | return 0; | 182 | return 0; |
196 | } | 183 | } |
197 | 184 | ||
198 | static int bt832_probe(struct i2c_adapter *adap) | 185 | static int bt832_probe(struct i2c_adapter *adap) |
199 | { | 186 | { |
187 | #ifdef I2C_CLASS_TV_ANALOG | ||
200 | if (adap->class & I2C_CLASS_TV_ANALOG) | 188 | if (adap->class & I2C_CLASS_TV_ANALOG) |
201 | return i2c_probe(adap, &addr_data, bt832_attach); | 189 | return i2c_probe(adap, &addr_data, bt832_attach); |
190 | #else | ||
191 | if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848)) | ||
192 | return i2c_probe(adap, &addr_data, bt832_attach); | ||
193 | #endif | ||
202 | return 0; | 194 | return 0; |
203 | } | 195 | } |
204 | 196 | ||
205 | static int bt832_detach(struct i2c_client *client) | 197 | static int bt832_detach(struct i2c_client *client) |
206 | { | 198 | { |
207 | struct bt832 *t = (struct bt832*)client->data; | 199 | struct bt832 *t = i2c_get_clientdata(client); |
208 | 200 | ||
209 | printk("bt832: detach.\n"); | 201 | printk("bt832: detach.\n"); |
210 | i2c_detach_client(client); | 202 | i2c_detach_client(client); |
@@ -215,7 +207,7 @@ static int bt832_detach(struct i2c_client *client) | |||
215 | static int | 207 | static int |
216 | bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) | 208 | bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) |
217 | { | 209 | { |
218 | struct bt832 *t = (struct bt832*)client->data; | 210 | struct bt832 *t = i2c_get_clientdata(client); |
219 | 211 | ||
220 | printk("bt832: command %x\n",cmd); | 212 | printk("bt832: command %x\n",cmd); |
221 | 213 | ||
@@ -249,19 +241,18 @@ static struct i2c_driver driver = { | |||
249 | }; | 241 | }; |
250 | static struct i2c_client client_template = | 242 | static struct i2c_client client_template = |
251 | { | 243 | { |
252 | .name = "bt832", | 244 | I2C_DEVNAME("bt832"), |
253 | .flags = I2C_CLIENT_ALLOW_USE, | 245 | .flags = I2C_CLIENT_ALLOW_USE, |
254 | .driver = &driver, | 246 | .driver = &driver, |
255 | }; | 247 | }; |
256 | 248 | ||
257 | 249 | ||
258 | int bt832_init_module(void) | 250 | static int __init bt832_init_module(void) |
259 | { | 251 | { |
260 | i2c_add_driver(&driver); | 252 | return i2c_add_driver(&driver); |
261 | return 0; | ||
262 | } | 253 | } |
263 | 254 | ||
264 | static void bt832_cleanup_module(void) | 255 | static void __exit bt832_cleanup_module(void) |
265 | { | 256 | { |
266 | i2c_del_driver(&driver); | 257 | i2c_del_driver(&driver); |
267 | } | 258 | } |
@@ -269,3 +260,10 @@ static void bt832_cleanup_module(void) | |||
269 | module_init(bt832_init_module); | 260 | module_init(bt832_init_module); |
270 | module_exit(bt832_cleanup_module); | 261 | module_exit(bt832_cleanup_module); |
271 | 262 | ||
263 | /* | ||
264 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
265 | * --------------------------------------------------------------------------- | ||
266 | * Local variables: | ||
267 | * c-basic-offset: 8 | ||
268 | * End: | ||
269 | */ | ||
diff --git a/drivers/media/video/bt832.h b/drivers/media/video/bt832.h index 7a98c06e0e34..9b6a8d2c96b5 100644 --- a/drivers/media/video/bt832.h +++ b/drivers/media/video/bt832.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Bt832 CMOS Camera Video Processor (VP) | 1 | /* Bt832 CMOS Camera Video Processor (VP) |
2 | 2 | ||
3 | The Bt832 CMOS Camera Video Processor chip connects a Quartsight CMOS | 3 | The Bt832 CMOS Camera Video Processor chip connects a Quartsight CMOS |
4 | color digital camera directly to video capture devices via an 8-bit, | 4 | color digital camera directly to video capture devices via an 8-bit, |
5 | 4:2:2 YUV or YCrCb video interface. | 5 | 4:2:2 YUV or YCrCb video interface. |
6 | 6 | ||
@@ -85,7 +85,7 @@ | |||
85 | #define BT832_DEVICE_ID 63 | 85 | #define BT832_DEVICE_ID 63 |
86 | # define BT832_DEVICE_ID__31 0x31 // Bt832 has ID 0x31 | 86 | # define BT832_DEVICE_ID__31 0x31 // Bt832 has ID 0x31 |
87 | 87 | ||
88 | /* STMicroelectronivcs VV5404 camera module | 88 | /* STMicroelectronivcs VV5404 camera module |
89 | i2c: 0x20: sensor address | 89 | i2c: 0x20: sensor address |
90 | i2c: 0xa0: eeprom for ccd defect map | 90 | i2c: 0xa0: eeprom for ccd defect map |
91 | */ | 91 | */ |
@@ -256,26 +256,26 @@ For the CCIR-601 standards, the sampling is based on a static orthogonal samplin | |||
256 | //=========================================================================== | 256 | //=========================================================================== |
257 | // Timing generator SRAM table values for CCIR601 720x480 NTSC | 257 | // Timing generator SRAM table values for CCIR601 720x480 NTSC |
258 | //=========================================================================== | 258 | //=========================================================================== |
259 | // For NTSC CCIR656 | 259 | // For NTSC CCIR656 |
260 | BYTE BtCard::SRAMTable_NTSC[] = | 260 | BYTE BtCard::SRAMTable_NTSC[] = |
261 | { | 261 | { |
262 | // SRAM Timing Table for NTSC | 262 | // SRAM Timing Table for NTSC |
263 | 0x0c, 0xc0, 0x00, | 263 | 0x0c, 0xc0, 0x00, |
264 | 0x00, 0x90, 0xc2, | 264 | 0x00, 0x90, 0xc2, |
265 | 0x03, 0x10, 0x03, | 265 | 0x03, 0x10, 0x03, |
266 | 0x06, 0x10, 0x34, | 266 | 0x06, 0x10, 0x34, |
267 | 0x12, 0x12, 0x65, | 267 | 0x12, 0x12, 0x65, |
268 | 0x02, 0x13, 0x24, | 268 | 0x02, 0x13, 0x24, |
269 | 0x19, 0x00, 0x24, | 269 | 0x19, 0x00, 0x24, |
270 | 0x39, 0x00, 0x96, | 270 | 0x39, 0x00, 0x96, |
271 | 0x59, 0x08, 0x93, | 271 | 0x59, 0x08, 0x93, |
272 | 0x83, 0x08, 0x97, | 272 | 0x83, 0x08, 0x97, |
273 | 0x03, 0x50, 0x30, | 273 | 0x03, 0x50, 0x30, |
274 | 0xc0, 0x40, 0x30, | 274 | 0xc0, 0x40, 0x30, |
275 | 0x86, 0x01, 0x01, | 275 | 0x86, 0x01, 0x01, |
276 | 0xa6, 0x0d, 0x62, | 276 | 0xa6, 0x0d, 0x62, |
277 | 0x03, 0x11, 0x61, | 277 | 0x03, 0x11, 0x61, |
278 | 0x05, 0x37, 0x30, | 278 | 0x05, 0x37, 0x30, |
279 | 0xac, 0x21, 0x50 | 279 | 0xac, 0x21, 0x50 |
280 | }; | 280 | }; |
281 | 281 | ||
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index 72c7eb0f8c24..a5d529ccf3ad 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c | |||
@@ -288,22 +288,14 @@ bt856_command (struct i2c_client *client, | |||
288 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' | 288 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' |
289 | */ | 289 | */ |
290 | static unsigned short normal_i2c[] = { I2C_BT856 >> 1, I2C_CLIENT_END }; | 290 | static unsigned short normal_i2c[] = { I2C_BT856 >> 1, I2C_CLIENT_END }; |
291 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | ||
292 | 291 | ||
293 | static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | 292 | static unsigned short ignore = I2C_CLIENT_END; |
294 | static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
295 | static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
296 | static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
297 | static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END }; | ||
298 | 293 | ||
299 | static struct i2c_client_address_data addr_data = { | 294 | static struct i2c_client_address_data addr_data = { |
300 | .normal_i2c = normal_i2c, | 295 | .normal_i2c = normal_i2c, |
301 | .normal_i2c_range = normal_i2c_range, | 296 | .probe = &ignore, |
302 | .probe = probe, | 297 | .ignore = &ignore, |
303 | .probe_range = probe_range, | 298 | .force = &ignore, |
304 | .ignore = ignore, | ||
305 | .ignore_range = ignore_range, | ||
306 | .force = force | ||
307 | }; | 299 | }; |
308 | 300 | ||
309 | static struct i2c_driver i2c_driver_bt856; | 301 | static struct i2c_driver i2c_driver_bt856; |
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 6334122704ae..a97b9b958ed6 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-cards.c,v 1.47 2005/02/22 14:06:32 kraxel Exp $ | 2 | $Id: bttv-cards.c,v 1.54 2005/07/19 18:26:46 mkrufky Exp $ |
3 | 3 | ||
4 | bttv-cards.c | 4 | bttv-cards.c |
5 | 5 | ||
@@ -39,9 +39,6 @@ | |||
39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
40 | 40 | ||
41 | #include "bttvp.h" | 41 | #include "bttvp.h" |
42 | #if 0 /* not working yet */ | ||
43 | #include "bt832.h" | ||
44 | #endif | ||
45 | 42 | ||
46 | /* fwd decl */ | 43 | /* fwd decl */ |
47 | static void boot_msp34xx(struct bttv *btv, int pin); | 44 | static void boot_msp34xx(struct bttv *btv, int pin); |
@@ -51,6 +48,7 @@ static void avermedia_eeprom(struct bttv *btv); | |||
51 | static void osprey_eeprom(struct bttv *btv); | 48 | static void osprey_eeprom(struct bttv *btv); |
52 | static void modtec_eeprom(struct bttv *btv); | 49 | static void modtec_eeprom(struct bttv *btv); |
53 | static void init_PXC200(struct bttv *btv); | 50 | static void init_PXC200(struct bttv *btv); |
51 | static void init_RTV24(struct bttv *btv); | ||
54 | 52 | ||
55 | static void winview_audio(struct bttv *btv, struct video_audio *v, int set); | 53 | static void winview_audio(struct bttv *btv, struct video_audio *v, int set); |
56 | static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set); | 54 | static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set); |
@@ -97,7 +95,7 @@ static int __devinit pvr_boot(struct bttv *btv); | |||
97 | static unsigned int triton1=0; | 95 | static unsigned int triton1=0; |
98 | static unsigned int vsfx=0; | 96 | static unsigned int vsfx=0; |
99 | static unsigned int latency = UNSET; | 97 | static unsigned int latency = UNSET; |
100 | static unsigned int no_overlay=-1; | 98 | int no_overlay=-1; |
101 | 99 | ||
102 | static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET }; | 100 | static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET }; |
103 | static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET }; | 101 | static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET }; |
@@ -512,13 +510,8 @@ struct tvcard bttv_tvcards[] = { | |||
512 | .svhs = 2, | 510 | .svhs = 2, |
513 | .gpiomask = 0x01fe00, | 511 | .gpiomask = 0x01fe00, |
514 | .muxsel = { 2, 3, 1, 1}, | 512 | .muxsel = { 2, 3, 1, 1}, |
515 | #if 0 | ||
516 | // old | ||
517 | .audiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 }, | ||
518 | #else | ||
519 | // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> | 513 | // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> |
520 | .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, | 514 | .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, |
521 | #endif | ||
522 | .needs_tvaudio = 1, | 515 | .needs_tvaudio = 1, |
523 | .pll = PLL_28, | 516 | .pll = PLL_28, |
524 | .tuner_type = -1, | 517 | .tuner_type = -1, |
@@ -765,14 +758,9 @@ struct tvcard bttv_tvcards[] = { | |||
765 | .tuner = 0, | 758 | .tuner = 0, |
766 | .svhs = 2, | 759 | .svhs = 2, |
767 | .muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector | 760 | .muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector |
768 | #if 0 | ||
769 | .gpiomask = 0xc33000, | ||
770 | .audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 }, | ||
771 | #else | ||
772 | /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */ | 761 | /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */ |
773 | .gpiomask = 0xb33000, | 762 | .gpiomask = 0xb33000, |
774 | .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 }, | 763 | .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 }, |
775 | #endif | ||
776 | /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) | 764 | /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) |
777 | gpio23 -- hef4052:nEnable (0x800000) | 765 | gpio23 -- hef4052:nEnable (0x800000) |
778 | gpio12 -- hef4052:A1 | 766 | gpio12 -- hef4052:A1 |
@@ -1602,20 +1590,11 @@ struct tvcard bttv_tvcards[] = { | |||
1602 | .video_inputs = 4, | 1590 | .video_inputs = 4, |
1603 | .audio_inputs = 1, | 1591 | .audio_inputs = 1, |
1604 | .tuner = -1, | 1592 | .tuner = -1, |
1605 | #if 0 /* TODO ... */ | ||
1606 | .svhs = OSPREY540_SVID_ANALOG, | ||
1607 | .muxsel = { [OSPREY540_COMP_ANALOG] = 2, | ||
1608 | [OSPREY540_SVID_ANALOG] = 3, }, | ||
1609 | #endif | ||
1610 | .pll = PLL_28, | 1593 | .pll = PLL_28, |
1611 | .tuner_type = -1, | 1594 | .tuner_type = -1, |
1612 | .no_msp34xx = 1, | 1595 | .no_msp34xx = 1, |
1613 | .no_tda9875 = 1, | 1596 | .no_tda9875 = 1, |
1614 | .no_tda7432 = 1, | 1597 | .no_tda7432 = 1, |
1615 | #if 0 /* TODO ... */ | ||
1616 | .muxsel_hook = osprey_540_muxsel, | ||
1617 | .picture_hook = osprey_540_set_picture, | ||
1618 | #endif | ||
1619 | },{ | 1598 | },{ |
1620 | 1599 | ||
1621 | /* ---- card 0x5C ---------------------------------- */ | 1600 | /* ---- card 0x5C ---------------------------------- */ |
@@ -2251,6 +2230,20 @@ struct tvcard bttv_tvcards[] = { | |||
2251 | .no_tda7432 = 1, | 2230 | .no_tda7432 = 1, |
2252 | .no_tda9875 = 1, | 2231 | .no_tda9875 = 1, |
2253 | .muxsel_hook = kodicom4400r_muxsel, | 2232 | .muxsel_hook = kodicom4400r_muxsel, |
2233 | }, | ||
2234 | { | ||
2235 | /* ---- card 0x85---------------------------------- */ | ||
2236 | /* Michael Henson <mhenson@clarityvi.com> */ | ||
2237 | /* Adlink RTV24 with special unlock codes */ | ||
2238 | .name = "Adlink RTV24", | ||
2239 | .video_inputs = 4, | ||
2240 | .audio_inputs = 1, | ||
2241 | .tuner = 0, | ||
2242 | .svhs = 2, | ||
2243 | .muxsel = { 2, 3, 1, 0}, | ||
2244 | .tuner_type = -1, | ||
2245 | .pll = PLL_28, | ||
2246 | |||
2254 | }}; | 2247 | }}; |
2255 | 2248 | ||
2256 | static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); | 2249 | static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); |
@@ -2531,21 +2524,12 @@ static void eagle_muxsel(struct bttv *btv, unsigned int input) | |||
2531 | btaor((2)<<5, ~(3<<5), BT848_IFORM); | 2524 | btaor((2)<<5, ~(3<<5), BT848_IFORM); |
2532 | gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]); | 2525 | gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]); |
2533 | 2526 | ||
2534 | #if 0 | ||
2535 | /* svhs */ | ||
2536 | /* wake chroma ADC */ | ||
2537 | btand(~BT848_ADC_C_SLEEP, BT848_ADC); | ||
2538 | /* set to YC video */ | ||
2539 | btor(BT848_CONTROL_COMP, BT848_E_CONTROL); | ||
2540 | btor(BT848_CONTROL_COMP, BT848_O_CONTROL); | ||
2541 | #else | ||
2542 | /* composite */ | 2527 | /* composite */ |
2543 | /* set chroma ADC to sleep */ | 2528 | /* set chroma ADC to sleep */ |
2544 | btor(BT848_ADC_C_SLEEP, BT848_ADC); | 2529 | btor(BT848_ADC_C_SLEEP, BT848_ADC); |
2545 | /* set to composite video */ | 2530 | /* set to composite video */ |
2546 | btand(~BT848_CONTROL_COMP, BT848_E_CONTROL); | 2531 | btand(~BT848_CONTROL_COMP, BT848_E_CONTROL); |
2547 | btand(~BT848_CONTROL_COMP, BT848_O_CONTROL); | 2532 | btand(~BT848_CONTROL_COMP, BT848_O_CONTROL); |
2548 | #endif | ||
2549 | 2533 | ||
2550 | /* switch sync drive off */ | 2534 | /* switch sync drive off */ |
2551 | gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE); | 2535 | gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE); |
@@ -2636,6 +2620,10 @@ void __devinit bttv_init_card1(struct bttv *btv) | |||
2636 | case BTTV_AVDVBT_771: | 2620 | case BTTV_AVDVBT_771: |
2637 | btv->use_i2c_hw = 1; | 2621 | btv->use_i2c_hw = 1; |
2638 | break; | 2622 | break; |
2623 | case BTTV_ADLINK_RTV24: | ||
2624 | init_RTV24( btv ); | ||
2625 | break; | ||
2626 | |||
2639 | } | 2627 | } |
2640 | if (!bttv_tvcards[btv->c.type].has_dvb) | 2628 | if (!bttv_tvcards[btv->c.type].has_dvb) |
2641 | bttv_reset_audio(btv); | 2629 | bttv_reset_audio(btv); |
@@ -2792,10 +2780,18 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
2792 | btv->tuner_type = tuner[btv->c.nr]; | 2780 | btv->tuner_type = tuner[btv->c.nr]; |
2793 | printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type); | 2781 | printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type); |
2794 | if (btv->pinnacle_id != UNSET) | 2782 | if (btv->pinnacle_id != UNSET) |
2795 | bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE, | 2783 | bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE, |
2796 | &btv->pinnacle_id); | 2784 | &btv->pinnacle_id); |
2797 | if (btv->tuner_type != UNSET) | 2785 | if (btv->tuner_type != UNSET) { |
2798 | bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type); | 2786 | struct tuner_setup tun_setup; |
2787 | |||
2788 | tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; | ||
2789 | tun_setup.type = btv->tuner_type; | ||
2790 | tun_setup.addr = ADDR_UNSET; | ||
2791 | |||
2792 | bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
2793 | } | ||
2794 | |||
2799 | btv->svhs = bttv_tvcards[btv->c.type].svhs; | 2795 | btv->svhs = bttv_tvcards[btv->c.type].svhs; |
2800 | if (svhs[btv->c.nr] != UNSET) | 2796 | if (svhs[btv->c.nr] != UNSET) |
2801 | btv->svhs = svhs[btv->c.nr]; | 2797 | btv->svhs = svhs[btv->c.nr]; |
@@ -3104,14 +3100,6 @@ static int tuner_0_table[] = { | |||
3104 | TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM, | 3100 | TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM, |
3105 | TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL, | 3101 | TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL, |
3106 | TUNER_PHILIPS_FM1216ME_MK3 }; | 3102 | TUNER_PHILIPS_FM1216ME_MK3 }; |
3107 | #if 0 | ||
3108 | int tuner_0_fm_table[] = { | ||
3109 | PHILIPS_FR1236_NTSC, PHILIPS_FR1216_PAL, | ||
3110 | PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL, | ||
3111 | PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL, | ||
3112 | PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM, | ||
3113 | PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL}; | ||
3114 | #endif | ||
3115 | 3103 | ||
3116 | static int tuner_1_table[] = { | 3104 | static int tuner_1_table[] = { |
3117 | TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL, | 3105 | TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL, |
@@ -3197,36 +3185,6 @@ static void __devinit boot_msp34xx(struct bttv *btv, int pin) | |||
3197 | 3185 | ||
3198 | static void __devinit boot_bt832(struct bttv *btv) | 3186 | static void __devinit boot_bt832(struct bttv *btv) |
3199 | { | 3187 | { |
3200 | #if 0 /* not working yet */ | ||
3201 | int resetbit=0; | ||
3202 | |||
3203 | switch (btv->c.type) { | ||
3204 | case BTTV_PXELVWPLTVPAK: | ||
3205 | resetbit = 0x400000; | ||
3206 | break; | ||
3207 | case BTTV_MODTEC_205: | ||
3208 | resetbit = 1<<9; | ||
3209 | break; | ||
3210 | default: | ||
3211 | BUG(); | ||
3212 | } | ||
3213 | |||
3214 | request_module("bt832"); | ||
3215 | bttv_call_i2c_clients(btv, BT832_HEXDUMP, NULL); | ||
3216 | |||
3217 | printk("bttv%d: Reset Bt832 [line=0x%x]\n",btv->c.nr,resetbit); | ||
3218 | gpio_write(0); | ||
3219 | gpio_inout(resetbit, resetbit); | ||
3220 | udelay(5); | ||
3221 | gpio_bits(resetbit, resetbit); | ||
3222 | udelay(5); | ||
3223 | gpio_bits(resetbit, 0); | ||
3224 | udelay(5); | ||
3225 | |||
3226 | // bt832 on pixelview changes from i2c 0x8a to 0x88 after | ||
3227 | // being reset as above. So we must follow by this: | ||
3228 | bttv_call_i2c_clients(btv, BT832_REATTACH, NULL); | ||
3229 | #endif | ||
3230 | } | 3188 | } |
3231 | 3189 | ||
3232 | /* ----------------------------------------------------------------------- */ | 3190 | /* ----------------------------------------------------------------------- */ |
@@ -3304,6 +3262,83 @@ static void __devinit init_PXC200(struct bttv *btv) | |||
3304 | } | 3262 | } |
3305 | 3263 | ||
3306 | 3264 | ||
3265 | |||
3266 | /* ----------------------------------------------------------------------- */ | ||
3267 | /* | ||
3268 | * The Adlink RTV-24 (aka Angelo) has some special initialisation to unlock | ||
3269 | * it. This apparently involves the following procedure for each 878 chip: | ||
3270 | * | ||
3271 | * 1) write 0x00C3FEFF to the GPIO_OUT_EN register | ||
3272 | * | ||
3273 | * 2) write to GPIO_DATA | ||
3274 | * - 0x0E | ||
3275 | * - sleep 1ms | ||
3276 | * - 0x10 + 0x0E | ||
3277 | * - sleep 10ms | ||
3278 | * - 0x0E | ||
3279 | * read from GPIO_DATA into buf (uint_32) | ||
3280 | * - if ( data>>18 & 0x01 != 0) || ( buf>>19 & 0x01 != 1 ) | ||
3281 | * error. ERROR_CPLD_Check_Failed stop. | ||
3282 | * | ||
3283 | * 3) write to GPIO_DATA | ||
3284 | * - write 0x4400 + 0x0E | ||
3285 | * - sleep 10ms | ||
3286 | * - write 0x4410 + 0x0E | ||
3287 | * - sleep 1ms | ||
3288 | * - write 0x0E | ||
3289 | * read from GPIO_DATA into buf (uint_32) | ||
3290 | * - if ( buf>>18 & 0x01 ) || ( buf>>19 && 0x01 != 0 ) | ||
3291 | * error. ERROR_CPLD_Check_Failed. | ||
3292 | */ | ||
3293 | /* ----------------------------------------------------------------------- */ | ||
3294 | void | ||
3295 | init_RTV24 (struct bttv *btv) | ||
3296 | { | ||
3297 | uint32_t dataRead = 0; | ||
3298 | long watchdog_value = 0x0E; | ||
3299 | |||
3300 | printk (KERN_INFO | ||
3301 | "bttv%d: Adlink RTV-24 initialisation in progress ...\n", | ||
3302 | btv->c.nr); | ||
3303 | |||
3304 | btwrite (0x00c3feff, BT848_GPIO_OUT_EN); | ||
3305 | |||
3306 | btwrite (0 + watchdog_value, BT848_GPIO_DATA); | ||
3307 | msleep (1); | ||
3308 | btwrite (0x10 + watchdog_value, BT848_GPIO_DATA); | ||
3309 | msleep (10); | ||
3310 | btwrite (0 + watchdog_value, BT848_GPIO_DATA); | ||
3311 | |||
3312 | dataRead = btread (BT848_GPIO_DATA); | ||
3313 | |||
3314 | if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 1)) { | ||
3315 | printk (KERN_INFO | ||
3316 | "bttv%d: Adlink RTV-24 initialisation(1) ERROR_CPLD_Check_Failed (read %d)\n", | ||
3317 | btv->c.nr, dataRead); | ||
3318 | } | ||
3319 | |||
3320 | btwrite (0x4400 + watchdog_value, BT848_GPIO_DATA); | ||
3321 | msleep (10); | ||
3322 | btwrite (0x4410 + watchdog_value, BT848_GPIO_DATA); | ||
3323 | msleep (1); | ||
3324 | btwrite (watchdog_value, BT848_GPIO_DATA); | ||
3325 | msleep (1); | ||
3326 | dataRead = btread (BT848_GPIO_DATA); | ||
3327 | |||
3328 | if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 0)) { | ||
3329 | printk (KERN_INFO | ||
3330 | "bttv%d: Adlink RTV-24 initialisation(2) ERROR_CPLD_Check_Failed (read %d)\n", | ||
3331 | btv->c.nr, dataRead); | ||
3332 | |||
3333 | return; | ||
3334 | } | ||
3335 | |||
3336 | printk (KERN_INFO | ||
3337 | "bttv%d: Adlink RTV-24 initialisation complete.\n", btv->c.nr); | ||
3338 | } | ||
3339 | |||
3340 | |||
3341 | |||
3307 | /* ----------------------------------------------------------------------- */ | 3342 | /* ----------------------------------------------------------------------- */ |
3308 | /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */ | 3343 | /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */ |
3309 | /* | 3344 | /* |
@@ -3474,11 +3509,6 @@ void tea5757_set_freq(struct bttv *btv, unsigned short freq) | |||
3474 | { | 3509 | { |
3475 | dprintk("tea5757_set_freq %d\n",freq); | 3510 | dprintk("tea5757_set_freq %d\n",freq); |
3476 | tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */ | 3511 | tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */ |
3477 | #if 0 | ||
3478 | /* breaks Miro PCTV */ | ||
3479 | value = tea5757_read(btv); | ||
3480 | dprintk("bttv%d: tea5757 readback=0x%x\n",btv->c.nr,value); | ||
3481 | #endif | ||
3482 | } | 3512 | } |
3483 | 3513 | ||
3484 | 3514 | ||
@@ -3558,13 +3588,8 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set) | |||
3558 | { | 3588 | { |
3559 | unsigned int val, con; | 3589 | unsigned int val, con; |
3560 | 3590 | ||
3561 | #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0) | ||
3562 | if (btv->radio_user) | 3591 | if (btv->radio_user) |
3563 | return; | 3592 | return; |
3564 | #else | ||
3565 | if (btv->radio) | ||
3566 | return; | ||
3567 | #endif | ||
3568 | 3593 | ||
3569 | val = gpio_read(); | 3594 | val = gpio_read(); |
3570 | if (set) { | 3595 | if (set) { |
@@ -3753,13 +3778,8 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set) | |||
3753 | { | 3778 | { |
3754 | unsigned int val = 0; | 3779 | unsigned int val = 0; |
3755 | 3780 | ||
3756 | #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0) | ||
3757 | if (btv->radio_user) | 3781 | if (btv->radio_user) |
3758 | return; | 3782 | return; |
3759 | #else | ||
3760 | if (btv->radio) | ||
3761 | return; | ||
3762 | #endif | ||
3763 | 3783 | ||
3764 | if (set) { | 3784 | if (set) { |
3765 | if (v->mode & VIDEO_SOUND_MONO) { | 3785 | if (v->mode & VIDEO_SOUND_MONO) { |
@@ -3790,13 +3810,8 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) | |||
3790 | { | 3810 | { |
3791 | unsigned int val = 0xffff; | 3811 | unsigned int val = 0xffff; |
3792 | 3812 | ||
3793 | #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0) | ||
3794 | if (btv->radio_user) | 3813 | if (btv->radio_user) |
3795 | return; | 3814 | return; |
3796 | #else | ||
3797 | if (btv->radio) | ||
3798 | return; | ||
3799 | #endif | ||
3800 | if (set) { | 3815 | if (set) { |
3801 | if (v->mode & VIDEO_SOUND_MONO) { | 3816 | if (v->mode & VIDEO_SOUND_MONO) { |
3802 | val = 0x0000; | 3817 | val = 0x0000; |
@@ -4273,11 +4288,6 @@ void __devinit bttv_check_chipset(void) | |||
4273 | latency = 0x0A; | 4288 | latency = 0x0A; |
4274 | #endif | 4289 | #endif |
4275 | 4290 | ||
4276 | #if 0 | ||
4277 | /* print which chipset we have */ | ||
4278 | while ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8,dev))) | ||
4279 | printk(KERN_INFO "bttv: Host bridge is %s\n",pci_name(dev)); | ||
4280 | #endif | ||
4281 | 4291 | ||
4282 | /* print warnings about any quirks found */ | 4292 | /* print warnings about any quirks found */ |
4283 | if (triton1) | 4293 | if (triton1) |
@@ -4286,9 +4296,11 @@ void __devinit bttv_check_chipset(void) | |||
4286 | printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n"); | 4296 | printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n"); |
4287 | if (pcipci_fail) { | 4297 | if (pcipci_fail) { |
4288 | printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n"); | 4298 | printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n"); |
4289 | if (UNSET == no_overlay) { | 4299 | if (!no_overlay) { |
4290 | printk(KERN_WARNING "bttv: going to disable overlay.\n"); | 4300 | printk(KERN_WARNING "bttv: overlay will be disabled.\n"); |
4291 | no_overlay = 1; | 4301 | no_overlay = 1; |
4302 | } else { | ||
4303 | printk(KERN_WARNING "bttv: overlay forced. Use this option at your own risk.\n"); | ||
4292 | } | 4304 | } |
4293 | } | 4305 | } |
4294 | if (UNSET != latency) | 4306 | if (UNSET != latency) |
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 033cc5498f23..eee9322ce21b 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-driver.c,v 1.37 2005/02/21 13:57:59 kraxel Exp $ | 2 | $Id: bttv-driver.c,v 1.52 2005/08/04 00:55:16 mchehab Exp $ |
3 | 3 | ||
4 | bttv - Bt848 frame grabber driver | 4 | bttv - Bt848 frame grabber driver |
5 | 5 | ||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
37 | #include <linux/kdev_t.h> | 37 | #include <linux/kdev_t.h> |
38 | #include <linux/dma-mapping.h> | ||
38 | 39 | ||
39 | #include <asm/io.h> | 40 | #include <asm/io.h> |
40 | #include <asm/byteorder.h> | 41 | #include <asm/byteorder.h> |
@@ -76,6 +77,10 @@ static unsigned int whitecrush_upper = 0xCF; | |||
76 | static unsigned int whitecrush_lower = 0x7F; | 77 | static unsigned int whitecrush_lower = 0x7F; |
77 | static unsigned int vcr_hack = 0; | 78 | static unsigned int vcr_hack = 0; |
78 | static unsigned int irq_iswitch = 0; | 79 | static unsigned int irq_iswitch = 0; |
80 | static unsigned int uv_ratio = 50; | ||
81 | static unsigned int full_luma_range = 0; | ||
82 | static unsigned int coring = 0; | ||
83 | extern int no_overlay; | ||
79 | 84 | ||
80 | /* API features (turn on/off stuff for testing) */ | 85 | /* API features (turn on/off stuff for testing) */ |
81 | static unsigned int v4l2 = 1; | 86 | static unsigned int v4l2 = 1; |
@@ -106,6 +111,9 @@ module_param(adc_crush, int, 0444); | |||
106 | module_param(whitecrush_upper, int, 0444); | 111 | module_param(whitecrush_upper, int, 0444); |
107 | module_param(whitecrush_lower, int, 0444); | 112 | module_param(whitecrush_lower, int, 0444); |
108 | module_param(vcr_hack, int, 0444); | 113 | module_param(vcr_hack, int, 0444); |
114 | module_param(uv_ratio, int, 0444); | ||
115 | module_param(full_luma_range, int, 0444); | ||
116 | module_param(coring, int, 0444); | ||
109 | 117 | ||
110 | module_param_array(radio, int, NULL, 0444); | 118 | module_param_array(radio, int, NULL, 0444); |
111 | 119 | ||
@@ -124,6 +132,9 @@ MODULE_PARM_DESC(whitecrush_upper,"sets the white crush upper value, default is | |||
124 | MODULE_PARM_DESC(whitecrush_lower,"sets the white crush lower value, default is 127"); | 132 | MODULE_PARM_DESC(whitecrush_lower,"sets the white crush lower value, default is 127"); |
125 | MODULE_PARM_DESC(vcr_hack,"enables the VCR hack (improves synch on poor VCR tapes), default is 0 (no)"); | 133 | MODULE_PARM_DESC(vcr_hack,"enables the VCR hack (improves synch on poor VCR tapes), default is 0 (no)"); |
126 | MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler"); | 134 | MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler"); |
135 | MODULE_PARM_DESC(uv_ratio,"ratio between u and v gains, default is 50"); | ||
136 | MODULE_PARM_DESC(full_luma_range,"use the full luma range, default is 0 (no)"); | ||
137 | MODULE_PARM_DESC(coring,"set the luma coring level, default is 0 (no)"); | ||
127 | 138 | ||
128 | MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); | 139 | MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); |
129 | MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); | 140 | MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); |
@@ -484,7 +495,10 @@ static const unsigned int BTTV_FORMATS = ARRAY_SIZE(bttv_formats); | |||
484 | #define V4L2_CID_PRIVATE_VCR_HACK (V4L2_CID_PRIVATE_BASE + 5) | 495 | #define V4L2_CID_PRIVATE_VCR_HACK (V4L2_CID_PRIVATE_BASE + 5) |
485 | #define V4L2_CID_PRIVATE_WHITECRUSH_UPPER (V4L2_CID_PRIVATE_BASE + 6) | 496 | #define V4L2_CID_PRIVATE_WHITECRUSH_UPPER (V4L2_CID_PRIVATE_BASE + 6) |
486 | #define V4L2_CID_PRIVATE_WHITECRUSH_LOWER (V4L2_CID_PRIVATE_BASE + 7) | 497 | #define V4L2_CID_PRIVATE_WHITECRUSH_LOWER (V4L2_CID_PRIVATE_BASE + 7) |
487 | #define V4L2_CID_PRIVATE_LASTP1 (V4L2_CID_PRIVATE_BASE + 8) | 498 | #define V4L2_CID_PRIVATE_UV_RATIO (V4L2_CID_PRIVATE_BASE + 8) |
499 | #define V4L2_CID_PRIVATE_FULL_LUMA_RANGE (V4L2_CID_PRIVATE_BASE + 9) | ||
500 | #define V4L2_CID_PRIVATE_CORING (V4L2_CID_PRIVATE_BASE + 10) | ||
501 | #define V4L2_CID_PRIVATE_LASTP1 (V4L2_CID_PRIVATE_BASE + 11) | ||
488 | 502 | ||
489 | static const struct v4l2_queryctrl no_ctl = { | 503 | static const struct v4l2_queryctrl no_ctl = { |
490 | .name = "42", | 504 | .name = "42", |
@@ -618,8 +632,32 @@ static const struct v4l2_queryctrl bttv_ctls[] = { | |||
618 | .step = 1, | 632 | .step = 1, |
619 | .default_value = 0x7F, | 633 | .default_value = 0x7F, |
620 | .type = V4L2_CTRL_TYPE_INTEGER, | 634 | .type = V4L2_CTRL_TYPE_INTEGER, |
635 | },{ | ||
636 | .id = V4L2_CID_PRIVATE_UV_RATIO, | ||
637 | .name = "uv ratio", | ||
638 | .minimum = 0, | ||
639 | .maximum = 100, | ||
640 | .step = 1, | ||
641 | .default_value = 50, | ||
642 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
643 | },{ | ||
644 | .id = V4L2_CID_PRIVATE_FULL_LUMA_RANGE, | ||
645 | .name = "full luma range", | ||
646 | .minimum = 0, | ||
647 | .maximum = 1, | ||
648 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
649 | },{ | ||
650 | .id = V4L2_CID_PRIVATE_CORING, | ||
651 | .name = "coring", | ||
652 | .minimum = 0, | ||
653 | .maximum = 3, | ||
654 | .step = 1, | ||
655 | .default_value = 0, | ||
656 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
621 | } | 657 | } |
622 | 658 | ||
659 | |||
660 | |||
623 | }; | 661 | }; |
624 | static const int BTTV_CTLS = ARRAY_SIZE(bttv_ctls); | 662 | static const int BTTV_CTLS = ARRAY_SIZE(bttv_ctls); |
625 | 663 | ||
@@ -662,12 +700,10 @@ int locked_btres(struct bttv *btv, int bit) | |||
662 | static | 700 | static |
663 | void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits) | 701 | void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits) |
664 | { | 702 | { |
665 | #if 1 /* DEBUG */ | ||
666 | if ((fh->resources & bits) != bits) { | 703 | if ((fh->resources & bits) != bits) { |
667 | /* trying to free ressources not allocated by us ... */ | 704 | /* trying to free ressources not allocated by us ... */ |
668 | printk("bttv: BUG! (btres)\n"); | 705 | printk("bttv: BUG! (btres)\n"); |
669 | } | 706 | } |
670 | #endif | ||
671 | down(&btv->reslock); | 707 | down(&btv->reslock); |
672 | fh->resources &= ~bits; | 708 | fh->resources &= ~bits; |
673 | btv->resources &= ~bits; | 709 | btv->resources &= ~bits; |
@@ -833,8 +869,8 @@ static void bt848_sat(struct bttv *btv, int color) | |||
833 | btv->saturation = color; | 869 | btv->saturation = color; |
834 | 870 | ||
835 | /* 0-511 for the color */ | 871 | /* 0-511 for the color */ |
836 | val_u = color >> 7; | 872 | val_u = ((color * btv->opt_uv_ratio) / 50) >> 7; |
837 | val_v = ((color>>7)*180L)/254; | 873 | val_v = (((color * (100 - btv->opt_uv_ratio) / 50) >>7)*180L)/254; |
838 | hibits = (val_u >> 7) & 2; | 874 | hibits = (val_u >> 7) & 2; |
839 | hibits |= (val_v >> 8) & 1; | 875 | hibits |= (val_v >> 8) & 1; |
840 | btwrite(val_u & 0xff, BT848_SAT_U_LO); | 876 | btwrite(val_u & 0xff, BT848_SAT_U_LO); |
@@ -907,11 +943,6 @@ audio_mux(struct bttv *btv, int mode) | |||
907 | i2c_mux = mux = (btv->audio & AUDIO_MUTE) ? AUDIO_OFF : btv->audio; | 943 | i2c_mux = mux = (btv->audio & AUDIO_MUTE) ? AUDIO_OFF : btv->audio; |
908 | if (btv->opt_automute && !signal && !btv->radio_user) | 944 | if (btv->opt_automute && !signal && !btv->radio_user) |
909 | mux = AUDIO_OFF; | 945 | mux = AUDIO_OFF; |
910 | #if 0 | ||
911 | printk("bttv%d: amux: mode=%d audio=%d signal=%s mux=%d/%d irq=%s\n", | ||
912 | btv->c.nr, mode, btv->audio, signal ? "yes" : "no", | ||
913 | mux, i2c_mux, in_interrupt() ? "yes" : "no"); | ||
914 | #endif | ||
915 | 946 | ||
916 | val = bttv_tvcards[btv->c.type].audiomux[mux]; | 947 | val = bttv_tvcards[btv->c.type].audiomux[mux]; |
917 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask,val); | 948 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask,val); |
@@ -958,11 +989,6 @@ set_tvnorm(struct bttv *btv, unsigned int norm) | |||
958 | case BTTV_VOODOOTV_FM: | 989 | case BTTV_VOODOOTV_FM: |
959 | bttv_tda9880_setnorm(btv,norm); | 990 | bttv_tda9880_setnorm(btv,norm); |
960 | break; | 991 | break; |
961 | #if 0 | ||
962 | case BTTV_OSPREY540: | ||
963 | osprey_540_set_norm(btv,norm); | ||
964 | break; | ||
965 | #endif | ||
966 | } | 992 | } |
967 | return 0; | 993 | return 0; |
968 | } | 994 | } |
@@ -1151,6 +1177,15 @@ static int get_control(struct bttv *btv, struct v4l2_control *c) | |||
1151 | case V4L2_CID_PRIVATE_WHITECRUSH_LOWER: | 1177 | case V4L2_CID_PRIVATE_WHITECRUSH_LOWER: |
1152 | c->value = btv->opt_whitecrush_lower; | 1178 | c->value = btv->opt_whitecrush_lower; |
1153 | break; | 1179 | break; |
1180 | case V4L2_CID_PRIVATE_UV_RATIO: | ||
1181 | c->value = btv->opt_uv_ratio; | ||
1182 | break; | ||
1183 | case V4L2_CID_PRIVATE_FULL_LUMA_RANGE: | ||
1184 | c->value = btv->opt_full_luma_range; | ||
1185 | break; | ||
1186 | case V4L2_CID_PRIVATE_CORING: | ||
1187 | c->value = btv->opt_coring; | ||
1188 | break; | ||
1154 | default: | 1189 | default: |
1155 | return -EINVAL; | 1190 | return -EINVAL; |
1156 | } | 1191 | } |
@@ -1247,6 +1282,18 @@ static int set_control(struct bttv *btv, struct v4l2_control *c) | |||
1247 | btv->opt_whitecrush_lower = c->value; | 1282 | btv->opt_whitecrush_lower = c->value; |
1248 | btwrite(c->value, BT848_WC_DOWN); | 1283 | btwrite(c->value, BT848_WC_DOWN); |
1249 | break; | 1284 | break; |
1285 | case V4L2_CID_PRIVATE_UV_RATIO: | ||
1286 | btv->opt_uv_ratio = c->value; | ||
1287 | bt848_sat(btv, btv->saturation); | ||
1288 | break; | ||
1289 | case V4L2_CID_PRIVATE_FULL_LUMA_RANGE: | ||
1290 | btv->opt_full_luma_range = c->value; | ||
1291 | btaor((c->value<<7), ~BT848_OFORM_RANGE, BT848_OFORM); | ||
1292 | break; | ||
1293 | case V4L2_CID_PRIVATE_CORING: | ||
1294 | btv->opt_coring = c->value; | ||
1295 | btaor((c->value<<5), ~BT848_OFORM_CORE32, BT848_OFORM); | ||
1296 | break; | ||
1250 | default: | 1297 | default: |
1251 | return -EINVAL; | 1298 | return -EINVAL; |
1252 | } | 1299 | } |
@@ -1792,7 +1839,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) | |||
1792 | 1839 | ||
1793 | if (unlikely(f->tuner != 0)) | 1840 | if (unlikely(f->tuner != 0)) |
1794 | return -EINVAL; | 1841 | return -EINVAL; |
1795 | if (unlikely(f->type != V4L2_TUNER_ANALOG_TV)) | 1842 | if (unlikely (f->type != V4L2_TUNER_ANALOG_TV)) |
1796 | return -EINVAL; | 1843 | return -EINVAL; |
1797 | down(&btv->lock); | 1844 | down(&btv->lock); |
1798 | btv->freq = f->frequency; | 1845 | btv->freq = f->frequency; |
@@ -2105,6 +2152,10 @@ static int bttv_s_fmt(struct bttv_fh *fh, struct bttv *btv, | |||
2105 | return 0; | 2152 | return 0; |
2106 | } | 2153 | } |
2107 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: | 2154 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: |
2155 | if (no_overlay > 0) { | ||
2156 | printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n"); | ||
2157 | return -EINVAL; | ||
2158 | } | ||
2108 | return setup_window(fh, btv, &f->fmt.win, 1); | 2159 | return setup_window(fh, btv, &f->fmt.win, 1); |
2109 | case V4L2_BUF_TYPE_VBI_CAPTURE: | 2160 | case V4L2_BUF_TYPE_VBI_CAPTURE: |
2110 | retval = bttv_switch_type(fh,f->type); | 2161 | retval = bttv_switch_type(fh,f->type); |
@@ -2178,9 +2229,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2178 | /* others */ | 2229 | /* others */ |
2179 | cap->type = VID_TYPE_CAPTURE| | 2230 | cap->type = VID_TYPE_CAPTURE| |
2180 | VID_TYPE_TUNER| | 2231 | VID_TYPE_TUNER| |
2181 | VID_TYPE_OVERLAY| | ||
2182 | VID_TYPE_CLIPPING| | 2232 | VID_TYPE_CLIPPING| |
2183 | VID_TYPE_SCALES; | 2233 | VID_TYPE_SCALES; |
2234 | if (no_overlay <= 0) | ||
2235 | cap->type |= VID_TYPE_OVERLAY; | ||
2236 | |||
2184 | cap->maxwidth = bttv_tvnorms[btv->tvnorm].swidth; | 2237 | cap->maxwidth = bttv_tvnorms[btv->tvnorm].swidth; |
2185 | cap->maxheight = bttv_tvnorms[btv->tvnorm].sheight; | 2238 | cap->maxheight = bttv_tvnorms[btv->tvnorm].sheight; |
2186 | cap->minwidth = 48; | 2239 | cap->minwidth = 48; |
@@ -2256,6 +2309,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2256 | struct video_window *win = arg; | 2309 | struct video_window *win = arg; |
2257 | struct v4l2_window w2; | 2310 | struct v4l2_window w2; |
2258 | 2311 | ||
2312 | if (no_overlay > 0) { | ||
2313 | printk ("VIDIOCSWIN: no_overlay\n"); | ||
2314 | return -EINVAL; | ||
2315 | } | ||
2316 | |||
2259 | w2.field = V4L2_FIELD_ANY; | 2317 | w2.field = V4L2_FIELD_ANY; |
2260 | w2.w.left = win->x; | 2318 | w2.w.left = win->x; |
2261 | w2.w.top = win->y; | 2319 | w2.w.top = win->y; |
@@ -2531,10 +2589,12 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2531 | cap->version = BTTV_VERSION_CODE; | 2589 | cap->version = BTTV_VERSION_CODE; |
2532 | cap->capabilities = | 2590 | cap->capabilities = |
2533 | V4L2_CAP_VIDEO_CAPTURE | | 2591 | V4L2_CAP_VIDEO_CAPTURE | |
2534 | V4L2_CAP_VIDEO_OVERLAY | | ||
2535 | V4L2_CAP_VBI_CAPTURE | | 2592 | V4L2_CAP_VBI_CAPTURE | |
2536 | V4L2_CAP_READWRITE | | 2593 | V4L2_CAP_READWRITE | |
2537 | V4L2_CAP_STREAMING; | 2594 | V4L2_CAP_STREAMING; |
2595 | if (no_overlay <= 0) | ||
2596 | cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY; | ||
2597 | |||
2538 | if (bttv_tvcards[btv->c.type].tuner != UNSET && | 2598 | if (bttv_tvcards[btv->c.type].tuner != UNSET && |
2539 | bttv_tvcards[btv->c.type].tuner != TUNER_ABSENT) | 2599 | bttv_tvcards[btv->c.type].tuner != TUNER_ABSENT) |
2540 | cap->capabilities |= V4L2_CAP_TUNER; | 2600 | cap->capabilities |= V4L2_CAP_TUNER; |
@@ -3030,7 +3090,7 @@ static struct file_operations bttv_fops = | |||
3030 | static struct video_device bttv_video_template = | 3090 | static struct video_device bttv_video_template = |
3031 | { | 3091 | { |
3032 | .name = "UNSET", | 3092 | .name = "UNSET", |
3033 | .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_OVERLAY| | 3093 | .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER| |
3034 | VID_TYPE_CLIPPING|VID_TYPE_SCALES, | 3094 | VID_TYPE_CLIPPING|VID_TYPE_SCALES, |
3035 | .hardware = VID_HARDWARE_BT848, | 3095 | .hardware = VID_HARDWARE_BT848, |
3036 | .fops = &bttv_fops, | 3096 | .fops = &bttv_fops, |
@@ -3117,11 +3177,6 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
3117 | return -EINVAL; | 3177 | return -EINVAL; |
3118 | memset(v,0,sizeof(*v)); | 3178 | memset(v,0,sizeof(*v)); |
3119 | strcpy(v->name, "Radio"); | 3179 | strcpy(v->name, "Radio"); |
3120 | /* japan: 76.0 MHz - 89.9 MHz | ||
3121 | western europe: 87.5 MHz - 108.0 MHz | ||
3122 | russia: 65.0 MHz - 108.0 MHz */ | ||
3123 | v->rangelow=(int)(65*16); | ||
3124 | v->rangehigh=(int)(108*16); | ||
3125 | bttv_call_i2c_clients(btv,cmd,v); | 3180 | bttv_call_i2c_clients(btv,cmd,v); |
3126 | return 0; | 3181 | return 0; |
3127 | } | 3182 | } |
@@ -3715,6 +3770,12 @@ static void bttv_unregister_video(struct bttv *btv) | |||
3715 | /* register video4linux devices */ | 3770 | /* register video4linux devices */ |
3716 | static int __devinit bttv_register_video(struct bttv *btv) | 3771 | static int __devinit bttv_register_video(struct bttv *btv) |
3717 | { | 3772 | { |
3773 | if (no_overlay <= 0) { | ||
3774 | bttv_video_template.type |= VID_TYPE_OVERLAY; | ||
3775 | } else { | ||
3776 | printk("bttv: Overlay support disabled.\n"); | ||
3777 | } | ||
3778 | |||
3718 | /* video */ | 3779 | /* video */ |
3719 | btv->video_dev = vdev_init(btv, &bttv_video_template, "video"); | 3780 | btv->video_dev = vdev_init(btv, &bttv_video_template, "video"); |
3720 | if (NULL == btv->video_dev) | 3781 | if (NULL == btv->video_dev) |
@@ -3813,7 +3874,7 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
3813 | btv->c.nr); | 3874 | btv->c.nr); |
3814 | return -EIO; | 3875 | return -EIO; |
3815 | } | 3876 | } |
3816 | if (pci_set_dma_mask(dev, 0xffffffff)) { | 3877 | if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { |
3817 | printk(KERN_WARNING "bttv%d: No suitable DMA available.\n", | 3878 | printk(KERN_WARNING "bttv%d: No suitable DMA available.\n", |
3818 | btv->c.nr); | 3879 | btv->c.nr); |
3819 | return -EIO; | 3880 | return -EIO; |
@@ -3828,11 +3889,6 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
3828 | pci_set_master(dev); | 3889 | pci_set_master(dev); |
3829 | pci_set_command(dev); | 3890 | pci_set_command(dev); |
3830 | pci_set_drvdata(dev,btv); | 3891 | pci_set_drvdata(dev,btv); |
3831 | if (!pci_dma_supported(dev,0xffffffff)) { | ||
3832 | printk("bttv%d: Oops: no 32bit PCI DMA ???\n", btv->c.nr); | ||
3833 | result = -EIO; | ||
3834 | goto fail1; | ||
3835 | } | ||
3836 | 3892 | ||
3837 | pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision); | 3893 | pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision); |
3838 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); | 3894 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); |
@@ -3876,6 +3932,9 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
3876 | btv->opt_vcr_hack = vcr_hack; | 3932 | btv->opt_vcr_hack = vcr_hack; |
3877 | btv->opt_whitecrush_upper = whitecrush_upper; | 3933 | btv->opt_whitecrush_upper = whitecrush_upper; |
3878 | btv->opt_whitecrush_lower = whitecrush_lower; | 3934 | btv->opt_whitecrush_lower = whitecrush_lower; |
3935 | btv->opt_uv_ratio = uv_ratio; | ||
3936 | btv->opt_full_luma_range = full_luma_range; | ||
3937 | btv->opt_coring = coring; | ||
3879 | 3938 | ||
3880 | /* fill struct bttv with some useful defaults */ | 3939 | /* fill struct bttv with some useful defaults */ |
3881 | btv->init.btv = btv; | 3940 | btv->init.btv = btv; |
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index c2368bc832ed..234a85563769 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-i2c.c,v 1.18 2005/02/16 12:14:10 kraxel Exp $ | 2 | $Id: bttv-i2c.c,v 1.25 2005/07/05 17:37:35 nsh Exp $ |
3 | 3 | ||
4 | bttv-i2c.c -- all the i2c code is here | 4 | bttv-i2c.c -- all the i2c code is here |
5 | 5 | ||
@@ -295,14 +295,26 @@ static int attach_inform(struct i2c_client *client) | |||
295 | { | 295 | { |
296 | struct bttv *btv = i2c_get_adapdata(client->adapter); | 296 | struct bttv *btv = i2c_get_adapdata(client->adapter); |
297 | 297 | ||
298 | if (btv->tuner_type != UNSET) | 298 | if (bttv_debug) |
299 | bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type); | 299 | printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n", |
300 | btv->c.nr,client->driver->name,client->addr, | ||
301 | i2c_clientname(client)); | ||
302 | if (!client->driver->command) | ||
303 | return 0; | ||
304 | |||
305 | if (btv->tuner_type != UNSET) { | ||
306 | struct tuner_setup tun_setup; | ||
307 | |||
308 | tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; | ||
309 | tun_setup.type = btv->tuner_type; | ||
310 | tun_setup.addr = ADDR_UNSET; | ||
311 | |||
312 | client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
313 | } | ||
314 | |||
300 | if (btv->pinnacle_id != UNSET) | 315 | if (btv->pinnacle_id != UNSET) |
301 | bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE, | 316 | client->driver->command(client,AUDC_CONFIG_PINNACLE, |
302 | &btv->pinnacle_id); | 317 | &btv->pinnacle_id); |
303 | if (bttv_debug) | ||
304 | printk("bttv%d: i2c attach [client=%s]\n", | ||
305 | btv->c.nr, i2c_clientname(client)); | ||
306 | return 0; | 318 | return 0; |
307 | } | 319 | } |
308 | 320 | ||
diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bttv-risc.c index bdc5ce6c43b9..9ed21fd190c6 100644 --- a/drivers/media/video/bttv-risc.c +++ b/drivers/media/video/bttv-risc.c | |||
@@ -334,10 +334,6 @@ bttv_calc_geo(struct bttv *btv, struct bttv_geometry *geo, | |||
334 | } | 334 | } |
335 | 335 | ||
336 | vdelay = tvnorm->vdelay; | 336 | vdelay = tvnorm->vdelay; |
337 | #if 0 /* FIXME */ | ||
338 | if (vdelay < btv->vbi.lines*2) | ||
339 | vdelay = btv->vbi.lines*2; | ||
340 | #endif | ||
341 | 337 | ||
342 | xsf = (width*scaledtwidth)/swidth; | 338 | xsf = (width*scaledtwidth)/swidth; |
343 | geo->hscale = ((totalwidth*4096UL)/xsf-4096); | 339 | geo->hscale = ((totalwidth*4096UL)/xsf-4096); |
@@ -776,13 +772,8 @@ bttv_overlay_risc(struct bttv *btv, | |||
776 | bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 0, 0); | 772 | bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 0, 0); |
777 | break; | 773 | break; |
778 | case V4L2_FIELD_INTERLACED: | 774 | case V4L2_FIELD_INTERLACED: |
779 | #if 0 | ||
780 | bttv_risc_overlay(btv, &buf->top, fmt, ov, 1, 0); | ||
781 | bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 0, 1); | ||
782 | #else | ||
783 | bttv_risc_overlay(btv, &buf->top, fmt, ov, 0, 1); | 775 | bttv_risc_overlay(btv, &buf->top, fmt, ov, 0, 1); |
784 | bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 1, 0); | 776 | bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 1, 0); |
785 | #endif | ||
786 | break; | 777 | break; |
787 | default: | 778 | default: |
788 | BUG(); | 779 | BUG(); |
diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h index 8322b66e0905..f2af9e1454f0 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bttv.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: bttv.h,v 1.17 2005/02/22 14:06:32 kraxel Exp $ | 2 | * $Id: bttv.h,v 1.22 2005/07/28 18:41:21 mchehab Exp $ |
3 | * | 3 | * |
4 | * bttv - Bt848 frame grabber driver | 4 | * bttv - Bt848 frame grabber driver |
5 | * | 5 | * |
@@ -135,6 +135,9 @@ | |||
135 | #define BTTV_DVICO_DVBT_LITE 0x80 | 135 | #define BTTV_DVICO_DVBT_LITE 0x80 |
136 | #define BTTV_TIBET_CS16 0x83 | 136 | #define BTTV_TIBET_CS16 0x83 |
137 | #define BTTV_KODICOM_4400R 0x84 | 137 | #define BTTV_KODICOM_4400R 0x84 |
138 | #define BTTV_ADLINK_RTV24 0x86 | ||
139 | #define BTTV_DVICO_FUSIONHDTV_5_LITE 0x87 | ||
140 | #define BTTV_ACORP_Y878F 0x88 | ||
138 | 141 | ||
139 | /* i2c address list */ | 142 | /* i2c address list */ |
140 | #define I2C_TSA5522 0xc2 | 143 | #define I2C_TSA5522 0xc2 |
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h index 1a9ba7e1cf51..aab094bc243d 100644 --- a/drivers/media/video/bttvp.h +++ b/drivers/media/video/bttvp.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttvp.h,v 1.17 2005/02/16 12:14:10 kraxel Exp $ | 2 | $Id: bttvp.h,v 1.21 2005/07/15 21:44:14 mchehab Exp $ |
3 | 3 | ||
4 | bttv - Bt848 frame grabber driver | 4 | bttv - Bt848 frame grabber driver |
5 | 5 | ||
@@ -27,7 +27,7 @@ | |||
27 | #define _BTTVP_H_ | 27 | #define _BTTVP_H_ |
28 | 28 | ||
29 | #include <linux/version.h> | 29 | #include <linux/version.h> |
30 | #define BTTV_VERSION_CODE KERNEL_VERSION(0,9,15) | 30 | #define BTTV_VERSION_CODE KERNEL_VERSION(0,9,16) |
31 | 31 | ||
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <linux/wait.h> | 33 | #include <linux/wait.h> |
@@ -226,10 +226,6 @@ extern int fini_bttv_i2c(struct bttv *btv); | |||
226 | #define dprintk if (bttv_debug >= 1) printk | 226 | #define dprintk if (bttv_debug >= 1) printk |
227 | #define d2printk if (bttv_debug >= 2) printk | 227 | #define d2printk if (bttv_debug >= 2) printk |
228 | 228 | ||
229 | /* our devices */ | ||
230 | #define BTTV_MAX 16 | ||
231 | extern unsigned int bttv_num; | ||
232 | |||
233 | #define BTTV_MAX_FBUF 0x208000 | 229 | #define BTTV_MAX_FBUF 0x208000 |
234 | #define VBIBUF_SIZE (2048*VBI_MAXLINES*2) | 230 | #define VBIBUF_SIZE (2048*VBI_MAXLINES*2) |
235 | #define BTTV_TIMEOUT (HZ/2) /* 0.5 seconds */ | 231 | #define BTTV_TIMEOUT (HZ/2) /* 0.5 seconds */ |
@@ -330,6 +326,9 @@ struct bttv { | |||
330 | int opt_vcr_hack; | 326 | int opt_vcr_hack; |
331 | int opt_whitecrush_upper; | 327 | int opt_whitecrush_upper; |
332 | int opt_whitecrush_lower; | 328 | int opt_whitecrush_lower; |
329 | int opt_uv_ratio; | ||
330 | int opt_full_luma_range; | ||
331 | int opt_coring; | ||
333 | 332 | ||
334 | /* radio data/state */ | 333 | /* radio data/state */ |
335 | int has_radio; | 334 | int has_radio; |
@@ -375,6 +374,10 @@ struct bttv { | |||
375 | unsigned int users; | 374 | unsigned int users; |
376 | struct bttv_fh init; | 375 | struct bttv_fh init; |
377 | }; | 376 | }; |
377 | |||
378 | /* our devices */ | ||
379 | #define BTTV_MAX 16 | ||
380 | extern unsigned int bttv_num; | ||
378 | extern struct bttv bttvs[BTTV_MAX]; | 381 | extern struct bttv bttvs[BTTV_MAX]; |
379 | 382 | ||
380 | /* private ioctls */ | 383 | /* private ioctls */ |
diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile index 606d0348da2c..107e48645e3a 100644 --- a/drivers/media/video/cx88/Makefile +++ b/drivers/media/video/cx88/Makefile | |||
@@ -9,3 +9,15 @@ obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o | |||
9 | EXTRA_CFLAGS += -I$(src)/.. | 9 | EXTRA_CFLAGS += -I$(src)/.. |
10 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core | 10 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core |
11 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends | 11 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends |
12 | ifneq ($(CONFIG_DVB_CX22702),n) | ||
13 | EXTRA_CFLAGS += -DHAVE_CX22702=1 | ||
14 | endif | ||
15 | ifneq ($(CONFIG_DVB_OR51132),n) | ||
16 | EXTRA_CFLAGS += -DHAVE_OR51132=1 | ||
17 | endif | ||
18 | ifneq ($(CONFIG_DVB_LGDT330X),n) | ||
19 | EXTRA_CFLAGS += -DHAVE_LGDT330X=1 | ||
20 | endif | ||
21 | ifneq ($(CONFIG_DVB_MT352),n) | ||
22 | EXTRA_CFLAGS += -DHAVE_MT352=1 | ||
23 | endif | ||
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 46d6778b863b..4f39688f780a 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-blackbird.c,v 1.26 2005/03/07 15:58:05 kraxel Exp $ | 2 | * $Id: cx88-blackbird.c,v 1.27 2005/06/03 13:31:50 mchehab Exp $ |
3 | * | 3 | * |
4 | * Support for a cx23416 mpeg encoder via cx2388x host port. | 4 | * Support for a cx23416 mpeg encoder via cx2388x host port. |
5 | * "blackbird" reference design. | 5 | * "blackbird" reference design. |
@@ -61,37 +61,304 @@ static LIST_HEAD(cx8802_devlist); | |||
61 | 61 | ||
62 | #define IVTV_CMD_HW_BLOCKS_RST 0xFFFFFFFF | 62 | #define IVTV_CMD_HW_BLOCKS_RST 0xFFFFFFFF |
63 | 63 | ||
64 | /*Firmware API commands*/ | 64 | /* Firmware API commands */ |
65 | #define IVTV_API_ENC_PING_FW 0x00000080 | 65 | /* #define IVTV_API_STD_TIMEOUT 0x00010000 // 65536, units?? */ |
66 | #define IVTV_API_ENC_GETVER 0x000000C4 | 66 | #define IVTV_API_STD_TIMEOUT 500 |
67 | #define IVTV_API_ENC_HALT_FW 0x000000C3 | 67 | |
68 | #define IVTV_API_STD_TIMEOUT 0x00010000 /*units??*/ | 68 | #define BLACKBIRD_API_PING 0x80 |
69 | //#define IVTV_API_ASSIGN_PGM_INDEX_INFO 0x000000c7 | 69 | #define BLACKBIRD_API_BEGIN_CAPTURE 0x81 |
70 | #define IVTV_API_ASSIGN_STREAM_TYPE 0x000000b9 | 70 | enum blackbird_capture_type { |
71 | #define IVTV_API_ASSIGN_OUTPUT_PORT 0x000000bb | 71 | BLACKBIRD_MPEG_CAPTURE, |
72 | #define IVTV_API_ASSIGN_FRAMERATE 0x0000008f | 72 | BLACKBIRD_RAW_CAPTURE, |
73 | #define IVTV_API_ASSIGN_FRAME_SIZE 0x00000091 | 73 | BLACKBIRD_RAW_PASSTHRU_CAPTURE |
74 | #define IVTV_API_ASSIGN_ASPECT_RATIO 0x00000099 | 74 | }; |
75 | #define IVTV_API_ASSIGN_BITRATES 0x00000095 | 75 | enum blackbird_capture_bits { |
76 | #define IVTV_API_ASSIGN_GOP_PROPERTIES 0x00000097 | 76 | BLACKBIRD_RAW_BITS_NONE = 0x00, |
77 | #define IVTV_API_ASSIGN_3_2_PULLDOWN 0x000000b1 | 77 | BLACKBIRD_RAW_BITS_YUV_CAPTURE = 0x01, |
78 | #define IVTV_API_ASSIGN_GOP_CLOSURE 0x000000c5 | 78 | BLACKBIRD_RAW_BITS_PCM_CAPTURE = 0x02, |
79 | #define IVTV_API_ASSIGN_AUDIO_PROPERTIES 0x000000bd | 79 | BLACKBIRD_RAW_BITS_VBI_CAPTURE = 0x04, |
80 | #define IVTV_API_ASSIGN_DNR_FILTER_MODE 0x0000009b | 80 | BLACKBIRD_RAW_BITS_PASSTHRU_CAPTURE = 0x08, |
81 | #define IVTV_API_ASSIGN_DNR_FILTER_PROPS 0x0000009d | 81 | BLACKBIRD_RAW_BITS_TO_HOST_CAPTURE = 0x10 |
82 | #define IVTV_API_ASSIGN_CORING_LEVELS 0x0000009f | 82 | }; |
83 | #define IVTV_API_ASSIGN_SPATIAL_FILTER_TYPE 0x000000a1 | 83 | #define BLACKBIRD_API_END_CAPTURE 0x82 |
84 | #define IVTV_API_ASSIGN_FRAME_DROP_RATE 0x000000d0 | 84 | enum blackbird_capture_end { |
85 | #define IVTV_API_ASSIGN_PLACEHOLDER 0x000000d8 | 85 | BLACKBIRD_END_AT_GOP, /* stop at the end of gop, generate irq */ |
86 | #define IVTV_API_MUTE_VIDEO 0x000000d9 | 86 | BLACKBIRD_END_NOW, /* stop immediately, no irq */ |
87 | #define IVTV_API_MUTE_AUDIO 0x000000da | 87 | }; |
88 | #define IVTV_API_INITIALIZE_INPUT 0x000000cd | 88 | #define BLACKBIRD_API_SET_AUDIO_ID 0x89 |
89 | #define IVTV_API_REFRESH_INPUT 0x000000d3 | 89 | #define BLACKBIRD_API_SET_VIDEO_ID 0x8B |
90 | #define IVTV_API_ASSIGN_NUM_VSYNC_LINES 0x000000d6 | 90 | #define BLACKBIRD_API_SET_PCR_ID 0x8D |
91 | #define IVTV_API_BEGIN_CAPTURE 0x00000081 | 91 | #define BLACKBIRD_API_SET_FRAMERATE 0x8F |
92 | //#define IVTV_API_PAUSE_ENCODER 0x000000d2 | 92 | enum blackbird_framerate { |
93 | //#define IVTV_API_EVENT_NOTIFICATION 0x000000d5 | 93 | BLACKBIRD_FRAMERATE_NTSC_30, /* NTSC: 30fps */ |
94 | #define IVTV_API_END_CAPTURE 0x00000082 | 94 | BLACKBIRD_FRAMERATE_PAL_25 /* PAL: 25fps */ |
95 | }; | ||
96 | #define BLACKBIRD_API_SET_RESOLUTION 0x91 | ||
97 | #define BLACKBIRD_API_SET_VIDEO_BITRATE 0x95 | ||
98 | enum blackbird_video_bitrate_type { | ||
99 | BLACKBIRD_VIDEO_VBR, | ||
100 | BLACKBIRD_VIDEO_CBR | ||
101 | }; | ||
102 | #define BLACKBIRD_PEAK_RATE_DIVISOR 400 | ||
103 | enum blackbird_mux_rate { | ||
104 | BLACKBIRD_MUX_RATE_DEFAULT, | ||
105 | /* dvd mux rate: multiply by 400 to get the actual rate */ | ||
106 | BLACKBIRD_MUX_RATE_DVD = 25200 | ||
107 | }; | ||
108 | #define BLACKBIRD_API_SET_GOP_STRUCTURE 0x97 | ||
109 | #define BLACKBIRD_API_SET_ASPECT_RATIO 0x99 | ||
110 | enum blackbird_aspect_ratio { | ||
111 | BLACKBIRD_ASPECT_RATIO_FORBIDDEN, | ||
112 | BLACKBIRD_ASPECT_RATIO_1_1_SQUARE, | ||
113 | BLACKBIRD_ASPECT_RATIO_4_3, | ||
114 | BLACKBIRD_ASPECT_RATIO_16_9, | ||
115 | BLACKBIRD_ASPECT_RATIO_221_100, | ||
116 | BLACKBIRD_ASPECT_RATIO_RESERVED | ||
117 | }; | ||
118 | #define BLACKBIRD_API_SET_DNR_MODE 0x9B | ||
119 | enum blackbird_dnr_bits { | ||
120 | BLACKBIRD_DNR_BITS_MANUAL, | ||
121 | BLACKBIRD_DNR_BITS_AUTO_SPATIAL, | ||
122 | BLACKBIRD_DNR_BITS_AUTO_TEMPORAL, | ||
123 | BLACKBIRD_DNR_BITS_AUTO | ||
124 | }; | ||
125 | enum blackbird_median_filter { | ||
126 | BLACKBIRD_MEDIAN_FILTER_DISABLED, | ||
127 | BLACKBIRD_MEDIAN_FILTER_HORIZONTAL, | ||
128 | BLACKBIRD_MEDIAN_FILTER_VERTICAL, | ||
129 | BLACKBIRD_MEDIAN_FILTER_HV, | ||
130 | BLACKBIRD_MEDIAN_FILTER_DIAGONAL | ||
131 | }; | ||
132 | #define BLACKBIRD_API_SET_MANUAL_DNR 0x9D | ||
133 | #define BLACKBIRD_API_SET_DNR_MEDIAN 0x9F | ||
134 | #define BLACKBIRD_API_SET_SPATIAL_FILTER 0xA1 | ||
135 | enum blackbird_spatial_filter_luma { | ||
136 | BLACKBIRD_SPATIAL_FILTER_LUMA_DISABLED, | ||
137 | BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, | ||
138 | BLACKBIRD_SPATIAL_FILTER_LUMA_1D_VERT, | ||
139 | BLACKBIRD_SPATIAL_FILTER_LUMA_2D_HV, /* separable, default */ | ||
140 | BLACKBIRD_SPATIAL_FILTER_LUMA_2D_SYMM /* symmetric non-separable */ | ||
141 | }; | ||
142 | enum blackbird_spatial_filter_chroma { | ||
143 | BLACKBIRD_SPATIAL_FILTER_CHROMA_DISABLED, | ||
144 | BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ /* default */ | ||
145 | }; | ||
146 | #define BLACKBIRD_API_SET_3_2_PULLDOWN 0xB1 | ||
147 | enum blackbird_pulldown { | ||
148 | BLACKBIRD_3_2_PULLDOWN_DISABLED, | ||
149 | BLACKBIRD_3_2_PULLDOWN_ENABLED | ||
150 | }; | ||
151 | #define BLACKBIRD_API_SET_VBI_LINE_NO 0xB7 | ||
152 | enum blackbird_vbi_line_bits { | ||
153 | BLACKBIRD_VBI_LINE_BITS_TOP_FIELD, | ||
154 | BLACKBIRD_VBI_LINE_BITS_BOT_FIELD = (1 << 31), | ||
155 | BLACKBIRD_VBI_LINE_BITS_ALL_LINES = 0xFFFFFFFF | ||
156 | }; | ||
157 | enum blackbird_vbi_line { | ||
158 | BLACKBIRD_VBI_LINE_DISABLED, | ||
159 | BLACKBIRD_VBI_LINE_ENABLED | ||
160 | }; | ||
161 | enum blackbird_vbi_slicing { | ||
162 | BLACKBIRD_VBI_SLICING_NONE, | ||
163 | BLACKBIRD_VBI_SLICING_CLOSED_CAPTION | ||
164 | }; | ||
165 | #define BLACKBIRD_API_SET_STREAM_TYPE 0xB9 | ||
166 | enum blackbird_stream_type { | ||
167 | BLACKBIRD_STREAM_PROGRAM, | ||
168 | BLACKBIRD_STREAM_TRANSPORT, | ||
169 | BLACKBIRD_STREAM_MPEG1, | ||
170 | BLACKBIRD_STREAM_PES_AV, | ||
171 | BLACKBIRD_STREAM_UNKNOWN4, | ||
172 | BLACKBIRD_STREAM_PES_VIDEO, | ||
173 | BLACKBIRD_STREAM_UNKNOWN6, | ||
174 | BLACKBIRD_STREAM_PES_AUDIO, | ||
175 | BLACKBIRD_STREAM_UNKNOWN8, | ||
176 | BLACKBIRD_STREAM_UNKNOWN9, /* audio/pcm ? */ | ||
177 | BLACKBIRD_STREAM_DVD, | ||
178 | BLACKBIRD_STREAM_VCD, | ||
179 | BLACKBIRD_STREAM_UNKNOWN12 /* svcd/xvcd ? */ | ||
180 | }; | ||
181 | #define BLACKBIRD_API_SET_OUTPUT_PORT 0xBB | ||
182 | enum blackbird_stream_port { | ||
183 | BLACKBIRD_OUTPUT_PORT_MEMORY, | ||
184 | BLACKBIRD_OUTPUT_PORT_STREAMING, | ||
185 | BLACKBIRD_OUTPUT_PORT_SERIAL | ||
186 | }; | ||
187 | #define BLACKBIRD_API_SET_AUDIO_PARAMS 0xBD | ||
188 | enum blackbird_audio_bits_sample_rate { | ||
189 | BLACKBIRD_AUDIO_BITS_44100HZ, | ||
190 | BLACKBIRD_AUDIO_BITS_48000HZ, | ||
191 | BLACKBIRD_AUDIO_BITS_32000HZ, | ||
192 | BLACKBIRD_AUDIO_BITS_RESERVED_HZ, | ||
193 | }; | ||
194 | enum blackbird_audio_bits_encoding { | ||
195 | BLACKBIRD_AUDIO_BITS_LAYER_1 = 0x1 << 2, | ||
196 | BLACKBIRD_AUDIO_BITS_LAYER_2 = 0x2 << 2, | ||
197 | }; | ||
198 | enum blackbird_audio_bits_bitrate_layer_1 { | ||
199 | BLACKBIRD_AUDIO_BITS_LAYER_1_FREE_FORMAT, | ||
200 | BLACKBIRD_AUDIO_BITS_LAYER_1_32 = 0x01 << 4, | ||
201 | BLACKBIRD_AUDIO_BITS_LAYER_1_64 = 0x02 << 4, | ||
202 | BLACKBIRD_AUDIO_BITS_LAYER_1_96 = 0x03 << 4, | ||
203 | BLACKBIRD_AUDIO_BITS_LAYER_1_128 = 0x04 << 4, | ||
204 | BLACKBIRD_AUDIO_BITS_LAYER_1_160 = 0x05 << 4, | ||
205 | BLACKBIRD_AUDIO_BITS_LAYER_1_192 = 0x06 << 4, | ||
206 | BLACKBIRD_AUDIO_BITS_LAYER_1_224 = 0x07 << 4, | ||
207 | BLACKBIRD_AUDIO_BITS_LAYER_1_256 = 0x08 << 4, | ||
208 | BLACKBIRD_AUDIO_BITS_LAYER_1_288 = 0x09 << 4, | ||
209 | BLACKBIRD_AUDIO_BITS_LAYER_1_320 = 0x0A << 4, | ||
210 | BLACKBIRD_AUDIO_BITS_LAYER_1_352 = 0x0B << 4, | ||
211 | BLACKBIRD_AUDIO_BITS_LAYER_1_384 = 0x0C << 4, | ||
212 | BLACKBIRD_AUDIO_BITS_LAYER_1_416 = 0x0D << 4, | ||
213 | BLACKBIRD_AUDIO_BITS_LAYER_1_448 = 0x0E << 4, | ||
214 | }; | ||
215 | enum blackbird_audio_bits_bitrate_layer_2 { | ||
216 | BLACKBIRD_AUDIO_BITS_LAYER_2_FREE_FORMAT, | ||
217 | BLACKBIRD_AUDIO_BITS_LAYER_2_32 = 0x01 << 4, | ||
218 | BLACKBIRD_AUDIO_BITS_LAYER_2_48 = 0x02 << 4, | ||
219 | BLACKBIRD_AUDIO_BITS_LAYER_2_56 = 0x03 << 4, | ||
220 | BLACKBIRD_AUDIO_BITS_LAYER_2_64 = 0x04 << 4, | ||
221 | BLACKBIRD_AUDIO_BITS_LAYER_2_80 = 0x05 << 4, | ||
222 | BLACKBIRD_AUDIO_BITS_LAYER_2_96 = 0x06 << 4, | ||
223 | BLACKBIRD_AUDIO_BITS_LAYER_2_112 = 0x07 << 4, | ||
224 | BLACKBIRD_AUDIO_BITS_LAYER_2_128 = 0x08 << 4, | ||
225 | BLACKBIRD_AUDIO_BITS_LAYER_2_160 = 0x09 << 4, | ||
226 | BLACKBIRD_AUDIO_BITS_LAYER_2_192 = 0x0A << 4, | ||
227 | BLACKBIRD_AUDIO_BITS_LAYER_2_224 = 0x0B << 4, | ||
228 | BLACKBIRD_AUDIO_BITS_LAYER_2_256 = 0x0C << 4, | ||
229 | BLACKBIRD_AUDIO_BITS_LAYER_2_320 = 0x0D << 4, | ||
230 | BLACKBIRD_AUDIO_BITS_LAYER_2_384 = 0x0E << 4, | ||
231 | }; | ||
232 | enum blackbird_audio_bits_mode { | ||
233 | BLACKBIRD_AUDIO_BITS_STEREO, | ||
234 | BLACKBIRD_AUDIO_BITS_JOINT_STEREO = 0x1 << 8, | ||
235 | BLACKBIRD_AUDIO_BITS_DUAL = 0x2 << 8, | ||
236 | BLACKBIRD_AUDIO_BITS_MONO = 0x3 << 8, | ||
237 | }; | ||
238 | enum blackbird_audio_bits_mode_extension { | ||
239 | BLACKBIRD_AUDIO_BITS_BOUND_4, | ||
240 | BLACKBIRD_AUDIO_BITS_BOUND_8 = 0x1 << 10, | ||
241 | BLACKBIRD_AUDIO_BITS_BOUND_12 = 0x2 << 10, | ||
242 | BLACKBIRD_AUDIO_BITS_BOUND_16 = 0x3 << 10, | ||
243 | }; | ||
244 | enum blackbird_audio_bits_emphasis { | ||
245 | BLACKBIRD_AUDIO_BITS_EMPHASIS_NONE, | ||
246 | BLACKBIRD_AUDIO_BITS_EMPHASIS_50_15 = 0x1 << 12, | ||
247 | BLACKBIRD_AUDIO_BITS_EMPHASIS_RESERVED = 0x2 << 12, | ||
248 | BLACKBIRD_AUDIO_BITS_EMPHASIS_CCITT_J17 = 0x3 << 12, | ||
249 | }; | ||
250 | enum blackbird_audio_bits_crc { | ||
251 | BLACKBIRD_AUDIO_BITS_CRC_OFF, | ||
252 | BLACKBIRD_AUDIO_BITS_CRC_ON = 0x1 << 14, | ||
253 | }; | ||
254 | enum blackbird_audio_bits_copyright { | ||
255 | BLACKBIRD_AUDIO_BITS_COPYRIGHT_OFF, | ||
256 | BLACKBIRD_AUDIO_BITS_COPYRIGHT_ON = 0x1 << 15, | ||
257 | }; | ||
258 | enum blackbird_audio_bits_original { | ||
259 | BLACKBIRD_AUDIO_BITS_COPY, | ||
260 | BLACKBIRD_AUDIO_BITS_ORIGINAL = 0x1 << 16, | ||
261 | }; | ||
262 | #define BLACKBIRD_API_HALT 0xC3 | ||
263 | #define BLACKBIRD_API_GET_VERSION 0xC4 | ||
264 | #define BLACKBIRD_API_SET_GOP_CLOSURE 0xC5 | ||
265 | enum blackbird_gop_closure { | ||
266 | BLACKBIRD_GOP_CLOSURE_OFF, | ||
267 | BLACKBIRD_GOP_CLOSURE_ON, | ||
268 | }; | ||
269 | #define BLACKBIRD_API_DATA_XFER_STATUS 0xC6 | ||
270 | enum blackbird_data_xfer_status { | ||
271 | BLACKBIRD_MORE_BUFFERS_FOLLOW, | ||
272 | BLACKBIRD_LAST_BUFFER, | ||
273 | }; | ||
274 | #define BLACKBIRD_API_PROGRAM_INDEX_INFO 0xC7 | ||
275 | enum blackbird_picture_mask { | ||
276 | BLACKBIRD_PICTURE_MASK_NONE, | ||
277 | BLACKBIRD_PICTURE_MASK_I_FRAMES, | ||
278 | BLACKBIRD_PICTURE_MASK_I_P_FRAMES = 0x3, | ||
279 | BLACKBIRD_PICTURE_MASK_ALL_FRAMES = 0x7, | ||
280 | }; | ||
281 | #define BLACKBIRD_API_SET_VBI_PARAMS 0xC8 | ||
282 | enum blackbird_vbi_mode_bits { | ||
283 | BLACKBIRD_VBI_BITS_SLICED, | ||
284 | BLACKBIRD_VBI_BITS_RAW, | ||
285 | }; | ||
286 | enum blackbird_vbi_insertion_bits { | ||
287 | BLACKBIRD_VBI_BITS_INSERT_IN_XTENSION_USR_DATA, | ||
288 | BLACKBIRD_VBI_BITS_INSERT_IN_PRIVATE_PACKETS = 0x1 << 1, | ||
289 | BLACKBIRD_VBI_BITS_SEPARATE_STREAM = 0x2 << 1, | ||
290 | BLACKBIRD_VBI_BITS_SEPARATE_STREAM_USR_DATA = 0x4 << 1, | ||
291 | BLACKBIRD_VBI_BITS_SEPARATE_STREAM_PRV_DATA = 0x5 << 1, | ||
292 | }; | ||
293 | #define BLACKBIRD_API_SET_DMA_BLOCK_SIZE 0xC9 | ||
294 | enum blackbird_dma_unit { | ||
295 | BLACKBIRD_DMA_BYTES, | ||
296 | BLACKBIRD_DMA_FRAMES, | ||
297 | }; | ||
298 | #define BLACKBIRD_API_DMA_TRANSFER_INFO 0xCA | ||
299 | #define BLACKBIRD_API_DMA_TRANSFER_STAT 0xCB | ||
300 | enum blackbird_dma_transfer_status_bits { | ||
301 | BLACKBIRD_DMA_TRANSFER_BITS_DONE = 0x01, | ||
302 | BLACKBIRD_DMA_TRANSFER_BITS_ERROR = 0x04, | ||
303 | BLACKBIRD_DMA_TRANSFER_BITS_LL_ERROR = 0x10, | ||
304 | }; | ||
305 | #define BLACKBIRD_API_SET_DMA2HOST_ADDR 0xCC | ||
306 | #define BLACKBIRD_API_INIT_VIDEO_INPUT 0xCD | ||
307 | #define BLACKBIRD_API_SET_FRAMESKIP 0xD0 | ||
308 | #define BLACKBIRD_API_PAUSE 0xD2 | ||
309 | enum blackbird_pause { | ||
310 | BLACKBIRD_PAUSE_ENCODING, | ||
311 | BLACKBIRD_RESUME_ENCODING, | ||
312 | }; | ||
313 | #define BLACKBIRD_API_REFRESH_INPUT 0xD3 | ||
314 | #define BLACKBIRD_API_SET_COPYRIGHT 0xD4 | ||
315 | enum blackbird_copyright { | ||
316 | BLACKBIRD_COPYRIGHT_OFF, | ||
317 | BLACKBIRD_COPYRIGHT_ON, | ||
318 | }; | ||
319 | #define BLACKBIRD_API_SET_NOTIFICATION 0xD5 | ||
320 | enum blackbird_notification_type { | ||
321 | BLACKBIRD_NOTIFICATION_REFRESH, | ||
322 | }; | ||
323 | enum blackbird_notification_status { | ||
324 | BLACKBIRD_NOTIFICATION_OFF, | ||
325 | BLACKBIRD_NOTIFICATION_ON, | ||
326 | }; | ||
327 | enum blackbird_notification_mailbox { | ||
328 | BLACKBIRD_NOTIFICATION_NO_MAILBOX = -1, | ||
329 | }; | ||
330 | #define BLACKBIRD_API_SET_CAPTURE_LINES 0xD6 | ||
331 | enum blackbird_field1_lines { | ||
332 | BLACKBIRD_FIELD1_SAA7114 = 0x00EF, /* 239 */ | ||
333 | BLACKBIRD_FIELD1_SAA7115 = 0x00F0, /* 240 */ | ||
334 | BLACKBIRD_FIELD1_MICRONAS = 0x0105, /* 261 */ | ||
335 | }; | ||
336 | enum blackbird_field2_lines { | ||
337 | BLACKBIRD_FIELD2_SAA7114 = 0x00EF, /* 239 */ | ||
338 | BLACKBIRD_FIELD2_SAA7115 = 0x00F0, /* 240 */ | ||
339 | BLACKBIRD_FIELD2_MICRONAS = 0x0106, /* 262 */ | ||
340 | }; | ||
341 | #define BLACKBIRD_API_SET_CUSTOM_DATA 0xD7 | ||
342 | enum blackbird_custom_data_type { | ||
343 | BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, | ||
344 | BLACKBIRD_CUSTOM_PRIVATE_PACKET, | ||
345 | }; | ||
346 | #define BLACKBIRD_API_MUTE_VIDEO 0xD9 | ||
347 | enum blackbird_mute { | ||
348 | BLACKBIRD_UNMUTE, | ||
349 | BLACKBIRD_MUTE, | ||
350 | }; | ||
351 | enum blackbird_mute_video_mask { | ||
352 | BLACKBIRD_MUTE_VIDEO_V_MASK = 0x0000FF00, | ||
353 | BLACKBIRD_MUTE_VIDEO_U_MASK = 0x00FF0000, | ||
354 | BLACKBIRD_MUTE_VIDEO_Y_MASK = 0xFF000000, | ||
355 | }; | ||
356 | enum blackbird_mute_video_shift { | ||
357 | BLACKBIRD_MUTE_VIDEO_V_SHIFT = 8, | ||
358 | BLACKBIRD_MUTE_VIDEO_U_SHIFT = 16, | ||
359 | BLACKBIRD_MUTE_VIDEO_Y_SHIFT = 24, | ||
360 | }; | ||
361 | #define BLACKBIRD_API_MUTE_AUDIO 0xDA | ||
95 | 362 | ||
96 | /* Registers */ | 363 | /* Registers */ |
97 | #define IVTV_REG_ENC_SDRAM_REFRESH (0x07F8 /*| IVTV_REG_OFFSET*/) | 364 | #define IVTV_REG_ENC_SDRAM_REFRESH (0x07F8 /*| IVTV_REG_OFFSET*/) |
@@ -405,68 +672,98 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) | |||
405 | return 0; | 672 | return 0; |
406 | } | 673 | } |
407 | 674 | ||
675 | /** | ||
676 | Settings used by the windows tv app for PVR2000: | ||
677 | ================================================================================================================= | ||
678 | Profile | Codec | Resolution | CBR/VBR | Video Qlty | V. Bitrate | Frmrate | Audio Codec | A. Bitrate | A. Mode | ||
679 | ----------------------------------------------------------------------------------------------------------------- | ||
680 | MPEG-1 | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 2000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
681 | MPEG-2 | MPEG2 | 720x576PAL | VBR | 600 :Good | 4000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
682 | VCD | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 1150 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
683 | DVD | MPEG2 | 720x576PAL | VBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
684 | DB* DVD | MPEG2 | 720x576PAL | CBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
685 | ================================================================================================================= | ||
686 | *DB: "DirectBurn" | ||
687 | */ | ||
408 | static void blackbird_codec_settings(struct cx8802_dev *dev) | 688 | static void blackbird_codec_settings(struct cx8802_dev *dev) |
409 | { | 689 | { |
410 | int bitrate_mode = 1; | 690 | int bitrate_mode = 1; |
411 | int bitrate = 7500000; | 691 | int bitrate = 7500000; |
412 | int bitrate_peak = 7500000; | 692 | int bitrate_peak = 7500000; |
693 | bitrate_mode = BLACKBIRD_VIDEO_CBR; | ||
694 | bitrate = 4000*1024; | ||
695 | bitrate_peak = 4000*1024; | ||
413 | 696 | ||
414 | /* assign stream type */ | 697 | /* assign stream type */ |
415 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 0); /* program stream */ | 698 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM); |
416 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 2); /* MPEG1 stream */ | 699 | /* blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_TRANSPORT); */ |
417 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 3); /* PES A/V */ | ||
418 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 10); /* DVD stream */ | ||
419 | 700 | ||
420 | /* assign output port */ | 701 | /* assign output port */ |
421 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_OUTPUT_PORT, 1, 0, 1); /* 1 = Host */ | 702 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */ |
422 | 703 | ||
423 | /* assign framerate */ | 704 | /* assign framerate */ |
424 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAMERATE, 1, 0, 0); | 705 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25); |
425 | 706 | ||
426 | /* assign frame size */ | 707 | /* assign frame size */ |
427 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_SIZE, 2, 0, | 708 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_RESOLUTION, 2, 0, |
428 | dev->height, dev->width); | 709 | dev->height, dev->width); |
429 | 710 | ||
430 | /* assign aspect ratio */ | 711 | /* assign aspect ratio */ |
431 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_ASPECT_RATIO, 1, 0, 2); | 712 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_ASPECT_RATIO, 1, 0, BLACKBIRD_ASPECT_RATIO_4_3); |
432 | 713 | ||
433 | /* assign bitrates */ | 714 | /* assign bitrates */ |
434 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_BITRATES, 5, 0, | 715 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_VIDEO_BITRATE, 5, 0, |
435 | bitrate_mode, /* mode */ | 716 | bitrate_mode, /* mode */ |
436 | bitrate, /* bps */ | 717 | bitrate, /* bps */ |
437 | bitrate_peak / 400, /* peak/400 */ | 718 | bitrate_peak / BLACKBIRD_PEAK_RATE_DIVISOR, /* peak/400 */ |
438 | 0, 0x70); /* encoding buffer, ckennedy */ | 719 | BLACKBIRD_MUX_RATE_DEFAULT /*, 0x70*/); /* encoding buffer, ckennedy */ |
439 | 720 | ||
440 | /* assign gop properties */ | 721 | /* assign gop properties */ |
441 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_GOP_PROPERTIES, 2, 0, 15, 3); | 722 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_STRUCTURE, 2, 0, 15, 3); |
442 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_GOP_PROPERTIES, 2, 0, 2, 1); | 723 | |
443 | 724 | /* assign 3 2 pulldown */ | |
444 | /* assign 3 2 pulldown */ | 725 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_3_2_PULLDOWN, 1, 0, BLACKBIRD_3_2_PULLDOWN_DISABLED); |
445 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_3_2_PULLDOWN, 1, 0, 0); | 726 | |
446 | 727 | /* assign audio properties */ | |
447 | /* note: it's not necessary to set the samplerate, the mpeg encoder seems to autodetect/adjust */ | 728 | /* note: it's not necessary to set the samplerate, the mpeg encoder seems to autodetect/adjust */ |
448 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, (2<<2) | (8<<4)); | 729 | /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, (2<<2) | (8<<4)); |
730 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, 0 | (2 << 2) | (14 << 4)); */ | ||
731 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_AUDIO_PARAMS, 1, 0, | ||
732 | BLACKBIRD_AUDIO_BITS_44100HZ | | ||
733 | BLACKBIRD_AUDIO_BITS_LAYER_2 | | ||
734 | BLACKBIRD_AUDIO_BITS_LAYER_2_224 | | ||
735 | BLACKBIRD_AUDIO_BITS_STEREO | | ||
736 | /* BLACKBIRD_AUDIO_BITS_BOUND_4 | */ | ||
737 | BLACKBIRD_AUDIO_BITS_EMPHASIS_NONE | | ||
738 | BLACKBIRD_AUDIO_BITS_CRC_OFF | | ||
739 | BLACKBIRD_AUDIO_BITS_COPYRIGHT_OFF | | ||
740 | BLACKBIRD_AUDIO_BITS_COPY | ||
741 | ); | ||
449 | 742 | ||
450 | /* assign gop closure */ | 743 | /* assign gop closure */ |
451 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_GOP_CLOSURE, 1, 0, 0); | 744 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_CLOSURE, 1, 0, BLACKBIRD_GOP_CLOSURE_OFF); |
452 | 745 | ||
453 | /* assign audio properties */ | ||
454 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, 0 | (2 << 2) | (14 << 4)); | ||
455 | 746 | ||
456 | /* assign dnr filter mode */ | 747 | /* assign dnr filter mode */ |
457 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_DNR_FILTER_MODE, 2, 0, 0, 0); | 748 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MODE, 2, 0, |
749 | BLACKBIRD_DNR_BITS_MANUAL, | ||
750 | BLACKBIRD_MEDIAN_FILTER_DISABLED | ||
751 | ); | ||
458 | 752 | ||
459 | /* assign dnr filter props*/ | 753 | /* assign dnr filter props*/ |
460 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_DNR_FILTER_PROPS, 2, 0, 0, 0); | 754 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_MANUAL_DNR, 2, 0, 0, 0); |
461 | 755 | ||
462 | /* assign coring levels (luma_h, luma_l, chroma_h, chroma_l) */ | 756 | /* assign coring levels (luma_h, luma_l, chroma_h, chroma_l) */ |
463 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_CORING_LEVELS, 4, 0, 0, 255, 0, 255); | 757 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MEDIAN, 4, 0, 0, 255, 0, 255); |
464 | 758 | ||
465 | /* assign spatial filter type: luma_t: 1 = horiz_only, chroma_t: 1 = horiz_only */ | 759 | /* assign spatial filter type: luma_t: horiz_only, chroma_t: horiz_only */ |
466 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_SPATIAL_FILTER_TYPE, 2, 0, 1, 1); | 760 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_SPATIAL_FILTER, 2, 0, |
761 | BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, | ||
762 | BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ | ||
763 | ); | ||
467 | 764 | ||
468 | /* assign frame drop rate */ | 765 | /* assign frame drop rate */ |
469 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_DROP_RATE, 1, 0, 0); | 766 | /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_DROP_RATE, 1, 0, 0); */ |
470 | } | 767 | } |
471 | 768 | ||
472 | static int blackbird_initialize_codec(struct cx8802_dev *dev) | 769 | static int blackbird_initialize_codec(struct cx8802_dev *dev) |
@@ -476,7 +773,7 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) | |||
476 | int retval; | 773 | int retval; |
477 | 774 | ||
478 | dprintk(1,"Initialize codec\n"); | 775 | dprintk(1,"Initialize codec\n"); |
479 | retval = blackbird_api_cmd(dev, IVTV_API_ENC_PING_FW, 0, 0); /* ping */ | 776 | retval = blackbird_api_cmd(dev, BLACKBIRD_API_PING, 0, 0); /* ping */ |
480 | if (retval < 0) { | 777 | if (retval < 0) { |
481 | /* ping was not successful, reset and upload firmware */ | 778 | /* ping was not successful, reset and upload firmware */ |
482 | cx_write(MO_SRST_IO, 0); /* SYS_RSTO=0 */ | 779 | cx_write(MO_SRST_IO, 0); /* SYS_RSTO=0 */ |
@@ -491,13 +788,13 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) | |||
491 | if (dev->mailbox < 0) | 788 | if (dev->mailbox < 0) |
492 | return -1; | 789 | return -1; |
493 | 790 | ||
494 | retval = blackbird_api_cmd(dev, IVTV_API_ENC_PING_FW, 0, 0); /* ping */ | 791 | retval = blackbird_api_cmd(dev, BLACKBIRD_API_PING, 0, 0); /* ping */ |
495 | if (retval < 0) { | 792 | if (retval < 0) { |
496 | dprintk(0, "ERROR: Firmware ping failed!\n"); | 793 | dprintk(0, "ERROR: Firmware ping failed!\n"); |
497 | return -1; | 794 | return -1; |
498 | } | 795 | } |
499 | 796 | ||
500 | retval = blackbird_api_cmd(dev, IVTV_API_ENC_GETVER, 0, 1, &version); | 797 | retval = blackbird_api_cmd(dev, BLACKBIRD_API_GET_VERSION, 0, 1, &version); |
501 | if (retval < 0) { | 798 | if (retval < 0) { |
502 | dprintk(0, "ERROR: Firmware get encoder version failed!\n"); | 799 | dprintk(0, "ERROR: Firmware get encoder version failed!\n"); |
503 | return -1; | 800 | return -1; |
@@ -511,31 +808,39 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) | |||
511 | cx_write(MO_VBOS_CONTROL, 0x84A00); /* no 656 mode, 8-bit pixels, disable VBI */ | 808 | cx_write(MO_VBOS_CONTROL, 0x84A00); /* no 656 mode, 8-bit pixels, disable VBI */ |
512 | cx_clear(MO_OUTPUT_FORMAT, 0x0008); /* Normal Y-limits to let the mpeg encoder sync */ | 809 | cx_clear(MO_OUTPUT_FORMAT, 0x0008); /* Normal Y-limits to let the mpeg encoder sync */ |
513 | 810 | ||
514 | #if 0 /* FIXME */ | ||
515 | set_scale(dev, 720, 480, V4L2_FIELD_INTERLACED); | ||
516 | #endif | ||
517 | blackbird_codec_settings(dev); | 811 | blackbird_codec_settings(dev); |
518 | msleep(1); | 812 | msleep(1); |
519 | 813 | ||
520 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xef, 0xef); | 814 | /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xef, 0xef); |
521 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xf0, 0xf0); | 815 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xf0, 0xf0); |
522 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0x180, 0x180); | 816 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0x180, 0x180); */ |
523 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_PLACEHOLDER, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); | 817 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_CAPTURE_LINES, 2, 0, |
818 | BLACKBIRD_FIELD1_SAA7115, | ||
819 | BLACKBIRD_FIELD1_SAA7115 | ||
820 | ); | ||
821 | |||
822 | /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_PLACEHOLDER, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); */ | ||
823 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_CUSTOM_DATA, 12, 0, | ||
824 | BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, | ||
825 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); | ||
524 | 826 | ||
525 | blackbird_api_cmd(dev, IVTV_API_INITIALIZE_INPUT, 0, 0); /* initialize the video input */ | 827 | blackbird_api_cmd(dev, BLACKBIRD_API_INIT_VIDEO_INPUT, 0, 0); /* initialize the video input */ |
526 | 828 | ||
527 | msleep(1); | 829 | msleep(1); |
528 | 830 | ||
529 | blackbird_api_cmd(dev, IVTV_API_MUTE_VIDEO, 1, 0, 0); | 831 | blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_VIDEO, 1, 0, BLACKBIRD_UNMUTE); |
530 | msleep(1); | 832 | msleep(1); |
531 | blackbird_api_cmd(dev, IVTV_API_MUTE_AUDIO, 1, 0, 0); | 833 | blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_AUDIO, 1, 0, BLACKBIRD_UNMUTE); |
532 | msleep(1); | 834 | msleep(1); |
533 | 835 | ||
534 | blackbird_api_cmd(dev, IVTV_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); /* start capturing to the host interface */ | 836 | /* blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); // start capturing to the host interface */ |
535 | //blackbird_api_cmd(dev, IVTV_API_BEGIN_CAPTURE, 2, 0, 0, 0); /* start capturing to the host interface */ | 837 | blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, |
536 | msleep(1); | 838 | BLACKBIRD_MPEG_CAPTURE, |
839 | BLACKBIRD_RAW_BITS_NONE | ||
840 | ); /* start capturing to the host interface */ | ||
841 | msleep(10); | ||
537 | 842 | ||
538 | blackbird_api_cmd(dev, IVTV_API_REFRESH_INPUT, 0,0); | 843 | blackbird_api_cmd(dev, BLACKBIRD_API_REFRESH_INPUT, 0,0); |
539 | return 0; | 844 | return 0; |
540 | } | 845 | } |
541 | 846 | ||
@@ -709,7 +1014,12 @@ static int mpeg_release(struct inode *inode, struct file *file) | |||
709 | { | 1014 | { |
710 | struct cx8802_fh *fh = file->private_data; | 1015 | struct cx8802_fh *fh = file->private_data; |
711 | 1016 | ||
712 | blackbird_api_cmd(fh->dev, IVTV_API_END_CAPTURE, 3, 0, 1, 0, 0x13); | 1017 | /* blackbird_api_cmd(fh->dev, BLACKBIRD_API_END_CAPTURE, 3, 0, BLACKBIRD_END_NOW, 0, 0x13); */ |
1018 | blackbird_api_cmd(fh->dev, BLACKBIRD_API_END_CAPTURE, 3, 0, | ||
1019 | BLACKBIRD_END_NOW, | ||
1020 | BLACKBIRD_MPEG_CAPTURE, | ||
1021 | BLACKBIRD_RAW_BITS_NONE | ||
1022 | ); | ||
713 | 1023 | ||
714 | /* stop mpeg capture */ | 1024 | /* stop mpeg capture */ |
715 | if (fh->mpegq.streaming) | 1025 | if (fh->mpegq.streaming) |
@@ -908,4 +1218,5 @@ module_exit(blackbird_fini); | |||
908 | * Local variables: | 1218 | * Local variables: |
909 | * c-basic-offset: 8 | 1219 | * c-basic-offset: 8 |
910 | * End: | 1220 | * End: |
1221 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
911 | */ | 1222 | */ |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 367624822d77..ebf02a7f81e8 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-cards.c,v 1.66 2005/03/04 09:12:23 kraxel Exp $ | 2 | * $Id: cx88-cards.c,v 1.90 2005/07/28 02:47:42 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * card-specific stuff. | 5 | * card-specific stuff. |
@@ -35,6 +35,9 @@ struct cx88_board cx88_boards[] = { | |||
35 | [CX88_BOARD_UNKNOWN] = { | 35 | [CX88_BOARD_UNKNOWN] = { |
36 | .name = "UNKNOWN/GENERIC", | 36 | .name = "UNKNOWN/GENERIC", |
37 | .tuner_type = UNSET, | 37 | .tuner_type = UNSET, |
38 | .radio_type = UNSET, | ||
39 | .tuner_addr = ADDR_UNSET, | ||
40 | .radio_addr = ADDR_UNSET, | ||
38 | .input = {{ | 41 | .input = {{ |
39 | .type = CX88_VMUX_COMPOSITE1, | 42 | .type = CX88_VMUX_COMPOSITE1, |
40 | .vmux = 0, | 43 | .vmux = 0, |
@@ -52,6 +55,9 @@ struct cx88_board cx88_boards[] = { | |||
52 | [CX88_BOARD_HAUPPAUGE] = { | 55 | [CX88_BOARD_HAUPPAUGE] = { |
53 | .name = "Hauppauge WinTV 34xxx models", | 56 | .name = "Hauppauge WinTV 34xxx models", |
54 | .tuner_type = UNSET, | 57 | .tuner_type = UNSET, |
58 | .radio_type = UNSET, | ||
59 | .tuner_addr = ADDR_UNSET, | ||
60 | .radio_addr = ADDR_UNSET, | ||
55 | .tda9887_conf = TDA9887_PRESENT, | 61 | .tda9887_conf = TDA9887_PRESENT, |
56 | .input = {{ | 62 | .input = {{ |
57 | .type = CX88_VMUX_TELEVISION, | 63 | .type = CX88_VMUX_TELEVISION, |
@@ -78,14 +84,23 @@ struct cx88_board cx88_boards[] = { | |||
78 | [CX88_BOARD_GDI] = { | 84 | [CX88_BOARD_GDI] = { |
79 | .name = "GDI Black Gold", | 85 | .name = "GDI Black Gold", |
80 | .tuner_type = UNSET, | 86 | .tuner_type = UNSET, |
87 | .radio_type = UNSET, | ||
88 | .tuner_addr = ADDR_UNSET, | ||
89 | .radio_addr = ADDR_UNSET, | ||
81 | .input = {{ | 90 | .input = {{ |
82 | .type = CX88_VMUX_TELEVISION, | 91 | .type = CX88_VMUX_TELEVISION, |
83 | .vmux = 0, | 92 | .vmux = 0, |
93 | },{ | ||
94 | .type = CX88_VMUX_SVIDEO, | ||
95 | .vmux = 2, | ||
84 | }}, | 96 | }}, |
85 | }, | 97 | }, |
86 | [CX88_BOARD_PIXELVIEW] = { | 98 | [CX88_BOARD_PIXELVIEW] = { |
87 | .name = "PixelView", | 99 | .name = "PixelView", |
88 | .tuner_type = 5, | 100 | .tuner_type = TUNER_PHILIPS_PAL, |
101 | .radio_type = UNSET, | ||
102 | .tuner_addr = ADDR_UNSET, | ||
103 | .radio_addr = ADDR_UNSET, | ||
89 | .input = {{ | 104 | .input = {{ |
90 | .type = CX88_VMUX_TELEVISION, | 105 | .type = CX88_VMUX_TELEVISION, |
91 | .vmux = 0, | 106 | .vmux = 0, |
@@ -104,7 +119,10 @@ struct cx88_board cx88_boards[] = { | |||
104 | }, | 119 | }, |
105 | [CX88_BOARD_ATI_WONDER_PRO] = { | 120 | [CX88_BOARD_ATI_WONDER_PRO] = { |
106 | .name = "ATI TV Wonder Pro", | 121 | .name = "ATI TV Wonder Pro", |
107 | .tuner_type = 44, | 122 | .tuner_type = TUNER_PHILIPS_4IN1, |
123 | .radio_type = UNSET, | ||
124 | .tuner_addr = ADDR_UNSET, | ||
125 | .radio_addr = ADDR_UNSET, | ||
108 | .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, | 126 | .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, |
109 | .input = {{ | 127 | .input = {{ |
110 | .type = CX88_VMUX_TELEVISION, | 128 | .type = CX88_VMUX_TELEVISION, |
@@ -122,7 +140,10 @@ struct cx88_board cx88_boards[] = { | |||
122 | }, | 140 | }, |
123 | [CX88_BOARD_WINFAST2000XP_EXPERT] = { | 141 | [CX88_BOARD_WINFAST2000XP_EXPERT] = { |
124 | .name = "Leadtek Winfast 2000XP Expert", | 142 | .name = "Leadtek Winfast 2000XP Expert", |
125 | .tuner_type = 44, | 143 | .tuner_type = TUNER_PHILIPS_4IN1, |
144 | .radio_type = UNSET, | ||
145 | .tuner_addr = ADDR_UNSET, | ||
146 | .radio_addr = ADDR_UNSET, | ||
126 | .tda9887_conf = TDA9887_PRESENT, | 147 | .tda9887_conf = TDA9887_PRESENT, |
127 | .input = {{ | 148 | .input = {{ |
128 | .type = CX88_VMUX_TELEVISION, | 149 | .type = CX88_VMUX_TELEVISION, |
@@ -156,7 +177,10 @@ struct cx88_board cx88_boards[] = { | |||
156 | }, | 177 | }, |
157 | [CX88_BOARD_AVERTV_303] = { | 178 | [CX88_BOARD_AVERTV_303] = { |
158 | .name = "AverTV Studio 303 (M126)", | 179 | .name = "AverTV Studio 303 (M126)", |
159 | .tuner_type = 38, | 180 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
181 | .radio_type = UNSET, | ||
182 | .tuner_addr = ADDR_UNSET, | ||
183 | .radio_addr = ADDR_UNSET, | ||
160 | .tda9887_conf = TDA9887_PRESENT, | 184 | .tda9887_conf = TDA9887_PRESENT, |
161 | .input = {{ | 185 | .input = {{ |
162 | .type = CX88_VMUX_TELEVISION, | 186 | .type = CX88_VMUX_TELEVISION, |
@@ -179,7 +203,10 @@ struct cx88_board cx88_boards[] = { | |||
179 | // added gpio values thanks to Michal | 203 | // added gpio values thanks to Michal |
180 | // values for PAL from DScaler | 204 | // values for PAL from DScaler |
181 | .name = "MSI TV-@nywhere Master", | 205 | .name = "MSI TV-@nywhere Master", |
182 | .tuner_type = 33, | 206 | .tuner_type = TUNER_MT2032, |
207 | .radio_type = UNSET, | ||
208 | .tuner_addr = ADDR_UNSET, | ||
209 | .radio_addr = ADDR_UNSET, | ||
183 | .tda9887_conf = TDA9887_PRESENT, | 210 | .tda9887_conf = TDA9887_PRESENT, |
184 | .input = {{ | 211 | .input = {{ |
185 | .type = CX88_VMUX_TELEVISION, | 212 | .type = CX88_VMUX_TELEVISION, |
@@ -206,7 +233,10 @@ struct cx88_board cx88_boards[] = { | |||
206 | }, | 233 | }, |
207 | [CX88_BOARD_WINFAST_DV2000] = { | 234 | [CX88_BOARD_WINFAST_DV2000] = { |
208 | .name = "Leadtek Winfast DV2000", | 235 | .name = "Leadtek Winfast DV2000", |
209 | .tuner_type = 38, | 236 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
237 | .radio_type = UNSET, | ||
238 | .tuner_addr = ADDR_UNSET, | ||
239 | .radio_addr = ADDR_UNSET, | ||
210 | .tda9887_conf = TDA9887_PRESENT, | 240 | .tda9887_conf = TDA9887_PRESENT, |
211 | .input = {{ | 241 | .input = {{ |
212 | .type = CX88_VMUX_TELEVISION, | 242 | .type = CX88_VMUX_TELEVISION, |
@@ -239,34 +269,40 @@ struct cx88_board cx88_boards[] = { | |||
239 | .gpio3 = 0x02000000, | 269 | .gpio3 = 0x02000000, |
240 | }, | 270 | }, |
241 | }, | 271 | }, |
242 | [CX88_BOARD_LEADTEK_PVR2000] = { | 272 | [CX88_BOARD_LEADTEK_PVR2000] = { |
243 | // gpio values for PAL version from regspy by DScaler | 273 | // gpio values for PAL version from regspy by DScaler |
244 | .name = "Leadtek PVR 2000", | 274 | .name = "Leadtek PVR 2000", |
245 | .tuner_type = 38, | 275 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
276 | .radio_type = UNSET, | ||
277 | .tuner_addr = ADDR_UNSET, | ||
278 | .radio_addr = ADDR_UNSET, | ||
246 | .tda9887_conf = TDA9887_PRESENT, | 279 | .tda9887_conf = TDA9887_PRESENT, |
247 | .input = {{ | 280 | .input = {{ |
248 | .type = CX88_VMUX_TELEVISION, | 281 | .type = CX88_VMUX_TELEVISION, |
249 | .vmux = 0, | 282 | .vmux = 0, |
250 | .gpio0 = 0x0000bde6, | 283 | .gpio0 = 0x0000bde2, |
251 | },{ | 284 | },{ |
252 | .type = CX88_VMUX_COMPOSITE1, | 285 | .type = CX88_VMUX_COMPOSITE1, |
253 | .vmux = 1, | 286 | .vmux = 1, |
254 | .gpio0 = 0x0000bde6, | 287 | .gpio0 = 0x0000bde6, |
255 | },{ | 288 | },{ |
256 | .type = CX88_VMUX_SVIDEO, | 289 | .type = CX88_VMUX_SVIDEO, |
257 | .vmux = 2, | 290 | .vmux = 2, |
258 | .gpio0 = 0x0000bde6, | 291 | .gpio0 = 0x0000bde6, |
259 | }}, | 292 | }}, |
260 | .radio = { | 293 | .radio = { |
261 | .type = CX88_RADIO, | 294 | .type = CX88_RADIO, |
262 | .gpio0 = 0x0000bd62, | 295 | .gpio0 = 0x0000bd62, |
263 | }, | 296 | }, |
264 | .blackbird = 1, | 297 | .blackbird = 1, |
265 | }, | 298 | }, |
266 | [CX88_BOARD_IODATA_GVVCP3PCI] = { | 299 | [CX88_BOARD_IODATA_GVVCP3PCI] = { |
267 | .name = "IODATA GV-VCP3/PCI", | 300 | .name = "IODATA GV-VCP3/PCI", |
268 | .tuner_type = TUNER_ABSENT, | 301 | .tuner_type = TUNER_ABSENT, |
269 | .input = {{ | 302 | .radio_type = UNSET, |
303 | .tuner_addr = ADDR_UNSET, | ||
304 | .radio_addr = ADDR_UNSET, | ||
305 | .input = {{ | ||
270 | .type = CX88_VMUX_COMPOSITE1, | 306 | .type = CX88_VMUX_COMPOSITE1, |
271 | .vmux = 0, | 307 | .vmux = 0, |
272 | },{ | 308 | },{ |
@@ -279,7 +315,10 @@ struct cx88_board cx88_boards[] = { | |||
279 | }, | 315 | }, |
280 | [CX88_BOARD_PROLINK_PLAYTVPVR] = { | 316 | [CX88_BOARD_PROLINK_PLAYTVPVR] = { |
281 | .name = "Prolink PlayTV PVR", | 317 | .name = "Prolink PlayTV PVR", |
282 | .tuner_type = 43, | 318 | .tuner_type = TUNER_PHILIPS_FM1236_MK3, |
319 | .radio_type = UNSET, | ||
320 | .tuner_addr = ADDR_UNSET, | ||
321 | .radio_addr = ADDR_UNSET, | ||
283 | .tda9887_conf = TDA9887_PRESENT, | 322 | .tda9887_conf = TDA9887_PRESENT, |
284 | .input = {{ | 323 | .input = {{ |
285 | .type = CX88_VMUX_TELEVISION, | 324 | .type = CX88_VMUX_TELEVISION, |
@@ -301,8 +340,11 @@ struct cx88_board cx88_boards[] = { | |||
301 | }, | 340 | }, |
302 | [CX88_BOARD_ASUS_PVR_416] = { | 341 | [CX88_BOARD_ASUS_PVR_416] = { |
303 | .name = "ASUS PVR-416", | 342 | .name = "ASUS PVR-416", |
304 | .tuner_type = 43, | 343 | .tuner_type = TUNER_PHILIPS_FM1236_MK3, |
305 | .tda9887_conf = TDA9887_PRESENT, | 344 | .radio_type = UNSET, |
345 | .tuner_addr = ADDR_UNSET, | ||
346 | .radio_addr = ADDR_UNSET, | ||
347 | .tda9887_conf = TDA9887_PRESENT, | ||
306 | .input = {{ | 348 | .input = {{ |
307 | .type = CX88_VMUX_TELEVISION, | 349 | .type = CX88_VMUX_TELEVISION, |
308 | .vmux = 0, | 350 | .vmux = 0, |
@@ -320,7 +362,10 @@ struct cx88_board cx88_boards[] = { | |||
320 | }, | 362 | }, |
321 | [CX88_BOARD_MSI_TVANYWHERE] = { | 363 | [CX88_BOARD_MSI_TVANYWHERE] = { |
322 | .name = "MSI TV-@nywhere", | 364 | .name = "MSI TV-@nywhere", |
323 | .tuner_type = 33, | 365 | .tuner_type = TUNER_MT2032, |
366 | .radio_type = UNSET, | ||
367 | .tuner_addr = ADDR_UNSET, | ||
368 | .radio_addr = ADDR_UNSET, | ||
324 | .tda9887_conf = TDA9887_PRESENT, | 369 | .tda9887_conf = TDA9887_PRESENT, |
325 | .input = {{ | 370 | .input = {{ |
326 | .type = CX88_VMUX_TELEVISION, | 371 | .type = CX88_VMUX_TELEVISION, |
@@ -342,6 +387,9 @@ struct cx88_board cx88_boards[] = { | |||
342 | [CX88_BOARD_KWORLD_DVB_T] = { | 387 | [CX88_BOARD_KWORLD_DVB_T] = { |
343 | .name = "KWorld/VStream XPert DVB-T", | 388 | .name = "KWorld/VStream XPert DVB-T", |
344 | .tuner_type = TUNER_ABSENT, | 389 | .tuner_type = TUNER_ABSENT, |
390 | .radio_type = UNSET, | ||
391 | .tuner_addr = ADDR_UNSET, | ||
392 | .radio_addr = ADDR_UNSET, | ||
345 | .input = {{ | 393 | .input = {{ |
346 | .type = CX88_VMUX_COMPOSITE1, | 394 | .type = CX88_VMUX_COMPOSITE1, |
347 | .vmux = 1, | 395 | .vmux = 1, |
@@ -356,8 +404,11 @@ struct cx88_board cx88_boards[] = { | |||
356 | .dvb = 1, | 404 | .dvb = 1, |
357 | }, | 405 | }, |
358 | [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1] = { | 406 | [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1] = { |
359 | .name = "DVICO FusionHDTV DVB-T1", | 407 | .name = "DViCO FusionHDTV DVB-T1", |
360 | .tuner_type = TUNER_ABSENT, /* No analog tuner */ | 408 | .tuner_type = TUNER_ABSENT, /* No analog tuner */ |
409 | .radio_type = UNSET, | ||
410 | .tuner_addr = ADDR_UNSET, | ||
411 | .radio_addr = ADDR_UNSET, | ||
361 | .input = {{ | 412 | .input = {{ |
362 | .type = CX88_VMUX_COMPOSITE1, | 413 | .type = CX88_VMUX_COMPOSITE1, |
363 | .vmux = 1, | 414 | .vmux = 1, |
@@ -371,7 +422,10 @@ struct cx88_board cx88_boards[] = { | |||
371 | }, | 422 | }, |
372 | [CX88_BOARD_KWORLD_LTV883] = { | 423 | [CX88_BOARD_KWORLD_LTV883] = { |
373 | .name = "KWorld LTV883RF", | 424 | .name = "KWorld LTV883RF", |
374 | .tuner_type = 48, | 425 | .tuner_type = TUNER_TNF_8831BGFF, |
426 | .radio_type = UNSET, | ||
427 | .tuner_addr = ADDR_UNSET, | ||
428 | .radio_addr = ADDR_UNSET, | ||
375 | .input = {{ | 429 | .input = {{ |
376 | .type = CX88_VMUX_TELEVISION, | 430 | .type = CX88_VMUX_TELEVISION, |
377 | .vmux = 0, | 431 | .vmux = 0, |
@@ -394,9 +448,12 @@ struct cx88_board cx88_boards[] = { | |||
394 | .gpio0 = 0x000007f8, | 448 | .gpio0 = 0x000007f8, |
395 | }, | 449 | }, |
396 | }, | 450 | }, |
397 | [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD] = { | 451 | [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q] = { |
398 | .name = "DViCO - FusionHDTV 3 Gold", | 452 | .name = "DViCO FusionHDTV 3 Gold-Q", |
399 | .tuner_type = TUNER_MICROTUNE_4042FI5, | 453 | .tuner_type = TUNER_MICROTUNE_4042FI5, |
454 | .radio_type = UNSET, | ||
455 | .tuner_addr = ADDR_UNSET, | ||
456 | .radio_addr = ADDR_UNSET, | ||
400 | /* | 457 | /* |
401 | GPIO[0] resets DT3302 DTV receiver | 458 | GPIO[0] resets DT3302 DTV receiver |
402 | 0 - reset asserted | 459 | 0 - reset asserted |
@@ -410,6 +467,9 @@ struct cx88_board cx88_boards[] = { | |||
410 | GPIO[3] selects RF input connector on tuner module | 467 | GPIO[3] selects RF input connector on tuner module |
411 | 0 - RF connector labeled CABLE | 468 | 0 - RF connector labeled CABLE |
412 | 1 - RF connector labeled ANT | 469 | 1 - RF connector labeled ANT |
470 | GPIO[4] selects high RF for QAM256 mode | ||
471 | 0 - normal RF | ||
472 | 1 - high RF | ||
413 | */ | 473 | */ |
414 | .input = {{ | 474 | .input = {{ |
415 | .type = CX88_VMUX_TELEVISION, | 475 | .type = CX88_VMUX_TELEVISION, |
@@ -428,25 +488,29 @@ struct cx88_board cx88_boards[] = { | |||
428 | .vmux = 2, | 488 | .vmux = 2, |
429 | .gpio0 = 0x0f00, | 489 | .gpio0 = 0x0f00, |
430 | }}, | 490 | }}, |
431 | #if 0 | 491 | .dvb = 1, |
432 | .ts = { | ||
433 | .type = CX88_TS, | ||
434 | .gpio0 = 0x00000f01, /* Hooked to tuner reset bit */ | ||
435 | } | ||
436 | #endif | ||
437 | }, | 492 | }, |
438 | [CX88_BOARD_HAUPPAUGE_DVB_T1] = { | 493 | [CX88_BOARD_HAUPPAUGE_DVB_T1] = { |
439 | .name = "Hauppauge Nova-T DVB-T", | 494 | .name = "Hauppauge Nova-T DVB-T", |
440 | .tuner_type = TUNER_ABSENT, | 495 | .tuner_type = TUNER_ABSENT, |
441 | .input = {{ | 496 | .radio_type = UNSET, |
497 | .tuner_addr = ADDR_UNSET, | ||
498 | .radio_addr = ADDR_UNSET, | ||
499 | .input = {{ | ||
442 | .type = CX88_VMUX_DVB, | 500 | .type = CX88_VMUX_DVB, |
443 | .vmux = 0, | 501 | .vmux = 0, |
502 | },{ | ||
503 | .type = CX88_VMUX_SVIDEO, | ||
504 | .vmux = 2, | ||
444 | }}, | 505 | }}, |
445 | .dvb = 1, | 506 | .dvb = 1, |
446 | }, | 507 | }, |
447 | [CX88_BOARD_CONEXANT_DVB_T1] = { | 508 | [CX88_BOARD_CONEXANT_DVB_T1] = { |
448 | .name = "Conexant DVB-T reference design", | 509 | .name = "Conexant DVB-T reference design", |
449 | .tuner_type = TUNER_ABSENT, | 510 | .tuner_type = TUNER_ABSENT, |
511 | .radio_type = UNSET, | ||
512 | .tuner_addr = ADDR_UNSET, | ||
513 | .radio_addr = ADDR_UNSET, | ||
450 | .input = {{ | 514 | .input = {{ |
451 | .type = CX88_VMUX_DVB, | 515 | .type = CX88_VMUX_DVB, |
452 | .vmux = 0, | 516 | .vmux = 0, |
@@ -456,6 +520,9 @@ struct cx88_board cx88_boards[] = { | |||
456 | [CX88_BOARD_PROVIDEO_PV259] = { | 520 | [CX88_BOARD_PROVIDEO_PV259] = { |
457 | .name = "Provideo PV259", | 521 | .name = "Provideo PV259", |
458 | .tuner_type = TUNER_PHILIPS_FQ1216ME, | 522 | .tuner_type = TUNER_PHILIPS_FQ1216ME, |
523 | .radio_type = UNSET, | ||
524 | .tuner_addr = ADDR_UNSET, | ||
525 | .radio_addr = ADDR_UNSET, | ||
459 | .input = {{ | 526 | .input = {{ |
460 | .type = CX88_VMUX_TELEVISION, | 527 | .type = CX88_VMUX_TELEVISION, |
461 | .vmux = 0, | 528 | .vmux = 0, |
@@ -463,8 +530,11 @@ struct cx88_board cx88_boards[] = { | |||
463 | .blackbird = 1, | 530 | .blackbird = 1, |
464 | }, | 531 | }, |
465 | [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS] = { | 532 | [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS] = { |
466 | .name = "DVICO FusionHDTV DVB-T Plus", | 533 | .name = "DViCO FusionHDTV DVB-T Plus", |
467 | .tuner_type = TUNER_ABSENT, /* No analog tuner */ | 534 | .tuner_type = TUNER_ABSENT, /* No analog tuner */ |
535 | .radio_type = UNSET, | ||
536 | .tuner_addr = ADDR_UNSET, | ||
537 | .radio_addr = ADDR_UNSET, | ||
468 | .input = {{ | 538 | .input = {{ |
469 | .type = CX88_VMUX_COMPOSITE1, | 539 | .type = CX88_VMUX_COMPOSITE1, |
470 | .vmux = 1, | 540 | .vmux = 1, |
@@ -479,6 +549,9 @@ struct cx88_board cx88_boards[] = { | |||
479 | [CX88_BOARD_DNTV_LIVE_DVB_T] = { | 549 | [CX88_BOARD_DNTV_LIVE_DVB_T] = { |
480 | .name = "digitalnow DNTV Live! DVB-T", | 550 | .name = "digitalnow DNTV Live! DVB-T", |
481 | .tuner_type = TUNER_ABSENT, | 551 | .tuner_type = TUNER_ABSENT, |
552 | .radio_type = UNSET, | ||
553 | .tuner_addr = ADDR_UNSET, | ||
554 | .radio_addr = ADDR_UNSET, | ||
482 | .input = {{ | 555 | .input = {{ |
483 | .type = CX88_VMUX_COMPOSITE1, | 556 | .type = CX88_VMUX_COMPOSITE1, |
484 | .vmux = 1, | 557 | .vmux = 1, |
@@ -495,6 +568,9 @@ struct cx88_board cx88_boards[] = { | |||
495 | [CX88_BOARD_PCHDTV_HD3000] = { | 568 | [CX88_BOARD_PCHDTV_HD3000] = { |
496 | .name = "pcHDTV HD3000 HDTV", | 569 | .name = "pcHDTV HD3000 HDTV", |
497 | .tuner_type = TUNER_THOMSON_DTT7610, | 570 | .tuner_type = TUNER_THOMSON_DTT7610, |
571 | .radio_type = UNSET, | ||
572 | .tuner_addr = ADDR_UNSET, | ||
573 | .radio_addr = ADDR_UNSET, | ||
498 | .input = {{ | 574 | .input = {{ |
499 | .type = CX88_VMUX_TELEVISION, | 575 | .type = CX88_VMUX_TELEVISION, |
500 | .vmux = 0, | 576 | .vmux = 0, |
@@ -530,8 +606,11 @@ struct cx88_board cx88_boards[] = { | |||
530 | [CX88_BOARD_HAUPPAUGE_ROSLYN] = { | 606 | [CX88_BOARD_HAUPPAUGE_ROSLYN] = { |
531 | // entry added by Kaustubh D. Bhalerao <bhalerao.1@osu.edu> | 607 | // entry added by Kaustubh D. Bhalerao <bhalerao.1@osu.edu> |
532 | // GPIO values obtained from regspy, courtesy Sean Covel | 608 | // GPIO values obtained from regspy, courtesy Sean Covel |
533 | .name = "Hauppauge WinTV 28xxx (Roslyn) models", | 609 | .name = "Hauppauge WinTV 28xxx (Roslyn) models", |
534 | .tuner_type = UNSET, | 610 | .tuner_type = UNSET, |
611 | .radio_type = UNSET, | ||
612 | .tuner_addr = ADDR_UNSET, | ||
613 | .radio_addr = ADDR_UNSET, | ||
535 | .input = {{ | 614 | .input = {{ |
536 | .type = CX88_VMUX_TELEVISION, | 615 | .type = CX88_VMUX_TELEVISION, |
537 | .vmux = 0, | 616 | .vmux = 0, |
@@ -559,33 +638,37 @@ struct cx88_board cx88_boards[] = { | |||
559 | .blackbird = 1, | 638 | .blackbird = 1, |
560 | }, | 639 | }, |
561 | [CX88_BOARD_DIGITALLOGIC_MEC] = { | 640 | [CX88_BOARD_DIGITALLOGIC_MEC] = { |
562 | /* params copied over from Leadtek PVR 2000 */ | ||
563 | .name = "Digital-Logic MICROSPACE Entertainment Center (MEC)", | 641 | .name = "Digital-Logic MICROSPACE Entertainment Center (MEC)", |
564 | /* not sure yet about the tuner type */ | 642 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
565 | .tuner_type = 38, | 643 | .radio_type = UNSET, |
644 | .tuner_addr = ADDR_UNSET, | ||
645 | .radio_addr = ADDR_UNSET, | ||
566 | .tda9887_conf = TDA9887_PRESENT, | 646 | .tda9887_conf = TDA9887_PRESENT, |
567 | .input = {{ | 647 | .input = {{ |
568 | .type = CX88_VMUX_TELEVISION, | 648 | .type = CX88_VMUX_TELEVISION, |
569 | .vmux = 0, | 649 | .vmux = 0, |
570 | .gpio0 = 0x0000bde6, | 650 | .gpio0 = 0x00009d80, |
571 | },{ | 651 | },{ |
572 | .type = CX88_VMUX_COMPOSITE1, | 652 | .type = CX88_VMUX_COMPOSITE1, |
573 | .vmux = 1, | 653 | .vmux = 1, |
574 | .gpio0 = 0x0000bde6, | 654 | .gpio0 = 0x00009d76, |
575 | },{ | 655 | },{ |
576 | .type = CX88_VMUX_SVIDEO, | 656 | .type = CX88_VMUX_SVIDEO, |
577 | .vmux = 2, | 657 | .vmux = 2, |
578 | .gpio0 = 0x0000bde6, | 658 | .gpio0 = 0x00009d76, |
579 | }}, | 659 | }}, |
580 | .radio = { | 660 | .radio = { |
581 | .type = CX88_RADIO, | 661 | .type = CX88_RADIO, |
582 | .gpio0 = 0x0000bd62, | 662 | .gpio0 = 0x00009d00, |
583 | }, | 663 | }, |
584 | .blackbird = 1, | 664 | .blackbird = 1, |
585 | }, | 665 | }, |
586 | [CX88_BOARD_IODATA_GVBCTV7E] = { | 666 | [CX88_BOARD_IODATA_GVBCTV7E] = { |
587 | .name = "IODATA GV/BCTV7E", | 667 | .name = "IODATA GV/BCTV7E", |
588 | .tuner_type = TUNER_PHILIPS_FQ1286, | 668 | .tuner_type = TUNER_PHILIPS_FQ1286, |
669 | .radio_type = UNSET, | ||
670 | .tuner_addr = ADDR_UNSET, | ||
671 | .radio_addr = ADDR_UNSET, | ||
589 | .tda9887_conf = TDA9887_PRESENT, | 672 | .tda9887_conf = TDA9887_PRESENT, |
590 | .input = {{ | 673 | .input = {{ |
591 | .type = CX88_VMUX_TELEVISION, | 674 | .type = CX88_VMUX_TELEVISION, |
@@ -601,6 +684,102 @@ struct cx88_board cx88_boards[] = { | |||
601 | .gpio1 = 0x0000e07f, | 684 | .gpio1 = 0x0000e07f, |
602 | }} | 685 | }} |
603 | }, | 686 | }, |
687 | [CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO] = { | ||
688 | .name = "PixelView PlayTV Ultra Pro (Stereo)", | ||
689 | /* May be also TUNER_YMEC_TVF_5533MF for NTSC/M or PAL/M */ | ||
690 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | ||
691 | .radio_type = UNSET, | ||
692 | .tuner_addr = ADDR_UNSET, | ||
693 | .radio_addr = ADDR_UNSET, | ||
694 | .input = {{ | ||
695 | .type = CX88_VMUX_TELEVISION, | ||
696 | .vmux = 0, | ||
697 | .gpio0 = 0xbf61, /* internal decoder */ | ||
698 | },{ | ||
699 | .type = CX88_VMUX_COMPOSITE1, | ||
700 | .vmux = 1, | ||
701 | .gpio0 = 0xbf63, | ||
702 | },{ | ||
703 | .type = CX88_VMUX_SVIDEO, | ||
704 | .vmux = 2, | ||
705 | .gpio0 = 0xbf63, | ||
706 | }}, | ||
707 | .radio = { | ||
708 | .type = CX88_RADIO, | ||
709 | .gpio0 = 0xbf60, | ||
710 | }, | ||
711 | }, | ||
712 | [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T] = { | ||
713 | .name = "DViCO FusionHDTV 3 Gold-T", | ||
714 | .tuner_type = TUNER_THOMSON_DTT7611, | ||
715 | .radio_type = UNSET, | ||
716 | .tuner_addr = ADDR_UNSET, | ||
717 | .radio_addr = ADDR_UNSET, | ||
718 | /* See DViCO FusionHDTV 3 Gold-Q for GPIO documentation. */ | ||
719 | .input = {{ | ||
720 | .type = CX88_VMUX_TELEVISION, | ||
721 | .vmux = 0, | ||
722 | .gpio0 = 0x0f0d, | ||
723 | },{ | ||
724 | .type = CX88_VMUX_COMPOSITE1, | ||
725 | .vmux = 1, | ||
726 | .gpio0 = 0x0f00, | ||
727 | },{ | ||
728 | .type = CX88_VMUX_SVIDEO, | ||
729 | .vmux = 2, | ||
730 | .gpio0 = 0x0f00, | ||
731 | }}, | ||
732 | .dvb = 1, | ||
733 | }, | ||
734 | [CX88_BOARD_ADSTECH_DVB_T_PCI] = { | ||
735 | .name = "ADS Tech Instant TV DVB-T PCI", | ||
736 | .tuner_type = TUNER_ABSENT, | ||
737 | .radio_type = UNSET, | ||
738 | .tuner_addr = ADDR_UNSET, | ||
739 | .radio_addr = ADDR_UNSET, | ||
740 | .input = {{ | ||
741 | .type = CX88_VMUX_COMPOSITE1, | ||
742 | .vmux = 1, | ||
743 | .gpio0 = 0x0700, | ||
744 | .gpio2 = 0x0101, | ||
745 | },{ | ||
746 | .type = CX88_VMUX_SVIDEO, | ||
747 | .vmux = 2, | ||
748 | .gpio0 = 0x0700, | ||
749 | .gpio2 = 0x0101, | ||
750 | }}, | ||
751 | .dvb = 1, | ||
752 | }, | ||
753 | [CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1] = { | ||
754 | .name = "TerraTec Cinergy 1400 DVB-T", | ||
755 | .tuner_type = TUNER_ABSENT, | ||
756 | .input = {{ | ||
757 | .type = CX88_VMUX_DVB, | ||
758 | .vmux = 0, | ||
759 | }}, | ||
760 | .dvb = 1, | ||
761 | }, | ||
762 | [CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD] = { | ||
763 | .name = "DViCO FusionHDTV 5 Gold", | ||
764 | .tuner_type = TUNER_LG_TDVS_H062F, | ||
765 | .radio_type = UNSET, | ||
766 | .tuner_addr = ADDR_UNSET, | ||
767 | .radio_addr = ADDR_UNSET, | ||
768 | /* See DViCO FusionHDTV 3 Gold-Q for GPIO documentation. */ | ||
769 | .input = {{ | ||
770 | .type = CX88_VMUX_TELEVISION, | ||
771 | .vmux = 0, | ||
772 | .gpio0 = 0x0f0d, | ||
773 | },{ | ||
774 | .type = CX88_VMUX_COMPOSITE1, | ||
775 | .vmux = 1, | ||
776 | .gpio0 = 0x0f00, | ||
777 | },{ | ||
778 | .type = CX88_VMUX_SVIDEO, | ||
779 | .vmux = 2, | ||
780 | .gpio0 = 0x0f00, | ||
781 | }}, | ||
782 | }, | ||
604 | }; | 783 | }; |
605 | const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); | 784 | const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); |
606 | 785 | ||
@@ -671,7 +850,11 @@ struct cx88_subid cx88_subids[] = { | |||
671 | },{ | 850 | },{ |
672 | .subvendor = 0x18ac, | 851 | .subvendor = 0x18ac, |
673 | .subdevice = 0xd810, | 852 | .subdevice = 0xd810, |
674 | .card = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD, | 853 | .card = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q, |
854 | },{ | ||
855 | .subvendor = 0x18ac, | ||
856 | .subdevice = 0xd820, | ||
857 | .card = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T, | ||
675 | },{ | 858 | },{ |
676 | .subvendor = 0x18AC, | 859 | .subvendor = 0x18AC, |
677 | .subdevice = 0xDB00, | 860 | .subdevice = 0xDB00, |
@@ -716,7 +899,19 @@ struct cx88_subid cx88_subids[] = { | |||
716 | .subvendor = 0x10fc, | 899 | .subvendor = 0x10fc, |
717 | .subdevice = 0xd035, | 900 | .subdevice = 0xd035, |
718 | .card = CX88_BOARD_IODATA_GVBCTV7E, | 901 | .card = CX88_BOARD_IODATA_GVBCTV7E, |
719 | } | 902 | },{ |
903 | .subvendor = 0x1421, | ||
904 | .subdevice = 0x0334, | ||
905 | .card = CX88_BOARD_ADSTECH_DVB_T_PCI, | ||
906 | },{ | ||
907 | .subvendor = 0x153b, | ||
908 | .subdevice = 0x1166, | ||
909 | .card = CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1, | ||
910 | },{ | ||
911 | .subvendor = 0x18ac, | ||
912 | .subdevice = 0xd500, | ||
913 | .card = CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD, | ||
914 | }, | ||
720 | }; | 915 | }; |
721 | const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); | 916 | const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); |
722 | 917 | ||
@@ -935,4 +1130,5 @@ EXPORT_SYMBOL(cx88_card_setup); | |||
935 | * Local variables: | 1130 | * Local variables: |
936 | * c-basic-offset: 8 | 1131 | * c-basic-offset: 8 |
937 | * End: | 1132 | * End: |
1133 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
938 | */ | 1134 | */ |
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 1ff79b5a8835..5e868f5cd0c0 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-core.c,v 1.24 2005/01/19 12:01:55 kraxel Exp $ | 2 | * $Id: cx88-core.c,v 1.33 2005/07/07 14:17:47 mchehab Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * driver core | 5 | * driver core |
@@ -51,12 +51,15 @@ module_param(latency,int,0444); | |||
51 | MODULE_PARM_DESC(latency,"pci latency timer"); | 51 | MODULE_PARM_DESC(latency,"pci latency timer"); |
52 | 52 | ||
53 | static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; | 53 | static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; |
54 | static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; | ||
54 | static unsigned int card[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; | 55 | static unsigned int card[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; |
55 | 56 | ||
56 | module_param_array(tuner, int, NULL, 0444); | 57 | module_param_array(tuner, int, NULL, 0444); |
58 | module_param_array(radio, int, NULL, 0444); | ||
57 | module_param_array(card, int, NULL, 0444); | 59 | module_param_array(card, int, NULL, 0444); |
58 | 60 | ||
59 | MODULE_PARM_DESC(tuner,"tuner type"); | 61 | MODULE_PARM_DESC(tuner,"tuner type"); |
62 | MODULE_PARM_DESC(radio,"radio tuner type"); | ||
60 | MODULE_PARM_DESC(card,"card type"); | 63 | MODULE_PARM_DESC(card,"card type"); |
61 | 64 | ||
62 | static unsigned int nicam = 0; | 65 | static unsigned int nicam = 0; |
@@ -429,7 +432,7 @@ int cx88_sram_channel_setup(struct cx88_core *core, | |||
429 | /* ------------------------------------------------------------------ */ | 432 | /* ------------------------------------------------------------------ */ |
430 | /* debug helper code */ | 433 | /* debug helper code */ |
431 | 434 | ||
432 | static int cx88_risc_decode(u32 risc) | 435 | int cx88_risc_decode(u32 risc) |
433 | { | 436 | { |
434 | static char *instr[16] = { | 437 | static char *instr[16] = { |
435 | [ RISC_SYNC >> 28 ] = "sync", | 438 | [ RISC_SYNC >> 28 ] = "sync", |
@@ -467,25 +470,6 @@ static int cx88_risc_decode(u32 risc) | |||
467 | return incr[risc >> 28] ? incr[risc >> 28] : 1; | 470 | return incr[risc >> 28] ? incr[risc >> 28] : 1; |
468 | } | 471 | } |
469 | 472 | ||
470 | #if 0 /* currently unused, but useful for debugging */ | ||
471 | void cx88_risc_disasm(struct cx88_core *core, | ||
472 | struct btcx_riscmem *risc) | ||
473 | { | ||
474 | unsigned int i,j,n; | ||
475 | |||
476 | printk("%s: risc disasm: %p [dma=0x%08lx]\n", | ||
477 | core->name, risc->cpu, (unsigned long)risc->dma); | ||
478 | for (i = 0; i < (risc->size >> 2); i += n) { | ||
479 | printk("%s: %04d: ", core->name, i); | ||
480 | n = cx88_risc_decode(risc->cpu[i]); | ||
481 | for (j = 1; j < n; j++) | ||
482 | printk("%s: %04d: 0x%08x [ arg #%d ]\n", | ||
483 | core->name, i+j, risc->cpu[i+j], j); | ||
484 | if (risc->cpu[i] == RISC_JUMP) | ||
485 | break; | ||
486 | } | ||
487 | } | ||
488 | #endif | ||
489 | 473 | ||
490 | void cx88_sram_channel_dump(struct cx88_core *core, | 474 | void cx88_sram_channel_dump(struct cx88_core *core, |
491 | struct sram_channel *ch) | 475 | struct sram_channel *ch) |
@@ -548,21 +532,6 @@ static char *cx88_pci_irqs[32] = { | |||
548 | "brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err", | 532 | "brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err", |
549 | "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1" | 533 | "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1" |
550 | }; | 534 | }; |
551 | char *cx88_vid_irqs[32] = { | ||
552 | "y_risci1", "u_risci1", "v_risci1", "vbi_risc1", | ||
553 | "y_risci2", "u_risci2", "v_risci2", "vbi_risc2", | ||
554 | "y_oflow", "u_oflow", "v_oflow", "vbi_oflow", | ||
555 | "y_sync", "u_sync", "v_sync", "vbi_sync", | ||
556 | "opc_err", "par_err", "rip_err", "pci_abort", | ||
557 | }; | ||
558 | char *cx88_mpeg_irqs[32] = { | ||
559 | "ts_risci1", NULL, NULL, NULL, | ||
560 | "ts_risci2", NULL, NULL, NULL, | ||
561 | "ts_oflow", NULL, NULL, NULL, | ||
562 | "ts_sync", NULL, NULL, NULL, | ||
563 | "opc_err", "par_err", "rip_err", "pci_abort", | ||
564 | "ts_err?", | ||
565 | }; | ||
566 | 535 | ||
567 | void cx88_print_irqbits(char *name, char *tag, char **strings, | 536 | void cx88_print_irqbits(char *name, char *tag, char **strings, |
568 | u32 bits, u32 mask) | 537 | u32 bits, u32 mask) |
@@ -612,16 +581,11 @@ void cx88_wakeup(struct cx88_core *core, | |||
612 | break; | 581 | break; |
613 | buf = list_entry(q->active.next, | 582 | buf = list_entry(q->active.next, |
614 | struct cx88_buffer, vb.queue); | 583 | struct cx88_buffer, vb.queue); |
615 | #if 0 | ||
616 | if (buf->count > count) | ||
617 | break; | ||
618 | #else | ||
619 | /* count comes from the hw and is is 16bit wide -- | 584 | /* count comes from the hw and is is 16bit wide -- |
620 | * this trick handles wrap-arounds correctly for | 585 | * this trick handles wrap-arounds correctly for |
621 | * up to 32767 buffers in flight... */ | 586 | * up to 32767 buffers in flight... */ |
622 | if ((s16) (count - buf->count) < 0) | 587 | if ((s16) (count - buf->count) < 0) |
623 | break; | 588 | break; |
624 | #endif | ||
625 | do_gettimeofday(&buf->vb.ts); | 589 | do_gettimeofday(&buf->vb.ts); |
626 | dprintk(2,"[%p/%d] wakeup reg=%d buf=%d\n",buf,buf->vb.i, | 590 | dprintk(2,"[%p/%d] wakeup reg=%d buf=%d\n",buf,buf->vb.i, |
627 | count, buf->count); | 591 | count, buf->count); |
@@ -736,6 +700,10 @@ static unsigned int inline norm_fsc8(struct cx88_tvnorm *norm) | |||
736 | { | 700 | { |
737 | static const unsigned int ntsc = 28636360; | 701 | static const unsigned int ntsc = 28636360; |
738 | static const unsigned int pal = 35468950; | 702 | static const unsigned int pal = 35468950; |
703 | static const unsigned int palm = 28604892; | ||
704 | |||
705 | if (norm->id & V4L2_STD_PAL_M) | ||
706 | return palm; | ||
739 | 707 | ||
740 | return (norm->id & V4L2_STD_625_50) ? pal : ntsc; | 708 | return (norm->id & V4L2_STD_625_50) ? pal : ntsc; |
741 | } | 709 | } |
@@ -749,6 +717,11 @@ static unsigned int inline norm_notchfilter(struct cx88_tvnorm *norm) | |||
749 | 717 | ||
750 | static unsigned int inline norm_htotal(struct cx88_tvnorm *norm) | 718 | static unsigned int inline norm_htotal(struct cx88_tvnorm *norm) |
751 | { | 719 | { |
720 | /* Should always be Line Draw Time / (4*FSC) */ | ||
721 | |||
722 | if (norm->id & V4L2_STD_PAL_M) | ||
723 | return 909; | ||
724 | |||
752 | return (norm->id & V4L2_STD_625_50) ? 1135 : 910; | 725 | return (norm->id & V4L2_STD_625_50) ? 1135 : 910; |
753 | } | 726 | } |
754 | 727 | ||
@@ -940,12 +913,10 @@ int cx88_set_tvnorm(struct cx88_core *core, struct cx88_tvnorm *norm) | |||
940 | norm->cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f); | 913 | norm->cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f); |
941 | cx_andor(MO_INPUT_FORMAT, 0xf, norm->cxiformat); | 914 | cx_andor(MO_INPUT_FORMAT, 0xf, norm->cxiformat); |
942 | 915 | ||
943 | #if 1 | ||
944 | // FIXME: as-is from DScaler | 916 | // FIXME: as-is from DScaler |
945 | dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n", | 917 | dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n", |
946 | norm->cxoformat, cx_read(MO_OUTPUT_FORMAT)); | 918 | norm->cxoformat, cx_read(MO_OUTPUT_FORMAT)); |
947 | cx_write(MO_OUTPUT_FORMAT, norm->cxoformat); | 919 | cx_write(MO_OUTPUT_FORMAT, norm->cxoformat); |
948 | #endif | ||
949 | 920 | ||
950 | // MO_SCONV_REG = adc clock / video dec clock * 2^17 | 921 | // MO_SCONV_REG = adc clock / video dec clock * 2^17 |
951 | tmp64 = adc_clock * (u64)(1 << 17); | 922 | tmp64 = adc_clock * (u64)(1 << 17); |
@@ -994,21 +965,7 @@ int cx88_set_tvnorm(struct cx88_core *core, struct cx88_tvnorm *norm) | |||
994 | set_tvaudio(core); | 965 | set_tvaudio(core); |
995 | 966 | ||
996 | // tell i2c chips | 967 | // tell i2c chips |
997 | #ifdef V4L2_I2C_CLIENTS | ||
998 | cx88_call_i2c_clients(core,VIDIOC_S_STD,&norm->id); | 968 | cx88_call_i2c_clients(core,VIDIOC_S_STD,&norm->id); |
999 | #else | ||
1000 | { | ||
1001 | struct video_channel c; | ||
1002 | memset(&c,0,sizeof(c)); | ||
1003 | c.channel = core->input; | ||
1004 | c.norm = VIDEO_MODE_PAL; | ||
1005 | if ((norm->id & (V4L2_STD_NTSC_M|V4L2_STD_NTSC_M_JP))) | ||
1006 | c.norm = VIDEO_MODE_NTSC; | ||
1007 | if (norm->id & V4L2_STD_SECAM) | ||
1008 | c.norm = VIDEO_MODE_SECAM; | ||
1009 | cx88_call_i2c_clients(core,VIDIOCSCHAN,&c); | ||
1010 | } | ||
1011 | #endif | ||
1012 | 969 | ||
1013 | // done | 970 | // done |
1014 | return 0; | 971 | return 0; |
@@ -1164,8 +1121,20 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) | |||
1164 | "insmod option" : "autodetected"); | 1121 | "insmod option" : "autodetected"); |
1165 | 1122 | ||
1166 | core->tuner_type = tuner[core->nr]; | 1123 | core->tuner_type = tuner[core->nr]; |
1124 | core->radio_type = radio[core->nr]; | ||
1167 | if (UNSET == core->tuner_type) | 1125 | if (UNSET == core->tuner_type) |
1168 | core->tuner_type = cx88_boards[core->board].tuner_type; | 1126 | core->tuner_type = cx88_boards[core->board].tuner_type; |
1127 | if (UNSET == core->radio_type) | ||
1128 | core->radio_type = cx88_boards[core->board].radio_type; | ||
1129 | if (!core->tuner_addr) | ||
1130 | core->tuner_addr = cx88_boards[core->board].tuner_addr; | ||
1131 | if (!core->radio_addr) | ||
1132 | core->radio_addr = cx88_boards[core->board].radio_addr; | ||
1133 | |||
1134 | printk(KERN_INFO "TV tuner %d at 0x%02x, Radio tuner %d at 0x%02x\n", | ||
1135 | core->tuner_type, core->tuner_addr<<1, | ||
1136 | core->radio_type, core->radio_addr<<1); | ||
1137 | |||
1169 | core->tda9887_conf = cx88_boards[core->board].tda9887_conf; | 1138 | core->tda9887_conf = cx88_boards[core->board].tda9887_conf; |
1170 | 1139 | ||
1171 | /* init hardware */ | 1140 | /* init hardware */ |
@@ -1206,8 +1175,6 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci) | |||
1206 | /* ------------------------------------------------------------------ */ | 1175 | /* ------------------------------------------------------------------ */ |
1207 | 1176 | ||
1208 | EXPORT_SYMBOL(cx88_print_ioctl); | 1177 | EXPORT_SYMBOL(cx88_print_ioctl); |
1209 | EXPORT_SYMBOL(cx88_vid_irqs); | ||
1210 | EXPORT_SYMBOL(cx88_mpeg_irqs); | ||
1211 | EXPORT_SYMBOL(cx88_print_irqbits); | 1178 | EXPORT_SYMBOL(cx88_print_irqbits); |
1212 | 1179 | ||
1213 | EXPORT_SYMBOL(cx88_core_irq); | 1180 | EXPORT_SYMBOL(cx88_core_irq); |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 9d15d3d5a2b7..78d223257a68 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-dvb.c,v 1.31 2005/03/07 15:58:05 kraxel Exp $ | 2 | * $Id: cx88-dvb.c,v 1.58 2005/08/07 09:24:08 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * MPEG Transport Stream (DVB) routines | 5 | * MPEG Transport Stream (DVB) routines |
@@ -29,21 +29,24 @@ | |||
29 | #include <linux/kthread.h> | 29 | #include <linux/kthread.h> |
30 | #include <linux/file.h> | 30 | #include <linux/file.h> |
31 | #include <linux/suspend.h> | 31 | #include <linux/suspend.h> |
32 | 32 | #include <linux/config.h> | |
33 | /* those two frontends need merging via linuxtv cvs ... */ | ||
34 | #define HAVE_CX22702 1 | ||
35 | #define HAVE_OR51132 1 | ||
36 | 33 | ||
37 | #include "cx88.h" | 34 | #include "cx88.h" |
38 | #include "dvb-pll.h" | 35 | #include "dvb-pll.h" |
39 | #include "mt352.h" | 36 | |
40 | #include "mt352_priv.h" | 37 | #ifdef HAVE_MT352 |
41 | #if HAVE_CX22702 | 38 | # include "mt352.h" |
39 | # include "mt352_priv.h" | ||
40 | #endif | ||
41 | #ifdef HAVE_CX22702 | ||
42 | # include "cx22702.h" | 42 | # include "cx22702.h" |
43 | #endif | 43 | #endif |
44 | #if HAVE_OR51132 | 44 | #ifdef HAVE_OR51132 |
45 | # include "or51132.h" | 45 | # include "or51132.h" |
46 | #endif | 46 | #endif |
47 | #ifdef HAVE_LGDT330X | ||
48 | # include "lgdt330x.h" | ||
49 | #endif | ||
47 | 50 | ||
48 | MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); | 51 | MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); |
49 | MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); | 52 | MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); |
@@ -100,6 +103,7 @@ static struct videobuf_queue_ops dvb_qops = { | |||
100 | 103 | ||
101 | /* ------------------------------------------------------------------ */ | 104 | /* ------------------------------------------------------------------ */ |
102 | 105 | ||
106 | #ifdef HAVE_MT352 | ||
103 | static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) | 107 | static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) |
104 | { | 108 | { |
105 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; | 109 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; |
@@ -167,22 +171,25 @@ static struct mt352_config dntv_live_dvbt_config = { | |||
167 | .demod_init = dntv_live_dvbt_demod_init, | 171 | .demod_init = dntv_live_dvbt_demod_init, |
168 | .pll_set = mt352_pll_set, | 172 | .pll_set = mt352_pll_set, |
169 | }; | 173 | }; |
174 | #endif | ||
170 | 175 | ||
171 | #if HAVE_CX22702 | 176 | #ifdef HAVE_CX22702 |
172 | static struct cx22702_config connexant_refboard_config = { | 177 | static struct cx22702_config connexant_refboard_config = { |
173 | .demod_address = 0x43, | 178 | .demod_address = 0x43, |
179 | .output_mode = CX22702_SERIAL_OUTPUT, | ||
174 | .pll_address = 0x60, | 180 | .pll_address = 0x60, |
175 | .pll_desc = &dvb_pll_thomson_dtt7579, | 181 | .pll_desc = &dvb_pll_thomson_dtt7579, |
176 | }; | 182 | }; |
177 | 183 | ||
178 | static struct cx22702_config hauppauge_novat_config = { | 184 | static struct cx22702_config hauppauge_novat_config = { |
179 | .demod_address = 0x43, | 185 | .demod_address = 0x43, |
186 | .output_mode = CX22702_SERIAL_OUTPUT, | ||
180 | .pll_address = 0x61, | 187 | .pll_address = 0x61, |
181 | .pll_desc = &dvb_pll_thomson_dtt759x, | 188 | .pll_desc = &dvb_pll_thomson_dtt759x, |
182 | }; | 189 | }; |
183 | #endif | 190 | #endif |
184 | 191 | ||
185 | #if HAVE_OR51132 | 192 | #ifdef HAVE_OR51132 |
186 | static int or51132_set_ts_param(struct dvb_frontend* fe, | 193 | static int or51132_set_ts_param(struct dvb_frontend* fe, |
187 | int is_punctured) | 194 | int is_punctured) |
188 | { | 195 | { |
@@ -199,6 +206,63 @@ static struct or51132_config pchdtv_hd3000 = { | |||
199 | }; | 206 | }; |
200 | #endif | 207 | #endif |
201 | 208 | ||
209 | #ifdef HAVE_LGDT330X | ||
210 | static int lgdt330x_pll_set(struct dvb_frontend* fe, | ||
211 | struct dvb_frontend_parameters* params) | ||
212 | { | ||
213 | struct cx8802_dev *dev= fe->dvb->priv; | ||
214 | u8 buf[4]; | ||
215 | struct i2c_msg msg = | ||
216 | { .addr = dev->core->pll_addr, .flags = 0, .buf = buf, .len = 4 }; | ||
217 | int err; | ||
218 | |||
219 | dvb_pll_configure(dev->core->pll_desc, buf, params->frequency, 0); | ||
220 | dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n", | ||
221 | __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]); | ||
222 | if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { | ||
223 | printk(KERN_WARNING "cx88-dvb: %s error " | ||
224 | "(addr %02x <- %02x, err = %i)\n", | ||
225 | __FUNCTION__, buf[0], buf[1], err); | ||
226 | if (err < 0) | ||
227 | return err; | ||
228 | else | ||
229 | return -EREMOTEIO; | ||
230 | } | ||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | static int lgdt330x_pll_rf_set(struct dvb_frontend* fe, int index) | ||
235 | { | ||
236 | struct cx8802_dev *dev= fe->dvb->priv; | ||
237 | struct cx88_core *core = dev->core; | ||
238 | |||
239 | dprintk(1, "%s: index = %d\n", __FUNCTION__, index); | ||
240 | if (index == 0) | ||
241 | cx_clear(MO_GP0_IO, 8); | ||
242 | else | ||
243 | cx_set(MO_GP0_IO, 8); | ||
244 | return 0; | ||
245 | } | ||
246 | |||
247 | static int lgdt330x_set_ts_param(struct dvb_frontend* fe, int is_punctured) | ||
248 | { | ||
249 | struct cx8802_dev *dev= fe->dvb->priv; | ||
250 | if (is_punctured) | ||
251 | dev->ts_gen_cntrl |= 0x04; | ||
252 | else | ||
253 | dev->ts_gen_cntrl &= ~0x04; | ||
254 | return 0; | ||
255 | } | ||
256 | |||
257 | static struct lgdt330x_config fusionhdtv_3_gold = { | ||
258 | .demod_address = 0x0e, | ||
259 | .demod_chip = LGDT3302, | ||
260 | .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */ | ||
261 | .pll_set = lgdt330x_pll_set, | ||
262 | .set_ts_params = lgdt330x_set_ts_param, | ||
263 | }; | ||
264 | #endif | ||
265 | |||
202 | static int dvb_register(struct cx8802_dev *dev) | 266 | static int dvb_register(struct cx8802_dev *dev) |
203 | { | 267 | { |
204 | /* init struct videobuf_dvb */ | 268 | /* init struct videobuf_dvb */ |
@@ -207,16 +271,18 @@ static int dvb_register(struct cx8802_dev *dev) | |||
207 | 271 | ||
208 | /* init frontend */ | 272 | /* init frontend */ |
209 | switch (dev->core->board) { | 273 | switch (dev->core->board) { |
210 | #if HAVE_CX22702 | 274 | #ifdef HAVE_CX22702 |
211 | case CX88_BOARD_HAUPPAUGE_DVB_T1: | 275 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
212 | dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config, | 276 | dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config, |
213 | &dev->core->i2c_adap); | 277 | &dev->core->i2c_adap); |
214 | break; | 278 | break; |
279 | case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: | ||
215 | case CX88_BOARD_CONEXANT_DVB_T1: | 280 | case CX88_BOARD_CONEXANT_DVB_T1: |
216 | dev->dvb.frontend = cx22702_attach(&connexant_refboard_config, | 281 | dev->dvb.frontend = cx22702_attach(&connexant_refboard_config, |
217 | &dev->core->i2c_adap); | 282 | &dev->core->i2c_adap); |
218 | break; | 283 | break; |
219 | #endif | 284 | #endif |
285 | #ifdef HAVE_MT352 | ||
220 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: | 286 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: |
221 | dev->core->pll_addr = 0x61; | 287 | dev->core->pll_addr = 0x61; |
222 | dev->core->pll_desc = &dvb_pll_lg_z201; | 288 | dev->core->pll_desc = &dvb_pll_lg_z201; |
@@ -231,17 +297,56 @@ static int dvb_register(struct cx8802_dev *dev) | |||
231 | break; | 297 | break; |
232 | case CX88_BOARD_KWORLD_DVB_T: | 298 | case CX88_BOARD_KWORLD_DVB_T: |
233 | case CX88_BOARD_DNTV_LIVE_DVB_T: | 299 | case CX88_BOARD_DNTV_LIVE_DVB_T: |
300 | case CX88_BOARD_ADSTECH_DVB_T_PCI: | ||
234 | dev->core->pll_addr = 0x61; | 301 | dev->core->pll_addr = 0x61; |
235 | dev->core->pll_desc = &dvb_pll_unknown_1; | 302 | dev->core->pll_desc = &dvb_pll_unknown_1; |
236 | dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config, | 303 | dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config, |
237 | &dev->core->i2c_adap); | 304 | &dev->core->i2c_adap); |
238 | break; | 305 | break; |
239 | #if HAVE_OR51132 | 306 | #endif |
307 | #ifdef HAVE_OR51132 | ||
240 | case CX88_BOARD_PCHDTV_HD3000: | 308 | case CX88_BOARD_PCHDTV_HD3000: |
241 | dev->dvb.frontend = or51132_attach(&pchdtv_hd3000, | 309 | dev->dvb.frontend = or51132_attach(&pchdtv_hd3000, |
242 | &dev->core->i2c_adap); | 310 | &dev->core->i2c_adap); |
243 | break; | 311 | break; |
244 | #endif | 312 | #endif |
313 | #ifdef HAVE_LGDT330X | ||
314 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: | ||
315 | dev->ts_gen_cntrl = 0x08; | ||
316 | { | ||
317 | /* Do a hardware reset of chip before using it. */ | ||
318 | struct cx88_core *core = dev->core; | ||
319 | |||
320 | cx_clear(MO_GP0_IO, 1); | ||
321 | mdelay(100); | ||
322 | cx_set(MO_GP0_IO, 1); | ||
323 | mdelay(200); | ||
324 | |||
325 | /* Select RF connector callback */ | ||
326 | fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set; | ||
327 | dev->core->pll_addr = 0x61; | ||
328 | dev->core->pll_desc = &dvb_pll_microtune_4042; | ||
329 | dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold, | ||
330 | &dev->core->i2c_adap); | ||
331 | } | ||
332 | break; | ||
333 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T: | ||
334 | dev->ts_gen_cntrl = 0x08; | ||
335 | { | ||
336 | /* Do a hardware reset of chip before using it. */ | ||
337 | struct cx88_core *core = dev->core; | ||
338 | |||
339 | cx_clear(MO_GP0_IO, 1); | ||
340 | mdelay(100); | ||
341 | cx_set(MO_GP0_IO, 9); | ||
342 | mdelay(200); | ||
343 | dev->core->pll_addr = 0x61; | ||
344 | dev->core->pll_desc = &dvb_pll_thomson_dtt7611; | ||
345 | dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold, | ||
346 | &dev->core->i2c_adap); | ||
347 | } | ||
348 | break; | ||
349 | #endif | ||
245 | default: | 350 | default: |
246 | printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n", | 351 | printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n", |
247 | dev->core->name); | 352 | dev->core->name); |
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 0725b1288f4f..a628a55299c6 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: cx88-i2c.c,v 1.20 2005/02/15 15:59:35 kraxel Exp $ | 2 | $Id: cx88-i2c.c,v 1.30 2005/07/25 05:10:13 mkrufky Exp $ |
3 | 3 | ||
4 | cx88-i2c.c -- all the i2c code is here | 4 | cx88-i2c.c -- all the i2c code is here |
5 | 5 | ||
@@ -91,15 +91,34 @@ static int cx8800_bit_getsda(void *data) | |||
91 | 91 | ||
92 | static int attach_inform(struct i2c_client *client) | 92 | static int attach_inform(struct i2c_client *client) |
93 | { | 93 | { |
94 | struct tuner_setup tun_setup; | ||
94 | struct cx88_core *core = i2c_get_adapdata(client->adapter); | 95 | struct cx88_core *core = i2c_get_adapdata(client->adapter); |
95 | 96 | ||
96 | dprintk(1, "i2c attach [addr=0x%x,client=%s]\n", | 97 | dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", |
97 | client->addr, i2c_clientname(client)); | 98 | client->driver->name,client->addr,i2c_clientname(client)); |
98 | if (!client->driver->command) | 99 | if (!client->driver->command) |
99 | return 0; | 100 | return 0; |
100 | 101 | ||
101 | if (core->tuner_type != UNSET) | 102 | if (core->radio_type != UNSET) { |
102 | client->driver->command(client, TUNER_SET_TYPE, &core->tuner_type); | 103 | if ((core->radio_addr==ADDR_UNSET)||(core->radio_addr==client->addr)) { |
104 | tun_setup.mode_mask = T_RADIO; | ||
105 | tun_setup.type = core->radio_type; | ||
106 | tun_setup.addr = core->radio_addr; | ||
107 | |||
108 | client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
109 | } | ||
110 | } | ||
111 | if (core->tuner_type != UNSET) { | ||
112 | if ((core->tuner_addr==ADDR_UNSET)||(core->tuner_addr==client->addr)) { | ||
113 | |||
114 | tun_setup.mode_mask = T_ANALOG_TV; | ||
115 | tun_setup.type = core->tuner_type; | ||
116 | tun_setup.addr = core->tuner_addr; | ||
117 | |||
118 | client->driver->command (client,TUNER_SET_TYPE_ADDR, &tun_setup); | ||
119 | } | ||
120 | } | ||
121 | |||
103 | if (core->tda9887_conf) | 122 | if (core->tda9887_conf) |
104 | client->driver->command(client, TDA9887_SET_CONFIG, &core->tda9887_conf); | 123 | client->driver->command(client, TDA9887_SET_CONFIG, &core->tda9887_conf); |
105 | return 0; | 124 | return 0; |
@@ -145,6 +164,7 @@ static struct i2c_client cx8800_i2c_client_template = { | |||
145 | }; | 164 | }; |
146 | 165 | ||
147 | static char *i2c_devs[128] = { | 166 | static char *i2c_devs[128] = { |
167 | [ 0x1c >> 1 ] = "lgdt330x", | ||
148 | [ 0x86 >> 1 ] = "tda9887/cx22702", | 168 | [ 0x86 >> 1 ] = "tda9887/cx22702", |
149 | [ 0xa0 >> 1 ] = "eeprom", | 169 | [ 0xa0 >> 1 ] = "eeprom", |
150 | [ 0xc0 >> 1 ] = "tuner (analog)", | 170 | [ 0xc0 >> 1 ] = "tuner (analog)", |
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index af6ad8cdbdb7..214887798192 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-input.c,v 1.9 2005/03/04 09:12:23 kraxel Exp $ | 2 | * $Id: cx88-input.c,v 1.15 2005/07/07 13:58:38 mchehab Exp $ |
3 | * | 3 | * |
4 | * Device driver for GPIO attached remote control interfaces | 4 | * Device driver for GPIO attached remote control interfaces |
5 | * on Conexant 2388x based TV/DVB cards. | 5 | * on Conexant 2388x based TV/DVB cards. |
@@ -38,119 +38,206 @@ | |||
38 | 38 | ||
39 | /* DigitalNow DNTV Live DVB-T Remote */ | 39 | /* DigitalNow DNTV Live DVB-T Remote */ |
40 | static IR_KEYTAB_TYPE ir_codes_dntv_live_dvb_t[IR_KEYTAB_SIZE] = { | 40 | static IR_KEYTAB_TYPE ir_codes_dntv_live_dvb_t[IR_KEYTAB_SIZE] = { |
41 | [ 0x00 ] = KEY_ESC, // 'go up a level?' | 41 | [0x00] = KEY_ESC, /* 'go up a level?' */ |
42 | [ 0x01 ] = KEY_KP1, // '1' | 42 | /* Keys 0 to 9 */ |
43 | [ 0x02 ] = KEY_KP2, // '2' | 43 | [0x0a] = KEY_KP0, |
44 | [ 0x03 ] = KEY_KP3, // '3' | 44 | [0x01] = KEY_KP1, |
45 | [ 0x04 ] = KEY_KP4, // '4' | 45 | [0x02] = KEY_KP2, |
46 | [ 0x05 ] = KEY_KP5, // '5' | 46 | [0x03] = KEY_KP3, |
47 | [ 0x06 ] = KEY_KP6, // '6' | 47 | [0x04] = KEY_KP4, |
48 | [ 0x07 ] = KEY_KP7, // '7' | 48 | [0x05] = KEY_KP5, |
49 | [ 0x08 ] = KEY_KP8, // '8' | 49 | [0x06] = KEY_KP6, |
50 | [ 0x09 ] = KEY_KP9, // '9' | 50 | [0x07] = KEY_KP7, |
51 | [ 0x0a ] = KEY_KP0, // '0' | 51 | [0x08] = KEY_KP8, |
52 | [ 0x0b ] = KEY_TUNER, // 'tv/fm' | 52 | [0x09] = KEY_KP9, |
53 | [ 0x0c ] = KEY_SEARCH, // 'scan' | 53 | |
54 | [ 0x0d ] = KEY_STOP, // 'stop' | 54 | [0x0b] = KEY_TUNER, /* tv/fm */ |
55 | [ 0x0e ] = KEY_PAUSE, // 'pause' | 55 | [0x0c] = KEY_SEARCH, /* scan */ |
56 | [ 0x0f ] = KEY_LIST, // 'source' | 56 | [0x0d] = KEY_STOP, |
57 | 57 | [0x0e] = KEY_PAUSE, | |
58 | [ 0x10 ] = KEY_MUTE, // 'mute' | 58 | [0x0f] = KEY_LIST, /* source */ |
59 | [ 0x11 ] = KEY_REWIND, // 'backward <<' | 59 | |
60 | [ 0x12 ] = KEY_POWER, // 'power' | 60 | [0x10] = KEY_MUTE, |
61 | [ 0x13 ] = KEY_S, // 'snap' | 61 | [0x11] = KEY_REWIND, /* backward << */ |
62 | [ 0x14 ] = KEY_AUDIO, // 'stereo' | 62 | [0x12] = KEY_POWER, |
63 | [ 0x15 ] = KEY_CLEAR, // 'reset' | 63 | [0x13] = KEY_S, /* snap */ |
64 | [ 0x16 ] = KEY_PLAY, // 'play' | 64 | [0x14] = KEY_AUDIO, /* stereo */ |
65 | [ 0x17 ] = KEY_ENTER, // 'enter' | 65 | [0x15] = KEY_CLEAR, /* reset */ |
66 | [ 0x18 ] = KEY_ZOOM, // 'full screen' | 66 | [0x16] = KEY_PLAY, |
67 | [ 0x19 ] = KEY_FASTFORWARD, // 'forward >>' | 67 | [0x17] = KEY_ENTER, |
68 | [ 0x1a ] = KEY_CHANNELUP, // 'channel +' | 68 | [0x18] = KEY_ZOOM, /* full screen */ |
69 | [ 0x1b ] = KEY_VOLUMEUP, // 'volume +' | 69 | [0x19] = KEY_FASTFORWARD, /* forward >> */ |
70 | [ 0x1c ] = KEY_INFO, // 'preview' | 70 | [0x1a] = KEY_CHANNELUP, |
71 | [ 0x1d ] = KEY_RECORD, // 'record' | 71 | [0x1b] = KEY_VOLUMEUP, |
72 | [ 0x1e ] = KEY_CHANNELDOWN, // 'channel -' | 72 | [0x1c] = KEY_INFO, /* preview */ |
73 | [ 0x1f ] = KEY_VOLUMEDOWN, // 'volume -' | 73 | [0x1d] = KEY_RECORD, /* record */ |
74 | [0x1e] = KEY_CHANNELDOWN, | ||
75 | [0x1f] = KEY_VOLUMEDOWN, | ||
74 | }; | 76 | }; |
75 | 77 | ||
76 | /* ---------------------------------------------------------------------- */ | 78 | /* ---------------------------------------------------------------------- */ |
77 | 79 | ||
78 | /* IO-DATA BCTV7E Remote */ | 80 | /* IO-DATA BCTV7E Remote */ |
79 | static IR_KEYTAB_TYPE ir_codes_iodata_bctv7e[IR_KEYTAB_SIZE] = { | 81 | static IR_KEYTAB_TYPE ir_codes_iodata_bctv7e[IR_KEYTAB_SIZE] = { |
80 | [ 0x40 ] = KEY_TV, // TV | 82 | [0x40] = KEY_TV, |
81 | [ 0x20 ] = KEY_RADIO, // FM | 83 | [0x20] = KEY_RADIO, /* FM */ |
82 | [ 0x60 ] = KEY_EPG, // EPG | 84 | [0x60] = KEY_EPG, |
83 | [ 0x00 ] = KEY_POWER, // power | 85 | [0x00] = KEY_POWER, |
84 | 86 | ||
85 | [ 0x50 ] = KEY_KP1, // 1 | 87 | /* Keys 0 to 9 */ |
86 | [ 0x30 ] = KEY_KP2, // 2 | 88 | [0x44] = KEY_KP0, /* 10 */ |
87 | [ 0x70 ] = KEY_KP3, // 3 | 89 | [0x50] = KEY_KP1, |
88 | [ 0x10 ] = KEY_L, // Live | 90 | [0x30] = KEY_KP2, |
89 | 91 | [0x70] = KEY_KP3, | |
90 | [ 0x48 ] = KEY_KP4, // 4 | 92 | [0x48] = KEY_KP4, |
91 | [ 0x28 ] = KEY_KP5, // 5 | 93 | [0x28] = KEY_KP5, |
92 | [ 0x68 ] = KEY_KP6, // 6 | 94 | [0x68] = KEY_KP6, |
93 | [ 0x08 ] = KEY_T, // Time Shift | 95 | [0x58] = KEY_KP7, |
94 | 96 | [0x38] = KEY_KP8, | |
95 | [ 0x58 ] = KEY_KP7, // 7 | 97 | [0x78] = KEY_KP9, |
96 | [ 0x38 ] = KEY_KP8, // 8 | 98 | |
97 | [ 0x78 ] = KEY_KP9, // 9 | 99 | [0x10] = KEY_L, /* Live */ |
98 | [ 0x18 ] = KEY_PLAYPAUSE, // Play | 100 | [0x08] = KEY_T, /* Time Shift */ |
99 | 101 | ||
100 | [ 0x44 ] = KEY_KP0, // 10 | 102 | [0x18] = KEY_PLAYPAUSE, /* Play */ |
101 | [ 0x24 ] = KEY_ENTER, // 11 | 103 | |
102 | [ 0x64 ] = KEY_ESC, // 12 | 104 | [0x24] = KEY_ENTER, /* 11 */ |
103 | [ 0x04 ] = KEY_M, // Multi | 105 | [0x64] = KEY_ESC, /* 12 */ |
104 | 106 | [0x04] = KEY_M, /* Multi */ | |
105 | [ 0x54 ] = KEY_VIDEO, // VIDEO | 107 | |
106 | [ 0x34 ] = KEY_CHANNELUP, // channel + | 108 | [0x54] = KEY_VIDEO, |
107 | [ 0x74 ] = KEY_VOLUMEUP, // volume + | 109 | [0x34] = KEY_CHANNELUP, |
108 | [ 0x14 ] = KEY_MUTE, // Mute | 110 | [0x74] = KEY_VOLUMEUP, |
109 | 111 | [0x14] = KEY_MUTE, | |
110 | [ 0x4c ] = KEY_S, // SVIDEO | 112 | |
111 | [ 0x2c ] = KEY_CHANNELDOWN, // channel - | 113 | [0x4c] = KEY_S, /* SVIDEO */ |
112 | [ 0x6c ] = KEY_VOLUMEDOWN, // volume - | 114 | [0x2c] = KEY_CHANNELDOWN, |
113 | [ 0x0c ] = KEY_ZOOM, // Zoom | 115 | [0x6c] = KEY_VOLUMEDOWN, |
114 | 116 | [0x0c] = KEY_ZOOM, | |
115 | [ 0x5c ] = KEY_PAUSE, // pause | 117 | |
116 | [ 0x3c ] = KEY_C, // || (red) | 118 | [0x5c] = KEY_PAUSE, |
117 | [ 0x7c ] = KEY_RECORD, // recording | 119 | [0x3c] = KEY_C, /* || (red) */ |
118 | [ 0x1c ] = KEY_STOP, // stop | 120 | [0x7c] = KEY_RECORD, /* recording */ |
119 | 121 | [0x1c] = KEY_STOP, | |
120 | [ 0x41 ] = KEY_REWIND, // backward << | 122 | |
121 | [ 0x21 ] = KEY_PLAY, // play | 123 | [0x41] = KEY_REWIND, /* backward << */ |
122 | [ 0x61 ] = KEY_FASTFORWARD, // forward >> | 124 | [0x21] = KEY_PLAY, |
123 | [ 0x01 ] = KEY_NEXT, // skip >| | 125 | [0x61] = KEY_FASTFORWARD, /* forward >> */ |
126 | [0x01] = KEY_NEXT, /* skip >| */ | ||
127 | }; | ||
128 | |||
129 | /* ---------------------------------------------------------------------- */ | ||
130 | |||
131 | /* ADS Tech Instant TV DVB-T PCI Remote */ | ||
132 | static IR_KEYTAB_TYPE ir_codes_adstech_dvb_t_pci[IR_KEYTAB_SIZE] = { | ||
133 | /* Keys 0 to 9 */ | ||
134 | [0x4d] = KEY_0, | ||
135 | [0x57] = KEY_1, | ||
136 | [0x4f] = KEY_2, | ||
137 | [0x53] = KEY_3, | ||
138 | [0x56] = KEY_4, | ||
139 | [0x4e] = KEY_5, | ||
140 | [0x5e] = KEY_6, | ||
141 | [0x54] = KEY_7, | ||
142 | [0x4c] = KEY_8, | ||
143 | [0x5c] = KEY_9, | ||
144 | |||
145 | [0x5b] = KEY_POWER, | ||
146 | [0x5f] = KEY_MUTE, | ||
147 | [0x55] = KEY_GOTO, | ||
148 | [0x5d] = KEY_SEARCH, | ||
149 | [0x17] = KEY_EPG, /* Guide */ | ||
150 | [0x1f] = KEY_MENU, | ||
151 | [0x0f] = KEY_UP, | ||
152 | [0x46] = KEY_DOWN, | ||
153 | [0x16] = KEY_LEFT, | ||
154 | [0x1e] = KEY_RIGHT, | ||
155 | [0x0e] = KEY_SELECT, /* Enter */ | ||
156 | [0x5a] = KEY_INFO, | ||
157 | [0x52] = KEY_EXIT, | ||
158 | [0x59] = KEY_PREVIOUS, | ||
159 | [0x51] = KEY_NEXT, | ||
160 | [0x58] = KEY_REWIND, | ||
161 | [0x50] = KEY_FORWARD, | ||
162 | [0x44] = KEY_PLAYPAUSE, | ||
163 | [0x07] = KEY_STOP, | ||
164 | [0x1b] = KEY_RECORD, | ||
165 | [0x13] = KEY_TUNER, /* Live */ | ||
166 | [0x0a] = KEY_A, | ||
167 | [0x12] = KEY_B, | ||
168 | [0x03] = KEY_PROG1, /* 1 */ | ||
169 | [0x01] = KEY_PROG2, /* 2 */ | ||
170 | [0x00] = KEY_PROG3, /* 3 */ | ||
171 | [0x06] = KEY_DVD, | ||
172 | [0x48] = KEY_AUX, /* Photo */ | ||
173 | [0x40] = KEY_VIDEO, | ||
174 | [0x19] = KEY_AUDIO, /* Music */ | ||
175 | [0x0b] = KEY_CHANNELUP, | ||
176 | [0x08] = KEY_CHANNELDOWN, | ||
177 | [0x15] = KEY_VOLUMEUP, | ||
178 | [0x1c] = KEY_VOLUMEDOWN, | ||
179 | }; | ||
180 | |||
181 | /* ---------------------------------------------------------------------- */ | ||
182 | |||
183 | /* MSI TV@nywhere remote */ | ||
184 | static IR_KEYTAB_TYPE ir_codes_msi_tvanywhere[IR_KEYTAB_SIZE] = { | ||
185 | /* Keys 0 to 9 */ | ||
186 | [0x00] = KEY_0, | ||
187 | [0x01] = KEY_1, | ||
188 | [0x02] = KEY_2, | ||
189 | [0x03] = KEY_3, | ||
190 | [0x04] = KEY_4, | ||
191 | [0x05] = KEY_5, | ||
192 | [0x06] = KEY_6, | ||
193 | [0x07] = KEY_7, | ||
194 | [0x08] = KEY_8, | ||
195 | [0x09] = KEY_9, | ||
196 | |||
197 | [0x0c] = KEY_MUTE, | ||
198 | [0x0f] = KEY_SCREEN, /* Full Screen */ | ||
199 | [0x10] = KEY_F, /* Funtion */ | ||
200 | [0x11] = KEY_T, /* Time shift */ | ||
201 | [0x12] = KEY_POWER, | ||
202 | [0x13] = KEY_MEDIA, /* MTS */ | ||
203 | [0x14] = KEY_SLOW, | ||
204 | [0x16] = KEY_REWIND, /* backward << */ | ||
205 | [0x17] = KEY_ENTER, /* Return */ | ||
206 | [0x18] = KEY_FASTFORWARD, /* forward >> */ | ||
207 | [0x1a] = KEY_CHANNELUP, | ||
208 | [0x1b] = KEY_VOLUMEUP, | ||
209 | [0x1e] = KEY_CHANNELDOWN, | ||
210 | [0x1f] = KEY_VOLUMEDOWN, | ||
124 | }; | 211 | }; |
125 | 212 | ||
126 | /* ---------------------------------------------------------------------- */ | 213 | /* ---------------------------------------------------------------------- */ |
127 | 214 | ||
128 | struct cx88_IR { | 215 | struct cx88_IR { |
129 | struct cx88_core *core; | 216 | struct cx88_core *core; |
130 | struct input_dev input; | 217 | struct input_dev input; |
131 | struct ir_input_state ir; | 218 | struct ir_input_state ir; |
132 | char name[32]; | 219 | char name[32]; |
133 | char phys[32]; | 220 | char phys[32]; |
134 | 221 | ||
135 | /* sample from gpio pin 16 */ | 222 | /* sample from gpio pin 16 */ |
136 | int sampling; | 223 | int sampling; |
137 | u32 samples[16]; | 224 | u32 samples[16]; |
138 | int scount; | 225 | int scount; |
139 | unsigned long release; | 226 | unsigned long release; |
140 | 227 | ||
141 | /* poll external decoder */ | 228 | /* poll external decoder */ |
142 | int polling; | 229 | int polling; |
143 | struct work_struct work; | 230 | struct work_struct work; |
144 | struct timer_list timer; | 231 | struct timer_list timer; |
145 | u32 gpio_addr; | 232 | u32 gpio_addr; |
146 | u32 last_gpio; | 233 | u32 last_gpio; |
147 | u32 mask_keycode; | 234 | u32 mask_keycode; |
148 | u32 mask_keydown; | 235 | u32 mask_keydown; |
149 | u32 mask_keyup; | 236 | u32 mask_keyup; |
150 | }; | 237 | }; |
151 | 238 | ||
152 | static int ir_debug = 0; | 239 | static int ir_debug = 0; |
153 | module_param(ir_debug, int, 0644); /* debug level [IR] */ | 240 | module_param(ir_debug, int, 0644); /* debug level [IR] */ |
154 | MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); | 241 | MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); |
155 | 242 | ||
156 | #define ir_dprintk(fmt, arg...) if (ir_debug) \ | 243 | #define ir_dprintk(fmt, arg...) if (ir_debug) \ |
@@ -174,37 +261,37 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) | |||
174 | /* extract data */ | 261 | /* extract data */ |
175 | data = ir_extract_bits(gpio, ir->mask_keycode); | 262 | data = ir_extract_bits(gpio, ir->mask_keycode); |
176 | ir_dprintk("irq gpio=0x%x code=%d | %s%s%s\n", | 263 | ir_dprintk("irq gpio=0x%x code=%d | %s%s%s\n", |
177 | gpio, data, | 264 | gpio, data, |
178 | ir->polling ? "poll" : "irq", | 265 | ir->polling ? "poll" : "irq", |
179 | (gpio & ir->mask_keydown) ? " down" : "", | 266 | (gpio & ir->mask_keydown) ? " down" : "", |
180 | (gpio & ir->mask_keyup) ? " up" : ""); | 267 | (gpio & ir->mask_keyup) ? " up" : ""); |
181 | 268 | ||
182 | if (ir->mask_keydown) { | 269 | if (ir->mask_keydown) { |
183 | /* bit set on keydown */ | 270 | /* bit set on keydown */ |
184 | if (gpio & ir->mask_keydown) { | 271 | if (gpio & ir->mask_keydown) { |
185 | ir_input_keydown(&ir->input,&ir->ir,data,data); | 272 | ir_input_keydown(&ir->input, &ir->ir, data, data); |
186 | } else { | 273 | } else { |
187 | ir_input_nokey(&ir->input,&ir->ir); | 274 | ir_input_nokey(&ir->input, &ir->ir); |
188 | } | 275 | } |
189 | 276 | ||
190 | } else if (ir->mask_keyup) { | 277 | } else if (ir->mask_keyup) { |
191 | /* bit cleared on keydown */ | 278 | /* bit cleared on keydown */ |
192 | if (0 == (gpio & ir->mask_keyup)) { | 279 | if (0 == (gpio & ir->mask_keyup)) { |
193 | ir_input_keydown(&ir->input,&ir->ir,data,data); | 280 | ir_input_keydown(&ir->input, &ir->ir, data, data); |
194 | } else { | 281 | } else { |
195 | ir_input_nokey(&ir->input,&ir->ir); | 282 | ir_input_nokey(&ir->input, &ir->ir); |
196 | } | 283 | } |
197 | 284 | ||
198 | } else { | 285 | } else { |
199 | /* can't distinguish keydown/up :-/ */ | 286 | /* can't distinguish keydown/up :-/ */ |
200 | ir_input_keydown(&ir->input,&ir->ir,data,data); | 287 | ir_input_keydown(&ir->input, &ir->ir, data, data); |
201 | ir_input_nokey(&ir->input,&ir->ir); | 288 | ir_input_nokey(&ir->input, &ir->ir); |
202 | } | 289 | } |
203 | } | 290 | } |
204 | 291 | ||
205 | static void ir_timer(unsigned long data) | 292 | static void ir_timer(unsigned long data) |
206 | { | 293 | { |
207 | struct cx88_IR *ir = (struct cx88_IR*)data; | 294 | struct cx88_IR *ir = (struct cx88_IR *)data; |
208 | 295 | ||
209 | schedule_work(&ir->work); | 296 | schedule_work(&ir->work); |
210 | } | 297 | } |
@@ -227,41 +314,64 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
227 | IR_KEYTAB_TYPE *ir_codes = NULL; | 314 | IR_KEYTAB_TYPE *ir_codes = NULL; |
228 | int ir_type = IR_TYPE_OTHER; | 315 | int ir_type = IR_TYPE_OTHER; |
229 | 316 | ||
230 | ir = kmalloc(sizeof(*ir),GFP_KERNEL); | 317 | ir = kmalloc(sizeof(*ir), GFP_KERNEL); |
231 | if (NULL == ir) | 318 | if (NULL == ir) |
232 | return -ENOMEM; | 319 | return -ENOMEM; |
233 | memset(ir,0,sizeof(*ir)); | 320 | memset(ir, 0, sizeof(*ir)); |
234 | 321 | ||
235 | /* detect & configure */ | 322 | /* detect & configure */ |
236 | switch (core->board) { | 323 | switch (core->board) { |
237 | case CX88_BOARD_DNTV_LIVE_DVB_T: | 324 | case CX88_BOARD_DNTV_LIVE_DVB_T: |
238 | ir_codes = ir_codes_dntv_live_dvb_t; | 325 | case CX88_BOARD_KWORLD_DVB_T: |
239 | ir->gpio_addr = MO_GP1_IO; | 326 | ir_codes = ir_codes_dntv_live_dvb_t; |
327 | ir->gpio_addr = MO_GP1_IO; | ||
240 | ir->mask_keycode = 0x1f; | 328 | ir->mask_keycode = 0x1f; |
241 | ir->mask_keyup = 0x60; | 329 | ir->mask_keyup = 0x60; |
242 | ir->polling = 50; // ms | 330 | ir->polling = 50; /* ms */ |
243 | break; | 331 | break; |
244 | case CX88_BOARD_HAUPPAUGE: | 332 | case CX88_BOARD_HAUPPAUGE: |
245 | case CX88_BOARD_HAUPPAUGE_DVB_T1: | 333 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
246 | ir_codes = ir_codes_hauppauge_new; | 334 | ir_codes = ir_codes_hauppauge_new; |
247 | ir_type = IR_TYPE_RC5; | 335 | ir_type = IR_TYPE_RC5; |
248 | ir->sampling = 1; | 336 | ir->sampling = 1; |
249 | break; | 337 | break; |
250 | case CX88_BOARD_WINFAST2000XP_EXPERT: | 338 | case CX88_BOARD_WINFAST2000XP_EXPERT: |
251 | ir_codes = ir_codes_winfast; | 339 | ir_codes = ir_codes_winfast; |
252 | ir->gpio_addr = MO_GP0_IO; | 340 | ir->gpio_addr = MO_GP0_IO; |
253 | ir->mask_keycode = 0x8f8; | 341 | ir->mask_keycode = 0x8f8; |
254 | ir->mask_keyup = 0x100; | 342 | ir->mask_keyup = 0x100; |
255 | ir->polling = 1; // ms | 343 | ir->polling = 1; /* ms */ |
256 | break; | 344 | break; |
257 | case CX88_BOARD_IODATA_GVBCTV7E: | 345 | case CX88_BOARD_IODATA_GVBCTV7E: |
258 | ir_codes = ir_codes_iodata_bctv7e; | 346 | ir_codes = ir_codes_iodata_bctv7e; |
259 | ir->gpio_addr = MO_GP0_IO; | 347 | ir->gpio_addr = MO_GP0_IO; |
260 | ir->mask_keycode = 0xfd; | 348 | ir->mask_keycode = 0xfd; |
261 | ir->mask_keydown = 0x02; | 349 | ir->mask_keydown = 0x02; |
262 | ir->polling = 5; // ms | 350 | ir->polling = 5; /* ms */ |
351 | break; | ||
352 | case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO: | ||
353 | ir_codes = ir_codes_pixelview; | ||
354 | ir->gpio_addr = MO_GP1_IO; | ||
355 | ir->mask_keycode = 0x1f; | ||
356 | ir->mask_keyup = 0x80; | ||
357 | ir->polling = 1; /* ms */ | ||
358 | break; | ||
359 | case CX88_BOARD_ADSTECH_DVB_T_PCI: | ||
360 | ir_codes = ir_codes_adstech_dvb_t_pci; | ||
361 | ir->gpio_addr = MO_GP1_IO; | ||
362 | ir->mask_keycode = 0xbf; | ||
363 | ir->mask_keyup = 0x40; | ||
364 | ir->polling = 50; /* ms */ | ||
365 | break; | ||
366 | case CX88_BOARD_MSI_TVANYWHERE_MASTER: | ||
367 | ir_codes = ir_codes_msi_tvanywhere; | ||
368 | ir->gpio_addr = MO_GP1_IO; | ||
369 | ir->mask_keycode = 0x1f; | ||
370 | ir->mask_keyup = 0x40; | ||
371 | ir->polling = 1; /* ms */ | ||
263 | break; | 372 | break; |
264 | } | 373 | } |
374 | |||
265 | if (NULL == ir_codes) { | 375 | if (NULL == ir_codes) { |
266 | kfree(ir); | 376 | kfree(ir); |
267 | return -ENODEV; | 377 | return -ENODEV; |
@@ -270,8 +380,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
270 | /* init input device */ | 380 | /* init input device */ |
271 | snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", | 381 | snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", |
272 | cx88_boards[core->board].name); | 382 | cx88_boards[core->board].name); |
273 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", | 383 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); |
274 | pci_name(pci)); | ||
275 | 384 | ||
276 | ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes); | 385 | ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes); |
277 | ir->input.name = ir->name; | 386 | ir->input.name = ir->name; |
@@ -279,10 +388,10 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
279 | ir->input.id.bustype = BUS_PCI; | 388 | ir->input.id.bustype = BUS_PCI; |
280 | ir->input.id.version = 1; | 389 | ir->input.id.version = 1; |
281 | if (pci->subsystem_vendor) { | 390 | if (pci->subsystem_vendor) { |
282 | ir->input.id.vendor = pci->subsystem_vendor; | 391 | ir->input.id.vendor = pci->subsystem_vendor; |
283 | ir->input.id.product = pci->subsystem_device; | 392 | ir->input.id.product = pci->subsystem_device; |
284 | } else { | 393 | } else { |
285 | ir->input.id.vendor = pci->vendor; | 394 | ir->input.id.vendor = pci->vendor; |
286 | ir->input.id.product = pci->device; | 395 | ir->input.id.product = pci->device; |
287 | } | 396 | } |
288 | 397 | ||
@@ -294,13 +403,13 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
294 | INIT_WORK(&ir->work, cx88_ir_work, ir); | 403 | INIT_WORK(&ir->work, cx88_ir_work, ir); |
295 | init_timer(&ir->timer); | 404 | init_timer(&ir->timer); |
296 | ir->timer.function = ir_timer; | 405 | ir->timer.function = ir_timer; |
297 | ir->timer.data = (unsigned long)ir; | 406 | ir->timer.data = (unsigned long)ir; |
298 | schedule_work(&ir->work); | 407 | schedule_work(&ir->work); |
299 | } | 408 | } |
300 | if (ir->sampling) { | 409 | if (ir->sampling) { |
301 | core->pci_irqmask |= (1<<18); // IR_SMP_INT | 410 | core->pci_irqmask |= (1 << 18); /* IR_SMP_INT */ |
302 | cx_write(MO_DDS_IO, 0xa80a80); // 4 kHz sample rate | 411 | cx_write(MO_DDS_IO, 0xa80a80); /* 4 kHz sample rate */ |
303 | cx_write(MO_DDSCFG_IO, 0x5); // enable | 412 | cx_write(MO_DDSCFG_IO, 0x5); /* enable */ |
304 | } | 413 | } |
305 | 414 | ||
306 | /* all done */ | 415 | /* all done */ |
@@ -336,7 +445,7 @@ int cx88_ir_fini(struct cx88_core *core) | |||
336 | void cx88_ir_irq(struct cx88_core *core) | 445 | void cx88_ir_irq(struct cx88_core *core) |
337 | { | 446 | { |
338 | struct cx88_IR *ir = core->ir; | 447 | struct cx88_IR *ir = core->ir; |
339 | u32 samples,rc5; | 448 | u32 samples, rc5; |
340 | int i; | 449 | int i; |
341 | 450 | ||
342 | if (NULL == ir) | 451 | if (NULL == ir) |
@@ -345,7 +454,7 @@ void cx88_ir_irq(struct cx88_core *core) | |||
345 | return; | 454 | return; |
346 | 455 | ||
347 | samples = cx_read(MO_SAMPLE_IO); | 456 | samples = cx_read(MO_SAMPLE_IO); |
348 | if (0 != samples && 0xffffffff != samples) { | 457 | if (0 != samples && 0xffffffff != samples) { |
349 | /* record sample data */ | 458 | /* record sample data */ |
350 | if (ir->scount < ARRAY_SIZE(ir->samples)) | 459 | if (ir->scount < ARRAY_SIZE(ir->samples)) |
351 | ir->samples[ir->scount++] = samples; | 460 | ir->samples[ir->scount++] = samples; |
@@ -353,8 +462,8 @@ void cx88_ir_irq(struct cx88_core *core) | |||
353 | } | 462 | } |
354 | if (!ir->scount) { | 463 | if (!ir->scount) { |
355 | /* nothing to sample */ | 464 | /* nothing to sample */ |
356 | if (ir->ir.keypressed && time_after(jiffies,ir->release)) | 465 | if (ir->ir.keypressed && time_after(jiffies, ir->release)) |
357 | ir_input_nokey(&ir->input,&ir->ir); | 466 | ir_input_nokey(&ir->input, &ir->ir); |
358 | return; | 467 | return; |
359 | } | 468 | } |
360 | 469 | ||
@@ -364,14 +473,14 @@ void cx88_ir_irq(struct cx88_core *core) | |||
364 | for (i = 0; i < ir->scount; i++) | 473 | for (i = 0; i < ir->scount; i++) |
365 | ir->samples[i] = ~ir->samples[i]; | 474 | ir->samples[i] = ~ir->samples[i]; |
366 | if (ir_debug) | 475 | if (ir_debug) |
367 | ir_dump_samples(ir->samples,ir->scount); | 476 | ir_dump_samples(ir->samples, ir->scount); |
368 | 477 | ||
369 | /* decode it */ | 478 | /* decode it */ |
370 | switch (core->board) { | 479 | switch (core->board) { |
371 | case CX88_BOARD_HAUPPAUGE: | 480 | case CX88_BOARD_HAUPPAUGE: |
372 | case CX88_BOARD_HAUPPAUGE_DVB_T1: | 481 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
373 | rc5 = ir_decode_biphase(ir->samples,ir->scount,5,7); | 482 | rc5 = ir_decode_biphase(ir->samples, ir->scount, 5, 7); |
374 | ir_dprintk("biphase decoded: %x\n",rc5); | 483 | ir_dprintk("biphase decoded: %x\n", rc5); |
375 | if ((rc5 & 0xfffff000) != 0x3000) | 484 | if ((rc5 & 0xfffff000) != 0x3000) |
376 | break; | 485 | break; |
377 | ir_input_keydown(&ir->input, &ir->ir, rc5 & 0x3f, rc5); | 486 | ir_input_keydown(&ir->input, &ir->ir, rc5 & 0x3f, rc5); |
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 07aae1899e17..fe2767c0ff94 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-mpeg.c,v 1.25 2005/03/07 14:18:00 kraxel Exp $ | 2 | * $Id: cx88-mpeg.c,v 1.31 2005/07/07 14:17:47 mchehab Exp $ |
3 | * | 3 | * |
4 | * Support for the mpeg transport stream transfers | 4 | * Support for the mpeg transport stream transfers |
5 | * PCI function #2 of the cx2388x. | 5 | * PCI function #2 of the cx2388x. |
@@ -55,7 +55,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev, | |||
55 | { | 55 | { |
56 | struct cx88_core *core = dev->core; | 56 | struct cx88_core *core = dev->core; |
57 | 57 | ||
58 | dprintk(1, "cx8802_start_mpegport_dma %d\n", buf->vb.width); | 58 | dprintk(0, "cx8802_start_dma %d\n", buf->vb.width); |
59 | 59 | ||
60 | /* setup fifo + format */ | 60 | /* setup fifo + format */ |
61 | cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH28], | 61 | cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH28], |
@@ -64,17 +64,21 @@ static int cx8802_start_dma(struct cx8802_dev *dev, | |||
64 | /* write TS length to chip */ | 64 | /* write TS length to chip */ |
65 | cx_write(MO_TS_LNGTH, buf->vb.width); | 65 | cx_write(MO_TS_LNGTH, buf->vb.width); |
66 | 66 | ||
67 | #if 1 | ||
68 | /* FIXME: this needs a review. | 67 | /* FIXME: this needs a review. |
69 | * also: move to cx88-blackbird + cx88-dvb source files? */ | 68 | * also: move to cx88-blackbird + cx88-dvb source files? */ |
70 | 69 | ||
71 | if (cx88_boards[core->board].dvb) { | 70 | if (cx88_boards[core->board].dvb) { |
72 | /* negedge driven & software reset */ | 71 | /* negedge driven & software reset */ |
73 | cx_write(TS_GEN_CNTRL, 0x40); | 72 | cx_write(TS_GEN_CNTRL, 0x0040 | dev->ts_gen_cntrl); |
74 | udelay(100); | 73 | udelay(100); |
75 | cx_write(MO_PINMUX_IO, 0x00); | 74 | cx_write(MO_PINMUX_IO, 0x00); |
76 | cx_write(TS_HW_SOP_CNTRL,47<<16|188<<4|0x00); | 75 | cx_write(TS_HW_SOP_CNTRL,0x47<<16|188<<4|0x01); |
77 | cx_write(TS_SOP_STAT,0x00); | 76 | if ((core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q) || |
77 | (core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T)) { | ||
78 | cx_write(TS_SOP_STAT, 1<<13); | ||
79 | } else { | ||
80 | cx_write(TS_SOP_STAT, 0x00); | ||
81 | } | ||
78 | cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl); | 82 | cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl); |
79 | udelay(100); | 83 | udelay(100); |
80 | } | 84 | } |
@@ -93,25 +97,27 @@ static int cx8802_start_dma(struct cx8802_dev *dev, | |||
93 | cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */ | 97 | cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */ |
94 | udelay(100); | 98 | udelay(100); |
95 | } | 99 | } |
96 | #endif | ||
97 | 100 | ||
98 | /* reset counter */ | 101 | /* reset counter */ |
99 | cx_write(MO_TS_GPCNTRL, GP_COUNT_CONTROL_RESET); | 102 | cx_write(MO_TS_GPCNTRL, GP_COUNT_CONTROL_RESET); |
100 | q->count = 1; | 103 | q->count = 1; |
101 | 104 | ||
102 | /* enable irqs */ | 105 | /* enable irqs */ |
106 | dprintk( 0, "setting the interrupt mask\n" ); | ||
103 | cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x04); | 107 | cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x04); |
104 | cx_write(MO_TS_INTMSK, 0x1f0011); | 108 | cx_set(MO_TS_INTMSK, 0x1f0011); |
109 | //cx_write(MO_TS_INTMSK, 0x0f0011); | ||
105 | 110 | ||
106 | /* start dma */ | 111 | /* start dma */ |
107 | cx_write(MO_DEV_CNTRL2, (1<<5)); /* FIXME: s/write/set/ ??? */ | 112 | cx_set(MO_DEV_CNTRL2, (1<<5)); |
108 | cx_write(MO_TS_DMACNTRL, 0x11); | 113 | cx_set(MO_TS_DMACNTRL, 0x11); |
109 | return 0; | 114 | return 0; |
110 | } | 115 | } |
111 | 116 | ||
112 | static int cx8802_stop_dma(struct cx8802_dev *dev) | 117 | static int cx8802_stop_dma(struct cx8802_dev *dev) |
113 | { | 118 | { |
114 | struct cx88_core *core = dev->core; | 119 | struct cx88_core *core = dev->core; |
120 | dprintk( 0, "cx8802_stop_dma\n" ); | ||
115 | 121 | ||
116 | /* stop dma */ | 122 | /* stop dma */ |
117 | cx_clear(MO_TS_DMACNTRL, 0x11); | 123 | cx_clear(MO_TS_DMACNTRL, 0x11); |
@@ -131,8 +137,12 @@ static int cx8802_restart_queue(struct cx8802_dev *dev, | |||
131 | struct cx88_buffer *buf; | 137 | struct cx88_buffer *buf; |
132 | struct list_head *item; | 138 | struct list_head *item; |
133 | 139 | ||
140 | dprintk( 0, "cx8802_restart_queue\n" ); | ||
134 | if (list_empty(&q->active)) | 141 | if (list_empty(&q->active)) |
142 | { | ||
143 | dprintk( 0, "cx8802_restart_queue: queue is empty\n" ); | ||
135 | return 0; | 144 | return 0; |
145 | } | ||
136 | 146 | ||
137 | buf = list_entry(q->active.next, struct cx88_buffer, vb.queue); | 147 | buf = list_entry(q->active.next, struct cx88_buffer, vb.queue); |
138 | dprintk(2,"restart_queue [%p/%d]: restart dma\n", | 148 | dprintk(2,"restart_queue [%p/%d]: restart dma\n", |
@@ -182,27 +192,32 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) | |||
182 | struct cx88_buffer *prev; | 192 | struct cx88_buffer *prev; |
183 | struct cx88_dmaqueue *q = &dev->mpegq; | 193 | struct cx88_dmaqueue *q = &dev->mpegq; |
184 | 194 | ||
195 | dprintk( 1, "cx8802_buf_queue\n" ); | ||
185 | /* add jump to stopper */ | 196 | /* add jump to stopper */ |
186 | buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); | 197 | buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); |
187 | buf->risc.jmp[1] = cpu_to_le32(q->stopper.dma); | 198 | buf->risc.jmp[1] = cpu_to_le32(q->stopper.dma); |
188 | 199 | ||
189 | if (list_empty(&q->active)) { | 200 | if (list_empty(&q->active)) { |
201 | dprintk( 0, "queue is empty - first active\n" ); | ||
190 | list_add_tail(&buf->vb.queue,&q->active); | 202 | list_add_tail(&buf->vb.queue,&q->active); |
191 | cx8802_start_dma(dev, q, buf); | 203 | cx8802_start_dma(dev, q, buf); |
192 | buf->vb.state = STATE_ACTIVE; | 204 | buf->vb.state = STATE_ACTIVE; |
193 | buf->count = q->count++; | 205 | buf->count = q->count++; |
194 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); | 206 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); |
195 | dprintk(2,"[%p/%d] %s - first active\n", | 207 | dprintk(0,"[%p/%d] %s - first active\n", |
196 | buf, buf->vb.i, __FUNCTION__); | 208 | buf, buf->vb.i, __FUNCTION__); |
209 | //udelay(100); | ||
197 | 210 | ||
198 | } else { | 211 | } else { |
212 | dprintk( 1, "queue is not empty - append to active\n" ); | ||
199 | prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue); | 213 | prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue); |
200 | list_add_tail(&buf->vb.queue,&q->active); | 214 | list_add_tail(&buf->vb.queue,&q->active); |
201 | buf->vb.state = STATE_ACTIVE; | 215 | buf->vb.state = STATE_ACTIVE; |
202 | buf->count = q->count++; | 216 | buf->count = q->count++; |
203 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); | 217 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); |
204 | dprintk(2,"[%p/%d] %s - append to active\n", | 218 | dprintk( 1, "[%p/%d] %s - append to active\n", |
205 | buf, buf->vb.i, __FUNCTION__); | 219 | buf, buf->vb.i, __FUNCTION__); |
220 | //udelay(100); | ||
206 | } | 221 | } |
207 | } | 222 | } |
208 | 223 | ||
@@ -224,7 +239,10 @@ static void do_cancel_buffers(struct cx8802_dev *dev, char *reason, int restart) | |||
224 | buf, buf->vb.i, reason, (unsigned long)buf->risc.dma); | 239 | buf, buf->vb.i, reason, (unsigned long)buf->risc.dma); |
225 | } | 240 | } |
226 | if (restart) | 241 | if (restart) |
242 | { | ||
243 | dprintk(0, "restarting queue\n" ); | ||
227 | cx8802_restart_queue(dev,q); | 244 | cx8802_restart_queue(dev,q); |
245 | } | ||
228 | spin_unlock_irqrestore(&dev->slock,flags); | 246 | spin_unlock_irqrestore(&dev->slock,flags); |
229 | } | 247 | } |
230 | 248 | ||
@@ -232,6 +250,7 @@ void cx8802_cancel_buffers(struct cx8802_dev *dev) | |||
232 | { | 250 | { |
233 | struct cx88_dmaqueue *q = &dev->mpegq; | 251 | struct cx88_dmaqueue *q = &dev->mpegq; |
234 | 252 | ||
253 | dprintk( 1, "cx8802_cancel_buffers" ); | ||
235 | del_timer_sync(&q->timeout); | 254 | del_timer_sync(&q->timeout); |
236 | cx8802_stop_dma(dev); | 255 | cx8802_stop_dma(dev); |
237 | do_cancel_buffers(dev,"cancel",0); | 256 | do_cancel_buffers(dev,"cancel",0); |
@@ -241,7 +260,7 @@ static void cx8802_timeout(unsigned long data) | |||
241 | { | 260 | { |
242 | struct cx8802_dev *dev = (struct cx8802_dev*)data; | 261 | struct cx8802_dev *dev = (struct cx8802_dev*)data; |
243 | 262 | ||
244 | dprintk(1, "%s\n",__FUNCTION__); | 263 | dprintk(0, "%s\n",__FUNCTION__); |
245 | 264 | ||
246 | if (debug) | 265 | if (debug) |
247 | cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]); | 266 | cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]); |
@@ -249,17 +268,28 @@ static void cx8802_timeout(unsigned long data) | |||
249 | do_cancel_buffers(dev,"timeout",1); | 268 | do_cancel_buffers(dev,"timeout",1); |
250 | } | 269 | } |
251 | 270 | ||
271 | static char *cx88_mpeg_irqs[32] = { | ||
272 | "ts_risci1", NULL, NULL, NULL, | ||
273 | "ts_risci2", NULL, NULL, NULL, | ||
274 | "ts_oflow", NULL, NULL, NULL, | ||
275 | "ts_sync", NULL, NULL, NULL, | ||
276 | "opc_err", "par_err", "rip_err", "pci_abort", | ||
277 | "ts_err?", | ||
278 | }; | ||
279 | |||
252 | static void cx8802_mpeg_irq(struct cx8802_dev *dev) | 280 | static void cx8802_mpeg_irq(struct cx8802_dev *dev) |
253 | { | 281 | { |
254 | struct cx88_core *core = dev->core; | 282 | struct cx88_core *core = dev->core; |
255 | u32 status, mask, count; | 283 | u32 status, mask, count; |
256 | 284 | ||
285 | dprintk( 1, "cx8802_mpeg_irq\n" ); | ||
257 | status = cx_read(MO_TS_INTSTAT); | 286 | status = cx_read(MO_TS_INTSTAT); |
258 | mask = cx_read(MO_TS_INTMSK); | 287 | mask = cx_read(MO_TS_INTMSK); |
259 | if (0 == (status & mask)) | 288 | if (0 == (status & mask)) |
260 | return; | 289 | return; |
261 | 290 | ||
262 | cx_write(MO_TS_INTSTAT, status); | 291 | cx_write(MO_TS_INTSTAT, status); |
292 | |||
263 | if (debug || (status & mask & ~0xff)) | 293 | if (debug || (status & mask & ~0xff)) |
264 | cx88_print_irqbits(core->name, "irq mpeg ", | 294 | cx88_print_irqbits(core->name, "irq mpeg ", |
265 | cx88_mpeg_irqs, status, mask); | 295 | cx88_mpeg_irqs, status, mask); |
@@ -273,6 +303,7 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) | |||
273 | 303 | ||
274 | /* risc1 y */ | 304 | /* risc1 y */ |
275 | if (status & 0x01) { | 305 | if (status & 0x01) { |
306 | dprintk( 1, "wake up\n" ); | ||
276 | spin_lock(&dev->slock); | 307 | spin_lock(&dev->slock); |
277 | count = cx_read(MO_TS_GPCNT); | 308 | count = cx_read(MO_TS_GPCNT); |
278 | cx88_wakeup(dev->core, &dev->mpegq, count); | 309 | cx88_wakeup(dev->core, &dev->mpegq, count); |
@@ -288,6 +319,7 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) | |||
288 | 319 | ||
289 | /* other general errors */ | 320 | /* other general errors */ |
290 | if (status & 0x1f0100) { | 321 | if (status & 0x1f0100) { |
322 | dprintk( 0, "general errors: 0x%08x\n", status & 0x1f0100 ); | ||
291 | spin_lock(&dev->slock); | 323 | spin_lock(&dev->slock); |
292 | cx8802_stop_dma(dev); | 324 | cx8802_stop_dma(dev); |
293 | cx8802_restart_queue(dev,&dev->mpegq); | 325 | cx8802_restart_queue(dev,&dev->mpegq); |
@@ -295,6 +327,8 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) | |||
295 | } | 327 | } |
296 | } | 328 | } |
297 | 329 | ||
330 | #define MAX_IRQ_LOOP 10 | ||
331 | |||
298 | static irqreturn_t cx8802_irq(int irq, void *dev_id, struct pt_regs *regs) | 332 | static irqreturn_t cx8802_irq(int irq, void *dev_id, struct pt_regs *regs) |
299 | { | 333 | { |
300 | struct cx8802_dev *dev = dev_id; | 334 | struct cx8802_dev *dev = dev_id; |
@@ -302,10 +336,13 @@ static irqreturn_t cx8802_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
302 | u32 status; | 336 | u32 status; |
303 | int loop, handled = 0; | 337 | int loop, handled = 0; |
304 | 338 | ||
305 | for (loop = 0; loop < 10; loop++) { | 339 | for (loop = 0; loop < MAX_IRQ_LOOP; loop++) { |
306 | status = cx_read(MO_PCI_INTSTAT) & (core->pci_irqmask | 0x04); | 340 | status = cx_read(MO_PCI_INTSTAT) & (core->pci_irqmask | 0x04); |
307 | if (0 == status) | 341 | if (0 == status) |
308 | goto out; | 342 | goto out; |
343 | dprintk( 1, "cx8802_irq\n" ); | ||
344 | dprintk( 1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP ); | ||
345 | dprintk( 1, " status: %d\n", status ); | ||
309 | handled = 1; | 346 | handled = 1; |
310 | cx_write(MO_PCI_INTSTAT, status); | 347 | cx_write(MO_PCI_INTSTAT, status); |
311 | 348 | ||
@@ -314,7 +351,8 @@ static irqreturn_t cx8802_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
314 | if (status & 0x04) | 351 | if (status & 0x04) |
315 | cx8802_mpeg_irq(dev); | 352 | cx8802_mpeg_irq(dev); |
316 | }; | 353 | }; |
317 | if (10 == loop) { | 354 | if (MAX_IRQ_LOOP == loop) { |
355 | dprintk( 0, "clearing mask\n" ); | ||
318 | printk(KERN_WARNING "%s/0: irq loop -- clearing mask\n", | 356 | printk(KERN_WARNING "%s/0: irq loop -- clearing mask\n", |
319 | core->name); | 357 | core->name); |
320 | cx_write(MO_PCI_INTMSK,0); | 358 | cx_write(MO_PCI_INTMSK,0); |
@@ -378,6 +416,7 @@ int cx8802_init_common(struct cx8802_dev *dev) | |||
378 | 416 | ||
379 | void cx8802_fini_common(struct cx8802_dev *dev) | 417 | void cx8802_fini_common(struct cx8802_dev *dev) |
380 | { | 418 | { |
419 | dprintk( 2, "cx8802_fini_common\n" ); | ||
381 | cx8802_stop_dma(dev); | 420 | cx8802_stop_dma(dev); |
382 | pci_disable_device(dev->pci); | 421 | pci_disable_device(dev->pci); |
383 | 422 | ||
@@ -399,16 +438,15 @@ int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state) | |||
399 | /* stop mpeg dma */ | 438 | /* stop mpeg dma */ |
400 | spin_lock(&dev->slock); | 439 | spin_lock(&dev->slock); |
401 | if (!list_empty(&dev->mpegq.active)) { | 440 | if (!list_empty(&dev->mpegq.active)) { |
441 | dprintk( 2, "suspend\n" ); | ||
402 | printk("%s: suspend mpeg\n", core->name); | 442 | printk("%s: suspend mpeg\n", core->name); |
403 | cx8802_stop_dma(dev); | 443 | cx8802_stop_dma(dev); |
404 | del_timer(&dev->mpegq.timeout); | 444 | del_timer(&dev->mpegq.timeout); |
405 | } | 445 | } |
406 | spin_unlock(&dev->slock); | 446 | spin_unlock(&dev->slock); |
407 | 447 | ||
408 | #if 1 | ||
409 | /* FIXME -- shutdown device */ | 448 | /* FIXME -- shutdown device */ |
410 | cx88_shutdown(dev->core); | 449 | cx88_shutdown(dev->core); |
411 | #endif | ||
412 | 450 | ||
413 | pci_save_state(pci_dev); | 451 | pci_save_state(pci_dev); |
414 | if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { | 452 | if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { |
@@ -430,10 +468,8 @@ int cx8802_resume_common(struct pci_dev *pci_dev) | |||
430 | pci_set_power_state(pci_dev, PCI_D0); | 468 | pci_set_power_state(pci_dev, PCI_D0); |
431 | pci_restore_state(pci_dev); | 469 | pci_restore_state(pci_dev); |
432 | 470 | ||
433 | #if 1 | ||
434 | /* FIXME: re-initialize hardware */ | 471 | /* FIXME: re-initialize hardware */ |
435 | cx88_reset(dev->core); | 472 | cx88_reset(dev->core); |
436 | #endif | ||
437 | 473 | ||
438 | /* restart video+vbi capture */ | 474 | /* restart video+vbi capture */ |
439 | spin_lock(&dev->slock); | 475 | spin_lock(&dev->slock); |
@@ -463,4 +499,5 @@ EXPORT_SYMBOL(cx8802_resume_common); | |||
463 | * Local variables: | 499 | * Local variables: |
464 | * c-basic-offset: 8 | 500 | * c-basic-offset: 8 |
465 | * End: | 501 | * End: |
502 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
466 | */ | 503 | */ |
diff --git a/drivers/media/video/cx88/cx88-reg.h b/drivers/media/video/cx88/cx88-reg.h index 8638ce57d84c..37f82662d265 100644 --- a/drivers/media/video/cx88/cx88-reg.h +++ b/drivers/media/video/cx88/cx88-reg.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: cx88-reg.h,v 1.6 2004/10/13 10:39:00 kraxel Exp $ | 2 | $Id: cx88-reg.h,v 1.8 2005/07/07 13:58:38 mchehab Exp $ |
3 | 3 | ||
4 | cx88x-hw.h - CX2388x register offsets | 4 | cx88x-hw.h - CX2388x register offsets |
5 | 5 | ||
@@ -397,6 +397,7 @@ | |||
397 | #define AUD_RATE_ADJ4 0x3205e4 | 397 | #define AUD_RATE_ADJ4 0x3205e4 |
398 | #define AUD_RATE_ADJ5 0x3205e8 | 398 | #define AUD_RATE_ADJ5 0x3205e8 |
399 | #define AUD_APB_IN_RATE_ADJ 0x3205ec | 399 | #define AUD_APB_IN_RATE_ADJ 0x3205ec |
400 | #define AUD_I2SCNTL 0x3205ec | ||
400 | #define AUD_PHASE_FIX_CTL 0x3205f0 | 401 | #define AUD_PHASE_FIX_CTL 0x3205f0 |
401 | #define AUD_PLL_PRESCALE 0x320600 | 402 | #define AUD_PLL_PRESCALE 0x320600 |
402 | #define AUD_PLL_DDS 0x320604 | 403 | #define AUD_PLL_DDS 0x320604 |
@@ -603,20 +604,11 @@ | |||
603 | #define EN_I2SIN_STR2DAC 0x00004000 | 604 | #define EN_I2SIN_STR2DAC 0x00004000 |
604 | #define EN_I2SIN_ENABLE 0x00008000 | 605 | #define EN_I2SIN_ENABLE 0x00008000 |
605 | 606 | ||
606 | #if 0 | ||
607 | /* old */ | ||
608 | #define EN_DMTRX_SUMDIFF 0x00000800 | ||
609 | #define EN_DMTRX_SUMR 0x00000880 | ||
610 | #define EN_DMTRX_LR 0x00000900 | ||
611 | #define EN_DMTRX_MONO 0x00000980 | ||
612 | #else | ||
613 | /* dscaler cvs */ | ||
614 | #define EN_DMTRX_SUMDIFF (0 << 7) | 607 | #define EN_DMTRX_SUMDIFF (0 << 7) |
615 | #define EN_DMTRX_SUMR (1 << 7) | 608 | #define EN_DMTRX_SUMR (1 << 7) |
616 | #define EN_DMTRX_LR (2 << 7) | 609 | #define EN_DMTRX_LR (2 << 7) |
617 | #define EN_DMTRX_MONO (3 << 7) | 610 | #define EN_DMTRX_MONO (3 << 7) |
618 | #define EN_DMTRX_BYPASS (1 << 11) | 611 | #define EN_DMTRX_BYPASS (1 << 11) |
619 | #endif | ||
620 | 612 | ||
621 | // Video | 613 | // Video |
622 | #define VID_CAPTURE_CONTROL 0x310180 | 614 | #define VID_CAPTURE_CONTROL 0x310180 |
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index f2a9475a2fee..91207f10bae7 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: cx88-tvaudio.c,v 1.34 2005/03/07 16:10:51 kraxel Exp $ | 2 | $Id: cx88-tvaudio.c,v 1.37 2005/07/07 13:58:38 mchehab Exp $ |
3 | 3 | ||
4 | cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver | 4 | cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver |
5 | 5 | ||
@@ -127,7 +127,8 @@ static void set_audio_start(struct cx88_core *core, | |||
127 | cx_write(AUD_VOL_CTL, (1 << 6)); | 127 | cx_write(AUD_VOL_CTL, (1 << 6)); |
128 | 128 | ||
129 | // increase level of input by 12dB | 129 | // increase level of input by 12dB |
130 | cx_write(AUD_AFE_12DB_EN, 0x0001); | 130 | // cx_write(AUD_AFE_12DB_EN, 0x0001); |
131 | cx_write(AUD_AFE_12DB_EN, 0x0000); | ||
131 | 132 | ||
132 | // start programming | 133 | // start programming |
133 | cx_write(AUD_CTL, 0x0000); | 134 | cx_write(AUD_CTL, 0x0000); |
@@ -143,9 +144,15 @@ static void set_audio_finish(struct cx88_core *core) | |||
143 | u32 volume; | 144 | u32 volume; |
144 | 145 | ||
145 | if (cx88_boards[core->board].blackbird) { | 146 | if (cx88_boards[core->board].blackbird) { |
147 | // sets sound input from external adc | ||
148 | cx_set(AUD_CTL, EN_I2SIN_ENABLE); | ||
149 | //cx_write(AUD_I2SINPUTCNTL, 0); | ||
150 | cx_write(AUD_I2SINPUTCNTL, 4); | ||
151 | cx_write(AUD_BAUDRATE, 1); | ||
146 | // 'pass-thru mode': this enables the i2s output to the mpeg encoder | 152 | // 'pass-thru mode': this enables the i2s output to the mpeg encoder |
147 | cx_set(AUD_CTL, 0x2000); | 153 | cx_set(AUD_CTL, EN_I2SOUT_ENABLE); |
148 | cx_write(AUD_I2SOUTPUTCNTL, 1); | 154 | cx_write(AUD_I2SOUTPUTCNTL, 1); |
155 | cx_write(AUD_I2SCNTL, 0); | ||
149 | //cx_write(AUD_APB_IN_RATE_ADJ, 0); | 156 | //cx_write(AUD_APB_IN_RATE_ADJ, 0); |
150 | } | 157 | } |
151 | 158 | ||
@@ -271,80 +278,6 @@ static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap) | |||
271 | set_audio_finish(core); | 278 | set_audio_finish(core); |
272 | } | 279 | } |
273 | 280 | ||
274 | #if 0 | ||
275 | static void set_audio_standard_NICAM(struct cx88_core *core) | ||
276 | { | ||
277 | static const struct rlist nicam_common[] = { | ||
278 | /* from dscaler */ | ||
279 | { AUD_RATE_ADJ1, 0x00000010 }, | ||
280 | { AUD_RATE_ADJ2, 0x00000040 }, | ||
281 | { AUD_RATE_ADJ3, 0x00000100 }, | ||
282 | { AUD_RATE_ADJ4, 0x00000400 }, | ||
283 | { AUD_RATE_ADJ5, 0x00001000 }, | ||
284 | // { AUD_DMD_RA_DDS, 0x00c0d5ce }, | ||
285 | |||
286 | // Deemphasis 1: | ||
287 | { AUD_DEEMPHGAIN_R, 0x000023c2 }, | ||
288 | { AUD_DEEMPHNUMER1_R, 0x0002a7bc }, | ||
289 | { AUD_DEEMPHNUMER2_R, 0x0003023e }, | ||
290 | { AUD_DEEMPHDENOM1_R, 0x0000f3d0 }, | ||
291 | { AUD_DEEMPHDENOM2_R, 0x00000000 }, | ||
292 | |||
293 | #if 0 | ||
294 | // Deemphasis 2: (other tv norm?) | ||
295 | { AUD_DEEMPHGAIN_R, 0x0000c600 }, | ||
296 | { AUD_DEEMPHNUMER1_R, 0x00066738 }, | ||
297 | { AUD_DEEMPHNUMER2_R, 0x00066739 }, | ||
298 | { AUD_DEEMPHDENOM1_R, 0x0001e88c }, | ||
299 | { AUD_DEEMPHDENOM2_R, 0x0001e88c }, | ||
300 | #endif | ||
301 | |||
302 | { AUD_DEEMPHDENOM2_R, 0x00000000 }, | ||
303 | { AUD_ERRLOGPERIOD_R, 0x00000fff }, | ||
304 | { AUD_ERRINTRPTTHSHLD1_R, 0x000003ff }, | ||
305 | { AUD_ERRINTRPTTHSHLD2_R, 0x000000ff }, | ||
306 | { AUD_ERRINTRPTTHSHLD3_R, 0x0000003f }, | ||
307 | { AUD_POLYPH80SCALEFAC, 0x00000003 }, | ||
308 | |||
309 | // setup QAM registers | ||
310 | { AUD_PDF_DDS_CNST_BYTE2, 0x06 }, | ||
311 | { AUD_PDF_DDS_CNST_BYTE1, 0x82 }, | ||
312 | { AUD_PDF_DDS_CNST_BYTE0, 0x16 }, | ||
313 | { AUD_QAM_MODE, 0x05 }, | ||
314 | |||
315 | { /* end of list */ }, | ||
316 | }; | ||
317 | static const struct rlist nicam_pal_i[] = { | ||
318 | { AUD_PDF_DDS_CNST_BYTE0, 0x12 }, | ||
319 | { AUD_PHACC_FREQ_8MSB, 0x3a }, | ||
320 | { AUD_PHACC_FREQ_8LSB, 0x93 }, | ||
321 | |||
322 | { /* end of list */ }, | ||
323 | }; | ||
324 | static const struct rlist nicam_default[] = { | ||
325 | { AUD_PDF_DDS_CNST_BYTE0, 0x16 }, | ||
326 | { AUD_PHACC_FREQ_8MSB, 0x34 }, | ||
327 | { AUD_PHACC_FREQ_8LSB, 0x4c }, | ||
328 | |||
329 | { /* end of list */ }, | ||
330 | }; | ||
331 | |||
332 | set_audio_start(core, 0x0010, | ||
333 | EN_DMTRX_LR | EN_DMTRX_BYPASS | EN_NICAM_AUTO_STEREO); | ||
334 | set_audio_registers(core, nicam_common); | ||
335 | switch (core->tvaudio) { | ||
336 | case WW_NICAM_I: | ||
337 | dprintk("%s PAL-I NICAM (status: unknown)\n",__FUNCTION__); | ||
338 | set_audio_registers(core, nicam_pal_i); | ||
339 | break; | ||
340 | case WW_NICAM_BGDKL: | ||
341 | dprintk("%s PAL-BGDK NICAM (status: unknown)\n",__FUNCTION__); | ||
342 | set_audio_registers(core, nicam_default); | ||
343 | break; | ||
344 | }; | ||
345 | set_audio_finish(core); | ||
346 | } | ||
347 | #endif | ||
348 | 281 | ||
349 | static void set_audio_standard_NICAM_L(struct cx88_core *core, int stereo) | 282 | static void set_audio_standard_NICAM_L(struct cx88_core *core, int stereo) |
350 | { | 283 | { |
@@ -707,50 +640,65 @@ static void set_audio_standard_EIAJ(struct cx88_core *core) | |||
707 | set_audio_finish(core); | 640 | set_audio_finish(core); |
708 | } | 641 | } |
709 | 642 | ||
710 | static void set_audio_standard_FM(struct cx88_core *core) | 643 | static void set_audio_standard_FM(struct cx88_core *core, enum cx88_deemph_type deemph) |
711 | { | 644 | { |
712 | #if 0 /* FIXME */ | 645 | static const struct rlist fm_deemph_50[] = { |
713 | switch (dev->audio_properties.FM_deemphasis) | 646 | { AUD_DEEMPH0_G0, 0x0C45 }, |
714 | { | 647 | { AUD_DEEMPH0_A0, 0x6262 }, |
715 | case WW_FM_DEEMPH_50: | 648 | { AUD_DEEMPH0_B0, 0x1C29 }, |
716 | //Set De-emphasis filter coefficients for 50 usec | 649 | { AUD_DEEMPH0_A1, 0x3FC66}, |
717 | cx_write(AUD_DEEMPH0_G0, 0x0C45); | 650 | { AUD_DEEMPH0_B1, 0x399A }, |
718 | cx_write(AUD_DEEMPH0_A0, 0x6262); | 651 | |
719 | cx_write(AUD_DEEMPH0_B0, 0x1C29); | 652 | { AUD_DEEMPH1_G0, 0x0D80 }, |
720 | cx_write(AUD_DEEMPH0_A1, 0x3FC66); | 653 | { AUD_DEEMPH1_A0, 0x6262 }, |
721 | cx_write(AUD_DEEMPH0_B1, 0x399A); | 654 | { AUD_DEEMPH1_B0, 0x1C29 }, |
722 | 655 | { AUD_DEEMPH1_A1, 0x3FC66}, | |
723 | cx_write(AUD_DEEMPH1_G0, 0x0D80); | 656 | { AUD_DEEMPH1_B1, 0x399A}, |
724 | cx_write(AUD_DEEMPH1_A0, 0x6262); | 657 | |
725 | cx_write(AUD_DEEMPH1_B0, 0x1C29); | 658 | { AUD_POLYPH80SCALEFAC, 0x0003}, |
726 | cx_write(AUD_DEEMPH1_A1, 0x3FC66); | 659 | { /* end of list */ }, |
727 | cx_write(AUD_DEEMPH1_B1, 0x399A); | 660 | }; |
661 | static const struct rlist fm_deemph_75[] = { | ||
662 | { AUD_DEEMPH0_G0, 0x091B }, | ||
663 | { AUD_DEEMPH0_A0, 0x6B68 }, | ||
664 | { AUD_DEEMPH0_B0, 0x11EC }, | ||
665 | { AUD_DEEMPH0_A1, 0x3FC66}, | ||
666 | { AUD_DEEMPH0_B1, 0x399A }, | ||
667 | |||
668 | { AUD_DEEMPH1_G0, 0x0AA0 }, | ||
669 | { AUD_DEEMPH1_A0, 0x6B68 }, | ||
670 | { AUD_DEEMPH1_B0, 0x11EC }, | ||
671 | { AUD_DEEMPH1_A1, 0x3FC66}, | ||
672 | { AUD_DEEMPH1_B1, 0x399A}, | ||
673 | |||
674 | { AUD_POLYPH80SCALEFAC, 0x0003}, | ||
675 | { /* end of list */ }, | ||
676 | }; | ||
728 | 677 | ||
729 | break; | 678 | /* It is enough to leave default values? */ |
679 | static const struct rlist fm_no_deemph[] = { | ||
730 | 680 | ||
731 | case WW_FM_DEEMPH_75: | 681 | { AUD_POLYPH80SCALEFAC, 0x0003}, |
732 | //Set De-emphasis filter coefficients for 75 usec | 682 | { /* end of list */ }, |
733 | cx_write(AUD_DEEMPH0_G0, 0x91B ); | 683 | }; |
734 | cx_write(AUD_DEEMPH0_A0, 0x6B68); | ||
735 | cx_write(AUD_DEEMPH0_B0, 0x11EC); | ||
736 | cx_write(AUD_DEEMPH0_A1, 0x3FC66); | ||
737 | cx_write(AUD_DEEMPH0_B1, 0x399A); | ||
738 | 684 | ||
739 | cx_write(AUD_DEEMPH1_G0, 0xAA0 ); | 685 | dprintk("%s (status: unknown)\n",__FUNCTION__); |
740 | cx_write(AUD_DEEMPH1_A0, 0x6B68); | 686 | set_audio_start(core, 0x0020, EN_FMRADIO_AUTO_STEREO); |
741 | cx_write(AUD_DEEMPH1_B0, 0x11EC); | ||
742 | cx_write(AUD_DEEMPH1_A1, 0x3FC66); | ||
743 | cx_write(AUD_DEEMPH1_B1, 0x399A); | ||
744 | 687 | ||
688 | switch (deemph) | ||
689 | { | ||
690 | case FM_NO_DEEMPH: | ||
691 | set_audio_registers(core, fm_no_deemph); | ||
745 | break; | 692 | break; |
746 | } | ||
747 | #endif | ||
748 | 693 | ||
749 | dprintk("%s (status: unknown)\n",__FUNCTION__); | 694 | case FM_DEEMPH_50: |
750 | set_audio_start(core, 0x0020, EN_FMRADIO_AUTO_STEREO); | 695 | set_audio_registers(core, fm_deemph_50); |
696 | break; | ||
751 | 697 | ||
752 | // AB: 10/2/01: this register is not being reset appropriately on occasion. | 698 | case FM_DEEMPH_75: |
753 | cx_write(AUD_POLYPH80SCALEFAC,3); | 699 | set_audio_registers(core, fm_deemph_75); |
700 | break; | ||
701 | } | ||
754 | 702 | ||
755 | set_audio_finish(core); | 703 | set_audio_finish(core); |
756 | } | 704 | } |
@@ -778,7 +726,7 @@ void cx88_set_tvaudio(struct cx88_core *core) | |||
778 | set_audio_standard_EIAJ(core); | 726 | set_audio_standard_EIAJ(core); |
779 | break; | 727 | break; |
780 | case WW_FM: | 728 | case WW_FM: |
781 | set_audio_standard_FM(core); | 729 | set_audio_standard_FM(core,FM_NO_DEEMPH); |
782 | break; | 730 | break; |
783 | case WW_SYSTEM_L_AM: | 731 | case WW_SYSTEM_L_AM: |
784 | set_audio_standard_NICAM_L(core, 1); | 732 | set_audio_standard_NICAM_L(core, 1); |
@@ -1029,4 +977,5 @@ EXPORT_SYMBOL(cx88_audio_thread); | |||
1029 | * Local variables: | 977 | * Local variables: |
1030 | * c-basic-offset: 8 | 978 | * c-basic-offset: 8 |
1031 | * End: | 979 | * End: |
980 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
1032 | */ | 981 | */ |
diff --git a/drivers/media/video/cx88/cx88-vbi.c b/drivers/media/video/cx88/cx88-vbi.c index 0584ff476387..320d57888bbd 100644 --- a/drivers/media/video/cx88/cx88-vbi.c +++ b/drivers/media/video/cx88/cx88-vbi.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-vbi.c,v 1.16 2004/12/10 12:33:39 kraxel Exp $ | 2 | * $Id: cx88-vbi.c,v 1.17 2005/06/12 04:19:19 mchehab Exp $ |
3 | */ | 3 | */ |
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
@@ -47,8 +47,8 @@ void cx8800_vbi_fmt(struct cx8800_dev *dev, struct v4l2_format *f) | |||
47 | } | 47 | } |
48 | 48 | ||
49 | static int cx8800_start_vbi_dma(struct cx8800_dev *dev, | 49 | static int cx8800_start_vbi_dma(struct cx8800_dev *dev, |
50 | struct cx88_dmaqueue *q, | 50 | struct cx88_dmaqueue *q, |
51 | struct cx88_buffer *buf) | 51 | struct cx88_buffer *buf) |
52 | { | 52 | { |
53 | struct cx88_core *core = dev->core; | 53 | struct cx88_core *core = dev->core; |
54 | 54 | ||
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index d1f5c92f0ce5..5f58c103198a 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-video.c,v 1.58 2005/03/07 15:58:05 kraxel Exp $ | 2 | * $Id: cx88-video.c,v 1.82 2005/07/22 05:13:34 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * video4linux video interface | 5 | * video4linux video interface |
@@ -86,13 +86,6 @@ static struct cx88_tvnorm tvnorms[] = { | |||
86 | .id = V4L2_STD_NTSC_M_JP, | 86 | .id = V4L2_STD_NTSC_M_JP, |
87 | .cxiformat = VideoFormatNTSCJapan, | 87 | .cxiformat = VideoFormatNTSCJapan, |
88 | .cxoformat = 0x181f0008, | 88 | .cxoformat = 0x181f0008, |
89 | #if 0 | ||
90 | },{ | ||
91 | .name = "NTSC-4.43", | ||
92 | .id = FIXME, | ||
93 | .cxiformat = VideoFormatNTSC443, | ||
94 | .cxoformat = 0x181f0008, | ||
95 | #endif | ||
96 | },{ | 89 | },{ |
97 | .name = "PAL-BG", | 90 | .name = "PAL-BG", |
98 | .id = V4L2_STD_PAL_BG, | 91 | .id = V4L2_STD_PAL_BG, |
@@ -248,6 +241,7 @@ static struct cx88_ctrl cx8800_ctls[] = { | |||
248 | .default_value = 0, | 241 | .default_value = 0, |
249 | .type = V4L2_CTRL_TYPE_INTEGER, | 242 | .type = V4L2_CTRL_TYPE_INTEGER, |
250 | }, | 243 | }, |
244 | .off = 0, | ||
251 | .reg = MO_CONTR_BRIGHT, | 245 | .reg = MO_CONTR_BRIGHT, |
252 | .mask = 0xff00, | 246 | .mask = 0xff00, |
253 | .shift = 8, | 247 | .shift = 8, |
@@ -261,7 +255,7 @@ static struct cx88_ctrl cx8800_ctls[] = { | |||
261 | .default_value = 0, | 255 | .default_value = 0, |
262 | .type = V4L2_CTRL_TYPE_INTEGER, | 256 | .type = V4L2_CTRL_TYPE_INTEGER, |
263 | }, | 257 | }, |
264 | .off = 0, | 258 | .off = 128, |
265 | .reg = MO_HUE, | 259 | .reg = MO_HUE, |
266 | .mask = 0x00ff, | 260 | .mask = 0x00ff, |
267 | .shift = 0, | 261 | .shift = 0, |
@@ -674,231 +668,6 @@ static struct videobuf_queue_ops cx8800_video_qops = { | |||
674 | 668 | ||
675 | /* ------------------------------------------------------------------ */ | 669 | /* ------------------------------------------------------------------ */ |
676 | 670 | ||
677 | #if 0 /* overlay support not finished yet */ | ||
678 | static u32* ov_risc_field(struct cx8800_dev *dev, struct cx8800_fh *fh, | ||
679 | u32 *rp, struct btcx_skiplist *skips, | ||
680 | u32 sync_line, int skip_even, int skip_odd) | ||
681 | { | ||
682 | int line,maxy,start,end,skip,nskips; | ||
683 | u32 ri,ra; | ||
684 | u32 addr; | ||
685 | |||
686 | /* sync instruction */ | ||
687 | *(rp++) = cpu_to_le32(RISC_RESYNC | sync_line); | ||
688 | |||
689 | addr = (unsigned long)dev->fbuf.base; | ||
690 | addr += dev->fbuf.fmt.bytesperline * fh->win.w.top; | ||
691 | addr += (fh->fmt->depth >> 3) * fh->win.w.left; | ||
692 | |||
693 | /* scan lines */ | ||
694 | for (maxy = -1, line = 0; line < fh->win.w.height; | ||
695 | line++, addr += dev->fbuf.fmt.bytesperline) { | ||
696 | if ((line%2) == 0 && skip_even) | ||
697 | continue; | ||
698 | if ((line%2) == 1 && skip_odd) | ||
699 | continue; | ||
700 | |||
701 | /* calculate clipping */ | ||
702 | if (line > maxy) | ||
703 | btcx_calc_skips(line, fh->win.w.width, &maxy, | ||
704 | skips, &nskips, fh->clips, fh->nclips); | ||
705 | |||
706 | /* write out risc code */ | ||
707 | for (start = 0, skip = 0; start < fh->win.w.width; start = end) { | ||
708 | if (skip >= nskips) { | ||
709 | ri = RISC_WRITE; | ||
710 | end = fh->win.w.width; | ||
711 | } else if (start < skips[skip].start) { | ||
712 | ri = RISC_WRITE; | ||
713 | end = skips[skip].start; | ||
714 | } else { | ||
715 | ri = RISC_SKIP; | ||
716 | end = skips[skip].end; | ||
717 | skip++; | ||
718 | } | ||
719 | if (RISC_WRITE == ri) | ||
720 | ra = addr + (fh->fmt->depth>>3)*start; | ||
721 | else | ||
722 | ra = 0; | ||
723 | |||
724 | if (0 == start) | ||
725 | ri |= RISC_SOL; | ||
726 | if (fh->win.w.width == end) | ||
727 | ri |= RISC_EOL; | ||
728 | ri |= (fh->fmt->depth>>3) * (end-start); | ||
729 | |||
730 | *(rp++)=cpu_to_le32(ri); | ||
731 | if (0 != ra) | ||
732 | *(rp++)=cpu_to_le32(ra); | ||
733 | } | ||
734 | } | ||
735 | kfree(skips); | ||
736 | return rp; | ||
737 | } | ||
738 | |||
739 | static int ov_risc_frame(struct cx8800_dev *dev, struct cx8800_fh *fh, | ||
740 | struct cx88_buffer *buf) | ||
741 | { | ||
742 | struct btcx_skiplist *skips; | ||
743 | u32 instructions,fields; | ||
744 | u32 *rp; | ||
745 | int rc; | ||
746 | |||
747 | /* skip list for window clipping */ | ||
748 | if (NULL == (skips = kmalloc(sizeof(*skips) * fh->nclips,GFP_KERNEL))) | ||
749 | return -ENOMEM; | ||
750 | |||
751 | fields = 0; | ||
752 | if (V4L2_FIELD_HAS_TOP(fh->win.field)) | ||
753 | fields++; | ||
754 | if (V4L2_FIELD_HAS_BOTTOM(fh->win.field)) | ||
755 | fields++; | ||
756 | |||
757 | /* estimate risc mem: worst case is (clip+1) * lines instructions | ||
758 | + syncs + jump (all 2 dwords) */ | ||
759 | instructions = (fh->nclips+1) * fh->win.w.height; | ||
760 | instructions += 3 + 4; | ||
761 | if ((rc = btcx_riscmem_alloc(dev->pci,&buf->risc,instructions*8)) < 0) { | ||
762 | kfree(skips); | ||
763 | return rc; | ||
764 | } | ||
765 | |||
766 | /* write risc instructions */ | ||
767 | rp = buf->risc.cpu; | ||
768 | switch (fh->win.field) { | ||
769 | case V4L2_FIELD_TOP: | ||
770 | rp = ov_risc_field(dev, fh, rp, skips, 0, 0, 0); | ||
771 | break; | ||
772 | case V4L2_FIELD_BOTTOM: | ||
773 | rp = ov_risc_field(dev, fh, rp, skips, 0x200, 0, 0); | ||
774 | break; | ||
775 | case V4L2_FIELD_INTERLACED: | ||
776 | rp = ov_risc_field(dev, fh, rp, skips, 0, 0, 1); | ||
777 | rp = ov_risc_field(dev, fh, rp, skips, 0x200, 1, 0); | ||
778 | break; | ||
779 | default: | ||
780 | BUG(); | ||
781 | } | ||
782 | |||
783 | /* save pointer to jmp instruction address */ | ||
784 | buf->risc.jmp = rp; | ||
785 | kfree(skips); | ||
786 | return 0; | ||
787 | } | ||
788 | |||
789 | static int verify_window(struct cx8800_dev *dev, struct v4l2_window *win) | ||
790 | { | ||
791 | enum v4l2_field field; | ||
792 | int maxw, maxh; | ||
793 | |||
794 | if (NULL == dev->fbuf.base) | ||
795 | return -EINVAL; | ||
796 | if (win->w.width < 48 || win->w.height < 32) | ||
797 | return -EINVAL; | ||
798 | if (win->clipcount > 2048) | ||
799 | return -EINVAL; | ||
800 | |||
801 | field = win->field; | ||
802 | maxw = norm_maxw(core->tvnorm); | ||
803 | maxh = norm_maxh(core->tvnorm); | ||
804 | |||
805 | if (V4L2_FIELD_ANY == field) { | ||
806 | field = (win->w.height > maxh/2) | ||
807 | ? V4L2_FIELD_INTERLACED | ||
808 | : V4L2_FIELD_TOP; | ||
809 | } | ||
810 | switch (field) { | ||
811 | case V4L2_FIELD_TOP: | ||
812 | case V4L2_FIELD_BOTTOM: | ||
813 | maxh = maxh / 2; | ||
814 | break; | ||
815 | case V4L2_FIELD_INTERLACED: | ||
816 | break; | ||
817 | default: | ||
818 | return -EINVAL; | ||
819 | } | ||
820 | |||
821 | win->field = field; | ||
822 | if (win->w.width > maxw) | ||
823 | win->w.width = maxw; | ||
824 | if (win->w.height > maxh) | ||
825 | win->w.height = maxh; | ||
826 | return 0; | ||
827 | } | ||
828 | |||
829 | static int setup_window(struct cx8800_dev *dev, struct cx8800_fh *fh, | ||
830 | struct v4l2_window *win) | ||
831 | { | ||
832 | struct v4l2_clip *clips = NULL; | ||
833 | int n,size,retval = 0; | ||
834 | |||
835 | if (NULL == fh->fmt) | ||
836 | return -EINVAL; | ||
837 | retval = verify_window(dev,win); | ||
838 | if (0 != retval) | ||
839 | return retval; | ||
840 | |||
841 | /* copy clips -- luckily v4l1 + v4l2 are binary | ||
842 | compatible here ...*/ | ||
843 | n = win->clipcount; | ||
844 | size = sizeof(*clips)*(n+4); | ||
845 | clips = kmalloc(size,GFP_KERNEL); | ||
846 | if (NULL == clips) | ||
847 | return -ENOMEM; | ||
848 | if (n > 0) { | ||
849 | if (copy_from_user(clips,win->clips,sizeof(struct v4l2_clip)*n)) { | ||
850 | kfree(clips); | ||
851 | return -EFAULT; | ||
852 | } | ||
853 | } | ||
854 | |||
855 | /* clip against screen */ | ||
856 | if (NULL != dev->fbuf.base) | ||
857 | n = btcx_screen_clips(dev->fbuf.fmt.width, dev->fbuf.fmt.height, | ||
858 | &win->w, clips, n); | ||
859 | btcx_sort_clips(clips,n); | ||
860 | |||
861 | /* 4-byte alignments */ | ||
862 | switch (fh->fmt->depth) { | ||
863 | case 8: | ||
864 | case 24: | ||
865 | btcx_align(&win->w, clips, n, 3); | ||
866 | break; | ||
867 | case 16: | ||
868 | btcx_align(&win->w, clips, n, 1); | ||
869 | break; | ||
870 | case 32: | ||
871 | /* no alignment fixups needed */ | ||
872 | break; | ||
873 | default: | ||
874 | BUG(); | ||
875 | } | ||
876 | |||
877 | down(&fh->vidq.lock); | ||
878 | if (fh->clips) | ||
879 | kfree(fh->clips); | ||
880 | fh->clips = clips; | ||
881 | fh->nclips = n; | ||
882 | fh->win = *win; | ||
883 | #if 0 | ||
884 | fh->ov.setup_ok = 1; | ||
885 | #endif | ||
886 | |||
887 | /* update overlay if needed */ | ||
888 | retval = 0; | ||
889 | #if 0 | ||
890 | if (check_btres(fh, RESOURCE_OVERLAY)) { | ||
891 | struct bttv_buffer *new; | ||
892 | |||
893 | new = videobuf_alloc(sizeof(*new)); | ||
894 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | ||
895 | retval = bttv_switch_overlay(btv,fh,new); | ||
896 | } | ||
897 | #endif | ||
898 | up(&fh->vidq.lock); | ||
899 | return retval; | ||
900 | } | ||
901 | #endif | ||
902 | 671 | ||
903 | /* ------------------------------------------------------------------ */ | 672 | /* ------------------------------------------------------------------ */ |
904 | 673 | ||
@@ -989,10 +758,10 @@ static int video_open(struct inode *inode, struct file *file) | |||
989 | struct cx88_core *core = dev->core; | 758 | struct cx88_core *core = dev->core; |
990 | int board = core->board; | 759 | int board = core->board; |
991 | dprintk(1,"video_open: setting radio device\n"); | 760 | dprintk(1,"video_open: setting radio device\n"); |
761 | cx_write(MO_GP3_IO, cx88_boards[board].radio.gpio3); | ||
992 | cx_write(MO_GP0_IO, cx88_boards[board].radio.gpio0); | 762 | cx_write(MO_GP0_IO, cx88_boards[board].radio.gpio0); |
993 | cx_write(MO_GP1_IO, cx88_boards[board].radio.gpio1); | 763 | cx_write(MO_GP1_IO, cx88_boards[board].radio.gpio1); |
994 | cx_write(MO_GP2_IO, cx88_boards[board].radio.gpio2); | 764 | cx_write(MO_GP2_IO, cx88_boards[board].radio.gpio2); |
995 | cx_write(MO_GP3_IO, cx88_boards[board].radio.gpio3); | ||
996 | dev->core->tvaudio = WW_FM; | 765 | dev->core->tvaudio = WW_FM; |
997 | cx88_set_tvaudio(core); | 766 | cx88_set_tvaudio(core); |
998 | cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); | 767 | cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); |
@@ -1187,9 +956,24 @@ static void init_controls(struct cx8800_dev *dev) | |||
1187 | .id = V4L2_CID_AUDIO_VOLUME, | 956 | .id = V4L2_CID_AUDIO_VOLUME, |
1188 | .value = 0x3f, | 957 | .value = 0x3f, |
1189 | }; | 958 | }; |
959 | static struct v4l2_control hue = { | ||
960 | .id = V4L2_CID_HUE, | ||
961 | .value = 0x80, | ||
962 | }; | ||
963 | static struct v4l2_control contrast = { | ||
964 | .id = V4L2_CID_CONTRAST, | ||
965 | .value = 0x80, | ||
966 | }; | ||
967 | static struct v4l2_control brightness = { | ||
968 | .id = V4L2_CID_BRIGHTNESS, | ||
969 | .value = 0x80, | ||
970 | }; | ||
1190 | 971 | ||
1191 | set_control(dev,&mute); | 972 | set_control(dev,&mute); |
1192 | set_control(dev,&volume); | 973 | set_control(dev,&volume); |
974 | set_control(dev,&hue); | ||
975 | set_control(dev,&contrast); | ||
976 | set_control(dev,&brightness); | ||
1193 | } | 977 | } |
1194 | 978 | ||
1195 | /* ------------------------------------------------------------------ */ | 979 | /* ------------------------------------------------------------------ */ |
@@ -1312,9 +1096,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1312 | struct cx8800_fh *fh = file->private_data; | 1096 | struct cx8800_fh *fh = file->private_data; |
1313 | struct cx8800_dev *dev = fh->dev; | 1097 | struct cx8800_dev *dev = fh->dev; |
1314 | struct cx88_core *core = dev->core; | 1098 | struct cx88_core *core = dev->core; |
1315 | #if 0 | ||
1316 | unsigned long flags; | ||
1317 | #endif | ||
1318 | int err; | 1099 | int err; |
1319 | 1100 | ||
1320 | if (video_debug > 1) | 1101 | if (video_debug > 1) |
@@ -1335,9 +1116,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1335 | V4L2_CAP_READWRITE | | 1116 | V4L2_CAP_READWRITE | |
1336 | V4L2_CAP_STREAMING | | 1117 | V4L2_CAP_STREAMING | |
1337 | V4L2_CAP_VBI_CAPTURE | | 1118 | V4L2_CAP_VBI_CAPTURE | |
1338 | #if 0 | ||
1339 | V4L2_CAP_VIDEO_OVERLAY | | ||
1340 | #endif | ||
1341 | 0; | 1119 | 0; |
1342 | if (UNSET != core->tuner_type) | 1120 | if (UNSET != core->tuner_type) |
1343 | cap->capabilities |= V4L2_CAP_TUNER; | 1121 | cap->capabilities |= V4L2_CAP_TUNER; |
@@ -1438,36 +1216,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1438 | } | 1216 | } |
1439 | 1217 | ||
1440 | 1218 | ||
1441 | #if 0 | ||
1442 | /* needs review */ | ||
1443 | case VIDIOC_G_AUDIO: | ||
1444 | { | ||
1445 | struct v4l2_audio *a = arg; | ||
1446 | unsigned int n = a->index; | ||
1447 | |||
1448 | memset(a,0,sizeof(*a)); | ||
1449 | a->index = n; | ||
1450 | switch (n) { | ||
1451 | case 0: | ||
1452 | if ((CX88_VMUX_TELEVISION == INPUT(n)->type) | ||
1453 | || (CX88_VMUX_CABLE == INPUT(n)->type)) { | ||
1454 | strcpy(a->name,"Television"); | ||
1455 | // FIXME figure out if stereo received and set V4L2_AUDCAP_STEREO. | ||
1456 | return 0; | ||
1457 | } | ||
1458 | break; | ||
1459 | case 1: | ||
1460 | if (CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD == core->board) { | ||
1461 | strcpy(a->name,"Line In"); | ||
1462 | a->capability = V4L2_AUDCAP_STEREO; | ||
1463 | return 0; | ||
1464 | } | ||
1465 | break; | ||
1466 | } | ||
1467 | // Audio input not available. | ||
1468 | return -EINVAL; | ||
1469 | } | ||
1470 | #endif | ||
1471 | 1219 | ||
1472 | /* --- capture ioctls ---------------------------------------- */ | 1220 | /* --- capture ioctls ---------------------------------------- */ |
1473 | case VIDIOC_ENUM_FMT: | 1221 | case VIDIOC_ENUM_FMT: |
@@ -1570,13 +1318,16 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1570 | { | 1318 | { |
1571 | struct v4l2_frequency *f = arg; | 1319 | struct v4l2_frequency *f = arg; |
1572 | 1320 | ||
1321 | memset(f,0,sizeof(*f)); | ||
1322 | |||
1573 | if (UNSET == core->tuner_type) | 1323 | if (UNSET == core->tuner_type) |
1574 | return -EINVAL; | 1324 | return -EINVAL; |
1575 | if (f->tuner != 0) | 1325 | |
1576 | return -EINVAL; | ||
1577 | memset(f,0,sizeof(*f)); | ||
1578 | f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; | 1326 | f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; |
1579 | f->frequency = dev->freq; | 1327 | f->frequency = dev->freq; |
1328 | |||
1329 | cx88_call_i2c_clients(dev->core,VIDIOC_G_FREQUENCY,f); | ||
1330 | |||
1580 | return 0; | 1331 | return 0; |
1581 | } | 1332 | } |
1582 | case VIDIOC_S_FREQUENCY: | 1333 | case VIDIOC_S_FREQUENCY: |
@@ -1594,11 +1345,12 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1594 | down(&dev->lock); | 1345 | down(&dev->lock); |
1595 | dev->freq = f->frequency; | 1346 | dev->freq = f->frequency; |
1596 | cx88_newstation(core); | 1347 | cx88_newstation(core); |
1597 | #ifdef V4L2_I2C_CLIENTS | ||
1598 | cx88_call_i2c_clients(dev->core,VIDIOC_S_FREQUENCY,f); | 1348 | cx88_call_i2c_clients(dev->core,VIDIOC_S_FREQUENCY,f); |
1599 | #else | 1349 | |
1600 | cx88_call_i2c_clients(dev->core,VIDIOCSFREQ,&dev->freq); | 1350 | /* When changing channels it is required to reset TVAUDIO */ |
1601 | #endif | 1351 | msleep (10); |
1352 | cx88_set_tvaudio(core); | ||
1353 | |||
1602 | up(&dev->lock); | 1354 | up(&dev->lock); |
1603 | return 0; | 1355 | return 0; |
1604 | } | 1356 | } |
@@ -1708,19 +1460,8 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
1708 | 1460 | ||
1709 | memset(t,0,sizeof(*t)); | 1461 | memset(t,0,sizeof(*t)); |
1710 | strcpy(t->name, "Radio"); | 1462 | strcpy(t->name, "Radio"); |
1711 | t->rangelow = (int)(65*16); | ||
1712 | t->rangehigh = (int)(108*16); | ||
1713 | 1463 | ||
1714 | #ifdef V4L2_I2C_CLIENTS | ||
1715 | cx88_call_i2c_clients(dev->core,VIDIOC_G_TUNER,t); | 1464 | cx88_call_i2c_clients(dev->core,VIDIOC_G_TUNER,t); |
1716 | #else | ||
1717 | { | ||
1718 | struct video_tuner vt; | ||
1719 | memset(&vt,0,sizeof(vt)); | ||
1720 | cx88_call_i2c_clients(dev,VIDIOCGTUNER,&vt); | ||
1721 | t->signal = vt.signal; | ||
1722 | } | ||
1723 | #endif | ||
1724 | return 0; | 1465 | return 0; |
1725 | } | 1466 | } |
1726 | case VIDIOC_ENUMINPUT: | 1467 | case VIDIOC_ENUMINPUT: |
@@ -1753,8 +1494,29 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
1753 | *id = 0; | 1494 | *id = 0; |
1754 | return 0; | 1495 | return 0; |
1755 | } | 1496 | } |
1756 | case VIDIOC_S_AUDIO: | 1497 | case VIDIOCSTUNER: |
1498 | { | ||
1499 | struct video_tuner *v = arg; | ||
1500 | |||
1501 | if (v->tuner) /* Only tuner 0 */ | ||
1502 | return -EINVAL; | ||
1503 | |||
1504 | cx88_call_i2c_clients(dev->core,VIDIOCSTUNER,v); | ||
1505 | return 0; | ||
1506 | } | ||
1757 | case VIDIOC_S_TUNER: | 1507 | case VIDIOC_S_TUNER: |
1508 | { | ||
1509 | struct v4l2_tuner *t = arg; | ||
1510 | |||
1511 | if (0 != t->index) | ||
1512 | return -EINVAL; | ||
1513 | |||
1514 | cx88_call_i2c_clients(dev->core,VIDIOC_S_TUNER,t); | ||
1515 | |||
1516 | return 0; | ||
1517 | } | ||
1518 | |||
1519 | case VIDIOC_S_AUDIO: | ||
1758 | case VIDIOC_S_INPUT: | 1520 | case VIDIOC_S_INPUT: |
1759 | case VIDIOC_S_STD: | 1521 | case VIDIOC_S_STD: |
1760 | return 0; | 1522 | return 0; |
@@ -1825,6 +1587,14 @@ static void cx8800_vid_timeout(unsigned long data) | |||
1825 | spin_unlock_irqrestore(&dev->slock,flags); | 1587 | spin_unlock_irqrestore(&dev->slock,flags); |
1826 | } | 1588 | } |
1827 | 1589 | ||
1590 | static char *cx88_vid_irqs[32] = { | ||
1591 | "y_risci1", "u_risci1", "v_risci1", "vbi_risc1", | ||
1592 | "y_risci2", "u_risci2", "v_risci2", "vbi_risc2", | ||
1593 | "y_oflow", "u_oflow", "v_oflow", "vbi_oflow", | ||
1594 | "y_sync", "u_sync", "v_sync", "vbi_sync", | ||
1595 | "opc_err", "par_err", "rip_err", "pci_abort", | ||
1596 | }; | ||
1597 | |||
1828 | static void cx8800_vid_irq(struct cx8800_dev *dev) | 1598 | static void cx8800_vid_irq(struct cx8800_dev *dev) |
1829 | { | 1599 | { |
1830 | struct cx88_core *core = dev->core; | 1600 | struct cx88_core *core = dev->core; |
@@ -2065,11 +1835,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
2065 | request_module("tuner"); | 1835 | request_module("tuner"); |
2066 | if (core->tda9887_conf) | 1836 | if (core->tda9887_conf) |
2067 | request_module("tda9887"); | 1837 | request_module("tda9887"); |
2068 | if (core->tuner_type != UNSET) | ||
2069 | cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE,&core->tuner_type); | ||
2070 | if (core->tda9887_conf) | ||
2071 | cx88_call_i2c_clients(dev->core,TDA9887_SET_CONFIG,&core->tda9887_conf); | ||
2072 | |||
2073 | /* register v4l devices */ | 1838 | /* register v4l devices */ |
2074 | dev->video_dev = cx88_vdev_init(core,dev->pci, | 1839 | dev->video_dev = cx88_vdev_init(core,dev->pci, |
2075 | &cx8800_video_template,"video"); | 1840 | &cx8800_video_template,"video"); |
@@ -2162,7 +1927,7 @@ static void __devexit cx8800_finidev(struct pci_dev *pci_dev) | |||
2162 | 1927 | ||
2163 | static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) | 1928 | static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) |
2164 | { | 1929 | { |
2165 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); | 1930 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); |
2166 | struct cx88_core *core = dev->core; | 1931 | struct cx88_core *core = dev->core; |
2167 | 1932 | ||
2168 | /* stop video+vbi capture */ | 1933 | /* stop video+vbi capture */ |
@@ -2179,10 +1944,8 @@ static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
2179 | } | 1944 | } |
2180 | spin_unlock(&dev->slock); | 1945 | spin_unlock(&dev->slock); |
2181 | 1946 | ||
2182 | #if 1 | ||
2183 | /* FIXME -- shutdown device */ | 1947 | /* FIXME -- shutdown device */ |
2184 | cx88_shutdown(dev->core); | 1948 | cx88_shutdown(dev->core); |
2185 | #endif | ||
2186 | 1949 | ||
2187 | pci_save_state(pci_dev); | 1950 | pci_save_state(pci_dev); |
2188 | if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { | 1951 | if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { |
@@ -2194,7 +1957,7 @@ static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
2194 | 1957 | ||
2195 | static int cx8800_resume(struct pci_dev *pci_dev) | 1958 | static int cx8800_resume(struct pci_dev *pci_dev) |
2196 | { | 1959 | { |
2197 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); | 1960 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); |
2198 | struct cx88_core *core = dev->core; | 1961 | struct cx88_core *core = dev->core; |
2199 | 1962 | ||
2200 | if (dev->state.disabled) { | 1963 | if (dev->state.disabled) { |
@@ -2204,10 +1967,8 @@ static int cx8800_resume(struct pci_dev *pci_dev) | |||
2204 | pci_set_power_state(pci_dev, PCI_D0); | 1967 | pci_set_power_state(pci_dev, PCI_D0); |
2205 | pci_restore_state(pci_dev); | 1968 | pci_restore_state(pci_dev); |
2206 | 1969 | ||
2207 | #if 1 | ||
2208 | /* FIXME: re-initialize hardware */ | 1970 | /* FIXME: re-initialize hardware */ |
2209 | cx88_reset(dev->core); | 1971 | cx88_reset(dev->core); |
2210 | #endif | ||
2211 | 1972 | ||
2212 | /* restart video+vbi capture */ | 1973 | /* restart video+vbi capture */ |
2213 | spin_lock(&dev->slock); | 1974 | spin_lock(&dev->slock); |
@@ -2230,8 +1991,8 @@ static struct pci_device_id cx8800_pci_tbl[] = { | |||
2230 | { | 1991 | { |
2231 | .vendor = 0x14f1, | 1992 | .vendor = 0x14f1, |
2232 | .device = 0x8800, | 1993 | .device = 0x8800, |
2233 | .subvendor = PCI_ANY_ID, | 1994 | .subvendor = PCI_ANY_ID, |
2234 | .subdevice = PCI_ANY_ID, | 1995 | .subdevice = PCI_ANY_ID, |
2235 | },{ | 1996 | },{ |
2236 | /* --- end of list --- */ | 1997 | /* --- end of list --- */ |
2237 | } | 1998 | } |
@@ -2239,10 +2000,10 @@ static struct pci_device_id cx8800_pci_tbl[] = { | |||
2239 | MODULE_DEVICE_TABLE(pci, cx8800_pci_tbl); | 2000 | MODULE_DEVICE_TABLE(pci, cx8800_pci_tbl); |
2240 | 2001 | ||
2241 | static struct pci_driver cx8800_pci_driver = { | 2002 | static struct pci_driver cx8800_pci_driver = { |
2242 | .name = "cx8800", | 2003 | .name = "cx8800", |
2243 | .id_table = cx8800_pci_tbl, | 2004 | .id_table = cx8800_pci_tbl, |
2244 | .probe = cx8800_initdev, | 2005 | .probe = cx8800_initdev, |
2245 | .remove = __devexit_p(cx8800_finidev), | 2006 | .remove = __devexit_p(cx8800_finidev), |
2246 | 2007 | ||
2247 | .suspend = cx8800_suspend, | 2008 | .suspend = cx8800_suspend, |
2248 | .resume = cx8800_resume, | 2009 | .resume = cx8800_resume, |
@@ -2274,4 +2035,5 @@ module_exit(cx8800_fini); | |||
2274 | * Local variables: | 2035 | * Local variables: |
2275 | * c-basic-offset: 8 | 2036 | * c-basic-offset: 8 |
2276 | * End: | 2037 | * End: |
2038 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
2277 | */ | 2039 | */ |
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 88eaaaba5ad8..da65dc92787c 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88.h,v 1.56 2005/03/04 09:12:23 kraxel Exp $ | 2 | * $Id: cx88.h,v 1.70 2005/07/24 17:44:09 mkrufky Exp $ |
3 | * | 3 | * |
4 | * v4l2 device driver for cx2388x based TV cards | 4 | * v4l2 device driver for cx2388x based TV cards |
5 | * | 5 | * |
@@ -35,8 +35,8 @@ | |||
35 | #include "btcx-risc.h" | 35 | #include "btcx-risc.h" |
36 | #include "cx88-reg.h" | 36 | #include "cx88-reg.h" |
37 | 37 | ||
38 | #include <linux/version.h> | 38 | #include <linux/utsname.h> |
39 | #define CX88_VERSION_CODE KERNEL_VERSION(0,0,4) | 39 | #define CX88_VERSION_CODE KERNEL_VERSION(0,0,5) |
40 | 40 | ||
41 | #ifndef TRUE | 41 | #ifndef TRUE |
42 | # define TRUE (1==1) | 42 | # define TRUE (1==1) |
@@ -51,8 +51,6 @@ | |||
51 | /* ----------------------------------------------------------- */ | 51 | /* ----------------------------------------------------------- */ |
52 | /* defines and enums */ | 52 | /* defines and enums */ |
53 | 53 | ||
54 | #define V4L2_I2C_CLIENTS 1 | ||
55 | |||
56 | #define FORMAT_FLAGS_PACKED 0x01 | 54 | #define FORMAT_FLAGS_PACKED 0x01 |
57 | #define FORMAT_FLAGS_PLANAR 0x02 | 55 | #define FORMAT_FLAGS_PLANAR 0x02 |
58 | 56 | ||
@@ -64,6 +62,13 @@ | |||
64 | #define SHADOW_AUD_BAL_CTL 2 | 62 | #define SHADOW_AUD_BAL_CTL 2 |
65 | #define SHADOW_MAX 2 | 63 | #define SHADOW_MAX 2 |
66 | 64 | ||
65 | /* FM Radio deemphasis type */ | ||
66 | enum cx88_deemph_type { | ||
67 | FM_NO_DEEMPH = 0, | ||
68 | FM_DEEMPH_50, | ||
69 | FM_DEEMPH_75 | ||
70 | }; | ||
71 | |||
67 | /* ----------------------------------------------------------- */ | 72 | /* ----------------------------------------------------------- */ |
68 | /* tv norms */ | 73 | /* tv norms */ |
69 | 74 | ||
@@ -77,9 +82,9 @@ struct cx88_tvnorm { | |||
77 | static unsigned int inline norm_maxw(struct cx88_tvnorm *norm) | 82 | static unsigned int inline norm_maxw(struct cx88_tvnorm *norm) |
78 | { | 83 | { |
79 | return (norm->id & V4L2_STD_625_50) ? 768 : 640; | 84 | return (norm->id & V4L2_STD_625_50) ? 768 : 640; |
80 | // return (norm->id & V4L2_STD_625_50) ? 720 : 640; | ||
81 | } | 85 | } |
82 | 86 | ||
87 | |||
83 | static unsigned int inline norm_maxh(struct cx88_tvnorm *norm) | 88 | static unsigned int inline norm_maxh(struct cx88_tvnorm *norm) |
84 | { | 89 | { |
85 | return (norm->id & V4L2_STD_625_50) ? 576 : 480; | 90 | return (norm->id & V4L2_STD_625_50) ? 576 : 480; |
@@ -152,7 +157,7 @@ extern struct sram_channel cx88_sram_channels[]; | |||
152 | #define CX88_BOARD_KWORLD_DVB_T 14 | 157 | #define CX88_BOARD_KWORLD_DVB_T 14 |
153 | #define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1 15 | 158 | #define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1 15 |
154 | #define CX88_BOARD_KWORLD_LTV883 16 | 159 | #define CX88_BOARD_KWORLD_LTV883 16 |
155 | #define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD 17 | 160 | #define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q 17 |
156 | #define CX88_BOARD_HAUPPAUGE_DVB_T1 18 | 161 | #define CX88_BOARD_HAUPPAUGE_DVB_T1 18 |
157 | #define CX88_BOARD_CONEXANT_DVB_T1 19 | 162 | #define CX88_BOARD_CONEXANT_DVB_T1 19 |
158 | #define CX88_BOARD_PROVIDEO_PV259 20 | 163 | #define CX88_BOARD_PROVIDEO_PV259 20 |
@@ -160,8 +165,13 @@ extern struct sram_channel cx88_sram_channels[]; | |||
160 | #define CX88_BOARD_PCHDTV_HD3000 22 | 165 | #define CX88_BOARD_PCHDTV_HD3000 22 |
161 | #define CX88_BOARD_DNTV_LIVE_DVB_T 23 | 166 | #define CX88_BOARD_DNTV_LIVE_DVB_T 23 |
162 | #define CX88_BOARD_HAUPPAUGE_ROSLYN 24 | 167 | #define CX88_BOARD_HAUPPAUGE_ROSLYN 24 |
163 | #define CX88_BOARD_DIGITALLOGIC_MEC 25 | 168 | #define CX88_BOARD_DIGITALLOGIC_MEC 25 |
164 | #define CX88_BOARD_IODATA_GVBCTV7E 26 | 169 | #define CX88_BOARD_IODATA_GVBCTV7E 26 |
170 | #define CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO 27 | ||
171 | #define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T 28 | ||
172 | #define CX88_BOARD_ADSTECH_DVB_T_PCI 29 | ||
173 | #define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1 30 | ||
174 | #define CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD 31 | ||
165 | 175 | ||
166 | enum cx88_itype { | 176 | enum cx88_itype { |
167 | CX88_VMUX_COMPOSITE1 = 1, | 177 | CX88_VMUX_COMPOSITE1 = 1, |
@@ -185,6 +195,9 @@ struct cx88_input { | |||
185 | struct cx88_board { | 195 | struct cx88_board { |
186 | char *name; | 196 | char *name; |
187 | unsigned int tuner_type; | 197 | unsigned int tuner_type; |
198 | unsigned int radio_type; | ||
199 | unsigned char tuner_addr; | ||
200 | unsigned char radio_addr; | ||
188 | int tda9887_conf; | 201 | int tda9887_conf; |
189 | struct cx88_input input[8]; | 202 | struct cx88_input input[8]; |
190 | struct cx88_input radio; | 203 | struct cx88_input radio; |
@@ -208,7 +221,6 @@ struct cx88_subid { | |||
208 | #define RESOURCE_VBI 4 | 221 | #define RESOURCE_VBI 4 |
209 | 222 | ||
210 | #define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ | 223 | #define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ |
211 | //#define BUFFER_TIMEOUT (HZ*2) | ||
212 | 224 | ||
213 | /* buffer for one video frame */ | 225 | /* buffer for one video frame */ |
214 | struct cx88_buffer { | 226 | struct cx88_buffer { |
@@ -255,6 +267,9 @@ struct cx88_core { | |||
255 | /* config info -- analog */ | 267 | /* config info -- analog */ |
256 | unsigned int board; | 268 | unsigned int board; |
257 | unsigned int tuner_type; | 269 | unsigned int tuner_type; |
270 | unsigned int radio_type; | ||
271 | unsigned char tuner_addr; | ||
272 | unsigned char radio_addr; | ||
258 | unsigned int tda9887_conf; | 273 | unsigned int tda9887_conf; |
259 | unsigned int has_radio; | 274 | unsigned int has_radio; |
260 | 275 | ||
@@ -321,11 +336,6 @@ struct cx8800_dev { | |||
321 | struct pci_dev *pci; | 336 | struct pci_dev *pci; |
322 | unsigned char pci_rev,pci_lat; | 337 | unsigned char pci_rev,pci_lat; |
323 | 338 | ||
324 | #if 0 | ||
325 | /* video overlay */ | ||
326 | struct v4l2_framebuffer fbuf; | ||
327 | struct cx88_buffer *screen; | ||
328 | #endif | ||
329 | 339 | ||
330 | /* capture queues */ | 340 | /* capture queues */ |
331 | struct cx88_dmaqueue vidq; | 341 | struct cx88_dmaqueue vidq; |
@@ -420,8 +430,6 @@ struct cx8802_dev { | |||
420 | /* ----------------------------------------------------------- */ | 430 | /* ----------------------------------------------------------- */ |
421 | /* cx88-core.c */ | 431 | /* cx88-core.c */ |
422 | 432 | ||
423 | extern char *cx88_vid_irqs[32]; | ||
424 | extern char *cx88_mpeg_irqs[32]; | ||
425 | extern void cx88_print_irqbits(char *name, char *tag, char **strings, | 433 | extern void cx88_print_irqbits(char *name, char *tag, char **strings, |
426 | u32 bits, u32 mask); | 434 | u32 bits, u32 mask); |
427 | extern void cx88_print_ioctl(char *name, unsigned int cmd); | 435 | extern void cx88_print_ioctl(char *name, unsigned int cmd); |
@@ -471,6 +479,11 @@ extern void cx88_core_put(struct cx88_core *core, | |||
471 | /* cx88-vbi.c */ | 479 | /* cx88-vbi.c */ |
472 | 480 | ||
473 | void cx8800_vbi_fmt(struct cx8800_dev *dev, struct v4l2_format *f); | 481 | void cx8800_vbi_fmt(struct cx8800_dev *dev, struct v4l2_format *f); |
482 | /* | ||
483 | int cx8800_start_vbi_dma(struct cx8800_dev *dev, | ||
484 | struct cx88_dmaqueue *q, | ||
485 | struct cx88_buffer *buf); | ||
486 | */ | ||
474 | int cx8800_stop_vbi_dma(struct cx8800_dev *dev); | 487 | int cx8800_stop_vbi_dma(struct cx8800_dev *dev); |
475 | int cx8800_restart_vbi_queue(struct cx8800_dev *dev, | 488 | int cx8800_restart_vbi_queue(struct cx8800_dev *dev, |
476 | struct cx88_dmaqueue *q); | 489 | struct cx88_dmaqueue *q); |
diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c index ab6620de4b3b..a565823330aa 100644 --- a/drivers/media/video/ir-kbd-gpio.c +++ b/drivers/media/video/ir-kbd-gpio.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ir-kbd-gpio.c,v 1.12 2005/02/22 12:28:40 kraxel Exp $ | 2 | * $Id: ir-kbd-gpio.c,v 1.13 2005/05/15 19:01:26 mchehab Exp $ |
3 | * | 3 | * |
4 | * Copyright (c) 2003 Gerd Knorr | 4 | * Copyright (c) 2003 Gerd Knorr |
5 | * Copyright (c) 2003 Pavel Machek | 5 | * Copyright (c) 2003 Pavel Machek |
@@ -114,38 +114,6 @@ static IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE] = { | |||
114 | [ 0x3e ] = KEY_VOLUMEUP, // 'volume +' | 114 | [ 0x3e ] = KEY_VOLUMEUP, // 'volume +' |
115 | }; | 115 | }; |
116 | 116 | ||
117 | static IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE] = { | ||
118 | [ 2 ] = KEY_KP0, | ||
119 | [ 1 ] = KEY_KP1, | ||
120 | [ 11 ] = KEY_KP2, | ||
121 | [ 27 ] = KEY_KP3, | ||
122 | [ 5 ] = KEY_KP4, | ||
123 | [ 9 ] = KEY_KP5, | ||
124 | [ 21 ] = KEY_KP6, | ||
125 | [ 6 ] = KEY_KP7, | ||
126 | [ 10 ] = KEY_KP8, | ||
127 | [ 18 ] = KEY_KP9, | ||
128 | |||
129 | [ 3 ] = KEY_TUNER, // TV/FM | ||
130 | [ 7 ] = KEY_SEARCH, // scan | ||
131 | [ 28 ] = KEY_ZOOM, // full screen | ||
132 | [ 30 ] = KEY_POWER, | ||
133 | [ 23 ] = KEY_VOLUMEDOWN, | ||
134 | [ 31 ] = KEY_VOLUMEUP, | ||
135 | [ 20 ] = KEY_CHANNELDOWN, | ||
136 | [ 22 ] = KEY_CHANNELUP, | ||
137 | [ 24 ] = KEY_MUTE, | ||
138 | |||
139 | [ 0 ] = KEY_LIST, // source | ||
140 | [ 19 ] = KEY_INFO, // loop | ||
141 | [ 16 ] = KEY_LAST, // +100 | ||
142 | [ 13 ] = KEY_CLEAR, // reset | ||
143 | [ 12 ] = BTN_RIGHT, // fun++ | ||
144 | [ 4 ] = BTN_LEFT, // fun-- | ||
145 | [ 14 ] = KEY_GOTO, // function | ||
146 | [ 15 ] = KEY_STOP, // freeze | ||
147 | }; | ||
148 | |||
149 | /* Attila Kondoros <attila.kondoros@chello.hu> */ | 117 | /* Attila Kondoros <attila.kondoros@chello.hu> */ |
150 | static IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE] = { | 118 | static IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE] = { |
151 | 119 | ||
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 92664f75d327..9fc5055e001c 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ir-kbd-i2c.c,v 1.10 2004/12/09 12:51:35 kraxel Exp $ | 2 | * $Id: ir-kbd-i2c.c,v 1.11 2005/07/07 16:42:11 mchehab Exp $ |
3 | * | 3 | * |
4 | * keyboard input driver for i2c IR remote controls | 4 | * keyboard input driver for i2c IR remote controls |
5 | * | 5 | * |
@@ -66,26 +66,26 @@ static IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE] = { | |||
66 | [ 29 ] = KEY_PAGEDOWN, | 66 | [ 29 ] = KEY_PAGEDOWN, |
67 | [ 19 ] = KEY_SOUND, | 67 | [ 19 ] = KEY_SOUND, |
68 | 68 | ||
69 | [ 24 ] = KEY_KPPLUSMINUS, // CH +/- | 69 | [ 24 ] = KEY_KPPLUSMINUS, /* CH +/- */ |
70 | [ 22 ] = KEY_SUBTITLE, // CC | 70 | [ 22 ] = KEY_SUBTITLE, /* CC */ |
71 | [ 13 ] = KEY_TEXT, // TTX | 71 | [ 13 ] = KEY_TEXT, /* TTX */ |
72 | [ 11 ] = KEY_TV, // AIR/CBL | 72 | [ 11 ] = KEY_TV, /* AIR/CBL */ |
73 | [ 17 ] = KEY_PC, // PC/TV | 73 | [ 17 ] = KEY_PC, /* PC/TV */ |
74 | [ 23 ] = KEY_OK, // CH RTN | 74 | [ 23 ] = KEY_OK, /* CH RTN */ |
75 | [ 25 ] = KEY_MODE, // FUNC | 75 | [ 25 ] = KEY_MODE, /* FUNC */ |
76 | [ 12 ] = KEY_SEARCH, // AUTOSCAN | 76 | [ 12 ] = KEY_SEARCH, /* AUTOSCAN */ |
77 | 77 | ||
78 | /* Not sure what to do with these ones! */ | 78 | /* Not sure what to do with these ones! */ |
79 | [ 15 ] = KEY_SELECT, // SOURCE | 79 | [ 15 ] = KEY_SELECT, /* SOURCE */ |
80 | [ 10 ] = KEY_KPPLUS, // +100 | 80 | [ 10 ] = KEY_KPPLUS, /* +100 */ |
81 | [ 20 ] = KEY_KPEQUAL, // SYNC | 81 | [ 20 ] = KEY_KPEQUAL, /* SYNC */ |
82 | [ 28 ] = KEY_MEDIA, // PC/TV | 82 | [ 28 ] = KEY_MEDIA, /* PC/TV */ |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { | 85 | static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { |
86 | [ 0x3 ] = KEY_POWER, | 86 | [ 0x3 ] = KEY_POWER, |
87 | [ 0x6f ] = KEY_MUTE, | 87 | [ 0x6f ] = KEY_MUTE, |
88 | [ 0x10 ] = KEY_BACKSPACE, // Recall | 88 | [ 0x10 ] = KEY_BACKSPACE, /* Recall */ |
89 | 89 | ||
90 | [ 0x11 ] = KEY_KP0, | 90 | [ 0x11 ] = KEY_KP0, |
91 | [ 0x4 ] = KEY_KP1, | 91 | [ 0x4 ] = KEY_KP1, |
@@ -97,7 +97,7 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { | |||
97 | [ 0xc ] = KEY_KP7, | 97 | [ 0xc ] = KEY_KP7, |
98 | [ 0xd ] = KEY_KP8, | 98 | [ 0xd ] = KEY_KP8, |
99 | [ 0xe ] = KEY_KP9, | 99 | [ 0xe ] = KEY_KP9, |
100 | [ 0x12 ] = KEY_KPDOT, // 100+ | 100 | [ 0x12 ] = KEY_KPDOT, /* 100+ */ |
101 | 101 | ||
102 | [ 0x7 ] = KEY_VOLUMEUP, | 102 | [ 0x7 ] = KEY_VOLUMEUP, |
103 | [ 0xb ] = KEY_VOLUMEDOWN, | 103 | [ 0xb ] = KEY_VOLUMEDOWN, |
@@ -109,25 +109,16 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { | |||
109 | [ 0x13 ] = KEY_CHANNELDOWN, | 109 | [ 0x13 ] = KEY_CHANNELDOWN, |
110 | [ 0x48 ] = KEY_ZOOM, | 110 | [ 0x48 ] = KEY_ZOOM, |
111 | 111 | ||
112 | [ 0x1b ] = KEY_VIDEO, // Video source | 112 | [ 0x1b ] = KEY_VIDEO, /* Video source */ |
113 | #if 0 | 113 | [ 0x49 ] = KEY_LANGUAGE, /* MTS Select */ |
114 | [ 0x1f ] = KEY_S, // Snapshot | 114 | [ 0x19 ] = KEY_SEARCH, /* Auto Scan */ |
115 | #endif | ||
116 | [ 0x49 ] = KEY_LANGUAGE, // MTS Select | ||
117 | [ 0x19 ] = KEY_SEARCH, // Auto Scan | ||
118 | 115 | ||
119 | [ 0x4b ] = KEY_RECORD, | 116 | [ 0x4b ] = KEY_RECORD, |
120 | [ 0x46 ] = KEY_PLAY, | 117 | [ 0x46 ] = KEY_PLAY, |
121 | [ 0x45 ] = KEY_PAUSE, // Pause | 118 | [ 0x45 ] = KEY_PAUSE, /* Pause */ |
122 | [ 0x44 ] = KEY_STOP, | 119 | [ 0x44 ] = KEY_STOP, |
123 | #if 0 | 120 | [ 0x40 ] = KEY_FORWARD, /* Forward ? */ |
124 | [ 0x43 ] = KEY_T, // Time Shift | 121 | [ 0x42 ] = KEY_REWIND, /* Backward ? */ |
125 | [ 0x47 ] = KEY_Y, // Time Shift OFF | ||
126 | [ 0x4a ] = KEY_O, // TOP | ||
127 | [ 0x17 ] = KEY_F, // SURF CH | ||
128 | #endif | ||
129 | [ 0x40 ] = KEY_FORWARD, // Forward ? | ||
130 | [ 0x42 ] = KEY_REWIND, // Backward ? | ||
131 | 122 | ||
132 | }; | 123 | }; |
133 | 124 | ||
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 7fbb8581a87d..62f1b8ddb98b 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c | |||
@@ -147,7 +147,6 @@ static unsigned short normal_i2c[] = { | |||
147 | I2C_MSP3400C_ALT >> 1, | 147 | I2C_MSP3400C_ALT >> 1, |
148 | I2C_CLIENT_END | 148 | I2C_CLIENT_END |
149 | }; | 149 | }; |
150 | static unsigned short normal_i2c_range[] = {I2C_CLIENT_END,I2C_CLIENT_END}; | ||
151 | I2C_CLIENT_INSMOD; | 150 | I2C_CLIENT_INSMOD; |
152 | 151 | ||
153 | /* ----------------------------------------------------------------------- */ | 152 | /* ----------------------------------------------------------------------- */ |
@@ -568,10 +567,6 @@ static void msp3400c_set_audmode(struct i2c_client *client, int audmode) | |||
568 | switch (audmode) { | 567 | switch (audmode) { |
569 | case V4L2_TUNER_MODE_STEREO: | 568 | case V4L2_TUNER_MODE_STEREO: |
570 | src = 0x0020 | nicam; | 569 | src = 0x0020 | nicam; |
571 | #if 0 | ||
572 | /* spatial effect */ | ||
573 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x0005,0x4000); | ||
574 | #endif | ||
575 | break; | 570 | break; |
576 | case V4L2_TUNER_MODE_MONO: | 571 | case V4L2_TUNER_MODE_MONO: |
577 | if (msp->mode == MSP_MODE_AM_NICAM) { | 572 | if (msp->mode == MSP_MODE_AM_NICAM) { |
@@ -736,28 +731,19 @@ static int msp34xx_sleep(struct msp3400c *msp, int timeout) | |||
736 | { | 731 | { |
737 | DECLARE_WAITQUEUE(wait, current); | 732 | DECLARE_WAITQUEUE(wait, current); |
738 | 733 | ||
739 | again: | ||
740 | add_wait_queue(&msp->wq, &wait); | 734 | add_wait_queue(&msp->wq, &wait); |
741 | if (!kthread_should_stop()) { | 735 | if (!kthread_should_stop()) { |
742 | if (timeout < 0) { | 736 | if (timeout < 0) { |
743 | set_current_state(TASK_INTERRUPTIBLE); | 737 | set_current_state(TASK_INTERRUPTIBLE); |
744 | schedule(); | 738 | schedule(); |
745 | } else { | 739 | } else { |
746 | #if 0 | ||
747 | /* hmm, that one doesn't return on wakeup ... */ | ||
748 | msleep_interruptible(timeout); | ||
749 | #else | ||
750 | set_current_state(TASK_INTERRUPTIBLE); | 740 | set_current_state(TASK_INTERRUPTIBLE); |
751 | schedule_timeout(msecs_to_jiffies(timeout)); | 741 | schedule_timeout(msecs_to_jiffies(timeout)); |
752 | #endif | ||
753 | } | 742 | } |
754 | } | 743 | } |
755 | 744 | ||
756 | remove_wait_queue(&msp->wq, &wait); | 745 | remove_wait_queue(&msp->wq, &wait); |
757 | 746 | try_to_freeze(); | |
758 | if (try_to_freeze(PF_FREEZE)) | ||
759 | goto again; | ||
760 | |||
761 | return msp->restart; | 747 | return msp->restart; |
762 | } | 748 | } |
763 | 749 | ||
@@ -1160,17 +1146,10 @@ static int msp3410d_thread(void *data) | |||
1160 | MSP_CARRIER(10.7)); | 1146 | MSP_CARRIER(10.7)); |
1161 | /* scart routing */ | 1147 | /* scart routing */ |
1162 | msp3400c_set_scart(client,SCART_IN2,0); | 1148 | msp3400c_set_scart(client,SCART_IN2,0); |
1163 | #if 0 | ||
1164 | /* radio from SCART_IN2 */ | ||
1165 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x08, 0x0220); | ||
1166 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x09, 0x0220); | ||
1167 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x0b, 0x0220); | ||
1168 | #else | ||
1169 | /* msp34xx does radio decoding */ | 1149 | /* msp34xx does radio decoding */ |
1170 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x08, 0x0020); | 1150 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x08, 0x0020); |
1171 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x09, 0x0020); | 1151 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x09, 0x0020); |
1172 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x0b, 0x0020); | 1152 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x0b, 0x0020); |
1173 | #endif | ||
1174 | break; | 1153 | break; |
1175 | case 0x0003: | 1154 | case 0x0003: |
1176 | case 0x0004: | 1155 | case 0x0004: |
@@ -1437,7 +1416,7 @@ static int msp_detach(struct i2c_client *client); | |||
1437 | static int msp_probe(struct i2c_adapter *adap); | 1416 | static int msp_probe(struct i2c_adapter *adap); |
1438 | static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg); | 1417 | static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg); |
1439 | 1418 | ||
1440 | static int msp_suspend(struct device * dev, pm_message_t state, u32 level); | 1419 | static int msp_suspend(struct device * dev, u32 state, u32 level); |
1441 | static int msp_resume(struct device * dev, u32 level); | 1420 | static int msp_resume(struct device * dev, u32 level); |
1442 | 1421 | ||
1443 | static void msp_wake_thread(struct i2c_client *client); | 1422 | static void msp_wake_thread(struct i2c_client *client); |
@@ -1513,10 +1492,6 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) | |||
1513 | return -1; | 1492 | return -1; |
1514 | } | 1493 | } |
1515 | 1494 | ||
1516 | #if 0 | ||
1517 | /* this will turn on a 1kHz beep - might be useful for debugging... */ | ||
1518 | msp3400c_write(c,I2C_MSP3400C_DFP, 0x0014, 0x1040); | ||
1519 | #endif | ||
1520 | msp3400c_setvolume(c, msp->muted, msp->volume, msp->balance); | 1495 | msp3400c_setvolume(c, msp->muted, msp->volume, msp->balance); |
1521 | 1496 | ||
1522 | snprintf(c->name, sizeof(c->name), "MSP34%02d%c-%c%d", | 1497 | snprintf(c->name, sizeof(c->name), "MSP34%02d%c-%c%d", |
@@ -1842,7 +1817,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
1842 | return 0; | 1817 | return 0; |
1843 | } | 1818 | } |
1844 | 1819 | ||
1845 | static int msp_suspend(struct device * dev, pm_message_t state, u32 level) | 1820 | static int msp_suspend(struct device * dev, u32 state, u32 level) |
1846 | { | 1821 | { |
1847 | struct i2c_client *c = container_of(dev, struct i2c_client, dev); | 1822 | struct i2c_client *c = container_of(dev, struct i2c_client, dev); |
1848 | 1823 | ||
diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400.h index d70a954e13aa..023f33056a4f 100644 --- a/drivers/media/video/msp3400.h +++ b/drivers/media/video/msp3400.h | |||
@@ -1,3 +1,7 @@ | |||
1 | /* | ||
2 | * $Id: msp3400.h,v 1.3 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | ||
4 | |||
1 | #ifndef MSP3400_H | 5 | #ifndef MSP3400_H |
2 | #define MSP3400_H | 6 | #define MSP3400_H |
3 | 7 | ||
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c index 95ad17b7f38e..2fb7c2d1787a 100644 --- a/drivers/media/video/mt20xx.c +++ b/drivers/media/video/mt20xx.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: mt20xx.c,v 1.4 2005/03/04 09:24:56 kraxel Exp $ | 2 | * $Id: mt20xx.c,v 1.5 2005/06/16 08:29:49 nsh Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * controls microtune tuners, mt2032 + mt2050 at the moment. | 5 | * controls microtune tuners, mt2032 + mt2050 at the moment. |
@@ -295,8 +295,8 @@ static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
295 | int if2 = t->radio_if2; | 295 | int if2 = t->radio_if2; |
296 | 296 | ||
297 | // per Manual for FM tuning: first if center freq. 1085 MHz | 297 | // per Manual for FM tuning: first if center freq. 1085 MHz |
298 | mt2032_set_if_freq(c, freq*62500 /* freq*1000*1000/16 */, | 298 | mt2032_set_if_freq(c, freq * 1000 / 16, |
299 | 1085*1000*1000,if2,if2,if2); | 299 | 1085*1000*1000,if2,if2,if2); |
300 | } | 300 | } |
301 | 301 | ||
302 | // Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001 | 302 | // Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001 |
@@ -511,22 +511,6 @@ int microtune_init(struct i2c_client *c) | |||
511 | tuner_info("microtune: companycode=%04x part=%02x rev=%02x\n", | 511 | tuner_info("microtune: companycode=%04x part=%02x rev=%02x\n", |
512 | company_code,buf[0x13],buf[0x14]); | 512 | company_code,buf[0x13],buf[0x14]); |
513 | 513 | ||
514 | #if 0 | ||
515 | /* seems to cause more problems than it solves ... */ | ||
516 | switch (company_code) { | ||
517 | case 0x30bf: | ||
518 | case 0x3cbf: | ||
519 | case 0x3dbf: | ||
520 | case 0x4d54: | ||
521 | case 0x8e81: | ||
522 | case 0x8e91: | ||
523 | /* ok (?) */ | ||
524 | break; | ||
525 | default: | ||
526 | tuner_warn("tuner: microtune: unknown companycode\n"); | ||
527 | return 0; | ||
528 | } | ||
529 | #endif | ||
530 | 514 | ||
531 | if (buf[0x13] < ARRAY_SIZE(microtune_part) && | 515 | if (buf[0x13] < ARRAY_SIZE(microtune_part) && |
532 | NULL != microtune_part[buf[0x13]]) | 516 | NULL != microtune_part[buf[0x13]]) |
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index 70bf1f1fad59..d04793fb80fc 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c | |||
@@ -142,8 +142,8 @@ struct mxb | |||
142 | 142 | ||
143 | int cur_mode; /* current audio mode (mono, stereo, ...) */ | 143 | int cur_mode; /* current audio mode (mono, stereo, ...) */ |
144 | int cur_input; /* current input */ | 144 | int cur_input; /* current input */ |
145 | int cur_freq; /* current frequency the tuner is tuned to */ | ||
146 | int cur_mute; /* current mute status */ | 145 | int cur_mute; /* current mute status */ |
146 | struct v4l2_frequency cur_freq; /* current frequency the tuner is tuned to */ | ||
147 | }; | 147 | }; |
148 | 148 | ||
149 | static struct saa7146_extension extension; | 149 | static struct saa7146_extension extension; |
@@ -326,6 +326,7 @@ static int mxb_init_done(struct saa7146_dev* dev) | |||
326 | struct mxb* mxb = (struct mxb*)dev->ext_priv; | 326 | struct mxb* mxb = (struct mxb*)dev->ext_priv; |
327 | struct video_decoder_init init; | 327 | struct video_decoder_init init; |
328 | struct i2c_msg msg; | 328 | struct i2c_msg msg; |
329 | struct tuner_setup tun_setup; | ||
329 | 330 | ||
330 | int i = 0, err = 0; | 331 | int i = 0, err = 0; |
331 | struct tea6415c_multiplex vm; | 332 | struct tea6415c_multiplex vm; |
@@ -349,9 +350,17 @@ static int mxb_init_done(struct saa7146_dev* dev) | |||
349 | mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_VBI_BYPASS, &i); | 350 | mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_VBI_BYPASS, &i); |
350 | 351 | ||
351 | /* select a tuner type */ | 352 | /* select a tuner type */ |
352 | i = 5; | 353 | tun_setup.mode_mask = T_ANALOG_TV; |
353 | mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE, &i); | 354 | tun_setup.addr = ADDR_UNSET; |
354 | 355 | tun_setup.type = TUNER_PHILIPS_PAL; | |
356 | mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE_ADDR, &tun_setup); | ||
357 | /* tune in some frequency on tuner */ | ||
358 | mxb->cur_freq.tuner = 0; | ||
359 | mxb->cur_freq.type = V4L2_TUNER_ANALOG_TV; | ||
360 | mxb->cur_freq.frequency = freq; | ||
361 | mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_FREQUENCY, | ||
362 | &mxb->cur_freq); | ||
363 | |||
355 | /* mute audio on tea6420s */ | 364 | /* mute audio on tea6420s */ |
356 | mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]); | 365 | mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]); |
357 | mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]); | 366 | mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]); |
@@ -368,12 +377,8 @@ static int mxb_init_done(struct saa7146_dev* dev) | |||
368 | vm.out = 13; | 377 | vm.out = 13; |
369 | mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm); | 378 | mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm); |
370 | 379 | ||
371 | /* tune in some frequency on tuner */ | ||
372 | mxb->tuner->driver->command(mxb->tuner, VIDIOCSFREQ, &freq); | ||
373 | |||
374 | /* the rest for mxb */ | 380 | /* the rest for mxb */ |
375 | mxb->cur_input = 0; | 381 | mxb->cur_input = 0; |
376 | mxb->cur_freq = freq; | ||
377 | mxb->cur_mute = 1; | 382 | mxb->cur_mute = 1; |
378 | 383 | ||
379 | mxb->cur_mode = V4L2_TUNER_MODE_STEREO; | 384 | mxb->cur_mode = V4L2_TUNER_MODE_STEREO; |
@@ -816,18 +821,14 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
816 | return -EINVAL; | 821 | return -EINVAL; |
817 | } | 822 | } |
818 | 823 | ||
819 | memset(f,0,sizeof(*f)); | 824 | *f = mxb->cur_freq; |
820 | f->type = V4L2_TUNER_ANALOG_TV; | ||
821 | f->frequency = mxb->cur_freq; | ||
822 | 825 | ||
823 | DEB_EE(("VIDIOC_G_FREQ: freq:0x%08x.\n", mxb->cur_freq)); | 826 | DEB_EE(("VIDIOC_G_FREQ: freq:0x%08x.\n", mxb->cur_freq.frequency)); |
824 | return 0; | 827 | return 0; |
825 | } | 828 | } |
826 | case VIDIOC_S_FREQUENCY: | 829 | case VIDIOC_S_FREQUENCY: |
827 | { | 830 | { |
828 | struct v4l2_frequency *f = arg; | 831 | struct v4l2_frequency *f = arg; |
829 | int t_locked = 0; | ||
830 | int v_byte = 0; | ||
831 | 832 | ||
832 | if (0 != f->tuner) | 833 | if (0 != f->tuner) |
833 | return -EINVAL; | 834 | return -EINVAL; |
@@ -840,20 +841,11 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
840 | return -EINVAL; | 841 | return -EINVAL; |
841 | } | 842 | } |
842 | 843 | ||
843 | DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n",f->frequency)); | 844 | mxb->cur_freq = *f; |
844 | 845 | DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n", mxb->cur_freq.frequency)); | |
845 | mxb->cur_freq = f->frequency; | ||
846 | 846 | ||
847 | /* tune in desired frequency */ | 847 | /* tune in desired frequency */ |
848 | mxb->tuner->driver->command(mxb->tuner, VIDIOCSFREQ, &mxb->cur_freq); | 848 | mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_FREQUENCY, &mxb->cur_freq); |
849 | |||
850 | /* check if pll of tuner & saa7111a is locked */ | ||
851 | // mxb->tuner->driver->command(mxb->tuner,TUNER_IS_LOCKED, &t_locked); | ||
852 | mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_GET_STATUS, &v_byte); | ||
853 | |||
854 | /* not locked -- anything to do here ? */ | ||
855 | if( 0 == t_locked || 0 == (v_byte & DECODER_STATUS_GOOD)) { | ||
856 | } | ||
857 | 849 | ||
858 | /* hack: changing the frequency should invalidate the vbi-counter (=> alevt) */ | 850 | /* hack: changing the frequency should invalidate the vbi-counter (=> alevt) */ |
859 | spin_lock(&dev->slock); | 851 | spin_lock(&dev->slock); |
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c index ba69f09cbdd1..b8054da31ffd 100644 --- a/drivers/media/video/saa5246a.c +++ b/drivers/media/video/saa5246a.c | |||
@@ -64,7 +64,6 @@ static struct video_device saa_template; /* Declared near bottom */ | |||
64 | 64 | ||
65 | /* Addresses to scan */ | 65 | /* Addresses to scan */ |
66 | static unsigned short normal_i2c[] = { I2C_ADDRESS, I2C_CLIENT_END }; | 66 | static unsigned short normal_i2c[] = { I2C_ADDRESS, I2C_CLIENT_END }; |
67 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | ||
68 | I2C_CLIENT_INSMOD; | 67 | I2C_CLIENT_INSMOD; |
69 | 68 | ||
70 | static struct i2c_client client_template; | 69 | static struct i2c_client client_template; |
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index d74caa139f0a..7ffa2e9a9bf3 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c | |||
@@ -132,7 +132,6 @@ static struct video_device saa_template; /* Declared near bottom */ | |||
132 | 132 | ||
133 | /* Addresses to scan */ | 133 | /* Addresses to scan */ |
134 | static unsigned short normal_i2c[] = {34>>1,I2C_CLIENT_END}; | 134 | static unsigned short normal_i2c[] = {34>>1,I2C_CLIENT_END}; |
135 | static unsigned short normal_i2c_range[] = {I2C_CLIENT_END}; | ||
136 | I2C_CLIENT_INSMOD; | 135 | I2C_CLIENT_INSMOD; |
137 | 136 | ||
138 | static struct i2c_client client_template; | 137 | static struct i2c_client client_template; |
diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index 64273b438530..22d055d8a695 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c | |||
@@ -463,22 +463,14 @@ static unsigned short normal_i2c[] = { | |||
463 | (I2C_SAA7110 >> 1) + 1, | 463 | (I2C_SAA7110 >> 1) + 1, |
464 | I2C_CLIENT_END | 464 | I2C_CLIENT_END |
465 | }; | 465 | }; |
466 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | ||
467 | 466 | ||
468 | static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | 467 | static unsigned short ignore = I2C_CLIENT_END; |
469 | static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
470 | static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
471 | static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
472 | static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END }; | ||
473 | 468 | ||
474 | static struct i2c_client_address_data addr_data = { | 469 | static struct i2c_client_address_data addr_data = { |
475 | .normal_i2c = normal_i2c, | 470 | .normal_i2c = normal_i2c, |
476 | .normal_i2c_range = normal_i2c_range, | 471 | .probe = &ignore, |
477 | .probe = probe, | 472 | .ignore = &ignore, |
478 | .probe_range = probe_range, | 473 | .force = &ignore, |
479 | .ignore = ignore, | ||
480 | .ignore_range = ignore_range, | ||
481 | .force = force | ||
482 | }; | 474 | }; |
483 | 475 | ||
484 | static struct i2c_driver i2c_driver_saa7110; | 476 | static struct i2c_driver i2c_driver_saa7110; |
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index 0a873112ae23..fcd897382fcf 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c | |||
@@ -482,22 +482,14 @@ saa7111_command (struct i2c_client *client, | |||
482 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' | 482 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' |
483 | */ | 483 | */ |
484 | static unsigned short normal_i2c[] = { I2C_SAA7111 >> 1, I2C_CLIENT_END }; | 484 | static unsigned short normal_i2c[] = { I2C_SAA7111 >> 1, I2C_CLIENT_END }; |
485 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | ||
486 | 485 | ||
487 | static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | 486 | static unsigned short ignore = I2C_CLIENT_END; |
488 | static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
489 | static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
490 | static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
491 | static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END }; | ||
492 | 487 | ||
493 | static struct i2c_client_address_data addr_data = { | 488 | static struct i2c_client_address_data addr_data = { |
494 | .normal_i2c = normal_i2c, | 489 | .normal_i2c = normal_i2c, |
495 | .normal_i2c_range = normal_i2c_range, | 490 | .probe = &ignore, |
496 | .probe = probe, | 491 | .ignore = &ignore, |
497 | .probe_range = probe_range, | 492 | .force = &ignore, |
498 | .ignore = ignore, | ||
499 | .ignore_range = ignore_range, | ||
500 | .force = force | ||
501 | }; | 493 | }; |
502 | 494 | ||
503 | static struct i2c_driver i2c_driver_saa7111; | 495 | static struct i2c_driver i2c_driver_saa7111; |
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c index e73023695e58..2ba997f5ef1d 100644 --- a/drivers/media/video/saa7114.c +++ b/drivers/media/video/saa7114.c | |||
@@ -820,22 +820,14 @@ saa7114_command (struct i2c_client *client, | |||
820 | */ | 820 | */ |
821 | static unsigned short normal_i2c[] = | 821 | static unsigned short normal_i2c[] = |
822 | { I2C_SAA7114 >> 1, I2C_SAA7114A >> 1, I2C_CLIENT_END }; | 822 | { I2C_SAA7114 >> 1, I2C_SAA7114A >> 1, I2C_CLIENT_END }; |
823 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | ||
824 | 823 | ||
825 | static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | 824 | static unsigned short ignore = I2C_CLIENT_END; |
826 | static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
827 | static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
828 | static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
829 | static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END }; | ||
830 | 825 | ||
831 | static struct i2c_client_address_data addr_data = { | 826 | static struct i2c_client_address_data addr_data = { |
832 | .normal_i2c = normal_i2c, | 827 | .normal_i2c = normal_i2c, |
833 | .normal_i2c_range = normal_i2c_range, | 828 | .probe = &ignore, |
834 | .probe = probe, | 829 | .ignore = &ignore, |
835 | .probe_range = probe_range, | 830 | .force = &ignore, |
836 | .ignore = ignore, | ||
837 | .ignore_range = ignore_range, | ||
838 | .force = force | ||
839 | }; | 831 | }; |
840 | 832 | ||
841 | static struct i2c_driver i2c_driver_saa7114; | 833 | static struct i2c_driver i2c_driver_saa7114; |
diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile index e577a06b136b..b778ffd94e65 100644 --- a/drivers/media/video/saa7134/Makefile +++ b/drivers/media/video/saa7134/Makefile | |||
@@ -9,3 +9,9 @@ obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o | |||
9 | EXTRA_CFLAGS += -I$(src)/.. | 9 | EXTRA_CFLAGS += -I$(src)/.. |
10 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core | 10 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core |
11 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends | 11 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends |
12 | ifneq ($(CONFIG_DVB_MT352),n) | ||
13 | EXTRA_CFLAGS += -DHAVE_MT352=1 | ||
14 | endif | ||
15 | ifneq ($(CONFIG_DVB_TDA1004X),n) | ||
16 | EXTRA_CFLAGS += -DHAVE_TDA1004X=1 | ||
17 | endif | ||
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 1db022682980..79d05ea1b69b 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c | |||
@@ -22,7 +22,6 @@ | |||
22 | 22 | ||
23 | /* Addresses to scan */ | 23 | /* Addresses to scan */ |
24 | static unsigned short normal_i2c[] = {0x20, I2C_CLIENT_END}; | 24 | static unsigned short normal_i2c[] = {0x20, I2C_CLIENT_END}; |
25 | static unsigned short normal_i2c_range[] = {I2C_CLIENT_END}; | ||
26 | I2C_CLIENT_INSMOD; | 25 | I2C_CLIENT_INSMOD; |
27 | 26 | ||
28 | MODULE_DESCRIPTION("device driver for saa6752hs MPEG2 encoder"); | 27 | MODULE_DESCRIPTION("device driver for saa6752hs MPEG2 encoder"); |
@@ -42,16 +41,16 @@ enum saa6752hs_videoformat { | |||
42 | 41 | ||
43 | static const struct v4l2_format v4l2_format_table[] = | 42 | static const struct v4l2_format v4l2_format_table[] = |
44 | { | 43 | { |
45 | [SAA6752HS_VF_D1] = { | 44 | [SAA6752HS_VF_D1] = |
46 | .fmt = { .pix = { .width = 720, .height = 576 }, }, }, | 45 | { .fmt = { .pix = { .width = 720, .height = 576 }}}, |
47 | [SAA6752HS_VF_2_3_D1] = { | 46 | [SAA6752HS_VF_2_3_D1] = |
48 | .fmt = { .pix = { .width = 480, .height = 576 }, }, }, | 47 | { .fmt = { .pix = { .width = 480, .height = 576 }}}, |
49 | [SAA6752HS_VF_1_2_D1] = { | 48 | [SAA6752HS_VF_1_2_D1] = |
50 | .fmt = { .pix = { .width = 352, .height = 576 }, }, }, | 49 | { .fmt = { .pix = { .width = 352, .height = 576 }}}, |
51 | [SAA6752HS_VF_SIF] = { | 50 | [SAA6752HS_VF_SIF] = |
52 | .fmt = { .pix = { .width = 352, .height = 288 }, }, }, | 51 | { .fmt = { .pix = { .width = 352, .height = 288 }}}, |
53 | [SAA6752HS_VF_UNKNOWN] = { | 52 | [SAA6752HS_VF_UNKNOWN] = |
54 | .fmt = { .pix = { .width = 0, .height = 0 }, }, }, | 53 | { .fmt = { .pix = { .width = 0, .height = 0}}}, |
55 | }; | 54 | }; |
56 | 55 | ||
57 | struct saa6752hs_state { | 56 | struct saa6752hs_state { |
@@ -156,10 +155,6 @@ static struct v4l2_mpeg_compression param_defaults = | |||
156 | .target = 256, | 155 | .target = 256, |
157 | }, | 156 | }, |
158 | 157 | ||
159 | #if 0 | ||
160 | /* FIXME: size? via S_FMT? */ | ||
161 | .video_format = MPEG_VIDEO_FORMAT_D1, | ||
162 | #endif | ||
163 | }; | 158 | }; |
164 | 159 | ||
165 | /* ---------------------------------------------------------------------- */ | 160 | /* ---------------------------------------------------------------------- */ |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index c51eb7f078d3..88b71a20b602 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -1,6 +1,5 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | * $Id: saa7134-cards.c,v 1.54 2005/03/07 12:01:51 kraxel Exp $ | 2 | * $Id: saa7134-cards.c,v 1.80 2005/07/07 01:49:30 mkrufky Exp $ |
4 | * | 3 | * |
5 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
6 | * card-specific stuff. | 5 | * card-specific stuff. |
@@ -47,6 +46,10 @@ struct saa7134_board saa7134_boards[] = { | |||
47 | .name = "UNKNOWN/GENERIC", | 46 | .name = "UNKNOWN/GENERIC", |
48 | .audio_clock = 0x00187de7, | 47 | .audio_clock = 0x00187de7, |
49 | .tuner_type = TUNER_ABSENT, | 48 | .tuner_type = TUNER_ABSENT, |
49 | .radio_type = UNSET, | ||
50 | .tuner_addr = ADDR_UNSET, | ||
51 | .radio_addr = ADDR_UNSET, | ||
52 | |||
50 | .inputs = {{ | 53 | .inputs = {{ |
51 | .name = "default", | 54 | .name = "default", |
52 | .vmux = 0, | 55 | .vmux = 0, |
@@ -58,6 +61,10 @@ struct saa7134_board saa7134_boards[] = { | |||
58 | .name = "Proteus Pro [philips reference design]", | 61 | .name = "Proteus Pro [philips reference design]", |
59 | .audio_clock = 0x00187de7, | 62 | .audio_clock = 0x00187de7, |
60 | .tuner_type = TUNER_PHILIPS_PAL, | 63 | .tuner_type = TUNER_PHILIPS_PAL, |
64 | .radio_type = UNSET, | ||
65 | .tuner_addr = ADDR_UNSET, | ||
66 | .radio_addr = ADDR_UNSET, | ||
67 | |||
61 | .inputs = {{ | 68 | .inputs = {{ |
62 | .name = name_comp1, | 69 | .name = name_comp1, |
63 | .vmux = 0, | 70 | .vmux = 0, |
@@ -83,6 +90,10 @@ struct saa7134_board saa7134_boards[] = { | |||
83 | .name = "LifeView FlyVIDEO3000", | 90 | .name = "LifeView FlyVIDEO3000", |
84 | .audio_clock = 0x00200000, | 91 | .audio_clock = 0x00200000, |
85 | .tuner_type = TUNER_PHILIPS_PAL, | 92 | .tuner_type = TUNER_PHILIPS_PAL, |
93 | .radio_type = UNSET, | ||
94 | .tuner_addr = ADDR_UNSET, | ||
95 | .radio_addr = ADDR_UNSET, | ||
96 | |||
86 | .gpiomask = 0xe000, | 97 | .gpiomask = 0xe000, |
87 | .inputs = {{ | 98 | .inputs = {{ |
88 | .name = name_tv, | 99 | .name = name_tv, |
@@ -90,7 +101,7 @@ struct saa7134_board saa7134_boards[] = { | |||
90 | .amux = TV, | 101 | .amux = TV, |
91 | .gpio = 0x8000, | 102 | .gpio = 0x8000, |
92 | .tv = 1, | 103 | .tv = 1, |
93 | },{ | 104 | },{ |
94 | .name = name_tv_mono, | 105 | .name = name_tv_mono, |
95 | .vmux = 1, | 106 | .vmux = 1, |
96 | .amux = LINE2, | 107 | .amux = LINE2, |
@@ -117,12 +128,21 @@ struct saa7134_board saa7134_boards[] = { | |||
117 | .amux = LINE2, | 128 | .amux = LINE2, |
118 | .gpio = 0x2000, | 129 | .gpio = 0x2000, |
119 | }, | 130 | }, |
131 | .mute = { | ||
132 | .name = name_mute, | ||
133 | .amux = TV, | ||
134 | .gpio = 0x8000, | ||
135 | }, | ||
120 | }, | 136 | }, |
121 | [SAA7134_BOARD_FLYVIDEO2000] = { | 137 | [SAA7134_BOARD_FLYVIDEO2000] = { |
122 | /* "TC Wan" <tcwan@cs.usm.my> */ | 138 | /* "TC Wan" <tcwan@cs.usm.my> */ |
123 | .name = "LifeView FlyVIDEO2000", | 139 | .name = "LifeView FlyVIDEO2000", |
124 | .audio_clock = 0x00200000, | 140 | .audio_clock = 0x00200000, |
125 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, | 141 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, |
142 | .radio_type = UNSET, | ||
143 | .tuner_addr = ADDR_UNSET, | ||
144 | .radio_addr = ADDR_UNSET, | ||
145 | |||
126 | .gpiomask = 0xe000, | 146 | .gpiomask = 0xe000, |
127 | .inputs = {{ | 147 | .inputs = {{ |
128 | .name = name_tv, | 148 | .name = name_tv, |
@@ -146,14 +166,14 @@ struct saa7134_board saa7134_boards[] = { | |||
146 | .amux = LINE2, | 166 | .amux = LINE2, |
147 | .gpio = 0x4000, | 167 | .gpio = 0x4000, |
148 | }}, | 168 | }}, |
149 | .radio = { | 169 | .radio = { |
150 | .name = name_radio, | 170 | .name = name_radio, |
151 | .amux = LINE2, | 171 | .amux = LINE2, |
152 | .gpio = 0x2000, | 172 | .gpio = 0x2000, |
153 | }, | 173 | }, |
154 | .mute = { | 174 | .mute = { |
155 | .name = name_mute, | 175 | .name = name_mute, |
156 | .amux = LINE2, | 176 | .amux = LINE2, |
157 | .gpio = 0x8000, | 177 | .gpio = 0x8000, |
158 | }, | 178 | }, |
159 | }, | 179 | }, |
@@ -162,10 +182,14 @@ struct saa7134_board saa7134_boards[] = { | |||
162 | .name = "LifeView FlyTV Platinum Mini", | 182 | .name = "LifeView FlyTV Platinum Mini", |
163 | .audio_clock = 0x00200000, | 183 | .audio_clock = 0x00200000, |
164 | .tuner_type = TUNER_PHILIPS_TDA8290, | 184 | .tuner_type = TUNER_PHILIPS_TDA8290, |
185 | .radio_type = UNSET, | ||
186 | .tuner_addr = ADDR_UNSET, | ||
187 | .radio_addr = ADDR_UNSET, | ||
188 | |||
165 | .inputs = {{ | 189 | .inputs = {{ |
166 | .name = name_tv, | 190 | .name = name_tv, |
167 | .vmux = 1, | 191 | .vmux = 1, |
168 | .amux = LINE2, | 192 | .amux = TV, |
169 | .tv = 1, | 193 | .tv = 1, |
170 | },{ | 194 | },{ |
171 | .name = name_comp1, | 195 | .name = name_comp1, |
@@ -183,6 +207,10 @@ struct saa7134_board saa7134_boards[] = { | |||
183 | .name = "LifeView FlyTV Platinum FM", | 207 | .name = "LifeView FlyTV Platinum FM", |
184 | .audio_clock = 0x00200000, | 208 | .audio_clock = 0x00200000, |
185 | .tuner_type = TUNER_PHILIPS_TDA8290, | 209 | .tuner_type = TUNER_PHILIPS_TDA8290, |
210 | .radio_type = UNSET, | ||
211 | .tuner_addr = ADDR_UNSET, | ||
212 | .radio_addr = ADDR_UNSET, | ||
213 | |||
186 | .gpiomask = 0x1E000, /* Set GP16 and unused 15,14,13 to Output */ | 214 | .gpiomask = 0x1E000, /* Set GP16 and unused 15,14,13 to Output */ |
187 | .inputs = {{ | 215 | .inputs = {{ |
188 | .name = name_tv, | 216 | .name = name_tv, |
@@ -190,7 +218,7 @@ struct saa7134_board saa7134_boards[] = { | |||
190 | .amux = TV, | 218 | .amux = TV, |
191 | .gpio = 0x10000, /* GP16=1 selects TV input */ | 219 | .gpio = 0x10000, /* GP16=1 selects TV input */ |
192 | .tv = 1, | 220 | .tv = 1, |
193 | },{ | 221 | },{ |
194 | /* .name = name_tv_mono, | 222 | /* .name = name_tv_mono, |
195 | .vmux = 1, | 223 | .vmux = 1, |
196 | .amux = LINE2, | 224 | .amux = LINE2, |
@@ -200,29 +228,38 @@ struct saa7134_board saa7134_boards[] = { | |||
200 | */ .name = name_comp1, /* Composite signal on S-Video input */ | 228 | */ .name = name_comp1, /* Composite signal on S-Video input */ |
201 | .vmux = 0, | 229 | .vmux = 0, |
202 | .amux = LINE2, | 230 | .amux = LINE2, |
203 | // .gpio = 0x4000, | 231 | /* .gpio = 0x4000, */ |
204 | },{ | 232 | },{ |
205 | .name = name_comp2, /* Composite input */ | 233 | .name = name_comp2, /* Composite input */ |
206 | .vmux = 3, | 234 | .vmux = 3, |
207 | .amux = LINE2, | 235 | .amux = LINE2, |
208 | // .gpio = 0x4000, | 236 | /* .gpio = 0x4000, */ |
209 | },{ | 237 | },{ |
210 | .name = name_svideo, /* S-Video signal on S-Video input */ | 238 | .name = name_svideo, /* S-Video signal on S-Video input */ |
211 | .vmux = 8, | 239 | .vmux = 8, |
212 | .amux = LINE2, | 240 | .amux = LINE2, |
213 | // .gpio = 0x4000, | 241 | /* .gpio = 0x4000, */ |
214 | }}, | 242 | }}, |
215 | .radio = { | 243 | .radio = { |
216 | .name = name_radio, | 244 | .name = name_radio, |
217 | .amux = TV, | 245 | .amux = TV, |
218 | .gpio = 0x00000, /* GP16=0 selects FM radio antenna */ | 246 | .gpio = 0x00000, /* GP16=0 selects FM radio antenna */ |
219 | }, | 247 | }, |
248 | .mute = { | ||
249 | .name = name_mute, | ||
250 | .amux = TV, | ||
251 | .gpio = 0x10000, | ||
252 | }, | ||
220 | }, | 253 | }, |
221 | [SAA7134_BOARD_EMPRESS] = { | 254 | [SAA7134_BOARD_EMPRESS] = { |
222 | /* "Gert Vervoort" <gert.vervoort@philips.com> */ | 255 | /* "Gert Vervoort" <gert.vervoort@philips.com> */ |
223 | .name = "EMPRESS", | 256 | .name = "EMPRESS", |
224 | .audio_clock = 0x00187de7, | 257 | .audio_clock = 0x00187de7, |
225 | .tuner_type = TUNER_PHILIPS_PAL, | 258 | .tuner_type = TUNER_PHILIPS_PAL, |
259 | .radio_type = UNSET, | ||
260 | .tuner_addr = ADDR_UNSET, | ||
261 | .radio_addr = ADDR_UNSET, | ||
262 | |||
226 | .inputs = {{ | 263 | .inputs = {{ |
227 | .name = name_comp1, | 264 | .name = name_comp1, |
228 | .vmux = 0, | 265 | .vmux = 0, |
@@ -245,33 +282,40 @@ struct saa7134_board saa7134_boards[] = { | |||
245 | .video_out = CCIR656, | 282 | .video_out = CCIR656, |
246 | }, | 283 | }, |
247 | [SAA7134_BOARD_MONSTERTV] = { | 284 | [SAA7134_BOARD_MONSTERTV] = { |
248 | /* "K.Ohta" <alpha292@bremen.or.jp> */ | 285 | /* "K.Ohta" <alpha292@bremen.or.jp> */ |
249 | .name = "SKNet Monster TV", | 286 | .name = "SKNet Monster TV", |
250 | .audio_clock = 0x00187de7, | 287 | .audio_clock = 0x00187de7, |
251 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 288 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
252 | .inputs = {{ | 289 | .radio_type = UNSET, |
253 | .name = name_tv, | 290 | .tuner_addr = ADDR_UNSET, |
254 | .vmux = 1, | 291 | .radio_addr = ADDR_UNSET, |
255 | .amux = TV, | 292 | |
256 | .tv = 1, | 293 | .inputs = {{ |
257 | },{ | 294 | .name = name_tv, |
258 | .name = name_comp1, | 295 | .vmux = 1, |
259 | .vmux = 0, | 296 | .amux = TV, |
260 | .amux = LINE1, | 297 | .tv = 1, |
261 | },{ | 298 | },{ |
262 | .name = name_svideo, | 299 | .name = name_comp1, |
263 | .vmux = 8, | 300 | .vmux = 0, |
264 | .amux = LINE1, | 301 | .amux = LINE1, |
265 | }}, | 302 | },{ |
266 | .radio = { | 303 | .name = name_svideo, |
267 | .name = name_radio, | 304 | .vmux = 8, |
268 | .amux = LINE2, | 305 | .amux = LINE1, |
269 | }, | 306 | }}, |
307 | .radio = { | ||
308 | .name = name_radio, | ||
309 | .amux = LINE2, | ||
310 | }, | ||
270 | }, | 311 | }, |
271 | [SAA7134_BOARD_MD9717] = { | 312 | [SAA7134_BOARD_MD9717] = { |
272 | .name = "Tevion MD 9717", | 313 | .name = "Tevion MD 9717", |
273 | .audio_clock = 0x00200000, | 314 | .audio_clock = 0x00200000, |
274 | .tuner_type = TUNER_PHILIPS_PAL, | 315 | .tuner_type = TUNER_PHILIPS_PAL, |
316 | .radio_type = UNSET, | ||
317 | .tuner_addr = ADDR_UNSET, | ||
318 | .radio_addr = ADDR_UNSET, | ||
275 | .inputs = {{ | 319 | .inputs = {{ |
276 | .name = name_tv, | 320 | .name = name_tv, |
277 | .vmux = 1, | 321 | .vmux = 1, |
@@ -302,10 +346,13 @@ struct saa7134_board saa7134_boards[] = { | |||
302 | }, | 346 | }, |
303 | }, | 347 | }, |
304 | [SAA7134_BOARD_TVSTATION_RDS] = { | 348 | [SAA7134_BOARD_TVSTATION_RDS] = { |
305 | /* Typhoon TV Tuner RDS: Art.Nr. 50694 */ | 349 | /* Typhoon TV Tuner RDS: Art.Nr. 50694 */ |
306 | .name = "KNC One TV-Station RDS / Typhoon TV Tuner RDS", | 350 | .name = "KNC One TV-Station RDS / Typhoon TV Tuner RDS", |
307 | .audio_clock = 0x00200000, | 351 | .audio_clock = 0x00200000, |
308 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 352 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
353 | .radio_type = UNSET, | ||
354 | .tuner_addr = ADDR_UNSET, | ||
355 | .radio_addr = ADDR_UNSET, | ||
309 | .tda9887_conf = TDA9887_PRESENT, | 356 | .tda9887_conf = TDA9887_PRESENT, |
310 | .inputs = {{ | 357 | .inputs = {{ |
311 | .name = name_tv, | 358 | .name = name_tv, |
@@ -314,10 +361,10 @@ struct saa7134_board saa7134_boards[] = { | |||
314 | .tv = 1, | 361 | .tv = 1, |
315 | },{ | 362 | },{ |
316 | .name = name_tv_mono, | 363 | .name = name_tv_mono, |
317 | .vmux = 1, | 364 | .vmux = 1, |
318 | .amux = LINE2, | 365 | .amux = LINE2, |
319 | .tv = 1, | 366 | .tv = 1, |
320 | },{ | 367 | },{ |
321 | 368 | ||
322 | .name = name_svideo, | 369 | .name = name_svideo, |
323 | .vmux = 8, | 370 | .vmux = 8, |
@@ -328,10 +375,10 @@ struct saa7134_board saa7134_boards[] = { | |||
328 | .amux = LINE1, | 375 | .amux = LINE1, |
329 | },{ | 376 | },{ |
330 | 377 | ||
331 | .name = "CVid over SVid", | 378 | .name = "CVid over SVid", |
332 | .vmux = 0, | 379 | .vmux = 0, |
333 | .amux = LINE1, | 380 | .amux = LINE1, |
334 | }}, | 381 | }}, |
335 | .radio = { | 382 | .radio = { |
336 | .name = name_radio, | 383 | .name = name_radio, |
337 | .amux = LINE2, | 384 | .amux = LINE2, |
@@ -341,6 +388,9 @@ struct saa7134_board saa7134_boards[] = { | |||
341 | .name = "KNC One TV-Station DVR", | 388 | .name = "KNC One TV-Station DVR", |
342 | .audio_clock = 0x00200000, | 389 | .audio_clock = 0x00200000, |
343 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 390 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
391 | .radio_type = UNSET, | ||
392 | .tuner_addr = ADDR_UNSET, | ||
393 | .radio_addr = ADDR_UNSET, | ||
344 | .tda9887_conf = TDA9887_PRESENT, | 394 | .tda9887_conf = TDA9887_PRESENT, |
345 | .gpiomask = 0x820000, | 395 | .gpiomask = 0x820000, |
346 | .inputs = {{ | 396 | .inputs = {{ |
@@ -369,32 +419,38 @@ struct saa7134_board saa7134_boards[] = { | |||
369 | .video_out = CCIR656, | 419 | .video_out = CCIR656, |
370 | }, | 420 | }, |
371 | [SAA7134_BOARD_CINERGY400] = { | 421 | [SAA7134_BOARD_CINERGY400] = { |
372 | .name = "Terratec Cinergy 400 TV", | 422 | .name = "Terratec Cinergy 400 TV", |
373 | .audio_clock = 0x00200000, | 423 | .audio_clock = 0x00200000, |
374 | .tuner_type = TUNER_PHILIPS_PAL, | 424 | .tuner_type = TUNER_PHILIPS_PAL, |
375 | .inputs = {{ | 425 | .radio_type = UNSET, |
376 | .name = name_tv, | 426 | .tuner_addr = ADDR_UNSET, |
377 | .vmux = 1, | 427 | .radio_addr = ADDR_UNSET, |
378 | .amux = TV, | 428 | .inputs = {{ |
379 | .tv = 1, | 429 | .name = name_tv, |
380 | },{ | 430 | .vmux = 1, |
381 | .name = name_comp1, | 431 | .amux = TV, |
382 | .vmux = 4, | 432 | .tv = 1, |
383 | .amux = LINE1, | 433 | },{ |
384 | },{ | 434 | .name = name_comp1, |
385 | .name = name_svideo, | 435 | .vmux = 4, |
386 | .vmux = 8, | 436 | .amux = LINE1, |
387 | .amux = LINE1, | 437 | },{ |
388 | },{ | 438 | .name = name_svideo, |
389 | .name = name_comp2, // CVideo over SVideo Connector | 439 | .vmux = 8, |
390 | .vmux = 0, | 440 | .amux = LINE1, |
391 | .amux = LINE1, | 441 | },{ |
392 | }} | 442 | .name = name_comp2, /* CVideo over SVideo Connector */ |
393 | }, | 443 | .vmux = 0, |
444 | .amux = LINE1, | ||
445 | }} | ||
446 | }, | ||
394 | [SAA7134_BOARD_MD5044] = { | 447 | [SAA7134_BOARD_MD5044] = { |
395 | .name = "Medion 5044", | 448 | .name = "Medion 5044", |
396 | .audio_clock = 0x00187de7, // was: 0x00200000, | 449 | .audio_clock = 0x00187de7, /* was: 0x00200000, */ |
397 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 450 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
451 | .radio_type = UNSET, | ||
452 | .tuner_addr = ADDR_UNSET, | ||
453 | .radio_addr = ADDR_UNSET, | ||
398 | .tda9887_conf = TDA9887_PRESENT, | 454 | .tda9887_conf = TDA9887_PRESENT, |
399 | .inputs = {{ | 455 | .inputs = {{ |
400 | .name = name_tv, | 456 | .name = name_tv, |
@@ -426,57 +482,65 @@ struct saa7134_board saa7134_boards[] = { | |||
426 | }, | 482 | }, |
427 | }, | 483 | }, |
428 | [SAA7134_BOARD_KWORLD] = { | 484 | [SAA7134_BOARD_KWORLD] = { |
429 | .name = "Kworld/KuroutoShikou SAA7130-TVPCI", | 485 | .name = "Kworld/KuroutoShikou SAA7130-TVPCI", |
430 | .audio_clock = 0x00187de7, | 486 | .audio_clock = 0x00187de7, |
431 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 487 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
432 | .inputs = {{ | 488 | .radio_type = UNSET, |
433 | .name = name_svideo, | 489 | .tuner_addr = ADDR_UNSET, |
434 | .vmux = 8, | 490 | .radio_addr = ADDR_UNSET, |
435 | .amux = LINE1, | 491 | .inputs = {{ |
436 | },{ | 492 | .name = name_svideo, |
437 | .name = name_comp1, | 493 | .vmux = 8, |
438 | .vmux = 3, | 494 | .amux = LINE1, |
439 | .amux = LINE1, | 495 | },{ |
440 | },{ | 496 | .name = name_comp1, |
441 | .name = name_tv, | 497 | .vmux = 3, |
442 | .vmux = 1, | 498 | .amux = LINE1, |
443 | .amux = LINE2, | 499 | },{ |
444 | .tv = 1, | 500 | .name = name_tv, |
445 | }}, | 501 | .vmux = 1, |
446 | }, | 502 | .amux = LINE2, |
503 | .tv = 1, | ||
504 | }}, | ||
505 | }, | ||
447 | [SAA7134_BOARD_CINERGY600] = { | 506 | [SAA7134_BOARD_CINERGY600] = { |
448 | .name = "Terratec Cinergy 600 TV", | 507 | .name = "Terratec Cinergy 600 TV", |
449 | .audio_clock = 0x00200000, | 508 | .audio_clock = 0x00200000, |
450 | .tuner_type = TUNER_PHILIPS_PAL, | 509 | .tuner_type = TUNER_PHILIPS_PAL, |
510 | .radio_type = UNSET, | ||
511 | .tuner_addr = ADDR_UNSET, | ||
512 | .radio_addr = ADDR_UNSET, | ||
451 | .tda9887_conf = TDA9887_PRESENT, | 513 | .tda9887_conf = TDA9887_PRESENT, |
452 | .inputs = {{ | 514 | .inputs = {{ |
453 | .name = name_tv, | 515 | .name = name_tv, |
454 | .vmux = 1, | 516 | .vmux = 1, |
455 | .amux = TV, | 517 | .amux = TV, |
456 | .tv = 1, | 518 | .tv = 1, |
457 | },{ | 519 | },{ |
458 | .name = name_comp1, | 520 | .name = name_comp1, |
459 | .vmux = 4, | 521 | .vmux = 4, |
460 | .amux = LINE1, | 522 | .amux = LINE1, |
461 | },{ | 523 | },{ |
462 | .name = name_svideo, | 524 | .name = name_svideo, |
463 | .vmux = 8, | 525 | .vmux = 8, |
464 | .amux = LINE1, | 526 | .amux = LINE1, |
465 | },{ | 527 | },{ |
466 | .name = name_comp2, // CVideo over SVideo Connector | 528 | .name = name_comp2, /* CVideo over SVideo Connector */ |
467 | .vmux = 0, | 529 | .vmux = 0, |
468 | .amux = LINE1, | 530 | .amux = LINE1, |
469 | }}, | 531 | }}, |
470 | .radio = { | 532 | .radio = { |
471 | .name = name_radio, | 533 | .name = name_radio, |
472 | .amux = LINE2, | 534 | .amux = LINE2, |
473 | }, | 535 | }, |
474 | }, | 536 | }, |
475 | [SAA7134_BOARD_MD7134] = { | 537 | [SAA7134_BOARD_MD7134] = { |
476 | .name = "Medion 7134", | 538 | .name = "Medion 7134", |
477 | //.audio_clock = 0x00200000, | ||
478 | .audio_clock = 0x00187de7, | 539 | .audio_clock = 0x00187de7, |
479 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 540 | .tuner_type = TUNER_PHILIPS_FMD1216ME_MK3, |
541 | .radio_type = UNSET, | ||
542 | .tuner_addr = ADDR_UNSET, | ||
543 | .radio_addr = ADDR_UNSET, | ||
480 | .tda9887_conf = TDA9887_PRESENT, | 544 | .tda9887_conf = TDA9887_PRESENT, |
481 | .mpeg = SAA7134_MPEG_DVB, | 545 | .mpeg = SAA7134_MPEG_DVB, |
482 | .inputs = {{ | 546 | .inputs = {{ |
@@ -504,6 +568,9 @@ struct saa7134_board saa7134_boards[] = { | |||
504 | .name = "Typhoon TV+Radio 90031", | 568 | .name = "Typhoon TV+Radio 90031", |
505 | .audio_clock = 0x00200000, | 569 | .audio_clock = 0x00200000, |
506 | .tuner_type = TUNER_PHILIPS_PAL, | 570 | .tuner_type = TUNER_PHILIPS_PAL, |
571 | .radio_type = UNSET, | ||
572 | .tuner_addr = ADDR_UNSET, | ||
573 | .radio_addr = ADDR_UNSET, | ||
507 | .tda9887_conf = TDA9887_PRESENT, | 574 | .tda9887_conf = TDA9887_PRESENT, |
508 | .inputs = {{ | 575 | .inputs = {{ |
509 | .name = name_tv, | 576 | .name = name_tv, |
@@ -523,11 +590,14 @@ struct saa7134_board saa7134_boards[] = { | |||
523 | .name = name_radio, | 590 | .name = name_radio, |
524 | .amux = LINE2, | 591 | .amux = LINE2, |
525 | }, | 592 | }, |
526 | }, | 593 | }, |
527 | [SAA7134_BOARD_ELSA] = { | 594 | [SAA7134_BOARD_ELSA] = { |
528 | .name = "ELSA EX-VISION 300TV", | 595 | .name = "ELSA EX-VISION 300TV", |
529 | .audio_clock = 0x00187de7, | 596 | .audio_clock = 0x00187de7, |
530 | .tuner_type = TUNER_HITACHI_NTSC, | 597 | .tuner_type = TUNER_HITACHI_NTSC, |
598 | .radio_type = UNSET, | ||
599 | .tuner_addr = ADDR_UNSET, | ||
600 | .radio_addr = ADDR_UNSET, | ||
531 | .inputs = {{ | 601 | .inputs = {{ |
532 | .name = name_svideo, | 602 | .name = name_svideo, |
533 | .vmux = 8, | 603 | .vmux = 8, |
@@ -542,11 +612,14 @@ struct saa7134_board saa7134_boards[] = { | |||
542 | .amux = LINE2, | 612 | .amux = LINE2, |
543 | .tv = 1, | 613 | .tv = 1, |
544 | }}, | 614 | }}, |
545 | }, | 615 | }, |
546 | [SAA7134_BOARD_ELSA_500TV] = { | 616 | [SAA7134_BOARD_ELSA_500TV] = { |
547 | .name = "ELSA EX-VISION 500TV", | 617 | .name = "ELSA EX-VISION 500TV", |
548 | .audio_clock = 0x00187de7, | 618 | .audio_clock = 0x00187de7, |
549 | .tuner_type = TUNER_HITACHI_NTSC, | 619 | .tuner_type = TUNER_HITACHI_NTSC, |
620 | .radio_type = UNSET, | ||
621 | .tuner_addr = ADDR_UNSET, | ||
622 | .radio_addr = ADDR_UNSET, | ||
550 | .inputs = {{ | 623 | .inputs = {{ |
551 | .name = name_svideo, | 624 | .name = name_svideo, |
552 | .vmux = 7, | 625 | .vmux = 7, |
@@ -562,83 +635,100 @@ struct saa7134_board saa7134_boards[] = { | |||
562 | .amux = LINE2, | 635 | .amux = LINE2, |
563 | .tv = 1, | 636 | .tv = 1, |
564 | }}, | 637 | }}, |
565 | }, | 638 | }, |
566 | [SAA7134_BOARD_ASUSTeK_TVFM7134] = { | 639 | [SAA7134_BOARD_ASUSTeK_TVFM7134] = { |
567 | .name = "ASUS TV-FM 7134", | 640 | .name = "ASUS TV-FM 7134", |
568 | .audio_clock = 0x00187de7, | 641 | .audio_clock = 0x00187de7, |
569 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 642 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
570 | .tda9887_conf = TDA9887_PRESENT, | 643 | .radio_type = UNSET, |
571 | .inputs = {{ | 644 | .tuner_addr = ADDR_UNSET, |
572 | .name = name_tv, | 645 | .radio_addr = ADDR_UNSET, |
573 | .vmux = 1, | 646 | .tda9887_conf = TDA9887_PRESENT, |
574 | .amux = TV, | 647 | .inputs = {{ |
575 | .tv = 1, | 648 | .name = name_tv, |
576 | },{ | 649 | .vmux = 1, |
577 | .name = name_comp1, | 650 | .amux = TV, |
578 | .vmux = 4, | 651 | .tv = 1, |
579 | .amux = LINE2, | 652 | },{ |
580 | },{ | 653 | .name = name_comp1, |
581 | .name = name_svideo, | 654 | .vmux = 4, |
582 | .vmux = 6, | 655 | .amux = LINE2, |
583 | .amux = LINE2, | 656 | },{ |
584 | }}, | 657 | .name = name_svideo, |
585 | .radio = { | 658 | .vmux = 6, |
586 | .name = name_radio, | 659 | .amux = LINE2, |
587 | .amux = LINE1, | 660 | }}, |
588 | }, | 661 | .radio = { |
589 | }, | 662 | .name = name_radio, |
590 | [SAA7135_BOARD_ASUSTeK_TVFM7135] = { | 663 | .amux = LINE1, |
591 | .name = "ASUS TV-FM 7135", | 664 | }, |
592 | .audio_clock = 0x00187de7, | 665 | }, |
593 | .tuner_type = TUNER_PHILIPS_TDA8290, | 666 | [SAA7134_BOARD_ASUSTeK_TVFM7135] = { |
667 | .name = "ASUS TV-FM 7135", | ||
668 | .audio_clock = 0x00187de7, | ||
669 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
670 | .radio_type = UNSET, | ||
671 | .tuner_addr = ADDR_UNSET, | ||
672 | .radio_addr = ADDR_UNSET, | ||
594 | .gpiomask = 0x200000, | 673 | .gpiomask = 0x200000, |
595 | .inputs = {{ | 674 | .inputs = {{ |
596 | .name = name_tv, | 675 | .name = name_tv, |
597 | .vmux = 1, | 676 | .vmux = 1, |
598 | .amux = TV, | 677 | .amux = TV, |
599 | .gpio = 0x0000, | 678 | .gpio = 0x0000, |
600 | .tv = 1, | 679 | .tv = 1, |
601 | },{ | 680 | },{ |
602 | .name = name_comp1, | 681 | .name = name_comp1, |
603 | .vmux = 4, | 682 | .vmux = 4, |
604 | .amux = LINE2, | 683 | .amux = LINE2, |
605 | .gpio = 0x0000, | 684 | .gpio = 0x0000, |
606 | },{ | 685 | },{ |
607 | .name = name_svideo, | 686 | .name = name_svideo, |
608 | .vmux = 6, | 687 | .vmux = 6, |
609 | .amux = LINE2, | 688 | .amux = LINE2, |
610 | .gpio = 0x0000, | 689 | .gpio = 0x0000, |
611 | }}, | 690 | }}, |
612 | .radio = { | 691 | .radio = { |
613 | .name = name_radio, | 692 | .name = name_radio, |
614 | .amux = TV, | 693 | .amux = TV, |
615 | .gpio = 0x200000, | 694 | .gpio = 0x200000, |
616 | }, | 695 | }, |
696 | .mute = { | ||
697 | .name = name_mute, | ||
698 | .gpio = 0x0000, | ||
699 | }, | ||
700 | |||
617 | }, | 701 | }, |
618 | [SAA7134_BOARD_VA1000POWER] = { | 702 | [SAA7134_BOARD_VA1000POWER] = { |
619 | .name = "AOPEN VA1000 POWER", | 703 | .name = "AOPEN VA1000 POWER", |
620 | .audio_clock = 0x00187de7, | 704 | .audio_clock = 0x00187de7, |
621 | .tuner_type = TUNER_PHILIPS_NTSC, | 705 | .tuner_type = TUNER_PHILIPS_NTSC, |
622 | .inputs = {{ | 706 | .radio_type = UNSET, |
623 | .name = name_svideo, | 707 | .tuner_addr = ADDR_UNSET, |
624 | .vmux = 8, | 708 | .radio_addr = ADDR_UNSET, |
625 | .amux = LINE1, | 709 | .inputs = {{ |
626 | },{ | 710 | .name = name_svideo, |
627 | .name = name_comp1, | 711 | .vmux = 8, |
628 | .vmux = 3, | 712 | .amux = LINE1, |
629 | .amux = LINE1, | 713 | },{ |
630 | },{ | 714 | .name = name_comp1, |
631 | .name = name_tv, | 715 | .vmux = 3, |
632 | .vmux = 1, | 716 | .amux = LINE1, |
633 | .amux = LINE2, | 717 | },{ |
634 | .tv = 1, | 718 | .name = name_tv, |
635 | }}, | 719 | .vmux = 1, |
720 | .amux = LINE2, | ||
721 | .tv = 1, | ||
722 | }}, | ||
636 | }, | 723 | }, |
637 | [SAA7134_BOARD_10MOONSTVMASTER] = { | 724 | [SAA7134_BOARD_10MOONSTVMASTER] = { |
638 | /* "lilicheng" <llc@linuxfans.org> */ | 725 | /* "lilicheng" <llc@linuxfans.org> */ |
639 | .name = "10MOONS PCI TV CAPTURE CARD", | 726 | .name = "10MOONS PCI TV CAPTURE CARD", |
640 | .audio_clock = 0x00200000, | 727 | .audio_clock = 0x00200000, |
641 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, | 728 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, |
729 | .radio_type = UNSET, | ||
730 | .tuner_addr = ADDR_UNSET, | ||
731 | .radio_addr = ADDR_UNSET, | ||
642 | .gpiomask = 0xe000, | 732 | .gpiomask = 0xe000, |
643 | .inputs = {{ | 733 | .inputs = {{ |
644 | .name = name_tv, | 734 | .name = name_tv, |
@@ -662,14 +752,14 @@ struct saa7134_board saa7134_boards[] = { | |||
662 | .amux = LINE2, | 752 | .amux = LINE2, |
663 | .gpio = 0x4000, | 753 | .gpio = 0x4000, |
664 | }}, | 754 | }}, |
665 | .radio = { | 755 | .radio = { |
666 | .name = name_radio, | 756 | .name = name_radio, |
667 | .amux = LINE2, | 757 | .amux = LINE2, |
668 | .gpio = 0x2000, | 758 | .gpio = 0x2000, |
669 | }, | 759 | }, |
670 | .mute = { | 760 | .mute = { |
671 | .name = name_mute, | 761 | .name = name_mute, |
672 | .amux = LINE2, | 762 | .amux = LINE2, |
673 | .gpio = 0x8000, | 763 | .gpio = 0x8000, |
674 | }, | 764 | }, |
675 | }, | 765 | }, |
@@ -678,6 +768,9 @@ struct saa7134_board saa7134_boards[] = { | |||
678 | .name = "BMK MPEX No Tuner", | 768 | .name = "BMK MPEX No Tuner", |
679 | .audio_clock = 0x200000, | 769 | .audio_clock = 0x200000, |
680 | .tuner_type = TUNER_ABSENT, | 770 | .tuner_type = TUNER_ABSENT, |
771 | .radio_type = UNSET, | ||
772 | .tuner_addr = ADDR_UNSET, | ||
773 | .radio_addr = ADDR_UNSET, | ||
681 | .inputs = {{ | 774 | .inputs = {{ |
682 | .name = name_comp1, | 775 | .name = name_comp1, |
683 | .vmux = 4, | 776 | .vmux = 4, |
@@ -706,80 +799,94 @@ struct saa7134_board saa7134_boards[] = { | |||
706 | .name = "Compro VideoMate TV", | 799 | .name = "Compro VideoMate TV", |
707 | .audio_clock = 0x00187de7, | 800 | .audio_clock = 0x00187de7, |
708 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 801 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
709 | .inputs = {{ | 802 | .radio_type = UNSET, |
710 | .name = name_svideo, | 803 | .tuner_addr = ADDR_UNSET, |
711 | .vmux = 8, | 804 | .radio_addr = ADDR_UNSET, |
712 | .amux = LINE1, | 805 | .inputs = {{ |
713 | },{ | 806 | .name = name_svideo, |
714 | .name = name_comp1, | 807 | .vmux = 8, |
715 | .vmux = 3, | 808 | .amux = LINE1, |
716 | .amux = LINE1, | 809 | },{ |
717 | },{ | 810 | .name = name_comp1, |
718 | .name = name_tv, | 811 | .vmux = 3, |
719 | .vmux = 1, | 812 | .amux = LINE1, |
720 | .amux = LINE2, | 813 | },{ |
721 | .tv = 1, | 814 | .name = name_tv, |
722 | }}, | 815 | .vmux = 1, |
723 | }, | 816 | .amux = LINE2, |
724 | [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS] = { | 817 | .tv = 1, |
818 | }}, | ||
819 | }, | ||
820 | [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS] = { | ||
725 | .name = "Compro VideoMate TV Gold+", | 821 | .name = "Compro VideoMate TV Gold+", |
726 | .audio_clock = 0x00187de7, | 822 | .audio_clock = 0x00187de7, |
727 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 823 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
728 | .gpiomask = 0x800c0000, | 824 | .gpiomask = 0x800c0000, |
729 | .inputs = {{ | 825 | .radio_type = UNSET, |
730 | .name = name_svideo, | 826 | .tuner_addr = ADDR_UNSET, |
731 | .vmux = 8, | 827 | .radio_addr = ADDR_UNSET, |
732 | .amux = LINE1, | 828 | .inputs = {{ |
733 | .gpio = 0x06c00012, | 829 | .name = name_svideo, |
734 | },{ | 830 | .vmux = 8, |
735 | .name = name_comp1, | 831 | .amux = LINE1, |
736 | .vmux = 3, | 832 | .gpio = 0x06c00012, |
737 | .amux = LINE1, | 833 | },{ |
738 | .gpio = 0x0ac20012, | 834 | .name = name_comp1, |
739 | },{ | 835 | .vmux = 3, |
740 | .name = name_tv, | 836 | .amux = LINE1, |
741 | .vmux = 1, | 837 | .gpio = 0x0ac20012, |
742 | .amux = LINE2, | 838 | },{ |
743 | .gpio = 0x08c20012, | 839 | .name = name_tv, |
744 | .tv = 1, | 840 | .vmux = 1, |
745 | }}, | 841 | .amux = LINE2, |
746 | }, | 842 | .gpio = 0x08c20012, |
843 | .tv = 1, | ||
844 | }}, /* radio and probably mute is missing */ | ||
845 | }, | ||
747 | [SAA7134_BOARD_CRONOS_PLUS] = { | 846 | [SAA7134_BOARD_CRONOS_PLUS] = { |
748 | /* gpio pins: | 847 | /* |
749 | 0 .. 3 BASE_ID | 848 | gpio pins: |
750 | 4 .. 7 PROTECT_ID | 849 | 0 .. 3 BASE_ID |
751 | 8 .. 11 USER_OUT | 850 | 4 .. 7 PROTECT_ID |
752 | 12 .. 13 USER_IN | 851 | 8 .. 11 USER_OUT |
753 | 14 .. 15 VIDIN_SEL */ | 852 | 12 .. 13 USER_IN |
853 | 14 .. 15 VIDIN_SEL | ||
854 | */ | ||
754 | .name = "Matrox CronosPlus", | 855 | .name = "Matrox CronosPlus", |
755 | .tuner_type = TUNER_ABSENT, | 856 | .tuner_type = TUNER_ABSENT, |
857 | .radio_type = UNSET, | ||
858 | .tuner_addr = ADDR_UNSET, | ||
859 | .radio_addr = ADDR_UNSET, | ||
756 | .gpiomask = 0xcf00, | 860 | .gpiomask = 0xcf00, |
757 | .inputs = {{ | 861 | .inputs = {{ |
758 | .name = name_comp1, | 862 | .name = name_comp1, |
759 | .vmux = 0, | 863 | .vmux = 0, |
760 | .gpio = 2 << 14, | 864 | .gpio = 2 << 14, |
761 | },{ | 865 | },{ |
762 | .name = name_comp2, | 866 | .name = name_comp2, |
763 | .vmux = 0, | 867 | .vmux = 0, |
764 | .gpio = 1 << 14, | 868 | .gpio = 1 << 14, |
765 | },{ | 869 | },{ |
766 | .name = name_comp3, | 870 | .name = name_comp3, |
767 | .vmux = 0, | 871 | .vmux = 0, |
768 | .gpio = 0 << 14, | 872 | .gpio = 0 << 14, |
769 | },{ | 873 | },{ |
770 | .name = name_comp4, | 874 | .name = name_comp4, |
771 | .vmux = 0, | 875 | .vmux = 0, |
772 | .gpio = 3 << 14, | 876 | .gpio = 3 << 14, |
773 | },{ | 877 | },{ |
774 | .name = name_svideo, | 878 | .name = name_svideo, |
775 | .vmux = 8, | 879 | .vmux = 8, |
776 | .gpio = 2 << 14, | 880 | .gpio = 2 << 14, |
777 | }}, | 881 | }}, |
778 | }, | 882 | }, |
779 | [SAA7134_BOARD_MD2819] = { | 883 | [SAA7134_BOARD_MD2819] = { |
780 | .name = "AverMedia M156 / Medion 2819", | 884 | .name = "AverMedia M156 / Medion 2819", |
781 | .audio_clock = 0x00187de7, | 885 | .audio_clock = 0x00187de7, |
782 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 886 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
887 | .radio_type = UNSET, | ||
888 | .tuner_addr = ADDR_UNSET, | ||
889 | .radio_addr = ADDR_UNSET, | ||
783 | .tda9887_conf = TDA9887_PRESENT, | 890 | .tda9887_conf = TDA9887_PRESENT, |
784 | .inputs = {{ | 891 | .inputs = {{ |
785 | .name = name_tv, | 892 | .name = name_tv, |
@@ -809,6 +916,9 @@ struct saa7134_board saa7134_boards[] = { | |||
809 | .name = "BMK MPEX Tuner", | 916 | .name = "BMK MPEX Tuner", |
810 | .audio_clock = 0x200000, | 917 | .audio_clock = 0x200000, |
811 | .tuner_type = TUNER_PHILIPS_PAL, | 918 | .tuner_type = TUNER_PHILIPS_PAL, |
919 | .radio_type = UNSET, | ||
920 | .tuner_addr = ADDR_UNSET, | ||
921 | .radio_addr = ADDR_UNSET, | ||
812 | .inputs = {{ | 922 | .inputs = {{ |
813 | .name = name_comp1, | 923 | .name = name_comp1, |
814 | .vmux = 1, | 924 | .vmux = 1, |
@@ -825,62 +935,72 @@ struct saa7134_board saa7134_boards[] = { | |||
825 | }}, | 935 | }}, |
826 | .mpeg = SAA7134_MPEG_EMPRESS, | 936 | .mpeg = SAA7134_MPEG_EMPRESS, |
827 | .video_out = CCIR656, | 937 | .video_out = CCIR656, |
828 | }, | 938 | }, |
829 | [SAA7134_BOARD_ASUSTEK_TVFM7133] = { | 939 | [SAA7134_BOARD_ASUSTEK_TVFM7133] = { |
830 | .name = "ASUS TV-FM 7133", | 940 | .name = "ASUS TV-FM 7133", |
831 | .audio_clock = 0x00187de7, | 941 | .audio_clock = 0x00187de7, |
832 | // probably wrong, the 7133 one is the NTSC version ... | 942 | /* probably wrong, the 7133 one is the NTSC version ... |
833 | // .tuner_type = TUNER_PHILIPS_FM1236_MK3 | 943 | * .tuner_type = TUNER_PHILIPS_FM1236_MK3 */ |
834 | .tuner_type = TUNER_LG_NTSC_NEW_TAPC, | 944 | .tuner_type = TUNER_LG_NTSC_NEW_TAPC, |
835 | .tda9887_conf = TDA9887_PRESENT, | 945 | .radio_type = UNSET, |
836 | .inputs = {{ | 946 | .tuner_addr = ADDR_UNSET, |
837 | .name = name_tv, | 947 | .radio_addr = ADDR_UNSET, |
838 | .vmux = 1, | 948 | .tda9887_conf = TDA9887_PRESENT, |
839 | .amux = TV, | 949 | .inputs = {{ |
840 | .tv = 1, | 950 | .name = name_tv, |
841 | },{ | 951 | .vmux = 1, |
842 | .name = name_comp1, | 952 | .amux = TV, |
843 | .vmux = 4, | 953 | .tv = 1, |
844 | .amux = LINE2, | 954 | |
845 | },{ | 955 | },{ |
846 | .name = name_svideo, | 956 | .name = name_comp1, |
847 | .vmux = 6, | 957 | .vmux = 4, |
848 | .amux = LINE2, | 958 | .amux = LINE2, |
849 | }}, | 959 | },{ |
850 | .radio = { | 960 | .name = name_svideo, |
851 | .name = name_radio, | 961 | .vmux = 6, |
852 | .amux = LINE1, | 962 | .amux = LINE2, |
853 | }, | 963 | }}, |
854 | }, | 964 | .radio = { |
965 | .name = name_radio, | ||
966 | .amux = LINE1, | ||
967 | }, | ||
968 | }, | ||
855 | [SAA7134_BOARD_PINNACLE_PCTV_STEREO] = { | 969 | [SAA7134_BOARD_PINNACLE_PCTV_STEREO] = { |
856 | .name = "Pinnacle PCTV Stereo (saa7134)", | 970 | .name = "Pinnacle PCTV Stereo (saa7134)", |
857 | .audio_clock = 0x00187de7, | 971 | .audio_clock = 0x00187de7, |
858 | .tuner_type = TUNER_MT2032, | 972 | .tuner_type = TUNER_MT2032, |
859 | .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, | 973 | .radio_type = UNSET, |
860 | .inputs = {{ | 974 | .tuner_addr = ADDR_UNSET, |
861 | .name = name_tv, | 975 | .radio_addr = ADDR_UNSET, |
862 | .vmux = 3, | 976 | .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, |
863 | .amux = TV, | 977 | .inputs = {{ |
864 | .tv = 1, | 978 | .name = name_tv, |
865 | },{ | 979 | .vmux = 3, |
866 | .name = name_comp1, | 980 | .amux = TV, |
867 | .vmux = 0, | 981 | .tv = 1, |
868 | .amux = LINE2, | 982 | },{ |
869 | },{ | 983 | .name = name_comp1, |
870 | .name = name_comp2, | 984 | .vmux = 0, |
871 | .vmux = 1, | 985 | .amux = LINE2, |
872 | .amux = LINE2, | 986 | },{ |
873 | },{ | 987 | .name = name_comp2, |
874 | .name = name_svideo, | 988 | .vmux = 1, |
875 | .vmux = 8, | 989 | .amux = LINE2, |
876 | .amux = LINE2, | 990 | },{ |
877 | }}, | 991 | .name = name_svideo, |
878 | }, | 992 | .vmux = 8, |
993 | .amux = LINE2, | ||
994 | }}, | ||
995 | }, | ||
879 | [SAA7134_BOARD_MANLI_MTV002] = { | 996 | [SAA7134_BOARD_MANLI_MTV002] = { |
880 | /* Ognjen Nastic <ognjen@logosoft.ba> */ | 997 | /* Ognjen Nastic <ognjen@logosoft.ba> */ |
881 | .name = "Manli MuchTV M-TV002", | 998 | .name = "Manli MuchTV M-TV002/Behold TV 403 FM", |
882 | .audio_clock = 0x00200000, | 999 | .audio_clock = 0x00200000, |
883 | .tuner_type = TUNER_PHILIPS_PAL, | 1000 | .tuner_type = TUNER_PHILIPS_PAL, |
1001 | .radio_type = UNSET, | ||
1002 | .tuner_addr = ADDR_UNSET, | ||
1003 | .radio_addr = ADDR_UNSET, | ||
884 | .inputs = {{ | 1004 | .inputs = {{ |
885 | .name = name_svideo, | 1005 | .name = name_svideo, |
886 | .vmux = 8, | 1006 | .vmux = 8, |
@@ -899,16 +1019,15 @@ struct saa7134_board saa7134_boards[] = { | |||
899 | .name = name_radio, | 1019 | .name = name_radio, |
900 | .amux = LINE2, | 1020 | .amux = LINE2, |
901 | }, | 1021 | }, |
902 | .mute = { | ||
903 | .name = name_mute, | ||
904 | .amux = LINE1, | ||
905 | }, | ||
906 | }, | 1022 | }, |
907 | [SAA7134_BOARD_MANLI_MTV001] = { | 1023 | [SAA7134_BOARD_MANLI_MTV001] = { |
908 | /* Ognjen Nastic <ognjen@logosoft.ba> UNTESTED */ | 1024 | /* Ognjen Nastic <ognjen@logosoft.ba> UNTESTED */ |
909 | .name = "Manli MuchTV M-TV001", | 1025 | .name = "Manli MuchTV M-TV001/Behold TV 401", |
910 | .audio_clock = 0x00200000, | 1026 | .audio_clock = 0x00200000, |
911 | .tuner_type = TUNER_PHILIPS_PAL, | 1027 | .tuner_type = TUNER_PHILIPS_PAL, |
1028 | .radio_type = UNSET, | ||
1029 | .tuner_addr = ADDR_UNSET, | ||
1030 | .radio_addr = ADDR_UNSET, | ||
912 | .inputs = {{ | 1031 | .inputs = {{ |
913 | .name = name_svideo, | 1032 | .name = name_svideo, |
914 | .vmux = 8, | 1033 | .vmux = 8, |
@@ -923,12 +1042,19 @@ struct saa7134_board saa7134_boards[] = { | |||
923 | .amux = LINE2, | 1042 | .amux = LINE2, |
924 | .tv = 1, | 1043 | .tv = 1, |
925 | }}, | 1044 | }}, |
926 | }, | 1045 | .mute = { |
1046 | .name = name_mute, | ||
1047 | .amux = LINE1, | ||
1048 | }, | ||
1049 | }, | ||
927 | [SAA7134_BOARD_TG3000TV] = { | 1050 | [SAA7134_BOARD_TG3000TV] = { |
928 | /* TransGear 3000TV */ | 1051 | /* TransGear 3000TV */ |
929 | .name = "Nagase Sangyo TransGear 3000TV", | 1052 | .name = "Nagase Sangyo TransGear 3000TV", |
930 | .audio_clock = 0x00187de7, | 1053 | .audio_clock = 0x00187de7, |
931 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 1054 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
1055 | .radio_type = UNSET, | ||
1056 | .tuner_addr = ADDR_UNSET, | ||
1057 | .radio_addr = ADDR_UNSET, | ||
932 | .inputs = {{ | 1058 | .inputs = {{ |
933 | .name = name_tv, | 1059 | .name = name_tv, |
934 | .vmux = 1, | 1060 | .vmux = 1, |
@@ -944,81 +1070,90 @@ struct saa7134_board saa7134_boards[] = { | |||
944 | .amux = LINE2, | 1070 | .amux = LINE2, |
945 | }}, | 1071 | }}, |
946 | }, | 1072 | }, |
947 | [SAA7134_BOARD_ECS_TVP3XP] = { | 1073 | [SAA7134_BOARD_ECS_TVP3XP] = { |
948 | .name = "Elitegroup ECS TVP3XP FM1216 Tuner Card(PAL-BG,FM) ", | 1074 | .name = "Elitegroup ECS TVP3XP FM1216 Tuner Card(PAL-BG,FM) ", |
949 | .audio_clock = 0x187de7, // xtal 32.1 MHz | 1075 | .audio_clock = 0x187de7, /* xtal 32.1 MHz */ |
950 | .tuner_type = TUNER_PHILIPS_PAL, | 1076 | .tuner_type = TUNER_PHILIPS_PAL, |
951 | .inputs = {{ | 1077 | .radio_type = UNSET, |
952 | .name = name_tv, | 1078 | .tuner_addr = ADDR_UNSET, |
953 | .vmux = 1, | 1079 | .radio_addr = ADDR_UNSET, |
954 | .amux = TV, | 1080 | .inputs = {{ |
955 | .tv = 1, | 1081 | .name = name_tv, |
956 | },{ | 1082 | .vmux = 1, |
957 | .name = name_tv_mono, | 1083 | .amux = TV, |
958 | .vmux = 1, | 1084 | .tv = 1, |
959 | .amux = LINE2, | 1085 | },{ |
960 | .tv = 1, | 1086 | .name = name_tv_mono, |
961 | },{ | 1087 | .vmux = 1, |
962 | .name = name_comp1, | 1088 | .amux = LINE2, |
963 | .vmux = 3, | 1089 | .tv = 1, |
964 | .amux = LINE1, | 1090 | },{ |
965 | },{ | 1091 | .name = name_comp1, |
966 | .name = name_svideo, | 1092 | .vmux = 3, |
967 | .vmux = 8, | 1093 | .amux = LINE1, |
968 | .amux = LINE1, | 1094 | },{ |
1095 | .name = name_svideo, | ||
1096 | .vmux = 8, | ||
1097 | .amux = LINE1, | ||
1098 | },{ | ||
1099 | .name = "CVid over SVid", | ||
1100 | .vmux = 0, | ||
1101 | .amux = LINE1, | ||
1102 | }}, | ||
1103 | .radio = { | ||
1104 | .name = name_radio, | ||
1105 | .amux = LINE2, | ||
1106 | }, | ||
1107 | }, | ||
1108 | [SAA7134_BOARD_ECS_TVP3XP_4CB5] = { | ||
1109 | .name = "Elitegroup ECS TVP3XP FM1236 Tuner Card (NTSC,FM)", | ||
1110 | .audio_clock = 0x187de7, | ||
1111 | .tuner_type = TUNER_PHILIPS_NTSC, | ||
1112 | .radio_type = UNSET, | ||
1113 | .tuner_addr = ADDR_UNSET, | ||
1114 | .radio_addr = ADDR_UNSET, | ||
1115 | .inputs = {{ | ||
1116 | .name = name_tv, | ||
1117 | .vmux = 1, | ||
1118 | .amux = TV, | ||
1119 | .tv = 1, | ||
1120 | },{ | ||
1121 | .name = name_tv_mono, | ||
1122 | .vmux = 1, | ||
1123 | .amux = LINE2, | ||
1124 | .tv = 1, | ||
1125 | },{ | ||
1126 | .name = name_comp1, | ||
1127 | .vmux = 3, | ||
1128 | .amux = LINE1, | ||
1129 | },{ | ||
1130 | .name = name_svideo, | ||
1131 | .vmux = 8, | ||
1132 | .amux = LINE1, | ||
969 | },{ | 1133 | },{ |
970 | .name = "CVid over SVid", | 1134 | .name = "CVid over SVid", |
971 | .vmux = 0, | 1135 | .vmux = 0, |
972 | .amux = LINE1, | 1136 | .amux = LINE1, |
973 | }}, | 1137 | }}, |
974 | .radio = { | 1138 | .radio = { |
975 | .name = name_radio, | 1139 | .name = name_radio, |
976 | .amux = LINE2, | 1140 | .amux = LINE2, |
977 | }, | 1141 | }, |
978 | }, | 1142 | }, |
979 | [SAA7134_BOARD_ECS_TVP3XP_4CB5] = { | ||
980 | .name = "Elitegroup ECS TVP3XP FM1236 Tuner Card (NTSC,FM)", | ||
981 | .audio_clock = 0x187de7, | ||
982 | .tuner_type = TUNER_PHILIPS_NTSC, | ||
983 | .inputs = {{ | ||
984 | .name = name_tv, | ||
985 | .vmux = 1, | ||
986 | .amux = TV, | ||
987 | .tv = 1, | ||
988 | },{ | ||
989 | .name = name_tv_mono, | ||
990 | .vmux = 1, | ||
991 | .amux = LINE2, | ||
992 | .tv = 1, | ||
993 | },{ | ||
994 | .name = name_comp1, | ||
995 | .vmux = 3, | ||
996 | .amux = LINE1, | ||
997 | },{ | ||
998 | .name = name_svideo, | ||
999 | .vmux = 8, | ||
1000 | .amux = LINE1, | ||
1001 | },{ | ||
1002 | .name = "CVid over SVid", | ||
1003 | .vmux = 0, | ||
1004 | .amux = LINE1, | ||
1005 | }}, | ||
1006 | .radio = { | ||
1007 | .name = name_radio, | ||
1008 | .amux = LINE2, | ||
1009 | }, | ||
1010 | }, | ||
1011 | [SAA7134_BOARD_AVACSSMARTTV] = { | 1143 | [SAA7134_BOARD_AVACSSMARTTV] = { |
1012 | /* Roman Pszonczenko <romka@kolos.math.uni.lodz.pl> */ | 1144 | /* Roman Pszonczenko <romka@kolos.math.uni.lodz.pl> */ |
1013 | .name = "AVACS SmartTV", | 1145 | .name = "AVACS SmartTV", |
1014 | .audio_clock = 0x00187de7, | 1146 | .audio_clock = 0x00187de7, |
1015 | .tuner_type = TUNER_PHILIPS_PAL, | 1147 | .tuner_type = TUNER_PHILIPS_PAL, |
1148 | .radio_type = UNSET, | ||
1149 | .tuner_addr = ADDR_UNSET, | ||
1150 | .radio_addr = ADDR_UNSET, | ||
1016 | .inputs = {{ | 1151 | .inputs = {{ |
1017 | .name = name_tv, | 1152 | .name = name_tv, |
1018 | .vmux = 1, | 1153 | .vmux = 1, |
1019 | .amux = TV, | 1154 | .amux = TV, |
1020 | .tv = 1, | 1155 | .tv = 1, |
1021 | },{ | 1156 | },{ |
1022 | .name = name_tv_mono, | 1157 | .name = name_tv_mono, |
1023 | .vmux = 1, | 1158 | .vmux = 1, |
1024 | .amux = LINE2, | 1159 | .amux = LINE2, |
@@ -1047,38 +1182,46 @@ struct saa7134_board saa7134_boards[] = { | |||
1047 | .name = "AVerMedia DVD EZMaker", | 1182 | .name = "AVerMedia DVD EZMaker", |
1048 | .audio_clock = 0x00187de7, | 1183 | .audio_clock = 0x00187de7, |
1049 | .tuner_type = TUNER_ABSENT, | 1184 | .tuner_type = TUNER_ABSENT, |
1185 | .radio_type = UNSET, | ||
1186 | .tuner_addr = ADDR_UNSET, | ||
1187 | .radio_addr = ADDR_UNSET, | ||
1188 | .inputs = {{ | ||
1189 | .name = name_comp1, | ||
1190 | .vmux = 3, | ||
1191 | },{ | ||
1192 | .name = name_svideo, | ||
1193 | .vmux = 8, | ||
1194 | }}, | ||
1195 | }, | ||
1196 | [SAA7134_BOARD_NOVAC_PRIMETV7133] = { | ||
1197 | /* toshii@netbsd.org */ | ||
1198 | .name = "Noval Prime TV 7133", | ||
1199 | .audio_clock = 0x00200000, | ||
1200 | .tuner_type = TUNER_ALPS_TSBH1_NTSC, | ||
1201 | .radio_type = UNSET, | ||
1202 | .tuner_addr = ADDR_UNSET, | ||
1203 | .radio_addr = ADDR_UNSET, | ||
1050 | .inputs = {{ | 1204 | .inputs = {{ |
1051 | .name = name_comp1, | 1205 | .name = name_comp1, |
1052 | .vmux = 3, | 1206 | .vmux = 3, |
1053 | },{ | 1207 | },{ |
1208 | .name = name_tv, | ||
1209 | .vmux = 1, | ||
1210 | .amux = TV, | ||
1211 | .tv = 1, | ||
1212 | },{ | ||
1054 | .name = name_svideo, | 1213 | .name = name_svideo, |
1055 | .vmux = 8, | 1214 | .vmux = 8, |
1056 | }}, | 1215 | }}, |
1057 | }, | 1216 | }, |
1058 | [SAA7134_BOARD_NOVAC_PRIMETV7133] = { | ||
1059 | /* toshii@netbsd.org */ | ||
1060 | .name = "Noval Prime TV 7133", | ||
1061 | .audio_clock = 0x00200000, | ||
1062 | .tuner_type = TUNER_ALPS_TSBH1_NTSC, | ||
1063 | .inputs = {{ | ||
1064 | .name = name_comp1, | ||
1065 | .vmux = 3, | ||
1066 | },{ | ||
1067 | .name = name_tv, | ||
1068 | .vmux = 1, | ||
1069 | .amux = TV, | ||
1070 | .tv = 1, | ||
1071 | },{ | ||
1072 | .name = name_svideo, | ||
1073 | .vmux = 8, | ||
1074 | }}, | ||
1075 | }, | ||
1076 | [SAA7134_BOARD_AVERMEDIA_STUDIO_305] = { | 1217 | [SAA7134_BOARD_AVERMEDIA_STUDIO_305] = { |
1077 | .name = "AverMedia AverTV Studio 305", | 1218 | .name = "AverMedia AverTV Studio 305", |
1078 | .audio_clock = 0x00187de7, | 1219 | .audio_clock = 0x00187de7, |
1079 | .tuner_type = TUNER_PHILIPS_FM1256_IH3, | 1220 | .tuner_type = TUNER_PHILIPS_FM1256_IH3, |
1221 | .radio_type = UNSET, | ||
1222 | .tuner_addr = ADDR_UNSET, | ||
1223 | .radio_addr = ADDR_UNSET, | ||
1080 | .tda9887_conf = TDA9887_PRESENT, | 1224 | .tda9887_conf = TDA9887_PRESENT, |
1081 | .gpiomask = 0x3, | ||
1082 | .inputs = {{ | 1225 | .inputs = {{ |
1083 | .name = name_tv, | 1226 | .name = name_tv, |
1084 | .vmux = 1, | 1227 | .vmux = 1, |
@@ -1098,35 +1241,41 @@ struct saa7134_board saa7134_boards[] = { | |||
1098 | .amux = LINE2, | 1241 | .amux = LINE2, |
1099 | }}, | 1242 | }}, |
1100 | .radio = { | 1243 | .radio = { |
1101 | .name = name_radio, | 1244 | .name = name_radio, |
1102 | .amux = LINE2, | 1245 | .amux = LINE2, |
1103 | }, | 1246 | }, |
1104 | .mute = { | 1247 | .mute = { |
1105 | .name = name_mute, | 1248 | .name = name_mute, |
1106 | .amux = LINE1, | 1249 | .amux = LINE1, |
1107 | }, | 1250 | }, |
1108 | }, | 1251 | }, |
1109 | [SAA7133_BOARD_UPMOST_PURPLE_TV] = { | 1252 | [SAA7134_BOARD_UPMOST_PURPLE_TV] = { |
1110 | .name = "UPMOST PURPLE TV", | 1253 | .name = "UPMOST PURPLE TV", |
1111 | .audio_clock = 0x00187de7, | 1254 | .audio_clock = 0x00187de7, |
1112 | .tuner_type = TUNER_PHILIPS_FM1236_MK3, | 1255 | .tuner_type = TUNER_PHILIPS_FM1236_MK3, |
1113 | .tda9887_conf = TDA9887_PRESENT, | 1256 | .radio_type = UNSET, |
1114 | .inputs = {{ | 1257 | .tuner_addr = ADDR_UNSET, |
1115 | .name = name_tv, | 1258 | .radio_addr = ADDR_UNSET, |
1116 | .vmux = 7, | 1259 | .tda9887_conf = TDA9887_PRESENT, |
1117 | .amux = TV, | 1260 | .inputs = {{ |
1118 | .tv = 1, | 1261 | .name = name_tv, |
1119 | },{ | 1262 | .vmux = 7, |
1120 | .name = name_svideo, | 1263 | .amux = TV, |
1121 | .vmux = 7, | 1264 | .tv = 1, |
1122 | .amux = LINE1, | 1265 | },{ |
1123 | }}, | 1266 | .name = name_svideo, |
1267 | .vmux = 7, | ||
1268 | .amux = LINE1, | ||
1269 | }}, | ||
1124 | }, | 1270 | }, |
1125 | [SAA7134_BOARD_ITEMS_MTV005] = { | 1271 | [SAA7134_BOARD_ITEMS_MTV005] = { |
1126 | /* Norman Jonas <normanjonas@arcor.de> */ | 1272 | /* Norman Jonas <normanjonas@arcor.de> */ |
1127 | .name = "Items MuchTV Plus / IT-005", | 1273 | .name = "Items MuchTV Plus / IT-005", |
1128 | .audio_clock = 0x00187de7, | 1274 | .audio_clock = 0x00187de7, |
1129 | .tuner_type = TUNER_PHILIPS_PAL, | 1275 | .tuner_type = TUNER_PHILIPS_PAL, |
1276 | .radio_type = UNSET, | ||
1277 | .tuner_addr = ADDR_UNSET, | ||
1278 | .radio_addr = ADDR_UNSET, | ||
1130 | .inputs = {{ | 1279 | .inputs = {{ |
1131 | .name = name_tv, | 1280 | .name = name_tv, |
1132 | .vmux = 3, | 1281 | .vmux = 3, |
@@ -1150,27 +1299,30 @@ struct saa7134_board saa7134_boards[] = { | |||
1150 | .name = "Terratec Cinergy 200 TV", | 1299 | .name = "Terratec Cinergy 200 TV", |
1151 | .audio_clock = 0x00200000, | 1300 | .audio_clock = 0x00200000, |
1152 | .tuner_type = TUNER_PHILIPS_PAL, | 1301 | .tuner_type = TUNER_PHILIPS_PAL, |
1302 | .radio_type = UNSET, | ||
1303 | .tuner_addr = ADDR_UNSET, | ||
1304 | .radio_addr = ADDR_UNSET, | ||
1153 | .inputs = {{ | 1305 | .inputs = {{ |
1154 | .name = name_tv, | 1306 | .name = name_tv, |
1155 | .vmux = 1, | 1307 | .vmux = 1, |
1156 | .amux = LINE2, | 1308 | .amux = LINE2, |
1157 | .tv = 1, | 1309 | .tv = 1, |
1158 | },{ | 1310 | },{ |
1159 | .name = name_comp1, | 1311 | .name = name_comp1, |
1160 | .vmux = 4, | 1312 | .vmux = 4, |
1161 | .amux = LINE1, | 1313 | .amux = LINE1, |
1162 | },{ | 1314 | },{ |
1163 | .name = name_svideo, | 1315 | .name = name_svideo, |
1164 | .vmux = 8, | 1316 | .vmux = 8, |
1165 | .amux = LINE1, | 1317 | .amux = LINE1, |
1166 | },{ | 1318 | },{ |
1167 | .name = name_comp2, // CVideo over SVideo Connector | 1319 | .name = name_comp2, /* CVideo over SVideo Connector */ |
1168 | .vmux = 0, | 1320 | .vmux = 0, |
1169 | .amux = LINE1, | 1321 | .amux = LINE1, |
1170 | }}, | 1322 | }}, |
1171 | .mute = { | 1323 | .mute = { |
1172 | .name = name_mute, | 1324 | .name = name_mute, |
1173 | .amux = LINE2, | 1325 | .amux = LINE2, |
1174 | }, | 1326 | }, |
1175 | }, | 1327 | }, |
1176 | [SAA7134_BOARD_VIDEOMATE_TV_PVR] = { | 1328 | [SAA7134_BOARD_VIDEOMATE_TV_PVR] = { |
@@ -1178,84 +1330,96 @@ struct saa7134_board saa7134_boards[] = { | |||
1178 | .name = "Compro VideoMate TV PVR/FM", | 1330 | .name = "Compro VideoMate TV PVR/FM", |
1179 | .audio_clock = 0x00187de7, | 1331 | .audio_clock = 0x00187de7, |
1180 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 1332 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
1333 | .radio_type = UNSET, | ||
1334 | .tuner_addr = ADDR_UNSET, | ||
1335 | .radio_addr = ADDR_UNSET, | ||
1181 | .gpiomask = 0x808c0080, | 1336 | .gpiomask = 0x808c0080, |
1182 | .inputs = {{ | 1337 | .inputs = {{ |
1183 | .name = name_svideo, | 1338 | .name = name_svideo, |
1184 | .vmux = 8, | 1339 | .vmux = 8, |
1185 | .amux = LINE1, | 1340 | .amux = LINE1, |
1186 | .gpio = 0x00080, | 1341 | .gpio = 0x00080, |
1187 | },{ | 1342 | },{ |
1188 | .name = name_comp1, | 1343 | .name = name_comp1, |
1189 | .vmux = 3, | 1344 | .vmux = 3, |
1190 | .amux = LINE1, | 1345 | .amux = LINE1, |
1191 | .gpio = 0x00080, | 1346 | .gpio = 0x00080, |
1192 | },{ | 1347 | },{ |
1193 | .name = name_tv, | 1348 | .name = name_tv, |
1194 | .vmux = 1, | 1349 | .vmux = 1, |
1195 | .amux = LINE2_LEFT, | 1350 | .amux = LINE2_LEFT, |
1196 | .tv = 1, | 1351 | .tv = 1, |
1197 | .gpio = 0x00080, | 1352 | .gpio = 0x00080, |
1198 | }}, | 1353 | }}, |
1199 | .radio = { | 1354 | .radio = { |
1200 | .name = name_radio, | 1355 | .name = name_radio, |
1201 | .amux = LINE2, | 1356 | .amux = LINE2, |
1202 | .gpio = 0x80000, | 1357 | .gpio = 0x80000, |
1203 | }, | 1358 | }, |
1204 | .mute = { | 1359 | .mute = { |
1205 | .name = name_mute, | 1360 | .name = name_mute, |
1206 | .amux = LINE2, | 1361 | .amux = LINE2, |
1207 | .gpio = 0x40000, | 1362 | .gpio = 0x40000, |
1208 | }, | 1363 | }, |
1209 | }, | 1364 | }, |
1210 | [SAA7134_BOARD_SABRENT_SBTTVFM] = { | 1365 | [SAA7134_BOARD_SABRENT_SBTTVFM] = { |
1211 | /* Michael Rodriguez-Torrent <mrtorrent@asu.edu> */ | 1366 | /* Michael Rodriguez-Torrent <mrtorrent@asu.edu> */ |
1212 | .name = "Sabrent SBT-TVFM (saa7130)", | 1367 | .name = "Sabrent SBT-TVFM (saa7130)", |
1213 | .audio_clock = 0x00187de7, | 1368 | .audio_clock = 0x00187de7, |
1214 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 1369 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
1215 | .inputs = {{ | 1370 | .radio_type = UNSET, |
1371 | .tuner_addr = ADDR_UNSET, | ||
1372 | .radio_addr = ADDR_UNSET, | ||
1373 | .inputs = {{ | ||
1216 | .name = name_comp1, | 1374 | .name = name_comp1, |
1217 | .vmux = 1, | 1375 | .vmux = 1, |
1218 | .amux = LINE2, | 1376 | .amux = LINE2, |
1219 | },{ | 1377 | },{ |
1220 | .name = name_tv, | 1378 | .name = name_tv, |
1221 | .vmux = 3, | 1379 | .vmux = 3, |
1222 | .amux = LINE2, | 1380 | .amux = LINE2, |
1223 | .tv = 1, | 1381 | .tv = 1, |
1224 | },{ | 1382 | },{ |
1225 | .name = name_svideo, | 1383 | .name = name_svideo, |
1226 | .vmux = 8, | 1384 | .vmux = 8, |
1227 | .amux = LINE2, | 1385 | .amux = LINE2, |
1228 | }}, | 1386 | }}, |
1229 | .radio = { | 1387 | .radio = { |
1230 | .name = name_radio, | 1388 | .name = name_radio, |
1231 | .amux = LINE2, | 1389 | .amux = LINE2, |
1232 | }, | 1390 | }, |
1233 | }, | 1391 | }, |
1234 | [SAA7134_BOARD_ZOLID_XPERT_TV7134] = { | 1392 | [SAA7134_BOARD_ZOLID_XPERT_TV7134] = { |
1235 | /* Helge Jensen <helge.jensen@slog.dk> */ | 1393 | /* Helge Jensen <helge.jensen@slog.dk> */ |
1236 | .name = ":Zolid Xpert TV7134", | 1394 | .name = ":Zolid Xpert TV7134", |
1237 | .audio_clock = 0x00187de7, | 1395 | .audio_clock = 0x00187de7, |
1238 | .tuner_type = TUNER_PHILIPS_NTSC, | 1396 | .tuner_type = TUNER_PHILIPS_NTSC, |
1239 | .inputs = {{ | 1397 | .radio_type = UNSET, |
1398 | .tuner_addr = ADDR_UNSET, | ||
1399 | .radio_addr = ADDR_UNSET, | ||
1400 | .inputs = {{ | ||
1240 | .name = name_svideo, | 1401 | .name = name_svideo, |
1241 | .vmux = 8, | 1402 | .vmux = 8, |
1242 | .amux = LINE1, | 1403 | .amux = LINE1, |
1243 | },{ | 1404 | },{ |
1244 | .name = name_comp1, | 1405 | .name = name_comp1, |
1245 | .vmux = 3, | 1406 | .vmux = 3, |
1246 | .amux = LINE1, | 1407 | .amux = LINE1, |
1247 | },{ | 1408 | },{ |
1248 | .name = name_tv, | 1409 | .name = name_tv, |
1249 | .vmux = 1, | 1410 | .vmux = 1, |
1250 | .amux = LINE2, | 1411 | .amux = LINE2, |
1251 | .tv = 1, | 1412 | .tv = 1, |
1252 | }}, | 1413 | }}, |
1253 | }, | 1414 | }, |
1254 | [SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE] = { | 1415 | [SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE] = { |
1255 | /* "Matteo Az" <matte.az@nospam.libero.it> ;-) */ | 1416 | /* "Matteo Az" <matte.az@nospam.libero.it> ;-) */ |
1256 | .name = "Empire PCI TV-Radio LE", | 1417 | .name = "Empire PCI TV-Radio LE", |
1257 | .audio_clock = 0x00187de7, | 1418 | .audio_clock = 0x00187de7, |
1258 | .tuner_type = TUNER_PHILIPS_PAL, | 1419 | .tuner_type = TUNER_PHILIPS_PAL, |
1420 | .radio_type = UNSET, | ||
1421 | .tuner_addr = ADDR_UNSET, | ||
1422 | .radio_addr = ADDR_UNSET, | ||
1259 | .gpiomask = 0x4000, | 1423 | .gpiomask = 0x4000, |
1260 | .inputs = {{ | 1424 | .inputs = {{ |
1261 | .name = name_tv_mono, | 1425 | .name = name_tv_mono, |
@@ -1274,18 +1438,18 @@ struct saa7134_board saa7134_boards[] = { | |||
1274 | .amux = LINE1, | 1438 | .amux = LINE1, |
1275 | .gpio = 0x8000, | 1439 | .gpio = 0x8000, |
1276 | }}, | 1440 | }}, |
1277 | .radio = { | 1441 | .radio = { |
1278 | .name = name_radio, | 1442 | .name = name_radio, |
1279 | .amux = LINE1, | 1443 | .amux = LINE1, |
1280 | .gpio = 0x8000, | 1444 | .gpio = 0x8000, |
1281 | }, | 1445 | }, |
1282 | .mute = { | 1446 | .mute = { |
1283 | .name = name_mute, | 1447 | .name = name_mute, |
1284 | .amux = TV, | 1448 | .amux = TV, |
1285 | .gpio =0x8000, | 1449 | .gpio =0x8000, |
1286 | } | 1450 | } |
1287 | }, | 1451 | }, |
1288 | [SAA7134_BOARD_AVERMEDIA_307] = { | 1452 | [SAA7134_BOARD_AVERMEDIA_STUDIO_307] = { |
1289 | /* | 1453 | /* |
1290 | Nickolay V. Shmyrev <nshmyrev@yandex.ru> | 1454 | Nickolay V. Shmyrev <nshmyrev@yandex.ru> |
1291 | Lots of thanks to Andrey Zolotarev <zolotarev_andrey@mail.ru> | 1455 | Lots of thanks to Andrey Zolotarev <zolotarev_andrey@mail.ru> |
@@ -1293,6 +1457,9 @@ struct saa7134_board saa7134_boards[] = { | |||
1293 | .name = "Avermedia AVerTV Studio 307", | 1457 | .name = "Avermedia AVerTV Studio 307", |
1294 | .audio_clock = 0x00187de7, | 1458 | .audio_clock = 0x00187de7, |
1295 | .tuner_type = TUNER_PHILIPS_FM1256_IH3, | 1459 | .tuner_type = TUNER_PHILIPS_FM1256_IH3, |
1460 | .radio_type = UNSET, | ||
1461 | .tuner_addr = ADDR_UNSET, | ||
1462 | .radio_addr = ADDR_UNSET, | ||
1296 | .tda9887_conf = TDA9887_PRESENT, | 1463 | .tda9887_conf = TDA9887_PRESENT, |
1297 | .gpiomask = 0x03, | 1464 | .gpiomask = 0x03, |
1298 | .inputs = {{ | 1465 | .inputs = {{ |
@@ -1322,16 +1489,61 @@ struct saa7134_board saa7134_boards[] = { | |||
1322 | .amux = LINE1, | 1489 | .amux = LINE1, |
1323 | .gpio = 0x01, | 1490 | .gpio = 0x01, |
1324 | }, | 1491 | }, |
1325 | }, | 1492 | .mute = { |
1326 | [SAA7134_BOARD_AVERMEDIA_CARDBUS] = { | 1493 | .name = name_mute, |
1327 | /* Jon Westgate <oryn@oryn.fsck.tv> */ | 1494 | .amux = LINE1, |
1328 | .name = "AVerMedia Cardbus TV/Radio", | 1495 | .gpio = 0x00, |
1329 | .audio_clock = 0x00200000, | 1496 | }, |
1330 | .tuner_type = TUNER_PHILIPS_PAL, | 1497 | }, |
1498 | [SAA7134_BOARD_AVERMEDIA_GO_007_FM] = { | ||
1499 | .name = "Avermedia AVerTV GO 007 FM", | ||
1500 | .audio_clock = 0x00187de7, | ||
1501 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
1502 | .radio_type = UNSET, | ||
1503 | .tuner_addr = ADDR_UNSET, | ||
1504 | .radio_addr = ADDR_UNSET, | ||
1505 | .gpiomask = 0x00300003, | ||
1506 | /* .gpiomask = 0x8c240003, */ | ||
1331 | .inputs = {{ | 1507 | .inputs = {{ |
1332 | .name = name_tv, | 1508 | .name = name_tv, |
1333 | .vmux = 1, | 1509 | .vmux = 1, |
1510 | .amux = TV, | ||
1511 | .tv = 1, | ||
1512 | .gpio = 0x01, | ||
1513 | },{ | ||
1514 | .name = name_comp1, | ||
1515 | .vmux = 0, | ||
1516 | .amux = LINE2, | ||
1517 | .gpio = 0x02, | ||
1518 | },{ | ||
1519 | .name = name_svideo, | ||
1520 | .vmux = 6, | ||
1334 | .amux = LINE2, | 1521 | .amux = LINE2, |
1522 | .gpio = 0x02, | ||
1523 | }}, | ||
1524 | .radio = { | ||
1525 | .name = name_radio, | ||
1526 | .amux = LINE1, | ||
1527 | .gpio = 0x00300001, | ||
1528 | }, | ||
1529 | .mute = { | ||
1530 | .name = name_mute, | ||
1531 | .amux = TV, | ||
1532 | .gpio = 0x01, | ||
1533 | }, | ||
1534 | }, | ||
1535 | [SAA7134_BOARD_AVERMEDIA_CARDBUS] = { | ||
1536 | /* Kees.Blom@cwi.nl */ | ||
1537 | .name = "AVerMedia Cardbus TV/Radio (E500)", | ||
1538 | .audio_clock = 0x187de7, | ||
1539 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
1540 | .radio_type = UNSET, | ||
1541 | .tuner_addr = ADDR_UNSET, | ||
1542 | .radio_addr = ADDR_UNSET, | ||
1543 | .inputs = {{ | ||
1544 | .name = name_tv, | ||
1545 | .vmux = 1, | ||
1546 | .amux = TV, | ||
1335 | .tv = 1, | 1547 | .tv = 1, |
1336 | },{ | 1548 | },{ |
1337 | .name = name_comp1, | 1549 | .name = name_comp1, |
@@ -1340,10 +1552,10 @@ struct saa7134_board saa7134_boards[] = { | |||
1340 | },{ | 1552 | },{ |
1341 | .name = name_svideo, | 1553 | .name = name_svideo, |
1342 | .vmux = 8, | 1554 | .vmux = 8, |
1343 | .amux = LINE2, | 1555 | .amux = LINE1, |
1344 | }}, | 1556 | }}, |
1345 | .radio = { | 1557 | .radio = { |
1346 | .name = name_radio, | 1558 | .name = name_radio, |
1347 | .amux = LINE1, | 1559 | .amux = LINE1, |
1348 | }, | 1560 | }, |
1349 | }, | 1561 | }, |
@@ -1351,119 +1563,134 @@ struct saa7134_board saa7134_boards[] = { | |||
1351 | .name = "Terratec Cinergy 400 mobile", | 1563 | .name = "Terratec Cinergy 400 mobile", |
1352 | .audio_clock = 0x187de7, | 1564 | .audio_clock = 0x187de7, |
1353 | .tuner_type = TUNER_ALPS_TSBE5_PAL, | 1565 | .tuner_type = TUNER_ALPS_TSBE5_PAL, |
1354 | .tda9887_conf = TDA9887_PRESENT, | 1566 | .radio_type = UNSET, |
1567 | .tuner_addr = ADDR_UNSET, | ||
1568 | .radio_addr = ADDR_UNSET, | ||
1569 | .tda9887_conf = TDA9887_PRESENT, | ||
1355 | .inputs = {{ | 1570 | .inputs = {{ |
1356 | .name = name_tv, | 1571 | .name = name_tv, |
1357 | .vmux = 1, | 1572 | .vmux = 1, |
1358 | .amux = TV, | 1573 | .amux = TV, |
1359 | .tv = 1, | 1574 | .tv = 1, |
1360 | },{ | 1575 | },{ |
1361 | .name = name_tv_mono, | 1576 | .name = name_tv_mono, |
1362 | .vmux = 1, | 1577 | .vmux = 1, |
1363 | .amux = LINE2, | 1578 | .amux = LINE2, |
1364 | .tv = 1, | 1579 | .tv = 1, |
1365 | },{ | 1580 | },{ |
1366 | .name = name_comp1, | 1581 | .name = name_comp1, |
1367 | .vmux = 3, | 1582 | .vmux = 3, |
1368 | .amux = LINE1, | 1583 | .amux = LINE1, |
1369 | },{ | 1584 | },{ |
1370 | .name = name_svideo, | 1585 | .name = name_svideo, |
1371 | .vmux = 8, | 1586 | .vmux = 8, |
1372 | .amux = LINE1, | 1587 | .amux = LINE1, |
1373 | }}, | 1588 | }}, |
1374 | }, | 1589 | }, |
1375 | [SAA7134_BOARD_CINERGY600_MK3] = { | 1590 | [SAA7134_BOARD_CINERGY600_MK3] = { |
1376 | .name = "Terratec Cinergy 600 TV MK3", | 1591 | .name = "Terratec Cinergy 600 TV MK3", |
1377 | .audio_clock = 0x00200000, | 1592 | .audio_clock = 0x00200000, |
1378 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 1593 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
1379 | .tda9887_conf = TDA9887_PRESENT, | 1594 | .radio_type = UNSET, |
1380 | .inputs = {{ | 1595 | .tuner_addr = ADDR_UNSET, |
1381 | .name = name_tv, | 1596 | .radio_addr = ADDR_UNSET, |
1382 | .vmux = 1, | 1597 | .tda9887_conf = TDA9887_PRESENT, |
1383 | .amux = TV, | 1598 | .inputs = {{ |
1384 | .tv = 1, | 1599 | .name = name_tv, |
1385 | },{ | 1600 | .vmux = 1, |
1386 | .name = name_comp1, | 1601 | .amux = TV, |
1387 | .vmux = 4, | 1602 | .tv = 1, |
1388 | .amux = LINE1, | 1603 | },{ |
1389 | },{ | 1604 | .name = name_comp1, |
1390 | .name = name_svideo, | 1605 | .vmux = 4, |
1391 | .vmux = 8, | 1606 | .amux = LINE1, |
1392 | .amux = LINE1, | 1607 | },{ |
1393 | },{ | 1608 | .name = name_svideo, |
1394 | .name = name_comp2, // CVideo over SVideo Connector | 1609 | .vmux = 8, |
1395 | .vmux = 0, | 1610 | .amux = LINE1, |
1396 | .amux = LINE1, | 1611 | },{ |
1397 | }}, | 1612 | .name = name_comp2, /* CVideo over SVideo Connector */ |
1613 | .vmux = 0, | ||
1614 | .amux = LINE1, | ||
1615 | }}, | ||
1616 | .radio = { | ||
1617 | .name = name_radio, | ||
1618 | .amux = LINE2, | ||
1619 | }, | ||
1620 | }, | ||
1621 | [SAA7134_BOARD_VIDEOMATE_GOLD_PLUS] = { | ||
1622 | /* Dylan Walkden <dylan_walkden@hotmail.com> */ | ||
1623 | .name = "Compro VideoMate Gold+ Pal", | ||
1624 | .audio_clock = 0x00187de7, | ||
1625 | .tuner_type = TUNER_PHILIPS_PAL, | ||
1626 | .radio_type = UNSET, | ||
1627 | .tuner_addr = ADDR_UNSET, | ||
1628 | .radio_addr = ADDR_UNSET, | ||
1629 | .gpiomask = 0x1ce780, | ||
1630 | .inputs = {{ | ||
1631 | .name = name_svideo, | ||
1632 | .vmux = 0, /* CVideo over SVideo Connector - ok? */ | ||
1633 | .amux = LINE1, | ||
1634 | .gpio = 0x008080, | ||
1635 | },{ | ||
1636 | .name = name_comp1, | ||
1637 | .vmux = 3, | ||
1638 | .amux = LINE1, | ||
1639 | .gpio = 0x008080, | ||
1640 | },{ | ||
1641 | .name = name_tv, | ||
1642 | .vmux = 1, | ||
1643 | .amux = TV, | ||
1644 | .tv = 1, | ||
1645 | .gpio = 0x008080, | ||
1646 | }}, | ||
1398 | .radio = { | 1647 | .radio = { |
1399 | .name = name_radio, | 1648 | .name = name_radio, |
1400 | .amux = LINE2, | 1649 | .amux = LINE2, |
1401 | }, | 1650 | .gpio = 0x80000, |
1402 | }, | 1651 | }, |
1403 | [SAA7134_BOARD_VIDEOMATE_GOLD_PLUS] = { | 1652 | .mute = { |
1404 | /* Dylan Walkden <dylan_walkden@hotmail.com> */ | 1653 | .name = name_mute, |
1405 | .name = "Compro VideoMate Gold+ Pal", | 1654 | .amux = LINE2, |
1406 | .audio_clock = 0x00187de7, | 1655 | .gpio = 0x0c8000, |
1407 | .tuner_type = TUNER_PHILIPS_PAL, | 1656 | }, |
1408 | .gpiomask = 0x1ce780, | 1657 | }, |
1409 | .inputs = {{ | ||
1410 | .name = name_svideo, | ||
1411 | .vmux = 0, // CVideo over SVideo Connector - ok? | ||
1412 | .amux = LINE1, | ||
1413 | .gpio = 0x008080, | ||
1414 | },{ | ||
1415 | .name = name_comp1, | ||
1416 | .vmux = 3, | ||
1417 | .amux = LINE1, | ||
1418 | .gpio = 0x008080, | ||
1419 | },{ | ||
1420 | .name = name_tv, | ||
1421 | .vmux = 1, | ||
1422 | .amux = TV, | ||
1423 | .tv = 1, | ||
1424 | .gpio = 0x008080, | ||
1425 | }}, | ||
1426 | .radio = { | ||
1427 | .name = name_radio, | ||
1428 | .amux = LINE2, | ||
1429 | .gpio = 0x80000, | ||
1430 | }, | ||
1431 | .mute = { | ||
1432 | .name = name_mute, | ||
1433 | .amux = LINE2, | ||
1434 | .gpio = 0x0c8000, | ||
1435 | }, | ||
1436 | }, | ||
1437 | [SAA7134_BOARD_PINNACLE_300I_DVBT_PAL] = { | 1658 | [SAA7134_BOARD_PINNACLE_300I_DVBT_PAL] = { |
1438 | .name = "Pinnacle PCTV 300i DVB-T + PAL", | 1659 | .name = "Pinnacle PCTV 300i DVB-T + PAL", |
1439 | .audio_clock = 0x00187de7, | 1660 | .audio_clock = 0x00187de7, |
1440 | .tuner_type = TUNER_MT2032, | 1661 | .tuner_type = TUNER_MT2032, |
1441 | .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, | 1662 | .radio_type = UNSET, |
1663 | .tuner_addr = ADDR_UNSET, | ||
1664 | .radio_addr = ADDR_UNSET, | ||
1665 | .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, | ||
1442 | .mpeg = SAA7134_MPEG_DVB, | 1666 | .mpeg = SAA7134_MPEG_DVB, |
1443 | .inputs = {{ | 1667 | .inputs = {{ |
1444 | .name = name_tv, | 1668 | .name = name_tv, |
1445 | .vmux = 3, | 1669 | .vmux = 3, |
1446 | .amux = TV, | 1670 | .amux = TV, |
1447 | .tv = 1, | 1671 | .tv = 1, |
1448 | },{ | 1672 | },{ |
1449 | .name = name_comp1, | 1673 | .name = name_comp1, |
1450 | .vmux = 0, | 1674 | .vmux = 0, |
1451 | .amux = LINE2, | 1675 | .amux = LINE2, |
1452 | },{ | 1676 | },{ |
1453 | .name = name_comp2, | 1677 | .name = name_comp2, |
1454 | .vmux = 1, | 1678 | .vmux = 1, |
1455 | .amux = LINE2, | 1679 | .amux = LINE2, |
1456 | },{ | 1680 | },{ |
1457 | .name = name_svideo, | 1681 | .name = name_svideo, |
1458 | .vmux = 8, | 1682 | .vmux = 8, |
1459 | .amux = LINE2, | 1683 | .amux = LINE2, |
1460 | }}, | 1684 | }}, |
1461 | }, | 1685 | }, |
1462 | [SAA7134_BOARD_PROVIDEO_PV952] = { | 1686 | [SAA7134_BOARD_PROVIDEO_PV952] = { |
1463 | /* andreas.kretschmer@web.de */ | 1687 | /* andreas.kretschmer@web.de */ |
1464 | .name = "ProVideo PV952", | 1688 | .name = "ProVideo PV952", |
1465 | .audio_clock = 0x00187de7, | 1689 | .audio_clock = 0x00187de7, |
1466 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 1690 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
1691 | .radio_type = UNSET, | ||
1692 | .tuner_addr = ADDR_UNSET, | ||
1693 | .radio_addr = ADDR_UNSET, | ||
1467 | .tda9887_conf = TDA9887_PRESENT, | 1694 | .tda9887_conf = TDA9887_PRESENT, |
1468 | .inputs = {{ | 1695 | .inputs = {{ |
1469 | .name = name_comp1, | 1696 | .name = name_comp1, |
@@ -1487,12 +1714,14 @@ struct saa7134_board saa7134_boards[] = { | |||
1487 | }, | 1714 | }, |
1488 | [SAA7134_BOARD_AVERMEDIA_305] = { | 1715 | [SAA7134_BOARD_AVERMEDIA_305] = { |
1489 | /* much like the "studio" version but without radio | 1716 | /* much like the "studio" version but without radio |
1490 | * and another tuner (sirspiritus@yandex.ru) */ | 1717 | * and another tuner (sirspiritus@yandex.ru) */ |
1491 | .name = "AverMedia AverTV/305", | 1718 | .name = "AverMedia AverTV/305", |
1492 | .audio_clock = 0x00187de7, | 1719 | .audio_clock = 0x00187de7, |
1493 | .tuner_type = TUNER_PHILIPS_FQ1216ME, | 1720 | .tuner_type = TUNER_PHILIPS_FQ1216ME, |
1721 | .radio_type = UNSET, | ||
1722 | .tuner_addr = ADDR_UNSET, | ||
1723 | .radio_addr = ADDR_UNSET, | ||
1494 | .tda9887_conf = TDA9887_PRESENT, | 1724 | .tda9887_conf = TDA9887_PRESENT, |
1495 | .gpiomask = 0x3, | ||
1496 | .inputs = {{ | 1725 | .inputs = {{ |
1497 | .name = name_tv, | 1726 | .name = name_tv, |
1498 | .vmux = 1, | 1727 | .vmux = 1, |
@@ -1512,41 +1741,269 @@ struct saa7134_board saa7134_boards[] = { | |||
1512 | .amux = LINE2, | 1741 | .amux = LINE2, |
1513 | }}, | 1742 | }}, |
1514 | .mute = { | 1743 | .mute = { |
1515 | .name = name_mute, | 1744 | .name = name_mute, |
1516 | .amux = LINE1, | 1745 | .amux = LINE1, |
1517 | }, | 1746 | }, |
1518 | }, | 1747 | }, |
1519 | [SAA7134_BOARD_FLYDVBTDUO] = { | 1748 | [SAA7134_BOARD_FLYDVBTDUO] = { |
1520 | /* LifeView FlyDVB-T DUO */ | 1749 | /* LifeView FlyDVB-T DUO */ |
1521 | /* "Nico Sabbi <nsabbi@tiscali.it> */ | 1750 | /* "Nico Sabbi <nsabbi@tiscali.it> Hartmut Hackmann hartmut.hackmann@t-online.de*/ |
1522 | .name = "LifeView FlyDVB-T DUO", | 1751 | .name = "LifeView FlyDVB-T DUO", |
1523 | .audio_clock = 0x00200000, | 1752 | .audio_clock = 0x00200000, |
1524 | .tuner_type = TUNER_PHILIPS_TDA8290, | 1753 | .tuner_type = TUNER_PHILIPS_TDA8290, |
1525 | // .gpiomask = 0xe000, | 1754 | .radio_type = UNSET, |
1755 | .tuner_addr = ADDR_UNSET, | ||
1756 | .radio_addr = ADDR_UNSET, | ||
1757 | .mpeg = SAA7134_MPEG_DVB, | ||
1758 | .inputs = {{ | ||
1759 | .name = name_tv, | ||
1760 | .vmux = 1, | ||
1761 | .amux = TV, | ||
1762 | .tv = 1, | ||
1763 | },{ | ||
1764 | .name = name_comp1, /* Composite signal on S-Video input */ | ||
1765 | .vmux = 0, | ||
1766 | .amux = LINE2, | ||
1767 | },{ | ||
1768 | .name = name_comp2, /* Composite input */ | ||
1769 | .vmux = 3, | ||
1770 | .amux = LINE2, | ||
1771 | },{ | ||
1772 | .name = name_svideo, /* S-Video signal on S-Video input */ | ||
1773 | .vmux = 8, | ||
1774 | .amux = LINE2, | ||
1775 | }}, | ||
1776 | }, | ||
1777 | [SAA7134_BOARD_PHILIPS_TOUGH] = { | ||
1778 | .name = "Philips TOUGH DVB-T reference design", | ||
1779 | .tuner_type = TUNER_ABSENT, | ||
1780 | .audio_clock = 0x00187de7, | ||
1781 | .radio_type = UNSET, | ||
1782 | .tuner_addr = ADDR_UNSET, | ||
1783 | .radio_addr = ADDR_UNSET, | ||
1784 | .mpeg = SAA7134_MPEG_DVB, | ||
1785 | .inputs = {{ | ||
1786 | .name = name_comp1, | ||
1787 | .vmux = 0, | ||
1788 | .amux = LINE1, | ||
1789 | },{ | ||
1790 | .name = name_svideo, | ||
1791 | .vmux = 8, | ||
1792 | .amux = LINE1, | ||
1793 | }}, | ||
1794 | }, | ||
1795 | [SAA7134_BOARD_AVERMEDIA_307] = { | ||
1796 | /* | ||
1797 | Davydov Vladimir <vladimir@iqmedia.com> | ||
1798 | */ | ||
1799 | .name = "Avermedia AVerTV 307", | ||
1800 | .audio_clock = 0x00187de7, | ||
1801 | .tuner_type = TUNER_PHILIPS_FQ1216ME, | ||
1802 | .radio_type = UNSET, | ||
1803 | .tuner_addr = ADDR_UNSET, | ||
1804 | .radio_addr = ADDR_UNSET, | ||
1805 | .tda9887_conf = TDA9887_PRESENT, | ||
1806 | .inputs = {{ | ||
1807 | .name = name_tv, | ||
1808 | .vmux = 1, | ||
1809 | .amux = TV, | ||
1810 | .tv = 1, | ||
1811 | },{ | ||
1812 | .name = name_comp1, | ||
1813 | .vmux = 0, | ||
1814 | .amux = LINE1, | ||
1815 | },{ | ||
1816 | .name = name_comp2, | ||
1817 | .vmux = 3, | ||
1818 | .amux = LINE1, | ||
1819 | },{ | ||
1820 | .name = name_svideo, | ||
1821 | .vmux = 8, | ||
1822 | .amux = LINE1, | ||
1823 | }}, | ||
1824 | }, | ||
1825 | [SAA7134_BOARD_ADS_INSTANT_TV] = { | ||
1826 | .name = "ADS Tech Instant TV (saa7135)", | ||
1827 | .audio_clock = 0x00187de7, | ||
1828 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
1829 | .radio_type = UNSET, | ||
1830 | .tuner_addr = ADDR_UNSET, | ||
1831 | .radio_addr = ADDR_UNSET, | ||
1832 | .inputs = {{ | ||
1833 | .name = name_tv, | ||
1834 | .vmux = 1, | ||
1835 | .amux = TV, | ||
1836 | .tv = 1, | ||
1837 | },{ | ||
1838 | .name = name_comp1, | ||
1839 | .vmux = 3, | ||
1840 | .amux = LINE2, | ||
1841 | },{ | ||
1842 | .name = name_svideo, | ||
1843 | .vmux = 8, | ||
1844 | .amux = LINE2, | ||
1845 | }}, | ||
1846 | }, | ||
1847 | [SAA7134_BOARD_KWORLD_VSTREAM_XPERT] = { | ||
1848 | .name = "Kworld/Tevion V-Stream Xpert TV PVR7134", | ||
1849 | .audio_clock = 0x00187de7, | ||
1850 | .tuner_type = TUNER_PHILIPS_PAL_I, | ||
1851 | .radio_type = UNSET, | ||
1852 | .tuner_addr = ADDR_UNSET, | ||
1853 | .radio_addr = ADDR_UNSET, | ||
1854 | .gpiomask = 0x0700, | ||
1855 | .inputs = {{ | ||
1856 | .name = name_tv, | ||
1857 | .vmux = 1, | ||
1858 | .amux = TV, | ||
1859 | .tv = 1, | ||
1860 | .gpio = 0x000, | ||
1861 | },{ | ||
1862 | .name = name_comp1, | ||
1863 | .vmux = 3, | ||
1864 | .amux = LINE1, | ||
1865 | .gpio = 0x200, /* gpio by DScaler */ | ||
1866 | },{ | ||
1867 | .name = name_svideo, | ||
1868 | .vmux = 0, | ||
1869 | .amux = LINE1, | ||
1870 | .gpio = 0x200, | ||
1871 | }}, | ||
1872 | .radio = { | ||
1873 | .name = name_radio, | ||
1874 | .amux = LINE1, | ||
1875 | .gpio = 0x100, | ||
1876 | }, | ||
1877 | .mute = { | ||
1878 | .name = name_mute, | ||
1879 | .amux = TV, | ||
1880 | .gpio = 0x000, | ||
1881 | }, | ||
1882 | }, | ||
1883 | [SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS] = { | ||
1884 | .name = "Typhoon DVB-T Duo Digital/Analog Cardbus", | ||
1885 | .audio_clock = 0x00200000, | ||
1886 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
1887 | .radio_type = UNSET, | ||
1888 | .tuner_addr = ADDR_UNSET, | ||
1889 | .radio_addr = ADDR_UNSET, | ||
1890 | .mpeg = SAA7134_MPEG_DVB, | ||
1891 | /* .gpiomask = 0xe000, */ | ||
1526 | .inputs = {{ | 1892 | .inputs = {{ |
1527 | .name = name_tv, | 1893 | .name = name_tv, |
1528 | .vmux = 1, | 1894 | .vmux = 1, |
1529 | .amux = TV, | 1895 | .amux = TV, |
1530 | // .gpio = 0x0000, | 1896 | /* .gpio = 0x0000, */ |
1531 | .tv = 1, | 1897 | .tv = 1, |
1532 | },{ | 1898 | },{ |
1533 | .name = name_comp1, /* Composite signal on S-Video input */ | 1899 | .name = name_comp1, /* Composite signal on S-Video input */ |
1534 | .vmux = 0, | 1900 | .vmux = 0, |
1535 | .amux = LINE2, | 1901 | .amux = LINE2, |
1536 | // .gpio = 0x4000, | 1902 | /* .gpio = 0x4000, */ |
1537 | },{ | 1903 | },{ |
1538 | .name = name_comp2, /* Composite input */ | 1904 | .name = name_comp2, /* Composite input */ |
1539 | .vmux = 3, | 1905 | .vmux = 3, |
1540 | .amux = LINE2, | 1906 | .amux = LINE2, |
1541 | // .gpio = 0x4000, | 1907 | /* .gpio = 0x4000, */ |
1542 | },{ | 1908 | },{ |
1543 | .name = name_svideo, /* S-Video signal on S-Video input */ | 1909 | .name = name_svideo, /* S-Video signal on S-Video input */ |
1544 | .vmux = 8, | 1910 | .vmux = 8, |
1545 | .amux = LINE2, | 1911 | .amux = LINE2, |
1546 | // .gpio = 0x4000, | 1912 | /* .gpio = 0x4000, */ |
1913 | }}, | ||
1914 | .radio = { | ||
1915 | .name = name_radio, | ||
1916 | .amux = LINE2, | ||
1917 | }, | ||
1918 | .mute = { | ||
1919 | .name = name_mute, | ||
1920 | .amux = LINE1, | ||
1921 | }, | ||
1922 | }, | ||
1923 | [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII] = { | ||
1924 | .name = "Compro VideoMate TV Gold+II", | ||
1925 | .audio_clock = 0x002187de7, | ||
1926 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, | ||
1927 | .radio_type = TUNER_TEA5767, | ||
1928 | .tuner_addr = 0x63, | ||
1929 | .radio_addr = 0x60, | ||
1930 | .gpiomask = 0x8c1880, | ||
1931 | .inputs = {{ | ||
1932 | .name = name_svideo, | ||
1933 | .vmux = 0, | ||
1934 | .amux = LINE1, | ||
1935 | .gpio = 0x800800, | ||
1936 | },{ | ||
1937 | .name = name_comp1, | ||
1938 | .vmux = 3, | ||
1939 | .amux = LINE1, | ||
1940 | .gpio = 0x801000, | ||
1941 | },{ | ||
1942 | .name = name_tv, | ||
1943 | .vmux = 1, | ||
1944 | .amux = TV, | ||
1945 | .tv = 1, | ||
1946 | .gpio = 0x800000, | ||
1947 | }}, | ||
1948 | .radio = { | ||
1949 | .name = name_radio, | ||
1950 | .amux = TV, | ||
1951 | .gpio = 0x880000, | ||
1952 | }, | ||
1953 | .mute = { | ||
1954 | .name = name_mute, | ||
1955 | .amux = LINE2, | ||
1956 | .gpio = 0x840000, | ||
1957 | }, | ||
1958 | }, | ||
1959 | [SAA7134_BOARD_KWORLD_XPERT] = { | ||
1960 | /* | ||
1961 | FIXME: | ||
1962 | - Remote control doesn't initialize properly. | ||
1963 | - Audio volume starts muted, | ||
1964 | then gradually increases after channel change. | ||
1965 | - Overlay scaling problems (application error?) | ||
1966 | - Composite S-Video untested. | ||
1967 | From: Konrad Rzepecki <hannibal@megapolis.pl> | ||
1968 | */ | ||
1969 | .name = "Kworld Xpert TV PVR7134", | ||
1970 | .audio_clock = 0x00187de7, | ||
1971 | .tuner_type = TUNER_TENA_9533_DI, | ||
1972 | .radio_type = TUNER_TEA5767, | ||
1973 | .tuner_addr = 0x61, | ||
1974 | .radio_addr = 0x60, | ||
1975 | .gpiomask = 0x0700, | ||
1976 | .inputs = {{ | ||
1977 | .name = name_tv, | ||
1978 | .vmux = 1, | ||
1979 | .amux = TV, | ||
1980 | .tv = 1, | ||
1981 | .gpio = 0x000, | ||
1982 | },{ | ||
1983 | .name = name_comp1, | ||
1984 | .vmux = 3, | ||
1985 | .amux = LINE1, | ||
1986 | .gpio = 0x200, /* gpio by DScaler */ | ||
1987 | },{ | ||
1988 | .name = name_svideo, | ||
1989 | .vmux = 0, | ||
1990 | .amux = LINE1, | ||
1991 | .gpio = 0x200, | ||
1547 | }}, | 1992 | }}, |
1993 | .radio = { | ||
1994 | .name = name_radio, | ||
1995 | .amux = LINE1, | ||
1996 | .gpio = 0x100, | ||
1997 | }, | ||
1998 | .mute = { | ||
1999 | .name = name_mute, | ||
2000 | .amux = TV, | ||
2001 | .gpio = 0x000, | ||
2002 | }, | ||
1548 | }, | 2003 | }, |
1549 | }; | 2004 | }; |
2005 | |||
2006 | |||
1550 | const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); | 2007 | const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); |
1551 | 2008 | ||
1552 | /* ------------------------------------------------------------------ */ | 2009 | /* ------------------------------------------------------------------ */ |
@@ -1559,13 +2016,13 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1559 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2016 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
1560 | .subdevice = 0x2001, | 2017 | .subdevice = 0x2001, |
1561 | .driver_data = SAA7134_BOARD_PROTEUS_PRO, | 2018 | .driver_data = SAA7134_BOARD_PROTEUS_PRO, |
1562 | },{ | 2019 | },{ |
1563 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2020 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1564 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2021 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1565 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2022 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
1566 | .subdevice = 0x2001, | 2023 | .subdevice = 0x2001, |
1567 | .driver_data = SAA7134_BOARD_PROTEUS_PRO, | 2024 | .driver_data = SAA7134_BOARD_PROTEUS_PRO, |
1568 | },{ | 2025 | },{ |
1569 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2026 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1570 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2027 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1571 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2028 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
@@ -1574,70 +2031,70 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1574 | },{ | 2031 | },{ |
1575 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2032 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1576 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2033 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1577 | .subvendor = 0x1131, | 2034 | .subvendor = 0x1131, |
1578 | .subdevice = 0x4e85, | 2035 | .subdevice = 0x4e85, |
1579 | .driver_data = SAA7134_BOARD_MONSTERTV, | 2036 | .driver_data = SAA7134_BOARD_MONSTERTV, |
1580 | },{ | 2037 | },{ |
1581 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2038 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1582 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2039 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1583 | .subvendor = 0x153B, | 2040 | .subvendor = 0x153B, |
1584 | .subdevice = 0x1142, | 2041 | .subdevice = 0x1142, |
1585 | .driver_data = SAA7134_BOARD_CINERGY400, | 2042 | .driver_data = SAA7134_BOARD_CINERGY400, |
1586 | },{ | 2043 | },{ |
1587 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2044 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1588 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2045 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1589 | .subvendor = 0x153B, | 2046 | .subvendor = 0x153B, |
1590 | .subdevice = 0x1143, | 2047 | .subdevice = 0x1143, |
1591 | .driver_data = SAA7134_BOARD_CINERGY600, | 2048 | .driver_data = SAA7134_BOARD_CINERGY600, |
1592 | },{ | 2049 | },{ |
1593 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2050 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1594 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2051 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1595 | .subvendor = 0x153B, | 2052 | .subvendor = 0x153B, |
1596 | .subdevice = 0x1158, | 2053 | .subdevice = 0x1158, |
1597 | .driver_data = SAA7134_BOARD_CINERGY600_MK3, | 2054 | .driver_data = SAA7134_BOARD_CINERGY600_MK3, |
1598 | },{ | 2055 | },{ |
1599 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2056 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1600 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2057 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1601 | .subvendor = 0x153b, | 2058 | .subvendor = 0x153b, |
1602 | .subdevice = 0x1162, | 2059 | .subdevice = 0x1162, |
1603 | .driver_data = SAA7134_BOARD_CINERGY400_CARDBUS, | 2060 | .driver_data = SAA7134_BOARD_CINERGY400_CARDBUS, |
1604 | },{ | 2061 | },{ |
1605 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2062 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1606 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2063 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1607 | .subvendor = 0x5168, | 2064 | .subvendor = 0x5168, |
1608 | .subdevice = 0x0138, | 2065 | .subdevice = 0x0138, |
1609 | .driver_data = SAA7134_BOARD_FLYVIDEO3000, | 2066 | .driver_data = SAA7134_BOARD_FLYVIDEO3000, |
1610 | },{ | 2067 | },{ |
1611 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2068 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1612 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2069 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1613 | .subvendor = 0x4e42, //"Typhoon PCI Capture TV Card" Art.No. 50673 | 2070 | .subvendor = 0x4e42, /* "Typhoon PCI Capture TV Card" Art.No. 50673 */ |
1614 | .subdevice = 0x0138, | 2071 | .subdevice = 0x0138, |
1615 | .driver_data = SAA7134_BOARD_FLYVIDEO3000, | 2072 | .driver_data = SAA7134_BOARD_FLYVIDEO3000, |
1616 | },{ | 2073 | },{ |
1617 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2074 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1618 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2075 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1619 | .subvendor = 0x5168, | 2076 | .subvendor = 0x5168, |
1620 | .subdevice = 0x0138, | 2077 | .subdevice = 0x0138, |
1621 | .driver_data = SAA7134_BOARD_FLYVIDEO2000, | 2078 | .driver_data = SAA7134_BOARD_FLYVIDEO2000, |
1622 | },{ | 2079 | },{ |
1623 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2080 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1624 | .device = PCI_DEVICE_ID_PHILIPS_SAA7135, | 2081 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1625 | .subvendor = 0x5168, | 2082 | .subvendor = 0x5168, |
1626 | .subdevice = 0x0212, /* minipci, LR212 */ | 2083 | .subdevice = 0x0212, /* minipci, LR212 */ |
1627 | .driver_data = SAA7134_BOARD_FLYTVPLATINUM_MINI, | 2084 | .driver_data = SAA7134_BOARD_FLYTVPLATINUM_MINI, |
1628 | },{ | 2085 | },{ |
1629 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2086 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1630 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2087 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1631 | .subvendor = 0x5168, /* Animation Technologies (LifeView) */ | 2088 | .subvendor = 0x5168, /* Animation Technologies (LifeView) */ |
1632 | .subdevice = 0x0214, /* Standard PCI, LR214WF */ | 2089 | .subdevice = 0x0214, /* Standard PCI, LR214WF */ |
1633 | .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM, | 2090 | .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM, |
1634 | },{ | 2091 | },{ |
1635 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2092 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1636 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2093 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1637 | .subvendor = 0x1489, /* KYE */ | 2094 | .subvendor = 0x1489, /* KYE */ |
1638 | .subdevice = 0x0214, /* Genius VideoWonder ProTV */ | 2095 | .subdevice = 0x0214, /* Genius VideoWonder ProTV */ |
1639 | .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM, /* is an LR214WF actually */ | 2096 | .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM, /* is an LR214WF actually */ |
1640 | },{ | 2097 | },{ |
1641 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2098 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1642 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2099 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1643 | .subvendor = 0x16be, | 2100 | .subvendor = 0x16be, |
@@ -1656,36 +2113,36 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1656 | .subdevice = 0x226b, | 2113 | .subdevice = 0x226b, |
1657 | .driver_data = SAA7134_BOARD_ELSA_500TV, | 2114 | .driver_data = SAA7134_BOARD_ELSA_500TV, |
1658 | },{ | 2115 | },{ |
1659 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2116 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1660 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2117 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1661 | .subvendor = PCI_VENDOR_ID_ASUSTEK, | 2118 | .subvendor = PCI_VENDOR_ID_ASUSTEK, |
1662 | .subdevice = 0x4842, | 2119 | .subdevice = 0x4842, |
1663 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, | 2120 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, |
1664 | },{ | 2121 | },{ |
1665 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2122 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1666 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2123 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1667 | .subvendor = PCI_VENDOR_ID_ASUSTEK, | 2124 | .subvendor = PCI_VENDOR_ID_ASUSTEK, |
1668 | .subdevice = 0x4845, | 2125 | .subdevice = 0x4845, |
1669 | .driver_data = SAA7135_BOARD_ASUSTeK_TVFM7135, | 2126 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7135, |
1670 | },{ | 2127 | },{ |
1671 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2128 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1672 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2129 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1673 | .subvendor = PCI_VENDOR_ID_ASUSTEK, | 2130 | .subvendor = PCI_VENDOR_ID_ASUSTEK, |
1674 | .subdevice = 0x4830, | 2131 | .subdevice = 0x4830, |
1675 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, | 2132 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, |
1676 | },{ | 2133 | },{ |
1677 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2134 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1678 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2135 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1679 | .subvendor = PCI_VENDOR_ID_ASUSTEK, | 2136 | .subvendor = PCI_VENDOR_ID_ASUSTEK, |
1680 | .subdevice = 0x4843, | 2137 | .subdevice = 0x4843, |
1681 | .driver_data = SAA7134_BOARD_ASUSTEK_TVFM7133, | 2138 | .driver_data = SAA7134_BOARD_ASUSTEK_TVFM7133, |
2139 | },{ | ||
2140 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2141 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
2142 | .subvendor = PCI_VENDOR_ID_ASUSTEK, | ||
2143 | .subdevice = 0x4840, | ||
2144 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, | ||
1682 | },{ | 2145 | },{ |
1683 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1684 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
1685 | .subvendor = PCI_VENDOR_ID_ASUSTEK, | ||
1686 | .subdevice = 0x4840, | ||
1687 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, | ||
1688 | },{ | ||
1689 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2146 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1690 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2147 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1691 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2148 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
@@ -1706,124 +2163,130 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1706 | },{ | 2163 | },{ |
1707 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2164 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1708 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2165 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1709 | .subvendor = 0x1131, | 2166 | .subvendor = 0x1131, |
1710 | .subdevice = 0x7133, | 2167 | .subdevice = 0x7133, |
1711 | .driver_data = SAA7134_BOARD_VA1000POWER, | 2168 | .driver_data = SAA7134_BOARD_VA1000POWER, |
1712 | },{ | 2169 | },{ |
1713 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2170 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1714 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2171 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1715 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2172 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
1716 | .subdevice = 0x2001, | 2173 | .subdevice = 0x2001, |
1717 | .driver_data = SAA7134_BOARD_10MOONSTVMASTER, | 2174 | .driver_data = SAA7134_BOARD_10MOONSTVMASTER, |
1718 | },{ | 2175 | },{ |
1719 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2176 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1720 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2177 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1721 | .subvendor = 0x185b, | 2178 | .subvendor = 0x185b, |
1722 | .subdevice = 0xc100, | 2179 | .subdevice = 0xc100, |
1723 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV, | 2180 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV, |
1724 | },{ | 2181 | },{ |
1725 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2182 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1726 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2183 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1727 | .subvendor = 0x185b, | 2184 | .subvendor = 0x185b, |
1728 | .subdevice = 0xc100, | 2185 | .subdevice = 0xc100, |
1729 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS, | 2186 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS, |
1730 | },{ | 2187 | },{ |
1731 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2188 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1732 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2189 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1733 | .subvendor = PCI_VENDOR_ID_MATROX, | 2190 | .subvendor = PCI_VENDOR_ID_MATROX, |
1734 | .subdevice = 0x48d0, | 2191 | .subdevice = 0x48d0, |
1735 | .driver_data = SAA7134_BOARD_CRONOS_PLUS, | 2192 | .driver_data = SAA7134_BOARD_CRONOS_PLUS, |
1736 | },{ | 2193 | },{ |
1737 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2194 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1738 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2195 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1739 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2196 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1740 | .subdevice = 0xa70b, | 2197 | .subdevice = 0xa70b, |
1741 | .driver_data = SAA7134_BOARD_MD2819, | 2198 | .driver_data = SAA7134_BOARD_MD2819, |
1742 | },{ | 2199 | },{ |
1743 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2200 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1744 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2201 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1745 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2202 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1746 | .subdevice = 0x2115, | 2203 | .subdevice = 0x2115, |
1747 | .driver_data = SAA7134_BOARD_AVERMEDIA_STUDIO_305, | 2204 | .driver_data = SAA7134_BOARD_AVERMEDIA_STUDIO_305, |
1748 | },{ | 2205 | },{ |
1749 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2206 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1750 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2207 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1751 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2208 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1752 | .subdevice = 0x2108, | 2209 | .subdevice = 0x2108, |
1753 | .driver_data = SAA7134_BOARD_AVERMEDIA_305, | 2210 | .driver_data = SAA7134_BOARD_AVERMEDIA_305, |
1754 | },{ | 2211 | },{ |
1755 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2212 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1756 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2213 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1757 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2214 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1758 | .subdevice = 0x10ff, | 2215 | .subdevice = 0x10ff, |
1759 | .driver_data = SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER, | 2216 | .driver_data = SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER, |
1760 | },{ | 2217 | },{ |
1761 | /* AVerMedia CardBus */ | 2218 | /* AVerMedia CardBus */ |
1762 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2219 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1763 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2220 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1764 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2221 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1765 | .subdevice = 0xd6ee, | 2222 | .subdevice = 0xd6ee, |
1766 | .driver_data = SAA7134_BOARD_AVERMEDIA_CARDBUS, | 2223 | .driver_data = SAA7134_BOARD_AVERMEDIA_CARDBUS, |
1767 | },{ | 2224 | },{ |
1768 | /* TransGear 3000TV */ | 2225 | /* TransGear 3000TV */ |
1769 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2226 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1770 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2227 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1771 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2228 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1772 | .subdevice = 0x050c, | 2229 | .subdevice = 0x050c, |
1773 | .driver_data = SAA7134_BOARD_TG3000TV, | 2230 | .driver_data = SAA7134_BOARD_TG3000TV, |
1774 | },{ | 2231 | },{ |
1775 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1776 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
1777 | .subvendor = 0x11bd, | ||
1778 | .subdevice = 0x002b, | ||
1779 | .driver_data = SAA7134_BOARD_PINNACLE_PCTV_STEREO, | ||
1780 | },{ | ||
1781 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1782 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
1783 | .subvendor = 0x11bd, | ||
1784 | .subdevice = 0x002d, | ||
1785 | .driver_data = SAA7134_BOARD_PINNACLE_300I_DVBT_PAL, | ||
1786 | },{ | ||
1787 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1788 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
1789 | .subvendor = 0x1019, | ||
1790 | .subdevice = 0x4cb4, | ||
1791 | .driver_data = SAA7134_BOARD_ECS_TVP3XP, | ||
1792 | },{ | ||
1793 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1794 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
1795 | .subvendor = 0x1019, | ||
1796 | .subdevice = 0x4cb5, | ||
1797 | .driver_data = SAA7134_BOARD_ECS_TVP3XP_4CB5, | ||
1798 | },{ | ||
1799 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2232 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1800 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2233 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1801 | .subvendor = 0x12ab, | 2234 | .subvendor = 0x11bd, |
1802 | .subdevice = 0x0800, | 2235 | .subdevice = 0x002b, |
1803 | .driver_data = SAA7133_BOARD_UPMOST_PURPLE_TV, | 2236 | .driver_data = SAA7134_BOARD_PINNACLE_PCTV_STEREO, |
2237 | },{ | ||
2238 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2239 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
2240 | .subvendor = 0x11bd, | ||
2241 | .subdevice = 0x002d, | ||
2242 | .driver_data = SAA7134_BOARD_PINNACLE_300I_DVBT_PAL, | ||
2243 | },{ | ||
2244 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2245 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
2246 | .subvendor = 0x1019, | ||
2247 | .subdevice = 0x4cb4, | ||
2248 | .driver_data = SAA7134_BOARD_ECS_TVP3XP, | ||
2249 | },{ | ||
2250 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2251 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
2252 | .subvendor = 0x1019, | ||
2253 | .subdevice = 0x4cb5, | ||
2254 | .driver_data = SAA7134_BOARD_ECS_TVP3XP_4CB5, | ||
2255 | },{ | ||
2256 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2257 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
2258 | .subvendor = 0x12ab, | ||
2259 | .subdevice = 0x0800, | ||
2260 | .driver_data = SAA7134_BOARD_UPMOST_PURPLE_TV, | ||
1804 | },{ | 2261 | },{ |
1805 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2262 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1806 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2263 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1807 | .subvendor = 0x153B, | 2264 | .subvendor = 0x153B, |
1808 | .subdevice = 0x1152, | 2265 | .subdevice = 0x1152, |
1809 | .driver_data = SAA7134_BOARD_CINERGY200, | 2266 | .driver_data = SAA7134_BOARD_CINERGY200, |
1810 | },{ | 2267 | },{ |
1811 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2268 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1812 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2269 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1813 | .subvendor = 0x185b, | 2270 | .subvendor = 0x185b, |
1814 | .subdevice = 0xc100, | 2271 | .subdevice = 0xc100, |
1815 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV_PVR, | 2272 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV_PVR, |
1816 | },{ | 2273 | },{ |
1817 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2274 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1818 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2275 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1819 | .subvendor = 0x1131, | 2276 | .subvendor = 0x1131, |
1820 | .subdevice = 0, | 2277 | .subdevice = 0, |
1821 | .driver_data = SAA7134_BOARD_SABRENT_SBTTVFM, | 2278 | .driver_data = SAA7134_BOARD_SABRENT_SBTTVFM, |
1822 | },{ | 2279 | },{ |
1823 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2280 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1824 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2281 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1825 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2282 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1826 | .subdevice = 0x9715, | 2283 | .subdevice = 0x9715, |
2284 | .driver_data = SAA7134_BOARD_AVERMEDIA_STUDIO_307, | ||
2285 | },{ | ||
2286 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2287 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
2288 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | ||
2289 | .subdevice = 0xa70a, | ||
1827 | .driver_data = SAA7134_BOARD_AVERMEDIA_307, | 2290 | .driver_data = SAA7134_BOARD_AVERMEDIA_307, |
1828 | },{ | 2291 | },{ |
1829 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2292 | .vendor = PCI_VENDOR_ID_PHILIPS, |
@@ -1831,31 +2294,70 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1831 | .subvendor = 0x185b, | 2294 | .subvendor = 0x185b, |
1832 | .subdevice = 0xc200, | 2295 | .subdevice = 0xc200, |
1833 | .driver_data = SAA7134_BOARD_VIDEOMATE_GOLD_PLUS, | 2296 | .driver_data = SAA7134_BOARD_VIDEOMATE_GOLD_PLUS, |
1834 | },{ | 2297 | },{ |
1835 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2298 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1836 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2299 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1837 | .subvendor = 0x1540, | 2300 | .subvendor = 0x1540, |
1838 | .subdevice = 0x9524, | 2301 | .subdevice = 0x9524, |
1839 | .driver_data = SAA7134_BOARD_PROVIDEO_PV952, | 2302 | .driver_data = SAA7134_BOARD_PROVIDEO_PV952, |
1840 | 2303 | ||
1841 | },{ | 2304 | },{ |
1842 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2305 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1843 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2306 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1844 | .subvendor = 0x5168, | 2307 | .subvendor = 0x5168, |
1845 | .subdevice = 0x0306, | 2308 | .subdevice = 0x0502, /* Cardbus version */ |
1846 | .driver_data = SAA7134_BOARD_FLYDVBTDUO, | 2309 | .driver_data = SAA7134_BOARD_FLYDVBTDUO, |
2310 | },{ | ||
2311 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2312 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
2313 | .subvendor = 0x5168, | ||
2314 | .subdevice = 0x0306, /* PCI version */ | ||
2315 | .driver_data = SAA7134_BOARD_FLYDVBTDUO, | ||
2316 | },{ | ||
2317 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2318 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
2319 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | ||
2320 | .subdevice = 0xf31f, | ||
2321 | .driver_data = SAA7134_BOARD_AVERMEDIA_GO_007_FM, | ||
2322 | |||
2323 | },{ | ||
2324 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2325 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | ||
2326 | .subvendor = PCI_VENDOR_ID_PHILIPS, | ||
2327 | .subdevice = 0x2004, | ||
2328 | .driver_data = SAA7134_BOARD_PHILIPS_TOUGH, | ||
2329 | },{ | ||
2330 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2331 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
2332 | .subvendor = 0x1421, | ||
2333 | .subdevice = 0x0350, /* PCI version */ | ||
2334 | .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, | ||
1847 | 2335 | ||
1848 | },{ | 2336 | },{ |
2337 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2338 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
2339 | .subvendor = 0x1421, | ||
2340 | .subdevice = 0x0370, /* cardbus version */ | ||
2341 | .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, | ||
2342 | |||
2343 | },{ /* Typhoon DVB-T Duo Digital/Analog Cardbus */ | ||
2344 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2345 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
2346 | .subvendor = 0x4e42, | ||
2347 | .subdevice = 0x0502, | ||
2348 | .driver_data = SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS, | ||
2349 | |||
2350 | },{ | ||
1849 | /* --- boards without eeprom + subsystem ID --- */ | 2351 | /* --- boards without eeprom + subsystem ID --- */ |
1850 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2352 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1851 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2353 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1852 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2354 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
1853 | .subdevice = 0, | 2355 | .subdevice = 0, |
1854 | .driver_data = SAA7134_BOARD_NOAUTO, | 2356 | .driver_data = SAA7134_BOARD_NOAUTO, |
1855 | },{ | 2357 | },{ |
1856 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2358 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1857 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2359 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1858 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2360 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
1859 | .subdevice = 0, | 2361 | .subdevice = 0, |
1860 | .driver_data = SAA7134_BOARD_NOAUTO, | 2362 | .driver_data = SAA7134_BOARD_NOAUTO, |
1861 | },{ | 2363 | },{ |
@@ -1863,26 +2365,26 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1863 | /* --- default catch --- */ | 2365 | /* --- default catch --- */ |
1864 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2366 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1865 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2367 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1866 | .subvendor = PCI_ANY_ID, | 2368 | .subvendor = PCI_ANY_ID, |
1867 | .subdevice = PCI_ANY_ID, | 2369 | .subdevice = PCI_ANY_ID, |
1868 | .driver_data = SAA7134_BOARD_UNKNOWN, | 2370 | .driver_data = SAA7134_BOARD_UNKNOWN, |
1869 | },{ | 2371 | },{ |
1870 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2372 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1871 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2373 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1872 | .subvendor = PCI_ANY_ID, | 2374 | .subvendor = PCI_ANY_ID, |
1873 | .subdevice = PCI_ANY_ID, | 2375 | .subdevice = PCI_ANY_ID, |
1874 | .driver_data = SAA7134_BOARD_UNKNOWN, | 2376 | .driver_data = SAA7134_BOARD_UNKNOWN, |
1875 | },{ | 2377 | },{ |
1876 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2378 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1877 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2379 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1878 | .subvendor = PCI_ANY_ID, | 2380 | .subvendor = PCI_ANY_ID, |
1879 | .subdevice = PCI_ANY_ID, | 2381 | .subdevice = PCI_ANY_ID, |
1880 | .driver_data = SAA7134_BOARD_UNKNOWN, | 2382 | .driver_data = SAA7134_BOARD_UNKNOWN, |
1881 | },{ | 2383 | },{ |
1882 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2384 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1883 | .device = PCI_DEVICE_ID_PHILIPS_SAA7135, | 2385 | .device = PCI_DEVICE_ID_PHILIPS_SAA7135, |
1884 | .subvendor = PCI_ANY_ID, | 2386 | .subvendor = PCI_ANY_ID, |
1885 | .subdevice = PCI_ANY_ID, | 2387 | .subdevice = PCI_ANY_ID, |
1886 | .driver_data = SAA7134_BOARD_UNKNOWN, | 2388 | .driver_data = SAA7134_BOARD_UNKNOWN, |
1887 | },{ | 2389 | },{ |
1888 | /* --- end of list --- */ | 2390 | /* --- end of list --- */ |
@@ -1893,46 +2395,9 @@ MODULE_DEVICE_TABLE(pci, saa7134_pci_tbl); | |||
1893 | /* ----------------------------------------------------------- */ | 2395 | /* ----------------------------------------------------------- */ |
1894 | /* flyvideo tweaks */ | 2396 | /* flyvideo tweaks */ |
1895 | 2397 | ||
1896 | #if 0 | ||
1897 | static struct { | ||
1898 | char *model; | ||
1899 | int tuner_type; | ||
1900 | } fly_list[0x20] = { | ||
1901 | /* default catch ... */ | ||
1902 | [ 0 ... 0x1f ] = { | ||
1903 | .model = "UNKNOWN", | ||
1904 | .tuner_type = TUNER_ABSENT, | ||
1905 | }, | ||
1906 | /* ... the ones known so far */ | ||
1907 | [ 0x05 ] = { | ||
1908 | .model = "PAL-BG", | ||
1909 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, | ||
1910 | }, | ||
1911 | [ 0x10 ] = { | ||
1912 | .model = "PAL-BG / PAL-DK", | ||
1913 | .tuner_type = TUNER_PHILIPS_PAL, | ||
1914 | }, | ||
1915 | [ 0x15 ] = { | ||
1916 | .model = "NTSC", | ||
1917 | .tuner_type = TUNER_ABSENT /* FIXME */, | ||
1918 | }, | ||
1919 | }; | ||
1920 | #endif | ||
1921 | 2398 | ||
1922 | static void board_flyvideo(struct saa7134_dev *dev) | 2399 | static void board_flyvideo(struct saa7134_dev *dev) |
1923 | { | 2400 | { |
1924 | #if 0 | ||
1925 | /* non-working attempt to detect the correct tuner type ... */ | ||
1926 | u32 value; | ||
1927 | int index; | ||
1928 | |||
1929 | value = dev->gpio_value; | ||
1930 | index = (value & 0x1f00) >> 8; | ||
1931 | printk(KERN_INFO "%s: flyvideo: gpio is 0x%x [model=%s,tuner=%d]\n", | ||
1932 | dev->name, value, fly_list[index].model, | ||
1933 | fly_list[index].tuner_type); | ||
1934 | dev->tuner_type = fly_list[index].tuner_type; | ||
1935 | #endif | ||
1936 | printk("%s: there are different flyvideo cards with different tuners\n" | 2401 | printk("%s: there are different flyvideo cards with different tuners\n" |
1937 | "%s: out there, you might have to use the tuner=<nr> insmod\n" | 2402 | "%s: out there, you might have to use the tuner=<nr> insmod\n" |
1938 | "%s: option to override the default value.\n", | 2403 | "%s: option to override the default value.\n", |
@@ -1943,7 +2408,7 @@ static void board_flyvideo(struct saa7134_dev *dev) | |||
1943 | 2408 | ||
1944 | int saa7134_board_init1(struct saa7134_dev *dev) | 2409 | int saa7134_board_init1(struct saa7134_dev *dev) |
1945 | { | 2410 | { |
1946 | // Always print gpio, often manufacturers encode tuner type and other info. | 2411 | /* Always print gpio, often manufacturers encode tuner type and other info. */ |
1947 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0); | 2412 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0); |
1948 | dev->gpio_value = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); | 2413 | dev->gpio_value = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); |
1949 | printk(KERN_INFO "%s: board init: gpio is %x\n", dev->name, dev->gpio_value); | 2414 | printk(KERN_INFO "%s: board init: gpio is %x\n", dev->name, dev->gpio_value); |
@@ -1961,21 +2426,26 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
1961 | case SAA7134_BOARD_ECS_TVP3XP: | 2426 | case SAA7134_BOARD_ECS_TVP3XP: |
1962 | case SAA7134_BOARD_ECS_TVP3XP_4CB5: | 2427 | case SAA7134_BOARD_ECS_TVP3XP_4CB5: |
1963 | case SAA7134_BOARD_MD2819: | 2428 | case SAA7134_BOARD_MD2819: |
2429 | case SAA7134_BOARD_KWORLD_VSTREAM_XPERT: | ||
2430 | case SAA7134_BOARD_KWORLD_XPERT: | ||
1964 | case SAA7134_BOARD_AVERMEDIA_STUDIO_305: | 2431 | case SAA7134_BOARD_AVERMEDIA_STUDIO_305: |
1965 | case SAA7134_BOARD_AVERMEDIA_305: | 2432 | case SAA7134_BOARD_AVERMEDIA_305: |
2433 | case SAA7134_BOARD_AVERMEDIA_STUDIO_307: | ||
1966 | case SAA7134_BOARD_AVERMEDIA_307: | 2434 | case SAA7134_BOARD_AVERMEDIA_307: |
1967 | // case SAA7134_BOARD_SABRENT_SBTTVFM: /* not finished yet */ | 2435 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM: |
2436 | /* case SAA7134_BOARD_SABRENT_SBTTVFM: */ /* not finished yet */ | ||
1968 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: | 2437 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: |
1969 | dev->has_remote = 1; | 2438 | case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: |
1970 | break; | 2439 | case SAA7134_BOARD_MANLI_MTV001: |
2440 | case SAA7134_BOARD_MANLI_MTV002: | ||
1971 | case SAA7134_BOARD_AVACSSMARTTV: | 2441 | case SAA7134_BOARD_AVACSSMARTTV: |
1972 | dev->has_remote = 1; | 2442 | dev->has_remote = 1; |
1973 | break; | 2443 | break; |
1974 | case SAA7134_BOARD_MD5044: | 2444 | case SAA7134_BOARD_MD5044: |
1975 | printk("%s: seems there are two different versions of the MD5044\n" | 2445 | printk("%s: seems there are two different versions of the MD5044\n" |
1976 | "%s: (with the same ID) out there. If sound doesn't work for\n" | 2446 | "%s: (with the same ID) out there. If sound doesn't work for\n" |
1977 | "%s: you try the audio_clock_override=0x200000 insmod option.\n", | 2447 | "%s: you try the audio_clock_override=0x200000 insmod option.\n", |
1978 | dev->name,dev->name,dev->name); | 2448 | dev->name,dev->name,dev->name); |
1979 | break; | 2449 | break; |
1980 | case SAA7134_BOARD_CINERGY400_CARDBUS: | 2450 | case SAA7134_BOARD_CINERGY400_CARDBUS: |
1981 | /* power-up tuner chip */ | 2451 | /* power-up tuner chip */ |
@@ -1983,11 +2453,19 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
1983 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000); | 2453 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000); |
1984 | msleep(1); | 2454 | msleep(1); |
1985 | break; | 2455 | break; |
2456 | case SAA7134_BOARD_FLYDVBTDUO: | ||
2457 | case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS: | ||
2458 | /* turn the fan on Hac: static for the time being */ | ||
2459 | saa_writeb(SAA7134_GPIO_GPMODE3, 0x08); | ||
2460 | saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x06); | ||
2461 | break; | ||
2462 | case SAA7134_BOARD_AVERMEDIA_CARDBUS: | ||
2463 | /* power-up tuner chip */ | ||
2464 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff); | ||
2465 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff); | ||
2466 | msleep(1); | ||
2467 | break; | ||
1986 | } | 2468 | } |
1987 | if (dev->has_remote) | ||
1988 | dev->irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18 | | ||
1989 | SAA7134_IRQ2_INTE_GPIO18A | | ||
1990 | SAA7134_IRQ2_INTE_GPIO16 ); | ||
1991 | return 0; | 2469 | return 0; |
1992 | } | 2470 | } |
1993 | 2471 | ||
@@ -2008,10 +2486,85 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
2008 | break; | 2486 | break; |
2009 | dev->board = board; | 2487 | dev->board = board; |
2010 | printk("%s: board type fixup: %s\n", dev->name, | 2488 | printk("%s: board type fixup: %s\n", dev->name, |
2011 | saa7134_boards[dev->board].name); | 2489 | saa7134_boards[dev->board].name); |
2012 | dev->tuner_type = saa7134_boards[dev->board].tuner_type; | 2490 | dev->tuner_type = saa7134_boards[dev->board].tuner_type; |
2013 | if (TUNER_ABSENT != dev->tuner_type) | 2491 | |
2014 | saa7134_i2c_call_clients(dev,TUNER_SET_TYPE,&dev->tuner_type); | 2492 | if (TUNER_ABSENT != dev->tuner_type) { |
2493 | struct tuner_setup tun_setup; | ||
2494 | |||
2495 | tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; | ||
2496 | tun_setup.type = dev->tuner_type; | ||
2497 | tun_setup.addr = ADDR_UNSET; | ||
2498 | |||
2499 | saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
2500 | } | ||
2501 | break; | ||
2502 | case SAA7134_BOARD_MD7134: | ||
2503 | { | ||
2504 | struct tuner_setup tun_setup; | ||
2505 | u8 subaddr; | ||
2506 | u8 data[3]; | ||
2507 | int ret, tuner_t; | ||
2508 | |||
2509 | struct i2c_msg msg[] = {{.addr=0x50, .flags=0, .buf=&subaddr, .len = 1}, | ||
2510 | {.addr=0x50, .flags=I2C_M_RD, .buf=data, .len = 3}}; | ||
2511 | subaddr= 0x14; | ||
2512 | tuner_t = 0; | ||
2513 | ret = i2c_transfer(&dev->i2c_adap, msg, 2); | ||
2514 | if (ret != 2) { | ||
2515 | printk(KERN_ERR "EEPROM read failure\n"); | ||
2516 | } else if ((data[0] != 0) && (data[0] != 0xff)) { | ||
2517 | /* old config structure */ | ||
2518 | subaddr = data[0] + 2; | ||
2519 | msg[1].len = 2; | ||
2520 | i2c_transfer(&dev->i2c_adap, msg, 2); | ||
2521 | tuner_t = (data[0] << 8) + data[1]; | ||
2522 | switch (tuner_t){ | ||
2523 | case 0x0103: | ||
2524 | dev->tuner_type = TUNER_PHILIPS_PAL; | ||
2525 | break; | ||
2526 | case 0x010C: | ||
2527 | dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3; | ||
2528 | break; | ||
2529 | default: | ||
2530 | printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t); | ||
2531 | } | ||
2532 | } else if ((data[1] != 0) && (data[1] != 0xff)) { | ||
2533 | /* new config structure */ | ||
2534 | subaddr = data[1] + 1; | ||
2535 | msg[1].len = 1; | ||
2536 | i2c_transfer(&dev->i2c_adap, msg, 2); | ||
2537 | subaddr = data[0] + 1; | ||
2538 | msg[1].len = 2; | ||
2539 | i2c_transfer(&dev->i2c_adap, msg, 2); | ||
2540 | tuner_t = (data[1] << 8) + data[0]; | ||
2541 | switch (tuner_t) { | ||
2542 | case 0x0005: | ||
2543 | dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3; | ||
2544 | break; | ||
2545 | case 0x001d: | ||
2546 | dev->tuner_type = TUNER_PHILIPS_FMD1216ME_MK3; | ||
2547 | printk(KERN_INFO "%s Board has DVB-T\n", dev->name); | ||
2548 | break; | ||
2549 | default: | ||
2550 | printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t); | ||
2551 | } | ||
2552 | } else { | ||
2553 | printk(KERN_ERR "%s unexpected config structure\n", dev->name); | ||
2554 | } | ||
2555 | |||
2556 | printk(KERN_INFO "%s Tuner type is %d\n", dev->name, dev->tuner_type); | ||
2557 | if (dev->tuner_type == TUNER_PHILIPS_FMD1216ME_MK3) { | ||
2558 | dev->tda9887_conf = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE | TDA9887_PORT2_ACTIVE; | ||
2559 | saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG, &dev->tda9887_conf); | ||
2560 | } | ||
2561 | |||
2562 | tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; | ||
2563 | tun_setup.type = dev->tuner_type; | ||
2564 | tun_setup.addr = ADDR_UNSET; | ||
2565 | |||
2566 | saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup); | ||
2567 | } | ||
2015 | break; | 2568 | break; |
2016 | } | 2569 | } |
2017 | return 0; | 2570 | return 0; |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index d506cafba8ff..1dbe61755e9f 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-core.c,v 1.28 2005/02/22 09:56:29 kraxel Exp $ | 2 | * $Id: saa7134-core.c,v 1.39 2005/07/05 17:37:35 nsh Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * driver core | 5 | * driver core |
@@ -183,46 +183,6 @@ void saa7134_track_gpio(struct saa7134_dev *dev, char *msg) | |||
183 | 183 | ||
184 | /* ------------------------------------------------------------------ */ | 184 | /* ------------------------------------------------------------------ */ |
185 | 185 | ||
186 | #if 0 | ||
187 | static char *dec1_bits[8] = { | ||
188 | "DCSTD0", "DCSCT1", "WIPA", "GLIMB", | ||
189 | "GLIMT", "SLTCA", "HLCK" | ||
190 | }; | ||
191 | static char *dec2_bits[8] = { | ||
192 | "RDCAP", "COPRO", "COLSTR", "TYPE3", | ||
193 | NULL, "FIDT", "HLVLN", "INTL" | ||
194 | }; | ||
195 | static char *scale1_bits[8] = { | ||
196 | "VID_A", "VBI_A", NULL, NULL, "VID_B", "VBI_B" | ||
197 | }; | ||
198 | static char *scale2_bits[8] = { | ||
199 | "TRERR", "CFERR", "LDERR", "WASRST", | ||
200 | "FIDSCI", "FIDSCO", "D6^D5", "TASK" | ||
201 | }; | ||
202 | |||
203 | static void dump_statusreg(struct saa7134_dev *dev, int reg, | ||
204 | char *regname, char **bits) | ||
205 | { | ||
206 | int value,i; | ||
207 | |||
208 | value = saa_readb(reg); | ||
209 | printk(KERN_DEBUG "%s: %s:", dev->name, regname); | ||
210 | for (i = 7; i >= 0; i--) { | ||
211 | if (NULL == bits[i]) | ||
212 | continue; | ||
213 | printk(" %s=%d", bits[i], (value & (1 << i)) ? 1 : 0); | ||
214 | } | ||
215 | printk("\n"); | ||
216 | } | ||
217 | |||
218 | static void dump_statusregs(struct saa7134_dev *dev) | ||
219 | { | ||
220 | dump_statusreg(dev,SAA7134_STATUS_VIDEO1,"dec1",dec1_bits); | ||
221 | dump_statusreg(dev,SAA7134_STATUS_VIDEO2,"dec2",dec2_bits); | ||
222 | dump_statusreg(dev,SAA7134_SCALER_STATUS0,"scale0",scale1_bits); | ||
223 | dump_statusreg(dev,SAA7134_SCALER_STATUS1,"scale1",scale2_bits); | ||
224 | } | ||
225 | #endif | ||
226 | 186 | ||
227 | /* ----------------------------------------------------------- */ | 187 | /* ----------------------------------------------------------- */ |
228 | /* delayed request_module */ | 188 | /* delayed request_module */ |
@@ -316,7 +276,7 @@ unsigned long saa7134_buffer_base(struct saa7134_buf *buf) | |||
316 | 276 | ||
317 | int saa7134_pgtable_alloc(struct pci_dev *pci, struct saa7134_pgtable *pt) | 277 | int saa7134_pgtable_alloc(struct pci_dev *pci, struct saa7134_pgtable *pt) |
318 | { | 278 | { |
319 | u32 *cpu; | 279 | __le32 *cpu; |
320 | dma_addr_t dma_addr; | 280 | dma_addr_t dma_addr; |
321 | 281 | ||
322 | cpu = pci_alloc_consistent(pci, SAA7134_PGTABLE_SIZE, &dma_addr); | 282 | cpu = pci_alloc_consistent(pci, SAA7134_PGTABLE_SIZE, &dma_addr); |
@@ -332,7 +292,7 @@ int saa7134_pgtable_build(struct pci_dev *pci, struct saa7134_pgtable *pt, | |||
332 | struct scatterlist *list, unsigned int length, | 292 | struct scatterlist *list, unsigned int length, |
333 | unsigned int startpage) | 293 | unsigned int startpage) |
334 | { | 294 | { |
335 | u32 *ptr; | 295 | __le32 *ptr; |
336 | unsigned int i,p; | 296 | unsigned int i,p; |
337 | 297 | ||
338 | BUG_ON(NULL == pt || NULL == pt->cpu); | 298 | BUG_ON(NULL == pt || NULL == pt->cpu); |
@@ -340,7 +300,7 @@ int saa7134_pgtable_build(struct pci_dev *pci, struct saa7134_pgtable *pt, | |||
340 | ptr = pt->cpu + startpage; | 300 | ptr = pt->cpu + startpage; |
341 | for (i = 0; i < length; i++, list++) | 301 | for (i = 0; i < length; i++, list++) |
342 | for (p = 0; p * 4096 < list->length; p++, ptr++) | 302 | for (p = 0; p * 4096 < list->length; p++, ptr++) |
343 | *ptr = sg_dma_address(list) - list->offset; | 303 | *ptr = cpu_to_le32(sg_dma_address(list) - list->offset); |
344 | return 0; | 304 | return 0; |
345 | } | 305 | } |
346 | 306 | ||
@@ -616,10 +576,6 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
616 | if (irq_debug) | 576 | if (irq_debug) |
617 | print_irqstatus(dev,loop,report,status); | 577 | print_irqstatus(dev,loop,report,status); |
618 | 578 | ||
619 | #if 0 | ||
620 | if (report & SAA7134_IRQ_REPORT_CONF_ERR) | ||
621 | dump_statusregs(dev); | ||
622 | #endif | ||
623 | 579 | ||
624 | if (report & SAA7134_IRQ_REPORT_RDCAP /* _INTL */) | 580 | if (report & SAA7134_IRQ_REPORT_RDCAP /* _INTL */) |
625 | saa7134_irq_video_intl(dev); | 581 | saa7134_irq_video_intl(dev); |
@@ -711,7 +667,6 @@ static int saa7134_hwinit1(struct saa7134_dev *dev) | |||
711 | SAA7134_MAIN_CTRL_EVFE1 | | 667 | SAA7134_MAIN_CTRL_EVFE1 | |
712 | SAA7134_MAIN_CTRL_EVFE2 | | 668 | SAA7134_MAIN_CTRL_EVFE2 | |
713 | SAA7134_MAIN_CTRL_ESFE | | 669 | SAA7134_MAIN_CTRL_ESFE | |
714 | SAA7134_MAIN_CTRL_EBADC | | ||
715 | SAA7134_MAIN_CTRL_EBDAC); | 670 | SAA7134_MAIN_CTRL_EBDAC); |
716 | 671 | ||
717 | /* enable peripheral devices */ | 672 | /* enable peripheral devices */ |
@@ -726,14 +681,28 @@ static int saa7134_hwinit1(struct saa7134_dev *dev) | |||
726 | /* late init (with i2c + irq) */ | 681 | /* late init (with i2c + irq) */ |
727 | static int saa7134_hwinit2(struct saa7134_dev *dev) | 682 | static int saa7134_hwinit2(struct saa7134_dev *dev) |
728 | { | 683 | { |
684 | unsigned int irq2_mask; | ||
729 | dprintk("hwinit2\n"); | 685 | dprintk("hwinit2\n"); |
730 | 686 | ||
731 | saa7134_video_init2(dev); | 687 | saa7134_video_init2(dev); |
732 | saa7134_tvaudio_init2(dev); | 688 | saa7134_tvaudio_init2(dev); |
733 | 689 | ||
734 | /* enable IRQ's */ | 690 | /* enable IRQ's */ |
691 | irq2_mask = | ||
692 | SAA7134_IRQ2_INTE_DEC3 | | ||
693 | SAA7134_IRQ2_INTE_DEC2 | | ||
694 | SAA7134_IRQ2_INTE_DEC1 | | ||
695 | SAA7134_IRQ2_INTE_DEC0 | | ||
696 | SAA7134_IRQ2_INTE_PE | | ||
697 | SAA7134_IRQ2_INTE_AR; | ||
698 | |||
699 | if (dev->has_remote) | ||
700 | irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18 | | ||
701 | SAA7134_IRQ2_INTE_GPIO18A | | ||
702 | SAA7134_IRQ2_INTE_GPIO16 ); | ||
703 | |||
735 | saa_writel(SAA7134_IRQ1, 0); | 704 | saa_writel(SAA7134_IRQ1, 0); |
736 | saa_writel(SAA7134_IRQ2, dev->irq2_mask); | 705 | saa_writel(SAA7134_IRQ2, irq2_mask); |
737 | 706 | ||
738 | return 0; | 707 | return 0; |
739 | } | 708 | } |
@@ -954,13 +923,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
954 | } | 923 | } |
955 | 924 | ||
956 | /* initialize hardware #1 */ | 925 | /* initialize hardware #1 */ |
957 | dev->irq2_mask = | ||
958 | SAA7134_IRQ2_INTE_DEC3 | | ||
959 | SAA7134_IRQ2_INTE_DEC2 | | ||
960 | SAA7134_IRQ2_INTE_DEC1 | | ||
961 | SAA7134_IRQ2_INTE_DEC0 | | ||
962 | SAA7134_IRQ2_INTE_PE | | ||
963 | SAA7134_IRQ2_INTE_AR; | ||
964 | saa7134_board_init1(dev); | 926 | saa7134_board_init1(dev); |
965 | saa7134_hwinit1(dev); | 927 | saa7134_hwinit1(dev); |
966 | 928 | ||
@@ -990,6 +952,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
990 | request_module("saa6752hs"); | 952 | request_module("saa6752hs"); |
991 | request_module_depend("saa7134-empress",&need_empress); | 953 | request_module_depend("saa7134-empress",&need_empress); |
992 | } | 954 | } |
955 | |||
993 | if (card_is_dvb(dev)) | 956 | if (card_is_dvb(dev)) |
994 | request_module_depend("saa7134-dvb",&need_dvb); | 957 | request_module_depend("saa7134-dvb",&need_dvb); |
995 | 958 | ||
@@ -1144,9 +1107,6 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) | |||
1144 | release_mem_region(pci_resource_start(pci_dev,0), | 1107 | release_mem_region(pci_resource_start(pci_dev,0), |
1145 | pci_resource_len(pci_dev,0)); | 1108 | pci_resource_len(pci_dev,0)); |
1146 | 1109 | ||
1147 | #if 0 /* causes some trouble when reinserting the driver ... */ | ||
1148 | pci_disable_device(pci_dev); | ||
1149 | #endif | ||
1150 | pci_set_drvdata(pci_dev, NULL); | 1110 | pci_set_drvdata(pci_dev, NULL); |
1151 | 1111 | ||
1152 | /* free memory */ | 1112 | /* free memory */ |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index c2873ae029f9..8be6a90358c8 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -1,8 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-dvb.c,v 1.12 2005/02/18 12:28:29 kraxel Exp $ | 2 | * $Id: saa7134-dvb.c,v 1.23 2005/07/24 22:12:47 mkrufky Exp $ |
3 | * | 3 | * |
4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] | 4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
5 | * | 5 | * |
6 | * Extended 3 / 2005 by Hartmut Hackmann to support various | ||
7 | * cards with the tda10046 DVB-T channel decoder | ||
8 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or | 11 | * the Free Software Foundation; either version 2 of the License, or |
@@ -26,24 +29,31 @@ | |||
26 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
27 | #include <linux/kthread.h> | 30 | #include <linux/kthread.h> |
28 | #include <linux/suspend.h> | 31 | #include <linux/suspend.h> |
32 | #include <linux/config.h> | ||
33 | |||
29 | 34 | ||
30 | #include "saa7134-reg.h" | 35 | #include "saa7134-reg.h" |
31 | #include "saa7134.h" | 36 | #include "saa7134.h" |
32 | 37 | ||
33 | #include "dvb-pll.h" | 38 | #ifdef HAVE_MT352 |
34 | #include "mt352.h" | 39 | # include "mt352.h" |
35 | #include "mt352_priv.h" /* FIXME */ | 40 | # include "mt352_priv.h" /* FIXME */ |
36 | #include "tda1004x.h" | 41 | #endif |
42 | #ifdef HAVE_TDA1004X | ||
43 | # include "tda1004x.h" | ||
44 | #endif | ||
37 | 45 | ||
38 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); | 46 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
39 | MODULE_LICENSE("GPL"); | 47 | MODULE_LICENSE("GPL"); |
40 | 48 | ||
41 | static unsigned int antenna_pwr = 0; | 49 | static unsigned int antenna_pwr = 0; |
50 | |||
42 | module_param(antenna_pwr, int, 0444); | 51 | module_param(antenna_pwr, int, 0444); |
43 | MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); | 52 | MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); |
44 | 53 | ||
45 | /* ------------------------------------------------------------------ */ | 54 | /* ------------------------------------------------------------------ */ |
46 | 55 | ||
56 | #ifdef HAVE_MT352 | ||
47 | static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) | 57 | static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) |
48 | { | 58 | { |
49 | u32 ok; | 59 | u32 ok; |
@@ -138,48 +148,388 @@ static struct mt352_config pinnacle_300i = { | |||
138 | .demod_init = mt352_pinnacle_init, | 148 | .demod_init = mt352_pinnacle_init, |
139 | .pll_set = mt352_pinnacle_pll_set, | 149 | .pll_set = mt352_pinnacle_pll_set, |
140 | }; | 150 | }; |
151 | #endif | ||
141 | 152 | ||
142 | /* ------------------------------------------------------------------ */ | 153 | /* ------------------------------------------------------------------ */ |
143 | 154 | ||
144 | static int medion_cardbus_init(struct dvb_frontend* fe) | 155 | #ifdef HAVE_TDA1004X |
156 | static int philips_tu1216_pll_init(struct dvb_frontend *fe) | ||
145 | { | 157 | { |
146 | /* anything to do here ??? */ | 158 | struct saa7134_dev *dev = fe->dvb->priv; |
159 | static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab }; | ||
160 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; | ||
161 | |||
162 | /* setup PLL configuration */ | ||
163 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
164 | return -EIO; | ||
165 | msleep(1); | ||
166 | |||
147 | return 0; | 167 | return 0; |
148 | } | 168 | } |
149 | 169 | ||
150 | static int medion_cardbus_pll_set(struct dvb_frontend* fe, | 170 | static int philips_tu1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
151 | struct dvb_frontend_parameters* params) | ||
152 | { | 171 | { |
153 | struct saa7134_dev *dev = fe->dvb->priv; | 172 | struct saa7134_dev *dev = fe->dvb->priv; |
154 | struct v4l2_frequency f; | 173 | u8 tuner_buf[4]; |
174 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf,.len = | ||
175 | sizeof(tuner_buf) }; | ||
176 | int tuner_frequency = 0; | ||
177 | u8 band, cp, filter; | ||
178 | |||
179 | /* determine charge pump */ | ||
180 | tuner_frequency = params->frequency + 36166000; | ||
181 | if (tuner_frequency < 87000000) | ||
182 | return -EINVAL; | ||
183 | else if (tuner_frequency < 130000000) | ||
184 | cp = 3; | ||
185 | else if (tuner_frequency < 160000000) | ||
186 | cp = 5; | ||
187 | else if (tuner_frequency < 200000000) | ||
188 | cp = 6; | ||
189 | else if (tuner_frequency < 290000000) | ||
190 | cp = 3; | ||
191 | else if (tuner_frequency < 420000000) | ||
192 | cp = 5; | ||
193 | else if (tuner_frequency < 480000000) | ||
194 | cp = 6; | ||
195 | else if (tuner_frequency < 620000000) | ||
196 | cp = 3; | ||
197 | else if (tuner_frequency < 830000000) | ||
198 | cp = 5; | ||
199 | else if (tuner_frequency < 895000000) | ||
200 | cp = 7; | ||
201 | else | ||
202 | return -EINVAL; | ||
203 | |||
204 | /* determine band */ | ||
205 | if (params->frequency < 49000000) | ||
206 | return -EINVAL; | ||
207 | else if (params->frequency < 161000000) | ||
208 | band = 1; | ||
209 | else if (params->frequency < 444000000) | ||
210 | band = 2; | ||
211 | else if (params->frequency < 861000000) | ||
212 | band = 4; | ||
213 | else | ||
214 | return -EINVAL; | ||
215 | |||
216 | /* setup PLL filter */ | ||
217 | switch (params->u.ofdm.bandwidth) { | ||
218 | case BANDWIDTH_6_MHZ: | ||
219 | filter = 0; | ||
220 | break; | ||
155 | 221 | ||
156 | /* | 222 | case BANDWIDTH_7_MHZ: |
157 | * this instructs tuner.o to set the frequency, the call will | 223 | filter = 0; |
158 | * end up in tuner_command(), VIDIOC_S_FREQUENCY switch. | 224 | break; |
159 | * tda9887.o will see that as well. | 225 | |
226 | case BANDWIDTH_8_MHZ: | ||
227 | filter = 1; | ||
228 | break; | ||
229 | |||
230 | default: | ||
231 | return -EINVAL; | ||
232 | } | ||
233 | |||
234 | /* calculate divisor | ||
235 | * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6) | ||
160 | */ | 236 | */ |
161 | f.tuner = 0; | 237 | tuner_frequency = (((params->frequency / 1000) * 6) + 217496) / 1000; |
162 | f.type = V4L2_TUNER_DIGITAL_TV; | 238 | |
163 | f.frequency = params->frequency / 1000 * 16 / 1000; | 239 | /* setup tuner buffer */ |
164 | saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f); | 240 | tuner_buf[0] = (tuner_frequency >> 8) & 0x7f; |
241 | tuner_buf[1] = tuner_frequency & 0xff; | ||
242 | tuner_buf[2] = 0xca; | ||
243 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; | ||
244 | |||
245 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
246 | return -EIO; | ||
247 | |||
248 | msleep(1); | ||
165 | return 0; | 249 | return 0; |
166 | } | 250 | } |
167 | 251 | ||
168 | static int fe_request_firmware(struct dvb_frontend* fe, | 252 | static int philips_tu1216_request_firmware(struct dvb_frontend *fe, |
169 | const struct firmware **fw, char* name) | 253 | const struct firmware **fw, char *name) |
170 | { | 254 | { |
171 | struct saa7134_dev *dev = fe->dvb->priv; | 255 | struct saa7134_dev *dev = fe->dvb->priv; |
172 | return request_firmware(fw, name, &dev->pci->dev); | 256 | return request_firmware(fw, name, &dev->pci->dev); |
173 | } | 257 | } |
174 | 258 | ||
259 | static struct tda1004x_config philips_tu1216_config = { | ||
260 | |||
261 | .demod_address = 0x8, | ||
262 | .invert = 1, | ||
263 | .invert_oclk = 1, | ||
264 | .xtal_freq = TDA10046_XTAL_4M, | ||
265 | .agc_config = TDA10046_AGC_DEFAULT, | ||
266 | .if_freq = TDA10046_FREQ_3617, | ||
267 | .pll_init = philips_tu1216_pll_init, | ||
268 | .pll_set = philips_tu1216_pll_set, | ||
269 | .pll_sleep = NULL, | ||
270 | .request_firmware = philips_tu1216_request_firmware, | ||
271 | }; | ||
272 | |||
273 | /* ------------------------------------------------------------------ */ | ||
274 | |||
275 | |||
276 | static int philips_fmd1216_pll_init(struct dvb_frontend *fe) | ||
277 | { | ||
278 | struct saa7134_dev *dev = fe->dvb->priv; | ||
279 | /* this message is to set up ATC and ALC */ | ||
280 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 }; | ||
281 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; | ||
282 | |||
283 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
284 | return -EIO; | ||
285 | msleep(1); | ||
286 | |||
287 | return 0; | ||
288 | } | ||
289 | |||
290 | static void philips_fmd1216_analog(struct dvb_frontend *fe) | ||
291 | { | ||
292 | struct saa7134_dev *dev = fe->dvb->priv; | ||
293 | /* this message actually turns the tuner back to analog mode */ | ||
294 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0x60 }; | ||
295 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; | ||
296 | |||
297 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
298 | msleep(1); | ||
299 | fmd1216_init[2] = 0x86; | ||
300 | fmd1216_init[3] = 0x54; | ||
301 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
302 | msleep(1); | ||
303 | } | ||
304 | |||
305 | static int philips_fmd1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
306 | { | ||
307 | struct saa7134_dev *dev = fe->dvb->priv; | ||
308 | u8 tuner_buf[4]; | ||
309 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = tuner_buf,.len = | ||
310 | sizeof(tuner_buf) }; | ||
311 | int tuner_frequency = 0; | ||
312 | int divider = 0; | ||
313 | u8 band, mode, cp; | ||
314 | |||
315 | /* determine charge pump */ | ||
316 | tuner_frequency = params->frequency + 36130000; | ||
317 | if (tuner_frequency < 87000000) | ||
318 | return -EINVAL; | ||
319 | /* low band */ | ||
320 | else if (tuner_frequency < 180000000) { | ||
321 | band = 1; | ||
322 | mode = 7; | ||
323 | cp = 0; | ||
324 | } else if (tuner_frequency < 195000000) { | ||
325 | band = 1; | ||
326 | mode = 6; | ||
327 | cp = 1; | ||
328 | /* mid band */ | ||
329 | } else if (tuner_frequency < 366000000) { | ||
330 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
331 | band = 10; | ||
332 | } else { | ||
333 | band = 2; | ||
334 | } | ||
335 | mode = 7; | ||
336 | cp = 0; | ||
337 | } else if (tuner_frequency < 478000000) { | ||
338 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
339 | band = 10; | ||
340 | } else { | ||
341 | band = 2; | ||
342 | } | ||
343 | mode = 6; | ||
344 | cp = 1; | ||
345 | /* high band */ | ||
346 | } else if (tuner_frequency < 662000000) { | ||
347 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
348 | band = 12; | ||
349 | } else { | ||
350 | band = 4; | ||
351 | } | ||
352 | mode = 7; | ||
353 | cp = 0; | ||
354 | } else if (tuner_frequency < 840000000) { | ||
355 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
356 | band = 12; | ||
357 | } else { | ||
358 | band = 4; | ||
359 | } | ||
360 | mode = 6; | ||
361 | cp = 1; | ||
362 | } else { | ||
363 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
364 | band = 12; | ||
365 | } else { | ||
366 | band = 4; | ||
367 | } | ||
368 | mode = 7; | ||
369 | cp = 1; | ||
370 | |||
371 | } | ||
372 | /* calculate divisor */ | ||
373 | /* ((36166000 + Finput) / 166666) rounded! */ | ||
374 | divider = (tuner_frequency + 83333) / 166667; | ||
375 | |||
376 | /* setup tuner buffer */ | ||
377 | tuner_buf[0] = (divider >> 8) & 0x7f; | ||
378 | tuner_buf[1] = divider & 0xff; | ||
379 | tuner_buf[2] = 0x80 | (cp << 6) | (mode << 3) | 4; | ||
380 | tuner_buf[3] = 0x40 | band; | ||
381 | |||
382 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
383 | return -EIO; | ||
384 | return 0; | ||
385 | } | ||
386 | |||
387 | #ifdef HAVE_TDA1004X | ||
175 | static struct tda1004x_config medion_cardbus = { | 388 | static struct tda1004x_config medion_cardbus = { |
176 | .demod_address = 0x08, /* not sure this is correct */ | 389 | .demod_address = 0x08, |
177 | .invert = 0, | 390 | .invert = 1, |
178 | .invert_oclk = 0, | 391 | .invert_oclk = 0, |
179 | .pll_init = medion_cardbus_init, | 392 | .xtal_freq = TDA10046_XTAL_16M, |
180 | .pll_set = medion_cardbus_pll_set, | 393 | .agc_config = TDA10046_AGC_IFO_AUTO_NEG, |
181 | .request_firmware = fe_request_firmware, | 394 | .if_freq = TDA10046_FREQ_3613, |
395 | .pll_init = philips_fmd1216_pll_init, | ||
396 | .pll_set = philips_fmd1216_pll_set, | ||
397 | .pll_sleep = philips_fmd1216_analog, | ||
398 | .request_firmware = NULL, | ||
399 | }; | ||
400 | #endif | ||
401 | |||
402 | /* ------------------------------------------------------------------ */ | ||
403 | |||
404 | struct tda827x_data { | ||
405 | u32 lomax; | ||
406 | u8 spd; | ||
407 | u8 bs; | ||
408 | u8 bp; | ||
409 | u8 cp; | ||
410 | u8 gc3; | ||
411 | u8 div1p5; | ||
412 | }; | ||
413 | |||
414 | static struct tda827x_data tda827x_dvbt[] = { | ||
415 | { .lomax = 62000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1}, | ||
416 | { .lomax = 66000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1}, | ||
417 | { .lomax = 76000000, .spd = 3, .bs = 1, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0}, | ||
418 | { .lomax = 84000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0}, | ||
419 | { .lomax = 93000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
420 | { .lomax = 98000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
421 | { .lomax = 109000000, .spd = 3, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
422 | { .lomax = 123000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
423 | { .lomax = 133000000, .spd = 2, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
424 | { .lomax = 151000000, .spd = 2, .bs = 1, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
425 | { .lomax = 154000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
426 | { .lomax = 181000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 0, .div1p5 = 0}, | ||
427 | { .lomax = 185000000, .spd = 2, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
428 | { .lomax = 217000000, .spd = 2, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
429 | { .lomax = 244000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
430 | { .lomax = 265000000, .spd = 1, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
431 | { .lomax = 302000000, .spd = 1, .bs = 1, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
432 | { .lomax = 324000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
433 | { .lomax = 370000000, .spd = 1, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
434 | { .lomax = 454000000, .spd = 1, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
435 | { .lomax = 493000000, .spd = 0, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
436 | { .lomax = 530000000, .spd = 0, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
437 | { .lomax = 554000000, .spd = 0, .bs = 1, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
438 | { .lomax = 604000000, .spd = 0, .bs = 1, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, | ||
439 | { .lomax = 696000000, .spd = 0, .bs = 2, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, | ||
440 | { .lomax = 740000000, .spd = 0, .bs = 2, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0}, | ||
441 | { .lomax = 820000000, .spd = 0, .bs = 3, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, | ||
442 | { .lomax = 865000000, .spd = 0, .bs = 3, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0}, | ||
443 | { .lomax = 0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0} | ||
444 | }; | ||
445 | |||
446 | static int philips_tda827x_pll_init(struct dvb_frontend *fe) | ||
447 | { | ||
448 | return 0; | ||
449 | } | ||
450 | |||
451 | static int philips_tda827x_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
452 | { | ||
453 | struct saa7134_dev *dev = fe->dvb->priv; | ||
454 | u8 tuner_buf[14]; | ||
455 | |||
456 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf, | ||
457 | .len = sizeof(tuner_buf) }; | ||
458 | int i, tuner_freq, if_freq; | ||
459 | u32 N; | ||
460 | switch (params->u.ofdm.bandwidth) { | ||
461 | case BANDWIDTH_6_MHZ: | ||
462 | if_freq = 4000000; | ||
463 | break; | ||
464 | case BANDWIDTH_7_MHZ: | ||
465 | if_freq = 4500000; | ||
466 | break; | ||
467 | default: /* 8 MHz or Auto */ | ||
468 | if_freq = 5000000; | ||
469 | break; | ||
470 | } | ||
471 | tuner_freq = params->frequency + if_freq; | ||
472 | |||
473 | i = 0; | ||
474 | while (tda827x_dvbt[i].lomax < tuner_freq) { | ||
475 | if(tda827x_dvbt[i + 1].lomax == 0) | ||
476 | break; | ||
477 | i++; | ||
478 | } | ||
479 | |||
480 | N = ((tuner_freq + 125000) / 250000) << (tda827x_dvbt[i].spd + 2); | ||
481 | tuner_buf[0] = 0; | ||
482 | tuner_buf[1] = (N>>8) | 0x40; | ||
483 | tuner_buf[2] = N & 0xff; | ||
484 | tuner_buf[3] = 0; | ||
485 | tuner_buf[4] = 0x52; | ||
486 | tuner_buf[5] = (tda827x_dvbt[i].spd << 6) + (tda827x_dvbt[i].div1p5 << 5) + | ||
487 | (tda827x_dvbt[i].bs << 3) + tda827x_dvbt[i].bp; | ||
488 | tuner_buf[6] = (tda827x_dvbt[i].gc3 << 4) + 0x8f; | ||
489 | tuner_buf[7] = 0xbf; | ||
490 | tuner_buf[8] = 0x2a; | ||
491 | tuner_buf[9] = 0x05; | ||
492 | tuner_buf[10] = 0xff; | ||
493 | tuner_buf[11] = 0x00; | ||
494 | tuner_buf[12] = 0x00; | ||
495 | tuner_buf[13] = 0x40; | ||
496 | |||
497 | tuner_msg.len = 14; | ||
498 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
499 | return -EIO; | ||
500 | |||
501 | msleep(500); | ||
502 | /* correct CP value */ | ||
503 | tuner_buf[0] = 0x30; | ||
504 | tuner_buf[1] = 0x50 + tda827x_dvbt[i].cp; | ||
505 | tuner_msg.len = 2; | ||
506 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
507 | |||
508 | return 0; | ||
509 | } | ||
510 | |||
511 | static void philips_tda827x_pll_sleep(struct dvb_frontend *fe) | ||
512 | { | ||
513 | struct saa7134_dev *dev = fe->dvb->priv; | ||
514 | static u8 tda827x_sleep[] = { 0x30, 0xd0}; | ||
515 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tda827x_sleep, | ||
516 | .len = sizeof(tda827x_sleep) }; | ||
517 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
518 | } | ||
519 | |||
520 | static struct tda1004x_config tda827x_lifeview_config = { | ||
521 | .demod_address = 0x08, | ||
522 | .invert = 1, | ||
523 | .invert_oclk = 0, | ||
524 | .xtal_freq = TDA10046_XTAL_16M, | ||
525 | .agc_config = TDA10046_AGC_TDA827X, | ||
526 | .if_freq = TDA10046_FREQ_045, | ||
527 | .pll_init = philips_tda827x_pll_init, | ||
528 | .pll_set = philips_tda827x_pll_set, | ||
529 | .pll_sleep = philips_tda827x_pll_sleep, | ||
530 | .request_firmware = NULL, | ||
182 | }; | 531 | }; |
532 | #endif | ||
183 | 533 | ||
184 | /* ------------------------------------------------------------------ */ | 534 | /* ------------------------------------------------------------------ */ |
185 | 535 | ||
@@ -197,18 +547,31 @@ static int dvb_init(struct saa7134_dev *dev) | |||
197 | dev); | 547 | dev); |
198 | 548 | ||
199 | switch (dev->board) { | 549 | switch (dev->board) { |
550 | #ifdef HAVE_MT352 | ||
200 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: | 551 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: |
201 | printk("%s: pinnacle 300i dvb setup\n",dev->name); | 552 | printk("%s: pinnacle 300i dvb setup\n",dev->name); |
202 | dev->dvb.frontend = mt352_attach(&pinnacle_300i, | 553 | dev->dvb.frontend = mt352_attach(&pinnacle_300i, |
203 | &dev->i2c_adap); | 554 | &dev->i2c_adap); |
204 | break; | 555 | break; |
556 | #endif | ||
557 | #ifdef HAVE_TDA1004X | ||
205 | case SAA7134_BOARD_MD7134: | 558 | case SAA7134_BOARD_MD7134: |
206 | dev->dvb.frontend = tda10046_attach(&medion_cardbus, | 559 | dev->dvb.frontend = tda10046_attach(&medion_cardbus, |
207 | &dev->i2c_adap); | 560 | &dev->i2c_adap); |
208 | if (NULL == dev->dvb.frontend) | ||
209 | printk("%s: Hmm, looks like this is the old MD7134 " | ||
210 | "version without DVB-T support\n",dev->name); | ||
211 | break; | 561 | break; |
562 | case SAA7134_BOARD_PHILIPS_TOUGH: | ||
563 | dev->dvb.frontend = tda10046_attach(&philips_tu1216_config, | ||
564 | &dev->i2c_adap); | ||
565 | break; | ||
566 | case SAA7134_BOARD_FLYDVBTDUO: | ||
567 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, | ||
568 | &dev->i2c_adap); | ||
569 | break; | ||
570 | case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS: | ||
571 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, | ||
572 | &dev->i2c_adap); | ||
573 | break; | ||
574 | #endif | ||
212 | default: | 575 | default: |
213 | printk("%s: Huh? unknown DVB card?\n",dev->name); | 576 | printk("%s: Huh? unknown DVB card?\n",dev->name); |
214 | break; | 577 | break; |
@@ -227,8 +590,6 @@ static int dvb_fini(struct saa7134_dev *dev) | |||
227 | { | 590 | { |
228 | static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE; | 591 | static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE; |
229 | 592 | ||
230 | printk("%s: %s\n",dev->name,__FUNCTION__); | ||
231 | |||
232 | switch (dev->board) { | 593 | switch (dev->board) { |
233 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: | 594 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: |
234 | /* otherwise we don't detect the tuner on next insmod */ | 595 | /* otherwise we don't detect the tuner on next insmod */ |
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index fa1357336907..c85348d0239f 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-empress.c,v 1.10 2005/02/03 10:24:33 kraxel Exp $ | 2 | * $Id: saa7134-empress.c,v 1.11 2005/05/22 19:23:39 nsh Exp $ |
3 | * | 3 | * |
4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] | 4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
5 | * | 5 | * |
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index 702bb63d9813..1203b93a572c 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-i2c.c,v 1.10 2005/01/24 17:37:23 kraxel Exp $ | 2 | * $Id: saa7134-i2c.c,v 1.22 2005/07/22 04:09:41 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * i2c interface support | 5 | * i2c interface support |
@@ -197,10 +197,6 @@ static inline int i2c_send_byte(struct saa7134_dev *dev, | |||
197 | enum i2c_status status; | 197 | enum i2c_status status; |
198 | __u32 dword; | 198 | __u32 dword; |
199 | 199 | ||
200 | #if 0 | ||
201 | i2c_set_attr(dev,attr); | ||
202 | saa_writeb(SAA7134_I2C_DATA, data); | ||
203 | #else | ||
204 | /* have to write both attr + data in one 32bit word */ | 200 | /* have to write both attr + data in one 32bit word */ |
205 | dword = saa_readl(SAA7134_I2C_ATTR_STATUS >> 2); | 201 | dword = saa_readl(SAA7134_I2C_ATTR_STATUS >> 2); |
206 | dword &= 0x0f; | 202 | dword &= 0x0f; |
@@ -210,7 +206,6 @@ static inline int i2c_send_byte(struct saa7134_dev *dev, | |||
210 | // dword |= 0x40 << 16; /* 400 kHz */ | 206 | // dword |= 0x40 << 16; /* 400 kHz */ |
211 | dword |= 0xf0 << 24; | 207 | dword |= 0xf0 << 24; |
212 | saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword); | 208 | saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword); |
213 | #endif | ||
214 | d2printk(KERN_DEBUG "%s: i2c data => 0x%x\n",dev->name,data); | 209 | d2printk(KERN_DEBUG "%s: i2c data => 0x%x\n",dev->name,data); |
215 | 210 | ||
216 | if (!i2c_is_busy_wait(dev)) | 211 | if (!i2c_is_busy_wait(dev)) |
@@ -305,6 +300,8 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
305 | status = i2c_get_status(dev); | 300 | status = i2c_get_status(dev); |
306 | if (i2c_is_error(status)) | 301 | if (i2c_is_error(status)) |
307 | goto err; | 302 | goto err; |
303 | /* ensure that the bus is idle for at least one bit slot */ | ||
304 | msleep(1); | ||
308 | 305 | ||
309 | d1printk("\n"); | 306 | d1printk("\n"); |
310 | return num; | 307 | return num; |
@@ -331,12 +328,44 @@ static u32 functionality(struct i2c_adapter *adap) | |||
331 | 328 | ||
332 | static int attach_inform(struct i2c_client *client) | 329 | static int attach_inform(struct i2c_client *client) |
333 | { | 330 | { |
334 | struct saa7134_dev *dev = client->adapter->algo_data; | 331 | struct saa7134_dev *dev = client->adapter->algo_data; |
335 | int tuner = dev->tuner_type; | 332 | int tuner = dev->tuner_type; |
336 | int conf = dev->tda9887_conf; | 333 | int conf = dev->tda9887_conf; |
334 | struct tuner_setup tun_setup; | ||
335 | |||
336 | d1printk( "%s i2c attach [addr=0x%x,client=%s]\n", | ||
337 | client->driver->name,client->addr,i2c_clientname(client)); | ||
338 | |||
339 | if (!client->driver->command) | ||
340 | return 0; | ||
341 | |||
342 | if (saa7134_boards[dev->board].radio_type != UNSET) { | ||
343 | |||
344 | tun_setup.type = saa7134_boards[dev->board].radio_type; | ||
345 | tun_setup.addr = saa7134_boards[dev->board].radio_addr; | ||
346 | |||
347 | if ((tun_setup.addr == ADDR_UNSET) || (tun_setup.addr == client->addr)) { | ||
348 | tun_setup.mode_mask = T_RADIO; | ||
349 | |||
350 | client->driver->command(client, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
351 | } | ||
352 | } | ||
353 | |||
354 | if (tuner != UNSET) { | ||
355 | |||
356 | tun_setup.type = tuner; | ||
357 | tun_setup.addr = saa7134_boards[dev->board].tuner_addr; | ||
358 | |||
359 | if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) { | ||
360 | |||
361 | tun_setup.mode_mask = T_ANALOG_TV; | ||
362 | |||
363 | client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_setup); | ||
364 | } | ||
365 | } | ||
366 | |||
367 | client->driver->command(client, TDA9887_SET_CONFIG, &conf); | ||
337 | 368 | ||
338 | saa7134_i2c_call_clients(dev,TUNER_SET_TYPE,&tuner); | ||
339 | saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&conf); | ||
340 | return 0; | 369 | return 0; |
341 | } | 370 | } |
342 | 371 | ||
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index ca50cf531f20..213740122fe6 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-input.c,v 1.16 2004/12/10 12:33:39 kraxel Exp $ | 2 | * $Id: saa7134-input.c,v 1.21 2005/06/22 23:37:34 nsh Exp $ |
3 | * | 3 | * |
4 | * handle saa7134 IR remotes via linux kernel input layer. | 4 | * handle saa7134 IR remotes via linux kernel input layer. |
5 | * | 5 | * |
@@ -68,10 +68,8 @@ static IR_KEYTAB_TYPE flyvideo_codes[IR_KEYTAB_SIZE] = { | |||
68 | [ 6 ] = KEY_AGAIN, // Recal | 68 | [ 6 ] = KEY_AGAIN, // Recal |
69 | [ 16 ] = KEY_KPENTER, // Enter | 69 | [ 16 ] = KEY_KPENTER, // Enter |
70 | 70 | ||
71 | #if 1 /* FIXME */ | ||
72 | [ 26 ] = KEY_F22, // Stereo | 71 | [ 26 ] = KEY_F22, // Stereo |
73 | [ 24 ] = KEY_EDIT, // AV Source | 72 | [ 24 ] = KEY_EDIT, // AV Source |
74 | #endif | ||
75 | }; | 73 | }; |
76 | 74 | ||
77 | static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = { | 75 | static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = { |
@@ -172,45 +170,45 @@ static IR_KEYTAB_TYPE eztv_codes[IR_KEYTAB_SIZE] = { | |||
172 | }; | 170 | }; |
173 | 171 | ||
174 | static IR_KEYTAB_TYPE avacssmart_codes[IR_KEYTAB_SIZE] = { | 172 | static IR_KEYTAB_TYPE avacssmart_codes[IR_KEYTAB_SIZE] = { |
175 | [ 30 ] = KEY_POWER, // power | 173 | [ 30 ] = KEY_POWER, // power |
176 | [ 28 ] = KEY_SEARCH, // scan | 174 | [ 28 ] = KEY_SEARCH, // scan |
177 | [ 7 ] = KEY_SELECT, // source | 175 | [ 7 ] = KEY_SELECT, // source |
178 | 176 | ||
179 | [ 22 ] = KEY_VOLUMEUP, | 177 | [ 22 ] = KEY_VOLUMEUP, |
180 | [ 20 ] = KEY_VOLUMEDOWN, | 178 | [ 20 ] = KEY_VOLUMEDOWN, |
181 | [ 31 ] = KEY_CHANNELUP, | 179 | [ 31 ] = KEY_CHANNELUP, |
182 | [ 23 ] = KEY_CHANNELDOWN, | 180 | [ 23 ] = KEY_CHANNELDOWN, |
183 | [ 24 ] = KEY_MUTE, | 181 | [ 24 ] = KEY_MUTE, |
184 | 182 | ||
185 | [ 2 ] = KEY_KP0, | 183 | [ 2 ] = KEY_KP0, |
186 | [ 1 ] = KEY_KP1, | 184 | [ 1 ] = KEY_KP1, |
187 | [ 11 ] = KEY_KP2, | 185 | [ 11 ] = KEY_KP2, |
188 | [ 27 ] = KEY_KP3, | 186 | [ 27 ] = KEY_KP3, |
189 | [ 5 ] = KEY_KP4, | 187 | [ 5 ] = KEY_KP4, |
190 | [ 9 ] = KEY_KP5, | 188 | [ 9 ] = KEY_KP5, |
191 | [ 21 ] = KEY_KP6, | 189 | [ 21 ] = KEY_KP6, |
192 | [ 6 ] = KEY_KP7, | 190 | [ 6 ] = KEY_KP7, |
193 | [ 10 ] = KEY_KP8, | 191 | [ 10 ] = KEY_KP8, |
194 | [ 18 ] = KEY_KP9, | 192 | [ 18 ] = KEY_KP9, |
195 | [ 16 ] = KEY_KPDOT, | 193 | [ 16 ] = KEY_KPDOT, |
196 | 194 | ||
197 | [ 3 ] = KEY_TUNER, // tv/fm | 195 | [ 3 ] = KEY_TUNER, // tv/fm |
198 | [ 4 ] = KEY_REWIND, // fm tuning left or function left | 196 | [ 4 ] = KEY_REWIND, // fm tuning left or function left |
199 | [ 12 ] = KEY_FORWARD, // fm tuning right or function right | 197 | [ 12 ] = KEY_FORWARD, // fm tuning right or function right |
200 | 198 | ||
201 | [ 0 ] = KEY_RECORD, | 199 | [ 0 ] = KEY_RECORD, |
202 | [ 8 ] = KEY_STOP, | 200 | [ 8 ] = KEY_STOP, |
203 | [ 17 ] = KEY_PLAY, | 201 | [ 17 ] = KEY_PLAY, |
204 | 202 | ||
205 | [ 25 ] = KEY_ZOOM, | 203 | [ 25 ] = KEY_ZOOM, |
206 | [ 14 ] = KEY_MENU, // function | 204 | [ 14 ] = KEY_MENU, // function |
207 | [ 19 ] = KEY_AGAIN, // recall | 205 | [ 19 ] = KEY_AGAIN, // recall |
208 | [ 29 ] = KEY_RESTART, // reset | 206 | [ 29 ] = KEY_RESTART, // reset |
207 | [ 26 ] = KEY_SHUFFLE, // snapshot/shuffle | ||
209 | 208 | ||
210 | // FIXME | 209 | // FIXME |
211 | [ 13 ] = KEY_F21, // mts | 210 | [ 13 ] = KEY_F21, // mts |
212 | [ 15 ] = KEY_F22, // min | 211 | [ 15 ] = KEY_F22, // min |
213 | [ 26 ] = KEY_F23, // freeze | ||
214 | }; | 212 | }; |
215 | 213 | ||
216 | /* Alex Hermann <gaaf@gmx.net> */ | 214 | /* Alex Hermann <gaaf@gmx.net> */ |
@@ -308,6 +306,102 @@ static IR_KEYTAB_TYPE videomate_tv_pvr_codes[IR_KEYTAB_SIZE] = { | |||
308 | [ 32 ] = KEY_LANGUAGE, | 306 | [ 32 ] = KEY_LANGUAGE, |
309 | [ 33 ] = KEY_SLEEP, | 307 | [ 33 ] = KEY_SLEEP, |
310 | }; | 308 | }; |
309 | |||
310 | /* Michael Tokarev <mjt@tls.msk.ru> | ||
311 | http://www.corpit.ru/mjt/beholdTV/remote_control.jpg | ||
312 | keytable is used by MANLI MTV00[12] and BeholdTV 40[13] at | ||
313 | least, and probably other cards too. | ||
314 | The "ascii-art picture" below (in comments, first row | ||
315 | is the keycode in hex, and subsequent row(s) shows | ||
316 | the button labels (several variants when appropriate) | ||
317 | helps to descide which keycodes to assign to the buttons. | ||
318 | */ | ||
319 | static IR_KEYTAB_TYPE manli_codes[IR_KEYTAB_SIZE] = { | ||
320 | |||
321 | /* 0x1c 0x12 * | ||
322 | * FUNCTION POWER * | ||
323 | * FM (|) * | ||
324 | * */ | ||
325 | [ 0x1c ] = KEY_RADIO, /*XXX*/ | ||
326 | [ 0x12 ] = KEY_POWER, | ||
327 | |||
328 | /* 0x01 0x02 0x03 * | ||
329 | * 1 2 3 * | ||
330 | * * | ||
331 | * 0x04 0x05 0x06 * | ||
332 | * 4 5 6 * | ||
333 | * * | ||
334 | * 0x07 0x08 0x09 * | ||
335 | * 7 8 9 * | ||
336 | * */ | ||
337 | [ 0x01 ] = KEY_KP1, | ||
338 | [ 0x02 ] = KEY_KP2, | ||
339 | [ 0x03 ] = KEY_KP3, | ||
340 | [ 0x04 ] = KEY_KP4, | ||
341 | [ 0x05 ] = KEY_KP5, | ||
342 | [ 0x06 ] = KEY_KP6, | ||
343 | [ 0x07 ] = KEY_KP7, | ||
344 | [ 0x08 ] = KEY_KP8, | ||
345 | [ 0x09 ] = KEY_KP9, | ||
346 | |||
347 | /* 0x0a 0x00 0x17 * | ||
348 | * RECALL 0 +100 * | ||
349 | * PLUS * | ||
350 | * */ | ||
351 | [ 0x0a ] = KEY_AGAIN, /*XXX KEY_REWIND? */ | ||
352 | [ 0x00 ] = KEY_KP0, | ||
353 | [ 0x17 ] = KEY_DIGITS, /*XXX*/ | ||
354 | |||
355 | /* 0x14 0x10 * | ||
356 | * MENU INFO * | ||
357 | * OSD */ | ||
358 | [ 0x14 ] = KEY_MENU, | ||
359 | [ 0x10 ] = KEY_INFO, | ||
360 | |||
361 | /* 0x0b * | ||
362 | * Up * | ||
363 | * * | ||
364 | * 0x18 0x16 0x0c * | ||
365 | * Left Ok Right * | ||
366 | * * | ||
367 | * 0x015 * | ||
368 | * Down * | ||
369 | * */ | ||
370 | [ 0x0b ] = KEY_UP, /*XXX KEY_SCROLLUP? */ | ||
371 | [ 0x18 ] = KEY_LEFT, /*XXX KEY_BACK? */ | ||
372 | [ 0x16 ] = KEY_OK, /*XXX KEY_SELECT? KEY_ENTER? */ | ||
373 | [ 0x0c ] = KEY_RIGHT, /*XXX KEY_FORWARD? */ | ||
374 | [ 0x15 ] = KEY_DOWN, /*XXX KEY_SCROLLDOWN? */ | ||
375 | |||
376 | /* 0x11 0x0d * | ||
377 | * TV/AV MODE * | ||
378 | * SOURCE STEREO * | ||
379 | * */ | ||
380 | [ 0x11 ] = KEY_TV, /*XXX*/ | ||
381 | [ 0x0d ] = KEY_MODE, /*XXX there's no KEY_STEREO */ | ||
382 | |||
383 | /* 0x0f 0x1b 0x1a * | ||
384 | * AUDIO Vol+ Chan+ * | ||
385 | * TIMESHIFT??? * | ||
386 | * * | ||
387 | * 0x0e 0x1f 0x1e * | ||
388 | * SLEEP Vol- Chan- * | ||
389 | * */ | ||
390 | [ 0x0f ] = KEY_AUDIO, | ||
391 | [ 0x1b ] = KEY_VOLUMEUP, | ||
392 | [ 0x1a ] = KEY_CHANNELUP, | ||
393 | [ 0x0e ] = KEY_SLEEP, /*XXX maybe KEY_PAUSE */ | ||
394 | [ 0x1f ] = KEY_VOLUMEDOWN, | ||
395 | [ 0x1e ] = KEY_CHANNELDOWN, | ||
396 | |||
397 | /* 0x13 0x19 * | ||
398 | * MUTE SNAPSHOT* | ||
399 | * */ | ||
400 | [ 0x13 ] = KEY_MUTE, | ||
401 | [ 0x19 ] = KEY_RECORD, /*XXX*/ | ||
402 | |||
403 | // 0x1d unused ? | ||
404 | }; | ||
311 | /* ---------------------------------------------------------------------- */ | 405 | /* ---------------------------------------------------------------------- */ |
312 | 406 | ||
313 | static int build_key(struct saa7134_dev *dev) | 407 | static int build_key(struct saa7134_dev *dev) |
@@ -379,7 +473,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
379 | switch (dev->board) { | 473 | switch (dev->board) { |
380 | case SAA7134_BOARD_FLYVIDEO2000: | 474 | case SAA7134_BOARD_FLYVIDEO2000: |
381 | case SAA7134_BOARD_FLYVIDEO3000: | 475 | case SAA7134_BOARD_FLYVIDEO3000: |
382 | case SAA7134_BOARD_FLYTVPLATINUM_FM: | 476 | case SAA7134_BOARD_FLYTVPLATINUM_FM: |
383 | ir_codes = flyvideo_codes; | 477 | ir_codes = flyvideo_codes; |
384 | mask_keycode = 0xEC00000; | 478 | mask_keycode = 0xEC00000; |
385 | mask_keydown = 0x0040000; | 479 | mask_keydown = 0x0040000; |
@@ -393,20 +487,25 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
393 | break; | 487 | break; |
394 | case SAA7134_BOARD_ECS_TVP3XP: | 488 | case SAA7134_BOARD_ECS_TVP3XP: |
395 | case SAA7134_BOARD_ECS_TVP3XP_4CB5: | 489 | case SAA7134_BOARD_ECS_TVP3XP_4CB5: |
396 | ir_codes = eztv_codes; | 490 | ir_codes = eztv_codes; |
397 | mask_keycode = 0x00017c; | 491 | mask_keycode = 0x00017c; |
398 | mask_keyup = 0x000002; | 492 | mask_keyup = 0x000002; |
399 | polling = 50; // ms | 493 | polling = 50; // ms |
400 | break; | 494 | break; |
495 | case SAA7134_BOARD_KWORLD_XPERT: | ||
401 | case SAA7134_BOARD_AVACSSMARTTV: | 496 | case SAA7134_BOARD_AVACSSMARTTV: |
402 | ir_codes = avacssmart_codes; | 497 | ir_codes = avacssmart_codes; |
403 | mask_keycode = 0x00001F; | 498 | mask_keycode = 0x00001F; |
404 | mask_keyup = 0x000020; | 499 | mask_keyup = 0x000020; |
405 | polling = 50; // ms | 500 | polling = 50; // ms |
406 | break; | 501 | break; |
407 | case SAA7134_BOARD_MD2819: | 502 | case SAA7134_BOARD_MD2819: |
503 | case SAA7134_BOARD_KWORLD_VSTREAM_XPERT: | ||
408 | case SAA7134_BOARD_AVERMEDIA_305: | 504 | case SAA7134_BOARD_AVERMEDIA_305: |
409 | case SAA7134_BOARD_AVERMEDIA_307: | 505 | case SAA7134_BOARD_AVERMEDIA_307: |
506 | case SAA7134_BOARD_AVERMEDIA_STUDIO_305: | ||
507 | case SAA7134_BOARD_AVERMEDIA_STUDIO_307: | ||
508 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM: | ||
410 | ir_codes = md2819_codes; | 509 | ir_codes = md2819_codes; |
411 | mask_keycode = 0x0007C8; | 510 | mask_keycode = 0x0007C8; |
412 | mask_keydown = 0x000010; | 511 | mask_keydown = 0x000010; |
@@ -415,7 +514,16 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
415 | saa_setb(SAA7134_GPIO_GPMODE0, 0x4); | 514 | saa_setb(SAA7134_GPIO_GPMODE0, 0x4); |
416 | saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); | 515 | saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); |
417 | break; | 516 | break; |
517 | case SAA7134_BOARD_MANLI_MTV001: | ||
518 | case SAA7134_BOARD_MANLI_MTV002: | ||
519 | ir_codes = manli_codes; | ||
520 | mask_keycode = 0x001f00; | ||
521 | mask_keyup = 0x004000; | ||
522 | mask_keydown = 0x002000; | ||
523 | polling = 50; // ms | ||
524 | break; | ||
418 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: | 525 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: |
526 | case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: | ||
419 | ir_codes = videomate_tv_pvr_codes; | 527 | ir_codes = videomate_tv_pvr_codes; |
420 | mask_keycode = 0x00003F; | 528 | mask_keycode = 0x00003F; |
421 | mask_keyup = 0x400000; | 529 | mask_keyup = 0x400000; |
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index 6b6a643bf1cd..b5bede95dbf5 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-oss.c,v 1.13 2004/12/10 12:33:39 kraxel Exp $ | 2 | * $Id: saa7134-oss.c,v 1.17 2005/06/28 23:41:47 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * oss dsp interface | 5 | * oss dsp interface |
@@ -49,7 +49,6 @@ MODULE_PARM_DESC(oss_rate,"sample rate (valid are: 32000,48000)"); | |||
49 | 49 | ||
50 | static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) | 50 | static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) |
51 | { | 51 | { |
52 | blksize &= ~0xff; | ||
53 | if (blksize < 0x100) | 52 | if (blksize < 0x100) |
54 | blksize = 0x100; | 53 | blksize = 0x100; |
55 | if (blksize > 0x10000) | 54 | if (blksize > 0x10000) |
@@ -57,8 +56,6 @@ static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) | |||
57 | 56 | ||
58 | if (blocks < 2) | 57 | if (blocks < 2) |
59 | blocks = 2; | 58 | blocks = 2; |
60 | while ((blksize * blocks) & ~PAGE_MASK) | ||
61 | blocks++; | ||
62 | if ((blksize * blocks) > 1024*1024) | 59 | if ((blksize * blocks) > 1024*1024) |
63 | blocks = 1024*1024 / blksize; | 60 | blocks = 1024*1024 / blksize; |
64 | 61 | ||
@@ -79,7 +76,7 @@ static int dsp_buffer_init(struct saa7134_dev *dev) | |||
79 | BUG(); | 76 | BUG(); |
80 | videobuf_dma_init(&dev->oss.dma); | 77 | videobuf_dma_init(&dev->oss.dma); |
81 | err = videobuf_dma_init_kernel(&dev->oss.dma, PCI_DMA_FROMDEVICE, | 78 | err = videobuf_dma_init_kernel(&dev->oss.dma, PCI_DMA_FROMDEVICE, |
82 | dev->oss.bufsize >> PAGE_SHIFT); | 79 | (dev->oss.bufsize + PAGE_SIZE) >> PAGE_SHIFT); |
83 | if (0 != err) | 80 | if (0 != err) |
84 | return err; | 81 | return err; |
85 | return 0; | 82 | return 0; |
@@ -163,10 +160,11 @@ static int dsp_rec_start(struct saa7134_dev *dev) | |||
163 | fmt |= 0x04; | 160 | fmt |= 0x04; |
164 | fmt |= (TV == dev->oss.input) ? 0xc0 : 0x80; | 161 | fmt |= (TV == dev->oss.input) ? 0xc0 : 0x80; |
165 | 162 | ||
166 | saa_writeb(SAA7134_NUM_SAMPLES0, (dev->oss.blksize & 0x0000ff)); | 163 | saa_writeb(SAA7134_NUM_SAMPLES0, ((dev->oss.blksize - 1) & 0x0000ff)); |
167 | saa_writeb(SAA7134_NUM_SAMPLES1, (dev->oss.blksize & 0x00ff00) >> 8); | 164 | saa_writeb(SAA7134_NUM_SAMPLES1, ((dev->oss.blksize - 1) & 0x00ff00) >> 8); |
168 | saa_writeb(SAA7134_NUM_SAMPLES2, (dev->oss.blksize & 0xff0000) >> 16); | 165 | saa_writeb(SAA7134_NUM_SAMPLES2, ((dev->oss.blksize - 1) & 0xff0000) >> 16); |
169 | saa_writeb(SAA7134_AUDIO_FORMAT_CTRL, fmt); | 166 | saa_writeb(SAA7134_AUDIO_FORMAT_CTRL, fmt); |
167 | |||
170 | break; | 168 | break; |
171 | case PCI_DEVICE_ID_PHILIPS_SAA7133: | 169 | case PCI_DEVICE_ID_PHILIPS_SAA7133: |
172 | case PCI_DEVICE_ID_PHILIPS_SAA7135: | 170 | case PCI_DEVICE_ID_PHILIPS_SAA7135: |
@@ -558,21 +556,28 @@ mixer_recsrc_7134(struct saa7134_dev *dev) | |||
558 | static int | 556 | static int |
559 | mixer_recsrc_7133(struct saa7134_dev *dev) | 557 | mixer_recsrc_7133(struct saa7134_dev *dev) |
560 | { | 558 | { |
561 | u32 value = 0xbbbbbb; | 559 | u32 anabar, xbarin; |
562 | 560 | ||
561 | xbarin = 0x03; // adc | ||
562 | anabar = 0; | ||
563 | switch (dev->oss.input) { | 563 | switch (dev->oss.input) { |
564 | case TV: | 564 | case TV: |
565 | value = 0xbbbb10; /* MAIN */ | 565 | xbarin = 0; // Demodulator |
566 | anabar = 2; // DACs | ||
566 | break; | 567 | break; |
567 | case LINE1: | 568 | case LINE1: |
568 | value = 0xbbbb32; /* AUX1 */ | 569 | anabar = 0; // aux1, aux1 |
569 | break; | 570 | break; |
570 | case LINE2: | 571 | case LINE2: |
571 | case LINE2_LEFT: | 572 | case LINE2_LEFT: |
572 | value = 0xbbbb54; /* AUX2 */ | 573 | anabar = 9; // aux2, aux2 |
573 | break; | 574 | break; |
574 | } | 575 | } |
575 | saa_dsp_writel(dev, 0x46c >> 2, value); | 576 | /* output xbar always main channel */ |
577 | saa_dsp_writel(dev, 0x46c >> 2, 0xbbbb10); | ||
578 | saa_dsp_writel(dev, 0x464 >> 2, xbarin); | ||
579 | saa_writel(0x594 >> 2, anabar); | ||
580 | |||
576 | return 0; | 581 | return 0; |
577 | } | 582 | } |
578 | 583 | ||
@@ -817,7 +822,7 @@ void saa7134_irq_oss_done(struct saa7134_dev *dev, unsigned long status) | |||
817 | reg = SAA7134_RS_BA1(6); | 822 | reg = SAA7134_RS_BA1(6); |
818 | } else { | 823 | } else { |
819 | /* even */ | 824 | /* even */ |
820 | if (0 == (dev->oss.dma_blk & 0x00)) | 825 | if (1 == (dev->oss.dma_blk & 0x01)) |
821 | reg = SAA7134_RS_BA2(6); | 826 | reg = SAA7134_RS_BA2(6); |
822 | } | 827 | } |
823 | if (0 == reg) { | 828 | if (0 == reg) { |
diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c index 345eb2a8c28d..4dd9f1b23928 100644 --- a/drivers/media/video/saa7134/saa7134-ts.c +++ b/drivers/media/video/saa7134/saa7134-ts.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-ts.c,v 1.14 2005/02/03 10:24:33 kraxel Exp $ | 2 | * $Id: saa7134-ts.c,v 1.15 2005/06/14 22:48:18 hhackmann Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * video4linux video interface | 5 | * video4linux video interface |
@@ -221,10 +221,10 @@ void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status) | |||
221 | if (dev->ts_q.curr) { | 221 | if (dev->ts_q.curr) { |
222 | field = dev->ts_q.curr->vb.field; | 222 | field = dev->ts_q.curr->vb.field; |
223 | if (field == V4L2_FIELD_TOP) { | 223 | if (field == V4L2_FIELD_TOP) { |
224 | if ((status & 0x100000) != 0x000000) | 224 | if ((status & 0x100000) != 0x100000) |
225 | goto done; | 225 | goto done; |
226 | } else { | 226 | } else { |
227 | if ((status & 0x100000) != 0x100000) | 227 | if ((status & 0x100000) != 0x000000) |
228 | goto done; | 228 | goto done; |
229 | } | 229 | } |
230 | saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE); | 230 | saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE); |
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index ecac13c006d5..eeafa5a71d2b 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-tvaudio.c,v 1.22 2005/01/07 13:11:19 kraxel Exp $ | 2 | * $Id: saa7134-tvaudio.c,v 1.30 2005/06/28 23:41:47 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * tv audio decoder (fm stereo, nicam, ...) | 5 | * tv audio decoder (fm stereo, nicam, ...) |
@@ -169,7 +169,7 @@ static void tvaudio_init(struct saa7134_dev *dev) | |||
169 | int clock = saa7134_boards[dev->board].audio_clock; | 169 | int clock = saa7134_boards[dev->board].audio_clock; |
170 | 170 | ||
171 | if (UNSET != audio_clock_override) | 171 | if (UNSET != audio_clock_override) |
172 | clock = audio_clock_override; | 172 | clock = audio_clock_override; |
173 | 173 | ||
174 | /* init all audio registers */ | 174 | /* init all audio registers */ |
175 | saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x00); | 175 | saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x00); |
@@ -181,7 +181,8 @@ static void tvaudio_init(struct saa7134_dev *dev) | |||
181 | saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff); | 181 | saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff); |
182 | saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff); | 182 | saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff); |
183 | saa_writeb(SAA7134_AUDIO_CLOCK2, (clock >> 16) & 0xff); | 183 | saa_writeb(SAA7134_AUDIO_CLOCK2, (clock >> 16) & 0xff); |
184 | saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x01); | 184 | // frame locked audio was reported not to be reliable |
185 | saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x02); | ||
185 | 186 | ||
186 | saa_writeb(SAA7134_NICAM_ERROR_LOW, 0x14); | 187 | saa_writeb(SAA7134_NICAM_ERROR_LOW, 0x14); |
187 | saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50); | 188 | saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50); |
@@ -218,14 +219,17 @@ static void mute_input_7134(struct saa7134_dev *dev) | |||
218 | in = dev->input; | 219 | in = dev->input; |
219 | mute = (dev->ctl_mute || | 220 | mute = (dev->ctl_mute || |
220 | (dev->automute && (&card(dev).radio) != in)); | 221 | (dev->automute && (&card(dev).radio) != in)); |
221 | if (PCI_DEVICE_ID_PHILIPS_SAA7130 == dev->pci->device && | 222 | if (card(dev).mute.name) { |
222 | card(dev).mute.name) { | 223 | /* |
223 | /* 7130 - we'll mute using some unconnected audio input */ | 224 | * 7130 - we'll mute using some unconnected audio input |
225 | * 7134 - we'll probably should switch external mux with gpio | ||
226 | */ | ||
224 | if (mute) | 227 | if (mute) |
225 | in = &card(dev).mute; | 228 | in = &card(dev).mute; |
226 | } | 229 | } |
230 | |||
227 | if (dev->hw_mute == mute && | 231 | if (dev->hw_mute == mute && |
228 | dev->hw_input == in) { | 232 | dev->hw_input == in) { |
229 | dprintk("mute/input: nothing to do [mute=%d,input=%s]\n", | 233 | dprintk("mute/input: nothing to do [mute=%d,input=%s]\n", |
230 | mute,in->name); | 234 | mute,in->name); |
231 | return; | 235 | return; |
@@ -250,10 +254,16 @@ static void mute_input_7134(struct saa7134_dev *dev) | |||
250 | saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, ausel); | 254 | saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, ausel); |
251 | saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x08, ics); | 255 | saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x08, ics); |
252 | saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x07, ocs); | 256 | saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x07, ocs); |
257 | // for oss, we need to change the clock configuration | ||
258 | if (in->amux == TV) | ||
259 | saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, 0x00); | ||
260 | else | ||
261 | saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, 0x01); | ||
253 | 262 | ||
254 | /* switch gpio-connected external audio mux */ | 263 | /* switch gpio-connected external audio mux */ |
255 | if (0 == card(dev).gpiomask) | 264 | if (0 == card(dev).gpiomask) |
256 | return; | 265 | return; |
266 | |||
257 | mask = card(dev).gpiomask; | 267 | mask = card(dev).gpiomask; |
258 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask); | 268 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask); |
259 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio); | 269 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio); |
@@ -333,13 +343,8 @@ static int tvaudio_sleep(struct saa7134_dev *dev, int timeout) | |||
333 | set_current_state(TASK_INTERRUPTIBLE); | 343 | set_current_state(TASK_INTERRUPTIBLE); |
334 | schedule(); | 344 | schedule(); |
335 | } else { | 345 | } else { |
336 | #if 0 | ||
337 | /* hmm, that one doesn't return on wakeup ... */ | ||
338 | msleep_interruptible(timeout); | ||
339 | #else | ||
340 | set_current_state(TASK_INTERRUPTIBLE); | 346 | set_current_state(TASK_INTERRUPTIBLE); |
341 | schedule_timeout(msecs_to_jiffies(timeout)); | 347 | schedule_timeout(msecs_to_jiffies(timeout)); |
342 | #endif | ||
343 | } | 348 | } |
344 | } | 349 | } |
345 | remove_wait_queue(&dev->thread.wq, &wait); | 350 | remove_wait_queue(&dev->thread.wq, &wait); |
@@ -394,27 +399,10 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, struct mainscan *scan) | |||
394 | return value; | 399 | return value; |
395 | } | 400 | } |
396 | 401 | ||
397 | #if 0 | ||
398 | static void sifdebug_dump_regs(struct saa7134_dev *dev) | ||
399 | { | ||
400 | print_regb(AUDIO_STATUS); | ||
401 | print_regb(IDENT_SIF); | ||
402 | print_regb(LEVEL_READOUT1); | ||
403 | print_regb(LEVEL_READOUT2); | ||
404 | print_regb(DCXO_IDENT_CTRL); | ||
405 | print_regb(DEMODULATOR); | ||
406 | print_regb(AGC_GAIN_SELECT); | ||
407 | print_regb(MONITOR_SELECT); | ||
408 | print_regb(FM_DEEMPHASIS); | ||
409 | print_regb(FM_DEMATRIX); | ||
410 | print_regb(SIF_SAMPLE_FREQ); | ||
411 | print_regb(ANALOG_IO_SELECT); | ||
412 | } | ||
413 | #endif | ||
414 | 402 | ||
415 | static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *audio) | 403 | static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *audio) |
416 | { | 404 | { |
417 | __u32 idp,nicam; | 405 | __u32 idp, nicam, nicam_status; |
418 | int retval = -1; | 406 | int retval = -1; |
419 | 407 | ||
420 | switch (audio->mode) { | 408 | switch (audio->mode) { |
@@ -436,19 +424,24 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au | |||
436 | break; | 424 | break; |
437 | case TVAUDIO_NICAM_FM: | 425 | case TVAUDIO_NICAM_FM: |
438 | case TVAUDIO_NICAM_AM: | 426 | case TVAUDIO_NICAM_AM: |
439 | nicam = saa_readb(SAA7134_NICAM_STATUS); | 427 | nicam = saa_readb(SAA7134_AUDIO_STATUS); |
440 | dprintk("getstereo: nicam=0x%x\n",nicam); | 428 | dprintk("getstereo: nicam=0x%x\n",nicam); |
441 | switch (nicam & 0x0b) { | 429 | if (nicam & 0x1) { |
442 | case 0x09: | 430 | nicam_status = saa_readb(SAA7134_NICAM_STATUS); |
443 | retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; | 431 | dprintk("getstereo: nicam_status=0x%x\n", nicam_status); |
444 | break; | 432 | |
445 | case 0x0a: | 433 | switch (nicam_status & 0x03) { |
446 | retval = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | 434 | case 0x01: |
447 | break; | 435 | retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; |
448 | case 0x08: | 436 | break; |
449 | default: | 437 | case 0x02: |
450 | retval = V4L2_TUNER_SUB_MONO; | 438 | retval = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; |
451 | break; | 439 | break; |
440 | default: | ||
441 | retval = V4L2_TUNER_SUB_MONO; | ||
442 | } | ||
443 | } else { | ||
444 | /* No nicam detected */ | ||
452 | } | 445 | } |
453 | break; | 446 | break; |
454 | } | 447 | } |
@@ -484,15 +477,15 @@ static int tvaudio_setstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au | |||
484 | break; | 477 | break; |
485 | case TVAUDIO_FM_K_STEREO: | 478 | case TVAUDIO_FM_K_STEREO: |
486 | case TVAUDIO_FM_BG_STEREO: | 479 | case TVAUDIO_FM_BG_STEREO: |
480 | case TVAUDIO_NICAM_AM: | ||
481 | case TVAUDIO_NICAM_FM: | ||
487 | dprintk("setstereo [fm] => %s\n", | 482 | dprintk("setstereo [fm] => %s\n", |
488 | name[ mode % ARRAY_SIZE(name) ]); | 483 | name[ mode % ARRAY_SIZE(name) ]); |
489 | reg = fm[ mode % ARRAY_SIZE(fm) ]; | 484 | reg = fm[ mode % ARRAY_SIZE(fm) ]; |
490 | saa_writeb(SAA7134_FM_DEMATRIX, reg); | 485 | saa_writeb(SAA7134_FM_DEMATRIX, reg); |
491 | break; | 486 | break; |
492 | case TVAUDIO_FM_SAT_STEREO: | 487 | case TVAUDIO_FM_SAT_STEREO: |
493 | case TVAUDIO_NICAM_AM: | 488 | /* Not implemented */ |
494 | case TVAUDIO_NICAM_FM: | ||
495 | /* FIXME */ | ||
496 | break; | 489 | break; |
497 | } | 490 | } |
498 | return 0; | 491 | return 0; |
@@ -572,14 +565,14 @@ static int tvaudio_thread(void *data) | |||
572 | } else if (0 != dev->last_carrier) { | 565 | } else if (0 != dev->last_carrier) { |
573 | /* no carrier -- try last detected one as fallback */ | 566 | /* no carrier -- try last detected one as fallback */ |
574 | carrier = dev->last_carrier; | 567 | carrier = dev->last_carrier; |
575 | printk(KERN_WARNING "%s/audio: audio carrier scan failed, " | 568 | dprintk(KERN_WARNING "%s/audio: audio carrier scan failed, " |
576 | "using %d.%03d MHz [last detected]\n", | 569 | "using %d.%03d MHz [last detected]\n", |
577 | dev->name, carrier/1000, carrier%1000); | 570 | dev->name, carrier/1000, carrier%1000); |
578 | 571 | ||
579 | } else { | 572 | } else { |
580 | /* no carrier + no fallback -- use default */ | 573 | /* no carrier + no fallback -- use default */ |
581 | carrier = default_carrier; | 574 | carrier = default_carrier; |
582 | printk(KERN_WARNING "%s/audio: audio carrier scan failed, " | 575 | dprintk(KERN_WARNING "%s/audio: audio carrier scan failed, " |
583 | "using %d.%03d MHz [default]\n", | 576 | "using %d.%03d MHz [default]\n", |
584 | dev->name, carrier/1000, carrier%1000); | 577 | dev->name, carrier/1000, carrier%1000); |
585 | } | 578 | } |
@@ -591,7 +584,7 @@ static int tvaudio_thread(void *data) | |||
591 | /* find the exact tv audio norm */ | 584 | /* find the exact tv audio norm */ |
592 | for (audio = UNSET, i = 0; i < TVAUDIO; i++) { | 585 | for (audio = UNSET, i = 0; i < TVAUDIO; i++) { |
593 | if (dev->tvnorm->id != UNSET && | 586 | if (dev->tvnorm->id != UNSET && |
594 | !(dev->tvnorm->id & tvaudio[i].std)) | 587 | !(dev->tvnorm->id & tvaudio[i].std)) |
595 | continue; | 588 | continue; |
596 | if (tvaudio[i].carr1 != carrier) | 589 | if (tvaudio[i].carr1 != carrier) |
597 | continue; | 590 | continue; |
@@ -698,24 +691,6 @@ static inline int saa_dsp_wait_bit(struct saa7134_dev *dev, int bit) | |||
698 | return 0; | 691 | return 0; |
699 | } | 692 | } |
700 | 693 | ||
701 | #if 0 | ||
702 | static int saa_dsp_readl(struct saa7134_dev *dev, int reg, u32 *value) | ||
703 | { | ||
704 | int err; | ||
705 | |||
706 | d2printk("dsp read reg 0x%x\n", reg<<2); | ||
707 | saa_readl(reg); | ||
708 | err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_RDB); | ||
709 | if (err < 0) | ||
710 | return err; | ||
711 | *value = saa_readl(reg); | ||
712 | d2printk("dsp read => 0x%06x\n", *value & 0xffffff); | ||
713 | err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_IDA); | ||
714 | if (err < 0) | ||
715 | return err; | ||
716 | return 0; | ||
717 | } | ||
718 | #endif | ||
719 | 694 | ||
720 | int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value) | 695 | int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value) |
721 | { | 696 | { |
@@ -748,31 +723,50 @@ static int getstereo_7133(struct saa7134_dev *dev) | |||
748 | static int mute_input_7133(struct saa7134_dev *dev) | 723 | static int mute_input_7133(struct saa7134_dev *dev) |
749 | { | 724 | { |
750 | u32 reg = 0; | 725 | u32 reg = 0; |
726 | u32 xbarin, xbarout; | ||
751 | int mask; | 727 | int mask; |
728 | struct saa7134_input *in; | ||
752 | 729 | ||
730 | /* Hac 0506 route OSS sound simultanously */ | ||
731 | xbarin = 0x03; | ||
753 | switch (dev->input->amux) { | 732 | switch (dev->input->amux) { |
754 | case TV: | 733 | case TV: |
755 | reg = 0x02; | 734 | reg = 0x02; |
735 | xbarin = 0; | ||
756 | break; | 736 | break; |
757 | case LINE1: | 737 | case LINE1: |
758 | reg = 0x00; | 738 | reg = 0x00; |
759 | break; | 739 | break; |
760 | case LINE2: | 740 | case LINE2: |
761 | case LINE2_LEFT: | 741 | case LINE2_LEFT: |
762 | reg = 0x01; | 742 | reg = 0x09; |
763 | break; | 743 | break; |
764 | } | 744 | } |
765 | if (dev->ctl_mute) | 745 | saa_dsp_writel(dev, 0x464 >> 2, xbarin); |
746 | if (dev->ctl_mute) { | ||
766 | reg = 0x07; | 747 | reg = 0x07; |
748 | xbarout = 0xbbbbbb; | ||
749 | } else | ||
750 | xbarout = 0xbbbb10; | ||
751 | saa_dsp_writel(dev, 0x46c >> 2, xbarout); | ||
752 | |||
767 | saa_writel(0x594 >> 2, reg); | 753 | saa_writel(0x594 >> 2, reg); |
768 | 754 | ||
755 | |||
769 | /* switch gpio-connected external audio mux */ | 756 | /* switch gpio-connected external audio mux */ |
770 | if (0 != card(dev).gpiomask) { | 757 | if (0 != card(dev).gpiomask) { |
771 | mask = card(dev).gpiomask; | 758 | mask = card(dev).gpiomask; |
759 | |||
760 | if (card(dev).mute.name && dev->ctl_mute) | ||
761 | in = &card(dev).mute; | ||
762 | else | ||
763 | in = dev->input; | ||
764 | |||
772 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask); | 765 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask); |
773 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, dev->input->gpio); | 766 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio); |
774 | saa7134_track_gpio(dev,dev->input->name); | 767 | saa7134_track_gpio(dev,in->name); |
775 | } | 768 | } |
769 | |||
776 | return 0; | 770 | return 0; |
777 | } | 771 | } |
778 | 772 | ||
diff --git a/drivers/media/video/saa7134/saa7134-vbi.c b/drivers/media/video/saa7134/saa7134-vbi.c index 86954cc7c377..29e51cad2aaf 100644 --- a/drivers/media/video/saa7134/saa7134-vbi.c +++ b/drivers/media/video/saa7134/saa7134-vbi.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-vbi.c,v 1.6 2004/12/10 12:33:39 kraxel Exp $ | 2 | * $Id: saa7134-vbi.c,v 1.7 2005/05/24 23:13:06 nsh Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * video4linux video interface | 5 | * video4linux video interface |
@@ -60,10 +60,10 @@ static void task_init(struct saa7134_dev *dev, struct saa7134_buf *buf, | |||
60 | saa_writeb(SAA7134_VBI_H_START2(task), norm->h_start >> 8); | 60 | saa_writeb(SAA7134_VBI_H_START2(task), norm->h_start >> 8); |
61 | saa_writeb(SAA7134_VBI_H_STOP1(task), norm->h_stop & 0xff); | 61 | saa_writeb(SAA7134_VBI_H_STOP1(task), norm->h_stop & 0xff); |
62 | saa_writeb(SAA7134_VBI_H_STOP2(task), norm->h_stop >> 8); | 62 | saa_writeb(SAA7134_VBI_H_STOP2(task), norm->h_stop >> 8); |
63 | saa_writeb(SAA7134_VBI_V_START1(task), norm->vbi_v_start & 0xff); | 63 | saa_writeb(SAA7134_VBI_V_START1(task), norm->vbi_v_start_0 & 0xff); |
64 | saa_writeb(SAA7134_VBI_V_START2(task), norm->vbi_v_start >> 8); | 64 | saa_writeb(SAA7134_VBI_V_START2(task), norm->vbi_v_start_0 >> 8); |
65 | saa_writeb(SAA7134_VBI_V_STOP1(task), norm->vbi_v_stop & 0xff); | 65 | saa_writeb(SAA7134_VBI_V_STOP1(task), norm->vbi_v_stop_0 & 0xff); |
66 | saa_writeb(SAA7134_VBI_V_STOP2(task), norm->vbi_v_stop >> 8); | 66 | saa_writeb(SAA7134_VBI_V_STOP2(task), norm->vbi_v_stop_0 >> 8); |
67 | 67 | ||
68 | saa_writeb(SAA7134_VBI_H_SCALE_INC1(task), VBI_SCALE & 0xff); | 68 | saa_writeb(SAA7134_VBI_H_SCALE_INC1(task), VBI_SCALE & 0xff); |
69 | saa_writeb(SAA7134_VBI_H_SCALE_INC2(task), VBI_SCALE >> 8); | 69 | saa_writeb(SAA7134_VBI_H_SCALE_INC2(task), VBI_SCALE >> 8); |
@@ -127,16 +127,10 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
127 | unsigned int lines, llength, size; | 127 | unsigned int lines, llength, size; |
128 | int err; | 128 | int err; |
129 | 129 | ||
130 | lines = norm->vbi_v_stop - norm->vbi_v_start +1; | 130 | lines = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1; |
131 | if (lines > VBI_LINE_COUNT) | 131 | if (lines > VBI_LINE_COUNT) |
132 | lines = VBI_LINE_COUNT; | 132 | lines = VBI_LINE_COUNT; |
133 | #if 1 | ||
134 | llength = VBI_LINE_LENGTH; | 133 | llength = VBI_LINE_LENGTH; |
135 | #else | ||
136 | llength = (norm->h_stop - norm->h_start +1) * 2; | ||
137 | if (llength > VBI_LINE_LENGTH) | ||
138 | llength = VBI_LINE_LENGTH; | ||
139 | #endif | ||
140 | size = lines * llength * 2; | 134 | size = lines * llength * 2; |
141 | if (0 != buf->vb.baddr && buf->vb.bsize < size) | 135 | if (0 != buf->vb.baddr && buf->vb.bsize < size) |
142 | return -EINVAL; | 136 | return -EINVAL; |
@@ -177,14 +171,8 @@ buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size) | |||
177 | struct saa7134_dev *dev = fh->dev; | 171 | struct saa7134_dev *dev = fh->dev; |
178 | int llength,lines; | 172 | int llength,lines; |
179 | 173 | ||
180 | lines = dev->tvnorm->vbi_v_stop - dev->tvnorm->vbi_v_start +1; | 174 | lines = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 +1; |
181 | #if 1 | ||
182 | llength = VBI_LINE_LENGTH; | 175 | llength = VBI_LINE_LENGTH; |
183 | #else | ||
184 | llength = (norm->h_stop - norm->h_start +1) * 2; | ||
185 | if (llength > VBI_LINE_LENGTH) | ||
186 | llength = VBI_LINE_LENGTH; | ||
187 | #endif | ||
188 | *size = lines * llength * 2; | 176 | *size = lines * llength * 2; |
189 | if (0 == *count) | 177 | if (0 == *count) |
190 | *count = vbibufs; | 178 | *count = vbibufs; |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 5d66060026ff..a4c2f751d097 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-video.c,v 1.28 2005/02/15 15:59:35 kraxel Exp $ | 2 | * $Id: saa7134-video.c,v 1.36 2005/06/28 23:41:47 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * video4linux video interface | 5 | * video4linux video interface |
@@ -31,8 +31,6 @@ | |||
31 | #include "saa7134-reg.h" | 31 | #include "saa7134-reg.h" |
32 | #include "saa7134.h" | 32 | #include "saa7134.h" |
33 | 33 | ||
34 | #define V4L2_I2C_CLIENTS 1 | ||
35 | |||
36 | /* ------------------------------------------------------------------ */ | 34 | /* ------------------------------------------------------------------ */ |
37 | 35 | ||
38 | static unsigned int video_debug = 0; | 36 | static unsigned int video_debug = 0; |
@@ -158,18 +156,20 @@ static struct saa7134_format formats[] = { | |||
158 | .h_stop = 719, \ | 156 | .h_stop = 719, \ |
159 | .video_v_start = 24, \ | 157 | .video_v_start = 24, \ |
160 | .video_v_stop = 311, \ | 158 | .video_v_stop = 311, \ |
161 | .vbi_v_start = 7, \ | 159 | .vbi_v_start_0 = 7, \ |
162 | .vbi_v_stop = 22, \ | 160 | .vbi_v_stop_0 = 22, \ |
161 | .vbi_v_start_1 = 319, \ | ||
163 | .src_timing = 4 | 162 | .src_timing = 4 |
164 | 163 | ||
165 | #define NORM_525_60 \ | 164 | #define NORM_525_60 \ |
166 | .h_start = 0, \ | 165 | .h_start = 0, \ |
167 | .h_stop = 703, \ | 166 | .h_stop = 703, \ |
168 | .video_v_start = 22, \ | 167 | .video_v_start = 23, \ |
169 | .video_v_stop = 22+239, \ | 168 | .video_v_stop = 262, \ |
170 | .vbi_v_start = 10, /* FIXME */ \ | 169 | .vbi_v_start_0 = 10, \ |
171 | .vbi_v_stop = 21, /* FIXME */ \ | 170 | .vbi_v_stop_0 = 21, \ |
172 | .src_timing = 1 | 171 | .vbi_v_start_1 = 273, \ |
172 | .src_timing = 7 | ||
173 | 173 | ||
174 | static struct saa7134_tvnorm tvnorms[] = { | 174 | static struct saa7134_tvnorm tvnorms[] = { |
175 | { | 175 | { |
@@ -274,11 +274,12 @@ static struct saa7134_tvnorm tvnorms[] = { | |||
274 | 274 | ||
275 | .h_start = 0, | 275 | .h_start = 0, |
276 | .h_stop = 719, | 276 | .h_stop = 719, |
277 | .video_v_start = 22, | 277 | .video_v_start = 23, |
278 | .video_v_stop = 22+239, | 278 | .video_v_stop = 262, |
279 | .vbi_v_start = 10, /* FIXME */ | 279 | .vbi_v_start_0 = 10, |
280 | .vbi_v_stop = 21, /* FIXME */ | 280 | .vbi_v_stop_0 = 21, |
281 | .src_timing = 1, | 281 | .vbi_v_start_1 = 273, |
282 | .src_timing = 7, | ||
282 | 283 | ||
283 | .sync_control = 0x18, | 284 | .sync_control = 0x18, |
284 | .luma_control = 0x40, | 285 | .luma_control = 0x40, |
@@ -335,8 +336,8 @@ static const struct v4l2_queryctrl video_ctrls[] = { | |||
335 | .default_value = 0, | 336 | .default_value = 0, |
336 | .type = V4L2_CTRL_TYPE_INTEGER, | 337 | .type = V4L2_CTRL_TYPE_INTEGER, |
337 | },{ | 338 | },{ |
338 | .id = V4L2_CID_VFLIP, | 339 | .id = V4L2_CID_HFLIP, |
339 | .name = "vertical flip", | 340 | .name = "Mirror", |
340 | .minimum = 0, | 341 | .minimum = 0, |
341 | .maximum = 1, | 342 | .maximum = 1, |
342 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 343 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
@@ -482,7 +483,7 @@ static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm) | |||
482 | dev->crop_bounds.width = norm->h_stop - norm->h_start +1; | 483 | dev->crop_bounds.width = norm->h_stop - norm->h_start +1; |
483 | dev->crop_defrect.width = norm->h_stop - norm->h_start +1; | 484 | dev->crop_defrect.width = norm->h_stop - norm->h_start +1; |
484 | 485 | ||
485 | dev->crop_bounds.top = (norm->vbi_v_stop+1)*2; | 486 | dev->crop_bounds.top = (norm->vbi_v_stop_0+1)*2; |
486 | dev->crop_defrect.top = norm->video_v_start*2; | 487 | dev->crop_defrect.top = norm->video_v_start*2; |
487 | dev->crop_bounds.height = ((norm->id & V4L2_STD_525_60) ? 524 : 624) | 488 | dev->crop_bounds.height = ((norm->id & V4L2_STD_525_60) ? 524 : 624) |
488 | - dev->crop_bounds.top; | 489 | - dev->crop_bounds.top; |
@@ -521,22 +522,7 @@ static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm) | |||
521 | saa_writeb(SAA7134_RAW_DATA_GAIN, 0x40); | 522 | saa_writeb(SAA7134_RAW_DATA_GAIN, 0x40); |
522 | saa_writeb(SAA7134_RAW_DATA_OFFSET, 0x80); | 523 | saa_writeb(SAA7134_RAW_DATA_OFFSET, 0x80); |
523 | 524 | ||
524 | #ifdef V4L2_I2C_CLIENTS | ||
525 | saa7134_i2c_call_clients(dev,VIDIOC_S_STD,&norm->id); | 525 | saa7134_i2c_call_clients(dev,VIDIOC_S_STD,&norm->id); |
526 | #else | ||
527 | { | ||
528 | /* pass down info to the i2c chips (v4l1) */ | ||
529 | struct video_channel c; | ||
530 | memset(&c,0,sizeof(c)); | ||
531 | c.channel = dev->ctl_input; | ||
532 | c.norm = VIDEO_MODE_PAL; | ||
533 | if (norm->id & V4L2_STD_NTSC) | ||
534 | c.norm = VIDEO_MODE_NTSC; | ||
535 | if (norm->id & V4L2_STD_SECAM) | ||
536 | c.norm = VIDEO_MODE_SECAM; | ||
537 | saa7134_i2c_call_clients(dev,VIDIOCSCHAN,&c); | ||
538 | } | ||
539 | #endif | ||
540 | } | 526 | } |
541 | 527 | ||
542 | static void video_mux(struct saa7134_dev *dev, int input) | 528 | static void video_mux(struct saa7134_dev *dev, int input) |
@@ -1064,7 +1050,7 @@ static int get_control(struct saa7134_dev *dev, struct v4l2_control *c) | |||
1064 | case V4L2_CID_PRIVATE_INVERT: | 1050 | case V4L2_CID_PRIVATE_INVERT: |
1065 | c->value = dev->ctl_invert; | 1051 | c->value = dev->ctl_invert; |
1066 | break; | 1052 | break; |
1067 | case V4L2_CID_VFLIP: | 1053 | case V4L2_CID_HFLIP: |
1068 | c->value = dev->ctl_mirror; | 1054 | c->value = dev->ctl_mirror; |
1069 | break; | 1055 | break; |
1070 | case V4L2_CID_PRIVATE_Y_EVEN: | 1056 | case V4L2_CID_PRIVATE_Y_EVEN: |
@@ -1139,7 +1125,7 @@ static int set_control(struct saa7134_dev *dev, struct saa7134_fh *fh, | |||
1139 | saa_writeb(SAA7134_DEC_CHROMA_SATURATION, | 1125 | saa_writeb(SAA7134_DEC_CHROMA_SATURATION, |
1140 | dev->ctl_invert ? -dev->ctl_saturation : dev->ctl_saturation); | 1126 | dev->ctl_invert ? -dev->ctl_saturation : dev->ctl_saturation); |
1141 | break; | 1127 | break; |
1142 | case V4L2_CID_VFLIP: | 1128 | case V4L2_CID_HFLIP: |
1143 | dev->ctl_mirror = c->value; | 1129 | dev->ctl_mirror = c->value; |
1144 | restart_overlay = 1; | 1130 | restart_overlay = 1; |
1145 | break; | 1131 | break; |
@@ -1218,7 +1204,6 @@ static int video_open(struct inode *inode, struct file *file) | |||
1218 | struct list_head *list; | 1204 | struct list_head *list; |
1219 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1205 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1220 | int radio = 0; | 1206 | int radio = 0; |
1221 | |||
1222 | list_for_each(list,&saa7134_devlist) { | 1207 | list_for_each(list,&saa7134_devlist) { |
1223 | h = list_entry(list, struct saa7134_dev, devlist); | 1208 | h = list_entry(list, struct saa7134_dev, devlist); |
1224 | if (h->video_dev && (h->video_dev->minor == minor)) | 1209 | if (h->video_dev && (h->video_dev->minor == minor)) |
@@ -1270,12 +1255,12 @@ static int video_open(struct inode *inode, struct file *file) | |||
1270 | if (fh->radio) { | 1255 | if (fh->radio) { |
1271 | /* switch to radio mode */ | 1256 | /* switch to radio mode */ |
1272 | saa7134_tvaudio_setinput(dev,&card(dev).radio); | 1257 | saa7134_tvaudio_setinput(dev,&card(dev).radio); |
1273 | saa7134_i2c_call_clients(dev,AUDC_SET_RADIO,NULL); | 1258 | saa7134_i2c_call_clients(dev,AUDC_SET_RADIO, NULL); |
1274 | } else { | 1259 | } else { |
1275 | /* switch to video/vbi mode */ | 1260 | /* switch to video/vbi mode */ |
1276 | video_mux(dev,dev->ctl_input); | 1261 | video_mux(dev,dev->ctl_input); |
1277 | } | 1262 | } |
1278 | return 0; | 1263 | return 0; |
1279 | } | 1264 | } |
1280 | 1265 | ||
1281 | static ssize_t | 1266 | static ssize_t |
@@ -1318,10 +1303,10 @@ video_poll(struct file *file, struct poll_table_struct *wait) | |||
1318 | } else { | 1303 | } else { |
1319 | down(&fh->cap.lock); | 1304 | down(&fh->cap.lock); |
1320 | if (UNSET == fh->cap.read_off) { | 1305 | if (UNSET == fh->cap.read_off) { |
1321 | /* need to capture a new frame */ | 1306 | /* need to capture a new frame */ |
1322 | if (res_locked(fh->dev,RESOURCE_VIDEO)) { | 1307 | if (res_locked(fh->dev,RESOURCE_VIDEO)) { |
1323 | up(&fh->cap.lock); | 1308 | up(&fh->cap.lock); |
1324 | return POLLERR; | 1309 | return POLLERR; |
1325 | } | 1310 | } |
1326 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) { | 1311 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) { |
1327 | up(&fh->cap.lock); | 1312 | up(&fh->cap.lock); |
@@ -1377,6 +1362,36 @@ static int video_release(struct inode *inode, struct file *file) | |||
1377 | res_free(dev,fh,RESOURCE_VBI); | 1362 | res_free(dev,fh,RESOURCE_VBI); |
1378 | } | 1363 | } |
1379 | 1364 | ||
1365 | /* ts-capture will not work in planar mode, so turn it off Hac: 04.05*/ | ||
1366 | saa_andorb(SAA7134_OFMT_VIDEO_A, 0x1f, 0); | ||
1367 | saa_andorb(SAA7134_OFMT_VIDEO_B, 0x1f, 0); | ||
1368 | saa_andorb(SAA7134_OFMT_DATA_A, 0x1f, 0); | ||
1369 | saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0); | ||
1370 | |||
1371 | if (dev->tuner_type == TUNER_PHILIPS_TDA8290) { | ||
1372 | u8 data[2]; | ||
1373 | int ret; | ||
1374 | struct i2c_msg msg = {.addr=I2C_ADDR_TDA8290, .flags=0, .buf=data, .len = 2}; | ||
1375 | data[0] = 0x21; | ||
1376 | data[1] = 0xc0; | ||
1377 | ret = i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
1378 | if (ret != 1) | ||
1379 | printk(KERN_ERR "TDA8290 access failure\n"); | ||
1380 | msg.addr = I2C_ADDR_TDA8275; | ||
1381 | data[0] = 0x30; | ||
1382 | data[1] = 0xd0; | ||
1383 | ret = i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
1384 | if (ret != 1) | ||
1385 | printk(KERN_ERR "TDA8275 access failure\n"); | ||
1386 | msg.addr = I2C_ADDR_TDA8290; | ||
1387 | data[0] = 0x21; | ||
1388 | data[1] = 0x80; | ||
1389 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
1390 | data[0] = 0x00; | ||
1391 | data[1] = 0x02; | ||
1392 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
1393 | } | ||
1394 | |||
1380 | /* free stuff */ | 1395 | /* free stuff */ |
1381 | videobuf_mmap_free(&fh->cap); | 1396 | videobuf_mmap_free(&fh->cap); |
1382 | videobuf_mmap_free(&fh->vbi); | 1397 | videobuf_mmap_free(&fh->vbi); |
@@ -1407,19 +1422,12 @@ static void saa7134_vbi_fmt(struct saa7134_dev *dev, struct v4l2_format *f) | |||
1407 | f->fmt.vbi.samples_per_line = 2048 /* VBI_LINE_LENGTH */; | 1422 | f->fmt.vbi.samples_per_line = 2048 /* VBI_LINE_LENGTH */; |
1408 | f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; | 1423 | f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; |
1409 | f->fmt.vbi.offset = 64 * 4; | 1424 | f->fmt.vbi.offset = 64 * 4; |
1410 | f->fmt.vbi.start[0] = norm->vbi_v_start; | 1425 | f->fmt.vbi.start[0] = norm->vbi_v_start_0; |
1411 | f->fmt.vbi.count[0] = norm->vbi_v_stop - norm->vbi_v_start +1; | 1426 | f->fmt.vbi.count[0] = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1; |
1412 | f->fmt.vbi.start[1] = norm->video_v_stop + norm->vbi_v_start +1; | 1427 | f->fmt.vbi.start[1] = norm->vbi_v_start_1; |
1413 | f->fmt.vbi.count[1] = f->fmt.vbi.count[0]; | 1428 | f->fmt.vbi.count[1] = f->fmt.vbi.count[0]; |
1414 | f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */ | 1429 | f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */ |
1415 | 1430 | ||
1416 | #if 0 | ||
1417 | if (V4L2_STD_PAL == norm->id) { | ||
1418 | /* FIXME */ | ||
1419 | f->fmt.vbi.start[0] += 3; | ||
1420 | f->fmt.vbi.start[1] += 3*2; | ||
1421 | } | ||
1422 | #endif | ||
1423 | } | 1431 | } |
1424 | 1432 | ||
1425 | static int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh, | 1433 | static int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh, |
@@ -1880,11 +1888,9 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1880 | return -EINVAL; | 1888 | return -EINVAL; |
1881 | down(&dev->lock); | 1889 | down(&dev->lock); |
1882 | dev->ctl_freq = f->frequency; | 1890 | dev->ctl_freq = f->frequency; |
1883 | #ifdef V4L2_I2C_CLIENTS | 1891 | |
1884 | saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,f); | 1892 | saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,f); |
1885 | #else | 1893 | |
1886 | saa7134_i2c_call_clients(dev,VIDIOCSFREQ,&dev->ctl_freq); | ||
1887 | #endif | ||
1888 | saa7134_tvaudio_do_scan(dev); | 1894 | saa7134_tvaudio_do_scan(dev); |
1889 | up(&dev->lock); | 1895 | up(&dev->lock); |
1890 | return 0; | 1896 | return 0; |
@@ -2136,19 +2142,20 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
2136 | 2142 | ||
2137 | memset(t,0,sizeof(*t)); | 2143 | memset(t,0,sizeof(*t)); |
2138 | strcpy(t->name, "Radio"); | 2144 | strcpy(t->name, "Radio"); |
2139 | t->rangelow = (int)(65*16); | 2145 | |
2140 | t->rangehigh = (int)(108*16); | 2146 | saa7134_i2c_call_clients(dev, VIDIOC_G_TUNER, t); |
2141 | 2147 | ||
2142 | #ifdef V4L2_I2C_CLIENTS | 2148 | return 0; |
2143 | saa7134_i2c_call_clients(dev,VIDIOC_G_TUNER,t); | 2149 | } |
2144 | #else | 2150 | case VIDIOC_S_TUNER: |
2145 | { | 2151 | { |
2146 | struct video_tuner vt; | 2152 | struct v4l2_tuner *t = arg; |
2147 | memset(&vt,0,sizeof(vt)); | 2153 | |
2148 | saa7134_i2c_call_clients(dev,VIDIOCGTUNER,&vt); | 2154 | if (0 != t->index) |
2149 | t->signal = vt.signal; | 2155 | return -EINVAL; |
2150 | } | 2156 | |
2151 | #endif | 2157 | saa7134_i2c_call_clients(dev,VIDIOC_S_TUNER,t); |
2158 | |||
2152 | return 0; | 2159 | return 0; |
2153 | } | 2160 | } |
2154 | case VIDIOC_ENUMINPUT: | 2161 | case VIDIOC_ENUMINPUT: |
@@ -2182,7 +2189,6 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
2182 | return 0; | 2189 | return 0; |
2183 | } | 2190 | } |
2184 | case VIDIOC_S_AUDIO: | 2191 | case VIDIOC_S_AUDIO: |
2185 | case VIDIOC_S_TUNER: | ||
2186 | case VIDIOC_S_INPUT: | 2192 | case VIDIOC_S_INPUT: |
2187 | case VIDIOC_S_STD: | 2193 | case VIDIOC_S_STD: |
2188 | return 0; | 2194 | return 0; |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index ac90a9853236..2af0cb2a731b 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134.h,v 1.38 2005/03/07 12:01:51 kraxel Exp $ | 2 | * $Id: saa7134.h,v 1.49 2005/07/13 17:25:25 mchehab Exp $ |
3 | * | 3 | * |
4 | * v4l2 device driver for philips saa7134 based TV cards | 4 | * v4l2 device driver for philips saa7134 based TV cards |
5 | * | 5 | * |
@@ -21,7 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/version.h> | 23 | #include <linux/version.h> |
24 | #define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,12) | 24 | #define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,14) |
25 | 25 | ||
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
@@ -46,8 +46,6 @@ | |||
46 | #endif | 46 | #endif |
47 | #define UNSET (-1U) | 47 | #define UNSET (-1U) |
48 | 48 | ||
49 | /* 2.4 / 2.5 driver compatibility stuff */ | ||
50 | |||
51 | /* ----------------------------------------------------------- */ | 49 | /* ----------------------------------------------------------- */ |
52 | /* enums */ | 50 | /* enums */ |
53 | 51 | ||
@@ -91,9 +89,10 @@ struct saa7134_tvnorm { | |||
91 | unsigned int h_stop; | 89 | unsigned int h_stop; |
92 | unsigned int video_v_start; | 90 | unsigned int video_v_start; |
93 | unsigned int video_v_stop; | 91 | unsigned int video_v_stop; |
94 | unsigned int vbi_v_start; | 92 | unsigned int vbi_v_start_0; |
95 | unsigned int vbi_v_stop; | 93 | unsigned int vbi_v_stop_0; |
96 | unsigned int src_timing; | 94 | unsigned int src_timing; |
95 | unsigned int vbi_v_start_1; | ||
97 | }; | 96 | }; |
98 | 97 | ||
99 | struct saa7134_tvaudio { | 98 | struct saa7134_tvaudio { |
@@ -158,7 +157,7 @@ struct saa7134_format { | |||
158 | #define SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER 33 | 157 | #define SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER 33 |
159 | #define SAA7134_BOARD_NOVAC_PRIMETV7133 34 | 158 | #define SAA7134_BOARD_NOVAC_PRIMETV7133 34 |
160 | #define SAA7134_BOARD_AVERMEDIA_STUDIO_305 35 | 159 | #define SAA7134_BOARD_AVERMEDIA_STUDIO_305 35 |
161 | #define SAA7133_BOARD_UPMOST_PURPLE_TV 36 | 160 | #define SAA7134_BOARD_UPMOST_PURPLE_TV 36 |
162 | #define SAA7134_BOARD_ITEMS_MTV005 37 | 161 | #define SAA7134_BOARD_ITEMS_MTV005 37 |
163 | #define SAA7134_BOARD_CINERGY200 38 | 162 | #define SAA7134_BOARD_CINERGY200 38 |
164 | #define SAA7134_BOARD_FLYTVPLATINUM_MINI 39 | 163 | #define SAA7134_BOARD_FLYTVPLATINUM_MINI 39 |
@@ -167,7 +166,7 @@ struct saa7134_format { | |||
167 | #define SAA7134_BOARD_SABRENT_SBTTVFM 42 | 166 | #define SAA7134_BOARD_SABRENT_SBTTVFM 42 |
168 | #define SAA7134_BOARD_ZOLID_XPERT_TV7134 43 | 167 | #define SAA7134_BOARD_ZOLID_XPERT_TV7134 43 |
169 | #define SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE 44 | 168 | #define SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE 44 |
170 | #define SAA7134_BOARD_AVERMEDIA_307 45 | 169 | #define SAA7134_BOARD_AVERMEDIA_STUDIO_307 45 |
171 | #define SAA7134_BOARD_AVERMEDIA_CARDBUS 46 | 170 | #define SAA7134_BOARD_AVERMEDIA_CARDBUS 46 |
172 | #define SAA7134_BOARD_CINERGY400_CARDBUS 47 | 171 | #define SAA7134_BOARD_CINERGY400_CARDBUS 47 |
173 | #define SAA7134_BOARD_CINERGY600_MK3 48 | 172 | #define SAA7134_BOARD_CINERGY600_MK3 48 |
@@ -175,9 +174,17 @@ struct saa7134_format { | |||
175 | #define SAA7134_BOARD_PINNACLE_300I_DVBT_PAL 50 | 174 | #define SAA7134_BOARD_PINNACLE_300I_DVBT_PAL 50 |
176 | #define SAA7134_BOARD_PROVIDEO_PV952 51 | 175 | #define SAA7134_BOARD_PROVIDEO_PV952 51 |
177 | #define SAA7134_BOARD_AVERMEDIA_305 52 | 176 | #define SAA7134_BOARD_AVERMEDIA_305 52 |
178 | #define SAA7135_BOARD_ASUSTeK_TVFM7135 53 | 177 | #define SAA7134_BOARD_ASUSTeK_TVFM7135 53 |
179 | #define SAA7134_BOARD_FLYTVPLATINUM_FM 54 | 178 | #define SAA7134_BOARD_FLYTVPLATINUM_FM 54 |
180 | #define SAA7134_BOARD_FLYDVBTDUO 55 | 179 | #define SAA7134_BOARD_FLYDVBTDUO 55 |
180 | #define SAA7134_BOARD_AVERMEDIA_307 56 | ||
181 | #define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57 | ||
182 | #define SAA7134_BOARD_ADS_INSTANT_TV 58 | ||
183 | #define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59 | ||
184 | #define SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS 60 | ||
185 | #define SAA7134_BOARD_PHILIPS_TOUGH 61 | ||
186 | #define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII 62 | ||
187 | #define SAA7134_BOARD_KWORLD_XPERT 63 | ||
181 | 188 | ||
182 | #define SAA7134_MAXBOARDS 8 | 189 | #define SAA7134_MAXBOARDS 8 |
183 | #define SAA7134_INPUT_MAX 8 | 190 | #define SAA7134_INPUT_MAX 8 |
@@ -208,6 +215,10 @@ struct saa7134_board { | |||
208 | 215 | ||
209 | /* i2c chip info */ | 216 | /* i2c chip info */ |
210 | unsigned int tuner_type; | 217 | unsigned int tuner_type; |
218 | unsigned int radio_type; | ||
219 | unsigned char tuner_addr; | ||
220 | unsigned char radio_addr; | ||
221 | |||
211 | unsigned int tda9887_conf; | 222 | unsigned int tda9887_conf; |
212 | 223 | ||
213 | /* peripheral I/O */ | 224 | /* peripheral I/O */ |
@@ -241,7 +252,7 @@ struct saa7134_dma; | |||
241 | /* saa7134 page table */ | 252 | /* saa7134 page table */ |
242 | struct saa7134_pgtable { | 253 | struct saa7134_pgtable { |
243 | unsigned int size; | 254 | unsigned int size; |
244 | u32 *cpu; | 255 | __le32 *cpu; |
245 | dma_addr_t dma; | 256 | dma_addr_t dma; |
246 | }; | 257 | }; |
247 | 258 | ||
@@ -398,9 +409,12 @@ struct saa7134_dev { | |||
398 | /* config info */ | 409 | /* config info */ |
399 | unsigned int board; | 410 | unsigned int board; |
400 | unsigned int tuner_type; | 411 | unsigned int tuner_type; |
412 | unsigned int radio_type; | ||
413 | unsigned char tuner_addr; | ||
414 | unsigned char radio_addr; | ||
415 | |||
401 | unsigned int tda9887_conf; | 416 | unsigned int tda9887_conf; |
402 | unsigned int gpio_value; | 417 | unsigned int gpio_value; |
403 | unsigned int irq2_mask; | ||
404 | 418 | ||
405 | /* i2c i/o */ | 419 | /* i2c i/o */ |
406 | struct i2c_adapter i2c_adap; | 420 | struct i2c_adapter i2c_adap; |
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index 5f0b224c3cb6..108e7a4a0273 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c | |||
@@ -380,22 +380,14 @@ saa7185_command (struct i2c_client *client, | |||
380 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' | 380 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' |
381 | */ | 381 | */ |
382 | static unsigned short normal_i2c[] = { I2C_SAA7185 >> 1, I2C_CLIENT_END }; | 382 | static unsigned short normal_i2c[] = { I2C_SAA7185 >> 1, I2C_CLIENT_END }; |
383 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | ||
384 | 383 | ||
385 | static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | 384 | static unsigned short ignore = I2C_CLIENT_END; |
386 | static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
387 | static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
388 | static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
389 | static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END }; | ||
390 | 385 | ||
391 | static struct i2c_client_address_data addr_data = { | 386 | static struct i2c_client_address_data addr_data = { |
392 | .normal_i2c = normal_i2c, | 387 | .normal_i2c = normal_i2c, |
393 | .normal_i2c_range = normal_i2c_range, | 388 | .probe = &ignore, |
394 | .probe = probe, | 389 | .ignore = &ignore, |
395 | .probe_range = probe_range, | 390 | .force = &ignore, |
396 | .ignore = ignore, | ||
397 | .ignore_range = ignore_range, | ||
398 | .force = force | ||
399 | }; | 391 | }; |
400 | 392 | ||
401 | static struct i2c_driver i2c_driver_saa7185; | 393 | static struct i2c_driver i2c_driver_saa7185; |
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index 376a4a439e9b..7cb1fb3e66f9 100644 --- a/drivers/media/video/tda7432.c +++ b/drivers/media/video/tda7432.c | |||
@@ -74,7 +74,6 @@ static unsigned short normal_i2c[] = { | |||
74 | I2C_TDA7432 >> 1, | 74 | I2C_TDA7432 >> 1, |
75 | I2C_CLIENT_END, | 75 | I2C_CLIENT_END, |
76 | }; | 76 | }; |
77 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
78 | I2C_CLIENT_INSMOD; | 77 | I2C_CLIENT_INSMOD; |
79 | 78 | ||
80 | /* Structure of address and subaddresses for the tda7432 */ | 79 | /* Structure of address and subaddresses for the tda7432 */ |
@@ -244,19 +243,6 @@ static int tda7432_write(struct i2c_client *client, int subaddr, int val) | |||
244 | } | 243 | } |
245 | 244 | ||
246 | /* I don't think we ever actually _read_ the chip... */ | 245 | /* I don't think we ever actually _read_ the chip... */ |
247 | #if 0 | ||
248 | static int tda7432_read(struct i2c_client *client) | ||
249 | { | ||
250 | unsigned char buffer; | ||
251 | d2printk("tda7432: In tda7432_read\n"); | ||
252 | if (1 != i2c_master_recv(client,&buffer,1)) { | ||
253 | printk(KERN_WARNING "tda7432: I/O error, trying (read)\n"); | ||
254 | return -1; | ||
255 | } | ||
256 | dprintk("tda7432: Read 0x%02x\n", buffer); | ||
257 | return buffer; | ||
258 | } | ||
259 | #endif | ||
260 | 246 | ||
261 | static int tda7432_set(struct i2c_client *client) | 247 | static int tda7432_set(struct i2c_client *client) |
262 | { | 248 | { |
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index b27cc348d95c..a8b6a8df5109 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tda8290.c,v 1.7 2005/03/07 12:01:51 kraxel Exp $ | 2 | * $Id: tda8290.c,v 1.15 2005/07/08 20:21:33 mchehab Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * controls the philips tda8290+75 tuner chip combo. | 5 | * controls the philips tda8290+75 tuner chip combo. |
@@ -69,7 +69,7 @@ static __u8 get_freq_entry( struct freq_entry* table, __u16 freq) | |||
69 | static unsigned char i2c_enable_bridge[2] = { 0x21, 0xC0 }; | 69 | static unsigned char i2c_enable_bridge[2] = { 0x21, 0xC0 }; |
70 | static unsigned char i2c_disable_bridge[2] = { 0x21, 0x80 }; | 70 | static unsigned char i2c_disable_bridge[2] = { 0x21, 0x80 }; |
71 | static unsigned char i2c_init_tda8275[14] = { 0x00, 0x00, 0x00, 0x00, | 71 | static unsigned char i2c_init_tda8275[14] = { 0x00, 0x00, 0x00, 0x00, |
72 | 0x7C, 0x04, 0xA3, 0x3F, | 72 | 0xfC, 0x04, 0xA3, 0x3F, |
73 | 0x2A, 0x04, 0xFF, 0x00, | 73 | 0x2A, 0x04, 0xFF, 0x00, |
74 | 0x00, 0x40 }; | 74 | 0x00, 0x40 }; |
75 | static unsigned char i2c_set_VS[2] = { 0x30, 0x6F }; | 75 | static unsigned char i2c_set_VS[2] = { 0x30, 0x6F }; |
@@ -136,18 +136,23 @@ static int tda8290_tune(struct i2c_client *c) | |||
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
139 | static void set_frequency(struct tuner *t, u16 ifc) | 139 | static void set_frequency(struct tuner *t, u16 ifc, unsigned int freq) |
140 | { | 140 | { |
141 | u32 N = (((t->freq<<3)+ifc)&0x3fffc); | 141 | u32 N; |
142 | 142 | ||
143 | N = N >> get_freq_entry(div_table, t->freq); | 143 | if (t->mode == V4L2_TUNER_RADIO) |
144 | freq = freq / 1000; | ||
145 | |||
146 | N = (((freq<<3)+ifc)&0x3fffc); | ||
147 | |||
148 | N = N >> get_freq_entry(div_table, freq); | ||
144 | t->i2c_set_freq[0] = 0; | 149 | t->i2c_set_freq[0] = 0; |
145 | t->i2c_set_freq[1] = (unsigned char)(N>>8); | 150 | t->i2c_set_freq[1] = (unsigned char)(N>>8); |
146 | t->i2c_set_freq[2] = (unsigned char) N; | 151 | t->i2c_set_freq[2] = (unsigned char) N; |
147 | t->i2c_set_freq[3] = 0x40; | 152 | t->i2c_set_freq[3] = 0x40; |
148 | t->i2c_set_freq[4] = 0x52; | 153 | t->i2c_set_freq[4] = 0x52; |
149 | t->i2c_set_freq[5] = get_freq_entry(band_table, t->freq); | 154 | t->i2c_set_freq[5] = get_freq_entry(band_table, freq); |
150 | t->i2c_set_freq[6] = get_freq_entry(agc_table, t->freq); | 155 | t->i2c_set_freq[6] = get_freq_entry(agc_table, freq); |
151 | t->i2c_set_freq[7] = 0x8f; | 156 | t->i2c_set_freq[7] = 0x8f; |
152 | } | 157 | } |
153 | 158 | ||
@@ -179,14 +184,14 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
179 | struct tuner *t = i2c_get_clientdata(c); | 184 | struct tuner *t = i2c_get_clientdata(c); |
180 | 185 | ||
181 | set_audio(t); | 186 | set_audio(t); |
182 | set_frequency(t, 864); | 187 | set_frequency(t, 864, freq); |
183 | tda8290_tune(c); | 188 | tda8290_tune(c); |
184 | } | 189 | } |
185 | 190 | ||
186 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) | 191 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) |
187 | { | 192 | { |
188 | struct tuner *t = i2c_get_clientdata(c); | 193 | struct tuner *t = i2c_get_clientdata(c); |
189 | set_frequency(t, 704); | 194 | set_frequency(t, 704, freq); |
190 | tda8290_tune(c); | 195 | tda8290_tune(c); |
191 | } | 196 | } |
192 | 197 | ||
diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c index b5177c6f54f6..c29bdfc3244e 100644 --- a/drivers/media/video/tda9840.c +++ b/drivers/media/video/tda9840.c | |||
@@ -43,7 +43,6 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); | |||
43 | 43 | ||
44 | /* addresses to scan, found only at 0x42 (7-Bit) */ | 44 | /* addresses to scan, found only at 0x42 (7-Bit) */ |
45 | static unsigned short normal_i2c[] = { I2C_TDA9840, I2C_CLIENT_END }; | 45 | static unsigned short normal_i2c[] = { I2C_TDA9840, I2C_CLIENT_END }; |
46 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | ||
47 | 46 | ||
48 | /* magic definition of all other variables and things */ | 47 | /* magic definition of all other variables and things */ |
49 | I2C_CLIENT_INSMOD; | 48 | I2C_CLIENT_INSMOD; |
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c index 4f1114c033a1..566e1a5ca135 100644 --- a/drivers/media/video/tda9875.c +++ b/drivers/media/video/tda9875.c | |||
@@ -44,7 +44,6 @@ static unsigned short normal_i2c[] = { | |||
44 | I2C_TDA9875 >> 1, | 44 | I2C_TDA9875 >> 1, |
45 | I2C_CLIENT_END | 45 | I2C_CLIENT_END |
46 | }; | 46 | }; |
47 | static unsigned short normal_i2c_range[] = {I2C_CLIENT_END}; | ||
48 | I2C_CLIENT_INSMOD; | 47 | I2C_CLIENT_INSMOD; |
49 | 48 | ||
50 | /* This is a superset of the TDA9875 */ | 49 | /* This is a superset of the TDA9875 */ |
@@ -124,19 +123,6 @@ static int tda9875_write(struct i2c_client *client, int subaddr, unsigned char v | |||
124 | return 0; | 123 | return 0; |
125 | } | 124 | } |
126 | 125 | ||
127 | #if 0 | ||
128 | static int tda9875_read(struct i2c_client *client) | ||
129 | { | ||
130 | unsigned char buffer; | ||
131 | dprintk("In tda9875_read\n"); | ||
132 | if (1 != i2c_master_recv(client,&buffer,1)) { | ||
133 | printk(KERN_WARNING "tda9875: I/O error, trying (read)\n"); | ||
134 | return -1; | ||
135 | } | ||
136 | dprintk("Read 0x%02x\n", buffer); | ||
137 | return buffer; | ||
138 | } | ||
139 | #endif | ||
140 | 126 | ||
141 | static int i2c_read_register(struct i2c_adapter *adap, int addr, int reg) | 127 | static int i2c_read_register(struct i2c_adapter *adap, int addr, int reg) |
142 | { | 128 | { |
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index debef1910c37..108c3ad7d622 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
@@ -33,7 +33,6 @@ static unsigned short normal_i2c[] = { | |||
33 | 0x96 >>1, | 33 | 0x96 >>1, |
34 | I2C_CLIENT_END, | 34 | I2C_CLIENT_END, |
35 | }; | 35 | }; |
36 | static unsigned short normal_i2c_range[] = {I2C_CLIENT_END,I2C_CLIENT_END}; | ||
37 | I2C_CLIENT_INSMOD; | 36 | I2C_CLIENT_INSMOD; |
38 | 37 | ||
39 | /* insmod options */ | 38 | /* insmod options */ |
@@ -54,6 +53,7 @@ struct tda9887 { | |||
54 | unsigned int config; | 53 | unsigned int config; |
55 | unsigned int pinnacle_id; | 54 | unsigned int pinnacle_id; |
56 | unsigned int using_v4l2; | 55 | unsigned int using_v4l2; |
56 | unsigned int radio_mode; | ||
57 | }; | 57 | }; |
58 | 58 | ||
59 | struct tvnorm { | 59 | struct tvnorm { |
@@ -213,12 +213,22 @@ static struct tvnorm tvnorms[] = { | |||
213 | } | 213 | } |
214 | }; | 214 | }; |
215 | 215 | ||
216 | static struct tvnorm radio = { | 216 | static struct tvnorm radio_stereo = { |
217 | .name = "radio", | 217 | .name = "Radio Stereo", |
218 | .b = ( cFmRadio | | ||
219 | cQSS ), | ||
220 | .c = ( cDeemphasisOFF | | ||
221 | cAudioGain6 ), | ||
222 | .e = ( cAudioIF_5_5 | | ||
223 | cRadioIF_38_90 ), | ||
224 | }; | ||
225 | |||
226 | static struct tvnorm radio_mono = { | ||
227 | .name = "Radio Mono", | ||
218 | .b = ( cFmRadio | | 228 | .b = ( cFmRadio | |
219 | cQSS ), | 229 | cQSS ), |
220 | .c = ( cDeemphasisON | | 230 | .c = ( cDeemphasisON | |
221 | cDeemphasis50 ), | 231 | cDeemphasis50), |
222 | .e = ( cAudioIF_5_5 | | 232 | .e = ( cAudioIF_5_5 | |
223 | cRadioIF_38_90 ), | 233 | cRadioIF_38_90 ), |
224 | }; | 234 | }; |
@@ -355,7 +365,10 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) | |||
355 | int i; | 365 | int i; |
356 | 366 | ||
357 | if (t->radio) { | 367 | if (t->radio) { |
358 | norm = &radio; | 368 | if (t->radio_mode == V4L2_TUNER_MODE_MONO) |
369 | norm = &radio_mono; | ||
370 | else | ||
371 | norm = &radio_stereo; | ||
359 | } else { | 372 | } else { |
360 | for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { | 373 | for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { |
361 | if (tvnorms[i].std & t->std) { | 374 | if (tvnorms[i].std & t->std) { |
@@ -546,23 +559,16 @@ static int tda9887_configure(struct tda9887 *t) | |||
546 | 559 | ||
547 | memset(buf,0,sizeof(buf)); | 560 | memset(buf,0,sizeof(buf)); |
548 | tda9887_set_tvnorm(t,buf); | 561 | tda9887_set_tvnorm(t,buf); |
562 | |||
549 | buf[1] |= cOutputPort1Inactive; | 563 | buf[1] |= cOutputPort1Inactive; |
550 | buf[1] |= cOutputPort2Inactive; | 564 | buf[1] |= cOutputPort2Inactive; |
565 | |||
551 | if (UNSET != t->pinnacle_id) { | 566 | if (UNSET != t->pinnacle_id) { |
552 | tda9887_set_pinnacle(t,buf); | 567 | tda9887_set_pinnacle(t,buf); |
553 | } | 568 | } |
554 | tda9887_set_config(t,buf); | 569 | tda9887_set_config(t,buf); |
555 | tda9887_set_insmod(t,buf); | 570 | tda9887_set_insmod(t,buf); |
556 | 571 | ||
557 | #if 0 | ||
558 | /* This as-is breaks some cards, must be fixed in a | ||
559 | * card-specific way, probably using TDA9887_SET_CONFIG to | ||
560 | * turn on/off port2 */ | ||
561 | if (t->std & V4L2_STD_SECAM_L) { | ||
562 | /* secam fixup (FIXME: move this to tvnorms array?) */ | ||
563 | buf[1] &= ~cOutputPort2Inactive; | ||
564 | } | ||
565 | #endif | ||
566 | 572 | ||
567 | dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", | 573 | dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", |
568 | buf[1],buf[2],buf[3]); | 574 | buf[1],buf[2],buf[3]); |
@@ -593,11 +599,14 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind) | |||
593 | if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) | 599 | if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) |
594 | return -ENOMEM; | 600 | return -ENOMEM; |
595 | memset(t,0,sizeof(*t)); | 601 | memset(t,0,sizeof(*t)); |
602 | |||
596 | t->client = client_template; | 603 | t->client = client_template; |
597 | t->std = 0; | 604 | t->std = 0; |
598 | t->pinnacle_id = UNSET; | 605 | t->pinnacle_id = UNSET; |
599 | i2c_set_clientdata(&t->client, t); | 606 | t->radio_mode = V4L2_TUNER_MODE_STEREO; |
600 | i2c_attach_client(&t->client); | 607 | |
608 | i2c_set_clientdata(&t->client, t); | ||
609 | i2c_attach_client(&t->client); | ||
601 | 610 | ||
602 | return 0; | 611 | return 0; |
603 | } | 612 | } |
@@ -734,6 +743,16 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
734 | } | 743 | } |
735 | break; | 744 | break; |
736 | } | 745 | } |
746 | case VIDIOC_S_TUNER: | ||
747 | { | ||
748 | struct v4l2_tuner* tuner = arg; | ||
749 | |||
750 | if (t->radio) { | ||
751 | t->radio_mode = tuner->audmode; | ||
752 | tda9887_configure (t); | ||
753 | } | ||
754 | break; | ||
755 | } | ||
737 | default: | 756 | default: |
738 | /* nothing */ | 757 | /* nothing */ |
739 | break; | 758 | break; |
@@ -741,7 +760,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
741 | return 0; | 760 | return 0; |
742 | } | 761 | } |
743 | 762 | ||
744 | static int tda9887_suspend(struct device * dev, pm_message_t state, u32 level) | 763 | static int tda9887_suspend(struct device * dev, u32 state, u32 level) |
745 | { | 764 | { |
746 | dprintk("tda9887: suspend\n"); | 765 | dprintk("tda9887: suspend\n"); |
747 | return 0; | 766 | return 0; |
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c new file mode 100644 index 000000000000..cebcc1fa68d1 --- /dev/null +++ b/drivers/media/video/tea5767.c | |||
@@ -0,0 +1,350 @@ | |||
1 | /* | ||
2 | * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview | ||
3 | * I2C address is allways 0xC0. | ||
4 | * | ||
5 | * $Id: tea5767.c,v 1.27 2005/07/31 12:10:56 mchehab Exp $ | ||
6 | * | ||
7 | * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) | ||
8 | * This code is placed under the terms of the GNU General Public License | ||
9 | * | ||
10 | * tea5767 autodetection thanks to Torsten Seeboth and Atsushi Nakagawa | ||
11 | * from their contributions on DScaler. | ||
12 | */ | ||
13 | |||
14 | #include <linux/i2c.h> | ||
15 | #include <linux/videodev.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <media/tuner.h> | ||
18 | |||
19 | #define PREFIX "TEA5767 " | ||
20 | |||
21 | /*****************************************************************************/ | ||
22 | |||
23 | /****************************** | ||
24 | * Write mode register values * | ||
25 | ******************************/ | ||
26 | |||
27 | /* First register */ | ||
28 | #define TEA5767_MUTE 0x80 /* Mutes output */ | ||
29 | #define TEA5767_SEARCH 0x40 /* Activates station search */ | ||
30 | /* Bits 0-5 for divider MSB */ | ||
31 | |||
32 | /* Second register */ | ||
33 | /* Bits 0-7 for divider LSB */ | ||
34 | |||
35 | /* Third register */ | ||
36 | |||
37 | /* Station search from botton to up */ | ||
38 | #define TEA5767_SEARCH_UP 0x80 | ||
39 | |||
40 | /* Searches with ADC output = 10 */ | ||
41 | #define TEA5767_SRCH_HIGH_LVL 0x60 | ||
42 | |||
43 | /* Searches with ADC output = 10 */ | ||
44 | #define TEA5767_SRCH_MID_LVL 0x40 | ||
45 | |||
46 | /* Searches with ADC output = 5 */ | ||
47 | #define TEA5767_SRCH_LOW_LVL 0x20 | ||
48 | |||
49 | /* if on, div=4*(Frf+Fif)/Fref otherwise, div=4*(Frf-Fif)/Freq) */ | ||
50 | #define TEA5767_HIGH_LO_INJECT 0x10 | ||
51 | |||
52 | /* Disable stereo */ | ||
53 | #define TEA5767_MONO 0x08 | ||
54 | |||
55 | /* Disable right channel and turns to mono */ | ||
56 | #define TEA5767_MUTE_RIGHT 0x04 | ||
57 | |||
58 | /* Disable left channel and turns to mono */ | ||
59 | #define TEA5767_MUTE_LEFT 0x02 | ||
60 | |||
61 | #define TEA5767_PORT1_HIGH 0x01 | ||
62 | |||
63 | /* Forth register */ | ||
64 | #define TEA5767_PORT2_HIGH 0x80 | ||
65 | /* Chips stops working. Only I2C bus remains on */ | ||
66 | #define TEA5767_STDBY 0x40 | ||
67 | |||
68 | /* Japan freq (76-108 MHz. If disabled, 87.5-108 MHz */ | ||
69 | #define TEA5767_JAPAN_BAND 0x20 | ||
70 | |||
71 | /* Unselected means 32.768 KHz freq as reference. Otherwise Xtal at 13 MHz */ | ||
72 | #define TEA5767_XTAL_32768 0x10 | ||
73 | |||
74 | /* Cuts weak signals */ | ||
75 | #define TEA5767_SOFT_MUTE 0x08 | ||
76 | |||
77 | /* Activates high cut control */ | ||
78 | #define TEA5767_HIGH_CUT_CTRL 0x04 | ||
79 | |||
80 | /* Activates stereo noise control */ | ||
81 | #define TEA5767_ST_NOISE_CTL 0x02 | ||
82 | |||
83 | /* If activate PORT 1 indicates SEARCH or else it is used as PORT1 */ | ||
84 | #define TEA5767_SRCH_IND 0x01 | ||
85 | |||
86 | /* Fiveth register */ | ||
87 | |||
88 | /* By activating, it will use Xtal at 13 MHz as reference for divider */ | ||
89 | #define TEA5767_PLLREF_ENABLE 0x80 | ||
90 | |||
91 | /* By activating, deemphasis=50, or else, deemphasis of 50us */ | ||
92 | #define TEA5767_DEEMPH_75 0X40 | ||
93 | |||
94 | /***************************** | ||
95 | * Read mode register values * | ||
96 | *****************************/ | ||
97 | |||
98 | /* First register */ | ||
99 | #define TEA5767_READY_FLAG_MASK 0x80 | ||
100 | #define TEA5767_BAND_LIMIT_MASK 0X40 | ||
101 | /* Bits 0-5 for divider MSB after search or preset */ | ||
102 | |||
103 | /* Second register */ | ||
104 | /* Bits 0-7 for divider LSB after search or preset */ | ||
105 | |||
106 | /* Third register */ | ||
107 | #define TEA5767_STEREO_MASK 0x80 | ||
108 | #define TEA5767_IF_CNTR_MASK 0x7f | ||
109 | |||
110 | /* Four register */ | ||
111 | #define TEA5767_ADC_LEVEL_MASK 0xf0 | ||
112 | |||
113 | /* should be 0 */ | ||
114 | #define TEA5767_CHIP_ID_MASK 0x0f | ||
115 | |||
116 | /* Fiveth register */ | ||
117 | /* Reserved for future extensions */ | ||
118 | #define TEA5767_RESERVED_MASK 0xff | ||
119 | |||
120 | enum tea5767_xtal_freq { | ||
121 | TEA5767_LOW_LO_32768 = 0, | ||
122 | TEA5767_HIGH_LO_32768 = 1, | ||
123 | TEA5767_LOW_LO_13MHz = 2, | ||
124 | TEA5767_HIGH_LO_13MHz = 3, | ||
125 | }; | ||
126 | |||
127 | |||
128 | /*****************************************************************************/ | ||
129 | |||
130 | static void set_tv_freq(struct i2c_client *c, unsigned int freq) | ||
131 | { | ||
132 | struct tuner *t = i2c_get_clientdata(c); | ||
133 | |||
134 | tuner_warn("This tuner doesn't support TV freq.\n"); | ||
135 | } | ||
136 | |||
137 | static void tea5767_status_dump(unsigned char *buffer) | ||
138 | { | ||
139 | unsigned int div, frq; | ||
140 | |||
141 | if (TEA5767_READY_FLAG_MASK & buffer[0]) | ||
142 | printk(PREFIX "Ready Flag ON\n"); | ||
143 | else | ||
144 | printk(PREFIX "Ready Flag OFF\n"); | ||
145 | |||
146 | if (TEA5767_BAND_LIMIT_MASK & buffer[0]) | ||
147 | printk(PREFIX "Tuner at band limit\n"); | ||
148 | else | ||
149 | printk(PREFIX "Tuner not at band limit\n"); | ||
150 | |||
151 | div = ((buffer[0] & 0x3f) << 8) | buffer[1]; | ||
152 | |||
153 | switch (TEA5767_HIGH_LO_32768) { | ||
154 | case TEA5767_HIGH_LO_13MHz: | ||
155 | frq = (div * 50000 - 700000 - 225000) / 4; /* Freq in KHz */ | ||
156 | break; | ||
157 | case TEA5767_LOW_LO_13MHz: | ||
158 | frq = (div * 50000 + 700000 + 225000) / 4; /* Freq in KHz */ | ||
159 | break; | ||
160 | case TEA5767_LOW_LO_32768: | ||
161 | frq = (div * 32768 + 700000 + 225000) / 4; /* Freq in KHz */ | ||
162 | break; | ||
163 | case TEA5767_HIGH_LO_32768: | ||
164 | default: | ||
165 | frq = (div * 32768 - 700000 - 225000) / 4; /* Freq in KHz */ | ||
166 | break; | ||
167 | } | ||
168 | buffer[0] = (div >> 8) & 0x3f; | ||
169 | buffer[1] = div & 0xff; | ||
170 | |||
171 | printk(PREFIX "Frequency %d.%03d KHz (divider = 0x%04x)\n", | ||
172 | frq / 1000, frq % 1000, div); | ||
173 | |||
174 | if (TEA5767_STEREO_MASK & buffer[2]) | ||
175 | printk(PREFIX "Stereo\n"); | ||
176 | else | ||
177 | printk(PREFIX "Mono\n"); | ||
178 | |||
179 | printk(PREFIX "IF Counter = %d\n", buffer[2] & TEA5767_IF_CNTR_MASK); | ||
180 | |||
181 | printk(PREFIX "ADC Level = %d\n", | ||
182 | (buffer[3] & TEA5767_ADC_LEVEL_MASK) >> 4); | ||
183 | |||
184 | printk(PREFIX "Chip ID = %d\n", (buffer[3] & TEA5767_CHIP_ID_MASK)); | ||
185 | |||
186 | printk(PREFIX "Reserved = 0x%02x\n", | ||
187 | (buffer[4] & TEA5767_RESERVED_MASK)); | ||
188 | } | ||
189 | |||
190 | /* Freq should be specifyed at 62.5 Hz */ | ||
191 | static void set_radio_freq(struct i2c_client *c, unsigned int frq) | ||
192 | { | ||
193 | struct tuner *t = i2c_get_clientdata(c); | ||
194 | unsigned char buffer[5]; | ||
195 | unsigned div; | ||
196 | int rc; | ||
197 | |||
198 | tuner_dbg (PREFIX "radio freq = %d.%03d MHz\n", frq/16000,(frq/16)%1000); | ||
199 | |||
200 | /* Rounds freq to next decimal value - for 62.5 KHz step */ | ||
201 | /* frq = 20*(frq/16)+radio_frq[frq%16]; */ | ||
202 | |||
203 | buffer[2] = TEA5767_PORT1_HIGH; | ||
204 | buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL | | ||
205 | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND; | ||
206 | buffer[4] = 0; | ||
207 | |||
208 | if (t->mode == T_STANDBY) { | ||
209 | tuner_dbg("TEA5767 set to standby mode\n"); | ||
210 | buffer[3] |= TEA5767_STDBY; | ||
211 | } | ||
212 | |||
213 | if (t->audmode == V4L2_TUNER_MODE_MONO) { | ||
214 | tuner_dbg("TEA5767 set to mono\n"); | ||
215 | buffer[2] |= TEA5767_MONO; | ||
216 | } else { | ||
217 | tuner_dbg("TEA5767 set to stereo\n"); | ||
218 | } | ||
219 | |||
220 | /* Should be replaced */ | ||
221 | switch (TEA5767_HIGH_LO_32768) { | ||
222 | case TEA5767_HIGH_LO_13MHz: | ||
223 | tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n"); | ||
224 | buffer[2] |= TEA5767_HIGH_LO_INJECT; | ||
225 | buffer[4] |= TEA5767_PLLREF_ENABLE; | ||
226 | div = (frq * 4000 / 16 + 700000 + 225000 + 25000) / 50000; | ||
227 | break; | ||
228 | case TEA5767_LOW_LO_13MHz: | ||
229 | tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n"); | ||
230 | |||
231 | buffer[4] |= TEA5767_PLLREF_ENABLE; | ||
232 | div = (frq * 4000 / 16 - 700000 - 225000 + 25000) / 50000; | ||
233 | break; | ||
234 | case TEA5767_LOW_LO_32768: | ||
235 | tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n"); | ||
236 | buffer[3] |= TEA5767_XTAL_32768; | ||
237 | /* const 700=4000*175 Khz - to adjust freq to right value */ | ||
238 | div = ((frq * 4000 / 16 - 700000 - 225000) + 16384) >> 15; | ||
239 | break; | ||
240 | case TEA5767_HIGH_LO_32768: | ||
241 | default: | ||
242 | tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 32,768 MHz\n"); | ||
243 | |||
244 | buffer[2] |= TEA5767_HIGH_LO_INJECT; | ||
245 | buffer[3] |= TEA5767_XTAL_32768; | ||
246 | div = ((frq * (4000 / 16) + 700000 + 225000) + 16384) >> 15; | ||
247 | break; | ||
248 | } | ||
249 | buffer[0] = (div >> 8) & 0x3f; | ||
250 | buffer[1] = div & 0xff; | ||
251 | |||
252 | if (5 != (rc = i2c_master_send(c, buffer, 5))) | ||
253 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); | ||
254 | |||
255 | if (tuner_debug) { | ||
256 | if (5 != (rc = i2c_master_recv(c, buffer, 5))) | ||
257 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); | ||
258 | else | ||
259 | tea5767_status_dump(buffer); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | static int tea5767_signal(struct i2c_client *c) | ||
264 | { | ||
265 | unsigned char buffer[5]; | ||
266 | int rc; | ||
267 | struct tuner *t = i2c_get_clientdata(c); | ||
268 | |||
269 | memset(buffer, 0, sizeof(buffer)); | ||
270 | if (5 != (rc = i2c_master_recv(c, buffer, 5))) | ||
271 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); | ||
272 | |||
273 | return ((buffer[3] & TEA5767_ADC_LEVEL_MASK) << (13 - 4)); | ||
274 | } | ||
275 | |||
276 | static int tea5767_stereo(struct i2c_client *c) | ||
277 | { | ||
278 | unsigned char buffer[5]; | ||
279 | int rc; | ||
280 | struct tuner *t = i2c_get_clientdata(c); | ||
281 | |||
282 | memset(buffer, 0, sizeof(buffer)); | ||
283 | if (5 != (rc = i2c_master_recv(c, buffer, 5))) | ||
284 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); | ||
285 | |||
286 | rc = buffer[2] & TEA5767_STEREO_MASK; | ||
287 | |||
288 | tuner_dbg("TEA5767 radio ST GET = %02x\n", rc); | ||
289 | |||
290 | return ((buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO : 0); | ||
291 | } | ||
292 | |||
293 | int tea5767_autodetection(struct i2c_client *c) | ||
294 | { | ||
295 | unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | ||
296 | int rc; | ||
297 | struct tuner *t = i2c_get_clientdata(c); | ||
298 | |||
299 | if (7 != (rc = i2c_master_recv(c, buffer, 7))) { | ||
300 | tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc); | ||
301 | return EINVAL; | ||
302 | } | ||
303 | |||
304 | /* If all bytes are the same then it's a TV tuner and not a tea5767 */ | ||
305 | if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && | ||
306 | buffer[0] == buffer[3] && buffer[0] == buffer[4]) { | ||
307 | tuner_warn("All bytes are equal. It is not a TEA5767\n"); | ||
308 | return EINVAL; | ||
309 | } | ||
310 | |||
311 | /* Status bytes: | ||
312 | * Byte 4: bit 3:1 : CI (Chip Identification) == 0 | ||
313 | * bit 0 : internally set to 0 | ||
314 | * Byte 5: bit 7:0 : == 0 | ||
315 | */ | ||
316 | if (!((buffer[3] & 0x0f) == 0x00) && (buffer[4] == 0x00)) { | ||
317 | tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); | ||
318 | return EINVAL; | ||
319 | } | ||
320 | /* It seems that tea5767 returns 0xff after the 5th byte */ | ||
321 | if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) { | ||
322 | tuner_warn("Returned more than 5 bytes. It is not a TEA5767\n"); | ||
323 | return EINVAL; | ||
324 | } | ||
325 | |||
326 | /* It seems that tea5767 returns 0xff after the 5th byte */ | ||
327 | if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) { | ||
328 | tuner_warn("Returned more than 5 bytes. It is not a TEA5767\n"); | ||
329 | return EINVAL; | ||
330 | } | ||
331 | |||
332 | tuner_warn("TEA5767 detected.\n"); | ||
333 | return 0; | ||
334 | } | ||
335 | |||
336 | int tea5767_tuner_init(struct i2c_client *c) | ||
337 | { | ||
338 | struct tuner *t = i2c_get_clientdata(c); | ||
339 | |||
340 | tuner_info("type set to %d (%s)\n", t->type, | ||
341 | "Philips TEA5767HN FM Radio"); | ||
342 | strlcpy(c->name, "tea5767", sizeof(c->name)); | ||
343 | |||
344 | t->tv_freq = set_tv_freq; | ||
345 | t->radio_freq = set_radio_freq; | ||
346 | t->has_signal = tea5767_signal; | ||
347 | t->is_stereo = tea5767_stereo; | ||
348 | |||
349 | return (0); | ||
350 | } | ||
diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c index 3ec39550bf46..b44db8a7b94d 100644 --- a/drivers/media/video/tea6415c.c +++ b/drivers/media/video/tea6415c.c | |||
@@ -43,7 +43,6 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); | |||
43 | 43 | ||
44 | /* addresses to scan, found only at 0x03 and/or 0x43 (7-bit) */ | 44 | /* addresses to scan, found only at 0x03 and/or 0x43 (7-bit) */ |
45 | static unsigned short normal_i2c[] = { I2C_TEA6415C_1, I2C_TEA6415C_2, I2C_CLIENT_END }; | 45 | static unsigned short normal_i2c[] = { I2C_TEA6415C_1, I2C_TEA6415C_2, I2C_CLIENT_END }; |
46 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | ||
47 | 46 | ||
48 | /* magic definition of all other variables and things */ | 47 | /* magic definition of all other variables and things */ |
49 | I2C_CLIENT_INSMOD; | 48 | I2C_CLIENT_INSMOD; |
diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index bd10710fd909..48d4db7d507b 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c | |||
@@ -40,7 +40,6 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); | |||
40 | 40 | ||
41 | /* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */ | 41 | /* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */ |
42 | static unsigned short normal_i2c[] = { I2C_TEA6420_1, I2C_TEA6420_2, I2C_CLIENT_END }; | 42 | static unsigned short normal_i2c[] = { I2C_TEA6420_1, I2C_TEA6420_2, I2C_CLIENT_END }; |
43 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | ||
44 | 43 | ||
45 | /* magic definition of all other variables and things */ | 44 | /* magic definition of all other variables and things */ |
46 | I2C_CLIENT_INSMOD; | 45 | I2C_CLIENT_INSMOD; |
diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c index 6b20aa902a8f..7d825e510ffd 100644 --- a/drivers/media/video/tuner-3036.c +++ b/drivers/media/video/tuner-3036.c | |||
@@ -34,19 +34,14 @@ static int this_adap; | |||
34 | static struct i2c_client client_template; | 34 | static struct i2c_client client_template; |
35 | 35 | ||
36 | /* Addresses to scan */ | 36 | /* Addresses to scan */ |
37 | static unsigned short normal_i2c[] = {I2C_CLIENT_END}; | 37 | static unsigned short normal_i2c[] = { 0x60, 0x61, I2C_CLIENT_END }; |
38 | static unsigned short normal_i2c_range[] = {0x60, 0x61, I2C_CLIENT_END}; | 38 | static unsigned short ignore = I2C_CLIENT_END; |
39 | static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
40 | static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
41 | static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
42 | static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
43 | static unsigned short force[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
44 | 39 | ||
45 | static struct i2c_client_address_data addr_data = { | 40 | static struct i2c_client_address_data addr_data = { |
46 | normal_i2c, normal_i2c_range, | 41 | .normal_i2c = normal_i2c, |
47 | probe, probe_range, | 42 | .probe = &ignore, |
48 | ignore, ignore_range, | 43 | .ignore = &ignore, |
49 | force | 44 | .force = &ignore, |
50 | }; | 45 | }; |
51 | 46 | ||
52 | /* ---------------------------------------------------------------------- */ | 47 | /* ---------------------------------------------------------------------- */ |
@@ -157,7 +152,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
157 | 152 | ||
158 | switch (cmd) | 153 | switch (cmd) |
159 | { | 154 | { |
160 | case TUNER_SET_TVFREQ: | 155 | case VIDIOCSFREQ: |
161 | set_tv_freq(client, *iarg); | 156 | set_tv_freq(client, *iarg); |
162 | break; | 157 | break; |
163 | 158 | ||
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 6212388edb75..f0a579827a24 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tuner-core.c,v 1.5 2005/02/15 15:59:35 kraxel Exp $ | 2 | * $Id: tuner-core.c,v 1.63 2005/07/28 18:19:55 mchehab Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * core core, i.e. kernel interfaces, registering and so on | 5 | * core core, i.e. kernel interfaces, registering and so on |
@@ -23,67 +23,68 @@ | |||
23 | #include <media/tuner.h> | 23 | #include <media/tuner.h> |
24 | #include <media/audiochip.h> | 24 | #include <media/audiochip.h> |
25 | 25 | ||
26 | #include "msp3400.h" | ||
27 | |||
26 | #define UNSET (-1U) | 28 | #define UNSET (-1U) |
27 | 29 | ||
28 | /* standard i2c insmod options */ | 30 | /* standard i2c insmod options */ |
29 | static unsigned short normal_i2c[] = { | 31 | static unsigned short normal_i2c[] = { |
30 | 0x4b, /* tda8290 */ | 32 | 0x4b, /* tda8290 */ |
31 | I2C_CLIENT_END | 33 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, |
32 | }; | 34 | 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, |
33 | static unsigned short normal_i2c_range[] = { | ||
34 | 0x60, 0x6f, | ||
35 | I2C_CLIENT_END | 35 | I2C_CLIENT_END |
36 | }; | 36 | }; |
37 | |||
37 | I2C_CLIENT_INSMOD; | 38 | I2C_CLIENT_INSMOD; |
38 | 39 | ||
39 | /* insmod options used at init time => read/only */ | 40 | /* insmod options used at init time => read/only */ |
40 | static unsigned int addr = 0; | 41 | static unsigned int addr = 0; |
41 | module_param(addr, int, 0444); | 42 | module_param(addr, int, 0444); |
42 | 43 | ||
44 | static unsigned int no_autodetect = 0; | ||
45 | module_param(no_autodetect, int, 0444); | ||
46 | |||
47 | static unsigned int show_i2c = 0; | ||
48 | module_param(show_i2c, int, 0444); | ||
49 | |||
43 | /* insmod options used at runtime => read/write */ | 50 | /* insmod options used at runtime => read/write */ |
44 | unsigned int tuner_debug = 0; | 51 | unsigned int tuner_debug = 0; |
45 | module_param(tuner_debug, int, 0644); | 52 | module_param(tuner_debug, int, 0644); |
46 | 53 | ||
47 | static unsigned int tv_range[2] = { 44, 958 }; | 54 | static unsigned int tv_range[2] = { 44, 958 }; |
48 | static unsigned int radio_range[2] = { 65, 108 }; | 55 | static unsigned int radio_range[2] = { 65, 108 }; |
49 | 56 | ||
50 | module_param_array(tv_range, int, NULL, 0644); | 57 | module_param_array(tv_range, int, NULL, 0644); |
51 | module_param_array(radio_range, int, NULL, 0644); | 58 | module_param_array(radio_range, int, NULL, 0644); |
52 | 59 | ||
53 | MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners"); | 60 | MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners"); |
54 | MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer"); | 61 | MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer"); |
55 | MODULE_LICENSE("GPL"); | 62 | MODULE_LICENSE("GPL"); |
56 | 63 | ||
57 | static int this_adap; | ||
58 | |||
59 | static struct i2c_driver driver; | 64 | static struct i2c_driver driver; |
60 | static struct i2c_client client_template; | 65 | static struct i2c_client client_template; |
61 | 66 | ||
62 | /* ---------------------------------------------------------------------- */ | 67 | /* ---------------------------------------------------------------------- */ |
63 | 68 | ||
64 | // Set tuner frequency, freq in Units of 62.5kHz = 1/16MHz | 69 | /* Set tuner frequency, freq in Units of 62.5kHz = 1/16MHz */ |
65 | static void set_tv_freq(struct i2c_client *c, unsigned int freq) | 70 | static void set_tv_freq(struct i2c_client *c, unsigned int freq) |
66 | { | 71 | { |
67 | struct tuner *t = i2c_get_clientdata(c); | 72 | struct tuner *t = i2c_get_clientdata(c); |
68 | 73 | ||
69 | if (t->type == UNSET) { | 74 | if (t->type == UNSET) { |
70 | tuner_info("tuner type not set\n"); | 75 | tuner_warn ("tuner type not set\n"); |
71 | return; | 76 | return; |
72 | } | 77 | } |
73 | if (NULL == t->tv_freq) { | 78 | if (NULL == t->tv_freq) { |
74 | tuner_info("Huh? tv_set is NULL?\n"); | 79 | tuner_warn ("Tuner has no way to set tv freq\n"); |
75 | return; | 80 | return; |
76 | } | 81 | } |
77 | if (freq < tv_range[0]*16 || freq > tv_range[1]*16) { | 82 | if (freq < tv_range[0] * 16 || freq > tv_range[1] * 16) { |
78 | /* FIXME: better do that chip-specific, but | 83 | tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n", |
79 | right now we don't have that in the config | 84 | freq / 16, freq % 16 * 100 / 16, tv_range[0], |
80 | struct and this way is still better than no | 85 | tv_range[1]); |
81 | check at all */ | ||
82 | tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n", | ||
83 | freq/16,freq%16*100/16,tv_range[0],tv_range[1]); | ||
84 | return; | ||
85 | } | 86 | } |
86 | t->tv_freq(c,freq); | 87 | t->tv_freq(c, freq); |
87 | } | 88 | } |
88 | 89 | ||
89 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) | 90 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) |
@@ -91,20 +92,21 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
91 | struct tuner *t = i2c_get_clientdata(c); | 92 | struct tuner *t = i2c_get_clientdata(c); |
92 | 93 | ||
93 | if (t->type == UNSET) { | 94 | if (t->type == UNSET) { |
94 | tuner_info("tuner type not set\n"); | 95 | tuner_warn ("tuner type not set\n"); |
95 | return; | 96 | return; |
96 | } | 97 | } |
97 | if (NULL == t->radio_freq) { | 98 | if (NULL == t->radio_freq) { |
98 | tuner_info("no radio tuning for this one, sorry.\n"); | 99 | tuner_warn ("tuner has no way to set radio frequency\n"); |
99 | return; | 100 | return; |
100 | } | 101 | } |
101 | if (freq < radio_range[0]*16 || freq > radio_range[1]*16) { | 102 | if (freq <= radio_range[0] * 16000 || freq >= radio_range[1] * 16000) { |
102 | tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n", | 103 | tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n", |
103 | freq/16,freq%16*100/16, | 104 | freq / 16000, freq % 16000 * 100 / 16000, |
104 | radio_range[0],radio_range[1]); | 105 | radio_range[0], radio_range[1]); |
105 | return; | ||
106 | } | 106 | } |
107 | t->radio_freq(c,freq); | 107 | |
108 | t->radio_freq(c, freq); | ||
109 | return; | ||
108 | } | 110 | } |
109 | 111 | ||
110 | static void set_freq(struct i2c_client *c, unsigned long freq) | 112 | static void set_freq(struct i2c_client *c, unsigned long freq) |
@@ -114,40 +116,45 @@ static void set_freq(struct i2c_client *c, unsigned long freq) | |||
114 | switch (t->mode) { | 116 | switch (t->mode) { |
115 | case V4L2_TUNER_RADIO: | 117 | case V4L2_TUNER_RADIO: |
116 | tuner_dbg("radio freq set to %lu.%02lu\n", | 118 | tuner_dbg("radio freq set to %lu.%02lu\n", |
117 | freq/16,freq%16*100/16); | 119 | freq / 16000, freq % 16000 * 100 / 16000); |
118 | set_radio_freq(c,freq); | 120 | set_radio_freq(c, freq); |
119 | break; | 121 | break; |
120 | case V4L2_TUNER_ANALOG_TV: | 122 | case V4L2_TUNER_ANALOG_TV: |
121 | case V4L2_TUNER_DIGITAL_TV: | 123 | case V4L2_TUNER_DIGITAL_TV: |
122 | tuner_dbg("tv freq set to %lu.%02lu\n", | 124 | tuner_dbg("tv freq set to %lu.%02lu\n", |
123 | freq/16,freq%16*100/16); | 125 | freq / 16, freq % 16 * 100 / 16); |
124 | set_tv_freq(c, freq); | 126 | set_tv_freq(c, freq); |
125 | break; | 127 | break; |
126 | } | 128 | } |
127 | t->freq = freq; | 129 | t->freq = freq; |
128 | } | 130 | } |
129 | 131 | ||
130 | static void set_type(struct i2c_client *c, unsigned int type) | 132 | static void set_type(struct i2c_client *c, unsigned int type, |
133 | unsigned int new_mode_mask) | ||
131 | { | 134 | { |
132 | struct tuner *t = i2c_get_clientdata(c); | 135 | struct tuner *t = i2c_get_clientdata(c); |
136 | unsigned char buffer[4]; | ||
133 | 137 | ||
134 | /* sanity check */ | 138 | if (type == UNSET || type == TUNER_ABSENT) { |
135 | if (type == UNSET || type == TUNER_ABSENT) | 139 | tuner_dbg ("tuner 0x%02x: Tuner type absent\n",c->addr); |
136 | return; | 140 | return; |
137 | if (type >= tuner_count) | 141 | } |
142 | |||
143 | if (type >= tuner_count) { | ||
144 | tuner_warn ("tuner 0x%02x: Tuner count greater than %d\n",c->addr,tuner_count); | ||
138 | return; | 145 | return; |
146 | } | ||
139 | 147 | ||
148 | /* This code detects calls by card attach_inform */ | ||
140 | if (NULL == t->i2c.dev.driver) { | 149 | if (NULL == t->i2c.dev.driver) { |
141 | /* not registered yet */ | 150 | tuner_dbg ("tuner 0x%02x: called during i2c_client register by adapter's attach_inform\n", c->addr); |
142 | t->type = type; | 151 | |
152 | t->type=type; | ||
143 | return; | 153 | return; |
144 | } | 154 | } |
145 | if (t->initialized) | ||
146 | /* run only once */ | ||
147 | return; | ||
148 | 155 | ||
149 | t->initialized = 1; | ||
150 | t->type = type; | 156 | t->type = type; |
157 | |||
151 | switch (t->type) { | 158 | switch (t->type) { |
152 | case TUNER_MT2032: | 159 | case TUNER_MT2032: |
153 | microtune_init(c); | 160 | microtune_init(c); |
@@ -155,81 +162,219 @@ static void set_type(struct i2c_client *c, unsigned int type) | |||
155 | case TUNER_PHILIPS_TDA8290: | 162 | case TUNER_PHILIPS_TDA8290: |
156 | tda8290_init(c); | 163 | tda8290_init(c); |
157 | break; | 164 | break; |
165 | case TUNER_TEA5767: | ||
166 | if (tea5767_tuner_init(c) == EINVAL) { | ||
167 | t->type = TUNER_ABSENT; | ||
168 | t->mode_mask = T_UNINITIALIZED; | ||
169 | return; | ||
170 | } | ||
171 | t->mode_mask = T_RADIO; | ||
172 | break; | ||
173 | case TUNER_PHILIPS_FMD1216ME_MK3: | ||
174 | buffer[0] = 0x0b; | ||
175 | buffer[1] = 0xdc; | ||
176 | buffer[2] = 0x9c; | ||
177 | buffer[3] = 0x60; | ||
178 | i2c_master_send(c, buffer, 4); | ||
179 | mdelay(1); | ||
180 | buffer[2] = 0x86; | ||
181 | buffer[3] = 0x54; | ||
182 | i2c_master_send(c, buffer, 4); | ||
183 | default_tuner_init(c); | ||
184 | break; | ||
158 | default: | 185 | default: |
159 | default_tuner_init(c); | 186 | default_tuner_init(c); |
160 | break; | 187 | break; |
161 | } | 188 | } |
189 | |||
190 | if (t->mode_mask == T_UNINITIALIZED) | ||
191 | t->mode_mask = new_mode_mask; | ||
192 | |||
193 | set_freq(c, t->freq); | ||
194 | tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", | ||
195 | c->adapter->name, c->driver->name, c->addr << 1, type, | ||
196 | t->mode_mask); | ||
197 | } | ||
198 | |||
199 | /* | ||
200 | * This function apply tuner config to tuner specified | ||
201 | * by tun_setup structure. I addr is unset, then admin status | ||
202 | * and tun addr status is more precise then current status, | ||
203 | * it's applied. Otherwise status and type are applied only to | ||
204 | * tuner with exactly the same addr. | ||
205 | */ | ||
206 | |||
207 | static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup) | ||
208 | { | ||
209 | struct tuner *t = i2c_get_clientdata(c); | ||
210 | |||
211 | if (tun_setup->addr == ADDR_UNSET) { | ||
212 | if (t->mode_mask & tun_setup->mode_mask) | ||
213 | set_type(c, tun_setup->type, tun_setup->mode_mask); | ||
214 | } else if (tun_setup->addr == c->addr) { | ||
215 | set_type(c, tun_setup->type, tun_setup->mode_mask); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | static inline int check_mode(struct tuner *t, char *cmd) | ||
220 | { | ||
221 | if (1 << t->mode & t->mode_mask) { | ||
222 | switch (t->mode) { | ||
223 | case V4L2_TUNER_RADIO: | ||
224 | tuner_dbg("Cmd %s accepted for radio\n", cmd); | ||
225 | break; | ||
226 | case V4L2_TUNER_ANALOG_TV: | ||
227 | tuner_dbg("Cmd %s accepted for analog TV\n", cmd); | ||
228 | break; | ||
229 | case V4L2_TUNER_DIGITAL_TV: | ||
230 | tuner_dbg("Cmd %s accepted for digital TV\n", cmd); | ||
231 | break; | ||
232 | } | ||
233 | return 0; | ||
234 | } | ||
235 | return EINVAL; | ||
162 | } | 236 | } |
163 | 237 | ||
164 | static char pal[] = "-"; | 238 | static char pal[] = "-"; |
165 | module_param_string(pal, pal, sizeof(pal), 0644); | 239 | module_param_string(pal, pal, sizeof(pal), 0644); |
240 | static char secam[] = "-"; | ||
241 | module_param_string(secam, secam, sizeof(secam), 0644); | ||
166 | 242 | ||
243 | /* get more precise norm info from insmod option */ | ||
167 | static int tuner_fixup_std(struct tuner *t) | 244 | static int tuner_fixup_std(struct tuner *t) |
168 | { | 245 | { |
169 | if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) { | 246 | if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) { |
170 | /* get more precise norm info from insmod option */ | ||
171 | switch (pal[0]) { | 247 | switch (pal[0]) { |
172 | case 'b': | 248 | case 'b': |
173 | case 'B': | 249 | case 'B': |
174 | case 'g': | 250 | case 'g': |
175 | case 'G': | 251 | case 'G': |
176 | tuner_dbg("insmod fixup: PAL => PAL-BG\n"); | 252 | tuner_dbg ("insmod fixup: PAL => PAL-BG\n"); |
177 | t->std = V4L2_STD_PAL_BG; | 253 | t->std = V4L2_STD_PAL_BG; |
178 | break; | 254 | break; |
179 | case 'i': | 255 | case 'i': |
180 | case 'I': | 256 | case 'I': |
181 | tuner_dbg("insmod fixup: PAL => PAL-I\n"); | 257 | tuner_dbg ("insmod fixup: PAL => PAL-I\n"); |
182 | t->std = V4L2_STD_PAL_I; | 258 | t->std = V4L2_STD_PAL_I; |
183 | break; | 259 | break; |
184 | case 'd': | 260 | case 'd': |
185 | case 'D': | 261 | case 'D': |
186 | case 'k': | 262 | case 'k': |
187 | case 'K': | 263 | case 'K': |
188 | tuner_dbg("insmod fixup: PAL => PAL-DK\n"); | 264 | tuner_dbg ("insmod fixup: PAL => PAL-DK\n"); |
189 | t->std = V4L2_STD_PAL_DK; | 265 | t->std = V4L2_STD_PAL_DK; |
190 | break; | 266 | break; |
267 | case 'M': | ||
268 | case 'm': | ||
269 | tuner_dbg ("insmod fixup: PAL => PAL-M\n"); | ||
270 | t->std = V4L2_STD_PAL_M; | ||
271 | break; | ||
272 | case 'N': | ||
273 | case 'n': | ||
274 | tuner_dbg ("insmod fixup: PAL => PAL-N\n"); | ||
275 | t->std = V4L2_STD_PAL_N; | ||
276 | break; | ||
277 | } | ||
278 | } | ||
279 | if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) { | ||
280 | switch (secam[0]) { | ||
281 | case 'd': | ||
282 | case 'D': | ||
283 | case 'k': | ||
284 | case 'K': | ||
285 | tuner_dbg ("insmod fixup: SECAM => SECAM-DK\n"); | ||
286 | t->std = V4L2_STD_SECAM_DK; | ||
287 | break; | ||
288 | case 'l': | ||
289 | case 'L': | ||
290 | tuner_dbg ("insmod fixup: SECAM => SECAM-L\n"); | ||
291 | t->std = V4L2_STD_SECAM_L; | ||
292 | break; | ||
191 | } | 293 | } |
192 | } | 294 | } |
295 | |||
193 | return 0; | 296 | return 0; |
194 | } | 297 | } |
195 | 298 | ||
196 | /* ---------------------------------------------------------------------- */ | 299 | /* ---------------------------------------------------------------------- */ |
197 | 300 | ||
301 | /* static var Used only in tuner_attach and tuner_probe */ | ||
302 | static unsigned default_mode_mask; | ||
303 | |||
304 | /* During client attach, set_type is called by adapter's attach_inform callback. | ||
305 | set_type must then be completed by tuner_attach. | ||
306 | */ | ||
198 | static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | 307 | static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) |
199 | { | 308 | { |
200 | struct tuner *t; | 309 | struct tuner *t; |
201 | 310 | ||
202 | if (this_adap > 0) | 311 | client_template.adapter = adap; |
203 | return -1; | 312 | client_template.addr = addr; |
204 | this_adap++; | ||
205 | 313 | ||
206 | client_template.adapter = adap; | 314 | t = kmalloc(sizeof(struct tuner), GFP_KERNEL); |
207 | client_template.addr = addr; | 315 | if (NULL == t) |
208 | 316 | return -ENOMEM; | |
209 | t = kmalloc(sizeof(struct tuner),GFP_KERNEL); | 317 | memset(t, 0, sizeof(struct tuner)); |
210 | if (NULL == t) | 318 | memcpy(&t->i2c, &client_template, sizeof(struct i2c_client)); |
211 | return -ENOMEM; | ||
212 | memset(t,0,sizeof(struct tuner)); | ||
213 | memcpy(&t->i2c,&client_template,sizeof(struct i2c_client)); | ||
214 | i2c_set_clientdata(&t->i2c, t); | 319 | i2c_set_clientdata(&t->i2c, t); |
215 | t->type = UNSET; | 320 | t->type = UNSET; |
216 | t->radio_if2 = 10700*1000; // 10.7MHz - FM radio | 321 | t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */ |
322 | t->audmode = V4L2_TUNER_MODE_STEREO; | ||
323 | t->mode_mask = T_UNINITIALIZED; | ||
324 | |||
325 | |||
326 | tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); | ||
327 | |||
328 | if (show_i2c) { | ||
329 | unsigned char buffer[16]; | ||
330 | int i,rc; | ||
331 | |||
332 | memset(buffer, 0, sizeof(buffer)); | ||
333 | rc = i2c_master_recv(&t->i2c, buffer, sizeof(buffer)); | ||
334 | printk("tuner-%04x I2C RECV = ",addr); | ||
335 | for (i=0;i<rc;i++) | ||
336 | printk("%02x ",buffer[i]); | ||
337 | printk("\n"); | ||
338 | } | ||
339 | /* TEA5767 autodetection code - only for addr = 0xc0 */ | ||
340 | if (!no_autodetect) { | ||
341 | if (addr == 0x60) { | ||
342 | if (tea5767_autodetection(&t->i2c) != EINVAL) { | ||
343 | t->type = TUNER_TEA5767; | ||
344 | t->mode_mask = T_RADIO; | ||
345 | t->mode = T_STANDBY; | ||
346 | t->freq = 87.5 * 16; /* Sets freq to FM range */ | ||
347 | default_mode_mask &= ~T_RADIO; | ||
348 | |||
349 | i2c_attach_client (&t->i2c); | ||
350 | set_type(&t->i2c,t->type, t->mode_mask); | ||
351 | return 0; | ||
352 | } | ||
353 | } | ||
354 | } | ||
355 | |||
356 | /* Initializes only the first adapter found */ | ||
357 | if (default_mode_mask != T_UNINITIALIZED) { | ||
358 | tuner_dbg ("Setting mode_mask to 0x%02x\n", default_mode_mask); | ||
359 | t->mode_mask = default_mode_mask; | ||
360 | t->freq = 400 * 16; /* Sets freq to VHF High */ | ||
361 | default_mode_mask = T_UNINITIALIZED; | ||
362 | } | ||
217 | 363 | ||
218 | i2c_attach_client(&t->i2c); | 364 | /* Should be just before return */ |
219 | tuner_info("chip found @ 0x%x (%s)\n", | 365 | i2c_attach_client (&t->i2c); |
220 | addr << 1, adap->name); | 366 | set_type (&t->i2c,t->type, t->mode_mask); |
221 | set_type(&t->i2c, t->type); | ||
222 | return 0; | 367 | return 0; |
223 | } | 368 | } |
224 | 369 | ||
225 | static int tuner_probe(struct i2c_adapter *adap) | 370 | static int tuner_probe(struct i2c_adapter *adap) |
226 | { | 371 | { |
227 | if (0 != addr) { | 372 | if (0 != addr) { |
228 | normal_i2c[0] = addr; | 373 | normal_i2c[0] = addr; |
229 | normal_i2c_range[0] = addr; | 374 | normal_i2c[1] = I2C_CLIENT_END; |
230 | normal_i2c_range[1] = addr; | ||
231 | } | 375 | } |
232 | this_adap = 0; | 376 | |
377 | default_mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; | ||
233 | 378 | ||
234 | if (adap->class & I2C_CLASS_TV_ANALOG) | 379 | if (adap->class & I2C_CLASS_TV_ANALOG) |
235 | return i2c_probe(adap, &addr_data, tuner_attach); | 380 | return i2c_probe(adap, &addr_data, tuner_attach); |
@@ -239,38 +384,78 @@ static int tuner_probe(struct i2c_adapter *adap) | |||
239 | static int tuner_detach(struct i2c_client *client) | 384 | static int tuner_detach(struct i2c_client *client) |
240 | { | 385 | { |
241 | struct tuner *t = i2c_get_clientdata(client); | 386 | struct tuner *t = i2c_get_clientdata(client); |
387 | int err; | ||
388 | |||
389 | err = i2c_detach_client(&t->i2c); | ||
390 | if (err) { | ||
391 | tuner_warn | ||
392 | ("Client deregistration failed, client not detached.\n"); | ||
393 | return err; | ||
394 | } | ||
242 | 395 | ||
243 | i2c_detach_client(&t->i2c); | ||
244 | kfree(t); | 396 | kfree(t); |
245 | return 0; | 397 | return 0; |
246 | } | 398 | } |
247 | 399 | ||
248 | #define SWITCH_V4L2 if (!t->using_v4l2 && tuner_debug) \ | 400 | /* |
249 | tuner_info("switching to v4l2\n"); \ | 401 | * Switch tuner to other mode. If tuner support both tv and radio, |
250 | t->using_v4l2 = 1; | 402 | * set another frequency to some value (This is needed for some pal |
251 | #define CHECK_V4L2 if (t->using_v4l2) { if (tuner_debug) \ | 403 | * tuners to avoid locking). Otherwise, just put second tuner in |
252 | tuner_info("ignore v4l1 call\n"); \ | 404 | * standby mode. |
253 | return 0; } | 405 | */ |
406 | |||
407 | static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd) | ||
408 | { | ||
409 | if (mode != t->mode) { | ||
410 | |||
411 | t->mode = mode; | ||
412 | if (check_mode(t, cmd) == EINVAL) { | ||
413 | t->mode = T_STANDBY; | ||
414 | if (V4L2_TUNER_RADIO == mode) { | ||
415 | set_tv_freq(client, 400 * 16); | ||
416 | } else { | ||
417 | set_radio_freq(client, 87.5 * 16000); | ||
418 | } | ||
419 | return EINVAL; | ||
420 | } | ||
421 | } | ||
422 | return 0; | ||
423 | } | ||
424 | |||
425 | #define switch_v4l2() if (!t->using_v4l2) \ | ||
426 | tuner_dbg("switching to v4l2\n"); \ | ||
427 | t->using_v4l2 = 1; | ||
254 | 428 | ||
255 | static int | 429 | static inline int check_v4l2(struct tuner *t) |
256 | tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | ||
257 | { | 430 | { |
258 | struct tuner *t = i2c_get_clientdata(client); | 431 | if (t->using_v4l2) { |
259 | unsigned int *iarg = (int*)arg; | 432 | tuner_dbg ("ignore v4l1 call\n"); |
433 | return EINVAL; | ||
434 | } | ||
435 | return 0; | ||
436 | } | ||
260 | 437 | ||
261 | switch (cmd) { | 438 | static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) |
439 | { | ||
440 | struct tuner *t = i2c_get_clientdata(client); | ||
441 | unsigned int *iarg = (int *)arg; | ||
262 | 442 | ||
443 | switch (cmd) { | ||
263 | /* --- configuration --- */ | 444 | /* --- configuration --- */ |
264 | case TUNER_SET_TYPE: | 445 | case TUNER_SET_TYPE_ADDR: |
265 | set_type(client,*iarg); | 446 | tuner_dbg ("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x\n", |
447 | ((struct tuner_setup *)arg)->type, | ||
448 | ((struct tuner_setup *)arg)->addr, | ||
449 | ((struct tuner_setup *)arg)->mode_mask); | ||
450 | |||
451 | set_addr(client, (struct tuner_setup *)arg); | ||
266 | break; | 452 | break; |
267 | case AUDC_SET_RADIO: | 453 | case AUDC_SET_RADIO: |
268 | if (V4L2_TUNER_RADIO != t->mode) { | 454 | set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO"); |
269 | set_tv_freq(client,400 * 16); | ||
270 | t->mode = V4L2_TUNER_RADIO; | ||
271 | } | ||
272 | break; | 455 | break; |
273 | case AUDC_CONFIG_PINNACLE: | 456 | case AUDC_CONFIG_PINNACLE: |
457 | if (check_mode(t, "AUDC_CONFIG_PINNACLE") == EINVAL) | ||
458 | return 0; | ||
274 | switch (*iarg) { | 459 | switch (*iarg) { |
275 | case 2: | 460 | case 2: |
276 | tuner_dbg("pinnacle pal\n"); | 461 | tuner_dbg("pinnacle pal\n"); |
@@ -281,154 +466,252 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
281 | t->radio_if2 = 41300 * 1000; | 466 | t->radio_if2 = 41300 * 1000; |
282 | break; | 467 | break; |
283 | } | 468 | } |
284 | break; | 469 | break; |
470 | case VIDIOCSAUDIO: | ||
471 | if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) | ||
472 | return 0; | ||
473 | if (check_v4l2(t) == EINVAL) | ||
474 | return 0; | ||
285 | 475 | ||
476 | /* Should be implemented, since bttv calls it */ | ||
477 | tuner_dbg("VIDIOCSAUDIO not implemented.\n"); | ||
478 | |||
479 | break; | ||
480 | case MSP_SET_MATRIX: | ||
481 | case TDA9887_SET_CONFIG: | ||
482 | break; | ||
286 | /* --- v4l ioctls --- */ | 483 | /* --- v4l ioctls --- */ |
287 | /* take care: bttv does userspace copying, we'll get a | 484 | /* take care: bttv does userspace copying, we'll get a |
288 | kernel pointer here... */ | 485 | kernel pointer here... */ |
289 | case VIDIOCSCHAN: | 486 | case VIDIOCSCHAN: |
290 | { | 487 | { |
291 | static const v4l2_std_id map[] = { | 488 | static const v4l2_std_id map[] = { |
292 | [ VIDEO_MODE_PAL ] = V4L2_STD_PAL, | 489 | [VIDEO_MODE_PAL] = V4L2_STD_PAL, |
293 | [ VIDEO_MODE_NTSC ] = V4L2_STD_NTSC_M, | 490 | [VIDEO_MODE_NTSC] = V4L2_STD_NTSC_M, |
294 | [ VIDEO_MODE_SECAM ] = V4L2_STD_SECAM, | 491 | [VIDEO_MODE_SECAM] = V4L2_STD_SECAM, |
295 | [ 4 /* bttv */ ] = V4L2_STD_PAL_M, | 492 | [4 /* bttv */ ] = V4L2_STD_PAL_M, |
296 | [ 5 /* bttv */ ] = V4L2_STD_PAL_N, | 493 | [5 /* bttv */ ] = V4L2_STD_PAL_N, |
297 | [ 6 /* bttv */ ] = V4L2_STD_NTSC_M_JP, | 494 | [6 /* bttv */ ] = V4L2_STD_NTSC_M_JP, |
298 | }; | 495 | }; |
299 | struct video_channel *vc = arg; | 496 | struct video_channel *vc = arg; |
300 | 497 | ||
301 | CHECK_V4L2; | 498 | if (check_v4l2(t) == EINVAL) |
302 | t->mode = V4L2_TUNER_ANALOG_TV; | 499 | return 0; |
303 | if (vc->norm < ARRAY_SIZE(map)) | 500 | |
304 | t->std = map[vc->norm]; | 501 | if (set_mode(client,t,V4L2_TUNER_ANALOG_TV, "VIDIOCSCHAN")==EINVAL) |
305 | tuner_fixup_std(t); | 502 | return 0; |
306 | if (t->freq) | 503 | |
307 | set_tv_freq(client,t->freq); | 504 | if (vc->norm < ARRAY_SIZE(map)) |
308 | return 0; | 505 | t->std = map[vc->norm]; |
309 | } | 506 | tuner_fixup_std(t); |
507 | if (t->freq) | ||
508 | set_tv_freq(client, t->freq); | ||
509 | return 0; | ||
510 | } | ||
310 | case VIDIOCSFREQ: | 511 | case VIDIOCSFREQ: |
311 | { | 512 | { |
312 | unsigned long *v = arg; | 513 | unsigned long *v = arg; |
313 | 514 | ||
314 | CHECK_V4L2; | 515 | if (check_mode(t, "VIDIOCSFREQ") == EINVAL) |
315 | set_freq(client,*v); | 516 | return 0; |
316 | return 0; | 517 | if (check_v4l2(t) == EINVAL) |
317 | } | 518 | return 0; |
318 | case VIDIOCGTUNER: | ||
319 | { | ||
320 | struct video_tuner *vt = arg; | ||
321 | 519 | ||
322 | CHECK_V4L2; | 520 | set_freq(client, *v); |
323 | if (V4L2_TUNER_RADIO == t->mode && t->has_signal) | 521 | return 0; |
324 | vt->signal = t->has_signal(client); | 522 | } |
325 | return 0; | 523 | case VIDIOCGTUNER: |
326 | } | 524 | { |
525 | struct video_tuner *vt = arg; | ||
526 | |||
527 | if (check_mode(t, "VIDIOCGTUNER") == EINVAL) | ||
528 | return 0; | ||
529 | if (check_v4l2(t) == EINVAL) | ||
530 | return 0; | ||
531 | |||
532 | if (V4L2_TUNER_RADIO == t->mode) { | ||
533 | if (t->has_signal) | ||
534 | vt->signal = t->has_signal(client); | ||
535 | if (t->is_stereo) { | ||
536 | if (t->is_stereo(client)) | ||
537 | vt->flags |= | ||
538 | VIDEO_TUNER_STEREO_ON; | ||
539 | else | ||
540 | vt->flags &= | ||
541 | ~VIDEO_TUNER_STEREO_ON; | ||
542 | } | ||
543 | vt->flags |= VIDEO_TUNER_LOW; /* Allow freqs at 62.5 Hz */ | ||
544 | |||
545 | vt->rangelow = radio_range[0] * 16000; | ||
546 | vt->rangehigh = radio_range[1] * 16000; | ||
547 | |||
548 | } else { | ||
549 | vt->rangelow = tv_range[0] * 16; | ||
550 | vt->rangehigh = tv_range[1] * 16; | ||
551 | } | ||
552 | |||
553 | return 0; | ||
554 | } | ||
327 | case VIDIOCGAUDIO: | 555 | case VIDIOCGAUDIO: |
328 | { | 556 | { |
329 | struct video_audio *va = arg; | 557 | struct video_audio *va = arg; |
330 | 558 | ||
331 | CHECK_V4L2; | 559 | if (check_mode(t, "VIDIOCGAUDIO") == EINVAL) |
332 | if (V4L2_TUNER_RADIO == t->mode && t->is_stereo) | 560 | return 0; |
333 | va->mode = t->is_stereo(client) | 561 | if (check_v4l2(t) == EINVAL) |
334 | ? VIDEO_SOUND_STEREO | 562 | return 0; |
335 | : VIDEO_SOUND_MONO; | 563 | |
336 | return 0; | 564 | if (V4L2_TUNER_RADIO == t->mode && t->is_stereo) |
337 | } | 565 | va->mode = t->is_stereo(client) |
566 | ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; | ||
567 | return 0; | ||
568 | } | ||
338 | 569 | ||
339 | case VIDIOC_S_STD: | 570 | case VIDIOC_S_STD: |
340 | { | 571 | { |
341 | v4l2_std_id *id = arg; | 572 | v4l2_std_id *id = arg; |
342 | 573 | ||
343 | SWITCH_V4L2; | 574 | if (set_mode (client, t, V4L2_TUNER_ANALOG_TV, "VIDIOC_S_STD") |
344 | t->mode = V4L2_TUNER_ANALOG_TV; | 575 | == EINVAL) |
345 | t->std = *id; | 576 | return 0; |
346 | tuner_fixup_std(t); | 577 | |
347 | if (t->freq) | 578 | switch_v4l2(); |
348 | set_freq(client,t->freq); | 579 | |
349 | break; | 580 | t->std = *id; |
350 | } | 581 | tuner_fixup_std(t); |
582 | if (t->freq) | ||
583 | set_freq(client, t->freq); | ||
584 | break; | ||
585 | } | ||
351 | case VIDIOC_S_FREQUENCY: | 586 | case VIDIOC_S_FREQUENCY: |
352 | { | 587 | { |
353 | struct v4l2_frequency *f = arg; | 588 | struct v4l2_frequency *f = arg; |
354 | 589 | ||
355 | SWITCH_V4L2; | 590 | t->freq = f->frequency; |
356 | if (V4L2_TUNER_RADIO == f->type && | 591 | switch_v4l2(); |
357 | V4L2_TUNER_RADIO != t->mode) | 592 | if (V4L2_TUNER_RADIO == f->type && |
358 | set_tv_freq(client,400*16); | 593 | V4L2_TUNER_RADIO != t->mode) { |
359 | t->mode = f->type; | 594 | if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY") |
360 | set_freq(client,f->frequency); | 595 | == EINVAL) |
361 | break; | 596 | return 0; |
362 | } | 597 | } |
363 | case VIDIOC_G_FREQUENCY: | 598 | set_freq(client,t->freq); |
364 | { | ||
365 | struct v4l2_frequency *f = arg; | ||
366 | 599 | ||
367 | SWITCH_V4L2; | 600 | break; |
368 | f->type = t->mode; | 601 | } |
369 | f->frequency = t->freq; | 602 | case VIDIOC_G_FREQUENCY: |
370 | break; | 603 | { |
371 | } | 604 | struct v4l2_frequency *f = arg; |
605 | |||
606 | if (check_mode(t, "VIDIOC_G_FREQUENCY") == EINVAL) | ||
607 | return 0; | ||
608 | switch_v4l2(); | ||
609 | f->type = t->mode; | ||
610 | f->frequency = t->freq; | ||
611 | break; | ||
612 | } | ||
372 | case VIDIOC_G_TUNER: | 613 | case VIDIOC_G_TUNER: |
373 | { | 614 | { |
374 | struct v4l2_tuner *tuner = arg; | 615 | struct v4l2_tuner *tuner = arg; |
375 | 616 | ||
376 | SWITCH_V4L2; | 617 | if (check_mode(t, "VIDIOC_G_TUNER") == EINVAL) |
377 | if (V4L2_TUNER_RADIO == t->mode && t->has_signal) | 618 | return 0; |
378 | tuner->signal = t->has_signal(client); | 619 | switch_v4l2(); |
379 | tuner->rangelow = tv_range[0] * 16; | 620 | |
380 | tuner->rangehigh = tv_range[1] * 16; | 621 | if (V4L2_TUNER_RADIO == t->mode) { |
381 | break; | 622 | |
382 | } | 623 | if (t->has_signal) |
624 | tuner->signal = t->has_signal(client); | ||
625 | |||
626 | if (t->is_stereo) { | ||
627 | if (t->is_stereo(client)) { | ||
628 | tuner->rxsubchans = | ||
629 | V4L2_TUNER_SUB_STEREO | | ||
630 | V4L2_TUNER_SUB_MONO; | ||
631 | } else { | ||
632 | tuner->rxsubchans = | ||
633 | V4L2_TUNER_SUB_MONO; | ||
634 | } | ||
635 | } | ||
636 | |||
637 | tuner->capability |= | ||
638 | V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; | ||
639 | |||
640 | tuner->audmode = t->audmode; | ||
641 | |||
642 | tuner->rangelow = radio_range[0] * 16000; | ||
643 | tuner->rangehigh = radio_range[1] * 16000; | ||
644 | } else { | ||
645 | tuner->rangelow = tv_range[0] * 16; | ||
646 | tuner->rangehigh = tv_range[1] * 16; | ||
647 | } | ||
648 | break; | ||
649 | } | ||
650 | case VIDIOC_S_TUNER: | ||
651 | { | ||
652 | struct v4l2_tuner *tuner = arg; | ||
653 | |||
654 | if (check_mode(t, "VIDIOC_S_TUNER") == EINVAL) | ||
655 | return 0; | ||
656 | |||
657 | switch_v4l2(); | ||
658 | |||
659 | if (V4L2_TUNER_RADIO == t->mode) { | ||
660 | t->audmode = tuner->audmode; | ||
661 | set_radio_freq(client, t->freq); | ||
662 | } | ||
663 | break; | ||
664 | } | ||
383 | default: | 665 | default: |
384 | /* nothing */ | 666 | tuner_dbg("Unimplemented IOCTL 0x%08x(dir=%d,tp=0x%02x,nr=%d,sz=%d)\n", |
667 | cmd, _IOC_DIR(cmd), _IOC_TYPE(cmd), | ||
668 | _IOC_NR(cmd), _IOC_SIZE(cmd)); | ||
385 | break; | 669 | break; |
386 | } | 670 | } |
387 | 671 | ||
388 | return 0; | 672 | return 0; |
389 | } | 673 | } |
390 | 674 | ||
391 | static int tuner_suspend(struct device * dev, pm_message_t state, u32 level) | 675 | static int tuner_suspend(struct device *dev, u32 state, u32 level) |
392 | { | 676 | { |
393 | struct i2c_client *c = container_of(dev, struct i2c_client, dev); | 677 | struct i2c_client *c = container_of (dev, struct i2c_client, dev); |
394 | struct tuner *t = i2c_get_clientdata(c); | 678 | struct tuner *t = i2c_get_clientdata (c); |
395 | 679 | ||
396 | tuner_dbg("suspend\n"); | 680 | tuner_dbg ("suspend\n"); |
397 | /* FIXME: power down ??? */ | 681 | /* FIXME: power down ??? */ |
398 | return 0; | 682 | return 0; |
399 | } | 683 | } |
400 | 684 | ||
401 | static int tuner_resume(struct device * dev, u32 level) | 685 | static int tuner_resume(struct device *dev, u32 level) |
402 | { | 686 | { |
403 | struct i2c_client *c = container_of(dev, struct i2c_client, dev); | 687 | struct i2c_client *c = container_of (dev, struct i2c_client, dev); |
404 | struct tuner *t = i2c_get_clientdata(c); | 688 | struct tuner *t = i2c_get_clientdata (c); |
405 | 689 | ||
406 | tuner_dbg("resume\n"); | 690 | tuner_dbg ("resume\n"); |
407 | if (t->freq) | 691 | if (t->freq) |
408 | set_freq(c,t->freq); | 692 | set_freq(c, t->freq); |
409 | return 0; | 693 | return 0; |
410 | } | 694 | } |
411 | 695 | ||
412 | /* ----------------------------------------------------------------------- */ | 696 | /* ----------------------------------------------------------------------- */ |
413 | 697 | ||
414 | static struct i2c_driver driver = { | 698 | static struct i2c_driver driver = { |
415 | .owner = THIS_MODULE, | 699 | .owner = THIS_MODULE, |
416 | .name = "tuner", | 700 | .name = "tuner", |
417 | .id = I2C_DRIVERID_TUNER, | 701 | .id = I2C_DRIVERID_TUNER, |
418 | .flags = I2C_DF_NOTIFY, | 702 | .flags = I2C_DF_NOTIFY, |
419 | .attach_adapter = tuner_probe, | 703 | .attach_adapter = tuner_probe, |
420 | .detach_client = tuner_detach, | 704 | .detach_client = tuner_detach, |
421 | .command = tuner_command, | 705 | .command = tuner_command, |
422 | .driver = { | 706 | .driver = { |
423 | .suspend = tuner_suspend, | 707 | .suspend = tuner_suspend, |
424 | .resume = tuner_resume, | 708 | .resume = tuner_resume, |
425 | }, | 709 | }, |
426 | }; | 710 | }; |
427 | static struct i2c_client client_template = | 711 | static struct i2c_client client_template = { |
428 | { | ||
429 | I2C_DEVNAME("(tuner unset)"), | 712 | I2C_DEVNAME("(tuner unset)"), |
430 | .flags = I2C_CLIENT_ALLOW_USE, | 713 | .flags = I2C_CLIENT_ALLOW_USE, |
431 | .driver = &driver, | 714 | .driver = &driver, |
432 | }; | 715 | }; |
433 | 716 | ||
434 | static int __init tuner_init_module(void) | 717 | static int __init tuner_init_module(void) |
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index 48c6ceff1dc2..de0c93aeb75d 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tuner-simple.c,v 1.10 2005/03/08 08:38:00 kraxel Exp $ | 2 | * $Id: tuner-simple.c,v 1.43 2005/07/28 18:41:21 mchehab Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * controls all those simple 4-control-bytes style tuners. | 5 | * controls all those simple 4-control-bytes style tuners. |
@@ -54,6 +54,27 @@ | |||
54 | #define PHILIPS_MF_SET_PAL_L 0x03 // France | 54 | #define PHILIPS_MF_SET_PAL_L 0x03 // France |
55 | #define PHILIPS_MF_SET_PAL_L2 0x02 // L' | 55 | #define PHILIPS_MF_SET_PAL_L2 0x02 // L' |
56 | 56 | ||
57 | /* Control byte */ | ||
58 | |||
59 | #define TUNER_RATIO_MASK 0x06 /* Bit cb1:cb2 */ | ||
60 | #define TUNER_RATIO_SELECT_50 0x00 | ||
61 | #define TUNER_RATIO_SELECT_32 0x02 | ||
62 | #define TUNER_RATIO_SELECT_166 0x04 | ||
63 | #define TUNER_RATIO_SELECT_62 0x06 | ||
64 | |||
65 | #define TUNER_CHARGE_PUMP 0x40 /* Bit cb6 */ | ||
66 | |||
67 | /* Status byte */ | ||
68 | |||
69 | #define TUNER_POR 0x80 | ||
70 | #define TUNER_FL 0x40 | ||
71 | #define TUNER_MODE 0x38 | ||
72 | #define TUNER_AFC 0x07 | ||
73 | #define TUNER_SIGNAL 0x07 | ||
74 | #define TUNER_STEREO 0x10 | ||
75 | |||
76 | #define TUNER_PLL_LOCKED 0x40 | ||
77 | #define TUNER_STEREO_MK3 0x04 | ||
57 | 78 | ||
58 | /* ---------------------------------------------------------------------- */ | 79 | /* ---------------------------------------------------------------------- */ |
59 | 80 | ||
@@ -207,12 +228,31 @@ static struct tunertype tuners[] = { | |||
207 | { "LG PAL (TAPE series)", LGINNOTEK, PAL, | 228 | { "LG PAL (TAPE series)", LGINNOTEK, PAL, |
208 | 16*170.00, 16*450.00, 0x01,0x02,0x08,0xce,623}, | 229 | 16*170.00, 16*450.00, 0x01,0x02,0x08,0xce,623}, |
209 | 230 | ||
210 | { "Philips PAL/SECAM multi (FQ1216AME MK4)", Philips, PAL, | 231 | { "Philips PAL/SECAM multi (FQ1216AME MK4)", Philips, PAL, |
211 | 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 }, | 232 | 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 }, |
212 | { "Philips FQ1236A MK4", Philips, NTSC, | 233 | { "Philips FQ1236A MK4", Philips, NTSC, |
213 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, | 234 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, |
235 | { "Ymec TVision TVF-8531MF/8831MF/8731MF", Philips, NTSC, | ||
236 | 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732}, | ||
237 | { "Ymec TVision TVF-5533MF", Philips, NTSC, | ||
238 | 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732}, | ||
214 | 239 | ||
240 | { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, | ||
241 | 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, | ||
242 | { "Tena TNF9533-D/IF/TNF9533-B/DF", Philips, PAL, | ||
243 | 16*160.25,16*464.25,0x01,0x02,0x04,0x8e,623}, | ||
244 | { "Philips TEA5767HN FM Radio", Philips, RADIO, | ||
245 | /* see tea5767.c for details */}, | ||
246 | { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL, | ||
247 | 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 }, | ||
248 | |||
249 | { "LG TDVS-H062F/TUA6034", LGINNOTEK, NTSC, | ||
250 | 16*160.00,16*455.00,0x01,0x02,0x04,0x8e,732}, | ||
251 | |||
252 | { "Ymec TVF66T5-B/DFF", Philips, PAL, | ||
253 | 16*160.25,16*464.25,0x01,0x02,0x08,0x8e,623}, | ||
215 | }; | 254 | }; |
255 | |||
216 | unsigned const int tuner_count = ARRAY_SIZE(tuners); | 256 | unsigned const int tuner_count = ARRAY_SIZE(tuners); |
217 | 257 | ||
218 | /* ---------------------------------------------------------------------- */ | 258 | /* ---------------------------------------------------------------------- */ |
@@ -223,43 +263,35 @@ static int tuner_getstatus(struct i2c_client *c) | |||
223 | 263 | ||
224 | if (1 != i2c_master_recv(c,&byte,1)) | 264 | if (1 != i2c_master_recv(c,&byte,1)) |
225 | return 0; | 265 | return 0; |
266 | |||
226 | return byte; | 267 | return byte; |
227 | } | 268 | } |
228 | 269 | ||
229 | #define TUNER_POR 0x80 | ||
230 | #define TUNER_FL 0x40 | ||
231 | #define TUNER_MODE 0x38 | ||
232 | #define TUNER_AFC 0x07 | ||
233 | |||
234 | #define TUNER_STEREO 0x10 /* radio mode */ | ||
235 | #define TUNER_SIGNAL 0x07 /* radio mode */ | ||
236 | |||
237 | static int tuner_signal(struct i2c_client *c) | 270 | static int tuner_signal(struct i2c_client *c) |
238 | { | 271 | { |
239 | return (tuner_getstatus(c) & TUNER_SIGNAL)<<13; | 272 | return (tuner_getstatus(c) & TUNER_SIGNAL) << 13; |
240 | } | 273 | } |
241 | 274 | ||
242 | static int tuner_stereo(struct i2c_client *c) | 275 | static int tuner_stereo(struct i2c_client *c) |
243 | { | 276 | { |
244 | return (tuner_getstatus (c) & TUNER_STEREO); | 277 | int stereo, status; |
245 | } | 278 | struct tuner *t = i2c_get_clientdata(c); |
246 | 279 | ||
247 | #if 0 /* unused */ | 280 | status = tuner_getstatus (c); |
248 | static int tuner_islocked (struct i2c_client *c) | ||
249 | { | ||
250 | return (tuner_getstatus (c) & TUNER_FL); | ||
251 | } | ||
252 | 281 | ||
253 | static int tuner_afcstatus (struct i2c_client *c) | 282 | switch (t->type) { |
254 | { | 283 | case TUNER_PHILIPS_FM1216ME_MK3: |
255 | return (tuner_getstatus (c) & TUNER_AFC) - 2; | 284 | case TUNER_PHILIPS_FM1236_MK3: |
256 | } | 285 | case TUNER_PHILIPS_FM1256_IH3: |
286 | stereo = ((status & TUNER_SIGNAL) == TUNER_STEREO_MK3); | ||
287 | break; | ||
288 | default: | ||
289 | stereo = status & TUNER_STEREO; | ||
290 | } | ||
257 | 291 | ||
258 | static int tuner_mode (struct i2c_client *c) | 292 | return stereo; |
259 | { | ||
260 | return (tuner_getstatus (c) & TUNER_MODE) >> 3; | ||
261 | } | 293 | } |
262 | #endif | 294 | |
263 | 295 | ||
264 | /* ---------------------------------------------------------------------- */ | 296 | /* ---------------------------------------------------------------------- */ |
265 | 297 | ||
@@ -342,7 +374,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
342 | 374 | ||
343 | case TUNER_MICROTUNE_4042FI5: | 375 | case TUNER_MICROTUNE_4042FI5: |
344 | /* Set the charge pump for fast tuning */ | 376 | /* Set the charge pump for fast tuning */ |
345 | tun->config |= 0x40; | 377 | tun->config |= TUNER_CHARGE_PUMP; |
346 | break; | 378 | break; |
347 | } | 379 | } |
348 | 380 | ||
@@ -391,14 +423,13 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
391 | tuner_warn("i2c i/o read error: rc == %d (should be 1)\n",rc); | 423 | tuner_warn("i2c i/o read error: rc == %d (should be 1)\n",rc); |
392 | break; | 424 | break; |
393 | } | 425 | } |
394 | /* bit 6 is PLL locked indicator */ | 426 | if (status_byte & TUNER_PLL_LOCKED) |
395 | if (status_byte & 0x40) | ||
396 | break; | 427 | break; |
397 | udelay(10); | 428 | udelay(10); |
398 | } | 429 | } |
399 | 430 | ||
400 | /* Set the charge pump for optimized phase noise figure */ | 431 | /* Set the charge pump for optimized phase noise figure */ |
401 | tun->config &= ~0x40; | 432 | tun->config &= ~TUNER_CHARGE_PUMP; |
402 | buffer[0] = (div>>8) & 0x7f; | 433 | buffer[0] = (div>>8) & 0x7f; |
403 | buffer[1] = div & 0xff; | 434 | buffer[1] = div & 0xff; |
404 | buffer[2] = tun->config; | 435 | buffer[2] = tun->config; |
@@ -419,18 +450,22 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
419 | unsigned div; | 450 | unsigned div; |
420 | int rc; | 451 | int rc; |
421 | 452 | ||
422 | tun=&tuners[t->type]; | 453 | tun = &tuners[t->type]; |
423 | div = freq + (int)(16*10.7); | 454 | div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */ |
424 | buffer[2] = tun->config; | 455 | buffer[2] = (tun->config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */ |
425 | 456 | ||
426 | switch (t->type) { | 457 | switch (t->type) { |
458 | case TUNER_TENA_9533_DI: | ||
459 | case TUNER_YMEC_TVF_5533MF: | ||
460 | tuner_dbg ("This tuner doesn't have FM. Most cards has a TEA5767 for FM\n"); | ||
461 | return; | ||
427 | case TUNER_PHILIPS_FM1216ME_MK3: | 462 | case TUNER_PHILIPS_FM1216ME_MK3: |
428 | case TUNER_PHILIPS_FM1236_MK3: | 463 | case TUNER_PHILIPS_FM1236_MK3: |
464 | case TUNER_PHILIPS_FMD1216ME_MK3: | ||
429 | buffer[3] = 0x19; | 465 | buffer[3] = 0x19; |
430 | break; | 466 | break; |
431 | case TUNER_PHILIPS_FM1256_IH3: | 467 | case TUNER_PHILIPS_FM1256_IH3: |
432 | div = (20 * freq)/16 + 333 * 2; | 468 | div = (20 * freq) / 16000 + (int)(33.3 * 20); /* IF 33.3 MHz */ |
433 | buffer[2] = 0x80; | ||
434 | buffer[3] = 0x19; | 469 | buffer[3] = 0x19; |
435 | break; | 470 | break; |
436 | case TUNER_LG_PAL_FM: | 471 | case TUNER_LG_PAL_FM: |
@@ -462,6 +497,7 @@ int default_tuner_init(struct i2c_client *c) | |||
462 | t->radio_freq = default_set_radio_freq; | 497 | t->radio_freq = default_set_radio_freq; |
463 | t->has_signal = tuner_signal; | 498 | t->has_signal = tuner_signal; |
464 | t->is_stereo = tuner_stereo; | 499 | t->is_stereo = tuner_stereo; |
500 | |||
465 | return 0; | 501 | return 0; |
466 | } | 502 | } |
467 | 503 | ||
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 80dc34f18c2c..f42a1efa8fcf 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
@@ -148,7 +148,6 @@ static unsigned short normal_i2c[] = { | |||
148 | I2C_TDA9874 >> 1, | 148 | I2C_TDA9874 >> 1, |
149 | I2C_PIC16C54 >> 1, | 149 | I2C_PIC16C54 >> 1, |
150 | I2C_CLIENT_END }; | 150 | I2C_CLIENT_END }; |
151 | static unsigned short normal_i2c_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
152 | I2C_CLIENT_INSMOD; | 151 | I2C_CLIENT_INSMOD; |
153 | 152 | ||
154 | static struct i2c_driver driver; | 153 | static struct i2c_driver driver; |
@@ -286,7 +285,7 @@ static int chip_thread(void *data) | |||
286 | schedule(); | 285 | schedule(); |
287 | } | 286 | } |
288 | remove_wait_queue(&chip->wq, &wait); | 287 | remove_wait_queue(&chip->wq, &wait); |
289 | try_to_freeze(PF_FREEZE); | 288 | try_to_freeze(); |
290 | if (chip->done || signal_pending(current)) | 289 | if (chip->done || signal_pending(current)) |
291 | break; | 290 | break; |
292 | dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c)); | 291 | dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c)); |
@@ -866,13 +865,8 @@ static int tda9874a_getmode(struct CHIPSTATE *chip) | |||
866 | * But changing the mode to VIDEO_SOUND_MONO would switch | 865 | * But changing the mode to VIDEO_SOUND_MONO would switch |
867 | * external 4052 multiplexer in audio_hook(). | 866 | * external 4052 multiplexer in audio_hook(). |
868 | */ | 867 | */ |
869 | #if 0 | ||
870 | if((nsr & 0x02) && !(dsr & 0x10)) /* NSR.S/MB=1 and DSR.AMSTAT=0 */ | ||
871 | mode |= VIDEO_SOUND_STEREO; | ||
872 | #else | ||
873 | if(nsr & 0x02) /* NSR.S/MB=1 */ | 868 | if(nsr & 0x02) /* NSR.S/MB=1 */ |
874 | mode |= VIDEO_SOUND_STEREO; | 869 | mode |= VIDEO_SOUND_STEREO; |
875 | #endif | ||
876 | if(nsr & 0x01) /* NSR.D/SB=1 */ | 870 | if(nsr & 0x01) /* NSR.D/SB=1 */ |
877 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | 871 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; |
878 | } else { | 872 | } else { |
@@ -1238,17 +1232,17 @@ static int ta8874z_checkit(struct CHIPSTATE *chip) | |||
1238 | /* audio chip descriptions - struct CHIPDESC */ | 1232 | /* audio chip descriptions - struct CHIPDESC */ |
1239 | 1233 | ||
1240 | /* insmod options to enable/disable individual audio chips */ | 1234 | /* insmod options to enable/disable individual audio chips */ |
1241 | int tda8425 = 1; | 1235 | static int tda8425 = 1; |
1242 | int tda9840 = 1; | 1236 | static int tda9840 = 1; |
1243 | int tda9850 = 1; | 1237 | static int tda9850 = 1; |
1244 | int tda9855 = 1; | 1238 | static int tda9855 = 1; |
1245 | int tda9873 = 1; | 1239 | static int tda9873 = 1; |
1246 | int tda9874a = 1; | 1240 | static int tda9874a = 1; |
1247 | int tea6300 = 0; // address clash with msp34xx | 1241 | static int tea6300 = 0; // address clash with msp34xx |
1248 | int tea6320 = 0; // address clash with msp34xx | 1242 | static int tea6320 = 0; // address clash with msp34xx |
1249 | int tea6420 = 1; | 1243 | static int tea6420 = 1; |
1250 | int pic16c54 = 1; | 1244 | static int pic16c54 = 1; |
1251 | int ta8874z = 0; // address clash with tda9840 | 1245 | static int ta8874z = 0; // address clash with tda9840 |
1252 | 1246 | ||
1253 | module_param(tda8425, int, 0444); | 1247 | module_param(tda8425, int, 0444); |
1254 | module_param(tda9840, int, 0444); | 1248 | module_param(tda9840, int, 0444); |
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index e1443a0937e3..127ec38ebd60 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
@@ -75,7 +75,7 @@ hauppauge_tuner_fmt[] = | |||
75 | { 0x00000007, "PAL(B/G)" }, | 75 | { 0x00000007, "PAL(B/G)" }, |
76 | { 0x00001000, "NTSC(M)" }, | 76 | { 0x00001000, "NTSC(M)" }, |
77 | { 0x00000010, "PAL(I)" }, | 77 | { 0x00000010, "PAL(I)" }, |
78 | { 0x00400000, "SECAM(L/L�)" }, | 78 | { 0x00400000, "SECAM(L/L´)" }, |
79 | { 0x00000e00, "PAL(D/K)" }, | 79 | { 0x00000e00, "PAL(D/K)" }, |
80 | { 0x03000000, "ATSC Digital" }, | 80 | { 0x03000000, "ATSC Digital" }, |
81 | }; | 81 | }; |
@@ -189,7 +189,7 @@ hauppauge_tuner[] = | |||
189 | { TUNER_ABSENT, "Philips FQ1236 MK3"}, | 189 | { TUNER_ABSENT, "Philips FQ1236 MK3"}, |
190 | { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, | 190 | { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, |
191 | { TUNER_ABSENT, "Samsung TCPE 4121P30A"}, | 191 | { TUNER_ABSENT, "Samsung TCPE 4121P30A"}, |
192 | { TUNER_ABSENT, "TCL MFPE05 2"}, | 192 | { TUNER_PHILIPS_FM1216ME_MK3, "TCL MFPE05 2"}, |
193 | /* 90-99 */ | 193 | /* 90-99 */ |
194 | { TUNER_ABSENT, "LG TALN H202T"}, | 194 | { TUNER_ABSENT, "LG TALN H202T"}, |
195 | { TUNER_PHILIPS_FQ1216AME_MK4, "Philips FQ1216AME MK4"}, | 195 | { TUNER_PHILIPS_FQ1216AME_MK4, "Philips FQ1216AME MK4"}, |
@@ -400,14 +400,6 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data | |||
400 | } | 400 | } |
401 | } | 401 | } |
402 | 402 | ||
403 | #if 0 | ||
404 | if (t_format < sizeof(hauppauge_tuner_fmt)/sizeof(struct HAUPPAUGE_TUNER_FMT)) { | ||
405 | tvee->tuner_formats = hauppauge_tuner_fmt[t_format].id; | ||
406 | t_fmt_name = hauppauge_tuner_fmt[t_format].name; | ||
407 | } else { | ||
408 | t_fmt_name = "<unknown>"; | ||
409 | } | ||
410 | #endif | ||
411 | 403 | ||
412 | TVEEPROM_KERN_INFO("Hauppauge: model = %d, rev = %s, serial# = %d\n", | 404 | TVEEPROM_KERN_INFO("Hauppauge: model = %d, rev = %s, serial# = %d\n", |
413 | tvee->model, | 405 | tvee->model, |
@@ -453,6 +445,7 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len) | |||
453 | } | 445 | } |
454 | EXPORT_SYMBOL(tveeprom_read); | 446 | EXPORT_SYMBOL(tveeprom_read); |
455 | 447 | ||
448 | #if 0 | ||
456 | int tveeprom_dump(unsigned char *eedata, int len) | 449 | int tveeprom_dump(unsigned char *eedata, int len) |
457 | { | 450 | { |
458 | int i; | 451 | int i; |
@@ -468,6 +461,7 @@ int tveeprom_dump(unsigned char *eedata, int len) | |||
468 | return 0; | 461 | return 0; |
469 | } | 462 | } |
470 | EXPORT_SYMBOL(tveeprom_dump); | 463 | EXPORT_SYMBOL(tveeprom_dump); |
464 | #endif /* 0 */ | ||
471 | 465 | ||
472 | /* ----------------------------------------------------------------------- */ | 466 | /* ----------------------------------------------------------------------- */ |
473 | /* needed for ivtv.sf.net at the moment. Should go away in the long */ | 467 | /* needed for ivtv.sf.net at the moment. Should go away in the long */ |
@@ -482,10 +476,10 @@ static unsigned short normal_i2c[] = { | |||
482 | 0xa0 >> 1, | 476 | 0xa0 >> 1, |
483 | I2C_CLIENT_END, | 477 | I2C_CLIENT_END, |
484 | }; | 478 | }; |
485 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | 479 | |
486 | I2C_CLIENT_INSMOD; | 480 | I2C_CLIENT_INSMOD; |
487 | 481 | ||
488 | struct i2c_driver i2c_driver_tveeprom; | 482 | static struct i2c_driver i2c_driver_tveeprom; |
489 | 483 | ||
490 | static int | 484 | static int |
491 | tveeprom_command(struct i2c_client *client, | 485 | tveeprom_command(struct i2c_client *client, |
@@ -557,7 +551,7 @@ tveeprom_detach_client (struct i2c_client *client) | |||
557 | return 0; | 551 | return 0; |
558 | } | 552 | } |
559 | 553 | ||
560 | struct i2c_driver i2c_driver_tveeprom = { | 554 | static struct i2c_driver i2c_driver_tveeprom = { |
561 | .owner = THIS_MODULE, | 555 | .owner = THIS_MODULE, |
562 | .name = "tveeprom", | 556 | .name = "tveeprom", |
563 | .id = I2C_DRIVERID_TVEEPROM, | 557 | .id = I2C_DRIVERID_TVEEPROM, |
diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c index eafd7061b310..51b99cdbf29e 100644 --- a/drivers/media/video/tvmixer.c +++ b/drivers/media/video/tvmixer.c | |||
@@ -1,3 +1,7 @@ | |||
1 | /* | ||
2 | * $Id: tvmixer.c,v 1.8 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | ||
4 | |||
1 | #include <linux/module.h> | 5 | #include <linux/module.h> |
2 | #include <linux/moduleparam.h> | 6 | #include <linux/moduleparam.h> |
3 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index b0d4bcb027d0..70ecbdb80277 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c | |||
@@ -1,4 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: v4l1-compat.c,v 1.9 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | * | ||
2 | * Video for Linux Two | 4 | * Video for Linux Two |
3 | * Backward Compatibility Layer | 5 | * Backward Compatibility Layer |
4 | * | 6 | * |
@@ -15,14 +17,11 @@ | |||
15 | * | 17 | * |
16 | */ | 18 | */ |
17 | 19 | ||
18 | #ifndef __KERNEL__ | ||
19 | #define __KERNEL__ | ||
20 | #endif | ||
21 | |||
22 | #include <linux/config.h> | 20 | #include <linux/config.h> |
23 | 21 | ||
24 | #include <linux/init.h> | 22 | #include <linux/init.h> |
25 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/moduleparam.h> | ||
26 | #include <linux/types.h> | 25 | #include <linux/types.h> |
27 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
28 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
@@ -787,12 +786,15 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
787 | !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) | 786 | !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) |
788 | aud->step = qctrl2.step; | 787 | aud->step = qctrl2.step; |
789 | aud->mode = 0; | 788 | aud->mode = 0; |
789 | |||
790 | memset(&tun2,0,sizeof(tun2)); | ||
790 | err = drv(inode, file, VIDIOC_G_TUNER, &tun2); | 791 | err = drv(inode, file, VIDIOC_G_TUNER, &tun2); |
791 | if (err < 0) { | 792 | if (err < 0) { |
792 | dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %d\n",err); | 793 | dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %d\n",err); |
793 | err = 0; | 794 | err = 0; |
794 | break; | 795 | break; |
795 | } | 796 | } |
797 | |||
796 | if (tun2.rxsubchans & V4L2_TUNER_SUB_LANG2) | 798 | if (tun2.rxsubchans & V4L2_TUNER_SUB_LANG2) |
797 | aud->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | 799 | aud->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; |
798 | else if (tun2.rxsubchans & V4L2_TUNER_SUB_STEREO) | 800 | else if (tun2.rxsubchans & V4L2_TUNER_SUB_STEREO) |
diff --git a/drivers/media/video/video-buf-dvb.c b/drivers/media/video/video-buf-dvb.c index 5f870075b55e..15f5bb486963 100644 --- a/drivers/media/video/video-buf-dvb.c +++ b/drivers/media/video/video-buf-dvb.c | |||
@@ -62,8 +62,7 @@ static int videobuf_dvb_thread(void *data) | |||
62 | break; | 62 | break; |
63 | if (kthread_should_stop()) | 63 | if (kthread_should_stop()) |
64 | break; | 64 | break; |
65 | if (current->flags & PF_FREEZE) | 65 | try_to_freeze(); |
66 | refrigerator(PF_FREEZE); | ||
67 | 66 | ||
68 | /* feed buffer data to demux */ | 67 | /* feed buffer data to demux */ |
69 | if (buf->state == STATE_DONE) | 68 | if (buf->state == STATE_DONE) |
diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index 0fd6c9a70917..5dbd9f6bf353 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c | |||
@@ -569,22 +569,14 @@ static unsigned short normal_i2c[] = | |||
569 | { I2C_VPX3220 >> 1, (I2C_VPX3220 >> 1) + 4, | 569 | { I2C_VPX3220 >> 1, (I2C_VPX3220 >> 1) + 4, |
570 | I2C_CLIENT_END | 570 | I2C_CLIENT_END |
571 | }; | 571 | }; |
572 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | ||
573 | 572 | ||
574 | static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | 573 | static unsigned short ignore = I2C_CLIENT_END; |
575 | static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
576 | static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
577 | static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; | ||
578 | static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END }; | ||
579 | 574 | ||
580 | static struct i2c_client_address_data addr_data = { | 575 | static struct i2c_client_address_data addr_data = { |
581 | .normal_i2c = normal_i2c, | 576 | .normal_i2c = normal_i2c, |
582 | .normal_i2c_range = normal_i2c_range, | 577 | .probe = &ignore, |
583 | .probe = probe, | 578 | .ignore = &ignore, |
584 | .probe_range = probe_range, | 579 | .force = &ignore, |
585 | .ignore = ignore, | ||
586 | .ignore_range = ignore_range, | ||
587 | .force = force | ||
588 | }; | 580 | }; |
589 | 581 | ||
590 | static struct i2c_driver vpx3220_i2c_driver; | 582 | static struct i2c_driver vpx3220_i2c_driver; |