/************************************************************************** * Copyright (c) 2009-2011, Intel Corporation. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Authors: * Benjamin Defnet <benjamin.r.defnet@intel.com> * Rajesh Poornachandran <rajesh.poornachandran@intel.com> * Massively reworked * Alan Cox <alan@linux.intel.com>
*/
/** * gma_power_init - initialise power manager * @dev: our device * * Set up for power management tracking of our hardware.
*/ void gma_power_init(struct drm_device *dev)
{ struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
/* FIXME: Move APM/OSPM base into relevant device code */
dev_priv->apm_base = dev_priv->apm_reg & 0xffff;
dev_priv->ospm_base &= 0xffff;
if (dev_priv->ops->init_pm)
dev_priv->ops->init_pm(dev);
/* * Runtime pm support is broken atm. So for now unconditionally * call pm_runtime_get() here and put it again in psb_driver_unload() * * To fix this we need to call pm_runtime_get() once for each active * pipe at boot and then put() / get() for each pipe disable / enable * so that the device gets runtime suspended when no pipes are active. * Once this is in place the pm_runtime_get() below should be replaced * by a pm_runtime_allow() call to undo the pm_runtime_forbid() from * pci_pm_init().
*/
pm_runtime_get(dev->dev);
dev_priv->pm_initialized = true;
}
/** * gma_power_uninit - end power manager * @dev: device to end for * * Undo the effects of gma_power_init
*/ void gma_power_uninit(struct drm_device *dev)
{ struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
if (!dev_priv->pm_initialized) return;
pm_runtime_put_noidle(dev->dev);
}
/** * gma_suspend_display - suspend the display logic * @dev: our DRM device * * Suspend the display logic of the graphics interface
*/ staticvoid gma_suspend_display(struct drm_device *dev)
{ struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
/** * gma_power_suspend - bus callback for suspend * @_dev: our device * * Called back by the PCI layer during a suspend of the system. We * perform the necessary shut down steps and save enough state that * we can undo this when resume is called.
*/ int gma_power_suspend(struct device *_dev)
{ struct pci_dev *pdev = to_pci_dev(_dev); struct drm_device *dev = pci_get_drvdata(pdev);
/** * gma_power_resume - resume power * @_dev: our device * * Resume the PCI side of the graphics and then the displays
*/ int gma_power_resume(struct device *_dev)
{ struct pci_dev *pdev = to_pci_dev(_dev); struct drm_device *dev = pci_get_drvdata(pdev);
/** * gma_power_begin - begin requiring power * @dev: our DRM device * @force_on: true to force power on * * Begin an action that requires the display power island is enabled. * We refcount the islands.
*/ bool gma_power_begin(struct drm_device *dev, bool force_on)
{ if (force_on) return pm_runtime_resume_and_get(dev->dev) == 0; else return pm_runtime_get_if_in_use(dev->dev) == 1;
}
/** * gma_power_end - end use of power * @dev: Our DRM device * * Indicate that one of our gma_power_begin() requested periods when * the diplay island power is needed has completed.
*/ void gma_power_end(struct drm_device *dev)
{
pm_runtime_put(dev->dev);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.