mirror of
https://github.com/DigitalDevices/dddvb.git
synced 2025-03-01 10:35:23 +00:00
Merge branch 'internal'
This commit is contained in:
commit
adaeb94a54
@ -574,10 +574,37 @@ static int mod_fsm_setup(struct ddb *dev, u32 MaxUsedChannels)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mod_set_power(struct ddb *dev)
|
||||||
|
{
|
||||||
|
struct ddb_link *link = &dev->link[0];
|
||||||
|
struct mod_base *base = &dev->mod_base;
|
||||||
|
struct mci_result res;
|
||||||
|
struct mci_command cmd = {
|
||||||
|
.mod_command = MOD_SETUP_OUTPUT,
|
||||||
|
.mod_channel = 0,
|
||||||
|
.mod_stream = 0,
|
||||||
|
.mod_setup_output = {
|
||||||
|
.connector = MOD_CONNECTOR_F,
|
||||||
|
.num_channels = dev->link[0].info->port_num,
|
||||||
|
.unit = MOD_UNIT_DBUV,
|
||||||
|
.channel_power = 9000,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
if (!link->mci_ok)
|
||||||
|
return -EFAULT;
|
||||||
|
cmd.mod_setup_output.channel_power =
|
||||||
|
8232 - base->attenuation * 1000 + base->gain * 12;
|
||||||
|
return ddb_mci_cmd_link(link, &cmd, &res);
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
if (dev->link[0].ids.revision == 1) {
|
||||||
|
dev->mod_base.gain = gain;
|
||||||
|
return mod_set_power(dev);
|
||||||
|
}
|
||||||
ddbwritel(dev, gain, RF_VGA);
|
ddbwritel(dev, gain, RF_VGA);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -686,23 +713,8 @@ static int mod_set_attenuator(struct ddb *dev, u32 Value)
|
|||||||
if (Value > 31)
|
if (Value > 31)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (dev->link[0].ids.revision == 1) {
|
if (dev->link[0].ids.revision == 1) {
|
||||||
struct ddb_link *link = &dev->link[0];
|
dev->mod_base.attenuation = Value;
|
||||||
struct mci_result res;
|
return mod_set_power(dev);
|
||||||
struct mci_command cmd = {
|
|
||||||
.mod_command = MOD_SETUP_OUTPUT,
|
|
||||||
.mod_channel = 0,
|
|
||||||
.mod_stream = 0,
|
|
||||||
.mod_setup_output = {
|
|
||||||
.connector = MOD_CONNECTOR_F,
|
|
||||||
.num_channels = dev->link[0].info->port_num,
|
|
||||||
.unit = MOD_UNIT_DBUV,
|
|
||||||
.channel_power = 9000 - Value * 100,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
if (!link->mci_ok) {
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
return ddb_mci_cmd_link(link, &cmd, &res);
|
|
||||||
} else
|
} else
|
||||||
ddbwritel(dev, Value, RF_ATTENUATOR);
|
ddbwritel(dev, Value, RF_ATTENUATOR);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1937,9 +1949,10 @@ int ddbridge_mod_do_ioctl(struct file *file, unsigned int cmd, void *parg)
|
|||||||
(struct ddb_mci_msg __user *) parg;
|
(struct ddb_mci_msg __user *) parg;
|
||||||
struct ddb_link *link;
|
struct ddb_link *link;
|
||||||
|
|
||||||
if (dev->link[0].ids.revision != 1)
|
if (dev->link[0].ids.revision != 1) {
|
||||||
|
ret = -EINVAL;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if (msg->link > 3) {
|
if (msg->link > 3) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
break;
|
break;
|
||||||
@ -1965,6 +1978,10 @@ 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;
|
||||||
|
|
||||||
dev->mod_base.frequency = Frequency;
|
dev->mod_base.frequency = Frequency;
|
||||||
|
dev->mod_base.gain = 64;
|
||||||
|
dev->mod_base.attenuation = 0;
|
||||||
|
mod_set_power(dev);
|
||||||
|
|
||||||
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];
|
||||||
@ -2164,6 +2181,7 @@ static int mod_init_sdr_iq(struct ddb *dev)
|
|||||||
mod_set_sdr_attenuator(dev, 0);
|
mod_set_sdr_attenuator(dev, 0);
|
||||||
udelay(10);
|
udelay(10);
|
||||||
mod_set_sdr_gain(dev, 120);
|
mod_set_sdr_gain(dev, 120);
|
||||||
|
ddb_mci_cmd_link_simple(&dev->link[0], 0xc0, 0x00, 90);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,6 +339,8 @@ struct mod_base {
|
|||||||
u32 frequency;
|
u32 frequency;
|
||||||
u32 flat_start;
|
u32 flat_start;
|
||||||
u32 flat_end;
|
u32 flat_end;
|
||||||
|
u32 attenuation;
|
||||||
|
u32 gain;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ddb_mod {
|
struct ddb_mod {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user