1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for Clovertrail PNW Camera Imaging ISP subsystem. 4 * 5 * Copyright (c) 2012 Intel Corporation. All Rights Reserved. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License version 9 * 2 as published by the Free Software Foundation. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * 17 */ 18 19 #ifndef __ATOMISP_ACC_H__ 20 #define __ATOMISP_ACC_H__ 21 22 #include "../../include/linux/atomisp.h" 23 #include "atomisp_internal.h" 24 25 #include "ia_css_types.h" 26 27 /* 28 * Interface functions for AtomISP driver acceleration API implementation. 29 */ 30 31 struct atomisp_sub_device; 32 33 void atomisp_acc_cleanup(struct atomisp_device *isp); 34 35 /* 36 * Free up any allocated resources. 37 * Must be called each time when the device is closed. 38 * Note that there isn't corresponding open() call; 39 * this function may be called sequentially multiple times. 40 * Must be called to free up resources before driver is unloaded. 41 */ 42 void atomisp_acc_release(struct atomisp_sub_device *asd); 43 44 /* Load acceleration binary. DEPRECATED. */ 45 int atomisp_acc_load(struct atomisp_sub_device *asd, 46 struct atomisp_acc_fw_load *fw); 47 48 /* Load acceleration binary with specified properties */ 49 int atomisp_acc_load_to_pipe(struct atomisp_sub_device *asd, 50 struct atomisp_acc_fw_load_to_pipe *fw); 51 52 /* Unload specified acceleration binary */ 53 int atomisp_acc_unload(struct atomisp_sub_device *asd, 54 unsigned int *handle); 55 56 /* 57 * Map a memory region into ISP memory space. 58 */ 59 int atomisp_acc_map(struct atomisp_sub_device *asd, 60 struct atomisp_acc_map *map); 61 62 /* 63 * Unmap a mapped memory region. 64 */ 65 int atomisp_acc_unmap(struct atomisp_sub_device *asd, 66 struct atomisp_acc_map *map); 67 68 /* 69 * Set acceleration binary argument to a previously mapped memory region. 70 */ 71 int atomisp_acc_s_mapped_arg(struct atomisp_sub_device *asd, 72 struct atomisp_acc_s_mapped_arg *arg); 73 74 /* 75 * Start acceleration. 76 * Return immediately, acceleration is left running in background. 77 * Specify either acceleration binary or pipeline which to start. 78 */ 79 int atomisp_acc_start(struct atomisp_sub_device *asd, 80 unsigned int *handle); 81 82 /* 83 * Wait until acceleration finishes. 84 * This MUST be called after each acceleration has been started. 85 * Specify either acceleration binary or pipeline handle. 86 */ 87 int atomisp_acc_wait(struct atomisp_sub_device *asd, 88 unsigned int *handle); 89 90 /* 91 * Used by ISR to notify ACC stage finished. 92 * This is internally used and does not export as IOCTL. 93 */ 94 void atomisp_acc_done(struct atomisp_sub_device *asd, unsigned int handle); 95 96 /* 97 * Appends the loaded acceleration binary extensions to the 98 * current ISP mode. Must be called just before atomisp_css_start(). 99 */ 100 int atomisp_acc_load_extensions(struct atomisp_sub_device *asd); 101 102 /* 103 * Must be called after streaming is stopped: 104 * unloads any loaded acceleration extensions. 105 */ 106 void atomisp_acc_unload_extensions(struct atomisp_sub_device *asd); 107 108 /* 109 * Set acceleration firmware flags. 110 */ 111 int atomisp_acc_set_state(struct atomisp_sub_device *asd, 112 struct atomisp_acc_state *arg); 113 114 /* 115 * Get acceleration firmware flags. 116 */ 117 int atomisp_acc_get_state(struct atomisp_sub_device *asd, 118 struct atomisp_acc_state *arg); 119 120 #endif /* __ATOMISP_ACC_H__ */ 121