msm: smd_pkt: Add new SMD channels for iWLAN

Add 9 new SMD control channels to support iWLAN feature.

Change-Id: I8a1d46275cecb0344d31014976703f56f3893093
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
msm: smd_pkt: Rate limit the subsystem_get operation

SMD_PKT Driver open operation triggers modem loading procedure, by invoking
the subsystem_get operation. When the modem image is not flashed in the
target, subsystem_get operation fails which in turn causes the open
operation to fail. Everytime the subsystem_get operation fails, an error
message is logged into the kernel logs by both PIL and SMD_PKT drivers.
Under such error scenario, the user-space modules retry the open operation
in a tight loop. This causes the SMD_PKT driver to invoke subsystem_get
operation frequently. This repeated frequent failures cause frequent
logging by PIL and SMD_PKT drivers into the kernel and eventually a
watchdog bite.

When the subsystem_get operation invoked by SMD_PKT driver fails, SMD_PKT
driver to throttle the subsequent invocation of subsystem_get operation.
This will avoid the potential watchdog bite under error scenarios.

CRs-Fixed: 431153
Change-Id: Ia465856b994e1907ab3c1fb7a7ddcae4fbfb7eb2
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
msm: smd_pkt: Do not print warning message for closed case

If a closed notification is received after a port has already been
marked as closed, then a warning message is logged even though this is a
normal use case.

Remove warning message for the close event.

Change-Id: I0299df056b83f30e104699a3a09f82cdc763f5b4
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
msm: smd: add smd_write_segment_avail()

Packet based SMD channels support transactions which allow the client to
send data payloads that exceed the size of the transport buffer.
Currently clients using this feature call smd_write_avail() to determine
how much free space is available in the buffer for the next segment of the
payload.

This causes inefficencies for the client, as smd_write_avail()
reserves SMD_HEADER_SIZE bytes from the client under the assumption that
a transport level header needs to be written to the transport buffer.  If
the transaction is already started, this assumption becomes incorrect and
space that could be used by the client to reduce the number of write in
some scenarios goes unused.

Add a function to the transaction API, smd_write_segment_avail(), which
is aware of if the transport level header needs to be written or not, and
return the correct ammount of usable space to the client.  Also, convert
the current clients of the transaction API to use
smd_write_segment_avail() as necessary.

CRs-Fixed: 471277
Change-Id: Ibdacd2572fa274c971eb679bc1d60eb2a7e1cab2
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
msm: smd_pkt: add enforcement that array lengths match number of ports

Additional checks are added to enforce that ports are equal in number
to the size of their representative arrays, to provide sanity checks when
ports are added or removed.

Change-Id: I83e7d74b8c21df8e357a817b7e542006b9b675a8
Signed-off-by: Brent Hronik <bhronik@codeaurora.org>
msm: smd_pkt: add additional smdcntl devices

Additional smdcntl devices are added to support Multi RMNET feature.

Change-Id: I6e0661e06af59235cd21ad8d15ee7324c40e8660
Signed-off-by: Brent Hronik <bhronik@codeaurora.org>
msm: pm2: Restore interrupt subsystem from sleep.

Change-Id: Id5128e47e1e78688d0b608b64454555f26a65043
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
Signed-off-by: Baji Patthan <bpatth@codeaurora.org>
fix false disconnect due to a signal sent to the reading process

- In the current implementation, when a signal is sent to the reading process,
  read is cancelled by calling usb_ep_dequeue, which lead into calling
  acc_complete_out with ECONNRESET, but the current logic treats it as
  disconnection, which makes the device inaccessible until cable is actually
  disconnected.
- The fix calls disconnect only when ESHUTDOWN error is passed.
- If data has already arrived while trying cancelling, the data is marked
  as available, and it will be read out on the next read. This is necessary
  as USB bulk is assumed to guarantee no data loss.

Change-Id: I8c6c5237eed051e722eb3027c72a5ef3bf5ed33f
Signed-off-by: keunyoung <keunyoung@google.com>
ARM: msm: only create rpcrouter pdev once

Change-Id: I1e3bebe50c93eb4c4874d35d1c87ebafa4f88af5
Signed-off-by: Dima Zavin <dima@android.com> (cherry picked from commit ed0708d)
msm: remove fmem support

This functionality is deprecated and no longer supported.
kernel:sched: LOAD_FREQ (4*HZ+61) avoids loadavg Moire

http://ripke.com/loadavg/moire

LOAD_FREQ is (5*HZ+1) to avoid high load average when idle.

Tests suggest (4*HZ+61) for a better distribution.

With some seconds based load (like SSL heartbeats)
and LOAD_FREQ at (5*HZ+1) we see Moire patterns like inverse sawtooth,
since 2 or 3 probes hit the jobs (load increases quickly),
followed by several probes missing it.

A 4.61 sec interval gives optimal distribution over when within a
second a probe is taken, as .61 is close to golden ratio phi 1.618...
(test in http://ripke.com/goldenratio.c).

12*4.61 = 55.32 secs is still close to a minute,
and 13*4.61=59.93 is even closer than the current 12*5.01=60.12
(with exponents EXP_x adjusted to a ratio of 13 instead of 12).
Makefile: fix USE_CCACHE
cpufreq: update policy->util directly

Signed-off-by: moddingg33k <moddingg33k@t-online.de>
cpufreq: let cpufreq_notify_utilization() consider load...

...in relation between policy->cur & policy->max

Signed-off-by: moddingg33k <moddingg33k@t-online.de>
mach-msm: don't enforce compiling run_queue_stats module

Signed-off-by: moddingg33k <moddingg33k@t-online.de>
mach-msm: Introduce Dynamic hotplug driver for MSM

Introduce a dynamic hotplug driver to automatically online/offline
CPUs proportional to load.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
dyn_hotplug: refining conditions for hot(un)plug

Signed-off-by: moddingg33k <moddingg33k@t-online.de>
ksm: Provide support to use deferred timers for scanner thread

KSM thread to scan pages is getting schedule on definite timeout.
That wakes up CPU from idle state and hence may affect the power
consumption. Provide an optional support to use deferred timer
which suites low-power use-cases.

To enable deferred timers,
$ echo 1 > /sys/kernel/mm/ksm/deferred_timer

Change-Id: I07fe199f97fe1f72f9a9e1b0b757a3ac533719e8
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
perf/arm: Fix armpmu_map_hw_event()

Fix constraint check in armpmu_map_hw_event().

Reported-and-tested-by: Vince Weaver <vincent.weaver@maine.edu>
Cc: <stable@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Patrick Tjin <pattjin@google.com>
hrtimer: Prevent hrtimer_enqueue_reprogram race

hrtimer_enqueue_reprogram contains a race which could result in
timer.base switch during unlock/lock sequence.

hrtimer_enqueue_reprogram is releasing the lock protecting the timer
base for calling raise_softirq_irqsoff() due to a lock ordering issue
versus rq->lock.

If during that time another CPU calls __hrtimer_start_range_ns() on
the same hrtimer, the timer base might switch, before the current CPU
can lock base->lock again and therefor the unlock_timer_base() call
will unlock the wrong lock.

[ tglx: Added comment and massaged changelog ]

Change-Id: I327d862c28f24b77a62861764393c4bf660a7318
Signed-off-by: Leonid Shatz <leonid.shatz@ravellosystems.com>
Signed-off-by: Izik Eidus <izik.eidus@ravellosystems.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/1359981217-389-1-git-send-email-izik.eidus@ravellosystems.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Git-commit: b22affe0aef429d657bc6505aacb1c569340ddd2
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Taniya Das <tdas@codeaurora.org>