summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHemant Hariyani <hemanthariyani@ti.com>2010-08-25 13:31:15 -0500
committerSebastien Jan <s-jan@ti.com>2010-09-01 09:41:40 +0200
commit6ce937791fb32fdf111e4d32d3d5ec75e868fc94 (patch)
treecb737bf92f1668032d272885399dad9d3dcccd93
parentceebfc1a91e5ffab4af9e7834296a647f8956aed (diff)
Kernel changes for hwmod and omap_device initialization for GPU.
Signed-off-by: Hemant Hariyani <hemanthariyani@ti.com>
-rw-r--r--arch/arm/mach-omap2/devices.c53
-rwxr-xr-xarch/arm/mach-omap2/omap_hwmod_44xx_data.c2
-rw-r--r--arch/arm/plat-omap/include/plat/gpu.h33
3 files changed, 86 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 52b1f5911e28..cccb6f7dd68b 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -32,6 +32,7 @@
#include <plat/mmc.h>
#include <plat/display.h>
#include <plat/dma.h>
+#include <plat/gpu.h>
#include <plat/omap_device.h>
#include <plat/omap_hwmod.h>
#include <plat/omap4-keypad.h>
@@ -971,6 +972,56 @@ static inline void omap_init_vout(void) {}
static void omap_init_wb(void) {}
#endif
+static struct omap_device_pm_latency omap_gpu_latency[] = {
+ [0] = {
+ .deactivate_func = omap_device_idle_hwmods,
+ .activate_func = omap_device_enable_hwmods,
+ .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+ },
+};
+
+static void omap_init_gpu(void)
+{
+ struct omap_hwmod *oh;
+ struct omap_device *od;
+ int max_omap_gpu_hwmod_name_len = 16;
+ char oh_name[max_omap_gpu_hwmod_name_len];
+ int l;
+ struct gpu_platform_data *pdata;
+ char *name = "omap_gpu";
+
+ l = snprintf(oh_name, max_omap_gpu_hwmod_name_len,
+ "gpu");
+ WARN(l >= max_omap_gpu_hwmod_name_len,
+ "String buffer overflow in GPU device setup\n");
+
+ oh = omap_hwmod_lookup(oh_name);
+ if (!oh) {
+
+ pr_err("omap_init_gpu: Could not look up %s\n", oh_name);
+ return;
+ }
+
+ pdata = kzalloc(sizeof(struct gpu_platform_data),
+ GFP_KERNEL);
+ if (!pdata) {
+ pr_err("omap_init_gpu: Platform data memory allocation failed\n");
+ return;
+ }
+
+ pdata->device_enable = omap_device_enable;
+ pdata->device_idle = omap_device_idle;
+ pdata->device_shutdown = omap_device_shutdown;
+
+ od = omap_device_build(name, 0, oh, pdata,
+ sizeof(struct gpu_platform_data),
+ omap_gpu_latency, ARRAY_SIZE(omap_gpu_latency), 0);
+ WARN(IS_ERR(od), "Could not build omap_device for %s %s\n",
+ name, oh_name);
+
+ kfree(pdata);
+}
+
/*-------------------------------------------------------------------------*/
static int __init omap2_init_devices(void)
@@ -991,7 +1042,7 @@ static int __init omap2_init_devices(void)
omap_init_vout();
if (cpu_is_omap44xx())
omap_init_wb();
-
+ omap_init_gpu();
return 0;
}
arch_initcall(omap2_init_devices);
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 3fdab2523ab9..113cb7f5a015 100755
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -5809,7 +5809,7 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
/* gpmc class */
&omap44xx_gpmc_hwmod,
/* gpu class */
-/* &omap44xx_gpu_hwmod, */
+ &omap44xx_gpu_hwmod,
/* hsi class */
/* &omap44xx_hsi_hwmod, */
/* i2c class */
diff --git a/arch/arm/plat-omap/include/plat/gpu.h b/arch/arm/plat-omap/include/plat/gpu.h
new file mode 100644
index 000000000000..70dcc922bcba
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/gpu.h
@@ -0,0 +1,33 @@
+/*
+ * arch/arm/plat-omap/include/plat/gpu.h
+ *
+ * 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 OMAP_GPU_H
+#define OMAP_GPU_H
+
+#include <plat/omap-pm.h>
+#include <linux/platform_device.h>
+
+struct gpu_platform_data {
+ void (*set_min_bus_tput)(struct device *dev, u8 agent_id,
+ unsigned long r);
+ int (*device_enable) (struct platform_device *pdev);
+ int (*device_shutdown) (struct platform_device *pdev);
+ int (*device_idle) (struct platform_device *pdev);
+};
+
+#endif