ispresizer.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * ispresizer.h
  4. *
  5. * TI OMAP3 ISP - Resizer module
  6. *
  7. * Copyright (C) 2010 Nokia Corporation
  8. * Copyright (C) 2009 Texas Instruments, Inc
  9. *
  10. * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
  11. * Sakari Ailus <sakari.ailus@iki.fi>
  12. */
  13. #ifndef OMAP3_ISP_RESIZER_H
  14. #define OMAP3_ISP_RESIZER_H
  15. #include <linux/spinlock.h>
  16. #include <linux/types.h>
  17. /*
  18. * Constants for filter coefficients count
  19. */
  20. #define COEFF_CNT 32
  21. /*
  22. * struct isprsz_coef - Structure for resizer filter coefficients.
  23. * @h_filter_coef_4tap: Horizontal filter coefficients for 8-phase/4-tap
  24. * mode (.5x-4x)
  25. * @v_filter_coef_4tap: Vertical filter coefficients for 8-phase/4-tap
  26. * mode (.5x-4x)
  27. * @h_filter_coef_7tap: Horizontal filter coefficients for 4-phase/7-tap
  28. * mode (.25x-.5x)
  29. * @v_filter_coef_7tap: Vertical filter coefficients for 4-phase/7-tap
  30. * mode (.25x-.5x)
  31. */
  32. struct isprsz_coef {
  33. u16 h_filter_coef_4tap[32];
  34. u16 v_filter_coef_4tap[32];
  35. /* Every 8th value is a dummy value in the following arrays: */
  36. u16 h_filter_coef_7tap[32];
  37. u16 v_filter_coef_7tap[32];
  38. };
  39. /* Chrominance horizontal algorithm */
  40. enum resizer_chroma_algo {
  41. RSZ_THE_SAME = 0, /* Chrominance the same as Luminance */
  42. RSZ_BILINEAR = 1, /* Chrominance uses bilinear interpolation */
  43. };
  44. /* Resizer input type select */
  45. enum resizer_colors_type {
  46. RSZ_YUV422 = 0, /* YUV422 color is interleaved */
  47. RSZ_COLOR8 = 1, /* Color separate data on 8 bits */
  48. };
  49. /*
  50. * Structure for horizontal and vertical resizing value
  51. */
  52. struct resizer_ratio {
  53. u32 horz;
  54. u32 vert;
  55. };
  56. /*
  57. * Structure for luminance enhancer parameters.
  58. */
  59. struct resizer_luma_yenh {
  60. u8 algo; /* algorithm select. */
  61. u8 gain; /* maximum gain. */
  62. u8 slope; /* slope. */
  63. u8 core; /* core offset. */
  64. };
  65. enum resizer_input_entity {
  66. RESIZER_INPUT_NONE,
  67. RESIZER_INPUT_VP, /* input video port - prev or ccdc */
  68. RESIZER_INPUT_MEMORY,
  69. };
  70. /* Sink and source resizer pads */
  71. #define RESZ_PAD_SINK 0
  72. #define RESZ_PAD_SOURCE 1
  73. #define RESZ_PADS_NUM 2
  74. /*
  75. * struct isp_res_device - OMAP3 ISP resizer module
  76. * @lock: Protects formats and crop rectangles between set_selection and IRQ
  77. * @crop.request: Crop rectangle requested by the user
  78. * @crop.active: Active crop rectangle (based on hardware requirements)
  79. */
  80. struct isp_res_device {
  81. struct v4l2_subdev subdev;
  82. struct media_pad pads[RESZ_PADS_NUM];
  83. struct v4l2_mbus_framefmt formats[RESZ_PADS_NUM];
  84. enum resizer_input_entity input;
  85. struct isp_video video_in;
  86. struct isp_video video_out;
  87. u32 addr_base; /* stored source buffer address in memory mode */
  88. u32 crop_offset; /* additional offset for crop in memory mode */
  89. struct resizer_ratio ratio;
  90. int pm_state;
  91. unsigned int applycrop:1;
  92. enum isp_pipeline_stream_state state;
  93. wait_queue_head_t wait;
  94. atomic_t stopping;
  95. spinlock_t lock;
  96. struct {
  97. struct v4l2_rect request;
  98. struct v4l2_rect active;
  99. } crop;
  100. };
  101. struct isp_device;
  102. int omap3isp_resizer_init(struct isp_device *isp);
  103. void omap3isp_resizer_cleanup(struct isp_device *isp);
  104. int omap3isp_resizer_register_entities(struct isp_res_device *res,
  105. struct v4l2_device *vdev);
  106. void omap3isp_resizer_unregister_entities(struct isp_res_device *res);
  107. void omap3isp_resizer_isr_frame_sync(struct isp_res_device *res);
  108. void omap3isp_resizer_isr(struct isp_res_device *isp_res);
  109. void omap3isp_resizer_max_rate(struct isp_res_device *res,
  110. unsigned int *max_rate);
  111. void omap3isp_resizer_suspend(struct isp_res_device *isp_res);
  112. void omap3isp_resizer_resume(struct isp_res_device *isp_res);
  113. int omap3isp_resizer_busy(struct isp_res_device *isp_res);
  114. #endif /* OMAP3_ISP_RESIZER_H */