Commit 54f227fdf3c422790b09caf627abaa477f6e5973

Authored by Robert Chiras
1 parent 5d6cbeafb8

MLK-21312: drm/panel: rm67191: Add support for suspend/resume

The 'reset' pin used by this panel driver is shared with the touchscreen
driver, which is causing issues during suspend/resume process. In order
to better handle this gpio pin, release its resource during suspend and
acquire it again in resume.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>

Showing 1 changed file with 37 additions and 0 deletions Side-by-side Diff

drivers/gpu/drm/panel/panel-raydium-rm67191.c
... ... @@ -635,6 +635,7 @@
635 635 drm_panel_init(&panel->base);
636 636 panel->base.funcs = &rad_panel_funcs;
637 637 panel->base.dev = dev;
  638 + dev_set_drvdata(dev, panel);
638 639  
639 640 ret = drm_panel_add(&panel->base);
640 641  
... ... @@ -672,6 +673,41 @@
672 673 rad_panel_unprepare(&rad->base);
673 674 }
674 675  
  676 +#ifdef CONFIG_PM
  677 +static int rad_panel_suspend(struct device *dev)
  678 +{
  679 + struct rad_panel *rad = dev_get_drvdata(dev);
  680 +
  681 + if (!rad->reset)
  682 + return 0;
  683 +
  684 + devm_gpiod_put(dev, rad->reset);
  685 + rad->reset = NULL;
  686 +
  687 + return 0;
  688 +}
  689 +
  690 +static int rad_panel_resume(struct device *dev)
  691 +{
  692 + struct rad_panel *rad = dev_get_drvdata(dev);
  693 +
  694 + if (rad->reset)
  695 + return 0;
  696 +
  697 + rad->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
  698 + if (IS_ERR(rad->reset))
  699 + rad->reset = NULL;
  700 +
  701 + return PTR_ERR_OR_ZERO(rad->reset);
  702 +}
  703 +
  704 +#endif
  705 +
  706 +static const struct dev_pm_ops rad_pm_ops = {
  707 + SET_RUNTIME_PM_OPS(rad_panel_suspend, rad_panel_resume, NULL)
  708 + SET_SYSTEM_SLEEP_PM_OPS(rad_panel_suspend, rad_panel_resume)
  709 +};
  710 +
675 711 static const struct of_device_id rad_of_match[] = {
676 712 { .compatible = "raydium,rm67191", },
677 713 { }
... ... @@ -682,6 +718,7 @@
682 718 .driver = {
683 719 .name = "panel-raydium-rm67191",
684 720 .of_match_table = rad_of_match,
  721 + .pm = &rad_pm_ops,
685 722 },
686 723 .probe = rad_panel_probe,
687 724 .remove = rad_panel_remove,