1 /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 #include <linux/module.h>
19 #include <linux/kernel.h>
20 #include <linux/sched.h>
21 #include <linux/time.h>
22 #include <linux/init.h>
23 #include <linux/interrupt.h>
24 #include <linux/hrtimer.h>
26 #include <mach/hardware.h>
29 #include <asm/system.h>
30 #include <asm/mach-types.h>
31 #include <linux/semaphore.h>
32 #include <linux/spinlock.h>
39 static int cursor_enabled
;
41 int mdp_hw_cursor_update(struct fb_info
*info
, struct fb_cursor
*cursor
)
43 struct msm_fb_data_type
*mfd
= (struct msm_fb_data_type
*)info
->par
;
44 struct fb_image
*img
= &cursor
->image
;
45 int calpha_en
, transp_en
;
49 if ((img
->width
> MDP_CURSOR_WIDTH
) ||
50 (img
->height
> MDP_CURSOR_HEIGHT
) ||
54 if (cursor
->set
& FB_CUR_SETPOS
)
55 MDP_OUTP(MDP_BASE
+ 0x9004c, (img
->dy
<< 16) | img
->dx
);
57 if (cursor
->set
& FB_CUR_SETIMAGE
) {
58 ret
= copy_from_user(mfd
->cursor_buf
, img
->data
,
59 img
->width
*img
->height
*4);
63 if (img
->bg_color
== 0xffffffff)
68 alpha
= (img
->fg_color
& 0xff000000) >> 24;
71 calpha_en
= 0x2; /* xrgb */
73 calpha_en
= 0x1; /* argb */
75 MDP_OUTP(MDP_BASE
+ 0x90044, (img
->height
<< 16) | img
->width
);
76 MDP_OUTP(MDP_BASE
+ 0x90048, mfd
->cursor_buf_phys
);
77 /* order the writes the cursor_buf before updating the
79 // dma_coherent_pre_ops();
80 MDP_OUTP(MDP_BASE
+ 0x90060,
81 (transp_en
<< 3) | (calpha_en
<< 1) |
82 (inp32(MDP_BASE
+ 0x90060) & 0x1));
83 #ifdef CONFIG_FB_MSM_MDP40
84 MDP_OUTP(MDP_BASE
+ 0x90064, (alpha
<< 24));
85 MDP_OUTP(MDP_BASE
+ 0x90068, (0xffffff & img
->bg_color
));
86 MDP_OUTP(MDP_BASE
+ 0x9006C, (0xffffff & img
->bg_color
));
88 MDP_OUTP(MDP_BASE
+ 0x90064,
89 (alpha
<< 24) | (0xffffff & img
->bg_color
));
90 MDP_OUTP(MDP_BASE
+ 0x90068, 0);
94 if ((cursor
->enable
) && (!cursor_enabled
)) {
96 MDP_OUTP(MDP_BASE
+ 0x90060, inp32(MDP_BASE
+ 0x90060) | 0x1);
97 } else if ((!cursor
->enable
) && (cursor_enabled
)) {
99 MDP_OUTP(MDP_BASE
+ 0x90060,
100 inp32(MDP_BASE
+ 0x90060) & (~0x1));