moby: enable camera flash (for use as a torch)
This commit is contained in:
@@ -36,7 +36,7 @@ in
|
||||
"pine64-alsa-ucm" # upstreaming: https://github.com/alsa-project/alsa-ucm-conf/pull/375
|
||||
];
|
||||
|
||||
# sane.programs.nwg-panel.config.torch = "white:flash"; #< TODO: enable the flashlight/torch
|
||||
sane.programs.nwg-panel.config.torch = "white:flash";
|
||||
sane.programs.swaynotificationcenter.config = {
|
||||
backlight = "backlight"; # /sys/class/backlight/*backlight*/brightness
|
||||
};
|
||||
@@ -44,6 +44,18 @@ in
|
||||
# else it'll change to something which produces no sound (like the "Voice Call" use case)
|
||||
# sane.programs.callaudiod.enableFor.user.colin = lib.mkForce false;
|
||||
|
||||
services.udev.extraRules = let
|
||||
chmod = lib.getExe' pkgs.coreutils "chmod";
|
||||
chown = lib.getExe' pkgs.coreutils "chown";
|
||||
in ''
|
||||
# make flashlight/torch writable by user.
|
||||
# taken from postmarketOS: <repo:postmarketOS/pmaports:device/main/device-pine64-pinephone/60-flashlight.rules>
|
||||
SUBSYSTEM=="leds", DEVPATH=="*/*:flash", RUN+="${chmod} g+w /sys%p/brightness /sys%p/flash_strobe", RUN+="${chown} :video /sys%p/brightness /sys%p/flash_strobe"
|
||||
|
||||
# make the front led (and all leds) user-writable (because why not)
|
||||
SUBSYSTEM=="leds", DEVPATH=="*/*", RUN+="${chmod} g+w /sys%p/brightness /sys%p/flash_strobe", RUN+="${chown} :video /sys%p/brightness"
|
||||
'';
|
||||
|
||||
boot.kernelPatches = [
|
||||
{
|
||||
# TODO: upstream into nixpkgs. <repo:nixos/nixpkgs:pkgs/os-specific/linux/kernel/common-config.nix>
|
||||
@@ -68,18 +80,22 @@ in
|
||||
name = "rk3399-pinephone-pro-battery";
|
||||
dtsFile = ./rk3399-pinephone-pro-battery.dtso;
|
||||
}
|
||||
{
|
||||
name = "rk3399-pinephone-pro-flash-led";
|
||||
dtsFile = ./rk3399-pinephone-pro-flash-led.dtso;
|
||||
}
|
||||
{
|
||||
name = "rk3399-pinephone-pro-lradc-fix";
|
||||
dtsFile = ./rk3399-pinephone-pro-lradc-fix.dtso;
|
||||
}
|
||||
{
|
||||
name = "rk3399-pinephone-pro-sound";
|
||||
dtsFile = ./rk3399-pinephone-pro-sound.dtso;
|
||||
}
|
||||
{
|
||||
name = "rk3399-pinephone-pro-modem";
|
||||
dtsFile = ./rk3399-pinephone-pro-modem.dtso;
|
||||
}
|
||||
{
|
||||
name = "rk3399-pinephone-pro-sound";
|
||||
dtsFile = ./rk3399-pinephone-pro-sound.dtso;
|
||||
}
|
||||
];
|
||||
|
||||
# this seems to not actually be necessary (unless maybe my *overlay* #include's stuff)
|
||||
|
@@ -0,0 +1,43 @@
|
||||
// for LED_FUNCTION_FLASH, etc
|
||||
#include <dt-bindings/leds/common.h>
|
||||
// for RK_PC6, other pins
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
// for GPIO_ACTIVE_HIGH
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
/* ensure this overlay applies only to the correct board */
|
||||
compatible = "pine64,pinephone-pro";
|
||||
};
|
||||
|
||||
// taken from pine64-org/rk3399-pinephone-pro.dts, did not validate against schematic.
|
||||
// subset of 41742e56f5: "arm64: dts: pinephone-pro: Add camera support"
|
||||
&{/} {
|
||||
sgm3140: led-controller {
|
||||
compatible = "sgmicro,sgm3140";
|
||||
vin-supply = <&vcc3v3_sys>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&flash_pins>;
|
||||
enable-gpios = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>;
|
||||
flash-gpios = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
|
||||
|
||||
sgm3140_flash: led {
|
||||
function = LED_FUNCTION_FLASH;
|
||||
color = <LED_COLOR_ID_WHITE>;
|
||||
flash-max-timeout-us = <250000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
leds {
|
||||
flash_pins: flash-pins {
|
||||
rockchip,pins =
|
||||
<1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>,
|
||||
<4 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user