linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v9 0/4] Media Device Allocator API
@ 2018-12-18 17:59 shuah
  2018-12-18 17:59 ` [PATCH v9 1/4] media: " shuah
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: shuah @ 2018-12-18 17:59 UTC (permalink / raw)
  To: mchehab, perex, tiwai, hverkuil
  Cc: Shuah Khan, linux-media, linux-kernel, alsa-devel

From: Shuah Khan <shuah@kernel.org>

Media Device Allocator API to allows multiple drivers share a media device.
This API solves a very common use-case for media devices where one physical
device (an USB stick) provides both audio and video. When such media device
exposes a standard USB Audio class, a proprietary Video class, two or more
independent drivers will share a single physical USB bridge. In such cases,
it is necessary to coordinate access to the shared resource.

Using this API, drivers can allocate a media device with the shared struct
device as the key. Once the media device is allocated by a driver, other
drivers can get a reference to it. The media device is released when all
the references are released.

- Tested sharing resources with kaffeine, vlc, xawtv, tvtime, and
  arecord. When analog is streaming, digital and audio user-space
  applications detect that the tuner is busy and exit. When digital
  is streaming, analog and audio applications detect that the tuner is
  busy and exit. When arecord is owns the tuner, digital and analog
  detect that the tuner is busy and exit.
- Tested media device allocator API with bind/unbind testing on
  snd-usb-audio and au0828 drivers to make sure /dev/mediaX is released
  only when the last driver is unbound.
- This patch series is tested on 4.20-rc6
- Addressed review comments from Hans on the RFC v8 (rebased on 4.19)
- Updated change log to describe the use-case more clearly.
- No changes to 0001,0002 code since the v7 referenced below.
- 0003 is a new patch to enable ALSA defines that have been
  disabled for kernel between 4.9 and 4.19.
- Minor merge conflict resolution in 0004.
- Added SPDX to new files.

References:
https://lkml.org/lkml/2018/11/2/169
https://www.mail-archive.com/linux-media@vger.kernel.org/msg105854.html

Shuah Khan (4):
  media: Media Device Allocator API
  media: change au0828 to use Media Device Allocator API
  media: media.h: Enable ALSA MEDIA_INTF_T* interface types
  sound/usb: Use Media Controller API to share media resources

 Documentation/media/kapi/mc-core.rst   |  41 ++++
 drivers/media/Makefile                 |   4 +
 drivers/media/media-dev-allocator.c    | 132 ++++++++++
 drivers/media/usb/au0828/au0828-core.c |  12 +-
 drivers/media/usb/au0828/au0828.h      |   1 +
 include/media/media-dev-allocator.h    |  53 ++++
 include/uapi/linux/media.h             |  25 +-
 sound/usb/Kconfig                      |   4 +
 sound/usb/Makefile                     |   2 +
 sound/usb/card.c                       |  14 ++
 sound/usb/card.h                       |   3 +
 sound/usb/media.c                      | 321 +++++++++++++++++++++++++
 sound/usb/media.h                      |  74 ++++++
 sound/usb/mixer.h                      |   3 +
 sound/usb/pcm.c                        |  29 ++-
 sound/usb/quirks-table.h               |   1 +
 sound/usb/stream.c                     |   2 +
 sound/usb/usbaudio.h                   |   6 +
 18 files changed, 705 insertions(+), 22 deletions(-)
 create mode 100644 drivers/media/media-dev-allocator.c
 create mode 100644 include/media/media-dev-allocator.h
 create mode 100644 sound/usb/media.c
 create mode 100644 sound/usb/media.h

-- 
2.17.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-01-24  7:30 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18 17:59 [PATCH v9 0/4] Media Device Allocator API shuah
2018-12-18 17:59 ` [PATCH v9 1/4] media: " shuah
2018-12-18 17:59 ` [PATCH v9 2/4] media: change au0828 to use " shuah
2018-12-18 17:59 ` [PATCH v9 3/4] media: media.h: Enable ALSA MEDIA_INTF_T* interface types shuah
2018-12-18 17:59 ` [PATCH v9 4/4] sound/usb: Use Media Controller API to share media resources shuah
2018-12-19 13:51   ` [alsa-devel] " Takashi Iwai
2019-01-11 14:57     ` shuah
2019-01-11 14:59       ` Hans Verkuil
2019-01-11 15:04         ` shuah
2019-01-18  8:36   ` Hans Verkuil
2019-01-18 21:54     ` shuah
2019-01-19  1:03       ` shuah
2019-01-19 10:30         ` Hans Verkuil
2019-01-20 19:32           ` shuah
2019-01-21 14:46 ` [PATCH v9 0/4] Media Device Allocator API Hans Verkuil
2019-01-24  1:35   ` shuah
2019-01-24  7:30     ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).