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

Commit c3780619 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Add support to read venus version through debugfs"

parents 8bcee50a 307102b3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1334,6 +1334,7 @@ static void hfi_process_sys_get_prop_image_version(
}

static void hfi_process_sys_property_info(
		msm_vidc_callback callback, u32 device_id,
		struct hfi_msg_sys_property_info_packet *pkt)
{
	if (!pkt) {
+18 −15
Original line number Diff line number Diff line
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2015, 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
@@ -70,7 +70,9 @@ static ssize_t core_info_read(struct file *file, char __user *buf,
{
	struct msm_vidc_core *core = file->private_data;
	struct hfi_device *hdev;
	int i = 0;
	struct hal_fw_info fw_info;
	int i = 0, rc = 0;

	if (!core || !core->device) {
		dprintk(VIDC_ERR, "Invalid params, core: %p\n", core);
		return 0;
@@ -80,19 +82,20 @@ static ssize_t core_info_read(struct file *file, char __user *buf,
	write_str(&dbg_buf, "===============================\n");
	write_str(&dbg_buf, "CORE %d: 0x%p\n", core->id, core);
	write_str(&dbg_buf, "===============================\n");
	write_str(&dbg_buf, "state: %d\n", core->state);
	write_str(&dbg_buf, "base addr: 0x%x\n",
		call_hfi_op(hdev, get_fw_info, hdev->hfi_device_data,
					FW_BASE_ADDRESS));
	write_str(&dbg_buf, "register_base: 0x%x\n",
		call_hfi_op(hdev, get_fw_info, hdev->hfi_device_data,
					FW_REGISTER_BASE));
	write_str(&dbg_buf, "register_size: %u\n",
		call_hfi_op(hdev, get_fw_info, hdev->hfi_device_data,
					FW_REGISTER_SIZE));
	write_str(&dbg_buf, "irq: %u\n",
		call_hfi_op(hdev, get_fw_info, hdev->hfi_device_data,
					FW_IRQ));
	write_str(&dbg_buf, "Core state: %d\n", core->state);
	rc = call_hfi_op(hdev, get_fw_info, hdev->hfi_device_data, &fw_info);
	if (rc) {
		dprintk(VIDC_WARN, "Failed to read FW info\n");
		goto err_fw_info;
	}

	write_str(&dbg_buf, "FW version : %s\n", &fw_info.version);
	write_str(&dbg_buf, "base addr: 0x%x\n", fw_info.base_addr);
	write_str(&dbg_buf, "register_base: 0x%x\n", fw_info.register_base);
	write_str(&dbg_buf, "register_size: %u\n", fw_info.register_size);
	write_str(&dbg_buf, "irq: %u\n", fw_info.irq);

err_fw_info:
	for (i = SYS_MSG_START; i < SYS_MSG_END; i++) {
		write_str(&dbg_buf, "completions[%d]: %s\n", i,
			completion_done(&core->completions[SYS_MSG_INDEX(i)]) ?
+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@
#include <media/msm_vidc.h>
#include <media/msm_media_info.h>

#include "vidc_hfi_api.h"
#include "vidc_hfi_api.h"

#define MSM_VIDC_DRV_NAME "msm_vidc_driver"
+43 −30
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@

#define FIRMWARE_SIZE			0X00A00000
#define REG_ADDR_OFFSET_BITMASK	0x000FFFFF
#define VENUS_VERSION_LENGTH 128

#define SHARED_QSIZE 0x1000000

@@ -4165,47 +4166,59 @@ static void venus_hfi_unload_fw(void *dev)
	}
}

static int venus_hfi_get_fw_info(void *dev, enum fw_info info)
static int venus_hfi_get_fw_info(void *dev, struct hal_fw_info *fw_info)
{
	int rc = 0;
	int rc = 0, i = 0, j = 0;
	struct venus_hfi_device *device = dev;
	u32 smem_block_size = 0;
	u8 *smem_table_ptr;
	char version[VENUS_VERSION_LENGTH];
	const u32 version_string_size = VENUS_VERSION_LENGTH;
	const u32 smem_image_index_venus = 14 * 128;

	if (!device) {
		dprintk(VIDC_ERR, "%s Invalid paramter: %p\n",
			__func__, device);
	if (!device || !fw_info) {
		dprintk(VIDC_ERR,
			"%s Invalid paramter: device = %p fw_info = %p\n",
				__func__, device, fw_info);
		return -EINVAL;
	}

	switch (info) {
	case FW_BASE_ADDRESS:
		rc = (u32)device->hal_data->firmware_base;
		if ((phys_addr_t)rc != device->hal_data->firmware_base) {
	smem_table_ptr = smem_get_entry(SMEM_IMAGE_VERSION_TABLE,
			&smem_block_size, 0, SMEM_ANY_HOST_FLAG);
	if (smem_table_ptr &&
			((smem_image_index_venus +
			  version_string_size) <= smem_block_size))
		memcpy(version,
			smem_table_ptr + smem_image_index_venus,
			version_string_size);

	while (version[i++] != 'V' && i < version_string_size)
		;

	for (i--; i < version_string_size && j < version_string_size; i++)
		fw_info->version[j++] = version[i];
	fw_info->version[version_string_size - 1] = '\0';
	dprintk(VIDC_DBG, "F/W version retrieved : %s\n", fw_info->version);

	fw_info->base_addr = (u32)device->hal_data->firmware_base;
	if ((phys_addr_t)fw_info->base_addr !=
		device->hal_data->firmware_base) {
		dprintk(VIDC_INFO,
				"%s: firmware_base (0x%pa) truncated to 0x%x",
				__func__, &device->hal_data->firmware_base, rc);
				__func__, &device->hal_data->firmware_base,
				fw_info->base_addr);
	}
		break;

	case FW_REGISTER_BASE:
		rc = (u32)device->res->register_base;
		if ((phys_addr_t)rc != device->res->register_base) {
	fw_info->register_base = (u32)device->res->register_base;
	if ((phys_addr_t)fw_info->register_base != device->res->register_base) {
		dprintk(VIDC_INFO,
				"%s: register_base (0x%pa) truncated to 0x%x",
				__func__, &device->res->register_base, rc);
				__func__, &device->res->register_base,
				fw_info->register_base);
	}
		break;

	case FW_REGISTER_SIZE:
		rc = device->hal_data->register_size;
		break;

	case FW_IRQ:
		rc = device->hal_data->irq;
		break;

	default:
		dprintk(VIDC_ERR, "Invalid fw info requested\n");
	}
	fw_info->register_size = device->hal_data->register_size;
	fw_info->irq = device->hal_data->irq;
	return rc;
}

+9 −9
Original line number Diff line number Diff line
@@ -985,6 +985,14 @@ struct vidc_seq_hdr {
	u32 seq_hdr_len;
};

struct hal_fw_info {
	char version[128];
	int base_addr;
	int register_base;
	int register_size;
	int irq;
};

enum hal_flush {
	HAL_FLUSH_INPUT,
	HAL_FLUSH_OUTPUT,
@@ -1259,14 +1267,6 @@ enum msm_vidc_hfi_type {
	VIDC_HFI_Q6,
};

enum fw_info {
	FW_BASE_ADDRESS,
	FW_REGISTER_BASE,
	FW_REGISTER_SIZE,
	FW_IRQ,
	FW_INFO_MAX,
};

enum msm_vidc_thermal_level {
	VIDC_THERMAL_NORMAL = 0,
	VIDC_THERMAL_LOW,
@@ -1348,7 +1348,7 @@ struct hfi_device {
			int *domain_num, int *partition_num);
	int (*load_fw)(void *dev);
	void (*unload_fw)(void *dev);
	int (*get_fw_info)(void *dev, enum fw_info info);
	int (*get_fw_info)(void *dev, struct hal_fw_info *fw_info);
	int (*get_stride_scanline)(int color_fmt, int width,
		int height,	int *stride, int *scanlines);
	int (*session_clean)(void *sess);