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

Commit 3f65c2c4 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 a7fd0654 e1823ed1
Loading
Loading
Loading
Loading
+17 −14
Original line number Original line Diff line number Diff line
@@ -73,7 +73,9 @@ static ssize_t core_info_read(struct file *file, char __user *buf,
{
{
	struct msm_vidc_core *core = file->private_data;
	struct msm_vidc_core *core = file->private_data;
	struct hfi_device *hdev;
	struct hfi_device *hdev;
	int i = 0;
	struct hal_fw_info fw_info;
	int i = 0, rc = 0;

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

	write_str(&dbg_buf, "register_size: %u\n",
	write_str(&dbg_buf, "FW version : %s\n", &fw_info.version);
		call_hfi_op(hdev, get_fw_info, hdev->hfi_device_data,
	write_str(&dbg_buf, "base addr: 0x%x\n", fw_info.base_addr);
					FW_REGISTER_SIZE));
	write_str(&dbg_buf, "register_base: 0x%x\n", fw_info.register_base);
	write_str(&dbg_buf, "irq: %u\n",
	write_str(&dbg_buf, "register_size: %u\n", fw_info.register_size);
		call_hfi_op(hdev, get_fw_info, hdev->hfi_device_data,
	write_str(&dbg_buf, "irq: %u\n", fw_info.irq);
					FW_IRQ));

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


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


#define MSM_VIDC_DRV_NAME "msm_vidc_driver"
#define MSM_VIDC_DRV_NAME "msm_vidc_driver"
+35 −32
Original line number Original line Diff line number Diff line
@@ -4266,52 +4266,55 @@ static void __unload_fw(struct venus_hfi_device *device)
	__deinit_resources(device);
	__deinit_resources(device);
}
}


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 i = 0, j = 0;
	struct venus_hfi_device *device = dev;
	struct venus_hfi_device *device = dev;
	u32 smem_block_size = 0;
	u8 *smem_table_ptr;
	char version[VENUS_VERSION_LENGTH];
	const u32 smem_image_index_venus = 14 * 128;


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


	mutex_lock(&device->lock);
	mutex_lock(&device->lock);


	switch (info) {
	smem_table_ptr = smem_get_entry(SMEM_IMAGE_VERSION_TABLE,
	case FW_BASE_ADDRESS:
			&smem_block_size, 0, SMEM_ANY_HOST_FLAG);
		rc = (u32)device->hal_data->firmware_base;
	if (smem_table_ptr &&
		if ((phys_addr_t)rc != device->hal_data->firmware_base) {
			((smem_image_index_venus +
			dprintk(VIDC_INFO,
			  VENUS_VERSION_LENGTH) <= smem_block_size))
				"%s: firmware_base (%pa) truncated to %#x",
		memcpy(version,
				__func__, &device->hal_data->firmware_base, rc);
			smem_table_ptr + smem_image_index_venus,
		}
			VENUS_VERSION_LENGTH);
		break;


	case FW_REGISTER_BASE:
	while (version[i++] != 'V' && i < VENUS_VERSION_LENGTH)
		rc = (u32)device->res->register_base;
		;
		if ((phys_addr_t)rc != device->res->register_base) {
			dprintk(VIDC_INFO,
				"%s: register_base (%pa) truncated to %#x",
				__func__, &device->res->register_base, rc);
		}
		break;


	case FW_REGISTER_SIZE:
	if (i == VENUS_VERSION_LENGTH - 1) {
		rc = device->hal_data->register_size;
		dprintk(VIDC_WARN, "Venus version string is not proper\n");
		break;
		fw_info->version[0] = '\0';
		goto fail_version_string;
	}


	case FW_IRQ:
	for (i--; i < VENUS_VERSION_LENGTH && j < VENUS_VERSION_LENGTH; i++)
		rc = device->hal_data->irq;
		fw_info->version[j++] = version[i];
		break;
	fw_info->version[j] = '\0';


	default:
fail_version_string:
		dprintk(VIDC_ERR, "Invalid fw info requested\n");
	dprintk(VIDC_DBG, "F/W version retrieved : %s\n", fw_info->version);
	}
	fw_info->base_addr = device->hal_data->firmware_base;
	fw_info->register_base = device->res->register_base;
	fw_info->register_size = device->hal_data->register_size;
	fw_info->irq = device->hal_data->irq;


	mutex_unlock(&device->lock);
	mutex_unlock(&device->lock);
	return rc;
	return 0;
}
}


static int venus_hfi_get_core_capabilities(void *dev)
static int venus_hfi_get_core_capabilities(void *dev)
+10 −9
Original line number Original line Diff line number Diff line
@@ -62,6 +62,7 @@
#define HAL_MAX_MATRIX_COEFFS 9
#define HAL_MAX_MATRIX_COEFFS 9
#define HAL_MAX_BIAS_COEFFS 3
#define HAL_MAX_BIAS_COEFFS 3
#define HAL_MAX_LIMIT_COEFFS 6
#define HAL_MAX_LIMIT_COEFFS 6
#define VENUS_VERSION_LENGTH 128


enum vidc_status {
enum vidc_status {
	VIDC_ERR_NONE = 0x0,
	VIDC_ERR_NONE = 0x0,
@@ -1030,6 +1031,14 @@ struct vidc_seq_hdr {
	u32 seq_hdr_len;
	u32 seq_hdr_len;
};
};


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

enum hal_flush {
enum hal_flush {
	HAL_FLUSH_INPUT,
	HAL_FLUSH_INPUT,
	HAL_FLUSH_OUTPUT,
	HAL_FLUSH_OUTPUT,
@@ -1325,14 +1334,6 @@ enum msm_vidc_hfi_type {
	VIDC_HFI_VENUS,
	VIDC_HFI_VENUS,
};
};


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

enum msm_vidc_thermal_level {
enum msm_vidc_thermal_level {
	VIDC_THERMAL_NORMAL = 0,
	VIDC_THERMAL_NORMAL = 0,
	VIDC_THERMAL_LOW,
	VIDC_THERMAL_LOW,
@@ -1447,7 +1448,7 @@ struct hfi_device {
						unsigned long instant_bitrate);
						unsigned long instant_bitrate);
	int (*vote_bus)(void *dev, struct vidc_bus_vote_data *data,
	int (*vote_bus)(void *dev, struct vidc_bus_vote_data *data,
			int num_data);
			int num_data);
	int (*get_fw_info)(void *dev, enum fw_info info);
	int (*get_fw_info)(void *dev, struct hal_fw_info *fw_info);
	int (*session_clean)(void *sess);
	int (*session_clean)(void *sess);
	int (*get_core_capabilities)(void *dev);
	int (*get_core_capabilities)(void *dev);
	int (*suspend)(void *dev);
	int (*suspend)(void *dev);