[PATCH v2 0/3] ALSA: Implement core jack support for kcontrol

2013-07-26 Thread Felipe F. Tonello
From: "Felipe F. Tonello" Sending series again. Difference is that previous Patch 4 was squashed with Patch 2. Also fixed comment on Patche 3. Felipe F. Tonello (3): ALSA: Added jack detection kcontrol support ALSA: pci: HDA/oxygen: Updating jack implementation according new ALSA

[PATCH v2 2/3] ALSA: pci: HDA/oxygen: Updating jack implementation according new ALSA Jacks

2013-07-26 Thread Felipe F. Tonello
From: "Felipe F. Tonello" ALSA standard jacks already are implemented using ALSA KControl. So there is no need implement that itself or to use snd_jack for input events only. Also updating oxygen codec jack implementation to support new jack API. Signed-off-by: Felipe F. Tonello

[PATCH v2 1/3] ALSA: Added jack detection kcontrol support

2013-07-26 Thread Felipe F. Tonello
From: "Felipe F. Tonello" This patch adds jack support for alsa kcontrol. This support is necessary since the new kcontrol is used by user-space daemons, such as PulseAudio(>=2.0), to do jack detection.) Signed-off-by: Felipe F. Tonello --- include/sound/jack.h | 6 -

[PATCH v2 3/3] ALSA: SoC: Updating jack implementation according new ALSA Jacks

2013-07-26 Thread Felipe F. Tonello
From: "Felipe F. Tonello" Updating the ASoC jack support to add the ability to specify a jack index when creating it. Signed-off-by: Felipe F. Tonello --- include/sound/soc.h| 2 +- sound/soc/fsl/wm1133-ev1.c | 4 ++-- sound/soc/mid-x86/mfld_machin

[PATCH v2 2/2] ALSA: SoC: Fix jack names according new API

2013-08-02 Thread Felipe F. Tonello
From: "Felipe F. Tonello" The new ALSA jack API ensures that " Jack" is appended by default. It's also good practice that all codecs name jacks based on its type. Signed-off-by: Felipe F. Tonello --- sound/soc/mid-x86/mfld_machine.c | 2 +- sound/soc/omap/omap-abe

[PATCH v2 1/2] ALSA: Added jack detection KControl support

2013-08-02 Thread Felipe F. Tonello
From: "Felipe F. Tonello" This patch adds jack support for ALSA KControl. This support is necessary since the new kcontrol is used by user-space daemons, such as PulseAudio(>=2.0), to do jack detection.) Also, HDA's CONFIG_SND_HDA_INPUT_JACK is disabled because it cause

[PATCH v2 0/2] ALSA: Implement core jack support for kcontrol

2013-08-02 Thread Felipe F. Tonello
From: "Felipe F. Tonello" On this second version I made sure that the patch series can be bisected. Also, since HDA codec has it's own jack infrastructure, I just disabled the support of the core ALSA jack in it. Why? Because it's causing duplication of controls, although th

[PATCH v3 1/2] ALSA: Added jack detection KControl support

2013-08-08 Thread Felipe F. Tonello
From: "Felipe F. Tonello" This patch adds jack support for ALSA KControl. This support is necessary since the new kcontrol is used by user-space daemons, such as PulseAudio(>=2.0), to do jack detection.) Also, HDA's CONFIG_SND_HDA_INPUT_JACK is disabled because it cause

[PATCH 1/4] ALSA: Added jack detection kcontrol support

2013-07-26 Thread Felipe F. Tonello
From: "Felipe F. Tonello" This patch adds jack support for alsa kcontrol. This support is necessary since the new kcontrol is used by user-space daemons, such as PulseAudio(>=2.0), to do jack detection.) Signed-off-by: Felipe F. Tonello --- include/sound/jack.h | 6 -

[PATCH 3/4] ALSA: SoC: Updating jack implementation according new ALSA Jacks

2013-07-26 Thread Felipe F. Tonello
From: "Felipe F. Tonello" ALSA standard jacks already are implemented using ALSA KControl. So there is no need implement that itself or to use snd_jack for input events only. Signed-off-by: Felipe F. Tonello --- include/sound/soc.h| 2 +- sound/soc/fsl/wm

[PATCH 4/4] ALSA: oxygen: Updating jack implementation according new ALSA Jacks

2013-07-26 Thread Felipe F. Tonello
From: "Felipe F. Tonello" ALSA standard jacks already are implemented using ALSA KControl. So there is no need implement that itself or to use snd_jack for input events only. Signed-off-by: Felipe F. Tonello --- sound/pci/oxygen/xonar_wm87x6.c | 2 +- 1 file changed, 1 inser

[PATCH 2/4] ALSA: HDA: Updating jack implementation according new ALSA Jacks

2013-07-26 Thread Felipe F. Tonello
From: "Felipe F. Tonello" ALSA standard jacks already are implemented using ALSA KControl. So there is no need implement that itself or to use snd_jack for input events only. Signed-off-by: Felipe F. Tonello --- sound/pci/hda/Kconfig | 8 sound/pci/hda/hda_codec.h | 2

[PATCH 0/4] ALSA: Implement core jack support for kcontrol

2013-07-26 Thread Felipe F. Tonello
From: "Felipe F. Tonello" This patch series enable KControl support for core Jack and update current codecs. This will will enable moderns user-space daemons, such as PulseAudio(>=2.0), to have jack detection support via newer ALSA KControl interface. Patch 1: Actually impleme

[PATCH 0/2] Added set_power handler to mmc sdhci host

2013-05-22 Thread Felipe F. Tonello
From: "Felipe F. Tonello" This set_power handler is useful for modules that need to be turned off when the mmc host turns off. Felipe F. Tonello (2): mmc: sdhci: Added set_power sdhci_ops handler. mmc: sdhci-s3c: Added set_power handler to platdata drivers/mmc/host/s

[PATCH 1/2] mmc: sdhci: Added set_power sdhci_ops handler.

2013-05-22 Thread Felipe F. Tonello
From: "Felipe F. Tonello" This is useful for power managment purposes if a sdhci child host wants to turn off some other peripheral also. Signed-off-by: Felipe F. Tonello --- drivers/mmc/host/sdhci.c | 8 drivers/mmc/host/sdhci.h | 1 + 2 files changed, 9 insertions(+) di

[PATCH 2/2] mmc: sdhci-s3c: Added set_power handler to platdata

2013-05-22 Thread Felipe F. Tonello
From: "Felipe F. Tonello" This is useful to turn off peripherals that are related to the mmc host. One common case is when the wifi module is connected as an mmc card to the host. Signed-off-by: Felipe F. Tonello --- drivers/mmc/host/sdhci-s3c.c| 8 inc

[PATCH v3 4/9] usb: gadget: f_midi: defaults buflen sizes to 512

2016-08-05 Thread Felipe F. Tonello
512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 +- drivers/usb/gadget/legacy/gmidi.c

[PATCH v3 8/9] usb: gadget: f_hid: use free_ep_req()

2016-08-05 Thread Felipe F. Tonello
We should always use free_ep_req() when allocating requests with alloc_ep_req(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget

[PATCH v3 9/9] usb: gadget: f_hid: use alloc_ep_req()

2016-08-05 Thread Felipe F. Tonello
Use gadget's framework allocation function instead of directly calling usb_ep_alloc_request(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/driver

[PATCH v3 0/9] Gadget endpoint request allocation and MIDI

2016-08-05 Thread Felipe F. Tonello
* Added documentation to alloc_ep_req and free_ep_req * Improved commit message on patch 7 Changes from v1: * Added patches 1, 2, 7, 8 ,9. * Patch 3 removes max_t() for buffer alignment with wMaxPacketSize Felipe F. Tonello (9): usb: gadget: fix usb_ep_align_maybe endianness and new

[PATCH v3 7/9] usb: gadget: remove useless parameter in alloc_ep_req()

2016-08-05 Thread Felipe F. Tonello
The default_length parameter of alloc_ep_req was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. So this patch also removes duplicate code from few drivers. Signed-off-by: Felipe F. Tonello --- drivers/usb

[PATCH v3 6/9] usb: gadget: f_midi: drop substreams when disabling endpoint

2016-08-05 Thread Felipe F. Tonello
This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 27

[PATCH v3 5/9] usb: gadget: f_midi: refactor state machine

2016-08-05 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget

[PATCH v3 3/9] usb: gadget: f_midi: remove alignment code for OUT endpoint

2016-08-05 Thread Felipe F. Tonello
The new version of alloc_ep_req() already aligns the buffer size to wMaxPacketSize on OUT endpoints. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers

[PATCH v3 2/9] usb: gadget: align buffer size when allocating for OUT endpoint

2016-08-05 Thread Felipe F. Tonello
Using usb_ep_align() makes sure that the buffer size for OUT endpoints is always aligned with wMaxPacketSize (512 usually). This makes sure that no buffer has the wrong size, which can cause nasty bugs. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/u_f.c | 3 +++ drivers/usb/gadget

[PATCH v3 1/9] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align

2016-08-05 Thread Felipe F. Tonello
useful to be used by USB requests allocator functions. Signed-off-by: Felipe F. Tonello --- include/linux/usb/gadget.h | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 612dbdfa388e..3cc93237ff98

[PATCH v4 07/10] usb: gadget: f_midi: drop substreams when disabling endpoint

2016-08-08 Thread Felipe F. Tonello
This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 27

[PATCH v4 10/10] usb: gadget: f_hid: use alloc_ep_req()

2016-08-08 Thread Felipe F. Tonello
Use gadget's framework allocation function instead of directly calling usb_ep_alloc_request(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/driver

[PATCH v4 03/10] usb: gadget: align buffer size when allocating for OUT endpoint

2016-08-08 Thread Felipe F. Tonello
Using usb_ep_align() makes sure that the buffer size for OUT endpoints is always aligned with wMaxPacketSize (512 usually). This makes sure that no buffer has the wrong size, which can cause nasty bugs. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/u_f.c | 3 +++ drivers/usb/gadget

[PATCH v4 06/10] usb: gadget: f_midi: refactor state machine

2016-08-08 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget

[PATCH v4 09/10] usb: gadget: f_hid: use free_ep_req()

2016-08-08 Thread Felipe F. Tonello
We should always use free_ep_req() when allocating requests with alloc_ep_req(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget

[PATCH v4 08/10] usb: gadget: remove useless parameter in alloc_ep_req()

2016-08-08 Thread Felipe F. Tonello
The default_length parameter of alloc_ep_req was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. So this patch also removes duplicate code from few drivers. Signed-off-by: Felipe F. Tonello --- drivers/usb

[PATCH v4 02/10] usb: gadget: change len to size_t on alloc_ep_req()

2016-08-08 Thread Felipe F. Tonello
Length of buffers should be of type size_t whenever possible. Altough recommended, this change has no real practical change, unless a driver has a uses a huge or negative buffer size - it might help find these bugs. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/u_f.c | 2 +- drivers

[PATCH v4 05/10] usb: gadget: f_midi: defaults buflen sizes to 512

2016-08-08 Thread Felipe F. Tonello
512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 +- drivers/usb/gadget/legacy/gmidi.c

[PATCH v4 04/10] usb: gadget: f_midi: remove alignment code for OUT endpoint

2016-08-08 Thread Felipe F. Tonello
The new version of alloc_ep_req() already aligns the buffer size to wMaxPacketSize on OUT endpoints. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers

[PATCH v4 00/10] Gadget endpoint request allocation and MIDI

2016-08-08 Thread Felipe F. Tonello
wMaxPacketSize. Felipe F. Tonello (10): usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align usb: gadget: change len to size_t on alloc_ep_req() usb: gadget: align buffer size when allocating for OUT endpoint usb: gadget: f_midi: remove alignment code for OUT endpoint usb: gadget

[PATCH v4 01/10] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align

2016-08-08 Thread Felipe F. Tonello
useful to be used by USB requests allocator functions. Signed-off-by: Felipe F. Tonello --- include/linux/usb/gadget.h | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 612dbdfa388e..3cc93237ff98

[PATCH v4 6/7] usb: gadget: gmidi: Cleanup legacy code

2015-10-26 Thread Felipe F. Tonello
Remove unnecessary headers and variables. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/legacy/gmidi.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/drivers/usb/gadget/legacy/gmidi.c b/drivers/usb/gadget/legacy/gmidi.c index da19c48..055390b 100644 --- a/drivers/usb

[PATCH v4 5/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-10-26 Thread Felipe F. Tonello
This avoids duplication of USB requests for OUT endpoint and re-enabling endpoints. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c

[PATCH v4 7/7] usb: gadget: f_midi: pre-allocate IN requests

2015-10-26 Thread Felipe F. Tonello
better multiple MIDI Gadget ports, always processing the last processed MIDI substream if the last USB request wasn't enought to handle the whole stream. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 173 +++ drivers/usb/gadget/l

[PATCH v4 2/7] usb: gadget: f_midi: remove duplicated code

2015-10-26 Thread Felipe F. Tonello
This code is duplicated from f_midi_start_ep(midi, f, midi->out_ep). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 20 1 file changed, 20 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_mid

[PATCH v4 4/7] usb: gadget: f_midi: fix leak on failed to enqueue out requests

2015-10-26 Thread Felipe F. Tonello
This patch fixes a memory leak that occurs when an endpoint fails to enqueue the request. If that happens the complete function will never be called, thus never freeing the request. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 1 + 1 file changed, 1 insertion

[PATCH v4 0/7] USB MIDI Gadget improvements and bug fixes

2015-10-26 Thread Felipe F. Tonello
. changes in v4: - pre-alocation of in requests. - more code clean up - fix memory leak on out requests - configure endpoints only when setting up MIDIStreaming interface Felipe F. Tonello (7): usb: gadget: f_midi: Transmit data only when IN ep is enabled usb: gadget: f_midi: remove duplicated

[PATCH v4 3/7] usb: gadget: define free_ep_req as universal function

2015-10-26 Thread Felipe F. Tonello
This function is shared between gadget functions, so this avoid unnecessary duplicated code and potentially avoid memory leaks. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 6 -- drivers/usb/gadget/function/f_sourcesink.c | 6 -- drivers/usb/gadget

[PATCH v4 1/7] usb: gadget: f_midi: Transmit data only when IN ep is enabled

2015-10-26 Thread Felipe F. Tonello
This makes sure f_midi doesn't try to enqueue data when the IN endpoint is disabled, ie, USB cable is disconnected. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/fun

[PATCH] usb: chipidea: udc: improve error handling on _hardware_enqueue

2015-10-27 Thread Felipe F. Tonello
_hardware_enqueue() didn't check for errors when using add_td_to_list() which can fail if dma_pool_alloc fails, thus causing a kernel panic when lastnode->ptr is NULL. Signed-off-by: Felipe F. Tonello --- drivers/usb/chipidea/udc.c | 19 ++- 1 file changed, 14 insertio

[PATCH] char: Added support for u-blox 6 i2c gps driver

2015-01-13 Thread Felipe F. Tonello
necessary so the NMEA data is not corrupted. * iflags: added IGNCR: Ignore carriage return on input. * oflags: removed ONLCR: (XSI) Map NL to CR-NL on output. Signed-off-by: Felipe F. Tonello --- drivers/tty/serial/Kconfig | 9 ++ drivers/tty/serial/Makefile | 1 + drivers/tty

[PATCH] input: egalax: Send touch end event when is about to suspend

2013-12-10 Thread Felipe F. Tonello
From: "Felipe F. Tonello" This is useful to report for users of this device that don't know anything about the suspension of the device. So users will receive a touch end event when the device is about to suspend, making it more user friendly. One example of users is the X Server

[PATCH 0/2] input: mt: Add helper function to send end events

2013-12-30 Thread Felipe F. Tonello
From: "Felipe F. Tonello" Adds a helper function to send end touch events for active tracking ids. And also implements it in egalax driver. Felipe F. Tonello (2): input: mt: Add helper function to send end events input: egalax: report end state in suspend callback drivers/input/

[PATCH 1/2] input: mt: Add helper function to send end events

2013-12-30 Thread Felipe F. Tonello
From: "Felipe F. Tonello" This is useful to report for users of devices that don't know anything about the suspension of the device. So users will receive a touch end event when the device is about to suspend, making it more user friendly. One example of users is the X Server

[PATCH 2/2] input: egalax: report end state in suspend callback

2013-12-30 Thread Felipe F. Tonello
From: "Felipe F. Tonello" Make sure user-space will receive the touch end event even if the device driver suspends while touchscreen is still active (with fingers touching it). Signed-off-by: Felipe F. Tonello --- drivers/input/touchscreen/egalax_ts.c | 5 + 1 file changed, 5

[PATCH v6 1/3] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-12-01 Thread Felipe F. Tonello
This avoids duplication of USB requests for OUT endpoint and re-enabling endpoints. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget

[PATCH v6 2/3] usb: gadget: f_midi: fail if set_alt fails to allocate requests

2015-12-01 Thread Felipe F. Tonello
This ensures that the midi function will only work if the proper number of IN and OUT requrests are allocated. Otherwise the function will work with less requests then what the user wants. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 3 ++- 1 file changed, 2

[PATCH v6 0/3] USB MIDI Gadget improvements and bug fixes

2015-12-01 Thread Felipe F. Tonello
ndpoints only when setting up MIDIStreaming interface Felipe F. Tonello (3): usb: gadget: f_midi: set altsettings only for MIDIStreaming interface usb: gadget: f_midi: fail if set_alt fails to allocate requests usb: gadget: f_midi: pre-allocate IN requests drivers/usb/gadget/function/

[PATCH v6 3/3] usb: gadget: f_midi: pre-allocate IN requests

2015-12-01 Thread Felipe F. Tonello
better multiple MIDI Gadget ports, always processing the last processed MIDI substream if the last USB request wasn't enought to handle the whole stream. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 166 +++ drivers/usb/gadget/l

[PATCH 0/4] More improvements on MIDI gadget function

2015-12-30 Thread Felipe F. Tonello
Patch 1: The main improvement is the refactor of the state machine MIDI parser. It is better to read and handles states properly, even weird ones. Patch 3: Fix a race condition. Patches 3-4: Miscelaneous fixes. Felipe F. Tonello (4): usb: gadget: f_midi: refactor state machine usb

[PATCH 1/4] usb: gadget: f_midi: refactor state machine

2015-12-30 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and as a result fixed a bug when packaging a MIDI-USB packet right after a non-conformant MIDI byte stream. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 204 ++- 1 file changed

[PATCH 2/4] usb: gadget: f_midi: added spinlock on transmit function

2015-12-30 Thread Felipe F. Tonello
Also it performs better then previous implementation that allocated a usb_request for every new transmit made. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_m

[PATCH 3/4] usb: gadget: f_midi: remove useless midi reference from port struct

2015-12-30 Thread Felipe F. Tonello
Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index bbff20697f76..b7d3f5a10bf0 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b

[PATCH 4/4] usb: gadget: f_midi: add mutex_unlock under setup_fail label

2015-12-30 Thread Felipe F. Tonello
This ensures that at any point on the function if a goto to setup_fail is made, it will unlock the mutex. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b

[PATCH] usb: gadget: f_midi: added spinlock on transmit function

2016-03-09 Thread Felipe F. Tonello
necessary. In this case it is used a spinlock since f_midi_transmit is also called by usb_request->complete callback in interrupt context. Cc: # v4.5+ Fixes: e1e3d7ec5da3 ("usb: gadget: f_midi: pre-allocate IN requests") Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/

[PATCH] usb: gadget: f_midi: Fixed a bug when buflen was smaller than wMaxPacketSize

2016-03-09 Thread Felipe F. Tonello
] HOST: [PING] DEVICE: [NAK] HOST: [PING] DEVICE: [NAK] ... HOST: [PING] DEVICE: [NAK] This patch fixes this problem by setting the minimum usb_request's buffer size for the OUT endpoint as its wMaxPacketSize. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.

[PATCH v5 2/7] usb: gadget: f_midi: remove duplicated code

2015-11-10 Thread Felipe F. Tonello
This code is duplicated from f_midi_start_ep(midi, f, midi->out_ep). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 19 --- 1 file changed, 19 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_mid

[PATCH v5 7/7] usb: gadget: f_midi: pre-allocate IN requests

2015-11-10 Thread Felipe F. Tonello
better multiple MIDI Gadget ports, always processing the last processed MIDI substream if the last USB request wasn't enought to handle the whole stream. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 174 +++ drivers/usb/gadget/l

[PATCH v5 3/7] usb: gadget: define free_ep_req as universal function

2015-11-10 Thread Felipe F. Tonello
This function is shared between gadget functions, so this avoid unnecessary duplicated code and potentially avoid memory leaks. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 6 -- drivers/usb/gadget/function/f_sourcesink.c | 6 -- drivers/usb/gadget

[PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface

2015-11-10 Thread Felipe F. Tonello
This avoids duplication of USB requests for OUT endpoint and re-enabling endpoints. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget

[PATCH v5 5/7] usb: gadget: gmidi: Cleanup legacy code

2015-11-10 Thread Felipe F. Tonello
Remove unnecessary headers and variables. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/legacy/gmidi.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/usb/gadget/legacy/gmidi.c b/drivers/usb/gadget/legacy/gmidi.c index 8a18348..be8e91d 100644 --- a/drivers/usb

[PATCH v5 4/7] usb: gadget: f_midi: fix leak on failed to enqueue out requests

2015-11-10 Thread Felipe F. Tonello
This patch fixes a memory leak that occurs when an endpoint fails to enqueue the request. If that happens the complete function will never be called, thus never freeing the request. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 1 + 1 file changed, 1 insertion

[PATCH v5 0/7] USB MIDI Gadget improvements and bug fixes

2015-11-10 Thread Felipe F. Tonello
nts only when setting up MIDIStreaming interface Felipe F. Tonello (7): usb: gadget: f_midi: Transmit data only when IN ep is enabled usb: gadget: f_midi: remove duplicated code usb: gadget: define free_ep_req as universal function usb: gadget: f_midi: fix leak on failed to enqueue out reque

[PATCH v5 1/7] usb: gadget: f_midi: Transmit data only when IN ep is enabled

2015-11-10 Thread Felipe F. Tonello
This makes sure f_midi doesn't try to enqueue data when the IN endpoint is disabled, ie, USB cable is disconnected. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_m

[PATCH v3 1/4] usb: gadget: f_midi: free usb request when done

2015-09-29 Thread Felipe F. Tonello
req->actual == req->length means that there is no data left to enqueue, so free the request. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drive

[PATCH v3 2/4] usb: gadget: f_midi: free request when usb_ep_queue fails

2015-09-29 Thread Felipe F. Tonello
This fix a memory leak that will occur in this case. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 93212ca

[PATCH v3 0/4] USB MIDI Gadget bug fixes and improvements

2015-09-29 Thread Felipe F. Tonello
Here is the third version of this patch set. It includes memory leakage bug fix, improvements and code cleanups. Felipe F. Tonello (4): usb: gadget: f_midi: free usb request when done usb: gadget: f_midi: free request when usb_ep_queue fails usb: gadget: f_midi: Transmit data only when IN

[PATCH v3 4/4] usb: gadget: f_midi: remove duplicated code

2015-09-29 Thread Felipe F. Tonello
This code is duplicated from f_midi_start_ep(midi, f, midi->out_ep). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 20 1 file changed, 20 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_mid

[PATCH v3 3/4] usb: gadget: f_midi: Transmit data only when IN ep is enabled

2015-09-29 Thread Felipe F. Tonello
This makes sure f_midi doesn't try to enqueue data when the IN endpoint is disabled, ie, USB cable is disconnected. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/fun

[PATCH 3/4] usb: gadget: f_midi: refactor state machine

2016-07-25 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget

[PATCH 4/4] usb: gadget: f_midi: drop substreams when disabling endpoint

2016-07-25 Thread Felipe F. Tonello
This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 27

[PATCH 0/4] MIDI Function improvements

2016-07-25 Thread Felipe F. Tonello
ation, which is nice to have. Felipe F. Tonello (4): usb: gadget: f_midi: fixed endianness when using wMaxPacketSize usb: gadget: f_midi: defaults buflen sizes to 512 usb: gadget: f_midi: refactor state machine usb: gadget: f_midi: drop substreams when disabling endpoint drivers/usb/gadget/fun

[PATCH 2/4] usb: gadget: f_midi: defaults buflen sizes to 512

2016-07-25 Thread Felipe F. Tonello
512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 +- drivers/usb/gadget/legacy/gmidi.c

[PATCH 1/4] usb: gadget: f_midi: fixed endianness when using wMaxPacketSize

2016-07-25 Thread Felipe F. Tonello
USB spec specifies wMaxPacketSize to be little endian (as other properties), so when using this variable in the driver we should convert to the current CPU endianness if necessary. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 +- 1 file changed, 1 insertion

[PATCH 1/9] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align

2016-07-26 Thread Felipe F. Tonello
useful to be used by USB requests allocator functions. Signed-off-by: Felipe F. Tonello --- include/linux/usb/gadget.h | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 612dbdfa388e..b8fa6901b881

[PATCH 9/9] usb: gadget: f_hid: use alloc_ep_req()

2016-07-26 Thread Felipe F. Tonello
Use gadget's framework allocation function instead of directly calling usb_ep_alloc_request(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/driver

[PATCH 8/9] usb: gadget: f_hid: use free_ep_req()

2016-07-26 Thread Felipe F. Tonello
We should always use free_ep_req() when allocating requests with alloc_ep_req(). Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget

[PATCH 7/9] usb: gadget: remove useless parameter in alloc_ep_req()

2016-07-26 Thread Felipe F. Tonello
This parameter was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. So this patch also removes duplicate code from few drivers. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c

[PATCH 5/9] usb: gadget: f_midi: refactor state machine

2016-07-26 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget

[PATCH v2 0/9] Gadget endpoint request allocation and MIDI

2016-07-26 Thread Felipe F. Tonello
-explanatory. Changes from v1: * Added patches 1, 2, 7, 8 ,9. * Patch 3 removes max_t() for buffer alignment with wMaxPacketSize Felipe F. Tonello (9): usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align usb: gadget: align buffer size when allocating for OUT endpoint usb: gadget

[PATCH 4/9] usb: gadget: f_midi: defaults buflen sizes to 512

2016-07-26 Thread Felipe F. Tonello
512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 2 +- drivers/usb/gadget/legacy/gmidi.c

[PATCH 6/9] usb: gadget: f_midi: drop substreams when disabling endpoint

2016-07-26 Thread Felipe F. Tonello
This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 27

[PATCH v2 7/9] usb: gadget: remove useless parameter in alloc_ep_req()

2016-07-26 Thread Felipe F. Tonello
This parameter was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. So this patch also removes duplicate code from few drivers. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_hid.c

[PATCH 2/9] usb: gadget: align buffer size when allocating for OUT endpoint

2016-07-26 Thread Felipe F. Tonello
Using usb_ep_align() makes sure that the buffer size for OUT endpoints is always aligned with wMaxPacketSize (512 usually). This makes sure that no buffer has the wrong size, which can cause nasty bugs. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/u_f.c | 3 +++ 1 file changed, 3

[PATCH 3/9] usb: gadget: f_midi: remove alignment code for OUT endpoint

2016-07-26 Thread Felipe F. Tonello
The new version of alloc_ep_req() already aligns the buffer size to wMaxPacketSize on OUT endpoints. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers

[PATCH v2] usb: gadget: f_midi: fixed a bug when buflen was smaller than wMaxPacketSize

2016-03-23 Thread Felipe F. Tonello
and replacing it with wMaxPacketSize of the appropriate endpoint where needed. Signed-off-by: Felipe F. Tonello --- v2: - Removed buflen - use le16_to_cpu() in order to avoid endianess issues drivers/usb/gadget/function/f_midi.c | 14 ++ drivers/usb/gadget/function/u_midi.h | 1

[PATCH 2/5] usb: gadget: f_midi: added spinlock on transmit function

2016-03-02 Thread Felipe F. Tonello
Also it performs better then previous implementation that allocated a usb_request for every new transmit made. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/us

[PATCH 4/5] usb: gadget: f_midi: cleanups and typos fixes

2016-03-02 Thread Felipe F. Tonello
Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 77 +++- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 8475e3dc82d4..9a9e6112e224

[PATCH 0/5] MIDI USB Gadget improvements

2016-03-02 Thread Felipe F. Tonello
Patches are pretty much self-described. Patch 1 is revised from comments. Patch 2 is a bug fix. Felipe F. Tonello (5): usb: gadget: f_midi: refactor state machine usb: gadget: f_midi: added spinlock on transmit function usb: gadget: gmidi: remove bus powered requirement on bmAttributes

[PATCH 5/5] usb: gadget: f_midi: updated copyright

2016-03-02 Thread Felipe F. Tonello
Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 9a9e6112e224..5c7f5c780fda 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b

[PATCH 3/5] usb: gadget: gmidi: remove bus powered requirement on bmAttributes

2016-03-02 Thread Felipe F. Tonello
flags. The default values are what the gadget used to use for backward compatibility. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/legacy/gmidi.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/legacy/gmidi.c b/drivers/usb/gadget

[PATCH 1/5] usb: gadget: f_midi: refactor state machine

2016-03-02 Thread Felipe F. Tonello
This refactor results in a cleaner state machine code and as a result fixed a bug when packaging a USB-MIDI packet right after a non-conformant MIDI byte stream. Signed-off-by: Felipe F. Tonello --- drivers/usb/gadget/function/f_midi.c | 204 ++- 1 file changed

[PATCH v2 1/3] usb: chipidea: core: fix when building without CONFIG_PM support

2015-09-23 Thread Felipe F. Tonello
If CONFIG_PM or CONFIG_PM_SLEEP is not set, driver will not compile properly. Signed-off-by: Felipe F. Tonello --- Changes for v2: * removed unnecessary #ifdef CONFIG_PM_SLEEP. drivers/usb/chipidea/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb

[PATCH v2 2/3] usb: gadget: f_midi: free usb request when done

2015-09-23 Thread Felipe F. Tonello
req->actual == req->length means that there is no data left to enqueue, so free the request. Signed-off-by: Felipe F. Tonello --- Changes in v2: * Re enqueue not fully completed requests, instead of read ALSA buffers. drivers/usb/gadget/function/f_midi.c | 10 ++ 1 file chan

  1   2   >