dpu_hw_intf.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef _DPU_HW_INTF_H
  13. #define _DPU_HW_INTF_H
  14. #include "dpu_hw_catalog.h"
  15. #include "dpu_hw_mdss.h"
  16. #include "dpu_hw_util.h"
  17. #include "dpu_hw_blk.h"
  18. struct dpu_hw_intf;
  19. /* intf timing settings */
  20. struct intf_timing_params {
  21. u32 width; /* active width */
  22. u32 height; /* active height */
  23. u32 xres; /* Display panel width */
  24. u32 yres; /* Display panel height */
  25. u32 h_back_porch;
  26. u32 h_front_porch;
  27. u32 v_back_porch;
  28. u32 v_front_porch;
  29. u32 hsync_pulse_width;
  30. u32 vsync_pulse_width;
  31. u32 hsync_polarity;
  32. u32 vsync_polarity;
  33. u32 border_clr;
  34. u32 underflow_clr;
  35. u32 hsync_skew;
  36. };
  37. struct intf_prog_fetch {
  38. u8 enable;
  39. /* vsync counter for the front porch pixel line */
  40. u32 fetch_start;
  41. };
  42. struct intf_status {
  43. u8 is_en; /* interface timing engine is enabled or not */
  44. u32 frame_count; /* frame count since timing engine enabled */
  45. u32 line_count; /* current line count including blanking */
  46. };
  47. /**
  48. * struct dpu_hw_intf_ops : Interface to the interface Hw driver functions
  49. * Assumption is these functions will be called after clocks are enabled
  50. * @ setup_timing_gen : programs the timing engine
  51. * @ setup_prog_fetch : enables/disables the programmable fetch logic
  52. * @ enable_timing: enable/disable timing engine
  53. * @ get_status: returns if timing engine is enabled or not
  54. * @ get_line_count: reads current vertical line counter
  55. */
  56. struct dpu_hw_intf_ops {
  57. void (*setup_timing_gen)(struct dpu_hw_intf *intf,
  58. const struct intf_timing_params *p,
  59. const struct dpu_format *fmt);
  60. void (*setup_prg_fetch)(struct dpu_hw_intf *intf,
  61. const struct intf_prog_fetch *fetch);
  62. void (*enable_timing)(struct dpu_hw_intf *intf,
  63. u8 enable);
  64. void (*get_status)(struct dpu_hw_intf *intf,
  65. struct intf_status *status);
  66. u32 (*get_line_count)(struct dpu_hw_intf *intf);
  67. };
  68. struct dpu_hw_intf {
  69. struct dpu_hw_blk base;
  70. struct dpu_hw_blk_reg_map hw;
  71. /* intf */
  72. enum dpu_intf idx;
  73. const struct dpu_intf_cfg *cap;
  74. const struct dpu_mdss_cfg *mdss;
  75. /* ops */
  76. struct dpu_hw_intf_ops ops;
  77. };
  78. /**
  79. * to_dpu_hw_intf - convert base object dpu_hw_base to container
  80. * @hw: Pointer to base hardware block
  81. * return: Pointer to hardware block container
  82. */
  83. static inline struct dpu_hw_intf *to_dpu_hw_intf(struct dpu_hw_blk *hw)
  84. {
  85. return container_of(hw, struct dpu_hw_intf, base);
  86. }
  87. /**
  88. * dpu_hw_intf_init(): Initializes the intf driver for the passed
  89. * interface idx.
  90. * @idx: interface index for which driver object is required
  91. * @addr: mapped register io address of MDP
  92. * @m : pointer to mdss catalog data
  93. */
  94. struct dpu_hw_intf *dpu_hw_intf_init(enum dpu_intf idx,
  95. void __iomem *addr,
  96. struct dpu_mdss_cfg *m);
  97. /**
  98. * dpu_hw_intf_destroy(): Destroys INTF driver context
  99. * @intf: Pointer to INTF driver context
  100. */
  101. void dpu_hw_intf_destroy(struct dpu_hw_intf *intf);
  102. #endif /*_DPU_HW_INTF_H */