V4L/DVB (13725): [Mantis/VP-1041] Revert to old register initialization parameters...
[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 };
37
38 int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
39 {
40         struct mantis_pci *mantis = fe->dvb->priv;
41
42         switch (voltage) {
43         case SEC_VOLTAGE_13:
44                 dprintk(verbose, MANTIS_ERROR, 1, "Polarization=[13V]");
45                 gpio_set_bits(mantis, 13, 1);
46                 gpio_set_bits(mantis, 14, 0);
47                 break;
48         case SEC_VOLTAGE_18:
49                 dprintk(verbose, MANTIS_ERROR, 1, "Polarization=[18V]");
50                 gpio_set_bits(mantis, 13, 1);
51                 gpio_set_bits(mantis, 14, 1);
52                 break;
53         case SEC_VOLTAGE_OFF:
54                 dprintk(verbose, MANTIS_ERROR, 1, "Frontend (dummy) POWERDOWN");
55                 break;
56         default:
57                 dprintk(verbose, MANTIS_ERROR, 1, "Invalid = (%d)", (u32 ) voltage);
58                 return -EINVAL;
59         }
60         mmwrite(0x00, MANTIS_GPIF_DOUT);
61
62         return 0;
63 }