mirror of
https://github.com/DigitalDevices/dddvb.git
synced 2023-10-10 13:37:43 +02:00
coding style fixes
This commit is contained in:
parent
b3b7a0ef2e
commit
f44a9dfcbd
@ -419,7 +419,7 @@ static void ddb_set_dma_table(struct ddb_io *io)
|
|||||||
static void ddb_set_dma_tables(struct ddb *dev)
|
static void ddb_set_dma_tables(struct ddb *dev)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
for (i = 0; i < DDB_MAX_PORT; i++) {
|
for (i = 0; i < DDB_MAX_PORT; i++) {
|
||||||
if (dev->port[i].input[0])
|
if (dev->port[i].input[0])
|
||||||
ddb_set_dma_table(dev->port[i].input[0]);
|
ddb_set_dma_table(dev->port[i].input[0]);
|
||||||
@ -427,7 +427,7 @@ static void ddb_set_dma_tables(struct ddb *dev)
|
|||||||
ddb_set_dma_table(dev->port[i].input[1]);
|
ddb_set_dma_table(dev->port[i].input[1]);
|
||||||
if (dev->port[i].output)
|
if (dev->port[i].output)
|
||||||
ddb_set_dma_table(dev->port[i].output);
|
ddb_set_dma_table(dev->port[i].output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -653,35 +653,35 @@ static void ddb_buffers_free(struct ddb *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Control:
|
* Control:
|
||||||
*
|
*
|
||||||
* Bit 0 - Enable TS
|
* Bit 0 - Enable TS
|
||||||
* 1 - Reset
|
* 1 - Reset
|
||||||
* 2 - clock enable
|
* 2 - clock enable
|
||||||
* 3 - clock phase
|
* 3 - clock phase
|
||||||
* 4 - gap enable
|
* 4 - gap enable
|
||||||
* 5 - send null packets on underrun
|
* 5 - send null packets on underrun
|
||||||
* 6 - enable clock gating
|
* 6 - enable clock gating
|
||||||
* 7 - set error bit on inserted null packets
|
* 7 - set error bit on inserted null packets
|
||||||
* 8-10 - fine adjust clock delay
|
* 8-10 - fine adjust clock delay
|
||||||
* 11- HS (high speed), if NCO mode=0: 0=72MHz 1=96Mhz
|
* 11- HS (high speed), if NCO mode=0: 0=72MHz 1=96Mhz
|
||||||
* 12- enable NCO mode
|
* 12- enable NCO mode
|
||||||
*
|
*
|
||||||
* Control 2:
|
* Control 2:
|
||||||
*
|
*
|
||||||
* Bit 0-6 : gap_size, Gap = (gap_size * 2) + 4
|
* Bit 0-6 : gap_size, Gap = (gap_size * 2) + 4
|
||||||
* 16-31: HS = 0: Speed = 72 * Value / 8192 MBit/s
|
* 16-31: HS = 0: Speed = 72 * Value / 8192 MBit/s
|
||||||
* HS = 1: Speed = 72 * 8 / (Value + 1) MBit/s (only bit 19-16 used)
|
* HS = 1: Speed = 72 * 8 / (Value + 1) MBit/s (only bit 19-16 used)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void calc_con(struct ddb_output *output, u32 *con, u32 *con2, u32 flags)
|
static void calc_con(struct ddb_output *output, u32 *con, u32 *con2, u32 flags)
|
||||||
{
|
{
|
||||||
struct ddb *dev = output->port->dev;
|
struct ddb *dev = output->port->dev;
|
||||||
u32 bitrate = output->port->obr, max_bitrate = 72000;
|
u32 bitrate = output->port->obr, max_bitrate = 72000;
|
||||||
u32 gap = 4, nco = 0;
|
u32 gap = 4, nco = 0;
|
||||||
|
|
||||||
*con = 0x1C;
|
*con = 0x1C;
|
||||||
if (output->port->gap != 0xffffffff) {
|
if (output->port->gap != 0xffffffff) {
|
||||||
flags |= 1;
|
flags |= 1;
|
||||||
gap = output->port->gap;
|
gap = output->port->gap;
|
||||||
@ -698,7 +698,8 @@ static void calc_con(struct ddb_output *output, u32 *con, u32 *con2, u32 flags)
|
|||||||
*con |= 0x800;
|
*con |= 0x800;
|
||||||
else {
|
else {
|
||||||
*con |= 0x1000;
|
*con |= 0x1000;
|
||||||
nco = (bitrate * 8192 + 71999) / 72000;
|
nco = (bitrate *
|
||||||
|
8192 + 71999) / 72000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -707,7 +708,7 @@ static void calc_con(struct ddb_output *output, u32 *con, u32 *con2, u32 flags)
|
|||||||
if (bitrate <= 64000) {
|
if (bitrate <= 64000) {
|
||||||
max_bitrate = 64000;
|
max_bitrate = 64000;
|
||||||
nco = 8;
|
nco = 8;
|
||||||
} else if( bitrate <= 72000) {
|
} else if (bitrate <= 72000) {
|
||||||
max_bitrate = 72000;
|
max_bitrate = 72000;
|
||||||
nco = 7;
|
nco = 7;
|
||||||
} else {
|
} else {
|
||||||
@ -736,7 +737,6 @@ static void calc_con(struct ddb_output *output, u32 *con, u32 *con2, u32 flags)
|
|||||||
gap = 127;
|
gap = 127;
|
||||||
}
|
}
|
||||||
*con2 = (nco << 16) | gap;
|
*con2 = (nco << 16) | gap;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ddb_output_start(struct ddb_output *output)
|
static void ddb_output_start(struct ddb_output *output)
|
||||||
@ -744,7 +744,7 @@ static void ddb_output_start(struct ddb_output *output)
|
|||||||
struct ddb *dev = output->port->dev;
|
struct ddb *dev = output->port->dev;
|
||||||
u32 con = 0x11c, con2 = 0;
|
u32 con = 0x11c, con2 = 0;
|
||||||
|
|
||||||
printk("Channel Base = %08x\n", output->regs);
|
pr_info("Channel Base = %08x\n", output->regs);
|
||||||
if (output->dma) {
|
if (output->dma) {
|
||||||
spin_lock_irq(&output->dma->lock);
|
spin_lock_irq(&output->dma->lock);
|
||||||
output->dma->cbuf = 0;
|
output->dma->cbuf = 0;
|
||||||
@ -811,7 +811,8 @@ static void ddb_input_stop(struct ddb_input *input)
|
|||||||
spin_unlock_irq(&input->dma->lock);
|
spin_unlock_irq(&input->dma->lock);
|
||||||
}
|
}
|
||||||
/*printk("input_stop %u.%u.%u\n",
|
/*printk("input_stop %u.%u.%u\n",
|
||||||
dev->nr, input->port->lnr, input->nr);*/
|
* dev->nr, input->port->lnr, input->nr);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ddb_input_start(struct ddb_input *input)
|
static void ddb_input_start(struct ddb_input *input)
|
||||||
@ -976,7 +977,8 @@ static ssize_t ddb_output_write(struct ddb_output *output,
|
|||||||
dma_sync_single_for_device(dev->dev,
|
dma_sync_single_for_device(dev->dev,
|
||||||
output->dma->pbuf[
|
output->dma->pbuf[
|
||||||
output->dma->cbuf],
|
output->dma->cbuf],
|
||||||
output->dma->size, DMA_TO_DEVICE);
|
output->dma->size,
|
||||||
|
DMA_TO_DEVICE);
|
||||||
left -= len;
|
left -= len;
|
||||||
buf += len;
|
buf += len;
|
||||||
output->dma->coff += len;
|
output->dma->coff += len;
|
||||||
@ -1106,8 +1108,10 @@ static size_t ddb_input_read(struct ddb_input *input,
|
|||||||
free = left;
|
free = left;
|
||||||
if (alt_dma)
|
if (alt_dma)
|
||||||
dma_sync_single_for_cpu(dev->dev,
|
dma_sync_single_for_cpu(dev->dev,
|
||||||
input->dma->pbuf[input->dma->cbuf],
|
input->dma->pbuf[
|
||||||
input->dma->size, DMA_FROM_DEVICE);
|
input->dma->cbuf],
|
||||||
|
input->dma->size,
|
||||||
|
DMA_FROM_DEVICE);
|
||||||
ret = copy_to_user(buf, input->dma->vbuf[input->dma->cbuf] +
|
ret = copy_to_user(buf, input->dma->vbuf[input->dma->cbuf] +
|
||||||
input->dma->coff, free);
|
input->dma->coff, free);
|
||||||
if (ret)
|
if (ret)
|
||||||
@ -1656,7 +1660,8 @@ static int lnb_command(struct ddb *dev, u32 link, u32 lnb, u32 cmd)
|
|||||||
msleep(20);
|
msleep(20);
|
||||||
}
|
}
|
||||||
if (c == 10)
|
if (c == 10)
|
||||||
pr_info("DDBridge: lnb_command lnb = %08x cmd = %08x\n", lnb, cmd);
|
pr_info("DDBridge: lnb_command lnb = %08x cmd = %08x\n",
|
||||||
|
lnb, cmd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1698,13 +1703,15 @@ static int lnb_send_diseqc(struct ddb *dev, u32 link, u32 input,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lnb_set_sat(struct ddb *dev, u32 link, u32 input, u32 sat, u32 band, u32 hor)
|
static int lnb_set_sat(struct ddb *dev, u32 link,
|
||||||
|
u32 input, u32 sat, u32 band, u32 hor)
|
||||||
{
|
{
|
||||||
struct dvb_diseqc_master_cmd cmd = {
|
struct dvb_diseqc_master_cmd cmd = {
|
||||||
.msg = {0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00},
|
.msg = {0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00},
|
||||||
.msg_len = 4
|
.msg_len = 4
|
||||||
};
|
};
|
||||||
cmd.msg[3] = 0xf0 | ( ((sat << 2) & 0x0c) | (band ? 1 : 0) | (hor ? 2 : 0));
|
cmd.msg[3] = 0xf0 | (((sat << 2) & 0x0c) |
|
||||||
|
(band ? 1 : 0) | (hor ? 2 : 0));
|
||||||
return lnb_send_diseqc(dev, link, input, &cmd);
|
return lnb_send_diseqc(dev, link, input, &cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2529,7 +2536,8 @@ static int init_xo2_ci(struct ddb_port *port)
|
|||||||
port->nr, data[0]);
|
port->nr, data[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
pr_info("DDBridge: Port %d: DuoFlex CI %u.%u\n", port->nr, data[0], data[1]);
|
pr_info("DDBridge: Port %d: DuoFlex CI %u.%u\n",
|
||||||
|
port->nr, data[0], data[1]);
|
||||||
|
|
||||||
i2c_read_reg(i2c, 0x10, 0x08, &val);
|
i2c_read_reg(i2c, 0x10, 0x08, &val);
|
||||||
if (val != 0) {
|
if (val != 0) {
|
||||||
@ -2615,15 +2623,15 @@ static void ddb_port_probe(struct ddb_port *port)
|
|||||||
port->class = DDB_PORT_MOD;
|
port->class = DDB_PORT_MOD;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->link[l].info->type == DDB_OCTOPRO_HDIN) {
|
if (dev->link[l].info->type == DDB_OCTOPRO_HDIN) {
|
||||||
if( port->nr == 0 ) {
|
if (port->nr == 0) {
|
||||||
dev->link[l].info->type = DDB_OCTOPUS;
|
dev->link[l].info->type = DDB_OCTOPUS;
|
||||||
port->name = "HDIN";
|
port->name = "HDIN";
|
||||||
port->class = DDB_PORT_LOOP;
|
port->class = DDB_PORT_LOOP;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->link[l].info->type == DDB_OCTOPUS_MAX) {
|
if (dev->link[l].info->type == DDB_OCTOPUS_MAX) {
|
||||||
port->name = "DUAL DVB-S2 MAX";
|
port->name = "DUAL DVB-S2 MAX";
|
||||||
@ -2657,7 +2665,7 @@ static void ddb_port_probe(struct ddb_port *port)
|
|||||||
ddbwritel(dev, I2C_SPEED_400,
|
ddbwritel(dev, I2C_SPEED_400,
|
||||||
port->i2c->regs + I2C_TIMING);
|
port->i2c->regs + I2C_TIMING);
|
||||||
} else {
|
} else {
|
||||||
pr_info(KERN_INFO "DDBridge: Port %d: Uninitialized DuoFlex\n",
|
pr_info("DDBridge: Port %d: Uninitialized DuoFlex\n",
|
||||||
port->nr);
|
port->nr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3214,7 +3222,8 @@ static void input_write_dvb(struct ddb_input *input,
|
|||||||
|
|
||||||
dma = dma2 = input->dma;
|
dma = dma2 = input->dma;
|
||||||
/* if there also is an output connected, do not ACK.
|
/* if there also is an output connected, do not ACK.
|
||||||
input_write_output will ACK. */
|
* input_write_output will ACK.
|
||||||
|
*/
|
||||||
if (input->redo) {
|
if (input->redo) {
|
||||||
dma2 = input->redo->dma;
|
dma2 = input->redo->dma;
|
||||||
ack = 0;
|
ack = 0;
|
||||||
@ -3229,7 +3238,7 @@ static void input_write_dvb(struct ddb_input *input,
|
|||||||
dma_sync_single_for_cpu(dev->dev, dma2->pbuf[dma->cbuf],
|
dma_sync_single_for_cpu(dev->dev, dma2->pbuf[dma->cbuf],
|
||||||
dma2->size, DMA_FROM_DEVICE);
|
dma2->size, DMA_FROM_DEVICE);
|
||||||
#if 0
|
#if 0
|
||||||
pr_info("DDBridge: %02x %02x %02x %02x \n",
|
pr_info("DDBridge: %02x %02x %02x %02x\n",
|
||||||
dma2->vbuf[dma->cbuf][0], dma2->vbuf[dma->cbuf][1],
|
dma2->vbuf[dma->cbuf][0], dma2->vbuf[dma->cbuf][1],
|
||||||
dma2->vbuf[dma->cbuf][2], dma2->vbuf[dma->cbuf][3]);
|
dma2->vbuf[dma->cbuf][2], dma2->vbuf[dma->cbuf][3]);
|
||||||
#endif
|
#endif
|
||||||
@ -3286,8 +3295,9 @@ static void input_handler(unsigned long data)
|
|||||||
|
|
||||||
|
|
||||||
/* If there is no input connected, input_tasklet() will
|
/* If there is no input connected, input_tasklet() will
|
||||||
just copy pointers and ACK. So, there is no need to go
|
* just copy pointers and ACK. So, there is no need to go
|
||||||
through the tasklet scheduler. */
|
* through the tasklet scheduler.
|
||||||
|
*/
|
||||||
#ifdef DDB_USE_WORK
|
#ifdef DDB_USE_WORK
|
||||||
if (input->redi)
|
if (input->redi)
|
||||||
queue_work(ddb_wq, &dma->work);
|
queue_work(ddb_wq, &dma->work);
|
||||||
@ -3342,7 +3352,7 @@ static void ddb_dma_init(struct ddb_io *io, int nr, int out)
|
|||||||
{
|
{
|
||||||
struct ddb_dma *dma;
|
struct ddb_dma *dma;
|
||||||
struct ddb_regmap *rm = io_regmap(io, 0);
|
struct ddb_regmap *rm = io_regmap(io, 0);
|
||||||
|
|
||||||
dma = out ? &io->port->dev->odma[nr] : &io->port->dev->idma[nr];
|
dma = out ? &io->port->dev->odma[nr] : &io->port->dev->idma[nr];
|
||||||
io->dma = dma;
|
io->dma = dma;
|
||||||
dma->io = io;
|
dma->io = io;
|
||||||
@ -3390,7 +3400,8 @@ static void ddb_input_init(struct ddb_port *port, int nr, int pnr, int anr)
|
|||||||
rm = io_regmap(input, 1);
|
rm = io_regmap(input, 1);
|
||||||
input->regs = DDB_LINK_TAG(port->lnr) |
|
input->regs = DDB_LINK_TAG(port->lnr) |
|
||||||
(rm->input->base + rm->input->size * nr);
|
(rm->input->base + rm->input->size * nr);
|
||||||
pr_debug("DDBridge: init link %u, input %u, regs %08x\n", port->lnr, nr, input->regs);
|
pr_debug("DDBridge: init link %u, input %u, regs %08x\n",
|
||||||
|
port->lnr, nr, input->regs);
|
||||||
if (dev->has_dma) {
|
if (dev->has_dma) {
|
||||||
struct ddb_regmap *rm0 = io_regmap(input, 0);
|
struct ddb_regmap *rm0 = io_regmap(input, 0);
|
||||||
u32 base = rm0->irq_base_idma;
|
u32 base = rm0->irq_base_idma;
|
||||||
@ -3398,9 +3409,9 @@ static void ddb_input_init(struct ddb_port *port, int nr, int pnr, int anr)
|
|||||||
|
|
||||||
if (port->lnr)
|
if (port->lnr)
|
||||||
dma_nr += 32 + (port->lnr - 1) * 8;
|
dma_nr += 32 + (port->lnr - 1) * 8;
|
||||||
|
|
||||||
pr_debug("DDBridge: init link %u, input %u, handler %u\n",
|
pr_debug("DDBridge: init link %u, input %u, handler %u\n",
|
||||||
port->lnr, nr, dma_nr + base);
|
port->lnr, nr, dma_nr + base);
|
||||||
dev->handler[0][dma_nr + base] = input_handler;
|
dev->handler[0][dma_nr + base] = input_handler;
|
||||||
dev->handler_data[0][dma_nr + base] = (unsigned long) input;
|
dev->handler_data[0][dma_nr + base] = (unsigned long) input;
|
||||||
ddb_dma_init(input, dma_nr, 0);
|
ddb_dma_init(input, dma_nr, 0);
|
||||||
@ -3420,7 +3431,7 @@ static void ddb_output_init(struct ddb_port *port, int nr)
|
|||||||
output->regs = DDB_LINK_TAG(port->lnr) |
|
output->regs = DDB_LINK_TAG(port->lnr) |
|
||||||
(rm->output->base + rm->output->size * nr);
|
(rm->output->base + rm->output->size * nr);
|
||||||
pr_debug("DDBridge: init link %u, output %u, regs %08x\n",
|
pr_debug("DDBridge: init link %u, output %u, regs %08x\n",
|
||||||
port->lnr, nr, output->regs);
|
port->lnr, nr, output->regs);
|
||||||
if (dev->has_dma) {
|
if (dev->has_dma) {
|
||||||
struct ddb_regmap *rm0 = io_regmap(output, 0);
|
struct ddb_regmap *rm0 = io_regmap(output, 0);
|
||||||
u32 base = rm0->irq_base_odma;
|
u32 base = rm0->irq_base_odma;
|
||||||
@ -3587,18 +3598,18 @@ static void ddb_ports_release(struct ddb *dev)
|
|||||||
dev->handler[0][_nr](dev->handler_data[0][_nr]); } \
|
dev->handler[0][_nr](dev->handler_data[0][_nr]); } \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
#define IRQ_HANDLE_BYTE(_n) \
|
#define IRQ_HANDLE_BYTE(_n) { \
|
||||||
if (s & (0x000000ff << ((_n) & 0x1f))) { \
|
if (s & (0x000000ff << ((_n) & 0x1f))) { \
|
||||||
IRQ_HANDLE(0 + _n); \
|
IRQ_HANDLE(0 + (_n)); \
|
||||||
IRQ_HANDLE(1 + _n); \
|
IRQ_HANDLE(1 + (_n)); \
|
||||||
IRQ_HANDLE(2 + _n); \
|
IRQ_HANDLE(2 + (_n)); \
|
||||||
IRQ_HANDLE(3 + _n); \
|
IRQ_HANDLE(3 + (_n)); \
|
||||||
IRQ_HANDLE(4 + _n); \
|
IRQ_HANDLE(4 + (_n)); \
|
||||||
IRQ_HANDLE(5 + _n); \
|
IRQ_HANDLE(5 + (_n)); \
|
||||||
IRQ_HANDLE(6 + _n); \
|
IRQ_HANDLE(6 + (_n)); \
|
||||||
IRQ_HANDLE(7 + _n); \
|
IRQ_HANDLE(7 + (_n)); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void irq_handle_msg(struct ddb *dev, u32 s)
|
static void irq_handle_msg(struct ddb *dev, u32 s)
|
||||||
{
|
{
|
||||||
@ -3719,20 +3730,20 @@ static irqreturn_t irq_handle_v2_n(struct ddb *dev, u32 n)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return IRQ_NONE;
|
return IRQ_NONE;
|
||||||
ddbwritel(dev, s, reg);
|
ddbwritel(dev, s, reg);
|
||||||
|
|
||||||
if ((s & 0x000000ff)) {
|
if ((s & 0x000000ff)) {
|
||||||
IRQ_HANDLE( 0 + off);
|
IRQ_HANDLE(0 + off);
|
||||||
IRQ_HANDLE( 1 + off);
|
IRQ_HANDLE(1 + off);
|
||||||
IRQ_HANDLE( 2 + off);
|
IRQ_HANDLE(2 + off);
|
||||||
IRQ_HANDLE( 3 + off);
|
IRQ_HANDLE(3 + off);
|
||||||
IRQ_HANDLE( 4 + off);
|
IRQ_HANDLE(4 + off);
|
||||||
IRQ_HANDLE( 5 + off);
|
IRQ_HANDLE(5 + off);
|
||||||
IRQ_HANDLE( 6 + off);
|
IRQ_HANDLE(6 + off);
|
||||||
IRQ_HANDLE( 7 + off);
|
IRQ_HANDLE(7 + off);
|
||||||
}
|
}
|
||||||
if ((s & 0x0000ff00)) {
|
if ((s & 0x0000ff00)) {
|
||||||
IRQ_HANDLE( 8 + off);
|
IRQ_HANDLE(8 + off);
|
||||||
IRQ_HANDLE( 9 + off);
|
IRQ_HANDLE(9 + off);
|
||||||
IRQ_HANDLE(10 + off);
|
IRQ_HANDLE(10 + off);
|
||||||
IRQ_HANDLE(11 + off);
|
IRQ_HANDLE(11 + off);
|
||||||
IRQ_HANDLE(12 + off);
|
IRQ_HANDLE(12 + off);
|
||||||
@ -3862,7 +3873,7 @@ static int nsd_do_ioctl(struct file *file, unsigned int cmd, void *parg)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
ctrl = (input->port->lnr << 16) | ((input->nr & 7) << 8) |
|
ctrl = (input->port->lnr << 16) | ((input->nr & 7) << 8) |
|
||||||
((ts->filter_mask & 3) << 2);
|
((ts->filter_mask & 3) << 2);
|
||||||
/*pr_info("DDBridge: GET_TS %u.%u\n", input->port->lnr, input->nr);*/
|
|
||||||
if (ddbreadl(dev, TS_CAPTURE_CONTROL) & 1) {
|
if (ddbreadl(dev, TS_CAPTURE_CONTROL) & 1) {
|
||||||
pr_info("DDBridge: ts capture busy\n");
|
pr_info("DDBridge: ts capture busy\n");
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
@ -4463,7 +4474,7 @@ static ssize_t fan_store(struct device *device, struct device_attribute *d,
|
|||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
struct ddb *dev = dev_get_drvdata(device);
|
struct ddb *dev = dev_get_drvdata(device);
|
||||||
unsigned val;
|
u32 val;
|
||||||
|
|
||||||
if (sscanf(buf, "%u\n", &val) != 1)
|
if (sscanf(buf, "%u\n", &val) != 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -4493,7 +4504,7 @@ static ssize_t temp_show(struct device *device,
|
|||||||
s32 temp, temp2, temp3;
|
s32 temp, temp2, temp3;
|
||||||
int i;
|
int i;
|
||||||
u8 tmp[2];
|
u8 tmp[2];
|
||||||
|
|
||||||
if (link->info->type == DDB_MOD) {
|
if (link->info->type == DDB_MOD) {
|
||||||
if (link->info->version >= 2) {
|
if (link->info->version >= 2) {
|
||||||
temp = 0xffff & ddbreadl(dev, TEMPMON2_BOARD);
|
temp = 0xffff & ddbreadl(dev, TEMPMON2_BOARD);
|
||||||
@ -4504,7 +4515,7 @@ static ssize_t temp_show(struct device *device,
|
|||||||
|
|
||||||
temp3 = 0xffff & ddbreadl(dev, TEMPMON2_QAMCORE);
|
temp3 = 0xffff & ddbreadl(dev, TEMPMON2_QAMCORE);
|
||||||
temp3 = (temp3 * 1000) >> 8;
|
temp3 = (temp3 * 1000) >> 8;
|
||||||
|
|
||||||
return sprintf(buf, "%d %d %d\n", temp, temp2, temp3);
|
return sprintf(buf, "%d %d %d\n", temp, temp2, temp3);
|
||||||
}
|
}
|
||||||
ddbwritel(dev, 1, TEMPMON_CONTROL);
|
ddbwritel(dev, 1, TEMPMON_CONTROL);
|
||||||
@ -4639,7 +4650,7 @@ static ssize_t led_store(struct device *device,
|
|||||||
{
|
{
|
||||||
struct ddb *dev = dev_get_drvdata(device);
|
struct ddb *dev = dev_get_drvdata(device);
|
||||||
int num = attr->attr.name[3] - 0x30;
|
int num = attr->attr.name[3] - 0x30;
|
||||||
unsigned val;
|
u32 val;
|
||||||
|
|
||||||
if (sscanf(buf, "%u\n", &val) != 1)
|
if (sscanf(buf, "%u\n", &val) != 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -4799,7 +4810,7 @@ static ssize_t obr_show(struct device *device,
|
|||||||
{
|
{
|
||||||
struct ddb *dev = dev_get_drvdata(device);
|
struct ddb *dev = dev_get_drvdata(device);
|
||||||
int num = attr->attr.name[3] - 0x30;
|
int num = attr->attr.name[3] - 0x30;
|
||||||
|
|
||||||
return sprintf(buf, "%d\n", dev->port[num].obr);
|
return sprintf(buf, "%d\n", dev->port[num].obr);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -4810,7 +4821,7 @@ static ssize_t obr_store(struct device *device, struct device_attribute *attr,
|
|||||||
struct ddb *dev = dev_get_drvdata(device);
|
struct ddb *dev = dev_get_drvdata(device);
|
||||||
int num = attr->attr.name[3] - 0x30;
|
int num = attr->attr.name[3] - 0x30;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
if (sscanf(buf, "%u\n", &val) != 1)
|
if (sscanf(buf, "%u\n", &val) != 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (val > 96000)
|
if (val > 96000)
|
||||||
@ -5016,7 +5027,8 @@ static void ddb_device_attrs_del(struct ddb *dev)
|
|||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
if (dev->link[i].info &&
|
if (dev->link[i].info &&
|
||||||
dev->link[i].info->tempmon_irq)
|
dev->link[i].info->tempmon_irq)
|
||||||
device_remove_file(dev->ddb_dev, &ddb_attrs_fanspeed[i]);
|
device_remove_file(dev->ddb_dev,
|
||||||
|
&ddb_attrs_fanspeed[i]);
|
||||||
for (i = 0; i < dev->link[0].info->temp_num; i++)
|
for (i = 0; i < dev->link[0].info->temp_num; i++)
|
||||||
device_remove_file(dev->ddb_dev, &ddb_attrs_temp[i]);
|
device_remove_file(dev->ddb_dev, &ddb_attrs_temp[i]);
|
||||||
for (i = 0; i < dev->link[0].info->port_num; i++)
|
for (i = 0; i < dev->link[0].info->port_num; i++)
|
||||||
@ -5128,7 +5140,7 @@ static void link_tasklet(unsigned long data)
|
|||||||
struct ddb *dev = link->dev;
|
struct ddb *dev = link->dev;
|
||||||
u32 s, tag = DDB_LINK_TAG(link->nr);
|
u32 s, tag = DDB_LINK_TAG(link->nr);
|
||||||
u32 l = link->nr;
|
u32 l = link->nr;
|
||||||
|
|
||||||
s = ddbreadl(dev, tag | INTERRUPT_STATUS);
|
s = ddbreadl(dev, tag | INTERRUPT_STATUS);
|
||||||
pr_info("DDBridge: gtl_irq %08x = %08x\n", tag | INTERRUPT_STATUS, s);
|
pr_info("DDBridge: gtl_irq %08x = %08x\n", tag | INTERRUPT_STATUS, s);
|
||||||
|
|
||||||
@ -5257,7 +5269,7 @@ static int ddb_gtl_init(struct ddb *dev)
|
|||||||
u32 l, base = dev->link[0].info->regmap->irq_base_gtl;
|
u32 l, base = dev->link[0].info->regmap->irq_base_gtl;
|
||||||
|
|
||||||
dev->handler_data[0][base] = (unsigned long) dev;
|
dev->handler_data[0][base] = (unsigned long) dev;
|
||||||
dev->handler[0][base] = gtl_link_handler;
|
dev->handler[0][base] = gtl_link_handler;
|
||||||
for (l = 1; l < dev->link[0].info->regmap->gtl->num + 1; l++)
|
for (l = 1; l < dev->link[0].info->regmap->gtl->num + 1; l++)
|
||||||
ddb_gtl_init_link(dev, l);
|
ddb_gtl_init_link(dev, l);
|
||||||
return 0;
|
return 0;
|
||||||
@ -5270,8 +5282,9 @@ static int ddb_gtl_init(struct ddb *dev)
|
|||||||
static void tempmon_setfan(struct ddb_link *link)
|
static void tempmon_setfan(struct ddb_link *link)
|
||||||
{
|
{
|
||||||
u32 temp, temp2, pwm;
|
u32 temp, temp2, pwm;
|
||||||
|
|
||||||
if ((ddblreadl(link, TEMPMON_CONTROL) & TEMPMON_CONTROL_OVERTEMP ) != 0) {
|
if ((ddblreadl(link, TEMPMON_CONTROL) &
|
||||||
|
TEMPMON_CONTROL_OVERTEMP) != 0) {
|
||||||
pr_info("DDBridge: Over temperature condition\n");
|
pr_info("DDBridge: Over temperature condition\n");
|
||||||
link->OverTemperatureError = 1;
|
link->OverTemperatureError = 1;
|
||||||
}
|
}
|
||||||
@ -5283,16 +5296,16 @@ static void tempmon_setfan(struct ddb_link *link)
|
|||||||
temp2 = 0;
|
temp2 = 0;
|
||||||
if (temp2 > temp)
|
if (temp2 > temp)
|
||||||
temp = temp2;
|
temp = temp2;
|
||||||
|
|
||||||
pwm = (ddblreadl(link, TEMPMON_FANCONTROL) >> 8) & 0x0F;
|
pwm = (ddblreadl(link, TEMPMON_FANCONTROL) >> 8) & 0x0F;
|
||||||
if (pwm > 10)
|
if (pwm > 10)
|
||||||
pwm = 10;
|
pwm = 10;
|
||||||
|
|
||||||
if (temp >= link->temp_tab[pwm]) {
|
if (temp >= link->temp_tab[pwm]) {
|
||||||
while( pwm < 10 && temp >= link->temp_tab[pwm + 1])
|
while (pwm < 10 && temp >= link->temp_tab[pwm + 1])
|
||||||
pwm += 1;
|
pwm += 1;
|
||||||
} else {
|
} else {
|
||||||
while( pwm > 1 && temp < link->temp_tab[pwm - 2])
|
while (pwm > 1 && temp < link->temp_tab[pwm - 2])
|
||||||
pwm -= 1;
|
pwm -= 1;
|
||||||
}
|
}
|
||||||
ddblwritel(link, (pwm << 8), TEMPMON_FANCONTROL);
|
ddblwritel(link, (pwm << 8), TEMPMON_FANCONTROL);
|
||||||
@ -5302,7 +5315,7 @@ static void tempmon_setfan(struct ddb_link *link)
|
|||||||
static void temp_handler(unsigned long data)
|
static void temp_handler(unsigned long data)
|
||||||
{
|
{
|
||||||
struct ddb_link *link = (struct ddb_link *) data;
|
struct ddb_link *link = (struct ddb_link *) data;
|
||||||
|
|
||||||
spin_lock(&link->temp_lock);
|
spin_lock(&link->temp_lock);
|
||||||
tempmon_setfan(link);
|
tempmon_setfan(link);
|
||||||
spin_unlock(&link->temp_lock);
|
spin_unlock(&link->temp_lock);
|
||||||
@ -5313,12 +5326,14 @@ static int tempmon_init(struct ddb_link *link, int FirstTime)
|
|||||||
struct ddb *dev = link->dev;
|
struct ddb *dev = link->dev;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
u32 l = link->nr;
|
u32 l = link->nr;
|
||||||
|
|
||||||
spin_lock_irq(&link->temp_lock);
|
spin_lock_irq(&link->temp_lock);
|
||||||
if (FirstTime) {
|
if (FirstTime) {
|
||||||
static u8 TemperatureTable[11] = {30,35,40,45,50,55,60,65,70,75,80};
|
static u8 TemperatureTable[11] = {
|
||||||
|
30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80};
|
||||||
memcpy(link->temp_tab, TemperatureTable, sizeof(TemperatureTable));
|
|
||||||
|
memcpy(link->temp_tab, TemperatureTable,
|
||||||
|
sizeof(TemperatureTable));
|
||||||
}
|
}
|
||||||
dev->handler[l][link->info->tempmon_irq] = temp_handler;
|
dev->handler[l][link->info->tempmon_irq] = temp_handler;
|
||||||
dev->handler_data[l][link->info->tempmon_irq] = (unsigned long) link;
|
dev->handler_data[l][link->info->tempmon_irq] = (unsigned long) link;
|
||||||
@ -5326,9 +5341,10 @@ static int tempmon_init(struct ddb_link *link, int FirstTime)
|
|||||||
TEMPMON_CONTROL_INTENABLE),
|
TEMPMON_CONTROL_INTENABLE),
|
||||||
TEMPMON_CONTROL);
|
TEMPMON_CONTROL);
|
||||||
ddblwritel(link, (3 << 8), TEMPMON_FANCONTROL);
|
ddblwritel(link, (3 << 8), TEMPMON_FANCONTROL);
|
||||||
|
|
||||||
link->OverTemperatureError =
|
link->OverTemperatureError =
|
||||||
((ddblreadl(link, TEMPMON_CONTROL) & TEMPMON_CONTROL_OVERTEMP ) != 0);
|
((ddblreadl(link, TEMPMON_CONTROL) &
|
||||||
|
TEMPMON_CONTROL_OVERTEMP) != 0);
|
||||||
if (link->OverTemperatureError) {
|
if (link->OverTemperatureError) {
|
||||||
pr_info("DDBridge: Over temperature condition\n");
|
pr_info("DDBridge: Over temperature condition\n");
|
||||||
status = -1;
|
status = -1;
|
||||||
@ -5341,7 +5357,7 @@ static int tempmon_init(struct ddb_link *link, int FirstTime)
|
|||||||
static int ddb_init_tempmon(struct ddb_link *link)
|
static int ddb_init_tempmon(struct ddb_link *link)
|
||||||
{
|
{
|
||||||
struct ddb_info *info = link->info;
|
struct ddb_info *info = link->info;
|
||||||
|
|
||||||
if (!info->tempmon_irq)
|
if (!info->tempmon_irq)
|
||||||
return 0;
|
return 0;
|
||||||
if (info->type == DDB_OCTOPUS_MAX ||
|
if (info->type == DDB_OCTOPUS_MAX ||
|
||||||
@ -5371,7 +5387,7 @@ static int ddb_init_boards(struct ddb *dev)
|
|||||||
l,
|
l,
|
||||||
dev->link[l].ids.vendor, dev->link[l].ids.device,
|
dev->link[l].ids.vendor, dev->link[l].ids.device,
|
||||||
dev->link[l].ids.subvendor, dev->link[l].ids.subdevice);
|
dev->link[l].ids.subvendor, dev->link[l].ids.subdevice);
|
||||||
|
|
||||||
if (info->board_control) {
|
if (info->board_control) {
|
||||||
ddbwritel(dev, 0, DDB_LINK_TAG(l) | BOARD_CONTROL);
|
ddbwritel(dev, 0, DDB_LINK_TAG(l) | BOARD_CONTROL);
|
||||||
msleep(100);
|
msleep(100);
|
||||||
@ -5393,7 +5409,7 @@ static int ddb_init(struct ddb *dev)
|
|||||||
mutex_init(&dev->link[0].flash_mutex);
|
mutex_init(&dev->link[0].flash_mutex);
|
||||||
if (no_init) {
|
if (no_init) {
|
||||||
ddb_device_create(dev);
|
ddb_device_create(dev);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (dev->link[0].info->ns_num) {
|
if (dev->link[0].info->ns_num) {
|
||||||
ddbwritel(dev, 1, ETHER_CONTROL);
|
ddbwritel(dev, 1, ETHER_CONTROL);
|
||||||
@ -5401,7 +5417,7 @@ static int ddb_init(struct ddb *dev)
|
|||||||
ddbwritel(dev, 14 + (dev->vlan ? 4 : 0), ETHER_LENGTH);
|
ddbwritel(dev, 14 + (dev->vlan ? 4 : 0), ETHER_LENGTH);
|
||||||
}
|
}
|
||||||
mutex_init(&dev->link[0].lnb.lock);
|
mutex_init(&dev->link[0].lnb.lock);
|
||||||
|
|
||||||
if (dev->link[0].info->regmap->gtl)
|
if (dev->link[0].info->regmap->gtl)
|
||||||
ddb_gtl_init(dev);
|
ddb_gtl_init(dev);
|
||||||
|
|
||||||
@ -5452,12 +5468,14 @@ static void ddb_reset_ios(struct ddb *dev)
|
|||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
struct ddb_regmap *rm = dev->link[0].info->regmap;
|
struct ddb_regmap *rm = dev->link[0].info->regmap;
|
||||||
|
|
||||||
if (rm->input)
|
if (rm->input)
|
||||||
for (i = 0; i < rm->input->num; i++)
|
for (i = 0; i < rm->input->num; i++)
|
||||||
ddb_reset_io(dev, rm->input->base + i * rm->input->size);
|
ddb_reset_io(dev,
|
||||||
|
rm->input->base + i * rm->input->size);
|
||||||
if (rm->output)
|
if (rm->output)
|
||||||
for (i = 0; i < rm->output->num; i++)
|
for (i = 0; i < rm->output->num; i++)
|
||||||
ddb_reset_io(dev, rm->output->base + i * rm->output->size);
|
ddb_reset_io(dev,
|
||||||
|
rm->output->base + i * rm->output->size);
|
||||||
usleep_range(5000, 6000);
|
usleep_range(5000, 6000);
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ static int ddb_i2c_master_xfer(struct i2c_adapter *adapter,
|
|||||||
ddbcpyfrom(dev, msg[0].buf,
|
ddbcpyfrom(dev, msg[0].buf,
|
||||||
i2c->rbuf, msg[0].len);
|
i2c->rbuf, msg[0].len);
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
ddbcpyto(dev, i2c->wbuf, msg[0].buf, msg[0].len);
|
ddbcpyto(dev, i2c->wbuf, msg[0].buf, msg[0].len);
|
||||||
ddbwritel(dev, msg[0].len, i2c->regs + I2C_TASKLENGTH);
|
ddbwritel(dev, msg[0].len, i2c->regs + I2C_TASKLENGTH);
|
||||||
if (ddb_i2c_cmd(i2c, addr, 2))
|
if (ddb_i2c_cmd(i2c, addr, 2))
|
||||||
|
@ -76,57 +76,62 @@ inline s64 RoundPCRDown(s64 a)
|
|||||||
return a & ~(HW_LSB_MASK - 1);
|
return a & ~(HW_LSB_MASK - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculating KF, LF from Symbolrate
|
/* Calculating KF, LF from Symbolrate
|
||||||
//
|
*
|
||||||
// Symbolrate is usually calculated as (M/N) * 10.24 MS/s
|
* Symbolrate is usually calculated as (M/N) * 10.24 MS/s
|
||||||
//
|
*
|
||||||
// Common Values for M,N
|
* Common Values for M,N
|
||||||
// J.83 Annex A,
|
* J.83 Annex A,
|
||||||
// Euro Docsis 6.952 MS/s : M = 869, N = 1280
|
* Euro Docsis 6.952 MS/s : M = 869, N = 1280
|
||||||
// 6.900 MS/s : M = 345, N = 512
|
* 6.900 MS/s : M = 345, N = 512
|
||||||
// 6.875 MS/s : M = 1375, N = 2048
|
* 6.875 MS/s : M = 1375, N = 2048
|
||||||
// 6.111 MS/s : M = 6111, N = 10240
|
* 6.111 MS/s : M = 6111, N = 10240
|
||||||
// J.83 Annex B **
|
* J.83 Annex B **
|
||||||
// QAM64 5.056941 : M = 401, N = 812
|
* QAM64 5.056941 : M = 401, N = 812
|
||||||
// QAM256 5.360537 : M = 78, N = 149
|
* QAM256 5.360537 : M = 78, N = 149
|
||||||
// J.83 Annex C **
|
* J.83 Annex C **
|
||||||
// 5.309734 : M = 1889, N = 3643
|
* 5.309734 : M = 1889, N = 3643
|
||||||
//
|
*
|
||||||
// For the present hardware
|
* For the present hardware
|
||||||
// KF' = 256 * M
|
* KF' = 256 * M
|
||||||
// LF' = 225 * N
|
* LF' = 225 * N
|
||||||
// or
|
* or
|
||||||
// KF' = Symbolrate in Hz
|
* KF' = Symbolrate in Hz
|
||||||
// LF' = 9000000
|
* LF' = 9000000
|
||||||
//
|
*
|
||||||
// KF = KF' / gcd(KF',LF')
|
* KF = KF' / gcd(KF',LF')
|
||||||
// LF = LF' / gcd(KF',LF')
|
* LF = LF' / gcd(KF',LF')
|
||||||
// Note: LF must not be a power of 2.
|
* Note: LF must not be a power of 2.
|
||||||
// Maximum value for KF,LF = 13421727 ( 0x7FFFFFF )
|
* Maximum value for KF,LF = 13421727 ( 0x7FFFFFF )
|
||||||
// ** using these M,N values will result in a small err (<5ppm)
|
* ** using these M,N values will result in a small err (<5ppm)
|
||||||
// calculating KF,LF directly gives the exact normative result
|
* calculating KF,LF directly gives the exact normative result
|
||||||
// but with rather large KF,LF values
|
* but with rather large KF,LF values
|
||||||
|
*/
|
||||||
|
|
||||||
static inline u32 gcd(u32 u,u32 v)
|
static inline u32 gcd(u32 u, u32 v)
|
||||||
{
|
{
|
||||||
int s = 0;
|
int s = 0;
|
||||||
while (((u|v)&1) == 0) {
|
|
||||||
s += 1;
|
while (((u | v) & 1) == 0) {
|
||||||
u >>= 1;
|
s += 1;
|
||||||
v >>= 1;
|
u >>= 1;
|
||||||
}
|
v >>= 1;
|
||||||
while ((u&1) == 0)
|
}
|
||||||
u >>= 1;
|
while ((u & 1) == 0)
|
||||||
do {
|
u >>= 1;
|
||||||
while ( (v&1) == 0 ) v >>= 1;
|
do {
|
||||||
if( u > v ) {
|
while ((v & 1) == 0)
|
||||||
u32 t = v;
|
v >>= 1;
|
||||||
v = u;
|
if (u > v) {
|
||||||
u = t;
|
u32 t = v;
|
||||||
}
|
|
||||||
v = v - u;
|
v = u;
|
||||||
} while(v != 0);
|
u = t;
|
||||||
return u << s;
|
}
|
||||||
|
v = v - u;
|
||||||
|
} while (v != 0);
|
||||||
|
|
||||||
|
return (u << s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@ -136,14 +141,14 @@ static inline u32 gcd(u32 u,u32 v)
|
|||||||
static int mod_SendChannelCommand(struct ddb *dev, u32 Channel, u32 Command)
|
static int mod_SendChannelCommand(struct ddb *dev, u32 Channel, u32 Command)
|
||||||
{
|
{
|
||||||
u32 ControlReg = ddbreadl(dev, CHANNEL_CONTROL(Channel));
|
u32 ControlReg = ddbreadl(dev, CHANNEL_CONTROL(Channel));
|
||||||
|
|
||||||
ControlReg = (ControlReg & ~CHANNEL_CONTROL_CMD_MASK)|Command;
|
ControlReg = (ControlReg & ~CHANNEL_CONTROL_CMD_MASK)|Command;
|
||||||
ddbwritel(dev, ControlReg, CHANNEL_CONTROL(Channel));
|
ddbwritel(dev, ControlReg, CHANNEL_CONTROL(Channel));
|
||||||
while(1) {
|
while (1) {
|
||||||
ControlReg = ddbreadl(dev, CHANNEL_CONTROL(Channel));
|
ControlReg = ddbreadl(dev, CHANNEL_CONTROL(Channel));
|
||||||
if (ControlReg == 0xFFFFFFFF)
|
if (ControlReg == 0xFFFFFFFF)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
if((ControlReg & CHANNEL_CONTROL_CMD_STATUS) == 0)
|
if ((ControlReg & CHANNEL_CONTROL_CMD_STATUS) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ControlReg & CHANNEL_CONTROL_ERROR_CMD)
|
if (ControlReg & CHANNEL_CONTROL_ERROR_CMD)
|
||||||
@ -173,7 +178,8 @@ void ddbridge_mod_output_stop(struct ddb_output *output)
|
|||||||
mod->State = CM_IDLE;
|
mod->State = CM_IDLE;
|
||||||
mod->Control &= 0xfffffff0;
|
mod->Control &= 0xfffffff0;
|
||||||
if (dev->link[0].info->version == 2)
|
if (dev->link[0].info->version == 2)
|
||||||
mod_SendChannelCommand(dev, output->nr, CHANNEL_CONTROL_CMD_FREE);
|
mod_SendChannelCommand(dev, output->nr,
|
||||||
|
CHANNEL_CONTROL_CMD_FREE);
|
||||||
ddbwritel(dev, mod->Control, CHANNEL_CONTROL(output->nr));
|
ddbwritel(dev, mod->Control, CHANNEL_CONTROL(output->nr));
|
||||||
#if 0
|
#if 0
|
||||||
udelay(10);
|
udelay(10);
|
||||||
@ -216,13 +222,13 @@ static void mod_set_rateinc(struct ddb *dev, u32 chan)
|
|||||||
static void mod_calc_rateinc(struct ddb_mod *mod)
|
static void mod_calc_rateinc(struct ddb_mod *mod)
|
||||||
{
|
{
|
||||||
u32 ri;
|
u32 ri;
|
||||||
|
|
||||||
pr_info("DDBridge: ibitrate %llu\n", mod->ibitrate);
|
pr_info("DDBridge: ibitrate %llu\n", mod->ibitrate);
|
||||||
pr_info("DDBridge: obitrate %llu\n", mod->obitrate);
|
pr_info("DDBridge: obitrate %llu\n", mod->obitrate);
|
||||||
|
|
||||||
if (mod->ibitrate != 0) {
|
if (mod->ibitrate != 0) {
|
||||||
u64 d = mod->obitrate - mod->ibitrate;
|
u64 d = mod->obitrate - mod->ibitrate;
|
||||||
|
|
||||||
d = div64_u64(d, mod->obitrate >> 24);
|
d = div64_u64(d, mod->obitrate >> 24);
|
||||||
if (d > 0xfffffe)
|
if (d > 0xfffffe)
|
||||||
ri = 0xfffffe;
|
ri = 0xfffffe;
|
||||||
@ -237,7 +243,7 @@ static void mod_calc_rateinc(struct ddb_mod *mod)
|
|||||||
|
|
||||||
static int mod_calc_obitrate(struct ddb_mod *mod)
|
static int mod_calc_obitrate(struct ddb_mod *mod)
|
||||||
{
|
{
|
||||||
u64 ofac;
|
u64 ofac;
|
||||||
|
|
||||||
ofac = (((u64) mod->symbolrate) << 32) * 188;
|
ofac = (((u64) mod->symbolrate) << 32) * 188;
|
||||||
ofac = div_u64(ofac, 204);
|
ofac = div_u64(ofac, 204);
|
||||||
@ -263,15 +269,17 @@ static int mod_set_symbolrate(struct ddb_mod *mod, u32 srate)
|
|||||||
|
|
||||||
static u32 qamtab[6] = { 0x000, 0x600, 0x601, 0x602, 0x903, 0x604 };
|
static u32 qamtab[6] = { 0x000, 0x600, 0x601, 0x602, 0x903, 0x604 };
|
||||||
|
|
||||||
static int mod_set_modulation(struct ddb_mod *mod, enum fe_modulation modulation)
|
static int mod_set_modulation(struct ddb_mod *mod,
|
||||||
|
enum fe_modulation modulation)
|
||||||
{
|
{
|
||||||
struct ddb *dev = mod->port->dev;
|
struct ddb *dev = mod->port->dev;
|
||||||
|
|
||||||
if (modulation > QAM_256 || modulation < QAM_16)
|
if (modulation > QAM_256 || modulation < QAM_16)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
mod->modulation = modulation;
|
mod->modulation = modulation;
|
||||||
if (dev->link[0].info->version < 2)
|
if (dev->link[0].info->version < 2)
|
||||||
ddbwritel(dev, qamtab[modulation], CHANNEL_SETTINGS(mod->port->nr));
|
ddbwritel(dev, qamtab[modulation],
|
||||||
|
CHANNEL_SETTINGS(mod->port->nr));
|
||||||
mod_calc_obitrate(mod);
|
mod_calc_obitrate(mod);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -279,7 +287,7 @@ static int mod_set_modulation(struct ddb_mod *mod, enum fe_modulation modulation
|
|||||||
static int mod_set_frequency(struct ddb_mod *mod, u32 frequency)
|
static int mod_set_frequency(struct ddb_mod *mod, u32 frequency)
|
||||||
{
|
{
|
||||||
u32 freq = frequency / 1000000;
|
u32 freq = frequency / 1000000;
|
||||||
|
|
||||||
if (frequency % 1000000)
|
if (frequency % 1000000)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if ((freq - 114) % 8)
|
if ((freq - 114) % 8)
|
||||||
@ -324,58 +332,62 @@ int ddbridge_mod_output_start(struct ddb_output *output)
|
|||||||
|
|
||||||
mod->State = CM_STARTUP;
|
mod->State = CM_STARTUP;
|
||||||
mod->StateCounter = CM_STARTUP_DELAY;
|
mod->StateCounter = CM_STARTUP_DELAY;
|
||||||
|
|
||||||
if (dev->link[0].info->version == 3)
|
if (dev->link[0].info->version == 3)
|
||||||
mod->Control = 0xfffffff0 & ddbreadl(dev, CHANNEL_CONTROL(output->nr));
|
mod->Control = 0xfffffff0 &
|
||||||
|
ddbreadl(dev, CHANNEL_CONTROL(output->nr));
|
||||||
else
|
else
|
||||||
mod->Control = 0;
|
mod->Control = 0;
|
||||||
ddbwritel(dev, mod->Control, CHANNEL_CONTROL(output->nr));
|
ddbwritel(dev, mod->Control, CHANNEL_CONTROL(output->nr));
|
||||||
udelay(10);
|
udelay(10);
|
||||||
ddbwritel(dev, mod->Control | CHANNEL_CONTROL_RESET, CHANNEL_CONTROL(output->nr));
|
ddbwritel(dev, mod->Control | CHANNEL_CONTROL_RESET,
|
||||||
|
CHANNEL_CONTROL(output->nr));
|
||||||
udelay(10);
|
udelay(10);
|
||||||
ddbwritel(dev, mod->Control, CHANNEL_CONTROL(output->nr));
|
ddbwritel(dev, mod->Control, CHANNEL_CONTROL(output->nr));
|
||||||
|
|
||||||
//pr_info("DDBridge: CHANNEL_BASE = %08x\n", CHANNEL_BASE);
|
|
||||||
///pr_info("DDBridge: CHANNEL_CONTROL = %08x\n", CHANNEL_CONTROL(Channel));
|
|
||||||
if (dev->link[0].info->version == 2) {
|
if (dev->link[0].info->version == 2) {
|
||||||
//u32 Output = ((dev->mod_base.frequency - 114000000)/8000000 + Channel) % 96;
|
|
||||||
u32 Output = (mod->frequency - 114000000) / 8000000;
|
u32 Output = (mod->frequency - 114000000) / 8000000;
|
||||||
u32 KF = Symbolrate;
|
u32 KF = Symbolrate;
|
||||||
u32 LF = 9000000UL;
|
u32 LF = 9000000UL;
|
||||||
u32 d = gcd(KF,LF);
|
u32 d = gcd(KF, LF);
|
||||||
u32 checkLF;
|
u32 checkLF;
|
||||||
|
|
||||||
ddbwritel(dev, mod->modulation - 1, CHANNEL_SETTINGS(Channel));
|
ddbwritel(dev, mod->modulation - 1, CHANNEL_SETTINGS(Channel));
|
||||||
ddbwritel(dev, Output, CHANNEL_SETTINGS2(Channel));
|
ddbwritel(dev, Output, CHANNEL_SETTINGS2(Channel));
|
||||||
|
|
||||||
KF = KF / d;
|
KF = KF / d;
|
||||||
LF = LF / d;
|
LF = LF / d;
|
||||||
|
|
||||||
while( (KF > KFLF_MAX) || (LF > KFLF_MAX) ) {
|
while ((KF > KFLF_MAX) || (LF > KFLF_MAX)) {
|
||||||
KF >>= 1;
|
KF >>= 1;
|
||||||
LF >>= 1;
|
LF >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkLF = LF;
|
checkLF = LF;
|
||||||
while ((checkLF & 1) == 0)
|
while ((checkLF & 1) == 0)
|
||||||
checkLF >>= 1;
|
checkLF >>= 1;
|
||||||
if (checkLF <= 1)
|
if (checkLF <= 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
pr_info("DDBridge: KF=%u LF=%u Output=%u mod=%u\n", KF, LF, Output, mod->modulation);
|
pr_info("DDBridge: KF=%u LF=%u Output=%u mod=%u\n",
|
||||||
|
KF, LF, Output, mod->modulation);
|
||||||
ddbwritel(dev, KF, CHANNEL_KF(Channel));
|
ddbwritel(dev, KF, CHANNEL_KF(Channel));
|
||||||
ddbwritel(dev, LF, CHANNEL_LF(Channel));
|
ddbwritel(dev, LF, CHANNEL_LF(Channel));
|
||||||
|
|
||||||
if (mod_SendChannelCommand(dev, Channel, CHANNEL_CONTROL_CMD_SETUP))
|
if (mod_SendChannelCommand(dev, Channel,
|
||||||
|
CHANNEL_CONTROL_CMD_SETUP))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
mod->Control |= CHANNEL_CONTROL_ENABLE_DVB;
|
mod->Control |= CHANNEL_CONTROL_ENABLE_DVB;
|
||||||
} else if (dev->link[0].info->version == 1) {
|
} else if (dev->link[0].info->version == 1) {
|
||||||
/* QAM: 600 601 602 903 604 = 16 32 64 128 256 */
|
/* QAM: 600 601 602 903 604 = 16 32 64 128 256 */
|
||||||
/* ddbwritel(dev, 0x604, CHANNEL_SETTINGS(output->nr)); */
|
/* ddbwritel(dev, 0x604, CHANNEL_SETTINGS(output->nr)); */
|
||||||
ddbwritel(dev, qamtab[mod->modulation], CHANNEL_SETTINGS(output->nr));
|
ddbwritel(dev, qamtab[mod->modulation],
|
||||||
mod->Control |= (CHANNEL_CONTROL_ENABLE_IQ | CHANNEL_CONTROL_ENABLE_DVB);
|
CHANNEL_SETTINGS(output->nr));
|
||||||
|
mod->Control |= (CHANNEL_CONTROL_ENABLE_IQ |
|
||||||
|
CHANNEL_CONTROL_ENABLE_DVB);
|
||||||
} else if (dev->link[0].info->version == 3) {
|
} else if (dev->link[0].info->version == 3) {
|
||||||
mod->Control |= (CHANNEL_CONTROL_ENABLE_IQ | CHANNEL_CONTROL_ENABLE_DVB);
|
mod->Control |= (CHANNEL_CONTROL_ENABLE_IQ |
|
||||||
|
CHANNEL_CONTROL_ENABLE_DVB);
|
||||||
}
|
}
|
||||||
if (dev->link[0].info->version < 3) {
|
if (dev->link[0].info->version < 3) {
|
||||||
mod_set_rateinc(dev, output->nr);
|
mod_set_rateinc(dev, output->nr);
|
||||||
@ -385,7 +397,8 @@ int ddbridge_mod_output_start(struct ddb_output *output)
|
|||||||
|
|
||||||
ddbwritel(dev, mod->Control, CHANNEL_CONTROL(output->nr));
|
ddbwritel(dev, mod->Control, CHANNEL_CONTROL(output->nr));
|
||||||
if (dev->link[0].info->version == 2)
|
if (dev->link[0].info->version == 2)
|
||||||
if (mod_SendChannelCommand(dev, Channel, CHANNEL_CONTROL_CMD_UNMUTE))
|
if (mod_SendChannelCommand(dev, Channel,
|
||||||
|
CHANNEL_CONTROL_CMD_UNMUTE))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
pr_info("DDBridge: mod_output_start %d.%d ctrl=%08x\n",
|
pr_info("DDBridge: mod_output_start %d.%d ctrl=%08x\n",
|
||||||
dev->nr, output->nr, mod->Control);
|
dev->nr, output->nr, mod->Control);
|
||||||
@ -399,9 +412,11 @@ int ddbridge_mod_output_start(struct ddb_output *output)
|
|||||||
static int mod_write_max2871(struct ddb *dev, u32 val)
|
static int mod_write_max2871(struct ddb *dev, u32 val)
|
||||||
{
|
{
|
||||||
ddbwritel(dev, val, MAX2871_OUTDATA);
|
ddbwritel(dev, val, MAX2871_OUTDATA);
|
||||||
ddbwritel(dev, MAX2871_CONTROL_CE | MAX2871_CONTROL_WRITE, MAX2871_CONTROL);
|
ddbwritel(dev, MAX2871_CONTROL_CE | MAX2871_CONTROL_WRITE,
|
||||||
while(1) {
|
MAX2871_CONTROL);
|
||||||
|
while (1) {
|
||||||
u32 ControlReg = ddbreadl(dev, MAX2871_CONTROL);
|
u32 ControlReg = ddbreadl(dev, MAX2871_CONTROL);
|
||||||
|
|
||||||
if (ControlReg == 0xFFFFFFFF)
|
if (ControlReg == 0xFFFFFFFF)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
if ((ControlReg & MAX2871_CONTROL_WRITE) == 0)
|
if ((ControlReg & MAX2871_CONTROL_WRITE) == 0)
|
||||||
@ -423,14 +438,14 @@ static int mod_setup_max2871(struct ddb *dev, u32 *reg)
|
|||||||
int status = 0;
|
int status = 0;
|
||||||
int i, j;
|
int i, j;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
ddbwritel(dev, MAX2871_CONTROL_CE, MAX2871_CONTROL);
|
ddbwritel(dev, MAX2871_CONTROL_CE, MAX2871_CONTROL);
|
||||||
msleep(30);
|
msleep(30);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
for (j = 5; j >= 0; j--) {
|
for (j = 5; j >= 0; j--) {
|
||||||
val = reg[j];
|
val = reg[j];
|
||||||
|
|
||||||
if (j ==4)
|
if (j == 4)
|
||||||
val &= 0xFFFFFEDF;
|
val &= 0xFFFFFEDF;
|
||||||
status = mod_write_max2871(dev, reg[j]);
|
status = mod_write_max2871(dev, reg[j]);
|
||||||
if (status)
|
if (status)
|
||||||
@ -452,19 +467,20 @@ static int mod_setup_max2871(struct ddb *dev, u32 *reg)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mod_fsm_setup(struct ddb *dev, u32 FrequencyPlan, u32 MaxUsedChannels)
|
static int mod_fsm_setup(struct ddb *dev, u32 FrequencyPlan,
|
||||||
|
u32 MaxUsedChannels)
|
||||||
{
|
{
|
||||||
int status = 0;
|
int status = 0;
|
||||||
u32 Capacity;
|
u32 Capacity;
|
||||||
u32 tmp = ddbreadl(dev, FSM_STATUS);
|
u32 tmp = ddbreadl(dev, FSM_STATUS);
|
||||||
|
|
||||||
if ((tmp & FSM_STATUS_READY) == 0) {
|
if ((tmp & FSM_STATUS_READY) == 0) {
|
||||||
status = mod_setup_max2871(dev, max2871_fsm);
|
status = mod_setup_max2871(dev, max2871_fsm);
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
ddbwritel(dev, FSM_CMD_RESET, FSM_CONTROL);
|
ddbwritel(dev, FSM_CMD_RESET, FSM_CONTROL);
|
||||||
msleep(10);
|
msleep(20);
|
||||||
|
|
||||||
tmp = ddbreadl(dev, FSM_STATUS);
|
tmp = ddbreadl(dev, FSM_STATUS);
|
||||||
if ((tmp & FSM_STATUS_READY) == 0)
|
if ((tmp & FSM_STATUS_READY) == 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -473,23 +489,23 @@ static int mod_fsm_setup(struct ddb *dev, u32 FrequencyPlan, u32 MaxUsedChannels
|
|||||||
if (((tmp & FSM_STATUS_QAMREADY) != 0) &&
|
if (((tmp & FSM_STATUS_QAMREADY) != 0) &&
|
||||||
((Capacity & FSM_CAPACITY_INUSE) != 0))
|
((Capacity & FSM_CAPACITY_INUSE) != 0))
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
ddbwritel(dev, FSM_CMD_SETUP, FSM_CONTROL);
|
ddbwritel(dev, FSM_CMD_SETUP, FSM_CONTROL);
|
||||||
msleep(10);
|
msleep(20);
|
||||||
tmp = ddbreadl(dev, FSM_STATUS);
|
tmp = ddbreadl(dev, FSM_STATUS);
|
||||||
|
|
||||||
if ((tmp & FSM_STATUS_QAMREADY) == 0)
|
if ((tmp & FSM_STATUS_QAMREADY) == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (MaxUsedChannels == 0)
|
if (MaxUsedChannels == 0)
|
||||||
MaxUsedChannels = (Capacity & FSM_CAPACITY_CUR) >> 16;
|
MaxUsedChannels = (Capacity & FSM_CAPACITY_CUR) >> 16;
|
||||||
|
|
||||||
pr_info("DDBridge: max used chan = %u\n", MaxUsedChannels);
|
pr_info("DDBridge: max used chan = %u\n", MaxUsedChannels);
|
||||||
if (MaxUsedChannels <= 1 )
|
if (MaxUsedChannels <= 1)
|
||||||
ddbwritel(dev, FSM_GAIN_N1, FSM_GAIN);
|
ddbwritel(dev, FSM_GAIN_N1, FSM_GAIN);
|
||||||
else if (MaxUsedChannels <= 2)
|
else if (MaxUsedChannels <= 2)
|
||||||
ddbwritel(dev, FSM_GAIN_N2, FSM_GAIN);
|
ddbwritel(dev, FSM_GAIN_N2, FSM_GAIN);
|
||||||
else if (MaxUsedChannels <= 4)
|
else if (MaxUsedChannels <= 4)
|
||||||
ddbwritel(dev, FSM_GAIN_N4, FSM_GAIN);
|
ddbwritel(dev, FSM_GAIN_N4, FSM_GAIN);
|
||||||
else if (MaxUsedChannels <= 8)
|
else if (MaxUsedChannels <= 8)
|
||||||
ddbwritel(dev, FSM_GAIN_N8, FSM_GAIN);
|
ddbwritel(dev, FSM_GAIN_N8, FSM_GAIN);
|
||||||
@ -507,84 +523,12 @@ static int mod_fsm_setup(struct ddb *dev, u32 FrequencyPlan, u32 MaxUsedChannels
|
|||||||
|
|
||||||
static int mod_set_vga(struct ddb *dev, u32 Gain)
|
static int mod_set_vga(struct ddb *dev, u32 Gain)
|
||||||
{
|
{
|
||||||
if( Gain > 255 )
|
if (Gain > 255)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
ddbwritel(dev, Gain, RF_VGA);
|
ddbwritel(dev, Gain, RF_VGA);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static int mod_get_vga(struct ddb *dev, u32 *pGain)
|
|
||||||
{
|
|
||||||
*pGain = ddbreadl(dev, RF_VGA);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TemperatureMonitorSetFan(struct ddb *dev)
|
|
||||||
{
|
|
||||||
u32 tqam, pwm;
|
|
||||||
|
|
||||||
if ((ddbreadl(dev, TEMPMON_CONTROL) & TEMPMON_CONTROL_OVERTEMP ) != 0) {
|
|
||||||
pr_info("DDBridge: Over temperature condition\n");
|
|
||||||
dev->OverTemperatureError = 1;
|
|
||||||
}
|
|
||||||
tqam = (ddbreadl(dev, TEMPMON2_QAMCORE) >> 8) & 0xFF;
|
|
||||||
if (tqam & 0x80)
|
|
||||||
tqam = 0;
|
|
||||||
|
|
||||||
pwm = (ddbreadl(dev, TEMPMON_FANCONTROL) >> 8) & 0x0F;
|
|
||||||
if (pwm > 10)
|
|
||||||
pwm = 10;
|
|
||||||
|
|
||||||
if (tqam >= dev->temp_tab[pwm]) {
|
|
||||||
while( pwm < 10 && tqam >= dev->temp_tab[pwm + 1])
|
|
||||||
pwm += 1;
|
|
||||||
} else {
|
|
||||||
while( pwm > 1 && tqam < dev->temp_tab[pwm - 2])
|
|
||||||
pwm -= 1;
|
|
||||||
}
|
|
||||||
ddbwritel(dev, (pwm << 8), TEMPMON_FANCONTROL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void temp_handler(unsigned long data)
|
|
||||||
{
|
|
||||||
struct ddb *dev = (struct ddb *) data;
|
|
||||||
|
|
||||||
pr_info("DDBridge: temp_handler\n");
|
|
||||||
|
|
||||||
spin_lock(&dev->temp_lock);
|
|
||||||
TemperatureMonitorSetFan(dev);
|
|
||||||
spin_unlock(&dev->temp_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int TemperatureMonitorInit(struct ddb *dev, int FirstTime) {
|
|
||||||
int status = 0;
|
|
||||||
|
|
||||||
spin_lock_irq(&dev->temp_lock);
|
|
||||||
if (FirstTime) {
|
|
||||||
static u8 TemperatureTable[11] = {30,35,40,45,50,55,60,65,70,75,80};
|
|
||||||
|
|
||||||
memcpy(dev->temp_tab, TemperatureTable, sizeof(TemperatureTable));
|
|
||||||
}
|
|
||||||
dev->handler[0][8] = temp_handler;
|
|
||||||
dev->handler_data[0][8] = (unsigned long) dev;
|
|
||||||
ddbwritel(dev, (TEMPMON_CONTROL_OVERTEMP | TEMPMON_CONTROL_AUTOSCAN |
|
|
||||||
TEMPMON_CONTROL_INTENABLE),
|
|
||||||
TEMPMON_CONTROL);
|
|
||||||
ddbwritel(dev, (3 << 8), TEMPMON_FANCONTROL);
|
|
||||||
|
|
||||||
dev->OverTemperatureError =
|
|
||||||
((ddbreadl(dev, TEMPMON_CONTROL) & TEMPMON_CONTROL_OVERTEMP ) != 0);
|
|
||||||
if (dev->OverTemperatureError) {
|
|
||||||
pr_info("DDBridge: Over temperature condition\n");
|
|
||||||
status = -1;
|
|
||||||
}
|
|
||||||
TemperatureMonitorSetFan(dev);
|
|
||||||
spin_unlock_irq(&dev->temp_lock);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@ -749,7 +693,8 @@ static int mod_set_si598(struct ddb *dev, u32 freq)
|
|||||||
((u32)(Data[1] & 0xE0) >> 6)) + 1;
|
((u32)(Data[1] & 0xE0) >> 6)) + 1;
|
||||||
fDCO = fOut * (u64)(HSDiv * N);
|
fDCO = fOut * (u64)(HSDiv * N);
|
||||||
m_fXtal = fDCO << 28;
|
m_fXtal = fDCO << 28;
|
||||||
pr_info("DDBridge: fxtal %016llx rfreq %016llx\n", m_fXtal, RFreq);
|
pr_info("DDBridge: fxtal %016llx rfreq %016llx\n",
|
||||||
|
m_fXtal, RFreq);
|
||||||
|
|
||||||
m_fXtal += RFreq >> 1;
|
m_fXtal += RFreq >> 1;
|
||||||
m_fXtal = div64_u64(m_fXtal, RFreq);
|
m_fXtal = div64_u64(m_fXtal, RFreq);
|
||||||
@ -950,9 +895,9 @@ static int mod_init_dac_input(struct ddb *dev)
|
|||||||
Seek = 1;
|
Seek = 1;
|
||||||
for (Sample = 0; Sample < 32; Sample += 1) {
|
for (Sample = 0; Sample < 32; Sample += 1) {
|
||||||
/* printk(" %2d: %d %2d %2d\n",
|
/* printk(" %2d: %d %2d %2d\n",
|
||||||
Sample, SeekTable[Sample], SetTable[Sample],
|
* Sample, SeekTable[Sample], SetTable[Sample],
|
||||||
HldTable[Sample]);
|
* HldTable[Sample]);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (Sample1 == 0xFF && SeekTable[Sample] == 1 && Seek == 0)
|
if (Sample1 == 0xFF && SeekTable[Sample] == 1 && Seek == 0)
|
||||||
Sample1 = Sample;
|
Sample1 = Sample;
|
||||||
@ -1244,7 +1189,8 @@ static int mod_init_1(struct ddb *dev, u32 Frequency)
|
|||||||
FrequencyCH10 = flash->DataSet[0].FlatStart + 4;
|
FrequencyCH10 = flash->DataSet[0].FlatStart + 4;
|
||||||
DownFrequency = Frequency + 9 * 8 + FrequencyCH10 +
|
DownFrequency = Frequency + 9 * 8 + FrequencyCH10 +
|
||||||
UP1Frequency + UP2Frequency;
|
UP1Frequency + UP2Frequency;
|
||||||
pr_info("DDBridge: CH10 = %d, Down = %d\n", FrequencyCH10, DownFrequency);
|
pr_info("DDBridge: CH10 = %d, Down = %d\n",
|
||||||
|
FrequencyCH10, DownFrequency);
|
||||||
|
|
||||||
if ((FrequencyCH10 + 9 * 8) > (flash->DataSet[0].FlatEnd - 4)) {
|
if ((FrequencyCH10 + 9 * 8) > (flash->DataSet[0].FlatEnd - 4)) {
|
||||||
pr_err("DDBridge: Frequency out of range %d\n", FrequencyCH10);
|
pr_err("DDBridge: Frequency out of range %d\n", FrequencyCH10);
|
||||||
@ -1296,10 +1242,10 @@ fail:
|
|||||||
#define FACTOR (1ULL << 22)
|
#define FACTOR (1ULL << 22)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
double Increment = FACTOR*PACKET_CLOCKS/double(m_OutputBitrate);
|
* double Increment = FACTOR*PACKET_CLOCKS/double(m_OutputBitrate);
|
||||||
double Decrement = FACTOR*PACKET_CLOCKS/double(m_InputBitrate);
|
* double Decrement = FACTOR*PACKET_CLOCKS/double(m_InputBitrate);
|
||||||
27000000 * 1504 * 2^22 / (6900000 * 188 / 204) = 26785190066.1
|
* 27000000 * 1504 * 2^22 / (6900000 * 188 / 204) = 26785190066.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ddbridge_mod_rate_handler(unsigned long data)
|
void ddbridge_mod_rate_handler(unsigned long data)
|
||||||
{
|
{
|
||||||
@ -1484,7 +1430,7 @@ void ddbridge_mod_rate_handler(unsigned long data)
|
|||||||
static int mod3_set_base_frequency(struct ddb *dev, u32 frequency)
|
static int mod3_set_base_frequency(struct ddb *dev, u32 frequency)
|
||||||
{
|
{
|
||||||
u64 tmp;
|
u64 tmp;
|
||||||
|
|
||||||
if (frequency % 1000)
|
if (frequency % 1000)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if ((frequency < 114000000) || (frequency > 874000000))
|
if ((frequency < 114000000) || (frequency > 874000000))
|
||||||
@ -1493,7 +1439,7 @@ static int mod3_set_base_frequency(struct ddb *dev, u32 frequency)
|
|||||||
tmp = frequency;
|
tmp = frequency;
|
||||||
tmp <<= 33;
|
tmp <<= 33;
|
||||||
tmp = div64_s64(tmp, 4915200000);
|
tmp = div64_s64(tmp, 4915200000);
|
||||||
printk("set base frequency = %u regs = 0x%08llx\n", frequency, tmp);
|
pr_info("set base frequency = %u regs = 0x%08llx\n", frequency, tmp);
|
||||||
ddbwritel(dev, (u32) tmp, RFDAC_FCW);
|
ddbwritel(dev, (u32) tmp, RFDAC_FCW);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1505,18 +1451,18 @@ static void mod3_set_cfcw(struct ddb_mod *mod, u32 f)
|
|||||||
s32 dcf = dev->mod_base.frequency;
|
s32 dcf = dev->mod_base.frequency;
|
||||||
s64 tmp, srdac = 245760000;
|
s64 tmp, srdac = 245760000;
|
||||||
u32 cfcw;
|
u32 cfcw;
|
||||||
|
|
||||||
tmp = ((s64) (freq - dcf)) << 32;
|
tmp = ((s64) (freq - dcf)) << 32;
|
||||||
tmp = div64_s64(tmp, srdac);
|
tmp = div64_s64(tmp, srdac);
|
||||||
cfcw = (u32) tmp;
|
cfcw = (u32) tmp;
|
||||||
printk("f=%u cfcw = %08x nr = %u\n", f, cfcw, mod->port->nr);
|
pr_info("f=%u cfcw = %08x nr = %u\n", f, cfcw, mod->port->nr);
|
||||||
ddbwritel(dev, cfcw, SDR_CHANNEL_CFCW(mod->port->nr));
|
ddbwritel(dev, cfcw, SDR_CHANNEL_CFCW(mod->port->nr));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mod3_set_frequency(struct ddb_mod *mod, u32 frequency)
|
static int mod3_set_frequency(struct ddb_mod *mod, u32 frequency)
|
||||||
{
|
{
|
||||||
struct ddb *dev = mod->port->dev;
|
struct ddb *dev = mod->port->dev;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (frequency % 1000)
|
if (frequency % 1000)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1542,7 +1488,7 @@ static int mod3_set_ari(struct ddb_mod *mod, u32 rate)
|
|||||||
|
|
||||||
static int mod3_prop_proc(struct ddb_mod *mod, struct dtv_property *tvp)
|
static int mod3_prop_proc(struct ddb_mod *mod, struct dtv_property *tvp)
|
||||||
{
|
{
|
||||||
switch(tvp->cmd) {
|
switch (tvp->cmd) {
|
||||||
case MODULATOR_OUTPUT_ARI:
|
case MODULATOR_OUTPUT_ARI:
|
||||||
return mod3_set_ari(mod, tvp->u.data);
|
return mod3_set_ari(mod, tvp->u.data);
|
||||||
|
|
||||||
@ -1559,7 +1505,7 @@ static int mod_prop_proc(struct ddb_mod *mod, struct dtv_property *tvp)
|
|||||||
{
|
{
|
||||||
if (mod->port->dev->link[0].info->version == 3)
|
if (mod->port->dev->link[0].info->version == 3)
|
||||||
return mod3_prop_proc(mod, tvp);
|
return mod3_prop_proc(mod, tvp);
|
||||||
switch(tvp->cmd) {
|
switch (tvp->cmd) {
|
||||||
case MODULATOR_SYMBOL_RATE:
|
case MODULATOR_SYMBOL_RATE:
|
||||||
return mod_set_symbolrate(mod, tvp->u.data);
|
return mod_set_symbolrate(mod, tvp->u.data);
|
||||||
|
|
||||||
@ -1586,20 +1532,22 @@ int ddbridge_mod_do_ioctl(struct file *file, unsigned int cmd, void *parg)
|
|||||||
struct ddb *dev = output->port->dev;
|
struct ddb *dev = output->port->dev;
|
||||||
struct ddb_mod *mod = &dev->mod[output->nr];
|
struct ddb_mod *mod = &dev->mod[output->nr];
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (dev->link[0].info->version == 3 && cmd != FE_SET_PROPERTY)
|
if (dev->link[0].info->version == 3 && cmd != FE_SET_PROPERTY)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case FE_SET_PROPERTY:
|
case FE_SET_PROPERTY:
|
||||||
{
|
{
|
||||||
struct dtv_properties *tvps = (struct dtv_properties __user *) parg;
|
struct dtv_properties *tvps =
|
||||||
|
(struct dtv_properties __user *) parg;
|
||||||
struct dtv_property *tvp = NULL;
|
struct dtv_property *tvp = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((tvps->num == 0) || (tvps->num > DTV_IOCTL_MAX_MSGS))
|
if ((tvps->num == 0) || (tvps->num > DTV_IOCTL_MAX_MSGS))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
tvp = kmalloc(tvps->num * sizeof(struct dtv_property), GFP_KERNEL);
|
tvp = kmalloc(tvps->num * sizeof(struct dtv_property),
|
||||||
|
GFP_KERNEL);
|
||||||
if (!tvp) {
|
if (!tvp) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
@ -1610,11 +1558,12 @@ int ddbridge_mod_do_ioctl(struct file *file, unsigned int cmd, void *parg)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
for (i = 0; i < tvps->num; i++) {
|
for (i = 0; i < tvps->num; i++) {
|
||||||
if ((ret = mod_prop_proc(mod, tvp + i)) < 0)
|
ret = mod_prop_proc(mod, tvp + i);
|
||||||
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
(tvp + i)->result = ret;
|
(tvp + i)->result = ret;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
kfree(tvp);
|
kfree(tvp);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1677,7 +1626,7 @@ static int mod_init_2(struct ddb *dev, u32 Frequency)
|
|||||||
pr_err("FSM setup failed!\n");
|
pr_err("FSM setup failed!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < streams; i++) {
|
for (i = 0; i < streams; i++) {
|
||||||
struct ddb_mod *mod = &dev->mod[i];
|
struct ddb_mod *mod = &dev->mod[i];
|
||||||
|
|
||||||
@ -1692,7 +1641,7 @@ static int mod_init_2(struct ddb *dev, u32 Frequency)
|
|||||||
mod_set_vga(dev, RF_VGA_GAIN_N16);
|
mod_set_vga(dev, RF_VGA_GAIN_N16);
|
||||||
else
|
else
|
||||||
mod_set_vga(dev, RF_VGA_GAIN_N24);
|
mod_set_vga(dev, RF_VGA_GAIN_N24);
|
||||||
|
|
||||||
mod_set_attenuator(dev, 0);
|
mod_set_attenuator(dev, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1732,7 +1681,7 @@ static void mod_set_sdr_table(struct ddb_mod *mod, u32 *tab, u32 len)
|
|||||||
struct ddb *dev = mod->port->dev;
|
struct ddb *dev = mod->port->dev;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
ddbwritel(dev, tab[i], SDR_CHANNEL_SETFIR(mod->port->nr));
|
ddbwritel(dev, tab[i], SDR_CHANNEL_SETFIR(mod->port->nr));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1740,45 +1689,45 @@ static int rfdac_init(struct ddb *dev)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
|
|
||||||
ddbwritel(dev, RFDAC_CMD_POWERDOWN, RFDAC_CONTROL);
|
ddbwritel(dev, RFDAC_CMD_POWERDOWN, RFDAC_CONTROL);
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
msleep(10);
|
msleep(20);
|
||||||
tmp = ddbreadl(dev, RFDAC_CONTROL);
|
tmp = ddbreadl(dev, RFDAC_CONTROL);
|
||||||
if ((tmp & RFDAC_CMD_STATUS) == 0x00)
|
if ((tmp & RFDAC_CMD_STATUS) == 0x00)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (tmp & 0x80)
|
if (tmp & 0x80)
|
||||||
return -1;
|
return -1;
|
||||||
printk("sync %d:%08x\n", i, tmp);
|
pr_info("sync %d:%08x\n", i, tmp);
|
||||||
ddbwritel(dev, RFDAC_CMD_RESET, RFDAC_CONTROL);
|
ddbwritel(dev, RFDAC_CMD_RESET, RFDAC_CONTROL);
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
msleep(10);
|
msleep(20);
|
||||||
tmp = ddbreadl(dev, RFDAC_CONTROL);
|
tmp = ddbreadl(dev, RFDAC_CONTROL);
|
||||||
if ((tmp & RFDAC_CMD_STATUS) == 0x00)
|
if ((tmp & RFDAC_CMD_STATUS) == 0x00)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (tmp & 0x80)
|
if (tmp & 0x80)
|
||||||
return -1;
|
return -1;
|
||||||
printk("sync %d:%08x\n", i, tmp);
|
pr_info("sync %d:%08x\n", i, tmp);
|
||||||
ddbwritel(dev, RFDAC_CMD_SETUP, RFDAC_CONTROL);
|
ddbwritel(dev, RFDAC_CMD_SETUP, RFDAC_CONTROL);
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
msleep(10);
|
msleep(20);
|
||||||
tmp = ddbreadl(dev, RFDAC_CONTROL);
|
tmp = ddbreadl(dev, RFDAC_CONTROL);
|
||||||
if ((tmp & RFDAC_CMD_STATUS) == 0x00)
|
if ((tmp & RFDAC_CMD_STATUS) == 0x00)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (tmp & 0x80)
|
if (tmp & 0x80)
|
||||||
return -1;
|
return -1;
|
||||||
printk("sync %d:%08x\n", i, tmp);
|
pr_info("sync %d:%08x\n", i, tmp);
|
||||||
ddbwritel(dev, 0x01, JESD204B_BASE);
|
ddbwritel(dev, 0x01, JESD204B_BASE);
|
||||||
for (i = 0; i < 400; i++) {
|
for (i = 0; i < 400; i++) {
|
||||||
msleep(10);
|
msleep(20);
|
||||||
tmp = ddbreadl(dev, JESD204B_BASE);
|
tmp = ddbreadl(dev, JESD204B_BASE);
|
||||||
if ((tmp & 0xc0000000) == 0xc0000000)
|
if ((tmp & 0xc0000000) == 0xc0000000)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printk("sync %d:%08x\n", i, tmp);
|
pr_info("sync %d:%08x\n", i, tmp);
|
||||||
if ((tmp & 0xc0000000) != 0xc0000000)
|
if ((tmp & 0xc0000000) != 0xc0000000)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
@ -1801,8 +1750,8 @@ static int mod_init_3(struct ddb *dev, u32 Frequency)
|
|||||||
|
|
||||||
for (i = 0; i < streams; i++) {
|
for (i = 0; i < streams; i++) {
|
||||||
struct ddb_mod *mod = &dev->mod[i];
|
struct ddb_mod *mod = &dev->mod[i];
|
||||||
|
|
||||||
mod->port = &dev->port[i];
|
mod->port = &dev->port[i];
|
||||||
|
|
||||||
mod_set_sdr_table(mod, vsb13500, 64);
|
mod_set_sdr_table(mod, vsb13500, 64);
|
||||||
mod_set_sdr_table(mod, stage2, 16);
|
mod_set_sdr_table(mod, stage2, 16);
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,6 @@ static int ns_alloc(struct dvbnss *nss)
|
|||||||
dev->ns[i].fe = input;
|
dev->ns[i].fe = input;
|
||||||
nss->priv = &dev->ns[i];
|
nss->priv = &dev->ns[i];
|
||||||
ret = 0;
|
ret = 0;
|
||||||
/*pr_info("DDBridge: %s i=%d fe=%d\n", __func__, i, input->nr); */
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ddbwritel(dev, 0x03, RTP_MASTER_CONTROL);
|
ddbwritel(dev, 0x03, RTP_MASTER_CONTROL);
|
||||||
@ -446,8 +445,6 @@ static int ns_start(struct dvbnss *nss)
|
|||||||
if (dns->fe != input)
|
if (dns->fe != input)
|
||||||
ddb_dvb_ns_input_start(dns->fe);
|
ddb_dvb_ns_input_start(dns->fe);
|
||||||
ddb_dvb_ns_input_start(input);
|
ddb_dvb_ns_input_start(input);
|
||||||
/* printk("ns start ns %u, fe %u link %u\n",
|
|
||||||
dns->nr, dns->fe->nr, dns->fe->port->lnr); */
|
|
||||||
ddbwritel(dev, reg | (dns->fe->nr << 8) | (dns->fe->port->lnr << 16),
|
ddbwritel(dev, reg | (dns->fe->nr << 8) | (dns->fe->port->lnr << 16),
|
||||||
STREAM_CONTROL(dns->nr));
|
STREAM_CONTROL(dns->nr));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -58,9 +58,9 @@
|
|||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Interrupt controller
|
/* Interrupt controller
|
||||||
How many MSI's are available depends on HW (Min 2 max 8)
|
* How many MSI's are available depends on HW (Min 2 max 8)
|
||||||
How many are usable also depends on Host platform
|
* How many are usable also depends on Host platform
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define INTERRUPT_BASE (0x40)
|
#define INTERRUPT_BASE (0x40)
|
||||||
|
|
||||||
@ -167,13 +167,15 @@
|
|||||||
#define TEMPMON_FANPWM (0x00000F00) // PWM speed in 10% steps
|
#define TEMPMON_FANPWM (0x00000F00) // PWM speed in 10% steps
|
||||||
#define TEMPMON_FANTACHO (0x000000FF) // Rotations in 100/min steps
|
#define TEMPMON_FANTACHO (0x000000FF) // Rotations in 100/min steps
|
||||||
|
|
||||||
// V1 Temperature Monitor
|
/* V1 Temperature Monitor
|
||||||
// Temperature Monitor TEMPMON_CONTROL & 0x8000 == 0 : ( 2x LM75A @ 0x90,0x92 )
|
* Temperature Monitor TEMPMON_CONTROL & 0x8000 == 0 : ( 2x LM75A @ 0x90,0x92 )
|
||||||
// Temperature Monitor TEMPMON_CONTROL & 0x8000 == 1 : ( 1x LM75A @ 0x90, 1x ADM1032 @ 0x9A )
|
* Temperature Monitor TEMPMON_CONTROL & 0x8000 == 1 :
|
||||||
|
* ( 1x LM75A @ 0x90, 1x ADM1032 @ 0x9A )
|
||||||
|
*/
|
||||||
|
|
||||||
#define TEMPMON1_CORE (TEMPMON_SENSOR0) // SHORT Temperature in °C x 256 (ADM1032 ext)
|
#define TEMPMON1_CORE (TEMPMON_SENSOR0) // u16 Temperature in °C x 256 (ADM1032 ext)
|
||||||
#define TEMPMON1_SENSOR1 (TEMPMON_BASE + 0x08) // SHORT Temperature in °C x 256 (LM75A 0x90)
|
#define TEMPMON1_SENSOR1 (TEMPMON_BASE + 0x08) // SHORT Temperature in °C x 256 (LM75A 0x90)
|
||||||
#define TEMPMON1_SENSOR2 (TEMPMON_BASE + 0x0C) // SHORT Temperature in °C x 256 (LM75A 0x92 or ADM1032 Int)
|
#define TEMPMON1_SENSOR2 (TEMPMON_BASE + 0x0C) // SHORT Temperature in °C x 256 (LM75A 0x92 or ADM1032 Int)
|
||||||
|
|
||||||
// V2 Temperature Monitor 2 ADM1032
|
// V2 Temperature Monitor 2 ADM1032
|
||||||
|
|
||||||
@ -332,16 +334,16 @@
|
|||||||
/* Muxout from VCO (usually = Lock) */
|
/* Muxout from VCO (usually = Lock) */
|
||||||
#define VCO3_CONTROL_MUXOUT (0x00000004)
|
#define VCO3_CONTROL_MUXOUT (0x00000004)
|
||||||
|
|
||||||
// V2
|
/* V2 */
|
||||||
|
|
||||||
#define MAX2871_BASE (0xC0)
|
#define MAX2871_BASE (0xC0)
|
||||||
#define MAX2871_CONTROL (MAX2871_BASE + 0x00)
|
#define MAX2871_CONTROL (MAX2871_BASE + 0x00)
|
||||||
#define MAX2871_OUTDATA (MAX2871_BASE + 0x04) // 32 Bit
|
#define MAX2871_OUTDATA (MAX2871_BASE + 0x04)
|
||||||
#define MAX2871_INDATA (MAX2871_BASE + 0x08) // 32 Bit
|
#define MAX2871_INDATA (MAX2871_BASE + 0x08)
|
||||||
#define MAX2871_CONTROL_WRITE (0x00000001) // 1 = Trigger write, resets when done
|
#define MAX2871_CONTROL_WRITE (0x00000001) // 1 = Trigger write, resets when done
|
||||||
#define MAX2871_CONTROL_CE (0x00000002) // 0 = Put VCO into power down
|
#define MAX2871_CONTROL_CE (0x00000002) // 0 = Put VCO into power down
|
||||||
#define MAX2871_CONTROL_MUXOUT (0x00000004) // Muxout from VCO
|
#define MAX2871_CONTROL_MUXOUT (0x00000004) // Muxout from VCO
|
||||||
#define MAX2871_CONTROL_LOCK (0x00000008) // Lock from VCO
|
#define MAX2871_CONTROL_LOCK (0x00000008) // Lock from VCO
|
||||||
|
|
||||||
#define FSM_BASE (0x200)
|
#define FSM_BASE (0x200)
|
||||||
#define FSM_CONTROL (FSM_BASE + 0x00)
|
#define FSM_CONTROL (FSM_BASE + 0x00)
|
||||||
@ -360,9 +362,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#define FSM_CAPACITY (FSM_BASE + 0x04)
|
#define FSM_CAPACITY (FSM_BASE + 0x04)
|
||||||
#define FSM_CAPACITY_MAX (0x3F000000)
|
#define FSM_CAPACITY_MAX (0x3F000000)
|
||||||
#define FSM_CAPACITY_CUR (0x003F0000)
|
#define FSM_CAPACITY_CUR (0x003F0000)
|
||||||
#define FSM_CAPACITY_INUSE (0x0000003F)
|
#define FSM_CAPACITY_INUSE (0x0000003F)
|
||||||
|
|
||||||
#define FSM_GAIN (FSM_BASE + 0x10)
|
#define FSM_GAIN (FSM_BASE + 0x10)
|
||||||
#define FSM_GAINMASK (0x000000FF)
|
#define FSM_GAINMASK (0x000000FF)
|
||||||
@ -381,15 +383,15 @@
|
|||||||
#define RF_ATTENUATOR (0xD8)
|
#define RF_ATTENUATOR (0xD8)
|
||||||
#define RF_ATTENUATOR (0xD8)
|
#define RF_ATTENUATOR (0xD8)
|
||||||
/* 0x00 = 0 dB
|
/* 0x00 = 0 dB
|
||||||
0x01 = 1 dB
|
* 0x01 = 1 dB
|
||||||
...
|
* ...
|
||||||
0x1F = 31 dB
|
* 0x1F = 31 dB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define RF_VGA (0xDC)
|
#define RF_VGA (0xDC)
|
||||||
/* Only V2 */
|
/* Only V2 */
|
||||||
/* 8 bit range 0 - 31.75 dB Gain */
|
/* 8 bit range 0 - 31.75 dB Gain */
|
||||||
|
|
||||||
/* VGA Gain for same output level as V1 Modulator */
|
/* VGA Gain for same output level as V1 Modulator */
|
||||||
#define RF_VGA_GAIN_N8 (85)
|
#define RF_VGA_GAIN_N8 (85)
|
||||||
#define RF_VGA_GAIN_N16 (117)
|
#define RF_VGA_GAIN_N16 (117)
|
||||||
@ -411,9 +413,9 @@
|
|||||||
#define RF_POWER_CONTROL_VALID (0x00000500)
|
#define RF_POWER_CONTROL_VALID (0x00000500)
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/*
|
||||||
Output control
|
* Output control
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define IQOUTPUT_BASE (0x240)
|
#define IQOUTPUT_BASE (0x240)
|
||||||
#define IQOUTPUT_CONTROL (IQOUTPUT_BASE + 0x00)
|
#define IQOUTPUT_CONTROL (IQOUTPUT_BASE + 0x00)
|
||||||
@ -581,7 +583,7 @@
|
|||||||
|
|
||||||
// Additional Status Bits
|
// Additional Status Bits
|
||||||
|
|
||||||
#define DMA_PCIE_LANES_MASK ( 0x00070000 )
|
#define DMA_PCIE_LANES_MASK (0x00070000)
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -619,7 +621,7 @@
|
|||||||
#define SDR_FIR_SELECT_MASK (0x00C00000)
|
#define SDR_FIR_SELECT_MASK (0x00C00000)
|
||||||
#define SDR_VSB_LENGTH_MASK (0x01000000)
|
#define SDR_VSB_LENGTH_MASK (0x01000000)
|
||||||
|
|
||||||
#define SDR_SET_FIR(select,tap,coeff,vsblen) \
|
#define SDR_SET_FIR(select, tap, coeff, vsblen) \
|
||||||
((((select)<<22)&SDR_FIR_SELECT_MASK)| \
|
((((select)<<22)&SDR_FIR_SELECT_MASK)| \
|
||||||
(((tap)<<16)&SDR_FIR_TAP_MASK)| \
|
(((tap)<<16)&SDR_FIR_TAP_MASK)| \
|
||||||
((coeff)&SDR_FIR_COEFF_MASK)| \
|
((coeff)&SDR_FIR_COEFF_MASK)| \
|
||||||
|
@ -129,7 +129,7 @@ static int __devinit ddb_irq_msi(struct ddb *dev, int nr)
|
|||||||
dev->msi);
|
dev->msi);
|
||||||
} else
|
} else
|
||||||
pr_info("DDBridge: MSI not available.\n");
|
pr_info("DDBridge: MSI not available.\n");
|
||||||
|
|
||||||
#else
|
#else
|
||||||
stat = pci_enable_msi_block(dev->pdev, nr);
|
stat = pci_enable_msi_block(dev->pdev, nr);
|
||||||
if (stat == 0) {
|
if (stat == 0) {
|
||||||
@ -139,7 +139,7 @@ static int __devinit ddb_irq_msi(struct ddb *dev, int nr)
|
|||||||
stat = pci_enable_msi(dev->pdev);
|
stat = pci_enable_msi(dev->pdev);
|
||||||
dev->msi = 1;
|
dev->msi = 1;
|
||||||
}
|
}
|
||||||
if (stat < 0)
|
if (stat < 0)
|
||||||
pr_info("DDBridge: MSI not available.\n");
|
pr_info("DDBridge: MSI not available.\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ static int __devinit ddb_irq_init2(struct ddb *dev)
|
|||||||
irq_flag, "ddbridge", (void *) dev);
|
irq_flag, "ddbridge", (void *) dev);
|
||||||
if (stat < 0)
|
if (stat < 0)
|
||||||
return stat;
|
return stat;
|
||||||
|
|
||||||
ddbwritel(dev, 0x0000ff7f, INTERRUPT_V2_CONTROL);
|
ddbwritel(dev, 0x0000ff7f, INTERRUPT_V2_CONTROL);
|
||||||
ddbwritel(dev, 0xffffffff, INTERRUPT_V2_ENABLE_1);
|
ddbwritel(dev, 0xffffffff, INTERRUPT_V2_ENABLE_1);
|
||||||
ddbwritel(dev, 0xffffffff, INTERRUPT_V2_ENABLE_2);
|
ddbwritel(dev, 0xffffffff, INTERRUPT_V2_ENABLE_2);
|
||||||
@ -181,15 +181,15 @@ static int __devinit ddb_irq_init2(struct ddb *dev)
|
|||||||
ddbwritel(dev, 0xffffffff, INTERRUPT_V2_ENABLE_7);
|
ddbwritel(dev, 0xffffffff, INTERRUPT_V2_ENABLE_7);
|
||||||
return stat;
|
return stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __devinit ddb_irq_init(struct ddb *dev)
|
static int __devinit ddb_irq_init(struct ddb *dev)
|
||||||
{
|
{
|
||||||
int stat;
|
int stat;
|
||||||
int irq_flag = IRQF_SHARED;
|
int irq_flag = IRQF_SHARED;
|
||||||
|
|
||||||
if (dev->link[0].info->regmap->irq_version == 2)
|
if (dev->link[0].info->regmap->irq_version == 2)
|
||||||
return ddb_irq_init2(dev);
|
return ddb_irq_init2(dev);
|
||||||
|
|
||||||
ddbwritel(dev, 0x00000000, INTERRUPT_ENABLE);
|
ddbwritel(dev, 0x00000000, INTERRUPT_ENABLE);
|
||||||
ddbwritel(dev, 0x00000000, MSI1_ENABLE);
|
ddbwritel(dev, 0x00000000, MSI1_ENABLE);
|
||||||
ddbwritel(dev, 0x00000000, MSI2_ENABLE);
|
ddbwritel(dev, 0x00000000, MSI2_ENABLE);
|
||||||
@ -254,7 +254,7 @@ static int __devinit ddb_probe(struct pci_dev *pdev,
|
|||||||
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))
|
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))
|
||||||
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))
|
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
dev = vzalloc(sizeof(struct ddb));
|
dev = vzalloc(sizeof(struct ddb));
|
||||||
if (dev == NULL)
|
if (dev == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -315,7 +315,7 @@ static int __devinit ddb_probe(struct pci_dev *pdev,
|
|||||||
stat = ddb_irq_init(dev);
|
stat = ddb_irq_init(dev);
|
||||||
if (stat < 0)
|
if (stat < 0)
|
||||||
goto fail0;
|
goto fail0;
|
||||||
|
|
||||||
if (ddb_init(dev) == 0)
|
if (ddb_init(dev) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ struct ddb_regmap {
|
|||||||
|
|
||||||
struct ddb_regset *input;
|
struct ddb_regset *input;
|
||||||
struct ddb_regset *output;
|
struct ddb_regset *output;
|
||||||
|
|
||||||
struct ddb_regset *channel;
|
struct ddb_regset *channel;
|
||||||
//struct ddb_regset *ci;
|
//struct ddb_regset *ci;
|
||||||
//struct ddb_regset *pid_filter;
|
//struct ddb_regset *pid_filter;
|
||||||
@ -191,7 +191,8 @@ struct ddb_info {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* DMA_SIZE MUST be smaller than 256k and
|
/* DMA_SIZE MUST be smaller than 256k and
|
||||||
MUST be divisible by 188 and 128 !!! */
|
* MUST be divisible by 188 and 128 !!!
|
||||||
|
*/
|
||||||
|
|
||||||
#define DMA_MAX_BUFS 32 /* hardware table limit */
|
#define DMA_MAX_BUFS 32 /* hardware table limit */
|
||||||
|
|
||||||
@ -364,11 +365,11 @@ struct ddb_mod {
|
|||||||
struct ddb_port *port;
|
struct ddb_port *port;
|
||||||
//u32 nr;
|
//u32 nr;
|
||||||
//u32 regs;
|
//u32 regs;
|
||||||
|
|
||||||
u32 frequency;
|
u32 frequency;
|
||||||
u32 modulation;
|
u32 modulation;
|
||||||
u32 symbolrate;
|
u32 symbolrate;
|
||||||
|
|
||||||
u64 obitrate;
|
u64 obitrate;
|
||||||
u64 ibitrate;
|
u64 ibitrate;
|
||||||
u32 pcr_correction;
|
u32 pcr_correction;
|
||||||
|
Loading…
Reference in New Issue
Block a user