emgd: add emgd 1.16 driver sources

This is starting-point code that subsequent patches will modify.  This is
a virgin copy of the code from the emgd 1.16 driver.

This code is coming from
 IEMGD_HEAD_Linux/common/drm/emgd_drm.tgz
which is a piece from the 'Linux Tar Ball' release of EMGD 1.16 downloaded
from here:
 https://edc.intel.com/App_Shared/Downloads/LIN_IEMGD_1_16_GOLD_3228.tgz

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
emgd: enable building within the kernel sources

Modify the build mechanism so that emgd can be configured and built
as a feature of the kernel.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
emgd-1.16 fix build issues with v3.8 kernel

These changes are done according to these existing commits in the v3.8 tree

b0071efe827f68cf173e1a8868b70618e9aca7d7
760285e7e7ab282c25b5e90816f7c47000557f4f
56550d94cbaeaa195cb98c95d012b301cbd65a8d
314e51b9851b4f4e8ab302243ff5a6fc6147f379
a69ac9ea85d87b57166a1c017c5019447b854a68

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
drivers: staging: cdv: initial pull from linux-yocto-3.0 kernel

Then commit is:
[
commit 7828ab82533828b924dbfad5158e274a8bb04df3
Author: Rahul Saxena <rahul.saxena@intel.com>
Date:   Thu Aug 9 10:44:33 2012 -0700

    add latest version of linux-3.0.0-cdv.patch.

    This version includes support for 1.0.2 version of pvr graphics
    driver and also has a security fix for unchecked inputs

    Signed-off-by: Rahul Saxena <rahul.saxena@intel.com>
]

Signed-off-by: Rahul Saxena <rahul.saxena@intel.com>
[minor adjustment for context to add it into kbuild]
Signed-off-by: Liang Li <liang.li@windriver.com>
drivers/staging: cdv: add cdv to kbuild

This commit touchs kconfig and Makefile, most likely to be problem.

Signed-off-by: Liang Li <ll@wrs.com>
drivers: staging: cdv: rename sysinfo.h to cdvsysinfo.h

There is wrs version sysinfo.h exists yet, so simply do rename to
avoid the confliction.

Signed-off-by: Liang Li <liang.li@windriver.com>
drivers: staging: cdv: fix wrong kernel header file inclusion

o eliminate wrong reference to <asm/system.h>
o coordinate with the rename cdvsysinfo.h
o add <linux/module.h> as needed

Signed-off-by: Liang Li <liang.li@windriver.com>
drivers: staging: cdv: Make the per-driver file_operations struct const

The DRM layer keeps a copy of struct file_operations inside its
big driver struct... which prevents it from being consistent and static.
For consistency (and the general security objective of having such things
static), it's desirable to get this fixed.

This patch splits out the file_operations field to its own struct,
which is then "static const", and just stick a pointer to this into
the driver struct, making it more consistent with how the rest of the
kernel does this.

Signed-off-by: Phil Staub <Phil.Staub@windriver.com>
Signed-off-by: Liang Li <liang.li@windriver.com>
drivers: staging: cdv: align with drm_frambuffer and drm_mode_fb_cmd2

Since the code base is 3.0 kernel, certain data structure and function
prototypes changes dramatically. Here we need to align with new
drm_frambuffer and drm_mod_fb_cmd2 data structure, as well as related
function prototypes.

Signed-off-by: Phil Staub <Phil.Staub@windriver.com>
Signed-off-by: Liang Li <liang.li@windriver.com>
drivers: staging: cdv: kmap/kunmap_atomic now only takes one arg.

kmap_atomic and kunmap_atomic with two args are now considered
deprecated. Remove the second argument.

Signed-off-by: Phil Staub <Phil.Staub@windriver.com>
Signed-off-by: Liang Li <liang.li@windriver.com>
drivers: staging: cdv: align ttm usage

Upstream commit 57de4ba9 [drm/ttm: simplify memory accounting for ttm
user v2] removed the tm_bo_extra_size and ttm_bo_size fields from the
ttm_bo_global struct as a simplification to ttm buffer object
handling. A helper function (ttm_bo_acc_size) was supplied instead.

The removed fields were used in calls to ttm_pl_size. These are now
replaced by ttm_bo_acc_size, and the static function ttm_pl_size has
been removed.

Upstream commit 3316497 [drm/ttm: remove userspace backed ttm object
support] removed the tm_bo_type_user enum, because the userspace
backed ttm object support as removed.

Signed-off-by: Phil Staub <Phil.Staub@windriver.com>
Signed-off-by: Liang Li <liang.li@windriver.com>
staging: cdv: rename symbol name to avoid conflict with emgd

The conflict symbol name between cdv and emgd will produce build
warnings like:

WARNING: drivers/staging/cdv/cedarview_gfx: 'PVRGetBufferClassJTable'
exported twice. Previous export was in drivers/gpu/drm/emgd/emgd.ko
WARNING: drivers/staging/cdv/cedarview_gfx: 'PVRGetDisplayClassJTable'
exported twice. Previous export was in drivers/gpu/drm/emgd/emgd.ko

Then the conflict symbols will make cedarview_gfx.ko and emgd.ko
exclusive in runtime.

Rename conflicted symbols to _cdv variant to avoid the conflict. After
the fix, we can have emgd.ko and cedarview_gfx.ko both:

[
 # lsmod
 Module                  Size  Used by
 firmware_class          5894  1 cedarview_gfx
 x_tables               13707  1 ip_tables
 ip_tables               9126  0
 ttm                    55390  1 cedarview_gfx
 emgd                  567194  0
 cedarview_gfx         382344  1
]

Signed-off-by: Liang Li <liang.li@windriver.com>
drivers/staging: cdv: build fix for 3.8 kernel

Signed-off-by: Liang Li <ll@wrs.com>
defconfig: add android-emgd-cdv_defconfig

Signed-off-by: Liang Li <ll@wrs.com>
defconfig: add android-wrs_defconfig

Signed-off-by: Liang Li <ll@wrs.com>
cdv build fix

Referenced mainline commit:
5fb4ef0e36b4c6ecc7fb025aaacb3b63b1114e87

Signed-off-by: Liang Li <ll@wrs.com>
cdv build fix

Referenced the build fix for emgd.

Signed-off-by: Liang Li <ll@wrs.com>
cdv build fix

In mainline commit 9785e10aedfa0fad5c1aac709dce5ada1b123783, the
netlink_set_nonroot was killed.

Signed-off-by: Liang Li <ll@wrs.com>
cdv build fix

Just record.

Signed-off-by: Liang Li <ll@wrs.com>
cdv build fix

misc fixes.

Signed-off-by: Liang Li <ll@wrs.com>