hi847.c 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010
  1. // SPDX-License-Identifier: GPL-2.0
  2. // Copyright (c) 2022 Intel Corporation.
  3. #include <asm/unaligned.h>
  4. #include <linux/acpi.h>
  5. #include <linux/delay.h>
  6. #include <linux/i2c.h>
  7. #include <linux/module.h>
  8. #include <linux/pm_runtime.h>
  9. #include <media/v4l2-ctrls.h>
  10. #include <media/v4l2-device.h>
  11. #include <media/v4l2-fwnode.h>
  12. #define HI847_REG_VALUE_08BIT 1
  13. #define HI847_REG_VALUE_16BIT 2
  14. #define HI847_REG_VALUE_24BIT 3
  15. #define HI847_LINK_FREQ_400MHZ 400000000ULL
  16. #define HI847_LINK_FREQ_200MHZ 200000000ULL
  17. #define HI847_SCLK 72000000ULL
  18. #define HI847_MCLK 19200000
  19. #define HI847_DATA_LANES 4
  20. #define HI847_RGB_DEPTH 10
  21. #define HI847_REG_CHIP_ID 0x0716
  22. #define HI847_CHIP_ID 0x0847
  23. #define HI847_REG_MODE_SELECT 0x0B00
  24. #define HI847_MODE_STANDBY 0x0000
  25. #define HI847_MODE_STREAMING 0x0100
  26. #define HI847_REG_MODE_TG 0x027E
  27. #define HI847_REG_MODE_TG_ENABLE 0x0100
  28. #define HI847_REG_MODE_TG_DISABLE 0x0000
  29. /* vertical-timings from sensor */
  30. #define HI847_REG_FLL 0x020E
  31. #define HI847_FLL_30FPS 0x0B51
  32. #define HI847_FLL_30FPS_MIN 0x0B51
  33. #define HI847_FLL_60FPS 0x05A9
  34. #define HI847_FLL_60FPS_MIN 0x05A9
  35. #define HI847_FLL_MAX 0x7fff
  36. /* horizontal-timings from sensor */
  37. #define HI847_REG_LLP 0x0206
  38. /* Exposure controls from sensor */
  39. #define HI847_REG_EXPOSURE 0x020A
  40. #define HI847_EXPOSURE_MIN 4
  41. #define HI847_EXPOSURE_MAX_MARGIN 4
  42. #define HI847_EXPOSURE_STEP 1
  43. /* Analog gain controls from sensor */
  44. #define HI847_REG_ANALOG_GAIN 0x0212
  45. #define HI847_ANAL_GAIN_MIN 0
  46. #define HI847_ANAL_GAIN_MAX 240
  47. #define HI847_ANAL_GAIN_STEP 1
  48. /* Digital gain controls from sensor */
  49. #define HI847_REG_MWB_GR_GAIN 0x0214
  50. #define HI847_REG_MWB_GB_GAIN 0x0216
  51. #define HI847_REG_MWB_R_GAIN 0x0218
  52. #define HI847_REG_MWB_B_GAIN 0x021A
  53. #define HI847_DGTL_GAIN_MIN 1
  54. #define HI847_DGTL_GAIN_MAX 8191
  55. #define HI847_DGTL_GAIN_STEP 1
  56. #define HI847_DGTL_GAIN_DEFAULT 512
  57. /* Test Pattern Control */
  58. #define HI847_REG_ISP 0X0B04
  59. #define HI847_REG_ISP_TPG_EN 0x0001
  60. #define HI847_REG_TEST_PATTERN 0x0C0A
  61. /* Flip Mirror Controls from sensor */
  62. #define HI847_REG_MIRROR_FLIP 0x0202
  63. #define HI847_REG_FORMAT_X 0x0F04
  64. #define HI847_REG_FORMAT_Y 0x0F06
  65. enum {
  66. HI847_LINK_FREQ_400MHZ_INDEX,
  67. HI847_LINK_FREQ_200MHZ_INDEX,
  68. };
  69. struct hi847_reg {
  70. u16 address;
  71. u16 val;
  72. };
  73. struct hi847_reg_list {
  74. u32 num_of_regs;
  75. const struct hi847_reg *regs;
  76. };
  77. struct hi847_link_freq_config {
  78. const struct hi847_reg_list reg_list;
  79. };
  80. struct hi847_mode {
  81. /* Frame width in pixels */
  82. u32 width;
  83. /* Frame height in pixels */
  84. u32 height;
  85. /* Horizontal timining size */
  86. u32 llp;
  87. /* Default vertical timining size */
  88. u32 fll_def;
  89. /* Min vertical timining size */
  90. u32 fll_min;
  91. /* Link frequency needed for this resolution */
  92. u32 link_freq_index;
  93. /* Sensor register settings for this resolution */
  94. const struct hi847_reg_list reg_list;
  95. };
  96. #define to_hi847(_sd) container_of(_sd, struct hi847, sd)
  97. //SENSOR_INITIALIZATION
  98. static const struct hi847_reg mipi_data_rate_lane_4[] = {
  99. {0x0790, 0x0100},
  100. {0x2000, 0x0000},
  101. {0x2002, 0x0058},
  102. {0x2006, 0x40B2},
  103. {0x2008, 0xB05C},
  104. {0x200A, 0x8446},
  105. {0x200C, 0x40B2},
  106. {0x200E, 0xB082},
  107. {0x2010, 0x8450},
  108. {0x2012, 0x40B2},
  109. {0x2014, 0xB0AE},
  110. {0x2016, 0x84C6},
  111. {0x2018, 0x40B2},
  112. {0x201A, 0xB11A},
  113. {0x201C, 0x84BC},
  114. {0x201E, 0x40B2},
  115. {0x2020, 0xB34A},
  116. {0x2022, 0x84B4},
  117. {0x2024, 0x40B2},
  118. {0x2026, 0xB386},
  119. {0x2028, 0x84B0},
  120. {0x202A, 0x40B2},
  121. {0x202C, 0xB3B4},
  122. {0x202E, 0x84B8},
  123. {0x2030, 0x40B2},
  124. {0x2032, 0xB0F4},
  125. {0x2034, 0x8470},
  126. {0x2036, 0x40B2},
  127. {0x2038, 0xB3EA},
  128. {0x203A, 0x847C},
  129. {0x203C, 0x40B2},
  130. {0x203E, 0xB658},
  131. {0x2040, 0x8478},
  132. {0x2042, 0x40B2},
  133. {0x2044, 0xB67E},
  134. {0x2046, 0x847E},
  135. {0x2048, 0x40B2},
  136. {0x204A, 0xB78E},
  137. {0x204C, 0x843A},
  138. {0x204E, 0x40B2},
  139. {0x2050, 0xB980},
  140. {0x2052, 0x845C},
  141. {0x2054, 0x40B2},
  142. {0x2056, 0xB9B0},
  143. {0x2058, 0x845E},
  144. {0x205A, 0x4130},
  145. {0x205C, 0x1292},
  146. {0x205E, 0xD016},
  147. {0x2060, 0xB3D2},
  148. {0x2062, 0x0B00},
  149. {0x2064, 0x2002},
  150. {0x2066, 0xD2E2},
  151. {0x2068, 0x0381},
  152. {0x206A, 0x93C2},
  153. {0x206C, 0x0263},
  154. {0x206E, 0x2001},
  155. {0x2070, 0x4130},
  156. {0x2072, 0x422D},
  157. {0x2074, 0x403E},
  158. {0x2076, 0x888E},
  159. {0x2078, 0x403F},
  160. {0x207A, 0x192A},
  161. {0x207C, 0x1292},
  162. {0x207E, 0x843E},
  163. {0x2080, 0x3FF7},
  164. {0x2082, 0x422D},
  165. {0x2084, 0x403E},
  166. {0x2086, 0x192A},
  167. {0x2088, 0x403F},
  168. {0x208A, 0x888E},
  169. {0x208C, 0x1292},
  170. {0x208E, 0x843E},
  171. {0x2090, 0xB3D2},
  172. {0x2092, 0x0267},
  173. {0x2094, 0x2403},
  174. {0x2096, 0xD0F2},
  175. {0x2098, 0x0040},
  176. {0x209A, 0x0381},
  177. {0x209C, 0x90F2},
  178. {0x209E, 0x0010},
  179. {0x20A0, 0x0260},
  180. {0x20A2, 0x2002},
  181. {0x20A4, 0x1292},
  182. {0x20A6, 0x84BC},
  183. {0x20A8, 0x1292},
  184. {0x20AA, 0xD020},
  185. {0x20AC, 0x4130},
  186. {0x20AE, 0x1292},
  187. {0x20B0, 0x8470},
  188. {0x20B2, 0x1292},
  189. {0x20B4, 0x8452},
  190. {0x20B6, 0x0900},
  191. {0x20B8, 0x7118},
  192. {0x20BA, 0x1292},
  193. {0x20BC, 0x848E},
  194. {0x20BE, 0x0900},
  195. {0x20C0, 0x7112},
  196. {0x20C2, 0x0800},
  197. {0x20C4, 0x7A20},
  198. {0x20C6, 0x4292},
  199. {0x20C8, 0x87DE},
  200. {0x20CA, 0x7334},
  201. {0x20CC, 0x0F00},
  202. {0x20CE, 0x7304},
  203. {0x20D0, 0x421F},
  204. {0x20D2, 0x8718},
  205. {0x20D4, 0x1292},
  206. {0x20D6, 0x846E},
  207. {0x20D8, 0x1292},
  208. {0x20DA, 0x8488},
  209. {0x20DC, 0x0B00},
  210. {0x20DE, 0x7114},
  211. {0x20E0, 0x0002},
  212. {0x20E2, 0x1292},
  213. {0x20E4, 0x848C},
  214. {0x20E6, 0x1292},
  215. {0x20E8, 0x8454},
  216. {0x20EA, 0x43C2},
  217. {0x20EC, 0x86EE},
  218. {0x20EE, 0x1292},
  219. {0x20F0, 0x8444},
  220. {0x20F2, 0x4130},
  221. {0x20F4, 0x4392},
  222. {0x20F6, 0x7360},
  223. {0x20F8, 0xB3D2},
  224. {0x20FA, 0x0B00},
  225. {0x20FC, 0x2402},
  226. {0x20FE, 0xC2E2},
  227. {0x2100, 0x0381},
  228. {0x2102, 0x0900},
  229. {0x2104, 0x732C},
  230. {0x2106, 0x4382},
  231. {0x2108, 0x7360},
  232. {0x210A, 0x422D},
  233. {0x210C, 0x403E},
  234. {0x210E, 0x87F0},
  235. {0x2110, 0x403F},
  236. {0x2112, 0x87E8},
  237. {0x2114, 0x1292},
  238. {0x2116, 0x843E},
  239. {0x2118, 0x4130},
  240. {0x211A, 0x120B},
  241. {0x211C, 0x120A},
  242. {0x211E, 0x4392},
  243. {0x2120, 0x87FA},
  244. {0x2122, 0x4392},
  245. {0x2124, 0x760E},
  246. {0x2126, 0x0900},
  247. {0x2128, 0x760C},
  248. {0x212A, 0x421B},
  249. {0x212C, 0x760A},
  250. {0x212E, 0x903B},
  251. {0x2130, 0x0201},
  252. {0x2132, 0x2408},
  253. {0x2134, 0x903B},
  254. {0x2136, 0x0102},
  255. {0x2138, 0x2405},
  256. {0x213A, 0x4292},
  257. {0x213C, 0x030A},
  258. {0x213E, 0x87F8},
  259. {0x2140, 0x1292},
  260. {0x2142, 0x849A},
  261. {0x2144, 0x903B},
  262. {0x2146, 0x0020},
  263. {0x2148, 0x2010},
  264. {0x214A, 0x403B},
  265. {0x214C, 0x8498},
  266. {0x214E, 0x422F},
  267. {0x2150, 0x12AB},
  268. {0x2152, 0x403F},
  269. {0x2154, 0x0028},
  270. {0x2156, 0x12AB},
  271. {0x2158, 0x403B},
  272. {0x215A, 0x84C4},
  273. {0x215C, 0x407F},
  274. {0x215E, 0xFFAA},
  275. {0x2160, 0x12AB},
  276. {0x2162, 0x407F},
  277. {0x2164, 0x0055},
  278. {0x2166, 0x12AB},
  279. {0x2168, 0x3FDC},
  280. {0x216A, 0x903B},
  281. {0x216C, 0x0021},
  282. {0x216E, 0x2890},
  283. {0x2170, 0x903B},
  284. {0x2172, 0x0100},
  285. {0x2174, 0x200D},
  286. {0x2176, 0x403F},
  287. {0x2178, 0x0028},
  288. {0x217A, 0x1292},
  289. {0x217C, 0x8498},
  290. {0x217E, 0x425F},
  291. {0x2180, 0x0306},
  292. {0x2182, 0x1292},
  293. {0x2184, 0x84C4},
  294. {0x2186, 0x4FC2},
  295. {0x2188, 0x0318},
  296. {0x218A, 0x0261},
  297. {0x218C, 0x0000},
  298. {0x218E, 0x3FC9},
  299. {0x2190, 0x903B},
  300. {0x2192, 0x0101},
  301. {0x2194, 0x2858},
  302. {0x2196, 0x903B},
  303. {0x2198, 0x0200},
  304. {0x219A, 0x2450},
  305. {0x219C, 0x903B},
  306. {0x219E, 0x0201},
  307. {0x21A0, 0x2C47},
  308. {0x21A2, 0x903B},
  309. {0x21A4, 0x0102},
  310. {0x21A6, 0x2041},
  311. {0x21A8, 0x93E2},
  312. {0x21AA, 0x0262},
  313. {0x21AC, 0x240A},
  314. {0x21AE, 0x425F},
  315. {0x21B0, 0x0306},
  316. {0x21B2, 0x1292},
  317. {0x21B4, 0x84C4},
  318. {0x21B6, 0x4F4E},
  319. {0x21B8, 0x4EC2},
  320. {0x21BA, 0x0318},
  321. {0x21BC, 0x0260},
  322. {0x21BE, 0x0000},
  323. {0x21C0, 0x3FB0},
  324. {0x21C2, 0x403A},
  325. {0x21C4, 0x8030},
  326. {0x21C6, 0x4382},
  327. {0x21C8, 0x0326},
  328. {0x21CA, 0x4382},
  329. {0x21CC, 0x0328},
  330. {0x21CE, 0x421B},
  331. {0x21D0, 0x030C},
  332. {0x21D2, 0x930B},
  333. {0x21D4, 0x2420},
  334. {0x21D6, 0x4A5F},
  335. {0x21D8, 0x0001},
  336. {0x21DA, 0x1292},
  337. {0x21DC, 0x84C4},
  338. {0x21DE, 0x4F4E},
  339. {0x21E0, 0x4A5F},
  340. {0x21E2, 0x0001},
  341. {0x21E4, 0x9F0E},
  342. {0x21E6, 0x2402},
  343. {0x21E8, 0x5392},
  344. {0x21EA, 0x0326},
  345. {0x21EC, 0x4ECA},
  346. {0x21EE, 0x0001},
  347. {0x21F0, 0x533B},
  348. {0x21F2, 0x2411},
  349. {0x21F4, 0x4A6F},
  350. {0x21F6, 0x1292},
  351. {0x21F8, 0x84C4},
  352. {0x21FA, 0x4F4E},
  353. {0x21FC, 0x4A6F},
  354. {0x21FE, 0x9F0E},
  355. {0x2200, 0x2402},
  356. {0x2202, 0x5392},
  357. {0x2204, 0x0326},
  358. {0x2206, 0x4ECA},
  359. {0x2208, 0x0000},
  360. {0x220A, 0x533B},
  361. {0x220C, 0x532A},
  362. {0x220E, 0x0260},
  363. {0x2210, 0x0000},
  364. {0x2212, 0x930B},
  365. {0x2214, 0x23E0},
  366. {0x2216, 0x40B2},
  367. {0x2218, 0xAA55},
  368. {0x221A, 0x0328},
  369. {0x221C, 0xB0F2},
  370. {0x221E, 0x0040},
  371. {0x2220, 0x0381},
  372. {0x2222, 0x277F},
  373. {0x2224, 0xD3D2},
  374. {0x2226, 0x0267},
  375. {0x2228, 0x3F7C},
  376. {0x222A, 0x0261},
  377. {0x222C, 0x0000},
  378. {0x222E, 0x3F79},
  379. {0x2230, 0x903B},
  380. {0x2232, 0x0201},
  381. {0x2234, 0x23FA},
  382. {0x2236, 0x1292},
  383. {0x2238, 0x84C0},
  384. {0x223A, 0x3F73},
  385. {0x223C, 0x1292},
  386. {0x223E, 0x84C0},
  387. {0x2240, 0x0261},
  388. {0x2242, 0x0000},
  389. {0x2244, 0x3F6E},
  390. {0x2246, 0x903B},
  391. {0x2248, 0x0040},
  392. {0x224A, 0x2018},
  393. {0x224C, 0x422F},
  394. {0x224E, 0x1292},
  395. {0x2250, 0x8498},
  396. {0x2252, 0x12B0},
  397. {0x2254, 0xF0EA},
  398. {0x2256, 0x907F},
  399. {0x2258, 0xFFAA},
  400. {0x225A, 0x240D},
  401. {0x225C, 0x5392},
  402. {0x225E, 0x0312},
  403. {0x2260, 0x12B0},
  404. {0x2262, 0xF0EA},
  405. {0x2264, 0x907F},
  406. {0x2266, 0x0055},
  407. {0x2268, 0x2403},
  408. {0x226A, 0x5392},
  409. {0x226C, 0x0312},
  410. {0x226E, 0x3F59},
  411. {0x2270, 0x5392},
  412. {0x2272, 0x0310},
  413. {0x2274, 0x3F56},
  414. {0x2276, 0x5392},
  415. {0x2278, 0x0310},
  416. {0x227A, 0x3FF2},
  417. {0x227C, 0x903B},
  418. {0x227E, 0x0080},
  419. {0x2280, 0x23D4},
  420. {0x2282, 0x4382},
  421. {0x2284, 0x0312},
  422. {0x2286, 0x4382},
  423. {0x2288, 0x0310},
  424. {0x228A, 0x0261},
  425. {0x228C, 0x0000},
  426. {0x228E, 0x3F49},
  427. {0x2290, 0x932B},
  428. {0x2292, 0x2005},
  429. {0x2294, 0x403F},
  430. {0x2296, 0x0028},
  431. {0x2298, 0x1292},
  432. {0x229A, 0x8498},
  433. {0x229C, 0x3F42},
  434. {0x229E, 0x903B},
  435. {0x22A0, 0x0003},
  436. {0x22A2, 0x284B},
  437. {0x22A4, 0x923B},
  438. {0x22A6, 0x2015},
  439. {0x22A8, 0x403F},
  440. {0x22AA, 0x0023},
  441. {0x22AC, 0x1292},
  442. {0x22AE, 0x8498},
  443. {0x22B0, 0x421B},
  444. {0x22B2, 0x87F8},
  445. {0x22B4, 0x421F},
  446. {0x22B6, 0x030C},
  447. {0x22B8, 0x9F0B},
  448. {0x22BA, 0x2F33},
  449. {0x22BC, 0x1292},
  450. {0x22BE, 0x84BA},
  451. {0x22C0, 0x930F},
  452. {0x22C2, 0x2004},
  453. {0x22C4, 0x5392},
  454. {0x22C6, 0x0312},
  455. {0x22C8, 0x531B},
  456. {0x22CA, 0x3FF4},
  457. {0x22CC, 0x5392},
  458. {0x22CE, 0x0310},
  459. {0x22D0, 0x3FFB},
  460. {0x22D2, 0x903B},
  461. {0x22D4, 0x0009},
  462. {0x22D6, 0x2818},
  463. {0x22D8, 0x903B},
  464. {0x22DA, 0x0010},
  465. {0x22DC, 0x23A6},
  466. {0x22DE, 0x403F},
  467. {0x22E0, 0x0027},
  468. {0x22E2, 0x1292},
  469. {0x22E4, 0x8498},
  470. {0x22E6, 0x421B},
  471. {0x22E8, 0x87F8},
  472. {0x22EA, 0x421F},
  473. {0x22EC, 0x030C},
  474. {0x22EE, 0x9F0B},
  475. {0x22F0, 0x2F18},
  476. {0x22F2, 0x1292},
  477. {0x22F4, 0x84BA},
  478. {0x22F6, 0x930F},
  479. {0x22F8, 0x2004},
  480. {0x22FA, 0x5392},
  481. {0x22FC, 0x0312},
  482. {0x22FE, 0x531B},
  483. {0x2300, 0x3FF4},
  484. {0x2302, 0x5392},
  485. {0x2304, 0x0310},
  486. {0x2306, 0x3FFB},
  487. {0x2308, 0x922B},
  488. {0x230A, 0x238F},
  489. {0x230C, 0x421B},
  490. {0x230E, 0x87F8},
  491. {0x2310, 0x421F},
  492. {0x2312, 0x030C},
  493. {0x2314, 0x9F0B},
  494. {0x2316, 0x2C0B},
  495. {0x2318, 0x1292},
  496. {0x231A, 0x84C2},
  497. {0x231C, 0x934F},
  498. {0x231E, 0x240A},
  499. {0x2320, 0x5392},
  500. {0x2322, 0x0312},
  501. {0x2324, 0x531B},
  502. {0x2326, 0x421F},
  503. {0x2328, 0x030C},
  504. {0x232A, 0x9F0B},
  505. {0x232C, 0x2BF5},
  506. {0x232E, 0x0261},
  507. {0x2330, 0x0000},
  508. {0x2332, 0x3EF7},
  509. {0x2334, 0x5392},
  510. {0x2336, 0x0310},
  511. {0x2338, 0x3FF5},
  512. {0x233A, 0x930B},
  513. {0x233C, 0x277F},
  514. {0x233E, 0x931B},
  515. {0x2340, 0x277A},
  516. {0x2342, 0x3F73},
  517. {0x2344, 0x413A},
  518. {0x2346, 0x413B},
  519. {0x2348, 0x4130},
  520. {0x234A, 0x4F0C},
  521. {0x234C, 0x403F},
  522. {0x234E, 0x0267},
  523. {0x2350, 0xF0FF},
  524. {0x2352, 0xFFDF},
  525. {0x2354, 0x0000},
  526. {0x2356, 0xF0FF},
  527. {0x2358, 0xFFEF},
  528. {0x235A, 0x0000},
  529. {0x235C, 0x421D},
  530. {0x235E, 0x84B0},
  531. {0x2360, 0x403E},
  532. {0x2362, 0x06F9},
  533. {0x2364, 0x4C0F},
  534. {0x2366, 0x1292},
  535. {0x2368, 0x84AC},
  536. {0x236A, 0x4F4E},
  537. {0x236C, 0xB31E},
  538. {0x236E, 0x2403},
  539. {0x2370, 0xD0F2},
  540. {0x2372, 0x0020},
  541. {0x2374, 0x0267},
  542. {0x2376, 0xB32E},
  543. {0x2378, 0x2403},
  544. {0x237A, 0xD0F2},
  545. {0x237C, 0x0010},
  546. {0x237E, 0x0267},
  547. {0x2380, 0xC3E2},
  548. {0x2382, 0x0267},
  549. {0x2384, 0x4130},
  550. {0x2386, 0x120B},
  551. {0x2388, 0x120A},
  552. {0x238A, 0x403A},
  553. {0x238C, 0x1140},
  554. {0x238E, 0x1292},
  555. {0x2390, 0xD080},
  556. {0x2392, 0x430B},
  557. {0x2394, 0x4A0F},
  558. {0x2396, 0x532A},
  559. {0x2398, 0x1292},
  560. {0x239A, 0x84A4},
  561. {0x239C, 0x4F0E},
  562. {0x239E, 0x430F},
  563. {0x23A0, 0x5E82},
  564. {0x23A2, 0x87FC},
  565. {0x23A4, 0x6F82},
  566. {0x23A6, 0x87FE},
  567. {0x23A8, 0x531B},
  568. {0x23AA, 0x923B},
  569. {0x23AC, 0x2BF3},
  570. {0x23AE, 0x413A},
  571. {0x23B0, 0x413B},
  572. {0x23B2, 0x4130},
  573. {0x23B4, 0xF0F2},
  574. {0x23B6, 0x007F},
  575. {0x23B8, 0x0267},
  576. {0x23BA, 0x421D},
  577. {0x23BC, 0x84B6},
  578. {0x23BE, 0x403E},
  579. {0x23C0, 0x01F9},
  580. {0x23C2, 0x1292},
  581. {0x23C4, 0x84AC},
  582. {0x23C6, 0x4F4E},
  583. {0x23C8, 0xF35F},
  584. {0x23CA, 0x2403},
  585. {0x23CC, 0xD0F2},
  586. {0x23CE, 0xFF80},
  587. {0x23D0, 0x0267},
  588. {0x23D2, 0xB36E},
  589. {0x23D4, 0x2404},
  590. {0x23D6, 0xD0F2},
  591. {0x23D8, 0x0040},
  592. {0x23DA, 0x0267},
  593. {0x23DC, 0x3C03},
  594. {0x23DE, 0xF0F2},
  595. {0x23E0, 0xFFBF},
  596. {0x23E2, 0x0267},
  597. {0x23E4, 0xC2E2},
  598. {0x23E6, 0x0267},
  599. {0x23E8, 0x4130},
  600. {0x23EA, 0x120B},
  601. {0x23EC, 0x120A},
  602. {0x23EE, 0x8231},
  603. {0x23F0, 0x430B},
  604. {0x23F2, 0x93C2},
  605. {0x23F4, 0x0C0A},
  606. {0x23F6, 0x2404},
  607. {0x23F8, 0xB3D2},
  608. {0x23FA, 0x0B05},
  609. {0x23FC, 0x2401},
  610. {0x23FE, 0x431B},
  611. {0x2400, 0x422D},
  612. {0x2402, 0x403E},
  613. {0x2404, 0x192A},
  614. {0x2406, 0x403F},
  615. {0x2408, 0x888E},
  616. {0x240A, 0x1292},
  617. {0x240C, 0x843E},
  618. {0x240E, 0x930B},
  619. {0x2410, 0x20F4},
  620. {0x2412, 0x93E2},
  621. {0x2414, 0x0241},
  622. {0x2416, 0x24EB},
  623. {0x2418, 0x403A},
  624. {0x241A, 0x0292},
  625. {0x241C, 0x4AA2},
  626. {0x241E, 0x0A00},
  627. {0x2420, 0xB2E2},
  628. {0x2422, 0x0361},
  629. {0x2424, 0x2405},
  630. {0x2426, 0x4A2F},
  631. {0x2428, 0x1292},
  632. {0x242A, 0x8474},
  633. {0x242C, 0x4F82},
  634. {0x242E, 0x0A1C},
  635. {0x2430, 0x93C2},
  636. {0x2432, 0x0360},
  637. {0x2434, 0x34CD},
  638. {0x2436, 0x430C},
  639. {0x2438, 0x4C0F},
  640. {0x243A, 0x5F0F},
  641. {0x243C, 0x4F0D},
  642. {0x243E, 0x510D},
  643. {0x2440, 0x4F0E},
  644. {0x2442, 0x5A0E},
  645. {0x2444, 0x4E1E},
  646. {0x2446, 0x0002},
  647. {0x2448, 0x4F1F},
  648. {0x244A, 0x192A},
  649. {0x244C, 0x1202},
  650. {0x244E, 0xC232},
  651. {0x2450, 0x4303},
  652. {0x2452, 0x4E82},
  653. {0x2454, 0x0130},
  654. {0x2456, 0x4F82},
  655. {0x2458, 0x0138},
  656. {0x245A, 0x421E},
  657. {0x245C, 0x013A},
  658. {0x245E, 0x421F},
  659. {0x2460, 0x013C},
  660. {0x2462, 0x4132},
  661. {0x2464, 0x108E},
  662. {0x2466, 0x108F},
  663. {0x2468, 0xEF4E},
  664. {0x246A, 0xEF0E},
  665. {0x246C, 0xF37F},
  666. {0x246E, 0xC312},
  667. {0x2470, 0x100F},
  668. {0x2472, 0x100E},
  669. {0x2474, 0x4E8D},
  670. {0x2476, 0x0000},
  671. {0x2478, 0x531C},
  672. {0x247A, 0x922C},
  673. {0x247C, 0x2BDD},
  674. {0x247E, 0xB3D2},
  675. {0x2480, 0x1921},
  676. {0x2482, 0x2403},
  677. {0x2484, 0x410F},
  678. {0x2486, 0x1292},
  679. {0x2488, 0x847E},
  680. {0x248A, 0x403B},
  681. {0x248C, 0x843E},
  682. {0x248E, 0x422D},
  683. {0x2490, 0x410E},
  684. {0x2492, 0x403F},
  685. {0x2494, 0x1908},
  686. {0x2496, 0x12AB},
  687. {0x2498, 0x403D},
  688. {0x249A, 0x0005},
  689. {0x249C, 0x403E},
  690. {0x249E, 0x0292},
  691. {0x24A0, 0x403F},
  692. {0x24A2, 0x86E4},
  693. {0x24A4, 0x12AB},
  694. {0x24A6, 0x421F},
  695. {0x24A8, 0x060E},
  696. {0x24AA, 0x9F82},
  697. {0x24AC, 0x8720},
  698. {0x24AE, 0x288D},
  699. {0x24B0, 0x9382},
  700. {0x24B2, 0x060E},
  701. {0x24B4, 0x248A},
  702. {0x24B6, 0x90BA},
  703. {0x24B8, 0x0010},
  704. {0x24BA, 0x0000},
  705. {0x24BC, 0x2C0B},
  706. {0x24BE, 0x93C2},
  707. {0x24C0, 0x86EE},
  708. {0x24C2, 0x2008},
  709. {0x24C4, 0x403F},
  710. {0x24C6, 0x06A7},
  711. {0x24C8, 0xD0FF},
  712. {0x24CA, 0x0007},
  713. {0x24CC, 0x0000},
  714. {0x24CE, 0xF0FF},
  715. {0x24D0, 0xFFF8},
  716. {0x24D2, 0x0000},
  717. {0x24D4, 0x4392},
  718. {0x24D6, 0x8720},
  719. {0x24D8, 0x403F},
  720. {0x24DA, 0x06A7},
  721. {0x24DC, 0xD2EF},
  722. {0x24DE, 0x0000},
  723. {0x24E0, 0xC2EF},
  724. {0x24E2, 0x0000},
  725. {0x24E4, 0x93C2},
  726. {0x24E6, 0x87D3},
  727. {0x24E8, 0x2068},
  728. {0x24EA, 0xB0F2},
  729. {0x24EC, 0x0040},
  730. {0x24EE, 0x0B05},
  731. {0x24F0, 0x2461},
  732. {0x24F2, 0xD3D2},
  733. {0x24F4, 0x0410},
  734. {0x24F6, 0xB3E2},
  735. {0x24F8, 0x0381},
  736. {0x24FA, 0x2089},
  737. {0x24FC, 0x90B2},
  738. {0x24FE, 0x0030},
  739. {0x2500, 0x0A00},
  740. {0x2502, 0x2C52},
  741. {0x2504, 0x93C2},
  742. {0x2506, 0x86EE},
  743. {0x2508, 0x204F},
  744. {0x250A, 0x430E},
  745. {0x250C, 0x430C},
  746. {0x250E, 0x4C0F},
  747. {0x2510, 0x5F0F},
  748. {0x2512, 0x5F0F},
  749. {0x2514, 0x5F0F},
  750. {0x2516, 0x4F1F},
  751. {0x2518, 0x8668},
  752. {0x251A, 0xF03F},
  753. {0x251C, 0x07FF},
  754. {0x251E, 0x903F},
  755. {0x2520, 0x0400},
  756. {0x2522, 0x343E},
  757. {0x2524, 0x5F0E},
  758. {0x2526, 0x531C},
  759. {0x2528, 0x923C},
  760. {0x252A, 0x2BF1},
  761. {0x252C, 0x4E0F},
  762. {0x252E, 0x930E},
  763. {0x2530, 0x3834},
  764. {0x2532, 0x110F},
  765. {0x2534, 0x110F},
  766. {0x2536, 0x110F},
  767. {0x2538, 0x9382},
  768. {0x253A, 0x86EE},
  769. {0x253C, 0x2023},
  770. {0x253E, 0x5F82},
  771. {0x2540, 0x87D6},
  772. {0x2542, 0x403B},
  773. {0x2544, 0x87D6},
  774. {0x2546, 0x4B2F},
  775. {0x2548, 0x12B0},
  776. {0x254A, 0xB624},
  777. {0x254C, 0x4F8B},
  778. {0x254E, 0x0000},
  779. {0x2550, 0x430C},
  780. {0x2552, 0x4C0D},
  781. {0x2554, 0x5D0D},
  782. {0x2556, 0x5D0D},
  783. {0x2558, 0x5D0D},
  784. {0x255A, 0x403A},
  785. {0x255C, 0x87D8},
  786. {0x255E, 0x421B},
  787. {0x2560, 0x87D6},
  788. {0x2562, 0x4B0F},
  789. {0x2564, 0x8A2F},
  790. {0x2566, 0x4F0E},
  791. {0x2568, 0x4E0F},
  792. {0x256A, 0x5F0F},
  793. {0x256C, 0x7F0F},
  794. {0x256E, 0xE33F},
  795. {0x2570, 0x8E8D},
  796. {0x2572, 0x8668},
  797. {0x2574, 0x7F8D},
  798. {0x2576, 0x866A},
  799. {0x2578, 0x531C},
  800. {0x257A, 0x923C},
  801. {0x257C, 0x2BEA},
  802. {0x257E, 0x4B8A},
  803. {0x2580, 0x0000},
  804. {0x2582, 0x3C45},
  805. {0x2584, 0x9382},
  806. {0x2586, 0x86F0},
  807. {0x2588, 0x2005},
  808. {0x258A, 0x4382},
  809. {0x258C, 0x87D6},
  810. {0x258E, 0x4382},
  811. {0x2590, 0x87D8},
  812. {0x2592, 0x3FD7},
  813. {0x2594, 0x4F82},
  814. {0x2596, 0x87D6},
  815. {0x2598, 0x3FD4},
  816. {0x259A, 0x503F},
  817. {0x259C, 0x0007},
  818. {0x259E, 0x3FC9},
  819. {0x25A0, 0x5F0E},
  820. {0x25A2, 0x503E},
  821. {0x25A4, 0xF800},
  822. {0x25A6, 0x3FBF},
  823. {0x25A8, 0x430F},
  824. {0x25AA, 0x12B0},
  825. {0x25AC, 0xB624},
  826. {0x25AE, 0x4382},
  827. {0x25B0, 0x87D6},
  828. {0x25B2, 0x3C2D},
  829. {0x25B4, 0xC3D2},
  830. {0x25B6, 0x0410},
  831. {0x25B8, 0x3F9E},
  832. {0x25BA, 0x430D},
  833. {0x25BC, 0x403E},
  834. {0x25BE, 0x0050},
  835. {0x25C0, 0x403F},
  836. {0x25C2, 0x85C8},
  837. {0x25C4, 0x1292},
  838. {0x25C6, 0x844E},
  839. {0x25C8, 0x3F90},
  840. {0x25CA, 0x5392},
  841. {0x25CC, 0x8720},
  842. {0x25CE, 0x3F84},
  843. {0x25D0, 0x403B},
  844. {0x25D2, 0x843E},
  845. {0x25D4, 0x4A0F},
  846. {0x25D6, 0x532F},
  847. {0x25D8, 0x422D},
  848. {0x25DA, 0x4F0E},
  849. {0x25DC, 0x403F},
  850. {0x25DE, 0x0E08},
  851. {0x25E0, 0x12AB},
  852. {0x25E2, 0x422D},
  853. {0x25E4, 0x403E},
  854. {0x25E6, 0x192A},
  855. {0x25E8, 0x410F},
  856. {0x25EA, 0x12AB},
  857. {0x25EC, 0x3F48},
  858. {0x25EE, 0x93C2},
  859. {0x25F0, 0x86EE},
  860. {0x25F2, 0x2312},
  861. {0x25F4, 0x403A},
  862. {0x25F6, 0x86E4},
  863. {0x25F8, 0x3F11},
  864. {0x25FA, 0x403D},
  865. {0x25FC, 0x0200},
  866. {0x25FE, 0x422E},
  867. {0x2600, 0x403F},
  868. {0x2602, 0x192A},
  869. {0x2604, 0x1292},
  870. {0x2606, 0x844E},
  871. {0x2608, 0xC3D2},
  872. {0x260A, 0x1921},
  873. {0x260C, 0x3F02},
  874. {0x260E, 0x422D},
  875. {0x2610, 0x403E},
  876. {0x2612, 0x888E},
  877. {0x2614, 0x403F},
  878. {0x2616, 0x192A},
  879. {0x2618, 0x1292},
  880. {0x261A, 0x843E},
  881. {0x261C, 0x5231},
  882. {0x261E, 0x413A},
  883. {0x2620, 0x413B},
  884. {0x2622, 0x4130},
  885. {0x2624, 0x4382},
  886. {0x2626, 0x052C},
  887. {0x2628, 0x4F0D},
  888. {0x262A, 0x930D},
  889. {0x262C, 0x3402},
  890. {0x262E, 0xE33D},
  891. {0x2630, 0x531D},
  892. {0x2632, 0xF03D},
  893. {0x2634, 0x07F0},
  894. {0x2636, 0x4D0E},
  895. {0x2638, 0xC312},
  896. {0x263A, 0x100E},
  897. {0x263C, 0x110E},
  898. {0x263E, 0x110E},
  899. {0x2640, 0x110E},
  900. {0x2642, 0x930F},
  901. {0x2644, 0x3803},
  902. {0x2646, 0x4EC2},
  903. {0x2648, 0x052C},
  904. {0x264A, 0x3C04},
  905. {0x264C, 0x4EC2},
  906. {0x264E, 0x052D},
  907. {0x2650, 0xE33D},
  908. {0x2652, 0x531D},
  909. {0x2654, 0x4D0F},
  910. {0x2656, 0x4130},
  911. {0x2658, 0x1292},
  912. {0x265A, 0xD048},
  913. {0x265C, 0x93C2},
  914. {0x265E, 0x86EE},
  915. {0x2660, 0x200D},
  916. {0x2662, 0xB0F2},
  917. {0x2664, 0x0020},
  918. {0x2666, 0x0381},
  919. {0x2668, 0x2407},
  920. {0x266A, 0x9292},
  921. {0x266C, 0x8722},
  922. {0x266E, 0x0384},
  923. {0x2670, 0x2C03},
  924. {0x2672, 0xD3D2},
  925. {0x2674, 0x0649},
  926. {0x2676, 0x4130},
  927. {0x2678, 0xC3D2},
  928. {0x267A, 0x0649},
  929. {0x267C, 0x4130},
  930. {0x267E, 0x120B},
  931. {0x2680, 0x120A},
  932. {0x2682, 0x1209},
  933. {0x2684, 0x1208},
  934. {0x2686, 0x1207},
  935. {0x2688, 0x1206},
  936. {0x268A, 0x1205},
  937. {0x268C, 0x1204},
  938. {0x268E, 0x8231},
  939. {0x2690, 0x4F81},
  940. {0x2692, 0x0000},
  941. {0x2694, 0x4381},
  942. {0x2696, 0x0002},
  943. {0x2698, 0x4304},
  944. {0x269A, 0x411C},
  945. {0x269C, 0x0002},
  946. {0x269E, 0x5C0C},
  947. {0x26A0, 0x4C0F},
  948. {0x26A2, 0x5F0F},
  949. {0x26A4, 0x5F0F},
  950. {0x26A6, 0x5F0F},
  951. {0x26A8, 0x5F0F},
  952. {0x26AA, 0x5F0F},
  953. {0x26AC, 0x503F},
  954. {0x26AE, 0x1980},
  955. {0x26B0, 0x440D},
  956. {0x26B2, 0x5D0D},
  957. {0x26B4, 0x4D0E},
  958. {0x26B6, 0x5F0E},
  959. {0x26B8, 0x4E2E},
  960. {0x26BA, 0x4D05},
  961. {0x26BC, 0x5505},
  962. {0x26BE, 0x5F05},
  963. {0x26C0, 0x4516},
  964. {0x26C2, 0x0008},
  965. {0x26C4, 0x4517},
  966. {0x26C6, 0x000A},
  967. {0x26C8, 0x460A},
  968. {0x26CA, 0x470B},
  969. {0x26CC, 0xF30A},
  970. {0x26CE, 0xF32B},
  971. {0x26D0, 0x4A81},
  972. {0x26D2, 0x0004},
  973. {0x26D4, 0x4B81},
  974. {0x26D6, 0x0006},
  975. {0x26D8, 0xB03E},
  976. {0x26DA, 0x2000},
  977. {0x26DC, 0x2404},
  978. {0x26DE, 0xF03E},
  979. {0x26E0, 0x1FFF},
  980. {0x26E2, 0xE33E},
  981. {0x26E4, 0x531E},
  982. {0x26E6, 0xF317},
  983. {0x26E8, 0x503E},
  984. {0x26EA, 0x2000},
  985. {0x26EC, 0x4E0F},
  986. {0x26EE, 0x5F0F},
  987. {0x26F0, 0x7F0F},
  988. {0x26F2, 0xE33F},
  989. {0x26F4, 0x512C},
  990. {0x26F6, 0x4C28},
  991. {0x26F8, 0x4309},
  992. {0x26FA, 0x4E0A},
  993. {0x26FC, 0x4F0B},
  994. {0x26FE, 0x480C},
  995. {0x2700, 0x490D},
  996. {0x2702, 0x1202},
  997. {0x2704, 0xC232},
  998. {0x2706, 0x12B0},
  999. {0x2708, 0xFFC0},
  1000. {0x270A, 0x4132},
  1001. {0x270C, 0x108E},
  1002. {0x270E, 0x108F},
  1003. {0x2710, 0xEF4E},
  1004. {0x2712, 0xEF0E},
  1005. {0x2714, 0xF37F},
  1006. {0x2716, 0xC312},
  1007. {0x2718, 0x100F},
  1008. {0x271A, 0x100E},
  1009. {0x271C, 0x4E85},
  1010. {0x271E, 0x0018},
  1011. {0x2720, 0x4F85},
  1012. {0x2722, 0x001A},
  1013. {0x2724, 0x480A},
  1014. {0x2726, 0x490B},
  1015. {0x2728, 0x460C},
  1016. {0x272A, 0x470D},
  1017. {0x272C, 0x1202},
  1018. {0x272E, 0xC232},
  1019. {0x2730, 0x12B0},
  1020. {0x2732, 0xFFC0},
  1021. {0x2734, 0x4132},
  1022. {0x2736, 0x4E0C},
  1023. {0x2738, 0x4F0D},
  1024. {0x273A, 0x108C},
  1025. {0x273C, 0x108D},
  1026. {0x273E, 0xED4C},
  1027. {0x2740, 0xED0C},
  1028. {0x2742, 0xF37D},
  1029. {0x2744, 0xC312},
  1030. {0x2746, 0x100D},
  1031. {0x2748, 0x100C},
  1032. {0x274A, 0x411E},
  1033. {0x274C, 0x0004},
  1034. {0x274E, 0x411F},
  1035. {0x2750, 0x0006},
  1036. {0x2752, 0x5E0E},
  1037. {0x2754, 0x6F0F},
  1038. {0x2756, 0x5E0E},
  1039. {0x2758, 0x6F0F},
  1040. {0x275A, 0x5E0E},
  1041. {0x275C, 0x6F0F},
  1042. {0x275E, 0xDE0C},
  1043. {0x2760, 0xDF0D},
  1044. {0x2762, 0x4C85},
  1045. {0x2764, 0x002C},
  1046. {0x2766, 0x4D85},
  1047. {0x2768, 0x002E},
  1048. {0x276A, 0x5314},
  1049. {0x276C, 0x9224},
  1050. {0x276E, 0x2B95},
  1051. {0x2770, 0x5391},
  1052. {0x2772, 0x0002},
  1053. {0x2774, 0x92A1},
  1054. {0x2776, 0x0002},
  1055. {0x2778, 0x2B8F},
  1056. {0x277A, 0x5231},
  1057. {0x277C, 0x4134},
  1058. {0x277E, 0x4135},
  1059. {0x2780, 0x4136},
  1060. {0x2782, 0x4137},
  1061. {0x2784, 0x4138},
  1062. {0x2786, 0x4139},
  1063. {0x2788, 0x413A},
  1064. {0x278A, 0x413B},
  1065. {0x278C, 0x4130},
  1066. {0x278E, 0x120B},
  1067. {0x2790, 0x120A},
  1068. {0x2792, 0x1209},
  1069. {0x2794, 0x8031},
  1070. {0x2796, 0x000C},
  1071. {0x2798, 0x425F},
  1072. {0x279A, 0x0205},
  1073. {0x279C, 0xC312},
  1074. {0x279E, 0x104F},
  1075. {0x27A0, 0x114F},
  1076. {0x27A2, 0x114F},
  1077. {0x27A4, 0x114F},
  1078. {0x27A6, 0x114F},
  1079. {0x27A8, 0x114F},
  1080. {0x27AA, 0xF37F},
  1081. {0x27AC, 0x4F0B},
  1082. {0x27AE, 0xF31B},
  1083. {0x27B0, 0x5B0B},
  1084. {0x27B2, 0x5B0B},
  1085. {0x27B4, 0x5B0B},
  1086. {0x27B6, 0x503B},
  1087. {0x27B8, 0xD194},
  1088. {0x27BA, 0x4219},
  1089. {0x27BC, 0x0508},
  1090. {0x27BE, 0xF039},
  1091. {0x27C0, 0x2000},
  1092. {0x27C2, 0x4F0A},
  1093. {0x27C4, 0xC312},
  1094. {0x27C6, 0x100A},
  1095. {0x27C8, 0xE31A},
  1096. {0x27CA, 0x421F},
  1097. {0x27CC, 0x87DE},
  1098. {0x27CE, 0x503F},
  1099. {0x27D0, 0xFF60},
  1100. {0x27D2, 0x903F},
  1101. {0x27D4, 0x00C8},
  1102. {0x27D6, 0x2C02},
  1103. {0x27D8, 0x403F},
  1104. {0x27DA, 0x00C8},
  1105. {0x27DC, 0x4F82},
  1106. {0x27DE, 0x7322},
  1107. {0x27E0, 0xB3D2},
  1108. {0x27E2, 0x0381},
  1109. {0x27E4, 0x2009},
  1110. {0x27E6, 0x421F},
  1111. {0x27E8, 0x86F0},
  1112. {0x27EA, 0xD21F},
  1113. {0x27EC, 0x86EE},
  1114. {0x27EE, 0x930F},
  1115. {0x27F0, 0x24B9},
  1116. {0x27F2, 0x40F2},
  1117. {0x27F4, 0xFF80},
  1118. {0x27F6, 0x0619},
  1119. {0x27F8, 0x1292},
  1120. {0x27FA, 0xD00A},
  1121. {0x27FC, 0xB3D2},
  1122. {0x27FE, 0x0385},
  1123. {0x2800, 0x2405},
  1124. {0x2802, 0x421F},
  1125. {0x2804, 0x880A},
  1126. {0x2806, 0x4F92},
  1127. {0x2808, 0x0002},
  1128. {0x280A, 0x8714},
  1129. {0x280C, 0x430D},
  1130. {0x280E, 0x93C2},
  1131. {0x2810, 0x87D0},
  1132. {0x2812, 0x2003},
  1133. {0x2814, 0xB2F2},
  1134. {0x2816, 0x0360},
  1135. {0x2818, 0x2001},
  1136. {0x281A, 0x431D},
  1137. {0x281C, 0x425F},
  1138. {0x281E, 0x87D3},
  1139. {0x2820, 0xD25F},
  1140. {0x2822, 0x87D2},
  1141. {0x2824, 0xF37F},
  1142. {0x2826, 0x5F0F},
  1143. {0x2828, 0x425E},
  1144. {0x282A, 0x87CD},
  1145. {0x282C, 0xDE0F},
  1146. {0x282E, 0x5F0F},
  1147. {0x2830, 0x5B0F},
  1148. {0x2832, 0x4FA2},
  1149. {0x2834, 0x0402},
  1150. {0x2836, 0x930D},
  1151. {0x2838, 0x2007},
  1152. {0x283A, 0x930A},
  1153. {0x283C, 0x248E},
  1154. {0x283E, 0x4F5F},
  1155. {0x2840, 0x0001},
  1156. {0x2842, 0xF37F},
  1157. {0x2844, 0x4FC2},
  1158. {0x2846, 0x0403},
  1159. {0x2848, 0x93C2},
  1160. {0x284A, 0x87CD},
  1161. {0x284C, 0x2483},
  1162. {0x284E, 0xC2F2},
  1163. {0x2850, 0x0400},
  1164. {0x2852, 0xB2E2},
  1165. {0x2854, 0x0265},
  1166. {0x2856, 0x2407},
  1167. {0x2858, 0x421F},
  1168. {0x285A, 0x0508},
  1169. {0x285C, 0xF03F},
  1170. {0x285E, 0xFFDF},
  1171. {0x2860, 0xD90F},
  1172. {0x2862, 0x4F82},
  1173. {0x2864, 0x0508},
  1174. {0x2866, 0xB3D2},
  1175. {0x2868, 0x0383},
  1176. {0x286A, 0x2484},
  1177. {0x286C, 0x403F},
  1178. {0x286E, 0x0508},
  1179. {0x2870, 0x4FB1},
  1180. {0x2872, 0x0000},
  1181. {0x2874, 0x4FB1},
  1182. {0x2876, 0x0002},
  1183. {0x2878, 0x4FB1},
  1184. {0x287A, 0x0004},
  1185. {0x287C, 0x403F},
  1186. {0x287E, 0x0500},
  1187. {0x2880, 0x4FB1},
  1188. {0x2882, 0x0006},
  1189. {0x2884, 0x4FB1},
  1190. {0x2886, 0x0008},
  1191. {0x2888, 0x4FB1},
  1192. {0x288A, 0x000A},
  1193. {0x288C, 0xB3E2},
  1194. {0x288E, 0x0383},
  1195. {0x2890, 0x2412},
  1196. {0x2892, 0xC2E1},
  1197. {0x2894, 0x0002},
  1198. {0x2896, 0xB2E2},
  1199. {0x2898, 0x0383},
  1200. {0x289A, 0x434F},
  1201. {0x289C, 0x634F},
  1202. {0x289E, 0xF37F},
  1203. {0x28A0, 0x4F4E},
  1204. {0x28A2, 0x114E},
  1205. {0x28A4, 0x434E},
  1206. {0x28A6, 0x104E},
  1207. {0x28A8, 0x415F},
  1208. {0x28AA, 0x0007},
  1209. {0x28AC, 0xF07F},
  1210. {0x28AE, 0x007F},
  1211. {0x28B0, 0xDE4F},
  1212. {0x28B2, 0x4FC1},
  1213. {0x28B4, 0x0007},
  1214. {0x28B6, 0xB2F2},
  1215. {0x28B8, 0x0383},
  1216. {0x28BA, 0x2415},
  1217. {0x28BC, 0xF0F1},
  1218. {0x28BE, 0xFFBF},
  1219. {0x28C0, 0x0000},
  1220. {0x28C2, 0xB0F2},
  1221. {0x28C4, 0x0010},
  1222. {0x28C6, 0x0383},
  1223. {0x28C8, 0x434E},
  1224. {0x28CA, 0x634E},
  1225. {0x28CC, 0x5E4E},
  1226. {0x28CE, 0x5E4E},
  1227. {0x28D0, 0x5E4E},
  1228. {0x28D2, 0x5E4E},
  1229. {0x28D4, 0x5E4E},
  1230. {0x28D6, 0x5E4E},
  1231. {0x28D8, 0x415F},
  1232. {0x28DA, 0x0006},
  1233. {0x28DC, 0xF07F},
  1234. {0x28DE, 0xFFBF},
  1235. {0x28E0, 0xDE4F},
  1236. {0x28E2, 0x4FC1},
  1237. {0x28E4, 0x0006},
  1238. {0x28E6, 0xB0F2},
  1239. {0x28E8, 0x0020},
  1240. {0x28EA, 0x0383},
  1241. {0x28EC, 0x2410},
  1242. {0x28EE, 0xF0F1},
  1243. {0x28F0, 0xFFDF},
  1244. {0x28F2, 0x0002},
  1245. {0x28F4, 0xB0F2},
  1246. {0x28F6, 0x0040},
  1247. {0x28F8, 0x0383},
  1248. {0x28FA, 0x434E},
  1249. {0x28FC, 0x634E},
  1250. {0x28FE, 0x5E4E},
  1251. {0x2900, 0x5E4E},
  1252. {0x2902, 0x415F},
  1253. {0x2904, 0x0008},
  1254. {0x2906, 0xC26F},
  1255. {0x2908, 0xDE4F},
  1256. {0x290A, 0x4FC1},
  1257. {0x290C, 0x0008},
  1258. {0x290E, 0x93C2},
  1259. {0x2910, 0x0383},
  1260. {0x2912, 0x3412},
  1261. {0x2914, 0xF0F1},
  1262. {0x2916, 0xFFDF},
  1263. {0x2918, 0x0000},
  1264. {0x291A, 0x425E},
  1265. {0x291C, 0x0382},
  1266. {0x291E, 0xF35E},
  1267. {0x2920, 0x5E4E},
  1268. {0x2922, 0x5E4E},
  1269. {0x2924, 0x5E4E},
  1270. {0x2926, 0x5E4E},
  1271. {0x2928, 0x5E4E},
  1272. {0x292A, 0x415F},
  1273. {0x292C, 0x0006},
  1274. {0x292E, 0xF07F},
  1275. {0x2930, 0xFFDF},
  1276. {0x2932, 0xDE4F},
  1277. {0x2934, 0x4FC1},
  1278. {0x2936, 0x0006},
  1279. {0x2938, 0x410F},
  1280. {0x293A, 0x4FB2},
  1281. {0x293C, 0x0508},
  1282. {0x293E, 0x4FB2},
  1283. {0x2940, 0x050A},
  1284. {0x2942, 0x4FB2},
  1285. {0x2944, 0x050C},
  1286. {0x2946, 0x4FB2},
  1287. {0x2948, 0x0500},
  1288. {0x294A, 0x4FB2},
  1289. {0x294C, 0x0502},
  1290. {0x294E, 0x4FB2},
  1291. {0x2950, 0x0504},
  1292. {0x2952, 0x3C10},
  1293. {0x2954, 0xD2F2},
  1294. {0x2956, 0x0400},
  1295. {0x2958, 0x3F7C},
  1296. {0x295A, 0x4F6F},
  1297. {0x295C, 0xF37F},
  1298. {0x295E, 0x4FC2},
  1299. {0x2960, 0x0402},
  1300. {0x2962, 0x3F72},
  1301. {0x2964, 0x90F2},
  1302. {0x2966, 0x0011},
  1303. {0x2968, 0x0619},
  1304. {0x296A, 0x2B46},
  1305. {0x296C, 0x50F2},
  1306. {0x296E, 0xFFF0},
  1307. {0x2970, 0x0619},
  1308. {0x2972, 0x3F42},
  1309. {0x2974, 0x5031},
  1310. {0x2976, 0x000C},
  1311. {0x2978, 0x4139},
  1312. {0x297A, 0x413A},
  1313. {0x297C, 0x413B},
  1314. {0x297E, 0x4130},
  1315. {0x2980, 0x0900},
  1316. {0x2982, 0x7312},
  1317. {0x2984, 0x421F},
  1318. {0x2986, 0x0A08},
  1319. {0x2988, 0xF03F},
  1320. {0x298A, 0xF7FF},
  1321. {0x298C, 0x4F82},
  1322. {0x298E, 0x0A88},
  1323. {0x2990, 0x0900},
  1324. {0x2992, 0x7312},
  1325. {0x2994, 0x421F},
  1326. {0x2996, 0x0A0E},
  1327. {0x2998, 0xF03F},
  1328. {0x299A, 0x7FFF},
  1329. {0x299C, 0x4F82},
  1330. {0x299E, 0x0A8E},
  1331. {0x29A0, 0x0900},
  1332. {0x29A2, 0x7312},
  1333. {0x29A4, 0x421F},
  1334. {0x29A6, 0x0A1E},
  1335. {0x29A8, 0xC31F},
  1336. {0x29AA, 0x4F82},
  1337. {0x29AC, 0x0A9E},
  1338. {0x29AE, 0x4130},
  1339. {0x29B0, 0x4292},
  1340. {0x29B2, 0x0A08},
  1341. {0x29B4, 0x0A88},
  1342. {0x29B6, 0x0900},
  1343. {0x29B8, 0x7312},
  1344. {0x29BA, 0x4292},
  1345. {0x29BC, 0x0A0E},
  1346. {0x29BE, 0x0A8E},
  1347. {0x29C0, 0x0900},
  1348. {0x29C2, 0x7312},
  1349. {0x29C4, 0x4292},
  1350. {0x29C6, 0x0A1E},
  1351. {0x29C8, 0x0A9E},
  1352. {0x29CA, 0x4130},
  1353. {0x29CC, 0x7400},
  1354. {0x29CE, 0x8058},
  1355. {0x29D0, 0x1807},
  1356. {0x29D2, 0x00E0},
  1357. {0x29D4, 0x7002},
  1358. {0x29D6, 0x17C7},
  1359. {0x29D8, 0x0045},
  1360. {0x29DA, 0x0006},
  1361. {0x29DC, 0x17CC},
  1362. {0x29DE, 0x0015},
  1363. {0x29E0, 0x1512},
  1364. {0x29E2, 0x216F},
  1365. {0x29E4, 0x005B},
  1366. {0x29E6, 0x005D},
  1367. {0x29E8, 0x00DE},
  1368. {0x29EA, 0x00DD},
  1369. {0x29EC, 0x5023},
  1370. {0x29EE, 0x00DE},
  1371. {0x29F0, 0x005B},
  1372. {0x29F2, 0x0410},
  1373. {0x29F4, 0x0091},
  1374. {0x29F6, 0x0015},
  1375. {0x29F8, 0x0040},
  1376. {0x29FA, 0x7023},
  1377. {0x29FC, 0x1653},
  1378. {0x29FE, 0x0156},
  1379. {0x2A00, 0x0001},
  1380. {0x2A02, 0x2081},
  1381. {0x2A04, 0x7020},
  1382. {0x2A06, 0x2F99},
  1383. {0x2A08, 0x005C},
  1384. {0x2A0A, 0x0000},
  1385. {0x2A0C, 0x5040},
  1386. {0x2A0E, 0x0045},
  1387. {0x2A10, 0x213A},
  1388. {0x2A12, 0x0303},
  1389. {0x2A14, 0x0148},
  1390. {0x2A16, 0x0049},
  1391. {0x2A18, 0x0045},
  1392. {0x2A1A, 0x0046},
  1393. {0x2A1C, 0x05DD},
  1394. {0x2A1E, 0x00DE},
  1395. {0x2A20, 0x00DD},
  1396. {0x2A22, 0x00DC},
  1397. {0x2A24, 0x00DE},
  1398. {0x2A26, 0x04D6},
  1399. {0x2A28, 0x2014},
  1400. {0x2A2A, 0x2081},
  1401. {0x2A2C, 0x7087},
  1402. {0x2A2E, 0x2F99},
  1403. {0x2A30, 0x005C},
  1404. {0x2A32, 0x0002},
  1405. {0x2A34, 0x5060},
  1406. {0x2A36, 0x31C0},
  1407. {0x2A38, 0x2122},
  1408. {0x2A3A, 0x7800},
  1409. {0x2A3C, 0xC08C},
  1410. {0x2A3E, 0x0001},
  1411. {0x2A40, 0x9038},
  1412. {0x2A42, 0x59F7},
  1413. {0x2A44, 0x907A},
  1414. {0x2A46, 0x03D8},
  1415. {0x2A48, 0x8D90},
  1416. {0x2A4A, 0x01C0},
  1417. {0x2A4C, 0x7400},
  1418. {0x2A4E, 0x8058},
  1419. {0x2A50, 0x1807},
  1420. {0x2A52, 0x00E0},
  1421. {0x2A54, 0x7002},
  1422. {0x2A56, 0x17C7},
  1423. {0x2A58, 0x0045},
  1424. {0x2A5A, 0x0006},
  1425. {0x2A5C, 0x17CC},
  1426. {0x2A5E, 0x0015},
  1427. {0x2A60, 0x1512},
  1428. {0x2A62, 0x216F},
  1429. {0x2A64, 0x005B},
  1430. {0x2A66, 0x005D},
  1431. {0x2A68, 0x00DE},
  1432. {0x2A6A, 0x00DD},
  1433. {0x2A6C, 0x5023},
  1434. {0x2A6E, 0x00DE},
  1435. {0x2A70, 0x005B},
  1436. {0x2A72, 0x0410},
  1437. {0x2A74, 0x0091},
  1438. {0x2A76, 0x0015},
  1439. {0x2A78, 0x0040},
  1440. {0x2A7A, 0x7023},
  1441. {0x2A7C, 0x1653},
  1442. {0x2A7E, 0x0156},
  1443. {0x2A80, 0x0001},
  1444. {0x2A82, 0x2081},
  1445. {0x2A84, 0x7020},
  1446. {0x2A86, 0x2F99},
  1447. {0x2A88, 0x005C},
  1448. {0x2A8A, 0x0000},
  1449. {0x2A8C, 0x5040},
  1450. {0x2A8E, 0x0045},
  1451. {0x2A90, 0x213A},
  1452. {0x2A92, 0x0303},
  1453. {0x2A94, 0x0148},
  1454. {0x2A96, 0x0049},
  1455. {0x2A98, 0x0045},
  1456. {0x2A9A, 0x0046},
  1457. {0x2A9C, 0x05DD},
  1458. {0x2A9E, 0x00DE},
  1459. {0x2AA0, 0x00DD},
  1460. {0x2AA2, 0x00DC},
  1461. {0x2AA4, 0x00DE},
  1462. {0x2AA6, 0x0296},
  1463. {0x2AA8, 0x2014},
  1464. {0x2AAA, 0x2081},
  1465. {0x2AAC, 0x7087},
  1466. {0x2AAE, 0x2F99},
  1467. {0x2AB0, 0x005C},
  1468. {0x2AB2, 0x0002},
  1469. {0x2AB4, 0x5060},
  1470. {0x2AB6, 0x31C0},
  1471. {0x2AB8, 0x2122},
  1472. {0x2ABA, 0x7800},
  1473. {0x2ABC, 0xC08C},
  1474. {0x2ABE, 0x0001},
  1475. {0x2AC0, 0x9038},
  1476. {0x2AC2, 0x59F7},
  1477. {0x2AC4, 0x907A},
  1478. {0x2AC6, 0x03D8},
  1479. {0x2AC8, 0x8D90},
  1480. {0x2ACA, 0x01C0},
  1481. {0x2ACC, 0x7400},
  1482. {0x2ACE, 0x2002},
  1483. {0x2AD0, 0x70DF},
  1484. {0x2AD2, 0x2F21},
  1485. {0x2AD4, 0x04C1},
  1486. {0x2AD6, 0x0D80},
  1487. {0x2AD8, 0x7800},
  1488. {0x2ADA, 0x0041},
  1489. {0x2ADC, 0x7400},
  1490. {0x2ADE, 0x2004},
  1491. {0x2AE0, 0x70DF},
  1492. {0x2AE2, 0x2F21},
  1493. {0x2AE4, 0x04C2},
  1494. {0x2AE6, 0x0D80},
  1495. {0x2AE8, 0x7800},
  1496. {0x2AEA, 0x7400},
  1497. {0x2AEC, 0x2008},
  1498. {0x2AEE, 0x70DF},
  1499. {0x2AF0, 0x2F21},
  1500. {0x2AF2, 0x04C3},
  1501. {0x2AF4, 0x0D80},
  1502. {0x2AF6, 0x7800},
  1503. {0x2AF8, 0x7400},
  1504. {0x2AFA, 0x0004},
  1505. {0x2AFC, 0x70DF},
  1506. {0x2AFE, 0x2F22},
  1507. {0x2B00, 0x7008},
  1508. {0x2B02, 0x2F1F},
  1509. {0x2B04, 0x7021},
  1510. {0x2B06, 0x2F01},
  1511. {0x2B08, 0x7800},
  1512. {0x2B0A, 0x7400},
  1513. {0x2B0C, 0x0002},
  1514. {0x2B0E, 0x70DF},
  1515. {0x2B10, 0x3F5F},
  1516. {0x2B12, 0x703A},
  1517. {0x2B14, 0x2F01},
  1518. {0x2B16, 0x7800},
  1519. {0x2B18, 0x7400},
  1520. {0x2B1A, 0x2010},
  1521. {0x2B1C, 0x70DF},
  1522. {0x2B1E, 0x3F40},
  1523. {0x2B20, 0x700A},
  1524. {0x2B22, 0x0FC0},
  1525. {0x2B24, 0x7800},
  1526. {0x2B26, 0x7400},
  1527. {0x2B28, 0x2004},
  1528. {0x2B2A, 0x70DF},
  1529. {0x2B2C, 0x2F21},
  1530. {0x2B2E, 0x04C2},
  1531. {0x2B30, 0x0D80},
  1532. {0x2B32, 0x7800},
  1533. {0x2B34, 0x0041},
  1534. {0x2B36, 0x7400},
  1535. {0x2B38, 0x2002},
  1536. {0x2B3A, 0x70DF},
  1537. {0x2B3C, 0x2F22},
  1538. {0x2B3E, 0x04C1},
  1539. {0x2B40, 0x0D80},
  1540. {0x2B42, 0x7800},
  1541. {0x2B44, 0x7400},
  1542. {0x2B46, 0x0001},
  1543. {0x2B48, 0x70DF},
  1544. {0x2B4A, 0x3F5F},
  1545. {0x2B4C, 0x703A},
  1546. {0x2B4E, 0x2F01},
  1547. {0x2B50, 0x7800},
  1548. {0x2B52, 0x7400},
  1549. {0x2B54, 0x200A},
  1550. {0x2B56, 0x70DF},
  1551. {0x2B58, 0x3F40},
  1552. {0x2B5A, 0x700A},
  1553. {0x2B5C, 0x0FC0},
  1554. {0x2B5E, 0x7800},
  1555. {0x2B60, 0x7400},
  1556. {0x2B62, 0x2015},
  1557. {0x2B64, 0x70DF},
  1558. {0x2B66, 0x3F5F},
  1559. {0x2B68, 0x703A},
  1560. {0x2B6A, 0x2F01},
  1561. {0x2B6C, 0x7800},
  1562. {0x2B6E, 0x7400},
  1563. {0x2B70, 0x7800},
  1564. {0x2B72, 0x007F},
  1565. {0x2B74, 0x0000},
  1566. {0x2B76, 0xB9CC},
  1567. {0x2B78, 0x0000},
  1568. {0x2B7A, 0xB9CC},
  1569. {0x2B7C, 0xBA3C},
  1570. {0x2B7E, 0x0002},
  1571. {0x2B80, 0x0000},
  1572. {0x2B82, 0xBA4C},
  1573. {0x2B84, 0x0000},
  1574. {0x2B86, 0xBA4C},
  1575. {0x2B88, 0xBABC},
  1576. {0x2B8A, 0x0002},
  1577. {0x2B8C, 0x0063},
  1578. {0x2B8E, 0xBB26},
  1579. {0x2B90, 0x0063},
  1580. {0x2B92, 0xBB36},
  1581. {0x2B94, 0x0063},
  1582. {0x2B96, 0xBAEA},
  1583. {0x2B98, 0x0063},
  1584. {0x2B9A, 0xBAF8},
  1585. {0x2B9C, 0xBADA},
  1586. {0x2B9E, 0x0004},
  1587. {0x2BA0, 0x0063},
  1588. {0x2BA2, 0xBAEA},
  1589. {0x2BA4, 0x0063},
  1590. {0x2BA6, 0xBB18},
  1591. {0x2BA8, 0x0063},
  1592. {0x2BAA, 0xBB26},
  1593. {0x2BAC, 0x0063},
  1594. {0x2BAE, 0xBB44},
  1595. {0x2BB0, 0xBADA},
  1596. {0x2BB2, 0x0004},
  1597. {0x2BB4, 0x0063},
  1598. {0x2BB6, 0xBACC},
  1599. {0x2BB8, 0x0063},
  1600. {0x2BBA, 0xBADC},
  1601. {0x2BBC, 0x0063},
  1602. {0x2BBE, 0xBAEA},
  1603. {0x2BC0, 0x0063},
  1604. {0x2BC2, 0xBAF8},
  1605. {0x2BC4, 0xBADA},
  1606. {0x2BC6, 0x0004},
  1607. {0x2BC8, 0x0063},
  1608. {0x2BCA, 0xBAEA},
  1609. {0x2BCC, 0x0063},
  1610. {0x2BCE, 0xBB18},
  1611. {0x2BD0, 0x0063},
  1612. {0x2BD2, 0xBACC},
  1613. {0x2BD4, 0x0063},
  1614. {0x2BD6, 0xBB0A},
  1615. {0x2BD8, 0xBADA},
  1616. {0x2BDA, 0x0004},
  1617. {0x2BDC, 0x0063},
  1618. {0x2BDE, 0xBACC},
  1619. {0x2BE0, 0x0063},
  1620. {0x2BE2, 0xBADC},
  1621. {0x2BE4, 0x0063},
  1622. {0x2BE6, 0xBAEA},
  1623. {0x2BE8, 0x0063},
  1624. {0x2BEA, 0xBB18},
  1625. {0x2BEC, 0xBADA},
  1626. {0x2BEE, 0x0004},
  1627. {0x2BF0, 0xFFFF},
  1628. {0x2BF2, 0xBB6E},
  1629. {0x2BF4, 0x0000},
  1630. {0x2BF6, 0x0000},
  1631. {0x2BF8, 0x0000},
  1632. {0x2BFA, 0x0000},
  1633. {0x2BFC, 0x0000},
  1634. {0x2BFE, 0x0000},
  1635. {0x2C00, 0xBB72},
  1636. {0x2C02, 0x0001},
  1637. {0x2C04, 0x0063},
  1638. {0x2C06, 0xBB52},
  1639. {0x2C08, 0x0063},
  1640. {0x2C0A, 0xBB60},
  1641. {0x2C0C, 0x0000},
  1642. {0x2C0E, 0x0000},
  1643. {0x2C10, 0x0000},
  1644. {0x2C12, 0x0000},
  1645. {0x2C14, 0xBADA},
  1646. {0x2C16, 0x0002},
  1647. {0x2C18, 0x0066},
  1648. {0x2C1A, 0x0067},
  1649. {0x2C1C, 0x00AF},
  1650. {0x2C1E, 0x01CF},
  1651. {0x2C20, 0x0087},
  1652. {0x2C22, 0x0083},
  1653. {0x2C24, 0x011B},
  1654. {0x2C26, 0x035A},
  1655. {0x2C28, 0x00FA},
  1656. {0x2C2A, 0x00F2},
  1657. {0x2C2C, 0x00A6},
  1658. {0x2C2E, 0x00A4},
  1659. {0x2C30, 0xFFFF},
  1660. {0x2C32, 0x002C},
  1661. {0x2C34, 0x0058},
  1662. {0x2C36, 0x0000},
  1663. {0x2C38, 0x0000},
  1664. {0x2C3A, 0xBC18},
  1665. {0x2C3C, 0xBB74},
  1666. {0x2C3E, 0xBB80},
  1667. {0x2C40, 0xBC32},
  1668. {0x2C42, 0xBB8C},
  1669. {0x2C44, 0xBBA0},
  1670. {0x2C46, 0xBB8C},
  1671. {0x2C48, 0xBBA0},
  1672. {0x2C4A, 0xBC04},
  1673. {0x2C4C, 0xBC04},
  1674. {0x2C4E, 0xBBF0},
  1675. {0x2C50, 0xBBF0},
  1676. {0x2C52, 0xBBB4},
  1677. {0x2C54, 0xBBC8},
  1678. {0x2C56, 0xBBB4},
  1679. {0x2C58, 0xBBC8},
  1680. {0x2C5A, 0xBC04},
  1681. {0x2C5C, 0xBC04},
  1682. {0x2C5E, 0xBBF0},
  1683. {0x2C60, 0xBBF0},
  1684. {0x2C62, 0xBB8C},
  1685. {0x2C64, 0xBBA0},
  1686. {0x2C66, 0xBB8C},
  1687. {0x2C68, 0xBBA0},
  1688. {0x2C6A, 0xBC04},
  1689. {0x2C6C, 0xBC04},
  1690. {0x2C6E, 0xBBF0},
  1691. {0x2C70, 0xBBF0},
  1692. {0x2C72, 0xBBB4},
  1693. {0x2C74, 0xBBC8},
  1694. {0x2C76, 0xBBB4},
  1695. {0x2C78, 0xBBC8},
  1696. {0x2C7A, 0xBC04},
  1697. {0x2C7C, 0xBC04},
  1698. {0x2C7E, 0xBBF0},
  1699. {0x2C80, 0xBBF0},
  1700. {0x3800, 0x880E},
  1701. {0x3802, 0xBC62},
  1702. {0x3804, 0xBC40},
  1703. {0x3806, 0xD13E},
  1704. {0x3808, 0xBC42},
  1705. {0x380A, 0xBC3C},
  1706. {0x380C, 0x0000},
  1707. {0x380E, 0x0040},
  1708. {0x3810, 0x0040},
  1709. {0x3812, 0x0040},
  1710. {0x3814, 0x0043},
  1711. {0x3816, 0x0046},
  1712. {0x3818, 0x004B},
  1713. {0x381A, 0x004D},
  1714. {0x381C, 0x0051},
  1715. {0x381E, 0x0055},
  1716. {0x3820, 0x005A},
  1717. {0x3822, 0x005E},
  1718. {0x3824, 0x0062},
  1719. {0x3826, 0x0067},
  1720. {0x3828, 0x006C},
  1721. {0x382A, 0x0070},
  1722. {0x382C, 0x0078},
  1723. {0x382E, 0x0086},
  1724. {0x3830, 0x0090},
  1725. {0x3832, 0x0096},
  1726. {0x3834, 0x009D},
  1727. {0x3836, 0x00A5},
  1728. {0x3838, 0x00AD},
  1729. {0x383A, 0x00B4},
  1730. {0x383C, 0x00B9},
  1731. {0x383E, 0x00BE},
  1732. {0x3840, 0x00C3},
  1733. {0x3842, 0x00C8},
  1734. {0x3844, 0x00CD},
  1735. {0x3846, 0x00D2},
  1736. {0x3848, 0x00D7},
  1737. {0x384A, 0x00DC},
  1738. {0x384C, 0x00DC},
  1739. {0x384E, 0x0000},
  1740. {0x3850, 0x0000},
  1741. {0x3852, 0x0000},
  1742. {0x3854, 0x0000},
  1743. {0x3856, 0x0000},
  1744. {0x3858, 0x0000},
  1745. {0x385A, 0x0000},
  1746. {0x385C, 0x0000},
  1747. {0x385E, 0x0000},
  1748. {0x3860, 0x0000},
  1749. {0x3862, 0x0000},
  1750. {0x3864, 0x0000},
  1751. {0x3866, 0x0000},
  1752. {0x3868, 0x0000},
  1753. {0x386A, 0x0000},
  1754. {0x386C, 0x0000},
  1755. {0x386E, 0x0000},
  1756. {0x3870, 0x0000},
  1757. {0x3872, 0x0000},
  1758. {0x3874, 0x0000},
  1759. {0x3876, 0x0000},
  1760. {0x3878, 0x0000},
  1761. {0x387A, 0x0000},
  1762. {0x387C, 0x0000},
  1763. {0x387E, 0x0000},
  1764. {0x3880, 0x0000},
  1765. {0x3882, 0x0000},
  1766. {0x3884, 0x0000},
  1767. {0x3886, 0x0000},
  1768. {0x3888, 0x0000},
  1769. {0x388A, 0x0000},
  1770. {0x388C, 0x0000},
  1771. {0x026A, 0xFFFF},
  1772. {0x026C, 0x00FF},
  1773. {0x026E, 0x0000},
  1774. {0x0360, 0x1E8E},
  1775. {0x040E, 0x01EB},
  1776. {0x0600, 0x1130},
  1777. {0x0602, 0x3112},
  1778. {0x0604, 0x8048},
  1779. {0x0606, 0x00E9},
  1780. {0x067A, 0x0404},
  1781. {0x067C, 0x0404},
  1782. {0x06A8, 0x0240},
  1783. {0x06AA, 0x00CA},
  1784. {0x06AC, 0x0041},
  1785. {0x06B4, 0x3FFF},
  1786. {0x06DE, 0x0404},
  1787. {0x06E0, 0x0404},
  1788. {0x06E2, 0xFF00},
  1789. {0x06E4, 0x8333},
  1790. {0x06E6, 0x8333},
  1791. {0x06E8, 0x8333},
  1792. {0x06EA, 0x8333},
  1793. {0x052A, 0x0000},
  1794. {0x052C, 0x0000},
  1795. {0x0F06, 0x0002},
  1796. {0x0A04, 0xB4C5},
  1797. {0x0A06, 0xC400},
  1798. {0x0A08, 0x988A},
  1799. {0x0A0A, 0xA387},
  1800. {0x0A0E, 0xEEC0},
  1801. {0x0A12, 0x0000},
  1802. {0x0A18, 0x0010},
  1803. {0x0A1C, 0x0040},
  1804. {0x0A20, 0x0015},
  1805. {0x0C00, 0x0021},
  1806. {0x0C16, 0x0002},
  1807. {0x0708, 0x6FC0},
  1808. {0x070C, 0x0000},
  1809. {0x120C, 0x1428},
  1810. {0x121A, 0x0000},
  1811. {0x121C, 0x1896},
  1812. {0x121E, 0x0032},
  1813. {0x1220, 0x0000},
  1814. {0x1222, 0x96FF},
  1815. {0x1244, 0x0000},
  1816. {0x105C, 0x0F0B},
  1817. {0x1958, 0x0000},
  1818. {0x195A, 0x004C},
  1819. {0x195C, 0x0097},
  1820. {0x195E, 0x0221},
  1821. {0x1960, 0x03FE},
  1822. {0x1980, 0x00E0},
  1823. {0x1982, 0x0010},
  1824. {0x1984, 0x2018},
  1825. {0x1986, 0x0008},
  1826. {0x1988, 0x0000},
  1827. {0x198A, 0x0000},
  1828. {0x198C, 0x0880},
  1829. {0x198E, 0x0000},
  1830. {0x1990, 0x1A00},
  1831. {0x1992, 0x0000},
  1832. {0x1994, 0x2800},
  1833. {0x1996, 0x0002},
  1834. {0x1962, 0x0000},
  1835. {0x1964, 0x004C},
  1836. {0x1966, 0x0097},
  1837. {0x1968, 0x0221},
  1838. {0x196A, 0x03FE},
  1839. {0x19C0, 0x00E0},
  1840. {0x19C2, 0x0010},
  1841. {0x19C4, 0x2018},
  1842. {0x19C6, 0x0008},
  1843. {0x19C8, 0x0000},
  1844. {0x19CA, 0x0000},
  1845. {0x19CC, 0x0880},
  1846. {0x19CE, 0x0000},
  1847. {0x19D0, 0x1A00},
  1848. {0x19D2, 0x0000},
  1849. {0x19D4, 0x2800},
  1850. {0x19D6, 0x0002},
  1851. {0x196C, 0x0000},
  1852. {0x196E, 0x004C},
  1853. {0x1970, 0x0097},
  1854. {0x1972, 0x0221},
  1855. {0x1974, 0x03FE},
  1856. {0x1A00, 0x00E0},
  1857. {0x1A02, 0x0010},
  1858. {0x1A04, 0x2018},
  1859. {0x1A06, 0x0008},
  1860. {0x1A08, 0x0000},
  1861. {0x1A0A, 0x0000},
  1862. {0x1A0C, 0x0880},
  1863. {0x1A0E, 0x0000},
  1864. {0x1A10, 0x1A00},
  1865. {0x1A12, 0x0000},
  1866. {0x1A14, 0x2800},
  1867. {0x1A16, 0x0002},
  1868. {0x1976, 0x0000},
  1869. {0x1978, 0x004C},
  1870. {0x197A, 0x0097},
  1871. {0x197C, 0x0221},
  1872. {0x197E, 0x03FE},
  1873. {0x1A40, 0x00E0},
  1874. {0x1A42, 0x0010},
  1875. {0x1A44, 0x2018},
  1876. {0x1A46, 0x0008},
  1877. {0x1A48, 0x0000},
  1878. {0x1A4A, 0x0000},
  1879. {0x1A4C, 0x0880},
  1880. {0x1A4E, 0x0000},
  1881. {0x1A50, 0x1A00},
  1882. {0x1A52, 0x0000},
  1883. {0x1A54, 0x2800},
  1884. {0x1A56, 0x0002},
  1885. {0x192A, 0x0201},
  1886. {0x0384, 0x0001},
  1887. {0x027E, 0x0100},
  1888. };
  1889. static const struct hi847_reg mode_3264x2448_regs[] = {
  1890. {0x0B00, 0x0000},
  1891. {0x0204, 0x0000},
  1892. {0x0206, 0x033C},
  1893. {0x020A, 0x0B4D},
  1894. {0x020E, 0x0B51},
  1895. {0x0214, 0x0200},
  1896. {0x0216, 0x0200},
  1897. {0x0218, 0x0200},
  1898. {0x021A, 0x0200},
  1899. {0x0224, 0x002E},
  1900. {0x022A, 0x0017},
  1901. {0x022C, 0x0E1F},
  1902. {0x022E, 0x09C1},
  1903. {0x0234, 0x1111},
  1904. {0x0236, 0x1111},
  1905. {0x0238, 0x1111},
  1906. {0x023A, 0x1111},
  1907. {0x0250, 0x0000},
  1908. {0x0252, 0x0006},
  1909. {0x0254, 0x0000},
  1910. {0x0256, 0x0000},
  1911. {0x0258, 0x0000},
  1912. {0x025A, 0x0000},
  1913. {0x025C, 0x0000},
  1914. {0x025E, 0x0202},
  1915. {0x0268, 0x00CD},
  1916. {0x0440, 0x0002},
  1917. {0x0F00, 0x0000},
  1918. {0x0F04, 0x0008},
  1919. {0x0F06, 0x0002},
  1920. {0x0B02, 0x0100},
  1921. {0x0B04, 0x00DC},
  1922. {0x0B12, 0x0CC0},
  1923. {0x0B14, 0x0990},
  1924. {0x0B20, 0x0100},
  1925. {0x1100, 0x1100},
  1926. {0x1102, 0x0008},
  1927. {0x1108, 0x0202},
  1928. {0x1118, 0x0000},
  1929. {0x0A10, 0xB040},
  1930. {0x0C14, 0x0008},
  1931. {0x0C18, 0x0CC0},
  1932. {0x0C1A, 0x0990},
  1933. {0x0730, 0x0001},
  1934. {0x0732, 0x0000},
  1935. {0x0734, 0x0300},
  1936. {0x0736, 0x004B},
  1937. {0x0738, 0x0001},
  1938. {0x073C, 0x0900},
  1939. {0x0740, 0x0000},
  1940. {0x0742, 0x0000},
  1941. {0x0744, 0x0300},
  1942. {0x0746, 0x007D},
  1943. {0x0748, 0x0002},
  1944. {0x074A, 0x0900},
  1945. {0x074C, 0x0000},
  1946. {0x074E, 0x0100},
  1947. {0x0750, 0x0000},
  1948. {0x1200, 0x0946},
  1949. {0x1202, 0x1A00},
  1950. {0x120E, 0x6027},
  1951. {0x1210, 0x8027},
  1952. {0x1246, 0x0105},
  1953. {0x1000, 0x0300},
  1954. {0x1002, 0xC311},
  1955. {0x1004, 0x2BB0},
  1956. {0x1010, 0x087B},
  1957. {0x1012, 0x0040},
  1958. {0x1014, 0x0020},
  1959. {0x1016, 0x0020},
  1960. {0x101A, 0x0020},
  1961. {0x1020, 0xC107},
  1962. {0x1022, 0x081E},
  1963. {0x1024, 0x0509},
  1964. {0x1026, 0x0B0A},
  1965. {0x1028, 0x1409},
  1966. {0x102A, 0x0B05},
  1967. {0x102C, 0x1400},
  1968. {0x1038, 0x0000},
  1969. {0x103E, 0x0001},
  1970. {0x1040, 0x0000},
  1971. {0x1042, 0x0008},
  1972. {0x1044, 0x0120},
  1973. {0x1046, 0x01B0},
  1974. {0x1048, 0x0090},
  1975. {0x1066, 0x089C},
  1976. {0x1600, 0x0000},
  1977. {0x1608, 0x0028},
  1978. {0x160A, 0x0C80},
  1979. {0x160C, 0x001A},
  1980. {0x160E, 0x0960},
  1981. {0x0252, 0x0009},
  1982. {0x0202, 0x0000},
  1983. };
  1984. static const struct hi847_reg mode_1632x1224_regs[] = {
  1985. {0x0B00, 0x0000},
  1986. {0x0204, 0x0200},
  1987. {0x0206, 0x033C},
  1988. {0x020A, 0x05A5},
  1989. {0x020E, 0x05A9},
  1990. {0x0214, 0x0200},
  1991. {0x0216, 0x0200},
  1992. {0x0218, 0x0200},
  1993. {0x021A, 0x0200},
  1994. {0x0224, 0x002C},
  1995. {0x022A, 0x0015},
  1996. {0x022C, 0x0E2D},
  1997. {0x022E, 0x09C1},
  1998. {0x0234, 0x3311},
  1999. {0x0236, 0x3311},
  2000. {0x0238, 0x3311},
  2001. {0x023A, 0x2222},
  2002. {0x0250, 0x0000},
  2003. {0x0252, 0x0006},
  2004. {0x0254, 0x0000},
  2005. {0x0256, 0x0000},
  2006. {0x0258, 0x0000},
  2007. {0x025A, 0x0000},
  2008. {0x025C, 0x0000},
  2009. {0x025E, 0x0202},
  2010. {0x0268, 0x00CD},
  2011. {0x0440, 0x0002},
  2012. {0x0F00, 0x0400},
  2013. {0x0F04, 0x0004},
  2014. {0x0F06, 0x0002},
  2015. {0x0B02, 0x0100},
  2016. {0x0B04, 0x00FC},
  2017. {0x0B12, 0x0660},
  2018. {0x0B14, 0x04C8},
  2019. {0x0B20, 0x0200},
  2020. {0x1100, 0x1100},
  2021. {0x1102, 0x0008},
  2022. {0x1108, 0x0402},
  2023. {0x1118, 0x0000},
  2024. {0x0A10, 0xB060},
  2025. {0x0C14, 0x0008},
  2026. {0x0C18, 0x0CC0},
  2027. {0x0C1A, 0x04C8},
  2028. {0x0730, 0x0001},
  2029. {0x0732, 0x0000},
  2030. {0x0734, 0x0300},
  2031. {0x0736, 0x004B},
  2032. {0x0738, 0x0001},
  2033. {0x073C, 0x0900},
  2034. {0x0740, 0x0000},
  2035. {0x0742, 0x0000},
  2036. {0x0744, 0x0300},
  2037. {0x0746, 0x007D},
  2038. {0x0748, 0x0002},
  2039. {0x074A, 0x0900},
  2040. {0x074C, 0x0100},
  2041. {0x074E, 0x0100},
  2042. {0x0750, 0x0000},
  2043. {0x1200, 0x0946},
  2044. {0x1202, 0x1A00},
  2045. {0x120E, 0x6027},
  2046. {0x1210, 0x8027},
  2047. {0x1246, 0x0105},
  2048. {0x1000, 0x0300},
  2049. {0x1002, 0xC311},
  2050. {0x1004, 0x2BB0},
  2051. {0x1010, 0x042B},
  2052. {0x1012, 0x0012},
  2053. {0x1014, 0x0020},
  2054. {0x1016, 0x0020},
  2055. {0x101A, 0x0020},
  2056. {0x1020, 0xC103},
  2057. {0x1022, 0x040F},
  2058. {0x1024, 0x0304},
  2059. {0x1026, 0x0607},
  2060. {0x1028, 0x0D06},
  2061. {0x102A, 0x0605},
  2062. {0x102C, 0x0C00},
  2063. {0x1038, 0x0000},
  2064. {0x103E, 0x0101},
  2065. {0x1040, 0x0000},
  2066. {0x1042, 0x0008},
  2067. {0x1044, 0x0120},
  2068. {0x1046, 0x01B0},
  2069. {0x1048, 0x0090},
  2070. {0x1066, 0x043B},
  2071. {0x1600, 0x0400},
  2072. {0x1608, 0x0028},
  2073. {0x160A, 0x0C80},
  2074. {0x160C, 0x001A},
  2075. {0x160E, 0x0960},
  2076. {0x0252, 0x0009},
  2077. {0x0202, 0x0000},
  2078. };
  2079. static const char * const hi847_test_pattern_menu[] = {
  2080. "No Pattern",
  2081. "Solid Colour",
  2082. "100% Colour Bars",
  2083. "Fade To Grey Colour Bars",
  2084. "PN9",
  2085. "Horizontal Gradient Pattern",
  2086. "Vertical Gradient Pattern",
  2087. "Check Board",
  2088. "Slant Pattern",
  2089. };
  2090. static const s64 link_freq_menu_items[] = {
  2091. HI847_LINK_FREQ_400MHZ,
  2092. HI847_LINK_FREQ_200MHZ,
  2093. };
  2094. static const struct hi847_link_freq_config link_freq_configs[] = {
  2095. [HI847_LINK_FREQ_400MHZ_INDEX] = {
  2096. .reg_list = {
  2097. .num_of_regs = ARRAY_SIZE(mipi_data_rate_lane_4),
  2098. .regs = mipi_data_rate_lane_4,
  2099. }
  2100. },
  2101. [HI847_LINK_FREQ_200MHZ_INDEX] = {
  2102. .reg_list = {
  2103. .num_of_regs = ARRAY_SIZE(mipi_data_rate_lane_4),
  2104. .regs = mipi_data_rate_lane_4,
  2105. }
  2106. }
  2107. };
  2108. static const struct hi847_mode supported_modes[] = {
  2109. {
  2110. .width = 3264,
  2111. .height = 2448,
  2112. .fll_def = HI847_FLL_30FPS,
  2113. .fll_min = HI847_FLL_30FPS_MIN,
  2114. .llp = 0x033C,
  2115. .reg_list = {
  2116. .num_of_regs = ARRAY_SIZE(mode_3264x2448_regs),
  2117. .regs = mode_3264x2448_regs,
  2118. },
  2119. .link_freq_index = HI847_LINK_FREQ_400MHZ_INDEX,
  2120. },
  2121. {
  2122. .width = 1632,
  2123. .height = 1224,
  2124. .fll_def = HI847_FLL_60FPS,
  2125. .fll_min = HI847_FLL_60FPS_MIN,
  2126. .llp = 0x033C,
  2127. .reg_list = {
  2128. .num_of_regs = ARRAY_SIZE(mode_1632x1224_regs),
  2129. .regs = mode_1632x1224_regs,
  2130. },
  2131. .link_freq_index = HI847_LINK_FREQ_200MHZ_INDEX,
  2132. }
  2133. };
  2134. struct hi847 {
  2135. struct v4l2_subdev sd;
  2136. struct media_pad pad;
  2137. struct v4l2_ctrl_handler ctrl_handler;
  2138. /* V4L2 Controls */
  2139. struct v4l2_ctrl *link_freq;
  2140. struct v4l2_ctrl *pixel_rate;
  2141. struct v4l2_ctrl *vblank;
  2142. struct v4l2_ctrl *hblank;
  2143. struct v4l2_ctrl *exposure;
  2144. struct v4l2_ctrl *vflip;
  2145. struct v4l2_ctrl *hflip;
  2146. /* Current mode */
  2147. const struct hi847_mode *cur_mode;
  2148. /* To serialize asynchronus callbacks */
  2149. struct mutex mutex;
  2150. /* Streaming on/off */
  2151. bool streaming;
  2152. };
  2153. static u64 to_pixel_rate(u32 f_index)
  2154. {
  2155. u64 pixel_rate = link_freq_menu_items[f_index] * 2 * HI847_DATA_LANES;
  2156. do_div(pixel_rate, HI847_RGB_DEPTH);
  2157. return pixel_rate;
  2158. }
  2159. static int hi847_read_reg(struct hi847 *hi847, u16 reg, u16 len, u32 *val)
  2160. {
  2161. struct i2c_client *client = v4l2_get_subdevdata(&hi847->sd);
  2162. struct i2c_msg msgs[2];
  2163. u8 addr_buf[2];
  2164. u8 data_buf[4] = {0};
  2165. int ret;
  2166. if (len > 4)
  2167. return -EINVAL;
  2168. put_unaligned_be16(reg, addr_buf);
  2169. msgs[0].addr = client->addr;
  2170. msgs[0].flags = 0;
  2171. msgs[0].len = sizeof(addr_buf);
  2172. msgs[0].buf = addr_buf;
  2173. msgs[1].addr = client->addr;
  2174. msgs[1].flags = I2C_M_RD;
  2175. msgs[1].len = len;
  2176. msgs[1].buf = &data_buf[4 - len];
  2177. ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
  2178. if (ret != ARRAY_SIZE(msgs))
  2179. return -EIO;
  2180. *val = get_unaligned_be32(data_buf);
  2181. return 0;
  2182. }
  2183. static int hi847_write_reg(struct hi847 *hi847, u16 reg, u16 len, u32 val)
  2184. {
  2185. struct i2c_client *client = v4l2_get_subdevdata(&hi847->sd);
  2186. u8 buf[6];
  2187. if (len > 4)
  2188. return -EINVAL;
  2189. put_unaligned_be16(reg, buf);
  2190. put_unaligned_be32(val << 8 * (4 - len), buf + 2);
  2191. if (i2c_master_send(client, buf, len + 2) != len + 2)
  2192. return -EIO;
  2193. return 0;
  2194. }
  2195. static int hi847_write_reg_list(struct hi847 *hi847,
  2196. const struct hi847_reg_list *r_list)
  2197. {
  2198. struct i2c_client *client = v4l2_get_subdevdata(&hi847->sd);
  2199. unsigned int i;
  2200. int ret;
  2201. for (i = 0; i < r_list->num_of_regs; i++) {
  2202. ret = hi847_write_reg(hi847, r_list->regs[i].address,
  2203. HI847_REG_VALUE_16BIT,
  2204. r_list->regs[i].val);
  2205. if (ret) {
  2206. dev_err_ratelimited(&client->dev,
  2207. "failed to write reg 0x%4.4x. error = %d",
  2208. r_list->regs[i].address, ret);
  2209. return ret;
  2210. }
  2211. }
  2212. return 0;
  2213. }
  2214. static int hi847_update_digital_gain(struct hi847 *hi847, u32 d_gain)
  2215. {
  2216. int ret;
  2217. ret = hi847_write_reg(hi847, HI847_REG_MWB_GR_GAIN,
  2218. HI847_REG_VALUE_16BIT, d_gain);
  2219. if (ret)
  2220. return ret;
  2221. ret = hi847_write_reg(hi847, HI847_REG_MWB_GB_GAIN,
  2222. HI847_REG_VALUE_16BIT, d_gain);
  2223. if (ret)
  2224. return ret;
  2225. ret = hi847_write_reg(hi847, HI847_REG_MWB_R_GAIN,
  2226. HI847_REG_VALUE_16BIT, d_gain);
  2227. if (ret)
  2228. return ret;
  2229. return hi847_write_reg(hi847, HI847_REG_MWB_B_GAIN,
  2230. HI847_REG_VALUE_16BIT, d_gain);
  2231. }
  2232. static int hi847_test_pattern(struct hi847 *hi847, u32 pattern)
  2233. {
  2234. int ret;
  2235. u32 val;
  2236. if (pattern) {
  2237. ret = hi847_read_reg(hi847, HI847_REG_ISP,
  2238. HI847_REG_VALUE_16BIT, &val);
  2239. if (ret)
  2240. return ret;
  2241. ret = hi847_write_reg(hi847, HI847_REG_ISP,
  2242. HI847_REG_VALUE_16BIT,
  2243. val | HI847_REG_ISP_TPG_EN);
  2244. if (ret)
  2245. return ret;
  2246. }
  2247. ret = hi847_read_reg(hi847, HI847_REG_TEST_PATTERN,
  2248. HI847_REG_VALUE_16BIT, &val);
  2249. if (ret)
  2250. return ret;
  2251. return hi847_write_reg(hi847, HI847_REG_TEST_PATTERN,
  2252. HI847_REG_VALUE_16BIT, val | pattern << 8);
  2253. }
  2254. static int hi847_grbg_shift(struct hi847 *hi847)
  2255. {
  2256. int ret;
  2257. int hflip, vflip;
  2258. /* regs shift for full size */
  2259. static const u32 FORMAT_X_SHIFT_1[2][2] = {
  2260. { 0x0008, 0x0007, },
  2261. { 0x0008, 0x0007, },
  2262. };
  2263. static const u32 FORMAT_Y_SHIFT_1[2][2] = {
  2264. { 0x0002, 0x0002, },
  2265. { 0x0001, 0x0001, },
  2266. };
  2267. /* regs shift for binning size */
  2268. static const u32 FORMAT_X_SHIFT_2[2][2] = {
  2269. { 0x0004, 0x0003, },
  2270. { 0x0004, 0x0003, },
  2271. };
  2272. static const u32 FORMAT_Y_SHIFT_2[2][2] = {
  2273. { 0x0002, 0x0002, },
  2274. { 0x0001, 0x0001, },
  2275. };
  2276. hflip = hi847->hflip->val;
  2277. vflip = hi847->vflip->val;
  2278. if (hi847->cur_mode->width == 3264) {
  2279. ret = hi847_write_reg(hi847, HI847_REG_FORMAT_X,
  2280. HI847_REG_VALUE_16BIT,
  2281. FORMAT_X_SHIFT_1[vflip][hflip]);
  2282. if (ret)
  2283. return ret;
  2284. return hi847_write_reg(hi847, HI847_REG_FORMAT_Y,
  2285. HI847_REG_VALUE_16BIT,
  2286. FORMAT_Y_SHIFT_1[vflip][hflip]);
  2287. } else {
  2288. ret = hi847_write_reg(hi847, HI847_REG_FORMAT_X,
  2289. HI847_REG_VALUE_16BIT,
  2290. FORMAT_X_SHIFT_2[vflip][hflip]);
  2291. if (ret)
  2292. return ret;
  2293. return hi847_write_reg(hi847, HI847_REG_FORMAT_Y,
  2294. HI847_REG_VALUE_16BIT,
  2295. FORMAT_Y_SHIFT_2[vflip][hflip]);
  2296. }
  2297. }
  2298. static int hi847_set_ctrl_hflip(struct hi847 *hi847, u32 ctrl_val)
  2299. {
  2300. int ret;
  2301. u32 val;
  2302. ret = hi847_read_reg(hi847, HI847_REG_MIRROR_FLIP,
  2303. HI847_REG_VALUE_16BIT, &val);
  2304. if (ret)
  2305. return ret;
  2306. ret = hi847_grbg_shift(hi847);
  2307. if (ret)
  2308. return ret;
  2309. return hi847_write_reg(hi847, HI847_REG_MIRROR_FLIP,
  2310. HI847_REG_VALUE_16BIT,
  2311. ctrl_val ? val | BIT(8) : val & ~BIT(8));
  2312. }
  2313. static int hi847_set_ctrl_vflip(struct hi847 *hi847, u8 ctrl_val)
  2314. {
  2315. int ret;
  2316. u32 val;
  2317. ret = hi847_read_reg(hi847, HI847_REG_MIRROR_FLIP,
  2318. HI847_REG_VALUE_16BIT, &val);
  2319. if (ret)
  2320. return ret;
  2321. ret = hi847_grbg_shift(hi847);
  2322. if (ret)
  2323. return ret;
  2324. return hi847_write_reg(hi847, HI847_REG_MIRROR_FLIP,
  2325. HI847_REG_VALUE_16BIT,
  2326. ctrl_val ? val | BIT(9) : val & ~BIT(9));
  2327. }
  2328. static int hi847_set_ctrl(struct v4l2_ctrl *ctrl)
  2329. {
  2330. struct hi847 *hi847 = container_of(ctrl->handler,
  2331. struct hi847, ctrl_handler);
  2332. struct i2c_client *client = v4l2_get_subdevdata(&hi847->sd);
  2333. s64 exposure_max;
  2334. int ret = 0;
  2335. /* Propagate change of current control to all related controls */
  2336. if (ctrl->id == V4L2_CID_VBLANK) {
  2337. /* Update max exposure while meeting expected vblanking */
  2338. exposure_max = hi847->cur_mode->height + ctrl->val -
  2339. HI847_EXPOSURE_MAX_MARGIN;
  2340. __v4l2_ctrl_modify_range(hi847->exposure,
  2341. hi847->exposure->minimum,
  2342. exposure_max, hi847->exposure->step,
  2343. exposure_max);
  2344. }
  2345. /* V4L2 controls values will be applied only when power is already up */
  2346. if (!pm_runtime_get_if_in_use(&client->dev))
  2347. return 0;
  2348. switch (ctrl->id) {
  2349. case V4L2_CID_ANALOGUE_GAIN:
  2350. ret = hi847_write_reg(hi847, HI847_REG_ANALOG_GAIN,
  2351. HI847_REG_VALUE_16BIT, ctrl->val);
  2352. break;
  2353. case V4L2_CID_DIGITAL_GAIN:
  2354. ret = hi847_update_digital_gain(hi847, ctrl->val);
  2355. break;
  2356. case V4L2_CID_EXPOSURE:
  2357. ret = hi847_write_reg(hi847, HI847_REG_EXPOSURE,
  2358. HI847_REG_VALUE_16BIT, ctrl->val);
  2359. break;
  2360. case V4L2_CID_VBLANK:
  2361. /* Update FLL that meets expected vertical blanking */
  2362. ret = hi847_write_reg(hi847, HI847_REG_FLL,
  2363. HI847_REG_VALUE_16BIT,
  2364. hi847->cur_mode->height + ctrl->val);
  2365. break;
  2366. case V4L2_CID_TEST_PATTERN:
  2367. ret = hi847_test_pattern(hi847, ctrl->val);
  2368. break;
  2369. case V4L2_CID_HFLIP:
  2370. hi847_set_ctrl_hflip(hi847, ctrl->val);
  2371. break;
  2372. case V4L2_CID_VFLIP:
  2373. hi847_set_ctrl_vflip(hi847, ctrl->val);
  2374. break;
  2375. default:
  2376. ret = -EINVAL;
  2377. break;
  2378. }
  2379. pm_runtime_put(&client->dev);
  2380. return ret;
  2381. }
  2382. static const struct v4l2_ctrl_ops hi847_ctrl_ops = {
  2383. .s_ctrl = hi847_set_ctrl,
  2384. };
  2385. static int hi847_init_controls(struct hi847 *hi847)
  2386. {
  2387. struct v4l2_ctrl_handler *ctrl_hdlr;
  2388. s64 exposure_max, h_blank;
  2389. int ret;
  2390. ctrl_hdlr = &hi847->ctrl_handler;
  2391. ret = v4l2_ctrl_handler_init(ctrl_hdlr, 8);
  2392. if (ret)
  2393. return ret;
  2394. ctrl_hdlr->lock = &hi847->mutex;
  2395. hi847->link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, &hi847_ctrl_ops,
  2396. V4L2_CID_LINK_FREQ,
  2397. ARRAY_SIZE(link_freq_menu_items) - 1,
  2398. 0, link_freq_menu_items);
  2399. if (hi847->link_freq)
  2400. hi847->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
  2401. hi847->pixel_rate = v4l2_ctrl_new_std
  2402. (ctrl_hdlr, &hi847_ctrl_ops,
  2403. V4L2_CID_PIXEL_RATE, 0,
  2404. to_pixel_rate(HI847_LINK_FREQ_400MHZ_INDEX),
  2405. 1,
  2406. to_pixel_rate(HI847_LINK_FREQ_400MHZ_INDEX));
  2407. hi847->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &hi847_ctrl_ops,
  2408. V4L2_CID_VBLANK,
  2409. hi847->cur_mode->fll_min -
  2410. hi847->cur_mode->height,
  2411. HI847_FLL_MAX -
  2412. hi847->cur_mode->height, 1,
  2413. hi847->cur_mode->fll_def -
  2414. hi847->cur_mode->height);
  2415. h_blank = hi847->cur_mode->llp - hi847->cur_mode->width;
  2416. hi847->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &hi847_ctrl_ops,
  2417. V4L2_CID_HBLANK, h_blank, h_blank, 1,
  2418. h_blank);
  2419. if (hi847->hblank)
  2420. hi847->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
  2421. v4l2_ctrl_new_std(ctrl_hdlr, &hi847_ctrl_ops, V4L2_CID_ANALOGUE_GAIN,
  2422. HI847_ANAL_GAIN_MIN, HI847_ANAL_GAIN_MAX,
  2423. HI847_ANAL_GAIN_STEP, HI847_ANAL_GAIN_MIN);
  2424. v4l2_ctrl_new_std(ctrl_hdlr, &hi847_ctrl_ops, V4L2_CID_DIGITAL_GAIN,
  2425. HI847_DGTL_GAIN_MIN, HI847_DGTL_GAIN_MAX,
  2426. HI847_DGTL_GAIN_STEP, HI847_DGTL_GAIN_DEFAULT);
  2427. exposure_max = hi847->cur_mode->fll_def - HI847_EXPOSURE_MAX_MARGIN;
  2428. hi847->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &hi847_ctrl_ops,
  2429. V4L2_CID_EXPOSURE,
  2430. HI847_EXPOSURE_MIN, exposure_max,
  2431. HI847_EXPOSURE_STEP,
  2432. exposure_max);
  2433. v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &hi847_ctrl_ops,
  2434. V4L2_CID_TEST_PATTERN,
  2435. ARRAY_SIZE(hi847_test_pattern_menu) - 1,
  2436. 0, 0, hi847_test_pattern_menu);
  2437. hi847->hflip = v4l2_ctrl_new_std(ctrl_hdlr, &hi847_ctrl_ops,
  2438. V4L2_CID_HFLIP, 0, 1, 1, 0);
  2439. hi847->vflip = v4l2_ctrl_new_std(ctrl_hdlr, &hi847_ctrl_ops,
  2440. V4L2_CID_VFLIP, 0, 1, 1, 0);
  2441. if (ctrl_hdlr->error)
  2442. return ctrl_hdlr->error;
  2443. hi847->sd.ctrl_handler = ctrl_hdlr;
  2444. return 0;
  2445. }
  2446. static void hi847_assign_pad_format(const struct hi847_mode *mode,
  2447. struct v4l2_mbus_framefmt *fmt)
  2448. {
  2449. fmt->width = mode->width;
  2450. fmt->height = mode->height;
  2451. fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10;
  2452. fmt->field = V4L2_FIELD_NONE;
  2453. }
  2454. static int hi847_start_streaming(struct hi847 *hi847)
  2455. {
  2456. struct i2c_client *client = v4l2_get_subdevdata(&hi847->sd);
  2457. const struct hi847_reg_list *reg_list;
  2458. int link_freq_index, ret;
  2459. link_freq_index = hi847->cur_mode->link_freq_index;
  2460. reg_list = &link_freq_configs[link_freq_index].reg_list;
  2461. ret = hi847_write_reg_list(hi847, reg_list);
  2462. if (ret) {
  2463. dev_err(&client->dev, "failed to set plls");
  2464. return ret;
  2465. }
  2466. reg_list = &hi847->cur_mode->reg_list;
  2467. ret = hi847_write_reg_list(hi847, reg_list);
  2468. if (ret) {
  2469. dev_err(&client->dev, "failed to set mode");
  2470. return ret;
  2471. }
  2472. ret = __v4l2_ctrl_handler_setup(hi847->sd.ctrl_handler);
  2473. if (ret)
  2474. return ret;
  2475. ret = hi847_write_reg(hi847, HI847_REG_MODE_TG,
  2476. HI847_REG_VALUE_16BIT, HI847_REG_MODE_TG_ENABLE);
  2477. ret = hi847_write_reg(hi847, HI847_REG_MODE_SELECT,
  2478. HI847_REG_VALUE_16BIT, HI847_MODE_STREAMING);
  2479. if (ret) {
  2480. dev_err(&client->dev, "failed to set stream");
  2481. return ret;
  2482. }
  2483. return 0;
  2484. }
  2485. static void hi847_stop_streaming(struct hi847 *hi847)
  2486. {
  2487. struct i2c_client *client = v4l2_get_subdevdata(&hi847->sd);
  2488. if (hi847_write_reg(hi847, HI847_REG_MODE_TG,
  2489. HI847_REG_VALUE_16BIT, HI847_REG_MODE_TG_DISABLE))
  2490. dev_err(&client->dev, "failed to set stream 0x%x",
  2491. HI847_REG_MODE_TG);
  2492. if (hi847_write_reg(hi847, HI847_REG_MODE_SELECT,
  2493. HI847_REG_VALUE_16BIT, HI847_MODE_STANDBY))
  2494. dev_err(&client->dev, "failed to set stream 0x%x",
  2495. HI847_REG_MODE_SELECT);
  2496. }
  2497. static int hi847_set_stream(struct v4l2_subdev *sd, int enable)
  2498. {
  2499. struct hi847 *hi847 = to_hi847(sd);
  2500. struct i2c_client *client = v4l2_get_subdevdata(sd);
  2501. int ret = 0;
  2502. if (hi847->streaming == enable)
  2503. return 0;
  2504. mutex_lock(&hi847->mutex);
  2505. if (enable) {
  2506. ret = pm_runtime_get_sync(&client->dev);
  2507. if (ret < 0) {
  2508. pm_runtime_put_noidle(&client->dev);
  2509. mutex_unlock(&hi847->mutex);
  2510. return ret;
  2511. }
  2512. ret = hi847_start_streaming(hi847);
  2513. if (ret) {
  2514. enable = 0;
  2515. hi847_stop_streaming(hi847);
  2516. pm_runtime_put(&client->dev);
  2517. }
  2518. } else {
  2519. hi847_stop_streaming(hi847);
  2520. pm_runtime_put(&client->dev);
  2521. }
  2522. hi847->streaming = enable;
  2523. mutex_unlock(&hi847->mutex);
  2524. return ret;
  2525. }
  2526. static int __maybe_unused hi847_suspend(struct device *dev)
  2527. {
  2528. struct i2c_client *client = to_i2c_client(dev);
  2529. struct v4l2_subdev *sd = i2c_get_clientdata(client);
  2530. struct hi847 *hi847 = to_hi847(sd);
  2531. mutex_lock(&hi847->mutex);
  2532. if (hi847->streaming)
  2533. hi847_stop_streaming(hi847);
  2534. mutex_unlock(&hi847->mutex);
  2535. return 0;
  2536. }
  2537. static int __maybe_unused hi847_resume(struct device *dev)
  2538. {
  2539. struct i2c_client *client = to_i2c_client(dev);
  2540. struct v4l2_subdev *sd = i2c_get_clientdata(client);
  2541. struct hi847 *hi847 = to_hi847(sd);
  2542. int ret;
  2543. mutex_lock(&hi847->mutex);
  2544. if (hi847->streaming) {
  2545. ret = hi847_start_streaming(hi847);
  2546. if (ret)
  2547. goto error;
  2548. }
  2549. mutex_unlock(&hi847->mutex);
  2550. return 0;
  2551. error:
  2552. hi847_stop_streaming(hi847);
  2553. hi847->streaming = 0;
  2554. mutex_unlock(&hi847->mutex);
  2555. return ret;
  2556. }
  2557. static int hi847_set_format(struct v4l2_subdev *sd,
  2558. struct v4l2_subdev_state *sd_state,
  2559. struct v4l2_subdev_format *fmt)
  2560. {
  2561. struct hi847 *hi847 = to_hi847(sd);
  2562. const struct hi847_mode *mode;
  2563. s32 vblank_def, h_blank;
  2564. mode = v4l2_find_nearest_size(supported_modes,
  2565. ARRAY_SIZE(supported_modes), width,
  2566. height, fmt->format.width,
  2567. fmt->format.height);
  2568. mutex_lock(&hi847->mutex);
  2569. hi847_assign_pad_format(mode, &fmt->format);
  2570. if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
  2571. *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) =
  2572. fmt->format;
  2573. } else {
  2574. hi847->cur_mode = mode;
  2575. __v4l2_ctrl_s_ctrl(hi847->link_freq, mode->link_freq_index);
  2576. __v4l2_ctrl_s_ctrl_int64(hi847->pixel_rate,
  2577. to_pixel_rate(mode->link_freq_index));
  2578. /* Update limits and set FPS to default */
  2579. vblank_def = mode->fll_def - mode->height;
  2580. __v4l2_ctrl_modify_range(hi847->vblank,
  2581. mode->fll_min - mode->height,
  2582. HI847_FLL_MAX - mode->height, 1,
  2583. vblank_def);
  2584. __v4l2_ctrl_s_ctrl(hi847->vblank, vblank_def);
  2585. h_blank = hi847->cur_mode->llp - hi847->cur_mode->width;
  2586. __v4l2_ctrl_modify_range(hi847->hblank, h_blank, h_blank, 1,
  2587. h_blank);
  2588. }
  2589. mutex_unlock(&hi847->mutex);
  2590. return 0;
  2591. }
  2592. static int hi847_get_format(struct v4l2_subdev *sd,
  2593. struct v4l2_subdev_state *sd_state,
  2594. struct v4l2_subdev_format *fmt)
  2595. {
  2596. struct hi847 *hi847 = to_hi847(sd);
  2597. mutex_lock(&hi847->mutex);
  2598. if (fmt->which == V4L2_SUBDEV_FORMAT_TRY)
  2599. fmt->format = *v4l2_subdev_get_try_format(&hi847->sd,
  2600. sd_state,
  2601. fmt->pad);
  2602. else
  2603. hi847_assign_pad_format(hi847->cur_mode, &fmt->format);
  2604. mutex_unlock(&hi847->mutex);
  2605. return 0;
  2606. }
  2607. static int hi847_enum_mbus_code(struct v4l2_subdev *sd,
  2608. struct v4l2_subdev_state *sd_state,
  2609. struct v4l2_subdev_mbus_code_enum *code)
  2610. {
  2611. if (code->index > 0)
  2612. return -EINVAL;
  2613. code->code = MEDIA_BUS_FMT_SGRBG10_1X10;
  2614. return 0;
  2615. }
  2616. static int hi847_enum_frame_size(struct v4l2_subdev *sd,
  2617. struct v4l2_subdev_state *sd_state,
  2618. struct v4l2_subdev_frame_size_enum *fse)
  2619. {
  2620. if (fse->index >= ARRAY_SIZE(supported_modes))
  2621. return -EINVAL;
  2622. if (fse->code != MEDIA_BUS_FMT_SGRBG10_1X10)
  2623. return -EINVAL;
  2624. fse->min_width = supported_modes[fse->index].width;
  2625. fse->max_width = fse->min_width;
  2626. fse->min_height = supported_modes[fse->index].height;
  2627. fse->max_height = fse->min_height;
  2628. return 0;
  2629. }
  2630. static int hi847_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
  2631. {
  2632. struct hi847 *hi847 = to_hi847(sd);
  2633. mutex_lock(&hi847->mutex);
  2634. hi847_assign_pad_format(&supported_modes[0],
  2635. v4l2_subdev_get_try_format(sd, fh->state, 0));
  2636. mutex_unlock(&hi847->mutex);
  2637. return 0;
  2638. }
  2639. static const struct v4l2_subdev_video_ops hi847_video_ops = {
  2640. .s_stream = hi847_set_stream,
  2641. };
  2642. static const struct v4l2_subdev_pad_ops hi847_pad_ops = {
  2643. .set_fmt = hi847_set_format,
  2644. .get_fmt = hi847_get_format,
  2645. .enum_mbus_code = hi847_enum_mbus_code,
  2646. .enum_frame_size = hi847_enum_frame_size,
  2647. };
  2648. static const struct v4l2_subdev_ops hi847_subdev_ops = {
  2649. .video = &hi847_video_ops,
  2650. .pad = &hi847_pad_ops,
  2651. };
  2652. static const struct media_entity_operations hi847_subdev_entity_ops = {
  2653. .link_validate = v4l2_subdev_link_validate,
  2654. };
  2655. static const struct v4l2_subdev_internal_ops hi847_internal_ops = {
  2656. .open = hi847_open,
  2657. };
  2658. static int hi847_identify_module(struct hi847 *hi847)
  2659. {
  2660. struct i2c_client *client = v4l2_get_subdevdata(&hi847->sd);
  2661. int ret;
  2662. u32 val;
  2663. ret = hi847_read_reg(hi847, HI847_REG_CHIP_ID,
  2664. HI847_REG_VALUE_16BIT, &val);
  2665. if (ret)
  2666. return ret;
  2667. if (val != HI847_CHIP_ID) {
  2668. dev_err(&client->dev, "chip id mismatch: %x!=%x",
  2669. HI847_CHIP_ID, val);
  2670. return -ENXIO;
  2671. }
  2672. return 0;
  2673. }
  2674. static int hi847_check_hwcfg(struct device *dev)
  2675. {
  2676. struct fwnode_handle *ep;
  2677. struct fwnode_handle *fwnode = dev_fwnode(dev);
  2678. struct v4l2_fwnode_endpoint bus_cfg = {
  2679. .bus_type = V4L2_MBUS_CSI2_DPHY
  2680. };
  2681. u32 mclk;
  2682. int ret;
  2683. unsigned int i, j;
  2684. if (!fwnode)
  2685. return -ENXIO;
  2686. ret = fwnode_property_read_u32(fwnode, "clock-frequency", &mclk);
  2687. if (ret) {
  2688. dev_err(dev, "can't get clock frequency");
  2689. return ret;
  2690. }
  2691. if (mclk != HI847_MCLK) {
  2692. dev_err(dev, "external clock %d is not supported", mclk);
  2693. return -EINVAL;
  2694. }
  2695. ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
  2696. if (!ep)
  2697. return -ENXIO;
  2698. ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
  2699. fwnode_handle_put(ep);
  2700. if (ret)
  2701. return ret;
  2702. if (bus_cfg.bus.mipi_csi2.num_data_lanes != HI847_DATA_LANES) {
  2703. dev_err(dev, "number of CSI2 data lanes %d is not supported",
  2704. bus_cfg.bus.mipi_csi2.num_data_lanes);
  2705. ret = -EINVAL;
  2706. goto check_hwcfg_error;
  2707. }
  2708. if (!bus_cfg.nr_of_link_frequencies) {
  2709. dev_err(dev, "no link frequencies defined");
  2710. ret = -EINVAL;
  2711. goto check_hwcfg_error;
  2712. }
  2713. for (i = 0; i < ARRAY_SIZE(link_freq_menu_items); i++) {
  2714. for (j = 0; j < bus_cfg.nr_of_link_frequencies; j++) {
  2715. if (link_freq_menu_items[i] ==
  2716. bus_cfg.link_frequencies[j])
  2717. break;
  2718. }
  2719. if (j == bus_cfg.nr_of_link_frequencies) {
  2720. dev_err(dev, "no link frequency %lld supported",
  2721. link_freq_menu_items[i]);
  2722. ret = -EINVAL;
  2723. goto check_hwcfg_error;
  2724. }
  2725. }
  2726. check_hwcfg_error:
  2727. v4l2_fwnode_endpoint_free(&bus_cfg);
  2728. return ret;
  2729. }
  2730. static void hi847_remove(struct i2c_client *client)
  2731. {
  2732. struct v4l2_subdev *sd = i2c_get_clientdata(client);
  2733. struct hi847 *hi847 = to_hi847(sd);
  2734. v4l2_async_unregister_subdev(sd);
  2735. media_entity_cleanup(&sd->entity);
  2736. v4l2_ctrl_handler_free(sd->ctrl_handler);
  2737. pm_runtime_disable(&client->dev);
  2738. mutex_destroy(&hi847->mutex);
  2739. }
  2740. static int hi847_probe(struct i2c_client *client)
  2741. {
  2742. struct hi847 *hi847;
  2743. int ret;
  2744. hi847 = devm_kzalloc(&client->dev, sizeof(*hi847), GFP_KERNEL);
  2745. if (!hi847)
  2746. return -ENOMEM;
  2747. ret = hi847_check_hwcfg(&client->dev);
  2748. if (ret) {
  2749. dev_err(&client->dev, "failed to get HW configuration: %d",
  2750. ret);
  2751. return ret;
  2752. }
  2753. v4l2_i2c_subdev_init(&hi847->sd, client, &hi847_subdev_ops);
  2754. ret = hi847_identify_module(hi847);
  2755. if (ret) {
  2756. dev_err(&client->dev, "failed to find sensor: %d", ret);
  2757. return ret;
  2758. }
  2759. mutex_init(&hi847->mutex);
  2760. hi847->cur_mode = &supported_modes[0];
  2761. ret = hi847_init_controls(hi847);
  2762. if (ret) {
  2763. dev_err(&client->dev, "failed to init controls: %d", ret);
  2764. goto probe_error_v4l2_ctrl_handler_free;
  2765. }
  2766. hi847->sd.internal_ops = &hi847_internal_ops;
  2767. hi847->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
  2768. hi847->sd.entity.ops = &hi847_subdev_entity_ops;
  2769. hi847->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
  2770. hi847->pad.flags = MEDIA_PAD_FL_SOURCE;
  2771. ret = media_entity_pads_init(&hi847->sd.entity, 1, &hi847->pad);
  2772. if (ret) {
  2773. dev_err(&client->dev, "failed to init entity pads: %d", ret);
  2774. goto probe_error_v4l2_ctrl_handler_free;
  2775. }
  2776. ret = v4l2_async_register_subdev_sensor(&hi847->sd);
  2777. if (ret < 0) {
  2778. dev_err(&client->dev, "failed to register V4L2 subdev: %d",
  2779. ret);
  2780. goto probe_error_media_entity_cleanup;
  2781. }
  2782. pm_runtime_set_active(&client->dev);
  2783. pm_runtime_enable(&client->dev);
  2784. pm_runtime_idle(&client->dev);
  2785. return 0;
  2786. probe_error_media_entity_cleanup:
  2787. media_entity_cleanup(&hi847->sd.entity);
  2788. probe_error_v4l2_ctrl_handler_free:
  2789. v4l2_ctrl_handler_free(hi847->sd.ctrl_handler);
  2790. mutex_destroy(&hi847->mutex);
  2791. return ret;
  2792. }
  2793. static const struct dev_pm_ops hi847_pm_ops = {
  2794. SET_SYSTEM_SLEEP_PM_OPS(hi847_suspend, hi847_resume)
  2795. };
  2796. #ifdef CONFIG_ACPI
  2797. static const struct acpi_device_id hi847_acpi_ids[] = {
  2798. {"HYV0847"},
  2799. {}
  2800. };
  2801. MODULE_DEVICE_TABLE(acpi, hi847_acpi_ids);
  2802. #endif
  2803. static struct i2c_driver hi847_i2c_driver = {
  2804. .driver = {
  2805. .name = "hi847",
  2806. .pm = &hi847_pm_ops,
  2807. .acpi_match_table = ACPI_PTR(hi847_acpi_ids),
  2808. },
  2809. .probe_new = hi847_probe,
  2810. .remove = hi847_remove,
  2811. };
  2812. module_i2c_driver(hi847_i2c_driver);
  2813. MODULE_AUTHOR("Shawn Tu <[email protected]>");
  2814. MODULE_DESCRIPTION("Hynix HI847 sensor driver");
  2815. MODULE_LICENSE("GPL v2");