|
@@ -67,11 +67,35 @@ int cam_sfe_init_hw(void *hw_priv, void *init_hw_args, uint32_t arg_size)
|
|
|
if (rc) {
|
|
|
CAM_ERR(CAM_SFE, "Enable SOC failed");
|
|
|
rc = -EFAULT;
|
|
|
- goto decrement_open_cnt;
|
|
|
+ goto deinit_hw;
|
|
|
}
|
|
|
|
|
|
CAM_DBG(CAM_SFE, "SFE SOC resource enabled");
|
|
|
|
|
|
+ if (core_info->sfe_top->hw_ops.init) {
|
|
|
+ rc = core_info->sfe_top->hw_ops.init(core_info->sfe_top->top_priv, NULL, 0);
|
|
|
+ if (rc) {
|
|
|
+ CAM_ERR(CAM_SFE, "Top init failed rc=%d", rc);
|
|
|
+ goto deinit_hw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (core_info->sfe_bus_wr->hw_ops.init) {
|
|
|
+ rc = core_info->sfe_bus_wr->hw_ops.init(core_info->sfe_bus_wr->bus_priv, NULL, 0);
|
|
|
+ if (rc) {
|
|
|
+ CAM_ERR(CAM_SFE, "Bus WR init failed rc=%d", rc);
|
|
|
+ goto deinit_hw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (core_info->sfe_bus_rd->hw_ops.init) {
|
|
|
+ rc = core_info->sfe_bus_rd->hw_ops.init(core_info->sfe_bus_rd->bus_priv, NULL, 0);
|
|
|
+ if (rc) {
|
|
|
+ CAM_ERR(CAM_SFE, "Bus RD init failed rc=%d", rc);
|
|
|
+ goto deinit_hw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/*
|
|
|
* Async Reset as part of power ON
|
|
|
* Any register write in bus_wr_init/bus_rd_init
|
|
@@ -82,10 +106,8 @@ int cam_sfe_init_hw(void *hw_priv, void *init_hw_args, uint32_t arg_size)
|
|
|
sfe_hw->hw_state = CAM_HW_STATE_POWER_UP;
|
|
|
return rc;
|
|
|
|
|
|
-decrement_open_cnt:
|
|
|
- mutex_lock(&sfe_hw->hw_mutex);
|
|
|
- sfe_hw->open_count--;
|
|
|
- mutex_unlock(&sfe_hw->hw_mutex);
|
|
|
+deinit_hw:
|
|
|
+ cam_sfe_deinit_hw(hw_priv, NULL, 0);
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
@@ -93,8 +115,10 @@ int cam_sfe_deinit_hw(void *hw_priv, void *deinit_hw_args, uint32_t arg_size)
|
|
|
{
|
|
|
struct cam_hw_info *sfe_hw = hw_priv;
|
|
|
struct cam_hw_soc_info *soc_info = NULL;
|
|
|
+ struct cam_sfe_hw_core_info *core_info = NULL;
|
|
|
int rc = 0;
|
|
|
|
|
|
+
|
|
|
if (!hw_priv) {
|
|
|
CAM_ERR(CAM_SFE, "Invalid arguments");
|
|
|
return -EINVAL;
|
|
@@ -117,6 +141,25 @@ int cam_sfe_deinit_hw(void *hw_priv, void *deinit_hw_args, uint32_t arg_size)
|
|
|
mutex_unlock(&sfe_hw->hw_mutex);
|
|
|
|
|
|
soc_info = &sfe_hw->soc_info;
|
|
|
+ core_info = (struct cam_sfe_hw_core_info *)sfe_hw->core_info;
|
|
|
+
|
|
|
+ if (core_info->sfe_bus_rd->hw_ops.deinit) {
|
|
|
+ rc = core_info->sfe_bus_rd->hw_ops.deinit(core_info->sfe_bus_rd->bus_priv, NULL, 0);
|
|
|
+ if (rc)
|
|
|
+ CAM_ERR(CAM_SFE, "Bus RD deinit failed rc=%d", rc);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (core_info->sfe_bus_wr->hw_ops.deinit) {
|
|
|
+ rc = core_info->sfe_bus_wr->hw_ops.deinit(core_info->sfe_bus_wr->bus_priv, NULL, 0);
|
|
|
+ if (rc)
|
|
|
+ CAM_ERR(CAM_SFE, "Bus WR deinit failed rc=%d", rc);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (core_info->sfe_top->hw_ops.deinit) {
|
|
|
+ rc = core_info->sfe_top->hw_ops.deinit(core_info->sfe_top->top_priv, NULL, 0);
|
|
|
+ if (rc)
|
|
|
+ CAM_ERR(CAM_SFE, "Top deinit failed rc=%d", rc);
|
|
|
+ }
|
|
|
|
|
|
/* Turn OFF Regulators, Clocks and other SOC resources */
|
|
|
CAM_DBG(CAM_SFE, "Disable SFE SOC resource");
|