sde_hw_ds.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2020, 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. /**
  55. * struct sde_hw_ds - destination scaler description
  56. * @base : Hardware block base structure
  57. * @hw : Block hardware details
  58. * @idx : Destination scaler index
  59. * @scl : Pointer to
  60. * - scaler offset relative to top offset
  61. * - capabilities
  62. * @ops : Pointer to operations for this DS
  63. */
  64. struct sde_hw_ds {
  65. struct sde_hw_blk base;
  66. struct sde_hw_blk_reg_map hw;
  67. enum sde_ds idx;
  68. struct sde_ds_cfg *scl;
  69. struct sde_hw_ds_ops ops;
  70. };
  71. /**
  72. * sde_hw_ds_init - initializes the destination scaler
  73. * hw driver object and should be called once before
  74. * accessing every destination scaler
  75. * @idx : DS index for which driver object is required
  76. * @addr: Mapped register io address of MDP
  77. * @m : MDSS catalog information
  78. * @Return: pointer to structure or ERR_PTR
  79. */
  80. struct sde_hw_ds *sde_hw_ds_init(enum sde_ds idx,
  81. void __iomem *addr,
  82. struct sde_mdss_cfg *m);
  83. /**
  84. * sde_hw_ds_destroy - destroys destination scaler
  85. * driver context
  86. * @hw_ds: Pointer to DS context
  87. */
  88. void sde_hw_ds_destroy(struct sde_hw_ds *hw_ds);
  89. #endif /*_SDE_HW_DS_H */