armbian-build/patch/kernel/archive/sm8550-6.18/0062_rsinput--regulator.patch
Christian Wang f785a6d9fd Added SM8550 Patches from ROCKNIX and also kernel config from ROCKNIX
https://github.com/ROCKNIX/distribution

From ROCKNIX/devices/SM8550/linux/linux.aarch64.conf

From ROCKNIX/devices/SM8550/patches/linux/
- 0001-msm-adreno-enable-A32.patch
- 0002-qcom-dispcc-sm8550-Fix-disp_cc_mdss_mdp_clk_src.patch
- 0003_drm-msm-dpu-Set-vsync-source-irrespective-of-mdp-.patch
- 0030-input-rmi4-add-reset-gpio.patch
- 0031_input--Add-driver-for-RSInput-Gamepad.patch
- 0033_leds--Add-driver-for-HEROIC-HTR3212.patch
- 0036_ASoC--qcom--sc8280xp-Add-support-for-Primary-I2S.patch
- 0042_mmc--sdhci-msm--Toggle-the-FIFO-write-clock-after-.patch
- 0047_ASoC--codecs--aw88166--AYN-Odin2-Specific-modifica.patch
- 0050_pmk8550-pwm.patch
- 0051-gpu-panel-add-Pocket-ACE-panel-driver.patch
- 0052-gpu-panel-add-Pocket-DMG-panel-driver.patch
- 0053-add-hynitron-touchscreen.patch
- 0053-edt-ft5x06-add-no_regmap_bulk_read-option.patch
- 0053-gpu-panel-add-Pocket-DS-lower-panel-driver.patch
- 0054_sn3112-pwm-driver.patch
- 0055_Synaptics-TD4328-LCD-panel.patch
- 0056_Xm-Plus-XM91080G-panel.patch
- 0057_Chipone-ICNA35XX-panel.patch
- 0057_DDIC-CH13726A-panel.patch
- 0058_AYN-Odin2-Mini--backlight.patch
- 0059_AYN-Odin2-Mini--hynitron--cstxxx.patch
- 0060-Add-Silergy-SY7758-backlight-driver.patch
- 0061-regulator-add-sgm3804-i2c-regulator-for-panel-power-.patch
- 0062_rsinput--regulator.patch
- 0070-drm-msm-remove-DRIVER_SYNCOBJ_TIMELINE.patch
- 0071-HACK-fix-usb-boot-hang.patch
- 0100-SM8550-Fix-L2-cache-for-CPU2-and-add-cache-sizes.patch
- 0101-SM8550-Add-DDR-LLCC-L3-CPU-bandwidth-scaling.patch
- 0102-20240424_wuxilin123_ayn_odin_2_support.patch
- 0103_arm64--dts--qcom--sm8550--add-UART15.patch
- 0104-drm-panel-Add-Retroid-Pocket-6-panel.patch
- 0120-20250728_konradybcio_gpu_cc_power_requirements_reality_check.patch
- 0122-interconnect__qcom__sm8550__Enable_QoS_configuration.patch
- 0154-dts-qcom-sm8550-add-opp-acd-level.patch
- 0200_arm64--dts--qcom--Add-AYN-QCS8550-Common.patch
- 0201_arm64--dts--qcom--Add-AYN-Odin2.patch
- 0202_arm64--dts--qcom--Add-AYN-Odin2-Mini.patch
- 0203_arm64--dts--qcom--Add-AYN-Odin2-Portal.patch
- 0204_arm64--dts--qcom--Add-AYN-Thor.patch
- 0210_arm64--dts--qcom--Add-AYANEO-Pocket-Common.patch
- 0211_arm64--dts--qcom--Add-AYANEO-Pocket-ACE.patch
- 0212_arm64--dts--qcom--Add-AYANEO-Pocket-DMG.patch
- 0213_arm64--dts--qcom--Add-AYANEO-Pocket-EVO.patch
- 0214_arm64--dts--qcom--Add-AYANEO-Pocket-DS.patch
- 0500-ROCKNIX-set-boot-fanspeed.patch
- 0501-ROCKNIX-fix-wifi-and-bt-mac.patch
- 0503-ROCKNIX-battery-name.patch
- v5_20251120_quic_utiwari_crypto_qce_add_runtime_pm_and_interconnect_bandwidth_scaling_support.patch
2026-03-04 19:57:23 +01:00

113 lines
3.3 KiB
Diff

From 1c8a28a552950fa3b4180c1e86e76e0ddcb140f8 Mon Sep 17 00:00:00 2001
From: Teguh Sobirin <teguh@sobir.in>
Date: Mon, 21 Apr 2025 18:16:35 +0800
Subject: [PATCH] input: RSInput: Add regulator
Signed-off-by: Teguh Sobirin <teguh@sobir.in>
---
drivers/input/joystick/rsinput.c | 48 ++++++++++++++++++++------------
1 file changed, 30 insertions(+), 18 deletions(-)
diff --git a/drivers/input/joystick/rsinput.c b/drivers/input/joystick/rsinput.c
index 4a70964077129b..12ba7a99422fda 100644
--- a/drivers/input/joystick/rsinput.c
+++ b/drivers/input/joystick/rsinput.c
@@ -5,8 +5,6 @@
* Copyright (C) 2024 Teguh Sobirin <teguh@sobir.in>
*
*/
-#define DEBUG
-
#include <linux/errno.h>
#include <linux/gpio/consumer.h>
#include <linux/init.h>
@@ -14,6 +12,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/regulator/consumer.h>
#include <linux/serdev.h>
#include <linux/slab.h>
#include <uapi/linux/sched/types.h>
@@ -55,6 +54,7 @@
struct rsinput_driver {
struct serdev_device *serdev;
struct input_dev *input;
+ struct regulator *vdd;
struct gpio_desc *boot_gpio;
struct gpio_desc *enable_gpio;
struct gpio_desc *reset_gpio;
@@ -111,7 +111,22 @@ static int rsinput_send_command(struct rsinput_driver *drv, uint8_t cmd, const u
static int rsinput_init_commands(struct rsinput_driver *drv) {
int error;
+ if (drv->boot_gpio)
+ gpiod_set_value_cansleep(drv->boot_gpio, 0);
+
+ if (drv->reset_gpio)
+ gpiod_set_value_cansleep(drv->reset_gpio, 0);
+
+ msleep(100);
+
+ if (drv->enable_gpio)
+ gpiod_set_value_cansleep(drv->enable_gpio, 1);
+
+ if (drv->reset_gpio)
+ gpiod_set_value_cansleep(drv->reset_gpio, 1);
+
msleep(100);
+
uint8_t version_request[] = {DATA_COMMOD_VERSION};
error = rsinput_send_command(drv, CMD_COMMOD, version_request, sizeof(version_request));
if (error < 0) {
@@ -284,6 +299,17 @@ static int rsinput_probe(struct serdev_device *serdev) {
if (!drv)
return -ENOMEM;
+ drv->vdd = devm_regulator_get(&serdev->dev, "vdd");
+ if (IS_ERR(drv->vdd)) {
+ error = PTR_ERR(drv->vdd);
+ return error;
+ }
+
+ error = regulator_enable(drv->vdd);
+ if (error < 0) {
+ return error;
+ }
+
drv->boot_gpio =
devm_gpiod_get_optional(&serdev->dev, "boot", GPIOD_OUT_HIGH);
if (IS_ERR(drv->boot_gpio)) {
@@ -305,22 +331,6 @@ static int rsinput_probe(struct serdev_device *serdev) {
dev_warn(&serdev->dev, "Unable to get reset gpio: %d\n", error);
}
- if (drv->boot_gpio)
- gpiod_set_value_cansleep(drv->boot_gpio, 0);
-
- if (drv->reset_gpio)
- gpiod_set_value_cansleep(drv->reset_gpio, 0);
-
- msleep(100);
-
- if (drv->enable_gpio)
- gpiod_set_value_cansleep(drv->enable_gpio, 1);
-
- if (drv->reset_gpio)
- gpiod_set_value_cansleep(drv->reset_gpio, 1);
-
- msleep(100);
-
error = serdev_device_open(serdev);
if (error)
return dev_err_probe(&serdev->dev, error, "Unable to open UART device\n");
@@ -394,6 +404,8 @@ static void rsinput_remove(struct serdev_device *serdev) {
if (drv->reset_gpio)
gpiod_set_value_cansleep(drv->reset_gpio, 0);
+
+ regulator_disable(drv->vdd);
}
static const struct of_device_id rsinput_of_match[] = {