diff options
-rw-r--r-- | drivers/ieee1394/dma.h | 1 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394_core.c | 1 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394_transactions.c | 29 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394_transactions.h | 2 | ||||
-rw-r--r-- | drivers/ieee1394/iso.h | 1 | ||||
-rw-r--r-- | drivers/media/dvb/Makefile | 2 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/Kconfig | 13 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/Makefile | 4 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/avc_api.c | 121 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/avc_api.h | 115 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/cmp.c | 99 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/cmp.h | 14 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/firesat-ci.c | 16 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/firesat-ci.h | 8 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/firesat-rc.c | 147 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/firesat-rc.h | 13 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/firesat.h | 78 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/firesat_1394.c | 164 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/firesat_dvb.c | 147 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/firesat_fe.c | 41 | ||||
-rw-r--r-- | drivers/media/dvb/firesat/firesat_iso.c | 12 |
21 files changed, 502 insertions, 526 deletions
diff --git a/drivers/ieee1394/dma.h b/drivers/ieee1394/dma.h index 2727bcd24194..467373cab8e5 100644 --- a/drivers/ieee1394/dma.h +++ b/drivers/ieee1394/dma.h | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <asm/types.h> | 13 | #include <asm/types.h> |
14 | 14 | ||
15 | struct file; | ||
15 | struct pci_dev; | 16 | struct pci_dev; |
16 | struct scatterlist; | 17 | struct scatterlist; |
17 | struct vm_area_struct; | 18 | struct vm_area_struct; |
diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c index 2beb8d94f7bd..1028e725a27e 100644 --- a/drivers/ieee1394/ieee1394_core.c +++ b/drivers/ieee1394/ieee1394_core.c | |||
@@ -1314,6 +1314,7 @@ EXPORT_SYMBOL(hpsb_make_lock64packet); | |||
1314 | EXPORT_SYMBOL(hpsb_make_phypacket); | 1314 | EXPORT_SYMBOL(hpsb_make_phypacket); |
1315 | EXPORT_SYMBOL(hpsb_read); | 1315 | EXPORT_SYMBOL(hpsb_read); |
1316 | EXPORT_SYMBOL(hpsb_write); | 1316 | EXPORT_SYMBOL(hpsb_write); |
1317 | EXPORT_SYMBOL(hpsb_lock); | ||
1317 | EXPORT_SYMBOL(hpsb_packet_success); | 1318 | EXPORT_SYMBOL(hpsb_packet_success); |
1318 | 1319 | ||
1319 | /** highlevel.c **/ | 1320 | /** highlevel.c **/ |
diff --git a/drivers/ieee1394/ieee1394_transactions.c b/drivers/ieee1394/ieee1394_transactions.c index 10c3d9f8c038..24021d2f0a75 100644 --- a/drivers/ieee1394/ieee1394_transactions.c +++ b/drivers/ieee1394/ieee1394_transactions.c | |||
@@ -570,3 +570,32 @@ int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation, | |||
570 | 570 | ||
571 | return retval; | 571 | return retval; |
572 | } | 572 | } |
573 | |||
574 | int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation, | ||
575 | u64 addr, int extcode, quadlet_t *data, quadlet_t arg) | ||
576 | { | ||
577 | struct hpsb_packet *packet; | ||
578 | int retval = 0; | ||
579 | |||
580 | BUG_ON(in_interrupt()); | ||
581 | |||
582 | packet = hpsb_make_lockpacket(host, node, addr, extcode, data, arg); | ||
583 | if (!packet) | ||
584 | return -ENOMEM; | ||
585 | |||
586 | packet->generation = generation; | ||
587 | retval = hpsb_send_packet_and_wait(packet); | ||
588 | if (retval < 0) | ||
589 | goto hpsb_lock_fail; | ||
590 | |||
591 | retval = hpsb_packet_success(packet); | ||
592 | |||
593 | if (retval == 0) | ||
594 | *data = packet->data[0]; | ||
595 | |||
596 | hpsb_lock_fail: | ||
597 | hpsb_free_tlabel(packet); | ||
598 | hpsb_free_packet(packet); | ||
599 | |||
600 | return retval; | ||
601 | } | ||
diff --git a/drivers/ieee1394/ieee1394_transactions.h b/drivers/ieee1394/ieee1394_transactions.h index d2d5bc3546d7..20b693be14b2 100644 --- a/drivers/ieee1394/ieee1394_transactions.h +++ b/drivers/ieee1394/ieee1394_transactions.h | |||
@@ -30,6 +30,8 @@ int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation, | |||
30 | u64 addr, quadlet_t *buffer, size_t length); | 30 | u64 addr, quadlet_t *buffer, size_t length); |
31 | int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation, | 31 | int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation, |
32 | u64 addr, quadlet_t *buffer, size_t length); | 32 | u64 addr, quadlet_t *buffer, size_t length); |
33 | int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation, | ||
34 | u64 addr, int extcode, quadlet_t *data, quadlet_t arg); | ||
33 | 35 | ||
34 | #ifdef HPSB_DEBUG_TLABELS | 36 | #ifdef HPSB_DEBUG_TLABELS |
35 | extern spinlock_t hpsb_tlabel_lock; | 37 | extern spinlock_t hpsb_tlabel_lock; |
diff --git a/drivers/ieee1394/iso.h b/drivers/ieee1394/iso.h index b5de5f21ef78..c2089c093aa7 100644 --- a/drivers/ieee1394/iso.h +++ b/drivers/ieee1394/iso.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define IEEE1394_ISO_H | 13 | #define IEEE1394_ISO_H |
14 | 14 | ||
15 | #include <linux/spinlock_types.h> | 15 | #include <linux/spinlock_types.h> |
16 | #include <linux/wait.h> | ||
16 | #include <asm/atomic.h> | 17 | #include <asm/atomic.h> |
17 | #include <asm/types.h> | 18 | #include <asm/types.h> |
18 | 19 | ||
diff --git a/drivers/media/dvb/Makefile b/drivers/media/dvb/Makefile index 41710554012f..cb765816f76c 100644 --- a/drivers/media/dvb/Makefile +++ b/drivers/media/dvb/Makefile | |||
@@ -4,4 +4,4 @@ | |||
4 | 4 | ||
5 | obj-y := dvb-core/ frontends/ ttpci/ ttusb-dec/ ttusb-budget/ b2c2/ bt8xx/ dvb-usb/ pluto2/ siano/ dm1105/ | 5 | obj-y := dvb-core/ frontends/ ttpci/ ttusb-dec/ ttusb-budget/ b2c2/ bt8xx/ dvb-usb/ pluto2/ siano/ dm1105/ |
6 | 6 | ||
7 | obj-$(CONFIG_DVB_FIRESAT) += firesat/ | 7 | obj-$(CONFIG_DVB_FIREDTV) += firesat/ |
diff --git a/drivers/media/dvb/firesat/Kconfig b/drivers/media/dvb/firesat/Kconfig index 93f8de5ec3c8..03d25ad10350 100644 --- a/drivers/media/dvb/firesat/Kconfig +++ b/drivers/media/dvb/firesat/Kconfig | |||
@@ -1,11 +1,12 @@ | |||
1 | config DVB_FIRESAT | 1 | config DVB_FIREDTV |
2 | tristate "FireSAT devices" | 2 | tristate "FireDTV (FireWire attached DVB receivers)" |
3 | depends on DVB_CORE && IEEE1394 && INPUT | 3 | depends on DVB_CORE && IEEE1394 && INPUT |
4 | help | 4 | help |
5 | Support for external IEEE1394 adapters designed by Digital Everywhere and | 5 | Support for DVB receivers from Digital Everywhere, known as FireDTV |
6 | produced by El Gato, shipped under the brand name 'FireDTV/FloppyDTV'. | 6 | and FloppyDTV, which are connected via IEEE 1394 (FireWire). |
7 | 7 | ||
8 | These devices don't have a MPEG decoder built in, so you need | 8 | These devices don't have an MPEG decoder built in, so you need |
9 | an external software decoder to watch TV. | 9 | an external software decoder to watch TV. |
10 | 10 | ||
11 | Say Y if you own such a device and want to use it. | 11 | To compile this driver as a module, say M here: the module will be |
12 | called firedtv. | ||
diff --git a/drivers/media/dvb/firesat/Makefile b/drivers/media/dvb/firesat/Makefile index be7701b817c9..9e49edc7c49d 100644 --- a/drivers/media/dvb/firesat/Makefile +++ b/drivers/media/dvb/firesat/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | firesat-objs := firesat_1394.o \ | 1 | firedtv-objs := firesat_1394.o \ |
2 | firesat_dvb.o \ | 2 | firesat_dvb.o \ |
3 | firesat_fe.o \ | 3 | firesat_fe.o \ |
4 | firesat_iso.o \ | 4 | firesat_iso.o \ |
@@ -7,7 +7,7 @@ firesat-objs := firesat_1394.o \ | |||
7 | firesat-rc.o \ | 7 | firesat-rc.o \ |
8 | firesat-ci.o | 8 | firesat-ci.o |
9 | 9 | ||
10 | obj-$(CONFIG_DVB_FIRESAT) += firesat.o | 10 | obj-$(CONFIG_DVB_FIREDTV) += firedtv.o |
11 | 11 | ||
12 | EXTRA_CFLAGS := -Idrivers/ieee1394 | 12 | EXTRA_CFLAGS := -Idrivers/ieee1394 |
13 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core | 13 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core |
diff --git a/drivers/media/dvb/firesat/avc_api.c b/drivers/media/dvb/firesat/avc_api.c index 3c8e7e3dacc2..6337f9f21d0f 100644 --- a/drivers/media/dvb/firesat/avc_api.c +++ b/drivers/media/dvb/firesat/avc_api.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * FireSAT AVC driver | 2 | * FireDTV driver (formerly known as FireSAT) |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Andreas Monitzer <andy@monitzer.com> | 4 | * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com> |
5 | * Copyright (c) 2008 Ben Backx <ben@bbackx.com> | 5 | * Copyright (C) 2008 Ben Backx <ben@bbackx.com> |
6 | * Copyright (c) 2008 Henrik Kurelid <henrik@kurelid.se> | 6 | * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License as | 9 | * modify it under the terms of the GNU General Public License as |
@@ -11,13 +11,20 @@ | |||
11 | * the License, or (at your option) any later version. | 11 | * the License, or (at your option) any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "firesat.h" | 14 | #include <linux/crc32.h> |
15 | #include <linux/delay.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/moduleparam.h> | ||
18 | #include <linux/mutex.h> | ||
19 | #include <linux/wait.h> | ||
20 | #include <linux/workqueue.h> | ||
21 | #include <asm/atomic.h> | ||
22 | |||
15 | #include <ieee1394_transactions.h> | 23 | #include <ieee1394_transactions.h> |
16 | #include <nodemgr.h> | 24 | #include <nodemgr.h> |
17 | #include <asm/byteorder.h> | 25 | |
18 | #include <linux/delay.h> | ||
19 | #include <linux/crc32.h> | ||
20 | #include "avc_api.h" | 26 | #include "avc_api.h" |
27 | #include "firesat.h" | ||
21 | #include "firesat-rc.h" | 28 | #include "firesat-rc.h" |
22 | 29 | ||
23 | #define RESPONSE_REGISTER 0xFFFFF0000D00ULL | 30 | #define RESPONSE_REGISTER 0xFFFFF0000D00ULL |
@@ -28,8 +35,6 @@ static unsigned int avc_comm_debug = 0; | |||
28 | module_param(avc_comm_debug, int, 0644); | 35 | module_param(avc_comm_debug, int, 0644); |
29 | MODULE_PARM_DESC(avc_comm_debug, "debug logging level [0..2] of AV/C communication, default is 0 (no)"); | 36 | MODULE_PARM_DESC(avc_comm_debug, "debug logging level [0..2] of AV/C communication, default is 0 (no)"); |
30 | 37 | ||
31 | static int __AVCRegisterRemoteControl(struct firesat*firesat, int internal); | ||
32 | |||
33 | /* Frees an allocated packet */ | 38 | /* Frees an allocated packet */ |
34 | static void avc_free_packet(struct hpsb_packet *packet) | 39 | static void avc_free_packet(struct hpsb_packet *packet) |
35 | { | 40 | { |
@@ -232,67 +237,39 @@ static int __AVCWrite(struct firesat *firesat, const AVCCmdFrm *CmdFrm, | |||
232 | return 0; | 237 | return 0; |
233 | } | 238 | } |
234 | 239 | ||
235 | int AVCWrite(struct firesat*firesat, const AVCCmdFrm *CmdFrm, AVCRspFrm *RspFrm) { | 240 | int AVCWrite(struct firesat*firesat, const AVCCmdFrm *CmdFrm, AVCRspFrm *RspFrm) |
241 | { | ||
236 | int ret; | 242 | int ret; |
237 | if(down_interruptible(&firesat->avc_sem)) | 243 | |
244 | if (mutex_lock_interruptible(&firesat->avc_mutex)) | ||
238 | return -EINTR; | 245 | return -EINTR; |
239 | 246 | ||
240 | ret = __AVCWrite(firesat, CmdFrm, RspFrm); | 247 | ret = __AVCWrite(firesat, CmdFrm, RspFrm); |
241 | 248 | ||
242 | up(&firesat->avc_sem); | 249 | mutex_unlock(&firesat->avc_mutex); |
243 | return ret; | 250 | return ret; |
244 | } | 251 | } |
245 | 252 | ||
246 | static void do_schedule_remotecontrol(unsigned long ignored); | 253 | int AVCRecv(struct firesat *firesat, u8 *data, size_t length) |
247 | DECLARE_TASKLET(schedule_remotecontrol, do_schedule_remotecontrol, 0); | 254 | { |
248 | 255 | AVCRspFrm *RspFrm = (AVCRspFrm *)data; | |
249 | static void do_schedule_remotecontrol(unsigned long ignored) { | 256 | |
250 | struct firesat *firesat; | 257 | if (length >= 8 && |
251 | unsigned long flags; | 258 | RspFrm->operand[0] == SFE_VENDOR_DE_COMPANYID_0 && |
252 | 259 | RspFrm->operand[1] == SFE_VENDOR_DE_COMPANYID_1 && | |
253 | spin_lock_irqsave(&firesat_list_lock, flags); | 260 | RspFrm->operand[2] == SFE_VENDOR_DE_COMPANYID_2 && |
254 | list_for_each_entry(firesat,&firesat_list,list) { | 261 | RspFrm->operand[3] == SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL) { |
255 | if(atomic_read(&firesat->reschedule_remotecontrol) == 1) { | 262 | if (RspFrm->resp == CHANGED) { |
256 | if(down_trylock(&firesat->avc_sem)) | 263 | firesat_handle_rc(RspFrm->operand[4] << 8 | |
257 | tasklet_schedule(&schedule_remotecontrol); | 264 | RspFrm->operand[5]); |
258 | else { | 265 | schedule_work(&firesat->remote_ctrl_work); |
259 | if(__AVCRegisterRemoteControl(firesat, 1) == 0) | 266 | } else if (RspFrm->resp != INTERIM) { |
260 | atomic_set(&firesat->reschedule_remotecontrol, 0); | 267 | printk(KERN_INFO "firedtv: remote control result = " |
261 | else | 268 | "%d\n", RspFrm->resp); |
262 | tasklet_schedule(&schedule_remotecontrol); | ||
263 | |||
264 | up(&firesat->avc_sem); | ||
265 | } | ||
266 | } | 269 | } |
267 | } | ||
268 | spin_unlock_irqrestore(&firesat_list_lock, flags); | ||
269 | } | ||
270 | |||
271 | int AVCRecv(struct firesat *firesat, u8 *data, size_t length) { | ||
272 | // printk(KERN_INFO "%s\n",__func__); | ||
273 | |||
274 | // remote control handling | ||
275 | |||
276 | #if 0 | ||
277 | AVCRspFrm *RspFrm = (AVCRspFrm*)data; | ||
278 | |||
279 | if(/*RspFrm->length >= 8 && ###*/ | ||
280 | ((RspFrm->operand[0] == SFE_VENDOR_DE_COMPANYID_0 && | ||
281 | RspFrm->operand[1] == SFE_VENDOR_DE_COMPANYID_1 && | ||
282 | RspFrm->operand[2] == SFE_VENDOR_DE_COMPANYID_2)) && | ||
283 | RspFrm->operand[3] == SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL) { | ||
284 | if(RspFrm->resp == CHANGED) { | ||
285 | // printk(KERN_INFO "%s: code = %02x %02x\n",__func__,RspFrm->operand[4],RspFrm->operand[5]); | ||
286 | firesat_got_remotecontrolcode((((u16)RspFrm->operand[4]) << 8) | ((u16)RspFrm->operand[5])); | ||
287 | |||
288 | // schedule | ||
289 | atomic_set(&firesat->reschedule_remotecontrol, 1); | ||
290 | tasklet_schedule(&schedule_remotecontrol); | ||
291 | } else if(RspFrm->resp != INTERIM) | ||
292 | printk(KERN_INFO "%s: remote control result = %d\n",__func__, RspFrm->resp); | ||
293 | return 0; | 270 | return 0; |
294 | } | 271 | } |
295 | #endif | 272 | |
296 | if(atomic_read(&firesat->avc_reply_received) == 1) { | 273 | if(atomic_read(&firesat->avc_reply_received) == 1) { |
297 | printk(KERN_ERR "%s: received out-of-order AVC response, " | 274 | printk(KERN_ERR "%s: received out-of-order AVC response, " |
298 | "ignored\n",__func__); | 275 | "ignored\n",__func__); |
@@ -718,7 +695,8 @@ int AVCTuner_GetTS(struct firesat *firesat){ | |||
718 | return 0; | 695 | return 0; |
719 | } | 696 | } |
720 | 697 | ||
721 | int AVCIdentifySubunit(struct firesat *firesat, unsigned char *systemId, int *transport) { | 698 | int AVCIdentifySubunit(struct firesat *firesat) |
699 | { | ||
722 | AVCCmdFrm CmdFrm; | 700 | AVCCmdFrm CmdFrm; |
723 | AVCRspFrm RspFrm; | 701 | AVCRspFrm RspFrm; |
724 | 702 | ||
@@ -752,8 +730,6 @@ int AVCIdentifySubunit(struct firesat *firesat, unsigned char *systemId, int *tr | |||
752 | printk(KERN_ERR "%s: Invalid response length\n", __func__); | 730 | printk(KERN_ERR "%s: Invalid response length\n", __func__); |
753 | return -EINVAL; | 731 | return -EINVAL; |
754 | } | 732 | } |
755 | if(systemId) | ||
756 | *systemId = RspFrm.operand[7]; | ||
757 | return 0; | 733 | return 0; |
758 | } | 734 | } |
759 | 735 | ||
@@ -901,7 +877,7 @@ int AVCSubUnitInfo(struct firesat *firesat, char *subunitcount) | |||
901 | return 0; | 877 | return 0; |
902 | } | 878 | } |
903 | 879 | ||
904 | static int __AVCRegisterRemoteControl(struct firesat*firesat, int internal) | 880 | int AVCRegisterRemoteControl(struct firesat *firesat) |
905 | { | 881 | { |
906 | AVCCmdFrm CmdFrm; | 882 | AVCCmdFrm CmdFrm; |
907 | 883 | ||
@@ -922,19 +898,16 @@ static int __AVCRegisterRemoteControl(struct firesat*firesat, int internal) | |||
922 | 898 | ||
923 | CmdFrm.length = 8; | 899 | CmdFrm.length = 8; |
924 | 900 | ||
925 | if(internal) { | 901 | return AVCWrite(firesat, &CmdFrm, NULL); |
926 | if(__AVCWrite(firesat,&CmdFrm,NULL) < 0) | ||
927 | return -EIO; | ||
928 | } else | ||
929 | if(AVCWrite(firesat,&CmdFrm,NULL) < 0) | ||
930 | return -EIO; | ||
931 | |||
932 | return 0; | ||
933 | } | 902 | } |
934 | 903 | ||
935 | int AVCRegisterRemoteControl(struct firesat*firesat) | 904 | void avc_remote_ctrl_work(struct work_struct *work) |
936 | { | 905 | { |
937 | return __AVCRegisterRemoteControl(firesat, 0); | 906 | struct firesat *firesat = |
907 | container_of(work, struct firesat, remote_ctrl_work); | ||
908 | |||
909 | /* Should it be rescheduled in failure cases? */ | ||
910 | AVCRegisterRemoteControl(firesat); | ||
938 | } | 911 | } |
939 | 912 | ||
940 | int AVCTuner_Host2Ca(struct firesat *firesat) | 913 | int AVCTuner_Host2Ca(struct firesat *firesat) |
diff --git a/drivers/media/dvb/firesat/avc_api.h b/drivers/media/dvb/firesat/avc_api.h index 041665685903..66f419a6f7c6 100644 --- a/drivers/media/dvb/firesat/avc_api.h +++ b/drivers/media/dvb/firesat/avc_api.h | |||
@@ -1,32 +1,25 @@ | |||
1 | /*************************************************************************** | ||
2 | avc_api.h - description | ||
3 | ------------------- | ||
4 | begin : Wed May 1 2000 | ||
5 | copyright : (C) 2000 by Manfred Weihs | ||
6 | copyright : (C) 2003 by Philipp Gutgsell | ||
7 | copyright : (C) 2008 by Henrik Kurelid (henrik@kurelid.se) | ||
8 | email : 0014guph@edu.fh-kaernten.ac.at | ||
9 | ***************************************************************************/ | ||
10 | |||
11 | /*************************************************************************** | ||
12 | * * | ||
13 | * This program is free software; you can redistribute it and/or modify * | ||
14 | * it under the terms of the GNU General Public License as published by * | ||
15 | * the Free Software Foundation; either version 2 of the License, or * | ||
16 | * (at your option) any later version. * | ||
17 | * * | ||
18 | ***************************************************************************/ | ||
19 | |||
20 | /* | 1 | /* |
21 | This is based on code written by Peter Halwachs, | 2 | * AV/C API |
22 | Thomas Groiss and Andreas Monitzer. | 3 | * |
23 | */ | 4 | * Copyright (C) 2000 Manfred Weihs |
24 | 5 | * Copyright (C) 2003 Philipp Gutgsell <0014guph@edu.fh-kaernten.ac.at> | |
25 | 6 | * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com> | |
26 | #ifndef __AVC_API_H__ | 7 | * Copyright (C) 2008 Ben Backx <ben@bbackx.com> |
27 | #define __AVC_API_H__ | 8 | * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se> |
28 | 9 | * | |
29 | #include <linux/dvb/frontend.h> | 10 | * This is based on code written by Peter Halwachs, Thomas Groiss and |
11 | * Andreas Monitzer. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License as | ||
15 | * published by the Free Software Foundation; either version 2 of | ||
16 | * the License, or (at your option) any later version. | ||
17 | */ | ||
18 | |||
19 | #ifndef _AVC_API_H | ||
20 | #define _AVC_API_H | ||
21 | |||
22 | #include <linux/types.h> | ||
30 | 23 | ||
31 | /************************************************************* | 24 | /************************************************************* |
32 | Constants from EN510221 | 25 | Constants from EN510221 |
@@ -416,34 +409,38 @@ typedef struct | |||
416 | 409 | ||
417 | #define LNBCONTROL_DONTCARE 0xff | 410 | #define LNBCONTROL_DONTCARE 0xff |
418 | 411 | ||
419 | 412 | struct dvb_diseqc_master_cmd; | |
420 | extern int AVCWrite(struct firesat *firesat, const AVCCmdFrm *CmdFrm, AVCRspFrm *RspFrm); | 413 | struct dvb_frontend_parameters; |
421 | extern int AVCRecv(struct firesat *firesat, u8 *data, size_t length); | 414 | struct firesat; |
422 | 415 | ||
423 | extern int AVCTuner_DSIT(struct firesat *firesat, | 416 | int AVCWrite(struct firesat *firesat, const AVCCmdFrm *CmdFrm, |
424 | int Source_Plug, | 417 | AVCRspFrm *RspFrm); |
425 | struct dvb_frontend_parameters *params, | 418 | int AVCRecv(struct firesat *firesat, u8 *data, size_t length); |
426 | __u8 *status); | 419 | |
427 | 420 | int AVCTuner_DSIT(struct firesat *firesat, int Source_Plug, | |
428 | extern int AVCTunerStatus(struct firesat *firesat, ANTENNA_INPUT_INFO *antenna_input_info); | 421 | struct dvb_frontend_parameters *params, __u8 *status); |
429 | extern int AVCTuner_DSD(struct firesat *firesat, struct dvb_frontend_parameters *params, __u8 *status); | 422 | |
430 | extern int AVCTuner_SetPIDs(struct firesat *firesat, unsigned char pidc, u16 pid[]); | 423 | int AVCTunerStatus(struct firesat *firesat, |
431 | extern int AVCTuner_GetTS(struct firesat *firesat); | 424 | ANTENNA_INPUT_INFO *antenna_input_info); |
432 | 425 | int AVCTuner_DSD(struct firesat *firesat, | |
433 | extern int AVCIdentifySubunit(struct firesat *firesat, unsigned char *systemId, int *transport); | 426 | struct dvb_frontend_parameters *params, __u8 *status); |
434 | extern int AVCLNBControl(struct firesat *firesat, char voltage, char burst, char conttone, char nrdiseq, struct dvb_diseqc_master_cmd *diseqcmd); | 427 | int AVCTuner_SetPIDs(struct firesat *firesat, unsigned char pidc, u16 pid[]); |
435 | extern int AVCSubUnitInfo(struct firesat *firesat, char *subunitcount); | 428 | int AVCTuner_GetTS(struct firesat *firesat); |
436 | extern int AVCRegisterRemoteControl(struct firesat *firesat); | 429 | |
437 | extern int AVCTuner_Host2Ca(struct firesat *firesat); | 430 | int AVCIdentifySubunit(struct firesat *firesat); |
438 | extern int avc_ca_app_info(struct firesat *firesat, char *app_info, | 431 | int AVCLNBControl(struct firesat *firesat, char voltage, char burst, |
439 | int *length); | 432 | char conttone, char nrdiseq, |
440 | extern int avc_ca_info(struct firesat *firesat, char *app_info, int *length); | 433 | struct dvb_diseqc_master_cmd *diseqcmd); |
441 | extern int avc_ca_reset(struct firesat *firesat); | 434 | int AVCSubUnitInfo(struct firesat *firesat, char *subunitcount); |
442 | extern int avc_ca_pmt(struct firesat *firesat, char *app_info, int length); | 435 | void avc_remote_ctrl_work(struct work_struct *work); |
443 | extern int avc_ca_get_time_date(struct firesat *firesat, int *interval); | 436 | int AVCRegisterRemoteControl(struct firesat *firesat); |
444 | extern int avc_ca_enter_menu(struct firesat *firesat); | 437 | int AVCTuner_Host2Ca(struct firesat *firesat); |
445 | extern int avc_ca_get_mmi(struct firesat *firesat, char *mmi_object, | 438 | int avc_ca_app_info(struct firesat *firesat, char *app_info, int *length); |
446 | int *length); | 439 | int avc_ca_info(struct firesat *firesat, char *app_info, int *length); |
447 | 440 | int avc_ca_reset(struct firesat *firesat); | |
448 | #endif | 441 | int avc_ca_pmt(struct firesat *firesat, char *app_info, int length); |
449 | 442 | int avc_ca_get_time_date(struct firesat *firesat, int *interval); | |
443 | int avc_ca_enter_menu(struct firesat *firesat); | ||
444 | int avc_ca_get_mmi(struct firesat *firesat, char *mmi_object, int *length); | ||
445 | |||
446 | #endif /* _AVC_API_H */ | ||
diff --git a/drivers/media/dvb/firesat/cmp.c b/drivers/media/dvb/firesat/cmp.c index a1291caa0674..d1bafba615e4 100644 --- a/drivers/media/dvb/firesat/cmp.c +++ b/drivers/media/dvb/firesat/cmp.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * FireSAT DVB driver | 2 | * FireDTV driver (formerly known as FireSAT) |
3 | * | 3 | * |
4 | * Copyright (c) ? | 4 | * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com> |
5 | * Copyright (c) 2008 Henrik Kurelid <henrik@kurelid.se> | 5 | * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU General Public License as | 8 | * modify it under the terms of the GNU General Public License as |
@@ -10,15 +10,19 @@ | |||
10 | * the License, or (at your option) any later version. | 10 | * the License, or (at your option) any later version. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include "cmp.h" | 13 | #include <linux/kernel.h> |
14 | #include <ieee1394.h> | 14 | #include <linux/mutex.h> |
15 | #include <nodemgr.h> | 15 | #include <linux/types.h> |
16 | #include <highlevel.h> | 16 | |
17 | #include <ohci1394.h> | ||
18 | #include <hosts.h> | 17 | #include <hosts.h> |
18 | #include <ieee1394.h> | ||
19 | #include <ieee1394_core.h> | 19 | #include <ieee1394_core.h> |
20 | #include <ieee1394_transactions.h> | 20 | #include <ieee1394_transactions.h> |
21 | #include <nodemgr.h> | ||
22 | |||
21 | #include "avc_api.h" | 23 | #include "avc_api.h" |
24 | #include "cmp.h" | ||
25 | #include "firesat.h" | ||
22 | 26 | ||
23 | typedef struct _OPCR | 27 | typedef struct _OPCR |
24 | { | 28 | { |
@@ -38,63 +42,33 @@ typedef struct _OPCR | |||
38 | 42 | ||
39 | #define FIRESAT_SPEED IEEE1394_SPEED_400 | 43 | #define FIRESAT_SPEED IEEE1394_SPEED_400 |
40 | 44 | ||
41 | /* hpsb_lock is being removed from the kernel-source, | 45 | static int cmp_read(struct firesat *firesat, void *buf, u64 addr, size_t len) |
42 | * therefor we define our own 'firesat_hpsb_lock'*/ | 46 | { |
43 | |||
44 | int send_packet_and_wait(struct hpsb_packet *packet); | ||
45 | |||
46 | int firesat_hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation, | ||
47 | u64 addr, int extcode, quadlet_t * data, quadlet_t arg) { | ||
48 | |||
49 | struct hpsb_packet *packet; | ||
50 | int retval = 0; | ||
51 | |||
52 | BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet | ||
53 | |||
54 | packet = hpsb_make_lockpacket(host, node, addr, extcode, data, arg); | ||
55 | if (!packet) | ||
56 | return -ENOMEM; | ||
57 | |||
58 | packet->generation = generation; | ||
59 | retval = send_packet_and_wait(packet); | ||
60 | if (retval < 0) | ||
61 | goto hpsb_lock_fail; | ||
62 | |||
63 | retval = hpsb_packet_success(packet); | ||
64 | |||
65 | if (retval == 0) { | ||
66 | *data = packet->data[0]; | ||
67 | } | ||
68 | |||
69 | hpsb_lock_fail: | ||
70 | hpsb_free_tlabel(packet); | ||
71 | hpsb_free_packet(packet); | ||
72 | |||
73 | return retval; | ||
74 | } | ||
75 | |||
76 | |||
77 | static int cmp_read(struct firesat *firesat, void *buffer, u64 addr, size_t length) { | ||
78 | int ret; | 47 | int ret; |
79 | if(down_interruptible(&firesat->avc_sem)) | 48 | |
49 | if (mutex_lock_interruptible(&firesat->avc_mutex)) | ||
80 | return -EINTR; | 50 | return -EINTR; |
81 | 51 | ||
82 | ret = hpsb_read(firesat->host, firesat->nodeentry->nodeid, firesat->nodeentry->generation, | 52 | ret = hpsb_read(firesat->host, firesat->nodeentry->nodeid, |
83 | addr, buffer, length); | 53 | firesat->nodeentry->generation, addr, buf, len); |
84 | 54 | ||
85 | up(&firesat->avc_sem); | 55 | mutex_unlock(&firesat->avc_mutex); |
86 | return ret; | 56 | return ret; |
87 | } | 57 | } |
88 | 58 | ||
89 | static int cmp_lock(struct firesat *firesat, quadlet_t *data, u64 addr, quadlet_t arg, int ext_tcode) { | 59 | static int cmp_lock(struct firesat *firesat, quadlet_t *data, u64 addr, |
60 | quadlet_t arg, int ext_tcode) | ||
61 | { | ||
90 | int ret; | 62 | int ret; |
91 | if(down_interruptible(&firesat->avc_sem)) | 63 | |
64 | if (mutex_lock_interruptible(&firesat->avc_mutex)) | ||
92 | return -EINTR; | 65 | return -EINTR; |
93 | 66 | ||
94 | ret = firesat_hpsb_lock(firesat->host, firesat->nodeentry->nodeid, firesat->nodeentry->generation, | 67 | ret = hpsb_lock(firesat->host, firesat->nodeentry->nodeid, |
95 | addr, ext_tcode, data, arg); | 68 | firesat->nodeentry->generation, |
69 | addr, ext_tcode, data, arg); | ||
96 | 70 | ||
97 | up(&firesat->avc_sem); | 71 | mutex_unlock(&firesat->avc_mutex); |
98 | return ret; | 72 | return ret; |
99 | } | 73 | } |
100 | 74 | ||
@@ -223,20 +197,3 @@ int try_CMPBreakPPconnection(struct firesat *firesat, int output_plug,int iso_ch | |||
223 | } | 197 | } |
224 | return 0; | 198 | return 0; |
225 | } | 199 | } |
226 | |||
227 | static void complete_packet(void *data) { | ||
228 | complete((struct completion *) data); | ||
229 | } | ||
230 | |||
231 | int send_packet_and_wait(struct hpsb_packet *packet) { | ||
232 | struct completion done; | ||
233 | int retval; | ||
234 | |||
235 | init_completion(&done); | ||
236 | hpsb_set_packet_complete_task(packet, complete_packet, &done); | ||
237 | retval = hpsb_send_packet(packet); | ||
238 | if (retval == 0) | ||
239 | wait_for_completion(&done); | ||
240 | |||
241 | return retval; | ||
242 | } | ||
diff --git a/drivers/media/dvb/firesat/cmp.h b/drivers/media/dvb/firesat/cmp.h index d43fbc29f262..600d5784dc72 100644 --- a/drivers/media/dvb/firesat/cmp.h +++ b/drivers/media/dvb/firesat/cmp.h | |||
@@ -1,9 +1,11 @@ | |||
1 | #ifndef __FIRESAT__CMP_H_ | 1 | #ifndef _CMP_H |
2 | #define __FIRESAT__CMP_H_ | 2 | #define _CMP_H |
3 | 3 | ||
4 | #include "firesat.h" | 4 | struct firesat; |
5 | 5 | ||
6 | extern int try_CMPEstablishPPconnection(struct firesat *firesat, int output_plug, int iso_channel); | 6 | int try_CMPEstablishPPconnection(struct firesat *firesat, int output_plug, |
7 | extern int try_CMPBreakPPconnection(struct firesat *firesat, int output_plug,int iso_channel); | 7 | int iso_channel); |
8 | int try_CMPBreakPPconnection(struct firesat *firesat, int output_plug, | ||
9 | int iso_channel); | ||
8 | 10 | ||
9 | #endif | 11 | #endif /* _CMP_H */ |
diff --git a/drivers/media/dvb/firesat/firesat-ci.c b/drivers/media/dvb/firesat/firesat-ci.c index 821048db283b..3ef25cc4bfdb 100644 --- a/drivers/media/dvb/firesat/firesat-ci.c +++ b/drivers/media/dvb/firesat/firesat-ci.c | |||
@@ -1,7 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * FireSAT DVB driver | 2 | * FireDTV driver (formerly known as FireSAT) |
3 | * | 3 | * |
4 | * Copyright (c) 2008 Henrik Kurelid <henrik@kurelid.se> | 4 | * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com> |
5 | * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se> | ||
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License as | 8 | * modify it under the terms of the GNU General Public License as |
@@ -9,13 +10,16 @@ | |||
9 | * the License, or (at your option) any later version. | 10 | * the License, or (at your option) any later version. |
10 | */ | 11 | */ |
11 | 12 | ||
12 | #include "firesat-ci.h" | ||
13 | #include "firesat.h" | ||
14 | #include "avc_api.h" | ||
15 | |||
16 | #include <linux/dvb/ca.h> | 13 | #include <linux/dvb/ca.h> |
14 | #include <linux/fs.h> | ||
15 | #include <linux/module.h> | ||
16 | |||
17 | #include <dvbdev.h> | 17 | #include <dvbdev.h> |
18 | 18 | ||
19 | #include "avc_api.h" | ||
20 | #include "firesat.h" | ||
21 | #include "firesat-ci.h" | ||
22 | |||
19 | static unsigned int ca_debug = 0; | 23 | static unsigned int ca_debug = 0; |
20 | module_param(ca_debug, int, 0644); | 24 | module_param(ca_debug, int, 0644); |
21 | MODULE_PARM_DESC(ca_debug, "debug logging of ca system, default is 0 (no)"); | 25 | MODULE_PARM_DESC(ca_debug, "debug logging of ca system, default is 0 (no)"); |
diff --git a/drivers/media/dvb/firesat/firesat-ci.h b/drivers/media/dvb/firesat/firesat-ci.h index dafe3f0f0cc9..04fe4061c778 100644 --- a/drivers/media/dvb/firesat/firesat-ci.h +++ b/drivers/media/dvb/firesat/firesat-ci.h | |||
@@ -1,9 +1,9 @@ | |||
1 | #ifndef __FIRESAT_CA_H | 1 | #ifndef _FIREDTV_CI_H |
2 | #define __FIRESAT_CA_H | 2 | #define _FIREDTV_CI_H |
3 | 3 | ||
4 | #include "firesat.h" | 4 | struct firesat; |
5 | 5 | ||
6 | int firesat_ca_init(struct firesat *firesat); | 6 | int firesat_ca_init(struct firesat *firesat); |
7 | void firesat_ca_release(struct firesat *firesat); | 7 | void firesat_ca_release(struct firesat *firesat); |
8 | 8 | ||
9 | #endif | 9 | #endif /* _FIREDTV_CI_H */ |
diff --git a/drivers/media/dvb/firesat/firesat-rc.c b/drivers/media/dvb/firesat/firesat-rc.c index e300b81008af..d3e08f9fe9f7 100644 --- a/drivers/media/dvb/firesat/firesat-rc.c +++ b/drivers/media/dvb/firesat/firesat-rc.c | |||
@@ -1,9 +1,26 @@ | |||
1 | #include "firesat.h" | 1 | /* |
2 | #include "firesat-rc.h" | 2 | * FireDTV driver (formerly known as FireSAT) |
3 | * | ||
4 | * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation; either version 2 of | ||
9 | * the License, or (at your option) any later version. | ||
10 | */ | ||
3 | 11 | ||
12 | #include <linux/bitops.h> | ||
4 | #include <linux/input.h> | 13 | #include <linux/input.h> |
14 | #include <linux/kernel.h> | ||
15 | #include <linux/types.h> | ||
16 | |||
17 | #include "firesat-rc.h" | ||
18 | |||
19 | /* fixed table with older keycodes, geared towards MythTV */ | ||
20 | const static u16 oldtable[] = { | ||
21 | |||
22 | /* code from device: 0x4501...0x451f */ | ||
5 | 23 | ||
6 | static u16 firesat_irtable[] = { | ||
7 | KEY_ESC, | 24 | KEY_ESC, |
8 | KEY_F9, | 25 | KEY_F9, |
9 | KEY_1, | 26 | KEY_1, |
@@ -35,50 +52,124 @@ static u16 firesat_irtable[] = { | |||
35 | KEY_RIGHT, | 52 | KEY_RIGHT, |
36 | KEY_P, | 53 | KEY_P, |
37 | KEY_M, | 54 | KEY_M, |
55 | |||
56 | /* code from device: 0x4540...0x4542 */ | ||
57 | |||
38 | KEY_R, | 58 | KEY_R, |
39 | KEY_V, | 59 | KEY_V, |
40 | KEY_C, | 60 | KEY_C, |
41 | 0 | ||
42 | }; | 61 | }; |
43 | 62 | ||
44 | static struct input_dev firesat_idev; | 63 | /* user-modifiable table for a remote as sold in 2008 */ |
64 | static u16 keytable[] = { | ||
65 | |||
66 | /* code from device: 0x0300...0x031f */ | ||
67 | |||
68 | [0x00] = KEY_POWER, | ||
69 | [0x01] = KEY_SLEEP, | ||
70 | [0x02] = KEY_STOP, | ||
71 | [0x03] = KEY_OK, | ||
72 | [0x04] = KEY_RIGHT, | ||
73 | [0x05] = KEY_1, | ||
74 | [0x06] = KEY_2, | ||
75 | [0x07] = KEY_3, | ||
76 | [0x08] = KEY_LEFT, | ||
77 | [0x09] = KEY_4, | ||
78 | [0x0a] = KEY_5, | ||
79 | [0x0b] = KEY_6, | ||
80 | [0x0c] = KEY_UP, | ||
81 | [0x0d] = KEY_7, | ||
82 | [0x0e] = KEY_8, | ||
83 | [0x0f] = KEY_9, | ||
84 | [0x10] = KEY_DOWN, | ||
85 | [0x11] = KEY_TITLE, /* "OSD" - fixme */ | ||
86 | [0x12] = KEY_0, | ||
87 | [0x13] = KEY_F20, /* "16:9" - fixme */ | ||
88 | [0x14] = KEY_SCREEN, /* "FULL" - fixme */ | ||
89 | [0x15] = KEY_MUTE, | ||
90 | [0x16] = KEY_SUBTITLE, | ||
91 | [0x17] = KEY_RECORD, | ||
92 | [0x18] = KEY_TEXT, | ||
93 | [0x19] = KEY_AUDIO, | ||
94 | [0x1a] = KEY_RED, | ||
95 | [0x1b] = KEY_PREVIOUS, | ||
96 | [0x1c] = KEY_REWIND, | ||
97 | [0x1d] = KEY_PLAYPAUSE, | ||
98 | [0x1e] = KEY_NEXT, | ||
99 | [0x1f] = KEY_VOLUMEUP, | ||
100 | |||
101 | /* code from device: 0x0340...0x0354 */ | ||
102 | |||
103 | [0x20] = KEY_CHANNELUP, | ||
104 | [0x21] = KEY_F21, /* "4:3" - fixme */ | ||
105 | [0x22] = KEY_TV, | ||
106 | [0x23] = KEY_DVD, | ||
107 | [0x24] = KEY_VCR, | ||
108 | [0x25] = KEY_AUX, | ||
109 | [0x26] = KEY_GREEN, | ||
110 | [0x27] = KEY_YELLOW, | ||
111 | [0x28] = KEY_BLUE, | ||
112 | [0x29] = KEY_CHANNEL, /* "CH.LIST" */ | ||
113 | [0x2a] = KEY_VENDOR, /* "CI" - fixme */ | ||
114 | [0x2b] = KEY_VOLUMEDOWN, | ||
115 | [0x2c] = KEY_CHANNELDOWN, | ||
116 | [0x2d] = KEY_LAST, | ||
117 | [0x2e] = KEY_INFO, | ||
118 | [0x2f] = KEY_FORWARD, | ||
119 | [0x30] = KEY_LIST, | ||
120 | [0x31] = KEY_FAVORITES, | ||
121 | [0x32] = KEY_MENU, | ||
122 | [0x33] = KEY_EPG, | ||
123 | [0x34] = KEY_EXIT, | ||
124 | }; | ||
125 | |||
126 | static struct input_dev *idev; | ||
45 | 127 | ||
46 | int firesat_register_rc(void) | 128 | int firesat_register_rc(void) |
47 | { | 129 | { |
48 | int index; | 130 | int i, err; |
131 | |||
132 | idev = input_allocate_device(); | ||
133 | if (!idev) | ||
134 | return -ENOMEM; | ||
49 | 135 | ||
50 | memset(&firesat_idev, 0, sizeof(firesat_idev)); | 136 | idev->name = "FireDTV remote control"; |
137 | idev->evbit[0] = BIT_MASK(EV_KEY); | ||
138 | idev->keycode = keytable; | ||
139 | idev->keycodesize = sizeof(keytable[0]); | ||
140 | idev->keycodemax = ARRAY_SIZE(keytable); | ||
51 | 141 | ||
52 | firesat_idev.evbit[0] = BIT(EV_KEY); | 142 | for (i = 0; i < ARRAY_SIZE(keytable); i++) |
143 | set_bit(keytable[i], idev->keybit); | ||
53 | 144 | ||
54 | for (index = 0; firesat_irtable[index] != 0; index++) | 145 | err = input_register_device(idev); |
55 | set_bit(firesat_irtable[index], firesat_idev.keybit); | 146 | if (err) |
147 | input_free_device(idev); | ||
56 | 148 | ||
57 | return input_register_device(&firesat_idev); | 149 | return err; |
58 | } | 150 | } |
59 | 151 | ||
60 | int firesat_unregister_rc(void) | 152 | void firesat_unregister_rc(void) |
61 | { | 153 | { |
62 | input_unregister_device(&firesat_idev); | 154 | input_unregister_device(idev); |
63 | return 0; | ||
64 | } | 155 | } |
65 | 156 | ||
66 | int firesat_got_remotecontrolcode(u16 code) | 157 | void firesat_handle_rc(unsigned int code) |
67 | { | 158 | { |
68 | u16 keycode; | 159 | if (code >= 0x0300 && code <= 0x031f) |
69 | 160 | code = keytable[code - 0x0300]; | |
70 | if (code > 0x4500 && code < 0x4520) | 161 | else if (code >= 0x0340 && code <= 0x0354) |
71 | keycode = firesat_irtable[code - 0x4501]; | 162 | code = keytable[code - 0x0320]; |
72 | else if (code > 0x453f && code < 0x4543) | 163 | else if (code >= 0x4501 && code <= 0x451f) |
73 | keycode = firesat_irtable[code - 0x4521]; | 164 | code = oldtable[code - 0x4501]; |
165 | else if (code >= 0x4540 && code <= 0x4542) | ||
166 | code = oldtable[code - 0x4521]; | ||
74 | else { | 167 | else { |
75 | printk(KERN_DEBUG "%s: invalid key code 0x%04x\n", __func__, | 168 | printk(KERN_DEBUG "firedtv: invalid key code 0x%04x " |
76 | code); | 169 | "from remote control\n", code); |
77 | return -EINVAL; | 170 | return; |
78 | } | 171 | } |
79 | 172 | ||
80 | input_report_key(&firesat_idev, keycode, 1); | 173 | input_report_key(idev, code, 1); |
81 | input_report_key(&firesat_idev, keycode, 0); | 174 | input_report_key(idev, code, 0); |
82 | |||
83 | return 0; | ||
84 | } | 175 | } |
diff --git a/drivers/media/dvb/firesat/firesat-rc.h b/drivers/media/dvb/firesat/firesat-rc.h index e89a8069ba88..81f4fdec60f1 100644 --- a/drivers/media/dvb/firesat/firesat-rc.h +++ b/drivers/media/dvb/firesat/firesat-rc.h | |||
@@ -1,9 +1,8 @@ | |||
1 | #ifndef __FIRESAT_LIRC_H | 1 | #ifndef _FIREDTV_RC_H |
2 | #define __FIRESAT_LIRC_H | 2 | #define _FIREDTV_RC_H |
3 | 3 | ||
4 | extern int firesat_register_rc(void); | 4 | int firesat_register_rc(void); |
5 | extern int firesat_unregister_rc(void); | 5 | void firesat_unregister_rc(void); |
6 | extern int firesat_got_remotecontrolcode(u16 code); | 6 | void firesat_handle_rc(unsigned int code); |
7 | |||
8 | #endif | ||
9 | 7 | ||
8 | #endif /* _FIREDTV_RC_H */ | ||
diff --git a/drivers/media/dvb/firesat/firesat.h b/drivers/media/dvb/firesat/firesat.h index f0bac244783a..5f0de88e41a6 100644 --- a/drivers/media/dvb/firesat/firesat.h +++ b/drivers/media/dvb/firesat/firesat.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * FireSAT DVB driver | 2 | * FireDTV driver (formerly known as FireSAT) |
3 | * | 3 | * |
4 | * Copyright (c) ? | 4 | * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com> |
5 | * Copyright (c) 2008 Henrik Kurelid <henrik@kurelid.se> | 5 | * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU General Public License as | 8 | * modify it under the terms of the GNU General Public License as |
@@ -10,22 +10,26 @@ | |||
10 | * the License, or (at your option) any later version. | 10 | * the License, or (at your option) any later version. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #ifndef __FIRESAT_H | 13 | #ifndef _FIREDTV_H |
14 | #define __FIRESAT_H | 14 | #define _FIREDTV_H |
15 | 15 | ||
16 | #include "dvb_frontend.h" | ||
17 | #include "dmxdev.h" | ||
18 | #include "dvb_demux.h" | ||
19 | #include "dvb_net.h" | ||
20 | |||
21 | #include <linux/version.h> | ||
22 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25) | ||
23 | #include <linux/semaphore.h> | ||
24 | #endif | ||
25 | #include <linux/dvb/frontend.h> | ||
26 | #include <linux/dvb/dmx.h> | 16 | #include <linux/dvb/dmx.h> |
27 | #include <iso.h> | 17 | #include <linux/dvb/frontend.h> |
18 | #include <linux/list.h> | ||
19 | #include <linux/mutex.h> | ||
20 | #include <linux/spinlock_types.h> | ||
21 | #include <linux/types.h> | ||
22 | #include <linux/wait.h> | ||
23 | #include <linux/workqueue.h> | ||
24 | #include <asm/atomic.h> | ||
25 | |||
26 | #include <demux.h> | ||
27 | #include <dmxdev.h> | ||
28 | #include <dvb_demux.h> | ||
29 | #include <dvb_net.h> | ||
30 | #include <dvbdev.h> | ||
28 | 31 | ||
32 | #include <linux/version.h> | ||
29 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25) | 33 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25) |
30 | #define DVB_REGISTER_ADAPTER(x, y, z, w, v) dvb_register_adapter(x, y, z, w, v) | 34 | #define DVB_REGISTER_ADAPTER(x, y, z, w, v) dvb_register_adapter(x, y, z, w, v) |
31 | #else | 35 | #else |
@@ -116,15 +120,19 @@ | |||
116 | 120 | ||
117 | 121 | ||
118 | enum model_type { | 122 | enum model_type { |
119 | FireSAT_DVB_S = 1, | 123 | FireSAT_UNKNOWN = 0, |
120 | FireSAT_DVB_C = 2, | 124 | FireSAT_DVB_S = 1, |
121 | FireSAT_DVB_T = 3, | 125 | FireSAT_DVB_C = 2, |
122 | FireSAT_DVB_S2 = 4 | 126 | FireSAT_DVB_T = 3, |
127 | FireSAT_DVB_S2 = 4, | ||
123 | }; | 128 | }; |
124 | 129 | ||
130 | struct hpsb_host; | ||
131 | struct hpsb_iso; | ||
132 | struct node_entry; | ||
133 | |||
125 | struct firesat { | 134 | struct firesat { |
126 | struct dvb_demux dvb_demux; | 135 | struct dvb_demux dvb_demux; |
127 | char *model_name; | ||
128 | 136 | ||
129 | /* DVB bits */ | 137 | /* DVB bits */ |
130 | struct dvb_adapter *adapter; | 138 | struct dvb_adapter *adapter; |
@@ -139,11 +147,10 @@ struct firesat { | |||
139 | int ca_last_command; | 147 | int ca_last_command; |
140 | int ca_time_interval; | 148 | int ca_time_interval; |
141 | 149 | ||
142 | struct semaphore avc_sem; | 150 | struct mutex avc_mutex; |
143 | wait_queue_head_t avc_wait; | 151 | wait_queue_head_t avc_wait; |
144 | atomic_t avc_reply_received; | 152 | atomic_t avc_reply_received; |
145 | 153 | struct work_struct remote_ctrl_work; | |
146 | atomic_t reschedule_remotecontrol; | ||
147 | 154 | ||
148 | struct firesat_channel { | 155 | struct firesat_channel { |
149 | struct firesat *firesat; | 156 | struct firesat *firesat; |
@@ -154,7 +161,7 @@ struct firesat { | |||
154 | int pid; | 161 | int pid; |
155 | int type; /* 1 - TS, 2 - Filter */ | 162 | int type; /* 1 - TS, 2 - Filter */ |
156 | } channel[16]; | 163 | } channel[16]; |
157 | struct semaphore demux_sem; | 164 | struct mutex demux_mutex; |
158 | 165 | ||
159 | /* needed by avc_api */ | 166 | /* needed by avc_api */ |
160 | void *respfrm; | 167 | void *respfrm; |
@@ -210,22 +217,23 @@ struct CIPHeader { | |||
210 | }; | 217 | }; |
211 | }; | 218 | }; |
212 | 219 | ||
220 | extern const char *firedtv_model_names[]; | ||
213 | extern struct list_head firesat_list; | 221 | extern struct list_head firesat_list; |
214 | extern spinlock_t firesat_list_lock; | 222 | extern spinlock_t firesat_list_lock; |
215 | 223 | ||
224 | struct device; | ||
225 | |||
216 | /* firesat_dvb.c */ | 226 | /* firesat_dvb.c */ |
217 | extern int firesat_start_feed(struct dvb_demux_feed *dvbdmxfeed); | 227 | int firesat_start_feed(struct dvb_demux_feed *dvbdmxfeed); |
218 | extern int firesat_stop_feed(struct dvb_demux_feed *dvbdmxfeed); | 228 | int firesat_stop_feed(struct dvb_demux_feed *dvbdmxfeed); |
219 | extern int firesat_dvbdev_init(struct firesat *firesat, | 229 | int firesat_dvbdev_init(struct firesat *firesat, struct device *dev, |
220 | struct device *dev, | 230 | struct dvb_frontend *fe); |
221 | struct dvb_frontend *fe); | ||
222 | 231 | ||
223 | /* firesat_fe.c */ | 232 | /* firesat_fe.c */ |
224 | extern int firesat_frontend_attach(struct firesat *firesat, | 233 | int firesat_frontend_attach(struct firesat *firesat, struct dvb_frontend *fe); |
225 | struct dvb_frontend *fe); | ||
226 | 234 | ||
227 | /* firesat_iso.c */ | 235 | /* firesat_iso.c */ |
228 | extern int setup_iso_channel(struct firesat *firesat); | 236 | int setup_iso_channel(struct firesat *firesat); |
229 | extern void tear_down_iso_channel(struct firesat *firesat); | 237 | void tear_down_iso_channel(struct firesat *firesat); |
230 | 238 | ||
231 | #endif | 239 | #endif /* _FIREDTV_H */ |
diff --git a/drivers/media/dvb/firesat/firesat_1394.c b/drivers/media/dvb/firesat/firesat_1394.c index b19e59416b59..a13fbe6b3a3c 100644 --- a/drivers/media/dvb/firesat/firesat_1394.c +++ b/drivers/media/dvb/firesat/firesat_1394.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * FireSAT DVB driver | 2 | * FireDTV driver (formerly known as FireSAT) |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Andreas Monitzer <andy@monitzer.com> | 4 | * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com> |
5 | * Copyright (c) 2007-2008 Ben Backx <ben@bbackx.com> | 5 | * Copyright (C) 2007-2008 Ben Backx <ben@bbackx.com> |
6 | * Copyright (c) 2008 Henrik Kurelid <henrik@kurelid.se> | 6 | * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License as | 9 | * modify it under the terms of the GNU General Public License as |
@@ -11,26 +11,34 @@ | |||
11 | * the License, or (at your option) any later version. | 11 | * the License, or (at your option) any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/init.h> | 14 | #include <linux/device.h> |
15 | #include <linux/slab.h> | ||
16 | #include <linux/wait.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/delay.h> | ||
19 | #include <linux/time.h> | ||
20 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
21 | #include <linux/interrupt.h> | 16 | #include <linux/kernel.h> |
22 | #include <ieee1394_hotplug.h> | 17 | #include <linux/list.h> |
23 | #include <nodemgr.h> | 18 | #include <linux/module.h> |
19 | #include <linux/mutex.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/spinlock.h> | ||
22 | #include <linux/string.h> | ||
23 | #include <linux/types.h> | ||
24 | #include <asm/atomic.h> | ||
25 | |||
26 | #include <dmxdev.h> | ||
27 | #include <dvb_demux.h> | ||
28 | #include <dvb_frontend.h> | ||
29 | #include <dvbdev.h> | ||
30 | |||
31 | #include <csr1212.h> | ||
24 | #include <highlevel.h> | 32 | #include <highlevel.h> |
25 | #include <ohci1394.h> | ||
26 | #include <hosts.h> | 33 | #include <hosts.h> |
27 | #include <dvbdev.h> | 34 | #include <ieee1394_hotplug.h> |
35 | #include <nodemgr.h> | ||
28 | 36 | ||
29 | #include "firesat.h" | ||
30 | #include "avc_api.h" | 37 | #include "avc_api.h" |
31 | #include "cmp.h" | 38 | #include "cmp.h" |
32 | #include "firesat-rc.h" | 39 | #include "firesat.h" |
33 | #include "firesat-ci.h" | 40 | #include "firesat-ci.h" |
41 | #include "firesat-rc.h" | ||
34 | 42 | ||
35 | #define FIRESAT_Vendor_ID 0x001287 | 43 | #define FIRESAT_Vendor_ID 0x001287 |
36 | 44 | ||
@@ -75,52 +83,6 @@ MODULE_DEVICE_TABLE(ieee1394, firesat_id_table); | |||
75 | LIST_HEAD(firesat_list); | 83 | LIST_HEAD(firesat_list); |
76 | spinlock_t firesat_list_lock = SPIN_LOCK_UNLOCKED; | 84 | spinlock_t firesat_list_lock = SPIN_LOCK_UNLOCKED; |
77 | 85 | ||
78 | static void firesat_add_host(struct hpsb_host *host); | ||
79 | static void firesat_remove_host(struct hpsb_host *host); | ||
80 | static void firesat_host_reset(struct hpsb_host *host); | ||
81 | |||
82 | static void fcp_request(struct hpsb_host *host, | ||
83 | int nodeid, | ||
84 | int direction, | ||
85 | int cts, | ||
86 | u8 *data, | ||
87 | size_t length); | ||
88 | |||
89 | static struct hpsb_highlevel firesat_highlevel = { | ||
90 | .name = "FireSAT", | ||
91 | .add_host = firesat_add_host, | ||
92 | .remove_host = firesat_remove_host, | ||
93 | .host_reset = firesat_host_reset, | ||
94 | .fcp_request = fcp_request, | ||
95 | }; | ||
96 | |||
97 | static void firesat_add_host (struct hpsb_host *host) | ||
98 | { | ||
99 | struct ti_ohci *ohci = (struct ti_ohci *)host->hostdata; | ||
100 | |||
101 | /* We only work with the OHCI-1394 driver */ | ||
102 | if (strcmp(host->driver->name, OHCI1394_DRIVER_NAME)) | ||
103 | return; | ||
104 | |||
105 | if (!hpsb_create_hostinfo(&firesat_highlevel, host, 0)) { | ||
106 | printk(KERN_ERR "Cannot allocate hostinfo\n"); | ||
107 | return; | ||
108 | } | ||
109 | |||
110 | hpsb_set_hostinfo(&firesat_highlevel, host, ohci); | ||
111 | hpsb_set_hostinfo_key(&firesat_highlevel, host, ohci->host->id); | ||
112 | } | ||
113 | |||
114 | static void firesat_remove_host (struct hpsb_host *host) | ||
115 | { | ||
116 | |||
117 | } | ||
118 | |||
119 | static void firesat_host_reset(struct hpsb_host *host) | ||
120 | { | ||
121 | printk(KERN_INFO "FireSAT host_reset (nodeid = 0x%x, hosts active = %d)\n",host->node_id,host->nodes_active); | ||
122 | } | ||
123 | |||
124 | static void fcp_request(struct hpsb_host *host, | 86 | static void fcp_request(struct hpsb_host *host, |
125 | int nodeid, | 87 | int nodeid, |
126 | int direction, | 88 | int direction, |
@@ -156,6 +118,14 @@ static void fcp_request(struct hpsb_host *host, | |||
156 | printk("%s: received invalid fcp request, ignored\n", __func__); | 118 | printk("%s: received invalid fcp request, ignored\n", __func__); |
157 | } | 119 | } |
158 | 120 | ||
121 | const char *firedtv_model_names[] = { | ||
122 | [FireSAT_UNKNOWN] = "unknown type", | ||
123 | [FireSAT_DVB_S] = "FireDTV S/CI", | ||
124 | [FireSAT_DVB_C] = "FireDTV C/CI", | ||
125 | [FireSAT_DVB_T] = "FireDTV T/CI", | ||
126 | [FireSAT_DVB_S2] = "FireDTV S2 ", | ||
127 | }; | ||
128 | |||
159 | static int firesat_probe(struct device *dev) | 129 | static int firesat_probe(struct device *dev) |
160 | { | 130 | { |
161 | struct unit_directory *ud = container_of(dev, struct unit_directory, device); | 131 | struct unit_directory *ud = container_of(dev, struct unit_directory, device); |
@@ -165,6 +135,7 @@ static int firesat_probe(struct device *dev) | |||
165 | unsigned char subunitcount = 0xff, subunit; | 135 | unsigned char subunitcount = 0xff, subunit; |
166 | struct firesat **firesats = kmalloc(sizeof (void*) * 2,GFP_KERNEL); | 136 | struct firesat **firesats = kmalloc(sizeof (void*) * 2,GFP_KERNEL); |
167 | int kv_len; | 137 | int kv_len; |
138 | int i; | ||
168 | char *kv_buf; | 139 | char *kv_buf; |
169 | 140 | ||
170 | if (!firesats) { | 141 | if (!firesats) { |
@@ -207,11 +178,11 @@ static int firesat_probe(struct device *dev) | |||
207 | return -ENOMEM; | 178 | return -ENOMEM; |
208 | } | 179 | } |
209 | 180 | ||
210 | sema_init(&firesat->avc_sem, 1); | 181 | mutex_init(&firesat->avc_mutex); |
211 | init_waitqueue_head(&firesat->avc_wait); | 182 | init_waitqueue_head(&firesat->avc_wait); |
212 | atomic_set(&firesat->avc_reply_received, 1); | 183 | atomic_set(&firesat->avc_reply_received, 1); |
213 | sema_init(&firesat->demux_sem, 1); | 184 | mutex_init(&firesat->demux_mutex); |
214 | atomic_set(&firesat->reschedule_remotecontrol, 0); | 185 | INIT_WORK(&firesat->remote_ctrl_work, avc_remote_ctrl_work); |
215 | 186 | ||
216 | spin_lock_irqsave(&firesat_list_lock, flags); | 187 | spin_lock_irqsave(&firesat_list_lock, flags); |
217 | INIT_LIST_HEAD(&firesat->list); | 188 | INIT_LIST_HEAD(&firesat->list); |
@@ -244,23 +215,13 @@ static int firesat_probe(struct device *dev) | |||
244 | while ((kv_buf + kv_len - 1) == '\0') kv_len--; | 215 | while ((kv_buf + kv_len - 1) == '\0') kv_len--; |
245 | kv_buf[kv_len++] = '\0'; | 216 | kv_buf[kv_len++] = '\0'; |
246 | 217 | ||
247 | /* Determining the device model */ | 218 | for (i = ARRAY_SIZE(firedtv_model_names); --i;) |
248 | if (strcmp(kv_buf, "FireDTV S/CI") == 0) { | 219 | if (strcmp(kv_buf, firedtv_model_names[i]) == 0) |
249 | printk(KERN_INFO "%s: found DVB/S\n", __func__); | 220 | break; |
250 | firesat->type = 1; | 221 | firesat->type = i; |
251 | } else if (strcmp(kv_buf, "FireDTV C/CI") == 0) { | ||
252 | printk(KERN_INFO "%s: found DVB/C\n", __func__); | ||
253 | firesat->type = 2; | ||
254 | } else if (strcmp(kv_buf, "FireDTV T/CI") == 0) { | ||
255 | printk(KERN_INFO "%s: found DVB/T\n", __func__); | ||
256 | firesat->type = 3; | ||
257 | } else if (strcmp(kv_buf, "FireDTV S2 ") == 0) { | ||
258 | printk(KERN_INFO "%s: found DVB/S2\n", __func__); | ||
259 | firesat->type = 4; | ||
260 | } | ||
261 | kfree(kv_buf); | 222 | kfree(kv_buf); |
262 | 223 | ||
263 | if (AVCIdentifySubunit(firesat, NULL, (int*)&firesat->type)) { | 224 | if (AVCIdentifySubunit(firesat)) { |
264 | printk("%s: cannot identify subunit %d\n", __func__, subunit); | 225 | printk("%s: cannot identify subunit %d\n", __func__, subunit); |
265 | spin_lock_irqsave(&firesat_list_lock, flags); | 226 | spin_lock_irqsave(&firesat_list_lock, flags); |
266 | list_del(&firesat->list); | 227 | list_del(&firesat->list); |
@@ -270,14 +231,14 @@ static int firesat_probe(struct device *dev) | |||
270 | } | 231 | } |
271 | 232 | ||
272 | // ---- | 233 | // ---- |
234 | /* FIXME: check for error return */ | ||
273 | firesat_dvbdev_init(firesat, dev, fe); | 235 | firesat_dvbdev_init(firesat, dev, fe); |
274 | // ---- | 236 | // ---- |
275 | firesats[subunit] = firesat; | 237 | firesats[subunit] = firesat; |
276 | } // loop for all tuners | 238 | } // loop for all tuners |
277 | 239 | ||
278 | //beta ;-) Disable remote control stuff to avoid crashing | 240 | if (firesats[0]) |
279 | //if(firesats[0]) | 241 | AVCRegisterRemoteControl(firesats[0]); |
280 | // AVCRegisterRemoteControl(firesats[0]); | ||
281 | 242 | ||
282 | return 0; | 243 | return 0; |
283 | } | 244 | } |
@@ -306,6 +267,8 @@ static int firesat_remove(struct device *dev) | |||
306 | list_del(&firesats[k]->list); | 267 | list_del(&firesats[k]->list); |
307 | spin_unlock_irqrestore(&firesat_list_lock, flags); | 268 | spin_unlock_irqrestore(&firesat_list_lock, flags); |
308 | 269 | ||
270 | cancel_work_sync(&firesats[k]->remote_ctrl_work); | ||
271 | |||
309 | kfree(firesats[k]->fe); | 272 | kfree(firesats[k]->fe); |
310 | kfree(firesats[k]->adapter); | 273 | kfree(firesats[k]->adapter); |
311 | kfree(firesats[k]->respfrm); | 274 | kfree(firesats[k]->respfrm); |
@@ -339,7 +302,7 @@ static int firesat_update(struct unit_directory *ud) | |||
339 | 302 | ||
340 | static struct hpsb_protocol_driver firesat_driver = { | 303 | static struct hpsb_protocol_driver firesat_driver = { |
341 | 304 | ||
342 | .name = "FireSAT", | 305 | .name = "firedtv", |
343 | .id_table = firesat_id_table, | 306 | .id_table = firesat_id_table, |
344 | .update = firesat_update, | 307 | .update = firesat_update, |
345 | 308 | ||
@@ -352,32 +315,41 @@ static struct hpsb_protocol_driver firesat_driver = { | |||
352 | }, | 315 | }, |
353 | }; | 316 | }; |
354 | 317 | ||
318 | static struct hpsb_highlevel firesat_highlevel = { | ||
319 | .name = "firedtv", | ||
320 | .fcp_request = fcp_request, | ||
321 | }; | ||
322 | |||
355 | static int __init firesat_init(void) | 323 | static int __init firesat_init(void) |
356 | { | 324 | { |
357 | int ret; | 325 | int ret; |
358 | 326 | ||
359 | printk(KERN_INFO "FireSAT loaded\n"); | ||
360 | hpsb_register_highlevel(&firesat_highlevel); | 327 | hpsb_register_highlevel(&firesat_highlevel); |
361 | ret = hpsb_register_protocol(&firesat_driver); | 328 | ret = hpsb_register_protocol(&firesat_driver); |
362 | if (ret) { | 329 | if (ret) { |
363 | printk(KERN_ERR "FireSAT: failed to register protocol\n"); | 330 | printk(KERN_ERR "firedtv: failed to register protocol\n"); |
364 | hpsb_unregister_highlevel(&firesat_highlevel); | 331 | goto fail; |
365 | return ret; | ||
366 | } | 332 | } |
367 | 333 | ||
368 | //Crash in this function, just disable RC for the time being... | 334 | ret = firesat_register_rc(); |
369 | //Don't forget to uncomment in firesat_exit and firesat_probe when you enable this. | 335 | if (ret) { |
370 | /*if((ret=firesat_register_rc())) | 336 | printk(KERN_ERR "firedtv: failed to register input device\n"); |
371 | printk("%s: firesat_register_rc return error code %d (ignored)\n", __func__, ret);*/ | 337 | goto fail_rc; |
338 | } | ||
372 | 339 | ||
373 | return 0; | 340 | return 0; |
341 | fail_rc: | ||
342 | hpsb_unregister_protocol(&firesat_driver); | ||
343 | fail: | ||
344 | hpsb_unregister_highlevel(&firesat_highlevel); | ||
345 | return ret; | ||
374 | } | 346 | } |
375 | 347 | ||
376 | static void __exit firesat_exit(void) | 348 | static void __exit firesat_exit(void) |
377 | { | 349 | { |
350 | firesat_unregister_rc(); | ||
378 | hpsb_unregister_protocol(&firesat_driver); | 351 | hpsb_unregister_protocol(&firesat_driver); |
379 | hpsb_unregister_highlevel(&firesat_highlevel); | 352 | hpsb_unregister_highlevel(&firesat_highlevel); |
380 | printk(KERN_INFO "FireSAT quit\n"); | ||
381 | } | 353 | } |
382 | 354 | ||
383 | module_init(firesat_init); | 355 | module_init(firesat_init); |
@@ -385,6 +357,6 @@ module_exit(firesat_exit); | |||
385 | 357 | ||
386 | MODULE_AUTHOR("Andreas Monitzer <andy@monitzer.com>"); | 358 | MODULE_AUTHOR("Andreas Monitzer <andy@monitzer.com>"); |
387 | MODULE_AUTHOR("Ben Backx <ben@bbackx.com>"); | 359 | MODULE_AUTHOR("Ben Backx <ben@bbackx.com>"); |
388 | MODULE_DESCRIPTION("FireSAT DVB Driver"); | 360 | MODULE_DESCRIPTION("FireDTV DVB Driver"); |
389 | MODULE_LICENSE("GPL"); | 361 | MODULE_LICENSE("GPL"); |
390 | MODULE_SUPPORTED_DEVICE("FireSAT DVB"); | 362 | MODULE_SUPPORTED_DEVICE("FireDTV DVB"); |
diff --git a/drivers/media/dvb/firesat/firesat_dvb.c b/drivers/media/dvb/firesat/firesat_dvb.c index 9e87402289a6..e944cee19f0a 100644 --- a/drivers/media/dvb/firesat/firesat_dvb.c +++ b/drivers/media/dvb/firesat/firesat_dvb.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * FireSAT DVB driver | 2 | * FireDTV driver (formerly known as FireSAT) |
3 | * | 3 | * |
4 | * Copyright (c) ? | 4 | * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com> |
5 | * Copyright (c) 2008 Henrik Kurelid <henrik@kurelid.se> | 5 | * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU General Public License as | 8 | * modify it under the terms of the GNU General Public License as |
@@ -10,64 +10,52 @@ | |||
10 | * the License, or (at your option) any later version. | 10 | * the License, or (at your option) any later version. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/slab.h> | ||
15 | #include <linux/wait.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/time.h> | ||
19 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
20 | #include <linux/interrupt.h> | 14 | #include <linux/kernel.h> |
21 | #include <ieee1394_hotplug.h> | 15 | #include <linux/mutex.h> |
22 | #include <nodemgr.h> | 16 | #include <linux/types.h> |
23 | #include <highlevel.h> | 17 | |
24 | #include <ohci1394.h> | 18 | #include <dvb_demux.h> |
25 | #include <hosts.h> | 19 | #include <dvb_frontend.h> |
26 | #include <dvbdev.h> | 20 | #include <dvbdev.h> |
27 | 21 | ||
28 | #include "firesat.h" | ||
29 | #include "avc_api.h" | 22 | #include "avc_api.h" |
30 | #include "cmp.h" | 23 | #include "firesat.h" |
31 | #include "firesat-rc.h" | ||
32 | #include "firesat-ci.h" | 24 | #include "firesat-ci.h" |
33 | 25 | ||
34 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 26 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
35 | 27 | ||
36 | static struct firesat_channel *firesat_channel_allocate(struct firesat *firesat) | 28 | static struct firesat_channel *firesat_channel_allocate(struct firesat *firesat) |
37 | { | 29 | { |
30 | struct firesat_channel *c = NULL; | ||
38 | int k; | 31 | int k; |
39 | 32 | ||
40 | //printk(KERN_INFO "%s\n", __func__); | 33 | if (mutex_lock_interruptible(&firesat->demux_mutex)) |
41 | |||
42 | if (down_interruptible(&firesat->demux_sem)) | ||
43 | return NULL; | 34 | return NULL; |
44 | 35 | ||
45 | for (k = 0; k < 16; k++) { | 36 | for (k = 0; k < 16; k++) |
46 | //printk(KERN_INFO "%s: channel %d: active = %d, pid = 0x%x\n",__func__,k,firesat->channel[k].active,firesat->channel[k].pid); | ||
47 | |||
48 | if (firesat->channel[k].active == 0) { | 37 | if (firesat->channel[k].active == 0) { |
49 | firesat->channel[k].active = 1; | 38 | firesat->channel[k].active = 1; |
50 | up(&firesat->demux_sem); | 39 | c = &firesat->channel[k]; |
51 | return &firesat->channel[k]; | 40 | break; |
52 | } | 41 | } |
53 | } | ||
54 | 42 | ||
55 | up(&firesat->demux_sem); | 43 | mutex_unlock(&firesat->demux_mutex); |
56 | return NULL; // no more channels available | 44 | return c; |
57 | } | 45 | } |
58 | 46 | ||
59 | static int firesat_channel_collect(struct firesat *firesat, int *pidc, u16 pid[]) | 47 | static int firesat_channel_collect(struct firesat *firesat, int *pidc, u16 pid[]) |
60 | { | 48 | { |
61 | int k, l = 0; | 49 | int k, l = 0; |
62 | 50 | ||
63 | if (down_interruptible(&firesat->demux_sem)) | 51 | if (mutex_lock_interruptible(&firesat->demux_mutex)) |
64 | return -EINTR; | 52 | return -EINTR; |
65 | 53 | ||
66 | for (k = 0; k < 16; k++) | 54 | for (k = 0; k < 16; k++) |
67 | if (firesat->channel[k].active == 1) | 55 | if (firesat->channel[k].active == 1) |
68 | pid[l++] = firesat->channel[k].pid; | 56 | pid[l++] = firesat->channel[k].pid; |
69 | 57 | ||
70 | up(&firesat->demux_sem); | 58 | mutex_unlock(&firesat->demux_mutex); |
71 | 59 | ||
72 | *pidc = l; | 60 | *pidc = l; |
73 | 61 | ||
@@ -77,12 +65,12 @@ static int firesat_channel_collect(struct firesat *firesat, int *pidc, u16 pid[] | |||
77 | static int firesat_channel_release(struct firesat *firesat, | 65 | static int firesat_channel_release(struct firesat *firesat, |
78 | struct firesat_channel *channel) | 66 | struct firesat_channel *channel) |
79 | { | 67 | { |
80 | if (down_interruptible(&firesat->demux_sem)) | 68 | if (mutex_lock_interruptible(&firesat->demux_mutex)) |
81 | return -EINTR; | 69 | return -EINTR; |
82 | 70 | ||
83 | channel->active = 0; | 71 | channel->active = 0; |
84 | 72 | ||
85 | up(&firesat->demux_sem); | 73 | mutex_unlock(&firesat->demux_mutex); |
86 | return 0; | 74 | return 0; |
87 | } | 75 | } |
88 | 76 | ||
@@ -172,7 +160,8 @@ int firesat_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
172 | { | 160 | { |
173 | struct dvb_demux *demux = dvbdmxfeed->demux; | 161 | struct dvb_demux *demux = dvbdmxfeed->demux; |
174 | struct firesat *firesat = (struct firesat*)demux->priv; | 162 | struct firesat *firesat = (struct firesat*)demux->priv; |
175 | int k, l = 0; | 163 | struct firesat_channel *c = dvbdmxfeed->priv; |
164 | int k, l; | ||
176 | u16 pids[16]; | 165 | u16 pids[16]; |
177 | 166 | ||
178 | //printk(KERN_INFO "%s (pid %u)\n", __func__, dvbdmxfeed->pid); | 167 | //printk(KERN_INFO "%s (pid %u)\n", __func__, dvbdmxfeed->pid); |
@@ -197,30 +186,24 @@ int firesat_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
197 | return 0; | 186 | return 0; |
198 | } | 187 | } |
199 | 188 | ||
200 | if (down_interruptible(&firesat->demux_sem)) | 189 | if (mutex_lock_interruptible(&firesat->demux_mutex)) |
201 | return -EINTR; | 190 | return -EINTR; |
202 | 191 | ||
203 | 192 | /* list except channel to be removed */ | |
204 | // list except channel to be removed | 193 | for (k = 0, l = 0; k < 16; k++) |
205 | for (k = 0; k < 16; k++) | ||
206 | if (firesat->channel[k].active == 1) { | 194 | if (firesat->channel[k].active == 1) { |
207 | if (&firesat->channel[k] != | 195 | if (&firesat->channel[k] != c) |
208 | (struct firesat_channel *)dvbdmxfeed->priv) | ||
209 | pids[l++] = firesat->channel[k].pid; | 196 | pids[l++] = firesat->channel[k].pid; |
210 | else | 197 | else |
211 | firesat->channel[k].active = 0; | 198 | firesat->channel[k].active = 0; |
212 | } | 199 | } |
213 | 200 | ||
214 | if ((k = AVCTuner_SetPIDs(firesat, l, pids))) { | 201 | k = AVCTuner_SetPIDs(firesat, l, pids); |
215 | up(&firesat->demux_sem); | 202 | if (!k) |
216 | return k; | 203 | c->active = 0; |
217 | } | ||
218 | 204 | ||
219 | ((struct firesat_channel *)dvbdmxfeed->priv)->active = 0; | 205 | mutex_unlock(&firesat->demux_mutex); |
220 | 206 | return k; | |
221 | up(&firesat->demux_sem); | ||
222 | |||
223 | return 0; | ||
224 | } | 207 | } |
225 | 208 | ||
226 | int firesat_dvbdev_init(struct firesat *firesat, | 209 | int firesat_dvbdev_init(struct firesat *firesat, |
@@ -229,60 +212,20 @@ int firesat_dvbdev_init(struct firesat *firesat, | |||
229 | { | 212 | { |
230 | int result; | 213 | int result; |
231 | 214 | ||
232 | #if 0 | 215 | firesat->adapter = kmalloc(sizeof(*firesat->adapter), GFP_KERNEL); |
233 | switch (firesat->type) { | 216 | if (!firesat->adapter) { |
234 | case FireSAT_DVB_S: | 217 | printk(KERN_ERR "firedtv: couldn't allocate memory\n"); |
235 | firesat->model_name = "FireSAT DVB-S"; | 218 | return -ENOMEM; |
236 | firesat->frontend_info = &firesat_S_frontend_info; | 219 | } |
237 | break; | ||
238 | case FireSAT_DVB_C: | ||
239 | firesat->model_name = "FireSAT DVB-C"; | ||
240 | firesat->frontend_info = &firesat_C_frontend_info; | ||
241 | break; | ||
242 | case FireSAT_DVB_T: | ||
243 | firesat->model_name = "FireSAT DVB-T"; | ||
244 | firesat->frontend_info = &firesat_T_frontend_info; | ||
245 | break; | ||
246 | default: | ||
247 | printk("%s: unknown model type 0x%x on subunit %d!\n", | ||
248 | __func__, firesat->type,subunit); | ||
249 | firesat->model_name = "Unknown"; | ||
250 | firesat->frontend_info = NULL; | ||
251 | } | ||
252 | #endif | ||
253 | /* // ------- CRAP ----------- | ||
254 | if (!firesat->frontend_info) { | ||
255 | spin_lock_irqsave(&firesat_list_lock, flags); | ||
256 | list_del(&firesat->list); | ||
257 | spin_unlock_irqrestore(&firesat_list_lock, flags); | ||
258 | kfree(firesat); | ||
259 | continue; | ||
260 | } | ||
261 | */ | ||
262 | //initialising firesat->adapter before calling dvb_register_adapter | ||
263 | if (!(firesat->adapter = kmalloc(sizeof (struct dvb_adapter), GFP_KERNEL))) { | ||
264 | printk("%s: couldn't allocate memory.\n", __func__); | ||
265 | kfree(firesat->adapter); | ||
266 | kfree(firesat); | ||
267 | return -ENOMEM; | ||
268 | } | ||
269 | |||
270 | if ((result = DVB_REGISTER_ADAPTER(firesat->adapter, | ||
271 | firesat->model_name, | ||
272 | THIS_MODULE, | ||
273 | dev, adapter_nr)) < 0) { | ||
274 | |||
275 | printk("%s: dvb_register_adapter failed: error %d\n", __func__, result); | ||
276 | #if 0 | ||
277 | /* ### cleanup */ | ||
278 | spin_lock_irqsave(&firesat_list_lock, flags); | ||
279 | list_del(&firesat->list); | ||
280 | spin_unlock_irqrestore(&firesat_list_lock, flags); | ||
281 | #endif | ||
282 | kfree(firesat); | ||
283 | 220 | ||
284 | return result; | 221 | result = DVB_REGISTER_ADAPTER(firesat->adapter, |
285 | } | 222 | firedtv_model_names[firesat->type], |
223 | THIS_MODULE, dev, adapter_nr); | ||
224 | if (result < 0) { | ||
225 | printk(KERN_ERR "firedtv: dvb_register_adapter failed\n"); | ||
226 | kfree(firesat->adapter); | ||
227 | return result; | ||
228 | } | ||
286 | 229 | ||
287 | memset(&firesat->demux, 0, sizeof(struct dvb_demux)); | 230 | memset(&firesat->demux, 0, sizeof(struct dvb_demux)); |
288 | firesat->demux.dmx.capabilities = 0/*DMX_TS_FILTERING | DMX_SECTION_FILTERING*/; | 231 | firesat->demux.dmx.capabilities = 0/*DMX_TS_FILTERING | DMX_SECTION_FILTERING*/; |
diff --git a/drivers/media/dvb/firesat/firesat_fe.c b/drivers/media/dvb/firesat/firesat_fe.c index 1c86c3e61373..ec614ea8de22 100644 --- a/drivers/media/dvb/firesat/firesat_fe.c +++ b/drivers/media/dvb/firesat/firesat_fe.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * FireSAT DVB driver | 2 | * FireDTV driver (formerly known as FireSAT) |
3 | * | 3 | * |
4 | * Copyright (c) ? | 4 | * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com> |
5 | * Copyright (c) 2008 Henrik Kurelid <henrik@kurelid.se> | 5 | * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU General Public License as | 8 | * modify it under the terms of the GNU General Public License as |
@@ -10,26 +10,15 @@ | |||
10 | * the License, or (at your option) any later version. | 10 | * the License, or (at your option) any later version. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/slab.h> | ||
15 | #include <linux/wait.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/time.h> | ||
19 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
20 | #include <linux/interrupt.h> | 14 | #include <linux/kernel.h> |
21 | #include <ieee1394_hotplug.h> | 15 | #include <linux/types.h> |
22 | #include <nodemgr.h> | 16 | |
23 | #include <highlevel.h> | 17 | #include <dvb_frontend.h> |
24 | #include <ohci1394.h> | ||
25 | #include <hosts.h> | ||
26 | #include <dvbdev.h> | ||
27 | 18 | ||
28 | #include "firesat.h" | ||
29 | #include "avc_api.h" | 19 | #include "avc_api.h" |
30 | #include "cmp.h" | 20 | #include "cmp.h" |
31 | #include "firesat-rc.h" | 21 | #include "firesat.h" |
32 | #include "firesat-ci.h" | ||
33 | 22 | ||
34 | static int firesat_dvb_init(struct dvb_frontend *fe) | 23 | static int firesat_dvb_init(struct dvb_frontend *fe) |
35 | { | 24 | { |
@@ -209,21 +198,17 @@ int firesat_frontend_attach(struct firesat *firesat, struct dvb_frontend *fe) | |||
209 | { | 198 | { |
210 | switch (firesat->type) { | 199 | switch (firesat->type) { |
211 | case FireSAT_DVB_S: | 200 | case FireSAT_DVB_S: |
212 | firesat->model_name = "FireSAT DVB-S"; | ||
213 | firesat->frontend_info = &firesat_S_frontend_info; | 201 | firesat->frontend_info = &firesat_S_frontend_info; |
214 | break; | 202 | break; |
215 | case FireSAT_DVB_C: | 203 | case FireSAT_DVB_C: |
216 | firesat->model_name = "FireSAT DVB-C"; | ||
217 | firesat->frontend_info = &firesat_C_frontend_info; | 204 | firesat->frontend_info = &firesat_C_frontend_info; |
218 | break; | 205 | break; |
219 | case FireSAT_DVB_T: | 206 | case FireSAT_DVB_T: |
220 | firesat->model_name = "FireSAT DVB-T"; | ||
221 | firesat->frontend_info = &firesat_T_frontend_info; | 207 | firesat->frontend_info = &firesat_T_frontend_info; |
222 | break; | 208 | break; |
223 | default: | 209 | default: |
224 | printk("%s: unknown model type 0x%x !\n", | 210 | printk(KERN_ERR "firedtv: no frontend for model type 0x%x\n", |
225 | __func__, firesat->type); | 211 | firesat->type); |
226 | firesat->model_name = "Unknown"; | ||
227 | firesat->frontend_info = NULL; | 212 | firesat->frontend_info = NULL; |
228 | } | 213 | } |
229 | fe->ops = firesat_ops; | 214 | fe->ops = firesat_ops; |
@@ -235,7 +220,7 @@ int firesat_frontend_attach(struct firesat *firesat, struct dvb_frontend *fe) | |||
235 | 220 | ||
236 | static struct dvb_frontend_info firesat_S_frontend_info = { | 221 | static struct dvb_frontend_info firesat_S_frontend_info = { |
237 | 222 | ||
238 | .name = "FireSAT DVB-S Frontend", | 223 | .name = "FireDTV DVB-S Frontend", |
239 | .type = FE_QPSK, | 224 | .type = FE_QPSK, |
240 | 225 | ||
241 | .frequency_min = 950000, | 226 | .frequency_min = 950000, |
@@ -256,7 +241,7 @@ static struct dvb_frontend_info firesat_S_frontend_info = { | |||
256 | 241 | ||
257 | static struct dvb_frontend_info firesat_C_frontend_info = { | 242 | static struct dvb_frontend_info firesat_C_frontend_info = { |
258 | 243 | ||
259 | .name = "FireSAT DVB-C Frontend", | 244 | .name = "FireDTV DVB-C Frontend", |
260 | .type = FE_QAM, | 245 | .type = FE_QAM, |
261 | 246 | ||
262 | .frequency_min = 47000000, | 247 | .frequency_min = 47000000, |
@@ -276,7 +261,7 @@ static struct dvb_frontend_info firesat_C_frontend_info = { | |||
276 | 261 | ||
277 | static struct dvb_frontend_info firesat_T_frontend_info = { | 262 | static struct dvb_frontend_info firesat_T_frontend_info = { |
278 | 263 | ||
279 | .name = "FireSAT DVB-T Frontend", | 264 | .name = "FireDTV DVB-T Frontend", |
280 | .type = FE_OFDM, | 265 | .type = FE_OFDM, |
281 | 266 | ||
282 | .frequency_min = 49000000, | 267 | .frequency_min = 49000000, |
diff --git a/drivers/media/dvb/firesat/firesat_iso.c b/drivers/media/dvb/firesat/firesat_iso.c index 15e23cf7d503..bc94afe57f63 100644 --- a/drivers/media/dvb/firesat/firesat_iso.c +++ b/drivers/media/dvb/firesat/firesat_iso.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * FireSAT DVB driver | 2 | * FireSAT DVB driver |
3 | * | 3 | * |
4 | * Copyright (c) 2008 Henrik Kurelid <henrik@kurelid.se> | 4 | * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License as | 7 | * modify it under the terms of the GNU General Public License as |
@@ -9,6 +9,16 @@ | |||
9 | * the License, or (at your option) any later version. | 9 | * the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/errno.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/list.h> | ||
15 | #include <linux/spinlock.h> | ||
16 | |||
17 | #include <dvb_demux.h> | ||
18 | |||
19 | #include <dma.h> | ||
20 | #include <iso.h> | ||
21 | |||
12 | #include "firesat.h" | 22 | #include "firesat.h" |
13 | 23 | ||
14 | static void rawiso_activity_cb(struct hpsb_iso *iso); | 24 | static void rawiso_activity_cb(struct hpsb_iso *iso); |