disp: msm: dsi: implement ESD trigger for trusted vm
DSI driver stubs out GPIO parsing in trusted vm. Add support for ESD trigger in trusted vm by explicitly parsing the reset gpio and setting the value. Change-Id: I8c04e4b27b234eb236ec51df633c06738f2a5c96 Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
This commit is contained in:
@@ -1660,9 +1660,10 @@ static ssize_t debugfs_esd_trigger_check(struct file *file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (display->esd_trigger) {
|
if (display->esd_trigger) {
|
||||||
|
struct dsi_panel *panel = display->panel;
|
||||||
|
|
||||||
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 = panel->panel_ops.trigger_esd_attack(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;
|
||||||
|
@@ -193,47 +193,14 @@ static int dsi_panel_gpio_release(struct dsi_panel *panel)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dsi_panel_trigger_esd_attack(struct dsi_panel *panel, bool trusted_vm_env)
|
static int dsi_panel_trigger_esd_attack_sub(int reset_gpio)
|
||||||
{
|
{
|
||||||
if (!panel) {
|
if (!gpio_is_valid(reset_gpio)) {
|
||||||
DSI_ERR("Invalid panel param\n");
|
DSI_INFO("failed to pull down the reset gpio\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* toggle reset-gpio by writing directly to register in trusted-vm */
|
gpio_set_value(reset_gpio, 0);
|
||||||
if (trusted_vm_env) {
|
|
||||||
struct dsi_tlmm_gpio *gpio = NULL;
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDE_EVT32(SDE_EVTLOG_FUNC_CASE1);
|
SDE_EVT32(SDE_EVTLOG_FUNC_CASE1);
|
||||||
DSI_INFO("GPIO pulled low to simulate ESD\n");
|
DSI_INFO("GPIO pulled low to simulate ESD\n");
|
||||||
@@ -241,6 +208,50 @@ int dsi_panel_trigger_esd_attack(struct dsi_panel *panel, bool trusted_vm_env)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int dsi_panel_vm_trigger_esd_attack(struct dsi_panel *panel)
|
||||||
|
{
|
||||||
|
struct dsi_parser_utils *utils = &panel->utils;
|
||||||
|
int reset_gpio;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
reset_gpio = utils->get_named_gpio(utils->data,
|
||||||
|
"qcom,platform-reset-gpio", 0);
|
||||||
|
if (!gpio_is_valid(reset_gpio)) {
|
||||||
|
DSI_ERR("[%s] reset gpio not provided\n", panel->name);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = gpio_request(reset_gpio, "reset_gpio");
|
||||||
|
if (rc) {
|
||||||
|
DSI_ERR("request for reset_gpio failed, rc=%d\n", rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = dsi_panel_trigger_esd_attack_sub(reset_gpio);
|
||||||
|
|
||||||
|
gpio_free(reset_gpio);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dsi_panel_trigger_esd_attack(struct dsi_panel *panel)
|
||||||
|
{
|
||||||
|
struct dsi_panel_reset_config *r_config;
|
||||||
|
|
||||||
|
if (!panel) {
|
||||||
|
DSI_ERR("Invalid panel param\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
r_config = &panel->reset_config;
|
||||||
|
if (!r_config) {
|
||||||
|
DSI_ERR("Invalid panel reset configuration\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dsi_panel_trigger_esd_attack_sub(r_config->reset_gpio);
|
||||||
|
}
|
||||||
|
|
||||||
static int dsi_panel_reset(struct dsi_panel *panel)
|
static int dsi_panel_reset(struct dsi_panel *panel)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@@ -3485,6 +3496,7 @@ static void dsi_panel_setup_vm_ops(struct dsi_panel *panel, bool trusted_vm_env)
|
|||||||
panel->panel_ops.bl_unregister = dsi_panel_vm_stub;
|
panel->panel_ops.bl_unregister = dsi_panel_vm_stub;
|
||||||
panel->panel_ops.parse_gpios = dsi_panel_vm_stub;
|
panel->panel_ops.parse_gpios = dsi_panel_vm_stub;
|
||||||
panel->panel_ops.parse_power_cfg = dsi_panel_vm_stub;
|
panel->panel_ops.parse_power_cfg = dsi_panel_vm_stub;
|
||||||
|
panel->panel_ops.trigger_esd_attack = dsi_panel_vm_trigger_esd_attack;
|
||||||
} else {
|
} else {
|
||||||
panel->panel_ops.pinctrl_init = dsi_panel_pinctrl_init;
|
panel->panel_ops.pinctrl_init = dsi_panel_pinctrl_init;
|
||||||
panel->panel_ops.gpio_request = dsi_panel_gpio_request;
|
panel->panel_ops.gpio_request = dsi_panel_gpio_request;
|
||||||
@@ -3494,6 +3506,7 @@ static void dsi_panel_setup_vm_ops(struct dsi_panel *panel, bool trusted_vm_env)
|
|||||||
panel->panel_ops.bl_unregister = dsi_panel_bl_unregister;
|
panel->panel_ops.bl_unregister = dsi_panel_bl_unregister;
|
||||||
panel->panel_ops.parse_gpios = dsi_panel_parse_gpios;
|
panel->panel_ops.parse_gpios = dsi_panel_parse_gpios;
|
||||||
panel->panel_ops.parse_power_cfg = dsi_panel_parse_power_cfg;
|
panel->panel_ops.parse_power_cfg = dsi_panel_parse_power_cfg;
|
||||||
|
panel->panel_ops.trigger_esd_attack = dsi_panel_trigger_esd_attack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -209,6 +209,7 @@ struct dsi_panel_ops {
|
|||||||
int (*bl_unregister)(struct dsi_panel *panel);
|
int (*bl_unregister)(struct dsi_panel *panel);
|
||||||
int (*parse_gpios)(struct dsi_panel *panel);
|
int (*parse_gpios)(struct dsi_panel *panel);
|
||||||
int (*parse_power_cfg)(struct dsi_panel *panel);
|
int (*parse_power_cfg)(struct dsi_panel *panel);
|
||||||
|
int (*trigger_esd_attack)(struct dsi_panel *panel);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dsi_panel {
|
struct dsi_panel {
|
||||||
@@ -310,8 +311,6 @@ 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, bool trusted_vm_env);
|
|
||||||
|
|
||||||
void dsi_panel_put(struct dsi_panel *panel);
|
void dsi_panel_put(struct dsi_panel *panel);
|
||||||
|
|
||||||
int dsi_panel_drv_init(struct dsi_panel *panel, struct mipi_dsi_host *host);
|
int dsi_panel_drv_init(struct dsi_panel *panel, struct mipi_dsi_host *host);
|
||||||
|
Viittaa uudesa ongelmassa
Block a user