Lines Matching +full:led +full:- +full:8
2 Auvitek AU8522 QAM/8VSB demodulator driver
6 Copyright (C) 2005-2008 Auvitek International, Ltd.
41 /* 16 bit registers, 8 bit values */
45 u8 buf[] = { (reg >> 8) | 0x80, reg & 0xff, data }; in au8522_writereg()
47 struct i2c_msg msg = { .addr = state->config.demod_address, in au8522_writereg()
50 ret = i2c_transfer(state->i2c, &msg, 1); in au8522_writereg()
56 return (ret != 1) ? -1 : 0; in au8522_writereg()
63 u8 b0[] = { (reg >> 8) | 0x40, reg & 0xff }; in au8522_readreg()
67 { .addr = state->config.demod_address, .flags = 0, in au8522_readreg()
69 { .addr = state->config.demod_address, .flags = I2C_M_RD, in au8522_readreg()
72 ret = i2c_transfer(state->i2c, msg, 2); in au8522_readreg()
83 struct au8522_state *state = fe->demodulator_priv; in au8522_i2c_gate_ctrl()
87 if (state->operational_mode == AU8522_ANALOG_MODE) { in au8522_i2c_gate_ctrl()
104 struct au8522_state *state = fe->demodulator_priv; in au8522_analog_i2c_gate_ctrl()
143 struct au8522_led_config *led_config = state->config.led_cfg; in au8522_led_gpio_enable()
146 /* bail out if we can't control an LED */ in au8522_led_gpio_enable()
147 if (!led_config || !led_config->gpio_output || in au8522_led_gpio_enable()
148 !led_config->gpio_output_enable || !led_config->gpio_output_disable) in au8522_led_gpio_enable()
152 (led_config->gpio_output & ~0xc000)); in au8522_led_gpio_enable()
155 val &= ~((led_config->gpio_output_enable >> 8) & 0xff); in au8522_led_gpio_enable()
156 val |= (led_config->gpio_output_enable & 0xff); in au8522_led_gpio_enable()
159 val &= ~((led_config->gpio_output_disable >> 8) & 0xff); in au8522_led_gpio_enable()
160 val |= (led_config->gpio_output_disable & 0xff); in au8522_led_gpio_enable()
163 (led_config->gpio_output & ~0xc000), val); in au8522_led_gpio_enable()
166 /* led = 0 | off
167 * led = 1 | signal ok
168 * led = 2 | signal strong
169 * led < 0 | only light led if leds are currently off
171 int au8522_led_ctrl(struct au8522_state *state, int led) in au8522_led_ctrl() argument
173 struct au8522_led_config *led_config = state->config.led_cfg; in au8522_led_ctrl()
176 /* bail out if we can't control an LED */ in au8522_led_ctrl()
177 if (!led_config || !led_config->gpio_leds || in au8522_led_ctrl()
178 !led_config->num_led_states || !led_config->led_states) in au8522_led_ctrl()
181 if (led < 0) { in au8522_led_ctrl()
182 /* if LED is already lit, then leave it as-is */ in au8522_led_ctrl()
183 if (state->led_state) in au8522_led_ctrl()
186 led *= -1; in au8522_led_ctrl()
189 /* toggle LED if changing state */ in au8522_led_ctrl()
190 if (state->led_state != led) { in au8522_led_ctrl()
193 dprintk("%s: %d\n", __func__, led); in au8522_led_ctrl()
198 (led_config->gpio_leds & ~0xc000)); in au8522_led_ctrl()
201 for (i = 0; i < led_config->num_led_states; i++) in au8522_led_ctrl()
202 val &= ~led_config->led_states[i]; in au8522_led_ctrl()
204 /* set selected LED state */ in au8522_led_ctrl()
205 if (led < led_config->num_led_states) in au8522_led_ctrl()
206 val |= led_config->led_states[led]; in au8522_led_ctrl()
207 else if (led_config->num_led_states) in au8522_led_ctrl()
209 led_config->led_states[led_config->num_led_states - 1]; in au8522_led_ctrl()
212 (led_config->gpio_leds & ~0xc000), val); in au8522_led_ctrl()
216 state->led_state = led; in au8522_led_ctrl()
218 if (led == 0) in au8522_led_ctrl()
228 struct au8522_state *state = fe->demodulator_priv; in au8522_init()
231 state->operational_mode = AU8522_DIGITAL_MODE; in au8522_init()
236 state->current_frequency = 0; in au8522_init()
237 state->current_modulation = VSB_8; in au8522_init()
249 struct au8522_state *state = fe->demodulator_priv; in au8522_sleep()
253 if (state->operational_mode == AU8522_ANALOG_MODE) { in au8522_sleep()
261 /* turn off led */ in au8522_sleep()
267 state->current_frequency = 0; in au8522_sleep()
276 MODULE_DESCRIPTION("Auvitek AU8522 QAM-B/ATSC Demodulator driver");