Lakshmi Narayana Kalavala | 85c4035 | 2017-05-15 16:19:13 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2017, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #ifndef _HFI_INTF_H_ |
| 14 | #define _HFI_INTF_H_ |
| 15 | |
| 16 | #include <linux/types.h> |
| 17 | |
| 18 | /** |
| 19 | * struct hfi_mem |
| 20 | * @len: length of memory |
| 21 | * @kva: kernel virtual address |
| 22 | * @iova: IO virtual address |
| 23 | * @reserved: reserved field |
| 24 | */ |
| 25 | struct hfi_mem { |
| 26 | uint64_t len; |
| 27 | uint64_t kva; |
| 28 | uint32_t iova; |
| 29 | uint32_t reserved; |
| 30 | }; |
| 31 | |
| 32 | /** |
| 33 | * struct hfi_mem_info |
| 34 | * @qtbl: qtable hfi memory |
| 35 | * @cmd_q: command queue hfi memory for host to firmware communication |
| 36 | * @msg_q: message queue hfi memory for firmware to host communication |
| 37 | * @dbg_q: debug queue hfi memory for firmware debug information |
| 38 | * @sec_heap: secondary heap hfi memory for firmware |
| 39 | * @icp_base: icp base address |
| 40 | */ |
| 41 | struct hfi_mem_info { |
| 42 | struct hfi_mem qtbl; |
| 43 | struct hfi_mem cmd_q; |
| 44 | struct hfi_mem msg_q; |
| 45 | struct hfi_mem dbg_q; |
| 46 | struct hfi_mem sec_heap; |
Lakshmi Narayana Kalavala | 2743a0d | 2017-05-30 10:41:37 -0700 | [diff] [blame] | 47 | struct hfi_mem shmem; |
Lakshmi Narayana Kalavala | 85c4035 | 2017-05-15 16:19:13 -0700 | [diff] [blame] | 48 | void __iomem *icp_base; |
| 49 | }; |
| 50 | |
| 51 | /** |
| 52 | * hfi_write_cmd() - function for hfi write |
| 53 | * @cmd_ptr: pointer to command data for hfi write |
| 54 | * |
| 55 | * Returns success(zero)/failure(non zero) |
| 56 | */ |
| 57 | int hfi_write_cmd(void *cmd_ptr); |
| 58 | |
| 59 | /** |
| 60 | * hfi_read_message() - function for hfi read |
| 61 | * @pmsg: buffer to place read message for hfi queue |
| 62 | * @q_id: queue id |
Karthik Anantha Ram | ad34728 | 2017-11-01 13:09:17 -0700 | [diff] [blame] | 63 | * @words_read: total number of words read from the queue |
| 64 | * returned as output to the caller |
Lakshmi Narayana Kalavala | 85c4035 | 2017-05-15 16:19:13 -0700 | [diff] [blame] | 65 | * |
Karthik Anantha Ram | ad34728 | 2017-11-01 13:09:17 -0700 | [diff] [blame] | 66 | * Returns success(zero)/failure(non zero) |
Lakshmi Narayana Kalavala | 85c4035 | 2017-05-15 16:19:13 -0700 | [diff] [blame] | 67 | */ |
Karthik Anantha Ram | ad34728 | 2017-11-01 13:09:17 -0700 | [diff] [blame] | 68 | int hfi_read_message(uint32_t *pmsg, uint8_t q_id, uint32_t *words_read); |
Lakshmi Narayana Kalavala | 85c4035 | 2017-05-15 16:19:13 -0700 | [diff] [blame] | 69 | |
| 70 | /** |
| 71 | * hfi_init() - function initialize hfi after firmware download |
| 72 | * @event_driven_mode: event mode |
| 73 | * @hfi_mem: hfi memory info |
| 74 | * @icp_base: icp base address |
| 75 | * @debug: debug flag |
| 76 | * |
| 77 | * Returns success(zero)/failure(non zero) |
| 78 | */ |
| 79 | int cam_hfi_init(uint8_t event_driven_mode, struct hfi_mem_info *hfi_mem, |
| 80 | void *__iomem icp_base, bool debug); |
| 81 | |
| 82 | /** |
| 83 | * hfi_get_hw_caps() - hardware capabilities from firmware |
| 84 | * @query_caps: holds query information from hfi |
| 85 | * |
| 86 | * Returns success(zero)/failure(non zero) |
| 87 | */ |
| 88 | int hfi_get_hw_caps(void *query_caps); |
| 89 | |
| 90 | /** |
| 91 | * hfi_send_system_cmd() - send hfi system command to firmware |
| 92 | * @type: type of system command |
| 93 | * @data: command data |
| 94 | * @size: size of command data |
| 95 | */ |
| 96 | void hfi_send_system_cmd(uint32_t type, uint64_t data, uint32_t size); |
| 97 | |
| 98 | /** |
| 99 | * cam_hfi_enable_cpu() - enable A5 CPU |
| 100 | * @icp_base: icp base address |
| 101 | */ |
| 102 | void cam_hfi_enable_cpu(void __iomem *icp_base); |
Suresh Vankadara | d8905f4 | 2017-06-04 13:33:49 +0530 | [diff] [blame] | 103 | |
| 104 | /** |
| 105 | * cam_hfi_disable_cpu() - disable A5 CPU |
| 106 | * @icp_base: icp base address |
| 107 | */ |
| 108 | void cam_hfi_disable_cpu(void __iomem *icp_base); |
| 109 | |
Lakshmi Narayana Kalavala | 85c4035 | 2017-05-15 16:19:13 -0700 | [diff] [blame] | 110 | /** |
| 111 | * cam_hfi_deinit() - cleanup HFI |
| 112 | */ |
| 113 | void cam_hfi_deinit(void); |
Lakshmi Narayana Kalavala | dac0b6c | 2017-09-13 15:33:42 -0700 | [diff] [blame] | 114 | /** |
| 115 | * hfi_set_debug_level() - set debug level |
| 116 | * @lvl: FW debug message level |
| 117 | */ |
| 118 | int hfi_set_debug_level(uint32_t lvl); |
Lakshmi Narayana Kalavala | 85c4035 | 2017-05-15 16:19:13 -0700 | [diff] [blame] | 119 | |
Suresh Vankadara | 6657bc2 | 2017-07-31 10:33:04 +0530 | [diff] [blame] | 120 | /** |
| 121 | * hfi_enable_ipe_bps_pc() - Enable interframe pc |
| 122 | * Host sends a command to firmware to enable interframe |
| 123 | * power collapse for IPE and BPS hardware. |
| 124 | * |
| 125 | * @enable: flag to enable/disable |
Alok Pandey | 78093d3 | 2017-11-08 18:56:54 +0530 | [diff] [blame^] | 126 | * @core_info: Core information to firmware |
Suresh Vankadara | 6657bc2 | 2017-07-31 10:33:04 +0530 | [diff] [blame] | 127 | */ |
Alok Pandey | 78093d3 | 2017-11-08 18:56:54 +0530 | [diff] [blame^] | 128 | int hfi_enable_ipe_bps_pc(bool enable, uint32_t core_info); |
Suresh Vankadara | 6657bc2 | 2017-07-31 10:33:04 +0530 | [diff] [blame] | 129 | |
Suresh Vankadara | aa6ff8f | 2017-10-26 22:51:27 +0530 | [diff] [blame] | 130 | /** |
| 131 | * hfi_cmd_ubwc_config() - UBWC configuration to firmware |
| 132 | * @ubwc_cfg: UBWC configuration parameters |
| 133 | */ |
| 134 | int hfi_cmd_ubwc_config(uint32_t *ubwc_cfg); |
| 135 | |
Alok Pandey | 78093d3 | 2017-11-08 18:56:54 +0530 | [diff] [blame^] | 136 | /** |
| 137 | * cam_hfi_resume() - function to resume |
| 138 | * @hfi_mem: hfi memory info |
| 139 | * @icp_base: icp base address |
| 140 | * @debug: debug flag |
| 141 | * |
| 142 | * Returns success(zero)/failure(non zero) |
| 143 | */ |
| 144 | int cam_hfi_resume(struct hfi_mem_info *hfi_mem, |
| 145 | void __iomem *icp_base, bool debug); |
| 146 | |
Lakshmi Narayana Kalavala | 85c4035 | 2017-05-15 16:19:13 -0700 | [diff] [blame] | 147 | #endif /* _HFI_INTF_H_ */ |