1
0
mirror of https://github.com/DigitalDevices/dddvb.git synced 2023-10-10 13:37:43 +02:00

Merge branch 'internal'

This commit is contained in:
internal 2022-12-13 14:18:04 +01:00
commit 979cb7a237
4 changed files with 86 additions and 22 deletions

View File

@ -626,12 +626,14 @@ static void ddb_input_stop_unlocked(struct ddb_input *input)
input->dma->running = 0; input->dma->running = 0;
if (input->dma->stall_count) if (input->dma->stall_count)
dev_warn(input->port->dev->dev, dev_warn(input->port->dev->dev,
"DMA stalled %u times!\n", "l%ui%u: DMA stalled %u times!\n",
input->port->lnr, input->nr,
input->dma->stall_count); input->dma->stall_count);
update_loss(input->dma); update_loss(input->dma);
if (input->dma->packet_loss > 1) if (input->dma->packet_loss > 1)
dev_warn(input->port->dev->dev, dev_warn(input->port->dev->dev,
"%u packets lost due to low DMA performance!\n", "l%ui%u: %u packets lost due to low DMA performance!\n",
input->port->lnr, input->nr,
input->dma->packet_loss); input->dma->packet_loss);
} }
} }
@ -1122,13 +1124,19 @@ static void dummy_release(struct dvb_frontend *fe)
kfree(fe); kfree(fe);
} }
static enum dvbfe_algo dummy_algo(struct dvb_frontend *fe)
{
return DVBFE_ALGO_HW;
}
static struct dvb_frontend_ops dummy_ops = { static struct dvb_frontend_ops dummy_ops = {
.delsys = { SYS_DVBC_ANNEX_A, SYS_DVBS, SYS_DVBS2 }, .delsys = { SYS_DVBC_ANNEX_A },
.info = { .info = {
.name = "DUMMY DVB-C/C2 DVB-T/T2", .name = "DUMMY DVB-C",
.frequency_stepsize_hz = 166667, /* DVB-T only */ .frequency_stepsize_hz = 0,
.frequency_min_hz = 47000000, /* DVB-T: 47125000 */ .frequency_tolerance_hz = 0,
.frequency_max_hz = 865000000, /* DVB-C: 862000000 */ .frequency_min_hz = 47000000,
.frequency_max_hz = 865000000,
.symbol_rate_min = 870000, .symbol_rate_min = 870000,
.symbol_rate_max = 11700000, .symbol_rate_max = 11700000,
.caps = FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_32 | .caps = FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_32 |
@ -1141,6 +1149,7 @@ static struct dvb_frontend_ops dummy_ops = {
FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO | FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO |
FE_CAN_RECOVER | FE_CAN_MUTE_TS | FE_CAN_2G_MODULATION FE_CAN_RECOVER | FE_CAN_MUTE_TS | FE_CAN_2G_MODULATION
}, },
.get_frontend_algo = dummy_algo,
.release = dummy_release, .release = dummy_release,
.read_status = dummy_read_status, .read_status = dummy_read_status,
}; };

View File

@ -134,6 +134,8 @@ int ddb_mci_cmd_link(struct ddb_link *link,
struct mci_result res; struct mci_result res;
int stat; int stat;
if (!link->mci_ok)
return -EFAULT;
if (!result) if (!result)
result = &res; result = &res;
mutex_lock(&link->mci_lock); mutex_lock(&link->mci_lock);
@ -294,6 +296,8 @@ void ddb_mci_proc_info(struct mci *mci, struct dtv_frontend_properties *p)
p->frequency = p->frequency =
mci->signal_info.dvbs2_signal_info.frequency; mci->signal_info.dvbs2_signal_info.frequency;
p->symbol_rate =
mci->signal_info.dvbs2_signal_info.symbol_rate;
switch (p->delivery_system) { switch (p->delivery_system) {
default: default:
case SYS_DVBS: case SYS_DVBS:
@ -303,8 +307,6 @@ void ddb_mci_proc_info(struct mci *mci, struct dtv_frontend_properties *p)
mci->signal_info.dvbs2_signal_info.pls_code; mci->signal_info.dvbs2_signal_info.pls_code;
p->frequency = p->frequency =
mci->signal_info.dvbs2_signal_info.frequency / 1000; mci->signal_info.dvbs2_signal_info.frequency / 1000;
p->symbol_rate =
mci->signal_info.dvbs2_signal_info.symbol_rate;
p->delivery_system = p->delivery_system =
(mci->signal_info.dvbs2_signal_info.standard == 2) ? (mci->signal_info.dvbs2_signal_info.standard == 2) ?
SYS_DVBS2 : SYS_DVBS; SYS_DVBS2 : SYS_DVBS;
@ -340,6 +342,8 @@ void ddb_mci_proc_info(struct mci *mci, struct dtv_frontend_properties *p)
break; break;
} }
case SYS_DVBC_ANNEX_A: case SYS_DVBC_ANNEX_A:
p->modulation =
mci->signal_info.dvbc_signal_info.constellation + 1;
break; break;
case SYS_DVBT: case SYS_DVBT:
break; break;

View File

@ -195,6 +195,48 @@ static int mod_calc_obitrate(struct ddb_mod *mod)
return 0; return 0;
} }
static int mod_set_stream(struct ddb_output *output)
{
struct ddb *dev = output->port->dev;
u32 stream = output->nr;
struct ddb_mod *mod = &dev->mod[output->nr];
struct ddb_link *link = &dev->link[0];
struct mci_result res;
u32 channel;
struct mci_command cmd = {
.mod_command = MOD_SETUP_STREAM,
.mod_channel = stream,
.mod_stream = stream,
.mod_setup_stream = {
.standard = MOD_STANDARD_DVBC_8,
.symbol_rate = mod->symbolrate,
.qam = {
.modulation = mod->modulation - 1,
.rolloff = 13,
}
},
};
if (dev->link[0].info->version != 2)
return 0;
if (dev->link[0].ids.revision != 1)
return 0;
if ((dev->link[0].ids.hwid & 0xffffff) < 9065)
return 0;
if (!mod->frequency && !mod->symbolrate && !mod->modulation)
return 0;
if (mod->frequency)
channel = (mod->frequency - 114000000) / 8000000;
if (!mod->symbolrate)
mod->symbolrate = 6900000;
if (!mod->modulation)
mod->modulation = 5;
cmd.mod_channel = channel;
cmd.mod_setup_stream.symbol_rate = mod->symbolrate;
cmd.mod_setup_stream.qam.modulation = mod->modulation - 1;
return ddb_mci_cmd_link(link, &cmd, &res);
}
static int mod_set_symbolrate(struct ddb_mod *mod, u32 srate) static int mod_set_symbolrate(struct ddb_mod *mod, u32 srate)
{ {
struct ddb *dev = mod->port->dev; struct ddb *dev = mod->port->dev;
@ -210,6 +252,7 @@ static int mod_set_symbolrate(struct ddb_mod *mod, u32 srate)
} }
mod->symbolrate = srate; mod->symbolrate = srate;
mod_calc_obitrate(mod); mod_calc_obitrate(mod);
mod_set_stream(mod->port->output);
return 0; return 0;
} }
@ -227,6 +270,7 @@ static int mod_set_modulation(struct ddb_mod *mod,
ddbwritel(dev, qamtab[modulation], ddbwritel(dev, qamtab[modulation],
CHANNEL_SETTINGS(mod->port->nr)); CHANNEL_SETTINGS(mod->port->nr));
mod_calc_obitrate(mod); mod_calc_obitrate(mod);
mod_set_stream(mod->port->output);
return 0; return 0;
} }
@ -241,6 +285,7 @@ static int mod_set_frequency(struct ddb_mod *mod, u32 frequency)
if ((freq < 114) || (freq > 874)) if ((freq < 114) || (freq > 874))
return -EINVAL; return -EINVAL;
mod->frequency = frequency; mod->frequency = frequency;
mod_set_stream(mod->port->output);
return 0; return 0;
} }
@ -330,13 +375,19 @@ int ddbridge_mod_output_start(struct ddb_output *output)
u32 LF = 9000000UL; u32 LF = 9000000UL;
u32 d = gcd(KF, LF); u32 d = gcd(KF, LF);
u32 checkLF; u32 checkLF;
#if 0
if (dev->link[0].ids.revision == 1) { if ((dev->link[0].ids.revision == 1)) {
mod->Control |= CHANNEL_CONTROL_ENABLE_DVB; if ((dev->link[0].info->version == 2)) {
return -EINVAL; if ((dev->link[0].ids.hwid & 0xffffff) >= 9065) {
break; mod->Control |= CHANNEL_CONTROL_ENABLE_DVB;
break;
}
} else {
mod->Control |= CHANNEL_CONTROL_ENABLE_DVB;
break;
}
} }
#endif
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));
@ -1909,7 +1960,6 @@ int ddbridge_mod_do_ioctl(struct file *file, unsigned int cmd, void *parg)
return ret; return ret;
} }
#if 0
static int mod_init_2_1(struct ddb *dev, u32 Frequency) static int mod_init_2_1(struct ddb *dev, u32 Frequency)
{ {
int i, streams = dev->link[0].info->port_num; int i, streams = dev->link[0].info->port_num;
@ -1921,7 +1971,6 @@ static int mod_init_2_1(struct ddb *dev, u32 Frequency)
} }
return 0; return 0;
} }
#endif
static int mod_init_2(struct ddb *dev, u32 Frequency) static int mod_init_2(struct ddb *dev, u32 Frequency)
{ {
@ -2127,6 +2176,8 @@ int ddbridge_mod_init(struct ddb *dev)
case 1: case 1:
return mod_init_1(dev, 722000000); return mod_init_1(dev, 722000000);
case 2: /* FSM */ case 2: /* FSM */
if ((dev->link[0].ids.hwid & 0xffffff) >= 9065)
return mod_init_2_1(dev, 114000000);
return mod_init_2(dev, 114000000); return mod_init_2(dev, 114000000);
case 16: /* PAL */ case 16: /* PAL */
return mod_init_3(dev, 503250000); return mod_init_3(dev, 503250000);

View File

@ -329,7 +329,7 @@ static void calc_lq(struct dddvb_fe *fe)
{ {
struct dtv_fe_stats st; struct dtv_fe_stats st;
int64_t str, snr; int64_t str, snr;
uint32_t mod, fec, ber_num, ber_den, trans, pilot = 0, quality = 0, freq; uint32_t mod, fec, ber_num, ber_den, trans, pilot = 0, quality = 0, freq, rate;
get_property(fe->fd, DTV_TRANSMISSION_MODE, &fe->pls_code); get_property(fe->fd, DTV_TRANSMISSION_MODE, &fe->pls_code);
dbgprintf(DEBUG_DVB, "fe%d: pls=0x%02x\n", fe->nr, fe->pls_code); dbgprintf(DEBUG_DVB, "fe%d: pls=0x%02x\n", fe->nr, fe->pls_code);
@ -362,15 +362,15 @@ static void calc_lq(struct dddvb_fe *fe)
dbgprintf(DEBUG_DVB, "fe%d: snr=%lld ber=%llu/%llu\n", dbgprintf(DEBUG_DVB, "fe%d: snr=%lld ber=%llu/%llu\n",
fe->nr, snr, ber_num, ber_den); fe->nr, snr, ber_num, ber_den);
dbgprintf(DEBUG_DVB, "fe%d: fec=%u mod=%u\n", fe->nr, fec, mod); dbgprintf(DEBUG_DVB, "fe%d: fec=%u mod=%u\n", fe->nr, fec, mod);
get_property(fe->fd, DTV_FREQUENCY, &freq);
dbgprintf(DEBUG_DVB, "fe%d: actual frequency=%u\n", fe->nr, freq);
get_property(fe->fd, DTV_SYMBOL_RATE, &rate);
dbgprintf(DEBUG_DVB, "fe%d: actual symbol rate=%u\n", fe->nr, rate);
switch (fe->n_param.param[PARAM_MSYS]) { switch (fe->n_param.param[PARAM_MSYS]) {
case SYS_DVBS: case SYS_DVBS:
get_property(fe->fd, DTV_FREQUENCY, &freq);
dbgprintf(DEBUG_DVB, "fe%d: actual frequency=%u\n", fe->nr, freq);
quality = dvbsq(snr, fec, ber_num, ber_den); quality = dvbsq(snr, fec, ber_num, ber_den);
break; break;
case SYS_DVBS2: case SYS_DVBS2:
get_property(fe->fd, DTV_FREQUENCY, &freq);
dbgprintf(DEBUG_DVB, "fe%d: actual frequency=%u\n", fe->nr, freq);
quality = dvbs2q(snr, fec, mod, ber_num, ber_den); quality = dvbs2q(snr, fec, mod, ber_num, ber_den);
break; break;
case SYS_DVBC_ANNEX_A: case SYS_DVBC_ANNEX_A: