Path: blob/master/drivers/media/dvb/mantis/mantis_common.h
15112 views
/*1Mantis PCI bridge driver23Copyright (C) Manu Abraham ([email protected])45This program is free software; you can redistribute it and/or modify6it under the terms of the GNU General Public License as published by7the Free Software Foundation; either version 2 of the License, or8(at your option) any later version.910This program is distributed in the hope that it will be useful,11but WITHOUT ANY WARRANTY; without even the implied warranty of12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13GNU General Public License for more details.1415You should have received a copy of the GNU General Public License16along with this program; if not, write to the Free Software17Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18*/1920#ifndef __MANTIS_COMMON_H21#define __MANTIS_COMMON_H2223#include <linux/mutex.h>24#include <linux/workqueue.h>2526#include "mantis_uart.h"2728#include "mantis_link.h"2930#define MANTIS_ERROR 031#define MANTIS_NOTICE 132#define MANTIS_INFO 233#define MANTIS_DEBUG 334#define MANTIS_TMG 93536#define dprintk(y, z, format, arg...) do { \37if (z) { \38if ((mantis->verbose > MANTIS_ERROR) && (mantis->verbose > y)) \39printk(KERN_ERR "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \40else if ((mantis->verbose > MANTIS_NOTICE) && (mantis->verbose > y)) \41printk(KERN_NOTICE "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \42else if ((mantis->verbose > MANTIS_INFO) && (mantis->verbose > y)) \43printk(KERN_INFO "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \44else if ((mantis->verbose > MANTIS_DEBUG) && (mantis->verbose > y)) \45printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \46else if ((mantis->verbose > MANTIS_TMG) && (mantis->verbose > y)) \47printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \48} else { \49if (mantis->verbose > y) \50printk(format , ##arg); \51} \52} while(0)5354#define mwrite(dat, addr) writel((dat), addr)55#define mread(addr) readl(addr)5657#define mmwrite(dat, addr) mwrite((dat), (mantis->mmio + (addr)))58#define mmread(addr) mread(mantis->mmio + (addr))5960#define MANTIS_TS_188 061#define MANTIS_TS_204 16263#define TWINHAN_TECHNOLOGIES 0x182264#define MANTIS 0x4e356566#define TECHNISAT 0x1ae467#define TERRATEC 0x153b6869#define MAKE_ENTRY(__subven, __subdev, __configptr) { \70.vendor = TWINHAN_TECHNOLOGIES, \71.device = MANTIS, \72.subvendor = (__subven), \73.subdevice = (__subdev), \74.driver_data = (unsigned long) (__configptr) \75}7677enum mantis_i2c_mode {78MANTIS_PAGE_MODE = 0,79MANTIS_BYTE_MODE,80};8182struct mantis_pci;8384struct mantis_hwconfig {85char *model_name;86char *dev_type;87u32 ts_size;8889enum mantis_baud baud_rate;90enum mantis_parity parity;91u32 bytes;9293irqreturn_t (*irq_handler)(int irq, void *dev_id);94int (*frontend_init)(struct mantis_pci *mantis, struct dvb_frontend *fe);9596u8 power;97u8 reset;9899enum mantis_i2c_mode i2c_mode;100};101102struct mantis_pci {103unsigned int verbose;104105/* PCI stuff */106u16 vendor_id;107u16 device_id;108u16 subsystem_vendor;109u16 subsystem_device;110111u8 latency;112113struct pci_dev *pdev;114115unsigned long mantis_addr;116void __iomem *mmio;117118u8 irq;119u8 revision;120121unsigned int num;122123/* RISC Core */124u32 finished_block;125u32 last_block;126u32 line_bytes;127u32 line_count;128u32 risc_pos;129u8 *buf_cpu;130dma_addr_t buf_dma;131u32 *risc_cpu;132dma_addr_t risc_dma;133134struct tasklet_struct tasklet;135136struct i2c_adapter adapter;137int i2c_rc;138wait_queue_head_t i2c_wq;139struct mutex i2c_lock;140141/* DVB stuff */142struct dvb_adapter dvb_adapter;143struct dvb_frontend *fe;144struct dvb_demux demux;145struct dmxdev dmxdev;146struct dmx_frontend fe_hw;147struct dmx_frontend fe_mem;148struct dvb_net dvbnet;149150u8 feeds;151152struct mantis_hwconfig *hwconfig;153154u32 mantis_int_stat;155u32 mantis_int_mask;156157/* board specific */158u8 mac_address[8];159u32 sub_vendor_id;160u32 sub_device_id;161162/* A12 A13 A14 */163u32 gpio_status;164165u32 gpif_status;166167struct mantis_ca *mantis_ca;168169wait_queue_head_t uart_wq;170struct work_struct uart_work;171spinlock_t uart_lock;172173struct rc_dev *rc;174char input_name[80];175char input_phys[80];176};177178#define MANTIS_HIF_STATUS (mantis->gpio_status)179180#endif /* __MANTIS_COMMON_H */181182183