vsp1_rwpf.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * vsp1_rwpf.h -- R-Car VSP1 Read and Write Pixel Formatters
  4. *
  5. * Copyright (C) 2013-2014 Renesas Electronics Corporation
  6. *
  7. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  8. */
  9. #ifndef __VSP1_RWPF_H__
  10. #define __VSP1_RWPF_H__
  11. #include <linux/spinlock.h>
  12. #include <media/media-entity.h>
  13. #include <media/v4l2-ctrls.h>
  14. #include <media/v4l2-subdev.h>
  15. #include "vsp1.h"
  16. #include "vsp1_entity.h"
  17. #define RWPF_PAD_SINK 0
  18. #define RWPF_PAD_SOURCE 1
  19. struct v4l2_ctrl;
  20. struct vsp1_dl_manager;
  21. struct vsp1_rwpf;
  22. struct vsp1_video;
  23. struct vsp1_rwpf_memory {
  24. dma_addr_t addr[3];
  25. };
  26. struct vsp1_rwpf {
  27. struct vsp1_entity entity;
  28. struct v4l2_ctrl_handler ctrls;
  29. struct vsp1_video *video;
  30. unsigned int max_width;
  31. unsigned int max_height;
  32. struct v4l2_pix_format_mplane format;
  33. const struct vsp1_format_info *fmtinfo;
  34. unsigned int brx_input;
  35. unsigned int alpha;
  36. u32 mult_alpha;
  37. u32 outfmt;
  38. struct {
  39. spinlock_t lock;
  40. struct {
  41. struct v4l2_ctrl *vflip;
  42. struct v4l2_ctrl *hflip;
  43. struct v4l2_ctrl *rotate;
  44. } ctrls;
  45. unsigned int pending;
  46. unsigned int active;
  47. bool rotate;
  48. } flip;
  49. struct vsp1_rwpf_memory mem;
  50. struct vsp1_dl_manager *dlm;
  51. };
  52. static inline struct vsp1_rwpf *to_rwpf(struct v4l2_subdev *subdev)
  53. {
  54. return container_of(subdev, struct vsp1_rwpf, entity.subdev);
  55. }
  56. static inline struct vsp1_rwpf *entity_to_rwpf(struct vsp1_entity *entity)
  57. {
  58. return container_of(entity, struct vsp1_rwpf, entity);
  59. }
  60. struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index);
  61. struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index);
  62. int vsp1_rwpf_init_ctrls(struct vsp1_rwpf *rwpf, unsigned int ncontrols);
  63. extern const struct v4l2_subdev_pad_ops vsp1_rwpf_pad_ops;
  64. struct v4l2_rect *vsp1_rwpf_get_crop(struct vsp1_rwpf *rwpf,
  65. struct v4l2_subdev_pad_config *config);
  66. #endif /* __VSP1_RWPF_H__ */