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

Commit cf3ea8d5 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Merge remote-tracking branch 'dev/msm-4.14-camx' into msm-4.14 05/13"

parents 1467a7a1 48b37586
Loading
Loading
Loading
Loading
+12 −1
Original line number 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
 * 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;
};

/**
 * 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,
	struct cam_cdm_private_dt_data *data, enum cam_cdm_type type,
	uint32_t *index);
+31 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@

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*/
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;
}

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,
	bool enable)
{
@@ -186,6 +213,9 @@ void cam_hw_cdm_dump_core_debug_registers(
{
	uint32_t dump_reg, core_dbg, loop_cnt;

	if (!debugfs_entry.dump_register)
		return;

	mutex_lock(&cdm_hw->hw_mutex);
	cam_cdm_read_hw_reg(cdm_hw, CDM_CFG_CORE_EN, &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--;
	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);

+10 −0
Original line number Diff line number Diff line
@@ -45,6 +45,14 @@ static int cam_icp_context_dump_active_request(void *data, unsigned long iova,
		return -EINVAL;
	}

	mutex_lock(&ctx->ctx_mutex);

	if (ctx->state < CAM_CTX_ACQUIRED || ctx->state > CAM_CTX_ACTIVATED) {
		CAM_ERR(CAM_ICP, "Invalid state icp ctx %d state %d",
			ctx->ctx_id, ctx->state);
		goto end;
	}

	CAM_INFO(CAM_ICP, "iommu fault for icp ctx %d state %d",
		ctx->ctx_id, ctx->state);

@@ -63,6 +71,8 @@ static int cam_icp_context_dump_active_request(void *data, unsigned long iova,
				req->request_id, rc);
	}

end:
	mutex_unlock(&ctx->ctx_mutex);
	return rc;
}

+38 −1
Original line number Diff line number Diff line
@@ -64,6 +64,37 @@ static struct cam_icp_hw_mgr icp_hw_mgr;

static void cam_icp_mgr_process_dbg_buf(unsigned int debug_lvl);

static int cam_icp_dump_io_cfg(struct cam_icp_hw_ctx_data *ctx_data,
	int32_t buf_handle)
{
	uintptr_t vaddr_ptr;
	uint32_t  *ptr;
	size_t    len;
	int       rc, i;
	char      buf[512];
	int       used = 0;

	rc = cam_mem_get_cpu_buf(buf_handle, &vaddr_ptr, &len);
	if (rc) {
		CAM_ERR(CAM_ICP, "Unable to get io_cfg buf address for %d",
			ctx_data->ctx_id);
		return rc;
	}

	len = len / sizeof(uint32_t);
	ptr = (uint32_t *)vaddr_ptr;
	for (i = 0; i < len; i++) {
		used += snprintf(buf + used,
			sizeof(buf) - used, "0X%08X-", ptr[i]);
		if (!(i % 8)) {
			CAM_INFO(CAM_ICP, "%s: %s", __func__, buf);
			used = 0;
		}
	}

	return rc;
}

static int cam_icp_send_ubwc_cfg(struct cam_icp_hw_mgr *hw_mgr)
{
	struct cam_hw_intf *a5_dev_intf = NULL;
@@ -4063,8 +4094,12 @@ static int cam_icp_mgr_prepare_hw_update(void *hw_mgr_priv,

	packet = prepare_args->packet;

	if (cam_packet_util_validate_packet(packet, prepare_args->remain_len))
	if (cam_packet_util_validate_packet(packet, prepare_args->remain_len)) {
		mutex_unlock(&ctx_data->ctx_mutex);
		CAM_ERR(CAM_ICP, "ctx id: %u packet req id %lld validate fail",
			ctx_data->ctx_id, packet->header.request_id);
		return -EINVAL;
	}

	rc = cam_icp_mgr_pkt_validation(packet);
	if (rc) {
@@ -4685,6 +4720,8 @@ static int cam_icp_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)
	rc = cam_icp_mgr_send_config_io(ctx_data, io_buf_addr);
	if (rc) {
		CAM_ERR(CAM_ICP, "IO Config command failed %d", rc);
		cam_icp_dump_io_cfg(ctx_data,
			icp_dev_acquire_info->io_config_cmd_handle);
		goto ioconfig_failed;
	}