firefly-linux-kernel-4.4.55.git
11 years agocpufreq: interactive: add boost pulse interface
Todd Poynor [Thu, 3 May 2012 07:16:55 +0000 (00:16 -0700)]
cpufreq: interactive: add boost pulse interface

Change-Id: Icf1e86d2065cc8f0816ba9c6b065eb056d4e8249
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: set floor for boosted speed
Todd Poynor [Fri, 27 Apr 2012 04:41:40 +0000 (21:41 -0700)]
cpufreq: interactive: set floor for boosted speed

Allow speed to drop to flooor frequency but not below, don't pin
to speed at last boost.

Change-Id: I0147c2b7a2e61ba16820605af6baaf09570be787
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: Add sysfs boost interface for hints from userspace
Todd Poynor [Tue, 24 Apr 2012 03:42:41 +0000 (20:42 -0700)]
cpufreq: interactive: Add sysfs boost interface for hints from userspace

The explicit hint on/off version.

Change-Id: Ibf62b6d45bf6fb8c9c055b9bdaf074ce9374c04f
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: remove unused target_validate_time_in_idle
Todd Poynor [Tue, 24 Apr 2012 04:22:45 +0000 (21:22 -0700)]
cpufreq: interactive: remove unused target_validate_time_in_idle

Change-Id: I37c5085b91318242612440dfd775ad762996612f
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: Boost frequency on touchscreen input
Todd Poynor [Tue, 3 Apr 2012 00:17:14 +0000 (17:17 -0700)]
cpufreq: interactive: Boost frequency on touchscreen input

Based on previous patches by Tero Kristo <tero.kristo@nokia.com>,
Brian Steuer <bsteuer@codeaurora.org>,
David Ng <dave@codeaurora.org>,
Antti P Miettinen <amiettinen@nvidia.com>, and
Thomas Renninger <trenn@suse.de>

Change-Id: Ic55fedcf6f9310f43a7022fb88e23b0392122769
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: Separate speed target revalidate time and initial set time
Todd Poynor [Fri, 20 Apr 2012 20:18:32 +0000 (13:18 -0700)]
cpufreq: interactive: Separate speed target revalidate time and initial set time

Allow speed drop after min_sample_time elapses from last time
the current speed was last re-validated as appropriate for
current load / input boost.

Allow speed bump after min_sample_time (or above_hispeed_delay)
elapses from the time the current speed was originally set.

Change-Id: Ic25687a7a53d25e6544c30c47d7ab6f27a47bee8
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: base hispeed bump on target freq, not actual
Todd Poynor [Thu, 19 Apr 2012 19:52:48 +0000 (12:52 -0700)]
cpufreq: interactive: base hispeed bump on target freq, not actual

For systems that set a common speed for all CPUs, checking current
speed here could bypass the intermediate hispeed bump decision for
this CPU when another CPU was already at hispeed.  This could
result in an overly high setting (for all CPUs) in situations
where all CPUs were about to drop to load levels that map to
hispeed or below.

Change-Id: I186f23dcfc5e2b6336cab8b0327f0c8a9a4482bc
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: adjust code and documentation to match
Todd Poynor [Wed, 18 Apr 2012 00:39:34 +0000 (17:39 -0700)]
cpufreq: interactive: adjust code and documentation to match

Change-Id: If59c668d514a29febe5c35404fd9d01df8548eb1
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: configurable delay before raising above hispeed
Todd Poynor [Sat, 14 Apr 2012 03:18:02 +0000 (20:18 -0700)]
cpufreq: interactive: configurable delay before raising above hispeed

Change-Id: I4d6ac40b23a3790d48e30c37408284e9f955e8fa
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: don't drop speed if recently at higher load
Todd Poynor [Sat, 7 Apr 2012 02:59:36 +0000 (19:59 -0700)]
cpufreq: interactive: don't drop speed if recently at higher load

Apply min_sample_time to the last time the current target speed
was originally requested or re-validated as appropriate for the
current load, not to the time since the current speed was
originally set.  Avoids periodic dips in speed during bursty
loads.

Change-Id: I250bda657985de60373f9897cc41f480664d51a1
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: set at least hispeed when above hispeed load
Todd Poynor [Sat, 7 Apr 2012 02:50:12 +0000 (19:50 -0700)]
cpufreq: interactive: set at least hispeed when above hispeed load

If load is above go_hispeed_load, always go to at least hispeed_freq,
even when reducing speed from a higher speed, not just when jumping
up from minimum speed.  Avoids running at a lower than intended
speed after a burst of even higher load.

Change-Id: I5b9d2a15ba25ce609b21bac7c724265cf6838dee
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq: interactive: apply intermediate load to max speed not current
Todd Poynor [Fri, 6 Apr 2012 08:13:09 +0000 (01:13 -0700)]
cpufreq: interactive: apply intermediate load to max speed not current

Evaluate spikes in load (below go_hispeed_load) against the maximum
speed supported by the device, not the current speed (which tends to
make it too difficult to raise speed to intermediate levels until
very busy).

Change-Id: Ib937006abf8bedb60891a739acd733e89b732ae0
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agocpufreq interactive governor: event tracing
Todd Poynor [Fri, 17 Feb 2012 00:27:59 +0000 (16:27 -0800)]
cpufreq interactive governor: event tracing

Change-Id: Ic13614a3da2faa2d4bd215ca3eb7191614f0cf66
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agonetfilter: xt_qtaguid: fix ipv6 protocol lookup
JP Abgrall [Tue, 17 Apr 2012 23:00:07 +0000 (16:00 -0700)]
netfilter: xt_qtaguid: fix ipv6 protocol lookup

When updating the stats for a given uid it would incorrectly assume
IPV4 and pick up the wrong protocol when IPV6.

Change-Id: Iea4a635012b4123bf7aa93809011b7b2040bb3d5
Signed-off-by: JP Abgrall <jpa@google.com>
11 years agonetfilter: qtaguid: initialize a local var to keep compiler happy.
JP Abgrall [Sat, 14 Apr 2012 02:22:35 +0000 (19:22 -0700)]
netfilter: qtaguid: initialize a local var to keep compiler happy.

There was a case that might have seemed like new_tag_stat was not
initialized and actually used.
Added comment explaining why it was impossible, and a BUG()
in case the logic gets changed.

Change-Id: I1eddd1b6f754c08a3bf89f7e9427e5dce1dfb081
Signed-off-by: JP Abgrall <jpa@google.com>
11 years agoARM: etm: Add sysfs entry to enable return stack if supported
Arve Hjønnevåg [Wed, 4 Apr 2012 01:01:03 +0000 (18:01 -0700)]
ARM: etm: Add sysfs entry to enable return stack if supported

Change-Id: Icb73d60324ad0ddfc3e8a450a28bb3d90c702788
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: etm: Add sysfs entry to disable branch_output flag
Arve Hjønnevåg [Tue, 3 Apr 2012 23:15:36 +0000 (16:15 -0700)]
ARM: etm: Add sysfs entry to disable branch_output flag

Change-Id: Ib91208a2c33621aa2d7bd9aa72bfbc670d9d5f1d
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: etm: Add sysfs entry to set context-id-size
Arve Hjønnevåg [Tue, 3 Apr 2012 00:20:32 +0000 (17:20 -0700)]
ARM: etm: Add sysfs entry to set context-id-size

Change-Id: I520dfb6e593dac131de8b9b1db77f1c734f18c24
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: etm: Add sysfs entry to enable timestamps if supported
Arve Hjønnevåg [Tue, 3 Apr 2012 00:20:32 +0000 (17:20 -0700)]
ARM: etm: Add sysfs entry to enable timestamps if supported

Change-Id: Iff964ba2f6236ed81863e02ec7b3ec9fbc48044a
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: etm: Check arch version and disable data tracing for ptm
Arve Hjønnevåg [Tue, 3 Apr 2012 03:18:56 +0000 (20:18 -0700)]
ARM: etm: Check arch version and disable data tracing for ptm

Change-Id: If2cb7928d0711f48348443d882a12416be9c5910
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: etm: Wait for etm/ptm(s) to stop before requesting PowerDown
Arve Hjønnevåg [Thu, 29 Mar 2012 04:03:13 +0000 (21:03 -0700)]
ARM: etm: Wait for etm/ptm(s) to stop before requesting PowerDown

When PowerDown was requested at the same time as ProgBit, the
formatter flush command that follows could get stuck.

Change-Id: Iafb665f61f055819e64ca1dcb60398c656f593e4
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agogpu: ion: ion_carveout_heap: fix for 3.4
Colin Cross [Wed, 4 Apr 2012 20:50:43 +0000 (13:50 -0700)]
gpu: ion: ion_carveout_heap: fix for 3.4

__arch_ioremap is no longer available, use __arm_ioremap instead.

Change-Id: Ied98208a3c1be6bc5ac195c3ade496fbb5003f37
Signed-off-by: Colin Cross <ccross@android.com>
11 years agousb: gadget: adb: Only enable the gadget when adbd is ready
Benoit Goby [Tue, 20 Mar 2012 01:56:52 +0000 (18:56 -0700)]
usb: gadget: adb: Only enable the gadget when adbd is ready

When adb is enabled, only connect the gadget when adbd is ready. If adbd
dies or is restarted (e.g. "adb root"), the gadget is disconnected when
the adb device is close, and it is re-connected once adb re-open the
device.

- Add callbacks to adb, similar to FunctionFs callbacks, to notify the
  gadget when the daemon is ready or closed.
- Refcount calls to android_enable/android_disable to enable the gadget
  only once all the function daemons are ready.
- Add enable/disble to android_usb_function to notify the function when
  it is added/removed from the list of enabled functions.

Change-Id: Id54ff85aec9cf8715c94b4f9bd6137a79ad58bfc
Signed-off-by: Benoit Goby <benoit@android.com>
11 years agoARM: fiq_debugger: fix multiple consoles and make it a preferred console
Colin Cross [Sun, 18 Mar 2012 22:25:55 +0000 (15:25 -0700)]
ARM: fiq_debugger: fix multiple consoles and make it a preferred console

Fix setting up consoles on multiple fiq debugger devices by
splitting the tty driver init into the initcall, and initializing
the single tty device during probe.  Has the side effect of moving
the tty device node to /dev/ttyFIQx, where x is the platform device
id, which should normally match the serial port.

To avoid having to pass a different console=/dev/ttyFIQx for every
device, make the fiq debugger a preferred console that will be used
by default if no console was passed on the command line.

Change-Id: I6cc2670628a41e84615859bc96adba189966d647
Signed-off-by: Colin Cross <ccross@android.com>
11 years agokdb: support new lines without carriage returns
Colin Cross [Thu, 15 Mar 2012 02:26:53 +0000 (19:26 -0700)]
kdb: support new lines without carriage returns

kdb expects carriage returns through the serial port to terminate
commands.  Modify it to accept the first seen carriage return or
new line as a terminator, but not treat \r\n as two terminators.

Change-Id: I06166017e7703d24310eefcb71c3a7d427088db7
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoARM: fiq_debugger: add support for kgdb
Colin Cross [Thu, 15 Mar 2012 02:23:29 +0000 (19:23 -0700)]
ARM: fiq_debugger: add support for kgdb

Adds polling tty ops to the fiq debugger console tty, which allows
kgdb to run against an fiq debugger console.

Add a check in do_sysrq to prevent enabling kgdb from the fiq
debugger unless a flag (writable only by root) has been set. This
should make it safe to enable KGDB on a production device.

Also add a shortcut to enable the console and kgdb together, to
allow kgdb to be enabled when the shell on the console is not
responding.

Change-Id: Ifc65239ca96c9887431a6a36b9b44a539002f544
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoARM: fiq_debugger: add debug_putc
Colin Cross [Thu, 15 Mar 2012 19:57:20 +0000 (12:57 -0700)]
ARM: fiq_debugger: add debug_putc

Convert all the calls to state->pdata->uart_putc to a debug_putc
helper.

Change-Id: Idc007bd170ff1b51d0325e238105ae0c86d23777
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoARM: fiq_debugger: add support for reboot commands
Colin Cross [Wed, 14 Mar 2012 23:29:47 +0000 (16:29 -0700)]
ARM: fiq_debugger: add support for reboot commands

Pass the rest of the reboot command to kernel_restart to allow
reboot bootloader to work from FIQ debugger.

Change-Id: I4e7b366a69268dda17ffcf4c84f2373d15cb1271
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoARM: fiq_debugger: fix compiling for v3.3
Colin Cross [Wed, 14 Mar 2012 23:28:45 +0000 (16:28 -0700)]
ARM: fiq_debugger: fix compiling for v3.3

Call kernel_restart instead of arch_reset, the ARM reset handling
has changed.

Remove localtimer irq printing, they now show up in the regular
irq stats.

Change-Id: I523da343b292c5711f3e1cbfd766d32eea2da84e
Signed-off-by: Colin Cross <ccross@android.com>
11 years agousb: gadget: adb: do not set error flag when dequeuing req
Colin Cross [Fri, 9 Mar 2012 01:57:51 +0000 (17:57 -0800)]
usb: gadget: adb: do not set error flag when dequeuing req

When an ep_out req is dequeued because of userspace freezing,
don't set the error flag.

Change-Id: I680f1a1059b8ac2244aaa069e7d42dc44abf98e9
Signed-off-by: Colin Cross <ccross@android.com>
11 years agousb: gadget: adb: allow freezing in adb_read
Colin Cross [Mon, 5 Mar 2012 21:29:45 +0000 (13:29 -0800)]
usb: gadget: adb: allow freezing in adb_read

wait_event_interruptible in adb_read might return -ERESTARTSYS if
userspace is frozen during adb_read or another signal is delivered
to adb.  If so, don't set dev->error to avoid resetting the adb
connection.

Change-Id: I5a7baa013a9a3a3b5305de7e6a0d18546a560018
Signed-off-by: Colin Cross <ccross@android.com>
11 years agousb: gadget: accessory: Add Android Accessory function
Benoit Goby [Mon, 19 Dec 2011 22:39:37 +0000 (14:39 -0800)]
usb: gadget: accessory: Add Android Accessory function

USB accessory mode allows users to connect USB host hardware
specifically designed for Android-powered devices. The accessories
must adhere to the Android accessory protocol outlined in the
http://accessories.android.com documentation. This allows
Android devices that cannot act as a USB host to still interact with
USB hardware. When an Android device is in USB accessory mode, the
attached Android USB accessory acts as the host, provides power
to the USB bus, and enumerates connected devices.

Signed-off-by: Mike Lockwood <lockwood@android.com>
11 years agousb: gadget: adb: Add ADB function
Benoit Goby [Mon, 19 Dec 2011 22:38:41 +0000 (14:38 -0800)]
usb: gadget: adb: Add ADB function

Android Debug Bridge (adb) is a command line tool that lets
users communicate with a Android-powered device. It is used
mainly to debug applications and tranfer files. f_adb implements
the transport layer between the ADB Server (on the host) and the
ADBD daemon (on the device).

Signed-off-by: Mike Lockwood <lockwood@android.com>
11 years agousb: gadget: mtp: Add MTP/PTP function
Benoit Goby [Mon, 19 Dec 2011 22:37:50 +0000 (14:37 -0800)]
usb: gadget: mtp: Add MTP/PTP function

USB gadget function driver used by the Android framework to
implement the MTP and PTP protocols. It creates a character device
that provides an interface for fast transfer of files and
supports transferring files greater than 4GB.

Signed-off-by: Mike Lockwood <lockwood@android.com>
11 years agousb: gadget: Add Android Composite Gadget driver
Benoit Goby [Mon, 12 Dec 2011 21:01:23 +0000 (13:01 -0800)]
usb: gadget: Add Android Composite Gadget driver

The Android Gadget driver is a composite driver that allows
userspace to change at runtime the list of functions enabled in
its configuration and to configure these functions. It supports
multiple functions: acm, adb, rndis, mtp/ptp, mass storage and
accessory.

It is usually controlled by a daemon that changes the configuration
based on user settings. For example, rndis is enabled when the user
enables sharing the phone data connection and adb (Android Debug
Bridge) is only enabled when the user wants to debug applications
for security reasons.

As an example on how to use it, the following shell commands will
make the gadget disconnect from the host and make it be re-enumerated
as a composite with 1 rndis and 2 acm interfaces, and a different
product id:

echo 0       > /sys/class/android_usb/android0/enable
echo rndis,acm > /sys/class/android_usb/android0/functions
echo 2       > /sys/class/android_usb/android0/f_acm/instances
echo 2d01    > /sys/class/android_usb/android0/idProduct
echo 1       > /sys/class/android_usb/android0/enable

The driver requires a gadget controller that supports software
control of the D+ pullup and the controller driver must support
disabling the pullup during composite_bind.

Signed-off-by: Mike Lockwood <lockwood@android.com>
Signed-off-by: Benoit Goby <benoit@android.com>
11 years agousb: otg: otg-wakelock: fix build for 3.3
Colin Cross [Wed, 1 Feb 2012 22:23:15 +0000 (14:23 -0800)]
usb: otg: otg-wakelock: fix build for 3.3

Add missing module.h include

Change-Id: Ib0538ca569c9e0713ceefcd1f91c6bc089d2f2ba
Signed-off-by: Colin Cross <ccross@android.com>
11 years agousb: otg: Temporarily grab wakelock on charger and disconnect events
Todd Poynor [Tue, 27 Sep 2011 03:35:30 +0000 (20:35 -0700)]
usb: otg: Temporarily grab wakelock on charger and disconnect events

Change-Id: If995d4af4adcb08e8369009483f2956ad9627267
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agoHID: Add input_register callback.
Jaikumar Ganesh [Tue, 20 Sep 2011 23:40:43 +0000 (16:40 -0700)]
HID: Add input_register callback.

Add input_register callback which gets called after
hid_configure_usage is called for all the reports
and before the input device is registered. This allows
individual drivers to do extra work like input mapping just
before device registration.

Based on discussions with David Herrmann <dh.herrmann@googlemail.com>

Change-Id: Idab6fb4f7b1e5e569bd0410967288717e9d34c98
Signed-off-by: Jaikumar Ganesh <jaikumarg@android.com>
Changed to add return code to input_configured instead of
adding input_register

Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agofuse: Freeze client on suspend when request sent to userspace
Todd Poynor [Wed, 24 Aug 2011 22:01:30 +0000 (15:01 -0700)]
fuse: Freeze client on suspend when request sent to userspace

Suspend attempts can abort when the FUSE daemon is already frozen
and a client is waiting uninterruptibly for a response, causing
freezing of tasks to fail.

Use the freeze-friendly wait API, but disregard other signals.

Change-Id: Icefb7e4bbc718ccb76bf3c04daaa5eeea7e0e63c
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agohid-multitouch: Filter collections by application usage.
Jeff Brown [Sun, 24 Jul 2011 21:31:14 +0000 (14:31 -0700)]
hid-multitouch: Filter collections by application usage.

This change fixes two problems.

First, it ensures that the hid-multitouch driver does not incorrectly
map GenericDesktop usages that are intended for other applications,
such as a Mouse.

Second, it sets the appropriate input properties so that user-space
can distinguish TouchScreen devices (INPUT_PROP_DIRECT) from
TouchPad devices (INPUT_PROP_POINTER) and configure them accordingly.

Change-Id: I8c2d947929186ffe7cf04b37c76e29b9abecf8cb
Signed-off-by: jeffbrown@android.com
11 years agonet: Only NET_ADMIN is allowed to fully control TUN interfaces.
Chia-chi Yeh [Fri, 15 Jul 2011 22:32:57 +0000 (15:32 -0700)]
net: Only NET_ADMIN is allowed to fully control TUN interfaces.

Signed-off-by: Chia-chi Yeh <chiachi@android.com>
11 years agobridge: Have tx_bytes count headers like rx_bytes.
Ashish Sharma [Sat, 8 Oct 2011 00:54:16 +0000 (17:54 -0700)]
bridge: Have tx_bytes count headers like rx_bytes.

Since rx_bytes accounting does not include Ethernet Headers in
br_input.c, excluding ETH_HLEN on the transmit path for consistent
measurement of packet length on both the Tx and Rx chains.

The clean way would be for Rx to include the eth header, but the
skb len has already been adjusted by the time the br code sees the skb.
This is only a temporary workaround until we can completely ignore or
cleanly fix the skb->len handling.

Change-Id: I910de95a4686b2119da7f1f326e2154ef31f9972
Signed-off-by: Ashish Sharma <ashishsharma@google.com>
11 years agonetfilter: ipv6: fix crash caused by ipv6_find_hdr()
JP Abgrall [Thu, 29 Sep 2011 22:36:49 +0000 (15:36 -0700)]
netfilter: ipv6: fix crash caused by ipv6_find_hdr()

When calling:
    ipv6_find_hdr(skb, &thoff, -1, NULL)
on a fragmented packet, thoff would be left with a random
value causing callers to read random memory offsets with:
    skb_header_pointer(skb, thoff, ...)

Now we force ipv6_find_hdr() to return a failure in this case.
Calling:
  ipv6_find_hdr(skb, &thoff, -1, &fragoff)
will set fragoff as expected, and not return a failure.

Change-Id: Ib474e8a4267dd2b300feca325811330329684a88
Signed-off-by: JP Abgrall <jpa@google.com>
11 years agonetfilter: fixup the quota2, and enable.
JP Abgrall [Tue, 12 Jul 2011 19:02:59 +0000 (12:02 -0700)]
netfilter: fixup the quota2, and enable.

The xt_quota2 came from
  http://sourceforge.net/projects/xtables-addons/develop

It needed tweaking for it to compile within the kernel tree.
Fixed kmalloc() and create_proc_entry() invocations within
 a non-interruptible context.
Removed useless copying of current quota back to the iptable's
struct matchinfo:
  - those are per CPU: they will change randomly based on which
    cpu gets to update the value.
  - they prevent matching a rule: e.g.
      -A chain -m quota2 --name q1 --quota 123
     can't be followed by
      -D chain -m quota2 --name q1 --quota 123
    as the 123 will be compared to the struct matchinfo's quota member.
Use the NETLINK NETLINK_NFLOG family to log a single message
when the quota limit is reached.
It uses the same packet type as ipt_ULOG, but
 - never copies skb data,
 - uses 112 as the event number (ULOG's +1)
It doesn't log if the module param "event_num" is 0.

Change-Id: I021d3b743db3b22158cc49acb5c94d905b501492
Signed-off-by: JP Abgrall <jpa@google.com>
11 years agonetfilter: adding the original quota2 from xtables-addons
JP Abgrall [Tue, 21 Jun 2011 18:14:49 +0000 (11:14 -0700)]
netfilter: adding the original quota2 from xtables-addons

The original xt_quota in the kernel is plain broken:
  - counts quota at a per CPU level
    (was written back when ubiquitous SMP was just a dream)
  - provides no way to count across IPV4/IPV6.

This patch is the original unaltered code from:
  http://sourceforge.net/projects/xtables-addons

  at commit e84391ce665cef046967f796dd91026851d6bbf3

Change-Id: I19d49858840effee9ecf6cff03c23b45a97efdeb
Signed-off-by: JP Abgrall <jpa@google.com>
11 years agoUSB: OTG: Take wakelock when VBUS present
Todd Poynor [Sat, 2 Jul 2011 00:19:56 +0000 (17:19 -0700)]
USB: OTG: Take wakelock when VBUS present

Enabled by default, can disable with:
   echo N > /sys/module/otg_wakelock/parameters/enabled

Change-Id: I34974624c52ae23490852b44c270d2f326cf6116
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agogpu: ion: Add ION Memory Manager
Rebecca Schultz Zavin [Thu, 30 Jun 2011 02:44:29 +0000 (19:44 -0700)]
gpu: ion: Add ION Memory Manager

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
11 years agonetfilter: have ip*t REJECT set the sock err when an icmp is to be sent
JP Abgrall [Thu, 16 Jun 2011 21:37:03 +0000 (14:37 -0700)]
netfilter: have ip*t REJECT set the sock err when an icmp is to be sent

Allow the REJECT --reject-with icmp*blabla to also set the matching error
locally on the socket affected by the reject.
This allows the process to see an error almost as if it received it
via ICMP.
It avoids the local process who's ingress packet is rejected to have to
wait for a pseudo-eternity until some timeout kicks in.

Ideally, this should be enabled with a new iptables flag similar to
   --reject-with-sock-err
For now it is enabled with CONFIG_IP*_NF_TARGET_REJECT_SKERR option.

Change-Id: I649a4fd5940029ec0b3233e5abb205da6984891e
Signed-off-by: JP Abgrall <jpa@google.com>
11 years agonetfilter: add xt_qtaguid matching module
JP Abgrall [Mon, 20 Jun 2011 19:41:46 +0000 (12:41 -0700)]
netfilter: add xt_qtaguid matching module

This module allows tracking stats at the socket level for given UIDs.
It replaces xt_owner.
If the --uid-owner is not specified, it will just count stats based on
who the skb belongs to. This will even happen on incoming skbs as it
looks into the skb via xt_socket magic to see who owns it.
If an skb is lost, it will be assigned to uid=0.

To control what sockets of what UIDs are tagged by what, one uses:
  echo t $sock_fd $accounting_tag $the_billed_uid \
     > /proc/net/xt_qtaguid/ctrl
 So whenever an skb belongs to a sock_fd, it will be accounted against
   $the_billed_uid
  and matching stats will show up under the uid with the given
   $accounting_tag.

Because the number of allocations for the stats structs is not that big:
  ~500 apps * 32 per app
we'll just do it atomic. This avoids walking lists many times, and
the fancy worker thread handling. Slabs will grow when needed later.

It use netdevice and inetaddr notifications instead of hooks in the core dev
code to track when a device comes and goes. This removes the need for
exposed iface_stat.h.

Put procfs dirs in /proc/net/xt_qtaguid/
  ctrl
  stats
  iface_stat/<iface>/...
The uid stats are obtainable in ./stats.

Change-Id: I01af4fd91c8de651668d3decb76d9bdc1e343919
Signed-off-by: JP Abgrall <jpa@google.com>
11 years agonf: xt_socket: export the fancy sock finder code
JP Abgrall [Wed, 15 Jun 2011 23:52:40 +0000 (16:52 -0700)]
nf: xt_socket: export the fancy sock finder code

The socket matching function has some nifty logic to get the struct sock
from the skb or from the connection tracker.
We export this so other xt_* can use it, similarly to ho how
xt_socket uses nf_tproxy_get_sock.

Change-Id: I11c58f59087e7f7ae09e4abd4b937cd3370fa2fd
Signed-off-by: JP Abgrall <jpa@google.com>
11 years agonet: wireless: Skip connect warning for CONFIG_CFG80211_ALLOW_RECONNECT
Dmitry Shmidt [Fri, 28 Oct 2011 17:35:37 +0000 (10:35 -0700)]
net: wireless: Skip connect warning for CONFIG_CFG80211_ALLOW_RECONNECT

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
11 years agonet: wireless: Fix CFG80211_ALLOW_RECONNECT option for disconnect
Dmitry Shmidt [Tue, 18 Oct 2011 19:30:02 +0000 (12:30 -0700)]
net: wireless: Fix CFG80211_ALLOW_RECONNECT option for disconnect

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
11 years agonet: wireless: Add CFG80211_ALLOW_RECONNECT option
Dmitry Shmidt [Thu, 15 Sep 2011 16:22:35 +0000 (09:22 -0700)]
net: wireless: Add CFG80211_ALLOW_RECONNECT option

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
11 years agonet: wireless: change the expire time about each entry of scan results
jun.ho.lee [Fri, 9 Sep 2011 09:50:02 +0000 (18:50 +0900)]
net: wireless: change the expire time about each entry of scan results

Change-Id: I6e8d838d91bebc28f4cd09dcb8b9f1de775be13d
Signed-off-by: jun.ho.lee <jun.ho.lee@samsung.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
11 years agonet: wireless: Add CONFIG_WIFI_CONTROL_FUNC option
Dmitry Shmidt [Wed, 8 Jun 2011 22:16:52 +0000 (15:16 -0700)]
net: wireless: Add CONFIG_WIFI_CONTROL_FUNC option

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
11 years agonet: wireless: Add get_country_code functionality to platform
Dmitry Shmidt [Tue, 15 Feb 2011 00:58:48 +0000 (16:58 -0800)]
net: wireless: Add get_country_code functionality to platform

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
11 years agonetwork: wireless: Add get_mac_addr functionality to platform
Dmitry Shmidt [Thu, 3 Jun 2010 17:55:33 +0000 (10:55 -0700)]
network: wireless: Add get_mac_addr functionality to platform

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
11 years agoARM: etm: Power down etm(s) when tracing is not enabled
Arve Hjønnevåg [Thu, 24 Feb 2011 00:51:58 +0000 (16:51 -0800)]
ARM: etm: Power down etm(s) when tracing is not enabled

Without this change a saw an 18% increase in idle power consumption
on one deivce when trace support is compiled into the kernel. Now
I see the same increase only when tracing.

Change-Id: I21bb5ecf1b7d29ce3790ceeb5323409cc22d5a3b
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: etm: Support multiple ETMs/PTMs.
Arve Hjønnevåg [Sat, 5 Feb 2011 06:38:14 +0000 (22:38 -0800)]
ARM: etm: Support multiple ETMs/PTMs.

If more than one ETM or PTM are present, configure all of them
and enable the formatter in the ETB. This allows tracing on dual
core systems (e.g. omap4).

Change-Id: I028657d5cf2bee1b23f193d4387b607953b35888
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: etm: Return the entire trace buffer if it is empty after reset
Arve Hjønnevåg [Sat, 5 Feb 2011 06:38:14 +0000 (22:38 -0800)]
ARM: etm: Return the entire trace buffer if it is empty after reset

On some SOCs the read and write pointer are reset when the chip
resets, but the trace buffer content is preserved. If the status
bits indicates that the buffer is empty and we have never started
tracing, assume the buffer is full instead. This can be useful
if the system rebooted from a watchdog reset.

Change-Id: Iaf21c2c329c6059004ee1d38e3dfff66d7d28029
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: etm: Add some missing locks and error checks
Arve Hjønnevåg [Tue, 15 Feb 2011 05:09:51 +0000 (21:09 -0800)]
ARM: etm: Add some missing locks and error checks

It is not safe to call etm_lock or etb_lock without holding the
mutex since another thread may also have unlocked the registers.

Also add some missing checks for valid etb_regs in the etm sysfs
entries.

Change-Id: I939f76a6ea7546a8fc0d4ddafa2fd2b6f38103bb
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: etm: Configure data tracing
Arve Hjønnevåg [Tue, 1 Feb 2011 02:33:55 +0000 (18:33 -0800)]
ARM: etm: Configure data tracing

The old code enabled data tracing, but did not configure the
range. We now configure it to trace all data addresses by default,
and add a trace_data_range attribute to change the range or disable
data tracing.

Change-Id: I9d04e3e1ea0d0b4d4d5bcb93b1b042938ad738b2
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: etm: Allow range selection
Arve Hjønnevåg [Sat, 29 Jan 2011 07:44:43 +0000 (23:44 -0800)]
ARM: etm: Allow range selection

Trace kernel text segment by default as before, allow tracing of other
ranges by writing a range to /sys/devices/etm/trace_range, or to trace
everything by writing 0 0.

Change-Id: Ibb734ca820fedf79560b20536247f1e1700cdc71
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: etm: Don't try to clear the buffer full status after reading the buffer
Arve Hjønnevåg [Tue, 1 Feb 2011 05:34:47 +0000 (21:34 -0800)]
ARM: etm: Don't try to clear the buffer full status after reading the buffer

If the write address was at the end of the buffer, toggling the trace
capture bit would set the RAM-full status instead of clearing it, and
if any of the stop bits in the formatter is set toggling the trace
capture bit may not do anything.

Instead use the read position to find out if the data has already
been returned.

This also fixes the read function so it works when the trace buffer is
larger than the buffer passed in from user space. The old version
would reset the trace buffer pointers after every read, so the second
call to read would always return 0.

Change-Id: I75256abe2556adfd66fd5963e46f9e84ae4645e1
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: etm: Don't limit tracing to only non-secure code.
Arve Hjønnevåg [Sat, 29 Jan 2011 07:33:11 +0000 (23:33 -0800)]
ARM: etm: Don't limit tracing to only non-secure code.

On some systems kernel code is considered secure, and this code
already limits tracing to the kernel text segment which results
in no trace data.

Change-Id: I098a0753e874859446d098e1ee209f67fc13cd5d
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: etm: Don't require clock control
Arve Hjønnevåg [Sat, 29 Jan 2011 07:12:32 +0000 (23:12 -0800)]
ARM: etm: Don't require clock control

If clk_get fail, assume the etb does not need a separate clock.

Change-Id: Ia0bf3f5391e94a60ea45876aa7afc8a88a7ec3bf
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agonet: Reorder incoming packets in PPPoLAC and PPPoPNS.
Chia-chi Yeh [Fri, 15 Apr 2011 22:22:09 +0000 (15:22 -0700)]
net: Reorder incoming packets in PPPoLAC and PPPoPNS.

PPP handles packet loss but does not work with out of order packets.
This change performs reordering of incoming data packets within a
sliding window of one second. Since sequence number is optional,
receiving a packet without it will drop all queued packets.

Currently the logic is triggered by incoming packets, so queued
packets have to wait till another packet is arrived. It is done for
simplicity since no additional locks or threads are required. For
reliable protocols, a retransmission will kick it. For unreliable
protocols, queued packets just seem like packet loss. Time-critical
protocols might be broken, but they never work with queueing anyway.

Signed-off-by: Chia-chi Yeh <chiachi@android.com>
11 years agocpufreq: Prevent memory leak in cpufreq_stats on hotplug
Colin Cross [Sat, 29 Jan 2011 03:32:31 +0000 (19:32 -0800)]
cpufreq: Prevent memory leak in cpufreq_stats on hotplug

Ensures that cpufreq_stats_free_table is called before
__cpufreq_remove_dev on cpu hotplug (which also occurs during
suspend on SMP systems) to make sure that sysfs_remove_group
can get called before the cpufreq kobj is freed.  Otherwise,
the sysfs file structures are leaked.

Change-Id: I87e55277272f5cfad47e9e7c92630e990bb90069
Signed-off-by: Colin Cross <ccross@android.com>
11 years agocpufreq: interactive: New 'interactive' governor
Mike Chan [Tue, 22 Jun 2010 18:26:45 +0000 (11:26 -0700)]
cpufreq: interactive: New 'interactive' governor

This governor is designed for latency-sensitive workloads, such as
interactive user interfaces.  The interactive governor aims to be
significantly more responsive to ramp CPU quickly up when CPU-intensive
activity begins.

Existing governors sample CPU load at a particular rate, typically
every X ms.  This can lead to under-powering UI threads for the period of
time during which the user begins interacting with a previously-idle system
until the next sample period happens.

The 'interactive' governor uses a different approach. Instead of sampling
the CPU at a specified rate, the governor will check whether to scale the
CPU frequency up soon after coming out of idle.  When the CPU comes out of
idle, a timer is configured to fire within 1-2 ticks.  If the CPU is very
busy from exiting idle to when the timer fires then we assume the CPU is
underpowered and ramp to MAX speed.

If the CPU was not sufficiently busy to immediately ramp to MAX speed, then
the governor evaluates the CPU load since the last speed adjustment,
choosing the highest value between that longer-term load or the short-term
load since idle exit to determine the CPU speed to ramp to.

A realtime thread is used for scaling up, giving the remaining tasks the
CPU performance benefit, unlike existing governors which are more likely to
schedule rampup work to occur after your performance starved tasks have
completed.

The tuneables for this governor are:
/sys/devices/system/cpu/cpufreq/interactive/min_sample_time:
The minimum amount of time to spend at the current frequency before
ramping down. This is to ensure that the governor has seen enough
historic CPU load data to determine the appropriate workload.
Default is 80000 uS.
/sys/devices/system/cpu/cpufreq/interactive/go_maxspeed_load
The CPU load at which to ramp to max speed.  Default is 85.

Change-Id: Ib2b362607c62f7c56d35f44a9ef3280f98c17585
Signed-off-by: Mike Chan <mike@android.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Bug: 3152864

11 years agoARM: Call idle notifiers
Todd Poynor [Thu, 16 Jun 2011 00:44:50 +0000 (17:44 -0700)]
ARM: Call idle notifiers

Change-Id: Id833e61c13baa1783705ac9e9046d1f0cc90c95e
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agoMove x86_64 idle notifiers to generic
Todd Poynor [Thu, 16 Jun 2011 00:21:57 +0000 (17:21 -0700)]
Move x86_64 idle notifiers to generic

Move the x86_64 idle notifiers originally by Andi Kleen and Venkatesh
Pallipadi to generic.

Change-Id: Idf29cda15be151f494ff245933c12462643388d5
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
11 years agostaging: remove Greg's TODO, now obsolete.
Brian Swetland [Thu, 21 Oct 2010 21:19:31 +0000 (14:19 -0700)]
staging: remove Greg's TODO, now obsolete.

Signed-off-by: Brian Swetland <swetland@google.com>
11 years agoARM: Add generic fiq serial debugger
Iliyan Malchev [Sun, 6 Jun 2010 00:36:24 +0000 (17:36 -0700)]
ARM: Add generic fiq serial debugger

Change-Id: Ibb536c88f0dbaf4766d0599296907e35e42cbfd6
Signed-off-by: Iliyan Malchev <malchev@google.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agoARM: Add fiq_glue
Arve Hjønnevåg [Tue, 28 Sep 2010 00:50:00 +0000 (17:50 -0700)]
ARM: Add fiq_glue

Change-Id: I27d2554e07d9de204e0a06696d38db51608d9f6b
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoAllow CONFIG_STACKTRACE to be enabled by itself.
Arve Hjønnevåg [Thu, 3 Jun 2010 23:33:07 +0000 (16:33 -0700)]
Allow CONFIG_STACKTRACE to be enabled by itself.

This allows us to get a kernel stacktrace for a thread though /proc.
Also enable it by default.

Change-Id: If8c21cd02feaf9863f4841ace524fa30c7328d49
Signed-off-by: Arve Hjønnevåg <arve@android.com>
11 years agonet: Fix CONFIG_RPS option to be turned off
Dmitry Shmidt [Mon, 30 Aug 2010 17:29:37 +0000 (10:29 -0700)]
net: Fix CONFIG_RPS option to be turned off

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
11 years agonet: activity_stats: Add statistics for network transmission activity
Mike Chan [Fri, 28 May 2010 21:32:19 +0000 (14:32 -0700)]
net: activity_stats: Add statistics for network transmission activity

When enabled, tracks the frequency of network transmissions
(inbound and outbound) and buckets them accordingly.
Buckets are determined by time between network activity.

Each bucket represents the number of network transmisions that were
N sec or longer apart. Where N is defined as 1 << bucket index.

This network pattern tracking is particularly useful for wireless
networks (ie: 3G) where batching network activity closely together
is more power efficient than far apart.

New file: /proc/net/stat/activity

output:

Min Bucket(sec) Count
              1 7
              2 0
              4 1
              8 0
             16 0
             32 2
             64 1
            128 0

Change-Id: I4c4cd8627b872a55f326b1715c51bc3bdd6e8d92
Signed-off-by: Mike Chan <mike@android.com>
11 years agostaging: android: lowmemorykiller: Fix task_struct leak
San Mehat [Thu, 6 May 2010 22:40:07 +0000 (15:40 -0700)]
staging: android: lowmemorykiller: Fix task_struct leak

As it turns out, the CONFIG_PROFILING interfaces leak a
task struct if the notifier chain returns NOTIFY_OK.. doh.

This patch reworks lowmemkiller to use the new generic task
free notifier chain.

Signed-off-by: San Mehat <san@google.com>
11 years agosched: Add a generic notifier when a task struct is about to be freed
San Mehat [Thu, 6 May 2010 22:37:55 +0000 (15:37 -0700)]
sched: Add a generic notifier when a task struct is about to be freed

This patch adds a notifier which can be used by subsystems that may
be interested in when a task has completely died and is about to
have it's last resource freed.

  The Android lowmemory killer uses this to determine when a task
it has killed has finally given up its goods.

Signed-off-by: San Mehat <san@google.com>
11 years agowlan: Extract generic wlan platform data from tiwlan specific header
Dmitry Shmidt [Thu, 18 Mar 2010 23:04:18 +0000 (16:04 -0700)]
wlan: Extract generic wlan platform data from tiwlan specific header

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
11 years agoblock: genhd: Add disk/partition specific uevent callbacks for partition info
San Mehat [Sat, 10 Oct 2009 16:35:24 +0000 (09:35 -0700)]
block: genhd: Add disk/partition specific uevent callbacks for partition info

For disk devices, a new uevent parameter 'NPARTS' specifies the number
of partitions detected by the kernel. Partition devices get 'PARTN' which
specifies the partitions index in the table, and 'PARTNAME', which
specifies PARTNAME specifices the partition name of a partition device

Signed-off-by: Dima Zavin <dima@android.com>
11 years agoproc: smaps: Allow smaps access for CAP_SYS_RESOURCE
San Mehat [Wed, 16 Sep 2009 19:39:10 +0000 (12:39 -0700)]
proc: smaps: Allow smaps access for CAP_SYS_RESOURCE

Signed-off-by: San Mehat <san@google.com>
11 years agoBluetooth: Keep master role when SCO or eSCO is active
hyungseoung.yoo [Fri, 18 Nov 2011 04:57:01 +0000 (13:57 +0900)]
Bluetooth: Keep master role when SCO or eSCO is active

This improves compatbility with a lot of headset / chipset
combinations. Ideally this should not be needed.

Change-Id: I8b676701e12e416aa7d60801b9d353b15d102709
Signed-off-by: hyungseoung.yoo <hyungseoung.yoo@samsung.com>
Signed-off-by: Jaikumar Ganesh <jaikumarg@android.com>
11 years agoBluetooth: Allow SCO/eSCO packet type selection for outgoing SCO connections.
Nick Pelly [Thu, 11 Feb 2010 19:54:28 +0000 (11:54 -0800)]
Bluetooth: Allow SCO/eSCO packet type selection for outgoing SCO connections.

__u16 sco_pkt_type is introduced to struct sockaddr_sco. It allows bitwise
selection of SCO/eSCO packet types. Currently those bits are:

0x0001 HV1 may be used.
0x0002 HV2 may be used.
0x0004 HV3 may be used.
0x0008 EV3 may be used.
0x0010 EV4 may be used.
0x0020 EV5 may be used.
0x0040 2-EV3 may be used.
0x0080 3-EV3 may be used.
0x0100 2-EV5 may be used.
0x0200 3-EV5 may be used.

This is similar to the Packet Type parameter in the HCI Setup Synchronous
Connection Command, except that we are not reversing the logic on the EDR bits.
This makes the use of sco_pkt_tpye forward portable for the use case of
white-listing packet types, which we expect will be the primary use case.

If sco_pkt_type is zero, or userspace uses the old struct sockaddr_sco,
then the default behavior is to allow all packet types.

Packet type selection is just a request made to the Bluetooth chipset, and
it is up to the link manager on the chipset to negiotiate and decide on the
actual packet types used. Furthermore, when a SCO/eSCO connection is eventually
made there is no way for the host stack to determine which packet type was used
(however it is possible to get the link type of SCO or eSCO).

sco_pkt_type is ignored for incoming SCO connections. It is possible
to add this in the future as a parameter to the Accept Synchronous Connection
Command, however its a little trickier because the kernel does not
currently preserve sockaddr_sco data between userspace calls to accept().

The most common use for sco_pkt_type will be to white-list only SCO packets,
which can be done with the hci.h constant SCO_ESCO_MASK.

This patch is motivated by broken Bluetooth carkits such as the Motorolo
HF850 (it claims to support eSCO, but will actually reject eSCO connections
after 5 seconds) and the 2007/2008 Infiniti G35/37 (fails to route audio
if a 2-EV5 packet type is negiotiated). With this patch userspace can maintain
a list of compatible packet types to workaround remote devices such as these.

Based on a patch by Marcel Holtmann.

Rebased to 2.6.39.

Change-Id: Ide1c89574fa4f6f1b9218282e1af17051eb86315
Signed-off-by: Nick Pelly <npelly@google.com>
11 years agoBluetooth: Add ACL MTU, available buffers and total buffers to hci_conn_info.
Nick Pelly [Wed, 9 Dec 2009 08:15:41 +0000 (00:15 -0800)]
Bluetooth: Add ACL MTU, available buffers and total buffers to hci_conn_info.

This provides userspace debugging tools access to ACL flow control state.

Signed-off-by: Nick Pelly <npelly@google.com>
11 years agoBluetooth: Fallback to SCO on error code 0x10 (Connection Accept Timeout).
Nick Pelly [Tue, 22 Sep 2009 22:19:46 +0000 (15:19 -0700)]
Bluetooth: Fallback to SCO on error code 0x10 (Connection Accept Timeout).

This is to support the Motorola HF850 carkit which reports the error code 0x10
for an eSCO attempt, even though it advertises eSCO support. Here is the
hcidump:

2009-09-22 15:40:24.492391 < HCI Command: Setup Synchronous Connection
(0x01|0x0028) plen 17
    handle 1 voice setting 0x0060
2009-09-22 15:40:24.493002 > HCI Event: Command Status (0x0f) plen 4
    Setup Synchronous Connection (0x01|0x0028) status 0x00 ncmd 1
2009-09-22 15:40:30.594869 > HCI Event: Synchronous Connect Complete (0x2c)
plen 17
    status 0x10 handle 257 bdaddr 00:50:CD:20:C6:84 type eSCO
    Error: Connection Accept Timeout Exceeded

With this patch we will retry with a SCO connection, which succeeds.

Unfortunately the Moto HF850 also takes 5 seconds to return the error for the
eSCO attempt, so it will still take 5 seconds to fallback to SCO with this
patch.

Signed-off-by: Nick Pelly <npelly@google.com>
11 years agoBluetooth: Increase timeout for legacy pairing from 10 seconds to 40 seconds.
Nick Pelly [Sat, 19 Sep 2009 01:29:23 +0000 (18:29 -0700)]
Bluetooth: Increase timeout for legacy pairing from 10 seconds to 40 seconds.

Legacy pairing is a bit of a problem because on the incoming end it is
impossible to know pairing has begun:

2009-09-18 18:29:24.115692 > HCI Event: Connect Request (0x04) plen 10
    bdaddr 00:23:D4:04:51:7A class 0x58020c type ACL
2009-09-18 18:29:24.115966 < HCI Command: Accept Connection Request (0x01|0x0009) plen 7
    bdaddr 00:23:D4:04:51:7A role 0x00
    Role: Master
2009-09-18 18:29:24.117065 > HCI Event: Command Status (0x0f) plen 4
    Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
2009-09-18 18:29:24.282928 > HCI Event: Role Change (0x12) plen 8
    status 0x00 bdaddr 00:23:D4:04:51:7A role 0x00
    Role: Master
2009-09-18 18:29:24.291534 > HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 1 bdaddr 00:23:D4:04:51:7A type ACL encrypt 0x00
2009-09-18 18:29:24.291839 < HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 1
2009-09-18 18:29:24.292144 > HCI Event: Page Scan Repetition Mode Change (0x20) plen 7
    bdaddr 00:23:D4:04:51:7A mode 1
2009-09-18 18:29:24.293823 > HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
2009-09-18 18:29:24.303588 > HCI Event: Max Slots Change (0x1b) plen 3
    handle 1 slots 5
2009-09-18 18:29:24.309448 > HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 1
    Features: 0xff 0xff 0x2d 0xfe 0x9b 0xff 0x79 0x83
2009-09-18 18:29:24.345916 < HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr 00:23:D4:04:51:7A mode 2 clkoffset 0x0000
2009-09-18 18:29:24.346923 > HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
2009-09-18 18:29:24.375793 > HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr 00:23:D4:04:51:7A name 'test'
2009-09-18 18:29:34.332190 < HCI Command: Disconnect (0x01|0x0006) plen 3
    handle 1 reason 0x13

There are some mainline patches such as "Add different pairing timeout for
Legacy Pairing" but they do not address the HCI sequence above.

I think the real solution is to avoid using CreateBond(), and instead make
the profile connection immediately. This way both sides will use a longer
timeout because there is a higher level connection in progress, and we will
not end up with the useless HCI sequence above.

Signed-off-by: Nick Pelly <npelly@google.com>
11 years agoBluetooth: Do not attempt to send dlci disconnect when in BT_CONFIG.
Nick Pelly [Thu, 9 Jul 2009 19:23:44 +0000 (12:23 -0700)]
Bluetooth: Do not attempt to send dlci disconnect when in BT_CONFIG.

This fixes a bug where shutdown() and close() on a rfcomm socket during ACL
connection would not cause HCI Create Connection Cancel.

Signed-off-by: Nick Pelly <npelly@google.com>
11 years agoserial_core: Add wake_peer uart operation
San Mehat [Thu, 30 Jul 2009 03:21:28 +0000 (20:21 -0700)]
serial_core: Add wake_peer uart operation

Add wake_peer which is called before starting UART TX. The idea here
is to provide a mechanism where we can wakeup our peer before sending
data.

Change-Id: I42e0779b635f64ca99184b45d5b028de80197491
Signed-off-by: San Mehat <san@google.com>
11 years agorfkill: Introduce CONFIG_RFKILL_PM and use instead of CONFIG_PM to power down
Nick Pelly [Fri, 5 Dec 2008 01:37:05 +0000 (17:37 -0800)]
rfkill: Introduce CONFIG_RFKILL_PM and use instead of CONFIG_PM to power down

Some platforms do not want to power down rfkill devices on suspend.

Change-Id: I62a11630521c636d54a4a02ab9037a43435925f5
Signed-off-by: Nick Pelly <npelly@google.com>
11 years agonet: Replace AID_NET_RAW checks with capable(CAP_NET_RAW).
Chia-chi Yeh [Tue, 30 Jun 2009 03:23:04 +0000 (11:23 +0800)]
net: Replace AID_NET_RAW checks with capable(CAP_NET_RAW).

Signed-off-by: Chia-chi Yeh <chiachi@android.com>
11 years agosecurity: Add AID_NET_RAW and AID_NET_ADMIN capability check in cap_capable().
Chia-chi Yeh [Thu, 18 Jun 2009 23:15:05 +0000 (07:15 +0800)]
security: Add AID_NET_RAW and AID_NET_ADMIN capability check in cap_capable().

Signed-off-by: Chia-chi Yeh <chiachi@android.com>
11 years agonet: PPPoPNS and PPPoLAC fixes.
Chia-chi Yeh [Fri, 12 Jun 2009 18:29:04 +0000 (02:29 +0800)]
net: PPPoPNS and PPPoLAC fixes.

net: Fix a bitmask in PPPoPNS and rename constants in PPPoPNS and PPPoLAC.

Signed-off-by: Chia-chi Yeh <chiachi@android.com>
net: Fix a potential deadlock while releasing PPPoLAC/PPPoPNS socket.

PPP driver guarantees that no thread will be executing start_xmit() after
returning from ppp_unregister_channel(). To achieve this, a spinlock (downl)
is used. In pppolac_release(), ppp_unregister_channel() is called after sk_udp
is locked. At the same time, another thread might be running in pppolac_xmit()
with downl. Thus a deadlock will occur if the thread tries to lock sk_udp.
The same situation might happen on sk_raw in pppopns_release().

Signed-off-by: Chia-chi Yeh <chiachi@android.com>
net: Force PPPoLAC and PPPoPNS to bind an interface before creating PPP channel.

It is common to manipulate the routing table after configuring PPP device.
Since both PPPoLAC and PPPoPNS run over IP, care must be taken to make sure
that there is no loop in the routing table.
Although this can be done by adding a host route, it might still cause
problems when the interface is down for some reason.

To solve this, this patch forces both drivers to bind an interface before
creating PPP channel, so the system will not re-route the tunneling sockets
to another interface when the original one is down. Another benefit is that
now the host route is no longer required, so there is no need to remove it
when PPP channel is closed.

Signed-off-by: Chia-chi Yeh <chiachi@android.com>
net: Avoid sleep-inside-spinlock in PPPoLAC and PPPoPNS.

Since recv() and xmit() are called with a spinlock held, routines which might
sleep cannot be used. This issue is solved by following changes:

Incoming packets are now processed in backlog handler, recv_core(), instead of
recv(). Since backlog handler is always executed with socket spinlock held, the
requirement of ppp_input() is still satisfied.

Outgoing packets are now processed in workqueue handler, xmit_core(), instead of
xmit(). Note that kernel_sendmsg() is no longer used to prevent touching dead
sockets.

In release(), lock_sock() and pppox_unbind_sock() ensure that no thread is in
recv_core() or xmit(). Then socket handlers are restored before release_sock(),
so no packets will leak in backlog queue.

Signed-off-by: Chia-chi Yeh <chiachi@android.com>
net: Fix msg_iovlen in PPPoLAC and PPPoPNS.

Although any positive value should work (which is always true in both drivers),
the correct value should be 1.

Signed-off-by: Chia-chi Yeh <chiachi@android.com>
11 years agonet: add PPP on PPTP Network Server (PPPoPNS) driver.
Chia-chi Yeh [Thu, 11 Jun 2009 17:09:30 +0000 (01:09 +0800)]
net: add PPP on PPTP Network Server (PPPoPNS) driver.

Signed-off-by: Chia-chi Yeh <chiachi@android.com>
ppopns: dont include px_proto define in if_pppopns.h

Change-Id: I27e687667db5b45182562f4a517a2e6cec6b1350
Signed-off-by: Dima Zavin <dima@android.com>
11 years agonet: add PPP on L2TP Access Concentrator (PPPoLAC) driver.
Chia-chi Yeh [Thu, 7 May 2009 20:02:40 +0000 (04:02 +0800)]
net: add PPP on L2TP Access Concentrator (PPPoLAC) driver.

Change-Id: I3ae3ee7520951ae24269db0ef2898c6455cf6bcc
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
ppolac: dont include px_proto define in if_pppolac.h

Change-Id: I55bc9cf91ea0e9e8f7bf5d6e241d188e1269343a
Signed-off-by: Dima Zavin <dima@android.com>
11 years agofs: block_dump: Don't display inode changes if block_dump < 2
San Mehat [Sun, 22 Mar 2009 01:48:54 +0000 (18:48 -0700)]
fs: block_dump: Don't display inode changes if block_dump < 2

Signed-off-by: San Mehat <san@android.com>
11 years agotiwlan: Add abstract wifi control functions support
Dmitry Shmidt [Thu, 18 Dec 2008 17:55:20 +0000 (09:55 -0800)]
tiwlan: Add abstract wifi control functions support

11 years agommc: block: Improve logging of handling emmc timeouts
Ken Sumrall [Wed, 26 Oct 2011 01:16:58 +0000 (18:16 -0700)]
mmc: block: Improve logging of handling emmc timeouts

Add some logging to make it clear just how the emmc timeout
was handled.

Change-Id: Id33fd28d8b9778dc4e85db829e2637a328eddab4
Signed-off-by: Ken Sumrall <ksumrall@android.com>
11 years agommc: core: host: only use wakelock for detect work
Colin Cross [Thu, 8 Sep 2011 00:28:58 +0000 (17:28 -0700)]
mmc: core: host: only use wakelock for detect work

There is no need to take a wakelock for delayed lazy disable
work, it will be cancelled in the suspend handler and force
disabled.  Only take the wakelock when the detect work is
queued, and make sure to drop the wakelock if the work is
cancelled.

Change-Id: I1e507a5f98848954ea21d45e23b6192c3132a349
Signed-off-by: Colin Cross <ccross@android.com>
11 years agoARM: Add 'card_present' state to mmc_platfrom_data
Dmitry Shmidt [Tue, 3 May 2011 18:05:04 +0000 (11:05 -0700)]
ARM: Add 'card_present' state to mmc_platfrom_data

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>