mod_power.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Copyright 2016 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: AMD
  23. *
  24. */
  25. #ifndef MODULES_INC_MOD_POWER_H_
  26. #define MODULES_INC_MOD_POWER_H_
  27. #include "dm_services.h"
  28. struct mod_power {
  29. int dummy;
  30. };
  31. /* VariBright related commands */
  32. enum varibright_command {
  33. VariBright_Cmd__SetVBLevel = 0,
  34. VariBright_Cmd__UserEnable,
  35. VariBright_Cmd__PreDisplayConfigChange,
  36. VariBright_Cmd__PostDisplayConfigChange,
  37. VariBright_Cmd__SuspendABM,
  38. VariBright_Cmd__ResumeABM,
  39. VariBright_Cmd__Unknown,
  40. };
  41. /* VariBright settings structure */
  42. struct varibright_info {
  43. enum varibright_command cmd;
  44. unsigned int level;
  45. bool enable;
  46. bool activate;
  47. };
  48. enum dmcu_block_psr_reason {
  49. /* This is a bitfield mask */
  50. dmcu_block_psr_reason_invalid = 0x0,
  51. dmcu_block_psr_reason_vsync_int = 0x1,
  52. dmcu_block_psr_reason_shared_primary = 0x2,
  53. dmcu_block_psr_reason_unsupported_link_rate = 0x4
  54. };
  55. struct mod_power *mod_power_create(struct dc *dc);
  56. void mod_power_destroy(struct mod_power *mod_power);
  57. bool mod_power_add_sink(struct mod_power *mod_power,
  58. const struct dc_sink *sink);
  59. bool mod_power_remove_sink(struct mod_power *mod_power,
  60. const struct dc_sink *sink);
  61. bool mod_power_set_backlight(struct mod_power *mod_power,
  62. const struct dc_stream **streams, int num_streams,
  63. unsigned int backlight_8bit);
  64. bool mod_power_get_backlight(struct mod_power *mod_power,
  65. const struct dc_sink *sink,
  66. unsigned int *backlight_8bit);
  67. void mod_power_initialize_backlight_caps
  68. (struct mod_power *mod_power);
  69. unsigned int mod_power_backlight_level_percentage_to_signal
  70. (struct mod_power *mod_power, unsigned int percentage);
  71. unsigned int mod_power_backlight_level_signal_to_percentage
  72. (struct mod_power *mod_power, unsigned int signalLevel8bit);
  73. bool mod_power_get_panel_backlight_boundaries
  74. (struct mod_power *mod_power,
  75. unsigned int *min_backlight,
  76. unsigned int *max_backlight,
  77. unsigned int *output_ac_level_percentage,
  78. unsigned int *output_dc_level_percentage);
  79. bool mod_power_set_smooth_brightness(struct mod_power *mod_power,
  80. const struct dc_sink *sink, bool enable_brightness);
  81. bool mod_power_notify_mode_change(struct mod_power *mod_power,
  82. const struct dc_stream *stream);
  83. bool mod_power_varibright_control(struct mod_power *mod_power,
  84. struct varibright_info *input_varibright_info);
  85. bool mod_power_block_psr(bool block_enable, enum dmcu_block_psr_reason reason);
  86. bool mod_power_set_psr_enable(struct mod_power *mod_power,
  87. bool psr_enable);
  88. #endif /* MODULES_INC_MOD_POWER_H_ */