Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright © 2006 Eric Anholt
0003  *
0004  * Permission to use, copy, modify, distribute, and sell this software and its
0005  * documentation for any purpose is hereby granted without fee, provided that
0006  * the above copyright notice appear in all copies and that both that copyright
0007  * notice and this permission notice appear in supporting documentation, and
0008  * that the name of the copyright holders not be used in advertising or
0009  * publicity pertaining to distribution of the software without specific,
0010  * written prior permission.  The copyright holders make no representations
0011  * about the suitability of this software for any purpose.  It is provided "as
0012  * is" without express or implied warranty.
0013  *
0014  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
0015  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
0016  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
0017  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
0018  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
0019  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
0020  * OF THIS SOFTWARE.
0021  */
0022 
0023 #ifndef __INTEL_DVO_DEV_H__
0024 #define __INTEL_DVO_DEV_H__
0025 
0026 #include <linux/i2c.h>
0027 
0028 #include <drm/drm_crtc.h>
0029 
0030 #include "i915_reg_defs.h"
0031 
0032 struct intel_dvo_device {
0033     const char *name;
0034     int type;
0035     /* DVOA/B/C output register */
0036     i915_reg_t dvo_reg;
0037     i915_reg_t dvo_srcdim_reg;
0038     /* GPIO register used for i2c bus to control this device */
0039     u32 gpio;
0040     int slave_addr;
0041 
0042     const struct intel_dvo_dev_ops *dev_ops;
0043     void *dev_priv;
0044     struct i2c_adapter *i2c_bus;
0045 };
0046 
0047 struct intel_dvo_dev_ops {
0048     /*
0049      * Initialize the device at startup time.
0050      * Returns NULL if the device does not exist.
0051      */
0052     bool (*init)(struct intel_dvo_device *dvo,
0053              struct i2c_adapter *i2cbus);
0054 
0055     /*
0056      * Called to allow the output a chance to create properties after the
0057      * RandR objects have been created.
0058      */
0059     void (*create_resources)(struct intel_dvo_device *dvo);
0060 
0061     /*
0062      * Turn on/off output.
0063      *
0064      * Because none of our dvo drivers support an intermediate power levels,
0065      * we don't expose this in the interfac.
0066      */
0067     void (*dpms)(struct intel_dvo_device *dvo, bool enable);
0068 
0069     /*
0070      * Callback for testing a video mode for a given output.
0071      *
0072      * This function should only check for cases where a mode can't
0073      * be supported on the output specifically, and not represent
0074      * generic CRTC limitations.
0075      *
0076      * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
0077      */
0078     int (*mode_valid)(struct intel_dvo_device *dvo,
0079               struct drm_display_mode *mode);
0080 
0081     /*
0082      * Callback for preparing mode changes on an output
0083      */
0084     void (*prepare)(struct intel_dvo_device *dvo);
0085 
0086     /*
0087      * Callback for committing mode changes on an output
0088      */
0089     void (*commit)(struct intel_dvo_device *dvo);
0090 
0091     /*
0092      * Callback for setting up a video mode after fixups have been made.
0093      *
0094      * This is only called while the output is disabled.  The dpms callback
0095      * must be all that's necessary for the output, to turn the output on
0096      * after this function is called.
0097      */
0098     void (*mode_set)(struct intel_dvo_device *dvo,
0099              const struct drm_display_mode *mode,
0100              const struct drm_display_mode *adjusted_mode);
0101 
0102     /*
0103      * Probe for a connected output, and return detect_status.
0104      */
0105     enum drm_connector_status (*detect)(struct intel_dvo_device *dvo);
0106 
0107     /*
0108      * Probe the current hw status, returning true if the connected output
0109      * is active.
0110      */
0111     bool (*get_hw_state)(struct intel_dvo_device *dev);
0112 
0113     /**
0114      * Query the device for the modes it provides.
0115      *
0116      * This function may also update MonInfo, mm_width, and mm_height.
0117      *
0118      * \return singly-linked list of modes or NULL if no modes found.
0119      */
0120     struct drm_display_mode *(*get_modes)(struct intel_dvo_device *dvo);
0121 
0122     /**
0123      * Clean up driver-specific bits of the output
0124      */
0125     void (*destroy) (struct intel_dvo_device *dvo);
0126 
0127     /**
0128      * Debugging hook to dump device registers to log file
0129      */
0130     void (*dump_regs)(struct intel_dvo_device *dvo);
0131 };
0132 
0133 extern const struct intel_dvo_dev_ops sil164_ops;
0134 extern const struct intel_dvo_dev_ops ch7xxx_ops;
0135 extern const struct intel_dvo_dev_ops ivch_ops;
0136 extern const struct intel_dvo_dev_ops tfp410_ops;
0137 extern const struct intel_dvo_dev_ops ch7017_ops;
0138 extern const struct intel_dvo_dev_ops ns2501_ops;
0139 
0140 #endif /* __INTEL_DVO_DEV_H__ */