aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Grenie <olivier.grenie@dibcom.fr>2009-09-18 03:08:43 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:40:03 -0500
commitf8731f4ddedb78693ae05e40aac5c4817f740518 (patch)
tree56100674dd3a1c2935ca234fd8086f24322ab163
parent8171c2059cc4b0507faf3a0e0fdf28cc83d8ac62 (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>
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c71
-rw-r--r--drivers/media/dvb/frontends/dib7000p.c18
-rw-r--r--drivers/media/dvb/frontends/dib7000p.h13
-rw-r--r--drivers/media/dvb/frontends/dib8000.c21
-rw-r--r--drivers/media/dvb/frontends/dib8000.h14
5 files changed, 136 insertions, 1 deletions
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index bf8e83187cba..cda60291c06e 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -1252,6 +1252,16 @@ static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
1252 return 0; 1252 return 0;
1253} 1253}
1254 1254
1255static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1256{
1257 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
1258}
1259
1260static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1261{
1262 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
1263}
1264
1255static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = { 1265static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
1256 60000, 15000, // internal, sampling 1266 60000, 15000, // internal, sampling
1257 1, 20, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass 1267 1, 20, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
@@ -1543,6 +1553,15 @@ static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1543 return 0; 1553 return 0;
1544} 1554}
1545 1555
1556static int stk807x_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1557{
1558 return dib8000_pid_filter(adapter->fe, index, pid, onoff);
1559}
1560
1561static int stk807x_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1562{
1563 return dib8000_pid_filter_ctrl(adapter->fe, onoff);
1564}
1546 1565
1547/* STK807x */ 1566/* STK807x */
1548static int stk807x_frontend_attach(struct dvb_usb_adapter *adap) 1567static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
@@ -1938,6 +1957,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
1938 .num_adapters = 1, 1957 .num_adapters = 1,
1939 .adapter = { 1958 .adapter = {
1940 { 1959 {
1960 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1961 .pid_filter_count = 32,
1962 .pid_filter = stk70x0p_pid_filter,
1963 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
1941 .frontend_attach = stk7700p_frontend_attach, 1964 .frontend_attach = stk7700p_frontend_attach,
1942 .tuner_attach = stk7700p_tuner_attach, 1965 .tuner_attach = stk7700p_tuner_attach,
1943 1966
@@ -2019,11 +2042,19 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2019 .num_adapters = 2, 2042 .num_adapters = 2,
2020 .adapter = { 2043 .adapter = {
2021 { 2044 {
2045 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2046 .pid_filter_count = 32,
2047 .pid_filter = stk70x0p_pid_filter,
2048 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2022 .frontend_attach = stk7700d_frontend_attach, 2049 .frontend_attach = stk7700d_frontend_attach,
2023 .tuner_attach = stk7700d_tuner_attach, 2050 .tuner_attach = stk7700d_tuner_attach,
2024 2051
2025 DIB0700_DEFAULT_STREAMING_CONFIG(0x02), 2052 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2026 }, { 2053 }, {
2054 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2055 .pid_filter_count = 32,
2056 .pid_filter = stk70x0p_pid_filter,
2057 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2027 .frontend_attach = stk7700d_frontend_attach, 2058 .frontend_attach = stk7700d_frontend_attach,
2028 .tuner_attach = stk7700d_tuner_attach, 2059 .tuner_attach = stk7700d_tuner_attach,
2029 2060
@@ -2066,6 +2097,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2066 .num_adapters = 1, 2097 .num_adapters = 1,
2067 .adapter = { 2098 .adapter = {
2068 { 2099 {
2100 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2101 .pid_filter_count = 32,
2102 .pid_filter = stk70x0p_pid_filter,
2103 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2069 .frontend_attach = stk7700P2_frontend_attach, 2104 .frontend_attach = stk7700P2_frontend_attach,
2070 .tuner_attach = stk7700d_tuner_attach, 2105 .tuner_attach = stk7700d_tuner_attach,
2071 2106
@@ -2098,6 +2133,14 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2098 .num_adapters = 1, 2133 .num_adapters = 1,
2099 .adapter = { 2134 .adapter = {
2100 { 2135 {
2136 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2137 .pid_filter_count = 32,
2138 .pid_filter = stk70x0p_pid_filter,
2139 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2140 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2141 .pid_filter_count = 32,
2142 .pid_filter = stk70x0p_pid_filter,
2143 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2101 .frontend_attach = stk7070p_frontend_attach, 2144 .frontend_attach = stk7070p_frontend_attach,
2102 .tuner_attach = dib7070p_tuner_attach, 2145 .tuner_attach = dib7070p_tuner_attach,
2103 2146
@@ -2200,6 +2243,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2200 .num_adapters = 2, 2243 .num_adapters = 2,
2201 .adapter = { 2244 .adapter = {
2202 { 2245 {
2246 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2247 .pid_filter_count = 32,
2248 .pid_filter = stk70x0p_pid_filter,
2249 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2203 .frontend_attach = stk7070pd_frontend_attach0, 2250 .frontend_attach = stk7070pd_frontend_attach0,
2204 .tuner_attach = dib7070p_tuner_attach, 2251 .tuner_attach = dib7070p_tuner_attach,
2205 2252
@@ -2207,6 +2254,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2207 2254
2208 .size_of_priv = sizeof(struct dib0700_adapter_state), 2255 .size_of_priv = sizeof(struct dib0700_adapter_state),
2209 }, { 2256 }, {
2257 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2258 .pid_filter_count = 32,
2259 .pid_filter = stk70x0p_pid_filter,
2260 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2210 .frontend_attach = stk7070pd_frontend_attach1, 2261 .frontend_attach = stk7070pd_frontend_attach1,
2211 .tuner_attach = dib7070p_tuner_attach, 2262 .tuner_attach = dib7070p_tuner_attach,
2212 2263
@@ -2253,6 +2304,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2253 .num_adapters = 1, 2304 .num_adapters = 1,
2254 .adapter = { 2305 .adapter = {
2255 { 2306 {
2307 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2308 .pid_filter_count = 32,
2309 .pid_filter = stk70x0p_pid_filter,
2310 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2256 .frontend_attach = stk7700ph_frontend_attach, 2311 .frontend_attach = stk7700ph_frontend_attach,
2257 .tuner_attach = stk7700ph_tuner_attach, 2312 .tuner_attach = stk7700ph_tuner_attach,
2258 2313
@@ -2365,6 +2420,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2365 .num_adapters = 1, 2420 .num_adapters = 1,
2366 .adapter = { 2421 .adapter = {
2367 { 2422 {
2423 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2424 .pid_filter_count = 32,
2425 .pid_filter = stk70x0p_pid_filter,
2426 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2368 .frontend_attach = stk7070p_frontend_attach, 2427 .frontend_attach = stk7070p_frontend_attach,
2369 .tuner_attach = dib7770p_tuner_attach, 2428 .tuner_attach = dib7770p_tuner_attach,
2370 2429
@@ -2396,6 +2455,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2396 .num_adapters = 1, 2455 .num_adapters = 1,
2397 .adapter = { 2456 .adapter = {
2398 { 2457 {
2458 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2459 .pid_filter_count = 32,
2460 .pid_filter = stk807x_pid_filter,
2461 .pid_filter_ctrl = stk807x_pid_filter_ctrl,
2399 .frontend_attach = stk807x_frontend_attach, 2462 .frontend_attach = stk807x_frontend_attach,
2400 .tuner_attach = dib807x_tuner_attach, 2463 .tuner_attach = dib807x_tuner_attach,
2401 2464
@@ -2427,6 +2490,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2427 .num_adapters = 2, 2490 .num_adapters = 2,
2428 .adapter = { 2491 .adapter = {
2429 { 2492 {
2493 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2494 .pid_filter_count = 32,
2495 .pid_filter = stk807x_pid_filter,
2496 .pid_filter_ctrl = stk807x_pid_filter_ctrl,
2430 .frontend_attach = stk807xpvr_frontend_attach0, 2497 .frontend_attach = stk807xpvr_frontend_attach0,
2431 .tuner_attach = dib807x_tuner_attach, 2498 .tuner_attach = dib807x_tuner_attach,
2432 2499
@@ -2436,6 +2503,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2436 sizeof(struct dib0700_adapter_state), 2503 sizeof(struct dib0700_adapter_state),
2437 }, 2504 },
2438 { 2505 {
2506 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2507 .pid_filter_count = 32,
2508 .pid_filter = stk807x_pid_filter,
2509 .pid_filter_ctrl = stk807x_pid_filter_ctrl,
2439 .frontend_attach = stk807xpvr_frontend_attach1, 2510 .frontend_attach = stk807xpvr_frontend_attach1,
2440 .tuner_attach = dib807x_tuner_attach, 2511 .tuner_attach = dib807x_tuner_attach,
2441 2512
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}
1303EXPORT_SYMBOL(dib7000p_get_i2c_master); 1303EXPORT_SYMBOL(dib7000p_get_i2c_master);
1304 1304
1305int 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}
1313EXPORT_SYMBOL(dib7000p_pid_filter_ctrl);
1314
1315int 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}
1321EXPORT_SYMBOL(dib7000p_pid_filter);
1322
1305int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]) 1323int 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,
51extern int dib7000p_set_gpio(struct dvb_frontend *, u8 num, u8 dir, u8 val); 51extern int dib7000p_set_gpio(struct dvb_frontend *, u8 num, u8 dir, u8 val);
52extern int dib7000p_set_wbd_ref(struct dvb_frontend *, u16 value); 52extern int dib7000p_set_wbd_ref(struct dvb_frontend *, u16 value);
53extern int dib7000pc_detection(struct i2c_adapter *i2c_adap); 53extern int dib7000pc_detection(struct i2c_adapter *i2c_adap);
54extern int dib7000p_pid_filter(struct dvb_frontend *, u8 id, u16 pid, u8 onoff);
55extern int dib7000p_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff);
54#else 56#else
55static inline 57static inline
56struct dvb_frontend *dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, 58struct 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}
100static 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
106static 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
2196EXPORT_SYMBOL(dib8000_get_i2c_master); 2196EXPORT_SYMBOL(dib8000_get_i2c_master);
2197 2197
2198int 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}
2207EXPORT_SYMBOL(dib8000_pid_filter_ctrl);
2208
2209int 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}
2215EXPORT_SYMBOL(dib8000_pid_filter);
2216
2198static const struct dvb_frontend_ops dib8000_ops = { 2217static 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
45extern int dib8000_set_gpio(struct dvb_frontend *, u8 num, u8 dir, u8 val); 45extern int dib8000_set_gpio(struct dvb_frontend *, u8 num, u8 dir, u8 val);
46extern int dib8000_set_wbd_ref(struct dvb_frontend *, u16 value); 46extern int dib8000_set_wbd_ref(struct dvb_frontend *, u16 value);
47extern int dib8000_pid_filter_ctrl(struct dvb_frontend *, u8 onoff);
48extern int dib8000_pid_filter(struct dvb_frontend *, u8 id, u16 pid, u8 onoff);
47#else 49#else
48static inline struct dvb_frontend *dib8000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg) 50static 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
80int 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
86int 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