Commit Graph

257800 Commits

Author SHA1 Message Date
Mike Lockwood
54c7c33ce2 USB: gadget: f_audio_source: Fix use after free in audio_unbind
When USB was disconnected, we were freeing our audio_dev struct in audio_unbind
before the audio system had cleaned up, resulting in a hang in audio_pcm_close.
We now statically allocate the audio_dev struct to avoid this problem.

Change-Id: I58ad21eaa20dcf4aa74ee614ef3b6ed2c91d52a1
Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-08-16 12:52:33 -07:00
Vinicius Costa Gomes
d4bad8b2ea HID: uhid: Fix sending events with invalid data
This was detected because events with invalid types were arriving
to userspace.

The code before this patch would only work for the first event in the
queue (when uhid->tail is 0).

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Reviewed-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:30 -07:00
Jiri Kosina
db5889812a HID: uhid: silence gcc warning
gcc is giving me:

drivers/hid/uhid.c: In function ‘uhid_hid_get_raw’:
drivers/hid/uhid.c:157: warning: ‘len’ may be used uninitialized in this function

which is clearly bogus, as

- when used as memcpy() argument, it's initialized properly
- the code is structured in a way that either 'ret' or 'len'
  is always initialized, so the return statement always has
  an initialized value.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:30 -07:00
David Herrmann
d33f92d28b MAINTAINERS: add UHID entry
Add an UHID entry to the MAINTAINERS file.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:30 -07:00
David Herrmann
9634f8109f HID: uhid: add example program
This adds an example user-space program that emulates a 3 button mouse
with wheel. It detects keyboard presses and moves the mouse accordingly.

It register a fake HID device to feed the raw HID reports into the kernel.
In this example, you could use uinput to get the same result, but this
shows how to get the same behavior with uhid so you don't need HID parsers
in user-space.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:29 -07:00
David Herrmann
bd76675614 HID: uhid: add documentation
This describes the protocol used by uhid for user-space applications. It
describes the details like non-blocking I/O and readv/writev for multiple
events per syscall.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:29 -07:00
David Herrmann
c12e46fb71 HID: uhid: implement feature requests
HID standard allows sending a feature request to the device which is
answered by an HID report. uhid implements this by sending a UHID_FEATURE
event to user-space which then must answer with UHID_FEATURE_ANSWER. If it
doesn't do this in a timely manner, the request is discarded silently.

We serialize the feature requests, that is, there is always only a single
active feature-request sent to user-space, other requests have to wait.
HIDP and USB-HID do it the same way.

Because we discard feature-requests silently, we must make sure to match
a response to the corresponding request. We use sequence-IDs for this so
user-space must copy the ID from the request into the answer.
Feature-answers are ignored if they do not contain the same ID as the
currently pending feature request.

Internally, we must make sure that feature-requests are synchronized with
UHID_DESTROY and close() events. We must not dead-lock when closing the
HID device, either, so we have to use separate locks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:29 -07:00
David Herrmann
715ee7c3e5 HID: uhid: forward raw output reports to user-space
Some drivers that use non-standard HID features require raw output reports
sent to the device. We now forward these requests directly to user-space
so the transport-level driver can correctly send it to the device or
handle it correspondingly.

There is no way to signal back whether the transmission was successful,
moreover, there might be lots of messages coming out from the driver
flushing the output-queue. However, there is currently no driver that
causes this so we are safe. If some drivers need to transmit lots of data
this way, we need a method to synchronize this and can implement another
UHID_OUTPUT_SYNC event.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:29 -07:00
David Herrmann
bd46634b0b HID: uhid: forward output request to user-space
If the hid-driver wants to send standardized data to the device it uses a
linux input_event. We forward this to the user-space transport-level
driver so they can perform the requested action on the device.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:29 -07:00
David Herrmann
e458139e9e HID: uhid: forward open/close events to user-space
HID core notifies us with *_open/*_close callbacks when there is an actual
user of our device. We forward these to user-space so they can react on
this. This allows user-space to skip I/O unless they receive an OPEN
event. When they receive a CLOSE event they can stop I/O again to save
energy.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:28 -07:00
David Herrmann
245fd8c6b7 HID: uhid: add UHID_START and UHID_STOP events
We send UHID_START and UHID_STOP events to user-space when the HID core
starts/stops the device. This notifies user-space about driver readiness
and data-I/O can start now.

This directly forwards the callbacks from hid-core to user-space.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:28 -07:00
David Herrmann
66454600e6 HID: uhid: forward hid report-descriptor to hid core
When the uhid_hid_parse callback is called we simply forward it to
hid_parse_report() with the data that we got in the UHID_CREATE event.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:28 -07:00
David Herrmann
e0ad83067d HID: uhid: allow feeding input data into uhid devices
This adds a new event type UHID_INPUT which allows user-space to feed raw
HID reports into the HID subsystem. We copy the data into kernel memory
and directly feed it into the HID core.

There is no error handling of the events couldn't be parsed so user-space
should consider all events successfull unless read() returns an error.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:28 -07:00
David Herrmann
6b1a4c7c9a HID: uhid: add UHID_CREATE and UHID_DESTROY events
UHID_CREATE and UHID_DESTROY are used to create and destroy a device on an
open uhid char-device. Internally, we allocate and register an HID device
with the HID core and immediately start the device. From now on events may
be received or sent to the device.

The UHID_CREATE event has a payload similar to the data used by
Bluetooth-HIDP when creating a new connection.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:28 -07:00
David Herrmann
d3444a842a HID: uhid: implement write() on uhid devices
Similar to read() you can only write() a single event with one call to an
uhid device. To write multiple events use writev() which is supported by
uhid.

We currently always return -EOPNOTSUPP but other events will be added in
later patches.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:28 -07:00
David Herrmann
b8dd3d95ca HID: uhid: implement read() on uhid devices
User-space can use read() to get a single event from uhid devices. read()
does never return multiple events. This allows us to extend the event
structure and still keep backwards compatibility.

If user-space wants to get multiple events in one syscall, they should use
the readv()/writev() syscalls which are supported by uhid.

This introduces a new lock which helps us synchronizing simultaneous reads
from user-space. We also correctly return -EINVAL/-EFAULT only on errors
and retry the read() when some other thread captured the event faster than
we did.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:27 -07:00
David Herrmann
191b03260f HID: uhid: allow poll()'ing on uhid devices
As long as the internal buffer is not empty, we return POLLIN to
user-space.

uhid->head and uhid->tail are no atomics so the comparison may return
inexact results. However, this doesn't matter here as user-space would
need to poll() in two threads simultaneously to trigger this. And in this
case it doesn't matter if a cached result is returned or the exact new
result as user-space does not know which thread returns first from poll()
and the following read(). So it is safe to compare the values without
locking.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:27 -07:00
David Herrmann
ef5006bca1 HID: uhid: add internal message buffer
When receiving messages from the HID subsystem, we need to process them
and store them in an internal buffer so user-space can read() on the char
device to retrieve the messages.

This adds a static buffer for 32 messages to each uhid device. Each
message is dynamically allocated so the uhid_device structure does not get
too big.

uhid_queue() adds a message to the buffer. If the buffer is full, the
message is discarded. uhid_queue_event() is an helper for messages without
payload.

This also adds a public header: uhid.h. It contains the declarations for
the user-space API. It is built around "struct uhid_event" which contains
a type field which specifies the event type and each event can then add a
variable-length payload. For now, there is only a dummy event but later
patches will add new event types and payloads.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:27 -07:00
David Herrmann
4409981837 HID: uhid: introduce user-space I/O driver support for HID
This adds a dummy driver that will support user-space I/O drivers for the
HID subsystem. This allows to write transport-level drivers like USB-HID
and Bluetooth-HID in user-space.

Low-Energy Bluetooth needs this to feed HID data that is parsed in
user-space back into the kernel.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-16 12:44:27 -07:00
Dmitry Shmidt
efadaa2555 mmc: Make sure host is disabled on suspend
Change-Id: Ie0bf2004e173cef8dad66722a152658d7727ab65
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-08-16 11:27:59 -07:00
Dmitry Shmidt
11c327f598 net: wireless: bcm4329: Remove obsolete files
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-08-13 14:03:29 -07:00
Ashish Sharma
9a6bc3422c netfilter: xt_IDLETIMER: Rename INTERFACE to LABEL in netlink notification.
Signed-off-by: Ashish Sharma <ashishsharma@google.com>
2012-08-13 12:58:31 -07:00
Dmitry Shmidt
e15cb9927c net: wireless: bcmdhd: Use correct time from boot for TSF
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-08-13 12:45:38 -07:00
Bernhard Walle
a1bc297a90 scripts/Kbuild.include: Fix portability problem of "echo -e"
"echo -e" is a GNU extension. When cross-compiling the kernel on a
BSD-like operating system (Mac OS X in my case), this doesn't work.

One could install a GNU version of echo, put that in the $PATH before
the system echo and use "/usr/bin/env echo", but the solution with
printf is simpler.

Since it is no disadvantage on Linux, I hope that gets accepted even if
cross-compiling the Linux kernel on another Unix operating system is
quite a rare use case.

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
Andreas Bießmann <andreas@biessmann.de>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-08-08 13:49:31 -07:00
Mike Lockwood
2fa1f1c9b5 USB: gadget: f_audio_source: Fix error handling and increase packet size
Fixes watchdog reset on USB disconnect
Larger packet size fixes performance in fullspeed mode

Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-08-02 15:23:27 -07:00
Dmitry Shmidt
e4639327fc net: wireless: bcmdhd: Fill station_info packet fields
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-07-27 10:04:44 -07:00
Dmitry Shmidt
62618c1b04 net: wireless: bcmdhd: Prevent HT Avail request failure to flood the log
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-07-18 11:19:40 -07:00
Dmitry Shmidt
3421d0b815 net: wireless: bcmdhd: Use proper jiffie-related functions
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>

Conflicts:

	drivers/net/wireless/bcmdhd/wl_cfg80211.c
	drivers/net/wireless/bcmdhd/wl_iw.c
2012-07-17 12:53:28 -07:00
Dmitry Shmidt
c491722e0e net: wireless: bcmdhd: Adjust driver/fw/chip info format
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-07-17 12:53:04 -07:00
German Monroy
b595a66a0b x86: Call idle notifiers
BZ: 35303

Google patched the idle loop for x86-64 (commit 1fd57f722c) and for ARM
(commit 41fa406c26), but they forgot x86-32.

This is preventing their interactive governor from upshifting CPU
frequencies in intel's SOC platforms (e.g. Medfield, etc.).

Fixing that.

NOTE: The notifier calls are not located in the same exact place in the
idle loop for x86-64 and ARM.  The notifier is called inside the
`while(!need_resched)' loop in x86-64 and outside of it in ARM.  Since
Google has likely tuned this governor for ARM, leaving it as in ARM.

Change-Id: Ibefd0c8f08e4b4c24c4a5c32dcdc574f9090b2b9
Signed-off-by: German Monroy <german.monroy@intel.com>
2012-07-16 13:40:02 -07:00
Dmitry Shmidt
66943ea352 net: wireless: bcmdhd: Add info_string param with driver/fw/chip info
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-07-12 17:25:05 -07:00
Dmitry Shmidt
f4702ad7ca net: wireless: bcmdhd: Remove country update from wl_update_wiphybands
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-07-12 10:45:50 -07:00
Neeraj Kumar Garg
a5c77fe0e6 net: wireless: bcmdhd: Fix P2P GO hang issue
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-07-12 10:45:50 -07:00
Dmitry Shmidt
df06df7bfc net: wireless: bcmdhd: Update wiphy bands on band change
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-07-12 10:45:49 -07:00
Andrey Vagin
230efa6869 net: wireless: bcmdhd: Init locks in dhd_attach() at the beginning
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-07-12 10:45:49 -07:00
Andrey Vagin
f70624b6e5 net: wireless: bcm4329: Init locks in dhd_attach() at the beginning
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-07-12 10:45:49 -07:00
Dmitry Shmidt
fa98f042f1 net: wireless: bcmdhd: Add mutex to wl_update_wiphybands()
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-07-12 10:45:49 -07:00
Dmitry Shmidt
22baf5de10 net: wireless: bcmdhd: Skip country setting if unnecessary
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-07-12 10:45:48 -07:00
Dmitry Shmidt
68983530ea net: wireless: bcmdhd: Return wl_construct_reginfo() call
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-07-12 10:45:48 -07:00
Dmitry Shmidt
d7ade6c71e net: wireless: bcmdhd: Add wiphyband update for country change
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-07-12 10:45:48 -07:00
Dmitry Shmidt
38fac5b1e2 net: wireless: bcmdhd: Skip inaccurate wl_construct_reginfo() call
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-06-28 10:42:19 -07:00
Dmitry Shmidt
562490d247 net: wireless: bcmdhd: Ignore error if "chanspecs" command is not supported
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-06-20 10:26:09 -07:00
Dmitry Shmidt
1ed2a48549 net: wireless: bcmdhd: Reduce priority for dhd_dpc and watchdog
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-06-19 10:38:24 -07:00
Dmitry Shmidt
2749b2ea4f net: wireless: bcmdhd: Reload FW in case of constant scan failure
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-06-19 10:38:10 -07:00
Dmitry Shmidt
cb786ee756 net: wireless: bcmdhd: Combined P2P fixes
- Fix p2p scan
- Fix p2p processing for channels 12 and 13
- Fix service discovery

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-06-13 11:29:39 -07:00
Theodore Ts'o
9d8a0e5b42 ext4: add missing save_error_info() to ext4_error()
The ext4_error() function is missing a call to save_error_info().
Since this is the function which marks the file system as containing
an error, this oversight (which was introduced in 2.6.36) is quite
significant, and should be backported to older stable kernels with
high urgency.

Change-Id: Ia1eb8d91f37ceb67faf3b79d6bc79b899f1d6bfc
Reported-by: Ken Sumrall <ksumrall@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: ksumrall@google.com
Cc: stable@kernel.org
Signed-off-by: Ken Sumrall <ksumrall@android.com>
2012-06-08 11:57:30 -07:00
Dmitry Shmidt
bc6f92e9cc net: wireless: bcmdhd: Update to version 5.90.195.75
- Fix false PCB-OVERLAP issue
- Fix simultanious connect request on two P2P devices

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-05-31 14:22:22 -07:00
Leslie Yu
3f427b101c net: wireless: bcmdhd: Fix P2P driver crash for MFG firmware
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-05-30 13:01:01 -07:00
Dmitry Shmidt
794eb6216d net: wireless: bcmdhd: Make responce waiting uninterruptible
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2012-05-30 13:00:45 -07:00
Mike Lockwood
0daae7684b USB: gadget: f_audio_source: Adjust packet timing to reduce glitches
Increase max packet size and clean up timing logic so we can better
recover from not getting an interrupt in time for a SOF.

Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-05-29 16:38:46 -07:00