dw200_subdev.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /****************************************************************************
  2. *
  3. * The MIT License (MIT)
  4. *
  5. * Copyright (c) 2020 VeriSilicon Holdings Co., Ltd.
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a
  8. * copy of this software and associated documentation files (the "Software"),
  9. * to deal in the Software without restriction, including without limitation
  10. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  11. * and/or sell copies of the Software, and to permit persons to whom the
  12. * Software is furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in
  15. * all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  22. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  23. * DEALINGS IN THE SOFTWARE.
  24. *
  25. *****************************************************************************
  26. *
  27. * The GPL License (GPL)
  28. *
  29. * Copyright (c) 2020 VeriSilicon Holdings Co., Ltd.
  30. *
  31. * This program is free software; you can redistribute it and/or
  32. * modify it under the terms of the GNU General Public License
  33. * as published by the Free Software Foundation; either version 2
  34. * of the License, or (at your option) any later version.
  35. *
  36. * This program is distributed in the hope that it will be useful,
  37. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  39. * GNU General Public License for more details.
  40. *
  41. * You should have received a copy of the GNU General Public License
  42. * along with this program;
  43. *
  44. *****************************************************************************
  45. *
  46. * Note: This software is released under dual MIT and GPL licenses. A
  47. * recipient may use this file under the terms of either the MIT license or
  48. * GPL License. If you wish to use only one license not the other, you can
  49. * indicate your decision by deleting one of the above license notices in your
  50. * version of this file.
  51. *
  52. *****************************************************************************/
  53. #ifndef _DW200_DEV_H
  54. #define _DW200_DEV_H
  55. #include <vvdefs.h>
  56. #include "vivdw200_irq_queue.h"
  57. #ifndef __KERNEL__
  58. #include <stdlib.h>
  59. #include <stdio.h>
  60. #define copy_from_user(a, b, c) dw200_copy_data(a, b, c)
  61. #define copy_to_user(a, b, c) dw200_copy_data(a, b, c)
  62. typedef void(*pReadBar) (uint32_t bar, uint32_t *data);
  63. typedef void(*pWriteBar) (uint32_t bar, uint32_t data);
  64. extern void dwe_set_func(pReadBar read_func, pWriteBar write_func);
  65. //extern void dw200_set_func(cmDW200* pDW200,pDw200ReadBar read_func, pDw200WriteBar write_func);
  66. typedef bool(*pVseReadBar) (uint32_t bar, uint32_t * data);
  67. typedef bool(*pVseWriteBar) (uint32_t bar, uint32_t data);
  68. extern void vse_set_func(pVseReadBar read_func, pVseWriteBar write_func);
  69. extern long dw200_copy_data(void *dst, void *src, int size);
  70. #endif
  71. typedef enum dw200_input_id {
  72. DW200_INPUT_DWE = 0,
  73. DW200_INPUT_VSE,
  74. DW200_INPUT_MAX
  75. } dw200_input_id;
  76. typedef enum dw200_output_id {
  77. DW200_OUTPUT_DWE = 0,
  78. DW200_OUTPUT_VSE0,
  79. DW200_OUTPUT_VSE1,
  80. DW200_OUTPUT_VSE2,
  81. DW200_OUTPUT_MAX
  82. } dw200_output_id;
  83. struct dwe_hw_info {
  84. u32 split_line;
  85. u32 scale_factor;
  86. u32 in_format;
  87. u32 out_format;
  88. u32 in_yuvbit;
  89. u32 out_yuvbit;
  90. u32 hand_shake;
  91. u32 roi_x, roi_y;
  92. u32 boundary_y, boundary_u, boundary_v;
  93. u32 map_w, map_h;
  94. u32 src_auto_shadow, dst_auto_shadow;
  95. u32 src_w, src_stride, src_h;
  96. u32 dst_w, dst_stride, dst_h, dst_size_uv;
  97. u32 split_h, split_v1, split_v2;
  98. };
  99. struct vse_crop_size {
  100. u32 left;
  101. u32 right;
  102. u32 top;
  103. u32 bottom;
  104. };
  105. struct vse_size {
  106. u32 width;
  107. u32 height;
  108. };
  109. struct vse_format_conv_settings {
  110. u32 in_format;
  111. u32 out_format;
  112. };
  113. struct vse_mi_settings {
  114. bool enable;
  115. u32 out_format;
  116. u32 width;
  117. u32 height;
  118. u32 yuvbit;
  119. };
  120. struct vse_params {
  121. u32 src_w;
  122. u32 src_h;
  123. u32 in_format;
  124. u32 in_yuvbit;
  125. u32 input_select;
  126. struct vse_crop_size crop_size[3];
  127. struct vse_size out_size[3];
  128. struct vse_format_conv_settings format_conv[3];
  129. bool resize_enable[3];
  130. struct vse_mi_settings mi_settings[3];
  131. };
  132. struct dw200_subdev {
  133. struct dwe_hw_info dwe_info;
  134. struct vse_params vse_info;
  135. void __iomem *dwe_base;
  136. void __iomem *dwe_reset;
  137. void __iomem *vse_base;
  138. void __iomem *vse_reset;
  139. vivdw200_mis_list_t dwe_circle_list;
  140. vivdw200_mis_list_t vse_circle_list;
  141. struct mutex *vvmutex;
  142. };
  143. void dwe_write_reg(struct dw200_subdev *dev, u32 offset, u32 val);
  144. u32 dwe_read_reg(struct dw200_subdev *dev, u32 offset);
  145. void vse_write_reg(struct dw200_subdev *dev, u32 offset, u32 val);
  146. u32 vse_read_reg(struct dw200_subdev *dev, u32 offset);
  147. #endif // _DW200_DEV_H