Merge "msm: ais: Add regulator enable and disable independent of CSID"
This commit is contained in:
commit
d5430d098c
2 changed files with 90 additions and 4 deletions
|
@ -787,6 +787,25 @@ static int msm_csiphy_init(struct csiphy_device *csiphy_dev)
|
|||
|
||||
CDBG("%s:%d called\n", __func__, __LINE__);
|
||||
|
||||
rc = msm_camera_config_vreg(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_vreg,
|
||||
csiphy_dev->regulator_count, NULL, 0,
|
||||
&csiphy_dev->csiphy_reg_ptr[0], 1);
|
||||
if (rc < 0) {
|
||||
pr_err("%s:%d csiphy config_vreg failed\n",
|
||||
__func__, __LINE__);
|
||||
goto csiphy_vreg_config_fail;
|
||||
}
|
||||
rc = msm_camera_enable_vreg(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_vreg,
|
||||
csiphy_dev->regulator_count, NULL, 0,
|
||||
&csiphy_dev->csiphy_reg_ptr[0], 1);
|
||||
if (rc < 0) {
|
||||
pr_err("%s:%d csiphy enable_vreg failed\n",
|
||||
__func__, __LINE__);
|
||||
goto top_vreg_enable_failed;
|
||||
}
|
||||
|
||||
rc = msm_camera_clk_enable(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_clk_info, csiphy_dev->csiphy_clk,
|
||||
csiphy_dev->num_clk, true);
|
||||
|
@ -795,7 +814,7 @@ static int msm_csiphy_init(struct csiphy_device *csiphy_dev)
|
|||
if (rc < 0) {
|
||||
pr_err("%s: csiphy clk enable failed\n", __func__);
|
||||
csiphy_dev->ref_count--;
|
||||
goto csiphy_resource_fail;
|
||||
goto csiphy_enable_clk_fail;
|
||||
}
|
||||
CDBG("%s:%d called\n", __func__, __LINE__);
|
||||
|
||||
|
@ -823,7 +842,17 @@ static int msm_csiphy_init(struct csiphy_device *csiphy_dev)
|
|||
csiphy_dev->csiphy_state = CSIPHY_POWER_UP;
|
||||
return 0;
|
||||
|
||||
csiphy_resource_fail:
|
||||
csiphy_enable_clk_fail:
|
||||
msm_camera_enable_vreg(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_vreg,
|
||||
csiphy_dev->regulator_count, NULL, 0,
|
||||
&csiphy_dev->csiphy_reg_ptr[0], 0);
|
||||
top_vreg_enable_failed:
|
||||
msm_camera_config_vreg(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_vreg,
|
||||
csiphy_dev->regulator_count, NULL, 0,
|
||||
&csiphy_dev->csiphy_reg_ptr[0], 0);
|
||||
csiphy_vreg_config_fail:
|
||||
if (cam_config_ahb_clk(NULL, 0, CAM_AHB_CLIENT_CSIPHY,
|
||||
CAM_AHB_SUSPEND_VOTE) < 0)
|
||||
pr_err("%s: failed to vote for AHB\n", __func__);
|
||||
|
@ -862,14 +891,34 @@ static int msm_csiphy_init(struct csiphy_device *csiphy_dev)
|
|||
return rc;
|
||||
}
|
||||
|
||||
rc = msm_camera_config_vreg(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_vreg,
|
||||
csiphy_dev->regulator_count, NULL, 0,
|
||||
&csiphy_dev->csiphy_reg_ptr[0], 1);
|
||||
if (rc < 0) {
|
||||
pr_err("%s:%d csiphy config_vreg failed\n",
|
||||
__func__, __LINE__);
|
||||
goto csiphy_vreg_config_fail;
|
||||
}
|
||||
rc = msm_camera_enable_vreg(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_vreg,
|
||||
csiphy_dev->regulator_count, NULL, 0,
|
||||
&csiphy_dev->csiphy_reg_ptr[0], 1);
|
||||
if (rc < 0) {
|
||||
pr_err("%s:%d csiphy enable_vreg failed\n",
|
||||
__func__, __LINE__);
|
||||
goto top_vreg_enable_failed;
|
||||
}
|
||||
|
||||
rc = msm_camera_clk_enable(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_clk_info, csiphy_dev->csiphy_clk,
|
||||
csiphy_dev->num_clk, true);
|
||||
if (rc < 0) {
|
||||
pr_err("%s: csiphy clk enable failed\n", __func__);
|
||||
csiphy_dev->ref_count--;
|
||||
goto csiphy_resource_fail;
|
||||
goto csiphy_enable_clk_fail;
|
||||
}
|
||||
CDBG("%s:%d clk enable success\n", __func__, __LINE__);
|
||||
|
||||
if (csiphy_dev->csiphy_3phase == CSI_3PHASE_HW)
|
||||
msm_csiphy_3ph_reset(csiphy_dev);
|
||||
|
@ -890,7 +939,17 @@ static int msm_csiphy_init(struct csiphy_device *csiphy_dev)
|
|||
csiphy_dev->csiphy_state = CSIPHY_POWER_UP;
|
||||
return 0;
|
||||
|
||||
csiphy_resource_fail:
|
||||
csiphy_enable_clk_fail:
|
||||
msm_camera_enable_vreg(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_vreg,
|
||||
csiphy_dev->regulator_count, NULL, 0,
|
||||
&csiphy_dev->csiphy_reg_ptr[0], 0);
|
||||
top_vreg_enable_failed:
|
||||
msm_camera_config_vreg(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_vreg,
|
||||
csiphy_dev->regulator_count, NULL, 0,
|
||||
&csiphy_dev->csiphy_reg_ptr[0], 0);
|
||||
csiphy_vreg_config_fail:
|
||||
if (cam_config_ahb_clk(NULL, 0, CAM_AHB_CLIENT_CSIPHY,
|
||||
CAM_AHB_SUSPEND_VOTE) < 0)
|
||||
pr_err("%s: failed to vote for AHB\n", __func__);
|
||||
|
@ -999,6 +1058,14 @@ static int msm_csiphy_release(struct csiphy_device *csiphy_dev, void *arg)
|
|||
csiphy_dev->csiphy_3p_clk, 2, false);
|
||||
}
|
||||
|
||||
msm_camera_enable_vreg(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_vreg,
|
||||
csiphy_dev->regulator_count, NULL, 0,
|
||||
&csiphy_dev->csiphy_reg_ptr[0], 0);
|
||||
msm_camera_config_vreg(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_vreg, csiphy_dev->regulator_count,
|
||||
NULL, 0, &csiphy_dev->csiphy_reg_ptr[0], 0);
|
||||
|
||||
csiphy_dev->csiphy_state = CSIPHY_POWER_DOWN;
|
||||
|
||||
if (cam_config_ahb_clk(NULL, 0, CAM_AHB_CLIENT_CSIPHY,
|
||||
|
@ -1105,6 +1172,13 @@ static int msm_csiphy_release(struct csiphy_device *csiphy_dev, void *arg)
|
|||
csiphy_dev->csiphy_3p_clk, 2, false);
|
||||
}
|
||||
|
||||
msm_camera_enable_vreg(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_vreg, csiphy_dev->regulator_count,
|
||||
NULL, 0, &csiphy_dev->csiphy_reg_ptr[0], 0);
|
||||
msm_camera_config_vreg(&csiphy_dev->pdev->dev,
|
||||
csiphy_dev->csiphy_vreg, csiphy_dev->regulator_count,
|
||||
NULL, 0, &csiphy_dev->csiphy_reg_ptr[0], 0);
|
||||
|
||||
csiphy_dev->csiphy_state = CSIPHY_POWER_DOWN;
|
||||
|
||||
if (cam_config_ahb_clk(NULL, 0, CAM_AHB_CLIENT_CSIPHY,
|
||||
|
@ -1463,6 +1537,14 @@ static int csiphy_probe(struct platform_device *pdev)
|
|||
goto csiphy_no_resource;
|
||||
}
|
||||
|
||||
rc = msm_camera_get_dt_vreg_data(pdev->dev.of_node,
|
||||
&(new_csiphy_dev->csiphy_vreg),
|
||||
&(new_csiphy_dev->regulator_count));
|
||||
if (rc < 0) {
|
||||
pr_err("%s: get vreg data from dtsi fail\n", __func__);
|
||||
rc = -EFAULT;
|
||||
goto csiphy_no_resource;
|
||||
}
|
||||
/* ToDo: Enable 3phase clock for dynamic clock enable/disable */
|
||||
rc = msm_csiphy_get_clk_info(new_csiphy_dev, pdev);
|
||||
if (rc < 0) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <media/ais/msm_ais_sensor.h>
|
||||
#include "msm_sd.h"
|
||||
#include "msm_camera_io_util.h"
|
||||
#include "msm_camera_dt_util.h"
|
||||
#include "cam_soc_api.h"
|
||||
|
||||
#define MAX_CSIPHY 3
|
||||
|
@ -169,6 +170,9 @@ struct csiphy_device {
|
|||
uint32_t csiphy_sof_debug;
|
||||
uint32_t csiphy_sof_debug_count;
|
||||
uint32_t is_combo_mode;
|
||||
struct camera_vreg_t *csiphy_vreg;
|
||||
struct regulator *csiphy_reg_ptr[MAX_REGULATOR];
|
||||
int32_t regulator_count;
|
||||
struct msm_camera_csiphy_params csiphy_params;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue