mt_spm_sleep.c 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881
  1. #include <linux/init.h>
  2. #include <linux/module.h>
  3. #include <linux/kernel.h>
  4. #include <linux/spinlock.h>
  5. #include <linux/delay.h>
  6. #include <linux/string.h>
  7. #include <mt-plat/aee.h>
  8. #include <linux/i2c.h>
  9. #include <linux/of_fdt.h>
  10. #include <asm/setup.h>
  11. #include <linux/lockdep.h>
  12. #include <linux/irqchip/mt-gic.h>
  13. /* #include <mach/mt_cirq.h> */
  14. #include "mt_spm_sleep.h"
  15. #include "mach/mt_clkmgr.h"
  16. #include "mt_cpuidle.h"
  17. #include <mach/wd_api.h>
  18. /* #include <mach/eint.h> */
  19. /* #include <mach/mtk_ccci_helper.h> */
  20. #include <mt-plat/mt_ccci_common.h>
  21. #include "mt_cpufreq.h"
  22. #include "mt_power_gs-v1.h"
  23. /* #include <mt-plat/upmu_common.h> */
  24. /* #include <mt-plat/upmu_sw.h> */
  25. /* #include <mt-plat/upmu_hw.h> */
  26. /* #include "mach/mt_pmic_wrap.h" */
  27. /* #include <mt_i2c.h> */
  28. #include "mt_spm_internal.h"
  29. #if !defined(CONFIG_ARCH_MT6580)
  30. #include "pwrap_hal.h"
  31. #include "mt_vcore_dvfs.h"
  32. /* #include <mach/mt_dramc.h> */
  33. #endif
  34. /* for MP0,1 AXI_CONFIG */
  35. #ifdef CONFIG_OF
  36. #include <linux/of.h>
  37. #include <linux/of_irq.h>
  38. #include <linux/of_address.h>
  39. #endif
  40. #if defined(CONFIG_ARCH_MT6580)
  41. #define DISABLE_DLPT_FEATURE
  42. #endif
  43. /**************************************
  44. * only for internal debug
  45. **************************************/
  46. #ifdef CONFIG_MTK_LDVT
  47. #define SPM_PWAKE_EN 0
  48. #define SPM_PCMWDT_EN 0
  49. #define SPM_BYPASS_SYSPWREQ 1
  50. #else
  51. #define SPM_PWAKE_EN 1
  52. #define SPM_PCMWDT_EN 1
  53. #define SPM_BYPASS_SYSPWREQ 0
  54. #endif
  55. #define SPM_PCMTIMER_DIS 0
  56. #define I2C_CHANNEL 2
  57. int spm_dormant_sta = 0; /* MT_CPU_DORMANT_RESET */
  58. int spm_ap_mdsrc_req_cnt = 0;
  59. u32 spm_suspend_flag = 0;
  60. struct wake_status suspend_info[20];
  61. u32 log_wakesta_cnt = 0;
  62. u32 log_wakesta_index = 0;
  63. u8 spm_snapshot_golden_setting = 0;
  64. struct wake_status spm_wakesta; /* record last wakesta */
  65. /* please put firmware to vendor/mediatek/proprietary/hardware/spm/mtxxxx/ */
  66. /* todo: dyna load SPM FW */
  67. /*
  68. #if defined(CONFIG_ARCH_MT6580)
  69. #define USE_DYNA_LOAD_SUSPEND
  70. #endif
  71. */
  72. #ifndef USE_DYNA_LOAD_SUSPEND
  73. /**********************************************************
  74. * PCM code for suspend
  75. **********************************************************/
  76. #if defined(CONFIG_ARCH_MT6735)
  77. static const u32 suspend_binary[] = {
  78. 0x81429801, 0xd80001e5, 0x17c07c1f, 0x18c0001f, 0x10001138, 0x1910001f,
  79. 0x10001138, 0xa1108404, 0xe0c00004, 0x1910001f, 0x10001138, 0x1a00001f,
  80. 0x10006604, 0xc0c03de0, 0xe2200007, 0x1a00001f, 0x100062c4, 0x1890001f,
  81. 0x100062c4, 0xa0940402, 0x1b00001f, 0x10000001, 0x1910001f, 0x10006310,
  82. 0x80c39001, 0xd8200443, 0xe2000002, 0x80c10001, 0x1b00001f, 0xbf7ce7ff,
  83. 0xd8200443, 0x17c07c1f, 0x1b00001f, 0x7f7ce7ff, 0xf0000000, 0x17c07c1f,
  84. 0x81429801, 0xd8000665, 0x17c07c1f, 0x18c0001f, 0x10001138, 0x1910001f,
  85. 0x10001138, 0x81308404, 0xe0c00004, 0x1910001f, 0x10001138, 0x1a00001f,
  86. 0x10006604, 0xc0c03de0, 0xe2200007, 0x1a00001f, 0x100062c4, 0x1890001f,
  87. 0x100062c4, 0x80b40402, 0x1b00001f, 0x00801001, 0x1910001f, 0x10006310,
  88. 0x80c39001, 0xd82008c3, 0xe2000002, 0x80c10001, 0x1b00001f, 0x6ffcf7ff,
  89. 0xd80008c3, 0x17c07c1f, 0x1b00001f, 0xaffce7ff, 0xf0000000, 0x17c07c1f,
  90. 0x81f58407, 0x81f68407, 0x1800001f, 0x17cf0f3f, 0x1b80001f, 0x20000000,
  91. 0x1800001f, 0x17cf0f16, 0xa1d28407, 0x81f20407, 0x81409801, 0xd8000b25,
  92. 0x17c07c1f, 0x18c0001f, 0x10006234, 0xc0c02960, 0x1200041f, 0x80310400,
  93. 0x1b80001f, 0x2000000a, 0xa0110400, 0x81f00407, 0xa1dd0407, 0x18c0001f,
  94. 0x100062d8, 0xc0c02c20, 0x1200041f, 0x81fd0407, 0xc2803ec0, 0x1290041f,
  95. 0x1b00001f, 0x6ffcf7ff, 0xf0000000, 0x17c07c1f, 0x1b00001f, 0x2f7ce7ff,
  96. 0x1b80001f, 0x20000004, 0xd80013ec, 0x17c07c1f, 0x1880001f, 0x10006320,
  97. 0xc0c02f40, 0xe080000f, 0xd8200f43, 0x17c07c1f, 0x1b00001f, 0x6ffcf7ff,
  98. 0xd00013e0, 0x17c07c1f, 0xe080001f, 0x81409801, 0xd80011c5, 0x17c07c1f,
  99. 0x18c0001f, 0x10214094, 0x1910001f, 0x1020e374, 0xe0c00004, 0x18c0001f,
  100. 0x10214098, 0x1910001f, 0x1020e378, 0xe0c00004, 0x1910001f, 0x10213378,
  101. 0x18c0001f, 0x10006234, 0xc0c02b40, 0x17c07c1f, 0x18c0001f, 0x100062d8,
  102. 0xc0c02d40, 0x17c07c1f, 0xc2803ec0, 0x1290841f, 0xa1d20407, 0x81f28407,
  103. 0xa1d68407, 0x1800001f, 0x17cf0f3f, 0x1800001f, 0x17ff0f3f, 0x19c0001f,
  104. 0x001c2397, 0x1b00001f, 0x2f7cefff, 0xf0000000, 0x17c07c1f, 0x1910001f,
  105. 0x102135cc, 0x81411801, 0xd8001585, 0x17c07c1f, 0x18c0001f, 0x10006240,
  106. 0xe0e00016, 0xe0e0001e, 0xe0e0000e, 0xe0e0000f, 0x803e0400, 0x1b80001f,
  107. 0x20000222, 0x80380400, 0x1b80001f, 0x20000280, 0x803b0400, 0x1b80001f,
  108. 0x2000001a, 0x803d0400, 0x1b80001f, 0x20000208, 0x80340400, 0x80310400,
  109. 0xe8208000, 0x10210044, 0x00000100, 0x1b80001f, 0x20000068, 0x1b80001f,
  110. 0x2000000a, 0x18c0001f, 0x10006240, 0xe0e0000d, 0xd8001c45, 0x17c07c1f,
  111. 0x1b80001f, 0x20000020, 0x18c0001f, 0x102130f0, 0x1910001f, 0x102130f0,
  112. 0xa9000004, 0x10000000, 0xe0c00004, 0x1b80001f, 0x2000000a, 0x89000004,
  113. 0xefffffff, 0xe0c00004, 0x18c0001f, 0x102140f4, 0x1910001f, 0x102140f4,
  114. 0xa9000004, 0x02000000, 0xe0c00004, 0x1b80001f, 0x2000000a, 0x89000004,
  115. 0xfdffffff, 0xe0c00004, 0x1910001f, 0x102140f4, 0x81fa0407, 0x81f08407,
  116. 0xe8208000, 0x10006354, 0x001fdaa3, 0xa9c00007, 0x60010000, 0xc2803ec0,
  117. 0x1291041f, 0x1b00001f, 0xbf7ce7ff, 0x1950001f, 0x100062c4, 0x80c41401,
  118. 0xd8001e83, 0x17c07c1f, 0x1b00001f, 0xaffce7ff, 0xf0000000, 0x17c07c1f,
  119. 0x1b80001f, 0x20000fdf, 0x1a50001f, 0x10006608, 0x80c9a401, 0x810ba401,
  120. 0x10920c1f, 0xa0979002, 0x80ca2401, 0xa0938c02, 0x8080080d, 0xd82022e2,
  121. 0x17c07c1f, 0x81f08407, 0xa9c00007, 0x60010000, 0x1b00001f, 0x2f7ce7ff,
  122. 0x1b80001f, 0x20000004, 0xd800292c, 0x17c07c1f, 0x1b00001f, 0xbf7ce7ff,
  123. 0x1950001f, 0x100062c4, 0x80c41401, 0xd8002923, 0x17c07c1f, 0x1b00001f,
  124. 0xaffce7ff, 0xd0002920, 0x17c07c1f, 0x89c00007, 0x9ffeffff, 0x1900001f,
  125. 0x40000000, 0x18d0001f, 0x40000000, 0xe1000003, 0xc0c03060, 0x1080041f,
  126. 0x1880001f, 0x10006320, 0xc0c02de0, 0xe080000f, 0xd8002063, 0x17c07c1f,
  127. 0xe080001f, 0xa1da0407, 0xe8208000, 0x10210048, 0x00000100, 0x1b80001f,
  128. 0x20000068, 0xa0110400, 0xa0140400, 0xa0180400, 0xa01b0400, 0xa01d0400,
  129. 0x1b80001f, 0x20000068, 0xa01e0400, 0x1b80001f, 0x20000104, 0x81411801,
  130. 0xd80027c5, 0x17c07c1f, 0x18c0001f, 0x10006240, 0xc0c02d40, 0x17c07c1f,
  131. 0xc2803ec0, 0x1291841f, 0x1b00001f, 0x6ffcf7ff, 0x1950001f, 0x100062c4,
  132. 0x80c41401, 0xd8202923, 0x17c07c1f, 0x1b00001f, 0x7f7ce7ff, 0xf0000000,
  133. 0x17c07c1f, 0xe0f07f16, 0x1380201f, 0xe0f07f1e, 0x1380201f, 0xe0f07f0e,
  134. 0x1b80001f, 0x20000100, 0xe0f07f0c, 0xe0f07f0d, 0xe0f07e0d, 0xe0f07c0d,
  135. 0xe0f0780d, 0xe0f0700d, 0xf0000000, 0x17c07c1f, 0xe0f07f0d, 0xe0f07f1d,
  136. 0xe0f07f1f, 0xe0f07f1e, 0xe0f07f12, 0xf0000000, 0x17c07c1f, 0xe0e00016,
  137. 0x1380201f, 0xe0e0001e, 0x1380201f, 0xe0e0000e, 0xe0e0000c, 0xe0e0000d,
  138. 0xf0000000, 0x17c07c1f, 0xe0e0000f, 0xe0e0001e, 0xe0e00012, 0xf0000000,
  139. 0x17c07c1f, 0x1112841f, 0xa1d08407, 0xd8202ea4, 0x80eab401, 0xd8002e23,
  140. 0x01200404, 0x1a00001f, 0x10006814, 0xe2000003, 0xf0000000, 0x17c07c1f,
  141. 0xa1d00407, 0x1b80001f, 0x20000100, 0x80ea3401, 0x1a00001f, 0x10006814,
  142. 0xe2000003, 0xf0000000, 0x17c07c1f, 0x81499801, 0xd82031c5, 0x17c07c1f,
  143. 0xd82036e2, 0x17c07c1f, 0x18d0001f, 0x40000000, 0x18d0001f, 0x70000000,
  144. 0xd80030c2, 0x00a00402, 0x814a1801, 0xd8203325, 0x17c07c1f, 0xd82036e2,
  145. 0x17c07c1f, 0x18d0001f, 0x40000000, 0x18d0001f, 0x80000000, 0xd8003222,
  146. 0x00a00402, 0x814a9801, 0xd8203485, 0x17c07c1f, 0xd82036e2, 0x17c07c1f,
  147. 0x18d0001f, 0x40000000, 0x18d0001f, 0xc0000000, 0xd8003382, 0x00a00402,
  148. 0x814c1801, 0xd82035e5, 0x17c07c1f, 0xd82036e2, 0x17c07c1f, 0x18d0001f,
  149. 0x40000000, 0x18d0001f, 0xa0000000, 0xd80034e2, 0x00a00402, 0xd82036e2,
  150. 0x17c07c1f, 0x18d0001f, 0x40000000, 0x18d0001f, 0x40000000, 0xd80035e2,
  151. 0x00a00402, 0xf0000000, 0x17c07c1f, 0x81441801, 0xd8203945, 0x17c07c1f,
  152. 0x1a00001f, 0x10006604, 0xc0c03de0, 0xe2200004, 0xc0c03060, 0x1093041f,
  153. 0xc0c03de0, 0xe2200003, 0xc0c03060, 0x1093041f, 0xc0c03de0, 0xe2200002,
  154. 0xc0c03060, 0x1093041f, 0x1a00001f, 0x100062c4, 0x1890001f, 0x100062c4,
  155. 0xa0908402, 0xe2000002, 0x1b00001f, 0x00801001, 0xf0000000, 0x17c07c1f,
  156. 0x1a00001f, 0x100062c4, 0x1890001f, 0x100062c4, 0x80b08402, 0xe2000002,
  157. 0x81441801, 0xd8203d65, 0x17c07c1f, 0x1a00001f, 0x10006604, 0xc0c03de0,
  158. 0xe2200003, 0xc0c03060, 0x1093041f, 0xc0c03de0, 0xe2200004, 0xc0c03060,
  159. 0x1093041f, 0xc0c03de0, 0xe2200005, 0xc0c03060, 0x1093041f, 0x1b00001f,
  160. 0x00000801, 0xf0000000, 0x17c07c1f, 0x18d0001f, 0x10006604, 0x10cf8c1f,
  161. 0xd8203de3, 0x17c07c1f, 0xf0000000, 0x17c07c1f, 0x18c0001f, 0x10006b18,
  162. 0x1910001f, 0x10006b18, 0xa1002804, 0xe0c00004, 0xf0000000, 0x17c07c1f,
  163. 0x17c07c1f, 0x17c07c1f, 0x1840001f, 0x00000001, 0xa1d48407, 0x1990001f,
  164. 0x10006b08, 0xe8208000, 0x10006b18, 0x00000000, 0x81441801, 0xd8204565,
  165. 0x17c07c1f, 0x1910001f, 0x100062c4, 0x80849001, 0x1a00001f, 0x10006b0c,
  166. 0x1950001f, 0x10006b0c, 0xa1508805, 0xe2000005, 0x18c0001f, 0x2f7ce7ff,
  167. 0x80809001, 0x81600801, 0xa0d59403, 0xa0d60803, 0xd8004465, 0x17c07c1f,
  168. 0x80841001, 0x81600801, 0xa0db9403, 0xa0de0803, 0xd8004465, 0x17c07c1f,
  169. 0x80f60403, 0xe8208000, 0x10006310, 0x0b160c38, 0x13000c1f, 0x1b80001f,
  170. 0xd00f0000, 0xd00045a0, 0x17c07c1f, 0x1b00001f, 0x2f7ce7ff, 0x81469801,
  171. 0xd8204705, 0x17c07c1f, 0x1b80001f, 0xd00f0000, 0x8880000c, 0x2f7ce7ff,
  172. 0xd80069e2, 0x17c07c1f, 0xd0004740, 0x17c07c1f, 0x1b80001f, 0x500f0000,
  173. 0xe8208000, 0x10006354, 0x001fdaa3, 0xc0c07900, 0x81401801, 0xd8004c65,
  174. 0x17c07c1f, 0x81f60407, 0x18c0001f, 0x10006200, 0xc0c07780, 0x12807c1f,
  175. 0xe8208000, 0x1000625c, 0x00000001, 0x1b80001f, 0x20000080, 0xc0c07780,
  176. 0x1280041f, 0x18c0001f, 0x10006208, 0xc0c07780, 0x12807c1f, 0xe8208000,
  177. 0x10006244, 0x00000001, 0x1b80001f, 0x20000080, 0xc0c07780, 0x1280041f,
  178. 0x18c0001f, 0x10006290, 0xc0c07780, 0x12807c1f, 0xc0c07780, 0x1280041f,
  179. 0x18c0001f, 0x100062dc, 0xe0c00001, 0xc2803ec0, 0x1292041f, 0x81469801,
  180. 0xd8004d45, 0x17c07c1f, 0x8880000c, 0x2f7ce7ff, 0xd8006542, 0x17c07c1f,
  181. 0xc0c079a0, 0x17c07c1f, 0x18c0001f, 0x10006294, 0xe0f07fff, 0xe0e00fff,
  182. 0xe0e000ff, 0x81449801, 0xd8005045, 0x17c07c1f, 0x1a00001f, 0x10006604,
  183. 0xe2200001, 0xc0c03de0, 0x17c07c1f, 0xe2200006, 0x18c0001f, 0x10001130,
  184. 0x1910001f, 0x10001130, 0xa1108404, 0xe0c00004, 0xc0c03de0, 0x17c07c1f,
  185. 0xa1d38407, 0xa1d98407, 0xa0108400, 0xa0120400, 0xa0148400, 0xa0150400,
  186. 0xa0158400, 0xa01b8400, 0xa01c0400, 0xa01c8400, 0xa0188400, 0xa0190400,
  187. 0xa0198400, 0x81441801, 0xd82054e5, 0x17c07c1f, 0x1910001f, 0x10006b0c,
  188. 0x1a00001f, 0x100062c4, 0x1950001f, 0x100062c4, 0x80809001, 0x81748405,
  189. 0xa1548805, 0xe2000005, 0x1a00001f, 0x10006b0c, 0x80c51801, 0x81308404,
  190. 0xa1108c04, 0xe2000004, 0x1b00001f, 0x2f7ce7ff, 0x80c09401, 0xc8e03723,
  191. 0x17c07c1f, 0xe8208000, 0x10006310, 0x0b1603f8, 0x1950001f, 0x100062c4,
  192. 0x80841401, 0x81600801, 0x18c0001f, 0xaf7ce7ff, 0xa0de0803, 0xa0db9403,
  193. 0x13000c1f, 0xe8208000, 0x1000110c, 0x00000454, 0xe8208000, 0x10001110,
  194. 0x00003e62, 0xe8208000, 0x10001114, 0x00000454, 0xe8208000, 0x10001118,
  195. 0x00002262, 0x1a00001f, 0x10006604, 0xc0c03de0, 0xe2200002, 0x1b80001f,
  196. 0x90100000, 0x80c00001, 0xc8c00903, 0x17c07c1f, 0x18d0001f, 0x10006284,
  197. 0x80810c01, 0xd8205c62, 0x17c07c1f, 0x18d0001f, 0x100062c4, 0x80840c01,
  198. 0xd8005c62, 0x17c07c1f, 0x18c0001f, 0x10001138, 0x1910001f, 0x10001138,
  199. 0xa1108404, 0xe0c00004, 0x1910001f, 0x10001138, 0x1a00001f, 0x10006604,
  200. 0xe2200007, 0x1a00001f, 0x100062c4, 0x1890001f, 0x100062c4, 0xa0940402,
  201. 0xe2000002, 0x80c10001, 0xc8c01423, 0x17c07c1f, 0x1b00001f, 0x2f7ce7ff,
  202. 0x18c0001f, 0x10006294, 0xe0e001fe, 0xe0e003fc, 0xe0e007f8, 0xe0e00ff0,
  203. 0x1b80001f, 0x20000020, 0xe0f07ff0, 0xe0f07f00, 0x81449801, 0xd80060e5,
  204. 0x17c07c1f, 0x1a00001f, 0x10006604, 0xe2200006, 0xc0c03de0, 0x17c07c1f,
  205. 0xe2200000, 0x18c0001f, 0x10001130, 0x1910001f, 0x10001130, 0x81308404,
  206. 0xe0c00004, 0xc0c03de0, 0x17c07c1f, 0x1b80001f, 0x200016a8, 0xc0c03de0,
  207. 0xe2200003, 0x1880001f, 0x1000110c, 0xe0a00618, 0x1880001f, 0x10001114,
  208. 0xe0a00618, 0x18d0001f, 0x10006b6c, 0x1880001f, 0x10001110, 0xe0800003,
  209. 0x1880001f, 0x10001118, 0x11080c1f, 0xe0800004, 0x80388400, 0x80390400,
  210. 0x80398400, 0x1b80001f, 0x20000300, 0x803b8400, 0x803c0400, 0x803c8400,
  211. 0x1b80001f, 0x20000300, 0x80348400, 0x80350400, 0x80358400, 0x1b80001f,
  212. 0x20000104, 0x10007c1f, 0x81f38407, 0x81f98407, 0x81f90407, 0x81f40407,
  213. 0x81401801, 0xd80069e5, 0x17c07c1f, 0x18c0001f, 0x100062dc, 0xe0c0001f,
  214. 0x18c0001f, 0x10006290, 0x1212841f, 0xc0c07500, 0x12807c1f, 0xc0c07500,
  215. 0x1280041f, 0x18c0001f, 0x10006208, 0x1212841f, 0xc0c07500, 0x12807c1f,
  216. 0xe8208000, 0x10006244, 0x00000000, 0x1b80001f, 0x20000080, 0xc0c07500,
  217. 0x1280041f, 0x18c0001f, 0x10006200, 0x1212841f, 0xc0c07500, 0x12807c1f,
  218. 0xe8208000, 0x1000625c, 0x00000000, 0x1b80001f, 0x20000080, 0xc0c07500,
  219. 0x1280041f, 0xe8208000, 0x10006824, 0x000f0000, 0x81f48407, 0xa1d60407,
  220. 0x81f10407, 0xa1db0407, 0xe8208000, 0x10006310, 0x0b160008, 0xc2803ec0,
  221. 0x1293841f, 0x18c0001f, 0x10006b14, 0xe0c0000c, 0x18c0001f, 0x10006b68,
  222. 0x1950001f, 0x100063c0, 0xe0c00005, 0x81441801, 0xd8207085, 0x10c0041f,
  223. 0x1910001f, 0x100062c4, 0x80849001, 0x1a00001f, 0x10006b0c, 0x1910001f,
  224. 0x10006b0c, 0xa0908804, 0xe2000002, 0x81441801, 0xd8207085, 0x10c0041f,
  225. 0x1910001f, 0x100062c4, 0x80809001, 0x81600801, 0xa0d59403, 0xa0d60803,
  226. 0xd8007025, 0x17c07c1f, 0x80841001, 0x81600801, 0xa0db9403, 0xa0de0803,
  227. 0xd8007025, 0x17c07c1f, 0x80f60403, 0xe8208000, 0x10006310, 0x0b160c38,
  228. 0x13000c1f, 0x1b80001f, 0x900a0000, 0x88900001, 0x10006814, 0xd8206de2,
  229. 0x17c07c1f, 0x18d0001f, 0x10006b6c, 0x78a00003, 0x0000beef, 0xd80072a2,
  230. 0x17c07c1f, 0xc0c07a40, 0x17c07c1f, 0xd0006de0, 0x17c07c1f, 0x1910001f,
  231. 0x10006b0c, 0x1a00001f, 0x100062c4, 0x1950001f, 0x100062c4, 0x80809001,
  232. 0x81748405, 0xa1548805, 0xe2000005, 0x80841401, 0xd8007482, 0x8204b401,
  233. 0xc8c00008, 0x17c07c1f, 0x1ac0001f, 0x55aa55aa, 0x10007c1f, 0xf0000000,
  234. 0xd800760a, 0x17c07c1f, 0xe2e00036, 0x17c07c1f, 0x17c07c1f, 0xe2e0003e,
  235. 0x1380201f, 0xe2e0003c, 0xd820774a, 0x17c07c1f, 0x1b80001f, 0x20000018,
  236. 0xe2e0007c, 0x1b80001f, 0x20000003, 0xe2e0005c, 0xe2e0004c, 0xe2e0004d,
  237. 0xf0000000, 0x17c07c1f, 0xd800782a, 0x17c07c1f, 0xe2e0004f, 0xe2e0006f,
  238. 0xe2e0002f, 0xd82078ca, 0x17c07c1f, 0xe2e0002e, 0xe2e0003e, 0xe2e00032,
  239. 0xf0000000, 0x17c07c1f, 0xa1d10407, 0x1b80001f, 0x20000020, 0xf0000000,
  240. 0x17c07c1f, 0xa1d40407, 0x1391841f, 0xa1d90407, 0xf0000000, 0x17c07c1f,
  241. 0x1900001f, 0x10006014, 0x1950001f, 0x10006014, 0xa1508405, 0xe1000005,
  242. 0x1900001f, 0x10006814, 0xe100001f, 0x812ab401, 0xd8007b64, 0x17c07c1f,
  243. 0x1880001f, 0x10006284, 0x18d0001f, 0x10006284, 0x80f20403, 0xe0800003,
  244. 0x80f08403, 0xe0800003, 0x1900001f, 0x10006014, 0x1950001f, 0x10006014,
  245. 0x81708405, 0xe1000005, 0x1900001f, 0x10006b6c, 0xe100001f, 0x81441801,
  246. 0xd8007fa5, 0x17c07c1f, 0x18c0001f, 0x10001138, 0x1910001f, 0x10001138,
  247. 0xa1108404, 0xe0c00004, 0x1910001f, 0x10001138, 0x1a00001f, 0x10006604,
  248. 0xe2200007, 0xf0000000, 0x17c07c1f
  249. };
  250. static struct pcm_desc suspend_pcm = {
  251. .version = "pcm_suspend_v34.5.11.3.3.8_20160128-dummy_read",
  252. .base = suspend_binary,
  253. .size = 1023,
  254. .sess = 2,
  255. .replace = 0,
  256. .vec0 = EVENT_VEC(23, 1, 0, 0), /* FUNC_MD_VRF18_WAKEUP */
  257. .vec1 = EVENT_VEC(28, 1, 0, 36), /* FUNC_MD_VRF18_SLEEP */
  258. .vec2 = EVENT_VEC(11, 1, 0, 72), /* FUNC_26M_WAKEUP */
  259. .vec3 = EVENT_VEC(12, 1, 0, 106), /* FUNC_26M_SLEEP */
  260. .vec4 = EVENT_VEC(30, 1, 0, 161), /* FUNC_APSRC_WAKEUP */
  261. .vec5 = EVENT_VEC(31, 1, 0, 246), /* FUNC_APSRC_SLEEP */
  262. .vec6 = EVENT_VEC(11, 1, 0, 441), /* FUNC_VCORE_HIGH */
  263. .vec7 = EVENT_VEC(12, 1, 0, 468), /* FUNC_VCORE_LOW */
  264. };
  265. #elif defined(CONFIG_ARCH_MT6735M)
  266. static const u32 suspend_binary[] = {
  267. 0x81429801, 0xd80001e5, 0x17c07c1f, 0x18c0001f, 0x10001124, 0x1910001f,
  268. 0x10001124, 0xa1108404, 0xe0c00004, 0x1910001f, 0x10001124, 0x1a00001f,
  269. 0x10006604, 0xc0c03da0, 0xe2200007, 0x1a00001f, 0x100062c4, 0x1890001f,
  270. 0x100062c4, 0xa0940402, 0x1b00001f, 0x10000001, 0x1910001f, 0x10006310,
  271. 0x80c39001, 0xd8200443, 0xe2000002, 0x80c10001, 0x1b00001f, 0xbf7ce7ff,
  272. 0xd8200443, 0x17c07c1f, 0x1b00001f, 0x7f7ce7ff, 0xf0000000, 0x17c07c1f,
  273. 0x81429801, 0xd8000665, 0x17c07c1f, 0x18c0001f, 0x10001124, 0x1910001f,
  274. 0x10001124, 0x81308404, 0xe0c00004, 0x1910001f, 0x10001124, 0x1a00001f,
  275. 0x10006604, 0xc0c03da0, 0xe2200007, 0x1a00001f, 0x100062c4, 0x1890001f,
  276. 0x100062c4, 0x80b40402, 0x1b00001f, 0x00801001, 0x1910001f, 0x10006310,
  277. 0x80c39001, 0xd82008c3, 0xe2000002, 0x80c10001, 0x1b00001f, 0x6ffcf7ff,
  278. 0xd80008c3, 0x17c07c1f, 0x1b00001f, 0xaffce7ff, 0xf0000000, 0x17c07c1f,
  279. 0x81f58407, 0x81f68407, 0x1800001f, 0x17cf0f3f, 0x1b80001f, 0x20000000,
  280. 0x1800001f, 0x17cf0f16, 0xa1d28407, 0x81f20407, 0x81409801, 0xd8000b25,
  281. 0x17c07c1f, 0x18c0001f, 0x10006234, 0xc0c02920, 0x1200041f, 0x80310400,
  282. 0x1b80001f, 0x2000000a, 0xa0110400, 0x81f00407, 0xa1dd0407, 0x18c0001f,
  283. 0x100062d8, 0xc0c02be0, 0x1200041f, 0x81fd0407, 0xc2803e80, 0x1290041f,
  284. 0x1b00001f, 0x6ffcf7ff, 0xf0000000, 0x17c07c1f, 0x1b00001f, 0x2f7ce7ff,
  285. 0x1b80001f, 0x20000004, 0xd80013ec, 0x17c07c1f, 0x1880001f, 0x10006320,
  286. 0xc0c02f00, 0xe080000f, 0xd8200f43, 0x17c07c1f, 0x1b00001f, 0x6ffcf7ff,
  287. 0xd00013e0, 0x17c07c1f, 0xe080001f, 0x81409801, 0xd80011c5, 0x17c07c1f,
  288. 0x18c0001f, 0x10214094, 0x1910001f, 0x1020e374, 0xe0c00004, 0x18c0001f,
  289. 0x10214098, 0x1910001f, 0x1020e378, 0xe0c00004, 0x1910001f, 0x10213378,
  290. 0x18c0001f, 0x10006234, 0xc0c02b00, 0x17c07c1f, 0x18c0001f, 0x100062d8,
  291. 0xc0c02d00, 0x17c07c1f, 0xc2803e80, 0x1290841f, 0xa1d20407, 0x81f28407,
  292. 0xa1d68407, 0x1800001f, 0x17cf0f3f, 0x1800001f, 0x17ff0f3f, 0x19c0001f,
  293. 0x001c2397, 0x1b00001f, 0x2f7cefff, 0xf0000000, 0x17c07c1f, 0x81411801,
  294. 0xd8001545, 0x17c07c1f, 0x18c0001f, 0x10006240, 0xe0e00016, 0xe0e0001e,
  295. 0xe0e0000e, 0xe0e0000f, 0x803e0400, 0x1b80001f, 0x20000222, 0x80380400,
  296. 0x1b80001f, 0x20000280, 0x803b0400, 0x1b80001f, 0x2000001a, 0x803d0400,
  297. 0x1b80001f, 0x20000208, 0x80340400, 0x80310400, 0xe8208000, 0x10210044,
  298. 0x00000100, 0x1b80001f, 0x20000068, 0x1b80001f, 0x2000000a, 0x18c0001f,
  299. 0x10006240, 0xe0e0000d, 0xd8001c05, 0x17c07c1f, 0x1b80001f, 0x20000020,
  300. 0x18c0001f, 0x102130f0, 0x1910001f, 0x102130f0, 0xa9000004, 0x10000000,
  301. 0xe0c00004, 0x1b80001f, 0x2000000a, 0x89000004, 0xefffffff, 0xe0c00004,
  302. 0x18c0001f, 0x102140f4, 0x1910001f, 0x102140f4, 0xa9000004, 0x02000000,
  303. 0xe0c00004, 0x1b80001f, 0x2000000a, 0x89000004, 0xfdffffff, 0xe0c00004,
  304. 0x1910001f, 0x102140f4, 0x81fa0407, 0x81f08407, 0xe8208000, 0x10006354,
  305. 0x001fdaa3, 0xa9c00007, 0x60010000, 0xc2803e80, 0x1291041f, 0x1b00001f,
  306. 0xbf7ce7ff, 0x1950001f, 0x100062c4, 0x80c41401, 0xd8001e43, 0x17c07c1f,
  307. 0x1b00001f, 0xaffce7ff, 0xf0000000, 0x17c07c1f, 0x1b80001f, 0x20000fdf,
  308. 0x1a50001f, 0x10006608, 0x80c9a401, 0x810ba401, 0x10920c1f, 0xa0979002,
  309. 0x80ca2401, 0xa0938c02, 0x8080080d, 0xd82022a2, 0x17c07c1f, 0x81f08407,
  310. 0xa9c00007, 0x60010000, 0x1b00001f, 0x2f7ce7ff, 0x1b80001f, 0x20000004,
  311. 0xd80028ec, 0x17c07c1f, 0x1b00001f, 0xbf7ce7ff, 0x1950001f, 0x100062c4,
  312. 0x80c41401, 0xd80028e3, 0x17c07c1f, 0x1b00001f, 0xaffce7ff, 0xd00028e0,
  313. 0x17c07c1f, 0x89c00007, 0x9ffeffff, 0x1900001f, 0x40000000, 0x18d0001f,
  314. 0x40000000, 0xe1000003, 0xc0c03020, 0x1080041f, 0x1880001f, 0x10006320,
  315. 0xc0c02da0, 0xe080000f, 0xd8002023, 0x17c07c1f, 0xe080001f, 0xa1da0407,
  316. 0xe8208000, 0x10210048, 0x00000100, 0x1b80001f, 0x20000068, 0xa0110400,
  317. 0xa0140400, 0xa0180400, 0xa01b0400, 0xa01d0400, 0x1b80001f, 0x20000068,
  318. 0xa01e0400, 0x1b80001f, 0x20000104, 0x81411801, 0xd8002785, 0x17c07c1f,
  319. 0x18c0001f, 0x10006240, 0xc0c02d00, 0x17c07c1f, 0xc2803e80, 0x1291841f,
  320. 0x1b00001f, 0x6ffcf7ff, 0x1950001f, 0x100062c4, 0x80c41401, 0xd82028e3,
  321. 0x17c07c1f, 0x1b00001f, 0x7f7ce7ff, 0xf0000000, 0x17c07c1f, 0xe0f07f16,
  322. 0x1380201f, 0xe0f07f1e, 0x1380201f, 0xe0f07f0e, 0x1b80001f, 0x20000100,
  323. 0xe0f07f0c, 0xe0f07f0d, 0xe0f07e0d, 0xe0f07c0d, 0xe0f0780d, 0xe0f0700d,
  324. 0xf0000000, 0x17c07c1f, 0xe0f07f0d, 0xe0f07f1d, 0xe0f07f1f, 0xe0f07f1e,
  325. 0xe0f07f12, 0xf0000000, 0x17c07c1f, 0xe0e00016, 0x1380201f, 0xe0e0001e,
  326. 0x1380201f, 0xe0e0000e, 0xe0e0000c, 0xe0e0000d, 0xf0000000, 0x17c07c1f,
  327. 0xe0e0000f, 0xe0e0001e, 0xe0e00012, 0xf0000000, 0x17c07c1f, 0x1112841f,
  328. 0xa1d08407, 0xd8202e64, 0x80eab401, 0xd8002de3, 0x01200404, 0x1a00001f,
  329. 0x10006814, 0xe2000003, 0xf0000000, 0x17c07c1f, 0xa1d00407, 0x1b80001f,
  330. 0x20000100, 0x80ea3401, 0x1a00001f, 0x10006814, 0xe2000003, 0xf0000000,
  331. 0x17c07c1f, 0x81499801, 0xd8203185, 0x17c07c1f, 0xd82036a2, 0x17c07c1f,
  332. 0x18d0001f, 0x40000000, 0x18d0001f, 0x70000000, 0xd8003082, 0x00a00402,
  333. 0x814a1801, 0xd82032e5, 0x17c07c1f, 0xd82036a2, 0x17c07c1f, 0x18d0001f,
  334. 0x40000000, 0x18d0001f, 0x80000000, 0xd80031e2, 0x00a00402, 0x814a9801,
  335. 0xd8203445, 0x17c07c1f, 0xd82036a2, 0x17c07c1f, 0x18d0001f, 0x40000000,
  336. 0x18d0001f, 0xc0000000, 0xd8003342, 0x00a00402, 0x814c1801, 0xd82035a5,
  337. 0x17c07c1f, 0xd82036a2, 0x17c07c1f, 0x18d0001f, 0x40000000, 0x18d0001f,
  338. 0xa0000000, 0xd80034a2, 0x00a00402, 0xd82036a2, 0x17c07c1f, 0x18d0001f,
  339. 0x40000000, 0x18d0001f, 0x40000000, 0xd80035a2, 0x00a00402, 0xf0000000,
  340. 0x17c07c1f, 0x81441801, 0xd8203905, 0x17c07c1f, 0x1a00001f, 0x10006604,
  341. 0xc0c03da0, 0xe2200004, 0xc0c03020, 0x1093041f, 0xc0c03da0, 0xe2200003,
  342. 0xc0c03020, 0x1093041f, 0xc0c03da0, 0xe2200002, 0xc0c03020, 0x1093041f,
  343. 0x1a00001f, 0x100062c4, 0x1890001f, 0x100062c4, 0xa0908402, 0xe2000002,
  344. 0x1b00001f, 0x00801001, 0xf0000000, 0x17c07c1f, 0x1a00001f, 0x100062c4,
  345. 0x1890001f, 0x100062c4, 0x80b08402, 0xe2000002, 0x81441801, 0xd8203d25,
  346. 0x17c07c1f, 0x1a00001f, 0x10006604, 0xc0c03da0, 0xe2200003, 0xc0c03020,
  347. 0x1093041f, 0xc0c03da0, 0xe2200004, 0xc0c03020, 0x1093041f, 0xc0c03da0,
  348. 0xe2200005, 0xc0c03020, 0x1093041f, 0x1b00001f, 0x00000801, 0xf0000000,
  349. 0x17c07c1f, 0x18d0001f, 0x10006604, 0x10cf8c1f, 0xd8203da3, 0x17c07c1f,
  350. 0xf0000000, 0x17c07c1f, 0x18c0001f, 0x10006b18, 0x1910001f, 0x10006b18,
  351. 0xa1002804, 0xe0c00004, 0xf0000000, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  352. 0x17c07c1f, 0x17c07c1f, 0x1840001f, 0x00000001, 0xa1d48407, 0x1990001f,
  353. 0x10006b08, 0xe8208000, 0x10006b18, 0x00000000, 0x81441801, 0xd8204565,
  354. 0x17c07c1f, 0x1910001f, 0x100062c4, 0x80849001, 0x1a00001f, 0x10006b0c,
  355. 0x1950001f, 0x10006b0c, 0xa1508805, 0xe2000005, 0x18c0001f, 0x2f7ce7ff,
  356. 0x80809001, 0x81600801, 0xa0d59403, 0xa0d60803, 0xd8004465, 0x17c07c1f,
  357. 0x80841001, 0x81600801, 0xa0db9403, 0xa0de0803, 0xd8004465, 0x17c07c1f,
  358. 0x80f60403, 0xe8208000, 0x10006310, 0x0b160c38, 0x13000c1f, 0x1b80001f,
  359. 0xd00f0000, 0xd00045a0, 0x17c07c1f, 0x1b00001f, 0x2f7ce7ff, 0x81469801,
  360. 0xd8204705, 0x17c07c1f, 0x1b80001f, 0xd00f0000, 0x8880000c, 0x2f7ce7ff,
  361. 0xd80069e2, 0x17c07c1f, 0xd0004740, 0x17c07c1f, 0x1b80001f, 0x500f0000,
  362. 0xe8208000, 0x10006354, 0x001fdaa3, 0xc0c07900, 0x81401801, 0xd8004c65,
  363. 0x17c07c1f, 0x81f60407, 0x18c0001f, 0x10006200, 0xc0c07780, 0x12807c1f,
  364. 0xe8208000, 0x1000625c, 0x00000001, 0x1b80001f, 0x20000080, 0xc0c07780,
  365. 0x1280041f, 0x18c0001f, 0x10006208, 0xc0c07780, 0x12807c1f, 0xe8208000,
  366. 0x10006244, 0x00000001, 0x1b80001f, 0x20000080, 0xc0c07780, 0x1280041f,
  367. 0x18c0001f, 0x10006290, 0xc0c07780, 0x12807c1f, 0xc0c07780, 0x1280041f,
  368. 0x18c0001f, 0x100062dc, 0xe0c00001, 0xc2803e80, 0x1292041f, 0x81469801,
  369. 0xd8004d45, 0x17c07c1f, 0x8880000c, 0x2f7ce7ff, 0xd8006542, 0x17c07c1f,
  370. 0xc0c079a0, 0x17c07c1f, 0x18c0001f, 0x10006294, 0xe0f07fff, 0xe0e00fff,
  371. 0xe0e000ff, 0x81449801, 0xd8005045, 0x17c07c1f, 0x1a00001f, 0x10006604,
  372. 0xe2200001, 0xc0c03da0, 0x17c07c1f, 0xe2200006, 0x18c0001f, 0x1000111c,
  373. 0x1910001f, 0x1000111c, 0xa1108404, 0xe0c00004, 0xc0c03da0, 0x17c07c1f,
  374. 0xa1d38407, 0xa1d98407, 0xa0108400, 0xa0120400, 0xa0148400, 0xa0150400,
  375. 0xa0158400, 0xa01b8400, 0xa01c0400, 0xa01c8400, 0xa0188400, 0xa0190400,
  376. 0xa0198400, 0x81441801, 0xd82054e5, 0x17c07c1f, 0x1910001f, 0x10006b0c,
  377. 0x1a00001f, 0x100062c4, 0x1950001f, 0x100062c4, 0x80809001, 0x81748405,
  378. 0xa1548805, 0xe2000005, 0x1a00001f, 0x10006b0c, 0x80c51801, 0x81308404,
  379. 0xa1108c04, 0xe2000004, 0x1b00001f, 0x2f7ce7ff, 0x80c09401, 0xc8e036e3,
  380. 0x17c07c1f, 0xe8208000, 0x10006310, 0x0b1603f8, 0x1950001f, 0x100062c4,
  381. 0x80841401, 0x81600801, 0x18c0001f, 0xaf7ce7ff, 0xa0de0803, 0xa0db9403,
  382. 0x13000c1f, 0xe8208000, 0x100010f8, 0x00000454, 0xe8208000, 0x100010fc,
  383. 0x00003e62, 0xe8208000, 0x10001100, 0x00000454, 0xe8208000, 0x10001104,
  384. 0x00002262, 0x1a00001f, 0x10006604, 0xc0c03da0, 0xe2200002, 0x1b80001f,
  385. 0x90100000, 0x80c00001, 0xc8c00903, 0x17c07c1f, 0x18d0001f, 0x10006284,
  386. 0x80810c01, 0xd8205c62, 0x17c07c1f, 0x18d0001f, 0x100062c4, 0x80840c01,
  387. 0xd8005c62, 0x17c07c1f, 0x18c0001f, 0x10001124, 0x1910001f, 0x10001124,
  388. 0xa1108404, 0xe0c00004, 0x1910001f, 0x10001124, 0x1a00001f, 0x10006604,
  389. 0xe2200007, 0x1a00001f, 0x100062c4, 0x1890001f, 0x100062c4, 0xa0940402,
  390. 0xe2000002, 0x80c10001, 0xc8c01423, 0x17c07c1f, 0x1b00001f, 0x2f7ce7ff,
  391. 0x18c0001f, 0x10006294, 0xe0e001fe, 0xe0e003fc, 0xe0e007f8, 0xe0e00ff0,
  392. 0x1b80001f, 0x20000020, 0xe0f07ff0, 0xe0f07f00, 0x81449801, 0xd80060e5,
  393. 0x17c07c1f, 0x1a00001f, 0x10006604, 0xe2200006, 0xc0c03da0, 0x17c07c1f,
  394. 0xe2200000, 0x18c0001f, 0x1000111c, 0x1910001f, 0x1000111c, 0x81308404,
  395. 0xe0c00004, 0xc0c03da0, 0x17c07c1f, 0x1b80001f, 0x200016a8, 0xc0c03da0,
  396. 0xe2200003, 0x1880001f, 0x100010f8, 0xe0a00618, 0x1880001f, 0x10001100,
  397. 0xe0a00618, 0x18d0001f, 0x10006b6c, 0x1880001f, 0x100010fc, 0xe0800003,
  398. 0x1880001f, 0x10001104, 0x11080c1f, 0xe0800004, 0x80388400, 0x80390400,
  399. 0x80398400, 0x1b80001f, 0x20000300, 0x803b8400, 0x803c0400, 0x803c8400,
  400. 0x1b80001f, 0x20000300, 0x80348400, 0x80350400, 0x80358400, 0x1b80001f,
  401. 0x20000104, 0x10007c1f, 0x81f38407, 0x81f98407, 0x81f90407, 0x81f40407,
  402. 0x81401801, 0xd80069e5, 0x17c07c1f, 0x18c0001f, 0x100062dc, 0xe0c0001f,
  403. 0x18c0001f, 0x10006290, 0x1212841f, 0xc0c07500, 0x12807c1f, 0xc0c07500,
  404. 0x1280041f, 0x18c0001f, 0x10006208, 0x1212841f, 0xc0c07500, 0x12807c1f,
  405. 0xe8208000, 0x10006244, 0x00000000, 0x1b80001f, 0x20000080, 0xc0c07500,
  406. 0x1280041f, 0x18c0001f, 0x10006200, 0x1212841f, 0xc0c07500, 0x12807c1f,
  407. 0xe8208000, 0x1000625c, 0x00000000, 0x1b80001f, 0x20000080, 0xc0c07500,
  408. 0x1280041f, 0xe8208000, 0x10006824, 0x000f0000, 0x81f48407, 0xa1d60407,
  409. 0x81f10407, 0xa1db0407, 0xe8208000, 0x10006310, 0x0b160008, 0xc2803e80,
  410. 0x1293841f, 0x18c0001f, 0x10006b14, 0xe0c0000c, 0x18c0001f, 0x10006b68,
  411. 0x1950001f, 0x100063c0, 0xe0c00005, 0x81441801, 0xd8207085, 0x10c0041f,
  412. 0x1910001f, 0x100062c4, 0x80849001, 0x1a00001f, 0x10006b0c, 0x1910001f,
  413. 0x10006b0c, 0xa0908804, 0xe2000002, 0x81441801, 0xd8207085, 0x10c0041f,
  414. 0x1910001f, 0x100062c4, 0x80809001, 0x81600801, 0xa0d59403, 0xa0d60803,
  415. 0xd8007025, 0x17c07c1f, 0x80841001, 0x81600801, 0xa0db9403, 0xa0de0803,
  416. 0xd8007025, 0x17c07c1f, 0x80f60403, 0xe8208000, 0x10006310, 0x0b160c38,
  417. 0x13000c1f, 0x1b80001f, 0x900a0000, 0x88900001, 0x10006814, 0xd8206de2,
  418. 0x17c07c1f, 0x18d0001f, 0x10006b6c, 0x78a00003, 0x0000beef, 0xd80072a2,
  419. 0x17c07c1f, 0xc0c07a40, 0x17c07c1f, 0xd0006de0, 0x17c07c1f, 0x1910001f,
  420. 0x10006b0c, 0x1a00001f, 0x100062c4, 0x1950001f, 0x100062c4, 0x80809001,
  421. 0x81748405, 0xa1548805, 0xe2000005, 0x80841401, 0xd8007482, 0x8204b401,
  422. 0xc8c00008, 0x17c07c1f, 0x1ac0001f, 0x55aa55aa, 0x10007c1f, 0xf0000000,
  423. 0xd800760a, 0x17c07c1f, 0xe2e00036, 0x17c07c1f, 0x17c07c1f, 0xe2e0003e,
  424. 0x1380201f, 0xe2e0003c, 0xd820774a, 0x17c07c1f, 0x1b80001f, 0x20000018,
  425. 0xe2e0007c, 0x1b80001f, 0x20000003, 0xe2e0005c, 0xe2e0004c, 0xe2e0004d,
  426. 0xf0000000, 0x17c07c1f, 0xd800782a, 0x17c07c1f, 0xe2e0004f, 0xe2e0006f,
  427. 0xe2e0002f, 0xd82078ca, 0x17c07c1f, 0xe2e0002e, 0xe2e0003e, 0xe2e00032,
  428. 0xf0000000, 0x17c07c1f, 0xa1d10407, 0x1b80001f, 0x20000020, 0xf0000000,
  429. 0x17c07c1f, 0xa1d40407, 0x1391841f, 0xa1d90407, 0xf0000000, 0x17c07c1f,
  430. 0x1900001f, 0x10006014, 0x1950001f, 0x10006014, 0xa1508405, 0xe1000005,
  431. 0x1900001f, 0x10006814, 0xe100001f, 0x812ab401, 0xd8007b64, 0x17c07c1f,
  432. 0x1880001f, 0x10006284, 0x18d0001f, 0x10006284, 0x80f20403, 0xe0800003,
  433. 0x80f08403, 0xe0800003, 0x1900001f, 0x10006014, 0x1950001f, 0x10006014,
  434. 0x81708405, 0xe1000005, 0x1900001f, 0x10006b6c, 0xe100001f, 0x81441801,
  435. 0xd8007fa5, 0x17c07c1f, 0x18c0001f, 0x10001124, 0x1910001f, 0x10001124,
  436. 0xa1108404, 0xe0c00004, 0x1910001f, 0x10001124, 0x1a00001f, 0x10006604,
  437. 0xe2200007, 0xf0000000, 0x17c07c1f
  438. };
  439. static struct pcm_desc suspend_pcm = {
  440. .version = "pcm_suspend_v0.5.4.5_20160311-dummy_read",
  441. .base = suspend_binary,
  442. .size = 1023,
  443. .sess = 2,
  444. .replace = 0,
  445. .vec0 = EVENT_VEC(23, 1, 0, 0), /* FUNC_MD_VRF18_WAKEUP */
  446. .vec1 = EVENT_VEC(28, 1, 0, 36), /* FUNC_MD_VRF18_SLEEP */
  447. .vec2 = EVENT_VEC(11, 1, 0, 72), /* FUNC_26M_WAKEUP */
  448. .vec3 = EVENT_VEC(12, 1, 0, 106), /* FUNC_26M_SLEEP */
  449. .vec4 = EVENT_VEC(30, 1, 0, 161), /* FUNC_APSRC_WAKEUP */
  450. .vec5 = EVENT_VEC(31, 1, 0, 244), /* FUNC_APSRC_SLEEP */
  451. .vec6 = EVENT_VEC(11, 1, 0, 439), /* FUNC_VCORE_HIGH */
  452. .vec7 = EVENT_VEC(12, 1, 0, 466), /* FUNC_VCORE_LOW */
  453. };
  454. #elif defined(CONFIG_ARCH_MT6753)
  455. static const u32 suspend_binary[] = {
  456. 0x81429801, 0xd80000e5, 0x17c07c1f, 0x1a00001f, 0x10006604, 0xc0c03e00,
  457. 0xe2200007, 0x1a00001f, 0x100062c4, 0x1890001f, 0x100062c4, 0xa0940402,
  458. 0xe2000002, 0x10c0041f, 0x81008801, 0x81601001, 0xa0d59403, 0xa0d61003,
  459. 0xa0de0403, 0x1910001f, 0x10006310, 0x81439001, 0xd82003e5, 0x13000c1f,
  460. 0x80c10001, 0x1b00001f, 0xbf7ce7ff, 0xd82003e3, 0x17c07c1f, 0x1b00001f,
  461. 0x7f7ce7ff, 0xf0000000, 0x17c07c1f, 0x81429801, 0xd8000505, 0x17c07c1f,
  462. 0x1a00001f, 0x10006604, 0xc0c03e00, 0xe2200009, 0x1a00001f, 0x100062c4,
  463. 0x1890001f, 0x100062c4, 0x80b40402, 0xe2000002, 0x10c0041f, 0x81008801,
  464. 0x81601001, 0xa0d59403, 0xa0d61003, 0xa0db8403, 0x1910001f, 0x10006310,
  465. 0x81439001, 0xd8200805, 0x13000c1f, 0x80c10001, 0x1b00001f, 0x6ffcf7ff,
  466. 0xd8000803, 0x17c07c1f, 0x1b00001f, 0xaffce7ff, 0xf0000000, 0x17c07c1f,
  467. 0x81f58407, 0x81f68407, 0x1800001f, 0x17cf0f3f, 0x1b80001f, 0x20000000,
  468. 0x1800001f, 0x17cf0f16, 0xa1d28407, 0x81f20407, 0x81409801, 0xd8000a65,
  469. 0x17c07c1f, 0x18c0001f, 0x10006234, 0xc0c02840, 0x1200041f, 0x80310400,
  470. 0x1b80001f, 0x2000000a, 0xa0110400, 0x81f00407, 0xa1dd0407, 0x18c0001f,
  471. 0x100062d8, 0xc0c02b00, 0x1200041f, 0x81fd0407, 0xc2803ee0, 0x1290041f,
  472. 0x1b00001f, 0x6ffcf7ff, 0xf0000000, 0x17c07c1f, 0x1b00001f, 0x2f7ce7ff,
  473. 0x1b80001f, 0x20000004, 0xd800132c, 0x17c07c1f, 0x1880001f, 0x10006320,
  474. 0xc0c02e20, 0xe080000f, 0xd8200e83, 0x17c07c1f, 0x1b00001f, 0x6ffcf7ff,
  475. 0xd0001320, 0x17c07c1f, 0xe080001f, 0x81409801, 0xd8001105, 0x17c07c1f,
  476. 0x18c0001f, 0x10214094, 0x1910001f, 0x1020e374, 0xe0c00004, 0x18c0001f,
  477. 0x10214098, 0x1910001f, 0x1020e378, 0xe0c00004, 0x1910001f, 0x10213378,
  478. 0x18c0001f, 0x10006234, 0xc0c02a20, 0x17c07c1f, 0x18c0001f, 0x100062d8,
  479. 0xc0c02c20, 0x17c07c1f, 0xc2803ee0, 0x1290841f, 0xa1d20407, 0x81f28407,
  480. 0xa1d68407, 0x1800001f, 0x17cf0f3f, 0x1800001f, 0x17ff0f3f, 0x19c0001f,
  481. 0x001c2397, 0x1b00001f, 0x2f7cefff, 0xf0000000, 0x17c07c1f, 0x81411801,
  482. 0xd8001485, 0x17c07c1f, 0x18c0001f, 0x10006240, 0xe0e00016, 0xe0e0001e,
  483. 0xe0e0000e, 0xe0e0000f, 0x803e0400, 0x1b80001f, 0x20000222, 0x80380400,
  484. 0x1b80001f, 0x20000280, 0x803b0400, 0x1b80001f, 0x2000001a, 0x803d0400,
  485. 0x1b80001f, 0x20000208, 0x80340400, 0x80310400, 0xe8208000, 0x10210044,
  486. 0x00000100, 0x1b80001f, 0x20000068, 0x1b80001f, 0x2000000a, 0x18c0001f,
  487. 0x10006240, 0xe0e0000d, 0xd8001b45, 0x17c07c1f, 0x1b80001f, 0x20000020,
  488. 0x18c0001f, 0x102130f0, 0x1910001f, 0x102130f0, 0xa9000004, 0x10000000,
  489. 0xe0c00004, 0x1b80001f, 0x2000000a, 0x89000004, 0xefffffff, 0xe0c00004,
  490. 0x18c0001f, 0x102140f4, 0x1910001f, 0x102140f4, 0xa9000004, 0x02000000,
  491. 0xe0c00004, 0x1b80001f, 0x2000000a, 0x89000004, 0xfdffffff, 0xe0c00004,
  492. 0x1910001f, 0x102140f4, 0x81fa0407, 0x81f08407, 0xe8208000, 0x10006354,
  493. 0x001fdaa3, 0xa9c00007, 0x60010000, 0xc2803ee0, 0x1291041f, 0x1b00001f,
  494. 0xbf7ce7ff, 0x1950001f, 0x100062c4, 0x80c41401, 0xd8001d83, 0x17c07c1f,
  495. 0x1b00001f, 0xaffce7ff, 0xf0000000, 0x17c07c1f, 0x1b80001f, 0x20000fdf,
  496. 0x1a50001f, 0x10006608, 0x80c9a401, 0x810ba401, 0x10920c1f, 0xa0979002,
  497. 0x80ca2401, 0xa0938c02, 0x8080080d, 0xd82021e2, 0x17c07c1f, 0x81f08407,
  498. 0xa9c00007, 0x60010000, 0x1b00001f, 0x2f7ce7ff, 0x1b80001f, 0x20000004,
  499. 0xd800280c, 0x17c07c1f, 0x1b00001f, 0xbf7ce7ff, 0x1950001f, 0x100062c4,
  500. 0x80c41401, 0xd8002803, 0x17c07c1f, 0x1b00001f, 0xaffce7ff, 0xd0002800,
  501. 0x17c07c1f, 0x89c00007, 0x9ffeffff, 0x1900001f, 0x40000000, 0x18d0001f,
  502. 0x40000000, 0xe1000003, 0xc0c02f40, 0x1080041f, 0x1880001f, 0x10006320,
  503. 0xc0c02cc0, 0xe080000f, 0xd8001f63, 0x17c07c1f, 0xe080001f, 0xa1da0407,
  504. 0xe8208000, 0x10210048, 0x00000100, 0x1b80001f, 0x20000068, 0xa0110400,
  505. 0xa0140400, 0xa8000000, 0x04410000, 0x1b80001f, 0x20000068, 0xa01e0400,
  506. 0x1b80001f, 0x20000104, 0x81411801, 0xd80026a5, 0x17c07c1f, 0x18c0001f,
  507. 0x10006240, 0xc0c02c20, 0x17c07c1f, 0xc2803ee0, 0x1291841f, 0x1b00001f,
  508. 0x6ffcf7ff, 0x1950001f, 0x100062c4, 0x80c41401, 0xd8202803, 0x17c07c1f,
  509. 0x1b00001f, 0x7f7ce7ff, 0xf0000000, 0x17c07c1f, 0xe0f07f16, 0x1380201f,
  510. 0xe0f07f1e, 0x1380201f, 0xe0f07f0e, 0x1b80001f, 0x20000100, 0xe0f07f0c,
  511. 0xe0f07f0d, 0xe0f07e0d, 0xe0f07c0d, 0xe0f0780d, 0xe0f0700d, 0xf0000000,
  512. 0x17c07c1f, 0xe0f07f0d, 0xe0f07f1d, 0xe0f07f1f, 0xe0f07f1e, 0xe0f07f12,
  513. 0xf0000000, 0x17c07c1f, 0xe0e00016, 0x1380201f, 0xe0e0001e, 0x1380201f,
  514. 0xe0e0000e, 0xe0e0000c, 0xe0e0000d, 0xf0000000, 0x17c07c1f, 0xe0e0000f,
  515. 0xe0e0001e, 0xe0e00012, 0xf0000000, 0x17c07c1f, 0x1112841f, 0xa1d08407,
  516. 0xd8202d84, 0x80eab401, 0xd8002d03, 0x01200404, 0x1a00001f, 0x10006814,
  517. 0xe2000003, 0xf0000000, 0x17c07c1f, 0xa1d00407, 0x1b80001f, 0x20000100,
  518. 0x80ea3401, 0x1a00001f, 0x10006814, 0xe2000003, 0xf0000000, 0x17c07c1f,
  519. 0x81499801, 0xd82030a5, 0x17c07c1f, 0xd82035c2, 0x17c07c1f, 0x18d0001f,
  520. 0x40000000, 0x18d0001f, 0x70000000, 0xd8002fa2, 0x00a00402, 0x814a1801,
  521. 0xd8203205, 0x17c07c1f, 0xd82035c2, 0x17c07c1f, 0x18d0001f, 0x40000000,
  522. 0x18d0001f, 0x80000000, 0xd8003102, 0x00a00402, 0x814a9801, 0xd8203365,
  523. 0x17c07c1f, 0xd82035c2, 0x17c07c1f, 0x18d0001f, 0x40000000, 0x18d0001f,
  524. 0xc0000000, 0xd8003262, 0x00a00402, 0x814c1801, 0xd82034c5, 0x17c07c1f,
  525. 0xd82035c2, 0x17c07c1f, 0x18d0001f, 0x40000000, 0x18d0001f, 0xa0000000,
  526. 0xd80033c2, 0x00a00402, 0xd82035c2, 0x17c07c1f, 0x18d0001f, 0x40000000,
  527. 0x18d0001f, 0x40000000, 0xd80034c2, 0x00a00402, 0xf0000000, 0x17c07c1f,
  528. 0x81441801, 0xd8203825, 0x17c07c1f, 0x1a00001f, 0x10006604, 0xc0c03e00,
  529. 0xe2200004, 0xc0c02f40, 0x1093041f, 0xc0c03e00, 0xe2200003, 0xc0c02f40,
  530. 0x1093041f, 0xc0c03e00, 0xe2200002, 0xc0c02f40, 0x1093041f, 0x1a00001f,
  531. 0x100062c4, 0x1890001f, 0x100062c4, 0xa0908402, 0xe2000002, 0x10c0041f,
  532. 0x81040801, 0x81601001, 0xa0db9403, 0xa0de1003, 0xa0d60403, 0x13000c1f,
  533. 0xf0000000, 0x17c07c1f, 0x1a00001f, 0x100062c4, 0x1890001f, 0x100062c4,
  534. 0x80b08402, 0xe2000002, 0x81441801, 0xd8203ce5, 0x17c07c1f, 0x1a00001f,
  535. 0x10006604, 0xc0c03e00, 0xe2200003, 0xc0c02f40, 0x1093041f, 0xc0c03e00,
  536. 0xe2200004, 0xc0c02f40, 0x1093041f, 0xc0c03e00, 0xe2200005, 0xc0c02f40,
  537. 0x1093041f, 0x10c0041f, 0x81040801, 0x81601001, 0xa0db9403, 0xa0de1003,
  538. 0xa0d58403, 0x13000c1f, 0xf0000000, 0x17c07c1f, 0x18d0001f, 0x10006604,
  539. 0x10cf8c1f, 0xd8203e03, 0x17c07c1f, 0xf0000000, 0x17c07c1f, 0x18c0001f,
  540. 0x10006b18, 0x1910001f, 0x10006b18, 0xa1002804, 0xe0c00004, 0xf0000000,
  541. 0x17c07c1f, 0x17c07c1f, 0x1840001f, 0x00000001, 0xa1d48407, 0x1990001f,
  542. 0x10006b08, 0xe8208000, 0x10006b18, 0x00000000, 0x81441801, 0xd8204445,
  543. 0x17c07c1f, 0x1910001f, 0x100062c4, 0x80849001, 0x1a00001f, 0x10006b0c,
  544. 0x1950001f, 0x10006b0c, 0xa1508805, 0xe2000005, 0x18c0001f, 0x2f7ce7ff,
  545. 0x80841001, 0x81600801, 0xa0db9403, 0xa0de0803, 0xe8208000, 0x10006310,
  546. 0x0b160038, 0x13000c1f, 0x1b80001f, 0xd00f0000, 0xd0004480, 0x17c07c1f,
  547. 0x1b00001f, 0x2f7ce7ff, 0x81469801, 0xd82045e5, 0x17c07c1f, 0x1b80001f,
  548. 0xd00f0000, 0x8880000c, 0x2f7ce7ff, 0xd8006382, 0x17c07c1f, 0xd0004620,
  549. 0x17c07c1f, 0x1b80001f, 0x500f0000, 0xe8208000, 0x10006354, 0x001fdaa3,
  550. 0xc0c07400, 0x81401801, 0xd8004b45, 0x17c07c1f, 0x81f60407, 0x18c0001f,
  551. 0x10006200, 0xc0c07280, 0x12807c1f, 0xe8208000, 0x1000625c, 0x00000001,
  552. 0x1b80001f, 0x20000080, 0xc0c07280, 0x1280041f, 0x18c0001f, 0x10006208,
  553. 0xc0c07280, 0x12807c1f, 0xe8208000, 0x10006244, 0x00000001, 0x1b80001f,
  554. 0x20000080, 0xc0c07280, 0x1280041f, 0x18c0001f, 0x10006290, 0xc0c07280,
  555. 0x12807c1f, 0xc0c07280, 0x1280041f, 0x18c0001f, 0x100062dc, 0xe0c00001,
  556. 0xc2803ee0, 0x1292041f, 0x81469801, 0xd8004c25, 0x17c07c1f, 0x8880000c,
  557. 0x2f7ce7ff, 0xd8005ee2, 0x17c07c1f, 0x18c0001f, 0x10006294, 0xe0f07fff,
  558. 0xe0e00fff, 0xe0e000ff, 0x81449801, 0xd8004fa5, 0x17c07c1f, 0x1a00001f,
  559. 0x10006604, 0x814d1801, 0xd8204ee5, 0x17c07c1f, 0xe2200006, 0xc0c07540,
  560. 0x12807c1f, 0xc0c03e00, 0x17c07c1f, 0xc2803ee0, 0x1294041f, 0xd0004fa0,
  561. 0x17c07c1f, 0xc0c03e00, 0xe2200001, 0xc0c03e00, 0xe2200006, 0xc0c03e00,
  562. 0xe220000a, 0xc0c074a0, 0x17c07c1f, 0xa1d38407, 0xa1d98407, 0x1800001f,
  563. 0x00000012, 0x1800001f, 0x00000e12, 0x1800001f, 0x03800e12, 0x1800001f,
  564. 0x038e0e12, 0x81441801, 0xd8205385, 0x17c07c1f, 0x1910001f, 0x10006b0c,
  565. 0x1a00001f, 0x100062c4, 0x1950001f, 0x100062c4, 0x80809001, 0x81748405,
  566. 0xa1548805, 0xe2000005, 0x1a00001f, 0x10006b0c, 0x80c51801, 0x81308404,
  567. 0xa1108c04, 0xe2000004, 0xe8208000, 0x10006310, 0x0b1603f8, 0x1950001f,
  568. 0x100062c4, 0x80841401, 0x81600801, 0x18c0001f, 0xaf7ce7ff, 0xa0de0803,
  569. 0xa0db9403, 0x13000c1f, 0x1b80001f, 0x90100000, 0x80c00001, 0xc8c00843,
  570. 0x17c07c1f, 0x18d0001f, 0x10006284, 0x80810c01, 0xd82057c2, 0x17c07c1f,
  571. 0x18d0001f, 0x100062c4, 0x80840c01, 0xd80057c2, 0x17c07c1f, 0x1a00001f,
  572. 0x10006604, 0xe2200007, 0x1a00001f, 0x100062c4, 0xa0940403, 0xe2000002,
  573. 0x80c10001, 0xc8c01363, 0x17c07c1f, 0x1b00001f, 0x2f7ce7ff, 0x18c0001f,
  574. 0x10006294, 0xe0e001fe, 0xe0e003fc, 0xe0e007f8, 0xe0e00ff0, 0x1b80001f,
  575. 0x20000020, 0xe0f07ff0, 0xe0f07f00, 0x1800001f, 0x03800e12, 0x1b80001f,
  576. 0x20000300, 0x1800001f, 0x00000e12, 0x1b80001f, 0x20000300, 0x1800001f,
  577. 0x00000012, 0x1b80001f, 0x20000104, 0x10007c1f, 0x81f38407, 0x81f98407,
  578. 0x81f90407, 0x81f40407, 0x81449801, 0xd8005ee5, 0x17c07c1f, 0x1a00001f,
  579. 0x10006604, 0x814d1801, 0xd8205de5, 0x17c07c1f, 0xe2200008, 0xc0c07540,
  580. 0x1280041f, 0xc0c03e00, 0x17c07c1f, 0x1b80001f, 0x20001c70, 0xd0005ee0,
  581. 0x17c07c1f, 0xc0c03e00, 0xe2200008, 0xc0c03e00, 0xe2200000, 0x1b80001f,
  582. 0x200016a8, 0xc0c03e00, 0xe220000b, 0x81401801, 0xd8006385, 0x17c07c1f,
  583. 0x18c0001f, 0x100062dc, 0xe0c0001f, 0x18c0001f, 0x10006290, 0x1212841f,
  584. 0xc0c07000, 0x12807c1f, 0xc0c07000, 0x1280041f, 0x18c0001f, 0x10006208,
  585. 0x1212841f, 0xc0c07000, 0x12807c1f, 0xe8208000, 0x10006244, 0x00000000,
  586. 0x1b80001f, 0x20000080, 0xc0c07000, 0x1280041f, 0x18c0001f, 0x10006200,
  587. 0x1212841f, 0xc0c07000, 0x12807c1f, 0xe8208000, 0x1000625c, 0x00000000,
  588. 0x1b80001f, 0x20000080, 0xc0c07000, 0x1280041f, 0xe8208000, 0x10006824,
  589. 0x000f0000, 0x81f48407, 0xa1d60407, 0x81f10407, 0xa1db0407, 0xe8208000,
  590. 0x10006310, 0x0b160008, 0xc2803ee0, 0x1293841f, 0x18c0001f, 0x10006b14,
  591. 0xe0c0000c, 0x18c0001f, 0x10006b68, 0x1950001f, 0x100063c0, 0xe0c00005,
  592. 0x81441801, 0xd8206ac5, 0x10c0041f, 0x1910001f, 0x100062c4, 0x80849001,
  593. 0x1a00001f, 0x10006b0c, 0x1910001f, 0x10006b0c, 0xa0908804, 0xe2000002,
  594. 0x89000002, 0xfffffe43, 0xe2000004, 0x1a00001f, 0x10006608, 0x1890001f,
  595. 0x10006608, 0x89000002, 0xfd67ffff, 0xe2000004, 0x81441801, 0xd8206ac5,
  596. 0x10c0041f, 0x1910001f, 0x100062c4, 0x80809001, 0x81600801, 0xa0d59403,
  597. 0xa0d60803, 0x80841001, 0x81600801, 0xa0db9403, 0xa0de0803, 0xe8208000,
  598. 0x10006310, 0x0b160c38, 0x81469801, 0xd8206b85, 0x17c07c1f, 0xe8208000,
  599. 0x100063e0, 0x00000001, 0x13000c1f, 0x1b80001f, 0x900a0000, 0x88900001,
  600. 0x10006814, 0xd82068c2, 0x17c07c1f, 0x18d0001f, 0x10006b6c, 0x78a00003,
  601. 0x0000beef, 0xd8006da2, 0x17c07c1f, 0xc0c07bc0, 0x17c07c1f, 0xd00068c0,
  602. 0x17c07c1f, 0x1910001f, 0x10006b0c, 0x1a00001f, 0x100062c4, 0x1950001f,
  603. 0x100062c4, 0x80809001, 0x81748405, 0xa1548805, 0xe2000005, 0x80841401,
  604. 0xd8006f82, 0x8204b401, 0xc8c00008, 0x17c07c1f, 0x1ac0001f, 0x55aa55aa,
  605. 0x10007c1f, 0xf0000000, 0xd800710a, 0x17c07c1f, 0xe2e00036, 0x17c07c1f,
  606. 0x17c07c1f, 0xe2e0003e, 0x1380201f, 0xe2e0003c, 0xd820724a, 0x17c07c1f,
  607. 0x1b80001f, 0x20000018, 0xe2e0007c, 0x1b80001f, 0x20000003, 0xe2e0005c,
  608. 0xe2e0004c, 0xe2e0004d, 0xf0000000, 0x17c07c1f, 0xd800732a, 0x17c07c1f,
  609. 0xe2e0004f, 0xe2e0006f, 0xe2e0002f, 0xd82073ca, 0x17c07c1f, 0xe2e0002e,
  610. 0xe2e0003e, 0xe2e00032, 0xf0000000, 0x17c07c1f, 0xa1d10407, 0x1b80001f,
  611. 0x20000020, 0xf0000000, 0x17c07c1f, 0xa1d40407, 0x1391841f, 0xa1d90407,
  612. 0xf0000000, 0x17c07c1f, 0xe8208000, 0x11012014, 0x00000002, 0xe8208000,
  613. 0x11012020, 0x00000001, 0xe8208000, 0x11012004, 0x000000d6, 0xe8208000,
  614. 0x11012040, 0x00000000, 0x1a00001f, 0x11012000, 0xd820798a, 0x17c07c1f,
  615. 0xe220000a, 0xe22000f6, 0xe8208000, 0x11012024, 0x00000001, 0x1890001f,
  616. 0x11012024, 0x1b80001f, 0x20000158, 0xe220008a, 0xe2200001, 0xe8208000,
  617. 0x11012024, 0x00000001, 0x1b80001f, 0x20000158, 0xd0007b80, 0x17c07c1f,
  618. 0xe220008a, 0xe2200000, 0xe8208000, 0x11012024, 0x00000001, 0x1890001f,
  619. 0x11012024, 0x1b80001f, 0x20000158, 0xe220000a, 0xe22000f4, 0xe8208000,
  620. 0x11012024, 0x00000001, 0x1b80001f, 0x20000158, 0xf0000000, 0x17c07c1f,
  621. 0x1900001f, 0x10006014, 0x1950001f, 0x10006014, 0xa1508405, 0xe1000005,
  622. 0x1900001f, 0x10006814, 0xe100001f, 0x812ab401, 0xd8007ce4, 0x17c07c1f,
  623. 0x1880001f, 0x10006284, 0x18d0001f, 0x10006284, 0x80f20403, 0xe0800003,
  624. 0x80f08403, 0xe0800003, 0x1900001f, 0x10006014, 0x1950001f, 0x10006014,
  625. 0x81708405, 0xe1000005, 0x1900001f, 0x10006b6c, 0xe100001f, 0xf0000000,
  626. 0x17c07c1f
  627. };
  628. static struct pcm_desc suspend_pcm = {
  629. .version = "pcm_suspend_v0.2.4.1.6.4.1_20151216",
  630. .base = suspend_binary,
  631. .size = 1021,
  632. .sess = 2,
  633. .replace = 0,
  634. .vec0 = EVENT_VEC(23, 1, 0, 0), /* FUNC_MD_VRF18_WAKEUP */
  635. .vec1 = EVENT_VEC(28, 1, 0, 33), /* FUNC_MD_VRF18_SLEEP */
  636. .vec2 = EVENT_VEC(11, 1, 0, 66), /* FUNC_26M_WAKEUP */
  637. .vec3 = EVENT_VEC(12, 1, 0, 100), /* FUNC_26M_SLEEP */
  638. .vec4 = EVENT_VEC(30, 1, 0, 155), /* FUNC_APSRC_WAKEUP */
  639. .vec5 = EVENT_VEC(31, 1, 0, 238), /* FUNC_APSRC_SLEEP */
  640. .vec6 = EVENT_VEC(11, 1, 0, 432), /* FUNC_VCORE_HIGH */
  641. .vec7 = EVENT_VEC(12, 1, 0, 464), /* FUNC_VCORE_LOW */
  642. };
  643. #elif defined(CONFIG_ARCH_MT6580)
  644. static const u32 suspend_binary[] = {
  645. 0xa1d58407, 0x81f68407, 0x803a0400, 0x1b80001f, 0x20000000, 0x80300400,
  646. 0x80328400, 0xa1d28407, 0x81f20407, 0xe8208000, 0x10006b04, 0x20000000,
  647. 0x80318400, 0x81409801, 0xd8000285, 0x17c07c1f, 0x18c0001f, 0x10006234,
  648. 0xc0c02580, 0x1200041f, 0x80310400, 0x1b80001f, 0x2000000a, 0xa0110400,
  649. 0xe8208000, 0x10006b04, 0x40000000, 0x81f00407, 0xe8208000, 0x10006b04,
  650. 0x00000000, 0xc2803220, 0x1290041f, 0x1b00001f, 0x7fffd7ff, 0xf0000000,
  651. 0x17c07c1f, 0x1b00001f, 0x3fffc7ff, 0x1b80001f, 0x20000004, 0xd8000b0c,
  652. 0x17c07c1f, 0x1880001f, 0x10006320, 0xc0c02b40, 0xe080000f, 0xd82006a3,
  653. 0x17c07c1f, 0x1b00001f, 0x7fffd7ff, 0xd0000b00, 0x17c07c1f, 0xe080001f,
  654. 0x81409801, 0xd8000925, 0x17c07c1f, 0x18c0001f, 0x10207094, 0x1910001f,
  655. 0x10206374, 0xe0c00004, 0x18c0001f, 0x10207098, 0x1910001f, 0x10206378,
  656. 0xe0c00004, 0x1910001f, 0x10206378, 0x18c0001f, 0x10006234, 0xc0c02760,
  657. 0x17c07c1f, 0xe8208000, 0x10006b04, 0x10000000, 0xc2803220, 0x1290841f,
  658. 0xa1d20407, 0x81f28407, 0xa1d68407, 0xa0100400, 0xa0128400, 0xa0118400,
  659. 0xa01a0400, 0x81f58407, 0x1b00001f, 0x3fffcfff, 0xf0000000, 0x17c07c1f,
  660. 0x81491801, 0xd8000ca5, 0x17c07c1f, 0x18c0001f, 0x102085cc, 0x1910001f,
  661. 0x102085cc, 0x813f8404, 0xe0c00004, 0x1910001f, 0x102085cc, 0x18c0001f,
  662. 0x1000627c, 0xe0e00ff0, 0x1b80001f, 0x20000020, 0xe0f07ff0, 0xe0f07f00,
  663. 0x81f30407, 0x81411801, 0xd8000ec5, 0x17c07c1f, 0x18c0001f, 0x10006240,
  664. 0xe0e00016, 0xe0e0001e, 0xe0e0000e, 0xe0e0000f, 0x803e0400, 0x1b80001f,
  665. 0x20000222, 0x80380400, 0x1b80001f, 0x20000280, 0x803b0400, 0x1b80001f,
  666. 0x2000001a, 0x803d0400, 0x1b80001f, 0x20000208, 0x80340400, 0x80310400,
  667. 0x1910001f, 0x10000000, 0x18c0001f, 0x10000000, 0xa1108404, 0xe0c00004,
  668. 0x1b80001f, 0x20000068, 0x1b80001f, 0x2000000a, 0x18c0001f, 0x10006240,
  669. 0xe0e0000d, 0xd80015e5, 0x17c07c1f, 0x1b80001f, 0x20000020, 0x18c0001f,
  670. 0x102080f0, 0x1910001f, 0x102080f0, 0xa9000004, 0x10000000, 0xe0c00004,
  671. 0x1b80001f, 0x2000000a, 0x89000004, 0xefffffff, 0xe0c00004, 0x18c0001f,
  672. 0x102070f4, 0x1910001f, 0x102070f4, 0xa9000004, 0x02000000, 0xe0c00004,
  673. 0x1b80001f, 0x2000000a, 0x89000004, 0xfdffffff, 0xe0c00004, 0x1910001f,
  674. 0x102070f4, 0x81fa0407, 0x81f08407, 0xe8208000, 0x10006354, 0xfffffc23,
  675. 0xa1d80407, 0xa1df0407, 0xc2803220, 0x1291041f, 0x81491801, 0xd8001865,
  676. 0x17c07c1f, 0x18c0001f, 0x102085cc, 0x1910001f, 0x102085cc, 0xa11f8404,
  677. 0xe0c00004, 0x1910001f, 0x102085cc, 0x1b00001f, 0xbfffc7ff, 0xf0000000,
  678. 0x17c07c1f, 0x1b80001f, 0x20000fdf, 0x1a50001f, 0x10006608, 0x80c9a401,
  679. 0x810ba401, 0x10920c1f, 0xa0979002, 0x8080080d, 0xd8201be2, 0x17c07c1f,
  680. 0x81f08407, 0xa1d80407, 0xa1df0407, 0x1b00001f, 0x3fffc7ff, 0x1b80001f,
  681. 0x20000004, 0xd800254c, 0x17c07c1f, 0x1b00001f, 0xbfffc7ff, 0xd0002540,
  682. 0x17c07c1f, 0x81f80407, 0x81ff0407, 0x1880001f, 0x10006320, 0xc0c029e0,
  683. 0xe080000f, 0xd8001a43, 0x17c07c1f, 0xe080001f, 0xa1da0407, 0x18c0001f,
  684. 0x110040d8, 0x1910001f, 0x110040d8, 0xa11f8404, 0xe0c00004, 0x1910001f,
  685. 0x110040d8, 0xa1d30407, 0x1910001f, 0x10000000, 0x18c0001f, 0x10000000,
  686. 0x81308404, 0xe0c00004, 0x81491801, 0xd8002065, 0x17c07c1f, 0x18c0001f,
  687. 0x102085cc, 0x1910001f, 0x102085cc, 0x813f8404, 0xe0c00004, 0x1910001f,
  688. 0x102085cc, 0x1b80001f, 0x20000068, 0xa0110400, 0xa0140400, 0xa0180400,
  689. 0xa01b0400, 0xa01d0400, 0x17c07c1f, 0x17c07c1f, 0xa01e0400, 0x17c07c1f,
  690. 0x17c07c1f, 0x81491801, 0xd8002345, 0x17c07c1f, 0x18c0001f, 0x102085cc,
  691. 0x1910001f, 0x102085cc, 0xa11f8404, 0xe0c00004, 0x1910001f, 0x102085cc,
  692. 0x81411801, 0xd8002425, 0x17c07c1f, 0x18c0001f, 0x10006240, 0xc0c02940,
  693. 0x17c07c1f, 0x18c0001f, 0x1000627c, 0xe0f07ff0, 0xe0e00ff0, 0xe0e000f0,
  694. 0xc2803220, 0x1291841f, 0x1b00001f, 0x7fffd7ff, 0xf0000000, 0x17c07c1f,
  695. 0xe0f07f16, 0x1380201f, 0xe0f07f1e, 0x1380201f, 0xe0f07f0e, 0x1b80001f,
  696. 0x20000100, 0xe0f07f0c, 0xe0f07f0d, 0xe0f07e0d, 0xe0f07c0d, 0xe0f0780d,
  697. 0xe0f0700d, 0xf0000000, 0x17c07c1f, 0xe0f07f0d, 0xe0f07f0f, 0xe0f07f1e,
  698. 0xe0f07f12, 0xf0000000, 0x17c07c1f, 0xe0e00016, 0x1380201f, 0xe0e0001e,
  699. 0x1380201f, 0xe0e0000e, 0xe0e0000c, 0xe0e0000d, 0xf0000000, 0x17c07c1f,
  700. 0xe0e0000f, 0xe0e0001e, 0xe0e00012, 0xf0000000, 0x17c07c1f, 0x1112841f,
  701. 0xa1d08407, 0xd8202aa4, 0x80eab401, 0xd8002a23, 0x01200404, 0x1a00001f,
  702. 0x10006814, 0xe2000003, 0xf0000000, 0x17c07c1f, 0xa1d00407, 0x1b80001f,
  703. 0x20000100, 0x80ea3401, 0x1a00001f, 0x10006814, 0xe2000003, 0xf0000000,
  704. 0x17c07c1f, 0xd8002d2a, 0x17c07c1f, 0xe2e00036, 0xe2e0003e, 0x1380201f,
  705. 0xe2e0003c, 0xd8202e6a, 0x17c07c1f, 0x1b80001f, 0x20000018, 0xe2e0007c,
  706. 0x1b80001f, 0x20000003, 0xe2e0005c, 0xe2e0004c, 0xe2e0004d, 0xf0000000,
  707. 0x17c07c1f, 0xa1d10407, 0x1b80001f, 0x20000020, 0xf0000000, 0x17c07c1f,
  708. 0xa1d40407, 0x1391841f, 0xf0000000, 0x17c07c1f, 0xd800306a, 0x17c07c1f,
  709. 0xe2e0004f, 0xe2e0006f, 0xe2e0002f, 0xd820310a, 0x17c07c1f, 0xe2e0002e,
  710. 0xe2e0003e, 0xe2e00032, 0xf0000000, 0x17c07c1f, 0x18d0001f, 0x10006604,
  711. 0x10cf8c1f, 0xd8203143, 0x17c07c1f, 0xf0000000, 0x17c07c1f, 0x18c0001f,
  712. 0x10006b18, 0x1910001f, 0x10006b18, 0xa1002804, 0xe0c00004, 0xf0000000,
  713. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  714. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  715. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  716. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  717. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  718. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  719. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  720. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  721. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  722. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  723. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  724. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  725. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  726. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  727. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  728. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  729. 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
  730. 0x17c07c1f, 0x17c07c1f, 0x1840001f, 0x00000001, 0xa1d48407, 0x1990001f,
  731. 0x10006b08, 0xe8208000, 0x10006b18, 0x00000000, 0x1b00001f, 0x3fffc7ff,
  732. 0x1b80001f, 0xd00f0000, 0x8880000c, 0x3fffc7ff, 0xd8005522, 0x17c07c1f,
  733. 0xe8208000, 0x10006354, 0xfffffc23, 0xc0c02ea0, 0x81401801, 0xd80046c5,
  734. 0x17c07c1f, 0x81f60407, 0x18c0001f, 0x10006200, 0xc0c02fc0, 0x12807c1f,
  735. 0xe8208000, 0x1000625c, 0x00000001, 0x1b80001f, 0x20000080, 0xc0c02fc0,
  736. 0x1280041f, 0x18c0001f, 0x10006208, 0xc0c02fc0, 0x12807c1f, 0xe8208000,
  737. 0x10006244, 0x00000001, 0x1b80001f, 0x20000080, 0xc0c02fc0, 0x1280041f,
  738. 0x18c0001f, 0x10006290, 0xc0c02fc0, 0x12807c1f, 0xc0c02fc0, 0x1280041f,
  739. 0xc2803220, 0x1292041f, 0x18c0001f, 0x10006294, 0xe0f07fff, 0xe0e00fff,
  740. 0xe0e000ff, 0xc0c02f40, 0x17c07c1f, 0xa1d38407, 0xa1d98407, 0x18c0001f,
  741. 0x11004078, 0x1910001f, 0x11004078, 0xa11f8404, 0xe0c00004, 0x1910001f,
  742. 0x11004078, 0x18c0001f, 0x11004098, 0x1910001f, 0x11004098, 0xa11f8404,
  743. 0xe0c00004, 0x1910001f, 0x11004098, 0xa0108400, 0xa0120400, 0xa0148400,
  744. 0xa0150400, 0xa0158400, 0xa01b8400, 0xa01c0400, 0xa01c8400, 0xa0188400,
  745. 0xa0190400, 0xa0198400, 0xe8208000, 0x10006310, 0x0b1600f8, 0x1b00001f,
  746. 0xbfffc7ff, 0x1b80001f, 0x90100000, 0x80c00001, 0xc8c00003, 0x17c07c1f,
  747. 0x80c10001, 0xc8c00b43, 0x17c07c1f, 0x1b00001f, 0x3fffc7ff, 0x18c0001f,
  748. 0x10006294, 0xe0e001fe, 0xe0e003fc, 0xe0e007f8, 0xe0e00ff0, 0x1b80001f,
  749. 0x20000020, 0xe0f07ff0, 0xe0f07f00, 0x80388400, 0x80390400, 0x80398400,
  750. 0x1b80001f, 0x20000300, 0x803b8400, 0x803c0400, 0x803c8400, 0x1b80001f,
  751. 0x20000300, 0x80348400, 0x80350400, 0x80358400, 0x1b80001f, 0x20000104,
  752. 0x80308400, 0x80320400, 0x81f38407, 0x81f98407, 0x81f40407, 0x81401801,
  753. 0xd8005525, 0x17c07c1f, 0x18c0001f, 0x10006290, 0x1212841f, 0xc0c02c60,
  754. 0x12807c1f, 0xc0c02c60, 0x1280041f, 0x18c0001f, 0x10006208, 0x1212841f,
  755. 0xc0c02c60, 0x12807c1f, 0xe8208000, 0x10006244, 0x00000000, 0x1b80001f,
  756. 0x20000080, 0xc0c02c60, 0x1280041f, 0x18c0001f, 0x10006200, 0x1212841f,
  757. 0xc0c02c60, 0x12807c1f, 0xe8208000, 0x1000625c, 0x00000000, 0x1b80001f,
  758. 0x20000080, 0xc0c02c60, 0x1280041f, 0xe8208000, 0x10006824, 0x000f0000,
  759. 0xa1db0407, 0x81f10407, 0x81f48407, 0xa1d60407, 0x1ac0001f, 0x55aa55aa,
  760. 0x10007c1f, 0xf0000000
  761. };
  762. static struct pcm_desc suspend_pcm = {
  763. .version = "pcm_suspend_v14.0_new",
  764. .base = suspend_binary,
  765. .size = 692,
  766. .sess = 2,
  767. .replace = 0,
  768. .vec0 = EVENT_VEC(11, 1, 0, 0), /* FUNC_26M_WAKEUP */
  769. .vec1 = EVENT_VEC(12, 1, 0, 37), /* FUNC_26M_SLEEP */
  770. .vec2 = EVENT_VEC(30, 1, 0, 90), /* FUNC_APSRC_WAKEUP */
  771. .vec3 = EVENT_VEC(31, 1, 0, 199), /* FUNC_APSRC_SLEEP */
  772. };
  773. #else
  774. /* ERROR */
  775. #endif
  776. #endif /* !defined(USE_DYNA_LOAD_SUSPEND) */
  777. /**************************************
  778. * SW code for suspend
  779. **************************************/
  780. #define SPM_SYSCLK_SETTLE 99 /* 3ms */
  781. #define WAIT_UART_ACK_TIMES 10 /* 10 * 10us */
  782. #define SPM_WAKE_PERIOD 600 /* sec */
  783. #if defined(CONFIG_ARCH_MT6580)
  784. #define WAKE_SRC_FOR_SUSPEND \
  785. (WAKE_SRC_KP | WAKE_SRC_EINT | WAKE_SRC_CONN_WDT | WAKE_SRC_CCIF0_MD | WAKE_SRC_CONN2AP | \
  786. WAKE_SRC_USB_CD | WAKE_SRC_USB_PDN | WAKE_SRC_SEJ | \
  787. WAKE_SRC_SYSPWREQ | WAKE_SRC_MD1_WDT)
  788. #define spm_is_wakesrc_invalid(wakesrc) (!!((u32)(wakesrc) & 0xFC7F3A9B))
  789. #else
  790. #if defined(CONFIG_MICROTRUST_TEE_SUPPORT)
  791. #define WAKE_SRC_FOR_SUSPEND \
  792. (WAKE_SRC_KP | WAKE_SRC_EINT | WAKE_SRC_CONN_WDT | WAKE_SRC_CCIF0_MD | WAKE_SRC_CCIF1_MD | WAKE_SRC_CONN2AP | \
  793. WAKE_SRC_USB_CD | WAKE_SRC_USB_PDN | \
  794. /*WAKE_SRC_SYSPWREQ |*/ WAKE_SRC_MD_WDT | WAKE_SRC_C2K_WDT | WAKE_SRC_CLDMA_MD)
  795. #else
  796. #define WAKE_SRC_FOR_SUSPEND \
  797. (WAKE_SRC_KP | WAKE_SRC_EINT | WAKE_SRC_CONN_WDT | WAKE_SRC_CCIF0_MD | WAKE_SRC_CCIF1_MD | WAKE_SRC_CONN2AP | \
  798. WAKE_SRC_USB_CD | WAKE_SRC_USB_PDN | WAKE_SRC_SEJ |\
  799. /*WAKE_SRC_SYSPWREQ |*/ WAKE_SRC_MD_WDT | WAKE_SRC_C2K_WDT | WAKE_SRC_CLDMA_MD)
  800. #endif
  801. #define spm_is_wakesrc_invalid(wakesrc) (!!((u32)(wakesrc) & 0xc0003803))
  802. #endif
  803. #define WAKE_SRC_FOR_MD32 0 \
  804. /* (WAKE_SRC_AUD_MD32) */
  805. #define reg_read(addr) __raw_readl((void __force __iomem *)(addr))
  806. #define reg_write(addr, val) mt_reg_sync_writel((val), ((void *)addr))
  807. /*
  808. #if defined(CONFIG_OF)
  809. extern void __iomem *_mcucfg_base;
  810. extern void __iomem *_mcucfg_phys_base;
  811. #undef MCUCFG_BASE
  812. #define MCUCFG_BASE (_mcucfg_base)
  813. #else
  814. #undef MCUCFG_BASE
  815. #define MCUCFG_BASE 0xF0200000
  816. #endif */
  817. /* MCUCFG registers */
  818. /*
  819. #define SPM_MP0_AXI_CONFIG (MCUCFG_BASE + 0x2C)
  820. #define SPM_MP0_AXI_CONFIG_PHYS (_mcucfg_phys_base + 0x2C)
  821. #define SPM_MP1_AXI_CONFIG (MCUCFG_BASE + 0x22C)
  822. #define SPM_MP1_AXI_CONFIG_PHYS (_mcucfg_phys_base + 0x22C)
  823. #define ACINACTM (1<<4)
  824. */
  825. #if defined(CONFIG_ARM_PSCI) || defined(CONFIG_MTK_PSCI)
  826. #define MCUSYS_SMC_WRITE(addr, val) mcusys_smc_write_phy(addr##_PHYS, val)
  827. #else
  828. #define MCUSYS_SMC_WRITE(addr, val) mcusys_smc_write(addr, val)
  829. #endif
  830. #ifdef CONFIG_MTK_RAM_CONSOLE
  831. #define SPM_AEE_RR_REC 1
  832. #else
  833. #define SPM_AEE_RR_REC 0
  834. #endif
  835. #if SPM_AEE_RR_REC
  836. enum spm_suspend_step {
  837. SPM_SUSPEND_ENTER = 0,
  838. SPM_SUSPEND_ENTER_WFI,
  839. SPM_SUSPEND_LEAVE_WFI,
  840. SPM_SUSPEND_LEAVE
  841. };
  842. /* extern void aee_rr_rec_spm_suspend_val(u32 val); */
  843. /* extern u32 aee_rr_curr_spm_suspend_val(void); */
  844. void __attribute__ ((weak)) aee_rr_rec_spm_suspend_val(u32 val)
  845. {
  846. }
  847. u32 __attribute__ ((weak)) aee_rr_curr_spm_suspend_val(void)
  848. {
  849. return 0;
  850. }
  851. #endif
  852. /* FIXME: Denali early porting */
  853. #if 1
  854. int __attribute__ ((weak)) exec_ccci_kern_func_by_md_id(int md_id, unsigned int id, char *buf,
  855. unsigned int len)
  856. {
  857. return 0;
  858. }
  859. int __attribute__ ((weak)) get_dynamic_period(int first_use, int first_wakeup_time,
  860. int battery_capacity_level)
  861. {
  862. return 0;
  863. }
  864. /*
  865. #else
  866. extern int get_dynamic_period(int first_use, int first_wakeup_time, int battery_capacity_level);
  867. */
  868. #endif
  869. void __attribute__ ((weak)) mt_cirq_clone_gic(void)
  870. {
  871. }
  872. void __attribute__ ((weak)) mt_cirq_enable(void)
  873. {
  874. }
  875. void __attribute__ ((weak)) mt_cirq_flush(void)
  876. {
  877. }
  878. void __attribute__ ((weak)) mt_cirq_disable(void)
  879. {
  880. }
  881. int __attribute__ ((weak)) request_uart_to_sleep(void)
  882. {
  883. return 0;
  884. }
  885. int __attribute__ ((weak)) request_uart_to_wakeup(void)
  886. {
  887. return 0;
  888. }
  889. void __attribute__ ((weak)) mtk_uart_restore(void)
  890. {
  891. }
  892. void __attribute__ ((weak)) mt_eint_print_status(void)
  893. {
  894. }
  895. /*
  896. extern int mt_irq_mask_all(struct mtk_irq_mask *mask);
  897. extern int mt_irq_mask_restore(struct mtk_irq_mask *mask);
  898. extern void mt_irq_unmask_for_sleep(unsigned int irq);
  899. extern int request_uart_to_sleep(void);
  900. extern int request_uart_to_wakeup(void);
  901. extern void mtk_uart_restore(void);
  902. extern void dump_uart_reg(void);
  903. */
  904. #if defined(CONFIG_ARCH_MT6580)
  905. static struct pwr_ctrl suspend_ctrl = {
  906. .wake_src = WAKE_SRC_FOR_SUSPEND,
  907. .wake_src_md32 = WAKE_SRC_FOR_MD32,
  908. .r0_ctrl_en = 1,
  909. .r7_ctrl_en = 1,
  910. .infra_dcm_lock = 1,
  911. .wfi_op = WFI_OP_AND,
  912. .ca7top_idle_mask = 0,
  913. .ca15top_idle_mask = 1,
  914. .mcusys_idle_mask = 0,
  915. .disp_req_mask = 0,
  916. .mfg_req_mask = 0,
  917. .gce_req_mask = 1,
  918. .md1_req_mask = 0,
  919. .md2_req_mask = 0,
  920. .md32_req_mask = 1,
  921. .md_apsrc_sel = 0,
  922. .md2_apsrc_sel = 0,
  923. .lte_mask = 1,
  924. .conn_mask = 0,
  925. #ifdef CONFIG_MTK_NFC
  926. .srclkenai_mask = 0, /* unmask for NFC use */
  927. #else
  928. .srclkenai_mask = 1, /* mask for gpio/i2c use */
  929. #endif
  930. #if 0
  931. /* use for birng-up */
  932. .ccif0_to_ap_mask = 1,
  933. .ccif0_to_md_mask = 1,
  934. .ccif1_to_ap_mask = 1,
  935. .ccif1_to_md_mask = 1,
  936. .ccifmd_md1_event_mask = 1,
  937. .ccifmd_md2_event_mask = 1,
  938. #endif
  939. /* .pcm_apsrc_req = 1, */
  940. /* .pcm_f26m_req = 1, */
  941. .ca7_wfi0_en = 1,
  942. .ca7_wfi1_en = 1,
  943. .ca7_wfi2_en = 1,
  944. .ca7_wfi3_en = 1,
  945. .ca15_wfi0_en = 0,
  946. .ca15_wfi1_en = 0,
  947. .ca15_wfi2_en = 0,
  948. .ca15_wfi3_en = 0,
  949. #if SPM_BYPASS_SYSPWREQ
  950. .syspwreq_mask = 1,
  951. #endif
  952. };
  953. #else
  954. static struct pwr_ctrl suspend_ctrl = {
  955. .wake_src = WAKE_SRC_FOR_SUSPEND,
  956. .wake_src_md32 = WAKE_SRC_FOR_MD32,
  957. .r0_ctrl_en = 1,
  958. .r7_ctrl_en = 1,
  959. .infra_dcm_lock = 1,
  960. .wfi_op = WFI_OP_AND,
  961. .ca7top_idle_mask = 0,
  962. .ca15top_idle_mask = 0,
  963. .mcusys_idle_mask = 0,
  964. .disp_req_mask = 0,
  965. .mfg_req_mask = 0,
  966. .md1_req_mask = 0,
  967. .md2_req_mask = 0,
  968. .md32_req_mask = 0,
  969. .md_apsrc_sel = 0,
  970. .md2_apsrc_sel = 0,
  971. .lte_mask = 1,
  972. .conn_mask = 0,
  973. #if 0
  974. .ccif0_to_ap_mask = 1,
  975. .ccif0_to_md_mask = 1,
  976. .ccif1_to_ap_mask = 1,
  977. .ccif1_to_md_mask = 1,
  978. .ccifmd_md1_event_mask = 1,
  979. .ccifmd_md2_event_mask = 1,
  980. #endif
  981. /* .pcm_f26m_req = 1, */
  982. .ca7_wfi0_en = 1,
  983. .ca7_wfi1_en = 1,
  984. .ca7_wfi2_en = 1,
  985. .ca7_wfi3_en = 1,
  986. .ca15_wfi0_en = 1,
  987. .ca15_wfi1_en = 1,
  988. .ca15_wfi2_en = 1,
  989. .ca15_wfi3_en = 1,
  990. #if SPM_BYPASS_SYSPWREQ
  991. .syspwreq_mask = 1,
  992. #endif
  993. };
  994. #endif
  995. struct spm_lp_scen __spm_suspend = {
  996. #ifndef USE_DYNA_LOAD_SUSPEND
  997. .pcmdesc = &suspend_pcm,
  998. #endif
  999. .pwrctrl = &suspend_ctrl,
  1000. .wakestatus = &suspend_info[0],
  1001. };
  1002. void spm_i2c_control(u32 channel, bool onoff)
  1003. {
  1004. return;
  1005. #if 0
  1006. /* static int pdn = 0; */
  1007. static bool i2c_onoff;
  1008. #ifdef CONFIG_OF
  1009. void __iomem *base;
  1010. #else
  1011. u32 base; /* , i2c_clk; */
  1012. #endif
  1013. switch (channel) {
  1014. case 0:
  1015. base = SPM_I2C0_BASE;
  1016. /* i2c_clk = MT_CG_INFRA_I2C0; */
  1017. break;
  1018. case 1:
  1019. base = SPM_I2C1_BASE;
  1020. /* i2c_clk = MT_CG_INFRA_I2C1; */
  1021. break;
  1022. case 2:
  1023. base = SPM_I2C2_BASE;
  1024. /* i2c_clk = MT_CG_INFRA_I2C2; */
  1025. break;
  1026. default:
  1027. base = SPM_I2C2_BASE;
  1028. break;
  1029. }
  1030. if ((1 == onoff) && (0 == i2c_onoff)) {
  1031. i2c_onoff = 1;
  1032. #if 0
  1033. #if 1
  1034. pdn = spm_read(INFRA_PDN_STA0) & (1U << i2c_clk);
  1035. spm_write(INFRA_PDN_CLR0, pdn); /* power on I2C */
  1036. #else
  1037. pdn = clock_is_on(i2c_clk);
  1038. if (!pdn)
  1039. enable_clock(i2c_clk, "spm_i2c");
  1040. #endif
  1041. #endif
  1042. spm_write(base + OFFSET_CONTROL, 0x0); /* init I2C_CONTROL */
  1043. spm_write(base + OFFSET_TRANSAC_LEN, 0x1); /* init I2C_TRANSAC_LEN */
  1044. spm_write(base + OFFSET_EXT_CONF, 0x0); /* init I2C_EXT_CONF */
  1045. spm_write(base + OFFSET_IO_CONFIG, 0x0); /* init I2C_IO_CONFIG */
  1046. spm_write(base + OFFSET_HS, 0x102); /* init I2C_HS */
  1047. } else if ((0 == onoff) && (1 == i2c_onoff)) {
  1048. i2c_onoff = 0;
  1049. #if 0
  1050. #if 1
  1051. spm_write(INFRA_PDN_SET0, pdn); /* restore I2C power */
  1052. #else
  1053. if (!pdn)
  1054. disable_clock(i2c_clk, "spm_i2c");
  1055. #endif
  1056. #endif
  1057. } else
  1058. ASSERT(1);
  1059. #endif
  1060. }
  1061. /* extern unsigned int mt_get_clk_mem_sel(void); */
  1062. /*
  1063. static bool spm_set_suspend_pcm_ver(u32 *suspend_flags)
  1064. {
  1065. u32 flag;
  1066. flag = *suspend_flags;
  1067. if(mt_get_clk_mem_sel()==MEMPLL3PLL)
  1068. {
  1069. __spm_suspend.pcmdesc = &suspend_pcm_3pll;
  1070. flag |= SPM_VCORE_DVS_DIS;
  1071. }
  1072. else if(mt_get_clk_mem_sel()==MEMPLL1PLL)
  1073. {
  1074. __spm_suspend.pcmdesc = &suspend_pcm_1pll;
  1075. flag &= ~SPM_VCORE_DVS_DIS;
  1076. }
  1077. else
  1078. return false;
  1079. *suspend_flags = flag;
  1080. return true;
  1081. }
  1082. */
  1083. #if 0
  1084. static void spm_suspend_pre_process(struct pwr_ctrl *pwrctrl)
  1085. {
  1086. #if 0
  1087. u32 rdata1 = 0, rdata2 = 0;
  1088. #endif
  1089. /* set PMIC WRAP table for suspend power control */
  1090. mt_cpufreq_set_pmic_phase(PMIC_WRAP_PHASE_SUSPEND);
  1091. spm_i2c_control(I2C_CHANNEL, 1);
  1092. #if 0
  1093. /* for infra pdn (emi driving) */
  1094. spm_write(0xF0004000, spm_read(0xF0004000) | (1 << 24));
  1095. /* MEMPLL control for SPM */
  1096. spm_write(0xF000F5C8, 0x3010F030);
  1097. spm_write(0xF000F5CC, 0x50101010);
  1098. #endif
  1099. /* spm_write(0xF0001070 , spm_read(0xF0001070) | (1 << 21)); // 26:26 enable */
  1100. /* spm_write(0xF0000204 , spm_read(0xF0000204) | (1 << 0)); // BUS 26MHz enable */
  1101. /* spm_write(0xF0001108 , 0x0); */
  1102. #ifdef CONFIG_MD32_SUPPORT
  1103. /* spm_write(MD32_BASE+0x2C, (spm_read(MD32_BASE+0x2C) & ~0xFFFF) | 0xcafe); */
  1104. #endif
  1105. #if 0
  1106. pwrap_read(0x2c2, &rdata1);
  1107. pwrap_write(0x2c2, 0x0123);
  1108. pwrap_read(0x2c2, &rdata2);
  1109. if (rdata2 != 0x0123) {
  1110. spm_crit2("suspend pmic wrapper 0x2c2, rdata1 = 0x%x, rdata2 = 0x%x\n", rdata1,
  1111. rdata2);
  1112. BUG();
  1113. }
  1114. #endif
  1115. }
  1116. #endif
  1117. #if 0
  1118. static void spm_suspend_post_process(struct pwr_ctrl *pwrctrl)
  1119. {
  1120. #if 0
  1121. u32 rdata1 = 0, rdata2 = 0;
  1122. pwrap_read(0x2c2, &rdata1);
  1123. pwrap_write(0x2c2, 0x3210);
  1124. pwrap_read(0x2c2, &rdata2);
  1125. if (rdata2 != 0x3210) {
  1126. spm_crit2("resume pmic wrapper 0x2c2, rdata1 = 0x%x, rdata2 = 0x%x\n", rdata1,
  1127. rdata2);
  1128. BUG();
  1129. }
  1130. #endif
  1131. #ifdef CONFIG_MD32_SUPPORT
  1132. /* spm_write(MD32_BASE+0x2C, spm_read(MD32_BASE+0x2C) & ~0xFFFF); */
  1133. #endif
  1134. /* set PMIC WRAP table for normal power control */
  1135. mt_cpufreq_set_pmic_phase(PMIC_WRAP_PHASE_NORMAL);
  1136. spm_i2c_control(I2C_CHANNEL, 0);
  1137. }
  1138. #endif
  1139. static void spm_set_sysclk_settle(void)
  1140. {
  1141. u32 md_settle, settle;
  1142. /* get MD SYSCLK settle */
  1143. spm_write(SPM_CLK_CON, spm_read(SPM_CLK_CON) | CC_SYSSETTLE_SEL);
  1144. spm_write(SPM_CLK_SETTLE, 0);
  1145. md_settle = spm_read(SPM_CLK_SETTLE);
  1146. /* SYSCLK settle = MD SYSCLK settle but set it again for MD PDN */
  1147. spm_write(SPM_CLK_SETTLE, SPM_SYSCLK_SETTLE - md_settle);
  1148. settle = spm_read(SPM_CLK_SETTLE);
  1149. spm_warn("md_settle = %u, settle = %u\n", md_settle, settle);
  1150. }
  1151. static void spm_kick_pcm_to_run(struct pwr_ctrl *pwrctrl)
  1152. {
  1153. /* enable PCM WDT (normal mode) to start count if needed */
  1154. #if SPM_PCMWDT_EN
  1155. {
  1156. u32 con1;
  1157. con1 = spm_read(SPM_PCM_CON1) & ~(CON1_PCM_WDT_WAKE_MODE | CON1_PCM_WDT_EN);
  1158. spm_write(SPM_PCM_CON1, CON1_CFG_KEY | con1);
  1159. if (spm_read(SPM_PCM_TIMER_VAL) > PCM_TIMER_MAX)
  1160. spm_write(SPM_PCM_TIMER_VAL, PCM_TIMER_MAX);
  1161. spm_write(SPM_PCM_WDT_TIMER_VAL, spm_read(SPM_PCM_TIMER_VAL) + PCM_WDT_TIMEOUT);
  1162. spm_write(SPM_PCM_CON1, con1 | CON1_CFG_KEY | CON1_PCM_WDT_EN);
  1163. }
  1164. #endif
  1165. #if SPM_PCMTIMER_DIS
  1166. {
  1167. u32 con1;
  1168. con1 = spm_read(SPM_PCM_CON1) & ~(CON1_PCM_TIMER_EN);
  1169. spm_write(SPM_PCM_CON1, con1 | CON1_CFG_KEY);
  1170. }
  1171. #endif
  1172. /* init PCM_PASR_DPD_0 for DPD */
  1173. spm_write(SPM_PCM_PASR_DPD_0, 0);
  1174. /* FIXME: for K2 fpga early porting */
  1175. #if 0
  1176. /* make MD32 work in suspend: fscp_ck = CLK26M */
  1177. clkmux_sel(MT_MUX_SCP, 0, "SPM-Sleep");
  1178. #endif
  1179. __spm_kick_pcm_to_run(pwrctrl);
  1180. }
  1181. static void spm_trigger_wfi_for_sleep(struct pwr_ctrl *pwrctrl)
  1182. {
  1183. /* FIXME: for K2 fpga early porting */
  1184. #if 0
  1185. sync_hw_gating_value(); /* for Vcore DVFS */
  1186. #endif
  1187. if (is_cpu_pdn(pwrctrl->pcm_flags)) {
  1188. spm_dormant_sta = mt_cpu_dormant(CPU_SHUTDOWN_MODE /* | DORMANT_SKIP_WFI */);
  1189. switch (spm_dormant_sta) {
  1190. case MT_CPU_DORMANT_RESET:
  1191. break;
  1192. case MT_CPU_DORMANT_ABORT:
  1193. break;
  1194. case MT_CPU_DORMANT_BREAK:
  1195. break;
  1196. case MT_CPU_DORMANT_BYPASS:
  1197. break;
  1198. }
  1199. } else {
  1200. spm_dormant_sta = -1;
  1201. /* spm_write(MP0_AXI_CONFIG, spm_read(MP0_AXI_CONFIG) | ACINACTM); */
  1202. wfi_with_sync();
  1203. /* spm_write(MP0_AXI_CONFIG, spm_read(MP0_AXI_CONFIG) & ~ACINACTM); */
  1204. }
  1205. if (is_infra_pdn(pwrctrl->pcm_flags))
  1206. mtk_uart_restore();
  1207. }
  1208. static void spm_clean_after_wakeup(void)
  1209. {
  1210. /* disable PCM WDT to stop count if needed */
  1211. #if SPM_PCMWDT_EN
  1212. spm_write(SPM_PCM_CON1, CON1_CFG_KEY | (spm_read(SPM_PCM_CON1) & ~CON1_PCM_WDT_EN));
  1213. #endif
  1214. #if SPM_PCMTIMER_DIS
  1215. spm_write(SPM_PCM_CON1, CON1_CFG_KEY | (spm_read(SPM_PCM_CON1) | CON1_PCM_TIMER_EN));
  1216. #endif
  1217. __spm_clean_after_wakeup();
  1218. /* FIXME: for K2 fpga early porting */
  1219. #if 0
  1220. /* restore clock mux: fscp_ck = SYSPLL1_D2 */
  1221. clkmux_sel(MT_MUX_SCP, 1, "SPM-Sleep");
  1222. #endif
  1223. }
  1224. static wake_reason_t spm_output_wake_reason(struct wake_status *wakesta, struct pcm_desc *pcmdesc)
  1225. {
  1226. wake_reason_t wr;
  1227. u32 md32_flag = 0;
  1228. u32 md32_flag2 = 0;
  1229. wr = __spm_output_wake_reason(wakesta, pcmdesc, true);
  1230. #if 1
  1231. memcpy(&suspend_info[log_wakesta_cnt], wakesta, sizeof(struct wake_status));
  1232. suspend_info[log_wakesta_cnt].log_index = log_wakesta_index;
  1233. if (10 <= log_wakesta_cnt) {
  1234. log_wakesta_cnt = 0;
  1235. spm_snapshot_golden_setting = 0;
  1236. } else {
  1237. log_wakesta_cnt++;
  1238. log_wakesta_index++;
  1239. }
  1240. if (0xFFFFFFF0 <= log_wakesta_index)
  1241. log_wakesta_index = 0;
  1242. #endif
  1243. #ifdef CONFIG_MD32_SUPPORT
  1244. md32_flag = spm_read(MD32_BASE + 0x2C);
  1245. md32_flag2 = spm_read(MD32_BASE + 0x30);
  1246. #endif
  1247. spm_warn("suspend dormant state = %d, md32_flag = 0x%x, md32_flag2 = %d\n",
  1248. spm_dormant_sta, md32_flag, md32_flag2);
  1249. spm_warn("log_wakesta_index = %d\n", log_wakesta_index);
  1250. if (0 != spm_ap_mdsrc_req_cnt)
  1251. spm_warn("warning: spm_ap_mdsrc_req_cnt = %d, r7[ap_mdsrc_req] = 0x%x\n",
  1252. spm_ap_mdsrc_req_cnt, spm_read(SPM_POWER_ON_VAL1) & (1 << 17));
  1253. if (wakesta->r12 & WAKE_SRC_EINT)
  1254. mt_eint_print_status();
  1255. #if 0
  1256. if (wakesta->debug_flag & (1 << 18)) {
  1257. spm_crit2("MD32 suspned pmic wrapper error");
  1258. BUG();
  1259. }
  1260. if (wakesta->debug_flag & (1 << 19)) {
  1261. spm_crit2("MD32 resume pmic wrapper error");
  1262. BUG();
  1263. }
  1264. #endif
  1265. #if !defined(CONFIG_ARCH_MT6580)
  1266. #ifdef CONFIG_MTK_CCCI_DEVICES
  1267. if (wakesta->r13 & 0x18) {
  1268. spm_warn("dump ID_DUMP_MD_SLEEP_MODE");
  1269. exec_ccci_kern_func_by_md_id(0, ID_DUMP_MD_SLEEP_MODE, NULL, 0);
  1270. }
  1271. #endif
  1272. if (wakesta->r12 & WAKE_SRC_CLDMA_MD)
  1273. exec_ccci_kern_func_by_md_id(0, ID_GET_MD_WAKEUP_SRC, NULL, 0);
  1274. #endif /* !defined(CONFIG_ARCH_MT6580) */
  1275. return wr;
  1276. }
  1277. #if SPM_PWAKE_EN
  1278. static u32 spm_get_wake_period(int pwake_time, wake_reason_t last_wr)
  1279. {
  1280. int period = SPM_WAKE_PERIOD;
  1281. #if 1
  1282. if (pwake_time < 0) {
  1283. /* use FG to get the period of 1% battery decrease */
  1284. period = get_dynamic_period(last_wr != WR_PCM_TIMER ? 1 : 0, SPM_WAKE_PERIOD, 1);
  1285. if (period <= 0) {
  1286. spm_warn("CANNOT GET PERIOD FROM FUEL GAUGE\n");
  1287. period = SPM_WAKE_PERIOD;
  1288. }
  1289. } else {
  1290. period = pwake_time;
  1291. spm_crit2("pwake = %d\n", pwake_time);
  1292. }
  1293. if (period > 36 * 3600) /* max period is 36.4 hours */
  1294. period = 36 * 3600;
  1295. #endif
  1296. return period;
  1297. }
  1298. #endif
  1299. /*
  1300. * wakesrc: WAKE_SRC_XXX
  1301. * enable : enable or disable @wakesrc
  1302. * replace: if true, will replace the default setting
  1303. */
  1304. int spm_set_sleep_wakesrc(u32 wakesrc, bool enable, bool replace)
  1305. {
  1306. unsigned long flags;
  1307. if (spm_is_wakesrc_invalid(wakesrc))
  1308. return -EINVAL;
  1309. spin_lock_irqsave(&__spm_lock, flags);
  1310. if (enable) {
  1311. if (replace)
  1312. __spm_suspend.pwrctrl->wake_src = wakesrc;
  1313. else
  1314. __spm_suspend.pwrctrl->wake_src |= wakesrc;
  1315. } else {
  1316. if (replace)
  1317. __spm_suspend.pwrctrl->wake_src = 0;
  1318. else
  1319. __spm_suspend.pwrctrl->wake_src &= ~wakesrc;
  1320. }
  1321. spin_unlock_irqrestore(&__spm_lock, flags);
  1322. return 0;
  1323. }
  1324. /*
  1325. * wakesrc: WAKE_SRC_XXX
  1326. */
  1327. u32 spm_get_sleep_wakesrc(void)
  1328. {
  1329. return __spm_suspend.pwrctrl->wake_src;
  1330. }
  1331. #if 0
  1332. static void uart_mhl_gpio_sleep_ctrl(bool suspend)
  1333. {
  1334. static int mhl_ws_gpio_mode;
  1335. static int mhl_ck_gpio_mode;
  1336. static int mhl_dat_gpio_mode;
  1337. if (suspend == true) {
  1338. #ifdef GPIO_MHL_I2S_OUT_WS_PIN
  1339. mhl_ws_gpio_mode = mt_get_gpio_mode(GPIO_MHL_I2S_OUT_WS_PIN);
  1340. mhl_ck_gpio_mode = mt_get_gpio_mode(GPIO_MHL_I2S_OUT_CK_PIN);
  1341. mhl_dat_gpio_mode = mt_get_gpio_mode(GPIO_MHL_I2S_OUT_DAT_PIN);
  1342. mt_set_gpio_mode(GPIO_MHL_I2S_OUT_WS_PIN, GPIO_MODE_GPIO);
  1343. mt_set_gpio_mode(GPIO_MHL_I2S_OUT_CK_PIN, GPIO_MODE_01);
  1344. mt_set_gpio_mode(GPIO_MHL_I2S_OUT_DAT_PIN, GPIO_MODE_02);
  1345. mt_set_gpio_mode(GPIO_MHL_I2S_OUT_WS_PIN, GPIO_MODE_00);
  1346. mt_set_gpio_dir(GPIO_MHL_I2S_OUT_WS_PIN, GPIO_DIR_IN);
  1347. mt_set_gpio_pull_enable(GPIO_MHL_I2S_OUT_WS_PIN, GPIO_PULL_ENABLE);
  1348. mt_set_gpio_pull_select(GPIO_MHL_I2S_OUT_WS_PIN, GPIO_PULL_DOWN);
  1349. mt_set_gpio_mode(GPIO_MHL_I2S_OUT_CK_PIN, GPIO_MODE_00);
  1350. mt_set_gpio_dir(GPIO_MHL_I2S_OUT_CK_PIN, GPIO_DIR_IN);
  1351. mt_set_gpio_pull_enable(GPIO_MHL_I2S_OUT_CK_PIN, GPIO_PULL_ENABLE);
  1352. mt_set_gpio_pull_select(GPIO_MHL_I2S_OUT_CK_PIN, GPIO_PULL_DOWN);
  1353. mt_set_gpio_mode(GPIO_MHL_I2S_OUT_DAT_PIN, GPIO_MODE_00);
  1354. mt_set_gpio_dir(GPIO_MHL_I2S_OUT_DAT_PIN, GPIO_DIR_IN);
  1355. mt_set_gpio_pull_enable(GPIO_MHL_I2S_OUT_DAT_PIN, GPIO_PULL_ENABLE);
  1356. mt_set_gpio_pull_select(GPIO_MHL_I2S_OUT_DAT_PIN, GPIO_PULL_DOWN);
  1357. #endif
  1358. } else {
  1359. #ifdef GPIO_MHL_I2S_OUT_WS_PIN
  1360. mt_set_gpio_mode(GPIO_MHL_I2S_OUT_WS_PIN, mhl_ws_gpio_mode);
  1361. mt_set_gpio_mode(GPIO_MHL_I2S_OUT_CK_PIN, mhl_ck_gpio_mode);
  1362. mt_set_gpio_mode(GPIO_MHL_I2S_OUT_DAT_PIN, mhl_dat_gpio_mode);
  1363. #endif
  1364. }
  1365. }
  1366. #endif
  1367. #if SPM_AEE_RR_REC
  1368. void spm_suspend_aee_init(void)
  1369. {
  1370. aee_rr_rec_spm_suspend_val(0);
  1371. }
  1372. #endif
  1373. /* #include <cust_pmic.h> */
  1374. #ifndef DISABLE_DLPT_FEATURE
  1375. /* extern int get_dlpt_imix_spm(void); */
  1376. int __attribute__ ((weak)) get_dlpt_imix_spm(void)
  1377. {
  1378. return 0;
  1379. }
  1380. #endif
  1381. wake_reason_t spm_go_to_sleep(u32 spm_flags, u32 spm_data)
  1382. {
  1383. u32 sec = 2;
  1384. int wd_ret;
  1385. /* struct wake_status wakesta; */
  1386. unsigned long flags;
  1387. #if defined(CONFIG_ARCH_MT6735) || defined(CONFIG_ARCH_MT6735M)
  1388. unsigned long temp_a, temp_b;
  1389. #endif
  1390. #if 0
  1391. unsigned int temp_c;
  1392. #endif
  1393. struct mtk_irq_mask mask;
  1394. struct wd_api *wd_api;
  1395. static wake_reason_t last_wr = WR_NONE;
  1396. struct pcm_desc *pcmdesc;
  1397. struct pwr_ctrl *pwrctrl;
  1398. #ifndef DISABLE_DLPT_FEATURE
  1399. get_dlpt_imix_spm();
  1400. #endif
  1401. #if SPM_AEE_RR_REC
  1402. spm_suspend_aee_init();
  1403. aee_rr_rec_spm_suspend_val(1 << SPM_SUSPEND_ENTER);
  1404. #endif
  1405. /*
  1406. if(spm_set_suspend_pcm_ver(&spm_flags)==false) {
  1407. spm_crit2("mempll setting error %x\n",mt_get_clk_mem_sel());
  1408. last_wr = WR_UNKNOWN;
  1409. return last_wr;
  1410. }
  1411. */
  1412. #ifndef USE_DYNA_LOAD_SUSPEND
  1413. pcmdesc = __spm_suspend.pcmdesc;
  1414. pwrctrl = __spm_suspend.pwrctrl;
  1415. #else
  1416. pwrctrl = __spm_suspend.pwrctrl;
  1417. if (dyna_load_pcm[DYNA_LOAD_PCM_SUSPEND].ready)
  1418. pcmdesc = &(dyna_load_pcm[DYNA_LOAD_PCM_SUSPEND].desc);
  1419. else
  1420. BUG();
  1421. #endif
  1422. set_pwrctrl_pcm_flags(pwrctrl, spm_flags);
  1423. set_pwrctrl_pcm_data(pwrctrl, spm_data);
  1424. #if SPM_PWAKE_EN
  1425. sec = spm_get_wake_period(-1 /* FIXME */ , last_wr);
  1426. #endif
  1427. pwrctrl->timer_val = sec * 32768;
  1428. wd_ret = get_wd_api(&wd_api);
  1429. if (!wd_ret)
  1430. wd_api->wd_suspend_notify();
  1431. mt_power_gs_dump_suspend();
  1432. /* spm_suspend_pre_process(pwrctrl); */
  1433. lockdep_off();
  1434. spin_lock_irqsave(&__spm_lock, flags);
  1435. mt_irq_mask_all(&mask);
  1436. mt_irq_unmask_for_sleep(SPM_IRQ0_ID);
  1437. mt_cirq_clone_gic();
  1438. mt_cirq_enable();
  1439. spm_set_sysclk_settle();
  1440. #if defined(CONFIG_ARCH_MT6753)
  1441. __spm_enable_i2c4_clk();
  1442. if (vcorefs_get_curr_voltage() == VCORE_1_P_25_UV)
  1443. vcorefs_list_kicker_request();
  1444. #endif
  1445. spm_warn("sec = %u, wakesrc = 0x%x (%u)(%u)\n",
  1446. sec, pwrctrl->wake_src, is_cpu_pdn(pwrctrl->pcm_flags),
  1447. is_infra_pdn(pwrctrl->pcm_flags));
  1448. if (request_uart_to_sleep()) {
  1449. last_wr = WR_UART_BUSY;
  1450. goto RESTORE_IRQ;
  1451. }
  1452. __spm_reset_and_init_pcm(pcmdesc);
  1453. __spm_kick_im_to_fetch(pcmdesc);
  1454. __spm_init_pcm_register();
  1455. __spm_init_event_vector(pcmdesc);
  1456. __spm_set_power_control(pwrctrl);
  1457. __spm_set_wakeup_event(pwrctrl);
  1458. #if !defined(CONFIG_ARCH_MT6580)
  1459. mt_cpufreq_set_pmic_phase(PMIC_WRAP_PHASE_SUSPEND);
  1460. #endif
  1461. #if 0
  1462. temp_a = spm_read(PMIC_WRAP_DVFS_WDATA5);
  1463. temp_b = spm_read(PMIC_WRAP_DVFS_WDATA4);
  1464. spm_write(SPM_PCM_PASR_DPD_3, (temp_a << 16) | temp_b);
  1465. temp_a = spm_read(PMIC_WRAP_DVFS_WDATA3);
  1466. temp_b = spm_read(PMIC_WRAP_DVFS_WDATA2);
  1467. spm_write(SPM_PCM_PASR_DPD_2, (temp_a << 16) | temp_b);
  1468. #endif
  1469. #if defined(CONFIG_ARCH_MT6735)
  1470. temp_a = spm_read(PMIC_WRAP_DVFS_WDATA2);
  1471. temp_b = spm_read(PMIC_WRAP_DVFS_WDATA3);
  1472. spm_write(SPM_PCM_PASR_DPD_3, (temp_b << 16) | temp_a);
  1473. #elif defined(CONFIG_ARCH_MT6735M)
  1474. temp_a = spm_read(PMIC_WRAP_DVFS_WDATA2);
  1475. temp_b = spm_read(PMIC_WRAP_DVFS_WDATA3);
  1476. spm_write(SPM_PCM_PASR_DPD_3, (temp_b << 16) | temp_a);
  1477. #elif defined(CONFIG_ARCH_MT6753)
  1478. spm_write(PMIC_WRAP_DVFS_ADR10, 0x454);
  1479. spm_write(PMIC_WRAP_DVFS_WDATA10, 0x3E62);
  1480. spm_write(PMIC_WRAP_DVFS_ADR11, 0x454);
  1481. spm_write(PMIC_WRAP_DVFS_WDATA11, 0x2262);
  1482. #else
  1483. #endif
  1484. spm_kick_pcm_to_run(pwrctrl);
  1485. #if SPM_AEE_RR_REC
  1486. aee_rr_rec_spm_suspend_val(aee_rr_curr_spm_suspend_val() | (1 << SPM_SUSPEND_ENTER_WFI));
  1487. #endif
  1488. #if defined(CONFIG_ARCH_MT6580)
  1489. gic_set_primask();
  1490. #endif
  1491. spm_trigger_wfi_for_sleep(pwrctrl);
  1492. #if defined(CONFIG_ARCH_MT6580)
  1493. gic_clear_primask();
  1494. #endif
  1495. #if !defined(CONFIG_ARCH_MT6580)
  1496. mt_cpufreq_set_pmic_phase(PMIC_WRAP_PHASE_NORMAL);
  1497. #endif
  1498. #if SPM_AEE_RR_REC
  1499. aee_rr_rec_spm_suspend_val(aee_rr_curr_spm_suspend_val() | (1 << SPM_SUSPEND_LEAVE_WFI));
  1500. #endif
  1501. /* record last wakesta */
  1502. /* __spm_get_wakeup_status(&wakesta); */
  1503. __spm_get_wakeup_status(&spm_wakesta);
  1504. spm_clean_after_wakeup();
  1505. request_uart_to_wakeup();
  1506. /* record last wakesta */
  1507. /* last_wr = spm_output_wake_reason(&wakesta, pcmdesc); */
  1508. last_wr = spm_output_wake_reason(&spm_wakesta, pcmdesc);
  1509. #if 0
  1510. pmic_read_interface_nolock(MT6328_VRF18_0_CON0, &temp_c, 0xFFFF, 0);
  1511. spm_crit2("VRF18_0 = 0x%x\n", temp_c);
  1512. #endif
  1513. #if defined(CONFIG_ARCH_MT6753)
  1514. if (vcorefs_get_curr_voltage() == VCORE_1_P_25_UV)
  1515. vcorefs_list_kicker_request();
  1516. __spm_disable_i2c4_clk();
  1517. #endif
  1518. RESTORE_IRQ:
  1519. mt_cirq_flush();
  1520. mt_cirq_disable();
  1521. mt_irq_mask_restore(&mask);
  1522. spin_unlock_irqrestore(&__spm_lock, flags);
  1523. lockdep_on();
  1524. /* spm_suspend_post_process(pwrctrl); */
  1525. if (!wd_ret)
  1526. wd_api->wd_resume_notify();
  1527. #if SPM_AEE_RR_REC
  1528. aee_rr_rec_spm_suspend_val(aee_rr_curr_spm_suspend_val() | (1 << SPM_SUSPEND_LEAVE));
  1529. #endif
  1530. return last_wr;
  1531. }
  1532. bool spm_is_md_sleep(void)
  1533. {
  1534. return !((spm_read(SPM_PCM_REG13_DATA) & R13_MD1_SRCLKENA) |
  1535. (spm_read(SPM_PCM_REG13_DATA) & R13_MD2_SRCLKENA));
  1536. }
  1537. bool spm_is_md1_sleep(void)
  1538. {
  1539. return !(spm_read(SPM_PCM_REG13_DATA) & R13_MD1_SRCLKENA);
  1540. }
  1541. bool spm_is_md2_sleep(void)
  1542. {
  1543. return !(spm_read(SPM_PCM_REG13_DATA) & R13_MD2_SRCLKENA);
  1544. }
  1545. bool spm_is_conn_sleep(void)
  1546. {
  1547. return !(spm_read(SPM_PCM_REG13_DATA) & R13_CONN_SRCLKENA);
  1548. }
  1549. void spm_set_wakeup_src_check(void)
  1550. {
  1551. /* clean wakeup event raw status */
  1552. spm_write(SPM_SLEEP_WAKEUP_EVENT_MASK, 0xFFFFFFFF);
  1553. /* set wakeup event */
  1554. spm_write(SPM_SLEEP_WAKEUP_EVENT_MASK, ~WAKE_SRC_FOR_SUSPEND);
  1555. }
  1556. bool spm_check_wakeup_src(void)
  1557. {
  1558. u32 wakeup_src;
  1559. /* check wanek event raw status */
  1560. wakeup_src = spm_read(SPM_SLEEP_ISR_RAW_STA);
  1561. if (wakeup_src) {
  1562. spm_crit2("WARNING: spm_check_wakeup_src = 0x%x", wakeup_src);
  1563. return 1;
  1564. } else
  1565. return 0;
  1566. }
  1567. void spm_poweron_config_set(void)
  1568. {
  1569. unsigned long flags;
  1570. spin_lock_irqsave(&__spm_lock, flags);
  1571. /* enable register control */
  1572. spm_write(SPM_POWERON_CONFIG_SET, (SPM_PROJECT_CODE << 16) | (1U << 0));
  1573. spin_unlock_irqrestore(&__spm_lock, flags);
  1574. }
  1575. void spm_md32_sram_con(u32 value)
  1576. {
  1577. unsigned long flags;
  1578. spin_lock_irqsave(&__spm_lock, flags);
  1579. /* enable register control */
  1580. spm_write(SPM_MD32_SRAM_CON, value);
  1581. spin_unlock_irqrestore(&__spm_lock, flags);
  1582. }
  1583. /* FIXME: for K2 fpga early porting */
  1584. #if 0
  1585. #define hw_spin_lock_for_ddrdfs() \
  1586. do { \
  1587. spm_write(0xF0050090, 0x8000); \
  1588. } while (!(spm_read(0xF0050090) & 0x8000))
  1589. #define hw_spin_unlock_for_ddrdfs() \
  1590. spm_write(0xF0050090, 0x8000)
  1591. #else
  1592. #define hw_spin_lock_for_ddrdfs()
  1593. #define hw_spin_unlock_for_ddrdfs()
  1594. #endif
  1595. void spm_ap_mdsrc_req(u8 set)
  1596. {
  1597. unsigned long flags;
  1598. u32 i = 0;
  1599. u32 md_sleep = 0;
  1600. if (set) {
  1601. spin_lock_irqsave(&__spm_lock, flags);
  1602. if (spm_ap_mdsrc_req_cnt < 0) {
  1603. spm_crit2("warning: set = %d, spm_ap_mdsrc_req_cnt = %d\n", set,
  1604. spm_ap_mdsrc_req_cnt);
  1605. /* goto AP_MDSRC_REC_CNT_ERR; */
  1606. spin_unlock_irqrestore(&__spm_lock, flags);
  1607. } else {
  1608. spm_ap_mdsrc_req_cnt++;
  1609. hw_spin_lock_for_ddrdfs();
  1610. spm_write(SPM_POWER_ON_VAL1, spm_read(SPM_POWER_ON_VAL1) | (1 << 17));
  1611. hw_spin_unlock_for_ddrdfs();
  1612. spin_unlock_irqrestore(&__spm_lock, flags);
  1613. /* if md_apsrc_req = 1'b0, wait 26M settling time (3ms) */
  1614. if (0 == (spm_read(SPM_PCM_REG13_DATA) & R13_MD1_APSRC_REQ)) {
  1615. md_sleep = 1;
  1616. mdelay(3);
  1617. }
  1618. /* Check ap_mdsrc_ack = 1'b1 */
  1619. while (0 == (spm_read(SPM_PCM_REG13_DATA) & R13_AP_MD1SRC_ACK)) {
  1620. if (10 > i++) {
  1621. mdelay(1);
  1622. } else {
  1623. spm_crit2
  1624. ("WARNING: MD SLEEP = %d, spm_ap_mdsrc_req CAN NOT polling AP_MD1SRC_ACK\n",
  1625. md_sleep);
  1626. /* goto AP_MDSRC_REC_CNT_ERR; */
  1627. break;
  1628. }
  1629. }
  1630. }
  1631. } else {
  1632. spin_lock_irqsave(&__spm_lock, flags);
  1633. spm_ap_mdsrc_req_cnt--;
  1634. if (spm_ap_mdsrc_req_cnt < 0) {
  1635. spm_crit2("warning: set = %d, spm_ap_mdsrc_req_cnt = %d\n", set,
  1636. spm_ap_mdsrc_req_cnt);
  1637. /* goto AP_MDSRC_REC_CNT_ERR; */
  1638. } else {
  1639. if (0 == spm_ap_mdsrc_req_cnt) {
  1640. hw_spin_lock_for_ddrdfs();
  1641. spm_write(SPM_POWER_ON_VAL1,
  1642. spm_read(SPM_POWER_ON_VAL1) & ~(1 << 17));
  1643. hw_spin_unlock_for_ddrdfs();
  1644. }
  1645. }
  1646. spin_unlock_irqrestore(&__spm_lock, flags);
  1647. }
  1648. /* AP_MDSRC_REC_CNT_ERR: */
  1649. /* spin_unlock_irqrestore(&__spm_lock, flags); */
  1650. }
  1651. void spm_output_sleep_option(void)
  1652. {
  1653. spm_notice("PWAKE_EN:%d, PCMWDT_EN:%d, BYPASS_SYSPWREQ:%d, I2C_CHANNEL:%d\n",
  1654. SPM_PWAKE_EN, SPM_PCMWDT_EN, SPM_BYPASS_SYSPWREQ, I2C_CHANNEL);
  1655. }
  1656. /* record last wakesta */
  1657. u32 spm_get_last_wakeup_src(void)
  1658. {
  1659. return spm_wakesta.r12;
  1660. }
  1661. u32 spm_get_last_wakeup_misc(void)
  1662. {
  1663. return spm_wakesta.wake_misc;
  1664. }
  1665. #if defined(CONFIG_ARCH_MT6580)
  1666. uint32_t get_suspend_debug_flag(void)
  1667. {
  1668. uint32_t value = 0;
  1669. value = spm_read(SPM_PCM_WDT_LATCH);
  1670. spm_crit("PCM_WDT_LATCH=0x%x\n", spm_read(SPM_PCM_WDT_LATCH));
  1671. return value;
  1672. }
  1673. EXPORT_SYMBOL(get_suspend_debug_flag);
  1674. #endif
  1675. MODULE_DESCRIPTION("SPM-Sleep Driver v0.1");