sde_hw_vdc.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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_VDC_H
  6. #define _SDE_HW_VDC_H
  7. #include "sde_hw_catalog.h"
  8. #include "sde_hw_mdss.h"
  9. #include "sde_hw_util.h"
  10. struct sde_hw_vdc;
  11. struct msm_display_vdc_info;
  12. /**
  13. * struct sde_hw_vdc_ops - interface to the vdc hardware driver functions
  14. * Assumption is these functions will be called after clocks are enabled
  15. */
  16. struct sde_hw_vdc_ops {
  17. /**
  18. * vdc_disable - disable vdc
  19. * @hw_vdc: Pointer to vdc context
  20. */
  21. void (*vdc_disable)(struct sde_hw_vdc *hw_vdc);
  22. /**
  23. * vdc_config - configures vdc encoder
  24. * @hw_vdc: Pointer to vdc context
  25. * @vdc: panel vdc parameters
  26. * @is_video_mode: current panel mode is video
  27. */
  28. void (*vdc_config)(struct sde_hw_vdc *hw_vdc,
  29. struct msm_display_vdc_info *vdc, bool is_video_mode);
  30. /**
  31. * bind_pingpong_blk - enable/disable the connection with pp
  32. * @hw_vdc: Pointer to vdc context
  33. * @enable: enable/disable connection
  34. * @pp: pingpong blk id
  35. */
  36. void (*bind_pingpong_blk)(struct sde_hw_vdc *hw_vdc,
  37. bool enable,
  38. const enum sde_pingpong pp);
  39. };
  40. struct sde_hw_vdc {
  41. struct sde_hw_blk_reg_map hw;
  42. /* vdc */
  43. enum sde_vdc idx;
  44. const struct sde_vdc_cfg *caps;
  45. /* ops */
  46. struct sde_hw_vdc_ops ops;
  47. };
  48. /**
  49. * to_sde_hw_vdc - convert base hw object to sde_hw_vdc container
  50. * @hw: Pointer to hardware block register map object
  51. * return: Pointer to hardware block container
  52. */
  53. static inline struct sde_hw_vdc *to_sde_hw_vdc(struct sde_hw_blk_reg_map *hw)
  54. {
  55. return container_of(hw, struct sde_hw_vdc, hw);
  56. }
  57. /**
  58. * sde_hw_vdc_init - initializes the vdc block for the passed
  59. * vdc idx.
  60. * @idx: VDC index for which driver object is required
  61. * @addr: Mapped register io address of MDP
  62. * @m: Pointer to mdss catalog data
  63. * Returns: Error code or allocated sde_hw_vdc context
  64. */
  65. struct sde_hw_blk_reg_map *sde_hw_vdc_init(enum sde_vdc idx,
  66. void __iomem *addr,
  67. struct sde_mdss_cfg *m);
  68. /**
  69. * sde_hw_vdc_destroy - destroys vdc driver context
  70. * should be called to free the context
  71. * @hw: Pointer to hardware block register map object
  72. */
  73. void sde_hw_vdc_destroy(struct sde_hw_blk_reg_map *hw);
  74. #endif /*_SDE_HW_VDC_H */