2 * Copyright © 2010 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 * jim liu <jim.liu@intel.com>
25 * Jackie Li<yaodong.li@intel.com>
28 #ifndef __MDFLD_DSI_DBI_DPU_H__
29 #define __MDFLD_DSI_DBI_DPU_H__
31 #include "mdfld_dsi_dbi.h"
43 #define MDFLD_PIPEA_PLANE_MASK 0x15
44 #define MDFLD_PIPEC_PLANE_MASK 0x2A
46 struct mdfld_cursor_info
{
51 #define MDFLD_CURSOR_SIZE 64
54 * enter DSR mode if screen has no update for 2 frames.
56 #define MDFLD_MAX_IDLE_COUNT 2
58 struct mdfld_dbi_dpu_info
{
59 struct drm_device
*dev
;
61 spinlock_t dpu_update_lock
;
64 struct mdfld_cursor_info cursors
[2];
66 /* Damaged area for each plane */
67 struct psb_drm_dpu_rect damaged_rects
[MDFLD_PLANE_NUM
];
69 /* Final damaged area */
70 struct psb_drm_dpu_rect damage_pipea
;
71 struct psb_drm_dpu_rect damage_pipec
;
77 struct timer_list dpu_timer
;
78 spinlock_t dpu_timer_lock
;
84 struct mdfld_dsi_dbi_output
*dbi_outputs
[2];
88 static inline int mdfld_dpu_region_extent(struct psb_drm_dpu_rect
*origin
,
89 struct psb_drm_dpu_rect
*rect
)
93 x1
= origin
->x
+ origin
->width
;
94 y1
= origin
->y
+ origin
->height
;
96 x2
= rect
->x
+ rect
->width
;
97 y2
= rect
->y
+ rect
->height
;
99 origin
->x
= min(origin
->x
, rect
->x
);
100 origin
->y
= min(origin
->y
, rect
->y
);
101 origin
->width
= max(x1
, x2
) - origin
->x
;
102 origin
->height
= max(y1
, y2
) - origin
->y
;
107 static inline void mdfld_check_boundary(struct mdfld_dbi_dpu_info
*dpu_info
,
108 struct psb_drm_dpu_rect
*rect
)
115 if (rect
->x
+ rect
->width
> 864)
116 rect
->width
= 864 - rect
->x
;
117 if (rect
->y
+ rect
->height
> 480)
118 rect
->height
= 480 - rect
->height
;
126 static inline void mdfld_dpu_init_damage(struct mdfld_dbi_dpu_info
*dpu_info
,
129 struct psb_drm_dpu_rect
*rect
;
132 rect
= &dpu_info
->damage_pipea
;
134 rect
= &dpu_info
->damage_pipec
;
142 extern int mdfld_dsi_dbi_dsr_off(struct drm_device
*dev
,
143 struct psb_drm_dpu_rect
*rect
);
144 extern int mdfld_dbi_dpu_report_damage(struct drm_device
*dev
,
146 struct psb_drm_dpu_rect
*rect
);
147 extern int mdfld_dbi_dpu_report_fullscreen_damage(struct drm_device
*dev
);
148 extern int mdfld_dpu_exit_dsr(struct drm_device
*dev
);
149 extern void mdfld_dbi_dpu_timer_start(struct mdfld_dbi_dpu_info
*dpu_info
);
150 extern int mdfld_dbi_dpu_init(struct drm_device
*dev
);
151 extern void mdfld_dbi_dpu_exit(struct drm_device
*dev
);
152 extern void mdfld_dpu_update_panel(struct drm_device
*dev
);
154 #endif /*__MDFLD_DSI_DBI_DPU_H__*/