aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-07-07 04:37:35 -0400
committerDave Airlie <airlied@redhat.com>2010-07-07 04:37:35 -0400
commitdb8cc27b804f89e8fd5f9d5385161956a777c471 (patch)
tree4d84e12dbf9b4bd75fa6150f4aedf54a41d722db /include/drm
parent6dbe7465713f0e45f0e867105ca944978d57346e (diff)
parent05269a3a5a78bb074413de495105d7a2686c4529 (diff)
Merge branch 'drm-platform' into drm-testing
* drm-platform: drm: Make sure the DRM offset matches the CPU drm: Add __arm defines to DRM drm: Add support for platform devices to register as DRM devices drm: Remove drm_resource wrappers
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drmP.h56
1 files changed, 44 insertions, 12 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index c1b987158dfa..6235169d5950 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -9,6 +9,7 @@
9/* 9/*
10 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 10 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
11 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 11 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
12 * Copyright (c) 2009-2010, Code Aurora Forum.
12 * All rights reserved. 13 * All rights reserved.
13 * 14 *
14 * Permission is hereby granted, free of charge, to any person obtaining a 15 * Permission is hereby granted, free of charge, to any person obtaining a
@@ -48,6 +49,7 @@
48#include <linux/proc_fs.h> 49#include <linux/proc_fs.h>
49#include <linux/init.h> 50#include <linux/init.h>
50#include <linux/file.h> 51#include <linux/file.h>
52#include <linux/platform_device.h>
51#include <linux/pci.h> 53#include <linux/pci.h>
52#include <linux/jiffies.h> 54#include <linux/jiffies.h>
53#include <linux/smp_lock.h> /* For (un)lock_kernel */ 55#include <linux/smp_lock.h> /* For (un)lock_kernel */
@@ -144,6 +146,7 @@ extern void drm_ut_debug_printk(unsigned int request_level,
144#define DRIVER_IRQ_VBL2 0x800 146#define DRIVER_IRQ_VBL2 0x800
145#define DRIVER_GEM 0x1000 147#define DRIVER_GEM 0x1000
146#define DRIVER_MODESET 0x2000 148#define DRIVER_MODESET 0x2000
149#define DRIVER_USE_PLATFORM_DEVICE 0x4000
147 150
148/***********************************************************************/ 151/***********************************************************************/
149/** \name Begin the DRM... */ 152/** \name Begin the DRM... */
@@ -823,6 +826,7 @@ struct drm_driver {
823 int num_ioctls; 826 int num_ioctls;
824 struct file_operations fops; 827 struct file_operations fops;
825 struct pci_driver pci_driver; 828 struct pci_driver pci_driver;
829 struct platform_device *platform_device;
826 /* List of devices hanging off this driver */ 830 /* List of devices hanging off this driver */
827 struct list_head device_list; 831 struct list_head device_list;
828}; 832};
@@ -1015,12 +1019,16 @@ struct drm_device {
1015 1019
1016 struct drm_agp_head *agp; /**< AGP data */ 1020 struct drm_agp_head *agp; /**< AGP data */
1017 1021
1022 struct device *dev; /**< Device structure */
1018 struct pci_dev *pdev; /**< PCI device structure */ 1023 struct pci_dev *pdev; /**< PCI device structure */
1019 int pci_vendor; /**< PCI vendor id */ 1024 int pci_vendor; /**< PCI vendor id */
1020 int pci_device; /**< PCI device id */ 1025 int pci_device; /**< PCI device id */
1021#ifdef __alpha__ 1026#ifdef __alpha__
1022 struct pci_controller *hose; 1027 struct pci_controller *hose;
1023#endif 1028#endif
1029
1030 struct platform_device *platformdev; /**< Platform device struture */
1031
1024 struct drm_sg_mem *sg; /**< Scatter gather memory */ 1032 struct drm_sg_mem *sg; /**< Scatter gather memory */
1025 int num_crtcs; /**< Number of CRTCs on this device */ 1033 int num_crtcs; /**< Number of CRTCs on this device */
1026 void *dev_private; /**< device private data */ 1034 void *dev_private; /**< device private data */
@@ -1060,17 +1068,21 @@ struct drm_device {
1060 1068
1061}; 1069};
1062 1070
1063static inline int drm_dev_to_irq(struct drm_device *dev)
1064{
1065 return dev->pdev->irq;
1066}
1067
1068static __inline__ int drm_core_check_feature(struct drm_device *dev, 1071static __inline__ int drm_core_check_feature(struct drm_device *dev,
1069 int feature) 1072 int feature)
1070{ 1073{
1071 return ((dev->driver->driver_features & feature) ? 1 : 0); 1074 return ((dev->driver->driver_features & feature) ? 1 : 0);
1072} 1075}
1073 1076
1077
1078static inline int drm_dev_to_irq(struct drm_device *dev)
1079{
1080 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1081 return platform_get_irq(dev->platformdev, 0);
1082 else
1083 return dev->pdev->irq;
1084}
1085
1074#ifdef __alpha__ 1086#ifdef __alpha__
1075#define drm_get_pci_domain(dev) dev->hose->index 1087#define drm_get_pci_domain(dev) dev->hose->index
1076#else 1088#else
@@ -1273,10 +1285,6 @@ extern int drm_freebufs(struct drm_device *dev, void *data,
1273extern int drm_mapbufs(struct drm_device *dev, void *data, 1285extern int drm_mapbufs(struct drm_device *dev, void *data,
1274 struct drm_file *file_priv); 1286 struct drm_file *file_priv);
1275extern int drm_order(unsigned long size); 1287extern int drm_order(unsigned long size);
1276extern resource_size_t drm_get_resource_start(struct drm_device *dev,
1277 unsigned int resource);
1278extern resource_size_t drm_get_resource_len(struct drm_device *dev,
1279 unsigned int resource);
1280 1288
1281 /* DMA support (drm_dma.h) */ 1289 /* DMA support (drm_dma.h) */
1282extern int drm_dma_setup(struct drm_device *dev); 1290extern int drm_dma_setup(struct drm_device *dev);
@@ -1351,8 +1359,11 @@ extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
1351struct drm_master *drm_master_create(struct drm_minor *minor); 1359struct drm_master *drm_master_create(struct drm_minor *minor);
1352extern struct drm_master *drm_master_get(struct drm_master *master); 1360extern struct drm_master *drm_master_get(struct drm_master *master);
1353extern void drm_master_put(struct drm_master **master); 1361extern void drm_master_put(struct drm_master **master);
1354extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1362extern int drm_get_pci_dev(struct pci_dev *pdev,
1355 struct drm_driver *driver); 1363 const struct pci_device_id *ent,
1364 struct drm_driver *driver);
1365extern int drm_get_platform_dev(struct platform_device *pdev,
1366 struct drm_driver *driver);
1356extern void drm_put_dev(struct drm_device *dev); 1367extern void drm_put_dev(struct drm_device *dev);
1357extern int drm_put_minor(struct drm_minor **minor); 1368extern int drm_put_minor(struct drm_minor **minor);
1358extern unsigned int drm_debug; 1369extern unsigned int drm_debug;
@@ -1529,6 +1540,9 @@ static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1529 1540
1530static __inline__ int drm_device_is_agp(struct drm_device *dev) 1541static __inline__ int drm_device_is_agp(struct drm_device *dev)
1531{ 1542{
1543 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1544 return 0;
1545
1532 if (dev->driver->device_is_agp != NULL) { 1546 if (dev->driver->device_is_agp != NULL) {
1533 int err = (*dev->driver->device_is_agp) (dev); 1547 int err = (*dev->driver->device_is_agp) (dev);
1534 1548
@@ -1542,7 +1556,10 @@ static __inline__ int drm_device_is_agp(struct drm_device *dev)
1542 1556
1543static __inline__ int drm_device_is_pcie(struct drm_device *dev) 1557static __inline__ int drm_device_is_pcie(struct drm_device *dev)
1544{ 1558{
1545 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); 1559 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1560 return 0;
1561 else
1562 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1546} 1563}
1547 1564
1548static __inline__ void drm_core_dropmap(struct drm_local_map *map) 1565static __inline__ void drm_core_dropmap(struct drm_local_map *map)
@@ -1550,6 +1567,21 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1550} 1567}
1551 1568
1552#include "drm_mem_util.h" 1569#include "drm_mem_util.h"
1570
1571static inline void *drm_get_device(struct drm_device *dev)
1572{
1573 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1574 return dev->platformdev;
1575 else
1576 return dev->pdev;
1577}
1578
1579extern int drm_platform_init(struct drm_driver *driver);
1580extern int drm_pci_init(struct drm_driver *driver);
1581extern int drm_fill_in_dev(struct drm_device *dev,
1582 const struct pci_device_id *ent,
1583 struct drm_driver *driver);
1584int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type);
1553/*@}*/ 1585/*@}*/
1554 1586
1555#endif /* __KERNEL__ */ 1587#endif /* __KERNEL__ */