dp_power.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _DP_POWER_H_
  6. #define _DP_POWER_H_
  7. #include "dp_parser.h"
  8. #include "dp_pll.h"
  9. #include "sde_power_handle.h"
  10. /**
  11. * sruct dp_power - DisplayPort's power related data
  12. *
  13. * @init: initializes the regulators/core clocks/GPIOs/pinctrl
  14. * @deinit: turns off the regulators/core clocks/GPIOs/pinctrl
  15. * @clk_enable: enable/disable the DP clocks
  16. * @set_pixel_clk_parent: set the parent of DP pixel clock
  17. * @clk_get_rate: get the current rate for provided clk_name
  18. * @power_client_init: configures clocks and regulators
  19. * @power_client_deinit: frees clock and regulator resources
  20. */
  21. struct dp_power {
  22. struct drm_device *drm_dev;
  23. struct sde_power_handle *phandle;
  24. int (*init)(struct dp_power *power, bool flip);
  25. int (*deinit)(struct dp_power *power);
  26. int (*clk_enable)(struct dp_power *power, enum dp_pm_type pm_type,
  27. bool enable);
  28. int (*set_pixel_clk_parent)(struct dp_power *power, u32 stream_id);
  29. u64 (*clk_get_rate)(struct dp_power *power, char *clk_name);
  30. int (*power_client_init)(struct dp_power *power,
  31. struct sde_power_handle *phandle,
  32. struct drm_device *drm_dev);
  33. void (*power_client_deinit)(struct dp_power *power);
  34. };
  35. /**
  36. * dp_power_get() - configure and get the DisplayPort power module data
  37. *
  38. * @parser: instance of parser module
  39. * @pll: instance of pll module
  40. * return: pointer to allocated power module data
  41. *
  42. * This API will configure the DisplayPort's power module and provides
  43. * methods to be called by the client to configure the power related
  44. * modueles.
  45. */
  46. struct dp_power *dp_power_get(struct dp_parser *parser, struct dp_pll *pll);
  47. /**
  48. * dp_power_put() - release the power related resources
  49. *
  50. * @power: pointer to the power module's data
  51. */
  52. void dp_power_put(struct dp_power *power);
  53. #endif /* _DP_POWER_H_ */