diff options
author | Mike Isely <isely@pobox.com> | 2008-04-22 13:45:40 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:07:47 -0400 |
commit | 62433e312076d4ff4f2df357b2a6fac29974344a (patch) | |
tree | a4eb42c0ffd1b517d8dbf4b68b37603b91ad51a9 /drivers/media/video/pvrusb2 | |
parent | e8f5bacfcf2ba9a98674f3cd51b63020920e16aa (diff) |
V4L/DVB (7309): pvrusb2: Enhance core logic to also control digital streaming
This is a major pvrusb2 change. The driver core has an algorithm that
is used to cleanly sequence the changes needed to enable / disable
video streaming. The algorithm had originally been written for analog
streaming, but when in digital mode the pipeline is considerably
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pvrusb2')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | 7 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 196 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.h | 8 |
3 files changed, 164 insertions, 47 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index 4971335c46d3..af06e6c4b8d5 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | |||
@@ -163,6 +163,11 @@ struct pvr2_decoder_ctrl { | |||
163 | #define FW1_STATE_RELOAD 3 | 163 | #define FW1_STATE_RELOAD 3 |
164 | #define FW1_STATE_OK 4 | 164 | #define FW1_STATE_OK 4 |
165 | 165 | ||
166 | /* What state the device is in if it is a hybrid */ | ||
167 | #define PVR2_PATHWAY_UNKNOWN 0 | ||
168 | #define PVR2_PATHWAY_ANALOG 1 | ||
169 | #define PVR2_PATHWAY_DIGITAL 2 | ||
170 | |||
166 | typedef int (*pvr2_i2c_func)(struct pvr2_hdw *,u8,u8 *,u16,u8 *, u16); | 171 | typedef int (*pvr2_i2c_func)(struct pvr2_hdw *,u8,u8 *,u16,u8 *, u16); |
167 | #define PVR2_I2C_FUNC_CNT 128 | 172 | #define PVR2_I2C_FUNC_CNT 128 |
168 | 173 | ||
@@ -229,6 +234,7 @@ struct pvr2_hdw { | |||
229 | 234 | ||
230 | /* Bits of state that describe what is going on with various parts | 235 | /* Bits of state that describe what is going on with various parts |
231 | of the driver. */ | 236 | of the driver. */ |
237 | int state_pathway_ok; /* Pathway config is ok */ | ||
232 | int state_encoder_ok; /* Encoder is operational */ | 238 | int state_encoder_ok; /* Encoder is operational */ |
233 | int state_encoder_run; /* Encoder is running */ | 239 | int state_encoder_run; /* Encoder is running */ |
234 | int state_encoder_config; /* Encoder is configured */ | 240 | int state_encoder_config; /* Encoder is configured */ |
@@ -267,6 +273,7 @@ struct pvr2_hdw { | |||
267 | int flag_disconnected; /* flag_ok == 0 due to disconnect */ | 273 | int flag_disconnected; /* flag_ok == 0 due to disconnect */ |
268 | int flag_init_ok; /* true if structure is fully initialized */ | 274 | int flag_init_ok; /* true if structure is fully initialized */ |
269 | int fw1_state; /* current situation with fw1 */ | 275 | int fw1_state; /* current situation with fw1 */ |
276 | int pathway_state; /* one of PVR2_PATHWAY_xxx */ | ||
270 | int flag_decoder_missed;/* We've noticed missing decoder */ | 277 | int flag_decoder_missed;/* We've noticed missing decoder */ |
271 | int flag_tripped; /* Indicates overall failure to start */ | 278 | int flag_tripped; /* Indicates overall failure to start */ |
272 | 279 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 7016d3eda324..0941f0b434b7 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -1860,6 +1860,14 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, | |||
1860 | if (hdw_desc->flag_has_fmradio) m |= 1 << PVR2_CVAL_INPUT_RADIO; | 1860 | if (hdw_desc->flag_has_fmradio) m |= 1 << PVR2_CVAL_INPUT_RADIO; |
1861 | hdw->input_avail_mask = m; | 1861 | hdw->input_avail_mask = m; |
1862 | 1862 | ||
1863 | /* If not a hybrid device, pathway_state never changes. So | ||
1864 | initialize it here to what it should forever be. */ | ||
1865 | if (!(hdw->input_avail_mask & (1 << PVR2_CVAL_INPUT_DTV))) { | ||
1866 | hdw->pathway_state = PVR2_PATHWAY_ANALOG; | ||
1867 | } else if (!(hdw->input_avail_mask & (1 << PVR2_CVAL_INPUT_TV))) { | ||
1868 | hdw->pathway_state = PVR2_PATHWAY_DIGITAL; | ||
1869 | } | ||
1870 | |||
1863 | hdw->control_cnt = CTRLDEF_COUNT; | 1871 | hdw->control_cnt = CTRLDEF_COUNT; |
1864 | hdw->control_cnt += MPEGDEF_COUNT; | 1872 | hdw->control_cnt += MPEGDEF_COUNT; |
1865 | hdw->controls = kzalloc(sizeof(struct pvr2_ctrl) * hdw->control_cnt, | 1873 | hdw->controls = kzalloc(sizeof(struct pvr2_ctrl) * hdw->control_cnt, |
@@ -2380,6 +2388,17 @@ static int pvr2_hdw_commit_execute(struct pvr2_hdw *hdw) | |||
2380 | } | 2388 | } |
2381 | } | 2389 | } |
2382 | 2390 | ||
2391 | if (hdw->input_dirty && | ||
2392 | (((hdw->input_val == PVR2_CVAL_INPUT_DTV) ? | ||
2393 | PVR2_PATHWAY_DIGITAL : PVR2_PATHWAY_ANALOG) != | ||
2394 | hdw->pathway_state)) { | ||
2395 | /* Change of mode being asked for... */ | ||
2396 | hdw->state_pathway_ok = 0; | ||
2397 | } | ||
2398 | if (!hdw->state_pathway_ok) { | ||
2399 | /* Can't commit anything until pathway is ok. */ | ||
2400 | return 0; | ||
2401 | } | ||
2383 | /* If any of the below has changed, then we can't do the update | 2402 | /* If any of the below has changed, then we can't do the update |
2384 | while the pipeline is running. Pipeline must be paused first | 2403 | while the pipeline is running. Pipeline must be paused first |
2385 | and decoder -> encoder connection be made quiescent before we | 2404 | and decoder -> encoder connection be made quiescent before we |
@@ -2436,9 +2455,11 @@ static int pvr2_hdw_commit_execute(struct pvr2_hdw *hdw) | |||
2436 | /* Now execute i2c core update */ | 2455 | /* Now execute i2c core update */ |
2437 | pvr2_i2c_core_sync(hdw); | 2456 | pvr2_i2c_core_sync(hdw); |
2438 | 2457 | ||
2439 | if (hdw->state_encoder_run) { | 2458 | if ((hdw->pathway_state == PVR2_PATHWAY_ANALOG) && |
2440 | /* If encoder isn't running, then this will get worked out | 2459 | hdw->state_encoder_run) { |
2441 | later when we start the encoder. */ | 2460 | /* If encoder isn't running or it can't be touched, then |
2461 | this will get worked out later when we start the | ||
2462 | encoder. */ | ||
2442 | if (pvr2_encoder_adjust(hdw) < 0) return !0; | 2463 | if (pvr2_encoder_adjust(hdw) < 0) return !0; |
2443 | } | 2464 | } |
2444 | 2465 | ||
@@ -3243,12 +3264,14 @@ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw) | |||
3243 | } | 3264 | } |
3244 | 3265 | ||
3245 | 3266 | ||
3246 | int pvr2_hdw_cmd_hcw_demod_reset(struct pvr2_hdw *hdw, int onoff) | 3267 | static int pvr2_hdw_cmd_hcw_demod_reset(struct pvr2_hdw *hdw, int onoff) |
3247 | { | 3268 | { |
3248 | int status; | 3269 | int status; |
3249 | 3270 | ||
3250 | LOCK_TAKE(hdw->ctl_lock); do { | 3271 | LOCK_TAKE(hdw->ctl_lock); do { |
3251 | pvr2_trace(PVR2_TRACE_INIT, "Issuing fe demod wake command"); | 3272 | pvr2_trace(PVR2_TRACE_INIT, |
3273 | "Issuing fe demod wake command (%s)", | ||
3274 | (onoff ? "on" : "off")); | ||
3252 | hdw->flag_ok = !0; | 3275 | hdw->flag_ok = !0; |
3253 | hdw->cmd_buffer[0] = FX2CMD_HCW_DEMOD_RESETIN; | 3276 | hdw->cmd_buffer[0] = FX2CMD_HCW_DEMOD_RESETIN; |
3254 | hdw->cmd_buffer[1] = onoff; | 3277 | hdw->cmd_buffer[1] = onoff; |
@@ -3258,24 +3281,15 @@ int pvr2_hdw_cmd_hcw_demod_reset(struct pvr2_hdw *hdw, int onoff) | |||
3258 | return status; | 3281 | return status; |
3259 | } | 3282 | } |
3260 | 3283 | ||
3261 | int pvr2_hdw_cmd_hcw_usbstream_dvb(struct pvr2_hdw *hdw, int onoff) | ||
3262 | { | ||
3263 | int status; | ||
3264 | LOCK_TAKE(hdw->ctl_lock); do { | ||
3265 | hdw->cmd_buffer[0] = | ||
3266 | (onoff ? FX2CMD_HCW_DTV_STREAMING_ON : | ||
3267 | FX2CMD_HCW_DTV_STREAMING_OFF); | ||
3268 | status = pvr2_send_request(hdw, hdw->cmd_buffer, 1, NULL, 0); | ||
3269 | } while (0); LOCK_GIVE(hdw->ctl_lock); | ||
3270 | return status; | ||
3271 | } | ||
3272 | 3284 | ||
3273 | int pvr2_hdw_cmd_onair_fe_power_ctrl(struct pvr2_hdw *hdw, int onoff) | 3285 | static int pvr2_hdw_cmd_onair_fe_power_ctrl(struct pvr2_hdw *hdw, int onoff) |
3274 | { | 3286 | { |
3275 | int status; | 3287 | int status; |
3276 | 3288 | ||
3277 | LOCK_TAKE(hdw->ctl_lock); do { | 3289 | LOCK_TAKE(hdw->ctl_lock); do { |
3278 | pvr2_trace(PVR2_TRACE_INIT, "Issuing fe power command to CPLD"); | 3290 | pvr2_trace(PVR2_TRACE_INIT, |
3291 | "Issuing fe power command to CPLD (%s)", | ||
3292 | (onoff ? "on" : "off")); | ||
3279 | hdw->flag_ok = !0; | 3293 | hdw->flag_ok = !0; |
3280 | hdw->cmd_buffer[0] = | 3294 | hdw->cmd_buffer[0] = |
3281 | (onoff ? FX2CMD_ONAIR_DTV_POWER_ON : | 3295 | (onoff ? FX2CMD_ONAIR_DTV_POWER_ON : |
@@ -3286,10 +3300,15 @@ int pvr2_hdw_cmd_onair_fe_power_ctrl(struct pvr2_hdw *hdw, int onoff) | |||
3286 | return status; | 3300 | return status; |
3287 | } | 3301 | } |
3288 | 3302 | ||
3289 | int pvr2_hdw_cmd_onair_digital_path_ctrl(struct pvr2_hdw *hdw, int onoff) | 3303 | |
3304 | static int pvr2_hdw_cmd_onair_digital_path_ctrl(struct pvr2_hdw *hdw, | ||
3305 | int onoff) | ||
3290 | { | 3306 | { |
3291 | int status; | 3307 | int status; |
3292 | LOCK_TAKE(hdw->ctl_lock); do { | 3308 | LOCK_TAKE(hdw->ctl_lock); do { |
3309 | pvr2_trace(PVR2_TRACE_INIT, | ||
3310 | "Issuing onair digital setup command (%s)", | ||
3311 | (onoff ? "on" : "off")); | ||
3293 | hdw->cmd_buffer[0] = | 3312 | hdw->cmd_buffer[0] = |
3294 | (onoff ? FX2CMD_ONAIR_DTV_STREAMING_ON : | 3313 | (onoff ? FX2CMD_ONAIR_DTV_STREAMING_ON : |
3295 | FX2CMD_ONAIR_DTV_STREAMING_OFF); | 3314 | FX2CMD_ONAIR_DTV_STREAMING_OFF); |
@@ -3298,19 +3317,85 @@ int pvr2_hdw_cmd_onair_digital_path_ctrl(struct pvr2_hdw *hdw, int onoff) | |||
3298 | return status; | 3317 | return status; |
3299 | } | 3318 | } |
3300 | 3319 | ||
3320 | |||
3321 | static void pvr2_hdw_cmd_modeswitch(struct pvr2_hdw *hdw,int digitalFl) | ||
3322 | { | ||
3323 | int cmode; | ||
3324 | /* Compare digital/analog desired setting with current setting. If | ||
3325 | they don't match, fix it... */ | ||
3326 | cmode = (digitalFl ? PVR2_PATHWAY_DIGITAL : PVR2_PATHWAY_ANALOG); | ||
3327 | if (cmode == hdw->pathway_state) { | ||
3328 | /* They match; nothing to do */ | ||
3329 | return; | ||
3330 | } | ||
3331 | |||
3332 | switch (hdw->hdw_desc->digital_control_scheme) { | ||
3333 | case PVR2_DIGITAL_SCHEME_HAUPPAUGE: | ||
3334 | pvr2_hdw_cmd_hcw_demod_reset(hdw,digitalFl); | ||
3335 | if (cmode == PVR2_PATHWAY_ANALOG) { | ||
3336 | /* If moving to analog mode, also force the decoder | ||
3337 | to reset. If no decoder is attached, then it's | ||
3338 | ok to ignore this because if/when the decoder | ||
3339 | attaches, it will reset itself at that time. */ | ||
3340 | pvr2_hdw_cmd_decoder_reset(hdw); | ||
3341 | } | ||
3342 | break; | ||
3343 | case PVR2_DIGITAL_SCHEME_ONAIR: | ||
3344 | /* Supposedly we should always have the power on whether in | ||
3345 | digital or analog mode. But for now do what appears to | ||
3346 | work... */ | ||
3347 | if (digitalFl) pvr2_hdw_cmd_onair_fe_power_ctrl(hdw,!0); | ||
3348 | pvr2_hdw_cmd_onair_digital_path_ctrl(hdw,digitalFl); | ||
3349 | if (!digitalFl) pvr2_hdw_cmd_onair_fe_power_ctrl(hdw,0); | ||
3350 | break; | ||
3351 | default: break; | ||
3352 | } | ||
3353 | |||
3354 | hdw->pathway_state = cmode; | ||
3355 | } | ||
3356 | |||
3357 | |||
3301 | /* Stop / start video stream transport */ | 3358 | /* Stop / start video stream transport */ |
3302 | static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl) | 3359 | static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl) |
3303 | { | 3360 | { |
3304 | int status; | 3361 | int status,cc; |
3362 | if ((hdw->pathway_state == PVR2_PATHWAY_DIGITAL) && | ||
3363 | hdw->hdw_desc->digital_control_scheme == | ||
3364 | PVR2_DIGITAL_SCHEME_HAUPPAUGE) { | ||
3365 | cc = (runFl ? | ||
3366 | FX2CMD_HCW_DTV_STREAMING_ON : | ||
3367 | FX2CMD_HCW_DTV_STREAMING_OFF); | ||
3368 | } else { | ||
3369 | cc = (runFl ? | ||
3370 | FX2CMD_STREAMING_ON : | ||
3371 | FX2CMD_STREAMING_OFF); | ||
3372 | } | ||
3373 | |||
3305 | LOCK_TAKE(hdw->ctl_lock); do { | 3374 | LOCK_TAKE(hdw->ctl_lock); do { |
3306 | hdw->cmd_buffer[0] = | 3375 | hdw->cmd_buffer[0] = cc; |
3307 | (runFl ? FX2CMD_STREAMING_ON : FX2CMD_STREAMING_OFF); | ||
3308 | status = pvr2_send_request(hdw,hdw->cmd_buffer,1,NULL,0); | 3376 | status = pvr2_send_request(hdw,hdw->cmd_buffer,1,NULL,0); |
3309 | } while (0); LOCK_GIVE(hdw->ctl_lock); | 3377 | } while (0); LOCK_GIVE(hdw->ctl_lock); |
3310 | return status; | 3378 | return status; |
3311 | } | 3379 | } |
3312 | 3380 | ||
3313 | 3381 | ||
3382 | /* Evaluate whether or not state_pathway_ok can change */ | ||
3383 | static int state_eval_pathway_ok(struct pvr2_hdw *hdw) | ||
3384 | { | ||
3385 | if (hdw->state_pathway_ok) { | ||
3386 | /* Nothing to do if pathway is already ok */ | ||
3387 | return 0; | ||
3388 | } | ||
3389 | if (!hdw->state_pipeline_idle) { | ||
3390 | /* Not allowed to change anything if pipeline is not idle */ | ||
3391 | return 0; | ||
3392 | } | ||
3393 | pvr2_hdw_cmd_modeswitch(hdw,hdw->input_val == PVR2_CVAL_INPUT_DTV); | ||
3394 | hdw->state_pathway_ok = !0; | ||
3395 | return !0; | ||
3396 | } | ||
3397 | |||
3398 | |||
3314 | /* Evaluate whether or not state_encoder_ok can change */ | 3399 | /* Evaluate whether or not state_encoder_ok can change */ |
3315 | static int state_eval_encoder_ok(struct pvr2_hdw *hdw) | 3400 | static int state_eval_encoder_ok(struct pvr2_hdw *hdw) |
3316 | { | 3401 | { |
@@ -3320,6 +3405,7 @@ static int state_eval_encoder_ok(struct pvr2_hdw *hdw) | |||
3320 | if (hdw->state_encoder_config) return 0; | 3405 | if (hdw->state_encoder_config) return 0; |
3321 | if (hdw->state_decoder_run) return 0; | 3406 | if (hdw->state_decoder_run) return 0; |
3322 | if (hdw->state_usbstream_run) return 0; | 3407 | if (hdw->state_usbstream_run) return 0; |
3408 | if (hdw->pathway_state != PVR2_PATHWAY_ANALOG) return 0; | ||
3323 | if (pvr2_upload_firmware2(hdw) < 0) { | 3409 | if (pvr2_upload_firmware2(hdw) < 0) { |
3324 | hdw->flag_tripped = !0; | 3410 | hdw->flag_tripped = !0; |
3325 | trace_stbit("flag_tripped",hdw->flag_tripped); | 3411 | trace_stbit("flag_tripped",hdw->flag_tripped); |
@@ -3345,7 +3431,9 @@ static int state_eval_encoder_config(struct pvr2_hdw *hdw) | |||
3345 | /* paranoia - solve race if timer just completed */ | 3431 | /* paranoia - solve race if timer just completed */ |
3346 | del_timer_sync(&hdw->encoder_wait_timer); | 3432 | del_timer_sync(&hdw->encoder_wait_timer); |
3347 | } else { | 3433 | } else { |
3348 | if (!hdw->state_encoder_ok || | 3434 | if (!hdw->state_pathway_ok || |
3435 | (hdw->pathway_state != PVR2_PATHWAY_ANALOG) || | ||
3436 | !hdw->state_encoder_ok || | ||
3349 | !hdw->state_pipeline_idle || | 3437 | !hdw->state_pipeline_idle || |
3350 | hdw->state_pipeline_pause || | 3438 | hdw->state_pipeline_pause || |
3351 | !hdw->state_pipeline_req || | 3439 | !hdw->state_pipeline_req || |
@@ -3399,13 +3487,16 @@ static int state_eval_encoder_run(struct pvr2_hdw *hdw) | |||
3399 | { | 3487 | { |
3400 | if (hdw->state_encoder_run) { | 3488 | if (hdw->state_encoder_run) { |
3401 | if (hdw->state_encoder_ok) { | 3489 | if (hdw->state_encoder_ok) { |
3402 | if (hdw->state_decoder_run) return 0; | 3490 | if (hdw->state_decoder_run && |
3491 | hdw->state_pathway_ok) return 0; | ||
3403 | if (pvr2_encoder_stop(hdw) < 0) return !0; | 3492 | if (pvr2_encoder_stop(hdw) < 0) return !0; |
3404 | } | 3493 | } |
3405 | hdw->state_encoder_run = 0; | 3494 | hdw->state_encoder_run = 0; |
3406 | } else { | 3495 | } else { |
3407 | if (!hdw->state_encoder_ok) return 0; | 3496 | if (!hdw->state_encoder_ok) return 0; |
3408 | if (!hdw->state_decoder_run) return 0; | 3497 | if (!hdw->state_decoder_run) return 0; |
3498 | if (!hdw->state_pathway_ok) return 0; | ||
3499 | if (hdw->pathway_state != PVR2_PATHWAY_ANALOG) return 0; | ||
3409 | if (pvr2_encoder_start(hdw) < 0) return !0; | 3500 | if (pvr2_encoder_start(hdw) < 0) return !0; |
3410 | hdw->state_encoder_run = !0; | 3501 | hdw->state_encoder_run = !0; |
3411 | } | 3502 | } |
@@ -3442,7 +3533,8 @@ static int state_eval_decoder_run(struct pvr2_hdw *hdw) | |||
3442 | if (hdw->state_decoder_run) { | 3533 | if (hdw->state_decoder_run) { |
3443 | if (hdw->state_encoder_ok) { | 3534 | if (hdw->state_encoder_ok) { |
3444 | if (hdw->state_pipeline_req && | 3535 | if (hdw->state_pipeline_req && |
3445 | !hdw->state_pipeline_pause) return 0; | 3536 | !hdw->state_pipeline_pause && |
3537 | hdw->state_pathway_ok) return 0; | ||
3446 | } | 3538 | } |
3447 | if (!hdw->flag_decoder_missed) { | 3539 | if (!hdw->flag_decoder_missed) { |
3448 | pvr2_decoder_enable(hdw,0); | 3540 | pvr2_decoder_enable(hdw,0); |
@@ -3475,7 +3567,9 @@ static int state_eval_decoder_run(struct pvr2_hdw *hdw) | |||
3475 | hopefully further stabilize the encoder. */ | 3567 | hopefully further stabilize the encoder. */ |
3476 | return 0; | 3568 | return 0; |
3477 | } | 3569 | } |
3478 | if (!hdw->state_pipeline_req || | 3570 | if (!hdw->state_pathway_ok || |
3571 | (hdw->pathway_state != PVR2_PATHWAY_ANALOG) || | ||
3572 | !hdw->state_pipeline_req || | ||
3479 | hdw->state_pipeline_pause || | 3573 | hdw->state_pipeline_pause || |
3480 | !hdw->state_pipeline_config || | 3574 | !hdw->state_pipeline_config || |
3481 | !hdw->state_encoder_config || | 3575 | !hdw->state_encoder_config || |
@@ -3496,16 +3590,25 @@ static int state_eval_decoder_run(struct pvr2_hdw *hdw) | |||
3496 | static int state_eval_usbstream_run(struct pvr2_hdw *hdw) | 3590 | static int state_eval_usbstream_run(struct pvr2_hdw *hdw) |
3497 | { | 3591 | { |
3498 | if (hdw->state_usbstream_run) { | 3592 | if (hdw->state_usbstream_run) { |
3499 | if (hdw->state_encoder_ok) { | 3593 | if (hdw->pathway_state == PVR2_PATHWAY_ANALOG) { |
3500 | if (hdw->state_encoder_run) return 0; | 3594 | if (hdw->state_encoder_ok && |
3595 | hdw->state_encoder_run && | ||
3596 | hdw->state_pathway_ok) return 0; | ||
3597 | } else { | ||
3598 | if (hdw->state_pipeline_req && | ||
3599 | !hdw->state_pipeline_pause && | ||
3600 | hdw->state_pathway_ok) return 0; | ||
3501 | } | 3601 | } |
3502 | pvr2_hdw_cmd_usbstream(hdw,0); | 3602 | pvr2_hdw_cmd_usbstream(hdw,0); |
3503 | hdw->state_usbstream_run = 0; | 3603 | hdw->state_usbstream_run = 0; |
3504 | } else { | 3604 | } else { |
3505 | if (!hdw->state_encoder_ok || | 3605 | if (!hdw->state_pipeline_req || |
3506 | !hdw->state_encoder_run || | 3606 | hdw->state_pipeline_pause || |
3507 | !hdw->state_pipeline_req || | 3607 | !hdw->state_pathway_ok) return 0; |
3508 | hdw->state_pipeline_pause) return 0; | 3608 | if (hdw->pathway_state == PVR2_PATHWAY_ANALOG) { |
3609 | if (!hdw->state_encoder_ok || | ||
3610 | !hdw->state_encoder_run) return 0; | ||
3611 | } | ||
3509 | if (pvr2_hdw_cmd_usbstream(hdw,!0) < 0) return 0; | 3612 | if (pvr2_hdw_cmd_usbstream(hdw,!0) < 0) return 0; |
3510 | hdw->state_usbstream_run = !0; | 3613 | hdw->state_usbstream_run = !0; |
3511 | } | 3614 | } |
@@ -3552,6 +3655,7 @@ typedef int (*state_eval_func)(struct pvr2_hdw *); | |||
3552 | 3655 | ||
3553 | /* Set of functions to be run to evaluate various states in the driver. */ | 3656 | /* Set of functions to be run to evaluate various states in the driver. */ |
3554 | const static state_eval_func eval_funcs[] = { | 3657 | const static state_eval_func eval_funcs[] = { |
3658 | state_eval_pathway_ok, | ||
3555 | state_eval_pipeline_config, | 3659 | state_eval_pipeline_config, |
3556 | state_eval_encoder_ok, | 3660 | state_eval_encoder_ok, |
3557 | state_eval_encoder_config, | 3661 | state_eval_encoder_config, |
@@ -3599,6 +3703,16 @@ static int pvr2_hdw_state_update(struct pvr2_hdw *hdw) | |||
3599 | } | 3703 | } |
3600 | 3704 | ||
3601 | 3705 | ||
3706 | static const char *pvr2_pathway_state_name(int id) | ||
3707 | { | ||
3708 | switch (id) { | ||
3709 | case PVR2_PATHWAY_ANALOG: return "analog"; | ||
3710 | case PVR2_PATHWAY_DIGITAL: return "digital"; | ||
3711 | default: return "unknown"; | ||
3712 | } | ||
3713 | } | ||
3714 | |||
3715 | |||
3602 | static unsigned int pvr2_hdw_report_unlocked(struct pvr2_hdw *hdw,int which, | 3716 | static unsigned int pvr2_hdw_report_unlocked(struct pvr2_hdw *hdw,int which, |
3603 | char *buf,unsigned int acnt) | 3717 | char *buf,unsigned int acnt) |
3604 | { | 3718 | { |
@@ -3606,13 +3720,15 @@ static unsigned int pvr2_hdw_report_unlocked(struct pvr2_hdw *hdw,int which, | |||
3606 | case 0: | 3720 | case 0: |
3607 | return scnprintf( | 3721 | return scnprintf( |
3608 | buf,acnt, | 3722 | buf,acnt, |
3609 | "driver:%s%s%s%s%s", | 3723 | "driver:%s%s%s%s%s<mode=%s>", |
3610 | (hdw->flag_ok ? " <ok>" : " <fail>"), | 3724 | (hdw->flag_ok ? " <ok>" : " <fail>"), |
3611 | (hdw->flag_init_ok ? " <init>" : " <uninitialized>"), | 3725 | (hdw->flag_init_ok ? " <init>" : " <uninitialized>"), |
3612 | (hdw->flag_disconnected ? " <disconnected>" : | 3726 | (hdw->flag_disconnected ? " <disconnected>" : |
3613 | " <connected>"), | 3727 | " <connected>"), |
3614 | (hdw->flag_tripped ? " <tripped>" : ""), | 3728 | (hdw->flag_tripped ? " <tripped>" : ""), |
3615 | (hdw->flag_decoder_missed ? " <no decoder>" : "")); | 3729 | (hdw->flag_decoder_missed ? " <no decoder>" : ""), |
3730 | pvr2_pathway_state_name(hdw->pathway_state)); | ||
3731 | |||
3616 | case 1: | 3732 | case 1: |
3617 | return scnprintf( | 3733 | return scnprintf( |
3618 | buf,acnt, | 3734 | buf,acnt, |
@@ -3625,7 +3741,7 @@ static unsigned int pvr2_hdw_report_unlocked(struct pvr2_hdw *hdw,int which, | |||
3625 | case 2: | 3741 | case 2: |
3626 | return scnprintf( | 3742 | return scnprintf( |
3627 | buf,acnt, | 3743 | buf,acnt, |
3628 | "worker:%s%s%s%s%s%s", | 3744 | "worker:%s%s%s%s%s%s%s", |
3629 | (hdw->state_decoder_run ? | 3745 | (hdw->state_decoder_run ? |
3630 | " <decode:run>" : | 3746 | " <decode:run>" : |
3631 | (hdw->state_decoder_quiescent ? | 3747 | (hdw->state_decoder_quiescent ? |
@@ -3641,7 +3757,9 @@ static unsigned int pvr2_hdw_report_unlocked(struct pvr2_hdw *hdw,int which, | |||
3641 | (hdw->state_encoder_waitok ? | 3757 | (hdw->state_encoder_waitok ? |
3642 | "" : " <encode:wait>")), | 3758 | "" : " <encode:wait>")), |
3643 | (hdw->state_usbstream_run ? | 3759 | (hdw->state_usbstream_run ? |
3644 | " <usb:run>" : " <usb:stop>")); | 3760 | " <usb:run>" : " <usb:stop>"), |
3761 | (hdw->state_pathway_ok ? | ||
3762 | "<pathway:ok>" : "")); | ||
3645 | break; | 3763 | break; |
3646 | case 3: | 3764 | case 3: |
3647 | return scnprintf( | 3765 | return scnprintf( |
@@ -3713,9 +3831,9 @@ static int pvr2_hdw_state_eval(struct pvr2_hdw *hdw) | |||
3713 | st = PVR2_STATE_WARM; | 3831 | st = PVR2_STATE_WARM; |
3714 | } else if (hdw->flag_tripped || hdw->flag_decoder_missed) { | 3832 | } else if (hdw->flag_tripped || hdw->flag_decoder_missed) { |
3715 | st = PVR2_STATE_ERROR; | 3833 | st = PVR2_STATE_ERROR; |
3716 | } else if (hdw->state_encoder_run && | 3834 | } else if (hdw->state_usbstream_run && |
3717 | hdw->state_decoder_run && | 3835 | ((hdw->pathway_state != PVR2_PATHWAY_ANALOG) || |
3718 | hdw->state_usbstream_run) { | 3836 | (hdw->state_encoder_run && hdw->state_decoder_run))) { |
3719 | st = PVR2_STATE_RUN; | 3837 | st = PVR2_STATE_RUN; |
3720 | } else { | 3838 | } else { |
3721 | st = PVR2_STATE_READY; | 3839 | st = PVR2_STATE_READY; |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h index e9090c5064d8..57e1ff491497 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h | |||
@@ -258,14 +258,6 @@ int pvr2_hdw_cmd_powerup(struct pvr2_hdw *); | |||
258 | /* suspend */ | 258 | /* suspend */ |
259 | int pvr2_hdw_cmd_powerdown(struct pvr2_hdw *); | 259 | int pvr2_hdw_cmd_powerdown(struct pvr2_hdw *); |
260 | 260 | ||
261 | /* Hauppauge - specific */ | ||
262 | int pvr2_hdw_cmd_hcw_demod_reset(struct pvr2_hdw *hdw, int onoff); | ||
263 | int pvr2_hdw_cmd_hcw_usbstream_dvb(struct pvr2_hdw *hdw, int onoff); | ||
264 | |||
265 | /* onair - specific */ | ||
266 | int pvr2_hdw_cmd_onair_fe_power_ctrl(struct pvr2_hdw *hdw, int onoff); | ||
267 | int pvr2_hdw_cmd_onair_digital_path_ctrl(struct pvr2_hdw *hdw, int onoff); | ||
268 | |||
269 | /* Order decoder to reset */ | 261 | /* Order decoder to reset */ |
270 | int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *); | 262 | int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *); |
271 | 263 | ||