vsp1_entity.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * vsp1_entity.h -- R-Car VSP1 Base Entity
  3. *
  4. * Copyright (C) 2013-2014 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. #ifndef __VSP1_ENTITY_H__
  14. #define __VSP1_ENTITY_H__
  15. #include <linux/list.h>
  16. #include <linux/spinlock.h>
  17. #include <media/v4l2-subdev.h>
  18. struct vsp1_device;
  19. struct vsp1_video;
  20. enum vsp1_entity_type {
  21. VSP1_ENTITY_BRU,
  22. VSP1_ENTITY_HSI,
  23. VSP1_ENTITY_HST,
  24. VSP1_ENTITY_LIF,
  25. VSP1_ENTITY_LUT,
  26. VSP1_ENTITY_RPF,
  27. VSP1_ENTITY_SRU,
  28. VSP1_ENTITY_UDS,
  29. VSP1_ENTITY_WPF,
  30. };
  31. /*
  32. * struct vsp1_route - Entity routing configuration
  33. * @type: Entity type this routing entry is associated with
  34. * @index: Entity index this routing entry is associated with
  35. * @reg: Output routing configuration register
  36. * @inputs: Target node value for each input
  37. *
  38. * Each $vsp1_route entry describes routing configuration for the entity
  39. * specified by the entry's @type and @index. @reg indicates the register that
  40. * holds output routing configuration for the entity, and the @inputs array
  41. * store the target node value for each input of the entity.
  42. */
  43. struct vsp1_route {
  44. enum vsp1_entity_type type;
  45. unsigned int index;
  46. unsigned int reg;
  47. unsigned int inputs[4];
  48. };
  49. struct vsp1_entity {
  50. struct vsp1_device *vsp1;
  51. enum vsp1_entity_type type;
  52. unsigned int index;
  53. const struct vsp1_route *route;
  54. struct list_head list_dev;
  55. struct list_head list_pipe;
  56. struct media_pad *pads;
  57. unsigned int source_pad;
  58. struct media_entity *sink;
  59. unsigned int sink_pad;
  60. struct v4l2_subdev subdev;
  61. struct v4l2_mbus_framefmt *formats;
  62. struct vsp1_video *video;
  63. spinlock_t lock; /* Protects the streaming field */
  64. bool streaming;
  65. };
  66. static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev)
  67. {
  68. return container_of(subdev, struct vsp1_entity, subdev);
  69. }
  70. int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
  71. unsigned int num_pads);
  72. void vsp1_entity_destroy(struct vsp1_entity *entity);
  73. extern const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops;
  74. extern const struct media_entity_operations vsp1_media_ops;
  75. struct v4l2_mbus_framefmt *
  76. vsp1_entity_get_pad_format(struct vsp1_entity *entity,
  77. struct v4l2_subdev_pad_config *cfg,
  78. unsigned int pad, u32 which);
  79. void vsp1_entity_init_formats(struct v4l2_subdev *subdev,
  80. struct v4l2_subdev_pad_config *cfg);
  81. bool vsp1_entity_is_streaming(struct vsp1_entity *entity);
  82. int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming);
  83. #endif /* __VSP1_ENTITY_H__ */