]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/sm7xxfb/sm7xx.h
Merge tag 'sound-4.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[karo-tx-linux.git] / drivers / staging / sm7xxfb / sm7xx.h
1 /*
2  * Silicon Motion SM712 frame buffer device
3  *
4  * Copyright (C) 2006 Silicon Motion Technology Corp.
5  * Authors:     Ge Wang, gewang@siliconmotion.com
6  *              Boyod boyod.yang@siliconmotion.com.cn
7  *
8  * Copyright (C) 2009 Lemote, Inc.
9  * Author: Wu Zhangjin, wuzhangjin@gmail.com
10  *
11  *  This file is subject to the terms and conditions of the GNU General Public
12  *  License. See the file COPYING in the main directory of this archive for
13  *  more details.
14  */
15
16 #define NR_PALETTE        256
17
18 #define FB_ACCEL_SMI_LYNX 88
19
20 #define SCREEN_X_RES      1024
21 #define SCREEN_Y_RES      600
22 #define SCREEN_BPP        16
23
24 /*Assume SM712 graphics chip has 4MB VRAM */
25 #define SM712_VIDEOMEMORYSIZE     0x00400000
26 /*Assume SM722 graphics chip has 8MB VRAM */
27 #define SM722_VIDEOMEMORYSIZE     0x00800000
28
29 #define dac_reg (0x3c8)
30 #define dac_val (0x3c9)
31
32 extern void __iomem *smtc_regbaseaddress;
33 #define smtc_mmiowb(dat, reg)   writeb(dat, smtc_regbaseaddress + reg)
34 #define smtc_mmioww(dat, reg)   writew(dat, smtc_regbaseaddress + reg)
35 #define smtc_mmiowl(dat, reg)   writel(dat, smtc_regbaseaddress + reg)
36
37 #define smtc_mmiorb(reg)        readb(smtc_regbaseaddress + reg)
38 #define smtc_mmiorw(reg)        readw(smtc_regbaseaddress + reg)
39 #define smtc_mmiorl(reg)        readl(smtc_regbaseaddress + reg)
40
41 #define SIZE_SR00_SR04      (0x04 - 0x00 + 1)
42 #define SIZE_SR10_SR24      (0x24 - 0x10 + 1)
43 #define SIZE_SR30_SR75      (0x75 - 0x30 + 1)
44 #define SIZE_SR80_SR93      (0x93 - 0x80 + 1)
45 #define SIZE_SRA0_SRAF      (0xAF - 0xA0 + 1)
46 #define SIZE_GR00_GR08      (0x08 - 0x00 + 1)
47 #define SIZE_AR00_AR14      (0x14 - 0x00 + 1)
48 #define SIZE_CR00_CR18      (0x18 - 0x00 + 1)
49 #define SIZE_CR30_CR4D      (0x4D - 0x30 + 1)
50 #define SIZE_CR90_CRA7      (0xA7 - 0x90 + 1)
51 #define SIZE_VPR                (0x6C + 1)
52 #define SIZE_DPR                (0x44 + 1)
53
54 static inline void smtc_crtcw(int reg, int val)
55 {
56         smtc_mmiowb(reg, 0x3d4);
57         smtc_mmiowb(val, 0x3d5);
58 }
59
60 static inline unsigned int smtc_crtcr(int reg)
61 {
62         smtc_mmiowb(reg, 0x3d4);
63         return smtc_mmiorb(0x3d5);
64 }
65
66 static inline void smtc_grphw(int reg, int val)
67 {
68         smtc_mmiowb(reg, 0x3ce);
69         smtc_mmiowb(val, 0x3cf);
70 }
71
72 static inline unsigned int smtc_grphr(int reg)
73 {
74         smtc_mmiowb(reg, 0x3ce);
75         return smtc_mmiorb(0x3cf);
76 }
77
78 static inline void smtc_attrw(int reg, int val)
79 {
80         smtc_mmiorb(0x3da);
81         smtc_mmiowb(reg, 0x3c0);
82         smtc_mmiorb(0x3c1);
83         smtc_mmiowb(val, 0x3c0);
84 }
85
86 static inline void smtc_seqw(int reg, int val)
87 {
88         smtc_mmiowb(reg, 0x3c4);
89         smtc_mmiowb(val, 0x3c5);
90 }
91
92 static inline unsigned int smtc_seqr(int reg)
93 {
94         smtc_mmiowb(reg, 0x3c4);
95         return smtc_mmiorb(0x3c5);
96 }
97
98 /* The next structure holds all information relevant for a specific video mode.
99  */
100
101 struct modeinit {
102         int mmsizex;
103         int mmsizey;
104         int bpp;
105         int hz;
106         unsigned char init_misc;
107         unsigned char init_sr00_sr04[SIZE_SR00_SR04];
108         unsigned char init_sr10_sr24[SIZE_SR10_SR24];
109         unsigned char init_sr30_sr75[SIZE_SR30_SR75];
110         unsigned char init_sr80_sr93[SIZE_SR80_SR93];
111         unsigned char init_sra0_sraf[SIZE_SRA0_SRAF];
112         unsigned char init_gr00_gr08[SIZE_GR00_GR08];
113         unsigned char init_ar00_ar14[SIZE_AR00_AR14];
114         unsigned char init_cr00_cr18[SIZE_CR00_CR18];
115         unsigned char init_cr30_cr4d[SIZE_CR30_CR4D];
116         unsigned char init_cr90_cra7[SIZE_CR90_CRA7];
117 };