summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_sourcesink.c
Commit message (Collapse)AuthorAgeFilesLines
* usb: gadget: f_sourcesink: Fix sparse warningJingoo Han2013-12-171-4/+4
| | | | | | | | | | | | | Make local symbols static in order to fix the following sparse warnings. drivers/usb/gadget/f_sourcesink.c:205:34: warning: symbol 'ss_source_comp_desc' was not declared. Should it be static? drivers/usb/gadget/f_sourcesink.c:222:34: warning: symbol 'ss_sink_comp_desc' was not declared. Should it be static? drivers/usb/gadget/f_sourcesink.c:240:34: warning: symbol 'ss_iso_source_comp_desc' was not declared. Should it be static? drivers/usb/gadget/f_sourcesink.c:258:34: warning: symbol 'ss_iso_sink_comp_desc' was not declared. Should it be static? Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: f_sourcesink: add configfs supportAndrzej Pietrasiewicz2013-11-261-0/+318
| | | | | | | | | Add support for using the sourcesink function in gadgets composed with configfs. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: factor out alloc_ep_reqAndrzej Pietrasiewicz2013-11-261-18/+5
| | | | | | | | | | alloc_ep_req() is a function repeated in several modules. Make a common implementation and use it. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: f_sourcesink.c: correct a copy-paste misnomerAndrzej Pietrasiewicz2013-04-231-2/+2
| | | | | | | | | | acm was the first function to be converted and it seems that its code served as a base for converting f_sourcesink to the new function interface. source_sink has nothing to do with acm, though. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: convert source sink and loopback to new function interfaceSebastian Andrzej Siewior2013-01-211-51/+114
| | | | | | | | | | | | | | This patch converts the f_sourcesink and f_loopback file to the USB-function module. Both functions shares a few common utility functions which are currently implemented in g_zero.c itself. This patch moves the common code into the sourcesink file and creates one module out of the the two functions (source sink and loop back). The g_zero gadget is function specific to source sink and loop back to set a few options. This Symbol dependency enforces a modul load right now. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: move source sink's config descriptor out of f_sourcesinkSebastian Andrzej Siewior2013-01-211-40/+8
| | | | | | | | | f_sourcesink should only include the bare function but it also includes the config descriptor. This patch moves the config descriptor into zero.c, the only user of this function. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: provide a wrapper around SourceSink's setup functionSebastian Andrzej Siewior2013-01-211-25/+45
| | | | | | | | | | | | | | | | | | | | The setup request can be sent to an interface/endpoint or to the device itself. If it is sent to an interface / endpoint then we forward it to the function that is mapped to that interface / endpoint. If the device is the target of the setup request then we forward it to the ->setup() callback of the currently active configuration. In case of the sourcesink function the requests are function specific but are sent to the device. This patch introduces a setup wrapper at configuration level which forwards the request to the function. By using this wrapper we can keep the function specific code within the function file and we need just a hint at config level to forward the request. The here introduced global variable will be moved into the gadget (which combines the two functions) in a later patch. SourceSink is currently the only function using ->setup() at config level. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget zero: avoid unnecessary reinit of data in f_sourcesinkArmando Visconti2013-01-101-2/+1
| | | | | | | | | | | In the IN case, since the USB request is allocated only when the source/sink function is started and never freed, the USB ept buffer needs to be initialized only at the beginning. This change results into a more performant g_zero module, especially when 'pattern=1' is selected. Signed-off-by: Armando Visconti <armando.visconti@st.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: always update HS/SS descriptors and create a copy of themSebastian Andrzej Siewior2012-10-311-55/+49
| | | | | | | | | | | | | | | | | | | | | | | | HS and SS descriptors are staticaly created. They are updated during the bind process with the endpoint address, string id or interface numbers. After that, the descriptor chain is linked to struct usb_function which is used by composite in order to serve the GET_DESCRIPTOR requests, number of available configs and so on. There is no need to assign the HS descriptor only if the UDC supports HS speed because composite won't report those to the host if HS support has not been reached. The same reasoning is valid for SS. This patch makes sure each function updates HS/SS descriptors unconditionally and uses the newly introduced helper function to create a copy the descriptors for the speed which is supported by the UDC. While at that, also rename f->descriptors to f->fs_descriptors in order to make it more explicit what that means. Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: move USB_BUFSIZ into global composite.hSebastian Andrzej Siewior2012-09-101-1/+1
| | | | | | | | | | | This patch moves USB_BUFSIZ into global header file as USB_COMP_EP0_BUFSIZ. There is currently only one user (f_sourcesink) besides composite which need it. Ideally f_sourcesink would have its own ep0 buffer. Lets keep it that way it was for now. Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: add isochronous support to gadget zeroPaul Zimmerman2012-05-041-55/+369
| | | | | | | | | | | Add two isochronous endpoints to the gadget zero source/sink function. They are enabled by selecting alternate interface 1, so by default they are not enabled. Module parameters for setting all the isoc endpoint characteristics are also provided. Signed-off-by: Pratyush Anand <pratyush.anand@st.com> Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: Add module.h to drivers/usb consumers who really use it.Paul Gortmaker2011-10-311-0/+1
| | | | | | | | | The situation up to this point meant that module.h was pretty much everywhere, regardless of whether you asked for it or not. We are fixing that, so give the USB folks who want it an actual include of it. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
* usb gadget: clean up FSF boilerplate textKlaus Schwarzkopf2011-09-091-9/+0
| | | | | | | | | | | | | | | | remove the following two paragraphs as they are not needed: This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc.,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Signed-off-by: Klaus Schwarzkopf <schwarzkopf@sensortherm.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: gadget: zero: add superspeed supportAmit Blay2011-07-081-1/+54
| | | | | | | | | | | | This patch adds SuperSpeed descriptors to the g_zero gadget. The SuperSpeed descriptors were added both for f_soursesink and f_loopback function drivers. Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org> Signed-off-by: Amit Blay <ablay@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
* USB: gadget: fix req length in sourcesink_setup()Bob Liu2011-07-011-0/+2
| | | | | | | | | | | | | | | The recent commit 2edb11cbac fixed req->length in the composite_setup() function, but that will cause all g_zero tests to fail like: root#> ./testusb -D /proc/bus/usb/002/021 -t14 -c 15000 -s 256 -v 1 unknown speed /proc/bus/usb/002/021 /proc/bus/usb/002/021 test 14 --> 32 (Broken pipe) We need to fix req->length in sourcesink_setup() as well to avoid this. Signed-off-by: Bob Liu <lliubbo@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: gadget: use config_ep_by_speed() instead of ep_choose()Tatyana Brokhman2011-06-281-2/+6
| | | | | | | | | | Remove obsolete functions: 1. ep_choose() 2. usb_find_endpoint() Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: gadget: add usb_endpoint_descriptor to struct usb_epTatyana Brokhman2011-06-281-6/+4
| | | | | | | | | | | | | | | | | Change usb_ep_enable() prototype to use endpoint descriptor from usb_ep. This optimization spares the FDs from saving the endpoint chosen descriptor. This optimization is not full though. To fully exploit this change, one needs to update all the UDCs as well since in the current implementation each of them saves the endpoint descriptor in it's internal (and extended) endpoint structure. Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb gadget: don't save bind callback in struct usb_configurationUwe Kleine-König2010-10-221-2/+1
| | | | | | | | | | | | | The bind function is most of the time only called at init time so there is no need to save a pointer to it in the configuration structure. This fixes many section mismatches reported by modpost. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [m.nazarewicz@samsung.com: updated for -next] Signed-off-by: Michał Nazarewicz <m.nazarewicz@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: Revert "USB: gadget: section mismatch warning fixed"Michal Nazarewicz2010-10-221-1/+1
| | | | | | | | | | | | | This reverts a commit which proposed an invalid solution for a section mismatch. Next 3 commits will fix it correctly. Conflicts: drivers/usb/gadget/mass_storage.c Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: gadget: section mismatch warning fixedMichal Nazarewicz2010-08-101-1/+1
| | | | | | | | | | | | | In may gadgets bind and bind like functions were in a init section as they were only run during initialisation. However, being callback functions they were referenced from structures in “normal” sections. Changing the tag from “__init” to “__ref” fixes the warnings. Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo2010-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
* headers: utsname.h reduxAlexey Dobriyan2009-09-231-1/+0
| | | | | | | | | | | | | * remove asm/atomic.h inclusion from linux/utsname.h -- not needed after kref conversion * remove linux/utsname.h inclusion from files which do not need it NOTE: it looks like fs/binfmt_elf.c do not need utsname.h, however due to some personality stuff it _is_ needed -- cowardly leave ELF-related headers and files alone. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* USB: gadget: gadget zero uses new suspend/resume hooksDavid Brownell2009-03-241-51/+1
| | | | | | | | | | | | | | | | Use the new device-level suspend/resume hooks for Gadget Zero; always enable them with the OTG test mode; and support remote wakeup on both configurations even in non-OTG mode. This ensures that both configurations can pass the USBCV remote wakeup tests when the OTG test mode is enabled. This changes behavior by adding autoresume support to the loopback config even in non-OTG mode; the test failure was that it didn't work in OTG mode. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: replace uses of __constant_{endian}Harvey Harrison2009-03-241-2/+2
| | | | | | | | The base versions handle constant folding now. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb gadget: USB_GADGET_VBUS_DRAW Kconfig optionDavid Brownell2008-10-171-1/+0
| | | | | | | | | | | | | | | | | | Offer a "how much VBUS power to request" configuration option for USB gadgets that aren't using board-specific customization of their gadget or (composite) configuration drivers. Also remove a couple pointless "depends on USB_GADGET" bits from the Kconfig text; booleans inside an "if USB_GADGET" will already have that dependency. Based on a patch from Justin Clacherty. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: Justin Clacherty <justin@redfish-group.com> Tested-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb gadget zero: split out source/sink configDavid Brownell2008-07-211-0/+587
This splits the gadget zero "source/sink" configuration into a standalone "configuration driver", building on the composite gadget framework code. It doesn't yet pull the original code out of gadget zero or update how that driver is built. Neither this, nor its sibling "loopback" configuration, is a function driver that can be combined with other functions. (The host "usbtest" driver wouldn't know how to deal with that!) However the code becomes simpler because of this conversion, so it's a net win. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
OpenPOWER on IntegriCloud