diff options
author | Mike Isely <isely@pobox.com> | 2008-04-03 03:51:19 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:09:48 -0400 |
commit | 72998b71096e364002269a8cacc0524937d479c6 (patch) | |
tree | febb32df15b0f0d085b6892e527e873b1923417b /drivers/media/video/pvrusb2 | |
parent | 07b80264c3ede47593e83189cce82b31100053f6 (diff) |
V4L/DVB (7709): pvrusb2: New device attribute for encoder usage in digital mode
Some tuners seem to not work in digital mode unless the encoder is
healthy. Implement a device attribute to represent this flag and
modify the core state machines to enforce this requirement.
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pvrusb2')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-devattr.c | 2 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-devattr.h | 7 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 33 |
3 files changed, 33 insertions, 9 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.c b/drivers/media/video/pvrusb2/pvrusb2-devattr.c index 64a29adcfd92..74c92a470eb6 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-devattr.c +++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.c | |||
@@ -201,6 +201,7 @@ static const struct pvr2_device_desc pvr2_device_onair_creator = { | |||
201 | .flag_has_analogtuner = !0, | 201 | .flag_has_analogtuner = !0, |
202 | .flag_has_composite = !0, | 202 | .flag_has_composite = !0, |
203 | .flag_has_svideo = !0, | 203 | .flag_has_svideo = !0, |
204 | .flag_digital_requires_cx23416 = !0, | ||
204 | .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, | 205 | .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, |
205 | .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR, | 206 | .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR, |
206 | .default_std_mask = V4L2_STD_NTSC_M, | 207 | .default_std_mask = V4L2_STD_NTSC_M, |
@@ -262,6 +263,7 @@ static const struct pvr2_device_desc pvr2_device_onair_usb2 = { | |||
262 | .flag_has_analogtuner = !0, | 263 | .flag_has_analogtuner = !0, |
263 | .flag_has_composite = !0, | 264 | .flag_has_composite = !0, |
264 | .flag_has_svideo = !0, | 265 | .flag_has_svideo = !0, |
266 | .flag_digital_requires_cx23416 = !0, | ||
265 | .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, | 267 | .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, |
266 | .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR, | 268 | .digital_control_scheme = PVR2_DIGITAL_SCHEME_ONAIR, |
267 | .default_std_mask = V4L2_STD_NTSC_M, | 269 | .default_std_mask = V4L2_STD_NTSC_M, |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.h b/drivers/media/video/pvrusb2/pvrusb2-devattr.h index 38913519a818..c2e2b06fe2e0 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-devattr.h +++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.h | |||
@@ -106,6 +106,13 @@ struct pvr2_device_desc { | |||
106 | /* If set, we don't bother trying to load cx23416 firmware. */ | 106 | /* If set, we don't bother trying to load cx23416 firmware. */ |
107 | int flag_skip_cx23416_firmware:1; | 107 | int flag_skip_cx23416_firmware:1; |
108 | 108 | ||
109 | /* If set, the encoder must be healthy in order for digital mode to | ||
110 | work (otherwise we assume that digital streaming will work even | ||
111 | if we fail to locate firmware for the encoder). If the device | ||
112 | doesn't support digital streaming then this flag has no | ||
113 | effect. */ | ||
114 | int flag_digital_requires_cx23416:1; | ||
115 | |||
109 | /* Device has a hauppauge eeprom which we can interrogate. */ | 116 | /* Device has a hauppauge eeprom which we can interrogate. */ |
110 | int flag_has_hauppauge_rom:1; | 117 | int flag_has_hauppauge_rom:1; |
111 | 118 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 195e974f5eb0..539fe17105e7 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -3502,7 +3502,12 @@ static int state_eval_encoder_ok(struct pvr2_hdw *hdw) | |||
3502 | if (hdw->state_encoder_config) return 0; | 3502 | if (hdw->state_encoder_config) return 0; |
3503 | if (hdw->state_decoder_run) return 0; | 3503 | if (hdw->state_decoder_run) return 0; |
3504 | if (hdw->state_usbstream_run) return 0; | 3504 | if (hdw->state_usbstream_run) return 0; |
3505 | if (hdw->pathway_state != PVR2_PATHWAY_ANALOG) return 0; | 3505 | if (hdw->pathway_state == PVR2_PATHWAY_DIGITAL) { |
3506 | if (!hdw->hdw_desc->flag_digital_requires_cx23416) return 0; | ||
3507 | } else if (hdw->pathway_state != PVR2_PATHWAY_ANALOG) { | ||
3508 | return 0; | ||
3509 | } | ||
3510 | |||
3506 | if (pvr2_upload_firmware2(hdw) < 0) { | 3511 | if (pvr2_upload_firmware2(hdw) < 0) { |
3507 | hdw->flag_tripped = !0; | 3512 | hdw->flag_tripped = !0; |
3508 | trace_stbit("flag_tripped",hdw->flag_tripped); | 3513 | trace_stbit("flag_tripped",hdw->flag_tripped); |
@@ -3687,14 +3692,19 @@ static int state_eval_decoder_run(struct pvr2_hdw *hdw) | |||
3687 | static int state_eval_usbstream_run(struct pvr2_hdw *hdw) | 3692 | static int state_eval_usbstream_run(struct pvr2_hdw *hdw) |
3688 | { | 3693 | { |
3689 | if (hdw->state_usbstream_run) { | 3694 | if (hdw->state_usbstream_run) { |
3695 | int fl = !0; | ||
3690 | if (hdw->pathway_state == PVR2_PATHWAY_ANALOG) { | 3696 | if (hdw->pathway_state == PVR2_PATHWAY_ANALOG) { |
3691 | if (hdw->state_encoder_ok && | 3697 | fl = (hdw->state_encoder_ok && |
3692 | hdw->state_encoder_run && | 3698 | hdw->state_encoder_run); |
3693 | hdw->state_pathway_ok) return 0; | 3699 | } else if ((hdw->pathway_state == PVR2_PATHWAY_DIGITAL) && |
3694 | } else { | 3700 | (hdw->hdw_desc->flag_digital_requires_cx23416)) { |
3695 | if (hdw->state_pipeline_req && | 3701 | fl = hdw->state_encoder_ok; |
3696 | !hdw->state_pipeline_pause && | 3702 | } |
3697 | hdw->state_pathway_ok) return 0; | 3703 | if (fl && |
3704 | hdw->state_pipeline_req && | ||
3705 | !hdw->state_pipeline_pause && | ||
3706 | hdw->state_pathway_ok) { | ||
3707 | return 0; | ||
3698 | } | 3708 | } |
3699 | pvr2_hdw_cmd_usbstream(hdw,0); | 3709 | pvr2_hdw_cmd_usbstream(hdw,0); |
3700 | hdw->state_usbstream_run = 0; | 3710 | hdw->state_usbstream_run = 0; |
@@ -3705,6 +3715,9 @@ static int state_eval_usbstream_run(struct pvr2_hdw *hdw) | |||
3705 | if (hdw->pathway_state == PVR2_PATHWAY_ANALOG) { | 3715 | if (hdw->pathway_state == PVR2_PATHWAY_ANALOG) { |
3706 | if (!hdw->state_encoder_ok || | 3716 | if (!hdw->state_encoder_ok || |
3707 | !hdw->state_encoder_run) return 0; | 3717 | !hdw->state_encoder_run) return 0; |
3718 | } else if ((hdw->pathway_state == PVR2_PATHWAY_DIGITAL) && | ||
3719 | (hdw->hdw_desc->flag_digital_requires_cx23416)) { | ||
3720 | if (!hdw->state_encoder_ok) return 0; | ||
3708 | } | 3721 | } |
3709 | if (pvr2_hdw_cmd_usbstream(hdw,!0) < 0) return 0; | 3722 | if (pvr2_hdw_cmd_usbstream(hdw,!0) < 0) return 0; |
3710 | hdw->state_usbstream_run = !0; | 3723 | hdw->state_usbstream_run = !0; |
@@ -3943,7 +3956,9 @@ static int pvr2_hdw_state_eval(struct pvr2_hdw *hdw) | |||
3943 | st = PVR2_STATE_DEAD; | 3956 | st = PVR2_STATE_DEAD; |
3944 | } else if (hdw->fw1_state != FW1_STATE_OK) { | 3957 | } else if (hdw->fw1_state != FW1_STATE_OK) { |
3945 | st = PVR2_STATE_COLD; | 3958 | st = PVR2_STATE_COLD; |
3946 | } else if (analog_mode && !hdw->state_encoder_ok) { | 3959 | } else if ((analog_mode || |
3960 | hdw->hdw_desc->flag_digital_requires_cx23416) && | ||
3961 | !hdw->state_encoder_ok) { | ||
3947 | st = PVR2_STATE_WARM; | 3962 | st = PVR2_STATE_WARM; |
3948 | } else if (hdw->flag_tripped || | 3963 | } else if (hdw->flag_tripped || |
3949 | (analog_mode && hdw->flag_decoder_missed)) { | 3964 | (analog_mode && hdw->flag_decoder_missed)) { |