INT32 wmt_plat_sdio_ctrl (WMT_SDIO_SLOT_NUM sdioPortType, ENUM_FUNC_STATE on)
{
    if(FUNC_ON == on)
        {
    /* add control logic here to generate SDIO CARD REMOVAL event to mmc/sd
         * controller. SDIO card removal operation and remove success messages
         * are expected.
         */
           WMT_INFO_FUNC("wmt_plat_sdio_ctrl :on = %d\n",on);
            sdio_reinit(); 
#ifdef CONFIG_MTK_OOB_ONLY
            mtk_interrupt_register();
#endif
        }
    else{
      /* add control logic here to generate SDIO CARD INSERTION event to mmc/sd
         * controller. SDIO card detection operation and detect success messages
         * are expected.
         */
#ifdef CONFIG_MTK_OOB_ONLY
            mtk_interrupt_unregister();
#endif
        WMT_INFO_FUNC("wmt_plat_sdio_ctrl :off = %d\n",on);
        }
      return 0;
}
/*
 * Return:
 *	0:	power on successfully
 *	others: power on failed
 */
int platform_wifi_power_on(void)
{
	int ret = 0;

	printk("######%s: \n",__func__);
	extern_wifi_set_enable(0);
	msleep(300);
	extern_wifi_set_enable(1);
	msleep(300);
	sdio_reinit();
	return ret;
}
/* Customer function to control hw specific wlan gpios */
void
dhd_customer_gpio_wlan_ctrl(int onoff)
{
	switch (onoff) {
		case WLAN_RESET_OFF:
			WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n",
				__FUNCTION__));
#ifdef CUSTOMER_HW
			bcm_wlan_power_off(2);
#endif /* CUSTOMER_HW */
#if defined(CUSTOMER_HW2)
			wifi_set_power(0, WIFI_TURNOFF_DELAY);
#endif
#ifdef CUSTOMER_HW_AMLOGIC
			//extern_wifi_set_enable(0);
#endif /* CUSTOMER_HW_AMLOGIC */
			WL_ERROR(("=========== WLAN placed in RESET ========\n"));
		break;

		case WLAN_RESET_ON:
			WL_TRACE(("%s: call customer specific GPIO to remove WLAN RESET\n",
				__FUNCTION__));
#ifdef CUSTOMER_HW
			bcm_wlan_power_on(2);
			OSL_DELAY(200);
#endif /* CUSTOMER_HW */
#if defined(CUSTOMER_HW2)
			wifi_set_power(1, 200);
#endif
#ifdef CUSTOMER_HW_AMLOGIC
			extern_wifi_set_enable(0);
			mdelay(200);
			extern_wifi_set_enable(1);
			mdelay(200);
			sdio_reinit();
#endif /* CUSTOMER_HW_AMLOGIC */
			mdelay(100);
			WL_ERROR(("=========== WLAN going back to live  ========\n"));
		break;

		case WLAN_POWER_OFF:
			WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n",
				__FUNCTION__));
#ifdef CUSTOMER_HW
			bcm_wlan_power_off(1);
#endif /* CUSTOMER_HW */

#ifdef CUSTOMER_HW_AMLOGIC
			extern_wifi_set_enable(0);
#endif /* CUSTOMER_HW_AMLOGIC */
			WL_ERROR(("=========== WLAN placed in POWER OFF ========\n"));
		break;

		case WLAN_POWER_ON:
			WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n",
				__FUNCTION__));
#ifdef CUSTOMER_HW
			bcm_wlan_power_on(1);
#endif /* CUSTOMER_HW */

#ifdef CUSTOMER_HW_AMLOGIC
			extern_wifi_set_enable(0);
			mdelay(200);
			extern_wifi_set_enable(1);
			mdelay(200);
			sdio_reinit();
#endif /* CUSTOMER_HW_AMLOGIC */
			/* Lets customer power to get stable */
			OSL_DELAY(200);
			WL_ERROR(("=========== WLAN placed in POWER ON ========\n"));
		break;
	}
}