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

Commit 7a55bd37 authored by kartanan's avatar kartanan
Browse files

msm:camera: Add functionality to dump memory state



Dumps the memory state for the entire mapped region for CSIPHY

Change-Id: I45fe2b2cd324dc487089769066f14648fcaf424d
Signed-off-by: default avatarkartanan <kartanan@codeaurora.org>
parent 2a84a6a4
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -14,6 +14,29 @@
#include "cam_csiphy_core.h"
#include "include/cam_csiphy_1_0_hwreg.h"

#ifdef CAM_CSIPHY_MEM_DMP
int32_t cam_csiphy_mem_dmp(struct cam_hw_soc_info *soc_info)
{
	int32_t rc = 0;
	resource_size_t size = 0;
	void __iomem *addr = NULL;

	if (!soc_info) {
		rc = -EINVAL;
		CAM_ERR(CAM_CSIPHY, "invalid input %d", rc);
		return rc;
	}
	addr = soc_info->reg_map[0].mem_base;
	size = resource_size(soc_info->mem_block[0]);
	rc = cam_io_dump(addr, 0, (size >> 2));
	if (rc < 0) {
		CAM_ERR(CAM_CSIPHY, "generating dump failed %d", rc);
		return rc;
	}
	return rc;
}
#endif

int32_t cam_csiphy_enable_hw(struct csiphy_device *csiphy_dev)
{
	int32_t rc = 0;
+8 −0
Original line number Diff line number Diff line
@@ -67,4 +67,12 @@ int cam_csiphy_enable_hw(struct csiphy_device *csiphy_dev);
 */
int cam_csiphy_disable_hw(struct csiphy_device *csiphy_dev);

/**
 * @soc_info: Soc info of cam hw driver module
 *
 * This API dumps memory for the entire mapped region
 * (needs to be macro enabled before use)
 */
int cam_csiphy_mem_dmp(struct cam_hw_soc_info *soc_info);

#endif /* _CAM_CSIPHY_SOC_H_ */
+2 −2
Original line number Diff line number Diff line
@@ -262,11 +262,11 @@ int cam_io_dump(void __iomem *base_addr, uint32_t start_offset, int size)
		if (i % NUM_REGISTER_PER_LINE == 0) {
			snprintf(p_str, 12, "0x%08x: ",
				REG_OFFSET(start_offset, i));
			p_str += 12;
			p_str += 11;
		}
		data = readl_relaxed(base_addr + REG_OFFSET(start_offset, i));
		snprintf(p_str, 9, "%08x ", data);
		p_str += 9;
		p_str += 8;
		if ((i + 1) % NUM_REGISTER_PER_LINE == 0) {
			CAM_ERR(CAM_UTIL, "%s", line_str);
			line_str[0] = '\0';