Commit graph

307852 commits

Author SHA1 Message Date
followmsi
0701a6840f regen defconfig 2017-10-28 14:03:20 +02:00
followmsi
895a086b99 Revert "Wake Timeout: disable screen wake functions after specified period of time"
This reverts commit b0c2713b43.
2017-10-28 14:02:50 +02:00
flar2
1284a2b962 fastcharge: update sysfs 2017-10-28 13:14:02 +02:00
flar2
49353a9fe8 USB fastcharge for Nexus 7 (2013)
Signed-off-by: flar2 <asegaert@gmail.com>
2017-10-28 13:13:52 +02:00
flar2
e2e746bfca ektf3k: option to force ac power mode (parrotMod)
Reference: https://github.com/parrotgeek1/ParrotModFloApp/blob/master/001-fix-touchscreen-calibration.patch

suggested-by: parrotgeek1 <parrotgeek1@gmail.com>
2017-10-28 13:07:49 +02:00
flar2
3dc43f5d05 wake_gestures: update sysfs 2017-10-28 13:07:39 +02:00
flar2
3872dfc5f1 wake_gestures: adjust defaults 2017-10-28 13:07:27 +02:00
flar2
8433a22857 ektf3k: fix compilation warning 2017-10-28 13:07:16 +02:00
flar2
d9e458e5e5 wake_gestures: update timings 2017-10-28 13:07:01 +02:00
flar2
32c96a0b19 wake gestures: disable by default
Signed-off-by: flar2 <asegaert@gmail.com>
2017-10-28 13:06:51 +02:00
CTCaer
b34eb59584 Forced touchscreen fw update
Signed-off-by: flar2 <asegaert@gmail.com>
2017-10-28 13:06:40 +02:00
flar2
add2b2bf57 Wake Gestures: fix sweep2sleep not working if sweep2wake is disabled
Signed-off-by: flar2 <asegaert@gmail.com>
2017-10-28 13:01:37 +02:00
flar2
b0c2713b43 Wake Timeout: disable screen wake functions after specified period of time
Signed-off-by: flar2 <asegaert@gmail.com>
2017-10-28 13:01:26 +02:00
flar2
9a16cd1cd6 Wake Gestures: add interface
Signed-off-by: flar2 <asegaert@gmail.com>
2017-10-28 13:01:12 +02:00
flar2
adc77ddc9b s2w: make some adjustments
Signed-off-by: flar2 <asegaert@gmail.com>
2017-10-28 13:01:00 +02:00
flar2
92a420e9c8 s2w: get rid of min timeout
Signed-off-by: flar2 <asegaert@gmail.com>
2017-10-28 13:00:25 +02:00
flar2
b7c0c770b5 adjust shortsweep distance
Signed-off-by: flar2 <asegaert@gmail.com>
2017-10-28 13:00:15 +02:00
Dennis Rassmann
18714ae0f0 drivers/input/touchscreen/ektf3k: auto retry 10 times on i2c reads The i2c devices we are connecting to may not be ready yet, or just busy. Retry with a 10ms pause in order to still obtain i2c data. This improves overall i2c data robustness
Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
Signed-off-by: flar2 <asegaert@gmail.com>
2017-10-28 13:00:03 +02:00
Dennis Rassmann
a2d050de6f drivers/input/touchscreen/ektf3k: auto retry 10 times on i2c reads The i2c devices we are connecting to may not be ready yet, or just busy. Retry with a 10ms pause in order to still obtain i2c data. This improves overall i2c data robustness
Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
Signed-off-by: flar2 <asegaert@gmail.com>
2017-10-28 12:59:47 +02:00
flar2
7bce0c4ac7 Disable s2w/dt2w when magnetic cover is used
Signed-off-by: flar2 <asegaert@gmail.com>
2017-10-28 12:57:24 +02:00
flar2
2e419eac16 command line options for s2w_orientation and pwrkey_suspend
Signed-off-by: flar2 <asegaert@gmail.com>
2017-10-28 12:57:10 +02:00
flar2
6e12f7ce6a New sweep2wake/doubletap2wake options
/sys/android_touch/orientation controls whether sweep2sleep works in portrait, landscape, or both
0 = both
1 = portrait only
2 = landscape only

/sys/android_touch/pwrkey_suspend  makes the power button toggle s2w/dt2w
If set to 1, pressing power button to turn off screen disables s2w/dt2w and pressing the power button to turn on screen re-enables s2w/dt2w

Signed-off-by: flar2 <asegaert@gmail.com>

Conflicts:
	drivers/input/touchscreen/ektf3k.c
2017-10-28 12:56:42 +02:00
flar2
1028cd0b0e Command line options
Signed-off-by: flar2 <asegaert@gmail.com>

Conflicts:
	drivers/input/lid.c
2017-10-28 12:53:47 +02:00
flar2
6f8e8d885d Sweep2wake and Doubletap2wake for the Nexus 7 (flo)
Signed-off-by: flar2 <asegaert@gmail.com>

Conflicts:
	drivers/input/touchscreen/ektf3k.c
2017-10-28 12:49:06 +02:00
followmsi
52f749ba85 regen defconfig 2017-10-22 15:06:10 +02:00
followmsi
116cd5f215 Merge branch 'lineage-15.0' into followmsi-oreo 2017-10-22 14:41:26 +02:00
Benoit Goby
cebec208aa usb: gadget: android: Add FunctionFS
Add support for FunctionFS (ffs) to implement usb functions in userspace.

The aliases property stores the list of functions that are implemented
using functionfs.

For example:
echo "adb,mtp" > /sys/class/android_usb/android0/f_ffs/aliases

Then when the function are enabled:
echo "adb,acm" > /sys/class/android_usb/android0/functions
Internally, ffs and acm will be used.

Change-Id: I44117b183d48a5a99ddbee3ef2cf8998be74598e
Signed-off-by: Benoit Goby <benoit@android.com>
2017-10-15 17:05:15 +03:00
Bo Shen
bdb82bf857 usb: gadget: u_serial: fix typo which cause build warning
fix typo error introduced by commit ea0e6276 (usb: gadget: add
multiple definition guards) which causes the following build warning:

  warning: "pr_vdebug" redefined

Change-Id: Iee37ffc4769b89ff48cfd935c006221b403a0c7f
Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2017-10-15 17:05:15 +03:00
Andrzej Pietrasiewicz
eecc6be21b usb: gadget: add multiple definition guards
If f_fs.c and u_serial.c are combined together using #include, which has
been a common practice so far, the pr_vdebug macro is defined multiple
times. Define it only once.

Change-Id: I370ef5efb4ceb81abcc4876536220d570107cc14
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2017-10-15 17:05:14 +03:00
Artem Borisov
800861e47a flo: defconfig: update PM configuration
Change-Id: I54ccad639b59f8fcd030ca255745147d4eaddc85
2017-10-15 17:05:14 +03:00
Liu ShuoX
3da71738d2 PM / Sleep: avoid 'autosleep' in shutdown progress
commit e5248a111b upstream.

Prevent automatic system suspend from happening during system
shutdown by making try_to_suspend() check system_state and return
immediately if it is not SYSTEM_RUNNING.

This prevents the following breakage from happening (scenario from
Zhang Yanmin):

 Kernel starts shutdown and calls all device driver's shutdown
 callback.  When a driver's shutdown is called, the last wakelock is
 released and suspend-to-ram starts.  However, as some driver's shut
 down callbacks already shut down devices and disabled runtime pm,
 the suspend-to-ram calls driver's suspend callback without noticing
 that device is already off and causes crash.

Change-Id: I09261fe136713cb6bdd66e061a9e886d077324c5
[rjw: Changelog]
Signed-off-by: Liu ShuoX <shuox.liu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 426b7d5074424aab388af948ba75a5e1c8b9a702)
2017-10-15 17:05:14 +03:00
Ruchi Kandoi
c74cb5707b wakeup: Add last wake up source logging for suspend abort reason.
There is a possibility that a wakeup source event is received after
the device prepares to suspend which might cause the suspend to abort.

This patch adds the functionality of reporting the last active wakeup
source which is currently not active but caused the suspend to abort reason
via the /sys/kernel/power/last_wakeup_reason file.

Change-Id: I1760d462f497b33e425f5565cb6cff5973932ec3
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2017-10-15 17:05:13 +03:00
Dmitry Shmidt
36f258a110 PM: Check dpm_suspend_start() return code during partial resume
Bug: 24986869

Change-Id: Iea3e0f84e43827b365b96d34bc647e310523bd40
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Signed-off-by: Thierry Strudel <tstrudel@google.com>
2017-10-15 17:05:13 +03:00
Ruchi Kandoi
0ff10ad812 wakeup_reason: use vsnprintf instead of snprintf for vargs.
Bug: 22368519
Change-Id: I38f6f1ac6eaf9490bdc195c59e045b33ad154a72
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2017-10-15 17:05:12 +03:00
Dmitry Shmidt
f6d4e6286e Power: Add wakeup reasons counters from boot in suspend_since_boot
From left to right:
        1. Amount of no-wait cycles
        2. Amount of timeout cycles
        3. Max waiting time in ms

Change-Id: Ibc0bb1c4ea591d005cdbb095b6d21c0734d2eb8b
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2017-10-15 17:05:12 +03:00
Dmitry Shmidt
dc58d3c933 PM: Reduce waiting for wakeup reasons to 100 ms
In 80% cases there is no need to wait, and in case
of timeout we continue to resume.

Change-Id: I6ae44e0ef6f7aa497f57fcd5f6e6bc83dc781852
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2017-10-15 17:05:12 +03:00
Ruchi Kandoi
18bbd5eed4 suspend: Return error when pending wakeup source is found.
Suspend is aborted if the wakeup_source is pending. These wakeup sources
are checked multiple times before going to suspend. If it is found to be
pending then suspend is aborted and -EBUSY is returned. This happens at
all the places except the last time they are checked. In this case
suspend is aborted but the error is not set. Since the error is not
propogated the suspend accounting considers this as a sucessful suspend
instead of suspend abort.

Change-Id: Ib63b4ead755127eaf03e3b303aab3c782ad02ed1
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2017-10-15 17:05:11 +03:00
Iliyan Malchev
a50130f1be PM: wakeup_reasons: disable wakeup-reason deduction by default
Introduce a config item, CONFIG_DEDUCE_WAKEUP_REASONS, disabled by default.
Make CONFIG_PARTUALRESUME select it.

Change-Id: I7d831ff0a9dfe0a504824f4bc65ba55c4d92546b
Signed-off-by: Iliyan Malchev <malchev@google.com>
2017-10-15 17:05:11 +03:00
Dmitry Shmidt
9ff16b88b8 PM: Replace WARN_ON on timeout with one line print
Change-Id: Ia8b32b8ee225b7b62a327fecb10e9284ee4116df
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2017-10-15 17:05:10 +03:00
Ruchi Kandoi
124acbcfe3 power: Avoids bogus error messages for the suspend aborts.
Avoids printing bogus error message "tasks refusing to freeze", in cases
where pending wakeup source caused the suspend abort.

Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Change-Id: I913ad290f501b31cd536d039834c8d24c6f16928
2017-10-15 17:05:10 +03:00
Iliyan Malchev
84612c4595 PM: wakeup_reasons: fix race condition
log_possible_wakeup_reason() and stop_logging_wakeup_reasons() can race, as the
latter can be called from process context, and both can run on separate cores.

Change-Id: I306441d0be46dd4fe58c55cdc162f9d61a28c27d
Signed-off-by: Iliyan Malchev <malchev@google.com>
2017-10-15 17:05:09 +03:00
Dmitry Shmidt
563e031bd3 Power: Report total suspend times from boot in suspend_since_boot
This node exports five values separated by space.
        From left to right:
        1. Amount of suspend/resume cycles
        2. Amount of suspend abort cycles
        3. Total time spent in suspend/resume process
        4. Total time in suspend abort process
        5. Total time spent sleep in suspend state

Change-Id: Ife188fd8386dce35f95fa7ba09fbc9d7e152db62
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2017-10-15 17:05:09 +03:00
Iliyan Malchev
953a4840dd PM: extend suspend_again mechanism to use partialresume
The old platform suspend_again callback overrides drivers' votes, such that if
it implemented and returns false, then we do not call the partialresume
handlers.  When it doesn't exists or returns true, then we also query the
registered drivers for consensus.

When a device resumes from suspend, the suspend/resume code invokes
partialresume to check to see if the set of wakeup interrupts all have matching
handlers. If this is not the case, the PM subsystem can continue to resume as
before.  If all of the wakeup sources have matching handlers, then those are
invoked in turn (and can block), and if all of them reach consensus that the
reason for the wakeup can be ignored, they say so to the PM subsystem, which
goes right back into suspend.

Signed-off-by: Iliyan Malchev <malchev@google.com>
Change-Id: Iaeb9ed78c4b5fb815c6e9c701233e703f481f962
2017-10-15 17:05:08 +03:00
Iliyan Malchev
4e0c8780cc power: add partial-resume framework
Partial resume refers to the concept of not waking up userspace when the kernel
comes out of suspend for certain types of events that we wish to discard.  An
example is a network packet that can be disacarded in the kernel, or spurious
wakeup event that we wish to ignore.  Partial resume allows drivers to register
callbacks, one one hand, and provides hooks into the PM's suspend/resume
mechanism, on the other.

When a device resumes from suspend, the core suspend/resume code invokes
partialresume to check to see if the set of wakeup interrupts all have
matching handlers. If this is not the case, the PM subsystem can continue to
resume as before.  If all of the wakeup sources have matching handlers, then
those are invoked in turn (and can block), and if all of them reach consensus
that the reason for the wakeup can be ignored, they say so to the PM subsystem,
which goes right back into suspend.  This latter support is implemented in a
separate change.

Signed-off-by: Iliyan Malchev <malchev@google.com>
Change-Id: Id50940bb22a550b413412264508d259f7121d442
2017-10-15 17:05:08 +03:00
Iliyan Malchev
7e87a4dc87 PM: wakeup_reason: correctly deduce wakeup interrupts
The wakeup_reason driver works by having a callback log_wakeup_reason(), be
called by the resume path once for each wakeup interrupt, with the irq number
as argument.  It then saves this interrupt in an array, and reports it when
requested (via /sys/kernel/wakeup_reasons/last_resume_reason) and also prints
the information out in kmsg.

This approach works, but it has the deficiency that often the reported wakeup
interrupt, while correct, is not the interrupt truly responsible for the
wakeup.  The reason for this is due to chained interrupt controllers (whether
in hardware or simulated in software).  It could be, for example, that the
power button is wired to a GPIO handled by a single interrupt for all GPIOs,
which interrupt then determines the GPIO and maps this to a software interrupt.
Whether this is done in software, or by chaining interrupt controllers, the end
result is that the wakeup reason will show not the interrupt associated with
the power button, but the base-GPIO interrupt instead.

This patch reworks the wakeup_sources driver such that it reports those final
interrupts we are interested in, and not the intermediate (and not the base)
ones.  It does so as follows:

-- The assumption is that generic_handle_irq() is called to dispatch all
   interrupts; due to this, chained interrupts result in recursive calls of
   generic_handle_irq().
-- We reconstruct the chains of interrupts that originate with the base wakeup
   interrupt and terminate with the interrupt we are interested in by tracing
   the calls to generic_handle_irq()
-- The tracing works by maitaining a per-cpu counter that is incremented with
   each call to generic_handle_irq(); that counter is reported to the
   wakeup_sources driver by a pair of functions, called
   log_possible_wakeup_reason_start() and log_possible_wakeup_reason_complete().
   The former is called before generic_handle_irq() handles the interrupt
   (thereby potentially calling itself recusively) and the latter afterward.
-- The two functions mentioned above are complemented by log_base_wake_reason()
   (renamed from log_wakeup_reason()), which is used to report the base wakeup
   interrupts to the wakeup_reason driver.
-- The three functions work together to build a set of trees, one per base
   wakeup reason, the leaves of which correspond to the interrupts we are
   interesed in; these trees can be arbitratily complex, though in reality they
   most often are a single node, or a chain of two nodes.  The complexity
   supports arbitrarily involved interrupt dispatch.
-- On resume, we build the tree; once the tree is completed, we walk it
   recursively, and print out to kmesg the (more useful) list of wakeup
   sources; simiarly, we walk the tree and print the leaves when
   /sys/kernel/wakeup_reasons/last_resume_reason is read.

Signed-off-by: Iliyan Malchev <malchev@google.com>
Change-Id: If8acb2951b61d2c6bcf4d011fe04d7f91057d139
2017-10-15 17:05:07 +03:00
Iliyan Malchev
4dbec3e7db irq_flow_handler_t now returns bool
Alter the signature of irq_flow_handler_t to return true for those interrupts
whose handlers were invoked, and false otherwise.  Also rework the actual
handlers, handle_.*_irq, to support the new signature.

Change-Id: I8a50410c477692bbcd39a0fefdac14253602d1f5
Signed-off-by: Iliyan Malchev <malchev@google.com>
2017-10-15 17:05:07 +03:00
Dmitry Shmidt
13e2b3277d PM: wakeup_reason: add check_wakeup_reason() to verify wakeup source irq
Wakeup reason is set before driver resume handlers are called.
It is cleared before driver suspend handlers are called, on
PM_SUSPEND_PREPARE.

Change-Id: I04218c9b0c115a7877e8029c73e6679ff82e0aa4
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Signed-off-by: Iliyan Malchev <malchev@google.com>
2017-10-15 16:24:04 +03:00
Ruchi Kandoi
e532467dab power: log the last suspend abort reason.
Extends the last_resume_reason to log suspend abort reason. The abort
reasons will have "Abort:" appended at the start to distinguish itself
from the resume reason.

Change-Id: Id3c62fc0cb86ca2e05a69e40de040b94f32be389
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Signed-off-by: Iliyan Malchev <malchev@google.com>
2017-10-15 16:23:56 +03:00
Ruchi Kandoi
1154a48192 PM: wakeup_reason: add functionality to log the last suspend-abort reason.
Extends the last_resume_reason to log suspend abort reason. The abort
reasons will have "Abort:" appended at the start to distinguish itself
from the resume reason.

Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Signed-off-by: Iliyan Malchev <malchev@google.com>
Change-Id: I3207f1844e3d87c706dfc298fb10e1c648814c5f
2017-10-15 16:17:14 +03:00
Iliyan Malchev
c9816de694 PM: wakeup_reason: add functions to query and clear wakeup reasons
The query results are valid until the next PM_SUSPEND_PREPARE.

Change-Id: I6bc2bd47c830262319576a001d39ac9a994916cf
Signed-off-by: Iliyan Malchev <malchev@google.com>
2017-10-15 16:17:14 +03:00