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

Commit 485b7a4b authored by Suresh Vankadara's avatar Suresh Vankadara Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: cdm: Dump registers based on debugfs" into dev/msm-4.14-camx

parents f9e21b9d 181c13ae
Loading
Loading
Loading
Loading
+12 −1
Original line number Original line Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -251,6 +251,17 @@ struct cam_cdm_intf_mgr {
	int32_t refcount;
	int32_t refcount;
};
};


/**
 * struct cam_cdm_debugfs_entry : debugfs entry struct
 *
 * @dentry                       : entry of debugfs
 * @dump_register                : flag to dump registers
 */
struct cam_cdm_debugfs_entry {
	struct dentry   *dentry;
	bool             dump_register;
};

int cam_cdm_intf_register_hw_cdm(struct cam_hw_intf *hw,
int cam_cdm_intf_register_hw_cdm(struct cam_hw_intf *hw,
	struct cam_cdm_private_dt_data *data, enum cam_cdm_type type,
	struct cam_cdm_private_dt_data *data, enum cam_cdm_type type,
	uint32_t *index);
	uint32_t *index);
+31 −0
Original line number Original line Diff line number Diff line
@@ -38,6 +38,8 @@


static void cam_hw_cdm_work(struct work_struct *work);
static void cam_hw_cdm_work(struct work_struct *work);


static struct cam_cdm_debugfs_entry debugfs_entry;

/* DT match table entry for all CDM variants*/
/* DT match table entry for all CDM variants*/
static const struct of_device_id msm_cam_hw_cdm_dt_match[] = {
static const struct of_device_id msm_cam_hw_cdm_dt_match[] = {
	{
	{
@@ -69,6 +71,31 @@ int cam_hw_cdm_bl_fifo_pending_bl_rb(struct cam_hw_info *cdm_hw,
	return rc;
	return rc;
}
}


static int cam_hw_cdm_create_debugfs_entry(void)
{
	int rc = 0;

	debugfs_entry.dentry = debugfs_create_dir("camera_cdm", NULL);
	if (!debugfs_entry.dentry)
		return -ENOMEM;

	if (!debugfs_create_bool("dump_register",
		0644,
		debugfs_entry.dentry,
		&debugfs_entry.dump_register)) {
		CAM_ERR(CAM_CDM,
			"failed to create dump_register entry");
		rc = -ENOMEM;
		goto err;
	}

	return rc;
err:
	debugfs_remove_recursive(debugfs_entry.dentry);
	debugfs_entry.dentry = NULL;
	return rc;
}

static int cam_hw_cdm_enable_bl_done_irq(struct cam_hw_info *cdm_hw,
static int cam_hw_cdm_enable_bl_done_irq(struct cam_hw_info *cdm_hw,
	bool enable)
	bool enable)
{
{
@@ -186,6 +213,9 @@ void cam_hw_cdm_dump_core_debug_registers(
{
{
	uint32_t dump_reg, core_dbg, loop_cnt;
	uint32_t dump_reg, core_dbg, loop_cnt;


	if (!debugfs_entry.dump_register)
		return;

	mutex_lock(&cdm_hw->hw_mutex);
	mutex_lock(&cdm_hw->hw_mutex);
	cam_cdm_read_hw_reg(cdm_hw, CDM_CFG_CORE_EN, &dump_reg);
	cam_cdm_read_hw_reg(cdm_hw, CDM_CFG_CORE_EN, &dump_reg);
	CAM_ERR(CAM_CDM, "CDM HW core status=%x", dump_reg);
	CAM_ERR(CAM_CDM, "CDM HW core status=%x", dump_reg);
@@ -1020,6 +1050,7 @@ int cam_hw_cdm_probe(struct platform_device *pdev)
	}
	}
	cdm_hw->open_count--;
	cdm_hw->open_count--;
	mutex_unlock(&cdm_hw->hw_mutex);
	mutex_unlock(&cdm_hw->hw_mutex);
	cam_hw_cdm_create_debugfs_entry();


	CAM_DBG(CAM_CDM, "CDM%d probe successful", cdm_hw_intf->hw_idx);
	CAM_DBG(CAM_CDM, "CDM%d probe successful", cdm_hw_intf->hw_idx);