diff --git a/config/devterm.nix b/config/devterm.nix index 60fce5be..e004ec92 100644 --- a/config/devterm.nix +++ b/config/devterm.nix @@ -61,4 +61,34 @@ }; networking.networkmanager.enable = true; users.users.darkkirb.extraGroups = ["networkmanager"]; + hardware.deviceTree.overlays = [ + { + name = "dwc2"; + dtsFile = ./devterm/dwc2-overlay.dts; + } + { + name = "cma"; + dtsFile = ./devterm/cma-overlay.dts; + } + { + name = "vc4-kms-v3d-pi4"; + dtsFile = ./devterm/vc4-kms-v3d-pi4-overlay.dts; + } + { + name = "devterm-pmu"; + dtsFile = ./devterm/devterm-pmu-overlay.dts; + } + { + name = "devterm-panel"; + dtsFile = ./devterm/devterm-panel-overlay.dts; + } + { + name = "devterm-misc"; + dtsFile = ./devterm/devterm-misc-overlay.dts; + } + { + name = "audremap"; + dtsFile = ./devterm/audremap-overlay.dts; + } + ]; } diff --git a/config/devterm/audremap-overlay.dts b/config/devterm/audremap-overlay.dts new file mode 100644 index 00000000..6734fc33 --- /dev/null +++ b/config/devterm/audremap-overlay.dts @@ -0,0 +1,23 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2711"; + + fragment@0 { + target = <&audio_pins>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@1 { + target = <&audio_pins>; + __overlay__ { + brcm,pins = < 12 13 >; + brcm,function = < 4 >; /* alt0 alt0 */ + }; + }; + + +}; \ No newline at end of file diff --git a/config/devterm/cma-overlay.dts b/config/devterm/cma-overlay.dts new file mode 100644 index 00000000..50ce265a --- /dev/null +++ b/config/devterm/cma-overlay.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2711"; + + fragment@0 { + target = <&cma>; + __overlay__ { + size = <(384 * 1024 * 1024)>; + }; + }; +}; \ No newline at end of file diff --git a/config/devterm/devterm-misc-overlay.dts b/config/devterm/devterm-misc-overlay.dts new file mode 100644 index 00000000..bb3a356a --- /dev/null +++ b/config/devterm/devterm-misc-overlay.dts @@ -0,0 +1,87 @@ +/dts-v1/; +/plugin/; + +/{ + compatible = "brcm,bcm2711"; + + fragment@0 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_pins>; + status = "okay"; + + adc101c: adc@54 { + reg = <0x54>; + compatible = "ti,adc101c"; + status = "okay"; + }; + }; + }; + + fragment@1 { + target = <&spi4>; + __overlay__ { + pinctrl-names = "default"; + pinctrl-0 = <&spi4_pins &spi4_cs_pins>; + cs-gpios = <&gpio 4 1>; + status = "okay"; + + spidev4_0: spidev@0 { + compatible = "spidev"; + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; + spi-max-frequency = <125000000>; + status = "okay"; + }; + }; + }; + + fragment@2 { + target = <&uart1>; + __overlay__ { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>; + status = "okay"; + }; + }; + + fragment@3 { + target = <&gpio>; + __overlay__ { + + i2c1_pins: i2c1 { + brcm,pins = <44 45>; + brcm,function = <6>; + }; + + spi4_pins: spi4_pins { + brcm,pins = <6 7>; + brcm,function = <7>; + }; + + spi4_cs_pins: spi0_cs_pins { + brcm,pins = <4>; + brcm,function = <1>; + }; + + uart1_pins: uart1_pins { + brcm,pins = <14 15>; + brcm,function = <2>; + brcm,pull = <0 2>; + }; + + }; + }; + + fragment@4 { + target-path = "/chosen"; + __overlay__ { + bootargs = "8250.nr_uarts=1"; + }; + }; + +}; \ No newline at end of file diff --git a/config/devterm/devterm-panel-overlay.dts b/config/devterm/devterm-panel-overlay.dts new file mode 100644 index 00000000..25e43199 --- /dev/null +++ b/config/devterm/devterm-panel-overlay.dts @@ -0,0 +1,46 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2711"; + + fragment@0 { + target=<&dsi1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + port { + dsi_out_port: endpoint { + remote-endpoint = <&panel_dsi_port>; + }; + }; + + panel_cwd686: panel@0 { + compatible = "cw,cwd686"; + reg = <0>; + reset-gpio = <&gpio 8 1>; + backlight = <&ocp8178_backlight>; + + port { + panel_dsi_port: endpoint { + remote-endpoint = <&dsi_out_port>; + }; + }; + }; + }; + }; + + fragment@1 { + target-path = "/"; + __overlay__ { + ocp8178_backlight: backlight@0 { + compatible = "ocp8178-backlight"; + backlight-control-gpios = <&gpio 9 0>; + default-brightness = <5>; + }; + }; + }; + +}; \ No newline at end of file diff --git a/config/devterm/devterm-pmu-overlay.dts b/config/devterm/devterm-pmu-overlay.dts new file mode 100644 index 00000000..b977e9ba --- /dev/null +++ b/config/devterm/devterm-pmu-overlay.dts @@ -0,0 +1,104 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2711"; + + fragment@0 { + target = <&i2c0if>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + pinctrl-0 = <&i2c0_pins>; + pinctrl-names = "default"; + status = "okay"; + + axp22x: pmic@34 { + interrupt-controller; + #interrupt-cells = <1>; + compatible = "x-powers,axp223"; + reg = <0x34>; /* i2c address */ + interrupt-parent = <&gpio>; + interrupts = <2 8>; /* IRQ_TYPE_EDGE_FALLING */ + irq-gpios = <&gpio 2 0>; + + regulators { + + x-powers,dcdc-freq = <3000>; + + reg_aldo1: aldo1 { + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "audio-vdd"; + }; + + reg_aldo2: aldo2 { + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "display-vcc"; + }; + + reg_dldo2: dldo2 { + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "dldo2"; + }; + + reg_dldo3: dldo3 { + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "dldo3"; + }; + + reg_dldo4: dldo4 { + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "dldo4"; + }; + + }; + + battery_power_supply: battery-power-supply { + compatible = "x-powers,axp221-battery-power-supply"; + monitored-battery = <&battery>; + }; + + ac_power_supply: ac_power_supply { + compatible = "x-powers,axp221-ac-power-supply"; + }; + + }; + }; + }; + + fragment@1 { + target = <&i2c0if>; + __overlay__ { + compatible = "brcm,bcm2708-i2c"; + }; + }; + + fragment@2 { + target-path = "/aliases"; + __overlay__ { + i2c0 = "/soc/i2c@7e205000"; + }; + }; + + fragment@3 { + target-path = "/"; + __overlay__ { + battery: battery@0 { + compatible = "simple-battery"; + constant-charge-current-max-microamp = <2100000>; + voltage-min-design-microvolt = <3300000>; + }; + }; + }; + +}; \ No newline at end of file diff --git a/config/devterm/dwc2-overlay.dts b/config/devterm/dwc2-overlay.dts new file mode 100644 index 00000000..4d20b0bc --- /dev/null +++ b/config/devterm/dwc2-overlay.dts @@ -0,0 +1,22 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2711"; + + fragment@0 { + target = <&usb>; + #address-cells = <0x01>; + #size-cells = <0x01>; + + __overlay__ { + compatible = "brcm,bcm2835-usb"; + dr_mode = "host"; + g-np-tx-fifo-size = <0x20>; + g-rx-fifo-size = <0x22e>; + g-tx-fifo-size = <0x200 0x200 0x200 0x200 0x200 0x100 0x100>; + status = "okay"; + phandle = <0x01>; + }; + }; +}; \ No newline at end of file diff --git a/config/devterm/vc4-kms-v3d-pi4-overlay.dts b/config/devterm/vc4-kms-v3d-pi4-overlay.dts new file mode 100644 index 00000000..def16d6d --- /dev/null +++ b/config/devterm/vc4-kms-v3d-pi4-overlay.dts @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2711"; + + fragment@1 { + target = <&fb>; + __overlay__ { + status = "disabled"; + }; + }; + + fragment@2 { + target = <&firmwarekms>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@3 { + target = <&v3d>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@4 { + target = <&vc4>; + __overlay__ { + status = "okay"; + }; + }; +}; \ No newline at end of file