am437x-vpfe.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * Copyright (C) 2013 - 2014 Texas Instruments, Inc.
  4. *
  5. * Benoit Parrot <[email protected]>
  6. * Lad, Prabhakar <[email protected]>
  7. *
  8. * This program is free software; you may redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; version 2 of the License.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  15. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  16. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  17. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  19. * SOFTWARE.
  20. */
  21. #ifndef AM437X_VPFE_USER_H
  22. #define AM437X_VPFE_USER_H
  23. #include <linux/videodev2.h>
  24. enum vpfe_ccdc_data_size {
  25. VPFE_CCDC_DATA_16BITS = 0,
  26. VPFE_CCDC_DATA_15BITS,
  27. VPFE_CCDC_DATA_14BITS,
  28. VPFE_CCDC_DATA_13BITS,
  29. VPFE_CCDC_DATA_12BITS,
  30. VPFE_CCDC_DATA_11BITS,
  31. VPFE_CCDC_DATA_10BITS,
  32. VPFE_CCDC_DATA_8BITS,
  33. };
  34. /* enum for No of pixel per line to be avg. in Black Clamping*/
  35. enum vpfe_ccdc_sample_length {
  36. VPFE_CCDC_SAMPLE_1PIXELS = 0,
  37. VPFE_CCDC_SAMPLE_2PIXELS,
  38. VPFE_CCDC_SAMPLE_4PIXELS,
  39. VPFE_CCDC_SAMPLE_8PIXELS,
  40. VPFE_CCDC_SAMPLE_16PIXELS,
  41. };
  42. /* enum for No of lines in Black Clamping */
  43. enum vpfe_ccdc_sample_line {
  44. VPFE_CCDC_SAMPLE_1LINES = 0,
  45. VPFE_CCDC_SAMPLE_2LINES,
  46. VPFE_CCDC_SAMPLE_4LINES,
  47. VPFE_CCDC_SAMPLE_8LINES,
  48. VPFE_CCDC_SAMPLE_16LINES,
  49. };
  50. /* enum for Alaw gamma width */
  51. enum vpfe_ccdc_gamma_width {
  52. VPFE_CCDC_GAMMA_BITS_15_6 = 0, /* use bits 15-6 for gamma */
  53. VPFE_CCDC_GAMMA_BITS_14_5,
  54. VPFE_CCDC_GAMMA_BITS_13_4,
  55. VPFE_CCDC_GAMMA_BITS_12_3,
  56. VPFE_CCDC_GAMMA_BITS_11_2,
  57. VPFE_CCDC_GAMMA_BITS_10_1,
  58. VPFE_CCDC_GAMMA_BITS_09_0, /* use bits 9-0 for gamma */
  59. };
  60. /* structure for ALaw */
  61. struct vpfe_ccdc_a_law {
  62. /* Enable/disable A-Law */
  63. unsigned char enable;
  64. /* Gamma Width Input */
  65. enum vpfe_ccdc_gamma_width gamma_wd;
  66. };
  67. /* structure for Black Clamping */
  68. struct vpfe_ccdc_black_clamp {
  69. unsigned char enable;
  70. /* only if bClampEnable is TRUE */
  71. enum vpfe_ccdc_sample_length sample_pixel;
  72. /* only if bClampEnable is TRUE */
  73. enum vpfe_ccdc_sample_line sample_ln;
  74. /* only if bClampEnable is TRUE */
  75. unsigned short start_pixel;
  76. /* only if bClampEnable is TRUE */
  77. unsigned short sgain;
  78. /* only if bClampEnable is FALSE */
  79. unsigned short dc_sub;
  80. };
  81. /* structure for Black Level Compensation */
  82. struct vpfe_ccdc_black_compensation {
  83. /* Constant value to subtract from Red component */
  84. char r;
  85. /* Constant value to subtract from Gr component */
  86. char gr;
  87. /* Constant value to subtract from Blue component */
  88. char b;
  89. /* Constant value to subtract from Gb component */
  90. char gb;
  91. };
  92. /* Structure for CCDC configuration parameters for raw capture mode passed
  93. * by application
  94. */
  95. struct vpfe_ccdc_config_params_raw {
  96. /* data size value from 8 to 16 bits */
  97. enum vpfe_ccdc_data_size data_sz;
  98. /* Structure for Optional A-Law */
  99. struct vpfe_ccdc_a_law alaw;
  100. /* Structure for Optical Black Clamp */
  101. struct vpfe_ccdc_black_clamp blk_clamp;
  102. /* Structure for Black Compensation */
  103. struct vpfe_ccdc_black_compensation blk_comp;
  104. };
  105. /*
  106. * Private IOCTL
  107. * VIDIOC_AM437X_CCDC_CFG - Set CCDC configuration for raw capture
  108. * This is an experimental ioctl that will change in future kernels. So use
  109. * this ioctl with care !
  110. **/
  111. #define VIDIOC_AM437X_CCDC_CFG \
  112. _IOW('V', BASE_VIDIOC_PRIVATE + 1, void *)
  113. #endif /* AM437X_VPFE_USER_H */