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