]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/kernel-video.git/commitdiff
gpu: sgx_omaplfb: Create omaplfb platform device file to permit device configuration
authorTony Lofthouse <a0741364@ti.com>
Tue, 9 Apr 2013 21:40:27 +0000 (14:40 -0700)
committerPraneeth Bajjuri <praneeth@ti.com>
Fri, 12 Jul 2013 22:45:13 +0000 (17:45 -0500)
Creat omaplfb initial instance

Change-Id: I9067e271bf9b680524a85ab18e97c3772a63d3ba
Signed-off-by: Tony Lofthouse <a0741364@ti.com>
Signed-off-by: Gustavo Diaz Prado <a0273371@ti.com>
Signed-off-by: Rodrigo Obregon <robregon@ti.com>
Signed-off-by: Dandawate Saket <dsaket@ti.com>
arch/arm/plat-omap/Makefile
arch/arm/plat-omap/include/plat/sgx_omaplfb.h [new file with mode: 0644]
arch/arm/plat-omap/sgx_omaplfb.c [new file with mode: 0644]

index a3f943eb1c41062f49d875641e3f8557b1bf2863..41cf4904b4524512d3eec37ac3ed2279ae9c5632 100644 (file)
@@ -16,3 +16,4 @@ i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
 obj-y += $(i2c-omap-m) $(i2c-omap-y)
 
 obj-$(CONFIG_DSSCOMP) += omap_dsscomp.o
+obj-$(CONFIG_ION_OMAP) += sgx_omaplfb.o
diff --git a/arch/arm/plat-omap/include/plat/sgx_omaplfb.h b/arch/arm/plat-omap/include/plat/sgx_omaplfb.h
new file mode 100644 (file)
index 0000000..66d59b2
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * SGX display class driver platform resources
+ *
+ * Copyright (C) 2012 Texas Instruments
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#ifndef _ARCH_ARM_PLAT_OMAP_SGX_OMAPLFB_H
+#define _ARCH_ARM_PLAT_OMAP_SGX_OMAPLFB_H
+
+enum sgx_omaplfb_flags {
+       /*
+        * This flag should be set when we do not want the primary display
+        * swap chain buffers to be used with an external display.
+        *
+        * The number of tiler2d and vram buffers need to be set appropriately
+        */
+       SGX_OMAPLFB_FLAGS_SDMA_TO_TILER2D_EXTERNAL = 0x00000001,
+};
+
+/*
+ * The settings this platform data entry will determine the type and number of
+ * buffers to use by omaplfb.
+ */
+struct sgx_omaplfb_config {
+       /*
+        * Number of tiler2d buffers required for display rendering,
+        * the number of buffers indicated by swap_chain_length will be used
+        * for the swap chain unless flags indicate otherwise
+        */
+       u32 tiler2d_buffers;
+       /*
+        * Number of vram buffers required for display rendering, if no tiler
+        * buffers are required or flags indicate then the number of buffers
+        * indicated by swap_chain_length will be used for the swap chain.
+        */
+       u32 vram_buffers;
+       /*
+        * Indicate any additional vram that needs to be reserved
+        */
+       u32 vram_reserve;
+       /*
+        * Tells omaplfb the number of buffers in the primary swapchain,
+        * if not set it defaults to 2.
+        */
+       u32 swap_chain_length;
+       enum sgx_omaplfb_flags flags;
+};
+
+struct sgx_omaplfb_platform_data {
+       u32 num_configs;
+       struct sgx_omaplfb_config *configs;
+};
+
+int sgx_omaplfb_set(unsigned int fbix, struct sgx_omaplfb_config *data);
+struct sgx_omaplfb_config *sgx_omaplfb_get(unsigned int fbix);
+
+#endif
diff --git a/arch/arm/plat-omap/sgx_omaplfb.c b/arch/arm/plat-omap/sgx_omaplfb.c
new file mode 100644 (file)
index 0000000..569f3c8
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * SGX display class driver platform resources
+ *
+ * Copyright (C) 2012 Texas Instruments
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <plat/board.h>
+
+#include <plat/sgx_omaplfb.h>
+
+#if defined(CONFIG_FB_OMAP2_NUM_FBS)
+#define OMAPLFB_NUM_DEV CONFIG_FB_OMAP2_NUM_FBS
+#else
+#define OMAPLFB_NUM_DEV 1
+#endif
+
+static struct sgx_omaplfb_config omaplfb_config[OMAPLFB_NUM_DEV] = {
+       {
+       .tiler2d_buffers = 2,
+       .swap_chain_length = 2,
+       }
+};
+
+static struct sgx_omaplfb_platform_data omaplfb_plat_data = {
+       .num_configs = OMAPLFB_NUM_DEV,
+       .configs = omaplfb_config,
+};
+
+static struct platform_device omaplfb_plat_device = {
+       .name           = "omaplfb",
+       .id             = -1,
+       .dev = {
+               .platform_data          = &omaplfb_plat_data,
+       },
+       .num_resources = 0,
+};
+
+int sgx_omaplfb_set(unsigned int fbix, struct sgx_omaplfb_config *data)
+{
+       if (fbix >= OMAPLFB_NUM_DEV) {
+               WARN(1, "Invalid FB device index");
+               return -ENOENT;
+       }
+       omaplfb_config[fbix] = *data;
+       return 0;
+}
+
+struct sgx_omaplfb_config *sgx_omaplfb_get(unsigned int fbix)
+{
+       if (fbix >= OMAPLFB_NUM_DEV) {
+               WARN(1, "Invalid FB device index");
+               return NULL;
+       }
+       return &omaplfb_config[fbix];
+}
+
+static int __init omap_init_omaplfb(void)
+{
+       return platform_device_register(&omaplfb_plat_device);
+}
+
+arch_initcall(omap_init_omaplfb);