|
@@ -1,6 +1,6 @@
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
/*
|
|
- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
|
|
|
|
|
+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
|
*/
|
|
*/
|
|
|
|
|
|
#include <linux/of.h>
|
|
#include <linux/of.h>
|
|
@@ -151,6 +151,7 @@ static int cam_bps_handle_pc(struct cam_hw_info *bps_dev)
|
|
struct cam_hw_soc_info *soc_info = NULL;
|
|
struct cam_hw_soc_info *soc_info = NULL;
|
|
struct cam_bps_device_core_info *core_info = NULL;
|
|
struct cam_bps_device_core_info *core_info = NULL;
|
|
struct cam_bps_device_hw_info *hw_info = NULL;
|
|
struct cam_bps_device_hw_info *hw_info = NULL;
|
|
|
|
+ int rc = 0;
|
|
int pwr_ctrl;
|
|
int pwr_ctrl;
|
|
int pwr_status;
|
|
int pwr_status;
|
|
|
|
|
|
@@ -158,13 +159,22 @@ static int cam_bps_handle_pc(struct cam_hw_info *bps_dev)
|
|
core_info = (struct cam_bps_device_core_info *)bps_dev->core_info;
|
|
core_info = (struct cam_bps_device_core_info *)bps_dev->core_info;
|
|
hw_info = core_info->bps_hw_info;
|
|
hw_info = core_info->bps_hw_info;
|
|
|
|
|
|
- cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
- CAM_CPAS_REG_CPASTOP, hw_info->pwr_ctrl,
|
|
|
|
- true, &pwr_ctrl);
|
|
|
|
|
|
+ rc = cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
+ CAM_CPAS_REG_CPASTOP, hw_info->pwr_ctrl,
|
|
|
|
+ true, &pwr_ctrl);
|
|
|
|
+ if (rc) {
|
|
|
|
+ CAM_ERR(CAM_ICP, "power ctrl read failed rc=%d", rc);
|
|
|
|
+ return rc;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!(pwr_ctrl & BPS_COLLAPSE_MASK)) {
|
|
if (!(pwr_ctrl & BPS_COLLAPSE_MASK)) {
|
|
- cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
- CAM_CPAS_REG_CPASTOP, hw_info->pwr_status,
|
|
|
|
- true, &pwr_status);
|
|
|
|
|
|
+ rc = cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
+ CAM_CPAS_REG_CPASTOP, hw_info->pwr_status,
|
|
|
|
+ true, &pwr_status);
|
|
|
|
+ if (rc) {
|
|
|
|
+ CAM_ERR(CAM_ICP, "power status read failed rc=%d", rc);
|
|
|
|
+ return rc;
|
|
|
|
+ }
|
|
|
|
|
|
cam_cpas_reg_write(core_info->cpas_handle,
|
|
cam_cpas_reg_write(core_info->cpas_handle,
|
|
CAM_CPAS_REG_CPASTOP,
|
|
CAM_CPAS_REG_CPASTOP,
|
|
@@ -174,15 +184,30 @@ static int cam_bps_handle_pc(struct cam_hw_info *bps_dev)
|
|
CAM_WARN(CAM_PERF, "BPS: pwr_status(%x):pwr_ctrl(%x)",
|
|
CAM_WARN(CAM_PERF, "BPS: pwr_status(%x):pwr_ctrl(%x)",
|
|
pwr_status, pwr_ctrl);
|
|
pwr_status, pwr_ctrl);
|
|
}
|
|
}
|
|
- cam_bps_get_gdsc_control(soc_info);
|
|
|
|
- cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
- CAM_CPAS_REG_CPASTOP, hw_info->pwr_ctrl, true,
|
|
|
|
- &pwr_ctrl);
|
|
|
|
- cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
- CAM_CPAS_REG_CPASTOP, hw_info->pwr_status,
|
|
|
|
- true, &pwr_status);
|
|
|
|
- CAM_DBG(CAM_PERF, "pwr_ctrl = %x pwr_status = %x",
|
|
|
|
- pwr_ctrl, pwr_status);
|
|
|
|
|
|
+
|
|
|
|
+ rc = cam_bps_get_gdsc_control(soc_info);
|
|
|
|
+ if (rc) {
|
|
|
|
+ CAM_ERR(CAM_ICP, "failed to get gdsc control rc=%d", rc);
|
|
|
|
+ return rc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ rc = cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
+ CAM_CPAS_REG_CPASTOP, hw_info->pwr_ctrl,
|
|
|
|
+ true, &pwr_ctrl);
|
|
|
|
+ if (rc) {
|
|
|
|
+ CAM_ERR(CAM_ICP, "power ctrl read failed rc=%d", rc);
|
|
|
|
+ return rc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ rc = cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
+ CAM_CPAS_REG_CPASTOP, hw_info->pwr_status,
|
|
|
|
+ true, &pwr_status);
|
|
|
|
+ if (rc) {
|
|
|
|
+ CAM_ERR(CAM_ICP, "power status read failed rc=%d", rc);
|
|
|
|
+ return rc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CAM_DBG(CAM_PERF, "pwr_ctrl=%x pwr_status=%x", pwr_ctrl, pwr_status);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -200,8 +225,14 @@ static int cam_bps_handle_resume(struct cam_hw_info *bps_dev)
|
|
core_info = (struct cam_bps_device_core_info *)bps_dev->core_info;
|
|
core_info = (struct cam_bps_device_core_info *)bps_dev->core_info;
|
|
hw_info = core_info->bps_hw_info;
|
|
hw_info = core_info->bps_hw_info;
|
|
|
|
|
|
- cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
- CAM_CPAS_REG_CPASTOP, hw_info->pwr_ctrl, true, &pwr_ctrl);
|
|
|
|
|
|
+ rc = cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
+ CAM_CPAS_REG_CPASTOP, hw_info->pwr_ctrl,
|
|
|
|
+ true, &pwr_ctrl);
|
|
|
|
+ if (rc) {
|
|
|
|
+ CAM_ERR(CAM_ICP, "power ctrl read failed rc=%d", rc);
|
|
|
|
+ return rc;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (pwr_ctrl & BPS_COLLAPSE_MASK) {
|
|
if (pwr_ctrl & BPS_COLLAPSE_MASK) {
|
|
CAM_DBG(CAM_PERF, "BPS: pwr_ctrl set(%x)", pwr_ctrl);
|
|
CAM_DBG(CAM_PERF, "BPS: pwr_ctrl set(%x)", pwr_ctrl);
|
|
cam_cpas_reg_write(core_info->cpas_handle,
|
|
cam_cpas_reg_write(core_info->cpas_handle,
|
|
@@ -210,12 +241,28 @@ static int cam_bps_handle_resume(struct cam_hw_info *bps_dev)
|
|
}
|
|
}
|
|
|
|
|
|
rc = cam_bps_transfer_gdsc_control(soc_info);
|
|
rc = cam_bps_transfer_gdsc_control(soc_info);
|
|
- cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
- CAM_CPAS_REG_CPASTOP, hw_info->pwr_ctrl, true, &pwr_ctrl);
|
|
|
|
- cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
- CAM_CPAS_REG_CPASTOP, hw_info->pwr_status, true, &pwr_status);
|
|
|
|
- CAM_DBG(CAM_PERF, "pwr_ctrl = %x pwr_status = %x",
|
|
|
|
- pwr_ctrl, pwr_status);
|
|
|
|
|
|
+ if (rc) {
|
|
|
|
+ CAM_ERR(CAM_ICP, "failed to transfer gdsc control rc=%d", rc);
|
|
|
|
+ return rc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ rc = cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
+ CAM_CPAS_REG_CPASTOP, hw_info->pwr_ctrl,
|
|
|
|
+ true, &pwr_ctrl);
|
|
|
|
+ if (rc) {
|
|
|
|
+ CAM_ERR(CAM_ICP, "power ctrl read failed rc=%d", rc);
|
|
|
|
+ return rc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ rc = cam_cpas_reg_read(core_info->cpas_handle,
|
|
|
|
+ CAM_CPAS_REG_CPASTOP, hw_info->pwr_status,
|
|
|
|
+ true, &pwr_status);
|
|
|
|
+ if (rc) {
|
|
|
|
+ CAM_ERR(CAM_ICP, "power status read failed rc=%d", rc);
|
|
|
|
+ return rc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CAM_DBG(CAM_PERF, "pwr_ctrl=%x pwr_status=%x", pwr_ctrl, pwr_status);
|
|
|
|
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|