dt: introduce of_get_child_by_name to get child node by name

This patch introduces of_get_child_by_name function to get a child node
by its name in a given parent node.

Without this patch each driver code has to iterate the parent and do
a string compare, However having of_get_child_by_name libary function would
avoid code duplication, errors and is more convenient.

Change-Id: Id33184bb9f4b494e7121d7dde719d29206dcad52
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
video: mdss: Squash MDSS power collapse feature

mdss:display: add regulator control to dsi-1

Regulators are shared by both dsi controller. For both
dual and split display application regulator should be
controlled individually to avoid reualtors are turned off
while dsi-1 still running which cause DLB0_ERR_CONTENTION_LP1
error.

CRs-fixed: 579900
Change-Id: Ia29bd3e49a405ccb1ad55f08f3897cee2ff6f4c6
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>

msm: mdss: dsi: Add ULPS mode support for dual dsi configuration

For dual dsi panels with broadcast mode enabled, the two dsi
controllers work in a master-slave configuration. Add support for
enabling ultra low power state (ULPS) mode in this use case.

Change-Id: I9e4383ca60174d6ffa599ce6caa47676a5eea216
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>

msm: mdss: Organize regulator supplies used by DSI controller

Regulator supplies in the DSI driver are used for two different
purposes. One set of regulators is used as a supply for the DSI
controller while another set is used to supply voltage to the
panel attached to the DSI controller. To support advanced power
saving features, it is required to be able to power down just the
DSI controller while keeping the panel on. To enable this,
organize the supplies into logical power modules.

Change-Id: I54f3ccba1c5ad1fe5c66e8700a012d22ab2684d6
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
(cherry picked from commit 855df197babeaa2ed2090622548d7f3f8b6e798a)

ARM: dts: msm: add mdss gdsc supply to dsi controller device

It is possible for the DSI controller to be active when MDP is
power collapsed. DSI controller needs to have it's own vote for
mdss gdsc to ensure that gdsc remains on in such cases.

Change-Id: I37f98c6e4f6d30908373b812fc50e29ba001b752
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>

msm: mdss: add support to enable idle power collapse

Add support for a new configuration entry to enable mdss power
collapse for idle screen use-cases, when a command mode interface is
active. Currently idle power collapse happens only if the Ultra-Low
Power State feature of the DSI controller is enabled. Adding a separate
configuration entry provides the flexibility to enable this feature
independent of the state of the DSI controller.

Change-Id: I4732a95a9f3d0db3e7ecc96a36414349ac6b5604
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
(cherry picked from commit 56758b2157a564b4022f29dcd56049fad15005fc)

mdss: mdp: do not send panel events for idle power collapse

When mdss idle power collapse is enabled, panel suspend and resume
events should not be sent to ensure that panel drivers remain active.

Change-Id: Ifbcdee69432cbd0d30f16c86af9c126d9443e269
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
(cherry picked from commit 8fe98249f7c1783eff001d91eb1f236a1f950270)

msm: mdss: move ULPS configuration to DSI clock control

DSI Ultra Low Power State (ULPS) mode is property of the DSI data
and clock lanes. Current implementation requires the MDP command
interface to send explicit events to the DSI controller to config
ULPS mode. However, it would be a lot more efficient if the DSI
controller would independently decide to enter/exit ULPS based on
whether the link clocks are enabled or not. This also ensures that
if any DCS commands need to be sent when ULPS is enabled, the DSI
controllers will exit ULPS accordingly.

Change-Id: If8d5b7039b5e104bcee5304c7c0ddb3cdd5bbcbc
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
(cherry picked from commit 1261aee15c058579c0a8b4492ce08285ef07fa03)

msm: mdss: modify MDSS idle power collapse exit sequence

When MDSS is idle power-collapsed, any events that require hardware
programming should result in exiting idle power collapse. Currently,
this is only done whenever a screen udpate happens. However, it is
possible that other APIs may be called prior to the actual screen
update. To address these cases, add the exit sequence call at the
interface level as well.

Change-Id: I162e1c1c4137a2ba20ed0b76f0c182c2c931cc87
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
(cherry picked from commit 200640f0be2beba654003c5b75fbbe3eab8a2d9c)

msm: mdss: Add support to read DSI clamp offset from DT

Since the DSI ULPS clamping registers offset varies
from chipset to chipset, so read the offset values from
chipset specific mdss dtsi file.

Change-Id: I0dcdf8cf0d0f3f1851337e05add833fbdac0632c
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>

msm: mdss: dsi: enable idle power collapse without DSI ULPS

It is possible to power collaps MDSS without configuring the DSI
lanes in Ultra Low Power State (ULPS). Add support for this by
configuring DSI clamps irrespective of whether ULPS feature is
enabled or not.

Change-Id: I0564216737cc6e98c1e8658862cf7af5dabd363c
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>

msm: mdss: fix race condition of DSI off and status check.

fb_event_callback cancels the work queue when it receives
the power down event. However, this event occurs after the
panel & DSI have been turned off. So if the check_status
function was being called right when the panel is being
turned off, we have a race conditon. Hence add offlock
mutex to ensure that bta status check is done when dsi
is being turned off.

Change-Id: Ie341c002c4544376bda2940fa65c6eb13997ae17
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>

msm: mdss: reset runtime status upon device resume

MDSS is power-collapsed in idle screen cases using the pm runtime
framework. However, it is possible that the runtime PM status may
not match with the post-system sleep status when the device is
resumed. This sometimes leads to the inconsistencies in MDSS
idle-power collapse upon system resume. To address this issue,
reset the runtime PM status in the pm resume handler.

Change-Id: I5696ce6c154f2898b82e70119d3d9a2be79b59b7
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>

msm: mdss: refactor MDSS idle power collapse logic

MDSS GDSC can be turned off, or power-collased for command mode panels
in static screen use-cases. In the current implementation, the power
collapse is triggered by a worker thread in the interface driver
whenever once it enters the idle state. However, MDP driver already
registers pm_runtime callbacks for idle and suspend notifications and
also maintains a count of active overlay sessions. It is much simpler
and cleaner to trigger idle-power collapse based on that. This also
avoids unnecessary synchronization issues pertaining to the power
collapse worker thread.

Change-Id: I96ee339b96ad794b2d87d19d1c14768fca3fa192
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>

video: mdss: Fixup power collapse

Change-Id: Iaf58e785e86c994b25001e6589162ba5c3043abc

mdss: mdp: start vreg release index from PANEL_PM

Start vreg release index from PANEL_PM to avoid
release call with DSI_MAX_PM in error case. This
avoids crash in dsi_probe if panel node parsing fails.

Change-Id: I236f40851d41831fe37eea77aa83e2f4ce031a3b
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>

video: mdss: Fix control of batfet regulator

Change-Id: I4b88a83e3c7caf1c1f5c57005731a05d05c774c8

msm: mdss: fix handling of runtime pm ref counts for fb device

In the current implementation, pm runtime status for the framebuffer
device changes to active when the overlay session is started. With idle
power collapse feature enabled, it is possible that the MDSS core could
be turned off prior to starting the overlay session depending on the
duration of the idle timeout. This may result in an invalid hardware
configuration leading to various target instabilities. Fix this by
holding a reference to the pm runtime when mdp overlay is turned on.
Similarly, when the userspace process is killed, wake up MDSS from idle
power collapse before shutting down the fb device.

Change-Id: Ie7748732fe76f9b2766da32b972e1e9fe7ff8751
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>

video: mdss: Fix another unbalanced clock ctrl

Change-Id: Ia993ab7532197f94e400f34df989d7d576a11552

Revert "msm: mdss: handle get buffer failure gracefully"

 * It's possible in the split rotator case for the rotator to
   get queued with has_buf = 0, which results in solidfill being
   enabled on the pipe. This is leads to IOMMU page faults and
   writeback timeouts.
 * Fixes green screen when rotating video on dual-DSI, and 4K
   video rotation on single-DSI (split rotator).

This reverts commit e092ab6793d4c718a37da38f79bb9d79c92c22c8.

Change-Id: I6cd57bba4be77242c2e314a5c0452eae1f10b104
a0001: Correct truly panel on commands, add gamma commands

Change-Id: Id38f4f5c7ad70478fbe283606359aae72c9cdd2e
a0001: Update truly panel DTSI for MDSS changes

Change-Id: Ic1bdd095e27f4d13c64a6b1e5c0ad8f125de2481
Merge branch 'shipping/cm-11.0' into ak-11.0s-nightly
ak_bacon_defconfig: enable RADIO FM support
arch: msm: split perf_event, disable debug and tracer
ak_bacon_defconfig: disable PERF_EVENTS and correlated
Revert "ak_bacon_defconfig: enable RADIO FM support"

This reverts commit 26cb0e1c88c111564c1835d673e31e0d018ef4b4.
Kernel Version: ak.035_b04.opo.cm11s
arm: vfpmodule: Fix warning procfs vfp_bounce reporting failed
vfp: makefile: hard float is used so change flag accordingly
ext4: Speedup WB_SYNC_ALL pass called from sync(2)

When doing filesystem wide sync, there's no need to force transaction
commit (or synchronously write inode buffer) separately for each inode
because ext4_sync_fs() takes care of forcing commit at the end (VFS
takes care of flushing buffer cache, respectively). Most of the time
this slowness doesn't manifest because previous WB_SYNC_NONE writeback
doesn't leave much to write but when there are processes aggressively
creating new files and several filesystems to sync, the sync slowness
can be noticeable. In the following test script sync(1) takes around 6
minutes when there are two ext4 filesystems mounted on a standard SATA
drive. After this patch sync takes a couple of seconds so we have about
two orders of magnitude improvement.

      function run_writers
      {
        for (( i = 0; i < 10; i++ )); do
          mkdir $1/dir$i
          for (( j = 0; j < 40000; j++ )); do
            dd if=/dev/zero of=$1/dir$i/$j bs=4k count=4 &>/dev/null
          done &
        done
      }

      for dir in "$@"; do
        run_writers $dir
      done

      sleep 40
      time sync

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ext4: speed up truncate/unlink by not using bforget() unless needed

Do not iterate over data blocks scanning for bh's to forget as they're
never exist. This improves time taken by unlink / truncate syscall.
Tested by continuously truncating file that is being written by dd.
Another test is rm -rf of linux tree while tar unpacks it. With
ordered data mode condition unlikely(!tbh) was always met in
ext4_free_blocks. With journal data mode tbh was found only few times,
so optimisation is also possible.

Unlinking fallocated 60G file after doing sync && echo 3 >
/proc/sys/vm/drop_caches && time rm --help

X86 before (linux 3.6-rc4):
# time rm -f test1
real    0m2.710s
user    0m0.000s
sys     0m1.530s

X86 after:
# time rm -f test1
real    0m0.644s
user    0m0.003s
sys     0m0.060s

MIPS before (linux 2.6.37):
# time rm -f test1
real    0m 4.93s
user    0m 0.00s
sys     0m 4.61s

MIPS after:
# time rm -f test1
real    0m 0.16s
user    0m 0.00s
sys     0m 0.06s

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Andrey Sidorov <qrxd43@motorola.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
af_unix: speedup /proc/net/unix

/proc/net/unix has quadratic behavior, and can hold unix_table_lock for
a while if high number of unix sockets are alive. (90 ms for 200k
sockets...)

We already have a hash table, so its quite easy to use it.

Problem is unbound sockets are still hashed in a single hash slot
(unix_socket_table[UNIX_HASH_TABLE])

This patch also spreads unbound sockets to 256 hash slots, to speedup
both /proc/net/unix and unix_diag.

Time to read /proc/net/unix with 200k unix sockets :
(time dd if=/proc/net/unix of=/dev/null bs=4k)

before : 520 secs
after : 2 secs

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
jbd2: optimize jbd2_journal_force_commit

Current implementation of jbd2_journal_force_commit() is suboptimal because
result in empty and useless commits. But callers just want to force and wait
any unfinished commits. We already have jbd2_journal_force_commit_nested()
which does exactly what we want, except we are guaranteed that we do not hold
journal transaction open.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
block: Reserve only one queue tag for sync IO if only 3 tags are available

In case a device has three tags available we still reserve two of them
for sync IO. That leaves only a single tag for async IO such as
writeback from flusher thread which results in poor performance.

Allow async IO to consume two tags in case queue has three tag availabe
to get a decent async write performance.

This patch improves streaming write performance on a machine with such disk
from ~21 MB/s to ~52 MB/s. Also postmark throughput in presence of
streaming writer improves from 8 to 12 transactions per second so sync
IO doesn't seem to be harmed in presence of heavy async writer.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
timer: optimize apply_slack()

__fls(mask) is equivalent to find_last_bit(&mask, BITS_PER_LONG), but cheaper.
find_last_bit was showing up high on the list when I was profiling for stalls
on icache misses on a system with very small cache size (MIPS).

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
ARM: 7461/1: topology: Add arch_scale_freq_power function

Add infrastructure to be able to modify the cpu_power of each core

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ARM: 7462/1: topology: factorize the update of sibling masks

This factorization has also been proposed in another patch that has not been
merged yet:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-January/080873.html
So, this patch could be dropped depending of the state of the other one.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>