diff options
author | Andres Salomon <dilinger@queued.net> | 2008-04-28 05:15:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:36 -0400 |
commit | 46fb6f110dfc3fc99f44cf701f66ea3e790b6a81 (patch) | |
tree | f1fd3abed10ac35bed20670bb47b83c592293d07 /drivers/video/geode/gxfb.h | |
parent | d1b4cc3ec5f8ddbac57ada58cbab36f5a0be38eb (diff) |
gxfb: add power management functionality
This adds the ability to suspend/resume the gxfb driver, which includes:
- The addition of a Graphics Processor register table in gxfb.h, and
associated GP handling.
- Register and palette saving code; registers are stored in gxfb_par.
A few MSR values are saved as well.
- gx_powerup and gx_powerdown functions which restore/save registers and
enable/disable graphic engines.
- gxfb_suspend/gxfb_resume
Originally based on a patch by Jordan Crouse.
Signed-off-by: Andres Salomon <dilinger@debian.org>
Cc: Jordan Crouse <jordan.crouse@amd.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/geode/gxfb.h')
-rw-r--r-- | drivers/video/geode/gxfb.h | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/drivers/video/geode/gxfb.h b/drivers/video/geode/gxfb.h index b8db7f82646c..16a96f8fd8c5 100644 --- a/drivers/video/geode/gxfb.h +++ b/drivers/video/geode/gxfb.h | |||
@@ -13,10 +13,34 @@ | |||
13 | 13 | ||
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | 15 | ||
16 | #define GP_REG_COUNT (0x50 / 4) | ||
17 | #define DC_REG_COUNT (0x90 / 4) | ||
18 | #define VP_REG_COUNT (0x138 / 8) | ||
19 | #define FP_REG_COUNT (0x68 / 8) | ||
20 | |||
21 | #define DC_PAL_COUNT 0x104 | ||
22 | |||
16 | struct gxfb_par { | 23 | struct gxfb_par { |
17 | int enable_crt; | 24 | int enable_crt; |
18 | void __iomem *dc_regs; | 25 | void __iomem *dc_regs; |
19 | void __iomem *vid_regs; | 26 | void __iomem *vid_regs; |
27 | void __iomem *gp_regs; | ||
28 | #ifdef CONFIG_PM | ||
29 | int powered_down; | ||
30 | |||
31 | /* register state, for power management functionality */ | ||
32 | struct { | ||
33 | uint64_t padsel; | ||
34 | uint64_t dotpll; | ||
35 | } msr; | ||
36 | |||
37 | uint32_t gp[GP_REG_COUNT]; | ||
38 | uint32_t dc[DC_REG_COUNT]; | ||
39 | uint64_t vp[VP_REG_COUNT]; | ||
40 | uint64_t fp[FP_REG_COUNT]; | ||
41 | |||
42 | uint32_t pal[DC_PAL_COUNT]; | ||
43 | #endif | ||
20 | }; | 44 | }; |
21 | 45 | ||
22 | unsigned int gx_frame_buffer_size(void); | 46 | unsigned int gx_frame_buffer_size(void); |
@@ -29,6 +53,43 @@ void gx_set_dclk_frequency(struct fb_info *info); | |||
29 | void gx_configure_display(struct fb_info *info); | 53 | void gx_configure_display(struct fb_info *info); |
30 | int gx_blank_display(struct fb_info *info, int blank_mode); | 54 | int gx_blank_display(struct fb_info *info, int blank_mode); |
31 | 55 | ||
56 | #ifdef CONFIG_PM | ||
57 | int gx_powerdown(struct fb_info *info); | ||
58 | int gx_powerup(struct fb_info *info); | ||
59 | #endif | ||
60 | |||
61 | |||
62 | /* Graphics Processor registers (table 6-23 from the data book) */ | ||
63 | enum gp_registers { | ||
64 | GP_DST_OFFSET = 0, | ||
65 | GP_SRC_OFFSET, | ||
66 | GP_STRIDE, | ||
67 | GP_WID_HEIGHT, | ||
68 | |||
69 | GP_SRC_COLOR_FG, | ||
70 | GP_SRC_COLOR_BG, | ||
71 | GP_PAT_COLOR_0, | ||
72 | GP_PAT_COLOR_1, | ||
73 | |||
74 | GP_PAT_COLOR_2, | ||
75 | GP_PAT_COLOR_3, | ||
76 | GP_PAT_COLOR_4, | ||
77 | GP_PAT_COLOR_5, | ||
78 | |||
79 | GP_PAT_DATA_0, | ||
80 | GP_PAT_DATA_1, | ||
81 | GP_RASTER_MODE, | ||
82 | GP_VECTOR_MODE, | ||
83 | |||
84 | GP_BLT_MODE, | ||
85 | GP_BLT_STATUS, | ||
86 | GP_HST_SRC, | ||
87 | GP_BASE_OFFSET, /* 0x4c */ | ||
88 | }; | ||
89 | |||
90 | #define GP_BLT_STATUS_BLT_PENDING (1 << 2) | ||
91 | #define GP_BLT_STATUS_BLT_BUSY (1 << 0) | ||
92 | |||
32 | 93 | ||
33 | /* Display Controller registers (table 6-38 from the data book) */ | 94 | /* Display Controller registers (table 6-38 from the data book) */ |
34 | enum dc_registers { | 95 | enum dc_registers { |
@@ -238,6 +299,16 @@ enum fp_registers { | |||
238 | 299 | ||
239 | /* register access functions */ | 300 | /* register access functions */ |
240 | 301 | ||
302 | static inline uint32_t read_gp(struct gxfb_par *par, int reg) | ||
303 | { | ||
304 | return readl(par->gp_regs + 4*reg); | ||
305 | } | ||
306 | |||
307 | static inline void write_gp(struct gxfb_par *par, int reg, uint32_t val) | ||
308 | { | ||
309 | writel(val, par->gp_regs + 4*reg); | ||
310 | } | ||
311 | |||
241 | static inline uint32_t read_dc(struct gxfb_par *par, int reg) | 312 | static inline uint32_t read_dc(struct gxfb_par *par, int reg) |
242 | { | 313 | { |
243 | return readl(par->dc_regs + 4*reg); | 314 | return readl(par->dc_regs + 4*reg); |
@@ -248,7 +319,6 @@ static inline void write_dc(struct gxfb_par *par, int reg, uint32_t val) | |||
248 | writel(val, par->dc_regs + 4*reg); | 319 | writel(val, par->dc_regs + 4*reg); |
249 | } | 320 | } |
250 | 321 | ||
251 | |||
252 | static inline uint32_t read_vp(struct gxfb_par *par, int reg) | 322 | static inline uint32_t read_vp(struct gxfb_par *par, int reg) |
253 | { | 323 | { |
254 | return readl(par->vid_regs + 8*reg); | 324 | return readl(par->vid_regs + 8*reg); |