tuner_e4k: add setting for common mode
This commit is contained in:
parent
6d95768e9c
commit
463a3f9c28
|
@ -191,6 +191,7 @@ struct e4k_state {
|
|||
int e4k_init(struct e4k_state *e4k);
|
||||
int e4k_if_gain_set(struct e4k_state *e4k, uint8_t stage, int8_t value);
|
||||
int e4k_mixer_gain_set(struct e4k_state *e4k, int8_t value);
|
||||
int e4k_commonmode_set(struct e4k_state *e4k, int8_t value);
|
||||
int e4k_tune_freq(struct e4k_state *e4k, uint32_t freq);
|
||||
int e4k_tune_params(struct e4k_state *e4k, struct e4k_pll_params *p);
|
||||
int e4k_compute_pll_params(struct e4k_pll_params *oscp, uint32_t fosc, uint32_t intended_flo);
|
||||
|
|
|
@ -295,6 +295,24 @@ static int cmd_tuner_dco_table(struct cmd_state *cs, enum cmd_op op,
|
|||
return e4k_dc_offset_gen_table(&e4k);
|
||||
}
|
||||
|
||||
static int cmd_tuner_commonmode(struct cmd_state *cs, enum cmd_op op,
|
||||
const char *cmd, int argc, char **argv)
|
||||
{
|
||||
int32_t cm;
|
||||
|
||||
switch (op) {
|
||||
case CMD_OP_SET:
|
||||
if (argc < 1)
|
||||
return -EINVAL;
|
||||
cm = strtoul(argv[0], NULL, 10);
|
||||
e4k_commonmode_set(&e4k, cm);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct cmd cmds[] = {
|
||||
{ "tuner.init", CMD_OP_EXEC, cmd_tuner_init,
|
||||
"Initialize the tuner" },
|
||||
|
@ -312,6 +330,8 @@ static struct cmd cmds[] = {
|
|||
"Perform DC offset calibration" },
|
||||
{ "tuner.dc_table", CMD_OP_EXEC, cmd_tuner_dco_table,
|
||||
"Generate DC offset table" },
|
||||
{ "tuner.commonmode", CMD_OP_SET, cmd_tuner_commonmode,
|
||||
"Switch common mode voltage" },
|
||||
|
||||
{ "si570.freq", CMD_OP_SET|CMD_OP_GET, cmd_si570_freq,
|
||||
"Change the SI570 clock frequency" },
|
||||
|
|
|
@ -714,6 +714,16 @@ int e4k_mixer_gain_set(struct e4k_state *e4k, int8_t value)
|
|||
return e4k_reg_set_mask(e4k, E4K_REG_GAIN2, 1, bit);
|
||||
}
|
||||
|
||||
int e4k_commonmode_set(struct e4k_state *e4k, int8_t value)
|
||||
{
|
||||
if(value < 0)
|
||||
return -EINVAL;
|
||||
else if(value > 7)
|
||||
return -EINVAL;
|
||||
|
||||
return e4k_reg_set_mask(e4k, E4K_REG_DC7, 7, value);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DC Offset */
|
||||
|
||||
|
|
Reference in New Issue