|
@@ -193,52 +193,63 @@ static int dsi_panel_gpio_release(struct dsi_panel *panel)
|
|
|
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) {
|
|
|
- DSI_ERR("Invalid panel param\n");
|
|
|
+ if (!gpio_is_valid(reset_gpio)) {
|
|
|
+ DSI_INFO("failed to pull down the reset gpio\n");
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
|
- /* toggle reset-gpio by writing directly to register in trusted-vm */
|
|
|
- if (trusted_vm_env) {
|
|
|
- struct dsi_tlmm_gpio *gpio = NULL;
|
|
|
- void __iomem *io;
|
|
|
- u32 offset = 0x4;
|
|
|
- int i;
|
|
|
+ gpio_set_value(reset_gpio, 0);
|
|
|
|
|
|
- for (i = 0; i < panel->tlmm_gpio_count; i++)
|
|
|
- if (!strcmp(panel->tlmm_gpio[i].name, "reset-gpio"))
|
|
|
- gpio = &panel->tlmm_gpio[i];
|
|
|
+ SDE_EVT32(SDE_EVTLOG_FUNC_CASE1);
|
|
|
+ DSI_INFO("GPIO pulled low to simulate ESD\n");
|
|
|
|
|
|
- if (!gpio) {
|
|
|
- DSI_ERR("reset gpio not found\n");
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
|
|
|
- io = ioremap(gpio->addr, gpio->size);
|
|
|
- writel_relaxed(0, io + offset);
|
|
|
- iounmap(io);
|
|
|
+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;
|
|
|
|
|
|
- } else {
|
|
|
- struct dsi_panel_reset_config *r_config = &panel->reset_config;
|
|
|
+ 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;
|
|
|
+ }
|
|
|
|
|
|
- if (!r_config) {
|
|
|
- DSI_ERR("Invalid panel reset configuration\n");
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
+ rc = gpio_request(reset_gpio, "reset_gpio");
|
|
|
+ if (rc) {
|
|
|
+ DSI_ERR("request for reset_gpio failed, rc=%d\n", rc);
|
|
|
+ return rc;
|
|
|
+ }
|
|
|
|
|
|
- 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);
|
|
|
+ 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;
|
|
|
}
|
|
|
|
|
|
- SDE_EVT32(SDE_EVTLOG_FUNC_CASE1);
|
|
|
- DSI_INFO("GPIO pulled low to simulate ESD\n");
|
|
|
+ r_config = &panel->reset_config;
|
|
|
+ if (!r_config) {
|
|
|
+ DSI_ERR("Invalid panel reset configuration\n");
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
|
|
|
- return 0;
|
|
|
+ return dsi_panel_trigger_esd_attack_sub(r_config->reset_gpio);
|
|
|
}
|
|
|
|
|
|
static int dsi_panel_reset(struct dsi_panel *panel)
|
|
@@ -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.parse_gpios = 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 {
|
|
|
panel->panel_ops.pinctrl_init = dsi_panel_pinctrl_init;
|
|
|
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.parse_gpios = dsi_panel_parse_gpios;
|
|
|
panel->panel_ops.parse_power_cfg = dsi_panel_parse_power_cfg;
|
|
|
+ panel->panel_ops.trigger_esd_attack = dsi_panel_trigger_esd_attack;
|
|
|
}
|
|
|
}
|
|
|
|