vsp1_dl.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * vsp1_dl.h -- R-Car VSP1 Display List
  4. *
  5. * Copyright (C) 2015 Renesas Corporation
  6. *
  7. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  8. */
  9. #ifndef __VSP1_DL_H__
  10. #define __VSP1_DL_H__
  11. #include <linux/types.h>
  12. struct vsp1_device;
  13. struct vsp1_dl_body;
  14. struct vsp1_dl_body_pool;
  15. struct vsp1_dl_list;
  16. struct vsp1_dl_manager;
  17. #define VSP1_DL_FRAME_END_COMPLETED BIT(0)
  18. #define VSP1_DL_FRAME_END_INTERNAL BIT(1)
  19. /**
  20. * struct vsp1_dl_ext_cmd - Extended Display command
  21. * @pool: pool to which this command belongs
  22. * @free: entry in the pool of free commands list
  23. * @opcode: command type opcode
  24. * @flags: flags used by the command
  25. * @cmds: array of command bodies for this extended cmd
  26. * @num_cmds: quantity of commands in @cmds array
  27. * @cmd_dma: DMA address of the command body
  28. * @data: memory allocation for command-specific data
  29. * @data_dma: DMA address for command-specific data
  30. */
  31. struct vsp1_dl_ext_cmd {
  32. struct vsp1_dl_cmd_pool *pool;
  33. struct list_head free;
  34. u8 opcode;
  35. u32 flags;
  36. struct vsp1_pre_ext_dl_body *cmds;
  37. unsigned int num_cmds;
  38. dma_addr_t cmd_dma;
  39. void *data;
  40. dma_addr_t data_dma;
  41. };
  42. void vsp1_dlm_setup(struct vsp1_device *vsp1);
  43. struct vsp1_dl_manager *vsp1_dlm_create(struct vsp1_device *vsp1,
  44. unsigned int index,
  45. unsigned int prealloc);
  46. void vsp1_dlm_destroy(struct vsp1_dl_manager *dlm);
  47. void vsp1_dlm_reset(struct vsp1_dl_manager *dlm);
  48. unsigned int vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm);
  49. struct vsp1_dl_body *vsp1_dlm_dl_body_get(struct vsp1_dl_manager *dlm);
  50. struct vsp1_dl_list *vsp1_dl_list_get(struct vsp1_dl_manager *dlm);
  51. void vsp1_dl_list_put(struct vsp1_dl_list *dl);
  52. struct vsp1_dl_body *vsp1_dl_list_get_body0(struct vsp1_dl_list *dl);
  53. struct vsp1_dl_ext_cmd *vsp1_dl_get_pre_cmd(struct vsp1_dl_list *dl);
  54. void vsp1_dl_list_commit(struct vsp1_dl_list *dl, bool internal);
  55. struct vsp1_dl_body_pool *
  56. vsp1_dl_body_pool_create(struct vsp1_device *vsp1, unsigned int num_bodies,
  57. unsigned int num_entries, size_t extra_size);
  58. void vsp1_dl_body_pool_destroy(struct vsp1_dl_body_pool *pool);
  59. struct vsp1_dl_body *vsp1_dl_body_get(struct vsp1_dl_body_pool *pool);
  60. void vsp1_dl_body_put(struct vsp1_dl_body *dlb);
  61. void vsp1_dl_body_write(struct vsp1_dl_body *dlb, u32 reg, u32 data);
  62. int vsp1_dl_list_add_body(struct vsp1_dl_list *dl, struct vsp1_dl_body *dlb);
  63. int vsp1_dl_list_add_chain(struct vsp1_dl_list *head, struct vsp1_dl_list *dl);
  64. #endif /* __VSP1_DL_H__ */