mako: touch: PLG137 firmware E044 update

Improved ghost touch issues by
- Upgraded baseline check algorithm
- Adjusted touch sensitivity

It doesn't help in all cases for b/9236385

Bug: 7725315
Bug: 9236385
Change-Id: I1850427bac84620f34cad61bdfd9b16bbf692e32
Signed-off-by: Jongrak Kwon <jongrak.kwon@lge.com>
seq_file: always update file->f_pos in seq_lseek()

This issue was first pointed out by Jiaxing Wang several months ago, but no
further comments:
https://lkml.org/lkml/2013/6/29/41

As we know pread() does not change f_pos, so after pread(), file->f_pos
and m->read_pos become different. And seq_lseek() does not update file->f_pos
if offset equals to m->read_pos, so after pread() and seq_lseek()(lseek to
m->read_pos), then a subsequent read may read from a wrong position, the
following program produces the problem:

    char str1[32] = { 0 };
    char str2[32] = { 0 };
    int poffset = 10;
    int count = 20;

    /*open any seq file*/
    int fd = open("/proc/modules", O_RDONLY);

    pread(fd, str1, count, poffset);
    printf("pread:%s\n", str1);

    /*seek to where m->read_pos is*/
    lseek(fd, poffset+count, SEEK_SET);

    /*supposed to read from poffset+count, but this read from position 0*/
    read(fd, str2, count);
    printf("read:%s\n", str2);

out put:
pread:
 ck_netbios_ns 12665
read:
 nf_conntrack_netbios

/proc/modules:
nf_conntrack_netbios_ns 12665 0 - Live 0xffffffffa038b000
nf_conntrack_broadcast 12589 1 nf_conntrack_netbios_ns, Live 0xffffffffa0386000

So we always update file->f_pos to offset in seq_lseek() to fix this issue.

cherry-picked from https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/fs/seq_file.c?id=05e16745c0c471bba313961b605b6da3b21a853d

Signed-off-by: Jiaxing Wang <hello.wjx@gmail.com>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Conflicts:
	fs/seq_file.c

Change-Id: If419b92498e2c3e08669a4342e9b9ebf99ad3768
Signed-off-by: Devin Kim <dojip.kim@lge.com>
fs/dcache.c: Fix the too small buffer for dname

temp[64] is used for internal temporary buffer in dynamic_dname().
This is for dname. But It's too small. dname's size may be > 64.
In that case, it returns as -ENAMETOOLONG. So Increase the buffer size
to 256 for avoiding this issue.

The following was caused by the small buffer.
WARNING: at /kernel/mm/page_alloc.c:2470 __alloc_pages_nodemask+0x24c/0x938()
CPU: 2 PID: 505 Comm: android.bg Not tainted 3.10.0-g2f73780-00003-g2ff41d9-dirty #13
[<c010ba3c>] (unwind_backtrace+0x0/0x11c) from [<c0109cac>] (show_stack+0x10/0x14)
[<c0109cac>] (show_stack+0x10/0x14) from [<c01939a0>] (warn_slowpath_common+0x48/0x68)
[<c01939a0>] (warn_slowpath_common+0x48/0x68) from [<c0193a7c>] (warn_slowpath_null+0x18/0x20)
[<c0193a7c>] (warn_slowpath_null+0x18/0x20) from [<c0222454>] (__alloc_pages_nodemask+0x24c/0x938)
[<c0222454>] (__alloc_pages_nodemask+0x24c/0x938) from [<c0222b50>] (__get_free_pages+0x10/0x24)
[<c0222b50>] (__get_free_pages+0x10/0x24) from [<c024faf8>] (kmalloc_order_trace+0x24/0xf0)
[<c024faf8>] (kmalloc_order_trace+0x24/0xf0) from [<c024fe20>] (__kmalloc+0x30/0x244)
[<c024fe20>] (__kmalloc+0x30/0x244) from [<c02723c8>] (seq_read+0x270/0x464)
[<c02723c8>] (seq_read+0x270/0x464) from [<c0256a18>] (vfs_read+0xa4/0x134)
[<c0256a18>] (vfs_read+0xa4/0x134) from [<c0256de8>] (SyS_read+0x38/0x68)
[<c0256de8>] (SyS_read+0x38/0x68) from [<c0106140>] (ret_fast_syscall+0x0/0x30)

Change-Id: I74f5217ba3c4be73e91f33f900f1f0c26810cc05
Signed-off-by: Devin Kim <dojip.kim@lge.com>
android: configs: Grab the android/configs from kernel/common

This is a squash of all changes from kernel/common android-3.4 up to
  5e35d66 android: configs: add IPV6 ROUTE INFO

Change-Id: I848f1865ec7da1dfc3338a3e9d7f944a6f00f2a6
Signed-off-by: JP Abgrall <jpa@google.com>
SELinux: include definition of new capabilities

The kernel has added CAP_WAKE_ALARM and CAP_EPOLLWAKEUP.  We need to
define these in SELinux so they can be mediated by policy.

Change-Id: I8a3e0db15ec5f4eb05d455a57e8446a8c2b484c2
Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
[sds: rename epollwakeup to block_suspend to match upstream merge]
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
(cherry picked from commit c6a020c889756568d0e2f3ab0c1f04ad9fcb320c)
android: configs: Add CONFIG_NETFILTER_XT_TARGET_IDLETIMER

Signed-off-by: Ashish Sharma <ashishsharma@google.com>
tcp: add a sysctl to config the tcp_default_init_rwnd

The default initial rwnd is hardcoded to 10.

Now we allow it to be controlled via
  /proc/sys/net/ipv4/tcp_default_init_rwnd
which limits the values from 3 to 100

This is somewhat needed because ipv6 routes are
autoconfigured by the kernel.

See "An Argument for Increasing TCP's Initial Congestion Window"
in https://developers.google.com/speed/articles/tcp_initcwnd_paper.pdf

Change-Id: I386b2a9d62de0ebe05c1ebe1b4bd91b314af5c54
Signed-off-by: JP Abgrall <jpa@google.com>

Conflicts:
	include/net/tcp.h
ping: prevent NULL pointer dereference on write to msg_name

A plain read() on a socket does set msg->msg_name to NULL. So check for
NULL pointer first.

[Backport of net-next cf970c002d270c36202bd5b9c2804d3097a52da0]

Bug: 12780426
Change-Id: Ida66892d359d2dfbb32803d8b0872bf8c0bb3865
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
(cherry picked from commit 9ad40c7df302ef477a3359dc02cc4b1834c948fc)
mako: touch: fix i2c error after firmware upgrade

After firmware upgrade, there should be some delay to
prevent i2c error. Added booting_delay to avoid the i2c error.

Change-Id: Icbc9c656d2f7db1329e83553cc5c1e20033600e5
Signed-off-by: Jongrak Kwon <jongrak.kwon@lge.com>
mako: touch: add error checking for reading descriptor

Previous code didn't check errors for reading descriptors.
Normally there's no error during reading descriptors but
touch device won't be working until complete power recycle
once it happens.

Change-Id: Ie3cb329cd85f59f592c5c9994c9db84c58f487ca
Signed-off-by: Jongrak Kwon <jongrak.kwon@lge.com>
cfg80211: add flags to define country IE processing rules

802.11 cards may have different country IE parsing behavioural
preferences and vendors may want to support these. These preferences
were managed by the WIPHY_FLAG_CUSTOM_REGULATORY and the
WIPHY_FLAG_STRICT_REGULATORY flags and their combination.
Instead of using this existing notation, split out the country IE
behavioural preferences to a new flag. This will allow us to add more
customizations easily and make the code more maintainable. Also add
a new flag to disable country IE hints issued by the CORE as the
first customization.

Change-Id: I66ba4a92ac0f029a115eea0a274b02db11279787
CRs-Fixed: 542802
Signed-off-by: Mihir Shete <smihir@codeaurora.org>
prima: release v3.2.3.16

    git://codeaurora.org/external/wlan/prima.git

    bbb00be wlan : Revision 3.2.3.16
    e5cb4d6 wlan: Initilize country IE prefrence flag
    04b4db0 wlan: VOS ASSERT in csrRoamCompletion due to Assoc ref count.
    10801e4 wifi: Scan list not updated with correct APs on band change.
    6157d55 wlan : Revision 3.2.3.15
    118d50b wlan: Fix to pass global temporary dynamic IPv6 addr
    9c5a189 wlan: Fix for handling IPv6 notifier block rightly.
    ff6ea2c Registering IPv6 notifier to notify change in IP.
    8482b36 wlan : Revision 3.2.3.14
    515bf61 wlan : Updated TDLS parameters in ini
    8178e94 wlan: Flush scan results on PNO indication event.

Signed-off-by: Ed Tam <etam@google.com>
fix false disconnect due to a signal sent to the reading process

- In the current implementation, when a signal is sent to the reading process,
  read is cancelled by calling usb_ep_dequeue, which lead into calling
  acc_complete_out with ECONNRESET, but the current logic treats it as
  disconnection, which makes the device inaccessible until cable is actually
  disconnected.
- The fix calls disconnect only when ESHUTDOWN error is passed.
- If data has already arrived while trying cancelling, the data is marked
  as available, and it will be read out on the next read. This is necessary
  as USB bulk is assumed to guarantee no data loss.

Signed-off-by: keunyoung <keunyoung@google.com>
Power: add an API to log wakeup reasons

Add API log_wakeup_reason() and expose it to userspace via sysfs path
/sys/kernel/wakeup_reasons/last_resume_reason

Change-Id: I81addaf420f1338255c5d0638b0d244a99d777d1
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
POWER: fix compile warnings in log_wakeup_reason

Change I81addaf420f1338255c5d0638b0d244a99d777d1 introduced compile
warnings, fix these.

Change-Id: I05482a5335599ab96c0a088a7d175c8d4cf1cf69
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
POWER: Add an API call to log wake wakeup reason

Change-Id: I8bf670b07dcd52e29214ebb4e6e42dddd8c3d35e
Signed-off-by: Ruchi kandoi <kandoiruchi@google.com>
prima: release v3.2.3.18

    git://codeaurora.org/external/wlan/prima.git

    ddf6376 wlan : Revision 3.2.3.18
    c7f2ee4 wlan: adding cfg.ini parameter to configure to RA filter.
    b55e3a1 wlan : Revision 3.2.3.17
    82b2600 wlan: Remove extra line & error handling
    479d343 wlan: Check for WatchDog reset status during queue selection
    9322c18 wlan: Use HDD context flag to check SSR status
    1c12443 wlan: Remove "isMcAddrListFilter" INI param
    9297d6c wlan: Multicast Address Filter cleanup
    375d30f wlan: Updating the Channel list based on 11d from Nv.bin.
    666d726 wlan: Additional Scan IE data is not as per interface.

Signed-off-by: Ed Tam <etam@google.com>
Revert "POWER: Add an API call to log wake wakeup reason"

This reverts commit 92869b73c2a59c151215bd6a0c91e2d3a3767994.

Change-Id: Ia1e07f9bbaf9784726020518807585a9c78bf53a
Revert "POWER: fix compile warnings in log_wakeup_reason"

This reverts commit 0d7de069b17d4f766203f106e4948eb8353292eb.

Change-Id: I7d421be1d3337906a31b9360504faee1e6492f92
Revert "Power: add an API to log wakeup reasons"

This reverts commit 15be381a2614982294b65bc36814de29a7d2502a.

Change-Id: I897ce59024399c8d5c59942d08c985eef5cf1fe3