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

Commit 6ae6c3f6 authored by Jeyaprakash Soundrapandian's avatar Jeyaprakash Soundrapandian Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: enables BPS callback for CPAS" into dev/msm-4.9-camx

parents 9d60fc37 505351a1
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -873,6 +873,7 @@ static int cam_cpas_hw_update_ahb_vote(struct cam_hw_info *cpas_hw,
	if (!CAM_CPAS_CLIENT_VALID(client_indx))
		return -EINVAL;

	mutex_lock(&cpas_hw->hw_mutex);
	mutex_lock(&cpas_core->client_mutex[client_indx]);

	if (!CAM_CPAS_CLIENT_STARTED(cpas_core, client_indx)) {
@@ -892,6 +893,7 @@ static int cam_cpas_hw_update_ahb_vote(struct cam_hw_info *cpas_hw,

unlock_client:
	mutex_unlock(&cpas_core->client_mutex[client_indx]);
	mutex_unlock(&cpas_hw->hw_mutex);
	return rc;
}

@@ -907,6 +909,7 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
	struct cam_axi_vote *axi_vote;
	enum cam_vote_level applied_level = CAM_SVS_VOTE;
	int rc;
	struct cam_cpas_private_soc *soc_private = NULL;

	if (!hw_priv || !start_args) {
		CAM_ERR(CAM_CPAS, "Invalid arguments %pK %pK",
@@ -922,6 +925,8 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,

	cpas_hw = (struct cam_hw_info *)hw_priv;
	cpas_core = (struct cam_cpas *) cpas_hw->core_info;
	soc_private = (struct cam_cpas_private_soc *)
		cpas_hw->soc_info.soc_private;
	cmd_hw_start = (struct cam_cpas_hw_cmd_start *)start_args;
	client_indx = CAM_CPAS_GET_CLIENT_IDX(cmd_hw_start->client_handle);
	ahb_vote = cmd_hw_start->ahb_vote;
@@ -1005,8 +1010,9 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
	cpas_client->started = true;
	cpas_core->streamon_clients++;

	CAM_DBG(CAM_CPAS, "client_indx=%d, streamon_clients=%d",
		client_indx, cpas_core->streamon_clients);
	CAM_DBG(CAM_CPAS, "client=%s, streamon_clients=%d",
		soc_private->client_name[client_indx],
		cpas_core->streamon_clients);
done:
	mutex_unlock(&cpas_core->client_mutex[client_indx]);
	mutex_unlock(&cpas_hw->hw_mutex);
@@ -1028,6 +1034,7 @@ static int cam_cpas_hw_stop(void *hw_priv, void *stop_args,
	struct cam_cpas_client *cpas_client;
	struct cam_ahb_vote ahb_vote;
	struct cam_axi_vote axi_vote;
	struct cam_cpas_private_soc *soc_private = NULL;
	int rc = 0;
	long result;

@@ -1045,6 +1052,8 @@ static int cam_cpas_hw_stop(void *hw_priv, void *stop_args,

	cpas_hw = (struct cam_hw_info *)hw_priv;
	cpas_core = (struct cam_cpas *) cpas_hw->core_info;
	soc_private = (struct cam_cpas_private_soc *)
		cpas_hw->soc_info.soc_private;
	cmd_hw_stop = (struct cam_cpas_hw_cmd_stop *)stop_args;
	client_indx = CAM_CPAS_GET_CLIENT_IDX(cmd_hw_stop->client_handle);

@@ -1054,8 +1063,9 @@ static int cam_cpas_hw_stop(void *hw_priv, void *stop_args,
	mutex_lock(&cpas_hw->hw_mutex);
	mutex_lock(&cpas_core->client_mutex[client_indx]);

	CAM_DBG(CAM_CPAS, "client_indx=%d, streamon_clients=%d",
		client_indx, cpas_core->streamon_clients);
	CAM_DBG(CAM_CPAS, "client=%s, streamon_clients=%d",
		soc_private->client_name[client_indx],
		cpas_core->streamon_clients);

	if (!CAM_CPAS_CLIENT_STARTED(cpas_core, client_indx)) {
		CAM_ERR(CAM_CPAS, "Client %d is not started", client_indx);
+36 −2
Original line number Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2018, 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
@@ -33,6 +33,40 @@ static struct cam_bps_device_hw_info cam_bps_hw_info = {
};
EXPORT_SYMBOL(cam_bps_hw_info);

static bool cam_bps_cpas_cb(uint32_t client_handle, void *userdata,
	struct cam_cpas_irq_data *irq_data)
{
	bool error_handled = false;

	if (!irq_data)
		return error_handled;

	switch (irq_data->irq_type) {
	case CAM_CAMNOC_IRQ_IPE_BPS_UBWC_DECODE_ERROR:
		CAM_ERR_RATE_LIMIT(CAM_ICP,
			"IPE/BPS UBWC Decode error type=%d status=%x thr_err=%d, fcl_err=%d, len_md_err=%d, format_err=%d",
			irq_data->irq_type,
			irq_data->u.dec_err.decerr_status.value,
			irq_data->u.dec_err.decerr_status.thr_err,
			irq_data->u.dec_err.decerr_status.fcl_err,
			irq_data->u.dec_err.decerr_status.len_md_err,
			irq_data->u.dec_err.decerr_status.format_err);
		error_handled = true;
		break;
	case CAM_CAMNOC_IRQ_IPE_BPS_UBWC_ENCODE_ERROR:
		CAM_ERR_RATE_LIMIT(CAM_ICP,
			"IPE/BPS UBWC Encode error type=%d status=%x",
			irq_data->irq_type,
			irq_data->u.enc_err.encerr_status.value);
		error_handled = true;
		break;
	default:
		break;
	}

	return error_handled;
}

int cam_bps_register_cpas(struct cam_hw_soc_info *soc_info,
			struct cam_bps_device_core_info *core_info,
			uint32_t hw_idx)
@@ -42,7 +76,7 @@ int cam_bps_register_cpas(struct cam_hw_soc_info *soc_info,

	cpas_register_params.dev = &soc_info->pdev->dev;
	memcpy(cpas_register_params.identifier, "bps", sizeof("bps"));
	cpas_register_params.cam_cpas_client_cb = NULL;
	cpas_register_params.cam_cpas_client_cb = cam_bps_cpas_cb;
	cpas_register_params.cell_index = hw_idx;
	cpas_register_params.userdata = NULL;