msm_camera.h 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291
  1. /* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #ifndef __LINUX_MSM_CAMERA_H
  14. #define __LINUX_MSM_CAMERA_H
  15. #ifdef MSM_CAMERA_BIONIC
  16. #include <sys/types.h>
  17. #endif
  18. #include <linux/videodev2.h>
  19. #include <linux/types.h>
  20. #include <linux/ioctl.h>
  21. #ifdef __KERNEL__
  22. #include <linux/cdev.h>
  23. #endif
  24. #ifdef MSM_CAMERA_GCC
  25. #include <time.h>
  26. #else
  27. #include <linux/time.h>
  28. #endif
  29. #include <linux/msm_ion.h>
  30. //#define BYPASS_COMPANION
  31. #define BIT(nr) (1UL << (nr))
  32. #define MSM_CAM_IOCTL_MAGIC 'm'
  33. #define MAX_SERVER_PAYLOAD_LENGTH 8192
  34. #define MSM_CAM_IOCTL_GET_SENSOR_INFO \
  35. _IOR(MSM_CAM_IOCTL_MAGIC, 1, struct msm_camsensor_info *)
  36. #define MSM_CAM_IOCTL_REGISTER_PMEM \
  37. _IOW(MSM_CAM_IOCTL_MAGIC, 2, struct msm_pmem_info *)
  38. #define MSM_CAM_IOCTL_UNREGISTER_PMEM \
  39. _IOW(MSM_CAM_IOCTL_MAGIC, 3, unsigned)
  40. #define MSM_CAM_IOCTL_CTRL_COMMAND \
  41. _IOW(MSM_CAM_IOCTL_MAGIC, 4, struct msm_ctrl_cmd *)
  42. #define MSM_CAM_IOCTL_CONFIG_VFE \
  43. _IOW(MSM_CAM_IOCTL_MAGIC, 5, struct msm_camera_vfe_cfg_cmd *)
  44. #define MSM_CAM_IOCTL_GET_STATS \
  45. _IOR(MSM_CAM_IOCTL_MAGIC, 6, struct msm_camera_stats_event_ctrl *)
  46. #define MSM_CAM_IOCTL_GETFRAME \
  47. _IOR(MSM_CAM_IOCTL_MAGIC, 7, struct msm_camera_get_frame *)
  48. #define MSM_CAM_IOCTL_ENABLE_VFE \
  49. _IOW(MSM_CAM_IOCTL_MAGIC, 8, struct camera_enable_cmd *)
  50. #define MSM_CAM_IOCTL_CTRL_CMD_DONE \
  51. _IOW(MSM_CAM_IOCTL_MAGIC, 9, struct camera_cmd *)
  52. #define MSM_CAM_IOCTL_CONFIG_CMD \
  53. _IOW(MSM_CAM_IOCTL_MAGIC, 10, struct camera_cmd *)
  54. #define MSM_CAM_IOCTL_DISABLE_VFE \
  55. _IOW(MSM_CAM_IOCTL_MAGIC, 11, struct camera_enable_cmd *)
  56. #define MSM_CAM_IOCTL_PAD_REG_RESET2 \
  57. _IOW(MSM_CAM_IOCTL_MAGIC, 12, struct camera_enable_cmd *)
  58. #define MSM_CAM_IOCTL_VFE_APPS_RESET \
  59. _IOW(MSM_CAM_IOCTL_MAGIC, 13, struct camera_enable_cmd *)
  60. #define MSM_CAM_IOCTL_RELEASE_FRAME_BUFFER \
  61. _IOW(MSM_CAM_IOCTL_MAGIC, 14, struct camera_enable_cmd *)
  62. #define MSM_CAM_IOCTL_RELEASE_STATS_BUFFER \
  63. _IOW(MSM_CAM_IOCTL_MAGIC, 15, struct msm_stats_buf *)
  64. #define MSM_CAM_IOCTL_AXI_CONFIG \
  65. _IOW(MSM_CAM_IOCTL_MAGIC, 16, struct msm_camera_vfe_cfg_cmd *)
  66. #define MSM_CAM_IOCTL_GET_PICTURE \
  67. _IOW(MSM_CAM_IOCTL_MAGIC, 17, struct msm_frame *)
  68. #define MSM_CAM_IOCTL_SET_CROP \
  69. _IOW(MSM_CAM_IOCTL_MAGIC, 18, struct crop_info *)
  70. #define MSM_CAM_IOCTL_PICT_PP \
  71. _IOW(MSM_CAM_IOCTL_MAGIC, 19, uint8_t *)
  72. #define MSM_CAM_IOCTL_PICT_PP_DONE \
  73. _IOW(MSM_CAM_IOCTL_MAGIC, 20, struct msm_snapshot_pp_status *)
  74. #define MSM_CAM_IOCTL_SENSOR_IO_CFG \
  75. _IOW(MSM_CAM_IOCTL_MAGIC, 21, struct sensor_cfg_data *)
  76. #define MSM_CAM_IOCTL_FLASH_LED_CFG \
  77. _IOW(MSM_CAM_IOCTL_MAGIC, 22, unsigned *)
  78. #define MSM_CAM_IOCTL_UNBLOCK_POLL_FRAME \
  79. _IO(MSM_CAM_IOCTL_MAGIC, 23)
  80. #define MSM_CAM_IOCTL_CTRL_COMMAND_2 \
  81. _IOW(MSM_CAM_IOCTL_MAGIC, 24, struct msm_ctrl_cmd *)
  82. #define MSM_CAM_IOCTL_AF_CTRL \
  83. _IOR(MSM_CAM_IOCTL_MAGIC, 25, struct msm_ctrl_cmt_t *)
  84. #define MSM_CAM_IOCTL_AF_CTRL_DONE \
  85. _IOW(MSM_CAM_IOCTL_MAGIC, 26, struct msm_ctrl_cmt_t *)
  86. #define MSM_CAM_IOCTL_CONFIG_VPE \
  87. _IOW(MSM_CAM_IOCTL_MAGIC, 27, struct msm_camera_vpe_cfg_cmd *)
  88. #define MSM_CAM_IOCTL_AXI_VPE_CONFIG \
  89. _IOW(MSM_CAM_IOCTL_MAGIC, 28, struct msm_camera_vpe_cfg_cmd *)
  90. #define MSM_CAM_IOCTL_STROBE_FLASH_CFG \
  91. _IOW(MSM_CAM_IOCTL_MAGIC, 29, uint32_t *)
  92. #define MSM_CAM_IOCTL_STROBE_FLASH_CHARGE \
  93. _IOW(MSM_CAM_IOCTL_MAGIC, 30, uint32_t *)
  94. #define MSM_CAM_IOCTL_STROBE_FLASH_RELEASE \
  95. _IO(MSM_CAM_IOCTL_MAGIC, 31)
  96. #define MSM_CAM_IOCTL_FLASH_CTRL \
  97. _IOW(MSM_CAM_IOCTL_MAGIC, 32, struct flash_ctrl_data *)
  98. #define MSM_CAM_IOCTL_ERROR_CONFIG \
  99. _IOW(MSM_CAM_IOCTL_MAGIC, 33, uint32_t *)
  100. #define MSM_CAM_IOCTL_ABORT_CAPTURE \
  101. _IO(MSM_CAM_IOCTL_MAGIC, 34)
  102. #define MSM_CAM_IOCTL_SET_FD_ROI \
  103. _IOW(MSM_CAM_IOCTL_MAGIC, 35, struct fd_roi_info *)
  104. #define MSM_CAM_IOCTL_GET_CAMERA_INFO \
  105. _IOR(MSM_CAM_IOCTL_MAGIC, 36, struct msm_camera_info *)
  106. #define MSM_CAM_IOCTL_UNBLOCK_POLL_PIC_FRAME \
  107. _IO(MSM_CAM_IOCTL_MAGIC, 37)
  108. #define MSM_CAM_IOCTL_RELEASE_PIC_BUFFER \
  109. _IOW(MSM_CAM_IOCTL_MAGIC, 38, struct camera_enable_cmd *)
  110. #define MSM_CAM_IOCTL_PUT_ST_FRAME \
  111. _IOW(MSM_CAM_IOCTL_MAGIC, 39, struct msm_camera_st_frame *)
  112. #define MSM_CAM_IOCTL_V4L2_EVT_NOTIFY \
  113. _IOW(MSM_CAM_IOCTL_MAGIC, 40, struct v4l2_event_and_payload)
  114. #define MSM_CAM_IOCTL_SET_MEM_MAP_INFO \
  115. _IOR(MSM_CAM_IOCTL_MAGIC, 41, struct msm_mem_map_info *)
  116. #define MSM_CAM_IOCTL_ACTUATOR_IO_CFG \
  117. _IOW(MSM_CAM_IOCTL_MAGIC, 42, struct msm_actuator_cfg_data *)
  118. #define MSM_CAM_IOCTL_MCTL_POST_PROC \
  119. _IOW(MSM_CAM_IOCTL_MAGIC, 43, struct msm_mctl_post_proc_cmd *)
  120. #define MSM_CAM_IOCTL_RESERVE_FREE_FRAME \
  121. _IOW(MSM_CAM_IOCTL_MAGIC, 44, struct msm_cam_evt_divert_frame *)
  122. #define MSM_CAM_IOCTL_RELEASE_FREE_FRAME \
  123. _IOR(MSM_CAM_IOCTL_MAGIC, 45, struct msm_cam_evt_divert_frame *)
  124. #define MSM_CAM_IOCTL_PICT_PP_DIVERT_DONE \
  125. _IOR(MSM_CAM_IOCTL_MAGIC, 46, struct msm_pp_frame *)
  126. #define MSM_CAM_IOCTL_SENSOR_V4l2_S_CTRL \
  127. _IOR(MSM_CAM_IOCTL_MAGIC, 47, struct v4l2_control)
  128. #define MSM_CAM_IOCTL_SENSOR_V4l2_QUERY_CTRL \
  129. _IOR(MSM_CAM_IOCTL_MAGIC, 48, struct v4l2_queryctrl)
  130. #define MSM_CAM_IOCTL_GET_KERNEL_SYSTEM_TIME \
  131. _IOW(MSM_CAM_IOCTL_MAGIC, 49, struct timeval *)
  132. #define MSM_CAM_IOCTL_SET_VFE_OUTPUT_TYPE \
  133. _IOW(MSM_CAM_IOCTL_MAGIC, 50, uint32_t *)
  134. #define MSM_CAM_IOCTL_MCTL_DIVERT_DONE \
  135. _IOR(MSM_CAM_IOCTL_MAGIC, 51, struct msm_cam_evt_divert_frame *)
  136. #define MSM_CAM_IOCTL_GET_ACTUATOR_INFO \
  137. _IOW(MSM_CAM_IOCTL_MAGIC, 52, struct msm_actuator_cfg_data *)
  138. #define MSM_CAM_IOCTL_EEPROM_IO_CFG \
  139. _IOW(MSM_CAM_IOCTL_MAGIC, 53, struct msm_eeprom_cfg_data *)
  140. #define MSM_CAM_IOCTL_ISPIF_IO_CFG \
  141. _IOR(MSM_CAM_IOCTL_MAGIC, 54, struct ispif_cfg_data *)
  142. #define MSM_CAM_IOCTL_STATS_REQBUF \
  143. _IOR(MSM_CAM_IOCTL_MAGIC, 55, struct msm_stats_reqbuf *)
  144. #define MSM_CAM_IOCTL_STATS_ENQUEUEBUF \
  145. _IOR(MSM_CAM_IOCTL_MAGIC, 56, struct msm_stats_buf_info *)
  146. #define MSM_CAM_IOCTL_STATS_FLUSH_BUFQ \
  147. _IOR(MSM_CAM_IOCTL_MAGIC, 57, struct msm_stats_flush_bufq *)
  148. #define MSM_CAM_IOCTL_SET_MCTL_SDEV \
  149. _IOW(MSM_CAM_IOCTL_MAGIC, 58, struct msm_mctl_set_sdev_data *)
  150. #define MSM_CAM_IOCTL_UNSET_MCTL_SDEV \
  151. _IOW(MSM_CAM_IOCTL_MAGIC, 59, struct msm_mctl_set_sdev_data *)
  152. #define MSM_CAM_IOCTL_GET_INST_HANDLE \
  153. _IOR(MSM_CAM_IOCTL_MAGIC, 60, uint32_t *)
  154. #define MSM_CAM_IOCTL_STATS_UNREG_BUF \
  155. _IOR(MSM_CAM_IOCTL_MAGIC, 61, struct msm_stats_flush_bufq *)
  156. #define MSM_CAM_IOCTL_CSIC_IO_CFG \
  157. _IOWR(MSM_CAM_IOCTL_MAGIC, 62, struct csic_cfg_data *)
  158. #define MSM_CAM_IOCTL_CSID_IO_CFG \
  159. _IOWR(MSM_CAM_IOCTL_MAGIC, 63, struct csid_cfg_data *)
  160. #define MSM_CAM_IOCTL_CSIPHY_IO_CFG \
  161. _IOR(MSM_CAM_IOCTL_MAGIC, 64, struct csiphy_cfg_data *)
  162. #define MSM_CAM_IOCTL_OEM \
  163. _IOW(MSM_CAM_IOCTL_MAGIC, 65, struct sensor_cfg_data *)
  164. #define MSM_CAM_IOCTL_AXI_INIT \
  165. _IOWR(MSM_CAM_IOCTL_MAGIC, 66, uint8_t *)
  166. #define MSM_CAM_IOCTL_AXI_RELEASE \
  167. _IO(MSM_CAM_IOCTL_MAGIC, 67)
  168. struct v4l2_event_and_payload {
  169. struct v4l2_event evt;
  170. uint32_t payload_length;
  171. uint32_t transaction_id;
  172. void *payload;
  173. };
  174. struct msm_stats_reqbuf {
  175. int num_buf; /* how many buffers requested */
  176. int stats_type; /* stats type */
  177. };
  178. struct msm_stats_flush_bufq {
  179. int stats_type; /* enum msm_stats_enum_type */
  180. };
  181. struct msm_mctl_pp_cmd {
  182. int32_t id;
  183. uint16_t length;
  184. void *value;
  185. };
  186. struct msm_mctl_post_proc_cmd {
  187. int32_t type;
  188. struct msm_mctl_pp_cmd cmd;
  189. };
  190. #define MSM_CAMERA_LED_OFF 0
  191. #define MSM_CAMERA_LED_LOW 1
  192. #define MSM_CAMERA_LED_HIGH 2
  193. #define MSM_CAMERA_LED_INIT 3
  194. #define MSM_CAMERA_LED_RELEASE 4
  195. #define MSM_CAMERA_STROBE_FLASH_NONE 0
  196. #define MSM_CAMERA_STROBE_FLASH_XENON 1
  197. #define MSM_MAX_CAMERA_SENSORS 5
  198. #define MAX_SENSOR_NAME 32
  199. #define MAX_CAM_NAME_SIZE 32
  200. #define MAX_ACT_MOD_NAME_SIZE 32
  201. #define MAX_ACT_NAME_SIZE 32
  202. #define NUM_ACTUATOR_DIR 2
  203. #define MAX_ACTUATOR_SCENARIO 8
  204. #define MAX_ACTUATOR_REGION 5
  205. #define MAX_ACTUATOR_INIT_SET 12
  206. #define MAX_ACTUATOR_TYPE_SIZE 32
  207. #define MAX_ACTUATOR_REG_TBL_SIZE 8
  208. #define MSM_MAX_CAMERA_CONFIGS 2
  209. #define PP_SNAP 0x01
  210. #define PP_RAW_SNAP ((0x01)<<1)
  211. #define PP_PREV ((0x01)<<2)
  212. #define PP_THUMB ((0x01)<<3)
  213. #define PP_MASK (PP_SNAP|PP_RAW_SNAP|PP_PREV|PP_THUMB)
  214. #define MSM_CAM_CTRL_CMD_DONE 0
  215. #define MSM_CAM_SENSOR_VFE_CMD 1
  216. /* Should be same as VIDEO_MAX_PLANES in videodev2.h */
  217. #define MAX_PLANES 8
  218. /*****************************************************
  219. * structure
  220. *****************************************************/
  221. /* define five type of structures for userspace <==> kernel
  222. * space communication:
  223. * command 1 - 2 are from userspace ==> kernel
  224. * command 3 - 4 are from kernel ==> userspace
  225. *
  226. * 1. control command: control command(from control thread),
  227. * control status (from config thread);
  228. */
  229. struct msm_ctrl_cmd {
  230. uint16_t type;
  231. uint16_t length;
  232. void *value;
  233. uint16_t status;
  234. uint32_t timeout_ms;
  235. int resp_fd; /* FIXME: to be used by the kernel, pass-through for now */
  236. int vnode_id; /* video dev id. Can we overload resp_fd? */
  237. int queue_idx;
  238. uint32_t evt_id;
  239. uint32_t stream_type; /* used to pass value to qcamera server */
  240. int config_ident; /*used as identifier for config node*/
  241. };
  242. struct msm_cam_evt_msg {
  243. unsigned short type; /* 1 == event (RPC), 0 == message (adsp) */
  244. unsigned short msg_id;
  245. unsigned int len; /* size in, number of bytes out */
  246. uint32_t frame_id;
  247. void *data;
  248. struct timespec timestamp;
  249. };
  250. struct msm_pp_frame_sp {
  251. /* phy addr of the buffer */
  252. unsigned long phy_addr;
  253. uint32_t y_off;
  254. uint32_t cbcr_off;
  255. /* buffer length */
  256. uint32_t length;
  257. int32_t fd;
  258. uint32_t addr_offset;
  259. /* mapped addr */
  260. unsigned long vaddr;
  261. };
  262. struct msm_pp_frame_mp {
  263. /* phy addr of the plane */
  264. unsigned long phy_addr;
  265. /* offset of plane data */
  266. uint32_t data_offset;
  267. /* plane length */
  268. uint32_t length;
  269. int32_t fd;
  270. uint32_t addr_offset;
  271. /* mapped addr */
  272. unsigned long vaddr;
  273. };
  274. struct msm_pp_frame {
  275. uint32_t handle; /* stores vb cookie */
  276. uint32_t frame_id;
  277. unsigned short buf_idx;
  278. int path;
  279. unsigned short image_type;
  280. unsigned short num_planes; /* 1 for sp */
  281. struct timeval timestamp;
  282. union {
  283. struct msm_pp_frame_sp sp;
  284. struct msm_pp_frame_mp mp[MAX_PLANES];
  285. };
  286. int node_type;
  287. uint32_t inst_handle;
  288. };
  289. struct msm_pp_crop {
  290. uint32_t src_x;
  291. uint32_t src_y;
  292. uint32_t src_w;
  293. uint32_t src_h;
  294. uint32_t dst_x;
  295. uint32_t dst_y;
  296. uint32_t dst_w;
  297. uint32_t dst_h;
  298. uint8_t update_flag;
  299. };
  300. struct msm_mctl_pp_frame_cmd {
  301. uint32_t cookie;
  302. uint8_t vpe_output_action;
  303. struct msm_pp_frame src_frame;
  304. struct msm_pp_frame dest_frame;
  305. struct msm_pp_crop crop;
  306. int path;
  307. };
  308. struct msm_cam_evt_divert_frame {
  309. unsigned short image_mode;
  310. unsigned short op_mode;
  311. unsigned short inst_idx;
  312. unsigned short node_idx;
  313. struct msm_pp_frame frame;
  314. int do_pp;
  315. };
  316. struct msm_mctl_pp_cmd_ack_event {
  317. uint32_t cmd; /* VPE_CMD_ZOOM? */
  318. int status; /* 0 done, < 0 err */
  319. uint32_t cookie; /* daemon's cookie */
  320. };
  321. struct msm_mctl_pp_event_info {
  322. int32_t event;
  323. union {
  324. struct msm_mctl_pp_cmd_ack_event ack;
  325. };
  326. };
  327. struct msm_isp_event_ctrl {
  328. unsigned short resptype;
  329. union {
  330. struct msm_cam_evt_msg isp_msg;
  331. struct msm_ctrl_cmd ctrl;
  332. struct msm_cam_evt_divert_frame div_frame;
  333. struct msm_mctl_pp_event_info pp_event_info;
  334. } isp_data;
  335. };
  336. #define MSM_CAM_RESP_CTRL 0
  337. #define MSM_CAM_RESP_STAT_EVT_MSG 1
  338. #define MSM_CAM_RESP_STEREO_OP_1 2
  339. #define MSM_CAM_RESP_STEREO_OP_2 3
  340. #define MSM_CAM_RESP_V4L2 4
  341. #define MSM_CAM_RESP_DIV_FRAME_EVT_MSG 5
  342. #define MSM_CAM_RESP_DONE_EVENT 6
  343. #define MSM_CAM_RESP_MCTL_PP_EVENT 7
  344. #define MSM_CAM_RESP_MAX 8
  345. #define MSM_CAM_APP_NOTIFY_EVENT 0
  346. #define MSM_CAM_APP_NOTIFY_ERROR_EVENT 1
  347. /* this one is used to send ctrl/status up to config thread */
  348. struct msm_stats_event_ctrl {
  349. /* 0 - ctrl_cmd from control thread,
  350. * 1 - stats/event kernel,
  351. * 2 - V4L control or read request */
  352. int resptype;
  353. int timeout_ms;
  354. struct msm_ctrl_cmd ctrl_cmd;
  355. /* struct vfe_event_t stats_event; */
  356. struct msm_cam_evt_msg stats_event;
  357. };
  358. /* 2. config command: config command(from config thread); */
  359. struct msm_camera_cfg_cmd {
  360. /* what to config:
  361. * 1 - sensor config, 2 - vfe config */
  362. uint16_t cfg_type;
  363. /* sensor config type */
  364. uint16_t cmd_type;
  365. uint16_t queue;
  366. uint16_t length;
  367. void *value;
  368. };
  369. #define CMD_GENERAL 0
  370. #define CMD_AXI_CFG_OUT1 1
  371. #define CMD_AXI_CFG_SNAP_O1_AND_O2 2
  372. #define CMD_AXI_CFG_OUT2 3
  373. #define CMD_PICT_T_AXI_CFG 4
  374. #define CMD_PICT_M_AXI_CFG 5
  375. #define CMD_RAW_PICT_AXI_CFG 6
  376. #define CMD_FRAME_BUF_RELEASE 7
  377. #define CMD_PREV_BUF_CFG 8
  378. #define CMD_SNAP_BUF_RELEASE 9
  379. #define CMD_SNAP_BUF_CFG 10
  380. #define CMD_STATS_DISABLE 11
  381. #define CMD_STATS_AEC_AWB_ENABLE 12
  382. #define CMD_STATS_AF_ENABLE 13
  383. #define CMD_STATS_AEC_ENABLE 14
  384. #define CMD_STATS_AWB_ENABLE 15
  385. #define CMD_STATS_ENABLE 16
  386. #define CMD_STATS_AXI_CFG 17
  387. #define CMD_STATS_AEC_AXI_CFG 18
  388. #define CMD_STATS_AF_AXI_CFG 19
  389. #define CMD_STATS_AWB_AXI_CFG 20
  390. #define CMD_STATS_RS_AXI_CFG 21
  391. #define CMD_STATS_CS_AXI_CFG 22
  392. #define CMD_STATS_IHIST_AXI_CFG 23
  393. #define CMD_STATS_SKIN_AXI_CFG 24
  394. #define CMD_STATS_BUF_RELEASE 25
  395. #define CMD_STATS_AEC_BUF_RELEASE 26
  396. #define CMD_STATS_AF_BUF_RELEASE 27
  397. #define CMD_STATS_AWB_BUF_RELEASE 28
  398. #define CMD_STATS_RS_BUF_RELEASE 29
  399. #define CMD_STATS_CS_BUF_RELEASE 30
  400. #define CMD_STATS_IHIST_BUF_RELEASE 31
  401. #define CMD_STATS_SKIN_BUF_RELEASE 32
  402. #define UPDATE_STATS_INVALID 33
  403. #define CMD_AXI_CFG_SNAP_GEMINI 34
  404. #define CMD_AXI_CFG_SNAP 35
  405. #define CMD_AXI_CFG_PREVIEW 36
  406. #define CMD_AXI_CFG_VIDEO 37
  407. #define CMD_STATS_IHIST_ENABLE 38
  408. #define CMD_STATS_RS_ENABLE 39
  409. #define CMD_STATS_CS_ENABLE 40
  410. #define CMD_VPE 41
  411. #define CMD_AXI_CFG_VPE 42
  412. #define CMD_AXI_CFG_ZSL 43
  413. #define CMD_AXI_CFG_SNAP_VPE 44
  414. #define CMD_AXI_CFG_SNAP_THUMB_VPE 45
  415. #define CMD_CONFIG_PING_ADDR 46
  416. #define CMD_CONFIG_PONG_ADDR 47
  417. #define CMD_CONFIG_FREE_BUF_ADDR 48
  418. #define CMD_AXI_CFG_ZSL_ALL_CHNLS 49
  419. #define CMD_AXI_CFG_VIDEO_ALL_CHNLS 50
  420. #define CMD_VFE_BUFFER_RELEASE 51
  421. #define CMD_VFE_PROCESS_IRQ 52
  422. #define CMD_STATS_BG_ENABLE 53
  423. #define CMD_STATS_BF_ENABLE 54
  424. #define CMD_STATS_BHIST_ENABLE 55
  425. #define CMD_STATS_BG_BUF_RELEASE 56
  426. #define CMD_STATS_BF_BUF_RELEASE 57
  427. #define CMD_STATS_BHIST_BUF_RELEASE 58
  428. #define CMD_VFE_PIX_SOF_COUNT_UPDATE 59
  429. #define CMD_VFE_COUNT_PIX_SOF_ENABLE 60
  430. #define CMD_STATS_BE_ENABLE 61
  431. #define CMD_STATS_BE_BUF_RELEASE 62
  432. #define CMD_AXI_CFG_PRIM BIT(8)
  433. #define CMD_AXI_CFG_PRIM_ALL_CHNLS BIT(9)
  434. #define CMD_AXI_CFG_SEC BIT(10)
  435. #define CMD_AXI_CFG_SEC_ALL_CHNLS BIT(11)
  436. #define CMD_AXI_CFG_TERT1 BIT(12)
  437. #define CMD_AXI_CFG_TERT2 BIT(13)
  438. #define CMD_AXI_START 0xE1
  439. #define CMD_AXI_STOP 0xE2
  440. #define CMD_AXI_RESET 0xE3
  441. #define CMD_AXI_ABORT 0xE4
  442. #define AXI_CMD_PREVIEW BIT(0)
  443. #define AXI_CMD_CAPTURE BIT(1)
  444. #define AXI_CMD_RECORD BIT(2)
  445. #define AXI_CMD_ZSL BIT(3)
  446. #define AXI_CMD_RAW_CAPTURE BIT(4)
  447. #define AXI_CMD_LIVESHOT BIT(5)
  448. /* vfe config command: config command(from config thread)*/
  449. struct msm_vfe_cfg_cmd {
  450. int cmd_type;
  451. uint16_t length;
  452. void *value;
  453. };
  454. struct msm_vpe_cfg_cmd {
  455. int cmd_type;
  456. uint16_t length;
  457. void *value;
  458. };
  459. #define MAX_CAMERA_ENABLE_NAME_LEN 32
  460. struct camera_enable_cmd {
  461. char name[MAX_CAMERA_ENABLE_NAME_LEN];
  462. };
  463. #define MSM_PMEM_OUTPUT1 0
  464. #define MSM_PMEM_OUTPUT2 1
  465. #define MSM_PMEM_OUTPUT1_OUTPUT2 2
  466. #define MSM_PMEM_THUMBNAIL 3
  467. #define MSM_PMEM_MAINIMG 4
  468. #define MSM_PMEM_RAW_MAINIMG 5
  469. #define MSM_PMEM_AEC_AWB 6
  470. #define MSM_PMEM_AF 7
  471. #define MSM_PMEM_AEC 8
  472. #define MSM_PMEM_AWB 9
  473. #define MSM_PMEM_RS 10
  474. #define MSM_PMEM_CS 11
  475. #define MSM_PMEM_IHIST 12
  476. #define MSM_PMEM_SKIN 13
  477. #define MSM_PMEM_VIDEO 14
  478. #define MSM_PMEM_PREVIEW 15
  479. #define MSM_PMEM_VIDEO_VPE 16
  480. #define MSM_PMEM_C2D 17
  481. #define MSM_PMEM_MAINIMG_VPE 18
  482. #define MSM_PMEM_THUMBNAIL_VPE 19
  483. #define MSM_PMEM_BAYER_GRID 20
  484. #define MSM_PMEM_BAYER_FOCUS 21
  485. #define MSM_PMEM_BAYER_HIST 22
  486. #define MSM_PMEM_BAYER_EXPOSURE 23
  487. #define MSM_PMEM_MAX 24
  488. #define STAT_AEAW 0
  489. #define STAT_AEC 1
  490. #define STAT_AF 2
  491. #define STAT_AWB 3
  492. #define STAT_RS 4
  493. #define STAT_CS 5
  494. #define STAT_IHIST 6
  495. #define STAT_SKIN 7
  496. #define STAT_BG 8
  497. #define STAT_BF 9
  498. #define STAT_BE 10
  499. #define STAT_BHIST 11
  500. #define STAT_MAX 12
  501. #define FRAME_PREVIEW_OUTPUT1 0
  502. #define FRAME_PREVIEW_OUTPUT2 1
  503. #define FRAME_SNAPSHOT 2
  504. #define FRAME_THUMBNAIL 3
  505. #define FRAME_RAW_SNAPSHOT 4
  506. #define FRAME_MAX 5
  507. enum msm_stats_enum_type {
  508. MSM_STATS_TYPE_AEC, /* legacy based AEC */
  509. MSM_STATS_TYPE_AF, /* legacy based AF */
  510. MSM_STATS_TYPE_AWB, /* legacy based AWB */
  511. MSM_STATS_TYPE_RS, /* legacy based RS */
  512. MSM_STATS_TYPE_CS, /* legacy based CS */
  513. MSM_STATS_TYPE_IHIST, /* legacy based HIST */
  514. MSM_STATS_TYPE_SKIN, /* legacy based SKIN */
  515. MSM_STATS_TYPE_BG, /* Bayer Grids */
  516. MSM_STATS_TYPE_BF, /* Bayer Focus */
  517. MSM_STATS_TYPE_BE, /* Bayer Exposure*/
  518. MSM_STATS_TYPE_BHIST, /* Bayer Hist */
  519. MSM_STATS_TYPE_AE_AW, /* legacy stats for vfe 2.x*/
  520. MSM_STATS_TYPE_COMP, /* Composite stats */
  521. MSM_STATS_TYPE_MAX /* MAX */
  522. };
  523. struct msm_stats_buf_info {
  524. int type; /* msm_stats_enum_type */
  525. int fd;
  526. void *vaddr;
  527. uint32_t offset;
  528. uint32_t len;
  529. uint32_t y_off;
  530. uint32_t cbcr_off;
  531. uint32_t planar0_off;
  532. uint32_t planar1_off;
  533. uint32_t planar2_off;
  534. uint8_t active;
  535. int buf_idx;
  536. };
  537. struct msm_pmem_info {
  538. int type;
  539. int fd;
  540. void *vaddr;
  541. uint32_t offset;
  542. uint32_t len;
  543. uint32_t y_off;
  544. uint32_t cbcr_off;
  545. uint32_t planar0_off;
  546. uint32_t planar1_off;
  547. uint32_t planar2_off;
  548. uint8_t active;
  549. };
  550. struct outputCfg {
  551. uint32_t height;
  552. uint32_t width;
  553. uint32_t window_height_firstline;
  554. uint32_t window_height_lastline;
  555. };
  556. #define VIDEO_NODE 0
  557. #define MCTL_NODE 1
  558. #define OUTPUT_1 0
  559. #define OUTPUT_2 1
  560. #define OUTPUT_1_AND_2 2 /* snapshot only */
  561. #define OUTPUT_1_AND_3 3 /* video */
  562. #define CAMIF_TO_AXI_VIA_OUTPUT_2 4
  563. #define OUTPUT_1_AND_CAMIF_TO_AXI_VIA_OUTPUT_2 5
  564. #define OUTPUT_2_AND_CAMIF_TO_AXI_VIA_OUTPUT_1 6
  565. #define OUTPUT_1_2_AND_3 7
  566. #define OUTPUT_ALL_CHNLS 8
  567. #define OUTPUT_VIDEO_ALL_CHNLS 9
  568. #define OUTPUT_ZSL_ALL_CHNLS 10
  569. #define LAST_AXI_OUTPUT_MODE_ENUM = OUTPUT_ZSL_ALL_CHNLS
  570. #define OUTPUT_PRIM BIT(8)
  571. #define OUTPUT_PRIM_ALL_CHNLS BIT(9)
  572. #define OUTPUT_SEC BIT(10)
  573. #define OUTPUT_SEC_ALL_CHNLS BIT(11)
  574. #define OUTPUT_TERT1 BIT(12)
  575. #define OUTPUT_TERT2 BIT(13)
  576. #define MSM_FRAME_PREV_1 0
  577. #define MSM_FRAME_PREV_2 1
  578. #define MSM_FRAME_ENC 2
  579. #define OUTPUT_TYPE_P BIT(0)
  580. #define OUTPUT_TYPE_T BIT(1)
  581. #define OUTPUT_TYPE_S BIT(2)
  582. #define OUTPUT_TYPE_V BIT(3)
  583. #define OUTPUT_TYPE_L BIT(4)
  584. #define OUTPUT_TYPE_ST_L BIT(5)
  585. #define OUTPUT_TYPE_ST_R BIT(6)
  586. #define OUTPUT_TYPE_ST_D BIT(7)
  587. #define OUTPUT_TYPE_R BIT(8)
  588. #define OUTPUT_TYPE_R1 BIT(9)
  589. #define OUTPUT_TYPE_SAEC BIT(10)
  590. #define OUTPUT_TYPE_SAFC BIT(11)
  591. #define OUTPUT_TYPE_SAWB BIT(12)
  592. #define OUTPUT_TYPE_IHST BIT(13)
  593. #define OUTPUT_TYPE_CSTA BIT(14)
  594. struct fd_roi_info {
  595. void *info;
  596. int info_len;
  597. };
  598. struct msm_mem_map_info {
  599. uint32_t cookie;
  600. uint32_t length;
  601. uint32_t mem_type;
  602. };
  603. #define MSM_MEM_MMAP 0
  604. #define MSM_MEM_USERPTR 1
  605. #define MSM_PLANE_MAX 8
  606. #define MSM_PLANE_Y 0
  607. #define MSM_PLANE_UV 1
  608. struct msm_frame {
  609. struct timespec ts;
  610. int path;
  611. int type;
  612. unsigned long buffer;
  613. uint32_t phy_offset;
  614. uint32_t y_off;
  615. uint32_t cbcr_off;
  616. uint32_t planar0_off;
  617. uint32_t planar1_off;
  618. uint32_t planar2_off;
  619. int fd;
  620. void *cropinfo;
  621. int croplen;
  622. uint32_t error_code;
  623. struct fd_roi_info roi_info;
  624. uint32_t frame_id;
  625. int stcam_quality_ind;
  626. uint32_t stcam_conv_value;
  627. struct ion_allocation_data ion_alloc;
  628. struct ion_fd_data fd_data;
  629. int ion_dev_fd;
  630. };
  631. enum msm_st_frame_packing {
  632. SIDE_BY_SIDE_HALF,
  633. SIDE_BY_SIDE_FULL,
  634. TOP_DOWN_HALF,
  635. TOP_DOWN_FULL,
  636. };
  637. struct msm_st_crop {
  638. uint32_t in_w;
  639. uint32_t in_h;
  640. uint32_t out_w;
  641. uint32_t out_h;
  642. };
  643. struct msm_st_half {
  644. uint32_t buf_p0_off;
  645. uint32_t buf_p1_off;
  646. uint32_t buf_p0_stride;
  647. uint32_t buf_p1_stride;
  648. uint32_t pix_x_off;
  649. uint32_t pix_y_off;
  650. struct msm_st_crop stCropInfo;
  651. };
  652. struct msm_st_frame {
  653. struct msm_frame buf_info;
  654. int type;
  655. enum msm_st_frame_packing packing;
  656. struct msm_st_half L;
  657. struct msm_st_half R;
  658. int frame_id;
  659. };
  660. #define MSM_CAMERA_ERR_MASK (0xFFFFFFFF & 1)
  661. struct stats_buff {
  662. unsigned long buff;
  663. int fd;
  664. };
  665. struct msm_stats_buf {
  666. uint8_t awb_ymin;
  667. struct stats_buff aec;
  668. struct stats_buff awb;
  669. struct stats_buff af;
  670. struct stats_buff be;
  671. struct stats_buff ihist;
  672. struct stats_buff rs;
  673. struct stats_buff cs;
  674. struct stats_buff skin;
  675. int type;
  676. uint32_t status_bits;
  677. unsigned long buffer;
  678. int fd;
  679. int length;
  680. struct ion_handle *handle;
  681. uint32_t frame_id;
  682. int buf_idx;
  683. };
  684. #define MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT 0
  685. /* video capture mode in VIDIOC_S_PARM */
  686. #define MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW \
  687. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+1)
  688. /* extendedmode for video recording in VIDIOC_S_PARM */
  689. #define MSM_V4L2_EXT_CAPTURE_MODE_VIDEO \
  690. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+2)
  691. /* extendedmode for the full size main image in VIDIOC_S_PARM */
  692. #define MSM_V4L2_EXT_CAPTURE_MODE_MAIN (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+3)
  693. /* extendedmode for the thumb nail image in VIDIOC_S_PARM */
  694. #define MSM_V4L2_EXT_CAPTURE_MODE_THUMBNAIL \
  695. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+4)
  696. /* ISP_PIX_OUTPUT1: no pp, directly send output1 buf to user */
  697. #define MSM_V4L2_EXT_CAPTURE_MODE_ISP_PIX_OUTPUT1 \
  698. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+5)
  699. /* ISP_PIX_OUTPUT2: no pp, directly send output2 buf to user */
  700. #define MSM_V4L2_EXT_CAPTURE_MODE_ISP_PIX_OUTPUT2 \
  701. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+6)
  702. /* raw image type */
  703. #define MSM_V4L2_EXT_CAPTURE_MODE_RAW \
  704. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+7)
  705. /* RDI dump */
  706. #define MSM_V4L2_EXT_CAPTURE_MODE_RDI \
  707. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+8)
  708. /* RDI dump 1 */
  709. #define MSM_V4L2_EXT_CAPTURE_MODE_RDI1 \
  710. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+9)
  711. /* RDI dump 2 */
  712. #define MSM_V4L2_EXT_CAPTURE_MODE_RDI2 \
  713. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+10)
  714. #define MSM_V4L2_EXT_CAPTURE_MODE_AEC \
  715. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+11)
  716. #define MSM_V4L2_EXT_CAPTURE_MODE_AWB \
  717. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+12)
  718. #define MSM_V4L2_EXT_CAPTURE_MODE_AF \
  719. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+13)
  720. #define MSM_V4L2_EXT_CAPTURE_MODE_IHIST \
  721. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+14)
  722. #define MSM_V4L2_EXT_CAPTURE_MODE_CS \
  723. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+15)
  724. #define MSM_V4L2_EXT_CAPTURE_MODE_RS \
  725. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+16)
  726. #define MSM_V4L2_EXT_CAPTURE_MODE_CSTA \
  727. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+17)
  728. #define MSM_V4L2_EXT_CAPTURE_MODE_V2X_LIVESHOT \
  729. (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+18)
  730. #define MSM_V4L2_EXT_CAPTURE_MODE_MAX (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+19)
  731. #define MSM_V4L2_PID_MOTION_ISO V4L2_CID_PRIVATE_BASE
  732. #define MSM_V4L2_PID_EFFECT (V4L2_CID_PRIVATE_BASE+1)
  733. #define MSM_V4L2_PID_HJR (V4L2_CID_PRIVATE_BASE+2)
  734. #define MSM_V4L2_PID_LED_MODE (V4L2_CID_PRIVATE_BASE+3)
  735. #define MSM_V4L2_PID_PREP_SNAPSHOT (V4L2_CID_PRIVATE_BASE+4)
  736. #define MSM_V4L2_PID_EXP_METERING (V4L2_CID_PRIVATE_BASE+5)
  737. #define MSM_V4L2_PID_ISO (V4L2_CID_PRIVATE_BASE+6)
  738. #define MSM_V4L2_PID_CAM_MODE (V4L2_CID_PRIVATE_BASE+7)
  739. #define MSM_V4L2_PID_LUMA_ADAPTATION (V4L2_CID_PRIVATE_BASE+8)
  740. #define MSM_V4L2_PID_BEST_SHOT (V4L2_CID_PRIVATE_BASE+9)
  741. #define MSM_V4L2_PID_FOCUS_MODE (V4L2_CID_PRIVATE_BASE+10)
  742. #define MSM_V4L2_PID_BL_DETECTION (V4L2_CID_PRIVATE_BASE+11)
  743. #define MSM_V4L2_PID_SNOW_DETECTION (V4L2_CID_PRIVATE_BASE+12)
  744. #define MSM_V4L2_PID_CTRL_CMD (V4L2_CID_PRIVATE_BASE+13)
  745. #define MSM_V4L2_PID_EVT_SUB_INFO (V4L2_CID_PRIVATE_BASE+14)
  746. #define MSM_V4L2_PID_STROBE_FLASH (V4L2_CID_PRIVATE_BASE+15)
  747. #define MSM_V4L2_PID_INST_HANDLE (V4L2_CID_PRIVATE_BASE+16)
  748. #define MSM_V4L2_PID_MMAP_INST (V4L2_CID_PRIVATE_BASE+17)
  749. #define MSM_V4L2_PID_PP_PLANE_INFO (V4L2_CID_PRIVATE_BASE+18)
  750. #define MSM_V4L2_PID_MAX MSM_V4L2_PID_PP_PLANE_INFO
  751. /* camera operation mode for video recording - two frame output queues */
  752. #define MSM_V4L2_CAM_OP_DEFAULT 0
  753. /* camera operation mode for video recording - two frame output queues */
  754. #define MSM_V4L2_CAM_OP_PREVIEW (MSM_V4L2_CAM_OP_DEFAULT+1)
  755. /* camera operation mode for video recording - two frame output queues */
  756. #define MSM_V4L2_CAM_OP_VIDEO (MSM_V4L2_CAM_OP_DEFAULT+2)
  757. /* camera operation mode for standard shapshot - two frame output queues */
  758. #define MSM_V4L2_CAM_OP_CAPTURE (MSM_V4L2_CAM_OP_DEFAULT+3)
  759. /* camera operation mode for zsl shapshot - three output queues */
  760. #define MSM_V4L2_CAM_OP_ZSL (MSM_V4L2_CAM_OP_DEFAULT+4)
  761. /* camera operation mode for raw snapshot - one frame output queue */
  762. #define MSM_V4L2_CAM_OP_RAW (MSM_V4L2_CAM_OP_DEFAULT+5)
  763. /* camera operation mode for jpeg snapshot - one frame output queue */
  764. #define MSM_V4L2_CAM_OP_JPEG_CAPTURE (MSM_V4L2_CAM_OP_DEFAULT+6)
  765. #define MSM_V4L2_VID_CAP_TYPE 0
  766. #define MSM_V4L2_STREAM_ON 1
  767. #define MSM_V4L2_STREAM_OFF 2
  768. #define MSM_V4L2_SNAPSHOT 3
  769. #define MSM_V4L2_QUERY_CTRL 4
  770. #define MSM_V4L2_GET_CTRL 5
  771. #define MSM_V4L2_SET_CTRL 6
  772. #define MSM_V4L2_QUERY 7
  773. #define MSM_V4L2_GET_CROP 8
  774. #define MSM_V4L2_SET_CROP 9
  775. #define MSM_V4L2_OPEN 10
  776. #define MSM_V4L2_CLOSE 11
  777. #define MSM_V4L2_SET_CTRL_CMD 12
  778. #define MSM_V4L2_EVT_SUB_MASK 13
  779. #define MSM_V4L2_PRIVATE_CMD 14
  780. #define MSM_V4L2_MAX 15
  781. #define V4L2_CAMERA_EXIT 43
  782. struct crop_info {
  783. void *info;
  784. int len;
  785. };
  786. struct msm_postproc {
  787. int ftnum;
  788. struct msm_frame fthumnail;
  789. int fmnum;
  790. struct msm_frame fmain;
  791. };
  792. struct msm_snapshot_pp_status {
  793. void *status;
  794. };
  795. #define CFG_SET_MODE 0
  796. #define CFG_SET_EFFECT 1
  797. #define CFG_START 2
  798. #define CFG_PWR_UP 3
  799. #define CFG_PWR_DOWN 4
  800. #define CFG_WRITE_EXPOSURE_GAIN 5
  801. #define CFG_SET_DEFAULT_FOCUS 6
  802. #define CFG_MOVE_FOCUS 7
  803. #define CFG_REGISTER_TO_REAL_GAIN 8
  804. #define CFG_REAL_TO_REGISTER_GAIN 9
  805. #define CFG_SET_FPS 10
  806. #define CFG_SET_PICT_FPS 11
  807. #define CFG_SET_BRIGHTNESS 12
  808. #define CFG_SET_CONTRAST 13
  809. #define CFG_SET_ZOOM 14
  810. #define CFG_SET_EXPOSURE_MODE 15
  811. #define CFG_SET_WB 16
  812. #define CFG_SET_ANTIBANDING 17
  813. #define CFG_SET_EXP_GAIN 18
  814. #define CFG_SET_PICT_EXP_GAIN 19
  815. #define CFG_SET_LENS_SHADING 20
  816. #define CFG_GET_PICT_FPS 21
  817. #define CFG_GET_PREV_L_PF 22
  818. #define CFG_GET_PREV_P_PL 23
  819. #define CFG_GET_PICT_L_PF 24
  820. #define CFG_GET_PICT_P_PL 25
  821. #define CFG_GET_AF_MAX_STEPS 26
  822. #define CFG_GET_PICT_MAX_EXP_LC 27
  823. #define CFG_SEND_WB_INFO 28
  824. #define CFG_SENSOR_INIT 29
  825. #define CFG_GET_3D_CALI_DATA 30
  826. #define CFG_GET_CALIB_DATA 31
  827. #define CFG_GET_OUTPUT_INFO 32
  828. #define CFG_GET_EEPROM_INFO 33
  829. #define CFG_GET_EEPROM_DATA 34
  830. #define CFG_SET_ACTUATOR_INFO 35
  831. #define CFG_GET_ACTUATOR_INFO 36
  832. /* TBD: QRD */
  833. #define CFG_SET_SATURATION 37
  834. #define CFG_SET_SHARPNESS 38
  835. #define CFG_SET_TOUCHAEC 39
  836. #define CFG_SET_AUTO_FOCUS 40
  837. #define CFG_SET_AUTOFLASH 41
  838. #define CFG_SET_EXPOSURE_COMPENSATION 42
  839. #define CFG_SET_ISO 43
  840. #define CFG_START_STREAM 44
  841. #define CFG_STOP_STREAM 45
  842. #define CFG_GET_CSI_PARAMS 46
  843. #define CFG_POWER_UP 47
  844. #define CFG_POWER_DOWN 48
  845. #define CFG_WRITE_I2C_ARRAY 49
  846. #define CFG_READ_I2C_ARRAY 50
  847. #define CFG_PCLK_CHANGE 51
  848. #define CFG_CONFIG_VREG_ARRAY 52
  849. #define CFG_CONFIG_CLK_ARRAY 53
  850. #define CFG_GPIO_OP 54
  851. #define CFG_MAX 55
  852. #define MOVE_NEAR 0
  853. #define MOVE_FAR 1
  854. #define SENSOR_PREVIEW_MODE 0
  855. #define SENSOR_SNAPSHOT_MODE 1
  856. #define SENSOR_RAW_SNAPSHOT_MODE 2
  857. #define SENSOR_HFR_60FPS_MODE 3
  858. #define SENSOR_HFR_90FPS_MODE 4
  859. #define SENSOR_HFR_120FPS_MODE 5
  860. #define SENSOR_QTR_SIZE 0
  861. #define SENSOR_FULL_SIZE 1
  862. #define SENSOR_QVGA_SIZE 2
  863. #define SENSOR_INVALID_SIZE 3
  864. #define CAMERA_EFFECT_OFF 0
  865. #define CAMERA_EFFECT_MONO 1
  866. #define CAMERA_EFFECT_NEGATIVE 2
  867. #define CAMERA_EFFECT_SOLARIZE 3
  868. #define CAMERA_EFFECT_SEPIA 4
  869. #define CAMERA_EFFECT_POSTERIZE 5
  870. #define CAMERA_EFFECT_WHITEBOARD 6
  871. #define CAMERA_EFFECT_BLACKBOARD 7
  872. #define CAMERA_EFFECT_AQUA 8
  873. #define CAMERA_EFFECT_EMBOSS 9
  874. #define CAMERA_EFFECT_SKETCH 10
  875. #define CAMERA_EFFECT_NEON 11
  876. #define CAMERA_EFFECT_FADED 12
  877. #define CAMERA_EFFECT_VINTAGECOOL 13
  878. #define CAMERA_EFFECT_VINTAGEWARM 14
  879. #define CAMERA_EFFECT_ACCENT_BLUE 15
  880. #define CAMERA_EFFECT_ACCENT_GREEN 16
  881. #define CAMERA_EFFECT_ACCENT_ORANGE 17
  882. #define CAMERA_EFFECT_MAX 18
  883. /* QRD */
  884. #define CAMERA_EFFECT_BW 10
  885. #define CAMERA_EFFECT_BLUISH 12
  886. #define CAMERA_EFFECT_REDDISH 13
  887. #define CAMERA_EFFECT_GREENISH 14
  888. /* QRD */
  889. #define CAMERA_ANTIBANDING_OFF 0
  890. #define CAMERA_ANTIBANDING_50HZ 2
  891. #define CAMERA_ANTIBANDING_60HZ 1
  892. #define CAMERA_ANTIBANDING_AUTO 3
  893. #define CAMERA_CONTRAST_LV0 0
  894. #define CAMERA_CONTRAST_LV1 1
  895. #define CAMERA_CONTRAST_LV2 2
  896. #define CAMERA_CONTRAST_LV3 3
  897. #define CAMERA_CONTRAST_LV4 4
  898. #define CAMERA_CONTRAST_LV5 5
  899. #define CAMERA_CONTRAST_LV6 6
  900. #define CAMERA_CONTRAST_LV7 7
  901. #define CAMERA_CONTRAST_LV8 8
  902. #define CAMERA_CONTRAST_LV9 9
  903. #define CAMERA_BRIGHTNESS_LV0 0
  904. #define CAMERA_BRIGHTNESS_LV1 1
  905. #define CAMERA_BRIGHTNESS_LV2 2
  906. #define CAMERA_BRIGHTNESS_LV3 3
  907. #define CAMERA_BRIGHTNESS_LV4 4
  908. #define CAMERA_BRIGHTNESS_LV5 5
  909. #define CAMERA_BRIGHTNESS_LV6 6
  910. #define CAMERA_BRIGHTNESS_LV7 7
  911. #define CAMERA_BRIGHTNESS_LV8 8
  912. #define CAMERA_SATURATION_LV0 0
  913. #define CAMERA_SATURATION_LV1 1
  914. #define CAMERA_SATURATION_LV2 2
  915. #define CAMERA_SATURATION_LV3 3
  916. #define CAMERA_SATURATION_LV4 4
  917. #define CAMERA_SATURATION_LV5 5
  918. #define CAMERA_SATURATION_LV6 6
  919. #define CAMERA_SATURATION_LV7 7
  920. #define CAMERA_SATURATION_LV8 8
  921. #define CAMERA_SHARPNESS_LV0 0
  922. #define CAMERA_SHARPNESS_LV1 3
  923. #define CAMERA_SHARPNESS_LV2 6
  924. #define CAMERA_SHARPNESS_LV3 9
  925. #define CAMERA_SHARPNESS_LV4 12
  926. #define CAMERA_SHARPNESS_LV5 15
  927. #define CAMERA_SHARPNESS_LV6 18
  928. #define CAMERA_SHARPNESS_LV7 21
  929. #define CAMERA_SHARPNESS_LV8 24
  930. #define CAMERA_SHARPNESS_LV9 27
  931. #define CAMERA_SHARPNESS_LV10 30
  932. #define CAMERA_SETAE_AVERAGE 0
  933. #define CAMERA_SETAE_CENWEIGHT 1
  934. #define CAMERA_WB_AUTO 1 /* This list must match aeecamera.h */
  935. #define CAMERA_WB_CUSTOM 2
  936. #define CAMERA_WB_INCANDESCENT 3
  937. #define CAMERA_WB_FLUORESCENT 4
  938. #define CAMERA_WB_DAYLIGHT 5
  939. #define CAMERA_WB_CLOUDY_DAYLIGHT 6
  940. #define CAMERA_WB_TWILIGHT 7
  941. #define CAMERA_WB_SHADE 8
  942. #define CAMERA_EXPOSURE_COMPENSATION_LV0 12
  943. #define CAMERA_EXPOSURE_COMPENSATION_LV1 6
  944. #define CAMERA_EXPOSURE_COMPENSATION_LV2 0
  945. #define CAMERA_EXPOSURE_COMPENSATION_LV3 -6
  946. #define CAMERA_EXPOSURE_COMPENSATION_LV4 -12
  947. enum msm_v4l2_saturation_level {
  948. MSM_V4L2_SATURATION_L0,
  949. MSM_V4L2_SATURATION_L1,
  950. MSM_V4L2_SATURATION_L2,
  951. MSM_V4L2_SATURATION_L3,
  952. MSM_V4L2_SATURATION_L4,
  953. MSM_V4L2_SATURATION_L5,
  954. MSM_V4L2_SATURATION_L6,
  955. MSM_V4L2_SATURATION_L7,
  956. MSM_V4L2_SATURATION_L8,
  957. MSM_V4L2_SATURATION_L9,
  958. MSM_V4L2_SATURATION_L10,
  959. };
  960. enum msm_v4l2_contrast_level {
  961. MSM_V4L2_CONTRAST_L0,
  962. MSM_V4L2_CONTRAST_L1,
  963. MSM_V4L2_CONTRAST_L2,
  964. MSM_V4L2_CONTRAST_L3,
  965. MSM_V4L2_CONTRAST_L4,
  966. MSM_V4L2_CONTRAST_L5,
  967. MSM_V4L2_CONTRAST_L6,
  968. MSM_V4L2_CONTRAST_L7,
  969. MSM_V4L2_CONTRAST_L8,
  970. MSM_V4L2_CONTRAST_L9,
  971. MSM_V4L2_CONTRAST_L10,
  972. };
  973. enum msm_v4l2_exposure_level {
  974. MSM_V4L2_EXPOSURE_N2,
  975. MSM_V4L2_EXPOSURE_N1,
  976. MSM_V4L2_EXPOSURE_D,
  977. MSM_V4L2_EXPOSURE_P1,
  978. MSM_V4L2_EXPOSURE_P2,
  979. };
  980. enum msm_v4l2_sharpness_level {
  981. MSM_V4L2_SHARPNESS_L0,
  982. MSM_V4L2_SHARPNESS_L1,
  983. MSM_V4L2_SHARPNESS_L2,
  984. MSM_V4L2_SHARPNESS_L3,
  985. MSM_V4L2_SHARPNESS_L4,
  986. MSM_V4L2_SHARPNESS_L5,
  987. MSM_V4L2_SHARPNESS_L6,
  988. };
  989. enum msm_v4l2_expo_metering_mode {
  990. MSM_V4L2_EXP_FRAME_AVERAGE,
  991. MSM_V4L2_EXP_CENTER_WEIGHTED,
  992. MSM_V4L2_EXP_SPOT_METERING,
  993. };
  994. enum msm_v4l2_iso_mode {
  995. MSM_V4L2_ISO_AUTO = 0,
  996. MSM_V4L2_ISO_DEBLUR,
  997. MSM_V4L2_ISO_100,
  998. MSM_V4L2_ISO_200,
  999. MSM_V4L2_ISO_400,
  1000. MSM_V4L2_ISO_800,
  1001. MSM_V4L2_ISO_1600,
  1002. };
  1003. enum msm_v4l2_wb_mode {
  1004. MSM_V4L2_WB_OFF,
  1005. MSM_V4L2_WB_AUTO ,
  1006. MSM_V4L2_WB_CUSTOM,
  1007. MSM_V4L2_WB_INCANDESCENT,
  1008. MSM_V4L2_WB_FLUORESCENT,
  1009. MSM_V4L2_WB_DAYLIGHT,
  1010. MSM_V4L2_WB_CLOUDY_DAYLIGHT,
  1011. };
  1012. enum msm_v4l2_special_effect {
  1013. MSM_V4L2_EFFECT_OFF,
  1014. MSM_V4L2_EFFECT_MONO,
  1015. MSM_V4L2_EFFECT_NEGATIVE,
  1016. MSM_V4L2_EFFECT_SOLARIZE,
  1017. MSM_V4L2_EFFECT_SEPIA,
  1018. MSM_V4L2_EFFECT_POSTERAIZE,
  1019. MSM_V4L2_EFFECT_WHITEBOARD,
  1020. MSM_V4L2_EFFECT_BLACKBOARD,
  1021. MSM_V4L2_EFFECT_AQUA,
  1022. MSM_V4L2_EFFECT_EMBOSS,
  1023. MSM_V4L2_EFFECT_SKETCH,
  1024. MSM_V4L2_EFFECT_NEON,
  1025. MSM_V4L2_EFFECT_MAX,
  1026. };
  1027. enum msm_v4l2_power_line_frequency {
  1028. MSM_V4L2_POWER_LINE_OFF,
  1029. MSM_V4L2_POWER_LINE_60HZ,
  1030. MSM_V4L2_POWER_LINE_50HZ,
  1031. MSM_V4L2_POWER_LINE_AUTO,
  1032. };
  1033. #define CAMERA_ISO_TYPE_AUTO 0
  1034. #define CAMEAR_ISO_TYPE_HJR 1
  1035. #define CAMEAR_ISO_TYPE_100 2
  1036. #define CAMERA_ISO_TYPE_200 3
  1037. #define CAMERA_ISO_TYPE_400 4
  1038. #define CAMEAR_ISO_TYPE_800 5
  1039. #define CAMERA_ISO_TYPE_1600 6
  1040. struct sensor_pict_fps {
  1041. uint16_t prevfps;
  1042. uint16_t pictfps;
  1043. };
  1044. struct exp_gain_cfg {
  1045. uint16_t gain;
  1046. uint32_t line;
  1047. };
  1048. struct focus_cfg {
  1049. int32_t steps;
  1050. int dir;
  1051. };
  1052. struct fps_cfg {
  1053. uint16_t f_mult;
  1054. uint16_t fps_div;
  1055. uint32_t pict_fps_div;
  1056. };
  1057. struct wb_info_cfg {
  1058. uint16_t red_gain;
  1059. uint16_t green_gain;
  1060. uint16_t blue_gain;
  1061. };
  1062. struct sensor_3d_exp_cfg {
  1063. uint16_t gain;
  1064. uint32_t line;
  1065. uint16_t r_gain;
  1066. uint16_t b_gain;
  1067. uint16_t gr_gain;
  1068. uint16_t gb_gain;
  1069. uint16_t gain_adjust;
  1070. };
  1071. struct sensor_3d_cali_data_t{
  1072. unsigned char left_p_matrix[3][4][8];
  1073. unsigned char right_p_matrix[3][4][8];
  1074. unsigned char square_len[8];
  1075. unsigned char focal_len[8];
  1076. unsigned char pixel_pitch[8];
  1077. uint16_t left_r;
  1078. uint16_t left_b;
  1079. uint16_t left_gb;
  1080. uint16_t left_af_far;
  1081. uint16_t left_af_mid;
  1082. uint16_t left_af_short;
  1083. uint16_t left_af_5um;
  1084. uint16_t left_af_50up;
  1085. uint16_t left_af_50down;
  1086. uint16_t right_r;
  1087. uint16_t right_b;
  1088. uint16_t right_gb;
  1089. uint16_t right_af_far;
  1090. uint16_t right_af_mid;
  1091. uint16_t right_af_short;
  1092. uint16_t right_af_5um;
  1093. uint16_t right_af_50up;
  1094. uint16_t right_af_50down;
  1095. };
  1096. struct sensor_init_cfg {
  1097. uint8_t prev_res;
  1098. uint8_t pict_res;
  1099. };
  1100. struct sensor_calib_data {
  1101. /* Color Related Measurements */
  1102. uint16_t r_over_g;
  1103. uint16_t b_over_g;
  1104. uint16_t gr_over_gb;
  1105. /* Lens Related Measurements */
  1106. uint16_t macro_2_inf;
  1107. uint16_t inf_2_macro;
  1108. uint16_t stroke_amt;
  1109. uint16_t af_pos_1m;
  1110. uint16_t af_pos_inf;
  1111. };
  1112. enum msm_sensor_resolution_t {
  1113. MSM_SENSOR_RES_FULL,
  1114. MSM_SENSOR_RES_QTR,
  1115. MSM_SENSOR_RES_2,
  1116. MSM_SENSOR_RES_3,
  1117. MSM_SENSOR_RES_4,
  1118. MSM_SENSOR_RES_5,
  1119. MSM_SENSOR_RES_6,
  1120. MSM_SENSOR_RES_7,
  1121. MSM_SENSOR_INVALID_RES,
  1122. };
  1123. struct msm_sensor_output_info_t {
  1124. uint16_t x_output;
  1125. uint16_t y_output;
  1126. uint16_t line_length_pclk;
  1127. uint16_t frame_length_lines;
  1128. uint32_t vt_pixel_clk;
  1129. uint32_t op_pixel_clk;
  1130. uint16_t binning_factor;
  1131. };
  1132. struct sensor_output_info_t {
  1133. struct msm_sensor_output_info_t *output_info;
  1134. uint16_t num_info;
  1135. };
  1136. struct msm_sensor_exp_gain_info_t {
  1137. uint16_t coarse_int_time_addr;
  1138. uint16_t global_gain_addr;
  1139. uint16_t vert_offset;
  1140. };
  1141. struct msm_sensor_output_reg_addr_t {
  1142. uint16_t x_output;
  1143. uint16_t y_output;
  1144. uint16_t line_length_pclk;
  1145. uint16_t frame_length_lines;
  1146. };
  1147. struct sensor_driver_params_type {
  1148. struct msm_camera_i2c_reg_setting *init_settings;
  1149. uint16_t init_settings_size;
  1150. struct msm_camera_i2c_reg_setting *mode_settings;
  1151. uint16_t mode_settings_size;
  1152. struct msm_sensor_output_reg_addr_t *sensor_output_reg_addr;
  1153. struct msm_camera_i2c_reg_setting *start_settings;
  1154. struct msm_camera_i2c_reg_setting *stop_settings;
  1155. struct msm_camera_i2c_reg_setting *groupon_settings;
  1156. struct msm_camera_i2c_reg_setting *groupoff_settings;
  1157. struct msm_sensor_exp_gain_info_t *sensor_exp_gain_info;
  1158. struct msm_sensor_output_info_t *output_info;
  1159. };
  1160. struct mirror_flip {
  1161. int32_t x_mirror;
  1162. int32_t y_flip;
  1163. };
  1164. struct cord {
  1165. uint32_t x;
  1166. uint32_t y;
  1167. };
  1168. struct msm_eeprom_data_t {
  1169. void *eeprom_data;
  1170. uint16_t index;
  1171. };
  1172. struct msm_camera_csid_vc_cfg {
  1173. uint8_t cid;
  1174. uint8_t dt;
  1175. uint8_t decode_format;
  1176. };
  1177. struct csi_lane_params_t {
  1178. uint16_t csi_lane_assign;
  1179. uint8_t csi_lane_mask;
  1180. uint8_t csi_if;
  1181. uint8_t csid_core[2];
  1182. uint8_t csi_phy_sel;
  1183. };
  1184. struct msm_camera_csid_lut_params {
  1185. uint8_t num_cid;
  1186. struct msm_camera_csid_vc_cfg *vc_cfg;
  1187. };
  1188. struct msm_camera_csid_params {
  1189. uint8_t lane_cnt;
  1190. uint16_t lane_assign;
  1191. uint8_t phy_sel;
  1192. struct msm_camera_csid_lut_params lut_params;
  1193. };
  1194. struct msm_camera_csiphy_params {
  1195. uint8_t lane_cnt;
  1196. uint8_t settle_cnt;
  1197. uint16_t lane_mask;
  1198. uint8_t combo_mode;
  1199. uint8_t csid_core;
  1200. };
  1201. struct msm_camera_csi2_params {
  1202. struct msm_camera_csid_params csid_params;
  1203. struct msm_camera_csiphy_params csiphy_params;
  1204. };
  1205. enum msm_camera_csi_data_format {
  1206. CSI_8BIT,
  1207. CSI_10BIT,
  1208. CSI_12BIT,
  1209. };
  1210. struct msm_camera_csi_params {
  1211. enum msm_camera_csi_data_format data_format;
  1212. uint8_t lane_cnt;
  1213. uint8_t lane_assign;
  1214. uint8_t settle_cnt;
  1215. uint8_t dpcm_scheme;
  1216. };
  1217. enum csic_cfg_type_t {
  1218. CSIC_INIT,
  1219. CSIC_CFG,
  1220. };
  1221. struct csic_cfg_data {
  1222. enum csic_cfg_type_t cfgtype;
  1223. struct msm_camera_csi_params *csic_params;
  1224. };
  1225. enum csid_cfg_type_t {
  1226. CSID_INIT,
  1227. CSID_CFG,
  1228. };
  1229. struct csid_cfg_data {
  1230. enum csid_cfg_type_t cfgtype;
  1231. union {
  1232. uint32_t csid_version;
  1233. struct msm_camera_csid_params *csid_params;
  1234. } cfg;
  1235. };
  1236. enum csiphy_cfg_type_t {
  1237. CSIPHY_INIT,
  1238. CSIPHY_CFG,
  1239. };
  1240. struct csiphy_cfg_data {
  1241. enum csiphy_cfg_type_t cfgtype;
  1242. struct msm_camera_csiphy_params *csiphy_params;
  1243. };
  1244. #define CSI_EMBED_DATA 0x12
  1245. #define CSI_RESERVED_DATA_0 0x13
  1246. #define CSI_YUV422_8 0x1E
  1247. #define CSI_RAW8 0x2A
  1248. #define CSI_RAW10 0x2B
  1249. #define CSI_RAW12 0x2C
  1250. #define CSI_DECODE_6BIT 0
  1251. #define CSI_DECODE_8BIT 1
  1252. #define CSI_DECODE_10BIT 2
  1253. #define CSI_DECODE_DPCM_10_8_10 5
  1254. #define ISPIF_STREAM(intf, action, vfe) (((intf)<<ISPIF_S_STREAM_SHIFT)+\
  1255. (action)+((vfe)<<ISPIF_VFE_INTF_SHIFT))
  1256. #define ISPIF_ON_FRAME_BOUNDARY (0x01 << 0)
  1257. #define ISPIF_OFF_FRAME_BOUNDARY (0x01 << 1)
  1258. #define ISPIF_OFF_IMMEDIATELY (0x01 << 2)
  1259. #define ISPIF_S_STREAM_SHIFT 4
  1260. #define ISPIF_VFE_INTF_SHIFT 12
  1261. #define PIX_0 (0x01 << 0)
  1262. #define RDI_0 (0x01 << 1)
  1263. #define PIX_1 (0x01 << 2)
  1264. #define RDI_1 (0x01 << 3)
  1265. #define RDI_2 (0x01 << 4)
  1266. enum msm_ispif_vfe_intf {
  1267. VFE0,
  1268. VFE1,
  1269. VFE_MAX,
  1270. };
  1271. enum msm_ispif_intftype {
  1272. PIX0,
  1273. RDI0,
  1274. PIX1,
  1275. RDI1,
  1276. RDI2,
  1277. INTF_MAX,
  1278. };
  1279. enum msm_ispif_vc {
  1280. VC0,
  1281. VC1,
  1282. VC2,
  1283. VC3,
  1284. };
  1285. enum msm_ispif_cid {
  1286. CID0,
  1287. CID1,
  1288. CID2,
  1289. CID3,
  1290. CID4,
  1291. CID5,
  1292. CID6,
  1293. CID7,
  1294. CID8,
  1295. CID9,
  1296. CID10,
  1297. CID11,
  1298. CID12,
  1299. CID13,
  1300. CID14,
  1301. CID15,
  1302. };
  1303. struct msm_ispif_params {
  1304. uint8_t intftype;
  1305. uint16_t cid_mask;
  1306. uint8_t csid;
  1307. uint8_t vfe_intf;
  1308. };
  1309. struct msm_ispif_params_list {
  1310. uint32_t len;
  1311. struct msm_ispif_params params[4];
  1312. };
  1313. enum ispif_cfg_type_t {
  1314. ISPIF_INIT,
  1315. ISPIF_SET_CFG,
  1316. ISPIF_SET_ON_FRAME_BOUNDARY,
  1317. ISPIF_SET_OFF_FRAME_BOUNDARY,
  1318. ISPIF_SET_OFF_IMMEDIATELY,
  1319. ISPIF_RELEASE,
  1320. };
  1321. struct ispif_cfg_data {
  1322. enum ispif_cfg_type_t cfgtype;
  1323. union {
  1324. uint32_t csid_version;
  1325. int cmd;
  1326. struct msm_ispif_params_list ispif_params;
  1327. } cfg;
  1328. };
  1329. enum msm_camera_i2c_reg_addr_type {
  1330. MSM_CAMERA_I2C_BYTE_ADDR = 1,
  1331. MSM_CAMERA_I2C_WORD_ADDR,
  1332. MSM_CAMERA_I2C_3B_ADDR,
  1333. };
  1334. struct msm_camera_i2c_reg_array {
  1335. uint16_t reg_addr;
  1336. uint16_t reg_data;
  1337. #if !defined(BYPASS_COMPANION) && defined(CONFIG_MSMB_CAMERA_MM)
  1338. uint8_t data_type;
  1339. uint32_t delay;
  1340. #endif
  1341. };
  1342. enum msm_camera_i2c_data_type {
  1343. MSM_CAMERA_I2C_BYTE_DATA = 1,
  1344. MSM_CAMERA_I2C_WORD_DATA,
  1345. MSM_CAMERA_I2C_SET_BYTE_MASK,
  1346. MSM_CAMERA_I2C_UNSET_BYTE_MASK,
  1347. MSM_CAMERA_I2C_SET_WORD_MASK,
  1348. MSM_CAMERA_I2C_UNSET_WORD_MASK,
  1349. MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA,
  1350. };
  1351. struct msm_camera_i2c_reg_setting {
  1352. struct msm_camera_i2c_reg_array *reg_setting;
  1353. uint16_t size;
  1354. enum msm_camera_i2c_reg_addr_type addr_type;
  1355. enum msm_camera_i2c_data_type data_type;
  1356. uint16_t delay;
  1357. };
  1358. enum oem_setting_type {
  1359. I2C_READ = 1,
  1360. I2C_WRITE,
  1361. GPIO_OP,
  1362. EEPROM_READ,
  1363. VREG_SET,
  1364. CLK_SET,
  1365. };
  1366. struct sensor_oem_setting {
  1367. enum oem_setting_type type;
  1368. void *data;
  1369. };
  1370. enum camera_vreg_type {
  1371. REG_LDO,
  1372. REG_VS,
  1373. REG_GPIO,
  1374. };
  1375. enum msm_camera_vreg_name_t {
  1376. CAM_VDIG,
  1377. CAM_VIO,
  1378. CAM_VANA,
  1379. CAM_VAF,
  1380. CAM_VREG_MAX,
  1381. };
  1382. struct msm_camera_csi_lane_params {
  1383. uint16_t csi_lane_assign;
  1384. uint16_t csi_lane_mask;
  1385. };
  1386. struct camera_vreg_t {
  1387. const char *reg_name;
  1388. enum camera_vreg_type type;
  1389. int min_voltage;
  1390. int max_voltage;
  1391. int op_mode;
  1392. uint32_t delay;
  1393. };
  1394. struct msm_camera_vreg_setting {
  1395. struct camera_vreg_t *cam_vreg;
  1396. uint16_t num_vreg;
  1397. uint8_t enable;
  1398. };
  1399. struct msm_cam_clk_info {
  1400. const char *clk_name;
  1401. long clk_rate;
  1402. uint32_t delay;
  1403. };
  1404. struct msm_cam_clk_setting {
  1405. struct msm_cam_clk_info *clk_info;
  1406. uint16_t num_clk_info;
  1407. uint8_t enable;
  1408. };
  1409. struct sensor_cfg_data {
  1410. int cfgtype;
  1411. int mode;
  1412. int rs;
  1413. uint8_t max_steps;
  1414. union {
  1415. int8_t effect;
  1416. uint8_t lens_shading;
  1417. uint16_t prevl_pf;
  1418. uint16_t prevp_pl;
  1419. uint16_t pictl_pf;
  1420. uint16_t pictp_pl;
  1421. uint32_t pict_max_exp_lc;
  1422. uint16_t p_fps;
  1423. uint8_t iso_type;
  1424. struct sensor_init_cfg init_info;
  1425. struct sensor_pict_fps gfps;
  1426. struct exp_gain_cfg exp_gain;
  1427. struct focus_cfg focus;
  1428. struct fps_cfg fps;
  1429. struct wb_info_cfg wb_info;
  1430. struct sensor_3d_exp_cfg sensor_3d_exp;
  1431. struct sensor_calib_data calib_info;
  1432. struct sensor_output_info_t output_info;
  1433. struct msm_eeprom_data_t eeprom_data;
  1434. struct csi_lane_params_t csi_lane_params;
  1435. /* QRD */
  1436. uint16_t antibanding;
  1437. uint8_t contrast;
  1438. uint8_t saturation;
  1439. uint8_t sharpness;
  1440. int8_t brightness;
  1441. int ae_mode;
  1442. uint8_t wb_val;
  1443. int8_t exp_compensation;
  1444. uint32_t pclk;
  1445. struct cord aec_cord;
  1446. int is_autoflash;
  1447. struct mirror_flip mirror_flip;
  1448. void *setting;
  1449. } cfg;
  1450. };
  1451. enum gpio_operation_type {
  1452. GPIO_REQUEST,
  1453. GPIO_FREE,
  1454. GPIO_SET_DIRECTION_OUTPUT,
  1455. GPIO_SET_DIRECTION_INPUT,
  1456. GPIO_GET_VALUE,
  1457. GPIO_SET_VALUE,
  1458. };
  1459. struct msm_cam_gpio_operation {
  1460. enum gpio_operation_type op_type;
  1461. unsigned address;
  1462. int value;
  1463. const char *tag;
  1464. };
  1465. struct damping_params_t {
  1466. uint32_t damping_step;
  1467. uint32_t damping_delay;
  1468. uint32_t hw_params;
  1469. };
  1470. enum actuator_type {
  1471. ACTUATOR_VCM,
  1472. ACTUATOR_PIEZO,
  1473. };
  1474. enum msm_actuator_data_type {
  1475. MSM_ACTUATOR_BYTE_DATA = 1,
  1476. MSM_ACTUATOR_WORD_DATA,
  1477. };
  1478. enum msm_actuator_addr_type {
  1479. MSM_ACTUATOR_BYTE_ADDR = 1,
  1480. MSM_ACTUATOR_WORD_ADDR,
  1481. };
  1482. enum msm_actuator_write_type {
  1483. MSM_ACTUATOR_WRITE_HW_DAMP,
  1484. MSM_ACTUATOR_WRITE_DAC,
  1485. };
  1486. struct msm_actuator_reg_params_t {
  1487. enum msm_actuator_write_type reg_write_type;
  1488. uint32_t hw_mask;
  1489. uint16_t reg_addr;
  1490. uint16_t hw_shift;
  1491. uint16_t data_shift;
  1492. };
  1493. struct reg_settings_t {
  1494. uint16_t reg_addr;
  1495. uint16_t reg_data;
  1496. };
  1497. struct region_params_t {
  1498. /* [0] = ForwardDirection Macro boundary
  1499. [1] = ReverseDirection Inf boundary
  1500. */
  1501. uint16_t step_bound[2];
  1502. uint16_t code_per_step;
  1503. };
  1504. struct msm_actuator_move_params_t {
  1505. int8_t dir;
  1506. int8_t sign_dir;
  1507. int16_t dest_step_pos;
  1508. int32_t num_steps;
  1509. struct damping_params_t *ringing_params;
  1510. };
  1511. struct msm_actuator_tuning_params_t {
  1512. int16_t initial_code;
  1513. uint16_t pwd_step;
  1514. uint16_t region_size;
  1515. uint32_t total_steps;
  1516. struct region_params_t *region_params;
  1517. };
  1518. struct msm_actuator_params_t {
  1519. enum actuator_type act_type;
  1520. uint8_t reg_tbl_size;
  1521. uint16_t data_size;
  1522. uint16_t init_setting_size;
  1523. uint32_t i2c_addr;
  1524. enum msm_actuator_addr_type i2c_addr_type;
  1525. enum msm_actuator_data_type i2c_data_type;
  1526. struct msm_actuator_reg_params_t *reg_tbl_params;
  1527. struct reg_settings_t *init_settings;
  1528. };
  1529. struct msm_actuator_set_info_t {
  1530. struct msm_actuator_params_t actuator_params;
  1531. struct msm_actuator_tuning_params_t af_tuning_params;
  1532. };
  1533. struct msm_actuator_get_info_t {
  1534. uint32_t focal_length_num;
  1535. uint32_t focal_length_den;
  1536. uint32_t f_number_num;
  1537. uint32_t f_number_den;
  1538. uint32_t f_pix_num;
  1539. uint32_t f_pix_den;
  1540. uint32_t total_f_dist_num;
  1541. uint32_t total_f_dist_den;
  1542. uint32_t hor_view_angle_num;
  1543. uint32_t hor_view_angle_den;
  1544. uint32_t ver_view_angle_num;
  1545. uint32_t ver_view_angle_den;
  1546. };
  1547. enum af_camera_name {
  1548. ACTUATOR_MAIN_CAM_0,
  1549. ACTUATOR_MAIN_CAM_1,
  1550. ACTUATOR_MAIN_CAM_2,
  1551. ACTUATOR_MAIN_CAM_3,
  1552. ACTUATOR_MAIN_CAM_4,
  1553. ACTUATOR_MAIN_CAM_5,
  1554. ACTUATOR_WEB_CAM_0,
  1555. ACTUATOR_WEB_CAM_1,
  1556. ACTUATOR_WEB_CAM_2,
  1557. };
  1558. struct msm_actuator_cfg_data {
  1559. int cfgtype;
  1560. uint8_t is_af_supported;
  1561. union {
  1562. struct msm_actuator_move_params_t move;
  1563. struct msm_actuator_set_info_t set_info;
  1564. struct msm_actuator_get_info_t get_info;
  1565. enum af_camera_name cam_name;
  1566. } cfg;
  1567. };
  1568. struct msm_eeprom_support {
  1569. uint16_t is_supported;
  1570. uint16_t size;
  1571. uint16_t index;
  1572. uint16_t qvalue;
  1573. };
  1574. struct msm_calib_wb {
  1575. uint16_t r_over_g;
  1576. uint16_t b_over_g;
  1577. uint16_t gr_over_gb;
  1578. };
  1579. struct msm_calib_af {
  1580. uint16_t macro_dac;
  1581. uint16_t inf_dac;
  1582. uint16_t start_dac;
  1583. };
  1584. struct msm_calib_lsc {
  1585. uint16_t r_gain[221];
  1586. uint16_t b_gain[221];
  1587. uint16_t gr_gain[221];
  1588. uint16_t gb_gain[221];
  1589. };
  1590. struct pixel_t {
  1591. int x;
  1592. int y;
  1593. };
  1594. struct msm_calib_dpc {
  1595. uint16_t validcount;
  1596. struct pixel_t snapshot_coord[128];
  1597. struct pixel_t preview_coord[128];
  1598. struct pixel_t video_coord[128];
  1599. };
  1600. struct msm_calib_raw {
  1601. uint8_t *data;
  1602. uint32_t size;
  1603. };
  1604. struct msm_camera_eeprom_info_t {
  1605. struct msm_eeprom_support af;
  1606. struct msm_eeprom_support wb;
  1607. struct msm_eeprom_support lsc;
  1608. struct msm_eeprom_support dpc;
  1609. struct msm_eeprom_support raw;
  1610. };
  1611. struct msm_eeprom_cfg_data {
  1612. int cfgtype;
  1613. uint8_t is_eeprom_supported;
  1614. union {
  1615. struct msm_eeprom_data_t get_data;
  1616. struct msm_camera_eeprom_info_t get_info;
  1617. } cfg;
  1618. };
  1619. struct sensor_large_data {
  1620. int cfgtype;
  1621. union {
  1622. struct sensor_3d_cali_data_t sensor_3d_cali_data;
  1623. } data;
  1624. };
  1625. enum sensor_type_t {
  1626. BAYER,
  1627. YUV,
  1628. JPEG_SOC,
  1629. };
  1630. enum flash_type {
  1631. LED_FLASH,
  1632. STROBE_FLASH,
  1633. };
  1634. enum strobe_flash_ctrl_type {
  1635. STROBE_FLASH_CTRL_INIT,
  1636. STROBE_FLASH_CTRL_CHARGE,
  1637. STROBE_FLASH_CTRL_RELEASE
  1638. };
  1639. struct strobe_flash_ctrl_data {
  1640. enum strobe_flash_ctrl_type type;
  1641. int charge_en;
  1642. };
  1643. struct msm_camera_info {
  1644. int num_cameras;
  1645. uint8_t has_3d_support[MSM_MAX_CAMERA_SENSORS];
  1646. uint8_t is_internal_cam[MSM_MAX_CAMERA_SENSORS];
  1647. uint32_t s_mount_angle[MSM_MAX_CAMERA_SENSORS];
  1648. const char *video_dev_name[MSM_MAX_CAMERA_SENSORS];
  1649. enum sensor_type_t sensor_type[MSM_MAX_CAMERA_SENSORS];
  1650. };
  1651. struct msm_cam_config_dev_info {
  1652. int num_config_nodes;
  1653. const char *config_dev_name[MSM_MAX_CAMERA_CONFIGS];
  1654. int config_dev_id[MSM_MAX_CAMERA_CONFIGS];
  1655. };
  1656. struct msm_mctl_node_info {
  1657. int num_mctl_nodes;
  1658. const char *mctl_node_name[MSM_MAX_CAMERA_SENSORS];
  1659. };
  1660. struct flash_ctrl_data {
  1661. int flashtype;
  1662. union {
  1663. int led_state;
  1664. struct strobe_flash_ctrl_data strobe_ctrl;
  1665. } ctrl_data;
  1666. };
  1667. #define GET_NAME 0
  1668. #define GET_PREVIEW_LINE_PER_FRAME 1
  1669. #define GET_PREVIEW_PIXELS_PER_LINE 2
  1670. #define GET_SNAPSHOT_LINE_PER_FRAME 3
  1671. #define GET_SNAPSHOT_PIXELS_PER_LINE 4
  1672. #define GET_SNAPSHOT_FPS 5
  1673. #define GET_SNAPSHOT_MAX_EP_LINE_CNT 6
  1674. struct msm_camsensor_info {
  1675. char name[MAX_SENSOR_NAME];
  1676. uint8_t flash_enabled;
  1677. uint8_t strobe_flash_enabled;
  1678. uint8_t actuator_enabled;
  1679. uint8_t ispif_supported;
  1680. int8_t total_steps;
  1681. uint8_t support_3d;
  1682. enum flash_type flashtype;
  1683. enum sensor_type_t sensor_type;
  1684. uint32_t pxlcode; /* enum v4l2_mbus_pixelcode */
  1685. uint32_t camera_type; /* msm_camera_type */
  1686. int mount_angle;
  1687. uint32_t max_width;
  1688. uint32_t max_height;
  1689. };
  1690. #define V4L2_SINGLE_PLANE 0
  1691. #define V4L2_MULTI_PLANE_Y 0
  1692. #define V4L2_MULTI_PLANE_CBCR 1
  1693. #define V4L2_MULTI_PLANE_CB 1
  1694. #define V4L2_MULTI_PLANE_CR 2
  1695. struct plane_data {
  1696. int plane_id;
  1697. uint32_t offset;
  1698. unsigned long size;
  1699. };
  1700. struct img_plane_info {
  1701. uint32_t width;
  1702. uint32_t height;
  1703. uint32_t pixelformat;
  1704. uint8_t buffer_type; /*Single/Multi planar*/
  1705. uint8_t output_port;
  1706. uint32_t ext_mode;
  1707. uint8_t num_planes;
  1708. struct plane_data plane[MAX_PLANES];
  1709. uint32_t sp_y_offset;
  1710. uint32_t inst_handle;
  1711. };
  1712. #define QCAMERA_NAME "qcamera"
  1713. #define QCAMERA_SERVER_NAME "qcamera_server"
  1714. #define QCAMERA_DEVICE_GROUP_ID 1
  1715. #define QCAMERA_VNODE_GROUP_ID 2
  1716. enum msm_cam_subdev_type {
  1717. CSIPHY_DEV,
  1718. CSID_DEV,
  1719. CSIC_DEV,
  1720. ISPIF_DEV,
  1721. VFE_DEV,
  1722. AXI_DEV,
  1723. VPE_DEV,
  1724. SENSOR_DEV,
  1725. ACTUATOR_DEV,
  1726. EEPROM_DEV,
  1727. GESTURE_DEV,
  1728. IRQ_ROUTER_DEV,
  1729. CPP_DEV,
  1730. CCI_DEV,
  1731. FLASH_DEV,
  1732. };
  1733. struct msm_mctl_set_sdev_data {
  1734. uint32_t revision;
  1735. enum msm_cam_subdev_type sdev_type;
  1736. };
  1737. #define MSM_CAM_V4L2_IOCTL_GET_CAMERA_INFO \
  1738. _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct msm_camera_v4l2_ioctl_t)
  1739. #define MSM_CAM_V4L2_IOCTL_GET_CONFIG_INFO \
  1740. _IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct msm_camera_v4l2_ioctl_t)
  1741. #define MSM_CAM_V4L2_IOCTL_GET_MCTL_INFO \
  1742. _IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct msm_camera_v4l2_ioctl_t)
  1743. #define MSM_CAM_V4L2_IOCTL_CTRL_CMD_DONE \
  1744. _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct msm_camera_v4l2_ioctl_t)
  1745. #define MSM_CAM_V4L2_IOCTL_GET_EVENT_PAYLOAD \
  1746. _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct msm_camera_v4l2_ioctl_t)
  1747. #define MSM_CAM_IOCTL_SEND_EVENT \
  1748. _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct v4l2_event)
  1749. #define MSM_CAM_V4L2_IOCTL_CFG_VPE \
  1750. _IOWR('V', BASE_VIDIOC_PRIVATE + 7, struct msm_vpe_cfg_cmd)
  1751. #define MSM_CAM_V4L2_IOCTL_PRIVATE_S_CTRL \
  1752. _IOWR('V', BASE_VIDIOC_PRIVATE + 8, struct msm_camera_v4l2_ioctl_t)
  1753. #define MSM_CAM_V4L2_IOCTL_PRIVATE_G_CTRL \
  1754. _IOWR('V', BASE_VIDIOC_PRIVATE + 9, struct msm_camera_v4l2_ioctl_t)
  1755. #define MSM_CAM_V4L2_IOCTL_PRIVATE_GENERAL \
  1756. _IOW('V', BASE_VIDIOC_PRIVATE + 10, struct msm_camera_v4l2_ioctl_t)
  1757. #define VIDIOC_MSM_VPE_INIT \
  1758. _IO('V', BASE_VIDIOC_PRIVATE + 15)
  1759. #define VIDIOC_MSM_VPE_RELEASE \
  1760. _IO('V', BASE_VIDIOC_PRIVATE + 16)
  1761. #define VIDIOC_MSM_VPE_CFG \
  1762. _IOWR('V', BASE_VIDIOC_PRIVATE + 17, struct msm_mctl_pp_params *)
  1763. #define VIDIOC_MSM_AXI_INIT \
  1764. _IOWR('V', BASE_VIDIOC_PRIVATE + 18, uint8_t *)
  1765. #define VIDIOC_MSM_AXI_RELEASE \
  1766. _IO('V', BASE_VIDIOC_PRIVATE + 19)
  1767. #define VIDIOC_MSM_AXI_CFG \
  1768. _IOWR('V', BASE_VIDIOC_PRIVATE + 20, void *)
  1769. #define VIDIOC_MSM_AXI_IRQ \
  1770. _IOWR('V', BASE_VIDIOC_PRIVATE + 21, void *)
  1771. #define VIDIOC_MSM_AXI_BUF_CFG \
  1772. _IOWR('V', BASE_VIDIOC_PRIVATE + 22, void *)
  1773. #define VIDIOC_MSM_AXI_RDI_COUNT_UPDATE \
  1774. _IOWR('V', BASE_VIDIOC_PRIVATE + 23, struct rdi_count_msg)
  1775. #define VIDIOC_MSM_VFE_INIT \
  1776. _IO('V', BASE_VIDIOC_PRIVATE + 24)
  1777. #define VIDIOC_MSM_VFE_RELEASE \
  1778. _IO('V', BASE_VIDIOC_PRIVATE + 25)
  1779. struct msm_camera_v4l2_ioctl_t {
  1780. uint32_t id;
  1781. uint32_t len;
  1782. uint32_t trans_code;
  1783. void __user *ioctl_ptr;
  1784. };
  1785. struct msm_camera_vfe_params_t {
  1786. uint32_t operation_mode;
  1787. uint32_t capture_count;
  1788. uint8_t skip_reset;
  1789. uint8_t stop_immediately;
  1790. uint16_t port_info;
  1791. uint32_t inst_handle;
  1792. uint16_t cmd_type;
  1793. };
  1794. enum msm_camss_irq_idx {
  1795. CAMERA_SS_IRQ_0,
  1796. CAMERA_SS_IRQ_1,
  1797. CAMERA_SS_IRQ_2,
  1798. CAMERA_SS_IRQ_3,
  1799. CAMERA_SS_IRQ_4,
  1800. CAMERA_SS_IRQ_5,
  1801. CAMERA_SS_IRQ_6,
  1802. CAMERA_SS_IRQ_7,
  1803. CAMERA_SS_IRQ_8,
  1804. CAMERA_SS_IRQ_9,
  1805. CAMERA_SS_IRQ_10,
  1806. CAMERA_SS_IRQ_11,
  1807. CAMERA_SS_IRQ_12,
  1808. CAMERA_SS_IRQ_MAX
  1809. };
  1810. enum msm_cam_hw_idx {
  1811. MSM_CAM_HW_MICRO,
  1812. MSM_CAM_HW_CCI,
  1813. MSM_CAM_HW_CSI0,
  1814. MSM_CAM_HW_CSI1,
  1815. MSM_CAM_HW_CSI2,
  1816. MSM_CAM_HW_CSI3,
  1817. MSM_CAM_HW_ISPIF,
  1818. MSM_CAM_HW_CPP,
  1819. MSM_CAM_HW_VFE0,
  1820. MSM_CAM_HW_VFE1,
  1821. MSM_CAM_HW_JPEG0,
  1822. MSM_CAM_HW_JPEG1,
  1823. MSM_CAM_HW_JPEG2,
  1824. MSM_CAM_HW_MAX
  1825. };
  1826. struct msm_camera_irq_cfg {
  1827. /* Bit mask of all the camera hardwares that needs to
  1828. * be composited into a single IRQ to the MSM.
  1829. * Current usage: (may be updated based on hw changes)
  1830. * Bits 31:13 - Reserved.
  1831. * Bits 12:0
  1832. * 12 - MSM_CAM_HW_JPEG2
  1833. * 11 - MSM_CAM_HW_JPEG1
  1834. * 10 - MSM_CAM_HW_JPEG0
  1835. * 9 - MSM_CAM_HW_VFE1
  1836. * 8 - MSM_CAM_HW_VFE0
  1837. * 7 - MSM_CAM_HW_CPP
  1838. * 6 - MSM_CAM_HW_ISPIF
  1839. * 5 - MSM_CAM_HW_CSI3
  1840. * 4 - MSM_CAM_HW_CSI2
  1841. * 3 - MSM_CAM_HW_CSI1
  1842. * 2 - MSM_CAM_HW_CSI0
  1843. * 1 - MSM_CAM_HW_CCI
  1844. * 0 - MSM_CAM_HW_MICRO
  1845. */
  1846. uint32_t cam_hw_mask;
  1847. uint8_t irq_idx;
  1848. uint8_t num_hwcore;
  1849. };
  1850. #define MSM_IRQROUTER_CFG_COMPIRQ \
  1851. _IOWR('V', BASE_VIDIOC_PRIVATE, void __user *)
  1852. #define MAX_NUM_CPP_STRIPS 8
  1853. enum msm_cpp_frame_type {
  1854. MSM_CPP_OFFLINE_FRAME,
  1855. MSM_CPP_REALTIME_FRAME,
  1856. };
  1857. struct msm_cpp_frame_strip_info {
  1858. int scale_v_en;
  1859. int scale_h_en;
  1860. int upscale_v_en;
  1861. int upscale_h_en;
  1862. int src_start_x;
  1863. int src_end_x;
  1864. int src_start_y;
  1865. int src_end_y;
  1866. /* Padding is required for upscaler because it does not
  1867. * pad internally like other blocks, also needed for rotation
  1868. * rotation expects all the blocks in the stripe to be the same size
  1869. * Padding is done such that all the extra padded pixels
  1870. * are on the right and bottom
  1871. */
  1872. int pad_bottom;
  1873. int pad_top;
  1874. int pad_right;
  1875. int pad_left;
  1876. int v_init_phase;
  1877. int h_init_phase;
  1878. int h_phase_step;
  1879. int v_phase_step;
  1880. int prescale_crop_width_first_pixel;
  1881. int prescale_crop_width_last_pixel;
  1882. int prescale_crop_height_first_line;
  1883. int prescale_crop_height_last_line;
  1884. int postscale_crop_height_first_line;
  1885. int postscale_crop_height_last_line;
  1886. int postscale_crop_width_first_pixel;
  1887. int postscale_crop_width_last_pixel;
  1888. int dst_start_x;
  1889. int dst_end_x;
  1890. int dst_start_y;
  1891. int dst_end_y;
  1892. int bytes_per_pixel;
  1893. unsigned int source_address;
  1894. unsigned int destination_address;
  1895. unsigned int src_stride;
  1896. unsigned int dst_stride;
  1897. int rotate_270;
  1898. int horizontal_flip;
  1899. int vertical_flip;
  1900. int scale_output_width;
  1901. int scale_output_height;
  1902. };
  1903. struct msm_cpp_frame_info_t {
  1904. int32_t frame_id;
  1905. uint32_t inst_id;
  1906. uint32_t client_id;
  1907. enum msm_cpp_frame_type frame_type;
  1908. uint32_t num_strips;
  1909. struct msm_cpp_frame_strip_info *strip_info;
  1910. };
  1911. struct msm_ver_num_info {
  1912. uint32_t main;
  1913. uint32_t minor;
  1914. uint32_t rev;
  1915. };
  1916. #define VIDIOC_MSM_CPP_CFG \
  1917. _IOWR('V', BASE_VIDIOC_PRIVATE, struct msm_camera_v4l2_ioctl_t)
  1918. #define VIDIOC_MSM_CPP_GET_EVENTPAYLOAD \
  1919. _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct msm_camera_v4l2_ioctl_t)
  1920. #define VIDIOC_MSM_CPP_GET_INST_INFO \
  1921. _IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct msm_camera_v4l2_ioctl_t)
  1922. #define V4L2_EVENT_CPP_FRAME_DONE (V4L2_EVENT_PRIVATE_START + 0)
  1923. /* Instance Handle - inst_handle
  1924. * Data bundle containing the information about where
  1925. * to get a buffer for a particular camera instance.
  1926. * This is a bitmask containing the following data:
  1927. * Buffer Handle Bitmask:
  1928. * ------------------------------------
  1929. * Bits : Purpose
  1930. * ------------------------------------
  1931. * 31 : is Dev ID valid?
  1932. * 30 - 24 : Dev ID.
  1933. * 23 : is Image mode valid?
  1934. * 22 - 16 : Image mode.
  1935. * 15 : is MCTL PP inst idx valid?
  1936. * 14 - 8 : MCTL PP inst idx.
  1937. * 7 : is Video inst idx valid?
  1938. * 6 - 0 : Video inst idx.
  1939. */
  1940. #define CLR_DEVID_MODE(handle) (handle &= 0x00FFFFFF)
  1941. #define SET_DEVID_MODE(handle, data) \
  1942. (handle |= ((0x1 << 31) | ((data & 0x7F) << 24)))
  1943. #define GET_DEVID_MODE(handle) \
  1944. ((handle & 0x80000000) ? ((handle & 0x7F000000) >> 24) : 0xFF)
  1945. #define CLR_IMG_MODE(handle) (handle &= 0xFF00FFFF)
  1946. #define SET_IMG_MODE(handle, data) \
  1947. (handle |= ((0x1 << 23) | ((data & 0x7F) << 16)))
  1948. #define GET_IMG_MODE(handle) \
  1949. ((handle & 0x800000) ? ((handle & 0x7F0000) >> 16) : 0xFF)
  1950. #define CLR_MCTLPP_INST_IDX(handle) (handle &= 0xFFFF00FF)
  1951. #define SET_MCTLPP_INST_IDX(handle, data) \
  1952. (handle |= ((0x1 << 15) | ((data & 0x7F) << 8)))
  1953. #define GET_MCTLPP_INST_IDX(handle) \
  1954. ((handle & 0x8000) ? ((handle & 0x7F00) >> 8) : 0xFF)
  1955. #define CLR_VIDEO_INST_IDX(handle) (handle &= 0xFFFFFF00)
  1956. #define GET_VIDEO_INST_IDX(handle) \
  1957. ((handle & 0x80) ? (handle & 0x7F) : 0xFF)
  1958. #define SET_VIDEO_INST_IDX(handle, data) \
  1959. (handle |= (0x1 << 7) | (data & 0x7F))
  1960. #endif /* __LINUX_MSM_CAMERA_H */