dvo.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * Copyright © 2006 Eric Anholt
  3. *
  4. * Permission to use, copy, modify, distribute, and sell this software and its
  5. * documentation for any purpose is hereby granted without fee, provided that
  6. * the above copyright notice appear in all copies and that both that copyright
  7. * notice and this permission notice appear in supporting documentation, and
  8. * that the name of the copyright holders not be used in advertising or
  9. * publicity pertaining to distribution of the software without specific,
  10. * written prior permission. The copyright holders make no representations
  11. * about the suitability of this software for any purpose. It is provided "as
  12. * is" without express or implied warranty.
  13. *
  14. * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15. * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  16. * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17. * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18. * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  19. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  20. * OF THIS SOFTWARE.
  21. */
  22. #ifndef _INTEL_DVO_H
  23. #define _INTEL_DVO_H
  24. #include <linux/i2c.h>
  25. #include "drmP.h"
  26. #include "drm.h"
  27. #include "drm_crtc.h"
  28. #include "intel_drv.h"
  29. struct intel_dvo_device {
  30. char *name;
  31. int type;
  32. /* DVOA/B/C output register */
  33. u32 dvo_reg;
  34. /* GPIO register used for i2c bus to control this device */
  35. u32 gpio;
  36. int slave_addr;
  37. struct intel_i2c_chan *i2c_bus;
  38. const struct intel_dvo_dev_ops *dev_ops;
  39. void *dev_priv;
  40. struct drm_display_mode *panel_fixed_mode;
  41. bool panel_wants_dither;
  42. };
  43. struct intel_dvo_dev_ops {
  44. /*
  45. * Initialize the device at startup time.
  46. * Returns NULL if the device does not exist.
  47. */
  48. bool (*init)(struct intel_dvo_device *dvo,
  49. struct intel_i2c_chan *i2cbus);
  50. /*
  51. * Called to allow the output a chance to create properties after the
  52. * RandR objects have been created.
  53. */
  54. void (*create_resources)(struct intel_dvo_device *dvo);
  55. /*
  56. * Turn on/off output or set intermediate power levels if available.
  57. *
  58. * Unsupported intermediate modes drop to the lower power setting.
  59. * If the mode is DPMSModeOff, the output must be disabled,
  60. * as the DPLL may be disabled afterwards.
  61. */
  62. void (*dpms)(struct intel_dvo_device *dvo, int mode);
  63. /*
  64. * Saves the output's state for restoration on VT switch.
  65. */
  66. void (*save)(struct intel_dvo_device *dvo);
  67. /*
  68. * Restore's the output's state at VT switch.
  69. */
  70. void (*restore)(struct intel_dvo_device *dvo);
  71. /*
  72. * Callback for testing a video mode for a given output.
  73. *
  74. * This function should only check for cases where a mode can't
  75. * be supported on the output specifically, and not represent
  76. * generic CRTC limitations.
  77. *
  78. * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
  79. */
  80. int (*mode_valid)(struct intel_dvo_device *dvo,
  81. struct drm_display_mode *mode);
  82. /*
  83. * Callback to adjust the mode to be set in the CRTC.
  84. *
  85. * This allows an output to adjust the clock or even the entire set of
  86. * timings, which is used for panels with fixed timings or for
  87. * buses with clock limitations.
  88. */
  89. bool (*mode_fixup)(struct intel_dvo_device *dvo,
  90. struct drm_display_mode *mode,
  91. struct drm_display_mode *adjusted_mode);
  92. /*
  93. * Callback for preparing mode changes on an output
  94. */
  95. void (*prepare)(struct intel_dvo_device *dvo);
  96. /*
  97. * Callback for committing mode changes on an output
  98. */
  99. void (*commit)(struct intel_dvo_device *dvo);
  100. /*
  101. * Callback for setting up a video mode after fixups have been made.
  102. *
  103. * This is only called while the output is disabled. The dpms callback
  104. * must be all that's necessary for the output, to turn the output on
  105. * after this function is called.
  106. */
  107. void (*mode_set)(struct intel_dvo_device *dvo,
  108. struct drm_display_mode *mode,
  109. struct drm_display_mode *adjusted_mode);
  110. /*
  111. * Probe for a connected output, and return detect_status.
  112. */
  113. enum drm_connector_status (*detect)(struct intel_dvo_device *dvo);
  114. /**
  115. * Query the device for the modes it provides.
  116. *
  117. * This function may also update MonInfo, mm_width, and mm_height.
  118. *
  119. * \return singly-linked list of modes or NULL if no modes found.
  120. */
  121. struct drm_display_mode *(*get_modes)(struct intel_dvo_device *dvo);
  122. /**
  123. * Clean up driver-specific bits of the output
  124. */
  125. void (*destroy) (struct intel_dvo_device *dvo);
  126. /**
  127. * Debugging hook to dump device registers to log file
  128. */
  129. void (*dump_regs)(struct intel_dvo_device *dvo);
  130. };
  131. extern struct intel_dvo_dev_ops sil164_ops;
  132. extern struct intel_dvo_dev_ops ch7xxx_ops;
  133. extern struct intel_dvo_dev_ops ivch_ops;
  134. extern struct intel_dvo_dev_ops tfp410_ops;
  135. extern struct intel_dvo_dev_ops ch7017_ops;
  136. #endif /* _INTEL_DVO_H */