summaryrefslogtreecommitdiff
path: root/drivers/media/dvb/firesat/firesat_dvb.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2008-08-25 22:17:30 (GMT)
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-02-24 13:51:26 (GMT)
commit612262a53352af839a14b3395975a3440c95080a (patch)
treec31efac0f840ac633a48e0fd07fdd95029d25c17 /drivers/media/dvb/firesat/firesat_dvb.c
parent81c67b7f82769292a86b802590be5879413f9278 (diff)
downloadlinux-fsl-qoriq-612262a53352af839a14b3395975a3440c95080a.tar.xz
firesat: copyrights, rename to firedtv, API conversions, fix remote control input
Combination of the following changes: Tue, 26 Aug 2008 00:17:30 +0200 (CEST) firedtv: fix remote control input and update the scancode-to-keycode mapping to a current model. Per default, various media key keycodes are emitted which closely match what is printed on the remote. Userland can modify the mapping by means of evdev ioctls. (Not tested.) The old scancode-to-keycode mapping is left in the driver but cannot be modified by ioctls. This preserves status quo for old remotes. Tue, 26 Aug 2008 00:11:28 +0200 (CEST) firedtv: replace tasklet by workqueue job Non-atomic context is a lot nicer to work with. Sun, 24 Aug 2008 23:30:00 +0200 (CEST) firedtv: move some code back to ieee1394 core Partially reverts "ieee1394: remove unused code" of Linux 2.6.25. Sun, 24 Aug 2008 23:29:30 +0200 (CEST) firedtv: replace semaphore by mutex firesat->avc_sem and ->demux_sem have been used exactly like a mutex. The only exception is the schedule_remotecontrol tasklet which did a down_trylock in atomic context. This is not possible with mutex_trylock; however the whole remote control related code is non-functional anyway at the moment. This should be fixed eventually, probably by turning the tasklet into a worqueue job. Convert everything else from semaphore to mutex. Also rewrite a few of the affected functions to unlock the mutex at a single exit point, instead of in several branches. Sun, 24 Aug 2008 23:28:45 +0200 (CEST) firedtv: some header cleanups Unify #ifndef/#define/#endif guards against multiple inclusion. Drop extern keyword from function declarations. Remove #include's into header files where struct declarations suffice. Remove unused ohci1394 interface and related unused ieee1394 interfaces. Add a few missing #include's and remove a few apparently obsolete ones. Sort them alphabetically. Sun, 24 Aug 2008 23:27:45 +0200 (CEST) firedtv: nicer registration message and some initialization fixes Print the correct name in dvb_register_adapter(). While we are at it, replace two switch cascades by one for loop, remove a superfluous member of struct firesat and of two unused arguments of AVCIdentifySubunit(), and fix bogus kfree's in firesat_dvbdev_init(). Tue, 26 Aug 2008 14:24:17 +0200 (CEST) firesat: rename to firedtv Suggested by Andreas Monitzer. Besides DVB-S/-S2 receivers, the driver also supports DVB-C and DVB-T receivers, hence the previous project name is too narrow now. Not yet done: Rename source directory, files, types, variables... Sun, 24 Aug 2008 23:26:23 +0200 (CEST) firesat: add missing copyright notes Reported by Andreas Monitzer and Christian Dolzer. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/media/dvb/firesat/firesat_dvb.c')
-rw-r--r--drivers/media/dvb/firesat/firesat_dvb.c147
1 files changed, 45 insertions, 102 deletions
diff --git a/drivers/media/dvb/firesat/firesat_dvb.c b/drivers/media/dvb/firesat/firesat_dvb.c
index 9e87402..e944cee 100644
--- a/drivers/media/dvb/firesat/firesat_dvb.c
+++ b/drivers/media/dvb/firesat/firesat_dvb.c
@@ -1,8 +1,8 @@
/*
- * FireSAT DVB driver
+ * FireDTV driver (formerly known as FireSAT)
*
- * Copyright (c) ?
- * Copyright (c) 2008 Henrik Kurelid <henrik@kurelid.se>
+ * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
+ * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -10,64 +10,52 @@
* the License, or (at your option) any later version.
*/
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/wait.h>
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/time.h>
#include <linux/errno.h>
-#include <linux/interrupt.h>
-#include <ieee1394_hotplug.h>
-#include <nodemgr.h>
-#include <highlevel.h>
-#include <ohci1394.h>
-#include <hosts.h>
+#include <linux/kernel.h>
+#include <linux/mutex.h>
+#include <linux/types.h>
+
+#include <dvb_demux.h>
+#include <dvb_frontend.h>
#include <dvbdev.h>
-#include "firesat.h"
#include "avc_api.h"
-#include "cmp.h"
-#include "firesat-rc.h"
+#include "firesat.h"
#include "firesat-ci.h"
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
static struct firesat_channel *firesat_channel_allocate(struct firesat *firesat)
{
+ struct firesat_channel *c = NULL;
int k;
- //printk(KERN_INFO "%s\n", __func__);
-
- if (down_interruptible(&firesat->demux_sem))
+ if (mutex_lock_interruptible(&firesat->demux_mutex))
return NULL;
- for (k = 0; k < 16; k++) {
- //printk(KERN_INFO "%s: channel %d: active = %d, pid = 0x%x\n",__func__,k,firesat->channel[k].active,firesat->channel[k].pid);
-
+ for (k = 0; k < 16; k++)
if (firesat->channel[k].active == 0) {
firesat->channel[k].active = 1;
- up(&firesat->demux_sem);
- return &firesat->channel[k];
+ c = &firesat->channel[k];
+ break;
}
- }
- up(&firesat->demux_sem);
- return NULL; // no more channels available
+ mutex_unlock(&firesat->demux_mutex);
+ return c;
}
static int firesat_channel_collect(struct firesat *firesat, int *pidc, u16 pid[])
{
int k, l = 0;
- if (down_interruptible(&firesat->demux_sem))
+ if (mutex_lock_interruptible(&firesat->demux_mutex))
return -EINTR;
for (k = 0; k < 16; k++)
if (firesat->channel[k].active == 1)
pid[l++] = firesat->channel[k].pid;
- up(&firesat->demux_sem);
+ mutex_unlock(&firesat->demux_mutex);
*pidc = l;
@@ -77,12 +65,12 @@ static int firesat_channel_collect(struct firesat *firesat, int *pidc, u16 pid[]
static int firesat_channel_release(struct firesat *firesat,
struct firesat_channel *channel)
{
- if (down_interruptible(&firesat->demux_sem))
+ if (mutex_lock_interruptible(&firesat->demux_mutex))
return -EINTR;
channel->active = 0;
- up(&firesat->demux_sem);
+ mutex_unlock(&firesat->demux_mutex);
return 0;
}
@@ -172,7 +160,8 @@ int firesat_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
{
struct dvb_demux *demux = dvbdmxfeed->demux;
struct firesat *firesat = (struct firesat*)demux->priv;
- int k, l = 0;
+ struct firesat_channel *c = dvbdmxfeed->priv;
+ int k, l;
u16 pids[16];
//printk(KERN_INFO "%s (pid %u)\n", __func__, dvbdmxfeed->pid);
@@ -197,30 +186,24 @@ int firesat_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
return 0;
}
- if (down_interruptible(&firesat->demux_sem))
+ if (mutex_lock_interruptible(&firesat->demux_mutex))
return -EINTR;
-
- // list except channel to be removed
- for (k = 0; k < 16; k++)
+ /* list except channel to be removed */
+ for (k = 0, l = 0; k < 16; k++)
if (firesat->channel[k].active == 1) {
- if (&firesat->channel[k] !=
- (struct firesat_channel *)dvbdmxfeed->priv)
+ if (&firesat->channel[k] != c)
pids[l++] = firesat->channel[k].pid;
else
firesat->channel[k].active = 0;
}
- if ((k = AVCTuner_SetPIDs(firesat, l, pids))) {
- up(&firesat->demux_sem);
- return k;
- }
+ k = AVCTuner_SetPIDs(firesat, l, pids);
+ if (!k)
+ c->active = 0;
- ((struct firesat_channel *)dvbdmxfeed->priv)->active = 0;
-
- up(&firesat->demux_sem);
-
- return 0;
+ mutex_unlock(&firesat->demux_mutex);
+ return k;
}
int firesat_dvbdev_init(struct firesat *firesat,
@@ -229,60 +212,20 @@ int firesat_dvbdev_init(struct firesat *firesat,
{
int result;
-#if 0
- switch (firesat->type) {
- case FireSAT_DVB_S:
- firesat->model_name = "FireSAT DVB-S";
- firesat->frontend_info = &firesat_S_frontend_info;
- break;
- case FireSAT_DVB_C:
- firesat->model_name = "FireSAT DVB-C";
- firesat->frontend_info = &firesat_C_frontend_info;
- break;
- case FireSAT_DVB_T:
- firesat->model_name = "FireSAT DVB-T";
- firesat->frontend_info = &firesat_T_frontend_info;
- break;
- default:
- printk("%s: unknown model type 0x%x on subunit %d!\n",
- __func__, firesat->type,subunit);
- firesat->model_name = "Unknown";
- firesat->frontend_info = NULL;
- }
-#endif
-/* // ------- CRAP -----------
- if (!firesat->frontend_info) {
- spin_lock_irqsave(&firesat_list_lock, flags);
- list_del(&firesat->list);
- spin_unlock_irqrestore(&firesat_list_lock, flags);
- kfree(firesat);
- continue;
- }
-*/
- //initialising firesat->adapter before calling dvb_register_adapter
- if (!(firesat->adapter = kmalloc(sizeof (struct dvb_adapter), GFP_KERNEL))) {
- printk("%s: couldn't allocate memory.\n", __func__);
- kfree(firesat->adapter);
- kfree(firesat);
- return -ENOMEM;
- }
-
- if ((result = DVB_REGISTER_ADAPTER(firesat->adapter,
- firesat->model_name,
- THIS_MODULE,
- dev, adapter_nr)) < 0) {
-
- printk("%s: dvb_register_adapter failed: error %d\n", __func__, result);
-#if 0
- /* ### cleanup */
- spin_lock_irqsave(&firesat_list_lock, flags);
- list_del(&firesat->list);
- spin_unlock_irqrestore(&firesat_list_lock, flags);
-#endif
- kfree(firesat);
+ firesat->adapter = kmalloc(sizeof(*firesat->adapter), GFP_KERNEL);
+ if (!firesat->adapter) {
+ printk(KERN_ERR "firedtv: couldn't allocate memory\n");
+ return -ENOMEM;
+ }
- return result;
- }
+ result = DVB_REGISTER_ADAPTER(firesat->adapter,
+ firedtv_model_names[firesat->type],
+ THIS_MODULE, dev, adapter_nr);
+ if (result < 0) {
+ printk(KERN_ERR "firedtv: dvb_register_adapter failed\n");
+ kfree(firesat->adapter);
+ return result;
+ }
memset(&firesat->demux, 0, sizeof(struct dvb_demux));
firesat->demux.dmx.capabilities = 0/*DMX_TS_FILTERING | DMX_SECTION_FILTERING*/;