1 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2 /*
3  * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
4  */
5 
6 #ifndef __UAPI_CAM_JPEG_H__
7 #define __UAPI_CAM_JPEG_H__
8 
9 #include <media/cam_defs.h>
10 
11 /* enc, dma, cdm(enc/dma) are used in querycap */
12 #define CAM_JPEG_DEV_TYPE_ENC      0
13 #define CAM_JPEG_DEV_TYPE_DMA      1
14 #define CAM_JPEG_DEV_TYPE_MAX      2
15 
16 #define CAM_JPEG_NUM_DEV_PER_RES_MAX      1
17 
18 /* definitions needed for jpeg aquire device */
19 #define CAM_JPEG_RES_TYPE_ENC        0
20 #define CAM_JPEG_RES_TYPE_DMA        1
21 #define CAM_JPEG_RES_TYPE_MAX        2
22 
23 /* packet opcode types */
24 #define CAM_JPEG_OPCODE_ENC_UPDATE 0
25 #define CAM_JPEG_OPCODE_DMA_UPDATE 1
26 
27 /* ENC input port resource type */
28 #define CAM_JPEG_ENC_INPUT_IMAGE                 0x0
29 
30 /* ENC output port resource type */
31 #define CAM_JPEG_ENC_OUTPUT_IMAGE                0x1
32 
33 #define CAM_JPEG_ENC_IO_IMAGES_MAX               0x2
34 
35 /* DMA input port resource type */
36 #define CAM_JPEG_DMA_INPUT_IMAGE                 0x0
37 
38 /* DMA output port resource type */
39 #define CAM_JPEG_DMA_OUTPUT_IMAGE                0x1
40 
41 #define CAM_JPEG_DMA_IO_IMAGES_MAX               0x2
42 
43 #define CAM_JPEG_IMAGE_MAX                       0x2
44 
45 /**
46  * struct cam_jpeg_dev_ver - Device information for particular hw type
47  *
48  * This is used to get device version info of JPEG ENC, JPEG DMA
49  * from hardware and use this info in CAM_QUERY_CAP IOCTL
50  *
51  * @size : Size of struct passed
52  * @dev_type: Hardware type for the cap info(jpeg enc, jpeg dma)
53  * @hw_ver: Major, minor and incr values of a device version
54  */
55 struct cam_jpeg_dev_ver {
56 	uint32_t size;
57 	uint32_t dev_type;
58 	struct cam_hw_version hw_ver;
59 };
60 
61 /**
62  * struct cam_jpeg_query_cap_cmd - JPEG query device capability payload
63  *
64  * @dev_iommu_handle: Jpeg iommu handles for secure/non secure
65  *      modes
66  * @cdm_iommu_handle: Iommu handles for secure/non secure modes
67  * @num_enc: Number of encoder
68  * @num_dma: Number of dma
69  * @dev_ver: Returned device capability array
70  */
71 struct cam_jpeg_query_cap_cmd {
72 	struct cam_iommu_handle dev_iommu_handle;
73 	struct cam_iommu_handle cdm_iommu_handle;
74 	uint32_t num_enc;
75 	uint32_t num_dma;
76 	struct cam_jpeg_dev_ver dev_ver[CAM_JPEG_DEV_TYPE_MAX];
77 };
78 
79 /**
80  * struct cam_jpeg_res_info - JPEG output resource info
81  *
82  * @format: Format of the resource
83  * @width:  Width in pixels
84  * @height: Height in lines
85  * @fps:  Fps
86  */
87 struct cam_jpeg_res_info {
88 	uint32_t format;
89 	uint32_t width;
90 	uint32_t height;
91 	uint32_t fps;
92 };
93 
94 /**
95  * struct cam_jpeg_acquire_dev_info - An JPEG device info
96  *
97  * @dev_type: Device type (ENC/DMA)
98  * @reserved: Reserved Bytes
99  * @in_res: In resource info
100  * @in_res: Iut resource info
101  */
102 struct cam_jpeg_acquire_dev_info {
103 	uint32_t dev_type;
104 	uint32_t reserved;
105 	struct cam_jpeg_res_info in_res;
106 	struct cam_jpeg_res_info out_res;
107 };
108 
109 /**
110  * struct cam_jpeg_config_inout_param_info - JPEG Config time
111  *     input output params
112  *
113  * @clk_index: Input Param- clock selection index.(-1 default)
114  * @output_size: Output Param - jpeg encode/dma output size in
115  *     bytes
116  */
117 struct cam_jpeg_config_inout_param_info {
118 	int32_t clk_index;
119 	int32_t output_size;
120 };
121 
122 #endif /* __UAPI_CAM_JPEG_H__ */
123