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