sde_hw_dsc.h 2.7 KB

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