162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
462306a36Sopenharmony_ci * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __HW_H__
962306a36Sopenharmony_ci#define __HW_H__
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/seq_file.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include "viamode.h"
1462306a36Sopenharmony_ci#include "global.h"
1562306a36Sopenharmony_ci#include "via_modesetting.h"
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define viafb_read_reg(p, i)			via_read_reg(p, i)
1862306a36Sopenharmony_ci#define viafb_write_reg(i, p, d)		via_write_reg(p, i, d)
1962306a36Sopenharmony_ci#define viafb_write_reg_mask(i, p, d, m)	via_write_reg_mask(p, i, d, m)
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/* VIA output devices */
2262306a36Sopenharmony_ci#define VIA_LDVP0	0x00000001
2362306a36Sopenharmony_ci#define VIA_LDVP1	0x00000002
2462306a36Sopenharmony_ci#define VIA_DVP0	0x00000004
2562306a36Sopenharmony_ci#define VIA_CRT		0x00000010
2662306a36Sopenharmony_ci#define VIA_DVP1	0x00000020
2762306a36Sopenharmony_ci#define VIA_LVDS1	0x00000040
2862306a36Sopenharmony_ci#define VIA_LVDS2	0x00000080
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci/* VIA output device power states */
3162306a36Sopenharmony_ci#define VIA_STATE_ON		0
3262306a36Sopenharmony_ci#define VIA_STATE_STANDBY	1
3362306a36Sopenharmony_ci#define VIA_STATE_SUSPEND	2
3462306a36Sopenharmony_ci#define VIA_STATE_OFF		3
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci/* VIA output device sync polarity */
3762306a36Sopenharmony_ci#define VIA_HSYNC_NEGATIVE	0x01
3862306a36Sopenharmony_ci#define VIA_VSYNC_NEGATIVE	0x02
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci/**********************************************************/
4162306a36Sopenharmony_ci/* Definition IGA2 Design Method of CRTC Shadow Registers */
4262306a36Sopenharmony_ci/**********************************************************/
4362306a36Sopenharmony_ci#define IGA2_HOR_TOTAL_SHADOW_FORMULA(x)           ((x/8)-5)
4462306a36Sopenharmony_ci#define IGA2_HOR_BLANK_END_SHADOW_FORMULA(x, y)     (((x+y)/8)-1)
4562306a36Sopenharmony_ci#define IGA2_VER_TOTAL_SHADOW_FORMULA(x)           ((x)-2)
4662306a36Sopenharmony_ci#define IGA2_VER_ADDR_SHADOW_FORMULA(x)            ((x)-1)
4762306a36Sopenharmony_ci#define IGA2_VER_BLANK_START_SHADOW_FORMULA(x)     ((x)-1)
4862306a36Sopenharmony_ci#define IGA2_VER_BLANK_END_SHADOW_FORMULA(x, y)     ((x+y)-1)
4962306a36Sopenharmony_ci#define IGA2_VER_SYNC_START_SHADOW_FORMULA(x)      (x)
5062306a36Sopenharmony_ci#define IGA2_VER_SYNC_END_SHADOW_FORMULA(x, y)      (x+y)
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci/* Define Register Number for IGA2 Shadow CRTC Timing */
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/* location: {CR6D,0,7},{CR71,3,3} */
5562306a36Sopenharmony_ci#define IGA2_SHADOW_HOR_TOTAL_REG_NUM       2
5662306a36Sopenharmony_ci/* location: {CR6E,0,7} */
5762306a36Sopenharmony_ci#define IGA2_SHADOW_HOR_BLANK_END_REG_NUM   1
5862306a36Sopenharmony_ci/* location: {CR6F,0,7},{CR71,0,2} */
5962306a36Sopenharmony_ci#define IGA2_SHADOW_VER_TOTAL_REG_NUM       2
6062306a36Sopenharmony_ci/* location: {CR70,0,7},{CR71,4,6} */
6162306a36Sopenharmony_ci#define IGA2_SHADOW_VER_ADDR_REG_NUM        2
6262306a36Sopenharmony_ci/* location: {CR72,0,7},{CR74,4,6} */
6362306a36Sopenharmony_ci#define IGA2_SHADOW_VER_BLANK_START_REG_NUM 2
6462306a36Sopenharmony_ci/* location: {CR73,0,7},{CR74,0,2} */
6562306a36Sopenharmony_ci#define IGA2_SHADOW_VER_BLANK_END_REG_NUM   2
6662306a36Sopenharmony_ci/* location: {CR75,0,7},{CR76,4,6} */
6762306a36Sopenharmony_ci#define IGA2_SHADOW_VER_SYNC_START_REG_NUM  2
6862306a36Sopenharmony_ci/* location: {CR76,0,3} */
6962306a36Sopenharmony_ci#define IGA2_SHADOW_VER_SYNC_END_REG_NUM    1
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci/* Define Fetch Count Register*/
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci/* location: {SR1C,0,7},{SR1D,0,1} */
7462306a36Sopenharmony_ci#define IGA1_FETCH_COUNT_REG_NUM        2
7562306a36Sopenharmony_ci/* 16 bytes alignment. */
7662306a36Sopenharmony_ci#define IGA1_FETCH_COUNT_ALIGN_BYTE     16
7762306a36Sopenharmony_ci/* x: H resolution, y: color depth */
7862306a36Sopenharmony_ci#define IGA1_FETCH_COUNT_PATCH_VALUE    4
7962306a36Sopenharmony_ci#define IGA1_FETCH_COUNT_FORMULA(x, y)   \
8062306a36Sopenharmony_ci	(((x*y)/IGA1_FETCH_COUNT_ALIGN_BYTE) + IGA1_FETCH_COUNT_PATCH_VALUE)
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci/* location: {CR65,0,7},{CR67,2,3} */
8362306a36Sopenharmony_ci#define IGA2_FETCH_COUNT_REG_NUM        2
8462306a36Sopenharmony_ci#define IGA2_FETCH_COUNT_ALIGN_BYTE     16
8562306a36Sopenharmony_ci#define IGA2_FETCH_COUNT_PATCH_VALUE    0
8662306a36Sopenharmony_ci#define IGA2_FETCH_COUNT_FORMULA(x, y)   \
8762306a36Sopenharmony_ci	(((x*y)/IGA2_FETCH_COUNT_ALIGN_BYTE) + IGA2_FETCH_COUNT_PATCH_VALUE)
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci/* Staring Address*/
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci/* location: {CR0C,0,7},{CR0D,0,7},{CR34,0,7},{CR48,0,1} */
9262306a36Sopenharmony_ci#define IGA1_STARTING_ADDR_REG_NUM      4
9362306a36Sopenharmony_ci/* location: {CR62,1,7},{CR63,0,7},{CR64,0,7} */
9462306a36Sopenharmony_ci#define IGA2_STARTING_ADDR_REG_NUM      3
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci/* Define Display OFFSET*/
9762306a36Sopenharmony_ci/* These value are by HW suggested value*/
9862306a36Sopenharmony_ci/* location: {SR17,0,7} */
9962306a36Sopenharmony_ci#define K800_IGA1_FIFO_MAX_DEPTH                384
10062306a36Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
10162306a36Sopenharmony_ci#define K800_IGA1_FIFO_THRESHOLD                328
10262306a36Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
10362306a36Sopenharmony_ci#define K800_IGA1_FIFO_HIGH_THRESHOLD           296
10462306a36Sopenharmony_ci/* location: {SR22,0,4}. (128/4) =64, K800 must be set zero, */
10562306a36Sopenharmony_ci				/* because HW only 5 bits */
10662306a36Sopenharmony_ci#define K800_IGA1_DISPLAY_QUEUE_EXPIRE_NUM      0
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
10962306a36Sopenharmony_ci#define K800_IGA2_FIFO_MAX_DEPTH                384
11062306a36Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
11162306a36Sopenharmony_ci#define K800_IGA2_FIFO_THRESHOLD                328
11262306a36Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
11362306a36Sopenharmony_ci#define K800_IGA2_FIFO_HIGH_THRESHOLD           296
11462306a36Sopenharmony_ci/* location: {CR94,0,6} */
11562306a36Sopenharmony_ci#define K800_IGA2_DISPLAY_QUEUE_EXPIRE_NUM      128
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci/* location: {SR17,0,7} */
11862306a36Sopenharmony_ci#define P880_IGA1_FIFO_MAX_DEPTH                192
11962306a36Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
12062306a36Sopenharmony_ci#define P880_IGA1_FIFO_THRESHOLD                128
12162306a36Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
12262306a36Sopenharmony_ci#define P880_IGA1_FIFO_HIGH_THRESHOLD           64
12362306a36Sopenharmony_ci/* location: {SR22,0,4}. (128/4) =64, K800 must be set zero, */
12462306a36Sopenharmony_ci				/* because HW only 5 bits */
12562306a36Sopenharmony_ci#define P880_IGA1_DISPLAY_QUEUE_EXPIRE_NUM      0
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
12862306a36Sopenharmony_ci#define P880_IGA2_FIFO_MAX_DEPTH                96
12962306a36Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
13062306a36Sopenharmony_ci#define P880_IGA2_FIFO_THRESHOLD                64
13162306a36Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
13262306a36Sopenharmony_ci#define P880_IGA2_FIFO_HIGH_THRESHOLD           32
13362306a36Sopenharmony_ci/* location: {CR94,0,6} */
13462306a36Sopenharmony_ci#define P880_IGA2_DISPLAY_QUEUE_EXPIRE_NUM      128
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci/* VT3314 chipset*/
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci/* location: {SR17,0,7} */
13962306a36Sopenharmony_ci#define CN700_IGA1_FIFO_MAX_DEPTH               96
14062306a36Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
14162306a36Sopenharmony_ci#define CN700_IGA1_FIFO_THRESHOLD               80
14262306a36Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
14362306a36Sopenharmony_ci#define CN700_IGA1_FIFO_HIGH_THRESHOLD          64
14462306a36Sopenharmony_ci/* location: {SR22,0,4}. (128/4) =64, P800 must be set zero,
14562306a36Sopenharmony_ci				because HW only 5 bits */
14662306a36Sopenharmony_ci#define CN700_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     0
14762306a36Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
14862306a36Sopenharmony_ci#define CN700_IGA2_FIFO_MAX_DEPTH               96
14962306a36Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
15062306a36Sopenharmony_ci#define CN700_IGA2_FIFO_THRESHOLD               80
15162306a36Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
15262306a36Sopenharmony_ci#define CN700_IGA2_FIFO_HIGH_THRESHOLD          32
15362306a36Sopenharmony_ci/* location: {CR94,0,6} */
15462306a36Sopenharmony_ci#define CN700_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     128
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci/* For VT3324, these values are suggested by HW */
15762306a36Sopenharmony_ci/* location: {SR17,0,7} */
15862306a36Sopenharmony_ci#define CX700_IGA1_FIFO_MAX_DEPTH               192
15962306a36Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
16062306a36Sopenharmony_ci#define CX700_IGA1_FIFO_THRESHOLD               128
16162306a36Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
16262306a36Sopenharmony_ci#define CX700_IGA1_FIFO_HIGH_THRESHOLD          128
16362306a36Sopenharmony_ci/* location: {SR22,0,4} */
16462306a36Sopenharmony_ci#define CX700_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     124
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
16762306a36Sopenharmony_ci#define CX700_IGA2_FIFO_MAX_DEPTH               96
16862306a36Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
16962306a36Sopenharmony_ci#define CX700_IGA2_FIFO_THRESHOLD               64
17062306a36Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
17162306a36Sopenharmony_ci#define CX700_IGA2_FIFO_HIGH_THRESHOLD          32
17262306a36Sopenharmony_ci/* location: {CR94,0,6} */
17362306a36Sopenharmony_ci#define CX700_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     128
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci/* VT3336 chipset*/
17662306a36Sopenharmony_ci/* location: {SR17,0,7} */
17762306a36Sopenharmony_ci#define K8M890_IGA1_FIFO_MAX_DEPTH               360
17862306a36Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
17962306a36Sopenharmony_ci#define K8M890_IGA1_FIFO_THRESHOLD               328
18062306a36Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
18162306a36Sopenharmony_ci#define K8M890_IGA1_FIFO_HIGH_THRESHOLD          296
18262306a36Sopenharmony_ci/* location: {SR22,0,4}. */
18362306a36Sopenharmony_ci#define K8M890_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     124
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
18662306a36Sopenharmony_ci#define K8M890_IGA2_FIFO_MAX_DEPTH               360
18762306a36Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
18862306a36Sopenharmony_ci#define K8M890_IGA2_FIFO_THRESHOLD               328
18962306a36Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
19062306a36Sopenharmony_ci#define K8M890_IGA2_FIFO_HIGH_THRESHOLD          296
19162306a36Sopenharmony_ci/* location: {CR94,0,6} */
19262306a36Sopenharmony_ci#define K8M890_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     124
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ci/* VT3327 chipset*/
19562306a36Sopenharmony_ci/* location: {SR17,0,7} */
19662306a36Sopenharmony_ci#define P4M890_IGA1_FIFO_MAX_DEPTH               96
19762306a36Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
19862306a36Sopenharmony_ci#define P4M890_IGA1_FIFO_THRESHOLD               76
19962306a36Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
20062306a36Sopenharmony_ci#define P4M890_IGA1_FIFO_HIGH_THRESHOLD          64
20162306a36Sopenharmony_ci/* location: {SR22,0,4}. (32/4) =8 */
20262306a36Sopenharmony_ci#define P4M890_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     32
20362306a36Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
20462306a36Sopenharmony_ci#define P4M890_IGA2_FIFO_MAX_DEPTH               96
20562306a36Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
20662306a36Sopenharmony_ci#define P4M890_IGA2_FIFO_THRESHOLD               76
20762306a36Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
20862306a36Sopenharmony_ci#define P4M890_IGA2_FIFO_HIGH_THRESHOLD          64
20962306a36Sopenharmony_ci/* location: {CR94,0,6} */
21062306a36Sopenharmony_ci#define P4M890_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     32
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ci/* VT3364 chipset*/
21362306a36Sopenharmony_ci/* location: {SR17,0,7} */
21462306a36Sopenharmony_ci#define P4M900_IGA1_FIFO_MAX_DEPTH               96
21562306a36Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
21662306a36Sopenharmony_ci#define P4M900_IGA1_FIFO_THRESHOLD               76
21762306a36Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
21862306a36Sopenharmony_ci#define P4M900_IGA1_FIFO_HIGH_THRESHOLD          76
21962306a36Sopenharmony_ci/* location: {SR22,0,4}. */
22062306a36Sopenharmony_ci#define P4M900_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     32
22162306a36Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
22262306a36Sopenharmony_ci#define P4M900_IGA2_FIFO_MAX_DEPTH               96
22362306a36Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
22462306a36Sopenharmony_ci#define P4M900_IGA2_FIFO_THRESHOLD               76
22562306a36Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
22662306a36Sopenharmony_ci#define P4M900_IGA2_FIFO_HIGH_THRESHOLD          76
22762306a36Sopenharmony_ci/* location: {CR94,0,6} */
22862306a36Sopenharmony_ci#define P4M900_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     32
22962306a36Sopenharmony_ci
23062306a36Sopenharmony_ci/* For VT3353, these values are suggested by HW */
23162306a36Sopenharmony_ci/* location: {SR17,0,7} */
23262306a36Sopenharmony_ci#define VX800_IGA1_FIFO_MAX_DEPTH               192
23362306a36Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
23462306a36Sopenharmony_ci#define VX800_IGA1_FIFO_THRESHOLD               152
23562306a36Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
23662306a36Sopenharmony_ci#define VX800_IGA1_FIFO_HIGH_THRESHOLD          152
23762306a36Sopenharmony_ci/* location: {SR22,0,4} */
23862306a36Sopenharmony_ci#define VX800_IGA1_DISPLAY_QUEUE_EXPIRE_NUM      64
23962306a36Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
24062306a36Sopenharmony_ci#define VX800_IGA2_FIFO_MAX_DEPTH               96
24162306a36Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
24262306a36Sopenharmony_ci#define VX800_IGA2_FIFO_THRESHOLD               64
24362306a36Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
24462306a36Sopenharmony_ci#define VX800_IGA2_FIFO_HIGH_THRESHOLD          32
24562306a36Sopenharmony_ci/* location: {CR94,0,6} */
24662306a36Sopenharmony_ci#define VX800_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     128
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ci/* For VT3409 */
24962306a36Sopenharmony_ci#define VX855_IGA1_FIFO_MAX_DEPTH               400
25062306a36Sopenharmony_ci#define VX855_IGA1_FIFO_THRESHOLD               320
25162306a36Sopenharmony_ci#define VX855_IGA1_FIFO_HIGH_THRESHOLD          320
25262306a36Sopenharmony_ci#define VX855_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     160
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ci#define VX855_IGA2_FIFO_MAX_DEPTH               200
25562306a36Sopenharmony_ci#define VX855_IGA2_FIFO_THRESHOLD               160
25662306a36Sopenharmony_ci#define VX855_IGA2_FIFO_HIGH_THRESHOLD          160
25762306a36Sopenharmony_ci#define VX855_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     320
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_ci/* For VT3410 */
26062306a36Sopenharmony_ci#define VX900_IGA1_FIFO_MAX_DEPTH               400
26162306a36Sopenharmony_ci#define VX900_IGA1_FIFO_THRESHOLD               320
26262306a36Sopenharmony_ci#define VX900_IGA1_FIFO_HIGH_THRESHOLD          320
26362306a36Sopenharmony_ci#define VX900_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     160
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_ci#define VX900_IGA2_FIFO_MAX_DEPTH               192
26662306a36Sopenharmony_ci#define VX900_IGA2_FIFO_THRESHOLD               160
26762306a36Sopenharmony_ci#define VX900_IGA2_FIFO_HIGH_THRESHOLD          160
26862306a36Sopenharmony_ci#define VX900_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     320
26962306a36Sopenharmony_ci
27062306a36Sopenharmony_ci#define IGA1_FIFO_DEPTH_SELECT_REG_NUM          1
27162306a36Sopenharmony_ci#define IGA1_FIFO_THRESHOLD_REG_NUM             2
27262306a36Sopenharmony_ci#define IGA1_FIFO_HIGH_THRESHOLD_REG_NUM        2
27362306a36Sopenharmony_ci#define IGA1_DISPLAY_QUEUE_EXPIRE_NUM_REG_NUM   1
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_ci#define IGA2_FIFO_DEPTH_SELECT_REG_NUM          3
27662306a36Sopenharmony_ci#define IGA2_FIFO_THRESHOLD_REG_NUM             2
27762306a36Sopenharmony_ci#define IGA2_FIFO_HIGH_THRESHOLD_REG_NUM        2
27862306a36Sopenharmony_ci#define IGA2_DISPLAY_QUEUE_EXPIRE_NUM_REG_NUM   1
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ci#define IGA1_FIFO_DEPTH_SELECT_FORMULA(x)                   ((x/2)-1)
28162306a36Sopenharmony_ci#define IGA1_FIFO_THRESHOLD_FORMULA(x)                      (x/4)
28262306a36Sopenharmony_ci#define IGA1_DISPLAY_QUEUE_EXPIRE_NUM_FORMULA(x)            (x/4)
28362306a36Sopenharmony_ci#define IGA1_FIFO_HIGH_THRESHOLD_FORMULA(x)                 (x/4)
28462306a36Sopenharmony_ci#define IGA2_FIFO_DEPTH_SELECT_FORMULA(x)                   (((x/2)/4)-1)
28562306a36Sopenharmony_ci#define IGA2_FIFO_THRESHOLD_FORMULA(x)                      (x/4)
28662306a36Sopenharmony_ci#define IGA2_DISPLAY_QUEUE_EXPIRE_NUM_FORMULA(x)            (x/4)
28762306a36Sopenharmony_ci#define IGA2_FIFO_HIGH_THRESHOLD_FORMULA(x)                 (x/4)
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci/************************************************************************/
29062306a36Sopenharmony_ci/*  LCD Timing                                                          */
29162306a36Sopenharmony_ci/************************************************************************/
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ci/* 500 ms = 500000 us */
29462306a36Sopenharmony_ci#define LCD_POWER_SEQ_TD0               500000
29562306a36Sopenharmony_ci/* 50 ms = 50000 us */
29662306a36Sopenharmony_ci#define LCD_POWER_SEQ_TD1               50000
29762306a36Sopenharmony_ci/* 0 us */
29862306a36Sopenharmony_ci#define LCD_POWER_SEQ_TD2               0
29962306a36Sopenharmony_ci/* 210 ms = 210000 us */
30062306a36Sopenharmony_ci#define LCD_POWER_SEQ_TD3               210000
30162306a36Sopenharmony_ci/* 2^10 * (1/14.31818M) = 71.475 us (K400.revA) */
30262306a36Sopenharmony_ci#define CLE266_POWER_SEQ_UNIT           71
30362306a36Sopenharmony_ci/* 2^11 * (1/14.31818M) = 142.95 us (K400.revB) */
30462306a36Sopenharmony_ci#define K800_POWER_SEQ_UNIT             142
30562306a36Sopenharmony_ci/* 2^13 * (1/14.31818M) = 572.1 us */
30662306a36Sopenharmony_ci#define P880_POWER_SEQ_UNIT             572
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci#define CLE266_POWER_SEQ_FORMULA(x)     ((x)/CLE266_POWER_SEQ_UNIT)
30962306a36Sopenharmony_ci#define K800_POWER_SEQ_FORMULA(x)       ((x)/K800_POWER_SEQ_UNIT)
31062306a36Sopenharmony_ci#define P880_POWER_SEQ_FORMULA(x)       ((x)/P880_POWER_SEQ_UNIT)
31162306a36Sopenharmony_ci
31262306a36Sopenharmony_ci/* location: {CR8B,0,7},{CR8F,0,3} */
31362306a36Sopenharmony_ci#define LCD_POWER_SEQ_TD0_REG_NUM       2
31462306a36Sopenharmony_ci/* location: {CR8C,0,7},{CR8F,4,7} */
31562306a36Sopenharmony_ci#define LCD_POWER_SEQ_TD1_REG_NUM       2
31662306a36Sopenharmony_ci/* location: {CR8D,0,7},{CR90,0,3} */
31762306a36Sopenharmony_ci#define LCD_POWER_SEQ_TD2_REG_NUM       2
31862306a36Sopenharmony_ci/* location: {CR8E,0,7},{CR90,4,7} */
31962306a36Sopenharmony_ci#define LCD_POWER_SEQ_TD3_REG_NUM       2
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ci/* LCD Scaling factor*/
32262306a36Sopenharmony_ci/* x: indicate setting horizontal size*/
32362306a36Sopenharmony_ci/* y: indicate panel horizontal size*/
32462306a36Sopenharmony_ci
32562306a36Sopenharmony_ci/* Horizontal scaling factor 10 bits (2^10) */
32662306a36Sopenharmony_ci#define CLE266_LCD_HOR_SCF_FORMULA(x, y)   (((x-1)*1024)/(y-1))
32762306a36Sopenharmony_ci/* Vertical scaling factor 10 bits (2^10) */
32862306a36Sopenharmony_ci#define CLE266_LCD_VER_SCF_FORMULA(x, y)   (((x-1)*1024)/(y-1))
32962306a36Sopenharmony_ci/* Horizontal scaling factor 10 bits (2^12) */
33062306a36Sopenharmony_ci#define K800_LCD_HOR_SCF_FORMULA(x, y)     (((x-1)*4096)/(y-1))
33162306a36Sopenharmony_ci/* Vertical scaling factor 10 bits (2^11) */
33262306a36Sopenharmony_ci#define K800_LCD_VER_SCF_FORMULA(x, y)     (((x-1)*2048)/(y-1))
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ci/* location: {CR9F,0,1},{CR77,0,7},{CR79,4,5} */
33562306a36Sopenharmony_ci#define LCD_HOR_SCALING_FACTOR_REG_NUM  3
33662306a36Sopenharmony_ci/* location: {CR79,3,3},{CR78,0,7},{CR79,6,7} */
33762306a36Sopenharmony_ci#define LCD_VER_SCALING_FACTOR_REG_NUM  3
33862306a36Sopenharmony_ci/* location: {CR77,0,7},{CR79,4,5} */
33962306a36Sopenharmony_ci#define LCD_HOR_SCALING_FACTOR_REG_NUM_CLE  2
34062306a36Sopenharmony_ci/* location: {CR78,0,7},{CR79,6,7} */
34162306a36Sopenharmony_ci#define LCD_VER_SCALING_FACTOR_REG_NUM_CLE  2
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_cistruct io_register {
34462306a36Sopenharmony_ci	u8 io_addr;
34562306a36Sopenharmony_ci	u8 start_bit;
34662306a36Sopenharmony_ci	u8 end_bit;
34762306a36Sopenharmony_ci};
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ci/*****************************************************
35062306a36Sopenharmony_ci**      Define IGA2 Shadow Display Timing         ****
35162306a36Sopenharmony_ci*****************************************************/
35262306a36Sopenharmony_ci
35362306a36Sopenharmony_ci/* IGA2 Shadow Horizontal Total */
35462306a36Sopenharmony_cistruct iga2_shadow_hor_total {
35562306a36Sopenharmony_ci	int reg_num;
35662306a36Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_HOR_TOTAL_REG_NUM];
35762306a36Sopenharmony_ci};
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_ci/* IGA2 Shadow Horizontal Blank End */
36062306a36Sopenharmony_cistruct iga2_shadow_hor_blank_end {
36162306a36Sopenharmony_ci	int reg_num;
36262306a36Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_HOR_BLANK_END_REG_NUM];
36362306a36Sopenharmony_ci};
36462306a36Sopenharmony_ci
36562306a36Sopenharmony_ci/* IGA2 Shadow Vertical Total */
36662306a36Sopenharmony_cistruct iga2_shadow_ver_total {
36762306a36Sopenharmony_ci	int reg_num;
36862306a36Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_VER_TOTAL_REG_NUM];
36962306a36Sopenharmony_ci};
37062306a36Sopenharmony_ci
37162306a36Sopenharmony_ci/* IGA2 Shadow Vertical Addressable Video */
37262306a36Sopenharmony_cistruct iga2_shadow_ver_addr {
37362306a36Sopenharmony_ci	int reg_num;
37462306a36Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_VER_ADDR_REG_NUM];
37562306a36Sopenharmony_ci};
37662306a36Sopenharmony_ci
37762306a36Sopenharmony_ci/* IGA2 Shadow Vertical Blank Start */
37862306a36Sopenharmony_cistruct iga2_shadow_ver_blank_start {
37962306a36Sopenharmony_ci	int reg_num;
38062306a36Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_VER_BLANK_START_REG_NUM];
38162306a36Sopenharmony_ci};
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ci/* IGA2 Shadow Vertical Blank End */
38462306a36Sopenharmony_cistruct iga2_shadow_ver_blank_end {
38562306a36Sopenharmony_ci	int reg_num;
38662306a36Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_VER_BLANK_END_REG_NUM];
38762306a36Sopenharmony_ci};
38862306a36Sopenharmony_ci
38962306a36Sopenharmony_ci/* IGA2 Shadow Vertical Sync Start */
39062306a36Sopenharmony_cistruct iga2_shadow_ver_sync_start {
39162306a36Sopenharmony_ci	int reg_num;
39262306a36Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_VER_SYNC_START_REG_NUM];
39362306a36Sopenharmony_ci};
39462306a36Sopenharmony_ci
39562306a36Sopenharmony_ci/* IGA2 Shadow Vertical Sync End */
39662306a36Sopenharmony_cistruct iga2_shadow_ver_sync_end {
39762306a36Sopenharmony_ci	int reg_num;
39862306a36Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_VER_SYNC_END_REG_NUM];
39962306a36Sopenharmony_ci};
40062306a36Sopenharmony_ci
40162306a36Sopenharmony_ci/* IGA1 Fetch Count Register */
40262306a36Sopenharmony_cistruct iga1_fetch_count {
40362306a36Sopenharmony_ci	int reg_num;
40462306a36Sopenharmony_ci	struct io_register reg[IGA1_FETCH_COUNT_REG_NUM];
40562306a36Sopenharmony_ci};
40662306a36Sopenharmony_ci
40762306a36Sopenharmony_ci/* IGA2 Fetch Count Register */
40862306a36Sopenharmony_cistruct iga2_fetch_count {
40962306a36Sopenharmony_ci	int reg_num;
41062306a36Sopenharmony_ci	struct io_register reg[IGA2_FETCH_COUNT_REG_NUM];
41162306a36Sopenharmony_ci};
41262306a36Sopenharmony_ci
41362306a36Sopenharmony_cistruct fetch_count {
41462306a36Sopenharmony_ci	struct iga1_fetch_count iga1_fetch_count_reg;
41562306a36Sopenharmony_ci	struct iga2_fetch_count iga2_fetch_count_reg;
41662306a36Sopenharmony_ci};
41762306a36Sopenharmony_ci
41862306a36Sopenharmony_ci/* Starting Address Register */
41962306a36Sopenharmony_cistruct iga1_starting_addr {
42062306a36Sopenharmony_ci	int reg_num;
42162306a36Sopenharmony_ci	struct io_register reg[IGA1_STARTING_ADDR_REG_NUM];
42262306a36Sopenharmony_ci};
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_cistruct iga2_starting_addr {
42562306a36Sopenharmony_ci	int reg_num;
42662306a36Sopenharmony_ci	struct io_register reg[IGA2_STARTING_ADDR_REG_NUM];
42762306a36Sopenharmony_ci};
42862306a36Sopenharmony_ci
42962306a36Sopenharmony_cistruct starting_addr {
43062306a36Sopenharmony_ci	struct iga1_starting_addr iga1_starting_addr_reg;
43162306a36Sopenharmony_ci	struct iga2_starting_addr iga2_starting_addr_reg;
43262306a36Sopenharmony_ci};
43362306a36Sopenharmony_ci
43462306a36Sopenharmony_ci/* LCD Power Sequence Timer */
43562306a36Sopenharmony_cistruct lcd_pwd_seq_td0 {
43662306a36Sopenharmony_ci	int reg_num;
43762306a36Sopenharmony_ci	struct io_register reg[LCD_POWER_SEQ_TD0_REG_NUM];
43862306a36Sopenharmony_ci};
43962306a36Sopenharmony_ci
44062306a36Sopenharmony_cistruct lcd_pwd_seq_td1 {
44162306a36Sopenharmony_ci	int reg_num;
44262306a36Sopenharmony_ci	struct io_register reg[LCD_POWER_SEQ_TD1_REG_NUM];
44362306a36Sopenharmony_ci};
44462306a36Sopenharmony_ci
44562306a36Sopenharmony_cistruct lcd_pwd_seq_td2 {
44662306a36Sopenharmony_ci	int reg_num;
44762306a36Sopenharmony_ci	struct io_register reg[LCD_POWER_SEQ_TD2_REG_NUM];
44862306a36Sopenharmony_ci};
44962306a36Sopenharmony_ci
45062306a36Sopenharmony_cistruct lcd_pwd_seq_td3 {
45162306a36Sopenharmony_ci	int reg_num;
45262306a36Sopenharmony_ci	struct io_register reg[LCD_POWER_SEQ_TD3_REG_NUM];
45362306a36Sopenharmony_ci};
45462306a36Sopenharmony_ci
45562306a36Sopenharmony_cistruct _lcd_pwd_seq_timer {
45662306a36Sopenharmony_ci	struct lcd_pwd_seq_td0 td0;
45762306a36Sopenharmony_ci	struct lcd_pwd_seq_td1 td1;
45862306a36Sopenharmony_ci	struct lcd_pwd_seq_td2 td2;
45962306a36Sopenharmony_ci	struct lcd_pwd_seq_td3 td3;
46062306a36Sopenharmony_ci};
46162306a36Sopenharmony_ci
46262306a36Sopenharmony_ci/* LCD Scaling Factor */
46362306a36Sopenharmony_cistruct _lcd_hor_scaling_factor {
46462306a36Sopenharmony_ci	int reg_num;
46562306a36Sopenharmony_ci	struct io_register reg[LCD_HOR_SCALING_FACTOR_REG_NUM];
46662306a36Sopenharmony_ci};
46762306a36Sopenharmony_ci
46862306a36Sopenharmony_cistruct _lcd_ver_scaling_factor {
46962306a36Sopenharmony_ci	int reg_num;
47062306a36Sopenharmony_ci	struct io_register reg[LCD_VER_SCALING_FACTOR_REG_NUM];
47162306a36Sopenharmony_ci};
47262306a36Sopenharmony_ci
47362306a36Sopenharmony_cistruct _lcd_scaling_factor {
47462306a36Sopenharmony_ci	struct _lcd_hor_scaling_factor lcd_hor_scaling_factor;
47562306a36Sopenharmony_ci	struct _lcd_ver_scaling_factor lcd_ver_scaling_factor;
47662306a36Sopenharmony_ci};
47762306a36Sopenharmony_ci
47862306a36Sopenharmony_cistruct pll_limit {
47962306a36Sopenharmony_ci	u16 multiplier_min;
48062306a36Sopenharmony_ci	u16 multiplier_max;
48162306a36Sopenharmony_ci	u8 divisor;
48262306a36Sopenharmony_ci	u8 rshift;
48362306a36Sopenharmony_ci};
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_cistruct rgbLUT {
48662306a36Sopenharmony_ci	u8 red;
48762306a36Sopenharmony_ci	u8 green;
48862306a36Sopenharmony_ci	u8 blue;
48962306a36Sopenharmony_ci};
49062306a36Sopenharmony_ci
49162306a36Sopenharmony_cistruct lcd_pwd_seq_timer {
49262306a36Sopenharmony_ci	u16 td0;
49362306a36Sopenharmony_ci	u16 td1;
49462306a36Sopenharmony_ci	u16 td2;
49562306a36Sopenharmony_ci	u16 td3;
49662306a36Sopenharmony_ci};
49762306a36Sopenharmony_ci
49862306a36Sopenharmony_ci/* Display FIFO Relation Registers*/
49962306a36Sopenharmony_cistruct iga1_fifo_depth_select {
50062306a36Sopenharmony_ci	int reg_num;
50162306a36Sopenharmony_ci	struct io_register reg[IGA1_FIFO_DEPTH_SELECT_REG_NUM];
50262306a36Sopenharmony_ci};
50362306a36Sopenharmony_ci
50462306a36Sopenharmony_cistruct iga1_fifo_threshold_select {
50562306a36Sopenharmony_ci	int reg_num;
50662306a36Sopenharmony_ci	struct io_register reg[IGA1_FIFO_THRESHOLD_REG_NUM];
50762306a36Sopenharmony_ci};
50862306a36Sopenharmony_ci
50962306a36Sopenharmony_cistruct iga1_fifo_high_threshold_select {
51062306a36Sopenharmony_ci	int reg_num;
51162306a36Sopenharmony_ci	struct io_register reg[IGA1_FIFO_HIGH_THRESHOLD_REG_NUM];
51262306a36Sopenharmony_ci};
51362306a36Sopenharmony_ci
51462306a36Sopenharmony_cistruct iga1_display_queue_expire_num {
51562306a36Sopenharmony_ci	int reg_num;
51662306a36Sopenharmony_ci	struct io_register reg[IGA1_DISPLAY_QUEUE_EXPIRE_NUM_REG_NUM];
51762306a36Sopenharmony_ci};
51862306a36Sopenharmony_ci
51962306a36Sopenharmony_cistruct iga2_fifo_depth_select {
52062306a36Sopenharmony_ci	int reg_num;
52162306a36Sopenharmony_ci	struct io_register reg[IGA2_FIFO_DEPTH_SELECT_REG_NUM];
52262306a36Sopenharmony_ci};
52362306a36Sopenharmony_ci
52462306a36Sopenharmony_cistruct iga2_fifo_threshold_select {
52562306a36Sopenharmony_ci	int reg_num;
52662306a36Sopenharmony_ci	struct io_register reg[IGA2_FIFO_THRESHOLD_REG_NUM];
52762306a36Sopenharmony_ci};
52862306a36Sopenharmony_ci
52962306a36Sopenharmony_cistruct iga2_fifo_high_threshold_select {
53062306a36Sopenharmony_ci	int reg_num;
53162306a36Sopenharmony_ci	struct io_register reg[IGA2_FIFO_HIGH_THRESHOLD_REG_NUM];
53262306a36Sopenharmony_ci};
53362306a36Sopenharmony_ci
53462306a36Sopenharmony_cistruct iga2_display_queue_expire_num {
53562306a36Sopenharmony_ci	int reg_num;
53662306a36Sopenharmony_ci	struct io_register reg[IGA2_DISPLAY_QUEUE_EXPIRE_NUM_REG_NUM];
53762306a36Sopenharmony_ci};
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_cistruct fifo_depth_select {
54062306a36Sopenharmony_ci	struct iga1_fifo_depth_select iga1_fifo_depth_select_reg;
54162306a36Sopenharmony_ci	struct iga2_fifo_depth_select iga2_fifo_depth_select_reg;
54262306a36Sopenharmony_ci};
54362306a36Sopenharmony_ci
54462306a36Sopenharmony_cistruct fifo_threshold_select {
54562306a36Sopenharmony_ci	struct iga1_fifo_threshold_select iga1_fifo_threshold_select_reg;
54662306a36Sopenharmony_ci	struct iga2_fifo_threshold_select iga2_fifo_threshold_select_reg;
54762306a36Sopenharmony_ci};
54862306a36Sopenharmony_ci
54962306a36Sopenharmony_cistruct fifo_high_threshold_select {
55062306a36Sopenharmony_ci	struct iga1_fifo_high_threshold_select
55162306a36Sopenharmony_ci	 iga1_fifo_high_threshold_select_reg;
55262306a36Sopenharmony_ci	struct iga2_fifo_high_threshold_select
55362306a36Sopenharmony_ci	 iga2_fifo_high_threshold_select_reg;
55462306a36Sopenharmony_ci};
55562306a36Sopenharmony_ci
55662306a36Sopenharmony_cistruct display_queue_expire_num {
55762306a36Sopenharmony_ci	struct iga1_display_queue_expire_num
55862306a36Sopenharmony_ci	 iga1_display_queue_expire_num_reg;
55962306a36Sopenharmony_ci	struct iga2_display_queue_expire_num
56062306a36Sopenharmony_ci	 iga2_display_queue_expire_num_reg;
56162306a36Sopenharmony_ci};
56262306a36Sopenharmony_ci
56362306a36Sopenharmony_cistruct iga2_shadow_crtc_timing {
56462306a36Sopenharmony_ci	struct iga2_shadow_hor_total hor_total_shadow;
56562306a36Sopenharmony_ci	struct iga2_shadow_hor_blank_end hor_blank_end_shadow;
56662306a36Sopenharmony_ci	struct iga2_shadow_ver_total ver_total_shadow;
56762306a36Sopenharmony_ci	struct iga2_shadow_ver_addr ver_addr_shadow;
56862306a36Sopenharmony_ci	struct iga2_shadow_ver_blank_start ver_blank_start_shadow;
56962306a36Sopenharmony_ci	struct iga2_shadow_ver_blank_end ver_blank_end_shadow;
57062306a36Sopenharmony_ci	struct iga2_shadow_ver_sync_start ver_sync_start_shadow;
57162306a36Sopenharmony_ci	struct iga2_shadow_ver_sync_end ver_sync_end_shadow;
57262306a36Sopenharmony_ci};
57362306a36Sopenharmony_ci
57462306a36Sopenharmony_ci/* device ID */
57562306a36Sopenharmony_ci#define CLE266_FUNCTION3    0x3123
57662306a36Sopenharmony_ci#define KM400_FUNCTION3     0x3205
57762306a36Sopenharmony_ci#define CN400_FUNCTION2     0x2259
57862306a36Sopenharmony_ci#define CN400_FUNCTION3     0x3259
57962306a36Sopenharmony_ci/* support VT3314 chipset */
58062306a36Sopenharmony_ci#define CN700_FUNCTION2     0x2314
58162306a36Sopenharmony_ci#define CN700_FUNCTION3     0x3208
58262306a36Sopenharmony_ci/* VT3324 chipset */
58362306a36Sopenharmony_ci#define CX700_FUNCTION2     0x2324
58462306a36Sopenharmony_ci#define CX700_FUNCTION3     0x3324
58562306a36Sopenharmony_ci/* VT3204 chipset*/
58662306a36Sopenharmony_ci#define KM800_FUNCTION3      0x3204
58762306a36Sopenharmony_ci/* VT3336 chipset*/
58862306a36Sopenharmony_ci#define KM890_FUNCTION3      0x3336
58962306a36Sopenharmony_ci/* VT3327 chipset*/
59062306a36Sopenharmony_ci#define P4M890_FUNCTION3     0x3327
59162306a36Sopenharmony_ci/* VT3293 chipset*/
59262306a36Sopenharmony_ci#define CN750_FUNCTION3     0x3208
59362306a36Sopenharmony_ci/* VT3364 chipset*/
59462306a36Sopenharmony_ci#define P4M900_FUNCTION3    0x3364
59562306a36Sopenharmony_ci/* VT3353 chipset*/
59662306a36Sopenharmony_ci#define VX800_FUNCTION3     0x3353
59762306a36Sopenharmony_ci/* VT3409 chipset*/
59862306a36Sopenharmony_ci#define VX855_FUNCTION3     0x3409
59962306a36Sopenharmony_ci/* VT3410 chipset*/
60062306a36Sopenharmony_ci#define VX900_FUNCTION3     0x3410
60162306a36Sopenharmony_ci
60262306a36Sopenharmony_cistruct IODATA {
60362306a36Sopenharmony_ci	u8 Index;
60462306a36Sopenharmony_ci	u8 Mask;
60562306a36Sopenharmony_ci	u8 Data;
60662306a36Sopenharmony_ci};
60762306a36Sopenharmony_ci
60862306a36Sopenharmony_cistruct pci_device_id_info {
60962306a36Sopenharmony_ci	u32 vendor;
61062306a36Sopenharmony_ci	u32 device;
61162306a36Sopenharmony_ci	u32 chip_index;
61262306a36Sopenharmony_ci};
61362306a36Sopenharmony_ci
61462306a36Sopenharmony_cistruct via_device_mapping {
61562306a36Sopenharmony_ci	u32 device;
61662306a36Sopenharmony_ci	const char *name;
61762306a36Sopenharmony_ci};
61862306a36Sopenharmony_ci
61962306a36Sopenharmony_ciextern int viafb_SAMM_ON;
62062306a36Sopenharmony_ciextern int viafb_dual_fb;
62162306a36Sopenharmony_ciextern int viafb_LCD2_ON;
62262306a36Sopenharmony_ciextern int viafb_LCD_ON;
62362306a36Sopenharmony_ciextern int viafb_DVI_ON;
62462306a36Sopenharmony_ciextern int viafb_hotplug;
62562306a36Sopenharmony_ci
62662306a36Sopenharmony_cistruct via_display_timing var_to_timing(const struct fb_var_screeninfo *var,
62762306a36Sopenharmony_ci	u16 cxres, u16 cyres);
62862306a36Sopenharmony_civoid viafb_fill_crtc_timing(const struct fb_var_screeninfo *var,
62962306a36Sopenharmony_ci	u16 cxres, u16 cyres, int iga);
63062306a36Sopenharmony_civoid viafb_set_vclock(u32 CLK, int set_iga);
63162306a36Sopenharmony_civoid viafb_load_reg(int timing_value, int viafb_load_reg_num,
63262306a36Sopenharmony_ci	struct io_register *reg,
63362306a36Sopenharmony_ci	      int io_type);
63462306a36Sopenharmony_civoid via_set_source(u32 devices, u8 iga);
63562306a36Sopenharmony_civoid via_set_state(u32 devices, u8 state);
63662306a36Sopenharmony_civoid via_set_sync_polarity(u32 devices, u8 polarity);
63762306a36Sopenharmony_ciu32 via_parse_odev(char *input, char **end);
63862306a36Sopenharmony_civoid via_odev_to_seq(struct seq_file *m, u32 odev);
63962306a36Sopenharmony_civoid init_ad9389(void);
64062306a36Sopenharmony_ci/* Access I/O Function */
64162306a36Sopenharmony_civoid viafb_lock_crt(void);
64262306a36Sopenharmony_civoid viafb_unlock_crt(void);
64362306a36Sopenharmony_civoid viafb_load_fetch_count_reg(int h_addr, int bpp_byte, int set_iga);
64462306a36Sopenharmony_civoid viafb_write_regx(struct io_reg RegTable[], int ItemNum);
64562306a36Sopenharmony_civoid viafb_load_FIFO_reg(int set_iga, int hor_active, int ver_active);
64662306a36Sopenharmony_civoid viafb_set_dpa_gfx(int output_interface, struct GFX_DPA_SETTING\
64762306a36Sopenharmony_ci					*p_gfx_dpa_setting);
64862306a36Sopenharmony_ci
64962306a36Sopenharmony_ciint viafb_setmode(void);
65062306a36Sopenharmony_civoid viafb_fill_var_timing_info(struct fb_var_screeninfo *var,
65162306a36Sopenharmony_ci	const struct fb_videomode *mode);
65262306a36Sopenharmony_civoid viafb_init_chip_info(int chip_type);
65362306a36Sopenharmony_civoid viafb_init_dac(int set_iga);
65462306a36Sopenharmony_ciint viafb_get_refresh(int hres, int vres, u32 float_refresh);
65562306a36Sopenharmony_civoid viafb_update_device_setting(int hres, int vres, int bpp, int flag);
65662306a36Sopenharmony_ci
65762306a36Sopenharmony_civoid viafb_set_iga_path(void);
65862306a36Sopenharmony_civoid viafb_set_primary_color_register(u8 index, u8 red, u8 green, u8 blue);
65962306a36Sopenharmony_civoid viafb_set_secondary_color_register(u8 index, u8 red, u8 green, u8 blue);
66062306a36Sopenharmony_civoid viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len);
66162306a36Sopenharmony_ci
66262306a36Sopenharmony_ci#endif /* __HW_H__ */
663