提交 a70f81c1 编写于 作者: R Rambaldi 提交者: 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: NRambaldi <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: NRambaldi <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: NStefan Richter <stefanr@s5r6.in-berlin.de>
上级 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
......
......@@ -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 @@ static int __avc_write(struct firesat *firesat,
* 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 @@ int avc_recv(struct firesat *firesat, u8 *data, size_t length)
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 @@ int avc_recv(struct firesat *firesat, u8 *data, size_t length)
* 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 @@ static void avc_tuner_tuneqpsk(struct firesat *firesat,
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 @@ static void avc_tuner_dsd_dvb_t(struct dvb_frontend_parameters *params,
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 @@ int avc_tuner_dsd(struct firesat *firesat,
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 @@ int avc_tuner_dsd(struct firesat *firesat,
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 @@ int avc_tuner_set_pids(struct firesat *firesat, unsigned char pidc, u16 pid[])
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 @@ int avc_tuner_set_pids(struct firesat *firesat, unsigned char pidc, u16 pid[])
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 @@ int avc_tuner_get_ts(struct firesat *firesat)
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 @@ int avc_tuner_get_ts(struct firesat *firesat)
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 @@ int avc_identify_subunit(struct firesat *firesat)
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 @@ int avc_identify_subunit(struct firesat *firesat)
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 @@ int avc_tuner_status(struct firesat *firesat,
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 @@ int avc_tuner_status(struct firesat *firesat,
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 @@ int avc_tuner_status(struct firesat *firesat,
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 @@ int avc_lnb_control(struct firesat *firesat, char voltage, char burst,
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 @@ int avc_lnb_control(struct firesat *firesat, char voltage, char burst,
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 @@ int avc_register_remote_control(struct firesat *firesat)
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 @@ int avc_tuner_host2ca(struct firesat *firesat)
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 @@ int avc_tuner_host2ca(struct firesat *firesat)
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 @@ static int get_ca_object_length(AVCRspFrm *RspFrm)
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 @@ int avc_ca_app_info(struct firesat *firesat, char *app_info, unsigned int *len)
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 @@ int avc_ca_app_info(struct firesat *firesat, char *app_info, unsigned int *len)
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 @@ int avc_ca_app_info(struct firesat *firesat, char *app_info, unsigned int *len)
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 @@ int avc_ca_info(struct firesat *firesat, char *app_info, unsigned int *len)
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 @@ int avc_ca_info(struct firesat *firesat, char *app_info, unsigned int *len)
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 @@ int avc_ca_info(struct firesat *firesat, char *app_info, unsigned int *len)
return 0;
}
int avc_ca_reset(struct firesat *firesat)
int avc_ca_reset(struct firedtv *fdtv)
{
AVCCmdFrm CmdFrm;
AVCRspFrm RspFrm;
......@@ -804,7 +804,7 @@ int avc_ca_reset(struct firesat *firesat)
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 @@ int avc_ca_reset(struct firesat *firesat)
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 @@ int avc_ca_pmt(struct firesat *firesat, char *msg, int length)
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 @@ int avc_ca_pmt(struct firesat *firesat, char *msg, int length)
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 @@ int avc_ca_pmt(struct firesat *firesat, char *msg, int length)
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 @@ int avc_ca_pmt(struct firesat *firesat, char *msg, int length)
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 @@ int avc_ca_pmt(struct firesat *firesat, char *msg, int length)
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 @@ int avc_ca_get_time_date(struct firesat *firesat, int *interval)
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 @@ int avc_ca_get_time_date(struct firesat *firesat, int *interval)
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 @@ int avc_ca_get_time_date(struct firesat *firesat, int *interval)
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 @@ int avc_ca_enter_menu(struct firesat *firesat)
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 @@ int avc_ca_enter_menu(struct firesat *firesat)
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 @@ int avc_ca_get_mmi(struct firesat *firesat, char *mmi_object, unsigned int *len)
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 @@ int avc_ca_get_mmi(struct firesat *firesat, char *mmi_object, unsigned int *len)
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 */
......
......@@ -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;
}
static int firesat_ca_app_info(struct firesat *firesat, void *arg)
static int fdtv_ca_app_info(struct firedtv *fdtv, void *arg)
{
struct ca_msg *reply = arg;
return
avc_ca_app_info(firesat, reply->msg, &reply->length) ? -EFAULT : 0;
avc_ca_app_info(fdtv, reply->msg, &reply->length) ? -EFAULT : 0;
}
static int firesat_ca_info(struct firesat *firesat, void *arg)
static int fdtv_ca_info(struct firedtv *fdtv, void *arg)
{
struct ca_msg *reply = arg;
return avc_ca_info(firesat, reply->msg, &reply->length) ? -EFAULT : 0;
return avc_ca_info(fdtv, reply->msg, &reply->length) ? -EFAULT : 0;
}
static int firesat_ca_get_mmi(struct firesat *firesat, void *arg)
static int fdtv_ca_get_mmi(struct firedtv *fdtv, void *arg)
{
struct ca_msg *reply = arg;
return
avc_ca_get_mmi(firesat, reply->msg, &reply->length) ? -EFAULT : 0;
avc_ca_get_mmi(fdtv, reply->msg, &reply->length) ? -EFAULT : 0;
}
static int firesat_ca_get_msg(struct firesat *firesat, void *arg)
static int fdtv_ca_get_msg(struct firedtv *fdtv, void *arg)
{
ANTENNA_INPUT_INFO info;
int err;
switch (firesat->ca_last_command) {
switch (fdtv->ca_last_command) {
case TAG_APP_INFO_ENQUIRY:
err = firesat_ca_app_info(firesat, arg);
err = fdtv_ca_app_info(fdtv, arg);
break;
case TAG_CA_INFO_ENQUIRY:
err = firesat_ca_info(firesat, arg);
err = fdtv_ca_info(fdtv, arg);
break;
default:
if (avc_tuner_status(firesat, &info))
if (avc_tuner_status(fdtv, &info))
err = -EFAULT;
else if (info.CaMmi == 1)
err = firesat_ca_get_mmi(firesat, arg);
err = fdtv_ca_get_mmi(fdtv, arg);
else {
printk(KERN_INFO "%s: Unhandled message 0x%08X\n",
__func__, firesat->ca_last_command);
__func__, fdtv->ca_last_command);
err = -EFAULT;
}
}
firesat->ca_last_command = 0;
fdtv->ca_last_command = 0;
return err;
}
static int firesat_ca_pmt(struct firesat *firesat, void *arg)
static int fdtv_ca_pmt(struct firedtv *fdtv, void *arg)
{
struct ca_msg *msg = arg;
int data_pos;
......@@ -139,21 +139,21 @@ static int firesat_ca_pmt(struct firesat *firesat, void *arg)
data_length = msg->msg[3];
}
return avc_ca_pmt(firesat, &msg->msg[data_pos], data_length) ?
return avc_ca_pmt(fdtv, &msg->msg[data_pos], data_length) ?
-EFAULT : 0;
}
static int firesat_ca_send_msg(struct firesat *firesat, void *arg)
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? */
firesat->ca_last_command =
fdtv->ca_last_command =
(msg->msg[0] << 16) + (msg->msg[1] << 8) + msg->msg[2];
switch (firesat->ca_last_command) {
switch (fdtv->ca_last_command) {
case TAG_CA_PMT:
err = firesat_ca_pmt(firesat, arg);
err = fdtv_ca_pmt(fdtv, arg);
break;
case TAG_APP_INFO_ENQUIRY:
/* handled in ca_get_msg */
......@@ -164,39 +164,39 @@ static int firesat_ca_send_msg(struct firesat *firesat, void *arg)
err = 0;
break;
case TAG_ENTER_MENU:
err = avc_ca_enter_menu(firesat);
err = avc_ca_enter_menu(fdtv);
break;
default:
printk(KERN_ERR "%s: Unhandled unknown message 0x%08X\n",
__func__, firesat->ca_last_command);
__func__, fdtv->ca_last_command);
err = -EFAULT;
}
return err;
}
static int firesat_ca_ioctl(struct inode *inode, struct file *file,
static int fdtv_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;
struct firedtv *fdtv = dvbdev->priv;
ANTENNA_INPUT_INFO info;
int err;
switch(cmd) {
case CA_RESET:
err = firesat_ca_reset(firesat);
err = fdtv_ca_reset(fdtv);
break;
case CA_GET_CAP:
err = firesat_ca_get_caps(arg);
err = fdtv_ca_get_caps(arg);
break;
case CA_GET_SLOT_INFO:
err = firesat_ca_get_slot_info(firesat, arg);
err = fdtv_ca_get_slot_info(fdtv, arg);
break;
case CA_GET_MSG:
err = firesat_ca_get_msg(firesat, arg);
err = fdtv_ca_get_msg(fdtv, arg);
break;
case CA_SEND_MSG:
err = firesat_ca_send_msg(firesat, arg);
err = fdtv_ca_send_msg(fdtv, arg);
break;
default:
printk(KERN_INFO "%s: Unhandled ioctl, command: %u\n",__func__,
......@@ -205,57 +205,57 @@ static int firesat_ca_ioctl(struct inode *inode, struct file *file,
}
/* FIXME Is this necessary? */
avc_tuner_status(firesat, &info);
avc_tuner_status(fdtv, &info);
return err;
}
static unsigned int firesat_ca_io_poll(struct file *file, poll_table *wait)
static unsigned int fdtv_ca_io_poll(struct file *file, poll_table *wait)
{
return POLLIN;
}
static struct file_operations firesat_ca_fops = {
static struct file_operations fdtv_ca_fops = {
.owner = THIS_MODULE,
.ioctl = dvb_generic_ioctl,
.open = dvb_generic_open,
.release = dvb_generic_release,
.poll = firesat_ca_io_poll,
.poll = fdtv_ca_io_poll,
};
static struct dvb_device firesat_ca = {
static struct dvb_device fdtv_ca = {
.users = 1,
.readers = 1,
.writers = 1,
.fops = &firesat_ca_fops,
.kernel_ioctl = firesat_ca_ioctl,
.fops = &fdtv_ca_fops,
.kernel_ioctl = fdtv_ca_ioctl,
};
int firesat_ca_register(struct firesat *firesat)
int fdtv_ca_register(struct firedtv *fdtv)
{
ANTENNA_INPUT_INFO info;
int err;
if (avc_tuner_status(firesat, &info))
if (avc_tuner_status(fdtv, &info))
return -EINVAL;
if (!firesat_ca_ready(&info))
if (!fdtv_ca_ready(&info))
return -EFAULT;
err = dvb_register_device(&firesat->adapter, &firesat->cadev,
&firesat_ca, firesat, DVB_DEVICE_CA);
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(firesat, &firesat->ca_time_interval);
avc_ca_get_time_date(fdtv, &fdtv->ca_time_interval);
return err;
}
void firesat_ca_release(struct firesat *firesat)
void fdtv_ca_release(struct firedtv *fdtv)
{
if (firesat->cadev)
dvb_unregister_device(firesat->cadev);
if (fdtv->cadev)
dvb_unregister_device(fdtv->cadev);
}
#ifndef _FIREDTV_CI_H
#define _FIREDTV_CI_H
struct firesat;
struct firedtv;
int firesat_ca_register(struct firesat *firesat);
void firesat_ca_release(struct firesat *firesat);
int fdtv_ca_register(struct firedtv *fdtv);
void fdtv_ca_release(struct firedtv *fdtv);
#endif /* _FIREDTV_CI_H */
......@@ -19,65 +19,65 @@
#include <dvb_frontend.h>
#include <dvbdev.h>
#include "avc_api.h"
#include "firesat.h"
#include "firesat-ci.h"
#include "avc.h"
#include "firedtv.h"
#include "firedtv-ci.h"
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
static struct firesat_channel *firesat_channel_allocate(struct firesat *firesat)
static struct firedtv_channel *fdtv_channel_allocate(struct firedtv *fdtv)
{
struct firesat_channel *c = NULL;
struct firedtv_channel *c = NULL;
int k;
if (mutex_lock_interruptible(&firesat->demux_mutex))
if (mutex_lock_interruptible(&fdtv->demux_mutex))
return NULL;
for (k = 0; k < 16; k++)
if (!firesat->channel[k].active) {
firesat->channel[k].active = true;
c = &firesat->channel[k];
if (!fdtv->channel[k].active) {
fdtv->channel[k].active = true;
c = &fdtv->channel[k];
break;
}
mutex_unlock(&firesat->demux_mutex);
mutex_unlock(&fdtv->demux_mutex);
return c;
}
static int firesat_channel_collect(struct firesat *firesat, int *pidc, u16 pid[])
static int fdtv_channel_collect(struct firedtv *fdtv, int *pidc, u16 pid[])
{
int k, l = 0;
if (mutex_lock_interruptible(&firesat->demux_mutex))
if (mutex_lock_interruptible(&fdtv->demux_mutex))
return -EINTR;
for (k = 0; k < 16; k++)
if (firesat->channel[k].active)
pid[l++] = firesat->channel[k].pid;
if (fdtv->channel[k].active)
pid[l++] = fdtv->channel[k].pid;
mutex_unlock(&firesat->demux_mutex);
mutex_unlock(&fdtv->demux_mutex);
*pidc = l;
return 0;
}
static int firesat_channel_release(struct firesat *firesat,
struct firesat_channel *channel)
static int fdtv_channel_release(struct firedtv *fdtv,
struct firedtv_channel *channel)
{
if (mutex_lock_interruptible(&firesat->demux_mutex))
if (mutex_lock_interruptible(&fdtv->demux_mutex))
return -EINTR;
channel->active = false;
mutex_unlock(&firesat->demux_mutex);
mutex_unlock(&fdtv->demux_mutex);
return 0;
}
int firesat_start_feed(struct dvb_demux_feed *dvbdmxfeed)
int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed)
{
struct firesat *firesat = (struct firesat*)dvbdmxfeed->demux->priv;
struct firesat_channel *channel;
struct firedtv *fdtv = (struct firedtv*)dvbdmxfeed->demux->priv;
struct firedtv_channel *channel;
int pidc,k;
u16 pids[16];
......@@ -98,14 +98,14 @@ int firesat_start_feed(struct dvb_demux_feed *dvbdmxfeed)
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
//Dirty fix to keep fdtv->channel pid-list up to date
for(k=0;k<16;k++){
if (!firesat->channel[k].active)
firesat->channel[k].pid =
if (!fdtv->channel[k].active)
fdtv->channel[k].pid =
dvbdmxfeed->pid;
break;
}
channel = firesat_channel_allocate(firesat);
channel = fdtv_channel_allocate(fdtv);
break;
default:
printk(KERN_ERR "%s: invalid pes type %u\n",
......@@ -113,7 +113,7 @@ int firesat_start_feed(struct dvb_demux_feed *dvbdmxfeed)
return -EINVAL;
}
} else {
channel = firesat_channel_allocate(firesat);
channel = fdtv_channel_allocate(fdtv);
}
if (!channel) {
......@@ -124,24 +124,24 @@ int firesat_start_feed(struct dvb_demux_feed *dvbdmxfeed)
dvbdmxfeed->priv = channel;
channel->pid = dvbdmxfeed->pid;
if (firesat_channel_collect(firesat, &pidc, pids)) {
firesat_channel_release(firesat, channel);
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(firesat);
k = avc_tuner_get_ts(fdtv);
if (k) {
firesat_channel_release(firesat, channel);
fdtv_channel_release(fdtv, channel);
printk("%s: AVCTuner_GetTS failed with error %d\n",
__func__, k);
return k;
}
} else {
k = avc_tuner_set_pids(firesat, pidc, pids);
k = avc_tuner_set_pids(fdtv, pidc, pids);
if (k) {
firesat_channel_release(firesat, channel);
fdtv_channel_release(fdtv, channel);
printk("%s: AVCTuner_SetPIDs failed with error %d\n",
__func__, k);
return k;
......@@ -151,11 +151,11 @@ int firesat_start_feed(struct dvb_demux_feed *dvbdmxfeed)
return 0;
}
int firesat_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
int fdtv_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;
struct firedtv *fdtv = (struct firedtv*)demux->priv;
struct firedtv_channel *c = dvbdmxfeed->priv;
int k, l;
u16 pids[16];
......@@ -179,95 +179,95 @@ int firesat_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
return 0;
}
if (mutex_lock_interruptible(&firesat->demux_mutex))
if (mutex_lock_interruptible(&fdtv->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;
if (fdtv->channel[k].active) {
if (&fdtv->channel[k] != c)
pids[l++] = fdtv->channel[k].pid;
else
firesat->channel[k].active = false;
fdtv->channel[k].active = false;
}
k = avc_tuner_set_pids(firesat, l, pids);
k = avc_tuner_set_pids(fdtv, l, pids);
if (!k)
c->active = false;
mutex_unlock(&firesat->demux_mutex);
mutex_unlock(&fdtv->demux_mutex);
return k;
}
int firesat_dvbdev_init(struct firesat *firesat, struct device *dev)
int fdtv_dvbdev_init(struct firedtv *fdtv, struct device *dev)
{
int err;
err = DVB_REGISTER_ADAPTER(&firesat->adapter,
firedtv_model_names[firesat->type],
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*/
firesat->demux.dmx.capabilities = 0;
fdtv->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;
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(&firesat->demux);
err = dvb_dmx_init(&fdtv->demux);
if (err)
goto fail_unreg_adapter;
firesat->dmxdev.filternum = 16;
firesat->dmxdev.demux = &firesat->demux.dmx;
firesat->dmxdev.capabilities = 0;
fdtv->dmxdev.filternum = 16;
fdtv->dmxdev.demux = &fdtv->demux.dmx;
fdtv->dmxdev.capabilities = 0;
err = dvb_dmxdev_init(&firesat->dmxdev, &firesat->adapter);
err = dvb_dmxdev_init(&fdtv->dmxdev, &fdtv->adapter);
if (err)
goto fail_dmx_release;
firesat->frontend.source = DMX_FRONTEND_0;
fdtv->frontend.source = DMX_FRONTEND_0;
err = firesat->demux.dmx.add_frontend(&firesat->demux.dmx,
&firesat->frontend);
err = fdtv->demux.dmx.add_frontend(&fdtv->demux.dmx,
&fdtv->frontend);
if (err)
goto fail_dmxdev_release;
err = firesat->demux.dmx.connect_frontend(&firesat->demux.dmx,
&firesat->frontend);
err = fdtv->demux.dmx.connect_frontend(&fdtv->demux.dmx,
&fdtv->frontend);
if (err)
goto fail_rem_frontend;
dvb_net_init(&firesat->adapter, &firesat->dvbnet, &firesat->demux.dmx);
dvb_net_init(&fdtv->adapter, &fdtv->dvbnet, &fdtv->demux.dmx);
firesat_frontend_init(firesat);
err = dvb_register_frontend(&firesat->adapter, &firesat->fe);
fdtv_frontend_init(fdtv);
err = dvb_register_frontend(&fdtv->adapter, &fdtv->fe);
if (err)
goto fail_net_release;
err = firesat_ca_register(firesat);
err = fdtv_ca_register(fdtv);
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);
dvb_net_release(&fdtv->dvbnet);
fdtv->demux.dmx.close(&fdtv->demux.dmx);
fail_rem_frontend:
firesat->demux.dmx.remove_frontend(&firesat->demux.dmx,
&firesat->frontend);
fdtv->demux.dmx.remove_frontend(&fdtv->demux.dmx,
&fdtv->frontend);
fail_dmxdev_release:
dvb_dmxdev_release(&firesat->dmxdev);
dvb_dmxdev_release(&fdtv->dmxdev);
fail_dmx_release:
dvb_dmx_release(&firesat->demux);
dvb_dmx_release(&fdtv->demux);
fail_unreg_adapter:
dvb_unregister_adapter(&firesat->adapter);
dvb_unregister_adapter(&fdtv->adapter);
fail_log:
dev_err(dev, "DVB initialization failed\n");
return err;
......
......@@ -17,77 +17,77 @@
#include <dvb_frontend.h>
#include "avc_api.h"
#include "avc.h"
#include "cmp.h"
#include "firesat.h"
#include "firedtv.h"
static int firesat_dvb_init(struct dvb_frontend *fe)
static int fdtv_dvb_init(struct dvb_frontend *fe)
{
struct firesat *firesat = fe->sec_priv;
struct firedtv *fdtv = fe->sec_priv;
int err;
/* FIXME - allocate free channel at IRM */
firesat->isochannel = firesat->adapter.num;
fdtv->isochannel = fdtv->adapter.num;
err = cmp_establish_pp_connection(firesat, firesat->subunit,
firesat->isochannel);
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(firesat);
return setup_iso_channel(fdtv);
}
static int firesat_sleep(struct dvb_frontend *fe)
static int fdtv_sleep(struct dvb_frontend *fe)
{
struct firesat *firesat = fe->sec_priv;
struct firedtv *fdtv = fe->sec_priv;
tear_down_iso_channel(firesat);
cmp_break_pp_connection(firesat, firesat->subunit, firesat->isochannel);
firesat->isochannel = -1;
tear_down_iso_channel(fdtv);
cmp_break_pp_connection(fdtv, fdtv->subunit, fdtv->isochannel);
fdtv->isochannel = -1;
return 0;
}
static int firesat_diseqc_send_master_cmd(struct dvb_frontend *fe,
static int fdtv_diseqc_send_master_cmd(struct dvb_frontend *fe,
struct dvb_diseqc_master_cmd *cmd)
{
struct firesat *firesat = fe->sec_priv;
struct firedtv *fdtv = fe->sec_priv;
return avc_lnb_control(firesat, LNBCONTROL_DONTCARE,
return avc_lnb_control(fdtv, LNBCONTROL_DONTCARE,
LNBCONTROL_DONTCARE, LNBCONTROL_DONTCARE, 1, cmd);
}
static int firesat_diseqc_send_burst(struct dvb_frontend *fe,
static int fdtv_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)
static int fdtv_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
{
struct firesat *firesat = fe->sec_priv;
struct firedtv *fdtv = fe->sec_priv;
firesat->tone = tone;
fdtv->tone = tone;
return 0;
}
static int firesat_set_voltage(struct dvb_frontend *fe,
static int fdtv_set_voltage(struct dvb_frontend *fe,
fe_sec_voltage_t voltage)
{
struct firesat *firesat = fe->sec_priv;
struct firedtv *fdtv = fe->sec_priv;
firesat->voltage = voltage;
fdtv->voltage = voltage;
return 0;
}
static int firesat_read_status(struct dvb_frontend *fe, fe_status_t *status)
static int fdtv_read_status(struct dvb_frontend *fe, fe_status_t *status)
{
struct firesat *firesat = fe->sec_priv;
struct firedtv *fdtv = fe->sec_priv;
ANTENNA_INPUT_INFO info;
if (avc_tuner_status(firesat, &info))
if (avc_tuner_status(fdtv, &info))
return -EINVAL;
if (info.NoRF)
......@@ -98,12 +98,12 @@ static int firesat_read_status(struct dvb_frontend *fe, fe_status_t *status)
return 0;
}
static int firesat_read_ber(struct dvb_frontend *fe, u32 *ber)
static int fdtv_read_ber(struct dvb_frontend *fe, u32 *ber)
{
struct firesat *firesat = fe->sec_priv;
struct firedtv *fdtv = fe->sec_priv;
ANTENNA_INPUT_INFO info;
if (avc_tuner_status(firesat, &info))
if (avc_tuner_status(fdtv, &info))
return -EINVAL;
*ber = info.BER[0] << 24 | info.BER[1] << 16 |
......@@ -111,24 +111,24 @@ static int firesat_read_ber(struct dvb_frontend *fe, u32 *ber)
return 0;
}
static int firesat_read_signal_strength (struct dvb_frontend *fe, u16 *strength)
static int fdtv_read_signal_strength (struct dvb_frontend *fe, u16 *strength)
{
struct firesat *firesat = fe->sec_priv;
struct firedtv *fdtv = fe->sec_priv;
ANTENNA_INPUT_INFO info;
if (avc_tuner_status(firesat, &info))
if (avc_tuner_status(fdtv, &info))
return -EINVAL;
*strength = info.SignalStrength << 8;
return 0;
}
static int firesat_read_snr(struct dvb_frontend *fe, u16 *snr)
static int fdtv_read_snr(struct dvb_frontend *fe, u16 *snr)
{
struct firesat *firesat = fe->sec_priv;
struct firedtv *fdtv = fe->sec_priv;
ANTENNA_INPUT_INFO info;
if (avc_tuner_status(firesat, &info))
if (avc_tuner_status(fdtv, &info))
return -EINVAL;
/* C/N[dB] = -10 * log10(snr / 65535) */
......@@ -137,53 +137,53 @@ static int firesat_read_snr(struct dvb_frontend *fe, u16 *snr)
return 0;
}
static int firesat_read_uncorrected_blocks(struct dvb_frontend *fe, u32 *ucblocks)
static int fdtv_read_uncorrected_blocks(struct dvb_frontend *fe, u32 *ucblocks)
{
return -EOPNOTSUPP;
}
static int firesat_set_frontend(struct dvb_frontend *fe,
static int fdtv_set_frontend(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params)
{
struct firesat *firesat = fe->sec_priv;
struct firedtv *fdtv = fe->sec_priv;
/* FIXME: avc_tuner_dsd never returns ACCEPTED. Check status? */
if (avc_tuner_dsd(firesat, params) != ACCEPTED)
if (avc_tuner_dsd(fdtv, params) != ACCEPTED)
return -EINVAL;
else
return 0; /* not sure of this... */
}
static int firesat_get_frontend(struct dvb_frontend *fe,
static int fdtv_get_frontend(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params)
{
return -EOPNOTSUPP;
}
void firesat_frontend_init(struct firesat *firesat)
void fdtv_frontend_init(struct firedtv *fdtv)
{
struct dvb_frontend_ops *ops = &firesat->fe.ops;
struct dvb_frontend_ops *ops = &fdtv->fe.ops;
struct dvb_frontend_info *fi = &ops->info;
ops->init = firesat_dvb_init;
ops->sleep = firesat_sleep;
ops->init = fdtv_dvb_init;
ops->sleep = fdtv_sleep;
ops->set_frontend = firesat_set_frontend;
ops->get_frontend = firesat_get_frontend;
ops->set_frontend = fdtv_set_frontend;
ops->get_frontend = fdtv_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->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 = 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;
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 (firesat->type) {
case FireSAT_DVB_S:
switch (fdtv->type) {
case FIREDTV_DVB_S:
fi->type = FE_QPSK;
fi->frequency_min = 950000;
......@@ -202,7 +202,7 @@ void firesat_frontend_init(struct firesat *firesat)
FE_CAN_QPSK;
break;
case FireSAT_DVB_C:
case FIREDTV_DVB_C:
fi->type = FE_QAM;
fi->frequency_min = 47000000;
......@@ -220,7 +220,7 @@ void firesat_frontend_init(struct firesat *firesat)
FE_CAN_QAM_AUTO;
break;
case FireSAT_DVB_T:
case FIREDTV_DVB_T:
fi->type = FE_OFDM;
fi->frequency_min = 49000000;
......@@ -236,10 +236,10 @@ void firesat_frontend_init(struct firesat *firesat)
default:
printk(KERN_ERR "FireDTV: no frontend for model type %d\n",
firesat->type);
fdtv->type);
}
strcpy(fi->name, firedtv_model_names[firesat->type]);
strcpy(fi->name, fdtv_model_names[fdtv->type]);
firesat->fe.dvb = &firesat->adapter;
firesat->fe.sec_priv = firesat;
fdtv->fe.dvb = &fdtv->adapter;
fdtv->fe.sec_priv = fdtv;
}
......@@ -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 @@ static void rawiso_activity_cb(struct hpsb_iso *iso)
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 @@ static void rawiso_activity_cb(struct hpsb_iso *iso)
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__);
......
......@@ -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 @@ const static u16 keytable[] = {
[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 @@ int firesat_register_rc(struct firesat *firesat, struct device *dev)
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 @@ int firesat_register_rc(struct firesat *firesat, struct device *dev)
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 @@ void firesat_handle_rc(struct firesat *firesat, unsigned int code)
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);
}
#ifndef _FIREDTV_RC_H
#define _FIREDTV_RC_H
struct firesat;
struct firedtv;
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);
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 */
......@@ -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 firesat {
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 @@ struct CIPHeader {
};
};
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 */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册