qcom_scm.c 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* Copyright (c) 2010,2015, The Linux Foundation. All rights reserved.
  2. * Copyright (C) 2015 Linaro Ltd.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. * 02110-1301, USA.
  17. */
  18. #include <linux/cpumask.h>
  19. #include <linux/export.h>
  20. #include <linux/types.h>
  21. #include <linux/qcom_scm.h>
  22. #include "qcom_scm.h"
  23. /**
  24. * qcom_scm_set_cold_boot_addr() - Set the cold boot address for cpus
  25. * @entry: Entry point function for the cpus
  26. * @cpus: The cpumask of cpus that will use the entry point
  27. *
  28. * Set the cold boot address of the cpus. Any cpu outside the supported
  29. * range would be removed from the cpu present mask.
  30. */
  31. int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus)
  32. {
  33. return __qcom_scm_set_cold_boot_addr(entry, cpus);
  34. }
  35. EXPORT_SYMBOL(qcom_scm_set_cold_boot_addr);
  36. /**
  37. * qcom_scm_set_warm_boot_addr() - Set the warm boot address for cpus
  38. * @entry: Entry point function for the cpus
  39. * @cpus: The cpumask of cpus that will use the entry point
  40. *
  41. * Set the Linux entry point for the SCM to transfer control to when coming
  42. * out of a power down. CPU power down may be executed on cpuidle or hotplug.
  43. */
  44. int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus)
  45. {
  46. return __qcom_scm_set_warm_boot_addr(entry, cpus);
  47. }
  48. EXPORT_SYMBOL(qcom_scm_set_warm_boot_addr);
  49. /**
  50. * qcom_scm_cpu_power_down() - Power down the cpu
  51. * @flags - Flags to flush cache
  52. *
  53. * This is an end point to power down cpu. If there was a pending interrupt,
  54. * the control would return from this function, otherwise, the cpu jumps to the
  55. * warm boot entry point set for this cpu upon reset.
  56. */
  57. void qcom_scm_cpu_power_down(u32 flags)
  58. {
  59. __qcom_scm_cpu_power_down(flags);
  60. }
  61. EXPORT_SYMBOL(qcom_scm_cpu_power_down);
  62. /**
  63. * qcom_scm_hdcp_available() - Check if secure environment supports HDCP.
  64. *
  65. * Return true if HDCP is supported, false if not.
  66. */
  67. bool qcom_scm_hdcp_available(void)
  68. {
  69. int ret;
  70. ret = __qcom_scm_is_call_available(QCOM_SCM_SVC_HDCP,
  71. QCOM_SCM_CMD_HDCP);
  72. return (ret > 0) ? true : false;
  73. }
  74. EXPORT_SYMBOL(qcom_scm_hdcp_available);
  75. /**
  76. * qcom_scm_hdcp_req() - Send HDCP request.
  77. * @req: HDCP request array
  78. * @req_cnt: HDCP request array count
  79. * @resp: response buffer passed to SCM
  80. *
  81. * Write HDCP register(s) through SCM.
  82. */
  83. int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp)
  84. {
  85. return __qcom_scm_hdcp_req(req, req_cnt, resp);
  86. }
  87. EXPORT_SYMBOL(qcom_scm_hdcp_req);