Given that BenH says using the sysdev approach for DRM is bogus, I'll yank
the code for it, rather than introducing something that isn't going to work 100% of the time.main
parent
75ba453365
commit
b6b270a260
|
@ -10,7 +10,7 @@
|
|||
drm-objs := drm_auth.o drm_bufs.o drm_context.o drm_dma.o drm_drawable.o \
|
||||
drm_drv.o drm_fops.o drm_ioctl.o drm_irq.o \
|
||||
drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
|
||||
drm_sysfs.o drm_pci.o drm_pm.o drm_agpsupport.o drm_scatter.o \
|
||||
drm_sysfs.o drm_pci.o drm_agpsupport.o drm_scatter.o \
|
||||
drm_memory_debug.o ati_pcigart.o
|
||||
tdfx-objs := tdfx_drv.o
|
||||
r128-objs := r128_drv.o r128_cce.o r128_state.o r128_irq.o
|
||||
|
|
|
@ -80,7 +80,6 @@
|
|||
#endif
|
||||
#include <linux/poll.h>
|
||||
#include <asm/pgalloc.h>
|
||||
#include <linux/sysdev.h>
|
||||
#include "drm.h"
|
||||
|
||||
#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
|
||||
|
@ -542,7 +541,6 @@ struct drm_driver {
|
|||
int new);
|
||||
int (*kernel_context_switch_unlock) (struct drm_device * dev);
|
||||
int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence);
|
||||
int (*power) (struct drm_device * dev, unsigned int state);
|
||||
|
||||
/**
|
||||
* Called by \c drm_device_is_agp. Typically used to determine if a
|
||||
|
@ -722,8 +720,6 @@ typedef struct drm_device {
|
|||
struct drm_driver *driver;
|
||||
drm_local_map_t *agp_buffer_map;
|
||||
drm_head_t primary; /**< primary screen head */
|
||||
|
||||
struct sys_device sysdev; /**< Power Management device structure */
|
||||
} drm_device_t;
|
||||
|
||||
static __inline__ int drm_core_check_feature(struct drm_device *dev,
|
||||
|
|
|
@ -268,9 +268,6 @@ int drm_takedown(drm_device_t * dev)
|
|||
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
drm_dma_takedown(dev);
|
||||
|
||||
if (drm_fb_loaded)
|
||||
drm_pm_takedown(dev);
|
||||
|
||||
if (dev->lock.hw_lock) {
|
||||
dev->sigdata.lock = dev->lock.hw_lock = NULL; /* SHM removed */
|
||||
dev->lock.filp = NULL;
|
||||
|
@ -339,9 +336,6 @@ int drm_init(struct drm_driver *driver,
|
|||
if (!drm_fb_loaded)
|
||||
pci_register_driver(&driver->pci_driver);
|
||||
else {
|
||||
if ((rc = drm_pm_init()))
|
||||
return rc;
|
||||
|
||||
for (i = 0; pciidlist[i].vendor != 0; i++) {
|
||||
pid = &pciidlist[i];
|
||||
|
||||
|
@ -355,7 +349,6 @@ int drm_init(struct drm_driver *driver,
|
|||
pci_dev_get(pdev);
|
||||
if ((rc = drm_get_dev(pdev, &pciidlist[i], driver))) {
|
||||
pci_dev_put(pdev);
|
||||
drm_pm_exit();
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
@ -542,7 +535,6 @@ static void __exit drm_core_exit(void)
|
|||
unregister_chrdev(DRM_MAJOR, "drm");
|
||||
|
||||
drm_free(drm_heads, sizeof(*drm_heads) * cards_limit, DRM_MEM_STUB);
|
||||
drm_pm_exit();
|
||||
}
|
||||
|
||||
module_init(drm_core_init);
|
||||
|
|
|
@ -1,152 +0,0 @@
|
|||
/**
|
||||
* \file drm_pm.h
|
||||
* Power management support
|
||||
*
|
||||
* \author José Fonseca <jrfonseca@tungstengraphics.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2004 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* 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
|
||||
* TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
|
||||
*/
|
||||
|
||||
#define __NO_VERSION__
|
||||
#include "drmP.h"
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/sysdev.h>
|
||||
|
||||
|
||||
static int drm_suspend(struct sys_device *sysdev, u32 state)
|
||||
{
|
||||
struct drm_device *dev =
|
||||
container_of(sysdev, struct drm_device, sysdev);
|
||||
|
||||
DRM_DEBUG("state=%d\n", state);
|
||||
|
||||
if (dev->driver->power)
|
||||
return dev->driver->power(dev, state);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int drm_resume(struct sys_device *sysdev)
|
||||
{
|
||||
struct drm_device *dev =
|
||||
container_of(sysdev, struct drm_device, sysdev);
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
if (dev->driver->power)
|
||||
return dev->driver->power(dev, 0);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int shutdown(struct sys_device *sysdev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static atomic_t sysdev_loaded = ATOMIC_INIT(-1);
|
||||
static struct sysdev_class drm_sysdev_class = {
|
||||
set_kset_name("drm"),
|
||||
.resume = drm_resume,
|
||||
.suspend = drm_suspend,
|
||||
.shutdown = shutdown,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the Power Management data.
|
||||
*
|
||||
* \param dev DRM device.
|
||||
* \return zero on success or a negative value on failure.
|
||||
*/
|
||||
int drm_pm_setup(drm_device_t *dev)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (atomic_read(&sysdev_loaded) == -1)
|
||||
return 0;
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
dev->sysdev.id = dev->primary.minor;
|
||||
dev->sysdev.cls = &drm_sysdev_class;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4)
|
||||
rc = sys_device_register(&dev->sysdev);
|
||||
#else
|
||||
rc = sysdev_register(&dev->sysdev);
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup the Power Management resources.
|
||||
*
|
||||
* \param dev DRM device.
|
||||
*/
|
||||
void drm_pm_takedown(drm_device_t *dev)
|
||||
{
|
||||
if (atomic_read(&sysdev_loaded) == -1)
|
||||
return;
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4)
|
||||
sys_device_unregister(&dev->sysdev);
|
||||
#else
|
||||
sysdev_unregister(&dev->sysdev);
|
||||
#endif
|
||||
}
|
||||
|
||||
int drm_pm_init(void)
|
||||
{
|
||||
int rc;
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
/* triggers on -1 to 0 transition */
|
||||
if (!atomic_inc_and_test(&sysdev_loaded))
|
||||
return 0;
|
||||
|
||||
if ((rc = sysdev_class_register(&drm_sysdev_class))) {
|
||||
/* reset it back to -1 */
|
||||
atomic_dec(&sysdev_loaded);
|
||||
} else {
|
||||
/* inc it up to 1 so that unload will trigger on 1->0 */
|
||||
atomic_inc(&sysdev_loaded);
|
||||
DRM_DEBUG("registered\n");
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
void __exit drm_pm_exit(void)
|
||||
{
|
||||
DRM_DEBUG("\n");
|
||||
/* triggers on the 1 to 0 transistion */
|
||||
if (atomic_dec_and_test(&sysdev_loaded)) {
|
||||
sysdev_class_unregister(&drm_sysdev_class);
|
||||
DRM_DEBUG("unregisted\n");
|
||||
}
|
||||
}
|
|
@ -94,10 +94,6 @@ static int fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
|
|||
|
||||
dev->driver = driver;
|
||||
|
||||
if (drm_fb_loaded)
|
||||
if ((retcode = drm_pm_setup( dev )))
|
||||
goto error_out_unreg;
|
||||
|
||||
if (dev->driver->preinit)
|
||||
if ((retcode = dev->driver->preinit(dev, ent->driver_data)))
|
||||
goto error_out_unreg;
|
||||
|
|
|
@ -90,7 +90,6 @@ static struct drm_driver driver = {
|
|||
.postinit = postinit,
|
||||
.version = version,
|
||||
.ioctls = i915_ioctls,
|
||||
.power = i915_power,
|
||||
.fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = drm_open,
|
||||
|
|
|
@ -165,29 +165,3 @@ int i915_resume( struct pci_dev *pdev )
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i915_power( drm_device_t *dev, unsigned int state )
|
||||
{
|
||||
drm_i915_private_t *dev_priv =
|
||||
(drm_i915_private_t *)dev->dev_private;
|
||||
|
||||
DRM_DEBUG("%s state=%d\n", __FUNCTION__, state);
|
||||
|
||||
if (!dev_priv) return 0;
|
||||
|
||||
/* Save state for power up later */
|
||||
if (state != 0) {
|
||||
I915_WRITE( SRX_INDEX, SR01 );
|
||||
dev_priv->sr01 = I915_READ( SRX_DATA );
|
||||
dev_priv->dvoc = I915_READ( DVOC );
|
||||
dev_priv->dvob = I915_READ( DVOB );
|
||||
dev_priv->lvds = I915_READ( LVDS );
|
||||
dev_priv->adpa = I915_READ( ADPA );
|
||||
dev_priv->ppcr = I915_READ( PPCR );
|
||||
}
|
||||
|
||||
/* D0: set DPMS mode on */
|
||||
i915_set_dpms(dev, state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue