ispresizer.h 3.8 KB

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