18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci.. _media-controller-intro: 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ciIntroduction 68c2ecf20Sopenharmony_ci============ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ciMedia devices increasingly handle multiple related functions. Many USB 98c2ecf20Sopenharmony_cicameras include microphones, video capture hardware can also output 108c2ecf20Sopenharmony_civideo, or SoC camera interfaces also perform memory-to-memory operations 118c2ecf20Sopenharmony_cisimilar to video codecs. 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciIndependent functions, even when implemented in the same hardware, can 148c2ecf20Sopenharmony_cibe modelled as separate devices. A USB camera with a microphone will be 158c2ecf20Sopenharmony_cipresented to userspace applications as V4L2 and ALSA capture devices. 168c2ecf20Sopenharmony_ciThe devices' relationships (when using a webcam, end-users shouldn't 178c2ecf20Sopenharmony_cihave to manually select the associated USB microphone), while not made 188c2ecf20Sopenharmony_ciavailable directly to applications by the drivers, can usually be 198c2ecf20Sopenharmony_ciretrieved from sysfs. 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ciWith more and more advanced SoC devices being introduced, the current 228c2ecf20Sopenharmony_ciapproach will not scale. Device topologies are getting increasingly 238c2ecf20Sopenharmony_cicomplex and can't always be represented by a tree structure. Hardware 248c2ecf20Sopenharmony_ciblocks are shared between different functions, creating dependencies 258c2ecf20Sopenharmony_cibetween seemingly unrelated devices. 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ciKernel abstraction APIs such as V4L2 and ALSA provide means for 288c2ecf20Sopenharmony_ciapplications to access hardware parameters. As newer hardware expose an 298c2ecf20Sopenharmony_ciincreasingly high number of those parameters, drivers need to guess what 308c2ecf20Sopenharmony_ciapplications really require based on limited information, thereby 318c2ecf20Sopenharmony_ciimplementing policies that belong to userspace. 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciThe media controller API aims at solving those problems. 34