Lines Matching refs:state

89 int mxl111sf_read_reg(struct mxl111sf_state *state, u8 addr, u8 *data)  in mxl111sf_read_reg()  argument
94 ret = mxl111sf_ctrl_msg(state->d, MXL_CMD_REG_READ, &addr, 1, buf, 2); in mxl111sf_read_reg()
113 int mxl111sf_write_reg(struct mxl111sf_state *state, u8 addr, u8 data) in mxl111sf_write_reg() argument
120 ret = mxl111sf_ctrl_msg(state->d, MXL_CMD_REG_WRITE, buf, 2, NULL, 0); in mxl111sf_write_reg()
128 int mxl111sf_write_reg_mask(struct mxl111sf_state *state, in mxl111sf_write_reg_mask() argument
135 ret = mxl111sf_read_reg(state, addr, &val); in mxl111sf_write_reg_mask()
142 ret = mxl111sf_read_reg(state, addr, &val); in mxl111sf_write_reg_mask()
150 ret = mxl111sf_write_reg(state, addr, val); in mxl111sf_write_reg_mask()
158 int mxl111sf_ctrl_program_regs(struct mxl111sf_state *state, in mxl111sf_ctrl_program_regs() argument
167 ret = mxl111sf_write_reg_mask(state, in mxl111sf_ctrl_program_regs()
182 static int mxl1x1sf_get_chip_info(struct mxl111sf_state *state) in mxl1x1sf_get_chip_info() argument
188 if ((state->chip_id) && (state->chip_ver)) in mxl1x1sf_get_chip_info()
191 ret = mxl111sf_read_reg(state, CHIP_ID_REG, &id); in mxl1x1sf_get_chip_info()
194 state->chip_id = id; in mxl1x1sf_get_chip_info()
196 ret = mxl111sf_read_reg(state, TOP_CHIP_REV_ID_REG, &ver); in mxl1x1sf_get_chip_info()
199 state->chip_ver = ver; in mxl1x1sf_get_chip_info()
214 state->chip_rev = MXL111SF_V6; in mxl1x1sf_get_chip_info()
218 state->chip_rev = MXL111SF_V8_100; in mxl1x1sf_get_chip_info()
222 state->chip_rev = MXL111SF_V8_200; in mxl1x1sf_get_chip_info()
226 state->chip_rev = 0; in mxl1x1sf_get_chip_info()
235 #define get_chip_info(state) \ argument
238 ___ret = mxl1x1sf_get_chip_info(state); \
242 ___ret = mxl1x1sf_get_chip_info(state); \
265 struct mxl111sf_state *state = fe_to_priv(fe); in mxl111sf_adap_fe_init() local
266 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id]; in mxl111sf_adap_fe_init()
270 if (!state->chip_id) { in mxl111sf_adap_fe_init()
277 mutex_lock(&state->fe_lock); in mxl111sf_adap_fe_init()
279 state->alt_mode = adap_state->alt_mode; in mxl111sf_adap_fe_init()
281 if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) in mxl111sf_adap_fe_init()
284 err = mxl1x1sf_soft_reset(state); in mxl111sf_adap_fe_init()
286 err = mxl111sf_init_tuner_demod(state); in mxl111sf_adap_fe_init()
288 err = mxl1x1sf_set_device_mode(state, adap_state->device_mode); in mxl111sf_adap_fe_init()
291 mxl111sf_enable_usb_output(state); in mxl111sf_adap_fe_init()
293 mxl1x1sf_top_master_ctrl(state, 1); in mxl111sf_adap_fe_init()
297 (state->chip_rev > MXL111SF_V6)) { in mxl111sf_adap_fe_init()
298 mxl111sf_config_pin_mux_modes(state, in mxl111sf_adap_fe_init()
302 err = mxl111sf_init_port_expander(state); in mxl111sf_adap_fe_init()
304 state->gpio_mode = adap_state->gpio_mode; in mxl111sf_adap_fe_init()
305 err = mxl111sf_gpio_mode_switch(state, state->gpio_mode); in mxl111sf_adap_fe_init()
321 struct mxl111sf_state *state = fe_to_priv(fe); in mxl111sf_adap_fe_sleep() local
322 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id]; in mxl111sf_adap_fe_sleep()
326 if (!state->chip_id) { in mxl111sf_adap_fe_sleep()
335 mutex_unlock(&state->fe_lock); in mxl111sf_adap_fe_sleep()
345 struct mxl111sf_state *state = fe_to_priv(fe); in mxl111sf_ep6_streaming_ctrl() local
346 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id]; in mxl111sf_ep6_streaming_ctrl()
352 ret = mxl111sf_enable_usb_output(state); in mxl111sf_ep6_streaming_ctrl()
354 ret = mxl111sf_config_mpeg_in(state, 1, 1, in mxl111sf_ep6_streaming_ctrl()
360 ret = mxl111sf_disable_656_port(state); in mxl111sf_ep6_streaming_ctrl()
370 struct mxl111sf_state *state = fe_to_priv(fe); in mxl111sf_ep5_streaming_ctrl() local
376 ret = mxl111sf_enable_usb_output(state); in mxl111sf_ep5_streaming_ctrl()
379 ret = mxl111sf_init_i2s_port(state, 200); in mxl111sf_ep5_streaming_ctrl()
381 ret = mxl111sf_config_i2s(state, 0, 15); in mxl111sf_ep5_streaming_ctrl()
384 ret = mxl111sf_disable_i2s_port(state); in mxl111sf_ep5_streaming_ctrl()
387 if (state->chip_rev > MXL111SF_V6) in mxl111sf_ep5_streaming_ctrl()
388 ret = mxl111sf_config_spi(state, onoff); in mxl111sf_ep5_streaming_ctrl()
396 struct mxl111sf_state *state = fe_to_priv(fe); in mxl111sf_ep4_streaming_ctrl() local
402 ret = mxl111sf_enable_usb_output(state); in mxl111sf_ep4_streaming_ctrl()
425 struct mxl111sf_state *state = d_to_priv(d); in mxl111sf_lgdt3305_frontend_attach() local
426 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; in mxl111sf_lgdt3305_frontend_attach()
432 state->d = d; in mxl111sf_lgdt3305_frontend_attach()
434 state->alt_mode = adap_state->alt_mode; in mxl111sf_lgdt3305_frontend_attach()
436 if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) in mxl111sf_lgdt3305_frontend_attach()
439 state->gpio_mode = MXL111SF_GPIO_MOD_ATSC; in mxl111sf_lgdt3305_frontend_attach()
440 adap_state->gpio_mode = state->gpio_mode; in mxl111sf_lgdt3305_frontend_attach()
444 ret = mxl1x1sf_soft_reset(state); in mxl111sf_lgdt3305_frontend_attach()
447 ret = mxl111sf_init_tuner_demod(state); in mxl111sf_lgdt3305_frontend_attach()
451 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode); in mxl111sf_lgdt3305_frontend_attach()
455 ret = mxl111sf_enable_usb_output(state); in mxl111sf_lgdt3305_frontend_attach()
458 ret = mxl1x1sf_top_master_ctrl(state, 1); in mxl111sf_lgdt3305_frontend_attach()
462 ret = mxl111sf_init_port_expander(state); in mxl111sf_lgdt3305_frontend_attach()
465 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode); in mxl111sf_lgdt3305_frontend_attach()
473 state->num_frontends++; in mxl111sf_lgdt3305_frontend_attach()
496 struct mxl111sf_state *state = d_to_priv(d); in mxl111sf_lg2160_frontend_attach() local
497 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; in mxl111sf_lg2160_frontend_attach()
503 state->d = d; in mxl111sf_lg2160_frontend_attach()
505 state->alt_mode = adap_state->alt_mode; in mxl111sf_lg2160_frontend_attach()
507 if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) in mxl111sf_lg2160_frontend_attach()
510 state->gpio_mode = MXL111SF_GPIO_MOD_MH; in mxl111sf_lg2160_frontend_attach()
511 adap_state->gpio_mode = state->gpio_mode; in mxl111sf_lg2160_frontend_attach()
515 ret = mxl1x1sf_soft_reset(state); in mxl111sf_lg2160_frontend_attach()
518 ret = mxl111sf_init_tuner_demod(state); in mxl111sf_lg2160_frontend_attach()
522 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode); in mxl111sf_lg2160_frontend_attach()
526 ret = mxl111sf_enable_usb_output(state); in mxl111sf_lg2160_frontend_attach()
529 ret = mxl1x1sf_top_master_ctrl(state, 1); in mxl111sf_lg2160_frontend_attach()
533 ret = mxl111sf_init_port_expander(state); in mxl111sf_lg2160_frontend_attach()
536 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode); in mxl111sf_lg2160_frontend_attach()
540 ret = get_chip_info(state); in mxl111sf_lg2160_frontend_attach()
548 state->num_frontends++; in mxl111sf_lg2160_frontend_attach()
581 struct mxl111sf_state *state = d_to_priv(d); in mxl111sf_lg2161_frontend_attach() local
582 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; in mxl111sf_lg2161_frontend_attach()
588 state->d = d; in mxl111sf_lg2161_frontend_attach()
590 state->alt_mode = adap_state->alt_mode; in mxl111sf_lg2161_frontend_attach()
592 if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) in mxl111sf_lg2161_frontend_attach()
595 state->gpio_mode = MXL111SF_GPIO_MOD_MH; in mxl111sf_lg2161_frontend_attach()
596 adap_state->gpio_mode = state->gpio_mode; in mxl111sf_lg2161_frontend_attach()
600 ret = mxl1x1sf_soft_reset(state); in mxl111sf_lg2161_frontend_attach()
603 ret = mxl111sf_init_tuner_demod(state); in mxl111sf_lg2161_frontend_attach()
607 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode); in mxl111sf_lg2161_frontend_attach()
611 ret = mxl111sf_enable_usb_output(state); in mxl111sf_lg2161_frontend_attach()
614 ret = mxl1x1sf_top_master_ctrl(state, 1); in mxl111sf_lg2161_frontend_attach()
618 ret = mxl111sf_init_port_expander(state); in mxl111sf_lg2161_frontend_attach()
621 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode); in mxl111sf_lg2161_frontend_attach()
625 ret = get_chip_info(state); in mxl111sf_lg2161_frontend_attach()
630 (MXL111SF_V8_200 == state->chip_rev) ? in mxl111sf_lg2161_frontend_attach()
635 state->num_frontends++; in mxl111sf_lg2161_frontend_attach()
668 struct mxl111sf_state *state = d_to_priv(d); in mxl111sf_lg2161_ep6_frontend_attach() local
669 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; in mxl111sf_lg2161_ep6_frontend_attach()
675 state->d = d; in mxl111sf_lg2161_ep6_frontend_attach()
677 state->alt_mode = adap_state->alt_mode; in mxl111sf_lg2161_ep6_frontend_attach()
679 if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) in mxl111sf_lg2161_ep6_frontend_attach()
682 state->gpio_mode = MXL111SF_GPIO_MOD_MH; in mxl111sf_lg2161_ep6_frontend_attach()
683 adap_state->gpio_mode = state->gpio_mode; in mxl111sf_lg2161_ep6_frontend_attach()
687 ret = mxl1x1sf_soft_reset(state); in mxl111sf_lg2161_ep6_frontend_attach()
690 ret = mxl111sf_init_tuner_demod(state); in mxl111sf_lg2161_ep6_frontend_attach()
694 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode); in mxl111sf_lg2161_ep6_frontend_attach()
698 ret = mxl111sf_enable_usb_output(state); in mxl111sf_lg2161_ep6_frontend_attach()
701 ret = mxl1x1sf_top_master_ctrl(state, 1); in mxl111sf_lg2161_ep6_frontend_attach()
705 ret = mxl111sf_init_port_expander(state); in mxl111sf_lg2161_ep6_frontend_attach()
708 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode); in mxl111sf_lg2161_ep6_frontend_attach()
712 ret = get_chip_info(state); in mxl111sf_lg2161_ep6_frontend_attach()
717 (MXL111SF_V8_200 == state->chip_rev) ? in mxl111sf_lg2161_ep6_frontend_attach()
722 state->num_frontends++; in mxl111sf_lg2161_ep6_frontend_attach()
743 struct mxl111sf_state *state = d_to_priv(d); in mxl111sf_attach_demod() local
744 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; in mxl111sf_attach_demod()
750 state->d = d; in mxl111sf_attach_demod()
752 state->alt_mode = adap_state->alt_mode; in mxl111sf_attach_demod()
754 if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) in mxl111sf_attach_demod()
757 state->gpio_mode = MXL111SF_GPIO_MOD_DVBT; in mxl111sf_attach_demod()
758 adap_state->gpio_mode = state->gpio_mode; in mxl111sf_attach_demod()
762 ret = mxl1x1sf_soft_reset(state); in mxl111sf_attach_demod()
765 ret = mxl111sf_init_tuner_demod(state); in mxl111sf_attach_demod()
769 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode); in mxl111sf_attach_demod()
773 ret = mxl111sf_enable_usb_output(state); in mxl111sf_attach_demod()
776 ret = mxl1x1sf_top_master_ctrl(state, 1); in mxl111sf_attach_demod()
781 mxl111sf_init_port_expander(state); in mxl111sf_attach_demod()
783 adap->fe[fe_id] = dvb_attach(mxl111sf_demod_attach, state, in mxl111sf_attach_demod()
786 state->num_frontends++; in mxl111sf_attach_demod()
798 static inline int mxl111sf_set_ant_path(struct mxl111sf_state *state, in mxl111sf_set_ant_path() argument
801 return mxl111sf_idac_config(state, 1, 1, in mxl111sf_set_ant_path()
817 struct mxl111sf_state *state = fe_to_priv(fe); in mxl111sf_ant_hunt() local
823 mxl111sf_set_ant_path(state, antctrl == ANT_PATH_AUTO ? in mxl111sf_ant_hunt()
832 mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL); in mxl111sf_ant_hunt()
836 mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL); in mxl111sf_ant_hunt()
840 mxl111sf_set_ant_path(state, ANT_PATH_INTERNAL); in mxl111sf_ant_hunt()
846 mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL); in mxl111sf_ant_hunt()
870 struct mxl111sf_state *state = adap_to_priv(adap); in mxl111sf_attach_tuner() local
875 for (i = 0; i < state->num_frontends; i++) { in mxl111sf_attach_tuner()
876 if (dvb_attach(mxl111sf_tuner_attach, adap->fe[i], state, in mxl111sf_attach_tuner()
900 struct mxl111sf_state *state = d_to_priv(d); in mxl111sf_init() local
905 ret = get_chip_info(state); in mxl111sf_init()
909 mutex_init(&state->fe_lock); in mxl111sf_init()
911 if (state->chip_rev > MXL111SF_V6) in mxl111sf_init()
912 mxl111sf_config_pin_mux_modes(state, PIN_MUX_TS_SPI_IN_MODE_1); in mxl111sf_init()
920 tveeprom_hauppauge_analog(&c, &state->tv, (0x84 == eeprom[0xa0]) ? in mxl111sf_init()
923 switch (state->tv.model) { in mxl111sf_init()
931 __func__, state->tv.model); in mxl111sf_init()