Skip to content

Commit

Permalink
video: fbdev: pmag-aa-fb: Adapt to current APIs
Browse files Browse the repository at this point in the history
Rework the driver to use the current frambuffer and TURBOchannel APIs,
including proper resource management and using the new framework for
hardware cursor support.

NB two Bt431 cursor generators are included onboard, both responding at
the same TURBOchannel bus addresses and with their host data buses wired
to byte lanes #0 and #1 respectively of the 32-bit bus.  Therefore both
can be accessed simultaneously with 16-bit data transfers.  Cursor
outputs of the chip wired to lane #0 drive the respective overlay select
inputs of the Bt455 RAMDAC, whereas cursor outputs of the chip wired to
lane #1 drive the respective P3 pixel select inputs of the RAMDAC.

So 5 (out of 17) Bt455 color registers are usable with this board:
palette entries #0 and #1 for frame buffer pixel data driven while
neither cursor generator is active, palette entries #8 and #9 for frame
buffer pixel data driven while cursor generator #1 is active only and
the overlay entry while cursor generator #0 is active.

Signed-off-by: Maciej W. Rozycki <[email protected]>
Signed-off-by: Tomi Valkeinen <[email protected]>
  • Loading branch information
Maciej W. Rozycki authored and tomba committed Feb 26, 2016
1 parent af22f64 commit 90c8317
Show file tree
Hide file tree
Showing 2 changed files with 215 additions and 421 deletions.
41 changes: 23 additions & 18 deletions drivers/video/fbdev/bt431.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
* linux/drivers/video/bt431.h
*
* Copyright 2003 Thiemo Seufer <[email protected]>
* Copyright 2016 Maciej W. Rozycki <[email protected]>
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
* archive for more details.
*/
#include <linux/types.h>

#define BT431_CURSOR_SIZE 64

/*
* Bt431 cursor generator registers, 32-bit aligned.
* Two twin Bt431 are used on the DECstation's PMAG-AA.
Expand Down Expand Up @@ -196,28 +199,30 @@ static inline void bt431_position_cursor(struct bt431_regs *regs, u16 x, u16 y)
bt431_write_reg_inc(regs, (y >> 8) & 0x0f); /* BT431_REG_CYHI */
}

static inline void bt431_set_font(struct bt431_regs *regs, u8 fgc,
u16 width, u16 height)
static inline void bt431_set_cursor(struct bt431_regs *regs,
const char *data, const char *mask,
u16 rop, u16 width, u16 height)
{
u16 x, y;
int i;
u16 fgp = fgc ? 0xffff : 0x0000;
u16 bgp = fgc ? 0x0000 : 0xffff;

i = 0;
width = DIV_ROUND_UP(width, 8);
bt431_select_reg(regs, BT431_REG_CRAM_BASE);
for (i = BT431_REG_CRAM_BASE; i <= BT431_REG_CRAM_END; i++) {
u16 value;

if (height << 6 <= i << 3)
value = bgp;
else if (width <= i % 8 << 3)
value = bgp;
else if (((width >> 3) & 0xffff) > i % 8)
value = fgp;
else
value = fgp & ~(bgp << (width % 8 << 1));

bt431_write_cmap_inc(regs, value);
}
for (y = 0; y < BT431_CURSOR_SIZE; y++)
for (x = 0; x < BT431_CURSOR_SIZE / 8; x++) {
u16 val = 0;

if (y < height && x < width) {
val = mask[i];
if (rop == ROP_XOR)
val = (val << 8) | (val ^ data[i]);
else
val = (val << 8) | (val & data[i]);
i++;
}
bt431_write_cmap_inc(regs, val);
}
}

static inline void bt431_init_cursor(struct bt431_regs *regs)
Expand Down
Loading

0 comments on commit 90c8317

Please sign in to comment.