10 #include <linux/types.h>
27 static inline u16 bt431_set_value(
u8 val)
29 return ((val << 8) | (val & 0xff)) & 0xffff;
32 static inline u8 bt431_get_value(
u16 val)
40 #define BT431_REG_CMD 0x0000
41 #define BT431_REG_CXLO 0x0001
42 #define BT431_REG_CXHI 0x0002
43 #define BT431_REG_CYLO 0x0003
44 #define BT431_REG_CYHI 0x0004
45 #define BT431_REG_WXLO 0x0005
46 #define BT431_REG_WXHI 0x0006
47 #define BT431_REG_WYLO 0x0007
48 #define BT431_REG_WYHI 0x0008
49 #define BT431_REG_WWLO 0x0009
50 #define BT431_REG_WWHI 0x000a
51 #define BT431_REG_WHLO 0x000b
52 #define BT431_REG_WHHI 0x000c
54 #define BT431_REG_CRAM_BASE 0x0000
55 #define BT431_REG_CRAM_END 0x01ff
60 #define BT431_CMD_CURS_ENABLE 0x40
61 #define BT431_CMD_XHAIR_ENABLE 0x20
62 #define BT431_CMD_OR_CURSORS 0x10
63 #define BT431_CMD_AND_CURSORS 0x00
64 #define BT431_CMD_1_1_MUX 0x00
65 #define BT431_CMD_4_1_MUX 0x04
66 #define BT431_CMD_5_1_MUX 0x08
67 #define BT431_CMD_xxx_MUX 0x0c
68 #define BT431_CMD_THICK_1 0x00
69 #define BT431_CMD_THICK_3 0x01
70 #define BT431_CMD_THICK_5 0x02
71 #define BT431_CMD_THICK_7 0x03
83 *lo = bt431_set_value(ir & 0xff);
85 *hi = bt431_set_value((ir >> 8) & 0xff);
98 return bt431_get_value(*r);
110 *r = bt431_set_value(value);
115 bt431_select_reg(regs, ir);
116 return bt431_read_reg_inc(regs);
121 bt431_select_reg(regs, ir);
122 bt431_write_reg_inc(regs, value);
152 bt431_select_reg(regs, cr);
153 return bt431_read_cmap_inc(regs);
158 bt431_select_reg(regs, cr);
159 bt431_write_cmap_inc(regs, value);
193 bt431_write_reg_inc(regs, x & 0xff);
194 bt431_write_reg_inc(regs, (x >> 8) & 0x0f);
195 bt431_write_reg_inc(regs, y & 0xff);
196 bt431_write_reg_inc(regs, (y >> 8) & 0x0f);
199 static inline void bt431_set_font(
struct bt431_regs *regs,
u8 fgc,
203 u16 fgp = fgc ? 0xffff : 0x0000;
204 u16 bgp = fgc ? 0x0000 : 0xffff;
210 if (height << 6 <= i << 3)
212 else if (width <= i % 8 << 3)
214 else if (((width >> 3) & 0xffff) > i % 8)
217 value = fgp & ~(bgp << (width % 8 << 1));
219 bt431_write_cmap_inc(regs, value);
223 static inline void bt431_init_cursor(
struct bt431_regs *regs)
227 bt431_write_reg_inc(regs, 0x00);
228 bt431_write_reg_inc(regs, 0x00);
229 bt431_write_reg_inc(regs, 0x00);
230 bt431_write_reg_inc(regs, 0x00);
231 bt431_write_reg_inc(regs, 0x00);
232 bt431_write_reg_inc(regs, 0x00);
233 bt431_write_reg_inc(regs, 0x00);
234 bt431_write_reg_inc(regs, 0x00);