rpmsg: fix device definitions in rpmsg client drivers

The rpmsg client drivers - rpmsg_omx, rpmsg_resmgr and the rpmsg
sample drivers - rpmsg_client_sample & rpmsg_server_sample, are
all defining the supported devices incorrectly as a 'platform'
device.

The devices these drivers support should all be 'rpmsg' devices,
and the device id tables declared by these drivers has been
corrected accordingly.

Change-Id: Ib1a0f0de5ffad48fe52937730e90a3254265a2f6
Reported-by: Xavier Boudet <x-boudet@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
rpmsg: omx: copy_from_user() errors should return -EFAULT

Change-Id: Ib4a2d92dd3b8afa18e60019871cfea2e6b446a4d
Signed-off-by: David Schleef <ds@ti.com>
rpmsg: omx: send disconnect only if omx state is connected

The rpmsg_omx driver sends a disconnect message automatically when the
driver's .release is called. This should be done only if a connection
has been established, otherwise just destroy the local end point.

Change-Id: I21b84aa6d91ae0d456f49cbe958f8e64caf691d5
Signed-off-by: Miguel Vadillo <vadillo@ti.com>
rpmsg: omx: initialize completion event in rpmsg_omx_open

An omx object is created when opening the rpmsg-omx device. However
the "reply_arrived" completion event is not initialized until the
connection message is sent across.

When the rpmsg_omx driver is removed (like in recovery), all pending
threads waiting on the "reply_arrived" are unblocked by a complete_all
call, however, if the rpmsg-omx device was only opened, such event is
not initialized yet, so the complete_all call will dereference a null
object causing a panic.

This patch moves the initialization of the "reply_arrived" completion
event to the open call, after the allocation of the omx object.

Change-Id: I92cf9cf5ac748456cb43bedc88fe1a8d80addd6c
Signed-off-by: Juan Gutierrez <jgutierrez@ti.com>
rpmsg: omx: implement separate register ioctl for sgx buffers

This implements a new register ioctl specifically meant for sgx
buffers. rpmsg_omx clients are expected to call register ioctl
for the specific buffer type (ion or sgx) before sending a buffer
to .write for mapping. The registration allows the rpmsg_omx
driver to hold a reference to the ion buffers making up the sgx
buffer, thereby preventing the buffer(s) to be freed up from
under the remote processor.

The individual imported ion handles are expected to be passed
into the .write call.

When a client no longer expects remote processor to use the buffer,
client should call unregister ioctl. A separate unregister ioctl
for pvr buffers is not created, and the same ion unregister ioctl
is expected to be used for all the ion handles a sgx buffer is
comprised of.

Change-Id: Ib36aab90136627899e98717aeb29bfa637ec09fd
Signed-off-by: Tyler Luu <tluu@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
rpmsg: omx: add ion system heap to omx ion client

Allow the rpmsg omx ion client to access buffers from
the ion system heap.

Change-Id: Ic2d6922cb5cb05ec96f807a36b77c124769f4ef2
Signed-off-by: Tyler Luu <tluu@ti.com>
Signed-off-by: David Schleef <ds@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
rpmsg: omx: add handling of ion system heap buffers
rpmsg: omx: fix copy_to_user in register/unregister ioctls