msm_vidc_iris2.c 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2020-2021,, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #include "msm_vidc_iris2.h"
  7. #include "msm_vidc_buffer_iris2.h"
  8. #include "msm_vidc_power_iris2.h"
  9. #include "msm_vidc_inst.h"
  10. #include "msm_vidc_core.h"
  11. #include "msm_vidc_driver.h"
  12. #include "msm_vidc_platform.h"
  13. #include "msm_vidc_internal.h"
  14. #include "msm_vidc_buffer.h"
  15. #include "msm_vidc_state.h"
  16. #include "msm_vidc_debug.h"
  17. #include "msm_vidc_variant.h"
  18. #include "venus_hfi.h"
  19. #define VIDEO_ARCH_LX 1
  20. #define VCODEC_BASE_OFFS_IRIS2 0x00000000
  21. #define AON_MVP_NOC_RESET 0x0001F000
  22. #define CPU_BASE_OFFS_IRIS2 0x000A0000
  23. #define AON_BASE_OFFS 0x000E0000
  24. #define CPU_CS_BASE_OFFS_IRIS2 (CPU_BASE_OFFS_IRIS2)
  25. #define CPU_IC_BASE_OFFS_IRIS2 (CPU_BASE_OFFS_IRIS2)
  26. #define CPU_CS_A2HSOFTINTCLR_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x1C)
  27. #define CPU_CS_VCICMD_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x20)
  28. #define CPU_CS_VCICMDARG0_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x24)
  29. #define CPU_CS_VCICMDARG1_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x28)
  30. #define CPU_CS_VCICMDARG2_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x2C)
  31. #define CPU_CS_VCICMDARG3_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x30)
  32. #define CPU_CS_VMIMSG_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x34)
  33. #define CPU_CS_VMIMSGAG0_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x38)
  34. #define CPU_CS_VMIMSGAG1_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x3C)
  35. #define CPU_CS_SCIACMD_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x48)
  36. #define CPU_CS_H2XSOFTINTEN_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x148)
  37. /* HFI_CTRL_STATUS */
  38. #define CPU_CS_SCIACMDARG0_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x4C)
  39. #define CPU_CS_SCIACMDARG0_HFI_CTRL_ERROR_STATUS_BMSK_IRIS2 0xfe
  40. #define CPU_CS_SCIACMDARG0_HFI_CTRL_PC_READY_IRIS2 0x100
  41. #define CPU_CS_SCIACMDARG0_HFI_CTRL_INIT_IDLE_MSG_BMSK_IRIS2 0x40000000
  42. /* HFI_QTBL_INFO */
  43. #define CPU_CS_SCIACMDARG1_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x50)
  44. /* HFI_QTBL_ADDR */
  45. #define CPU_CS_SCIACMDARG2_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x54)
  46. /* HFI_VERSION_INFO */
  47. #define CPU_CS_SCIACMDARG3_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x58)
  48. /* SFR_ADDR */
  49. #define CPU_CS_SCIBCMD_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x5C)
  50. /* MMAP_ADDR */
  51. #define CPU_CS_SCIBCMDARG0_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x60)
  52. /* UC_REGION_ADDR */
  53. #define CPU_CS_SCIBARG1_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x64)
  54. /* UC_REGION_ADDR */
  55. #define CPU_CS_SCIBARG2_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x68)
  56. #define CPU_CS_AHB_BRIDGE_SYNC_RESET (CPU_CS_BASE_OFFS_IRIS2 + 0x160)
  57. #define CPU_CS_AHB_BRIDGE_SYNC_RESET_STATUS (CPU_CS_BASE_OFFS_IRIS2 + 0x164)
  58. /* FAL10 Feature Control */
  59. #define CPU_CS_X2RPMh_IRIS2 (CPU_CS_BASE_OFFS_IRIS2 + 0x168)
  60. #define CPU_CS_X2RPMh_MASK0_BMSK_IRIS2 0x1
  61. #define CPU_CS_X2RPMh_MASK0_SHFT_IRIS2 0x0
  62. #define CPU_CS_X2RPMh_MASK1_BMSK_IRIS2 0x2
  63. #define CPU_CS_X2RPMh_MASK1_SHFT_IRIS2 0x1
  64. #define CPU_CS_X2RPMh_SWOVERRIDE_BMSK_IRIS2 0x4
  65. #define CPU_CS_X2RPMh_SWOVERRIDE_SHFT_IRIS2 0x3
  66. #define CPU_IC_SOFTINT_IRIS2 (CPU_IC_BASE_OFFS_IRIS2 + 0x150)
  67. #define CPU_IC_SOFTINT_H2A_SHFT_IRIS2 0x0
  68. /*
  69. * --------------------------------------------------------------------------
  70. * MODULE: AON_MVP_NOC_RESET_REGISTERS
  71. * --------------------------------------------------------------------------
  72. */
  73. #define AON_WRAPPER_MVP_NOC_RESET_REQ (AON_MVP_NOC_RESET + 0x000)
  74. #define AON_WRAPPER_MVP_NOC_RESET_ACK (AON_MVP_NOC_RESET + 0x004)
  75. /*
  76. * --------------------------------------------------------------------------
  77. * MODULE: wrapper
  78. * --------------------------------------------------------------------------
  79. */
  80. #define WRAPPER_BASE_OFFS_IRIS2 0x000B0000
  81. #define WRAPPER_INTR_STATUS_IRIS2 (WRAPPER_BASE_OFFS_IRIS2 + 0x0C)
  82. #define WRAPPER_INTR_STATUS_A2HWD_BMSK_IRIS2 0x8
  83. #define WRAPPER_INTR_STATUS_A2H_BMSK_IRIS2 0x4
  84. #define WRAPPER_INTR_MASK_IRIS2 (WRAPPER_BASE_OFFS_IRIS2 + 0x10)
  85. #define WRAPPER_INTR_MASK_A2HWD_BMSK_IRIS2 0x8
  86. #define WRAPPER_INTR_MASK_A2HCPU_BMSK_IRIS2 0x4
  87. #define WRAPPER_CPU_CLOCK_CONFIG_IRIS2 (WRAPPER_BASE_OFFS_IRIS2 + 0x2000)
  88. #define WRAPPER_CPU_CGC_DIS_IRIS2 (WRAPPER_BASE_OFFS_IRIS2 + 0x2010)
  89. #define WRAPPER_CPU_STATUS_IRIS2 (WRAPPER_BASE_OFFS_IRIS2 + 0x2014)
  90. #define WRAPPER_DEBUG_BRIDGE_LPI_CONTROL_IRIS2 (WRAPPER_BASE_OFFS_IRIS2 + 0x54)
  91. #define WRAPPER_DEBUG_BRIDGE_LPI_STATUS_IRIS2 (WRAPPER_BASE_OFFS_IRIS2 + 0x58)
  92. #define WRAPPER_CORE_CLOCK_CONFIG_IRIS2 (WRAPPER_BASE_OFFS_IRIS2 + 0x88)
  93. /*
  94. * --------------------------------------------------------------------------
  95. * MODULE: tz_wrapper
  96. * --------------------------------------------------------------------------
  97. */
  98. #define WRAPPER_TZ_BASE_OFFS 0x000C0000
  99. #define WRAPPER_TZ_CPU_CLOCK_CONFIG (WRAPPER_TZ_BASE_OFFS)
  100. #define WRAPPER_TZ_CPU_STATUS (WRAPPER_TZ_BASE_OFFS + 0x10)
  101. #define CTRL_INIT_IRIS2 CPU_CS_SCIACMD_IRIS2
  102. #define CTRL_STATUS_IRIS2 CPU_CS_SCIACMDARG0_IRIS2
  103. #define CTRL_ERROR_STATUS__M_IRIS2 \
  104. CPU_CS_SCIACMDARG0_HFI_CTRL_ERROR_STATUS_BMSK_IRIS2
  105. #define CTRL_INIT_IDLE_MSG_BMSK_IRIS2 \
  106. CPU_CS_SCIACMDARG0_HFI_CTRL_INIT_IDLE_MSG_BMSK_IRIS2
  107. #define CTRL_STATUS_PC_READY_IRIS2 \
  108. CPU_CS_SCIACMDARG0_HFI_CTRL_PC_READY_IRIS2
  109. #define QTBL_INFO_IRIS2 CPU_CS_SCIACMDARG1_IRIS2
  110. #define QTBL_ADDR_IRIS2 CPU_CS_SCIACMDARG2_IRIS2
  111. #define VERSION_INFO_IRIS2 CPU_CS_SCIACMDARG3_IRIS2
  112. #define SFR_ADDR_IRIS2 CPU_CS_SCIBCMD_IRIS2
  113. #define MMAP_ADDR_IRIS2 CPU_CS_SCIBCMDARG0_IRIS2
  114. #define UC_REGION_ADDR_IRIS2 CPU_CS_SCIBARG1_IRIS2
  115. #define UC_REGION_SIZE_IRIS2 CPU_CS_SCIBARG2_IRIS2
  116. #define AON_WRAPPER_MVP_NOC_LPI_CONTROL (AON_BASE_OFFS)
  117. #define AON_WRAPPER_MVP_NOC_LPI_STATUS (AON_BASE_OFFS + 0x4)
  118. /*
  119. * --------------------------------------------------------------------------
  120. * MODULE: VCODEC_SS registers
  121. * --------------------------------------------------------------------------
  122. */
  123. #define VCODEC_SS_IDLE_STATUSn (VCODEC_BASE_OFFS_IRIS2 + 0x70)
  124. /*
  125. * --------------------------------------------------------------------------
  126. * MODULE: vcodec noc error log registers (iris2)
  127. * --------------------------------------------------------------------------
  128. */
  129. #define VCODEC_NOC_VIDEO_A_NOC_BASE_OFFS 0x00010000
  130. #define VCODEC_NOC_ERL_MAIN_SWID_LOW 0x00011200
  131. #define VCODEC_NOC_ERL_MAIN_SWID_HIGH 0x00011204
  132. #define VCODEC_NOC_ERL_MAIN_MAINCTL_LOW 0x00011208
  133. #define VCODEC_NOC_ERL_MAIN_ERRVLD_LOW 0x00011210
  134. #define VCODEC_NOC_ERL_MAIN_ERRCLR_LOW 0x00011218
  135. #define VCODEC_NOC_ERL_MAIN_ERRLOG0_LOW 0x00011220
  136. #define VCODEC_NOC_ERL_MAIN_ERRLOG0_HIGH 0x00011224
  137. #define VCODEC_NOC_ERL_MAIN_ERRLOG1_LOW 0x00011228
  138. #define VCODEC_NOC_ERL_MAIN_ERRLOG1_HIGH 0x0001122C
  139. #define VCODEC_NOC_ERL_MAIN_ERRLOG2_LOW 0x00011230
  140. #define VCODEC_NOC_ERL_MAIN_ERRLOG2_HIGH 0x00011234
  141. #define VCODEC_NOC_ERL_MAIN_ERRLOG3_LOW 0x00011238
  142. #define VCODEC_NOC_ERL_MAIN_ERRLOG3_HIGH 0x0001123C
  143. static int __interrupt_init_iris2(struct msm_vidc_core *vidc_core)
  144. {
  145. struct msm_vidc_core *core = vidc_core;
  146. u32 mask_val = 0;
  147. int rc = 0;
  148. if (!core) {
  149. d_vpr_e("%s: invalid params\n", __func__);
  150. return -EINVAL;
  151. }
  152. /* All interrupts should be disabled initially 0x1F6 : Reset value */
  153. rc = __read_register(core, WRAPPER_INTR_MASK_IRIS2, &mask_val);
  154. if (rc)
  155. return rc;
  156. /* Write 0 to unmask CPU and WD interrupts */
  157. mask_val &= ~(WRAPPER_INTR_MASK_A2HWD_BMSK_IRIS2|
  158. WRAPPER_INTR_MASK_A2HCPU_BMSK_IRIS2);
  159. rc = __write_register(core, WRAPPER_INTR_MASK_IRIS2, mask_val);
  160. if (rc)
  161. return rc;
  162. return 0;
  163. }
  164. static int __setup_ucregion_memory_map_iris2(struct msm_vidc_core *vidc_core)
  165. {
  166. struct msm_vidc_core *core = vidc_core;
  167. u32 value;
  168. int rc = 0;
  169. if (!core) {
  170. d_vpr_e("%s: invalid params\n", __func__);
  171. return -EINVAL;
  172. }
  173. value = (u32)core->iface_q_table.align_device_addr;
  174. rc = __write_register(core, UC_REGION_ADDR_IRIS2, value);
  175. if (rc)
  176. return rc;
  177. value = SHARED_QSIZE;
  178. rc = __write_register(core, UC_REGION_SIZE_IRIS2, value);
  179. if (rc)
  180. return rc;
  181. value = (u32)core->iface_q_table.align_device_addr;
  182. rc = __write_register(core, QTBL_ADDR_IRIS2, value);
  183. if (rc)
  184. return rc;
  185. rc = __write_register(core, QTBL_INFO_IRIS2, 0x01);
  186. if (rc)
  187. return rc;
  188. /* update queues vaddr for debug purpose */
  189. value = (u32)((u64)core->iface_q_table.align_virtual_addr);
  190. rc = __write_register(core, CPU_CS_VCICMDARG0_IRIS2, value);
  191. if (rc)
  192. return rc;
  193. value = (u32)((u64)core->iface_q_table.align_virtual_addr >> 32);
  194. rc = __write_register(core, CPU_CS_VCICMDARG1_IRIS2, value);
  195. if (rc)
  196. return rc;
  197. if (core->sfr.align_device_addr) {
  198. value = (u32)core->sfr.align_device_addr + VIDEO_ARCH_LX;
  199. rc = __write_register(core, SFR_ADDR_IRIS2, value);
  200. if (rc)
  201. return rc;
  202. }
  203. return 0;
  204. }
  205. static int __power_off_iris2_hardware(struct msm_vidc_core *core)
  206. {
  207. int rc = 0, i;
  208. u32 value = 0;
  209. if (is_core_sub_state(core, CORE_SUBSTATE_FW_PWR_CTRL)) {
  210. d_vpr_h("%s: hardware power control enabled\n", __func__);
  211. goto disable_power;
  212. }
  213. /*
  214. * check to make sure core clock branch enabled else
  215. * we cannot read vcodec top idle register
  216. */
  217. rc = __read_register(core, WRAPPER_CORE_CLOCK_CONFIG_IRIS2, &value);
  218. if (rc)
  219. return rc;
  220. if (value) {
  221. d_vpr_h("%s: core clock config not enabled, enabling it to read vcodec registers\n",
  222. __func__);
  223. rc = __write_register(core, WRAPPER_CORE_CLOCK_CONFIG_IRIS2, 0);
  224. if (rc)
  225. return rc;
  226. }
  227. /*
  228. * add MNoC idle check before collapsing MVS0 per HPG update
  229. * poll for NoC DMA idle -> HPG 6.1.1
  230. */
  231. for (i = 0; i < core->capabilities[NUM_VPP_PIPE].value; i++) {
  232. rc = __read_register_with_poll_timeout(core, VCODEC_SS_IDLE_STATUSn + 4*i,
  233. 0x400000, 0x400000, 2000, 20000);
  234. if (rc)
  235. d_vpr_h("%s: VCODEC_SS_IDLE_STATUSn (%d) is not idle (%#x)\n",
  236. __func__, i, value);
  237. }
  238. /* Apply partial reset on MSF interface and wait for ACK */
  239. rc = __write_register(core, AON_WRAPPER_MVP_NOC_RESET_REQ, 0x3);
  240. if (rc)
  241. return rc;
  242. rc = __read_register_with_poll_timeout(core, AON_WRAPPER_MVP_NOC_RESET_ACK,
  243. 0x3, 0x3, 200, 2000);
  244. if (rc)
  245. d_vpr_h("%s: AON_WRAPPER_MVP_NOC_RESET assert failed\n", __func__);
  246. /* De-assert partial reset on MSF interface and wait for ACK */
  247. rc = __write_register(core, AON_WRAPPER_MVP_NOC_RESET_REQ, 0x0);
  248. if (rc)
  249. return rc;
  250. rc = __read_register_with_poll_timeout(core, AON_WRAPPER_MVP_NOC_RESET_ACK,
  251. 0x3, 0x0, 200, 2000);
  252. if (rc)
  253. d_vpr_h("%s: AON_WRAPPER_MVP_NOC_RESET de-assert failed\n", __func__);
  254. /*
  255. * Reset both sides of 2 ahb2ahb_bridges (TZ and non-TZ)
  256. * do we need to check status register here?
  257. */
  258. rc = __write_register(core, CPU_CS_AHB_BRIDGE_SYNC_RESET, 0x3);
  259. if (rc)
  260. return rc;
  261. rc = __write_register(core, CPU_CS_AHB_BRIDGE_SYNC_RESET, 0x2);
  262. if (rc)
  263. return rc;
  264. rc = __write_register(core, CPU_CS_AHB_BRIDGE_SYNC_RESET, 0x0);
  265. if (rc)
  266. return rc;
  267. disable_power:
  268. /* power down process */
  269. rc = call_res_op(core, gdsc_off, core, "vcodec");
  270. if (rc) {
  271. d_vpr_e("%s: disable regulator vcodec failed\n", __func__);
  272. rc = 0;
  273. }
  274. rc = call_res_op(core, clk_disable, core, "vcodec_clk");
  275. if (rc) {
  276. d_vpr_e("%s: disable unprepare vcodec_clk failed\n", __func__);
  277. rc = 0;
  278. }
  279. return rc;
  280. }
  281. static int __power_off_iris2_controller(struct msm_vidc_core *core)
  282. {
  283. int rc = 0;
  284. /*
  285. * mask fal10_veto QLPAC error since fal10_veto can go 1
  286. * when pwwait == 0 and clamped to 0 -> HPG 6.1.2
  287. */
  288. rc = __write_register(core, CPU_CS_X2RPMh_IRIS2, 0x3);
  289. if (rc)
  290. return rc;
  291. /* set MNoC to low power, set PD_NOC_QREQ (bit 0) */
  292. rc = __write_register_masked(core, AON_WRAPPER_MVP_NOC_LPI_CONTROL,
  293. 0x1, BIT(0));
  294. if (rc)
  295. return rc;
  296. rc = __read_register_with_poll_timeout(core, AON_WRAPPER_MVP_NOC_LPI_STATUS,
  297. 0x1, 0x1, 200, 2000);
  298. if (rc)
  299. d_vpr_h("%s: AON_WRAPPER_MVP_NOC_LPI_CONTROL failed\n", __func__);
  300. /* Set Debug bridge Low power */
  301. rc = __write_register(core, WRAPPER_DEBUG_BRIDGE_LPI_CONTROL_IRIS2, 0x7);
  302. if (rc)
  303. return rc;
  304. rc = __read_register_with_poll_timeout(core, WRAPPER_DEBUG_BRIDGE_LPI_STATUS_IRIS2,
  305. 0x7, 0x7, 200, 2000);
  306. if (rc)
  307. d_vpr_h("%s: debug bridge low power failed\n", __func__);
  308. /* Debug bridge LPI release */
  309. rc = __write_register(core, WRAPPER_DEBUG_BRIDGE_LPI_CONTROL_IRIS2, 0x0);
  310. if (rc)
  311. return rc;
  312. rc = __read_register_with_poll_timeout(core, WRAPPER_DEBUG_BRIDGE_LPI_STATUS_IRIS2,
  313. 0xffffffff, 0x0, 200, 2000);
  314. if (rc)
  315. d_vpr_h("%s: debug bridge release failed\n", __func__);
  316. /* Turn off MVP MVS0C core clock */
  317. rc = call_res_op(core, clk_disable, core, "core_clk");
  318. if (rc) {
  319. d_vpr_e("%s: disable unprepare core_clk failed\n", __func__);
  320. rc = 0;
  321. }
  322. /* Disable GCC_VIDEO_AXI0_CLK clock */
  323. rc = call_res_op(core, clk_disable, core, "gcc_video_axi0");
  324. if (rc) {
  325. d_vpr_e("%s: disable unprepare gcc_video_axi0 failed\n", __func__);
  326. rc = 0;
  327. }
  328. rc = call_res_op(core, reset_bridge, core);
  329. if (rc) {
  330. d_vpr_e("%s: reset bridge failed\n", __func__);
  331. rc = 0;
  332. }
  333. /* power down process */
  334. rc = call_res_op(core, gdsc_off, core, "iris-ctl");
  335. if (rc) {
  336. d_vpr_e("%s: disable regulator iris-ctl failed\n", __func__);
  337. rc = 0;
  338. }
  339. return rc;
  340. }
  341. static int __power_off_iris2(struct msm_vidc_core *core)
  342. {
  343. int rc = 0;
  344. if (!core || !core->capabilities) {
  345. d_vpr_e("%s: invalid params\n", __func__);
  346. return -EINVAL;
  347. }
  348. if (!is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE))
  349. return 0;
  350. /**
  351. * Reset video_cc_mvs0_clk_src value to resolve MMRM high video
  352. * clock projection issue.
  353. */
  354. rc = call_res_op(core, set_clks, core, 0);
  355. if (rc)
  356. d_vpr_e("%s: resetting clocks failed\n", __func__);
  357. if (__power_off_iris2_hardware(core))
  358. d_vpr_e("%s: failed to power off hardware\n", __func__);
  359. if (__power_off_iris2_controller(core))
  360. d_vpr_e("%s: failed to power off controller\n", __func__);
  361. rc = call_res_op(core, set_bw, core, 0, 0);
  362. if (rc)
  363. d_vpr_e("%s: failed to unvote buses\n", __func__);
  364. if (!(core->intr_status & WRAPPER_INTR_STATUS_A2HWD_BMSK_IRIS2))
  365. disable_irq_nosync(core->resource->irq);
  366. core->intr_status = 0;
  367. msm_vidc_change_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE, 0, __func__);
  368. return rc;
  369. }
  370. static int __power_on_iris2_controller(struct msm_vidc_core *core)
  371. {
  372. int rc = 0;
  373. rc = call_res_op(core, gdsc_on, core, "iris-ctl");
  374. if (rc)
  375. goto fail_regulator;
  376. rc = call_res_op(core, reset_bridge, core);
  377. if (rc)
  378. goto fail_reset_ahb2axi;
  379. rc = call_res_op(core, clk_enable, core, "gcc_video_axi0");
  380. if (rc)
  381. goto fail_clk_axi;
  382. rc = call_res_op(core, clk_enable, core, "core_clk");
  383. if (rc)
  384. goto fail_clk_controller;
  385. return 0;
  386. fail_clk_controller:
  387. call_res_op(core, clk_disable, core, "gcc_video_axi0");
  388. fail_clk_axi:
  389. fail_reset_ahb2axi:
  390. call_res_op(core, gdsc_off, core, "iris-ctl");
  391. fail_regulator:
  392. return rc;
  393. }
  394. static int __power_on_iris2_hardware(struct msm_vidc_core *core)
  395. {
  396. int rc = 0;
  397. rc = call_res_op(core, gdsc_on, core, "vcodec");
  398. if (rc)
  399. goto fail_regulator;
  400. rc = call_res_op(core, clk_enable, core, "vcodec_clk");
  401. if (rc)
  402. goto fail_clk_controller;
  403. return 0;
  404. fail_clk_controller:
  405. call_res_op(core, gdsc_off, core, "vcodec");
  406. fail_regulator:
  407. return rc;
  408. }
  409. static int __power_on_iris2(struct msm_vidc_core *core)
  410. {
  411. struct frequency_table *freq_tbl;
  412. u32 freq = 0;
  413. int rc = 0;
  414. if (is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE))
  415. return 0;
  416. if (!core_in_valid_state(core)) {
  417. d_vpr_e("%s: invalid core state %s\n",
  418. __func__, core_state_name(core->state));
  419. return -EINVAL;
  420. }
  421. /* Vote for all hardware resources */
  422. rc = call_res_op(core, set_bw, core, INT_MAX, INT_MAX);
  423. if (rc) {
  424. d_vpr_e("%s: failed to vote buses, rc %d\n", __func__, rc);
  425. goto fail_vote_buses;
  426. }
  427. rc = __power_on_iris2_controller(core);
  428. if (rc) {
  429. d_vpr_e("%s: failed to power on iris2 controller\n", __func__);
  430. goto fail_power_on_controller;
  431. }
  432. rc = __power_on_iris2_hardware(core);
  433. if (rc) {
  434. d_vpr_e("%s: failed to power on iris2 hardware\n", __func__);
  435. goto fail_power_on_hardware;
  436. }
  437. /* video controller and hardware powered on successfully */
  438. rc = msm_vidc_change_core_sub_state(core, 0, CORE_SUBSTATE_POWER_ENABLE, __func__);
  439. if (rc)
  440. goto fail_power_on_substate;
  441. freq_tbl = core->resource->freq_set.freq_tbl;
  442. freq = core->power.clk_freq ? core->power.clk_freq :
  443. freq_tbl[0].freq;
  444. rc = call_res_op(core, set_clks, core, freq);
  445. if (rc) {
  446. d_vpr_e("%s: failed to scale clocks\n", __func__);
  447. rc = 0;
  448. }
  449. core->power.clk_freq = freq;
  450. /*
  451. * Re-program all of the registers that get reset as a result of
  452. * regulator_disable() and _enable()
  453. */
  454. __set_registers(core);
  455. __interrupt_init_iris2(core);
  456. core->intr_status = 0;
  457. enable_irq(core->resource->irq);
  458. return rc;
  459. fail_power_on_substate:
  460. __power_off_iris2_hardware(core);
  461. fail_power_on_hardware:
  462. __power_off_iris2_controller(core);
  463. fail_power_on_controller:
  464. call_res_op(core, set_bw, core, 0, 0);
  465. fail_vote_buses:
  466. msm_vidc_change_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE, 0, __func__);
  467. return rc;
  468. }
  469. static int __prepare_pc_iris2(struct msm_vidc_core *vidc_core)
  470. {
  471. int rc = 0;
  472. u32 wfi_status = 0, idle_status = 0, pc_ready = 0;
  473. u32 ctrl_status = 0;
  474. struct msm_vidc_core *core = vidc_core;
  475. if (!core) {
  476. d_vpr_e("%s: invalid params\n", __func__);
  477. return -EINVAL;
  478. }
  479. rc = __read_register(core, CTRL_STATUS_IRIS2, &ctrl_status);
  480. if (rc)
  481. return rc;
  482. pc_ready = ctrl_status & CTRL_STATUS_PC_READY_IRIS2;
  483. idle_status = ctrl_status & BIT(30);
  484. if (pc_ready) {
  485. d_vpr_h("Already in pc_ready state\n");
  486. return 0;
  487. }
  488. rc = __read_register(core, WRAPPER_TZ_CPU_STATUS, &wfi_status);
  489. if (rc)
  490. return rc;
  491. wfi_status &= BIT(0);
  492. if (!wfi_status || !idle_status) {
  493. d_vpr_e("Skipping PC, wfi status not set\n");
  494. goto skip_power_off;
  495. }
  496. rc = __prepare_pc(core);
  497. if (rc) {
  498. d_vpr_e("Failed __prepare_pc %d\n", rc);
  499. goto skip_power_off;
  500. }
  501. rc = __read_register_with_poll_timeout(core, CTRL_STATUS_IRIS2,
  502. CTRL_STATUS_PC_READY_IRIS2, CTRL_STATUS_PC_READY_IRIS2, 250, 2500);
  503. if (rc) {
  504. d_vpr_e("%s: Skip PC. Ctrl status not set\n", __func__);
  505. goto skip_power_off;
  506. }
  507. rc = __read_register_with_poll_timeout(core, WRAPPER_TZ_CPU_STATUS,
  508. BIT(0), 0x1, 250, 2500);
  509. if (rc) {
  510. d_vpr_e("%s: Skip PC. Wfi status not set\n", __func__);
  511. goto skip_power_off;
  512. }
  513. return rc;
  514. skip_power_off:
  515. rc = __read_register(core, CTRL_STATUS_IRIS2, &ctrl_status);
  516. if (rc)
  517. return rc;
  518. rc = __read_register(core, WRAPPER_TZ_CPU_STATUS, &wfi_status);
  519. if (rc)
  520. return rc;
  521. wfi_status &= BIT(0);
  522. d_vpr_e("Skip PC, wfi=%#x, idle=%#x, pcr=%#x, ctrl=%#x)\n",
  523. wfi_status, idle_status, pc_ready, ctrl_status);
  524. return -EAGAIN;
  525. }
  526. static int __raise_interrupt_iris2(struct msm_vidc_core *vidc_core)
  527. {
  528. struct msm_vidc_core *core = vidc_core;
  529. int rc = 0;
  530. if (!core) {
  531. d_vpr_e("%s: invalid params\n", __func__);
  532. return -EINVAL;
  533. }
  534. rc = __write_register(core, CPU_IC_SOFTINT_IRIS2, 1 << CPU_IC_SOFTINT_H2A_SHFT_IRIS2);
  535. if (rc)
  536. return rc;
  537. return 0;
  538. }
  539. static int __watchdog_iris2(struct msm_vidc_core *vidc_core, u32 intr_status)
  540. {
  541. int rc = 0;
  542. struct msm_vidc_core *core = vidc_core;
  543. if (!core) {
  544. d_vpr_e("%s: invalid params\n", __func__);
  545. return -EINVAL;
  546. }
  547. if (intr_status & WRAPPER_INTR_STATUS_A2HWD_BMSK_IRIS2) {
  548. d_vpr_e("%s: received watchdog interrupt\n", __func__);
  549. rc = 1;
  550. }
  551. return rc;
  552. }
  553. static int __noc_error_info_iris2(struct msm_vidc_core *vidc_core)
  554. {
  555. struct msm_vidc_core *core = vidc_core;
  556. if (!core) {
  557. d_vpr_e("%s: invalid params\n", __func__);
  558. return -EINVAL;
  559. }
  560. /*
  561. * we are not supposed to access vcodec subsystem registers
  562. * unless vcodec core clock WRAPPER_CORE_CLOCK_CONFIG_IRIS2 is enabled.
  563. * core clock might have been disabled by video firmware as part of
  564. * inter frame power collapse (power plane control feature).
  565. */
  566. /*
  567. val = __read_register(core, VCODEC_NOC_ERL_MAIN_SWID_LOW);
  568. d_vpr_e("VCODEC_NOC_ERL_MAIN_SWID_LOW: %#x\n", val);
  569. val = __read_register(core, VCODEC_NOC_ERL_MAIN_SWID_HIGH);
  570. d_vpr_e("VCODEC_NOC_ERL_MAIN_SWID_HIGH: %#x\n", val);
  571. val = __read_register(core, VCODEC_NOC_ERL_MAIN_MAINCTL_LOW);
  572. d_vpr_e("VCODEC_NOC_ERL_MAIN_MAINCTL_LOW: %#x\n", val);
  573. val = __read_register(core, VCODEC_NOC_ERL_MAIN_ERRVLD_LOW);
  574. d_vpr_e("VCODEC_NOC_ERL_MAIN_ERRVLD_LOW: %#x\n", val);
  575. val = __read_register(core, VCODEC_NOC_ERL_MAIN_ERRCLR_LOW);
  576. d_vpr_e("VCODEC_NOC_ERL_MAIN_ERRCLR_LOW: %#x\n", val);
  577. val = __read_register(core, VCODEC_NOC_ERL_MAIN_ERRLOG0_LOW);
  578. d_vpr_e("VCODEC_NOC_ERL_MAIN_ERRLOG0_LOW: %#x\n", val);
  579. val = __read_register(core, VCODEC_NOC_ERL_MAIN_ERRLOG0_HIGH);
  580. d_vpr_e("VCODEC_NOC_ERL_MAIN_ERRLOG0_HIGH: %#x\n", val);
  581. val = __read_register(core, VCODEC_NOC_ERL_MAIN_ERRLOG1_LOW);
  582. d_vpr_e("VCODEC_NOC_ERL_MAIN_ERRLOG1_LOW: %#x\n", val);
  583. val = __read_register(core, VCODEC_NOC_ERL_MAIN_ERRLOG1_HIGH);
  584. d_vpr_e("VCODEC_NOC_ERL_MAIN_ERRLOG1_HIGH: %#x\n", val);
  585. val = __read_register(core, VCODEC_NOC_ERL_MAIN_ERRLOG2_LOW);
  586. d_vpr_e("VCODEC_NOC_ERL_MAIN_ERRLOG2_LOW: %#x\n", val);
  587. val = __read_register(core, VCODEC_NOC_ERL_MAIN_ERRLOG2_HIGH);
  588. d_vpr_e("VCODEC_NOC_ERL_MAIN_ERRLOG2_HIGH: %#x\n", val);
  589. val = __read_register(core, VCODEC_NOC_ERL_MAIN_ERRLOG3_LOW);
  590. d_vpr_e("VCODEC_NOC_ERL_MAIN_ERRLOG3_LOW: %#x\n", val);
  591. val = __read_register(core, VCODEC_NOC_ERL_MAIN_ERRLOG3_HIGH);
  592. d_vpr_e("VCODEC_NOC_ERL_MAIN_ERRLOG3_HIGH: %#x\n", val);
  593. */
  594. return 0;
  595. }
  596. static int __clear_interrupt_iris2(struct msm_vidc_core *vidc_core)
  597. {
  598. struct msm_vidc_core *core = vidc_core;
  599. u32 intr_status = 0, mask = 0;
  600. int rc = 0;
  601. if (!core) {
  602. d_vpr_e("%s: NULL core\n", __func__);
  603. return 0;
  604. }
  605. rc = __read_register(core, WRAPPER_INTR_STATUS_IRIS2, &intr_status);
  606. if (rc)
  607. return rc;
  608. mask = (WRAPPER_INTR_STATUS_A2H_BMSK_IRIS2|
  609. WRAPPER_INTR_STATUS_A2HWD_BMSK_IRIS2|
  610. CTRL_INIT_IDLE_MSG_BMSK_IRIS2);
  611. if (intr_status & mask) {
  612. core->intr_status |= intr_status;
  613. core->reg_count++;
  614. d_vpr_l("INTERRUPT: times: %d interrupt_status: %d\n",
  615. core->reg_count, intr_status);
  616. } else {
  617. core->spur_count++;
  618. }
  619. rc = __write_register(core, CPU_CS_A2HSOFTINTCLR_IRIS2, 1);
  620. if (rc)
  621. return rc;
  622. return 0;
  623. }
  624. static int __boot_firmware_iris2(struct msm_vidc_core *vidc_core)
  625. {
  626. int rc = 0;
  627. u32 ctrl_init_val = 0, ctrl_status = 0, count = 0, max_tries = 1000;
  628. struct msm_vidc_core *core = vidc_core;
  629. if (!core) {
  630. d_vpr_e("%s: NULL core\n", __func__);
  631. return 0;
  632. }
  633. rc = __setup_ucregion_memory_map_iris2(core);
  634. if (rc)
  635. return rc;
  636. ctrl_init_val = BIT(0);
  637. rc = __write_register(core, CTRL_INIT_IRIS2, ctrl_init_val);
  638. if (rc)
  639. return rc;
  640. while (!ctrl_status && count < max_tries) {
  641. rc = __read_register(core, CTRL_STATUS_IRIS2, &ctrl_status);
  642. if (rc)
  643. return rc;
  644. if ((ctrl_status & CTRL_ERROR_STATUS__M_IRIS2) == 0x4) {
  645. d_vpr_e("invalid setting for UC_REGION\n");
  646. break;
  647. }
  648. usleep_range(50, 100);
  649. count++;
  650. }
  651. if (count >= max_tries) {
  652. d_vpr_e("Error booting up vidc firmware\n");
  653. return -ETIME;
  654. }
  655. /* Enable interrupt before sending commands to venus */
  656. rc = __write_register(core, CPU_CS_H2XSOFTINTEN_IRIS2, 0x1);
  657. if (rc)
  658. return rc;
  659. rc = __write_register(core, CPU_CS_X2RPMh_IRIS2, 0x0);
  660. if (rc)
  661. return rc;
  662. return rc;
  663. }
  664. int msm_vidc_decide_work_mode_iris2(struct msm_vidc_inst* inst)
  665. {
  666. u32 work_mode;
  667. struct v4l2_format *inp_f;
  668. u32 width, height;
  669. bool res_ok = false;
  670. if (!inst || !inst->capabilities) {
  671. d_vpr_e("%s: invalid params\n", __func__);
  672. return -EINVAL;
  673. }
  674. work_mode = MSM_VIDC_STAGE_2;
  675. inp_f = &inst->fmts[INPUT_PORT];
  676. if (is_image_decode_session(inst))
  677. work_mode = MSM_VIDC_STAGE_1;
  678. if (is_image_session(inst))
  679. goto exit;
  680. if (is_decode_session(inst)) {
  681. height = inp_f->fmt.pix_mp.height;
  682. width = inp_f->fmt.pix_mp.width;
  683. res_ok = res_is_less_than(width, height, 1280, 720);
  684. if (inst->capabilities->cap[CODED_FRAMES].value ==
  685. CODED_FRAMES_INTERLACE ||
  686. inst->capabilities->cap[LOWLATENCY_MODE].value ||
  687. res_ok) {
  688. work_mode = MSM_VIDC_STAGE_1;
  689. }
  690. } else if (is_encode_session(inst)) {
  691. height = inst->crop.height;
  692. width = inst->crop.width;
  693. res_ok = !res_is_greater_than(width, height, 4096, 2160);
  694. if (res_ok &&
  695. (inst->capabilities->cap[LOWLATENCY_MODE].value)) {
  696. work_mode = MSM_VIDC_STAGE_1;
  697. }
  698. if (inst->capabilities->cap[LOSSLESS].value)
  699. work_mode = MSM_VIDC_STAGE_2;
  700. if (!inst->capabilities->cap[GOP_SIZE].value)
  701. work_mode = MSM_VIDC_STAGE_2;
  702. } else {
  703. i_vpr_e(inst, "%s: invalid session type\n", __func__);
  704. return -EINVAL;
  705. }
  706. exit:
  707. i_vpr_h(inst, "Configuring work mode = %u low latency = %u, gop size = %u\n",
  708. work_mode, inst->capabilities->cap[LOWLATENCY_MODE].value,
  709. inst->capabilities->cap[GOP_SIZE].value);
  710. msm_vidc_update_cap_value(inst, STAGE, work_mode, __func__);
  711. return 0;
  712. }
  713. int msm_vidc_decide_work_route_iris2(struct msm_vidc_inst* inst)
  714. {
  715. u32 work_route;
  716. struct msm_vidc_core* core;
  717. if (!inst || !inst->core) {
  718. d_vpr_e("%s: invalid params\n", __func__);
  719. return -EINVAL;
  720. }
  721. core = inst->core;
  722. work_route = core->capabilities[NUM_VPP_PIPE].value;
  723. if (is_image_session(inst))
  724. goto exit;
  725. if (is_decode_session(inst)) {
  726. if (inst->capabilities->cap[CODED_FRAMES].value ==
  727. CODED_FRAMES_INTERLACE)
  728. work_route = MSM_VIDC_PIPE_1;
  729. } else if (is_encode_session(inst)) {
  730. u32 slice_mode;
  731. slice_mode = inst->capabilities->cap[SLICE_MODE].value;
  732. /*TODO Pipe=1 for legacy CBR*/
  733. if (slice_mode == V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_BYTES)
  734. work_route = MSM_VIDC_PIPE_1;
  735. } else {
  736. i_vpr_e(inst, "%s: invalid session type\n", __func__);
  737. return -EINVAL;
  738. }
  739. exit:
  740. i_vpr_h(inst, "Configuring work route = %u", work_route);
  741. msm_vidc_update_cap_value(inst, PIPE, work_route, __func__);
  742. return 0;
  743. }
  744. int msm_vidc_adjust_blur_type_iris2(void *instance, struct v4l2_ctrl *ctrl)
  745. {
  746. struct msm_vidc_inst_capability *capability;
  747. s32 adjusted_value;
  748. struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
  749. s32 rc_type = -1, cac = -1;
  750. s32 pix_fmts = -1, min_quality = -1;
  751. if (!inst || !inst->capabilities) {
  752. d_vpr_e("%s: invalid params\n", __func__);
  753. return -EINVAL;
  754. }
  755. capability = inst->capabilities;
  756. adjusted_value = ctrl ? ctrl->val :
  757. capability->cap[BLUR_TYPES].value;
  758. if (adjusted_value == MSM_VIDC_BLUR_NONE)
  759. return 0;
  760. if (msm_vidc_get_parent_value(inst, BLUR_TYPES, BITRATE_MODE,
  761. &rc_type, __func__) ||
  762. msm_vidc_get_parent_value(inst, BLUR_TYPES,
  763. CONTENT_ADAPTIVE_CODING, &cac, __func__) ||
  764. msm_vidc_get_parent_value(inst, BLUR_TYPES, PIX_FMTS,
  765. &pix_fmts, __func__) ||
  766. msm_vidc_get_parent_value(inst, BLUR_TYPES, MIN_QUALITY,
  767. &min_quality, __func__))
  768. return -EINVAL;
  769. if (adjusted_value == MSM_VIDC_BLUR_EXTERNAL) {
  770. if (is_scaling_enabled(inst) || min_quality) {
  771. adjusted_value = MSM_VIDC_BLUR_NONE;
  772. }
  773. } else if (adjusted_value == MSM_VIDC_BLUR_ADAPTIVE) {
  774. if (is_scaling_enabled(inst) || min_quality ||
  775. (rc_type != HFI_RC_VBR_CFR) ||
  776. !cac ||
  777. is_10bit_colorformat(pix_fmts)) {
  778. adjusted_value = MSM_VIDC_BLUR_NONE;
  779. }
  780. }
  781. msm_vidc_update_cap_value(inst, BLUR_TYPES,
  782. adjusted_value, __func__);
  783. return 0;
  784. }
  785. int msm_vidc_decide_quality_mode_iris2(struct msm_vidc_inst* inst)
  786. {
  787. struct msm_vidc_inst_capability* capability = NULL;
  788. struct msm_vidc_core *core;
  789. u32 mbpf, mbps, max_hq_mbpf, max_hq_mbps;
  790. u32 mode = MSM_VIDC_POWER_SAVE_MODE;
  791. if (!inst || !inst->capabilities) {
  792. d_vpr_e("%s: invalid params\n", __func__);
  793. return -EINVAL;
  794. }
  795. capability = inst->capabilities;
  796. if (!is_encode_session(inst))
  797. return 0;
  798. /* image session always runs at quality mode */
  799. if (is_image_session(inst)) {
  800. mode = MSM_VIDC_MAX_QUALITY_MODE;
  801. goto exit;
  802. }
  803. mbpf = msm_vidc_get_mbs_per_frame(inst);
  804. mbps = mbpf * msm_vidc_get_fps(inst);
  805. core = inst->core;
  806. max_hq_mbpf = core->capabilities[MAX_MBPF_HQ].value;;
  807. max_hq_mbps = core->capabilities[MAX_MBPS_HQ].value;;
  808. /* NRT session to have max quality unless client configures lesser complexity */
  809. if (!is_realtime_session(inst) && mbpf <= max_hq_mbpf) {
  810. mode = MSM_VIDC_MAX_QUALITY_MODE;
  811. if (capability->cap[COMPLEXITY].value < DEFAULT_COMPLEXITY)
  812. mode = MSM_VIDC_POWER_SAVE_MODE;
  813. goto exit;
  814. }
  815. /* Power saving always disabled for CQ and LOSSLESS RC modes. */
  816. if (capability->cap[LOSSLESS].value ||
  817. (mbpf <= max_hq_mbpf && mbps <= max_hq_mbps))
  818. mode = MSM_VIDC_MAX_QUALITY_MODE;
  819. exit:
  820. msm_vidc_update_cap_value(inst, QUALITY_MODE, mode, __func__);
  821. return 0;
  822. }
  823. static struct msm_vidc_venus_ops iris2_ops = {
  824. .boot_firmware = __boot_firmware_iris2,
  825. .raise_interrupt = __raise_interrupt_iris2,
  826. .clear_interrupt = __clear_interrupt_iris2,
  827. .power_on = __power_on_iris2,
  828. .power_off = __power_off_iris2,
  829. .prepare_pc = __prepare_pc_iris2,
  830. .watchdog = __watchdog_iris2,
  831. .noc_error_info = __noc_error_info_iris2,
  832. };
  833. static struct msm_vidc_session_ops msm_session_ops = {
  834. .buffer_size = msm_buffer_size_iris2,
  835. .min_count = msm_buffer_min_count_iris2,
  836. .extra_count = msm_buffer_extra_count_iris2,
  837. .calc_freq = msm_vidc_calc_freq_iris2,
  838. .calc_bw = msm_vidc_calc_bw_iris2,
  839. .decide_work_route = msm_vidc_decide_work_route_iris2,
  840. .decide_work_mode = msm_vidc_decide_work_mode_iris2,
  841. .decide_quality_mode = msm_vidc_decide_quality_mode_iris2,
  842. };
  843. int msm_vidc_init_iris2(struct msm_vidc_core *core)
  844. {
  845. if (!core) {
  846. d_vpr_e("%s: invalid params\n", __func__);
  847. return -EINVAL;
  848. }
  849. d_vpr_h("%s()\n", __func__);
  850. core->venus_ops = &iris2_ops;
  851. core->session_ops = &msm_session_ops;
  852. return 0;
  853. }
  854. int msm_vidc_deinit_iris2(struct msm_vidc_core *core)
  855. {
  856. /* do nothing */
  857. return 0;
  858. }