diff options
author | Lopy Cheng <lopycheng@google.com> | 2021-05-19 10:17:55 +0800 |
---|---|---|
committer | TreeHugger Robot <treehugger-gerrit@google.com> | 2021-07-17 01:48:00 +0000 |
commit | d6e37e4cc66dc996ae91ec7e6fc257a00058fefc (patch) | |
tree | ba2844a7d8dacb08c228637c8ab9fd3f12a46f8f | |
parent | 36fec371a1d1576ba368def5d33931bb6e56abeb (diff) | |
download | display-d6e37e4cc66dc996ae91ec7e6fc257a00058fefc.tar.gz |
panel: reset the panel
Add the debug node to reset the panel. Simulate the
ESD attack to cause the panel dead.
Bug: 143292884
Test: Trigger reset to cause the panel dead
Signed-off-by: Lopy Cheng <lopycheng@google.com>
Change-Id: I1a575f520621c31da1fcd509a3b2ee547306ec47
-rw-r--r-- | samsung/panel/panel-samsung-drv.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/samsung/panel/panel-samsung-drv.c b/samsung/panel/panel-samsung-drv.c index 4f6d050..79b38c5 100644 --- a/samsung/panel/panel-samsung-drv.c +++ b/samsung/panel/panel-samsung-drv.c @@ -1759,6 +1759,56 @@ static const struct file_operations exynos_dsi_payload_fops = { .release = single_release, }; +static int exynos_reset_panel(struct exynos_panel *ctx) +{ + if (!ctx) { + pr_debug("reset_panel: exynos_panel not exist\n"); + return -EPERM; + } + + if (IS_ERR_OR_NULL(ctx->reset_gpio)) { + pr_debug("reset_panel: reset_gpio is invalid\n"); + return -EPERM; + } + + gpiod_set_value(ctx->reset_gpio, 0); + pr_info("reset_panel: pull reset_gpio to low to reset panel\n"); + + return 0; +} + +static ssize_t exynos_debugfs_reset_panel(struct file *file, + const char __user *user_buf, + size_t count, loff_t *ppos) +{ + bool reset_panel; + int ret; + struct mipi_dsi_device *dsi = file->private_data; + struct exynos_panel *ctx = mipi_dsi_get_drvdata(dsi); + + if (!ctx->initialized || !ctx->enabled) + return -EPERM; + + ret = kstrtobool_from_user(user_buf, count, &reset_panel); + if (ret) + return ret; + + if (reset_panel) { + ret = exynos_reset_panel(ctx); + if (ret) { + pr_debug("reset_panel: reset panel failed\n"); + return ret; + } + } + + return count; +} + +static const struct file_operations exynos_reset_panel_fops = { + .open = simple_open, + .write = exynos_debugfs_reset_panel, +}; + static int exynos_dsi_debugfs_add(struct mipi_dsi_device *dsi, struct dentry *parent) { @@ -1784,6 +1834,7 @@ static int exynos_dsi_debugfs_add(struct mipi_dsi_device *dsi, &exynos_dsi_payload_fops); debugfs_create_file("name", 0600, parent, dsi, &exynos_dsi_name_fops); + debugfs_create_file("reset_panel",0200, parent, dsi, &exynos_reset_panel_fops); return 0; } |