/* stub functions for kernel to control audio path pin mux */ int mtk_wcn_cmb_stub_aif_ctrl (CMB_STUB_AIF_X state, CMB_STUB_AIF_CTRL ctrl) { int ret; if ( (CMB_STUB_AIF_MAX <= state) || (CMB_STUB_AIF_CTRL_MAX <= ctrl) ) { CMB_STUB_LOG_WARN("[cmb_stub] aif_ctrl invalid (%d, %d)\n", state, ctrl); return -1; } /* avoid the early interrupt before we register the eirq_handler */ if (cmb_stub_aif_ctrl_cb){ ret = (*cmb_stub_aif_ctrl_cb)(state, ctrl); CMB_STUB_LOG_INFO( "[cmb_stub] aif_ctrl_cb state(%d->%d) ctrl(%d) ret(%d)\n", cmb_stub_aif_stat , state, ctrl, ret); /* KERN_DEBUG */ cmb_stub_aif_stat = state; return ret; } else { CMB_STUB_LOG_WARN("[cmb_stub] aif_ctrl_cb null \n"); return -2; } }
static int _mt_combo_plt_do_deep_idle(COMBO_IF src, int enter) { int ret = -1; const char *combo_if_name[] = { "COMBO_IF_UART", "COMBO_IF_MSDC" }; if(src != COMBO_IF_UART && src!= COMBO_IF_MSDC){ CMB_STUB_LOG_WARN("src = %d is error\n", src); return ret; } if(src >= 0 && src < COMBO_IF_MAX){ CMB_STUB_LOG_INFO("src = %s, to enter deep idle? %d \n", combo_if_name[src], enter); } /*TODO: For Common SDIO configuration, we need to do some judgement between STP and WIFI to decide if the msdc will enter deep idle safely*/ switch(src){ case COMBO_IF_UART: if(enter == 0){ //clr_device_working_ability(MT65XX_PDN_PERI_UART3, DEEP_IDLE_STATE); //disable_dpidle_by_bit(MT65XX_PDN_PERI_UART2); ret = mtk_uart_pdn_enable(wmt_uart_port_desc, 0); if (ret < 0) { CMB_STUB_LOG_WARN("[CMB] %s exit deep idle failed\n", wmt_uart_port_desc); } } else { //set_device_working_ability(MT65XX_PDN_PERI_UART3, DEEP_IDLE_STATE); //enable_dpidle_by_bit(MT65XX_PDN_PERI_UART2); ret = mtk_uart_pdn_enable(wmt_uart_port_desc, 1); if (ret < 0) { CMB_STUB_LOG_WARN("[CMB] %s enter deep idle failed\n", wmt_uart_port_desc); } } ret = 0; break; case COMBO_IF_MSDC: if(enter == 0){ //clr_device_working_ability(MT65XX_PDN_PERI_MSDC2, DEEP_IDLE_STATE); } else { //set_device_working_ability(MT65XX_PDN_PERI_MSDC2, DEEP_IDLE_STATE); } ret = 0; break; default: ret = -1; break; } return ret; }
/*! * \brief A unregistration function for WMT-PLAT to unregister from CMB-STUB. * * An MTK-WCN-CMB-STUB unregistration function provided to WMT-PLAT to * unregister itself and clear callback function references. * * \retval 0 operation success */ int mtk_wcn_cmb_stub_unreg (void) { cmb_stub_aif_ctrl_cb = NULL; cmb_stub_func_ctrl_cb = NULL; CMB_STUB_LOG_INFO("[cmb_stub] unregistered \n"); /* KERN_DEBUG */ return 0; }
/*! * \brief A unregistration function for WMT-PLAT to unregister from CMB-STUB. * * An MTK-WCN-CMB-STUB unregistration function provided to WMT-PLAT to * unregister itself and clear callback function references. * * \retval 0 operation success */ int mtk_wcn_cmb_stub_unreg (void) { cmb_stub_aif_ctrl_cb = NULL; cmb_stub_func_ctrl_cb = NULL; cmb_stub_thermal_ctrl_cb = NULL; cmb_stub_deep_idle_ctrl_cb = NULL; cmb_stub_do_reset_cb = NULL; CMB_STUB_LOG_INFO("[cmb_stub] unregistered \n"); /* KERN_DEBUG */ #if MTK_WCN_CMB_FOR_SDIO_1V_AUTOK if(g_sdio_1v_autok_wk){ vfree(g_sdio_1v_autok_wk); g_sdio_1v_autok_wk = NULL; } #endif return 0; }
void mtk_wcn_wmt_set_chipid(int chipid) { CMB_STUB_LOG_INFO("set current consys chipid (0x%x)\n",chipid); gConnectivityChipId = chipid; }
static int _mt_combo_plt_do_deep_idle(COMBO_IF src, int enter) { int ret = -1; #if 0 const char *combo_if_name[] = { "COMBO_IF_UART", "COMBO_IF_MSDC" }; #endif if(src != COMBO_IF_UART && src!= COMBO_IF_MSDC && src != COMBO_IF_BTIF){ CMB_STUB_LOG_WARN("src = %d is error\n", src); return ret; } #if 0 if(src >= 0 && src < COMBO_IF_MAX){ CMB_STUB_LOG_INFO("src = %s, to enter deep idle? %d \n", combo_if_name[src], enter); } #endif /*TODO: For Common SDIO configuration, we need to do some judgement between STP and WIFI to decide if the msdc will enter deep idle safely*/ switch(src){ case COMBO_IF_UART: if(enter == 0){ //clr_device_working_ability(MT65XX_PDN_PERI_UART3, DEEP_IDLE_STATE); //disable_dpidle_by_bit(MT65XX_PDN_PERI_UART2); #ifdef MTK_WCN_COMBO_CHIP_SUPPORT ret = mtk_uart_pdn_enable(wmt_uart_port_desc, 0); if (ret < 0) { CMB_STUB_LOG_WARN("[CMB] %s exit deep idle failed\n", wmt_uart_port_desc); } #endif } else { //set_device_working_ability(MT65XX_PDN_PERI_UART3, DEEP_IDLE_STATE); //enable_dpidle_by_bit(MT65XX_PDN_PERI_UART2); #ifdef MTK_WCN_COMBO_CHIP_SUPPORT ret = mtk_uart_pdn_enable(wmt_uart_port_desc, 1); if (ret < 0) { CMB_STUB_LOG_WARN("[CMB] %s enter deep idle failed\n", wmt_uart_port_desc); } #endif } ret = 0; break; case COMBO_IF_MSDC: if(enter == 0){ //clr_device_working_ability(MT65XX_PDN_PERI_MSDC2, DEEP_IDLE_STATE); } else { //set_device_working_ability(MT65XX_PDN_PERI_MSDC2, DEEP_IDLE_STATE); } ret = 0; break; case COMBO_IF_BTIF: if(cmb_stub_deep_idle_ctrl_cb) { ret = (*cmb_stub_deep_idle_ctrl_cb)(enter); }else { CMB_STUB_LOG_WARN("NULL function pointer\n"); } if(ret) { CMB_STUB_LOG_WARN("%s deep idle fail(%d)\n",enter == 1?"enter":"exit",ret); }else { CMB_STUB_LOG_DBG("%s deep idle ok(%d)\n",enter == 1?"enter":"exit",ret); } break; default: ret = -1; break; } return ret; }