sde_hw_vdc.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. * @is_video_mode: current panel mode is video
  28. */
  29. void (*vdc_config)(struct sde_hw_vdc *hw_vdc,
  30. struct msm_display_vdc_info *vdc, bool is_video_mode);
  31. /**
  32. * bind_pingpong_blk - enable/disable the connection with pp
  33. * @hw_vdc: Pointer to vdc context
  34. * @enable: enable/disable connection
  35. * @pp: pingpong blk id
  36. */
  37. void (*bind_pingpong_blk)(struct sde_hw_vdc *hw_vdc,
  38. bool enable,
  39. const enum sde_pingpong pp);
  40. };
  41. struct sde_hw_vdc {
  42. struct sde_hw_blk base;
  43. struct sde_hw_blk_reg_map hw;
  44. /* vdc */
  45. enum sde_vdc idx;
  46. const struct sde_vdc_cfg *caps;
  47. /* ops */
  48. struct sde_hw_vdc_ops ops;
  49. };
  50. /**
  51. * sde_hw_vdc - convert base object sde_hw_base to container
  52. * @hw: Pointer to base hardware block
  53. * return: Pointer to hardware block container
  54. */
  55. static inline struct sde_hw_vdc *to_sde_hw_vdc(struct sde_hw_blk *hw)
  56. {
  57. return container_of(hw, struct sde_hw_vdc, base);
  58. }
  59. /**
  60. * sde_hw_vdc_init - initializes the vdc block for the passed
  61. * vdc idx.
  62. * @idx: VDC index for which driver object is required
  63. * @addr: Mapped register io address of MDP
  64. * @m: Pointer to mdss catalog data
  65. * Returns: Error code or allocated sde_hw_vdc context
  66. */
  67. struct sde_hw_vdc *sde_hw_vdc_init(enum sde_vdc idx,
  68. void __iomem *addr,
  69. struct sde_mdss_cfg *m);
  70. /**
  71. * sde_hw_vdc_destroy - destroys vdc driver context
  72. * should be called to free the context
  73. * @vdc: Pointer to vdc driver context returned by sde_hw_vdc_init
  74. */
  75. void sde_hw_vdc_destroy(struct sde_hw_vdc *vdc);
  76. #endif /*_SDE_HW_VDC_H */