コード例 #1
0
ファイル: wmt_plat_sample.c プロジェクト: Galland/mt6620
INT32 wmt_plat_init(P_PWR_SEQ_TIME pPwrSeqTime)
{
/* CMB_STUB_CB stub_cb; */
/*PWR_SEQ_TIME pwr_seq_time;*/
	INT32 iret;

/* stub_cb.aif_ctrl_cb = wmt_plat_audio_ctrl; */
/* stub_cb.func_ctrl_cb = wmt_plat_func_ctrl; */
/* stub_cb.size = sizeof(stub_cb); */

/* register to cmb_stub */
/* iret = mtk_wcn_cmb_stub_reg(&stub_cb); */

/* init cmb_hw */
	iret += mtk_wcn_cmb_hw_init(pPwrSeqTime);

/*init wmt function ctrl wakelock if wake lock is supported by host platform*/
#ifdef CFG_WMT_WAKELOCK_SUPPORT
	wake_lock_init(&wmtWakeLock, WAKE_LOCK_SUSPEND, "wmtFuncCtrl");
	osal_sleepable_lock_init(&gOsSLock);
#endif

	spin_lock_init(&g_balance_lock);

	WMT_DBG_FUNC("WMT-PLAT: ALPS platform init (%d)\n", iret);

	return 0;
}
コード例 #2
0
INT32
wmt_plat_init (UINT32 co_clock_en)
{
	CMB_STUB_CB stub_cb;
    INT32 iret;
    /*init wmt function ctrl wakelock if wake lock is supported by host platform*/
	if(co_clock_en)
	{
		wmt_plat_soc_co_clock_flag_set(1);
	}else
	{
		wmt_plat_soc_co_clock_flag_set(0);
	}

    stub_cb.aif_ctrl_cb = wmt_plat_audio_ctrl;
    stub_cb.func_ctrl_cb = wmt_plat_func_ctrl;
	stub_cb.thermal_query_cb = wmt_plat_thermal_ctrl;
	stub_cb.deep_idle_ctrl_cb = wmt_plat_deep_idle_ctrl;
    stub_cb.size = sizeof(stub_cb);

    /* register to cmb_stub */
    iret = mtk_wcn_cmb_stub_reg(&stub_cb);
    #ifdef CFG_WMT_WAKELOCK_SUPPORT
    wake_lock_init(&wmtWakeLock, WAKE_LOCK_SUSPEND, "wmtFuncCtrl");
    osal_sleepable_lock_init(&gOsSLock);
    #endif

	iret += mtk_wcn_consys_hw_init();

	osal_unsleepable_lock_init(&gbgfIrqBle.lock);
    WMT_DBG_FUNC("WMT-PLAT: ALPS platform init (%d)\n", iret);

    return 0;
}
コード例 #3
0
/* wcn_core_dump_init - create core dump sys
 * @ timeout - core dump time out value
 *
 * Return object pointer if success, else NULL
 */
P_WCN_CORE_DUMP_T wcn_core_dump_init(UINT32 timeout)
{
#define KBYTES (1024*sizeof(char))
#define L1_BUF_SIZE (32*KBYTES)
#define L2_BUF_SIZE (512*KBYTES)

    P_WCN_CORE_DUMP_T core_dmp = NULL;

    core_dmp = (P_WCN_CORE_DUMP_T)osal_malloc(sizeof(WCN_CORE_DUMP_T));
    if (!core_dmp) {
        STP_DBG_ERR_FUNC("alloc mem failed!\n");
        goto fail;
    }

    osal_memset(core_dmp, 0, sizeof(WCN_CORE_DUMP_T));

    core_dmp->compressor = wcn_compressor_init("core_dump_compressor", L1_BUF_SIZE, L2_BUF_SIZE);
    if (!core_dmp->compressor) {
        STP_DBG_ERR_FUNC("create compressor failed!\n");
        goto fail;
    }
    wcn_compressor_reset(core_dmp->compressor, 1, GZIP);

    core_dmp->dmp_timer.timeoutHandler = core_dump_timeout_handler;
    core_dmp->dmp_timer.timeroutHandlerData = (ULONG)core_dmp;
    osal_timer_create(&core_dmp->dmp_timer);
    core_dmp->timeout = timeout;

    osal_sleepable_lock_init(&core_dmp->dmp_lock);

    core_dmp->sm = CORE_DUMP_INIT;
    STP_DBG_INFO_FUNC("create coredump object OK!\n");

    return core_dmp;

fail:
    if (core_dmp && core_dmp->compressor) {
        wcn_compressor_deinit(core_dmp->compressor);
        core_dmp->compressor = NULL;
    }

    if (core_dmp) {
        osal_free(core_dmp);
    }

    osal_sleepable_lock_deinit(&core_dmp->dmp_lock);

    return NULL;
}
コード例 #4
0
ファイル: stp_dbg.c プロジェクト: Scorpio92/mediatek
P_STP_DBG_CPUPCR_T stp_dbg_cpupcr_init(VOID)
{
    P_STP_DBG_CPUPCR_T pSdCpupcr = NULL;

    pSdCpupcr = (P_STP_DBG_CPUPCR_T) osal_malloc(osal_sizeof(STP_DBG_CPUPCR_T));

    if (!pSdCpupcr) {
        STP_DBG_ERR_FUNC("stp dbg cpupcr allocate memory fail!\n");
        return NULL;
    }

    osal_memset(pSdCpupcr, 0, osal_sizeof(STP_DBG_CPUPCR_T));

    osal_sleepable_lock_init(&pSdCpupcr->lock);

    return pSdCpupcr;
}
コード例 #5
0
INT32 wmt_plat_init(P_PWR_SEQ_TIME pPwrSeqTime)
{

	/*PWR_SEQ_TIME pwr_seq_time; */
	INT32 iret = -1;
	/* init cmb_hw */
	iret += mtk_wcn_cmb_hw_init(pPwrSeqTime);

	/*init wmt function ctrl wakelock if wake lock is supported by host platform */
#ifdef CFG_WMT_WAKELOCK_SUPPORT
	wake_lock_init(&wmtWakeLock, WAKE_LOCK_SUSPEND, "wmtFuncCtrl");
	osal_sleepable_lock_init(&gOsSLock);
#endif

	WMT_DBG_FUNC("WMT-PLAT: ALPS platform init (%d)\n", iret);

	return 0;
}
コード例 #6
0
static int WMT_init(void)
{
	dev_t devID = MKDEV(gWmtMajor, 0);
	INT32 cdevErr = -1;
	INT32 ret = -1;
#if REMOVE_MK_NODE
	struct device *wmt_dev = NULL;
#endif

	WMT_INFO_FUNC("WMT Version= %s DATE=%s\n", MTK_WMT_VERSION, MTK_WMT_DATE);
	WMT_INFO_FUNC("COMBO Driver Version= %s\n", MTK_COMBO_DRIVER_VERSION);
	/* Prepare a UCHAR device */
	/*static allocate chrdev */
	gWmtInitDone = 0;
	init_waitqueue_head((wait_queue_head_t *) &gWmtInitWq);

	stp_drv_init();

	ret = register_chrdev_region(devID, WMT_DEV_NUM, WMT_DRIVER_NAME);
	if (ret) {
		WMT_ERR_FUNC("fail to register chrdev\n");
		return ret;
	}

	cdev_init(&gWmtCdev, &gWmtFops);
	gWmtCdev.owner = THIS_MODULE;

	cdevErr = cdev_add(&gWmtCdev, devID, WMT_DEV_NUM);
	if (cdevErr) {
		WMT_ERR_FUNC("cdev_add() fails (%d)\n", cdevErr);
		goto error;
	}
	WMT_INFO_FUNC("driver(major %d) installed\n", gWmtMajor);
#if REMOVE_MK_NODE
	wmt_class = class_create(THIS_MODULE, "stpwmt");
	if (IS_ERR(wmt_class))
		goto error;
	wmt_dev = device_create(wmt_class, NULL, devID, NULL, "stpwmt");
	if (IS_ERR(wmt_dev))
		goto error;
#endif

#if 0
	pWmtDevCtx = wmt_drv_create();
	if (!pWmtDevCtx) {
		WMT_ERR_FUNC("wmt_drv_create() fails\n");
		goto error;
	}

	ret = wmt_drv_init(pWmtDevCtx);
	if (ret) {
		WMT_ERR_FUNC("wmt_drv_init() fails (%d)\n", ret);
		goto error;
	}

	WMT_INFO_FUNC("stp_btmcb_reg\n");
	wmt_cdev_btmcb_reg();

	ret = wmt_drv_start(pWmtDevCtx);
	if (ret) {
		WMT_ERR_FUNC("wmt_drv_start() fails (%d)\n", ret);
		goto error;
	}
#endif
	ret = wmt_lib_init();
	if (ret) {
		WMT_ERR_FUNC("wmt_lib_init() fails (%d)\n", ret);
		goto error;
	}
#if CFG_WMT_DBG_SUPPORT
	wmt_dev_dbg_setup();
#endif

#if CFG_WMT_PROC_FOR_AEE
	wmt_dev_proc_for_aee_setup();
#endif

    mtk_wcn_hif_sdio_update_cb_reg(wmt_dev_tra_sdio_update);
#if CONSYS_WMT_REG_SUSPEND_CB_ENABLE
	ret = register_pm_notifier(&wmt_pm_notifier_block);
	if (ret)
		WMT_ERR_FUNC("WMT failed to register PM notifier failed(%d)\n", ret);
#endif
	gWmtInitDone = 1;
	wake_up(&gWmtInitWq);
#if CONSYS_EARLYSUSPEND_ENABLE
    osal_sleepable_lock_init(&g_es_lr_lock);
    register_early_suspend(&wmt_early_suspend_handler);
    WMT_INFO_FUNC("register_early_suspend finished\n");
#endif
    WMT_INFO_FUNC("success \n");
    return 0;

 error:
	wmt_lib_deinit();
#if CFG_WMT_DBG_SUPPORT
	wmt_dev_dbg_remove();
#endif
#if REMOVE_MK_NODE
	if (!IS_ERR(wmt_dev))
		device_destroy(wmt_class, devID);
	if (!IS_ERR(wmt_class)) {
		class_destroy(wmt_class);
		wmt_class = NULL;
	}
#endif

	if (cdevErr == 0) {
		cdev_del(&gWmtCdev);
	}

	if (ret == 0) {
		unregister_chrdev_region(devID, WMT_DEV_NUM);
		gWmtMajor = -1;
	}

	WMT_ERR_FUNC("fail\n");

	return -1;
}