Harsh Shah | a1af882 | 2017-05-11 22:06:36 -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 _CAM_ISP_HW_H_ |
| 14 | #define _CAM_ISP_HW_H_ |
| 15 | |
| 16 | #include <linux/completion.h> |
| 17 | #include "cam_hw.h" |
| 18 | #include "cam_soc_util.h" |
| 19 | #include "cam_irq_controller.h" |
Ravikishore Pampana | ff6132e | 2017-07-27 15:32:31 +0530 | [diff] [blame] | 20 | #include <uapi/media/cam_isp.h> |
Harsh Shah | a1af882 | 2017-05-11 22:06:36 -0700 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * struct cam_isp_timestamp: |
| 24 | * |
| 25 | * @mono_time: Monotonic boot time |
| 26 | * @vt_time: AV Timer time |
| 27 | * @ticks: Qtimer ticks |
| 28 | */ |
| 29 | struct cam_isp_timestamp { |
| 30 | struct timeval mono_time; |
| 31 | struct timeval vt_time; |
| 32 | uint64_t ticks; |
| 33 | }; |
| 34 | |
| 35 | /* |
| 36 | * cam_isp_hw_get_timestamp() |
| 37 | * |
| 38 | * @Brief: Get timestamp values |
| 39 | * |
| 40 | * @time_stamp: Structure that holds different time values |
| 41 | * |
| 42 | * @Return: Void |
| 43 | */ |
| 44 | void cam_isp_hw_get_timestamp(struct cam_isp_timestamp *time_stamp); |
| 45 | |
| 46 | enum cam_isp_hw_type { |
| 47 | CAM_ISP_HW_TYPE_CSID = 0, |
| 48 | CAM_ISP_HW_TYPE_ISPIF = 1, |
| 49 | CAM_ISP_HW_TYPE_VFE = 2, |
| 50 | CAM_ISP_HW_TYPE_IFE_CSID = 3, |
| 51 | CAM_ISP_HW_TYPE_MAX = 4, |
| 52 | }; |
| 53 | |
| 54 | enum cam_isp_hw_split_id { |
| 55 | CAM_ISP_HW_SPLIT_LEFT = 0, |
| 56 | CAM_ISP_HW_SPLIT_RIGHT, |
| 57 | CAM_ISP_HW_SPLIT_MAX, |
| 58 | }; |
| 59 | |
| 60 | enum cam_isp_hw_sync_mode { |
| 61 | CAM_ISP_HW_SYNC_NONE, |
| 62 | CAM_ISP_HW_SYNC_MASTER, |
| 63 | CAM_ISP_HW_SYNC_SLAVE, |
| 64 | CAM_ISP_HW_SYNC_MAX, |
| 65 | }; |
| 66 | |
| 67 | enum cam_isp_resource_state { |
| 68 | CAM_ISP_RESOURCE_STATE_UNAVAILABLE = 0, |
| 69 | CAM_ISP_RESOURCE_STATE_AVAILABLE = 1, |
| 70 | CAM_ISP_RESOURCE_STATE_RESERVED = 2, |
| 71 | CAM_ISP_RESOURCE_STATE_INIT_HW = 3, |
| 72 | CAM_ISP_RESOURCE_STATE_STREAMING = 4, |
| 73 | }; |
| 74 | |
| 75 | enum cam_isp_resource_type { |
| 76 | CAM_ISP_RESOURCE_UNINT, |
| 77 | CAM_ISP_RESOURCE_SRC, |
| 78 | CAM_ISP_RESOURCE_CID, |
| 79 | CAM_ISP_RESOURCE_PIX_PATH, |
| 80 | CAM_ISP_RESOURCE_VFE_IN, |
| 81 | CAM_ISP_RESOURCE_VFE_OUT, |
| 82 | CAM_ISP_RESOURCE_MAX, |
| 83 | }; |
| 84 | |
| 85 | /* |
| 86 | * struct cam_isp_resource_node: |
| 87 | * |
| 88 | * @Brief: Structure representing HW resource object |
| 89 | * |
| 90 | * @res_type: Resource Type |
| 91 | * @res_id: Unique resource ID within res_type objects |
| 92 | * for a particular HW |
| 93 | * @res_state: State of the resource |
| 94 | * @hw_intf: HW Interface of HW to which this resource |
| 95 | * belongs |
| 96 | * @res_priv: Private data of the resource |
| 97 | * @list: list_head node for this resource |
| 98 | * @cdm_ops: CDM operation functions |
| 99 | * @tasklet_info: Tasklet structure that will be used to |
| 100 | * schedule IRQ events related to this resource |
| 101 | * @irq_handle: handle returned on subscribing for IRQ event |
Senthil Kumar Rajagopal | a8e0c49 | 2017-09-05 16:21:49 +0530 | [diff] [blame] | 102 | * @init: function pointer to init the HW resource |
| 103 | * @deinit: function pointer to deinit the HW resource |
Harsh Shah | a1af882 | 2017-05-11 22:06:36 -0700 | [diff] [blame] | 104 | * @start: function pointer to start the HW resource |
| 105 | * @stop: function pointer to stop the HW resource |
| 106 | * @process_cmd: function pointer for processing commands |
| 107 | * specific to the resource |
| 108 | * @top_half_handler: Top Half handler function |
| 109 | * @bottom_half_handler: Bottom Half handler function |
| 110 | */ |
| 111 | struct cam_isp_resource_node { |
| 112 | enum cam_isp_resource_type res_type; |
| 113 | uint32_t res_id; |
| 114 | enum cam_isp_resource_state res_state; |
| 115 | struct cam_hw_intf *hw_intf; |
| 116 | void *res_priv; |
| 117 | struct list_head list; |
| 118 | void *cdm_ops; |
| 119 | void *tasklet_info; |
| 120 | int irq_handle; |
| 121 | |
Senthil Kumar Rajagopal | a8e0c49 | 2017-09-05 16:21:49 +0530 | [diff] [blame] | 122 | int (*init)(struct cam_isp_resource_node *rsrc_node, |
| 123 | void *init_args, uint32_t arg_size); |
| 124 | int (*deinit)(struct cam_isp_resource_node *rsrc_node, |
| 125 | void *deinit_args, uint32_t arg_size); |
Harsh Shah | a1af882 | 2017-05-11 22:06:36 -0700 | [diff] [blame] | 126 | int (*start)(struct cam_isp_resource_node *rsrc_node); |
| 127 | int (*stop)(struct cam_isp_resource_node *rsrc_node); |
| 128 | int (*process_cmd)(struct cam_isp_resource_node *rsrc_node, |
| 129 | uint32_t cmd_type, void *cmd_args, uint32_t arg_size); |
| 130 | CAM_IRQ_HANDLER_TOP_HALF top_half_handler; |
| 131 | CAM_IRQ_HANDLER_BOTTOM_HALF bottom_half_handler; |
| 132 | }; |
| 133 | |
| 134 | /* |
| 135 | * struct cam_isp_hw_get_cdm_args: |
| 136 | * |
| 137 | * @Brief: Contain the command buffer information |
| 138 | * to store the CDM commands. |
| 139 | * |
| 140 | * @res: Resource node |
| 141 | * @cmd_buf_addr: Command buffer to store the change base command |
| 142 | * @size: Size of the buffer in bytes |
| 143 | * @used_bytes: Consumed bytes in the command buffer |
| 144 | * |
| 145 | */ |
| 146 | struct cam_isp_hw_get_cdm_args { |
| 147 | struct cam_isp_resource_node *res; |
| 148 | uint32_t *cmd_buf_addr; |
| 149 | uint32_t size; |
| 150 | uint32_t used_bytes; |
| 151 | }; |
| 152 | |
| 153 | /* |
| 154 | * struct cam_isp_hw_get_buf_update: |
| 155 | * |
| 156 | * @Brief: Get cdm commands for buffer updates. |
| 157 | * |
| 158 | * @ cdm: Command buffer information |
Jing Zhou | a4e9fbe | 2017-05-15 14:37:21 -0700 | [diff] [blame] | 159 | * @ image_buf: image buffer address array |
Harsh Shah | a1af882 | 2017-05-11 22:06:36 -0700 | [diff] [blame] | 160 | * @ num_buf: Number of buffers in the image_buf array |
Jing Zhou | a4e9fbe | 2017-05-15 14:37:21 -0700 | [diff] [blame] | 161 | * @ io_cfg: IO buffer config information sent from UMD |
Harsh Shah | a1af882 | 2017-05-11 22:06:36 -0700 | [diff] [blame] | 162 | * |
| 163 | */ |
| 164 | struct cam_isp_hw_get_buf_update { |
| 165 | struct cam_isp_hw_get_cdm_args cdm; |
| 166 | uint64_t *image_buf; |
| 167 | uint32_t num_buf; |
Jing Zhou | a4e9fbe | 2017-05-15 14:37:21 -0700 | [diff] [blame] | 168 | struct cam_buf_io_cfg *io_cfg; |
Harsh Shah | a1af882 | 2017-05-11 22:06:36 -0700 | [diff] [blame] | 169 | }; |
| 170 | |
Pavan Kumar Chilamkurthi | 649cdf9 | 2017-08-15 01:40:57 -0700 | [diff] [blame] | 171 | /* |
| 172 | * struct cam_isp_hw_get_hfr_update: |
| 173 | * |
| 174 | * @Brief: Get cdm commands for HFR updates. |
| 175 | * |
| 176 | * @ cdm: Command buffer information |
| 177 | * @ io_hfr_cfg: IO buffer config information sent from UMD |
| 178 | * |
| 179 | */ |
| 180 | struct cam_isp_hw_get_hfr_update { |
| 181 | struct cam_isp_hw_get_cdm_args cdm; |
| 182 | struct cam_isp_port_hfr_config *io_hfr_cfg; |
| 183 | }; |
| 184 | |
Ravikishore Pampana | ff6132e | 2017-07-27 15:32:31 +0530 | [diff] [blame] | 185 | /* |
| 186 | * struct cam_isp_hw_dual_isp_update_args: |
| 187 | * |
| 188 | * @Brief: update the dual isp striping configuration. |
| 189 | * |
| 190 | * @ split_id: spilt id to inform left or rifht |
| 191 | * @ res: resource node |
| 192 | * @ dual_cfg: dual isp configuration |
| 193 | * |
| 194 | */ |
| 195 | struct cam_isp_hw_dual_isp_update_args { |
| 196 | enum cam_isp_hw_split_id split_id; |
| 197 | struct cam_isp_resource_node *res; |
| 198 | struct cam_isp_dual_config *dual_cfg; |
| 199 | }; |
Harsh Shah | a1af882 | 2017-05-11 22:06:36 -0700 | [diff] [blame] | 200 | #endif /* _CAM_ISP_HW_H_ */ |