diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/retrogame_joypad_s2_f1.dtsi b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/retrogame_joypad_s2_f1.dtsi new file mode 100644 index 0000000000..304ef1ef49 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/retrogame_joypad_s2_f1.dtsi @@ -0,0 +1,122 @@ +/* + This is a skeleton of joypad with 2 sticks and FN (MODE) button. + Fits devices with 1 stick and 2 extra face buttons too. + By including this ans setting I/O properties only, + devices should get consistent controller id and mapping + thus reusing non-game configs: + * SDL gamecontrollerdb.txt + * ES es_input.cfg + * Retroarch gamepad +*/ + +/ { + joypad: retrogame_joypad_s2_f1 { + /* These drivers emit the same button set which makes this skeleton ADC-agnostic */ + /* compatible = "rocknix-joypad"; */ + /* compatible = "rocknix-singleadc-joypad"; */ + + /* These are constants making Joystick Guid the same */ + joypad-name = "retrogame_joypad_s2_f1"; + joypad-vendor = <0x484B>; + joypad-product = <0x1121>; /* 11 inherited, 2 for number of sticks, 1 for number of FN */ + joypad-revision = <0x0100>; + + /* require explicit status = "okay"; */ + status = "disabled"; + + /* 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>; + + /* poll device interval (ms), adc read interval */ + poll-interval = <10>; + + /* gpio button auto repeat set value : default disable */ + /* + autorepeat; + */ + + /* meaningful node names for easier use */ + up { + label = "GPIO DPAD-UP"; + linux,code = ; + }; + down { + label = "GPIO DPAD-DOWN"; + linux,code = ; + }; + left { + label = "GPIO DPAD-LEFT"; + linux,code = ; + }; + right { + label = "GPIO DPAD-RIGHT"; + linux,code = ; + }; + + a { + label = "GPIO BTN-A"; + linux,code = ; + }; + b { + label = "GPIO BTN-B"; + linux,code = ; + }; + x { + label = "GPIO BTN-X"; + linux,code = ; + }; + y { + label = "GPIO BTN-Y"; + linux,code = ; + }; + + select { + label = "GPIO BTN_SELECT"; + linux,code = ; + }; + start { + label = "GPIO BTN_START"; + linux,code = ; + }; + mode { + label = "GPIO BTN_F"; + linux,code = ; + }; + + tl { + label = "GPIO BTN_TL"; + linux,code = ; + }; + tr { + label = "GPIO BTN_TR"; + linux,code = ; + }; + tl2 { + label = "GPIO BTN_TL2"; + linux,code = ; + }; + tr2 { + label = "GPIO BTN_TR2"; + linux,code = ; + }; + + thumbl { + label = "GPIO BTN_THUMBL"; + linux,code = ; + }; + thumbr { + label = "GPIO BTN_THUMBR"; + linux,code = ; + }; + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-anbernic-rg351m.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-anbernic-rg351m.dts new file mode 100644 index 0000000000..c12bb79944 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-anbernic-rg351m.dts @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Hardkernel Co., Ltd + * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH + * Copyright (c) 2022 Maya Matuszczyk + */ + +/dts-v1/; +#include "rk3326-odroid-go.dtsi" + +/ { + model = "Anbernic RG351M"; + compatible = "anbernic,rg351m", "rockchip,rk3326"; + + battery: battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <3500000>; + charge-term-current-microamp = <350000>; + constant-charge-current-max-microamp = <2000000>; + constant-charge-voltage-max-microvolt = <4200000>; + factory-internal-resistance-micro-ohms = <180000>; + voltage-max-design-microvolt = <4100000>; + voltage-min-design-microvolt = <3500000>; + + ocv-capacity-celsius = <20>; + ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, + <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, + <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, + <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, + <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, + <3574170 0>; + }; + + vibrator { + compatible = "pwm-vibrator"; + pwms = <&pwm0 0 1000000 0>; + pwm-names = "enable"; + }; +}; + +/delete-node/ &vcc_host; /* conflicts with pwm vibration motor */ + +&internal_display { + compatible = "elida,kd35t133"; + iovcc-supply = <&vcc_lcd>; + vdd-supply = <&vcc_lcd>; + rotation = <270>; +}; + +&pwm0 { + status = "okay"; +}; + +&rk817_charger { + /* This device does not have a current sense resistor */ + //rockchip,resistor-sense-micro-ohms = <0>; + monitored-battery = <&battery>; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-anbernic-rg351m.dtsi b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-anbernic-rg351m.dtsi new file mode 100644 index 0000000000..1dadde198c --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-anbernic-rg351m.dtsi @@ -0,0 +1,480 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Hardkernel Co., Ltd + * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH + * Copyright (c) 2022 Maya Matuszczyk + */ + +/dts-v1/; +#include +#include +#include +#include +#include "rk3326.dtsi" + +/ { + aliases { + mmc0 = &sdmmc; + }; + + chosen { + stdout-path = "serial2:115200n8"; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + power-supply = <&vcc_bl>; + pwms = <&pwm1 0 25000 0>; + }; + + /* + * LED is a tri-state. Driven high it is red, driven low it is + * green, and not driven at all (pin set to input) it is amber. + * Additionally, there is a 2nd LED that is not controllable + * that is on (red) when plugged in to power. + */ + gpio_led: gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pin>; + + red_green_led: led-0 { + color = ; + gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_HIGH>; + function = LED_FUNCTION_CHARGING; + }; + }; + + rk817-sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "rk817_int"; + 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 = + "Microphone", "Mic Jack", + "Headphone", "Headphones", + "Speaker", "Speaker"; + simple-audio-card,routing = + "MICL", "Mic Jack", + "Headphones", "HPOL", + "Headphones", "HPOR", + "Speaker", "SPKO"; + + simple-audio-card,codec { + sound-dai = <&rk817>; + }; + + simple-audio-card,cpu { + sound-dai = <&i2s1_2ch>; + }; + }; + + vccsys: regulator-vccsys { + compatible = "regulator-fixed"; + regulator-name = "vcc3v8_sys"; + regulator-always-on; + regulator-min-microvolt = <3800000>; + regulator-max-microvolt = <3800000>; + }; + + vibrator { + compatible = "pwm-vibrator"; + pwms = <&pwm0 0 1000000 0>; + pwm-names = "enable"; + }; +}; + +&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 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + ports { + mipi_out: port@1 { + reg = <1>; + + mipi_out_panel: endpoint { + remote-endpoint = <&mipi_in_panel>; + }; + }; + }; + + internal_display: panel@0 { + reg = <0>; + backlight = <&backlight>; + reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; + + 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>; + #clock-cells = <1>; + clock-names = "mclk"; + clock-output-names = "rk808-clkout1", "xin32k"; + clocks = <&cru SCLK_I2S1_OUT>; + interrupt-parent = <&gpio0>; + interrupts = ; + pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>; + pinctrl-names = "default"; + #sound-dai-cells = <0>; + wakeup-source; + + vcc1-supply = <&vccsys>; + vcc2-supply = <&vccsys>; + vcc3-supply = <&vccsys>; + vcc4-supply = <&vccsys>; + vcc5-supply = <&vccsys>; + vcc6-supply = <&vccsys>; + vcc7-supply = <&vccsys>; + vcc8-supply = <&vccsys>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1150000>; + regulator-min-microvolt = <950000>; + regulator-name = "vdd_logic"; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vdd_arm: DCDC_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1350000>; + regulator-min-microvolt = <950000>; + regulator-name = "vdd_arm"; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vcc_ddr"; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_3v3: DCDC_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc_3v3"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_1v8: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1800000>; + regulator-min-microvolt = <1800000>; + regulator-name = "vcc_1v8"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_1v0: LDO_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1000000>; + regulator-min-microvolt = <1000000>; + regulator-name = "vdd_1v0"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + + vcc3v3_pmu: LDO_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc3v3_pmu"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <1800000>; + regulator-name = "vccio_sd"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_sd: LDO_REG6 { + regulator-boot-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc_sd"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_bl: LDO_REG7 { + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc_bl"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_lcd: LDO_REG8 { + regulator-max-microvolt = <2800000>; + regulator-min-microvolt = <2800000>; + regulator-name = "vcc_lcd"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <2800000>; + }; + }; + + vcc_wifi: LDO_REG9 { + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc_wifi"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + usb_midu: BOOST { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <5400000>; + regulator-min-microvolt = <5000000>; + regulator-name = "usb_midu"; + }; + }; + + rk817_codec: codec { + rockchip,mic-in-differential; + }; + }; +}; + +&i2s1_2ch { + status = "okay"; +}; + +&io_domains { + vccio1-supply = <&vcc_3v3>; + vccio2-supply = <&vccio_sd>; + vccio3-supply = <&vcc_3v3>; + vccio4-supply = <&vcc_3v3>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + status = "okay"; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + status = "okay"; +}; + +&pwm0 { + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&saradc { + vref-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc { + cap-sd-highspeed; + card-detect-delay = <200>; + cd-gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_LOW>; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&sfc { + #address-cells = <1>; + pinctrl-0 = <&sfc_clk &sfc_cs0 &sfc_bus2>; + pinctrl-names = "default"; + #size-cells = <0>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <108000000>; + spi-rx-bus-width = <2>; + spi-tx-bus-width = <1>; + }; +}; + +&tsadc { + status = "okay"; +}; + +&u2phy { + status = "okay"; + + u2phy_host: host-port { + status = "okay"; + }; + + u2phy_otg: otg-port { + status = "disabled"; + }; +}; + +&usb20_otg { + status = "okay"; +}; + +&uart2 { + pinctrl-0 = <&uart2m1_xfer>; + pinctrl-names = "default"; + status = "okay"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&pinctrl { + headphone { + hp_det: hp-det { + rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + leds { + led_pin: led-pin { + rockchip,pins = <2 RK_PB5 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>; + }; + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-anbernic-rg351v.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-anbernic-rg351v.dts new file mode 100644 index 0000000000..26658a37f4 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-anbernic-rg351v.dts @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Hardkernel Co., Ltd + * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH + * Copyright (c) 2022 Maya Matuszczyk + */ + +/dts-v1/; +#include "rk3326-odroid-go.dtsi" + +/ { + model = "Anbernic RG351V"; + compatible = "anbernic,rg351v", "rockchip,rk3326"; + + aliases { + mmc0 = &sdio; + mmc1 = &sdmmc; + }; + + gpio-keys-vol { + compatible = "gpio-keys"; + autorepeat; + pinctrl-0 = <&btn_pins_vol>; + pinctrl-names = "default"; + + button-vol-down { + gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; + label = "VOLUMEDOWN"; + linux,code = ; + }; + + button-volume-up { + gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; + label = "VOLUMEUP"; + linux,code = ; + }; + }; + + battery: battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <3500000>; + charge-term-current-microamp = <350000>; + constant-charge-current-max-microamp = <2000000>; + constant-charge-voltage-max-microvolt = <4200000>; + factory-internal-resistance-micro-ohms = <180000>; + voltage-max-design-microvolt = <4100000>; + voltage-min-design-microvolt = <3500000>; + + ocv-capacity-celsius = <20>; + ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, + <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, + <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, + <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, + <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, + <3574170 0>; + }; + + vibrator { + compatible = "pwm-vibrator"; + pwms = <&pwm0 0 1000000 0>; + pwm-names = "enable"; + }; +}; + +/* conflicts with pwm vibration motor */ +/delete-node/ &vcc_host; + +/* Device only has 1 LED compared to Odroid Go Advance */ +/delete-node/ &gpio_led; + +&internal_display { + compatible = "anbernic,rg351v-panel", "newvision,nv3051d"; + iovcc-supply = <&vcc_lcd>; + vdd-supply = <&vcc_lcd>; +}; + +&io_domains { + vccio1-supply = <&vccio_sd>; +}; + +/delete-node/ &pwm_led; + +&pwm0 { + status = "okay"; +}; + +/delete-node/ &pwm3; + +&rk817_charger { + /* This device does not have a current sense resistor */ + rockchip,resistor-sense-micro-ohms = <0>; + monitored-battery = <&battery>; +}; + +&sdio { + cap-sd-highspeed; + card-detect-delay = <200>; + cd-gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/ + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&vcc_sd { + regulator-max-microvolt = <3000000>; + regulator-min-microvolt = <1800000>; +}; + +&vccio_sd { + regulator-max-microvolt = <1800000>; +}; + +&pinctrl { + btns { + btn_pins_vol: btn-pins-vol { + rockchip,pins = <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-eeclone.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-eeclone.dts new file mode 100644 index 0000000000..1dc8f70b43 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-eeclone.dts @@ -0,0 +1,926 @@ +/// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2024-present ROCKNIX (https://github.com/ROCKNIX) + * Copyright (c) 2025 Danil Zagoskin + */ + +/dts-v1/; +#include +#include +#include +#include +#include "rk3326.dtsi" + +/ { + model = "Generic EE clone"; + compatible = "gameconsole,eeclone", "rockchip,rk3326"; + + aliases { + mmc0 = &emmc; + mmc1 = &sdmmc; + mmc2 = &sdio; + serial1 = &uart2; + serial2 = &uart5; + }; + + 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 = <4000000>; + 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 = <100>; + + /* disabled by default, dtbo may enable it when needed */ + status = "disabled"; + + button-vol-up { + press-threshold-microvolt = <15000>; + label = "VOLUMEUP"; + linux,code = ; + }; + + button-vol-down { + press-threshold-microvolt = <300000>; + label = "VOLUMEDOWN"; + linux,code = ; + }; + }; + + joypad: joypad { + compatible = "rocknix-singleadc-joypad"; + + joypad-name = "r36s_Gamepad"; + joypad-product = <0x1188>; + joypad-revision = <0x0188>; + + status = "okay"; + + /* gpio pincontrol setup */ + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins>; + + /* Analog mux define */ + io-channel-names = "amux_adc"; + io-channels = <&saradc 1>; + + /* adc mux channel count */ + amux-count = <4>; + /* non-default wiring */ + amux-channel-mapping = <2 3 1 0>; + /* adc mux enable gpio */ + amux-en-gpios = <&gpio2 RK_PB4 GPIO_ACTIVE_LOW>; /* rocker0-gpios */ + /* adc mux select(a,b) gpio */ + amux-a-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_LOW>; /* rocker1-gpios */ + amux-b-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_LOW>; /* rocker-gpios */ + + /* 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>; + + /* gpio button auto repeat set value : default disable */ + /* + autorepeat; + */ + + /* + 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 = ; // 0x220 + }; + sw2 { + gpios = <&gpio3 RK_PC7 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-DOWN"; + linux,code = ; // 0x221 + }; + sw3 { + gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-LEFT"; + linux,code = ; // 0x222 + }; + sw4 { + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-RIGHT"; + linux,code = ; // 0x223 + }; + + sw5 { + gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; + label = "GPIO KEY BTN-A"; + linux,code = ; // 0x131 + }; + sw6 { + gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-B"; + linux,code = ; // 0x130 + }; + sw7 { + gpios = <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-Y"; + linux,code = ; // 0x134 + }; + sw8 { + gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-X"; + linux,code = ; // 0x133 + }; + + sw11 { + gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_THUMBL"; + linux,code = ; // 0x2c2 + }; + sw12 { + gpios = <&gpio2 RK_PB6 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_THUMBR"; + linux,code = ; // 0x2c3 + }; + + sw13 { + gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_FN"; + linux,code = ; // 0x2c4 + }; + + sw15 { + gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-LEFT"; + linux,code = ; // 0x02 + }; + sw16 { + gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-RIGHT"; + linux,code = ; // 0x05 + }; + sw19 { + gpios = <&gpio3 RK_PD0 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_SELECT"; + linux,code = ; + }; + sw20 { + gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-RIGHT2"; + linux,code = ; + }; + sw21 { + gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-LEFT2"; + linux,code = ; + }; + sw22 { + gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_START"; + linux,code = ; + }; + }; + + leds: gpio-leds { + compatible = "gpio-leds"; + pinctrl-0 = <&led_pins>; + pinctrl-names = "default"; + + /* charge_red_gpio = <&gpio0 17 0>; */ + led-0 { + color = ; + default-state = "off"; + function = LED_FUNCTION_CHARGING; + linux,default-trigger = "none"; + gpios = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>; + }; + + /* charge_blue_gpio = <&gpio0 0 0>; */ + led-1 { + color = ; + default-state = "on"; + function = LED_FUNCTION_POWER; + linux,default-trigger = "default-on"; + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; + }; + }; + + 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 = + "Microphone", "Mic Jack", + "Headphone", "Headphones", + "Speaker", "Speaker"; + simple-audio-card,routing = + "MICL", "Mic Jack", + "Headphones", "HPOL", + "Headphones", "HPOR", + "Speaker", "SPKO"; + + simple-audio-card,codec { + sound-dai = <&rk817>; + }; + + simple-audio-card,cpu { + sound-dai = <&i2s1_2ch>; + }; + }; + + vccsys: vccsys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_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>; + }; +}; + +&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 = "magicx,xu10-panel", "sitronix,st7703"; + 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>; + + 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 = <850000>; + 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 = <1800000>; + 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-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc3v0_dvp: LDO_REG8 { + regulator-name = "vcc3v0_dvp"; + 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>; + }; + }; + + 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 = <4900000>; + regulator-max-microvolt = <5400000>; + regulator-always-on; + regulator-boot-on; + }; + + /* + otg_switch: OTG_SWITCH { + regulator-name = "otg_switch"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + */ + }; + + 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 = <800>; + 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; + vqmmc-supply = <&vccio_sd>; + vmmc-supply = <&vcc_sd>; + status = "okay"; +}; + +&sdio { + cap-sd-highspeed; + max-frequency = <100000000>; + cd-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; + card-detect-delay = <800>; + supports-sd; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vqmmc-supply = <&vcc2v8_dvp>; + vmmc-supply = <&vcc3v0_dvp>; + status = "okay"; +}; + +&emmc { + status = "okay"; + no-sdio; + no-sd; + disable-wp; + non-removable; + num-slots = <1>; +}; + +&tsadc { + status = "okay"; +}; + +&u2phy { + status = "okay"; + + u2phy_host: host-port { + status = "okay"; + }; + + u2phy_otg: otg-port { + status = "disabled"; + }; +}; + +&usb20_otg { + status = "okay"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; +&pinctrl { + btns { + btn_pins: btn-pins { + rockchip,pins = + <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>, + <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>, + <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PC2 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PC3 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PC7 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + 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_PA0 RK_FUNC_GPIO &pcfg_pull_none>, /* charge_blue_gpio = <&gpio0 0 0>; */ + <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; /* charge_red_gpio = <&gpio0 17 0>; */ + }; + }; + + 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>; + }; + }; +}; + +&uart5 { + status = "okay"; +}; +&uart2 { + status = "disabled"; +}; + + +&internal_display { + compatible = "rocknix,generic-dsi"; + 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"; +}; + + diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r33s.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r33s.dts new file mode 100644 index 0000000000..5a93510a76 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r33s.dts @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * # Copyright (C) 2022-24 JELOS (https://github.com/JustEnoughLinuxOS) + */ + +/dts-v1/; +#include "rk3326-gameconsole-r3xs.dtsi" + +/ { + model = "Game Console R33S"; + compatible = "gameconsole,r33s", "rockchip,rk3326"; + + builtin_gamepad: r33s_joypad { + compatible = "rocknix-singleadc-joypad"; + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins>; + joypad-name = "r33s_joypad"; + joypad-product = <0x0AA2>; + joypad-revision = <0x0100>; + joypad-vendor = <0x0001>; + + status = "okay"; + amux-count = <0>; + /* poll device interval (ms), adc read interval */ + poll-interval = <10>; + pwms = <&pwm0 0 1000000000 0>; + pwm-names = "enable"; + rumble-boost-weak = <0x0000>; + rumble-boost-strong = <0x0000>; + + button-sw1 { + gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; + label = "DPAD-UP"; + linux,code = ; + }; + button-sw2 { + gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; + label = "DPAD-DOWN"; + linux,code = ; + }; + button-sw3 { + gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; + label = "DPAD-LEFT"; + linux,code = ; + }; + button-sw4 { + gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; + label = "DPAD-RIGHT"; + linux,code = ; + }; + button-sw5 { + gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; + label = "BTN-A"; + linux,code = ; + }; + button-sw6 { + gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; + label = "BTN-B"; + linux,code = ; + }; + button-sw7 { + gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; + label = "BTN-Y"; + linux,code = ; + }; + button-sw8 { + gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; + label = "BTN-X"; + linux,code = ; + }; + button-sw9 { + gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; + label = "TOP-LEFT"; + linux,code = ; + }; + button-sw10 { + gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; + label = "TOP-RIGHT"; + linux,code = ; + }; + button-sw11 { + gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; + label = "SELECT"; + linux,code = ; + }; + button-sw12 { + gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + label = "TOP-RIGHT 2"; + linux,code = ; + }; + button-sw13 { + gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; + label = "TOP-LEFT 2"; + linux,code = ; + }; + button-sw14 { + gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; + label = "START"; + linux,code = ; + }; + }; +}; + +&pinctrl { + btns { + btn_pins: btn-pins { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r36s.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r36s.dts new file mode 100644 index 0000000000..45ce508962 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r36s.dts @@ -0,0 +1,202 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * # Copyright (C) 2022-24 JELOS (https://github.com/JustEnoughLinuxOS) + */ + +/dts-v1/; +#include "rk3326-gameconsole-r3xs.dtsi" + +/ { + model = "Game Console R36S"; + compatible = "gameconsole,r35s", "gameconsole,r36s", "rockchip,rk3326"; + + joypad: odroidgo3-joypad { + compatible = "odroidgo3-joypad"; + pwms = <&pwm0 0 200000000 0>; + pwm-names = "enable"; + rumble-boost-weak = <0x0000>; + rumble-boost-strong = <0x0000>; + + joypad-name = "r36s_Gamepad"; + joypad-product = <0x1188>; + joypad-revision = <0x0188>; + + status = "okay"; + + /* gpio pincontrol setup */ + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins>; + pinctrl-1 = <&pwm0_pin>; + + /* Analog mux define */ + io-channel-names = "amux_adc"; + io-channels = <&saradc 1>; + + /* adc mux channel count */ + amux-count = <4>; + /* adc mux select(a,b) gpio */ + amux-a-gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; + amux-b-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; + /* adc mux enable gpio */ + amux-en-gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; + + /* 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 RG36S */ + invert-absx; + invert-absy; + + /* gpio button auto repeat set value : default disable */ + /* + autorepeat; + */ + + /* + joypad driver is poll-device driver. + poll-device is does not support wakeup-source. + */ + sw1 { + gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-UP"; + linux,code = ; // 0x220 + }; + sw2 { + gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-DOWN"; + linux,code = ; // 0x221 + }; + sw3 { + gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-LEFT"; + linux,code = ; // 0x222 + }; + sw4 { + gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-RIGHT"; + linux,code = ; // 0x223 + }; + sw5 { + gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; + label = "GPIO KEY BTN-A"; + linux,code = ; // 0x131 + }; + sw6 { + gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-B"; + linux,code = ; // 0x130 + }; + sw7 { + gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-Y"; + linux,code = ; // 0x134 + }; + sw8 { + gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-X"; + linux,code = ; // 0x133 + }; + sw11 { + gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_THUMBL"; + linux,code = ; // 0x2c2 + }; + sw12 { + gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_THUMBR"; + linux,code = ; // 0x2c3 + }; + sw13 { + gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_FN"; + linux,code = ; // 0x2c4 + }; + sw15 { + gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-LEFT"; + linux,code = ; // 0x02 + }; + sw16 { + gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-RIGHT"; + linux,code = ; // 0x05 + }; + sw19 { + gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_SELECT"; + linux,code = ; + }; + sw20 { + gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-RIGHT2"; + linux,code = ; + }; + sw21 { + gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-LEFT2"; + linux,code = ; + }; + sw22 { + gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; + label = "GPIO BTN_START"; + linux,code = ; + }; + }; +}; + +&pinctrl { + btns { + btn_pins: btn-pins { + rockchip,pins = <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; + + }; + + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r3xs.dtsi b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r3xs.dtsi new file mode 100644 index 0000000000..de1b0d51e2 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r3xs.dtsi @@ -0,0 +1,545 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * # Copyright (C) 2022-24 JELOS (https://github.com/JustEnoughLinuxOS) + */ + +/dts-v1/; +#include +#include +#include +#include +#include "rk3326.dtsi" + +/ { + model = "Game Console R33S"; + compatible = "gameconsolec,r33s", "rockchip,rk3326"; + + aliases { + mmc0 = &sdio; + mmc1 = &sdmmc; + }; + + chosen { + stdout-path = "serial2:115200n8"; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + power-supply = <&vcc_bl>; + 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>; + }; + + gpio-keys-vol { + compatible = "gpio-keys"; + autorepeat; + pinctrl-0 = <&btn_pins_vol>; + pinctrl-names = "default"; + + button-vol-down { + gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; + label = "VOLUMEDOWN"; + linux,code = ; + }; + + button-volume-up { + gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; + label = "VOLUMEUP"; + linux,code = ; + }; + }; + + battery: battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <3200000>; + charge-term-current-microamp = <320000>; + constant-charge-current-max-microamp = <2000000>; + constant-charge-voltage-max-microvolt = <4200000>; + factory-internal-resistance-micro-ohms = <180000>; + voltage-max-design-microvolt = <4100000>; + voltage-min-design-microvolt = <3500000>; + + ocv-capacity-celsius = <20>; + ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, + <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, + <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, + <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, + <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, + <3574170 0>; + + }; + + rk817-sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "rk817_int"; + 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 = + "Microphone", "Mic Jack", + "Headphone", "Headphones", + "Speaker", "Speaker"; + simple-audio-card,routing = + "MICL", "Mic Jack", + "Headphones", "HPOL", + "Headphones", "HPOR", + "Speaker", "SPKO"; + + 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-min-microvolt = <3800000>; + regulator-max-microvolt = <3800000>; + }; +}; + +&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 { + reg = <0>; + backlight = <&backlight>; + reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; + + port { + mipi_in_panel: endpoint { + remote-endpoint = <&mipi_out_panel>; + }; + }; + }; +}; + +&dsi_dphy { + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_logic>; + status = "okay"; +}; + +&internal_display { + compatible = "gameconsole,r36s-panel", "sitronix,st7703"; + iovcc-supply = <&vcc_lcd>; + vdd-supply = <&vcc_lcd>; +}; + +&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 = <&vccsys>; + vcc8-supply = <&vccsys>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1150000>; + 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-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-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_3v3: DCDC_REG4 { + regulator-name = "vcc_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_1v8: LDO_REG2 { + regulator-name = "vcc_1v8"; + 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>; + }; + }; + + vdd_1v0: LDO_REG3 { + regulator-name = "vdd_1v0"; + 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>; + }; + }; + + vcc3v3_pmu: LDO_REG4 { + regulator-name = "vcc3v3_pmu"; + 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>; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + 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>; + }; + }; + + vcc_sd: LDO_REG6 { + regulator-name = "vcc_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc_bl: LDO_REG7 { + regulator-name = "vcc_bl"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_lcd: LDO_REG8 { + regulator-name = "vcc_lcd"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <2800000>; + }; + }; + + LDO_REG9 { + /* unused */ + }; + + usb_midu: BOOST { + regulator-name = "usb_midu"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5400000>; + regulator-always-on; + regulator-boot-on; + }; + }; + + rk817_charger: charger { + 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; + }; + }; +}; + +&i2s1_2ch { + status = "okay"; +}; + +&io_domains { + vccio1-supply = <&vccio_sd>; + vccio2-supply = <&vccio_sd>; + vccio3-supply = <&vcc_3v3>; + vccio4-supply = <&vcc_3v3>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + status = "okay"; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + status = "okay"; +}; + +&pwm0 { + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&saradc { + vref-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-sd-highspeed; + card-detect-delay = <800>; + cd-gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/ + disable-wp; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&sdio { + bus-width = <4>; + cap-sd-highspeed; + card-detect-delay = <800>; + cd-gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/ + disable-wp; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&tsadc { + status = "okay"; +}; + +&u2phy { + status = "okay"; + + u2phy_host: host-port { + status = "okay"; + }; + + u2phy_otg: otg-port { + status = "disabled"; + }; +}; + +&usb20_otg { + status = "okay"; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2m1_xfer>; + status = "okay"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&rk817_charger { + monitored-battery = <&battery>; +}; + +&pinctrl { + btns { + btn_pins_vol: btn-pins-vol { + rockchip,pins = <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + 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>; + }; + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameforce-chi.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameforce-chi.dts new file mode 100644 index 0000000000..7b47cf7017 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-gameforce-chi.dts @@ -0,0 +1,811 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2024 Chris Morgan + */ + +/dts-v1/; +#include +#include +#include +#include +#include "rk3326.dtsi" + +/ { + model = "GameForce Chi"; + compatible = "gameforce,chi", "rockchip,rk3326"; + chassis-type = "handset"; + + aliases { + mmc0 = &sdmmc; + mmc1 = &sdio; + }; + + chosen { + stdout-path = "serial2:115200n8"; + }; + + adc_joystick: adc-joystick { + compatible = "adc-joystick"; + io-channels = <&saradc 0>, + <&saradc 1>; + poll-interval = <100>; + #address-cells = <1>; + #size-cells = <0>; + + axis@0 { + reg = <0>; + abs-flat = <10>; + abs-fuzz = <10>; + abs-range = <850 175>; + linux,code = ; + }; + + axis@1 { + reg = <1>; + abs-flat = <10>; + abs-fuzz = <10>; + abs-range = <800 190>; + linux,code = ; + }; + }; + + adc_keys: adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 2>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1800000>; + poll-interval = <60>; + + button-1 { + label = "HAPPY1"; + linux,code = ; + press-threshold-microvolt = <15000>; + }; + + button-2 { + label = "HAPPY2"; + linux,code = ; + press-threshold-microvolt = <300000>; + }; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + power-supply = <&vcc_bl>; + pwms = <&pwm1 0 25000 0>; + }; + + battery: battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <3000000>; + charge-term-current-microamp = <300000>; + constant-charge-current-max-microamp = <1500000>; + constant-charge-voltage-max-microvolt = <4200000>; + factory-internal-resistance-micro-ohms = <180000>; + ocv-capacity-celsius = <20>; + ocv-capacity-table-0 = <4106000 100>, <4071000 95>, <4018000 90>, <3975000 85>, + <3946000 80>, <3908000 75>, <3877000 70>, <3853000 65>, + <3834000 60>, <3816000 55>, <3802000 50>, <3788000 45>, + <3774000 40>, <3760000 35>, <3748000 30>, <3735000 25>, + <3718000 20>, <3697000 15>, <3685000 10>, <3625000 5>, + <3400000 0>; + voltage-max-design-microvolt = <4250000>; + voltage-min-design-microvolt = <3400000>; + }; + + gpio_leds: gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pins>; + + red_led: led-0 { + color = ; + gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>; + }; + + green_led: led-1 { + color = ; + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + }; + + blue_led: led-2 { + color = ; + gpios = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>; + }; + + white_led: led-3 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_HIGH>; + }; + + chg_led: led-4 { + color = ; + function = LED_FUNCTION_CHARGING; + gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_HIGH>; + }; + + }; + + gpio_keys: gpio-keys { + compatible = "gpio-keys"; + pinctrl-0 = <&btn_pins_ctrl>; + pinctrl-names = "default"; + + button-a { + gpios = <&gpio2 RK_PB0 GPIO_ACTIVE_LOW>; + label = "EAST"; + linux,code = ; + }; + + button-b { + gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>; + label = "SOUTH"; + linux,code = ; + }; + + button-down { + gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; + label = "DPAD-DOWN"; + linux,code = ; + }; + + button-home { + gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; + label = "HOME"; + linux,code = ; + }; + + button-l1 { + gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; + label = "TL"; + linux,code = ; + }; + + button-l2 { + gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; + label = "TL2"; + linux,code = ; + }; + + button-left { + gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; + label = "DPAD-LEFT"; + linux,code = ; + }; + + button-r1 { + gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; + label = "TR"; + linux,code = ; + }; + + button-r2 { + gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; + label = "TR2"; + linux,code = ; + }; + + button-right { + gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; + label = "DPAD-RIGHT"; + linux,code = ; + }; + + button-select { + gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; + label = "SELECT"; + linux,code = ; + }; + + button-start { + gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; + label = "START"; + linux,code = ; + }; + + button-up { + gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; + label = "DPAD-UP"; + linux,code = ; + }; + + button-x { + gpios = <&gpio2 RK_PB3 GPIO_ACTIVE_LOW>; + label = "NORTH"; + linux,code = ; + }; + + button-y { + gpios = <&gpio2 RK_PB2 GPIO_ACTIVE_LOW>; + label = "WEST"; + linux,code = ; + }; + }; + + multi-led { + compatible = "leds-group-multicolor"; + color = ; + function = LED_FUNCTION_KBD_BACKLIGHT; + leds = <&red_led>, <&green_led>, <&blue_led>; + }; + + spk_amp: audio-amplifier { + compatible = "simple-audio-amplifier"; + enable-gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&spk_amp_enable_h>; + pinctrl-names = "default"; + sound-name-prefix = "Speaker Amp"; + }; + + sound { + compatible = "simple-audio-card"; + pinctrl-0 = <&hp_det>; + pinctrl-names = "default"; + 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 = + "Microphone", "Mic Jack", + "Headphone", "Headphones", + "Speaker", "Internal Speakers"; + simple-audio-card,routing = + "MICL", "Mic Jack", + "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>; + }; + }; + + vibrator_left: pwm-vibrator-l { + compatible = "pwm-vibrator"; + pwm-names = "enable"; + pwms = <&pwm4 0 25000 0>; + }; + + vibrator_right: pwm-vibrator-r { + compatible = "pwm-vibrator"; + pwm-names = "enable"; + pwms = <&pwm5 0 25000 0>; + }; + + 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 = <200>; + reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; + }; + + vccsys: regulator-vccsys { + compatible = "regulator-fixed"; + regulator-name = "vcc3v8_sys"; + regulator-always-on; + regulator-min-microvolt = <3800000>; + regulator-max-microvolt = <3800000>; + }; +}; + +&cpu0 { + cpu-supply = <&vdd_arm>; +}; + +&cpu1 { + cpu-supply = <&vdd_arm>; +}; + +&cpu2 { + cpu-supply = <&vdd_arm>; +}; + +&cpu3 { + cpu-supply = <&vdd_arm>; +}; + +&display_subsystem { + status = "okay"; +}; + +&dsi { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + internal_display: panel@0 { + reg = <0>; + compatible = "gameforce,chi-panel"; + backlight = <&backlight>; + iovcc-supply = <&vcc_lcd>; + vcc-supply = <&vcc_lcd>; + reset-gpios = <&gpio3 RK_PA0 GPIO_ACTIVE_LOW>; + + port { + mipi_in_panel: endpoint { + remote-endpoint = <&mipi_out_panel>; + }; + }; + }; + + ports { + mipi_out: port@1 { + reg = <1>; + + mipi_out_panel: endpoint { + remote-endpoint = <&mipi_in_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>; + #clock-cells = <1>; + clock-names = "mclk"; + clock-output-names = "rk808-clkout1", "xin32k"; + clocks = <&cru SCLK_I2S1_OUT>; + interrupt-parent = <&gpio0>; + interrupts = ; + pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>; + pinctrl-names = "default"; + #sound-dai-cells = <0>; + system-power-controller; + wakeup-source; + + 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>; + vcc9-supply = <&dcdc_boost>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1150000>; + regulator-min-microvolt = <950000>; + regulator-name = "vdd_logic"; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vdd_arm: DCDC_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1350000>; + regulator-min-microvolt = <950000>; + regulator-name = "vdd_arm"; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vcc_ddr"; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_3v0: DCDC_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <3000000>; + regulator-min-microvolt = <3000000>; + regulator-name = "vcc_3v0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc_1v8: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1800000>; + regulator-min-microvolt = <1800000>; + regulator-name = "vcc_1v8"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_1v0: LDO_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1000000>; + regulator-min-microvolt = <1000000>; + regulator-name = "vdd_1v0"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + + vcc_3v0_pmu: LDO_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <3000000>; + regulator-min-microvolt = <3000000>; + regulator-name = "vcc_3v0_pmu"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <1800000>; + regulator-name = "vccio_sd"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_sd: LDO_REG6 { + regulator-boot-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc_sd"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_bl: LDO_REG7 { + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc_bl"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_lcd: LDO_REG8 { + regulator-max-microvolt = <2800000>; + regulator-min-microvolt = <2800000>; + regulator-name = "vcc_lcd"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <2800000>; + }; + }; + + vcc_wifi: LDO_REG9 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc_wifi"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + dcdc_boost: BOOST { + regulator-max-microvolt = <5000000>; + regulator-min-microvolt = <5000000>; + regulator-name = "dcdc_boost"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + otg_switch: OTG_SWITCH { + regulator-name = "otg_switch"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + + rk817_charger: charger { + monitored-battery = <&battery>; + rockchip,resistor-sense-micro-ohms = <10000>; + rockchip,sleep-enter-current-microamp = <300000>; + rockchip,sleep-filter-current-microamp = <100000>; + }; + }; +}; + +&i2s1_2ch { + status = "okay"; +}; + +&io_domains { + vccio1-supply = <&vcc_3v0_pmu>; + vccio2-supply = <&vccio_sd>; + vccio3-supply = <&vcc_3v0>; + vccio4-supply = <&vcc_3v0>; + vccio5-supply = <&vcc_3v0>; + vccio6-supply = <&vcc_3v0>; + status = "okay"; +}; + +&pinctrl { + bluetooth-pins { + bt_reset: bt-reset { + rockchip,pins = + <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + bt_wake_dev: bt-wake-dev { + rockchip,pins = + <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake_host: bt-wake-host { + rockchip,pins = + <0 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = + <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + gpio-btns { + btn_pins_ctrl: btn-pins-ctrl { + rockchip,pins = + <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + gpio-leds { + led_pins: led-pins { + rockchip,pins = + <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>, + <3 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>, + <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>, + <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>, + <3 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int: pmic-int { + rockchip,pins = + <0 RK_PC1 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>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = + <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + speaker { + spk_amp_enable_h: spk-amp-enable-h { + rockchip,pins = + <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc_1v8>; + pmuio2-supply = <&vcc_3v0_pmu>; + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&pwm4 { + status = "okay"; +}; + +&pwm5 { + status = "okay"; +}; + +&saradc { + vref-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdio { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + disable-wp; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + no-mmc; + no-sd; + non-removable; + sd-uhs-sdr104; + status = "okay"; +}; + +&sdmmc { + cap-mmc-highspeed; + cap-sd-highspeed; + no-sdio; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&sfc { + #address-cells = <1>; + pinctrl-0 = <&sfc_clk &sfc_cs0 &sfc_bus2>; + pinctrl-names = "default"; + #size-cells = <0>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <108000000>; + spi-rx-bus-width = <2>; + spi-tx-bus-width = <1>; + }; +}; + +&tsadc { + status = "okay"; +}; + +&u2phy { + status = "okay"; + + u2phy_otg: otg-port { + status = "okay"; + }; +}; + +&usb20_otg { + status = "okay"; +}; + +/* + * The right ADC joystick exists connected to an unknown ADC + * controller which can be communicated with via uart0. This ADC device + * is an 8-pin SOIC with no markings located right next to the left ADC + * joystick ribbon cable. The pinout for this ADC controller appears to + * be pin 1 - VCC (2.8v), pin 2 - 1.8v (clk maybe?), pin 3 - GPIO 10, + * pin 4 - unknown, pin 5 - unknown, pin 6 - analog in, pin 7 - analog in, + * pin 8 - ground. There is currently a userspace UART driver for this + * device but it only works with the BSP joystick driver. + */ +&uart0 { + status = "okay"; +}; + +/* + * Bluetooth was not working on BSP and is not currently working on + * mainline due to missing firmware. Bluetooth requires removal of DMA + * or else it will not probe. + */ +&uart1 { + /delete-property/ dma-names; + /delete-property/ dmas; + uart-has-rtscts; + status = "okay"; + + bluetooth: bluetooth { + compatible = "realtek,rtl8723ds-bt"; + device-wake-gpios = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; + enable-gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; + host-wake-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&bt_reset>, <&bt_wake_dev>, <&bt_wake_host>; + pinctrl-names = "default"; + }; +}; + +&uart2 { + pinctrl-0 = <&uart2m1_xfer>; + pinctrl-names = "default"; + status = "okay"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-magicx-xu-mini-m.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-magicx-xu-mini-m.dts new file mode 100644 index 0000000000..e857d9d4c8 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-magicx-xu-mini-m.dts @@ -0,0 +1,109 @@ +/// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2024-present ROCKNIX (https://github.com/ROCKNIX) + * Copyright (c) 2024 Olivier Schonken + */ + +#include "rk3326-magicx-xu10.dts" + +/ { + model = "MagicX XU Mini M"; + compatible = "magicx,xu-mini-m", "rockchip,rk3326"; +}; + +&battery { + charge-full-design-microamp-hours = <2600000>; +}; + +&dsi { + internal_display: panel@0 { + compatible = "rocknix,generic-dsi"; + panel_description = + "G size=69,139 delays=5,20,20,120,20 format=rgb888 lanes=2 flags=0xe03", + + "M clock=25000 horizontal=480,60,10,54 vertical=640,20,10,20 default=1", + "M clock=25200 horizontal=480,60,22,54 vertical=640,20,139,20", + "M clock=25000 horizontal=480,60,31,54 vertical=640,20,120,20", + "M clock=25660 horizontal=480,60,22,54 vertical=640,20,153,20", + "M clock=25300 horizontal=480,60,31,54 vertical=640,20,24,20", + "M clock=28590 horizontal=480,60,15,54 vertical=640,20,106,20", + "M clock=25380 horizontal=480,60,17,54 vertical=640,20,13,20", + "M clock=25410 horizontal=480,60,11,54 vertical=640,20,20,20", + "M clock=29490 horizontal=480,60,24,54 vertical=640,20,114,20", + "M clock=33520 horizontal=480,60,36,54 vertical=640,20,25,20", + "M clock=38430 horizontal=480,60,16,54 vertical=640,20,20,20", + "M clock=50820 horizontal=480,60,11,54 vertical=640,20,20,20", + + "I seq=ff7701000013", + "I seq=ef08", + "I seq=ff7701000010", + "I seq=c04f00", "I seq=c11002", "I seq=c22002", "I seq=cc10", + "I seq=b006161e0e12060a0809230412102b311f", + "I seq=b1060f160d100704090720051210262f1f", + "I seq=ff7701000011", + "I seq=b065", "I seq=b185", "I seq=b282", "I seq=b380", "I seq=b542", "I seq=b785", + "I seq=b820", + "I seq=c178", "I seq=c278", + "I seq=d088", + "I seq=e0000002", + "I seq=e104a006a005a007a0004444", + "I seq=e2000000000000000000000000", + "I seq=e300002222", + "I seq=e44444", + "I seq=e50c90a0a00e92a0a0088ca0a00a8ea0a0", + "I seq=e600002222", + "I seq=e74444", + "I seq=e80d91a0a00f93a0a0098da0a00b8fa0a0", + "I seq=eb0000e4e4440040", + "I seq=edfff5476f0ba1abffffba1ab0f6745fff", + "I seq=ef080808403f64", + "I seq=ff7701000013", + "I seq=e6167c", "I seq=e8000e", + "I seq=e8000c wait=50", + "I seq=e80000", + "I seq=ff7701000000", + "I seq=11 wait=150", + "I seq=29 wait=120"; + rotation = <90>; + }; +}; + +&joypad { + joypad-name = "XU Mini M Gamepad"; + + invert-absrx; + /delete-property/ invert-absx; + + sw5 { + gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-B"; + }; + sw6 { + gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-A"; + }; + sw7 { + gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-X"; + }; + sw8 { + gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-Y"; + }; + sw16 { + gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; + }; + sw17 { + gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; + }; +}; + +&pinctrl { + headphone { + hp_det: hp-det { + rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; +}; + + diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-magicx-xu10.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-magicx-xu10.dts new file mode 100644 index 0000000000..3fe532e06d --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-magicx-xu10.dts @@ -0,0 +1,872 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Hardkernel Co., Ltd + * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH + * Copyright (c) 2022 Maya Matuszczyk + */ + +/dts-v1/; +#include +#include +#include +#include +#include "rk3326.dtsi" + +/ { + model = "MagicX XU10"; + compatible = "magicx,xu10", "rockchip,rk3326"; + + aliases { + mmc0 = &sdio; + mmc1 = &sdmmc; + }; + + 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>; + }; + + joypad: xu10-joypad { + compatible = "xu10-joypad"; + + joypad-name = "XU10 Gamepad"; + joypad-product = <0x0200>; + joypad-revision = <0x0010>; + + status = "okay"; + /* + - xu10-joypad sysfs list - + * for poll device interval(ms) + /sys/devices/platform/odroidgo3_joypad/poll_interval [rw] + ex) echo 20 > poll_interval + * for button-adc-fuzz + /sys/devices/platform/odroidgo3_joypad/adc_fuzz [r] + * for button-adc-flat + /sys/devices/platform/odroidgo3_joypad/adc_flat [r] + + * for report control(1:enable, 0:disable) + /sys/devices/platform/odroidgo3_joypad/enable [rw] + * for adc calibration value setup(current adcs value -> cal value) + /sys/devices/platform/odroidgo3_joypad/adc_cal [rw] + ex) echo 0 > adc_cal + * for amux data debug + * Joypad driver is disabled when using this sysfs. + /sys/devices/platform/odroidgo3_joypad/amux_debug [rw] + ex) echo 0 > amux_debug --> select amux channel + ex) cat amux_debug --> get adc data of seleted channel + */ + + /* gpio pincontrol setup */ + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins>; + + /* Analog mux define */ + io-channel-names = "joy_left", "joy_right"; + io-channels = <&saradc 1>, <&saradc 2>; + + /* adc mux channel count */ + amux-count = <4>; + + /* adc mux select(a,b) gpio */ + amux-a-gpios = <&gpio2 RK_PB3 GPIO_ACTIVE_LOW>; + amux-b-gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>; + + /* adc mux enable gpio */ + amux-en-gpios = <&gpio1 RK_PB0 GPIO_ACTIVE_LOW>; + + /* adc calculate scale */ + button-adc-scale = <2>; + + /* adc deadzone range */ + button-adc-deadzone = <180>; + + /* + 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 XU10 */ + invert-absx; + invert-absy; + + /* 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 = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-UP"; + linux,code = ; // 0x220 + }; + sw2 { + gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-DOWN"; + linux,code = ; // 0x221 + }; + sw3 { + gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-LEFT"; + linux,code = ; // 0x222 + }; + sw4 { + gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-RIGHT"; + linux,code = ; // 0x223 + }; + sw5 { + gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-A"; + linux,code = ; // 0x130 + }; + sw6 { + gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-B"; + linux,code = ; // 0x131 + }; + sw7 { + gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-Y"; + linux,code = ; // 0x133 + }; + sw8 { + gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-X"; + linux,code = ; // 0x134 + }; + sw9 { + gpios = <&gpio2 RK_PB0 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-SELECT"; + linux,code = ; // 0x13a + }; + sw10 { + gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-START"; + linux,code = ; // 0x13b + }; + sw11 { + gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-THUMBL"; + linux,code = ; // 0x13d + }; + sw12 { + gpios = <&gpio2 RK_PB2 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-THUMBR"; + linux,code = ; // 0x13e + }; + sw13 { + gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-G"; + linux,code = ; // 0x2c0 + }; + sw14 { + gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-LEFT"; + linux,code = ; // 0x136 + }; + sw15 { + gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-RIGHT"; + linux,code = ; // 0x137 + }; + sw16 { + gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-RIGHT2"; + linux,code = ; // 0x139 + }; + sw17 { + gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-LEFT2"; + linux,code = ; // 0x138 + }; + }; + + 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>; + }; + + gpio-keys-vol { + compatible = "gpio-keys"; + autorepeat; + pinctrl-0 = <&btn_pins_vol>; + pinctrl-names = "default"; + + button-vol-down { + gpios = <&gpio0 RK_PC1 GPIO_ACTIVE_LOW>; + label = "VOLUMEDOWN"; + linux,code = ; + }; + + button-vol-up { + gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>; + label = "VOLUMEUP"; + linux,code = ; + }; + }; + + leds: gpio-leds { + compatible = "gpio-leds"; + pinctrl-0 = <&led_pins>; + pinctrl-names = "default"; + + led-0 { + color = ; + default-state = "off"; + function = LED_FUNCTION_CHARGING; + gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; + }; + + led-1 { + color = ; + default-state = "off"; + function = LED_FUNCTION_STATUS; + gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; + }; + }; + + rk817-sound { + compatible = "simple-audio-card"; + pinctrl-names = "default"; + pinctrl-0 = <&hp_det>; + simple-audio-card,name = "rk817_int"; + simple-audio-card,format = "i2s"; + simple-audio-card,hp-det-gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_LOW>; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,widgets = + "Microphone", "Mic Jack", + "Headphone", "Headphones", + "Speaker", "Speaker"; + simple-audio-card,routing = + "MICL", "Mic Jack", + "Headphones", "HPOL", + "Headphones", "HPOR", + "Speaker", "SPKO"; + + 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-min-microvolt = <3800000>; + regulator-max-microvolt = <3800000>; + }; + + 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 = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + regulator-boot-on; + vin-supply = <&usb_midu>; + }; +}; + +&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 = "magicx,xu10-panel", "sitronix,st7703"; + 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>; + + 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>; + vcc9-supply = <&usb_midu>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <1150000>; + 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 = <850000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + 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-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_3v0: DCDC_REG4 { + regulator-name = "vcc_3v0"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + 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 = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc2v8_dvp: LDO_REG7 { + regulator-name = "vcc2v8_dvp"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <2800000>; + }; + }; + + vcc3v0_dvp: LDO_REG8 { + regulator-name = "vcc3v0_dvp"; + 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>; + }; + }; + + vdd1v5_dvp: LDO_REG9 { + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-name = "vdd1v5_dvp"; + + 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 = <&vcc1v8_soc>; + vccio2-supply = <&vccio_sd>; + vccio3-supply = <&vcc3v0_dvp>; + vccio4-supply = <&vcc_3v0>; + vccio5-supply = <&vcc_3v0>; + vccio6-supply = <&vcc_3v0>; + 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 { + cap-sd-highspeed; + card-detect-delay = <200>; + cd-gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/ + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&tsadc { + status = "okay"; +}; + +&u2phy { + status = "okay"; + + u2phy_host: host-port { + status = "okay"; + }; + + u2phy_otg: otg-port { + status = "disabled"; + }; +}; + +/* FIQ Header(P2): 2(RXD:GPIO2.B4),3(TXD:.B6) */ +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2m1_xfer>; + status = "okay"; +}; + +&usb20_otg { + status = "okay"; + dr_mode = "host"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&pinctrl { + btns { + btn_pins: btn-pins { + rockchip,pins = <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + btn_pins_vol: btn-pins-vol { + rockchip,pins = + <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up>, + <0 RK_PB7 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>; + }; + }; + + gpio-led { + led_pins: led-pins { + rockchip,pins = + <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>, + <0 RK_PB4 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>; + }; + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-odroid-go.dtsi b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-odroid-go.dtsi new file mode 100644 index 0000000000..b655d10598 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-odroid-go.dtsi @@ -0,0 +1,568 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Hardkernel Co., Ltd + * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH + * Copyright (c) 2022 Maya Matuszczyk + */ + +/dts-v1/; +#include +#include +#include +#include +#include "rk3326.dtsi" + +/ { + aliases { + mmc0 = &sdmmc; + }; + + chosen { + stdout-path = "serial2:115200n8"; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + power-supply = <&vcc_bl>; + 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>; + }; + + /* led-1 is wired directly to output of always-on regulator */ + + gpio_led: gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&red_led_pin>; + + red_led: led-3 { + color = ; + gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; + function = LED_FUNCTION_CHARGING; + }; + }; + + pwm_led: led-controller { + compatible = "pwm-leds"; + + blue_led: led-2 { + color = ; + function = LED_FUNCTION_STATUS; + linux,default-trigger = "heartbeat"; + max-brightness = <255>; + pwms = <&pwm3 0 25000 0>; + }; + }; + + rk817-sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "rk817_int"; + 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 = + "Microphone", "Mic Jack", + "Headphone", "Headphones", + "Speaker", "Speaker"; + simple-audio-card,routing = + "MICL", "Mic Jack", + "Headphones", "HPOL", + "Headphones", "HPOR", + "Speaker", "SPKO"; + + simple-audio-card,codec { + sound-dai = <&rk817>; + }; + + simple-audio-card,cpu { + sound-dai = <&i2s1_2ch>; + }; + }; + + vccsys: regulator-vccsys { + compatible = "regulator-fixed"; + regulator-name = "vcc3v8_sys"; + regulator-always-on; + regulator-min-microvolt = <3800000>; + regulator-max-microvolt = <3800000>; + }; + + vcc_host: regulator-vcc-host { + compatible = "regulator-fixed"; + regulator-name = "vcc_host"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + + gpio = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + regulator-boot-on; + vin-supply = <&usb_midu>; + }; +}; + +&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 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + ports { + mipi_out: port@1 { + reg = <1>; + + mipi_out_panel: endpoint { + remote-endpoint = <&mipi_in_panel>; + }; + }; + }; + + internal_display: panel@0 { + reg = <0>; + backlight = <&backlight>; + reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; + + 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 = <&vccsys>; + vcc8-supply = <&vccsys>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1150000>; + 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-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-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_3v3: DCDC_REG4 { + regulator-name = "vcc_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_1v8: LDO_REG2 { + regulator-name = "vcc_1v8"; + 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>; + }; + }; + + vdd_1v0: LDO_REG3 { + regulator-name = "vdd_1v0"; + 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>; + }; + }; + + vcc3v3_pmu: LDO_REG4 { + regulator-name = "vcc3v3_pmu"; + 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>; + }; + }; + + 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-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_bl: LDO_REG7 { + regulator-name = "vcc_bl"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_lcd: LDO_REG8 { + regulator-name = "vcc_lcd"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <2800000>; + }; + }; + + LDO_REG9 { + /* unused */ + }; + + usb_midu: BOOST { + regulator-name = "usb_midu"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5400000>; + regulator-always-on; + regulator-boot-on; + }; + }; + + rk817_charger: charger { + 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; + }; + }; +}; + +/* EXT Header(P2): 7(SCL:GPIO0.C2), 8(SDA:GPIO0.C3) */ +&i2c1 { + clock-frequency = <400000>; + status = "okay"; +}; + +/* I2S 1 Channel Used */ +&i2s1_2ch { + status = "okay"; +}; + +&io_domains { + vccio1-supply = <&vcc_3v3>; + vccio2-supply = <&vccio_sd>; + vccio3-supply = <&vcc_3v3>; + vccio4-supply = <&vcc_3v3>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + status = "okay"; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&pwm3 { + status = "okay"; +}; + +&saradc { + vref-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc { + cap-sd-highspeed; + card-detect-delay = <200>; + cd-gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/ + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&sfc { + pinctrl-0 = <&sfc_clk &sfc_cs0 &sfc_bus2>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <108000000>; + spi-rx-bus-width = <2>; + spi-tx-bus-width = <1>; + }; +}; + +&tsadc { + status = "okay"; +}; + +&u2phy { + status = "okay"; + + u2phy_host: host-port { + status = "okay"; + }; + + u2phy_otg: otg-port { + status = "disabled"; + }; +}; + +&usb20_otg { + status = "okay"; +}; + +/* EXT Header(P2): 2(RXD:GPIO1.C0),3(TXD:.C1),4(CTS:.C2),5(RTS:.C3) */ +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_xfer &uart1_cts>; + status = "okay"; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2m1_xfer>; + status = "okay"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&pinctrl { + btns { + btn_pins: btn-pins { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + leds { + red_led_pin: red-led-pin { + rockchip,pins = <0 RK_PB5 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>; + }; + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-odroid-go2-v11.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-odroid-go2-v11.dts new file mode 100644 index 0000000000..f96fb0645a --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-odroid-go2-v11.dts @@ -0,0 +1,308 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Hardkernel Co., Ltd + * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH + * Copyright (c) 2022 Maya Matuszczyk + */ + +/dts-v1/; +#include "rk3326-odroid-go.dtsi" + +/ { + model = "ODROID-GO Advance Black Edition"; + compatible = "hardkernel,rk3326-odroid-go2-v11", "rockchip,rk3326"; + + aliases { + mmc1 = &sdio; + }; + + gpio_keys: volume-keys { + compatible = "gpio-keys"; + autorepeat; + pinctrl-0 = <&btn_pins_vol>; + pinctrl-names = "default"; + + volume-up-button { + label = "VOLUMEUP"; + linux,code = ; + gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; + + }; + volume-down-button { + label = "VOLUMEDOWN"; + linux,code = ; + gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; + + }; + }; + + joypad: odroidgo2-joypad { + compatible = "odroidgo2-v11-joypad"; + + /* + - odroidgo2-joypad sysfs list - + * for poll device interval(ms) + /sys/devices/platform/odroidgo2_joypad/poll_interval [rw] + * for button-adc-fuzz + /sys/devices/platform/odroidgo2_joypad/adc_fuzz [r] + * for button-adc-flat + /sys/devices/platform/odroidgo2_joypad/adc_flat [r] + + * for report control(1:enable, 0:disable) + /sys/devices/platform/odroidgo2_joypad/enable [rw] + * for adc calibration value setup(1:current adcs value -> cal value) + /sys/devices/platform/odroidgo2_joypad/adc_cal [rw] + */ + + /* gpio pincontrol setup */ + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins>; + + /* JOY_X, JOY_Y Channel define */ + io-channel-names = "joy_x", "joy_y"; + io-channels = <&saradc 1>, <&saradc 2>; + + /* adc channel count */ + button-adc-count = <2>; + + /* adc calculate scale */ + button-adc-scale = <2>; + + /* adc deadzone range */ + button-adc-deadzone = <20>; + + /* + joy-stick voltage range + /sys/devices/platform/ff288000.saradc/iio:device0 + adc-x : in_voltage1_raw + adc-y : in_voltage2_raw + + range calculate. + (adc raw max value - adc raw min value) * scale * 1.7515 + */ + button-adc-x-range = <1800>; + button-adc-y-range = <1800>; + + /* + specifies fuzz value that is used to filter noise from + the event stream. + */ + button-adc-fuzz = <32>; + button-adc-flat = <32>; + + /* poll device interval (ms), adc read interval */ + poll-interval = <10>; + + /* gpio button auto repeat set value : default disable */ + /* + autorepeat; + */ + + /* + *** ODROIDGO2-Advance Switch layoout *** + |------------------------------------------------| + | sw15 sw16 | + | sw20 sw21 | + |------------------------------------------------| + | sw1 |-------------------| sw8 | + | sw3 sw4 | | sw7 sw5 | + | sw2 | LCD Display | sw6 | + | | | | + | |-------------------| | + | sw9 sw10 vol- vol+ sw13 sw14 | + |------------------------------------------------| + */ + /* + joypad driver is poll-device driver. + poll-device is does not support wakeup-source. + */ + sw1 { + gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-UP"; + linux,code = ; // 0x220 + }; + sw2 { + gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-DOWN"; + linux,code = ; // 0x221 + }; + sw3 { + gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-LEFT"; + linux,code = ; // 0x222 + }; + sw4 { + gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-RIGHT"; + linux,code = ; // 0x223 + }; + sw5 { + gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; + label = "GPIO KEY BTN-A"; + linux,code = ; // 0x131 + }; + sw6 { + gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-B"; + linux,code = ; // 0x130 + }; + sw7 { + gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-Y"; + linux,code = ; // 0x134 + }; + sw8 { + gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-X"; + linux,code = ; // 0x133 + }; + sw9 { + gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-SELECT"; + linux,code = ; // 0x2c0 + }; + sw10 { + gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-THUMBL"; + linux,code = ; // 0x2c1 + }; + sw13 { + gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-THUMBR"; + linux,code = ; // 0x2c4 + }; + sw14 { + gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-START"; + linux,code = ; // 0x13c + }; + sw15 { + gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-LEFT"; + linux,code = ; // 0x02 + }; + sw16 { + gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-RIGHT"; + linux,code = ; // 0x05 + }; + sw20 { + gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-LEFT2"; + linux,code = ; + }; + sw21 { + gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-RIGHT2"; + linux,code = ; + }; + }; + + battery: battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <3000000>; + charge-term-current-microamp = <300000>; + constant-charge-current-max-microamp = <2000000>; + constant-charge-voltage-max-microvolt = <4200000>; + factory-internal-resistance-micro-ohms = <180000>; + voltage-max-design-microvolt = <4100000>; + voltage-min-design-microvolt = <3500000>; + + ocv-capacity-celsius = <20>; + ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, + <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, + <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, + <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, + <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, + <3574170 0>; + }; + + wifi_pwrseq: wifi-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_pwrseq_pins>; + reset-gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; + post-power-on-delay-ms = <300>; + power-off-delay-us = <200000>; + }; +}; + +&internal_display { + compatible = "elida,kd35t133"; + iovcc-supply = <&vcc_lcd>; + vdd-supply = <&vcc_lcd>; + rotation = <270>; +}; + +&rk817 { + regulators { + vcc_wifi: LDO_REG9 { + regulator-name = "vcc_wifi"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + }; +}; + +&rk817_charger { + monitored-battery = <&battery>; +}; + +&sdio { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + disable-wp; + keep-power-in-suspend; + non-removable; + vmmc-supply = <&vcc_wifi>; + mmc-pwrseq = <&wifi_pwrseq>; + status = "okay"; + + esp8089: wifi@1 { + compatible = "esp,esp8089"; + reg = <1>; + esp,crystal-26M-en = <1>; + }; +}; + +&pinctrl { + btns { + btn_pins: btn-pins { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + btn_pins_vol: btn-pins-vol { + rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + wifi { + wifi_pwrseq_pins: wifi-pwrseq-pins { + rockchip,pins = <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB6 RK_FUNC_GPIO &pcfg_output_high>; + }; + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-odroid-go2.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-odroid-go2.dts new file mode 100644 index 0000000000..f142737a01 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-odroid-go2.dts @@ -0,0 +1,235 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Hardkernel Co., Ltd + * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH + * Copyright (c) 2022 Maya Matuszczyk + */ + +/dts-v1/; +#include "rk3326-odroid-go.dtsi" + +/ { + model = "ODROID-GO Advance"; + compatible = "hardkernel,rk3326-odroid-go2", "rockchip,rk3326"; + + gpio_keys: volume-keys { + compatible = "gpio-keys-polled"; + poll-interval = <5>; + autorepeat; + + volume-up-button { + label = "VOLUME-UP"; + linux,code = ; + gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; + + }; + volume-down-button { + label = "VOLUME-DOWN"; + linux,code = ; + gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; + + }; + }; + + joypad: odroidgo2-joypad { + compatible = "odroidgo2-joypad"; + + /* + - odroidgo2-joypad sysfs list - + * for poll device interval(ms) + /sys/devices/platform/odroidgo2_joypad/poll_interval [rw] + * for button-adc-fuzz + /sys/devices/platform/odroidgo2_joypad/adc_fuzz [r] + * for button-adc-flat + /sys/devices/platform/odroidgo2_joypad/adc_flat [r] + + * for report control(1:enable, 0:disable) + /sys/devices/platform/odroidgo2_joypad/enable [rw] + * for adc calibration value setup(1:current adcs value -> cal value) + /sys/devices/platform/odroidgo2_joypad/adc_cal [rw] + */ + + /* gpio pincontrol setup */ + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins>; + + /* JOY_X, JOY_Y Channel define */ + io-channel-names = "joy_x", "joy_y"; + io-channels = <&saradc 1>, <&saradc 2>; + + /* adc channel count */ + button-adc-count = <2>; + + /* adc calculate scale */ + button-adc-scale = <2>; + + /* adc deadzone range */ + button-adc-deadzone = <20>; + + /* + joy-stick voltage range + /sys/devices/platform/ff288000.saradc/iio:device0 + adc-x : in_voltage1_raw + adc-y : in_voltage2_raw + + range calculate. + (adc raw max value - adc raw min value) * scale * 1.7515 + */ + button-adc-x-range = <1800>; + button-adc-y-range = <1800>; + + /* + specifies fuzz value that is used to filter noise from + the event stream. + */ + button-adc-fuzz = <32>; + button-adc-flat = <32>; + + /* poll device interval (ms), adc read interval */ + poll-interval = <10>; + + /* gpio button auto repeat set value : default disable */ + /* + autorepeat; + */ + + /* + *** ODROIDGO2-Advance Switch layoout *** + |------------------------------------------------| + | sw15 sw16 | + |------------------------------------------------| + | sw1 |-------------------| sw8 | + | sw3 sw4 | | sw7 sw5 | + | sw2 | LCD Display | sw6 | + | | | | + | |-------------------| | + | sw9 sw10 vol- vol+ sw13 sw14 | + |------------------------------------------------| + */ + /* + joypad driver is poll-device driver. + poll-device is does not support wakeup-source. + */ + sw1 { + gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-UP"; + linux,code = ; // 0x220 + }; + sw2 { + gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-DOWN"; + linux,code = ; // 0x221 + }; + sw3 { + gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-LEFT"; + linux,code = ; // 0x222 + }; + sw4 { + gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-RIGHT"; + linux,code = ; // 0x223 + }; + sw5 { + gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; + label = "GPIO KEY BTN-A"; + linux,code = ; // 0x131 + }; + sw6 { + gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-B"; + linux,code = ; // 0x130 + }; + sw7 { + gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-Y"; + linux,code = ; // 0x134 + }; + sw8 { + gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-X"; + linux,code = ; // 0x133 + }; + sw9 { + gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; + label = "GPIO F1"; + linux,code = ; // 0x2c0 + }; + sw10 { + gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; + label = "GPIO F2"; + linux,code = ; // 0x2c1 + }; + sw13 { + gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; + label = "GPIO F5"; + linux,code = ; // 0x2c4 + }; + sw14 { + gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO F6"; + linux,code = ; // 0x13c + }; + sw15 { + gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-LEFT"; + linux,code = ; // 0x02 + }; + sw16 { + gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-RIGHT"; + linux,code = ; // 0x05 + }; + }; + + battery: battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <3000000>; + charge-term-current-microamp = <300000>; + constant-charge-current-max-microamp = <2000000>; + constant-charge-voltage-max-microvolt = <4200000>; + factory-internal-resistance-micro-ohms = <180000>; + voltage-max-design-microvolt = <4100000>; + voltage-min-design-microvolt = <3500000>; + + ocv-capacity-celsius = <20>; + ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, + <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, + <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, + <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, + <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, + <3574170 0>; + }; +}; + +&internal_display { + compatible = "elida,kd35t133"; + iovcc-supply = <&vcc_lcd>; + vdd-supply = <&vcc_lcd>; + rotation = <270>; +}; + +&rk817_charger { + monitored-battery = <&battery>; +}; + +&pinctrl { + btns { + btn_pins: btn-pins { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-odroid-go3.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-odroid-go3.dts new file mode 100644 index 0000000000..c3099f9cfe --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-odroid-go3.dts @@ -0,0 +1,289 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Hardkernel Co., Ltd + * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH + * Copyright (c) 2022 Maya Matuszczyk + */ + +/dts-v1/; +#include "rk3326-odroid-go.dtsi" + +/ { + model = "ODROID-GO Super"; + compatible = "hardkernel,rk3326-odroid-go3", "rockchip,rk3326"; + + joypad: odroidgo3-joypad { + compatible = "odroidgo3-joypad"; + + joypad-name = "odroidgo3_joypad"; + joypad-product = <0x0001>; + joypad-revision = <0x0101>; + + status = "okay"; + /* + - odroidgo3-joypad sysfs list - + * for poll device interval(ms) + /sys/devices/platform/odroidgo3_joypad/poll_interval [rw] + ex) echo 20 > poll_interval + * for button-adc-fuzz + /sys/devices/platform/odroidgo3_joypad/adc_fuzz [r] + * for button-adc-flat + /sys/devices/platform/odroidgo3_joypad/adc_flat [r] + + * for report control(1:enable, 0:disable) + /sys/devices/platform/odroidgo3_joypad/enable [rw] + * for adc calibration value setup(current adcs value -> cal value) + /sys/devices/platform/odroidgo3_joypad/adc_cal [rw] + ex) echo 0 > adc_cal + * for amux data debug + * Joypad driver is disabled when using this sysfs. + /sys/devices/platform/odroidgo3_joypad/amux_debug [rw] + ex) echo 0 > amux_debug --> select amux channel + ex) cat amux_debug --> get adc data of seleted channel + */ + + /* gpio pincontrol setup */ + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins>; + + /* Analog mux define */ + io-channel-names = "amux_adc"; + io-channels = <&saradc 1>; + + /* adc mux channel count */ + amux-count = <4>; + /* adc mux select(a,b) gpio */ + amux-a-gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; + amux-b-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; + /* adc mux enable gpio */ + amux-en-gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; + + /* 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 = <180>; + abs_x-n-tuning = <180>; + + abs_y-p-tuning = <180>; + abs_y-n-tuning = <170>; + + abs_rx-p-tuning = <180>; + abs_rx-n-tuning = <180>; + + abs_ry-p-tuning = <180>; + abs_ry-n-tuning = <170>; + + /* poll device interval (ms), adc read interval */ + poll-interval = <10>; + + /* gpio button auto repeat set value : default disable */ + /* + autorepeat; + */ + + /* + *** ODROIDGO3-Advance Switch layoout *** + |------------------------------------------------| + | sw15 sw21 sw10 sw9 sw20 sw16 | + |------------------------------------------------| + | sw19 sw22 | + | |-------------------| | + | sw1 | | sw8 | + | sw3 sw4 | | sw7 sw5 | + | sw2 | LCD Display | sw6 | + | | | | + | | | | + | |-------------------| | + | sw11 sw12 | sd-slot | sw13 sw14 | + |-------------------| |------------------| + */ + /* + joypad driver is poll-device driver. + poll-device is does not support wakeup-source. + */ + sw1 { + gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-UP"; + linux,code = ; // 0x220 + }; + sw2 { + gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-DOWN"; + linux,code = ; // 0x221 + }; + sw3 { + gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-LEFT"; + linux,code = ; // 0x222 + }; + sw4 { + gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-RIGHT"; + linux,code = ; // 0x223 + }; + sw5 { + gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; + label = "GPIO KEY BTN-A"; + linux,code = ; // 0x131 + }; + sw6 { + gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-B"; + linux,code = ; // 0x130 + }; + sw7 { + gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-Y"; + linux,code = ; // 0x134 + }; + sw8 { + gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-X"; + linux,code = ; // 0x133 + }; + sw11 { + gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; + label = "GPIO F3"; + linux,code = ; // 0x2c2 + }; + sw12 { + gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; + label = "GPIO F4"; + linux,code = ; // 0x2c3 + }; + sw13 { + gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; + label = "GPIO F5"; + linux,code = ; // 0x2c4 + }; + sw14 { + gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO F6"; + linux,code = ; // 0x13c + }; + sw15 { + gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-LEFT"; + linux,code = ; // 0x02 + }; + sw16 { + gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-RIGHT"; + linux,code = ; // 0x05 + }; + sw19 { + gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; + label = "GPIO F1"; + linux,code = ; + }; + sw20 { + gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-RIGHT2"; + linux,code = ; + }; + sw21 { + gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-LEFT2"; + linux,code = ; + }; + sw22 { + gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; + label = "GPIO F2"; + linux,code = ; + }; + }; + + battery: battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <4000000>; + charge-term-current-microamp = <300000>; + constant-charge-current-max-microamp = <2000000>; + constant-charge-voltage-max-microvolt = <4200000>; + factory-internal-resistance-micro-ohms = <180000>; + voltage-max-design-microvolt = <4100000>; + voltage-min-design-microvolt = <3500000>; + + ocv-capacity-celsius = <20>; + ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, + <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, + <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, + <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, + <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, + <3574170 0>; + }; + + gpio-keys-vol { + compatible = "gpio-keys"; + autorepeat; + pinctrl-0 = <&btn_pins_vol>; + pinctrl-names = "default"; + + button-vol-down { + gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; + label = "VOLUMEDOWN"; + linux,code = ; + }; + + button-volume-up { + gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; + label = "VOLUMEUP"; + linux,code = ; + }; + }; +}; + +&internal_display { + compatible = "elida,kd50t048a", "sitronix,st7701"; + reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>; + IOVCC-supply = <&vcc_lcd>; + VCC-supply = <&vcc_lcd>; + rotation = <270>; +}; + +&rk817_charger { + monitored-battery = <&battery>; +}; + +&pinctrl { + btns { + btn_pins: btn-pins { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + btn_pins_vol: btn-pins-vol { + rockchip,pins = <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-powkiddy-rgb10.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-powkiddy-rgb10.dts new file mode 100644 index 0000000000..23a30542b9 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-powkiddy-rgb10.dts @@ -0,0 +1,280 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Hardkernel Co., Ltd + * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH + * Copyright (c) 2022 Maya Matuszczyk + */ + +/dts-v1/; +#include "rk3326-odroid-go.dtsi" + +/ { + model = "Powkiddy RGB10"; + compatible = "powkiddy,rk3326-rgb10", "rockchip,rk3326"; + + aliases { + mmc1 = &sdio; + }; + + joypad: odroidgo2-joypad { + compatible = "odroidgo2-v11-joypad"; + + /* + - odroidgo2-joypad sysfs list - + * for poll device interval(ms) + /sys/devices/platform/odroidgo2_joypad/poll_interval [rw] + * for button-adc-fuzz + /sys/devices/platform/odroidgo2_joypad/adc_fuzz [r] + * for button-adc-flat + /sys/devices/platform/odroidgo2_joypad/adc_flat [r] + + * for report control(1:enable, 0:disable) + /sys/devices/platform/odroidgo2_joypad/enable [rw] + * for adc calibration value setup(1:current adcs value -> cal value) + /sys/devices/platform/odroidgo2_joypad/adc_cal [rw] + */ + + /* gpio pincontrol setup */ + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins>; + + /* JOY_X, JOY_Y Channel define */ + io-channel-names = "joy_x", "joy_y"; + io-channels = <&saradc 1>, <&saradc 2>; + + /* adc channel count */ + button-adc-count = <2>; + + /* adc calculate scale */ + button-adc-scale = <2>; + + /* adc deadzone range */ + button-adc-deadzone = <20>; + + /* + joy-stick voltage range + /sys/devices/platform/ff288000.saradc/iio:device0 + adc-x : in_voltage1_raw + adc-y : in_voltage2_raw + + range calculate. + (adc raw max value - adc raw min value) * scale * 1.7515 + */ + button-adc-x-range = <1800>; + button-adc-y-range = <1800>; + + /* + specifies fuzz value that is used to filter noise from + the event stream. + */ + button-adc-fuzz = <32>; + button-adc-flat = <32>; + + /* poll device interval (ms), adc read interval */ + poll-interval = <10>; + + /* gpio button auto repeat set value : default disable */ + /* + autorepeat; + */ + + /* + *** RGB10 Switch layoout *** + |------------------------------------------------| + | sw15 sw16 | + | sw20 sw21 | + |------------------------------------------------| + | sw1 sw10 |-------------------| sw13 sw8 | + | sw3 sw4 | | sw7 sw5 | + | sw2 | LCD Display | sw6 | + | | | | + | |-------------------| | + |------------------------------------------------| + */ + /* + joypad driver is poll-device driver. + poll-device is does not support wakeup-source. + */ + sw1 { + gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-UP"; + linux,code = ; // 0x220 + }; + sw2 { + gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-DOWN"; + linux,code = ; // 0x221 + }; + sw3 { + gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-LEFT"; + linux,code = ; // 0x222 + }; + sw4 { + gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-RIGHT"; + linux,code = ; // 0x223 + }; + sw5 { + gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; + label = "GPIO KEY BTN-A"; + linux,code = ; // 0x131 + }; + sw6 { + gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-B"; + linux,code = ; // 0x130 + }; + sw7 { + gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-Y"; + linux,code = ; // 0x134 + }; + sw8 { + gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-X"; + linux,code = ; // 0x133 + }; + sw9 { + gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-SELECT"; + linux,code = ; // 0x2c0 + }; + sw10 { + gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-THUMBL"; + linux,code = ; // 0x2c1 + }; + sw13 { + gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-THUMBR"; + linux,code = ; // 0x2c4 + }; + sw14 { + gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-START"; + linux,code = ; // 0x13c + }; + sw15 { + gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-LEFT"; + linux,code = ; // 0x02 + }; + sw16 { + gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-RIGHT"; + linux,code = ; // 0x05 + }; + sw20 { + gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-LEFT2"; + linux,code = ; + }; + sw21 { + gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-RIGHT2"; + linux,code = ; + }; + }; + + battery: battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <2800000>; + charge-term-current-microamp = <280000>; + constant-charge-current-max-microamp = <2000000>; + constant-charge-voltage-max-microvolt = <4200000>; + factory-internal-resistance-micro-ohms = <180000>; + voltage-max-design-microvolt = <4100000>; + voltage-min-design-microvolt = <3500000>; + + ocv-capacity-celsius = <20>; + ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, + <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, + <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, + <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, + <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, + <3574170 0>; + }; + + wifi_pwrseq: wifi-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_pwrseq_pins>; + /*reset-gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>;*/ + }; +}; + +&internal_display { + compatible = "elida,kd35t133"; + iovcc-supply = <&vcc_lcd>; + vdd-supply = <&vcc_lcd>; + rotation = <270>; +}; + +&rk817 { + regulators { + vcc_wifi: LDO_REG9 { + regulator-name = "vcc_wifi"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + }; +}; + +&rk817_charger { + monitored-battery = <&battery>; +}; + +&sdio { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + disable-wp; + keep-power-in-suspend; + non-removable; + vmmc-supply = <&vcc_wifi>; + status = "okay"; + + esp8089: wifi@1 { + compatible = "esp,esp8089"; + reg = <1>; + esp,crystal-26M-en = <2>; + }; +}; + +&pinctrl { + btns { + btn_pins: btn-pins { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + wifi { + wifi_pwrseq_pins: wifi-pwrseq-pins { + rockchip,pins = /*<3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>,*/ + <3 RK_PB6 RK_FUNC_GPIO &pcfg_output_high>; + }; + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-powkiddy-rgb10x.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-powkiddy-rgb10x.dts new file mode 100644 index 0000000000..3e50071189 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-powkiddy-rgb10x.dts @@ -0,0 +1,209 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2024 ROCKNIX + */ + +/dts-v1/; +#include "rk3326-odroid-go.dtsi" +#include "retrogame_joypad_s2_f1.dtsi" + +/ { + model = "Powkiddy RGB10X"; + compatible = "powkiddy,rk3326-rgb10x", "rockchip,rk3326"; + + aliases { + mmc1 = &sdio; + }; + + battery: battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <2800000>; + charge-term-current-microamp = <280000>; + constant-charge-current-max-microamp = <2000000>; + constant-charge-voltage-max-microvolt = <4200000>; + factory-internal-resistance-micro-ohms = <180000>; + voltage-max-design-microvolt = <4100000>; + voltage-min-design-microvolt = <3500000>; + + ocv-capacity-celsius = <20>; + ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, + <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, + <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, + <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, + <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, + <3574170 0>; + }; + + gpio-keys-vol { + compatible = "gpio-keys"; + autorepeat; + pinctrl-0 = <&btn_pins_vol>; + pinctrl-names = "default"; + + button-vol-down { + gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; + label = "VOLUMEDOWN"; + linux,code = ; + }; + + button-volume-up { + gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; + label = "VOLUMEUP"; + linux,code = ; + }; + }; +}; + +&joypad { + compatible = "rocknix-singleadc-joypad"; + joypad-name = "retrogame_joypad_s1_f2"; /* distinct name to indicate there is 1 stick and 2 fn buttons */ + joypad-product = <0x1112>; /* 11 inherited, 1 for number of sticks, 2 for number of FN */ + status = "okay"; + + /* gpio pincontrol setup */ + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins>; + + /* Analog mux define */ + io-channel-names = "amux_adc"; + io-channels = <&saradc 1>; + + /* adc mux channel count */ + /* despite there is only left stick, amux-count needs to be 4, */ + /* because amux 0 and 1 are hardcoded as RX and RY in the driver */ + amux-count = <4>; + /* adc mux select(a,b) gpio */ + amux-a-gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; + amux-b-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; + /* adc mux enable gpio */ + amux-en-gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; + + /* + 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>; + + /* required for RGB10X */ + invert-absx; + invert-absy; + + /* + joypad driver is poll-device driver. + poll-device is does not support wakeup-source. + */ + up { gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; }; + down { gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; }; + left { gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; }; + right { gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; }; + + a { gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; }; + b { gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; }; + x { gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; }; + y { gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; }; + + tl { gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; }; + tr { gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; }; + tr2 { gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; }; + tl2 { gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; }; + + select{ gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; }; + start { gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; }; + + thumbl{ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; }; + + /* Plus and Minus face buttons are mapped to mode and thumbr */ + mode { + gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; + label = "GPIO MINUS"; + }; + thumbr { + gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; + label = "GPIO PLUS"; + }; +}; + +&internal_display { + compatible = "powkiddy,rk2023-panel", "newvision,nv3051d"; + vdd-supply = <&vcc_lcd>; +}; + +&io_domains { + vccio1-supply = <&vccio_sd>; +}; + +/delete-node/ &pwm3; +/delete-node/ &pwm_led; + +&red_led { + gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_HIGH>; +}; + +&red_led_pin { + rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; +}; + +&rk817_charger { + monitored-battery = <&battery>; +}; + +&sdio { + cap-sd-highspeed; + card-detect-delay = <200>; + cd-gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&vcc_sd { + regulator-max-microvolt = <3000000>; + regulator-min-microvolt = <1800000>; +}; + +&vccio_sd { + regulator-max-microvolt = <1800000>; +}; + +&pinctrl { + btns { + btn_pins: btn-pins { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + btn_pins_vol: btn-pins-vol { + rockchip,pins = <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-powkiddy-rgb20s.dts b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-powkiddy-rgb20s.dts new file mode 100644 index 0000000000..cf507db957 --- /dev/null +++ b/projects/ROCKNIX/devices/RK3326/linux/dts/rockchip/rk3326-powkiddy-rgb20s.dts @@ -0,0 +1,340 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Hardkernel Co., Ltd + * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH + * Copyright (c) 2022 Maya Matuszczyk + */ + +/dts-v1/; +#include "rk3326-odroid-go.dtsi" + +/ { + model = "Powkiddy RGB20S"; + compatible = "powkiddy,rgb20s", "rockchip,rk3326"; + + aliases { + mmc0 = &sdio; + mmc1 = &sdmmc; + }; + + gpio-keys-vol { + compatible = "gpio-keys"; + autorepeat; + pinctrl-0 = <&btn_pins_vol>; + pinctrl-names = "default"; + + button-vol-down { + gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; + label = "VOLUMEDOWN"; + linux,code = ; + }; + + button-volume-up { + gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; + label = "VOLUMEUP"; + linux,code = ; + }; + }; + + joypad: rgb20s-joypad { + compatible = "rgb20s-joypad"; + + pwms = <&pwm0 0 200000000 0>; + pwm-names = "enable"; + rumble-boost-weak = <0x0000>; + rumble-boost-strong = <0x0000>; + + joypad-name = "RGB20S Gamepad"; + joypad-product = <0x1177>; + joypad-revision = <0x0177>; + + status = "okay"; + /* + - odroidgo3-joypad sysfs list - + * for poll device interval(ms) + /sys/devices/platform/odroidgo3_joypad/poll_interval [rw] + ex) echo 20 > poll_interval + * for button-adc-fuzz + /sys/devices/platform/odroidgo3_joypad/adc_fuzz [r] + * for button-adc-flat + /sys/devices/platform/odroidgo3_joypad/adc_flat [r] + + * for report control(1:enable, 0:disable) + /sys/devices/platform/odroidgo3_joypad/enable [rw] + * for adc calibration value setup(current adcs value -> cal value) + /sys/devices/platform/odroidgo3_joypad/adc_cal [rw] + ex) echo 0 > adc_cal + + * for rumble period(ns) + /sys/devices/platform/odroidgo3_joypad/rumble_period + ex) echo 20000000 > rumble_duty_cycle + ex) cat rumble_duty_cycle -->get current duty cycle + + * for rumble boost(0~65535) + /sys/devices/platform/odroidgo3_joypad/rumble_boost_weak + /sys/devices/platform/odroidgo3_joypad/rumble_boost_strong + + * for amux data debug + * Joypad driver is disabled when using this sysfs. + /sys/devices/platform/odroidgo3_joypad/amux_debug [rw] + ex) echo 0 > amux_debug --> select amux channel + ex) cat amux_debug --> get adc data of seleted channel + */ + + /* gpio pincontrol setup */ + pinctrl-names = "default"; + pinctrl-0 = <&btn_pins>; + pinctrl-1 = <&pwm0_pin>; + + /* Analog mux define */ + io-channel-names = "amux_adc"; + io-channels = <&saradc 1>; + + /* adc mux channel count */ + amux-count = <4>; + /* adc mux select(a,b) gpio */ + amux-a-gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; + amux-b-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; + /* adc mux enable gpio */ + amux-en-gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; + + /* 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; + + /* gpio button auto repeat set value : default disable */ + /* + autorepeat; + */ + + /* + joypad driver is poll-device driver. + poll-device is does not support wakeup-source. + */ + sw1 { + gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-UP"; + linux,code = ; // 0x220 + }; + sw2 { + gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-DOWN"; + linux,code = ; // 0x221 + }; + sw3 { + gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-LEFT"; + linux,code = ; // 0x222 + }; + sw4 { + gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; + label = "GPIO DPAD-RIGHT"; + linux,code = ; // 0x223 + }; + sw5 { + gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; + label = "GPIO KEY BTN-A"; + linux,code = ; // 0x131 + }; + sw6 { + gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-B"; + linux,code = ; // 0x130 + }; + sw7 { + gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-Y"; + linux,code = ; // 0x134 + }; + sw8 { + gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; + label = "GPIO BTN-X"; + linux,code = ; // 0x133 + }; + sw11 { + gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; + label = "GPIO F3"; + linux,code = ; // 0x2c2 + }; + sw12 { + gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; + label = "GPIO F4"; + linux,code = ; // 0x2c3 + }; + /*sw13 { + gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; + label = "GPIO F5"; + linux,code = ; // 0x2c4 + }; + sw14 { + gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO F6"; + linux,code = ; // 0x13c + };*/ + sw15 { + gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-LEFT"; + linux,code = ; // 0x02 + }; + sw16 { + gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-RIGHT"; + linux,code = ; // 0x05 + }; + sw19 { + gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; + label = "GPIO F1"; + linux,code = ; + }; + sw20 { + gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-RIGHT2"; + linux,code = ; + }; + sw21 { + gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; + label = "GPIO TOP-LEFT2"; + linux,code = ; + }; + sw22 { + gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; + label = "GPIO F2"; + linux,code = ; + }; + }; + + battery: battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <3500000>; + charge-term-current-microamp = <350000>; + constant-charge-current-max-microamp = <2000000>; + constant-charge-voltage-max-microvolt = <4200000>; + factory-internal-resistance-micro-ohms = <180000>; + voltage-max-design-microvolt = <4100000>; + voltage-min-design-microvolt = <3500000>; + + ocv-capacity-celsius = <20>; + ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, + <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, + <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, + <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, + <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, + <3574170 0>; + }; +}; + +/* conflicts with pwm vibration motor */ +/delete-node/ &vcc_host; + +/* Device only has 1 LED compared to Odroid Go Advance */ +/delete-node/ &gpio_led; + +&internal_display { +// compatible = "anbernic,rg351v-panel", "newvision,nv3051d"; + compatible = "powkiddy,rk2023-panel", "newvision,nv3051d"; + iovcc-supply = <&vcc_lcd>; + vdd-supply = <&vcc_lcd>; +}; + +&io_domains { + vccio1-supply = <&vccio_sd>; +}; + +/delete-node/ &pwm_led; + +&pwm0 { + status = "okay"; +}; + +/delete-node/ &pwm3; + +&rk817_charger { + /* This device does not have a current sense resistor */ + rockchip,resistor-sense-micro-ohms = <0>; + monitored-battery = <&battery>; +}; + +&sdio { + cap-sd-highspeed; + card-detect-delay = <200>; + cd-gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/ + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&vcc_sd { + regulator-max-microvolt = <3000000>; + regulator-min-microvolt = <1800000>; +}; + +&vccio_sd { + regulator-max-microvolt = <1800000>; +}; + +&pinctrl { + btns { + btn_pins_vol: btn-pins-vol { + rockchip,pins = <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + btn_pins: btn-pins { + rockchip,pins = <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; diff --git a/projects/ROCKNIX/devices/RK3326/linux/linux.aarch64.conf b/projects/ROCKNIX/devices/RK3326/linux/linux.aarch64.conf index 8cab246d04..2c63a7239e 100644 --- a/projects/ROCKNIX/devices/RK3326/linux/linux.aarch64.conf +++ b/projects/ROCKNIX/devices/RK3326/linux/linux.aarch64.conf @@ -5079,7 +5079,6 @@ CONFIG_DEVFREQ_GOV_PASSIVE=y # DEVFREQ Drivers # CONFIG_ARM_RK3399_DMC_DEVFREQ=y -# CONFIG_ARM_ROCKCHIP_BUS_DEVFREQ is not set CONFIG_PM_DEVFREQ_EVENT=y CONFIG_DEVFREQ_EVENT_ROCKCHIP_DFI=y CONFIG_EXTCON=y diff --git a/projects/ROCKNIX/devices/RK3326/patches/linux/000-rk3326-dts.patch b/projects/ROCKNIX/devices/RK3326/patches/linux/000-rk3326-dts.patch index d6be56c801..5d3e38f1ee 100644 --- a/projects/ROCKNIX/devices/RK3326/patches/linux/000-rk3326-dts.patch +++ b/projects/ROCKNIX/devices/RK3326/patches/linux/000-rk3326-dts.patch @@ -133,3607 +133,3 @@ index 9137dd76e72c..882b91d8468d 100644 }; vpu: video-codec@ff442000 { -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351m.dts b/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351m.dts -index f4d20f29c1b4..c12bb7994441 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351m.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351m.dts -@@ -6,16 +6,53 @@ - */ - - /dts-v1/; --#include "rk3326-anbernic-rg351m.dtsi" -+#include "rk3326-odroid-go.dtsi" - - / { - model = "Anbernic RG351M"; - compatible = "anbernic,rg351m", "rockchip,rk3326"; -+ -+ battery: battery { -+ compatible = "simple-battery"; -+ charge-full-design-microamp-hours = <3500000>; -+ charge-term-current-microamp = <350000>; -+ constant-charge-current-max-microamp = <2000000>; -+ constant-charge-voltage-max-microvolt = <4200000>; -+ factory-internal-resistance-micro-ohms = <180000>; -+ voltage-max-design-microvolt = <4100000>; -+ voltage-min-design-microvolt = <3500000>; -+ -+ ocv-capacity-celsius = <20>; -+ ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, -+ <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, -+ <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, -+ <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, -+ <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, -+ <3574170 0>; -+ }; -+ -+ vibrator { -+ compatible = "pwm-vibrator"; -+ pwms = <&pwm0 0 1000000 0>; -+ pwm-names = "enable"; -+ }; - }; - -+/delete-node/ &vcc_host; /* conflicts with pwm vibration motor */ -+ - &internal_display { - compatible = "elida,kd35t133"; - iovcc-supply = <&vcc_lcd>; -- rotation = <270>; - vdd-supply = <&vcc_lcd>; -+ rotation = <270>; -+}; -+ -+&pwm0 { -+ status = "okay"; -+}; -+ -+&rk817_charger { -+ /* This device does not have a current sense resistor */ -+ //rockchip,resistor-sense-micro-ohms = <0>; -+ monitored-battery = <&battery>; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351v.dts b/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351v.dts -index c79f7a7b38cb..26658a37f4e3 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351v.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3326-anbernic-rg351v.dts -@@ -1,32 +1,76 @@ - // SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2019 Hardkernel Co., Ltd -+ * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH -+ * Copyright (c) 2022 Maya Matuszczyk -+ */ - - /dts-v1/; --#include "rk3326-anbernic-rg351m.dtsi" -+#include "rk3326-odroid-go.dtsi" - - / { - model = "Anbernic RG351V"; - compatible = "anbernic,rg351v", "rockchip,rk3326"; - -- gpio_keys_vol: gpio-keys-vol { -- compatible = "gpio-keys"; -- autorepeat; -- -- button-vol-down { -- gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; -- label = "VOLUMEDOWN"; -- linux,code = ; -- }; -- -- button-vol-up { -- gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; -- label = "VOLUMEUP"; -- linux,code = ; -- }; -+ aliases { -+ mmc0 = &sdio; -+ mmc1 = &sdmmc; -+ }; -+ -+ gpio-keys-vol { -+ compatible = "gpio-keys"; -+ autorepeat; -+ pinctrl-0 = <&btn_pins_vol>; -+ pinctrl-names = "default"; -+ -+ button-vol-down { -+ gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; -+ label = "VOLUMEDOWN"; -+ linux,code = ; -+ }; -+ -+ button-volume-up { -+ gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; -+ label = "VOLUMEUP"; -+ linux,code = ; -+ }; -+ }; -+ -+ battery: battery { -+ compatible = "simple-battery"; -+ charge-full-design-microamp-hours = <3500000>; -+ charge-term-current-microamp = <350000>; -+ constant-charge-current-max-microamp = <2000000>; -+ constant-charge-voltage-max-microvolt = <4200000>; -+ factory-internal-resistance-micro-ohms = <180000>; -+ voltage-max-design-microvolt = <4100000>; -+ voltage-min-design-microvolt = <3500000>; -+ -+ ocv-capacity-celsius = <20>; -+ ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, -+ <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, -+ <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, -+ <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, -+ <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, -+ <3574170 0>; -+ }; -+ -+ vibrator { -+ compatible = "pwm-vibrator"; -+ pwms = <&pwm0 0 1000000 0>; -+ pwm-names = "enable"; - }; - }; - -+/* conflicts with pwm vibration motor */ -+/delete-node/ &vcc_host; -+ -+/* Device only has 1 LED compared to Odroid Go Advance */ -+/delete-node/ &gpio_led; -+ - &internal_display { - compatible = "anbernic,rg351v-panel", "newvision,nv3051d"; -+ iovcc-supply = <&vcc_lcd>; - vdd-supply = <&vcc_lcd>; - }; - -@@ -34,6 +78,33 @@ &io_domains { - vccio1-supply = <&vccio_sd>; - }; - -+/delete-node/ &pwm_led; -+ -+&pwm0 { -+ status = "okay"; -+}; -+ -+/delete-node/ &pwm3; -+ -+&rk817_charger { -+ /* This device does not have a current sense resistor */ -+ rockchip,resistor-sense-micro-ohms = <0>; -+ monitored-battery = <&battery>; -+}; -+ -+&sdio { -+ cap-sd-highspeed; -+ card-detect-delay = <200>; -+ cd-gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/ -+ sd-uhs-sdr12; -+ sd-uhs-sdr25; -+ sd-uhs-sdr50; -+ sd-uhs-sdr104; -+ vmmc-supply = <&vcc_sd>; -+ vqmmc-supply = <&vccio_sd>; -+ status = "okay"; -+}; -+ - &vcc_sd { - regulator-max-microvolt = <3000000>; - regulator-min-microvolt = <1800000>; -@@ -42,3 +113,12 @@ &vcc_sd { - &vccio_sd { - regulator-max-microvolt = <1800000>; - }; -+ -+&pinctrl { -+ btns { -+ btn_pins_vol: btn-pins-vol { -+ rockchip,pins = <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+}; -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-gameconsole-r33s.dts b/arch/arm64/boot/dts/rockchip/rk3326-gameconsole-r33s.dts -new file mode 100644 -index 000000000000..3bef2baf90a4 ---- /dev/null -+++ b/arch/arm64/boot/dts/rockchip/rk3326-gameconsole-r33s.dts -@@ -0,0 +1,124 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * # Copyright (C) 2022-24 JELOS (https://github.com/JustEnoughLinuxOS) -+ */ -+ -+/dts-v1/; -+#include "rk3326-gameconsole-r3xs.dtsi" -+ -+/ { -+ model = "Game Console R33S"; -+ compatible = "gameconsole,r33s", "rockchip,rk3326"; -+ -+ builtin_gamepad: r33s_joypad { -+ compatible = "rocknix-singleadc-joypad"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&btn_pins>; -+ joypad-name = "r33s_joypad"; -+ joypad-product = <0x0AA2>; -+ joypad-revision = <0x0100>; -+ joypad-vendor = <0x0001>; -+ -+ status = "okay"; -+ amux-count = <0>; -+ /* poll device interval (ms), adc read interval */ -+ poll-interval = <10>; -+ pwms = <&pwm0 0 1000000000 0>; -+ pwm-names = "enable"; -+ rumble-boost-weak = <0x0000>; -+ rumble-boost-strong = <0x0000>; -+ -+ button-sw1 { -+ gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "DPAD-UP"; -+ linux,code = ; -+ }; -+ button-sw2 { -+ gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; -+ label = "DPAD-DOWN"; -+ linux,code = ; -+ }; -+ button-sw3 { -+ gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; -+ label = "DPAD-LEFT"; -+ linux,code = ; -+ }; -+ button-sw4 { -+ gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "DPAD-RIGHT"; -+ linux,code = ; -+ }; -+ button-sw5 { -+ gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "BTN-A"; -+ linux,code = ; -+ }; -+ button-sw6 { -+ gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "BTN-B"; -+ linux,code = ; -+ }; -+ button-sw7 { -+ gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "BTN-Y"; -+ linux,code = ; -+ }; -+ button-sw8 { -+ gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "BTN-X"; -+ linux,code = ; -+ }; -+ button-sw9 { -+ gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "TOP-LEFT"; -+ linux,code = ; -+ }; -+ button-sw10 { -+ gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "TOP-RIGHT"; -+ linux,code = ; -+ }; -+ button-sw11 { -+ gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; -+ label = "SELECT"; -+ linux,code = ; -+ }; -+ button-sw12 { -+ gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "TOP-RIGHT 2"; -+ linux,code = ; -+ }; -+ button-sw13 { -+ gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; -+ label = "TOP-LEFT 2"; -+ linux,code = ; -+ }; -+ button-sw14 { -+ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "START"; -+ linux,code = ; -+ }; -+ }; -+}; -+ -+&pinctrl { -+ btns { -+ btn_pins: btn-pins { -+ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ -+ }; -+}; -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-gameconsole-r36s.dts b/arch/arm64/boot/dts/rockchip/rk3326-gameconsole-r36s.dts -new file mode 100644 -index 000000000000..45ce50896267 ---- /dev/null -+++ b/arch/arm64/boot/dts/rockchip/rk3326-gameconsole-r36s.dts -@@ -0,0 +1,202 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * # Copyright (C) 2022-24 JELOS (https://github.com/JustEnoughLinuxOS) -+ */ -+ -+/dts-v1/; -+#include "rk3326-gameconsole-r3xs.dtsi" -+ -+/ { -+ model = "Game Console R36S"; -+ compatible = "gameconsole,r35s", "gameconsole,r36s", "rockchip,rk3326"; -+ -+ joypad: odroidgo3-joypad { -+ compatible = "odroidgo3-joypad"; -+ pwms = <&pwm0 0 200000000 0>; -+ pwm-names = "enable"; -+ rumble-boost-weak = <0x0000>; -+ rumble-boost-strong = <0x0000>; -+ -+ joypad-name = "r36s_Gamepad"; -+ joypad-product = <0x1188>; -+ joypad-revision = <0x0188>; -+ -+ status = "okay"; -+ -+ /* gpio pincontrol setup */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&btn_pins>; -+ pinctrl-1 = <&pwm0_pin>; -+ -+ /* Analog mux define */ -+ io-channel-names = "amux_adc"; -+ io-channels = <&saradc 1>; -+ -+ /* adc mux channel count */ -+ amux-count = <4>; -+ /* adc mux select(a,b) gpio */ -+ amux-a-gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; -+ amux-b-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; -+ /* adc mux enable gpio */ -+ amux-en-gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; -+ -+ /* 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 RG36S */ -+ invert-absx; -+ invert-absy; -+ -+ /* gpio button auto repeat set value : default disable */ -+ /* -+ autorepeat; -+ */ -+ -+ /* -+ joypad driver is poll-device driver. -+ poll-device is does not support wakeup-source. -+ */ -+ sw1 { -+ gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-UP"; -+ linux,code = ; // 0x220 -+ }; -+ sw2 { -+ gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-DOWN"; -+ linux,code = ; // 0x221 -+ }; -+ sw3 { -+ gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-LEFT"; -+ linux,code = ; // 0x222 -+ }; -+ sw4 { -+ gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-RIGHT"; -+ linux,code = ; // 0x223 -+ }; -+ sw5 { -+ gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "GPIO KEY BTN-A"; -+ linux,code = ; // 0x131 -+ }; -+ sw6 { -+ gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-B"; -+ linux,code = ; // 0x130 -+ }; -+ sw7 { -+ gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-Y"; -+ linux,code = ; // 0x134 -+ }; -+ sw8 { -+ gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-X"; -+ linux,code = ; // 0x133 -+ }; -+ sw11 { -+ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_THUMBL"; -+ linux,code = ; // 0x2c2 -+ }; -+ sw12 { -+ gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_THUMBR"; -+ linux,code = ; // 0x2c3 -+ }; -+ sw13 { -+ gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_FN"; -+ linux,code = ; // 0x2c4 -+ }; -+ sw15 { -+ gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-LEFT"; -+ linux,code = ; // 0x02 -+ }; -+ sw16 { -+ gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-RIGHT"; -+ linux,code = ; // 0x05 -+ }; -+ sw19 { -+ gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_SELECT"; -+ linux,code = ; -+ }; -+ sw20 { -+ gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-RIGHT2"; -+ linux,code = ; -+ }; -+ sw21 { -+ gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-LEFT2"; -+ linux,code = ; -+ }; -+ sw22 { -+ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_START"; -+ linux,code = ; -+ }; -+ }; -+}; -+ -+&pinctrl { -+ btns { -+ btn_pins: btn-pins { -+ rockchip,pins = <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; -+ -+ }; -+ -+ }; -+}; -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-gameconsole-r3xs.dtsi b/arch/arm64/boot/dts/rockchip/rk3326-gameconsole-r3xs.dtsi -new file mode 100644 -index 000000000000..de1b0d51e238 ---- /dev/null -+++ b/arch/arm64/boot/dts/rockchip/rk3326-gameconsole-r3xs.dtsi -@@ -0,0 +1,545 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * # Copyright (C) 2022-24 JELOS (https://github.com/JustEnoughLinuxOS) -+ */ -+ -+/dts-v1/; -+#include -+#include -+#include -+#include -+#include "rk3326.dtsi" -+ -+/ { -+ model = "Game Console R33S"; -+ compatible = "gameconsolec,r33s", "rockchip,rk3326"; -+ -+ aliases { -+ mmc0 = &sdio; -+ mmc1 = &sdmmc; -+ }; -+ -+ chosen { -+ stdout-path = "serial2:115200n8"; -+ }; -+ -+ backlight: backlight { -+ compatible = "pwm-backlight"; -+ power-supply = <&vcc_bl>; -+ 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>; -+ }; -+ -+ gpio-keys-vol { -+ compatible = "gpio-keys"; -+ autorepeat; -+ pinctrl-0 = <&btn_pins_vol>; -+ pinctrl-names = "default"; -+ -+ button-vol-down { -+ gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; -+ label = "VOLUMEDOWN"; -+ linux,code = ; -+ }; -+ -+ button-volume-up { -+ gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; -+ label = "VOLUMEUP"; -+ linux,code = ; -+ }; -+ }; -+ -+ battery: battery { -+ compatible = "simple-battery"; -+ charge-full-design-microamp-hours = <3200000>; -+ charge-term-current-microamp = <320000>; -+ constant-charge-current-max-microamp = <2000000>; -+ constant-charge-voltage-max-microvolt = <4200000>; -+ factory-internal-resistance-micro-ohms = <180000>; -+ voltage-max-design-microvolt = <4100000>; -+ voltage-min-design-microvolt = <3500000>; -+ -+ ocv-capacity-celsius = <20>; -+ ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, -+ <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, -+ <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, -+ <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, -+ <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, -+ <3574170 0>; -+ -+ }; -+ -+ rk817-sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,name = "rk817_int"; -+ 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 = -+ "Microphone", "Mic Jack", -+ "Headphone", "Headphones", -+ "Speaker", "Speaker"; -+ simple-audio-card,routing = -+ "MICL", "Mic Jack", -+ "Headphones", "HPOL", -+ "Headphones", "HPOR", -+ "Speaker", "SPKO"; -+ -+ 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-min-microvolt = <3800000>; -+ regulator-max-microvolt = <3800000>; -+ }; -+}; -+ -+&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 { -+ reg = <0>; -+ backlight = <&backlight>; -+ reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; -+ -+ port { -+ mipi_in_panel: endpoint { -+ remote-endpoint = <&mipi_out_panel>; -+ }; -+ }; -+ }; -+}; -+ -+&dsi_dphy { -+ status = "okay"; -+}; -+ -+&gpu { -+ mali-supply = <&vdd_logic>; -+ status = "okay"; -+}; -+ -+&internal_display { -+ compatible = "gameconsole,r36s-panel", "sitronix,st7703"; -+ iovcc-supply = <&vcc_lcd>; -+ vdd-supply = <&vcc_lcd>; -+}; -+ -+&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 = <&vccsys>; -+ vcc8-supply = <&vccsys>; -+ -+ regulators { -+ vdd_logic: DCDC_REG1 { -+ regulator-name = "vdd_logic"; -+ regulator-min-microvolt = <950000>; -+ regulator-max-microvolt = <1150000>; -+ 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-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-state-mem { -+ regulator-on-in-suspend; -+ }; -+ }; -+ -+ vcc_3v3: DCDC_REG4 { -+ regulator-name = "vcc_3v3"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-always-on; -+ regulator-boot-on; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <3300000>; -+ }; -+ }; -+ -+ vcc_1v8: LDO_REG2 { -+ regulator-name = "vcc_1v8"; -+ 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>; -+ }; -+ }; -+ -+ vdd_1v0: LDO_REG3 { -+ regulator-name = "vdd_1v0"; -+ 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>; -+ }; -+ }; -+ -+ vcc3v3_pmu: LDO_REG4 { -+ regulator-name = "vcc3v3_pmu"; -+ 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>; -+ }; -+ }; -+ -+ vccio_sd: LDO_REG5 { -+ regulator-name = "vccio_sd"; -+ 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>; -+ }; -+ }; -+ -+ vcc_sd: LDO_REG6 { -+ regulator-name = "vcc_sd"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3000000>; -+ regulator-boot-on; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <3000000>; -+ }; -+ }; -+ -+ vcc_bl: LDO_REG7 { -+ regulator-name = "vcc_bl"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <3300000>; -+ }; -+ }; -+ -+ vcc_lcd: LDO_REG8 { -+ regulator-name = "vcc_lcd"; -+ regulator-min-microvolt = <2800000>; -+ regulator-max-microvolt = <2800000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <2800000>; -+ }; -+ }; -+ -+ LDO_REG9 { -+ /* unused */ -+ }; -+ -+ usb_midu: BOOST { -+ regulator-name = "usb_midu"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5400000>; -+ regulator-always-on; -+ regulator-boot-on; -+ }; -+ }; -+ -+ rk817_charger: charger { -+ 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; -+ }; -+ }; -+}; -+ -+&i2s1_2ch { -+ status = "okay"; -+}; -+ -+&io_domains { -+ vccio1-supply = <&vccio_sd>; -+ vccio2-supply = <&vccio_sd>; -+ vccio3-supply = <&vcc_3v3>; -+ vccio4-supply = <&vcc_3v3>; -+ vccio5-supply = <&vcc_3v3>; -+ vccio6-supply = <&vcc_3v3>; -+ status = "okay"; -+}; -+ -+&pmu_io_domains { -+ pmuio1-supply = <&vcc3v3_pmu>; -+ pmuio2-supply = <&vcc3v3_pmu>; -+ status = "okay"; -+}; -+ -+&pwm0 { -+ status = "okay"; -+}; -+ -+&pwm1 { -+ status = "okay"; -+}; -+ -+&saradc { -+ vref-supply = <&vcc_1v8>; -+ status = "okay"; -+}; -+ -+&sdmmc { -+ bus-width = <4>; -+ cap-sd-highspeed; -+ card-detect-delay = <800>; -+ cd-gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/ -+ disable-wp; -+ sd-uhs-sdr12; -+ sd-uhs-sdr25; -+ sd-uhs-sdr50; -+ sd-uhs-sdr104; -+ vmmc-supply = <&vcc_sd>; -+ vqmmc-supply = <&vccio_sd>; -+ status = "okay"; -+}; -+ -+&sdio { -+ bus-width = <4>; -+ cap-sd-highspeed; -+ card-detect-delay = <800>; -+ cd-gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/ -+ disable-wp; -+ sd-uhs-sdr12; -+ sd-uhs-sdr25; -+ sd-uhs-sdr50; -+ sd-uhs-sdr104; -+ vmmc-supply = <&vcc_sd>; -+ vqmmc-supply = <&vccio_sd>; -+ status = "okay"; -+}; -+ -+&tsadc { -+ status = "okay"; -+}; -+ -+&u2phy { -+ status = "okay"; -+ -+ u2phy_host: host-port { -+ status = "okay"; -+ }; -+ -+ u2phy_otg: otg-port { -+ status = "disabled"; -+ }; -+}; -+ -+&usb20_otg { -+ status = "okay"; -+}; -+ -+&uart2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart2m1_xfer>; -+ status = "okay"; -+}; -+ -+&vopb { -+ status = "okay"; -+}; -+ -+&vopb_mmu { -+ status = "okay"; -+}; -+ -+&rk817_charger { -+ monitored-battery = <&battery>; -+}; -+ -+&pinctrl { -+ btns { -+ btn_pins_vol: btn-pins-vol { -+ rockchip,pins = <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ headphone { -+ hp_det: hp-det { -+ rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>; -+ }; -+ }; -+ -+ 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>; -+ }; -+ }; -+}; -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts b/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts -new file mode 100644 -index 000000000000..3fe532e06d58 ---- /dev/null -+++ b/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts -@@ -0,0 +1,872 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2019 Hardkernel Co., Ltd -+ * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH -+ * Copyright (c) 2022 Maya Matuszczyk -+ */ -+ -+/dts-v1/; -+#include -+#include -+#include -+#include -+#include "rk3326.dtsi" -+ -+/ { -+ model = "MagicX XU10"; -+ compatible = "magicx,xu10", "rockchip,rk3326"; -+ -+ aliases { -+ mmc0 = &sdio; -+ mmc1 = &sdmmc; -+ }; -+ -+ 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>; -+ }; -+ -+ joypad: xu10-joypad { -+ compatible = "xu10-joypad"; -+ -+ joypad-name = "XU10 Gamepad"; -+ joypad-product = <0x0200>; -+ joypad-revision = <0x0010>; -+ -+ status = "okay"; -+ /* -+ - xu10-joypad sysfs list - -+ * for poll device interval(ms) -+ /sys/devices/platform/odroidgo3_joypad/poll_interval [rw] -+ ex) echo 20 > poll_interval -+ * for button-adc-fuzz -+ /sys/devices/platform/odroidgo3_joypad/adc_fuzz [r] -+ * for button-adc-flat -+ /sys/devices/platform/odroidgo3_joypad/adc_flat [r] -+ -+ * for report control(1:enable, 0:disable) -+ /sys/devices/platform/odroidgo3_joypad/enable [rw] -+ * for adc calibration value setup(current adcs value -> cal value) -+ /sys/devices/platform/odroidgo3_joypad/adc_cal [rw] -+ ex) echo 0 > adc_cal -+ * for amux data debug -+ * Joypad driver is disabled when using this sysfs. -+ /sys/devices/platform/odroidgo3_joypad/amux_debug [rw] -+ ex) echo 0 > amux_debug --> select amux channel -+ ex) cat amux_debug --> get adc data of seleted channel -+ */ -+ -+ /* gpio pincontrol setup */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&btn_pins>; -+ -+ /* Analog mux define */ -+ io-channel-names = "joy_left", "joy_right"; -+ io-channels = <&saradc 1>, <&saradc 2>; -+ -+ /* adc mux channel count */ -+ amux-count = <4>; -+ -+ /* adc mux select(a,b) gpio */ -+ amux-a-gpios = <&gpio2 RK_PB3 GPIO_ACTIVE_LOW>; -+ amux-b-gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>; -+ -+ /* adc mux enable gpio */ -+ amux-en-gpios = <&gpio1 RK_PB0 GPIO_ACTIVE_LOW>; -+ -+ /* adc calculate scale */ -+ button-adc-scale = <2>; -+ -+ /* adc deadzone range */ -+ button-adc-deadzone = <180>; -+ -+ /* -+ 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 XU10 */ -+ invert-absx; -+ invert-absy; -+ -+ /* 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 = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-UP"; -+ linux,code = ; // 0x220 -+ }; -+ sw2 { -+ gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-DOWN"; -+ linux,code = ; // 0x221 -+ }; -+ sw3 { -+ gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-LEFT"; -+ linux,code = ; // 0x222 -+ }; -+ sw4 { -+ gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-RIGHT"; -+ linux,code = ; // 0x223 -+ }; -+ sw5 { -+ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-A"; -+ linux,code = ; // 0x130 -+ }; -+ sw6 { -+ gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-B"; -+ linux,code = ; // 0x131 -+ }; -+ sw7 { -+ gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-Y"; -+ linux,code = ; // 0x133 -+ }; -+ sw8 { -+ gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-X"; -+ linux,code = ; // 0x134 -+ }; -+ sw9 { -+ gpios = <&gpio2 RK_PB0 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-SELECT"; -+ linux,code = ; // 0x13a -+ }; -+ sw10 { -+ gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-START"; -+ linux,code = ; // 0x13b -+ }; -+ sw11 { -+ gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-THUMBL"; -+ linux,code = ; // 0x13d -+ }; -+ sw12 { -+ gpios = <&gpio2 RK_PB2 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-THUMBR"; -+ linux,code = ; // 0x13e -+ }; -+ sw13 { -+ gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-G"; -+ linux,code = ; // 0x2c0 -+ }; -+ sw14 { -+ gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-LEFT"; -+ linux,code = ; // 0x136 -+ }; -+ sw15 { -+ gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-RIGHT"; -+ linux,code = ; // 0x137 -+ }; -+ sw16 { -+ gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-RIGHT2"; -+ linux,code = ; // 0x139 -+ }; -+ sw17 { -+ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-LEFT2"; -+ linux,code = ; // 0x138 -+ }; -+ }; -+ -+ 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>; -+ }; -+ -+ gpio-keys-vol { -+ compatible = "gpio-keys"; -+ autorepeat; -+ pinctrl-0 = <&btn_pins_vol>; -+ pinctrl-names = "default"; -+ -+ button-vol-down { -+ gpios = <&gpio0 RK_PC1 GPIO_ACTIVE_LOW>; -+ label = "VOLUMEDOWN"; -+ linux,code = ; -+ }; -+ -+ button-vol-up { -+ gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "VOLUMEUP"; -+ linux,code = ; -+ }; -+ }; -+ -+ leds: gpio-leds { -+ compatible = "gpio-leds"; -+ pinctrl-0 = <&led_pins>; -+ pinctrl-names = "default"; -+ -+ led-0 { -+ color = ; -+ default-state = "off"; -+ function = LED_FUNCTION_CHARGING; -+ gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; -+ }; -+ -+ led-1 { -+ color = ; -+ default-state = "off"; -+ function = LED_FUNCTION_STATUS; -+ gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; -+ }; -+ }; -+ -+ rk817-sound { -+ compatible = "simple-audio-card"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hp_det>; -+ simple-audio-card,name = "rk817_int"; -+ simple-audio-card,format = "i2s"; -+ simple-audio-card,hp-det-gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_LOW>; -+ simple-audio-card,mclk-fs = <256>; -+ simple-audio-card,widgets = -+ "Microphone", "Mic Jack", -+ "Headphone", "Headphones", -+ "Speaker", "Speaker"; -+ simple-audio-card,routing = -+ "MICL", "Mic Jack", -+ "Headphones", "HPOL", -+ "Headphones", "HPOR", -+ "Speaker", "SPKO"; -+ -+ 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-min-microvolt = <3800000>; -+ regulator-max-microvolt = <3800000>; -+ }; -+ -+ 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 = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; -+ enable-active-high; -+ regulator-always-on; -+ regulator-boot-on; -+ vin-supply = <&usb_midu>; -+ }; -+}; -+ -+&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 = "magicx,xu10-panel", "sitronix,st7703"; -+ 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>; -+ -+ 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>; -+ vcc9-supply = <&usb_midu>; -+ -+ regulators { -+ vdd_logic: DCDC_REG1 { -+ regulator-name = "vdd_logic"; -+ regulator-min-microvolt = <850000>; -+ regulator-max-microvolt = <1150000>; -+ 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 = <850000>; -+ regulator-max-microvolt = <1350000>; -+ regulator-ramp-delay = <6001>; -+ 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-state-mem { -+ regulator-on-in-suspend; -+ }; -+ }; -+ -+ vcc_3v0: DCDC_REG4 { -+ regulator-name = "vcc_3v0"; -+ regulator-min-microvolt = <3000000>; -+ regulator-max-microvolt = <3000000>; -+ 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 = <1800000>; -+ regulator-max-microvolt = <3000000>; -+ regulator-always-on; -+ regulator-boot-on; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <3000000>; -+ }; -+ }; -+ -+ vcc2v8_dvp: LDO_REG7 { -+ regulator-name = "vcc2v8_dvp"; -+ regulator-min-microvolt = <2800000>; -+ regulator-max-microvolt = <2800000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <2800000>; -+ }; -+ }; -+ -+ vcc3v0_dvp: LDO_REG8 { -+ regulator-name = "vcc3v0_dvp"; -+ 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>; -+ }; -+ }; -+ -+ vdd1v5_dvp: LDO_REG9 { -+ regulator-min-microvolt = <1500000>; -+ regulator-max-microvolt = <1500000>; -+ regulator-name = "vdd1v5_dvp"; -+ -+ 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 = <&vcc1v8_soc>; -+ vccio2-supply = <&vccio_sd>; -+ vccio3-supply = <&vcc3v0_dvp>; -+ vccio4-supply = <&vcc_3v0>; -+ vccio5-supply = <&vcc_3v0>; -+ vccio6-supply = <&vcc_3v0>; -+ 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 { -+ cap-sd-highspeed; -+ card-detect-delay = <200>; -+ cd-gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/ -+ sd-uhs-sdr12; -+ sd-uhs-sdr25; -+ sd-uhs-sdr50; -+ sd-uhs-sdr104; -+ vmmc-supply = <&vcc_sd>; -+ vqmmc-supply = <&vccio_sd>; -+ status = "okay"; -+}; -+ -+&tsadc { -+ status = "okay"; -+}; -+ -+&u2phy { -+ status = "okay"; -+ -+ u2phy_host: host-port { -+ status = "okay"; -+ }; -+ -+ u2phy_otg: otg-port { -+ status = "disabled"; -+ }; -+}; -+ -+/* FIQ Header(P2): 2(RXD:GPIO2.B4),3(TXD:.B6) */ -+&uart2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart2m1_xfer>; -+ status = "okay"; -+}; -+ -+&usb20_otg { -+ status = "okay"; -+ dr_mode = "host"; -+}; -+ -+&vopb { -+ status = "okay"; -+}; -+ -+&vopb_mmu { -+ status = "okay"; -+}; -+ -+&pinctrl { -+ btns { -+ btn_pins: btn-pins { -+ rockchip,pins = <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ -+ btn_pins_vol: btn-pins-vol { -+ rockchip,pins = -+ <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up>, -+ <0 RK_PB7 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>; -+ }; -+ }; -+ -+ gpio-led { -+ led_pins: led-pins { -+ rockchip,pins = -+ <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>, -+ <0 RK_PB4 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>; -+ }; -+ }; -+}; -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go.dtsi b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go.dtsi -index 80fc53c807a4..84dbabeb6e03 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go.dtsi -@@ -25,93 +25,40 @@ backlight: backlight { - compatible = "pwm-backlight"; - power-supply = <&vcc_bl>; - pwms = <&pwm1 0 25000 0>; -- }; -- -- builtin_gamepad: gpio-keys { -- compatible = "gpio-keys"; -- pinctrl-names = "default"; -- pinctrl-0 = <&btn_pins>; -- -- button-sw1 { -- gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; -- label = "DPAD-UP"; -- linux,code = ; -- }; -- button-sw2 { -- gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; -- label = "DPAD-DOWN"; -- linux,code = ; -- }; -- button-sw3 { -- gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; -- label = "DPAD-LEFT"; -- linux,code = ; -- }; -- button-sw4 { -- gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; -- label = "DPAD-RIGHT"; -- linux,code = ; -- }; -- button-sw5 { -- gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; -- label = "BTN-A"; -- linux,code = ; -- }; -- button-sw6 { -- gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; -- label = "BTN-B"; -- linux,code = ; -- }; -- button-sw7 { -- gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; -- label = "BTN-Y"; -- linux,code = ; -- }; -- button-sw8 { -- gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; -- label = "BTN-X"; -- linux,code = ; -- }; -- btn_f1: button-sw9 { -- gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; -- label = "F1"; -- linux,code = ; -- }; -- btn_f2: button-sw10 { -- gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; -- label = "F2"; -- linux,code = ; -- }; -- btn_f3: button-sw11 { -- gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; -- label = "F3"; -- linux,code = ; -- }; -- btn_f4: button-sw12 { -- gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; -- label = "F4"; -- linux,code = ; -- }; -- btn_f5: button-sw13 { -- gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; -- label = "F5"; -- linux,code = ; -- }; -- btn_f6: button-sw14 { -- gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; -- label = "F6"; -- linux,code = ; -- }; -- button-sw15 { -- gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; -- label = "TOP-LEFT"; -- linux,code = ; -- }; -- button-sw16 { -- gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; -- label = "TOP-RIGHT"; -- linux,code = ; -- }; -+ 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>; - }; - - /* led-1 is wired directly to output of always-on regulator */ -@@ -187,6 +134,10 @@ vcc_host: vcc_host { - }; - }; - -+&dmc { -+ center-supply = <&vdd_logic>; -+}; -+ - &cpu0 { - cpu-supply = <&vdd_arm>; - }; -@@ -236,7 +187,6 @@ internal_display: panel@0 { - reg = <0>; - backlight = <&backlight>; - reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; -- rotation = <270>; - - port { - mipi_in_panel: endpoint { -@@ -271,6 +221,7 @@ rk817: pmic@20 { - 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>; -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2-v11.dts b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2-v11.dts -index d94ac81eb4e6..1c276b93cb4a 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2-v11.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2-v11.dts -@@ -16,31 +16,188 @@ aliases { - mmc1 = &sdio; - }; - -- analog_sticks: adc-joystick { -- compatible = "adc-joystick"; -- io-channels = <&saradc 1>, -- <&saradc 2>; -- poll-interval = <60>; -- #address-cells = <1>; -- #size-cells = <0>; -- -- axis@0 { -- reg = <0>; -- abs-flat = <10>; -- abs-fuzz = <10>; -- abs-range = <172 772>; -- linux,code = ; -- }; -+ gpio_keys: volume-keys { -+ compatible = "gpio-keys"; -+ autorepeat; -+ pinctrl-0 = <&btn_pins_vol>; -+ pinctrl-names = "default"; -+ -+ volume-up-button { -+ label = "VOLUMEUP"; -+ linux,code = ; -+ gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; -+ -+ }; -+ volume-down-button { -+ label = "VOLUMEDOWN"; -+ linux,code = ; -+ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; - -- axis@1 { -- reg = <1>; -- abs-flat = <10>; -- abs-fuzz = <10>; -- abs-range = <278 815>; -- linux,code = ; - }; - }; - -+ joypad: odroidgo2-joypad { -+ compatible = "odroidgo2-v11-joypad"; -+ -+ /* -+ - odroidgo2-joypad sysfs list - -+ * for poll device interval(ms) -+ /sys/devices/platform/odroidgo2_joypad/poll_interval [rw] -+ * for button-adc-fuzz -+ /sys/devices/platform/odroidgo2_joypad/adc_fuzz [r] -+ * for button-adc-flat -+ /sys/devices/platform/odroidgo2_joypad/adc_flat [r] -+ -+ * for report control(1:enable, 0:disable) -+ /sys/devices/platform/odroidgo2_joypad/enable [rw] -+ * for adc calibration value setup(1:current adcs value -> cal value) -+ /sys/devices/platform/odroidgo2_joypad/adc_cal [rw] -+ */ -+ -+ /* gpio pincontrol setup */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&btn_pins>; -+ -+ /* JOY_X, JOY_Y Channel define */ -+ io-channel-names = "joy_x", "joy_y"; -+ io-channels = <&saradc 1>, <&saradc 2>; -+ -+ /* adc channel count */ -+ button-adc-count = <2>; -+ -+ /* adc calculate scale */ -+ button-adc-scale = <2>; -+ -+ /* adc deadzone range */ -+ button-adc-deadzone = <20>; -+ -+ /* -+ joy-stick voltage range -+ /sys/devices/platform/ff288000.saradc/iio:device0 -+ adc-x : in_voltage1_raw -+ adc-y : in_voltage2_raw -+ -+ range calculate. -+ (adc raw max value - adc raw min value) * scale * 1.7515 -+ */ -+ button-adc-x-range = <1800>; -+ button-adc-y-range = <1800>; -+ -+ /* -+ specifies fuzz value that is used to filter noise from -+ the event stream. -+ */ -+ button-adc-fuzz = <32>; -+ button-adc-flat = <32>; -+ -+ /* poll device interval (ms), adc read interval */ -+ poll-interval = <10>; -+ -+ /* gpio button auto repeat set value : default disable */ -+ /* -+ autorepeat; -+ */ -+ -+ /* -+ *** ODROIDGO2-Advance Switch layoout *** -+ |------------------------------------------------| -+ | sw15 sw16 | -+ | sw20 sw21 | -+ |------------------------------------------------| -+ | sw1 |-------------------| sw8 | -+ | sw3 sw4 | | sw7 sw5 | -+ | sw2 | LCD Display | sw6 | -+ | | | | -+ | |-------------------| | -+ | sw9 sw10 vol- vol+ sw13 sw14 | -+ |------------------------------------------------| -+ */ -+ /* -+ joypad driver is poll-device driver. -+ poll-device is does not support wakeup-source. -+ */ -+ sw1 { -+ gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-UP"; -+ linux,code = ; // 0x220 -+ }; -+ sw2 { -+ gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-DOWN"; -+ linux,code = ; // 0x221 -+ }; -+ sw3 { -+ gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-LEFT"; -+ linux,code = ; // 0x222 -+ }; -+ sw4 { -+ gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-RIGHT"; -+ linux,code = ; // 0x223 -+ }; -+ sw5 { -+ gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "GPIO KEY BTN-A"; -+ linux,code = ; // 0x131 -+ }; -+ sw6 { -+ gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-B"; -+ linux,code = ; // 0x130 -+ }; -+ sw7 { -+ gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-Y"; -+ linux,code = ; // 0x134 -+ }; -+ sw8 { -+ gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-X"; -+ linux,code = ; // 0x133 -+ }; -+ sw9 { -+ gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-SELECT"; -+ linux,code = ; // 0x2c0 -+ }; -+ sw10 { -+ gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-THUMBL"; -+ linux,code = ; // 0x2c1 -+ }; -+ sw13 { -+ gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-THUMBR"; -+ linux,code = ; // 0x2c4 -+ }; -+ sw14 { -+ gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-START"; -+ linux,code = ; // 0x13c -+ }; -+ sw15 { -+ gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-LEFT"; -+ linux,code = ; // 0x02 -+ }; -+ sw16 { -+ gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-RIGHT"; -+ linux,code = ; // 0x05 -+ }; -+ sw20 { -+ gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-LEFT2"; -+ linux,code = ; -+ }; -+ sw21 { -+ gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-RIGHT2"; -+ linux,code = ; -+ }; -+ }; -+ - battery: battery { - compatible = "simple-battery"; - charge-full-design-microamp-hours = <3000000>; -@@ -65,19 +221,8 @@ wifi_pwrseq: wifi-pwrseq { - pinctrl-names = "default"; - pinctrl-0 = <&wifi_pwrseq_pins>; - reset-gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; -- }; --}; -- --&builtin_gamepad { -- button-sw20 { -- gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; -- label = "TOP-LEFT 2"; -- linux,code = ; -- }; -- button-sw21 { -- gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; -- label = "TOP-RIGHT 2"; -- linux,code = ; -+ post-power-on-delay-ms = <300>; -+ power-off-delay-us = <200000>; - }; - }; - -@@ -85,6 +230,7 @@ &internal_display { - compatible = "elida,kd35t133"; - iovcc-supply = <&vcc_lcd>; - vdd-supply = <&vcc_lcd>; -+ rotation = <270>; - }; - - &rk817 { -@@ -93,9 +239,11 @@ vcc_wifi: LDO_REG9 { - regulator-name = "vcc_wifi"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; -+ regulator-always-on; -+ regulator-boot-on; - - regulator-state-mem { -- regulator-on-in-suspend; -+ regulator-off-in-suspend; - regulator-suspend-microvolt = <3300000>; - }; - }; -@@ -112,16 +260,15 @@ &sdio { - cap-sdio-irq; - disable-wp; - keep-power-in-suspend; -- mmc-pwrseq = <&wifi_pwrseq>; - non-removable; - vmmc-supply = <&vcc_wifi>; -- #address-cells = <1>; -- #size-cells = <0>; -+ mmc-pwrseq = <&wifi_pwrseq>; - status = "okay"; - - esp8089: wifi@1 { - compatible = "esp,esp8089"; - reg = <1>; -+ esp,crystal-26M-en = <1>; - }; - }; - -@@ -138,8 +285,6 @@ btn_pins: btn-pins { - <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, - <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, - <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>, -- <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, -- <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, - <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, - <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, - <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -@@ -148,6 +293,10 @@ - <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, - <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; - }; -+ btn_pins_vol: btn-pins-vol { -+ rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; - }; - - wifi { -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts -index aa6f5b12206b..f142737a0111 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts -@@ -12,30 +12,175 @@ / { - model = "ODROID-GO Advance"; - compatible = "hardkernel,rk3326-odroid-go2", "rockchip,rk3326"; - -- analog_sticks: adc-joystick { -- compatible = "adc-joystick"; -- io-channels = <&saradc 1>, -- <&saradc 2>; -- poll-interval = <60>; -- #address-cells = <1>; -- #size-cells = <0>; -- -- axis@0 { -- reg = <0>; -- abs-flat = <10>; -- abs-fuzz = <10>; -- abs-range = <172 772>; -- linux,code = ; -- }; -- -- axis@1 { -- reg = <1>; -- abs-flat = <10>; -- abs-fuzz = <10>; -- abs-range = <278 815>; -- linux,code = ; -- }; -- }; -+ gpio_keys: volume-keys { -+ compatible = "gpio-keys-polled"; -+ poll-interval = <5>; -+ autorepeat; -+ -+ volume-up-button { -+ label = "VOLUME-UP"; -+ linux,code = ; -+ gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; -+ -+ }; -+ volume-down-button { -+ label = "VOLUME-DOWN"; -+ linux,code = ; -+ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; -+ -+ }; -+ }; -+ -+ joypad: odroidgo2-joypad { -+ compatible = "odroidgo2-joypad"; -+ -+ /* -+ - odroidgo2-joypad sysfs list - -+ * for poll device interval(ms) -+ /sys/devices/platform/odroidgo2_joypad/poll_interval [rw] -+ * for button-adc-fuzz -+ /sys/devices/platform/odroidgo2_joypad/adc_fuzz [r] -+ * for button-adc-flat -+ /sys/devices/platform/odroidgo2_joypad/adc_flat [r] -+ -+ * for report control(1:enable, 0:disable) -+ /sys/devices/platform/odroidgo2_joypad/enable [rw] -+ * for adc calibration value setup(1:current adcs value -> cal value) -+ /sys/devices/platform/odroidgo2_joypad/adc_cal [rw] -+ */ -+ -+ /* gpio pincontrol setup */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&btn_pins>; -+ -+ /* JOY_X, JOY_Y Channel define */ -+ io-channel-names = "joy_x", "joy_y"; -+ io-channels = <&saradc 1>, <&saradc 2>; -+ -+ /* adc channel count */ -+ button-adc-count = <2>; -+ -+ /* adc calculate scale */ -+ button-adc-scale = <2>; -+ -+ /* adc deadzone range */ -+ button-adc-deadzone = <20>; -+ -+ /* -+ joy-stick voltage range -+ /sys/devices/platform/ff288000.saradc/iio:device0 -+ adc-x : in_voltage1_raw -+ adc-y : in_voltage2_raw -+ -+ range calculate. -+ (adc raw max value - adc raw min value) * scale * 1.7515 -+ */ -+ button-adc-x-range = <1800>; -+ button-adc-y-range = <1800>; -+ -+ /* -+ specifies fuzz value that is used to filter noise from -+ the event stream. -+ */ -+ button-adc-fuzz = <32>; -+ button-adc-flat = <32>; -+ -+ /* poll device interval (ms), adc read interval */ -+ poll-interval = <10>; -+ -+ /* gpio button auto repeat set value : default disable */ -+ /* -+ autorepeat; -+ */ -+ -+ /* -+ *** ODROIDGO2-Advance Switch layoout *** -+ |------------------------------------------------| -+ | sw15 sw16 | -+ |------------------------------------------------| -+ | sw1 |-------------------| sw8 | -+ | sw3 sw4 | | sw7 sw5 | -+ | sw2 | LCD Display | sw6 | -+ | | | | -+ | |-------------------| | -+ | sw9 sw10 vol- vol+ sw13 sw14 | -+ |------------------------------------------------| -+ */ -+ /* -+ joypad driver is poll-device driver. -+ poll-device is does not support wakeup-source. -+ */ -+ sw1 { -+ gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-UP"; -+ linux,code = ; // 0x220 -+ }; -+ sw2 { -+ gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-DOWN"; -+ linux,code = ; // 0x221 -+ }; -+ sw3 { -+ gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-LEFT"; -+ linux,code = ; // 0x222 -+ }; -+ sw4 { -+ gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-RIGHT"; -+ linux,code = ; // 0x223 -+ }; -+ sw5 { -+ gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "GPIO KEY BTN-A"; -+ linux,code = ; // 0x131 -+ }; -+ sw6 { -+ gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-B"; -+ linux,code = ; // 0x130 -+ }; -+ sw7 { -+ gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-Y"; -+ linux,code = ; // 0x134 -+ }; -+ sw8 { -+ gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-X"; -+ linux,code = ; // 0x133 -+ }; -+ sw9 { -+ gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; -+ label = "GPIO F1"; -+ linux,code = ; // 0x2c0 -+ }; -+ sw10 { -+ gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; -+ label = "GPIO F2"; -+ linux,code = ; // 0x2c1 -+ }; -+ sw13 { -+ gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; -+ label = "GPIO F5"; -+ linux,code = ; // 0x2c4 -+ }; -+ sw14 { -+ gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "GPIO F6"; -+ linux,code = ; // 0x13c -+ }; -+ sw15 { -+ gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-LEFT"; -+ linux,code = ; // 0x02 -+ }; -+ sw16 { -+ gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-RIGHT"; -+ linux,code = ; // 0x05 -+ }; -+ }; - - battery: battery { - compatible = "simple-battery"; -@@ -61,8 +206,30 @@ &internal_display { - compatible = "elida,kd35t133"; - iovcc-supply = <&vcc_lcd>; - vdd-supply = <&vcc_lcd>; -+ rotation = <270>; - }; - - &rk817_charger { - monitored-battery = <&battery>; - }; -+ -+&pinctrl { -+ btns { -+ btn_pins: btn-pins { -+ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+}; -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go3.dts b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go3.dts -index 35bbaf559ca3..d03b3d9cb675 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go3.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go3.dts -@@ -12,67 +12,201 @@ / { - model = "ODROID-GO Super"; - compatible = "hardkernel,rk3326-odroid-go3", "rockchip,rk3326"; - -- joystick_mux_controller: mux-controller { -- compatible = "gpio-mux"; -- pinctrl = <&mux_en_pins>; -- #mux-control-cells = <0>; -+ joypad: odroidgo3-joypad { -+ compatible = "odroidgo3-joypad"; - -- mux-gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>, -- <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; -- }; -+ joypad-name = "odroidgo3_joypad"; -+ joypad-product = <0x0001>; -+ joypad-revision = <0x0101>; -+ -+ status = "okay"; -+ /* -+ - odroidgo3-joypad sysfs list - -+ * for poll device interval(ms) -+ /sys/devices/platform/odroidgo3_joypad/poll_interval [rw] -+ ex) echo 20 > poll_interval -+ * for button-adc-fuzz -+ /sys/devices/platform/odroidgo3_joypad/adc_fuzz [r] -+ * for button-adc-flat -+ /sys/devices/platform/odroidgo3_joypad/adc_flat [r] -+ -+ * for report control(1:enable, 0:disable) -+ /sys/devices/platform/odroidgo3_joypad/enable [rw] -+ * for adc calibration value setup(current adcs value -> cal value) -+ /sys/devices/platform/odroidgo3_joypad/adc_cal [rw] -+ ex) echo 0 > adc_cal -+ * for amux data debug -+ * Joypad driver is disabled when using this sysfs. -+ /sys/devices/platform/odroidgo3_joypad/amux_debug [rw] -+ ex) echo 0 > amux_debug --> select amux channel -+ ex) cat amux_debug --> get adc data of seleted channel -+ */ -+ -+ /* gpio pincontrol setup */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&btn_pins>; - -- joystick_mux: adc-mux { -- compatible = "io-channel-mux"; -+ /* Analog mux define */ -+ io-channel-names = "amux_adc"; - io-channels = <&saradc 1>; -- io-channel-names = "parent"; -- #io-channel-cells = <1>; - -- mux-controls = <&joystick_mux_controller>; -- channels = "0", "1", "2", "3"; -- }; -+ /* adc mux channel count */ -+ amux-count = <4>; -+ /* adc mux select(a,b) gpio */ -+ amux-a-gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; -+ amux-b-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; -+ /* adc mux enable gpio */ -+ amux-en-gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; - -- analog_sticks: adc-joystick { -- compatible = "adc-joystick"; -- io-channels = <&joystick_mux 0>, -- <&joystick_mux 1>, -- <&joystick_mux 2>, -- <&joystick_mux 3>; -- poll-interval = <60>; -- #address-cells = <1>; -- #size-cells = <0>; -- -- axis@0 { -- reg = <0>; -- abs-flat = <10>; -- abs-fuzz = <10>; -- abs-range = <180 800>; -- linux,code = ; -- }; -+ /* adc calculate scale */ -+ button-adc-scale = <2>; - -- axis@1 { -- reg = <1>; -- abs-flat = <10>; -- abs-fuzz = <10>; -- abs-range = <180 800>; -- linux,code = ; -- }; -+ /* adc deadzone range */ -+ button-adc-deadzone = <64>; - -- axis@2 { -- reg = <2>; -- abs-flat = <10>; -- abs-fuzz = <10>; -- abs-range = <180 800>; -- linux,code = ; -- }; -+ /* -+ specifies fuzz value that is used to filter noise from -+ the event stream. -+ */ -+ button-adc-fuzz = <32>; -+ button-adc-flat = <32>; - -- axis@3 { -- reg = <3>; -- abs-flat = <10>; -- abs-fuzz = <10>; -- abs-range = <180 800>; -- linux,code = ; -- }; -- }; -+ /* -+ Analog Stick data tuning value(precent) -+ p = positive direction, n = negative direction -+ report value = (real_adc_data * tuning_value) / 100 -+ */ -+ abs_x-p-tuning = <180>; -+ abs_x-n-tuning = <180>; -+ -+ abs_y-p-tuning = <180>; -+ abs_y-n-tuning = <170>; -+ -+ abs_rx-p-tuning = <180>; -+ abs_rx-n-tuning = <180>; -+ -+ abs_ry-p-tuning = <180>; -+ abs_ry-n-tuning = <170>; -+ -+ /* poll device interval (ms), adc read interval */ -+ poll-interval = <10>; -+ -+ /* gpio button auto repeat set value : default disable */ -+ /* -+ autorepeat; -+ */ -+ -+ /* -+ *** ODROIDGO3-Advance Switch layoout *** -+ |------------------------------------------------| -+ | sw15 sw21 sw10 sw9 sw20 sw16 | -+ |------------------------------------------------| -+ | sw19 sw22 | -+ | |-------------------| | -+ | sw1 | | sw8 | -+ | sw3 sw4 | | sw7 sw5 | -+ | sw2 | LCD Display | sw6 | -+ | | | | -+ | | | | -+ | |-------------------| | -+ | sw11 sw12 | sd-slot | sw13 sw14 | -+ |-------------------| |------------------| -+ */ -+ /* -+ joypad driver is poll-device driver. -+ poll-device is does not support wakeup-source. -+ */ -+ sw1 { -+ gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-UP"; -+ linux,code = ; // 0x220 -+ }; -+ sw2 { -+ gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-DOWN"; -+ linux,code = ; // 0x221 -+ }; -+ sw3 { -+ gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-LEFT"; -+ linux,code = ; // 0x222 -+ }; -+ sw4 { -+ gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-RIGHT"; -+ linux,code = ; // 0x223 -+ }; -+ sw5 { -+ gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "GPIO KEY BTN-A"; -+ linux,code = ; // 0x131 -+ }; -+ sw6 { -+ gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-B"; -+ linux,code = ; // 0x130 -+ }; -+ sw7 { -+ gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-Y"; -+ linux,code = ; // 0x134 -+ }; -+ sw8 { -+ gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-X"; -+ linux,code = ; // 0x133 -+ }; -+ sw11 { -+ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "GPIO F3"; -+ linux,code = ; // 0x2c2 -+ }; -+ sw12 { -+ gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; -+ label = "GPIO F4"; -+ linux,code = ; // 0x2c3 -+ }; -+ sw13 { -+ gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; -+ label = "GPIO F5"; -+ linux,code = ; // 0x2c4 -+ }; -+ sw14 { -+ gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "GPIO F6"; -+ linux,code = ; // 0x13c -+ }; -+ sw15 { -+ gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-LEFT"; -+ linux,code = ; // 0x02 -+ }; -+ sw16 { -+ gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-RIGHT"; -+ linux,code = ; // 0x05 -+ }; -+ sw19 { -+ gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; -+ label = "GPIO F1"; -+ linux,code = ; -+ }; -+ sw20 { -+ gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-RIGHT2"; -+ linux,code = ; -+ }; -+ sw21 { -+ gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-LEFT2"; -+ linux,code = ; -+ }; -+ sw22 { -+ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "GPIO F2"; -+ linux,code = ; -+ }; -+ }; - - battery: battery { - compatible = "simple-battery"; -@@ -113,39 +247,12 @@ button-volume-up { - }; - }; - --/* f1 and f2 conflict with volume buttons */ --/delete-node/ &btn_f1; --/delete-node/ &btn_f2; -- --&builtin_gamepad { -- button-sw19 { -- gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; -- label = "SELECT"; -- linux,code = ; -- }; -- /* note that TR2 and TL2 are swapped */ -- button-sw20 { -- gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; -- label = "TOP-RIGHT 2"; -- linux,code = ; -- }; -- button-sw21 { -- gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; -- label = "TOP-LEFT 2"; -- linux,code = ; -- }; -- button-sw22 { -- gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; -- label = "START"; -- linux,code = ; -- }; --}; -- - &internal_display { - compatible = "elida,kd50t048a", "sitronix,st7701"; - reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>; - IOVCC-supply = <&vcc_lcd>; - VCC-supply = <&vcc_lcd>; -+ rotation = <270>; - }; - - &rk817_charger { -@@ -179,10 +286,4 @@ btn_pins_vol: btn-pins-vol { - <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; - }; - }; -- -- joystick { -- mux_en_pins: mux-pins { -- rockchip,pins = <3 RK_PB5 RK_FUNC_GPIO &pcfg_output_low>; -- }; -- }; - }; -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-powkiddy-rgb10.dts b/arch/arm64/boot/dts/rockchip/rk3326-powkiddy-rgb10.dts -new file mode 100644 -index 000000000000..23a30542b906 ---- /dev/null -+++ b/arch/arm64/boot/dts/rockchip/rk3326-powkiddy-rgb10.dts -@@ -0,0 +1,280 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2019 Hardkernel Co., Ltd -+ * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH -+ * Copyright (c) 2022 Maya Matuszczyk -+ */ -+ -+/dts-v1/; -+#include "rk3326-odroid-go.dtsi" -+ -+/ { -+ model = "Powkiddy RGB10"; -+ compatible = "powkiddy,rk3326-rgb10", "rockchip,rk3326"; -+ -+ aliases { -+ mmc1 = &sdio; -+ }; -+ -+ joypad: odroidgo2-joypad { -+ compatible = "odroidgo2-v11-joypad"; -+ -+ /* -+ - odroidgo2-joypad sysfs list - -+ * for poll device interval(ms) -+ /sys/devices/platform/odroidgo2_joypad/poll_interval [rw] -+ * for button-adc-fuzz -+ /sys/devices/platform/odroidgo2_joypad/adc_fuzz [r] -+ * for button-adc-flat -+ /sys/devices/platform/odroidgo2_joypad/adc_flat [r] -+ -+ * for report control(1:enable, 0:disable) -+ /sys/devices/platform/odroidgo2_joypad/enable [rw] -+ * for adc calibration value setup(1:current adcs value -> cal value) -+ /sys/devices/platform/odroidgo2_joypad/adc_cal [rw] -+ */ -+ -+ /* gpio pincontrol setup */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&btn_pins>; -+ -+ /* JOY_X, JOY_Y Channel define */ -+ io-channel-names = "joy_x", "joy_y"; -+ io-channels = <&saradc 1>, <&saradc 2>; -+ -+ /* adc channel count */ -+ button-adc-count = <2>; -+ -+ /* adc calculate scale */ -+ button-adc-scale = <2>; -+ -+ /* adc deadzone range */ -+ button-adc-deadzone = <20>; -+ -+ /* -+ joy-stick voltage range -+ /sys/devices/platform/ff288000.saradc/iio:device0 -+ adc-x : in_voltage1_raw -+ adc-y : in_voltage2_raw -+ -+ range calculate. -+ (adc raw max value - adc raw min value) * scale * 1.7515 -+ */ -+ button-adc-x-range = <1800>; -+ button-adc-y-range = <1800>; -+ -+ /* -+ specifies fuzz value that is used to filter noise from -+ the event stream. -+ */ -+ button-adc-fuzz = <32>; -+ button-adc-flat = <32>; -+ -+ /* poll device interval (ms), adc read interval */ -+ poll-interval = <10>; -+ -+ /* gpio button auto repeat set value : default disable */ -+ /* -+ autorepeat; -+ */ -+ -+ /* -+ *** RGB10 Switch layoout *** -+ |------------------------------------------------| -+ | sw15 sw16 | -+ | sw20 sw21 | -+ |------------------------------------------------| -+ | sw1 sw10 |-------------------| sw13 sw8 | -+ | sw3 sw4 | | sw7 sw5 | -+ | sw2 | LCD Display | sw6 | -+ | | | | -+ | |-------------------| | -+ |------------------------------------------------| -+ */ -+ /* -+ joypad driver is poll-device driver. -+ poll-device is does not support wakeup-source. -+ */ -+ sw1 { -+ gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-UP"; -+ linux,code = ; // 0x220 -+ }; -+ sw2 { -+ gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-DOWN"; -+ linux,code = ; // 0x221 -+ }; -+ sw3 { -+ gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-LEFT"; -+ linux,code = ; // 0x222 -+ }; -+ sw4 { -+ gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-RIGHT"; -+ linux,code = ; // 0x223 -+ }; -+ sw5 { -+ gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "GPIO KEY BTN-A"; -+ linux,code = ; // 0x131 -+ }; -+ sw6 { -+ gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-B"; -+ linux,code = ; // 0x130 -+ }; -+ sw7 { -+ gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-Y"; -+ linux,code = ; // 0x134 -+ }; -+ sw8 { -+ gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-X"; -+ linux,code = ; // 0x133 -+ }; -+ sw9 { -+ gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-SELECT"; -+ linux,code = ; // 0x2c0 -+ }; -+ sw10 { -+ gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-THUMBL"; -+ linux,code = ; // 0x2c1 -+ }; -+ sw13 { -+ gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-THUMBR"; -+ linux,code = ; // 0x2c4 -+ }; -+ sw14 { -+ gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-START"; -+ linux,code = ; // 0x13c -+ }; -+ sw15 { -+ gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-LEFT"; -+ linux,code = ; // 0x02 -+ }; -+ sw16 { -+ gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-RIGHT"; -+ linux,code = ; // 0x05 -+ }; -+ sw20 { -+ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-LEFT2"; -+ linux,code = ; -+ }; -+ sw21 { -+ gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-RIGHT2"; -+ linux,code = ; -+ }; -+ }; -+ -+ battery: battery { -+ compatible = "simple-battery"; -+ charge-full-design-microamp-hours = <2800000>; -+ charge-term-current-microamp = <280000>; -+ constant-charge-current-max-microamp = <2000000>; -+ constant-charge-voltage-max-microvolt = <4200000>; -+ factory-internal-resistance-micro-ohms = <180000>; -+ voltage-max-design-microvolt = <4100000>; -+ voltage-min-design-microvolt = <3500000>; -+ -+ ocv-capacity-celsius = <20>; -+ ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, -+ <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, -+ <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, -+ <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, -+ <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, -+ <3574170 0>; -+ }; -+ -+ wifi_pwrseq: wifi-pwrseq { -+ compatible = "mmc-pwrseq-simple"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&wifi_pwrseq_pins>; -+ /*reset-gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>;*/ -+ }; -+}; -+ -+&internal_display { -+ compatible = "elida,kd35t133"; -+ iovcc-supply = <&vcc_lcd>; -+ vdd-supply = <&vcc_lcd>; -+ rotation = <270>; -+}; -+ -+&rk817 { -+ regulators { -+ vcc_wifi: LDO_REG9 { -+ regulator-name = "vcc_wifi"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-always-on; -+ regulator-boot-on; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <3300000>; -+ }; -+ }; -+ }; -+}; -+ -+&rk817_charger { -+ monitored-battery = <&battery>; -+}; -+ -+&sdio { -+ bus-width = <4>; -+ cap-sd-highspeed; -+ cap-sdio-irq; -+ disable-wp; -+ keep-power-in-suspend; -+ non-removable; -+ vmmc-supply = <&vcc_wifi>; -+ status = "okay"; -+ -+ esp8089: wifi@1 { -+ compatible = "esp,esp8089"; -+ reg = <1>; -+ esp,crystal-26M-en = <2>; -+ }; -+}; -+ -+&pinctrl { -+ btns { -+ btn_pins: btn-pins { -+ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ wifi { -+ wifi_pwrseq_pins: wifi-pwrseq-pins { -+ rockchip,pins = /*<3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>,*/ -+ <3 RK_PB6 RK_FUNC_GPIO &pcfg_output_high>; -+ }; -+ }; -+}; -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-powkiddy-rgb20s.dts b/arch/arm64/boot/dts/rockchip/rk3326-powkiddy-rgb20s.dts -new file mode 100644 -index 000000000000..cf507db957ed ---- /dev/null -+++ b/arch/arm64/boot/dts/rockchip/rk3326-powkiddy-rgb20s.dts -@@ -0,0 +1,340 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2019 Hardkernel Co., Ltd -+ * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH -+ * Copyright (c) 2022 Maya Matuszczyk -+ */ -+ -+/dts-v1/; -+#include "rk3326-odroid-go.dtsi" -+ -+/ { -+ model = "Powkiddy RGB20S"; -+ compatible = "powkiddy,rgb20s", "rockchip,rk3326"; -+ -+ aliases { -+ mmc0 = &sdio; -+ mmc1 = &sdmmc; -+ }; -+ -+ gpio-keys-vol { -+ compatible = "gpio-keys"; -+ autorepeat; -+ pinctrl-0 = <&btn_pins_vol>; -+ pinctrl-names = "default"; -+ -+ button-vol-down { -+ gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; -+ label = "VOLUMEDOWN"; -+ linux,code = ; -+ }; -+ -+ button-volume-up { -+ gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; -+ label = "VOLUMEUP"; -+ linux,code = ; -+ }; -+ }; -+ -+ joypad: rgb20s-joypad { -+ compatible = "rgb20s-joypad"; -+ -+ pwms = <&pwm0 0 200000000 0>; -+ pwm-names = "enable"; -+ rumble-boost-weak = <0x0000>; -+ rumble-boost-strong = <0x0000>; -+ -+ joypad-name = "RGB20S Gamepad"; -+ joypad-product = <0x1177>; -+ joypad-revision = <0x0177>; -+ -+ status = "okay"; -+ /* -+ - odroidgo3-joypad sysfs list - -+ * for poll device interval(ms) -+ /sys/devices/platform/odroidgo3_joypad/poll_interval [rw] -+ ex) echo 20 > poll_interval -+ * for button-adc-fuzz -+ /sys/devices/platform/odroidgo3_joypad/adc_fuzz [r] -+ * for button-adc-flat -+ /sys/devices/platform/odroidgo3_joypad/adc_flat [r] -+ -+ * for report control(1:enable, 0:disable) -+ /sys/devices/platform/odroidgo3_joypad/enable [rw] -+ * for adc calibration value setup(current adcs value -> cal value) -+ /sys/devices/platform/odroidgo3_joypad/adc_cal [rw] -+ ex) echo 0 > adc_cal -+ -+ * for rumble period(ns) -+ /sys/devices/platform/odroidgo3_joypad/rumble_period -+ ex) echo 20000000 > rumble_duty_cycle -+ ex) cat rumble_duty_cycle -->get current duty cycle -+ -+ * for rumble boost(0~65535) -+ /sys/devices/platform/odroidgo3_joypad/rumble_boost_weak -+ /sys/devices/platform/odroidgo3_joypad/rumble_boost_strong -+ -+ * for amux data debug -+ * Joypad driver is disabled when using this sysfs. -+ /sys/devices/platform/odroidgo3_joypad/amux_debug [rw] -+ ex) echo 0 > amux_debug --> select amux channel -+ ex) cat amux_debug --> get adc data of seleted channel -+ */ -+ -+ /* gpio pincontrol setup */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&btn_pins>; -+ pinctrl-1 = <&pwm0_pin>; -+ -+ /* Analog mux define */ -+ io-channel-names = "amux_adc"; -+ io-channels = <&saradc 1>; -+ -+ /* adc mux channel count */ -+ amux-count = <4>; -+ /* adc mux select(a,b) gpio */ -+ amux-a-gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; -+ amux-b-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; -+ /* adc mux enable gpio */ -+ amux-en-gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; -+ -+ /* 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; -+ -+ /* gpio button auto repeat set value : default disable */ -+ /* -+ autorepeat; -+ */ -+ -+ /* -+ joypad driver is poll-device driver. -+ poll-device is does not support wakeup-source. -+ */ -+ sw1 { -+ gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-UP"; -+ linux,code = ; // 0x220 -+ }; -+ sw2 { -+ gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-DOWN"; -+ linux,code = ; // 0x221 -+ }; -+ sw3 { -+ gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-LEFT"; -+ linux,code = ; // 0x222 -+ }; -+ sw4 { -+ gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-RIGHT"; -+ linux,code = ; // 0x223 -+ }; -+ sw5 { -+ gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "GPIO KEY BTN-A"; -+ linux,code = ; // 0x131 -+ }; -+ sw6 { -+ gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-B"; -+ linux,code = ; // 0x130 -+ }; -+ sw7 { -+ gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-Y"; -+ linux,code = ; // 0x134 -+ }; -+ sw8 { -+ gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-X"; -+ linux,code = ; // 0x133 -+ }; -+ sw11 { -+ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "GPIO F3"; -+ linux,code = ; // 0x2c2 -+ }; -+ sw12 { -+ gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; -+ label = "GPIO F4"; -+ linux,code = ; // 0x2c3 -+ }; -+ /*sw13 { -+ gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; -+ label = "GPIO F5"; -+ linux,code = ; // 0x2c4 -+ }; -+ sw14 { -+ gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; -+ label = "GPIO F6"; -+ linux,code = ; // 0x13c -+ };*/ -+ sw15 { -+ gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-LEFT"; -+ linux,code = ; // 0x02 -+ }; -+ sw16 { -+ gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-RIGHT"; -+ linux,code = ; // 0x05 -+ }; -+ sw19 { -+ gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; -+ label = "GPIO F1"; -+ linux,code = ; -+ }; -+ sw20 { -+ gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-RIGHT2"; -+ linux,code = ; -+ }; -+ sw21 { -+ gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-LEFT2"; -+ linux,code = ; -+ }; -+ sw22 { -+ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "GPIO F2"; -+ linux,code = ; -+ }; -+ }; -+ -+ battery: battery { -+ compatible = "simple-battery"; -+ charge-full-design-microamp-hours = <3500000>; -+ charge-term-current-microamp = <350000>; -+ constant-charge-current-max-microamp = <2000000>; -+ constant-charge-voltage-max-microvolt = <4200000>; -+ factory-internal-resistance-micro-ohms = <180000>; -+ voltage-max-design-microvolt = <4100000>; -+ voltage-min-design-microvolt = <3500000>; -+ -+ ocv-capacity-celsius = <20>; -+ ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, -+ <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, -+ <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, -+ <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, -+ <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, -+ <3574170 0>; -+ }; -+}; -+ -+/* conflicts with pwm vibration motor */ -+/delete-node/ &vcc_host; -+ -+/* Device only has 1 LED compared to Odroid Go Advance */ -+/delete-node/ &gpio_led; -+ -+&internal_display { -+// compatible = "anbernic,rg351v-panel", "newvision,nv3051d"; -+ compatible = "powkiddy,rk2023-panel", "newvision,nv3051d"; -+ iovcc-supply = <&vcc_lcd>; -+ vdd-supply = <&vcc_lcd>; -+}; -+ -+&io_domains { -+ vccio1-supply = <&vccio_sd>; -+}; -+ -+/delete-node/ &pwm_led; -+ -+&pwm0 { -+ status = "okay"; -+}; -+ -+/delete-node/ &pwm3; -+ -+&rk817_charger { -+ /* This device does not have a current sense resistor */ -+ rockchip,resistor-sense-micro-ohms = <0>; -+ monitored-battery = <&battery>; -+}; -+ -+&sdio { -+ cap-sd-highspeed; -+ card-detect-delay = <200>; -+ cd-gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/ -+ sd-uhs-sdr12; -+ sd-uhs-sdr25; -+ sd-uhs-sdr50; -+ sd-uhs-sdr104; -+ vmmc-supply = <&vcc_sd>; -+ vqmmc-supply = <&vccio_sd>; -+ status = "okay"; -+}; -+ -+&vcc_sd { -+ regulator-max-microvolt = <3000000>; -+ regulator-min-microvolt = <1800000>; -+}; -+ -+&vccio_sd { -+ regulator-max-microvolt = <1800000>; -+}; -+ -+&pinctrl { -+ btns { -+ btn_pins_vol: btn-pins-vol { -+ rockchip,pins = <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ -+ btn_pins: btn-pins { -+ rockchip,pins = <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+}; diff --git a/projects/ROCKNIX/devices/RK3326/patches/linux/003-dmc-driver.patch b/projects/ROCKNIX/devices/RK3326/patches/linux/003-dmc-driver.patch deleted file mode 100644 index ef87be675b..0000000000 --- a/projects/ROCKNIX/devices/RK3326/patches/linux/003-dmc-driver.patch +++ /dev/null @@ -1,289 +0,0 @@ -diff -rupN linux.orig/drivers/devfreq/Kconfig linux/drivers/devfreq/Kconfig ---- linux.orig/drivers/devfreq/Kconfig 2024-01-10 19:42:04.697152003 +0000 -+++ linux/drivers/devfreq/Kconfig 2024-01-10 20:09:49.575772091 +0000 -@@ -141,6 +141,12 @@ config ARM_RK3399_DMC_DEVFREQ - It sets the frequency for the memory controller and reads the usage counts - from hardware. - -+config ARM_ROCKCHIP_BUS_DEVFREQ -+ tristate "rockchip bus" -+ depends on ARCH_ROCKCHIP -+ help -+ rk bus driver -+ - config ARM_SUN8I_A33_MBUS_DEVFREQ - tristate "sun8i/sun50i MBUS DEVFREQ Driver" - depends on ARCH_SUNXI || COMPILE_TEST -diff -rupN linux.orig/drivers/devfreq/Makefile linux/drivers/devfreq/Makefile ---- linux.orig/drivers/devfreq/Makefile 2024-01-10 19:42:04.697152003 +0000 -+++ linux/drivers/devfreq/Makefile 2024-01-10 20:09:49.575772091 +0000 -@@ -13,6 +13,7 @@ obj-$(CONFIG_ARM_IMX_BUS_DEVFREQ) += imx - obj-$(CONFIG_ARM_IMX8M_DDRC_DEVFREQ) += imx8m-ddrc.o - obj-$(CONFIG_ARM_MEDIATEK_CCI_DEVFREQ) += mtk-cci-devfreq.o - obj-$(CONFIG_ARM_RK3399_DMC_DEVFREQ) += rk3399_dmc.o -+obj-$(CONFIG_ARM_ROCKCHIP_BUS_DEVFREQ) += rockchip_bus.o - obj-$(CONFIG_ARM_SUN8I_A33_MBUS_DEVFREQ) += sun8i-a33-mbus.o - obj-$(CONFIG_ARM_TEGRA_DEVFREQ) += tegra30-devfreq.o - -diff -rupN linux.orig/drivers/devfreq/rockchip_bus.c linux/drivers/devfreq/rockchip_bus.c ---- linux.orig/drivers/devfreq/rockchip_bus.c 1970-01-01 00:00:00.000000000 +0000 -+++ linux/drivers/devfreq/rockchip_bus.c 2024-01-10 20:09:49.575772091 +0000 -@@ -0,0 +1,258 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* -+ * Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd. -+ * Author: Tony Xie -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define CLUSTER0 0 -+#define CLUSTER1 1 -+#define MAX_CLUSTERS 2 -+ -+#define to_rockchip_bus_clk_nb(nb) \ -+ container_of(nb, struct rockchip_bus, clk_nb) -+#define to_rockchip_bus_cpufreq_nb(nb) \ -+ container_of(nb, struct rockchip_bus, cpufreq_nb) -+ -+struct busfreq_table { -+ unsigned long freq; -+ unsigned long volt; -+}; -+ -+struct rockchip_bus { -+ struct device *dev; -+ struct regulator *regulator; -+ struct clk *clk; -+ struct notifier_block clk_nb; -+ struct notifier_block cpufreq_nb; -+ struct busfreq_table *freq_table; -+ -+ unsigned int max_state; -+ -+ unsigned long cur_volt; -+ unsigned long cur_rate; -+ -+ /* -+ * Busfreq-policy-cpufreq: -+ * If the cpu frequency of two clusters are both less than or equal to -+ * cpu_high_freq, change bus rate to low_rate, otherwise change it to -+ * high_rate. -+ */ -+ unsigned long high_rate; -+ unsigned long low_rate; -+ unsigned int cpu_high_freq; -+ unsigned int cpu_freq[MAX_CLUSTERS]; -+}; -+ -+static int rockchip_bus_set_freq_table(struct rockchip_bus *bus) -+{ -+ struct device *dev = bus->dev; -+ struct dev_pm_opp *opp; -+ unsigned long freq; -+ int i, count; -+ -+ count = dev_pm_opp_get_opp_count(dev); -+ if (count <= 0) -+ return -EINVAL; -+ -+ bus->max_state = count; -+ bus->freq_table = devm_kcalloc(dev, -+ bus->max_state, -+ sizeof(*bus->freq_table), -+ GFP_KERNEL); -+ if (!bus->freq_table) { -+ bus->max_state = 0; -+ return -ENOMEM; -+ } -+ -+ for (i = 0, freq = 0; i < bus->max_state; i++, freq++) { -+ opp = dev_pm_opp_find_freq_ceil(dev, &freq); -+ if (IS_ERR(opp)) { -+ devm_kfree(dev, bus->freq_table); -+ bus->max_state = 0; -+ return PTR_ERR(opp); -+ } -+ bus->freq_table[i].volt = dev_pm_opp_get_voltage(opp); -+ bus->freq_table[i].freq = freq; -+ dev_pm_opp_put(opp); -+ } -+ -+ return 0; -+} -+ -+static int rockchip_bus_power_control_init(struct rockchip_bus *bus) -+{ -+ struct device *dev = bus->dev; -+ int ret = 0; -+ -+ bus->clk = devm_clk_get(dev, "bus"); -+ if (IS_ERR(bus->clk)) { -+ dev_err(dev, "failed to get bus clock\n"); -+ return PTR_ERR(bus->clk); -+ } -+ -+ bus->regulator = devm_regulator_get(dev, "bus"); -+ if (IS_ERR(bus->regulator)) { -+ dev_err(dev, "failed to get bus regulator\n"); -+ return PTR_ERR(bus->regulator); -+ } -+ -+ ret = dev_pm_opp_of_add_table(dev); -+ if (ret < 0) { -+ dev_err(dev, "failed to get OPP table\n"); -+ return ret; -+ } -+ -+ ret = rockchip_bus_set_freq_table(bus); -+ if (ret < 0) { -+ dev_err(dev, "failed to set bus freq table\n"); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int rockchip_bus_clkfreq_target(struct device *dev, unsigned long freq) -+{ -+ struct rockchip_bus *bus = dev_get_drvdata(dev); -+ unsigned long target_volt = bus->freq_table[bus->max_state - 1].volt; -+ int i; -+ -+ for (i = 0; i < bus->max_state; i++) { -+ if (freq <= bus->freq_table[i].freq) { -+ target_volt = bus->freq_table[i].volt; -+ break; -+ } -+ } -+ -+ printk("AAA target_volt: %lu\n", target_volt); -+ -+ if (bus->cur_volt != target_volt) { -+ if (regulator_set_voltage(bus->regulator, target_volt, -+ INT_MAX)) { -+ dev_err(dev, "failed to set voltage %lu uV\n", -+ target_volt); -+ return -EINVAL; -+ } -+ bus->cur_volt = target_volt; -+ } -+ -+ return 0; -+} -+ -+static int rockchip_bus_clk_notifier(struct notifier_block *nb, -+ unsigned long event, void *data) -+{ -+ struct clk_notifier_data *ndata = data; -+ struct rockchip_bus *bus = to_rockchip_bus_clk_nb(nb); -+ int ret = 0; -+ -+ printk("AAA event %lu, old_rate %lu, new_rate: %lu\n", -+ event, ndata->old_rate, ndata->new_rate); -+ -+ switch (event) { -+ case PRE_RATE_CHANGE: -+ if (ndata->new_rate > ndata->old_rate) -+ ret = rockchip_bus_clkfreq_target(bus->dev, -+ ndata->new_rate); -+ break; -+ case POST_RATE_CHANGE: -+ if (ndata->new_rate < ndata->old_rate) -+ ret = rockchip_bus_clkfreq_target(bus->dev, -+ ndata->new_rate); -+ break; -+ case ABORT_RATE_CHANGE: -+ if (ndata->new_rate > ndata->old_rate) -+ ret = rockchip_bus_clkfreq_target(bus->dev, -+ ndata->old_rate); -+ break; -+ default: -+ break; -+ } -+ -+ return notifier_from_errno(ret); -+} -+ -+static int rockchip_bus_clkfreq(struct rockchip_bus *bus) -+{ -+ struct device *dev = bus->dev; -+ unsigned long init_rate; -+ int ret = 0; -+ -+ ret = rockchip_bus_power_control_init(bus); -+ if (ret) { -+ dev_err(dev, "failed to init power control\n"); -+ return ret; -+ } -+ -+ init_rate = clk_get_rate(bus->clk); -+ printk("init rate %d", init_rate); -+ ret = rockchip_bus_clkfreq_target(dev, init_rate); -+ if (ret) -+ return ret; -+ -+ bus->clk_nb.notifier_call = rockchip_bus_clk_notifier; -+ ret = clk_notifier_register(bus->clk, &bus->clk_nb); -+ if (ret) { -+ dev_err(dev, "failed to register clock notifier\n"); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static const struct of_device_id rockchip_busfreq_of_match[] = { -+ { .compatible = "rockchip,px30-bus", }, -+ { .compatible = "rockchip,rk1808-bus", }, -+ { .compatible = "rockchip,rk3288-bus", }, -+ { .compatible = "rockchip,rk3368-bus", }, -+ { .compatible = "rockchip,rk3399-bus", }, -+ { .compatible = "rockchip,rv1126-bus", }, -+ { }, -+}; -+ -+MODULE_DEVICE_TABLE(of, rockchip_busfreq_of_match); -+ -+static int rockchip_busfreq_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct device_node *np = dev->of_node; -+ struct rockchip_bus *bus; -+ const char *policy_name; -+ int ret = 0; -+ -+ bus = devm_kzalloc(dev, sizeof(*bus), GFP_KERNEL); -+ if (!bus) -+ return -ENOMEM; -+ bus->dev = dev; -+ platform_set_drvdata(pdev, bus); -+ -+ printk("asdfsadfsadffasdafsdhjfsdakasdfjfjasdklsfadkljsdfajklfsadjklfasdjklhasfdhjklafsdhkjsfdajkhfasdk"); -+ return rockchip_bus_clkfreq(bus); -+} -+ -+static struct platform_driver rockchip_busfreq_driver = { -+ .probe = rockchip_busfreq_probe, -+ .driver = { -+ .name = "rockchip-busfreq", -+ .of_match_table = rockchip_busfreq_of_match, -+ }, -+}; -+ -+module_platform_driver(rockchip_busfreq_driver); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_AUTHOR("Tony Xie "); -+MODULE_DESCRIPTION("rockchip busfreq driver with devfreq framework"); diff --git a/projects/ROCKNIX/devices/RK3326/patches/linux/006-powkiddy-rgb10x.patch b/projects/ROCKNIX/devices/RK3326/patches/linux/006-powkiddy-rgb10x.patch deleted file mode 100644 index 0964cbec80..0000000000 --- a/projects/ROCKNIX/devices/RK3326/patches/linux/006-powkiddy-rgb10x.patch +++ /dev/null @@ -1,215 +0,0 @@ -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-powkiddy-rgb10x.dts b/arch/arm64/boot/dts/rockchip/rk3326-powkiddy-rgb10x.dts -new file mode 100644 -index 000000000000..70e642907531 ---- /dev/null -+++ b/arch/arm64/boot/dts/rockchip/rk3326-powkiddy-rgb10x.dts -@@ -0,0 +1,209 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2024 ROCKNIX -+ */ -+ -+/dts-v1/; -+#include "rk3326-odroid-go.dtsi" -+#include "retrogame_joypad_s2_f1.dtsi" -+ -+/ { -+ model = "Powkiddy RGB10X"; -+ compatible = "powkiddy,rk3326-rgb10x", "rockchip,rk3326"; -+ -+ aliases { -+ mmc1 = &sdio; -+ }; -+ -+ battery: battery { -+ compatible = "simple-battery"; -+ charge-full-design-microamp-hours = <2800000>; -+ charge-term-current-microamp = <280000>; -+ constant-charge-current-max-microamp = <2000000>; -+ constant-charge-voltage-max-microvolt = <4200000>; -+ factory-internal-resistance-micro-ohms = <180000>; -+ voltage-max-design-microvolt = <4100000>; -+ voltage-min-design-microvolt = <3500000>; -+ -+ ocv-capacity-celsius = <20>; -+ ocv-capacity-table-0 = <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>, -+ <3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>, -+ <3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>, -+ <3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>, -+ <3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>, -+ <3574170 0>; -+ }; -+ -+ gpio-keys-vol { -+ compatible = "gpio-keys"; -+ autorepeat; -+ pinctrl-0 = <&btn_pins_vol>; -+ pinctrl-names = "default"; -+ -+ button-vol-down { -+ gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; -+ label = "VOLUMEDOWN"; -+ linux,code = ; -+ }; -+ -+ button-volume-up { -+ gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; -+ label = "VOLUMEUP"; -+ linux,code = ; -+ }; -+ }; -+}; -+ -+&joypad { -+ compatible = "rocknix-singleadc-joypad"; -+ joypad-name = "retrogame_joypad_s1_f2"; /* distinct name to indicate there is 1 stick and 2 fn buttons */ -+ joypad-product = <0x1112>; /* 11 inherited, 1 for number of sticks, 2 for number of FN */ -+ status = "okay"; -+ -+ /* gpio pincontrol setup */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&btn_pins>; -+ -+ /* Analog mux define */ -+ io-channel-names = "amux_adc"; -+ io-channels = <&saradc 1>; -+ -+ /* adc mux channel count */ -+ /* despite there is only left stick, amux-count needs to be 4, */ -+ /* because amux 0 and 1 are hardcoded as RX and RY in the driver */ -+ amux-count = <4>; -+ /* adc mux select(a,b) gpio */ -+ amux-a-gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; -+ amux-b-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; -+ /* adc mux enable gpio */ -+ amux-en-gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; -+ -+ /* -+ 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>; -+ -+ /* required for RGB10X */ -+ invert-absx; -+ invert-absy; -+ -+ /* -+ joypad driver is poll-device driver. -+ poll-device is does not support wakeup-source. -+ */ -+ up { gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; }; -+ down { gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; }; -+ left { gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; }; -+ right { gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; }; -+ -+ a { gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; }; -+ b { gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; }; -+ x { gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; }; -+ y { gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>; }; -+ -+ tl { gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>; }; -+ tr { gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; }; -+ tr2 { gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; }; -+ tl2 { gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; }; -+ -+ select{ gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; }; -+ start { gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; }; -+ -+ thumbl{ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; }; -+ -+ /* Plus and Minus face buttons are mapped to mode and thumbr */ -+ mode { -+ gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>; -+ label = "GPIO MINUS"; -+ }; -+ thumbr { -+ gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; -+ label = "GPIO PLUS"; -+ }; -+}; -+ -+&internal_display { -+ compatible = "powkiddy,rk2023-panel", "newvision,nv3051d"; -+ vdd-supply = <&vcc_lcd>; -+}; -+ -+&io_domains { -+ vccio1-supply = <&vccio_sd>; -+}; -+ -+/delete-node/ &pwm3; -+/delete-node/ &pwm_led; -+ -+&red_led { -+ gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_HIGH>; -+}; -+ -+&red_led_pin { -+ rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; -+}; -+ -+&rk817_charger { -+ monitored-battery = <&battery>; -+}; -+ -+&sdio { -+ cap-sd-highspeed; -+ card-detect-delay = <200>; -+ cd-gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; -+ sd-uhs-sdr12; -+ sd-uhs-sdr25; -+ sd-uhs-sdr50; -+ sd-uhs-sdr104; -+ vmmc-supply = <&vcc_sd>; -+ vqmmc-supply = <&vccio_sd>; -+ status = "okay"; -+}; -+ -+&vcc_sd { -+ regulator-max-microvolt = <3000000>; -+ regulator-min-microvolt = <1800000>; -+}; -+ -+&vccio_sd { -+ regulator-max-microvolt = <1800000>; -+}; -+ -+&pinctrl { -+ btns { -+ btn_pins: btn-pins { -+ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ btn_pins_vol: btn-pins-vol { -+ rockchip,pins = <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, -+ <2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+}; diff --git a/projects/ROCKNIX/devices/RK3326/patches/linux/021-magicx-xu-mini-m.patch b/projects/ROCKNIX/devices/RK3326/patches/linux/021-magicx-xu-mini-m.patch deleted file mode 100644 index 8353d161dc..0000000000 --- a/projects/ROCKNIX/devices/RK3326/patches/linux/021-magicx-xu-mini-m.patch +++ /dev/null @@ -1,115 +0,0 @@ -diff --git a/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu-mini-m.dts b/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu-mini-m.dts -new file mode 100644 -index 000000000000..e57803b572b8 ---- /dev/null -+++ b/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu-mini-m.dts -@@ -0,0 +1,109 @@ -+/// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2024-present ROCKNIX (https://github.com/ROCKNIX) -+ * Copyright (c) 2024 Olivier Schonken -+ */ -+ -+#include "rk3326-magicx-xu10.dts" -+ -+/ { -+ model = "MagicX XU Mini M"; -+ compatible = "magicx,xu-mini-m", "rockchip,rk3326"; -+}; -+ -+&battery { -+ charge-full-design-microamp-hours = <2600000>; -+}; -+ -+&dsi { -+ internal_display: panel@0 { -+ compatible = "rocknix,generic-dsi"; -+ panel_description = -+ "G size=69,139 delays=5,20,20,120,20 format=rgb888 lanes=2 flags=0xe03", -+ -+ "M clock=25000 horizontal=480,60,10,54 vertical=640,20,10,20 default=1", -+ "M clock=25200 horizontal=480,60,22,54 vertical=640,20,139,20", -+ "M clock=25000 horizontal=480,60,31,54 vertical=640,20,120,20", -+ "M clock=25660 horizontal=480,60,22,54 vertical=640,20,153,20", -+ "M clock=25300 horizontal=480,60,31,54 vertical=640,20,24,20", -+ "M clock=28590 horizontal=480,60,15,54 vertical=640,20,106,20", -+ "M clock=25380 horizontal=480,60,17,54 vertical=640,20,13,20", -+ "M clock=25410 horizontal=480,60,11,54 vertical=640,20,20,20", -+ "M clock=29490 horizontal=480,60,24,54 vertical=640,20,114,20", -+ "M clock=33520 horizontal=480,60,36,54 vertical=640,20,25,20", -+ "M clock=38430 horizontal=480,60,16,54 vertical=640,20,20,20", -+ "M clock=50820 horizontal=480,60,11,54 vertical=640,20,20,20", -+ -+ "I seq=ff7701000013", -+ "I seq=ef08", -+ "I seq=ff7701000010", -+ "I seq=c04f00", "I seq=c11002", "I seq=c22002", "I seq=cc10", -+ "I seq=b006161e0e12060a0809230412102b311f", -+ "I seq=b1060f160d100704090720051210262f1f", -+ "I seq=ff7701000011", -+ "I seq=b065", "I seq=b185", "I seq=b282", "I seq=b380", "I seq=b542", "I seq=b785", -+ "I seq=b820", -+ "I seq=c178", "I seq=c278", -+ "I seq=d088", -+ "I seq=e0000002", -+ "I seq=e104a006a005a007a0004444", -+ "I seq=e2000000000000000000000000", -+ "I seq=e300002222", -+ "I seq=e44444", -+ "I seq=e50c90a0a00e92a0a0088ca0a00a8ea0a0", -+ "I seq=e600002222", -+ "I seq=e74444", -+ "I seq=e80d91a0a00f93a0a0098da0a00b8fa0a0", -+ "I seq=eb0000e4e4440040", -+ "I seq=edfff5476f0ba1abffffba1ab0f6745fff", -+ "I seq=ef080808403f64", -+ "I seq=ff7701000013", -+ "I seq=e6167c", "I seq=e8000e", -+ "I seq=e8000c wait=50", -+ "I seq=e80000", -+ "I seq=ff7701000000", -+ "I seq=11 wait=150", -+ "I seq=29 wait=120"; -+ rotation = <90>; -+ }; -+}; -+ -+&joypad { -+ joypad-name = "XU Mini M Gamepad"; -+ -+ invert-absrx; -+ /delete-property/ invert-absx; -+ -+ sw5 { -+ gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-B"; -+ }; -+ sw6 { -+ gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-A"; -+ }; -+ sw7 { -+ gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-X"; -+ }; -+ sw8 { -+ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-Y"; -+ }; -+ sw16 { -+ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; -+ }; -+ sw17 { -+ gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; -+ }; -+}; -+ -+&pinctrl { -+ headphone { -+ hp_det: hp-det { -+ rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>; -+ }; -+ }; -+}; -+ -+ diff --git a/projects/ROCKNIX/devices/RK3326/patches/linux/023-gameconsole-eeclone.patch b/projects/ROCKNIX/devices/RK3326/patches/linux/023-gameconsole-eeclone.patch deleted file mode 100644 index af8ddc1e23..0000000000 --- a/projects/ROCKNIX/devices/RK3326/patches/linux/023-gameconsole-eeclone.patch +++ /dev/null @@ -1,930 +0,0 @@ -new file mode 100644 ---- /dev/null -+++ b/arch/arm64/boot/dts/rockchip/rk3326-gameconsole-eeclone.dts -@@ -0,0 +1,926 @@ -+/// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2024-present ROCKNIX (https://github.com/ROCKNIX) -+ * Copyright (c) 2025 Danil Zagoskin -+ */ -+ -+/dts-v1/; -+#include -+#include -+#include -+#include -+#include "rk3326.dtsi" -+ -+/ { -+ model = "Generic EE clone"; -+ compatible = "gameconsole,eeclone", "rockchip,rk3326"; -+ -+ aliases { -+ mmc0 = &emmc; -+ mmc1 = &sdmmc; -+ mmc2 = &sdio; -+ serial1 = &uart2; -+ serial2 = &uart5; -+ }; -+ -+ 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 = <4000000>; -+ 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 = <100>; -+ -+ /* disabled by default, dtbo may enable it when needed */ -+ status = "disabled"; -+ -+ button-vol-up { -+ press-threshold-microvolt = <15000>; -+ label = "VOLUMEUP"; -+ linux,code = ; -+ }; -+ -+ button-vol-down { -+ press-threshold-microvolt = <300000>; -+ label = "VOLUMEDOWN"; -+ linux,code = ; -+ }; -+ }; -+ -+ joypad: joypad { -+ compatible = "rocknix-singleadc-joypad"; -+ -+ joypad-name = "r36s_Gamepad"; -+ joypad-product = <0x1188>; -+ joypad-revision = <0x0188>; -+ -+ status = "okay"; -+ -+ /* gpio pincontrol setup */ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&btn_pins>; -+ -+ /* Analog mux define */ -+ io-channel-names = "amux_adc"; -+ io-channels = <&saradc 1>; -+ -+ /* adc mux channel count */ -+ amux-count = <4>; -+ /* non-default wiring */ -+ amux-channel-mapping = <2 3 1 0>; -+ /* adc mux enable gpio */ -+ amux-en-gpios = <&gpio2 RK_PB4 GPIO_ACTIVE_LOW>; /* rocker0-gpios */ -+ /* adc mux select(a,b) gpio */ -+ amux-a-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_LOW>; /* rocker1-gpios */ -+ amux-b-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_LOW>; /* rocker-gpios */ -+ -+ /* 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>; -+ -+ /* gpio button auto repeat set value : default disable */ -+ /* -+ autorepeat; -+ */ -+ -+ /* -+ 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 = ; // 0x220 -+ }; -+ sw2 { -+ gpios = <&gpio3 RK_PC7 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-DOWN"; -+ linux,code = ; // 0x221 -+ }; -+ sw3 { -+ gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-LEFT"; -+ linux,code = ; // 0x222 -+ }; -+ sw4 { -+ gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_LOW>; -+ label = "GPIO DPAD-RIGHT"; -+ linux,code = ; // 0x223 -+ }; -+ -+ sw5 { -+ gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; -+ label = "GPIO KEY BTN-A"; -+ linux,code = ; // 0x131 -+ }; -+ sw6 { -+ gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-B"; -+ linux,code = ; // 0x130 -+ }; -+ sw7 { -+ gpios = <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-Y"; -+ linux,code = ; // 0x134 -+ }; -+ sw8 { -+ gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN-X"; -+ linux,code = ; // 0x133 -+ }; -+ -+ sw11 { -+ gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_THUMBL"; -+ linux,code = ; // 0x2c2 -+ }; -+ sw12 { -+ gpios = <&gpio2 RK_PB6 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_THUMBR"; -+ linux,code = ; // 0x2c3 -+ }; -+ -+ sw13 { -+ gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_FN"; -+ linux,code = ; // 0x2c4 -+ }; -+ -+ sw15 { -+ gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-LEFT"; -+ linux,code = ; // 0x02 -+ }; -+ sw16 { -+ gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-RIGHT"; -+ linux,code = ; // 0x05 -+ }; -+ sw19 { -+ gpios = <&gpio3 RK_PD0 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_SELECT"; -+ linux,code = ; -+ }; -+ sw20 { -+ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-RIGHT2"; -+ linux,code = ; -+ }; -+ sw21 { -+ gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; -+ label = "GPIO TOP-LEFT2"; -+ linux,code = ; -+ }; -+ sw22 { -+ gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; -+ label = "GPIO BTN_START"; -+ linux,code = ; -+ }; -+ }; -+ -+ leds: gpio-leds { -+ compatible = "gpio-leds"; -+ pinctrl-0 = <&led_pins>; -+ pinctrl-names = "default"; -+ -+ /* charge_red_gpio = <&gpio0 17 0>; */ -+ led-0 { -+ color = ; -+ default-state = "off"; -+ function = LED_FUNCTION_CHARGING; -+ linux,default-trigger = "none"; -+ gpios = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>; -+ }; -+ -+ /* charge_blue_gpio = <&gpio0 0 0>; */ -+ led-1 { -+ color = ; -+ default-state = "on"; -+ function = LED_FUNCTION_POWER; -+ linux,default-trigger = "default-on"; -+ gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; -+ }; -+ }; -+ -+ 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 = -+ "Microphone", "Mic Jack", -+ "Headphone", "Headphones", -+ "Speaker", "Speaker"; -+ simple-audio-card,routing = -+ "MICL", "Mic Jack", -+ "Headphones", "HPOL", -+ "Headphones", "HPOR", -+ "Speaker", "SPKO"; -+ -+ simple-audio-card,codec { -+ sound-dai = <&rk817>; -+ }; -+ -+ simple-audio-card,cpu { -+ sound-dai = <&i2s1_2ch>; -+ }; -+ }; -+ -+ vccsys: vccsys { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc5v0_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>; -+ }; -+}; -+ -+&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 = "magicx,xu10-panel", "sitronix,st7703"; -+ 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>; -+ -+ 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 = <850000>; -+ 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 = <1800000>; -+ 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-off-in-suspend; -+ regulator-suspend-microvolt = <3300000>; -+ }; -+ }; -+ -+ vcc3v0_dvp: LDO_REG8 { -+ regulator-name = "vcc3v0_dvp"; -+ 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>; -+ }; -+ }; -+ -+ 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 = <4900000>; -+ regulator-max-microvolt = <5400000>; -+ regulator-always-on; -+ regulator-boot-on; -+ }; -+ -+ /* -+ otg_switch: OTG_SWITCH { -+ regulator-name = "otg_switch"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ */ -+ }; -+ -+ 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 = <800>; -+ 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; -+ vqmmc-supply = <&vccio_sd>; -+ vmmc-supply = <&vcc_sd>; -+ status = "okay"; -+}; -+ -+&sdio { -+ cap-sd-highspeed; -+ max-frequency = <100000000>; -+ cd-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; -+ card-detect-delay = <800>; -+ supports-sd; -+ sd-uhs-sdr12; -+ sd-uhs-sdr25; -+ sd-uhs-sdr50; -+ sd-uhs-sdr104; -+ vqmmc-supply = <&vcc2v8_dvp>; -+ vmmc-supply = <&vcc3v0_dvp>; -+ status = "okay"; -+}; -+ -+&emmc { -+ status = "okay"; -+ no-sdio; -+ no-sd; -+ disable-wp; -+ non-removable; -+ num-slots = <1>; -+}; -+ -+&tsadc { -+ status = "okay"; -+}; -+ -+&u2phy { -+ status = "okay"; -+ -+ u2phy_host: host-port { -+ status = "okay"; -+ }; -+ -+ u2phy_otg: otg-port { -+ status = "disabled"; -+ }; -+}; -+ -+&usb20_otg { -+ status = "okay"; -+}; -+ -+&vopb { -+ status = "okay"; -+}; -+ -+&vopb_mmu { -+ status = "okay"; -+}; -+&pinctrl { -+ btns { -+ btn_pins: btn-pins { -+ rockchip,pins = -+ <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>, -+ <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>, -+ <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PC2 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PC3 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PC7 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>, -+ <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ headphone { -+ hp_det: hp-det { -+ rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>; -+ }; -+ }; -+ -+ 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_PA0 RK_FUNC_GPIO &pcfg_pull_none>, /* charge_blue_gpio = <&gpio0 0 0>; */ -+ <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; /* charge_red_gpio = <&gpio0 17 0>; */ -+ }; -+ }; -+ -+ 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>; -+ }; -+ }; -+}; -+ -+&uart5 { -+ status = "okay"; -+}; -+&uart2 { -+ status = "disabled"; -+}; -+ -+ -+&internal_display { -+ compatible = "rocknix,generic-dsi"; -+ 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"; -+}; -+ -+ diff --git a/projects/ROCKNIX/packages/linux/package.mk b/projects/ROCKNIX/packages/linux/package.mk index 8dfddbe3df..67496ebe0c 100644 --- a/projects/ROCKNIX/packages/linux/package.mk +++ b/projects/ROCKNIX/packages/linux/package.mk @@ -92,6 +92,11 @@ post_patch() { cp -v $(get_pkg_directory generic-dsi)/sources/panel-generic-dsi.c ${PKG_BUILD}/drivers/gpu/drm/panel/ echo "obj-y" += panel-generic-dsi.o >> ${PKG_BUILD}/drivers/gpu/drm/panel/Makefile fi + + DTS_SOURCE_DIR="${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/linux/dts" + if [ -d "${DTS_SOURCE_DIR}" ]; then + rsync -av "${DTS_SOURCE_DIR}/" ${PKG_BUILD}/arch/arm64/boot/dts/ + fi } make_init() { diff --git a/projects/ROCKNIX/packages/linux/patches/mainline/0006-stable-rocknix-joypad-dtsi.patch b/projects/ROCKNIX/packages/linux/patches/mainline/0006-stable-rocknix-joypad-dtsi.patch deleted file mode 100644 index f9bcc18d30..0000000000 --- a/projects/ROCKNIX/packages/linux/patches/mainline/0006-stable-rocknix-joypad-dtsi.patch +++ /dev/null @@ -1,125 +0,0 @@ ---- /dev/null 2025-04-28 17:53:20.285890583 +0000 -+++ linux-6.12.17/arch/arm64/boot/dts/rockchip/retrogame_joypad_s2_f1.dtsi 2025-05-09 17:14:55.222064032 +0000 -@@ -0,0 +1,122 @@ -+/* -+ This is a skeleton of joypad with 2 sticks and FN (MODE) button. -+ Fits devices with 1 stick and 2 extra face buttons too. -+ By including this ans setting I/O properties only, -+ devices should get consistent controller id and mapping -+ thus reusing non-game configs: -+ * SDL gamecontrollerdb.txt -+ * ES es_input.cfg -+ * Retroarch gamepad -+*/ -+ -+/ { -+ joypad: retrogame_joypad_s2_f1 { -+ /* These drivers emit the same button set which makes this skeleton ADC-agnostic */ -+ /* compatible = "rocknix-joypad"; */ -+ /* compatible = "rocknix-singleadc-joypad"; */ -+ -+ /* These are constants making Joystick Guid the same */ -+ joypad-name = "retrogame_joypad_s2_f1"; -+ joypad-vendor = <0x484B>; -+ joypad-product = <0x1121>; /* 11 inherited, 2 for number of sticks, 1 for number of FN */ -+ joypad-revision = <0x0100>; -+ -+ /* require explicit status = "okay"; */ -+ status = "disabled"; -+ -+ /* 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>; -+ -+ /* poll device interval (ms), adc read interval */ -+ poll-interval = <10>; -+ -+ /* gpio button auto repeat set value : default disable */ -+ /* -+ autorepeat; -+ */ -+ -+ /* meaningful node names for easier use */ -+ up { -+ label = "GPIO DPAD-UP"; -+ linux,code = ; -+ }; -+ down { -+ label = "GPIO DPAD-DOWN"; -+ linux,code = ; -+ }; -+ left { -+ label = "GPIO DPAD-LEFT"; -+ linux,code = ; -+ }; -+ right { -+ label = "GPIO DPAD-RIGHT"; -+ linux,code = ; -+ }; -+ -+ a { -+ label = "GPIO BTN-A"; -+ linux,code = ; -+ }; -+ b { -+ label = "GPIO BTN-B"; -+ linux,code = ; -+ }; -+ x { -+ label = "GPIO BTN-X"; -+ linux,code = ; -+ }; -+ y { -+ label = "GPIO BTN-Y"; -+ linux,code = ; -+ }; -+ -+ select { -+ label = "GPIO BTN_SELECT"; -+ linux,code = ; -+ }; -+ start { -+ label = "GPIO BTN_START"; -+ linux,code = ; -+ }; -+ mode { -+ label = "GPIO BTN_F"; -+ linux,code = ; -+ }; -+ -+ tl { -+ label = "GPIO BTN_TL"; -+ linux,code = ; -+ }; -+ tr { -+ label = "GPIO BTN_TR"; -+ linux,code = ; -+ }; -+ tl2 { -+ label = "GPIO BTN_TL2"; -+ linux,code = ; -+ }; -+ tr2 { -+ label = "GPIO BTN_TR2"; -+ linux,code = ; -+ }; -+ -+ thumbl { -+ label = "GPIO BTN_THUMBL"; -+ linux,code = ; -+ }; -+ thumbr { -+ label = "GPIO BTN_THUMBR"; -+ linux,code = ; -+ }; -+ }; -+};