Release 4.11 drivers/staging/sm750fb/sm750_cursor.c
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/fb.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/vmalloc.h>
#include <linux/pagemap.h>
#include <linux/console.h>
#include <linux/platform_device.h>
#include <linux/screen_info.h>
#include "sm750.h"
#include "sm750_cursor.h"
#define poke32(addr, data) \
writel((data), cursor->mmio + (addr))
/* cursor control for voyager and 718/750*/
#define HWC_ADDRESS 0x0
#define HWC_ADDRESS_ENABLE BIT(31)
#define HWC_ADDRESS_EXT BIT(27)
#define HWC_ADDRESS_CS BIT(26)
#define HWC_ADDRESS_ADDRESS_MASK 0x3ffffff
#define HWC_LOCATION 0x4
#define HWC_LOCATION_TOP BIT(27)
#define HWC_LOCATION_Y_SHIFT 16
#define HWC_LOCATION_Y_MASK (0x7ff << 16)
#define HWC_LOCATION_LEFT BIT(11)
#define HWC_LOCATION_X_MASK 0x7ff
#define HWC_COLOR_12 0x8
#define HWC_COLOR_12_2_RGB565_SHIFT 16
#define HWC_COLOR_12_2_RGB565_MASK (0xffff << 16)
#define HWC_COLOR_12_1_RGB565_MASK 0xffff
#define HWC_COLOR_3 0xC
#define HWC_COLOR_3_RGB565_MASK 0xffff
/* hw_cursor_xxx works for voyager,718 and 750 */
void sm750_hw_cursor_enable(struct lynx_cursor *cursor)
{
u32 reg;
reg = (cursor->offset & HWC_ADDRESS_ADDRESS_MASK) | HWC_ADDRESS_ENABLE;
poke32(HWC_ADDRESS, reg);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sudip Mukherjee | 25 | 78.12% | 1 | 25.00% |
Mike Rapoport | 5 | 15.62% | 1 | 25.00% |
Arnd Bergmann | 1 | 3.12% | 1 | 25.00% |
Matthieu Simon | 1 | 3.12% | 1 | 25.00% |
Total | 32 | 100.00% | 4 | 100.00% |
void sm750_hw_cursor_disable(struct lynx_cursor *cursor)
{
poke32(HWC_ADDRESS, 0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sudip Mukherjee | 15 | 88.24% | 1 | 33.33% |
Matthieu Simon | 1 | 5.88% | 1 | 33.33% |
Arnd Bergmann | 1 | 5.88% | 1 | 33.33% |
Total | 17 | 100.00% | 3 | 100.00% |
void sm750_hw_cursor_setSize(struct lynx_cursor *cursor,
int w, int h)
{
cursor->w = w;
cursor->h = h;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sudip Mukherjee | 27 | 96.43% | 1 | 50.00% |
Arnd Bergmann | 1 | 3.57% | 1 | 50.00% |
Total | 28 | 100.00% | 2 | 100.00% |
void sm750_hw_cursor_setPos(struct lynx_cursor *cursor,
int x, int y)
{
u32 reg;
reg = (((y << HWC_LOCATION_Y_SHIFT) & HWC_LOCATION_Y_MASK) |
(x & HWC_LOCATION_X_MASK));
poke32(HWC_LOCATION, reg);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sudip Mukherjee | 30 | 65.22% | 1 | 25.00% |
Mike Rapoport | 14 | 30.43% | 1 | 25.00% |
Arnd Bergmann | 1 | 2.17% | 1 | 25.00% |
Matthieu Simon | 1 | 2.17% | 1 | 25.00% |
Total | 46 | 100.00% | 4 | 100.00% |
void sm750_hw_cursor_setColor(struct lynx_cursor *cursor,
u32 fg, u32 bg)
{
u32 reg = (fg << HWC_COLOR_12_2_RGB565_SHIFT) &
HWC_COLOR_12_2_RGB565_MASK;
poke32(HWC_COLOR_12, reg | (bg & HWC_COLOR_12_1_RGB565_MASK));
poke32(HWC_COLOR_3, 0xffe0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sudip Mukherjee | 32 | 68.09% | 1 | 25.00% |
Mike Rapoport | 12 | 25.53% | 1 | 25.00% |
Matthieu Simon | 2 | 4.26% | 1 | 25.00% |
Arnd Bergmann | 1 | 2.13% | 1 | 25.00% |
Total | 47 | 100.00% | 4 | 100.00% |
void sm750_hw_cursor_setData(struct lynx_cursor *cursor,
u16 rop, const u8 *pcol, const u8 *pmsk)
{
int i, j, count, pitch, offset;
u8 color, mask, opr;
u16 data;
void __iomem *pbuffer, *pstart;
/* in byte*/
pitch = cursor->w >> 3;
/* in byte */
count = pitch * cursor->h;
/* in byte */
offset = cursor->maxW * 2 / 8;
data = 0;
pstart = cursor->vstart;
pbuffer = pstart;
for (i = 0; i < count; i++) {
color = *pcol++;
mask = *pmsk++;
data = 0;
for (j = 0; j < 8; j++) {
if (mask & (0x80>>j)) {
if (rop == ROP_XOR)
opr = mask ^ color;
else
opr = mask & color;
/* 2 stands for forecolor and 1 for backcolor */
data |= ((opr & (0x80>>j))?2:1)<<(j*2);
}
}
iowrite16(data, pbuffer);
/* assume pitch is 1,2,4,8,...*/
if ((i + 1) % pitch == 0) {
/* need a return */
pstart += offset;
pbuffer = pstart;
} else {
pbuffer += sizeof(u16);
}
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sudip Mukherjee | 224 | 94.12% | 1 | 33.33% |
Lorenzo Stoakes | 13 | 5.46% | 1 | 33.33% |
Arnd Bergmann | 1 | 0.42% | 1 | 33.33% |
Total | 238 | 100.00% | 3 | 100.00% |
void sm750_hw_cursor_setData2(struct lynx_cursor *cursor,
u16 rop, const u8 *pcol, const u8 *pmsk)
{
int i, j, count, pitch, offset;
u8 color, mask;
u16 data;
void __iomem *pbuffer, *pstart;
/* in byte*/
pitch = cursor->w >> 3;
/* in byte */
count = pitch * cursor->h;
/* in byte */
offset = cursor->maxW * 2 / 8;
data = 0;
pstart = cursor->vstart;
pbuffer = pstart;
for (i = 0; i < count; i++) {
color = *pcol++;
mask = *pmsk++;
data = 0;
for (j = 0; j < 8; j++) {
if (mask & (1<<j))
data |= ((color & (1<<j))?1:2)<<(j*2);
}
iowrite16(data, pbuffer);
/* assume pitch is 1,2,4,8,...*/
if (!(i&(pitch-1))) {
/* need a return */
pstart += offset;
pbuffer = pstart;
} else {
pbuffer += sizeof(u16);
}
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sudip Mukherjee | 201 | 93.49% | 1 | 33.33% |
Lorenzo Stoakes | 13 | 6.05% | 1 | 33.33% |
Arnd Bergmann | 1 | 0.47% | 1 | 33.33% |
Total | 215 | 100.00% | 3 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sudip Mukherjee | 663 | 87.58% | 1 | 12.50% |
Mike Rapoport | 54 | 7.13% | 3 | 37.50% |
Lorenzo Stoakes | 26 | 3.43% | 1 | 12.50% |
Arnd Bergmann | 7 | 0.92% | 1 | 12.50% |
Matthieu Simon | 6 | 0.79% | 1 | 12.50% |
Isaac Assegai | 1 | 0.13% | 1 | 12.50% |
Total | 757 | 100.00% | 8 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.