diff options
author | Tony Lofthouse <a0741364@ti.com> | 2012-03-06 11:07:01 -0600 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-11-19 21:05:21 +0100 |
commit | e67c9a6c21efdf1de2d4534e1d2b873910f1bb9d (patch) | |
tree | 1df12172e4f35e665c39fa154d512bced44ee760 /arch/arm/plat-omap | |
parent | fe286f980697feb074d0b4bc21376777b3465008 (diff) | |
download | kernel_samsung_tuna-e67c9a6c21efdf1de2d4534e1d2b873910f1bb9d.zip kernel_samsung_tuna-e67c9a6c21efdf1de2d4534e1d2b873910f1bb9d.tar.gz kernel_samsung_tuna-e67c9a6c21efdf1de2d4534e1d2b873910f1bb9d.tar.bz2 |
sgx_omaplfb: Create omaplfb platform device file to permit device configuration
Change-Id: Ic790a0440d19d862d981a230470523409b25b9a3
Signed-off-by: Tony Lofthouse <a0741364@ti.com>
Signed-off-by: Gustavo Diaz Prado <a0273371@ti.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r-- | arch/arm/plat-omap/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/sgx_omaplfb.h | 71 | ||||
-rw-r--r-- | arch/arm/plat-omap/sgx_omaplfb.c | 81 |
3 files changed, 153 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile index 954ace3..6fd1670 100644 --- a/arch/arm/plat-omap/Makefile +++ b/arch/arm/plat-omap/Makefile @@ -35,3 +35,4 @@ obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-interface.o obj-$(CONFIG_OMAP_PM) += omap-pm-interface.o omap-pm-helper.o 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 index 0000000..66d59b2 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/sgx_omaplfb.h @@ -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 index 0000000..569f3c8 --- /dev/null +++ b/arch/arm/plat-omap/sgx_omaplfb.c @@ -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); |