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

Commit 2e671e75 authored by Suresh Vankadara's avatar Suresh Vankadara Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: sync: Dump fence info in case of fence exhaust" into dev/msm-4.14-camx

parents cb79ed06 8455b4b5
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -29,6 +29,20 @@ struct sync_device *sync_dev;
 */
static bool trigger_cb_without_switch;

void cam_sync_print_fence_table(void)
{
	int cnt;

	for (cnt = 0; cnt < CAM_SYNC_MAX_OBJS; cnt++) {
		CAM_INFO(CAM_SYNC, "%d, %s, %d, %d, %d",
			sync_dev->sync_table[cnt].sync_id,
			sync_dev->sync_table[cnt].name,
			sync_dev->sync_table[cnt].type,
			sync_dev->sync_table[cnt].state,
			sync_dev->sync_table[cnt].ref_cnt);
	}
}

int cam_sync_create(int32_t *sync_obj, const char *name)
{
	int rc;
@@ -37,8 +51,15 @@ int cam_sync_create(int32_t *sync_obj, const char *name)

	do {
		idx = find_first_zero_bit(sync_dev->bitmap, CAM_SYNC_MAX_OBJS);
		if (idx >= CAM_SYNC_MAX_OBJS)
		if (idx >= CAM_SYNC_MAX_OBJS) {
			CAM_ERR(CAM_SYNC,
				"Error: Unable to Create Sync Idx = %d Reached Max!!",
				idx);
			sync_dev->err_cnt++;
			if (sync_dev->err_cnt == 1)
				cam_sync_print_fence_table();
			return -ENOMEM;
		}
		CAM_DBG(CAM_SYNC, "Index location available at idx: %ld", idx);
		bit = test_and_set_bit(idx, sync_dev->bitmap);
	} while (bit);
@@ -765,6 +786,7 @@ static int cam_sync_open(struct file *filep)
		CAM_ERR(CAM_SYNC, "Sync device NULL");
		return -ENODEV;
	}
	sync_dev->err_cnt = 0;

	mutex_lock(&sync_dev->table_lock);
	if (sync_dev->open_cnt >= 1) {
@@ -797,6 +819,7 @@ static int cam_sync_close(struct file *filep)
		rc = -ENODEV;
		return rc;
	}
	sync_dev->err_cnt = 0;
	mutex_lock(&sync_dev->table_lock);
	sync_dev->open_cnt--;
	if (!sync_dev->open_cnt) {
@@ -972,6 +995,7 @@ static int cam_sync_probe(struct platform_device *pdev)
	if (!sync_dev)
		return -ENOMEM;

	sync_dev->err_cnt = 0;
	mutex_init(&sync_dev->table_lock);
	spin_lock_init(&sync_dev->cam_sync_eventq_lock);

+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, 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
@@ -184,6 +184,7 @@ struct cam_signalable_info {
 * @work_queue      : Work queue used for dispatching kernel callbacks
 * @cam_sync_eventq : Event queue used to dispatch user payloads to user space
 * @bitmap          : Bitmap representation of all sync objects
 * @err_cnt         : Error counter to dump fence table
 */
struct sync_device {
	struct video_device *vdev;
@@ -197,6 +198,7 @@ struct sync_device {
	struct v4l2_fh *cam_sync_eventq;
	spinlock_t cam_sync_eventq_lock;
	DECLARE_BITMAP(bitmap, CAM_SYNC_MAX_OBJS);
	int err_cnt;
};