aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/dvb/frontends/Kconfig4
-rw-r--r--drivers/media/dvb/frontends/lnbh24.h55
-rw-r--r--drivers/media/dvb/frontends/lnbp21.c41
-rw-r--r--drivers/media/dvb/frontends/lnbp21.h50
4 files changed, 126 insertions, 24 deletions
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index 649ac75aaefa..d3cfced2ce23 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -453,11 +453,11 @@ comment "SEC control devices for DVB-S"
453 depends on DVB_CORE 453 depends on DVB_CORE
454 454
455config DVB_LNBP21 455config DVB_LNBP21
456 tristate "LNBP21 SEC controller" 456 tristate "LNBP21/LNBH24 SEC controllers"
457 depends on DVB_CORE && I2C 457 depends on DVB_CORE && I2C
458 default m if DVB_FE_CUSTOMISE 458 default m if DVB_FE_CUSTOMISE
459 help 459 help
460 An SEC control chip. 460 An SEC control chips.
461 461
462config DVB_ISL6405 462config DVB_ISL6405
463 tristate "ISL6405 SEC controller" 463 tristate "ISL6405 SEC controller"
diff --git a/drivers/media/dvb/frontends/lnbh24.h b/drivers/media/dvb/frontends/lnbh24.h
new file mode 100644
index 000000000000..c059b165318f
--- /dev/null
+++ b/drivers/media/dvb/frontends/lnbh24.h
@@ -0,0 +1,55 @@
1/*
2 * lnbh24.h - driver for lnb supply and control ic lnbh24
3 *
4 * Copyright (C) 2009 NetUP Inc.
5 * Copyright (C) 2009 Igor M. Liplianin <liplianin@netup.ru>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 *
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef _LNBH24_H
24#define _LNBH24_H
25
26/* system register bits */
27#define LNBH24_OLF 0x01
28#define LNBH24_OTF 0x02
29#define LNBH24_EN 0x04
30#define LNBH24_VSEL 0x08
31#define LNBH24_LLC 0x10
32#define LNBH24_TEN 0x20
33#define LNBH24_TTX 0x40
34#define LNBH24_PCL 0x80
35
36#include <linux/dvb/frontend.h>
37
38#if defined(CONFIG_DVB_LNBP21) || (defined(CONFIG_DVB_LNBP21_MODULE) \
39 && defined(MODULE))
40/* override_set and override_clear control which
41 system register bits (above) to always set & clear */
42extern struct dvb_frontend *lnbh24_attach(struct dvb_frontend *fe,
43 struct i2c_adapter *i2c, u8 override_set,
44 u8 override_clear, u8 i2c_addr);
45#else
46static inline struct dvb_frontend *lnbh24_attach(struct dvb_frontend *fe,
47 struct i2c_adapter *i2c, u8 override_set,
48 u8 override_clear, u8 i2c_addr)
49{
50 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
51 return NULL;
52}
53#endif
54
55#endif
diff --git a/drivers/media/dvb/frontends/lnbp21.c b/drivers/media/dvb/frontends/lnbp21.c
index 76f935d9755a..772a0bbb0dd8 100644
--- a/drivers/media/dvb/frontends/lnbp21.c
+++ b/drivers/media/dvb/frontends/lnbp21.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * lnbp21.h - driver for lnb supply and control ic lnbp21 2 * lnbp21.c - driver for lnb supply and control ic lnbp21
3 * 3 *
4 * Copyright (C) 2006 Oliver Endriss 4 * Copyright (C) 2006 Oliver Endriss
5 * Copyright (C) 2009 Igor M. Liplianin <liplianin@netup.ru>
5 * 6 *
6 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
@@ -33,18 +34,21 @@
33 34
34#include "dvb_frontend.h" 35#include "dvb_frontend.h"
35#include "lnbp21.h" 36#include "lnbp21.h"
37#include "lnbh24.h"
36 38
37struct lnbp21 { 39struct lnbp21 {
38 u8 config; 40 u8 config;
39 u8 override_or; 41 u8 override_or;
40 u8 override_and; 42 u8 override_and;
41 struct i2c_adapter *i2c; 43 struct i2c_adapter *i2c;
44 u8 i2c_addr;
42}; 45};
43 46
44static int lnbp21_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) 47static int lnbp21_set_voltage(struct dvb_frontend *fe,
48 fe_sec_voltage_t voltage)
45{ 49{
46 struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->sec_priv; 50 struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->sec_priv;
47 struct i2c_msg msg = { .addr = 0x08, .flags = 0, 51 struct i2c_msg msg = { .addr = lnbp21->i2c_addr, .flags = 0,
48 .buf = &lnbp21->config, 52 .buf = &lnbp21->config,
49 .len = sizeof(lnbp21->config) }; 53 .len = sizeof(lnbp21->config) };
50 54
@@ -72,7 +76,7 @@ static int lnbp21_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
72static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) 76static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
73{ 77{
74 struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->sec_priv; 78 struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->sec_priv;
75 struct i2c_msg msg = { .addr = 0x08, .flags = 0, 79 struct i2c_msg msg = { .addr = lnbp21->i2c_addr, .flags = 0,
76 .buf = &lnbp21->config, 80 .buf = &lnbp21->config,
77 .len = sizeof(lnbp21->config) }; 81 .len = sizeof(lnbp21->config) };
78 82
@@ -97,15 +101,18 @@ static void lnbp21_release(struct dvb_frontend *fe)
97 fe->sec_priv = NULL; 101 fe->sec_priv = NULL;
98} 102}
99 103
100struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear) 104static struct dvb_frontend *lnbx2x_attach(struct dvb_frontend *fe,
105 struct i2c_adapter *i2c, u8 override_set,
106 u8 override_clear, u8 i2c_addr, u8 config)
101{ 107{
102 struct lnbp21 *lnbp21 = kmalloc(sizeof(struct lnbp21), GFP_KERNEL); 108 struct lnbp21 *lnbp21 = kmalloc(sizeof(struct lnbp21), GFP_KERNEL);
103 if (!lnbp21) 109 if (!lnbp21)
104 return NULL; 110 return NULL;
105 111
106 /* default configuration */ 112 /* default configuration */
107 lnbp21->config = LNBP21_ISEL; 113 lnbp21->config = config;
108 lnbp21->i2c = i2c; 114 lnbp21->i2c = i2c;
115 lnbp21->i2c_addr = i2c_addr;
109 fe->sec_priv = lnbp21; 116 fe->sec_priv = lnbp21;
110 117
111 /* bits which should be forced to '1' */ 118 /* bits which should be forced to '1' */
@@ -126,11 +133,29 @@ struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *
126 /* override frontend ops */ 133 /* override frontend ops */
127 fe->ops.set_voltage = lnbp21_set_voltage; 134 fe->ops.set_voltage = lnbp21_set_voltage;
128 fe->ops.enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; 135 fe->ops.enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage;
136 printk(KERN_INFO "LNBx2x attached on addr=%x", lnbp21->i2c_addr);
129 137
130 return fe; 138 return fe;
131} 139}
140
141struct dvb_frontend *lnbp24_attach(struct dvb_frontend *fe,
142 struct i2c_adapter *i2c, u8 override_set,
143 u8 override_clear, u8 i2c_addr)
144{
145 return lnbx2x_attach(fe, i2c, override_set, override_clear,
146 i2c_addr, LNBH24_TTX);
147}
148EXPORT_SYMBOL(lnbh24_attach);
149
150struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe,
151 struct i2c_adapter *i2c, u8 override_set,
152 u8 override_clear)
153{
154 return lnbx2x_attach(fe, i2c, override_set, override_clear,
155 0x08, LNBP21_ISEL);
156}
132EXPORT_SYMBOL(lnbp21_attach); 157EXPORT_SYMBOL(lnbp21_attach);
133 158
134MODULE_DESCRIPTION("Driver for lnb supply and control ic lnbp21"); 159MODULE_DESCRIPTION("Driver for lnb supply and control ic lnbp21, lnbh24");
135MODULE_AUTHOR("Oliver Endriss"); 160MODULE_AUTHOR("Oliver Endriss, Igor M. Liplianin");
136MODULE_LICENSE("GPL"); 161MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/frontends/lnbp21.h b/drivers/media/dvb/frontends/lnbp21.h
index b8745887492c..fcdf1c650dde 100644
--- a/drivers/media/dvb/frontends/lnbp21.h
+++ b/drivers/media/dvb/frontends/lnbp21.h
@@ -28,26 +28,48 @@
28#define _LNBP21_H 28#define _LNBP21_H
29 29
30/* system register bits */ 30/* system register bits */
31#define LNBP21_OLF 0x01 /* [R-only] 0=OK; 1=over current limit flag*/ 31/* [RO] 0=OK; 1=over current limit flag */
32#define LNBP21_OTF 0x02 /* [R-only] 0=OK; 1=over temperature flag (150degC typ) */ 32#define LNBP21_OLF 0x01
33#define LNBP21_EN 0x04 /* [RW] 0=disable LNB power, enable loopthrough; 1=enable LNB power, disable loopthrough*/ 33/* [RO] 0=OK; 1=over temperature flag (150 C) */
34#define LNBP21_VSEL 0x08 /* [RW] 0=low voltage (13/14V, vert pol); 1=high voltage (18/19V,horiz pol) */ 34#define LNBP21_OTF 0x02
35#define LNBP21_LLC 0x10 /* [RW] increase LNB voltage by 1V: 0=13/18V; 1=14/19V */ 35/* [RW] 0=disable LNB power, enable loopthrough
36#define LNBP21_TEN 0x20 /* [RW] 0=tone controlled by DSQIN pin; 1=tone enable, disable DSQIN */ 36 1=enable LNB power, disable loopthrough */
37#define LNBP21_ISEL 0x40 /* [RW] current limit select 0:Iout=500-650mA,Isc=300mA ; 1:Iout=400-550mA,Isc=200mA*/ 37#define LNBP21_EN 0x04
38#define LNBP21_PCL 0x80 /* [RW] short-circuit prot: 0=pulsed (dynamic) curr limiting; 1=static curr limiting*/ 38/* [RW] 0=low voltage (13/14V, vert pol)
39 1=high voltage (18/19V,horiz pol) */
40#define LNBP21_VSEL 0x08
41/* [RW] increase LNB voltage by 1V:
42 0=13/18V; 1=14/19V */
43#define LNBP21_LLC 0x10
44/* [RW] 0=tone controlled by DSQIN pin
45 1=tone enable, disable DSQIN */
46#define LNBP21_TEN 0x20
47/* [RW] current limit select:
48 0:Iout=500-650mA Isc=300mA
49 1:Iout=400-550mA Isc=200mA */
50#define LNBP21_ISEL 0x40
51/* [RW] short-circuit protect:
52 0=pulsed (dynamic) curr limiting
53 1=static curr limiting */
54#define LNBP21_PCL 0x80
39 55
40#include <linux/dvb/frontend.h> 56#include <linux/dvb/frontend.h>
41 57
42#if defined(CONFIG_DVB_LNBP21) || (defined(CONFIG_DVB_LNBP21_MODULE) && defined(MODULE)) 58#if defined(CONFIG_DVB_LNBP21) || (defined(CONFIG_DVB_LNBP21_MODULE) \
43/* override_set and override_clear control which system register bits (above) to always set & clear */ 59 && defined(MODULE))
44extern struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear); 60/* override_set and override_clear control which
61 system register bits (above) to always set & clear */
62extern struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe,
63 struct i2c_adapter *i2c, u8 override_set,
64 u8 override_clear);
45#else 65#else
46static inline struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear) 66static inline struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe,
67 struct i2c_adapter *i2c, u8 override_set,
68 u8 override_clear)
47{ 69{
48 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 70 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
49 return NULL; 71 return NULL;
50} 72}
51#endif // CONFIG_DVB_LNBP21 73#endif
52 74
53#endif // _LNBP21_H 75#endif