diff options
author | Antti Palosaari <crope@iki.fi> | 2013-01-11 18:45:11 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-21 17:50:53 -0400 |
commit | bada342e0845f459f0abd80cf7c86ec871980c1a (patch) | |
tree | 7da3844767a22f9835cc426d2af2fd8a40c96fcc /drivers/media/usb/dvb-usb-v2/af9035.c | |
parent | a7816b7667d227e97d91e4dee4657862affea7a1 (diff) |
[media] af9035: USB1.1 support (== PID filters)
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb/dvb-usb-v2/af9035.c')
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/af9035.c | 85 |
1 files changed, 82 insertions, 3 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index ad66ac4b3913..3f00f0bee0ce 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c | |||
@@ -894,7 +894,12 @@ static int af9035_frontend_callback(void *adapter_priv, int component, | |||
894 | static int af9035_get_adapter_count(struct dvb_usb_device *d) | 894 | static int af9035_get_adapter_count(struct dvb_usb_device *d) |
895 | { | 895 | { |
896 | struct state *state = d_to_priv(d); | 896 | struct state *state = d_to_priv(d); |
897 | return state->dual_mode + 1; | 897 | |
898 | /* disable 2nd adapter as we don't have PID filters implemented */ | ||
899 | if (d->udev->speed == USB_SPEED_FULL) | ||
900 | return 1; | ||
901 | else | ||
902 | return state->dual_mode + 1; | ||
898 | } | 903 | } |
899 | 904 | ||
900 | static int af9035_frontend_attach(struct dvb_usb_adapter *adap) | 905 | static int af9035_frontend_attach(struct dvb_usb_adapter *adap) |
@@ -1201,8 +1206,8 @@ static int af9035_init(struct dvb_usb_device *d) | |||
1201 | { | 1206 | { |
1202 | struct state *state = d_to_priv(d); | 1207 | struct state *state = d_to_priv(d); |
1203 | int ret, i; | 1208 | int ret, i; |
1204 | u16 frame_size = 87 * 188 / 4; | 1209 | u16 frame_size = (d->udev->speed == USB_SPEED_FULL ? 5 : 87) * 188 / 4; |
1205 | u8 packet_size = 512 / 4; | 1210 | u8 packet_size = (d->udev->speed == USB_SPEED_FULL ? 64 : 512) / 4; |
1206 | struct reg_val_mask tab[] = { | 1211 | struct reg_val_mask tab[] = { |
1207 | { 0x80f99d, 0x01, 0x01 }, | 1212 | { 0x80f99d, 0x01, 0x01 }, |
1208 | { 0x80f9a4, 0x01, 0x01 }, | 1213 | { 0x80f9a4, 0x01, 0x01 }, |
@@ -1328,6 +1333,72 @@ err: | |||
1328 | #define af9035_get_rc_config NULL | 1333 | #define af9035_get_rc_config NULL |
1329 | #endif | 1334 | #endif |
1330 | 1335 | ||
1336 | static int af9035_get_stream_config(struct dvb_frontend *fe, u8 *ts_type, | ||
1337 | struct usb_data_stream_properties *stream) | ||
1338 | { | ||
1339 | struct dvb_usb_device *d = fe_to_d(fe); | ||
1340 | dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, fe_to_adap(fe)->id); | ||
1341 | |||
1342 | if (d->udev->speed == USB_SPEED_FULL) | ||
1343 | stream->u.bulk.buffersize = 5 * 188; | ||
1344 | |||
1345 | return 0; | ||
1346 | } | ||
1347 | |||
1348 | /* | ||
1349 | * FIXME: PID filter is property of demodulator and should be moved to the | ||
1350 | * correct driver. Also we support only adapter #0 PID filter and will | ||
1351 | * disable adapter #1 if USB1.1 is used. | ||
1352 | */ | ||
1353 | static int af9035_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) | ||
1354 | { | ||
1355 | struct dvb_usb_device *d = adap_to_d(adap); | ||
1356 | int ret; | ||
1357 | |||
1358 | dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff); | ||
1359 | |||
1360 | ret = af9035_wr_reg_mask(d, 0x80f993, onoff, 0x01); | ||
1361 | if (ret < 0) | ||
1362 | goto err; | ||
1363 | |||
1364 | return 0; | ||
1365 | |||
1366 | err: | ||
1367 | dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret); | ||
1368 | |||
1369 | return ret; | ||
1370 | } | ||
1371 | |||
1372 | static int af9035_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, | ||
1373 | int onoff) | ||
1374 | { | ||
1375 | struct dvb_usb_device *d = adap_to_d(adap); | ||
1376 | int ret; | ||
1377 | u8 wbuf[2] = {(pid >> 0) & 0xff, (pid >> 8) & 0xff}; | ||
1378 | |||
1379 | dev_dbg(&d->udev->dev, "%s: index=%d pid=%04x onoff=%d\n", | ||
1380 | __func__, index, pid, onoff); | ||
1381 | |||
1382 | ret = af9035_wr_regs(d, 0x80f996, wbuf, 2); | ||
1383 | if (ret < 0) | ||
1384 | goto err; | ||
1385 | |||
1386 | ret = af9035_wr_reg(d, 0x80f994, onoff); | ||
1387 | if (ret < 0) | ||
1388 | goto err; | ||
1389 | |||
1390 | ret = af9035_wr_reg(d, 0x80f995, index); | ||
1391 | if (ret < 0) | ||
1392 | goto err; | ||
1393 | |||
1394 | return 0; | ||
1395 | |||
1396 | err: | ||
1397 | dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret); | ||
1398 | |||
1399 | return ret; | ||
1400 | } | ||
1401 | |||
1331 | static int af9035_probe(struct usb_interface *intf, | 1402 | static int af9035_probe(struct usb_interface *intf, |
1332 | const struct usb_device_id *id) | 1403 | const struct usb_device_id *id) |
1333 | { | 1404 | { |
@@ -1385,10 +1456,18 @@ static const struct dvb_usb_device_properties af9035_props = { | |||
1385 | .tuner_attach = af9035_tuner_attach, | 1456 | .tuner_attach = af9035_tuner_attach, |
1386 | .init = af9035_init, | 1457 | .init = af9035_init, |
1387 | .get_rc_config = af9035_get_rc_config, | 1458 | .get_rc_config = af9035_get_rc_config, |
1459 | .get_stream_config = af9035_get_stream_config, | ||
1388 | 1460 | ||
1389 | .get_adapter_count = af9035_get_adapter_count, | 1461 | .get_adapter_count = af9035_get_adapter_count, |
1390 | .adapter = { | 1462 | .adapter = { |
1391 | { | 1463 | { |
1464 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | | ||
1465 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | ||
1466 | |||
1467 | .pid_filter_count = 32, | ||
1468 | .pid_filter_ctrl = af9035_pid_filter_ctrl, | ||
1469 | .pid_filter = af9035_pid_filter, | ||
1470 | |||
1392 | .stream = DVB_USB_STREAM_BULK(0x84, 6, 87 * 188), | 1471 | .stream = DVB_USB_STREAM_BULK(0x84, 6, 87 * 188), |
1393 | }, { | 1472 | }, { |
1394 | .stream = DVB_USB_STREAM_BULK(0x85, 6, 87 * 188), | 1473 | .stream = DVB_USB_STREAM_BULK(0x85, 6, 87 * 188), |