18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) STMicroelectronics SA 2015 48c2ecf20Sopenharmony_ci * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics. 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef DELTA_MJPEG_FW_H 88c2ecf20Sopenharmony_ci#define DELTA_MJPEG_FW_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* 118c2ecf20Sopenharmony_ci * struct jpeg_decoded_buffer_address_t 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * defines the addresses where the decoded picture/additional 148c2ecf20Sopenharmony_ci * info related to the block structures will be stored 158c2ecf20Sopenharmony_ci * 168c2ecf20Sopenharmony_ci * @display_luma_p: address of the luma buffer 178c2ecf20Sopenharmony_ci * @display_chroma_p: address of the chroma buffer 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_cistruct jpeg_decoded_buffer_address_t { 208c2ecf20Sopenharmony_ci u32 luma_p; 218c2ecf20Sopenharmony_ci u32 chroma_p; 228c2ecf20Sopenharmony_ci}; 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* 258c2ecf20Sopenharmony_ci * struct jpeg_display_buffer_address_t 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * defines the addresses (used by the Display Reconstruction block) 288c2ecf20Sopenharmony_ci * where the pictures to be displayed will be stored 298c2ecf20Sopenharmony_ci * 308c2ecf20Sopenharmony_ci * @struct_size: size of the structure in bytes 318c2ecf20Sopenharmony_ci * @display_luma_p: address of the luma buffer 328c2ecf20Sopenharmony_ci * @display_chroma_p: address of the chroma buffer 338c2ecf20Sopenharmony_ci * @display_decimated_luma_p: address of the decimated luma buffer 348c2ecf20Sopenharmony_ci * @display_decimated_chroma_p: address of the decimated chroma buffer 358c2ecf20Sopenharmony_ci */ 368c2ecf20Sopenharmony_cistruct jpeg_display_buffer_address_t { 378c2ecf20Sopenharmony_ci u32 struct_size; 388c2ecf20Sopenharmony_ci u32 display_luma_p; 398c2ecf20Sopenharmony_ci u32 display_chroma_p; 408c2ecf20Sopenharmony_ci u32 display_decimated_luma_p; 418c2ecf20Sopenharmony_ci u32 display_decimated_chroma_p; 428c2ecf20Sopenharmony_ci}; 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci/* 458c2ecf20Sopenharmony_ci * used for enabling main/aux outputs for both display & 468c2ecf20Sopenharmony_ci * reference reconstruction blocks 478c2ecf20Sopenharmony_ci */ 488c2ecf20Sopenharmony_cienum jpeg_rcn_ref_disp_enable_t { 498c2ecf20Sopenharmony_ci /* enable decimated (for display) reconstruction */ 508c2ecf20Sopenharmony_ci JPEG_DISP_AUX_EN = 0x00000010, 518c2ecf20Sopenharmony_ci /* enable main (for display) reconstruction */ 528c2ecf20Sopenharmony_ci JPEG_DISP_MAIN_EN = 0x00000020, 538c2ecf20Sopenharmony_ci /* enable both main & decimated (for display) reconstruction */ 548c2ecf20Sopenharmony_ci JPEG_DISP_AUX_MAIN_EN = 0x00000030, 558c2ecf20Sopenharmony_ci /* enable only reference output(ex. for trick modes) */ 568c2ecf20Sopenharmony_ci JPEG_REF_MAIN_EN = 0x00000100, 578c2ecf20Sopenharmony_ci /* 588c2ecf20Sopenharmony_ci * enable reference output with decimated 598c2ecf20Sopenharmony_ci * (for display) reconstruction 608c2ecf20Sopenharmony_ci */ 618c2ecf20Sopenharmony_ci JPEG_REF_MAIN_DISP_AUX_EN = 0x00000110, 628c2ecf20Sopenharmony_ci /* 638c2ecf20Sopenharmony_ci * enable reference output with main 648c2ecf20Sopenharmony_ci * (for display) reconstruction 658c2ecf20Sopenharmony_ci */ 668c2ecf20Sopenharmony_ci JPEG_REF_MAIN_DISP_MAIN_EN = 0x00000120, 678c2ecf20Sopenharmony_ci /* 688c2ecf20Sopenharmony_ci * enable reference output with main & decimated 698c2ecf20Sopenharmony_ci * (for display) reconstruction 708c2ecf20Sopenharmony_ci */ 718c2ecf20Sopenharmony_ci JPEG_REF_MAIN_DISP_MAIN_AUX_EN = 0x00000130 728c2ecf20Sopenharmony_ci}; 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci/* identifies the horizontal decimation factor */ 758c2ecf20Sopenharmony_cienum jpeg_horizontal_deci_factor_t { 768c2ecf20Sopenharmony_ci /* no resize */ 778c2ecf20Sopenharmony_ci JPEG_HDEC_1 = 0x00000000, 788c2ecf20Sopenharmony_ci /* Advanced H/2 resize using improved 8-tap filters */ 798c2ecf20Sopenharmony_ci JPEG_HDEC_ADVANCED_2 = 0x00000101, 808c2ecf20Sopenharmony_ci /* Advanced H/4 resize using improved 8-tap filters */ 818c2ecf20Sopenharmony_ci JPEG_HDEC_ADVANCED_4 = 0x00000102 828c2ecf20Sopenharmony_ci}; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci/* identifies the vertical decimation factor */ 858c2ecf20Sopenharmony_cienum jpeg_vertical_deci_factor_t { 868c2ecf20Sopenharmony_ci /* no resize */ 878c2ecf20Sopenharmony_ci JPEG_VDEC_1 = 0x00000000, 888c2ecf20Sopenharmony_ci /* V/2 , progressive resize */ 898c2ecf20Sopenharmony_ci JPEG_VDEC_ADVANCED_2_PROG = 0x00000204, 908c2ecf20Sopenharmony_ci /* V/2 , interlaced resize */ 918c2ecf20Sopenharmony_ci JPEG_VDEC_ADVANCED_2_INT = 0x000000208 928c2ecf20Sopenharmony_ci}; 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci/* status of the decoding process */ 958c2ecf20Sopenharmony_cienum jpeg_decoding_error_t { 968c2ecf20Sopenharmony_ci JPEG_DECODER_NO_ERROR = 0, 978c2ecf20Sopenharmony_ci JPEG_DECODER_UNDEFINED_HUFF_TABLE = 1, 988c2ecf20Sopenharmony_ci JPEG_DECODER_UNSUPPORTED_MARKER = 2, 998c2ecf20Sopenharmony_ci JPEG_DECODER_UNABLE_ALLOCATE_MEMORY = 3, 1008c2ecf20Sopenharmony_ci JPEG_DECODER_NON_SUPPORTED_SAMP_FACTORS = 4, 1018c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_PARAMETER = 5, 1028c2ecf20Sopenharmony_ci JPEG_DECODER_DECODE_ERROR = 6, 1038c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_RESTART_MARKER = 7, 1048c2ecf20Sopenharmony_ci JPEG_DECODER_UNSUPPORTED_COLORSPACE = 8, 1058c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_SOS_SPECTRAL = 9, 1068c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_SOS_SUCCESSIVE = 10, 1078c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_HEADER_LENGTH = 11, 1088c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_COUNT_VALUE = 12, 1098c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_DHT_MARKER = 13, 1108c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_INDEX_VALUE = 14, 1118c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_NUMBER_HUFFMAN_TABLES = 15, 1128c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_QUANT_TABLE_LENGTH = 16, 1138c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_NUMBER_QUANT_TABLES = 17, 1148c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_COMPONENT_COUNT = 18, 1158c2ecf20Sopenharmony_ci JPEG_DECODER_DIVIDE_BY_ZERO_ERROR = 19, 1168c2ecf20Sopenharmony_ci JPEG_DECODER_NOT_JPG_IMAGE = 20, 1178c2ecf20Sopenharmony_ci JPEG_DECODER_UNSUPPORTED_ROTATION_ANGLE = 21, 1188c2ecf20Sopenharmony_ci JPEG_DECODER_UNSUPPORTED_SCALING = 22, 1198c2ecf20Sopenharmony_ci JPEG_DECODER_INSUFFICIENT_OUTPUTBUFFER_SIZE = 23, 1208c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_HWCFG_GP_VERSION_VALUE = 24, 1218c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_VALUE_FROM_RED = 25, 1228c2ecf20Sopenharmony_ci JPEG_DECODER_BAD_SUBREGION_PARAMETERS = 26, 1238c2ecf20Sopenharmony_ci JPEG_DECODER_PROGRESSIVE_DECODE_NOT_SUPPORTED = 27, 1248c2ecf20Sopenharmony_ci JPEG_DECODER_ERROR_TASK_TIMEOUT = 28, 1258c2ecf20Sopenharmony_ci JPEG_DECODER_ERROR_FEATURE_NOT_SUPPORTED = 29 1268c2ecf20Sopenharmony_ci}; 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci/* identifies the decoding mode */ 1298c2ecf20Sopenharmony_cienum jpeg_decoding_mode_t { 1308c2ecf20Sopenharmony_ci JPEG_NORMAL_DECODE = 0, 1318c2ecf20Sopenharmony_ci}; 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_cienum jpeg_additional_flags_t { 1348c2ecf20Sopenharmony_ci JPEG_ADDITIONAL_FLAG_NONE = 0, 1358c2ecf20Sopenharmony_ci /* request firmware to return values of the CEH registers */ 1368c2ecf20Sopenharmony_ci JPEG_ADDITIONAL_FLAG_CEH = 1, 1378c2ecf20Sopenharmony_ci /* output storage of auxiliary reconstruction in Raster format. */ 1388c2ecf20Sopenharmony_ci JPEG_ADDITIONAL_FLAG_RASTER = 64, 1398c2ecf20Sopenharmony_ci /* output storage of auxiliary reconstruction in 420MB format. */ 1408c2ecf20Sopenharmony_ci JPEG_ADDITIONAL_FLAG_420MB = 128 1418c2ecf20Sopenharmony_ci}; 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci/* 1448c2ecf20Sopenharmony_ci * struct jpeg_video_decode_init_params_t - initialization command parameters 1458c2ecf20Sopenharmony_ci * 1468c2ecf20Sopenharmony_ci * @circular_buffer_begin_addr_p: start address of fw circular buffer 1478c2ecf20Sopenharmony_ci * @circular_buffer_end_addr_p: end address of fw circular buffer 1488c2ecf20Sopenharmony_ci */ 1498c2ecf20Sopenharmony_cistruct jpeg_video_decode_init_params_t { 1508c2ecf20Sopenharmony_ci u32 circular_buffer_begin_addr_p; 1518c2ecf20Sopenharmony_ci u32 circular_buffer_end_addr_p; 1528c2ecf20Sopenharmony_ci u32 reserved; 1538c2ecf20Sopenharmony_ci}; 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci/* 1568c2ecf20Sopenharmony_ci * struct jpeg_decode_params_t - decode command parameters 1578c2ecf20Sopenharmony_ci * 1588c2ecf20Sopenharmony_ci * @picture_start_addr_p: start address of jpeg picture 1598c2ecf20Sopenharmony_ci * @picture_end_addr_p: end address of jpeg picture 1608c2ecf20Sopenharmony_ci * @decoded_buffer_addr: decoded picture buffer 1618c2ecf20Sopenharmony_ci * @display_buffer_addr: display picture buffer 1628c2ecf20Sopenharmony_ci * @main_aux_enable: enable main and/or aux outputs 1638c2ecf20Sopenharmony_ci * @horizontal_decimation_factor:horizontal decimation factor 1648c2ecf20Sopenharmony_ci * @vertical_decimation_factor: vertical decimation factor 1658c2ecf20Sopenharmony_ci * @xvalue0: the x(0) coordinate for subregion decoding 1668c2ecf20Sopenharmony_ci * @xvalue1: the x(1) coordinate for subregion decoding 1678c2ecf20Sopenharmony_ci * @yvalue0: the y(0) coordinate for subregion decoding 1688c2ecf20Sopenharmony_ci * @yvalue1: the y(1) coordinate for subregion decoding 1698c2ecf20Sopenharmony_ci * @decoding_mode: decoding mode 1708c2ecf20Sopenharmony_ci * @additional_flags: additional flags 1718c2ecf20Sopenharmony_ci * @field_flag: determines frame/field scan 1728c2ecf20Sopenharmony_ci * @is_jpeg_image: 1 = still jpeg, 0 = motion jpeg 1738c2ecf20Sopenharmony_ci */ 1748c2ecf20Sopenharmony_cistruct jpeg_decode_params_t { 1758c2ecf20Sopenharmony_ci u32 picture_start_addr_p; 1768c2ecf20Sopenharmony_ci u32 picture_end_addr_p; 1778c2ecf20Sopenharmony_ci struct jpeg_decoded_buffer_address_t decoded_buffer_addr; 1788c2ecf20Sopenharmony_ci struct jpeg_display_buffer_address_t display_buffer_addr; 1798c2ecf20Sopenharmony_ci enum jpeg_rcn_ref_disp_enable_t main_aux_enable; 1808c2ecf20Sopenharmony_ci enum jpeg_horizontal_deci_factor_t horizontal_decimation_factor; 1818c2ecf20Sopenharmony_ci enum jpeg_vertical_deci_factor_t vertical_decimation_factor; 1828c2ecf20Sopenharmony_ci u32 xvalue0; 1838c2ecf20Sopenharmony_ci u32 xvalue1; 1848c2ecf20Sopenharmony_ci u32 yvalue0; 1858c2ecf20Sopenharmony_ci u32 yvalue1; 1868c2ecf20Sopenharmony_ci enum jpeg_decoding_mode_t decoding_mode; 1878c2ecf20Sopenharmony_ci u32 additional_flags; 1888c2ecf20Sopenharmony_ci u32 field_flag; 1898c2ecf20Sopenharmony_ci u32 reserved; 1908c2ecf20Sopenharmony_ci u32 is_jpeg_image; 1918c2ecf20Sopenharmony_ci}; 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci/* 1948c2ecf20Sopenharmony_ci * struct jpeg_decode_return_params_t 1958c2ecf20Sopenharmony_ci * 1968c2ecf20Sopenharmony_ci * status returned by firmware after decoding 1978c2ecf20Sopenharmony_ci * 1988c2ecf20Sopenharmony_ci * @decode_time_in_us: decoding time in microseconds 1998c2ecf20Sopenharmony_ci * @pm_cycles: profiling information 2008c2ecf20Sopenharmony_ci * @pm_dmiss: profiling information 2018c2ecf20Sopenharmony_ci * @pm_imiss: profiling information 2028c2ecf20Sopenharmony_ci * @pm_bundles: profiling information 2038c2ecf20Sopenharmony_ci * @pm_pft: profiling information 2048c2ecf20Sopenharmony_ci * @error_code: status of the decoding process 2058c2ecf20Sopenharmony_ci * @ceh_registers: array where values of the Contrast Enhancement 2068c2ecf20Sopenharmony_ci * Histogram (CEH) registers will be stored. 2078c2ecf20Sopenharmony_ci * ceh_registers[0] correspond to register MBE_CEH_0_7, 2088c2ecf20Sopenharmony_ci * ceh_registers[1] correspond to register MBE_CEH_8_15 2098c2ecf20Sopenharmony_ci * ceh_registers[2] correspond to register MBE_CEH_16_23 2108c2ecf20Sopenharmony_ci * Note that elements of this array will be updated only 2118c2ecf20Sopenharmony_ci * if additional_flags has JPEG_ADDITIONAL_FLAG_CEH set. 2128c2ecf20Sopenharmony_ci */ 2138c2ecf20Sopenharmony_cistruct jpeg_decode_return_params_t { 2148c2ecf20Sopenharmony_ci /* profiling info */ 2158c2ecf20Sopenharmony_ci u32 decode_time_in_us; 2168c2ecf20Sopenharmony_ci u32 pm_cycles; 2178c2ecf20Sopenharmony_ci u32 pm_dmiss; 2188c2ecf20Sopenharmony_ci u32 pm_imiss; 2198c2ecf20Sopenharmony_ci u32 pm_bundles; 2208c2ecf20Sopenharmony_ci u32 pm_pft; 2218c2ecf20Sopenharmony_ci enum jpeg_decoding_error_t error_code; 2228c2ecf20Sopenharmony_ci u32 ceh_registers[32]; 2238c2ecf20Sopenharmony_ci}; 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ci#endif /* DELTA_MJPEG_FW_H */ 226