firedtv: rename files, variables, functions from firesat to firedtv

Combination of the following changes:

Sat, 17 Jan 2009 14:47:34 +0100
firedtv: rename variables and functions from firesat to firedtv

    Signed-off-by: Rambaldi <Rambaldi@xs4all.nl>

    Additional changes by Stefan Richter:

    Renamed struct firedtv *firedtv to struct firedtv *fdtv and
    firedtv_foo_bar() to fdtv_foo_bar() for brevity.

Sat, 17 Jan 2009 13:07:44 +0100
firedtv: rename files from firesat to firedtv

    Signed-off-by: Rambaldi <Rambaldi@xs4all.nl>

    Additional changes by Stefan Richter:

    Name the directory "firewire" instead of "firedtv".
    Standardize on "-" instead of "_" in file names, because that's what
    drivers/firewire/ and drivers/media/dvb/dvb-usb/ use too.
    Build fix.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
diff --git a/drivers/media/dvb/Kconfig b/drivers/media/dvb/Kconfig
index 8a2d5f9..5a74c5c 100644
--- a/drivers/media/dvb/Kconfig
+++ b/drivers/media/dvb/Kconfig
@@ -51,7 +51,7 @@
 	depends on DVB_CORE && PCI && I2C
 source "drivers/media/dvb/dm1105/Kconfig"
 
-source "drivers/media/dvb/firesat/Kconfig"
+source "drivers/media/dvb/firewire/Kconfig"
 
 comment "Supported DVB Frontends"
 	depends on DVB_CORE
diff --git a/drivers/media/dvb/Makefile b/drivers/media/dvb/Makefile
index cb76581..6092a5b 100644
--- a/drivers/media/dvb/Makefile
+++ b/drivers/media/dvb/Makefile
@@ -4,4 +4,4 @@
 
 obj-y        := dvb-core/ frontends/ ttpci/ ttusb-dec/ ttusb-budget/ b2c2/ bt8xx/ dvb-usb/ pluto2/ siano/ dm1105/
 
-obj-$(CONFIG_DVB_FIREDTV)	+= firesat/
+obj-$(CONFIG_DVB_FIREDTV)	+= firewire/
diff --git a/drivers/media/dvb/firesat/Makefile b/drivers/media/dvb/firesat/Makefile
deleted file mode 100644
index 9e49edc..0000000
--- a/drivers/media/dvb/firesat/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-firedtv-objs := firesat_1394.o	\
-		firesat_dvb.o	\
-		firesat_fe.o	\
-		firesat_iso.o	\
-		avc_api.o	\
-		cmp.o		\
-		firesat-rc.o	\
-		firesat-ci.o
-
-obj-$(CONFIG_DVB_FIREDTV) += firedtv.o
-
-EXTRA_CFLAGS := -Idrivers/ieee1394
-EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
diff --git a/drivers/media/dvb/firesat/cmp.h b/drivers/media/dvb/firesat/cmp.h
deleted file mode 100644
index d92f6c7..0000000
--- a/drivers/media/dvb/firesat/cmp.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _CMP_H
-#define _CMP_H
-
-struct firesat;
-
-int cmp_establish_pp_connection(struct firesat *firesat, int plug, int channel);
-void cmp_break_pp_connection(struct firesat *firesat, int plug, int channel);
-
-#endif /* _CMP_H */
diff --git a/drivers/media/dvb/firesat/firesat-ci.c b/drivers/media/dvb/firesat/firesat-ci.c
deleted file mode 100644
index 783ed20..0000000
--- a/drivers/media/dvb/firesat/firesat-ci.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * FireDTV driver (formerly known as FireSAT)
- *
- * 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
- *	published by the Free Software Foundation; either version 2 of
- *	the License, or (at your option) any later version.
- */
-
-#include <linux/dvb/ca.h>
-#include <linux/fs.h>
-#include <linux/module.h>
-
-#include <dvbdev.h>
-
-#include "avc_api.h"
-#include "firesat.h"
-#include "firesat-ci.h"
-
-static int firesat_ca_ready(ANTENNA_INPUT_INFO *info)
-{
-	return info->CaInitializationStatus == 1 &&
-	       info->CaErrorFlag == 0 &&
-	       info->CaDvbFlag == 1 &&
-	       info->CaModulePresentStatus == 1;
-}
-
-static int firesat_get_ca_flags(ANTENNA_INPUT_INFO *info)
-{
-	int flags = 0;
-
-	if (info->CaModulePresentStatus == 1)
-		flags |= CA_CI_MODULE_PRESENT;
-	if (info->CaInitializationStatus == 1 &&
-	    info->CaErrorFlag == 0 &&
-	    info->CaDvbFlag == 1)
-		flags |= CA_CI_MODULE_READY;
-	return flags;
-}
-
-static int firesat_ca_reset(struct firesat *firesat)
-{
-	return avc_ca_reset(firesat) ? -EFAULT : 0;
-}
-
-static int firesat_ca_get_caps(void *arg)
-{
-	struct ca_caps *cap = arg;
-
-	cap->slot_num = 1;
-	cap->slot_type = CA_CI;
-	cap->descr_num = 1;
-	cap->descr_type = CA_ECD;
-	return 0;
-}
-
-static int firesat_ca_get_slot_info(struct firesat *firesat, void *arg)
-{
-	ANTENNA_INPUT_INFO info;
-	struct ca_slot_info *slot = arg;
-
-	if (avc_tuner_status(firesat, &info))
-		return -EFAULT;
-
-	if (slot->num != 0)
-		return -EFAULT;
-
-	slot->type = CA_CI;
-	slot->flags = firesat_get_ca_flags(&info);
-	return 0;
-}
-
-static int firesat_ca_app_info(struct firesat *firesat, void *arg)
-{
-	struct ca_msg *reply = arg;
-
-	return
-	    avc_ca_app_info(firesat, reply->msg, &reply->length) ? -EFAULT : 0;
-}
-
-static int firesat_ca_info(struct firesat *firesat, void *arg)
-{
-	struct ca_msg *reply = arg;
-
-	return avc_ca_info(firesat, reply->msg, &reply->length) ? -EFAULT : 0;
-}
-
-static int firesat_ca_get_mmi(struct firesat *firesat, void *arg)
-{
-	struct ca_msg *reply = arg;
-
-	return
-	    avc_ca_get_mmi(firesat, reply->msg, &reply->length) ? -EFAULT : 0;
-}
-
-static int firesat_ca_get_msg(struct firesat *firesat, void *arg)
-{
-	ANTENNA_INPUT_INFO info;
-	int err;
-
-	switch (firesat->ca_last_command) {
-	case TAG_APP_INFO_ENQUIRY:
-		err = firesat_ca_app_info(firesat, arg);
-		break;
-	case TAG_CA_INFO_ENQUIRY:
-		err = firesat_ca_info(firesat, arg);
-		break;
-	default:
-		if (avc_tuner_status(firesat, &info))
-			err = -EFAULT;
-		else if (info.CaMmi == 1)
-			err = firesat_ca_get_mmi(firesat, arg);
-		else {
-			printk(KERN_INFO "%s: Unhandled message 0x%08X\n",
-			       __func__, firesat->ca_last_command);
-			err = -EFAULT;
-		}
-	}
-	firesat->ca_last_command = 0;
-	return err;
-}
-
-static int firesat_ca_pmt(struct firesat *firesat, void *arg)
-{
-	struct ca_msg *msg = arg;
-	int data_pos;
-	int data_length;
-	int i;
-
-	data_pos = 4;
-	if (msg->msg[3] & 0x80) {
-		data_length = 0;
-		for (i = 0; i < (msg->msg[3] & 0x7F); i++)
-			data_length = (data_length << 8) + msg->msg[data_pos++];
-	} else {
-		data_length = msg->msg[3];
-	}
-
-	return avc_ca_pmt(firesat, &msg->msg[data_pos], data_length) ?
-	       -EFAULT : 0;
-}
-
-static int firesat_ca_send_msg(struct firesat *firesat, void *arg)
-{
-	struct ca_msg *msg = arg;
-	int err;
-
-	/* Do we need a semaphore for this? */
-	firesat->ca_last_command =
-		(msg->msg[0] << 16) + (msg->msg[1] << 8) + msg->msg[2];
-	switch (firesat->ca_last_command) {
-	case TAG_CA_PMT:
-		err = firesat_ca_pmt(firesat, arg);
-		break;
-	case TAG_APP_INFO_ENQUIRY:
-		/* handled in ca_get_msg */
-		err = 0;
-		break;
-	case TAG_CA_INFO_ENQUIRY:
-		/* handled in ca_get_msg */
-		err = 0;
-		break;
-	case TAG_ENTER_MENU:
-		err = avc_ca_enter_menu(firesat);
-		break;
-	default:
-		printk(KERN_ERR "%s: Unhandled unknown message 0x%08X\n",
-		       __func__, firesat->ca_last_command);
-		err = -EFAULT;
-	}
-	return err;
-}
-
-static int firesat_ca_ioctl(struct inode *inode, struct file *file,
-			    unsigned int cmd, void *arg)
-{
-	struct dvb_device *dvbdev = file->private_data;
-	struct firesat *firesat = dvbdev->priv;
-	ANTENNA_INPUT_INFO info;
-	int err;
-
-	switch(cmd) {
-	case CA_RESET:
-		err = firesat_ca_reset(firesat);
-		break;
-	case CA_GET_CAP:
-		err = firesat_ca_get_caps(arg);
-		break;
-	case CA_GET_SLOT_INFO:
-		err = firesat_ca_get_slot_info(firesat, arg);
-		break;
-	case CA_GET_MSG:
-		err = firesat_ca_get_msg(firesat, arg);
-		break;
-	case CA_SEND_MSG:
-		err = firesat_ca_send_msg(firesat, arg);
-		break;
-	default:
-		printk(KERN_INFO "%s: Unhandled ioctl, command: %u\n",__func__,
-		       cmd);
-		err = -EOPNOTSUPP;
-	}
-
-	/* FIXME Is this necessary? */
-	avc_tuner_status(firesat, &info);
-
-	return err;
-}
-
-static unsigned int firesat_ca_io_poll(struct file *file, poll_table *wait)
-{
-	return POLLIN;
-}
-
-static struct file_operations firesat_ca_fops = {
-	.owner		= THIS_MODULE,
-	.ioctl		= dvb_generic_ioctl,
-	.open		= dvb_generic_open,
-	.release	= dvb_generic_release,
-	.poll		= firesat_ca_io_poll,
-};
-
-static struct dvb_device firesat_ca = {
-	.users		= 1,
-	.readers	= 1,
-	.writers	= 1,
-	.fops		= &firesat_ca_fops,
-	.kernel_ioctl	= firesat_ca_ioctl,
-};
-
-int firesat_ca_register(struct firesat *firesat)
-{
-	ANTENNA_INPUT_INFO info;
-	int err;
-
-	if (avc_tuner_status(firesat, &info))
-		return -EINVAL;
-
-	if (!firesat_ca_ready(&info))
-		return -EFAULT;
-
-	err = dvb_register_device(&firesat->adapter, &firesat->cadev,
-				  &firesat_ca, firesat, DVB_DEVICE_CA);
-
-	if (info.CaApplicationInfo == 0)
-		printk(KERN_ERR "%s: CaApplicationInfo is not set.\n",
-		       __func__);
-	if (info.CaDateTimeRequest == 1)
-		avc_ca_get_time_date(firesat, &firesat->ca_time_interval);
-
-	return err;
-}
-
-void firesat_ca_release(struct firesat *firesat)
-{
-	if (firesat->cadev)
-		dvb_unregister_device(firesat->cadev);
-}
diff --git a/drivers/media/dvb/firesat/firesat-ci.h b/drivers/media/dvb/firesat/firesat-ci.h
deleted file mode 100644
index 9c68cd2..0000000
--- a/drivers/media/dvb/firesat/firesat-ci.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _FIREDTV_CI_H
-#define _FIREDTV_CI_H
-
-struct firesat;
-
-int firesat_ca_register(struct firesat *firesat);
-void firesat_ca_release(struct firesat *firesat);
-
-#endif /* _FIREDTV_CI_H */
diff --git a/drivers/media/dvb/firesat/firesat-rc.h b/drivers/media/dvb/firesat/firesat-rc.h
deleted file mode 100644
index 12c1c5c..0000000
--- a/drivers/media/dvb/firesat/firesat-rc.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _FIREDTV_RC_H
-#define _FIREDTV_RC_H
-
-struct firesat;
-struct device;
-
-int firesat_register_rc(struct firesat *firesat, struct device *dev);
-void firesat_unregister_rc(struct firesat *firesat);
-void firesat_handle_rc(struct firesat *firesat, unsigned int code);
-
-#endif /* _FIREDTV_RC_H */
diff --git a/drivers/media/dvb/firesat/firesat_1394.c b/drivers/media/dvb/firesat/firesat_1394.c
deleted file mode 100644
index 11db627..0000000
--- a/drivers/media/dvb/firesat/firesat_1394.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * FireDTV driver (formerly known as FireSAT)
- *
- * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
- * Copyright (C) 2007-2008 Ben Backx <ben@bbackx.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
- *	published by the Free Software Foundation; either version 2 of
- *	the License, or (at your option) any later version.
- */
-
-#include <linux/device.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/list.h>
-#include <linux/module.h>
-#include <linux/mutex.h>
-#include <linux/slab.h>
-#include <linux/spinlock.h>
-#include <linux/string.h>
-#include <linux/types.h>
-
-#include <dmxdev.h>
-#include <dvb_demux.h>
-#include <dvb_frontend.h>
-#include <dvbdev.h>
-
-#include <csr1212.h>
-#include <highlevel.h>
-#include <hosts.h>
-#include <ieee1394_hotplug.h>
-#include <nodemgr.h>
-
-#include "avc_api.h"
-#include "cmp.h"
-#include "firesat.h"
-#include "firesat-ci.h"
-#include "firesat-rc.h"
-
-#define MATCH_FLAGS	IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID | \
-			IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION
-#define DIGITAL_EVERYWHERE_OUI   0x001287
-
-static struct ieee1394_device_id firesat_id_table[] = {
-
-	{
-		/* FloppyDTV S/CI and FloppyDTV S2 */
-		.match_flags	= MATCH_FLAGS,
-		.vendor_id	= DIGITAL_EVERYWHERE_OUI,
-		.model_id	= 0x000024,
-		.specifier_id	= AVC_UNIT_SPEC_ID_ENTRY,
-		.version	= AVC_SW_VERSION_ENTRY,
-	},{
-		/* FloppyDTV T/CI */
-		.match_flags	= MATCH_FLAGS,
-		.vendor_id	= DIGITAL_EVERYWHERE_OUI,
-		.model_id	= 0x000025,
-		.specifier_id	= AVC_UNIT_SPEC_ID_ENTRY,
-		.version	= AVC_SW_VERSION_ENTRY,
-	},{
-		/* FloppyDTV C/CI */
-		.match_flags	= MATCH_FLAGS,
-		.vendor_id	= DIGITAL_EVERYWHERE_OUI,
-		.model_id	= 0x000026,
-		.specifier_id	= AVC_UNIT_SPEC_ID_ENTRY,
-		.version	= AVC_SW_VERSION_ENTRY,
-	},{
-		/* FireDTV S/CI and FloppyDTV S2 */
-		.match_flags	= MATCH_FLAGS,
-		.vendor_id	= DIGITAL_EVERYWHERE_OUI,
-		.model_id	= 0x000034,
-		.specifier_id	= AVC_UNIT_SPEC_ID_ENTRY,
-		.version	= AVC_SW_VERSION_ENTRY,
-	},{
-		/* FireDTV T/CI */
-		.match_flags	= MATCH_FLAGS,
-		.vendor_id	= DIGITAL_EVERYWHERE_OUI,
-		.model_id	= 0x000035,
-		.specifier_id	= AVC_UNIT_SPEC_ID_ENTRY,
-		.version	= AVC_SW_VERSION_ENTRY,
-	},{
-		/* FireDTV C/CI */
-		.match_flags	= MATCH_FLAGS,
-		.vendor_id	= DIGITAL_EVERYWHERE_OUI,
-		.model_id	= 0x000036,
-		.specifier_id	= AVC_UNIT_SPEC_ID_ENTRY,
-		.version	= AVC_SW_VERSION_ENTRY,
-	}, { }
-};
-
-MODULE_DEVICE_TABLE(ieee1394, firesat_id_table);
-
-/* list of all firesat devices */
-LIST_HEAD(firesat_list);
-DEFINE_SPINLOCK(firesat_list_lock);
-
-static void fcp_request(struct hpsb_host *host,
-			int nodeid,
-			int direction,
-			int cts,
-			u8 *data,
-			size_t length)
-{
-	struct firesat *firesat = NULL;
-	struct firesat *firesat_entry;
-	unsigned long flags;
-
-	if (length > 0 && ((data[0] & 0xf0) >> 4) == 0) {
-
-		spin_lock_irqsave(&firesat_list_lock, flags);
-		list_for_each_entry(firesat_entry,&firesat_list,list) {
-			if (firesat_entry->ud->ne->host == host &&
-			    firesat_entry->ud->ne->nodeid == nodeid &&
-			    (firesat_entry->subunit == (data[1]&0x7) ||
-			     (firesat_entry->subunit == 0 &&
-			      (data[1]&0x7) == 0x7))) {
-				firesat=firesat_entry;
-				break;
-			}
-		}
-		spin_unlock_irqrestore(&firesat_list_lock, flags);
-
-		if (firesat)
-			avc_recv(firesat, data, length);
-	}
-}
-
-const char *firedtv_model_names[] = {
-	[FireSAT_UNKNOWN] = "unknown type",
-	[FireSAT_DVB_S]   = "FireDTV S/CI",
-	[FireSAT_DVB_C]   = "FireDTV C/CI",
-	[FireSAT_DVB_T]   = "FireDTV T/CI",
-	[FireSAT_DVB_S2]  = "FireDTV S2  ",
-};
-
-static int firesat_probe(struct device *dev)
-{
-	struct unit_directory *ud =
-			container_of(dev, struct unit_directory, device);
-	struct firesat *firesat;
-	unsigned long flags;
-	int kv_len;
-	void *kv_str;
-	int i;
-	int err = -ENOMEM;
-
-	firesat = kzalloc(sizeof(*firesat), GFP_KERNEL);
-	if (!firesat)
-		return -ENOMEM;
-
-	dev->driver_data = firesat;
-	firesat->ud		= ud;
-	firesat->subunit	= 0;
-	firesat->isochannel	= -1;
-	firesat->tone		= 0xff;
-	firesat->voltage	= 0xff;
-
-	mutex_init(&firesat->avc_mutex);
-	init_waitqueue_head(&firesat->avc_wait);
-	firesat->avc_reply_received = true;
-	mutex_init(&firesat->demux_mutex);
-	INIT_WORK(&firesat->remote_ctrl_work, avc_remote_ctrl_work);
-
-	/* Reading device model from ROM */
-	kv_len = (ud->model_name_kv->value.leaf.len - 2) * sizeof(quadlet_t);
-	kv_str = CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(ud->model_name_kv);
-	for (i = ARRAY_SIZE(firedtv_model_names); --i;)
-		if (strlen(firedtv_model_names[i]) <= kv_len &&
-		    strncmp(kv_str, firedtv_model_names[i], kv_len) == 0)
-			break;
-	firesat->type = i;
-
-	/*
-	 * Work around a bug in udev's path_id script:  Use the fw-host's dev
-	 * instead of the unit directory's dev as parent of the input device.
-	 */
-	err = firesat_register_rc(firesat, dev->parent->parent);
-	if (err)
-		goto fail_free;
-
-	INIT_LIST_HEAD(&firesat->list);
-	spin_lock_irqsave(&firesat_list_lock, flags);
-	list_add_tail(&firesat->list, &firesat_list);
-	spin_unlock_irqrestore(&firesat_list_lock, flags);
-
-	err = avc_identify_subunit(firesat);
-	if (err)
-		goto fail;
-
-	err = firesat_dvbdev_init(firesat, dev);
-	if (err)
-		goto fail;
-
-	avc_register_remote_control(firesat);
-	return 0;
-
-fail:
-	spin_lock_irqsave(&firesat_list_lock, flags);
-	list_del(&firesat->list);
-	spin_unlock_irqrestore(&firesat_list_lock, flags);
-	firesat_unregister_rc(firesat);
-fail_free:
-	kfree(firesat);
-	return err;
-}
-
-static int firesat_remove(struct device *dev)
-{
-	struct firesat *firesat = dev->driver_data;
-	unsigned long flags;
-
-	firesat_ca_release(firesat);
-	dvb_unregister_frontend(&firesat->fe);
-	dvb_net_release(&firesat->dvbnet);
-	firesat->demux.dmx.close(&firesat->demux.dmx);
-	firesat->demux.dmx.remove_frontend(&firesat->demux.dmx,
-					   &firesat->frontend);
-	dvb_dmxdev_release(&firesat->dmxdev);
-	dvb_dmx_release(&firesat->demux);
-	dvb_unregister_adapter(&firesat->adapter);
-
-	spin_lock_irqsave(&firesat_list_lock, flags);
-	list_del(&firesat->list);
-	spin_unlock_irqrestore(&firesat_list_lock, flags);
-
-	cancel_work_sync(&firesat->remote_ctrl_work);
-	firesat_unregister_rc(firesat);
-
-	kfree(firesat);
-	return 0;
-}
-
-static int firesat_update(struct unit_directory *ud)
-{
-	struct firesat *firesat = ud->device.driver_data;
-
-	if (firesat->isochannel >= 0)
-		cmp_establish_pp_connection(firesat, firesat->subunit,
-					    firesat->isochannel);
-	return 0;
-}
-
-static struct hpsb_protocol_driver firesat_driver = {
-
-	.name		= "firedtv",
-	.id_table	= firesat_id_table,
-	.update		= firesat_update,
-
-	.driver         = {
-		//.name and .bus are filled in for us in more recent linux versions
-		//.name	= "FireSAT",
-		//.bus	= &ieee1394_bus_type,
-		.probe  = firesat_probe,
-		.remove = firesat_remove,
-	},
-};
-
-static struct hpsb_highlevel firesat_highlevel = {
-	.name		= "firedtv",
-	.fcp_request	= fcp_request,
-};
-
-static int __init firesat_init(void)
-{
-	int ret;
-
-	hpsb_register_highlevel(&firesat_highlevel);
-	ret = hpsb_register_protocol(&firesat_driver);
-	if (ret) {
-		printk(KERN_ERR "firedtv: failed to register protocol\n");
-		hpsb_unregister_highlevel(&firesat_highlevel);
-	}
-	return ret;
-}
-
-static void __exit firesat_exit(void)
-{
-	hpsb_unregister_protocol(&firesat_driver);
-	hpsb_unregister_highlevel(&firesat_highlevel);
-}
-
-module_init(firesat_init);
-module_exit(firesat_exit);
-
-MODULE_AUTHOR("Andreas Monitzer <andy@monitzer.com>");
-MODULE_AUTHOR("Ben Backx <ben@bbackx.com>");
-MODULE_DESCRIPTION("FireDTV DVB Driver");
-MODULE_LICENSE("GPL");
-MODULE_SUPPORTED_DEVICE("FireDTV DVB");
diff --git a/drivers/media/dvb/firesat/firesat_dvb.c b/drivers/media/dvb/firesat/firesat_dvb.c
deleted file mode 100644
index cb36c03..0000000
--- a/drivers/media/dvb/firesat/firesat_dvb.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * FireDTV driver (formerly known as FireSAT)
- *
- * 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
- *	published by the Free Software Foundation; either version 2 of
- *	the License, or (at your option) any later version.
- */
-
-#include <linux/errno.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 "avc_api.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;
-
-	if (mutex_lock_interruptible(&firesat->demux_mutex))
-		return NULL;
-
-	for (k = 0; k < 16; k++)
-		if (!firesat->channel[k].active) {
-			firesat->channel[k].active = true;
-			c = &firesat->channel[k];
-			break;
-		}
-
-	mutex_unlock(&firesat->demux_mutex);
-	return c;
-}
-
-static int firesat_channel_collect(struct firesat *firesat, int *pidc, u16 pid[])
-{
-	int k, l = 0;
-
-	if (mutex_lock_interruptible(&firesat->demux_mutex))
-		return -EINTR;
-
-	for (k = 0; k < 16; k++)
-		if (firesat->channel[k].active)
-			pid[l++] = firesat->channel[k].pid;
-
-	mutex_unlock(&firesat->demux_mutex);
-
-	*pidc = l;
-
-	return 0;
-}
-
-static int firesat_channel_release(struct firesat *firesat,
-				   struct firesat_channel *channel)
-{
-	if (mutex_lock_interruptible(&firesat->demux_mutex))
-		return -EINTR;
-
-	channel->active = false;
-
-	mutex_unlock(&firesat->demux_mutex);
-	return 0;
-}
-
-int firesat_start_feed(struct dvb_demux_feed *dvbdmxfeed)
-{
-	struct firesat *firesat = (struct firesat*)dvbdmxfeed->demux->priv;
-	struct firesat_channel *channel;
-	int pidc,k;
-	u16 pids[16];
-
-	switch (dvbdmxfeed->type) {
-	case DMX_TYPE_TS:
-	case DMX_TYPE_SEC:
-		break;
-	default:
-		printk(KERN_ERR "%s: invalid type %u\n",
-		       __func__, dvbdmxfeed->type);
-		return -EINVAL;
-	}
-
-	if (dvbdmxfeed->type == DMX_TYPE_TS) {
-		switch (dvbdmxfeed->pes_type) {
-		case DMX_TS_PES_VIDEO:
-		case DMX_TS_PES_AUDIO:
-		case DMX_TS_PES_TELETEXT:
-		case DMX_TS_PES_PCR:
-		case DMX_TS_PES_OTHER:
-			//Dirty fix to keep firesat->channel pid-list up to date
-			for(k=0;k<16;k++){
-				if (!firesat->channel[k].active)
-					firesat->channel[k].pid =
-						dvbdmxfeed->pid;
-					break;
-			}
-			channel = firesat_channel_allocate(firesat);
-			break;
-		default:
-			printk(KERN_ERR "%s: invalid pes type %u\n",
-			       __func__, dvbdmxfeed->pes_type);
-			return -EINVAL;
-		}
-	} else {
-		channel = firesat_channel_allocate(firesat);
-	}
-
-	if (!channel) {
-		printk(KERN_ERR "%s: busy!\n", __func__);
-		return -EBUSY;
-	}
-
-	dvbdmxfeed->priv = channel;
-	channel->pid = dvbdmxfeed->pid;
-
-	if (firesat_channel_collect(firesat, &pidc, pids)) {
-		firesat_channel_release(firesat, channel);
-		printk(KERN_ERR "%s: could not collect pids!\n", __func__);
-		return -EINTR;
-	}
-
-	if (dvbdmxfeed->pid == 8192) {
-		k = avc_tuner_get_ts(firesat);
-		if (k) {
-			firesat_channel_release(firesat, channel);
-			printk("%s: AVCTuner_GetTS failed with error %d\n",
-			       __func__, k);
-			return k;
-		}
-	} else {
-		k = avc_tuner_set_pids(firesat, pidc, pids);
-		if (k) {
-			firesat_channel_release(firesat, channel);
-			printk("%s: AVCTuner_SetPIDs failed with error %d\n",
-			       __func__, k);
-			return k;
-		}
-	}
-
-	return 0;
-}
-
-int firesat_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
-{
-	struct dvb_demux *demux = dvbdmxfeed->demux;
-	struct firesat *firesat = (struct firesat*)demux->priv;
-	struct firesat_channel *c = dvbdmxfeed->priv;
-	int k, l;
-	u16 pids[16];
-
-	if (dvbdmxfeed->type == DMX_TYPE_TS && !((dvbdmxfeed->ts_type & TS_PACKET) &&
-				(demux->dmx.frontend->source != DMX_MEMORY_FE))) {
-
-		if (dvbdmxfeed->ts_type & TS_DECODER) {
-
-			if (dvbdmxfeed->pes_type >= DMX_TS_PES_OTHER ||
-				!demux->pesfilter[dvbdmxfeed->pes_type])
-
-				return -EINVAL;
-
-			demux->pids[dvbdmxfeed->pes_type] |= 0x8000;
-			demux->pesfilter[dvbdmxfeed->pes_type] = NULL;
-		}
-
-		if (!(dvbdmxfeed->ts_type & TS_DECODER &&
-			dvbdmxfeed->pes_type < DMX_TS_PES_OTHER))
-
-			return 0;
-	}
-
-	if (mutex_lock_interruptible(&firesat->demux_mutex))
-		return -EINTR;
-
-	/* list except channel to be removed */
-	for (k = 0, l = 0; k < 16; k++)
-		if (firesat->channel[k].active) {
-			if (&firesat->channel[k] != c)
-				pids[l++] = firesat->channel[k].pid;
-			else
-				firesat->channel[k].active = false;
-		}
-
-	k = avc_tuner_set_pids(firesat, l, pids);
-	if (!k)
-		c->active = false;
-
-	mutex_unlock(&firesat->demux_mutex);
-	return k;
-}
-
-int firesat_dvbdev_init(struct firesat *firesat, struct device *dev)
-{
-	int err;
-
-	err = DVB_REGISTER_ADAPTER(&firesat->adapter,
-				   firedtv_model_names[firesat->type],
-				   THIS_MODULE, dev, adapter_nr);
-	if (err < 0)
-		goto fail_log;
-
-	/*DMX_TS_FILTERING | DMX_SECTION_FILTERING*/
-	firesat->demux.dmx.capabilities = 0;
-
-	firesat->demux.priv		= (void *)firesat;
-	firesat->demux.filternum	= 16;
-	firesat->demux.feednum		= 16;
-	firesat->demux.start_feed	= firesat_start_feed;
-	firesat->demux.stop_feed	= firesat_stop_feed;
-	firesat->demux.write_to_decoder	= NULL;
-
-	err = dvb_dmx_init(&firesat->demux);
-	if (err)
-		goto fail_unreg_adapter;
-
-	firesat->dmxdev.filternum	= 16;
-	firesat->dmxdev.demux		= &firesat->demux.dmx;
-	firesat->dmxdev.capabilities	= 0;
-
-	err = dvb_dmxdev_init(&firesat->dmxdev, &firesat->adapter);
-	if (err)
-		goto fail_dmx_release;
-
-	firesat->frontend.source = DMX_FRONTEND_0;
-
-	err = firesat->demux.dmx.add_frontend(&firesat->demux.dmx,
-					      &firesat->frontend);
-	if (err)
-		goto fail_dmxdev_release;
-
-	err = firesat->demux.dmx.connect_frontend(&firesat->demux.dmx,
-						  &firesat->frontend);
-	if (err)
-		goto fail_rem_frontend;
-
-	dvb_net_init(&firesat->adapter, &firesat->dvbnet, &firesat->demux.dmx);
-
-	firesat_frontend_init(firesat);
-	err = dvb_register_frontend(&firesat->adapter, &firesat->fe);
-	if (err)
-		goto fail_net_release;
-
-	err = firesat_ca_register(firesat);
-	if (err)
-		dev_info(dev, "Conditional Access Module not enabled\n");
-
-	return 0;
-
-fail_net_release:
-	dvb_net_release(&firesat->dvbnet);
-	firesat->demux.dmx.close(&firesat->demux.dmx);
-fail_rem_frontend:
-	firesat->demux.dmx.remove_frontend(&firesat->demux.dmx,
-					   &firesat->frontend);
-fail_dmxdev_release:
-	dvb_dmxdev_release(&firesat->dmxdev);
-fail_dmx_release:
-	dvb_dmx_release(&firesat->demux);
-fail_unreg_adapter:
-	dvb_unregister_adapter(&firesat->adapter);
-fail_log:
-	dev_err(dev, "DVB initialization failed\n");
-	return err;
-}
-
-
diff --git a/drivers/media/dvb/firesat/firesat_fe.c b/drivers/media/dvb/firesat/firesat_fe.c
deleted file mode 100644
index 1ed972b..0000000
--- a/drivers/media/dvb/firesat/firesat_fe.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * FireDTV driver (formerly known as FireSAT)
- *
- * 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
- *	published by the Free Software Foundation; either version 2 of
- *	the License, or (at your option) any later version.
- */
-
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/types.h>
-
-#include <dvb_frontend.h>
-
-#include "avc_api.h"
-#include "cmp.h"
-#include "firesat.h"
-
-static int firesat_dvb_init(struct dvb_frontend *fe)
-{
-	struct firesat *firesat = fe->sec_priv;
-	int err;
-
-	/* FIXME - allocate free channel at IRM */
-	firesat->isochannel = firesat->adapter.num;
-
-	err = cmp_establish_pp_connection(firesat, firesat->subunit,
-					  firesat->isochannel);
-	if (err) {
-		printk(KERN_ERR "Could not establish point to point "
-		       "connection.\n");
-		return err;
-	}
-
-	return setup_iso_channel(firesat);
-}
-
-static int firesat_sleep(struct dvb_frontend *fe)
-{
-	struct firesat *firesat = fe->sec_priv;
-
-	tear_down_iso_channel(firesat);
-	cmp_break_pp_connection(firesat, firesat->subunit, firesat->isochannel);
-	firesat->isochannel = -1;
-	return 0;
-}
-
-static int firesat_diseqc_send_master_cmd(struct dvb_frontend *fe,
-					  struct dvb_diseqc_master_cmd *cmd)
-{
-	struct firesat *firesat = fe->sec_priv;
-
-	return avc_lnb_control(firesat, LNBCONTROL_DONTCARE,
-			LNBCONTROL_DONTCARE, LNBCONTROL_DONTCARE, 1, cmd);
-}
-
-static int firesat_diseqc_send_burst(struct dvb_frontend *fe,
-				     fe_sec_mini_cmd_t minicmd)
-{
-	return 0;
-}
-
-static int firesat_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
-{
-	struct firesat *firesat = fe->sec_priv;
-
-	firesat->tone = tone;
-	return 0;
-}
-
-static int firesat_set_voltage(struct dvb_frontend *fe,
-			       fe_sec_voltage_t voltage)
-{
-	struct firesat *firesat = fe->sec_priv;
-
-	firesat->voltage = voltage;
-	return 0;
-}
-
-static int firesat_read_status(struct dvb_frontend *fe, fe_status_t *status)
-{
-	struct firesat *firesat = fe->sec_priv;
-	ANTENNA_INPUT_INFO info;
-
-	if (avc_tuner_status(firesat, &info))
-		return -EINVAL;
-
-	if (info.NoRF)
-		*status = 0;
-	else
-		*status = FE_HAS_SIGNAL | FE_HAS_VITERBI | FE_HAS_SYNC |
-			  FE_HAS_CARRIER | FE_HAS_LOCK;
-	return 0;
-}
-
-static int firesat_read_ber(struct dvb_frontend *fe, u32 *ber)
-{
-	struct firesat *firesat = fe->sec_priv;
-	ANTENNA_INPUT_INFO info;
-
-	if (avc_tuner_status(firesat, &info))
-		return -EINVAL;
-
-	*ber = info.BER[0] << 24 | info.BER[1] << 16 |
-	       info.BER[2] << 8 | info.BER[3];
-	return 0;
-}
-
-static int firesat_read_signal_strength (struct dvb_frontend *fe, u16 *strength)
-{
-	struct firesat *firesat = fe->sec_priv;
-	ANTENNA_INPUT_INFO info;
-
-	if (avc_tuner_status(firesat, &info))
-		return -EINVAL;
-
-	*strength = info.SignalStrength << 8;
-	return 0;
-}
-
-static int firesat_read_snr(struct dvb_frontend *fe, u16 *snr)
-{
-	struct firesat *firesat = fe->sec_priv;
-	ANTENNA_INPUT_INFO info;
-
-	if (avc_tuner_status(firesat, &info))
-		return -EINVAL;
-
-	/* C/N[dB] = -10 * log10(snr / 65535) */
-	*snr = (info.CarrierNoiseRatio[0] << 8) + info.CarrierNoiseRatio[1];
-	*snr *= 257;
-	return 0;
-}
-
-static int firesat_read_uncorrected_blocks(struct dvb_frontend *fe, u32 *ucblocks)
-{
-	return -EOPNOTSUPP;
-}
-
-static int firesat_set_frontend(struct dvb_frontend *fe,
-				struct dvb_frontend_parameters *params)
-{
-	struct firesat *firesat = fe->sec_priv;
-
-	/* FIXME: avc_tuner_dsd never returns ACCEPTED. Check status? */
-	if (avc_tuner_dsd(firesat, params) != ACCEPTED)
-		return -EINVAL;
-	else
-		return 0; /* not sure of this... */
-}
-
-static int firesat_get_frontend(struct dvb_frontend *fe,
-				struct dvb_frontend_parameters *params)
-{
-	return -EOPNOTSUPP;
-}
-
-void firesat_frontend_init(struct firesat *firesat)
-{
-	struct dvb_frontend_ops *ops = &firesat->fe.ops;
-	struct dvb_frontend_info *fi = &ops->info;
-
-	ops->init			= firesat_dvb_init;
-	ops->sleep			= firesat_sleep;
-
-	ops->set_frontend		= firesat_set_frontend;
-	ops->get_frontend		= firesat_get_frontend;
-
-	ops->read_status		= firesat_read_status;
-	ops->read_ber			= firesat_read_ber;
-	ops->read_signal_strength	= firesat_read_signal_strength;
-	ops->read_snr			= firesat_read_snr;
-	ops->read_ucblocks		= firesat_read_uncorrected_blocks;
-
-	ops->diseqc_send_master_cmd 	= firesat_diseqc_send_master_cmd;
-	ops->diseqc_send_burst		= firesat_diseqc_send_burst;
-	ops->set_tone			= firesat_set_tone;
-	ops->set_voltage		= firesat_set_voltage;
-
-	switch (firesat->type) {
-	case FireSAT_DVB_S:
-		fi->type		= FE_QPSK;
-
-		fi->frequency_min	= 950000;
-		fi->frequency_max	= 2150000;
-		fi->frequency_stepsize	= 125;
-		fi->symbol_rate_min	= 1000000;
-		fi->symbol_rate_max	= 40000000;
-
-		fi->caps 		= FE_CAN_INVERSION_AUTO	|
-					  FE_CAN_FEC_1_2	|
-					  FE_CAN_FEC_2_3	|
-					  FE_CAN_FEC_3_4	|
-					  FE_CAN_FEC_5_6	|
-					  FE_CAN_FEC_7_8	|
-					  FE_CAN_FEC_AUTO	|
-					  FE_CAN_QPSK;
-		break;
-
-	case FireSAT_DVB_C:
-		fi->type		= FE_QAM;
-
-		fi->frequency_min	= 47000000;
-		fi->frequency_max	= 866000000;
-		fi->frequency_stepsize	= 62500;
-		fi->symbol_rate_min	= 870000;
-		fi->symbol_rate_max	= 6900000;
-
-		fi->caps 		= FE_CAN_INVERSION_AUTO |
-					  FE_CAN_QAM_16		|
-					  FE_CAN_QAM_32		|
-					  FE_CAN_QAM_64		|
-					  FE_CAN_QAM_128	|
-					  FE_CAN_QAM_256	|
-					  FE_CAN_QAM_AUTO;
-		break;
-
-	case FireSAT_DVB_T:
-		fi->type		= FE_OFDM;
-
-		fi->frequency_min	= 49000000;
-		fi->frequency_max	= 861000000;
-		fi->frequency_stepsize	= 62500;
-
-		fi->caps 		= FE_CAN_INVERSION_AUTO		|
-					  FE_CAN_FEC_2_3		|
-					  FE_CAN_TRANSMISSION_MODE_AUTO |
-					  FE_CAN_GUARD_INTERVAL_AUTO	|
-					  FE_CAN_HIERARCHY_AUTO;
-		break;
-
-	default:
-		printk(KERN_ERR "FireDTV: no frontend for model type %d\n",
-		       firesat->type);
-	}
-	strcpy(fi->name, firedtv_model_names[firesat->type]);
-
-	firesat->fe.dvb = &firesat->adapter;
-	firesat->fe.sec_priv = firesat;
-}
diff --git a/drivers/media/dvb/firesat/Kconfig b/drivers/media/dvb/firewire/Kconfig
similarity index 100%
rename from drivers/media/dvb/firesat/Kconfig
rename to drivers/media/dvb/firewire/Kconfig
diff --git a/drivers/media/dvb/firewire/Makefile b/drivers/media/dvb/firewire/Makefile
new file mode 100644
index 0000000..628dacd
--- /dev/null
+++ b/drivers/media/dvb/firewire/Makefile
@@ -0,0 +1,13 @@
+firedtv-objs := firedtv-1394.o	\
+		firedtv-dvb.o	\
+		firedtv-fe.o	\
+		firedtv-iso.o	\
+		avc.o		\
+		cmp.o		\
+		firedtv-rc.o	\
+		firedtv-ci.o
+
+obj-$(CONFIG_DVB_FIREDTV) += firedtv.o
+
+EXTRA_CFLAGS := -Idrivers/ieee1394
+EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
diff --git a/drivers/media/dvb/firesat/avc_api.c b/drivers/media/dvb/firewire/avc.c
similarity index 83%
rename from drivers/media/dvb/firesat/avc_api.c
rename to drivers/media/dvb/firewire/avc.c
index 3a4da73..847a537 100644
--- a/drivers/media/dvb/firesat/avc_api.c
+++ b/drivers/media/dvb/firewire/avc.c
@@ -25,26 +25,26 @@
 #include <ieee1394_transactions.h>
 #include <nodemgr.h>
 
-#include "avc_api.h"
-#include "firesat.h"
-#include "firesat-rc.h"
+#include "avc.h"
+#include "firedtv.h"
+#include "firedtv-rc.h"
 
 #define FCP_COMMAND_REGISTER	0xfffff0000b00ULL
 
-static int __avc_write(struct firesat *firesat,
+static int __avc_write(struct firedtv *fdtv,
 		       const AVCCmdFrm *CmdFrm, AVCRspFrm *RspFrm)
 {
 	int err, retry;
 
 	if (RspFrm)
-		firesat->avc_reply_received = false;
+		fdtv->avc_reply_received = false;
 
 	for (retry = 0; retry < 6; retry++) {
-		err = hpsb_node_write(firesat->ud->ne, FCP_COMMAND_REGISTER,
+		err = hpsb_node_write(fdtv->ud->ne, FCP_COMMAND_REGISTER,
 				      (quadlet_t *)CmdFrm, CmdFrm->length);
 		if (err) {
-			firesat->avc_reply_received = true;
-			dev_err(&firesat->ud->device,
+			fdtv->avc_reply_received = true;
+			dev_err(&fdtv->ud->device,
 				"FCP command write failed\n");
 			return err;
 		}
@@ -56,34 +56,34 @@
 		 * AV/C specs say that answers should be sent within 150 ms.
 		 * Time out after 200 ms.
 		 */
-		if (wait_event_timeout(firesat->avc_wait,
-				       firesat->avc_reply_received,
+		if (wait_event_timeout(fdtv->avc_wait,
+				       fdtv->avc_reply_received,
 				       HZ / 5) != 0) {
-			memcpy(RspFrm, firesat->respfrm, firesat->resp_length);
-			RspFrm->length = firesat->resp_length;
+			memcpy(RspFrm, fdtv->respfrm, fdtv->resp_length);
+			RspFrm->length = fdtv->resp_length;
 
 			return 0;
 		}
 	}
-	dev_err(&firesat->ud->device, "FCP response timed out\n");
+	dev_err(&fdtv->ud->device, "FCP response timed out\n");
 	return -ETIMEDOUT;
 }
 
-static int avc_write(struct firesat *firesat,
+static int avc_write(struct firedtv *fdtv,
 		     const AVCCmdFrm *CmdFrm, AVCRspFrm *RspFrm)
 {
 	int ret;
 
-	if (mutex_lock_interruptible(&firesat->avc_mutex))
+	if (mutex_lock_interruptible(&fdtv->avc_mutex))
 		return -EINTR;
 
-	ret = __avc_write(firesat, CmdFrm, RspFrm);
+	ret = __avc_write(fdtv, CmdFrm, RspFrm);
 
-	mutex_unlock(&firesat->avc_mutex);
+	mutex_unlock(&fdtv->avc_mutex);
 	return ret;
 }
 
-int avc_recv(struct firesat *firesat, u8 *data, size_t length)
+int avc_recv(struct firedtv *fdtv, u8 *data, size_t length)
 {
 	AVCRspFrm *RspFrm = (AVCRspFrm *)data;
 
@@ -93,27 +93,27 @@
 	    RspFrm->operand[2] == SFE_VENDOR_DE_COMPANYID_2 &&
 	    RspFrm->operand[3] == SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL) {
 		if (RspFrm->resp == CHANGED) {
-			firesat_handle_rc(firesat,
+			fdtv_handle_rc(fdtv,
 			    RspFrm->operand[4] << 8 | RspFrm->operand[5]);
-			schedule_work(&firesat->remote_ctrl_work);
+			schedule_work(&fdtv->remote_ctrl_work);
 		} else if (RspFrm->resp != INTERIM) {
-			dev_info(&firesat->ud->device,
+			dev_info(&fdtv->ud->device,
 				 "remote control result = %d\n", RspFrm->resp);
 		}
 		return 0;
 	}
 
-	if (firesat->avc_reply_received) {
-		dev_err(&firesat->ud->device,
+	if (fdtv->avc_reply_received) {
+		dev_err(&fdtv->ud->device,
 			"received out-of-order AVC response, ignored\n");
 		return -EIO;
 	}
 
-	memcpy(firesat->respfrm, data, length);
-	firesat->resp_length = length;
+	memcpy(fdtv->respfrm, data, length);
+	fdtv->resp_length = length;
 
-	firesat->avc_reply_received = true;
-	wake_up(&firesat->avc_wait);
+	fdtv->avc_reply_received = true;
+	wake_up(&fdtv->avc_wait);
 
 	return 0;
 }
@@ -122,7 +122,7 @@
  * tuning command for setting the relative LNB frequency
  * (not supported by the AVC standard)
  */
-static void avc_tuner_tuneqpsk(struct firesat *firesat,
+static void avc_tuner_tuneqpsk(struct firedtv *fdtv,
 		struct dvb_frontend_parameters *params, AVCCmdFrm *CmdFrm)
 {
 	CmdFrm->opcode = VENDOR;
@@ -158,21 +158,21 @@
 		CmdFrm->operand[10] = 0x0;
 	}
 
-	if (firesat->voltage == 0xff)
+	if (fdtv->voltage == 0xff)
 		CmdFrm->operand[11] = 0xff;
-	else if (firesat->voltage == SEC_VOLTAGE_18) /* polarisation */
+	else if (fdtv->voltage == SEC_VOLTAGE_18) /* polarisation */
 		CmdFrm->operand[11] = 0;
 	else
 		CmdFrm->operand[11] = 1;
 
-	if (firesat->tone == 0xff)
+	if (fdtv->tone == 0xff)
 		CmdFrm->operand[12] = 0xff;
-	else if (firesat->tone == SEC_TONE_ON) /* band */
+	else if (fdtv->tone == SEC_TONE_ON) /* band */
 		CmdFrm->operand[12] = 1;
 	else
 		CmdFrm->operand[12] = 0;
 
-	if (firesat->type == FireSAT_DVB_S2) {
+	if (fdtv->type == FIREDTV_DVB_S2) {
 		CmdFrm->operand[13] = 0x1;
 		CmdFrm->operand[14] = 0xff;
 		CmdFrm->operand[15] = 0xff;
@@ -394,7 +394,7 @@
 	CmdFrm->length = 24;
 }
 
-int avc_tuner_dsd(struct firesat *firesat,
+int avc_tuner_dsd(struct firedtv *fdtv,
 		  struct dvb_frontend_parameters *params)
 {
 	AVCCmdFrm CmdFrm;
@@ -405,21 +405,21 @@
 	CmdFrm.cts	= AVC;
 	CmdFrm.ctype	= CONTROL;
 	CmdFrm.sutyp	= 0x5;
-	CmdFrm.suid	= firesat->subunit;
+	CmdFrm.suid	= fdtv->subunit;
 
-	switch (firesat->type) {
-	case FireSAT_DVB_S:
-	case FireSAT_DVB_S2:
-		avc_tuner_tuneqpsk(firesat, params, &CmdFrm); break;
-	case FireSAT_DVB_C:
+	switch (fdtv->type) {
+	case FIREDTV_DVB_S:
+	case FIREDTV_DVB_S2:
+		avc_tuner_tuneqpsk(fdtv, params, &CmdFrm); break;
+	case FIREDTV_DVB_C:
 		avc_tuner_dsd_dvb_c(params, &CmdFrm); break;
-	case FireSAT_DVB_T:
+	case FIREDTV_DVB_T:
 		avc_tuner_dsd_dvb_t(params, &CmdFrm); break;
 	default:
 		BUG();
 	}
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	msleep(500);
@@ -432,7 +432,7 @@
 	return 0;
 }
 
-int avc_tuner_set_pids(struct firesat *firesat, unsigned char pidc, u16 pid[])
+int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[])
 {
 	AVCCmdFrm CmdFrm;
 	AVCRspFrm RspFrm;
@@ -446,7 +446,7 @@
 	CmdFrm.cts	= AVC;
 	CmdFrm.ctype	= CONTROL;
 	CmdFrm.sutyp	= 0x5;
-	CmdFrm.suid	= firesat->subunit;
+	CmdFrm.suid	= fdtv->subunit;
 	CmdFrm.opcode	= DSD;
 
 	CmdFrm.operand[0]  = 0; // source plug
@@ -469,14 +469,14 @@
 
 	CmdFrm.length = ALIGN(3 + pos, 4);
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	msleep(50);
 	return 0;
 }
 
-int avc_tuner_get_ts(struct firesat *firesat)
+int avc_tuner_get_ts(struct firedtv *fdtv)
 {
 	AVCCmdFrm CmdFrm;
 	AVCRspFrm RspFrm;
@@ -486,7 +486,7 @@
 	CmdFrm.cts		= AVC;
 	CmdFrm.ctype	= CONTROL;
 	CmdFrm.sutyp	= 0x5;
-	CmdFrm.suid		= firesat->subunit;
+	CmdFrm.suid		= fdtv->subunit;
 	CmdFrm.opcode	= DSIT;
 
 	CmdFrm.operand[0]  = 0; // source plug
@@ -495,21 +495,21 @@
 	CmdFrm.operand[3]  = 0x20; // system id = DVB
 	CmdFrm.operand[4]  = 0x00; // antenna number
 	CmdFrm.operand[5]  = 0x0;  // system_specific_search_flags
-	CmdFrm.operand[6]  = (firesat->type == FireSAT_DVB_T)?0x0c:0x11; // system_specific_multiplex selection_length
+	CmdFrm.operand[6]  = (fdtv->type == FIREDTV_DVB_T)?0x0c:0x11; // system_specific_multiplex selection_length
 	CmdFrm.operand[7]  = 0x00; // valid_flags [0]
 	CmdFrm.operand[8]  = 0x00; // valid_flags [1]
-	CmdFrm.operand[7 + (firesat->type == FireSAT_DVB_T)?0x0c:0x11] = 0x00; // nr_of_dsit_sel_specs (always 0)
+	CmdFrm.operand[7 + (fdtv->type == FIREDTV_DVB_T)?0x0c:0x11] = 0x00; // nr_of_dsit_sel_specs (always 0)
 
-	CmdFrm.length = (firesat->type == FireSAT_DVB_T)?24:28;
+	CmdFrm.length = (fdtv->type == FIREDTV_DVB_T)?24:28;
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	msleep(250);
 	return 0;
 }
 
-int avc_identify_subunit(struct firesat *firesat)
+int avc_identify_subunit(struct firedtv *fdtv)
 {
 	AVCCmdFrm CmdFrm;
 	AVCRspFrm RspFrm;
@@ -519,7 +519,7 @@
 	CmdFrm.cts = AVC;
 	CmdFrm.ctype = CONTROL;
 	CmdFrm.sutyp = 0x5; // tuner
-	CmdFrm.suid = firesat->subunit;
+	CmdFrm.suid = fdtv->subunit;
 	CmdFrm.opcode = READ_DESCRIPTOR;
 
 	CmdFrm.operand[0]=DESCRIPTOR_SUBUNIT_IDENTIFIER;
@@ -532,19 +532,19 @@
 
 	CmdFrm.length=12;
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	if ((RspFrm.resp != STABLE && RspFrm.resp != ACCEPTED) ||
 	    (RspFrm.operand[3] << 8) + RspFrm.operand[4] != 8) {
-		dev_err(&firesat->ud->device,
+		dev_err(&fdtv->ud->device,
 			"cannot read subunit identifier\n");
 		return -EINVAL;
 	}
 	return 0;
 }
 
-int avc_tuner_status(struct firesat *firesat,
+int avc_tuner_status(struct firedtv *fdtv,
 		     ANTENNA_INPUT_INFO *antenna_input_info)
 {
 	AVCCmdFrm CmdFrm;
@@ -556,7 +556,7 @@
 	CmdFrm.cts=AVC;
 	CmdFrm.ctype=CONTROL;
 	CmdFrm.sutyp=0x05; // tuner
-	CmdFrm.suid=firesat->subunit;
+	CmdFrm.suid=fdtv->subunit;
 	CmdFrm.opcode=READ_DESCRIPTOR;
 
 	CmdFrm.operand[0]=DESCRIPTOR_TUNER_STATUS;
@@ -568,17 +568,17 @@
 	CmdFrm.operand[6]=0x00;
 	CmdFrm.length=12;
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	if (RspFrm.resp != STABLE && RspFrm.resp != ACCEPTED) {
-		dev_err(&firesat->ud->device, "cannot read tuner status\n");
+		dev_err(&fdtv->ud->device, "cannot read tuner status\n");
 		return -EINVAL;
 	}
 
 	length = RspFrm.operand[9];
 	if (RspFrm.operand[1] != 0x10 || length != sizeof(ANTENNA_INPUT_INFO)) {
-		dev_err(&firesat->ud->device, "got invalid tuner status\n");
+		dev_err(&fdtv->ud->device, "got invalid tuner status\n");
 		return -EINVAL;
 	}
 
@@ -586,7 +586,7 @@
 	return 0;
 }
 
-int avc_lnb_control(struct firesat *firesat, char voltage, char burst,
+int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
 		    char conttone, char nrdiseq,
 		    struct dvb_diseqc_master_cmd *diseqcmd)
 {
@@ -599,7 +599,7 @@
 	CmdFrm.cts=AVC;
 	CmdFrm.ctype=CONTROL;
 	CmdFrm.sutyp=0x05;
-	CmdFrm.suid=firesat->subunit;
+	CmdFrm.suid=fdtv->subunit;
 	CmdFrm.opcode=VENDOR;
 
 	CmdFrm.operand[0]=SFE_VENDOR_DE_COMPANYID_0;
@@ -624,18 +624,18 @@
 
 	CmdFrm.length = ALIGN(3 + i, 4);
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	if (RspFrm.resp != ACCEPTED) {
-		dev_err(&firesat->ud->device, "LNB control failed\n");
+		dev_err(&fdtv->ud->device, "LNB control failed\n");
 		return -EINVAL;
 	}
 
 	return 0;
 }
 
-int avc_register_remote_control(struct firesat *firesat)
+int avc_register_remote_control(struct firedtv *fdtv)
 {
 	AVCCmdFrm CmdFrm;
 
@@ -654,20 +654,20 @@
 
 	CmdFrm.length = 8;
 
-	return avc_write(firesat, &CmdFrm, NULL);
+	return avc_write(fdtv, &CmdFrm, NULL);
 }
 
 void avc_remote_ctrl_work(struct work_struct *work)
 {
-	struct firesat *firesat =
-			container_of(work, struct firesat, remote_ctrl_work);
+	struct firedtv *fdtv =
+			container_of(work, struct firedtv, remote_ctrl_work);
 
 	/* Should it be rescheduled in failure cases? */
-	avc_register_remote_control(firesat);
+	avc_register_remote_control(fdtv);
 }
 
 #if 0 /* FIXME: unused */
-int avc_tuner_host2ca(struct firesat *firesat)
+int avc_tuner_host2ca(struct firedtv *fdtv)
 {
 	AVCCmdFrm CmdFrm;
 	AVCRspFrm RspFrm;
@@ -676,7 +676,7 @@
 	CmdFrm.cts = AVC;
 	CmdFrm.ctype = CONTROL;
 	CmdFrm.sutyp = 0x5;
-	CmdFrm.suid = firesat->subunit;
+	CmdFrm.suid = fdtv->subunit;
 	CmdFrm.opcode = VENDOR;
 
 	CmdFrm.operand[0]=SFE_VENDOR_DE_COMPANYID_0;
@@ -689,7 +689,7 @@
 	CmdFrm.operand[7] = 0; // length
 	CmdFrm.length = 12;
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	return 0;
@@ -721,7 +721,7 @@
 	return RspFrm->operand[7];
 }
 
-int avc_ca_app_info(struct firesat *firesat, char *app_info, unsigned int *len)
+int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len)
 {
 	AVCCmdFrm CmdFrm;
 	AVCRspFrm RspFrm;
@@ -731,7 +731,7 @@
 	CmdFrm.cts = AVC;
 	CmdFrm.ctype = STATUS;
 	CmdFrm.sutyp = 0x5;
-	CmdFrm.suid = firesat->subunit;
+	CmdFrm.suid = fdtv->subunit;
 	CmdFrm.opcode = VENDOR;
 
 	CmdFrm.operand[0]=SFE_VENDOR_DE_COMPANYID_0;
@@ -742,7 +742,7 @@
 	CmdFrm.operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; // ca tag
 	CmdFrm.length = 12;
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	/* FIXME: check response code and validate response data */
@@ -759,7 +759,7 @@
 	return 0;
 }
 
-int avc_ca_info(struct firesat *firesat, char *app_info, unsigned int *len)
+int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len)
 {
 	AVCCmdFrm CmdFrm;
 	AVCRspFrm RspFrm;
@@ -769,7 +769,7 @@
 	CmdFrm.cts = AVC;
 	CmdFrm.ctype = STATUS;
 	CmdFrm.sutyp = 0x5;
-	CmdFrm.suid = firesat->subunit;
+	CmdFrm.suid = fdtv->subunit;
 	CmdFrm.opcode = VENDOR;
 
 	CmdFrm.operand[0]=SFE_VENDOR_DE_COMPANYID_0;
@@ -780,7 +780,7 @@
 	CmdFrm.operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; // ca tag
 	CmdFrm.length = 12;
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	pos = get_ca_object_pos(&RspFrm);
@@ -795,7 +795,7 @@
 	return 0;
 }
 
-int avc_ca_reset(struct firesat *firesat)
+int avc_ca_reset(struct firedtv *fdtv)
 {
 	AVCCmdFrm CmdFrm;
 	AVCRspFrm RspFrm;
@@ -804,7 +804,7 @@
 	CmdFrm.cts = AVC;
 	CmdFrm.ctype = CONTROL;
 	CmdFrm.sutyp = 0x5;
-	CmdFrm.suid = firesat->subunit;
+	CmdFrm.suid = fdtv->subunit;
 	CmdFrm.opcode = VENDOR;
 
 	CmdFrm.operand[0]=SFE_VENDOR_DE_COMPANYID_0;
@@ -818,13 +818,13 @@
 	CmdFrm.operand[8] = 0; // force hardware reset
 	CmdFrm.length = 12;
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	return 0;
 }
 
-int avc_ca_pmt(struct firesat *firesat, char *msg, int length)
+int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
 {
 	AVCCmdFrm CmdFrm;
 	AVCRspFrm RspFrm;
@@ -840,11 +840,11 @@
 	CmdFrm.cts = AVC;
 	CmdFrm.ctype = CONTROL;
 	CmdFrm.sutyp = 0x5;
-	CmdFrm.suid = firesat->subunit;
+	CmdFrm.suid = fdtv->subunit;
 	CmdFrm.opcode = VENDOR;
 
 	if (msg[0] != LIST_MANAGEMENT_ONLY) {
-		dev_info(&firesat->ud->device,
+		dev_info(&fdtv->ud->device,
 			 "forcing list_management to ONLY\n");
 		msg[0] = LIST_MANAGEMENT_ONLY;
 	}
@@ -894,7 +894,7 @@
 	if (program_info_length > 0) {
 		pmt_cmd_id = msg[read_pos++];
 		if (pmt_cmd_id != 1 && pmt_cmd_id != 4)
-			dev_err(&firesat->ud->device,
+			dev_err(&fdtv->ud->device,
 				"invalid pmt_cmd_id %d\n", pmt_cmd_id);
 
 		memcpy(&CmdFrm.operand[write_pos], &msg[read_pos],
@@ -916,7 +916,7 @@
 		if (es_info_length > 0) {
 			pmt_cmd_id = msg[read_pos++];
 			if (pmt_cmd_id != 1 && pmt_cmd_id != 4)
-				dev_err(&firesat->ud->device,
+				dev_err(&fdtv->ud->device,
 					"invalid pmt_cmd_id %d "
 					"at stream level\n", pmt_cmd_id);
 
@@ -945,11 +945,11 @@
 
 	CmdFrm.length = ALIGN(3 + write_pos, 4);
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	if (RspFrm.resp != ACCEPTED) {
-		dev_err(&firesat->ud->device,
+		dev_err(&fdtv->ud->device,
 			"CA PMT failed with response 0x%x\n", RspFrm.resp);
 		return -EFAULT;
 	}
@@ -957,7 +957,7 @@
 	return 0;
 }
 
-int avc_ca_get_time_date(struct firesat *firesat, int *interval)
+int avc_ca_get_time_date(struct firedtv *fdtv, int *interval)
 {
 	AVCCmdFrm CmdFrm;
 	AVCRspFrm RspFrm;
@@ -966,7 +966,7 @@
 	CmdFrm.cts = AVC;
 	CmdFrm.ctype = STATUS;
 	CmdFrm.sutyp = 0x5;
-	CmdFrm.suid = firesat->subunit;
+	CmdFrm.suid = fdtv->subunit;
 	CmdFrm.opcode = VENDOR;
 
 	CmdFrm.operand[0]=SFE_VENDOR_DE_COMPANYID_0;
@@ -979,7 +979,7 @@
 	CmdFrm.operand[7] = 0; // length
 	CmdFrm.length = 12;
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	/* FIXME: check response code and validate response data */
@@ -989,7 +989,7 @@
 	return 0;
 }
 
-int avc_ca_enter_menu(struct firesat *firesat)
+int avc_ca_enter_menu(struct firedtv *fdtv)
 {
 	AVCCmdFrm CmdFrm;
 	AVCRspFrm RspFrm;
@@ -998,7 +998,7 @@
 	CmdFrm.cts = AVC;
 	CmdFrm.ctype = STATUS;
 	CmdFrm.sutyp = 0x5;
-	CmdFrm.suid = firesat->subunit;
+	CmdFrm.suid = fdtv->subunit;
 	CmdFrm.opcode = VENDOR;
 
 	CmdFrm.operand[0]=SFE_VENDOR_DE_COMPANYID_0;
@@ -1011,13 +1011,13 @@
 	CmdFrm.operand[7] = 0; // length
 	CmdFrm.length = 12;
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	return 0;
 }
 
-int avc_ca_get_mmi(struct firesat *firesat, char *mmi_object, unsigned int *len)
+int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len)
 {
 	AVCCmdFrm CmdFrm;
 	AVCRspFrm RspFrm;
@@ -1026,7 +1026,7 @@
 	CmdFrm.cts = AVC;
 	CmdFrm.ctype = STATUS;
 	CmdFrm.sutyp = 0x5;
-	CmdFrm.suid = firesat->subunit;
+	CmdFrm.suid = fdtv->subunit;
 	CmdFrm.opcode = VENDOR;
 
 	CmdFrm.operand[0]=SFE_VENDOR_DE_COMPANYID_0;
@@ -1039,7 +1039,7 @@
 	CmdFrm.operand[7] = 0; // length
 	CmdFrm.length = 12;
 
-	if (avc_write(firesat, &CmdFrm, &RspFrm) < 0)
+	if (avc_write(fdtv, &CmdFrm, &RspFrm) < 0)
 		return -EIO;
 
 	/* FIXME: check response code and validate response data */
diff --git a/drivers/media/dvb/firesat/avc_api.h b/drivers/media/dvb/firewire/avc.h
similarity index 90%
rename from drivers/media/dvb/firesat/avc_api.h
rename to drivers/media/dvb/firewire/avc.h
index 9d2efd8..168f371 100644
--- a/drivers/media/dvb/firesat/avc_api.h
+++ b/drivers/media/dvb/firewire/avc.h
@@ -402,31 +402,31 @@
 
 struct dvb_diseqc_master_cmd;
 struct dvb_frontend_parameters;
-struct firesat;
+struct firedtv;
 
-int avc_recv(struct firesat *firesat, u8 *data, size_t length);
+int avc_recv(struct firedtv *fdtv, u8 *data, size_t length);
 
-int AVCTuner_DSIT(struct firesat *firesat, int Source_Plug,
+int AVCTuner_DSIT(struct firedtv *fdtv, int Source_Plug,
 		struct dvb_frontend_parameters *params, __u8 *status);
 
-int avc_tuner_status(struct firesat *firesat,
+int avc_tuner_status(struct firedtv *fdtv,
 		ANTENNA_INPUT_INFO *antenna_input_info);
-int avc_tuner_dsd(struct firesat *firesat,
+int avc_tuner_dsd(struct firedtv *fdtv,
 		struct dvb_frontend_parameters *params);
-int avc_tuner_set_pids(struct firesat *firesat, unsigned char pidc, u16 pid[]);
-int avc_tuner_get_ts(struct firesat *firesat);
-int avc_identify_subunit(struct firesat *firesat);
-int avc_lnb_control(struct firesat *firesat, char voltage, char burst,
+int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]);
+int avc_tuner_get_ts(struct firedtv *fdtv);
+int avc_identify_subunit(struct firedtv *fdtv);
+int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
 		char conttone, char nrdiseq,
 		struct dvb_diseqc_master_cmd *diseqcmd);
 void avc_remote_ctrl_work(struct work_struct *work);
-int avc_register_remote_control(struct firesat *firesat);
-int avc_ca_app_info(struct firesat *firesat, char *app_info, unsigned int *len);
-int avc_ca_info(struct firesat *firesat, char *app_info, unsigned int *len);
-int avc_ca_reset(struct firesat *firesat);
-int avc_ca_pmt(struct firesat *firesat, char *app_info, int length);
-int avc_ca_get_time_date(struct firesat *firesat, int *interval);
-int avc_ca_enter_menu(struct firesat *firesat);
-int avc_ca_get_mmi(struct firesat *firesat, char *mmi_object, unsigned int *len);
+int avc_register_remote_control(struct firedtv *fdtv);
+int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
+int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
+int avc_ca_reset(struct firedtv *fdtv);
+int avc_ca_pmt(struct firedtv *fdtv, char *app_info, int length);
+int avc_ca_get_time_date(struct firedtv *fdtv, int *interval);
+int avc_ca_enter_menu(struct firedtv *fdtv);
+int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len);
 
 #endif /* _AVC_API_H */
diff --git a/drivers/media/dvb/firesat/cmp.c b/drivers/media/dvb/firewire/cmp.c
similarity index 73%
rename from drivers/media/dvb/firesat/cmp.c
rename to drivers/media/dvb/firewire/cmp.c
index 8e98b81..821e033 100644
--- a/drivers/media/dvb/firesat/cmp.c
+++ b/drivers/media/dvb/firewire/cmp.c
@@ -20,41 +20,41 @@
 #include <ieee1394.h>
 #include <nodemgr.h>
 
-#include "avc_api.h"
+#include "avc.h"
 #include "cmp.h"
-#include "firesat.h"
+#include "firedtv.h"
 
 #define CMP_OUTPUT_PLUG_CONTROL_REG_0	0xfffff0000904ULL
 
-static int cmp_read(struct firesat *firesat, void *buf, u64 addr, size_t len)
+static int cmp_read(struct firedtv *fdtv, void *buf, u64 addr, size_t len)
 {
 	int ret;
 
-	if (mutex_lock_interruptible(&firesat->avc_mutex))
+	if (mutex_lock_interruptible(&fdtv->avc_mutex))
 		return -EINTR;
 
-	ret = hpsb_node_read(firesat->ud->ne, addr, buf, len);
+	ret = hpsb_node_read(fdtv->ud->ne, addr, buf, len);
 	if (ret < 0)
-		dev_err(&firesat->ud->device, "CMP: read I/O error\n");
+		dev_err(&fdtv->ud->device, "CMP: read I/O error\n");
 
-	mutex_unlock(&firesat->avc_mutex);
+	mutex_unlock(&fdtv->avc_mutex);
 	return ret;
 }
 
-static int cmp_lock(struct firesat *firesat, void *data, u64 addr, __be32 arg,
+static int cmp_lock(struct firedtv *fdtv, void *data, u64 addr, __be32 arg,
 		    int ext_tcode)
 {
 	int ret;
 
-	if (mutex_lock_interruptible(&firesat->avc_mutex))
+	if (mutex_lock_interruptible(&fdtv->avc_mutex))
 		return -EINTR;
 
-	ret = hpsb_node_lock(firesat->ud->ne, addr, ext_tcode, data,
+	ret = hpsb_node_lock(fdtv->ud->ne, addr, ext_tcode, data,
 			     (__force quadlet_t)arg);
 	if (ret < 0)
-		dev_err(&firesat->ud->device, "CMP: lock I/O error\n");
+		dev_err(&fdtv->ud->device, "CMP: lock I/O error\n");
 
-	mutex_unlock(&firesat->avc_mutex);
+	mutex_unlock(&fdtv->avc_mutex);
 	return ret;
 }
 
@@ -78,20 +78,20 @@
 #define set_opcr_data_rate(p, v)	set_opcr((p), (v), 0x3, 14)
 #define set_opcr_overhead_id(p, v)	set_opcr((p), (v), 0xf, 10)
 
-int cmp_establish_pp_connection(struct firesat *firesat, int plug, int channel)
+int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel)
 {
 	__be32 old_opcr, opcr;
 	u64 opcr_address = CMP_OUTPUT_PLUG_CONTROL_REG_0 + (plug << 2);
 	int attempts = 0;
 	int ret;
 
-	ret = cmp_read(firesat, &opcr, opcr_address, 4);
+	ret = cmp_read(fdtv, &opcr, opcr_address, 4);
 	if (ret < 0)
 		return ret;
 
 repeat:
 	if (!get_opcr_online(opcr)) {
-		dev_err(&firesat->ud->device, "CMP: output offline\n");
+		dev_err(&fdtv->ud->device, "CMP: output offline\n");
 		return -EBUSY;
 	}
 
@@ -99,11 +99,11 @@
 
 	if (get_opcr_p2p_connections(opcr)) {
 		if (get_opcr_channel(opcr) != channel) {
-			dev_err(&firesat->ud->device,
+			dev_err(&fdtv->ud->device,
 				"CMP: cannot change channel\n");
 			return -EBUSY;
 		}
-		dev_info(&firesat->ud->device,
+		dev_info(&fdtv->ud->device,
 			 "CMP: overlaying existing connection\n");
 
 		/* We don't allocate isochronous resources. */
@@ -119,7 +119,7 @@
 
 	set_opcr_p2p_connections(&opcr, get_opcr_p2p_connections(opcr) + 1);
 
-	ret = cmp_lock(firesat, &opcr, opcr_address, old_opcr, 2);
+	ret = cmp_lock(fdtv, &opcr, opcr_address, old_opcr, 2);
 	if (ret < 0)
 		return ret;
 
@@ -137,26 +137,26 @@
 	return 0;
 }
 
-void cmp_break_pp_connection(struct firesat *firesat, int plug, int channel)
+void cmp_break_pp_connection(struct firedtv *fdtv, int plug, int channel)
 {
 	__be32 old_opcr, opcr;
 	u64 opcr_address = CMP_OUTPUT_PLUG_CONTROL_REG_0 + (plug << 2);
 	int attempts = 0;
 
-	if (cmp_read(firesat, &opcr, opcr_address, 4) < 0)
+	if (cmp_read(fdtv, &opcr, opcr_address, 4) < 0)
 		return;
 
 repeat:
 	if (!get_opcr_online(opcr) || !get_opcr_p2p_connections(opcr) ||
 	    get_opcr_channel(opcr) != channel) {
-		dev_err(&firesat->ud->device, "CMP: no connection to break\n");
+		dev_err(&fdtv->ud->device, "CMP: no connection to break\n");
 		return;
 	}
 
 	old_opcr = opcr;
 	set_opcr_p2p_connections(&opcr, get_opcr_p2p_connections(opcr) - 1);
 
-	if (cmp_lock(firesat, &opcr, opcr_address, old_opcr, 2) < 0)
+	if (cmp_lock(fdtv, &opcr, opcr_address, old_opcr, 2) < 0)
 		return;
 
 	if (old_opcr != opcr) {
diff --git a/drivers/media/dvb/firewire/cmp.h b/drivers/media/dvb/firewire/cmp.h
new file mode 100644
index 0000000..17e182c
--- /dev/null
+++ b/drivers/media/dvb/firewire/cmp.h
@@ -0,0 +1,9 @@
+#ifndef _CMP_H
+#define _CMP_H
+
+struct firedtv;
+
+int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel);
+void cmp_break_pp_connection(struct firedtv *fdtv, int plug, int channel);
+
+#endif /* _CMP_H */
diff --git a/drivers/media/dvb/firewire/firedtv-1394.c b/drivers/media/dvb/firewire/firedtv-1394.c
new file mode 100644
index 0000000..9536182
--- /dev/null
+++ b/drivers/media/dvb/firewire/firedtv-1394.c
@@ -0,0 +1,291 @@
+/*
+ * FireDTV driver (formerly known as FireSAT)
+ *
+ * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
+ * Copyright (C) 2007-2008 Ben Backx <ben@bbackx.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
+ *	published by the Free Software Foundation; either version 2 of
+ *	the License, or (at your option) any later version.
+ */
+
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/string.h>
+#include <linux/types.h>
+
+#include <dmxdev.h>
+#include <dvb_demux.h>
+#include <dvb_frontend.h>
+#include <dvbdev.h>
+
+#include <csr1212.h>
+#include <highlevel.h>
+#include <hosts.h>
+#include <ieee1394_hotplug.h>
+#include <nodemgr.h>
+
+#include "avc.h"
+#include "cmp.h"
+#include "firedtv.h"
+#include "firedtv-ci.h"
+#include "firedtv-rc.h"
+
+#define MATCH_FLAGS	IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID | \
+			IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION
+#define DIGITAL_EVERYWHERE_OUI   0x001287
+
+static struct ieee1394_device_id fdtv_id_table[] = {
+
+	{
+		/* FloppyDTV S/CI and FloppyDTV S2 */
+		.match_flags	= MATCH_FLAGS,
+		.vendor_id	= DIGITAL_EVERYWHERE_OUI,
+		.model_id	= 0x000024,
+		.specifier_id	= AVC_UNIT_SPEC_ID_ENTRY,
+		.version	= AVC_SW_VERSION_ENTRY,
+	},{
+		/* FloppyDTV T/CI */
+		.match_flags	= MATCH_FLAGS,
+		.vendor_id	= DIGITAL_EVERYWHERE_OUI,
+		.model_id	= 0x000025,
+		.specifier_id	= AVC_UNIT_SPEC_ID_ENTRY,
+		.version	= AVC_SW_VERSION_ENTRY,
+	},{
+		/* FloppyDTV C/CI */
+		.match_flags	= MATCH_FLAGS,
+		.vendor_id	= DIGITAL_EVERYWHERE_OUI,
+		.model_id	= 0x000026,
+		.specifier_id	= AVC_UNIT_SPEC_ID_ENTRY,
+		.version	= AVC_SW_VERSION_ENTRY,
+	},{
+		/* FireDTV S/CI and FloppyDTV S2 */
+		.match_flags	= MATCH_FLAGS,
+		.vendor_id	= DIGITAL_EVERYWHERE_OUI,
+		.model_id	= 0x000034,
+		.specifier_id	= AVC_UNIT_SPEC_ID_ENTRY,
+		.version	= AVC_SW_VERSION_ENTRY,
+	},{
+		/* FireDTV T/CI */
+		.match_flags	= MATCH_FLAGS,
+		.vendor_id	= DIGITAL_EVERYWHERE_OUI,
+		.model_id	= 0x000035,
+		.specifier_id	= AVC_UNIT_SPEC_ID_ENTRY,
+		.version	= AVC_SW_VERSION_ENTRY,
+	},{
+		/* FireDTV C/CI */
+		.match_flags	= MATCH_FLAGS,
+		.vendor_id	= DIGITAL_EVERYWHERE_OUI,
+		.model_id	= 0x000036,
+		.specifier_id	= AVC_UNIT_SPEC_ID_ENTRY,
+		.version	= AVC_SW_VERSION_ENTRY,
+	}, { }
+};
+
+MODULE_DEVICE_TABLE(ieee1394, fdtv_id_table);
+
+/* list of all firedtv devices */
+LIST_HEAD(fdtv_list);
+DEFINE_SPINLOCK(fdtv_list_lock);
+
+static void fcp_request(struct hpsb_host *host,
+			int nodeid,
+			int direction,
+			int cts,
+			u8 *data,
+			size_t length)
+{
+	struct firedtv *fdtv = NULL;
+	struct firedtv *fdtv_entry;
+	unsigned long flags;
+
+	if (length > 0 && ((data[0] & 0xf0) >> 4) == 0) {
+
+		spin_lock_irqsave(&fdtv_list_lock, flags);
+		list_for_each_entry(fdtv_entry,&fdtv_list,list) {
+			if (fdtv_entry->ud->ne->host == host &&
+			    fdtv_entry->ud->ne->nodeid == nodeid &&
+			    (fdtv_entry->subunit == (data[1]&0x7) ||
+			     (fdtv_entry->subunit == 0 &&
+			      (data[1]&0x7) == 0x7))) {
+				fdtv=fdtv_entry;
+				break;
+			}
+		}
+		spin_unlock_irqrestore(&fdtv_list_lock, flags);
+
+		if (fdtv)
+			avc_recv(fdtv, data, length);
+	}
+}
+
+const char *fdtv_model_names[] = {
+	[FIREDTV_UNKNOWN] = "unknown type",
+	[FIREDTV_DVB_S]   = "FireDTV S/CI",
+	[FIREDTV_DVB_C]   = "FireDTV C/CI",
+	[FIREDTV_DVB_T]   = "FireDTV T/CI",
+	[FIREDTV_DVB_S2]  = "FireDTV S2  ",
+};
+
+static int fdtv_probe(struct device *dev)
+{
+	struct unit_directory *ud =
+			container_of(dev, struct unit_directory, device);
+	struct firedtv *fdtv;
+	unsigned long flags;
+	int kv_len;
+	void *kv_str;
+	int i;
+	int err = -ENOMEM;
+
+	fdtv = kzalloc(sizeof(*fdtv), GFP_KERNEL);
+	if (!fdtv)
+		return -ENOMEM;
+
+	dev->driver_data	= fdtv;
+	fdtv->ud		= ud;
+	fdtv->subunit		= 0;
+	fdtv->isochannel	= -1;
+	fdtv->tone		= 0xff;
+	fdtv->voltage		= 0xff;
+
+	mutex_init(&fdtv->avc_mutex);
+	init_waitqueue_head(&fdtv->avc_wait);
+	fdtv->avc_reply_received = true;
+	mutex_init(&fdtv->demux_mutex);
+	INIT_WORK(&fdtv->remote_ctrl_work, avc_remote_ctrl_work);
+
+	/* Reading device model from ROM */
+	kv_len = (ud->model_name_kv->value.leaf.len - 2) * sizeof(quadlet_t);
+	kv_str = CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(ud->model_name_kv);
+	for (i = ARRAY_SIZE(fdtv_model_names); --i;)
+		if (strlen(fdtv_model_names[i]) <= kv_len &&
+		    strncmp(kv_str, fdtv_model_names[i], kv_len) == 0)
+			break;
+	fdtv->type = i;
+
+	/*
+	 * Work around a bug in udev's path_id script:  Use the fw-host's dev
+	 * instead of the unit directory's dev as parent of the input device.
+	 */
+	err = fdtv_register_rc(fdtv, dev->parent->parent);
+	if (err)
+		goto fail_free;
+
+	INIT_LIST_HEAD(&fdtv->list);
+	spin_lock_irqsave(&fdtv_list_lock, flags);
+	list_add_tail(&fdtv->list, &fdtv_list);
+	spin_unlock_irqrestore(&fdtv_list_lock, flags);
+
+	err = avc_identify_subunit(fdtv);
+	if (err)
+		goto fail;
+
+	err = fdtv_dvbdev_init(fdtv, dev);
+	if (err)
+		goto fail;
+
+	avc_register_remote_control(fdtv);
+	return 0;
+
+fail:
+	spin_lock_irqsave(&fdtv_list_lock, flags);
+	list_del(&fdtv->list);
+	spin_unlock_irqrestore(&fdtv_list_lock, flags);
+	fdtv_unregister_rc(fdtv);
+fail_free:
+	kfree(fdtv);
+	return err;
+}
+
+static int fdtv_remove(struct device *dev)
+{
+	struct firedtv *fdtv = dev->driver_data;
+	unsigned long flags;
+
+	fdtv_ca_release(fdtv);
+	dvb_unregister_frontend(&fdtv->fe);
+	dvb_net_release(&fdtv->dvbnet);
+	fdtv->demux.dmx.close(&fdtv->demux.dmx);
+	fdtv->demux.dmx.remove_frontend(&fdtv->demux.dmx,
+					   &fdtv->frontend);
+	dvb_dmxdev_release(&fdtv->dmxdev);
+	dvb_dmx_release(&fdtv->demux);
+	dvb_unregister_adapter(&fdtv->adapter);
+
+	spin_lock_irqsave(&fdtv_list_lock, flags);
+	list_del(&fdtv->list);
+	spin_unlock_irqrestore(&fdtv_list_lock, flags);
+
+	cancel_work_sync(&fdtv->remote_ctrl_work);
+	fdtv_unregister_rc(fdtv);
+
+	kfree(fdtv);
+	return 0;
+}
+
+static int fdtv_update(struct unit_directory *ud)
+{
+	struct firedtv *fdtv = ud->device.driver_data;
+
+	if (fdtv->isochannel >= 0)
+		cmp_establish_pp_connection(fdtv, fdtv->subunit,
+					    fdtv->isochannel);
+	return 0;
+}
+
+static struct hpsb_protocol_driver fdtv_driver = {
+
+	.name		= "firedtv",
+	.id_table	= fdtv_id_table,
+	.update		= fdtv_update,
+
+	.driver         = {
+		//.name and .bus are filled in for us in more recent linux versions
+		//.name	= "FireDTV",
+		//.bus	= &ieee1394_bus_type,
+		.probe  = fdtv_probe,
+		.remove = fdtv_remove,
+	},
+};
+
+static struct hpsb_highlevel fdtv_highlevel = {
+	.name		= "firedtv",
+	.fcp_request	= fcp_request,
+};
+
+static int __init fdtv_init(void)
+{
+	int ret;
+
+	hpsb_register_highlevel(&fdtv_highlevel);
+	ret = hpsb_register_protocol(&fdtv_driver);
+	if (ret) {
+		printk(KERN_ERR "firedtv: failed to register protocol\n");
+		hpsb_unregister_highlevel(&fdtv_highlevel);
+	}
+	return ret;
+}
+
+static void __exit fdtv_exit(void)
+{
+	hpsb_unregister_protocol(&fdtv_driver);
+	hpsb_unregister_highlevel(&fdtv_highlevel);
+}
+
+module_init(fdtv_init);
+module_exit(fdtv_exit);
+
+MODULE_AUTHOR("Andreas Monitzer <andy@monitzer.com>");
+MODULE_AUTHOR("Ben Backx <ben@bbackx.com>");
+MODULE_DESCRIPTION("FireDTV DVB Driver");
+MODULE_LICENSE("GPL");
+MODULE_SUPPORTED_DEVICE("FireDTV DVB");
diff --git a/drivers/media/dvb/firewire/firedtv-ci.c b/drivers/media/dvb/firewire/firedtv-ci.c
new file mode 100644
index 0000000..6d87926
--- /dev/null
+++ b/drivers/media/dvb/firewire/firedtv-ci.c
@@ -0,0 +1,261 @@
+/*
+ * FireDTV driver (formerly known as FireSAT)
+ *
+ * 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
+ *	published by the Free Software Foundation; either version 2 of
+ *	the License, or (at your option) any later version.
+ */
+
+#include <linux/dvb/ca.h>
+#include <linux/fs.h>
+#include <linux/module.h>
+
+#include <dvbdev.h>
+
+#include "avc.h"
+#include "firedtv.h"
+#include "firedtv-ci.h"
+
+static int fdtv_ca_ready(ANTENNA_INPUT_INFO *info)
+{
+	return info->CaInitializationStatus == 1 &&
+	       info->CaErrorFlag == 0 &&
+	       info->CaDvbFlag == 1 &&
+	       info->CaModulePresentStatus == 1;
+}
+
+static int fdtv_get_ca_flags(ANTENNA_INPUT_INFO *info)
+{
+	int flags = 0;
+
+	if (info->CaModulePresentStatus == 1)
+		flags |= CA_CI_MODULE_PRESENT;
+	if (info->CaInitializationStatus == 1 &&
+	    info->CaErrorFlag == 0 &&
+	    info->CaDvbFlag == 1)
+		flags |= CA_CI_MODULE_READY;
+	return flags;
+}
+
+static int fdtv_ca_reset(struct firedtv *fdtv)
+{
+	return avc_ca_reset(fdtv) ? -EFAULT : 0;
+}
+
+static int fdtv_ca_get_caps(void *arg)
+{
+	struct ca_caps *cap = arg;
+
+	cap->slot_num = 1;
+	cap->slot_type = CA_CI;
+	cap->descr_num = 1;
+	cap->descr_type = CA_ECD;
+	return 0;
+}
+
+static int fdtv_ca_get_slot_info(struct firedtv *fdtv, void *arg)
+{
+	ANTENNA_INPUT_INFO info;
+	struct ca_slot_info *slot = arg;
+
+	if (avc_tuner_status(fdtv, &info))
+		return -EFAULT;
+
+	if (slot->num != 0)
+		return -EFAULT;
+
+	slot->type = CA_CI;
+	slot->flags = fdtv_get_ca_flags(&info);
+	return 0;
+}
+
+static int fdtv_ca_app_info(struct firedtv *fdtv, void *arg)
+{
+	struct ca_msg *reply = arg;
+
+	return
+	    avc_ca_app_info(fdtv, reply->msg, &reply->length) ? -EFAULT : 0;
+}
+
+static int fdtv_ca_info(struct firedtv *fdtv, void *arg)
+{
+	struct ca_msg *reply = arg;
+
+	return avc_ca_info(fdtv, reply->msg, &reply->length) ? -EFAULT : 0;
+}
+
+static int fdtv_ca_get_mmi(struct firedtv *fdtv, void *arg)
+{
+	struct ca_msg *reply = arg;
+
+	return
+	    avc_ca_get_mmi(fdtv, reply->msg, &reply->length) ? -EFAULT : 0;
+}
+
+static int fdtv_ca_get_msg(struct firedtv *fdtv, void *arg)
+{
+	ANTENNA_INPUT_INFO info;
+	int err;
+
+	switch (fdtv->ca_last_command) {
+	case TAG_APP_INFO_ENQUIRY:
+		err = fdtv_ca_app_info(fdtv, arg);
+		break;
+	case TAG_CA_INFO_ENQUIRY:
+		err = fdtv_ca_info(fdtv, arg);
+		break;
+	default:
+		if (avc_tuner_status(fdtv, &info))
+			err = -EFAULT;
+		else if (info.CaMmi == 1)
+			err = fdtv_ca_get_mmi(fdtv, arg);
+		else {
+			printk(KERN_INFO "%s: Unhandled message 0x%08X\n",
+			       __func__, fdtv->ca_last_command);
+			err = -EFAULT;
+		}
+	}
+	fdtv->ca_last_command = 0;
+	return err;
+}
+
+static int fdtv_ca_pmt(struct firedtv *fdtv, void *arg)
+{
+	struct ca_msg *msg = arg;
+	int data_pos;
+	int data_length;
+	int i;
+
+	data_pos = 4;
+	if (msg->msg[3] & 0x80) {
+		data_length = 0;
+		for (i = 0; i < (msg->msg[3] & 0x7F); i++)
+			data_length = (data_length << 8) + msg->msg[data_pos++];
+	} else {
+		data_length = msg->msg[3];
+	}
+
+	return avc_ca_pmt(fdtv, &msg->msg[data_pos], data_length) ?
+	       -EFAULT : 0;
+}
+
+static int fdtv_ca_send_msg(struct firedtv *fdtv, void *arg)
+{
+	struct ca_msg *msg = arg;
+	int err;
+
+	/* Do we need a semaphore for this? */
+	fdtv->ca_last_command =
+		(msg->msg[0] << 16) + (msg->msg[1] << 8) + msg->msg[2];
+	switch (fdtv->ca_last_command) {
+	case TAG_CA_PMT:
+		err = fdtv_ca_pmt(fdtv, arg);
+		break;
+	case TAG_APP_INFO_ENQUIRY:
+		/* handled in ca_get_msg */
+		err = 0;
+		break;
+	case TAG_CA_INFO_ENQUIRY:
+		/* handled in ca_get_msg */
+		err = 0;
+		break;
+	case TAG_ENTER_MENU:
+		err = avc_ca_enter_menu(fdtv);
+		break;
+	default:
+		printk(KERN_ERR "%s: Unhandled unknown message 0x%08X\n",
+		       __func__, fdtv->ca_last_command);
+		err = -EFAULT;
+	}
+	return err;
+}
+
+static int fdtv_ca_ioctl(struct inode *inode, struct file *file,
+			    unsigned int cmd, void *arg)
+{
+	struct dvb_device *dvbdev = file->private_data;
+	struct firedtv *fdtv = dvbdev->priv;
+	ANTENNA_INPUT_INFO info;
+	int err;
+
+	switch(cmd) {
+	case CA_RESET:
+		err = fdtv_ca_reset(fdtv);
+		break;
+	case CA_GET_CAP:
+		err = fdtv_ca_get_caps(arg);
+		break;
+	case CA_GET_SLOT_INFO:
+		err = fdtv_ca_get_slot_info(fdtv, arg);
+		break;
+	case CA_GET_MSG:
+		err = fdtv_ca_get_msg(fdtv, arg);
+		break;
+	case CA_SEND_MSG:
+		err = fdtv_ca_send_msg(fdtv, arg);
+		break;
+	default:
+		printk(KERN_INFO "%s: Unhandled ioctl, command: %u\n",__func__,
+		       cmd);
+		err = -EOPNOTSUPP;
+	}
+
+	/* FIXME Is this necessary? */
+	avc_tuner_status(fdtv, &info);
+
+	return err;
+}
+
+static unsigned int fdtv_ca_io_poll(struct file *file, poll_table *wait)
+{
+	return POLLIN;
+}
+
+static struct file_operations fdtv_ca_fops = {
+	.owner		= THIS_MODULE,
+	.ioctl		= dvb_generic_ioctl,
+	.open		= dvb_generic_open,
+	.release	= dvb_generic_release,
+	.poll		= fdtv_ca_io_poll,
+};
+
+static struct dvb_device fdtv_ca = {
+	.users		= 1,
+	.readers	= 1,
+	.writers	= 1,
+	.fops		= &fdtv_ca_fops,
+	.kernel_ioctl	= fdtv_ca_ioctl,
+};
+
+int fdtv_ca_register(struct firedtv *fdtv)
+{
+	ANTENNA_INPUT_INFO info;
+	int err;
+
+	if (avc_tuner_status(fdtv, &info))
+		return -EINVAL;
+
+	if (!fdtv_ca_ready(&info))
+		return -EFAULT;
+
+	err = dvb_register_device(&fdtv->adapter, &fdtv->cadev,
+				  &fdtv_ca, fdtv, DVB_DEVICE_CA);
+
+	if (info.CaApplicationInfo == 0)
+		printk(KERN_ERR "%s: CaApplicationInfo is not set.\n",
+		       __func__);
+	if (info.CaDateTimeRequest == 1)
+		avc_ca_get_time_date(fdtv, &fdtv->ca_time_interval);
+
+	return err;
+}
+
+void fdtv_ca_release(struct firedtv *fdtv)
+{
+	if (fdtv->cadev)
+		dvb_unregister_device(fdtv->cadev);
+}
diff --git a/drivers/media/dvb/firewire/firedtv-ci.h b/drivers/media/dvb/firewire/firedtv-ci.h
new file mode 100644
index 0000000..d6840f5
--- /dev/null
+++ b/drivers/media/dvb/firewire/firedtv-ci.h
@@ -0,0 +1,9 @@
+#ifndef _FIREDTV_CI_H
+#define _FIREDTV_CI_H
+
+struct firedtv;
+
+int fdtv_ca_register(struct firedtv *fdtv);
+void fdtv_ca_release(struct firedtv *fdtv);
+
+#endif /* _FIREDTV_CI_H */
diff --git a/drivers/media/dvb/firewire/firedtv-dvb.c b/drivers/media/dvb/firewire/firedtv-dvb.c
new file mode 100644
index 0000000..1823058
--- /dev/null
+++ b/drivers/media/dvb/firewire/firedtv-dvb.c
@@ -0,0 +1,276 @@
+/*
+ * FireDTV driver (formerly known as FireSAT)
+ *
+ * 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
+ *	published by the Free Software Foundation; either version 2 of
+ *	the License, or (at your option) any later version.
+ */
+
+#include <linux/errno.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 "avc.h"
+#include "firedtv.h"
+#include "firedtv-ci.h"
+
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
+static struct firedtv_channel *fdtv_channel_allocate(struct firedtv *fdtv)
+{
+	struct firedtv_channel *c = NULL;
+	int k;
+
+	if (mutex_lock_interruptible(&fdtv->demux_mutex))
+		return NULL;
+
+	for (k = 0; k < 16; k++)
+		if (!fdtv->channel[k].active) {
+			fdtv->channel[k].active = true;
+			c = &fdtv->channel[k];
+			break;
+		}
+
+	mutex_unlock(&fdtv->demux_mutex);
+	return c;
+}
+
+static int fdtv_channel_collect(struct firedtv *fdtv, int *pidc, u16 pid[])
+{
+	int k, l = 0;
+
+	if (mutex_lock_interruptible(&fdtv->demux_mutex))
+		return -EINTR;
+
+	for (k = 0; k < 16; k++)
+		if (fdtv->channel[k].active)
+			pid[l++] = fdtv->channel[k].pid;
+
+	mutex_unlock(&fdtv->demux_mutex);
+
+	*pidc = l;
+
+	return 0;
+}
+
+static int fdtv_channel_release(struct firedtv *fdtv,
+				   struct firedtv_channel *channel)
+{
+	if (mutex_lock_interruptible(&fdtv->demux_mutex))
+		return -EINTR;
+
+	channel->active = false;
+
+	mutex_unlock(&fdtv->demux_mutex);
+	return 0;
+}
+
+int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed)
+{
+	struct firedtv *fdtv = (struct firedtv*)dvbdmxfeed->demux->priv;
+	struct firedtv_channel *channel;
+	int pidc,k;
+	u16 pids[16];
+
+	switch (dvbdmxfeed->type) {
+	case DMX_TYPE_TS:
+	case DMX_TYPE_SEC:
+		break;
+	default:
+		printk(KERN_ERR "%s: invalid type %u\n",
+		       __func__, dvbdmxfeed->type);
+		return -EINVAL;
+	}
+
+	if (dvbdmxfeed->type == DMX_TYPE_TS) {
+		switch (dvbdmxfeed->pes_type) {
+		case DMX_TS_PES_VIDEO:
+		case DMX_TS_PES_AUDIO:
+		case DMX_TS_PES_TELETEXT:
+		case DMX_TS_PES_PCR:
+		case DMX_TS_PES_OTHER:
+			//Dirty fix to keep fdtv->channel pid-list up to date
+			for(k=0;k<16;k++){
+				if (!fdtv->channel[k].active)
+					fdtv->channel[k].pid =
+						dvbdmxfeed->pid;
+					break;
+			}
+			channel = fdtv_channel_allocate(fdtv);
+			break;
+		default:
+			printk(KERN_ERR "%s: invalid pes type %u\n",
+			       __func__, dvbdmxfeed->pes_type);
+			return -EINVAL;
+		}
+	} else {
+		channel = fdtv_channel_allocate(fdtv);
+	}
+
+	if (!channel) {
+		printk(KERN_ERR "%s: busy!\n", __func__);
+		return -EBUSY;
+	}
+
+	dvbdmxfeed->priv = channel;
+	channel->pid = dvbdmxfeed->pid;
+
+	if (fdtv_channel_collect(fdtv, &pidc, pids)) {
+		fdtv_channel_release(fdtv, channel);
+		printk(KERN_ERR "%s: could not collect pids!\n", __func__);
+		return -EINTR;
+	}
+
+	if (dvbdmxfeed->pid == 8192) {
+		k = avc_tuner_get_ts(fdtv);
+		if (k) {
+			fdtv_channel_release(fdtv, channel);
+			printk("%s: AVCTuner_GetTS failed with error %d\n",
+			       __func__, k);
+			return k;
+		}
+	} else {
+		k = avc_tuner_set_pids(fdtv, pidc, pids);
+		if (k) {
+			fdtv_channel_release(fdtv, channel);
+			printk("%s: AVCTuner_SetPIDs failed with error %d\n",
+			       __func__, k);
+			return k;
+		}
+	}
+
+	return 0;
+}
+
+int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
+{
+	struct dvb_demux *demux = dvbdmxfeed->demux;
+	struct firedtv *fdtv = (struct firedtv*)demux->priv;
+	struct firedtv_channel *c = dvbdmxfeed->priv;
+	int k, l;
+	u16 pids[16];
+
+	if (dvbdmxfeed->type == DMX_TYPE_TS && !((dvbdmxfeed->ts_type & TS_PACKET) &&
+				(demux->dmx.frontend->source != DMX_MEMORY_FE))) {
+
+		if (dvbdmxfeed->ts_type & TS_DECODER) {
+
+			if (dvbdmxfeed->pes_type >= DMX_TS_PES_OTHER ||
+				!demux->pesfilter[dvbdmxfeed->pes_type])
+
+				return -EINVAL;
+
+			demux->pids[dvbdmxfeed->pes_type] |= 0x8000;
+			demux->pesfilter[dvbdmxfeed->pes_type] = NULL;
+		}
+
+		if (!(dvbdmxfeed->ts_type & TS_DECODER &&
+			dvbdmxfeed->pes_type < DMX_TS_PES_OTHER))
+
+			return 0;
+	}
+
+	if (mutex_lock_interruptible(&fdtv->demux_mutex))
+		return -EINTR;
+
+	/* list except channel to be removed */
+	for (k = 0, l = 0; k < 16; k++)
+		if (fdtv->channel[k].active) {
+			if (&fdtv->channel[k] != c)
+				pids[l++] = fdtv->channel[k].pid;
+			else
+				fdtv->channel[k].active = false;
+		}
+
+	k = avc_tuner_set_pids(fdtv, l, pids);
+	if (!k)
+		c->active = false;
+
+	mutex_unlock(&fdtv->demux_mutex);
+	return k;
+}
+
+int fdtv_dvbdev_init(struct firedtv *fdtv, struct device *dev)
+{
+	int err;
+
+	err = DVB_REGISTER_ADAPTER(&fdtv->adapter,
+				   fdtv_model_names[fdtv->type],
+				   THIS_MODULE, dev, adapter_nr);
+	if (err < 0)
+		goto fail_log;
+
+	/*DMX_TS_FILTERING | DMX_SECTION_FILTERING*/
+	fdtv->demux.dmx.capabilities = 0;
+
+	fdtv->demux.priv	= fdtv;
+	fdtv->demux.filternum	= 16;
+	fdtv->demux.feednum	= 16;
+	fdtv->demux.start_feed	= fdtv_start_feed;
+	fdtv->demux.stop_feed	= fdtv_stop_feed;
+	fdtv->demux.write_to_decoder = NULL;
+
+	err = dvb_dmx_init(&fdtv->demux);
+	if (err)
+		goto fail_unreg_adapter;
+
+	fdtv->dmxdev.filternum	= 16;
+	fdtv->dmxdev.demux		= &fdtv->demux.dmx;
+	fdtv->dmxdev.capabilities	= 0;
+
+	err = dvb_dmxdev_init(&fdtv->dmxdev, &fdtv->adapter);
+	if (err)
+		goto fail_dmx_release;
+
+	fdtv->frontend.source = DMX_FRONTEND_0;
+
+	err = fdtv->demux.dmx.add_frontend(&fdtv->demux.dmx,
+					      &fdtv->frontend);
+	if (err)
+		goto fail_dmxdev_release;
+
+	err = fdtv->demux.dmx.connect_frontend(&fdtv->demux.dmx,
+						  &fdtv->frontend);
+	if (err)
+		goto fail_rem_frontend;
+
+	dvb_net_init(&fdtv->adapter, &fdtv->dvbnet, &fdtv->demux.dmx);
+
+	fdtv_frontend_init(fdtv);
+	err = dvb_register_frontend(&fdtv->adapter, &fdtv->fe);
+	if (err)
+		goto fail_net_release;
+
+	err = fdtv_ca_register(fdtv);
+	if (err)
+		dev_info(dev, "Conditional Access Module not enabled\n");
+
+	return 0;
+
+fail_net_release:
+	dvb_net_release(&fdtv->dvbnet);
+	fdtv->demux.dmx.close(&fdtv->demux.dmx);
+fail_rem_frontend:
+	fdtv->demux.dmx.remove_frontend(&fdtv->demux.dmx,
+					   &fdtv->frontend);
+fail_dmxdev_release:
+	dvb_dmxdev_release(&fdtv->dmxdev);
+fail_dmx_release:
+	dvb_dmx_release(&fdtv->demux);
+fail_unreg_adapter:
+	dvb_unregister_adapter(&fdtv->adapter);
+fail_log:
+	dev_err(dev, "DVB initialization failed\n");
+	return err;
+}
+
+
diff --git a/drivers/media/dvb/firewire/firedtv-fe.c b/drivers/media/dvb/firewire/firedtv-fe.c
new file mode 100644
index 0000000..f8150f4
--- /dev/null
+++ b/drivers/media/dvb/firewire/firedtv-fe.c
@@ -0,0 +1,245 @@
+/*
+ * FireDTV driver (formerly known as FireSAT)
+ *
+ * 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
+ *	published by the Free Software Foundation; either version 2 of
+ *	the License, or (at your option) any later version.
+ */
+
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/types.h>
+
+#include <dvb_frontend.h>
+
+#include "avc.h"
+#include "cmp.h"
+#include "firedtv.h"
+
+static int fdtv_dvb_init(struct dvb_frontend *fe)
+{
+	struct firedtv *fdtv = fe->sec_priv;
+	int err;
+
+	/* FIXME - allocate free channel at IRM */
+	fdtv->isochannel = fdtv->adapter.num;
+
+	err = cmp_establish_pp_connection(fdtv, fdtv->subunit,
+					  fdtv->isochannel);
+	if (err) {
+		printk(KERN_ERR "Could not establish point to point "
+		       "connection.\n");
+		return err;
+	}
+
+	return setup_iso_channel(fdtv);
+}
+
+static int fdtv_sleep(struct dvb_frontend *fe)
+{
+	struct firedtv *fdtv = fe->sec_priv;
+
+	tear_down_iso_channel(fdtv);
+	cmp_break_pp_connection(fdtv, fdtv->subunit, fdtv->isochannel);
+	fdtv->isochannel = -1;
+	return 0;
+}
+
+static int fdtv_diseqc_send_master_cmd(struct dvb_frontend *fe,
+					  struct dvb_diseqc_master_cmd *cmd)
+{
+	struct firedtv *fdtv = fe->sec_priv;
+
+	return avc_lnb_control(fdtv, LNBCONTROL_DONTCARE,
+			LNBCONTROL_DONTCARE, LNBCONTROL_DONTCARE, 1, cmd);
+}
+
+static int fdtv_diseqc_send_burst(struct dvb_frontend *fe,
+				     fe_sec_mini_cmd_t minicmd)
+{
+	return 0;
+}
+
+static int fdtv_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
+{
+	struct firedtv *fdtv = fe->sec_priv;
+
+	fdtv->tone = tone;
+	return 0;
+}
+
+static int fdtv_set_voltage(struct dvb_frontend *fe,
+			       fe_sec_voltage_t voltage)
+{
+	struct firedtv *fdtv = fe->sec_priv;
+
+	fdtv->voltage = voltage;
+	return 0;
+}
+
+static int fdtv_read_status(struct dvb_frontend *fe, fe_status_t *status)
+{
+	struct firedtv *fdtv = fe->sec_priv;
+	ANTENNA_INPUT_INFO info;
+
+	if (avc_tuner_status(fdtv, &info))
+		return -EINVAL;
+
+	if (info.NoRF)
+		*status = 0;
+	else
+		*status = FE_HAS_SIGNAL | FE_HAS_VITERBI | FE_HAS_SYNC |
+			  FE_HAS_CARRIER | FE_HAS_LOCK;
+	return 0;
+}
+
+static int fdtv_read_ber(struct dvb_frontend *fe, u32 *ber)
+{
+	struct firedtv *fdtv = fe->sec_priv;
+	ANTENNA_INPUT_INFO info;
+
+	if (avc_tuner_status(fdtv, &info))
+		return -EINVAL;
+
+	*ber = info.BER[0] << 24 | info.BER[1] << 16 |
+	       info.BER[2] << 8 | info.BER[3];
+	return 0;
+}
+
+static int fdtv_read_signal_strength (struct dvb_frontend *fe, u16 *strength)
+{
+	struct firedtv *fdtv = fe->sec_priv;
+	ANTENNA_INPUT_INFO info;
+
+	if (avc_tuner_status(fdtv, &info))
+		return -EINVAL;
+
+	*strength = info.SignalStrength << 8;
+	return 0;
+}
+
+static int fdtv_read_snr(struct dvb_frontend *fe, u16 *snr)
+{
+	struct firedtv *fdtv = fe->sec_priv;
+	ANTENNA_INPUT_INFO info;
+
+	if (avc_tuner_status(fdtv, &info))
+		return -EINVAL;
+
+	/* C/N[dB] = -10 * log10(snr / 65535) */
+	*snr = (info.CarrierNoiseRatio[0] << 8) + info.CarrierNoiseRatio[1];
+	*snr *= 257;
+	return 0;
+}
+
+static int fdtv_read_uncorrected_blocks(struct dvb_frontend *fe, u32 *ucblocks)
+{
+	return -EOPNOTSUPP;
+}
+
+static int fdtv_set_frontend(struct dvb_frontend *fe,
+				struct dvb_frontend_parameters *params)
+{
+	struct firedtv *fdtv = fe->sec_priv;
+
+	/* FIXME: avc_tuner_dsd never returns ACCEPTED. Check status? */
+	if (avc_tuner_dsd(fdtv, params) != ACCEPTED)
+		return -EINVAL;
+	else
+		return 0; /* not sure of this... */
+}
+
+static int fdtv_get_frontend(struct dvb_frontend *fe,
+				struct dvb_frontend_parameters *params)
+{
+	return -EOPNOTSUPP;
+}
+
+void fdtv_frontend_init(struct firedtv *fdtv)
+{
+	struct dvb_frontend_ops *ops = &fdtv->fe.ops;
+	struct dvb_frontend_info *fi = &ops->info;
+
+	ops->init			= fdtv_dvb_init;
+	ops->sleep			= fdtv_sleep;
+
+	ops->set_frontend		= fdtv_set_frontend;
+	ops->get_frontend		= fdtv_get_frontend;
+
+	ops->read_status		= fdtv_read_status;
+	ops->read_ber			= fdtv_read_ber;
+	ops->read_signal_strength	= fdtv_read_signal_strength;
+	ops->read_snr			= fdtv_read_snr;
+	ops->read_ucblocks		= fdtv_read_uncorrected_blocks;
+
+	ops->diseqc_send_master_cmd 	= fdtv_diseqc_send_master_cmd;
+	ops->diseqc_send_burst		= fdtv_diseqc_send_burst;
+	ops->set_tone			= fdtv_set_tone;
+	ops->set_voltage		= fdtv_set_voltage;
+
+	switch (fdtv->type) {
+	case FIREDTV_DVB_S:
+		fi->type		= FE_QPSK;
+
+		fi->frequency_min	= 950000;
+		fi->frequency_max	= 2150000;
+		fi->frequency_stepsize	= 125;
+		fi->symbol_rate_min	= 1000000;
+		fi->symbol_rate_max	= 40000000;
+
+		fi->caps 		= FE_CAN_INVERSION_AUTO	|
+					  FE_CAN_FEC_1_2	|
+					  FE_CAN_FEC_2_3	|
+					  FE_CAN_FEC_3_4	|
+					  FE_CAN_FEC_5_6	|
+					  FE_CAN_FEC_7_8	|
+					  FE_CAN_FEC_AUTO	|
+					  FE_CAN_QPSK;
+		break;
+
+	case FIREDTV_DVB_C:
+		fi->type		= FE_QAM;
+
+		fi->frequency_min	= 47000000;
+		fi->frequency_max	= 866000000;
+		fi->frequency_stepsize	= 62500;
+		fi->symbol_rate_min	= 870000;
+		fi->symbol_rate_max	= 6900000;
+
+		fi->caps 		= FE_CAN_INVERSION_AUTO |
+					  FE_CAN_QAM_16		|
+					  FE_CAN_QAM_32		|
+					  FE_CAN_QAM_64		|
+					  FE_CAN_QAM_128	|
+					  FE_CAN_QAM_256	|
+					  FE_CAN_QAM_AUTO;
+		break;
+
+	case FIREDTV_DVB_T:
+		fi->type		= FE_OFDM;
+
+		fi->frequency_min	= 49000000;
+		fi->frequency_max	= 861000000;
+		fi->frequency_stepsize	= 62500;
+
+		fi->caps 		= FE_CAN_INVERSION_AUTO		|
+					  FE_CAN_FEC_2_3		|
+					  FE_CAN_TRANSMISSION_MODE_AUTO |
+					  FE_CAN_GUARD_INTERVAL_AUTO	|
+					  FE_CAN_HIERARCHY_AUTO;
+		break;
+
+	default:
+		printk(KERN_ERR "FireDTV: no frontend for model type %d\n",
+		       fdtv->type);
+	}
+	strcpy(fi->name, fdtv_model_names[fdtv->type]);
+
+	fdtv->fe.dvb = &fdtv->adapter;
+	fdtv->fe.sec_priv = fdtv;
+}
diff --git a/drivers/media/dvb/firesat/firesat_iso.c b/drivers/media/dvb/firewire/firedtv-iso.c
similarity index 71%
rename from drivers/media/dvb/firesat/firesat_iso.c
rename to drivers/media/dvb/firewire/firedtv-iso.c
index b3c61f9..a72df22 100644
--- a/drivers/media/dvb/firesat/firesat_iso.c
+++ b/drivers/media/dvb/firewire/firedtv-iso.c
@@ -20,35 +20,35 @@
 #include <iso.h>
 #include <nodemgr.h>
 
-#include "firesat.h"
+#include "firedtv.h"
 
 static void rawiso_activity_cb(struct hpsb_iso *iso);
 
-void tear_down_iso_channel(struct firesat *firesat)
+void tear_down_iso_channel(struct firedtv *fdtv)
 {
-	if (firesat->iso_handle != NULL) {
-		hpsb_iso_stop(firesat->iso_handle);
-		hpsb_iso_shutdown(firesat->iso_handle);
+	if (fdtv->iso_handle != NULL) {
+		hpsb_iso_stop(fdtv->iso_handle);
+		hpsb_iso_shutdown(fdtv->iso_handle);
 	}
-	firesat->iso_handle = NULL;
+	fdtv->iso_handle = NULL;
 }
 
-int setup_iso_channel(struct firesat *firesat)
+int setup_iso_channel(struct firedtv *fdtv)
 {
 	int result;
-	firesat->iso_handle =
-		hpsb_iso_recv_init(firesat->ud->ne->host,
+	fdtv->iso_handle =
+		hpsb_iso_recv_init(fdtv->ud->ne->host,
 				   256 * 200, //data_buf_size,
 				   256, //buf_packets,
-				   firesat->isochannel,
+				   fdtv->isochannel,
 				   HPSB_ISO_DMA_DEFAULT, //dma_mode,
 				   -1, //stat.config.irq_interval,
 				   rawiso_activity_cb);
-	if (firesat->iso_handle == NULL) {
+	if (fdtv->iso_handle == NULL) {
 		printk(KERN_ERR "Cannot initialize iso receive.\n");
 		return -EINVAL;
 	}
-	result = hpsb_iso_recv_start(firesat->iso_handle, -1, -1, 0);
+	result = hpsb_iso_recv_start(fdtv->iso_handle, -1, -1, 0);
 	if (result != 0) {
 		printk(KERN_ERR "Cannot start iso receive.\n");
 		return -EINVAL;
@@ -62,19 +62,19 @@
 	unsigned int i;
 	unsigned int packet;
 	unsigned long flags;
-	struct firesat *firesat = NULL;
-	struct firesat *firesat_iterator;
+	struct firedtv *fdtv = NULL;
+	struct firedtv *fdtv_iterator;
 
-	spin_lock_irqsave(&firesat_list_lock, flags);
-	list_for_each_entry(firesat_iterator, &firesat_list, list) {
-		if(firesat_iterator->iso_handle == iso) {
-			firesat = firesat_iterator;
+	spin_lock_irqsave(&fdtv_list_lock, flags);
+	list_for_each_entry(fdtv_iterator, &fdtv_list, list) {
+		if(fdtv_iterator->iso_handle == iso) {
+			fdtv = fdtv_iterator;
 			break;
 		}
 	}
-	spin_unlock_irqrestore(&firesat_list_lock, flags);
+	spin_unlock_irqrestore(&fdtv_list_lock, flags);
 
-	if (firesat) {
+	if (fdtv) {
 		packet = iso->first_packet;
 		num = hpsb_iso_n_ready(iso);
 		for (i = 0; i < num; i++,
@@ -91,7 +91,7 @@
 
 			while (count --) {
 				if (buf[sizeof(struct firewireheader)] == 0x47)
-					dvb_dmx_swfilter_packets(&firesat->demux,
+					dvb_dmx_swfilter_packets(&fdtv->demux,
 								 &buf[sizeof(struct firewireheader)], 1);
 				else
 					printk("%s: invalid packet, skipping\n", __func__);
diff --git a/drivers/media/dvb/firesat/firesat-rc.c b/drivers/media/dvb/firewire/firedtv-rc.c
similarity index 86%
rename from drivers/media/dvb/firesat/firesat-rc.c
rename to drivers/media/dvb/firewire/firedtv-rc.c
index 5f9de14..436c0c6 100644
--- a/drivers/media/dvb/firesat/firesat-rc.c
+++ b/drivers/media/dvb/firewire/firedtv-rc.c
@@ -15,8 +15,8 @@
 #include <linux/string.h>
 #include <linux/types.h>
 
-#include "firesat-rc.h"
-#include "firesat.h"
+#include "firedtv-rc.h"
+#include "firedtv.h"
 
 /* fixed table with older keycodes, geared towards MythTV */
 const static u16 oldtable[] = {
@@ -125,7 +125,7 @@
 	[0x34] = KEY_EXIT,
 };
 
-int firesat_register_rc(struct firesat *firesat, struct device *dev)
+int fdtv_register_rc(struct firedtv *fdtv, struct device *dev)
 {
 	struct input_dev *idev;
 	int i, err;
@@ -134,7 +134,7 @@
 	if (!idev)
 		return -ENOMEM;
 
-	firesat->remote_ctrl_dev = idev;
+	fdtv->remote_ctrl_dev = idev;
 	idev->name = "FireDTV remote control";
 	idev->dev.parent = dev;
 	idev->evbit[0] = BIT_MASK(EV_KEY);
@@ -162,15 +162,15 @@
 	return err;
 }
 
-void firesat_unregister_rc(struct firesat *firesat)
+void fdtv_unregister_rc(struct firedtv *fdtv)
 {
-	kfree(firesat->remote_ctrl_dev->keycode);
-	input_unregister_device(firesat->remote_ctrl_dev);
+	kfree(fdtv->remote_ctrl_dev->keycode);
+	input_unregister_device(fdtv->remote_ctrl_dev);
 }
 
-void firesat_handle_rc(struct firesat *firesat, unsigned int code)
+void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code)
 {
-	u16 *keycode = firesat->remote_ctrl_dev->keycode;
+	u16 *keycode = fdtv->remote_ctrl_dev->keycode;
 
 	if (code >= 0x0300 && code <= 0x031f)
 		code = keycode[code - 0x0300];
@@ -186,6 +186,6 @@
 		return;
 	}
 
-	input_report_key(firesat->remote_ctrl_dev, code, 1);
-	input_report_key(firesat->remote_ctrl_dev, code, 0);
+	input_report_key(fdtv->remote_ctrl_dev, code, 1);
+	input_report_key(fdtv->remote_ctrl_dev, code, 0);
 }
diff --git a/drivers/media/dvb/firewire/firedtv-rc.h b/drivers/media/dvb/firewire/firedtv-rc.h
new file mode 100644
index 0000000..d3e1472
--- /dev/null
+++ b/drivers/media/dvb/firewire/firedtv-rc.h
@@ -0,0 +1,11 @@
+#ifndef _FIREDTV_RC_H
+#define _FIREDTV_RC_H
+
+struct firedtv;
+struct device;
+
+int fdtv_register_rc(struct firedtv *fdtv, struct device *dev);
+void fdtv_unregister_rc(struct firedtv *fdtv);
+void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code);
+
+#endif /* _FIREDTV_RC_H */
diff --git a/drivers/media/dvb/firesat/firesat.h b/drivers/media/dvb/firewire/firedtv.h
similarity index 87%
rename from drivers/media/dvb/firesat/firesat.h
rename to drivers/media/dvb/firewire/firedtv.h
index 51f64c0..2a34028 100644
--- a/drivers/media/dvb/firesat/firesat.h
+++ b/drivers/media/dvb/firewire/firedtv.h
@@ -120,18 +120,18 @@
 
 
 enum model_type {
-	FireSAT_UNKNOWN = 0,
-	FireSAT_DVB_S   = 1,
-	FireSAT_DVB_C   = 2,
-	FireSAT_DVB_T   = 3,
-	FireSAT_DVB_S2  = 4,
+	FIREDTV_UNKNOWN = 0,
+	FIREDTV_DVB_S   = 1,
+	FIREDTV_DVB_C   = 2,
+	FIREDTV_DVB_T   = 3,
+	FIREDTV_DVB_S2  = 4,
 };
 
 struct input_dev;
 struct hpsb_iso;
 struct unit_directory;
 
-struct firesat {
+struct firedtv {
 	struct dvb_adapter	adapter;
 	struct dmxdev		dmxdev;
 	struct dvb_demux	demux;
@@ -149,7 +149,7 @@
 	struct work_struct	remote_ctrl_work;
 	struct input_dev	*remote_ctrl_dev;
 
-	struct firesat_channel {
+	struct firedtv_channel {
 		bool active;
 		int pid;
 	} channel[16];
@@ -206,22 +206,22 @@
 	};
 };
 
-extern const char *firedtv_model_names[];
-extern struct list_head firesat_list;
-extern spinlock_t firesat_list_lock;
+extern const char *fdtv_model_names[];
+extern struct list_head fdtv_list;
+extern spinlock_t fdtv_list_lock;
 
 struct device;
 
-/* firesat_dvb.c */
-int firesat_start_feed(struct dvb_demux_feed *dvbdmxfeed);
-int firesat_stop_feed(struct dvb_demux_feed *dvbdmxfeed);
-int firesat_dvbdev_init(struct firesat *firesat, struct device *dev);
+/* firedtv-dvb.c */
+int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed);
+int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed);
+int fdtv_dvbdev_init(struct firedtv *fdtv, struct device *dev);
 
-/* firesat_fe.c */
-void firesat_frontend_init(struct firesat *firesat);
+/* firedtv-fe.c */
+void fdtv_frontend_init(struct firedtv *fdtv);
 
-/* firesat_iso.c */
-int setup_iso_channel(struct firesat *firesat);
-void tear_down_iso_channel(struct firesat *firesat);
+/* firedtv-iso.c */
+int setup_iso_channel(struct firedtv *fdtv);
+void tear_down_iso_channel(struct firedtv *fdtv);
 
 #endif /* _FIREDTV_H */