Skip to content

Commit

Permalink
V4L/DVB (13699): [Mantis, MB86A16] Initial checkin: Mantis, MB86A16
Browse files Browse the repository at this point in the history
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Manu Abraham authored and Mauro Carvalho Chehab committed Jan 17, 2010
1 parent 6ccf80e commit 41e840b
Show file tree
Hide file tree
Showing 20 changed files with 3,689 additions and 0 deletions.
1,772 changes: 1,772 additions & 0 deletions drivers/media/dvb/frontends/mb86a16.c

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions drivers/media/dvb/frontends/mb86a16.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Fujitsu MB86A16 DVB-S/DSS DC Receiver driver
Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef __MB86A16_H
#define __MB86A16_H

#include <linux/dvb/frontend.h>
#include "dvb_frontend.h"


struct mb86a16_config {
u8 demod_address;

int (*set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
};

extern struct dvb_frontend *mb86a16_attach(const struct mb86a16_config *config,
struct i2c_adapter *i2c_adap);


#endif //__MB86A16_H
151 changes: 151 additions & 0 deletions drivers/media/dvb/frontends/mb86a16_priv.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
/*
Fujitsu MB86A16 DVB-S/DSS DC Receiver driver
Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef __MB86A16_PRIV_H
#define __MB86A16_PRIV_H

#define MB86A16_TSOUT 0x00
#define MB86A16_TSOUT_HIZSEL (0x01 << 5)
#define MB86A16_TSOUT_HIZCNTI (0x01 << 4)
#define MB86A16_TSOUT_MODE (0x01 << 3)
#define MB86A16_TSOUT_ORDER (0x01 << 2)
#define MB86A16_TSOUT_ERROR (0x01 << 1)
#define Mb86A16_TSOUT_EDGE (0x01 << 0)

#define MB86A16_FEC 0x01
#define MB86A16_FEC_FSYNC (0x01 << 5)
#define MB86A16_FEC_PCKB8 (0x01 << 4)
#define MB86A16_FEC_DVDS (0x01 << 3)
#define MB86A16_FEC_EREN (0x01 << 2)
#define Mb86A16_FEC_RSEN (0x01 << 1)
#define MB86A16_FEC_DIEN (0x01 << 0)

#define MB86A16_AGC 0x02
#define MB86A16_AGC_AGMD (0x01 << 6)
#define MB86A16_AGC_AGCW (0x0f << 2)
#define MB86A16_AGC_AGCP (0x01 << 1)
#define MB86A16_AGC_AGCR (0x01 << 0)

#define MB86A16_SRATE1 0x03
#define MB86A16_SRATE1_DECI (0x07 << 2)
#define MB86A16_SRATE1_CSEL (0x01 << 1)
#define MB86A16_SRATE1_RSEL (0x01 << 0)

#define MB86A16_SRATE2 0x04
#define MB86A16_SRATE2_STOFSL (0xff << 0)

#define MB86A16_SRATE3 0x05
#define MB86A16_SRATE2_STOFSH (0xff << 0)

#define MB86A16_VITERBI 0x06
#define MB86A16_FRAMESYNC 0x07
#define MB86A16_CRLFILTCOEF1 0x08
#define MB86A16_CRLFILTCOEF2 0x09
#define MB86A16_STRFILTCOEF1 0x0a
#define MB86A16_STRFILTCOEF2 0x0b
#define MB86A16_RESET 0x0c
#define MB86A16_STATUS 0x0d
#define MB86A16_AFCML 0x0e
#define MB86A16_AFCMH 0x0f
#define MB86A16_BERMON 0x10
#define MB86A16_BERTAB 0x11
#define MB86A16_BERLSB 0x12
#define MB86A16_BERMID 0x13
#define MB86A16_BERMSB 0x14
#define MB86A16_AGCM 0x15

#define MB86A16_DCC1 0x16
#define MB86A16_DCC1_DISTA (0x01 << 7)
#define MB86A16_DCC1_PRTY (0x01 << 6)
#define MB86A16_DCC1_CTOE (0x01 << 5)
#define MB86A16_DCC1_TBEN (0x01 << 4)
#define MB86A16_DCC1_TBO (0x01 << 3)
#define MB86A16_DCC1_NUM (0x07 << 0)

#define MB86A16_DCC2 0x17
#define MB86A16_DCC2_DCBST (0x01 << 0)

#define MB86A16_DCC3 0x18
#define MB86A16_DCC3_CODE0 (0xff << 0)

#define MB86A16_DCC4 0x19
#define MB86A16_DCC4_CODE1 (0xff << 0)

#define MB86A16_DCC5 0x1a
#define MB86A16_DCC5_CODE2 (0xff << 0)

#define MB86A16_DCC6 0x1b
#define MB86A16_DCC6_CODE3 (0xff << 0)

#define MB86A16_DCC7 0x1c
#define MB86A16_DCC7_CODE4 (0xff << 0)

#define MB86A16_DCC8 0x1d
#define MB86A16_DCC8_CODE5 (0xff << 0)

#define MB86A16_DCCOUT 0x1e
#define MB86A16_DCCOUT_DISEN (0x01 << 0)

#define MB86A16_TONEOUT1 0x1f
#define MB86A16_TONE_TDIVL (0xff << 0)

#define MB86A16_TONEOUT2 0x20
#define MB86A16_TONE_TMD (0x03 << 2)
#define MB86A16_TONE_TDIVH (0x03 << 0)

#define MB86A16_FREQ1 0x21
#define MB86A16_FREQ2 0x22
#define MB86A16_FREQ3 0x23
#define MB86A16_FREQ4 0x24
#define MB86A16_FREQSET 0x25
#define MB86A16_CNM 0x26
#define MB86A16_PORT0 0x27
#define MB86A16_PORT1 0x28
#define MB86A16_DRCFILT 0x29
#define MB86A16_AFC 0x2a
#define MB86A16_AFCEXL 0x2b
#define MB86A16_AFCEXH 0x2c
#define MB86A16_DAGC 0x2d
#define MB86A16_SEQMODE 0x32
#define MB86A16_S0S1T 0x33
#define MB86A16_S2S3T 0x34
#define MB86A16_S4S5T 0x35
#define MB86A16_CNTMR 0x36
#define MB86A16_SIG1 0x37
#define MB86A16_SIG2 0x38
#define MB86A16_VIMAG 0x39
#define MB86A16_VISET1 0x3a
#define MB86A16_VISET2 0x3b
#define MB86A16_VISET3 0x3c
#define MB86A16_FAGCS1 0x3d
#define MB86A16_FAGCS2 0x3e
#define MB86A16_FAGCS3 0x3f
#define MB86A16_FAGCS4 0x40
#define MB86A16_FAGCS5 0x41
#define MB86A16_FAGCS6 0x42
#define MB86A16_CRM 0x43
#define MB86A16_STRM 0x44
#define MB86A16_DAGCML 0x45
#define MB86A16_DAGCMH 0x46
#define MB86A16_QPSKTST 0x49
#define MB86A16_DISTMON 0x52
#define MB86A16_VERSION 0x7f

#endif //__MB86A16_PRIV_H
13 changes: 13 additions & 0 deletions drivers/media/dvb/mantis/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
config DVB_MANTIS
tristate "MANTIS based cards"
depends on DVB_CORE && PCI && I2C
select DVB_MB86A16
select DVB_CU1216
select DVB_ZL10353
select DVB_STV0299
select DVB_PLL
help
Support for PCI cards based on the Mantis PCI bridge.
Say Y when you have a Mantis based DVB card and want to use it.

If unsure say N.
7 changes: 7 additions & 0 deletions drivers/media/dvb/mantis/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mantis-objs = mantis_core.o mantis_dma.o mantis_pci.o mantis_i2c.o \
mantis_dvb.o mantis_vp1033.o mantis_vp1034.o mantis_vp2033.o \
mantis_vp3030.o

obj-$(CONFIG_DVB_MANTIS) += mantis.o

EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
135 changes: 135 additions & 0 deletions drivers/media/dvb/mantis/mantis_common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/*
Mantis PCI bridge driver
Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef __MANTIS_COMMON_H
#define __MANTIS_COMMON_H

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/pci.h>

#include "dvbdev.h"
#include "dvb_demux.h"
#include "dmxdev.h"
#include "dvb_frontend.h"
#include "dvb_net.h"
#include <linux/i2c.h>
#include "mantis_reg.h"

#define MANTIS_ERROR 0
#define MANTIS_NOTICE 1
#define MANTIS_INFO 2
#define MANTIS_DEBUG 3

#define dprintk(x, y, z, format, arg...) do { \
if (z) { \
if ((x > MANTIS_ERROR) && (x > y)) \
printk(KERN_ERR "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
else if ((x > MANTIS_NOTICE) && (x > y)) \
printk(KERN_NOTICE "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
else if ((x > MANTIS_INFO) && (x > y)) \
printk(KERN_INFO "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
else if ((x > MANTIS_DEBUG) && (x > y)) \
printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
} else { \
if (x > y) \
printk(format , ##arg); \
} \
} while(0)

#define mwrite(dat, addr) writel((dat), addr)
#define mread(addr) readl(addr)

#define mmwrite(dat, addr) mwrite((dat), (mantis->mantis_mmio + (addr)))
#define mmread(addr) mread(mantis->mantis_mmio + (addr))
#define mmand(dat, addr) mmwrite((dat) & mmread(addr), addr)
#define mmor(dat, addr) mmwrite((dat) | mmread(addr), addr)
#define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr)


struct mantis_pci {
/* PCI stuff */
u16 vendor_id;
u16 device_id;
u8 latency;

struct pci_dev *pdev;

unsigned long mantis_addr;
volatile void __iomem *mantis_mmio;

u8 irq;
u8 revision;

unsigned int num;
u16 ts_size;

/* RISC Core */
u32 finished_block;
u32 last_block;
u32 line_bytes;
u32 line_count;
u32 risc_pos;
u8 *buf_cpu;
dma_addr_t buf_dma;
u32 *risc_cpu;
dma_addr_t risc_dma;

struct tasklet_struct tasklet;

struct i2c_adapter adapter;
int i2c_rc;
wait_queue_head_t i2c_wq;

/* DVB stuff */
struct dvb_adapter dvb_adapter;
struct dvb_frontend *fe;
struct dvb_demux demux;
struct dmxdev dmxdev;
struct dmx_frontend fe_hw;
struct dmx_frontend fe_mem;
struct dvb_net dvbnet;

u8 feeds;

struct mantis_config *config;

u32 mantis_int_stat;
u32 mantis_int_mask;

/* board specific */
u8 mac_address[8];
u32 sub_vendor_id;
u32 sub_device_id;

/* A12 A13 A14 */
int gpio_status;};

extern unsigned int verbose;
extern unsigned int devs;
extern unsigned int i2c;
extern int mantis_dvb_init(struct mantis_pci *mantis);
extern int mantis_frontend_init(struct mantis_pci *mantis);
extern int mantis_dvb_exit(struct mantis_pci *mantis);
extern void mantis_dma_xfer(unsigned long data);
extern void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value);

#endif //__MANTIS_COMMON_H
Loading

0 comments on commit 41e840b

Please sign in to comment.