Advertisement
Guest User

Untitled

a guest
Apr 29th, 2021
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.41 KB | None | 0 0
  1. diff --git a/drivers/soc/amlogic/meson-ee-pwrc.c b/drivers/soc/amlogic/meson-ee-pwrc.c
  2. index 50bf5d2b828b..70d6ab7a6b47 100644
  3. --- a/drivers/soc/amlogic/meson-ee-pwrc.c
  4. +++ b/drivers/soc/amlogic/meson-ee-pwrc.c
  5. @@ -353,10 +353,15 @@ static int meson_ee_pwrc_off(struct generic_pm_domain *domain)
  6.  
  7.     if (pwrc_domain->num_clks) {
  8.         msleep(20);
  9. -       clk_bulk_disable_unprepare(pwrc_domain->num_clks,
  10. -                      pwrc_domain->clks);
  11. +
  12. +       /* TODO: test */
  13. +       if (pwrc_domain->enabled)
  14. +           clk_bulk_disable_unprepare(pwrc_domain->num_clks,
  15. +                          pwrc_domain->clks);
  16.     }
  17.  
  18. +   pwrc_domain->enabled = false;
  19. +
  20.     return 0;
  21.  }
  22.  
  23. @@ -392,8 +397,14 @@ static int meson_ee_pwrc_on(struct generic_pm_domain *domain)
  24.     if (ret)
  25.         return ret;
  26.  
  27. -   return clk_bulk_prepare_enable(pwrc_domain->num_clks,
  28. -                      pwrc_domain->clks);
  29. +   ret = clk_bulk_prepare_enable(pwrc_domain->num_clks,
  30. +                     pwrc_domain->clks);
  31. +   if (ret)
  32. +       return ret;
  33. +
  34. +   pwrc_domain->enabled = true;
  35. +
  36. +   return 0;
  37.  }
  38.  
  39.  static int meson_ee_pwrc_init_domain(struct platform_device *pdev,
  40. @@ -434,33 +445,11 @@ static int meson_ee_pwrc_init_domain(struct platform_device *pdev,
  41.     dom->base.power_on = meson_ee_pwrc_on;
  42.     dom->base.power_off = meson_ee_pwrc_off;
  43.  
  44. -   /*
  45. -         * TOFIX: This is a special case for the VPU power domain, which can
  46. -    * be enabled previously by the bootloader. In this case the VPU
  47. -         * pipeline may be functional but no driver maybe never attach
  48. -         * to this power domain, and if the domain is disabled it could
  49. -         * cause system errors. This is why the pm_domain_always_on_gov
  50. -         * is used here.
  51. -         * For the same reason, the clocks should be enabled in case
  52. -         * we need to power the domain off, otherwise the internal clocks
  53. -         * prepare/enable counters won't be in sync.
  54. -         */
  55. -   if (dom->num_clks && dom->desc.get_power && !dom->desc.get_power(dom)) {
  56. -       ret = clk_bulk_prepare_enable(dom->num_clks, dom->clks);
  57. -       if (ret)
  58. -           return ret;
  59. -
  60. -       dom->base.flags = GENPD_FLAG_ALWAYS_ON;
  61. -       ret = pm_genpd_init(&dom->base, NULL, false);
  62. -       if (ret)
  63. -           return ret;
  64. -   } else {
  65. -       ret = pm_genpd_init(&dom->base, NULL,
  66. -                   (dom->desc.get_power ?
  67. -                    dom->desc.get_power(dom) : true));
  68. -       if (ret)
  69. -           return ret;
  70. -   }
  71. +   ret = pm_genpd_init(&dom->base, NULL,
  72. +               (dom->desc.get_power ?
  73. +                dom->desc.get_power(dom) : true));
  74. +   if (ret)
  75. +       return ret;
  76.  
  77.     return 0;
  78.  }
  79. @@ -528,19 +517,6 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
  80.     return of_genpd_add_provider_onecell(pdev->dev.of_node, &pwrc->xlate);
  81.  }
  82.  
  83. -static void meson_ee_pwrc_shutdown(struct platform_device *pdev)
  84. -{
  85. -   struct meson_ee_pwrc *pwrc = platform_get_drvdata(pdev);
  86. -   int i;
  87. -
  88. -   for (i = 0 ; i < pwrc->xlate.num_domains ; ++i) {
  89. -       struct meson_ee_pwrc_domain *dom = &pwrc->domains[i];
  90. -
  91. -       if (dom->desc.get_power && !dom->desc.get_power(dom))
  92. -           meson_ee_pwrc_off(&dom->base);
  93. -   }
  94. -}
  95. -
  96.  static struct meson_ee_pwrc_domain_data meson_ee_g12a_pwrc_data = {
  97.     .count = ARRAY_SIZE(g12a_pwrc_domains),
  98.     .domains = g12a_pwrc_domains,
  99. @@ -606,7 +582,6 @@ MODULE_DEVICE_TABLE(of, meson_ee_pwrc_match_table);
  100.  
  101.  static struct platform_driver meson_ee_pwrc_driver = {
  102.     .probe = meson_ee_pwrc_probe,
  103. -   .shutdown = meson_ee_pwrc_shutdown,
  104.     .driver = {
  105.         .name       = "meson_ee_pwrc",
  106.         .of_match_table = meson_ee_pwrc_match_table,
  107.  
  108.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement