sde_hw_vdc.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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_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. #include "sde_hw_blk.h"
  11. struct sde_hw_vdc;
  12. struct msm_display_vdc_info;
  13. /**
  14. * struct sde_hw_vdc_ops - interface to the vdc hardware driver functions
  15. * Assumption is these functions will be called after clocks are enabled
  16. */
  17. struct sde_hw_vdc_ops {
  18. /**
  19. * vdc_disable - disable vdc
  20. * @hw_vdc: Pointer to vdc context
  21. */
  22. void (*vdc_disable)(struct sde_hw_vdc *hw_vdc);
  23. /**
  24. * vdc_config - configures vdc encoder
  25. * @hw_vdc: Pointer to vdc context
  26. * @vdc: panel vdc parameters
  27. */
  28. void (*vdc_config)(struct sde_hw_vdc *hw_vdc,
  29. struct msm_display_vdc_info *vdc);
  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 base;
  42. struct sde_hw_blk_reg_map hw;
  43. /* vdc */
  44. enum sde_vdc idx;
  45. const struct sde_vdc_cfg *caps;
  46. /* ops */
  47. struct sde_hw_vdc_ops ops;
  48. };
  49. /**
  50. * sde_hw_vdc - convert base object sde_hw_base to container
  51. * @hw: Pointer to base hardware block
  52. * return: Pointer to hardware block container
  53. */
  54. static inline struct sde_hw_vdc *to_sde_hw_vdc(struct sde_hw_blk *hw)
  55. {
  56. return container_of(hw, struct sde_hw_vdc, base);
  57. }
  58. /**
  59. * sde_hw_vdc_init - initializes the vdc block for the passed
  60. * vdc idx.
  61. * @idx: VDC index for which driver object is required
  62. * @addr: Mapped register io address of MDP
  63. * @m: Pointer to mdss catalog data
  64. * Returns: Error code or allocated sde_hw_vdc context
  65. */
  66. struct sde_hw_vdc *sde_hw_vdc_init(enum sde_vdc idx,
  67. void __iomem *addr,
  68. struct sde_mdss_cfg *m);
  69. /**
  70. * sde_hw_vdc_destroy - destroys vdc driver context
  71. * should be called to free the context
  72. * @vdc: Pointer to vdc driver context returned by sde_hw_vdc_init
  73. */
  74. void sde_hw_vdc_destroy(struct sde_hw_vdc *vdc);
  75. #endif /*_SDE_HW_VDC_H */