aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/emgd/emgd/pal/lvds/lvds.h
blob: 0a8e841521d19315011150664e560491adaf8e4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/* -*- pse-c -*-
 *-----------------------------------------------------------------------------
 * Filename: lvds.h
 * $Revision: 1.4 $
 *-----------------------------------------------------------------------------
 * Copyright © 2002-2010, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *-----------------------------------------------------------------------------
 * Description:
 *  This is header file for Internal LVDS PORT DRIVER.
 *-----------------------------------------------------------------------------
 */

#ifndef _PD_LVDS_H
#define _PD_LVDS_H

#include <pd.h>
#include <pci.h>

/* Values received from DPG hardware engineer. These are for single channel.  */

#ifndef PCI_DEVICE_ID_VGA_855
#define PCI_DEVICE_ID_VGA_855      0x3582
#endif
#ifndef PCI_DEVICE_ID_VGA_915AL
#define PCI_DEVICE_ID_VGA_915AL    0x2592
#endif
#ifndef PCI_DEVICE_ID_VGA_945GM
#define PCI_DEVICE_ID_VGA_945GM    0x27A2
#endif
#ifndef PCI_DEVICE_ID_VGA_945GME
#define PCI_DEVICE_ID_VGA_945GME   0x27AE
#endif
#ifndef PCI_DEVICE_ID_VGA_GM965
#define PCI_DEVICE_ID_VGA_GM965    0x2A02
#endif
#ifndef PCI_DEVICE_ID_VGA_GME965
#define PCI_DEVICE_ID_VGA_GME965   0x2A12
#endif
#ifndef PCI_DEVICE_ID_VGA_CTG
#define PCI_DEVICE_ID_VGA_CTG      0x2A42
#endif
#ifndef PCI_DEVICE_ID_VGA_PLB
#define PCI_DEVICE_ID_VGA_PLB      0x8108
#endif
#ifndef PCI_DEVICE_ID_VGA_TNC
#define PCI_DEVICE_ID_VGA_TNC      0x4108
#endif
#ifndef PCI_DEVICE_ID_VGA_TNC_A0
#define PCI_DEVICE_ID_VGA_TNC_A0   0x4100
#endif
#ifndef PCI_DEVICE_ID_VGA_LNC
#define PCI_DEVICE_ID_VGA_LNC      0x4102
#endif


#define LVDS_MIN_DCLK 12000L    /* in KHz */
#define LVDS_MAX_DCLK 112000L   /* in KHz */
/* definition for 915GM */
#define LVDS_915GM_SINGLE_MIN_DCLK   20000L
#define LVDS_915GM_SINGLE_MAX_DCLK  112000L
#define LVDS_915GM_DUAL_MIN_DCLK     25000L
#define LVDS_915GM_DUAL_MAX_DCLK    224000L

/* definition for 945GM */
#define LVDS_945GM_SINGLE_MIN_DCLK   25000L
#define LVDS_945GM_SINGLE_MAX_DCLK  112000L
#define LVDS_945GM_DUAL_MIN_DCLK     25000L
#define LVDS_945GM_DUAL_MAX_DCLK    224000L

/* definition for GM965 */
#define LVDS_GM965_SINGLE_MIN_DCLK   25000L
#define LVDS_GM965_SINGLE_MAX_DCLK  112000L
#define LVDS_GM965_DUAL_MIN_DCLK     25000L
#define LVDS_GM965_DUAL_MAX_DCLK    224000L

/* definition for Atom E6xx */
#define LVDS_TNC_SINGLE_MIN_DCLK     19750L
#define LVDS_TNC_SINGLE_MAX_DCLK     79500L

#define LVDS_MIN(a, b)       ((a)<(b)?(a):(b))

/* Local attributes
 * BIT15 of attribute Id specifies that it is a local attribute */
#define LVDS_ATTR_ID_DATA_FORMAT   (BIT(15)|1)
#define LVDS_ATTR_ID_TC_LVDS_CLK   (BIT(15)|2)

/* Default values */
#define LVDS_DEF_PANEL_DEPTH    18      /* Default panel depth */
#define LVDS_DEF_DITHER          1      /* default=1 as default panel depth=18*/
#define LVDS_DEF_SCALE_ON        1      /* Default scaling is on */
#define LVDS_DEF_PANEL_FIT       1      /* Default panel fit in on */

typedef struct _lvds_context {
	unsigned short fp_width;
	unsigned short fp_height;
	unsigned short dual_channel;
	unsigned short panel_type;
	unsigned short panel_fit;
	unsigned short panel_depth;
	unsigned short dither;
	unsigned short aspect_ratio;
	unsigned long  text_tune;
	unsigned long  pwm_intensity;
	unsigned long  inverter_freq;
	unsigned long  blm_legacy_mode;

	unsigned long power_state;
	unsigned short chipset;
	unsigned char init_done;
	unsigned char num_attrs;
	unsigned long pipe;
	unsigned short gfx_freq;
	unsigned char gn4_plus;
	unsigned char pwm_done;
	unsigned char tc_110MHz_clk;

	pd_callback_t *callback;
	pd_timing_t   *timing_table;
	pd_attr_t     *attr_list;
	pd_timing_t   *native_dtd;
	pd_timing_t   *current_mode;
} lvds_context_t;

extern int PD_MODULE_INIT(lvds_init, (void *handle));
extern int PD_MODULE_EXIT(lvds_exit, (void));
extern unsigned long lvds_validate(unsigned long cookie);
extern int lvds_open(pd_callback_t *callback, void **context);
extern int lvds_init_device(void *context);
extern int lvds_close(void *context);
extern int lvds_set_mode(void *context, pd_timing_t *mode,
			unsigned long flags);
extern int lvds_post_set_mode(void *context, pd_timing_t *mode,
			unsigned long flags);
extern int lvds_set_attrs(void *context, unsigned long num, pd_attr_t *list);
extern int lvds_get_attrs(void *context, unsigned long*num, pd_attr_t **list);
extern int lvds_get_timing_list(void *context, pd_timing_t *in_list,
			pd_timing_t **list);
extern int lvds_set_power(void *context, unsigned long state);
extern int lvds_get_power(void *context, unsigned long *state);
extern int lvds_save(void *context, void **state, unsigned long flags);
extern int lvds_restore(void *context, void *state, unsigned long flags);
extern int lvds_get_port_status(void *context, pd_port_status_t *port_status);

#endif

/*----------------------------------------------------------------------------
 * File Revision History
 * $Id: lvds.h,v 1.4 2010/09/20 17:26:48 astead Exp $
 * $Source: /nfs/fm/proj/eia/cvsroot/koheo/linux/egd_drm/emgd/pal/lvds/lvds.h,v $
 *----------------------------------------------------------------------------
 */