]> Pileus Git - ~andy/linux/blob - drivers/media/dvb/mantis/mantis_vp1034.c
V4L/DVB (13709): [Mantis/VP-1034] Switch 13/18v for the VP-1034 properly
[~andy/linux] / 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 };
36
37 int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
38 {
39         struct mantis_pci *mantis = fe->dvb->priv;
40
41         switch (voltage) {
42         case SEC_VOLTAGE_13:
43                 dprintk(verbose, MANTIS_ERROR, 1, "Polarization=[13V]");
44                 gpio_set_bits(mantis, 13, 1);
45                 gpio_set_bits(mantis, 14, 0);
46                 break;
47         case SEC_VOLTAGE_18:
48                 dprintk(verbose, MANTIS_ERROR, 1, "Polarization=[18V]");
49                 gpio_set_bits(mantis, 13, 1);
50                 gpio_set_bits(mantis, 14, 1);
51                 break;
52         case SEC_VOLTAGE_OFF:
53                 dprintk(verbose, MANTIS_ERROR, 1, "Frontend (dummy) POWERDOWN");
54                 break;
55         default:
56                 dprintk(verbose, MANTIS_ERROR, 1, "Invalid = (%d)", (u32 ) voltage);
57                 return -EINVAL;
58         }
59         mmwrite(0x00, MANTIS_GPIF_DOUT);
60
61         return 0;
62 }