Lines Matching refs:state

291 	struct msp_state *state = to_state(i2c_get_clientdata(client));  in msp_set_scart()  local
293 state->in_scart = in; in msp_set_scart()
299 state->acb &= ~scarts[out][0]; in msp_set_scart()
300 state->acb |= scarts[out][in + 1]; in msp_set_scart()
302 state->acb = 0xf60; /* Mute Input and SCART 1 Output */ in msp_set_scart()
305 scart_names[in], out, state->acb); in msp_set_scart()
306 msp_write_dsp(client, 0x13, state->acb); in msp_set_scart()
309 if (state->has_i2s_conf) in msp_set_scart()
310 msp_write_dem(client, 0x40, state->i2s_mode); in msp_set_scart()
317 struct msp_state *state = to_state(i2c_get_clientdata(client)); in msp_wake_thread() local
319 if (NULL == state->kthread) in msp_wake_thread()
321 state->watch_stereo = 0; in msp_wake_thread()
322 state->restart = 1; in msp_wake_thread()
323 wake_up_interruptible(&state->wq); in msp_wake_thread()
326 int msp_sleep(struct msp_state *state, int timeout) in msp_sleep() argument
330 add_wait_queue(&state->wq, &wait); in msp_sleep()
341 remove_wait_queue(&state->wq, &wait); in msp_sleep()
343 return state->restart; in msp_sleep()
350 struct msp_state *state = ctrl_to_state(ctrl); in msp_s_ctrl() local
351 struct i2c_client *client = v4l2_get_subdevdata(&state->sd); in msp_s_ctrl()
357 int reallymuted = state->muted->val | state->scan_in_progress; in msp_s_ctrl()
363 state->muted->val ? "on" : "off", in msp_s_ctrl()
364 state->scan_in_progress ? "yes" : "no", in msp_s_ctrl()
365 state->volume->val); in msp_s_ctrl()
369 if (state->has_scart2_out_volume) in msp_s_ctrl()
371 if (state->has_headphones) in msp_s_ctrl()
379 if (state->has_headphones) in msp_s_ctrl()
386 if (state->has_headphones) in msp_s_ctrl()
393 if (state->has_headphones) in msp_s_ctrl()
400 if (state->has_headphones) in msp_s_ctrl()
410 void msp_update_volume(struct msp_state *state) in msp_update_volume() argument
413 v4l2_ctrl_lock(state->volume); in msp_update_volume()
414 state->volume->val = state->volume->cur.val; in msp_update_volume()
415 state->muted->val = state->muted->cur.val; in msp_update_volume()
416 msp_s_ctrl(state->volume); in msp_update_volume()
417 v4l2_ctrl_unlock(state->volume); in msp_update_volume()
423 struct msp_state *state = to_state(sd); in msp_s_radio() local
426 if (state->radio) in msp_s_radio()
428 state->radio = 1; in msp_s_radio()
430 state->watch_stereo = 0; in msp_s_radio()
431 switch (state->opmode) { in msp_s_radio()
437 msp_update_volume(state); in msp_s_radio()
459 struct msp_state *state = to_state(sd); in msp_querystd() local
462 *id &= state->detected_std; in msp_querystd()
466 msp_standard_std_name(state->std), state->detected_std); in msp_querystd()
473 struct msp_state *state = to_state(sd); in msp_s_std() local
475 int update = state->radio || state->v4l2_std != id; in msp_s_std()
477 state->v4l2_std = id; in msp_s_std()
478 state->radio = 0; in msp_s_std()
487 struct msp_state *state = to_state(sd); in msp_s_routing() local
497 if (state->route_in == input && state->route_out == output) in msp_s_routing()
499 state->route_in = input; in msp_s_routing()
500 state->route_out = output; in msp_s_routing()
506 state->mode = extern_input ? MSP_MODE_EXTERN : MSP_MODE_AM_DETECT; in msp_s_routing()
507 state->rxsubchans = V4L2_TUNER_SUB_STEREO; in msp_s_routing()
512 reg = (state->opmode == OPMODE_AUTOSELECT) ? 0x30 : 0xbb; in msp_s_routing()
522 struct msp_state *state = to_state(sd); in msp_g_tuner() local
527 if (!state->radio) { in msp_g_tuner()
528 if (state->opmode == OPMODE_AUTOSELECT) in msp_g_tuner()
530 vt->rxsubchans = state->rxsubchans; in msp_g_tuner()
532 vt->audmode = state->audmode; in msp_g_tuner()
540 struct msp_state *state = to_state(sd); in msp_s_tuner() local
543 if (state->radio) /* TODO: add mono/stereo support for radio */ in msp_s_tuner()
545 if (state->audmode == vt->audmode) in msp_s_tuner()
547 state->audmode = vt->audmode; in msp_s_tuner()
555 struct msp_state *state = to_state(sd); in msp_s_i2s_clock_freq() local
562 state->i2s_mode = 0; in msp_s_i2s_clock_freq()
565 state->i2s_mode = 1; in msp_s_i2s_clock_freq()
575 struct msp_state *state = to_state(sd); in msp_log_status() local
580 if (state->opmode == OPMODE_AUTOSELECT) in msp_log_status()
583 client->name, state->rev1, state->rev2); in msp_log_status()
585 v4l2_ctrl_handler_log_status(&state->hdl, prefix); in msp_log_status()
586 switch (state->mode) { in msp_log_status()
598 if (state->mode == MSP_MODE_EXTERN) { in msp_log_status()
600 } else if (state->opmode == OPMODE_MANUAL) { in msp_log_status()
602 (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", in msp_log_status()
603 (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); in msp_log_status()
605 if (state->opmode == OPMODE_AUTODETECT) in msp_log_status()
608 msp_standard_std_name(state->std), in msp_log_status()
609 (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", in msp_log_status()
610 (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); in msp_log_status()
612 v4l_info(client, "Audmode: 0x%04x\n", state->audmode); in msp_log_status()
614 state->route_in, state->route_out); in msp_log_status()
615 v4l_info(client, "ACB: 0x%04x\n", state->acb); in msp_log_status()
682 struct msp_state *state; in msp_probe() local
700 state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); in msp_probe()
701 if (!state) in msp_probe()
704 sd = &state->sd; in msp_probe()
707 state->v4l2_std = V4L2_STD_NTSC; in msp_probe()
708 state->detected_std = V4L2_STD_ALL; in msp_probe()
709 state->audmode = V4L2_TUNER_MODE_STEREO; in msp_probe()
710 state->input = -1; in msp_probe()
711 state->i2s_mode = 0; in msp_probe()
712 init_waitqueue_head(&state->wq); in msp_probe()
714 state->route_in = MSP_INPUT_DEFAULT; in msp_probe()
715 state->route_out = MSP_OUTPUT_DEFAULT; in msp_probe()
717 state->rev1 = msp_read_dsp(client, 0x1e); in msp_probe()
718 if (state->rev1 != -1) in msp_probe()
719 state->rev2 = msp_read_dsp(client, 0x1f); in msp_probe()
721 state->rev1, state->rev2); in msp_probe()
722 if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) { in msp_probe()
728 msp_family = ((state->rev1 >> 4) & 0x0f) + 3; in msp_probe()
729 msp_product = (state->rev2 >> 8) & 0xff; in msp_probe()
732 msp_revision = (state->rev1 & 0x0f) + '@'; in msp_probe()
733 msp_hard = ((state->rev1 >> 8) & 0xff) + '@'; in msp_probe()
734 msp_rom = state->rev2 & 0x1f; in msp_probe()
736 state->ident = msp_family * 10000 + 4000 + msp_product * 10 + in msp_probe()
740 state->has_nicam = in msp_probe()
743 state->has_radio = in msp_probe()
746 state->has_headphones = in msp_probe()
749 state->has_scart2 = in msp_probe()
752 state->has_scart3 = in msp_probe()
755 state->has_scart4 = in msp_probe()
759 state->has_scart2_out = in msp_probe()
762 state->has_scart2_out_volume = in msp_probe()
763 msp_revision > 'C' && state->has_scart2_out; in msp_probe()
765 state->has_i2s_conf = in msp_probe()
769 state->has_subwoofer = in msp_probe()
773 state->has_sound_processing = in msp_probe()
776 state->has_virtual_dolby_surround = in msp_probe()
779 state->has_dolby_pro_logic = in msp_probe()
783 state->force_btsc = in msp_probe()
786 state->opmode = opmode; in msp_probe()
787 if (state->opmode == OPMODE_AUTO) { in msp_probe()
790 state->opmode = OPMODE_AUTOSELECT; in msp_probe()
793 state->opmode = OPMODE_AUTODETECT; in msp_probe()
795 state->opmode = OPMODE_MANUAL; in msp_probe()
798 hdl = &state->hdl; in msp_probe()
800 if (state->has_sound_processing) { in msp_probe()
808 state->volume = v4l2_ctrl_new_std(hdl, &msp_ctrl_ops, in msp_probe()
812 state->muted = v4l2_ctrl_new_std(hdl, &msp_ctrl_ops, in msp_probe()
822 v4l2_ctrl_cluster(2, &state->volume); in msp_probe()
831 if (state->has_nicam && state->has_radio) in msp_probe()
833 else if (state->has_nicam) in msp_probe()
835 else if (state->has_radio) in msp_probe()
840 switch (state->opmode) { in msp_probe()
858 state->kthread = kthread_run(thread_func, client, "msp34xx"); in msp_probe()
860 if (IS_ERR(state->kthread)) in msp_probe()
869 struct msp_state *state = to_state(i2c_get_clientdata(client)); in msp_remove() local
871 v4l2_device_unregister_subdev(&state->sd); in msp_remove()
873 if (state->kthread) { in msp_remove()
874 state->restart = 1; in msp_remove()
875 kthread_stop(state->kthread); in msp_remove()
879 v4l2_ctrl_handler_free(&state->hdl); in msp_remove()