2023-04-12 12:48:02 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
|
|
|
|
inherit (lib) mkDefault mkEnableOption mkIf mkOption optional types;
|
|
|
|
|
|
|
|
cfg = config.hardware.ipu6;
|
|
|
|
|
|
|
|
in
|
|
|
|
{
|
|
|
|
|
|
|
|
options.hardware.ipu6 = {
|
|
|
|
|
|
|
|
enable = mkEnableOption (lib.mdDoc "support for Intel IPU6/MIPI cameras");
|
|
|
|
|
|
|
|
platform = mkOption {
|
2024-01-13 08:15:51 +00:00
|
|
|
type = types.enum [ "ipu6" "ipu6ep" "ipu6epmtl" ];
|
2023-04-12 12:48:02 +00:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
Choose the version for your hardware platform.
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
Use `ipu6` for Tiger Lake, `ipu6ep` for Alder Lake or Raptor Lake,
|
|
|
|
and `ipu6epmtl` for Meteor Lake.
|
2023-04-12 12:48:02 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
boot.extraModulePackages = with config.boot.kernelPackages; [
|
|
|
|
ipu6-drivers
|
|
|
|
];
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
hardware.firmware = [ pkgs.ipu6-camera-bins ];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
services.udev.extraRules = ''
|
|
|
|
SUBSYSTEM=="intel-ipu6-psys", MODE="0660", GROUP="video"
|
|
|
|
'';
|
|
|
|
|
|
|
|
services.v4l2-relayd.instances.ipu6 = {
|
|
|
|
enable = mkDefault true;
|
|
|
|
|
|
|
|
cardLabel = mkDefault "Intel MIPI Camera";
|
|
|
|
|
|
|
|
extraPackages = with pkgs.gst_all_1; [ ]
|
|
|
|
++ optional (cfg.platform == "ipu6") icamerasrc-ipu6
|
2024-01-13 08:15:51 +00:00
|
|
|
++ optional (cfg.platform == "ipu6ep") icamerasrc-ipu6ep
|
|
|
|
++ optional (cfg.platform == "ipu6epmtl") icamerasrc-ipu6epmtl;
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
input = {
|
|
|
|
pipeline = "icamerasrc";
|
2024-01-13 08:15:51 +00:00
|
|
|
format = mkIf (cfg.platform != "ipu6") (mkDefault "NV12");
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|