Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d3f54d8 authored by yutingshih's avatar yutingshih Committed by yutingshih(97855)
Browse files

Add a flag for VIO turn on and off if multi-camera operate

Root cause:
[PRJ8901-149][Ar]ATS<8901_CTS9.0R7>-<SDM632 - CtsCameraTestCases android.hardware.cts.CameraTest#testMultiCameraRelease>
The power re-control

How to fix:
Add a flag for VIO ON/OFF

RiskArea:
CAMERA

Change-Id: I65ad3dc91eba174831fbba63205ef1a33b3395ce
parent aff52979
Loading
Loading
Loading
Loading
+87 −0
Original line number Diff line number Diff line
@@ -25,6 +25,26 @@
#undef CDBG
#define CDBG(fmt, args...) pr_debug(fmt, ##args)

//<2019/05/10-Yuting Shih.[FAIRPHONE][MISC][COMMON][CAMERA][][]Add for CTS testMultiCameraRelease fail issue.
#if defined( MULTI_CAMERA_POWER_ON )
  #undef  MULTI_CAMERA_POWER_ON
#endif
  #define   MULTI_CAMERA_POWER_ON

#if defined( CAM_CDBG )
  #undef CAM_DBG
#endif

#if defined( MULTI_CAMERA_POWER_ON )
//#define   CAM_DBG(fmt, args...)    pr_debug(fmt, ##args)
#define   CAM_DBG(fmt, args...)    pr_err(fmt, ##args)

int   iovdd_count = 0;
#else
#define   CAM_DBG(fmt, args...)    do{}while(0)
#endif
//>2019/05/10-Yuting Shih.[FAIRPHONE][MISC][COMMON][CAMERA][][].

int msm_camera_fill_vreg_params(struct camera_vreg_t *cam_vreg,
	int num_vreg, struct msm_sensor_power_setting *power_setting,
	uint16_t power_setting_size)
@@ -1495,10 +1515,32 @@ int msm_camera_power_up(struct msm_camera_power_ctrl_t *ctrl,
			CDBG("%s:%d gpio set val %d\n", __func__, __LINE__,
				ctrl->gpio_conf->gpio_num_info->gpio_num
				[power_setting->seq_val]);
		//<2019/05/10-Yuting Shih.[FAIRPHONE][MISC][COMMON][CAMERA][CTS][]Add and modified for CTS testMultiCameraRelease fail issue.
		#if defined( MULTI_CAMERA_POWER_ON )
			if( power_setting->seq_val == SENSOR_GPIO_VIO )
			{
				CAM_DBG("[%s][Arima] 1.Set common gpio. Loop %d\n", __func__, iovdd_count );
				if( iovdd_count == 0 )
				{
					gpio_set_value_cansleep(
						ctrl->gpio_conf->gpio_num_info->gpio_num[power_setting->seq_val],
						(int) power_setting->config_val );
				}
				iovdd_count++;
			}
			else
			{
				gpio_set_value_cansleep(
					ctrl->gpio_conf->gpio_num_info->gpio_num[power_setting->seq_val],
					(int) power_setting->config_val);
			}
		#else /** Default **/
			gpio_set_value_cansleep(
				ctrl->gpio_conf->gpio_num_info->gpio_num
				[power_setting->seq_val],
				(int) power_setting->config_val);
		#endif /* End.. (MULTI_CAMERA_POWER_ON) */
		//>2019/05/10-Yuting Shih.[FAIRPHONE][MISC][COMMON][CAMERA][CTS][].
			break;
		case SENSOR_VREG:
			if (power_setting->seq_val == INVALID_VREG)
@@ -1510,6 +1552,7 @@ int msm_camera_power_up(struct msm_camera_power_ctrl_t *ctrl,
					SENSOR_GPIO_MAX);
				goto power_up_failed;
			}

			if (power_setting->seq_val < ctrl->num_vreg)
				msm_camera_config_single_vreg(ctrl->dev,
					&ctrl->cam_vreg
@@ -1571,9 +1614,31 @@ int msm_camera_power_up(struct msm_camera_power_ctrl_t *ctrl,
			if (!ctrl->gpio_conf->gpio_num_info->valid
				[power_setting->seq_val])
				continue;
		//<2019/05/10-Yuting Shih.[FAIRPHONE][MISC][COMMON][CAMERA][CTS][]Add and modified for CTS testMultiCameraRelease fail issue.
		#if defined( MULTI_CAMERA_POWER_ON )
			if( power_setting->seq_val == SENSOR_GPIO_VIO )
			{
				iovdd_count --;
				if( iovdd_count == 0 )
				{
					gpio_set_value_cansleep(
						ctrl->gpio_conf->gpio_num_info->gpio_num[power_setting->seq_val],
						GPIOF_OUT_INIT_LOW );
				}
				CAM_DBG("[%s][Arima] 2.Set common gpio. Loop %d\n", __func__, iovdd_count );
			}
			else
			{
				gpio_set_value_cansleep(
					ctrl->gpio_conf->gpio_num_info->gpio_num
					[power_setting->seq_val], GPIOF_OUT_INIT_LOW);
			}
		#else /** Default **/
			gpio_set_value_cansleep(
				ctrl->gpio_conf->gpio_num_info->gpio_num
				[power_setting->seq_val], GPIOF_OUT_INIT_LOW);
		#endif  /* end.. (MULTI_CAMERA_POWER_ON) */
		//>2019/05/10-Yuting Shih.[FAIRPHONE][MISC][COMMON][CAMERA][CTS][].
			break;
		case SENSOR_VREG:
			if (power_setting->seq_val < ctrl->num_vreg)
@@ -1682,10 +1747,32 @@ int msm_camera_power_down(struct msm_camera_power_ctrl_t *ctrl,
			if (!ctrl->gpio_conf->gpio_num_info->valid
				[pd->seq_val])
				continue;
		//<2019/05/10-Yuting Shih.[FAIRPHONE][MISC][COMMON][CAMERA][CTS][]Add and modified for CTS testMultiCameraRelease fail issue.
		#if defined( MULTI_CAMERA_POWER_ON )
			if( pd->seq_val == SENSOR_GPIO_VIO )
			{
				iovdd_count --;
				if( iovdd_count == 0 )
				{
					gpio_set_value_cansleep(
						ctrl->gpio_conf->gpio_num_info->gpio_num[pd->seq_val],
						(int) pd->config_val );
				}
				CAM_DBG("[%s][Arima] 3.Set common gpio. Loop %d\n", __func__, iovdd_count );
			}
			else
			{
				gpio_set_value_cansleep(
					ctrl->gpio_conf->gpio_num_info->gpio_num[pd->seq_val],
					(int) pd->config_val );
			}
		#else /** Default **/
			gpio_set_value_cansleep(
				ctrl->gpio_conf->gpio_num_info->gpio_num
				[pd->seq_val],
				(int) pd->config_val);
		#endif  /* end.. (MULTI_CAMERA_POWER_ON) */
		//>2019/05/10-Yuting Shih.[FAIRPHONE][MISC][COMMON][CAMERA][CTS][].
			break;
		case SENSOR_VREG:
			if (pd->seq_val == INVALID_VREG)