28f3420b231233c284954a36f08301017af5f5ee
[safe/jmp/linux-2.6] / drivers / media / dvb / mantis / mantis_vp1034.c
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
21 #include "mantis_common.h"
22 #include "mantis_vp1034.h"
23
24 struct mb86a16_config vp1034_config = {
25         .demod_address  = 0x08,
26         .set_voltage    = vp1034_set_voltage,
27 };
28
29 #define MANTIS_MODEL_NAME       "VP-1034"
30 #define MANTIS_DEV_TYPE         "DVB-S/DSS"
31
32 struct mantis_hwconfig vp1034_mantis_config = {
33         .model_name     = MANTIS_MODEL_NAME,
34         .dev_type       = MANTIS_DEV_TYPE,
35         .ts_size        = MANTIS_TS_204,
36         .baud_rate      = MANTIS_BAUD_9600,
37         .parity         = MANTIS_PARITY_NONE,
38         .bytes          = 0,
39 };
40
41 int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
42 {
43         struct mantis_pci *mantis = fe->dvb->priv;
44
45         switch (voltage) {
46         case SEC_VOLTAGE_13:
47                 dprintk(verbose, MANTIS_ERROR, 1, "Polarization=[13V]");
48                 gpio_set_bits(mantis, 13, 1);
49                 gpio_set_bits(mantis, 14, 0);
50                 break;
51         case SEC_VOLTAGE_18:
52                 dprintk(verbose, MANTIS_ERROR, 1, "Polarization=[18V]");
53                 gpio_set_bits(mantis, 13, 1);
54                 gpio_set_bits(mantis, 14, 1);
55                 break;
56         case SEC_VOLTAGE_OFF:
57                 dprintk(verbose, MANTIS_ERROR, 1, "Frontend (dummy) POWERDOWN");
58                 break;
59         default:
60                 dprintk(verbose, MANTIS_ERROR, 1, "Invalid = (%d)", (u32 ) voltage);
61                 return -EINVAL;
62         }
63         mmwrite(0x00, MANTIS_GPIF_DOUT);
64
65         return 0;
66 }