linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] media: vimc: use configfs in order to configure devices topologies
@ 2019-09-19 20:32 Dafna Hirschfeld
  2019-09-19 20:32 ` [PATCH 1/5] media: vimc: upon streaming, check that the pipeline starts with a source entity Dafna Hirschfeld
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Dafna Hirschfeld @ 2019-09-19 20:32 UTC (permalink / raw)
  To: linux-media
  Cc: dafna.hirschfeld, laurent.pinchart, helen.koike, ezequiel,
	andre.almeida, skhan, hverkuil, kernel, dafna3

This patchset introduces the usage of configfs in order to create vimc devices
with a configured topology. A patch introducing configfs usage was already sent by Helen Koike:
https://patchwork.linuxtv.org/patch/53397/ . The current patch is based on her patch but
suggests a new API for using configfs.
It uses symlinks to represent a link between two entities, an approach already used in the kernel
by usb gadgets composed with configfs to associate usb gadget's functions to its configurations.
For example, a topology of sensor->capture will be created with the following commands:

CONFIGFS_ROOT=/sys/kernel/config

mkdir ${CONFIGFS_ROOT}/vimc/mdev/
mkdir ${CONFIGFS_ROOT}/vimc/mdev/vimc-sensor:sen
mkdir ${CONFIGFS_ROOT}/vimc/mdev/vimc-capture:cap
tree ${CONFIGFS_ROOT}
/configfs/
`-- vimc
    `-- mdev
        |-- hotplug
        |-- vimc-capture:cap
        |   `-- pad:sink:0
        `-- vimc-sensor:sen
            `-- pad:source:0

mkdir ${CONFIGFS_ROOT}/vimc/mdev/vimc-sensor:sen/pad:source:0/to-cap
ln -s ${CONFIGFS_ROOT}/vimc/mdev/vimc-capture:cap/pad:sink:0 ${CONFIGFS_ROOT}/vimc/mdev/vimc-sensor:sen/pad:source:0/to-cap
tree ${CONFIGFS_ROOT}
/configfs/
`-- vimc
    `-- mdev
        |-- hotplug
        |-- vimc-capture:cap
        |   `-- pad:sink:0
        `-- vimc-sensor:sen
            `-- pad:source:0
                `-- to-cap
                    |-- enabled
                    |-- immutable
                    `-- pad:sink:0 -> ../../../../../vimc/mdev/vimc-capture:cap/pad:sink:0

There are several reasons to prefer the symlink approach in order to represent links between entities.
The previous approach in which links are represented with directories of the form 'entity1:pad>-><entity2:pad'
requires userspace to parse the dirctories names in order to understand the topology, while in the symlink
approach userspace needs only to traverse the configfs tree.
Also, the usage of symlinks prevents userspace from creating links between entities that don't exist and also
an entity can't be removed if there is a symlink pointing to it or from it, while in the previous approach the
links were created by creating unrelated directories and care had to be taken to ensure consistency. This way
the topology configured from userspace is restricted to always be valid and represent the current topology of
the device. This results in less validation needed in kernel code when plugging the device and less possibility
for mistakes in the userspace side. Last, but not least, using symlinks is the natural way of associating things
in configfs.

This patch is meant to demonstrate the suggested configfs api and get comments and acceptance/disagreement from
the community. It passes few tests that configure basic topology and streams the capture entities.
Here is the tests script: https://gitlab.collabora.com/dafna/scripts/blob/master/configfs/sym-unit-tests-simple-topo.sh
Further versions will go through more extensive debugging.

The patchset is rebased on top of v5 of the patchset 'Collapse vimc into single monolithic driver' sent by Shuah Khan
https://lkml.org/lkml/2019/9/17/656

Patch 1, was sent by me before as a single patch and is needed for the configfs implementation.

Patch 2, documents how to use the new configfs api in order to create and set devices topologies.

Patch 3, only adds the new configfs api code but does not use it yet, so it still creates only the hardcoded device.

Patch 4, removes the hardcoded device topology and creates devices with topologies configured with the configfs.

Patch 5, implements indexing for the bus_info field since now there can be more than one vimc device.

Dafna Hirschfeld (5):
  media: vimc: upon streaming, check that the pipeline starts with a
    source entity
  docs: media: vimc: Documenting vimc topology configuration using
    configfs
  media: vimc: Add the implementation for the configfs api
  media: vimc: use configfs instead of having hardcoded configuration
  media: vimc: Add device index to the bus_info

 Documentation/media/v4l-drivers/vimc.dot    |  28 +-
 Documentation/media/v4l-drivers/vimc.rst    | 240 ++++++-
 drivers/media/platform/vimc/Kconfig         |   9 +-
 drivers/media/platform/vimc/Makefile        |   2 +-
 drivers/media/platform/vimc/vimc-capture.c  |  50 +-
 drivers/media/platform/vimc/vimc-common.h   |  86 ++-
 drivers/media/platform/vimc/vimc-configfs.c | 656 ++++++++++++++++++++
 drivers/media/platform/vimc/vimc-configfs.h |  41 ++
 drivers/media/platform/vimc/vimc-core.c     | 350 +++++------
 drivers/media/platform/vimc/vimc-debayer.c  |  35 +-
 drivers/media/platform/vimc/vimc-scaler.c   |  35 +-
 drivers/media/platform/vimc/vimc-sensor.c   |  33 +-
 drivers/media/platform/vimc/vimc-streamer.c |  39 +-
 13 files changed, 1289 insertions(+), 315 deletions(-)
 create mode 100644 drivers/media/platform/vimc/vimc-configfs.c
 create mode 100644 drivers/media/platform/vimc/vimc-configfs.h

-- 
2.20.1


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

end of thread, other threads:[~2019-11-04 15:28 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-19 20:32 [PATCH 0/5] media: vimc: use configfs in order to configure devices topologies Dafna Hirschfeld
2019-09-19 20:32 ` [PATCH 1/5] media: vimc: upon streaming, check that the pipeline starts with a source entity Dafna Hirschfeld
2019-09-26 14:32   ` Shuah Khan
2019-10-08 13:34     ` Dafna Hirschfeld
2019-09-19 20:32 ` [PATCH 2/5] docs: media: vimc: Documenting vimc topology configuration using configfs Dafna Hirschfeld
2019-09-20 13:39   ` Hans Verkuil
2019-09-23  9:29     ` Dafna Hirschfeld
2019-09-23  9:50       ` Hans Verkuil
2019-09-27  5:56         ` Andrzej Pietrasiewicz
2019-09-26 18:59   ` Shuah Khan
2019-09-19 20:32 ` [PATCH 3/5] media: vimc: Add the implementation for the configfs api Dafna Hirschfeld
2019-09-26 19:25   ` Shuah Khan
2019-11-04 15:28     ` Dafna Hirschfeld
2019-09-27  7:55   ` Andrzej Pietrasiewicz
2019-09-19 20:32 ` [PATCH 4/5] media: vimc: use configfs instead of having hardcoded configuration Dafna Hirschfeld
2019-09-26 19:41   ` Shuah Khan
2019-09-19 20:32 ` [PATCH 5/5] media: vimc: Add device index to the bus_info Dafna Hirschfeld
2019-09-20 13:17 ` [PATCH 0/5] media: vimc: use configfs in order to configure devices topologies Hans Verkuil
2019-09-20 15:07   ` Dafna Hirschfeld
2019-09-20 15:10     ` 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).