ispresizer.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * ispresizer.h
  3. *
  4. * TI OMAP3 ISP - Resizer module
  5. *
  6. * Copyright (C) 2010 Nokia Corporation
  7. * Copyright (C) 2009 Texas Instruments, Inc
  8. *
  9. * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
  10. * Sakari Ailus <sakari.ailus@iki.fi>
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  24. * 02110-1301 USA
  25. */
  26. #ifndef OMAP3_ISP_RESIZER_H
  27. #define OMAP3_ISP_RESIZER_H
  28. #include <linux/types.h>
  29. /*
  30. * Constants for filter coefficents count
  31. */
  32. #define COEFF_CNT 32
  33. /*
  34. * struct isprsz_coef - Structure for resizer filter coeffcients.
  35. * @h_filter_coef_4tap: Horizontal filter coefficients for 8-phase/4-tap
  36. * mode (.5x-4x)
  37. * @v_filter_coef_4tap: Vertical filter coefficients for 8-phase/4-tap
  38. * mode (.5x-4x)
  39. * @h_filter_coef_7tap: Horizontal filter coefficients for 4-phase/7-tap
  40. * mode (.25x-.5x)
  41. * @v_filter_coef_7tap: Vertical filter coefficients for 4-phase/7-tap
  42. * mode (.25x-.5x)
  43. */
  44. struct isprsz_coef {
  45. u16 h_filter_coef_4tap[32];
  46. u16 v_filter_coef_4tap[32];
  47. /* Every 8th value is a dummy value in the following arrays: */
  48. u16 h_filter_coef_7tap[32];
  49. u16 v_filter_coef_7tap[32];
  50. };
  51. /* Chrominance horizontal algorithm */
  52. enum resizer_chroma_algo {
  53. RSZ_THE_SAME = 0, /* Chrominance the same as Luminance */
  54. RSZ_BILINEAR = 1, /* Chrominance uses bilinear interpolation */
  55. };
  56. /* Resizer input type select */
  57. enum resizer_colors_type {
  58. RSZ_YUV422 = 0, /* YUV422 color is interleaved */
  59. RSZ_COLOR8 = 1, /* Color separate data on 8 bits */
  60. };
  61. /*
  62. * Structure for horizontal and vertical resizing value
  63. */
  64. struct resizer_ratio {
  65. u32 horz;
  66. u32 vert;
  67. };
  68. /*
  69. * Structure for luminance enhancer parameters.
  70. */
  71. struct resizer_luma_yenh {
  72. u8 algo; /* algorithm select. */
  73. u8 gain; /* maximum gain. */
  74. u8 slope; /* slope. */
  75. u8 core; /* core offset. */
  76. };
  77. enum resizer_input_entity {
  78. RESIZER_INPUT_NONE,
  79. RESIZER_INPUT_VP, /* input video port - prev or ccdc */
  80. RESIZER_INPUT_MEMORY,
  81. };
  82. /* Sink and source resizer pads */
  83. #define RESZ_PAD_SINK 0
  84. #define RESZ_PAD_SOURCE 1
  85. #define RESZ_PADS_NUM 2
  86. /*
  87. * struct isp_res_device - OMAP3 ISP resizer module
  88. * @crop.request: Crop rectangle requested by the user
  89. * @crop.active: Active crop rectangle (based on hardware requirements)
  90. */
  91. struct isp_res_device {
  92. struct v4l2_subdev subdev;
  93. struct media_pad pads[RESZ_PADS_NUM];
  94. struct v4l2_mbus_framefmt formats[RESZ_PADS_NUM];
  95. enum resizer_input_entity input;
  96. struct isp_video video_in;
  97. struct isp_video video_out;
  98. u32 addr_base; /* stored source buffer address in memory mode */
  99. u32 crop_offset; /* additional offset for crop in memory mode */
  100. struct resizer_ratio ratio;
  101. int pm_state;
  102. unsigned int applycrop:1;
  103. enum isp_pipeline_stream_state state;
  104. wait_queue_head_t wait;
  105. atomic_t stopping;
  106. struct {
  107. struct v4l2_rect request;
  108. struct v4l2_rect active;
  109. } crop;
  110. };
  111. struct isp_device;
  112. int omap3isp_resizer_init(struct isp_device *isp);
  113. void omap3isp_resizer_cleanup(struct isp_device *isp);
  114. int omap3isp_resizer_register_entities(struct isp_res_device *res,
  115. struct v4l2_device *vdev);
  116. void omap3isp_resizer_unregister_entities(struct isp_res_device *res);
  117. void omap3isp_resizer_isr_frame_sync(struct isp_res_device *res);
  118. void omap3isp_resizer_isr(struct isp_res_device *isp_res);
  119. void omap3isp_resizer_max_rate(struct isp_res_device *res,
  120. unsigned int *max_rate);
  121. void omap3isp_resizer_suspend(struct isp_res_device *isp_res);
  122. void omap3isp_resizer_resume(struct isp_res_device *isp_res);
  123. int omap3isp_resizer_busy(struct isp_res_device *isp_res);
  124. #endif /* OMAP3_ISP_RESIZER_H */