sde_hw_ds.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2019, 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. #include "sde_hw_blk.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. * get_scaler_ver - get scaler h/w version
  55. * @ctx: Pointer to ds structure
  56. */
  57. u32 (*get_scaler_ver)(struct sde_hw_ds *ctx);
  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 base;
  71. struct sde_hw_blk_reg_map hw;
  72. enum sde_ds idx;
  73. struct sde_ds_cfg *scl;
  74. struct sde_hw_ds_ops ops;
  75. };
  76. /**
  77. * sde_hw_ds_init - initializes the destination scaler
  78. * hw driver object and should be called once before
  79. * accessing every destination scaler
  80. * @idx : DS index for which driver object is required
  81. * @addr: Mapped register io address of MDP
  82. * @m : MDSS catalog information
  83. * @Return: pointer to structure or ERR_PTR
  84. */
  85. struct sde_hw_ds *sde_hw_ds_init(enum sde_ds idx,
  86. void __iomem *addr,
  87. struct sde_mdss_cfg *m);
  88. /**
  89. * sde_hw_ds_destroy - destroys destination scaler
  90. * driver context
  91. * @hw_ds: Pointer to DS context
  92. */
  93. void sde_hw_ds_destroy(struct sde_hw_ds *hw_ds);
  94. #endif /*_SDE_HW_DS_H */