0006-soc-rockchip-power-domain-export-idle-request.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. From 4ffe79de7272234408a9179aa4c403ee1b67a362 Mon Sep 17 00:00:00 2001
  2. From: Myy Miouyouyou <myy@miouyouyou.fr>
  3. Date: Thu, 7 Dec 2017 21:27:52 +0100
  4. Subject: [PATCH] soc: rockchip: power-domain: export idle request
  5. We need to put the power status of HEVC/RKVDEC IP into IDLE
  6. unless we can't reset that IP or the SoC would crash down.
  7. rockchip_pmu_idle_request(dev, true)---> enter idle
  8. rockchip_pmu_idle_request(dev, false)---> exit idle
  9. Only the video codec drivers of rockchip platform would
  10. request this patch currently.
  11. I am not sure whether it is necessary to add a new function
  12. at generic power domain. I want someone give me some advises
  13. here.
  14. Signed-off-by: Myy Miouyouyou <myy@miouyouyou.fr>
  15. ---
  16. drivers/soc/rockchip/pm_domains.c | 23 +++++++++++++++++++++++
  17. include/linux/rockchip_pmu.h | 15 +++++++++++++++
  18. 2 files changed, 38 insertions(+)
  19. create mode 100644 include/linux/rockchip_pmu.h
  20. diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
  21. index 40b75748..0006ed53 100644
  22. --- a/drivers/soc/rockchip/pm_domains.c
  23. +++ b/drivers/soc/rockchip/pm_domains.c
  24. @@ -180,6 +180,29 @@ static int rockchip_pmu_set_idle_request(struct rockchip_pm_domain *pd,
  25. return 0;
  26. }
  27. +int rockchip_pmu_idle_request(struct device *dev, bool idle)
  28. +{
  29. + struct generic_pm_domain *genpd;
  30. + struct rockchip_pm_domain *pd;
  31. + int ret;
  32. +
  33. + if (IS_ERR_OR_NULL(dev))
  34. + return -EINVAL;
  35. +
  36. + if (IS_ERR_OR_NULL(dev->pm_domain))
  37. + return -EINVAL;
  38. +
  39. + genpd = pd_to_genpd(dev->pm_domain);
  40. + pd = to_rockchip_pd(genpd);
  41. +
  42. + mutex_lock(&pd->pmu->mutex);
  43. + ret = rockchip_pmu_set_idle_request(pd, idle);
  44. + mutex_unlock(&pd->pmu->mutex);
  45. +
  46. + return ret;
  47. +}
  48. +EXPORT_SYMBOL(rockchip_pmu_idle_request);
  49. +
  50. static int rockchip_pmu_save_qos(struct rockchip_pm_domain *pd)
  51. {
  52. int i;
  53. diff --git a/include/linux/rockchip_pmu.h b/include/linux/rockchip_pmu.h
  54. new file mode 100644
  55. index 00000000..720b3314
  56. --- /dev/null
  57. +++ b/include/linux/rockchip_pmu.h
  58. @@ -0,0 +1,15 @@
  59. +/*
  60. + * pm_domain.h - Definitions and headers related to device power domains.
  61. + *
  62. + * Copyright (C) 2017 Randy Li <ayaka@soulik.info>.
  63. + *
  64. + * This file is released under the GPLv2.
  65. + */
  66. +
  67. +#ifndef _LINUX_ROCKCHIP_PM_H
  68. +#define _LINUX_ROCKCHIP_PM_H
  69. +#include <linux/device.h>
  70. +
  71. +int rockchip_pmu_idle_request(struct device *dev, bool idle);
  72. +
  73. +#endif /* _LINUX_ROCKCHIP_PM_H */
  74. --
  75. 2.14.1