linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* tree with htc dream support
@ 2009-12-05 22:11 Pavel Machek
  2009-12-05 23:12 ` Daniel Walker
  0 siblings, 1 reply; 38+ messages in thread
From: Pavel Machek @ 2009-12-05 22:11 UTC (permalink / raw)
  To: Arve Hj?nnev?g, kernel list, linux-arm-kernel, Brian Swetland,
	Daniel Walker, Iliyan Malchev

Hi!

Where is the tree with HTC Dream support? I thought it was 

http://git.kernel.org/?p=linux/kernel/git/dwalker/linux-msm.git;a=summary

but it does not seem to contain basic dream support (board file and
serial console) and I thought that was going to linus for 2.6.33...?

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-05 22:11 tree with htc dream support Pavel Machek
@ 2009-12-05 23:12 ` Daniel Walker
  2009-12-06  7:41   ` Pavel Machek
       [not found]   ` <a55d774e0912051638u7858878cg7cf62905c3c005c1@mail.gmail.com>
  0 siblings, 2 replies; 38+ messages in thread
From: Daniel Walker @ 2009-12-05 23:12 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Arve Hj?nnev?g, kernel list, linux-arm-kernel, Brian Swetland,
	Iliyan Malchev, linux-kernel

On Sat, 2009-12-05 at 23:11 +0100, Pavel Machek wrote:
> Hi!
> 
> Where is the tree with HTC Dream support? I thought it was 
> 
> http://git.kernel.org/?p=linux/kernel/git/dwalker/linux-msm.git;a=summary
> 
> but it does not seem to contain basic dream support (board file and
> serial console) and I thought that was going to linus for 2.6.33...?

It's here

git://codeaurora.org/quic/kernel/dwalker/linux-msm.git

In the "testing" branch .. 

or

https://www.codeaurora.org/gitweb/quic/kernel/?p=dwalker/linux-msm.git;a=shortlog;h=refs/heads/testing

It's been in Linux-next for maybe two weeks .. I've been trying to
decide if I should submit it for 2.6.33. I'm going to be adding boat
loads of additional msm code and doing a fairly large merge for
2.6.34 .. So your code would get better testing if we wait for that.

However, If you really want it in 2.6.33 I'll try to accommodate you.

Daniel


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-05 23:12 ` Daniel Walker
@ 2009-12-06  7:41   ` Pavel Machek
  2009-12-06 13:51     ` Daniel Walker
       [not found]   ` <a55d774e0912051638u7858878cg7cf62905c3c005c1@mail.gmail.com>
  1 sibling, 1 reply; 38+ messages in thread
From: Pavel Machek @ 2009-12-06  7:41 UTC (permalink / raw)
  To: Daniel Walker
  Cc: Arve Hj?nnev?g, kernel list, linux-arm-kernel, Brian Swetland,
	Iliyan Malchev, linux-kernel

Hi!

> > Where is the tree with HTC Dream support? I thought it was 
> > 
> > http://git.kernel.org/?p=linux/kernel/git/dwalker/linux-msm.git;a=summary
> > 
> > but it does not seem to contain basic dream support (board file and
> > serial console) and I thought that was going to linus for 2.6.33...?
> 
> It's here
> 
> git://codeaurora.org/quic/kernel/dwalker/linux-msm.git
...
> It's been in Linux-next for maybe two weeks .. I've been trying to
> decide if I should submit it for 2.6.33. I'm going to be adding boat
> loads of additional msm code and doing a fairly large merge for
> 2.6.34 .. So your code would get better testing if we wait for that.
> 
> However, If you really want it in 2.6.33 I'll try to accommodate you.

It would be good to get it in 2.6.33, so that we can build on it, and
so that you are marked as official maintainer etc. I do not think that
code would benefit from any additional delays...
								Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
       [not found]   ` <a55d774e0912051638u7858878cg7cf62905c3c005c1@mail.gmail.com>
@ 2009-12-06  7:43     ` Pavel Machek
  2009-12-06 13:55     ` Daniel Walker
  2009-12-12  5:42     ` Arve Hjønnevåg
  2 siblings, 0 replies; 38+ messages in thread
From: Pavel Machek @ 2009-12-06  7:43 UTC (permalink / raw)
  To: Brian Swetland
  Cc: Daniel Walker, Arve Hj?nnev?g, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

On Sat 2009-12-05 16:38:31, Brian Swetland wrote:
>    On Sat, Dec 5, 2009 at 3:12 PM, Daniel Walker <dwalker@codeaurora.org>
>    wrote:
> 
>      https://www.codeaurora.org/gitweb/quic/kernel/?p=dwalker/linux-msm.git;a=shortlog;h=refs/heads/testing
> 
>      It's been in Linux-next for maybe two weeks .. I've been trying to
>      decide if I should submit it for 2.6.33. I'm going to be adding boat
>      loads of additional msm code and doing a fairly large merge for
>      2.6.34 .. So your code would get better testing if we wait for that.
> 
>      However, If you really want it in 2.6.33 I'll try to accommodate you.
> 
>    Arve's about to take our common and msm trees and rebase them over the
>    .32, which may be useful for reference -- at least as a snapshot of a
>    fully functional set of patches that android donut and eclair run on, on
>    production hardware.A  We'll make that available as soon as we have
>    something that's bootable.

Looking forward :-).
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-06  7:41   ` Pavel Machek
@ 2009-12-06 13:51     ` Daniel Walker
  2009-12-08  8:53       ` Pavel Machek
  0 siblings, 1 reply; 38+ messages in thread
From: Daniel Walker @ 2009-12-06 13:51 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Arve Hj?nnev?g, kernel list, linux-arm-kernel, Brian Swetland,
	Iliyan Malchev, linux-kernel

On Sun, 2009-12-06 at 08:41 +0100, Pavel Machek wrote:
> Hi!
> 
> > > Where is the tree with HTC Dream support? I thought it was 
> > > 
> > > http://git.kernel.org/?p=linux/kernel/git/dwalker/linux-msm.git;a=summary
> > > 
> > > but it does not seem to contain basic dream support (board file and
> > > serial console) and I thought that was going to linus for 2.6.33...?
> > 
> > It's here
> > 
> > git://codeaurora.org/quic/kernel/dwalker/linux-msm.git
> ...
> > It's been in Linux-next for maybe two weeks .. I've been trying to
> > decide if I should submit it for 2.6.33. I'm going to be adding boat
> > loads of additional msm code and doing a fairly large merge for
> > 2.6.34 .. So your code would get better testing if we wait for that.
> > 
> > However, If you really want it in 2.6.33 I'll try to accommodate you.
> 
> It would be good to get it in 2.6.33, so that we can build on it, and
> so that you are marked as official maintainer etc. I do not think that
> code would benefit from any additional delays...

Ok. Fine with me, unless someone else has a specific objection .

Daniel


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
       [not found]   ` <a55d774e0912051638u7858878cg7cf62905c3c005c1@mail.gmail.com>
  2009-12-06  7:43     ` Pavel Machek
@ 2009-12-06 13:55     ` Daniel Walker
  2009-12-12  5:42     ` Arve Hjønnevåg
  2 siblings, 0 replies; 38+ messages in thread
From: Daniel Walker @ 2009-12-06 13:55 UTC (permalink / raw)
  To: Brian Swetland
  Cc: Pavel Machek, Arve Hj?nnev?g, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

On Sat, 2009-12-05 at 16:38 -0800, Brian Swetland wrote:
> On Sat, Dec 5, 2009 at 3:12 PM, Daniel Walker <dwalker@codeaurora.org>
> wrote:
>         https://www.codeaurora.org/gitweb/quic/kernel/?p=dwalker/linux-msm.git;a=shortlog;h=refs/heads/testing
>         
>         It's been in Linux-next for maybe two weeks .. I've been
>         trying to
>         decide if I should submit it for 2.6.33. I'm going to be
>         adding boat
>         loads of additional msm code and doing a fairly large merge
>         for
>         2.6.34 .. So your code would get better testing if we wait for
>         that.
>         
>         However, If you really want it in 2.6.33 I'll try to
>         accommodate you.
> 
> Arve's about to take our common and msm trees and rebase them over
> the .32, which may be useful for reference -- at least as a snapshot
> of a fully functional set of patches that android donut and eclair run
> on, on production hardware.  We'll make that available as soon as we
> have something that's bootable.

Ok .. I'm mainly working with a small subset of a full Android tree.
It's just isolated to the arch/arm/mach-msm/ directory (some in
arch/arm/) .. If you guys have changes to that area just let me know
where they are and I'll try to move them forward.

Daniel


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-06 13:51     ` Daniel Walker
@ 2009-12-08  8:53       ` Pavel Machek
  0 siblings, 0 replies; 38+ messages in thread
From: Pavel Machek @ 2009-12-08  8:53 UTC (permalink / raw)
  To: Daniel Walker
  Cc: Arve Hj?nnev?g, kernel list, linux-arm-kernel, Brian Swetland,
	Iliyan Malchev, linux-kernel

On Sun 2009-12-06 05:51:27, Daniel Walker wrote:
> On Sun, 2009-12-06 at 08:41 +0100, Pavel Machek wrote:
> > Hi!
> > 
> > > > Where is the tree with HTC Dream support? I thought it was 
> > > > 
> > > > http://git.kernel.org/?p=linux/kernel/git/dwalker/linux-msm.git;a=summary
> > > > 
> > > > but it does not seem to contain basic dream support (board file and
> > > > serial console) and I thought that was going to linus for 2.6.33...?
> > > 
> > > It's here
> > > 
> > > git://codeaurora.org/quic/kernel/dwalker/linux-msm.git
> > ...
> > > It's been in Linux-next for maybe two weeks .. I've been trying to
> > > decide if I should submit it for 2.6.33. I'm going to be adding boat
> > > loads of additional msm code and doing a fairly large merge for
> > > 2.6.34 .. So your code would get better testing if we wait for that.
> > > 
> > > However, If you really want it in 2.6.33 I'll try to accommodate you.
> > 
> > It would be good to get it in 2.6.33, so that we can build on it, and
> > so that you are marked as official maintainer etc. I do not think that
> > code would benefit from any additional delays...
> 
> Ok. Fine with me, unless someone else has a specific objection .

Any news here?
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
       [not found]   ` <a55d774e0912051638u7858878cg7cf62905c3c005c1@mail.gmail.com>
  2009-12-06  7:43     ` Pavel Machek
  2009-12-06 13:55     ` Daniel Walker
@ 2009-12-12  5:42     ` Arve Hjønnevåg
  2009-12-12 11:17       ` Pavel Machek
                         ` (2 more replies)
  2 siblings, 3 replies; 38+ messages in thread
From: Arve Hjønnevåg @ 2009-12-12  5:42 UTC (permalink / raw)
  To: Brian Swetland
  Cc: Daniel Walker, Pavel Machek, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

On Sat, Dec 5, 2009 at 4:38 PM, Brian Swetland <swetland@google.com> wrote:
> Arve's about to take our common and msm trees and rebase them over the .32,
> which may be useful for reference -- at least as a snapshot of a fully
> functional set of patches that android donut and eclair run on, on
> production hardware.  We'll make that available as soon as we have something
> that's bootable.
>
> Brian
>
>

A first pass of this is available in the android-msm-2.6.32-test1
branch at git://android.git.kernel.org/kernel/experimental.git.

http://android.git.kernel.org/?p=kernel/experimental.git;a=shortlog;h=refs/heads/android-msm-2.6.32-test1

-- 
Arve Hjønnevåg

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-12  5:42     ` Arve Hjønnevåg
@ 2009-12-12 11:17       ` Pavel Machek
  2009-12-12 11:25       ` Pavel Machek
  2009-12-12 14:18       ` Daniel Walker
  2 siblings, 0 replies; 38+ messages in thread
From: Pavel Machek @ 2009-12-12 11:17 UTC (permalink / raw)
  To: Arve Hj?nnev?g
  Cc: Brian Swetland, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

On Fri 2009-12-11 21:42:07, Arve Hj?nnev?g wrote:
> On Sat, Dec 5, 2009 at 4:38 PM, Brian Swetland <swetland@google.com> wrote:
> > Arve's about to take our common and msm trees and rebase them over the .32,
> > which may be useful for reference -- at least as a snapshot of a fully
> > functional set of patches that android donut and eclair run on, on
> > production hardware.  We'll make that available as soon as we have something
> > that's bootable.
> 
> A first pass of this is available in the android-msm-2.6.32-test1
> branch at git://android.git.kernel.org/kernel/experimental.git.

Thanks!

I get 

  CC      drivers/i2c/chips/mt9t013.o
drivers/i2c/chips/mt9t013.c: In function 'mt9t013_remove':
drivers/i2c/chips/mt9t013.c:1301: error: implicit declaration of
function 'i2c_detach_client'
make[3]: *** [drivers/i2c/chips/mt9t013.o] Error 1
make[2]: *** [drivers/i2c/chips] Error 2
make[1]: *** [drivers/i2c] Error 2

... I guess mt9t013 should depend on i2c? I'll try to fix the config.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-12  5:42     ` Arve Hjønnevåg
  2009-12-12 11:17       ` Pavel Machek
@ 2009-12-12 11:25       ` Pavel Machek
  2009-12-12 11:51         ` Arve Hjønnevåg
  2009-12-12 17:53         ` Pavel Machek
  2009-12-12 14:18       ` Daniel Walker
  2 siblings, 2 replies; 38+ messages in thread
From: Pavel Machek @ 2009-12-12 11:25 UTC (permalink / raw)
  To: Arve Hj?nnev?g
  Cc: Brian Swetland, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

On Fri 2009-12-11 21:42:07, Arve Hj?nnev?g wrote:
> On Sat, Dec 5, 2009 at 4:38 PM, Brian Swetland <swetland@google.com> wrote:
> > Arve's about to take our common and msm trees and rebase them over the .32,
> > which may be useful for reference -- at least as a snapshot of a fully
> > functional set of patches that android donut and eclair run on, on
> > production hardware.  We'll make that available as soon as we have something
> > that's bootable.
> >
> > Brian
> >
> >
> 
> A first pass of this is available in the android-msm-2.6.32-test1
> branch at git://android.git.kernel.org/kernel/experimental.git.

According to some docs, i2c_detach can be just removed, so...?

Then I got this:

  CC      drivers/input/misc/gpio_axis.o
  CC      drivers/input/misc/keychord.o
drivers/input/misc/keychord.c: In function 'keychord_event':
drivers/input/misc/keychord.c:129: error: 'TASK_INTERRUPTIBLE'
undeclared (first use in this
function)drivers/input/misc/keychord.c:129: error: (Each undeclared
identifier is reported only once
drivers/input/misc/keychord.c:129: error: for each function it appears
in.)
drivers/input/misc/keychord.c: In function 'keychord_read':
drivers/input/misc/keychord.c:205: error: 'TASK_INTERRUPTIBLE'
undeclared (first use in this
function)drivers/input/misc/keychord.c:205: error: implicit
declaration of function 'signal_pending'
drivers/input/misc/keychord.c:205: error: implicit declaration of
function 'schedule'
make[3]: *** [drivers/input/misc/keychord.o] Error 1
make[2]: *** [drivers/input/misc] Error 2
make[1]: *** [drivers/input] Error 2
make: *** [drivers] Error 2
12.60user 2.53system 16.93 (0m16.939s) elapsed 89.36%CPU
pavel@amd:/data/l/linux-msm-32$

I used this to fix the compilation...

Signed-off-by: Pavel Machek <pavel@ucw.cz>

diff --git a/drivers/i2c/chips/mt9t013.c b/drivers/i2c/chips/mt9t013.c
index e911ece..200a9f8 100755
--- a/drivers/i2c/chips/mt9t013.c
+++ b/drivers/i2c/chips/mt9t013.c
@@ -1298,7 +1298,6 @@ static int mt9t013_remove(struct i2c_client *client)
 	struct mt9t013_data *mt = i2c_get_clientdata(client);
 	free_irq(client->irq, mt);
 	deinit_suspend();
-	i2c_detach_client(client);
 	pclient = NULL;
 	misc_deregister(&mt9t013_device);
 	kfree(mt);
diff --git a/drivers/input/misc/keychord.c b/drivers/input/misc/keychord.c
index ea94f26..ca23905 100644
--- a/drivers/input/misc/keychord.c
+++ b/drivers/input/misc/keychord.c
@@ -23,6 +23,7 @@
 #include <linux/fs.h>
 #include <linux/miscdevice.h>
 #include <linux/keychord.h>
+#include <linux/sched.h>
 
 #define KEYCHORD_NAME		"keychord"
 #define BUFFER_SIZE			16

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-12 11:25       ` Pavel Machek
@ 2009-12-12 11:51         ` Arve Hjønnevåg
  2009-12-12 12:11           ` Arve Hjønnevåg
  2009-12-12 17:53         ` Pavel Machek
  1 sibling, 1 reply; 38+ messages in thread
From: Arve Hjønnevåg @ 2009-12-12 11:51 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Brian Swetland, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

On Sat, Dec 12, 2009 at 3:25 AM, Pavel Machek <pavel@ucw.cz> wrote:
> On Fri 2009-12-11 21:42:07, Arve Hj?nnev?g wrote:
>> On Sat, Dec 5, 2009 at 4:38 PM, Brian Swetland <swetland@google.com> wrote:
>> > Arve's about to take our common and msm trees and rebase them over the .32,
>> > which may be useful for reference -- at least as a snapshot of a fully
>> > functional set of patches that android donut and eclair run on, on
>> > production hardware.  We'll make that available as soon as we have something
>> > that's bootable.
>> >
>> > Brian
>> >
>> >
>>
>> A first pass of this is available in the android-msm-2.6.32-test1
>> branch at git://android.git.kernel.org/kernel/experimental.git.
>
> According to some docs, i2c_detach can be just removed, so...?
>
> Then I got this:
>
>  CC      drivers/input/misc/gpio_axis.o
>  CC      drivers/input/misc/keychord.o
> drivers/input/misc/keychord.c: In function 'keychord_event':
> drivers/input/misc/keychord.c:129: error: 'TASK_INTERRUPTIBLE'
> undeclared (first use in this
> function)drivers/input/misc/keychord.c:129: error: (Each undeclared
> identifier is reported only once
> drivers/input/misc/keychord.c:129: error: for each function it appears
> in.)
> drivers/input/misc/keychord.c: In function 'keychord_read':
> drivers/input/misc/keychord.c:205: error: 'TASK_INTERRUPTIBLE'
> undeclared (first use in this
> function)drivers/input/misc/keychord.c:205: error: implicit
> declaration of function 'signal_pending'
> drivers/input/misc/keychord.c:205: error: implicit declaration of
> function 'schedule'
> make[3]: *** [drivers/input/misc/keychord.o] Error 1
> make[2]: *** [drivers/input/misc] Error 2
> make[1]: *** [drivers/input] Error 2
> make: *** [drivers] Error 2
> 12.60user 2.53system 16.93 (0m16.939s) elapsed 89.36%CPU
> pavel@amd:/data/l/linux-msm-32$
>

I don't know what is different, but this compiles for me without
adding sched.h. I did have to add sched.h to some other drivers
though.

-- 
Arve Hjønnevåg

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-12 11:51         ` Arve Hjønnevåg
@ 2009-12-12 12:11           ` Arve Hjønnevåg
  0 siblings, 0 replies; 38+ messages in thread
From: Arve Hjønnevåg @ 2009-12-12 12:11 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Brian Swetland, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

2009/12/12 Arve Hjønnevåg <arve@android.com>:
> On Sat, Dec 12, 2009 at 3:25 AM, Pavel Machek <pavel@ucw.cz> wrote:
>> On Fri 2009-12-11 21:42:07, Arve Hj?nnev?g wrote:
>>> On Sat, Dec 5, 2009 at 4:38 PM, Brian Swetland <swetland@google.com> wrote:
>>> > Arve's about to take our common and msm trees and rebase them over the .32,
>>> > which may be useful for reference -- at least as a snapshot of a fully
>>> > functional set of patches that android donut and eclair run on, on
>>> > production hardware.  We'll make that available as soon as we have something
>>> > that's bootable.
>>> >
>>> > Brian
>>> >
>>> >
>>>
>>> A first pass of this is available in the android-msm-2.6.32-test1
>>> branch at git://android.git.kernel.org/kernel/experimental.git.
>>
>> According to some docs, i2c_detach can be just removed, so...?
>>
>> Then I got this:
>>
>>  CC      drivers/input/misc/gpio_axis.o
>>  CC      drivers/input/misc/keychord.o
>> drivers/input/misc/keychord.c: In function 'keychord_event':
>> drivers/input/misc/keychord.c:129: error: 'TASK_INTERRUPTIBLE'
>> undeclared (first use in this
>> function)drivers/input/misc/keychord.c:129: error: (Each undeclared
>> identifier is reported only once
>> drivers/input/misc/keychord.c:129: error: for each function it appears
>> in.)
>> drivers/input/misc/keychord.c: In function 'keychord_read':
>> drivers/input/misc/keychord.c:205: error: 'TASK_INTERRUPTIBLE'
>> undeclared (first use in this
>> function)drivers/input/misc/keychord.c:205: error: implicit
>> declaration of function 'signal_pending'
>> drivers/input/misc/keychord.c:205: error: implicit declaration of
>> function 'schedule'
>> make[3]: *** [drivers/input/misc/keychord.o] Error 1
>> make[2]: *** [drivers/input/misc] Error 2
>> make[1]: *** [drivers/input] Error 2
>> make: *** [drivers] Error 2
>> 12.60user 2.53system 16.93 (0m16.939s) elapsed 89.36%CPU
>> pavel@amd:/data/l/linux-msm-32$
>>
>
> I don't know what is different, but this compiles for me without
> adding sched.h. I did have to add sched.h to some other drivers
> though.

It fails to build if I turn off CONFIG_PREEMPT.

For now run "make msm_defconfig" if you want a working configuration.

-- 
Arve Hjønnevåg

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-12  5:42     ` Arve Hjønnevåg
  2009-12-12 11:17       ` Pavel Machek
  2009-12-12 11:25       ` Pavel Machek
@ 2009-12-12 14:18       ` Daniel Walker
  2009-12-12 22:34         ` Arve Hjønnevåg
  2 siblings, 1 reply; 38+ messages in thread
From: Daniel Walker @ 2009-12-12 14:18 UTC (permalink / raw)
  To: Arve Hjønnevåg
  Cc: Brian Swetland, Pavel Machek, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

On Fri, 2009-12-11 at 21:42 -0800, Arve Hjønnevåg wrote:
> On Sat, Dec 5, 2009 at 4:38 PM, Brian Swetland <swetland@google.com> wrote:
> > Arve's about to take our common and msm trees and rebase them over the .32,
> > which may be useful for reference -- at least as a snapshot of a fully
> > functional set of patches that android donut and eclair run on, on
> > production hardware.  We'll make that available as soon as we have something
> > that's bootable.
> >
> > Brian
> >
> >
> 
> A first pass of this is available in the android-msm-2.6.32-test1
> branch at git://android.git.kernel.org/kernel/experimental.git.
> 
> http://android.git.kernel.org/?p=kernel/experimental.git;a=shortlog;h=refs/heads/android-msm-2.6.32-test1


Does this have the the newest wakelock code in it? From the all the
re-writes that you've done.

Daniel


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-12 11:25       ` Pavel Machek
  2009-12-12 11:51         ` Arve Hjønnevåg
@ 2009-12-12 17:53         ` Pavel Machek
  2009-12-12 22:41           ` Arve Hjønnevåg
  1 sibling, 1 reply; 38+ messages in thread
From: Pavel Machek @ 2009-12-12 17:53 UTC (permalink / raw)
  To: Arve Hj?nnev?g
  Cc: Brian Swetland, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

On Sat 2009-12-12 12:25:36, Pavel Machek wrote:
> On Fri 2009-12-11 21:42:07, Arve Hj?nnev?g wrote:
> > On Sat, Dec 5, 2009 at 4:38 PM, Brian Swetland <swetland@google.com> wrote:
> > > Arve's about to take our common and msm trees and rebase them over the .32,
> > > which may be useful for reference -- at least as a snapshot of a fully
> > > functional set of patches that android donut and eclair run on, on
> > > production hardware.  We'll make that available as soon as we have something
> > > that's bootable.
> > >
> > > Brian
> > >
> > >
> > 
> > A first pass of this is available in the android-msm-2.6.32-test1
> > branch at git://android.git.kernel.org/kernel/experimental.git.
> 
> According to some docs, i2c_detach can be just removed, so...?
> 
> Then I got this:

And then I got it to boot. Good! (And a bit after that, probably
watchdog kicked and phone rebooted back into .27.)

On the second try -- with ramdisk.img -- I got it to boot to GUI, but
the GUI did not show up. I can hear the background sounds but not see
anything. I probably need to turn off
CONFIG_FRAMEBUFFER_CONSOLE... Yes, now it boots to the GUI and I can
actually see that. (It would be nice to make GUI work with
FRAMEBUFFER_CONSOLE on; it should not be that hard...).

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-12 14:18       ` Daniel Walker
@ 2009-12-12 22:34         ` Arve Hjønnevåg
  2009-12-13 21:25           ` Pavel Machek
  0 siblings, 1 reply; 38+ messages in thread
From: Arve Hjønnevåg @ 2009-12-12 22:34 UTC (permalink / raw)
  To: Daniel Walker
  Cc: Brian Swetland, Pavel Machek, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

2009/12/12 Daniel Walker <dwalker@codeaurora.org>:
> On Fri, 2009-12-11 at 21:42 -0800, Arve Hjønnevåg wrote:
>> On Sat, Dec 5, 2009 at 4:38 PM, Brian Swetland <swetland@google.com> wrote:
>> > Arve's about to take our common and msm trees and rebase them over the .32,
>> > which may be useful for reference -- at least as a snapshot of a fully
>> > functional set of patches that android donut and eclair run on, on
>> > production hardware.  We'll make that available as soon as we have something
>> > that's bootable.
>> >
>> > Brian
>> >
>> >
>>
>> A first pass of this is available in the android-msm-2.6.32-test1
>> branch at git://android.git.kernel.org/kernel/experimental.git.
>>
>> http://android.git.kernel.org/?p=kernel/experimental.git;a=shortlog;h=refs/heads/android-msm-2.6.32-test1
>
>
> Does this have the the newest wakelock code in it? From the all the
> re-writes that you've done.

No.

-- 
Arve Hjønnevåg

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-12 17:53         ` Pavel Machek
@ 2009-12-12 22:41           ` Arve Hjønnevåg
  2009-12-15  6:30             ` Arve Hjønnevåg
  0 siblings, 1 reply; 38+ messages in thread
From: Arve Hjønnevåg @ 2009-12-12 22:41 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Brian Swetland, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

On Sat, Dec 12, 2009 at 9:53 AM, Pavel Machek <pavel@ucw.cz> wrote:
> On Sat 2009-12-12 12:25:36, Pavel Machek wrote:
>> On Fri 2009-12-11 21:42:07, Arve Hj?nnev?g wrote:
>> > On Sat, Dec 5, 2009 at 4:38 PM, Brian Swetland <swetland@google.com> wrote:
>> > > Arve's about to take our common and msm trees and rebase them over the .32,
>> > > which may be useful for reference -- at least as a snapshot of a fully
>> > > functional set of patches that android donut and eclair run on, on
>> > > production hardware.  We'll make that available as soon as we have something
>> > > that's bootable.
>> > >
>> > > Brian
>> > >
>> > >
>> >
>> > A first pass of this is available in the android-msm-2.6.32-test1
>> > branch at git://android.git.kernel.org/kernel/experimental.git.
>>
>> According to some docs, i2c_detach can be just removed, so...?
>>
>> Then I got this:
>
> And then I got it to boot. Good! (And a bit after that, probably
> watchdog kicked and phone rebooted back into .27.)
>
> On the second try -- with ramdisk.img -- I got it to boot to GUI, but
> the GUI did not show up. I can hear the background sounds but not see
> anything. I probably need to turn off
> CONFIG_FRAMEBUFFER_CONSOLE... Yes, now it boots to the GUI and I can
> actually see that. (It would be nice to make GUI work with
> FRAMEBUFFER_CONSOLE on; it should not be that hard...).
>

It used to work, but I have not tested it recently. Make sure you turn
CONFIG_FB_EARLYSUSPEND off and CONFIG_CONSOLE_EARLYSUSPEND on since
userspace will not switch consoles if it finds the sysfs interface
that CONFIG_FB_EARLYSUSPEND adds.

-- 
Arve Hjønnevåg

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-12 22:34         ` Arve Hjønnevåg
@ 2009-12-13 21:25           ` Pavel Machek
  2009-12-15  6:34             ` Arve Hjønnevåg
  0 siblings, 1 reply; 38+ messages in thread
From: Pavel Machek @ 2009-12-13 21:25 UTC (permalink / raw)
  To: Arve Hj?nnev?g
  Cc: Daniel Walker, Brian Swetland, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

Hi!

> >> > Arve's about to take our common and msm trees and rebase them over the .32,
> >> > which may be useful for reference -- at least as a snapshot of a fully
> >> > functional set of patches that android donut and eclair run on, on
> >> > production hardware.  We'll make that available as soon as we have something
> >> > that's bootable.
> >> >
> >> > Brian
> >> >
> >> >
> >>
> >> A first pass of this is available in the android-msm-2.6.32-test1
> >> branch at git://android.git.kernel.org/kernel/experimental.git.
> >>
> >> http://android.git.kernel.org/?p=kernel/experimental.git;a=shortlog;h=refs/heads/android-msm-2.6.32-test1
> >
> > Does this have the the newest wakelock code in it? From the all the
> > re-writes that you've done.
> 
> No.

One more wish list item: many drivers are now available in
drivers/staging/dream, and are being slowly cleaned up. Would it be
possible to start using those for android-msm-2.6.32 tree?

You'll need to reapply some stuff I had to remove (like wakelocks),
but it should be still better/less work long term to patch those back
in than maintaining separate copy. Diff should get much smaller...
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-12 22:41           ` Arve Hjønnevåg
@ 2009-12-15  6:30             ` Arve Hjønnevåg
  0 siblings, 0 replies; 38+ messages in thread
From: Arve Hjønnevåg @ 2009-12-15  6:30 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Brian Swetland, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

2009/12/12 Arve Hjønnevåg <arve@android.com>:
> On Sat, Dec 12, 2009 at 9:53 AM, Pavel Machek <pavel@ucw.cz> wrote:
>> On Sat 2009-12-12 12:25:36, Pavel Machek wrote:
>>> On Fri 2009-12-11 21:42:07, Arve Hj?nnev?g wrote:
>>> > On Sat, Dec 5, 2009 at 4:38 PM, Brian Swetland <swetland@google.com> wrote:
>>> > > Arve's about to take our common and msm trees and rebase them over the .32,
>>> > > which may be useful for reference -- at least as a snapshot of a fully
>>> > > functional set of patches that android donut and eclair run on, on
>>> > > production hardware.  We'll make that available as soon as we have something
>>> > > that's bootable.
>>> > >
>>> > > Brian
>>> > >
>>> > >
>>> >
>>> > A first pass of this is available in the android-msm-2.6.32-test1
>>> > branch at git://android.git.kernel.org/kernel/experimental.git.
>>>
>>> According to some docs, i2c_detach can be just removed, so...?
>>>
>>> Then I got this:
>>
>> And then I got it to boot. Good! (And a bit after that, probably
>> watchdog kicked and phone rebooted back into .27.)
>>
>> On the second try -- with ramdisk.img -- I got it to boot to GUI, but
>> the GUI did not show up. I can hear the background sounds but not see
>> anything. I probably need to turn off
>> CONFIG_FRAMEBUFFER_CONSOLE... Yes, now it boots to the GUI and I can
>> actually see that. (It would be nice to make GUI work with
>> FRAMEBUFFER_CONSOLE on; it should not be that hard...).
>>
>
> It used to work, but I have not tested it recently. Make sure you turn
> CONFIG_FB_EARLYSUSPEND off and CONFIG_CONSOLE_EARLYSUSPEND on since
> userspace will not switch consoles if it finds the sysfs interface
> that CONFIG_FB_EARLYSUSPEND adds.

I fixed a bug in the framebuffer driver. If you pull the same branch
again it should work.

-- 
Arve Hjønnevåg

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-13 21:25           ` Pavel Machek
@ 2009-12-15  6:34             ` Arve Hjønnevåg
  2009-12-15 22:20               ` Pavel Machek
  2009-12-27  9:35               ` Pavel Machek
  0 siblings, 2 replies; 38+ messages in thread
From: Arve Hjønnevåg @ 2009-12-15  6:34 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Daniel Walker, Brian Swetland, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

On Sun, Dec 13, 2009 at 1:25 PM, Pavel Machek <pavel@ucw.cz> wrote:
> Hi!
>
>> >> > Arve's about to take our common and msm trees and rebase them over the .32,
>> >> > which may be useful for reference -- at least as a snapshot of a fully
>> >> > functional set of patches that android donut and eclair run on, on
>> >> > production hardware.  We'll make that available as soon as we have something
>> >> > that's bootable.
>> >> >
>> >> > Brian
>> >> >
>> >> >
>> >>
>> >> A first pass of this is available in the android-msm-2.6.32-test1
>> >> branch at git://android.git.kernel.org/kernel/experimental.git.
>> >>
>> >> http://android.git.kernel.org/?p=kernel/experimental.git;a=shortlog;h=refs/heads/android-msm-2.6.32-test1
>> >
>> > Does this have the the newest wakelock code in it? From the all the
>> > re-writes that you've done.
>>
>> No.
>
> One more wish list item: many drivers are now available in
> drivers/staging/dream, and are being slowly cleaned up. Would it be
> possible to start using those for android-msm-2.6.32 tree?
>
> You'll need to reapply some stuff I had to remove (like wakelocks),
> but it should be still better/less work long term to patch those back
> in than maintaining separate copy. Diff should get much smaller...
>                                                                        Pavel

I do plan to look at these, but I don't know when I'll get to it.

-- 
Arve Hjønnevåg

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-15  6:34             ` Arve Hjønnevåg
@ 2009-12-15 22:20               ` Pavel Machek
  2009-12-27  9:35               ` Pavel Machek
  1 sibling, 0 replies; 38+ messages in thread
From: Pavel Machek @ 2009-12-15 22:20 UTC (permalink / raw)
  To: Arve Hj?nnev?g
  Cc: Daniel Walker, Brian Swetland, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel

> >> >> A first pass of this is available in the android-msm-2.6.32-test1
> >> >> branch at git://android.git.kernel.org/kernel/experimental.git.
> >> >>
> >> >> http://android.git.kernel.org/?p=kernel/experimental.git;a=shortlog;h=refs/heads/android-msm-2.6.32-test1
> >> >
> >> > Does this have the the newest wakelock code in it? From the all the
> >> > re-writes that you've done.
> >>
> >> No.
> >
> > One more wish list item: many drivers are now available in
> > drivers/staging/dream, and are being slowly cleaned up. Would it be
> > possible to start using those for android-msm-2.6.32 tree?
> >
> > You'll need to reapply some stuff I had to remove (like wakelocks),
> > but it should be still better/less work long term to patch those back
> > in than maintaining separate copy. Diff should get much smaller...

> 
> I do plan to look at these, but I don't know when I'll get to it.

Thanks.

Actually... a question. How do I generate diff against mainline from
the tree?

Stuff like 'git diff -r v2.6.11' works, but I need 'git diff -r
v2.6.32', and that fails because tag is just not there :-(. Well, 'git
diff -r 22763c5cf3690a681551162c15d34d935308c8d7' works, but...

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-15  6:34             ` Arve Hjønnevåg
  2009-12-15 22:20               ` Pavel Machek
@ 2009-12-27  9:35               ` Pavel Machek
  2009-12-27 20:15                 ` Pavel Machek
  1 sibling, 1 reply; 38+ messages in thread
From: Pavel Machek @ 2009-12-27  9:35 UTC (permalink / raw)
  To: Arve Hj?nnev?g
  Cc: Daniel Walker, Brian Swetland, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

Hi!

> > One more wish list item: many drivers are now available in
> > drivers/staging/dream, and are being slowly cleaned up. Would it be
> > possible to start using those for android-msm-2.6.32 tree?
> >
> > You'll need to reapply some stuff I had to remove (like wakelocks),
> > but it should be still better/less work long term to patch those back
> > in than maintaining separate copy. Diff should get much smaller...
> 
> I do plan to look at these, but I don't know when I'll get to it.

So... this switches qdsp5 code from private version to version in
staging. It actually boots.

It should be followed by git rm of around 12K lines of code from your
patch... (And yes, it actually boots; I tested camera, it worked).

Signed-off-by: Pavel Machek <pavel@ucw.cz>

									Pavel
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 49f85b4..94623a4 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -15,7 +15,7 @@ obj-$(CONFIG_MSM_ONCRPCROUTER) += smd_rpcrouter_device.o
 obj-$(CONFIG_MSM_ONCRPCROUTER) += smd_rpcrouter_servers.o
 obj-$(CONFIG_MSM_RPCSERVERS) += rpc_server_dog_keepalive.o
 obj-$(CONFIG_MSM_RPCSERVERS) += rpc_server_time_remote.o
-obj-$(CONFIG_MSM_ADSP) += qdsp5/
+obj-$(CONFIG_MSM_ADSP) += ../../../drivers/staging/dream/qdsp5/
 obj-$(CONFIG_MSM_HW3D) += hw3d.o
 obj-$(CONFIG_PM) += pm.o
 obj-$(CONFIG_CPU_FREQ) += cpufreq.o


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-28  0:46                         ` Brian Swetland
@ 2009-12-27 10:18                           ` Pavel Machek
  2009-12-28 20:24                             ` Brian Swetland
  0 siblings, 1 reply; 38+ messages in thread
From: Pavel Machek @ 2009-12-27 10:18 UTC (permalink / raw)
  To: Brian Swetland
  Cc: Arve Hj?nnev?g, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

Hi!

> > Switch smd code to the version in staging. Something to apply to
> > dream/ tree I'd say... and yes, it still works.
> 
> I think we might want to consider leaving at least the core smd code
> under mach-msm.

In the long run, I agree.

In the short run... the code is staging quality, so it should be in
staging... and you'll not have to mainain so huge diff. (-20 kLoc).

> To start with it's specific to the 7k/8k platform, not dream (though
> that may just be a quirk of how things are named in staging).  Also
> the lowest layers (proc_comm and smsm_state stuff) are required for
> clock control and basic power management to work -- they're kinda
> joined at the hip with the platform.  It seems weird to me to have the
> necessary bits to implement clock/power/pm outside of the mach/arch
> space.

Agreed, but... I don't see much effort merging 7k/8k patches. And I
believe its better to use code that's already in staging/ to keep
diffs small. Renames are easy with git, and yes, we'll need to do some
moving when code is clean enough.

But that's how staging/ works: all the code there will need to be
moved to the proper places...

> The higher level stuff (qmi, rpcrouter, smdtty, etc) could easily live
> elsewhere (though I'm not sure where the best space in the drivers
> hierarchy for them would be).

drivers/mfd? Yes, we'll have to rename once the code is clean enough.

	     	  	     	       	    	     	Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-27  9:35               ` Pavel Machek
@ 2009-12-27 20:15                 ` Pavel Machek
  2009-12-27 20:20                   ` Brian Swetland
  0 siblings, 1 reply; 38+ messages in thread
From: Pavel Machek @ 2009-12-27 20:15 UTC (permalink / raw)
  To: Arve Hj?nnev?g
  Cc: Daniel Walker, Brian Swetland, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

On Sun 2009-12-27 10:35:38, Pavel Machek wrote:
> Hi!
> 
> > > One more wish list item: many drivers are now available in
> > > drivers/staging/dream, and are being slowly cleaned up. Would it be
> > > possible to start using those for android-msm-2.6.32 tree?
> > >
> > > You'll need to reapply some stuff I had to remove (like wakelocks),
> > > but it should be still better/less work long term to patch those back
> > > in than maintaining separate copy. Diff should get much smaller...
> > 
> > I do plan to look at these, but I don't know when I'll get to it.
> 
> So... this switches qdsp5 code from private version to version in
> staging. It actually boots.

And when I replace .c's in qdsp5 with -msm version, it also works,
with diff being reasonably small.

Now... how does camera driver work? I did not drivers/media/video/msm/
driver into the kernel, but camera application seems to still
work...?!
								Pavel

diff --git a/drivers/staging/dream/qdsp5/adsp.c b/drivers/staging/dream/qdsp5/adsp.c
index d096456..b976f94 100644
--- a/drivers/staging/dream/qdsp5/adsp.c
+++ b/drivers/staging/dream/qdsp5/adsp.c
@@ -194,7 +194,7 @@ static int adsp_rpc_init(struct msm_adsp_module *adsp_module)
 	adsp_module->rpc_client = msm_rpc_connect(
 			RPC_ADSP_RTOS_ATOM_PROG,
 			RPC_ADSP_RTOS_ATOM_VERS,
-			MSM_RPC_UNINTERRUPTIBLE);
+			MSM_RPC_UNINTERRUPTIBLE | MSM_RPC_ENABLE_RECEIVE);
 
 	if (IS_ERR(adsp_module->rpc_client)) {
 		int rc = PTR_ERR(adsp_module->rpc_client);
@@ -219,7 +219,7 @@ static void  msm_get_init_info(void)
 	adsp_info.init_info_rpc_client = msm_rpc_connect(
 			RPC_ADSP_RTOS_ATOM_PROG,
 			RPC_ADSP_RTOS_ATOM_VERS,
-			MSM_RPC_UNINTERRUPTIBLE);
+			MSM_RPC_UNINTERRUPTIBLE | MSM_RPC_ENABLE_RECEIVE);
 	if (IS_ERR(adsp_info.init_info_rpc_client)) {
 		rc = PTR_ERR(adsp_info.init_info_rpc_client);
 		adsp_info.init_info_rpc_client = 0;
@@ -709,9 +709,11 @@ static void handle_adsp_rtos_mtoa_app(struct rpc_request_hdr *req)
 				     RPC_ACCEPTSTAT_SUCCESS);
 	mutex_unlock(&module->lock);
 #ifdef CONFIG_MSM_ADSP_REPORT_EVENTS
-	modem_event_addr = (uint32_t *)req;
-	module->ops->event(module->driver_data, EVENT_MSG_ID,
-				EVENT_LEN, read_modem_event);
+	if (module->ops != NULL && module->ops->event != NULL) {
+		modem_event_addr = (uint32_t *)req;
+		module->ops->event(module->driver_data, EVENT_MSG_ID,
+					EVENT_LEN, read_modem_event);
+	}
 #endif
 }
 
diff --git a/drivers/staging/dream/qdsp5/adsp_6210.c b/drivers/staging/dream/qdsp5/adsp_6210.c
index 3cf4e99..628c247 100644
--- a/drivers/staging/dream/qdsp5/adsp_6210.c
+++ b/drivers/staging/dream/qdsp5/adsp_6210.c
@@ -16,7 +16,7 @@
 #include "adsp.h"
 
 /* Firmware modules */
-typedef enum {
+typedef enum { 
 	QDSP_MODULE_KERNEL,
 	QDSP_MODULE_AFETASK,
 	QDSP_MODULE_AUDPLAY0TASK,
diff --git a/drivers/staging/dream/qdsp5/adsp_6220.c b/drivers/staging/dream/qdsp5/adsp_6220.c
index 02225cd..c4c5a55 100644
--- a/drivers/staging/dream/qdsp5/adsp_6220.c
+++ b/drivers/staging/dream/qdsp5/adsp_6220.c
@@ -16,7 +16,7 @@
 #include "adsp.h"
 
 /* Firmware modules */
-typedef enum {
+typedef enum { 
 	QDSP_MODULE_KERNEL,
 	QDSP_MODULE_AFETASK,
 	QDSP_MODULE_AUDPLAY0TASK,
diff --git a/drivers/staging/dream/qdsp5/adsp_vfe_patch_event.c b/drivers/staging/dream/qdsp5/adsp_vfe_patch_event.c
index a56392b..8f09ed2 100644
--- a/drivers/staging/dream/qdsp5/adsp_vfe_patch_event.c
+++ b/drivers/staging/dream/qdsp5/adsp_vfe_patch_event.c
@@ -44,7 +44,7 @@ int adsp_vfe_patch_event(struct msm_adsp_module *module,
 	case VFE_MSG_OP2:
 		return patch_op_event(module, event);
 	case VFE_MSG_STATS_AF:
-	case VFE_MSG_STATS_WB_EXP:
+	case VFE_MSG_STATS_WB_EXP:	
 		return patch_af_wb_event(module, event);
 	default:
 		break;
diff --git a/drivers/staging/dream/qdsp5/adsp_vfe_verify_cmd.c b/drivers/staging/dream/qdsp5/adsp_vfe_verify_cmd.c
index 927d50a..d1f3fa8 100644
--- a/drivers/staging/dream/qdsp5/adsp_vfe_verify_cmd.c
+++ b/drivers/staging/dream/qdsp5/adsp_vfe_verify_cmd.c
@@ -184,7 +184,7 @@ static int verify_vfe_command_table(struct msm_adsp_module *module,
 		vfe_cmd_axi_op_cfg *cmd = (vfe_cmd_axi_op_cfg *)cmd_data;
 		void **addr1_y, **addr2_y, **addr1_cbcr, **addr2_cbcr;
 
-		if (cmd_size != sizeof(vfe_cmd_axi_op_cfg)) {
+		if (cmd_size != sizeof(vfe_cmd_axi_op_cfg)) { 
 			printk(KERN_ERR "adsp: module %s: invalid VFE TABLE (VFE_CMD_AXI_OP_CFG) command size %d\n",
 				module->name, cmd_size);
 			return -1;
diff --git a/drivers/staging/dream/qdsp5/adsp_video_verify_cmd.c b/drivers/staging/dream/qdsp5/adsp_video_verify_cmd.c
index 53aff77..fdad055 100644
--- a/drivers/staging/dream/qdsp5/adsp_video_verify_cmd.c
+++ b/drivers/staging/dream/qdsp5/adsp_video_verify_cmd.c
@@ -107,7 +107,7 @@ static int verify_vdec_pkt_cmd(struct msm_adsp_module *module,
 
 	/* deref those ptrs and check if they are a frame header packet */
 	frame_header_pkt = (viddec_cmd_frame_header_packet *)subframe_pkt_addr;
-
+	
 	switch (frame_header_pkt->packet_id) {
 	case 0xB201: /* h.264 */
 		num_addr = skip = 8;
diff --git a/drivers/staging/dream/qdsp5/audio_aac.c b/drivers/staging/dream/qdsp5/audio_aac.c
index ad2390f..4232b9f 100644
--- a/drivers/staging/dream/qdsp5/audio_aac.c
+++ b/drivers/staging/dream/qdsp5/audio_aac.c
@@ -666,7 +666,6 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 			config.unused[0] = 0;
 			config.unused[1] = 0;
 			config.unused[2] = 0;
-			config.unused[3] = 0;
 			if (copy_to_user((void *)arg, &config,
 					 sizeof(config)))
 				rc = -EFAULT;
@@ -950,7 +949,7 @@ static int audio_release(struct inode *inode, struct file *file)
 	return 0;
 }
 
-static struct audio the_aac_audio;
+struct audio the_aac_audio;
 
 static int audio_open(struct inode *inode, struct file *file)
 {
diff --git a/drivers/staging/dream/qdsp5/audio_amrnb.c b/drivers/staging/dream/qdsp5/audio_amrnb.c
index cd818a5..63fe2d0 100644
--- a/drivers/staging/dream/qdsp5/audio_amrnb.c
+++ b/drivers/staging/dream/qdsp5/audio_amrnb.c
@@ -551,7 +551,6 @@ static long audamrnb_ioctl(struct file *file, unsigned int cmd,
 			config.unused[0] = 0;
 			config.unused[1] = 0;
 			config.unused[2] = 0;
-			config.unused[3] = 0;
 			if (copy_to_user((void *)arg, &config,
 					 sizeof(config)))
 				rc = -EFAULT;
diff --git a/drivers/staging/dream/qdsp5/audio_evrc.c b/drivers/staging/dream/qdsp5/audio_evrc.c
index 4b43e18..8ee8d53 100644
--- a/drivers/staging/dream/qdsp5/audio_evrc.c
+++ b/drivers/staging/dream/qdsp5/audio_evrc.c
@@ -517,7 +517,6 @@ static long audevrc_ioctl(struct file *file, unsigned int cmd,
 			config.unused[0] = 0;
 			config.unused[1] = 0;
 			config.unused[2] = 0;
-			config.unused[3] = 0;
 			if (copy_to_user((void *)arg, &config, sizeof(config)))
 				rc = -EFAULT;
 			else
diff --git a/drivers/staging/dream/qdsp5/audio_in.c b/drivers/staging/dream/qdsp5/audio_in.c
index 3d950a2..35a7f7d 100644
--- a/drivers/staging/dream/qdsp5/audio_in.c
+++ b/drivers/staging/dream/qdsp5/audio_in.c
@@ -282,7 +282,7 @@ static void audio_in_get_dsp_frames(struct audio_in *audio)
 	/* XXX check for bogus frame size? */
 
 	frame = (void *) (((char *)audio->in[index].data) - sizeof(*frame));
-
+		
 	spin_lock_irqsave(&audio->dsp_lock, flags);
 	audio->in[index].size = frame->bytes;
 
@@ -524,7 +524,7 @@ static int audio_in_encoder_config(struct audio_in *audio)
 	cmd.samp_rate_index = audio->samp_rate_index;
 	cmd.stereo_mode = audio->channel_mode; /* 0 for mono, 1 for stereo */
 
-	/* FIXME have no idea why cmd.rec_quality is fixed
+	/* FIXME have no idea why cmd.rec_quality is fixed 
 	 * as 0x1C00 from sample code
 	 */
 	cmd.rec_quality = 0x1C00;
@@ -785,7 +785,7 @@ static int audio_in_release(struct inode *inode, struct file *file)
 	return 0;
 }
 
-static struct audio_in the_audio_in;
+struct audio_in the_audio_in;
 
 static int audio_in_open(struct inode *inode, struct file *file)
 {
diff --git a/drivers/staging/dream/qdsp5/audio_mp3.c b/drivers/staging/dream/qdsp5/audio_mp3.c
index b95574f..f09bdcb 100644
--- a/drivers/staging/dream/qdsp5/audio_mp3.c
+++ b/drivers/staging/dream/qdsp5/audio_mp3.c
@@ -1,5 +1,5 @@
 /* arch/arm/mach-msm/qdsp5/audio_mp3.c
- *
+ * 
  * mp3 audio output device
  *
  * Copyright (C) 2008 Google, Inc.
@@ -469,7 +469,7 @@ static void audplay_send_data(struct audio *audio, unsigned needed)
 		 * so that it won't be recycled until the next buffer
 		 * is requested
 		 */
-
+			
 		frame = audio->out + audio->out_tail;
 		if (frame->used) {
 		  BUG_ON(frame->used == 0xffffffff);
@@ -604,7 +604,6 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		config.unused[0] = 0;
 		config.unused[1] = 0;
 		config.unused[2] = 0;
-		config.unused[3] = 0;
 		if (copy_to_user((void *) arg, &config, sizeof(config))) {
 			rc = -EFAULT;
 		} else {
@@ -864,7 +863,7 @@ static int audio_release(struct inode *inode, struct file *file)
 	return 0;
 }
 
-static struct audio the_mp3_audio;
+struct audio the_mp3_audio;
 
 static int audio_open(struct inode *inode, struct file *file)
 {
diff --git a/drivers/staging/dream/qdsp5/audio_out.c b/drivers/staging/dream/qdsp5/audio_out.c
index d1adcf6..fcb1f13 100644
--- a/drivers/staging/dream/qdsp5/audio_out.c
+++ b/drivers/staging/dream/qdsp5/audio_out.c
@@ -227,7 +227,7 @@ static int audio_enable(struct audio *audio)
 	pr_info("audio_enable()\n");
 
 	if (audio->enabled)
-		return 0;
+		return 0;	
 
 	/* refuse to start if we're not ready */
 	if (!audio->out[0].used || !audio->out[1].used)
@@ -245,7 +245,7 @@ static int audio_enable(struct audio *audio)
 	cfg.codec = RPC_AUD_DEF_CODEC_PCM;
 	cfg.snd_method = RPC_SND_METHOD_MIDI;
 
-	audio_prevent_sleep(audio);
+	audio_prevent_sleep(audio);	
 	rc = audmgr_enable(&audio->audmgr, &cfg);
 	if (rc < 0) {
 		audio_allow_sleep(audio);
@@ -355,7 +355,7 @@ static int audio_dsp_out_enable(struct audio *audio, int yes)
 	audpp_cmd_pcm_intf cmd;
 
 	memset(&cmd, 0, sizeof(cmd));
-	cmd.cmd_id	= AUDPP_CMD_PCM_INTF_2;
+	cmd.cmd_id	= AUDPP_CMD_PCM_INTF_2; 
 	cmd.object_num	= AUDPP_CMD_PCM_INTF_OBJECT_NUM;
 	cmd.config	= AUDPP_CMD_PCM_INTF_CONFIG_CMD_V;
 	cmd.intf_type	= AUDPP_CMD_PCM_INTF_RX_ENA_ARMTODSP_V;
@@ -374,14 +374,14 @@ static int audio_dsp_out_enable(struct audio *audio, int yes)
 		cmd.sample_rate		= audio->out_sample_rate;
 		cmd.channel_mode	= audio->out_channel_mode;
 	}
-
+	
 	return audpp_send_queue2(&cmd, sizeof(cmd));
 }
 
 static int audio_dsp_send_buffer(struct audio *audio, unsigned idx, unsigned len)
 {
 	audpp_cmd_pcm_intf_send_buffer cmd;
-
+	
 	cmd.cmd_id		= AUDPP_CMD_PCM_INTF_2;
 	cmd.host_pcm_object	= AUDPP_CMD_PCM_INTF_OBJECT_NUM;
 	cmd.config		= AUDPP_CMD_PCM_INTF_BUFFER_CMD_V;
@@ -573,7 +573,6 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		config.unused[0] = 0;
 		config.unused[1] = 0;
 		config.unused[2] = 0;
-		config.unused[3] = 0;
 		if (copy_to_user((void*) arg, &config, sizeof(config))) {
 			rc = -EFAULT;
 		} else {
@@ -682,7 +681,7 @@ static ssize_t audio_write(struct file *file, const char __user *buf,
 	LOG(EV_RETURN,(buf > start) ? (buf - start) : rc);
 	if (buf > start)
 		return buf - start;
-	return rc;
+	return rc;	
 }
 
 static int audio_release(struct inode *inode, struct file *file)
@@ -699,7 +698,7 @@ static int audio_release(struct inode *inode, struct file *file)
 	return 0;
 }
 
-static struct audio the_audio;
+struct audio the_audio;
 
 static int audio_open(struct inode *inode, struct file *file)
 {
@@ -715,7 +714,7 @@ static int audio_open(struct inode *inode, struct file *file)
 	}
 
 	if (!audio->data) {
-		audio->data = dma_alloc_coherent(NULL, DMASZ,
+		audio->data = dma_alloc_coherent(NULL, DMASZ, 
 						 &audio->phys, GFP_KERNEL);
 		if (!audio->data) {
 			pr_err("audio: could not allocate DMA buffers\n");
@@ -736,7 +735,7 @@ static int audio_open(struct inode *inode, struct file *file)
 	audio->out[0].data = audio->data + 0;
 	audio->out[0].addr = audio->phys + 0;
 	audio->out[0].size = BUFSZ;
-
+	
 	audio->out[1].data = audio->data + BUFSZ;
 	audio->out[1].addr = audio->phys + BUFSZ;
 	audio->out[1].size = BUFSZ;
diff --git a/drivers/staging/dream/qdsp5/audio_qcelp.c b/drivers/staging/dream/qdsp5/audio_qcelp.c
index f0f50e3..9571469 100644
--- a/drivers/staging/dream/qdsp5/audio_qcelp.c
+++ b/drivers/staging/dream/qdsp5/audio_qcelp.c
@@ -531,7 +531,6 @@ static long audqcelp_ioctl(struct file *file, unsigned int cmd,
 			config.unused[0] = 0;
 			config.unused[1] = 0;
 			config.unused[2] = 0;
-			config.unused[3] = 0;
 			if (copy_to_user((void *)arg, &config,
 					 sizeof(config)))
 				rc = -EFAULT;
diff --git a/drivers/staging/dream/qdsp5/audmgr.c b/drivers/staging/dream/qdsp5/audmgr.c
index 1ad8b82..691ea8f 100644
--- a/drivers/staging/dream/qdsp5/audmgr.c
+++ b/drivers/staging/dream/qdsp5/audmgr.c
@@ -208,7 +208,7 @@ int audmgr_open(struct audmgr *am)
 
 	am->ept = msm_rpc_connect(AUDMGR_PROG,
 				AUDMGR_VERS,
-				MSM_RPC_UNINTERRUPTIBLE);
+				MSM_RPC_UNINTERRUPTIBLE | MSM_RPC_ENABLE_RECEIVE);
 
 	init_waitqueue_head(&am->wait);
 
diff --git a/drivers/staging/dream/qdsp5/audmgr.h b/drivers/staging/dream/qdsp5/audmgr.h
index c07c36b..cd2d0c6 100644
--- a/drivers/staging/dream/qdsp5/audmgr.h
+++ b/drivers/staging/dream/qdsp5/audmgr.h
@@ -1,6 +1,6 @@
 /* arch/arm/mach-msm/qdsp5/audmgr.h
  *
- * Copyright 2008 (c) QUALCOMM Incorporated.
+ * Copyright 2008 (c) QUALCOMM Incorporated. 
  * Copyright (C) 2008 Google, Inc.
  *
  * This software is licensed under the terms of the GNU General Public
@@ -131,7 +131,7 @@ struct rpc_audmgr_enable_client_args {
 	uint32_t cb_func;
 	uint32_t client_data;
 };
-
+	
 #define AUDMGR_ENABLE_CLIENT			2
 #define AUDMGR_DISABLE_CLIENT			3
 #define AUDMGR_SUSPEND_EVENT_RSP		4
@@ -159,7 +159,7 @@ struct rpc_audmgr_cb_func_ptr {
 	union {
 		uint32_t handle;
 		uint32_t volume;
-
+		
 	} u;
 };
 
diff --git a/drivers/staging/dream/qdsp5/audmgr_new.h b/drivers/staging/dream/qdsp5/audmgr_new.h
index 49670fe..4381242 100644
--- a/drivers/staging/dream/qdsp5/audmgr_new.h
+++ b/drivers/staging/dream/qdsp5/audmgr_new.h
@@ -1,6 +1,6 @@
 /* arch/arm/mach-msm/qdsp5/audmgr.h
  *
- * Copyright 2008 (c) QUALCOMM Incorporated.
+ * Copyright 2008 (c) QUALCOMM Incorporated. 
  * Copyright (C) 2008 Google, Inc.
  *
  * This software is licensed under the terms of the GNU General Public
@@ -135,7 +135,7 @@ struct rpc_audmgr_enable_client_args {
 	uint32_t cb_func;
 	uint32_t client_data;
 };
-
+	
 #define AUDMGR_ENABLE_CLIENT			2
 #define AUDMGR_DISABLE_CLIENT			3
 #define AUDMGR_SUSPEND_EVENT_RSP		4
diff --git a/drivers/staging/dream/qdsp5/audpp.c b/drivers/staging/dream/qdsp5/audpp.c
index d06556e..32c2847 100644
--- a/drivers/staging/dream/qdsp5/audpp.c
+++ b/drivers/staging/dream/qdsp5/audpp.c
@@ -251,7 +251,7 @@ int audpp_enable(int id, audpp_event_func func, void *private)
 					 AUDPP_MSG_CFG_MSG, AUDPP_MSG_ENA_ENA);
 		local_irq_restore(flags);
 	}
-
+			
 	res = 0;
 out:
 	mutex_unlock(audpp->lock);
@@ -331,7 +331,7 @@ unsigned audpp_avsync_sample_count(int id)
 
 	if (BAD_ID(id))
 		return 0;
-
+	
 	mask = 1 << id;
 	id = id * AUDPP_AVSYNC_INFO_SIZE + 2;
 	local_irq_save(flags);
@@ -375,7 +375,7 @@ int audpp_set_volume_and_pan(unsigned id, unsigned volume, int pan)
 {
 	/* cmd, obj_cfg[7], cmd_type, volume, pan */
 	uint16_t cmd[11];
-
+	
 	if (id > 6)
 		return -EINVAL;
 
diff --git a/drivers/staging/dream/qdsp5/evlog.h b/drivers/staging/dream/qdsp5/evlog.h
index 922ce67..5c0edf1 100644
--- a/drivers/staging/dream/qdsp5/evlog.h
+++ b/drivers/staging/dream/qdsp5/evlog.h
@@ -36,7 +36,7 @@ struct ev_entry {
 	uint32_t id;
 	uint32_t arg;
 };
-
+	
 struct ev_log {
 	struct ev_entry *entry;
 	unsigned max;
@@ -58,7 +58,7 @@ static ssize_t ev_log_read(struct file *file, char __user *buf,
 	int size = 0;
 	unsigned n, id, max;
 	ktime_t now, t;
-
+	
 	max = log->max;
 	now = ktime_get();
 	local_irq_save(flags);


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-27 20:15                 ` Pavel Machek
@ 2009-12-27 20:20                   ` Brian Swetland
  2009-12-27 20:37                     ` Pavel Machek
  0 siblings, 1 reply; 38+ messages in thread
From: Brian Swetland @ 2009-12-27 20:20 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Arve Hj?nnev?g, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

On Sun, Dec 27, 2009 at 12:15 PM, Pavel Machek <pavel@ucw.cz> wrote:
> On Sun 2009-12-27 10:35:38, Pavel Machek wrote:
>> Hi!
>>
>> > > One more wish list item: many drivers are now available in
>> > > drivers/staging/dream, and are being slowly cleaned up. Would it be
>> > > possible to start using those for android-msm-2.6.32 tree?
>> > >
>> > > You'll need to reapply some stuff I had to remove (like wakelocks),
>> > > but it should be still better/less work long term to patch those back
>> > > in than maintaining separate copy. Diff should get much smaller...
>> >
>> > I do plan to look at these, but I don't know when I'll get to it.
>>
>> So... this switches qdsp5 code from private version to version in
>> staging. It actually boots.
>
> And when I replace .c's in qdsp5 with -msm version, it also works,
> with diff being reasonably small.
>
> Now... how does camera driver work? I did not drivers/media/video/msm/
> driver into the kernel, but camera application seems to still
> work...?!

Depends which version of the camera userspace code you've got.  The
stuff for cupcake/donut talks directly to the DSP and the DSP
interacts with the VFE (video frontend, the camera data transport).  I
believe the new camera driver bypasses some (all?) of that and deals
with the VFE directly.  At least on 8k that's how it works (no DSP
involvement at all).

Brian

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-27 20:20                   ` Brian Swetland
@ 2009-12-27 20:37                     ` Pavel Machek
  2009-12-27 21:13                       ` Pavel Machek
  0 siblings, 1 reply; 38+ messages in thread
From: Pavel Machek @ 2009-12-27 20:37 UTC (permalink / raw)
  To: Brian Swetland
  Cc: Arve Hj?nnev?g, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

Hi!

> >> > I do plan to look at these, but I don't know when I'll get to it.
> >>
> >> So... this switches qdsp5 code from private version to version in
> >> staging. It actually boots.
> >
> > And when I replace .c's in qdsp5 with -msm version, it also works,
> > with diff being reasonably small.
> >
> > Now... how does camera driver work? I did not drivers/media/video/msm/
> > driver into the kernel, but camera application seems to still
> > work...?!
> 
> Depends which version of the camera userspace code you've got.  The
> stuff for cupcake/donut talks directly to the DSP and the DSP
> interacts with the VFE (video frontend, the camera data transport).  I
> believe the new camera driver bypasses some (all?) of that and deals
> with the VFE directly.  At least on 8k that's how it works (no DSP
> involvement at all).

I have 1.5 listed as "firmware version" under "about phone". I guess
that means "cupcake". Ok, so that looks like I do not have easy way of
testing camera driver, because my userland does not need it...
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-27 20:37                     ` Pavel Machek
@ 2009-12-27 21:13                       ` Pavel Machek
  2009-12-27 21:53                         ` Pavel Machek
  2009-12-28  0:46                         ` Brian Swetland
  0 siblings, 2 replies; 38+ messages in thread
From: Pavel Machek @ 2009-12-27 21:13 UTC (permalink / raw)
  To: Brian Swetland
  Cc: Arve Hj?nnev?g, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

On Sun 2009-12-27 21:37:04, Pavel Machek wrote:
> Hi!
> 
> > >> > I do plan to look at these, but I don't know when I'll get to it.
> > >>
> > >> So... this switches qdsp5 code from private version to version in
> > >> staging. It actually boots.
> > >
> > > And when I replace .c's in qdsp5 with -msm version, it also works,
> > > with diff being reasonably small.
> > >
> > > Now... how does camera driver work? I did not drivers/media/video/msm/
> > > driver into the kernel, but camera application seems to still
> > > work...?!
> > 
> > Depends which version of the camera userspace code you've got.  The
> > stuff for cupcake/donut talks directly to the DSP and the DSP
> > interacts with the VFE (video frontend, the camera data transport).  I
> > believe the new camera driver bypasses some (all?) of that and deals
> > with the VFE directly.  At least on 8k that's how it works (no DSP
> > involvement at all).
> 
> I have 1.5 listed as "firmware version" under "about phone". I guess
> that means "cupcake". Ok, so that looks like I do not have easy way of
> testing camera driver, because my userland does not need it...

Switch smd code	to the version in staging. Something to apply to
dream/ tree I'd say... and yes, it still works.

Signed-off-by: Pavel Machek <pavel@ucw.cz>

diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 94623a4..bb96022 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -9,10 +9,10 @@ obj-y += nand_partitions.o
 
 obj-$(CONFIG_MSM_FIQ_SUPPORT) += fiq_glue.o
 obj-$(CONFIG_MACH_TROUT) += board-trout-rfkill.o
-obj-$(CONFIG_MSM_SMD) += smd.o smd_tty.o smd_qmi.o
-obj-$(CONFIG_MSM_ONCRPCROUTER) += smd_rpcrouter.o
-obj-$(CONFIG_MSM_ONCRPCROUTER) += smd_rpcrouter_device.o
-obj-$(CONFIG_MSM_ONCRPCROUTER) += smd_rpcrouter_servers.o
+obj-$(CONFIG_MSM_SMD) += ../../../drivers/staging/dream/smd/smd.o ../../../drivers/staging/dream/smd/smd_tty.o ../../../drivers/staging/dream/smd/smd_qmi.o
+obj-$(CONFIG_MSM_ONCRPCROUTER) += ../../../drivers/staging/dream/smd/smd_rpcrouter.o
+obj-$(CONFIG_MSM_ONCRPCROUTER) += ../../../drivers/staging/dream/smd/smd_rpcrouter_device.o
+obj-$(CONFIG_MSM_ONCRPCROUTER) += ../../../drivers/staging/dream/smd/smd_rpcrouter_servers.o
 obj-$(CONFIG_MSM_RPCSERVERS) += rpc_server_dog_keepalive.o
 obj-$(CONFIG_MSM_RPCSERVERS) += rpc_server_time_remote.o
 obj-$(CONFIG_MSM_ADSP) += ../../../drivers/staging/dream/qdsp5/
diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c
deleted file mode 100644
index 64d1232..0000000
--- a/arch/arm/mach-msm/smd.c
+++ /dev/null
@@ -1,1330 +0,0 @@
-/* arch/arm/mach-msm/smd.c
- *
- * Copyright (C) 2007 Google, Inc.
- * Author: Brian Swetland <swetland@google.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-
-#include <linux/platform_device.h>
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/cdev.h>
-#include <linux/device.h>
-#include <linux/wait.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/list.h>
-#include <linux/slab.h>
-#include <linux/debugfs.h>
-#include <linux/delay.h>
-#include <linux/io.h>
-
-#include <mach/msm_smd.h>
-#include <mach/msm_iomap.h>
-#include <mach/system.h>
-
-#include "smd_private.h"
-#include "proc_comm.h"
-
-void (*msm_hw_reset_hook)(void);
-
-#define MODULE_NAME "msm_smd"
-
-enum {
-	MSM_SMD_DEBUG = 1U << 0,
-	MSM_SMSM_DEBUG = 1U << 0,
-};
-
-static int msm_smd_debug_mask;
-
-module_param_named(debug_mask, msm_smd_debug_mask,
-		   int, S_IRUGO | S_IWUSR | S_IWGRP);
-
-void *smem_find(unsigned id, unsigned size);
-static void smd_diag(void);
-
-static unsigned last_heap_free = 0xffffffff;
-
-#define MSM_A2M_INT(n) (MSM_CSR_BASE + 0x400 + (n) * 4)
-
-static inline void notify_other_smsm(void)
-{
-	writel(1, MSM_A2M_INT(5));
-}
-
-static inline void notify_other_smd(void)
-{
-	writel(1, MSM_A2M_INT(0));
-}
-
-static void smd_diag(void)
-{
-	char *x;
-
-	x = smem_find(ID_DIAG_ERR_MSG, SZ_DIAG_ERR_MSG);
-	if (x != 0) {
-		x[SZ_DIAG_ERR_MSG - 1] = 0;
-		pr_info("smem: DIAG '%s'\n", x);
-	}
-}
-
-/* call when SMSM_RESET flag is set in the A9's smsm_state */
-static void handle_modem_crash(void)
-{
-	pr_err("ARM9 has CRASHED\n");
-	smd_diag();
-
-	/* hard reboot if possible */
-	if (msm_hw_reset_hook)
-		msm_hw_reset_hook();
-
-	/* in this case the modem or watchdog should reboot us */
-	for (;;)
-		;
-}
-
-extern int (*msm_check_for_modem_crash)(void);
-
-static int check_for_modem_crash(void)
-{
-	struct smsm_shared *smsm;
-
-	smsm = smem_find(ID_SHARED_STATE, 2 * sizeof(struct smsm_shared));
-
-	/* if the modem's not ready yet, we have to hope for the best */
-	if (!smsm)
-		return 0;
-
-	if (smsm[1].state & SMSM_RESET) {
-		handle_modem_crash();
-		return -1;
-	} else {
-		return 0;
-	}
-}
-
-#define SMD_SS_CLOSED            0x00000000
-#define SMD_SS_OPENING           0x00000001
-#define SMD_SS_OPENED            0x00000002
-#define SMD_SS_FLUSHING          0x00000003
-#define SMD_SS_CLOSING           0x00000004
-#define SMD_SS_RESET             0x00000005
-#define SMD_SS_RESET_OPENING     0x00000006
-
-#define SMD_BUF_SIZE 8192
-#define SMD_CHANNELS 64
-
-#define SMD_HEADER_SIZE 20
-
-
-/* the spinlock is used to synchronize between the
-** irq handler and code that mutates the channel
-** list or fiddles with channel state
-*/
-static DEFINE_SPINLOCK(smd_lock);
-static DEFINE_SPINLOCK(smem_lock);
-
-/* the mutex is used during open() and close()
-** operations to avoid races while creating or
-** destroying smd_channel structures
-*/
-static DEFINE_MUTEX(smd_creation_mutex);
-
-static int smd_initialized;
-
-struct smd_alloc_elm {
-	char name[20];
-	uint32_t cid;
-	uint32_t ctype;
-	uint32_t ref_count;
-};
-
-struct smd_half_channel {
-	unsigned state;
-	unsigned char fDSR;
-	unsigned char fCTS;
-	unsigned char fCD;
-	unsigned char fRI;
-	unsigned char fHEAD;
-	unsigned char fTAIL;
-	unsigned char fSTATE;
-	unsigned char fUNUSED;
-	unsigned tail;
-	unsigned head;
-	unsigned char data[SMD_BUF_SIZE];
-};
-
-struct smd_shared {
-	struct smd_half_channel ch0;
-	struct smd_half_channel ch1;
-};
-
-struct smd_channel {
-	volatile struct smd_half_channel *send;
-	volatile struct smd_half_channel *recv;
-	struct list_head ch_list;
-
-	unsigned current_packet;
-	unsigned n;
-	void *priv;
-	void (*notify)(void *priv, unsigned flags);
-
-	int (*read)(smd_channel_t *ch, void *data, int len);
-	int (*write)(smd_channel_t *ch, const void *data, int len);
-	int (*read_avail)(smd_channel_t *ch);
-	int (*write_avail)(smd_channel_t *ch);
-
-	void (*update_state)(smd_channel_t *ch);
-	unsigned last_state;
-
-	char name[32];
-	struct platform_device pdev;
-};
-
-static LIST_HEAD(smd_ch_closed_list);
-static LIST_HEAD(smd_ch_list);
-
-static unsigned char smd_ch_allocated[64];
-static struct work_struct probe_work;
-
-static void smd_alloc_channel(const char *name, uint32_t cid, uint32_t type);
-
-static void smd_channel_probe_worker(struct work_struct *work)
-{
-	struct smd_alloc_elm *shared;
-	unsigned n;
-
-	shared = smem_find(ID_CH_ALLOC_TBL, sizeof(*shared) * 64);
-
-	for (n = 0; n < 64; n++) {
-		if (smd_ch_allocated[n])
-			continue;
-		if (!shared[n].ref_count)
-			continue;
-		if (!shared[n].name[0])
-			continue;
-		smd_alloc_channel(shared[n].name,
-				  shared[n].cid,
-				  shared[n].ctype);
-		smd_ch_allocated[n] = 1;
-	}
-}
-
-static char *chstate(unsigned n)
-{
-	switch (n) {
-	case SMD_SS_CLOSED:
-		return "CLOSED";
-	case SMD_SS_OPENING:
-		return "OPENING";
-	case SMD_SS_OPENED:
-		return "OPENED";
-	case SMD_SS_FLUSHING:
-		return "FLUSHING";
-	case SMD_SS_CLOSING:
-		return "CLOSING";
-	case SMD_SS_RESET:
-		return "RESET";
-	case SMD_SS_RESET_OPENING:
-		return "ROPENING";
-	default:
-		return "UNKNOWN";
-	}
-}
-
-/* how many bytes are available for reading */
-static int smd_stream_read_avail(struct smd_channel *ch)
-{
-	return (ch->recv->head - ch->recv->tail) & (SMD_BUF_SIZE - 1);
-}
-
-/* how many bytes we are free to write */
-static int smd_stream_write_avail(struct smd_channel *ch)
-{
-	return (SMD_BUF_SIZE - 1) -
-		((ch->send->head - ch->send->tail) & (SMD_BUF_SIZE - 1));
-}
-
-static int smd_packet_read_avail(struct smd_channel *ch)
-{
-	if (ch->current_packet) {
-		int n = smd_stream_read_avail(ch);
-		if (n > ch->current_packet)
-			n = ch->current_packet;
-		return n;
-	} else {
-		return 0;
-	}
-}
-
-static int smd_packet_write_avail(struct smd_channel *ch)
-{
-	int n = smd_stream_write_avail(ch);
-	return n > SMD_HEADER_SIZE ? n - SMD_HEADER_SIZE : 0;
-}
-
-static int ch_is_open(struct smd_channel *ch)
-{
-	return (ch->recv->state == SMD_SS_OPENED) &&
-		(ch->send->state == SMD_SS_OPENED);
-}
-
-/* provide a pointer and length to readable data in the fifo */
-static unsigned ch_read_buffer(struct smd_channel *ch, void **ptr)
-{
-	unsigned head = ch->recv->head;
-	unsigned tail = ch->recv->tail;
-	*ptr = (void *) (ch->recv->data + tail);
-
-	if (tail <= head)
-		return head - tail;
-	else
-		return SMD_BUF_SIZE - tail;
-}
-
-/* advance the fifo read pointer after data from ch_read_buffer is consumed */
-static void ch_read_done(struct smd_channel *ch, unsigned count)
-{
-	BUG_ON(count > smd_stream_read_avail(ch));
-	ch->recv->tail = (ch->recv->tail + count) & (SMD_BUF_SIZE - 1);
-	ch->recv->fTAIL = 1;
-}
-
-/* basic read interface to ch_read_{buffer,done} used
-** by smd_*_read() and update_packet_state()
-** will read-and-discard if the _data pointer is null
-*/
-static int ch_read(struct smd_channel *ch, void *_data, int len)
-{
-	void *ptr;
-	unsigned n;
-	unsigned char *data = _data;
-	int orig_len = len;
-
-	while (len > 0) {
-		n = ch_read_buffer(ch, &ptr);
-		if (n == 0)
-			break;
-
-		if (n > len)
-			n = len;
-		if (_data)
-			memcpy(data, ptr, n);
-
-		data += n;
-		len -= n;
-		ch_read_done(ch, n);
-	}
-
-	return orig_len - len;
-}
-
-static void update_stream_state(struct smd_channel *ch)
-{
-	/* streams have no special state requiring updating */
-}
-
-static void update_packet_state(struct smd_channel *ch)
-{
-	unsigned hdr[5];
-	int r;
-
-	/* can't do anything if we're in the middle of a packet */
-	if (ch->current_packet != 0)
-		return;
-
-	/* don't bother unless we can get the full header */
-	if (smd_stream_read_avail(ch) < SMD_HEADER_SIZE)
-		return;
-
-	r = ch_read(ch, hdr, SMD_HEADER_SIZE);
-	BUG_ON(r != SMD_HEADER_SIZE);
-
-	ch->current_packet = hdr[0];
-}
-
-/* provide a pointer and length to next free space in the fifo */
-static unsigned ch_write_buffer(struct smd_channel *ch, void **ptr)
-{
-	unsigned head = ch->send->head;
-	unsigned tail = ch->send->tail;
-	*ptr = (void *) (ch->send->data + head);
-
-	if (head < tail) {
-		return tail - head - 1;
-	} else {
-		if (tail == 0)
-			return SMD_BUF_SIZE - head - 1;
-		else
-			return SMD_BUF_SIZE - head;
-	}
-}
-
-/* advace the fifo write pointer after freespace
- * from ch_write_buffer is filled
- */
-static void ch_write_done(struct smd_channel *ch, unsigned count)
-{
-	BUG_ON(count > smd_stream_write_avail(ch));
-	ch->send->head = (ch->send->head + count) & (SMD_BUF_SIZE - 1);
-	ch->send->fHEAD = 1;
-}
-
-static void hc_set_state(volatile struct smd_half_channel *hc, unsigned n)
-{
-	if (n == SMD_SS_OPENED) {
-		hc->fDSR = 1;
-		hc->fCTS = 1;
-		hc->fCD = 1;
-	} else {
-		hc->fDSR = 0;
-		hc->fCTS = 0;
-		hc->fCD = 0;
-	}
-	hc->state = n;
-	hc->fSTATE = 1;
-	notify_other_smd();
-}
-
-static void do_smd_probe(void)
-{
-	struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE;
-	if (shared->heap_info.free_offset != last_heap_free) {
-		last_heap_free = shared->heap_info.free_offset;
-		schedule_work(&probe_work);
-	}
-}
-
-static void smd_state_change(struct smd_channel *ch,
-			     unsigned last, unsigned next)
-{
-	ch->last_state = next;
-
-	pr_info("SMD: ch %d %s -> %s\n", ch->n,
-		chstate(last), chstate(next));
-
-	switch (next) {
-	case SMD_SS_OPENING:
-		ch->recv->tail = 0;
-	case SMD_SS_OPENED:
-		if (ch->send->state != SMD_SS_OPENED)
-			hc_set_state(ch->send, SMD_SS_OPENED);
-		ch->notify(ch->priv, SMD_EVENT_OPEN);
-		break;
-	case SMD_SS_FLUSHING:
-	case SMD_SS_RESET:
-		/* we should force them to close? */
-	default:
-		ch->notify(ch->priv, SMD_EVENT_CLOSE);
-	}
-}
-
-static irqreturn_t smd_irq_handler(int irq, void *data)
-{
-	unsigned long flags;
-	struct smd_channel *ch;
-	int do_notify = 0;
-	unsigned ch_flags;
-	unsigned tmp;
-
-	spin_lock_irqsave(&smd_lock, flags);
-	list_for_each_entry(ch, &smd_ch_list, ch_list) {
-		ch_flags = 0;
-		if (ch_is_open(ch)) {
-			if (ch->recv->fHEAD) {
-				ch->recv->fHEAD = 0;
-				ch_flags |= 1;
-				do_notify |= 1;
-			}
-			if (ch->recv->fTAIL) {
-				ch->recv->fTAIL = 0;
-				ch_flags |= 2;
-				do_notify |= 1;
-			}
-			if (ch->recv->fSTATE) {
-				ch->recv->fSTATE = 0;
-				ch_flags |= 4;
-				do_notify |= 1;
-			}
-		}
-		tmp = ch->recv->state;
-		if (tmp != ch->last_state)
-			smd_state_change(ch, ch->last_state, tmp);
-		if (ch_flags) {
-			ch->update_state(ch);
-			ch->notify(ch->priv, SMD_EVENT_DATA);
-		}
-	}
-	if (do_notify)
-		notify_other_smd();
-	spin_unlock_irqrestore(&smd_lock, flags);
-	do_smd_probe();
-	return IRQ_HANDLED;
-}
-
-static void smd_fake_irq_handler(unsigned long arg)
-{
-	smd_irq_handler(0, NULL);
-}
-
-static DECLARE_TASKLET(smd_fake_irq_tasklet, smd_fake_irq_handler, 0);
-
-void smd_sleep_exit(void)
-{
-	unsigned long flags;
-	struct smd_channel *ch;
-	unsigned tmp;
-	int need_int = 0;
-
-	spin_lock_irqsave(&smd_lock, flags);
-	list_for_each_entry(ch, &smd_ch_list, ch_list) {
-		if (ch_is_open(ch)) {
-			if (ch->recv->fHEAD) {
-				if (msm_smd_debug_mask & MSM_SMD_DEBUG)
-					pr_info("smd_sleep_exit ch %d fHEAD "
-						"%x %x %x\n",
-						ch->n, ch->recv->fHEAD,
-						ch->recv->head, ch->recv->tail);
-				need_int = 1;
-				break;
-			}
-			if (ch->recv->fTAIL) {
-				if (msm_smd_debug_mask & MSM_SMD_DEBUG)
-					pr_info("smd_sleep_exit ch %d fTAIL "
-						"%x %x %x\n",
-						ch->n, ch->recv->fTAIL,
-						ch->send->head, ch->send->tail);
-				need_int = 1;
-				break;
-			}
-			if (ch->recv->fSTATE) {
-				if (msm_smd_debug_mask & MSM_SMD_DEBUG)
-					pr_info("smd_sleep_exit ch %d fSTATE %x"
-						"\n", ch->n, ch->recv->fSTATE);
-				need_int = 1;
-				break;
-			}
-			tmp = ch->recv->state;
-			if (tmp != ch->last_state) {
-				if (msm_smd_debug_mask & MSM_SMD_DEBUG)
-					pr_info("smd_sleep_exit ch %d "
-						"state %x != %x\n",
-						ch->n, tmp, ch->last_state);
-				need_int = 1;
-				break;
-			}
-		}
-	}
-	spin_unlock_irqrestore(&smd_lock, flags);
-	do_smd_probe();
-	if (need_int) {
-		if (msm_smd_debug_mask & MSM_SMD_DEBUG)
-			pr_info("smd_sleep_exit need interrupt\n");
-		tasklet_schedule(&smd_fake_irq_tasklet);
-	}
-}
-
-
-void smd_kick(smd_channel_t *ch)
-{
-	unsigned long flags;
-	unsigned tmp;
-
-	spin_lock_irqsave(&smd_lock, flags);
-	ch->update_state(ch);
-	tmp = ch->recv->state;
-	if (tmp != ch->last_state) {
-		ch->last_state = tmp;
-		if (tmp == SMD_SS_OPENED)
-			ch->notify(ch->priv, SMD_EVENT_OPEN);
-		else
-			ch->notify(ch->priv, SMD_EVENT_CLOSE);
-	}
-	ch->notify(ch->priv, SMD_EVENT_DATA);
-	notify_other_smd();
-	spin_unlock_irqrestore(&smd_lock, flags);
-}
-
-static int smd_is_packet(int chn)
-{
-	if ((chn > 4) || (chn == 1))
-		return 1;
-	else
-		return 0;
-}
-
-static int smd_stream_write(smd_channel_t *ch, const void *_data, int len)
-{
-	void *ptr;
-	const unsigned char *buf = _data;
-	unsigned xfer;
-	int orig_len = len;
-
-	if (len < 0)
-		return -EINVAL;
-
-	while ((xfer = ch_write_buffer(ch, &ptr)) != 0) {
-		if (!ch_is_open(ch))
-			break;
-		if (xfer > len)
-			xfer = len;
-		memcpy(ptr, buf, xfer);
-		ch_write_done(ch, xfer);
-		len -= xfer;
-		buf += xfer;
-		if (len == 0)
-			break;
-	}
-
-	notify_other_smd();
-
-	return orig_len - len;
-}
-
-static int smd_packet_write(smd_channel_t *ch, const void *_data, int len)
-{
-	unsigned hdr[5];
-
-	if (len < 0)
-		return -EINVAL;
-
-	if (smd_stream_write_avail(ch) < (len + SMD_HEADER_SIZE))
-		return -ENOMEM;
-
-	hdr[0] = len;
-	hdr[1] = hdr[2] = hdr[3] = hdr[4] = 0;
-
-	smd_stream_write(ch, hdr, sizeof(hdr));
-	smd_stream_write(ch, _data, len);
-
-	return len;
-}
-
-static int smd_stream_read(smd_channel_t *ch, void *data, int len)
-{
-	int r;
-
-	if (len < 0)
-		return -EINVAL;
-
-	r = ch_read(ch, data, len);
-	if (r > 0)
-		notify_other_smd();
-
-	return r;
-}
-
-static int smd_packet_read(smd_channel_t *ch, void *data, int len)
-{
-	unsigned long flags;
-	int r;
-
-	if (len < 0)
-		return -EINVAL;
-
-	if (len > ch->current_packet)
-		len = ch->current_packet;
-
-	r = ch_read(ch, data, len);
-	if (r > 0)
-		notify_other_smd();
-
-	spin_lock_irqsave(&smd_lock, flags);
-	ch->current_packet -= r;
-	update_packet_state(ch);
-	spin_unlock_irqrestore(&smd_lock, flags);
-
-	return r;
-}
-
-static void smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
-{
-	struct smd_channel *ch;
-	struct smd_shared *shared;
-
-	shared = smem_alloc(ID_SMD_CHANNELS + cid, sizeof(*shared));
-	if (!shared) {
-		pr_err("smd_alloc_channel() cid %d does not exist\n", cid);
-		return;
-	}
-
-	ch = kzalloc(sizeof(struct smd_channel), GFP_KERNEL);
-	if (ch == 0) {
-		pr_err("smd_alloc_channel() out of memory\n");
-		return;
-	}
-
-	ch->send = &shared->ch0;
-	ch->recv = &shared->ch1;
-	ch->n = cid;
-
-	if (smd_is_packet(cid)) {
-		ch->read = smd_packet_read;
-		ch->write = smd_packet_write;
-		ch->read_avail = smd_packet_read_avail;
-		ch->write_avail = smd_packet_write_avail;
-		ch->update_state = update_packet_state;
-	} else {
-		ch->read = smd_stream_read;
-		ch->write = smd_stream_write;
-		ch->read_avail = smd_stream_read_avail;
-		ch->write_avail = smd_stream_write_avail;
-		ch->update_state = update_stream_state;
-	}
-
-	memcpy(ch->name, "SMD_", 4);
-	memcpy(ch->name + 4, name, 20);
-	ch->name[23] = 0;
-	ch->pdev.name = ch->name;
-	ch->pdev.id = -1;
-
-	pr_info("smd_alloc_channel() '%s' cid=%d, shared=%p\n",
-		ch->name, ch->n, shared);
-
-	mutex_lock(&smd_creation_mutex);
-	list_add(&ch->ch_list, &smd_ch_closed_list);
-	mutex_unlock(&smd_creation_mutex);
-
-	platform_device_register(&ch->pdev);
-}
-
-static void do_nothing_notify(void *priv, unsigned flags)
-{
-}
-
-struct smd_channel *smd_get_channel(const char *name)
-{
-	struct smd_channel *ch;
-
-	mutex_lock(&smd_creation_mutex);
-	list_for_each_entry(ch, &smd_ch_closed_list, ch_list) {
-		if (!strcmp(name, ch->name)) {
-			list_del(&ch->ch_list);
-			mutex_unlock(&smd_creation_mutex);
-			return ch;
-		}
-	}
-	mutex_unlock(&smd_creation_mutex);
-
-	return NULL;
-}
-
-int smd_open(const char *name, smd_channel_t **_ch,
-	     void *priv, void (*notify)(void *, unsigned))
-{
-	struct smd_channel *ch;
-	unsigned long flags;
-
-	if (smd_initialized == 0) {
-		pr_info("smd_open() before smd_init()\n");
-		return -ENODEV;
-	}
-
-	ch = smd_get_channel(name);
-	if (!ch)
-		return -ENODEV;
-
-	if (notify == 0)
-		notify = do_nothing_notify;
-
-	ch->notify = notify;
-	ch->current_packet = 0;
-	ch->last_state = SMD_SS_CLOSED;
-	ch->priv = priv;
-
-	*_ch = ch;
-
-	spin_lock_irqsave(&smd_lock, flags);
-	list_add(&ch->ch_list, &smd_ch_list);
-
-	/* If the remote side is CLOSING, we need to get it to
-	 * move to OPENING (which we'll do by moving from CLOSED to
-	 * OPENING) and then get it to move from OPENING to
-	 * OPENED (by doing the same state change ourselves).
-	 *
-	 * Otherwise, it should be OPENING and we can move directly
-	 * to OPENED so that it will follow.
-	 */
-	if (ch->recv->state == SMD_SS_CLOSING) {
-		ch->send->head = 0;
-		hc_set_state(ch->send, SMD_SS_OPENING);
-	} else {
-		hc_set_state(ch->send, SMD_SS_OPENED);
-	}
-	spin_unlock_irqrestore(&smd_lock, flags);
-	smd_kick(ch);
-
-	return 0;
-}
-
-int smd_close(smd_channel_t *ch)
-{
-	unsigned long flags;
-
-	pr_info("smd_close(%p)\n", ch);
-
-	if (ch == 0)
-		return -1;
-
-	spin_lock_irqsave(&smd_lock, flags);
-	ch->notify = do_nothing_notify;
-	list_del(&ch->ch_list);
-	hc_set_state(ch->send, SMD_SS_CLOSED);
-	spin_unlock_irqrestore(&smd_lock, flags);
-
-	mutex_lock(&smd_creation_mutex);
-	list_add(&ch->ch_list, &smd_ch_closed_list);
-	mutex_unlock(&smd_creation_mutex);
-
-	return 0;
-}
-
-int smd_read(smd_channel_t *ch, void *data, int len)
-{
-	return ch->read(ch, data, len);
-}
-
-int smd_write(smd_channel_t *ch, const void *data, int len)
-{
-	return ch->write(ch, data, len);
-}
-
-int smd_read_avail(smd_channel_t *ch)
-{
-	return ch->read_avail(ch);
-}
-
-int smd_write_avail(smd_channel_t *ch)
-{
-	return ch->write_avail(ch);
-}
-
-int smd_wait_until_readable(smd_channel_t *ch, int bytes)
-{
-	return -1;
-}
-
-int smd_wait_until_writable(smd_channel_t *ch, int bytes)
-{
-	return -1;
-}
-
-int smd_cur_packet_size(smd_channel_t *ch)
-{
-	return ch->current_packet;
-}
-
-
-/* ------------------------------------------------------------------------- */
-
-void *smem_alloc(unsigned id, unsigned size)
-{
-	return smem_find(id, size);
-}
-
-static void *_smem_find(unsigned id, unsigned *size)
-{
-	struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE;
-	struct smem_heap_entry *toc = shared->heap_toc;
-
-	if (id >= SMEM_NUM_ITEMS)
-		return 0;
-
-	if (toc[id].allocated) {
-		*size = toc[id].size;
-		return (void *) (MSM_SHARED_RAM_BASE + toc[id].offset);
-	}
-
-	return 0;
-}
-
-void *smem_find(unsigned id, unsigned size_in)
-{
-	unsigned size;
-	void *ptr;
-
-	ptr = _smem_find(id, &size);
-	if (!ptr)
-		return 0;
-
-	size_in = ALIGN(size_in, 8);
-	if (size_in != size) {
-		pr_err("smem_find(%d, %d): wrong size %d\n",
-		       id, size_in, size);
-		return 0;
-	}
-
-	return ptr;
-}
-
-static irqreturn_t smsm_irq_handler(int irq, void *data)
-{
-	unsigned long flags;
-	struct smsm_shared *smsm;
-
-	spin_lock_irqsave(&smem_lock, flags);
-	smsm = smem_alloc(ID_SHARED_STATE,
-			  2 * sizeof(struct smsm_shared));
-
-	if (smsm == 0) {
-		pr_info("<SM NO STATE>\n");
-	} else {
-		unsigned apps = smsm[0].state;
-		unsigned modm = smsm[1].state;
-
-		if (msm_smd_debug_mask & MSM_SMSM_DEBUG)
-			pr_info("<SM %08x %08x>\n", apps, modm);
-		if (modm & SMSM_RESET) {
-			handle_modem_crash();
-		} else {
-			apps |= SMSM_INIT;
-			if (modm & SMSM_SMDINIT)
-				apps |= SMSM_SMDINIT;
-			if (modm & SMSM_RPCINIT)
-				apps |= SMSM_RPCINIT;
-		}
-
-		if (smsm[0].state != apps) {
-			if (msm_smd_debug_mask & MSM_SMSM_DEBUG)
-				pr_info("<SM %08x NOTIFY>\n", apps);
-			smsm[0].state = apps;
-			do_smd_probe();
-			notify_other_smsm();
-		}
-	}
-	spin_unlock_irqrestore(&smem_lock, flags);
-	return IRQ_HANDLED;
-}
-
-int smsm_change_state(uint32_t clear_mask, uint32_t set_mask)
-{
-	unsigned long flags;
-	struct smsm_shared *smsm;
-
-	spin_lock_irqsave(&smem_lock, flags);
-
-	smsm = smem_alloc(ID_SHARED_STATE,
-			  2 * sizeof(struct smsm_shared));
-
-	if (smsm) {
-		if (smsm[1].state & SMSM_RESET)
-			handle_modem_crash();
-		smsm[0].state = (smsm[0].state & ~clear_mask) | set_mask;
-		if (msm_smd_debug_mask & MSM_SMSM_DEBUG)
-			pr_info("smsm_change_state %x\n",
-			       smsm[0].state);
-		notify_other_smsm();
-	}
-
-	spin_unlock_irqrestore(&smem_lock, flags);
-
-	if (smsm == NULL) {
-		pr_err("smsm_change_state <SM NO STATE>\n");
-		return -EIO;
-	}
-	return 0;
-}
-
-uint32_t smsm_get_state(void)
-{
-	unsigned long flags;
-	struct smsm_shared *smsm;
-	uint32_t rv;
-
-	spin_lock_irqsave(&smem_lock, flags);
-
-	smsm = smem_alloc(ID_SHARED_STATE,
-			  2 * sizeof(struct smsm_shared));
-
-	if (smsm)
-		rv = smsm[1].state;
-	else
-		rv = 0;
-
-	if (rv & SMSM_RESET)
-		handle_modem_crash();
-
-	spin_unlock_irqrestore(&smem_lock, flags);
-
-	if (smsm == NULL)
-		pr_err("smsm_get_state <SM NO STATE>\n");
-	return rv;
-}
-
-int smsm_set_sleep_duration(uint32_t delay)
-{
-	uint32_t *ptr;
-
-	ptr = smem_alloc(SMEM_SMSM_SLEEP_DELAY, sizeof(*ptr));
-	if (ptr == NULL) {
-		pr_err("smsm_set_sleep_duration <SM NO SLEEP_DELAY>\n");
-		return -EIO;
-	}
-	if (msm_smd_debug_mask & MSM_SMSM_DEBUG)
-		pr_info("smsm_set_sleep_duration %d -> %d\n",
-		       *ptr, delay);
-	*ptr = delay;
-	return 0;
-}
-
-int smsm_set_interrupt_info(struct smsm_interrupt_info *info)
-{
-	struct smsm_interrupt_info *ptr;
-
-	ptr = smem_alloc(SMEM_SMSM_INT_INFO, sizeof(*ptr));
-	if (ptr == NULL) {
-		pr_err("smsm_set_sleep_duration <SM NO INT_INFO>\n");
-		return -EIO;
-	}
-	if (msm_smd_debug_mask & MSM_SMSM_DEBUG)
-		pr_info("smsm_set_interrupt_info %x %x -> %x %x\n",
-		       ptr->aArm_en_mask, ptr->aArm_interrupts_pending,
-		       info->aArm_en_mask, info->aArm_interrupts_pending);
-	*ptr = *info;
-	return 0;
-}
-
-#define MAX_NUM_SLEEP_CLIENTS		64
-#define MAX_SLEEP_NAME_LEN		8
-
-#define NUM_GPIO_INT_REGISTERS		6
-#define GPIO_SMEM_NUM_GROUPS		2
-#define GPIO_SMEM_MAX_PC_INTERRUPTS	8
-
-struct tramp_gpio_save {
-	unsigned int enable;
-	unsigned int detect;
-	unsigned int polarity;
-};
-
-struct tramp_gpio_smem {
-	uint16_t num_fired[GPIO_SMEM_NUM_GROUPS];
-	uint16_t fired[GPIO_SMEM_NUM_GROUPS][GPIO_SMEM_MAX_PC_INTERRUPTS];
-	uint32_t enabled[NUM_GPIO_INT_REGISTERS];
-	uint32_t detection[NUM_GPIO_INT_REGISTERS];
-	uint32_t polarity[NUM_GPIO_INT_REGISTERS];
-};
-
-
-void smsm_print_sleep_info(void)
-{
-	unsigned long flags;
-	uint32_t *ptr;
-	struct tramp_gpio_smem *gpio;
-	struct smsm_interrupt_info *int_info;
-
-
-	spin_lock_irqsave(&smem_lock, flags);
-
-	ptr = smem_alloc(SMEM_SMSM_SLEEP_DELAY, sizeof(*ptr));
-	if (ptr)
-		pr_info("SMEM_SMSM_SLEEP_DELAY: %x\n", *ptr);
-
-	ptr = smem_alloc(SMEM_SMSM_LIMIT_SLEEP, sizeof(*ptr));
-	if (ptr)
-		pr_info("SMEM_SMSM_LIMIT_SLEEP: %x\n", *ptr);
-
-	ptr = smem_alloc(SMEM_SLEEP_POWER_COLLAPSE_DISABLED, sizeof(*ptr));
-	if (ptr)
-		pr_info("SMEM_SLEEP_POWER_COLLAPSE_DISABLED: %x\n", *ptr);
-
-	int_info = smem_alloc(SMEM_SMSM_INT_INFO, sizeof(*int_info));
-	if (int_info)
-		pr_info("SMEM_SMSM_INT_INFO %x %x %x\n",
-			int_info->aArm_en_mask,
-			int_info->aArm_interrupts_pending,
-			int_info->aArm_wakeup_reason);
-
-	gpio = smem_alloc(SMEM_GPIO_INT, sizeof(*gpio));
-	if (gpio) {
-		int i;
-		for (i = 0; i < NUM_GPIO_INT_REGISTERS; i++)
-			pr_info("SMEM_GPIO_INT: %d: e %x d %x p %x\n",
-				i, gpio->enabled[i], gpio->detection[i],
-				gpio->polarity[i]);
-
-		for (i = 0; i < GPIO_SMEM_NUM_GROUPS; i++)
-			pr_info("SMEM_GPIO_INT: %d: f %d: %d %d...\n",
-				i, gpio->num_fired[i], gpio->fired[i][0],
-				gpio->fired[i][1]);
-	}
-
-	spin_unlock_irqrestore(&smem_lock, flags);
-}
-
-int smd_core_init(void)
-{
-	int r;
-	pr_info("smd_core_init()\n");
-
-	r = request_irq(INT_A9_M2A_0, smd_irq_handler,
-			IRQF_TRIGGER_RISING, "smd_dev", 0);
-	if (r < 0)
-		return r;
-	r = enable_irq_wake(INT_A9_M2A_0);
-	if (r < 0)
-		pr_err("smd_core_init: enable_irq_wake failed for A9_M2A_0\n");
-
-	r = request_irq(INT_A9_M2A_5, smsm_irq_handler,
-			IRQF_TRIGGER_RISING, "smsm_dev", 0);
-	if (r < 0) {
-		free_irq(INT_A9_M2A_0, 0);
-		return r;
-	}
-	r = enable_irq_wake(INT_A9_M2A_5);
-	if (r < 0)
-		pr_err("smd_core_init: enable_irq_wake failed for A9_M2A_5\n");
-
-	/* we may have missed a signal while booting -- fake
-	 * an interrupt to make sure we process any existing
-	 * state
-	 */
-	smsm_irq_handler(0, 0);
-
-	pr_info("smd_core_init() done\n");
-
-	return 0;
-}
-
-#if defined(CONFIG_DEBUG_FS)
-
-static int dump_ch(char *buf, int max, int n,
-		  struct smd_half_channel *s,
-		  struct smd_half_channel *r)
-{
-	return scnprintf(
-		buf, max,
-		"ch%02d:"
-		" %8s(%04d/%04d) %c%c%c%c%c%c%c <->"
-		" %8s(%04d/%04d) %c%c%c%c%c%c%c\n", n,
-		chstate(s->state), s->tail, s->head,
-		s->fDSR ? 'D' : 'd',
-		s->fCTS ? 'C' : 'c',
-		s->fCD ? 'C' : 'c',
-		s->fRI ? 'I' : 'i',
-		s->fHEAD ? 'W' : 'w',
-		s->fTAIL ? 'R' : 'r',
-		s->fSTATE ? 'S' : 's',
-		chstate(r->state), r->tail, r->head,
-		r->fDSR ? 'D' : 'd',
-		r->fCTS ? 'R' : 'r',
-		r->fCD ? 'C' : 'c',
-		r->fRI ? 'I' : 'i',
-		r->fHEAD ? 'W' : 'w',
-		r->fTAIL ? 'R' : 'r',
-		r->fSTATE ? 'S' : 's'
-		);
-}
-
-static int debug_read_stat(char *buf, int max)
-{
-	struct smsm_shared *smsm;
-	char *msg;
-	int i = 0;
-
-	smsm = smem_find(ID_SHARED_STATE,
-			 2 * sizeof(struct smsm_shared));
-
-	msg = smem_find(ID_DIAG_ERR_MSG, SZ_DIAG_ERR_MSG);
-
-	if (smsm) {
-		if (smsm[1].state & SMSM_RESET)
-			i += scnprintf(buf + i, max - i,
-				       "smsm: ARM9 HAS CRASHED\n");
-		i += scnprintf(buf + i, max - i, "smsm: a9: %08x a11: %08x\n",
-			       smsm[0].state, smsm[1].state);
-	} else {
-		i += scnprintf(buf + i, max - i, "smsm: cannot find\n");
-	}
-	if (msg) {
-		msg[SZ_DIAG_ERR_MSG - 1] = 0;
-		i += scnprintf(buf + i, max - i, "diag: '%s'\n", msg);
-	}
-	return i;
-}
-
-static int debug_read_mem(char *buf, int max)
-{
-	unsigned n;
-	struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE;
-	struct smem_heap_entry *toc = shared->heap_toc;
-	int i = 0;
-
-	i += scnprintf(buf + i, max - i,
-		       "heap: init=%d free=%d remain=%d\n",
-		       shared->heap_info.initialized,
-		       shared->heap_info.free_offset,
-		       shared->heap_info.heap_remaining);
-
-	for (n = 0; n < SMEM_NUM_ITEMS; n++) {
-		if (toc[n].allocated == 0)
-			continue;
-		i += scnprintf(buf + i, max - i,
-			       "%04d: offsed %08x size %08x\n",
-			       n, toc[n].offset, toc[n].size);
-	}
-	return i;
-}
-
-static int debug_read_ch(char *buf, int max)
-{
-	struct smd_shared *shared;
-	int n, i = 0;
-
-	for (n = 0; n < SMD_CHANNELS; n++) {
-		shared = smem_find(ID_SMD_CHANNELS + n,
-				   sizeof(struct smd_shared));
-		if (shared == 0)
-			continue;
-		i += dump_ch(buf + i, max - i, n, &shared->ch0, &shared->ch1);
-	}
-
-	return i;
-}
-
-static int debug_read_version(char *buf, int max)
-{
-	struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE;
-	unsigned version = shared->version[VERSION_MODEM];
-	return sprintf(buf, "%d.%d\n", version >> 16, version & 0xffff);
-}
-
-static int debug_read_build_id(char *buf, int max)
-{
-	unsigned size;
-	void *data;
-
-	data = _smem_find(SMEM_HW_SW_BUILD_ID, &size);
-	if (!data)
-		return 0;
-
-	if (size >= max)
-		size = max;
-	memcpy(buf, data, size);
-
-	return size;
-}
-
-static int debug_read_alloc_tbl(char *buf, int max)
-{
-	struct smd_alloc_elm *shared;
-	int n, i = 0;
-
-	shared = smem_find(ID_CH_ALLOC_TBL, sizeof(*shared) * 64);
-
-	for (n = 0; n < 64; n++) {
-		if (shared[n].ref_count == 0)
-			continue;
-		i += scnprintf(buf + i, max - i,
-			       "%03d: %20s cid=%02d ctype=%d ref_count=%d\n",
-			       n, shared[n].name, shared[n].cid,
-			       shared[n].ctype, shared[n].ref_count);
-	}
-
-	return i;
-}
-
-static int debug_boom(char *buf, int max)
-{
-	unsigned ms = 5000;
-	msm_proc_comm(PCOM_RESET_MODEM, &ms, 0);
-	return 0;
-}
-
-#define DEBUG_BUFMAX 4096
-static char debug_buffer[DEBUG_BUFMAX];
-
-static ssize_t debug_read(struct file *file, char __user *buf,
-			  size_t count, loff_t *ppos)
-{
-	int (*fill)(char *buf, int max) = file->private_data;
-	int bsize = fill(debug_buffer, DEBUG_BUFMAX);
-	return simple_read_from_buffer(buf, count, ppos, debug_buffer, bsize);
-}
-
-static int debug_open(struct inode *inode, struct file *file)
-{
-	file->private_data = inode->i_private;
-	return 0;
-}
-
-static const struct file_operations debug_ops = {
-	.read = debug_read,
-	.open = debug_open,
-};
-
-static void debug_create(const char *name, mode_t mode,
-			 struct dentry *dent,
-			 int (*fill)(char *buf, int max))
-{
-	debugfs_create_file(name, mode, dent, fill, &debug_ops);
-}
-
-static void smd_debugfs_init(void)
-{
-	struct dentry *dent;
-
-	dent = debugfs_create_dir("smd", 0);
-	if (IS_ERR(dent))
-		return;
-
-	debug_create("ch", 0444, dent, debug_read_ch);
-	debug_create("stat", 0444, dent, debug_read_stat);
-	debug_create("mem", 0444, dent, debug_read_mem);
-	debug_create("version", 0444, dent, debug_read_version);
-	debug_create("tbl", 0444, dent, debug_read_alloc_tbl);
-	debug_create("build", 0444, dent, debug_read_build_id);
-	debug_create("boom", 0444, dent, debug_boom);
-}
-#else
-static void smd_debugfs_init(void) {}
-#endif
-
-static int __init msm_smd_probe(struct platform_device *pdev)
-{
-	pr_info("smd_init()\n");
-
-	INIT_WORK(&probe_work, smd_channel_probe_worker);
-
-	if (smd_core_init()) {
-		pr_err("smd_core_init() failed\n");
-		return -1;
-	}
-
-	do_smd_probe();
-
-	msm_check_for_modem_crash = check_for_modem_crash;
-
-	smd_debugfs_init();
-	smd_initialized = 1;
-
-	return 0;
-}
-
-static struct platform_driver msm_smd_driver = {
-	.probe = msm_smd_probe,
-	.driver = {
-		.name = MODULE_NAME,
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init msm_smd_init(void)
-{
-	return platform_driver_register(&msm_smd_driver);
-}
-
-module_init(msm_smd_init);
-
-MODULE_DESCRIPTION("MSM Shared Memory Core");
-MODULE_AUTHOR("Brian Swetland <swetland@google.com>");
-MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-msm/smd_qmi.c b/arch/arm/mach-msm/smd_qmi.c
deleted file mode 100644
index 50411df..0000000
--- a/arch/arm/mach-msm/smd_qmi.c
+++ /dev/null
@@ -1,860 +0,0 @@
-/* arch/arm/mach-msm/smd_qmi.c
- *
- * QMI Control Driver -- Manages network data connections.
- *
- * Copyright (C) 2007 Google, Inc.
- * Author: Brian Swetland <swetland@google.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/cdev.h>
-#include <linux/device.h>
-#include <linux/sched.h>
-#include <linux/wait.h>
-#include <linux/miscdevice.h>
-#include <linux/workqueue.h>
-#include <linux/wakelock.h>
-
-#include <asm/uaccess.h>
-#include <mach/msm_smd.h>
-
-#define QMI_CTL 0x00
-#define QMI_WDS 0x01
-#define QMI_DMS 0x02
-#define QMI_NAS 0x03
-
-#define QMI_RESULT_SUCCESS 0x0000
-#define QMI_RESULT_FAILURE 0x0001
-
-struct qmi_msg {
-	unsigned char service;
-	unsigned char client_id;
-	unsigned short txn_id;
-	unsigned short type;
-	unsigned short size;
-	unsigned char *tlv;
-};
-
-#define qmi_ctl_client_id 0
-
-#define STATE_OFFLINE    0
-#define STATE_QUERYING   1
-#define STATE_ONLINE     2
-
-struct qmi_ctxt {
-	struct miscdevice misc;
-
-	struct mutex lock;
-
-	unsigned char ctl_txn_id;
-	unsigned char wds_client_id;
-	unsigned short wds_txn_id;
-
-	unsigned wds_busy;
-	unsigned wds_handle;
-	unsigned state_dirty;
-	unsigned state;
-
-	unsigned char addr[4];
-	unsigned char mask[4];
-	unsigned char gateway[4];
-	unsigned char dns1[4];
-	unsigned char dns2[4];
-
-	smd_channel_t *ch;
-	const char *ch_name;
-	struct wake_lock wake_lock;
-
-	struct work_struct open_work;
-	struct work_struct read_work;
-};
-
-static struct qmi_ctxt *qmi_minor_to_ctxt(unsigned n);
-
-static void qmi_read_work(struct work_struct *ws);
-static void qmi_open_work(struct work_struct *work);
-
-void qmi_ctxt_init(struct qmi_ctxt *ctxt, unsigned n)
-{
-	mutex_init(&ctxt->lock);
-	INIT_WORK(&ctxt->read_work, qmi_read_work);
-	INIT_WORK(&ctxt->open_work, qmi_open_work);
-	wake_lock_init(&ctxt->wake_lock, WAKE_LOCK_SUSPEND, ctxt->misc.name);
-	ctxt->ctl_txn_id = 1;
-	ctxt->wds_txn_id = 1;
-	ctxt->wds_busy = 1;
-	ctxt->state = STATE_OFFLINE;
-
-}
-
-static struct workqueue_struct *qmi_wq;
-
-static int verbose = 0;
-
-/* anyone waiting for a state change waits here */
-static DECLARE_WAIT_QUEUE_HEAD(qmi_wait_queue);
-
-
-static void qmi_dump_msg(struct qmi_msg *msg, const char *prefix)
-{
-	unsigned sz, n;
-	unsigned char *x;
-
-	if (!verbose)
-		return;
-
-	printk(KERN_INFO
-	       "qmi: %s: svc=%02x cid=%02x tid=%04x type=%04x size=%04x\n",
-	       prefix, msg->service, msg->client_id,
-	       msg->txn_id, msg->type, msg->size);
-
-	x = msg->tlv;
-	sz = msg->size;
-
-	while (sz >= 3) {
-		sz -= 3;
-
-		n = x[1] | (x[2] << 8);
-		if (n > sz)
-			break;
-
-		printk(KERN_INFO "qmi: %s: tlv: %02x %04x { ",
-		       prefix, x[0], n);
-		x += 3;
-		sz -= n;
-		while (n-- > 0)
-			printk("%02x ", *x++);
-		printk("}\n");
-	}
-}
-
-int qmi_add_tlv(struct qmi_msg *msg,
-		unsigned type, unsigned size, const void *data)
-{
-	unsigned char *x = msg->tlv + msg->size;
-
-	x[0] = type;
-	x[1] = size;
-	x[2] = size >> 8;
-
-	memcpy(x + 3, data, size);
-
-	msg->size += (size + 3);
-
-	return 0;
-}
-
-/* Extract a tagged item from a qmi message buffer,
-** taking care not to overrun the buffer.
-*/
-static int qmi_get_tlv(struct qmi_msg *msg,
-		       unsigned type, unsigned size, void *data)
-{
-	unsigned char *x = msg->tlv;
-	unsigned len = msg->size;
-	unsigned n;
-
-	while (len >= 3) {
-		len -= 3;
-
-		/* size of this item */
-		n = x[1] | (x[2] << 8);
-		if (n > len)
-			break;
-
-		if (x[0] == type) {
-			if (n != size)
-				return -1;
-			memcpy(data, x + 3, size);
-			return 0;
-		}
-
-		x += (n + 3);
-		len -= n;
-	}
-
-	return -1;
-}
-
-static unsigned qmi_get_status(struct qmi_msg *msg, unsigned *error)
-{
-	unsigned short status[2];
-	if (qmi_get_tlv(msg, 0x02, sizeof(status), status)) {
-		*error = 0;
-		return QMI_RESULT_FAILURE;
-	} else {
-		*error = status[1];
-		return status[0];
-	}
-}
-
-/* 0x01 <qmux-header> <payload> */
-#define QMUX_HEADER    13
-
-/* should be >= HEADER + FOOTER */
-#define QMUX_OVERHEAD  16
-
-static int qmi_send(struct qmi_ctxt *ctxt, struct qmi_msg *msg)
-{
-	unsigned char *data;
-	unsigned hlen;
-	unsigned len;
-	int r;
-
-	qmi_dump_msg(msg, "send");
-
-	if (msg->service == QMI_CTL) {
-		hlen = QMUX_HEADER - 1;
-	} else {
-		hlen = QMUX_HEADER;
-	}
-
-	/* QMUX length is total header + total payload - IFC selector */
-	len = hlen + msg->size - 1;
-	if (len > 0xffff)
-		return -1;
-
-	data = msg->tlv - hlen;
-
-	/* prepend encap and qmux header */
-	*data++ = 0x01; /* ifc selector */
-
-	/* qmux header */
-	*data++ = len;
-	*data++ = len >> 8;
-	*data++ = 0x00; /* flags: client */
-	*data++ = msg->service;
-	*data++ = msg->client_id;
-
-	/* qmi header */
-	*data++ = 0x00; /* flags: send */
-	*data++ = msg->txn_id;
-	if (msg->service != QMI_CTL)
-		*data++ = msg->txn_id >> 8;
-
-	*data++ = msg->type;
-	*data++ = msg->type >> 8;
-	*data++ = msg->size;
-	*data++ = msg->size >> 8;
-
-	/* len + 1 takes the interface selector into account */
-	r = smd_write(ctxt->ch, msg->tlv - hlen, len + 1);
-
-	if (r != len) {
-		return -1;
-	} else {
-		return 0;
-	}
-}
-
-static void qmi_process_ctl_msg(struct qmi_ctxt *ctxt, struct qmi_msg *msg)
-{
-	unsigned err;
-	if (msg->type == 0x0022) {
-		unsigned char n[2];
-		if (qmi_get_status(msg, &err))
-			return;
-		if (qmi_get_tlv(msg, 0x01, sizeof(n), n))
-			return;
-		if (n[0] == QMI_WDS) {
-			printk(KERN_INFO
-			       "qmi: ctl: wds use client_id 0x%02x\n", n[1]);
-			ctxt->wds_client_id = n[1];
-			ctxt->wds_busy = 0;
-		}
-	}
-}
-
-static int qmi_network_get_profile(struct qmi_ctxt *ctxt);
-
-static void swapaddr(unsigned char *src, unsigned char *dst)
-{
-	dst[0] = src[3];
-	dst[1] = src[2];
-	dst[2] = src[1];
-	dst[3] = src[0];
-}
-
-static unsigned char zero[4];
-static void qmi_read_runtime_profile(struct qmi_ctxt *ctxt, struct qmi_msg *msg)
-{
-	unsigned char tmp[4];
-	unsigned r;
-
-	r = qmi_get_tlv(msg, 0x1e, 4, tmp);
-	swapaddr(r ? zero : tmp, ctxt->addr);
-	r = qmi_get_tlv(msg, 0x21, 4, tmp);
-	swapaddr(r ? zero : tmp, ctxt->mask);
-	r = qmi_get_tlv(msg, 0x20, 4, tmp);
-	swapaddr(r ? zero : tmp, ctxt->gateway);
-	r = qmi_get_tlv(msg, 0x15, 4, tmp);
-	swapaddr(r ? zero : tmp, ctxt->dns1);
-	r = qmi_get_tlv(msg, 0x16, 4, tmp);
-	swapaddr(r ? zero : tmp, ctxt->dns2);
-}
-
-static void qmi_process_unicast_wds_msg(struct qmi_ctxt *ctxt,
-					struct qmi_msg *msg)
-{
-	unsigned err;
-	switch (msg->type) {
-	case 0x0021:
-		if (qmi_get_status(msg, &err)) {
-			printk(KERN_ERR
-			       "qmi: wds: network stop failed (%04x)\n", err);
-		} else {
-			printk(KERN_INFO
-			       "qmi: wds: network stopped\n");
-			ctxt->state = STATE_OFFLINE;
-			ctxt->state_dirty = 1;
-		}
-		break;
-	case 0x0020:
-		if (qmi_get_status(msg, &err)) {
-			printk(KERN_ERR
-			       "qmi: wds: network start failed (%04x)\n", err);
-		} else if (qmi_get_tlv(msg, 0x01, sizeof(ctxt->wds_handle), &ctxt->wds_handle)) {
-			printk(KERN_INFO
-			       "qmi: wds no handle?\n");
-		} else {
-			printk(KERN_INFO
-			       "qmi: wds: got handle 0x%08x\n",
-			       ctxt->wds_handle);
-		}
-		break;
-	case 0x002D:
-		printk("qmi: got network profile\n");
-		if (ctxt->state == STATE_QUERYING) {
-			qmi_read_runtime_profile(ctxt, msg);
-			ctxt->state = STATE_ONLINE;
-			ctxt->state_dirty = 1;
-		}
-		break;
-	default:
-		printk(KERN_ERR "qmi: unknown msg type 0x%04x\n", msg->type);
-	}
-	ctxt->wds_busy = 0;
-}
-
-static void qmi_process_broadcast_wds_msg(struct qmi_ctxt *ctxt,
-					  struct qmi_msg *msg)
-{
-	if (msg->type == 0x0022) {
-		unsigned char n[2];
-		if (qmi_get_tlv(msg, 0x01, sizeof(n), n))
-			return;
-		switch (n[0]) {
-		case 1:
-			printk(KERN_INFO "qmi: wds: DISCONNECTED\n");
-			ctxt->state = STATE_OFFLINE;
-			ctxt->state_dirty = 1;
-			break;
-		case 2:
-			printk(KERN_INFO "qmi: wds: CONNECTED\n");
-			ctxt->state = STATE_QUERYING;
-			ctxt->state_dirty = 1;
-			qmi_network_get_profile(ctxt);
-			break;
-		case 3:
-			printk(KERN_INFO "qmi: wds: SUSPENDED\n");
-			ctxt->state = STATE_OFFLINE;
-			ctxt->state_dirty = 1;
-		}
-	} else {
-		printk(KERN_ERR "qmi: unknown bcast msg type 0x%04x\n", msg->type);
-	}
-}
-
-static void qmi_process_wds_msg(struct qmi_ctxt *ctxt,
-				struct qmi_msg *msg)
-{
-	printk("wds: %04x @ %02x\n", msg->type, msg->client_id);
-	if (msg->client_id == ctxt->wds_client_id) {
-		qmi_process_unicast_wds_msg(ctxt, msg);
-	} else if (msg->client_id == 0xff) {
-		qmi_process_broadcast_wds_msg(ctxt, msg);
-	} else {
-		printk(KERN_ERR
-		       "qmi_process_wds_msg client id 0x%02x unknown\n",
-		       msg->client_id);
-	}
-}
-
-static void qmi_process_qmux(struct qmi_ctxt *ctxt,
-			     unsigned char *buf, unsigned sz)
-{
-	struct qmi_msg msg;
-
-	/* require a full header */
-	if (sz < 5)
-		return;
-
-	/* require a size that matches the buffer size */
-	if (sz != (buf[0] | (buf[1] << 8)))
-		return;
-
-	/* only messages from a service (bit7=1) are allowed */
-	if (buf[2] != 0x80)
-		return;
-
-	msg.service = buf[3];
-	msg.client_id = buf[4];
-
-	/* annoyingly, CTL messages have a shorter TID */
-	if (buf[3] == 0) {
-		if (sz < 7)
-			return;
-		msg.txn_id = buf[6];
-		buf += 7;
-		sz -= 7;
-	} else {
-		if (sz < 8)
-			return;
-		msg.txn_id = buf[6] | (buf[7] << 8);
-		buf += 8;
-		sz -= 8;
-	}
-
-	/* no type and size!? */
-	if (sz < 4)
-		return;
-	sz -= 4;
-
-	msg.type = buf[0] | (buf[1] << 8);
-	msg.size = buf[2] | (buf[3] << 8);
-	msg.tlv = buf + 4;
-
-	if (sz != msg.size)
-		return;
-
-	qmi_dump_msg(&msg, "recv");
-
-	mutex_lock(&ctxt->lock);
-	switch (msg.service) {
-	case QMI_CTL:
-		qmi_process_ctl_msg(ctxt, &msg);
-		break;
-	case QMI_WDS:
-		qmi_process_wds_msg(ctxt, &msg);
-		break;
-	default:
-		printk(KERN_ERR "qmi: msg from unknown svc 0x%02x\n",
-		       msg.service);
-		break;
-	}
-	mutex_unlock(&ctxt->lock);
-
-	wake_up(&qmi_wait_queue);
-}
-
-#define QMI_MAX_PACKET (256 + QMUX_OVERHEAD)
-
-static void qmi_read_work(struct work_struct *ws)
-{
-	struct qmi_ctxt *ctxt = container_of(ws, struct qmi_ctxt, read_work);
-	struct smd_channel *ch = ctxt->ch;
-	unsigned char buf[QMI_MAX_PACKET];
-	int sz;
-
-	for (;;) {
-		sz = smd_cur_packet_size(ch);
-		if (sz == 0)
-			break;
-		if (sz < smd_read_avail(ch))
-			break;
-		if (sz > QMI_MAX_PACKET) {
-			smd_read(ch, 0, sz);
-			continue;
-		}
-		if (smd_read(ch, buf, sz) != sz) {
-			printk(KERN_ERR "qmi: not enough data?!\n");
-			continue;
-		}
-
-		/* interface selector must be 1 */
-		if (buf[0] != 0x01)
-			continue;
-
-		qmi_process_qmux(ctxt, buf + 1, sz - 1);
-	}
-}
-
-static int qmi_request_wds_cid(struct qmi_ctxt *ctxt);
-
-static void qmi_open_work(struct work_struct *ws)
-{
-	struct qmi_ctxt *ctxt = container_of(ws, struct qmi_ctxt, open_work);
-	mutex_lock(&ctxt->lock);
-	qmi_request_wds_cid(ctxt);
-	mutex_unlock(&ctxt->lock);
-}
-
-static void qmi_notify(void *priv, unsigned event)
-{
-	struct qmi_ctxt *ctxt = priv;
-	
-	switch (event) {
-	case SMD_EVENT_DATA: {
-		int sz;
-		sz = smd_cur_packet_size(ctxt->ch);
-		if ((sz > 0) && (sz <= smd_read_avail(ctxt->ch))) {
-			wake_lock_timeout(&ctxt->wake_lock, HZ / 2);
-			queue_work(qmi_wq, &ctxt->read_work);
-		}
-		break;
-	}
-	case SMD_EVENT_OPEN:
-		printk(KERN_INFO "qmi: smd opened\n");
-		queue_work(qmi_wq, &ctxt->open_work);
-		break;
-	case SMD_EVENT_CLOSE:
-		printk(KERN_INFO "qmi: smd closed\n");
-		break;
-	}
-}
-
-static int qmi_request_wds_cid(struct qmi_ctxt *ctxt)
-{
-	unsigned char data[64 + QMUX_OVERHEAD];
-	struct qmi_msg msg;
-	unsigned char n;
-
-	msg.service = QMI_CTL;
-	msg.client_id = qmi_ctl_client_id;
-	msg.txn_id = ctxt->ctl_txn_id;
-	msg.type = 0x0022;
-	msg.size = 0;
-	msg.tlv = data + QMUX_HEADER;
-
-	ctxt->ctl_txn_id += 2;
-
-	n = QMI_WDS;
-	qmi_add_tlv(&msg, 0x01, 0x01, &n);
-
-	return qmi_send(ctxt, &msg);
-}
-
-static int qmi_network_get_profile(struct qmi_ctxt *ctxt)
-{
-	unsigned char data[96 + QMUX_OVERHEAD];
-	struct qmi_msg msg;
-
-	msg.service = QMI_WDS;
-	msg.client_id = ctxt->wds_client_id;
-	msg.txn_id = ctxt->wds_txn_id;
-	msg.type = 0x002D;
-	msg.size = 0;
-	msg.tlv = data + QMUX_HEADER;
-
-	ctxt->wds_txn_id += 2;
-
-	return qmi_send(ctxt, &msg);
-}
-
-static int qmi_network_up(struct qmi_ctxt *ctxt, char *apn)
-{
-	unsigned char data[96 + QMUX_OVERHEAD];
-	struct qmi_msg msg;
-	char *auth_type;
-	char *user;
-	char *pass;
-
-	for (user = apn; *user; user++) {
-		if (*user == ' ') {
-			*user++ = 0;
-			break;
-		}
-	}
-	for (pass = user; *pass; pass++) {
-		if (*pass == ' ') {
-			*pass++ = 0;
-			break;
-		}
-	}
-
-	for (auth_type = pass; *auth_type; auth_type++) {
-		if (*auth_type == ' ') {
-			*auth_type++ = 0;
-			break;
-		}
-	}
-
-	msg.service = QMI_WDS;
-	msg.client_id = ctxt->wds_client_id;
-	msg.txn_id = ctxt->wds_txn_id;
-	msg.type = 0x0020;
-	msg.size = 0;
-	msg.tlv = data + QMUX_HEADER;
-
-	ctxt->wds_txn_id += 2;
-
-	qmi_add_tlv(&msg, 0x14, strlen(apn), apn);
-	if (*auth_type)
-		qmi_add_tlv(&msg, 0x16, strlen(auth_type), auth_type);
-	if (*user) {
-		if (!*auth_type) {
-			unsigned char x;
-			x = 3;
-			qmi_add_tlv(&msg, 0x16, 1, &x);
-		}
-		qmi_add_tlv(&msg, 0x17, strlen(user), user);
-		if (*pass)
-			qmi_add_tlv(&msg, 0x18, strlen(pass), pass);
-	}
-	return qmi_send(ctxt, &msg);
-}
-
-static int qmi_network_down(struct qmi_ctxt *ctxt)
-{
-	unsigned char data[16 + QMUX_OVERHEAD];
-	struct qmi_msg msg;
-
-	msg.service = QMI_WDS;
-	msg.client_id = ctxt->wds_client_id;
-	msg.txn_id = ctxt->wds_txn_id;
-	msg.type = 0x0021;
-	msg.size = 0;
-	msg.tlv = data + QMUX_HEADER;
-
-	ctxt->wds_txn_id += 2;
-
-	qmi_add_tlv(&msg, 0x01, sizeof(ctxt->wds_handle), &ctxt->wds_handle);
-
-	return qmi_send(ctxt, &msg);
-}
-
-static int qmi_print_state(struct qmi_ctxt *ctxt, char *buf, int max)
-{
-	int i;
-	char *statename;
-
-	if (ctxt->state == STATE_ONLINE) {
-		statename = "up";
-	} else if (ctxt->state == STATE_OFFLINE) {
-		statename = "down";
-	} else {
-		statename = "busy";
-	}
-
-	i = scnprintf(buf, max, "STATE=%s\n", statename);
-	i += scnprintf(buf + i, max - i, "CID=%d\n",ctxt->wds_client_id);
-
-	if (ctxt->state != STATE_ONLINE){
-		return i;
-	}
-
-	i += scnprintf(buf + i, max - i, "ADDR=%d.%d.%d.%d\n",
-		ctxt->addr[0], ctxt->addr[1], ctxt->addr[2], ctxt->addr[3]);
-	i += scnprintf(buf + i, max - i, "MASK=%d.%d.%d.%d\n",
-		ctxt->mask[0], ctxt->mask[1], ctxt->mask[2], ctxt->mask[3]);
-	i += scnprintf(buf + i, max - i, "GATEWAY=%d.%d.%d.%d\n",
-		ctxt->gateway[0], ctxt->gateway[1], ctxt->gateway[2],
-		ctxt->gateway[3]);
-	i += scnprintf(buf + i, max - i, "DNS1=%d.%d.%d.%d\n",
-		ctxt->dns1[0], ctxt->dns1[1], ctxt->dns1[2], ctxt->dns1[3]);
-	i += scnprintf(buf + i, max - i, "DNS2=%d.%d.%d.%d\n",
-		ctxt->dns2[0], ctxt->dns2[1], ctxt->dns2[2], ctxt->dns2[3]);
-
-	return i;
-}
-
-static ssize_t qmi_read(struct file *fp, char __user *buf,
-			size_t count, loff_t *pos)
-{
-	struct qmi_ctxt *ctxt = fp->private_data;
-	char msg[256];
-	int len;
-	int r;
-
-	mutex_lock(&ctxt->lock);
-	for (;;) {
-		if (ctxt->state_dirty) {
-			ctxt->state_dirty = 0;
-			len = qmi_print_state(ctxt, msg, 256);
-			break;
-		}
-		mutex_unlock(&ctxt->lock);
-		r = wait_event_interruptible(qmi_wait_queue, ctxt->state_dirty);
-		if (r < 0)
-			return r;
-		mutex_lock(&ctxt->lock);
-	}
-	mutex_unlock(&ctxt->lock);
-
-	if (len > count)
-		len = count;
-
-	if (copy_to_user(buf, msg, len))
-		return -EFAULT;
-
-	return len;
-}
-
-
-static ssize_t qmi_write(struct file *fp, const char __user *buf,
-			 size_t count, loff_t *pos)
-{
-	struct qmi_ctxt *ctxt = fp->private_data;
-	unsigned char cmd[64];
-	int len;
-	int r;
-
-	if (count < 1)
-		return 0;
-
-	len = count > 63 ? 63 : count;
-
-	if (copy_from_user(cmd, buf, len))
-		return -EFAULT;
-
-	cmd[len] = 0;
-
-	/* lazy */
-	if (cmd[len-1] == '\n') {
-		cmd[len-1] = 0;
-		len--;
-	}
-
-	if (!strncmp(cmd, "verbose", 7)) {
-		verbose = 1;
-	} else if (!strncmp(cmd, "terse", 5)) {
-		verbose = 0;
-	} else if (!strncmp(cmd, "poll", 4)) {
-		ctxt->state_dirty = 1;
-		wake_up(&qmi_wait_queue);
-	} else if (!strncmp(cmd, "down", 4)) {
-retry_down:
-		mutex_lock(&ctxt->lock);
-		if (ctxt->wds_busy) {
-			mutex_unlock(&ctxt->lock);
-			r = wait_event_interruptible(qmi_wait_queue, !ctxt->wds_busy);
-			if (r < 0)
-				return r;
-			goto retry_down;
-		}
-		ctxt->wds_busy = 1;
-		qmi_network_down(ctxt);
-		mutex_unlock(&ctxt->lock);
-	} else if (!strncmp(cmd, "up:", 3)) {
-retry_up:
-		mutex_lock(&ctxt->lock);
-		if (ctxt->wds_busy) {
-			mutex_unlock(&ctxt->lock);
-			r = wait_event_interruptible(qmi_wait_queue, !ctxt->wds_busy);
-			if (r < 0)
-				return r;
-			goto retry_up;
-		}
-		ctxt->wds_busy = 1;
-		qmi_network_up(ctxt, cmd+3);
-		mutex_unlock(&ctxt->lock);
-	} else {
-		return -EINVAL;
-	}
-
-	return count;
-}
-
-static int qmi_open(struct inode *ip, struct file *fp)
-{
-	struct qmi_ctxt *ctxt = qmi_minor_to_ctxt(MINOR(ip->i_rdev));
-	int r = 0;
-
-	if (!ctxt) {
-		printk(KERN_ERR "unknown qmi misc %d\n", MINOR(ip->i_rdev));
-		return -ENODEV;
-	}
-
-	fp->private_data = ctxt;
-
-	mutex_lock(&ctxt->lock);
-	if (ctxt->ch == 0)
-		r = smd_open(ctxt->ch_name, &ctxt->ch, ctxt, qmi_notify);
-	if (r == 0)
-		wake_up(&qmi_wait_queue);
-	mutex_unlock(&ctxt->lock);
-
-	return r;
-}
-
-static int qmi_release(struct inode *ip, struct file *fp)
-{
-	return 0;
-}
-
-static struct file_operations qmi_fops = {
-	.owner = THIS_MODULE,
-	.read = qmi_read,
-	.write = qmi_write,
-	.open = qmi_open,
-	.release = qmi_release,
-};
-
-static struct qmi_ctxt qmi_device0 = {
-	.ch_name = "SMD_DATA5_CNTL",
-	.misc = {
-		.minor = MISC_DYNAMIC_MINOR,
-		.name = "qmi0",
-		.fops = &qmi_fops,
-	}
-};
-static struct qmi_ctxt qmi_device1 = {
-	.ch_name = "SMD_DATA6_CNTL",
-	.misc = {
-		.minor = MISC_DYNAMIC_MINOR,
-		.name = "qmi1",
-		.fops = &qmi_fops,
-	}
-};
-static struct qmi_ctxt qmi_device2 = {
-	.ch_name = "SMD_DATA7_CNTL",
-	.misc = {
-		.minor = MISC_DYNAMIC_MINOR,
-		.name = "qmi2",
-		.fops = &qmi_fops,
-	}
-};
-
-static struct qmi_ctxt *qmi_minor_to_ctxt(unsigned n)
-{
-	if (n == qmi_device0.misc.minor)
-		return &qmi_device0;
-	if (n == qmi_device1.misc.minor)
-		return &qmi_device1;
-	if (n == qmi_device2.misc.minor)
-		return &qmi_device2;
-	return 0;
-}
-
-static int __init qmi_init(void)
-{
-	int ret;
-
-	qmi_wq = create_singlethread_workqueue("qmi");
-	if (qmi_wq == 0)
-		return -ENOMEM;
-
-	qmi_ctxt_init(&qmi_device0, 0);
-	qmi_ctxt_init(&qmi_device1, 1);
-	qmi_ctxt_init(&qmi_device2, 2);
-
-	ret = misc_register(&qmi_device0.misc);
-	if (ret == 0)
-		ret = misc_register(&qmi_device1.misc);
-	if (ret == 0)
-		ret = misc_register(&qmi_device2.misc);
-	return ret;
-}
-
-module_init(qmi_init);
diff --git a/arch/arm/mach-msm/smd_rpcrouter.c b/arch/arm/mach-msm/smd_rpcrouter.c
deleted file mode 100644
index 39c3c15..0000000
--- a/arch/arm/mach-msm/smd_rpcrouter.c
+++ /dev/null
@@ -1,1309 +0,0 @@
-/* arch/arm/mach-msm/smd_rpcrouter.c
- *
- * Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2007-2009 QUALCOMM Incorporated.
- * Author: San Mehat <san@android.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-
-/* TODO: handle cases where smd_write() will tempfail due to full fifo */
-/* TODO: thread priority? schedule a work to bump it? */
-/* TODO: maybe make server_list_lock a mutex */
-/* TODO: pool fragments to avoid kmalloc/kfree churn */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <linux/cdev.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/types.h>
-#include <linux/delay.h>
-#include <linux/fs.h>
-#include <linux/err.h>
-#include <linux/sched.h>
-#include <linux/poll.h>
-#include <linux/wakelock.h>
-#include <asm/uaccess.h>
-#include <asm/byteorder.h>
-#include <linux/platform_device.h>
-#include <linux/uaccess.h>
-
-#include <asm/byteorder.h>
-
-#include <mach/msm_smd.h>
-#include "smd_rpcrouter.h"
-
-#define TRACE_R2R_MSG 0
-#define TRACE_R2R_RAW 0
-#define TRACE_RPC_MSG 0
-#define TRACE_NOTIFY_MSG 0
-
-#define MSM_RPCROUTER_DEBUG 0
-#define MSM_RPCROUTER_DEBUG_PKT 0
-#define MSM_RPCROUTER_R2R_DEBUG 0
-#define DUMP_ALL_RECEIVED_HEADERS 0
-
-#define DIAG(x...) printk("[RR] ERROR " x)
-
-#if MSM_RPCROUTER_DEBUG
-#define D(x...) printk(x)
-#else
-#define D(x...) do {} while (0)
-#endif
-
-#if TRACE_R2R_MSG
-#define RR(x...) printk("[RR] "x)
-#else
-#define RR(x...) do {} while (0)
-#endif
-
-#if TRACE_RPC_MSG
-#define IO(x...) printk("[RPC] "x)
-#else
-#define IO(x...) do {} while (0)
-#endif
-
-#if TRACE_NOTIFY_MSG
-#define NTFY(x...) printk(KERN_ERR "[NOTIFY] "x)
-#else
-#define NTFY(x...) do {} while (0)
-#endif
-
-static LIST_HEAD(local_endpoints);
-static LIST_HEAD(remote_endpoints);
-
-static LIST_HEAD(server_list);
-
-static smd_channel_t *smd_channel;
-static int initialized;
-static wait_queue_head_t newserver_wait;
-static wait_queue_head_t smd_wait;
-static int smd_wait_count; /* odd while waiting */
-
-static DEFINE_SPINLOCK(local_endpoints_lock);
-static DEFINE_SPINLOCK(remote_endpoints_lock);
-static DEFINE_SPINLOCK(server_list_lock);
-static DEFINE_SPINLOCK(smd_lock);
-
-static struct workqueue_struct *rpcrouter_workqueue;
-static struct wake_lock rpcrouter_wake_lock;
-static int rpcrouter_need_len;
-
-static atomic_t next_xid = ATOMIC_INIT(1);
-static uint8_t next_pacmarkid;
-
-static void do_read_data(struct work_struct *work);
-static void do_create_pdevs(struct work_struct *work);
-static void do_create_rpcrouter_pdev(struct work_struct *work);
-
-static DECLARE_WORK(work_read_data, do_read_data);
-static DECLARE_WORK(work_create_pdevs, do_create_pdevs);
-static DECLARE_WORK(work_create_rpcrouter_pdev, do_create_rpcrouter_pdev);
-
-#define RR_STATE_IDLE    0
-#define RR_STATE_HEADER  1
-#define RR_STATE_BODY    2
-#define RR_STATE_ERROR   3
-
-struct rr_context {
-	struct rr_packet *pkt;
-	uint8_t *ptr;
-	uint32_t state; /* current assembly state */
-	uint32_t count; /* bytes needed in this state */
-};
-
-struct rr_context the_rr_context;
-
-static struct platform_device rpcrouter_pdev = {
-	.name		= "oncrpc_router",
-	.id		= -1,
-};
-
-
-static int rpcrouter_send_control_msg(union rr_control_msg *msg)
-{
-	struct rr_header hdr;
-	unsigned long flags;
-	int need;
-
-	if (!(msg->cmd == RPCROUTER_CTRL_CMD_HELLO) && !initialized) {
-		printk(KERN_ERR "rpcrouter_send_control_msg(): Warning, "
-		       "router not initialized\n");
-		return -EINVAL;
-	}
-
-	hdr.version = RPCROUTER_VERSION;
-	hdr.type = msg->cmd;
-	hdr.src_pid = RPCROUTER_PID_LOCAL;
-	hdr.src_cid = RPCROUTER_ROUTER_ADDRESS;
-	hdr.confirm_rx = 0;
-	hdr.size = sizeof(*msg);
-	hdr.dst_pid = 0;
-	hdr.dst_cid = RPCROUTER_ROUTER_ADDRESS;
-
-	/* TODO: what if channel is full? */
-
-	need = sizeof(hdr) + hdr.size;
-	spin_lock_irqsave(&smd_lock, flags);
-	while (smd_write_avail(smd_channel) < need) {
-		spin_unlock_irqrestore(&smd_lock, flags);
-		msleep(250);
-		spin_lock_irqsave(&smd_lock, flags);
-	}
-	smd_write(smd_channel, &hdr, sizeof(hdr));
-	smd_write(smd_channel, msg, hdr.size);
-	spin_unlock_irqrestore(&smd_lock, flags);
-	return 0;
-}
-
-static struct rr_server *rpcrouter_create_server(uint32_t pid,
-							uint32_t cid,
-							uint32_t prog,
-							uint32_t ver)
-{
-	struct rr_server *server;
-	unsigned long flags;
-	int rc;
-
-	server = kmalloc(sizeof(struct rr_server), GFP_KERNEL);
-	if (!server)
-		return ERR_PTR(-ENOMEM);
-
-	memset(server, 0, sizeof(struct rr_server));
-	server->pid = pid;
-	server->cid = cid;
-	server->prog = prog;
-	server->vers = ver;
-
-	spin_lock_irqsave(&server_list_lock, flags);
-	list_add_tail(&server->list, &server_list);
-	spin_unlock_irqrestore(&server_list_lock, flags);
-
-	if (pid == RPCROUTER_PID_REMOTE) {
-		rc = msm_rpcrouter_create_server_cdev(server);
-		if (rc < 0)
-			goto out_fail;
-	}
-	return server;
-out_fail:
-	spin_lock_irqsave(&server_list_lock, flags);
-	list_del(&server->list);
-	spin_unlock_irqrestore(&server_list_lock, flags);
-	kfree(server);
-	return ERR_PTR(rc);
-}
-
-static void rpcrouter_destroy_server(struct rr_server *server)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&server_list_lock, flags);
-	list_del(&server->list);
-	spin_unlock_irqrestore(&server_list_lock, flags);
-	device_destroy(msm_rpcrouter_class, server->device_number);
-	kfree(server);
-}
-
-static struct rr_server *rpcrouter_lookup_server(uint32_t prog, uint32_t ver)
-{
-	struct rr_server *server;
-	unsigned long flags;
-
-	spin_lock_irqsave(&server_list_lock, flags);
-	list_for_each_entry(server, &server_list, list) {
-		if (server->prog == prog
-		 && server->vers == ver) {
-			spin_unlock_irqrestore(&server_list_lock, flags);
-			return server;
-		}
-	}
-	spin_unlock_irqrestore(&server_list_lock, flags);
-	return NULL;
-}
-
-static struct rr_server *rpcrouter_lookup_server_by_dev(dev_t dev)
-{
-	struct rr_server *server;
-	unsigned long flags;
-
-	spin_lock_irqsave(&server_list_lock, flags);
-	list_for_each_entry(server, &server_list, list) {
-		if (server->device_number == dev) {
-			spin_unlock_irqrestore(&server_list_lock, flags);
-			return server;
-		}
-	}
-	spin_unlock_irqrestore(&server_list_lock, flags);
-	return NULL;
-}
-
-struct msm_rpc_endpoint *msm_rpcrouter_create_local_endpoint(dev_t dev)
-{
-	struct msm_rpc_endpoint *ept;
-	unsigned long flags;
-
-	ept = kmalloc(sizeof(struct msm_rpc_endpoint), GFP_KERNEL);
-	if (!ept)
-		return NULL;
-	memset(ept, 0, sizeof(struct msm_rpc_endpoint));
-
-	/* mark no reply outstanding */
-	ept->reply_pid = 0xffffffff;
-
-	ept->cid = (uint32_t) ept;
-	ept->pid = RPCROUTER_PID_LOCAL;
-	ept->dev = dev;
-
-	if ((dev != msm_rpcrouter_devno) && (dev != MKDEV(0, 0))) {
-		struct rr_server *srv;
-		/*
-		 * This is a userspace client which opened
-		 * a program/ver devicenode. Bind the client
-		 * to that destination
-		 */
-		srv = rpcrouter_lookup_server_by_dev(dev);
-		/* TODO: bug? really? */
-		BUG_ON(!srv);
-
-		ept->dst_pid = srv->pid;
-		ept->dst_cid = srv->cid;
-		ept->dst_prog = cpu_to_be32(srv->prog);
-		ept->dst_vers = cpu_to_be32(srv->vers);
-		ept->flags |= MSM_RPC_ENABLE_RECEIVE;
-
-		D("Creating local ept %p @ %08x:%08x\n", ept, srv->prog, srv->vers);
-	} else {
-		/* mark not connected */
-		ept->dst_pid = 0xffffffff;
-		D("Creating a master local ept %p\n", ept);
-	}
-
-	init_waitqueue_head(&ept->wait_q);
-	INIT_LIST_HEAD(&ept->read_q);
-	spin_lock_init(&ept->read_q_lock);
-	wake_lock_init(&ept->read_q_wake_lock, WAKE_LOCK_SUSPEND, "rpc_read");
-	INIT_LIST_HEAD(&ept->incomplete);
-
-	spin_lock_irqsave(&local_endpoints_lock, flags);
-	list_add_tail(&ept->list, &local_endpoints);
-	spin_unlock_irqrestore(&local_endpoints_lock, flags);
-	return ept;
-}
-
-int msm_rpcrouter_destroy_local_endpoint(struct msm_rpc_endpoint *ept)
-{
-	int rc;
-	union rr_control_msg msg;
-
-	msg.cmd = RPCROUTER_CTRL_CMD_REMOVE_CLIENT;
-	msg.cli.pid = ept->pid;
-	msg.cli.cid = ept->cid;
-
-	RR("x REMOVE_CLIENT id=%d:%08x\n", ept->pid, ept->cid);
-	rc = rpcrouter_send_control_msg(&msg);
-	if (rc < 0)
-		return rc;
-
-	wake_lock_destroy(&ept->read_q_wake_lock);
-	list_del(&ept->list);
-	kfree(ept);
-	return 0;
-}
-
-static int rpcrouter_create_remote_endpoint(uint32_t cid)
-{
-	struct rr_remote_endpoint *new_c;
-	unsigned long flags;
-
-	new_c = kmalloc(sizeof(struct rr_remote_endpoint), GFP_KERNEL);
-	if (!new_c)
-		return -ENOMEM;
-	memset(new_c, 0, sizeof(struct rr_remote_endpoint));
-
-	new_c->cid = cid;
-	new_c->pid = RPCROUTER_PID_REMOTE;
-	init_waitqueue_head(&new_c->quota_wait);
-	spin_lock_init(&new_c->quota_lock);
-
-	spin_lock_irqsave(&remote_endpoints_lock, flags);
-	list_add_tail(&new_c->list, &remote_endpoints);
-	spin_unlock_irqrestore(&remote_endpoints_lock, flags);
-	return 0;
-}
-
-static struct msm_rpc_endpoint *rpcrouter_lookup_local_endpoint(uint32_t cid)
-{
-	struct msm_rpc_endpoint *ept;
-	unsigned long flags;
-
-	spin_lock_irqsave(&local_endpoints_lock, flags);
-	list_for_each_entry(ept, &local_endpoints, list) {
-		if (ept->cid == cid) {
-			spin_unlock_irqrestore(&local_endpoints_lock, flags);
-			return ept;
-		}
-	}
-	spin_unlock_irqrestore(&local_endpoints_lock, flags);
-	return NULL;
-}
-
-static struct rr_remote_endpoint *rpcrouter_lookup_remote_endpoint(uint32_t cid)
-{
-	struct rr_remote_endpoint *ept;
-	unsigned long flags;
-
-	spin_lock_irqsave(&remote_endpoints_lock, flags);
-	list_for_each_entry(ept, &remote_endpoints, list) {
-		if (ept->cid == cid) {
-			spin_unlock_irqrestore(&remote_endpoints_lock, flags);
-			return ept;
-		}
-	}
-	spin_unlock_irqrestore(&remote_endpoints_lock, flags);
-	return NULL;
-}
-
-static int process_control_msg(union rr_control_msg *msg, int len)
-{
-	union rr_control_msg ctl;
-	struct rr_server *server;
-	struct rr_remote_endpoint *r_ept;
-	int rc = 0;
-	unsigned long flags;
-
-	if (len != sizeof(*msg)) {
-		printk(KERN_ERR "rpcrouter: r2r msg size %d != %d\n",
-		       len, sizeof(*msg));
-		return -EINVAL;
-	}
-
-	switch (msg->cmd) {
-	case RPCROUTER_CTRL_CMD_HELLO:
-		RR("o HELLO\n");
-
-		RR("x HELLO\n");
-		memset(&ctl, 0, sizeof(ctl));
-		ctl.cmd = RPCROUTER_CTRL_CMD_HELLO;
-		rpcrouter_send_control_msg(&ctl);
-
-		initialized = 1;
-
-		/* Send list of servers one at a time */
-		ctl.cmd = RPCROUTER_CTRL_CMD_NEW_SERVER;
-
-		/* TODO: long time to hold a spinlock... */
-		spin_lock_irqsave(&server_list_lock, flags);
-		list_for_each_entry(server, &server_list, list) {
-			ctl.srv.pid = server->pid;
-			ctl.srv.cid = server->cid;
-			ctl.srv.prog = server->prog;
-			ctl.srv.vers = server->vers;
-
-			RR("x NEW_SERVER id=%d:%08x prog=%08x:%08x\n",
-			   server->pid, server->cid,
-			   server->prog, server->vers);
-
-			rpcrouter_send_control_msg(&ctl);
-		}
-		spin_unlock_irqrestore(&server_list_lock, flags);
-
-		queue_work(rpcrouter_workqueue, &work_create_rpcrouter_pdev);
-		break;
-
-	case RPCROUTER_CTRL_CMD_RESUME_TX:
-		RR("o RESUME_TX id=%d:%08x\n", msg->cli.pid, msg->cli.cid);
-
-		r_ept = rpcrouter_lookup_remote_endpoint(msg->cli.cid);
-		if (!r_ept) {
-			printk(KERN_ERR
-			       "rpcrouter: Unable to resume client\n");
-			break;
-		}
-		spin_lock_irqsave(&r_ept->quota_lock, flags);
-		r_ept->tx_quota_cntr = 0;
-		spin_unlock_irqrestore(&r_ept->quota_lock, flags);
-		wake_up(&r_ept->quota_wait);
-		break;
-
-	case RPCROUTER_CTRL_CMD_NEW_SERVER:
-		RR("o NEW_SERVER id=%d:%08x prog=%08x:%08x\n",
-		   msg->srv.pid, msg->srv.cid, msg->srv.prog, msg->srv.vers);
-
-		server = rpcrouter_lookup_server(msg->srv.prog, msg->srv.vers);
-
-		if (!server) {
-			server = rpcrouter_create_server(
-				msg->srv.pid, msg->srv.cid,
-				msg->srv.prog, msg->srv.vers);
-			if (!server)
-				return -ENOMEM;
-			/*
-			 * XXX: Verify that its okay to add the
-			 * client to our remote client list
-			 * if we get a NEW_SERVER notification
-			 */
-			if (!rpcrouter_lookup_remote_endpoint(msg->srv.cid)) {
-				rc = rpcrouter_create_remote_endpoint(
-					msg->srv.cid);
-				if (rc < 0)
-					printk(KERN_ERR
-						"rpcrouter:Client create"
-						"error (%d)\n", rc);
-			}
-			schedule_work(&work_create_pdevs);
-			wake_up(&newserver_wait);
-		} else {
-			if ((server->pid == msg->srv.pid) &&
-			    (server->cid == msg->srv.cid)) {
-				printk(KERN_ERR "rpcrouter: Duplicate svr\n");
-			} else {
-				server->pid = msg->srv.pid;
-				server->cid = msg->srv.cid;
-			}
-		}
-		break;
-
-	case RPCROUTER_CTRL_CMD_REMOVE_SERVER:
-		RR("o REMOVE_SERVER prog=%08x:%d\n",
-		   msg->srv.prog, msg->srv.vers);
-		server = rpcrouter_lookup_server(msg->srv.prog, msg->srv.vers);
-		if (server)
-			rpcrouter_destroy_server(server);
-		break;
-
-	case RPCROUTER_CTRL_CMD_REMOVE_CLIENT:
-		RR("o REMOVE_CLIENT id=%d:%08x\n", msg->cli.pid, msg->cli.cid);
-		if (msg->cli.pid != RPCROUTER_PID_REMOTE) {
-			printk(KERN_ERR
-			       "rpcrouter: Denying remote removal of "
-			       "local client\n");
-			break;
-		}
-		r_ept = rpcrouter_lookup_remote_endpoint(msg->cli.cid);
-		if (r_ept) {
-			spin_lock_irqsave(&remote_endpoints_lock, flags);
-			list_del(&r_ept->list);
-			spin_unlock_irqrestore(&remote_endpoints_lock, flags);
-			kfree(r_ept);
-		}
-
-		/* Notify local clients of this event */
-		printk(KERN_ERR "rpcrouter: LOCAL NOTIFICATION NOT IMP\n");
-		rc = -ENOSYS;
-
-		break;
-	default:
-		RR("o UNKNOWN(%08x)\n", msg->cmd);
-		rc = -ENOSYS;
-	}
-
-	return rc;
-}
-
-static void do_create_rpcrouter_pdev(struct work_struct *work)
-{
-	platform_device_register(&rpcrouter_pdev);
-}
-
-static void do_create_pdevs(struct work_struct *work)
-{
-	unsigned long flags;
-	struct rr_server *server;
-
-	/* TODO: race if destroyed while being registered */
-	spin_lock_irqsave(&server_list_lock, flags);
-	list_for_each_entry(server, &server_list, list) {
-		if (server->pid == RPCROUTER_PID_REMOTE) {
-			if (server->pdev_name[0] == 0) {
-				spin_unlock_irqrestore(&server_list_lock,
-						       flags);
-				msm_rpcrouter_create_server_pdev(server);
-				schedule_work(&work_create_pdevs);
-				return;
-			}
-		}
-	}
-	spin_unlock_irqrestore(&server_list_lock, flags);
-}
-
-static void rpcrouter_smdnotify(void *_dev, unsigned event)
-{
-	if (event != SMD_EVENT_DATA)
-		return;
-
-	if (smd_read_avail(smd_channel) >= rpcrouter_need_len)
-		wake_lock(&rpcrouter_wake_lock);
-	wake_up(&smd_wait);
-}
-
-static void *rr_malloc(unsigned sz)
-{
-	void *ptr = kmalloc(sz, GFP_KERNEL);
-	if (ptr)
-		return ptr;
-
-	printk(KERN_ERR "rpcrouter: kmalloc of %d failed, retrying...\n", sz);
-	do {
-		ptr = kmalloc(sz, GFP_KERNEL);
-	} while (!ptr);
-
-	return ptr;
-}
-
-/* TODO: deal with channel teardown / restore */
-static int rr_read(void *data, int len)
-{
-	int rc;
-	unsigned long flags;
-//	printk("rr_read() %d\n", len);
-	for(;;) {
-		spin_lock_irqsave(&smd_lock, flags);
-		if (smd_read_avail(smd_channel) >= len) {
-			rc = smd_read(smd_channel, data, len);
-			spin_unlock_irqrestore(&smd_lock, flags);
-			if (rc == len)
-				return 0;
-			else
-				return -EIO;
-		}
-		rpcrouter_need_len = len;
-		wake_unlock(&rpcrouter_wake_lock);
-		spin_unlock_irqrestore(&smd_lock, flags);
-
-//		printk("rr_read: waiting (%d)\n", len);
-		smd_wait_count++;
-		wake_up(&smd_wait);
-		wait_event(smd_wait, smd_read_avail(smd_channel) >= len);
-		smd_wait_count++;
-	}
-	return 0;
-}
-
-static uint32_t r2r_buf[RPCROUTER_MSGSIZE_MAX];
-
-static void do_read_data(struct work_struct *work)
-{
-	struct rr_header hdr;
-	struct rr_packet *pkt;
-	struct rr_fragment *frag;
-	struct msm_rpc_endpoint *ept;
-	uint32_t pm, mid;
-	unsigned long flags;
-
-	if (rr_read(&hdr, sizeof(hdr)))
-		goto fail_io;
-
-#if TRACE_R2R_RAW
-	RR("- ver=%d type=%d src=%d:%08x crx=%d siz=%d dst=%d:%08x\n",
-	   hdr.version, hdr.type, hdr.src_pid, hdr.src_cid,
-	   hdr.confirm_rx, hdr.size, hdr.dst_pid, hdr.dst_cid);
-#endif
-
-	if (hdr.version != RPCROUTER_VERSION) {
-		DIAG("version %d != %d\n", hdr.version, RPCROUTER_VERSION);
-		goto fail_data;
-	}
-	if (hdr.size > RPCROUTER_MSGSIZE_MAX) {
-		DIAG("msg size %d > max %d\n", hdr.size, RPCROUTER_MSGSIZE_MAX);
-		goto fail_data;
-	}
-
-	if (hdr.dst_cid == RPCROUTER_ROUTER_ADDRESS) {
-		if (rr_read(r2r_buf, hdr.size))
-			goto fail_io;
-		process_control_msg((void*) r2r_buf, hdr.size);
-		goto done;
-	}
-
-	if (hdr.size < sizeof(pm)) {
-		DIAG("runt packet (no pacmark)\n");
-		goto fail_data;
-	}
-	if (rr_read(&pm, sizeof(pm)))
-		goto fail_io;
-
-	hdr.size -= sizeof(pm);
-
-	frag = rr_malloc(hdr.size + sizeof(*frag));
-	frag->next = NULL;
-	frag->length = hdr.size;
-	if (rr_read(frag->data, hdr.size))
-		goto fail_io;
-
-	ept = rpcrouter_lookup_local_endpoint(hdr.dst_cid);
-	if (!ept) {
-		DIAG("no local ept for cid %08x\n", hdr.dst_cid);
-		kfree(frag);
-		goto done;
-	}
-
-	/* See if there is already a partial packet that matches our mid
-	 * and if so, append this fragment to that packet.
-	 */
-	mid = PACMARK_MID(pm);
-	list_for_each_entry(pkt, &ept->incomplete, list) {
-		if (pkt->mid == mid) {
-			pkt->last->next = frag;
-			pkt->last = frag;
-			pkt->length += frag->length;
-			if (PACMARK_LAST(pm)) {
-				list_del(&pkt->list);
-				goto packet_complete;
-			}
-			goto done;
-		}
-	}
-	/* This mid is new -- create a packet for it, and put it on
-	 * the incomplete list if this fragment is not a last fragment,
-	 * otherwise put it on the read queue.
-	 */
-	pkt = rr_malloc(sizeof(struct rr_packet));
-	pkt->first = frag;
-	pkt->last = frag;
-	memcpy(&pkt->hdr, &hdr, sizeof(hdr));
-	pkt->mid = mid;
-	pkt->length = frag->length;
-	if (!PACMARK_LAST(pm)) {
-		list_add_tail(&pkt->list, &ept->incomplete);
-		goto done;
-	}
-
-packet_complete:
-	spin_lock_irqsave(&ept->read_q_lock, flags);
-	if (ept->flags & MSM_RPC_ENABLE_RECEIVE) {
-		wake_lock(&ept->read_q_wake_lock);
-		list_add_tail(&pkt->list, &ept->read_q);
-		wake_up(&ept->wait_q);
-	} else {
-		pr_warning("smd_rpcrouter: Unexpected incoming data on %08x:%08x\n",
-				be32_to_cpu(ept->dst_prog),
-				be32_to_cpu(ept->dst_vers));
-	}
-	spin_unlock_irqrestore(&ept->read_q_lock, flags);
-done:
-
-	if (hdr.confirm_rx) {
-		union rr_control_msg msg;
-
-		msg.cmd = RPCROUTER_CTRL_CMD_RESUME_TX;
-		msg.cli.pid = hdr.dst_pid;
-		msg.cli.cid = hdr.dst_cid;
-
-		RR("x RESUME_TX id=%d:%08x\n", msg.cli.pid, msg.cli.cid);
-		rpcrouter_send_control_msg(&msg);
-	}
-
-	queue_work(rpcrouter_workqueue, &work_read_data);
-	return;
-
-fail_io:
-fail_data:
-	printk(KERN_ERR "rpc_router has died\n");
-	wake_unlock(&rpcrouter_wake_lock);
-}
-
-void msm_rpc_setup_req(struct rpc_request_hdr *hdr, uint32_t prog,
-		       uint32_t vers, uint32_t proc)
-{
-	memset(hdr, 0, sizeof(struct rpc_request_hdr));
-	hdr->xid = cpu_to_be32(atomic_add_return(1, &next_xid));
-	hdr->rpc_vers = cpu_to_be32(2);
-	hdr->prog = cpu_to_be32(prog);
-	hdr->vers = cpu_to_be32(vers);
-	hdr->procedure = cpu_to_be32(proc);
-}
-
-struct msm_rpc_endpoint *msm_rpc_open(void)
-{
-	struct msm_rpc_endpoint *ept;
-
-	ept = msm_rpcrouter_create_local_endpoint(MKDEV(0, 0));
-	if (ept == NULL)
-		return ERR_PTR(-ENOMEM);
-
-	return ept;
-}
-
-int msm_rpc_close(struct msm_rpc_endpoint *ept)
-{
-	return msm_rpcrouter_destroy_local_endpoint(ept);
-}
-EXPORT_SYMBOL(msm_rpc_close);
-
-int msm_rpc_write(struct msm_rpc_endpoint *ept, void *buffer, int count)
-{
-	struct rr_header hdr;
-	uint32_t pacmark;
-	struct rpc_request_hdr *rq = buffer;
-	struct rr_remote_endpoint *r_ept;
-	unsigned long flags;
-	int needed;
-	DEFINE_WAIT(__wait);
-
-	/* TODO: fragmentation for large outbound packets */
-	if (count > (RPCROUTER_MSGSIZE_MAX - sizeof(uint32_t)) || !count)
-		return -EINVAL;
-
-	/* snoop the RPC packet and enforce permissions */
-
-	/* has to have at least the xid and type fields */
-	if (count < (sizeof(uint32_t) * 2)) {
-		printk(KERN_ERR "rr_write: rejecting runt packet\n");
-		return -EINVAL;
-	}
-
-	if (rq->type == 0) {
-		/* RPC CALL */
-		if (count < (sizeof(uint32_t) * 6)) {
-			printk(KERN_ERR
-			       "rr_write: rejecting runt call packet\n");
-			return -EINVAL;
-		}
-		if (ept->dst_pid == 0xffffffff) {
-			printk(KERN_ERR "rr_write: not connected\n");
-			return -ENOTCONN;
-		}
-
-#if CONFIG_MSM_AMSS_VERSION >= 6350
-		if ((ept->dst_prog != rq->prog) ||
-			!msm_rpc_is_compatible_version(
-					be32_to_cpu(ept->dst_vers),
-					be32_to_cpu(rq->vers))) {
-#else
-		if (ept->dst_prog != rq->prog || ept->dst_vers != rq->vers) {
-#endif
-			printk(KERN_ERR
-			       "rr_write: cannot write to %08x:%d "
-			       "(bound to %08x:%d)\n",
-			       be32_to_cpu(rq->prog), be32_to_cpu(rq->vers),
-			       be32_to_cpu(ept->dst_prog),
-			       be32_to_cpu(ept->dst_vers));
-			return -EINVAL;
-		}
-		hdr.dst_pid = ept->dst_pid;
-		hdr.dst_cid = ept->dst_cid;
-		IO("CALL on ept %p to %08x:%08x @ %d:%08x (%d bytes) (xid %x proc %x)\n",
-		   ept,
-		   be32_to_cpu(rq->prog), be32_to_cpu(rq->vers),
-		   ept->dst_pid, ept->dst_cid, count,
-		   be32_to_cpu(rq->xid), be32_to_cpu(rq->procedure));
-	} else {
-		/* RPC REPLY */
-		/* TODO: locking */
-		if (ept->reply_pid == 0xffffffff) {
-			printk(KERN_ERR
-			       "rr_write: rejecting unexpected reply\n");
-			return -EINVAL;
-		}
-		if (ept->reply_xid != rq->xid) {
-			printk(KERN_ERR
-			       "rr_write: rejecting packet w/ bad xid\n");
-			return -EINVAL;
-		}
-
-		hdr.dst_pid = ept->reply_pid;
-		hdr.dst_cid = ept->reply_cid;
-
-		/* consume this reply */
-		ept->reply_pid = 0xffffffff;
-
-		IO("REPLY on ept %p to xid=%d @ %d:%08x (%d bytes)\n",
-		   ept,
-		   be32_to_cpu(rq->xid), hdr.dst_pid, hdr.dst_cid, count);
-	}
-
-	r_ept = rpcrouter_lookup_remote_endpoint(hdr.dst_cid);
-
-	if (!r_ept) {
-		printk(KERN_ERR
-			"msm_rpc_write(): No route to ept "
-			"[PID %x CID %x]\n", hdr.dst_pid, hdr.dst_cid);
-		return -EHOSTUNREACH;
-	}
-
-	/* Create routing header */
-	hdr.type = RPCROUTER_CTRL_CMD_DATA;
-	hdr.version = RPCROUTER_VERSION;
-	hdr.src_pid = ept->pid;
-	hdr.src_cid = ept->cid;
-	hdr.confirm_rx = 0;
-	hdr.size = count + sizeof(uint32_t);
-
-	for (;;) {
-		prepare_to_wait(&r_ept->quota_wait, &__wait,
-				TASK_INTERRUPTIBLE);
-		spin_lock_irqsave(&r_ept->quota_lock, flags);
-		if (r_ept->tx_quota_cntr < RPCROUTER_DEFAULT_RX_QUOTA)
-			break;
-		if (signal_pending(current) && 
-		    (!(ept->flags & MSM_RPC_UNINTERRUPTIBLE)))
-			break;
-		spin_unlock_irqrestore(&r_ept->quota_lock, flags);
-		schedule();
-	}
-	finish_wait(&r_ept->quota_wait, &__wait);
-
-	if (signal_pending(current) &&
-	    (!(ept->flags & MSM_RPC_UNINTERRUPTIBLE))) {
-		spin_unlock_irqrestore(&r_ept->quota_lock, flags);
-		return -ERESTARTSYS;
-	}
-	r_ept->tx_quota_cntr++;
-	if (r_ept->tx_quota_cntr == RPCROUTER_DEFAULT_RX_QUOTA)
-		hdr.confirm_rx = 1;
-
-	/* bump pacmark while interrupts disabled to avoid race
-	 * probably should be atomic op instead
-	 */
-	pacmark = PACMARK(count, ++next_pacmarkid, 0, 1);
-
-	spin_unlock_irqrestore(&r_ept->quota_lock, flags);
-
-	spin_lock_irqsave(&smd_lock, flags);
-
-	needed = sizeof(hdr) + hdr.size;
-	while (smd_write_avail(smd_channel) < needed) {
-		spin_unlock_irqrestore(&smd_lock, flags);
-		msleep(250);
-		spin_lock_irqsave(&smd_lock, flags);
-	}
-
-	/* TODO: deal with full fifo */
-	smd_write(smd_channel, &hdr, sizeof(hdr));
-	smd_write(smd_channel, &pacmark, sizeof(pacmark));
-	smd_write(smd_channel, buffer, count);
-
-	spin_unlock_irqrestore(&smd_lock, flags);
-
-	return count;
-}
-EXPORT_SYMBOL(msm_rpc_write);
-
-/*
- * NOTE: It is the responsibility of the caller to kfree buffer
- */
-int msm_rpc_read(struct msm_rpc_endpoint *ept, void **buffer,
-		 unsigned user_len, long timeout)
-{
-	struct rr_fragment *frag, *next;
-	char *buf;
-	int rc;
-
-	rc = __msm_rpc_read(ept, &frag, user_len, timeout);
-	if (rc <= 0)
-		return rc;
-
-	/* single-fragment messages conveniently can be
-	 * returned as-is (the buffer is at the front)
-	 */
-	if (frag->next == 0) {
-		*buffer = (void*) frag;
-		return rc;
-	}
-
-	/* multi-fragment messages, we have to do it the
-	 * hard way, which is rather disgusting right now
-	 */
-	buf = rr_malloc(rc);
-	*buffer = buf;
-
-	while (frag != NULL) {
-		memcpy(buf, frag->data, frag->length);
-		next = frag->next;
-		buf += frag->length;
-		kfree(frag);
-		frag = next;
-	}
-
-	return rc;
-}
-
-int msm_rpc_call(struct msm_rpc_endpoint *ept, uint32_t proc,
-		 void *_request, int request_size,
-		 long timeout)
-{
-	return msm_rpc_call_reply(ept, proc,
-				  _request, request_size,
-				  NULL, 0, timeout);
-}
-EXPORT_SYMBOL(msm_rpc_call);
-
-int msm_rpc_call_reply(struct msm_rpc_endpoint *ept, uint32_t proc,
-		       void *_request, int request_size,
-		       void *_reply, int reply_size,
-		       long timeout)
-{
-	struct rpc_request_hdr *req = _request;
-	struct rpc_reply_hdr *reply;
-	int rc;
-
-	if (request_size < sizeof(*req))
-		return -ETOOSMALL;
-
-	if (ept->dst_pid == 0xffffffff)
-		return -ENOTCONN;
-
-	/* We can't use msm_rpc_setup_req() here, because dst_prog and
-	 * dst_vers here are already in BE.
-	 */
-	memset(req, 0, sizeof(*req));
-	req->xid = cpu_to_be32(atomic_add_return(1, &next_xid));
-	req->rpc_vers = cpu_to_be32(2);
-	req->prog = ept->dst_prog;
-	req->vers = ept->dst_vers;
-	req->procedure = cpu_to_be32(proc);
-
-	/* Allow replys to be added to the queue */
-	ept->flags |= MSM_RPC_ENABLE_RECEIVE;
-
-	rc = msm_rpc_write(ept, req, request_size);
-	if (rc < 0)
-		goto error;
-
-	for (;;) {
-		rc = msm_rpc_read(ept, (void*) &reply, -1, timeout);
-		if (rc < 0)
-			goto error;
-		if (rc < (3 * sizeof(uint32_t))) {
-			rc = -EIO;
-			break;
-		}
-		/* we should not get CALL packets -- ignore them */
-		if (reply->type == 0) {
-			kfree(reply);
-			continue;
-		}
-		/* If an earlier call timed out, we could get the (no
-		 * longer wanted) reply for it.  Ignore replies that
-		 * we don't expect.
-		 */
-		if (reply->xid != req->xid) {
-			kfree(reply);
-			continue;
-		}
-		if (reply->reply_stat != 0) {
-			rc = -EPERM;
-			break;
-		}
-		if (reply->data.acc_hdr.accept_stat != 0) {
-			rc = -EINVAL;
-			break;
-		}
-		if (_reply == NULL) {
-			rc = 0;
-			break;
-		}
-		if (rc > reply_size) {
-			rc = -ENOMEM;
-		} else {
-			memcpy(_reply, reply, rc);
-		}
-		break;
-	}
-	kfree(reply);
-error:
-	ept->flags &= ~MSM_RPC_ENABLE_RECEIVE;
-	wake_unlock(&ept->read_q_wake_lock);
-
-	return rc;
-}
-EXPORT_SYMBOL(msm_rpc_call_reply);
-
-
-static inline int ept_packet_available(struct msm_rpc_endpoint *ept)
-{
-	unsigned long flags;
-	int ret;
-	spin_lock_irqsave(&ept->read_q_lock, flags);
-	ret = !list_empty(&ept->read_q);
-	spin_unlock_irqrestore(&ept->read_q_lock, flags);
-	return ret;
-}
-
-int __msm_rpc_read(struct msm_rpc_endpoint *ept,
-		   struct rr_fragment **frag_ret,
-		   unsigned len, long timeout)
-{
-	struct rr_packet *pkt;
-	struct rpc_request_hdr *rq;
-	DEFINE_WAIT(__wait);
-	unsigned long flags;
-	int rc;
-
-	IO("READ on ept %p\n", ept);
-
-	if (ept->flags & MSM_RPC_UNINTERRUPTIBLE) {
-		if (timeout < 0) {
-			wait_event(ept->wait_q, ept_packet_available(ept));
-		} else {
-			rc = wait_event_timeout(
-				ept->wait_q, ept_packet_available(ept),
-				timeout);
-			if (rc == 0)
-				return -ETIMEDOUT;
-		}
-	} else {
-		if (timeout < 0) {
-			rc = wait_event_interruptible(
-				ept->wait_q, ept_packet_available(ept));
-			if (rc < 0)
-				return rc;
-		} else {
-			rc = wait_event_interruptible_timeout(
-				ept->wait_q, ept_packet_available(ept),
-				timeout);
-			if (rc == 0)
-				return -ETIMEDOUT;
-		}
-	}
-
-	spin_lock_irqsave(&ept->read_q_lock, flags);
-	if (list_empty(&ept->read_q)) {
-		spin_unlock_irqrestore(&ept->read_q_lock, flags);
-		return -EAGAIN;
-	}
-	pkt = list_first_entry(&ept->read_q, struct rr_packet, list);
-	if (pkt->length > len) {
-		spin_unlock_irqrestore(&ept->read_q_lock, flags);
-		return -ETOOSMALL;
-	}
-	list_del(&pkt->list);
-	if (list_empty(&ept->read_q))
-		wake_unlock(&ept->read_q_wake_lock);
-	spin_unlock_irqrestore(&ept->read_q_lock, flags);
-
-	rc = pkt->length;
-
-	*frag_ret = pkt->first;
-	rq = (void*) pkt->first->data;
-	if ((rc >= (sizeof(uint32_t) * 3)) && (rq->type == 0)) {
-		IO("READ on ept %p is a CALL on %08x:%08x proc %d xid %d\n",
-			ept, be32_to_cpu(rq->prog), be32_to_cpu(rq->vers),
-			be32_to_cpu(rq->procedure),
-			be32_to_cpu(rq->xid));
-		/* RPC CALL */
-		if (ept->reply_pid != 0xffffffff) {
-			printk(KERN_WARNING
-			       "rr_read: lost previous reply xid...\n");
-		}
-		/* TODO: locking? */
-		ept->reply_pid = pkt->hdr.src_pid;
-		ept->reply_cid = pkt->hdr.src_cid;
-		ept->reply_xid = rq->xid;
-	}
-#if TRACE_RPC_MSG
-	else if ((rc >= (sizeof(uint32_t) * 3)) && (rq->type == 1))
-		IO("READ on ept %p is a REPLY\n", ept);
-	else IO("READ on ept %p (%d bytes)\n", ept, rc);
-#endif
-
-	kfree(pkt);
-	return rc;
-}
-
-#if CONFIG_MSM_AMSS_VERSION >= 6350
-int msm_rpc_is_compatible_version(uint32_t server_version,
-				  uint32_t client_version)
-{
-	if ((server_version & RPC_VERSION_MODE_MASK) !=
-	    (client_version & RPC_VERSION_MODE_MASK))
-		return 0;
-
-	if (server_version & RPC_VERSION_MODE_MASK)
-		return server_version == client_version;
-
-	return ((server_version & RPC_VERSION_MAJOR_MASK) ==
-		(client_version & RPC_VERSION_MAJOR_MASK)) &&
-		((server_version & RPC_VERSION_MINOR_MASK) >=
-		(client_version & RPC_VERSION_MINOR_MASK));
-}
-EXPORT_SYMBOL(msm_rpc_is_compatible_version);
-
-static int msm_rpc_get_compatible_server(uint32_t prog,
-					uint32_t ver,
-					uint32_t *found_vers)
-{
-	struct rr_server *server;
-	unsigned long     flags;
-	if (found_vers == NULL)
-		return 0;
-
-	spin_lock_irqsave(&server_list_lock, flags);
-	list_for_each_entry(server, &server_list, list) {
-		if ((server->prog == prog) &&
-		    msm_rpc_is_compatible_version(server->vers, ver)) {
-			*found_vers = server->vers;
-			spin_unlock_irqrestore(&server_list_lock, flags);
-			return 0;
-		}
-	}
-	spin_unlock_irqrestore(&server_list_lock, flags);
-	return -1;
-}
-#endif
-
-struct msm_rpc_endpoint *msm_rpc_connect(uint32_t prog, uint32_t vers, unsigned flags)
-{
-	struct msm_rpc_endpoint *ept;
-	struct rr_server *server;
-
-#if CONFIG_MSM_AMSS_VERSION >= 6350
-	if (!(vers & RPC_VERSION_MODE_MASK)) {
-		uint32_t found_vers;
-		if (msm_rpc_get_compatible_server(prog, vers, &found_vers) < 0)
-			return ERR_PTR(-EHOSTUNREACH);
-		if (found_vers != vers) {
-			D("RPC using new version %08x:{%08x --> %08x}\n",
-			 	prog, vers, found_vers);
-			vers = found_vers;
-		}
-	}
-#endif
-
-	server = rpcrouter_lookup_server(prog, vers);
-	if (!server)
-		return ERR_PTR(-EHOSTUNREACH);
-
-	ept = msm_rpc_open();
-	if (IS_ERR(ept))
-		return ept;
-
-	ept->flags = flags;
-	ept->dst_pid = server->pid;
-	ept->dst_cid = server->cid;
-	ept->dst_prog = cpu_to_be32(prog);
-	ept->dst_vers = cpu_to_be32(vers);
-
-	return ept;
-}
-EXPORT_SYMBOL(msm_rpc_connect);
-
-uint32_t msm_rpc_get_vers(struct msm_rpc_endpoint *ept)
-{
-	return be32_to_cpu(ept->dst_vers);
-}
-EXPORT_SYMBOL(msm_rpc_get_vers);
-
-/* TODO: permission check? */
-int msm_rpc_register_server(struct msm_rpc_endpoint *ept,
-			    uint32_t prog, uint32_t vers)
-{
-	int rc;
-	union rr_control_msg msg;
-	struct rr_server *server;
-
-	server = rpcrouter_create_server(ept->pid, ept->cid,
-					 prog, vers);
-	if (!server)
-		return -ENODEV;
-
-	msg.srv.cmd = RPCROUTER_CTRL_CMD_NEW_SERVER;
-	msg.srv.pid = ept->pid;
-	msg.srv.cid = ept->cid;
-	msg.srv.prog = prog;
-	msg.srv.vers = vers;
-
-	RR("x NEW_SERVER id=%d:%08x prog=%08x:%08x\n",
-	   ept->pid, ept->cid, prog, vers);
-
-	rc = rpcrouter_send_control_msg(&msg);
-	if (rc < 0)
-		return rc;
-
-	ept->flags |= MSM_RPC_ENABLE_RECEIVE;
-	return 0;
-}
-
-/* TODO: permission check -- disallow unreg of somebody else's server */
-int msm_rpc_unregister_server(struct msm_rpc_endpoint *ept,
-			      uint32_t prog, uint32_t vers)
-{
-	struct rr_server *server;
-	server = rpcrouter_lookup_server(prog, vers);
-
-	if (!server)
-		return -ENOENT;
-
-	ept->flags &= ~MSM_RPC_ENABLE_RECEIVE;
-	wake_unlock(&ept->read_q_wake_lock);
-	rpcrouter_destroy_server(server);
-	return 0;
-}
-
-static int msm_rpcrouter_probe(struct platform_device *pdev)
-{
-	int rc;
-
-	/* Initialize what we need to start processing */
-	INIT_LIST_HEAD(&local_endpoints);
-	INIT_LIST_HEAD(&remote_endpoints);
-
-	init_waitqueue_head(&newserver_wait);
-	init_waitqueue_head(&smd_wait);
-	wake_lock_init(&rpcrouter_wake_lock, WAKE_LOCK_SUSPEND, "SMD_RPCCALL");
-
-	rpcrouter_workqueue = create_singlethread_workqueue("rpcrouter");
-	if (!rpcrouter_workqueue)
-		return -ENOMEM;
-
-	rc = msm_rpcrouter_init_devices();
-	if (rc < 0)
-		goto fail_destroy_workqueue;
-
-	/* Open up SMD channel 2 */
-	initialized = 0;
-	rc = smd_open("SMD_RPCCALL", &smd_channel, NULL, rpcrouter_smdnotify);
-	if (rc < 0)
-		goto fail_remove_devices;
-
-	queue_work(rpcrouter_workqueue, &work_read_data);
-	return 0;
-
- fail_remove_devices:
-	msm_rpcrouter_exit_devices();
- fail_destroy_workqueue:
-	destroy_workqueue(rpcrouter_workqueue);
-	return rc;
-}
-
-static int msm_rpcrouter_suspend(struct platform_device *pdev,
-					pm_message_t state)
-{
-	/* Wait until the worker thread has waited at least once so that it
-	 * gets a chance to release its wakelock.
-	 */
-	int wait_count = smd_wait_count;
-	if (!(smd_wait_count & 1))
-		wait_event(smd_wait, smd_wait_count != wait_count);
-	return 0;
-}
-
-static struct platform_driver msm_smd_channel2_driver = {
-	.probe		= msm_rpcrouter_probe,
-	.driver		= {
-			.name	= "SMD_RPCCALL",
-			.owner	= THIS_MODULE,
-	},
-	.suspend	= msm_rpcrouter_suspend,
-};
-
-static int __init rpcrouter_init(void)
-{
-	return platform_driver_register(&msm_smd_channel2_driver);
-}
-
-module_init(rpcrouter_init);
-MODULE_DESCRIPTION("MSM RPC Router");
-MODULE_AUTHOR("San Mehat <san@android.com>");
-MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-msm/smd_rpcrouter.h b/arch/arm/mach-msm/smd_rpcrouter.h
deleted file mode 100644
index a7416a2..0000000
--- a/arch/arm/mach-msm/smd_rpcrouter.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/** arch/arm/mach-msm/smd_rpcrouter.h
- *
- * Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2007-2008 QUALCOMM Incorporated.
- * Author: San Mehat <san@android.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-
-#ifndef _ARCH_ARM_MACH_MSM_SMD_RPCROUTER_H
-#define _ARCH_ARM_MACH_MSM_SMD_RPCROUTER_H
-
-#include <linux/types.h>
-#include <linux/list.h>
-#include <linux/cdev.h>
-#include <linux/platform_device.h>
-#include <linux/wakelock.h>
-
-#include <mach/msm_smd.h>
-#include <mach/msm_rpcrouter.h>
-
-/* definitions for the R2R wire protcol */
-
-#define RPCROUTER_VERSION			1
-#define RPCROUTER_PROCESSORS_MAX		4
-#define RPCROUTER_MSGSIZE_MAX			512
-
-#define RPCROUTER_CLIENT_BCAST_ID		0xffffffff
-#define RPCROUTER_ROUTER_ADDRESS		0xfffffffe
-
-#define RPCROUTER_PID_LOCAL			1
-#define RPCROUTER_PID_REMOTE			0
-
-#define RPCROUTER_CTRL_CMD_DATA			1
-#define RPCROUTER_CTRL_CMD_HELLO		2
-#define RPCROUTER_CTRL_CMD_BYE			3
-#define RPCROUTER_CTRL_CMD_NEW_SERVER		4
-#define RPCROUTER_CTRL_CMD_REMOVE_SERVER	5
-#define RPCROUTER_CTRL_CMD_REMOVE_CLIENT	6
-#define RPCROUTER_CTRL_CMD_RESUME_TX		7
-#define RPCROUTER_CTRL_CMD_EXIT			8
-
-#define RPCROUTER_DEFAULT_RX_QUOTA	5
-
-union rr_control_msg {
-	uint32_t cmd;
-	struct {
-		uint32_t cmd;
-		uint32_t prog;
-		uint32_t vers;
-		uint32_t pid;
-		uint32_t cid;
-	} srv;
-	struct {
-		uint32_t cmd;
-		uint32_t pid;
-		uint32_t cid;
-	} cli;
-};
-
-struct rr_header {
-	uint32_t version;
-	uint32_t type;
-	uint32_t src_pid;
-	uint32_t src_cid;
-	uint32_t confirm_rx;
-	uint32_t size;
-	uint32_t dst_pid;
-	uint32_t dst_cid;
-};
-
-/* internals */
-
-#define RPCROUTER_MAX_REMOTE_SERVERS		100
-
-struct rr_fragment {
-	unsigned char data[RPCROUTER_MSGSIZE_MAX];
-	uint32_t length;
-	struct rr_fragment *next;
-};
-
-struct rr_packet {
-	struct list_head list;
-	struct rr_fragment *first;
-	struct rr_fragment *last;
-	struct rr_header hdr;
-	uint32_t mid;
-	uint32_t length;
-};
-
-#define PACMARK_LAST(n) ((n) & 0x80000000)
-#define PACMARK_MID(n)  (((n) >> 16) & 0xFF)
-#define PACMARK_LEN(n)  ((n) & 0xFFFF)
-
-static inline uint32_t PACMARK(uint32_t len, uint32_t mid, uint32_t first,
-			       uint32_t last)
-{
-	return (len & 0xFFFF) |
-	  ((mid & 0xFF) << 16) |
-	  ((!!first) << 30) |
-	  ((!!last) << 31);
-}
-
-struct rr_server {
-	struct list_head list;
-
-	uint32_t pid;
-	uint32_t cid;
-	uint32_t prog;
-	uint32_t vers;
-
-	dev_t device_number;
-	struct cdev cdev;
-	struct device *device;
-	struct rpcsvr_platform_device p_device;
-	char pdev_name[32];
-};
-
-struct rr_remote_endpoint {
-	uint32_t pid;
-	uint32_t cid;
-
-	int tx_quota_cntr;
-	spinlock_t quota_lock;
-	wait_queue_head_t quota_wait;
-
-	struct list_head list;
-};
-
-struct msm_rpc_endpoint {
-	struct list_head list;
-
-	/* incomplete packets waiting for assembly */
-	struct list_head incomplete;
-
-	/* complete packets waiting to be read */
-	struct list_head read_q;
-	spinlock_t read_q_lock;
-	struct wake_lock read_q_wake_lock;
-	wait_queue_head_t wait_q;
-	unsigned flags;
-
-	/* endpoint address */
-	uint32_t pid;
-	uint32_t cid;
-
-	/* bound remote address
-	 * if not connected (dst_pid == 0xffffffff) RPC_CALL writes fail
-	 * RPC_CALLs must be to the prog/vers below or they will fail
-	 */
-	uint32_t dst_pid;
-	uint32_t dst_cid;
-	uint32_t dst_prog; /* be32 */
-	uint32_t dst_vers; /* be32 */
-
-	/* reply remote address
-	 * if reply_pid == 0xffffffff, none available
-	 * RPC_REPLY writes may only go to the pid/cid/xid of the
-	 * last RPC_CALL we received.
-	 */
-	uint32_t reply_pid;
-	uint32_t reply_cid;
-	uint32_t reply_xid; /* be32 */
-	uint32_t next_pm;   /* Pacmark sequence */
-
-	/* device node if this endpoint is accessed via userspace */
-	dev_t dev;
-};
-
-/* shared between smd_rpcrouter*.c */
-
-int __msm_rpc_read(struct msm_rpc_endpoint *ept,
-		   struct rr_fragment **frag,
-		   unsigned len, long timeout);
-
-struct msm_rpc_endpoint *msm_rpcrouter_create_local_endpoint(dev_t dev);
-int msm_rpcrouter_destroy_local_endpoint(struct msm_rpc_endpoint *ept);
-
-int msm_rpcrouter_create_server_cdev(struct rr_server *server);
-int msm_rpcrouter_create_server_pdev(struct rr_server *server);
-
-int msm_rpcrouter_init_devices(void);
-void msm_rpcrouter_exit_devices(void);
-
-extern dev_t msm_rpcrouter_devno;
-extern struct class *msm_rpcrouter_class;
-#endif
diff --git a/arch/arm/mach-msm/smd_rpcrouter_device.c b/arch/arm/mach-msm/smd_rpcrouter_device.c
deleted file mode 100644
index 9156da1..0000000
--- a/arch/arm/mach-msm/smd_rpcrouter_device.c
+++ /dev/null
@@ -1,376 +0,0 @@
-/* arch/arm/mach-msm/smd_rpcrouter_device.c
- *
- * Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2007-2009 QUALCOMM Incorporated.
- * Author: San Mehat <san@android.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <linux/cdev.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/types.h>
-#include <linux/delay.h>
-#include <linux/fs.h>
-#include <linux/err.h>
-#include <linux/sched.h>
-#include <linux/poll.h>
-#include <linux/platform_device.h>
-#include <linux/msm_rpcrouter.h>
-
-#include <asm/uaccess.h>
-#include <asm/byteorder.h>
-
-#include "smd_rpcrouter.h"
-
-#define SAFETY_MEM_SIZE 65536
-
-/* Next minor # available for a remote server */
-static int next_minor = 1;
-
-struct class *msm_rpcrouter_class;
-dev_t msm_rpcrouter_devno;
-
-static struct cdev rpcrouter_cdev;
-static struct device *rpcrouter_device;
-
-static int rpcrouter_open(struct inode *inode, struct file *filp)
-{
-	int rc;
-	struct msm_rpc_endpoint *ept;
-
-	rc = nonseekable_open(inode, filp);
-	if (rc < 0)
-		return rc;
-
-	ept = msm_rpcrouter_create_local_endpoint(inode->i_rdev);
-	if (!ept)
-		return -ENOMEM;
-
-	filp->private_data = ept;
-	return 0;
-}
-
-static int rpcrouter_release(struct inode *inode, struct file *filp)
-{
-	struct msm_rpc_endpoint *ept;
-	ept = (struct msm_rpc_endpoint *) filp->private_data;
-
-	return msm_rpcrouter_destroy_local_endpoint(ept);
-}
-
-static ssize_t rpcrouter_read(struct file *filp, char __user *buf,
-			      size_t count, loff_t *ppos)
-{
-	struct msm_rpc_endpoint *ept;
-	struct rr_fragment *frag, *next;
-	int rc;
-
-	ept = (struct msm_rpc_endpoint *) filp->private_data;
-
-	rc = __msm_rpc_read(ept, &frag, count, -1);
-	if (rc < 0)
-		return rc;
-
-	count = rc;
-
-	while (frag != NULL) {		
-		if (copy_to_user(buf, frag->data, frag->length)) {
-			printk(KERN_ERR
-			       "rpcrouter: could not copy all read data to user!\n");
-			rc = -EFAULT;
-		}
-		buf += frag->length;
-		next = frag->next;
-		kfree(frag);
-		frag = next;
-	}
-
-	return rc;
-}
-
-static ssize_t rpcrouter_write(struct file *filp, const char __user *buf,
-				size_t count, loff_t *ppos)
-{
-	struct msm_rpc_endpoint	*ept;
-	int rc = 0;
-	void *k_buffer;
-
-	ept = (struct msm_rpc_endpoint *) filp->private_data;
-
-	/* A check for safety, this seems non-standard */
-	if (count > SAFETY_MEM_SIZE)
-		return -EINVAL;
-
-	k_buffer = kmalloc(count, GFP_KERNEL);
-	if (!k_buffer)
-		return -ENOMEM;
-
-	if (copy_from_user(k_buffer, buf, count)) {
-		rc = -EFAULT;
-		goto write_out_free;
-	}
-
-	rc = msm_rpc_write(ept, k_buffer, count);
-	if (rc < 0)
-		goto write_out_free;
-
-	rc = count;
-write_out_free:
-	kfree(k_buffer);
-	return rc;
-}
-
-static unsigned int rpcrouter_poll(struct file *filp,
-				   struct poll_table_struct *wait)
-{
-	struct msm_rpc_endpoint *ept;
-	unsigned mask = 0;
-	ept = (struct msm_rpc_endpoint *) filp->private_data;
-
-	/* If there's data already in the read queue, return POLLIN.
-	 * Else, wait for the requested amount of time, and check again.
-	 */
-
-	if (!list_empty(&ept->read_q))
-		mask |= POLLIN;
-
-	if (!mask) {
-		poll_wait(filp, &ept->wait_q, wait);
-		if (!list_empty(&ept->read_q))
-			mask |= POLLIN;
-	}
-
-	return mask;
-}
-
-static long rpcrouter_ioctl(struct file *filp, unsigned int cmd,
-			    unsigned long arg)
-{
-	struct msm_rpc_endpoint *ept;
-	struct rpcrouter_ioctl_server_args server_args;
-	int rc = 0;
-	uint32_t n;
-
-	ept = (struct msm_rpc_endpoint *) filp->private_data;
-	switch (cmd) {
-
-	case RPC_ROUTER_IOCTL_GET_VERSION:
-		n = RPC_ROUTER_VERSION_V1;
-		rc = put_user(n, (unsigned int *) arg);
-		break;
-
-	case RPC_ROUTER_IOCTL_GET_MTU:
-		/* the pacmark word reduces the actual payload
-		 * possible per message
-		 */
-		n = RPCROUTER_MSGSIZE_MAX - sizeof(uint32_t);
-		rc = put_user(n, (unsigned int *) arg);
-		break;
-
-	case RPC_ROUTER_IOCTL_REGISTER_SERVER:
-		rc = copy_from_user(&server_args, (void *) arg,
-				    sizeof(server_args));
-		if (rc < 0)
-			break;
-		msm_rpc_register_server(ept,
-					server_args.prog,
-					server_args.vers);
-		break;
-
-	case RPC_ROUTER_IOCTL_UNREGISTER_SERVER:
-		rc = copy_from_user(&server_args, (void *) arg,
-				    sizeof(server_args));
-		if (rc < 0)
-			break;
-
-		msm_rpc_unregister_server(ept,
-					  server_args.prog,
-					  server_args.vers);
-		break;
-
-	case RPC_ROUTER_IOCTL_GET_MINOR_VERSION:
-		n = MSM_RPC_GET_MINOR(msm_rpc_get_vers(ept));
-		rc = put_user(n, (unsigned int *)arg);
-		break;
-
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	return rc;
-}
-
-static struct file_operations rpcrouter_server_fops = {
-	.owner	 = THIS_MODULE,
-	.open	 = rpcrouter_open,
-	.release = rpcrouter_release,
-	.read	 = rpcrouter_read,
-	.write	 = rpcrouter_write,
-	.poll    = rpcrouter_poll,
-	.unlocked_ioctl	 = rpcrouter_ioctl,
-};
-
-static struct file_operations rpcrouter_router_fops = {
-	.owner	 = THIS_MODULE,
-	.open	 = rpcrouter_open,
-	.release = rpcrouter_release,
-	.read	 = rpcrouter_read,
-	.write	 = rpcrouter_write,
-	.poll    = rpcrouter_poll,
-	.unlocked_ioctl = rpcrouter_ioctl,
-};
-
-int msm_rpcrouter_create_server_cdev(struct rr_server *server)
-{
-	int rc;
-	uint32_t dev_vers;
-
-	if (next_minor == RPCROUTER_MAX_REMOTE_SERVERS) {
-		printk(KERN_ERR
-		       "rpcrouter: Minor numbers exhausted - Increase "
-		       "RPCROUTER_MAX_REMOTE_SERVERS\n");
-		return -ENOBUFS;
-	}
-
-#if CONFIG_MSM_AMSS_VERSION >= 6350
-	/* Servers with bit 31 set are remote msm servers with hashkey version.
-	 * Servers with bit 31 not set are remote msm servers with
-	 * backwards compatible version type in which case the minor number
-	 * (lower 16 bits) is set to zero.
-	 *
-	 */
-	if ((server->vers & RPC_VERSION_MODE_MASK))
-		dev_vers = server->vers;
-	else
-		dev_vers = server->vers & RPC_VERSION_MAJOR_MASK;
-#else
-	dev_vers = server->vers;
-#endif
-
-	server->device_number =
-		MKDEV(MAJOR(msm_rpcrouter_devno), next_minor++);
-
-	server->device =
-		device_create(msm_rpcrouter_class, rpcrouter_device,
-			      server->device_number, NULL, "%.8x:%.8x",
-			      server->prog, dev_vers);
-	if (IS_ERR(server->device)) {
-		printk(KERN_ERR
-		       "rpcrouter: Unable to create device (%ld)\n",
-		       PTR_ERR(server->device));
-		return PTR_ERR(server->device);;
-	}
-
-	cdev_init(&server->cdev, &rpcrouter_server_fops);
-	server->cdev.owner = THIS_MODULE;
-
-	rc = cdev_add(&server->cdev, server->device_number, 1);
-	if (rc < 0) {
-		printk(KERN_ERR
-		       "rpcrouter: Unable to add chrdev (%d)\n", rc);
-		device_destroy(msm_rpcrouter_class, server->device_number);
-		return rc;
-	}
-	return 0;
-}
-
-/* for backward compatible version type (31st bit cleared)
- * clearing minor number (lower 16 bits) in device name
- * is neccessary for driver binding
- */
-int msm_rpcrouter_create_server_pdev(struct rr_server *server)
-{
-	sprintf(server->pdev_name, "rs%.8x:%.8x",
-		server->prog,
-#if CONFIG_MSM_AMSS_VERSION >= 6350
-		(server->vers & RPC_VERSION_MODE_MASK) ? server->vers :
-		(server->vers & RPC_VERSION_MAJOR_MASK));
-#else
-		server->vers);
-#endif
-
-	server->p_device.base.id = -1;
-	server->p_device.base.name = server->pdev_name;
-
-	server->p_device.prog = server->prog;
-	server->p_device.vers = server->vers;
-
-	platform_device_register(&server->p_device.base);
-	return 0;
-}
-
-int msm_rpcrouter_init_devices(void)
-{
-	int rc;
-	int major;
-
-	/* Create the device nodes */
-	msm_rpcrouter_class = class_create(THIS_MODULE, "oncrpc");
-	if (IS_ERR(msm_rpcrouter_class)) {
-		rc = -ENOMEM;
-		printk(KERN_ERR
-		       "rpcrouter: failed to create oncrpc class\n");
-		goto fail;
-	}
-
-	rc = alloc_chrdev_region(&msm_rpcrouter_devno, 0,
-				 RPCROUTER_MAX_REMOTE_SERVERS + 1,
-				 "oncrpc");
-	if (rc < 0) {
-		printk(KERN_ERR
-		       "rpcrouter: Failed to alloc chardev region (%d)\n", rc);
-		goto fail_destroy_class;
-	}
-
-	major = MAJOR(msm_rpcrouter_devno);
-	rpcrouter_device = device_create(msm_rpcrouter_class, NULL,
-					 msm_rpcrouter_devno, NULL, "%.8x:%d",
-					 0, 0);
-	if (IS_ERR(rpcrouter_device)) {
-		rc = -ENOMEM;
-		goto fail_unregister_cdev_region;
-	}
-
-	cdev_init(&rpcrouter_cdev, &rpcrouter_router_fops);
-	rpcrouter_cdev.owner = THIS_MODULE;
-
-	rc = cdev_add(&rpcrouter_cdev, msm_rpcrouter_devno, 1);
-	if (rc < 0)
-		goto fail_destroy_device;
-
-	return 0;
-
-fail_destroy_device:
-	device_destroy(msm_rpcrouter_class, msm_rpcrouter_devno);
-fail_unregister_cdev_region:
-	unregister_chrdev_region(msm_rpcrouter_devno,
-				 RPCROUTER_MAX_REMOTE_SERVERS + 1);
-fail_destroy_class:
-	class_destroy(msm_rpcrouter_class);
-fail:
-	return rc;
-}
-
-void msm_rpcrouter_exit_devices(void)
-{
-	cdev_del(&rpcrouter_cdev);
-	device_destroy(msm_rpcrouter_class, msm_rpcrouter_devno);
-	unregister_chrdev_region(msm_rpcrouter_devno,
-				 RPCROUTER_MAX_REMOTE_SERVERS + 1);
-	class_destroy(msm_rpcrouter_class);
-}
-
diff --git a/arch/arm/mach-msm/smd_rpcrouter_servers.c b/arch/arm/mach-msm/smd_rpcrouter_servers.c
deleted file mode 100644
index 2597bbb..0000000
--- a/arch/arm/mach-msm/smd_rpcrouter_servers.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/* arch/arm/mach-msm/rpc_servers.c
- *
- * Copyright (C) 2007 Google, Inc.
- * Author: Iliyan Malchev <ibm@android.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <linux/cdev.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/types.h>
-#include <linux/fs.h>
-#include <linux/kthread.h>
-#include <linux/delay.h>
-#include <linux/platform_device.h>
-#include <linux/wakelock.h>
-
-#include <linux/msm_rpcrouter.h>
-#include <linux/uaccess.h>
-
-#include <mach/msm_rpcrouter.h>
-#include "smd_rpcrouter.h"
-
-static struct msm_rpc_endpoint *endpoint;
-
-#define FLAG_REGISTERED 0x0001
-
-static LIST_HEAD(rpc_server_list);
-static DEFINE_MUTEX(rpc_server_list_lock);
-static int rpc_servers_active;
-static struct wake_lock rpc_servers_wake_lock;
-
-static void rpc_server_register(struct msm_rpc_server *server)
-{
-	int rc;
-	rc = msm_rpc_register_server(endpoint, server->prog, server->vers);
-	if (rc < 0)
-		printk(KERN_ERR "[rpcserver] error registering %p @ %08x:%d\n",
-		       server, server->prog, server->vers);
-}
-
-static struct msm_rpc_server *rpc_server_find(uint32_t prog, uint32_t vers)
-{
-	struct msm_rpc_server *server;
-
-	mutex_lock(&rpc_server_list_lock);
-	list_for_each_entry(server, &rpc_server_list, list) {
-		if ((server->prog == prog) &&
-#if CONFIG_MSM_AMSS_VERSION >= 6350
-		    msm_rpc_is_compatible_version(server->vers, vers)) {
-#else
-		    server->vers == vers) {
-#endif
-			mutex_unlock(&rpc_server_list_lock);
-			return server;
-		}
-	}
-	mutex_unlock(&rpc_server_list_lock);
-	return NULL;
-}
-
-static void rpc_server_register_all(void)
-{
-	struct msm_rpc_server *server;
-
-	mutex_lock(&rpc_server_list_lock);
-	list_for_each_entry(server, &rpc_server_list, list) {
-		if (!(server->flags & FLAG_REGISTERED)) {
-			rpc_server_register(server);
-			server->flags |= FLAG_REGISTERED;
-		}
-	}
-	mutex_unlock(&rpc_server_list_lock);
-}
-
-int msm_rpc_create_server(struct msm_rpc_server *server)
-{
-	/* make sure we're in a sane state first */
-	server->flags = 0;
-	INIT_LIST_HEAD(&server->list);
-
-	mutex_lock(&rpc_server_list_lock);
-	list_add(&server->list, &rpc_server_list);
-	if (rpc_servers_active) {
-		rpc_server_register(server);
-		server->flags |= FLAG_REGISTERED;
-	}
-	mutex_unlock(&rpc_server_list_lock);
-
-	return 0;
-}
-
-static int rpc_send_accepted_void_reply(struct msm_rpc_endpoint *client,
-					uint32_t xid, uint32_t accept_status)
-{
-	int rc = 0;
-	uint8_t reply_buf[sizeof(struct rpc_reply_hdr)];
-	struct rpc_reply_hdr *reply = (struct rpc_reply_hdr *)reply_buf;
-
-	reply->xid = cpu_to_be32(xid);
-	reply->type = cpu_to_be32(1); /* reply */
-	reply->reply_stat = cpu_to_be32(RPCMSG_REPLYSTAT_ACCEPTED);
-
-	reply->data.acc_hdr.accept_stat = cpu_to_be32(accept_status);
-	reply->data.acc_hdr.verf_flavor = 0;
-	reply->data.acc_hdr.verf_length = 0;
-
-	rc = msm_rpc_write(client, reply_buf, sizeof(reply_buf));
-	if (rc < 0)
-		printk(KERN_ERR
-		       "%s: could not write response: %d\n",
-		       __FUNCTION__, rc);
-
-	return rc;
-}
-
-static int rpc_servers_thread(void *data)
-{
-	void *buffer;
-	struct rpc_request_hdr *req;
-	struct msm_rpc_server *server;
-	int rc;
-
-	for (;;) {
-		wake_unlock(&rpc_servers_wake_lock);
-		rc = wait_event_interruptible(endpoint->wait_q,
-						!list_empty(&endpoint->read_q));
-		wake_lock(&rpc_servers_wake_lock);
-		rc = msm_rpc_read(endpoint, &buffer, -1, -1);
-		if (rc < 0) {
-			printk(KERN_ERR "%s: could not read: %d\n",
-			       __FUNCTION__, rc);
-			break;
-		}
-		req = (struct rpc_request_hdr *)buffer;
-
-		req->type = be32_to_cpu(req->type);
-		req->xid = be32_to_cpu(req->xid);
-		req->rpc_vers = be32_to_cpu(req->rpc_vers);
-		req->prog = be32_to_cpu(req->prog);
-		req->vers = be32_to_cpu(req->vers);
-		req->procedure = be32_to_cpu(req->procedure);
-
-		server = rpc_server_find(req->prog, req->vers);
-
-		if (req->rpc_vers != 2)
-			continue;
-		if (req->type != 0)
-			continue;
-		if (!server) {
-			rpc_send_accepted_void_reply(
-				endpoint, req->xid,
-				RPC_ACCEPTSTAT_PROG_UNAVAIL);
-			continue;
-		}
-
-		rc = server->rpc_call(server, req, rc);
-
-		switch (rc) {
-		case 0:
-			rpc_send_accepted_void_reply(
-				endpoint, req->xid,
-				RPC_ACCEPTSTAT_SUCCESS);
-			break;
-		default:
-			rpc_send_accepted_void_reply(
-				endpoint, req->xid,
-				RPC_ACCEPTSTAT_PROG_UNAVAIL);
-			break;
-		}
-
-		kfree(buffer);
-	}
-
-	do_exit(0);
-}
-
-static int rpcservers_probe(struct platform_device *pdev)
-{
-	struct task_struct *server_thread;
-
-	endpoint = msm_rpc_open();
-	if (IS_ERR(endpoint))
-		return PTR_ERR(endpoint);
-
-	/* we're online -- register any servers installed beforehand */
-	rpc_servers_active = 1;
-	rpc_server_register_all();
-
-	/* start the kernel thread */
-	server_thread = kthread_run(rpc_servers_thread, NULL, "krpcserversd");
-	if (IS_ERR(server_thread))
-		return PTR_ERR(server_thread);
-
-	return 0;
-}
-
-static struct platform_driver rpcservers_driver = {
-	.probe	= rpcservers_probe,
-	.driver	= {
-		.name	= "oncrpc_router",
-		.owner	= THIS_MODULE,
-	},
-};
-
-static int __init rpc_servers_init(void)
-{
-	wake_lock_init(&rpc_servers_wake_lock, WAKE_LOCK_SUSPEND, "rpc_server");
-	return platform_driver_register(&rpcservers_driver);
-}
-
-module_init(rpc_servers_init);
-
-MODULE_DESCRIPTION("MSM RPC Servers");
-MODULE_AUTHOR("Iliyan Malchev <ibm@android.com>");
-MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-msm/smd_tty.c b/arch/arm/mach-msm/smd_tty.c
deleted file mode 100644
index 2edd9d1..0000000
--- a/arch/arm/mach-msm/smd_tty.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/* arch/arm/mach-msm/smd_tty.c
- *
- * Copyright (C) 2007 Google, Inc.
- * Author: Brian Swetland <swetland@google.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/cdev.h>
-#include <linux/device.h>
-#include <linux/wait.h>
-#include <linux/wakelock.h>
-
-#include <linux/tty.h>
-#include <linux/tty_driver.h>
-#include <linux/tty_flip.h>
-
-#include <mach/msm_smd.h>
-
-#define MAX_SMD_TTYS 32
-
-static DEFINE_MUTEX(smd_tty_lock);
-
-struct smd_tty_info {
-	smd_channel_t *ch;
-	struct tty_struct *tty;
-	struct wake_lock wake_lock;
-	int open_count;
-};
-
-static struct smd_tty_info smd_tty[MAX_SMD_TTYS];
-
-
-static void smd_tty_notify(void *priv, unsigned event)
-{
-	unsigned char *ptr;
-	int avail;
-	struct smd_tty_info *info = priv;
-	struct tty_struct *tty = info->tty;
-
-	if (!tty)
-		return;
-
-	if (event != SMD_EVENT_DATA)
-		return;
-
-	for (;;) {
-		if (test_bit(TTY_THROTTLED, &tty->flags)) break;
-		avail = smd_read_avail(info->ch);
-		if (avail == 0) break;
-
-		avail = tty_prepare_flip_string(tty, &ptr, avail);
-
-		if (smd_read(info->ch, ptr, avail) != avail) {
-			/* shouldn't be possible since we're in interrupt
-			** context here and nobody else could 'steal' our
-			** characters.
-			*/
-			printk(KERN_ERR "OOPS - smd_tty_buffer mismatch?!");
-		}
-
-		wake_lock_timeout(&info->wake_lock, HZ / 2);
-		tty_flip_buffer_push(tty);
-	}
-
-	/* XXX only when writable and necessary */
-	tty_wakeup(tty);
-}
-
-static int smd_tty_open(struct tty_struct *tty, struct file *f)
-{
-	int res = 0;
-	int n = tty->index;
-	struct smd_tty_info *info;
-	const char *name;
-
-	if (n == 0) {
-		name = "SMD_DS";
-	} else if (n == 27) {
-		name = "SMD_GPSNMEA";
-	} else {
-		return -ENODEV;
-	}
-
-	info = smd_tty + n;
-
-	mutex_lock(&smd_tty_lock);
-	wake_lock_init(&info->wake_lock, WAKE_LOCK_SUSPEND, name);
-	tty->driver_data = info;
-
-	if (info->open_count++ == 0) {
-		info->tty = tty;
-		if (info->ch) {
-			smd_kick(info->ch);
-		} else {
-			res = smd_open(name, &info->ch, info, smd_tty_notify);
-		}
-	}
-	mutex_unlock(&smd_tty_lock);
-
-	return res;
-}
-
-static void smd_tty_close(struct tty_struct *tty, struct file *f)
-{
-	struct smd_tty_info *info = tty->driver_data;
-
-	if (info == 0)
-		return;
-
-	mutex_lock(&smd_tty_lock);
-	if (--info->open_count == 0) {
-		info->tty = 0;
-		tty->driver_data = 0;
-		wake_lock_destroy(&info->wake_lock);
-		if (info->ch) {
-			smd_close(info->ch);
-			info->ch = 0;
-		}
-	}
-	mutex_unlock(&smd_tty_lock);
-}
-
-static int smd_tty_write(struct tty_struct *tty, const unsigned char *buf, int len)
-{
-	struct smd_tty_info *info = tty->driver_data;
-	int avail;
-
-	/* if we're writing to a packet channel we will
-	** never be able to write more data than there
-	** is currently space for
-	*/
-	avail = smd_write_avail(info->ch);
-	if (len > avail)
-		len = avail;
-
-	return smd_write(info->ch, buf, len);
-}
-
-static int smd_tty_write_room(struct tty_struct *tty)
-{
-	struct smd_tty_info *info = tty->driver_data;
-	return smd_write_avail(info->ch);
-}
-
-static int smd_tty_chars_in_buffer(struct tty_struct *tty)
-{
-	struct smd_tty_info *info = tty->driver_data;
-	return smd_read_avail(info->ch);
-}
-
-static void smd_tty_unthrottle(struct tty_struct *tty)
-{
-	struct smd_tty_info *info = tty->driver_data;
-	smd_kick(info->ch);
-}
-
-static struct tty_operations smd_tty_ops = {
-	.open = smd_tty_open,
-	.close = smd_tty_close,
-	.write = smd_tty_write,
-	.write_room = smd_tty_write_room,
-	.chars_in_buffer = smd_tty_chars_in_buffer,
-	.unthrottle = smd_tty_unthrottle,
-};
-
-static struct tty_driver *smd_tty_driver;
-
-static int __init smd_tty_init(void)
-{
-	int ret;
-
-	smd_tty_driver = alloc_tty_driver(MAX_SMD_TTYS);
-	if (smd_tty_driver == 0)
-		return -ENOMEM;
-
-	smd_tty_driver->owner = THIS_MODULE;
-	smd_tty_driver->driver_name = "smd_tty_driver";
-	smd_tty_driver->name = "smd";
-	smd_tty_driver->major = 0;
-	smd_tty_driver->minor_start = 0;
-	smd_tty_driver->type = TTY_DRIVER_TYPE_SERIAL;
-	smd_tty_driver->subtype = SERIAL_TYPE_NORMAL;
-	smd_tty_driver->init_termios = tty_std_termios;
-	smd_tty_driver->init_termios.c_iflag = 0;
-	smd_tty_driver->init_termios.c_oflag = 0;
-	smd_tty_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
-	smd_tty_driver->init_termios.c_lflag = 0;
-	smd_tty_driver->flags = TTY_DRIVER_RESET_TERMIOS |
-		TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
-	tty_set_operations(smd_tty_driver, &smd_tty_ops);
-
-	ret = tty_register_driver(smd_tty_driver);
-	if (ret) return ret;
-
-	/* this should be dynamic */
-	tty_register_device(smd_tty_driver, 0, 0);
-	tty_register_device(smd_tty_driver, 27, 0);
-
-	return 0;
-}
-
-module_init(smd_tty_init);


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-27 21:13                       ` Pavel Machek
@ 2009-12-27 21:53                         ` Pavel Machek
  2009-12-28  0:46                         ` Brian Swetland
  1 sibling, 0 replies; 38+ messages in thread
From: Pavel Machek @ 2009-12-27 21:53 UTC (permalink / raw)
  To: Brian Swetland
  Cc: Arve Hj?nnev?g, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

Hi!

This switches gpio_ code and touchscreen driver to the version in
staging tree; removing 2KLoC.

Signed-off-by: Pavel Machek <pavel@ucw.cz>

diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 42a5a5a..17a0bb4 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -12,7 +12,7 @@ obj-$(CONFIG_INPUT_BFIN_ROTARY)		+= bfin_rotary.o
 obj-$(CONFIG_INPUT_CM109)		+= cm109.o
 obj-$(CONFIG_INPUT_COBALT_BTNS)		+= cobalt_btns.o
 obj-$(CONFIG_INPUT_DM355EVM)		+= dm355evm_keys.o
-obj-$(CONFIG_INPUT_GPIO)		+= gpio_event.o gpio_matrix.o gpio_input.o gpio_output.o gpio_axis.o
+obj-$(CONFIG_INPUT_GPIO)		+= ../../staging/dream/gpio_event.o ../../staging/dream/gpio_matrix.o ../../staging/dream/gpio_input.o ../../staging/dream/gpio_output.o ../../staging/dream/gpio_axis.o
 obj-$(CONFIG_HP_SDC_RTC)		+= hp_sdc_rtc.o
 obj-$(CONFIG_INPUT_IXP4XX_BEEPER)	+= ixp4xx-beeper.o
 obj-$(CONFIG_INPUT_KEYCHORD)		+= keychord.o
diff --git a/drivers/input/misc/gpio_axis.c b/drivers/input/misc/gpio_axis.c
deleted file mode 100644
index 30b9f56..0000000
--- a/drivers/input/misc/gpio_axis.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* drivers/input/misc/gpio_axis.c
- *
- * Copyright (C) 2007 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/gpio.h>
-#include <linux/gpio_event.h>
-#include <linux/interrupt.h>
-
-struct gpio_axis_state {
-	struct gpio_event_input_devs *input_devs;
-	struct gpio_event_axis_info *info;
-	uint32_t pos;
-};
-
-uint16_t gpio_axis_4bit_gray_map_table[] = {
-	[0x0] = 0x0, [0x1] = 0x1, /* 0000 0001 */
-	[0x3] = 0x2, [0x2] = 0x3, /* 0011 0010 */
-	[0x6] = 0x4, [0x7] = 0x5, /* 0110 0111 */
-	[0x5] = 0x6, [0x4] = 0x7, /* 0101 0100 */
-	[0xc] = 0x8, [0xd] = 0x9, /* 1100 1101 */
-	[0xf] = 0xa, [0xe] = 0xb, /* 1111 1110 */
-	[0xa] = 0xc, [0xb] = 0xd, /* 1010 1011 */
-	[0x9] = 0xe, [0x8] = 0xf, /* 1001 1000 */
-};
-uint16_t gpio_axis_4bit_gray_map(struct gpio_event_axis_info *info, uint16_t in)
-{
-	return gpio_axis_4bit_gray_map_table[in];
-}
-
-uint16_t gpio_axis_5bit_singletrack_map_table[] = {
-	[0x10] = 0x00, [0x14] = 0x01, [0x1c] = 0x02, /*     10000 10100 11100 */
-	[0x1e] = 0x03, [0x1a] = 0x04, [0x18] = 0x05, /*     11110 11010 11000 */
-	[0x08] = 0x06, [0x0a] = 0x07, [0x0e] = 0x08, /*    01000 01010 01110  */
-	[0x0f] = 0x09, [0x0d] = 0x0a, [0x0c] = 0x0b, /*    01111 01101 01100  */
-	[0x04] = 0x0c, [0x05] = 0x0d, [0x07] = 0x0e, /*   00100 00101 00111   */
-	[0x17] = 0x0f, [0x16] = 0x10, [0x06] = 0x11, /*   10111 10110 00110   */
-	[0x02] = 0x12, [0x12] = 0x13, [0x13] = 0x14, /*  00010 10010 10011    */
-	[0x1b] = 0x15, [0x0b] = 0x16, [0x03] = 0x17, /*  11011 01011 00011    */
-	[0x01] = 0x18, [0x09] = 0x19, [0x19] = 0x1a, /* 00001 01001 11001     */
-	[0x1d] = 0x1b, [0x15] = 0x1c, [0x11] = 0x1d, /* 11101 10101 10001     */
-};
-uint16_t gpio_axis_5bit_singletrack_map(
-	struct gpio_event_axis_info *info, uint16_t in)
-{
-	return gpio_axis_5bit_singletrack_map_table[in];
-}
-
-static void gpio_event_update_axis(struct gpio_axis_state *as, int report)
-{
-	struct gpio_event_axis_info *ai = as->info;
-	int i;
-	int change;
-	uint16_t state = 0;
-	uint16_t pos;
-	uint16_t old_pos = as->pos;
-	for (i = ai->count - 1; i >= 0; i--)
-		state = (state << 1) | gpio_get_value(ai->gpio[i]);
-	pos = ai->map(ai, state);
-	if (ai->flags & GPIOEAF_PRINT_RAW)
-		pr_info("axis %d-%d raw %x, pos %d -> %d\n",
-			ai->type, ai->code, state, old_pos, pos);
-	if (report && pos != old_pos) {
-		if (ai->type == EV_REL) {
-			change = (ai->decoded_size + pos - old_pos) %
-				  ai->decoded_size;
-			if (change > ai->decoded_size / 2)
-				change -= ai->decoded_size;
-			if (change == ai->decoded_size / 2) {
-				if (ai->flags & GPIOEAF_PRINT_EVENT)
-					pr_info("axis %d-%d unknown direction, "
-						"pos %d -> %d\n", ai->type,
-						ai->code, old_pos, pos);
-				change = 0; /* no closest direction */
-			}
-			if (ai->flags & GPIOEAF_PRINT_EVENT)
-				pr_info("axis %d-%d change %d\n",
-					ai->type, ai->code, change);
-			input_report_rel(as->input_devs->dev[ai->dev],
-						ai->code, change);
-		} else {
-			if (ai->flags & GPIOEAF_PRINT_EVENT)
-				pr_info("axis %d-%d now %d\n",
-					ai->type, ai->code, pos);
-			input_event(as->input_devs->dev[ai->dev],
-					ai->type, ai->code, pos);
-		}
-		input_sync(as->input_devs->dev[ai->dev]);
-	}
-	as->pos = pos;
-}
-
-static irqreturn_t gpio_axis_irq_handler(int irq, void *dev_id)
-{
-	struct gpio_axis_state *as = dev_id;
-	gpio_event_update_axis(as, 1);
-	return IRQ_HANDLED;
-}
-
-int gpio_event_axis_func(struct gpio_event_input_devs *input_devs,
-			 struct gpio_event_info *info, void **data, int func)
-{
-	int ret;
-	int i;
-	int irq;
-	struct gpio_event_axis_info *ai;
-	struct gpio_axis_state *as;
-
-	ai = container_of(info, struct gpio_event_axis_info, info);
-	if (func == GPIO_EVENT_FUNC_SUSPEND) {
-		for (i = 0; i < ai->count; i++)
-			disable_irq(gpio_to_irq(ai->gpio[i]));
-		return 0;
-	}
-	if (func == GPIO_EVENT_FUNC_RESUME) {
-		for (i = 0; i < ai->count; i++)
-			enable_irq(gpio_to_irq(ai->gpio[i]));
-		return 0;
-	}
-
-	if (func == GPIO_EVENT_FUNC_INIT) {
-		*data = as = kmalloc(sizeof(*as), GFP_KERNEL);
-		if (as == NULL) {
-			ret = -ENOMEM;
-			goto err_alloc_axis_state_failed;
-		}
-		as->input_devs = input_devs;
-		as->info = ai;
-		if (ai->dev >= input_devs->count) {
-			pr_err("gpio_event_axis: bad device index %d >= %d "
-				"for %d:%d\n", ai->dev, input_devs->count,
-				ai->type, ai->code);
-			ret = -EINVAL;
-			goto err_bad_device_index;
-		}
-
-		input_set_capability(input_devs->dev[ai->dev],
-				     ai->type, ai->code);
-		if (ai->type == EV_ABS) {
-			input_set_abs_params(input_devs->dev[ai->dev], ai->code,
-					     0, ai->decoded_size - 1, 0, 0);
-		}
-		for (i = 0; i < ai->count; i++) {
-			ret = gpio_request(ai->gpio[i], "gpio_event_axis");
-			if (ret < 0)
-				goto err_request_gpio_failed;
-			ret = gpio_direction_input(ai->gpio[i]);
-			if (ret < 0)
-				goto err_gpio_direction_input_failed;
-			ret = irq = gpio_to_irq(ai->gpio[i]);
-			if (ret < 0)
-				goto err_get_irq_num_failed;
-			ret = request_irq(irq, gpio_axis_irq_handler,
-					  IRQF_TRIGGER_RISING |
-					  IRQF_TRIGGER_FALLING,
-					  "gpio_event_axis", as);
-			if (ret < 0)
-				goto err_request_irq_failed;
-		}
-		gpio_event_update_axis(as, 0);
-		return 0;
-	}
-
-	ret = 0;
-	as = *data;
-	for (i = ai->count - 1; i >= 0; i--) {
-		free_irq(gpio_to_irq(ai->gpio[i]), as);
-err_request_irq_failed:
-err_get_irq_num_failed:
-err_gpio_direction_input_failed:
-		gpio_free(ai->gpio[i]);
-err_request_gpio_failed:
-		;
-	}
-err_bad_device_index:
-	kfree(as);
-	*data = NULL;
-err_alloc_axis_state_failed:
-	return ret;
-}
diff --git a/drivers/input/misc/gpio_event.c b/drivers/input/misc/gpio_event.c
deleted file mode 100644
index 139b360..0000000
--- a/drivers/input/misc/gpio_event.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/* drivers/input/misc/gpio_event.c
- *
- * Copyright (C) 2007 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-
-#include <linux/earlysuspend.h>
-#include <linux/module.h>
-#include <linux/input.h>
-#include <linux/gpio_event.h>
-#include <linux/hrtimer.h>
-#include <linux/platform_device.h>
-
-struct gpio_event {
-	struct gpio_event_input_devs *input_devs;
-	const struct gpio_event_platform_data *info;
-	struct early_suspend early_suspend;
-	void *state[0];
-};
-
-static int gpio_input_event(
-	struct input_dev *dev, unsigned int type, unsigned int code, int value)
-{
-	int i;
-	int devnr;
-	int ret = 0;
-	int tmp_ret;
-	struct gpio_event_info **ii;
-	struct gpio_event *ip = input_get_drvdata(dev);
-
-	for (devnr = 0; devnr < ip->input_devs->count; devnr++)
-		if (ip->input_devs->dev[devnr] == dev)
-			break;
-	if (devnr == ip->input_devs->count) {
-		pr_err("gpio_input_event: unknown device %p\n", dev);
-		return -EIO;
-	}
-
-	for (i = 0, ii = ip->info->info; i < ip->info->info_count; i++, ii++) {
-		if ((*ii)->event) {
-			tmp_ret = (*ii)->event(ip->input_devs, *ii,
-						&ip->state[i],
-						devnr, type, code, value);
-			if (tmp_ret)
-				ret = tmp_ret;
-		}
-	}
-	return ret;
-}
-
-static int gpio_event_call_all_func(struct gpio_event *ip, int func)
-{
-	int i;
-	int ret;
-	struct gpio_event_info **ii;
-
-	if (func == GPIO_EVENT_FUNC_INIT || func == GPIO_EVENT_FUNC_RESUME) {
-		ii = ip->info->info;
-		for (i = 0; i < ip->info->info_count; i++, ii++) {
-			if ((*ii)->func == NULL) {
-				ret = -ENODEV;
-				pr_err("gpio_event_probe: Incomplete pdata, "
-					"no function\n");
-				goto err_no_func;
-			}
-			if (func == GPIO_EVENT_FUNC_RESUME && (*ii)->no_suspend)
-				continue;
-			ret = (*ii)->func(ip->input_devs, *ii, &ip->state[i],
-					  func);
-			if (ret) {
-				pr_err("gpio_event_probe: function failed\n");
-				goto err_func_failed;
-			}
-		}
-		return 0;
-	}
-
-	ret = 0;
-	i = ip->info->info_count;
-	ii = ip->info->info + i;
-	while (i > 0) {
-		i--;
-		ii--;
-		if ((func & ~1) == GPIO_EVENT_FUNC_SUSPEND && (*ii)->no_suspend)
-			continue;
-		(*ii)->func(ip->input_devs, *ii, &ip->state[i], func & ~1);
-err_func_failed:
-err_no_func:
-		;
-	}
-	return ret;
-}
-
-#ifdef CONFIG_HAS_EARLYSUSPEND
-void gpio_event_suspend(struct early_suspend *h)
-{
-	struct gpio_event *ip;
-	ip = container_of(h, struct gpio_event, early_suspend);
-	gpio_event_call_all_func(ip, GPIO_EVENT_FUNC_SUSPEND);
-	ip->info->power(ip->info, 0);
-}
-
-void gpio_event_resume(struct early_suspend *h)
-{
-	struct gpio_event *ip;
-	ip = container_of(h, struct gpio_event, early_suspend);
-	ip->info->power(ip->info, 1);
-	gpio_event_call_all_func(ip, GPIO_EVENT_FUNC_RESUME);
-}
-#endif
-
-static int __init gpio_event_probe(struct platform_device *pdev)
-{
-	int err;
-	struct gpio_event *ip;
-	struct gpio_event_platform_data *event_info;
-	int dev_count = 1;
-	int i;
-	int registered = 0;
-
-	event_info = pdev->dev.platform_data;
-	if (event_info == NULL) {
-		pr_err("gpio_event_probe: No pdata\n");
-		return -ENODEV;
-	}
-	if ((!event_info->name && !event_info->names[0]) ||
-	    !event_info->info || !event_info->info_count) {
-		pr_err("gpio_event_probe: Incomplete pdata\n");
-		return -ENODEV;
-	}
-	if (!event_info->name)
-		while (event_info->names[dev_count])
-			dev_count++;
-	ip = kzalloc(sizeof(*ip) +
-		     sizeof(ip->state[0]) * event_info->info_count +
-		     sizeof(*ip->input_devs) +
-		     sizeof(ip->input_devs->dev[0]) * dev_count, GFP_KERNEL);
-	if (ip == NULL) {
-		err = -ENOMEM;
-		pr_err("gpio_event_probe: Failed to allocate private data\n");
-		goto err_kp_alloc_failed;
-	}
-	ip->input_devs = (void*)&ip->state[event_info->info_count];
-	platform_set_drvdata(pdev, ip);
-
-	for (i = 0; i < dev_count; i++) {
-		struct input_dev *input_dev = input_allocate_device();
-		if (input_dev == NULL) {
-			err = -ENOMEM;
-			pr_err("gpio_event_probe: "
-				"Failed to allocate input device\n");
-			goto err_input_dev_alloc_failed;
-		}
-		input_set_drvdata(input_dev, ip);
-		input_dev->name = event_info->name ?
-					event_info->name : event_info->names[i];
-		input_dev->event = gpio_input_event;
-		ip->input_devs->dev[i] = input_dev;
-	}
-	ip->input_devs->count = dev_count;
-	ip->info = event_info;
-	if (event_info->power) {
-#ifdef CONFIG_HAS_EARLYSUSPEND
-		ip->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
-		ip->early_suspend.suspend = gpio_event_suspend;
-		ip->early_suspend.resume = gpio_event_resume;
-		register_early_suspend(&ip->early_suspend);
-#endif
-		ip->info->power(ip->info, 1);
-	}
-
-	err = gpio_event_call_all_func(ip, GPIO_EVENT_FUNC_INIT);
-	if (err)
-		goto err_call_all_func_failed;
-
-	for (i = 0; i < dev_count; i++) {
-		err = input_register_device(ip->input_devs->dev[i]);
-		if (err) {
-			pr_err("gpio_event_probe: Unable to register %s "
-				"input device\n", ip->input_devs->dev[i]->name);
-			goto err_input_register_device_failed;
-		}
-		registered++;
-	}
-
-	return 0;
-
-err_input_register_device_failed:
-	gpio_event_call_all_func(ip, GPIO_EVENT_FUNC_UNINIT);
-err_call_all_func_failed:
-	if (event_info->power) {
-#ifdef CONFIG_HAS_EARLYSUSPEND
-		unregister_early_suspend(&ip->early_suspend);
-#endif
-		ip->info->power(ip->info, 0);
-	}
-	for (i = 0; i < registered; i++)
-		input_unregister_device(ip->input_devs->dev[i]);
-	for (i = dev_count - 1; i >= registered; i--) {
-		input_free_device(ip->input_devs->dev[i]);
-err_input_dev_alloc_failed:
-		;
-	}
-	kfree(ip);
-err_kp_alloc_failed:
-	return err;
-}
-
-static int gpio_event_remove(struct platform_device *pdev)
-{
-	struct gpio_event *ip = platform_get_drvdata(pdev);
-	int i;
-
-	gpio_event_call_all_func(ip, GPIO_EVENT_FUNC_UNINIT);
-	if (ip->info->power) {
-#ifdef CONFIG_HAS_EARLYSUSPEND
-		unregister_early_suspend(&ip->early_suspend);
-#endif
-		ip->info->power(ip->info, 0);
-	}
-	for (i = 0; i < ip->input_devs->count; i++)
-		input_unregister_device(ip->input_devs->dev[i]);
-	kfree(ip);
-	return 0;
-}
-
-static struct platform_driver gpio_event_driver = {
-	.probe		= gpio_event_probe,
-	.remove		= gpio_event_remove,
-	.driver		= {
-		.name	= GPIO_EVENT_DEV_NAME,
-	},
-};
-
-static int __devinit gpio_event_init(void)
-{
-	return platform_driver_register(&gpio_event_driver);
-}
-
-static void __exit gpio_event_exit(void)
-{
-	platform_driver_unregister(&gpio_event_driver);
-}
-
-module_init(gpio_event_init);
-module_exit(gpio_event_exit);
-
-MODULE_DESCRIPTION("GPIO Event Driver");
-MODULE_LICENSE("GPL");
-
diff --git a/drivers/input/misc/gpio_input.c b/drivers/input/misc/gpio_input.c
deleted file mode 100644
index 7e66f8c..0000000
--- a/drivers/input/misc/gpio_input.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/* drivers/input/misc/gpio_input.c
- *
- * Copyright (C) 2007 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/gpio.h>
-#include <linux/gpio_event.h>
-#include <linux/hrtimer.h>
-#include <linux/input.h>
-#include <linux/interrupt.h>
-#include <linux/wakelock.h>
-
-enum {
-	DEBOUNCE_UNSTABLE     = BIT(0),	/* Got irq, while debouncing */
-	DEBOUNCE_PRESSED      = BIT(1),
-	DEBOUNCE_NOTPRESSED   = BIT(2),
-	DEBOUNCE_WAIT_IRQ     = BIT(3),	/* Stable irq state */
-	DEBOUNCE_POLL         = BIT(4),	/* Stable polling state */
-
-	DEBOUNCE_UNKNOWN =
-		DEBOUNCE_PRESSED | DEBOUNCE_NOTPRESSED,
-};
-
-struct gpio_key_state {
-	struct gpio_input_state *ds;
-	uint8_t debounce;
-};
-
-struct gpio_input_state {
-	struct gpio_event_input_devs *input_devs;
-	const struct gpio_event_input_info *info;
-	struct hrtimer timer;
-	int use_irq;
-	int debounce_count;
-	spinlock_t irq_lock;
-	struct wake_lock wake_lock;
-	struct gpio_key_state key_state[0];
-};
-
-static enum hrtimer_restart gpio_event_input_timer_func(struct hrtimer *timer)
-{
-	int i;
-	int pressed;
-	struct gpio_input_state *ds =
-		container_of(timer, struct gpio_input_state, timer);
-	unsigned gpio_flags = ds->info->flags;
-	unsigned npolarity;
-	int nkeys = ds->info->keymap_size;
-	const struct gpio_event_direct_entry *key_entry;
-	struct gpio_key_state *key_state;
-	unsigned long irqflags;
-	uint8_t debounce;
-
-#if 0
-	key_entry = kp->keys_info->keymap;
-	key_state = kp->key_state;
-	for (i = 0; i < nkeys; i++, key_entry++, key_state++)
-		pr_info("gpio_read_detect_status %d %d\n", key_entry->gpio,
-			gpio_read_detect_status(key_entry->gpio));
-#endif
-	key_entry = ds->info->keymap;
-	key_state = ds->key_state;
-	spin_lock_irqsave(&ds->irq_lock, irqflags);
-	for (i = 0; i < nkeys; i++, key_entry++, key_state++) {
-		debounce = key_state->debounce;
-		if (debounce & DEBOUNCE_WAIT_IRQ)
-			continue;
-		if (key_state->debounce & DEBOUNCE_UNSTABLE) {
-			debounce = key_state->debounce = DEBOUNCE_UNKNOWN;
-			enable_irq(gpio_to_irq(key_entry->gpio));
-			pr_info("gpio_keys_scan_keys: key %x-%x, %d "
-				"(%d) continue debounce\n",
-				ds->info->type, key_entry->code,
-				i, key_entry->gpio);
-		}
-		npolarity = !(gpio_flags & GPIOEDF_ACTIVE_HIGH);
-		pressed = gpio_get_value(key_entry->gpio) ^ npolarity;
-		if (debounce & DEBOUNCE_POLL) {
-			if (pressed == !(debounce & DEBOUNCE_PRESSED)) {
-				ds->debounce_count++;
-				key_state->debounce = DEBOUNCE_UNKNOWN;
-				if (gpio_flags & GPIOEDF_PRINT_KEY_DEBOUNCE)
-					pr_info("gpio_keys_scan_keys: key %x-"
-						"%x, %d (%d) start debounce\n",
-						ds->info->type, key_entry->code,
-						i, key_entry->gpio);
-			}
-			continue;
-		}
-		if (pressed && (debounce & DEBOUNCE_NOTPRESSED)) {
-			if (gpio_flags & GPIOEDF_PRINT_KEY_DEBOUNCE)
-				pr_info("gpio_keys_scan_keys: key %x-%x, %d "
-					"(%d) debounce pressed 1\n",
-					ds->info->type, key_entry->code,
-					i, key_entry->gpio);
-			key_state->debounce = DEBOUNCE_PRESSED;
-			continue;
-		}
-		if (!pressed && (debounce & DEBOUNCE_PRESSED)) {
-			if (gpio_flags & GPIOEDF_PRINT_KEY_DEBOUNCE)
-				pr_info("gpio_keys_scan_keys: key %x-%x, %d "
-					"(%d) debounce pressed 0\n",
-					ds->info->type, key_entry->code,
-					i, key_entry->gpio);
-			key_state->debounce = DEBOUNCE_NOTPRESSED;
-			continue;
-		}
-		/* key is stable */
-		ds->debounce_count--;
-		if (ds->use_irq)
-			key_state->debounce |= DEBOUNCE_WAIT_IRQ;
-		else
-			key_state->debounce |= DEBOUNCE_POLL;
-		if (gpio_flags & GPIOEDF_PRINT_KEYS)
-			pr_info("gpio_keys_scan_keys: key %x-%x, %d (%d) "
-				"changed to %d\n", ds->info->type,
-				key_entry->code, i, key_entry->gpio, pressed);
-		input_event(ds->input_devs->dev[key_entry->dev], ds->info->type,
-			    key_entry->code, pressed);
-	}
-
-#if 0
-	key_entry = kp->keys_info->keymap;
-	key_state = kp->key_state;
-	for (i = 0; i < nkeys; i++, key_entry++, key_state++) {
-		pr_info("gpio_read_detect_status %d %d\n", key_entry->gpio,
-			gpio_read_detect_status(key_entry->gpio));
-	}
-#endif
-
-	if (ds->debounce_count)
-		hrtimer_start(timer, ds->info->debounce_time, HRTIMER_MODE_REL);
-	else if (!ds->use_irq)
-		hrtimer_start(timer, ds->info->poll_time, HRTIMER_MODE_REL);
-	else
-		wake_unlock(&ds->wake_lock);
-
-	spin_unlock_irqrestore(&ds->irq_lock, irqflags);
-
-	return HRTIMER_NORESTART;
-}
-
-static irqreturn_t gpio_event_input_irq_handler(int irq, void *dev_id)
-{
-	struct gpio_key_state *ks = dev_id;
-	struct gpio_input_state *ds = ks->ds;
-	int keymap_index = ks - ds->key_state;
-	const struct gpio_event_direct_entry *key_entry;
-	unsigned long irqflags;
-	int pressed;
-
-	if (!ds->use_irq)
-		return IRQ_HANDLED;
-
-	key_entry = &ds->info->keymap[keymap_index];
-
-	if (ds->info->debounce_time.tv64) {
-		spin_lock_irqsave(&ds->irq_lock, irqflags);
-		if (ks->debounce & DEBOUNCE_WAIT_IRQ) {
-			ks->debounce = DEBOUNCE_UNKNOWN;
-			if (ds->debounce_count++ == 0) {
-				wake_lock(&ds->wake_lock);
-				hrtimer_start(
-					&ds->timer, ds->info->debounce_time,
-					HRTIMER_MODE_REL);
-			}
-			if (ds->info->flags & GPIOEDF_PRINT_KEY_DEBOUNCE)
-				pr_info("gpio_event_input_irq_handler: "
-					"key %x-%x, %d (%d) start debounce\n",
-					ds->info->type, key_entry->code,
-					keymap_index, key_entry->gpio);
-		} else {
-			disable_irq_nosync(irq);
-			ks->debounce = DEBOUNCE_UNSTABLE;
-		}
-		spin_unlock_irqrestore(&ds->irq_lock, irqflags);
-	} else {
-		pressed = gpio_get_value(key_entry->gpio) ^
-			!(ds->info->flags & GPIOEDF_ACTIVE_HIGH);
-		if (ds->info->flags & GPIOEDF_PRINT_KEYS)
-			pr_info("gpio_event_input_irq_handler: key %x-%x, %d "
-				"(%d) changed to %d\n",
-				ds->info->type, key_entry->code, keymap_index,
-				key_entry->gpio, pressed);
-		input_event(ds->input_devs->dev[key_entry->dev], ds->info->type,
-			    key_entry->code, pressed);
-	}
-	return IRQ_HANDLED;
-}
-
-static int gpio_event_input_request_irqs(struct gpio_input_state *ds)
-{
-	int i;
-	int err;
-	unsigned int irq;
-	unsigned long req_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING;
-
-	for (i = 0; i < ds->info->keymap_size; i++) {
-		err = irq = gpio_to_irq(ds->info->keymap[i].gpio);
-		if (err < 0)
-			goto err_gpio_get_irq_num_failed;
-		err = request_irq(irq, gpio_event_input_irq_handler,
-				  req_flags, "gpio_keys", &ds->key_state[i]);
-		if (err) {
-			pr_err("gpio_event_input_request_irqs: request_irq "
-				"failed for input %d, irq %d\n",
-				ds->info->keymap[i].gpio, irq);
-			goto err_request_irq_failed;
-		}
-		enable_irq_wake(irq);
-	}
-	return 0;
-
-	for (i = ds->info->keymap_size - 1; i >= 0; i--) {
-		free_irq(gpio_to_irq(ds->info->keymap[i].gpio),
-			 &ds->key_state[i]);
-err_request_irq_failed:
-err_gpio_get_irq_num_failed:
-		;
-	}
-	return err;
-}
-
-int gpio_event_input_func(struct gpio_event_input_devs *input_devs,
-			struct gpio_event_info *info, void **data, int func)
-{
-	int ret;
-	int i;
-	unsigned long irqflags;
-	struct gpio_event_input_info *di;
-	struct gpio_input_state *ds = *data;
-
-	di = container_of(info, struct gpio_event_input_info, info);
-
-	if (func == GPIO_EVENT_FUNC_SUSPEND) {
-		if (ds->use_irq)
-			for (i = 0; i < di->keymap_size; i++)
-				disable_irq(gpio_to_irq(di->keymap[i].gpio));
-		hrtimer_cancel(&ds->timer);
-		return 0;
-	}
-	if (func == GPIO_EVENT_FUNC_RESUME) {
-		spin_lock_irqsave(&ds->irq_lock, irqflags);
-		if (ds->use_irq)
-			for (i = 0; i < di->keymap_size; i++)
-				enable_irq(gpio_to_irq(di->keymap[i].gpio));
-		hrtimer_start(&ds->timer, ktime_set(0, 0), HRTIMER_MODE_REL);
-		spin_unlock_irqrestore(&ds->irq_lock, irqflags);
-		return 0;
-	}
-
-	if (func == GPIO_EVENT_FUNC_INIT) {
-		if (ktime_to_ns(di->poll_time) <= 0)
-			di->poll_time = ktime_set(0, 20 * NSEC_PER_MSEC);
-
-		*data = ds = kzalloc(sizeof(*ds) + sizeof(ds->key_state[0]) *
-					di->keymap_size, GFP_KERNEL);
-		if (ds == NULL) {
-			ret = -ENOMEM;
-			pr_err("gpio_event_input_func: "
-				"Failed to allocate private data\n");
-			goto err_ds_alloc_failed;
-		}
-		ds->debounce_count = di->keymap_size;
-		ds->input_devs = input_devs;
-		ds->info = di;
-		wake_lock_init(&ds->wake_lock, WAKE_LOCK_SUSPEND, "gpio_input");
-		spin_lock_init(&ds->irq_lock);
-
-		for (i = 0; i < di->keymap_size; i++) {
-			int dev = di->keymap[i].dev;
-			if (dev >= input_devs->count) {
-				pr_err("gpio_event_input_func: bad device "
-					"index %d >= %d for key code %d\n",
-					dev, input_devs->count,
-					di->keymap[i].code);
-				ret = -EINVAL;
-				goto err_bad_keymap;
-			}
-			input_set_capability(input_devs->dev[dev], di->type,
-					     di->keymap[i].code);
-			ds->key_state[i].ds = ds;
-			ds->key_state[i].debounce = DEBOUNCE_UNKNOWN;
-		}
-
-		for (i = 0; i < di->keymap_size; i++) {
-			ret = gpio_request(di->keymap[i].gpio, "gpio_kp_in");
-			if (ret) {
-				pr_err("gpio_event_input_func: gpio_request "
-					"failed for %d\n", di->keymap[i].gpio);
-				goto err_gpio_request_failed;
-			}
-			ret = gpio_direction_input(di->keymap[i].gpio);
-			if (ret) {
-				pr_err("gpio_event_input_func: "
-					"gpio_direction_input failed for %d\n",
-					di->keymap[i].gpio);
-				goto err_gpio_configure_failed;
-			}
-		}
-
-		ret = gpio_event_input_request_irqs(ds);
-
-		spin_lock_irqsave(&ds->irq_lock, irqflags);
-		ds->use_irq = ret == 0;
-
-		pr_info("GPIO Input Driver: Start gpio inputs for %s%s in %s "
-			"mode\n", input_devs->dev[0]->name,
-			(input_devs->count > 1) ? "..." : "",
-			ret == 0 ? "interrupt" : "polling");
-
-		hrtimer_init(&ds->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-		ds->timer.function = gpio_event_input_timer_func;
-		hrtimer_start(&ds->timer, ktime_set(0, 0), HRTIMER_MODE_REL);
-		spin_unlock_irqrestore(&ds->irq_lock, irqflags);
-		return 0;
-	}
-
-	ret = 0;
-	spin_lock_irqsave(&ds->irq_lock, irqflags);
-	hrtimer_cancel(&ds->timer);
-	if (ds->use_irq) {
-		for (i = di->keymap_size - 1; i >= 0; i--) {
-			free_irq(gpio_to_irq(di->keymap[i].gpio),
-				 &ds->key_state[i]);
-		}
-	}
-	spin_unlock_irqrestore(&ds->irq_lock, irqflags);
-
-	for (i = di->keymap_size - 1; i >= 0; i--) {
-err_gpio_configure_failed:
-		gpio_free(di->keymap[i].gpio);
-err_gpio_request_failed:
-		;
-	}
-err_bad_keymap:
-	wake_lock_destroy(&ds->wake_lock);
-	kfree(ds);
-err_ds_alloc_failed:
-	return ret;
-}
diff --git a/drivers/input/misc/gpio_matrix.c b/drivers/input/misc/gpio_matrix.c
deleted file mode 100644
index 90866c4..0000000
--- a/drivers/input/misc/gpio_matrix.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/* drivers/input/misc/gpio_matrix.c
- *
- * Copyright (C) 2007 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/gpio.h>
-#include <linux/gpio_event.h>
-#include <linux/hrtimer.h>
-#include <linux/interrupt.h>
-#include <linux/wakelock.h>
-
-struct gpio_kp {
-	struct gpio_event_input_devs *input_devs;
-	struct gpio_event_matrix_info *keypad_info;
-	struct hrtimer timer;
-	struct wake_lock wake_lock;
-	int current_output;
-	unsigned int use_irq:1;
-	unsigned int key_state_changed:1;
-	unsigned int last_key_state_changed:1;
-	unsigned int some_keys_pressed:2;
-	unsigned long keys_pressed[0];
-};
-
-static void clear_phantom_key(struct gpio_kp *kp, int out, int in)
-{
-	struct gpio_event_matrix_info *mi = kp->keypad_info;
-	int key_index = out * mi->ninputs + in;
-	unsigned short keyentry = mi->keymap[key_index];
-	unsigned short keycode = keyentry & MATRIX_KEY_MASK;
-	unsigned short dev = keyentry >> MATRIX_CODE_BITS;
-
-	if (!test_bit(keycode, kp->input_devs->dev[dev]->key)) {
-		if (mi->flags & GPIOKPF_PRINT_PHANTOM_KEYS)
-			pr_info("gpiomatrix: phantom key %x, %d-%d (%d-%d) "
-				"cleared\n", keycode, out, in,
-				mi->output_gpios[out], mi->input_gpios[in]);
-		__clear_bit(key_index, kp->keys_pressed);
-	} else {
-		if (mi->flags & GPIOKPF_PRINT_PHANTOM_KEYS)
-			pr_info("gpiomatrix: phantom key %x, %d-%d (%d-%d) "
-				"not cleared\n", keycode, out, in,
-				mi->output_gpios[out], mi->input_gpios[in]);
-	}
-}
-
-static int restore_keys_for_input(struct gpio_kp *kp, int out, int in)
-{
-	int rv = 0;
-	int key_index;
-
-	key_index = out * kp->keypad_info->ninputs + in;
-	while (out < kp->keypad_info->noutputs) {
-		if (test_bit(key_index, kp->keys_pressed)) {
-			rv = 1;
-			clear_phantom_key(kp, out, in);
-		}
-		key_index += kp->keypad_info->ninputs;
-		out++;
-	}
-	return rv;
-}
-
-static void remove_phantom_keys(struct gpio_kp *kp)
-{
-	int out, in, inp;
-	int key_index;
-
-	if (kp->some_keys_pressed < 3)
-		return;
-
-	for (out = 0; out < kp->keypad_info->noutputs; out++) {
-		inp = -1;
-		key_index = out * kp->keypad_info->ninputs;
-		for (in = 0; in < kp->keypad_info->ninputs; in++, key_index++) {
-			if (test_bit(key_index, kp->keys_pressed)) {
-				if (inp == -1) {
-					inp = in;
-					continue;
-				}
-				if (inp >= 0) {
-					if (!restore_keys_for_input(kp, out + 1,
-									inp))
-						break;
-					clear_phantom_key(kp, out, inp);
-					inp = -2;
-				}
-				restore_keys_for_input(kp, out, in);
-			}
-		}
-	}
-}
-
-static void report_key(struct gpio_kp *kp, int key_index, int out, int in)
-{
-	struct gpio_event_matrix_info *mi = kp->keypad_info;
-	int pressed = test_bit(key_index, kp->keys_pressed);
-	unsigned short keyentry = mi->keymap[key_index];
-	unsigned short keycode = keyentry & MATRIX_KEY_MASK;
-	unsigned short dev = keyentry >> MATRIX_CODE_BITS;
-
-	if (pressed != test_bit(keycode, kp->input_devs->dev[dev]->key)) {
-		if (keycode == KEY_RESERVED) {
-			if (mi->flags & GPIOKPF_PRINT_UNMAPPED_KEYS)
-				pr_info("gpiomatrix: unmapped key, %d-%d "
-					"(%d-%d) changed to %d\n",
-					out, in, mi->output_gpios[out],
-					mi->input_gpios[in], pressed);
-		} else {
-			if (mi->flags & GPIOKPF_PRINT_MAPPED_KEYS)
-				pr_info("gpiomatrix: key %x, %d-%d (%d-%d) "
-					"changed to %d\n", keycode,
-					out, in, mi->output_gpios[out],
-					mi->input_gpios[in], pressed);
-			input_report_key(kp->input_devs->dev[dev], keycode, pressed);
-		}
-	}
-}
-
-static enum hrtimer_restart gpio_keypad_timer_func(struct hrtimer *timer)
-{
-	int out, in;
-	int key_index;
-	int gpio;
-	struct gpio_kp *kp = container_of(timer, struct gpio_kp, timer);
-	struct gpio_event_matrix_info *mi = kp->keypad_info;
-	unsigned gpio_keypad_flags = mi->flags;
-	unsigned polarity = !!(gpio_keypad_flags & GPIOKPF_ACTIVE_HIGH);
-
-	out = kp->current_output;
-	if (out == mi->noutputs) {
-		out = 0;
-		kp->last_key_state_changed = kp->key_state_changed;
-		kp->key_state_changed = 0;
-		kp->some_keys_pressed = 0;
-	} else {
-		key_index = out * mi->ninputs;
-		for (in = 0; in < mi->ninputs; in++, key_index++) {
-			gpio = mi->input_gpios[in];
-			if (gpio_get_value(gpio) ^ !polarity) {
-				if (kp->some_keys_pressed < 3)
-					kp->some_keys_pressed++;
-				kp->key_state_changed |= !__test_and_set_bit(
-						key_index, kp->keys_pressed);
-			} else
-				kp->key_state_changed |= __test_and_clear_bit(
-						key_index, kp->keys_pressed);
-		}
-		gpio = mi->output_gpios[out];
-		if (gpio_keypad_flags & GPIOKPF_DRIVE_INACTIVE)
-			gpio_set_value(gpio, !polarity);
-		else
-			gpio_direction_input(gpio);
-		out++;
-	}
-	kp->current_output = out;
-	if (out < mi->noutputs) {
-		gpio = mi->output_gpios[out];
-		if (gpio_keypad_flags & GPIOKPF_DRIVE_INACTIVE)
-			gpio_set_value(gpio, polarity);
-		else
-			gpio_direction_output(gpio, polarity);
-		hrtimer_start(timer, mi->settle_time, HRTIMER_MODE_REL);
-		return HRTIMER_NORESTART;
-	}
-	if (gpio_keypad_flags & GPIOKPF_DEBOUNCE) {
-		if (kp->key_state_changed) {
-			hrtimer_start(&kp->timer, mi->debounce_delay,
-				      HRTIMER_MODE_REL);
-			return HRTIMER_NORESTART;
-		}
-		kp->key_state_changed = kp->last_key_state_changed;
-	}
-	if (kp->key_state_changed) {
-		if (gpio_keypad_flags & GPIOKPF_REMOVE_SOME_PHANTOM_KEYS)
-			remove_phantom_keys(kp);
-		key_index = 0;
-		for (out = 0; out < mi->noutputs; out++)
-			for (in = 0; in < mi->ninputs; in++, key_index++)
-				report_key(kp, key_index, out, in);
-	}
-	if (!kp->use_irq || kp->some_keys_pressed) {
-		hrtimer_start(timer, mi->poll_time, HRTIMER_MODE_REL);
-		return HRTIMER_NORESTART;
-	}
-
-	/* No keys are pressed, reenable interrupt */
-	for (out = 0; out < mi->noutputs; out++) {
-		if (gpio_keypad_flags & GPIOKPF_DRIVE_INACTIVE)
-			gpio_set_value(mi->output_gpios[out], polarity);
-		else
-			gpio_direction_output(mi->output_gpios[out], polarity);
-	}
-	for (in = 0; in < mi->ninputs; in++)
-		enable_irq(gpio_to_irq(mi->input_gpios[in]));
-	wake_unlock(&kp->wake_lock);
-	return HRTIMER_NORESTART;
-}
-
-static irqreturn_t gpio_keypad_irq_handler(int irq_in, void *dev_id)
-{
-	int i;
-	struct gpio_kp *kp = dev_id;
-	struct gpio_event_matrix_info *mi = kp->keypad_info;
-	unsigned gpio_keypad_flags = mi->flags;
-
-	if (!kp->use_irq) /* ignore interrupt while registering the handler */
-		return IRQ_HANDLED;
-
-	for (i = 0; i < mi->ninputs; i++)
-		disable_irq_nosync(gpio_to_irq(mi->input_gpios[i]));
-	for (i = 0; i < mi->noutputs; i++) {
-		if (gpio_keypad_flags & GPIOKPF_DRIVE_INACTIVE)
-			gpio_set_value(mi->output_gpios[i],
-				!(gpio_keypad_flags & GPIOKPF_ACTIVE_HIGH));
-		else
-			gpio_direction_input(mi->output_gpios[i]);
-	}
-	wake_lock(&kp->wake_lock);
-	hrtimer_start(&kp->timer, ktime_set(0, 0), HRTIMER_MODE_REL);
-	return IRQ_HANDLED;
-}
-
-static int gpio_keypad_request_irqs(struct gpio_kp *kp)
-{
-	int i;
-	int err;
-	unsigned int irq;
-	unsigned long request_flags;
-	struct gpio_event_matrix_info *mi = kp->keypad_info;
-
-	switch (mi->flags & (GPIOKPF_ACTIVE_HIGH|GPIOKPF_LEVEL_TRIGGERED_IRQ)) {
-	default:
-		request_flags = IRQF_TRIGGER_FALLING;
-		break;
-	case GPIOKPF_ACTIVE_HIGH:
-		request_flags = IRQF_TRIGGER_RISING;
-		break;
-	case GPIOKPF_LEVEL_TRIGGERED_IRQ:
-		request_flags = IRQF_TRIGGER_LOW;
-		break;
-	case GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_ACTIVE_HIGH:
-		request_flags = IRQF_TRIGGER_HIGH;
-		break;
-	}
-
-	for (i = 0; i < mi->ninputs; i++) {
-		err = irq = gpio_to_irq(mi->input_gpios[i]);
-		if (err < 0)
-			goto err_gpio_get_irq_num_failed;
-		err = request_irq(irq, gpio_keypad_irq_handler, request_flags,
-				  "gpio_kp", kp);
-		if (err) {
-			pr_err("gpiomatrix: request_irq failed for input %d, "
-				"irq %d\n", mi->input_gpios[i], irq);
-			goto err_request_irq_failed;
-		}
-		err = set_irq_wake(irq, 1);
-		if (err) {
-			pr_err("gpiomatrix: set_irq_wake failed for input %d, "
-				"irq %d\n", mi->input_gpios[i], irq);
-		}
-		disable_irq(irq);
-	}
-	return 0;
-
-	for (i = mi->noutputs - 1; i >= 0; i--) {
-		free_irq(gpio_to_irq(mi->input_gpios[i]), kp);
-err_request_irq_failed:
-err_gpio_get_irq_num_failed:
-		;
-	}
-	return err;
-}
-
-int gpio_event_matrix_func(struct gpio_event_input_devs *input_devs,
-	struct gpio_event_info *info, void **data, int func)
-{
-	int i;
-	int err;
-	int key_count;
-	struct gpio_kp *kp;
-	struct gpio_event_matrix_info *mi;
-
-	mi = container_of(info, struct gpio_event_matrix_info, info);
-	if (func == GPIO_EVENT_FUNC_SUSPEND || func == GPIO_EVENT_FUNC_RESUME) {
-		/* TODO: disable scanning */
-		return 0;
-	}
-
-	if (func == GPIO_EVENT_FUNC_INIT) {
-		if (mi->keymap == NULL ||
-		   mi->input_gpios == NULL ||
-		   mi->output_gpios == NULL) {
-			err = -ENODEV;
-			pr_err("gpiomatrix: Incomplete pdata\n");
-			goto err_invalid_platform_data;
-		}
-		key_count = mi->ninputs * mi->noutputs;
-
-		*data = kp = kzalloc(sizeof(*kp) + sizeof(kp->keys_pressed[0]) *
-				     BITS_TO_LONGS(key_count), GFP_KERNEL);
-		if (kp == NULL) {
-			err = -ENOMEM;
-			pr_err("gpiomatrix: Failed to allocate private data\n");
-			goto err_kp_alloc_failed;
-		}
-		kp->input_devs = input_devs;
-		kp->keypad_info = mi;
-		for (i = 0; i < key_count; i++) {
-			unsigned short keyentry = mi->keymap[i];
-			unsigned short keycode = keyentry & MATRIX_KEY_MASK;
-			unsigned short dev = keyentry >> MATRIX_CODE_BITS;
-			if (dev >= input_devs->count) {
-				pr_err("gpiomatrix: bad device index %d >= "
-					"%d for key code %d\n",
-					dev, input_devs->count, keycode);
-				err = -EINVAL;
-				goto err_bad_keymap;
-			}
-			if (keycode && keycode <= KEY_MAX)
-				input_set_capability(input_devs->dev[dev],
-							EV_KEY, keycode);
-		}
-
-		for (i = 0; i < mi->noutputs; i++) {
-			if (gpio_cansleep(mi->output_gpios[i])) {
-				pr_err("gpiomatrix: unsupported output gpio %d,"
-					" can sleep\n", mi->output_gpios[i]);
-				err = -EINVAL;
-				goto err_request_output_gpio_failed;
-			}
-			err = gpio_request(mi->output_gpios[i], "gpio_kp_out");
-			if (err) {
-				pr_err("gpiomatrix: gpio_request failed for "
-					"output %d\n", mi->output_gpios[i]);
-				goto err_request_output_gpio_failed;
-			}
-			if (mi->flags & GPIOKPF_DRIVE_INACTIVE)
-				err = gpio_direction_output(mi->output_gpios[i],
-					!(mi->flags & GPIOKPF_ACTIVE_HIGH));
-			else
-				err = gpio_direction_input(mi->output_gpios[i]);
-			if (err) {
-				pr_err("gpiomatrix: gpio_configure failed for "
-					"output %d\n", mi->output_gpios[i]);
-				goto err_output_gpio_configure_failed;
-			}
-		}
-		for (i = 0; i < mi->ninputs; i++) {
-			err = gpio_request(mi->input_gpios[i], "gpio_kp_in");
-			if (err) {
-				pr_err("gpiomatrix: gpio_request failed for "
-					"input %d\n", mi->input_gpios[i]);
-				goto err_request_input_gpio_failed;
-			}
-			err = gpio_direction_input(mi->input_gpios[i]);
-			if (err) {
-				pr_err("gpiomatrix: gpio_direction_input failed"
-					" for input %d\n", mi->input_gpios[i]);
-				goto err_gpio_direction_input_failed;
-			}
-		}
-		kp->current_output = mi->noutputs;
-		kp->key_state_changed = 1;
-
-		hrtimer_init(&kp->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-		kp->timer.function = gpio_keypad_timer_func;
-		wake_lock_init(&kp->wake_lock, WAKE_LOCK_SUSPEND, "gpio_kp");
-		err = gpio_keypad_request_irqs(kp);
-		kp->use_irq = err == 0;
-
-		pr_info("GPIO Matrix Keypad Driver: Start keypad matrix for "
-			"%s%s in %s mode\n", input_devs->dev[0]->name,
-			(input_devs->count > 1) ? "..." : "",
-			kp->use_irq ? "interrupt" : "polling");
-
-		if (kp->use_irq)
-			wake_lock(&kp->wake_lock);
-		hrtimer_start(&kp->timer, ktime_set(0, 0), HRTIMER_MODE_REL);
-
-		return 0;
-	}
-
-	err = 0;
-	kp = *data;
-
-	if (kp->use_irq)
-		for (i = mi->noutputs - 1; i >= 0; i--)
-			free_irq(gpio_to_irq(mi->input_gpios[i]), kp);
-
-	hrtimer_cancel(&kp->timer);
-	wake_lock_destroy(&kp->wake_lock);
-	for (i = mi->noutputs - 1; i >= 0; i--) {
-err_gpio_direction_input_failed:
-		gpio_free(mi->input_gpios[i]);
-err_request_input_gpio_failed:
-		;
-	}
-	for (i = mi->noutputs - 1; i >= 0; i--) {
-err_output_gpio_configure_failed:
-		gpio_free(mi->output_gpios[i]);
-err_request_output_gpio_failed:
-		;
-	}
-err_bad_keymap:
-	kfree(kp);
-err_kp_alloc_failed:
-err_invalid_platform_data:
-	return err;
-}
diff --git a/drivers/input/misc/gpio_output.c b/drivers/input/misc/gpio_output.c
deleted file mode 100644
index 2aac2fa..0000000
--- a/drivers/input/misc/gpio_output.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* drivers/input/misc/gpio_output.c
- *
- * Copyright (C) 2007 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/gpio.h>
-#include <linux/gpio_event.h>
-
-int gpio_event_output_event(
-	struct gpio_event_input_devs *input_devs, struct gpio_event_info *info,
-	void **data, unsigned int dev, unsigned int type,
-	unsigned int code, int value)
-{
-	int i;
-	struct gpio_event_output_info *oi;
-	oi = container_of(info, struct gpio_event_output_info, info);
-	if (type != oi->type)
-		return 0;
-	if (!(oi->flags & GPIOEDF_ACTIVE_HIGH))
-		value = !value;
-	for (i = 0; i < oi->keymap_size; i++)
-		if (dev == oi->keymap[i].dev && code == oi->keymap[i].code)
-			gpio_set_value(oi->keymap[i].gpio, value);
-	return 0;
-}
-
-int gpio_event_output_func(
-	struct gpio_event_input_devs *input_devs, struct gpio_event_info *info,
-	void **data, int func)
-{
-	int ret;
-	int i;
-	struct gpio_event_output_info *oi;
-	oi = container_of(info, struct gpio_event_output_info, info);
-
-	if (func == GPIO_EVENT_FUNC_SUSPEND || func == GPIO_EVENT_FUNC_RESUME)
-		return 0;
-
-	if (func == GPIO_EVENT_FUNC_INIT) {
-		int output_level = !(oi->flags & GPIOEDF_ACTIVE_HIGH);
-
-		for (i = 0; i < oi->keymap_size; i++) {
-			int dev = oi->keymap[i].dev;
-			if (dev >= input_devs->count) {
-				pr_err("gpio_event_output_func: bad device "
-					"index %d >= %d for key code %d\n",
-					dev, input_devs->count,
-					oi->keymap[i].code);
-				ret = -EINVAL;
-				goto err_bad_keymap;
-			}
-			input_set_capability(input_devs->dev[dev], oi->type,
-					     oi->keymap[i].code);
-		}
-
-		for (i = 0; i < oi->keymap_size; i++) {
-			ret = gpio_request(oi->keymap[i].gpio,
-					   "gpio_event_output");
-			if (ret) {
-				pr_err("gpio_event_output_func: gpio_request "
-					"failed for %d\n", oi->keymap[i].gpio);
-				goto err_gpio_request_failed;
-			}
-			ret = gpio_direction_output(oi->keymap[i].gpio,
-						    output_level);
-			if (ret) {
-				pr_err("gpio_event_output_func: "
-					"gpio_direction_output failed for %d\n",
-					oi->keymap[i].gpio);
-				goto err_gpio_direction_output_failed;
-			}
-		}
-		return 0;
-	}
-
-	ret = 0;
-	for (i = oi->keymap_size - 1; i >= 0; i--) {
-err_gpio_direction_output_failed:
-		gpio_free(oi->keymap[i].gpio);
-err_gpio_request_failed:
-		;
-	}
-err_bad_keymap:
-	return ret;
-}
-
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 3c49e49..438e477 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -27,7 +27,7 @@ obj-$(CONFIG_TOUCHSCREEN_HP7XX)		+= jornada720_ts.o
 obj-$(CONFIG_TOUCHSCREEN_HTCPEN)	+= htcpen.o
 obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE)	+= usbtouchscreen.o
 obj-$(CONFIG_TOUCHSCREEN_PENMOUNT)	+= penmount.o
-obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI)	+= synaptics_i2c_rmi.o
+obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI)	+= ../../staging/dream/synaptics_i2c_rmi.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213)	+= touchit213.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT)	+= touchright.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN)	+= touchwin.o
diff --git a/drivers/input/touchscreen/synaptics_i2c_rmi.c b/drivers/input/touchscreen/synaptics_i2c_rmi.c
deleted file mode 100644
index f37c0c0..0000000
--- a/drivers/input/touchscreen/synaptics_i2c_rmi.c
+++ /dev/null
@@ -1,674 +0,0 @@
-/* drivers/input/keyboard/synaptics_i2c_rmi.c
- *
- * Copyright (C) 2007 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/earlysuspend.h>
-#include <linux/hrtimer.h>
-#include <linux/i2c.h>
-#include <linux/input.h>
-#include <linux/interrupt.h>
-#include <linux/io.h>
-#include <linux/platform_device.h>
-#include <linux/synaptics_i2c_rmi.h>
-
-static struct workqueue_struct *synaptics_wq;
-
-struct synaptics_ts_data {
-	uint16_t addr;
-	struct i2c_client *client;
-	struct input_dev *input_dev;
-	int use_irq;
-	bool has_relative_report;
-	struct hrtimer timer;
-	struct work_struct  work;
-	uint16_t max[2];
-	int snap_state[2][2];
-	int snap_down_on[2];
-	int snap_down_off[2];
-	int snap_up_on[2];
-	int snap_up_off[2];
-	int snap_down[2];
-	int snap_up[2];
-	uint32_t flags;
-	int reported_finger_count;
-	int8_t sensitivity_adjust;
-	int (*power)(int on);
-	struct early_suspend early_suspend;
-};
-
-#ifdef CONFIG_HAS_EARLYSUSPEND
-static void synaptics_ts_early_suspend(struct early_suspend *h);
-static void synaptics_ts_late_resume(struct early_suspend *h);
-#endif
-
-static int synaptics_init_panel(struct synaptics_ts_data *ts)
-{
-	int ret;
-
-	ret = i2c_smbus_write_byte_data(ts->client, 0xff, 0x10); /* page select = 0x10 */
-	if (ret < 0) {
-		printk(KERN_ERR "i2c_smbus_write_byte_data failed for page select\n");
-		goto err_page_select_failed;
-	}
-	ret = i2c_smbus_write_byte_data(ts->client, 0x41, 0x04); /* Set "No Clip Z" */
-	if (ret < 0)
-		printk(KERN_ERR "i2c_smbus_write_byte_data failed for No Clip Z\n");
-
-	ret = i2c_smbus_write_byte_data(ts->client, 0x44,
-					ts->sensitivity_adjust);
-	if (ret < 0)
-		pr_err("synaptics_ts: failed to set Sensitivity Adjust\n");
-
-err_page_select_failed:
-	ret = i2c_smbus_write_byte_data(ts->client, 0xff, 0x04); /* page select = 0x04 */
-	if (ret < 0)
-		printk(KERN_ERR "i2c_smbus_write_byte_data failed for page select\n");
-	ret = i2c_smbus_write_byte_data(ts->client, 0xf0, 0x81); /* normal operation, 80 reports per second */
-	if (ret < 0)
-		printk(KERN_ERR "synaptics_ts_resume: i2c_smbus_write_byte_data failed\n");
-	return ret;
-}
-
-static void synaptics_ts_work_func(struct work_struct *work)
-{
-	int i;
-	int ret;
-	int bad_data = 0;
-	struct i2c_msg msg[2];
-	uint8_t start_reg;
-	uint8_t buf[15];
-	struct synaptics_ts_data *ts = container_of(work, struct synaptics_ts_data, work);
-	int buf_len = ts->has_relative_report ? 15 : 13;
-
-	msg[0].addr = ts->client->addr;
-	msg[0].flags = 0;
-	msg[0].len = 1;
-	msg[0].buf = &start_reg;
-	start_reg = 0x00;
-	msg[1].addr = ts->client->addr;
-	msg[1].flags = I2C_M_RD;
-	msg[1].len = buf_len;
-	msg[1].buf = buf;
-
-	/* printk("synaptics_ts_work_func\n"); */
-	for (i = 0; i < ((ts->use_irq && !bad_data) ? 1 : 10); i++) {
-		ret = i2c_transfer(ts->client->adapter, msg, 2);
-		if (ret < 0) {
-			printk(KERN_ERR "synaptics_ts_work_func: i2c_transfer failed\n");
-			bad_data = 1;
-		} else {
-			/* printk("synaptics_ts_work_func: %x %x %x %x %x %x" */
-			/*        " %x %x %x %x %x %x %x %x %x, ret %d\n", */
-			/*        buf[0], buf[1], buf[2], buf[3], */
-			/*        buf[4], buf[5], buf[6], buf[7], */
-			/*        buf[8], buf[9], buf[10], buf[11], */
-			/*        buf[12], buf[13], buf[14], ret); */
-			if ((buf[buf_len - 1] & 0xc0) != 0x40) {
-				printk(KERN_WARNING "synaptics_ts_work_func:"
-				       " bad read %x %x %x %x %x %x %x %x %x"
-				       " %x %x %x %x %x %x, ret %d\n",
-				       buf[0], buf[1], buf[2], buf[3],
-				       buf[4], buf[5], buf[6], buf[7],
-				       buf[8], buf[9], buf[10], buf[11],
-				       buf[12], buf[13], buf[14], ret);
-				if (bad_data)
-					synaptics_init_panel(ts);
-				bad_data = 1;
-				continue;
-			}
-			bad_data = 0;
-			if ((buf[buf_len - 1] & 1) == 0) {
-				/* printk("read %d coordinates\n", i); */
-				break;
-			} else {
-				int pos[2][2];
-				int f, a;
-				int base;
-				/* int x = buf[3] | (uint16_t)(buf[2] & 0x1f) << 8; */
-				/* int y = buf[5] | (uint16_t)(buf[4] & 0x1f) << 8; */
-				int z = buf[1];
-				int w = buf[0] >> 4;
-				int finger = buf[0] & 7;
-
-				/* int x2 = buf[3+6] | (uint16_t)(buf[2+6] & 0x1f) << 8; */
-				/* int y2 = buf[5+6] | (uint16_t)(buf[4+6] & 0x1f) << 8; */
-				/* int z2 = buf[1+6]; */
-				/* int w2 = buf[0+6] >> 4; */
-				/* int finger2 = buf[0+6] & 7; */
-
-				/* int dx = (int8_t)buf[12]; */
-				/* int dy = (int8_t)buf[13]; */
-				int finger2_pressed;
-
-				/* printk("x %4d, y %4d, z %3d, w %2d, F %d, 2nd: x %4d, y %4d, z %3d, w %2d, F %d, dx %4d, dy %4d\n", */
-				/*	x, y, z, w, finger, */
-				/*	x2, y2, z2, w2, finger2, */
-				/*	dx, dy); */
-
-				base = 2;
-				for (f = 0; f < 2; f++) {
-					uint32_t flip_flag = SYNAPTICS_FLIP_X;
-					for (a = 0; a < 2; a++) {
-						int p = buf[base + 1];
-						p |= (uint16_t)(buf[base] & 0x1f) << 8;
-						if (ts->flags & flip_flag)
-							p = ts->max[a] - p;
-						if (ts->flags & SYNAPTICS_SNAP_TO_INACTIVE_EDGE) {
-							if (ts->snap_state[f][a]) {
-								if (p <= ts->snap_down_off[a])
-									p = ts->snap_down[a];
-								else if (p >= ts->snap_up_off[a])
-									p = ts->snap_up[a];
-								else
-									ts->snap_state[f][a] = 0;
-							} else {
-								if (p <= ts->snap_down_on[a]) {
-									p = ts->snap_down[a];
-									ts->snap_state[f][a] = 1;
-								} else if (p >= ts->snap_up_on[a]) {
-									p = ts->snap_up[a];
-									ts->snap_state[f][a] = 1;
-								}
-							}
-						}
-						pos[f][a] = p;
-						base += 2;
-						flip_flag <<= 1;
-					}
-					base += 2;
-					if (ts->flags & SYNAPTICS_SWAP_XY)
-						swap(pos[f][0], pos[f][1]);
-				}
-				if (z) {
-					input_report_abs(ts->input_dev, ABS_X, pos[0][0]);
-					input_report_abs(ts->input_dev, ABS_Y, pos[0][1]);
-				}
-				input_report_abs(ts->input_dev, ABS_PRESSURE, z);
-				input_report_abs(ts->input_dev, ABS_TOOL_WIDTH, w);
-				input_report_key(ts->input_dev, BTN_TOUCH, finger);
-				finger2_pressed = finger > 1 && finger != 7;
-				input_report_key(ts->input_dev, BTN_2, finger2_pressed);
-				if (finger2_pressed) {
-					input_report_abs(ts->input_dev, ABS_HAT0X, pos[1][0]);
-					input_report_abs(ts->input_dev, ABS_HAT0Y, pos[1][1]);
-				}
-
-				if (!finger)
-					z = 0;
-				input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, z);
-				input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);
-				input_report_abs(ts->input_dev, ABS_MT_POSITION_X, pos[0][0]);
-				input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, pos[0][1]);
-				input_mt_sync(ts->input_dev);
-				if (finger2_pressed) {
-					input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, z);
-					input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);
-					input_report_abs(ts->input_dev, ABS_MT_POSITION_X, pos[1][0]);
-					input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, pos[1][1]);
-					input_mt_sync(ts->input_dev);
-				} else if (ts->reported_finger_count > 1) {
-					input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0);
-					input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0);
-					input_mt_sync(ts->input_dev);
-				}
-				ts->reported_finger_count = finger;
-				input_sync(ts->input_dev);
-			}
-		}
-	}
-	if (ts->use_irq)
-		enable_irq(ts->client->irq);
-}
-
-static enum hrtimer_restart synaptics_ts_timer_func(struct hrtimer *timer)
-{
-	struct synaptics_ts_data *ts = container_of(timer, struct synaptics_ts_data, timer);
-	/* printk("synaptics_ts_timer_func\n"); */
-
-	queue_work(synaptics_wq, &ts->work);
-
-	hrtimer_start(&ts->timer, ktime_set(0, 12500000), HRTIMER_MODE_REL);
-	return HRTIMER_NORESTART;
-}
-
-static irqreturn_t synaptics_ts_irq_handler(int irq, void *dev_id)
-{
-	struct synaptics_ts_data *ts = dev_id;
-
-	/* printk("synaptics_ts_irq_handler\n"); */
-	disable_irq_nosync(ts->client->irq);
-	queue_work(synaptics_wq, &ts->work);
-	return IRQ_HANDLED;
-}
-
-static int synaptics_ts_probe(
-	struct i2c_client *client, const struct i2c_device_id *id)
-{
-	struct synaptics_ts_data *ts;
-	uint8_t buf0[4];
-	uint8_t buf1[8];
-	struct i2c_msg msg[2];
-	int ret = 0;
-	uint16_t max_x, max_y;
-	int fuzz_x, fuzz_y, fuzz_p, fuzz_w;
-	struct synaptics_i2c_rmi_platform_data *pdata;
-	unsigned long irqflags;
-	int inactive_area_left;
-	int inactive_area_right;
-	int inactive_area_top;
-	int inactive_area_bottom;
-	int snap_left_on;
-	int snap_left_off;
-	int snap_right_on;
-	int snap_right_off;
-	int snap_top_on;
-	int snap_top_off;
-	int snap_bottom_on;
-	int snap_bottom_off;
-	uint32_t panel_version;
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		printk(KERN_ERR "synaptics_ts_probe: need I2C_FUNC_I2C\n");
-		ret = -ENODEV;
-		goto err_check_functionality_failed;
-	}
-
-	ts = kzalloc(sizeof(*ts), GFP_KERNEL);
-	if (ts == NULL) {
-		ret = -ENOMEM;
-		goto err_alloc_data_failed;
-	}
-	INIT_WORK(&ts->work, synaptics_ts_work_func);
-	ts->client = client;
-	i2c_set_clientdata(client, ts);
-	pdata = client->dev.platform_data;
-	if (pdata)
-		ts->power = pdata->power;
-	if (ts->power) {
-		ret = ts->power(1);
-		if (ret < 0) {
-			printk(KERN_ERR "synaptics_ts_probe power on failed\n");
-			goto err_power_failed;
-		}
-	}
-
-	ret = i2c_smbus_write_byte_data(ts->client, 0xf4, 0x01); /* device command = reset */
-	if (ret < 0) {
-		printk(KERN_ERR "i2c_smbus_write_byte_data failed\n");
-		/* fail? */
-	}
-	{
-		int retry = 10;
-		while (retry-- > 0) {
-			ret = i2c_smbus_read_byte_data(ts->client, 0xe4);
-			if (ret >= 0)
-				break;
-			msleep(100);
-		}
-	}
-	if (ret < 0) {
-		printk(KERN_ERR "i2c_smbus_read_byte_data failed\n");
-		goto err_detect_failed;
-	}
-	printk(KERN_INFO "synaptics_ts_probe: Product Major Version %x\n", ret);
-	panel_version = ret << 8;
-	ret = i2c_smbus_read_byte_data(ts->client, 0xe5);
-	if (ret < 0) {
-		printk(KERN_ERR "i2c_smbus_read_byte_data failed\n");
-		goto err_detect_failed;
-	}
-	printk(KERN_INFO "synaptics_ts_probe: Product Minor Version %x\n", ret);
-	panel_version |= ret;
-
-	ret = i2c_smbus_read_byte_data(ts->client, 0xe3);
-	if (ret < 0) {
-		printk(KERN_ERR "i2c_smbus_read_byte_data failed\n");
-		goto err_detect_failed;
-	}
-	printk(KERN_INFO "synaptics_ts_probe: product property %x\n", ret);
-
-	if (pdata) {
-		while (pdata->version > panel_version)
-			pdata++;
-		ts->flags = pdata->flags;
-		ts->sensitivity_adjust = pdata->sensitivity_adjust;
-		irqflags = pdata->irqflags;
-		inactive_area_left = pdata->inactive_left;
-		inactive_area_right = pdata->inactive_right;
-		inactive_area_top = pdata->inactive_top;
-		inactive_area_bottom = pdata->inactive_bottom;
-		snap_left_on = pdata->snap_left_on;
-		snap_left_off = pdata->snap_left_off;
-		snap_right_on = pdata->snap_right_on;
-		snap_right_off = pdata->snap_right_off;
-		snap_top_on = pdata->snap_top_on;
-		snap_top_off = pdata->snap_top_off;
-		snap_bottom_on = pdata->snap_bottom_on;
-		snap_bottom_off = pdata->snap_bottom_off;
-		fuzz_x = pdata->fuzz_x;
-		fuzz_y = pdata->fuzz_y;
-		fuzz_p = pdata->fuzz_p;
-		fuzz_w = pdata->fuzz_w;
-	} else {
-		irqflags = 0;
-		inactive_area_left = 0;
-		inactive_area_right = 0;
-		inactive_area_top = 0;
-		inactive_area_bottom = 0;
-		snap_left_on = 0;
-		snap_left_off = 0;
-		snap_right_on = 0;
-		snap_right_off = 0;
-		snap_top_on = 0;
-		snap_top_off = 0;
-		snap_bottom_on = 0;
-		snap_bottom_off = 0;
-		fuzz_x = 0;
-		fuzz_y = 0;
-		fuzz_p = 0;
-		fuzz_w = 0;
-	}
-
-	ret = i2c_smbus_read_byte_data(ts->client, 0xf0);
-	if (ret < 0) {
-		printk(KERN_ERR "i2c_smbus_read_byte_data failed\n");
-		goto err_detect_failed;
-	}
-	printk(KERN_INFO "synaptics_ts_probe: device control %x\n", ret);
-
-	ret = i2c_smbus_read_byte_data(ts->client, 0xf1);
-	if (ret < 0) {
-		printk(KERN_ERR "i2c_smbus_read_byte_data failed\n");
-		goto err_detect_failed;
-	}
-	printk(KERN_INFO "synaptics_ts_probe: interrupt enable %x\n", ret);
-
-	ret = i2c_smbus_write_byte_data(ts->client, 0xf1, 0); /* disable interrupt */
-	if (ret < 0) {
-		printk(KERN_ERR "i2c_smbus_write_byte_data failed\n");
-		goto err_detect_failed;
-	}
-
-	msg[0].addr = ts->client->addr;
-	msg[0].flags = 0;
-	msg[0].len = 1;
-	msg[0].buf = buf0;
-	buf0[0] = 0xe0;
-	msg[1].addr = ts->client->addr;
-	msg[1].flags = I2C_M_RD;
-	msg[1].len = 8;
-	msg[1].buf = buf1;
-	ret = i2c_transfer(ts->client->adapter, msg, 2);
-	if (ret < 0) {
-		printk(KERN_ERR "i2c_transfer failed\n");
-		goto err_detect_failed;
-	}
-	printk(KERN_INFO "synaptics_ts_probe: 0xe0: %x %x %x %x %x %x %x %x\n",
-	       buf1[0], buf1[1], buf1[2], buf1[3],
-	       buf1[4], buf1[5], buf1[6], buf1[7]);
-
-	ret = i2c_smbus_write_byte_data(ts->client, 0xff, 0x10); /* page select = 0x10 */
-	if (ret < 0) {
-		printk(KERN_ERR "i2c_smbus_write_byte_data failed for page select\n");
-		goto err_detect_failed;
-	}
-	ret = i2c_smbus_read_word_data(ts->client, 0x02);
-	if (ret < 0) {
-		printk(KERN_ERR "i2c_smbus_read_word_data failed\n");
-		goto err_detect_failed;
-	}
-	ts->has_relative_report = !(ret & 0x100);
-	printk(KERN_INFO "synaptics_ts_probe: Sensor properties %x\n", ret);
-	ret = i2c_smbus_read_word_data(ts->client, 0x04);
-	if (ret < 0) {
-		printk(KERN_ERR "i2c_smbus_read_word_data failed\n");
-		goto err_detect_failed;
-	}
-	ts->max[0] = max_x = (ret >> 8 & 0xff) | ((ret & 0x1f) << 8);
-	ret = i2c_smbus_read_word_data(ts->client, 0x06);
-	if (ret < 0) {
-		printk(KERN_ERR "i2c_smbus_read_word_data failed\n");
-		goto err_detect_failed;
-	}
-	ts->max[1] = max_y = (ret >> 8 & 0xff) | ((ret & 0x1f) << 8);
-	if (ts->flags & SYNAPTICS_SWAP_XY)
-		swap(max_x, max_y);
-
-	ret = synaptics_init_panel(ts); /* will also switch back to page 0x04 */
-	if (ret < 0) {
-		printk(KERN_ERR "synaptics_init_panel failed\n");
-		goto err_detect_failed;
-	}
-
-	ts->input_dev = input_allocate_device();
-	if (ts->input_dev == NULL) {
-		ret = -ENOMEM;
-		printk(KERN_ERR "synaptics_ts_probe: Failed to allocate input device\n");
-		goto err_input_dev_alloc_failed;
-	}
-	ts->input_dev->name = "synaptics-rmi-touchscreen";
-	set_bit(EV_SYN, ts->input_dev->evbit);
-	set_bit(EV_KEY, ts->input_dev->evbit);
-	set_bit(BTN_TOUCH, ts->input_dev->keybit);
-	set_bit(BTN_2, ts->input_dev->keybit);
-	set_bit(EV_ABS, ts->input_dev->evbit);
-	inactive_area_left = inactive_area_left * max_x / 0x10000;
-	inactive_area_right = inactive_area_right * max_x / 0x10000;
-	inactive_area_top = inactive_area_top * max_y / 0x10000;
-	inactive_area_bottom = inactive_area_bottom * max_y / 0x10000;
-	snap_left_on = snap_left_on * max_x / 0x10000;
-	snap_left_off = snap_left_off * max_x / 0x10000;
-	snap_right_on = snap_right_on * max_x / 0x10000;
-	snap_right_off = snap_right_off * max_x / 0x10000;
-	snap_top_on = snap_top_on * max_y / 0x10000;
-	snap_top_off = snap_top_off * max_y / 0x10000;
-	snap_bottom_on = snap_bottom_on * max_y / 0x10000;
-	snap_bottom_off = snap_bottom_off * max_y / 0x10000;
-	fuzz_x = fuzz_x * max_x / 0x10000;
-	fuzz_y = fuzz_y * max_y / 0x10000;
-	ts->snap_down[!!(ts->flags & SYNAPTICS_SWAP_XY)] = -inactive_area_left;
-	ts->snap_up[!!(ts->flags & SYNAPTICS_SWAP_XY)] = max_x + inactive_area_right;
-	ts->snap_down[!(ts->flags & SYNAPTICS_SWAP_XY)] = -inactive_area_top;
-	ts->snap_up[!(ts->flags & SYNAPTICS_SWAP_XY)] = max_y + inactive_area_bottom;
-	ts->snap_down_on[!!(ts->flags & SYNAPTICS_SWAP_XY)] = snap_left_on;
-	ts->snap_down_off[!!(ts->flags & SYNAPTICS_SWAP_XY)] = snap_left_off;
-	ts->snap_up_on[!!(ts->flags & SYNAPTICS_SWAP_XY)] = max_x - snap_right_on;
-	ts->snap_up_off[!!(ts->flags & SYNAPTICS_SWAP_XY)] = max_x - snap_right_off;
-	ts->snap_down_on[!(ts->flags & SYNAPTICS_SWAP_XY)] = snap_top_on;
-	ts->snap_down_off[!(ts->flags & SYNAPTICS_SWAP_XY)] = snap_top_off;
-	ts->snap_up_on[!(ts->flags & SYNAPTICS_SWAP_XY)] = max_y - snap_bottom_on;
-	ts->snap_up_off[!(ts->flags & SYNAPTICS_SWAP_XY)] = max_y - snap_bottom_off;
-	printk(KERN_INFO "synaptics_ts_probe: max_x %d, max_y %d\n", max_x, max_y);
-	printk(KERN_INFO "synaptics_ts_probe: inactive_x %d %d, inactive_y %d %d\n",
-	       inactive_area_left, inactive_area_right,
-	       inactive_area_top, inactive_area_bottom);
-	printk(KERN_INFO "synaptics_ts_probe: snap_x %d-%d %d-%d, snap_y %d-%d %d-%d\n",
-	       snap_left_on, snap_left_off, snap_right_on, snap_right_off,
-	       snap_top_on, snap_top_off, snap_bottom_on, snap_bottom_off);
-	input_set_abs_params(ts->input_dev, ABS_X, -inactive_area_left, max_x + inactive_area_right, fuzz_x, 0);
-	input_set_abs_params(ts->input_dev, ABS_Y, -inactive_area_top, max_y + inactive_area_bottom, fuzz_y, 0);
-	input_set_abs_params(ts->input_dev, ABS_PRESSURE, 0, 255, fuzz_p, 0);
-	input_set_abs_params(ts->input_dev, ABS_TOOL_WIDTH, 0, 15, fuzz_w, 0);
-	input_set_abs_params(ts->input_dev, ABS_HAT0X, -inactive_area_left, max_x + inactive_area_right, fuzz_x, 0);
-	input_set_abs_params(ts->input_dev, ABS_HAT0Y, -inactive_area_top, max_y + inactive_area_bottom, fuzz_y, 0);
-	input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, -inactive_area_left, max_x + inactive_area_right, fuzz_x, 0);
-	input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, -inactive_area_top, max_y + inactive_area_bottom, fuzz_y, 0);
-	input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, fuzz_p, 0);
-	input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 15, fuzz_w, 0);
-	/* ts->input_dev->name = ts->keypad_info->name; */
-	ret = input_register_device(ts->input_dev);
-	if (ret) {
-		printk(KERN_ERR "synaptics_ts_probe: Unable to register %s input device\n", ts->input_dev->name);
-		goto err_input_register_device_failed;
-	}
-	if (client->irq) {
-		ret = request_irq(client->irq, synaptics_ts_irq_handler, irqflags, client->name, ts);
-		if (ret == 0) {
-			ret = i2c_smbus_write_byte_data(ts->client, 0xf1, 0x01); /* enable abs int */
-			if (ret)
-				free_irq(client->irq, ts);
-		}
-		if (ret == 0)
-			ts->use_irq = 1;
-		else
-			dev_err(&client->dev, "request_irq failed\n");
-	}
-	if (!ts->use_irq) {
-		hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-		ts->timer.function = synaptics_ts_timer_func;
-		hrtimer_start(&ts->timer, ktime_set(1, 0), HRTIMER_MODE_REL);
-	}
-#ifdef CONFIG_HAS_EARLYSUSPEND
-	ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
-	ts->early_suspend.suspend = synaptics_ts_early_suspend;
-	ts->early_suspend.resume = synaptics_ts_late_resume;
-	register_early_suspend(&ts->early_suspend);
-#endif
-
-	printk(KERN_INFO "synaptics_ts_probe: Start touchscreen %s in %s mode\n", ts->input_dev->name, ts->use_irq ? "interrupt" : "polling");
-
-	return 0;
-
-err_input_register_device_failed:
-	input_free_device(ts->input_dev);
-
-err_input_dev_alloc_failed:
-err_detect_failed:
-err_power_failed:
-	kfree(ts);
-err_alloc_data_failed:
-err_check_functionality_failed:
-	return ret;
-}
-
-static int synaptics_ts_remove(struct i2c_client *client)
-{
-	struct synaptics_ts_data *ts = i2c_get_clientdata(client);
-	unregister_early_suspend(&ts->early_suspend);
-	if (ts->use_irq)
-		free_irq(client->irq, ts);
-	else
-		hrtimer_cancel(&ts->timer);
-	input_unregister_device(ts->input_dev);
-	kfree(ts);
-	return 0;
-}
-
-static int synaptics_ts_suspend(struct i2c_client *client, pm_message_t mesg)
-{
-	int ret;
-	struct synaptics_ts_data *ts = i2c_get_clientdata(client);
-
-	if (ts->use_irq)
-		disable_irq(client->irq);
-	else
-		hrtimer_cancel(&ts->timer);
-	ret = cancel_work_sync(&ts->work);
-	if (ret && ts->use_irq) /* if work was pending disable-count is now 2 */
-		enable_irq(client->irq);
-	ret = i2c_smbus_write_byte_data(ts->client, 0xf1, 0); /* disable interrupt */
-	if (ret < 0)
-		printk(KERN_ERR "synaptics_ts_suspend: i2c_smbus_write_byte_data failed\n");
-
-	ret = i2c_smbus_write_byte_data(client, 0xf0, 0x86); /* deep sleep */
-	if (ret < 0)
-		printk(KERN_ERR "synaptics_ts_suspend: i2c_smbus_write_byte_data failed\n");
-	if (ts->power) {
-		ret = ts->power(0);
-		if (ret < 0)
-			printk(KERN_ERR "synaptics_ts_resume power off failed\n");
-	}
-	return 0;
-}
-
-static int synaptics_ts_resume(struct i2c_client *client)
-{
-	int ret;
-	struct synaptics_ts_data *ts = i2c_get_clientdata(client);
-
-	if (ts->power) {
-		ret = ts->power(1);
-		if (ret < 0)
-			printk(KERN_ERR "synaptics_ts_resume power on failed\n");
-	}
-
-	synaptics_init_panel(ts);
-
-	if (ts->use_irq)
-		enable_irq(client->irq);
-
-	if (!ts->use_irq)
-		hrtimer_start(&ts->timer, ktime_set(1, 0), HRTIMER_MODE_REL);
-	else
-		i2c_smbus_write_byte_data(ts->client, 0xf1, 0x01); /* enable abs int */
-
-	return 0;
-}
-
-#ifdef CONFIG_HAS_EARLYSUSPEND
-static void synaptics_ts_early_suspend(struct early_suspend *h)
-{
-	struct synaptics_ts_data *ts;
-	ts = container_of(h, struct synaptics_ts_data, early_suspend);
-	synaptics_ts_suspend(ts->client, PMSG_SUSPEND);
-}
-
-static void synaptics_ts_late_resume(struct early_suspend *h)
-{
-	struct synaptics_ts_data *ts;
-	ts = container_of(h, struct synaptics_ts_data, early_suspend);
-	synaptics_ts_resume(ts->client);
-}
-#endif
-
-static const struct i2c_device_id synaptics_ts_id[] = {
-	{ SYNAPTICS_I2C_RMI_NAME, 0 },
-	{ }
-};
-
-static struct i2c_driver synaptics_ts_driver = {
-	.probe		= synaptics_ts_probe,
-	.remove		= synaptics_ts_remove,
-#ifndef CONFIG_HAS_EARLYSUSPEND
-	.suspend	= synaptics_ts_suspend,
-	.resume		= synaptics_ts_resume,
-#endif
-	.id_table	= synaptics_ts_id,
-	.driver = {
-		.name	= SYNAPTICS_I2C_RMI_NAME,
-	},
-};
-
-static int __devinit synaptics_ts_init(void)
-{
-	synaptics_wq = create_singlethread_workqueue("synaptics_wq");
-	if (!synaptics_wq)
-		return -ENOMEM;
-	return i2c_add_driver(&synaptics_ts_driver);
-}
-
-static void __exit synaptics_ts_exit(void)
-{
-	i2c_del_driver(&synaptics_ts_driver);
-	if (synaptics_wq)
-		destroy_workqueue(synaptics_wq);
-}
-
-module_init(synaptics_ts_init);
-module_exit(synaptics_ts_exit);
-
-MODULE_DESCRIPTION("Synaptics Touchscreen Driver");
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/dream/gpio_axis.c b/drivers/staging/dream/gpio_axis.c
index c801172..30b9f56 100644
--- a/drivers/staging/dream/gpio_axis.c
+++ b/drivers/staging/dream/gpio_axis.c
@@ -19,7 +19,7 @@
 #include <linux/interrupt.h>
 
 struct gpio_axis_state {
-	struct input_dev *input_dev;
+	struct gpio_event_input_devs *input_devs;
 	struct gpio_event_axis_info *info;
 	uint32_t pos;
 };
@@ -87,14 +87,16 @@ static void gpio_event_update_axis(struct gpio_axis_state *as, int report)
 			if (ai->flags & GPIOEAF_PRINT_EVENT)
 				pr_info("axis %d-%d change %d\n",
 					ai->type, ai->code, change);
-			input_report_rel(as->input_dev, ai->code, change);
+			input_report_rel(as->input_devs->dev[ai->dev],
+						ai->code, change);
 		} else {
 			if (ai->flags & GPIOEAF_PRINT_EVENT)
 				pr_info("axis %d-%d now %d\n",
 					ai->type, ai->code, pos);
-			input_event(as->input_dev, ai->type, ai->code, pos);
+			input_event(as->input_devs->dev[ai->dev],
+					ai->type, ai->code, pos);
 		}
-		input_sync(as->input_dev);
+		input_sync(as->input_devs->dev[ai->dev]);
 	}
 	as->pos = pos;
 }
@@ -106,7 +108,7 @@ static irqreturn_t gpio_axis_irq_handler(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-int gpio_event_axis_func(struct input_dev *input_dev,
+int gpio_event_axis_func(struct gpio_event_input_devs *input_devs,
 			 struct gpio_event_info *info, void **data, int func)
 {
 	int ret;
@@ -133,13 +135,21 @@ int gpio_event_axis_func(struct input_dev *input_dev,
 			ret = -ENOMEM;
 			goto err_alloc_axis_state_failed;
 		}
-		as->input_dev = input_dev;
+		as->input_devs = input_devs;
 		as->info = ai;
+		if (ai->dev >= input_devs->count) {
+			pr_err("gpio_event_axis: bad device index %d >= %d "
+				"for %d:%d\n", ai->dev, input_devs->count,
+				ai->type, ai->code);
+			ret = -EINVAL;
+			goto err_bad_device_index;
+		}
 
-		input_set_capability(input_dev, ai->type, ai->code);
+		input_set_capability(input_devs->dev[ai->dev],
+				     ai->type, ai->code);
 		if (ai->type == EV_ABS) {
-			input_set_abs_params(input_dev, ai->code, 0,
-					     ai->decoded_size - 1, 0, 0);
+			input_set_abs_params(input_devs->dev[ai->dev], ai->code,
+					     0, ai->decoded_size - 1, 0, 0);
 		}
 		for (i = 0; i < ai->count; i++) {
 			ret = gpio_request(ai->gpio[i], "gpio_event_axis");
@@ -173,6 +183,7 @@ err_gpio_direction_input_failed:
 err_request_gpio_failed:
 		;
 	}
+err_bad_device_index:
 	kfree(as);
 	*data = NULL;
 err_alloc_axis_state_failed:
diff --git a/drivers/staging/dream/gpio_event.c b/drivers/staging/dream/gpio_event.c
index 8b64c1e..139b360 100644
--- a/drivers/staging/dream/gpio_event.c
+++ b/drivers/staging/dream/gpio_event.c
@@ -21,7 +21,7 @@
 #include <linux/platform_device.h>
 
 struct gpio_event {
-	struct input_dev *input_dev;
+	struct gpio_event_input_devs *input_devs;
 	const struct gpio_event_platform_data *info;
 	struct early_suspend early_suspend;
 	void *state[0];
@@ -31,15 +31,25 @@ static int gpio_input_event(
 	struct input_dev *dev, unsigned int type, unsigned int code, int value)
 {
 	int i;
+	int devnr;
 	int ret = 0;
 	int tmp_ret;
 	struct gpio_event_info **ii;
 	struct gpio_event *ip = input_get_drvdata(dev);
 
+	for (devnr = 0; devnr < ip->input_devs->count; devnr++)
+		if (ip->input_devs->dev[devnr] == dev)
+			break;
+	if (devnr == ip->input_devs->count) {
+		pr_err("gpio_input_event: unknown device %p\n", dev);
+		return -EIO;
+	}
+
 	for (i = 0, ii = ip->info->info; i < ip->info->info_count; i++, ii++) {
 		if ((*ii)->event) {
-			tmp_ret = (*ii)->event(ip->input_dev, *ii,
-					&ip->state[i], type, code, value);
+			tmp_ret = (*ii)->event(ip->input_devs, *ii,
+						&ip->state[i],
+						devnr, type, code, value);
 			if (tmp_ret)
 				ret = tmp_ret;
 		}
@@ -62,7 +72,9 @@ static int gpio_event_call_all_func(struct gpio_event *ip, int func)
 					"no function\n");
 				goto err_no_func;
 			}
-			ret = (*ii)->func(ip->input_dev, *ii, &ip->state[i],
+			if (func == GPIO_EVENT_FUNC_RESUME && (*ii)->no_suspend)
+				continue;
+			ret = (*ii)->func(ip->input_devs, *ii, &ip->state[i],
 					  func);
 			if (ret) {
 				pr_err("gpio_event_probe: function failed\n");
@@ -78,7 +90,9 @@ static int gpio_event_call_all_func(struct gpio_event *ip, int func)
 	while (i > 0) {
 		i--;
 		ii--;
-		(*ii)->func(ip->input_dev, *ii, &ip->state[i], func & ~1);
+		if ((func & ~1) == GPIO_EVENT_FUNC_SUSPEND && (*ii)->no_suspend)
+			continue;
+		(*ii)->func(ip->input_devs, *ii, &ip->state[i], func & ~1);
 err_func_failed:
 err_no_func:
 		;
@@ -108,37 +122,51 @@ static int __init gpio_event_probe(struct platform_device *pdev)
 {
 	int err;
 	struct gpio_event *ip;
-	struct input_dev *input_dev;
 	struct gpio_event_platform_data *event_info;
+	int dev_count = 1;
+	int i;
+	int registered = 0;
 
 	event_info = pdev->dev.platform_data;
 	if (event_info == NULL) {
 		pr_err("gpio_event_probe: No pdata\n");
 		return -ENODEV;
 	}
-	if (event_info->name == NULL ||
-	   event_info->info == NULL ||
-	   event_info->info_count == 0) {
+	if ((!event_info->name && !event_info->names[0]) ||
+	    !event_info->info || !event_info->info_count) {
 		pr_err("gpio_event_probe: Incomplete pdata\n");
 		return -ENODEV;
 	}
+	if (!event_info->name)
+		while (event_info->names[dev_count])
+			dev_count++;
 	ip = kzalloc(sizeof(*ip) +
-		     sizeof(ip->state[0]) * event_info->info_count, GFP_KERNEL);
+		     sizeof(ip->state[0]) * event_info->info_count +
+		     sizeof(*ip->input_devs) +
+		     sizeof(ip->input_devs->dev[0]) * dev_count, GFP_KERNEL);
 	if (ip == NULL) {
 		err = -ENOMEM;
 		pr_err("gpio_event_probe: Failed to allocate private data\n");
 		goto err_kp_alloc_failed;
 	}
+	ip->input_devs = (void*)&ip->state[event_info->info_count];
 	platform_set_drvdata(pdev, ip);
 
-	input_dev = input_allocate_device();
-	if (input_dev == NULL) {
-		err = -ENOMEM;
-		pr_err("gpio_event_probe: Failed to allocate input device\n");
-		goto err_input_dev_alloc_failed;
+	for (i = 0; i < dev_count; i++) {
+		struct input_dev *input_dev = input_allocate_device();
+		if (input_dev == NULL) {
+			err = -ENOMEM;
+			pr_err("gpio_event_probe: "
+				"Failed to allocate input device\n");
+			goto err_input_dev_alloc_failed;
+		}
+		input_set_drvdata(input_dev, ip);
+		input_dev->name = event_info->name ?
+					event_info->name : event_info->names[i];
+		input_dev->event = gpio_input_event;
+		ip->input_devs->dev[i] = input_dev;
 	}
-	input_set_drvdata(input_dev, ip);
-	ip->input_dev = input_dev;
+	ip->input_devs->count = dev_count;
 	ip->info = event_info;
 	if (event_info->power) {
 #ifdef CONFIG_HAS_EARLYSUSPEND
@@ -150,18 +178,18 @@ static int __init gpio_event_probe(struct platform_device *pdev)
 		ip->info->power(ip->info, 1);
 	}
 
-	input_dev->name = ip->info->name;
-	input_dev->event = gpio_input_event;
-
 	err = gpio_event_call_all_func(ip, GPIO_EVENT_FUNC_INIT);
 	if (err)
 		goto err_call_all_func_failed;
 
-	err = input_register_device(input_dev);
-	if (err) {
-		pr_err("gpio_event_probe: Unable to register %s input device\n",
-			input_dev->name);
-		goto err_input_register_device_failed;
+	for (i = 0; i < dev_count; i++) {
+		err = input_register_device(ip->input_devs->dev[i]);
+		if (err) {
+			pr_err("gpio_event_probe: Unable to register %s "
+				"input device\n", ip->input_devs->dev[i]->name);
+			goto err_input_register_device_failed;
+		}
+		registered++;
 	}
 
 	return 0;
@@ -175,8 +203,13 @@ err_call_all_func_failed:
 #endif
 		ip->info->power(ip->info, 0);
 	}
-	input_free_device(input_dev);
+	for (i = 0; i < registered; i++)
+		input_unregister_device(ip->input_devs->dev[i]);
+	for (i = dev_count - 1; i >= registered; i--) {
+		input_free_device(ip->input_devs->dev[i]);
 err_input_dev_alloc_failed:
+		;
+	}
 	kfree(ip);
 err_kp_alloc_failed:
 	return err;
@@ -185,6 +218,7 @@ err_kp_alloc_failed:
 static int gpio_event_remove(struct platform_device *pdev)
 {
 	struct gpio_event *ip = platform_get_drvdata(pdev);
+	int i;
 
 	gpio_event_call_all_func(ip, GPIO_EVENT_FUNC_UNINIT);
 	if (ip->info->power) {
@@ -193,7 +227,8 @@ static int gpio_event_remove(struct platform_device *pdev)
 #endif
 		ip->info->power(ip->info, 0);
 	}
-	input_unregister_device(ip->input_dev);
+	for (i = 0; i < ip->input_devs->count; i++)
+		input_unregister_device(ip->input_devs->dev[i]);
 	kfree(ip);
 	return 0;
 }
diff --git a/drivers/staging/dream/gpio_input.c b/drivers/staging/dream/gpio_input.c
index 7e307f2..7e66f8c 100644
--- a/drivers/staging/dream/gpio_input.c
+++ b/drivers/staging/dream/gpio_input.c
@@ -38,7 +38,7 @@ struct gpio_key_state {
 };
 
 struct gpio_input_state {
-	struct input_dev *input_dev;
+	struct gpio_event_input_devs *input_devs;
 	const struct gpio_event_input_info *info;
 	struct hrtimer timer;
 	int use_irq;
@@ -126,7 +126,7 @@ static enum hrtimer_restart gpio_event_input_timer_func(struct hrtimer *timer)
 			pr_info("gpio_keys_scan_keys: key %x-%x, %d (%d) "
 				"changed to %d\n", ds->info->type,
 				key_entry->code, i, key_entry->gpio, pressed);
-		input_event(ds->input_dev, ds->info->type,
+		input_event(ds->input_devs->dev[key_entry->dev], ds->info->type,
 			    key_entry->code, pressed);
 	}
 
@@ -181,7 +181,7 @@ static irqreturn_t gpio_event_input_irq_handler(int irq, void *dev_id)
 					ds->info->type, key_entry->code,
 					keymap_index, key_entry->gpio);
 		} else {
-			disable_irq(irq);
+			disable_irq_nosync(irq);
 			ks->debounce = DEBOUNCE_UNSTABLE;
 		}
 		spin_unlock_irqrestore(&ds->irq_lock, irqflags);
@@ -193,7 +193,7 @@ static irqreturn_t gpio_event_input_irq_handler(int irq, void *dev_id)
 				"(%d) changed to %d\n",
 				ds->info->type, key_entry->code, keymap_index,
 				key_entry->gpio, pressed);
-		input_event(ds->input_dev, ds->info->type,
+		input_event(ds->input_devs->dev[key_entry->dev], ds->info->type,
 			    key_entry->code, pressed);
 	}
 	return IRQ_HANDLED;
@@ -232,7 +232,7 @@ err_gpio_get_irq_num_failed:
 	return err;
 }
 
-int gpio_event_input_func(struct input_dev *input_dev,
+int gpio_event_input_func(struct gpio_event_input_devs *input_devs,
 			struct gpio_event_info *info, void **data, int func)
 {
 	int ret;
@@ -244,11 +244,9 @@ int gpio_event_input_func(struct input_dev *input_dev,
 	di = container_of(info, struct gpio_event_input_info, info);
 
 	if (func == GPIO_EVENT_FUNC_SUSPEND) {
-		spin_lock_irqsave(&ds->irq_lock, irqflags);
 		if (ds->use_irq)
 			for (i = 0; i < di->keymap_size; i++)
 				disable_irq(gpio_to_irq(di->keymap[i].gpio));
-		spin_unlock_irqrestore(&ds->irq_lock, irqflags);
 		hrtimer_cancel(&ds->timer);
 		return 0;
 	}
@@ -275,13 +273,22 @@ int gpio_event_input_func(struct input_dev *input_dev,
 			goto err_ds_alloc_failed;
 		}
 		ds->debounce_count = di->keymap_size;
-		ds->input_dev = input_dev;
+		ds->input_devs = input_devs;
 		ds->info = di;
 		wake_lock_init(&ds->wake_lock, WAKE_LOCK_SUSPEND, "gpio_input");
 		spin_lock_init(&ds->irq_lock);
 
 		for (i = 0; i < di->keymap_size; i++) {
-			input_set_capability(input_dev, di->type,
+			int dev = di->keymap[i].dev;
+			if (dev >= input_devs->count) {
+				pr_err("gpio_event_input_func: bad device "
+					"index %d >= %d for key code %d\n",
+					dev, input_devs->count,
+					di->keymap[i].code);
+				ret = -EINVAL;
+				goto err_bad_keymap;
+			}
+			input_set_capability(input_devs->dev[dev], di->type,
 					     di->keymap[i].code);
 			ds->key_state[i].ds = ds;
 			ds->key_state[i].debounce = DEBOUNCE_UNKNOWN;
@@ -308,9 +315,10 @@ int gpio_event_input_func(struct input_dev *input_dev,
 		spin_lock_irqsave(&ds->irq_lock, irqflags);
 		ds->use_irq = ret == 0;
 
-		pr_info("GPIO Input Driver: Start gpio inputs for %s in %s "
-			"mode\n",
-			input_dev->name, ret == 0 ? "interrupt" : "polling");
+		pr_info("GPIO Input Driver: Start gpio inputs for %s%s in %s "
+			"mode\n", input_devs->dev[0]->name,
+			(input_devs->count > 1) ? "..." : "",
+			ret == 0 ? "interrupt" : "polling");
 
 		hrtimer_init(&ds->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 		ds->timer.function = gpio_event_input_timer_func;
@@ -336,6 +344,7 @@ err_gpio_configure_failed:
 err_gpio_request_failed:
 		;
 	}
+err_bad_keymap:
 	wake_lock_destroy(&ds->wake_lock);
 	kfree(ds);
 err_ds_alloc_failed:
diff --git a/drivers/staging/dream/gpio_matrix.c b/drivers/staging/dream/gpio_matrix.c
index c1f4765..90866c4 100644
--- a/drivers/staging/dream/gpio_matrix.c
+++ b/drivers/staging/dream/gpio_matrix.c
@@ -21,7 +21,7 @@
 #include <linux/wakelock.h>
 
 struct gpio_kp {
-	struct input_dev *input_dev;
+	struct gpio_event_input_devs *input_devs;
 	struct gpio_event_matrix_info *keypad_info;
 	struct hrtimer timer;
 	struct wake_lock wake_lock;
@@ -37,9 +37,11 @@ static void clear_phantom_key(struct gpio_kp *kp, int out, int in)
 {
 	struct gpio_event_matrix_info *mi = kp->keypad_info;
 	int key_index = out * mi->ninputs + in;
-	unsigned short keycode = mi->keymap[key_index];;
+	unsigned short keyentry = mi->keymap[key_index];
+	unsigned short keycode = keyentry & MATRIX_KEY_MASK;
+	unsigned short dev = keyentry >> MATRIX_CODE_BITS;
 
-	if (!test_bit(keycode, kp->input_dev->key)) {
+	if (!test_bit(keycode, kp->input_devs->dev[dev]->key)) {
 		if (mi->flags & GPIOKPF_PRINT_PHANTOM_KEYS)
 			pr_info("gpiomatrix: phantom key %x, %d-%d (%d-%d) "
 				"cleared\n", keycode, out, in,
@@ -104,8 +106,11 @@ static void report_key(struct gpio_kp *kp, int key_index, int out, int in)
 {
 	struct gpio_event_matrix_info *mi = kp->keypad_info;
 	int pressed = test_bit(key_index, kp->keys_pressed);
-	unsigned short keycode = mi->keymap[key_index];
-	if (pressed != test_bit(keycode, kp->input_dev->key)) {
+	unsigned short keyentry = mi->keymap[key_index];
+	unsigned short keycode = keyentry & MATRIX_KEY_MASK;
+	unsigned short dev = keyentry >> MATRIX_CODE_BITS;
+
+	if (pressed != test_bit(keycode, kp->input_devs->dev[dev]->key)) {
 		if (keycode == KEY_RESERVED) {
 			if (mi->flags & GPIOKPF_PRINT_UNMAPPED_KEYS)
 				pr_info("gpiomatrix: unmapped key, %d-%d "
@@ -118,7 +123,7 @@ static void report_key(struct gpio_kp *kp, int key_index, int out, int in)
 					"changed to %d\n", keycode,
 					out, in, mi->output_gpios[out],
 					mi->input_gpios[in], pressed);
-			input_report_key(kp->input_dev, keycode, pressed);
+			input_report_key(kp->input_devs->dev[dev], keycode, pressed);
 		}
 	}
 }
@@ -214,7 +219,7 @@ static irqreturn_t gpio_keypad_irq_handler(int irq_in, void *dev_id)
 		return IRQ_HANDLED;
 
 	for (i = 0; i < mi->ninputs; i++)
-		disable_irq(gpio_to_irq(mi->input_gpios[i]));
+		disable_irq_nosync(gpio_to_irq(mi->input_gpios[i]));
 	for (i = 0; i < mi->noutputs; i++) {
 		if (gpio_keypad_flags & GPIOKPF_DRIVE_INACTIVE)
 			gpio_set_value(mi->output_gpios[i],
@@ -279,7 +284,7 @@ err_gpio_get_irq_num_failed:
 	return err;
 }
 
-int gpio_event_matrix_func(struct input_dev *input_dev,
+int gpio_event_matrix_func(struct gpio_event_input_devs *input_devs,
 	struct gpio_event_info *info, void **data, int func)
 {
 	int i;
@@ -311,13 +316,22 @@ int gpio_event_matrix_func(struct input_dev *input_dev,
 			pr_err("gpiomatrix: Failed to allocate private data\n");
 			goto err_kp_alloc_failed;
 		}
-		kp->input_dev = input_dev;
+		kp->input_devs = input_devs;
 		kp->keypad_info = mi;
-		set_bit(EV_KEY, input_dev->evbit);
 		for (i = 0; i < key_count; i++) {
-			if (mi->keymap[i])
-				set_bit(mi->keymap[i] & KEY_MAX,
-					input_dev->keybit);
+			unsigned short keyentry = mi->keymap[i];
+			unsigned short keycode = keyentry & MATRIX_KEY_MASK;
+			unsigned short dev = keyentry >> MATRIX_CODE_BITS;
+			if (dev >= input_devs->count) {
+				pr_err("gpiomatrix: bad device index %d >= "
+					"%d for key code %d\n",
+					dev, input_devs->count, keycode);
+				err = -EINVAL;
+				goto err_bad_keymap;
+			}
+			if (keycode && keycode <= KEY_MAX)
+				input_set_capability(input_devs->dev[dev],
+							EV_KEY, keycode);
 		}
 
 		for (i = 0; i < mi->noutputs; i++) {
@@ -367,8 +381,9 @@ int gpio_event_matrix_func(struct input_dev *input_dev,
 		err = gpio_keypad_request_irqs(kp);
 		kp->use_irq = err == 0;
 
-		pr_info("GPIO Matrix Keypad Driver: Start keypad matrix for %s "
-			"in %s mode\n", input_dev->name,
+		pr_info("GPIO Matrix Keypad Driver: Start keypad matrix for "
+			"%s%s in %s mode\n", input_devs->dev[0]->name,
+			(input_devs->count > 1) ? "..." : "",
 			kp->use_irq ? "interrupt" : "polling");
 
 		if (kp->use_irq)
@@ -399,6 +414,7 @@ err_output_gpio_configure_failed:
 err_request_output_gpio_failed:
 		;
 	}
+err_bad_keymap:
 	kfree(kp);
 err_kp_alloc_failed:
 err_invalid_platform_data:
diff --git a/drivers/staging/dream/gpio_output.c b/drivers/staging/dream/gpio_output.c
index 6f8453c..2aac2fa 100644
--- a/drivers/staging/dream/gpio_output.c
+++ b/drivers/staging/dream/gpio_output.c
@@ -18,8 +18,9 @@
 #include <linux/gpio_event.h>
 
 int gpio_event_output_event(
-	struct input_dev *input_dev, struct gpio_event_info *info, void **data,
-	unsigned int type, unsigned int code, int value)
+	struct gpio_event_input_devs *input_devs, struct gpio_event_info *info,
+	void **data, unsigned int dev, unsigned int type,
+	unsigned int code, int value)
 {
 	int i;
 	struct gpio_event_output_info *oi;
@@ -29,14 +30,14 @@ int gpio_event_output_event(
 	if (!(oi->flags & GPIOEDF_ACTIVE_HIGH))
 		value = !value;
 	for (i = 0; i < oi->keymap_size; i++)
-		if (code == oi->keymap[i].code)
+		if (dev == oi->keymap[i].dev && code == oi->keymap[i].code)
 			gpio_set_value(oi->keymap[i].gpio, value);
 	return 0;
 }
 
 int gpio_event_output_func(
-	struct input_dev *input_dev, struct gpio_event_info *info, void **data,
-	int func)
+	struct gpio_event_input_devs *input_devs, struct gpio_event_info *info,
+	void **data, int func)
 {
 	int ret;
 	int i;
@@ -48,9 +49,20 @@ int gpio_event_output_func(
 
 	if (func == GPIO_EVENT_FUNC_INIT) {
 		int output_level = !(oi->flags & GPIOEDF_ACTIVE_HIGH);
-		for (i = 0; i < oi->keymap_size; i++)
-			input_set_capability(input_dev, oi->type,
+
+		for (i = 0; i < oi->keymap_size; i++) {
+			int dev = oi->keymap[i].dev;
+			if (dev >= input_devs->count) {
+				pr_err("gpio_event_output_func: bad device "
+					"index %d >= %d for key code %d\n",
+					dev, input_devs->count,
+					oi->keymap[i].code);
+				ret = -EINVAL;
+				goto err_bad_keymap;
+			}
+			input_set_capability(input_devs->dev[dev], oi->type,
 					     oi->keymap[i].code);
+		}
 
 		for (i = 0; i < oi->keymap_size; i++) {
 			ret = gpio_request(oi->keymap[i].gpio,
@@ -79,6 +91,7 @@ err_gpio_direction_output_failed:
 err_gpio_request_failed:
 		;
 	}
+err_bad_keymap:
 	return ret;
 }
 


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-27 21:13                       ` Pavel Machek
  2009-12-27 21:53                         ` Pavel Machek
@ 2009-12-28  0:46                         ` Brian Swetland
  2009-12-27 10:18                           ` Pavel Machek
  1 sibling, 1 reply; 38+ messages in thread
From: Brian Swetland @ 2009-12-28  0:46 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Arve Hj?nnev?g, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

On Sun, Dec 27, 2009 at 1:13 PM, Pavel Machek <pavel@ucw.cz> wrote:
>
> Switch smd code to the version in staging. Something to apply to
> dream/ tree I'd say... and yes, it still works.

Hi Pavel,

I think we might want to consider leaving at least the core smd code
under mach-msm.

To start with it's specific to the 7k/8k platform, not dream (though
that may just be a quirk of how things are named in staging).  Also
the lowest layers (proc_comm and smsm_state stuff) are required for
clock control and basic power management to work -- they're kinda
joined at the hip with the platform.  It seems weird to me to have the
necessary bits to implement clock/power/pm outside of the mach/arch
space.

The higher level stuff (qmi, rpcrouter, smdtty, etc) could easily live
elsewhere (though I'm not sure where the best space in the drivers
hierarchy for them would be).

Brian

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-27 10:18                           ` Pavel Machek
@ 2009-12-28 20:24                             ` Brian Swetland
  2009-12-28 20:48                               ` Pavel Machek
  0 siblings, 1 reply; 38+ messages in thread
From: Brian Swetland @ 2009-12-28 20:24 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Arve Hj?nnev?g, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

On Sun, Dec 27, 2009 at 2:18 AM, Pavel Machek <pavel@ucw.cz> wrote:
> Hi!
>
>> > Switch smd code to the version in staging. Something to apply to
>> > dream/ tree I'd say... and yes, it still works.
>>
>> I think we might want to consider leaving at least the core smd code
>> under mach-msm.
>
> In the long run, I agree.
>
> In the short run... the code is staging quality, so it should be in
> staging... and you'll not have to mainain so huge diff. (-20 kLoc).

The core smd stuff is really not that large.  The central smd.[ch] are
about 1300 lines, and proc_comm.[ch] are about 400 lines.  Is it
possible to get some review/feedback as to what's "staging quality"
about this code so we can clean it up?  I'd rather just fix the issues
and get the core stuff in there so clock, power, etc support is there
for the platform rather than have it live in staging purgatory.

Since this stuff is integral to mach-msm, required for essential
operation of the platform, and makes sense to be part of the mach-msm
codebase, why not just fix it there rather than move it out into
staging and then back?  I'm not sure what that gains us.

Brian

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-28 20:24                             ` Brian Swetland
@ 2009-12-28 20:48                               ` Pavel Machek
  2009-12-28 20:52                                 ` Pavel Machek
                                                   ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Pavel Machek @ 2009-12-28 20:48 UTC (permalink / raw)
  To: Brian Swetland
  Cc: Arve Hj?nnev?g, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

Hi!

> >> > Switch smd code to the version in staging. Something to apply to
> >> > dream/ tree I'd say... and yes, it still works.
> >>
> >> I think we might want to consider leaving at least the core smd code
> >> under mach-msm.
> >
> > In the long run, I agree.
> >
> > In the short run... the code is staging quality, so it should be in
> > staging... and you'll not have to mainain so huge diff. (-20 kLoc).
> 
> The core smd stuff is really not that large.  The central smd.[ch] are
> about 1300 lines, and proc_comm.[ch] are about 400 lines.  Is it
> possible to get some review/feedback as to what's "staging quality"
> about this code so we can clean it up?  I'd rather just fix the
> issues

Just submit it to Daniel W., ccing rmk and l-a-k, and I'm sure you'll
get feedback.

For a start, checkpatch has some mild complains. 

> and get the core stuff in there so clock, power, etc support is there
> for the platform rather than have it live in staging purgatory.
> 
> Since this stuff is integral to mach-msm, required for essential
> operation of the platform, and makes sense to be part of the mach-msm
> codebase, why not just fix it there rather than move it out into
> staging and then back?  I'm not sure what that gains us.

Well, it is in staging now. I just want you to use the existing
version, instead of adding another one.

Of course, getting it into kernel proper would be even better. I'll
gladly help but I did not have yet time/energy to do that.

								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-28 20:48                               ` Pavel Machek
@ 2009-12-28 20:52                                 ` Pavel Machek
  2009-12-28 21:08                                 ` Brian Swetland
  2009-12-29  1:25                                 ` Daniel Walker
  2 siblings, 0 replies; 38+ messages in thread
From: Pavel Machek @ 2009-12-28 20:52 UTC (permalink / raw)
  To: Brian Swetland
  Cc: Arve Hj?nnev?g, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

On Mon 2009-12-28 21:48:48, Pavel Machek wrote:
> Hi!
> 
> > >> > Switch smd code to the version in staging. Something to apply to
> > >> > dream/ tree I'd say... and yes, it still works.
> > >>
> > >> I think we might want to consider leaving at least the core smd code
> > >> under mach-msm.
> > >
> > > In the long run, I agree.
> > >
> > > In the short run... the code is staging quality, so it should be in
> > > staging... and you'll not have to mainain so huge diff. (-20 kLoc).
> > 
> > The core smd stuff is really not that large.  The central smd.[ch] are
> > about 1300 lines, and proc_comm.[ch] are about 400 lines.  Is it
> > possible to get some review/feedback as to what's "staging quality"
> > about this code so we can clean it up?  I'd rather just fix the
> > issues
> 
> Just submit it to Daniel W., ccing rmk and l-a-k, and I'm sure you'll
> get feedback.
> 
> For a start, checkpatch has some mild complains. 

BTW if would be cool to fix style in the staging/, then do git mv, so
that cleanups are clearly separated/changelogged in kernel proper... 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-28 20:48                               ` Pavel Machek
  2009-12-28 20:52                                 ` Pavel Machek
@ 2009-12-28 21:08                                 ` Brian Swetland
  2010-01-01 14:54                                   ` Pavel Machek
  2009-12-29  1:25                                 ` Daniel Walker
  2 siblings, 1 reply; 38+ messages in thread
From: Brian Swetland @ 2009-12-28 21:08 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Arve Hjønnevåg, Daniel Walker, kernel list,
	linux-arm-kernel, Iliyan Malchev, Greg KH

On Mon, Dec 28, 2009 at 12:48 PM, Pavel Machek <pavel@ucw.cz> wrote:
>> > In the short run... the code is staging quality, so it should be in
>> > staging... and you'll not have to mainain so huge diff. (-20 kLoc).
>>
>> The core smd stuff is really not that large.  The central smd.[ch] are
>> about 1300 lines, and proc_comm.[ch] are about 400 lines.  Is it
>> possible to get some review/feedback as to what's "staging quality"
>> about this code so we can clean it up?  I'd rather just fix the
>> issues
>
> Just submit it to Daniel W., ccing rmk and l-a-k, and I'm sure you'll
> get feedback.
>
> For a start, checkpatch has some mild complains.
>
>> and get the core stuff in there so clock, power, etc support is there
>> for the platform rather than have it live in staging purgatory.
>>
>> Since this stuff is integral to mach-msm, required for essential
>> operation of the platform, and makes sense to be part of the mach-msm
>> codebase, why not just fix it there rather than move it out into
>> staging and then back?  I'm not sure what that gains us.
>
> Well, it is in staging now. I just want you to use the existing
> version, instead of adding another one.

I'm trying to understand where the version in staging came from, how
it's been changed, etc, so I can resolve that against what we have
that's known good and shipping today and make sure we're not losing
bugfixes and such along the way.

Do you remember where the smd code that you put into staging came
from, exactly?  Unfortunately since things have been moved, modified,
renamed, etc, getting clean diffs is a bit of an adventure right now.

When I'm back in the office (on vacation at the moment, trying to stay
caught up on email though) I'll have to start figuring out what went
where and how different it is from what we have today, say in Arve's
.33 based tree.

Brian

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-28 20:48                               ` Pavel Machek
  2009-12-28 20:52                                 ` Pavel Machek
  2009-12-28 21:08                                 ` Brian Swetland
@ 2009-12-29  1:25                                 ` Daniel Walker
  2010-01-01 15:18                                   ` Pavel Machek
  2 siblings, 1 reply; 38+ messages in thread
From: Daniel Walker @ 2009-12-29  1:25 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Brian Swetland, Arve Hj?nnev?g, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

On Mon, 2009-12-28 at 21:48 +0100, Pavel Machek wrote:
> Hi!
> 
> > >> > Switch smd code to the version in staging. Something to apply to
> > >> > dream/ tree I'd say... and yes, it still works.
> > >>
> > >> I think we might want to consider leaving at least the core smd code
> > >> under mach-msm.
> > >
> > > In the long run, I agree.
> > >
> > > In the short run... the code is staging quality, so it should be in
> > > staging... and you'll not have to mainain so huge diff. (-20 kLoc).
> > 
> > The core smd stuff is really not that large.  The central smd.[ch] are
> > about 1300 lines, and proc_comm.[ch] are about 400 lines.  Is it
> > possible to get some review/feedback as to what's "staging quality"
> > about this code so we can clean it up?  I'd rather just fix the
> > issues
> 
> Just submit it to Daniel W., ccing rmk and l-a-k, and I'm sure you'll
> get feedback.

I have it in my tree already .. My tree has some duplication over
staging, for instance the rpc code is mostly in my tree, as is the smd
code.

Daniel


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-28 21:08                                 ` Brian Swetland
@ 2010-01-01 14:54                                   ` Pavel Machek
  0 siblings, 0 replies; 38+ messages in thread
From: Pavel Machek @ 2010-01-01 14:54 UTC (permalink / raw)
  To: Brian Swetland
  Cc: Arve Hj??nnev??g, Daniel Walker, kernel list, linux-arm-kernel,
	Iliyan Malchev, Greg KH

Hi!

(sorry for long response time, holidays with poor network connection).

> >> and get the core stuff in there so clock, power, etc support is there
> >> for the platform rather than have it live in staging purgatory.
> >>
> >> Since this stuff is integral to mach-msm, required for essential
> >> operation of the platform, and makes sense to be part of the mach-msm
> >> codebase, why not just fix it there rather than move it out into
> >> staging and then back?  I'm not sure what that gains us.
> >
> > Well, it is in staging now. I just want you to use the existing
> > version, instead of adding another one.
> 
> I'm trying to understand where the version in staging came from, how
> it's been changed, etc, so I can resolve that against what we have
> that's known good and shipping today and make sure we're not losing
> bugfixes and such along the way.

> Do you remember where the smd code that you put into staging came
> from, exactly?  Unfortunately since things have been moved, modified,
> renamed, etc, getting clean diffs is a bit of an adventure right
> now.

I believe the version in staging is from 2.6.29-msm tree. Anyway,
changes should be pretty simple to see on diff -u (I belive I tried
that at one point).
								Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2009-12-29  1:25                                 ` Daniel Walker
@ 2010-01-01 15:18                                   ` Pavel Machek
  2010-01-01 16:08                                     ` Daniel Walker
  0 siblings, 1 reply; 38+ messages in thread
From: Pavel Machek @ 2010-01-01 15:18 UTC (permalink / raw)
  To: Daniel Walker
  Cc: Brian Swetland, Arve Hj?nnev?g, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

Hi!

> > > >> > Switch smd code to the version in staging. Something to apply to
> > > >> > dream/ tree I'd say... and yes, it still works.
> > > >>
> > > >> I think we might want to consider leaving at least the core smd code
> > > >> under mach-msm.
> > > >
> > > > In the long run, I agree.
> > > >
> > > > In the short run... the code is staging quality, so it should be in
> > > > staging... and you'll not have to mainain so huge diff. (-20 kLoc).
> > > 
> > > The core smd stuff is really not that large.  The central smd.[ch] are
> > > about 1300 lines, and proc_comm.[ch] are about 400 lines.  Is it
> > > possible to get some review/feedback as to what's "staging quality"
> > > about this code so we can clean it up?  I'd rather just fix the
> > > issues
> > 
> > Just submit it to Daniel W., ccing rmk and l-a-k, and I'm sure you'll
> > get feedback.
> 
> I have it in my tree already .. My tree has some duplication over
> staging, for instance the rpc code is mostly in my tree, as is the smd
> code.

Do you expect you can just merge those for 2.6.34? That would be
great.
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2010-01-01 15:18                                   ` Pavel Machek
@ 2010-01-01 16:08                                     ` Daniel Walker
  2010-01-02 10:55                                       ` Pavel Machek
  0 siblings, 1 reply; 38+ messages in thread
From: Daniel Walker @ 2010-01-01 16:08 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Brian Swetland, Arve Hj?nnev?g, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

On Fri, 2010-01-01 at 16:18 +0100, Pavel Machek wrote:

> > I have it in my tree already .. My tree has some duplication over
> > staging, for instance the rpc code is mostly in my tree, as is the smd
> > code.
> 
> Do you expect you can just merge those for 2.6.34? That would be
> great.

I will try ..

One major thing I will not merge is the qdsp stuff .. So it's
good that it's in staging.. With that I also wanted to mention that
there is an alsa driver that (I think) uses the qdsp code.. I was
thinking that the parts of the qdsp code that the alsa driver uses we
could pull out and add into the alsa driver. Then clean up the alsa
driver..

Daniel



^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2010-01-01 16:08                                     ` Daniel Walker
@ 2010-01-02 10:55                                       ` Pavel Machek
  2010-01-05 21:31                                         ` Daniel Walker
  0 siblings, 1 reply; 38+ messages in thread
From: Pavel Machek @ 2010-01-02 10:55 UTC (permalink / raw)
  To: Daniel Walker
  Cc: Brian Swetland, Arve Hj?nnev?g, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

On Fri 2010-01-01 08:08:48, Daniel Walker wrote:
> On Fri, 2010-01-01 at 16:18 +0100, Pavel Machek wrote:
> 
> > > I have it in my tree already .. My tree has some duplication over
> > > staging, for instance the rpc code is mostly in my tree, as is the smd
> > > code.
> > 
> > Do you expect you can just merge those for 2.6.34? That would be
> > great.
> 
> I will try ..

Good.

How can I check out that tree? I tried pulling from
git://codeaurora.org/quic/kernel/dwalker/linux-msm.git , but those
changes do not seem to be there. (I tried default, master and for-next
branches).

> One major thing I will not merge is the qdsp stuff .. So it's
> good that it's in staging.. With that I also wanted to mention that
> there is an alsa driver that (I think) uses the qdsp code.. I was
> thinking that the parts of the qdsp code that the alsa driver uses we
> could pull out and add into the alsa driver. Then clean up the alsa
> driver..

I did not have chance to play with audio, yet. I believe qdsp code
should eventually end up in drivers/mfd (or something like that) --
because it does more than audio, but...

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: tree with htc dream support
  2010-01-02 10:55                                       ` Pavel Machek
@ 2010-01-05 21:31                                         ` Daniel Walker
  0 siblings, 0 replies; 38+ messages in thread
From: Daniel Walker @ 2010-01-05 21:31 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Brian Swetland, Arve Hj?nnev?g, kernel list, linux-arm-kernel,
	Iliyan Malchev, linux-kernel, Greg KH

On Sat, 2010-01-02 at 11:55 +0100, Pavel Machek wrote:
> On Fri 2010-01-01 08:08:48, Daniel Walker wrote:
> > On Fri, 2010-01-01 at 16:18 +0100, Pavel Machek wrote:
> > 
> > > > I have it in my tree already .. My tree has some duplication over
> > > > staging, for instance the rpc code is mostly in my tree, as is the smd
> > > > code.
> > > 
> > > Do you expect you can just merge those for 2.6.34? That would be
> > > great.
> > 
> > I will try ..
> 
> Good.
> 
> How can I check out that tree? I tried pulling from
> git://codeaurora.org/quic/kernel/dwalker/linux-msm.git , but those
> changes do not seem to be there. (I tried default, master and for-next
> branches).

Should be there now .. It's not history stable, or particularly useful
right now .. You can see what's in it tho ..

Daniel


^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2010-01-05 21:31 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-05 22:11 tree with htc dream support Pavel Machek
2009-12-05 23:12 ` Daniel Walker
2009-12-06  7:41   ` Pavel Machek
2009-12-06 13:51     ` Daniel Walker
2009-12-08  8:53       ` Pavel Machek
     [not found]   ` <a55d774e0912051638u7858878cg7cf62905c3c005c1@mail.gmail.com>
2009-12-06  7:43     ` Pavel Machek
2009-12-06 13:55     ` Daniel Walker
2009-12-12  5:42     ` Arve Hjønnevåg
2009-12-12 11:17       ` Pavel Machek
2009-12-12 11:25       ` Pavel Machek
2009-12-12 11:51         ` Arve Hjønnevåg
2009-12-12 12:11           ` Arve Hjønnevåg
2009-12-12 17:53         ` Pavel Machek
2009-12-12 22:41           ` Arve Hjønnevåg
2009-12-15  6:30             ` Arve Hjønnevåg
2009-12-12 14:18       ` Daniel Walker
2009-12-12 22:34         ` Arve Hjønnevåg
2009-12-13 21:25           ` Pavel Machek
2009-12-15  6:34             ` Arve Hjønnevåg
2009-12-15 22:20               ` Pavel Machek
2009-12-27  9:35               ` Pavel Machek
2009-12-27 20:15                 ` Pavel Machek
2009-12-27 20:20                   ` Brian Swetland
2009-12-27 20:37                     ` Pavel Machek
2009-12-27 21:13                       ` Pavel Machek
2009-12-27 21:53                         ` Pavel Machek
2009-12-28  0:46                         ` Brian Swetland
2009-12-27 10:18                           ` Pavel Machek
2009-12-28 20:24                             ` Brian Swetland
2009-12-28 20:48                               ` Pavel Machek
2009-12-28 20:52                                 ` Pavel Machek
2009-12-28 21:08                                 ` Brian Swetland
2010-01-01 14:54                                   ` Pavel Machek
2009-12-29  1:25                                 ` Daniel Walker
2010-01-01 15:18                                   ` Pavel Machek
2010-01-01 16:08                                     ` Daniel Walker
2010-01-02 10:55                                       ` Pavel Machek
2010-01-05 21:31                                         ` Daniel Walker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).