コード例 #1
0
Result_t Handle_CAPI2_SYS_SoftResetSystem(RPC_Msg_t *pReqMsg, UInt32 param)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_SYS_SOFT_RESET_SYSTEM_RSP, &data);

	switch (param) {
	case SYS_HALT:                  /* 0x002 */
		kernel_halt();
		break;

	case SYS_POWER_OFF:             /* 0x003 */
		kernel_power_off();
		break;

	case SYS_RESTART:      /* 0x0001 or SYS_DOWN  */
	default:
		kernel_restart(NULL);
		break;
	}

	return result;
}
コード例 #2
0
Result_t Handle_CAPI2_SYSRPC_PMU_IsSIMReady(RPC_Msg_t *pReqMsg,
					    PMU_SIMLDO_t simldo)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;
	int ret = 0;
	RegulatorInfo_t *curReg = &gRegulatorList[REG_INDEX(simldo)];

	if (!IS_ERR(curReg->handle)) {
		ret = regulator_is_enabled(curReg->handle);
		KRIL_DEBUG(DBG_INFO,
			   "  Handle_CAPI2_PMU_IsSIMReady ldo=%d handle=%p ret=%d\n\n",
			   (int)simldo, curReg->handle, (int)ret);
	} else
		KRIL_DEBUG(DBG_INFO,
			   " regulator_is_enabled Invalid Handle  %d\n",
			   (int)IS_ERR(curReg->handle));

	memset(&data, 0, sizeof(SYS_ReqRep_t));
	data.req_rep_u.CAPI2_SYSRPC_PMU_IsSIMReady_Rsp.val = curReg->isSimInit;	/*(Boolean)(regulator_is_enabled > 0); */
	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_PMU_IS_SIM_READY_RSP, &data);

	KRIL_DEBUG(DBG_INFO, " Handle_CAPI2_PMU_IsSIMReady DONE active=%d\n",
		   (int)curReg->isSimInit);
	return result;
}
コード例 #3
0
Result_t Handle_SYS_AT_MTEST_Handler(RPC_Msg_t* pReqMsg, UInt8* p1, UInt8* p2, UInt8* p3, UInt8* p4, UInt8* p5, UInt8* p6, UInt8* p7, UInt8* p8, UInt8* p9, Int32 output_size)
{
	char* ptr = NULL;
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	if(output_size > 0)
	{
		ptr = malloc(output_size+1);
		memset(ptr,0, (output_size+1));
	}

	memset(&data, 0, sizeof(SYS_ReqRep_t));
	data.req_rep_u.SYS_AT_MTEST_Handler_Rsp.val.res = AT_MTEST_Handler(p1,p2,p3,p4,p5,p6,p7,p8,p9,ptr,output_size);

	data.req_rep_u.SYS_AT_MTEST_Handler_Rsp.val.data = (UInt8*)ptr;
	data.req_rep_u.SYS_AT_MTEST_Handler_Rsp.val.len = output_size;

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_AT_MTEST_HANDLER_RSP, &data);

	if(ptr)
		free(ptr);

	return result;
}
コード例 #4
0
Result_t Handle_SYS_SimApi_ColdResetEvt(RPC_Msg_t *pReqMsg,
	UInt8 simId, Boolean isMasterMode, UInt32 event)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_SYS_SIM_COLD_RESET_EVT_RSP, &data);

	switch (event) {
	case 0:		/* SIM_ISO_COLD_RESET_BEGIN */
		printk(KERN_INFO "SIM Cold Reset Start\n");
/*TBD		nfc_sim_ctrl(0); */
		break;

	case 1:		/* SIM_ISO_COLD_RESET_SUCCEED */
		printk(KERN_INFO "SIM Cold Reset Done\n");
/*TBD		nfc_sim_ctrl(1); */
		break;

	default:
		printk(KERN_INFO "SIM Cold Reset unhandled event %d\n", event);
		break;
	}

	return result;
}
コード例 #5
0
Result_t Handle_SYS_APSystemCmd(RPC_Msg_t *pReqMsg, UInt32 cmd,
	UInt32 param1, UInt32 param2, UInt32 param3)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;
	static int rfldo_prev_state = -1;

	memset(&data, 0, sizeof(SYS_ReqRep_t));

	switch (cmd) {
	case AP_SYS_CMD_RFLDO:
		if (param1 != rfldo_prev_state) {
			printk(KERN_INFO "Excuting SYS_AP_CMD_RFLDO cmdType=%d\n",
				(int)param1);
			result = SetLDORegulator(
					(enum SYS_LDO_Cmd_Type_t)param1,
					"rf", REGULATOR_MODE_STANDBY);
			rfldo_prev_state = param1;
		}
		break;

	case AP_SYS_CMD_SIMLDO:
		printk(KERN_INFO "Excuting SYS_AP_CMD_SIMLDO cmdType=%d\n",
			(int)param1);
		if ((SetLDORegulator((enum SYS_LDO_Cmd_Type_t)param1,
			"sim_vcc", REGULATOR_MODE_IDLE) == RESULT_ERROR) ||
			(SetLDORegulator((enum SYS_LDO_Cmd_Type_t)param1,
				"sim2_vcc", REGULATOR_MODE_IDLE) ==
					RESULT_ERROR)) {
			result = RESULT_ERROR;
		}
		break;

	case AP_SYS_CMD_SIM1LDO:
		printk(KERN_INFO "Excuting SYS_AP_CMD_SIMLDO cmdType=%d\n",
			(int)param1);
		result = SetLDORegulator((enum SYS_LDO_Cmd_Type_t)param1,
			"sim_vcc", REGULATOR_MODE_IDLE);
		break;

	case AP_SYS_CMD_SIM2LDO:
		printk(KERN_INFO "Excuting SYS_AP_CMD_SIMLDO cmdType=%d\n",
			(int)param1);
		result = SetLDORegulator((enum SYS_LDO_Cmd_Type_t)param1,
			"sim2_vcc", REGULATOR_MODE_IDLE);
		break;

	default:
		printk(KERN_INFO "Unhandled AP SYS CMD %d\n", (int)cmd);
		break;
	}

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_AP_SYS_CMD_RSP, &data);

	return result;
}
コード例 #6
0
Result_t Handle_CAPI2_PMU_BattADCReq(RPC_Msg_t* pReqMsg)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));

	HAL_EM_BATTMGR_BattADCReq();
	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_PMU_BATT_LEVEL_RSP, &data);
	return result;
}
コード例 #7
0
	return result;
}

Result_t Handle_CAPI2_SYSRPC_MEASMGR_GetDataB_Adc(RPC_Msg_t* pReqMsg, MeasMngrCnfgReq_t *req)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));
	SYSRPC_MEASMGR_GetDataB_Adc(req, &data.req_rep_u.CAPI2_SYSRPC_MEASMGR_GetDataB_Adc_Rsp.val);

	data.result = result;
コード例 #8
0
Result_t Handle_CAPI2_CP2AP_PedestalMode_Control(RPC_Msg_t* pReqMsg, UInt32 enable)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));
	PedestalModeAllowedByCP = enable;

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_CP2AP_PEDESTALMODE_CONTROL_RSP, &data);
	return result;
}
コード例 #9
0
	return result;
}

Result_t Handle_CAPI2_SYSRPC_HAL_ADC_Ctrl(RPC_Msg_t* pReqMsg, HAL_ADC_Action_en_t action, HAL_ADC_ReadConfig_st_t *req)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));
	SYSRPC_HAL_ADC_Ctrl(action,req, &data.req_rep_u.CAPI2_SYSRPC_HAL_ADC_Ctrl_Rsp.val);

	data.result = result;
コード例 #10
0
Result_t Handle_CAPI2_FLASH_SaveImage(RPC_Msg_t* pReqMsg, UInt32 flash_addr, UInt32 length, UInt32 shared_mem_addr)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));
	data.req_rep_u.CAPI2_FLASH_SaveImage_Rsp.val = (Boolean)FlashSaveData(flash_addr,length,(UInt8*)shared_mem_addr);

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_FLASH_SAVEIMAGE_RSP, &data);
	return result;
}
コード例 #11
0
//#if ( (defined(FUSE_COMMS_PROCESSOR) && (defined(COMM_EM))) )
#if  (defined(FUSE_COMMS_PROCESSOR) )


Result_t Handle_CAPI2_HAL_EM_BATTMGR_GetBattTemp(RPC_Msg_t* pReqMsg)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));
	HAL_EM_BATTMGR_GetBattTemp(&data.req_rep_u.CAPI2_HAL_EM_BATTMGR_GetBattTemp_Rsp.val);

	data.result = result;
コード例 #12
0
Result_t Handle_SYS_Sync_RegisterSetClientName(RPC_Msg_t* pReqMsg, uchar_ptr_t clientName)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));
	data.req_rep_u.SYS_Sync_RegisterSetClientName_Rsp.val = (Boolean)SYS_RegisterSetClientName(pReqMsg->clientID, (char*)clientName);

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_SYS_SYNC_REGISTER_NAME_RSP, &data);
	return result;
}
コード例 #13
0
Result_t Handle_CAPI2_CPPS_Control(RPC_Msg_t *pReqMsg, UInt32 cmd,
				   UInt32 address, UInt32 offset, UInt32 size)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));
	data.req_rep_u.CAPI2_CPPS_Control_Rsp.val = (UInt32)3;	/*CPPS_CONTROL_NO_FFS_SUPPORT_ON_AP */

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_CPPS_CONTROL_RSP, &data);
	return result;
}
コード例 #14
0
Result_t Handle_SYS_Sync_SetRegisteredEventMask(RPC_Msg_t* pReqMsg, UInt16 *maskList, UInt8 maskLen)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));

	SYS_SetRegisteredEventMask(pReqMsg->clientID, maskList, maskLen);

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_SYS_SYNC_SET_REG_EVENT_MASK_RSP, &data);
	return result;
}
コード例 #15
0
Result_t Handle_SYS_Sync_DeRegisterForMSEvent(RPC_Msg_t* pReqMsg)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));

	//call

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_SYS_SYNC_DEREG_EVENT_RSP, &data);
	return result;
}
コード例 #16
0
Result_t Handle_SYS_Sync_EnableFilterMask(RPC_Msg_t* pReqMsg, SysFilterEnable_t flag)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));

	SYS_EnableFilterMessage(pReqMsg->clientID, flag, NULL);

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_SYS_SYNC_ENABLE_FILTER_RSP, &data);
	return result;
}
コード例 #17
0
Result_t Handle_SYS_Sync_RegisterForMSEvent(RPC_Msg_t* pReqMsg, UInt32 eventMask)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;

	memset(&data, 0, sizeof(SYS_ReqRep_t));

	SYS_RegisterForPredefinedClient(SYS_DefaultRemoteHandler, pReqMsg->clientID, eventMask);


	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_SYS_SYNC_REG_EVENT_RSP, &data);
	return result;
}
コード例 #18
0
Result_t Handle_SYS_SIMLOCKApi_SetStatusEx(RPC_Msg_t *pReqMsg, UInt8 simId,
					   SYS_SIMLOCK_STATE_t *simlock_state)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;
	ClientInfo_t cInfo = { 0 };

	memset(&data, 0, sizeof(SYS_ReqRep_t));

	cInfo.simId = (SimNumber_t) simId;
	SIMLOCKApi_SetStatus(&cInfo, simlock_state);

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_SYS_SIMLOCK_SET_STATUS_RSP, &data);
	return result;
}
コード例 #19
0
Result_t Handle_SYS_SimApi_GetCurrLockedSimlockTypeEx(RPC_Msg_t *pReqMsg,
						      UInt8 simId)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;
	ClientInfo_t cInfo = { 0 };

	memset(&data, 0, sizeof(SYS_ReqRep_t));
	cInfo.simId = (SimNumber_t) simId;
	data.req_rep_u.SYS_SimApi_GetCurrLockedSimlockTypeEx_Rsp.val =
	    (UInt32)SimApi_GetCurrLockedSimlockType(&cInfo);

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_SYS_GET_CUR_SIMLOCK_TYPE_RSP,
			       &data);
	return result;
}
コード例 #20
0
Result_t Handle_SYS_Sync_SetFilteredEventMask(RPC_Msg_t* pReqMsg, UInt16 *maskList, UInt8 maskLen, SysFilterEnable_t enableFlag)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;
	Boolean val;

	memset(&data, 0, sizeof(SYS_ReqRep_t));

	val = SYS_SetFilteredEventMask(pReqMsg->clientID, maskList, maskLen, enableFlag);

	if(val)
		SYS_EnableFilterMessage(pReqMsg->clientID, enableFlag, IsApInDeepSleep);

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_SYS_SYNC_SET_REG_FILTER_MASK_RSP, &data);
	return result;
}
コード例 #21
0
Result_t Handle_SYS_SimLockApi_GetStatus(RPC_Msg_t *pReqMsg, UInt8 simId,
					 SYS_SIMLOCK_SIM_DATA_t *sim_data,
					 Boolean is_testsim)
{
#ifdef CONFIG_BCM_SIMLOCK
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;
	sec_simlock_sim_data_t tmp_sim_data;
	sec_simlock_state_t tmp_sim_state;

	memset(&data, 0, sizeof(SYS_ReqRep_t));
	/* convert sim_data to security driver format here... */
	strncpy(tmp_sim_data.imsi_string, sim_data->imsi_string,
		MAX_IMSI_DIGITS);
	tmp_sim_data.imsi_string[MAX_IMSI_DIGITS] = '\0';
	memcpy(tmp_sim_data.gid1, sim_data->gid1, MAX_GID_DIGITS);
	memcpy(tmp_sim_data.gid2, sim_data->gid2, MAX_GID_DIGITS);
	tmp_sim_data.gid1_len = sim_data->gid1_len;
	tmp_sim_data.gid2_len = sim_data->gid2_len;

	if (0 == sec_simlock_get_status(&tmp_sim_data,
					simId, is_testsim, &tmp_sim_state)) {
		/* retrieved SIM lock state successfully from security driver */
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    network_lock_enabled =
		    (0 != tmp_sim_state.network_lock_enabled);
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    network_subset_lock_enabled =
		    (0 != tmp_sim_state.network_subset_lock_enabled);
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    service_provider_lock_enabled =
		    (0 != tmp_sim_state.service_provider_lock_enabled);
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    corporate_lock_enabled =
		    (0 != tmp_sim_state.corporate_lock_enabled);
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    phone_lock_enabled =
		    (0 != tmp_sim_state.phone_lock_enabled);

		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.network_lock =
		    convert_security_state(tmp_sim_state.network_lock);
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    network_subset_lock =
		    convert_security_state(tmp_sim_state.network_subset_lock);
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    service_provider_lock =
		    convert_security_state(tmp_sim_state.service_provider_lock);
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.corporate_lock =
		    convert_security_state(tmp_sim_state.corporate_lock);
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.phone_lock =
		    convert_security_state(tmp_sim_state.phone_lock);
	} else {
		/* error retrieving SIM lock state from security driver, so all is open */
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    network_lock_enabled = TRUE;
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    network_subset_lock_enabled = TRUE;
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    service_provider_lock_enabled = TRUE;
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    corporate_lock_enabled = TRUE;
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    phone_lock_enabled = TRUE;

		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.network_lock =
		    SYS_SIM_SECURITY_OPEN;
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    network_subset_lock = SYS_SIM_SECURITY_OPEN;
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.
		    service_provider_lock = SYS_SIM_SECURITY_OPEN;
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.corporate_lock =
		    SYS_SIM_SECURITY_OPEN;
		data.req_rep_u.SYS_SimLockApi_GetStatus_Rsp.val.phone_lock =
		    SYS_SIM_SECURITY_OPEN;
	}

	data.result = result;

	Send_SYS_RspForRequest(pReqMsg, MSG_SYS_SIMLOCK_GET_STATUS_RSP, &data);
	return result;
#else
	return RESULT_ERROR;
#endif
}
コード例 #22
0
Result_t Handle_CAPI2_SYSRPC_PMU_ActivateSIM(RPC_Msg_t *pReqMsg,
					     PMU_SIMLDO_t simldo,
					     PMU_SIMVolt_t volt)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;
	int simMicroVolts = 0;
	int ret;
	RegulatorInfo_t *curReg = &gRegulatorList[REG_INDEX(simldo)];
#if defined (CONFIG_MACH_JAVA_SS_COMMON)
	void __iomem *sim_sldor = NULL;
	int val;
#endif
	memset(&data, 0, sizeof(SYS_ReqRep_t));
	data.result = result;

	if (IS_ERR(curReg->handle)) {
		KRIL_DEBUG(DBG_ERROR,
			   " enter Handle_CAPI2_PMU_ActivateSIM Invalid Handle ldo=%d handle=%p active=%d\n",
			   simldo, curReg->handle, curReg->isSimInit);
		Send_SYS_RspForRequest(pReqMsg, MSG_PMU_ACTIVATE_SIM_RSP,
				       &data);
		return result;
	}

	KRIL_DEBUG(DBG_INFO,
		   " enter Handle_CAPI2_PMU_ActivateSIM ldo=%d handle=%p active=%d\n",
		   simldo, curReg->handle, curReg->isSimInit);

#if defined (CONFIG_MACH_JAVA_SS_COMMON)
	if (REG_INDEX(simldo))
			sim_sldor = (void __iomem *)(KONA_SIMI2_VA +
							SIMI_SLDOCR_OFFSET);
		else
			sim_sldor = (void __iomem *) (KONA_SIMI_VA +
							SIMI_SLDOCR_OFFSET);
#endif
	switch (volt) {
	case PMU_SIM3P0Volt:
		{
			KRIL_DEBUG(DBG_INFO, " PMU_SIM3P0Volt\n");
			/* 3.0 V SIM */
			simMicroVolts = THREE_VOLTS_IN_MICRO_VOLTS;
			break;
		}

	case PMU_SIM1P8Volt:
		{
			KRIL_DEBUG(DBG_INFO, " PMU_SIM1P8Volt\n");
			/* 1.8 V SIM */
			simMicroVolts = ONE_PT_EIGHT_VOLTS_IN_MICRO_VOLTS;
			break;
		}

	case PMU_SIM0P0Volt:
		{
			simMicroVolts = 0;

#if defined (CONFIG_MACH_JAVA_SS_COMMON)
			if (sim_sldor) {
				val = readl(sim_sldor);
				val &= ~SIMI_SLDOCR_SIMVCC_EN_MASK;
				writel(val, sim_sldor);
				KRIL_DEBUG(DBG_INFO, "SIM SLDOR 0x%x\n", val);
			}
#endif
			KRIL_DEBUG(DBG_INFO,
				   " ** PMU_SIM0P0Volt - turn off regulator (FORCE)\n");

			if (curReg->isSimInit) {
				curReg->isSimInit = FALSE;
				ret = regulator_disable(curReg->handle);
				KRIL_DEBUG(DBG_INFO,
					   " regulator_disable returned 0x%x\n",
					   ret);
			}
			break;
		}

	default:
		{
			KRIL_DEBUG(DBG_INFO,
				   " unrecognized value for volt %d\n",
				   (int)volt);
			break;
		}

	}

	if (simMicroVolts > 0) {
		ret =
		    regulator_set_voltage(curReg->handle, simMicroVolts,
					  simMicroVolts);
		KRIL_DEBUG(DBG_INFO, " regulator_set_voltage returned %d\n",
			   ret);

		ret = regulator_enable(curReg->handle);
		KRIL_DEBUG(DBG_INFO, " regulator_enable returned %d\n", ret);
#if defined (CONFIG_MACH_JAVA_SS_COMMON)
		if (sim_sldor) {
			val = readl(sim_sldor);
			val |= SIMI_SLDOCR_SIMVCC_EN_MASK;
			writel(val, sim_sldor);
			KRIL_DEBUG(DBG_INFO, "SIM SLDOR 0x%x\n", val);
		}
#endif
		/*Set SIMLDO mode to LPM in DSM*/
		ret = regulator_set_mode(curReg->handle, REGULATOR_MODE_IDLE);
		KRIL_DEBUG(DBG_INFO, "regulator_set_mode returned %d\n", ret);

		curReg->isSimInit = TRUE;
	}
	/*PMU_ActivateSIM(volt); */

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_PMU_ACTIVATE_SIM_RSP, &data);

	return result;
}
コード例 #23
0
Result_t Handle_CAPI2_SYSRPC_PMU_ActivateSIM(RPC_Msg_t *pReqMsg,
					     PMU_SIMLDO_t simldo,
					     PMU_SIMVolt_t volt)
{
	Result_t result = RESULT_OK;
	SYS_ReqRep_t data;
	int simMicroVolts = 0;
	int ret;
	RegulatorInfo_t *curReg = &gRegulatorList[REG_INDEX(simldo)];

	memset(&data, 0, sizeof(SYS_ReqRep_t));
	data.result = result;

	if (IS_ERR(curReg->handle)) {
		KRIL_DEBUG(DBG_ERROR,
			   " enter Handle_CAPI2_PMU_ActivateSIM Invalid Handle ldo=%d handle=%p active=%d\n",
			   simldo, curReg->handle, curReg->isSimInit);
		Send_SYS_RspForRequest(pReqMsg, MSG_PMU_ACTIVATE_SIM_RSP,
				       &data);
		return result;
	}

	KRIL_DEBUG(DBG_INFO,
		   " enter Handle_CAPI2_PMU_ActivateSIM ldo=%d handle=%p active=%d\n",
		   simldo, curReg->handle, curReg->isSimInit);

	switch (volt) {
	case PMU_SIM3P0Volt:
		{
			KRIL_DEBUG(DBG_INFO, " PMU_SIM3P0Volt\n");
			// 3.0 V SIM
			simMicroVolts = THREE_VOLTS_IN_MICRO_VOLTS;
			break;
		}

	case PMU_SIM1P8Volt:
		{
			KRIL_DEBUG(DBG_INFO, " PMU_SIM1P8Volt\n");
			// 1.8 V SIM
			simMicroVolts = ONE_PT_EIGHT_VOLTS_IN_MICRO_VOLTS;
			break;
		}

	case PMU_SIM0P0Volt:
		{
			simMicroVolts = 0;

			KRIL_DEBUG(DBG_INFO,
				   " ** PMU_SIM0P0Volt - turn off regulator (FORCE)\n");

			if (curReg->isSimInit) {
				curReg->isSimInit = FALSE;
				ret = regulator_disable(curReg->handle);
				KRIL_DEBUG(DBG_INFO,
					   " regulator_disable returned 0x%x\n",
					   ret);
			}
			break;
		}

	default:
		{
			KRIL_DEBUG(DBG_INFO,
				   " unrecognized value for volt %d\n",
				   (int)volt);
			break;
		}

	}

	if (simMicroVolts > 0) {
		ret = regulator_set_voltage(curReg->handle, simMicroVolts,
					    simMicroVolts);

		if (ret == 0) {
			KRIL_DEBUG(DBG_INFO,
			   " regulator_set_voltage success\n");

			ret = regulator_enable(curReg->handle);
			if (ret == 0)
				KRIL_DEBUG(DBG_INFO,
				" regulator_enable success\n");
			else
				KRIL_DEBUG(DBG_ERROR,
				" regulator_enable FAIL\n");
		} else
			KRIL_DEBUG(DBG_ERROR,
			" regulator_set_voltage FAIL\n");

		/* if either regulator call fails, return error result
		 * to caller as well as CP
		 */
		if (ret)
			result = RESULT_ERROR;
		curReg->isSimInit = (ret == 0);
	}

	data.result = result;
	Send_SYS_RspForRequest(pReqMsg, MSG_PMU_ACTIVATE_SIM_RSP, &data);

	return result;
}