linux/drivers/media/usb/dvb-usb/friio.h
<<
>>
Prefs
   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/media/dvb-drivers/dvb-usb.rst for more information
  12 */
  13#ifndef _DVB_USB_FRIIO_H_
  14#define _DVB_USB_FRIIO_H_
  15
  16/**
  17 *      Friio Components
  18 *       USB hub:                                AU4254
  19 *         USB controller(+ TS dmx & streaming): GL861
  20 *         Frontend:                             comtech JDVBT-90502
  21 *             (tuner PLL:                       tua6034, I2C addr:(0xC0 >> 1))
  22 *             (OFDM demodulator:                TC90502, I2C addr:(0x30 >> 1))
  23 *         LED x3 (+LNB) control:                PIC 16F676
  24 *         EEPROM:                               24C08
  25 *
  26 *        (USB smart card reader:                AU9522)
  27 *
  28 */
  29
  30#define DVB_USB_LOG_PREFIX "friio"
  31#include "dvb-usb.h"
  32
  33extern int dvb_usb_friio_debug;
  34#define deb_info(args...) dprintk(dvb_usb_friio_debug, 0x01, args)
  35#define deb_xfer(args...) dprintk(dvb_usb_friio_debug, 0x02, args)
  36#define deb_rc(args...)   dprintk(dvb_usb_friio_debug, 0x04, args)
  37#define deb_fe(args...)   dprintk(dvb_usb_friio_debug, 0x08, args)
  38
  39/* Vendor requests */
  40#define GL861_WRITE             0x40
  41#define GL861_READ              0xc0
  42
  43/* command bytes */
  44#define GL861_REQ_I2C_WRITE     0x01
  45#define GL861_REQ_I2C_READ      0x02
  46/* For control msg with data argument */
  47/* Used for accessing the PLL on the secondary I2C bus of FE via GL861 */
  48#define GL861_REQ_I2C_DATA_CTRL_WRITE   0x03
  49
  50#define GL861_ALTSETTING_COUNT  2
  51#define FRIIO_BULK_ALTSETTING   0
  52#define FRIIO_ISOC_ALTSETTING   1
  53
  54/* LED & LNB control via PIC. */
  55/* basically, it's serial control with clock and strobe. */
  56/* write the below 4bit control data to the reg 0x00 at the I2C addr 0x00 */
  57/* when controlling the LEDs, 32bit(saturation, R, G, B) is sent on the bit3*/
  58#define FRIIO_CTL_LNB (1 << 0)
  59#define FRIIO_CTL_STROBE (1 << 1)
  60#define FRIIO_CTL_CLK (1 << 2)
  61#define FRIIO_CTL_LED (1 << 3)
  62
  63/* Front End related */
  64
  65#define FRIIO_DEMOD_ADDR  (0x30 >> 1)
  66#define FRIIO_PLL_ADDR  (0xC0 >> 1)
  67
  68#define JDVBT90502_PLL_CLK      4000000
  69#define JDVBT90502_PLL_DIVIDER  28
  70
  71#define JDVBT90502_2ND_I2C_REG 0xFE
  72
  73/* byte index for pll i2c command data structure*/
  74/* see datasheet for tua6034 */
  75#define DEMOD_REDIRECT_REG 0
  76#define ADDRESS_BYTE       1
  77#define DIVIDER_BYTE1      2
  78#define DIVIDER_BYTE2      3
  79#define CONTROL_BYTE       4
  80#define BANDSWITCH_BYTE    5
  81#define AGC_CTRL_BYTE      5
  82#define PLL_CMD_LEN        6
  83
  84/* bit masks for PLL STATUS response */
  85#define PLL_STATUS_POR_MODE   0x80 /* 1: Power on Reset (test) Mode */
  86#define PLL_STATUS_LOCKED     0x40 /* 1: locked */
  87#define PLL_STATUS_AGC_ACTIVE 0x08 /* 1:active */
  88#define PLL_STATUS_TESTMODE   0x07 /* digital output level (5 level) */
  89  /* 0.15Vcc step   0x00: < 0.15Vcc, ..., 0x04: >= 0.6Vcc (<= 1Vcc) */
  90
  91
  92struct jdvbt90502_config {
  93        u8 demod_address; /* i2c addr for demodulator IC */
  94        u8 pll_address;   /* PLL addr on the secondary i2c*/
  95};
  96extern struct jdvbt90502_config friio_fe_config;
  97
  98extern struct dvb_frontend *jdvbt90502_attach(struct dvb_usb_device *d);
  99#endif
 100