Commit a70f81c1 authored by Rambaldi's avatar Rambaldi Committed by Stefan Richter

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: default avatarRambaldi <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: default avatarRambaldi <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: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 291f006e
......@@ -51,7 +51,7 @@ comment "Supported SDMC DM1105 Adapters"
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
......
......@@ -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/
#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 */
firedtv-objs := firesat_1394.o \
firesat_dvb.o \
firesat_fe.o \
firesat_iso.o \
avc_api.o \
firedtv-objs := firedtv-1394.o \
firedtv-dvb.o \
firedtv-fe.o \
firedtv-iso.o \
avc.o \
cmp.o \
firesat-rc.o \
firesat-ci.o
firedtv-rc.o \
firedtv-ci.o
obj-$(CONFIG_DVB_FIREDTV) += firedtv.o
......
......@@ -402,31 +402,31 @@ typedef struct
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 */
......@@ -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 @@ static inline void set_opcr(__be32 *opcr, u32 value, u32 mask, u32 shift)
#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 @@ int cmp_establish_pp_connection(struct firesat *firesat, int plug, int channel)
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 @@ int cmp_establish_pp_connection(struct firesat *firesat, int plug, int channel)
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 @@ int cmp_establish_pp_connection(struct firesat *firesat, int plug, int channel)
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) {
......
#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 */
......@@ -33,17 +33,17 @@
#include <ieee1394_hotplug.h>
#include <nodemgr.h>
#include "avc_api.h"
#include "avc.h"
#include "cmp.h"
#include "firesat.h"
#include "firesat-ci.h"
#include "firesat-rc.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 firesat_id_table[] = {
static struct ieee1394_device_id fdtv_id_table[] = {
{
/* FloppyDTV S/CI and FloppyDTV S2 */
......@@ -90,11 +90,11 @@ static struct ieee1394_device_id firesat_id_table[] = {
}, { }
};
MODULE_DEVICE_TABLE(ieee1394, firesat_id_table);
MODULE_DEVICE_TABLE(ieee1394, fdtv_id_table);
/* list of all firesat devices */
LIST_HEAD(firesat_list);
DEFINE_SPINLOCK(firesat_list_lock);
/* list of all firedtv devices */
LIST_HEAD(fdtv_list);
DEFINE_SPINLOCK(fdtv_list_lock);
static void fcp_request(struct hpsb_host *host,
int nodeid,
......@@ -103,186 +103,186 @@ static void fcp_request(struct hpsb_host *host,
u8 *data,
size_t length)
{
struct firesat *firesat = NULL;
struct firesat *firesat_entry;
struct firedtv *fdtv = NULL;
struct firedtv *fdtv_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 &&
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))) {
firesat=firesat_entry;
fdtv=fdtv_entry;
break;
}
}
spin_unlock_irqrestore(&firesat_list_lock, flags);
spin_unlock_irqrestore(&fdtv_list_lock, flags);
if (firesat)
avc_recv(firesat, data, length);
if (fdtv)
avc_recv(fdtv, 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 ",
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 firesat_probe(struct device *dev)
static int fdtv_probe(struct device *dev)
{
struct unit_directory *ud =
container_of(dev, struct unit_directory, device);
struct firesat *firesat;
struct firedtv *fdtv;
unsigned long flags;
int kv_len;
void *kv_str;
int i;
int err = -ENOMEM;
firesat = kzalloc(sizeof(*firesat), GFP_KERNEL);
if (!firesat)
fdtv = kzalloc(sizeof(*fdtv), GFP_KERNEL);
if (!fdtv)
return -ENOMEM;
dev->driver_data = firesat;
firesat->ud = ud;
firesat->subunit = 0;
firesat->isochannel = -1;
firesat->tone = 0xff;
firesat->voltage = 0xff;
dev->driver_data = fdtv;
fdtv->ud = ud;
fdtv->subunit = 0;
fdtv->isochannel = -1;
fdtv->tone = 0xff;
fdtv->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);
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(firedtv_model_names); --i;)
if (strlen(firedtv_model_names[i]) <= kv_len &&
strncmp(kv_str, firedtv_model_names[i], kv_len) == 0)
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;
firesat->type = i;
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 = firesat_register_rc(firesat, dev->parent->parent);
err = fdtv_register_rc(fdtv, 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);
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(firesat);
err = avc_identify_subunit(fdtv);
if (err)
goto fail;
err = firesat_dvbdev_init(firesat, dev);
err = fdtv_dvbdev_init(fdtv, dev);
if (err)
goto fail;
avc_register_remote_control(firesat);
avc_register_remote_control(fdtv);
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);
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(firesat);
kfree(fdtv);
return err;
}
static int firesat_remove(struct device *dev)
static int fdtv_remove(struct device *dev)
{
struct firesat *firesat = dev->driver_data;
struct firedtv *fdtv = 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);
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(&firesat_list_lock, flags);
list_del(&firesat->list);
spin_unlock_irqrestore(&firesat_list_lock, flags);
spin_lock_irqsave(&fdtv_list_lock, flags);
list_del(&fdtv->list);
spin_unlock_irqrestore(&fdtv_list_lock, flags);
cancel_work_sync(&firesat->remote_ctrl_work);
firesat_unregister_rc(firesat);
cancel_work_sync(&fdtv->remote_ctrl_work);
fdtv_unregister_rc(fdtv);
kfree(firesat);
kfree(fdtv);
return 0;
}
static int firesat_update(struct unit_directory *ud)
static int fdtv_update(struct unit_directory *ud)
{
struct firesat *firesat = ud->device.driver_data;
struct firedtv *fdtv = ud->device.driver_data;
if (firesat->isochannel >= 0)
cmp_establish_pp_connection(firesat, firesat->subunit,
firesat->isochannel);
if (fdtv->isochannel >= 0)
cmp_establish_pp_connection(fdtv, fdtv->subunit,
fdtv->isochannel);
return 0;
}
static struct hpsb_protocol_driver firesat_driver = {
static struct hpsb_protocol_driver fdtv_driver = {
.name = "firedtv",
.id_table = firesat_id_table,
.update = firesat_update,
.id_table = fdtv_id_table,
.update = fdtv_update,
.driver = {
//.name and .bus are filled in for us in more recent linux versions
//.name = "FireSAT",
//.name = "FireDTV",
//.bus = &ieee1394_bus_type,
.probe = firesat_probe,
.remove = firesat_remove,
.probe = fdtv_probe,
.remove = fdtv_remove,
},
};
static struct hpsb_highlevel firesat_highlevel = {
static struct hpsb_highlevel fdtv_highlevel = {
.name = "firedtv",
.fcp_request = fcp_request,
};
static int __init firesat_init(void)
static int __init fdtv_init(void)
{
int ret;
hpsb_register_highlevel(&firesat_highlevel);
ret = hpsb_register_protocol(&firesat_driver);
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(&firesat_highlevel);
hpsb_unregister_highlevel(&fdtv_highlevel);
}
return ret;
}
static void __exit firesat_exit(void)
static void __exit fdtv_exit(void)
{
hpsb_unregister_protocol(&firesat_driver);
hpsb_unregister_highlevel(&firesat_highlevel);
hpsb_unregister_protocol(&fdtv_driver);
hpsb_unregister_highlevel(&fdtv_highlevel);
}
module_init(firesat_init);
module_exit(firesat_exit);
module_init(fdtv_init);
module_exit(fdtv_exit);
MODULE_AUTHOR("Andreas Monitzer <andy@monitzer.com>");
MODULE_AUTHOR("Ben Backx <ben@bbackx.com>");
......
......@@ -16,11 +16,11 @@
#include <dvbdev.h>
#include "avc_api.h"
#include "firesat.h"
#include "firesat-ci.h"
#include "avc.h"
#include "firedtv.h"
#include "firedtv-ci.h"
static int firesat_ca_ready(ANTENNA_INPUT_INFO *info)
static int fdtv_ca_ready(ANTENNA_INPUT_INFO *info)
{
return info->CaInitializationStatus == 1 &&
info->CaErrorFlag == 0 &&
......@@ -28,7 +28,7 @@ static int firesat_ca_ready(ANTENNA_INPUT_INFO *info)
info->CaModulePresentStatus == 1;
}
static int firesat_get_ca_flags(ANTENNA_INPUT_INFO *info)
static int fdtv_get_ca_flags(ANTENNA_INPUT_INFO *info)
{
int flags = 0;
......@@ -41,12 +41,12 @@ static int firesat_get_ca_flags(ANTENNA_INPUT_INFO *info)
return flags;
}
static int firesat_ca_reset(struct firesat *firesat)
static int fdtv_ca_reset(struct firedtv *fdtv)
{
return avc_ca_reset(firesat) ? -EFAULT : 0;
return avc_ca_reset(fdtv) ? -EFAULT : 0;
}
static int firesat_ca_get_caps(void *arg)
static int fdtv_ca_get_caps(void *arg)
{
struct ca_caps *cap = arg;
......@@ -57,73 +57,73 @@ static int firesat_ca_get_caps(void *arg)
return 0;
}
static int firesat_ca_get_slot_info(struct firesat *firesat, void *arg)
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(firesat, &info))
if (avc_tuner_status(fdtv, &info))
return -EFAULT;
if (slot->num != 0)
return -EFAULT;
slot->type = CA_CI;
slot->flags = firesat_get_ca_flags(&info);
slot->flags = fdtv_get_ca_flags(&info);
return 0;
}