/* ------------------------------------------------------------- */ static void tlc_process_cmd(void) { uint32_t ret = TUI_DCI_ERR_INTERNAL_ERROR; uint32_t command_id = CMD_TUI_SW_NONE; #if defined(CONFIG_SECURE_OS_BOOSTER_API) int ret_val = 0; u8 retry_cnt = 0; #endif if (NULL == dci) { pr_debug("ERROR %s: DCI has not been set up properly - exiting"\ "\n", __func__); return; } else { command_id = dci->cmd_nwd.id; } /* Warn if previous response was not acknowledged */ if (CMD_TUI_SW_NONE == command_id) { pr_debug("ERROR %s: Notified without command\n", __func__); return; } else { if (dci->nwd_rsp.id != CMD_TUI_SW_NONE) pr_debug("%s: Warning, previous response not ack\n", __func__); } /* Handle command */ switch (command_id) { case CMD_TUI_SW_OPEN_SESSION: pr_debug("%s: CMD_TUI_SW_OPEN_SESSION.\n", __func__); #if defined(CONFIG_SECURE_OS_BOOSTER_API) pr_info("%s TUI_CPU_SPEEDUP ON retry: %d\n", __func__, retry_cnt); do { ret_val = secos_booster_start(MAX_PERFORMANCE); retry_cnt++; if (ret_val) { pr_err("%s: booster start failed. (%d) retry: %d\n" , __func__, ret_val, retry_cnt); if (retry_cnt < 7) usleep_range(500, 510); } } while (ret_val && retry_cnt < 7); #endif /* Start android TUI activity */ ret = send_cmd_to_user(TLC_TUI_CMD_START_ACTIVITY); if (TUI_DCI_OK != ret) break; /* allocate TUI frame buffer */ ret = hal_tui_alloc(dci->nwd_rsp.alloc_buffer, dci->cmd_nwd.payload.alloc_data.alloc_size, dci->cmd_nwd.payload.alloc_data.num_of_buff); if (TUI_DCI_OK != ret) { pr_err("%s: hal_tui_alloc error : %d\n", __func__ ,ret); /* no need to call tui_i2c_reset, because there will be no TUI * session */ //tui_i2c_reset(); send_cmd_to_user(TLC_TUI_CMD_STOP_ACTIVITY); break; } /* Deactivate linux UI drivers */ ret = hal_tui_deactivate(); if (TUI_DCI_OK != ret) { pr_err("%s: hal_tui_deactivate error : %d\n", __func__ ,ret); hal_tui_free(); send_cmd_to_user(TLC_TUI_CMD_STOP_ACTIVITY); break; } break; case CMD_TUI_SW_CLOSE_SESSION: pr_debug("%s: CMD_TUI_SW_CLOSE_SESSION.\n", __func__); /* Activate linux UI drivers */ ret = hal_tui_activate(); hal_tui_free(); #if defined(CONFIG_SECURE_OS_BOOSTER_API) ret_val = secos_booster_stop(); if (ret_val) pr_err("%s: booster stop failed. (%d)\n" , __func__, ret_val); #endif /* Stop android TUI activity */ ret = send_cmd_to_user(TLC_TUI_CMD_STOP_ACTIVITY); break; default: pr_debug("ERROR %s: Unknown command %d\n", __func__, command_id); break; } /* Fill in response to SWd, fill ID LAST */ pr_debug("%s: return 0x%08x to cmd 0x%08x\n", __func__, ret, command_id); dci->nwd_rsp.return_code = ret; dci->nwd_rsp.id = RSP_ID(command_id); /* Acknowledge command */ dci->cmd_nwd.id = CMD_TUI_SW_NONE; /* Notify SWd */ pr_debug("DCI RSP NOTIFY CORE\n"); ret = mc_notify(&dr_session_handle); if (MC_DRV_OK != ret) pr_debug("ERROR %s: Notify failed: %d\n", __func__, ret); }
/* ------------------------------------------------------------- */ static void tlcProcessCmd(void) { uint32_t ret = TUI_DCI_ERR_INTERNAL_ERROR; uint32_t commandId = CMD_TUI_SW_NONE; pDci->cmdNwd.payload.allocData.numOfBuff = TUI_BUFFER_NUM; if (NULL == pDci) { pr_debug("ERROR tlcProcessCmd: DCI has not been set up properly - exiting\n"); return; } else { commandId = pDci->cmdNwd.id; } /* Warn if previous response was not acknowledged */ if (CMD_TUI_SW_NONE == commandId) { pr_debug("ERROR tlcProcessCmd: Notified without command\n"); return; } else { if (pDci->nwdRsp.id != CMD_TUI_SW_NONE) pr_debug("tlcProcessCmd: Warning, previous response not ack\n"); } /* Handle command */ switch (commandId) { case CMD_TUI_SW_OPEN_SESSION: printk(KERN_ERR "tlcProcessCmd: CMD_TUI_SW_OPEN_SESSION.\n"); /* Start android TUI activity */ ret = sendCmdToUser(TLC_TUI_CMD_START_ACTIVITY); if (TUI_DCI_OK == ret) { /* allocate TUI frame buffer */ ret = hal_tui_alloc(&pDci->nwdRsp.allocBuffer[MAX_DCI_BUFFER_NUMBER], pDci->cmdNwd.payload.allocData.allocSize, pDci->cmdNwd.payload.allocData.numOfBuff); printk(KERN_ERR "tlcProcessCmd: CMD_TUI_SW_OPEN_SESSION & disable_irq(%d);.\n",tsp_irq_num); disable_irq(tsp_irq_num); msleep(100); // temp code } hal_tui_video_space_alloc(); pDci->nwdRsp.allocBuffer[0].pa = g_sec_tuiMemPool.pa; pDci->nwdRsp.allocBuffer[1].pa = (g_sec_tuiMemPool.pa + g_sec_tuiMemPool.size/2); pDci->cmdNwd.payload.allocData.allocSize = g_sec_tuiMemPool.size; break; case CMD_TUI_SW_STOP_DISPLAY: printk(KERN_ERR "tlcProcessCmd: CMD_TUI_SW_STOP_DISPLAY.\n"); /* Deactivate linux UI drivers */ ret = hal_tui_deactivate(); break; case CMD_TUI_SW_CLOSE_SESSION: printk(KERN_ERR "tlcProcessCmd: CMD_TUI_SW_CLOSE_SESSION & enable_irq(%d).\n", tsp_irq_num); disable_irq(pwr_irq_num); /* Activate linux UI drivers */ ret = hal_tui_activate(); tui_i2c_reset(); enable_irq(tsp_irq_num); hal_tui_free(); enable_irq(pwr_irq_num); /* Stop android TUI activity */ ret = sendCmdToUser(TLC_TUI_CMD_STOP_ACTIVITY); break; default: pr_debug("ERROR tlcProcessCmd: Unknown command %d\n", commandId); break; } /* Fill in response to SWd, fill ID LAST */ pr_debug("tlcProcessCmd: return 0x%08x to cmd 0x%08x\n", ret, commandId); pDci->nwdRsp.returnCode = ret; pDci->nwdRsp.id = RSP_ID(commandId); /* Acknowledge command */ pDci->cmdNwd.id = CMD_TUI_SW_NONE; /* Notify SWd */ pr_debug("DCI RSP NOTIFY CORE\n"); ret = mc_notify(&drSessionHandle); if (MC_DRV_OK != ret) pr_debug("ERROR tlcProcessCmd: Notify failed: %d\n", ret); }