simple-ampli-switch, update devicetree module, enable 'ant2', remove audio-patch
This commit is contained in:
parent
dae8cef853
commit
d4e8a63052
@ -1,44 +0,0 @@
|
|||||||
{pkgs, ...}: let
|
|
||||||
rpi-utils = pkgs.callPackage ../raspberry-pi/packages/rpi-utils {};
|
|
||||||
audio-patch = pkgs.writeText "audio_3.5_patch.py" ''
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
|
|
||||||
def init_gpio():
|
|
||||||
os.popen("${rpi-utils}/bin/pinctrl set 11 op")
|
|
||||||
os.popen("${rpi-utils}/bin/pinctrl set 10 ip pn")
|
|
||||||
|
|
||||||
def check_3_5():
|
|
||||||
tmp = os.popen("${rpi-utils}/bin/pinctrl 10").readline().strip("\n")
|
|
||||||
return tmp
|
|
||||||
|
|
||||||
def enable_speaker_gpio():
|
|
||||||
os.popen("${rpi-utils}/bin/pinctrl set 11 op dh")
|
|
||||||
|
|
||||||
def disable_speaker_gpio():
|
|
||||||
os.popen("${rpi-utils}/bin/pinctrl set 11 op dl")
|
|
||||||
|
|
||||||
init_gpio()
|
|
||||||
|
|
||||||
while True:
|
|
||||||
tmp = check_3_5()
|
|
||||||
if tmp == "10: ip pn | lo // GPIO10 = input":
|
|
||||||
enable_speaker_gpio()
|
|
||||||
elif tmp == "10: ip pn | hi // GPIO10 = input":
|
|
||||||
disable_speaker_gpio()
|
|
||||||
time.sleep(1)
|
|
||||||
'';
|
|
||||||
in {
|
|
||||||
config = {
|
|
||||||
systemd.services."audio_3.5_patch" = {
|
|
||||||
description = "cpi audio patch";
|
|
||||||
after = ["multi-user.target"];
|
|
||||||
wantedBy = ["multi-user.target"];
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "simple";
|
|
||||||
ExecStart = "${pkgs.python3Minimal}/bin/python ${audio-patch}";
|
|
||||||
RemainAfterExit = "no";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@ -11,8 +11,7 @@ in {
|
|||||||
[nixos-hardware.nixosModules.raspberry-pi-4]
|
[nixos-hardware.nixosModules.raspberry-pi-4]
|
||||||
++ [./kernel]
|
++ [./kernel]
|
||||||
++ [../raspberry-pi/overlays]
|
++ [../raspberry-pi/overlays]
|
||||||
++ [../raspberry-pi/apply-overlays]
|
++ [../raspberry-pi/apply-overlays];
|
||||||
++ [./audio.nix];
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
environment.systemPackages = [rpi-utils];
|
environment.systemPackages = [rpi-utils];
|
||||||
@ -25,10 +24,10 @@ in {
|
|||||||
cpu-revision.enable = mkDefault true;
|
cpu-revision.enable = mkDefault true;
|
||||||
audremap.enable = mkDefault true;
|
audremap.enable = mkDefault true;
|
||||||
vc4-kms-v3d.enable = mkDefault true;
|
vc4-kms-v3d.enable = mkDefault true;
|
||||||
disable-pcie.enable = mkDefault true;
|
cpi-disable-pcie.enable = mkDefault true;
|
||||||
disable-genet.enable = mkDefault true;
|
cpi-disable-genet.enable = mkDefault true;
|
||||||
panel-uc.enable = mkDefault true;
|
cpi-uconsole.enable = mkDefault true;
|
||||||
cpi-pmu.enable = mkDefault true;
|
# cpi-pmu.enable = mkDefault true;
|
||||||
cpi-i2c1.enable = mkDefault false;
|
cpi-i2c1.enable = mkDefault false;
|
||||||
cpi-spi4.enable = mkDefault false;
|
cpi-spi4.enable = mkDefault false;
|
||||||
cpi-bluetooth.enable = mkDefault true;
|
cpi-bluetooth.enable = mkDefault true;
|
||||||
@ -42,7 +41,7 @@ in {
|
|||||||
{
|
{
|
||||||
name = "bcm2711-rpi-cm4";
|
name = "bcm2711-rpi-cm4";
|
||||||
params = {
|
params = {
|
||||||
ant2 = mkDefault "off";
|
ant2 = mkDefault "on";
|
||||||
audio = mkDefault "on";
|
audio = mkDefault "on";
|
||||||
spi = mkDefault "off";
|
spi = mkDefault "off";
|
||||||
i2c_arm = mkDefault "on";
|
i2c_arm = mkDefault "on";
|
||||||
|
Loading…
Reference in New Issue
Block a user