aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorShivananda Hebbar <x0hebbar@ti.com>2012-02-02 15:30:14 -0600
committerDan Murphy <dmurphy@ti.com>2012-02-15 07:45:08 -0600
commit7e0b63a88f89618be47b4acd75d71ee0ad086cab (patch)
tree08f76426c5606b2d23f4ba4b8205a85768fbdc5f /drivers/media/video
parentff011d6949ffe7b38c9121b2165236bc7746e318 (diff)
downloadkernel_samsung_espresso10-7e0b63a88f89618be47b4acd75d71ee0ad086cab.zip
kernel_samsung_espresso10-7e0b63a88f89618be47b4acd75d71ee0ad086cab.tar.gz
kernel_samsung_espresso10-7e0b63a88f89618be47b4acd75d71ee0ad086cab.tar.bz2
OMAP: TILER: Make character driver creation configurable
The TILER code that creates the character driver code and interacts with the userspace has been placed under the kernel configuration option that controls the userspace, so that the cdev creation is bypassed when userspace is disabled. Change-Id: I3d5d372433fc89e676e54088dc8af8bdb74b8007 Signed-off-by: Shivananda Hebbar <x0hebbar@ti.com> Signed-off-by: Andy Gross <andy.gross@ti.com> Signed-off-by: Suman Anna <s-anna@ti.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/tiler/tiler-ioctl.c4
-rw-r--r--drivers/media/video/tiler/tiler-main.c24
2 files changed, 22 insertions, 6 deletions
diff --git a/drivers/media/video/tiler/tiler-ioctl.c b/drivers/media/video/tiler/tiler-ioctl.c
index b54c39f..0d5f063 100644
--- a/drivers/media/video/tiler/tiler-ioctl.c
+++ b/drivers/media/video/tiler/tiler-ioctl.c
@@ -171,6 +171,7 @@ void _m_unregister_buf(struct __buf_info *_b)
* ==========================================================================
*/
+#ifdef CONFIG_TILER_ENABLE_USERSPACE
/* mmap tiler buffer into user's virtual space */
static s32 tiler_mmap(struct file *filp, struct vm_area_struct *vma)
{
@@ -498,12 +499,15 @@ static const struct file_operations tiler_fops = {
.release = tiler_release,
.mmap = tiler_mmap,
};
+#endif
void tiler_ioctl_init(struct tiler_ops *tiler)
{
ops = tiler;
+#ifdef CONFIG_TILER_ENABLE_USERSPACE
ops->fops = &tiler_fops;
+#endif
#ifdef CONFIG_TILER_SECURE
offset_lookup = ssptr_lookup = false;
diff --git a/drivers/media/video/tiler/tiler-main.c b/drivers/media/video/tiler/tiler-main.c
index bce9699..2befe0e 100644
--- a/drivers/media/video/tiler/tiler-main.c
+++ b/drivers/media/video/tiler/tiler-main.c
@@ -55,9 +55,6 @@ MODULE_PARM_DESC(grain, "Granularity (bytes)");
module_param_named(alloc_debug, tiler_alloc_debug, uint, 0644);
MODULE_PARM_DESC(alloc_debug, "Allocation debug flag");
-struct tiler_dev {
- struct cdev cdev;
-};
static struct dentry *dbgfs;
static struct dentry *dbg_map;
@@ -67,9 +64,14 @@ static struct list_head blocks; /* all tiler blocks */
static struct list_head orphan_areas; /* orphaned 2D areas */
static struct list_head orphan_onedim; /* orphaned 1D areas */
+#ifdef CONFIG_TILER_ENABLE_USERSPACE
+struct tiler_dev {
+ struct cdev cdev;
+};
static s32 tiler_major;
static s32 tiler_minor;
static struct tiler_dev *tiler_device;
+#endif
static struct class *tilerdev_class;
static struct mutex mtx;
static struct tcm *tcm[TILER_FORMATS];
@@ -77,6 +79,7 @@ static struct tmm *tmm[TILER_FORMATS];
static u32 *dmac_va;
static dma_addr_t dmac_pa;
static DEFINE_MUTEX(dmac_mtx);
+static dev_t dev;
/*
* TMM connectors
@@ -1506,7 +1509,6 @@ static struct platform_driver tiler_driver_ldm = {
static s32 __init tiler_init(void)
{
- dev_t dev = 0;
s32 r = -1;
struct device *device = NULL;
struct tcm_pt div_pt;
@@ -1582,8 +1584,13 @@ static s32 __init tiler_init(void)
tiler.nv12_packed = tcm[TILFMT_8BIT] == tcm[TILFMT_16BIT];
#endif
+ if (!sita || !tmm_pat) {
+ r = -ENOMEM;
+ goto error;
+ }
+#ifdef CONFIG_TILER_ENABLE_USERSPACE
tiler_device = kmalloc(sizeof(*tiler_device), GFP_KERNEL);
- if (!tiler_device || !sita || !tmm_pat) {
+ if (!tiler_device) {
r = -ENOMEM;
goto error;
}
@@ -1604,6 +1611,7 @@ static s32 __init tiler_init(void)
r = cdev_add(&tiler_device->cdev, dev, 1);
if (r)
printk(KERN_ERR "cdev_add():failed\n");
+#endif
tilerdev_class = class_create(THIS_MODULE, "tiler");
@@ -1639,7 +1647,9 @@ static s32 __init tiler_init(void)
error:
/* TODO: error handling for device registration */
if (r) {
+#ifdef CONFIG_TILER_ENABLE_USERSPACE
kfree(tiler_device);
+#endif
tcm_deinit(sita);
tmm_deinit(tmm_pat);
dma_free_coherent(NULL, tiler.width * tiler.height *
@@ -1685,9 +1695,11 @@ static void __exit tiler_exit(void)
mutex_destroy(&mtx);
platform_driver_unregister(&tiler_driver_ldm);
+#ifdef CONFIG_TILER_ENABLE_USERSPACE
cdev_del(&tiler_device->cdev);
kfree(tiler_device);
- device_destroy(tilerdev_class, MKDEV(tiler_major, tiler_minor));
+#endif
+ device_destroy(tilerdev_class, dev);
class_destroy(tilerdev_class);
}