xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/hwi/CamHwBase.cpp (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  *  Copyright (c) 2019 Rockchip Corporation
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  */
17 
18 #include "CamHwBase.h"
19 #include "SensorHw.h"
20 #include "LensHw.h"
21 
22 namespace RkCam {
23 
CamHwBase()24 CamHwBase::CamHwBase()
25     : mKpHwSt (false)
26 {}
27 
~CamHwBase()28 CamHwBase::~CamHwBase()
29 {}
30 
31 XCamReturn
init(const char * sns_ent_name)32 CamHwBase::init(const char* sns_ent_name)
33 {
34     // TODO: new all subdevices and open
35     return XCAM_RETURN_NO_ERROR;
36 }
37 
38 XCamReturn
deInit()39 CamHwBase::deInit()
40 {
41     return XCAM_RETURN_NO_ERROR;
42 }
43 
44 XCamReturn
prepare(uint32_t width,uint32_t height,int mode,int t_delay,int g_delay)45 CamHwBase::prepare(uint32_t width, uint32_t height, int mode, int t_delay, int g_delay)
46 {
47     // TODO
48     // check sensor's output width,height
49     return XCAM_RETURN_NO_ERROR;
50 }
51 
52 XCamReturn
start()53 CamHwBase::start()
54 {
55     // TODO
56     // subscribe events
57     // start devices
58     // start pollthread
59 //    mPollthread->start();
60 //    mPollLumathread->start();
61 
62     return XCAM_RETURN_NO_ERROR;
63 }
64 
65 XCamReturn
stop()66 CamHwBase::stop()
67 {
68     // TODO
69     // unsubscribe events
70     // stop pollthread
71     // stop devices
72 //    mPollthread->stop();
73 //    mPollLumathread->stop();
74 
75     return XCAM_RETURN_NO_ERROR;
76 }
77 
pause()78 XCamReturn CamHwBase::pause()
79 {
80     return XCAM_RETURN_NO_ERROR;
81 }
resume()82 XCamReturn CamHwBase::resume()
83 {
84     return XCAM_RETURN_NO_ERROR;
85 }
86 
87 XCamReturn
getSensorModeData(const char * sns_ent_name,rk_aiq_exposure_sensor_descriptor & sns_des)88 CamHwBase::getSensorModeData(const char* sns_ent_name,
89                              rk_aiq_exposure_sensor_descriptor& sns_des)
90 {
91     // TODO
92     // get from SensorHw
93 
94     return XCAM_RETURN_NO_ERROR;
95 }
96 
97 XCamReturn
setHwResListener(HwResListener * resListener)98 CamHwBase::setHwResListener(HwResListener* resListener)
99 {
100     mHwResLintener = resListener;
101 
102     return XCAM_RETURN_NO_ERROR;
103 }
104 
105 XCamReturn
poll_buffer_ready(SmartPtr<VideoBuffer> & buf,int type)106 CamHwBase::poll_buffer_ready (SmartPtr<VideoBuffer> &buf, int type)
107 {//not used
108     assert(0);
109 
110     return XCAM_RETURN_NO_ERROR;
111 }
112 
113 XCamReturn
poll_buffer_ready(SmartPtr<VideoBuffer> & buf)114 CamHwBase::poll_buffer_ready (SmartPtr<VideoBuffer> &buf)
115 {
116     if (mHwResLintener) {
117         return mHwResLintener->hwResCb(buf);
118     }
119 
120     return XCAM_RETURN_NO_ERROR;
121 }
122 
123 XCamReturn
poll_buffer_failed(int64_t timestamp,const char * msg)124 CamHwBase::poll_buffer_failed (int64_t timestamp, const char *msg)
125 {
126     // TODO
127     return XCAM_RETURN_ERROR_FAILED;
128 }
129 
130 XCamReturn
poll_event_ready(uint32_t sequence,int type)131 CamHwBase::poll_event_ready (uint32_t sequence, int type)
132 {
133     return XCAM_RETURN_NO_ERROR;
134 }
135 
136 XCamReturn
poll_event_failed(int64_t timestamp,const char * msg)137 CamHwBase::poll_event_failed (int64_t timestamp, const char *msg)
138 {
139     return XCAM_RETURN_ERROR_FAILED;
140 }
141 } //namspace RkCam
142