From a738af646ba71e50cdde2ebe602ba73dee59fdb1 Mon Sep 17 00:00:00 2001 From: Douglas Teles Date: Wed, 1 Jul 2026 20:01:01 -0300 Subject: [PATCH] RK3326: support the R36T Max internal SDIO WiFi (rk912/rk915) Users reported the R36T Max clone does not even scan for networks on the 2.0 clone image while the stock OS and Aurknix work (bug report 2). The R36T Max internal WiFi is an rk912/rk915 SDIO module, which the clone image had no driver, no DTS wiring and no SDIO quirks for. Port the working support from ROCKNIX/Aurknix: - rk915 driver package (AveyondFly/rk915, WiFi/BT SDIO), added to ADDITIONAL_DRIVERS. - 024-mainline-linux-hacks-for-rk915.patch: MMC_CAP2_WIFI_RK912 cap behind the supports-rk912 DT property; bypasses the SDIO CIS size check and power cycling that break this module's initialization. - rk3326-aislpc-r36tmax.dts: dedicated device tree (sdio_pwrseq, sdio node with supports-rk912, correct joypad wiring including the analog stick inversion users hit on the generic clone DTB). Adapted to the archr-singleadc-joypad and archr,generic-dsi compatibles. - Temperature sensor quirk for the "AISLPC R36TMax" model string. Co-Authored-By: Claude Fable 5 --- .../dts/rockchip/rk3326-aislpc-r36tmax.dts | 967 ++++++++++++++++++ projects/ArchR/devices/RK3326/options | 2 +- .../024-mainline-linux-hacks-for-rk915.patch | 81 ++ .../devices/AISLPC R36TMax/001-device_config | 12 + .../packages/linux-drivers/rk915/package.mk | 31 + 5 files changed, 1092 insertions(+), 1 deletion(-) create mode 100644 projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-aislpc-r36tmax.dts create mode 100755 projects/ArchR/devices/RK3326/patches/linux/024-mainline-linux-hacks-for-rk915.patch create mode 100755 projects/ArchR/packages/hardware/quirks/devices/AISLPC R36TMax/001-device_config create mode 100644 projects/ArchR/packages/linux-drivers/rk915/package.mk diff --git a/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-aislpc-r36tmax.dts b/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-aislpc-r36tmax.dts new file mode 100644 index 0000000000..1d0772eb78 --- /dev/null +++ b/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-aislpc-r36tmax.dts @@ -0,0 +1,967 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* +* # Copyright (C) 2022-26 AURKNIX (https://github.com/AveyondFly) +*/ + +/dts-v1/; +#include +#include +#include +#include +#include "rk3326.dtsi" + +/ { + model = "AISLPC R36TMax"; + compatible = "aislpc,r36tmax", "rockchip,rk3326"; + + aliases { + mmc2 = &sdio; + mmc1 = &sdmmc; + mmc0 = &emmc; + }; + + chosen { + systemd.debug_shell = "ttyS0"; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&pwm1 0 25000 0>; + brightness-levels = < + 0 1 2 3 4 5 6 7 + 8 9 10 11 12 13 14 15 + 16 17 18 19 20 21 22 23 + 24 25 26 27 28 29 30 31 + 32 33 34 35 36 37 38 39 + 40 41 42 43 44 45 46 47 + 48 49 50 51 52 53 54 55 + 56 57 58 59 60 61 62 63 + 64 65 66 67 68 69 70 71 + 72 73 74 75 76 77 78 79 + 80 81 82 83 84 85 86 87 + 88 89 90 91 92 93 94 95 + 96 97 98 99 100 101 102 103 + 104 105 106 107 108 109 110 111 + 112 113 114 115 116 117 118 119 + 120 121 122 123 124 125 126 127 + 128 129 130 131 132 133 134 135 + 136 137 138 139 140 141 142 143 + 144 145 146 147 148 149 150 151 + 152 153 154 155 156 157 158 159 + 160 161 162 163 164 165 166 167 + 168 169 170 171 172 173 174 175 + 176 177 178 179 180 181 182 183 + 184 185 186 187 188 189 190 191 + 192 193 194 195 196 197 198 199 + 200 201 202 203 204 205 206 207 + 208 209 210 211 212 213 214 215 + 216 217 218 219 220 221 222 223 + 224 225 226 227 228 229 230 231 + 232 233 234 235 236 237 238 239 + 240 241 242 243 244 245 246 247 + 248 249 250 251 252 253 254 255>; + default-brightness-level = <128>; + }; + + battery: battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <3000000>; + charge-term-current-microamp = <200000>; + constant-charge-current-max-microamp = <1500000>; + constant-charge-voltage-max-microvolt = <4200000>; + factory-internal-resistance-micro-ohms = <100000>; + voltage-max-design-microvolt = <4100000>; + voltage-min-design-microvolt = <3300000>; + + ocv-capacity-celsius = <20>; + ocv-capacity-table-0 = + <4046950 100>, <4001920 95>, <3967900 90>, <3940000 85>, + <3910000 80>, <3870000 75>, <3830000 70>, <3790000 65>, + <3750000 60>, <3720000 55>, <3690000 50>, <3650000 45>, + <3610000 40>, <3570000 35>, <3540000 30>, <3500000 25>, + <3460000 20>, <3420000 15>, <3380000 10>, <3340000 5>, + <3300000 0>; + }; + + adc_keys: adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 2>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1800000>; + poll-interval = <60>; + + vol-down-key { + label = "VOLUMEDOWN"; + linux,code = ; + press-threshold-microvolt = <280000>; + }; + + vol-up-key { + label = "VOLUMEUP"; + linux,code = ; + press-threshold-microvolt = <15000>; + }; + }; + + joypad: rocknix-singleadc-joypad { + compatible = "archr-singleadc-joypad"; + + joypad-name = "retrogame_joypad"; + joypad-product = <0x1101>; + joypad-revision = <0x0100>; + joypad-vendor = <0x484B>; + + status = "okay"; + + /* gpio pincontrol setup */ + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins_ctrl>; + + /* Analog mux define */ + io-channel-names = "amux_adc"; + io-channels = <&saradc 1>; + + /* adc mux channel count */ + amux-count = <4>; + amux-channel-mapping = <2 3 1 0>; + /* adc mux select(a,b) gpio */ + amux-a-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_LOW>; + amux-b-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + /* adc mux enable gpio */ + // amux-en-gpios = <&gpio2 RK_PB4 GPIO_ACTIVE_LOW>; + + rumble-gpio = <&gpio3 RK_PA6 GPIO_ACTIVE_HIGH>; + + /* adc calculate scale */ + button-adc-scale = <2>; + + /* adc deadzone range */ + button-adc-deadzone = <64>; + + /* + specifies fuzz value that is used to filter noise from + the event stream. + */ + button-adc-fuzz = <32>; + button-adc-flat = <32>; + + /* + Analog Stick data tuning value(precent) + p = positive direction, n = negative direction + report value = (real_adc_data * tuning_value) / 100 + */ + abs_x-p-tuning = <200>; + abs_x-n-tuning = <200>; + + abs_y-p-tuning = <200>; + abs_y-n-tuning = <200>; + + abs_rx-p-tuning = <200>; + abs_rx-n-tuning = <200>; + + abs_ry-p-tuning = <200>; + abs_ry-n-tuning = <200>; + + /* poll device interval (ms), adc read interval */ + poll-interval = <10>; + + /* required for RG351MP */ + invert-absx; + invert-absy; + invert-absrx; + invert-absry; + + /* gpio button auto repeat set value : default disable */ + /* + autorepeat; + */ + + /* + *** MagicX XU10 - layoout *** + |-------------------------------| + | sw14 sw17 sw16 sw15 | + |-----|-------------------|-----| + | | | | + |vol+ | | sw13| + |vol- | | | + | | LCD Display | | + | | | | + | | | | + | |-------------------| | + | sw9 sw10 | + | | + | sw1 sw7 | + | sw3 sw4 sw8 sw6 | + | sw2 sw5 | + | | + | sw11 sw12 | + | | + |-------|---------------|-------| + */ + + /* + joypad driver is poll-device driver. + poll-device is does not support wakeup-source. + */ + sw1 { + gpios = <&gpio3 RK_PC6 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-UP"; + linux,code = ; + }; + sw2 { + gpios = <&gpio3 RK_PC7 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-DOWN"; + linux,code = ; + }; + sw3 { + gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-LEFT"; + linux,code = ; + }; + sw4 { + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-RIGHT"; + linux,code = ; + }; + sw5 { + gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-A"; + linux,code = ; + }; + sw6 { + gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-B"; + linux,code = ; + }; + sw7 { + gpios = <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-Y"; + linux,code = ; + }; + sw8 { + gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-X"; + linux,code = ; + }; + sw9 { + gpios = <&gpio3 RK_PD0 GPIO_ACTIVE_LOW>; + label = "BTN_SELECT"; + linux,code = ; + }; + sw10 { + gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; + label = "BTN_START"; + linux,code = ; + }; + /* this sw11 entry is SPECIAL, most RK3566 devices do not have + this physical button but for the sake of keeping compatibility + with ES and retroarch, this phantom button and offset will + allow existing userspace programs to work without doing any + new remapping thus saving lots of headaches and extra work */ + sw11 { + gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_F"; + linux,code = ; + }; + sw12 { + gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>; + label = "BTN_THUMBL"; + linux,code = ; + }; + sw13 { + gpios = <&gpio2 RK_PB6 GPIO_ACTIVE_LOW>; + label = "BTN_THUMBR"; + linux,code = ; + }; + sw14 { + gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_TR"; + linux,code = ; + }; + sw15 { + gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_TR2"; + linux,code = ; + }; + sw16 { + gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_TL"; + linux,code = ; + }; + sw17 { + gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_TL2"; + linux,code = ; + }; + }; + + spk_amp: audio-amplifier { + compatible = "simple-audio-amplifier"; + enable-gpios = <&gpio3 RK_PA7 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&spk_amp_enable_h>; + pinctrl-names = "default"; + sound-name-prefix = "Speaker Amp"; + }; + rk817-sound { + compatible = "simple-audio-card"; + pinctrl-names = "default"; + pinctrl-0 = <&hp_det>; + simple-audio-card,name = "rk817_ext"; + simple-audio-card,aux-devs = <&spk_amp>; + simple-audio-card,format = "i2s"; + simple-audio-card,hp-det-gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,widgets = + "Headphone", "Headphones", + "Speaker", "Internal Speakers"; + /* despite it's just a mono speaker, we need to route both Speaker Amp channels + Otherwise, the second channel stays on and keeps amp enabled */ + simple-audio-card,routing = + "Headphones", "HPOL", + "Headphones", "HPOR", + "Internal Speakers", "Speaker Amp OUTL", + "Internal Speakers", "Speaker Amp OUTR", + "Speaker Amp INL", "HPOL", + "Speaker Amp INR", "HPOR"; + + simple-audio-card,pin-switches = "Internal Speakers"; + + simple-audio-card,codec { + sound-dai = <&rk817>; + }; + + simple-audio-card,cpu { + sound-dai = <&i2s1_2ch>; + }; + }; + + vccsys: vccsys { + compatible = "regulator-fixed"; + regulator-name = "vcc3v8_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + + vcc18_lcd0: vcc18-lcd0 { + compatible = "regulator-fixed"; + regulator-name = "vcc18_lcd0_n"; + gpio = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; + enable-active-high; + pinctrl-0 = <&vcc18_lcd_n>; + pinctrl-names = "default"; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_host: vcc_host { + compatible = "regulator-fixed"; + regulator-name = "vcc_host"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio3 RK_PA4 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&vcc5_usb>; + pinctrl-names = "default"; + enable-active-high; + regulator-always-on; + regulator-boot-on; + vin-supply = <&usb_midu>; + }; + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + /*clocks = <&rk817 1>; + clock-names = "ext_clock"; + */ + pinctrl-0 = <&wifi_enable_h>; + pinctrl-names = "default"; + post-power-on-delay-ms = <2000>; + reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; + }; + +}; + +&dmc { + center-supply = <&vdd_logic>; +}; + +&cpu0 { + cpu-supply = <&vdd_arm>; +}; + +&cpu1 { + cpu-supply = <&vdd_arm>; +}; + +&cpu2 { + cpu-supply = <&vdd_arm>; +}; + +&cpu3 { + cpu-supply = <&vdd_arm>; +}; + +&cru { + assigned-clocks = <&cru PLL_NPLL>, + <&cru ACLK_BUS_PRE>, <&cru ACLK_PERI_PRE>, + <&cru HCLK_BUS_PRE>, <&cru HCLK_PERI_PRE>, + <&cru PCLK_BUS_PRE>, <&cru SCLK_GPU>; + + assigned-clock-rates = <1188000000>, + <200000000>, <200000000>, + <150000000>, <150000000>, + <100000000>, <200000000>; +}; + +&display_subsystem { + status = "okay"; +}; + +&dsi { + status = "okay"; + + ports { + mipi_out: port@1 { + reg = <1>; + + mipi_out_panel: endpoint { + remote-endpoint = <&mipi_in_panel>; + }; + }; + }; + + internal_display: panel@0 { + compatible = "archr,generic-dsi", "rocknix,generic-dsi"; + iovcc-supply = <&vcc18_lcd0>; + vcc-supply = <&vcc18_lcd0>; + reg = <0>; + backlight = <&backlight>; + reset-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&lcd_rst>; + panel_description = + "G size=153,85 delays=20,20,20,120,20 format=rgb888 lanes=4 flags=0xe03", + + "M clock=50000 horizontal=720,140,80,140 vertical=720,20,4,20 default=1", + "M clock=50000 horizontal=720,140,100,140 vertical=720,20,150,20", + "M clock=50040 horizontal=720,140,112,140 vertical=720,20,140,20", + "M clock=51400 horizontal=720,140,132,140 vertical=720,20,148,20", + "M clock=50140 horizontal=720,140,90,140 vertical=720,20,40,20", + "M clock=56900 horizontal=720,140,90,140 vertical=720,20,114,20", + "M clock=50400 horizontal=720,140,92,140 vertical=720,20,10,20", + "M clock=50220 horizontal=720,140,80,140 vertical=720,20,15,20", + "M clock=54600 horizontal=720,140,112,140 vertical=720,20,57,20", + "M clock=75450 horizontal=720,140,95,140 vertical=720,20,153,20", + "M clock=75330 horizontal=720,140,80,140 vertical=720,20,15,20", + "M clock=100440 horizontal=720,140,80,140 vertical=720,20,15,20", + + "I seq=b9f11283", + "I seq=b1000000da80", + "I seq=b23c1230", + "I seq=b31010282803ff00000000", + "I seq=b480", + "I seq=b50a0a", + "I seq=b69797", + "I seq=b82622f013", + "I seq=ba338105f90e0e2000000000000000442500900a0000014f01000037", + "I seq=bc47", + "I seq=bf021100", + "I seq=c0737350500000127000", + "I seq=c12500323277e4ffffcccc7777", + "I seq=c68200bfff00ff", + "I seq=c7b8000a000000", + "I seq=c810401e02", + "I seq=cc0b", + "I seq=e0000b102c3d3f423a070d0f131513140f16000b102c3d3f423a070d0f131513140f16", + "I seq=e307070b0b0b0b00000000ff00c010", + "I seq=e9c8100a000080811231234f86a000470800000c00000000000c00000098028baf4602888888888898138baf5713888888888800000000000000000000000000", + "I seq=ea970c090909780000000000009f318ba8317588888888889f208ba820648888888888230000027100000000000000000000000000000040808100000000", + "I seq=efffff01", + "I seq=11 wait=250", + "I seq=29 wait=50"; + port { + mipi_in_panel: endpoint { + remote-endpoint = <&mipi_out_panel>; + }; + }; + }; +}; + +&dsi_dphy { + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_logic>; + status = "okay"; +}; + +&i2c0 { + clock-frequency = <400000>; + i2c-scl-falling-time-ns = <16>; + i2c-scl-rising-time-ns = <280>; + status = "okay"; + + rk817: pmic@20 { + compatible = "rockchip,rk817"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = ; + clock-output-names = "rk808-clkout1", "xin32k"; + clock-names = "mclk"; + clocks = <&cru SCLK_I2S1_OUT>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>; + rockchip,system-power-controller; + wakeup-source; + #clock-cells = <1>; + #sound-dai-cells = <0>; + + vcc1-supply = <&vccsys>; + vcc2-supply = <&vccsys>; + vcc3-supply = <&vccsys>; + vcc4-supply = <&vccsys>; + vcc5-supply = <&vccsys>; + vcc6-supply = <&vccsys>; + vcc7-supply = <&vcc_3v0>; + vcc8-supply = <&vccsys>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1350000>; + regulator-initial-mode = <0x02>; + regulator-ramp-delay = <6001>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vdd_arm: DCDC_REG2 { + regulator-name = "vdd_arm"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x02>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x02>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_3v0: DCDC_REG4 { + regulator-name = "vcc_3v0"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-initial-mode = <0x02>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc_1v0: LDO_REG1 { + regulator-name = "vcc_1v0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + + vcc1v8_soc: LDO_REG2 { + regulator-name = "vcc1v8_soc"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc1v0_soc: LDO_REG3 { + regulator-name = "vcc1v0_soc"; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + + vcc3v0_pmu: LDO_REG4 { + regulator-name = "vcc3v0_pmu"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_sd: LDO_REG6 { + regulator-name = "vcc_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc2v8_dvp: LDO_REG7 { + regulator-name = "vcc2v8_dvp"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc3v0_dvp: LDO_REG8 { + regulator-name = "vcc3v0_dvp"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vdd1v5_dvp: LDO_REG9 { + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-name = "vdd1v5_dvp"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <1500000>; + }; + }; + + usb_midu: BOOST { + regulator-name = "usb_midu"; + regulator-min-microvolt = <4700000>; + regulator-max-microvolt = <5400000>; + regulator-always-on; + regulator-boot-on; + }; + + }; + + rk817_charger: charger { + monitored-battery = <&battery>; + rockchip,resistor-sense-micro-ohms = <10000>; + rockchip,sleep-enter-current-microamp = <300000>; + rockchip,sleep-filter-current-microamp = <100000>; + }; + + rk817_codec: codec { + rockchip,mic-in-differential; + }; + }; +}; + +/* I2S 1 Channel Used Header(P2):1(GPIO2.C3),2(.C2), 3(.C1), 4(.C5), 5(.C4) */ +&i2s1_2ch { + status = "okay"; + #sound-dai-cells = <0>; +}; + +&io_domains { + vccio1-supply = <&vcc2v8_dvp>; + vccio2-supply = <&vccio_sd>; + vccio3-supply = <&vcc1v8_soc>; + vccio4-supply = <&vcc_3v0>; + vccio5-supply = <&vcc_3v0>; + vccio6-supply = <&vcc1v8_soc>; + status = "okay"; +}; + +&isp { + status = "okay"; +}; + +&isp_mmu { + status = "okay"; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v0_pmu>; + pmuio2-supply = <&vcc3v0_pmu>; + status = "okay"; +}; + +&csi_dphy { + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&saradc { + vref-supply = <&vcc1v8_soc>; + status = "okay"; +}; + +&sdmmc { + cap-sd-highspeed; + card-detect-delay = <200>; + cd-gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_LOW>; /*[> ff370000 PD_SDCARD CD GPIO <]*/ + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&sdio { + #address-cells = <1>; + #size-cells = <0>; + bus-width = <4>; + disable-wp; + max-frequency = <0x2faf080>; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + no-mmc; + no-sd; + cap-sdio-irq; + non-removable; + cap-sd-highspeed; + supports-sdio; + supports-rk912; + status = "okay"; + wifi@1 { + reg = <1>; + interrupt-names = "host-wake"; + interrupt-parent = <&gpio0>; + interrupts = ; + pinctrl-0 = <&wifi_host_wake_l>; + pinctrl-names = "default"; + }; +}; + +&emmc { + no-sdio; + no-sd; + disable-wp; + non-removable; + num-slots = <0x01>; + status = "okay"; +}; + +&tsadc { + status = "okay"; +}; + +&u2phy { + status = "okay"; + + u2phy_host: host-port { + status = "okay"; + }; + + u2phy_otg: otg-port { + status = "okay"; + }; +}; + +/* FIQ Header(P2): 2(RXD:GPIO2.B4),3(TXD:.B6) */ +&uart2 { + status = "okay"; + dma-names = "tx"; + pinctrl-0 = <&uart2m1_xfer>; +}; + +&uart1 { + status = "okay"; +}; + +&usb20_otg { + status = "okay"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&uart2m1_xfer { + rockchip,pins = <2 RK_PB4 2 &pcfg_pull_up>; +}; + +&pinctrl { + btns { + btn_pins_ctrl: btn-pins-ctrl { + rockchip,pins = + <3 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_up_12ma>, + <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up_12ma>, + <3 RK_PC2 RK_FUNC_GPIO &pcfg_pull_up_12ma>, + <3 RK_PC3 RK_FUNC_GPIO &pcfg_pull_up_12ma>, + <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_up_12ma>, + <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up_12ma>, + <3 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up_12ma>, + <3 RK_PC7 RK_FUNC_GPIO &pcfg_pull_up_12ma>, + <3 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + btn_pins_vol: btn-pins-vol { + rockchip,pins = <3 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + gpio-lcd { + lcd_rst: lcd-rst { + rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + vcc18-lcd { + vcc18_lcd_n: vcc18-lcd-n { + rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + vcc5-usb { + vcc5_usb: vcc5-usb { + rockchip,pins = <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + gpio-led { + led_pins: led-pins { + rockchip,pins = + <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>, + <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + dc_det: dc-det { + rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + pmic_int: pmic-int { + rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + soc_slppin_gpio: soc_slppin_gpio { + rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_output_low>; + }; + + soc_slppin_rst: soc_slppin_rst { + rockchip,pins = <0 RK_PA4 2 &pcfg_pull_none>; + }; + + soc_slppin_slp: soc_slppin_slp { + rockchip,pins = <0 RK_PA4 1 &pcfg_pull_none>; + }; + }; + + speaker { + spk_amp_enable_h: spk-amp-enable-h { + rockchip,pins = + <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = + <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + wifi_host_wake_l: wifi-host-wake-l { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; +}; diff --git a/projects/ArchR/devices/RK3326/options b/projects/ArchR/devices/RK3326/options index f87b57ce9b..76eadd9713 100644 --- a/projects/ArchR/devices/RK3326/options +++ b/projects/ArchR/devices/RK3326/options @@ -61,7 +61,7 @@ # for a list of additional drivers see packages/linux-drivers # Space separated list is supported, # e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2" - ADDITIONAL_DRIVERS="RTL8188EUS RTL8812AU RTL8814AU RTL8821AU RTL8821CU RTL88x2BU RTL8831 AIC8800 mali-bifrost" + ADDITIONAL_DRIVERS="rk915 RTL8188EUS RTL8812AU RTL8814AU RTL8821AU RTL8821CU RTL88x2BU RTL8831 AIC8800 mali-bifrost" # Additional Firmware to use ( ) # Space separated list is supported, diff --git a/projects/ArchR/devices/RK3326/patches/linux/024-mainline-linux-hacks-for-rk915.patch b/projects/ArchR/devices/RK3326/patches/linux/024-mainline-linux-hacks-for-rk915.patch new file mode 100755 index 0000000000..4f08624da2 --- /dev/null +++ b/projects/ArchR/devices/RK3326/patches/linux/024-mainline-linux-hacks-for-rk915.patch @@ -0,0 +1,81 @@ +diff -ur linux-6.12.29/drivers/mmc/core/host.c linux_for_rk915/drivers/mmc/core/host.c +--- linux-6.12.29/drivers/mmc/core/host.c 2025-05-18 06:25:00.000000000 +0000 ++++ linux_for_rk915/drivers/mmc/core/host.c 2025-06-28 17:43:59.825733795 +0000 +@@ -403,6 +403,8 @@ + host->caps2 |= MMC_CAP2_NO_SD; + if (device_property_read_bool(dev, "no-mmc")) + host->caps2 |= MMC_CAP2_NO_MMC; ++ if (device_property_read_bool(dev, "supports-rk912")) ++ host->caps2 |= MMC_CAP2_WIFI_RK912; + if (device_property_read_bool(dev, "no-mmc-hs400")) + host->caps2 &= ~(MMC_CAP2_HS400_1_8V | MMC_CAP2_HS400_1_2V | + MMC_CAP2_HS400_ES); +diff -ur linux-6.12.29/drivers/mmc/core/sdio.c linux_for_rk915/drivers/mmc/core/sdio.c +--- linux-6.12.29/drivers/mmc/core/sdio.c 2025-05-18 06:25:00.000000000 +0000 ++++ linux_for_rk915/drivers/mmc/core/sdio.c 2025-06-28 17:43:59.827733748 +0000 +@@ -1076,7 +1076,8 @@ + * removable card is checked from a detect work later on in the resume + * process. + */ +- if (!mmc_card_keep_power(host)) { ++ if (!mmc_card_keep_power(host) && ++ !(host->caps2 & MMC_CAP2_WIFI_RK912)) { + mmc_power_up(host, host->card->ocr); + /* + * Tell runtime PM core we just powered up the card, +diff -ur linux-6.12.29/drivers/mmc/core/sdio_cis.c linux_for_rk915/drivers/mmc/core/sdio_cis.c +--- linux-6.12.29/drivers/mmc/core/sdio_cis.c 2025-05-18 06:25:00.000000000 +0000 ++++ linux_for_rk915/drivers/mmc/core/sdio_cis.c 2025-06-28 17:43:59.826733772 +0000 +@@ -190,15 +191,15 @@ + pr_warn("%s: card has broken SDIO 1.1 CIS, forcing SDIO 1.0\n", + mmc_hostname(card->host)); + vsn = SDIO_SDIO_REV_1_00; +- } else if (size < min_size) { ++ } else if (size < min_size && !(card->host->caps2 & MMC_CAP2_WIFI_RK912)) { + return -EINVAL; + } + + /* TPLFE_MAX_BLK_SIZE */ + func->max_blksize = buf[12] | (buf[13] << 8); + + /* TPLFE_ENABLE_TIMEOUT_VAL, present in ver 1.1 and above */ +- if (vsn > SDIO_SDIO_REV_1_00) ++ if (vsn > SDIO_SDIO_REV_1_00 && !(card->host->caps2 & MMC_CAP2_WIFI_RK912)) + func->enable_timeout = (buf[28] | (buf[29] << 8)) * 10; + else + func->enable_timeout = jiffies_to_msecs(HZ); +diff -ur linux-6.12.29/drivers/mmc/host/dw_mmc.c linux_for_rk915/drivers/mmc/host/dw_mmc.c +--- linux-6.12.29/drivers/mmc/host/dw_mmc.c 2025-05-18 06:25:00.000000000 +0000 ++++ linux_for_rk915/drivers/mmc/host/dw_mmc.c 2025-06-28 17:44:02.417672518 +0000 +@@ -295,6 +295,10 @@ + SDMMC_CMD_PRV_DAT_WAIT, 0); + } + ++ if ((mmc->caps2 & MMC_CAP2_WIFI_RK912) && ++ (cmd->opcode == SD_IO_RW_DIRECT)) ++ cmdr |= SDMMC_CMD_PRV_DAT_WAIT; ++ + if (cmd->flags & MMC_RSP_PRESENT) { + /* We expect a response, so set this bit */ + cmdr |= SDMMC_CMD_RESP_EXP; +@@ -1263,7 +1267,8 @@ + + /* enable clock; only low power if no SDIO */ + clk_en_a = SDMMC_CLKEN_ENABLE << slot->id; +- if (!test_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags)) ++ if (!test_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags) && ++ !(slot->mmc->caps2 & MMC_CAP2_WIFI_RK912)) + clk_en_a |= SDMMC_CLKEN_LOW_PWR << slot->id; + mci_writel(host, CLKENA, clk_en_a); + +diff -ur linux-6.12.29/include/linux/mmc/host.h linux_for_rk915/include/linux/mmc/host.h +--- linux-6.12.29/include/linux/mmc/host.h 2025-05-18 06:25:00.000000000 +0000 ++++ linux_for_rk915/include/linux/mmc/host.h 2025-06-28 17:45:54.422123779 +0000 +@@ -404,6 +404,7 @@ + #define MMC_CAP2_CRYPTO 0 + #endif + #define MMC_CAP2_ALT_GPT_TEGRA (1 << 28) /* Host with eMMC that has GPT entry at a non-standard location */ ++#define MMC_CAP2_WIFI_RK912 (1 << 29) + + int fixed_drv_type; /* fixed driver type for non-removable media */ + diff --git a/projects/ArchR/packages/hardware/quirks/devices/AISLPC R36TMax/001-device_config b/projects/ArchR/packages/hardware/quirks/devices/AISLPC R36TMax/001-device_config new file mode 100755 index 0000000000..a03fa325bf --- /dev/null +++ b/projects/ArchR/packages/hardware/quirks/devices/AISLPC R36TMax/001-device_config @@ -0,0 +1,12 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2024-present ArchR (https://github.com/archr-linux/Arch-R) + +# Minimal per-device config: wire up the temperature sensors so System +# Information (archr-info) and EmulationStation show CPU/GPU temps. The +# quirks loader matches the folder name against /proc/device-tree/model +# exactly, so this folder name MUST equal the DTS `model` string. +cat </storage/.config/profile.d/001-device_config +DEVICE_TEMP_SENSOR="/sys/devices/virtual/thermal/thermal_zone0/temp" +DEVICE_GPU_TEMP_SENSOR="/sys/devices/virtual/thermal/thermal_zone1/temp" +CONF diff --git a/projects/ArchR/packages/linux-drivers/rk915/package.mk b/projects/ArchR/packages/linux-drivers/rk915/package.mk new file mode 100644 index 0000000000..23d9bd165f --- /dev/null +++ b/projects/ArchR/packages/linux-drivers/rk915/package.mk @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2024-present ROCKNIX (https://github.com/ROCKNIX) + +PKG_NAME="rk915" +PKG_VERSION="e2fd61651c272aab7bd7e76ba05e5682d7c1d211" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/AveyondFly/rk915" +PKG_URL="${PKG_SITE}/archive/${PKG_VERSION}.tar.gz" +PKG_LONGDESC="RK915 WiFi/BT SDIO driver" +PKG_TOOLCHAIN="manual" +PKG_IS_KERNEL_PKG="yes" + +pre_make_target() { + unset LDFLAGS +} + +make_target() { + kernel_make -C $(kernel_path) M=${PKG_BUILD} \ + BUSIF=SDIO \ + ROM=true \ + CHIP=RK915 +} + +makeinstall_target() { + mkdir -p ${INSTALL}/$(get_full_module_dir)/${PKG_NAME} + cp ${PKG_BUILD}/*.ko ${INSTALL}/$(get_full_module_dir)/${PKG_NAME} + + # Install firmware to kernel overlay + mkdir -p ${INSTALL}/$(get_full_firmware_dir) + cp ${PKG_BUILD}/firmware/*.bin ${INSTALL}/$(get_full_firmware_dir)/ +}