···11+config MANTIS_CORE22+ tristate "Mantis/Hopper PCI bridge based devices"33+ depends on PCI && I2C44+55+ help66+ Support for PCI cards based on the Mantis and Hopper PCi bridge.77+88+ Say Y if you own such a device and want to use it.99+110config DVB_MANTIS211 tristate "MANTIS based cards"33- depends on DVB_CORE && PCI && I2C1212+ depends on MANTIS_CORE && DVB_CORE && PCI && I2C413 select DVB_MB86A16514 select DVB_CU1216615 select DVB_ZL10353···2011 Say Y when you have a Mantis based DVB card and want to use it.21122213 If unsure say N.1414+1515+config DVB_HOPPER1616+ tristate "HOPPER based cards"1717+ depends on MANTIS_CORE && DVB_CORE && PCI && I2C1818+ select DVB_ZL103531919+ select DVB_PLL2020+ help2121+ Support for PCI cards based on the Hopper PCI bridge.2222+ Say Y when you have a Hopper based DVB card and want to use it.2323+2424+ If unsure say N
···11+/*22+ Mantis VP-3028 driver33+44+ Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com)55+66+ This program is free software; you can redistribute it and/or modify77+ it under the terms of the GNU General Public License as published by88+ the Free Software Foundation; either version 2 of the License, or99+ (at your option) any later version.1010+1111+ This program is distributed in the hope that it will be useful,1212+ but WITHOUT ANY WARRANTY; without even the implied warranty of1313+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+ GNU General Public License for more details.1515+1616+ You should have received a copy of the GNU General Public License1717+ along with this program; if not, write to the Free Software1818+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1919+*/2020+2121+#include <asm/irq.h>2222+#include <linux/signal.h>2323+#include <linux/sched.h>2424+#include <linux/interrupt.h>2525+2626+#include "dmxdev.h"2727+#include "dvbdev.h"2828+#include "dvb_demux.h"2929+#include "dvb_frontend.h"3030+#include "dvb_net.h"3131+3232+#include "zl10353.h"3333+#include "mantis_common.h"3434+#include "mantis_ioc.h"3535+#include "mantis_dvb.h"3636+#include "hopper_vp3028.h"3737+3838+struct zl10353_config hopper_vp3028_config = {3939+ .demod_address = 0x0f,4040+};4141+4242+#define MANTIS_MODEL_NAME "VP-3028"4343+#define MANTIS_DEV_TYPE "DVB-T"4444+4545+static int vp3028_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)4646+{4747+ struct i2c_adapter *adapter = &mantis->adapter;4848+ int err = 0;4949+5050+ err = mantis_frontend_power(mantis, POWER_ON);5151+ mantis_frontend_soft_reset(mantis);5252+5353+ dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");5454+ fe = zl10353_attach(&hopper_vp3028_config, adapter);5555+5656+ if (!fe)5757+ return -1;5858+5959+ dprintk(MANTIS_ERROR, 1, "Done!");6060+6161+ return 0;6262+}6363+6464+struct mantis_hwconfig vp3028_config = {6565+ .model_name = MANTIS_MODEL_NAME,6666+ .dev_type = MANTIS_DEV_TYPE,6767+ .ts_size = MANTIS_TS_188,6868+6969+ .baud_rate = MANTIS_BAUD_9600,7070+ .parity = MANTIS_PARITY_NONE,7171+ .bytes = 0,7272+7373+ .frontend_init = vp3028_frontend_init,7474+ .power = GPIF_A00,7575+ .reset = GPIF_A03,7676+};
···11+#ifndef __MANTIS_I2C_H22+#define __MANTIS_I2C_H33+44+extern int mantis_i2c_init(struct mantis_pci *mantis);55+extern int mantis_i2c_exit(struct mantis_pci *mantis);66+77+#endif /* __MANTIS_I2C_H */
+145
drivers/media/dvb/mantis/mantis_ioc.c
···11+/*22+ Mantis PCI bridge driver33+44+ Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com)55+66+ This program is free software; you can redistribute it and/or modify77+ it under the terms of the GNU General Public License as published by88+ the Free Software Foundation; either version 2 of the License, or99+ (at your option) any later version.1010+1111+ This program is distributed in the hope that it will be useful,1212+ but WITHOUT ANY WARRANTY; without even the implied warranty of1313+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+ GNU General Public License for more details.1515+1616+ You should have received a copy of the GNU General Public License1717+ along with this program; if not, write to the Free Software1818+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1919+*/2020+2121+#include <linux/kernel.h>2222+#include <linux/i2c.h>2323+2424+#include <asm/irq.h>2525+#include <linux/signal.h>2626+#include <linux/sched.h>2727+#include <linux/interrupt.h>2828+2929+#include "dmxdev.h"3030+#include "dvbdev.h"3131+#include "dvb_demux.h"3232+#include "dvb_frontend.h"3333+#include "dvb_net.h"3434+3535+#include "mantis_common.h"3636+#include "mantis_reg.h"3737+#include "mantis_ioc.h"3838+3939+static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)4040+{4141+ struct i2c_adapter *adapter = &mantis->adapter;4242+4343+ int err;4444+ struct i2c_msg msg[] = {4545+ { .addr = 0x50, .flags = 0, .buf = data, .len = 1 },4646+ { .addr = 0x50, .flags = I2C_M_RD, .buf = data, .len = length },4747+ };4848+4949+ err = i2c_transfer(adapter, msg, 2);5050+ if (err < 0) {5151+ dprintk(MANTIS_ERROR, 1, "ERROR: i2c read: < err=%i d0=0x%02x d1=0x%02x >",5252+ err, data[0], data[1]);5353+5454+ return err;5555+ }5656+5757+ return 0;5858+}5959+6060+static int write_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)6161+{6262+ struct i2c_adapter *adapter = &mantis->adapter;6363+ int err;6464+6565+ struct i2c_msg msg = { .addr = 0x50, .flags = 0, .buf = data, .len = length };6666+6767+ err = i2c_transfer(adapter, &msg, 1);6868+ if (err < 0) {6969+ dprintk(MANTIS_ERROR, 1, "ERROR: i2c write: < err=%i length=0x%02x d0=0x%02x, d1=0x%02x >",7070+ err, length, data[0], data[1]);7171+7272+ return err;7373+ }7474+7575+ return 0;7676+}7777+7878+int mantis_get_mac(struct mantis_pci *mantis)7979+{8080+ int err;8181+8282+ mantis->mac_address[0] = 0x08;8383+8484+ err = read_eeprom_byte(mantis, &mantis->mac_address[0], 6);8585+ if (err < 0) {8686+ dprintk(MANTIS_ERROR, 1, "ERROR: Mantis EEPROM read error <%d>", err);8787+8888+ return err;8989+ }9090+9191+ dprintk(MANTIS_ERROR, 0,9292+ " MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]\n",9393+ mantis->mac_address[0], mantis->mac_address[1],9494+ mantis->mac_address[2], mantis->mac_address[3],9595+ mantis->mac_address[4], mantis->mac_address[5]);9696+9797+ return 0;9898+}9999+EXPORT_SYMBOL_GPL(mantis_get_mac);100100+101101+/* Turn the given bit on or off. */102102+void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value)103103+{104104+ u32 cur;105105+106106+ cur = mmread(MANTIS_GPIF_ADDR);107107+ if (value)108108+ mantis->gpio_status = cur | (1 << bitpos);109109+ else110110+ mantis->gpio_status = cur & (~(1 << bitpos));111111+112112+ mmwrite(mantis->gpio_status, MANTIS_GPIF_ADDR);113113+ mmwrite(0x00, MANTIS_GPIF_DOUT);114114+}115115+EXPORT_SYMBOL_GPL(gpio_set_bits);116116+117117+int mantis_stream_control(struct mantis_pci *mantis, enum mantis_stream_control stream_ctl)118118+{119119+ u32 reg;120120+121121+ reg = mmread(MANTIS_CONTROL);122122+ switch (stream_ctl) {123123+ case STREAM_TO_HIF:124124+ dprintk(MANTIS_DEBUG, 1, "Set stream to HIF");125125+ reg &= 0xff - MANTIS_BYPASS;126126+ mmwrite(reg, MANTIS_CONTROL);127127+ reg |= MANTIS_BYPASS;128128+ mmwrite(reg, MANTIS_CONTROL);129129+ break;130130+131131+ case STREAM_TO_CAM:132132+ dprintk(MANTIS_DEBUG, 1, "Set stream to CAM");133133+ reg |= MANTIS_BYPASS;134134+ mmwrite(reg, MANTIS_CONTROL);135135+ reg &= 0xff - MANTIS_BYPASS;136136+ mmwrite(reg, MANTIS_CONTROL);137137+ break;138138+ default:139139+ dprintk(MANTIS_ERROR, 1, "Unknown MODE <%02x>", stream_ctl);140140+ return -1;141141+ }142142+143143+ return 0;144144+}145145+EXPORT_SYMBOL_GPL(mantis_stream_control);