Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] DiB7000M: add pid filtering

This patch adds the pid filtering for the dib7000M demod. It also
corrects the pid filtering for the dib7700 based board. It should
prevent an oops, when using dib7700p based board.

References: https://bugzilla.novell.com/show_bug.cgi?id=644807

Signed-off-by: Olivier Grenie <olivier.grenie@dibcom.fr>
Signed-off-by: Patrick Boettcher <patrick.boettcher@dibcom.fr>
Tested-by: Pavel SKARKA <paul.sp@seznam.cz>
Cc: stable@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Olivier Grenie and committed by
Mauro Carvalho Chehab
e192a7cf 0a91be40

+53 -2
+19 -2
drivers/media/dvb/dvb-usb/dib0700_devices.c
··· 870 870 return 0; 871 871 } 872 872 873 + static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index, 874 + u16 pid, int onoff) 875 + { 876 + struct dib0700_state *st = adapter->dev->priv; 877 + if (st->is_dib7000pc) 878 + return dib7000p_pid_filter(adapter->fe, index, pid, onoff); 879 + return dib7000m_pid_filter(adapter->fe, index, pid, onoff); 880 + } 881 + 882 + static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff) 883 + { 884 + struct dib0700_state *st = adapter->dev->priv; 885 + if (st->is_dib7000pc) 886 + return dib7000p_pid_filter_ctrl(adapter->fe, onoff); 887 + return dib7000m_pid_filter_ctrl(adapter->fe, onoff); 888 + } 889 + 873 890 static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff) 874 891 { 875 892 return dib7000p_pid_filter(adapter->fe, index, pid, onoff); ··· 1892 1875 { 1893 1876 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, 1894 1877 .pid_filter_count = 32, 1895 - .pid_filter = stk70x0p_pid_filter, 1896 - .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, 1878 + .pid_filter = stk7700p_pid_filter, 1879 + .pid_filter_ctrl = stk7700p_pid_filter_ctrl, 1897 1880 .frontend_attach = stk7700p_frontend_attach, 1898 1881 .tuner_attach = stk7700p_tuner_attach, 1899 1882
+19
drivers/media/dvb/frontends/dib7000m.c
··· 1285 1285 } 1286 1286 EXPORT_SYMBOL(dib7000m_get_i2c_master); 1287 1287 1288 + int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff) 1289 + { 1290 + struct dib7000m_state *state = fe->demodulator_priv; 1291 + u16 val = dib7000m_read_word(state, 294 + state->reg_offs) & 0xffef; 1292 + val |= (onoff & 0x1) << 4; 1293 + dprintk("PID filter enabled %d", onoff); 1294 + return dib7000m_write_word(state, 294 + state->reg_offs, val); 1295 + } 1296 + EXPORT_SYMBOL(dib7000m_pid_filter_ctrl); 1297 + 1298 + int dib7000m_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff) 1299 + { 1300 + struct dib7000m_state *state = fe->demodulator_priv; 1301 + dprintk("PID filter: index %x, PID %d, OnOff %d", id, pid, onoff); 1302 + return dib7000m_write_word(state, 300 + state->reg_offs + id, 1303 + onoff ? (1 << 13) | pid : 0); 1304 + } 1305 + EXPORT_SYMBOL(dib7000m_pid_filter); 1306 + 1288 1307 #if 0 1289 1308 /* used with some prototype boards */ 1290 1309 int dib7000m_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods,
+15
drivers/media/dvb/frontends/dib7000m.h
··· 46 46 extern struct i2c_adapter *dib7000m_get_i2c_master(struct dvb_frontend *, 47 47 enum dibx000_i2c_interface, 48 48 int); 49 + extern int dib7000m_pid_filter(struct dvb_frontend *, u8 id, u16 pid, u8 onoff); 50 + extern int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff); 49 51 #else 50 52 static inline 51 53 struct dvb_frontend *dib7000m_attach(struct i2c_adapter *i2c_adap, ··· 64 62 { 65 63 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 66 64 return NULL; 65 + } 66 + static inline int dib7000m_pid_filter(struct dvb_frontend *fe, u8 id, 67 + u16 pid, u8 onoff) 68 + { 69 + printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 70 + return -ENODEV; 71 + } 72 + 73 + static inline int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe, 74 + uint8_t onoff) 75 + { 76 + printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 77 + return -ENODEV; 67 78 } 68 79 #endif 69 80