コード例 #1
0
ファイル: msg.c プロジェクト: 0xroot/Blackphone-BP1-Kernel
/*
 *  ======== msg_create ========
 *  Purpose:
 *      Create an object to manage message queues. Only one of these objects
 *      can exist per device object.
 */
int msg_create(struct msg_mgr **msg_man,
		      struct dev_object *hdev_obj, msg_onexit msg_callback)
{
	struct bridge_drv_interface *intf_fxns;
	struct msg_mgr_ *msg_mgr_obj;
	struct msg_mgr *hmsg_mgr;
	int status = 0;

	*msg_man = NULL;

	dev_get_intf_fxns(hdev_obj, &intf_fxns);

	/* Let Bridge message module finish the create: */
	status =
	    (*intf_fxns->msg_create) (&hmsg_mgr, hdev_obj, msg_callback);

	if (!status) {
		/* Fill in DSP API message module's fields of the msg_mgr
		 * structure */
		msg_mgr_obj = (struct msg_mgr_ *)hmsg_mgr;
		msg_mgr_obj->intf_fxns = intf_fxns;

		/* Finally, return the new message manager handle: */
		*msg_man = hmsg_mgr;
	} else {
		status = -EPERM;
	}
	return status;
}
コード例 #2
0
ファイル: msg.c プロジェクト: romanbb/android_kernel_lge_d851
int msg_create(struct msg_mgr **msg_man,
		      struct dev_object *hdev_obj, msg_onexit msg_callback)
{
	struct bridge_drv_interface *intf_fxns;
	struct msg_mgr_ *msg_mgr_obj;
	struct msg_mgr *hmsg_mgr;
	int status = 0;

	*msg_man = NULL;

	dev_get_intf_fxns(hdev_obj, &intf_fxns);

	/*                                              */
	status =
	    (*intf_fxns->msg_create) (&hmsg_mgr, hdev_obj, msg_callback);

	if (!status) {
		/*                                                       
               */
		msg_mgr_obj = (struct msg_mgr_ *)hmsg_mgr;
		msg_mgr_obj->intf_fxns = intf_fxns;

		/*                                                 */
		*msg_man = hmsg_mgr;
	} else {
		status = -EPERM;
	}
	return status;
}
コード例 #3
0
ファイル: pwr.c プロジェクト: 3sOx/asuswrt-merlin
/*
 *  ======== pwr_wake_dsp ========
 *    Send command to DSP to wake it from sleep.
 */
int pwr_wake_dsp(const u32 timeout)
{
	struct bridge_drv_interface *intf_fxns;
	struct bridge_dev_context *dw_context;
	int status = -EPERM;
	struct dev_object *hdev_obj = NULL;
	u32 arg = timeout;

	for (hdev_obj = (struct dev_object *)drv_get_first_dev_object();
	     hdev_obj != NULL;
	     hdev_obj = (struct dev_object *)drv_get_next_dev_object
	     ((u32) hdev_obj)) {
		if (!(dev_get_bridge_context(hdev_obj,
						      (struct bridge_dev_context
						       **)&dw_context))) {
			if (!(dev_get_intf_fxns(hdev_obj,
			      (struct bridge_drv_interface **)&intf_fxns))) {
				status =
				    (*intf_fxns->pfn_dev_cntrl) (dw_context,
							BRDIOCTL_WAKEUP,
							(void *)&arg);
			}
		}
	}
	return status;
}
コード例 #4
0
ファイル: pwr.c プロジェクト: 3sOx/asuswrt-merlin
/*
 *  ======== pwr_pm_post_scale========
 *    Sends post-notification message to DSP.
 */
int pwr_pm_post_scale(u16 voltage_domain, u32 level)
{
	struct bridge_drv_interface *intf_fxns;
	struct bridge_dev_context *dw_context;
	int status = -EPERM;
	struct dev_object *hdev_obj = NULL;
	u32 arg[2];

	arg[0] = voltage_domain;
	arg[1] = level;

	for (hdev_obj = (struct dev_object *)drv_get_first_dev_object();
	     hdev_obj != NULL;
	     hdev_obj = (struct dev_object *)drv_get_next_dev_object
	     ((u32) hdev_obj)) {
		if (!(dev_get_bridge_context(hdev_obj,
						      (struct bridge_dev_context
						       **)&dw_context))) {
			if (!(dev_get_intf_fxns(hdev_obj,
			      (struct bridge_drv_interface **)&intf_fxns))) {
				status =
				    (*intf_fxns->pfn_dev_cntrl) (dw_context,
						BRDIOCTL_POSTSCALE_NOTIFY,
						(void *)&arg);
			}
		}
	}
	return status;

}
コード例 #5
0
ファイル: strm.c プロジェクト: 7799/linux
/*
 *  ======== strm_create ========
 *  Purpose:
 *      Create a STRM manager object.
 */
int strm_create(struct strm_mgr **strm_man,
		       struct dev_object *dev_obj)
{
	struct strm_mgr *strm_mgr_obj;
	int status = 0;

	*strm_man = NULL;
	/* Allocate STRM manager object */
	strm_mgr_obj = kzalloc(sizeof(struct strm_mgr), GFP_KERNEL);
	if (strm_mgr_obj == NULL)
		status = -ENOMEM;
	else
		strm_mgr_obj->dev_obj = dev_obj;

	/* Get Channel manager and Bridge function interface */
	if (!status) {
		status = dev_get_chnl_mgr(dev_obj, &(strm_mgr_obj->chnl_mgr));
		if (!status) {
			(void)dev_get_intf_fxns(dev_obj,
						&(strm_mgr_obj->intf_fxns));
		}
	}

	if (!status)
		*strm_man = strm_mgr_obj;
	else
		kfree(strm_mgr_obj);

	return status;
}
コード例 #6
0
ファイル: chnl.c プロジェクト: AdiPat/i9003_Kernel
/*
 *  ======== chnl_create ========
 *  Purpose:
 *      Create a channel manager object, responsible for opening new channels
 *      and closing old ones for a given 'Bridge board.
 */
int chnl_create(OUT struct chnl_mgr **phChnlMgr,
		       struct dev_object *hdev_obj,
		       IN CONST struct chnl_mgrattrs *pMgrAttrs)
{
	int status;
	struct chnl_mgr *hchnl_mgr;
	struct chnl_mgr_ *chnl_mgr_obj = NULL;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(phChnlMgr != NULL);
	DBC_REQUIRE(pMgrAttrs != NULL);

	*phChnlMgr = NULL;

	/* Validate args: */
	if ((0 < pMgrAttrs->max_channels) &&
	    (pMgrAttrs->max_channels <= CHNL_MAXCHANNELS))
		status = 0;
	else if (pMgrAttrs->max_channels == 0)
		status = -EINVAL;
	else
		status = -ECHRNG;

	if (pMgrAttrs->word_size == 0)
		status = -EINVAL;

	if (DSP_SUCCEEDED(status)) {
		status = dev_get_chnl_mgr(hdev_obj, &hchnl_mgr);
		if (DSP_SUCCEEDED(status) && hchnl_mgr != NULL)
			status = -EEXIST;

	}

	if (DSP_SUCCEEDED(status)) {
		struct bridge_drv_interface *intf_fxns;
		dev_get_intf_fxns(hdev_obj, &intf_fxns);
		if (intf_fxns) {
			/* Let WMD channel module finish the create */
			status = (*intf_fxns->pfn_chnl_create)(&hchnl_mgr,
						hdev_obj, pMgrAttrs);
		}
		if (DSP_SUCCEEDED(status)) {
			/* Fill in WCD channel module's fields of the
			 * chnl_mgr structure */
			chnl_mgr_obj = (struct chnl_mgr_ *)hchnl_mgr;
			chnl_mgr_obj->intf_fxns = intf_fxns;
			/* Finally, return the new channel manager handle: */
			*phChnlMgr = hchnl_mgr;
		}
	}

	DBC_ENSURE(DSP_FAILED(status) || chnl_mgr_obj);

	return status;
}
コード例 #7
0
ファイル: chnl.c プロジェクト: ANFS/ANFS-kernel
/*
 *  ======== chnl_create ========
 *  Purpose:
 *      Create a channel manager object, responsible for opening new channels
 *      and closing old ones for a given 'Bridge board.
 */
int chnl_create(struct chnl_mgr **channel_mgr,
		       struct dev_object *hdev_obj,
		       const struct chnl_mgrattrs *mgr_attrts)
{
	int status;
	struct chnl_mgr *hchnl_mgr;
	struct chnl_mgr_ *chnl_mgr_obj = NULL;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(channel_mgr != NULL);
	DBC_REQUIRE(mgr_attrts != NULL);

	*channel_mgr = NULL;

	/* Validate args: */
	if ((0 < mgr_attrts->max_channels) &&
	    (mgr_attrts->max_channels <= CHNL_MAXCHANNELS))
		status = 0;
	else if (mgr_attrts->max_channels == 0)
		status = -EINVAL;
	else
		status = -ECHRNG;

	if (mgr_attrts->word_size == 0)
		status = -EINVAL;

	if (!status) {
		status = dev_get_chnl_mgr(hdev_obj, &hchnl_mgr);
		if (!status && hchnl_mgr != NULL)
			status = -EEXIST;

	}

	if (!status) {
		struct bridge_drv_interface *intf_fxns;
		dev_get_intf_fxns(hdev_obj, &intf_fxns);
		/* Let Bridge channel module finish the create: */
		status = (*intf_fxns->pfn_chnl_create) (&hchnl_mgr, hdev_obj,
							mgr_attrts);
		if (!status) {
			/* Fill in DSP API channel module's fields of the
			 * chnl_mgr structure */
			chnl_mgr_obj = (struct chnl_mgr_ *)hchnl_mgr;
			chnl_mgr_obj->intf_fxns = intf_fxns;
			/* Finally, return the new channel manager handle: */
			*channel_mgr = hchnl_mgr;
		}
	}

	DBC_ENSURE(status || chnl_mgr_obj);

	return status;
}
コード例 #8
0
ファイル: io.c プロジェクト: ANFS/ANFS-kernel
/*
 *  ======== io_create ========
 *  Purpose:
 *      Create an IO manager object, responsible for managing IO between
 *      CHNL and msg_ctrl
 */
int io_create(struct io_mgr **io_man, struct dev_object *hdev_obj,
		     const struct io_attrs *mgr_attrts)
{
	struct bridge_drv_interface *intf_fxns;
	struct io_mgr *hio_mgr = NULL;
	struct io_mgr_ *pio_mgr = NULL;
	int status = 0;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(io_man != NULL);
	DBC_REQUIRE(mgr_attrts != NULL);

	*io_man = NULL;

	/* A memory base of 0 implies no memory base: */
	if ((mgr_attrts->shm_base != 0) && (mgr_attrts->usm_length == 0))
		status = -EINVAL;

	if (mgr_attrts->word_size == 0)
		status = -EINVAL;

	if (!status) {
		dev_get_intf_fxns(hdev_obj, &intf_fxns);

		/* Let Bridge channel module finish the create: */
		status = (*intf_fxns->pfn_io_create) (&hio_mgr, hdev_obj,
						      mgr_attrts);

		if (!status) {
			pio_mgr = (struct io_mgr_ *)hio_mgr;
			pio_mgr->intf_fxns = intf_fxns;
			pio_mgr->hdev_obj = hdev_obj;

			/* Return the new channel manager handle: */
			*io_man = hio_mgr;
		}
	}

	return status;
}
コード例 #9
0
ファイル: pwr.c プロジェクト: 3sOx/asuswrt-merlin
/*
 *  ======== pwr_sleep_dsp ========
 *    Send command to DSP to enter sleep state.
 */
int pwr_sleep_dsp(const u32 sleep_code, const u32 timeout)
{
	struct bridge_drv_interface *intf_fxns;
	struct bridge_dev_context *dw_context;
	int status = -EPERM;
	struct dev_object *hdev_obj = NULL;
	u32 ioctlcode = 0;
	u32 arg = timeout;

	for (hdev_obj = (struct dev_object *)drv_get_first_dev_object();
	     hdev_obj != NULL;
	     hdev_obj =
	     (struct dev_object *)drv_get_next_dev_object((u32) hdev_obj)) {
		if (dev_get_bridge_context(hdev_obj,
						(struct bridge_dev_context **)
						   &dw_context)) {
			continue;
		}
		if (dev_get_intf_fxns(hdev_obj,
						(struct bridge_drv_interface **)
						&intf_fxns)) {
			continue;
		}
		if (sleep_code == PWR_DEEPSLEEP)
			ioctlcode = BRDIOCTL_DEEPSLEEP;
		else if (sleep_code == PWR_EMERGENCYDEEPSLEEP)
			ioctlcode = BRDIOCTL_EMERGENCYSLEEP;
		else
			status = -EINVAL;

		if (status != -EINVAL) {
			status = (*intf_fxns->pfn_dev_cntrl) (dw_context,
							      ioctlcode,
							      (void *)&arg);
		}
	}
	return status;
}
コード例 #10
0
ファイル: msg.c プロジェクト: macroliu/samsung_kernel_nowplus
/*
 *  ======== msg_create ========
 *  Purpose:
 *      Create an object to manage message queues. Only one of these objects
 *      can exist per device object.
 */
dsp_status msg_create(OUT struct msg_mgr **phMsgMgr,
		      struct dev_object *hdev_obj, msg_onexit msgCallback)
{
	struct bridge_drv_interface *intf_fxns;
	struct msg_mgr_ *msg_mgr_obj;
	struct msg_mgr *hmsg_mgr;
	dsp_status status = DSP_SOK;

	DBC_REQUIRE(refs > 0);
	DBC_REQUIRE(phMsgMgr != NULL);
	DBC_REQUIRE(msgCallback != NULL);
	DBC_REQUIRE(hdev_obj != NULL);

	*phMsgMgr = NULL;

	status = dev_get_intf_fxns(hdev_obj, &intf_fxns);

	if (intf_fxns) {
		/* Let WMD message module finish the create */
		status = (*intf_fxns->pfn_msg_create)(&hmsg_mgr,
				hdev_obj, msgCallback);
	}

	if (DSP_SUCCEEDED(status)) {
		/* Fill in WCD message module's fields of the msg_mgr
		 * structure */
		msg_mgr_obj = (struct msg_mgr_ *)hmsg_mgr;
		msg_mgr_obj->intf_fxns = intf_fxns;

		/* Finally, return the new message manager handle: */
		*phMsgMgr = hmsg_mgr;
	} else {
		status = -EPERM;
	}
	return status;
}
コード例 #11
0
ファイル: io.c プロジェクト: romanbb/android_kernel_lge_d851
int io_create(struct io_mgr **io_man, struct dev_object *hdev_obj,
		     const struct io_attrs *mgr_attrts)
{
	struct bridge_drv_interface *intf_fxns;
	struct io_mgr *hio_mgr = NULL;
	struct io_mgr_ *pio_mgr = NULL;
	int status = 0;

	*io_man = NULL;

	/*                                            */
	if ((mgr_attrts->shm_base != 0) && (mgr_attrts->sm_length == 0))
		status = -EINVAL;

	if (mgr_attrts->word_size == 0)
		status = -EINVAL;

	if (!status) {
		dev_get_intf_fxns(hdev_obj, &intf_fxns);

		/*                                              */
		status = (*intf_fxns->io_create) (&hio_mgr, hdev_obj,
						      mgr_attrts);

		if (!status) {
			pio_mgr = (struct io_mgr_ *)hio_mgr;
			pio_mgr->intf_fxns = intf_fxns;
			pio_mgr->dev_obj = hdev_obj;

			/*                                        */
			*io_man = hio_mgr;
		}
	}

	return status;
}
コード例 #12
0
int disp_create(struct disp_object **dispatch_obj,
		       struct dev_object *hdev_obj,
		       const struct disp_attr *disp_attrs)
{
	struct disp_object *disp_obj;
	struct bridge_drv_interface *intf_fxns;
	u32 ul_chnl_id;
	struct chnl_attr chnl_attr_obj;
	int status = 0;
	u8 dev_type;

	*dispatch_obj = NULL;

	/*                                 */
	disp_obj = kzalloc(sizeof(struct disp_object), GFP_KERNEL);
	if (disp_obj == NULL)
		status = -ENOMEM;
	else
		disp_obj->dev_obj = hdev_obj;

	/*                                                   */
	if (!status) {
		status = dev_get_chnl_mgr(hdev_obj, &(disp_obj->chnl_mgr));
		if (!status) {
			(void)dev_get_intf_fxns(hdev_obj, &intf_fxns);
			disp_obj->intf_fxns = intf_fxns;
		}
	}

	/*                                                                  
            */
	if (status)
		goto func_cont;

	status = dev_get_dev_type(hdev_obj, &dev_type);

	if (status)
		goto func_cont;

	if (dev_type != DSP_UNIT) {
		status = -EPERM;
		goto func_cont;
	}

	disp_obj->char_size = DSPWORDSIZE;
	disp_obj->word_size = DSPWORDSIZE;
	disp_obj->data_mau_size = DSPWORDSIZE;
	/*                                              */
	chnl_attr_obj.uio_reqs = CHNLIOREQS;
	chnl_attr_obj.event_obj = NULL;
	ul_chnl_id = disp_attrs->chnl_offset + CHNLTORMSOFFSET;
	status = (*intf_fxns->chnl_open) (&(disp_obj->chnl_to_dsp),
					      disp_obj->chnl_mgr,
					      CHNL_MODETODSP, ul_chnl_id,
					      &chnl_attr_obj);

	if (!status) {
		ul_chnl_id = disp_attrs->chnl_offset + CHNLFROMRMSOFFSET;
		status =
		    (*intf_fxns->chnl_open) (&(disp_obj->chnl_from_dsp),
						 disp_obj->chnl_mgr,
						 CHNL_MODEFROMDSP, ul_chnl_id,
						 &chnl_attr_obj);
	}
	if (!status) {
		/*                                       */
		disp_obj->bufsize = disp_attrs->chnl_buf_size;
		disp_obj->bufsize_rms = RMS_COMMANDBUFSIZE;
		disp_obj->buf = kzalloc(disp_obj->bufsize, GFP_KERNEL);
		if (disp_obj->buf == NULL)
			status = -ENOMEM;
	}
func_cont:
	if (!status)
		*dispatch_obj = disp_obj;
	else
		delete_disp(disp_obj);

	return status;
}