diff options
author | Olivier Grenie <olivier.grenie@dibcom.fr> | 2011-01-14 11:58:59 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-02 11:45:12 -0500 |
commit | e192a7cf0effe7680264a5bc35c0ad1bdcdc921c (patch) | |
tree | 586ca0b3d8c77be1d8cd418641e30f26e0d09766 /drivers | |
parent | 0a91be40ed67ca72a81cfd842d5c2604ff1a54a4 (diff) |
[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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/dvb-usb/dib0700_devices.c | 21 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dib7000m.c | 19 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dib7000m.h | 15 |
3 files changed, 53 insertions, 2 deletions
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index defd83964ce2..193cdb77b76a 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c | |||
@@ -870,6 +870,23 @@ static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap) | |||
870 | return 0; | 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 | static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff) | 890 | static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff) |
874 | { | 891 | { |
875 | return dib7000p_pid_filter(adapter->fe, index, pid, onoff); | 892 | return dib7000p_pid_filter(adapter->fe, index, pid, onoff); |
@@ -1875,8 +1892,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
1875 | { | 1892 | { |
1876 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 1893 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
1877 | .pid_filter_count = 32, | 1894 | .pid_filter_count = 32, |
1878 | .pid_filter = stk70x0p_pid_filter, | 1895 | .pid_filter = stk7700p_pid_filter, |
1879 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | 1896 | .pid_filter_ctrl = stk7700p_pid_filter_ctrl, |
1880 | .frontend_attach = stk7700p_frontend_attach, | 1897 | .frontend_attach = stk7700p_frontend_attach, |
1881 | .tuner_attach = stk7700p_tuner_attach, | 1898 | .tuner_attach = stk7700p_tuner_attach, |
1882 | 1899 | ||
diff --git a/drivers/media/dvb/frontends/dib7000m.c b/drivers/media/dvb/frontends/dib7000m.c index c7f5ccf54aa5..289a79837f24 100644 --- a/drivers/media/dvb/frontends/dib7000m.c +++ b/drivers/media/dvb/frontends/dib7000m.c | |||
@@ -1285,6 +1285,25 @@ struct i2c_adapter * dib7000m_get_i2c_master(struct dvb_frontend *demod, enum di | |||
1285 | } | 1285 | } |
1286 | EXPORT_SYMBOL(dib7000m_get_i2c_master); | 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 | #if 0 | 1307 | #if 0 |
1289 | /* used with some prototype boards */ | 1308 | /* used with some prototype boards */ |
1290 | int dib7000m_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, | 1309 | int dib7000m_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, |
diff --git a/drivers/media/dvb/frontends/dib7000m.h b/drivers/media/dvb/frontends/dib7000m.h index 113819ce9f0d..81fcf2241c64 100644 --- a/drivers/media/dvb/frontends/dib7000m.h +++ b/drivers/media/dvb/frontends/dib7000m.h | |||
@@ -46,6 +46,8 @@ extern struct dvb_frontend *dib7000m_attach(struct i2c_adapter *i2c_adap, | |||
46 | extern struct i2c_adapter *dib7000m_get_i2c_master(struct dvb_frontend *, | 46 | extern struct i2c_adapter *dib7000m_get_i2c_master(struct dvb_frontend *, |
47 | enum dibx000_i2c_interface, | 47 | enum dibx000_i2c_interface, |
48 | int); | 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 | #else | 51 | #else |
50 | static inline | 52 | static inline |
51 | struct dvb_frontend *dib7000m_attach(struct i2c_adapter *i2c_adap, | 53 | struct dvb_frontend *dib7000m_attach(struct i2c_adapter *i2c_adap, |
@@ -63,6 +65,19 @@ struct i2c_adapter *dib7000m_get_i2c_master(struct dvb_frontend *demod, | |||
63 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | 65 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
64 | return NULL; | 66 | return NULL; |
65 | } | 67 | } |
68 | static inline int dib7000m_pid_filter(struct dvb_frontend *fe, u8 id, | ||
69 | u16 pid, u8 onoff) | ||
70 | { | ||
71 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
72 | return -ENODEV; | ||
73 | } | ||
74 | |||
75 | static inline int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe, | ||
76 | uint8_t onoff) | ||
77 | { | ||
78 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
79 | return -ENODEV; | ||
80 | } | ||
66 | #endif | 81 | #endif |
67 | 82 | ||
68 | /* TODO | 83 | /* TODO |