162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef __MATROXFB_DAC1064_H__
362306a36Sopenharmony_ci#define __MATROXFB_DAC1064_H__
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#include "matroxfb_base.h"
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifdef CONFIG_FB_MATROX_MYSTIQUE
962306a36Sopenharmony_ciextern struct matrox_switch matrox_mystique;
1062306a36Sopenharmony_ci#endif
1162306a36Sopenharmony_ci#ifdef CONFIG_FB_MATROX_G
1262306a36Sopenharmony_ciextern struct matrox_switch matrox_G100;
1362306a36Sopenharmony_ci#endif
1462306a36Sopenharmony_ci#ifdef NEED_DAC1064
1562306a36Sopenharmony_civoid DAC1064_global_init(struct matrox_fb_info *minfo);
1662306a36Sopenharmony_civoid DAC1064_global_restore(struct matrox_fb_info *minfo);
1762306a36Sopenharmony_ci#endif
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define M1064_INDEX	0x00
2062306a36Sopenharmony_ci#define M1064_PALWRADD	0x00
2162306a36Sopenharmony_ci#define M1064_PALDATA	0x01
2262306a36Sopenharmony_ci#define M1064_PIXRDMSK	0x02
2362306a36Sopenharmony_ci#define M1064_PALRDADD	0x03
2462306a36Sopenharmony_ci#define M1064_X_DATAREG	0x0A
2562306a36Sopenharmony_ci#define M1064_CURPOSXL	0x0C	/* can be accessed as DWORD */
2662306a36Sopenharmony_ci#define M1064_CURPOSXH	0x0D
2762306a36Sopenharmony_ci#define M1064_CURPOSYL	0x0E
2862306a36Sopenharmony_ci#define M1064_CURPOSYH	0x0F
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define M1064_XCURADDL		0x04
3162306a36Sopenharmony_ci#define M1064_XCURADDH		0x05
3262306a36Sopenharmony_ci#define M1064_XCURCTRL		0x06
3362306a36Sopenharmony_ci#define     M1064_XCURCTRL_DIS		0x00	/* transparent, transparent, transparent, transparent */
3462306a36Sopenharmony_ci#define     M1064_XCURCTRL_3COLOR	0x01	/* transparent, 0, 1, 2 */
3562306a36Sopenharmony_ci#define     M1064_XCURCTRL_XGA		0x02	/* 0, 1, transparent, complement */
3662306a36Sopenharmony_ci#define     M1064_XCURCTRL_XWIN		0x03	/* transparent, transparent, 0, 1 */
3762306a36Sopenharmony_ci	/* drive DVI by standard(0)/DVI(1) PLL */
3862306a36Sopenharmony_ci	/* if set(1), C?DVICLKEN and C?DVICLKSEL must be set(1) */
3962306a36Sopenharmony_ci#define      M1064_XDVICLKCTRL_DVIDATAPATHSEL   0x01
4062306a36Sopenharmony_ci	/* drive CRTC1 by standard(0)/DVI(1) PLL */
4162306a36Sopenharmony_ci#define      M1064_XDVICLKCTRL_C1DVICLKSEL      0x02
4262306a36Sopenharmony_ci	/* drive CRTC2 by standard(0)/DVI(1) PLL */
4362306a36Sopenharmony_ci#define      M1064_XDVICLKCTRL_C2DVICLKSEL      0x04
4462306a36Sopenharmony_ci	/* pixel clock allowed to(0)/blocked from(1) driving CRTC1 */
4562306a36Sopenharmony_ci#define      M1064_XDVICLKCTRL_C1DVICLKEN       0x08
4662306a36Sopenharmony_ci	/* DVI PLL loop filter bandwidth selection bits */
4762306a36Sopenharmony_ci#define      M1064_XDVICLKCTRL_DVILOOPCTL       0x30
4862306a36Sopenharmony_ci	/* CRTC2 pixel clock allowed to(0)/blocked from(1) driving CRTC2 */
4962306a36Sopenharmony_ci#define      M1064_XDVICLKCTRL_C2DVICLKEN       0x40
5062306a36Sopenharmony_ci	/* P1PLL loop filter bandwidth selection */
5162306a36Sopenharmony_ci#define      M1064_XDVICLKCTRL_P1LOOPBWDTCTL    0x80
5262306a36Sopenharmony_ci#define M1064_XCURCOL0RED	0x08
5362306a36Sopenharmony_ci#define M1064_XCURCOL0GREEN	0x09
5462306a36Sopenharmony_ci#define M1064_XCURCOL0BLUE	0x0A
5562306a36Sopenharmony_ci#define M1064_XCURCOL1RED	0x0C
5662306a36Sopenharmony_ci#define M1064_XCURCOL1GREEN	0x0D
5762306a36Sopenharmony_ci#define M1064_XCURCOL1BLUE	0x0E
5862306a36Sopenharmony_ci#define M1064_XDVICLKCTRL	0x0F
5962306a36Sopenharmony_ci#define M1064_XCURCOL2RED	0x10
6062306a36Sopenharmony_ci#define M1064_XCURCOL2GREEN	0x11
6162306a36Sopenharmony_ci#define M1064_XCURCOL2BLUE	0x12
6262306a36Sopenharmony_ci#define DAC1064_XVREFCTRL	0x18
6362306a36Sopenharmony_ci#define      DAC1064_XVREFCTRL_INTERNAL		0x3F
6462306a36Sopenharmony_ci#define      DAC1064_XVREFCTRL_EXTERNAL		0x00
6562306a36Sopenharmony_ci#define      DAC1064_XVREFCTRL_G100_DEFAULT	0x03
6662306a36Sopenharmony_ci#define M1064_XMULCTRL		0x19
6762306a36Sopenharmony_ci#define      M1064_XMULCTRL_DEPTH_8BPP		0x00	/* 8 bpp paletized */
6862306a36Sopenharmony_ci#define      M1064_XMULCTRL_DEPTH_15BPP_1BPP	0x01	/* 15 bpp paletized + 1 bpp overlay */
6962306a36Sopenharmony_ci#define      M1064_XMULCTRL_DEPTH_16BPP		0x02	/* 16 bpp paletized */
7062306a36Sopenharmony_ci#define      M1064_XMULCTRL_DEPTH_24BPP		0x03	/* 24 bpp paletized */
7162306a36Sopenharmony_ci#define      M1064_XMULCTRL_DEPTH_24BPP_8BPP	0x04	/* 24 bpp direct + 8 bpp overlay paletized */
7262306a36Sopenharmony_ci#define      M1064_XMULCTRL_2G8V16		0x05	/* 15 bpp video direct, half xres, 8bpp paletized */
7362306a36Sopenharmony_ci#define      M1064_XMULCTRL_G16V16		0x06	/* 15 bpp video, 15bpp graphics, one of them paletized */
7462306a36Sopenharmony_ci#define      M1064_XMULCTRL_DEPTH_32BPP		0x07	/* 24 bpp paletized + 8 bpp unused */
7562306a36Sopenharmony_ci#define      M1064_XMULCTRL_GRAPHICS_PALETIZED	0x00
7662306a36Sopenharmony_ci#define      M1064_XMULCTRL_VIDEO_PALETIZED	0x08
7762306a36Sopenharmony_ci#define M1064_XPIXCLKCTRL	0x1A
7862306a36Sopenharmony_ci#define      M1064_XPIXCLKCTRL_SRC_PCI		0x00
7962306a36Sopenharmony_ci#define      M1064_XPIXCLKCTRL_SRC_PLL		0x01
8062306a36Sopenharmony_ci#define      M1064_XPIXCLKCTRL_SRC_EXT		0x02
8162306a36Sopenharmony_ci#define	     M1064_XPIXCLKCTRL_SRC_SYS		0x03	/* G200/G400 */
8262306a36Sopenharmony_ci#define      M1064_XPIXCLKCTRL_SRC_PLL2		0x03	/* G450 */
8362306a36Sopenharmony_ci#define      M1064_XPIXCLKCTRL_SRC_MASK		0x03
8462306a36Sopenharmony_ci#define      M1064_XPIXCLKCTRL_EN		0x00
8562306a36Sopenharmony_ci#define      M1064_XPIXCLKCTRL_DIS		0x04
8662306a36Sopenharmony_ci#define      M1064_XPIXCLKCTRL_PLL_DOWN		0x00
8762306a36Sopenharmony_ci#define      M1064_XPIXCLKCTRL_PLL_UP		0x08
8862306a36Sopenharmony_ci#define M1064_XGENCTRL		0x1D
8962306a36Sopenharmony_ci#define      M1064_XGENCTRL_VS_0		0x00
9062306a36Sopenharmony_ci#define      M1064_XGENCTRL_VS_1		0x01
9162306a36Sopenharmony_ci#define      M1064_XGENCTRL_ALPHA_DIS		0x00
9262306a36Sopenharmony_ci#define      M1064_XGENCTRL_ALPHA_EN		0x02
9362306a36Sopenharmony_ci#define      M1064_XGENCTRL_BLACK_0IRE		0x00
9462306a36Sopenharmony_ci#define      M1064_XGENCTRL_BLACK_75IRE		0x10
9562306a36Sopenharmony_ci#define      M1064_XGENCTRL_SYNC_ON_GREEN	0x00
9662306a36Sopenharmony_ci#define      M1064_XGENCTRL_NO_SYNC_ON_GREEN	0x20
9762306a36Sopenharmony_ci#define      M1064_XGENCTRL_SYNC_ON_GREEN_MASK	0x20
9862306a36Sopenharmony_ci#define M1064_XMISCCTRL		0x1E
9962306a36Sopenharmony_ci#define      M1064_XMISCCTRL_DAC_DIS		0x00
10062306a36Sopenharmony_ci#define      M1064_XMISCCTRL_DAC_EN		0x01
10162306a36Sopenharmony_ci#define      M1064_XMISCCTRL_MFC_VGA		0x00
10262306a36Sopenharmony_ci#define      M1064_XMISCCTRL_MFC_MAFC		0x02
10362306a36Sopenharmony_ci#define      M1064_XMISCCTRL_MFC_DIS		0x06
10462306a36Sopenharmony_ci#define      GX00_XMISCCTRL_MFC_MAFC		0x02
10562306a36Sopenharmony_ci#define      GX00_XMISCCTRL_MFC_PANELLINK	0x04
10662306a36Sopenharmony_ci#define      GX00_XMISCCTRL_MFC_DIS		0x06
10762306a36Sopenharmony_ci#define      GX00_XMISCCTRL_MFC_MASK		0x06
10862306a36Sopenharmony_ci#define      M1064_XMISCCTRL_DAC_6BIT		0x00
10962306a36Sopenharmony_ci#define      M1064_XMISCCTRL_DAC_8BIT		0x08
11062306a36Sopenharmony_ci#define      M1064_XMISCCTRL_DAC_WIDTHMASK	0x08
11162306a36Sopenharmony_ci#define      M1064_XMISCCTRL_LUT_DIS		0x00
11262306a36Sopenharmony_ci#define      M1064_XMISCCTRL_LUT_EN		0x10
11362306a36Sopenharmony_ci#define      G400_XMISCCTRL_VDO_MAFC12		0x00
11462306a36Sopenharmony_ci#define      G400_XMISCCTRL_VDO_BYPASS656	0x40
11562306a36Sopenharmony_ci#define      G400_XMISCCTRL_VDO_C2_MAFC12	0x80
11662306a36Sopenharmony_ci#define      G400_XMISCCTRL_VDO_C2_BYPASS656	0xC0
11762306a36Sopenharmony_ci#define      G400_XMISCCTRL_VDO_MASK		0xE0
11862306a36Sopenharmony_ci#define M1064_XGENIOCTRL	0x2A
11962306a36Sopenharmony_ci#define M1064_XGENIODATA	0x2B
12062306a36Sopenharmony_ci#define DAC1064_XSYSPLLM	0x2C
12162306a36Sopenharmony_ci#define DAC1064_XSYSPLLN	0x2D
12262306a36Sopenharmony_ci#define DAC1064_XSYSPLLP	0x2E
12362306a36Sopenharmony_ci#define DAC1064_XSYSPLLSTAT	0x2F
12462306a36Sopenharmony_ci#define M1064_XZOOMCTRL		0x38
12562306a36Sopenharmony_ci#define      M1064_XZOOMCTRL_1			0x00
12662306a36Sopenharmony_ci#define      M1064_XZOOMCTRL_2			0x01
12762306a36Sopenharmony_ci#define      M1064_XZOOMCTRL_4			0x03
12862306a36Sopenharmony_ci#define M1064_XSENSETEST	0x3A
12962306a36Sopenharmony_ci#define      M1064_XSENSETEST_BCOMP		0x01
13062306a36Sopenharmony_ci#define      M1064_XSENSETEST_GCOMP		0x02
13162306a36Sopenharmony_ci#define      M1064_XSENSETEST_RCOMP		0x04
13262306a36Sopenharmony_ci#define      M1064_XSENSETEST_PDOWN		0x00
13362306a36Sopenharmony_ci#define      M1064_XSENSETEST_PUP		0x80
13462306a36Sopenharmony_ci#define M1064_XCRCREML		0x3C
13562306a36Sopenharmony_ci#define M1064_XCRCREMH		0x3D
13662306a36Sopenharmony_ci#define M1064_XCRCBITSEL	0x3E
13762306a36Sopenharmony_ci#define M1064_XCOLKEYMASKL	0x40
13862306a36Sopenharmony_ci#define M1064_XCOLKEYMASKH	0x41
13962306a36Sopenharmony_ci#define M1064_XCOLKEYL		0x42
14062306a36Sopenharmony_ci#define M1064_XCOLKEYH		0x43
14162306a36Sopenharmony_ci#define M1064_XPIXPLLAM		0x44
14262306a36Sopenharmony_ci#define M1064_XPIXPLLAN		0x45
14362306a36Sopenharmony_ci#define M1064_XPIXPLLAP		0x46
14462306a36Sopenharmony_ci#define M1064_XPIXPLLBM		0x48
14562306a36Sopenharmony_ci#define M1064_XPIXPLLBN		0x49
14662306a36Sopenharmony_ci#define M1064_XPIXPLLBP		0x4A
14762306a36Sopenharmony_ci#define M1064_XPIXPLLCM		0x4C
14862306a36Sopenharmony_ci#define M1064_XPIXPLLCN		0x4D
14962306a36Sopenharmony_ci#define M1064_XPIXPLLCP		0x4E
15062306a36Sopenharmony_ci#define M1064_XPIXPLLSTAT	0x4F
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci#define M1064_XTVO_IDX		0x87
15362306a36Sopenharmony_ci#define M1064_XTVO_DATA		0x88
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci#define M1064_XOUTPUTCONN	0x8A
15662306a36Sopenharmony_ci#define M1064_XSYNCCTRL		0x8B
15762306a36Sopenharmony_ci#define M1064_XVIDPLLSTAT	0x8C
15862306a36Sopenharmony_ci#define M1064_XVIDPLLP		0x8D
15962306a36Sopenharmony_ci#define M1064_XVIDPLLM		0x8E
16062306a36Sopenharmony_ci#define M1064_XVIDPLLN		0x8F
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci#define M1064_XPWRCTRL		0xA0
16362306a36Sopenharmony_ci#define     M1064_XPWRCTRL_PANELPDN	0x04
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci#define M1064_XPANMODE		0xA2
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_cienum POS1064 {
16862306a36Sopenharmony_ci	POS1064_XCURADDL=0, POS1064_XCURADDH, POS1064_XCURCTRL,
16962306a36Sopenharmony_ci	POS1064_XCURCOL0RED, POS1064_XCURCOL0GREEN, POS1064_XCURCOL0BLUE,
17062306a36Sopenharmony_ci	POS1064_XCURCOL1RED, POS1064_XCURCOL1GREEN, POS1064_XCURCOL1BLUE,
17162306a36Sopenharmony_ci	POS1064_XCURCOL2RED, POS1064_XCURCOL2GREEN, POS1064_XCURCOL2BLUE,
17262306a36Sopenharmony_ci	POS1064_XVREFCTRL, POS1064_XMULCTRL, POS1064_XPIXCLKCTRL, POS1064_XGENCTRL,
17362306a36Sopenharmony_ci	POS1064_XMISCCTRL,
17462306a36Sopenharmony_ci	POS1064_XGENIOCTRL, POS1064_XGENIODATA, POS1064_XZOOMCTRL, POS1064_XSENSETEST,
17562306a36Sopenharmony_ci	POS1064_XCRCBITSEL,
17662306a36Sopenharmony_ci	POS1064_XCOLKEYMASKL, POS1064_XCOLKEYMASKH, POS1064_XCOLKEYL, POS1064_XCOLKEYH,
17762306a36Sopenharmony_ci	POS1064_XOUTPUTCONN, POS1064_XPANMODE, POS1064_XPWRCTRL };
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci#endif	/* __MATROXFB_DAC1064_H__ */
181