diff options
author | Tate Hornbeck <tate.hornbeck@ti.com> | 2012-01-18 13:43:08 -0600 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-01 12:56:51 +0200 |
commit | c3d702be6d0fc273d97b810bcd70ae7b5fe374ed (patch) | |
tree | 3496f82e97d7ae4e9ca4938cbaf546e652ded330 /drivers/gpu | |
parent | 36a616d3bcd3b24cd35dc26c978fbae33e15027c (diff) | |
download | kernel_samsung_tuna-c3d702be6d0fc273d97b810bcd70ae7b5fe374ed.zip kernel_samsung_tuna-c3d702be6d0fc273d97b810bcd70ae7b5fe374ed.tar.gz kernel_samsung_tuna-c3d702be6d0fc273d97b810bcd70ae7b5fe374ed.tar.bz2 |
SGX-KM: egl.cfg sysfs entry
Create a runtime sysfs entry for egl.cfg. This is needed
by the SGX driver to determine which OpenGL libraries
to load.
Change-Id: Ief39f498721d0ad71942f8a49fcfefc4c449d656
Signed-off-by: Tate Hornbeck <tate.hornbeck@ti.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/pvr/Makefile | 1 | ||||
-rw-r--r-- | drivers/gpu/pvr/pvrsrv.c | 7 | ||||
-rw-r--r-- | drivers/gpu/pvr/sysfs.c | 79 | ||||
-rw-r--r-- | drivers/gpu/pvr/sysfs.h | 1 |
4 files changed, 88 insertions, 0 deletions
diff --git a/drivers/gpu/pvr/Makefile b/drivers/gpu/pvr/Makefile index 4fad869..6e0b333 100644 --- a/drivers/gpu/pvr/Makefile +++ b/drivers/gpu/pvr/Makefile @@ -99,6 +99,7 @@ pvrsrvkm-y := \ perproc.o \ lists.o \ refcount.o \ + sysfs.o \ omap4/sysconfig.o \ omap4/sysutils.o \ sgx/bridged_sgx_bridge.o \ diff --git a/drivers/gpu/pvr/pvrsrv.c b/drivers/gpu/pvr/pvrsrv.c index af2b6eb..2cea16f 100644 --- a/drivers/gpu/pvr/pvrsrv.c +++ b/drivers/gpu/pvr/pvrsrv.c @@ -32,6 +32,7 @@ #include "pdump_km.h" #include "deviceid.h" #include "ra.h" +#include "sysfs.h" #if defined(TTRACE) #include "ttrace.h" #endif @@ -202,6 +203,12 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVInit(PSYS_DATA psSysData) { PVRSRV_ERROR eError; + eError = PVRSRVCreateSysfsEntry(); + if (eError != PVRSRV_OK) + { + goto Error; + } + eError = ResManInit(); if (eError != PVRSRV_OK) diff --git a/drivers/gpu/pvr/sysfs.c b/drivers/gpu/pvr/sysfs.c new file mode 100644 index 0000000..d3fd69c --- /dev/null +++ b/drivers/gpu/pvr/sysfs.c @@ -0,0 +1,79 @@ +#include <linux/kobject.h> +#include <linux/sysfs.h> +#include <linux/stat.h> +#include <asm/page.h> +#include <linux/slab.h> +#include "services_headers.h" +#include "pdump_km.h" +#include "sysfs.h" + +/* sysfs structures */ +struct pvrsrv_attribute { + struct attribute attr; + int sgx_version; + int sgx_revision; +}; + +static struct pvrsrv_attribute PVRSRVAttr = { + .attr.name = "egl.cfg", + .attr.mode = S_IRUGO, +#if defined(SGX544) + .sgx_version = 544, + .sgx_revision = 112, +#else + .sgx_version = 540, + .sgx_revision = 120, +#endif +}; + +/* sysfs read function */ +static ssize_t PVRSRVEglCfgShow(struct kobject *kobj, struct attribute *attr, + char *buffer) { + struct pvrsrv_attribute *pvrsrv_attr; + + pvrsrv_attr = container_of(attr, struct pvrsrv_attribute, attr); + return snprintf(buffer, PAGE_SIZE, "0 0 android\n0 1 POWERVR_SGX%d_%d", + pvrsrv_attr->sgx_version, pvrsrv_attr->sgx_revision); +} + +/* sysfs write function unsupported*/ +static ssize_t PVRSRVEglCfgStore(struct kobject *kobj, struct attribute *attr, + const char *buffer, size_t size) { + PVR_DPF((PVR_DBG_ERROR, "PVRSRVEglCfgStore not implemented")); + return 0; +} + +static struct attribute *pvrsrv_sysfs_attrs[] = { + &PVRSRVAttr.attr, + NULL +}; + +static const struct sysfs_ops pvrsrv_sysfs_ops = { + .show = PVRSRVEglCfgShow, + .store = PVRSRVEglCfgStore, +}; + +static struct kobj_type pvrsrv_ktype = { + .sysfs_ops = &pvrsrv_sysfs_ops, + .default_attrs = pvrsrv_sysfs_attrs, +}; + +/* create sysfs entry /sys/egl/egl.cfg to determine + which gfx libraries to load */ + +int PVRSRVCreateSysfsEntry(void) +{ + struct kobject *egl_cfg_kobject; + int r; + + egl_cfg_kobject = kzalloc(sizeof(*egl_cfg_kobject), GFP_KERNEL); + r = kobject_init_and_add(egl_cfg_kobject, &pvrsrv_ktype, NULL, "egl"); + + if (r) { + PVR_DPF((PVR_DBG_ERROR, + "Failed to create egl.cfg sysfs entry")); + return PVRSRV_ERROR_INIT_FAILURE; + } + + return PVRSRV_OK; +} diff --git a/drivers/gpu/pvr/sysfs.h b/drivers/gpu/pvr/sysfs.h new file mode 100644 index 0000000..66fb99d --- /dev/null +++ b/drivers/gpu/pvr/sysfs.h @@ -0,0 +1 @@ +int PVRSRVCreateSysfsEntry(void); |