GC5035.c 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908
  1. /******************************************************************************\ |* Copyright (c) 2020 by VeriSilicon Holdings Co., Ltd. ("VeriSilicon") *| |* All Rights Reserved. *| |* *| |* The material in this file is confidential and contains trade secrets of *| |* of VeriSilicon. This is proprietary information owned or licensed by *| |* VeriSilicon. No part of this work may be disclosed, reproduced, copied, *| |* transmitted, or used in any way for any purpose, without the express *| |* written permission of VeriSilicon. *| |* *|
  2. \******************************************************************************/
  3. #include <ebase/types.h>
  4. #include <ebase/trace.h>
  5. #include <ebase/builtins.h>
  6. #include <common/return_codes.h>
  7. #include <common/misc.h>
  8. #include <sys/ioctl.h>
  9. #include <fcntl.h>
  10. #include <isi/isi.h>
  11. #include <isi/isi_iss.h>
  12. #include <isi/isi_priv.h>
  13. #include <vvsensor.h>
  14. #include "GC5035_priv.h"
  15. #include "gc5035.h"
  16. CREATE_TRACER( GC5035_INFO , "GC5035: ", INFO, 0);
  17. CREATE_TRACER( GC5035_WARN , "GC5035: ", WARNING, 0);
  18. CREATE_TRACER( GC5035_ERROR, "GC5035: ", ERROR, 0);
  19. CREATE_TRACER( GC5035_DEBUG, "GC5035: ", INFO, 0);
  20. CREATE_TRACER( GC5035_REG_INFO , "GC5035: ", INFO, 0);
  21. CREATE_TRACER( GC5035_REG_DEBUG, "GC5035: ", INFO, 0);
  22. #ifdef SUBDEV_V4L2
  23. #include <sys/ioctl.h>
  24. #include <sys/mman.h>
  25. #include <fcntl.h>
  26. #include <linux/videodev2.h>
  27. #include <linux/v4l2-subdev.h>
  28. #undef TRACE
  29. #define TRACE(x, ...)
  30. #endif
  31. #define GC5035_MIN_GAIN_STEP ( 1.0f/16.0f ) /**< min gain step size used by GUI (hardware min = 1/16; 1/16..32/16 depending on actual gain ) */
  32. #define GC5035_MAX_GAIN_AEC ( 32.0f ) /**< max. gain used by the AEC (arbitrarily chosen, hardware limit = 62.0, driver limit = 32.0 ) */
  33. #define GC5035_VS_MAX_INTEGRATION_TIME (0.0018)
  34. /*****************************************************************************
  35. *Sensor Info
  36. *****************************************************************************/
  37. static const char SensorName[16] = "GC5035";
  38. static struct vvcam_mode_info pgc5035_mode_info[] = {
  39. {
  40. .index = 0,
  41. .width = 640,
  42. .height = 480,
  43. .fps = 30,
  44. .hdr_mode = SENSOR_MODE_LINEAR, // SENSOR_MODE_LINEAR
  45. .bit_width = 10,
  46. .bayer_pattern = BAYER_GRBG,
  47. .mipi_phy_freq = 438, //mbps
  48. .mipi_line_num = 2,
  49. .config_file_3a = "GC5035_640x480_raw10", //3aconfig_GC5035_640x480_raw10.json
  50. .preg_data = (void *)"gc5035 sensor liner mode 640*480@30",
  51. },
  52. {
  53. .index = 1,
  54. .width = 1920,
  55. .height = 1080,
  56. .fps = 30,
  57. .hdr_mode = SENSOR_MODE_LINEAR,
  58. .bit_width = 10,
  59. .bayer_pattern = BAYER_RGGB,
  60. .mipi_phy_freq = 876, //mbps
  61. .mipi_line_num = 2,
  62. .config_file_3a = "GC5035_1920x1080_raw10", //3aconfig_GC5035_1920x1080_raw10.json
  63. .preg_data = (void *)"gc5035 sensor liner mode 1920*1080@30",
  64. },
  65. {
  66. .index = 2,
  67. .width = 2592,
  68. .height = 1944,
  69. .fps = 30,
  70. .hdr_mode = SENSOR_MODE_LINEAR,
  71. .bit_width = 10,
  72. .bayer_pattern = BAYER_RGGB,
  73. .mipi_phy_freq = 876, //mbps
  74. .mipi_line_num = 2,
  75. .config_file_3a = "GC5035_2592x1944_raw10", //3aconfig_GC5035_2592x1944_raw10.json
  76. .preg_data = (void *)"gc5035 sensor liner mode 2592*1944@30",
  77. },
  78. {
  79. .index = 3,
  80. .width = 1296,
  81. .height = 972,
  82. .fps = 30,
  83. .hdr_mode = SENSOR_MODE_LINEAR,
  84. .bit_width = 10,
  85. .bayer_pattern = BAYER_RGGB,
  86. .mipi_phy_freq = 438,
  87. .mipi_line_num = 2,
  88. .config_file_3a = "GC5035_1296x972_raw10", //3aconfig_GC5035_1296x972_raw10.json
  89. .preg_data = (void *)"gc5035 sensor liner mode 1296*972@30",
  90. },
  91. {
  92. .index = 4,
  93. .width = 1280,
  94. .height = 720,
  95. .fps = 30,
  96. .hdr_mode = SENSOR_MODE_LINEAR,
  97. .bit_width = 10,
  98. .bayer_pattern = BAYER_RGGB,
  99. .mipi_phy_freq = 438, //COULD BE WRONG
  100. .mipi_line_num = 2,
  101. .config_file_3a = "GC5035_1280x720_raw10", //3aconfig_GC5035_1280x720_raw10.json
  102. .preg_data = (void *)"gc5035 sensor liner mode 1280*720@30",
  103. },
  104. #if 0
  105. {
  106. .index = 5,
  107. .width = 1280,
  108. .height = 720,
  109. .fps = 60,
  110. .hdr_mode = SENSOR_MODE_LINEAR,
  111. .bit_width = 10,
  112. .bayer_pattern = BAYER_RGGB,
  113. .mipi_phy_freq = 438, //COULD BE WRONG
  114. .mipi_line_num = 2,
  115. .config_file_3a = "GC5035_1280x720_raw10", //3aconfig_GC5035_1280x720_raw10.json
  116. .preg_data = (void *)"gc5035 sensor liner mode 1280*720@60",
  117. }
  118. #endif
  119. };
  120. static RESULT GC5035_IsiRegisterWriteIss(IsiSensorHandle_t handle, const uint32_t address, const uint32_t value);
  121. static RESULT GC5035_IsiSensorSetPowerIss(IsiSensorHandle_t handle, bool_t on) {
  122. RESULT result = RET_SUCCESS;
  123. int ret = 0;
  124. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  125. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  126. return RET_NULL_POINTER;
  127. }
  128. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  129. TRACE(GC5035_INFO, "%s (enter)\n", __func__);
  130. int32_t enable = on;
  131. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_POWER, &enable);
  132. if (ret != 0) {
  133. // to do
  134. //TRACE(GC5035_ERROR, "%s: sensor set power error!\n", __func__);
  135. //return (RET_FAILURE);
  136. }
  137. TRACE(GC5035_INFO, "%s (exit)\n", __func__);
  138. return (result);
  139. }
  140. static RESULT GC5035_IsiResetSensorIss(IsiSensorHandle_t handle) {
  141. RESULT result = RET_SUCCESS;
  142. int ret = 0;
  143. TRACE(GC5035_INFO, "%s (enter)\n", __func__);
  144. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  145. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  146. return RET_NULL_POINTER;
  147. }
  148. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  149. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_RESET, NULL);
  150. if (ret != 0) {
  151. TRACE(GC5035_ERROR, "%s: sensor reset error!\n", __func__);
  152. return (RET_FAILURE);
  153. }
  154. TRACE(GC5035_INFO, "%s (exit)\n", __func__);
  155. return (result);
  156. }
  157. #ifdef SUBDEV_CHAR
  158. static RESULT GC5035_IsiSensorSetClkIss(IsiSensorHandle_t handle, uint32_t clk) {
  159. RESULT result = RET_SUCCESS;
  160. int32_t ret = 0;
  161. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  162. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  163. return RET_NULL_POINTER;
  164. }
  165. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  166. TRACE(GC5035_INFO, "%s (enter)\n", __func__);
  167. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_CLK, &clk);
  168. if (ret != 0) {
  169. // to do
  170. //TRACE(GC5035_ERROR, "%s: sensor set clk error!\n", __func__);
  171. //return (RET_FAILURE);
  172. }
  173. TRACE(GC5035_INFO, "%s (exit)\n", __func__);
  174. return (result);
  175. }
  176. static RESULT GC5035_IsiSensorGetClkIss
  177. (IsiSensorHandle_t handle, uint32_t * pclk) {
  178. RESULT result = RET_SUCCESS;
  179. int ret = 0;
  180. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  181. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  182. return RET_NULL_POINTER;
  183. }
  184. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  185. TRACE(GC5035_INFO, "%s (enter)\n", __func__);
  186. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_CLK, pclk);
  187. if (ret != 0) {
  188. // to do
  189. //TRACE(GC5035_ERROR, "%s: sensor get clk error!\n", __func__);
  190. //return (RET_FAILURE);
  191. }
  192. TRACE(GC5035_INFO, "%s (exit)\n", __func__);
  193. return (result);
  194. }
  195. static RESULT GC5035_IsiConfigSensorSCCBIss(IsiSensorHandle_t handle)
  196. {
  197. return RET_SUCCESS;
  198. }
  199. #endif
  200. static RESULT GC5035_IsiRegisterReadIss
  201. (IsiSensorHandle_t handle, const uint32_t address, uint32_t * p_value) {
  202. RESULT result = RET_SUCCESS;
  203. int32_t ret = 0;
  204. TRACE(GC5035_INFO, "%s (enter)\n", __func__);
  205. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  206. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  207. return RET_NULL_POINTER;
  208. }
  209. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  210. struct vvcam_sccb_data sccb_data;
  211. sccb_data.addr = address;
  212. sccb_data.data = 0;
  213. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_READ_REG, &sccb_data);
  214. if (ret != 0) {
  215. TRACE(GC5035_ERROR, "%s: read sensor register error!\n",
  216. __func__);
  217. return (RET_FAILURE);
  218. }
  219. *p_value = sccb_data.data;
  220. TRACE(GC5035_INFO, "%s (exit) result = %d\n", __func__, result);
  221. return (result);
  222. }
  223. static RESULT GC5035_IsiRegisterWriteIss
  224. (IsiSensorHandle_t handle, const uint32_t address, const uint32_t value) {
  225. RESULT result = RET_SUCCESS;
  226. int ret = 0;
  227. TRACE(GC5035_INFO, "%s (enter)\n", __func__);
  228. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  229. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  230. return RET_NULL_POINTER;
  231. }
  232. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  233. struct vvcam_sccb_data sccb_data;
  234. sccb_data.addr = address;
  235. sccb_data.data = value;
  236. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_WRITE_REG, &sccb_data);
  237. if (ret != 0) {
  238. TRACE(GC5035_ERROR, "%s: write sensor register error!\n",
  239. __func__);
  240. return (RET_FAILURE);
  241. }
  242. TRACE(GC5035_INFO, "%s (exit) result = %d\n", __func__, result);
  243. return (result);
  244. }
  245. static RESULT GC5035_IsiQuerySensorSupportIss(HalHandle_t HalHandle, vvcam_mode_info_array_t *pSensorSupportInfo)
  246. {
  247. TRACE(GC5035_DEBUG, "enter %s", __func__);
  248. //int ret = 0;
  249. struct vvcam_mode_info_array *psensor_mode_info_arry;
  250. HalContext_t *pHalCtx = HalHandle;
  251. if ( pHalCtx == NULL ) {
  252. return RET_NULL_POINTER;
  253. }
  254. psensor_mode_info_arry = pSensorSupportInfo;
  255. #if 0
  256. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_QUERY, psensor_mode_info_arry);
  257. if (ret != 0) {
  258. TRACE(GC5035_ERROR, "%s: sensor kernel query error! Use isi query\n",__func__);
  259. psensor_mode_info_arry->count = sizeof(pgc5035_mode_info) / sizeof(struct vvcam_mode_info);
  260. memcpy(psensor_mode_info_arry->modes, pgc5035_mode_info, sizeof(pgc5035_mode_info));
  261. }
  262. #endif
  263. psensor_mode_info_arry->count = sizeof(pgc5035_mode_info) / sizeof(struct vvcam_mode_info);
  264. memcpy(psensor_mode_info_arry->modes, pgc5035_mode_info, sizeof(pgc5035_mode_info));
  265. TRACE(GC5035_DEBUG, "%s-%s-%d: cnt=%d\n", __FILE__, __func__, __LINE__, psensor_mode_info_arry->count);
  266. return RET_SUCCESS;
  267. }
  268. static RESULT GC5035_IsiQuerySensorIss(IsiSensorHandle_t handle, vvcam_mode_info_array_t *pSensorInfo)
  269. {
  270. RESULT result = RET_SUCCESS;
  271. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  272. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  273. return RET_NULL_POINTER;
  274. }
  275. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  276. GC5035_IsiQuerySensorSupportIss(pHalCtx,pSensorInfo);
  277. return result;
  278. }
  279. static RESULT GC5035_IsiGetSensorModeIss(IsiSensorHandle_t handle,void *mode)
  280. {
  281. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  282. if (pGC5035Ctx == NULL) {
  283. return (RET_WRONG_HANDLE);
  284. }
  285. memcpy(mode,&(pGC5035Ctx->SensorMode), sizeof(pGC5035Ctx->SensorMode));
  286. return ( RET_SUCCESS );
  287. }
  288. static RESULT GC5035_IsiCreateSensorIss(IsiSensorInstanceConfig_t * pConfig) {
  289. RESULT result = RET_SUCCESS;
  290. GC5035_Context_t *pGC5035Ctx;
  291. TRACE(GC5035_INFO, "%s (enter)\n", __func__);
  292. if (!pConfig || !pConfig->pSensor)
  293. return (RET_NULL_POINTER);
  294. pGC5035Ctx = (GC5035_Context_t *) malloc(sizeof(GC5035_Context_t));
  295. if (!pGC5035Ctx) {
  296. TRACE(GC5035_ERROR, "%s: Can't allocate gc5035 context\n",
  297. __func__);
  298. return (RET_OUTOFMEM);
  299. }
  300. MEMSET(pGC5035Ctx, 0, sizeof(GC5035_Context_t));
  301. result = HalAddRef(pConfig->HalHandle);
  302. if (result != RET_SUCCESS) {
  303. free(pGC5035Ctx);
  304. return (result);
  305. }
  306. pGC5035Ctx->IsiCtx.HalHandle = pConfig->HalHandle;
  307. pGC5035Ctx->IsiCtx.pSensor = pConfig->pSensor;
  308. pGC5035Ctx->GroupHold = BOOL_FALSE;
  309. pGC5035Ctx->OldGain = 0;
  310. pGC5035Ctx->OldIntegrationTime = 0;
  311. pGC5035Ctx->Configured = BOOL_FALSE;
  312. pGC5035Ctx->Streaming = BOOL_FALSE;
  313. pGC5035Ctx->TestPattern = BOOL_FALSE;
  314. pGC5035Ctx->isAfpsRun = BOOL_FALSE;
  315. pGC5035Ctx->SensorMode.index = pConfig->SensorModeIndex;
  316. pConfig->hSensor = (IsiSensorHandle_t) pGC5035Ctx;
  317. #ifdef SUBDEV_CHAR
  318. struct vvcam_mode_info *SensorDefaultMode = NULL;
  319. for (int i=0; i < sizeof(pgc5035_mode_info)/ sizeof(struct vvcam_mode_info); i++)
  320. {
  321. if (pgc5035_mode_info[i].index == pGC5035Ctx->SensorMode.index)
  322. {
  323. SensorDefaultMode = &(pgc5035_mode_info[i]);
  324. break;
  325. }
  326. }
  327. if (SensorDefaultMode != NULL)
  328. {
  329. strcpy(pGC5035Ctx->SensorRegCfgFile, get_vi_config_path());
  330. switch(SensorDefaultMode->index)
  331. {
  332. case 0:
  333. strcat(pGC5035Ctx->SensorRegCfgFile,
  334. "GC5035_mipi2lane_640x480@30_gc.txt");
  335. break;
  336. case 1:
  337. strcat(pGC5035Ctx->SensorRegCfgFile,
  338. "GC5035_mipi2lane_1920x1080@30_gc.txt");
  339. break;
  340. case 2:
  341. strcat(pGC5035Ctx->SensorRegCfgFile,
  342. "GC5035_mipi2lane_2592x1944@30_gc.txt");
  343. break;
  344. case 3:
  345. strcat(pGC5035Ctx->SensorRegCfgFile,
  346. "GC5035_mipi2lane_1296x972@30_mayi.txt");
  347. break;
  348. case 4: //720p@30fps
  349. strcat(pGC5035Ctx->SensorRegCfgFile,
  350. "GC5035_mipi2lane_1280x720@30_gc.txt");
  351. break;
  352. case 5: //720p@60fps
  353. strcat(pGC5035Ctx->SensorRegCfgFile,
  354. "GC5035_mipi2lane_1280x720@60_mayi.txt");
  355. break;
  356. default:
  357. break;
  358. }
  359. if (access(pGC5035Ctx->SensorRegCfgFile, F_OK) == 0) {
  360. pGC5035Ctx->KernelDriverFlag = 0;
  361. memcpy(&(pGC5035Ctx->SensorMode),SensorDefaultMode,sizeof(struct vvcam_mode_info));
  362. } else {
  363. pGC5035Ctx->KernelDriverFlag = 1;
  364. }
  365. }else
  366. {
  367. pGC5035Ctx->KernelDriverFlag = 1;
  368. }
  369. result = GC5035_IsiSensorSetPowerIss(pGC5035Ctx, BOOL_TRUE);
  370. RETURN_RESULT_IF_DIFFERENT(RET_SUCCESS, result);
  371. uint32_t SensorClkIn = 0;
  372. if (pGC5035Ctx->KernelDriverFlag) {
  373. result = GC5035_IsiSensorGetClkIss(pGC5035Ctx, &SensorClkIn);
  374. RETURN_RESULT_IF_DIFFERENT(RET_SUCCESS, result);
  375. }
  376. result = GC5035_IsiSensorSetClkIss(pGC5035Ctx, SensorClkIn);
  377. RETURN_RESULT_IF_DIFFERENT(RET_SUCCESS, result);
  378. result = GC5035_IsiResetSensorIss(pGC5035Ctx);
  379. RETURN_RESULT_IF_DIFFERENT(RET_SUCCESS, result);
  380. pGC5035Ctx->pattern = ISI_BPAT_BGBGGRGR;
  381. if (!pGC5035Ctx->KernelDriverFlag) {
  382. result = GC5035_IsiConfigSensorSCCBIss(pGC5035Ctx);
  383. RETURN_RESULT_IF_DIFFERENT(RET_SUCCESS, result);
  384. }
  385. #endif
  386. TRACE(GC5035_INFO, "%s (exit pConfig->hSensor = %p)\n", __func__, pConfig->hSensor);
  387. return (result);
  388. }
  389. static RESULT GC5035_IsiGetRegCfgIss(const char *registerFileName,
  390. struct vvcam_sccb_array *arry)
  391. {
  392. if (NULL == registerFileName) {
  393. TRACE(GC5035_ERROR, "%s:registerFileName is NULL\n", __func__);
  394. return (RET_NULL_POINTER);
  395. }
  396. #ifdef SUBDEV_CHAR
  397. FILE *fp = NULL;
  398. fp = fopen(registerFileName, "rb");
  399. if (!fp) {
  400. TRACE(GC5035_ERROR, "%s:load register file %s error!\n",
  401. __func__, registerFileName);
  402. return (RET_FAILURE);
  403. }
  404. char LineBuf[512];
  405. uint32_t FileTotalLine = 0;
  406. while (!feof(fp)) {
  407. fgets(LineBuf, 512, fp);
  408. FileTotalLine++;
  409. }
  410. arry->sccb_data =
  411. malloc(FileTotalLine * sizeof(struct vvcam_sccb_data));
  412. if (arry->sccb_data == NULL) {
  413. TRACE(GC5035_ERROR, "%s:malloc failed NULL Point!\n", __func__,
  414. registerFileName);
  415. return (RET_FAILURE);
  416. }
  417. rewind(fp);
  418. arry->count = 0;
  419. while (!feof(fp)) {
  420. memset(LineBuf, 0, sizeof(LineBuf));
  421. fgets(LineBuf, 512, fp);
  422. int result =
  423. sscanf(LineBuf, "0x%x 0x%x",
  424. &(arry->sccb_data[arry->count].addr),
  425. &(arry->sccb_data[arry->count].data));
  426. if (result != 2)
  427. continue;
  428. arry->count++;
  429. }
  430. #endif
  431. return 0;
  432. }
  433. static RESULT GC5035_IsiInitSensorIss(IsiSensorHandle_t handle) {
  434. RESULT result = RET_SUCCESS;
  435. int ret = 0;
  436. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  437. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  438. TRACE(GC5035_INFO, "%s (enter handle = %p)\n", __func__, handle);
  439. if (pGC5035Ctx == NULL) {
  440. return (RET_WRONG_HANDLE);
  441. }
  442. TRACE(GC5035_INFO, "%s (pGC5035Ctx->KernelDriverFlag = %d)\n", __func__, pGC5035Ctx->KernelDriverFlag);
  443. if (pGC5035Ctx->KernelDriverFlag) {
  444. ;
  445. } else {
  446. TRACE(GC5035_INFO, "%s (001)\n", __func__);
  447. struct vvcam_sccb_array arry;
  448. result = GC5035_IsiGetRegCfgIss(pGC5035Ctx->SensorRegCfgFile, &arry);
  449. if (result != 0) {
  450. TRACE(GC5035_ERROR,
  451. "%s:GC5035_IsiGetRegCfgIss error!\n", __func__);
  452. return (RET_FAILURE);
  453. }
  454. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_WRITE_ARRAY, &arry);
  455. if (ret != 0) {
  456. TRACE(GC5035_ERROR, "%s:Sensor Write Reg arry error!\n",
  457. __func__);
  458. return (RET_FAILURE);
  459. }
  460. TRACE(GC5035_INFO, "%s (pGC5035Ctx->SensorMode.index = %d)\n", __func__, pGC5035Ctx->SensorMode.index);
  461. switch(pGC5035Ctx->SensorMode.index)
  462. {
  463. case 0: // 480p
  464. pGC5035Ctx->one_line_exp_time = 0.0000167; // line_time = line_length / pclk =1460/87.6mhz = 0.0000167
  465. pGC5035Ctx->FrameLengthLines = 0x7cc; //framelength=1996=0x7cc
  466. pGC5035Ctx->CurFrameLengthLines = pGC5035Ctx->FrameLengthLines;
  467. pGC5035Ctx->MaxIntegrationLine = pGC5035Ctx->CurFrameLengthLines - 8;
  468. pGC5035Ctx->MinIntegrationLine = 1;
  469. pGC5035Ctx->AecMaxGain = 16;
  470. pGC5035Ctx->AecMinGain = 1;
  471. break;
  472. case 1: // 1080p
  473. pGC5035Ctx->one_line_exp_time = 0.0000167; // line_time = line_length / pclk =2920/175.2mhz = 0.00001667
  474. pGC5035Ctx->FrameLengthLines = 0x7D8; //framelength=2008=0x7D8
  475. pGC5035Ctx->CurFrameLengthLines = pGC5035Ctx->FrameLengthLines;
  476. pGC5035Ctx->MaxIntegrationLine = pGC5035Ctx->CurFrameLengthLines - 8;
  477. pGC5035Ctx->MinIntegrationLine = 1;
  478. pGC5035Ctx->AecMaxGain = 16;
  479. pGC5035Ctx->AecMinGain = 1;
  480. break;
  481. case 2: // full size
  482. pGC5035Ctx->one_line_exp_time = 0.0000167; // line_time = line_length / pclk =2920/175.2mhz = 0.00001667
  483. pGC5035Ctx->FrameLengthLines = 0x7D8; //framelength=2008=0x7D8
  484. pGC5035Ctx->CurFrameLengthLines = pGC5035Ctx->FrameLengthLines;
  485. pGC5035Ctx->MaxIntegrationLine = pGC5035Ctx->CurFrameLengthLines - 8;
  486. pGC5035Ctx->MinIntegrationLine = 1;
  487. pGC5035Ctx->AecMaxGain = 16;
  488. pGC5035Ctx->AecMinGain = 1;
  489. break;
  490. case 3: // 1296x972
  491. pGC5035Ctx->one_line_exp_time = 0.0000167; // line_time = line_length / pclk =2920/175.2mhz = 0.00001667
  492. pGC5035Ctx->FrameLengthLines = 0x7D8; //framelength=2008=0x7D8
  493. pGC5035Ctx->CurFrameLengthLines = pGC5035Ctx->FrameLengthLines;
  494. pGC5035Ctx->MaxIntegrationLine = pGC5035Ctx->CurFrameLengthLines - 8;
  495. pGC5035Ctx->MinIntegrationLine = 1;
  496. pGC5035Ctx->AecMaxGain = 16;
  497. pGC5035Ctx->AecMinGain = 1;
  498. break;
  499. case 4: // 720p@30fps
  500. case 5: // 720p@60fps
  501. pGC5035Ctx->one_line_exp_time = 0.0000167; // line_time = line_length / pclk =2920/175.2mhz = 0.00001667
  502. pGC5035Ctx->FrameLengthLines = 0x7D8; //framelength=2008=0x7D8
  503. pGC5035Ctx->CurFrameLengthLines = pGC5035Ctx->FrameLengthLines;
  504. pGC5035Ctx->MaxIntegrationLine = pGC5035Ctx->CurFrameLengthLines - 8;
  505. pGC5035Ctx->MinIntegrationLine = 1;
  506. pGC5035Ctx->AecMaxGain = 16;
  507. pGC5035Ctx->AecMinGain = 1;
  508. break;
  509. default:
  510. return (RET_FAILURE);
  511. }
  512. pGC5035Ctx->AecIntegrationTimeIncrement = pGC5035Ctx->one_line_exp_time;
  513. pGC5035Ctx->AecMinIntegrationTime =
  514. pGC5035Ctx->one_line_exp_time * pGC5035Ctx->MinIntegrationLine;
  515. pGC5035Ctx->AecMaxIntegrationTime =
  516. pGC5035Ctx->one_line_exp_time * pGC5035Ctx->MaxIntegrationLine;
  517. pGC5035Ctx->MaxFps = pGC5035Ctx->SensorMode.fps;
  518. pGC5035Ctx->MinFps = 1;
  519. pGC5035Ctx->CurrFps = pGC5035Ctx->MaxFps;
  520. }
  521. TRACE(GC5035_INFO, "%s (pGC5035Ctx->one_line_exp_time = %f)\n", __func__, pGC5035Ctx->one_line_exp_time);
  522. TRACE(GC5035_INFO, "%s (pGC5035Ctx->MinIntegrationLine = %d, pGC5035Ctx->MaxIntegrationLine = %d)\n", __func__, pGC5035Ctx->MinIntegrationLine, pGC5035Ctx->MaxIntegrationLine);
  523. return (result);
  524. }
  525. static RESULT GC5035_IsiReleaseSensorIss(IsiSensorHandle_t handle) {
  526. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  527. RESULT result = RET_SUCCESS;
  528. TRACE(GC5035_INFO, "%s (enter)\n", __func__);
  529. if (pGC5035Ctx == NULL)
  530. return (RET_WRONG_HANDLE);
  531. (void)GC5035_IsiSensorSetStreamingIss(pGC5035Ctx, BOOL_FALSE);
  532. (void)GC5035_IsiSensorSetPowerIss(pGC5035Ctx, BOOL_FALSE);
  533. (void)HalDelRef(pGC5035Ctx->IsiCtx.HalHandle);
  534. MEMSET(pGC5035Ctx, 0, sizeof(GC5035_Context_t));
  535. free(pGC5035Ctx);
  536. TRACE(GC5035_INFO, "%s (exit)\n", __func__);
  537. return (result);
  538. }
  539. struct gc5035_fmt {
  540. int width;
  541. int height;
  542. int fps;
  543. };
  544. static RESULT GC5035_IsiSetupSensorIss
  545. (IsiSensorHandle_t handle, const IsiSensorConfig_t * pConfig) {
  546. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  547. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  548. RESULT result = RET_SUCCESS;
  549. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  550. if (!pGC5035Ctx) {
  551. TRACE(GC5035_ERROR,
  552. "%s: Invalid sensor handle (NULL pointer detected)\n",
  553. __func__);
  554. return (RET_WRONG_HANDLE);
  555. }
  556. if (!pConfig) {
  557. TRACE(GC5035_ERROR,
  558. "%s: Invalid configuration (NULL pointer detected)\n",
  559. __func__);
  560. return (RET_NULL_POINTER);
  561. }
  562. if (pGC5035Ctx->Streaming != BOOL_FALSE) {
  563. return RET_WRONG_STATE;
  564. }
  565. memcpy(&pGC5035Ctx->Config, pConfig, sizeof(IsiSensorConfig_t));
  566. /* 1.) SW reset of image sensor (via I2C register interface) be careful, bits 6..0 are reserved, reset bit is not sticky */
  567. TRACE(GC5035_DEBUG, "%s: GC5035 System-Reset executed\n", __func__);
  568. osSleep(100);
  569. //GC5035_AecSetModeParameters not defined yet as of 2021/8/9.
  570. //result = GC5035_AecSetModeParameters(pGC5035Ctx, pConfig);
  571. //if (result != RET_SUCCESS) {
  572. // TRACE(GC5035_ERROR, "%s: SetupOutputWindow failed.\n",
  573. // __func__);
  574. // return (result);
  575. //}
  576. #if 1
  577. struct gc5035_fmt fmt;
  578. fmt.width = pConfig->Resolution.width;
  579. fmt.height = pConfig->Resolution.height;
  580. ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_FPS, &fmt);//result = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_FPS, &fmt);
  581. #endif
  582. pGC5035Ctx->Configured = BOOL_TRUE;
  583. TRACE(GC5035_INFO, "%s: (exit) ret=0x%x \n", __func__, result);
  584. return result;
  585. }
  586. static RESULT GC5035_IsiChangeSensorResolutionIss(IsiSensorHandle_t handle, uint16_t width, uint16_t height) {
  587. RESULT result = RET_SUCCESS;
  588. #if 0
  589. struct gc5035_fmt fmt;
  590. fmt.width = width;
  591. fmt.height = height;
  592. int ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_FPS, &fmt);
  593. #endif
  594. TRACE(GC5035_INFO, "%s (exit)\n", __func__);
  595. return (result);
  596. }
  597. static RESULT GC5035_IsiSensorSetStreamingIss
  598. (IsiSensorHandle_t handle, bool_t on) {
  599. RESULT result = RET_SUCCESS;
  600. int ret = 0;
  601. TRACE(GC5035_INFO, "%s (enter)\n", __func__);
  602. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  603. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  604. return RET_NULL_POINTER;
  605. }
  606. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  607. if (pGC5035Ctx->Configured != BOOL_TRUE)
  608. return RET_WRONG_STATE;
  609. int32_t enable = (uint32_t) on;
  610. ret = GC5035_IsiRegisterWriteIss(handle, 0xfe, 0x00);
  611. if (ret != 0) {
  612. return (RET_FAILURE);
  613. }
  614. if (on == true) {
  615. ret = GC5035_IsiRegisterWriteIss(handle, 0x3e, 0x91);
  616. } else {
  617. ret = GC5035_IsiRegisterWriteIss(handle, 0x3e, 0x01);
  618. }
  619. if (ret != 0) {
  620. return (RET_FAILURE);
  621. }
  622. pGC5035Ctx->Streaming = on;
  623. TRACE(GC5035_INFO, "%s (exit)\n", __func__);
  624. return (result);
  625. }
  626. static int32_t sensor_get_chip_id(IsiSensorHandle_t handle, uint32_t *chip_id)
  627. {
  628. RESULT result = RET_SUCCESS;
  629. int32_t ret = 0;
  630. int32_t chip_id_high = 0;
  631. int32_t chip_id_low = 0;
  632. ret = GC5035_IsiRegisterReadIss(handle, 0xf0, &chip_id_high);
  633. if (ret != 0) {
  634. TRACE(GC5035_ERROR,
  635. "%s: Read Sensor correct ID Error! \n", __func__);
  636. return (RET_FAILURE);
  637. }
  638. ret = GC5035_IsiRegisterReadIss(handle, 0xf1, &chip_id_low);
  639. if (ret != 0) {
  640. TRACE(GC5035_ERROR,
  641. "%s: Read Sensor correct ID Error! \n", __func__);
  642. return (RET_FAILURE);
  643. }
  644. *chip_id = ((chip_id_high & 0xff)<<8) | (chip_id_low & 0xff);
  645. return 0;
  646. }
  647. static RESULT GC5035_IsiCheckSensorConnectionIss(IsiSensorHandle_t handle) {
  648. RESULT result = RET_SUCCESS;
  649. int ret = 0;
  650. uint32_t correct_id = 0x5035;
  651. uint32_t sensor_id = 0;
  652. TRACE(GC5035_INFO, "%s (enter)\n", __func__);
  653. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  654. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  655. return RET_NULL_POINTER;
  656. }
  657. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  658. ret = sensor_get_chip_id(handle, &sensor_id);
  659. if (ret != 0) {
  660. TRACE(GC5035_ERROR,
  661. "%s: Read Sensor chip ID Error! \n", __func__);
  662. return (RET_FAILURE);
  663. }
  664. if (correct_id != sensor_id) {
  665. TRACE(GC5035_ERROR, "%s:ChipID =0x%x sensor_id=%x error! \n",
  666. __func__, correct_id, sensor_id);
  667. return (RET_FAILURE);
  668. }
  669. TRACE(GC5035_INFO,
  670. "%s ChipID = 0x%08x, sensor_id = 0x%08x, success! \n", __func__,
  671. correct_id, sensor_id);
  672. TRACE(GC5035_INFO, "%s (exit)\n", __func__);
  673. return (result);
  674. }
  675. static RESULT GC5035_IsiGetSensorRevisionIss
  676. (IsiSensorHandle_t handle, uint32_t * p_value) {
  677. RESULT result = RET_SUCCESS;
  678. TRACE(GC5035_INFO, "%s (enter)\n", __func__);
  679. *p_value = 0X5690;
  680. TRACE(GC5035_INFO, "%s (exit)\n", __func__);
  681. return (result);
  682. }
  683. static RESULT GC5035_IsiGetGainLimitsIss
  684. (IsiSensorHandle_t handle, float *pMinGain, float *pMaxGain) {
  685. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  686. RESULT result = RET_SUCCESS;
  687. /*TODO*/
  688. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  689. if (pGC5035Ctx == NULL) {
  690. TRACE(GC5035_ERROR,
  691. "%s: Invalid sensor handle (NULL pointer detected)\n",
  692. __func__);
  693. return (RET_WRONG_HANDLE);
  694. }
  695. if ((pMinGain == NULL) || (pMaxGain == NULL)) {
  696. TRACE(GC5035_ERROR, "%s: NULL pointer received!!\n");
  697. return (RET_NULL_POINTER);
  698. }
  699. *pMinGain = pGC5035Ctx->AecMinGain;
  700. *pMaxGain = pGC5035Ctx->AecMaxGain;
  701. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  702. return (result);
  703. }
  704. static RESULT GC5035_IsiGetIntegrationTimeLimitsIss
  705. (IsiSensorHandle_t handle,
  706. float *pMinIntegrationTime, float *pMaxIntegrationTime) {
  707. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  708. RESULT result = RET_SUCCESS;
  709. /*TODO*/
  710. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  711. if (pGC5035Ctx == NULL) {
  712. TRACE(GC5035_ERROR,
  713. "%s: Invalid sensor handle (NULL pointer detected)\n",
  714. __func__);
  715. return (RET_WRONG_HANDLE);
  716. }
  717. if ((pMinIntegrationTime == NULL) || (pMaxIntegrationTime == NULL)) {
  718. TRACE(GC5035_ERROR, "%s: NULL pointer received!!\n");
  719. return (RET_NULL_POINTER);
  720. }
  721. *pMinIntegrationTime = pGC5035Ctx->AecMinIntegrationTime;
  722. *pMaxIntegrationTime = pGC5035Ctx->AecMaxIntegrationTime;
  723. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  724. return (result);
  725. }
  726. RESULT GC5035_IsiGetGainIss(IsiSensorHandle_t handle, float *pSetGain) {
  727. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  728. RESULT result = RET_SUCCESS;
  729. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  730. if (pGC5035Ctx == NULL) {
  731. TRACE(GC5035_ERROR,
  732. "%s: Invalid sensor handle (NULL pointer detected)\n",
  733. __func__);
  734. return (RET_WRONG_HANDLE);
  735. }
  736. if (pSetGain == NULL) {
  737. return (RET_NULL_POINTER);
  738. }
  739. *pSetGain = pGC5035Ctx->AecCurGain;
  740. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  741. return (result);
  742. }
  743. RESULT GC5035_IsiGetLongGainIss(IsiSensorHandle_t handle, float *gain)
  744. {
  745. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  746. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  747. if (pGC5035Ctx == NULL) {
  748. TRACE(GC5035_ERROR,"%s: Invalid sensor handle (NULL pointer detected)\n",__func__);
  749. return (RET_WRONG_HANDLE);
  750. }
  751. if (gain == NULL) {
  752. return (RET_NULL_POINTER);
  753. }
  754. *gain = pGC5035Ctx->AecCurLongGain;
  755. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  756. return (RET_SUCCESS);
  757. }
  758. RESULT GC5035_IsiGetVSGainIss(IsiSensorHandle_t handle, float *pSetGain) {
  759. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  760. RESULT result = RET_SUCCESS;
  761. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  762. if (pGC5035Ctx == NULL) {
  763. TRACE(GC5035_ERROR,
  764. "%s: Invalid sensor handle (NULL pointer detected)\n",
  765. __func__);
  766. return (RET_WRONG_HANDLE);
  767. }
  768. if (pSetGain == NULL) {
  769. return (RET_NULL_POINTER);
  770. }
  771. *pSetGain = pGC5035Ctx->AecCurVSGain;
  772. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  773. return (result);
  774. }
  775. RESULT GC5035_IsiGetGainIncrementIss(IsiSensorHandle_t handle, float *pIncr) {
  776. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  777. RESULT result = RET_SUCCESS;
  778. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  779. if (pGC5035Ctx == NULL) {
  780. TRACE(GC5035_ERROR,
  781. "%s: Invalid sensor handle (NULL pointer detected)\n",
  782. __func__);
  783. return (RET_WRONG_HANDLE);
  784. }
  785. if (pIncr == NULL)
  786. return (RET_NULL_POINTER);
  787. *pIncr = pGC5035Ctx->AecGainIncrement;
  788. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  789. return (result);
  790. }
  791. uint16_t GC5035_AGC_Param[17][2] = {
  792. { 256, 0 },
  793. { 302, 1 },
  794. { 358, 2 },
  795. { 425, 3 },
  796. { 502, 8 },
  797. { 599, 9 },
  798. { 717, 10 },
  799. { 845, 11 },
  800. { 998, 12 },
  801. { 1203, 13 },
  802. { 1434, 14 },
  803. { 1710, 15 },
  804. { 1997, 16 },
  805. { 2355, 17 },
  806. { 2816, 18 },
  807. { 3318, 19 },
  808. { 3994, 20 },
  809. };
  810. static uint32_t Dgain_ratio = 256;
  811. RESULT GC5035_IsiSetGainIss
  812. (IsiSensorHandle_t handle,
  813. float NewGain, float *pSetGain, float *hdr_ratio) {
  814. RESULT result = RET_SUCCESS;
  815. int32_t ret = 0;
  816. uint32_t temp_gain;
  817. uint16_t gain_index;
  818. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  819. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  820. return RET_NULL_POINTER;
  821. }
  822. if (NewGain >= 16) { // More than 16 will not take effect
  823. NewGain = 16;
  824. }
  825. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  826. //GC5035 specific
  827. uint32_t SensorGain = 0;
  828. SensorGain = NewGain * 256; // pGC5035Ctx->gain_accuracy;
  829. if (SensorGain < 256) { //min gain=1x
  830. SensorGain = 256;
  831. NewGain = 1;
  832. } else if (SensorGain > 16*256) { //max gain=16x
  833. SensorGain = 16*256;
  834. NewGain = 16;
  835. }
  836. for (gain_index = 16; gain_index >= 0; gain_index--) {
  837. if (SensorGain >= GC5035_AGC_Param[gain_index][0])
  838. break;
  839. }
  840. ret = GC5035_IsiRegisterWriteIss(handle, 0xfe, 0x00);
  841. if (ret != 0) {
  842. return (RET_FAILURE);
  843. }
  844. ret = GC5035_IsiRegisterWriteIss(handle, 0xb6, GC5035_AGC_Param[gain_index][1]);
  845. if (ret != 0) {
  846. return (RET_FAILURE);
  847. }
  848. temp_gain = SensorGain*Dgain_ratio / GC5035_AGC_Param[gain_index][0];
  849. ret = GC5035_IsiRegisterWriteIss(handle, 0xb1, (temp_gain >> 8) & 0x0f);
  850. if (ret != 0) {
  851. return (RET_FAILURE);
  852. }
  853. ret = GC5035_IsiRegisterWriteIss(handle, 0xb2, temp_gain & 0xfc);
  854. if (ret != 0) {
  855. return (RET_FAILURE);
  856. }
  857. volatile int32_t reg;
  858. TRACE(GC5035_DEBUG, "%s gain_index=%d,[gain_index][0]=%d,Dgain_ratio=%u\n",__func__, gain_index, GC5035_AGC_Param[gain_index][0], Dgain_ratio);
  859. TRACE(GC5035_DEBUG, "%s temp_gain=0x%x,0xb1 write 0x%x,0xb2 write 0x%x\n",__func__, temp_gain, (temp_gain >> 8) & 0x0f, temp_gain & 0xfc);
  860. GC5035_IsiRegisterReadIss(handle, 0xb6, &reg);
  861. TRACE(GC5035_DEBUG, "%s 0xb6 read 0x0%x\n",__func__, reg);
  862. GC5035_IsiRegisterReadIss(handle, 0xb1, &reg);
  863. TRACE(GC5035_DEBUG, "%s 0xb1 read 0x0%x\n",__func__, reg);
  864. GC5035_IsiRegisterReadIss(handle, 0xb2, &reg);
  865. TRACE(GC5035_DEBUG, "%s 0xb2 read 0x0%x\n",__func__, reg);
  866. pGC5035Ctx->AecCurGain = ((float)(NewGain));
  867. *pSetGain = pGC5035Ctx->AecCurGain;
  868. TRACE(GC5035_DEBUG, "%s: g=%f\n", __func__, *pSetGain);
  869. return (result);
  870. }
  871. RESULT GC5035_IsiSetLongGainIss(IsiSensorHandle_t handle, float gain)
  872. {
  873. int ret = 0;
  874. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  875. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  876. if (!pGC5035Ctx || !pGC5035Ctx->IsiCtx.HalHandle)
  877. {
  878. TRACE(GC5035_ERROR,"%s: Invalid sensor handle (NULL pointer detected)\n",__func__);
  879. return (RET_WRONG_HANDLE);
  880. }
  881. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  882. uint32_t SensorGain = 0;
  883. SensorGain = gain * pGC5035Ctx->gain_accuracy;
  884. if (pGC5035Ctx->LastLongGain != SensorGain)
  885. {
  886. /*TODO*/
  887. #if 0
  888. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_LONG_GAIN, &SensorGain);
  889. if (ret != 0)
  890. {
  891. return (RET_FAILURE);
  892. TRACE(GC5035_ERROR,"%s: set long gain failed\n");
  893. }
  894. #endif
  895. pGC5035Ctx->LastLongGain = SensorGain;
  896. pGC5035Ctx->AecCurLongGain = gain;
  897. }
  898. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  899. return (RET_SUCCESS);
  900. }
  901. RESULT GC5035_IsiSetVSGainIss
  902. (IsiSensorHandle_t handle,
  903. float NewIntegrationTime,
  904. float NewGain, float *pSetGain, float *hdr_ratio) {
  905. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  906. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  907. RESULT result = RET_SUCCESS;
  908. #if 0
  909. float Gain = 0.0f;
  910. uint32_t ucGain = 0U;
  911. uint32_t again = 0U;
  912. #endif
  913. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  914. if (!pGC5035Ctx) {
  915. TRACE(GC5035_ERROR,
  916. "%s: Invalid sensor handle (NULL pointer detected)\n",
  917. __func__);
  918. return (RET_WRONG_HANDLE);
  919. }
  920. if (!pSetGain || !hdr_ratio)
  921. return (RET_NULL_POINTER);
  922. uint32_t SensorGain = 0;
  923. SensorGain = NewGain * pGC5035Ctx->gain_accuracy;
  924. /*TODO*/
  925. //ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_VSGAIN, &SensorGain);
  926. pGC5035Ctx->AecCurVSGain = NewGain;
  927. *pSetGain = pGC5035Ctx->AecCurGain;
  928. TRACE(GC5035_DEBUG, "%s: g=%f\n", __func__, *pSetGain);
  929. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  930. return (result);
  931. }
  932. RESULT GC5035_IsiSetBayerPattern(IsiSensorHandle_t handle, uint8_t pattern)
  933. {
  934. RESULT result = RET_SUCCESS;
  935. #if 0
  936. uint8_t h_shift = 0, v_shift = 0;
  937. uint32_t val_h = 0, val_l = 0;
  938. uint16_t val = 0;
  939. uint8_t Start_p = 0;
  940. bool_t streaming_status;
  941. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  942. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  943. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  944. return RET_NULL_POINTER;
  945. }
  946. // pattern 0:B 1:GB 2:GR 3:R
  947. streaming_status = pGC5035Ctx->Streaming;
  948. result = GC5035_IsiSensorSetStreamingIss(handle, 0);
  949. switch (pattern) {
  950. case BAYER_BGGR:
  951. Start_p = 0;
  952. break;
  953. case BAYER_GBRG:
  954. Start_p = 1;
  955. break;
  956. case BAYER_GRBG:
  957. Start_p = 2;
  958. break;
  959. case BAYER_RGGB:
  960. Start_p = 3;
  961. break;
  962. }
  963. h_shift = Start_p % 2;
  964. v_shift = Start_p / 2;
  965. GC5035_IsiRegisterReadIss(handle, 0x30a0, &val_h);
  966. GC5035_IsiRegisterReadIss(handle, 0x30a1, &val_l);
  967. val = (((val_h << 8) & 0xff00) | (val_l & 0x00ff)) + h_shift;
  968. val_h = (val >> 8) & 0xff;
  969. val_l = val & 0xff;
  970. GC5035_IsiRegisterWriteIss(handle, 0x30a0, (uint8_t)val_h);
  971. GC5035_IsiRegisterWriteIss(handle, 0x30a1, (uint8_t)val_l);
  972. GC5035_IsiRegisterReadIss(handle, 0x30a2, &val_h);
  973. GC5035_IsiRegisterReadIss(handle, 0x30a3, &val_l);
  974. val = (((val_h << 8) & 0xff00) | (val_l & 0x00ff)) + v_shift;
  975. val_h = (val >> 8) & 0xff;
  976. val_l = val & 0xff;
  977. GC5035_IsiRegisterWriteIss(handle, 0x30a2, (uint8_t)val_h);
  978. GC5035_IsiRegisterWriteIss(handle, 0x30a3, (uint8_t)val_l);
  979. GC5035_IsiRegisterReadIss(handle, 0x30a4, &val_h);
  980. GC5035_IsiRegisterReadIss(handle, 0x30a5, &val_l);
  981. val = (((val_h << 8) & 0xff00) | (val_l & 0x00ff)) + h_shift;
  982. val_h = (val >> 8) & 0xff;
  983. val_l = val & 0xff;
  984. GC5035_IsiRegisterWriteIss(handle, 0x30a4, (uint8_t)val_h);
  985. GC5035_IsiRegisterWriteIss(handle, 0x30a5, (uint8_t)val_l);
  986. GC5035_IsiRegisterReadIss(handle, 0x30a6, &val_h);
  987. GC5035_IsiRegisterReadIss(handle, 0x30a7, &val_l);
  988. val = (((val_h << 8) & 0xff00) | (val_l & 0x00ff)) + v_shift;
  989. val_h = (val >> 8) & 0xff;
  990. val_l = val & 0xff;
  991. GC5035_IsiRegisterWriteIss(handle, 0x30a6, (uint8_t)val_h);
  992. GC5035_IsiRegisterWriteIss(handle, 0x30a7, (uint8_t)val_l);
  993. pGC5035Ctx->pattern = pattern;
  994. result = GC5035_IsiSensorSetStreamingIss(handle, streaming_status);
  995. #endif
  996. return (result);
  997. }
  998. RESULT GC5035_IsiGetIntegrationTimeIss
  999. (IsiSensorHandle_t handle, float *pSetIntegrationTime)
  1000. {
  1001. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1002. RESULT result = RET_SUCCESS;
  1003. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  1004. if (!pGC5035Ctx) {
  1005. TRACE(GC5035_ERROR,
  1006. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1007. __func__);
  1008. return (RET_WRONG_HANDLE);
  1009. }
  1010. if (!pSetIntegrationTime)
  1011. return (RET_NULL_POINTER);
  1012. *pSetIntegrationTime = pGC5035Ctx->AecCurIntegrationTime;
  1013. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  1014. return (result);
  1015. }
  1016. RESULT GC5035_IsiGetLongIntegrationTimeIss(IsiSensorHandle_t handle, float *pIntegrationTime)
  1017. {
  1018. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1019. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  1020. if (!pGC5035Ctx) {
  1021. TRACE(GC5035_ERROR,"%s: Invalid sensor handle (NULL pointer detected)\n",__func__);
  1022. return (RET_WRONG_HANDLE);
  1023. }
  1024. if (!pIntegrationTime)
  1025. return (RET_NULL_POINTER);
  1026. pGC5035Ctx->AecCurLongIntegrationTime = pGC5035Ctx->AecCurIntegrationTime;
  1027. *pIntegrationTime = pGC5035Ctx->AecCurLongIntegrationTime;
  1028. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  1029. return (RET_SUCCESS);
  1030. }
  1031. RESULT GC5035_IsiGetVSIntegrationTimeIss
  1032. (IsiSensorHandle_t handle, float *pSetIntegrationTime)
  1033. {
  1034. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1035. RESULT result = RET_SUCCESS;
  1036. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  1037. if (!pGC5035Ctx) {
  1038. TRACE(GC5035_ERROR,
  1039. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1040. __func__);
  1041. return (RET_WRONG_HANDLE);
  1042. }
  1043. if (!pSetIntegrationTime)
  1044. return (RET_NULL_POINTER);
  1045. *pSetIntegrationTime = pGC5035Ctx->AecCurVSIntegrationTime;
  1046. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  1047. return (result);
  1048. }
  1049. RESULT GC5035_IsiGetIntegrationTimeIncrementIss
  1050. (IsiSensorHandle_t handle, float *pIncr)
  1051. {
  1052. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1053. RESULT result = RET_SUCCESS;
  1054. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  1055. if (!pGC5035Ctx) {
  1056. TRACE(GC5035_ERROR,
  1057. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1058. __func__);
  1059. return (RET_WRONG_HANDLE);
  1060. }
  1061. if (!pIncr)
  1062. return (RET_NULL_POINTER);
  1063. //_smallest_ increment the sensor/driver can handle (e.g. used for sliders in the application)
  1064. *pIncr = pGC5035Ctx->AecIntegrationTimeIncrement;
  1065. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  1066. return (result);
  1067. }
  1068. RESULT GC5035_IsiSetIntegrationTimeIss
  1069. (IsiSensorHandle_t handle,
  1070. float NewIntegrationTime,
  1071. float *pSetIntegrationTime,
  1072. uint8_t * pNumberOfFramesToSkip, float *hdr_ratio)
  1073. {
  1074. RESULT result = RET_SUCCESS;
  1075. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1076. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  1077. uint32_t exp_line = 0;
  1078. uint32_t cal_shutter = 0;
  1079. uint32_t exp_line_old = 0;
  1080. int ret = 0;
  1081. TRACE(GC5035_INFO, "%s: (enter handle = %p)\n", __func__, handle);
  1082. if (!pGC5035Ctx) {
  1083. TRACE(GC5035_ERROR,
  1084. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1085. __func__);
  1086. return (RET_WRONG_HANDLE);
  1087. }
  1088. if (!pSetIntegrationTime || !pNumberOfFramesToSkip) {
  1089. TRACE(GC5035_ERROR,
  1090. "%s: Invalid parameter (NULL pointer detected)\n",
  1091. __func__);
  1092. return (RET_NULL_POINTER);
  1093. }
  1094. exp_line = NewIntegrationTime / pGC5035Ctx->one_line_exp_time;
  1095. exp_line_old = exp_line;
  1096. exp_line =
  1097. MIN(pGC5035Ctx->MaxIntegrationLine,
  1098. MAX(pGC5035Ctx->MinIntegrationLine, exp_line));
  1099. TRACE(GC5035_DEBUG, "%s: set AEC_PK_EXPO=0x%05x min_exp_line = %d, max_exp_line = %d\n", __func__, exp_line, pGC5035Ctx->MinIntegrationLine, pGC5035Ctx->MaxIntegrationLine);
  1100. if (exp_line != pGC5035Ctx->OldIntegrationTime) {
  1101. /*TODO*/
  1102. //ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_EXP, &exp_line);
  1103. pGC5035Ctx->OldIntegrationTime = exp_line; // remember current integration time
  1104. pGC5035Ctx->AecCurIntegrationTime =
  1105. exp_line * pGC5035Ctx->one_line_exp_time;
  1106. *pNumberOfFramesToSkip = 1U; //skip 1 frame
  1107. } else {
  1108. *pNumberOfFramesToSkip = 0U; //no frame skip
  1109. }
  1110. if (NewIntegrationTime > pGC5035Ctx->MaxIntegrationLine * pGC5035Ctx->one_line_exp_time)
  1111. NewIntegrationTime = pGC5035Ctx->MaxIntegrationLine * pGC5035Ctx->one_line_exp_time;
  1112. // GC5035 specific
  1113. cal_shutter = exp_line >> 2;
  1114. cal_shutter = cal_shutter << 2;//保证为4的整数倍
  1115. if (cal_shutter != 0) {
  1116. Dgain_ratio = 256 * exp_line / cal_shutter;
  1117. }
  1118. ret = GC5035_IsiRegisterWriteIss(handle, 0xfe, 0x00);
  1119. if (ret != 0) {
  1120. return (RET_FAILURE);
  1121. }
  1122. ret = GC5035_IsiRegisterWriteIss(handle, 0x03, (cal_shutter >> 8) & 0x3F);
  1123. if (ret != 0) {
  1124. return (RET_FAILURE);
  1125. }
  1126. ret = GC5035_IsiRegisterWriteIss(handle, 0x04, cal_shutter & 0xFF);
  1127. if (ret != 0) {
  1128. return (RET_FAILURE);
  1129. }
  1130. volatile int32_t reg;
  1131. TRACE(GC5035_DEBUG, "%s exp_line = %fs / %fs = %d\n",__func__, NewIntegrationTime, pGC5035Ctx->one_line_exp_time, exp_line);
  1132. TRACE(GC5035_DEBUG, "%s cal_shutter=%d,Dgain_ratio=%u\n", __func__, cal_shutter, Dgain_ratio);
  1133. TRACE(GC5035_DEBUG, "%s 0x03 write 0x%x, 0x04 write 0x%x\n", __func__, (cal_shutter >> 8) & 0x3F, cal_shutter & 0xFF);
  1134. GC5035_IsiRegisterReadIss(handle, 0x03, &reg);
  1135. TRACE(GC5035_DEBUG, "%s 0x03 read 0x0%x\n",__func__, reg);
  1136. GC5035_IsiRegisterReadIss(handle, 0x04, &reg);
  1137. TRACE(GC5035_DEBUG, "%s 0x04 read 0x0%x\n",__func__, reg);
  1138. if (exp_line_old != exp_line) {
  1139. *pSetIntegrationTime = pGC5035Ctx->AecCurIntegrationTime;
  1140. } else {
  1141. *pSetIntegrationTime = NewIntegrationTime;
  1142. }
  1143. TRACE(GC5035_DEBUG, "%s: Ti=%f\n", __func__, *pSetIntegrationTime);
  1144. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  1145. return (result);
  1146. }
  1147. RESULT GC5035_IsiSetLongIntegrationTimeIss(IsiSensorHandle_t handle,float IntegrationTime)
  1148. {
  1149. int ret;
  1150. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  1151. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1152. if (!handle || !pGC5035Ctx->IsiCtx.HalHandle)
  1153. {
  1154. TRACE(GC5035_ERROR,"%s: Invalid sensor handle (NULL pointer detected)\n",__func__);
  1155. return (RET_WRONG_HANDLE);
  1156. }
  1157. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  1158. uint32_t exp_line = 0;
  1159. exp_line = IntegrationTime / pGC5035Ctx->one_line_exp_time;
  1160. exp_line = MIN(pGC5035Ctx->MaxIntegrationLine, MAX(pGC5035Ctx->MinIntegrationLine, exp_line));
  1161. if (exp_line != pGC5035Ctx->LastLongExpLine)
  1162. {
  1163. if (pGC5035Ctx->KernelDriverFlag)
  1164. {
  1165. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_LONG_EXP, &exp_line);
  1166. if (ret != 0)
  1167. {
  1168. TRACE(GC5035_ERROR,"%s: set long gain failed\n");
  1169. return RET_FAILURE;
  1170. }
  1171. }
  1172. pGC5035Ctx->LastLongExpLine = exp_line;
  1173. pGC5035Ctx->AecCurLongIntegrationTime = pGC5035Ctx->LastLongExpLine*pGC5035Ctx->one_line_exp_time;
  1174. }
  1175. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  1176. return (RET_SUCCESS);
  1177. }
  1178. RESULT GC5035_IsiSetVSIntegrationTimeIss
  1179. (IsiSensorHandle_t handle,
  1180. float NewIntegrationTime,
  1181. float *pSetVSIntegrationTime,
  1182. uint8_t * pNumberOfFramesToSkip, float *hdr_ratio)
  1183. {
  1184. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1185. RESULT result = RET_SUCCESS;
  1186. uint32_t exp_line = 0;
  1187. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  1188. if (!pGC5035Ctx) {
  1189. TRACE(GC5035_ERROR,
  1190. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1191. __func__);
  1192. return (RET_WRONG_HANDLE);
  1193. }
  1194. if (!pSetVSIntegrationTime || !pNumberOfFramesToSkip) {
  1195. TRACE(GC5035_ERROR,
  1196. "%s: Invalid parameter (NULL pointer detected)\n",
  1197. __func__);
  1198. return (RET_NULL_POINTER);
  1199. }
  1200. TRACE(GC5035_INFO,
  1201. "%s: maxIntegrationTime-=%f minIntegrationTime = %f\n", __func__,
  1202. pGC5035Ctx->AecMaxIntegrationTime,
  1203. pGC5035Ctx->AecMinIntegrationTime);
  1204. exp_line = NewIntegrationTime / pGC5035Ctx->one_line_exp_time;
  1205. exp_line =
  1206. MIN(pGC5035Ctx->MaxIntegrationLine,
  1207. MAX(pGC5035Ctx->MinIntegrationLine, exp_line));
  1208. if (exp_line != pGC5035Ctx->OldVsIntegrationTime) {
  1209. /*TODO*/
  1210. // ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_VSEXP, &exp_line);
  1211. } else if (1){
  1212. pGC5035Ctx->OldVsIntegrationTime = exp_line;
  1213. pGC5035Ctx->AecCurVSIntegrationTime = exp_line * pGC5035Ctx->one_line_exp_time; //remember current integration time
  1214. *pNumberOfFramesToSkip = 1U; //skip 1 frame
  1215. } else {
  1216. *pNumberOfFramesToSkip = 0U; //no frame skip
  1217. }
  1218. *pSetVSIntegrationTime = pGC5035Ctx->AecCurVSIntegrationTime;
  1219. TRACE(GC5035_DEBUG, "%s: NewIntegrationTime=%f\n", __func__,
  1220. NewIntegrationTime);
  1221. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  1222. return (result);
  1223. }
  1224. RESULT GC5035_IsiExposureControlIss
  1225. (IsiSensorHandle_t handle,
  1226. float NewGain,
  1227. float NewIntegrationTime,
  1228. uint8_t * pNumberOfFramesToSkip,
  1229. float *pSetGain, float *pSetIntegrationTime, float *hdr_ratio)
  1230. {
  1231. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1232. RESULT result = RET_SUCCESS;
  1233. int TmpGain;
  1234. /*TODO*/
  1235. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  1236. if (pGC5035Ctx == NULL) {
  1237. TRACE(GC5035_ERROR,
  1238. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1239. __func__);
  1240. return (RET_WRONG_HANDLE);
  1241. }
  1242. if ((pNumberOfFramesToSkip == NULL) || (pSetGain == NULL)
  1243. || (pSetIntegrationTime == NULL)) {
  1244. TRACE(GC5035_ERROR,
  1245. "%s: Invalid parameter (NULL pointer detected)\n",
  1246. __func__);
  1247. return (RET_NULL_POINTER);
  1248. }
  1249. TRACE(GC5035_ERROR, "%s: g=%f, Ti=%f\n", __func__, NewGain,
  1250. NewIntegrationTime);
  1251. result = GC5035_IsiSetIntegrationTimeIss(handle, NewIntegrationTime,
  1252. pSetIntegrationTime,
  1253. pNumberOfFramesToSkip, hdr_ratio);
  1254. result = GC5035_IsiSetGainIss(handle, NewGain, pSetGain, hdr_ratio);
  1255. pGC5035Ctx->CurHdrRatio = *hdr_ratio;
  1256. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  1257. return result;
  1258. }
  1259. RESULT GC5035_IsiGetCurrentExposureIss
  1260. (IsiSensorHandle_t handle, float *pSetGain, float *pSetIntegrationTime, float *hdr_ratio) {
  1261. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1262. RESULT result = RET_SUCCESS;
  1263. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  1264. if (pGC5035Ctx == NULL) {
  1265. TRACE(GC5035_ERROR,
  1266. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1267. __func__);
  1268. return (RET_WRONG_HANDLE);
  1269. }
  1270. if ((pSetGain == NULL) || (pSetIntegrationTime == NULL))
  1271. return (RET_NULL_POINTER);
  1272. *pSetGain = pGC5035Ctx->AecCurGain;
  1273. *pSetIntegrationTime = pGC5035Ctx->AecCurIntegrationTime;
  1274. *hdr_ratio = pGC5035Ctx->CurHdrRatio;
  1275. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  1276. return (result);
  1277. }
  1278. RESULT GC5035_IsiGetResolutionIss(IsiSensorHandle_t handle, uint16_t *pwidth, uint16_t *pheight) {
  1279. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1280. RESULT result = RET_SUCCESS;
  1281. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  1282. if (pGC5035Ctx == NULL) {
  1283. TRACE(GC5035_ERROR,
  1284. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1285. __func__);
  1286. return (RET_WRONG_HANDLE);
  1287. }
  1288. *pwidth = pGC5035Ctx->SensorMode.width;
  1289. *pheight = pGC5035Ctx->SensorMode.height;
  1290. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  1291. return (result);
  1292. }
  1293. RESULT GC5035_IsiGetSensorFpsIss(IsiSensorHandle_t handle, uint32_t * pfps)
  1294. {
  1295. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1296. RESULT result = RET_SUCCESS;
  1297. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  1298. if (pGC5035Ctx == NULL) {
  1299. TRACE(GC5035_ERROR,
  1300. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1301. __func__);
  1302. return (RET_WRONG_HANDLE);
  1303. }
  1304. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  1305. if (pGC5035Ctx->KernelDriverFlag) {
  1306. /*TODO*/
  1307. ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_FPS, pfps);
  1308. pGC5035Ctx->CurrFps = *pfps;
  1309. }
  1310. *pfps = pGC5035Ctx->CurrFps;
  1311. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  1312. return (result);
  1313. }
  1314. RESULT GC5035_IsiSetSensorFpsIss(IsiSensorHandle_t handle, uint32_t fps)
  1315. {
  1316. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1317. RESULT result = RET_SUCCESS;
  1318. int32_t ret = 0;
  1319. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  1320. if (pGC5035Ctx == NULL) {
  1321. TRACE(GC5035_ERROR,
  1322. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1323. __func__);
  1324. return (RET_WRONG_HANDLE);
  1325. }
  1326. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  1327. if (fps > pGC5035Ctx->MaxFps) {
  1328. TRACE(GC5035_ERROR,
  1329. "%s: set fps(%d) out of range, correct to %d (%d, %d)\n",
  1330. __func__, fps, pGC5035Ctx->MaxFps, pGC5035Ctx->MinFps,
  1331. pGC5035Ctx->MaxFps);
  1332. fps = pGC5035Ctx->MaxFps;
  1333. }
  1334. if (fps < pGC5035Ctx->MinFps) {
  1335. TRACE(GC5035_ERROR,
  1336. "%s: set fps(%d) out of range, correct to %d (%d, %d)\n",
  1337. __func__, fps, pGC5035Ctx->MinFps, pGC5035Ctx->MinFps,
  1338. pGC5035Ctx->MaxFps);
  1339. fps = pGC5035Ctx->MinFps;
  1340. }
  1341. if (pGC5035Ctx->KernelDriverFlag) {
  1342. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_FPS, &fps);
  1343. if (ret != 0) {
  1344. TRACE(GC5035_ERROR, "%s: set sensor fps=%d error\n",
  1345. __func__);
  1346. return (RET_FAILURE);
  1347. }
  1348. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_SENSOR_MODE, &(pGC5035Ctx->SensorMode));
  1349. {
  1350. pGC5035Ctx->MaxIntegrationLine = pGC5035Ctx->SensorMode.ae_info.max_integration_time;
  1351. pGC5035Ctx->AecMaxIntegrationTime = pGC5035Ctx->MaxIntegrationLine * pGC5035Ctx->one_line_exp_time;
  1352. }
  1353. #ifdef SUBDEV_CHAR
  1354. struct vvcam_ae_info_s ae_info;
  1355. ret =
  1356. ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_AE_INFO, &ae_info);
  1357. if (ret != 0) {
  1358. TRACE(GC5035_ERROR, "%s:sensor get ae info error!\n",
  1359. __func__);
  1360. return (RET_FAILURE);
  1361. }
  1362. pGC5035Ctx->one_line_exp_time =
  1363. (float)ae_info.one_line_exp_time_ns / 1000000000;
  1364. pGC5035Ctx->MaxIntegrationLine = ae_info.max_integration_time;
  1365. pGC5035Ctx->AecMaxIntegrationTime =
  1366. pGC5035Ctx->MaxIntegrationLine *
  1367. pGC5035Ctx->one_line_exp_time;
  1368. #endif
  1369. }
  1370. TRACE(GC5035_INFO, "%s: set sensor fps = %d\n", __func__,
  1371. pGC5035Ctx->CurrFps);
  1372. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  1373. return (result);
  1374. }
  1375. static RESULT GC5035_IsiActivateTestPattern(IsiSensorHandle_t handle,
  1376. const bool_t enable)
  1377. {
  1378. RESULT result = RET_SUCCESS;
  1379. TRACE(GC5035_INFO, "%s: (enter)\n", __func__);
  1380. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1381. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  1382. return RET_NULL_POINTER;
  1383. }
  1384. if (pGC5035Ctx->Configured != BOOL_TRUE)
  1385. return RET_WRONG_STATE;
  1386. if (BOOL_TRUE == enable) {
  1387. //result = GC5035_IsiRegisterWriteIss(handle, 0x3253, 0x80);
  1388. } else {
  1389. //result = GC5035_IsiRegisterWriteIss(handle, 0x3253, 0x00);
  1390. }
  1391. pGC5035Ctx->TestPattern = enable;
  1392. TRACE(GC5035_INFO, "%s: (exit)\n", __func__);
  1393. return (result);
  1394. }
  1395. static RESULT GC5035_IsiSensorSetBlcIss(IsiSensorHandle_t handle, sensor_blc_t * pblc)
  1396. {
  1397. int32_t ret = 0;
  1398. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1399. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  1400. return RET_WRONG_HANDLE;
  1401. }
  1402. if (pblc == NULL)
  1403. return RET_NULL_POINTER;
  1404. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  1405. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_BLC, pblc);
  1406. if (ret != 0)
  1407. {
  1408. TRACE(GC5035_ERROR, "%s: set wb error\n", __func__);
  1409. }
  1410. return RET_SUCCESS;
  1411. }
  1412. static RESULT GC5035_IsiSensorSetWBIss(IsiSensorHandle_t handle, sensor_white_balance_t * pwb)
  1413. {
  1414. int32_t ret = 0;
  1415. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1416. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  1417. return RET_WRONG_HANDLE;
  1418. }
  1419. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  1420. if (pwb == NULL)
  1421. return RET_NULL_POINTER;
  1422. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_WB, pwb);
  1423. if (ret != 0)
  1424. {
  1425. TRACE(GC5035_ERROR, "%s: set wb error\n", __func__);
  1426. }
  1427. return RET_SUCCESS;
  1428. }
  1429. static RESULT GC5035_IsiGetSensorAWBModeIss(IsiSensorHandle_t handle, IsiSensorAwbMode_t *pawbmode)
  1430. {
  1431. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1432. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  1433. return RET_NULL_POINTER;
  1434. }
  1435. if (pGC5035Ctx->SensorMode.hdr_mode == SENSOR_MODE_HDR_NATIVE){
  1436. *pawbmode = ISI_SENSOR_AWB_MODE_SENSOR;
  1437. }else{
  1438. *pawbmode = ISI_SENSOR_AWB_MODE_NORMAL;
  1439. }
  1440. return RET_SUCCESS;
  1441. }
  1442. static RESULT GC5035_IsiSensorGetExpandCurveIss(IsiSensorHandle_t handle, sensor_expand_curve_t * pexpand_curve)
  1443. {
  1444. int32_t ret = 0;
  1445. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1446. if (pGC5035Ctx == NULL || pGC5035Ctx->IsiCtx.HalHandle == NULL) {
  1447. return RET_NULL_POINTER;
  1448. }
  1449. HalContext_t *pHalCtx = (HalContext_t *) pGC5035Ctx->IsiCtx.HalHandle;
  1450. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_EXPAND_CURVE, pexpand_curve);
  1451. if (ret != 0)
  1452. {
  1453. TRACE(GC5035_ERROR, "%s: get expand cure error\n", __func__);
  1454. return RET_FAILURE;
  1455. }
  1456. return RET_SUCCESS;
  1457. }
  1458. static RESULT GC5035_IsiGetCapsIss(IsiSensorHandle_t handle,
  1459. IsiSensorCaps_t * pIsiSensorCaps)
  1460. {
  1461. GC5035_Context_t *pGC5035Ctx = (GC5035_Context_t *) handle;
  1462. RESULT result = RET_SUCCESS;
  1463. TRACE(GC5035_INFO, "%s (enter)\n", __func__);
  1464. if (pGC5035Ctx == NULL) {
  1465. return (RET_WRONG_HANDLE);
  1466. }
  1467. if (pIsiSensorCaps == NULL) {
  1468. return (RET_NULL_POINTER);
  1469. }
  1470. pIsiSensorCaps->BusWidth = pGC5035Ctx->SensorMode.bit_width;
  1471. pIsiSensorCaps->Mode = ISI_MODE_BAYER;
  1472. pIsiSensorCaps->FieldSelection = ISI_FIELDSEL_BOTH;
  1473. pIsiSensorCaps->YCSequence = ISI_YCSEQ_YCBYCR;
  1474. pIsiSensorCaps->Conv422 = ISI_CONV422_NOCOSITED;
  1475. pIsiSensorCaps->BPat = pGC5035Ctx->SensorMode.bayer_pattern;
  1476. pIsiSensorCaps->HPol = ISI_HPOL_REFPOS;
  1477. pIsiSensorCaps->VPol = ISI_VPOL_NEG;
  1478. pIsiSensorCaps->Edge = ISI_EDGE_RISING;
  1479. pIsiSensorCaps->Resolution.width = pGC5035Ctx->SensorMode.width;
  1480. pIsiSensorCaps->Resolution.height = pGC5035Ctx->SensorMode.height;
  1481. pIsiSensorCaps->SmiaMode = ISI_SMIA_OFF;
  1482. pIsiSensorCaps->MipiLanes = ISI_MIPI_2LANES;
  1483. if (pIsiSensorCaps->BusWidth == 10) {
  1484. pIsiSensorCaps->MipiMode = ISI_MIPI_MODE_RAW_10;
  1485. }else if (pIsiSensorCaps->BusWidth == 12){
  1486. pIsiSensorCaps->MipiMode = ISI_MIPI_MODE_RAW_12;
  1487. }else{
  1488. pIsiSensorCaps->MipiMode = ISI_MIPI_OFF;
  1489. }
  1490. TRACE(GC5035_INFO, "%s (exit)\n", __func__);
  1491. return result;
  1492. }
  1493. RESULT GC5035_IsiGetSensorIss(IsiSensor_t *pIsiSensor)
  1494. {
  1495. RESULT result = RET_SUCCESS;
  1496. TRACE( GC5035_INFO, "%s (enter)\n", __func__);
  1497. if ( pIsiSensor != NULL ) {
  1498. pIsiSensor->pszName = SensorName;
  1499. pIsiSensor->pIsiCreateSensorIss = GC5035_IsiCreateSensorIss;
  1500. pIsiSensor->pIsiInitSensorIss = GC5035_IsiInitSensorIss;
  1501. pIsiSensor->pIsiGetSensorModeIss = GC5035_IsiGetSensorModeIss;
  1502. pIsiSensor->pIsiResetSensorIss = GC5035_IsiResetSensorIss;
  1503. pIsiSensor->pIsiReleaseSensorIss = GC5035_IsiReleaseSensorIss;
  1504. pIsiSensor->pIsiGetCapsIss = GC5035_IsiGetCapsIss;
  1505. pIsiSensor->pIsiSetupSensorIss = GC5035_IsiSetupSensorIss;
  1506. pIsiSensor->pIsiChangeSensorResolutionIss = GC5035_IsiChangeSensorResolutionIss;
  1507. pIsiSensor->pIsiSensorSetStreamingIss = GC5035_IsiSensorSetStreamingIss;
  1508. pIsiSensor->pIsiSensorSetPowerIss = GC5035_IsiSensorSetPowerIss;
  1509. pIsiSensor->pIsiCheckSensorConnectionIss = GC5035_IsiCheckSensorConnectionIss;
  1510. pIsiSensor->pIsiGetSensorRevisionIss = GC5035_IsiGetSensorRevisionIss;
  1511. pIsiSensor->pIsiRegisterReadIss = GC5035_IsiRegisterReadIss;
  1512. pIsiSensor->pIsiRegisterWriteIss = GC5035_IsiRegisterWriteIss;
  1513. /* AEC functions */
  1514. pIsiSensor->pIsiExposureControlIss = GC5035_IsiExposureControlIss;
  1515. pIsiSensor->pIsiGetGainLimitsIss = GC5035_IsiGetGainLimitsIss;
  1516. pIsiSensor->pIsiGetIntegrationTimeLimitsIss = GC5035_IsiGetIntegrationTimeLimitsIss;
  1517. pIsiSensor->pIsiGetCurrentExposureIss = GC5035_IsiGetCurrentExposureIss;
  1518. pIsiSensor->pIsiGetVSGainIss = GC5035_IsiGetVSGainIss;
  1519. pIsiSensor->pIsiGetGainIss = GC5035_IsiGetGainIss;
  1520. pIsiSensor->pIsiGetLongGainIss = GC5035_IsiGetLongGainIss;
  1521. pIsiSensor->pIsiGetGainIncrementIss = GC5035_IsiGetGainIncrementIss;
  1522. pIsiSensor->pIsiSetGainIss = GC5035_IsiSetGainIss;
  1523. pIsiSensor->pIsiGetIntegrationTimeIss = GC5035_IsiGetIntegrationTimeIss;
  1524. pIsiSensor->pIsiGetVSIntegrationTimeIss = GC5035_IsiGetVSIntegrationTimeIss;
  1525. pIsiSensor->pIsiGetLongIntegrationTimeIss = GC5035_IsiGetLongIntegrationTimeIss;
  1526. pIsiSensor->pIsiGetIntegrationTimeIncrementIss = GC5035_IsiGetIntegrationTimeIncrementIss;
  1527. pIsiSensor->pIsiSetIntegrationTimeIss = GC5035_IsiSetIntegrationTimeIss;
  1528. pIsiSensor->pIsiQuerySensorIss = GC5035_IsiQuerySensorIss;
  1529. pIsiSensor->pIsiGetResolutionIss = GC5035_IsiGetResolutionIss;
  1530. pIsiSensor->pIsiGetSensorFpsIss = GC5035_IsiGetSensorFpsIss;
  1531. pIsiSensor->pIsiSetSensorFpsIss = GC5035_IsiSetSensorFpsIss;
  1532. pIsiSensor->pIsiSensorGetExpandCurveIss = GC5035_IsiSensorGetExpandCurveIss;
  1533. /* AWB specific functions */
  1534. /* Testpattern */
  1535. pIsiSensor->pIsiActivateTestPattern = GC5035_IsiActivateTestPattern;
  1536. pIsiSensor->pIsiSetBayerPattern = GC5035_IsiSetBayerPattern;
  1537. pIsiSensor->pIsiSensorSetBlcIss = GC5035_IsiSensorSetBlcIss;
  1538. pIsiSensor->pIsiSensorSetWBIss = GC5035_IsiSensorSetWBIss;
  1539. pIsiSensor->pIsiGetSensorAWBModeIss = GC5035_IsiGetSensorAWBModeIss;
  1540. } else {
  1541. result = RET_NULL_POINTER;
  1542. }
  1543. TRACE( GC5035_INFO, "%s (exit)\n", __func__);
  1544. return ( result );
  1545. }
  1546. /*****************************************************************************
  1547. * each sensor driver need declare this struct for isi load
  1548. *****************************************************************************/
  1549. IsiCamDrvConfig_t GC5035_IsiCamDrvConfig = {
  1550. 0,
  1551. GC5035_IsiQuerySensorSupportIss,
  1552. GC5035_IsiGetSensorIss,
  1553. {
  1554. SensorName, /**< IsiSensor_t.pszName */
  1555. 0, /**< IsiSensor_t.pIsiInitIss>*/
  1556. 0, /**< IsiSensor_t.pIsiResetSensorIss>*/
  1557. 0, /**< IsiSensor_t.pRegisterTable */
  1558. 0, /**< IsiSensor_t.pIsiSensorCaps */
  1559. 0, /**< IsiSensor_t.pIsiCreateSensorIss */
  1560. 0, /**< IsiSensor_t.pIsiReleaseSensorIss */
  1561. 0, /**< IsiSensor_t.pIsiGetCapsIss */
  1562. 0, /**< IsiSensor_t.pIsiSetupSensorIss */
  1563. 0, /**< IsiSensor_t.pIsiChangeSensorResolutionIss */
  1564. 0, /**< IsiSensor_t.pIsiSensorSetStreamingIss */
  1565. 0, /**< IsiSensor_t.pIsiSensorSetPowerIss */
  1566. 0, /**< IsiSensor_t.pIsiCheckSensorConnectionIss */
  1567. 0, /**< IsiSensor_t.pIsiGetSensorRevisionIss */
  1568. 0, /**< IsiSensor_t.pIsiRegisterReadIss */
  1569. 0, /**< IsiSensor_t.pIsiRegisterWriteIss */
  1570. 0, /**< IsiSensor_t.pIsiExposureControlIss */
  1571. 0, /**< IsiSensor_t.pIsiGetGainLimitsIss */
  1572. 0, /**< IsiSensor_t.pIsiGetIntegrationTimeLimitsIss */
  1573. 0, /**< IsiSensor_t.pIsiGetCurrentExposureIss */
  1574. 0, /**< IsiSensor_t.pIsiGetGainIss */
  1575. 0, /**< IsiSensor_t.pIsiGetVSGainIss */
  1576. 0, /**< IsiSensor_t.pIsiGetGainIncrementIss */
  1577. 0, /**< IsiSensor_t.pIsiGetGainIncrementIss */
  1578. 0, /**< IsiSensor_t.pIsiSetGainIss */
  1579. 0, /**< IsiSensor_t.pIsiGetIntegrationTimeIss */
  1580. 0, /**< IsiSensor_t.pIsiGetIntegrationTimeIncrementIss */
  1581. 0, /**< IsiSensor_t.pIsiSetIntegrationTimeIss */
  1582. 0, /**< IsiSensor_t.pIsiGetResolutionIss */
  1583. 0, /**< IsiSensor_t.pIsiGetAfpsInfoIss */
  1584. 0, /**< IsiSensor_t.pIsiMdiInitMotoDriveMds */
  1585. 0, /**< IsiSensor_t.pIsiMdiSetupMotoDrive */
  1586. 0, /**< IsiSensor_t.pIsiMdiFocusSet */
  1587. 0, /**< IsiSensor_t.pIsiMdiFocusGet */
  1588. 0, /**< IsiSensor_t.pIsiMdiFocusCalibrate */
  1589. 0, /**< IsiSensor_t.pIsiGetSensorMipiInfoIss */
  1590. 0, /**< IsiSensor_t.pIsiActivateTestPattern */
  1591. 0, /**< IsiSensor_t.pIsiSetBayerPattern */
  1592. }
  1593. };