Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 1 | /* |
| 2 | Mantis VP-1034 driver |
| 3 | |
| 4 | Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com) |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | */ |
| 20 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame^] | 21 | #include <asm/irq.h> |
| 22 | #include <linux/signal.h> |
| 23 | #include <linux/sched.h> |
| 24 | #include <linux/interrupt.h> |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 25 | |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame^] | 26 | #include "dmxdev.h" |
| 27 | #include "dvbdev.h" |
| 28 | #include "dvb_demux.h" |
| 29 | #include "dvb_frontend.h" |
| 30 | #include "dvb_net.h" |
| 31 | |
| 32 | #include "mb86a16.h" |
| 33 | #include "mantis_common.h" |
| 34 | #include "mantis_ioc.h" |
| 35 | #include "mantis_vp1034.h" |
| 36 | #include "mantis_reg.h" |
| 37 | |
| 38 | struct mb86a16_config vp1034_mb86a16_config = { |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 39 | .demod_address = 0x08, |
| 40 | .set_voltage = vp1034_set_voltage, |
| 41 | }; |
| 42 | |
Manu Abraham | df0cca1 | 2009-12-02 22:07:24 -0300 | [diff] [blame] | 43 | #define MANTIS_MODEL_NAME "VP-1034" |
| 44 | #define MANTIS_DEV_TYPE "DVB-S/DSS" |
| 45 | |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 46 | int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
| 47 | { |
| 48 | struct mantis_pci *mantis = fe->dvb->priv; |
| 49 | |
| 50 | switch (voltage) { |
| 51 | case SEC_VOLTAGE_13: |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame^] | 52 | dprintk(MANTIS_ERROR, 1, "Polarization=[13V]"); |
Manu Abraham | 715d341 | 2009-12-03 05:37:51 -0300 | [diff] [blame] | 53 | gpio_set_bits(mantis, 13, 1); |
| 54 | gpio_set_bits(mantis, 14, 0); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 55 | break; |
| 56 | case SEC_VOLTAGE_18: |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame^] | 57 | dprintk(MANTIS_ERROR, 1, "Polarization=[18V]"); |
Manu Abraham | 715d341 | 2009-12-03 05:37:51 -0300 | [diff] [blame] | 58 | gpio_set_bits(mantis, 13, 1); |
| 59 | gpio_set_bits(mantis, 14, 1); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 60 | break; |
| 61 | case SEC_VOLTAGE_OFF: |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame^] | 62 | dprintk(MANTIS_ERROR, 1, "Frontend (dummy) POWERDOWN"); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 63 | break; |
| 64 | default: |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame^] | 65 | dprintk(MANTIS_ERROR, 1, "Invalid = (%d)", (u32 ) voltage); |
Manu Abraham | 41e840b | 2009-12-02 21:57:10 -0300 | [diff] [blame] | 66 | return -EINVAL; |
| 67 | } |
| 68 | mmwrite(0x00, MANTIS_GPIF_DOUT); |
| 69 | |
| 70 | return 0; |
| 71 | } |
Manu Abraham | b3b9614 | 2009-12-04 05:41:11 -0300 | [diff] [blame^] | 72 | |
| 73 | static int vp1034_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) |
| 74 | { |
| 75 | struct i2c_adapter *adapter = &mantis->adapter; |
| 76 | |
| 77 | dprintk(MANTIS_ERROR, 1, "Probing for MB86A16 (DVB-S/DSS)"); |
| 78 | fe = mb86a16_attach(&vp1034_mb86a16_config, adapter); |
| 79 | if (fe) { |
| 80 | dprintk(MANTIS_ERROR, 1, |
| 81 | "found MB86A16 DVB-S/DSS frontend @0x%02x", |
| 82 | vp1034_mb86a16_config.demod_address); |
| 83 | |
| 84 | } else { |
| 85 | return -1; |
| 86 | } |
| 87 | |
| 88 | mantis->fe = fe; |
| 89 | dprintk(MANTIS_ERROR, 1, "Done!"); |
| 90 | |
| 91 | return 0; |
| 92 | } |
| 93 | |
| 94 | struct mantis_hwconfig vp1034_config = { |
| 95 | .model_name = MANTIS_MODEL_NAME, |
| 96 | .dev_type = MANTIS_DEV_TYPE, |
| 97 | .ts_size = MANTIS_TS_204, |
| 98 | |
| 99 | .baud_rate = MANTIS_BAUD_9600, |
| 100 | .parity = MANTIS_PARITY_NONE, |
| 101 | .bytes = 0, |
| 102 | |
| 103 | .frontend_init = vp1034_frontend_init, |
| 104 | }; |