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

Commit fa429d92 authored by Pranav Sanwal's avatar Pranav Sanwal
Browse files

msm: camera: tfe: Correct Configuration of top tpg mux selection



In case of concurrent tpg use case, configure top tpg mux sel
properly.

CRs-Fixed: 2804168
Change-Id: I9955c9f03cebac854a339ff5161a99ecaf27cbdf
Signed-off-by: default avatarPranav Sanwal <psanwal@codeaurora.org>
parent b1ac875f
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2021, The Linux Foundation. All rights reserved.
 */

#include <linux/iopoll.h>
@@ -469,8 +469,14 @@ static int cam_top_tpg_start(void *hw_priv, void *start_args,
			soc_info->reg_map[0].mem_base + tpg_reg->tpg_vbi_cfg);

	/* Set the TOP tpg mux sel*/
	cam_io_w_mb((1 << tpg_hw->hw_intf->hw_idx),
	val = cam_io_r_mb(soc_info->reg_map[1].mem_base +
		tpg_reg->top_mux_reg_offset);
	val |= (1 << tpg_hw->hw_intf->hw_idx);

	cam_io_w_mb(val,
		soc_info->reg_map[1].mem_base + tpg_reg->top_mux_reg_offset);
	CAM_DBG(CAM_ISP, "TPG:%d Set top Mux: 0x%x",
		tpg_hw->hw_intf->hw_idx, val);

	val = ((tpg_data->num_active_lanes - 1) <<
		tpg_reg->tpg_num_active_lines_shift) |
@@ -498,6 +504,7 @@ static int cam_top_tpg_stop(void *hw_priv,
	struct cam_isp_resource_node           *tpg_res;
	const struct cam_top_tpg_reg_offset    *tpg_reg;
	struct cam_top_tpg_cfg                 *tpg_data;
	uint32_t                                val;

	if (!hw_priv || !stop_args ||
		(arg_size != sizeof(struct cam_isp_resource_node))) {
@@ -524,6 +531,16 @@ static int cam_top_tpg_stop(void *hw_priv,
	cam_io_w_mb(0, soc_info->reg_map[0].mem_base +
		tpg_reg->tpg_ctrl);

	/* Reset the TOP tpg mux sel*/
	val = cam_io_r_mb(soc_info->reg_map[1].mem_base +
		tpg_reg->top_mux_reg_offset);
	val &= ~(1 << tpg_hw->hw_intf->hw_idx);

	cam_io_w_mb(val,
		soc_info->reg_map[1].mem_base + tpg_reg->top_mux_reg_offset);
	CAM_DBG(CAM_ISP, "TPG:%d Reset Top Mux: 0x%x",
		tpg_hw->hw_intf->hw_idx, val);

	tpg_res->res_state = CAM_ISP_RESOURCE_STATE_RESERVED;

	CAM_DBG(CAM_ISP, "TPG:%d stopped", tpg_hw->hw_intf->hw_idx);