aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorMalcolm Priestley <tvboxspy@gmail.com>2011-04-02 17:59:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 08:28:36 -0400
commiteb02d8571bebf53a9c18a82f9912d0a77ebb83e7 (patch)
treeb2883ea6d55b6dad1d7b59d49ce705156ce9aed6 /drivers/media/dvb
parentbb19a4210540866443e51635733a83d0970939c8 (diff)
[media] DM04/QQBOX v1.84 added PID filter
A greatly simplified version of the PID Filter now added back to the Driver. The driver allows for the PID filter to be turned off. applied after patch 683781. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-usb/lmedm04.c87
-rw-r--r--drivers/media/dvb/dvb-usb/lmedm04.h1
2 files changed, 85 insertions, 3 deletions
diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c
index a4457e4c1246..5b0f43791f77 100644
--- a/drivers/media/dvb/dvb-usb/lmedm04.c
+++ b/drivers/media/dvb/dvb-usb/lmedm04.c
@@ -62,8 +62,6 @@
62 * LME2510: SHARP:BS2F7HZ0194(MV0194) cannot cold reset and share system 62 * LME2510: SHARP:BS2F7HZ0194(MV0194) cannot cold reset and share system
63 * with other tuners. After a cold reset streaming will not start. 63 * with other tuners. After a cold reset streaming will not start.
64 * 64 *
65 * PID functions have been removed from this driver version due to
66 * problems with different firmware and application versions.
67 */ 65 */
68#define DVB_USB_LOG_PREFIX "LME2510(C)" 66#define DVB_USB_LOG_PREFIX "LME2510(C)"
69#include <linux/usb.h> 67#include <linux/usb.h>
@@ -104,6 +102,10 @@ static int dvb_usb_lme2510_firmware;
104module_param_named(firmware, dvb_usb_lme2510_firmware, int, 0644); 102module_param_named(firmware, dvb_usb_lme2510_firmware, int, 0644);
105MODULE_PARM_DESC(firmware, "set default firmware 0=Sharp7395 1=LG"); 103MODULE_PARM_DESC(firmware, "set default firmware 0=Sharp7395 1=LG");
106 104
105static int pid_filter;
106module_param_named(pid, pid_filter, int, 0644);
107MODULE_PARM_DESC(pid, "set default 0=on 1=off");
108
107 109
108DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 110DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
109 111
@@ -216,6 +218,38 @@ static int lme2510_remote_keypress(struct dvb_usb_adapter *adap, u32 keypress)
216 return 0; 218 return 0;
217} 219}
218 220
221static int lme2510_enable_pid(struct dvb_usb_device *d, u8 index, u16 pid_out)
222{
223 struct lme2510_state *st = d->priv;
224 static u8 pid_buff[] = LME_ZERO_PID;
225 static u8 rbuf[1];
226 u8 pid_no = index * 2;
227 int ret = 0;
228 deb_info(1, "PID Setting Pid %04x", pid_out);
229
230 pid_buff[2] = pid_no;
231 pid_buff[3] = (u8)pid_out & 0xff;
232 pid_buff[4] = pid_no + 1;
233 pid_buff[5] = (u8)(pid_out >> 8);
234
235 /* wait for i2c mutex */
236 ret = mutex_lock_interruptible(&d->i2c_mutex);
237 if (ret < 0) {
238 ret = -EAGAIN;
239 return ret;
240 }
241
242 ret |= lme2510_usb_talk(d, pid_buff ,
243 sizeof(pid_buff) , rbuf, sizeof(rbuf));
244
245 if (st->stream_on & 1)
246 ret |= lme2510_stream_restart(d);
247
248 mutex_unlock(&d->i2c_mutex);
249
250 return ret;
251}
252
219static void lme2510_int_response(struct urb *lme_urb) 253static void lme2510_int_response(struct urb *lme_urb)
220{ 254{
221 struct dvb_usb_adapter *adap = lme_urb->context; 255 struct dvb_usb_adapter *adap = lme_urb->context;
@@ -326,6 +360,41 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)
326 return 0; 360 return 0;
327} 361}
328 362
363static int lme2510_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
364{
365 static u8 clear_pid_reg[] = LME_CLEAR_PID;
366 static u8 rbuf[1];
367 int ret = 0;
368
369 deb_info(1, "PID Clearing Filter");
370
371 ret = mutex_lock_interruptible(&adap->dev->i2c_mutex);
372
373 if (!onoff)
374 ret |= lme2510_usb_talk(adap->dev, clear_pid_reg,
375 sizeof(clear_pid_reg), rbuf, sizeof(rbuf));
376
377 mutex_unlock(&adap->dev->i2c_mutex);
378
379 return 0;
380}
381
382static int lme2510_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid,
383 int onoff)
384{
385 int ret = 0;
386
387 deb_info(3, "%s PID=%04x Index=%04x onoff=%02x", __func__,
388 pid, index, onoff);
389
390 if (onoff)
391 if (!pid_filter)
392 ret = lme2510_enable_pid(adap->dev, index, pid);
393
394 return ret;
395}
396
397
329static int lme2510_return_status(struct usb_device *dev) 398static int lme2510_return_status(struct usb_device *dev)
330{ 399{
331 int ret = 0; 400 int ret = 0;
@@ -1099,7 +1168,13 @@ static struct dvb_usb_device_properties lme2510_properties = {
1099 .num_adapters = 1, 1168 .num_adapters = 1,
1100 .adapter = { 1169 .adapter = {
1101 { 1170 {
1171 .caps = DVB_USB_ADAP_HAS_PID_FILTER|
1172 DVB_USB_ADAP_NEED_PID_FILTERING|
1173 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1102 .streaming_ctrl = lme2510_streaming_ctrl, 1174 .streaming_ctrl = lme2510_streaming_ctrl,
1175 .pid_filter_count = 15,
1176 .pid_filter = lme2510_pid_filter,
1177 .pid_filter_ctrl = lme2510_pid_filter_ctrl,
1103 .frontend_attach = dm04_lme2510_frontend_attach, 1178 .frontend_attach = dm04_lme2510_frontend_attach,
1104 .tuner_attach = dm04_lme2510_tuner, 1179 .tuner_attach = dm04_lme2510_tuner,
1105 /* parameter for the MPEG2-data transfer */ 1180 /* parameter for the MPEG2-data transfer */
@@ -1135,7 +1210,13 @@ static struct dvb_usb_device_properties lme2510c_properties = {
1135 .num_adapters = 1, 1210 .num_adapters = 1,
1136 .adapter = { 1211 .adapter = {
1137 { 1212 {
1213 .caps = DVB_USB_ADAP_HAS_PID_FILTER|
1214 DVB_USB_ADAP_NEED_PID_FILTERING|
1215 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1138 .streaming_ctrl = lme2510_streaming_ctrl, 1216 .streaming_ctrl = lme2510_streaming_ctrl,
1217 .pid_filter_count = 15,
1218 .pid_filter = lme2510_pid_filter,
1219 .pid_filter_ctrl = lme2510_pid_filter_ctrl,
1139 .frontend_attach = dm04_lme2510_frontend_attach, 1220 .frontend_attach = dm04_lme2510_frontend_attach,
1140 .tuner_attach = dm04_lme2510_tuner, 1221 .tuner_attach = dm04_lme2510_tuner,
1141 /* parameter for the MPEG2-data transfer */ 1222 /* parameter for the MPEG2-data transfer */
@@ -1233,5 +1314,5 @@ module_exit(lme2510_module_exit);
1233 1314
1234MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); 1315MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
1235MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0"); 1316MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0");
1236MODULE_VERSION("1.81"); 1317MODULE_VERSION("1.84");
1237MODULE_LICENSE("GPL"); 1318MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/lmedm04.h b/drivers/media/dvb/dvb-usb/lmedm04.h
index 3a30ab12edc2..ab21e2ef53fa 100644
--- a/drivers/media/dvb/dvb-usb/lmedm04.h
+++ b/drivers/media/dvb/dvb-usb/lmedm04.h
@@ -40,6 +40,7 @@
40*/ 40*/
41#define LME_ST_ON_W {0x06, 0x00} 41#define LME_ST_ON_W {0x06, 0x00}
42#define LME_CLEAR_PID {0x03, 0x02, 0x20, 0xa0} 42#define LME_CLEAR_PID {0x03, 0x02, 0x20, 0xa0}
43#define LME_ZERO_PID {0x03, 0x06, 0x00, 0x00, 0x01, 0x00, 0x20, 0x9c}
43 44
44/* LNB Voltage 45/* LNB Voltage
45 * 07 XX XX 46 * 07 XX XX