diff --git a/projects/Rockchip/patches/linux/RK3566/018-fix-rg503-a-y-buttons.patch b/projects/Rockchip/patches/linux/RK3566/018-fix-rg503-a-y-buttons.patch deleted file mode 100644 index add7b1ae2..000000000 --- a/projects/Rockchip/patches/linux/RK3566/018-fix-rg503-a-y-buttons.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts 2024-03-15 18:26:31.236348216 +0300 -+++ b/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts 2024-03-15 18:26:48.664293252 +0300 -@@ -139,7 +139,7 @@ - - &gpio_keys_control { - button-a { -- gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; -+ gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; - label = "EAST"; - linux,code = ; - }; -@@ -175,7 +175,7 @@ - }; - - button-y { -- gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; -+ gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; - label = "WEST"; - linux,code = ; - }; diff --git a/projects/Rockchip/patches/linux/RK3566/018-powkiddy-wifi.patch b/projects/Rockchip/patches/linux/RK3566/018-powkiddy-wifi-input.patch similarity index 100% rename from projects/Rockchip/patches/linux/RK3566/018-powkiddy-wifi.patch rename to projects/Rockchip/patches/linux/RK3566/018-powkiddy-wifi-input.patch diff --git a/projects/Rockchip/patches/linux/RK3566/003-singleadc-joypad.patch b/projects/Rockchip/patches/linux/RK3566/019-singleadc-joypad.patch similarity index 100% rename from projects/Rockchip/patches/linux/RK3566/003-singleadc-joypad.patch rename to projects/Rockchip/patches/linux/RK3566/019-singleadc-joypad.patch diff --git a/projects/Rockchip/patches/linux/RK3566/020-rg353vs-input.patch b/projects/Rockchip/patches/linux/RK3566/020-rg353vs-input.patch new file mode 100644 index 000000000..173b26072 --- /dev/null +++ b/projects/Rockchip/patches/linux/RK3566/020-rg353vs-input.patch @@ -0,0 +1,171 @@ +diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353vs.dts linux/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353vs.dts +--- linux.orig/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353vs.dts 2024-03-26 04:17:51.534641800 +0000 ++++ linux/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353vs.dts 2024-03-26 04:25:37.989710946 +0000 +@@ -61,19 +61,156 @@ + sound-dai = <&i2s1_8ch>; + }; + }; +-}; + +-&gpio_keys_control { +- button-r1 { +- gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; +- label = "TR"; +- linux,code = ; +- }; ++ joypad: singleadc-joypad { ++ compatible = "singleadc-joypad"; ++ hw_info = <0x02>; ++ ++ joypad-name = "retrogame_joypad"; ++ joypad-product = <0x1101>; ++ joypad-revision = <0x0100>; ++ ++ status = "okay"; ++ ++ /* gpio pincontrol setup */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&btn_pins_ctrl>; ++ ++ /* Analog mux define */ ++ io-channel-names = "amux_adc"; ++ io-channels = <&saradc 3>; ++ ++ /* adc mux channel count */ ++ amux-count = <4>; ++ /* adc mux select(a,b) gpio */ ++ amux-a-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>; ++ amux-b-gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>; ++ /* adc mux enable gpio */ ++ amux-en-gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_LOW>; ++ ++ /* adc calculate scale */ ++ button-adc-scale = <2>; + +- button-r2 { +- gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; +- label = "TR2"; +- linux,code = ; ++ /* 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 = <245>; ++ abs_x-n-tuning = <245>; ++ ++ abs_y-p-tuning = <245>; ++ abs_y-n-tuning = <245>; ++ ++ abs_rx-p-tuning = <245>; ++ abs_rx-n-tuning = <245>; ++ ++ abs_ry-p-tuning = <245>; ++ abs_ry-n-tuning = <245>; ++ ++ /* poll device interval (ms), adc read interval */ ++ poll-interval = <10>; ++ ++ /* gpio button auto repeat set value : default disable */ ++ /* ++ autorepeat; ++ */ ++ sw1 { ++ gpios = <&gpio3 RK_PA3 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-UP"; ++ linux,code = ; ++ }; ++ sw2 { ++ gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-DOWN"; ++ linux,code = ; ++ }; ++ sw3 { ++ gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-LEFT"; ++ linux,code = ; ++ }; ++ sw4 { ++ gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-RIGHT"; ++ linux,code = ; ++ }; ++ sw5 { ++ gpios = <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>; ++ label = "GPIO KEY BTN-A"; ++ linux,code = ; ++ }; ++ sw6 { ++ gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-B"; ++ linux,code = ; ++ }; ++ sw7 { ++ gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-X"; ++ linux,code = ; ++ }; ++ sw8 { ++ gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-Y"; ++ linux,code = ; ++ }; ++ sw9 { ++ gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_SELECT"; ++ linux,code = ; ++ }; ++ sw10 { ++ gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_START"; ++ linux,code = ; ++ }; ++ sw11 { ++ gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_F"; ++ linux,code = ; ++ }; ++ sw12 { ++ gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TL"; ++ linux,code = ; ++ }; ++ sw13 { ++ gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TR"; ++ linux,code = ; ++ }; ++ sw14 { ++ gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TL2"; ++ linux,code = ; ++ }; ++ sw15 { ++ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TR2"; ++ linux,code = ; ++ }; ++ sw16 { ++ gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_THUMBL"; ++ linux,code = ; ++ }; ++ sw17 { ++ gpios = <&gpio3 RK_PA2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_THUMBR"; ++ linux,code = ; ++ }; ++ + }; + }; + diff --git a/projects/Rockchip/patches/linux/RK3566/021-rg503-input.patch b/projects/Rockchip/patches/linux/RK3566/021-rg503-input.patch new file mode 100644 index 000000000..044b96ebc --- /dev/null +++ b/projects/Rockchip/patches/linux/RK3566/021-rg503-input.patch @@ -0,0 +1,211 @@ +diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts linux/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts +--- linux.orig/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts 2024-03-26 04:17:51.534641800 +0000 ++++ linux/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts 2024-03-26 04:51:03.363007171 +0000 +@@ -102,6 +102,156 @@ + pinctrl-names = "default"; + sound-name-prefix = "Speaker Amp"; + }; ++ ++ joypad: singleadc-joypad { ++ compatible = "singleadc-joypad"; ++ ++ joypad-name = "retrogame_joypad"; ++ joypad-product = <0x1101>; ++ joypad-revision = <0x0100>; ++ ++ status = "okay"; ++ ++ /* gpio pincontrol setup */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&btn_pins_ctrl>; ++ ++ /* Analog mux define */ ++ io-channel-names = "amux_adc"; ++ io-channels = <&saradc 3>; ++ ++ /* adc mux channel count */ ++ amux-count = <4>; ++ /* adc mux select(a,b) gpio */ ++ amux-a-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>; ++ amux-b-gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>; ++ /* adc mux enable gpio */ ++ amux-en-gpios = <&gpio0 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 = <450>; ++ abs_x-n-tuning = <450>; ++ ++ abs_y-p-tuning = <450>; ++ abs_y-n-tuning = <450>; ++ ++ abs_rx-p-tuning = <450>; ++ abs_rx-n-tuning = <450>; ++ ++ abs_ry-p-tuning = <450>; ++ abs_ry-n-tuning = <450>; ++ ++ /* poll device interval (ms), adc read interval */ ++ poll-interval = <10>; ++ ++ /* gpio button auto repeat set value : default disable */ ++ /* ++ autorepeat; ++ */ ++ sw1 { ++ gpios = <&gpio3 RK_PA3 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-UP"; ++ linux,code = ; ++ }; ++ sw2 { ++ gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-DOWN"; ++ linux,code = ; ++ }; ++ sw3 { ++ gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-LEFT"; ++ linux,code = ; ++ }; ++ sw4 { ++ gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-RIGHT"; ++ linux,code = ; ++ }; ++ sw5 { ++ gpios = <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>; ++ label = "GPIO KEY BTN-A"; ++ linux,code = ; ++ }; ++ sw6 { ++ gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-B"; ++ linux,code = ; ++ }; ++ sw7 { ++ gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-X"; ++ linux,code = ; ++ }; ++ sw8 { ++ gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-Y"; ++ linux,code = ; ++ }; ++ sw9 { ++ gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_SELECT"; ++ linux,code = ; ++ }; ++ sw10 { ++ gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_START"; ++ linux,code = ; ++ }; ++ sw11 { ++ gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_F"; ++ linux,code = ; ++ }; ++ sw12 { ++ gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TL"; ++ linux,code = ; ++ }; ++ sw13 { ++ gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TR"; ++ linux,code = ; ++ }; ++ sw14 { ++ gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TL2"; ++ linux,code = ; ++ }; ++ sw15 { ++ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TR2"; ++ linux,code = ; ++ }; ++ sw16 { ++ gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_THUMBL"; ++ linux,code = ; ++ }; ++ sw17 { ++ gpios = <&gpio3 RK_PA2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_THUMBR"; ++ linux,code = ; ++ }; ++ ++ }; + }; + + &cru { +@@ -137,50 +287,6 @@ + }; + }; + +-&gpio_keys_control { +- button-a { +- gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; +- label = "EAST"; +- linux,code = ; +- }; +- +- button-left { +- gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>; +- label = "DPAD-LEFT"; +- linux,code = ; +- }; +- +- button-right { +- gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>; +- label = "DPAD-RIGHT"; +- linux,code = ; +- }; +- +- button-r1 { +- gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; +- label = "TR"; +- linux,code = ; +- }; +- +- button-r2 { +- gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; +- label = "TR2"; +- linux,code = ; +- }; +- +- button-right { +- gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>; +- label = "DPAD-RIGHT"; +- linux,code = ; +- }; +- +- button-y { +- gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; +- label = "WEST"; +- linux,code = ; +- }; +-}; +- + &pinctrl { + audio-amplifier { + spk_amp_enable_h: spk-amp-enable-h { diff --git a/projects/Rockchip/patches/linux/RK3566/022-rg353v-input.patch b/projects/Rockchip/patches/linux/RK3566/022-rg353v-input.patch new file mode 100644 index 000000000..ae5142e18 --- /dev/null +++ b/projects/Rockchip/patches/linux/RK3566/022-rg353v-input.patch @@ -0,0 +1,173 @@ +diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353v.dts linux/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353v.dts +--- linux.orig/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353v.dts 2024-03-26 04:17:51.534641800 +0000 ++++ linux/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353v.dts 2024-03-26 05:25:52.199838520 +0000 +@@ -62,20 +62,158 @@ + sound-dai = <&i2s1_8ch>; + }; + }; +-}; + +-&gpio_keys_control { +- button-r1 { +- gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; +- label = "TR"; +- linux,code = ; +- }; ++ joypad: singleadc-joypad { ++ compatible = "singleadc-joypad"; ++ hw_info = <0x02>; ++ ++ joypad-name = "retrogame_joypad"; ++ joypad-product = <0x1101>; ++ joypad-revision = <0x0100>; ++ ++ status = "okay"; ++ ++ /* gpio pincontrol setup */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&btn_pins_ctrl>; ++ ++ /* Analog mux define */ ++ io-channel-names = "amux_adc"; ++ io-channels = <&saradc 3>; ++ ++ /* adc mux channel count */ ++ amux-count = <4>; ++ /* adc mux select(a,b) gpio */ ++ amux-a-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>; ++ amux-b-gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>; ++ /* adc mux enable gpio */ ++ amux-en-gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_LOW>; ++ ++ /* adc calculate scale */ ++ button-adc-scale = <2>; ++ ++ /* adc deadzone range */ ++ button-adc-deadzone = <64>; + +- button-r2 { +- gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; +- label = "TR2"; +- linux,code = ; ++ /* ++ 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 = <245>; ++ abs_x-n-tuning = <245>; ++ ++ abs_y-p-tuning = <245>; ++ abs_y-n-tuning = <245>; ++ ++ abs_rx-p-tuning = <245>; ++ abs_rx-n-tuning = <245>; ++ ++ abs_ry-p-tuning = <245>; ++ abs_ry-n-tuning = <245>; ++ ++ /* poll device interval (ms), adc read interval */ ++ poll-interval = <10>; ++ ++ /* gpio button auto repeat set value : default disable */ ++ /* ++ autorepeat; ++ */ ++ sw1 { ++ gpios = <&gpio3 RK_PA3 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-UP"; ++ linux,code = ; ++ }; ++ sw2 { ++ gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-DOWN"; ++ linux,code = ; ++ }; ++ sw3 { ++ gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-LEFT"; ++ linux,code = ; ++ }; ++ sw4 { ++ gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-RIGHT"; ++ linux,code = ; ++ }; ++ sw5 { ++ gpios = <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>; ++ label = "GPIO KEY BTN-A"; ++ linux,code = ; ++ }; ++ sw6 { ++ gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-B"; ++ linux,code = ; ++ }; ++ sw7 { ++ gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-X"; ++ linux,code = ; ++ }; ++ sw8 { ++ gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-Y"; ++ linux,code = ; ++ }; ++ sw9 { ++ gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_SELECT"; ++ linux,code = ; ++ }; ++ sw10 { ++ gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_START"; ++ linux,code = ; ++ }; ++ sw11 { ++ gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_F"; ++ linux,code = ; ++ }; ++ sw12 { ++ gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TL"; ++ linux,code = ; ++ }; ++ sw13 { ++ gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TR"; ++ linux,code = ; ++ }; ++ sw14 { ++ gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TL2"; ++ linux,code = ; ++ }; ++ sw15 { ++ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TR2"; ++ linux,code = ; ++ }; ++ sw16 { ++ gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_THUMBL"; ++ linux,code = ; ++ }; ++ sw17 { ++ gpios = <&gpio3 RK_PA2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_THUMBR"; ++ linux,code = ; ++ }; ++ + }; ++ + }; + + &i2c2 { diff --git a/projects/Rockchip/patches/linux/RK3566/023-rg353p-input.patch b/projects/Rockchip/patches/linux/RK3566/023-rg353p-input.patch new file mode 100644 index 000000000..dec66b093 --- /dev/null +++ b/projects/Rockchip/patches/linux/RK3566/023-rg353p-input.patch @@ -0,0 +1,171 @@ +diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353p.dts linux/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353p.dts +--- linux.orig/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353p.dts 2024-03-26 04:17:51.534641800 +0000 ++++ linux/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353p.dts 2024-03-26 05:29:29.179313507 +0000 +@@ -75,19 +75,156 @@ + pinctrl-names = "default"; + sound-name-prefix = "Speaker Amp"; + }; +-}; + +-&gpio_keys_control { +- button-r1 { +- gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; +- label = "TR"; +- linux,code = ; +- }; ++ joypad: singleadc-joypad { ++ compatible = "singleadc-joypad"; ++ hw_info = <0x01>; ++ ++ joypad-name = "retrogame_joypad"; ++ joypad-product = <0x1101>; ++ joypad-revision = <0x0100>; ++ ++ status = "okay"; ++ ++ /* gpio pincontrol setup */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&btn_pins_ctrl>; ++ ++ /* Analog mux define */ ++ io-channel-names = "amux_adc"; ++ io-channels = <&saradc 3>; ++ ++ /* adc mux channel count */ ++ amux-count = <4>; ++ /* adc mux select(a,b) gpio */ ++ amux-a-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>; ++ amux-b-gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>; ++ /* adc mux enable gpio */ ++ amux-en-gpios = <&gpio0 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 = <245>; ++ abs_x-n-tuning = <245>; ++ ++ abs_y-p-tuning = <245>; ++ abs_y-n-tuning = <245>; ++ ++ abs_rx-p-tuning = <245>; ++ abs_rx-n-tuning = <245>; ++ ++ abs_ry-p-tuning = <245>; ++ abs_ry-n-tuning = <245>; ++ ++ /* poll device interval (ms), adc read interval */ ++ poll-interval = <10>; + +- button-r2 { +- gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; +- label = "TR2"; +- linux,code = ; ++ /* gpio button auto repeat set value : default disable */ ++ /* ++ autorepeat; ++ */ ++ sw1 { ++ gpios = <&gpio3 RK_PA3 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-UP"; ++ linux,code = ; ++ }; ++ sw2 { ++ gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-DOWN"; ++ linux,code = ; ++ }; ++ sw3 { ++ gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-LEFT"; ++ linux,code = ; ++ }; ++ sw4 { ++ gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-RIGHT"; ++ linux,code = ; ++ }; ++ sw5 { ++ gpios = <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>; ++ label = "GPIO KEY BTN-A"; ++ linux,code = ; ++ }; ++ sw6 { ++ gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-B"; ++ linux,code = ; ++ }; ++ sw7 { ++ gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-X"; ++ linux,code = ; ++ }; ++ sw8 { ++ gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-Y"; ++ linux,code = ; ++ }; ++ sw9 { ++ gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_SELECT"; ++ linux,code = ; ++ }; ++ sw10 { ++ gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_START"; ++ linux,code = ; ++ }; ++ sw11 { ++ gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_F"; ++ linux,code = ; ++ }; ++ sw12 { ++ gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TL"; ++ linux,code = ; ++ }; ++ sw13 { ++ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TR"; ++ linux,code = ; ++ }; ++ sw14 { ++ gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TL2"; ++ linux,code = ; ++ }; ++ sw15 { ++ gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TR2"; ++ linux,code = ; ++ }; ++ sw16 { ++ gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_THUMBL"; ++ linux,code = ; ++ }; ++ sw17 { ++ gpios = <&gpio3 RK_PA2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_THUMBR"; ++ linux,code = ; ++ }; ++ + }; + }; + diff --git a/projects/Rockchip/patches/linux/RK3566/024-rg353ps-input.patch b/projects/Rockchip/patches/linux/RK3566/024-rg353ps-input.patch new file mode 100644 index 000000000..3023573d0 --- /dev/null +++ b/projects/Rockchip/patches/linux/RK3566/024-rg353ps-input.patch @@ -0,0 +1,170 @@ +diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353ps.dts linux/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353ps.dts +--- linux.orig/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353ps.dts 2024-03-26 04:17:51.534641800 +0000 ++++ linux/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353ps.dts 2024-03-26 05:31:21.679144829 +0000 +@@ -74,19 +74,155 @@ + pinctrl-names = "default"; + sound-name-prefix = "Speaker Amp"; + }; +-}; ++ joypad: singleadc-joypad { ++ compatible = "singleadc-joypad"; ++ hw_info = <0x01>; + +-&gpio_keys_control { +- button-r1 { +- gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; +- label = "TR"; +- linux,code = ; +- }; ++ joypad-name = "retrogame_joypad"; ++ joypad-product = <0x1101>; ++ joypad-revision = <0x0100>; ++ ++ status = "okay"; ++ ++ /* gpio pincontrol setup */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&btn_pins_ctrl>; ++ ++ /* Analog mux define */ ++ io-channel-names = "amux_adc"; ++ io-channels = <&saradc 3>; ++ ++ /* adc mux channel count */ ++ amux-count = <4>; ++ /* adc mux select(a,b) gpio */ ++ amux-a-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>; ++ amux-b-gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>; ++ /* adc mux enable gpio */ ++ amux-en-gpios = <&gpio0 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 = <245>; ++ abs_x-n-tuning = <245>; ++ ++ abs_y-p-tuning = <245>; ++ abs_y-n-tuning = <245>; ++ ++ abs_rx-p-tuning = <245>; ++ abs_rx-n-tuning = <245>; ++ ++ abs_ry-p-tuning = <245>; ++ abs_ry-n-tuning = <245>; ++ ++ /* poll device interval (ms), adc read interval */ ++ poll-interval = <10>; + +- button-r2 { +- gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; +- label = "TR2"; +- linux,code = ; ++ /* gpio button auto repeat set value : default disable */ ++ /* ++ autorepeat; ++ */ ++ sw1 { ++ gpios = <&gpio3 RK_PA3 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-UP"; ++ linux,code = ; ++ }; ++ sw2 { ++ gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-DOWN"; ++ linux,code = ; ++ }; ++ sw3 { ++ gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-LEFT"; ++ linux,code = ; ++ }; ++ sw4 { ++ gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>; ++ label = "GPIO DPAD-RIGHT"; ++ linux,code = ; ++ }; ++ sw5 { ++ gpios = <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>; ++ label = "GPIO KEY BTN-A"; ++ linux,code = ; ++ }; ++ sw6 { ++ gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-B"; ++ linux,code = ; ++ }; ++ sw7 { ++ gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-X"; ++ linux,code = ; ++ }; ++ sw8 { ++ gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN-Y"; ++ linux,code = ; ++ }; ++ sw9 { ++ gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_SELECT"; ++ linux,code = ; ++ }; ++ sw10 { ++ gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_START"; ++ linux,code = ; ++ }; ++ sw11 { ++ gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_F"; ++ linux,code = ; ++ }; ++ sw12 { ++ gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TL"; ++ linux,code = ; ++ }; ++ sw13 { ++ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TR"; ++ linux,code = ; ++ }; ++ sw14 { ++ gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TL2"; ++ linux,code = ; ++ }; ++ sw15 { ++ gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_TR2"; ++ linux,code = ; ++ }; ++ sw16 { ++ gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_THUMBL"; ++ linux,code = ; ++ }; ++ sw17 { ++ gpios = <&gpio3 RK_PA2 GPIO_ACTIVE_LOW>; ++ label = "GPIO BTN_THUMBR"; ++ linux,code = ; ++ }; ++ + }; + }; +