friio.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* DVB USB compliant Linux driver for the Friio USB2.0 ISDB-T receiver.
  2. *
  3. * Copyright (C) 2009 Akihiro Tsukada <tskd2@yahoo.co.jp>
  4. *
  5. * This module is based off the the gl861 and vp702x modules.
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the Free
  9. * Software Foundation, version 2.
  10. *
  11. * see Documentation/dvb/README.dvb-usb for more information
  12. */
  13. #ifndef _DVB_USB_FRIIO_H_
  14. #define _DVB_USB_FRIIO_H_
  15. /**
  16. * Friio Components
  17. * USB hub: AU4254
  18. * USB controller(+ TS dmx & streaming): GL861
  19. * Frontend: comtech JDVBT-90502
  20. * (tuner PLL: tua6034, I2C addr:(0xC0 >> 1))
  21. * (OFDM demodulator: TC90502, I2C addr:(0x30 >> 1))
  22. * LED x3 (+LNB) control: PIC 16F676
  23. * EEPROM: 24C08
  24. *
  25. * (USB smart card reader: AU9522)
  26. *
  27. */
  28. #define DVB_USB_LOG_PREFIX "friio"
  29. #include "dvb-usb.h"
  30. extern int dvb_usb_friio_debug;
  31. #define deb_info(args...) dprintk(dvb_usb_friio_debug, 0x01, args)
  32. #define deb_xfer(args...) dprintk(dvb_usb_friio_debug, 0x02, args)
  33. #define deb_rc(args...) dprintk(dvb_usb_friio_debug, 0x04, args)
  34. #define deb_fe(args...) dprintk(dvb_usb_friio_debug, 0x08, args)
  35. /* Vendor requests */
  36. #define GL861_WRITE 0x40
  37. #define GL861_READ 0xc0
  38. /* command bytes */
  39. #define GL861_REQ_I2C_WRITE 0x01
  40. #define GL861_REQ_I2C_READ 0x02
  41. /* For control msg with data argument */
  42. /* Used for accessing the PLL on the secondary I2C bus of FE via GL861 */
  43. #define GL861_REQ_I2C_DATA_CTRL_WRITE 0x03
  44. #define GL861_ALTSETTING_COUNT 2
  45. #define FRIIO_BULK_ALTSETTING 0
  46. #define FRIIO_ISOC_ALTSETTING 1
  47. /* LED & LNB control via PIC. */
  48. /* basically, it's serial control with clock and strobe. */
  49. /* write the below 4bit control data to the reg 0x00 at the I2C addr 0x00 */
  50. /* when controlling the LEDs, 32bit(saturation, R, G, B) is sent on the bit3*/
  51. #define FRIIO_CTL_LNB (1 << 0)
  52. #define FRIIO_CTL_STROBE (1 << 1)
  53. #define FRIIO_CTL_CLK (1 << 2)
  54. #define FRIIO_CTL_LED (1 << 3)
  55. /* Front End related */
  56. #define FRIIO_DEMOD_ADDR (0x30 >> 1)
  57. #define FRIIO_PLL_ADDR (0xC0 >> 1)
  58. #define JDVBT90502_PLL_CLK 4000000
  59. #define JDVBT90502_PLL_DIVIDER 28
  60. #define JDVBT90502_2ND_I2C_REG 0xFE
  61. /* byte index for pll i2c command data structure*/
  62. /* see datasheet for tua6034 */
  63. #define DEMOD_REDIRECT_REG 0
  64. #define ADDRESS_BYTE 1
  65. #define DIVIDER_BYTE1 2
  66. #define DIVIDER_BYTE2 3
  67. #define CONTROL_BYTE 4
  68. #define BANDSWITCH_BYTE 5
  69. #define AGC_CTRL_BYTE 5
  70. #define PLL_CMD_LEN 6
  71. /* bit masks for PLL STATUS response */
  72. #define PLL_STATUS_POR_MODE 0x80 /* 1: Power on Reset (test) Mode */
  73. #define PLL_STATUS_LOCKED 0x40 /* 1: locked */
  74. #define PLL_STATUS_AGC_ACTIVE 0x08 /* 1:active */
  75. #define PLL_STATUS_TESTMODE 0x07 /* digital output level (5 level) */
  76. /* 0.15Vcc step 0x00: < 0.15Vcc, ..., 0x04: >= 0.6Vcc (<= 1Vcc) */
  77. struct jdvbt90502_config {
  78. u8 demod_address; /* i2c addr for demodulator IC */
  79. u8 pll_address; /* PLL addr on the secondary i2c*/
  80. };
  81. extern struct jdvbt90502_config friio_fe_config;
  82. extern struct dvb_frontend *jdvbt90502_attach(struct dvb_usb_device *d);
  83. #endif