drivers/firmware: Import OnePlus Changes

Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
This commit is contained in:
Cyber Knight 2021-09-26 01:02:42 +08:00
parent 5d6fbaeb39
commit 462b249a28
No known key found for this signature in database
GPG Key ID: 23BD4CCD326E9D64
1 changed files with 22 additions and 11 deletions

View File

@ -10,7 +10,7 @@
* GNU General Public License for more details.
*
*/
#include <linux/debugfs.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/io.h>
@ -26,6 +26,7 @@
#include <linux/dma-buf.h>
#include <linux/ion_kernel.h>
#include <linux/pm.h>
#include <linux/proc_fs.h>
#include <soc/qcom/scm.h>
#include <soc/qcom/qseecomi.h>
@ -808,7 +809,10 @@ static ssize_t tzdbgfs_read(struct file *file, char __user *buf,
size_t count, loff_t *offp)
{
int len = 0;
int *tz_id = file->private_data;
int *tz_id = PDE_DATA(file_inode(file));
pr_info("%s: private_data file name %s\n", __func__, file->f_path.dentry->d_name.name);
pr_info("%s: data address: %p, data: %d\n", __func__, tz_id, *tz_id);
if (*tz_id == TZDBG_BOOT || *tz_id == TZDBG_RESET ||
*tz_id == TZDBG_INTERRUPT || *tz_id == TZDBG_GENERAL ||
@ -939,14 +943,16 @@ err:
return;
}
static int tzdbgfs_init(struct platform_device *pdev)
{
int rc = 0;
int i;
struct dentry *dent_dir;
struct dentry *dent;
struct proc_dir_entry *dent_dir = NULL;
struct proc_dir_entry *dent = NULL;
dent_dir = debugfs_create_dir("tzdbg", NULL);
dent_dir = proc_mkdir("tzdbg", NULL);
if (dent_dir == NULL) {
dev_err(&pdev->dev, "tzdbg debugfs_create_dir failed\n");
return -ENOMEM;
@ -954,9 +960,9 @@ static int tzdbgfs_init(struct platform_device *pdev)
for (i = 0; i < TZDBG_STATS_MAX; i++) {
tzdbg.debug_tz[i] = i;
dent = debugfs_create_file_unsafe(tzdbg.stat[i].name,
0444, dent_dir,
&tzdbg.debug_tz[i], &tzdbg_fops);
dent = proc_create_data(tzdbg.stat[i].name,
0444, dent_dir
, &tzdbg_fops, &tzdbg.debug_tz[i]);
if (dent == NULL) {
dev_err(&pdev->dev, "TZ debugfs_create_file failed\n");
rc = -ENOMEM;
@ -970,18 +976,18 @@ static int tzdbgfs_init(struct platform_device *pdev)
platform_set_drvdata(pdev, dent_dir);
return 0;
err:
debugfs_remove_recursive(dent_dir);
proc_remove(dent_dir);
return rc;
}
static void tzdbgfs_exit(struct platform_device *pdev)
{
struct dentry *dent_dir;
struct proc_dir_entry *dent_dir;
kzfree(tzdbg.disp_buf);
dent_dir = platform_get_drvdata(pdev);
debugfs_remove_recursive(dent_dir);
proc_remove(dent_dir);
if (g_qsee_log)
dma_free_coherent(&pdev->dev, QSEE_LOG_BUF_SIZE,
(void *)g_qsee_log, coh_pmem);
@ -1138,9 +1144,14 @@ static int tz_log_probe(struct platform_device *pdev)
tzdbg.diag_buf = (struct tzdbg_t *)ptr;
pr_info("%s: Start init tz procfs\n", __func__);
if (tzdbgfs_init(pdev))
goto err;
pr_info("%s: End init tz procfs\n", __func__);
tzdbg_register_qsee_log_buf(pdev);
tzdbg_get_tz_version();