disp: msm: dsi: enable ESD trigger through debugfs in trsuted-vm
Add support to trigger ESD through debugfs by directly modifying the reset GPIOs TLMM register in trusted-vm as GPIO driver support is not enabled. Change-Id: I859affe69c13dbe115a48b0a63a600a57027db58 Signed-off-by: Veera Sundaram Sankaran <veeras@codeaurora.org>
This commit is contained in:
@@ -1529,7 +1529,8 @@ static ssize_t debugfs_esd_trigger_check(struct file *file,
|
|||||||
|
|
||||||
if (display->esd_trigger) {
|
if (display->esd_trigger) {
|
||||||
DSI_INFO("ESD attack triggered by user\n");
|
DSI_INFO("ESD attack triggered by user\n");
|
||||||
rc = dsi_panel_trigger_esd_attack(display->panel);
|
rc = dsi_panel_trigger_esd_attack(display->panel,
|
||||||
|
display->trusted_vm_env);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
DSI_ERR("Failed to trigger ESD attack\n");
|
DSI_ERR("Failed to trigger ESD attack\n");
|
||||||
goto error;
|
goto error;
|
||||||
|
@@ -191,29 +191,52 @@ static int dsi_panel_gpio_release(struct dsi_panel *panel)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dsi_panel_trigger_esd_attack(struct dsi_panel *panel)
|
int dsi_panel_trigger_esd_attack(struct dsi_panel *panel, bool trusted_vm_env)
|
||||||
{
|
{
|
||||||
struct dsi_panel_reset_config *r_config;
|
|
||||||
|
|
||||||
if (!panel) {
|
if (!panel) {
|
||||||
DSI_ERR("Invalid panel param\n");
|
DSI_ERR("Invalid panel param\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
r_config = &panel->reset_config;
|
/* toggle reset-gpio by writing directly to register in trusted-vm */
|
||||||
if (!r_config) {
|
if (trusted_vm_env) {
|
||||||
DSI_ERR("Invalid panel reset configuration\n");
|
struct dsi_tlmm_gpio *gpio = NULL;
|
||||||
return -EINVAL;
|
void __iomem *io;
|
||||||
|
u32 offset = 0x4;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < panel->tlmm_gpio_count; i++)
|
||||||
|
if (!strcmp(panel->tlmm_gpio[i].name, "reset-gpio"))
|
||||||
|
gpio = &panel->tlmm_gpio[i];
|
||||||
|
|
||||||
|
if (!gpio) {
|
||||||
|
DSI_ERR("reset gpio not found\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
io = ioremap(gpio->addr, gpio->size);
|
||||||
|
writel_relaxed(0, io + offset);
|
||||||
|
iounmap(io);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
struct dsi_panel_reset_config *r_config = &panel->reset_config;
|
||||||
|
|
||||||
|
if (!r_config) {
|
||||||
|
DSI_ERR("Invalid panel reset configuration\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gpio_is_valid(r_config->reset_gpio)) {
|
||||||
|
DSI_ERR("failed to pull down gpio\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
gpio_set_value(r_config->reset_gpio, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpio_is_valid(r_config->reset_gpio)) {
|
SDE_EVT32(SDE_EVTLOG_FUNC_CASE1);
|
||||||
gpio_set_value(r_config->reset_gpio, 0);
|
DSI_INFO("GPIO pulled low to simulate ESD\n");
|
||||||
SDE_EVT32(SDE_EVTLOG_FUNC_CASE1);
|
|
||||||
DSI_INFO("GPIO pulled low to simulate ESD\n");
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
DSI_ERR("failed to pull down gpio\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dsi_panel_reset(struct dsi_panel *panel)
|
static int dsi_panel_reset(struct dsi_panel *panel)
|
||||||
|
@@ -298,7 +298,7 @@ struct dsi_panel *dsi_panel_get(struct device *parent,
|
|||||||
int topology_override,
|
int topology_override,
|
||||||
bool trusted_vm_env);
|
bool trusted_vm_env);
|
||||||
|
|
||||||
int dsi_panel_trigger_esd_attack(struct dsi_panel *panel);
|
int dsi_panel_trigger_esd_attack(struct dsi_panel *panel, bool trusted_vm_env);
|
||||||
|
|
||||||
void dsi_panel_put(struct dsi_panel *panel);
|
void dsi_panel_put(struct dsi_panel *panel);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user