Path: blob/master/drivers/media/dvb/mantis/mantis_vp1034.c
15112 views
/*1Mantis VP-1034 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#include <linux/signal.h>21#include <linux/sched.h>22#include <linux/interrupt.h>2324#include "dmxdev.h"25#include "dvbdev.h"26#include "dvb_demux.h"27#include "dvb_frontend.h"28#include "dvb_net.h"2930#include "mb86a16.h"31#include "mantis_common.h"32#include "mantis_ioc.h"33#include "mantis_dvb.h"34#include "mantis_vp1034.h"35#include "mantis_reg.h"3637struct mb86a16_config vp1034_mb86a16_config = {38.demod_address = 0x08,39.set_voltage = vp1034_set_voltage,40};4142#define MANTIS_MODEL_NAME "VP-1034"43#define MANTIS_DEV_TYPE "DVB-S/DSS"4445int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)46{47struct mantis_pci *mantis = fe->dvb->priv;4849switch (voltage) {50case SEC_VOLTAGE_13:51dprintk(MANTIS_ERROR, 1, "Polarization=[13V]");52mantis_gpio_set_bits(mantis, 13, 1);53mantis_gpio_set_bits(mantis, 14, 0);54break;55case SEC_VOLTAGE_18:56dprintk(MANTIS_ERROR, 1, "Polarization=[18V]");57mantis_gpio_set_bits(mantis, 13, 1);58mantis_gpio_set_bits(mantis, 14, 1);59break;60case SEC_VOLTAGE_OFF:61dprintk(MANTIS_ERROR, 1, "Frontend (dummy) POWERDOWN");62break;63default:64dprintk(MANTIS_ERROR, 1, "Invalid = (%d)", (u32) voltage);65return -EINVAL;66}67mmwrite(0x00, MANTIS_GPIF_DOUT);6869return 0;70}7172static int vp1034_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)73{74struct i2c_adapter *adapter = &mantis->adapter;7576int err = 0;7778err = mantis_frontend_power(mantis, POWER_ON);79if (err == 0) {80mantis_frontend_soft_reset(mantis);81msleep(250);8283dprintk(MANTIS_ERROR, 1, "Probing for MB86A16 (DVB-S/DSS)");84fe = dvb_attach(mb86a16_attach, &vp1034_mb86a16_config, adapter);85if (fe) {86dprintk(MANTIS_ERROR, 1,87"found MB86A16 DVB-S/DSS frontend @0x%02x",88vp1034_mb86a16_config.demod_address);8990} else {91return -1;92}93} else {94dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",95adapter->name,96err);9798return -EIO;99}100mantis->fe = fe;101dprintk(MANTIS_ERROR, 1, "Done!");102103return 0;104}105106struct mantis_hwconfig vp1034_config = {107.model_name = MANTIS_MODEL_NAME,108.dev_type = MANTIS_DEV_TYPE,109.ts_size = MANTIS_TS_204,110111.baud_rate = MANTIS_BAUD_9600,112.parity = MANTIS_PARITY_NONE,113.bytes = 0,114115.frontend_init = vp1034_frontend_init,116.power = GPIF_A12,117.reset = GPIF_A13,118};119120121