1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for Intel Camera Imaging ISP subsystem. 4 * Copyright (c) 2015, Intel Corporation. 5 */ 6 7 #ifndef __IA_CSS_METADATA_H 8 #define __IA_CSS_METADATA_H 9 10 /* @file 11 * This file contains structure for processing sensor metadata. 12 */ 13 14 #include <linux/build_bug.h> 15 16 #include <type_support.h> 17 #include "ia_css_types.h" 18 #include "ia_css_stream_format.h" 19 20 /* Metadata configuration. This data structure contains necessary info 21 * to process sensor metadata. 22 */ 23 struct ia_css_metadata_config { 24 enum atomisp_input_format data_type; /** Data type of CSI-2 embedded 25 data. The default value is ATOMISP_INPUT_FORMAT_EMBEDDED. For 26 certain sensors, user can choose non-default data type for embedded 27 data. */ 28 struct ia_css_resolution resolution; /** Resolution */ 29 }; 30 31 struct ia_css_metadata_info { 32 struct ia_css_resolution resolution; /** Resolution */ 33 u32 stride; /** Stride in bytes */ 34 u32 size; /** Total size in bytes */ 35 }; 36 37 struct ia_css_metadata { 38 struct ia_css_metadata_info info; /** Layout info */ 39 ia_css_ptr address; /** CSS virtual address */ 40 u32 exp_id; 41 /** Exposure ID, see ia_css_event_public.h for more detail */ 42 }; 43 44 #define SIZE_OF_IA_CSS_METADATA_STRUCT sizeof(struct ia_css_metadata) 45 46 static_assert(sizeof(struct ia_css_metadata) == SIZE_OF_IA_CSS_METADATA_STRUCT); 47 48 /* @brief Allocate a metadata buffer. 49 * @param[in] metadata_info Metadata info struct, contains details on metadata buffers. 50 * @return Pointer of metadata buffer or NULL (if error) 51 * 52 * This function allocates a metadata buffer according to the properties 53 * specified in the metadata_info struct. 54 */ 55 struct ia_css_metadata * 56 ia_css_metadata_allocate(const struct ia_css_metadata_info *metadata_info); 57 58 /* @brief Free a metadata buffer. 59 * 60 * @param[in] metadata Pointer of metadata buffer. 61 * @return None 62 * 63 * This function frees a metadata buffer. 64 */ 65 void 66 ia_css_metadata_free(struct ia_css_metadata *metadata); 67 68 #endif /* __IA_CSS_METADATA_H */ 69