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

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

Merge "msm: camera: common: Merge camera-kernel.3.1 changes in...

Merge "msm: camera: common: Merge camera-kernel.3.1 changes in camera-kernel.4.0" into camera-kernel.lnx.4.0
parents c4d16b52 172d34b6
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@
/* BL_FIFO configurations*/
#define CAM_CDM_BL_FIFO_LENGTH_MAX_DEFAULT 0x40
#define CAM_CDM_BL_FIFO_LENGTH_CFG_SHIFT 0x10
#define CAM_CDM_BL_FIFO_FLUSH_SHIFT 0x3

#define CAM_CDM_BL_FIFO_REQ_SIZE_MAX 0x00
#define CAM_CDM_BL_FIFO_REQ_SIZE_MAX_DIV2 0x01
@@ -100,6 +101,7 @@
#define CAM_CDM_IRQ_STATUS_ERROR_INV_CMD_MASK 0x10000
#define CAM_CDM_IRQ_STATUS_ERROR_OVER_FLOW_MASK 0x20000
#define CAM_CDM_IRQ_STATUS_ERROR_AHB_BUS_MASK 0x40000
#define CAM_CDM_IRQ_STATUS_USR_DATA_MASK 0xFF

#define CAM_CDM_IRQ_STATUS_ERRORS \
	(CAM_CDM_IRQ_STATUS_ERROR_INV_CMD_MASK | \
@@ -371,6 +373,7 @@ enum cam_cdm_hw_process_intf_cmd {
	CAM_CDM_HW_INTF_CMD_RESET_HW,
	CAM_CDM_HW_INTF_CMD_FLUSH_HW,
	CAM_CDM_HW_INTF_CMD_HANDLE_ERROR,
	CAM_CDM_HW_INTF_CMD_HANG_DETECT,
	CAM_CDM_HW_INTF_CMD_INVALID,
};

@@ -466,6 +469,8 @@ struct cam_cdm_bl_fifo {
	struct mutex fifo_lock;
	uint8_t bl_tag;
	uint32_t bl_depth;
	uint8_t last_bl_tag_done;
	uint32_t work_record;
};

/**
@@ -493,6 +498,7 @@ struct cam_cdm_bl_fifo {
 * @gen_irq:             memory region in which gen_irq command will be written
 * @cpas_handle:         handle for cpas driver
 * @arbitration:         type of arbitration to be used for the CDM
 * @rst_done_cnt:        CMD reset done count
 */
struct cam_cdm {
	uint32_t index;
@@ -515,6 +521,7 @@ struct cam_cdm {
	struct cam_cdm_hw_mem gen_irq[CAM_CDM_BL_FIFO_MAX];
	uint32_t cpas_handle;
	enum cam_cdm_arbitration arbitration;
	uint32_t rst_done_cnt;
};

/* struct cam_cdm_private_dt_data - CDM hw custom dt data */
+80 −23
Original line number Diff line number Diff line
@@ -262,6 +262,47 @@ void cam_cdm_notify_clients(struct cam_hw_info *cdm_hw,
	}
}

static int cam_cdm_stream_handle_init(void *hw_priv, bool init)
{
	struct cam_hw_info *cdm_hw = hw_priv;
	struct cam_cdm *core = NULL;
	int rc = -EPERM;

	core = (struct cam_cdm *)cdm_hw->core_info;

	if (init) {
		rc = cam_hw_cdm_init(hw_priv, NULL, 0);
		if (rc) {
			CAM_ERR(CAM_CDM, "CDM HW init failed");
			return rc;
		}

		if (core->arbitration !=
			CAM_CDM_ARBITRATION_PRIORITY_BASED) {
			rc = cam_hw_cdm_alloc_genirq_mem(
				hw_priv);
			if (rc) {
				CAM_ERR(CAM_CDM,
					"Genirqalloc failed");
				cam_hw_cdm_deinit(hw_priv,
					NULL, 0);
			}
		}
	} else {
		rc = cam_hw_cdm_deinit(hw_priv, NULL, 0);
		if (rc)
			CAM_ERR(CAM_CDM, "Deinit failed in streamoff");

		if (core->arbitration !=
			CAM_CDM_ARBITRATION_PRIORITY_BASED) {
			if (cam_hw_cdm_release_genirq_mem(hw_priv))
				CAM_ERR(CAM_CDM, "Genirq release fail");
		}
	}

	return rc;
}

int cam_cdm_stream_ops_internal(void *hw_priv,
	void *start_args, bool operation)
{
@@ -337,19 +378,7 @@ int cam_cdm_stream_ops_internal(void *hw_priv,
				rc = 0;
			} else {
				CAM_DBG(CAM_CDM, "CDM HW init first time");
				rc = cam_hw_cdm_init(hw_priv, NULL, 0);
				if (rc == 0) {
					rc = cam_hw_cdm_alloc_genirq_mem(
						hw_priv);
					if (rc != 0) {
						CAM_ERR(CAM_CDM,
							"Genirqalloc failed");
						cam_hw_cdm_deinit(hw_priv,
							NULL, 0);
					}
				} else {
					CAM_ERR(CAM_CDM, "CDM HW init failed");
				}
				rc = cam_cdm_stream_handle_init(hw_priv, true);
			}
			if (rc == 0) {
				cdm_hw->open_count++;
@@ -378,17 +407,10 @@ int cam_cdm_stream_ops_internal(void *hw_priv,
					rc = 0;
				} else {
					CAM_DBG(CAM_CDM, "CDM HW Deinit now");
					rc = cam_hw_cdm_deinit(
						hw_priv, NULL, 0);
					if (cam_hw_cdm_release_genirq_mem(
						hw_priv))
						CAM_ERR(CAM_CDM,
							"Genirq release fail");
					rc = cam_cdm_stream_handle_init(hw_priv,
						false);
				}
				if (rc) {
					CAM_ERR(CAM_CDM,
						"Deinit failed in streamoff");
				} else {
				if (rc == 0) {
					client->stream_on = false;
					rc = cam_cpas_stop(core->cpas_handle);
					if (rc)
@@ -763,6 +785,41 @@ int cam_cdm_process_cmd(void *hw_priv,
		mutex_unlock(&cdm_hw->hw_mutex);
		break;
	}
	case CAM_CDM_HW_INTF_CMD_HANG_DETECT: {
		uint32_t *handle = cmd_args;
		int idx;
		struct cam_cdm_client *client;

		if (sizeof(uint32_t) != arg_size) {
			CAM_ERR(CAM_CDM,
				"Invalid CDM cmd %d size=%x for handle=%x",
				cmd, arg_size, *handle);
				return -EINVAL;
		}

		idx = CAM_CDM_GET_CLIENT_IDX(*handle);
		mutex_lock(&cdm_hw->hw_mutex);
		client = core->clients[idx];
		if (!client) {
			CAM_ERR(CAM_CDM,
				"Client not present for handle %d",
				*handle);
			mutex_unlock(&cdm_hw->hw_mutex);
			break;
		}

		if (*handle != client->handle) {
			CAM_ERR(CAM_CDM,
				"handle mismatch, client handle %d index %d received handle %d",
				client->handle, idx, *handle);
			mutex_unlock(&cdm_hw->hw_mutex);
			break;
		}

		rc = cam_hw_cdm_hang_detect(cdm_hw, *handle);
		mutex_unlock(&cdm_hw->hw_mutex);
		break;
	}
	default:
		CAM_ERR(CAM_CDM, "CDM HW intf command not valid =%d", cmd);
		break;
+1 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ int cam_hw_cdm_submit_bl(struct cam_hw_info *cdm_hw,
int cam_hw_cdm_reset_hw(struct cam_hw_info *cdm_hw, uint32_t handle);
int cam_hw_cdm_flush_hw(struct cam_hw_info *cdm_hw, uint32_t handle);
int cam_hw_cdm_handle_error(struct cam_hw_info *cdm_hw, uint32_t handle);
int cam_hw_cdm_hang_detect(struct cam_hw_info *cdm_hw, uint32_t handle);
struct cam_cdm_bl_cb_request_entry *cam_cdm_find_request_by_bl_tag(
	uint32_t tag, struct list_head *bl_list);
void cam_cdm_notify_clients(struct cam_hw_info *cdm_hw,
Loading