1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NV04_DISPLAY_H__
3 #define __NV04_DISPLAY_H__
4 #include <subdev/bios.h>
5 #include <subdev/bios/pll.h>
7 #include "nouveau_display.h"
9 enum nv04_fp_display_regs
{
19 struct nv04_crtc_reg
{
20 unsigned char MiscOutReg
;
25 uint8_t Attribute
[21];
26 unsigned char DAC
[768];
36 uint32_t crtc_eng_ctrl
;
39 uint32_t nv10_cursync
;
40 struct nvkm_pll_vals pllvals
;
41 uint32_t ramdac_gen_ctrl
;
47 uint32_t tv_vsync_delay
;
50 uint32_t tv_hsync_delay
;
51 uint32_t tv_hsync_delay2
;
52 uint32_t fp_horiz_regs
[7];
53 uint32_t fp_vert_regs
[7];
56 uint32_t dither_regs
[6];
60 uint32_t fp_margin_color
;
65 uint32_t ctv_regs
[38];
68 struct nv04_output_reg
{
73 struct nv04_mode_state
{
74 struct nv04_crtc_reg crtc_reg
[2];
80 struct nv04_mode_state mode_reg
;
81 struct nv04_mode_state saved_reg
;
82 uint32_t saved_vga_font
[4][16384];
83 uint32_t dac_users
[4];
84 struct nouveau_bo
*image
[2];
85 struct nvif_notify flip
;
88 static inline struct nv04_display
*
89 nv04_display(struct drm_device
*dev
)
91 return nouveau_display(dev
)->priv
;
95 int nv04_display_create(struct drm_device
*);
98 int nv04_crtc_create(struct drm_device
*, int index
);
101 int nv04_dac_create(struct drm_connector
*, struct dcb_output
*);
102 uint32_t nv17_dac_sample_load(struct drm_encoder
*encoder
);
103 int nv04_dac_output_offset(struct drm_encoder
*encoder
);
104 void nv04_dac_update_dacclk(struct drm_encoder
*encoder
, bool enable
);
105 bool nv04_dac_in_use(struct drm_encoder
*encoder
);
108 int nv04_dfp_create(struct drm_connector
*, struct dcb_output
*);
109 int nv04_dfp_get_bound_head(struct drm_device
*dev
, struct dcb_output
*dcbent
);
110 void nv04_dfp_bind_head(struct drm_device
*dev
, struct dcb_output
*dcbent
,
112 void nv04_dfp_disable(struct drm_device
*dev
, int head
);
113 void nv04_dfp_update_fp_control(struct drm_encoder
*encoder
, int mode
);
116 int nv04_tv_identify(struct drm_device
*dev
, int i2c_index
);
117 int nv04_tv_create(struct drm_connector
*, struct dcb_output
*);
120 int nv17_tv_create(struct drm_connector
*, struct dcb_output
*);
123 void nouveau_overlay_init(struct drm_device
*dev
);
126 nv_two_heads(struct drm_device
*dev
)
128 struct nouveau_drm
*drm
= nouveau_drm(dev
);
129 const int impl
= dev
->pdev
->device
& 0x0ff0;
131 if (drm
->client
.device
.info
.family
>= NV_DEVICE_INFO_V0_CELSIUS
&& impl
!= 0x0100 &&
132 impl
!= 0x0150 && impl
!= 0x01a0 && impl
!= 0x0200)
139 nv_gf4_disp_arch(struct drm_device
*dev
)
141 return nv_two_heads(dev
) && (dev
->pdev
->device
& 0x0ff0) != 0x0110;
145 nv_two_reg_pll(struct drm_device
*dev
)
147 struct nouveau_drm
*drm
= nouveau_drm(dev
);
148 const int impl
= dev
->pdev
->device
& 0x0ff0;
150 if (impl
== 0x0310 || impl
== 0x0340 || drm
->client
.device
.info
.family
>= NV_DEVICE_INFO_V0_CURIE
)
156 nv_match_device(struct drm_device
*dev
, unsigned device
,
157 unsigned sub_vendor
, unsigned sub_device
)
159 return dev
->pdev
->device
== device
&&
160 dev
->pdev
->subsystem_vendor
== sub_vendor
&&
161 dev
->pdev
->subsystem_device
== sub_device
;
164 #include <subdev/bios/init.h>
167 nouveau_bios_run_init_table(struct drm_device
*dev
, u16 table
,
168 struct dcb_output
*outp
, int crtc
)
170 nvbios_init(&nvxx_bios(&nouveau_drm(dev
)->client
.device
)->subdev
, table
,
176 int nv04_flip_complete(struct nvif_notify
*);