vsp1_entity.h 2.5 KB

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