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:
none 2021-06-23 16:30:26 +02:00
commit ccc13aed48
3 changed files with 87 additions and 21 deletions

View File

@ -35,10 +35,10 @@ void print_temp(struct mci_result *res)
printf("Die temperature = %u\n", res->sx8_bist.temperature); printf("Die temperature = %u\n", res->sx8_bist.temperature);
} }
int temp_info(int dev) int temp_info(int dev, uint32_t link)
{ {
struct ddb_mci_msg msg = { struct ddb_mci_msg msg = {
.link = 0, .link = link,
.cmd.command = SX8_CMD_GETBIST, .cmd.command = SX8_CMD_GETBIST,
}; };
int ret; int ret;
@ -233,23 +233,36 @@ void print_info(struct mci_result *res, uint8_t demod)
switch (res->mode) { switch (res->mode) {
case M4_MODE_DVBSX: case M4_MODE_DVBSX:
if (res->dvbs2_signal_info.standard == 2) { if (res->dvbs2_signal_info.standard == 2) {
int short_frame = 0; int short_frame = 0, pilots = 0;
char *modcod = "unknown";
uint8_t pls = res->dvbs2_signal_info.pls_code;
if ((res->dvbs2_signal_info.pls_code >= 128) || if ((pls >= 128) || ((res->dvbs2_signal_info.roll_off & 0x7f) > 2))
((res->dvbs2_signal_info.roll_off & 0x7f) > 2))
printf("Demod Locked: DVB-S2X\n"); printf("Demod Locked: DVB-S2X\n");
else else
printf("Demod Locked: DVB-S2\n"); printf("Demod Locked: DVB-S2\n");
printf("PLS-Code: %u\n", res->dvbs2_signal_info.pls_code); printf("PLS-Code: %u\n", res->dvbs2_signal_info.pls_code);
printf("Roll-Off: %s\n", Rolloff[res->dvbs2_signal_info.roll_off]); if (pls >= 250) {
printf("Inversion: %s\n", (res->dvbs2_signal_info.roll_off & 0x80) ? "on": "off"); pilots = 1;
printf("\n"); modcod = S2Xrsvd[pls - 250];
} else if (pls >= 132) {
pilots = pls & 1;
short_frame = pls > 216;
modcod = S2XModCods[(pls - 132)/2];
} else if (pls < 128) {
pilots = pls & 1;
short_frame = pls & 2;
modcod = S2ModCods[pls / 4];
}
printf("Roll-Off: %s\n", Rolloff[res->dvbs2_signal_info.roll_off & 7]);
printf("Pilots: %s\n", pilots ? "On" : "Off");
printf("Frame: %s\n", short_frame ? "Short" : "Long");
} else { } else {
printf("Demod Locked: DVB-S\n"); printf("Demod Locked: DVB-S\n");
printf("PR: %s\n", printf("PR: %s\n",
PunctureRates[res->dvbs2_signal_info.pls_code & 0x07]); PunctureRates[res->dvbs2_signal_info.pls_code & 0x07]);
} }
printf("Inversion: %s\n", (res->dvbs2_signal_info.roll_off & 0x80) ? "on": "off");
case M4_MODE_DVBT: case M4_MODE_DVBT:
printf("Locked DVB-T\n"); printf("Locked DVB-T\n");
break; break;
@ -274,10 +287,37 @@ void print_info(struct mci_result *res, uint8_t demod)
} }
int mci_info(int dev, uint8_t demod) int readreg(int dev, uint32_t reg, uint32_t link, uint32_t *val)
{
struct ddb_reg ddbreg;
ddbreg.reg = reg + (link << 28);
if (ioctl(dev, IOCTL_DDB_READ_REG, &ddbreg) < 0)
return -1;
*val = ddbreg.val;
return 0;
}
void mci_firmware(int dev, uint32_t link)
{
union {
uint32_t u[4];
char s[16];
} version;
readreg(dev, MIC_INTERFACE_VER , link, &version.u[0]);
readreg(dev, MIC_INTERFACE_VER + 4, link, &version.u[1]);
readreg(dev, MIC_INTERFACE_VER + 8, link, &version.u[2]);
readreg(dev, MIC_INTERFACE_VER + 12, link, &version.u[3]);
printf("MCI firmware: %s.%d\n", &version.s, version.s[15]);
}
int mci_info(int dev, uint32_t link, uint8_t demod)
{ {
struct ddb_mci_msg msg = { struct ddb_mci_msg msg = {
.link = 0, .link = link,
.cmd.command = MCI_CMD_GETSIGNALINFO, .cmd.command = MCI_CMD_GETSIGNALINFO,
.cmd.demod = demod .cmd.demod = demod
}; };
@ -380,20 +420,22 @@ static int card_info(int ddbnum, int demod)
id.hw, id.regmap, (id.hw & 0xff0000) >> 16, (id.hw & 0xffff)); id.hw, id.regmap, (id.hw & 0xff0000) >> 16, (id.hw & 0xffff));
switch (id.device) { switch (id.device) {
case 0x0009: case 0x0009:
mci_firmware(ddb, link);
if (demod >= 0) if (demod >= 0)
mci_info(ddb, demod); mci_info(ddb, link, demod);
else { else {
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
mci_info(ddb, i); mci_info(ddb, link, i);
} }
temp_info(ddb); temp_info(ddb, link);
break; break;
case 0x000a: case 0x000a:
mci_firmware(ddb, link);
if (demod >= 0) if (demod >= 0)
mci_info(ddb, demod); mci_info(ddb, link, demod);
else { else {
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
mci_info(ddb, i); mci_info(ddb, link, i);
} }
break; break;
default: default:

View File

@ -2602,7 +2602,7 @@ static int ddb_port_match_link_i2c(struct ddb_port *port)
static void ddb_ports_init(struct ddb *dev) static void ddb_ports_init(struct ddb *dev)
{ {
u32 i, l, p; u32 i, l, p, ports;
struct ddb_port *port; struct ddb_port *port;
const struct ddb_info *info; const struct ddb_info *info;
const struct ddb_regmap *rm; const struct ddb_regmap *rm;
@ -2614,7 +2614,12 @@ static void ddb_ports_init(struct ddb *dev)
rm = info->regmap; rm = info->regmap;
if (!rm) if (!rm)
continue; continue;
for (i = 0; i < info->port_num; i++, p++) { ports = info->port_num;
if ((l == 0) && (dev->link[l].info->type == DDB_MOD) &&
(dev->link[0].ids.revision == 1)) {
ports = ddbreadl(dev, 0x260) >> 24;
}
for (i = 0; i < ports; i++, p++) {
port = &dev->port[p]; port = &dev->port[p];
port->dev = dev; port->dev = dev;
port->nr = i; port->nr = i;
@ -3266,8 +3271,8 @@ static long ddb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
ddbid.device = dev->link[0].ids.device; ddbid.device = dev->link[0].ids.device;
ddbid.subvendor = dev->link[0].ids.subvendor; ddbid.subvendor = dev->link[0].ids.subvendor;
ddbid.subdevice = dev->link[0].ids.subdevice; ddbid.subdevice = dev->link[0].ids.subdevice;
ddbid.hw = ddbreadl(dev, 0); ddbid.hw = dev->link[0].ids.hwid;
ddbid.regmap = ddbreadl(dev, 4); ddbid.regmap = dev->link[0].ids.regmapid;
if (copy_to_user(parg, &ddbid, sizeof(ddbid))) if (copy_to_user(parg, &ddbid, sizeof(ddbid)))
return -EFAULT; return -EFAULT;
break; break;

View File

@ -1863,6 +1863,8 @@ static int mod_init_2(struct ddb *dev, u32 Frequency)
dev_err(dev->dev, "FSM setup failed!\n"); dev_err(dev->dev, "FSM setup failed!\n");
return -1; return -1;
} }
if (dev->link[0].ids.revision == 1)
return 0;
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];
@ -2049,6 +2051,23 @@ static int mod_init_sdr_iq(struct ddb *dev)
int ddbridge_mod_init(struct ddb *dev) int ddbridge_mod_init(struct ddb *dev)
{ {
dev_info(dev->dev, "Revision: %u\n", dev->link[0].ids.revision);
if (dev->link[0].ids.revision == 1) {
switch (dev->link[0].info->version) {
case 0:
case 1:
return mod_init_1(dev, 722000000);
case 2: /* FSM */
return mod_init_2(dev, 114000000);
case 16: /* PAL */
return mod_init_3(dev, 503250000);
case 17: /* raw IQ */
case 18: /* IQ+FFT */
return mod_init_sdr_iq(dev);
default:
return -1;
}
}
switch (dev->link[0].info->version) { switch (dev->link[0].info->version) {
case 0: case 0:
case 1: case 1: