sde_hw_ds.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
  4. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  5. */
  6. #ifndef _SDE_HW_DS_H
  7. #define _SDE_HW_DS_H
  8. #include "sde_hw_mdss.h"
  9. #include "sde_hw_util.h"
  10. #include "sde_hw_catalog.h"
  11. struct sde_hw_ds;
  12. /* Destination Scaler DUAL mode overfetch pixel count */
  13. #define SDE_DS_OVERFETCH_SIZE 5
  14. /* Destination scaler DUAL mode operation bit */
  15. #define SDE_DS_OP_MODE_DUAL BIT(16)
  16. /* struct sde_hw_ds_cfg - destination scaler config
  17. * @idx : DS selection index
  18. * @flags : Flag to switch between mode for DS
  19. * @lm_width : Layer mixer width configuration
  20. * @lm_heigh : Layer mixer height configuration
  21. * @scl3_cfg : Configuration data for scaler
  22. */
  23. struct sde_hw_ds_cfg {
  24. u32 idx;
  25. int flags;
  26. u32 lm_width;
  27. u32 lm_height;
  28. struct sde_hw_scaler3_cfg scl3_cfg;
  29. };
  30. /**
  31. * struct sde_hw_ds_ops - interface to the destination scaler
  32. * hardware driver functions
  33. * Caller must call the init function to get the ds context for each ds
  34. * Assumption is these functions will be called after clocks are enabled
  35. */
  36. struct sde_hw_ds_ops {
  37. /**
  38. * setup_opmode - destination scaler op mode setup
  39. * @hw_ds : Pointer to ds context
  40. * @op_mode : Op mode configuration
  41. */
  42. void (*setup_opmode)(struct sde_hw_ds *hw_ds,
  43. u32 op_mode);
  44. /**
  45. * setup_scaler - destination scaler block setup
  46. * @hw_ds : Pointer to ds context
  47. * @scaler_cfg : Pointer to scaler data
  48. * @scaler_lut_cfg : Pointer to scaler lut
  49. */
  50. void (*setup_scaler)(struct sde_hw_ds *hw_ds,
  51. void *scaler_cfg,
  52. void *scaler_lut_cfg);
  53. /**
  54. * disable_dest_scl - disable destination scaler hw block
  55. * @hw_ds : Pointer to ds context
  56. */
  57. void (*disable_dest_scl)(struct sde_hw_ds *hw_ds);
  58. };
  59. /**
  60. * struct sde_hw_ds - destination scaler description
  61. * @base : Hardware block base structure
  62. * @hw : Block hardware details
  63. * @idx : Destination scaler index
  64. * @scl : Pointer to
  65. * - scaler offset relative to top offset
  66. * - capabilities
  67. * @ops : Pointer to operations for this DS
  68. */
  69. struct sde_hw_ds {
  70. struct sde_hw_blk_reg_map hw;
  71. enum sde_ds idx;
  72. struct sde_ds_cfg *scl;
  73. struct sde_hw_ds_ops ops;
  74. };
  75. /**
  76. * to_sde_hw_ds - convert base hw object to sde_hw_ds container
  77. * @hw: Pointer to hardware block register map object
  78. * return: Pointer to hardware block container
  79. */
  80. static inline struct sde_hw_ds *to_sde_hw_ds(struct sde_hw_blk_reg_map *hw)
  81. {
  82. return container_of(hw, struct sde_hw_ds, hw);
  83. }
  84. /**
  85. * sde_hw_ds_init - initializes the destination scaler
  86. * hw driver object and should be called once before
  87. * accessing every destination scaler
  88. * @idx : DS index for which driver object is required
  89. * @addr: Mapped register io address of MDP
  90. * @m : MDSS catalog information
  91. * @Return: pointer to structure or ERR_PTR
  92. */
  93. struct sde_hw_blk_reg_map *sde_hw_ds_init(enum sde_ds idx,
  94. void __iomem *addr,
  95. struct sde_mdss_cfg *m);
  96. /**
  97. * sde_hw_ds_destroy - destroys destination scaler driver context
  98. * @hw: Pointer to hardware block register map object
  99. */
  100. void sde_hw_ds_destroy(struct sde_hw_blk_reg_map *hw);
  101. #endif /*_SDE_HW_DS_H */