diff options
author | Olli Salonen <olli.salonen@iki.fi> | 2014-09-21 06:53:19 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-09-23 20:49:42 -0400 |
commit | 5b5560842a7ee002d208a20866f88fafd63198eb (patch) | |
tree | 54f15d28553a19d2d2fe678149c08f05281f849f /drivers/media | |
parent | 5dcf5bf6d9dd81cdf66aab94f62bee354a7d1238 (diff) |
[media] af9035: Add support for IT930x USB bridge
Add support for IT930x USB bridge and IT9303 reference design.
It is a DVB-T/T2/C tuner with the following components:
- IT9303 USB bridge
- Si2168-B40 demodulator
- Si2147-A30 tuner
The IT9303 requires firmware that can be downloaded here:
http://trsqr.net/olli/linux/firmwares/it930x/
The Si2168-B40 requires firmware, but the one that is used by PCTV 292e can be used.
http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/Si2168-B40/
The Si2147-A30 tuner does not require firmware loading.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb-core/dvb-usb-ids.h | 1 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/af9035.c | 324 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/af9035.h | 6 |
3 files changed, 314 insertions, 17 deletions
diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h index d484a5158496..e07a84e7bc56 100644 --- a/drivers/media/dvb-core/dvb-usb-ids.h +++ b/drivers/media/dvb-core/dvb-usb-ids.h | |||
@@ -144,6 +144,7 @@ | |||
144 | #define USB_PID_ITETECH_IT9135 0x9135 | 144 | #define USB_PID_ITETECH_IT9135 0x9135 |
145 | #define USB_PID_ITETECH_IT9135_9005 0x9005 | 145 | #define USB_PID_ITETECH_IT9135_9005 0x9005 |
146 | #define USB_PID_ITETECH_IT9135_9006 0x9006 | 146 | #define USB_PID_ITETECH_IT9135_9006 0x9006 |
147 | #define USB_PID_ITETECH_IT9303 0x9306 | ||
147 | #define USB_PID_KWORLD_399U 0xe399 | 148 | #define USB_PID_KWORLD_399U 0xe399 |
148 | #define USB_PID_KWORLD_399U_2 0xe400 | 149 | #define USB_PID_KWORLD_399U_2 0xe400 |
149 | #define USB_PID_KWORLD_395U 0xe396 | 150 | #define USB_PID_KWORLD_395U 0xe396 |
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index c50d27d4a57f..00758c83eec7 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c | |||
@@ -290,7 +290,7 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, | |||
290 | return -EAGAIN; | 290 | return -EAGAIN; |
291 | 291 | ||
292 | /* | 292 | /* |
293 | * I2C sub header is 5 bytes long. Meaning of those bytes are: | 293 | * AF9035 I2C sub header is 5 bytes long. Meaning of those bytes are: |
294 | * 0: data len | 294 | * 0: data len |
295 | * 1: I2C addr << 1 | 295 | * 1: I2C addr << 1 |
296 | * 2: reg addr len | 296 | * 2: reg addr len |
@@ -317,6 +317,12 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, | |||
317 | * bus. I2C subsystem does not allow register multiple devices to same | 317 | * bus. I2C subsystem does not allow register multiple devices to same |
318 | * bus, having same slave address. Due to that we reuse demod address, | 318 | * bus, having same slave address. Due to that we reuse demod address, |
319 | * shifted by one bit, on that case. | 319 | * shifted by one bit, on that case. |
320 | * | ||
321 | * For IT930x we use a different command and the sub header is | ||
322 | * different as well: | ||
323 | * 0: data len | ||
324 | * 1: I2C bus (0x03 seems to be only value used) | ||
325 | * 2: I2C addr << 1 | ||
320 | */ | 326 | */ |
321 | #define AF9035_IS_I2C_XFER_WRITE_READ(_msg, _num) \ | 327 | #define AF9035_IS_I2C_XFER_WRITE_READ(_msg, _num) \ |
322 | (_num == 2 && !(_msg[0].flags & I2C_M_RD) && (_msg[1].flags & I2C_M_RD)) | 328 | (_num == 2 && !(_msg[0].flags & I2C_M_RD) && (_msg[1].flags & I2C_M_RD)) |
@@ -348,13 +354,24 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, | |||
348 | struct usb_req req = { CMD_I2C_RD, 0, 5 + msg[0].len, | 354 | struct usb_req req = { CMD_I2C_RD, 0, 5 + msg[0].len, |
349 | buf, msg[1].len, msg[1].buf }; | 355 | buf, msg[1].len, msg[1].buf }; |
350 | 356 | ||
357 | if (state->chip_type == 0x9306) { | ||
358 | req.cmd = CMD_GENERIC_I2C_RD; | ||
359 | req.wlen = 3 + msg[0].len; | ||
360 | } | ||
351 | req.mbox |= ((msg[0].addr & 0x80) >> 3); | 361 | req.mbox |= ((msg[0].addr & 0x80) >> 3); |
362 | |||
352 | buf[0] = msg[1].len; | 363 | buf[0] = msg[1].len; |
353 | buf[1] = msg[0].addr << 1; | 364 | if (state->chip_type == 0x9306) { |
354 | buf[2] = 0x00; /* reg addr len */ | 365 | buf[1] = 0x03; /* I2C bus */ |
355 | buf[3] = 0x00; /* reg addr MSB */ | 366 | buf[2] = msg[0].addr << 1; |
356 | buf[4] = 0x00; /* reg addr LSB */ | 367 | memcpy(&buf[3], msg[0].buf, msg[0].len); |
357 | memcpy(&buf[5], msg[0].buf, msg[0].len); | 368 | } else { |
369 | buf[1] = msg[0].addr << 1; | ||
370 | buf[2] = 0x00; /* reg addr len */ | ||
371 | buf[3] = 0x00; /* reg addr MSB */ | ||
372 | buf[4] = 0x00; /* reg addr LSB */ | ||
373 | memcpy(&buf[5], msg[0].buf, msg[0].len); | ||
374 | } | ||
358 | ret = af9035_ctrl_msg(d, &req); | 375 | ret = af9035_ctrl_msg(d, &req); |
359 | } | 376 | } |
360 | } else if (AF9035_IS_I2C_XFER_WRITE(msg, num)) { | 377 | } else if (AF9035_IS_I2C_XFER_WRITE(msg, num)) { |
@@ -380,13 +397,24 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, | |||
380 | struct usb_req req = { CMD_I2C_WR, 0, 5 + msg[0].len, | 397 | struct usb_req req = { CMD_I2C_WR, 0, 5 + msg[0].len, |
381 | buf, 0, NULL }; | 398 | buf, 0, NULL }; |
382 | 399 | ||
400 | if (state->chip_type == 0x9306) { | ||
401 | req.cmd = CMD_GENERIC_I2C_WR; | ||
402 | req.wlen = 3 + msg[0].len; | ||
403 | } | ||
404 | |||
383 | req.mbox |= ((msg[0].addr & 0x80) >> 3); | 405 | req.mbox |= ((msg[0].addr & 0x80) >> 3); |
384 | buf[0] = msg[0].len; | 406 | buf[0] = msg[0].len; |
385 | buf[1] = msg[0].addr << 1; | 407 | if (state->chip_type == 0x9306) { |
386 | buf[2] = 0x00; /* reg addr len */ | 408 | buf[1] = 0x03; /* I2C bus */ |
387 | buf[3] = 0x00; /* reg addr MSB */ | 409 | buf[2] = msg[0].addr << 1; |
388 | buf[4] = 0x00; /* reg addr LSB */ | 410 | memcpy(&buf[3], msg[0].buf, msg[0].len); |
389 | memcpy(&buf[5], msg[0].buf, msg[0].len); | 411 | } else { |
412 | buf[1] = msg[0].addr << 1; | ||
413 | buf[2] = 0x00; /* reg addr len */ | ||
414 | buf[3] = 0x00; /* reg addr MSB */ | ||
415 | buf[4] = 0x00; /* reg addr LSB */ | ||
416 | memcpy(&buf[5], msg[0].buf, msg[0].len); | ||
417 | } | ||
390 | ret = af9035_ctrl_msg(d, &req); | 418 | ret = af9035_ctrl_msg(d, &req); |
391 | } | 419 | } |
392 | } else if (AF9035_IS_I2C_XFER_READ(msg, num)) { | 420 | } else if (AF9035_IS_I2C_XFER_READ(msg, num)) { |
@@ -397,13 +425,23 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, | |||
397 | /* I2C read */ | 425 | /* I2C read */ |
398 | u8 buf[5]; | 426 | u8 buf[5]; |
399 | struct usb_req req = { CMD_I2C_RD, 0, sizeof(buf), | 427 | struct usb_req req = { CMD_I2C_RD, 0, sizeof(buf), |
400 | buf, msg[0].len, msg[0].buf }; | 428 | buf, msg[0].len, msg[0].buf }; |
429 | |||
430 | if (state->chip_type == 0x9306) { | ||
431 | req.cmd = CMD_GENERIC_I2C_RD; | ||
432 | req.wlen = 3; | ||
433 | } | ||
401 | req.mbox |= ((msg[0].addr & 0x80) >> 3); | 434 | req.mbox |= ((msg[0].addr & 0x80) >> 3); |
402 | buf[0] = msg[0].len; | 435 | buf[0] = msg[0].len; |
403 | buf[1] = msg[0].addr << 1; | 436 | if (state->chip_type == 0x9306) { |
404 | buf[2] = 0x00; /* reg addr len */ | 437 | buf[1] = 0x03; /* I2C bus */ |
405 | buf[3] = 0x00; /* reg addr MSB */ | 438 | buf[2] = msg[0].addr << 1; |
406 | buf[4] = 0x00; /* reg addr LSB */ | 439 | } else { |
440 | buf[1] = msg[0].addr << 1; | ||
441 | buf[2] = 0x00; /* reg addr len */ | ||
442 | buf[3] = 0x00; /* reg addr MSB */ | ||
443 | buf[4] = 0x00; /* reg addr LSB */ | ||
444 | } | ||
407 | ret = af9035_ctrl_msg(d, &req); | 445 | ret = af9035_ctrl_msg(d, &req); |
408 | } | 446 | } |
409 | } else { | 447 | } else { |
@@ -465,6 +503,9 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name) | |||
465 | else | 503 | else |
466 | *name = AF9035_FIRMWARE_IT9135_V1; | 504 | *name = AF9035_FIRMWARE_IT9135_V1; |
467 | state->eeprom_addr = EEPROM_BASE_IT9135; | 505 | state->eeprom_addr = EEPROM_BASE_IT9135; |
506 | } else if (state->chip_type == 0x9306) { | ||
507 | *name = AF9035_FIRMWARE_IT9303; | ||
508 | state->eeprom_addr = EEPROM_BASE_IT9135; | ||
468 | } else { | 509 | } else { |
469 | *name = AF9035_FIRMWARE_AF9035; | 510 | *name = AF9035_FIRMWARE_AF9035; |
470 | state->eeprom_addr = EEPROM_BASE_AF9035; | 511 | state->eeprom_addr = EEPROM_BASE_AF9035; |
@@ -674,7 +715,8 @@ static int af9035_download_firmware(struct dvb_usb_device *d, | |||
674 | if (!tmp) | 715 | if (!tmp) |
675 | tmp = 0x3a; | 716 | tmp = 0x3a; |
676 | 717 | ||
677 | if (state->chip_type == 0x9135) { | 718 | if ((state->chip_type == 0x9135) || |
719 | (state->chip_type == 0x9306)) { | ||
678 | ret = af9035_wr_reg(d, 0x004bfb, tmp); | 720 | ret = af9035_wr_reg(d, 0x004bfb, tmp); |
679 | if (ret < 0) | 721 | if (ret < 0) |
680 | goto err; | 722 | goto err; |
@@ -766,8 +808,16 @@ static int af9035_read_config(struct dvb_usb_device *d) | |||
766 | dev_dbg(&d->udev->dev, "%s: no eeprom\n", __func__); | 808 | dev_dbg(&d->udev->dev, "%s: no eeprom\n", __func__); |
767 | goto skip_eeprom; | 809 | goto skip_eeprom; |
768 | } | 810 | } |
811 | } else if (state->chip_type == 0x9306) { | ||
812 | /* | ||
813 | * IT930x is an USB bridge, only single demod-single tuner | ||
814 | * configurations seen so far. | ||
815 | */ | ||
816 | return 0; | ||
769 | } | 817 | } |
770 | 818 | ||
819 | |||
820 | |||
771 | /* check if there is dual tuners */ | 821 | /* check if there is dual tuners */ |
772 | ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); | 822 | ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); |
773 | if (ret < 0) | 823 | if (ret < 0) |
@@ -1111,6 +1161,41 @@ err: | |||
1111 | return ret; | 1161 | return ret; |
1112 | } | 1162 | } |
1113 | 1163 | ||
1164 | static int it930x_frontend_attach(struct dvb_usb_adapter *adap) | ||
1165 | { | ||
1166 | struct state *state = adap_to_priv(adap); | ||
1167 | struct dvb_usb_device *d = adap_to_d(adap); | ||
1168 | int ret; | ||
1169 | struct si2168_config si2168_config; | ||
1170 | struct i2c_adapter *adapter; | ||
1171 | |||
1172 | dev_dbg(&d->udev->dev, "adap->id=%d\n", adap->id); | ||
1173 | |||
1174 | si2168_config.i2c_adapter = &adapter; | ||
1175 | si2168_config.fe = &adap->fe[0]; | ||
1176 | si2168_config.ts_mode = SI2168_TS_SERIAL; | ||
1177 | |||
1178 | state->af9033_config[adap->id].fe = &adap->fe[0]; | ||
1179 | state->af9033_config[adap->id].ops = &state->ops; | ||
1180 | ret = af9035_add_i2c_dev(d, "si2168", 0x67, &si2168_config, | ||
1181 | &d->i2c_adap); | ||
1182 | if (ret) | ||
1183 | goto err; | ||
1184 | |||
1185 | if (adap->fe[0] == NULL) { | ||
1186 | ret = -ENODEV; | ||
1187 | goto err; | ||
1188 | } | ||
1189 | state->i2c_adapter_demod = adapter; | ||
1190 | |||
1191 | return 0; | ||
1192 | |||
1193 | err: | ||
1194 | dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret); | ||
1195 | |||
1196 | return ret; | ||
1197 | } | ||
1198 | |||
1114 | static int af9035_frontend_detach(struct dvb_usb_adapter *adap) | 1199 | static int af9035_frontend_detach(struct dvb_usb_adapter *adap) |
1115 | { | 1200 | { |
1116 | struct state *state = adap_to_priv(adap); | 1201 | struct state *state = adap_to_priv(adap); |
@@ -1430,6 +1515,93 @@ err: | |||
1430 | return ret; | 1515 | return ret; |
1431 | } | 1516 | } |
1432 | 1517 | ||
1518 | static int it930x_tuner_attach(struct dvb_usb_adapter *adap) | ||
1519 | { | ||
1520 | struct state *state = adap_to_priv(adap); | ||
1521 | struct dvb_usb_device *d = adap_to_d(adap); | ||
1522 | int ret; | ||
1523 | struct si2157_config si2157_config; | ||
1524 | |||
1525 | dev_dbg(&d->udev->dev, "%s: adap->id=%d\n", __func__, adap->id); | ||
1526 | |||
1527 | /* I2C master bus 2 clock speed 300k */ | ||
1528 | ret = af9035_wr_reg(d, 0x00f6a7, 0x07); | ||
1529 | if (ret < 0) | ||
1530 | goto err; | ||
1531 | |||
1532 | /* I2C master bus 1,3 clock speed 300k */ | ||
1533 | ret = af9035_wr_reg(d, 0x00f103, 0x07); | ||
1534 | if (ret < 0) | ||
1535 | goto err; | ||
1536 | |||
1537 | /* set gpio11 low */ | ||
1538 | ret = af9035_wr_reg_mask(d, 0xd8d4, 0x01, 0x01); | ||
1539 | if (ret < 0) | ||
1540 | goto err; | ||
1541 | |||
1542 | ret = af9035_wr_reg_mask(d, 0xd8d5, 0x01, 0x01); | ||
1543 | if (ret < 0) | ||
1544 | goto err; | ||
1545 | |||
1546 | ret = af9035_wr_reg_mask(d, 0xd8d3, 0x01, 0x01); | ||
1547 | if (ret < 0) | ||
1548 | goto err; | ||
1549 | |||
1550 | /* Tuner enable using gpiot2_en, gpiot2_on and gpiot2_o (reset) */ | ||
1551 | ret = af9035_wr_reg_mask(d, 0xd8b8, 0x01, 0x01); | ||
1552 | if (ret < 0) | ||
1553 | goto err; | ||
1554 | |||
1555 | ret = af9035_wr_reg_mask(d, 0xd8b9, 0x01, 0x01); | ||
1556 | if (ret < 0) | ||
1557 | goto err; | ||
1558 | |||
1559 | ret = af9035_wr_reg_mask(d, 0xd8b7, 0x00, 0x01); | ||
1560 | if (ret < 0) | ||
1561 | goto err; | ||
1562 | |||
1563 | msleep(200); | ||
1564 | |||
1565 | ret = af9035_wr_reg_mask(d, 0xd8b7, 0x01, 0x01); | ||
1566 | if (ret < 0) | ||
1567 | goto err; | ||
1568 | |||
1569 | memset(&si2157_config, 0, sizeof(si2157_config)); | ||
1570 | si2157_config.fe = adap->fe[0]; | ||
1571 | ret = af9035_add_i2c_dev(d, "si2157", 0x63, | ||
1572 | &si2157_config, state->i2c_adapter_demod); | ||
1573 | |||
1574 | if (ret) | ||
1575 | goto err; | ||
1576 | |||
1577 | return 0; | ||
1578 | |||
1579 | err: | ||
1580 | dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret); | ||
1581 | |||
1582 | return ret; | ||
1583 | } | ||
1584 | |||
1585 | |||
1586 | static int it930x_tuner_detach(struct dvb_usb_adapter *adap) | ||
1587 | { | ||
1588 | struct state *state = adap_to_priv(adap); | ||
1589 | struct dvb_usb_device *d = adap_to_d(adap); | ||
1590 | |||
1591 | dev_dbg(&d->udev->dev, "adap->id=%d\n", adap->id); | ||
1592 | |||
1593 | if (adap->id == 1) { | ||
1594 | if (state->i2c_client[3]) | ||
1595 | af9035_del_i2c_dev(d); | ||
1596 | } else if (adap->id == 0) { | ||
1597 | if (state->i2c_client[1]) | ||
1598 | af9035_del_i2c_dev(d); | ||
1599 | } | ||
1600 | |||
1601 | return 0; | ||
1602 | } | ||
1603 | |||
1604 | |||
1433 | static int af9035_tuner_detach(struct dvb_usb_adapter *adap) | 1605 | static int af9035_tuner_detach(struct dvb_usb_adapter *adap) |
1434 | { | 1606 | { |
1435 | struct state *state = adap_to_priv(adap); | 1607 | struct state *state = adap_to_priv(adap); |
@@ -1503,6 +1675,89 @@ err: | |||
1503 | return ret; | 1675 | return ret; |
1504 | } | 1676 | } |
1505 | 1677 | ||
1678 | static int it930x_init(struct dvb_usb_device *d) | ||
1679 | { | ||
1680 | struct state *state = d_to_priv(d); | ||
1681 | int ret, i; | ||
1682 | u16 frame_size = (d->udev->speed == USB_SPEED_FULL ? 5 : 816) * 188 / 4; | ||
1683 | u8 packet_size = (d->udev->speed == USB_SPEED_FULL ? 64 : 512) / 4; | ||
1684 | struct reg_val_mask tab[] = { | ||
1685 | { 0x00da1a, 0x00, 0x01 }, /* ignore_sync_byte */ | ||
1686 | { 0x00f41f, 0x04, 0x04 }, /* dvbt_inten */ | ||
1687 | { 0x00da10, 0x00, 0x01 }, /* mpeg_full_speed */ | ||
1688 | { 0x00f41a, 0x01, 0x01 }, /* dvbt_en */ | ||
1689 | { 0x00da1d, 0x01, 0x01 }, /* mp2_sw_rst, reset EP4 */ | ||
1690 | { 0x00dd11, 0x00, 0x20 }, /* ep4_tx_en, disable EP4 */ | ||
1691 | { 0x00dd13, 0x00, 0x20 }, /* ep4_tx_nak, disable EP4 NAK */ | ||
1692 | { 0x00dd11, 0x20, 0x20 }, /* ep4_tx_en, enable EP4 */ | ||
1693 | { 0x00dd11, 0x00, 0x40 }, /* ep5_tx_en, disable EP5 */ | ||
1694 | { 0x00dd13, 0x00, 0x40 }, /* ep5_tx_nak, disable EP5 NAK */ | ||
1695 | { 0x00dd11, state->dual_mode << 6, 0x40 }, /* enable EP5 */ | ||
1696 | { 0x00dd88, (frame_size >> 0) & 0xff, 0xff}, | ||
1697 | { 0x00dd89, (frame_size >> 8) & 0xff, 0xff}, | ||
1698 | { 0x00dd0c, packet_size, 0xff}, | ||
1699 | { 0x00dd8a, (frame_size >> 0) & 0xff, 0xff}, | ||
1700 | { 0x00dd8b, (frame_size >> 8) & 0xff, 0xff}, | ||
1701 | { 0x00dd0d, packet_size, 0xff }, | ||
1702 | { 0x00da1d, 0x00, 0x01 }, /* mp2_sw_rst, disable */ | ||
1703 | { 0x00d833, 0x01, 0xff }, /* slew rate ctrl: slew rate boosts */ | ||
1704 | { 0x00d830, 0x00, 0xff }, /* Bit 0 of output driving control */ | ||
1705 | { 0x00d831, 0x01, 0xff }, /* Bit 1 of output driving control */ | ||
1706 | { 0x00d832, 0x00, 0xff }, /* Bit 2 of output driving control */ | ||
1707 | |||
1708 | /* suspend gpio1 for TS-C */ | ||
1709 | { 0x00d8b0, 0x01, 0xff }, /* gpio1 */ | ||
1710 | { 0x00d8b1, 0x01, 0xff }, /* gpio1 */ | ||
1711 | { 0x00d8af, 0x00, 0xff }, /* gpio1 */ | ||
1712 | |||
1713 | /* suspend gpio7 for TS-D */ | ||
1714 | { 0x00d8c4, 0x01, 0xff }, /* gpio7 */ | ||
1715 | { 0x00d8c5, 0x01, 0xff }, /* gpio7 */ | ||
1716 | { 0x00d8c3, 0x00, 0xff }, /* gpio7 */ | ||
1717 | |||
1718 | /* suspend gpio13 for TS-B */ | ||
1719 | { 0x00d8dc, 0x01, 0xff }, /* gpio13 */ | ||
1720 | { 0x00d8dd, 0x01, 0xff }, /* gpio13 */ | ||
1721 | { 0x00d8db, 0x00, 0xff }, /* gpio13 */ | ||
1722 | |||
1723 | /* suspend gpio14 for TS-E */ | ||
1724 | { 0x00d8e4, 0x01, 0xff }, /* gpio14 */ | ||
1725 | { 0x00d8e5, 0x01, 0xff }, /* gpio14 */ | ||
1726 | { 0x00d8e3, 0x00, 0xff }, /* gpio14 */ | ||
1727 | |||
1728 | /* suspend gpio15 for TS-A */ | ||
1729 | { 0x00d8e8, 0x01, 0xff }, /* gpio15 */ | ||
1730 | { 0x00d8e9, 0x01, 0xff }, /* gpio15 */ | ||
1731 | { 0x00d8e7, 0x00, 0xff }, /* gpio15 */ | ||
1732 | |||
1733 | { 0x00da58, 0x00, 0x01 }, /* ts_in_src, serial */ | ||
1734 | { 0x00da73, 0x01, 0xff }, /* ts0_aggre_mode */ | ||
1735 | { 0x00da78, 0x47, 0xff }, /* ts0_sync_byte */ | ||
1736 | { 0x00da4c, 0x01, 0xff }, /* ts0_en */ | ||
1737 | { 0x00da5a, 0x1f, 0xff }, /* ts_fail_ignore */ | ||
1738 | }; | ||
1739 | |||
1740 | dev_dbg(&d->udev->dev, | ||
1741 | "%s: USB speed=%d frame_size=%04x packet_size=%02x\n", | ||
1742 | __func__, d->udev->speed, frame_size, packet_size); | ||
1743 | |||
1744 | /* init endpoints */ | ||
1745 | for (i = 0; i < ARRAY_SIZE(tab); i++) { | ||
1746 | ret = af9035_wr_reg_mask(d, tab[i].reg, | ||
1747 | tab[i].val, tab[i].mask); | ||
1748 | |||
1749 | if (ret < 0) | ||
1750 | goto err; | ||
1751 | } | ||
1752 | |||
1753 | return 0; | ||
1754 | err: | ||
1755 | dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret); | ||
1756 | |||
1757 | return ret; | ||
1758 | } | ||
1759 | |||
1760 | |||
1506 | #if IS_ENABLED(CONFIG_RC_CORE) | 1761 | #if IS_ENABLED(CONFIG_RC_CORE) |
1507 | static int af9035_rc_query(struct dvb_usb_device *d) | 1762 | static int af9035_rc_query(struct dvb_usb_device *d) |
1508 | { | 1763 | { |
@@ -1706,6 +1961,37 @@ static const struct dvb_usb_device_properties af9035_props = { | |||
1706 | }, | 1961 | }, |
1707 | }; | 1962 | }; |
1708 | 1963 | ||
1964 | static const struct dvb_usb_device_properties it930x_props = { | ||
1965 | .driver_name = KBUILD_MODNAME, | ||
1966 | .owner = THIS_MODULE, | ||
1967 | .adapter_nr = adapter_nr, | ||
1968 | .size_of_priv = sizeof(struct state), | ||
1969 | |||
1970 | .generic_bulk_ctrl_endpoint = 0x02, | ||
1971 | .generic_bulk_ctrl_endpoint_response = 0x81, | ||
1972 | |||
1973 | .identify_state = af9035_identify_state, | ||
1974 | .download_firmware = af9035_download_firmware, | ||
1975 | |||
1976 | .i2c_algo = &af9035_i2c_algo, | ||
1977 | .read_config = af9035_read_config, | ||
1978 | .frontend_attach = it930x_frontend_attach, | ||
1979 | .frontend_detach = af9035_frontend_detach, | ||
1980 | .tuner_attach = it930x_tuner_attach, | ||
1981 | .tuner_detach = it930x_tuner_detach, | ||
1982 | .init = it930x_init, | ||
1983 | .get_stream_config = af9035_get_stream_config, | ||
1984 | |||
1985 | .get_adapter_count = af9035_get_adapter_count, | ||
1986 | .adapter = { | ||
1987 | { | ||
1988 | .stream = DVB_USB_STREAM_BULK(0x84, 4, 816 * 188), | ||
1989 | }, { | ||
1990 | .stream = DVB_USB_STREAM_BULK(0x85, 4, 816 * 188), | ||
1991 | }, | ||
1992 | }, | ||
1993 | }; | ||
1994 | |||
1709 | static const struct usb_device_id af9035_id_table[] = { | 1995 | static const struct usb_device_id af9035_id_table[] = { |
1710 | /* AF9035 devices */ | 1996 | /* AF9035 devices */ |
1711 | { DVB_USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035_9035, | 1997 | { DVB_USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035_9035, |
@@ -1759,6 +2045,9 @@ static const struct usb_device_id af9035_id_table[] = { | |||
1759 | { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_CTVDIGDUAL_V2, | 2045 | { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_CTVDIGDUAL_V2, |
1760 | &af9035_props, "Digital Dual TV Receiver CTVDIGDUAL_V2", | 2046 | &af9035_props, "Digital Dual TV Receiver CTVDIGDUAL_V2", |
1761 | RC_MAP_IT913X_V1) }, | 2047 | RC_MAP_IT913X_V1) }, |
2048 | /* IT930x devices */ | ||
2049 | { DVB_USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9303, | ||
2050 | &it930x_props, "ITE 9303 Generic", NULL) }, | ||
1762 | /* XXX: that same ID [0ccd:0099] is used by af9015 driver too */ | 2051 | /* XXX: that same ID [0ccd:0099] is used by af9015 driver too */ |
1763 | { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x0099, | 2052 | { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x0099, |
1764 | &af9035_props, "TerraTec Cinergy T Stick Dual RC (rev. 2)", | 2053 | &af9035_props, "TerraTec Cinergy T Stick Dual RC (rev. 2)", |
@@ -1795,3 +2084,4 @@ MODULE_LICENSE("GPL"); | |||
1795 | MODULE_FIRMWARE(AF9035_FIRMWARE_AF9035); | 2084 | MODULE_FIRMWARE(AF9035_FIRMWARE_AF9035); |
1796 | MODULE_FIRMWARE(AF9035_FIRMWARE_IT9135_V1); | 2085 | MODULE_FIRMWARE(AF9035_FIRMWARE_IT9135_V1); |
1797 | MODULE_FIRMWARE(AF9035_FIRMWARE_IT9135_V2); | 2086 | MODULE_FIRMWARE(AF9035_FIRMWARE_IT9135_V2); |
2087 | MODULE_FIRMWARE(AF9035_FIRMWARE_IT9303); | ||
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h index edb3871c50ea..416a97f05ec8 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.h +++ b/drivers/media/usb/dvb-usb-v2/af9035.h | |||
@@ -31,6 +31,8 @@ | |||
31 | #include "tda18218.h" | 31 | #include "tda18218.h" |
32 | #include "fc2580.h" | 32 | #include "fc2580.h" |
33 | #include "it913x.h" | 33 | #include "it913x.h" |
34 | #include "si2168.h" | ||
35 | #include "si2157.h" | ||
34 | 36 | ||
35 | struct reg_val { | 37 | struct reg_val { |
36 | u32 reg; | 38 | u32 reg; |
@@ -66,6 +68,7 @@ struct state { | |||
66 | struct af9033_ops ops; | 68 | struct af9033_ops ops; |
67 | #define AF9035_I2C_CLIENT_MAX 4 | 69 | #define AF9035_I2C_CLIENT_MAX 4 |
68 | struct i2c_client *i2c_client[AF9035_I2C_CLIENT_MAX]; | 70 | struct i2c_client *i2c_client[AF9035_I2C_CLIENT_MAX]; |
71 | struct i2c_adapter *i2c_adapter_demod; | ||
69 | }; | 72 | }; |
70 | 73 | ||
71 | static const u32 clock_lut_af9035[] = { | 74 | static const u32 clock_lut_af9035[] = { |
@@ -99,6 +102,7 @@ static const u32 clock_lut_it9135[] = { | |||
99 | #define AF9035_FIRMWARE_AF9035 "dvb-usb-af9035-02.fw" | 102 | #define AF9035_FIRMWARE_AF9035 "dvb-usb-af9035-02.fw" |
100 | #define AF9035_FIRMWARE_IT9135_V1 "dvb-usb-it9135-01.fw" | 103 | #define AF9035_FIRMWARE_IT9135_V1 "dvb-usb-it9135-01.fw" |
101 | #define AF9035_FIRMWARE_IT9135_V2 "dvb-usb-it9135-02.fw" | 104 | #define AF9035_FIRMWARE_IT9135_V2 "dvb-usb-it9135-02.fw" |
105 | #define AF9035_FIRMWARE_IT9303 "dvb-usb-it9303-01.fw" | ||
102 | 106 | ||
103 | /* | 107 | /* |
104 | * eeprom is memory mapped as read only. Writing that memory mapped address | 108 | * eeprom is memory mapped as read only. Writing that memory mapped address |
@@ -140,5 +144,7 @@ static const u32 clock_lut_it9135[] = { | |||
140 | #define CMD_FW_DL_BEGIN 0x24 | 144 | #define CMD_FW_DL_BEGIN 0x24 |
141 | #define CMD_FW_DL_END 0x25 | 145 | #define CMD_FW_DL_END 0x25 |
142 | #define CMD_FW_SCATTER_WR 0x29 | 146 | #define CMD_FW_SCATTER_WR 0x29 |
147 | #define CMD_GENERIC_I2C_RD 0x2a | ||
148 | #define CMD_GENERIC_I2C_WR 0x2b | ||
143 | 149 | ||
144 | #endif | 150 | #endif |