Эх сурвалжийг харах

msm: camera: icp: Dumping icp clocks in error case

Dumping both ipe and bps clocks in case of frame process
failure. Added generic utility function to dump any hw's
clocks.

CRs-Fixed: 3297488
Change-Id: Ia952696b0288361bffaeadfd53041c72fd21f96d
Signed-off-by: Yash Upadhyay <[email protected]>
Signed-off-by: Alok Chauhan <[email protected]>
Yash Upadhyay 2 жил өмнө
parent
commit
419797f633

+ 5 - 1
drivers/cam_icp/icp_hw/bps_hw/bps_core.c

@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 // SPDX-License-Identifier: GPL-2.0-only
 /*
 /*
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024, Qualcomm Innovation Center, Inc. All rights reserved.
  */
  */
 
 
 #include <linux/of.h>
 #include <linux/of.h>
@@ -473,6 +473,10 @@ int cam_bps_process_cmd(void *device_priv, uint32_t cmd_type,
 	case CAM_ICP_DEV_CMD_RESET:
 	case CAM_ICP_DEV_CMD_RESET:
 		rc = cam_bps_cmd_reset(soc_info, core_info);
 		rc = cam_bps_cmd_reset(soc_info, core_info);
 		break;
 		break;
+	case CAM_ICP_DEV_CMD_DUMP_CLK: {
+		rc = cam_soc_util_dump_clk(soc_info);
+		break;
+	}
 	default:
 	default:
 		CAM_ERR(CAM_ICP, "Invalid Cmd Type:%u", cmd_type);
 		CAM_ERR(CAM_ICP, "Invalid Cmd Type:%u", cmd_type);
 		rc = -EINVAL;
 		rc = -EINVAL;

+ 22 - 2
drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c

@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 // SPDX-License-Identifier: GPL-2.0-only
 /*
 /*
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  */
  */
 
 
 #include <linux/uaccess.h>
 #include <linux/uaccess.h>
@@ -2329,9 +2329,28 @@ static void cam_icp_mgr_compute_fw_avg_response_time(struct cam_icp_hw_ctx_data
 		(perf_stats->total_resp_time / perf_stats->total_requests));
 		(perf_stats->total_resp_time / perf_stats->total_requests));
 }
 }
 
 
+static int cam_icp_mgr_dump_clk(struct cam_icp_hw_ctx_data *ctx_data)
+{
+	uint32_t i;
+	struct cam_hw_intf *dev_intf = NULL;
+
+	for (i = 0; i < ctx_data->device_info->hw_dev_cnt; i++) {
+		dev_intf = ctx_data->device_info->dev_intf[i];
+		if (!dev_intf) {
+			CAM_ERR(CAM_ICP, "Device intf for %s[%u] is NULL",
+				ctx_data->device_info->dev_name, i);
+			return -EINVAL;
+		}
+		dev_intf->hw_ops.process_cmd(dev_intf->hw_priv, CAM_ICP_DEV_CMD_DUMP_CLK,
+				NULL, 0);
+	}
+
+	return 0;
+}
+
 static int cam_icp_mgr_handle_frame_process(uint32_t *msg_ptr, int flag)
 static int cam_icp_mgr_handle_frame_process(uint32_t *msg_ptr, int flag)
 {
 {
-	int i;
+	int i, rc;
 	uint32_t idx, event_id;
 	uint32_t idx, event_id;
 	uint64_t request_id;
 	uint64_t request_id;
 	struct cam_icp_hw_mgr *hw_mgr = NULL;
 	struct cam_icp_hw_mgr *hw_mgr = NULL;
@@ -2394,6 +2413,7 @@ static int cam_icp_mgr_handle_frame_process(uint32_t *msg_ptr, int flag)
 				cam_icp_error_handle_id_to_type(ioconfig_ack->err_type),
 				cam_icp_error_handle_id_to_type(ioconfig_ack->err_type),
 				request_id);
 				request_id);
 			event_id = CAM_CTX_EVT_ID_ERROR;
 			event_id = CAM_CTX_EVT_ID_ERROR;
+			rc = cam_icp_mgr_dump_clk(ctx_data);
 		}
 		}
 		buf_data.evt_param = cam_icp_handle_err_type_to_evt_param(ioconfig_ack->err_type);
 		buf_data.evt_param = cam_icp_handle_err_type_to_evt_param(ioconfig_ack->err_type);
 	} else {
 	} else {

+ 2 - 1
drivers/cam_icp/icp_hw/icp_hw_mgr/include/cam_icp_hw_intf.h

@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
 /*
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  */
  */
 
 
 #ifndef CAM_ICP_HW_INTF_H
 #ifndef CAM_ICP_HW_INTF_H
@@ -55,6 +55,7 @@ enum cam_icp_dev_cmd_type {
 	CAM_ICP_DEV_CMD_UPDATE_CLK,
 	CAM_ICP_DEV_CMD_UPDATE_CLK,
 	CAM_ICP_DEV_CMD_DISABLE_CLK,
 	CAM_ICP_DEV_CMD_DISABLE_CLK,
 	CAM_ICP_DEV_CMD_RESET,
 	CAM_ICP_DEV_CMD_RESET,
+	CAM_ICP_DEV_CMD_DUMP_CLK,
 	CAM_ICP_DEV_CMD_MAX
 	CAM_ICP_DEV_CMD_MAX
 };
 };
 
 

+ 5 - 1
drivers/cam_icp/icp_hw/ipe_hw/ipe_core.c

@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 // SPDX-License-Identifier: GPL-2.0-only
 /*
 /*
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024, Qualcomm Innovation Center, Inc. All rights reserved.
  */
  */
 
 
 #include <linux/of.h>
 #include <linux/of.h>
@@ -465,6 +465,10 @@ int cam_ipe_process_cmd(void *device_priv, uint32_t cmd_type,
 	case CAM_ICP_DEV_CMD_RESET:
 	case CAM_ICP_DEV_CMD_RESET:
 		rc = cam_ipe_cmd_reset(soc_info, core_info);
 		rc = cam_ipe_cmd_reset(soc_info, core_info);
 		break;
 		break;
+	case CAM_ICP_DEV_CMD_DUMP_CLK: {
+		rc = cam_soc_util_dump_clk(soc_info);
+		break;
+	}
 	default:
 	default:
 		CAM_ERR(CAM_ICP, "Invalid Cmd Type:%u", cmd_type);
 		CAM_ERR(CAM_ICP, "Invalid Cmd Type:%u", cmd_type);
 		rc = -EINVAL;
 		rc = -EINVAL;

+ 17 - 1
drivers/cam_utils/cam_soc_util.c

@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 // SPDX-License-Identifier: GPL-2.0-only
 /*
 /*
  * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024, Qualcomm Innovation Center, Inc. All rights reserved.
  */
  */
 
 
 #include <linux/of.h>
 #include <linux/of.h>
@@ -9,6 +9,7 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/gpio.h>
 #include <linux/gpio.h>
 #include <linux/of_gpio.h>
 #include <linux/of_gpio.h>
+#include <linux/clk/qcom.h>
 #include "cam_soc_util.h"
 #include "cam_soc_util.h"
 #include "cam_debug_util.h"
 #include "cam_debug_util.h"
 #include "cam_cx_ipeak.h"
 #include "cam_cx_ipeak.h"
@@ -2311,6 +2312,21 @@ int cam_soc_util_set_clk_rate_level(struct cam_hw_soc_info *soc_info,
 	return rc;
 	return rc;
 };
 };
 
 
+int cam_soc_util_dump_clk(struct cam_hw_soc_info *soc_info)
+{
+	int i, rc = 0;
+
+	if (!soc_info)
+		return -EINVAL;
+
+	for (i = 0; i < soc_info->num_clk; i++) {
+		CAM_INFO(CAM_UTIL, "Dumping clock = %s", soc_info->clk_name[i]);
+		qcom_clk_dump(soc_info->clk[i], NULL, false);
+	}
+
+	return rc;
+}
+
 static int cam_soc_util_get_dt_gpio_req_tbl(struct device_node *of_node,
 static int cam_soc_util_get_dt_gpio_req_tbl(struct device_node *of_node,
 	struct cam_soc_gpio_data *gconf, uint16_t *gpio_array,
 	struct cam_soc_gpio_data *gconf, uint16_t *gpio_array,
 	uint16_t gpio_array_size)
 	uint16_t gpio_array_size)

+ 13 - 1
drivers/cam_utils/cam_soc_util.h

@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
 /*
  * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024, Qualcomm Innovation Center, Inc. All rights reserved.
  */
  */
 
 
 #ifndef _CAM_SOC_UTIL_H_
 #ifndef _CAM_SOC_UTIL_H_
@@ -607,6 +607,18 @@ int cam_soc_util_set_clk_rate_level(struct cam_hw_soc_info *soc_info,
 int cam_soc_util_clk_disable(struct cam_hw_soc_info *soc_info, int cesta_client_idx,
 int cam_soc_util_clk_disable(struct cam_hw_soc_info *soc_info, int cesta_client_idx,
 	bool optional_clk, int32_t clk_idx);
 	bool optional_clk, int32_t clk_idx);
 
 
+/**
+ * cam_soc_util_dump_clk()
+ *
+ * @brief:              Dumps all the clocks of the caller hw, using
+ *                      clock api.
+ *
+ * @soc_info:           Device soc information
+ * @return:             Success or failure
+ */
+
+int cam_soc_util_dump_clk(struct cam_hw_soc_info *soc_info);
+
 /**
 /**
  * cam_soc_util_irq_enable()
  * cam_soc_util_irq_enable()
  *
  *