Makefile: GCC flag optimizations
msm: kgsl: Remove extra interrupts when setting MMU state

The interrupts added to the ringbuffer on PTFLUSH and TLBUPDATE
were causing a major increase in the number of interrupts from the GPU.
This was leading to increase in power and loss of performance. Add a check
to turn off IOMMU clocks when going to SLEEP.

Change-Id: I41617dd3b7b3f7d9622523f2a1407b912dbd989e
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: ksgl adreno 2xx: *squashing updates*

msm: kgsl: Do not save context if it is being destroyed

      No need to save a context if it is being destroyed since
      it will no longer be used at all. This is better for
      performance and also avoids the use of legacy kgsl
      context save code for contexts that use preambles

      Change-Id: I19a64e82188b4132f353bb61c21e4ed2281092fc
      Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>

msm: kgsl: Increase REG_RBBM_CNTL value to 0xFFFF for A20X

      Increase number of clocks that RBBM will wait before de-asserting
      the Register Clock Active signal. This fixes kernel panics during
      stability tests on multiple devices

      Change-Id: I6f7f8bb17cfd9c5beed0fd21d56ab6ab9fd40195
      Signed-off-by: Rammohan Basavaraju <rammoh@codeaurora.org>

msm: kgsl: Do not allocate space in ringbuffer for hung context

      If a hang is detected when allocating space in ringbuffer and
      if the context for which the space is being allocated is hung
      then do not allocate space at all.

      Change-Id: Ia5ade2341fe5016119d8c140413860420c5c3a3d
      Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>

msm: kgsl: Define unique values for context flags

      Use BIT to define all context related flags. This ensures
      that these flags are unique and is easier to maintain. Also,
      fix spelling of CTXT_FLAGS_BEING_DESTOYED to
      CTXT_FLAGS_BEING_DESTROYED

      Change-Id: I866c67b9c5d59d6117e31714756af3106018f9cb
      Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>

msm: kgsl: Update log messages for usability

      Many of the log messages were outdated and did not tell enough
      information about what they were logging.  Update the content
      and/or remove log messages.

      Change-Id: Ica21510150be034bb3551ef0279d3afa91e559ea
      Signed-off-by: Carter Cooper <ccooper@codeaurora.org>

msm: kgsl: Remove ts_notifier_list

      Remove ts_notifier_list from the driver since it is not being
      used and is causing extra work to be done in the interrupt
      handlers for A2XX, A3XX and Z180.

      Change-Id: I5512e36f1e807f3a3e62aeac54cfd3075d4cf7a4
      Signed-off-by: Carter Cooper <ccooper@codeaurora.org>

msm: kgsl: Always reset global ts_cmp_enable on GPU interrupts

      Always rest the ts_cmp_enable when an interrupt is received
      from the GPU.  This keeps legacy code that is not using
      per context timestamps correctly updated.  No effect is
      seen with mainline code using per context timestamps.

      CRs-fixed: 418172
      Change-Id: I7f29086d4885571bdb165c0e759dc6ffc40b554f
      Signed-off-by: Carter Cooper <ccooper@codeaurora.org>

      # This is the 8th commit message:

      msm: kgsl: Handle a possible ringbuffer allocspace error

      In the GPU specific start functions, account for the possibility
      that ringbuffer allocation routine might return NULL.

      Change-Id: Ic0dedbadf6199fee78b6a8c8210a1e76961873a0
      Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
workqueues: Introduce new flag WQ_POWER_EFFICIENT for power oriented workqueues

workqueues: Introduce new flag WQ_POWER_EFFICIENT for power oriented workqueues

      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>

workqueue: Add system wide power_efficient workqueues

      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>
PHYLIB: queue work on system_power_efficient_wq

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>
block: queue work on power efficient wq

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>
fbcon: queue work on power efficient wq

fbcon uses workqueues and it has 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.

Cc: Dave Airlie <airlied@redhat.com>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
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>
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>
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>