• Home
  • History
  • Annotate
  • only in /drivers/usb/gadget/function/
History log of /drivers/usb/gadget/function/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
19088ddf7fd9f51395f6a25536e76847d767cd01 03-Sep-2015 Badhri Jagan Sridharan <Badhri@google.com> ANDROID: usb: gadget: create F_midi device

Android frameworks relies on the alsa
config reported by the f_midi device.

Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
Change-Id: I0695e00b166fd953f50acea93802245b0d5a5240
_midi.c
0d87d144f44b6ed2d8e4189489e19f18d9a7c49e 13-Jul-2015 Robert Baldyga <r.baldyga@samsung.com> usb: gadget: midi: avoid redundant f_midi_set_alt() call

Function midi registers two interfaces with single set_alt() function
which means that f_midi_set_alt() is called twice when configuration
is set. That means that endpoint initialization and ep request allocation
is done two times. To avoid this problem we do such things only once,
for interface number 1 (MIDI Streaming interface).

BACKPORT FROM MAINLINE KERNEL

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: I55c015c6a11180a40534671fbf505342a0032ef2
_midi.c
f803e26b70f4539040503994a160e44238ec229f 03-Jul-2015 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_midi: fix error recovery path

In case kstrdup() fails the resources to release are
midi->in_port[] and midi. No cards have been registered,
so no need to unregister any.

BACKPORT FROM MAINLINE KERNEL

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: Idf14ca5aded888fe7c56d8b06763b009800827f5
_midi.c
61ef7b1f6326cffc724cd59934fc16be2bce7e68 14-May-2015 Pawel Szewczyk <p.szewczyk@samsung.com> usb: gadget: f_midi: fix segfault when reading empty id

When midi function is created, 'id' attribute is initialized with
SNDRV_DEFAULT_STR1, which is NULL pointer. Trying to read this attribute
before filling it ends up with segmentation fault.

This commit fix this issue by preventing null pointer dereference. Now
f_midi_opts_id_show() returns empty string when id is a null pointer.

Reproduction path:

$ mkdir functions/midi.0
$ cat functions/midi.0/id

[ 53.130132] Unable to handle kernel NULL pointer dereference at
virtual address 00000000
[ 53.132630] pgd = ec6cc000
[ 53.135308] [00000000] *pgd=6b759831, *pte=00000000, *ppte=00000000
[ 53.141530] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
[ 53.146904] Modules linked in: usb_f_midi snd_rawmidi libcomposite
[ 53.153071] CPU: 1 PID: 2936 Comm: cat Not tainted
3.19.0-00041-gcf4b216 #7
[ 53.160010] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[ 53.166088] task: ee234c80 ti: ec764000 task.ti: ec764000
[ 53.171482] PC is at strlcpy+0x8/0x60
[ 53.175128] LR is at f_midi_opts_id_show+0x28/0x3c [usb_f_midi]
[ 53.181019] pc : [<c0222a9c>] lr : [<bf01bed0>] psr: 60000053
[ 53.181019] sp : ec765ef8 ip : 00000141 fp : 00000000
[ 53.192474] r10: 00019000 r9 : ed7546c0 r8 : 00010000
[ 53.197682] r7 : ec765f80 r6 : eb46a000 r5 : eb46a000 r4 :
ed754734
[ 53.204192] r3 : ee234c80 r2 : 00001000 r1 : 00000000 r0 :
eb46a000
[ 53.210704] Flags: nZCv IRQs on FIQs off Mode SVC_32 ISA ARM
Segment user
[ 53.217907] Control: 10c5387d Table: 6c6cc04a DAC: 00000015
[ 53.223636] Process cat (pid: 2936, stack limit = 0xec764238)
[ 53.229364] Stack: (0xec765ef8 to 0xec766000)
[ 53.233706] 5ee0:
ed754734 ed7546c0
[ 53.241866] 5f00: eb46a000 bf01bed0 eb753b80 bf01cc44 eb753b98
bf01b0a4 bf01b08c c0125dd0
[ 53.250025] 5f20: 00002f19 00000000 ec432e00 bf01cce8 c0530c00
00019000 00010000 ec765f80
[ 53.258184] 5f40: 00010000 ec764000 00019000 c00cc4ac ec432e00
c00cc55c 00000017 000081a4
[ 53.266343] 5f60: 00000001 00000000 00000000 ec432e00 ec432e00
00010000 00019000 c00cc620
[ 53.274502] 5f80: 00000000 00000000 00000000 00010000 ffff1000
00019000 00000003 c000e9a8
[ 53.282662] 5fa0: 00000000 c000e7e0 00010000 ffff1000 00000003
00019000 00010000 00019000
[ 53.290821] 5fc0: 00010000 ffff1000 00019000 00000003 7fffe000
00000001 00000000 00000000
[ 53.298980] 5fe0: 00000000 be8c68d4 0000b995 b6f0e3e6 40000070
00000003 00000000 00000000
[ 53.307157] [<c0222a9c>] (strlcpy) from [<bf01bed0>]
(f_midi_opts_id_show+0x28/0x3c [usb_f_midi])
[ 53.316006] [<bf01bed0>] (f_midi_opts_id_show [usb_f_midi]) from
[<bf01b0a4>] (f_midi_opts_attr_show+0x18/0x24 )
[ 53.327209] [<bf01b0a4>] (f_midi_opts_attr_show [usb_f_midi]) from
[<c0125dd0>] (configfs_read_file+0x9c/0xec)
[ 53.337180] [<c0125dd0>] (configfs_read_file) from [<c00cc4ac>]
(__vfs_read+0x18/0x4c)
[ 53.345073] [<c00cc4ac>] (__vfs_read) from [<c00cc55c>]
(vfs_read+0x7c/0x100)
[ 53.352190] [<c00cc55c>] (vfs_read) from [<c00cc620>]
(SyS_read+0x40/0x8c)
[ 53.359056] [<c00cc620>] (SyS_read) from [<c000e7e0>]
(ret_fast_syscall+0x0/0x34)
[ 53.366513] Code: ebffe3d3 e8bd8008 e92d4070 e1a05000 (e5d14000)
[ 53.372641] ---[ end trace e4f53a4e233d98d0 ]---

BACKPORT FROM MAINLINE KERNEL

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: I7cb7fef0d8d8336d7801a99941824be2bf04f256
_midi.c
745024148169d8d128c185c1d2b2bfab4e307777 07-Dec-2014 Julia Lawall <Julia.Lawall@lip6.fr> usb: gadget: fix misspelling of current function in string

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance,
as proposed by Rasmus Villemoes.

BACKPORT FROM MAINLINE KERNEL

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: I971885f53489cd1fbcf539630e2b8136511ce54d
_hid.c
_midi.c
d01107520eb572cdbfbe71baf641b4a43a5a1a36 12-Nov-2014 Fengguang Wu <fengguang.wu@intel.com> usb: gadget: midi: f_midi_alloc() can be static

drivers/usb/gadget/function/f_midi.c:1072:21: sparse: symbol 'f_midi_alloc' was not declared. Should it be static?
drivers/usb/gadget/legacy/gmidi.c:118:30: sparse: symbol 'fi_midi' was not declared. Should it be static?
drivers/usb/gadget/legacy/gmidi.c:119:21: sparse: symbol 'f_midi' was not declared. Should it be static?

BACKPORT FROM MAINLINE KERNEL

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: I7794cd62da8deb408848e86163747d5ce655f33b
_midi.c
d03e8022781abd0f6097ba2ed132760f6969d0c9 16-Oct-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_midi: add configfs support

Make the midi function available for gadgets composed with configfs.

BACKPORT FROM MAINLINE KERNEL

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: I544e0e270de8cd0e55bf51aae7fa33d7d32a9ad8
_midi.c
_midi.h
506c9295204d6a581c181fbaafc191586f5750ed 16-Oct-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_midi: use usb_gstrings_attach

In order to add configfs support the usb_gstrings_attach must be used.

BACKPORT FROM MAINLINE KERNEL

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: I65b34edbfa8882e8d7e82d0732fa323a2426bf3e
_midi.c
a0d67b7bed9c08ebffc596847b9ee53fd7fbba61 16-Oct-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_midi: remove compatibility layer

There are no old f_midi interface users left, so remove it.

BACKPORT FROM MAINLINE KERNEL

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: I8d4450aa3b630aadf61fc63e6ed7ca105df6a0e6
_midi.c
8a7a4c03503cc181355ad473acf895136faa251b 16-Oct-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_midi: convert to new function interface with backward compatibility

Converting midi to the new function interface requires converting
the USB midi's function code and its users.

This patch converts the f_midi.c to the new function interface.
The file can now be compiled into a separate usb_f_midi.ko module.

The old function interface is provided by means of a preprocessor
conditional directives. After all users are converted, the old interface
can be removed.

BACKPORT FROM MAINLINE KERNEL

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: I249b56af9549d8a5288bab99ad657ce15cc57e22
akefile
_midi.c
_midi.h
519fc4b38fe73b73e878d95be89e49e8e5e0f2ff 16-Oct-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_midi: check kstrdup() return value

kstrdup() might fail, so check its return value and react appropriately.

BACKPORT FROM MAINLINE KERNEL

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: Ife54cb138b51fd84ac2b62aa340747789894a320
_midi.c
4158b96a16aaa6da4c6b588fa267027bbc04ae2c 16-Oct-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_midi: enable use of the index parameter

The soundcard index to use for the ALSA device creation is passed as a
parameter to f_midi_bind_config(), but is assigned to midi->index only
after the call to f_midi_register_card(midi). So no matter what is passed
to f_midi_bind_config(), the actual index for snd_card_new() is always 0.
This probably works ok if at the moment of f_midi's bind there are no
other snd_cards, but if there are, it is not possible to bind f_midi.

This patch moves the assignment to a place before the call to
f_midi_register_card(midi).

BACKPORT FROM MAINLINE KERNEL

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: Ia2a2c95b165dd3575b03b0928ff2322349b73e24
_midi.c
c44a699d96df2e13467fc081bff88b97dcc5afb2 31-Jul-2015 Amit Pundir <amit.pundir@linaro.org> usb: gadget: fix NULL ptr derefer while symlinking PTP func

Fix NULL pointer dereference while trying to link PTP
function to a gadget configuration without creating
MTP function.

PTP piggyback on MTP function so make sure we have
MTP function created beforehand. Otherwise we run
into following kernel panic:
-----------------------
[ 70.329957] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 70.330738] pgd = dd8ec000
[ 70.330916] [00000000] *pgd=00000000
[ 70.331663] Internal error: Oops: 805 [#1] SMP THUMB2
[ 70.332155] CPU: 0 PID: 2067 Comm: ln Not tainted 3.18.0-00587-gdfa582e #1
[ 70.332511] task: dd9c92c0 ti: dd822000 task.ti: dd822000
[ 70.333094] PC is at function_alloc_mtp_ptp+0xe/0x68
[ 70.333311] LR is at usb_get_function+0x11/0x1c
[ 70.333489] pc : [<c034ec12>] lr : [<c033cce9>] psr: 60070033
<..snip..>
[ 70.384111] 3fc0: bec14ae4 00000004 bec14c0a 00000053 00000004 b6f0422d 00000000 bec14adc
[ 70.384369] 3fe0: bec14af8 bec14a98 b6f071f3 b6e8977c 20070010 bec14c0d 00000000 00000000
[ 70.384832] [<c034ec12>] (function_alloc_mtp_ptp) from [<c033cce9>] (usb_get_function+0x11/0x1c)
[ 70.385146] [<c033cce9>] (usb_get_function) from [<c033da9b>] (config_usb_cfg_link+0x87/0xa8)
[ 70.385421] [<c033da9b>] (config_usb_cfg_link) from [<c011f417>] (configfs_symlink+0xb7/0x1c8)
[ 70.385696] [<c011f417>] (configfs_symlink) from [<c00dcd8d>] (vfs_symlink+0x85/0xc0)
[ 70.386010] [<c00dcd8d>] (vfs_symlink) from [<c00dce0b>] (SyS_symlinkat+0x43/0x70)
[ 70.386261] [<c00dce0b>] (SyS_symlinkat) from [<c000ce41>] (ret_fast_syscall+0x1/0x5c)
[ 70.386610] Code: eb04 4a0f 6e03 480f (e883) 0005
[ 70.387346] ---[ end trace 8dba7c552e02f8fa ]---
[ 70.387647] Kernel panic - not syncing: Fatal exception
[ 70.387980] ---[ end Kernel panic - not syncing: Fatal exception
-----------------------

Steps to reproduce the kernel panic:

mount -t configfs none /config
mkdir /config/usb_gadget/g1
cd /config/usb_gadget/g1
echo 0x18d1 > idVendor
echo 0x4e26 > idProduct
mkdir strings/0x409
echo 0123459876 > strings/0x409/serialnumber
echo Asus > strings/0x409/manufacturer
echo Nexus7 > strings/0x409/product
mkdir configs/c.1
mkdir configs/c.1/strings/0x409
echo "Conf 1" > configs/c.1/strings/0x409/configuration
echo 120 > configs/c.1/MaxPower
mkdir functions/ptp.ptp
ln -s functions/ptp.ptp configs/c.1/ptp.ptp

Also MTP and PTP are mutually exclusive functions
so make sure we have only one of it linked to a
configuration at a time. Otherwise it opens up
another set of bug(s?).

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
_mtp.c
e9ff62c25d696eab4e486a2b284bc13df42336c4 31-Mar-2015 Amit Pundir <amit.pundir@linaro.org> usb: gadget: Relocate f_rndis

Relocate f_rndis driver to function/ directory and
fix following configfs + rndis function build failure:
----------
make[4]: *** No rule to make target `drivers/usb/gadget/function/f_rndis.o', needed by `drivers/usb/gadget/function/usb_f_rndis.o'. Stop.
make[3]: *** [drivers/usb/gadget/function] Error 2
make[2]: *** [drivers/usb/gadget] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2
----------

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
_rndis.c
0f8c6ce4fc6b0253846da7a4c5cae5c994a6f23a 31-Mar-2015 Badhri Jagan Sridharan <Badhri@google.com> usb: gadget: Relocate f_accessory

3.18 kernel has reorganized drivers/usb/gadget
directory. Moving accessory gadget driver from
drivers/usb/gadget to drivers/usb/gadget/function

Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
Change-Id: If73c6df0537c4b1f51338ed3b0db817e51f06b4a
akefile
_accessory.c
1172f96b6005e4d96cb236643c47de6203f55947 27-Mar-2015 Badhri Jagan Sridharan <Badhri@google.com> usb: gadget: Move gadget functions code

3.18 kernel has reorganized drivers/usb/gadget
directory. Moving gadget functions drivers from
drivers/usb/gadget to drivers/usb/gadget/function

Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
Change-Id: I1eab0190f8d42e3be1b4e91ad3bc3a2dc853b0ef
akefile
_audio_source.c
_mtp.c
_mtp.h
_ptp.c
f3ebc8dc9ee8d22dc3bf1ca791eda063194f86ab 22-Jan-2015 Praneeth Bajjuri <praneeth@ti.com> usb: u_ether: Fix compile errors

commit f1a1823ff24fa4e3412b5078f20021cf40834946
usb: gadget: u_ether: convert into module

changes qlen function definition. and this has to be fixed
accordingly in current u_ether driver.

This patch fixes following compile error in u_ether caused by commit.

drivers/usb/gadget/u_ether.c: In function 'rx_fill':
drivers/usb/gadget/u_ether.c:416:3: error: too few arguments to function 'qlen'
if (++req_cnt > qlen(dev->gadget))
^

drivers/usb/gadget/u_ether.c: In function 'eth_start_xmit':
drivers/usb/gadget/u_ether.c:738:24: error: 'qmult' undeclared (first use in this function)
if (dev->tx_qlen == (qmult/2)) {

which was caused by commits
commit 79467317949e1621240f632acfb7453783bec2e7
USB: gadget: u_ether: Fix data stall issue in RNDIS tethering mode

commit 68b91e8c54f5c091986c5719631893b10eab760a
usb: u_ether: Add workqueue as bottom half handler for rx data path

Change-Id: Ic4e5a1e08cb688e5a606c7c1895f869d8f887b9f
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
_ether.c
a77185d6aa95ae9dbfc897d6b352f01bb6b78902 25-Sep-2014 Badhri Jagan Sridharan <Badhri@google.com> USB: f_rndis: fix compile error

Change-Id: Ied5dd8ef905bdf84d176a5e560b09e292b68fbc5
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
_rndis.c
e77389702c49fab2d617dcf3a734e3d3e490a80c 04-Sep-2014 xerox_lin <xerox_lin@htc.com> USB: gadget: rndis: Add module parameter for DL max packets per xfer

Currently DL aggregation is supported in RNDIS driver and is set to
3 by default. And there is no support to change downlink maximum
packets per transfer at runtime through module parameter. Hence add
module parameter for DL maximum packets per transfer to change it at
runtime.

echo 6 > /sys/module/g_android/parameters/rndis_dl_max_pkt_per_xfer

To disable DL aggregation during runtime,

echo 1 > /sys/module/g_android/parameters/rndis_dl_max_pkt_per_xfer

Change-Id: I3a1d0bc97358e2b6f233df7ae8725fb507de50db
Signed-off-by: Xerox Lin <xerox_lin@htc.com>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
_rndis.c
_ether.c
_ether.h
0e8b24fb6c0ba6ca13d2ec811d304f4a7668ac3c 18-Sep-2014 Badhri Jagan Sridharan <Badhri@google.com> ndis: Add debug support to disable RNDIS Multipacket Feature

This change adds module param which allows to disable RNDIS
Multi-packet Feature (Aggregation support in Downlink path)
as this feature is enabled by default.

To disable use this param before moving to RNDIS Composition:
echo 1 > /sys/module/g_android/parameters/rndis_multipacket_dl_disable

Also counts errors as Rx errors if received RNDIS packets are
not following RNDIS message format as those packets are being
discarded.

Change-Id: I764430da78f2204af92e14bb279c11b24c7e4c67
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
_rndis.c
_ether.c
e298eec11b3a54e5c3bbdc065e172457fe8361c3 18-Sep-2014 Badhri Jagan Sridharan <Badhri@google.com> RNDIS: Add Data aggregation (multi packet) support

Add data aggregation support using RNDIS Multi Packet feature
to achieve better UDP Downlink throughput. Max 3 RNDIS Packets
aggregated into one RNDIS Packet with this implementation.

With this change, seeing UDP Downlink throughput increase
from 90 Mbps to above 100 Mbps when using Iperf and sending
data more than 100 Mbps.

Change-Id: I21c39482718944bb1b1068bdd02f626531e58f08
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
_rndis.c
_ether.c
3c96d69a0295d276bb2fb6a5bd92feb9478d6f57 18-Sep-2014 Badhri Jagan Sridharan <Badhri@google.com> USB: gadget: u_ether: Fix data stall issue in RNDIS tethering mode

For dual speed gadget, with current no. of request(10), there is
possibility of corner case occurence where all 10 reuqests are queued
to HW without setting IOC bit, which could lead to data stall in
RNDIS tethering and RNDIS local networking.

With this patch, counter will be incremented before queueing request to
HW and sets IOC bit for every nth request due to which the corner case
of all requests queued to HW without IOC bit set will be avoided.

Change-Id: I26515bfd9bbc8f7af38be7835692143f7093118a
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
_ether.c
cc0be22f98d12e185690d89b08507ed0c0953c29 14-Sep-2012 taeju.park <taeju.park@lge.com> usb: gadget: prevent change of Host MAC address of 'usb0' interface

On windows 7 platform, previously allocated ip address is maintained.
However, Host MAC address of 'usb0' interface is changed when the
tethering driver re-enumerated. Thus, the tethering network driver
can't be allocated ip address from dhcp. It causes connection delay
between host and phone for usb tethering.

This patch prevents from changing Host MAC address of 'usb0' interface.
In other words, this patch maintains the Host MAC address allocated when
first tethering driver although the driver is re-enumerated. However,
after reboot, the Host MAC address can be changed.

Change-Id: I43add9925e9d6d90c56cffbd3ed999104448f818
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
_ether.c
25c9b9257611f6c8d4f89d2c249169367752e149 25-Sep-2014 Badhri Jagan Sridharan <Badhri@google.com> usb: u_ether: Add workqueue as bottom half handler for rx data path

u_ether driver passes rx data to network layer and resubmits the
request back to usb hardware in interrupt context. Network layer
processes rx data by scheduling tasklet. For high throughput
scenarios on rx data path driver is spending lot of time in interrupt
context due to rx data processing by tasklet and continuous completion
and re-submission of the usb requests which results in watchdog bark.
Hence move the rx data processing and usb request submission to a
workqueue bottom half handler.

Change-Id: I316de8e267997137ac189a8b7b2846fa325f4a5a
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
_ether.c
c5ecbca49ba375cf4c7fd8a22210aebd25ebb1f9 14-Aug-2014 xerox_lin <xerox_lin@htc.com> usb: Add support for rndis uplink aggregation

RNDIS protocol supports data aggregation on uplink and can help
reduce mips by reducing number of interrupts on device. Throughput
also improved by 20-30%. Aggregation is disabled by setting
aggregation packet size to 1. To help better UL throughput, set
as ul aggregation support to 3 rndis packets by default. It can be
configured via module parameter: rndis_ul_max_pkt_per_xfer.

Change-Id: I0b62a21a5c3ceb6b04933d0d6da33301dbafe493
Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
Signed-off-by: Xerox Lin <xerox_lin@htc.com>
_rndis.c
ndis.c
ndis.h
_ether.c
_ether.h
34c2b574724958a9aa02a2ddd01636ff35e8b074 18-Aug-2014 xerox_lin <xerox_lin@htc.com> USB: rndis: Free the rndis response queue during REMOTE_NDIS_RESET_MSG

When rndis data transfer is in progress, some Windows7 Host PC is not
sending the GET_ENCAPSULATED_RESPONSE command for receiving the response
for the previous SEND_ENCAPSULATED_COMMAND processed.

The rndis function driver appends each response for the
SEND_ENCAPSULATED_COMMAND in a queue. As the above process got corrupted,
the Host sends a REMOTE_NDIS_RESET_MSG command to do a soft-reset.
As the rndis response queue is not freed, the previous response is sent
as a part of this REMOTE_NDIS_RESET_MSG's reset response and the Host
blocks any more Rndis transfers.

Hence free the rndis response queue as a part of this soft-reset so that
the current response for REMOTE_NDIS_RESET_MSG is sent properly during the
response command.

Change-Id: I8eff3849db452fe01b7d1fe4140ef1f1ad3f4fd4
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
Signed-off-by: Xerox Lin <xerox_lin@htc.com>
ndis.c
1c9fcf4b41d5df043f0050ff707cf726b47725b2 17-May-2013 Arve Hjønnevåg <arve@android.com> usb: gadget: android: 3.10 fixes

Signed-off-by: Arve Hjønnevåg <arve@android.com>
_serial.c
1c545be8dd928d43c9e293fe6338c98585a38400 06-Nov-2012 Benoit Goby <benoit@android.com> usb: gadget: Fix android gadget driver build

Removed obsolete f_adb function

Change-Id: Idfb4110429bc0ea63f493c68ad667f49ca471987
Signed-off-by: Benoit Goby <benoit@android.com>
_serial.c
9b1763553a89b2a84881119eeabfccdb803bb468 22-Oct-2014 Pavitrakumar Managutte <pavitra1729@gmail.com> usb: gadget: function: Fixed the return value on error path

Fixed the return value on failure. status variable
is set to 0 at usb_assign_descriptors call and the same is
returned on error which is incorrect.

Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Pavitrakumar Managutte <pavitra1729@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_rndis.c
d12a8727171c770990c246f0682f0af7859bb245 22-Oct-2014 Pavitrakumar Managutte <pavitra1729@gmail.com> usb: gadget: function: Remove redundant usb_free_all_descriptors

Removed usb_free_all_descriptors in the bind functions, which
results in double-free corruption of the descriptors on error path.
The usb descriptors are allocated by usb_assign_descriptors.

Signed-off-by: Pavitrakumar Managutte <pavitra1729@gmail.com>
Reviewed-by: Robert Baldyga <r.baldyga@samsung.com>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_eem.c
_hid.c
_ncm.c
_obex.c
_phonet.c
_rndis.c
_subset.c
_uac2.c
e0857ce58e8658657f5f12fe25272b93cfeb16aa 13-Oct-2014 Felipe Balbi <balbi@ti.com> usb: gadget: loopback: don't queue requests to bogus endpoints

A request allocated from e.g. ep1out cannot
be queued to any other endpoint. This bug has
been in f_loopback at least since mid-2011 and
since nobody has really screamed about it, we're
not backporting to any stable kernels.

Debugged with MUSB since that's the only controller
which complains about this case.

Signed-off-by: Felipe Balbi <balbi@ti.com>
_loopback.c
c0d31b3c3d9a025b8d5a57c35671e60c5f388bf7 13-Oct-2014 David Cohen <david.a.cohen@linux.intel.com> usb: ffs: fix regression when quirk_ep_out_aligned_size flag is set

The commit '2e4c7553cd usb: gadget: f_fs: add aio support' broke the
quirk implemented to align buffer size to maxpacketsize on out endpoint.
As result, functionfs does not work on Intel platforms using dwc3 driver
(i.e. Bay Trail and Merrifield). This patch fixes the issue.

This code is based on a previous Qiuxu's patch.

Fixes: 2e4c7553cd (usb: gadget: f_fs: add aio support)
Cc: <stable@vger.kernel.org> # v3.16+
Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_fs.c
a3058a5d82e296daaca07411c3738a9ddd79f302 09-Oct-2014 Robert Baldyga <r.baldyga@samsung.com> usb: gadget: f_fs: remove redundant ffs_data_get()

During FunctionFS bind, ffs_data_get() function was called twice
(in functionfs_bind() and in ffs_do_functionfs_bind()), while on unbind
ffs_data_put() was called once (in functionfs_unbind() function).
In result refcount never reached value 0, and ffs memory resources has
been never released.

Since ffs_data_get() call in ffs_do_functionfs_bind() is redundant
and not neccessary, we remove it to have equal number of gets ans puts,
and free allocated memory after refcount reach 0.

Fixes: 5920cda (usb: gadget: FunctionFS: convert to new function
interface with backward compatibility)
Cc: <stable@vger.kernel.org> # v3.14+
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_fs.c
3985f3ab0834edf014ebd19192d9dd77422dea67 29-Sep-2014 Felipe Balbi <balbi@ti.com> usb: gadget: function: f_obex: fix Interface Descriptor Test

On USB20CV's Interface Descriptor Test, a series
of SetInterface/GetInterface requests are issued
and gadget driver is required to always return
correct alternate setting.

In one step of the test, g_serial with f_obex
was returning the wrong value (1 instead of 0).

In order to fix this, we will now hold currently
selected alternate setting inside our struct f_obex
and just return that from our ->get_alt()
implementation.

Note that his also simplifies the code a bit.

Signed-off-by: Felipe Balbi <balbi@ti.com>
_obex.c
de1e6e799fc4e6f0452737e454267c0bfdf88c62 29-Sep-2014 Felipe Balbi <balbi@ti.com> usb: gadget: function: uac2: add a release method

devices are required to provide a release method. This
patch fixes the following WARN():

[ 42.611159] ------------[ cut here ]------------
[ 42.616025] WARNING: CPU: 0 PID: 1453 at drivers/base/core.c:250 device_release+0x94/0xa0()
[ 42.624820] Device 'snd_uac2.0' does not have a release() function, it is broken and must be fixed.
[ 42.634328] Modules linked in: usb_f_uac2 g_audio(-) libcomposite configfs xhci_hcd snd_soc_davinci_mcasp snd_soc_edma snd_soc_tlv320aic3x snd_soc_omap snd_soc_evm snd_soc_core dwc3 snd_compress omapdrm snd_pcm_dmaengine snd_pcm snd_timer snd fb_sys_fops lis3lv02d_i2c matrix_keypad dwc3_omap lis3lv02d panel_dpi input_polldev soundcore
[ 42.665687] CPU: 0 PID: 1453 Comm: modprobe Tainted: G D 3.17.0-rc6-00448-g9f3d0ec-dirty #188
[ 42.675756] [<c0017338>] (unwind_backtrace) from [<c0012fdc>] (show_stack+0x20/0x24)
[ 42.683911] [<c0012fdc>] (show_stack) from [<c0647fbc>] (dump_stack+0x8c/0xa4)
[ 42.691526] [<c0647fbc>] (dump_stack) from [<c0049950>] (warn_slowpath_common+0x7c/0xa0)
[ 42.700004] [<c0049950>] (warn_slowpath_common) from [<c00499b4>] (warn_slowpath_fmt+0x40/0x48)
[ 42.709194] [<c00499b4>] (warn_slowpath_fmt) from [<c0405f7c>] (device_release+0x94/0xa0)
[ 42.717794] [<c0405f7c>] (device_release) from [<c032e8e8>] (kobject_cleanup+0x4c/0x7c)
[ 42.726189] [<c032e8e8>] (kobject_cleanup) from [<c032e7c8>] (kobject_put+0x60/0x90)
[ 42.734316] [<c032e7c8>] (kobject_put) from [<c0406320>] (put_device+0x24/0x28)
[ 42.741995] [<c0406320>] (put_device) from [<c040c008>] (platform_device_unregister+0x2c/0x30)
[ 42.751061] [<c040c008>] (platform_device_unregister) from [<bf2b6b70>] (afunc_unbind+0x2c/0x68 [usb_f_uac2])
[ 42.761523] [<bf2b6b70>] (afunc_unbind [usb_f_uac2]) from [<bf29dbec>] (remove_config.isra.8+0xe8/0x100 [libcomposite])
[ 42.772868] [<bf29dbec>] (remove_config.isra.8 [libcomposite]) from [<bf29f9a4>] (__composite_unbind+0x48/0xb0 [libcomposite])
[ 42.784855] [<bf29f9a4>] (__composite_unbind [libcomposite]) from [<bf29fa28>] (composite_unbind+0x1c/0x20 [libcomposite])
[ 42.796446] [<bf29fa28>] (composite_unbind [libcomposite]) from [<c04d229c>] (usb_gadget_remove_driver+0x78/0xb0)
[ 42.807224] [<c04d229c>] (usb_gadget_remove_driver) from [<c04d2348>] (usb_gadget_unregister_driver+0x74/0xb8)
[ 42.817742] [<c04d2348>] (usb_gadget_unregister_driver) from [<bf29db00>] (usb_composite_unregister+0x1c/0x20 [libcomposite])
[ 42.829632] [<bf29db00>] (usb_composite_unregister [libcomposite]) from [<bf2b1084>] (audio_driver_exit+0x14/0x1c [g_audio])
[ 42.841430] [<bf2b1084>] (audio_driver_exit [g_audio]) from [<c00c0fe0>] (SyS_delete_module+0x120/0x1b0)
[ 42.851415] [<c00c0fe0>] (SyS_delete_module) from [<c000ed40>] (ret_fast_syscall+0x0/0x48)
[ 42.860075] ---[ end trace bb22e678d8d6db7b ]---
root@saruman:~#

Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.c
f3bb7b298120df8a9b7354e4f6d07e3185c15db7 29-Sep-2014 Felipe Balbi <balbi@ti.com> usb: gadget: function: uac2: prevent double ep disable

without this check, f_uac2 would try to disable
the same endpoint twice. Fix that.

Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.c
703a303c187ef7e3c8daf8a1be343576c9579eaf 29-Sep-2014 Felipe Balbi <balbi@ti.com> usb: gadget: function: uac2: add wMaxPacketSize to ep desc

Endpoint descriptors should pass wMaxPacketSize. Note
that this also fixes USB20CV Other Speed Endpoint
Descriptor Tests.

Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.c
e3122f5fedb6d88a043b60822f601f7ab517a465 29-Sep-2014 Felipe Balbi <balbi@ti.com> usb: gadget: function: uvc: disable endpoints on ->disable()

when our ->disable() method is called, we must
make sure to teardown all our resources, including
endpoints.

Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
62e370785cb337981999ac7ec364e22ffb6c2cd3 29-Sep-2014 Felipe Balbi <balbi@ti.com> usb: gadget: function: uvc: manage our video control endpoint

just like any other endpoint, we must enable/disable
our video control endpoint based on calls to our
->set_alt() method.

Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
52ec49a5e56a27c5b6f8217708783eff39f24c16 29-Sep-2014 Felipe Balbi <balbi@ti.com> usb: gadget: function: acm: make f_acm pass USB20CV Chapter9

During Halt Endpoint Test, our interrupt endpoint
will be disabled, which will clear out ep->desc
to NULL. Unless we call config_ep_by_speed() again,
we will not be able to enable this endpoint which
will make us fail that test.

Fixes: f9c56cd (usb: gadget: Clear usb_endpoint_descriptor
inside the struct usb_ep on disable)
Cc: <stable@vger.kernel.org> # v3.4+
Signed-off-by: Felipe Balbi <balbi@ti.com>
_acm.c
e975be287b87e0862b0f57e7326a79667e32a90a 29-Sep-2014 Felipe Balbi <balbi@ti.com> usb: gadget: function: uvc: return correct alt-setting

If our alternate setting has been selected, we must
return that on a subsequent Get Interface request
even if we're not streaming.

Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
c92bae753722a0010f1cabfb242581e130378b9f 29-Sep-2014 Felipe Balbi <balbi@ti.com> usb: gadget: function: uvc: make sure to balance ep enable/disable

If a set_alt() to the same alternate setting that's
already selected is received, functions are required
to reset the interface state, this means we must disable
all endpoints and reenable them again.

This is also documented on our kdoc for struct usb_function

* @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may
* initialize usb_ep.driver data at this time (when it is used).
* Note that setting an interface to its current altsetting resets
* interface state, and that all interfaces have a disabled state.

Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
d7577b389233a74609841492feaf6a55967aa5c8 29-Sep-2014 Felipe Balbi <balbi@ti.com> usb: gadget: function: uvc: conditionally dequeue

We shouldn't try to dequeue a NULL pointer.

Signed-off-by: Felipe Balbi <balbi@ti.com>
vc_video.c
77c688ac87183537ed0fb84ec2cb8fa8ec97c458 13-Oct-2014 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs updates from Al Viro:
"The big thing in this pile is Eric's unmount-on-rmdir series; we
finally have everything we need for that. The final piece of prereqs
is delayed mntput() - now filesystem shutdown always happens on
shallow stack.

Other than that, we have several new primitives for iov_iter (Matt
Wilcox, culled from his XIP-related series) pushing the conversion to
->read_iter()/ ->write_iter() a bit more, a bunch of fs/dcache.c
cleanups and fixes (including the external name refcounting, which
gives consistent behaviour of d_move() wrt procfs symlinks for long
and short names alike) and assorted cleanups and fixes all over the
place.

This is just the first pile; there's a lot of stuff from various
people that ought to go in this window. Starting with
unionmount/overlayfs mess... ;-/"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (60 commits)
fs/file_table.c: Update alloc_file() comment
vfs: Deduplicate code shared by xattr system calls operating on paths
reiserfs: remove pointless forward declaration of struct nameidata
don't need that forward declaration of struct nameidata in dcache.h anymore
take dname_external() into fs/dcache.c
let path_init() failures treated the same way as subsequent link_path_walk()
fix misuses of f_count() in ppp and netlink
ncpfs: use list_for_each_entry() for d_subdirs walk
vfs: move getname() from callers to do_mount()
gfs2_atomic_open(): skip lookups on hashed dentry
[infiniband] remove pointless assignments
gadgetfs: saner API for gadgetfs_create_file()
f_fs: saner API for ffs_sb_create_file()
jfs: don't hash direct inode
[s390] remove pointless assignment of ->f_op in vmlogrdr ->open()
ecryptfs: ->f_op is never NULL
android: ->f_op is never NULL
nouveau: __iomem misannotations
missing annotation in fs/file.c
fs: namespace: suppress 'may be used uninitialized' warnings
...
1bb27cacf4992b77556ed4487f99c76c4af3b43d 03-Sep-2014 Al Viro <viro@zeniv.linux.org.uk> f_fs: saner API for ffs_sb_create_file()

make it return dentry instead of inode

Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
_fs.c
35a9ad8af0bb0fa3525e6d0d20e32551d226f38e 09-Oct-2014 Linus Torvalds <torvalds@linux-foundation.org> Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next

Pull networking updates from David Miller:
"Most notable changes in here:

1) By far the biggest accomplishment, thanks to a large range of
contributors, is the addition of multi-send for transmit. This is
the result of discussions back in Chicago, and the hard work of
several individuals.

Now, when the ->ndo_start_xmit() method of a driver sees
skb->xmit_more as true, it can choose to defer the doorbell
telling the driver to start processing the new TX queue entires.

skb->xmit_more means that the generic networking is guaranteed to
call the driver immediately with another SKB to send.

There is logic added to the qdisc layer to dequeue multiple
packets at a time, and the handling mis-predicted offloads in
software is now done with no locks held.

Finally, pktgen is extended to have a "burst" parameter that can
be used to test a multi-send implementation.

Several drivers have xmit_more support: i40e, igb, ixgbe, mlx4,
virtio_net

Adding support is almost trivial, so export more drivers to
support this optimization soon.

I want to thank, in no particular or implied order, Jesper
Dangaard Brouer, Eric Dumazet, Alexander Duyck, Tom Herbert, Jamal
Hadi Salim, John Fastabend, Florian Westphal, Daniel Borkmann,
David Tat, Hannes Frederic Sowa, and Rusty Russell.

2) PTP and timestamping support in bnx2x, from Michal Kalderon.

3) Allow adjusting the rx_copybreak threshold for a driver via
ethtool, and add rx_copybreak support to enic driver. From
Govindarajulu Varadarajan.

4) Significant enhancements to the generic PHY layer and the bcm7xxx
driver in particular (EEE support, auto power down, etc.) from
Florian Fainelli.

5) Allow raw buffers to be used for flow dissection, allowing drivers
to determine the optimal "linear pull" size for devices that DMA
into pools of pages. The objective is to get exactly the
necessary amount of headers into the linear SKB area pre-pulled,
but no more. The new interface drivers use is eth_get_headlen().
From WANG Cong, with driver conversions (several had their own
by-hand duplicated implementations) by Alexander Duyck and Eric
Dumazet.

6) Support checksumming more smoothly and efficiently for
encapsulations, and add "foo over UDP" facility. From Tom
Herbert.

7) Add Broadcom SF2 switch driver to DSA layer, from Florian
Fainelli.

8) eBPF now can load programs via a system call and has an extensive
testsuite. Alexei Starovoitov and Daniel Borkmann.

9) Major overhaul of the packet scheduler to use RCU in several major
areas such as the classifiers and rate estimators. From John
Fastabend.

10) Add driver for Intel FM10000 Ethernet Switch, from Alexander
Duyck.

11) Rearrange TCP_SKB_CB() to reduce cache line misses, from Eric
Dumazet.

12) Add Datacenter TCP congestion control algorithm support, From
Florian Westphal.

13) Reorganize sk_buff so that __copy_skb_header() is significantly
faster. From Eric Dumazet"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1558 commits)
netlabel: directly return netlbl_unlabel_genl_init()
net: add netdev_txq_bql_{enqueue, complete}_prefetchw() helpers
net: description of dma_cookie cause make xmldocs warning
cxgb4: clean up a type issue
cxgb4: potential shift wrapping bug
i40e: skb->xmit_more support
net: fs_enet: Add NAPI TX
net: fs_enet: Remove non NAPI RX
r8169:add support for RTL8168EP
net_sched: copy exts->type in tcf_exts_change()
wimax: convert printk to pr_foo()
af_unix: remove 0 assignment on static
ipv6: Do not warn for informational ICMP messages, regardless of type.
Update Intel Ethernet Driver maintainers list
bridge: Save frag_max_size between PRE_ROUTING and POST_ROUTING
tipc: fix bug in multicast congestion handling
net: better IFF_XMIT_DST_RELEASE support
net/mlx4_en: remove NETDEV_TX_BUSY
3c59x: fix bad split of cpu_to_le32(pci_map_single())
net: bcmgenet: fix Tx ring priority programming
...
a173dc447d2980bb7cb9618a6b59cf135ea01e80 29-Sep-2014 Arnd Bergmann <arnd@arndb.de> usb: gadget: uvc: fix up uvcg_v4l2_get_unmapped_area typo

Patch "usb: gadget: uvc: rename functions to avoid conflicts with host uvc"
renamed a lot of symbols but missed one references that was inside of
an #ifdef:

drivers/usb/gadget/function/uvc_v4l2.c:363:23: error: 'uvcg_v4l2_get_unmapped_area' undeclared here (not in a function)
.get_unmapped_area = uvcg_v4l2_get_unmapped_area,
^
drivers/usb/gadget/function/uvc_v4l2.c:344:22: warning: 'uvc_v4l2_get_unmapped_area' defined but not used [-Wunused-function]
static unsigned long uvc_v4l2_get_unmapped_area(struct file *file,
^

This renames the reference according the changed function name.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 7ea95b110811 ("usb: gadget: uvc: rename functions to avoid conflicts with host uvc")
Cc: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Cc: Michael Grzeschik <m.grzeschik@pengutronix.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
vc_v4l2.c
1f6d80358dc9bbbeb56cb43384fa11fd645d9289 23-Sep-2014 David S. Miller <davem@davemloft.net> Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Conflicts:
arch/mips/net/bpf_jit.c
drivers/net/can/flexcan.c

Both the flexcan and MIPS bpf_jit conflicts were cases of simple
overlapping changes.

Signed-off-by: David S. Miller <davem@davemloft.net>
6dd5b021bd6c735a6a1515d06dab1478fc461dfd 16-Sep-2014 Laurent Pinchart <laurent.pinchart@ideasonboard.com> usb: gadget: uvc: Simplify uvcg_video_pump by using local variable

Use the local queue variable instead of computing it every time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
vc_video.c
e102609f107269fbc04af21548e78e99c02b6204 16-Sep-2014 Laurent Pinchart <laurent.pinchart@ideasonboard.com> usb: gadget: uvc: Fix endianness mismatches

The struct usb_endpoint_descriptor wMaxPacketSize field the struct
usb_ss_ep_comp_descriptor wBytesPerInterval field are stored in
little-endian format. Convert the values from CPU order to little endian
before storing the values.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
4a6698b80cfe36dd4e3c6bc30ab81b4e0a837f64 16-Sep-2014 Fengguang Wu <fengguang.wu@intel.com> usb: gadget: uvc: uvc_alloc() can be static

The function isn't called from outside of its compilation unit, make it
static.

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
1b0bf88fd8b845aef4300c7c0feca774265dd1c4 09-Sep-2014 Robert Baldyga <r.baldyga@samsung.com> usb: gadget: f_fs: virtual endpoint address mapping

This patch introduces virtual endpoint address mapping. It separates
function logic form physical endpoint addresses making it more hardware
independent.

Following modifications changes user space API, so to enable them user
have to switch on the FUNCTIONFS_VIRTUAL_ADDR flag in descriptors.

Endpoints are now refered using virtual endpoint addresses chosen by
user in endpoint descpriptors. This applies to each context when endpoint
address can be used:
- when accessing endpoint files in FunctionFS filesystemi (in file name),
- in setup requests directed to specific endpoint (in wIndex field),
- in descriptors returned by FUNCTIONFS_ENDPOINT_DESC ioctl.

In endpoint file names the endpoint address number is formatted as
double-digit hexadecimal value ("ep%02x") which has few advantages -
it is easy to parse, allows to easly recognize endpoint direction basing
on its name (IN endpoint number starts with digit 8, and OUT with 0)
which can be useful for debugging purpose, and it makes easier to introduce
further features allowing to use each endpoint number in both directions
to have more endpoints available for function if hardware supports this
(for example we could have ep01 which is endpoint 1 with OUT direction,
and ep81 which is endpoint 1 with IN direction).

Physical endpoint address can be still obtained using ioctl named
FUNCTIONFS_ENDPOINT_REVMAP, but now it's not neccesary to handle
USB transactions properly.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_fs.c
_fs.h
4cd41ffd27b6b775445ecfdb72b592b71d6b4a32 16-Sep-2014 Felipe Balbi <balbi@ti.com> Merge tag 'v3.17-rc5' into next

Linux 3.17-rc5

Signed-off-by: Felipe Balbi <balbi@ti.com>

Conflicts:
Documentation/devicetree/bindings/usb/mxs-phy.txt
drivers/usb/phy/phy-mxs-usb.c
fe00bcbf8a124980a38ce395ed6422d41be17374 11-Sep-2014 Michal Nazarewicz <mina86@mina86.com> usb: f_fs: replace BUG in dead-code with less serious WARN_ON

Even though the BUG() in __ffs_event_add is a dead-code, it is still
better to warn rather then crash the system if that code ever gets
executed.

Reported-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_fs.c
c559a353410939c0884e83bdb0e2420a986ac53b 09-Sep-2014 Robert Baldyga <r.baldyga@samsung.com> usb: gadget: f_fs: add ioctl returning ep descriptor

This patch introduces ioctl named FUNCTIONFS_ENDPOINT_DESC, which
returns endpoint descriptor to userspace. It works only if function
is active.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_fs.c
85b06f5e53d17c15844ef3cd45d0c7107f0ae45c 09-Sep-2014 Dan Carpenter <dan.carpenter@oracle.com> usb: gadget: f_fs: signedness bug in __ffs_func_bind_do_descs()

We need "idx" to be signed for the error handling to work.

Fixes: 6d5c1c77bbf9 ('usb: gadget: f_fs: fix the redundant ep files problem')
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_fs.c
13443799b559cde593826091a7de135483b245e5 09-Sep-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uvc: use usb_gstrings_attach

Attach strings to gadget with usb_strings_attach.
It is required for correct instantiation of functions more than once:
instead of modifying the local uvc_en_us_strings a function instance
specific copy is created with usb_gstrings_attach.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Tested-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
cb47d889e651d36b4200800de1d56977b910d8a3 09-Sep-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uvc: remove compatibility layer

There are no users of the old interface left. Remove it.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Tested-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
_uvc.h
6d11ed76c45dd7c8322c2d03575f2164cc725c18 09-Sep-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uvc: convert f_uvc to new function interface

Use the new function registration interface. It is required
in order to integrate configfs support.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Tested-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
[Updated copyright years]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
akefile
_uvc.c
_uvc.h
3a83c16ef0e03e2ca2f1ce547a7cba53a62d0e0d 09-Sep-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: uvc: separately compile some components of f_uvc

Compile uvc_queue, uvc_v4l2, uvc_video separately so that later they can
be all combined in a separately compiled f_uvc.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Tested-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
[Make uvc_v4l2_ioctl_ops non-static]
[Rename __UVC__V4L2__H__ and __UVC__VIDEO__H__]
[Update MAINTAINERS]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
_uvc.h
vc.h
vc_queue.c
vc_queue.h
vc_v4l2.c
vc_v4l2.h
vc_video.c
vc_video.h
7ea95b110811fa8e41f5960c278bcfc80b8b21c1 09-Sep-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: uvc: rename functions to avoid conflicts with host uvc

Prepare for separate compilation of uvc function's components.
Some symbols will have to be exported, so rename to avoid
conflicts with functions of the same name in host uvc.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Tested-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
[Rename uvc_video_pump and uvc_queue_head as well]
[Rename forgotten uvc_queue_cancel instance in a comment]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
vc_queue.c
vc_v4l2.c
vc_video.c
70aacc5777d1f1ca0a88067c9121ce86441bc4e0 09-Sep-2014 Amit Virdi <amit.virdi@st.com> usb: gadget: zero: Fix warning generated by kbuild

The kbuild test bot generated the warning:
drivers/usb/gadget/function/f_sourcesink.c:1498: warning: comparison is
always false due to limited range of data type

This patch fixes it.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
CC: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_sourcesink.c
f7cc38b16e2741186253be3dff61a9d124112126 08-Sep-2014 Felipe Balbi <balbi@ti.com> Merge tag 'v3.17-rc4' into next

Merge Linux 3.17-rc4 here so we have all the latest
fixes on next too. This also cleans up a few conflicts
when applying patches.

Signed-off-by: Felipe Balbi <balbi@ti.com>

Conflicts:
drivers/usb/gadget/Makefile
drivers/usb/gadget/function/Makefile
drivers/usb/gadget/legacy/Makefile
drivers/usb/phy/phy-samsung-usb.h
efb540c895d2cb77b1472edda6ca45d40719a041 08-Sep-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: uvc: move module parameters from f_uvc

When configfs support is integrated the future uvc function
module must not take any parameters. Move parameters to
webcam.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Tested-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
_uvc.h
a1d27a4bf5bb4144c593358cbd7261c6c6f0a023 08-Sep-2014 Laurent Pinchart <laurent.pinchart@ideasonboard.com> usb: gadget: f_uvc: Move to video_ioctl2

Simplify ioctl handling by using video_ioctl2.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
vc_v4l2.c
26a029f2277bf58c72ada0a92ae44ff9dd702a2e 08-Sep-2014 Laurent Pinchart <laurent.pinchart@ideasonboard.com> usb: gadget: f_uvc: Store EP0 control request state during setup stage

To handle class requests received on ep0, the driver needs to access the
length and direction of the request after the setup stage. It currently
stores them in a v4l2 event during the setup stage, and then copies them
from the event structure to the driver internal state structure when the
event is dequeued.

This two-steps approach isn't necessary. Simplify the driver by storing
the needed information in the driver internal state structure directly
during the setup stage.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
vc_v4l2.c
eb84d6b60491a3ca3d90d62ee5346b007770d40d 08-Sep-2014 David S. Miller <davem@davemloft.net> Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
6d5c1c77bbf98b2cc5373af02bb7b3b27584ee4a 25-Aug-2014 Robert Baldyga <r.baldyga@samsung.com> usb: gadget: f_fs: fix the redundant ep files problem

Up to now, when endpoint addresses in descriptors were non-consecutive,
there were created redundant files, which could cause problems in kernel,
when user tried to read/write to them. It was result of fact that maximum
endpoint address was taken as total number of endpoints in function.

This patch adds endpoint descriptors counting and storing their addresses
in eps_addrmap to verify their cohesion in each speed.

Endpoint address map would be also useful for further features, just like
vitual endpoint address mapping.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_fs.c
_fs.h
9bb87f168931cf55738ed2fbda3639575cede886 27-Aug-2014 Daniel Mack <zonque@gmail.com> usb: gadget: f_uac2: send reasonably sized packets

The UAC2 function driver currently responds to all packets at all times
with wMaxPacketSize packets. That results in way too fast audio
playback as the function driver (which is in fact supposed to define
the audio stream pace) delivers as fast as it can.

Fix this by sizing each packet correctly with the following steps:

a) Set the packet's size by dividing the nominal data rate by the
playback endpoint's interval.

b) If there is a residual value from the calculation in a), add
it to a accumulator to keep track of it across packets.

c) If the accumulator has gathered at least the number of bytes
that are needed for one sample frame, increase the packet size.

This way, the packet size calculation will get rid of any kind of
imprecision that would otherwise occur with a simple division over
time.

Some of the variables that are needed while processing each packet
are pre-computed for performance reasons.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.c
ec9e43138f1219966850477e056f6eb7fbcc4fa4 27-Aug-2014 Daniel Mack <zonque@gmail.com> usb: gadget: f_uac2: handle partial dma area wrap

With packet sizes other than 512, payloads in the packets may wrap
around the ALSA dma buffer partially, which leads to memory corruption
and audible clicks and pops in the audio stream at the moment, because
there is no boundary check before the memcpy().

In preparation to an implementation for smaller and dynamically sized
packets, we have to address such cases, and copy the payload in two
steps conditionally.

The 'src' and 'dst' approach doesn't work here anymore, as different
behavior is necessary in playback and capture cases. Thus, this patch
open-codes the routine now.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.c
254b3bf68b65ac8f82da1c7e0c1a2bb17012aa7d 27-Aug-2014 Daniel Mack <zonque@gmail.com> usb: gadget: f_uac2: introduce agdev_to_uac2_opts

Add a simple container_of() wrapper to get a struct f_uac2_opts from a
struct struct audio_dev. Use it in two places where it is currently
open-coded.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.c
a8147dabe56f7e7a4975e60abb613f7e62277577 27-Aug-2014 Daniel Mack <zonque@gmail.com> usb: gadget: f_uac2: add short-hand for 'dev'

In afunc_bind() and afunc_set_alt(), &uac2->pdev.dev are used multiple
times. Adding a short-hand for them makes lines shorter so we can
remove some line wraps.

No functional change.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.c
430fdbd3b7ea4a820d4c1aa936ede77433cfa818 27-Aug-2014 Daniel Mack <zonque@gmail.com> usb: gadget: f_uac2: restructure some code in afunc_set_alt()

Restructure some code to make it easier to read.

While at it, return -ENOMEM instead of -EINVAL if
usb_ep_alloc_request() fails, and omit the logging in such cases
(the mm core will complain loud enough).

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.c
4953ef658910416655cdb4b61618458aa11302ab 27-Aug-2014 Michal Nazarewicz <mina86@mina86.com> usb: gadget: f_mass_storage: simplify start_transfer slightly

Flatten the start_transfer function by reversing the if condition and
returning early out of the function if everything went fine. It makes
the function look less complicated, at least to me, and easier to
understand.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_mass_storage.c
fa31409a82ee050e52caad9e4c483fe3edca163a 27-Aug-2014 Yegor Yefremov <yegorslists@googlemail.com> usb: gadget: use $(srctree) instead of $(PWD) for includes

Using $(PWD) breaks builds when make was invoked from outside
of the kernel tree.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
akefile
c2c0e8b2b88cac379b2a2167b448000dedd2596a 28-Aug-2014 David S. Miller <davem@davemloft.net> f_ncm: Don't use netdev_start_xmit().

Unfortunately, the USB gadget layer has this weird things where NULL
skbs are passed into ops->ndo_start_xmit() in order to trigger the
dev->wrap() calls to build packets.

This is completely outside of the allowable range of sane arguments
for the ndo_start_xmit method. All invocations of ndo_start_xmit()
should be with non-NULL SKB arguments.

Put back the direct call, but with a comment explaining how this
is not acceptable in the long term.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
_ncm.c
ef11982dd7a657512c362242508bb4021e0d67b6 22-Aug-2014 Amit Virdi <amit.virdi@st.com> usb: gadget: zero: Add support for interrupt EP

Interrupt endpoints behave quite similar to the bulk endpoints with the
difference that the endpoints expect data sending/reception request at
particular intervals till the whole data has not been transmitted.

The interrupt EP support is added to gadget zero. A new alternate setting (=2)
has been added. It has 2 interrupt endpoints. The default parameters are set as:
bInterval: 1 ms for FS and 8 uFrames (implying 1 ms) for HS/SS
wMaxPacketSize: 64 bytes for FS and 1024 bytes for HS/SS
However, the same can be overridden through the module parameter interface.

The code is tested for HS and SS on a platform having DWC3 controller.

Signed-off-by: Amit Virdi <amit.virdi@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_loopback.c
_sourcesink.c
_zero.h
c572a217d1b81209ae5a4fe09a96db758f86f10b 21-Aug-2014 Richard Leitner <richard.leitner@skidata.com> usb: gadget: serial: remove PREFIX macro

Remove the ttyGS PREFIX macro from u_serial.c and replace all occurences with
the hardcoded ttyGS string.

This macro was mostly used in a few debug/warning messages and a lot of
hardcoded ttyGS existed beneath. It may have been used for renaming the
tty, but if done so most debug messages would have ignored this.

Due to the fact the usage of this PREFIX in all debug calls would have
resulted in a hard to read/grep code it is removed completely.

Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_serial.c
b8b0ea51b381a43c3179281a7aaf95b49f9f5f7b 21-Aug-2014 Richard Leitner <richard.leitner@skidata.com> usb: gadget: serial: replace {V,}DBG macro with dev_{v,}dbg

Replace the VDBG and DBG macro with the kernels "proper" debug macros
(dev_vdbg and dev_dbg) in f_acm.c, f_obex.c & f_serial.c

Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_acm.c
_obex.c
_serial.c
4798248e4e023170e937a65a1d30fcc52496dd42 23-Aug-2014 David S. Miller <davem@davemloft.net> net: Add ops->ndo_xmit_flush()

Signed-off-by: David S. Miller <davem@davemloft.net>
_ncm.c
84d1b78af9b35d706de2d1c115b9194bcaaa97b0 21-Aug-2014 Michael Grzeschik <m.grzeschik@pengutronix.de> usb: gadget: uvc: remove DRIVER_VERSION{,_NUMBER}

As the driver is in mainline we can remove the version numbers.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
vc.h
vc_v4l2.c
e73798572e115f73066567f5840d4e5c21da70a8 21-Aug-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uvc: fix potential memory leak

If uvc->control_buf is successfuly allocated but uvc->control_req
is not, uvc->control_buf is not freed in the error recovery path.
With this patch applied uvc->control_buf is freed unconditionally;
if it happens to be NULL kfree on it is safe anyway.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uvc.c
ee7ec7f6b39d2ae25dca000398929edaa2ce412d 21-Aug-2014 Philipp Zabel <p.zabel@pengutronix.de> usb: gadget: uvc: Add support for DMABUF importing

Activate the videobuf2 DMABUF support. As vb2-vmalloc supports the
importer role only, exporting buffers isn't supported yet. When the
exporter role will be implemented in vb2-vmalloc the UVC gadget driver
will automatically gain support for it.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
vc_queue.c
6bc17375d2e787e5c7ef94bfb4e194b6c690a4a7 21-Aug-2014 Michael Grzeschik <m.grzeschik@pengutronix.de> usb: gadget: uvc: Change KERN_INFO to KERN_DEBUG on request shutdown

The disconnect of the USB Device is a common pattern for
an UVC Camera. In many cases this will give us an meaningless
information for all buffers that couldn't be enqueued.
That patch changes this to KERN_DEBUG.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
vc_video.c
0854611a19ae4dfa56569e6f640017a1d2dd3312 22-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uac1: add configfs support

Add support for using f_uac1 function as a component of a gadget
composed with configfs.

Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac1.c
_uac1.h
bcec9784dd78abfa9d8ca8b7144f6e37ea6abfd5 22-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uac1: use defined constants as defaults

When configfs support is added the values in question will have to be
used in two different places. Substitute them with defined constants
to avoid duplicating magic numbers.

Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac1.c
_uac1.h
807dccdba5c157c7131772bb6bd9a114a2ed9760 22-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uac1: use usb_gstrings_attach

Use the new usb_gstring_attach interface.

Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac1.c
605ef833f0c6f9e609e27ff1582a14a4dbc7d341 22-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uac1: remove compatibility layer

There are no users of the old interface left, so it can be removed.

Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac1.c
_uac1.c
_uac1.h
f3a3406b3f562f8d15b89979c0ca9e184b269084 22-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uac1: convert to new function interface with backward compatibility

Converting uac1 to the new function interface requires converting
the USB uac1's function code and its users.

This patch converts the f_uac1.c to the new function interface.

The file is now compiled into a separate usb_f_uac1.ko module.

The old function interface is provided by means of a preprocessor
conditional directives. After all users are converted, the old interface
can be removed.

Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
akefile
_uac1.c
_uac1.c
_uac1.h
af1a58ca00b3735275c453ebd0b811a71a377470 22-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uac1: prepare for separate compilation

Integrating configfs requires converting f_uac1 to new function interface,
which in turn requires converting it to the new function interface,
which involves separate compilation of f_uac1.c into usb_f_uac1.ko.
u_uac1.c contains some module parameters. After this patch is applied
they are still a part of the resulting g_audio.ko, but can be guarded
with a compatiblity flag which will be removed when no users of the old
function interface of f_uac1 are left.

Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac1.c
f73db69f95921512b7cba586066723b500770d1a 22-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uac1: add function strings

uac1 function is missing strings. Add them.

Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac1.c
3aeea3c53e73b972ff07a1d03d6cc07f97de4f2f 22-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uac2: add configfs support

Add support for using f_uac2 function as a component of a gadget
composed with configfs.

Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.c
_uac2.h
065a107cdd70f0621011424009b3ecd4e42481b1 22-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uac2: use defined constants as defaults

When configfs is integrated the same values will have to be used
as defaults. Use symbolic names in order not to duplicate magic numbers.

Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.h
f408757f819a5792e6d27865a12f4da4ae802d28 22-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uac2: use usb_gstrings_attach

Use the new usb_gstring_attach interface.

Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.c
d980039a89fafe03829e4423d0da5d8fd119189d 22-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uac2: remove compatibility layer

There are no users of the old interface left, so it can be removed.

Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.c
f8f93d244afad804e09595fcb14320fe2896fef5 22-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_uac2: convert to new function interface with backward compatibility

Converting uac2 to the new function interface requires converting
the USB uac2's function code and its users.

This patch converts the f_uac2.c to the new function interface.

The file is now compiled into a separate usb_f_uac2.ko module.

The old function interface is provided by means of a preprocessor
conditional directives. After all users are converted, the old interface
can be removed.

Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
akefile
_uac2.c
_uac2.h
5d73abf2a77a090ca4c920ac99c8ec0e272398a9 22-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: audio: Use container_of to free audio_dev

Eliminate static struct *agdev_g from f_uac2.c.
It is used for freeing its memory, but the same address can be found
by calling container_of in afunc_unbind(). This implies eliminating
uac2_unbind_config(). The audio_config_driver in audio.c does not have
its unbind method any more. It has been used only when uac2 is used,
so uac2 itself can handle unbinding in afunc_unbind().

Tested-by: Sebastian Reimers <sebastian.reimers@googlemail.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.c
5d19703822da2a8e9161302aa918c8e45a4c5eee 18-Aug-2014 Philippe Reynes <tremyfr@gmail.com> usb: gadget: remove $(PWD) in ccflags-y

The variable $(PWD) is useless, and it may break the compilation.
For example, it breaks the kernel compilation when it's done with
buildroot :

/home/trem/Codes/armadeus/armadeus/buildroot/output/host/usr/bin/ccache
/home/trem/Codes/armadeus/armadeus/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc
-Wp,-MD,drivers/usb/gadget/legacy/.hid.o.d -nostdinc -isystem
/home/trem/Codes/armadeus/armadeus/buildroot/output/host/usr/lib/gcc/arm-buildroot-linux-uclibcgnueabi/4.7.3/include
-I./arch/arm/include -Iarch/arm/include/generated -Iinclude
-I./arch/arm/include/uapi -Iarch/arm/include/generated/uapi
-I./include/uapi -Iinclude/generated/uapi -include
./include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Wall -Wundef
-Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -Wno-format-security
-fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp
-funwind-tables -marm -D__LINUX_ARM_ARCH__=5 -march=armv5te
-mtune=arm9tdmi -msoft-float -Uarm -fno-delete-null-pointer-checks -O2
--param=allow-store-data-races=0 -Wframe-larger-than=1024
-fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer
-fno-var-tracking-assignments -g -Wdeclaration-after-statement
-Wno-pointer-sign -fno-strict-overflow -fconserve-stack
-Werror=implicit-int -Werror=strict-prototypes -DCC_HAVE_ASM_GOTO
-I/home/trem/Codes/armadeus/armadeus/buildroot/drivers/usb/gadget/
-I/home/trem/Codes/armadeus/armadeus/buildroot/drivers/usb/gadget/udc/
-I/home/trem/Codes/armadeus/armadeus/buildroot/drivers/usb/gadget/function/
-DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(hid)"
-D"KBUILD_MODNAME=KBUILD_STR(g_hid)" -c -o
drivers/usb/gadget/legacy/hid.o drivers/usb/gadget/legacy/hid.c
drivers/usb/gadget/epautoconf.c:23:26: erreur fatale: gadget_chips.h :
Aucun fichier ou dossier de ce type

This compilation line include :
..../buildroot/driver/usb/gadget
but the real path is :
..../buildroot/output/build/linux-3.17-rc1/driver/usb/gadget

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
akefile
bd52b813a999e44d2e35c2390d02fa4d0f61d08a 08-Aug-2014 Michael Grzeschik <m.grzeschik@pengutronix.de> usb: gadget: uvc: fix possible lockup in uvc gadget

If the pending buffers in the queue could not be pushed to the udc
endpoint we have to cancel the uvc_queue. Otherwise the gadget will get
stuck on this error. This patch calls uvc_queue_cancel if usb_ep_queue
failed.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
vc_video.c
7166c32d9a6b8655ce13b0844482526734ac41b3 25-Jul-2014 Li RongQing <roy.qing.li@gmail.com> Revert "usb: gadget: u_ether: synchronize with transmit when stopping queue"

This reverts commit a9232076374334ca2bc2a448dfde96d38a54349a.

It introduced a dead lock, and did not fix anything.

it made netif_tx_lock() be called in IRQ context, but in softirq context,
the same lock is locked without disabling IRQ. In fact, the commit a923207637
did not fix anything, since netif_stop_queue did not free the any resource

[ 10.154920] =================================
[ 10.156026] [ INFO: inconsistent lock state ]
[ 10.156026] 3.16.0-rc5+ #13 Not tainted
[ 10.156026] ---------------------------------
[ 10.156026] inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
[ 10.156026] swapper/1/0 [HC0[0]:SC1[5]:HE1:SE0] takes:
[ 10.156026] (_xmit_ETHER){?.-...}, at: [<80948b6a>] sch_direct_xmit+0x7a/0x250
[ 10.156026] {IN-HARDIRQ-W} state was registered at:
[ 10.156026] [<804811f0>] __lock_acquire+0x800/0x17a0
[ 10.156026] [<804828ba>] lock_acquire+0x6a/0xf0
[ 10.156026] [<809ed477>] _raw_spin_lock+0x27/0x40
[ 10.156026] [<8088d508>] gether_disconnect+0x68/0x280
[ 10.156026] [<8088e777>] eem_set_alt+0x37/0xc0
[ 10.156026] [<808847ce>] composite_setup+0x30e/0x1240
[ 10.156026] [<8088b8ae>] pch_udc_isr+0xa6e/0xf50
[ 10.156026] [<8048abe8>] handle_irq_event_percpu+0x38/0x1e0
[ 10.156026] [<8048adc1>] handle_irq_event+0x31/0x50
[ 10.156026] [<8048d94b>] handle_fasteoi_irq+0x6b/0x140
[ 10.156026] [<804040a5>] handle_irq+0x65/0x80
[ 10.156026] [<80403cfc>] do_IRQ+0x3c/0xc0
[ 10.156026] [<809ee6ae>] common_interrupt+0x2e/0x34
[ 10.156026] [<804668c5>] finish_task_switch+0x65/0xd0
[ 10.156026] [<809e89df>] __schedule+0x20f/0x7d0
[ 10.156026] [<809e94aa>] schedule_preempt_disabled+0x2a/0x70
[ 10.156026] [<8047bf03>] cpu_startup_entry+0x143/0x410
[ 10.156026] [<809e2e61>] rest_init+0xa1/0xb0
[ 10.156026] [<80ce2a3b>] start_kernel+0x336/0x33b
[ 10.156026] [<80ce22ab>] i386_start_kernel+0x79/0x7d
[ 10.156026] irq event stamp: 52070
[ 10.156026] hardirqs last enabled at (52070): [<809375de>] neigh_resolve_output+0xee/0x2a0
[ 10.156026] hardirqs last disabled at (52069): [<809375a8>] neigh_resolve_output+0xb8/0x2a0
[ 10.156026] softirqs last enabled at (52020): [<8044401f>] _local_bh_enable+0x1f/0x50
[ 10.156026] softirqs last disabled at (52021): [<80404036>] do_softirq_own_stack+0x26/0x30
[ 10.156026]
[ 10.156026] other info that might help us debug this:
[ 10.156026] Possible unsafe locking scenario:
[ 10.156026]
[ 10.156026] CPU0
[ 10.156026] ----
[ 10.156026] lock(_xmit_ETHER);
[ 10.156026] <Interrupt>
[ 10.156026] lock(_xmit_ETHER);
[ 10.156026]
[ 10.156026] *** DEADLOCK ***
[ 10.156026]
[ 10.156026] 4 locks held by swapper/1/0:
[ 10.156026] #0: (((&idev->mc_ifc_timer))){+.-...}, at: [<8044b100>] call_timer_fn+0x0/0x190
[ 10.156026] #1: (rcu_read_lock){......}, at: [<a0577c40>] mld_sendpack+0x0/0x590 [ipv6]
[ 10.156026] #2: (rcu_read_lock_bh){......}, at: [<a055680c>] ip6_finish_output2+0x4c/0x7f0 [ipv6]
[ 10.156026] #3: (rcu_read_lock_bh){......}, at: [<8092e510>] __dev_queue_xmit+0x0/0x5f0
[ 10.156026]
[ 10.156026] stack backtrace:
[ 10.156026] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.16.0-rc5+ #13
[ 10.156026] 811dbb10 00000000 9e919d10 809e6785 9e8b8000 9e919d3c 809e561e 80b95511
[ 10.156026] 80b9545a 80b9543d 80b95450 80b95441 80b957e4 9e8b84e0 00000002 8047f7b0
[ 10.156026] 9e919d5c 8048043b 00000002 00000000 9e8b8000 00000001 00000004 9e8b8000
[ 10.156026] Call Trace:
[ 10.156026] [<809e6785>] dump_stack+0x48/0x69
[ 10.156026] [<809e561e>] print_usage_bug+0x18f/0x19c
[ 10.156026] [<8047f7b0>] ? print_shortest_lock_dependencies+0x170/0x170
[ 10.156026] [<8048043b>] mark_lock+0x53b/0x5f0
[ 10.156026] [<804810cf>] __lock_acquire+0x6df/0x17a0
[ 10.156026] [<804828ba>] lock_acquire+0x6a/0xf0
[ 10.156026] [<80948b6a>] ? sch_direct_xmit+0x7a/0x250
[ 10.156026] [<809ed477>] _raw_spin_lock+0x27/0x40
[ 10.156026] [<80948b6a>] ? sch_direct_xmit+0x7a/0x250
[ 10.156026] [<80948b6a>] sch_direct_xmit+0x7a/0x250
[ 10.156026] [<8092e6bf>] __dev_queue_xmit+0x1af/0x5f0
[ 10.156026] [<80947fc0>] ? ether_setup+0x80/0x80
[ 10.156026] [<8092eb0f>] dev_queue_xmit+0xf/0x20
[ 10.156026] [<8093764c>] neigh_resolve_output+0x15c/0x2a0
[ 10.156026] [<a0556927>] ip6_finish_output2+0x167/0x7f0 [ipv6]
[ 10.156026] [<a0559b05>] ip6_finish_output+0x85/0x1c0 [ipv6]
[ 10.156026] [<a0559cb7>] ip6_output+0x77/0x240 [ipv6]
[ 10.156026] [<a0578163>] mld_sendpack+0x523/0x590 [ipv6]
[ 10.156026] [<80480501>] ? mark_held_locks+0x11/0x90
[ 10.156026] [<a057947d>] mld_ifc_timer_expire+0x15d/0x280 [ipv6]
[ 10.156026] [<8044b168>] call_timer_fn+0x68/0x190
[ 10.156026] [<a0579320>] ? igmp6_group_added+0x150/0x150 [ipv6]
[ 10.156026] [<8044b3fa>] run_timer_softirq+0x16a/0x240
[ 10.156026] [<a0579320>] ? igmp6_group_added+0x150/0x150 [ipv6]
[ 10.156026] [<80444984>] __do_softirq+0xd4/0x2f0
[ 10.156026] [<804448b0>] ? tasklet_action+0x100/0x100
[ 10.156026] [<80404036>] do_softirq_own_stack+0x26/0x30
[ 10.156026] <IRQ> [<80444d05>] irq_exit+0x65/0x70
[ 10.156026] [<8042d758>] smp_apic_timer_interrupt+0x38/0x50
[ 10.156026] [<809ee91f>] apic_timer_interrupt+0x2f/0x34
[ 10.156026] [<8048007b>] ? mark_lock+0x17b/0x5f0
[ 10.156026] [<8040a912>] ? default_idle+0x22/0xf0
[ 10.156026] [<8040b13e>] arch_cpu_idle+0xe/0x10
[ 10.156026] [<8047bfc6>] cpu_startup_entry+0x206/0x410
[ 10.156026] [<8042bfbd>] start_secondary+0x19d/0x1e0

Acked-by: Tony Lindgren <tony@atomide.com>
Reported-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jeff Westfahl <jeff.westfahl@ni.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_ether.c
ae045e2455429c418a418a3376301a9e5753a0a8 06-Aug-2014 Linus Torvalds <torvalds@linux-foundation.org> Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next

Pull networking updates from David Miller:
"Highlights:

1) Steady transitioning of the BPF instructure to a generic spot so
all kernel subsystems can make use of it, from Alexei Starovoitov.

2) SFC driver supports busy polling, from Alexandre Rames.

3) Take advantage of hash table in UDP multicast delivery, from David
Held.

4) Lighten locking, in particular by getting rid of the LRU lists, in
inet frag handling. From Florian Westphal.

5) Add support for various RFC6458 control messages in SCTP, from
Geir Ola Vaagland.

6) Allow to filter bridge forwarding database dumps by device, from
Jamal Hadi Salim.

7) virtio-net also now supports busy polling, from Jason Wang.

8) Some low level optimization tweaks in pktgen from Jesper Dangaard
Brouer.

9) Add support for ipv6 address generation modes, so that userland
can have some input into the process. From Jiri Pirko.

10) Consolidate common TCP connection request code in ipv4 and ipv6,
from Octavian Purdila.

11) New ARP packet logger in netfilter, from Pablo Neira Ayuso.

12) Generic resizable RCU hash table, with intial users in netlink and
nftables. From Thomas Graf.

13) Maintain a name assignment type so that userspace can see where a
network device name came from (enumerated by kernel, assigned
explicitly by userspace, etc.) From Tom Gundersen.

14) Automatic flow label generation on transmit in ipv6, from Tom
Herbert.

15) New packet timestamping facilities from Willem de Bruijn, meant to
assist in measuring latencies going into/out-of the packet
scheduler, latency from TCP data transmission to ACK, etc"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1536 commits)
cxgb4 : Disable recursive mailbox commands when enabling vi
net: reduce USB network driver config options.
tg3: Modify tg3_tso_bug() to handle multiple TX rings
amd-xgbe: Perform phy connect/disconnect at dev open/stop
amd-xgbe: Use dma_set_mask_and_coherent to set DMA mask
net: sun4i-emac: fix memory leak on bad packet
sctp: fix possible seqlock seadlock in sctp_packet_transmit()
Revert "net: phy: Set the driver when registering an MDIO bus device"
cxgb4vf: Turn off SGE RX/TX Callback Timers and interrupts in PCI shutdown routine
team: Simplify return path of team_newlink
bridge: Update outdated comment on promiscuous mode
net-timestamp: ACK timestamp for bytestreams
net-timestamp: TCP timestamping
net-timestamp: SCHED timestamp on entering packet scheduler
net-timestamp: add key to disambiguate concurrent datagrams
net-timestamp: move timestamp flags out of sk_flags
net-timestamp: extend SCM_TIMESTAMPING ancillary data struct
cxgb4i : Move stray CPL definitions to cxgb4 driver
tcp: reduce spurious retransmits due to transient SACK reneging
qlcnic: Initialize dcbnl_ops before register_netdev
...
61fe2d75f138992f116ee70e83f10ff2d7e79143 21-Jul-2014 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Merge tag 'usb-for-v3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:

usb: patches for v3.17 merge window

Surprisingly enough, while a big set of patches, the majority is
composed of cleanups (using devm_*, fixing sparse errors, moving
code around, adding const, etc).

The highlights are addition of new support for PLX USB338x devices,
and support for USB 2.0-only configurations of the DWC3 IP core.

Signed-of-by: Felipe Balbi <balbi@ti.com>
4546527350c3c508554dff53e9086e9d3de0b97b 01-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: f_rndis: fix interface id for OS descriptors

f->os_desc_table[0].if_id is zero by default. If the actual id happens
to be different then no Feature Descriptors will be returned to the host
for this interface, so assign if_id as soon as it is known.

Cc: <stable@vger.kernel.org> # v3.16
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_rndis.c
55f7840ac4c6224263d88014b69f8cd35fa66817 03-Jul-2014 Sebastian Reimers <sebastian.reimers@googlemail.com> usb: gadget: f_uac2: Fix pcm sample size selection

The pcm playback and capture sample size format was fixed
SNDRV_PCM_FMTBIT_S16_LE.

This patch respects also 16, 24 and 32 bit p_ssize and c_ssize values.

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sebastian Reimers <sebastian.reimers@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
_uac2.c
00a2430ff07d4e0e0e7e24e02fd8adede333b797 15-Jul-2014 Andrzej Pietrasiewicz <andrzej.p@samsung.com> usb: gadget: Gadget directory cleanup - group usb functions

The drivers/usb/gadget directory contains many files.
Files which are related can be distributed into separate directories.
This patch moves the USB functions implementations into a separate directory.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
akefile
_acm.c
_ecm.c
_eem.c
_fs.c
_hid.c
_loopback.c
_mass_storage.c
_mass_storage.h
_midi.c
_ncm.c
_obex.c
_phonet.c
_rndis.c
_serial.c
_sourcesink.c
_subset.c
_uac1.c
_uac2.c
_uvc.c
_uvc.h
_zero.h
dis.h
ndis.c
ndis.h
torage_common.c
torage_common.h
_ecm.h
_eem.h
_ether.c
_ether.h
_ether_configfs.h
_fs.h
_gether.h
_ncm.h
_phonet.h
_rndis.h
_serial.c
_serial.h
_uac1.c
_uac1.h
vc.h
vc_queue.c
vc_queue.h
vc_v4l2.c
vc_video.c