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

Commit da18d6ec authored by Wyes Karny's avatar Wyes Karny
Browse files

msm: camera: isp: Support UBWC compression disable



Support UBWC compression disable via debugfs. When debugfs entry
disable_ubwc_comp is set, overwrite the ubwc mode_cfg register for WM to
force disable UBWC compression.

CRs-Fixed: 2789618
Change-Id: I912f56254ee41f5b6a0e2e1de14c570cd0e5813f
Signed-off-by: default avatarWyes Karny <wkarny@codeaurora.org>
parent 34cbbdd6
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, 2021 The Linux Foundation. All rights reserved.
 */

#ifndef _HFI_INTF_H_
@@ -147,8 +147,9 @@ int hfi_cmd_ubwc_config_ext(uint32_t *ubwc_ipe_cfg,
 * hfi_cmd_ubwc_config() - UBWC configuration to firmware
 *                         for older targets
 * @ubwc_cfg:           UBWC configuration parameters
 * @disable_ubwc_comp:  Disable UBWC compression
 */
int hfi_cmd_ubwc_config(uint32_t *ubwc_cfg);
int hfi_cmd_ubwc_config(uint32_t *ubwc_cfg, bool disable_ubwc_comp);

/**
 * cam_hfi_resume() - function to resume
+7 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, 2021 The Linux Foundation. All rights reserved.
 */

#include <linux/io.h>
@@ -269,7 +269,7 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id,
	return rc;
}

int hfi_cmd_ubwc_config(uint32_t *ubwc_cfg)
int hfi_cmd_ubwc_config(uint32_t *ubwc_cfg, bool disable_ubwc_comp)
{
	uint8_t *prop;
	struct hfi_cmd_prop *dbg_prop;
@@ -292,6 +292,11 @@ int hfi_cmd_ubwc_config(uint32_t *ubwc_cfg)
	dbg_prop->num_prop = 1;
	dbg_prop->prop_data[0] = HFI_PROP_SYS_UBWC_CFG;
	dbg_prop->prop_data[1] = ubwc_cfg[0];
	if (disable_ubwc_comp) {
		ubwc_cfg[1] &= ~CAM_ICP_UBWC_COMP_EN;
		CAM_DBG(CAM_ICP, "UBWC comp force disable, val= 0x%x",
			ubwc_cfg[1]);
	}
	dbg_prop->prop_data[2] = ubwc_cfg[1];

	hfi_write_cmd(prop);
+24 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/slab.h>
@@ -535,6 +535,7 @@ int cam_a5_process_cmd(void *device_priv, uint32_t cmd_type,
		break;
	case CAM_ICP_A5_CMD_UBWC_CFG: {
		struct a5_ubwc_cfg_ext *ubwc_cfg_ext = NULL;
		uint32_t *disable_ubwc_comp;

		a5_soc = soc_info->soc_private;
		if (!a5_soc) {
@@ -542,6 +543,13 @@ int cam_a5_process_cmd(void *device_priv, uint32_t cmd_type,
			return -EINVAL;
		}

		if (!cmd_args) {
			CAM_ERR(CAM_ICP, "Invalid args");
			return -EINVAL;
		}

		disable_ubwc_comp = (uint32_t *)cmd_args;

		if (a5_soc->ubwc_config_ext) {
			/* Invoke kernel API to determine DDR type */
			ddr_type = of_fdt_get_ddrtype();
@@ -558,10 +566,24 @@ int cam_a5_process_cmd(void *device_priv, uint32_t cmd_type,
				ubwc_cfg_ext->ubwc_bps_fetch_cfg[index];
			ubwc_bps_cfg[1] =
				ubwc_cfg_ext->ubwc_bps_write_cfg[index];

			if (*disable_ubwc_comp) {
				ubwc_ipe_cfg[1] &= ~CAM_ICP_UBWC_COMP_EN;
				ubwc_bps_cfg[1] &= ~CAM_ICP_UBWC_COMP_EN;
				CAM_DBG(CAM_ISP,
					"UBWC comp force disable, ubwc_ipe_cfg:  0x%x, ubwc_bps_cfg: 0x%x",
					ubwc_ipe_cfg[1], ubwc_bps_cfg[1]);
			}

			rc = hfi_cmd_ubwc_config_ext(&ubwc_ipe_cfg[0],
					&ubwc_bps_cfg[0]);
		} else {
			rc = hfi_cmd_ubwc_config(a5_soc->uconfig.ubwc_cfg);
			if (*disable_ubwc_comp)
				rc = hfi_cmd_ubwc_config(
					a5_soc->uconfig.ubwc_cfg, true);
			else
				rc = hfi_cmd_ubwc_config(
					a5_soc->uconfig.ubwc_cfg, false);
		}

		break;
+15 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/uaccess.h>
@@ -109,6 +109,7 @@ static int cam_icp_send_ubwc_cfg(struct cam_icp_hw_mgr *hw_mgr)
{
	struct cam_hw_intf *a5_dev_intf = NULL;
	int rc;
	uint32_t disable_ubwc_comp = 0;

	a5_dev_intf = hw_mgr->a5_dev_intf;
	if (!a5_dev_intf) {
@@ -116,9 +117,12 @@ static int cam_icp_send_ubwc_cfg(struct cam_icp_hw_mgr *hw_mgr)
		return -EINVAL;
	}

	disable_ubwc_comp = hw_mgr->disable_ubwc_comp;

	rc = a5_dev_intf->hw_ops.process_cmd(
		a5_dev_intf->hw_priv,
		CAM_ICP_A5_CMD_UBWC_CFG, NULL, 0);
		CAM_ICP_A5_CMD_UBWC_CFG, (void *)&disable_ubwc_comp,
		sizeof(disable_ubwc_comp));
	if (rc)
		CAM_ERR(CAM_ICP, "CAM_ICP_A5_CMD_UBWC_CFG is failed");

@@ -1956,6 +1960,15 @@ static int cam_icp_hw_mgr_create_debugfs_entry(void)
		goto err;
	}

	if (!debugfs_create_bool("disable_ubwc_comp",
		0644,
		icp_hw_mgr.dentry,
		&icp_hw_mgr.disable_ubwc_comp)) {
		CAM_ERR(CAM_ICP, "failed to create disable_ubwc_comp");
		rc = -ENOMEM;
		goto err;
	}

	/* Set default hang dump lvl */
	icp_hw_mgr.a5_fw_dump_lvl = HFI_FW_DUMP_ON_FAILURE;
	return rc;
+3 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 */

#ifndef CAM_ICP_HW_MGR_H
@@ -352,6 +352,7 @@ struct cam_icp_clk_info {
 * @bps_dev_intf: Device interface for BPS
 * @ipe_clk_state: IPE clock state flag
 * @bps_clk_state: BPS clock state flag
 * @disable_ubwc_comp: Disable UBWC compression
 * @recovery: Flag to validate if in previous session FW
 *            reported a fatal error or wdt. If set FW is
 *            re-downloaded for new camera session.
@@ -401,6 +402,7 @@ struct cam_icp_hw_mgr {
	struct cam_hw_intf *bps_dev_intf;
	bool ipe_clk_state;
	bool bps_clk_state;
	bool disable_ubwc_comp;
	atomic_t recovery;
};

Loading