xref: /openbmc/linux/drivers/gpu/drm/gma500/power.h (revision bbbb262d375140a27ed9fe45a13f19a04a0c51b2)
1*bbbb262dSAlan Cox /**************************************************************************
2*bbbb262dSAlan Cox  * Copyright (c) 2009-2011, Intel Corporation.
3*bbbb262dSAlan Cox  * All Rights Reserved.
4*bbbb262dSAlan Cox 
5*bbbb262dSAlan Cox  * Permission is hereby granted, free of charge, to any person obtaining a
6*bbbb262dSAlan Cox  * copy of this software and associated documentation files (the "Software"),
7*bbbb262dSAlan Cox  * to deal in the Software without restriction, including without limitation
8*bbbb262dSAlan Cox  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9*bbbb262dSAlan Cox  * and/or sell copies of the Software, and to permit persons to whom the
10*bbbb262dSAlan Cox  * Software is furnished to do so, subject to the following conditions:
11*bbbb262dSAlan Cox  *
12*bbbb262dSAlan Cox  * The above copyright notice and this permission notice (including the next
13*bbbb262dSAlan Cox  * paragraph) shall be included in all copies or substantial portions of the
14*bbbb262dSAlan Cox  * Software.
15*bbbb262dSAlan Cox  *
16*bbbb262dSAlan Cox  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17*bbbb262dSAlan Cox  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18*bbbb262dSAlan Cox  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19*bbbb262dSAlan Cox  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20*bbbb262dSAlan Cox  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21*bbbb262dSAlan Cox  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22*bbbb262dSAlan Cox  * SOFTWARE.
23*bbbb262dSAlan Cox  *
24*bbbb262dSAlan Cox  * Authors:
25*bbbb262dSAlan Cox  *    Benjamin Defnet <benjamin.r.defnet@intel.com>
26*bbbb262dSAlan Cox  *    Rajesh Poornachandran <rajesh.poornachandran@intel.com>
27*bbbb262dSAlan Cox  * Massively reworked
28*bbbb262dSAlan Cox  *    Alan Cox <alan@linux.intel.com>
29*bbbb262dSAlan Cox  */
30*bbbb262dSAlan Cox #ifndef _PSB_POWERMGMT_H_
31*bbbb262dSAlan Cox #define _PSB_POWERMGMT_H_
32*bbbb262dSAlan Cox 
33*bbbb262dSAlan Cox #include <linux/pci.h>
34*bbbb262dSAlan Cox #include <drm/drmP.h>
35*bbbb262dSAlan Cox 
36*bbbb262dSAlan Cox void gma_power_init(struct drm_device *dev);
37*bbbb262dSAlan Cox void gma_power_uninit(struct drm_device *dev);
38*bbbb262dSAlan Cox 
39*bbbb262dSAlan Cox /*
40*bbbb262dSAlan Cox  * The kernel bus power management  will call these functions
41*bbbb262dSAlan Cox  */
42*bbbb262dSAlan Cox int gma_power_suspend(struct device *dev);
43*bbbb262dSAlan Cox int gma_power_resume(struct device *dev);
44*bbbb262dSAlan Cox 
45*bbbb262dSAlan Cox /*
46*bbbb262dSAlan Cox  * These are the functions the driver should use to wrap all hw access
47*bbbb262dSAlan Cox  * (i.e. register reads and writes)
48*bbbb262dSAlan Cox  */
49*bbbb262dSAlan Cox bool gma_power_begin(struct drm_device *dev, bool force);
50*bbbb262dSAlan Cox void gma_power_end(struct drm_device *dev);
51*bbbb262dSAlan Cox 
52*bbbb262dSAlan Cox /*
53*bbbb262dSAlan Cox  * Use this function to do an instantaneous check for if the hw is on.
54*bbbb262dSAlan Cox  * Only use this in cases where you know the mutex is already held such
55*bbbb262dSAlan Cox  * as in irq install/uninstall and you need to
56*bbbb262dSAlan Cox  * prevent a deadlock situation.  Otherwise use gma_power_begin().
57*bbbb262dSAlan Cox  */
58*bbbb262dSAlan Cox bool gma_power_is_on(struct drm_device *dev);
59*bbbb262dSAlan Cox 
60*bbbb262dSAlan Cox /*
61*bbbb262dSAlan Cox  * GFX-Runtime PM callbacks
62*bbbb262dSAlan Cox  */
63*bbbb262dSAlan Cox int psb_runtime_suspend(struct device *dev);
64*bbbb262dSAlan Cox int psb_runtime_resume(struct device *dev);
65*bbbb262dSAlan Cox int psb_runtime_idle(struct device *dev);
66*bbbb262dSAlan Cox 
67*bbbb262dSAlan Cox #endif /*_PSB_POWERMGMT_H_*/
68