Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nv04_display.h
Go to the documentation of this file.
1 #ifndef __NV04_DISPLAY_H__
2 #define __NV04_DISPLAY_H__
3 
4 #include <subdev/bios/pll.h>
5 
6 #include "nouveau_display.h"
7 
16 };
17 
18 struct nv04_crtc_reg {
19  unsigned char MiscOutReg;
20  uint8_t CRTC[0xa0];
21  uint8_t CR58[0x10];
25  unsigned char DAC[768];
26 
27  /* PCRTC regs */
36 
37  /* PRAMDAC regs */
65 };
66 
69  int head;
70 };
71 
76 };
77 
78 struct nv04_display {
83 };
84 
85 static inline struct nv04_display *
87 {
88  return nouveau_display(dev)->priv;
89 }
90 
91 /* nv04_display.c */
94 int nv04_display_create(struct drm_device *);
95 void nv04_display_destroy(struct drm_device *);
96 int nv04_display_init(struct drm_device *);
97 void nv04_display_fini(struct drm_device *);
98 
99 /* nv04_crtc.c */
100 int nv04_crtc_create(struct drm_device *, int index);
101 
102 /* nv04_dac.c */
103 int nv04_dac_create(struct drm_connector *, struct dcb_output *);
104 uint32_t nv17_dac_sample_load(struct drm_encoder *encoder);
105 int nv04_dac_output_offset(struct drm_encoder *encoder);
106 void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable);
107 bool nv04_dac_in_use(struct drm_encoder *encoder);
108 
109 /* nv04_dfp.c */
110 int nv04_dfp_create(struct drm_connector *, struct dcb_output *);
111 int nv04_dfp_get_bound_head(struct drm_device *dev, struct dcb_output *dcbent);
112 void nv04_dfp_bind_head(struct drm_device *dev, struct dcb_output *dcbent,
113  int head, bool dl);
114 void nv04_dfp_disable(struct drm_device *dev, int head);
115 void nv04_dfp_update_fp_control(struct drm_encoder *encoder, int mode);
116 
117 /* nv04_tv.c */
118 int nv04_tv_identify(struct drm_device *dev, int i2c_index);
119 int nv04_tv_create(struct drm_connector *, struct dcb_output *);
120 
121 /* nv17_tv.c */
122 int nv17_tv_create(struct drm_connector *, struct dcb_output *);
123 
124 static inline bool
125 nv_two_heads(struct drm_device *dev)
126 {
127  struct nouveau_drm *drm = nouveau_drm(dev);
128  const int impl = dev->pci_device & 0x0ff0;
129 
130  if (nv_device(drm->device)->card_type >= NV_10 && impl != 0x0100 &&
131  impl != 0x0150 && impl != 0x01a0 && impl != 0x0200)
132  return true;
133 
134  return false;
135 }
136 
137 static inline bool
138 nv_gf4_disp_arch(struct drm_device *dev)
139 {
140  return nv_two_heads(dev) && (dev->pci_device & 0x0ff0) != 0x0110;
141 }
142 
143 static inline bool
144 nv_two_reg_pll(struct drm_device *dev)
145 {
146  struct nouveau_drm *drm = nouveau_drm(dev);
147  const int impl = dev->pci_device & 0x0ff0;
148 
149  if (impl == 0x0310 || impl == 0x0340 || nv_device(drm->device)->card_type >= NV_40)
150  return true;
151  return false;
152 }
153 
154 static inline bool
155 nv_match_device(struct drm_device *dev, unsigned device,
156  unsigned sub_vendor, unsigned sub_device)
157 {
158  return dev->pdev->device == device &&
159  dev->pdev->subsystem_vendor == sub_vendor &&
160  dev->pdev->subsystem_device == sub_device;
161 }
162 
163 #include <subdev/bios.h>
164 #include <subdev/bios/init.h>
165 
166 static inline void
167 nouveau_bios_run_init_table(struct drm_device *dev, u16 table,
168  struct dcb_output *outp, int crtc)
169 {
170  struct nouveau_device *device = nouveau_dev(dev);
171  struct nouveau_bios *bios = nouveau_bios(device);
172  struct nvbios_init init = {
173  .subdev = nv_subdev(bios),
174  .bios = bios,
175  .offset = table,
176  .outp = outp,
177  .crtc = crtc,
178  .execute = 1,
179  };
180 
181  nvbios_exec(&init);
182 }
183 
184 #endif