Exemplo n.º 1
0
/*----------------------------------------------------------------------------*/
VOID
glResetInit(
    VOID
    )
{
#if (MTK_WCN_SINGLE_MODULE == 0)
    /* 1. register for reset callback */
    mtk_wcn_wmt_msgcb_reg(WMTDRV_TYPE_WIFI, (PF_WMT_CB)glResetCallback);
#endif /* MTK_WCN_SINGLE_MODULE */

    /* 2.1 registration for NETLINK_GENERIC family */
    if(genl_register_family(&mtk_wifi_gnl_family) != 0) {
        DBGLOG(INIT, WARN, ("%s(): GE_NELINK family registration fail\n", __func__));
    }
    else {
        /* 2.2 operation registration */
        if(genl_register_ops(&mtk_wifi_gnl_family, &mtk_wifi_gnl_ops_bind) != 0) {
            DBGLOG(INIT, WARN, ("%s(): BIND operation registration fail\n", __func__));
        }
        /*
        if(genl_register_ops(&mtk_wifi_gnl_family, &mtk_wifi_gnl_ops_reset) != 0) {
            DBGLOG(INIT, WARN, ("%s(): RESET operation registration fail\n", __func__));
        }*/
    }

    INIT_WORK(&work_rst, mtk_wifi_reset);

    return;
}
Exemplo n.º 2
0
/*----------------------------------------------------------------------------*/
VOID
glResetInit(
    VOID
    )
{
    /* 1. register for reset callback */
    mtk_wcn_wmt_msgcb_reg(WMTDRV_TYPE_WIFI, (PF_WMT_CB)glResetCallback);

    /* 2.1 registration for NETLINK_GENERIC family */
    if(genl_register_family(&mtk_wifi_gnl_family) != 0) {
        DBGLOG(INIT, WARN, ("%s(): GE_NELINK family registration fail\n", __func__));
    }
    else {
        /* 2.2 operation registration */
        if(genl_register_ops(&mtk_wifi_gnl_family, &mtk_wifi_gnl_ops_bind) != 0) {
            DBGLOG(INIT, WARN, ("%s(): BIND operation registration fail\n", __func__));
        }

        if(genl_register_ops(&mtk_wifi_gnl_family, &mtk_wifi_gnl_ops_reset) != 0) {
            DBGLOG(INIT, WARN, ("%s(): RESET operation registration fail\n", __func__));
        }
    }

    return;
}
static int BT_open(struct inode *inode, struct file *file)
{
    BT_INFO_FUNC("%s: major %d minor %d (pid %d)\n", __func__,
        imajor(inode),
        iminor(inode),
        current->pid
        );

#if 1 /* GeorgeKuo: turn on function before check stp ready */
     /* turn on BT */
    if (MTK_WCN_BOOL_FALSE == mtk_wcn_wmt_func_on(WMTDRV_TYPE_BT)) {
        BT_WARN_FUNC("WMT turn on BT fail!\n");
        return -ENODEV;
    }else{
        retflag = 0;
        mtk_wcn_wmt_msgcb_reg(WMTDRV_TYPE_BT, bt_cdev_rst_cb);
        BT_INFO_FUNC("WMT register BT rst cb!\n");
    }
#endif

    if (mtk_wcn_stp_is_ready()) {
#if 0 /* GeorgeKuo: turn on function before check stp ready */
         /* turn on BT */
        if (MTK_WCN_BOOL_FALSE == mtk_wcn_wmt_func_on(WMTDRV_TYPE_BT)) {
            BT_WARN_FUNC("WMT turn on BT fail!\n");
            return -ENODEV;
        }
#endif
        mtk_wcn_stp_set_bluez(0);

        BT_INFO_FUNC("Now it's in MTK Bluetooth Mode\n");
        BT_INFO_FUNC("WMT turn on BT OK!\n");
        BT_INFO_FUNC("STP is ready!\n");
        platform_load_nvram_data(BT_NVRAM_CUSTOM_NAME,
            (char *)&g_nvram_btdata, sizeof(g_nvram_btdata));

        BT_INFO_FUNC("Read NVRAM : BD address %02x%02x%02x%02x%02x%02x Cap 0x%02x Codec 0x%02x\n",
            g_nvram_btdata[0], g_nvram_btdata[1], g_nvram_btdata[2],
            g_nvram_btdata[3], g_nvram_btdata[4], g_nvram_btdata[5],
            g_nvram_btdata[6], g_nvram_btdata[7]);

        mtk_wcn_stp_register_event_cb(BT_TASK_INDX, BT_event_cb);
		BT_INFO_FUNC("mtk_wcn_stp_register_event_cb finish\n");
    }
    else {
        BT_ERR_FUNC("STP is not ready\n");

        /*return error code*/
        return -ENODEV;
    }

//    init_MUTEX(&wr_mtx);
    sema_init(&wr_mtx, 1);
//    init_MUTEX(&rd_mtx);
    sema_init(&rd_mtx, 1);
	BT_INFO_FUNC("finish\n");

    return 0;
}
Exemplo n.º 4
0
/*----------------------------------------------------------------------------*/
VOID glResetInit(VOID)
{
	/* 1. Register reset callback */
	mtk_wcn_wmt_msgcb_reg(WMTDRV_TYPE_WIFI, (PF_WMT_CB) glResetCallback);

	/* 2. Initialize reset work */
	INIT_WORK(&(wifi_rst.rst_work), mtk_wifi_reset);

	return;
}
Exemplo n.º 5
0
/*----------------------------------------------------------------------------*/
VOID glResetInit(VOID)
{
#if (MTK_WCN_SINGLE_MODULE == 0)
	/* 1. Register reset callback */
	mtk_wcn_wmt_msgcb_reg(WMTDRV_TYPE_WIFI, (PF_WMT_CB) glResetCallback);
#endif /* MTK_WCN_SINGLE_MODULE */

	/* 2. Initialize reset work */
	INIT_WORK(&(wifi_rst.rst_work), mtk_wifi_reset);

	return;
}
Exemplo n.º 6
0
fm_s32 fm_link_setup(void *data)
{
	fm_s32 ret = 0;

	if (!(link_event = fm_zalloc(sizeof(struct fm_link_event)))) {
		WCN_DBG(FM_ALT | LINK, "fm_zalloc(fm_link_event) -ENOMEM\n");
		return -1;
	}

	link_event->ln_event = fm_flag_event_create("ln_evt");

	if (!link_event->ln_event) {
		WCN_DBG(FM_ALT | LINK, "create mt6620_ln_event failed\n");
		fm_free(link_event);
		return -1;
	}

	fm_flag_event_get(link_event->ln_event);


	WCN_DBG(FM_NTC | LINK, "fm link setup\n");

	cmd_fifo = fm_trace_fifo_create("cmd_fifo");
	if (!cmd_fifo) {
		WCN_DBG(FM_ALT | LINK, "create cmd_fifo failed\n");
		ret = -1;
		goto failed;
	}

	evt_fifo = fm_trace_fifo_create("evt_fifo");
	if (!evt_fifo) {
		WCN_DBG(FM_ALT | LINK, "create evt_fifo failed\n");
		ret = -1;
		goto failed;
	}

	reset = data;		/* get whole chip reset cb */
	mtk_wcn_wmt_msgcb_reg(WMTDRV_TYPE_FM, WCNfm_wholechip_rst_cb);
	return 0;

 failed:
	fm_trace_fifo_release(evt_fifo);
	fm_trace_fifo_release(cmd_fifo);
	fm_flag_event_put(link_event->ln_event);
	if (link_event) {
		fm_free(link_event);
	}

	return ret;
}
Exemplo n.º 7
0
static int GPS_open(struct inode *inode, struct file *file)
{
    printk("%s: major %d minor %d (pid %d)\n", __func__,
        imajor(inode),
        iminor(inode),
        current->pid
        );
	if(retflag == 1)
	{
		GPS_WARN_FUNC("whole chip resetting...\n");
		return -EPERM;
	}
#if 1 /* GeorgeKuo: turn on function before check stp ready */
     /* turn on BT */

    if (MTK_WCN_BOOL_FALSE == mtk_wcn_wmt_func_on(WMTDRV_TYPE_GPS)) {
        GPS_WARN_FUNC("WMT turn on GPS fail!\n");
        return -ENODEV;
    } else {
        mtk_wcn_wmt_msgcb_reg(WMTDRV_TYPE_GPS, gps_cdev_rst_cb);
        GPS_INFO_FUNC("WMT turn on GPS OK!\n");
    }
#endif

    if (mtk_wcn_stp_is_ready()) {
#if 0
        if (MTK_WCN_BOOL_FALSE == mtk_wcn_wmt_func_on(WMTDRV_TYPE_GPS)) {
            GPS_WARN_FUNC("WMT turn on GPS fail!\n");
            return -ENODEV;
        }
        GPS_INFO_FUNC("WMT turn on GPS OK!\n");
#endif
        mtk_wcn_stp_register_event_cb(GPS_TASK_INDX, GPS_event_cb);
    }  else {        
        GPS_ERR_FUNC("STP is not ready, Cannot open GPS Devices\n\r");
        
        /*return error code*/
        return -ENODEV;
    }

    //init_MUTEX(&wr_mtx);
    sema_init(&wr_mtx, 1);
    //init_MUTEX(&rd_mtx);
    sema_init(&rd_mtx, 1);
    
    return 0;
}
Exemplo n.º 8
0
static int BT_open(struct inode *inode, struct file *file)
{
	BT_INFO_FUNC("%s: major %d minor %d pid %d\n", __func__, imajor(inode), iminor(inode), current->pid);
	if (current->pid == 1)
		return 0;

	/* Turn on BT */
	if (MTK_WCN_BOOL_FALSE == mtk_wcn_wmt_func_on(WMTDRV_TYPE_BT)) {
		BT_WARN_FUNC("WMT turn on BT fail!\n");
		return -ENODEV;
	}

	BT_INFO_FUNC("WMT turn on BT OK!\n");
	rstflag = 0;

	if (mtk_wcn_stp_is_ready()) {

		mtk_wcn_stp_set_bluez(0);

		BT_INFO_FUNC("Now it's in MTK Bluetooth Mode\n");
		BT_INFO_FUNC("STP is ready!\n");

		BT_DBG_FUNC("Register BT event callback!\n");
		mtk_wcn_stp_register_event_cb(BT_TASK_INDX, BT_event_cb);
	} else {
		BT_ERR_FUNC("STP is not ready\n");
		mtk_wcn_wmt_func_off(WMTDRV_TYPE_BT);
		return -ENODEV;
	}

	BT_DBG_FUNC("Register BT reset callback!\n");
	mtk_wcn_wmt_msgcb_reg(WMTDRV_TYPE_BT, bt_cdev_rst_cb);

/* init_MUTEX(&wr_mtx); */
	sema_init(&wr_mtx, 1);
/* init_MUTEX(&rd_mtx); */
	sema_init(&rd_mtx, 1);
	BT_INFO_FUNC("%s: finish\n", __func__);

	return 0;
}