#define dprintk(arg...)\ do { if (debug)\
printk(arg);\
} while (0)
/* Despite the name "hybrid_tuner", the framework works just as well for
hybrid demodulators as well... */ static LIST_HEAD(hybrid_tuner_instance_list); static DEFINE_MUTEX(au8522_list_mutex);
/* 16 bit registers, 8 bit values */ int au8522_writereg(struct au8522_state *state, u16 reg, u8 data)
{ int ret;
u8 buf[] = { (reg >> 8) | 0x80, reg & 0xff, data };
int au8522_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
{ struct au8522_state *state = fe->demodulator_priv;
dprintk("%s(%d)\n", __func__, enable);
if (state->operational_mode == AU8522_ANALOG_MODE) { /* We're being asked to manage the gate even though we're notindigitalmode.Thiscanoccurifwegetswitched overtoanalogmodebeforethedvb_frontendkernelthread
has completely shutdown */ return0;
}
/* Reset the demod hardware and reset all of the configuration registers
to a default state. */ int au8522_get_state(struct au8522_state **state, struct i2c_adapter *i2c,
u8 client_address)
{ int ret;
/* bail out if we can't control an LED */ if (!led_config || !led_config->gpio_output ||
!led_config->gpio_output_enable || !led_config->gpio_output_disable) return0;
val = au8522_readreg(state, 0x4000 |
(led_config->gpio_output & ~0xc000)); if (onoff) { /* enable GPIO output */
val &= ~((led_config->gpio_output_enable >> 8) & 0xff);
val |= (led_config->gpio_output_enable & 0xff);
} else { /* disable GPIO output */
val &= ~((led_config->gpio_output_disable >> 8) & 0xff);
val |= (led_config->gpio_output_disable & 0xff);
} return au8522_writereg(state, 0x8000 |
(led_config->gpio_output & ~0xc000), val);
}
/* led = 0 | off *led=1|signalok *led=2|signalstrong *led<0|onlylightledifledsarecurrentlyoff
*/ int au8522_led_ctrl(struct au8522_state *state, int led)
{ struct au8522_led_config *led_config = state->config.led_cfg; int i, ret = 0;
/* bail out if we can't control an LED */ if (!led_config || !led_config->gpio_leds ||
!led_config->num_led_states || !led_config->led_states) return0;
if (led < 0) { /* if LED is already lit, then leave it as-is */ if (state->led_state) return0; else
led *= -1;
}
/* toggle LED if changing state */ if (state->led_state != led) {
u8 val;
dprintk("%s: %d\n", __func__, led);
au8522_led_gpio_enable(state, 1);
val = au8522_readreg(state, 0x4000 |
(led_config->gpio_leds & ~0xc000));
/* start with all leds off */ for (i = 0; i < led_config->num_led_states; i++)
val &= ~led_config->led_states[i];
/* set selected LED state */ if (led < led_config->num_led_states)
val |= led_config->led_states[led]; elseif (led_config->num_led_states)
val |=
led_config->led_states[led_config->num_led_states - 1];
ret = au8522_writereg(state, 0x8000 |
(led_config->gpio_leds & ~0xc000), val); if (ret < 0) return ret;
/* Clear out any state associated with the digital side of the chip,sothatwhenitgetspoweredbackupitwon'tthink
that it is already tuned */
state->current_frequency = 0;
state->current_modulation = VSB_8;
/* Only power down if the digital side is currently using the chip */ if (state->operational_mode == AU8522_ANALOG_MODE) { /* We're not in one of the expected power modes, which means thattheDVBthreadisprobablytellingustogotosleep eventhoughtheanalogfrontendhasalreadystartedusing
the chip. So ignore the request */ return0;
}
/* turn off led */
au8522_led_ctrl(state, 0);
/* Power down the chip */
au8522_writereg(state, 0xa4, 1 << 5);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.