Raspberry PiのLinux KernelでMedia Controller APIを無効にする

環境

Raspberry Pi 4B
Raspberry Pi OS
Linux raspberrypi 5.15.84-v8+ #1613 SMP PREEMPT Thu Jan 5 12:03:08 GMT 2023 aarch64 GNU/Linux
OV5647モジュールを接続済み

問題

/dev/video0 に設定されているイメージセンサーを確認するためにv4l2-ctlやqv4l2を使っても思い通りの動作をしなかった
例:

$ v4l2-ctl -d /dev/video0 --list-ctrls
*何も出力されない*

$ v4l2-ctl -d 0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'YUYV' (YUYV 4:2:2)
                Size: Stepwise 16x16 - 16376x16376 with step 1/1
        [1]: 'UYVY' (UYVY 4:2:2)
                Size: Stepwise 16x16 - 16376x16376 with step 1/1
... 
*なんか違いそうなのが出力されてる*

config.txt 変更

Media Controller APIがデフォルトで有効になっているので無効にする
/boot/config.txt 内の [pi4] の [all] 欄に以下を追加

[all]
camera_auto_detect=0
dtoverlay=ov5647,media-controller=0

config.txt 変更後

v4l2-ctl

$ v4l2-ctl -d /dev/video0 --list-ctrls

User Controls

        white_balance_automatic 0x0098090c (bool)   : default=0 value=0
                       exposure 0x00980911 (int)    : min=4 max=500 step=1 default=500 value=500
                 gain_automatic 0x00980912 (bool)   : default=0 value=0
                horizontal_flip 0x00980914 (bool)   : default=0 value=0 flags=modify-layout
                  vertical_flip 0x00980915 (bool)   : default=0 value=0 flags=modify-layout

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=1 default=1 value=1
...


$ v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'pGAA' (10-bit Bayer GBGB/RGRG Packed)
                Size: Discrete 2592x1944
                Size: Discrete 1920x1080
                Size: Discrete 1296x972
                Size: Discrete 640x480
        [1]: 'GB10' (10-bit Bayer GBGB/RGRG)
                Size: Discrete 2592x1944
                Size: Discrete 1920x1080
                Size: Discrete 1296x972
                Size: Discrete 640x480

...なんでかGBRGとして認識されてる
OV5647はBGGR配列

qv4l2

次?

media-ctl操作してMedia Controller API経由のキャプチャ(できたらいいな...)

参考

raspbian - libcamera stack does not work with Bullseye - Raspberry Pi Stack Exchange
linux/README at rpi-5.15.y · raspberrypi/linux · GitHub
https://manpages.debian.org/stretch/v4l-utils/v4l2-ctl.1