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

Commit ee9d1af1 authored by Ashray Kulkarni's avatar Ashray Kulkarni
Browse files

msm: vidc : report PC_PREP failure as SYS_ERROR



When prepare for power collapse command fails, firmware is in
unusable state. This will make the driver unusable. This commit
reports this failure as SYS_ERROR resulting in unloading the
driver and firmware so next session can be opened successfully.

Change-Id: I849c2f8e98621bdff6ca4dddfd859a916e16dcb3
Signed-off-by: default avatarAshray Kulkarni <ashrayk@codeaurora.org>
parent 08a5dba0
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -1867,8 +1867,6 @@ void handle_cmd_response(enum hal_command_response cmd, void *data)
		handle_seq_hdr_done(cmd, data);
		break;
	case HAL_SYS_WATCHDOG_TIMEOUT:
		handle_sys_error(cmd, data);
		break;
	case HAL_SYS_ERROR:
		handle_sys_error(cmd, data);
		break;
+18 −5
Original line number Diff line number Diff line
@@ -3256,6 +3256,15 @@ static int __check_core_registered(struct hal_device_data core,
	return -EINVAL;
}

static void __process_fatal_error(
		struct venus_hfi_device *device)
{
	struct msm_vidc_cb_cmd_done cmd_done = {0};

	cmd_done.device_id = device->device_id;
	device->callback(HAL_SYS_ERROR, &cmd_done);
}

static int __prepare_pc(struct venus_hfi_device *device)
{
	int rc = 0;
@@ -3334,10 +3343,12 @@ static void venus_hfi_pm_handler(struct work_struct *work)
	rc = __prepare_pc(device);
	if (rc) {
		dprintk(VIDC_ERR, "Failed to prepare for PC %d\n", rc);
		goto err_prepare_pc;
		__alloc_set_imem(device);
		mutex_unlock(&device->lock);
		__process_fatal_error(device);
		return;
	}


	if (device->last_packet_type != HFI_CMD_SYS_PC_PREP) {
		dprintk(VIDC_DBG,
			"Last command (%#x) is not PC_PREP cmd\n",
@@ -3385,8 +3396,7 @@ skip_power_off:
	dprintk(VIDC_WARN, "Power off skipped (last pkt %#x, status: %#x)\n",
		device->last_packet_type, ctrl_status);

err_prepare_pc:
	__alloc_imem(device, device->res->imem_size);
	__alloc_set_imem(device);
err_unset_imem:
	mutex_unlock(&device->lock);
	return;
@@ -3508,6 +3518,7 @@ static struct msm_vidc_cb_info *__response_handler(

		dprintk(VIDC_ERR, "Received watchdog timeout\n");
		packets[packet_count++] = info;
		goto exit;
	}

	/* Bleed the msg queue dry of packets */
@@ -3615,6 +3626,7 @@ static struct msm_vidc_cb_info *__response_handler(
		}
	}

exit:
	__flush_debug_queue(device, raw_packet);

	kfree(raw_packet);
@@ -4349,6 +4361,7 @@ static void __unload_fw(struct venus_hfi_device *device)

	flush_workqueue(device->vidc_workq);
	cancel_delayed_work(&venus_hfi_pm_work);
	if (device->state != VENUS_STATE_DEINIT)
		flush_workqueue(device->venus_pm_workq);
	subsystem_put(device->resources.fw.cookie);
	__interface_queues_release(device);