aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/lnbp21.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/lnbp21.c')
-rw-r--r--drivers/media/dvb/frontends/lnbp21.c41
1 files changed, 33 insertions, 8 deletions
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");