]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/staging/gma500/psb_powermgmt.h
staging: gma500: Intel GMA500 staging driver
[karo-tx-linux.git] / drivers / staging / gma500 / psb_powermgmt.h
1 /**************************************************************************
2  * Copyright (c) 2009, Intel Corporation.
3  * All Rights Reserved.
4
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  *
24  * Authors:
25  *    Benjamin Defnet <benjamin.r.defnet@intel.com>
26  *    Rajesh Poornachandran <rajesh.poornachandran@intel.com>
27  *
28  */
29 #ifndef _PSB_POWERMGMT_H_
30 #define _PSB_POWERMGMT_H_
31
32 #include <linux/pci.h>
33 #include <drm/drmP.h>
34
35 #define OSPM_GRAPHICS_ISLAND    0x1
36 #define OSPM_VIDEO_ENC_ISLAND   0x2
37 #define OSPM_VIDEO_DEC_ISLAND   0x4
38 #define OSPM_DISPLAY_ISLAND     0x8
39 #define OSPM_GL3_CACHE_ISLAND   0x10
40 #define OSPM_ALL_ISLANDS        0x1f
41
42 /* IPC message and command defines used to enable/disable mipi panel voltages */
43 #define IPC_MSG_PANEL_ON_OFF    0xE9
44 #define IPC_CMD_PANEL_ON        1
45 #define IPC_CMD_PANEL_OFF       0
46
47 typedef enum _UHBUsage
48 {
49     OSPM_UHB_ONLY_IF_ON = 0,
50     OSPM_UHB_FORCE_POWER_ON,
51 } UHBUsage;
52
53 /* Use these functions to power down video HW for D0i3 purpose  */
54
55 void ospm_power_init(struct drm_device *dev);
56 void ospm_power_uninit(void);
57
58
59 /*
60  * OSPM will call these functions
61  */
62 int ospm_power_suspend(struct pci_dev *pdev, pm_message_t state);
63 int ospm_power_resume(struct pci_dev *pdev);
64
65 /*
66  * These are the functions the driver should use to wrap all hw access
67  * (i.e. register reads and writes)
68  */
69 bool ospm_power_using_hw_begin(int hw_island, UHBUsage usage);
70 void ospm_power_using_hw_end(int hw_island);
71
72 /*
73  * Use this function to do an instantaneous check for if the hw is on.
74  * Only use this in cases where you know the g_state_change_mutex
75  * is already held such as in irq install/uninstall and you need to
76  * prevent a deadlock situation.  Otherwise use ospm_power_using_hw_begin().
77  */
78 bool ospm_power_is_hw_on(int hw_islands);
79
80 /*
81  * Power up/down different hw component rails/islands
82  */
83 void ospm_power_island_down(int hw_islands);
84 void ospm_power_island_up(int hw_islands);
85 void ospm_suspend_graphics(void);
86 /*
87  * GFX-Runtime PM callbacks
88  */
89 int psb_runtime_suspend(struct device *dev);
90 int psb_runtime_resume(struct device *dev);
91 int psb_runtime_idle(struct device *dev);
92 int ospm_runtime_pm_allow(struct drm_device * dev);
93 void ospm_runtime_pm_forbid(struct drm_device * dev);
94
95
96 #endif /*_PSB_POWERMGMT_H_*/