Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Upstream - #15

Closed
ghost wants to merge 93 commits into
cm-14.1from
unknown repository
Closed

Upstream#15
ghost wants to merge 93 commits into
cm-14.1from
unknown repository

Conversation

@ghost

@ghost ghost commented Nov 13, 2017

Copy link
Copy Markdown

No description provided.

leonfish77101 and others added 30 commits October 1, 2017 10:09
 * Add a dummy makefile here so the DT gets cleaned for 64-bit

Change-Id: I380d5012a52cc37b09da23d3ee94c3ba2ec904b9

Signed-off-by: Peter Nyilas <github@criminal.hu>
 * __uint128_t is not defined on 32-bit.

Change-Id: I3447a95810f67b2af79f4ed476af96d8c279d2f7

Signed-off-by: Peter Nyilas <peter.nyilas@byyd-tech.com>
Change-Id: Id10eb332c9bbf10a8ba9f238f408b4d1dfa3658d

Signed-off-by: Peter Nyilas <peter.nyilas@byyd-tech.com>
 * DSP supports this swimmingly.

Change-Id: I11696dd49253c5a310b32c0bfe1a878009597b24
 * Provide a simple color temperature adjustment interface via MDSS PCC.
 * Provide hardware integration support for CABC, SRE, and CE.

Change-Id: I4ed1f3876767dd6bedccaf0bbf61af7d36730ca0
 * Add support for auto contrast optimization.
 * Add preset support.
 * Presets are arbitrary sets of DSI commands (defined in the DT) which
   can be used for implementing device-specific modes.
 * This adds the "preset" and "num_presets" sysfs nodes.
 * The preset at position zero is always applied.
 * Completely reworked the way we send commands to the hardware. Now we
   create a single DSI command buffer and send the whole thing at once.

Change-Id: I9b986593cf42b65a3360dae474d8318406b48204
 * We should avoid waking up the hardware if not necessary-
   but unfortunately even if we do, we might not get a valid
   result when querying for the current PCC settings.
 * Get rid of this code and keep track of the desired values
   ourselves, and reapply it during wakeup.

Change-Id: I1d42842af0d044e241dcc5b9266be0db4f84800b
 * The second controller won't have it's own framebuffer, so don't
   dereference a NULL pointer.

Change-Id: I0d0c1475882eb65c8d5bc69c9ac3776b5d60339f
 * If we send calibration data via ioctl, we want to make sure
   it's preserved when applying RGB offsets via LiveDisplay.
 * Add support for combining the values, using the calibrated
   PCC value as a scaling factor.

Change-Id: I33a5678a858f5e1c609709b4e7e901c792fd2590
 * Just combine the values instead of trying to scale things.

Change-Id: I5e5b94ad117ec4c01d49fc38b1d967817de76825
 * We shouldn't return zero from this.

Change-Id: I181a878d442e55e930c1a9532c40c84c3a9b1361
Cancel the tfa9890 delayed monitor work (synchronously) without holding
the dsp init mutex.  If the work is running, it's a guaranteed
deadlock.

Bug: 17180173 Couldn't wake up device after pressing power button
Signed-off-by: Chris Fries <cfries@motorola.com>
Change-Id: I214ba83d88fc83abdc9afb220bf66895af382a11
qpnp-leds: restore original interface for setting brightness ramps

OnePlus's customizations are ugly and get in the way.

DTS: update brightness ramps

- We can only store 24 values in the LUT so use 8 per channel.
- Fix overlapping start_idx values.

Change-Id: I108d00b5483b13e3d741eabfcd4316aa28edf47f
Change-Id: I75125b1f8276f75543720adae577519683f3f19b
The existing implementation of mdss_mdp_ctl_intf_event() calls all
subscribed handlers of a given event sequentially. This results in
poor performance in some cases.

For example, some DSI panels have long sleeps (~120ms) in their power-
on sequences. For dual-DSI displays with both panels are subscribing
to the same unblank event, these long sleeps occur one-after-the-other
to the detriment of display-on latency. By modifying
mdss_mdp_ctl_intf_event() to schedule the handlers on worker threads,
commands to both DSI panels can be sent in parallel, with the
associated sleeps occurring in parallel also.

Change-Id: If0fba0b58346529558a30a44c50e64cbe44ef3f3
Signed-off-by: Matt Wagantall <mwagantall@cyngn.com>
kkovaacs and others added 21 commits October 3, 2017 17:51
The lz4 library has two functions for decompression, with slightly
different signatures and behaviour. The lz4_decompress_crypto() function
seemed to be using the one that assumes that the decompressed length is
known in advance.

This patch switches to the other decompression function and makes sure
that the length of the decompressed output is properly returned to the
caller.

The same issue was present in the lz4hc algorithm.

Coincidentally, this change also makes very basic lz4 and lz4hc
compression tests in testmgr pass.

Change-Id: I506303398a672aa0cdbc7dc6145edf61c5a68f33
Signed-off-by: KOVACS Krisztian <hidden@sch.bme.hu>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
adreno_dispatch_work and _kgsl_event_worker are both low-latency
low-runtime functions that are in the critical path of GPU
rendering. Moving them out of workqueues and into a dedicated FIFO
kthread avoids significant jitter.

bug 30342017

Change-Id: I5feb4e829064d422b4b9af2acb449afd1f981899
Scheduling issues were occurring with the GPU event worker after
b7be807 (msm: kgsl: Unbind the kgsl-event workqueue) was merged.
In certain conditions, it seems that the kgsl-event workqueue
was conflicting with the KGSL worker and slowing it down.

It turns out that everywhere we schedule the event worker
and the dispatcher worker at the same time.  Since the worker
is singlethread, the event worker and the dispatcher run
synchronously anyway, so it makes sense to run the event processor
from within the dispatcher and save the extra schedule.

Change-Id: Ic0dedbad67eb04d41afb6add4477f146dfff9784
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Fix double free on error paths

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I1c25a175e87e5dd5cafcdcf9d78bf4c0dc3f88ef
Bug: 65386954
Fixes: aa6d3ac ("mnt: Add filesystem private data to mount points")
This moves the code to adjust the gid/uid of lower filesystem
files under the mount flag derive_gid.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I44eaad4ef67c7fcfda3b6ea3502afab94442610c
Bug: 63245673
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 63245673
Change-Id: I5fc596420301045895e5a9a7e297fd05434babf9
Keep time calculation in 64-bit throughout. If we have long times
between idle calculations this can result in deltas > 32 bits
which causes incorrect load percentage calculations and selecting
the wrong frequencies if we truncate here.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Alex Naidis <alex.naidis@linux.com>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
After a CPU comes online, clk_set_rate() silently refuses to change said CPU's
frequency to the frequency it was running at before going offline (since it
thinks that we are setting the same frequency redundantly). By default, each CPU
runs at its minimum frequency when coming online, so if the governor decides to
keep a CPU running at the frequency it used before going offline, then
clk_set_rate() will ignore the frequency change request and the CPU will stay
stuck running at its minimum frequency for a potentially long period of time
(i.e. until the governor decides to change the frequency to something
different). This can cause severe lag when a device is woken up from deep sleep.

In order to prevent a CPU from being stuck at its default frequency for a
potentially long period of time, set the CLKFLAG_NO_RATE_CACHE flag so that the
governor's frequency change requests will always be honored right after a CPU
comes online.

Note that this requires a CPU's component clocks to be using CLKFLAG_NO_RATE_CACHE
as well in order to fix the issue.

Signed-off-by: Sultanxda <sultanxda@gmail.com>
The performance cluster can have frequency change requests ignored when
it comes online without having this flag set. This can result in the perfcl
running at its default frequency instead of the frequency that the CPU
governor wants.

Change-Id: I215858637941e03f9047e4511fd51b03c5dd4567
Signed-off-by: Sultan Alsawaf <sultanxda@gmail.com>
If the worker is already executing a work item when another is queued,
we can safely skip wakeup without worrying about stalling queue thus
avoiding waking up the busy worker spuriously.  Spurious wakeups
should be fine but still isn't nice and avoiding it is trivial here.

tj: Updated description.

Change-Id: I0eb09b9087ebf3c2acab536efa923eee780432df
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
In idle balancing where a CPU going idle pulls tasks from another CPU,
a livelock may happen if the CPU pulls all tasks from another, makes
it idle, and this iterates. So just avoid this.

Reported-by: Rabin Vincent <rabin.vincent@axis.com>
Signed-off-by: Yuyang Du <yuyang.du@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Ben Segall <bsegall@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: Morten Rasmussen <morten.rasmussen@arm.com>
Cc: Paul Turner <pjt@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20150705221151.GF5197@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit 985d3a4)
Signed-off-by: Ricky Liang <jcliang@chromium.org>

BUG=chrome-os-partner:45410
TEST=Boot kernel on Oak. Run tests for days and doesn't see kernel lock-ups.

Change-Id: I4e39dd14189fbf27afcc64de255f7d1b7b822b34
Reviewed-on: https://chromium-review.googlesource.com/309510
Commit-Ready: Ricky Liang <jcliang@chromium.org>
Tested-by: Ricky Liang <jcliang@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
…d systems

commit 2087823 upstream.

Systems show a minimal load average of 0.00, 0.01, 0.05 even when they
have no load at all.

Uptime and /proc/loadavg on all systems with kernels released during the
last five years up until kernel version 4.6-rc5, show a 5- and 15-minute
minimum loadavg of 0.01 and 0.05 respectively. This should be 0.00 on
idle systems, but the way the kernel calculates this value prevents it
from getting lower than the mentioned values.

Likewise but not as obviously noticeable, a fully loaded system with no
processes waiting, shows a maximum 1/5/15 loadavg of 1.00, 0.99, 0.95
(multiplied by number of cores).

Once the (old) load becomes 93 or higher, it mathematically can never
get lower than 93, even when the active (load) remains 0 forever.
This results in the strange 0.00, 0.01, 0.05 uptime values on idle
systems.  Note: 93/2048 = 0.0454..., which rounds up to 0.05.

It is not correct to add a 0.5 rounding (=1024/2048) here, since the
result from this function is fed back into the next iteration again,
so the result of that +0.5 rounding value then gets multiplied by
(2048-2037), and then rounded again, so there is a virtual "ghost"
load created, next to the old and active load terms.

By changing the way the internally kept value is rounded, that internal
value equivalent now can reach 0.00 on idle, and 1.00 on full load. Upon
increasing load, the internally kept load value is rounded up, when the
load is decreasing, the load value is rounded down.

The modified code was tested on nohz=off and nohz kernels. It was tested
on vanilla kernel 4.6-rc5 and on centos 7.1 kernel 3.10.0-327. It was
tested on single, dual, and octal cores system. It was tested on virtual
hosts and bare hardware. No unwanted effects have been observed, and the
problems that the patch intended to fix were indeed gone.

Tested-by: Damien Wyart <damien.wyart@free.fr>
Signed-off-by: Vik Heyndrickx <vik.heyndrickx@veribox.net>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Doug Smythies <dsmythies@telus.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 0f004f5 ("sched: Cure more NO_HZ load average woes")
Link: http://lkml.kernel.org/r/e8d32bff-d544-7748-72b5-3c86cc71f09f@veribox.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Defining relaxed version of atomic read as cpu_relaxed_read_atomic
which will be used for improving power efficiency for arm64.

bug 1440421

Change-Id: I6ac26653ec3d62f74d8c21f250dcdaf9dfb75b9b
Signed-off-by: Alex Van Brunt <avanbrunt@nvidia.com>
(cherry picked from commit 7360c3df73afa07361eecab730903e0697d3408f)
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/415628
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

arm: atomic.h: defined relaxed atomic_read

Defining relaxed version of atomic read as cpu_relaxed_read_atomic.

bug 1440421

Change-Id: I39303d72350985890c7eb5a1afc768c3f8064b47
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
(cherry picked from commit 6c20e8c2aed05ad1a9d1b41cfdd875dc377db44c)
Reviewed-on: http://git-master/r/415637
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

arm64: atomic.h: defining relaxed atomic_read

Defining relaxed version of atomic read as cpu_relaxed_read_atomic
which will be used for improving power efficiency for arm64.

bug 1440421

Change-Id: I5a88b8e66ec3021335905109010efc856ffa7c7e
Signed-off-by: Alex Van Brunt <avanbrunt@nvidia.com>
(cherry picked from commit f53c05073d148adfe7abe153f1569c4bd655fb44)
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/415639
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

asm-generic: relaxed.h: defined relaxed.h

Defined a new header file relaxed.h, which contains basic
macros which will be used for improving power efficiency for
arm64.

bug 1440421

Change-Id: I5ae7503afdfbaa951827bbf466d8ddccf444f558
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/398315
(cherry picked from commit dd434aeb1afea1d9ebce1099fb6ecfa7c6c762c6)
Reviewed-on: http://git-master/r/422203
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

asm-generic: processor.h: adding new header file

Defining a new header file and adding architecture
independent macros. Using these macros we are optimizing
power usage on ARM64.

bug 1440421

Change-Id: I7393d35703d0b0a504331653d70f109a50a197c7
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/381905
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alexander Van Brunt <avanbrunt@nvidia.com>
Reviewed-by: Sri Krishna Chowdary <schowdary@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

asm-generic: processor.h: remove redundant macros

Removing cpu_relaxed_read and cpu_relaxed_read_long macros from
processor.h, as these macros are defined in asm-generic/relaxed.h.

Bug 1440421

Change-Id: I5d1ba25755e1c9d33b080dfe01ba838289f306af
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/400093
(cherry picked from commit 57eb21e2d4cad3ce1f85283cfffd0eff85a6d17d)
Reviewed-on: http://git-master/r/422209
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

arm: asm: relaxed.h: defined relaxed.h

Defined a new header file relaxed.h, which uses generic
definitions of some macros used by arm64 for improving
power efficiency.

bug 1440421

Change-Id: I654dcef609812e3bb54e6c892c1554f9cbb4bd3d
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/398766
(cherry picked from commit a96e59b1959f3ee216503b4f9df3cb75f7093ed6)
Reviewed-on: http://git-master/r/422211
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

arm64: asm: relaxed.h: defined relaxed.h

Defined a new header file relaxed.h, which contains
arm64 specific macros which will be used to improve
power efficiency of arm64.

bug 1440421

Change-Id: Iee14115490cb16001d5eac9e309ee6e088b88f44
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/398323
(cherry picked from commit beb69cd6d2893c36712d4f927e41da0de729d651)
Reviewed-on: http://git-master/r/422212
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

ARM64: defining macros to optimize power usage

Here we have defined some macros such as
cpu_relaxed_read, cpu_relaxed_read_long,
cpu_read_relax in arch/arm64/include/asm/processor.h
which will be used to enhance power optimization on Denver.

bug 1440421

Here we are trying to improve power optimazation
using some macros such

Change-Id: I313e47b35e9a638fe81b7350887f59eeacc45bc1
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/381950
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sri Krishna Chowdary <schowdary@nvidia.com>
Reviewed-by: Alexander Van Brunt <avanbrunt@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

arm64: processor.h: remove redundant macros

Removing cpu_relaxed_read and cpu_relaxed_read_long macros from
processor.h, as these macros are defined in asm/relaxed.h.

bug 1440421

Change-Id: Ic766ac6e34eefe93f90349c088626a0fb277670c
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/400127
(cherry picked from commit 108bf0b30d72c52e33dd4fec71dd1ed5baf13ed2)
Reviewed-on: http://git-master/r/422214
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

thread_info: enhance power efficiency

Using cpu_relaxed_read_long and defining relaxed
version of some macros, and functions so that it
can be used to improve power efficiency.

bug 1440421

Change-Id: If857ff7110cffadc6f13289a6395d253a8e3e232
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/380859
(cherry picked from commit a66b23c6971403594cc6a82923c8df3b8472de90)
Reviewed-on: http://git-master/r/422251
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

hrtimer: enhance power efficiency

Defining relaxed version of hrtimer_callback_running(),
which will be used to improve power efficiency through
the use of macro cpu_relaxed_read_long.

Bug 1440421

Change-Id: Ie42d7ae9628a817d52f4636781e11b607327c2c5
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/398789
(cherry picked from commit 0d9f5fc1d39d7d1809519b5d11bf7ac72287b7c6)
Reviewed-on: http://git-master/r/422255
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

llist: defining relaxed version of llist_empty

Defining relaxed version of llist_empty as llist_empty_relaxed,
which will be used for power-optimization.

bug 1440421

Change-Id: I1c4c34b381e49775ed08ddd606d9744a7e7e1fba
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/426483
Reviewed-by: Sri Krishna Chowdary <schowdary@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alexander Van Brunt <avanbrunt@nvidia.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

arm64: atomic: add missing macros

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

hrtimer: Replace usage of hrtimer_callback_running with the new relaxed version for less power usage

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

arm64: use the new *_relaxed macros for lower power usage

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

kernel: cpu: use cpu_read_relaxed on cpu_down()

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
While accessing cur_policy during executing events
CPUFREQ_GOV_START, CPUFREQ_GOV_STOP, CPUFREQ_GOV_LIMITS,
same mutex lock is not taken, dbs_data->mutex, which leads
to race and data corruption while running continious suspend
resume test. This is seen with ondemand governor with suspend
resume test using rtcwake.

 Unable to handle kernel NULL pointer dereference at virtual address 00000028
 pgd = ed610000
 [00000028] *pgd=adf11831, *pte=00000000, *ppte=00000000
 Internal error: Oops: 17 [#1] PREEMPT SMP ARM
 Modules linked in: nvhost_vi
 CPU: 1 PID: 3243 Comm: rtcwake Not tainted 3.10.24-gf5cf9e5 #1
 task: ee708040 ti: ed61c000 task.ti: ed61c000
 PC is at cpufreq_governor_dbs+0x400/0x634
 LR is at cpufreq_governor_dbs+0x3f8/0x634
 pc : [<c05652b8>] lr : [<c05652b0>] psr: 600f0013
 sp : ed61dcb0 ip : 000493e0 fp : c1cc14f0
 r10: 00000000 r9 : 00000000 r8 : 00000000
 r7 : eb725280 r6 : c1cc1560 r5 : eb575200 r4 : ebad7740
 r3 : ee708040 r2 : ed61dca8 r1 : 001ebd24 r0 : 00000000
 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
 Control: 10c5387d Table: ad61006a DAC: 00000015
 [<c05652b8>] (cpufreq_governor_dbs+0x400/0x634) from [<c055f700>] (__cpufreq_governor+0x98/0x1b4)
 [<c055f700>] (__cpufreq_governor+0x98/0x1b4) from [<c0560770>] (__cpufreq_set_policy+0x250/0x320)
 [<c0560770>] (__cpufreq_set_policy+0x250/0x320) from [<c0561dcc>] (cpufreq_update_policy+0xcc/0x168)
 [<c0561dcc>] (cpufreq_update_policy+0xcc/0x168) from [<c0561ed0>] (cpu_freq_notify+0x68/0xdc)
 [<c0561ed0>] (cpu_freq_notify+0x68/0xdc) from [<c008eff8>] (notifier_call_chain+0x4c/0x8c)
 [<c008eff8>] (notifier_call_chain+0x4c/0x8c) from [<c008f3d4>] (__blocking_notifier_call_chain+0x50/0x68)
 [<c008f3d4>] (__blocking_notifier_call_chain+0x50/0x68) from [<c008f40c>] (blocking_notifier_call_chain+0x20/0x28)
 [<c008f40c>] (blocking_notifier_call_chain+0x20/0x28) from [<c00aac6c>] (pm_qos_update_bounded_target+0xd8/0x310)
 [<c00aac6c>] (pm_qos_update_bounded_target+0xd8/0x310) from [<c00ab3b0>] (__pm_qos_update_request+0x64/0x70)
 [<c00ab3b0>] (__pm_qos_update_request+0x64/0x70) from [<c004b4b8>] (tegra_pm_notify+0x114/0x134)
 [<c004b4b8>] (tegra_pm_notify+0x114/0x134) from [<c008eff8>] (notifier_call_chain+0x4c/0x8c)
 [<c008eff8>] (notifier_call_chain+0x4c/0x8c) from [<c008f3d4>] (__blocking_notifier_call_chain+0x50/0x68)
 [<c008f3d4>] (__blocking_notifier_call_chain+0x50/0x68) from [<c008f40c>] (blocking_notifier_call_chain+0x20/0x28)
 [<c008f40c>] (blocking_notifier_call_chain+0x20/0x28) from [<c00ac228>] (pm_notifier_call_chain+0x1c/0x34)
 [<c00ac228>] (pm_notifier_call_chain+0x1c/0x34) from [<c00ad38c>] (enter_state+0xec/0x128)
 [<c00ad38c>] (enter_state+0xec/0x128) from [<c00ad400>] (pm_suspend+0x38/0xa4)
 [<c00ad400>] (pm_suspend+0x38/0xa4) from [<c00ac114>] (state_store+0x70/0xc0)
 [<c00ac114>] (state_store+0x70/0xc0) from [<c027b1e8>] (kobj_attr_store+0x14/0x20)
 [<c027b1e8>] (kobj_attr_store+0x14/0x20) from [<c019cd9c>] (sysfs_write_file+0x104/0x184)
 [<c019cd9c>] (sysfs_write_file+0x104/0x184) from [<c0143038>] (vfs_write+0xd0/0x19c)
 [<c0143038>] (vfs_write+0xd0/0x19c) from [<c0143414>] (SyS_write+0x4c/0x78)
 [<c0143414>] (SyS_write+0x4c/0x78) from [<c000f080>] (ret_fast_syscall+0x0/0x30)
 Code: e1a00006 eb084346 e59b0020 e5951024 (e5903028)
 ---[ end trace 0488523c8f6b0f9d ]---

Change-Id: Iabd1dae0c57268fe05c8835ff0d4ae1590651829
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: 3.11+ <stable@vger.kernel.org> # 3.11+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: flar2 <asegaert@gmail.com>
Since we can compose gadgets from many functions, there is the problem
related to gadget breakage while FunctionFS daemon being closed. FFS
function is userspace code so there is no way to know when it will close
files (it doesn't matter what is the reason of this situation, it can
be daemon logic, program breakage, process kill or any other). So when
we have another function in gadget which, for example, sends some amount
of data, does some software update or implements some real-time functionality,
we may want to keep the gadget connected despite FFS function is no longer
functional.

We can't just remove one of functions from gadget since it has been
enumerated, so the only way to keep entire gadget working is to make
broken FFS function deactivated but still visible to host. For this
purpose this patch introduces "no_disconnect" mode. It can be enabled
by setting mount option "no_disconnect=1", and results with defering
function disconnect to the moment of reopen ep0 file or filesystem
unmount. After closing all endpoint files, FunctionFS is set to state
FFS_DEACTIVATED.

When ffs->state == FFS_DEACTIVATED:
- function is still bound and visible to host,
- setup requests are automatically stalled,
- transfers on other endpoints are refused,
- epfiles, except ep0, are deleted from the filesystem,
- opening ep0 causes the function to be closed, and then FunctionFS
  is ready for descriptors and string write,
- altsetting change causes the function to be closed - we want to keep
  function alive until another functions are potentialy used, altsetting
  change means that another configuration is being selected or USB cable
  was unplugged, which indicates that we don't need to stay longer in
  FFS_DEACTIVATED state
- unmounting of the FunctionFS instance causes the function to be closed.

Tested-by: David Cohen <david.a.cohen@linux.intel.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

Bug: 36801389
Bug: 34873000
Change-Id: I950dc11f21048c34af640cb3ab81873d2a6730a9
Signed-off-by: Jerry Zhang <zhangjerry@google.com>
epfile->error is a QC extension. It needs to be guarded
from being null to work safely with the no_disconnect patch.

Bug: 37423404
Change-Id: I3142a03ef3296b928aa36c54a5397afbe30798b7
Signed-off-by: Jerry Zhang <zhangjerry@google.com>
Change-Id: I50640419725071f1a7a29389a272831a1a1c3c32
*this was accidentially removed with latest rebase

Change-Id: Ic86f0bad54df2069bab865b8ac8ffe2c848929be
Follows tree side changes, and we actually make no use of them.

Change-Id: Ibebe4fb1261071f3afb552f7f4f251b896aac10a
Change-Id: I01b9527ea1dc15e18c8a50dda72ab04449c93be5
@ghost
ghost force-pushed the cm-14.1 branch 5 times, most recently from 04e0ac3 to 9624ad9 Compare November 22, 2017 21:15
@ghost
ghost force-pushed the cm-14.1 branch 2 times, most recently from 92f421a to 6ed4299 Compare December 9, 2017 20:08
@ghost ghost closed this Jul 31, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.