video.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ACPI_VIDEO_H
  3. #define __ACPI_VIDEO_H
  4. #include <linux/errno.h> /* for ENODEV */
  5. #include <linux/types.h> /* for bool */
  6. struct acpi_video_brightness_flags {
  7. u8 _BCL_no_ac_battery_levels:1; /* no AC/Battery levels in _BCL */
  8. u8 _BCL_reversed:1; /* _BCL package is in a reversed order */
  9. u8 _BQC_use_index:1; /* _BQC returns an index value */
  10. };
  11. struct acpi_video_device_brightness {
  12. int curr;
  13. int count;
  14. int *levels;
  15. struct acpi_video_brightness_flags flags;
  16. };
  17. struct acpi_device;
  18. #define ACPI_VIDEO_CLASS "video"
  19. #define ACPI_VIDEO_DISPLAY_CRT 1
  20. #define ACPI_VIDEO_DISPLAY_TV 2
  21. #define ACPI_VIDEO_DISPLAY_DVI 3
  22. #define ACPI_VIDEO_DISPLAY_LCD 4
  23. #define ACPI_VIDEO_DISPLAY_LEGACY_MONITOR 0x0100
  24. #define ACPI_VIDEO_DISPLAY_LEGACY_PANEL 0x0110
  25. #define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200
  26. #define ACPI_VIDEO_NOTIFY_SWITCH 0x80
  27. #define ACPI_VIDEO_NOTIFY_PROBE 0x81
  28. #define ACPI_VIDEO_NOTIFY_CYCLE 0x82
  29. #define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83
  30. #define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84
  31. #define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x85
  32. #define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86
  33. #define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87
  34. #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88
  35. #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89
  36. enum acpi_backlight_type {
  37. acpi_backlight_undef = -1,
  38. acpi_backlight_none = 0,
  39. acpi_backlight_video,
  40. acpi_backlight_vendor,
  41. acpi_backlight_native,
  42. };
  43. #if IS_ENABLED(CONFIG_ACPI_VIDEO)
  44. extern int acpi_video_register(void);
  45. extern void acpi_video_unregister(void);
  46. extern int acpi_video_get_edid(struct acpi_device *device, int type,
  47. int device_id, void **edid);
  48. extern enum acpi_backlight_type acpi_video_get_backlight_type(void);
  49. extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type);
  50. /*
  51. * Note: The value returned by acpi_video_handles_brightness_key_presses()
  52. * may change over time and should not be cached.
  53. */
  54. extern bool acpi_video_handles_brightness_key_presses(void);
  55. extern int acpi_video_get_levels(struct acpi_device *device,
  56. struct acpi_video_device_brightness **dev_br,
  57. int *pmax_level);
  58. #else
  59. static inline int acpi_video_register(void) { return -ENODEV; }
  60. static inline void acpi_video_unregister(void) { return; }
  61. static inline int acpi_video_get_edid(struct acpi_device *device, int type,
  62. int device_id, void **edid)
  63. {
  64. return -ENODEV;
  65. }
  66. static inline enum acpi_backlight_type acpi_video_get_backlight_type(void)
  67. {
  68. return acpi_backlight_vendor;
  69. }
  70. static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type)
  71. {
  72. }
  73. static inline bool acpi_video_handles_brightness_key_presses(void)
  74. {
  75. return false;
  76. }
  77. static inline int acpi_video_get_levels(struct acpi_device *device,
  78. struct acpi_video_device_brightness **dev_br,
  79. int *pmax_level)
  80. {
  81. return -ENODEV;
  82. }
  83. #endif
  84. #endif