Пример #1
0
u32 vcd_client_power_event(struct vcd_dev_ctxt *dev_ctxt, struct vcd_clnt_ctxt
	*cctxt, u32 event)
{
	u32 rc = VCD_ERR_FAIL;

	switch (event) {
	case VCD_EVT_PWR_CLNT_CMD_BEGIN:
		rc = vcd_un_gate_clock(dev_ctxt);
		break;
	case VCD_EVT_PWR_CLNT_CMD_END:
		rc = vcd_gate_clock(dev_ctxt);
		break;
	case VCD_EVT_PWR_CLNT_CMD_FAIL:
		if (!vcd_core_is_busy(dev_ctxt))
			rc = vcd_gate_clock(dev_ctxt);
		break;
	case VCD_EVT_PWR_CLNT_PAUSE:
	case VCD_EVT_PWR_CLNT_LAST_FRAME:
	case VCD_EVT_PWR_CLNT_ERRFATAL:
		if (!cctxt)
			break;
		rc = VCD_S_SUCCESS;
		if (cctxt->status.req_perf_lvl) {
			dev_ctxt->reqd_perf_lvl -= cctxt->reqd_perf_lvl;
			cctxt->status.req_perf_lvl = false;

			rc = vcd_set_perf_level(dev_ctxt,
				dev_ctxt->reqd_perf_lvl, cctxt);
		}
		break;
	case VCD_EVT_PWR_CLNT_RESUME:
	case VCD_EVT_PWR_CLNT_FIRST_FRAME:
		if (!cctxt)
			break;
		rc = VCD_S_SUCCESS;
		if (!cctxt->status.req_perf_lvl) {
			dev_ctxt->reqd_perf_lvl += cctxt->reqd_perf_lvl;
			cctxt->status.req_perf_lvl = true;

			rc = vcd_set_perf_level(dev_ctxt,
				dev_ctxt->reqd_perf_lvl, cctxt);
		}
		break;
	}

	return rc;
}
u32 vcd_set_perf_level(struct vcd_dev_ctxt *dev_ctxt, u32 perf_lvl)
{
	u32 rc = VCD_S_SUCCESS;
	if (!vcd_core_is_busy(dev_ctxt)) {
		if (res_trk_set_perf_level(perf_lvl,
			&dev_ctxt->curr_perf_lvl, dev_ctxt)) {
			dev_ctxt->set_perf_lvl_pending = false;
		} else {
			rc = VCD_ERR_FAIL;
			dev_ctxt->set_perf_lvl_pending = true;
		}

	} else {
		dev_ctxt->set_perf_lvl_pending = true;
	}

	return rc;
}
Пример #3
0
u32 vcd_set_perf_level(struct vcd_dev_ctxt_type *p_dev_ctxt,
	u32 n_perf_lvl, struct vcd_clnt_ctxt_type_t *p_cctxt)
{
	u32 rc = VCD_S_SUCCESS;

	if (!vcd_core_is_busy(p_dev_ctxt)) {
		if (res_trk_set_perf_level(n_perf_lvl,
			&p_dev_ctxt->n_curr_perf_lvl, p_cctxt)) {
			p_dev_ctxt->b_set_perf_lvl_pending = FALSE;
		} else {
			rc = VCD_ERR_FAIL;
			p_dev_ctxt->b_set_perf_lvl_pending = TRUE;
		}

	} else {
		p_dev_ctxt->b_set_perf_lvl_pending = TRUE;
	}

	return rc;
}
Пример #4
0
u32 vcd_client_power_event(
	struct vcd_dev_ctxt_type *p_dev_ctxt,
    struct vcd_clnt_ctxt_type_t *p_cctxt, u32 event)
{
	u32 rc = VCD_ERR_FAIL;

	switch (event) {

	case VCD_EVT_PWR_CLNT_CMD_BEGIN:
		{
			rc = vcd_un_gate_clock(p_dev_ctxt);
			break;
		}

	case VCD_EVT_PWR_CLNT_CMD_END:
		{
			rc = vcd_gate_clock(p_dev_ctxt);
			break;
		}

	case VCD_EVT_PWR_CLNT_CMD_FAIL:
		{
			if (!vcd_core_is_busy(p_dev_ctxt))
				rc = vcd_gate_clock(p_dev_ctxt);

			break;
		}

	case VCD_EVT_PWR_CLNT_PAUSE:
	case VCD_EVT_PWR_CLNT_LAST_FRAME:
	case VCD_EVT_PWR_CLNT_ERRFATAL:
		{
			if (p_cctxt) {
				rc = VCD_S_SUCCESS;
				if (p_cctxt->status.b_req_perf_lvl) {
					p_dev_ctxt->n_reqd_perf_lvl -=
						p_cctxt->n_reqd_perf_lvl;
					p_cctxt->status.b_req_perf_lvl = FALSE;

					rc = vcd_set_perf_level(p_dev_ctxt,
						p_dev_ctxt->n_reqd_perf_lvl,
						p_cctxt);
				}
			}

			break;
		}

	case VCD_EVT_PWR_CLNT_RESUME:
	case VCD_EVT_PWR_CLNT_FIRST_FRAME:
		{
			if (p_cctxt) {
				rc = VCD_S_SUCCESS;
				if (!p_cctxt->status.b_req_perf_lvl) {
					p_dev_ctxt->n_reqd_perf_lvl +=
						p_cctxt->n_reqd_perf_lvl;
					p_cctxt->status.b_req_perf_lvl = TRUE;

					rc = vcd_set_perf_level(p_dev_ctxt,
						p_dev_ctxt->n_reqd_perf_lvl,
						p_cctxt);
				}
			}
			break;
		}
	}

	return rc;
}
Пример #5
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");
        }
    }
}