23 Apr, 2019

13 commits

  • Add helper function to parse the DT for the hdmi-phandle property
    and return the corresponding struct device pointer.

    It takes care to avoid increasing the device refcount since all
    we need is the device pointer. This pointer is used in the
    notifier list as a key, but it is never accessed by the CEC driver.

    Signed-off-by: Hans Verkuil
    Reported-by: Wen Yang
    Acked-by: Wen Yang
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • I previously added an RC_CORE dependency here, but missed the corner
    case of CONFIG_VIDEO_SECO_CEC=y with CONFIG_RC_CORE=m, which still
    causes a link error:

    drivers/media/platform/seco-cec/seco-cec.o: In function `secocec_probe':
    seco-cec.c:(.text+0x1b8): undefined reference to `devm_rc_allocate_device'
    seco-cec.c:(.text+0x2e8): undefined reference to `devm_rc_register_device'
    drivers/media/platform/seco-cec/seco-cec.o: In function `secocec_irq_handler':
    seco-cec.c:(.text+0xa2c): undefined reference to `rc_keydown'

    Refine the dependency to disallow building the RC subdriver in this case.
    This is the same logic we apply in other drivers like it.

    Fixes: f27dd0ad6885 ("media: seco-cec: fix RC_CORE dependency")

    Cc: # 5.1
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Arnd Bergmann
     
  • In function ts2020_set_tuner_rf(), local variable "utmp" could
    be uninitialized if function regmap_read() returns -EINVAL.
    However, this value is used in if statement and written to
    the register, which is potentially unsafe.

    Signed-off-by: Yizhuo
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Yizhuo
     
  • Remove .owner field if calls are used which set it automatically
    Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

    Signed-off-by: YueHaibing
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    YueHaibing
     
  • The timestamps in ir-keytable -t output showed that the Xbox DVD
    IR dongle decodes scancodes every 64ms. The last scancode of a
    longer button press is decodes 64ms after the last-but-one which
    indicates the decoder doesn't use a timeout but decodes on the last
    edge of the signal.

    267.042629: lirc protocol(unknown): scancode = 0xace
    267.042665: event type EV_MSC(0x04): scancode = 0xace
    267.042665: event type EV_KEY(0x01) key_down: KEY_1(0x0002)
    267.042665: event type EV_SYN(0x00).
    267.106625: lirc protocol(unknown): scancode = 0xace
    267.106643: event type EV_MSC(0x04): scancode = 0xace
    267.106643: event type EV_SYN(0x00).
    267.170623: lirc protocol(unknown): scancode = 0xace
    267.170638: event type EV_MSC(0x04): scancode = 0xace
    267.170638: event type EV_SYN(0x00).
    267.234621: lirc protocol(unknown): scancode = 0xace
    267.234636: event type EV_MSC(0x04): scancode = 0xace
    267.234636: event type EV_SYN(0x00).
    267.298623: lirc protocol(unknown): scancode = 0xace
    267.298638: event type EV_MSC(0x04): scancode = 0xace
    267.298638: event type EV_SYN(0x00).
    267.543345: event type EV_KEY(0x01) key_down: KEY_1(0x0002)
    267.543345: event type EV_SYN(0x00).
    267.570015: event type EV_KEY(0x01) key_up: KEY_1(0x0002)
    267.570015: event type EV_SYN(0x00).

    Add a protocol with the repeat value and set the timeout in the
    driver to 10ms (to have a bit of headroom for delays) so the Xbox
    DVD remote performs more responsive.

    Signed-off-by: Matthias Reichl
    Acked-by: Benjamin Valentin
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Matthias Reichl
     
  • Later datasheet versions (rev 1.00) clarifies that the FLD register
    should be set after LINKCNT.

    Signed-off-by: Niklas Söderlund
    Reviewed-by: Ulrich Hecht
    Reviewed-by: Kieran Bingham
    Reviewed-by: Laurent Pinchart
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Niklas Söderlund
     
  • Latest information from hardware engineers reveals that H3 ES2 and ES3
    behave differently when working with link speeds bellow 250 Mpbs.
    Add a SoC match for H3 ES2.* and use the correct startup sequence.

    Signed-off-by: Niklas Söderlund
    Reviewed-by: Kieran Bingham
    Reviewed-by: Laurent Pinchart
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Niklas Söderlund
     
  • The latest datasheet (rev 1.50) updates the start procedure for V3M and
    E3. Update the driver to match these changes.

    Signed-off-by: Niklas Söderlund
    Reviewed-by: Ulrich Hecht
    Reviewed-by: Laurent Pinchart
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Niklas Söderlund
     
  • Later versions of the datasheet updates the reset procedure to more
    closely resemble the standby mode. Update the driver to enter and exit
    the standby mode instead of resetting the hardware before and after
    streaming is started and stopped. This replaces the software reset
    (SRST.SRST) control.

    While at it break out the full start and stop procedures from
    rcsi2_s_stream() into the existing helper functions.

    Signed-off-by: Niklas Söderlund
    Reviewed-by: Laurent Pinchart
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Niklas Söderlund
     
  • The resets property will become mandatory to operate the device, list it
    as such. All device tree source files have always included the reset
    property so making it mandatory will not introduce any regressions.

    While at it improve the description for the clocks property.

    Signed-off-by: Niklas Söderlund
    Reviewed-by: Laurent Pinchart
    Reviewed-by: Rob Herring
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Niklas Söderlund
     
  • If VIDIOC_CREATE_BUFS is called with a sizeimage smaller than the
    queue sizeimage, fail with -EINVAL instead of correcting the size
    and continuing without error. This is required by v4l2-compliance.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • v4l2-compliance sets colorimetry on the output queue and then verifies
    that querying colorimetry on the capture queue returns the same
    configuration. For this to work, the encoder must allow setting context
    colorimetry parameters on the output queue.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • The stateful encoder API requires VIDIOC_ENUM_FRAMESIZES to be
    implemented.
    Allow enumeration of supported frame sizes for encoding.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     

22 Apr, 2019

27 commits

  • Return -ENOTTY when userspace tries to call VIDIOC_(TRY_)ENCODER_CMD on
    a decoder instance or VIDIOC_(TRY_)DECODER_CMD on an encoder instance.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • Add min number of buffers for capture (decoder) and output (encoder)
    controls, which are required by the stateful video decoder / encoder
    interface specification.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • The error return value is not written by some firmware codecs, such as
    MPEG-2 decode on CodaHx4. Clear the error return value before starting
    the picture run to avoid misinterpreting unrelated values returned by
    sequence initialization as error return value.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • Since levels are specified in terms of maximum values, there is no
    reason to filter out lower levels than the supported maximum.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • The chosen codec depends on the coded format, which is known as soon as
    the S_FMT call on the coded queue. This allows to use the codec in
    callbacks that may be called before start_streaming, such as buf_queue.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • Calling VIDIOC_DQBUF can release the core serialization lock pointed to
    by vb2_queue->lock if it has to wait for a new buffer to arrive.

    However, if userspace dup()ped the video device filehandle, then it is
    possible to read or call DQBUF from two filehandles at the same time.

    It is also possible to call REQBUFS from one filehandle while the other
    is waiting for a buffer. This will remove all the buffers and reallocate
    new ones. Removing all the buffers isn't the problem here (that's already
    handled correctly by DQBUF), but the reallocating part is: DQBUF isn't
    aware that the buffers have changed.

    This is fixed by setting a flag whenever the lock is released while waiting
    for a buffer to arrive. And checking the flag where needed so we can return
    -EBUSY.

    Signed-off-by: Hans Verkuil
    Reported-by: Syzbot
    Reviewed-by: Tomasz Figa
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • The ctrl_check_input() function is called from pvr2_ctrl_range_check().
    It's supposed to validate user supplied input and return true or false
    depending on whether the input is valid or not. The problem is that
    negative shifts or shifts greater than 31 are undefined in C. In
    practice with GCC they result in shift wrapping so this function returns
    true for some inputs which are not valid and this could result in a
    buffer overflow:

    drivers/media/usb/pvrusb2/pvrusb2-ctrl.c:205 pvr2_ctrl_get_valname()
    warn: uncapped user index 'names[val]'

    The cptr->hdw->input_allowed_mask mask is configured in pvr2_hdw_create()
    and the highest valid bit is BIT(4).

    Fixes: 7fb20fa38caa ("V4L/DVB (7299): pvrusb2: Improve logic which handles input choice availability")

    Signed-off-by: Dan Carpenter
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Dan Carpenter
     
  • Currently, MEDIA_IOC_G_TOPOLOGY ioctl on cedrus fails due to incorrect
    initialization order. Fix that by moving video_register_device() before
    v4l2_m2m_register_media_controller() and while at it, fix error path.

    Reported-by: Jonas Karlman
    Signed-off-by: Jernej Skrabec
    Acked-by: Paul Kocialkowski
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Jernej Skrabec
     
  • syzkaller reported crashes on kfree() called from
    vivid_vid_cap_s_selection(). This looks like a simple typo, as
    dev->bitmap_cap is allocated with vzalloc() throughout the file.

    Fixes: ef834f7836ec0 ("[media] vivid: add the video capture and output
    parts")

    Signed-off-by: Alexander Potapenko
    Reported-by: Syzbot
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Alexander Potapenko
     
  • If a buffer is queued to a request, followed by an attempt to queue
    the same buffer again, then the second qbuf returns an error since
    the buffer is not in the DEQUEUED state anymore.

    However, before it gets to that check it executes the code under the
    'if (!vb->prepared)' condition. This clears previously set data needed
    for request handling, and now querybuf will no longer report that this
    buffer is part of a request.

    Move the state check to before the 'if' and make sure to only do the
    state check when called from QBUF and if V4L2_BUF_FLAG_REQUEST_FD is
    set.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • Update referenced frame buffer's reference count when playing vp9
    content which has show_existing_frame flag, and copy enough buffer
    data to current shown frame.

    Signed-off-by: Maoguang Meng
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Maoguang Meng
     
  • The driver used %d for formatting unsigned values. Use %u instead.

    Signed-off-by: Sakari Ailus
    Reviewed-by: Bingbu Cao
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • Current ImgU driver processes and releases the parameter buffer
    immediately after queued from user. This does not align with other
    image buffers which are grouped in sets and used for the same frame.
    If user queues multiple parameter buffers continuously, only the last
    one will take effect.
    To make consistent buffers usage, this patch changes the parameter
    buffer handling and group parameter buffer with other image buffers
    for each frame.
    Each time driver will queue one more group of buffers when previous
    frame processed and buffers consumed by css.

    Signed-off-by: Tianshu Qiu
    Signed-off-by: Bingbu Cao
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Bingbu Cao
     
  • This V4L2 subdev driver enables STMicroelectronics MIPID02 device.

    Signed-off-by: Mickael Guene
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mickael Guene
     
  • This adds documentation of device tree for MIPID02 CSI-2 to PARALLEL
    bridge.

    Reviewed-by: Rob Herring
    Signed-off-by: Mickael Guene
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mickael Guene
     
  • This patch adds MEDIA_BUS_FMT_BGR888_3X8 used by STM MIPID02 CSI-2 to
    PARALLEL bridge driver when input format is MEDIA_BUS_FMT_BGR888_1X24.

    Signed-off-by: Mickael Guene
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Mickael Guene
     
  • Avoid returning with mutex locked.

    Fixes: fa8cb6444c32 ("[media] ov2659: Don't depend on subdev API")

    Cc: "Lad, Prabhakar"
    Signed-off-by: Akinobu Mita
    Acked-by: Lad, Prabhakar
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Akinobu Mita
     
  • This driver returns an error if unsupported media bus pixel code is
    requested by VIDIOC_SUBDEV_S_FMT.

    But according to Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst,

    Drivers must not return an error solely because the requested format
    doesn't match the device capabilities. They must instead modify the
    format to match what the hardware can provide.

    So select default format code and return success in that case.

    This is detected by v4l2-compliance.

    Cc: "Lad, Prabhakar"
    Signed-off-by: Akinobu Mita
    Acked-by: Lad, Prabhakar
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Akinobu Mita
     
  • Register V4L2 subdevice implemented by the driver to the V4L2
    asynchronous subdevice framework.

    [Sakari Ailus: Remove extra call to v4l2_i2c_subdev_set_name]

    Signed-off-by: Janusz Krzysztofik
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Janusz Krzysztofik
     
  • In preparation for adding asynchronous subdevice support to the driver,
    don't acquire v4l2_clk from the driver .probe() callback as that may
    fail if the clock is provided by a bridge driver which may be not yet
    initialized. Move the v4l2_clk_get() to ov6650_video_probe() helper
    which is going to be converted to v4l2_subdev_internal_ops.registered()
    callback, executed only when the bridge driver is ready.

    Signed-off-by: Janusz Krzysztofik
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Janusz Krzysztofik
     
  • After removal of clock_start() from before soc_camera_init_i2c() in
    soc_camera_probe() by commit 9aea470b399d ("[media] soc-camera: switch
    I2C subdevice drivers to use v4l2-clk") introduced in v3.11, the ov6650
    driver could no longer probe the sensor successfully because its clock
    was no longer turned on in advance. The issue was initially worked
    around by adding that missing clock_start() equivalent to OMAP1 camera
    interface driver - the only user of this sensor - but a propoer fix
    should be rather implemented in the sensor driver code itself.

    Fix the issue by inserting a delay between the clock is turned on and
    the sensor I2C registers are read for the first time.

    Tested on Amstrad Delta with now out of tree but still locally
    maintained omap1_camera host driver.

    Fixes: 9aea470b399d ("[media] soc-camera: switch I2C subdevice drivers to use v4l2-clk")

    Signed-off-by: Janusz Krzysztofik
    Cc: stable@vger.kernel.org
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Janusz Krzysztofik
     
  • If the application was streaming from both videoX and vbiX, and streaming
    from videoX was stopped, then the vbi streaming also stopped.

    The cause being that stop_streaming for video stopped the subdevs as well,
    instead of only doing that if dev->streaming_users reached 0.

    au0828_stop_vbi_streaming was also wrong since it didn't stop the subdevs
    at all when dev->streaming_users reached 0.

    Signed-off-by: Hans Verkuil
    Tested-by: Shuah Khan
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • Fix media_devnode_unregister() to clear devnode->media_dev while holding
    media_devnode_lock. media_devnode_register()'s cdev_add_error handling
    does this correctly.

    Signed-off-by: Shuah Khan
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Shuah Khan
     
  • Fix au0828_analog_stream_enable() to check if device is in the right
    state first. When unbind happens while bind is in progress, usbdev
    pointer could be invalid in au0828_analog_stream_enable() and a call
    to usb_ifnum_to_if() will result in the null pointer dereference.

    This problem is found with the new media_dev_allocator.sh test.

    kernel: [ 590.359623] BUG: unable to handle kernel NULL pointer dereference at 00000000000004e8
    kernel: [ 590.359627] #PF error: [normal kernel read fault]
    kernel: [ 590.359629] PGD 0 P4D 0
    kernel: [ 590.359632] Oops: 0000 [#1] SMP PTI
    kernel: [ 590.359634] CPU: 3 PID: 1458 Comm: v4l_id Not tainted 5.1.0-rc2+ #30
    kernel: [ 590.359636] Hardware name: Dell Inc. OptiPlex 7 90/0HY9JP, BIOS A18 09/24/2013
    kernel: [ 590.359641] RIP: 0010:usb_ifnum_to_if+0x6/0x60
    kernel: [ 590.359643] Code: 5d 41 5e 41 5f 5d c3 48 83 c4
    10 b8 fa ff ff ff 5b 41 5c 41 5d 41 5e 41 5f 5d c3 b8 fa ff ff ff c3 0f 1f 00 6
    6 66 66 66 90 55 8b 97 e8 04 00 00 48 89 e5 48 85 d2 74 41 0f b6 4a 04 84 c
    9 74
    kernel: [ 590.359645] RSP: 0018:ffffad3cc3c1fc00 EFLAGS: 00010246
    kernel: [ 590.359646] RAX: 0000000000000000 RBX: ffff8ded b1f3c000 RCX: 1f377e4500000000
    kernel: [ 590.359648] RDX: ffff8dedfa3a6b50 RSI: 00000000 00000000 RDI: 0000000000000000
    kernel: [ 590.359649] RBP: ffffad3cc3c1fc28 R08: 00000000 8574acc2 R09: ffff8dedfa3a6b50
    kernel: [ 590.359650] R10: 0000000000000001 R11: 00000000 00000000 R12: 0000000000000000
    kernel: [ 590.359652] R13: ffff8dedb1f3f0f0 R14: ffffffff adcf7ec0 R15: 0000000000000000
    kernel: [ 590.359654] FS: 00007f7917198540(0000) GS:ffff 8dee258c0000(0000) knlGS:0000000000000000
    kernel: [ 590.359655] CS: 0010 DS: 0000 ES: 0000 CR0: 00 00000080050033
    kernel: [ 590.359657] CR2: 00000000000004e8 CR3: 00000001 a388e002 CR4: 00000000000606e0
    kernel: [ 590.359658] Call Trace:
    kernel: [ 590.359664] ? au0828_analog_stream_enable+0x2c/0x180
    kernel: [ 590.359666] au0828_v4l2_open+0xa4/0x110
    kernel: [ 590.359670] v4l2_open+0x8b/0x120
    kernel: [ 590.359674] chrdev_open+0xa6/0x1c0
    kernel: [ 590.359676] ? cdev_put.part.3+0x20/0x20
    kernel: [ 590.359678] do_dentry_open+0x1f6/0x360
    kernel: [ 590.359681] vfs_open+0x2f/0x40
    kernel: [ 590.359684] path_openat+0x299/0xc20
    kernel: [ 590.359688] do_filp_open+0x9b/0x110
    kernel: [ 590.359695] ? _raw_spin_unlock+0x27/0x40
    kernel: [ 590.359697] ? __alloc_fd+0xb2/0x160
    kernel: [ 590.359700] do_sys_open+0x1ba/0x260
    kernel: [ 590.359702] ? do_sys_open+0x1ba/0x260
    kernel: [ 590.359712] __x64_sys_openat+0x20/0x30
    kernel: [ 590.359715] do_syscall_64+0x5a/0x120
    kernel: [ 590.359718] entry_SYSCALL_64_after_hwframe+0x44/0xa9

    Signed-off-by: Shuah Khan
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Shuah Khan
     
  • Add a new test for Media Device Allocator API.

    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.

    This test does a series of unbind/bind tests to make sure media device
    is released correctly when it is no longer is use and when the last
    driver releases the reference.

    Signed-off-by: Shuah Khan
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Shuah Khan
     
  • Enable and disable source interfaces aren't consistent in enforcing
    how video and audio share the tuner resource.

    Fix these issues to enforce the following rules and allow
    sharing between audio and video applications.

    - When DVB is streaming, audio/video/vbi/s-video/composite
    should find the resource busy. DVB holds the tuner in
    exclusive mode.
    - When video/VBI is streaming, audio can share the tuner and vice versa.
    - v4l2 allows multiple applications to open video device.
    - Video applications call enable source multiple times during their
    run-time. Resource should stay locked until the last application
    releases it.
    - A shared resource should stay in shared state and locked when it is
    in use by audio and video. More than one video application is allowed
    to use the tuner as long as video streaming protocol allows such usage.
    Resource is released when the last video/audio application releases it.
    - S-Video and Composite hold the resource in exclusive mode.

    Signed-off-by: Shuah Khan
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Shuah Khan
     
  • 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.

    Change the ALSA driver to use the Media Controller API to share media
    resources with DVB, and V4L2 drivers on a AU0828 media device.

    The Media Controller specific initialization is done after sound card is
    registered. ALSA creates Media interface and entity function graph nodes
    for Control, Mixer, PCM Playback, and PCM Capture devices.

    snd_usb_hw_params() will call Media Controller enable source handler
    interface to request the media resource. If resource request is granted,
    it will release it from snd_usb_hw_free(). If resource is busy, -EBUSY is
    returned.

    Media specific cleanup is done in usb_audio_disconnect().

    Reviewed-by: Takashi Iwai
    Signed-off-by: Shuah Khan
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Shuah Khan