From 2ea8b58dd3e1a82c4e70c26eb9a9c709b2b4790f Mon Sep 17 00:00:00 2001 From: Shridhar Rasal Date: Wed, 24 Jan 2018 15:24:18 +0530 Subject: [PATCH] drivers: video: tegra: host: decode fw version tag - Decode firmware version tag from ucode binary. - Add debugfs to dump firmware version tag Jira DLA-318 Change-Id: I0208d8c8da2d91454f3ba0f4efa618cb44e22787 Signed-off-by: Shridhar Rasal Signed-off-by: Prashant Gaikwad Reviewed-on: https://git-master.nvidia.com/r/1645226 GVS: Gerrit_Virtual_Submit Reviewed-by: Mitch Harwell Tested-by: Mitch Harwell Reviewed-by: Ken Adams Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/video/tegra/host/nvdla/nvdla_debug.c | 41 ++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/video/tegra/host/nvdla/nvdla_debug.c b/drivers/video/tegra/host/nvdla/nvdla_debug.c index bc1fcb12..ddc31a97 100644 --- a/drivers/video/tegra/host/nvdla/nvdla_debug.c +++ b/drivers/video/tegra/host/nvdla/nvdla_debug.c @@ -524,6 +524,43 @@ static ssize_t debug_dla_fw_reload_set(struct file *file, return count; } +static int nvdla_fw_ver_tag_show(struct seq_file *s, void *unused) +{ + struct nvdla_device *nvdla_dev; + struct platform_device *pdev; + int err; + unsigned int tag; + struct flcn *m; + + nvdla_dev = (struct nvdla_device *)s->private; + pdev = nvdla_dev->pdev; + + /* update fw_version if engine is not yet powered on */ + err = nvhost_module_busy(pdev); + if (err) + return err; + + m = get_flcn(pdev); + tag = m->os.bin_ver_tag; + + nvhost_module_idle(pdev); + + seq_printf(s, "%x\n", tag); + + return 0; +} + +static int nvdla_fw_ver_tag_open(struct inode *inode, struct file *file) +{ + return single_open(file, nvdla_fw_ver_tag_show, inode->i_private); +} + +static const struct file_operations nvdla_fw_ver_tag_fops = { + .open = nvdla_fw_ver_tag_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; static int debug_dla_fw_reload_show(struct seq_file *s, void *data) { seq_puts(s, "0\n"); @@ -613,6 +650,10 @@ static void dla_fw_debugfs_init(struct platform_device *pdev) nvdla_dev, &nvdla_fw_ver_fops)) goto trace_failed; + if (!debugfs_create_file("tag", S_IRUGO, fw_dir, + nvdla_dev, &nvdla_fw_ver_tag_fops)) + goto trace_failed; + if (!debugfs_create_file("reload", 0600, fw_dir, nvdla_dev, &nvdla_fw_reload_fops)) goto trace_failed;