Exemplo n.º 1
0
static u32 vcd_stop_cmn(struct vcd_clnt_ctxt *cctxt)
{
	struct vcd_dev_ctxt *dev_ctxt = cctxt->dev_ctxt;
	u32 rc = VCD_S_SUCCESS;
	struct vcd_transc *transc;

	VCD_MSG_LOW("vcd_stop_cmn in %d:", cctxt->clnt_state.state);

	rc = vcd_flush_buffers(cctxt, VCD_FLUSH_ALL);

	VCD_FAILED_RETURN(rc, "Failed: vcd_flush_buffers");

	if (!cctxt->status.frame_submitted) {

		if (vcd_get_command_channel(dev_ctxt, &transc)) {
			rc = vcd_power_event(dev_ctxt, cctxt,
				VCD_EVT_PWR_CLNT_CMD_BEGIN);

			if (!VCD_FAILED(rc)) {
				transc->type = VCD_CMD_CODEC_STOP;
				transc->cctxt = cctxt;

				rc = vcd_submit_cmd_sess_end(transc);
			} else {
				VCD_MSG_ERROR("Failed:"
					" VCD_EVT_PWR_CLNT_CMD_BEGIN");
			}

			if (VCD_FAILED(rc)) {
				vcd_release_command_channel(dev_ctxt,
							    transc);
			}

		} else {
			vcd_client_cmd_flush_and_en_q(cctxt,
						      VCD_CMD_CODEC_STOP);
		}
	}

	if (VCD_FAILED(rc)) {
		(void)vcd_power_event(dev_ctxt, cctxt,
				      VCD_EVT_PWR_CLNT_CMD_FAIL);
	} else {
		vcd_do_client_state_transition(cctxt,
					       VCD_CLIENT_STATE_STOPPING,
					       CLIENT_STATE_EVENT_NUMBER
					       (stop));
	}

	return rc;
}
Exemplo n.º 2
0
void vcd_continue(void)
{
	struct vcd_drv_ctxt *drv_ctxt;
	struct vcd_dev_ctxt *dev_ctxt;
	u32 command_continue;
	struct vcd_transc *transc;
	u32 rc;
	VCD_MSG_LOW("vcd_continue:");

	drv_ctxt = vcd_get_drv_context();
	dev_ctxt = &drv_ctxt->dev_ctxt;

	dev_ctxt->command_continue = false;

	if (dev_ctxt->pending_cmd == VCD_CMD_DEVICE_INIT) {
		VCD_MSG_HIGH("VCD_CMD_DEVICE_INIT is pending");

		dev_ctxt->pending_cmd = VCD_CMD_NONE;

		(void)vcd_init_device_context(drv_ctxt,
			DEVICE_STATE_EVENT_NUMBER(open));
	} else if (dev_ctxt->pending_cmd == VCD_CMD_DEVICE_TERM) {
		VCD_MSG_HIGH("VCD_CMD_DEVICE_TERM is pending");

		dev_ctxt->pending_cmd = VCD_CMD_NONE;

		(void)vcd_deinit_device_context(drv_ctxt,
			DEVICE_STATE_EVENT_NUMBER(close));
	} else if (dev_ctxt->pending_cmd == VCD_CMD_DEVICE_RESET) {
		VCD_MSG_HIGH("VCD_CMD_DEVICE_RESET is pending");
		dev_ctxt->pending_cmd = VCD_CMD_NONE;
		(void)vcd_reset_device_context(drv_ctxt,
			DEVICE_STATE_EVENT_NUMBER(dev_cb));
	} else {
		if (dev_ctxt->set_perf_lvl_pending) {
			rc = vcd_power_event(dev_ctxt, NULL,
						 VCD_EVT_PWR_DEV_SET_PERFLVL);

			if (VCD_FAILED(rc)) {
				VCD_MSG_ERROR
					("VCD_EVT_PWR_CLNT_SET_PERFLVL failed");
				VCD_MSG_HIGH
					("Not running at desired perf level."
					 "curr=%d, reqd=%d",
					 dev_ctxt->curr_perf_lvl,
					 dev_ctxt->reqd_perf_lvl);
			} else {
				dev_ctxt->set_perf_lvl_pending = false;
			}
		}

		do {
			command_continue = false;

			if (vcd_get_command_channel_in_loop
				(dev_ctxt, &transc)) {
				if (vcd_submit_command_in_continue(dev_ctxt,
					transc))
					command_continue = true;
				else {
					VCD_MSG_MED
						("No more commands to submit");

					vcd_release_command_channel(dev_ctxt,
						transc);

					vcd_release_interim_command_channels
						(dev_ctxt);
				}
			}
		} while (command_continue);

		do {
			command_continue = false;

			if (vcd_get_frame_channel_in_loop
				(dev_ctxt, &transc)) {
				if (vcd_try_submit_frame_in_continue(dev_ctxt,
					transc)) {
					command_continue = true;
				} else {
					VCD_MSG_MED("No more frames to submit");

					vcd_release_frame_channel(dev_ctxt,
								  transc);

					vcd_release_interim_frame_channels
						(dev_ctxt);
				}
			}

		} while (command_continue);

		if (!vcd_core_is_busy(dev_ctxt)) {
			rc = vcd_power_event(dev_ctxt, NULL,
				VCD_EVT_PWR_CLNT_CMD_END);

			if (VCD_FAILED(rc))
				VCD_MSG_ERROR("Failed:"
					"VCD_EVT_PWR_CLNT_CMD_END");
		}
	}
}
void vcd_continue(void)
{
    struct vcd_drv_ctxt_type_t *p_drv_ctxt;
    struct vcd_dev_ctxt_type *p_dev_ctxt;
    u32 b_continue;
    struct vcd_transc_type *p_transc;
    u32 rc;
    VCD_MSG_LOW("vcd_continue:");

    p_drv_ctxt = vcd_get_drv_context();
    p_dev_ctxt = &p_drv_ctxt->dev_ctxt;

    p_dev_ctxt->b_continue = FALSE;

    if (p_dev_ctxt->e_pending_cmd == VCD_CMD_DEVICE_INIT) {
        VCD_MSG_HIGH("VCD_CMD_DEVICE_INIT is pending");

        p_dev_ctxt->e_pending_cmd = VCD_CMD_NONE;

        (void)vcd_init_device_context(p_drv_ctxt,
                                      DEVICE_STATE_EVENT_NUMBER(pf_open));
    } else if (p_dev_ctxt->e_pending_cmd == VCD_CMD_DEVICE_TERM) {
        VCD_MSG_HIGH("VCD_CMD_DEVICE_TERM is pending");

        p_dev_ctxt->e_pending_cmd = VCD_CMD_NONE;

        (void)vcd_deinit_device_context(p_drv_ctxt,
                                        DEVICE_STATE_EVENT_NUMBER(pf_close));
    } else if (p_dev_ctxt->e_pending_cmd == VCD_CMD_DEVICE_RESET) {
        VCD_MSG_HIGH("VCD_CMD_DEVICE_RESET is pending");
        p_dev_ctxt->e_pending_cmd = VCD_CMD_NONE;
        (void)vcd_reset_device_context(p_drv_ctxt,
                                       DEVICE_STATE_EVENT_NUMBER(pf_dev_cb));
    } else {
        if (p_dev_ctxt->b_set_perf_lvl_pending) {
            rc = vcd_power_event(p_dev_ctxt, NULL,
                                 VCD_EVT_PWR_DEV_SET_PERFLVL);

            if (VCD_FAILED(rc)) {
                VCD_MSG_ERROR
                ("VCD_EVT_PWR_CLNT_SET_PERFLVL failed");
                VCD_MSG_HIGH
                ("Not running at desired perf level."
                 "curr=%d, reqd=%d",
                 p_dev_ctxt->n_curr_perf_lvl,
                 p_dev_ctxt->n_reqd_perf_lvl);
            } else {
                p_dev_ctxt->b_set_perf_lvl_pending = FALSE;
            }
        }

        do {
            b_continue = FALSE;

            if (vcd_get_command_channel_in_loop
                    (p_dev_ctxt, &p_transc)) {
                if (vcd_submit_command_in_continue(p_dev_ctxt,
                                                   p_transc))
                    b_continue = TRUE;
                else {
                    VCD_MSG_MED
                    ("No more commands to submit");

                    vcd_release_command_channel(p_dev_ctxt,
                                                p_transc);

                    vcd_release_interim_command_channels
                    (p_dev_ctxt);
                }
            }
        } while (b_continue);

        do {
            b_continue = FALSE;

            if (vcd_get_frame_channel_in_loop
                    (p_dev_ctxt, &p_transc)) {
                if (vcd_try_submit_frame_in_continue(p_dev_ctxt,
                                                     p_transc)) {
                    b_continue = TRUE;
                } else {
                    VCD_MSG_MED("No more frames to submit");

                    vcd_release_frame_channel(p_dev_ctxt,
                                              p_transc);

                    vcd_release_interim_frame_channels
                    (p_dev_ctxt);
                }
            }

        } while (b_continue);

        if (!vcd_core_is_busy(p_dev_ctxt)) {
            rc = vcd_power_event(p_dev_ctxt, NULL,
                                 VCD_EVT_PWR_CLNT_CMD_END);

            if (VCD_FAILED(rc))
                VCD_MSG_ERROR("Failed:"
                              "VCD_EVT_PWR_CLNT_CMD_END");
        }
    }
}