vsp1_pipe.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. /*
  2. * vsp1_pipe.c -- R-Car VSP1 Pipeline
  3. *
  4. * Copyright (C) 2013-2015 Renesas Electronics Corporation
  5. *
  6. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. */
  13. #include <linux/delay.h>
  14. #include <linux/list.h>
  15. #include <linux/sched.h>
  16. #include <linux/wait.h>
  17. #include <media/media-entity.h>
  18. #include <media/v4l2-subdev.h>
  19. #include "vsp1.h"
  20. #include "vsp1_brx.h"
  21. #include "vsp1_dl.h"
  22. #include "vsp1_entity.h"
  23. #include "vsp1_hgo.h"
  24. #include "vsp1_hgt.h"
  25. #include "vsp1_pipe.h"
  26. #include "vsp1_rwpf.h"
  27. #include "vsp1_uds.h"
  28. /* -----------------------------------------------------------------------------
  29. * Helper Functions
  30. */
  31. static const struct vsp1_format_info vsp1_video_formats[] = {
  32. { V4L2_PIX_FMT_RGB332, MEDIA_BUS_FMT_ARGB8888_1X32,
  33. VI6_FMT_RGB_332, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  34. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  35. 1, { 8, 0, 0 }, false, false, 1, 1, false },
  36. { V4L2_PIX_FMT_ARGB444, MEDIA_BUS_FMT_ARGB8888_1X32,
  37. VI6_FMT_ARGB_4444, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  38. VI6_RPF_DSWAP_P_WDS,
  39. 1, { 16, 0, 0 }, false, false, 1, 1, true },
  40. { V4L2_PIX_FMT_XRGB444, MEDIA_BUS_FMT_ARGB8888_1X32,
  41. VI6_FMT_XRGB_4444, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  42. VI6_RPF_DSWAP_P_WDS,
  43. 1, { 16, 0, 0 }, false, false, 1, 1, false },
  44. { V4L2_PIX_FMT_ARGB555, MEDIA_BUS_FMT_ARGB8888_1X32,
  45. VI6_FMT_ARGB_1555, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  46. VI6_RPF_DSWAP_P_WDS,
  47. 1, { 16, 0, 0 }, false, false, 1, 1, true },
  48. { V4L2_PIX_FMT_XRGB555, MEDIA_BUS_FMT_ARGB8888_1X32,
  49. VI6_FMT_XRGB_1555, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  50. VI6_RPF_DSWAP_P_WDS,
  51. 1, { 16, 0, 0 }, false, false, 1, 1, false },
  52. { V4L2_PIX_FMT_RGB565, MEDIA_BUS_FMT_ARGB8888_1X32,
  53. VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  54. VI6_RPF_DSWAP_P_WDS,
  55. 1, { 16, 0, 0 }, false, false, 1, 1, false },
  56. { V4L2_PIX_FMT_BGR24, MEDIA_BUS_FMT_ARGB8888_1X32,
  57. VI6_FMT_BGR_888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  58. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  59. 1, { 24, 0, 0 }, false, false, 1, 1, false },
  60. { V4L2_PIX_FMT_RGB24, MEDIA_BUS_FMT_ARGB8888_1X32,
  61. VI6_FMT_RGB_888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  62. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  63. 1, { 24, 0, 0 }, false, false, 1, 1, false },
  64. { V4L2_PIX_FMT_ABGR32, MEDIA_BUS_FMT_ARGB8888_1X32,
  65. VI6_FMT_ARGB_8888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
  66. 1, { 32, 0, 0 }, false, false, 1, 1, true },
  67. { V4L2_PIX_FMT_XBGR32, MEDIA_BUS_FMT_ARGB8888_1X32,
  68. VI6_FMT_ARGB_8888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
  69. 1, { 32, 0, 0 }, false, false, 1, 1, false },
  70. { V4L2_PIX_FMT_ARGB32, MEDIA_BUS_FMT_ARGB8888_1X32,
  71. VI6_FMT_ARGB_8888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  72. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  73. 1, { 32, 0, 0 }, false, false, 1, 1, true },
  74. { V4L2_PIX_FMT_XRGB32, MEDIA_BUS_FMT_ARGB8888_1X32,
  75. VI6_FMT_ARGB_8888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  76. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  77. 1, { 32, 0, 0 }, false, false, 1, 1, false },
  78. { V4L2_PIX_FMT_HSV24, MEDIA_BUS_FMT_AHSV8888_1X32,
  79. VI6_FMT_RGB_888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  80. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  81. 1, { 24, 0, 0 }, false, false, 1, 1, false },
  82. { V4L2_PIX_FMT_HSV32, MEDIA_BUS_FMT_AHSV8888_1X32,
  83. VI6_FMT_ARGB_8888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  84. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  85. 1, { 32, 0, 0 }, false, false, 1, 1, false },
  86. { V4L2_PIX_FMT_UYVY, MEDIA_BUS_FMT_AYUV8_1X32,
  87. VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  88. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  89. 1, { 16, 0, 0 }, false, false, 2, 1, false },
  90. { V4L2_PIX_FMT_VYUY, MEDIA_BUS_FMT_AYUV8_1X32,
  91. VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  92. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  93. 1, { 16, 0, 0 }, false, true, 2, 1, false },
  94. { V4L2_PIX_FMT_YUYV, MEDIA_BUS_FMT_AYUV8_1X32,
  95. VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  96. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  97. 1, { 16, 0, 0 }, true, false, 2, 1, false },
  98. { V4L2_PIX_FMT_YVYU, MEDIA_BUS_FMT_AYUV8_1X32,
  99. VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  100. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  101. 1, { 16, 0, 0 }, true, true, 2, 1, false },
  102. { V4L2_PIX_FMT_NV12M, MEDIA_BUS_FMT_AYUV8_1X32,
  103. VI6_FMT_Y_UV_420, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  104. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  105. 2, { 8, 16, 0 }, false, false, 2, 2, false },
  106. { V4L2_PIX_FMT_NV21M, MEDIA_BUS_FMT_AYUV8_1X32,
  107. VI6_FMT_Y_UV_420, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  108. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  109. 2, { 8, 16, 0 }, false, true, 2, 2, false },
  110. { V4L2_PIX_FMT_NV16M, MEDIA_BUS_FMT_AYUV8_1X32,
  111. VI6_FMT_Y_UV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  112. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  113. 2, { 8, 16, 0 }, false, false, 2, 1, false },
  114. { V4L2_PIX_FMT_NV61M, MEDIA_BUS_FMT_AYUV8_1X32,
  115. VI6_FMT_Y_UV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  116. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  117. 2, { 8, 16, 0 }, false, true, 2, 1, false },
  118. { V4L2_PIX_FMT_YUV420M, MEDIA_BUS_FMT_AYUV8_1X32,
  119. VI6_FMT_Y_U_V_420, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  120. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  121. 3, { 8, 8, 8 }, false, false, 2, 2, false },
  122. { V4L2_PIX_FMT_YVU420M, MEDIA_BUS_FMT_AYUV8_1X32,
  123. VI6_FMT_Y_U_V_420, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  124. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  125. 3, { 8, 8, 8 }, false, true, 2, 2, false },
  126. { V4L2_PIX_FMT_YUV422M, MEDIA_BUS_FMT_AYUV8_1X32,
  127. VI6_FMT_Y_U_V_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  128. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  129. 3, { 8, 8, 8 }, false, false, 2, 1, false },
  130. { V4L2_PIX_FMT_YVU422M, MEDIA_BUS_FMT_AYUV8_1X32,
  131. VI6_FMT_Y_U_V_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  132. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  133. 3, { 8, 8, 8 }, false, true, 2, 1, false },
  134. { V4L2_PIX_FMT_YUV444M, MEDIA_BUS_FMT_AYUV8_1X32,
  135. VI6_FMT_Y_U_V_444, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  136. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  137. 3, { 8, 8, 8 }, false, false, 1, 1, false },
  138. { V4L2_PIX_FMT_YVU444M, MEDIA_BUS_FMT_AYUV8_1X32,
  139. VI6_FMT_Y_U_V_444, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  140. VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  141. 3, { 8, 8, 8 }, false, true, 1, 1, false },
  142. };
  143. /**
  144. * vsp1_get_format_info - Retrieve format information for a 4CC
  145. * @vsp1: the VSP1 device
  146. * @fourcc: the format 4CC
  147. *
  148. * Return a pointer to the format information structure corresponding to the
  149. * given V4L2 format 4CC, or NULL if no corresponding format can be found.
  150. */
  151. const struct vsp1_format_info *vsp1_get_format_info(struct vsp1_device *vsp1,
  152. u32 fourcc)
  153. {
  154. unsigned int i;
  155. /* Special case, the VYUY and HSV formats are supported on Gen2 only. */
  156. if (vsp1->info->gen != 2) {
  157. switch (fourcc) {
  158. case V4L2_PIX_FMT_VYUY:
  159. case V4L2_PIX_FMT_HSV24:
  160. case V4L2_PIX_FMT_HSV32:
  161. return NULL;
  162. }
  163. }
  164. for (i = 0; i < ARRAY_SIZE(vsp1_video_formats); ++i) {
  165. const struct vsp1_format_info *info = &vsp1_video_formats[i];
  166. if (info->fourcc == fourcc)
  167. return info;
  168. }
  169. return NULL;
  170. }
  171. /* -----------------------------------------------------------------------------
  172. * Pipeline Management
  173. */
  174. void vsp1_pipeline_reset(struct vsp1_pipeline *pipe)
  175. {
  176. struct vsp1_entity *entity;
  177. unsigned int i;
  178. if (pipe->brx) {
  179. struct vsp1_brx *brx = to_brx(&pipe->brx->subdev);
  180. for (i = 0; i < ARRAY_SIZE(brx->inputs); ++i)
  181. brx->inputs[i].rpf = NULL;
  182. }
  183. for (i = 0; i < ARRAY_SIZE(pipe->inputs); ++i)
  184. pipe->inputs[i] = NULL;
  185. pipe->output = NULL;
  186. list_for_each_entry(entity, &pipe->entities, list_pipe)
  187. entity->pipe = NULL;
  188. INIT_LIST_HEAD(&pipe->entities);
  189. pipe->state = VSP1_PIPELINE_STOPPED;
  190. pipe->buffers_ready = 0;
  191. pipe->num_inputs = 0;
  192. pipe->brx = NULL;
  193. pipe->hgo = NULL;
  194. pipe->hgt = NULL;
  195. pipe->lif = NULL;
  196. pipe->uds = NULL;
  197. }
  198. void vsp1_pipeline_init(struct vsp1_pipeline *pipe)
  199. {
  200. mutex_init(&pipe->lock);
  201. spin_lock_init(&pipe->irqlock);
  202. init_waitqueue_head(&pipe->wq);
  203. kref_init(&pipe->kref);
  204. INIT_LIST_HEAD(&pipe->entities);
  205. pipe->state = VSP1_PIPELINE_STOPPED;
  206. }
  207. /* Must be called with the pipe irqlock held. */
  208. void vsp1_pipeline_run(struct vsp1_pipeline *pipe)
  209. {
  210. struct vsp1_device *vsp1 = pipe->output->entity.vsp1;
  211. if (pipe->state == VSP1_PIPELINE_STOPPED) {
  212. vsp1_write(vsp1, VI6_CMD(pipe->output->entity.index),
  213. VI6_CMD_STRCMD);
  214. pipe->state = VSP1_PIPELINE_RUNNING;
  215. }
  216. pipe->buffers_ready = 0;
  217. }
  218. bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe)
  219. {
  220. unsigned long flags;
  221. bool stopped;
  222. spin_lock_irqsave(&pipe->irqlock, flags);
  223. stopped = pipe->state == VSP1_PIPELINE_STOPPED;
  224. spin_unlock_irqrestore(&pipe->irqlock, flags);
  225. return stopped;
  226. }
  227. int vsp1_pipeline_stop(struct vsp1_pipeline *pipe)
  228. {
  229. struct vsp1_device *vsp1 = pipe->output->entity.vsp1;
  230. struct vsp1_entity *entity;
  231. unsigned long flags;
  232. int ret;
  233. if (pipe->lif) {
  234. /*
  235. * When using display lists in continuous frame mode the only
  236. * way to stop the pipeline is to reset the hardware.
  237. */
  238. ret = vsp1_reset_wpf(vsp1, pipe->output->entity.index);
  239. if (ret == 0) {
  240. spin_lock_irqsave(&pipe->irqlock, flags);
  241. pipe->state = VSP1_PIPELINE_STOPPED;
  242. spin_unlock_irqrestore(&pipe->irqlock, flags);
  243. }
  244. } else {
  245. /* Otherwise just request a stop and wait. */
  246. spin_lock_irqsave(&pipe->irqlock, flags);
  247. if (pipe->state == VSP1_PIPELINE_RUNNING)
  248. pipe->state = VSP1_PIPELINE_STOPPING;
  249. spin_unlock_irqrestore(&pipe->irqlock, flags);
  250. ret = wait_event_timeout(pipe->wq, vsp1_pipeline_stopped(pipe),
  251. msecs_to_jiffies(500));
  252. ret = ret == 0 ? -ETIMEDOUT : 0;
  253. }
  254. list_for_each_entry(entity, &pipe->entities, list_pipe) {
  255. if (entity->route && entity->route->reg)
  256. vsp1_write(vsp1, entity->route->reg,
  257. VI6_DPR_NODE_UNUSED);
  258. }
  259. if (pipe->hgo)
  260. vsp1_write(vsp1, VI6_DPR_HGO_SMPPT,
  261. (7 << VI6_DPR_SMPPT_TGW_SHIFT) |
  262. (VI6_DPR_NODE_UNUSED << VI6_DPR_SMPPT_PT_SHIFT));
  263. if (pipe->hgt)
  264. vsp1_write(vsp1, VI6_DPR_HGT_SMPPT,
  265. (7 << VI6_DPR_SMPPT_TGW_SHIFT) |
  266. (VI6_DPR_NODE_UNUSED << VI6_DPR_SMPPT_PT_SHIFT));
  267. v4l2_subdev_call(&pipe->output->entity.subdev, video, s_stream, 0);
  268. return ret;
  269. }
  270. bool vsp1_pipeline_ready(struct vsp1_pipeline *pipe)
  271. {
  272. unsigned int mask;
  273. mask = ((1 << pipe->num_inputs) - 1) << 1;
  274. if (!pipe->lif)
  275. mask |= 1 << 0;
  276. return pipe->buffers_ready == mask;
  277. }
  278. void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe)
  279. {
  280. unsigned int flags;
  281. if (pipe == NULL)
  282. return;
  283. /*
  284. * If the DL commit raced with the frame end interrupt, the commit ends
  285. * up being postponed by one frame. The returned flags tell whether the
  286. * active frame was finished or postponed.
  287. */
  288. flags = vsp1_dlm_irq_frame_end(pipe->output->dlm);
  289. if (pipe->hgo)
  290. vsp1_hgo_frame_end(pipe->hgo);
  291. if (pipe->hgt)
  292. vsp1_hgt_frame_end(pipe->hgt);
  293. /*
  294. * Regardless of frame completion we still need to notify the pipe
  295. * frame_end to account for vblank events.
  296. */
  297. if (pipe->frame_end)
  298. pipe->frame_end(pipe, flags);
  299. pipe->sequence++;
  300. }
  301. /*
  302. * Propagate the alpha value through the pipeline.
  303. *
  304. * As the UDS has restricted scaling capabilities when the alpha component needs
  305. * to be scaled, we disable alpha scaling when the UDS input has a fixed alpha
  306. * value. The UDS then outputs a fixed alpha value which needs to be programmed
  307. * from the input RPF alpha.
  308. */
  309. void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
  310. struct vsp1_dl_list *dl, unsigned int alpha)
  311. {
  312. if (!pipe->uds)
  313. return;
  314. /*
  315. * The BRU and BRS background color has a fixed alpha value set to 255,
  316. * the output alpha value is thus always equal to 255.
  317. */
  318. if (pipe->uds_input->type == VSP1_ENTITY_BRU ||
  319. pipe->uds_input->type == VSP1_ENTITY_BRS)
  320. alpha = 255;
  321. vsp1_uds_set_alpha(pipe->uds, dl, alpha);
  322. }
  323. /*
  324. * Propagate the partition calculations through the pipeline
  325. *
  326. * Work backwards through the pipe, allowing each entity to update the partition
  327. * parameters based on its configuration, and the entity connected to its
  328. * source. Each entity must produce the partition required for the previous
  329. * entity in the pipeline.
  330. */
  331. void vsp1_pipeline_propagate_partition(struct vsp1_pipeline *pipe,
  332. struct vsp1_partition *partition,
  333. unsigned int index,
  334. struct vsp1_partition_window *window)
  335. {
  336. struct vsp1_entity *entity;
  337. list_for_each_entry_reverse(entity, &pipe->entities, list_pipe) {
  338. if (entity->ops->partition)
  339. entity->ops->partition(entity, pipe, partition, index,
  340. window);
  341. }
  342. }
  343. void vsp1_pipelines_suspend(struct vsp1_device *vsp1)
  344. {
  345. unsigned long flags;
  346. unsigned int i;
  347. int ret;
  348. /*
  349. * To avoid increasing the system suspend time needlessly, loop over the
  350. * pipelines twice, first to set them all to the stopping state, and
  351. * then to wait for the stop to complete.
  352. */
  353. for (i = 0; i < vsp1->info->wpf_count; ++i) {
  354. struct vsp1_rwpf *wpf = vsp1->wpf[i];
  355. struct vsp1_pipeline *pipe;
  356. if (wpf == NULL)
  357. continue;
  358. pipe = wpf->entity.pipe;
  359. if (pipe == NULL)
  360. continue;
  361. spin_lock_irqsave(&pipe->irqlock, flags);
  362. if (pipe->state == VSP1_PIPELINE_RUNNING)
  363. pipe->state = VSP1_PIPELINE_STOPPING;
  364. spin_unlock_irqrestore(&pipe->irqlock, flags);
  365. }
  366. for (i = 0; i < vsp1->info->wpf_count; ++i) {
  367. struct vsp1_rwpf *wpf = vsp1->wpf[i];
  368. struct vsp1_pipeline *pipe;
  369. if (wpf == NULL)
  370. continue;
  371. pipe = wpf->entity.pipe;
  372. if (pipe == NULL)
  373. continue;
  374. ret = wait_event_timeout(pipe->wq, vsp1_pipeline_stopped(pipe),
  375. msecs_to_jiffies(500));
  376. if (ret == 0)
  377. dev_warn(vsp1->dev, "pipeline %u stop timeout\n",
  378. wpf->entity.index);
  379. }
  380. }
  381. void vsp1_pipelines_resume(struct vsp1_device *vsp1)
  382. {
  383. unsigned long flags;
  384. unsigned int i;
  385. /* Resume all running pipelines. */
  386. for (i = 0; i < vsp1->info->wpf_count; ++i) {
  387. struct vsp1_rwpf *wpf = vsp1->wpf[i];
  388. struct vsp1_pipeline *pipe;
  389. if (wpf == NULL)
  390. continue;
  391. pipe = wpf->entity.pipe;
  392. if (pipe == NULL)
  393. continue;
  394. spin_lock_irqsave(&pipe->irqlock, flags);
  395. if (vsp1_pipeline_ready(pipe))
  396. vsp1_pipeline_run(pipe);
  397. spin_unlock_irqrestore(&pipe->irqlock, flags);
  398. }
  399. }