예제 #1
0
INT32 wmt_plat_wake_lock_ctrl(ENUM_WL_OP opId)
{
#ifdef CFG_WMT_WAKELOCK_SUPPORT
	static INT32 counter = 0;

	osal_lock_sleepable_lock(&gOsSLock);
	if (WL_OP_GET == opId) {
		++counter;
	} else if (WL_OP_PUT == opId) {
		--counter;
	}
	osal_unlock_sleepable_lock(&gOsSLock);
	if (WL_OP_GET == opId && counter == 1) {
		wake_lock(&wmtWakeLock);
		WMT_DBG_FUNC("WMT-PLAT: after wake_lock(%d), counter(%d)\n",
			     wake_lock_active(&wmtWakeLock), counter);
	} else if (WL_OP_PUT == opId && counter == 0) {
		wake_unlock(&wmtWakeLock);
		WMT_DBG_FUNC("WMT-PLAT: after wake_unlock(%d), counter(%d)\n",
			     wake_lock_active(&wmtWakeLock), counter);
	} else {
		WMT_WARN_FUNC("WMT-PLAT: wakelock status(%d), counter(%d)\n",
			      wake_lock_active(&wmtWakeLock), counter);
	}
	return 0;
#else
	WMT_WARN_FUNC("WMT-PLAT: host awake function is not supported.");
	return 0;

#endif
}
예제 #2
0
INT32 stp_dbg_set_version_info(UINT32 chipid, UINT8 *pRomVer, UINT8 *wifiVer, UINT8 *pPatchVer, UINT8 *pPatchBrh)
{
    if (g_stp_dbg_cpupcr) {
        osal_lock_sleepable_lock(&g_stp_dbg_cpupcr->lock);
        g_stp_dbg_cpupcr->chipId = chipid;

        if (wifiVer) {
            osal_memcpy(g_stp_dbg_cpupcr->wifiVer, wifiVer, 4);
        }

        if (pRomVer) {
            osal_memcpy(g_stp_dbg_cpupcr->romVer, pRomVer, 2);
        }

        if (pPatchVer) {
            osal_memcpy(g_stp_dbg_cpupcr->patchVer, pPatchVer, 8);
        }

        if (pPatchBrh) {
            osal_memcpy(g_stp_dbg_cpupcr->branchVer, pPatchBrh, 4);
        }

        osal_unlock_sleepable_lock(&g_stp_dbg_cpupcr->lock);
    } else {
        STP_DBG_ERR_FUNC("NULL pointer\n");
        return -1;
    }

    STP_DBG_INFO_FUNC("chipid(0x%x),wifiver(%s),romver(%s),patchver(%s),branchver(%s)\n",
                      g_stp_dbg_cpupcr->chipId, g_stp_dbg_cpupcr->wifiVer, &g_stp_dbg_cpupcr->romVer[0],
                      &g_stp_dbg_cpupcr->patchVer[0], &g_stp_dbg_cpupcr->branchVer[0]);
    return 0;
}
예제 #3
0
static void wmt_dev_late_resume(struct early_suspend *h)
{
    WMT_INFO_FUNC("@@@@@@@@@@wmt enter late resume@@@@@@@@@@@@@@\n");
    osal_lock_sleepable_lock(&g_es_lr_lock);
    g_early_suspend_flag = 0;
    osal_unlock_sleepable_lock(&g_es_lr_lock);
    mtk_wmt_func_on_background();
}
예제 #4
0
static void wmt_dev_early_suspend(struct early_suspend *h)
{
    osal_lock_sleepable_lock(&g_es_lr_lock);
    g_early_suspend_flag = 1;
    osal_unlock_sleepable_lock(&g_es_lr_lock);
    WMT_INFO_FUNC("@@@@@@@@@@wmt enter early suspend@@@@@@@@@@@@@@\n");
    if (MTK_WCN_BOOL_FALSE == mtk_wcn_wmt_func_off(WMTDRV_TYPE_LPBK)) {
        WMT_WARN_FUNC("WMT turn off LPBK fail\n");
    } else {
	WMT_INFO_FUNC("WMT turn off LPBK suceed");
    }
}
예제 #5
0
static INT32 wmt_pwr_on_thread (void *pvData)
{
	INT32 retryCounter = 1;
	WMT_INFO_FUNC("wmt_pwr_on_thread start to run\n");
#if CONSYS_EARLYSUSPEND_ENABLE
	osal_lock_sleepable_lock(&g_es_lr_lock);
	if (1 == g_early_suspend_flag)
	{
		WMT_INFO_FUNC("wmt_pwr_on_thread exit, do nothing due to early_suspend flag set\n");
		osal_unlock_sleepable_lock(&g_es_lr_lock);
		return 0;
	}
    osal_unlock_sleepable_lock(&g_es_lr_lock);
#endif
	do {
		if (MTK_WCN_BOOL_FALSE == mtk_wcn_wmt_func_on(WMTDRV_TYPE_LPBK)) {
			WMT_WARN_FUNC("WMT turn on LPBK fail, retrying, retryCounter left:%d!\n", retryCounter);
			retryCounter--;
			osal_sleep_ms(1000);
		}
		else
		{
			WMT_INFO_FUNC("WMT turn on LPBK suceed");
			break;
		}
	} while (retryCounter > 0);
#if CONSYS_EARLYSUSPEND_ENABLE	
	osal_lock_sleepable_lock(&g_es_lr_lock);
	if (1 == g_early_suspend_flag)
	{
		WMT_INFO_FUNC("turn off lpbk due to early_suspend flag set\n");
		mtk_wcn_wmt_func_off(WMTDRV_TYPE_LPBK);
	}
	osal_unlock_sleepable_lock(&g_es_lr_lock);
#endif	
	WMT_INFO_FUNC("wmt_pwr_on_thread exits\n");
	return 0;
}
예제 #6
0
/* wcn_core_dump_out - get compressed data from compressor buffer
 * @ dmp - pointer of object
 * @ pbuf - target buffer's pointer
 * @ len - data length
 *
 * Retunr 0 if success;  else error code
 */
INT32 wcn_core_dump_out(P_WCN_CORE_DUMP_T dmp, PUINT8 *pbuf, PINT32 plen)
{
    INT32 ret = 0;

    if ((!dmp) || (!pbuf) || (!plen)) {
        STP_DBG_ERR_FUNC("invalid pointer!\n");
        return -1;
    }

    ret = osal_lock_sleepable_lock(&dmp->dmp_lock);
    if (ret) {
        STP_DBG_ERR_FUNC("--->lock dmp->dmp_lock failed, ret=%d\n", ret);
        return ret;
    }

    ret = wcn_compressor_out(dmp->compressor, pbuf, plen);

    osal_unlock_sleepable_lock(&dmp->dmp_lock);

    return ret;
}
예제 #7
0
/* wcn_core_dump_in - add a packet to compressor buffer
 * @ dmp - pointer of object
 * @ buf - input buffer
 * @ len - data length
 *
 * Retunr 0 if success; return 1 if find end string; else error code
 */
INT32 wcn_core_dump_in(P_WCN_CORE_DUMP_T dmp, PUINT8 buf, INT32 len)
{
    INT32 ret = 0;
    INT32 tmp;
#define INFO_HEAD "MT6628 FW CORE, "

    if ((!dmp) || (!buf)) {
        STP_DBG_ERR_FUNC("invalid pointer!\n");
        return -1;
    }

    ret = osal_lock_sleepable_lock(&dmp->dmp_lock);
    if (ret) {
        STP_DBG_ERR_FUNC("--->lock dmp->dmp_lock failed, ret=%d\n", ret);
        return ret;
    }

    switch (dmp->sm) {
    case CORE_DUMP_INIT:
        wcn_compressor_reset(dmp->compressor, 1, GZIP);
        osal_timer_start(&dmp->dmp_timer, STP_CORE_DUMP_TIMEOUT);

        // first package, copy to info buffer
        osal_strcpy(&dmp->info[0], INFO_HEAD);
        tmp = STP_CORE_DUMP_INFO_SZ - osal_strlen(INFO_HEAD);
        tmp = (len > tmp) ? tmp : len;
        osal_memcpy(&dmp->info[osal_strlen(INFO_HEAD)], buf, tmp);
        dmp->info[STP_CORE_DUMP_INFO_SZ] = '\0';

        // show coredump start info on UI
        //osal_dbg_assert_aee("MT662x f/w coredump start", "MT662x firmware coredump start");
        aee_kernel_dal_show("MT662x coredump start, please wait up to 5 minutes.\n");

        // parsing data, and check end srting
        ret = wcn_core_dump_check_end(buf, len);
        if (ret == 1) {
            STP_DBG_INFO_FUNC("core dump end!\n");
            dmp->sm = CORE_DUMP_DONE;
            wcn_compressor_in(dmp->compressor, buf, len, 1);
        } else {
            dmp->sm = CORE_DUMP_DOING;
            wcn_compressor_in(dmp->compressor, buf, len, 0);
        }
        break;

    case CORE_DUMP_DOING:
        // parsing data, and check end srting
        ret = wcn_core_dump_check_end(buf, len);
        if (ret == 1) {
            STP_DBG_INFO_FUNC("core dump end!\n");
            dmp->sm = CORE_DUMP_DONE;
            wcn_compressor_in(dmp->compressor, buf, len, 1);
        } else {
            dmp->sm = CORE_DUMP_DOING;
            wcn_compressor_in(dmp->compressor, buf, len, 0);
        }
        break;

    case CORE_DUMP_DONE:
        wcn_compressor_reset(dmp->compressor, 1, GZIP);
        osal_timer_start(&dmp->dmp_timer, STP_CORE_DUMP_TIMEOUT);
        wcn_compressor_in(dmp->compressor, buf, len, 0);
        dmp->sm = CORE_DUMP_DOING;
        break;

    case CORE_DUMP_TIMEOUT:
        break;
    default:
        break;
    }

    osal_unlock_sleepable_lock(&dmp->dmp_lock);

    return ret;
}
예제 #8
0
INT32 stp_dbg_set_fw_info(UINT8 *issue_info, UINT32 len, ENUM_STP_FW_ISSUE_TYPE issue_type)
{
    ENUM_ASSERT_INFO_PARSER_TYPE type_index;
    UINT8 *tempbuf = NULL;
    UINT32 i  = 0;
    INT32 iRet = 0;

    if (NULL == issue_info) {
        STP_DBG_ERR_FUNC("null issue infor\n");
        return -1;
    }

    STP_DBG_INFO_FUNC("issue type(%d)\n", issue_type);
    g_stp_dbg_cpupcr->issue_type = issue_type;
    osal_memset(&g_stp_dbg_cpupcr->assert_info[0], 0, STP_ASSERT_INFO_SIZE);

    if (STP_FW_ASSERT_ISSUE == issue_type) {
        tempbuf = osal_malloc(len);

        if (!tempbuf) {
            return -2;
        }

        osal_memcpy(&tempbuf[0], issue_info, len);

        for (i = 0; i < len; i++) {
            if (tempbuf[i] == '\0') {
                tempbuf[i] = '?';
            }
        }

        tempbuf[len] = '\0';
#if 0
        STP_DBG_INFO_FUNC("FW assert infor len(%d)\n", len);

        for (i = 0; i < len; i++) {
            if (0 == len % 64) {
                printk("\n");
            }

            printk("%c", tempbuf[i]);
        }

        printk("\n");
#endif

        for (type_index = STP_DBG_ASSERT_INFO; type_index < STP_DBG_PARSER_TYPE_MAX; type_index ++) {
            iRet += _stp_dbg_parser_assert_str(&tempbuf[0], type_index);
        }

        if (iRet) {
            STP_DBG_ERR_FUNC("passert assert infor fail(%d)\n", iRet);
        }

        osal_free(tempbuf);
    } else if (STP_FW_NOACK_ISSUE == issue_type) {
        osal_lock_sleepable_lock(&g_stp_dbg_cpupcr->lock);
        osal_memcpy(&g_stp_dbg_cpupcr->assert_info[0], issue_info, len);
        g_stp_dbg_cpupcr->fwTaskId = 6;
        g_stp_dbg_cpupcr->fwRrq = 0;
        g_stp_dbg_cpupcr->fwIsr = 0;
        osal_unlock_sleepable_lock(&g_stp_dbg_cpupcr->lock);
    } else if (STP_DBG_PROC_TEST == issue_type) {
        osal_lock_sleepable_lock(&g_stp_dbg_cpupcr->lock);
        osal_memcpy(&g_stp_dbg_cpupcr->assert_info[0], issue_info, len);
        g_stp_dbg_cpupcr->fwTaskId = 0;
        g_stp_dbg_cpupcr->fwRrq = 0;
        g_stp_dbg_cpupcr->fwIsr = 0;
        osal_unlock_sleepable_lock(&g_stp_dbg_cpupcr->lock);
    } else if (STP_FW_WARM_RST_ISSUE == issue_type) {
        osal_lock_sleepable_lock(&g_stp_dbg_cpupcr->lock);
        osal_memcpy(&g_stp_dbg_cpupcr->assert_info[0], issue_info, len);
        g_stp_dbg_cpupcr->fwTaskId = 0;
        g_stp_dbg_cpupcr->fwRrq = 0;
        g_stp_dbg_cpupcr->fwIsr = 0;
        osal_unlock_sleepable_lock(&g_stp_dbg_cpupcr->lock);
    } else {
        STP_DBG_ERR_FUNC("invalid issue type(%d)\n", issue_type);
        return -3;
    }

    return iRet;
}