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

Commit 842380c4 authored by Camera Software Integration's avatar Camera Software Integration Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: cpas: Add support for custom QoS selection" into camera-kernel.lnx.4.0

parents c651d58e 5cb16c01
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
@@ -1810,6 +1810,35 @@ static int cam_cpas_log_vote(struct cam_hw_info *cpas_hw)
	return rc;
}

static int cam_cpas_select_qos(struct cam_hw_info *cpas_hw,
	uint32_t selection_mask)
{
	struct cam_cpas *cpas_core = (struct cam_cpas *) cpas_hw->core_info;
	int rc = 0;

	mutex_lock(&cpas_hw->hw_mutex);

	if (cpas_hw->hw_state == CAM_HW_STATE_POWER_UP) {
		CAM_ERR(CAM_CPAS,
			"Hw already in power up state, can't change QoS settings");
		rc = -EINVAL;
		goto done;
	}

	if (cpas_core->internal_ops.setup_qos_settings) {
		rc = cpas_core->internal_ops.setup_qos_settings(cpas_hw,
			selection_mask);
		if (rc)
			CAM_ERR(CAM_CPAS, "Failed in changing QoS %d", rc);
	} else {
		CAM_WARN(CAM_CPAS, "No ops for qos_settings");
	}

done:
	mutex_unlock(&cpas_hw->hw_mutex);
	return rc;
}

static int cam_cpas_hw_process_cmd(void *hw_priv,
	uint32_t cmd_type, void *cmd_args, uint32_t arg_size)
{
@@ -1916,6 +1945,20 @@ static int cam_cpas_hw_process_cmd(void *hw_priv,
		rc = cam_cpas_log_vote(hw_priv);
		break;
	}

	case CAM_CPAS_HW_CMD_SELECT_QOS: {
		uint32_t *selection_mask;

		if (sizeof(uint32_t) != arg_size) {
			CAM_ERR(CAM_CPAS, "cmd_type %d, size mismatch %d",
				cmd_type, arg_size);
			break;
		}

		selection_mask = (uint32_t *)cmd_args;
		rc = cam_cpas_select_qos(hw_priv, *selection_mask);
		break;
	}
	default:
		CAM_ERR(CAM_CPAS, "CPAS HW command not valid =%d", cmd_type);
		break;
+3 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ enum cam_cpas_access_type {
 * @setup_regbase: Function pointer for setup rebase indices
 * @power_on: Function pointer for hw core specific power on settings
 * @power_off: Function pointer for hw core specific power off settings
 * @setup_qos_settings: Function pointer for hw to select a specific qos header
 *
 */
struct cam_cpas_internal_ops {
@@ -67,6 +68,8 @@ struct cam_cpas_internal_ops {
		int32_t regbase_index[], int32_t num_reg_map);
	int (*power_on)(struct cam_hw_info *cpas_hw);
	int (*power_off)(struct cam_hw_info *cpas_hw);
	int (*setup_qos_settings)(struct cam_hw_info *cpas_hw,
		uint32_t selection_mask);
};

/**
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ enum cam_cpas_hw_cmd_process {
	CAM_CPAS_HW_CMD_AHB_VOTE,
	CAM_CPAS_HW_CMD_AXI_VOTE,
	CAM_CPAS_HW_CMD_LOG_VOTE,
	CAM_CPAS_HW_CMD_SELECT_QOS,
	CAM_CPAS_HW_CMD_INVALID,
};

+25 −0
Original line number Diff line number Diff line
@@ -429,6 +429,31 @@ void cam_cpas_log_votes(void)
}
EXPORT_SYMBOL(cam_cpas_log_votes);

int cam_cpas_select_qos_settings(uint32_t selection_mask)
{
	int rc = 0;

	if (!CAM_CPAS_INTF_INITIALIZED()) {
		CAM_ERR(CAM_CPAS, "cpas intf not initialized");
		return -EBADR;
	}

	if (g_cpas_intf->hw_intf->hw_ops.process_cmd) {
		rc = g_cpas_intf->hw_intf->hw_ops.process_cmd(
			g_cpas_intf->hw_intf->hw_priv,
			CAM_CPAS_HW_CMD_SELECT_QOS, &selection_mask,
			sizeof(selection_mask));
		if (rc)
			CAM_ERR(CAM_CPAS, "Failed in process_cmd, rc=%d", rc);
	} else {
		CAM_ERR(CAM_CPAS, "Invalid process_cmd ops");
		rc = -EBADR;
	}

	return rc;
}
EXPORT_SYMBOL(cam_cpas_select_qos_settings);

int cam_cpas_unregister_client(uint32_t client_handle)
{
	int rc;
+2 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2018, 2020 The Linux Foundation. All rights reserved.
 */

#include "cam_cpas_hw_intf.h"
@@ -77,6 +77,7 @@ int cam_camsstop_get_internal_ops(struct cam_cpas_internal_ops *internal_ops)
	internal_ops->setup_regbase = cam_camsstop_setup_regbase_indices;
	internal_ops->power_on = NULL;
	internal_ops->power_off = NULL;
	internal_ops->setup_qos_settings = NULL;

	return 0;
}
Loading