Low CPU Clocks: Allow ultra low CPU frequencies for better battery performance

while screen is on or background operations like audio books and music

Change-Id: Ica29c0f97ec467433a9d57c93c3fed9a86d8db4e
Signed-off-by: Paul Reioux <reioux@gmail.com>
cpufreq: allow for low CPU clock policy when hotplugging new cores

Change-Id: Ifda10f5b6cf20617bdc45e10738d52f8f77c723c
Signed-off-by: faux123 <reioux@gmail.com>
krait-defines: create a new common header file shared used by various drivers

code to help organize common MACRO definitions into 1 file

Change-Id: Icd7385d1aea3bbb49a15f1adcffc797b9bce4344
Signed-off-by: Paul Reioux <reioux@gmail.com>
defconfig: enable LOW_CPUCLOCKS

Change-Id: Id855bdacfea481c37da9d3641ad17b82939d5d66
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: I5ca061a265d79a5cb961ba444da4a88021cd04e6
Signed-off-by: keunyoung <keunyoung@google.com>
mDNIE: Fix Samsung typos for typedefs on mode and scenario names

Change-Id: I46ce20046e79baf081318a0faf6fce64e4835ce1
drivers: bcmdhd: do not create debugfs entries, half wake lock period

Change-Id: I740bdf7aadcac1559a64dc260ee550eb73861b76
bcmdhd: half the timeout from 1000ms to 500ms

Change-Id: Ia18e12bda760bdc3f3640619ae1958b95474df78
vfp: optimize flags

Change-Id: I75fa4c945fa162c03aebf31c0951757450764643
workqueues: Introduce new flag WQ_POWER_EFFICIENT for power oriented workqueues

Adapted for 3.4 from lsk-v3.10

Workqueues can be performance or power-oriented. Currently, most workqueues are
bound to the CPU they were created on. This gives good performance (due to cache
effects) at the cost of potentially waking up otherwise idle cores (Idle from
scheduler's perspective. Which may or may not be physically idle) just to
process some work. To save power, we can allow the work to be rescheduled on a
core that is already awake.

Workqueues created with the WQ_UNBOUND flag will allow some power savings.
However, we don't change the default behaviour of the system.  To enable
power-saving behaviour, a new config option CONFIG_WQ_POWER_EFFICIENT needs to
be turned on. This option can also be overridden by the
workqueue.power_efficient boot parameter.

tj: Updated config description and comments.  Renamed
    CONFIG_WQ_POWER_EFFICIENT to CONFIG_WQ_POWER_EFFICIENT_DEFAULT.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit cee22a15052faa817e3ec8985a28154d3fabc7aa)
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
Signed-off-by: poondog <markj338@gmail.com>

Change-Id: I30a41d04c69badc2ca2fa4dff98ddf88a2be36fd
workqueue: Add system wide power_efficient workqueues

Adapted for 3.4 from lsk-v3.10

This patch adds system wide workqueues aligned towards power saving. This is
done by allocating them with WQ_UNBOUND flag if 'wq_power_efficient' is set to
'true'.

tj: updated comments a bit.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 0668106ca3865ba945e155097fb042bf66d364d3)
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Luis Cruz <ljc2491@gmail.com>

Change-Id: I044be776be0f84ebb6cc7deb1d06556a55418a46
block: queue work on power efficient wq

Adapted for 3.4 from lsk-v3.10

Block layer uses workqueues for multiple purposes. There is no real dependency
of scheduling these on the cpu which scheduled them.

On a idle system, it is observed that and idle cpu wakes up many times just to
service this work. It would be better if we can schedule it on a cpu which the
scheduler believes to be the most appropriate one.

This patch replaces normal workqueues with power efficient versions.

Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 695588f9454bdbc7c1a2fbb8a6bfdcfba6183348)
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
Signed-off-by: poondog <markj338@gmail.com>

Change-Id: Ie1a34e614b70f04a83f3c7e8784625d26565b958
PHYLIB: queue work on system_power_efficient_wq

Adapted for 3.4 from lsk-v3.10

Phylib uses workqueues for multiple purposes. There is no real dependency of
scheduling these on the cpu which scheduled them.

On a idle system, it is observed that and idle cpu wakes up many times just to
service this work. It would be better if we can schedule it on a cpu which the
scheduler believes to be the most appropriate one.

This patch replaces system_wq with system_power_efficient_wq for PHYLIB.

Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit bbb47bdeae756f04b896b55b51f230f3eb21f207)
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
Signed-off-by: poondog <markj338@gmail.com>

Change-Id: Ibd4fab56ab0333ebb940eb8cd96d66dcc0aa76c1
ASoC: pcm: Use the power efficient workqueue for delayed powerdown

Adapted for 3.4 from lsk-v3.10

There is no need to use a normal per-CPU workqueue for delayed power downs
as they're not timing or performance critical and waking up a core for them
would defeat some of the point.

Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
(cherry picked from commit d4e1a73acd4e894f8332f2093bceaef585cfab67)
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
Signed-off-by: poondog <markj338@gmail.com>

Change-Id: I2e91de84cde59ff22c75dfcc49ea40a76caac0c8
ASoC: jack: Use power efficient workqueue

Adapted for 3.4 from lsk-v3.10

The accessory detect debounce work is not performance sensitive so let
the scheduler run it wherever is most efficient rather than in a per CPU
workqueue by using the system power efficient workqueue.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
(cherry picked from commit e6058aaadcd473e5827720dc143af56aabbeecc7)
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
Signed-off-by: poondog <markj338@gmail.com>

Change-Id: Id1bc555943a12dd7bdba70d0385e9c1f0cb7641a
regulator: core: Use the power efficient workqueue for delayed powerdown

Adapted for 3.4 from lsk-v3.10

There is no need to use a normal per-CPU workqueue for delayed power downs
as they're not timing or performance critical and waking up a core for them
would defeat some of the point.

Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Liam Girdwood <liam.r.girdwood@intel.com>
(cherry picked from commit 070260f07c7daec311f2466eb9d1df475d5a46f8)
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
Signed-off-by: poondog <markj338@gmail.com>

Change-Id: I89069b83f6fb49382dbe0abeae0ed2a25d6ee1c0
defconfig: enable WQ_POWER_EFFICIENT_DEFAULT

Change-Id: Ic637a9ab5e7d8a423bf14d98b6369be6dc25b4e5
Asynchronous Fsync: initial extraction of Async Fsync from HTC

Change-Id: I12c566344cd4670137385d6ccd73cb7747b7e901
Signed-off-by: Paul Reioux <reioux@gmail.com>
defconfig: enable ASYNC_FSYNC

Change-Id: I2a4914f77cad162ff0599c3fbc05ab5493a6e53c
fs: fixup kconfig warning about async fsync

Change-Id: I87bb9c0171961ffbc1b2e5c015bea1dc5123d246