Skip to content

media: tuner large grain locking

Shuah Khan linux-media 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4drivers/base: add managed token dev resourcedrivers/base/Makefile drivers/base/token_devres.c include/linux/token_devres.h+154 -11 reply
2/4media: dvb-fe changes to use tuner tokendrivers/media/dvb-core/dvb_frontend.c drivers/media/dvb-core/dvb_frontend.h+22 -00 replies
3/4media: v4l2-core changes to use tuner tokendrivers/media/v4l2-core/v4l2-dev.c include/media/v4l2-dev.h+23 -11 reply
4/4media: au0828 changes to use token devres for tuner accessdrivers/media/usb/au0828/au0828-core.c drivers/media/usb/au0828/au0828-dvb.c drivers/media/usb/au0828/au0828-video.c +1 more+51 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] media: tuner large grain locking

Add a managed token resource that can be created at device level which can be used as a large grain lock by diverse group of drivers such as the media drivers that share a resource.

Token resource manages a unique named string resource which is derived from common bus_name, and hardware address fields from the struct device.

au0828 is changed to use token devres as a large locking for exclusive access to tuner function. A new tuner_tkn field is added to struct au0828_dev. Tuner token is created from au0828 probe() and destroyed from disconnect().

Two new routines au0828_create_token_resources() and au0828_destroy_token_resources() create and destroy the tuner token.

au0828-dvb exports the tuner token to dvb-frontend when it registers the digital frontend using the tuner_tkn field in struct dvb_frontend.

au0828-video exports the tuner token to v4l2-core when it registers the analog function using tuner_tkn field in struct video_device.

Before this change:

- digital tv app disrupts an active analog app when it tries to use the tuner
e.g: tvtime analog video stream stops when kaffeine starts
- analog tv app disrupts another analog app when it tries to use the tuner
e.g: tvtime audio glitches when xawtv starts and vice versa.
- analog tv app disrupts an active digital app when it tries to use the tuner
e.g: kaffeine digital stream stops when tvtime starts
- digital tv app disrupts another digital tv app when it tries to use the tuner
e.g: kaffeine digital stream stops when vlc starts and vice versa

After this change:
- digital tv app detects tuner is busy without disrupting the active app.
- analog tv app detects tuner is busy without disrupting the active analog app.
- analog tv app detects tuner is busy without disrupting the active digital app.
- digital tv app detects tuner is busy without disrupting the active digital app.

Requesting feedback on any use-cases I missed and overall approach to solving the contention between media functions.

Shuah Khan (4):
drivers/base: add managed token dev resource
media: dvb-fe changes to use tuner token
media: v4l2-core changes to use tuner token
media: au0828 changes to use token devres for tuner access

 drivers/base/Makefile                   |    2 +-
 drivers/base/token_devres.c             |  134 +++++++++++++++++++++++++++++++
 drivers/media/dvb-core/dvb_frontend.c   |   21 +++++
 drivers/media/dvb-core/dvb_frontend.h   |    1 +
 drivers/media/usb/au0828/au0828-core.c  |   42 ++++++++++
 drivers/media/usb/au0828/au0828-dvb.c   |    1 +
 drivers/media/usb/au0828/au0828-video.c |    4 +
 drivers/media/usb/au0828/au0828.h       |    4 +
 drivers/media/v4l2-core/v4l2-dev.c      |   23 +++++-
 include/linux/token_devres.h            |   19 +++++
 include/media/v4l2-dev.h                |    1 +
 11 files changed, 250 insertions(+), 2 deletions(-)
 create mode 100644 drivers/base/token_devres.c
 create mode 100644 include/linux/token_devres.h
Signature · 1 line
1.7.10.4