/*1* Copyright © 2006 Eric Anholt2*3* Permission to use, copy, modify, distribute, and sell this software and its4* documentation for any purpose is hereby granted without fee, provided that5* the above copyright notice appear in all copies and that both that copyright6* notice and this permission notice appear in supporting documentation, and7* that the name of the copyright holders not be used in advertising or8* publicity pertaining to distribution of the software without specific,9* written prior permission. The copyright holders make no representations10* about the suitability of this software for any purpose. It is provided "as11* is" without express or implied warranty.12*13* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,14* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO15* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR16* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,17* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER18* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE19* OF THIS SOFTWARE.20*/2122#ifndef _INTEL_DVO_H23#define _INTEL_DVO_H2425#include <linux/i2c.h>26#include "drmP.h"27#include "drm.h"28#include "drm_crtc.h"29#include "intel_drv.h"3031struct intel_dvo_device {32const char *name;33int type;34/* DVOA/B/C output register */35u32 dvo_reg;36/* GPIO register used for i2c bus to control this device */37u32 gpio;38int slave_addr;3940const struct intel_dvo_dev_ops *dev_ops;41void *dev_priv;42struct i2c_adapter *i2c_bus;43};4445struct intel_dvo_dev_ops {46/*47* Initialize the device at startup time.48* Returns NULL if the device does not exist.49*/50bool (*init)(struct intel_dvo_device *dvo,51struct i2c_adapter *i2cbus);5253/*54* Called to allow the output a chance to create properties after the55* RandR objects have been created.56*/57void (*create_resources)(struct intel_dvo_device *dvo);5859/*60* Turn on/off output or set intermediate power levels if available.61*62* Unsupported intermediate modes drop to the lower power setting.63* If the mode is DPMSModeOff, the output must be disabled,64* as the DPLL may be disabled afterwards.65*/66void (*dpms)(struct intel_dvo_device *dvo, int mode);6768/*69* Callback for testing a video mode for a given output.70*71* This function should only check for cases where a mode can't72* be supported on the output specifically, and not represent73* generic CRTC limitations.74*75* \return MODE_OK if the mode is valid, or another MODE_* otherwise.76*/77int (*mode_valid)(struct intel_dvo_device *dvo,78struct drm_display_mode *mode);7980/*81* Callback to adjust the mode to be set in the CRTC.82*83* This allows an output to adjust the clock or even the entire set of84* timings, which is used for panels with fixed timings or for85* buses with clock limitations.86*/87bool (*mode_fixup)(struct intel_dvo_device *dvo,88struct drm_display_mode *mode,89struct drm_display_mode *adjusted_mode);9091/*92* Callback for preparing mode changes on an output93*/94void (*prepare)(struct intel_dvo_device *dvo);9596/*97* Callback for committing mode changes on an output98*/99void (*commit)(struct intel_dvo_device *dvo);100101/*102* Callback for setting up a video mode after fixups have been made.103*104* This is only called while the output is disabled. The dpms callback105* must be all that's necessary for the output, to turn the output on106* after this function is called.107*/108void (*mode_set)(struct intel_dvo_device *dvo,109struct drm_display_mode *mode,110struct drm_display_mode *adjusted_mode);111112/*113* Probe for a connected output, and return detect_status.114*/115enum drm_connector_status (*detect)(struct intel_dvo_device *dvo);116117/**118* Query the device for the modes it provides.119*120* This function may also update MonInfo, mm_width, and mm_height.121*122* \return singly-linked list of modes or NULL if no modes found.123*/124struct drm_display_mode *(*get_modes)(struct intel_dvo_device *dvo);125126/**127* Clean up driver-specific bits of the output128*/129void (*destroy) (struct intel_dvo_device *dvo);130131/**132* Debugging hook to dump device registers to log file133*/134void (*dump_regs)(struct intel_dvo_device *dvo);135};136137extern struct intel_dvo_dev_ops sil164_ops;138extern struct intel_dvo_dev_ops ch7xxx_ops;139extern struct intel_dvo_dev_ops ivch_ops;140extern struct intel_dvo_dev_ops tfp410_ops;141extern struct intel_dvo_dev_ops ch7017_ops;142143#endif /* _INTEL_DVO_H */144145146