msm: bam_dmux: UL inactivity timeout is too high

Reduce UL_TIMEOUT from 1000 ms to 200 ms to improve current drain
for idle use case.

Signed-off-by: Alexander Filonenko <vtp684@motorola.com>
Reviewed-on: http://gerrit.pcs.mot.com/538334
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Connie Zhao <czhao1@motorola.com>
Reviewed-by: Check Patch <CHEKPACH@motorola.com>
Reviewed-by: Klocwork kwcheck <klocwork-kwcheck@sourceforge.mot.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
Reviewed-by: Igor Kovalenko <cik009@motorola.com>
Reviewed-by: Christopher Fries <c.fries@motorola.com>
SLT-Approved: Christopher Fries <c.fries@motorola.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Delay UL powerdown if BAM is in polling mode

Reviewed-on: http://gerrit.pcs.mot.com/548359
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Igor Kovalenko <cik009@motorola.com>
Reviewed-by: Klocwork kwcheck <klocwork-kwcheck@sourceforge.mot.com>
Reviewed-by: Alexander Filonenko <alexf@motorola.com>
SLT-Approved: Christopher Fries <c.fries@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: bam_dmux: optimize UL inactivity timeout

Increase UL_TIMEOUT_DELAY to 300 ms to avoid most of powerdown attempts while
in polling mode.

Signed-off-by: Alexander Filonenko <vtp684@motorola.com>
Reviewed-on: http://gerrit.pcs.mot.com/548732
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Check Patch <CHEKPACH@motorola.com>
Reviewed-by: Klocwork kwcheck <klocwork-kwcheck@sourceforge.mot.com>
Reviewed-by: Igor Kovalenko <cik009@motorola.com>
SLT-Approved: Christopher Fries <c.fries@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: bam_dmux: fix compilation issue

Signed-off-by: Jeffrey Carlyle <jeff.carlyle@motorola.com>
[ljc: also call BUG instead of panic]
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
intelliactive: add upstream patches

Signed-off-by: Paul Reioux <reioux@gmail.com>
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.

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>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
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'.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: bam_dmux: Use power efficient workqueues for
 delayed timeouts

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: Luis Cruz <ljc2491@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Revert "backlight: lm3630: Make backlight dimmer configurable"

This reverts commit b34e7175920aa02195845578876fade405506f7b.
backlight: fix a bug where the screen would be completely dark or near darkness with backlight_dimmer enabled when the display dimmed. The brightness level can't be any lower than dev->min_brightness and previous code allowed that to happen, so fix it.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
backlight: clean the code.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
backlight: add minimum backlight brightness module param.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
backlight: scale max current when the brightness level is below 15 instead of using always 0.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Revert "sched/fair: improve fairness efficiency"

This reverts commit 6ef028527e1bb5584dfbb69ff6d80c59dc6f2e98.