Lines Matching +full:led +full:- +full:8
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 Auvitek AU8522 QAM/8VSB demodulator driver
7 Copyright (C) 2005-2008 Auvitek International, Ltd.
29 /* 16 bit registers, 8 bit values */
33 u8 buf[] = { (reg >> 8) | 0x80, reg & 0xff, data }; in au8522_writereg()
35 struct i2c_msg msg = { .addr = state->config.demod_address, in au8522_writereg()
38 ret = i2c_transfer(state->i2c, &msg, 1); in au8522_writereg()
44 return (ret != 1) ? -1 : 0; in au8522_writereg()
51 u8 b0[] = { (reg >> 8) | 0x40, reg & 0xff }; in au8522_readreg()
55 { .addr = state->config.demod_address, .flags = 0, in au8522_readreg()
57 { .addr = state->config.demod_address, .flags = I2C_M_RD, in au8522_readreg()
60 ret = i2c_transfer(state->i2c, msg, 2); in au8522_readreg()
71 struct au8522_state *state = fe->demodulator_priv; in au8522_i2c_gate_ctrl()
75 if (state->operational_mode == AU8522_ANALOG_MODE) { in au8522_i2c_gate_ctrl()
92 struct au8522_state *state = fe->demodulator_priv; in au8522_analog_i2c_gate_ctrl()
131 struct au8522_led_config *led_config = state->config.led_cfg; in au8522_led_gpio_enable()
134 /* bail out if we can't control an LED */ in au8522_led_gpio_enable()
135 if (!led_config || !led_config->gpio_output || in au8522_led_gpio_enable()
136 !led_config->gpio_output_enable || !led_config->gpio_output_disable) in au8522_led_gpio_enable()
140 (led_config->gpio_output & ~0xc000)); in au8522_led_gpio_enable()
143 val &= ~((led_config->gpio_output_enable >> 8) & 0xff); in au8522_led_gpio_enable()
144 val |= (led_config->gpio_output_enable & 0xff); in au8522_led_gpio_enable()
147 val &= ~((led_config->gpio_output_disable >> 8) & 0xff); in au8522_led_gpio_enable()
148 val |= (led_config->gpio_output_disable & 0xff); in au8522_led_gpio_enable()
151 (led_config->gpio_output & ~0xc000), val); in au8522_led_gpio_enable()
154 /* led = 0 | off
155 * led = 1 | signal ok
156 * led = 2 | signal strong
157 * led < 0 | only light led if leds are currently off
159 int au8522_led_ctrl(struct au8522_state *state, int led) in au8522_led_ctrl() argument
161 struct au8522_led_config *led_config = state->config.led_cfg; in au8522_led_ctrl()
164 /* bail out if we can't control an LED */ in au8522_led_ctrl()
165 if (!led_config || !led_config->gpio_leds || in au8522_led_ctrl()
166 !led_config->num_led_states || !led_config->led_states) in au8522_led_ctrl()
169 if (led < 0) { in au8522_led_ctrl()
170 /* if LED is already lit, then leave it as-is */ in au8522_led_ctrl()
171 if (state->led_state) in au8522_led_ctrl()
174 led *= -1; in au8522_led_ctrl()
177 /* toggle LED if changing state */ in au8522_led_ctrl()
178 if (state->led_state != led) { in au8522_led_ctrl()
181 dprintk("%s: %d\n", __func__, led); in au8522_led_ctrl()
186 (led_config->gpio_leds & ~0xc000)); in au8522_led_ctrl()
189 for (i = 0; i < led_config->num_led_states; i++) in au8522_led_ctrl()
190 val &= ~led_config->led_states[i]; in au8522_led_ctrl()
192 /* set selected LED state */ in au8522_led_ctrl()
193 if (led < led_config->num_led_states) in au8522_led_ctrl()
194 val |= led_config->led_states[led]; in au8522_led_ctrl()
195 else if (led_config->num_led_states) in au8522_led_ctrl()
197 led_config->led_states[led_config->num_led_states - 1]; in au8522_led_ctrl()
200 (led_config->gpio_leds & ~0xc000), val); in au8522_led_ctrl()
204 state->led_state = led; in au8522_led_ctrl()
206 if (led == 0) in au8522_led_ctrl()
216 struct au8522_state *state = fe->demodulator_priv; in au8522_init()
219 state->operational_mode = AU8522_DIGITAL_MODE; in au8522_init()
224 state->current_frequency = 0; in au8522_init()
225 state->current_modulation = VSB_8; in au8522_init()
237 struct au8522_state *state = fe->demodulator_priv; in au8522_sleep()
241 if (state->operational_mode == AU8522_ANALOG_MODE) { in au8522_sleep()
249 /* turn off led */ in au8522_sleep()
255 state->current_frequency = 0; in au8522_sleep()
264 MODULE_DESCRIPTION("Auvitek AU8522 QAM-B/ATSC Demodulator driver");