Re: [GIT PULL] USB-serial fixes for v4.12-rc6
On Sat, Jun 17, 2017 at 09:39:21PM +0200, Greg Kroah-Hartman wrote: > On Fri, Jun 16, 2017 at 02:44:19PM +0200, Johan Hovold wrote: > > The following changes since commit 32c1431eea4881a6b17bd7c639315010aeefa452: > > > > Linux 4.12-rc5 (2017-06-11 16:48:20 -0700) > > > > are available in the git repository at: > > > > git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git > > tags/usb-serial-4.12-rc6 > > Sorry for missing this release for these, I had to get on a flight and > get the existing bug fixes to Linus for -rc6. I'll get to these this > week. No worries. Thanks, Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 3/4] usb: gadget: function: make current f_uac1 implementation legacy
Before introducing new f_uac1 function (with virtual ALSA card) make current implementation legacy. This includes renaming of existing files, some variables, config options and documentation Signed-off-by: Ruslan Bilovol --- ...gadget-uac1 => configfs-usb-gadget-uac1_legacy} | 2 +- Documentation/usb/gadget-testing.txt | 9 +++-- drivers/usb/gadget/Kconfig | 8 ++-- drivers/usb/gadget/function/Makefile | 4 +- .../gadget/function/{f_uac1.c => f_uac1_legacy.c} | 45 +++--- .../gadget/function/{u_uac1.c => u_uac1_legacy.c} | 7 ++-- .../gadget/function/{u_uac1.h => u_uac1_legacy.h} | 8 ++-- drivers/usb/gadget/legacy/Kconfig | 6 +-- drivers/usb/gadget/legacy/audio.c | 26 ++--- 9 files changed, 59 insertions(+), 56 deletions(-) rename Documentation/ABI/testing/{configfs-usb-gadget-uac1 => configfs-usb-gadget-uac1_legacy} (84%) rename drivers/usb/gadget/function/{f_uac1.c => f_uac1_legacy.c} (95%) rename drivers/usb/gadget/function/{u_uac1.c => u_uac1_legacy.c} (98%) rename drivers/usb/gadget/function/{u_uac1.h => u_uac1_legacy.h} (94%) diff --git a/Documentation/ABI/testing/configfs-usb-gadget-uac1 b/Documentation/ABI/testing/configfs-usb-gadget-uac1_legacy similarity index 84% rename from Documentation/ABI/testing/configfs-usb-gadget-uac1 rename to Documentation/ABI/testing/configfs-usb-gadget-uac1_legacy index 8ba9a12..b2eaefd 100644 --- a/Documentation/ABI/testing/configfs-usb-gadget-uac1 +++ b/Documentation/ABI/testing/configfs-usb-gadget-uac1_legacy @@ -1,4 +1,4 @@ -What: /config/usb-gadget/gadget/functions/uac1.name +What: /config/usb-gadget/gadget/functions/uac1_legacy.name Date: Sep 2014 KernelVersion: 3.18 Description: diff --git a/Documentation/usb/gadget-testing.txt b/Documentation/usb/gadget-testing.txt index fb0cc4d..ce51d6e 100644 --- a/Documentation/usb/gadget-testing.txt +++ b/Documentation/usb/gadget-testing.txt @@ -16,7 +16,7 @@ provided by gadgets. 13. RNDIS function 14. SERIAL function 15. SOURCESINK function -16. UAC1 function +16. UAC1 function (legacy implementation) 17. UAC2 function 18. UVC function 19. PRINTER function @@ -589,15 +589,16 @@ device: run the gadget host: test-usb (tools/usb/testusb.c) -16. UAC1 function +16. UAC1 function (legacy implementation) = -The function is provided by usb_f_uac1.ko module. +The function is provided by usb_f_uac1_legacy.ko module. Function-specific configfs interface -The function name to use when creating the function directory is "uac1". +The function name to use when creating the function directory +is "uac1_legacy". The uac1 function provides these attributes in its function directory: audio_buf_size - audio buffer size diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 3b0ffd6..01c2e2b 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -191,7 +191,7 @@ config USB_F_MASS_STORAGE config USB_F_FS tristate -config USB_F_UAC1 +config USB_F_UAC1_LEGACY tristate config USB_F_UAC2 @@ -365,13 +365,13 @@ config USB_CONFIGFS_F_FS implemented in kernel space (for instance Ethernet, serial or mass storage) and other are implemented in user space. -config USB_CONFIGFS_F_UAC1 - bool "Audio Class 1.0" +config USB_CONFIGFS_F_UAC1_LEGACY + bool "Audio Class 1.0 (legacy implementation)" depends on USB_CONFIGFS depends on SND select USB_LIBCOMPOSITE select SND_PCM - select USB_F_UAC1 + select USB_F_UAC1_LEGACY help This Audio function implements 1 AudioControl interface, 1 AudioStreaming Interface each for USB-OUT and USB-IN. diff --git a/drivers/usb/gadget/function/Makefile b/drivers/usb/gadget/function/Makefile index b29f2ae..50ee517 100644 --- a/drivers/usb/gadget/function/Makefile +++ b/drivers/usb/gadget/function/Makefile @@ -33,8 +33,8 @@ obj-$(CONFIG_USB_F_MASS_STORAGE)+= usb_f_mass_storage.o usb_f_fs-y := f_fs.o obj-$(CONFIG_USB_F_FS) += usb_f_fs.o obj-$(CONFIG_USB_U_AUDIO) += u_audio.o -usb_f_uac1-y := f_uac1.o u_uac1.o -obj-$(CONFIG_USB_F_UAC1) += usb_f_uac1.o +usb_f_uac1_legacy-y:= f_uac1_legacy.o u_uac1_legacy.o +obj-$(CONFIG_USB_F_UAC1_LEGACY)+= usb_f_uac1_legacy.o usb_f_uac2-y := f_uac2.o obj-$(CONFIG_USB_F_UAC2) += usb_f_uac2.o usb_f_uvc-y:= f_uvc.o uvc_queue.o uvc_v4l2.o uvc_video.o uvc_configfs.o diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1_legacy.c similarity index 95% rename from drivers/usb/gadget/function/f_uac1.c rename to drivers/usb/gadget/function/f_uac1_legacy.c index 5dfc94b..5d229e7 100644 --- a/drivers/usb/gadget/function/f_uac1.c +++ b/drivers/u
[PATCH v5 4/4] usb: gadget: add f_uac1 variant based on a new u_audio api
This patch adds a new function 'f_uac1' (f_uac1 with virtual "ALSA card") that uses recently created u_audio API. Comparing to legacy f_uac1 function implementation it doesn't require any real Audio codec to be present on the device. In f_uac1 audio streams are simply sinked to and sourced from a virtual ALSA sound card created using u_audio API. Legacy f_uac1 approach is to write audio samples directly to existing ALSA sound card f_uac1 approach is more generic/flexible one - create an ALSA sound card that represents USB Audio function and allows to be used by userspace application that may choose to do whatever it wants with the data received from the USB Host and choose to provide whatever it wants as audio data to the USB Host. f_uac1 also has capture support (gadget->host) thanks to easy implementation via u_audio. By default, capture interface has 48000kHz/2ch configuration, same as playback channel has. f_uac1 descriptors naming convention uses f_uac2 driver naming convention that makes it more common and meaningful. Comparing to f_uac1_legacy, the f_uac1 doesn't have volume/mute functionality. This is because the f_uac1 volume/mute feature unit was dummy implementation since that driver creation (2009) and never had any real volume control or mute functionality, so there is no any difference here. Since f_uac1 functionality, exposed interface to userspace (virtual ALSA card), input parameters are so different comparing to f_uac1_legacy, that there is no any reason to keep them in the same file/module, and separate function was created. g_audio can be built using one of existing UAC functions (f_uac1, f_uac1_legacy or f_uac2) Signed-off-by: Ruslan Bilovol --- Documentation/ABI/testing/configfs-usb-gadget-uac1 | 14 + Documentation/usb/gadget-testing.txt | 44 ++ drivers/usb/gadget/Kconfig | 25 +- drivers/usb/gadget/function/Makefile | 2 + drivers/usb/gadget/function/f_uac1.c | 802 + drivers/usb/gadget/function/u_uac1.h | 41 ++ drivers/usb/gadget/legacy/Kconfig | 18 +- drivers/usb/gadget/legacy/audio.c | 69 +- 8 files changed, 1000 insertions(+), 15 deletions(-) create mode 100644 Documentation/ABI/testing/configfs-usb-gadget-uac1 create mode 100644 drivers/usb/gadget/function/f_uac1.c create mode 100644 drivers/usb/gadget/function/u_uac1.h diff --git a/Documentation/ABI/testing/configfs-usb-gadget-uac1 b/Documentation/ABI/testing/configfs-usb-gadget-uac1 new file mode 100644 index 000..abfe447 --- /dev/null +++ b/Documentation/ABI/testing/configfs-usb-gadget-uac1 @@ -0,0 +1,14 @@ +What: /config/usb-gadget/gadget/functions/uac1.name +Date: June 2017 +KernelVersion: 4.14 +Description: + The attributes: + + c_chmask - capture channel mask + c_srate - capture sampling rate + c_ssize - capture sample size (bytes) + p_chmask - playback channel mask + p_srate - playback sampling rate + p_ssize - playback sample size (bytes) + req_number - the number of pre-allocated request + for both capture and playback diff --git a/Documentation/usb/gadget-testing.txt b/Documentation/usb/gadget-testing.txt index ce51d6e..fbc397d 100644 --- a/Documentation/usb/gadget-testing.txt +++ b/Documentation/usb/gadget-testing.txt @@ -20,6 +20,7 @@ provided by gadgets. 17. UAC2 function 18. UVC function 19. PRINTER function +20. UAC1 function (new API) 1. ACM function @@ -773,3 +774,46 @@ host: More advanced testing can be done with the prn_example described in Documentation/usb/gadget-printer.txt. + + +20. UAC1 function (virtual ALSA card, using u_audio API) += + +The function is provided by usb_f_uac1.ko module. +It will create a virtual ALSA card and the audio streams are simply +sinked to and sourced from it. + +Function-specific configfs interface + + +The function name to use when creating the function directory is "uac1". +The uac1 function provides these attributes in its function directory: + + c_chmask - capture channel mask + c_srate - capture sampling rate + c_ssize - capture sample size (bytes) + p_chmask - playback channel mask + p_srate - playback sampling rate + p_ssize - playback sample size (bytes) + req_number - the number of pre-allocated request for both capture +and playback + +The attributes have sane default values. + +Testing the UAC1 function +- + +device: run the gadget +host: aplay -l # should list our USB Audio Gadget + +This function does not require real hardware support, it just +sends a stream of audio data to/from the host. In order to +actually hear something at the device side, a command similar +to this must be used at the device sid
[PATCH v5 2/4] usb: gadget: f_uac2: split out audio core
Abstract the peripheral side ALSA sound card code from the f_uac2 function into a component that can be called by various functions, so the various flavors can be split apart and selectively reused. Visible changes: - add uac_params structure to pass audio paramteres for g_audio_setup - make ALSA sound card's name configurable - add [in/out]_ep_maxpsize - allocate snd_uac_chip structure during g_audio_setup - add u_audio_[start/stop]_[capture/playback] functions Signed-off-by: Ruslan Bilovol --- drivers/usb/gadget/Kconfig| 4 + drivers/usb/gadget/function/Makefile | 1 + drivers/usb/gadget/function/f_uac2.c | 718 -- drivers/usb/gadget/function/u_audio.c | 662 +++ drivers/usb/gadget/function/u_audio.h | 95 + drivers/usb/gadget/legacy/Kconfig | 1 + 6 files changed, 845 insertions(+), 636 deletions(-) create mode 100644 drivers/usb/gadget/function/u_audio.c create mode 100644 drivers/usb/gadget/function/u_audio.h diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index b3c879b..3b0ffd6 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -158,6 +158,9 @@ config USB_U_SERIAL config USB_U_ETHER tristate +config USB_U_AUDIO + tristate + config USB_F_SERIAL tristate @@ -381,6 +384,7 @@ config USB_CONFIGFS_F_UAC2 depends on SND select USB_LIBCOMPOSITE select SND_PCM + select USB_U_AUDIO select USB_F_UAC2 help This Audio function is compatible with USB Audio Class diff --git a/drivers/usb/gadget/function/Makefile b/drivers/usb/gadget/function/Makefile index cb8c225..b29f2ae 100644 --- a/drivers/usb/gadget/function/Makefile +++ b/drivers/usb/gadget/function/Makefile @@ -32,6 +32,7 @@ usb_f_mass_storage-y := f_mass_storage.o storage_common.o obj-$(CONFIG_USB_F_MASS_STORAGE)+= usb_f_mass_storage.o usb_f_fs-y := f_fs.o obj-$(CONFIG_USB_F_FS) += usb_f_fs.o +obj-$(CONFIG_USB_U_AUDIO) += u_audio.o usb_f_uac1-y := f_uac1.o u_uac1.o obj-$(CONFIG_USB_F_UAC1) += usb_f_uac1.o usb_f_uac2-y := f_uac2.o diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index f674bae..9082ce2 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -15,10 +15,7 @@ #include #include -#include -#include -#include - +#include "u_audio.h" #include "u_uac2.h" /* @@ -50,455 +47,23 @@ #define UNFLW_CTRL 8 #define OVFLW_CTRL 10 -struct uac2_req { - struct uac2_rtd_params *pp; /* parent param */ - struct usb_request *req; +struct f_uac2 { + struct g_audio g_audio; + u8 ac_intf, as_in_intf, as_out_intf; + u8 ac_alt, as_in_alt, as_out_alt; /* needed for get_alt() */ }; -struct uac2_rtd_params { - struct snd_uac2_chip *uac2; /* parent chip */ - bool ep_enabled; /* if the ep is enabled */ - /* Size of the ring buffer */ - size_t dma_bytes; - unsigned char *dma_area; - - struct snd_pcm_substream *ss; - - /* Ring buffer */ - ssize_t hw_ptr; - - void *rbuf; - - size_t period_size; - - unsigned max_psize; - struct uac2_req *ureq; - - spinlock_t lock; -}; - -struct snd_uac2_chip { - struct uac2_rtd_params p_prm; - struct uac2_rtd_params c_prm; - - struct snd_card *card; - struct snd_pcm *pcm; - - /* timekeeping for the playback endpoint */ - unsigned int p_interval; - unsigned int p_residue; - - /* pre-calculated values for playback iso completion */ - unsigned int p_pktsize; - unsigned int p_pktsize_residue; - unsigned int p_framesize; -}; - -#define BUFF_SIZE_MAX (PAGE_SIZE * 16) -#define PRD_SIZE_MAX PAGE_SIZE -#define MIN_PERIODS4 - -static struct snd_pcm_hardware uac2_pcm_hardware = { - .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER -| SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID -| SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME, - .rates = SNDRV_PCM_RATE_CONTINUOUS, - .periods_max = BUFF_SIZE_MAX / PRD_SIZE_MAX, - .buffer_bytes_max = BUFF_SIZE_MAX, - .period_bytes_max = PRD_SIZE_MAX, - .periods_min = MIN_PERIODS, -}; - -struct audio_dev { - u8 ac_intf, ac_alt; - u8 as_out_intf, as_out_alt; - u8 as_in_intf, as_in_alt; - - struct usb_ep *in_ep, *out_ep; - struct usb_function func; - struct usb_gadget *gadget; - - /* The ALSA Sound Card it represents on the USB-Client side */ - struct snd_uac2_chip uac2; -}; - -static inline -struct audio_dev *func_to_agdev(struct usb_function *f) -{ - return container_of(f, struct audio_dev, func); -} - -static inline -struct audio_dev *uac2_to_agdev(struct snd_uac2_chip *u) +stat
[PATCH v5 1/4] usb: gadget: f_uac2: remove platform driver/device creation
Simplify f_uac2 by removing platform driver/device creation; use composite's usb_gadget device as parent for sound card and for debug prints. This removes extra layer of code without any functional change. Signed-off-by: Ruslan Bilovol --- drivers/usb/gadget/function/f_uac2.c | 107 +-- 1 file changed, 28 insertions(+), 79 deletions(-) diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index 5a7ba05..f674bae 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -13,7 +13,6 @@ #include #include -#include #include #include @@ -51,8 +50,6 @@ #define UNFLW_CTRL 8 #define OVFLW_CTRL 10 -static const char *uac2_name = "snd_uac2"; - struct uac2_req { struct uac2_rtd_params *pp; /* parent param */ struct usb_request *req; @@ -81,9 +78,6 @@ struct uac2_rtd_params { }; struct snd_uac2_chip { - struct platform_device pdev; - struct platform_driver pdrv; - struct uac2_rtd_params p_prm; struct uac2_rtd_params c_prm; @@ -122,6 +116,7 @@ struct audio_dev { struct usb_ep *in_ep, *out_ep; struct usb_function func; + struct usb_gadget *gadget; /* The ALSA Sound Card it represents on the USB-Client side */ struct snd_uac2_chip uac2; @@ -140,12 +135,6 @@ struct audio_dev *uac2_to_agdev(struct snd_uac2_chip *u) } static inline -struct snd_uac2_chip *pdev_to_uac2(struct platform_device *p) -{ - return container_of(p, struct snd_uac2_chip, pdev); -} - -static inline struct f_uac2_opts *agdev_to_uac2_opts(struct audio_dev *agdev) { return container_of(agdev->func.fi, struct f_uac2_opts, func_inst); @@ -254,7 +243,7 @@ uint num_channels(uint chanmask) exit: if (usb_ep_queue(ep, req, GFP_ATOMIC)) - dev_err(&uac2->pdev.dev, "%d Error!\n", __LINE__); + dev_err(uac2->card->dev, "%d Error!\n", __LINE__); if (update_alsa) snd_pcm_period_elapsed(substream); @@ -440,23 +429,22 @@ static int uac2_pcm_null(struct snd_pcm_substream *substream) .prepare = uac2_pcm_null, }; -static int snd_uac2_probe(struct platform_device *pdev) +static int snd_uac2_probe(struct audio_dev *audio_dev) { - struct snd_uac2_chip *uac2 = pdev_to_uac2(pdev); + struct snd_uac2_chip *uac2 = &audio_dev->uac2; struct snd_card *card; struct snd_pcm *pcm; - struct audio_dev *audio_dev; struct f_uac2_opts *opts; int err; int p_chmask, c_chmask; - audio_dev = uac2_to_agdev(uac2); opts = container_of(audio_dev->func.fi, struct f_uac2_opts, func_inst); p_chmask = opts->p_chmask; c_chmask = opts->c_chmask; /* Choose any slot, with no id */ - err = snd_card_new(&pdev->dev, -1, NULL, THIS_MODULE, 0, &card); + err = snd_card_new(&audio_dev->gadget->dev, + -1, NULL, THIS_MODULE, 0, &card); if (err < 0) return err; @@ -481,16 +469,15 @@ static int snd_uac2_probe(struct platform_device *pdev) strcpy(card->driver, "UAC2_Gadget"); strcpy(card->shortname, "UAC2_Gadget"); - sprintf(card->longname, "UAC2_Gadget %i", pdev->id); + sprintf(card->longname, "UAC2_Gadget %i", card->dev->id); snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_dma_continuous_data(GFP_KERNEL), 0, BUFF_SIZE_MAX); err = snd_card_register(card); - if (!err) { - platform_set_drvdata(pdev, card); + + if (!err) return 0; - } snd_fail: snd_card_free(card); @@ -501,9 +488,9 @@ static int snd_uac2_probe(struct platform_device *pdev) return err; } -static int snd_uac2_remove(struct platform_device *pdev) +static int snd_uac2_remove(struct audio_dev *audio_dev) { - struct snd_card *card = platform_get_drvdata(pdev); + struct snd_card *card = audio_dev->uac2.card; if (card) return snd_card_free(card); @@ -511,45 +498,6 @@ static int snd_uac2_remove(struct platform_device *pdev) return 0; } -static void snd_uac2_release(struct device *dev) -{ - dev_dbg(dev, "releasing '%s'\n", dev_name(dev)); -} - -static int alsa_uac2_init(struct audio_dev *agdev) -{ - struct snd_uac2_chip *uac2 = &agdev->uac2; - int err; - - uac2->pdrv.probe = snd_uac2_probe; - uac2->pdrv.remove = snd_uac2_remove; - uac2->pdrv.driver.name = uac2_name; - - uac2->pdev.id = 0; - uac2->pdev.name = uac2_name; - uac2->pdev.dev.release = snd_uac2_release; - - /* Register snd_uac2 driver */ - err = platform_driver_register(&uac2->pdrv); - if (err) - return err; - - /* Register snd_uac2 device */ - err = platform_device_register(&uac2->pdev); - if (err) - platf
[PATCH v5 0/4] USB Audio Gadget refactoring
Hi Felipe, This is v5 of audio gadget refactoring. Note, that legacy f_uac1 function is broken since v4.10 by commit 7e4da3fcf7c9 ("usb: gadget: composite: Test get_alt() presence instead of set_alt()"). The fact that at v4.12-rc5 time nobody cares about may be a good sign that number of users is small if any. Thus making it legacy makes sence. This series depends on legacy f_uac1 fix I posted before: http://www.spinics.net/lists/linux-usb/msg158373.html Without this fix it's not possible to check that refactoring didn't break legacy f_uac1 functionality I came to this patch series when wanted to do two things: - use UAC1 as virtual ALSA sound card on gadget side, just like UAC2 is used so it's possible to do rate resampling - have both playback/capture support in UAC1 Since I wanted to have same behavior for both UAC1/UAC2, obviously I've got an utility part (u_audio.c) for virtual ALSA sound card handling like we have for ethernet(u_ether) or serial(u_serial) functions. Function-specific parts (f_uac1/f_uac2) became almost as storage for class-specific USB descriptors, some boilerplate for configfs, binding and few USB config request handling. Originally in RFC [1] I've posted before, there was major change to f_uac1 after that it couldn't do direct play to existing ALSA sound card anymore, representing audio on gadget side as virtual ALSA sound card where audio streams are simply sinked to and sourced from it, so it may break current usecase for some people (and that's why it was RFC). During RFC discussion, it was agreed to not touch existing f_uac1 implementation and create new one instead. At v4 patchet discussion another approach was agreed - current f_uac1.c gets renamed to f_uac1_legacy.c and introduced a *new* f_uac1.c instead that is done in current patchset (v5) Now, it's possible to use existing user-space applications for audio routing between Audio Gadget and real sound card. I personally use alsaloop tool from alsautils and have ability to create PCM loopback between two different ALSA cards using rate resampling, which was not possible with previous "direct play to ALSA card" approach in f_uac1. While here, also dropped redundant platform driver/device creation in f_uac2 driver (as well as didn't add "never implemented" volume/mute functionality in f_uac1_legacy to f_uac1) that made this work even easier to do. This series is tested with both legacy g_audio.ko and modern configfs approaches under Ubuntu 14.04 (UAC1 and UAC2) and under Windows7 x64 (UAC1 only) having perfect results in all cases. Comments, testing are welcome. v5 changes: - after discussion with Felipe, switched to another approach with making current f_uac1 legacy and introducing a new f_uac1.c instead - addressed Jassi's copyright comments v4 changes: - renamed f_uac1_newapi to f_uac1_acard that is more meaningful - rebased on top of balbi/next v3 changes: - renamed u_audio exported symbols so they don't conflict with old f_uac1 if both are built-in. v2 changes: - do not touch f_uac1, instead created f_uac1_newapi - added documentation for f_uac1_newapi - rebased on top of v4.8-rc1 [1] https://lkml.org/lkml/2016/5/23/649 Ruslan Bilovol (4): usb: gadget: f_uac2: remove platform driver/device creation usb: gadget: f_uac2: split out audio core usb: gadget: function: make current f_uac1 implementation legacy usb: gadget: add f_uac1 variant based on a new u_audio api Documentation/ABI/testing/configfs-usb-gadget-uac1 | 18 +- .../ABI/testing/configfs-usb-gadget-uac1_legacy| 12 + Documentation/usb/gadget-testing.txt | 53 +- drivers/usb/gadget/Kconfig | 29 +- drivers/usb/gadget/function/Makefile |5 +- drivers/usb/gadget/function/f_uac1.c | 906 +++-- drivers/usb/gadget/function/f_uac1_legacy.c| 1021 drivers/usb/gadget/function/f_uac2.c | 795 ++- drivers/usb/gadget/function/u_audio.c | 662 + drivers/usb/gadget/function/u_audio.h | 95 ++ drivers/usb/gadget/function/u_uac1.h | 87 +- .../gadget/function/{u_uac1.c => u_uac1_legacy.c} |7 +- drivers/usb/gadget/function/u_uac1_legacy.h| 82 ++ drivers/usb/gadget/legacy/Kconfig | 15 +- drivers/usb/gadget/legacy/audio.c | 55 +- 15 files changed, 2494 insertions(+), 1348 deletions(-) create mode 100644 Documentation/ABI/testing/configfs-usb-gadget-uac1_legacy create mode 100644 drivers/usb/gadget/function/f_uac1_legacy.c create mode 100644 drivers/usb/gadget/function/u_audio.c create mode 100644 drivers/usb/gadget/function/u_audio.h rename drivers/usb/gadget/function/{u_uac1.c => u_uac1_legacy.c} (98%) create mode 100644 drivers/usb/gadget/function/u_uac1_legacy.h -- 1.9.1 -- To unsubscribe from this list: send the l
Re: [PATCH] dt-bindings: usb: exynos-usb: Add missing required VDD properties
On Tue, Jun 13, 2017 at 06:29:25PM +0200, Krzysztof Kozlowski wrote: > Since commit bd8ce544ec35 ("usb: dwc3: exynos: Make provision for vdd > regulators") vdd33-supply and vdd10-supply are required so document them > in bindings. > > Signed-off-by: Krzysztof Kozlowski > --- > Documentation/devicetree/bindings/usb/exynos-usb.txt | 4 > 1 file changed, 4 insertions(+) Applied. Rob -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v15 2/7] power: add power sequence library
On Thu, Jun 15, 2017 at 06:06:04PM +0800, Peter Chen wrote: > On Thu, Jun 15, 2017 at 11:35:20AM +0200, Ulf Hansson wrote: > > On 15 June 2017 at 11:11, Peter Chen wrote: > > > On Thu, Jun 15, 2017 at 10:11:45AM +0200, Ulf Hansson wrote: > > >> > Yes, you are right. This is the limitation for this power sequence > > >> > library, the registration for the 1st power sequence instance must > > >> > be finished before device driver uses it. I am appreciated that > > >> > you can supply some suggestions for it. > > >> > > >> In general this kind of problems is solved by first parsing the DTB, > > >> which means you will find out whether there is a resource (a pwrseq) > > >> required for the device. Then you try to fetch that resource, and if > > >> that fails, it means the resource is not yet available, and hence you > > >> want to retry later and should return -EPROBE_DEFER. > > >> > > >> In this case, of_pwrseq_on() needs to be converted to start looking > > >> for a pwrseq compatible in it's child node - I guess. Then if that is > > >> found, you try to fetch the instance of the corresponding library. > > >> Failing to fetch the library instance should then cause a return > > >> -EPROBE_DEFER. > > > > > > The most difficulty for this is we can't know whether the requested > > > pwrseq instance will be registered or not, the kernel configuration > > > for this pwrseq library may not be chosen at all. > > > > In such case it is still correct to return -EPROBE_DEFER, because the > > driver that tries to probe its device will fail unless it can run the > > needed pwrseq. Right? > > > > Unlike the MMC design, there is no dts entry to indicate whether this > device needs pwrseq or not at this design, it will only carry out power > on sequence after matching. So, return -EPROBE_DEFER may not work since > this device may never need pwrseq. > Ulf, since it is the use case limitation, it can't work like device driver. Do you have more comments for it, thanks. Peter > > > > > >> > > >> > > > >> >> Moreover, I have found yet another severe problem but reviewing the > > >> >> code: > > >> >> In the struct pwrseq, you have a "bool used", which you are setting to > > >> >> "true" once the pwrseq has been hooked up with the device, when a > > >> >> driver calls of_pwrseq_on(). Setting that variable to true, will also > > >> >> prevent another driver from using the same instance of the pwrseq for > > >> >> its device. So, to cope with multiple users, you register a new > > >> >> instance of the same pwrseq library that got hooked up, once the > > >> >> ->get() callback is about to complete. > > >> >> > > >> >> The problem the occurs, when there is another driver calling > > >> >> of_pwrseq_on() in between, meaning that the new instance has not yet > > >> >> been registered. This will simply fail, won't it? > > >> > > > >> > Yes, you are right, thanks for pointing that, I will add mutex_lock for > > >> > of_pwrseq_on. > > >> > > >> Another option is to entirely skip to two step approach. > > >> > > >> In other words, make the library to cope with multiple users via the > > >> same registered library instance. > > >> > > > > > > No, the pwrseq instance stores dtb information (clock, gpio, etc), it > > > needs to be per device. > > > > I think you misunderstood my suggestion here. Of course you need to > > allocate one pwrseq data per device. > > > > However, my point is that you shouldn't need more than one instance of > > the library functions to be registered in the list of available pwrseq > > libraries. > > > > This additional instance is used to store compatible information for > this pwrseq library, it is used for the next matching between device > and pwrseq library, it just likes we need the first pwrseq instance > registered at boot stage. > > -- > > Best Regards, > Peter Chen > > ___ > linux-arm-kernel mailing list > linux-arm-ker...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: host: ehci: workaround PME bug on AMD EHCI controller
On Sat, Jun 17, 2017 at 1:30 AM, Alan Stern wrote: > On Sat, 17 Jun 2017, Kai-Heng Feng wrote: > >> On Fri, Jun 16, 2017 at 11:07 AM, Kai-Heng Feng >> wrote: >> > On Thu, Jun 15, 2017 at 10:12 PM, Alan Stern >> > wrote: >> >> Those documents refer to a hardware bug with a workaround in the BIOS. >> >> Have you checked to see if your BIOS is up to date? >> > >> > Yes, it's up to date. >> > >> >> Alan, I re-sent a patch but I forgot to add you to CC list: >> http://marc.info/?l=linux-pci&m=149760607914628&w=2 > > Thanks for letting me know. The patch seems reasonable. > > Have you tested it with system suspend? That is, if you suspend the > whole computer, does plugging or unplugging a USB device cause the > system to wake up? No, the system will not wake up when plugging or unplugging. Tried several times, nether runtime PM enabled nor runtime PM disabled will wake up the system under S3, when (un)plugging USB devices. > > Alan Stern > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3] usb: xhci: Issue stop EP command only when the EP state is running
on AMD platforms with SNPS 3.1 USB controller if stop endpoint command is issued the controller does not respond, when the EP is not in running state. HW completes the command execution and reports "Context State Error" completion code. This is as per the spec. However HW on receiving the second command additionally marks EP to Flow control state in HW which is RTL bug. This bug causes the HW not to respond to any further doorbells that are rung by the driver. This makes the EP to not functional anymore and causes gross functional failures. As a workaround, not to hit this problem, its better we check the EP state and issue the stop EP command only when the EP is in running state. Also, with the inclusion of this patch, there maybe a possible race condition that may get triggered as mentioned in the xHCI spec 4.6.9 Signed-off-by: Shyam Sundar S K Signed-off-by: Nehal Shah --- drivers/usb/host/xhci-hub.c | 30 +- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 0dde49c..d39b1e0 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -398,17 +398,29 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) spin_lock_irqsave(&xhci->lock, flags); for (i = LAST_EP_INDEX; i > 0; i--) { if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) { - struct xhci_command *command; - command = xhci_alloc_command(xhci, false, false, -GFP_NOWAIT); - if (!command) { - spin_unlock_irqrestore(&xhci->lock, flags); - xhci_free_command(xhci, cmd); - return -ENOMEM; + /* Check endpoint is running before stopping it, +* AMD SNPS 3.1 xHC may misbehave otherwise +*/ + + struct xhci_ep_ctx *ep_ctx; + + ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->out_ctx, i); + + if (GET_EP_CTX_STATE(ep_ctx) == EP_STATE_RUNNING) { + struct xhci_command *command; + + command = xhci_alloc_command(xhci, false, false, +GFP_NOWAIT); + if (!command) { + spin_unlock_irqrestore(&xhci->lock, + flags); + xhci_free_command(xhci, cmd); + return -ENOMEM; + } + xhci_queue_stop_endpoint(xhci, command, +slot_id, i, suspend); } - xhci_queue_stop_endpoint(xhci, command, slot_id, i, -suspend); } } xhci_queue_stop_endpoint(xhci, cmd, slot_id, 0, suspend); -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PULL] USB changes for v4.13 merge window
Hi Greg, here's my pull request for the current merge window. Patches have been in linux-next for a while and there's time for them to soak a little more. Note that you're gonna get a conflict when merging this on f_mass_storage, you should use the version coming from my tree which was authored by Alan Stern. Let me know if you need further details on this. Also, let me know if you want anything to be changed from the pull request. Cheers The following changes since commit 2ea659a9ef488125eb46da6eb571de5eae5c43f6: Linux 4.12-rc1 (2017-05-13 13:19:49 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/usb-for-v4.13 for you to fetch changes up to 0591bc2360152f851e29246884805bb77a2c3b9d: usb: gadget: add f_uac1 variant based on a new u_audio api (2017-06-19 09:22:47 +0300) usb: changes for v4.13 merge window This time around we have a total of 57 non-merge commits. A list of most important changes follows: - Improvements to dwc3 tracing interface - Initial dual-role support for dwc3 - Improvements to how we handle DMA resources in dwc3 - A new f_uac1 implementation which much more flexible - Removal of AVR32 bits - Improvements to f_mass_storage driver Alan Stern (2): USB: f_mass_storage: improve async notification handling USB: f_mass_storage: improve memory barriers and synchronization Alexandre Belloni (1): usb: gadget: udc: atmel: Remove unnecessary macros Andy Shevchenko (2): usb: gadget: udc: atmel: Remove AVR32 bits from the driver usb: dwc3: gadget: increase readability of dwc3_gadget_init_endpoints() Arvind Yadav (3): usb: mtu3: Handle return value of clk_prepare_enable usb: gadget: mv_udc: Handle return value of clk_prepare_enable. usb: dwc3: exynos: Handle return value of clk_prepare_enable Baolin Wang (3): usb: phy: Introduce one extcon device into usb phy usb: phy: phy-qcom-8x16-usb: Remove redundant extcon register/unregister usb: phy: phy-msm-usb: Remove redundant extcon register/unregister Dan Carpenter (1): usb: gadget: udc-xilinx: clean up a variable name Felipe Balbi (21): usb: dwc3: gadget: don't WARN about lack of TRBs usb: dwc3: gadget: lazily map requests for DMA usb: dwc3: replace %p with %pK tools: usb: testusb: update default vary for superspeed usb: dwc3: update documentation usb: dwc3: debugfs: slightly improve output of trb_ring usb: dwc3: gadget: slight cleanup to dwc3_process_event_entry() usb: dwc3: trace: rely on __string() and __assign_str() usb: dwc3: debug: remove static char buffer from dwc3_decode_event() usb: dwc3: trace: decode ctrl request usb: dwc3: add ReST documentation usb: move ReST documentation to Documentation/driver-api/usb/ usb: gadget: core: introduce ->udc_set_speed() method usb: dwc3: gadget: implement ->udc_set_speed() usb: gadget: dummy: implement ->udc_set_speed() usb: gadget: udc: add a 'function' sysfs file Documentation: ABI: sysfs-class-udc: remove duplicated entry usb: dwc3: ep0: make sure wValue is 0 on GetStatus() usb: dwc3: ulpi: conditionally resume ULPI PHY usb: dwc3: core: initialize ULPI before trying to get the PHY usb: dwc3: core: program PHY for proper DRD modes Gustavo A. R. Silva (1): usb: gadget: udc: add null check before pointer dereference Jerry Zhang (2): usb: gadget: function: f_fs: Let ffs_epfile_ioctl wait for enable. usb: gadget: function: f_fs: Move epfile waitqueue to ffs_data. John Youn (2): usb: gadget: composite: Exclude SS Dev Cap Desc usb: gadget: Allow a non-SuperSpeed gadget to support LPM Li Jun (1): usb: gadget: mass_storage: set msg_registered after msg registered Mauro Carvalho Chehab (1): usb: fix the comment with regards to DocBook Raviteja Garimella (5): usb: gadget: udc: Rename amd5536udc driver file based on IP usb: gadget: udc: make debug prints compatible with both pci and platform devices usb: gadget: udc: Provide correct arguments for 'dma_pool_create' dt-bindings: usb: DT bindings documentation for Broadcom IPROC USB Device controller. usb: gadget: udc: Add Synopsys UDC Platform driver Ruslan Bilovol (5): usb: gadget: function: f_uac1: implement get_alt() usb: gadget: f_uac2: remove platform driver/device creation usb: gadget: f_uac2: split out audio core usb: gadget: function: make current f_uac1 implementation legacy usb: gadget: add f_uac1 variant based on a new u_audio api Sekhar Nori (1): usb: gadget: f_uac2: calculate wMaxPacketSize before endpoint match Srinath Mannam (1): usb: gadget: bdc: 64-bit pointer capability check Stefan Agner (3): usb: gadget: remove