diff options
author | Aapo Tahkola <aet@rasterburn.org> | 2007-05-08 11:03:55 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-07-18 13:23:38 -0400 |
commit | 47f8df0fc0a5bd2e7e46ca438715ffa290051f72 (patch) | |
tree | 9c562ae684d36abe4839913763b88e483c4dcd4d | |
parent | 7cb47a14609eed6db2041fd1fe888027b2a3c3e0 (diff) |
V4L/DVB (5692): M920x: attempt to fix hw pid filters on second endpoint
Signed-off-by: Aapo Tahkola <aet@rasterburn.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/dvb/dvb-usb/m920x.c | 57 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/m920x.h | 5 |
2 files changed, 41 insertions, 21 deletions
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c index c546ddeda5d4..37e7f5881a82 100644 --- a/drivers/media/dvb/dvb-usb/m920x.c +++ b/drivers/media/dvb/dvb-usb/m920x.c | |||
@@ -22,6 +22,8 @@ static int dvb_usb_m920x_debug; | |||
22 | module_param_named(debug,dvb_usb_m920x_debug, int, 0644); | 22 | module_param_named(debug,dvb_usb_m920x_debug, int, 0644); |
23 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); | 23 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); |
24 | 24 | ||
25 | static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid); | ||
26 | |||
25 | static inline int m920x_read(struct usb_device *udev, u8 request, u16 value, | 27 | static inline int m920x_read(struct usb_device *udev, u8 request, u16 value, |
26 | u16 index, void *data, int size) | 28 | u16 index, void *data, int size) |
27 | { | 29 | { |
@@ -57,7 +59,8 @@ static inline int m920x_write(struct usb_device *udev, u8 request, | |||
57 | 59 | ||
58 | static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq) | 60 | static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq) |
59 | { | 61 | { |
60 | int ret = 0; | 62 | int ret = 0, i, epi; |
63 | int adap_enabled[M9206_MAX_ADAPTERS] = { 0 }; | ||
61 | 64 | ||
62 | /* Remote controller init. */ | 65 | /* Remote controller init. */ |
63 | if (d->props.rc_query) { | 66 | if (d->props.rc_query) { |
@@ -76,6 +79,28 @@ static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq) | |||
76 | deb("Initialising remote control success\n"); | 79 | deb("Initialising remote control success\n"); |
77 | } | 80 | } |
78 | 81 | ||
82 | for (i = 0; i < d->props.num_adapters; i++) { | ||
83 | epi = d->adapter[i].props.stream.endpoint - 0x81; | ||
84 | |||
85 | if (epi < 0 || epi >= M9206_MAX_ADAPTERS) { | ||
86 | printk(KERN_INFO "m920x: Unexpected adapter endpoint!\n"); | ||
87 | return -EINVAL; | ||
88 | } | ||
89 | |||
90 | adap_enabled[epi] = 1; | ||
91 | } | ||
92 | |||
93 | for (i = 0; i < M9206_MAX_ADAPTERS; i++) { | ||
94 | if (adap_enabled[i]) | ||
95 | continue; | ||
96 | |||
97 | if ((ret = m920x_set_filter(d, 0x81 + i, 0, 0x0)) != 0) | ||
98 | return ret; | ||
99 | |||
100 | if ((ret = m920x_set_filter(d, 0x81 + i, 0, 0x02f5)) != 0) | ||
101 | return ret; | ||
102 | } | ||
103 | |||
79 | return ret; | 104 | return ret; |
80 | } | 105 | } |
81 | 106 | ||
@@ -211,8 +236,7 @@ static struct i2c_algorithm m920x_i2c_algo = { | |||
211 | }; | 236 | }; |
212 | 237 | ||
213 | /* pid filter */ | 238 | /* pid filter */ |
214 | static int m920x_set_filter(struct dvb_usb_adapter *adap, | 239 | static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid) |
215 | int type, int idx, int pid) | ||
216 | { | 240 | { |
217 | int ret = 0; | 241 | int ret = 0; |
218 | 242 | ||
@@ -221,10 +245,10 @@ static int m920x_set_filter(struct dvb_usb_adapter *adap, | |||
221 | 245 | ||
222 | pid |= 0x8000; | 246 | pid |= 0x8000; |
223 | 247 | ||
224 | if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0) | 248 | if ((ret = m920x_write(d->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0) |
225 | return ret; | 249 | return ret; |
226 | 250 | ||
227 | if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0) | 251 | if ((ret = m920x_write(d->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0) |
228 | return ret; | 252 | return ret; |
229 | 253 | ||
230 | return ret; | 254 | return ret; |
@@ -233,40 +257,35 @@ static int m920x_set_filter(struct dvb_usb_adapter *adap, | |||
233 | static int m920x_update_filters(struct dvb_usb_adapter *adap) | 257 | static int m920x_update_filters(struct dvb_usb_adapter *adap) |
234 | { | 258 | { |
235 | struct m920x_state *m = adap->dev->priv; | 259 | struct m920x_state *m = adap->dev->priv; |
236 | int enabled = m->filtering_enabled; | 260 | int enabled = m->filtering_enabled[adap->id]; |
237 | int i, ret = 0, filter = 0; | 261 | int i, ret = 0, filter = 0; |
262 | int ep = adap->props.stream.endpoint; | ||
238 | 263 | ||
239 | for (i = 0; i < M9206_MAX_FILTERS; i++) | 264 | for (i = 0; i < M9206_MAX_FILTERS; i++) |
240 | if (m->filters[i] == 8192) | 265 | if (m->filters[adap->id][i] == 8192) |
241 | enabled = 0; | 266 | enabled = 0; |
242 | 267 | ||
243 | /* Disable all filters */ | 268 | /* Disable all filters */ |
244 | if ((ret = m920x_set_filter(adap, 0x81, 1, enabled)) != 0) | 269 | if ((ret = m920x_set_filter(adap->dev, ep, 1, enabled)) != 0) |
245 | return ret; | 270 | return ret; |
246 | 271 | ||
247 | for (i = 0; i < M9206_MAX_FILTERS; i++) | 272 | for (i = 0; i < M9206_MAX_FILTERS; i++) |
248 | if ((ret = m920x_set_filter(adap, 0x81, i + 2, 0)) != 0) | 273 | if ((ret = m920x_set_filter(adap->dev, ep, i + 2, 0)) != 0) |
249 | return ret; | 274 | return ret; |
250 | 275 | ||
251 | if ((ret = m920x_set_filter(adap, 0x82, 0, 0x0)) != 0) | ||
252 | return ret; | ||
253 | |||
254 | /* Set */ | 276 | /* Set */ |
255 | if (enabled) { | 277 | if (enabled) { |
256 | for (i = 0; i < M9206_MAX_FILTERS; i++) { | 278 | for (i = 0; i < M9206_MAX_FILTERS; i++) { |
257 | if (m->filters[i] == 0) | 279 | if (m->filters[adap->id][i] == 0) |
258 | continue; | 280 | continue; |
259 | 281 | ||
260 | if ((ret = m920x_set_filter(adap, 0x81, filter + 2, m->filters[i])) != 0) | 282 | if ((ret = m920x_set_filter(adap->dev, ep, filter + 2, m->filters[adap->id][i])) != 0) |
261 | return ret; | 283 | return ret; |
262 | 284 | ||
263 | filter++; | 285 | filter++; |
264 | } | 286 | } |
265 | } | 287 | } |
266 | 288 | ||
267 | if ((ret = m920x_set_filter(adap, 0x82, 0, 0x02f5)) != 0) | ||
268 | return ret; | ||
269 | |||
270 | return ret; | 289 | return ret; |
271 | } | 290 | } |
272 | 291 | ||
@@ -274,7 +293,7 @@ static int m920x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
274 | { | 293 | { |
275 | struct m920x_state *m = adap->dev->priv; | 294 | struct m920x_state *m = adap->dev->priv; |
276 | 295 | ||
277 | m->filtering_enabled = onoff ? 1 : 0; | 296 | m->filtering_enabled[adap->id] = onoff ? 1 : 0; |
278 | 297 | ||
279 | return m920x_update_filters(adap); | 298 | return m920x_update_filters(adap); |
280 | } | 299 | } |
@@ -283,7 +302,7 @@ static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, in | |||
283 | { | 302 | { |
284 | struct m920x_state *m = adap->dev->priv; | 303 | struct m920x_state *m = adap->dev->priv; |
285 | 304 | ||
286 | m->filters[index] = onoff ? pid : 0; | 305 | m->filters[adap->id][index] = onoff ? pid : 0; |
287 | 306 | ||
288 | return m920x_update_filters(adap); | 307 | return m920x_update_filters(adap); |
289 | } | 308 | } |
diff --git a/drivers/media/dvb/dvb-usb/m920x.h b/drivers/media/dvb/dvb-usb/m920x.h index 2c8942d04222..37532890accd 100644 --- a/drivers/media/dvb/dvb-usb/m920x.h +++ b/drivers/media/dvb/dvb-usb/m920x.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #define M9206_FW 0x30 | 18 | #define M9206_FW 0x30 |
19 | 19 | ||
20 | #define M9206_MAX_FILTERS 8 | 20 | #define M9206_MAX_FILTERS 8 |
21 | #define M9206_MAX_ADAPTERS 2 | ||
21 | 22 | ||
22 | /* | 23 | /* |
23 | sequences found in logs: | 24 | sequences found in logs: |
@@ -60,8 +61,8 @@ response to a write, is unknown. | |||
60 | */ | 61 | */ |
61 | 62 | ||
62 | struct m920x_state { | 63 | struct m920x_state { |
63 | u16 filters[M9206_MAX_FILTERS]; | 64 | u16 filters[M9206_MAX_ADAPTERS][M9206_MAX_FILTERS]; |
64 | int filtering_enabled; | 65 | int filtering_enabled[M9206_MAX_ADAPTERS]; |
65 | int rep_count; | 66 | int rep_count; |
66 | }; | 67 | }; |
67 | 68 | ||