From c6c48e8f09559f19409acac51c039fedec036a8f Mon Sep 17 00:00:00 2001 From: Oendaril Date: Thu, 1 Feb 2024 22:30:51 -0500 Subject: [PATCH 1/3] Adding the ability to define invert parameters on odroid3go joypad driver. This can allow any of the 4 joystick axes to be flipped at the driver level. --- .../patches/RK3326/004-input-drivers.patch | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/projects/Rockchip/packages/linux/patches/RK3326/004-input-drivers.patch b/projects/Rockchip/packages/linux/patches/RK3326/004-input-drivers.patch index ddbea2e157..ec3598263c 100644 --- a/projects/Rockchip/packages/linux/patches/RK3326/004-input-drivers.patch +++ b/projects/Rockchip/packages/linux/patches/RK3326/004-input-drivers.patch @@ -2264,9 +2264,9 @@ diff -rupN linux.orig/drivers/input/joystick/odroidgo2-v11-joypad.c linux/driver + +/*----------------------------------------------------------------------------*/ diff -rupN linux.orig/drivers/input/joystick/odroidgo3-joypad.c linux/drivers/input/joystick/odroidgo3-joypad.c ---- linux.orig/drivers/input/joystick/odroidgo3-joypad.c 1970-01-01 00:00:00.000000000 +0000 -+++ linux/drivers/input/joystick/odroidgo3-joypad.c 2024-01-29 06:19:30.953540557 +0000 -@@ -0,0 +1,1086 @@ +--- linux.orig/drivers/input/joystick/odroidgo3-joypad.c 1969-12-31 19:00:00.000000000 -0500 ++++ linux/drivers/input/joystick/odroidgo3-joypad.c 2024-02-01 13:43:52.000000000 -0500 +@@ -0,0 +1,1108 @@ +/* + * SARADC joystick & GPIO Button driver for Linux(Hardkernel ODROIDGO2-Advance) + */ @@ -2391,6 +2391,12 @@ diff -rupN linux.orig/drivers/input/joystick/odroidgo3-joypad.c linux/drivers/in + /* analog button */ + struct bt_adc *adcs; + ++ /* report reference point */ ++ bool invert_absx; ++ bool invert_absy; ++ bool invert_absrx; ++ bool invert_absry; ++ + /* report interval (ms) */ + int bt_gpio_count; + struct bt_gpio *gpios; @@ -2504,7 +2510,7 @@ diff -rupN linux.orig/drivers/input/joystick/odroidgo3-joypad.c linux/drivers/in + + value *= adc->scale; + -+ return (adc->invert ? (adc->max - value) : value); ++ return value; +} + +/*----------------------------------------------------------------------------*/ @@ -3009,6 +3015,8 @@ diff -rupN linux.orig/drivers/input/joystick/odroidgo3-joypad.c linux/drivers/in + + switch (nbtn) { + case 0: ++ if (joypad->invert_absry) ++ adc->invert = true; + adc->report_type = ABS_RY; + if (device_property_read_u32(dev, + "abs_ry-p-tuning", @@ -3020,6 +3028,8 @@ diff -rupN linux.orig/drivers/input/joystick/odroidgo3-joypad.c linux/drivers/in + adc->tuning_n = ADC_TUNING_DEFAULT; + break; + case 1: ++ if (joypad->invert_absrx) ++ adc->invert = true; + adc->report_type = ABS_RX; + if (device_property_read_u32(dev, + "abs_rx-p-tuning", @@ -3031,6 +3041,8 @@ diff -rupN linux.orig/drivers/input/joystick/odroidgo3-joypad.c linux/drivers/in + adc->tuning_n = ADC_TUNING_DEFAULT; + break; + case 2: ++ if (joypad->invert_absy) ++ adc->invert = true; + adc->report_type = ABS_Y; + if (device_property_read_u32(dev, + "abs_y-p-tuning", @@ -3042,6 +3054,8 @@ diff -rupN linux.orig/drivers/input/joystick/odroidgo3-joypad.c linux/drivers/in + adc->tuning_n = ADC_TUNING_DEFAULT; + break; + case 3: ++ if (joypad->invert_absx) ++ adc->invert = true; + adc->report_type = ABS_X; + if (device_property_read_u32(dev, + "abs_x-p-tuning", @@ -3247,6 +3261,14 @@ diff -rupN linux.orig/drivers/input/joystick/odroidgo3-joypad.c linux/drivers/in + + joypad->auto_repeat = device_property_present(dev, "autorepeat"); + ++ /* change the report reference point? (read value * -1) */ ++ joypad->invert_absx = device_property_present(dev, "invert-absx"); ++ joypad->invert_absy = device_property_present(dev, "invert-absy"); ++ joypad->invert_absrx = device_property_present(dev, "invert-absrx"); ++ joypad->invert_absry = device_property_present(dev, "invert-absry"); ++ dev_info(dev, "%s : invert-absx = %d, inveret-absy = %d, invert-absrx = %d, invert-absry = %d\n", ++ __func__, joypad->invert_absx, joypad->invert_absy, joypad->invert_absrx, joypad->invert_absry); ++ + joypad->bt_gpio_count = device_get_child_node_count(dev); + + if ((joypad->amux_count == 0) || (joypad->bt_gpio_count == 0)) { From 31195c78a21ef87f156a8efb1830b61defc453af Mon Sep 17 00:00:00 2001 From: Oendaril Date: Thu, 1 Feb 2024 22:31:27 -0500 Subject: [PATCH 2/3] Adding some additional regulator changes to match original dts and hopefully prevent lcd blanking after resume from sleep --- .../packages/linux/patches/RK3326/000-rk3326-dts.patch | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/Rockchip/packages/linux/patches/RK3326/000-rk3326-dts.patch b/projects/Rockchip/packages/linux/patches/RK3326/000-rk3326-dts.patch index 9aab8b388b..516f3fd13e 100644 --- a/projects/Rockchip/packages/linux/patches/RK3326/000-rk3326-dts.patch +++ b/projects/Rockchip/packages/linux/patches/RK3326/000-rk3326-dts.patch @@ -949,8 +949,8 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3326-gameconsole-r33s.dts l +}; diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts linux/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts --- linux.orig/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts 1969-12-31 19:00:00.000000000 -0500 -+++ linux/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts 2024-01-29 18:25:00.758766065 -0500 -@@ -0,0 +1,825 @@ ++++ linux/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts 2024-02-01 21:39:27.594961980 -0500 +@@ -0,0 +1,828 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Hardkernel Co., Ltd @@ -1306,6 +1306,7 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts linux/ + compatible = "regulator-fixed"; + regulator-name = "vcc3v8_sys"; + regulator-always-on; ++ regulator-boot-on; + regulator-min-microvolt = <3800000>; + regulator-max-microvolt = <3800000>; + }; @@ -1572,6 +1573,8 @@ diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3326-magicx-xu10.dts linux/ + regulator-name = "vcc18_lcd_n"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ enable-active-high; + + regulator-state-mem { + regulator-off-in-suspend; From 131482132b386f4105be3c14e0492bbbbcb90a6f Mon Sep 17 00:00:00 2001 From: Oendaril Date: Thu, 1 Feb 2024 22:33:20 -0500 Subject: [PATCH 3/3] Changing a/b for mupen64plussa to south and west respectively to match other handhelds and retroarch button mapping for face buttons. Also, adding performance tuning to mupen by disabling mipmap and using faster texture algorithm. Also, accurate texture mapping actually introduced artifacts --- .../config/RK3326/mupen64plus.cfg.xut | 22 +++++++++---------- .../config/RK3326/default.ini | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/emulators/standalone/mupen64plus-sa/mupen64plus-sa-core/config/RK3326/mupen64plus.cfg.xut b/packages/emulators/standalone/mupen64plus-sa/mupen64plus-sa-core/config/RK3326/mupen64plus.cfg.xut index edf332ab36..f9ebfdd47e 100644 --- a/packages/emulators/standalone/mupen64plus-sa/mupen64plus-sa-core/config/RK3326/mupen64plus.cfg.xut +++ b/packages/emulators/standalone/mupen64plus-sa/mupen64plus-sa-core/config/RK3326/mupen64plus.cfg.xut @@ -110,13 +110,13 @@ Kbd Mapping Frame Advance = 47 # SDL keysym for pressing the game shark button Kbd Mapping Gameshark = 103 # Joystick event string for stopping the emulator -Joy Mapping Stop = "J0B12/B13" +Joy Mapping Stop = "J0B16/B9" # Joystick event string for switching between fullscreen/windowed modes Joy Mapping Fullscreen = "" # Joystick event string for saving the emulator state -Joy Mapping Save State = "J0B12/B5" +Joy Mapping Save State = "J0B16/B5" # Joystick event string for loading the emulator state -Joy Mapping Load State = "J0B12/B4" +Joy Mapping Load State = "J0B16/B4" # Joystick event string for advancing the save state slot Joy Mapping Increment Slot = "" # Joystick event string for resetting the emulator @@ -128,7 +128,7 @@ Joy Mapping Speed Up = "" # Joystick event string for taking a screenshot Joy Mapping Screenshot = "" # Joystick event string for pausing the emulator -Joy Mapping Pause = "J0B12/B0" +Joy Mapping Pause = "J0B16/B0" # Joystick event string for muting/unmuting the sound Joy Mapping Mute = "" # Joystick event string for increasing the volume @@ -136,7 +136,7 @@ Joy Mapping Increase Volume = "" # Joystick event string for decreasing the volume Joy Mapping Decrease Volume = "" # Joystick event string for fast-forward -Joy Mapping Fast Forward = "J0B12/B14" +Joy Mapping Fast Forward = "J0B16/B15" # Joystick event string for advancing by one frame when paused Joy Mapping Frame Advance = "" # Joystick event string for pressing the game shark button @@ -196,8 +196,8 @@ DPad D = button(13) DPad U = button(12) Start = button(9) Z Trig = button(7) -B Button = button(1) -A Button = button(2) +B Button = button(0) +A Button = button(1) C Button R = axis(2+) C Button L = axis(2-) C Button D = axis(3+) @@ -399,7 +399,7 @@ ScreenHeight = 320 # Use fullscreen mode if True, or windowed mode if False Fullscreen = True # If true, activate the SDL_GL_SWAP_CONTROL attribute -VerticalSync = True +VerticalSync = False # Rotate screen contents: 0=0 degree, 1=90 degree, 2 = 180 degree, 3=270 degree Rotate = 0 @@ -605,9 +605,9 @@ ScreenUpdateSetting = 4 # Force to use normal alpha blender NormalAlphaBlender = False # Use a faster algorithm to speed up texture loading and CRC computation -FastTextureLoading = False +FastTextureLoading = True # Use different texture coordinate clamping code -AccurateTextureMapping = True +AccurateTextureMapping = False # Force emulated frame buffers to be in N64 native resolution InN64Resolution = False # Try to reduce Video RAM usage (should never be used) @@ -641,7 +641,7 @@ DumpTexturesToFiles = False # Display On-screen FPS ShowFPS = False # Use Mipmapping? 0=no, 1=nearest, 2=bilinear, 3=trilinear -Mipmapping = 2 +Mipmapping = 0 # Enable, Disable fog generation (0=Disable, 1=Enable) FogMethod = 1 # Force to use texture filtering or not (0=auto: n64 choose, 1=force no filtering, 2=force filtering) diff --git a/packages/emulators/standalone/mupen64plus-sa/mupen64plus-sa-input-sdl/config/RK3326/default.ini b/packages/emulators/standalone/mupen64plus-sa/mupen64plus-sa-input-sdl/config/RK3326/default.ini index e03cfdde70..262e09b83c 100644 --- a/packages/emulators/standalone/mupen64plus-sa/mupen64plus-sa-input-sdl/config/RK3326/default.ini +++ b/packages/emulators/standalone/mupen64plus-sa/mupen64plus-sa-input-sdl/config/RK3326/default.ini @@ -135,8 +135,8 @@ DPad D = button(13) DPad U = button(12) Start = button(9) Z Trig = button(7) -B Button = button(1) -A Button = button(2) +B Button = button(0) +A Button = button(1) C Button R = axis(2+) C Button L = axis(2-) C Button D = axis(3+)