xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/uAPI2/rk_aiq_user_api2_atmo.cpp (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (c) 2019-2022 Rockchip Eletronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #include "uAPI2/rk_aiq_user_api2_atmo.h"
17 
18 #include "algo_handlers/RkAiqAtmoHandle.h"
19 
20 RKAIQ_BEGIN_DECLARE
21 
22 #ifdef RK_SIMULATOR_HW
23 #define CHECK_USER_API_ENABLE
24 #endif
25 
26 #if RKAIQ_HAVE_TMO_V1
27 XCamReturn
rk_aiq_user_api2_atmo_SetAttrib(const rk_aiq_sys_ctx_t * sys_ctx,atmo_attrib_t attr)28 rk_aiq_user_api2_atmo_SetAttrib(const rk_aiq_sys_ctx_t* sys_ctx, atmo_attrib_t attr)
29 {
30     if(CHECK_ISP_HW_V20()) {
31         CHECK_USER_API_ENABLE2(sys_ctx);
32         CHECK_USER_API_ENABLE(RK_AIQ_ALGO_TYPE_ATMO);
33         RkAiqAtmoHandleInt* algo_handle =
34             algoHandle<RkAiqAtmoHandleInt>(sys_ctx, RK_AIQ_ALGO_TYPE_ATMO);
35 
36         if (algo_handle) {
37             return algo_handle->setAttrib(attr);
38         }
39     }
40     else if(CHECK_ISP_HW_V21())
41         LOGE_ATMO("%s:ISP2.1 do not support atmo api!\n", __FUNCTION__);
42 
43     return XCAM_RETURN_NO_ERROR;
44 }
45 
46 XCamReturn
rk_aiq_user_api2_atmo_GetAttrib(const rk_aiq_sys_ctx_t * sys_ctx,atmo_attrib_t * attr)47 rk_aiq_user_api2_atmo_GetAttrib(const rk_aiq_sys_ctx_t* sys_ctx, atmo_attrib_t* attr)
48 {
49     if(CHECK_ISP_HW_V20()) {
50         RkAiqAtmoHandleInt* algo_handle =
51             algoHandle<RkAiqAtmoHandleInt>(sys_ctx, RK_AIQ_ALGO_TYPE_ATMO);
52 
53         if (algo_handle) {
54             return algo_handle->getAttrib(attr);
55         }
56     }
57     else if(CHECK_ISP_HW_V21())
58         LOGE_ATMO("%s:ISP2.1 do not support atmo api!\n", __FUNCTION__);
59 
60     return XCAM_RETURN_NO_ERROR;
61 }
62 #else
63 XCamReturn
64 rk_aiq_user_api2_atmo_SetAttrib(const rk_aiq_sys_ctx_t* sys_ctx, atmo_attrib_t attr) {
65     return XCAM_RETURN_ERROR_UNKNOWN;
66 }
67 
68 XCamReturn
69 rk_aiq_user_api2_atmo_GetAttrib(const rk_aiq_sys_ctx_t* sys_ctx, atmo_attrib_t* attr) {
70     return XCAM_RETURN_ERROR_UNKNOWN;
71 }
72 #endif
73 
74 
75 RKAIQ_END_DECLARE
76