vpif_display.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * VPIF display header file
  3. *
  4. * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation version 2.
  9. *
  10. * This program is distributed .as is. WITHOUT ANY WARRANTY of any
  11. * kind, whether express or implied; without even the implied warranty
  12. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #ifndef VPIF_DISPLAY_H
  16. #define VPIF_DISPLAY_H
  17. /* Header files */
  18. #include <media/videobuf2-dma-contig.h>
  19. #include <media/v4l2-device.h>
  20. #include "vpif.h"
  21. /* Macros */
  22. #define VPIF_DISPLAY_VERSION "0.0.2"
  23. #define VPIF_VALID_FIELD(field) \
  24. (((V4L2_FIELD_ANY == field) || (V4L2_FIELD_NONE == field)) || \
  25. (((V4L2_FIELD_INTERLACED == field) || (V4L2_FIELD_SEQ_TB == field)) || \
  26. (V4L2_FIELD_SEQ_BT == field)))
  27. #define VPIF_DISPLAY_MAX_DEVICES (2)
  28. #define VPIF_SLICED_BUF_SIZE (256)
  29. #define VPIF_SLICED_MAX_SERVICES (3)
  30. #define VPIF_VIDEO_INDEX (0)
  31. #define VPIF_VBI_INDEX (1)
  32. #define VPIF_HBI_INDEX (2)
  33. /* Setting it to 1 as HBI/VBI support yet to be added , else 3*/
  34. #define VPIF_NUMOBJECTS (1)
  35. /* Macros */
  36. #define ISALIGNED(a) (0 == ((a) & 7))
  37. /* enumerated data types */
  38. /* Enumerated data type to give id to each device per channel */
  39. enum vpif_channel_id {
  40. VPIF_CHANNEL2_VIDEO = 0, /* Channel2 Video */
  41. VPIF_CHANNEL3_VIDEO, /* Channel3 Video */
  42. };
  43. /* structures */
  44. struct video_obj {
  45. enum v4l2_field buf_field;
  46. u32 latest_only; /* indicate whether to return
  47. * most recent displayed frame only */
  48. v4l2_std_id stdid; /* Currently selected or default
  49. * standard */
  50. struct v4l2_dv_timings dv_timings;
  51. };
  52. struct vpif_disp_buffer {
  53. struct vb2_v4l2_buffer vb;
  54. struct list_head list;
  55. };
  56. struct common_obj {
  57. struct vpif_disp_buffer *cur_frm; /* Pointer pointing to current
  58. * vb2_buffer */
  59. struct vpif_disp_buffer *next_frm; /* Pointer pointing to next
  60. * vb2_buffer */
  61. struct v4l2_format fmt; /* Used to store the format */
  62. struct vb2_queue buffer_queue; /* Buffer queue used in
  63. * video-buf */
  64. struct list_head dma_queue; /* Queue of filled frames */
  65. spinlock_t irqlock; /* Used in video-buf */
  66. /* channel specific parameters */
  67. struct mutex lock; /* lock used to access this
  68. * structure */
  69. u32 ytop_off; /* offset of Y top from the
  70. * starting of the buffer */
  71. u32 ybtm_off; /* offset of Y bottom from the
  72. * starting of the buffer */
  73. u32 ctop_off; /* offset of C top from the
  74. * starting of the buffer */
  75. u32 cbtm_off; /* offset of C bottom from the
  76. * starting of the buffer */
  77. /* Function pointer to set the addresses */
  78. void (*set_addr)(unsigned long, unsigned long,
  79. unsigned long, unsigned long);
  80. u32 height;
  81. u32 width;
  82. };
  83. struct channel_obj {
  84. /* V4l2 specific parameters */
  85. struct video_device video_dev; /* Identifies video device for
  86. * this channel */
  87. u32 field_id; /* Indicates id of the field
  88. * which is being displayed */
  89. u8 initialized; /* flag to indicate whether
  90. * encoder is initialized */
  91. u32 output_idx; /* Current output index */
  92. struct v4l2_subdev *sd; /* Current output subdev(may be NULL) */
  93. enum vpif_channel_id channel_id;/* Identifies channel */
  94. struct vpif_params vpifparams;
  95. struct common_obj common[VPIF_NUMOBJECTS];
  96. struct video_obj video;
  97. };
  98. /* vpif device structure */
  99. struct vpif_device {
  100. struct v4l2_device v4l2_dev;
  101. struct channel_obj *dev[VPIF_DISPLAY_NUM_CHANNELS];
  102. struct v4l2_subdev **sd;
  103. struct v4l2_async_notifier notifier;
  104. struct vpif_display_config *config;
  105. };
  106. #endif /* VPIF_DISPLAY_H */