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

Commit 1873019e authored by Rajakumar Govindaram's avatar Rajakumar Govindaram
Browse files

msm: camera: jpeg: make some data types common to enc and dma



Make some data structures common to jpeg encoder/dma and move
to common header.

Change-Id: Iab850ca8ad5b33a63b535a19bc457abb8d4a918e
Signed-off-by: default avatarRajakumar Govindaram <rajakuma@codeaurora.org>
parent 51baf468
Loading
Loading
Loading
Loading
+24 −29
Original line number Diff line number Diff line
@@ -28,8 +28,6 @@
#include "cam_hw_mgr_intf.h"
#include "cam_jpeg_hw_mgr_intf.h"
#include "cam_jpeg_hw_mgr.h"
#include "cam_enc_hw_intf.h"
#include "cam_dma_hw_intf.h"
#include "cam_smmu_api.h"
#include "cam_mem_mgr.h"
#include "cam_req_mgr_workq.h"
@@ -88,13 +86,20 @@ static int cam_jpeg_mgr_process_irq(void *priv, void *data)
	}
	rc = hw_mgr->devices[dev_type][0]->hw_ops.process_cmd(
		hw_mgr->devices[dev_type][0]->hw_priv,
		CAM_JPEG_ENC_CMD_SET_IRQ_CB,
		CAM_JPEG_CMD_SET_IRQ_CB,
		&irq_cb, sizeof(irq_cb));
	if (rc) {
		CAM_ERR(CAM_JPEG, "CMD_SET_IRQ_CB failed %d", rc);
		return rc;
	}

	if (hw_mgr->devices[dev_type][0]->hw_ops.deinit) {
		rc = hw_mgr->devices[dev_type][0]->hw_ops.deinit(
			hw_mgr->devices[dev_type][0]->hw_priv, NULL, 0);
		if (rc)
			CAM_ERR(CAM_JPEG, "Failed to Deinit %d HW", dev_type);
	}

	mutex_lock(&g_jpeg_hw_mgr.hw_mgr_mutex);
	hw_mgr->device_in_use[dev_type][0] = false;
	p_cfg_req = hw_mgr->dev_hw_cfg_args[dev_type][0];
@@ -313,6 +318,20 @@ static int cam_jpeg_mgr_process_cmd(void *priv, void *data)
	if (dev_type != p_cfg_req->dev_type)
		CAM_WARN(CAM_JPEG, "dev types not same something wrong");

	if (!hw_mgr->devices[dev_type][0]->hw_ops.init) {
		CAM_ERR(CAM_JPEG, "hw op init null ");
		rc = -EFAULT;
		goto end;
	}
	rc = hw_mgr->devices[dev_type][0]->hw_ops.init(
		hw_mgr->devices[dev_type][0]->hw_priv,
		ctx_data,
		sizeof(ctx_data));
	if (rc) {
		CAM_ERR(CAM_JPEG, "Failed to Init %d HW", dev_type);
		goto end;
	}

	irq_cb.jpeg_hw_mgr_cb = cam_jpeg_hw_mgr_cb;
	irq_cb.data = (void *)ctx_data;
	irq_cb.b_set_cb = true;
@@ -322,7 +341,7 @@ static int cam_jpeg_mgr_process_cmd(void *priv, void *data)
	}
	rc = hw_mgr->devices[dev_type][0]->hw_ops.process_cmd(
		hw_mgr->devices[dev_type][0]->hw_priv,
		CAM_JPEG_ENC_CMD_SET_IRQ_CB,
		CAM_JPEG_CMD_SET_IRQ_CB,
		&irq_cb, sizeof(irq_cb));
	if (rc) {
		CAM_ERR(CAM_JPEG, "SET_IRQ_CB failed %d", rc);
@@ -564,7 +583,7 @@ static int cam_jpeg_mgr_prepare_hw_update(void *hw_mgr_priv,
			packet->header.op_code & 0xff);
		return -EINVAL;
	}
	if ((packet->num_cmd_buf > 2) || !packet->num_patches ||
	if ((packet->num_cmd_buf > 5) || !packet->num_patches ||
		!packet->num_io_configs) {
		CAM_ERR(CAM_JPEG, "wrong number of cmd/patch info: %u %u",
			packet->num_cmd_buf,
@@ -668,12 +687,6 @@ static int cam_jpeg_mgr_release_hw(void *hw_mgr_priv, void *release_hw_args)
		cam_cdm_release(hw_mgr->cdm_info[dev_type][0].cdm_handle);
	}

	if (g_jpeg_hw_mgr.devices[dev_type][0]->hw_ops.deinit) {
		rc = g_jpeg_hw_mgr.devices[dev_type][0]->hw_ops.deinit(
			g_jpeg_hw_mgr.devices[dev_type][0]->hw_priv, NULL, 0);
		if (rc)
			CAM_ERR(CAM_JPEG, "Failed to Init %d HW", dev_type);
	}
	mutex_unlock(&hw_mgr->hw_mgr_mutex);

	rc = cam_jpeg_mgr_release_ctx(hw_mgr, ctx_data);
@@ -792,20 +805,6 @@ static int cam_jpeg_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)
		goto start_cdm_hdl_failed;
	}

	if (!g_jpeg_hw_mgr.devices[dev_type][0]->hw_ops.init) {
		CAM_ERR(CAM_JPEG, "hw op init null ");
		rc = -EINVAL;
		goto init_failed;
	}
	rc = g_jpeg_hw_mgr.devices[dev_type][0]->hw_ops.init(
		g_jpeg_hw_mgr.devices[dev_type][0]->hw_priv,
		ctx_data,
		sizeof(ctx_data));
	if (rc) {
		CAM_ERR(CAM_JPEG, "Failed to Init %d HW", dev_type);
		goto init_failed;
	}

	if (hw_mgr->cdm_info[dev_type][0].ref_cnt == 1)
		if (cam_cdm_stream_on(
			hw_mgr->cdm_info[dev_type][0].cdm_handle)) {
@@ -841,10 +840,6 @@ static int cam_jpeg_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)
	if (hw_mgr->cdm_info[dev_type][0].ref_cnt == 1)
		cam_cdm_stream_off(hw_mgr->cdm_info[dev_type][0].cdm_handle);
start_cdm_hdl_failed:
	if (g_jpeg_hw_mgr.devices[dev_type][0]->hw_ops.deinit)
		g_jpeg_hw_mgr.devices[dev_type][0]->hw_ops.deinit(
			g_jpeg_hw_mgr.devices[dev_type][0]->hw_priv, NULL, 0);
init_failed:
	if (hw_mgr->cdm_info[dev_type][0].ref_cnt == 1)
		cam_cdm_release(hw_mgr->cdm_info[dev_type][0].cdm_handle);
	hw_mgr->cdm_info[dev_type][0].ref_cnt--;
+0 −28
Original line number Diff line number Diff line
/* Copyright (c) 2017, 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
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef CAM_JPEG_DMA_HW_INTF_H
#define CAM_JPEG_DMA_HW_INTF_H

#include <uapi/media/cam_defs.h>
#include <media/cam_jpeg.h>

#include "cam_hw_mgr_intf.h"
#include "cam_jpeg_hw_intf.h"

enum cam_jpeg_dma_cmd_type {
	CAM_JPEG_DMA_CMD_CDM_CFG,
	CAM_JPEG_DMA_CMD_SET_IRQ_CB,
	CAM_JPEG_DMA_CMD_MAX,
};

#endif /* CAM_JPEG_DMA_HW_INTF_H */
+0 −28
Original line number Diff line number Diff line
/* Copyright (c) 2017, 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
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef CAM_JPEG_ENC_HW_INTF_H
#define CAM_JPEG_ENC_HW_INTF_H

#include <uapi/media/cam_defs.h>
#include <media/cam_jpeg.h>

#include "cam_hw_mgr_intf.h"
#include "cam_jpeg_hw_intf.h"

enum cam_jpeg_enc_cmd_type {
	CAM_JPEG_ENC_CMD_CDM_CFG,
	CAM_JPEG_ENC_CMD_SET_IRQ_CB,
	CAM_JPEG_ENC_CMD_MAX,
};

#endif /* CAM_JPEG_ENC_HW_INTF_H */
+18 −0
Original line number Diff line number Diff line
@@ -13,14 +13,32 @@
#ifndef CAM_JPEG_HW_INTF_H
#define CAM_JPEG_HW_INTF_H

#include "cam_cpas_api.h"

#define CAM_JPEG_CTX_MAX              8
#define CAM_JPEG_DEV_PER_TYPE_MAX     1

#define CAM_JPEG_CMD_BUF_MAX_SIZE     128
#define CAM_JPEG_MSG_BUF_MAX_SIZE     CAM_JPEG_CMD_BUF_MAX_SIZE

#define JPEG_VOTE                     640000000

enum cam_jpeg_hw_type {
	CAM_JPEG_DEV_ENC,
	CAM_JPEG_DEV_DMA,
};

struct cam_jpeg_set_irq_cb {
	int32_t (*jpeg_hw_mgr_cb)(uint32_t irq_status,
		int32_t result_size, void *data);
	void *data;
	uint32_t b_set_cb;
};

enum cam_jpeg_cmd_type {
	CAM_JPEG_CMD_CDM_CFG,
	CAM_JPEG_CMD_SET_IRQ_CB,
	CAM_JPEG_CMD_MAX,
};

#endif
+0 −26
Original line number Diff line number Diff line
@@ -17,34 +17,8 @@
#include <uapi/media/cam_defs.h>
#include <linux/of.h>

#include "cam_cpas_api.h"

#define JPEG_TURBO_VOTE           640000000

int cam_jpeg_hw_mgr_init(struct device_node *of_node,
	uint64_t *hw_mgr_hdl);

/**
 * struct cam_jpeg_cpas_vote
 * @ahb_vote: AHB vote info
 * @axi_vote: AXI vote info
 * @ahb_vote_valid: Flag for ahb vote data
 * @axi_vote_valid: Flag for axi vote data
 */
struct cam_jpeg_cpas_vote {
	struct cam_ahb_vote ahb_vote;
	struct cam_axi_vote axi_vote;
	uint32_t ahb_vote_valid;
	uint32_t axi_vote_valid;
};

struct cam_jpeg_set_irq_cb {
	int32_t (*jpeg_hw_mgr_cb)(
		uint32_t irq_status,
		int32_t result_size,
		void *data);
	void *data;
	uint32_t b_set_cb;
};

#endif /* CAM_JPEG_HW_MGR_INTF_H */
Loading