18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
48c2ecf20Sopenharmony_ci * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __HW_H__
98c2ecf20Sopenharmony_ci#define __HW_H__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/seq_file.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include "viamode.h"
148c2ecf20Sopenharmony_ci#include "global.h"
158c2ecf20Sopenharmony_ci#include "via_modesetting.h"
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define viafb_read_reg(p, i)			via_read_reg(p, i)
188c2ecf20Sopenharmony_ci#define viafb_write_reg(i, p, d)		via_write_reg(p, i, d)
198c2ecf20Sopenharmony_ci#define viafb_write_reg_mask(i, p, d, m)	via_write_reg_mask(p, i, d, m)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* VIA output devices */
228c2ecf20Sopenharmony_ci#define VIA_LDVP0	0x00000001
238c2ecf20Sopenharmony_ci#define VIA_LDVP1	0x00000002
248c2ecf20Sopenharmony_ci#define VIA_DVP0	0x00000004
258c2ecf20Sopenharmony_ci#define VIA_CRT		0x00000010
268c2ecf20Sopenharmony_ci#define VIA_DVP1	0x00000020
278c2ecf20Sopenharmony_ci#define VIA_LVDS1	0x00000040
288c2ecf20Sopenharmony_ci#define VIA_LVDS2	0x00000080
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/* VIA output device power states */
318c2ecf20Sopenharmony_ci#define VIA_STATE_ON		0
328c2ecf20Sopenharmony_ci#define VIA_STATE_STANDBY	1
338c2ecf20Sopenharmony_ci#define VIA_STATE_SUSPEND	2
348c2ecf20Sopenharmony_ci#define VIA_STATE_OFF		3
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* VIA output device sync polarity */
378c2ecf20Sopenharmony_ci#define VIA_HSYNC_NEGATIVE	0x01
388c2ecf20Sopenharmony_ci#define VIA_VSYNC_NEGATIVE	0x02
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/**********************************************************/
418c2ecf20Sopenharmony_ci/* Definition IGA2 Design Method of CRTC Shadow Registers */
428c2ecf20Sopenharmony_ci/**********************************************************/
438c2ecf20Sopenharmony_ci#define IGA2_HOR_TOTAL_SHADOW_FORMULA(x)           ((x/8)-5)
448c2ecf20Sopenharmony_ci#define IGA2_HOR_BLANK_END_SHADOW_FORMULA(x, y)     (((x+y)/8)-1)
458c2ecf20Sopenharmony_ci#define IGA2_VER_TOTAL_SHADOW_FORMULA(x)           ((x)-2)
468c2ecf20Sopenharmony_ci#define IGA2_VER_ADDR_SHADOW_FORMULA(x)            ((x)-1)
478c2ecf20Sopenharmony_ci#define IGA2_VER_BLANK_START_SHADOW_FORMULA(x)     ((x)-1)
488c2ecf20Sopenharmony_ci#define IGA2_VER_BLANK_END_SHADOW_FORMULA(x, y)     ((x+y)-1)
498c2ecf20Sopenharmony_ci#define IGA2_VER_SYNC_START_SHADOW_FORMULA(x)      (x)
508c2ecf20Sopenharmony_ci#define IGA2_VER_SYNC_END_SHADOW_FORMULA(x, y)      (x+y)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* Define Register Number for IGA2 Shadow CRTC Timing */
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/* location: {CR6D,0,7},{CR71,3,3} */
558c2ecf20Sopenharmony_ci#define IGA2_SHADOW_HOR_TOTAL_REG_NUM       2
568c2ecf20Sopenharmony_ci/* location: {CR6E,0,7} */
578c2ecf20Sopenharmony_ci#define IGA2_SHADOW_HOR_BLANK_END_REG_NUM   1
588c2ecf20Sopenharmony_ci/* location: {CR6F,0,7},{CR71,0,2} */
598c2ecf20Sopenharmony_ci#define IGA2_SHADOW_VER_TOTAL_REG_NUM       2
608c2ecf20Sopenharmony_ci/* location: {CR70,0,7},{CR71,4,6} */
618c2ecf20Sopenharmony_ci#define IGA2_SHADOW_VER_ADDR_REG_NUM        2
628c2ecf20Sopenharmony_ci/* location: {CR72,0,7},{CR74,4,6} */
638c2ecf20Sopenharmony_ci#define IGA2_SHADOW_VER_BLANK_START_REG_NUM 2
648c2ecf20Sopenharmony_ci/* location: {CR73,0,7},{CR74,0,2} */
658c2ecf20Sopenharmony_ci#define IGA2_SHADOW_VER_BLANK_END_REG_NUM   2
668c2ecf20Sopenharmony_ci/* location: {CR75,0,7},{CR76,4,6} */
678c2ecf20Sopenharmony_ci#define IGA2_SHADOW_VER_SYNC_START_REG_NUM  2
688c2ecf20Sopenharmony_ci/* location: {CR76,0,3} */
698c2ecf20Sopenharmony_ci#define IGA2_SHADOW_VER_SYNC_END_REG_NUM    1
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/* Define Fetch Count Register*/
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci/* location: {SR1C,0,7},{SR1D,0,1} */
748c2ecf20Sopenharmony_ci#define IGA1_FETCH_COUNT_REG_NUM        2
758c2ecf20Sopenharmony_ci/* 16 bytes alignment. */
768c2ecf20Sopenharmony_ci#define IGA1_FETCH_COUNT_ALIGN_BYTE     16
778c2ecf20Sopenharmony_ci/* x: H resolution, y: color depth */
788c2ecf20Sopenharmony_ci#define IGA1_FETCH_COUNT_PATCH_VALUE    4
798c2ecf20Sopenharmony_ci#define IGA1_FETCH_COUNT_FORMULA(x, y)   \
808c2ecf20Sopenharmony_ci	(((x*y)/IGA1_FETCH_COUNT_ALIGN_BYTE) + IGA1_FETCH_COUNT_PATCH_VALUE)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci/* location: {CR65,0,7},{CR67,2,3} */
838c2ecf20Sopenharmony_ci#define IGA2_FETCH_COUNT_REG_NUM        2
848c2ecf20Sopenharmony_ci#define IGA2_FETCH_COUNT_ALIGN_BYTE     16
858c2ecf20Sopenharmony_ci#define IGA2_FETCH_COUNT_PATCH_VALUE    0
868c2ecf20Sopenharmony_ci#define IGA2_FETCH_COUNT_FORMULA(x, y)   \
878c2ecf20Sopenharmony_ci	(((x*y)/IGA2_FETCH_COUNT_ALIGN_BYTE) + IGA2_FETCH_COUNT_PATCH_VALUE)
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci/* Staring Address*/
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci/* location: {CR0C,0,7},{CR0D,0,7},{CR34,0,7},{CR48,0,1} */
928c2ecf20Sopenharmony_ci#define IGA1_STARTING_ADDR_REG_NUM      4
938c2ecf20Sopenharmony_ci/* location: {CR62,1,7},{CR63,0,7},{CR64,0,7} */
948c2ecf20Sopenharmony_ci#define IGA2_STARTING_ADDR_REG_NUM      3
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci/* Define Display OFFSET*/
978c2ecf20Sopenharmony_ci/* These value are by HW suggested value*/
988c2ecf20Sopenharmony_ci/* location: {SR17,0,7} */
998c2ecf20Sopenharmony_ci#define K800_IGA1_FIFO_MAX_DEPTH                384
1008c2ecf20Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
1018c2ecf20Sopenharmony_ci#define K800_IGA1_FIFO_THRESHOLD                328
1028c2ecf20Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
1038c2ecf20Sopenharmony_ci#define K800_IGA1_FIFO_HIGH_THRESHOLD           296
1048c2ecf20Sopenharmony_ci/* location: {SR22,0,4}. (128/4) =64, K800 must be set zero, */
1058c2ecf20Sopenharmony_ci				/* because HW only 5 bits */
1068c2ecf20Sopenharmony_ci#define K800_IGA1_DISPLAY_QUEUE_EXPIRE_NUM      0
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
1098c2ecf20Sopenharmony_ci#define K800_IGA2_FIFO_MAX_DEPTH                384
1108c2ecf20Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
1118c2ecf20Sopenharmony_ci#define K800_IGA2_FIFO_THRESHOLD                328
1128c2ecf20Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
1138c2ecf20Sopenharmony_ci#define K800_IGA2_FIFO_HIGH_THRESHOLD           296
1148c2ecf20Sopenharmony_ci/* location: {CR94,0,6} */
1158c2ecf20Sopenharmony_ci#define K800_IGA2_DISPLAY_QUEUE_EXPIRE_NUM      128
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci/* location: {SR17,0,7} */
1188c2ecf20Sopenharmony_ci#define P880_IGA1_FIFO_MAX_DEPTH                192
1198c2ecf20Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
1208c2ecf20Sopenharmony_ci#define P880_IGA1_FIFO_THRESHOLD                128
1218c2ecf20Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
1228c2ecf20Sopenharmony_ci#define P880_IGA1_FIFO_HIGH_THRESHOLD           64
1238c2ecf20Sopenharmony_ci/* location: {SR22,0,4}. (128/4) =64, K800 must be set zero, */
1248c2ecf20Sopenharmony_ci				/* because HW only 5 bits */
1258c2ecf20Sopenharmony_ci#define P880_IGA1_DISPLAY_QUEUE_EXPIRE_NUM      0
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
1288c2ecf20Sopenharmony_ci#define P880_IGA2_FIFO_MAX_DEPTH                96
1298c2ecf20Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
1308c2ecf20Sopenharmony_ci#define P880_IGA2_FIFO_THRESHOLD                64
1318c2ecf20Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
1328c2ecf20Sopenharmony_ci#define P880_IGA2_FIFO_HIGH_THRESHOLD           32
1338c2ecf20Sopenharmony_ci/* location: {CR94,0,6} */
1348c2ecf20Sopenharmony_ci#define P880_IGA2_DISPLAY_QUEUE_EXPIRE_NUM      128
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci/* VT3314 chipset*/
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci/* location: {SR17,0,7} */
1398c2ecf20Sopenharmony_ci#define CN700_IGA1_FIFO_MAX_DEPTH               96
1408c2ecf20Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
1418c2ecf20Sopenharmony_ci#define CN700_IGA1_FIFO_THRESHOLD               80
1428c2ecf20Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
1438c2ecf20Sopenharmony_ci#define CN700_IGA1_FIFO_HIGH_THRESHOLD          64
1448c2ecf20Sopenharmony_ci/* location: {SR22,0,4}. (128/4) =64, P800 must be set zero,
1458c2ecf20Sopenharmony_ci				because HW only 5 bits */
1468c2ecf20Sopenharmony_ci#define CN700_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     0
1478c2ecf20Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
1488c2ecf20Sopenharmony_ci#define CN700_IGA2_FIFO_MAX_DEPTH               96
1498c2ecf20Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
1508c2ecf20Sopenharmony_ci#define CN700_IGA2_FIFO_THRESHOLD               80
1518c2ecf20Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
1528c2ecf20Sopenharmony_ci#define CN700_IGA2_FIFO_HIGH_THRESHOLD          32
1538c2ecf20Sopenharmony_ci/* location: {CR94,0,6} */
1548c2ecf20Sopenharmony_ci#define CN700_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     128
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci/* For VT3324, these values are suggested by HW */
1578c2ecf20Sopenharmony_ci/* location: {SR17,0,7} */
1588c2ecf20Sopenharmony_ci#define CX700_IGA1_FIFO_MAX_DEPTH               192
1598c2ecf20Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
1608c2ecf20Sopenharmony_ci#define CX700_IGA1_FIFO_THRESHOLD               128
1618c2ecf20Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
1628c2ecf20Sopenharmony_ci#define CX700_IGA1_FIFO_HIGH_THRESHOLD          128
1638c2ecf20Sopenharmony_ci/* location: {SR22,0,4} */
1648c2ecf20Sopenharmony_ci#define CX700_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     124
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
1678c2ecf20Sopenharmony_ci#define CX700_IGA2_FIFO_MAX_DEPTH               96
1688c2ecf20Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
1698c2ecf20Sopenharmony_ci#define CX700_IGA2_FIFO_THRESHOLD               64
1708c2ecf20Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
1718c2ecf20Sopenharmony_ci#define CX700_IGA2_FIFO_HIGH_THRESHOLD          32
1728c2ecf20Sopenharmony_ci/* location: {CR94,0,6} */
1738c2ecf20Sopenharmony_ci#define CX700_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     128
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci/* VT3336 chipset*/
1768c2ecf20Sopenharmony_ci/* location: {SR17,0,7} */
1778c2ecf20Sopenharmony_ci#define K8M890_IGA1_FIFO_MAX_DEPTH               360
1788c2ecf20Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
1798c2ecf20Sopenharmony_ci#define K8M890_IGA1_FIFO_THRESHOLD               328
1808c2ecf20Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
1818c2ecf20Sopenharmony_ci#define K8M890_IGA1_FIFO_HIGH_THRESHOLD          296
1828c2ecf20Sopenharmony_ci/* location: {SR22,0,4}. */
1838c2ecf20Sopenharmony_ci#define K8M890_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     124
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
1868c2ecf20Sopenharmony_ci#define K8M890_IGA2_FIFO_MAX_DEPTH               360
1878c2ecf20Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
1888c2ecf20Sopenharmony_ci#define K8M890_IGA2_FIFO_THRESHOLD               328
1898c2ecf20Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
1908c2ecf20Sopenharmony_ci#define K8M890_IGA2_FIFO_HIGH_THRESHOLD          296
1918c2ecf20Sopenharmony_ci/* location: {CR94,0,6} */
1928c2ecf20Sopenharmony_ci#define K8M890_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     124
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci/* VT3327 chipset*/
1958c2ecf20Sopenharmony_ci/* location: {SR17,0,7} */
1968c2ecf20Sopenharmony_ci#define P4M890_IGA1_FIFO_MAX_DEPTH               96
1978c2ecf20Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
1988c2ecf20Sopenharmony_ci#define P4M890_IGA1_FIFO_THRESHOLD               76
1998c2ecf20Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
2008c2ecf20Sopenharmony_ci#define P4M890_IGA1_FIFO_HIGH_THRESHOLD          64
2018c2ecf20Sopenharmony_ci/* location: {SR22,0,4}. (32/4) =8 */
2028c2ecf20Sopenharmony_ci#define P4M890_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     32
2038c2ecf20Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
2048c2ecf20Sopenharmony_ci#define P4M890_IGA2_FIFO_MAX_DEPTH               96
2058c2ecf20Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
2068c2ecf20Sopenharmony_ci#define P4M890_IGA2_FIFO_THRESHOLD               76
2078c2ecf20Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
2088c2ecf20Sopenharmony_ci#define P4M890_IGA2_FIFO_HIGH_THRESHOLD          64
2098c2ecf20Sopenharmony_ci/* location: {CR94,0,6} */
2108c2ecf20Sopenharmony_ci#define P4M890_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     32
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci/* VT3364 chipset*/
2138c2ecf20Sopenharmony_ci/* location: {SR17,0,7} */
2148c2ecf20Sopenharmony_ci#define P4M900_IGA1_FIFO_MAX_DEPTH               96
2158c2ecf20Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
2168c2ecf20Sopenharmony_ci#define P4M900_IGA1_FIFO_THRESHOLD               76
2178c2ecf20Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
2188c2ecf20Sopenharmony_ci#define P4M900_IGA1_FIFO_HIGH_THRESHOLD          76
2198c2ecf20Sopenharmony_ci/* location: {SR22,0,4}. */
2208c2ecf20Sopenharmony_ci#define P4M900_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     32
2218c2ecf20Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
2228c2ecf20Sopenharmony_ci#define P4M900_IGA2_FIFO_MAX_DEPTH               96
2238c2ecf20Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
2248c2ecf20Sopenharmony_ci#define P4M900_IGA2_FIFO_THRESHOLD               76
2258c2ecf20Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
2268c2ecf20Sopenharmony_ci#define P4M900_IGA2_FIFO_HIGH_THRESHOLD          76
2278c2ecf20Sopenharmony_ci/* location: {CR94,0,6} */
2288c2ecf20Sopenharmony_ci#define P4M900_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     32
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci/* For VT3353, these values are suggested by HW */
2318c2ecf20Sopenharmony_ci/* location: {SR17,0,7} */
2328c2ecf20Sopenharmony_ci#define VX800_IGA1_FIFO_MAX_DEPTH               192
2338c2ecf20Sopenharmony_ci/* location: {SR16,0,5},{SR16,7,7} */
2348c2ecf20Sopenharmony_ci#define VX800_IGA1_FIFO_THRESHOLD               152
2358c2ecf20Sopenharmony_ci/* location: {SR18,0,5},{SR18,7,7} */
2368c2ecf20Sopenharmony_ci#define VX800_IGA1_FIFO_HIGH_THRESHOLD          152
2378c2ecf20Sopenharmony_ci/* location: {SR22,0,4} */
2388c2ecf20Sopenharmony_ci#define VX800_IGA1_DISPLAY_QUEUE_EXPIRE_NUM      64
2398c2ecf20Sopenharmony_ci/* location: {CR68,4,7},{CR94,7,7},{CR95,7,7} */
2408c2ecf20Sopenharmony_ci#define VX800_IGA2_FIFO_MAX_DEPTH               96
2418c2ecf20Sopenharmony_ci/* location: {CR68,0,3},{CR95,4,6} */
2428c2ecf20Sopenharmony_ci#define VX800_IGA2_FIFO_THRESHOLD               64
2438c2ecf20Sopenharmony_ci/* location: {CR92,0,3},{CR95,0,2} */
2448c2ecf20Sopenharmony_ci#define VX800_IGA2_FIFO_HIGH_THRESHOLD          32
2458c2ecf20Sopenharmony_ci/* location: {CR94,0,6} */
2468c2ecf20Sopenharmony_ci#define VX800_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     128
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci/* For VT3409 */
2498c2ecf20Sopenharmony_ci#define VX855_IGA1_FIFO_MAX_DEPTH               400
2508c2ecf20Sopenharmony_ci#define VX855_IGA1_FIFO_THRESHOLD               320
2518c2ecf20Sopenharmony_ci#define VX855_IGA1_FIFO_HIGH_THRESHOLD          320
2528c2ecf20Sopenharmony_ci#define VX855_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     160
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci#define VX855_IGA2_FIFO_MAX_DEPTH               200
2558c2ecf20Sopenharmony_ci#define VX855_IGA2_FIFO_THRESHOLD               160
2568c2ecf20Sopenharmony_ci#define VX855_IGA2_FIFO_HIGH_THRESHOLD          160
2578c2ecf20Sopenharmony_ci#define VX855_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     320
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci/* For VT3410 */
2608c2ecf20Sopenharmony_ci#define VX900_IGA1_FIFO_MAX_DEPTH               400
2618c2ecf20Sopenharmony_ci#define VX900_IGA1_FIFO_THRESHOLD               320
2628c2ecf20Sopenharmony_ci#define VX900_IGA1_FIFO_HIGH_THRESHOLD          320
2638c2ecf20Sopenharmony_ci#define VX900_IGA1_DISPLAY_QUEUE_EXPIRE_NUM     160
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci#define VX900_IGA2_FIFO_MAX_DEPTH               192
2668c2ecf20Sopenharmony_ci#define VX900_IGA2_FIFO_THRESHOLD               160
2678c2ecf20Sopenharmony_ci#define VX900_IGA2_FIFO_HIGH_THRESHOLD          160
2688c2ecf20Sopenharmony_ci#define VX900_IGA2_DISPLAY_QUEUE_EXPIRE_NUM     320
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ci#define IGA1_FIFO_DEPTH_SELECT_REG_NUM          1
2718c2ecf20Sopenharmony_ci#define IGA1_FIFO_THRESHOLD_REG_NUM             2
2728c2ecf20Sopenharmony_ci#define IGA1_FIFO_HIGH_THRESHOLD_REG_NUM        2
2738c2ecf20Sopenharmony_ci#define IGA1_DISPLAY_QUEUE_EXPIRE_NUM_REG_NUM   1
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci#define IGA2_FIFO_DEPTH_SELECT_REG_NUM          3
2768c2ecf20Sopenharmony_ci#define IGA2_FIFO_THRESHOLD_REG_NUM             2
2778c2ecf20Sopenharmony_ci#define IGA2_FIFO_HIGH_THRESHOLD_REG_NUM        2
2788c2ecf20Sopenharmony_ci#define IGA2_DISPLAY_QUEUE_EXPIRE_NUM_REG_NUM   1
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci#define IGA1_FIFO_DEPTH_SELECT_FORMULA(x)                   ((x/2)-1)
2818c2ecf20Sopenharmony_ci#define IGA1_FIFO_THRESHOLD_FORMULA(x)                      (x/4)
2828c2ecf20Sopenharmony_ci#define IGA1_DISPLAY_QUEUE_EXPIRE_NUM_FORMULA(x)            (x/4)
2838c2ecf20Sopenharmony_ci#define IGA1_FIFO_HIGH_THRESHOLD_FORMULA(x)                 (x/4)
2848c2ecf20Sopenharmony_ci#define IGA2_FIFO_DEPTH_SELECT_FORMULA(x)                   (((x/2)/4)-1)
2858c2ecf20Sopenharmony_ci#define IGA2_FIFO_THRESHOLD_FORMULA(x)                      (x/4)
2868c2ecf20Sopenharmony_ci#define IGA2_DISPLAY_QUEUE_EXPIRE_NUM_FORMULA(x)            (x/4)
2878c2ecf20Sopenharmony_ci#define IGA2_FIFO_HIGH_THRESHOLD_FORMULA(x)                 (x/4)
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci/************************************************************************/
2908c2ecf20Sopenharmony_ci/*  LCD Timing                                                          */
2918c2ecf20Sopenharmony_ci/************************************************************************/
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci/* 500 ms = 500000 us */
2948c2ecf20Sopenharmony_ci#define LCD_POWER_SEQ_TD0               500000
2958c2ecf20Sopenharmony_ci/* 50 ms = 50000 us */
2968c2ecf20Sopenharmony_ci#define LCD_POWER_SEQ_TD1               50000
2978c2ecf20Sopenharmony_ci/* 0 us */
2988c2ecf20Sopenharmony_ci#define LCD_POWER_SEQ_TD2               0
2998c2ecf20Sopenharmony_ci/* 210 ms = 210000 us */
3008c2ecf20Sopenharmony_ci#define LCD_POWER_SEQ_TD3               210000
3018c2ecf20Sopenharmony_ci/* 2^10 * (1/14.31818M) = 71.475 us (K400.revA) */
3028c2ecf20Sopenharmony_ci#define CLE266_POWER_SEQ_UNIT           71
3038c2ecf20Sopenharmony_ci/* 2^11 * (1/14.31818M) = 142.95 us (K400.revB) */
3048c2ecf20Sopenharmony_ci#define K800_POWER_SEQ_UNIT             142
3058c2ecf20Sopenharmony_ci/* 2^13 * (1/14.31818M) = 572.1 us */
3068c2ecf20Sopenharmony_ci#define P880_POWER_SEQ_UNIT             572
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci#define CLE266_POWER_SEQ_FORMULA(x)     ((x)/CLE266_POWER_SEQ_UNIT)
3098c2ecf20Sopenharmony_ci#define K800_POWER_SEQ_FORMULA(x)       ((x)/K800_POWER_SEQ_UNIT)
3108c2ecf20Sopenharmony_ci#define P880_POWER_SEQ_FORMULA(x)       ((x)/P880_POWER_SEQ_UNIT)
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci/* location: {CR8B,0,7},{CR8F,0,3} */
3138c2ecf20Sopenharmony_ci#define LCD_POWER_SEQ_TD0_REG_NUM       2
3148c2ecf20Sopenharmony_ci/* location: {CR8C,0,7},{CR8F,4,7} */
3158c2ecf20Sopenharmony_ci#define LCD_POWER_SEQ_TD1_REG_NUM       2
3168c2ecf20Sopenharmony_ci/* location: {CR8D,0,7},{CR90,0,3} */
3178c2ecf20Sopenharmony_ci#define LCD_POWER_SEQ_TD2_REG_NUM       2
3188c2ecf20Sopenharmony_ci/* location: {CR8E,0,7},{CR90,4,7} */
3198c2ecf20Sopenharmony_ci#define LCD_POWER_SEQ_TD3_REG_NUM       2
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci/* LCD Scaling factor*/
3228c2ecf20Sopenharmony_ci/* x: indicate setting horizontal size*/
3238c2ecf20Sopenharmony_ci/* y: indicate panel horizontal size*/
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci/* Horizontal scaling factor 10 bits (2^10) */
3268c2ecf20Sopenharmony_ci#define CLE266_LCD_HOR_SCF_FORMULA(x, y)   (((x-1)*1024)/(y-1))
3278c2ecf20Sopenharmony_ci/* Vertical scaling factor 10 bits (2^10) */
3288c2ecf20Sopenharmony_ci#define CLE266_LCD_VER_SCF_FORMULA(x, y)   (((x-1)*1024)/(y-1))
3298c2ecf20Sopenharmony_ci/* Horizontal scaling factor 10 bits (2^12) */
3308c2ecf20Sopenharmony_ci#define K800_LCD_HOR_SCF_FORMULA(x, y)     (((x-1)*4096)/(y-1))
3318c2ecf20Sopenharmony_ci/* Vertical scaling factor 10 bits (2^11) */
3328c2ecf20Sopenharmony_ci#define K800_LCD_VER_SCF_FORMULA(x, y)     (((x-1)*2048)/(y-1))
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci/* location: {CR9F,0,1},{CR77,0,7},{CR79,4,5} */
3358c2ecf20Sopenharmony_ci#define LCD_HOR_SCALING_FACTOR_REG_NUM  3
3368c2ecf20Sopenharmony_ci/* location: {CR79,3,3},{CR78,0,7},{CR79,6,7} */
3378c2ecf20Sopenharmony_ci#define LCD_VER_SCALING_FACTOR_REG_NUM  3
3388c2ecf20Sopenharmony_ci/* location: {CR77,0,7},{CR79,4,5} */
3398c2ecf20Sopenharmony_ci#define LCD_HOR_SCALING_FACTOR_REG_NUM_CLE  2
3408c2ecf20Sopenharmony_ci/* location: {CR78,0,7},{CR79,6,7} */
3418c2ecf20Sopenharmony_ci#define LCD_VER_SCALING_FACTOR_REG_NUM_CLE  2
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_cistruct io_register {
3448c2ecf20Sopenharmony_ci	u8 io_addr;
3458c2ecf20Sopenharmony_ci	u8 start_bit;
3468c2ecf20Sopenharmony_ci	u8 end_bit;
3478c2ecf20Sopenharmony_ci};
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci/*****************************************************
3508c2ecf20Sopenharmony_ci**      Define IGA2 Shadow Display Timing         ****
3518c2ecf20Sopenharmony_ci*****************************************************/
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ci/* IGA2 Shadow Horizontal Total */
3548c2ecf20Sopenharmony_cistruct iga2_shadow_hor_total {
3558c2ecf20Sopenharmony_ci	int reg_num;
3568c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_HOR_TOTAL_REG_NUM];
3578c2ecf20Sopenharmony_ci};
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci/* IGA2 Shadow Horizontal Blank End */
3608c2ecf20Sopenharmony_cistruct iga2_shadow_hor_blank_end {
3618c2ecf20Sopenharmony_ci	int reg_num;
3628c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_HOR_BLANK_END_REG_NUM];
3638c2ecf20Sopenharmony_ci};
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_ci/* IGA2 Shadow Vertical Total */
3668c2ecf20Sopenharmony_cistruct iga2_shadow_ver_total {
3678c2ecf20Sopenharmony_ci	int reg_num;
3688c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_VER_TOTAL_REG_NUM];
3698c2ecf20Sopenharmony_ci};
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci/* IGA2 Shadow Vertical Addressable Video */
3728c2ecf20Sopenharmony_cistruct iga2_shadow_ver_addr {
3738c2ecf20Sopenharmony_ci	int reg_num;
3748c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_VER_ADDR_REG_NUM];
3758c2ecf20Sopenharmony_ci};
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ci/* IGA2 Shadow Vertical Blank Start */
3788c2ecf20Sopenharmony_cistruct iga2_shadow_ver_blank_start {
3798c2ecf20Sopenharmony_ci	int reg_num;
3808c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_VER_BLANK_START_REG_NUM];
3818c2ecf20Sopenharmony_ci};
3828c2ecf20Sopenharmony_ci
3838c2ecf20Sopenharmony_ci/* IGA2 Shadow Vertical Blank End */
3848c2ecf20Sopenharmony_cistruct iga2_shadow_ver_blank_end {
3858c2ecf20Sopenharmony_ci	int reg_num;
3868c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_VER_BLANK_END_REG_NUM];
3878c2ecf20Sopenharmony_ci};
3888c2ecf20Sopenharmony_ci
3898c2ecf20Sopenharmony_ci/* IGA2 Shadow Vertical Sync Start */
3908c2ecf20Sopenharmony_cistruct iga2_shadow_ver_sync_start {
3918c2ecf20Sopenharmony_ci	int reg_num;
3928c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_VER_SYNC_START_REG_NUM];
3938c2ecf20Sopenharmony_ci};
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci/* IGA2 Shadow Vertical Sync End */
3968c2ecf20Sopenharmony_cistruct iga2_shadow_ver_sync_end {
3978c2ecf20Sopenharmony_ci	int reg_num;
3988c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_SHADOW_VER_SYNC_END_REG_NUM];
3998c2ecf20Sopenharmony_ci};
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci/* IGA1 Fetch Count Register */
4028c2ecf20Sopenharmony_cistruct iga1_fetch_count {
4038c2ecf20Sopenharmony_ci	int reg_num;
4048c2ecf20Sopenharmony_ci	struct io_register reg[IGA1_FETCH_COUNT_REG_NUM];
4058c2ecf20Sopenharmony_ci};
4068c2ecf20Sopenharmony_ci
4078c2ecf20Sopenharmony_ci/* IGA2 Fetch Count Register */
4088c2ecf20Sopenharmony_cistruct iga2_fetch_count {
4098c2ecf20Sopenharmony_ci	int reg_num;
4108c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_FETCH_COUNT_REG_NUM];
4118c2ecf20Sopenharmony_ci};
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_cistruct fetch_count {
4148c2ecf20Sopenharmony_ci	struct iga1_fetch_count iga1_fetch_count_reg;
4158c2ecf20Sopenharmony_ci	struct iga2_fetch_count iga2_fetch_count_reg;
4168c2ecf20Sopenharmony_ci};
4178c2ecf20Sopenharmony_ci
4188c2ecf20Sopenharmony_ci/* Starting Address Register */
4198c2ecf20Sopenharmony_cistruct iga1_starting_addr {
4208c2ecf20Sopenharmony_ci	int reg_num;
4218c2ecf20Sopenharmony_ci	struct io_register reg[IGA1_STARTING_ADDR_REG_NUM];
4228c2ecf20Sopenharmony_ci};
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_cistruct iga2_starting_addr {
4258c2ecf20Sopenharmony_ci	int reg_num;
4268c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_STARTING_ADDR_REG_NUM];
4278c2ecf20Sopenharmony_ci};
4288c2ecf20Sopenharmony_ci
4298c2ecf20Sopenharmony_cistruct starting_addr {
4308c2ecf20Sopenharmony_ci	struct iga1_starting_addr iga1_starting_addr_reg;
4318c2ecf20Sopenharmony_ci	struct iga2_starting_addr iga2_starting_addr_reg;
4328c2ecf20Sopenharmony_ci};
4338c2ecf20Sopenharmony_ci
4348c2ecf20Sopenharmony_ci/* LCD Power Sequence Timer */
4358c2ecf20Sopenharmony_cistruct lcd_pwd_seq_td0 {
4368c2ecf20Sopenharmony_ci	int reg_num;
4378c2ecf20Sopenharmony_ci	struct io_register reg[LCD_POWER_SEQ_TD0_REG_NUM];
4388c2ecf20Sopenharmony_ci};
4398c2ecf20Sopenharmony_ci
4408c2ecf20Sopenharmony_cistruct lcd_pwd_seq_td1 {
4418c2ecf20Sopenharmony_ci	int reg_num;
4428c2ecf20Sopenharmony_ci	struct io_register reg[LCD_POWER_SEQ_TD1_REG_NUM];
4438c2ecf20Sopenharmony_ci};
4448c2ecf20Sopenharmony_ci
4458c2ecf20Sopenharmony_cistruct lcd_pwd_seq_td2 {
4468c2ecf20Sopenharmony_ci	int reg_num;
4478c2ecf20Sopenharmony_ci	struct io_register reg[LCD_POWER_SEQ_TD2_REG_NUM];
4488c2ecf20Sopenharmony_ci};
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_cistruct lcd_pwd_seq_td3 {
4518c2ecf20Sopenharmony_ci	int reg_num;
4528c2ecf20Sopenharmony_ci	struct io_register reg[LCD_POWER_SEQ_TD3_REG_NUM];
4538c2ecf20Sopenharmony_ci};
4548c2ecf20Sopenharmony_ci
4558c2ecf20Sopenharmony_cistruct _lcd_pwd_seq_timer {
4568c2ecf20Sopenharmony_ci	struct lcd_pwd_seq_td0 td0;
4578c2ecf20Sopenharmony_ci	struct lcd_pwd_seq_td1 td1;
4588c2ecf20Sopenharmony_ci	struct lcd_pwd_seq_td2 td2;
4598c2ecf20Sopenharmony_ci	struct lcd_pwd_seq_td3 td3;
4608c2ecf20Sopenharmony_ci};
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_ci/* LCD Scaling Factor */
4638c2ecf20Sopenharmony_cistruct _lcd_hor_scaling_factor {
4648c2ecf20Sopenharmony_ci	int reg_num;
4658c2ecf20Sopenharmony_ci	struct io_register reg[LCD_HOR_SCALING_FACTOR_REG_NUM];
4668c2ecf20Sopenharmony_ci};
4678c2ecf20Sopenharmony_ci
4688c2ecf20Sopenharmony_cistruct _lcd_ver_scaling_factor {
4698c2ecf20Sopenharmony_ci	int reg_num;
4708c2ecf20Sopenharmony_ci	struct io_register reg[LCD_VER_SCALING_FACTOR_REG_NUM];
4718c2ecf20Sopenharmony_ci};
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_cistruct _lcd_scaling_factor {
4748c2ecf20Sopenharmony_ci	struct _lcd_hor_scaling_factor lcd_hor_scaling_factor;
4758c2ecf20Sopenharmony_ci	struct _lcd_ver_scaling_factor lcd_ver_scaling_factor;
4768c2ecf20Sopenharmony_ci};
4778c2ecf20Sopenharmony_ci
4788c2ecf20Sopenharmony_cistruct pll_limit {
4798c2ecf20Sopenharmony_ci	u16 multiplier_min;
4808c2ecf20Sopenharmony_ci	u16 multiplier_max;
4818c2ecf20Sopenharmony_ci	u8 divisor;
4828c2ecf20Sopenharmony_ci	u8 rshift;
4838c2ecf20Sopenharmony_ci};
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_cistruct rgbLUT {
4868c2ecf20Sopenharmony_ci	u8 red;
4878c2ecf20Sopenharmony_ci	u8 green;
4888c2ecf20Sopenharmony_ci	u8 blue;
4898c2ecf20Sopenharmony_ci};
4908c2ecf20Sopenharmony_ci
4918c2ecf20Sopenharmony_cistruct lcd_pwd_seq_timer {
4928c2ecf20Sopenharmony_ci	u16 td0;
4938c2ecf20Sopenharmony_ci	u16 td1;
4948c2ecf20Sopenharmony_ci	u16 td2;
4958c2ecf20Sopenharmony_ci	u16 td3;
4968c2ecf20Sopenharmony_ci};
4978c2ecf20Sopenharmony_ci
4988c2ecf20Sopenharmony_ci/* Display FIFO Relation Registers*/
4998c2ecf20Sopenharmony_cistruct iga1_fifo_depth_select {
5008c2ecf20Sopenharmony_ci	int reg_num;
5018c2ecf20Sopenharmony_ci	struct io_register reg[IGA1_FIFO_DEPTH_SELECT_REG_NUM];
5028c2ecf20Sopenharmony_ci};
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_cistruct iga1_fifo_threshold_select {
5058c2ecf20Sopenharmony_ci	int reg_num;
5068c2ecf20Sopenharmony_ci	struct io_register reg[IGA1_FIFO_THRESHOLD_REG_NUM];
5078c2ecf20Sopenharmony_ci};
5088c2ecf20Sopenharmony_ci
5098c2ecf20Sopenharmony_cistruct iga1_fifo_high_threshold_select {
5108c2ecf20Sopenharmony_ci	int reg_num;
5118c2ecf20Sopenharmony_ci	struct io_register reg[IGA1_FIFO_HIGH_THRESHOLD_REG_NUM];
5128c2ecf20Sopenharmony_ci};
5138c2ecf20Sopenharmony_ci
5148c2ecf20Sopenharmony_cistruct iga1_display_queue_expire_num {
5158c2ecf20Sopenharmony_ci	int reg_num;
5168c2ecf20Sopenharmony_ci	struct io_register reg[IGA1_DISPLAY_QUEUE_EXPIRE_NUM_REG_NUM];
5178c2ecf20Sopenharmony_ci};
5188c2ecf20Sopenharmony_ci
5198c2ecf20Sopenharmony_cistruct iga2_fifo_depth_select {
5208c2ecf20Sopenharmony_ci	int reg_num;
5218c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_FIFO_DEPTH_SELECT_REG_NUM];
5228c2ecf20Sopenharmony_ci};
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_cistruct iga2_fifo_threshold_select {
5258c2ecf20Sopenharmony_ci	int reg_num;
5268c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_FIFO_THRESHOLD_REG_NUM];
5278c2ecf20Sopenharmony_ci};
5288c2ecf20Sopenharmony_ci
5298c2ecf20Sopenharmony_cistruct iga2_fifo_high_threshold_select {
5308c2ecf20Sopenharmony_ci	int reg_num;
5318c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_FIFO_HIGH_THRESHOLD_REG_NUM];
5328c2ecf20Sopenharmony_ci};
5338c2ecf20Sopenharmony_ci
5348c2ecf20Sopenharmony_cistruct iga2_display_queue_expire_num {
5358c2ecf20Sopenharmony_ci	int reg_num;
5368c2ecf20Sopenharmony_ci	struct io_register reg[IGA2_DISPLAY_QUEUE_EXPIRE_NUM_REG_NUM];
5378c2ecf20Sopenharmony_ci};
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_cistruct fifo_depth_select {
5408c2ecf20Sopenharmony_ci	struct iga1_fifo_depth_select iga1_fifo_depth_select_reg;
5418c2ecf20Sopenharmony_ci	struct iga2_fifo_depth_select iga2_fifo_depth_select_reg;
5428c2ecf20Sopenharmony_ci};
5438c2ecf20Sopenharmony_ci
5448c2ecf20Sopenharmony_cistruct fifo_threshold_select {
5458c2ecf20Sopenharmony_ci	struct iga1_fifo_threshold_select iga1_fifo_threshold_select_reg;
5468c2ecf20Sopenharmony_ci	struct iga2_fifo_threshold_select iga2_fifo_threshold_select_reg;
5478c2ecf20Sopenharmony_ci};
5488c2ecf20Sopenharmony_ci
5498c2ecf20Sopenharmony_cistruct fifo_high_threshold_select {
5508c2ecf20Sopenharmony_ci	struct iga1_fifo_high_threshold_select
5518c2ecf20Sopenharmony_ci	 iga1_fifo_high_threshold_select_reg;
5528c2ecf20Sopenharmony_ci	struct iga2_fifo_high_threshold_select
5538c2ecf20Sopenharmony_ci	 iga2_fifo_high_threshold_select_reg;
5548c2ecf20Sopenharmony_ci};
5558c2ecf20Sopenharmony_ci
5568c2ecf20Sopenharmony_cistruct display_queue_expire_num {
5578c2ecf20Sopenharmony_ci	struct iga1_display_queue_expire_num
5588c2ecf20Sopenharmony_ci	 iga1_display_queue_expire_num_reg;
5598c2ecf20Sopenharmony_ci	struct iga2_display_queue_expire_num
5608c2ecf20Sopenharmony_ci	 iga2_display_queue_expire_num_reg;
5618c2ecf20Sopenharmony_ci};
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_cistruct iga2_shadow_crtc_timing {
5648c2ecf20Sopenharmony_ci	struct iga2_shadow_hor_total hor_total_shadow;
5658c2ecf20Sopenharmony_ci	struct iga2_shadow_hor_blank_end hor_blank_end_shadow;
5668c2ecf20Sopenharmony_ci	struct iga2_shadow_ver_total ver_total_shadow;
5678c2ecf20Sopenharmony_ci	struct iga2_shadow_ver_addr ver_addr_shadow;
5688c2ecf20Sopenharmony_ci	struct iga2_shadow_ver_blank_start ver_blank_start_shadow;
5698c2ecf20Sopenharmony_ci	struct iga2_shadow_ver_blank_end ver_blank_end_shadow;
5708c2ecf20Sopenharmony_ci	struct iga2_shadow_ver_sync_start ver_sync_start_shadow;
5718c2ecf20Sopenharmony_ci	struct iga2_shadow_ver_sync_end ver_sync_end_shadow;
5728c2ecf20Sopenharmony_ci};
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_ci/* device ID */
5758c2ecf20Sopenharmony_ci#define CLE266_FUNCTION3    0x3123
5768c2ecf20Sopenharmony_ci#define KM400_FUNCTION3     0x3205
5778c2ecf20Sopenharmony_ci#define CN400_FUNCTION2     0x2259
5788c2ecf20Sopenharmony_ci#define CN400_FUNCTION3     0x3259
5798c2ecf20Sopenharmony_ci/* support VT3314 chipset */
5808c2ecf20Sopenharmony_ci#define CN700_FUNCTION2     0x2314
5818c2ecf20Sopenharmony_ci#define CN700_FUNCTION3     0x3208
5828c2ecf20Sopenharmony_ci/* VT3324 chipset */
5838c2ecf20Sopenharmony_ci#define CX700_FUNCTION2     0x2324
5848c2ecf20Sopenharmony_ci#define CX700_FUNCTION3     0x3324
5858c2ecf20Sopenharmony_ci/* VT3204 chipset*/
5868c2ecf20Sopenharmony_ci#define KM800_FUNCTION3      0x3204
5878c2ecf20Sopenharmony_ci/* VT3336 chipset*/
5888c2ecf20Sopenharmony_ci#define KM890_FUNCTION3      0x3336
5898c2ecf20Sopenharmony_ci/* VT3327 chipset*/
5908c2ecf20Sopenharmony_ci#define P4M890_FUNCTION3     0x3327
5918c2ecf20Sopenharmony_ci/* VT3293 chipset*/
5928c2ecf20Sopenharmony_ci#define CN750_FUNCTION3     0x3208
5938c2ecf20Sopenharmony_ci/* VT3364 chipset*/
5948c2ecf20Sopenharmony_ci#define P4M900_FUNCTION3    0x3364
5958c2ecf20Sopenharmony_ci/* VT3353 chipset*/
5968c2ecf20Sopenharmony_ci#define VX800_FUNCTION3     0x3353
5978c2ecf20Sopenharmony_ci/* VT3409 chipset*/
5988c2ecf20Sopenharmony_ci#define VX855_FUNCTION3     0x3409
5998c2ecf20Sopenharmony_ci/* VT3410 chipset*/
6008c2ecf20Sopenharmony_ci#define VX900_FUNCTION3     0x3410
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_cistruct IODATA {
6038c2ecf20Sopenharmony_ci	u8 Index;
6048c2ecf20Sopenharmony_ci	u8 Mask;
6058c2ecf20Sopenharmony_ci	u8 Data;
6068c2ecf20Sopenharmony_ci};
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_cistruct pci_device_id_info {
6098c2ecf20Sopenharmony_ci	u32 vendor;
6108c2ecf20Sopenharmony_ci	u32 device;
6118c2ecf20Sopenharmony_ci	u32 chip_index;
6128c2ecf20Sopenharmony_ci};
6138c2ecf20Sopenharmony_ci
6148c2ecf20Sopenharmony_cistruct via_device_mapping {
6158c2ecf20Sopenharmony_ci	u32 device;
6168c2ecf20Sopenharmony_ci	const char *name;
6178c2ecf20Sopenharmony_ci};
6188c2ecf20Sopenharmony_ci
6198c2ecf20Sopenharmony_ciextern int viafb_SAMM_ON;
6208c2ecf20Sopenharmony_ciextern int viafb_dual_fb;
6218c2ecf20Sopenharmony_ciextern int viafb_LCD2_ON;
6228c2ecf20Sopenharmony_ciextern int viafb_LCD_ON;
6238c2ecf20Sopenharmony_ciextern int viafb_DVI_ON;
6248c2ecf20Sopenharmony_ciextern int viafb_hotplug;
6258c2ecf20Sopenharmony_ci
6268c2ecf20Sopenharmony_cistruct via_display_timing var_to_timing(const struct fb_var_screeninfo *var,
6278c2ecf20Sopenharmony_ci	u16 cxres, u16 cyres);
6288c2ecf20Sopenharmony_civoid viafb_fill_crtc_timing(const struct fb_var_screeninfo *var,
6298c2ecf20Sopenharmony_ci	u16 cxres, u16 cyres, int iga);
6308c2ecf20Sopenharmony_civoid viafb_set_vclock(u32 CLK, int set_iga);
6318c2ecf20Sopenharmony_civoid viafb_load_reg(int timing_value, int viafb_load_reg_num,
6328c2ecf20Sopenharmony_ci	struct io_register *reg,
6338c2ecf20Sopenharmony_ci	      int io_type);
6348c2ecf20Sopenharmony_civoid via_set_source(u32 devices, u8 iga);
6358c2ecf20Sopenharmony_civoid via_set_state(u32 devices, u8 state);
6368c2ecf20Sopenharmony_civoid via_set_sync_polarity(u32 devices, u8 polarity);
6378c2ecf20Sopenharmony_ciu32 via_parse_odev(char *input, char **end);
6388c2ecf20Sopenharmony_civoid via_odev_to_seq(struct seq_file *m, u32 odev);
6398c2ecf20Sopenharmony_civoid init_ad9389(void);
6408c2ecf20Sopenharmony_ci/* Access I/O Function */
6418c2ecf20Sopenharmony_civoid viafb_lock_crt(void);
6428c2ecf20Sopenharmony_civoid viafb_unlock_crt(void);
6438c2ecf20Sopenharmony_civoid viafb_load_fetch_count_reg(int h_addr, int bpp_byte, int set_iga);
6448c2ecf20Sopenharmony_civoid viafb_write_regx(struct io_reg RegTable[], int ItemNum);
6458c2ecf20Sopenharmony_civoid viafb_load_FIFO_reg(int set_iga, int hor_active, int ver_active);
6468c2ecf20Sopenharmony_civoid viafb_set_dpa_gfx(int output_interface, struct GFX_DPA_SETTING\
6478c2ecf20Sopenharmony_ci					*p_gfx_dpa_setting);
6488c2ecf20Sopenharmony_ci
6498c2ecf20Sopenharmony_ciint viafb_setmode(void);
6508c2ecf20Sopenharmony_civoid viafb_fill_var_timing_info(struct fb_var_screeninfo *var,
6518c2ecf20Sopenharmony_ci	const struct fb_videomode *mode);
6528c2ecf20Sopenharmony_civoid viafb_init_chip_info(int chip_type);
6538c2ecf20Sopenharmony_civoid viafb_init_dac(int set_iga);
6548c2ecf20Sopenharmony_ciint viafb_get_refresh(int hres, int vres, u32 float_refresh);
6558c2ecf20Sopenharmony_civoid viafb_update_device_setting(int hres, int vres, int bpp, int flag);
6568c2ecf20Sopenharmony_ci
6578c2ecf20Sopenharmony_civoid viafb_set_iga_path(void);
6588c2ecf20Sopenharmony_civoid viafb_set_primary_color_register(u8 index, u8 red, u8 green, u8 blue);
6598c2ecf20Sopenharmony_civoid viafb_set_secondary_color_register(u8 index, u8 red, u8 green, u8 blue);
6608c2ecf20Sopenharmony_civoid viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len);
6618c2ecf20Sopenharmony_ci
6628c2ecf20Sopenharmony_ci#endif /* __HW_H__ */
663