diff options
author | Olivier Grenie <olivier.grenie@dibcom.fr> | 2009-09-18 03:08:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:40:03 -0500 |
commit | f8731f4ddedb78693ae05e40aac5c4817f740518 (patch) | |
tree | 56100674dd3a1c2935ca234fd8086f24322ab163 /drivers/media/dvb/frontends | |
parent | 8171c2059cc4b0507faf3a0e0fdf28cc83d8ac62 (diff) |
V4L/DVB (13049): dib8000: SNR in 10th of dB
dib7000p/dib8000: added pid filtering
dib8000: the SNR is in 10th of dB (not in dB)
dib7000p and dib8000: added the pid filtering. This feature is enabled by module option (dvb-usb module).
Signed-off-by: Olivier Grenie <olivier.grenie@dibcom.fr>
Signed-off-by: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r-- | drivers/media/dvb/frontends/dib7000p.c | 18 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dib7000p.h | 13 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dib8000.c | 21 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dib8000.h | 14 |
4 files changed, 65 insertions, 1 deletions
diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c index 0781f94e05d2..60e1aaaec5b3 100644 --- a/drivers/media/dvb/frontends/dib7000p.c +++ b/drivers/media/dvb/frontends/dib7000p.c | |||
@@ -1302,6 +1302,24 @@ struct i2c_adapter * dib7000p_get_i2c_master(struct dvb_frontend *demod, enum di | |||
1302 | } | 1302 | } |
1303 | EXPORT_SYMBOL(dib7000p_get_i2c_master); | 1303 | EXPORT_SYMBOL(dib7000p_get_i2c_master); |
1304 | 1304 | ||
1305 | int dib7000p_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff) | ||
1306 | { | ||
1307 | struct dib7000p_state *state = fe->demodulator_priv; | ||
1308 | u16 val = dib7000p_read_word(state, 235) & 0xffef; | ||
1309 | val |= (onoff & 0x1) << 4; | ||
1310 | dprintk("PID filter enabled %d", onoff); | ||
1311 | return dib7000p_write_word(state, 235, val); | ||
1312 | } | ||
1313 | EXPORT_SYMBOL(dib7000p_pid_filter_ctrl); | ||
1314 | |||
1315 | int dib7000p_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff) | ||
1316 | { | ||
1317 | struct dib7000p_state *state = fe->demodulator_priv; | ||
1318 | dprintk("PID filter: index %x, PID %d, OnOff %d", id, pid, onoff); | ||
1319 | return dib7000p_write_word(state, 241 + id, onoff ? (1 << 13) | pid : 0); | ||
1320 | } | ||
1321 | EXPORT_SYMBOL(dib7000p_pid_filter); | ||
1322 | |||
1305 | int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]) | 1323 | int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]) |
1306 | { | 1324 | { |
1307 | struct dib7000p_state st = { .i2c_adap = i2c }; | 1325 | struct dib7000p_state st = { .i2c_adap = i2c }; |
diff --git a/drivers/media/dvb/frontends/dib7000p.h b/drivers/media/dvb/frontends/dib7000p.h index 02a4c82f0c70..3a769df3c86f 100644 --- a/drivers/media/dvb/frontends/dib7000p.h +++ b/drivers/media/dvb/frontends/dib7000p.h | |||
@@ -51,6 +51,8 @@ extern int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, | |||
51 | extern int dib7000p_set_gpio(struct dvb_frontend *, u8 num, u8 dir, u8 val); | 51 | extern int dib7000p_set_gpio(struct dvb_frontend *, u8 num, u8 dir, u8 val); |
52 | extern int dib7000p_set_wbd_ref(struct dvb_frontend *, u16 value); | 52 | extern int dib7000p_set_wbd_ref(struct dvb_frontend *, u16 value); |
53 | extern int dib7000pc_detection(struct i2c_adapter *i2c_adap); | 53 | extern int dib7000pc_detection(struct i2c_adapter *i2c_adap); |
54 | extern int dib7000p_pid_filter(struct dvb_frontend *, u8 id, u16 pid, u8 onoff); | ||
55 | extern int dib7000p_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff); | ||
54 | #else | 56 | #else |
55 | static inline | 57 | static inline |
56 | struct dvb_frontend *dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, | 58 | struct dvb_frontend *dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, |
@@ -95,6 +97,17 @@ static inline int dib7000pc_detection(struct i2c_adapter *i2c_adap) | |||
95 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | 97 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
96 | return -ENODEV; | 98 | return -ENODEV; |
97 | } | 99 | } |
100 | static inline int dib7000p_pid_filter(struct dvb_frontend *, u8 id, u16 pid, u8 onoff) | ||
101 | { | ||
102 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
103 | return -ENODEV; | ||
104 | } | ||
105 | |||
106 | static inline int dib7000p_pid_filter_ctrl(struct dvb_frontend *fe, uint8_t onoff) | ||
107 | { | ||
108 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
109 | return -ENODEV; | ||
110 | } | ||
98 | #endif | 111 | #endif |
99 | 112 | ||
100 | #endif | 113 | #endif |
diff --git a/drivers/media/dvb/frontends/dib8000.c b/drivers/media/dvb/frontends/dib8000.c index 852c790d09d9..44c2dc9b4f11 100644 --- a/drivers/media/dvb/frontends/dib8000.c +++ b/drivers/media/dvb/frontends/dib8000.c | |||
@@ -2121,7 +2121,7 @@ static int dib8000_read_snr(struct dvb_frontend *fe, u16 * snr) | |||
2121 | else | 2121 | else |
2122 | result -= intlog10(2) * 10 * noise_exp - 100; | 2122 | result -= intlog10(2) * 10 * noise_exp - 100; |
2123 | 2123 | ||
2124 | *snr = result / (1 << 24); | 2124 | *snr = result / ((1 << 24) / 10); |
2125 | return 0; | 2125 | return 0; |
2126 | } | 2126 | } |
2127 | 2127 | ||
@@ -2195,6 +2195,25 @@ struct i2c_adapter *dib8000_get_i2c_master(struct dvb_frontend *fe, enum dibx000 | |||
2195 | 2195 | ||
2196 | EXPORT_SYMBOL(dib8000_get_i2c_master); | 2196 | EXPORT_SYMBOL(dib8000_get_i2c_master); |
2197 | 2197 | ||
2198 | int dib8000_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff) | ||
2199 | { | ||
2200 | struct dib8000_state *st = fe->demodulator_priv; | ||
2201 | u16 val = dib8000_read_word(st, 299) & 0xffef; | ||
2202 | val |= (onoff & 0x1) << 4; | ||
2203 | |||
2204 | dprintk("pid filter enabled %d", onoff); | ||
2205 | return dib8000_write_word(st, 299, val); | ||
2206 | } | ||
2207 | EXPORT_SYMBOL(dib8000_pid_filter_ctrl); | ||
2208 | |||
2209 | int dib8000_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff) | ||
2210 | { | ||
2211 | struct dib8000_state *st = fe->demodulator_priv; | ||
2212 | dprintk("Index %x, PID %d, OnOff %d", id, pid, onoff); | ||
2213 | return dib8000_write_word(st, 305 + id, onoff ? (1 << 13) | pid : 0); | ||
2214 | } | ||
2215 | EXPORT_SYMBOL(dib8000_pid_filter); | ||
2216 | |||
2198 | static const struct dvb_frontend_ops dib8000_ops = { | 2217 | static const struct dvb_frontend_ops dib8000_ops = { |
2199 | .info = { | 2218 | .info = { |
2200 | .name = "DiBcom 8000 ISDB-T", | 2219 | .name = "DiBcom 8000 ISDB-T", |
diff --git a/drivers/media/dvb/frontends/dib8000.h b/drivers/media/dvb/frontends/dib8000.h index a86de340dd54..8c89482b738a 100644 --- a/drivers/media/dvb/frontends/dib8000.h +++ b/drivers/media/dvb/frontends/dib8000.h | |||
@@ -44,6 +44,8 @@ extern int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, u | |||
44 | 44 | ||
45 | extern int dib8000_set_gpio(struct dvb_frontend *, u8 num, u8 dir, u8 val); | 45 | extern int dib8000_set_gpio(struct dvb_frontend *, u8 num, u8 dir, u8 val); |
46 | extern int dib8000_set_wbd_ref(struct dvb_frontend *, u16 value); | 46 | extern int dib8000_set_wbd_ref(struct dvb_frontend *, u16 value); |
47 | extern int dib8000_pid_filter_ctrl(struct dvb_frontend *, u8 onoff); | ||
48 | extern int dib8000_pid_filter(struct dvb_frontend *, u8 id, u16 pid, u8 onoff); | ||
47 | #else | 49 | #else |
48 | static inline struct dvb_frontend *dib8000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg) | 50 | static inline struct dvb_frontend *dib8000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg) |
49 | { | 51 | { |
@@ -74,6 +76,18 @@ int dib8000_set_wbd_ref(struct dvb_frontend *fe, u16 value) | |||
74 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | 76 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
75 | return -ENODEV; | 77 | return -ENODEV; |
76 | } | 78 | } |
79 | |||
80 | int dib8000_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff) | ||
81 | { | ||
82 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
83 | return -ENODEV; | ||
84 | } | ||
85 | |||
86 | int dib8000_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff) | ||
87 | { | ||
88 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
89 | return -ENODEV; | ||
90 | } | ||
77 | #endif | 91 | #endif |
78 | 92 | ||
79 | #endif | 93 | #endif |