xref: /openbmc/linux/Documentation/userspace-api/media/mediactl/media-controller-intro.rst (revision cbecf716ca618fd44feda6bd9a64a8179d031fc5)
1*059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
254f38fcaSMauro Carvalho Chehab
354f38fcaSMauro Carvalho Chehab.. _media-controller-intro:
454f38fcaSMauro Carvalho Chehab
554f38fcaSMauro Carvalho ChehabIntroduction
654f38fcaSMauro Carvalho Chehab============
754f38fcaSMauro Carvalho Chehab
854f38fcaSMauro Carvalho ChehabMedia devices increasingly handle multiple related functions. Many USB
954f38fcaSMauro Carvalho Chehabcameras include microphones, video capture hardware can also output
1054f38fcaSMauro Carvalho Chehabvideo, or SoC camera interfaces also perform memory-to-memory operations
1154f38fcaSMauro Carvalho Chehabsimilar to video codecs.
1254f38fcaSMauro Carvalho Chehab
1354f38fcaSMauro Carvalho ChehabIndependent functions, even when implemented in the same hardware, can
1454f38fcaSMauro Carvalho Chehabbe modelled as separate devices. A USB camera with a microphone will be
1554f38fcaSMauro Carvalho Chehabpresented to userspace applications as V4L2 and ALSA capture devices.
1654f38fcaSMauro Carvalho ChehabThe devices' relationships (when using a webcam, end-users shouldn't
1754f38fcaSMauro Carvalho Chehabhave to manually select the associated USB microphone), while not made
1854f38fcaSMauro Carvalho Chehabavailable directly to applications by the drivers, can usually be
1954f38fcaSMauro Carvalho Chehabretrieved from sysfs.
2054f38fcaSMauro Carvalho Chehab
2154f38fcaSMauro Carvalho ChehabWith more and more advanced SoC devices being introduced, the current
2254f38fcaSMauro Carvalho Chehabapproach will not scale. Device topologies are getting increasingly
2354f38fcaSMauro Carvalho Chehabcomplex and can't always be represented by a tree structure. Hardware
2454f38fcaSMauro Carvalho Chehabblocks are shared between different functions, creating dependencies
2554f38fcaSMauro Carvalho Chehabbetween seemingly unrelated devices.
2654f38fcaSMauro Carvalho Chehab
2754f38fcaSMauro Carvalho ChehabKernel abstraction APIs such as V4L2 and ALSA provide means for
2854f38fcaSMauro Carvalho Chehabapplications to access hardware parameters. As newer hardware expose an
2954f38fcaSMauro Carvalho Chehabincreasingly high number of those parameters, drivers need to guess what
3054f38fcaSMauro Carvalho Chehabapplications really require based on limited information, thereby
3154f38fcaSMauro Carvalho Chehabimplementing policies that belong to userspace.
3254f38fcaSMauro Carvalho Chehab
3354f38fcaSMauro Carvalho ChehabThe media controller API aims at solving those problems.
34