dvo.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 <drm/drmP.h>
  26. #include <drm/drm_crtc.h>
  27. #include "intel_drv.h"
  28. struct intel_dvo_device {
  29. const char *name;
  30. int type;
  31. /* DVOA/B/C output register */
  32. u32 dvo_reg;
  33. /* GPIO register used for i2c bus to control this device */
  34. u32 gpio;
  35. int slave_addr;
  36. const struct intel_dvo_dev_ops *dev_ops;
  37. void *dev_priv;
  38. struct i2c_adapter *i2c_bus;
  39. };
  40. struct intel_dvo_dev_ops {
  41. /*
  42. * Initialize the device at startup time.
  43. * Returns NULL if the device does not exist.
  44. */
  45. bool (*init)(struct intel_dvo_device *dvo,
  46. struct i2c_adapter *i2cbus);
  47. /*
  48. * Called to allow the output a chance to create properties after the
  49. * RandR objects have been created.
  50. */
  51. void (*create_resources)(struct intel_dvo_device *dvo);
  52. /*
  53. * Turn on/off output.
  54. *
  55. * Because none of our dvo drivers support an intermediate power levels,
  56. * we don't expose this in the interfac.
  57. */
  58. void (*dpms)(struct intel_dvo_device *dvo, bool enable);
  59. /*
  60. * Callback for testing a video mode for a given output.
  61. *
  62. * This function should only check for cases where a mode can't
  63. * be supported on the output specifically, and not represent
  64. * generic CRTC limitations.
  65. *
  66. * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
  67. */
  68. int (*mode_valid)(struct intel_dvo_device *dvo,
  69. struct drm_display_mode *mode);
  70. /*
  71. * Callback for preparing mode changes on an output
  72. */
  73. void (*prepare)(struct intel_dvo_device *dvo);
  74. /*
  75. * Callback for committing mode changes on an output
  76. */
  77. void (*commit)(struct intel_dvo_device *dvo);
  78. /*
  79. * Callback for setting up a video mode after fixups have been made.
  80. *
  81. * This is only called while the output is disabled. The dpms callback
  82. * must be all that's necessary for the output, to turn the output on
  83. * after this function is called.
  84. */
  85. void (*mode_set)(struct intel_dvo_device *dvo,
  86. const struct drm_display_mode *mode,
  87. const struct drm_display_mode *adjusted_mode);
  88. /*
  89. * Probe for a connected output, and return detect_status.
  90. */
  91. enum drm_connector_status (*detect)(struct intel_dvo_device *dvo);
  92. /*
  93. * Probe the current hw status, returning true if the connected output
  94. * is active.
  95. */
  96. bool (*get_hw_state)(struct intel_dvo_device *dev);
  97. /**
  98. * Query the device for the modes it provides.
  99. *
  100. * This function may also update MonInfo, mm_width, and mm_height.
  101. *
  102. * \return singly-linked list of modes or NULL if no modes found.
  103. */
  104. struct drm_display_mode *(*get_modes)(struct intel_dvo_device *dvo);
  105. /**
  106. * Clean up driver-specific bits of the output
  107. */
  108. void (*destroy) (struct intel_dvo_device *dvo);
  109. /**
  110. * Debugging hook to dump device registers to log file
  111. */
  112. void (*dump_regs)(struct intel_dvo_device *dvo);
  113. };
  114. extern struct intel_dvo_dev_ops sil164_ops;
  115. extern struct intel_dvo_dev_ops ch7xxx_ops;
  116. extern struct intel_dvo_dev_ops ivch_ops;
  117. extern struct intel_dvo_dev_ops tfp410_ops;
  118. extern struct intel_dvo_dev_ops ch7017_ops;
  119. extern struct intel_dvo_dev_ops ns2501_ops;
  120. #endif /* _INTEL_DVO_H */