jilai wang | 9626b69 | 2015-04-10 16:15:59 -0400 | [diff] [blame] | 1 | /* Copyright (c) 2010,2015, The Linux Foundation. All rights reserved. |
Lina Iyer | 2ce76a6 | 2015-03-02 16:30:29 -0700 | [diff] [blame] | 2 | * Copyright (C) 2015 Linaro Ltd. |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 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 | |
Kumar Gala | b6a1dfb | 2015-03-11 16:28:10 -0500 | [diff] [blame] | 19 | #include <linux/cpumask.h> |
| 20 | #include <linux/export.h> |
| 21 | #include <linux/types.h> |
Kumar Gala | 916f743 | 2015-02-26 15:49:09 -0600 | [diff] [blame] | 22 | #include <linux/qcom_scm.h> |
Stephen Boyd | 2a1eb58 | 2010-08-27 10:01:23 -0700 | [diff] [blame] | 23 | |
Kumar Gala | b6a1dfb | 2015-03-11 16:28:10 -0500 | [diff] [blame] | 24 | #include "qcom_scm.h" |
Lina Iyer | a353e4a | 2015-03-02 16:30:28 -0700 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * qcom_scm_set_cold_boot_addr() - Set the cold boot address for cpus |
| 28 | * @entry: Entry point function for the cpus |
| 29 | * @cpus: The cpumask of cpus that will use the entry point |
| 30 | * |
| 31 | * Set the cold boot address of the cpus. Any cpu outside the supported |
| 32 | * range would be removed from the cpu present mask. |
| 33 | */ |
| 34 | int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus) |
| 35 | { |
Kumar Gala | b6a1dfb | 2015-03-11 16:28:10 -0500 | [diff] [blame] | 36 | return __qcom_scm_set_cold_boot_addr(entry, cpus); |
Lina Iyer | a353e4a | 2015-03-02 16:30:28 -0700 | [diff] [blame] | 37 | } |
| 38 | EXPORT_SYMBOL(qcom_scm_set_cold_boot_addr); |
Lina Iyer | 2ce76a6 | 2015-03-02 16:30:29 -0700 | [diff] [blame] | 39 | |
| 40 | /** |
| 41 | * qcom_scm_set_warm_boot_addr() - Set the warm boot address for cpus |
| 42 | * @entry: Entry point function for the cpus |
| 43 | * @cpus: The cpumask of cpus that will use the entry point |
| 44 | * |
| 45 | * Set the Linux entry point for the SCM to transfer control to when coming |
| 46 | * out of a power down. CPU power down may be executed on cpuidle or hotplug. |
| 47 | */ |
| 48 | int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus) |
| 49 | { |
Kumar Gala | b6a1dfb | 2015-03-11 16:28:10 -0500 | [diff] [blame] | 50 | return __qcom_scm_set_warm_boot_addr(entry, cpus); |
Lina Iyer | 2ce76a6 | 2015-03-02 16:30:29 -0700 | [diff] [blame] | 51 | } |
| 52 | EXPORT_SYMBOL(qcom_scm_set_warm_boot_addr); |
Lina Iyer | 767b023 | 2015-03-02 16:30:30 -0700 | [diff] [blame] | 53 | |
Lina Iyer | 767b023 | 2015-03-02 16:30:30 -0700 | [diff] [blame] | 54 | /** |
| 55 | * qcom_scm_cpu_power_down() - Power down the cpu |
| 56 | * @flags - Flags to flush cache |
| 57 | * |
| 58 | * This is an end point to power down cpu. If there was a pending interrupt, |
| 59 | * the control would return from this function, otherwise, the cpu jumps to the |
| 60 | * warm boot entry point set for this cpu upon reset. |
| 61 | */ |
| 62 | void qcom_scm_cpu_power_down(u32 flags) |
| 63 | { |
Kumar Gala | b6a1dfb | 2015-03-11 16:28:10 -0500 | [diff] [blame] | 64 | __qcom_scm_cpu_power_down(flags); |
Lina Iyer | 767b023 | 2015-03-02 16:30:30 -0700 | [diff] [blame] | 65 | } |
| 66 | EXPORT_SYMBOL(qcom_scm_cpu_power_down); |
jilai wang | 9626b69 | 2015-04-10 16:15:59 -0400 | [diff] [blame] | 67 | |
| 68 | /** |
| 69 | * qcom_scm_hdcp_available() - Check if secure environment supports HDCP. |
| 70 | * |
| 71 | * Return true if HDCP is supported, false if not. |
| 72 | */ |
| 73 | bool qcom_scm_hdcp_available(void) |
| 74 | { |
| 75 | int ret; |
| 76 | |
| 77 | ret = __qcom_scm_is_call_available(QCOM_SCM_SVC_HDCP, |
| 78 | QCOM_SCM_CMD_HDCP); |
| 79 | |
| 80 | return (ret > 0) ? true : false; |
| 81 | } |
| 82 | EXPORT_SYMBOL(qcom_scm_hdcp_available); |
| 83 | |
| 84 | /** |
| 85 | * qcom_scm_hdcp_req() - Send HDCP request. |
| 86 | * @req: HDCP request array |
| 87 | * @req_cnt: HDCP request array count |
| 88 | * @resp: response buffer passed to SCM |
| 89 | * |
| 90 | * Write HDCP register(s) through SCM. |
| 91 | */ |
| 92 | int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) |
| 93 | { |
| 94 | return __qcom_scm_hdcp_req(req, req_cnt, resp); |
| 95 | } |
| 96 | EXPORT_SYMBOL(qcom_scm_hdcp_req); |