Linux Audio

Check our new training course

In-person Linux kernel drivers training

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