Lines Matching refs:state
277 struct msp_state *state = to_state(i2c_get_clientdata(client));
279 state->in_scart = in;
285 state->acb &= ~scarts[out][0];
286 state->acb |= scarts[out][in + 1];
288 state->acb = 0xf60; /* Mute Input and SCART 1 Output */
291 scart_names[in], out, state->acb);
292 msp_write_dsp(client, 0x13, state->acb);
295 if (state->has_i2s_conf)
296 msp_write_dem(client, 0x40, state->i2s_mode);
303 struct msp_state *state = to_state(i2c_get_clientdata(client));
305 if (NULL == state->kthread)
307 state->watch_stereo = 0;
308 state->restart = 1;
309 wake_up_interruptible(&state->wq);
312 int msp_sleep(struct msp_state *state, int timeout)
316 add_wait_queue(&state->wq, &wait);
327 remove_wait_queue(&state->wq, &wait);
329 return state->restart;
336 struct msp_state *state = ctrl_to_state(ctrl);
337 struct i2c_client *client = v4l2_get_subdevdata(&state->sd);
343 int reallymuted = state->muted->val | state->scan_in_progress;
349 state->muted->val ? "on" : "off",
350 state->scan_in_progress ? "yes" : "no",
351 state->volume->val);
355 if (state->has_scart2_out_volume)
357 if (state->has_headphones)
365 if (state->has_headphones)
372 if (state->has_headphones)
379 if (state->has_headphones)
386 if (state->has_headphones)
396 void msp_update_volume(struct msp_state *state)
399 v4l2_ctrl_lock(state->volume);
400 state->volume->val = state->volume->cur.val;
401 state->muted->val = state->muted->cur.val;
402 msp_s_ctrl(state->volume);
403 v4l2_ctrl_unlock(state->volume);
409 struct msp_state *state = to_state(sd);
412 if (state->radio)
414 state->radio = 1;
416 state->watch_stereo = 0;
417 switch (state->opmode) {
423 msp_update_volume(state);
445 struct msp_state *state = to_state(sd);
448 *id &= state->detected_std;
452 msp_standard_std_name(state->std), state->detected_std);
459 struct msp_state *state = to_state(sd);
461 int update = state->radio || state->v4l2_std != id;
463 state->v4l2_std = id;
464 state->radio = 0;
473 struct msp_state *state = to_state(sd);
483 if (state->route_in == input && state->route_out == output)
485 state->route_in = input;
486 state->route_out = output;
492 state->mode = extern_input ? MSP_MODE_EXTERN : MSP_MODE_AM_DETECT;
493 state->rxsubchans = V4L2_TUNER_SUB_STEREO;
498 reg = (state->opmode == OPMODE_AUTOSELECT) ? 0x30 : 0xbb;
508 struct msp_state *state = to_state(sd);
513 if (!state->radio) {
514 if (state->opmode == OPMODE_AUTOSELECT)
516 vt->rxsubchans = state->rxsubchans;
518 vt->audmode = state->audmode;
526 struct msp_state *state = to_state(sd);
529 if (state->radio) /* TODO: add mono/stereo support for radio */
531 if (state->audmode == vt->audmode)
533 state->audmode = vt->audmode;
541 struct msp_state *state = to_state(sd);
548 state->i2s_mode = 0;
551 state->i2s_mode = 1;
561 struct msp_state *state = to_state(sd);
566 if (state->opmode == OPMODE_AUTOSELECT)
569 client->name, state->rev1, state->rev2);
571 v4l2_ctrl_handler_log_status(&state->hdl, prefix);
572 switch (state->mode) {
584 if (state->mode == MSP_MODE_EXTERN) {
586 } else if (state->opmode == OPMODE_MANUAL) {
588 (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono",
589 (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : "");
591 if (state->opmode == OPMODE_AUTODETECT)
594 msp_standard_std_name(state->std),
595 (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono",
596 (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : "");
598 dev_info(&client->dev, "Audmode: 0x%04x\n", state->audmode);
600 state->route_in, state->route_out);
601 dev_info(&client->dev, "ACB: 0x%04x\n", state->acb);
669 struct msp_state *state;
690 state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL);
691 if (!state)
694 sd = &state->sd;
698 state->pads[MSP3400_PAD_IF_INPUT].flags = MEDIA_PAD_FL_SINK;
699 state->pads[MSP3400_PAD_IF_INPUT].sig_type = PAD_SIGNAL_AUDIO;
700 state->pads[MSP3400_PAD_OUT].flags = MEDIA_PAD_FL_SOURCE;
701 state->pads[MSP3400_PAD_OUT].sig_type = PAD_SIGNAL_AUDIO;
705 ret = media_entity_pads_init(&sd->entity, 2, state->pads);
710 state->v4l2_std = V4L2_STD_NTSC;
711 state->detected_std = V4L2_STD_ALL;
712 state->audmode = V4L2_TUNER_MODE_STEREO;
713 state->input = -1;
714 state->i2s_mode = 0;
715 init_waitqueue_head(&state->wq);
717 state->route_in = MSP_INPUT_DEFAULT;
718 state->route_out = MSP_OUTPUT_DEFAULT;
720 state->rev1 = msp_read_dsp(client, 0x1e);
721 if (state->rev1 != -1)
722 state->rev2 = msp_read_dsp(client, 0x1f);
724 state->rev1, state->rev2);
725 if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) {
731 msp_family = ((state->rev1 >> 4) & 0x0f) + 3;
732 msp_product = (state->rev2 >> 8) & 0xff;
735 msp_revision = (state->rev1 & 0x0f) + '@';
736 msp_hard = ((state->rev1 >> 8) & 0xff) + '@';
737 msp_rom = state->rev2 & 0x1f;
739 state->ident = msp_family * 10000 + 4000 + msp_product * 10 +
743 state->has_nicam =
746 state->has_radio =
749 state->has_headphones =
752 state->has_scart2 =
755 state->has_scart3 =
758 state->has_scart4 =
762 state->has_scart2_out =
765 state->has_scart2_out_volume =
766 msp_revision > 'C' && state->has_scart2_out;
768 state->has_i2s_conf =
772 state->has_subwoofer =
776 state->has_sound_processing =
779 state->has_virtual_dolby_surround =
782 state->has_dolby_pro_logic =
786 state->force_btsc =
789 state->opmode = opmode;
790 if (state->opmode < OPMODE_MANUAL
791 || state->opmode > OPMODE_AUTOSELECT) {
794 state->opmode = OPMODE_AUTOSELECT;
797 state->opmode = OPMODE_AUTODETECT;
799 state->opmode = OPMODE_MANUAL;
802 hdl = &state->hdl;
804 if (state->has_sound_processing) {
812 state->volume = v4l2_ctrl_new_std(hdl, &msp_ctrl_ops,
816 state->muted = v4l2_ctrl_new_std(hdl, &msp_ctrl_ops,
826 v4l2_ctrl_cluster(2, &state->volume);
834 (state->has_nicam) ? "nicam" : "",
835 (state->has_nicam && state->has_radio) ? " and " : "",
836 (state->has_radio) ? "radio" : "",
837 opmode_str[state->opmode]);
840 switch (state->opmode) {
854 state->kthread = kthread_run(thread_func, client, "msp34xx");
856 if (IS_ERR(state->kthread))
865 struct msp_state *state = to_state(i2c_get_clientdata(client));
867 v4l2_device_unregister_subdev(&state->sd);
869 if (state->kthread) {
870 state->restart = 1;
871 kthread_stop(state->kthread);
875 v4l2_ctrl_handler_free(&state->hdl);