diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-dvb.c | 44 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-dvb.h | 3 |
2 files changed, 45 insertions, 2 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-dvb.c b/drivers/media/video/pvrusb2/pvrusb2-dvb.c index 250462265a41..c85477709e6e 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-dvb.c +++ b/drivers/media/video/pvrusb2/pvrusb2-dvb.c | |||
@@ -18,6 +18,7 @@ | |||
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/kthread.h> | ||
21 | #include "dvbdev.h" | 22 | #include "dvbdev.h" |
22 | #include "pvrusb2-hdw-internal.h" | 23 | #include "pvrusb2-hdw-internal.h" |
23 | #include "pvrusb2-hdw.h" | 24 | #include "pvrusb2-hdw.h" |
@@ -25,18 +26,56 @@ | |||
25 | 26 | ||
26 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 27 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
27 | 28 | ||
29 | static int pvr2_dvb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) | ||
30 | { | ||
31 | struct pvr2_dvb_adapter *adap = dvbdmxfeed->demux->priv; | ||
32 | int newfeedcount, ret = 0; | ||
33 | |||
34 | if (adap == NULL) | ||
35 | return -ENODEV; | ||
36 | |||
37 | mutex_lock(&adap->lock); | ||
38 | newfeedcount = adap->feedcount + (onoff ? 1 : -1); | ||
39 | |||
40 | if (newfeedcount == 0) { | ||
41 | printk(KERN_DEBUG "stop feeding\n"); | ||
42 | |||
43 | ret = kthread_stop(adap->thread); | ||
44 | adap->thread = NULL; | ||
45 | } | ||
46 | |||
47 | adap->feedcount = newfeedcount; | ||
48 | |||
49 | if (adap->feedcount == onoff && adap->feedcount > 0) { | ||
50 | if (NULL != adap->thread) | ||
51 | goto fail; | ||
52 | |||
53 | printk(KERN_DEBUG "start feeding\n"); | ||
54 | |||
55 | if (IS_ERR(adap->thread)) { | ||
56 | ret = PTR_ERR(adap->thread); | ||
57 | adap->thread = NULL; | ||
58 | } | ||
59 | //ret = newfeedcount; | ||
60 | } | ||
61 | fail: | ||
62 | mutex_unlock(&adap->lock); | ||
63 | |||
64 | return ret; | ||
65 | } | ||
66 | |||
28 | static int pvr2_dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed) | 67 | static int pvr2_dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed) |
29 | { | 68 | { |
30 | printk(KERN_DEBUG "start pid: 0x%04x, feedtype: %d\n", | 69 | printk(KERN_DEBUG "start pid: 0x%04x, feedtype: %d\n", |
31 | dvbdmxfeed->pid, dvbdmxfeed->type); | 70 | dvbdmxfeed->pid, dvbdmxfeed->type); |
32 | return 0; /* FIXME: pvr2_dvb_ctrl_feed(dvbdmxfeed, 1); */ | 71 | return pvr2_dvb_ctrl_feed(dvbdmxfeed, 1); |
33 | } | 72 | } |
34 | 73 | ||
35 | static int pvr2_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | 74 | static int pvr2_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) |
36 | { | 75 | { |
37 | printk(KERN_DEBUG "stop pid: 0x%04x, feedtype: %d\n", | 76 | printk(KERN_DEBUG "stop pid: 0x%04x, feedtype: %d\n", |
38 | dvbdmxfeed->pid, dvbdmxfeed->type); | 77 | dvbdmxfeed->pid, dvbdmxfeed->type); |
39 | return 0; /* FIXME: pvr2_dvb_ctrl_feed(dvbdmxfeed, 0); */ | 78 | return pvr2_dvb_ctrl_feed(dvbdmxfeed, 0); |
40 | } | 79 | } |
41 | 80 | ||
42 | static int pvr2_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire) | 81 | static int pvr2_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire) |
@@ -172,6 +211,7 @@ int pvr2_dvb_init(struct pvr2_context *pvr) | |||
172 | int ret = 0; | 211 | int ret = 0; |
173 | 212 | ||
174 | pvr->hdw->dvb.pvr = pvr; | 213 | pvr->hdw->dvb.pvr = pvr; |
214 | mutex_init(&pvr->hdw->dvb.lock); | ||
175 | 215 | ||
176 | ret = pvr2_dvb_adapter_init(&pvr->hdw->dvb); | 216 | ret = pvr2_dvb_adapter_init(&pvr->hdw->dvb); |
177 | if (ret < 0) | 217 | if (ret < 0) |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-dvb.h b/drivers/media/video/pvrusb2/pvrusb2-dvb.h index 0aff05cb9415..98728d44a4b6 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-dvb.h +++ b/drivers/media/video/pvrusb2/pvrusb2-dvb.h | |||
@@ -19,6 +19,9 @@ struct pvr2_dvb_adapter { | |||
19 | int feedcount; | 19 | int feedcount; |
20 | int max_feed_count; | 20 | int max_feed_count; |
21 | 21 | ||
22 | struct task_struct *thread; | ||
23 | struct mutex lock; | ||
24 | |||
22 | unsigned int digital_up:1; | 25 | unsigned int digital_up:1; |
23 | }; | 26 | }; |
24 | 27 | ||