sde_hw_ds.h 2.9 KB

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