aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2/pvrusb2-hdw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c99
1 files changed, 59 insertions, 40 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 2de595112224..4672199ae92d 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -264,7 +264,6 @@ static void pvr2_hdw_set_cur_freq(struct pvr2_hdw *,unsigned long);
264static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl); 264static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl);
265static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw); 265static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw);
266static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw); 266static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw);
267static unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw);
268static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw); 267static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw);
269static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw); 268static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw);
270static void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw); 269static void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw);
@@ -623,8 +622,34 @@ static void ctrl_stdcur_clear_dirty(struct pvr2_ctrl *cptr)
623 622
624static int ctrl_signal_get(struct pvr2_ctrl *cptr,int *vp) 623static int ctrl_signal_get(struct pvr2_ctrl *cptr,int *vp)
625{ 624{
626 *vp = ((pvr2_hdw_get_signal_status_internal(cptr->hdw) & 625 struct pvr2_hdw *hdw = cptr->hdw;
627 PVR2_SIGNAL_OK) ? 1 : 0); 626 pvr2_i2c_core_status_poll(hdw);
627 *vp = hdw->tuner_signal_info.signal;
628 return 0;
629}
630
631static int ctrl_audio_modes_present_get(struct pvr2_ctrl *cptr,int *vp)
632{
633 int val = 0;
634 unsigned int subchan;
635 struct pvr2_hdw *hdw = cptr->hdw;
636 if (hdw->tuner_signal_stale) {
637 pvr2_i2c_core_status_poll(hdw);
638 }
639 subchan = hdw->tuner_signal_info.rxsubchans;
640 if (subchan & V4L2_TUNER_SUB_MONO) {
641 val |= (1 << V4L2_TUNER_MODE_MONO);
642 }
643 if (subchan & V4L2_TUNER_SUB_STEREO) {
644 val |= (1 << V4L2_TUNER_MODE_STEREO);
645 }
646 if (subchan & V4L2_TUNER_SUB_LANG1) {
647 val |= (1 << V4L2_TUNER_MODE_LANG1);
648 }
649 if (subchan & V4L2_TUNER_SUB_LANG2) {
650 val |= (1 << V4L2_TUNER_MODE_LANG2);
651 }
652 *vp = val;
628 return 0; 653 return 0;
629} 654}
630 655
@@ -898,7 +923,20 @@ static const struct pvr2_ctl_info control_defs[] = {
898 .desc = "Signal Present", 923 .desc = "Signal Present",
899 .name = "signal_present", 924 .name = "signal_present",
900 .get_value = ctrl_signal_get, 925 .get_value = ctrl_signal_get,
901 DEFBOOL, 926 DEFINT(0,65535),
927 },{
928 .desc = "Audio Modes Present",
929 .name = "audio_modes_present",
930 .get_value = ctrl_audio_modes_present_get,
931 /* For this type we "borrow" the V4L2_TUNER_MODE enum from
932 v4l. Nothing outside of this module cares about this,
933 but I reuse it in order to also reuse the
934 control_values_audiomode string table. */
935 DEFMASK(((1 << V4L2_TUNER_MODE_MONO)|
936 (1 << V4L2_TUNER_MODE_STEREO)|
937 (1 << V4L2_TUNER_MODE_LANG1)|
938 (1 << V4L2_TUNER_MODE_LANG2)),
939 control_values_audiomode),
902 },{ 940 },{
903 .desc = "Video Standards Available Mask", 941 .desc = "Video Standards Available Mask",
904 .name = "video_standard_mask_available", 942 .name = "video_standard_mask_available",
@@ -1957,6 +1995,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
1957 hdw,pvr2_device_names[hdw_type]); 1995 hdw,pvr2_device_names[hdw_type]);
1958 if (!hdw) goto fail; 1996 if (!hdw) goto fail;
1959 memset(hdw,0,sizeof(*hdw)); 1997 memset(hdw,0,sizeof(*hdw));
1998 hdw->tuner_signal_stale = !0;
1960 cx2341x_fill_defaults(&hdw->enc_ctl_state); 1999 cx2341x_fill_defaults(&hdw->enc_ctl_state);
1961 2000
1962 hdw->control_cnt = CTRLDEF_COUNT; 2001 hdw->control_cnt = CTRLDEF_COUNT;
@@ -2179,9 +2218,6 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw)
2179 pvr2_stream_destroy(hdw->vid_stream); 2218 pvr2_stream_destroy(hdw->vid_stream);
2180 hdw->vid_stream = NULL; 2219 hdw->vid_stream = NULL;
2181 } 2220 }
2182 if (hdw->audio_stat) {
2183 hdw->audio_stat->detach(hdw->audio_stat->ctxt);
2184 }
2185 if (hdw->decoder_ctrl) { 2221 if (hdw->decoder_ctrl) {
2186 hdw->decoder_ctrl->detach(hdw->decoder_ctrl->ctxt); 2222 hdw->decoder_ctrl->detach(hdw->decoder_ctrl->ctxt);
2187 } 2223 }
@@ -2547,34 +2583,6 @@ const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw)
2547} 2583}
2548 2584
2549 2585
2550/* Return bit mask indicating signal status */
2551static unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw)
2552{
2553 unsigned int msk = 0;
2554 switch (hdw->input_val) {
2555 case PVR2_CVAL_INPUT_TV:
2556 case PVR2_CVAL_INPUT_RADIO:
2557 if (hdw->decoder_ctrl &&
2558 hdw->decoder_ctrl->tuned(hdw->decoder_ctrl->ctxt)) {
2559 msk |= PVR2_SIGNAL_OK;
2560 if (hdw->audio_stat &&
2561 hdw->audio_stat->status(hdw->audio_stat->ctxt)) {
2562 if (hdw->flag_stereo) {
2563 msk |= PVR2_SIGNAL_STEREO;
2564 }
2565 if (hdw->flag_bilingual) {
2566 msk |= PVR2_SIGNAL_SAP;
2567 }
2568 }
2569 }
2570 break;
2571 default:
2572 msk |= PVR2_SIGNAL_OK | PVR2_SIGNAL_STEREO;
2573 }
2574 return msk;
2575}
2576
2577
2578int pvr2_hdw_is_hsm(struct pvr2_hdw *hdw) 2586int pvr2_hdw_is_hsm(struct pvr2_hdw *hdw)
2579{ 2587{
2580 int result; 2588 int result;
@@ -2590,14 +2598,25 @@ int pvr2_hdw_is_hsm(struct pvr2_hdw *hdw)
2590} 2598}
2591 2599
2592 2600
2593/* Return bit mask indicating signal status */ 2601/* Execute poll of tuner status */
2594unsigned int pvr2_hdw_get_signal_status(struct pvr2_hdw *hdw) 2602void pvr2_hdw_execute_tuner_poll(struct pvr2_hdw *hdw)
2595{ 2603{
2596 unsigned int msk = 0;
2597 LOCK_TAKE(hdw->big_lock); do { 2604 LOCK_TAKE(hdw->big_lock); do {
2598 msk = pvr2_hdw_get_signal_status_internal(hdw); 2605 pvr2_i2c_core_status_poll(hdw);
2599 } while (0); LOCK_GIVE(hdw->big_lock); 2606 } while (0); LOCK_GIVE(hdw->big_lock);
2600 return msk; 2607}
2608
2609
2610/* Return information about the tuner */
2611int pvr2_hdw_get_tuner_status(struct pvr2_hdw *hdw,struct v4l2_tuner *vtp)
2612{
2613 LOCK_TAKE(hdw->big_lock); do {
2614 if (hdw->tuner_signal_stale) {
2615 pvr2_i2c_core_status_poll(hdw);
2616 }
2617 memcpy(vtp,&hdw->tuner_signal_info,sizeof(struct v4l2_tuner));
2618 } while (0); LOCK_GIVE(hdw->big_lock);
2619 return 0;
2601} 2620}
2602 2621
2603 2622