dp_power.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved.
  4. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
  5. */
  6. #ifndef _DP_POWER_H_
  7. #define _DP_POWER_H_
  8. #include "dp_parser.h"
  9. #include "dp_pll.h"
  10. #include "sde_power_handle.h"
  11. /**
  12. * sruct dp_power - DisplayPort's power related data
  13. *
  14. * @dp_phy_gdsc: GDSC regulator
  15. * @init: initializes the regulators/core clocks/GPIOs/pinctrl
  16. * @deinit: turns off the regulators/core clocks/GPIOs/pinctrl
  17. * @clk_enable: enable/disable the DP clocks
  18. * @clk_status: check for clock status
  19. * @set_pixel_clk_parent: set the parent of DP pixel clock
  20. * @park_clocks: park all clocks driven by PLL
  21. * @clk_get_rate: get the current rate for provided clk_name
  22. * @power_client_init: configures clocks and regulators
  23. * @power_client_deinit: frees clock and regulator resources
  24. * @power_mmrm_init: configures mmrm client registration
  25. */
  26. struct dp_power {
  27. struct drm_device *drm_dev;
  28. struct sde_power_handle *phandle;
  29. struct regulator *dp_phy_gdsc;
  30. int (*init)(struct dp_power *power, bool flip);
  31. int (*deinit)(struct dp_power *power);
  32. int (*clk_enable)(struct dp_power *power, enum dp_pm_type pm_type,
  33. bool enable);
  34. bool (*clk_status)(struct dp_power *power, enum dp_pm_type pm_type);
  35. int (*set_pixel_clk_parent)(struct dp_power *power, u32 stream_id);
  36. int (*park_clocks)(struct dp_power *power);
  37. u64 (*clk_get_rate)(struct dp_power *power, char *clk_name);
  38. int (*power_client_init)(struct dp_power *power,
  39. struct sde_power_handle *phandle,
  40. struct drm_device *drm_dev);
  41. void (*power_client_deinit)(struct dp_power *power);
  42. int (*power_mmrm_init)(struct dp_power *power,
  43. struct sde_power_handle *phandle, void *dp,
  44. int (*dp_display_mmrm_callback)(struct mmrm_client_notifier_data *notifier_data));
  45. };
  46. /**
  47. * dp_power_get() - configure and get the DisplayPort power module data
  48. *
  49. * @parser: instance of parser module
  50. * @pll: instance of pll module
  51. * return: pointer to allocated power module data
  52. *
  53. * This API will configure the DisplayPort's power module and provides
  54. * methods to be called by the client to configure the power related
  55. * modueles.
  56. */
  57. struct dp_power *dp_power_get(struct dp_parser *parser, struct dp_pll *pll);
  58. /**
  59. * dp_power_put() - release the power related resources
  60. *
  61. * @power: pointer to the power module's data
  62. */
  63. void dp_power_put(struct dp_power *power);
  64. #if defined(CONFIG_SECDP)
  65. enum dp_hpd_plug_orientation secdp_get_plug_orientation(struct dp_power *dp_power);
  66. int secdp_power_request_gpios(struct dp_power *dp_power);
  67. void secdp_power_set_gpio(struct dp_power *dp_power, bool flip);
  68. void secdp_power_unset_gpio(struct dp_power *dp_power);
  69. #if defined(CONFIG_SECDP_FACTORY_DPSWITCH_TEST)
  70. void secdp_config_gpios_factory(struct dp_power *dp_power, int aux_sel, bool out_en);
  71. #endif
  72. void secdp_redriver_onoff(struct dp_power *dp_power, bool enable, int lane);
  73. void secdp_redriver_linkinfo(struct dp_power *dp_power, u32 rate, u8 v_level, u8 p_level);
  74. #endif/*CONFIG_SECDP*/
  75. #endif /* _DP_POWER_H_ */