diff options
author | Hartmut Hackmann <hartmut.hackmann@t-online.de> | 2008-04-22 13:42:09 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:07:43 -0400 |
commit | 4b1431ca1c98e26569c9b6cd6d06265cef9495ec (patch) | |
tree | 87cb4178c35bfe850d0b38d0a07e5fdcc7cc7817 | |
parent | 26ec394e7c528e6f71e53a1335846328b8453ef5 (diff) |
V4L/DVB (7224): Initial DVB-S support for MD8800 /CTX948
Support is not complete yet and untested.
Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t-online.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/dvb/frontends/isl6405.c | 164 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/isl6405.h | 74 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-dvb.c | 18 |
3 files changed, 255 insertions, 1 deletions
diff --git a/drivers/media/dvb/frontends/isl6405.c b/drivers/media/dvb/frontends/isl6405.c new file mode 100644 index 000000000000..33d33f4d8867 --- /dev/null +++ b/drivers/media/dvb/frontends/isl6405.c | |||
@@ -0,0 +1,164 @@ | |||
1 | /* | ||
2 | * isl6405.c - driver for dual lnb supply and control ic ISL6405 | ||
3 | * | ||
4 | * Copyright (C) 2008 Hartmut Hackmann | ||
5 | * Copyright (C) 2006 Oliver Endriss | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
22 | * Or, point your browser to http://www.gnu.org/copyleft/gpl.html | ||
23 | * | ||
24 | * | ||
25 | * the project's page is at http://www.linuxtv.org | ||
26 | */ | ||
27 | #include <linux/delay.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <linux/init.h> | ||
30 | #include <linux/kernel.h> | ||
31 | #include <linux/module.h> | ||
32 | #include <linux/string.h> | ||
33 | #include <linux/slab.h> | ||
34 | |||
35 | #include "dvb_frontend.h" | ||
36 | #include "isl6405.h" | ||
37 | |||
38 | struct isl6405 { | ||
39 | u8 config; | ||
40 | u8 override_or; | ||
41 | u8 override_and; | ||
42 | struct i2c_adapter *i2c; | ||
43 | u8 i2c_addr; | ||
44 | }; | ||
45 | |||
46 | static int isl6405_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | ||
47 | { | ||
48 | struct isl6405 *isl6405 = (struct isl6405 *) fe->sec_priv; | ||
49 | struct i2c_msg msg = { .addr = isl6405->i2c_addr, .flags = 0, | ||
50 | .buf = &isl6405->config, | ||
51 | .len = sizeof(isl6405->config) }; | ||
52 | |||
53 | if (isl6405->override_or & 0x80) { | ||
54 | isl6405->config &= ~(ISL6405_VSEL2 | ISL6405_EN2); | ||
55 | switch (voltage) { | ||
56 | case SEC_VOLTAGE_OFF: | ||
57 | break; | ||
58 | case SEC_VOLTAGE_13: | ||
59 | isl6405->config |= ISL6405_EN2; | ||
60 | break; | ||
61 | case SEC_VOLTAGE_18: | ||
62 | isl6405->config |= (ISL6405_EN2 | ISL6405_VSEL2); | ||
63 | break; | ||
64 | default: | ||
65 | return -EINVAL; | ||
66 | } | ||
67 | } else { | ||
68 | isl6405->config &= ~(ISL6405_VSEL1 | ISL6405_EN1); | ||
69 | switch (voltage) { | ||
70 | case SEC_VOLTAGE_OFF: | ||
71 | break; | ||
72 | case SEC_VOLTAGE_13: | ||
73 | isl6405->config |= ISL6405_EN1; | ||
74 | break; | ||
75 | case SEC_VOLTAGE_18: | ||
76 | isl6405->config |= (ISL6405_EN1 | ISL6405_VSEL1); | ||
77 | break; | ||
78 | default: | ||
79 | return -EINVAL; | ||
80 | }; | ||
81 | } | ||
82 | isl6405->config |= isl6405->override_or; | ||
83 | isl6405->config &= isl6405->override_and; | ||
84 | |||
85 | return (i2c_transfer(isl6405->i2c, &msg, 1) == 1) ? 0 : -EIO; | ||
86 | } | ||
87 | |||
88 | static int isl6405_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) | ||
89 | { | ||
90 | struct isl6405 *isl6405 = (struct isl6405 *) fe->sec_priv; | ||
91 | struct i2c_msg msg = { .addr = isl6405->i2c_addr, .flags = 0, | ||
92 | .buf = &isl6405->config, | ||
93 | .len = sizeof(isl6405->config) }; | ||
94 | |||
95 | if (isl6405->override_or & 0x80) { | ||
96 | if (arg) | ||
97 | isl6405->config |= ISL6405_LLC2; | ||
98 | else | ||
99 | isl6405->config &= ~ISL6405_LLC2; | ||
100 | } else { | ||
101 | if (arg) | ||
102 | isl6405->config |= ISL6405_LLC1; | ||
103 | else | ||
104 | isl6405->config &= ~ISL6405_LLC1; | ||
105 | } | ||
106 | isl6405->config |= isl6405->override_or; | ||
107 | isl6405->config &= isl6405->override_and; | ||
108 | |||
109 | return (i2c_transfer(isl6405->i2c, &msg, 1) == 1) ? 0 : -EIO; | ||
110 | } | ||
111 | |||
112 | static void isl6405_release(struct dvb_frontend *fe) | ||
113 | { | ||
114 | /* power off */ | ||
115 | isl6405_set_voltage(fe, SEC_VOLTAGE_OFF); | ||
116 | |||
117 | /* free */ | ||
118 | kfree(fe->sec_priv); | ||
119 | fe->sec_priv = NULL; | ||
120 | } | ||
121 | |||
122 | struct dvb_frontend *isl6405_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, | ||
123 | u8 i2c_addr, u8 override_set, u8 override_clear) | ||
124 | { | ||
125 | struct isl6405 *isl6405 = kmalloc(sizeof(struct isl6405), GFP_KERNEL); | ||
126 | if (!isl6405) | ||
127 | return NULL; | ||
128 | |||
129 | /* default configuration */ | ||
130 | if (override_set & 0x80) | ||
131 | isl6405->config = ISL6405_ISEL2; | ||
132 | else | ||
133 | isl6405->config = ISL6405_ISEL1; | ||
134 | isl6405->i2c = i2c; | ||
135 | isl6405->i2c_addr = i2c_addr; | ||
136 | fe->sec_priv = isl6405; | ||
137 | |||
138 | /* bits which should be forced to '1' */ | ||
139 | isl6405->override_or = override_set; | ||
140 | |||
141 | /* bits which should be forced to '0' */ | ||
142 | isl6405->override_and = ~override_clear; | ||
143 | |||
144 | /* detect if it is present or not */ | ||
145 | if (isl6405_set_voltage(fe, SEC_VOLTAGE_OFF)) { | ||
146 | kfree(isl6405); | ||
147 | fe->sec_priv = NULL; | ||
148 | return NULL; | ||
149 | } | ||
150 | |||
151 | /* install release callback */ | ||
152 | fe->ops.release_sec = isl6405_release; | ||
153 | |||
154 | /* override frontend ops */ | ||
155 | fe->ops.set_voltage = isl6405_set_voltage; | ||
156 | fe->ops.enable_high_lnb_voltage = isl6405_enable_high_lnb_voltage; | ||
157 | |||
158 | return fe; | ||
159 | } | ||
160 | EXPORT_SYMBOL(isl6405_attach); | ||
161 | |||
162 | MODULE_DESCRIPTION("Driver for lnb supply and control ic isl6405"); | ||
163 | MODULE_AUTHOR("Hartmut Hackmann & Oliver Endriss"); | ||
164 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/frontends/isl6405.h b/drivers/media/dvb/frontends/isl6405.h new file mode 100644 index 000000000000..9d4001a2237e --- /dev/null +++ b/drivers/media/dvb/frontends/isl6405.h | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * isl6405.h - driver for dual lnb supply and control ic ISL6405 | ||
3 | * | ||
4 | * Copyright (C) 2008 Hartmut Hackmann | ||
5 | * Copyright (C) 2006 Oliver Endriss | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
22 | * Or, point your browser to http://www.gnu.org/copyleft/gpl.html | ||
23 | * | ||
24 | * | ||
25 | * the project's page is at http://www.linuxtv.org | ||
26 | */ | ||
27 | |||
28 | #ifndef _ISL6405_H | ||
29 | #define _ISL6405_H | ||
30 | |||
31 | #include <linux/dvb/frontend.h> | ||
32 | |||
33 | /* system register bits */ | ||
34 | |||
35 | /* this bit selects register (control) 1 or 2 | ||
36 | note that the bit maps are different */ | ||
37 | |||
38 | #define ISL6405_SR 0x80 | ||
39 | |||
40 | /* SR = 0 */ | ||
41 | #define ISL6405_OLF1 0x01 | ||
42 | #define ISL6405_EN1 0x02 | ||
43 | #define ISL6405_VSEL1 0x04 | ||
44 | #define ISL6405_LLC1 0x08 | ||
45 | #define ISL6405_ENT1 0x10 | ||
46 | #define ISL6405_ISEL1 0x20 | ||
47 | #define ISL6405_DCL 0x40 | ||
48 | |||
49 | /* SR = 1 */ | ||
50 | #define ISL6405_OLF2 0x01 | ||
51 | #define ISL6405_OTF 0x02 | ||
52 | #define ISL6405_EN2 0x04 | ||
53 | #define ISL6405_VSEL2 0x08 | ||
54 | #define ISL6405_LLC2 0x10 | ||
55 | #define ISL6405_ENT2 0x20 | ||
56 | #define ISL6405_ISEL2 0x40 | ||
57 | |||
58 | #if defined(CONFIG_DVB_ISL6405) || (defined(CONFIG_DVB_ISL6405_MODULE) && defined(MODULE)) | ||
59 | /* override_set and override_clear control which system register bits (above) | ||
60 | * to always set & clear | ||
61 | */ | ||
62 | extern struct dvb_frontend *isl6405_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, | ||
63 | u8 i2c_addr, u8 override_set, u8 override_clear); | ||
64 | #else | ||
65 | static inline struct dvb_frontend *isl6405_attach(struct dvb_frontend *fe, | ||
66 | struct i2c_adapter *i2c, u8 i2c_addr, | ||
67 | u8 override_set, u8 override_clear) | ||
68 | { | ||
69 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | ||
70 | return NULL; | ||
71 | } | ||
72 | #endif /* CONFIG_DVB_ISL6405 */ | ||
73 | |||
74 | #endif | ||
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 9d61d74fabd4..72fd9fed8a34 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include "tda826x.h" | 43 | #include "tda826x.h" |
44 | #include "tda827x.h" | 44 | #include "tda827x.h" |
45 | #include "isl6421.h" | 45 | #include "isl6421.h" |
46 | #include "isl6405.h" | ||
46 | 47 | ||
47 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); | 48 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
48 | MODULE_LICENSE("GPL"); | 49 | MODULE_LICENSE("GPL"); |
@@ -990,7 +991,22 @@ static int dvb_init(struct saa7134_dev *dev) | |||
990 | configure_tda827x_fe(dev, &tevion_dvbt220rf_config); | 991 | configure_tda827x_fe(dev, &tevion_dvbt220rf_config); |
991 | break; | 992 | break; |
992 | case SAA7134_BOARD_MEDION_MD8800_QUADRO: | 993 | case SAA7134_BOARD_MEDION_MD8800_QUADRO: |
993 | configure_tda827x_fe(dev, &md8800_dvbt_config); | 994 | if (!use_frontend) { /* terrestrial */ |
995 | configure_tda827x_fe(dev, &md8800_dvbt_config); | ||
996 | } else { /* satellite */ | ||
997 | dev->dvb.frontend = dvb_attach(tda10086_attach, | ||
998 | &flydvbs, &dev->i2c_adap); | ||
999 | if (dev->dvb.frontend) { | ||
1000 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, | ||
1001 | 0x60, &dev->i2c_adap, 0) == NULL) | ||
1002 | wprintk("%s: Medion Quadro, no tda826x " | ||
1003 | "found !\n", __FUNCTION__); | ||
1004 | if (dvb_attach(isl6405_attach, dev->dvb.frontend, | ||
1005 | &dev->i2c_adap, 0x08, 0, 0) == NULL) | ||
1006 | wprintk("%s: Medion Quadro, no ISL6405 " | ||
1007 | "found !\n", __FUNCTION__); | ||
1008 | } | ||
1009 | } | ||
994 | break; | 1010 | break; |
995 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: | 1011 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: |
996 | dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, | 1012 | dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, |