sde_hw_dsc.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2019, 2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _SDE_HW_DSC_H
  6. #define _SDE_HW_DSC_H
  7. #include "sde_hw_catalog.h"
  8. #include "sde_hw_mdss.h"
  9. #include "sde_hw_util.h"
  10. struct sde_hw_dsc;
  11. struct msm_display_dsc_info;
  12. #define DSC_MODE_SPLIT_PANEL BIT(0)
  13. #define DSC_MODE_MULTIPLEX BIT(1)
  14. #define DSC_MODE_VIDEO BIT(2)
  15. /**
  16. * struct sde_hw_dsc_ops - interface to the dsc hardware driver functions
  17. * Assumption is these functions will be called after clocks are enabled
  18. */
  19. struct sde_hw_dsc_ops {
  20. /**
  21. * dsc_disable - disable dsc
  22. * @hw_dsc: Pointer to dsc context
  23. */
  24. void (*dsc_disable)(struct sde_hw_dsc *hw_dsc);
  25. /**
  26. * dsc_config - configures dsc encoder
  27. * @hw_dsc: Pointer to dsc context
  28. * @dsc: panel dsc parameters
  29. * @mode: dsc topology mode to be set
  30. * @ich_reset_override: option to reset ich
  31. */
  32. void (*dsc_config)(struct sde_hw_dsc *hw_dsc,
  33. struct msm_display_dsc_info *dsc,
  34. u32 mode, bool ich_reset_override);
  35. /**
  36. * dsc_config_thresh - programs panel thresholds
  37. * @hw_dsc: Pointer to dsc context
  38. * @dsc: panel dsc parameters
  39. */
  40. void (*dsc_config_thresh)(struct sde_hw_dsc *hw_dsc,
  41. struct msm_display_dsc_info *dsc);
  42. /**
  43. * bind_pingpong_blk - enable/disable the connection with pp
  44. * @hw_dsc: Pointer to dsc context
  45. * @enable: enable/disable connection
  46. * @pp: pingpong blk id
  47. */
  48. void (*bind_pingpong_blk)(struct sde_hw_dsc *hw_dsc,
  49. bool enable,
  50. const enum sde_pingpong pp);
  51. };
  52. struct sde_hw_dsc {
  53. struct sde_hw_blk_reg_map hw;
  54. /* dsc */
  55. enum sde_dsc idx;
  56. const struct sde_dsc_cfg *caps;
  57. /* ops */
  58. struct sde_hw_dsc_ops ops;
  59. };
  60. /**
  61. * to_sde_hw_dsc - convert base hw object to sde_hw_dsc container
  62. * @hw: Pointer to hardware block register map object
  63. * return: Pointer to hardware block container
  64. */
  65. static inline struct sde_hw_dsc *to_sde_hw_dsc(struct sde_hw_blk_reg_map *hw)
  66. {
  67. return container_of(hw, struct sde_hw_dsc, hw);
  68. }
  69. /**
  70. * sde_hw_dsc_init - initializes the dsc block for the passed
  71. * dsc idx.
  72. * @idx: DSC index for which driver object is required
  73. * @addr: Mapped register io address of MDP
  74. * @m: Pointer to mdss catalog data
  75. * Returns: Error code or allocated sde_hw_dsc context
  76. */
  77. struct sde_hw_blk_reg_map *sde_hw_dsc_init(enum sde_dsc idx,
  78. void __iomem *addr,
  79. struct sde_mdss_cfg *m);
  80. /**
  81. * sde_hw_dsc_destroy - destroys dsc driver context
  82. * should be called to free the context
  83. * @hw: Pointer to hardware block register map object
  84. */
  85. void sde_hw_dsc_destroy(struct sde_hw_blk_reg_map *hw);
  86. #endif /*_SDE_HW_DSC_H */