3868 lines
104 KiB
Diff
3868 lines
104 KiB
Diff
diff -rupN linux.orig/Makefile linux/Makefile
|
|
--- linux.orig/Makefile 2023-06-23 03:53:37.552116029 +0000
|
|
+++ linux/Makefile 2023-07-22 17:35:56.978930533 +0000
|
|
@@ -826,6 +826,8 @@ KBUILD_CFLAGS += $(call cc-disable-warni
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
|
|
+KBUILD_CFLAGS += $(call cc-disable-warning, unused-label)
|
|
+KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)
|
|
|
|
ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
|
|
KBUILD_CFLAGS += -O2
|
|
@@ -1075,7 +1077,7 @@ endif
|
|
KBUILD_CFLAGS += -Werror=date-time
|
|
|
|
# enforce correct pointer usage
|
|
-KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types)
|
|
+# KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types)
|
|
|
|
# Require designated initializers for all marked structures
|
|
KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
|
|
diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/Makefile linux/arch/arm64/boot/dts/rockchip/Makefile
|
|
--- linux.orig/arch/arm64/boot/dts/rockchip/Makefile 2023-06-23 03:53:36.244094795 +0000
|
|
+++ linux/arch/arm64/boot/dts/rockchip/Makefile 2023-07-27 13:59:09.292214719 +0000
|
|
@@ -21,6 +21,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-li
|
|
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-orion-r68-meta.dtb
|
|
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-px5-evb.dtb
|
|
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-r88.dtb
|
|
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-anbernic-rg552.dtb
|
|
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-eaidk-610.dtb
|
|
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-evb.dtb
|
|
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-ficus.dtb
|
|
diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi
|
|
--- linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi 1970-01-01 00:00:00.000000000 +0000
|
|
+++ linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552-opp.dtsi 2023-07-27 12:34:27.790942738 +0000
|
|
@@ -0,0 +1,141 @@
|
|
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
|
+/*
|
|
+ * Copyright (c) 2016-2017 Fuzhou Rockchip Electronics Co., Ltd
|
|
+ * Copyright (C) 2022-present - The JELOS Project (https://github.com/JustEnoughLinuxOS)
|
|
+ */
|
|
+
|
|
+/ {
|
|
+ cluster0_opp: opp-table-0 {
|
|
+ compatible = "operating-points-v2";
|
|
+ opp-shared;
|
|
+
|
|
+ opp00 {
|
|
+ opp-hz = /bits/ 64 <816000000>;
|
|
+ opp-microvolt = <850000>;
|
|
+ };
|
|
+ opp01 {
|
|
+ opp-hz = /bits/ 64 <1008000000>;
|
|
+ opp-microvolt = <925000>;
|
|
+ };
|
|
+ opp02 {
|
|
+ opp-hz = /bits/ 64 <1200000000>;
|
|
+ opp-microvolt = <1000000>;
|
|
+ };
|
|
+ opp03 {
|
|
+ opp-hz = /bits/ 64 <1416000000>;
|
|
+ opp-microvolt = <1125000>;
|
|
+ };
|
|
+ opp-04 {
|
|
+ opp-hz = /bits/ 64 <1512000000>;
|
|
+ opp-microvolt = <1200000>;
|
|
+ };
|
|
+ opp-05 {
|
|
+ opp-hz = /bits/ 64 <1608000000>;
|
|
+ opp-microvolt = <1225000>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ cluster1_opp: opp-table-1 {
|
|
+ compatible = "operating-points-v2";
|
|
+ opp-shared;
|
|
+
|
|
+ opp00 {
|
|
+ opp-hz = /bits/ 64 <816000000>;
|
|
+ opp-microvolt = <825000>;
|
|
+ };
|
|
+ opp01 {
|
|
+ opp-hz = /bits/ 64 <1008000000>;
|
|
+ opp-microvolt = <875000>;
|
|
+ };
|
|
+ opp02 {
|
|
+ opp-hz = /bits/ 64 <1200000000>;
|
|
+ opp-microvolt = <950000>;
|
|
+ };
|
|
+ opp03 {
|
|
+ opp-hz = /bits/ 64 <1416000000>;
|
|
+ opp-microvolt = <1025000>;
|
|
+ };
|
|
+ opp04 {
|
|
+ opp-hz = /bits/ 64 <1608000000>;
|
|
+ opp-microvolt = <1100000>;
|
|
+ };
|
|
+ opp05 {
|
|
+ opp-hz = /bits/ 64 <1800000000>;
|
|
+ opp-microvolt = <1200000>;
|
|
+ };
|
|
+ opp-06 {
|
|
+ opp-hz = /bits/ 64 <1992000000>;
|
|
+ opp-microvolt = <1250000>;
|
|
+ };
|
|
+ opp-07 {
|
|
+ opp-hz = /bits/ 64 <2088000000>;
|
|
+ opp-microvolt = <1250000>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ gpu_opp_table: opp-table-2 {
|
|
+ compatible = "operating-points-v2";
|
|
+
|
|
+ opp00 {
|
|
+ opp-hz = /bits/ 64 <500000000>;
|
|
+ opp-microvolt = <875000>;
|
|
+ };
|
|
+ opp01 {
|
|
+ opp-hz = /bits/ 64 <600000000>;
|
|
+ opp-microvolt = <925000>;
|
|
+ };
|
|
+ opp02 {
|
|
+ opp-hz = /bits/ 64 <800000000>;
|
|
+ opp-microvolt = <1100000>;
|
|
+ };
|
|
+ opp03 {
|
|
+ opp-hz = /bits/ 64 <900000000>;
|
|
+ opp-microvolt = <1150000>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ dmc_opp_table: opp-table-3 {
|
|
+ compatible = "operating-points-v2";
|
|
+
|
|
+ opp00 {
|
|
+ opp-hz = /bits/ 64 <666000000>;
|
|
+ opp-microvolt = <900000>;
|
|
+ };
|
|
+ opp01 {
|
|
+ opp-hz = /bits/ 64 <856000000>;
|
|
+ opp-microvolt = <900000>;
|
|
+ };
|
|
+ };
|
|
+};
|
|
+
|
|
+&cpu_l0 {
|
|
+ operating-points-v2 = <&cluster0_opp>;
|
|
+};
|
|
+
|
|
+&cpu_l1 {
|
|
+ operating-points-v2 = <&cluster0_opp>;
|
|
+};
|
|
+
|
|
+&cpu_l2 {
|
|
+ operating-points-v2 = <&cluster0_opp>;
|
|
+};
|
|
+
|
|
+&cpu_l3 {
|
|
+ operating-points-v2 = <&cluster0_opp>;
|
|
+};
|
|
+
|
|
+&cpu_b0 {
|
|
+ operating-points-v2 = <&cluster1_opp>;
|
|
+};
|
|
+
|
|
+&cpu_b1 {
|
|
+ operating-points-v2 = <&cluster1_opp>;
|
|
+};
|
|
+
|
|
+&dmc {
|
|
+ operating-points-v2 = <&dmc_opp_table>;
|
|
+};
|
|
+
|
|
+&gpu {
|
|
+ operating-points-v2 = <&gpu_opp_table>;
|
|
+};
|
|
diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts
|
|
--- linux.orig/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts 1970-01-01 00:00:00.000000000 +0000
|
|
+++ linux/arch/arm64/boot/dts/rockchip/rk3399-anbernic-rg552.dts 2023-07-28 03:39:31.373986693 +0000
|
|
@@ -0,0 +1,1329 @@
|
|
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
|
+/*
|
|
+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
|
|
+ * Copyright (c) 2018 Akash Gajjar <Akash_Gajjar@mentor.com>
|
|
+ * Copyright (c) 2022 Maya Matuszczyk <maccraft123mc@gmail.com>
|
|
+ * Copyright (C) 2022-present - The JELOS Project (https://github.com/JustEnoughLinuxOS)
|
|
+ */
|
|
+
|
|
+
|
|
+/dts-v1/;
|
|
+#include <dt-bindings/input/linux-event-codes.h>
|
|
+#include <dt-bindings/pwm/pwm.h>
|
|
+#include <dt-bindings/usb/pd.h>
|
|
+#include "rk3399.dtsi"
|
|
+#include "rk3399-anbernic-rg552-opp.dtsi"
|
|
+
|
|
+/ {
|
|
+ model = "Anbernic RG552";
|
|
+ compatible = "anbernic,rg552", "rockchip,rk3399";
|
|
+
|
|
+ aliases {
|
|
+ mmc0 = &sdio0;
|
|
+ mmc1 = &sdmmc;
|
|
+ mmc2 = &sdhci;
|
|
+ };
|
|
+
|
|
+ chosen {
|
|
+ stdout-path = "serial2:1500000n8";
|
|
+ };
|
|
+
|
|
+ volume-keys {
|
|
+ compatible = "gpio-keys";
|
|
+ autorepeat;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&vol_pwr_btn>;
|
|
+
|
|
+ sw1 {
|
|
+ label = "BTN VOL+";
|
|
+ linux,code = <KEY_VOLUMEUP>;
|
|
+ gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>;
|
|
+ };
|
|
+ sw2 {
|
|
+ label = "BTN VOL-";
|
|
+ linux,code = <KEY_VOLUMEDOWN>;
|
|
+ gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ power-btn {
|
|
+ compatible = "gpio-keys";
|
|
+ autorepeat;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&pwr_btn>;
|
|
+
|
|
+ sw1 {
|
|
+ debounce-interval = <100>;
|
|
+ gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
|
|
+ label = "BTN PWR";
|
|
+ linux,code = <KEY_POWER>;
|
|
+ wakeup-source;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ adc-keys {
|
|
+ compatible = "adc-keys";
|
|
+ io-channels = <&saradc 1>;
|
|
+ io-channel-names = "buttons";
|
|
+ keyup-threshold-microvolt = <1800000>;
|
|
+ poll-interval = <100>;
|
|
+
|
|
+ home-key {
|
|
+ linux,code = <BTN_MODE>;
|
|
+ label = "F Button";
|
|
+ press-threshold-microvolt = <1750>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ joypad: singleadc-joypad {
|
|
+ compatible = "singleadc-joypad";
|
|
+
|
|
+ pwms = <&pwm3 0 200000000 0>;
|
|
+ pwm-names = "enable";
|
|
+ rumble-boost-weak = <0x0000>;
|
|
+ rumble-boost-strong = <0x0000>;
|
|
+
|
|
+ joypad-name = "retrogame_joypad";
|
|
+ joypad-product = <0x1101>;
|
|
+ joypad-revision = <0x0200>;
|
|
+
|
|
+ status = "okay";
|
|
+
|
|
+ /* gpio pincontrol setup */
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&btn_pins>;
|
|
+
|
|
+ /* Analog mux define */
|
|
+ io-channel-names = "amux_adc";
|
|
+ io-channels = <&saradc 4>;
|
|
+
|
|
+ /* adc mux channel count */
|
|
+ amux-count = <4>;
|
|
+ /* adc mux select(a,b) gpio */
|
|
+ amux-a-gpios = <&gpio1 RK_PA1 GPIO_ACTIVE_LOW>;
|
|
+ amux-b-gpios = <&gpio1 RK_PA0 GPIO_ACTIVE_LOW>;
|
|
+ /* adc mux enable gpio */
|
|
+ amux-en-gpios = <&gpio1 RK_PA4 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 = <300>;
|
|
+ abs_x-n-tuning = <300>;
|
|
+
|
|
+ abs_y-p-tuning = <300>;
|
|
+ abs_y-n-tuning = <300>;
|
|
+
|
|
+ abs_rx-p-tuning = <300>;
|
|
+ abs_rx-n-tuning = <300>;
|
|
+
|
|
+ abs_ry-p-tuning = <300>;
|
|
+ abs_ry-n-tuning = <300>;
|
|
+
|
|
+ /* poll device interval (ms), adc read interval */
|
|
+ poll-interval = <10>;
|
|
+
|
|
+ /* required for RG552(invert) */
|
|
+ invert-absx;
|
|
+ invert-absy;
|
|
+
|
|
+ /* gpio button auto repeat set value : default disable */
|
|
+ /*
|
|
+ autorepeat;
|
|
+ */
|
|
+ sw1 {
|
|
+ gpios = <&gpio3 RK_PA0 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO DPAD-UP";
|
|
+ linux,code = <BTN_DPAD_UP>;
|
|
+ };
|
|
+ sw2 {
|
|
+ gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO DPAD-DOWN";
|
|
+ linux,code = <BTN_DPAD_DOWN>;
|
|
+ };
|
|
+ sw3 {
|
|
+ gpios = <&gpio3 RK_PA3 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO DPAD-LEFT";
|
|
+ linux,code = <BTN_DPAD_LEFT>;
|
|
+ };
|
|
+ sw4 {
|
|
+ gpios = <&gpio3 RK_PA2 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO DPAD-RIGHT";
|
|
+ linux,code = <BTN_DPAD_RIGHT>;
|
|
+ };
|
|
+ sw5 {
|
|
+ gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO KEY BTN-A";
|
|
+ linux,code = <BTN_EAST>;
|
|
+ };
|
|
+ sw6 {
|
|
+ gpios = <&gpio3 RK_PA7 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO BTN-B";
|
|
+ linux,code = <BTN_SOUTH>;
|
|
+ };
|
|
+ sw7 {
|
|
+ gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO BTN-X";
|
|
+ linux,code = <BTN_NORTH>;
|
|
+ };
|
|
+ sw8 {
|
|
+ gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO BTN-Y";
|
|
+ linux,code = <BTN_WEST>;
|
|
+ };
|
|
+ sw9 {
|
|
+ gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO BTN_SELECT";
|
|
+ linux,code = <BTN_SELECT>;
|
|
+ };
|
|
+ sw10 {
|
|
+ gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO BTN_START";
|
|
+ linux,code = <BTN_START>;
|
|
+ };
|
|
+ sw11 {
|
|
+ gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO BTN_F";
|
|
+ linux,code = <BTN_MODE>;
|
|
+ };
|
|
+ sw12 {
|
|
+ gpios = <&gpio3 RK_PD0 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO BTN_TL";
|
|
+ linux,code = <BTN_TL>;
|
|
+ };
|
|
+ sw13 {
|
|
+ gpios = <&gpio3 RK_PD2 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO BTN_TR";
|
|
+ linux,code = <BTN_TR>;
|
|
+ };
|
|
+ sw14 {
|
|
+ gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO BTN_TL2";
|
|
+ linux,code = <BTN_TL2>;
|
|
+ };
|
|
+ sw15 {
|
|
+ gpios = <&gpio3 RK_PD3 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO BTN_TR2";
|
|
+ linux,code = <BTN_TR2>;
|
|
+ };
|
|
+ sw16 {
|
|
+ gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO BTN_THUMBL";
|
|
+ linux,code = <BTN_THUMBL>;
|
|
+ };
|
|
+ sw17 {
|
|
+ gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
|
|
+ label = "GPIO BTN_THUMBR";
|
|
+ linux,code = <BTN_THUMBR>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ leds: gpio-leds {
|
|
+ compatible = "gpio-leds";
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 =<&leds_gpio>;
|
|
+
|
|
+ led@1 {
|
|
+ gpios = <&gpio1 RK_PC4 GPIO_ACTIVE_HIGH>;
|
|
+ label = "battery_green";
|
|
+ default-state= "on";
|
|
+ };
|
|
+
|
|
+ led@2 {
|
|
+ gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
|
|
+ label = "battery_red";
|
|
+ };
|
|
+
|
|
+ };
|
|
+
|
|
+ es8316-sound {
|
|
+ compatible = "simple-audio-card";
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&hp_det_pin>;
|
|
+ simple-audio-card,name = "rockchip,es8316-codec";
|
|
+ simple-audio-card,format = "i2s";
|
|
+ simple-audio-card,mclk-fs = <256>;
|
|
+
|
|
+ simple-audio-card,widgets =
|
|
+ "Microphone", "Mic Jack",
|
|
+ "Headphone", "Headphones",
|
|
+ "Speaker", "Speaker";
|
|
+ simple-audio-card,routing =
|
|
+ "MIC1", "Mic Jack",
|
|
+ "Headphones", "HPOL",
|
|
+ "Headphones", "HPOR",
|
|
+ "Speaker Amplifier INL", "HPOL",
|
|
+ "Speaker Amplifier INR", "HPOR",
|
|
+ "Speaker", "Speaker Amplifier OUTL",
|
|
+ "Speaker", "Speaker Amplifier OUTR";
|
|
+
|
|
+ simple-audio-card,hp-det-gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>;
|
|
+ simple-audio-card,aux-devs = <&speaker_amp>;
|
|
+ simple-audio-card,pin-switches = "Speaker";
|
|
+
|
|
+ simple-audio-card,cpu {
|
|
+ sound-dai = <&i2s1>;
|
|
+ };
|
|
+
|
|
+ simple-audio-card,codec {
|
|
+ sound-dai = <&es8316>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ speaker_amp: speaker-amplifier {
|
|
+ compatible = "simple-audio-amplifier";
|
|
+ enable-gpios = <&gpio1 RK_PC5 GPIO_ACTIVE_HIGH>;
|
|
+ sound-name-prefix = "Speaker Amplifier";
|
|
+ VCC-supply = <&vcc5v0_sys>;
|
|
+ };
|
|
+
|
|
+ hdmi-sound {
|
|
+ status = "okay";
|
|
+ };
|
|
+
|
|
+ fan: pwm-fan {
|
|
+ compatible = "pwm-fan";
|
|
+ pwms = <&pwm1 0 10000 1>;
|
|
+ #cooling-cells = <2>;
|
|
+ cooling-levels = <80 140 200 255>;
|
|
+ fan-supply = <&vcc5v0_sys>;
|
|
+ };
|
|
+
|
|
+ backlight: backlight {
|
|
+ status = "okay";
|
|
+ compatible = "pwm-backlight";
|
|
+ pwms = <&pwm0 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 = <200>;
|
|
+ };
|
|
+
|
|
+ bat: battery {
|
|
+ compatible = "simple-battery";
|
|
+ charge-full-design-microamp-hours = <6400000>;
|
|
+ voltage-max-design-microvolt = <4350000>;
|
|
+ voltage-min-design-microvolt = <3400000>;
|
|
+ };
|
|
+
|
|
+ mains_charger: dc-charger {
|
|
+ compatible = "gpio-charger";
|
|
+ charger-type = "mains";
|
|
+ gpios = <&gpio4 RK_PD0 GPIO_ACTIVE_LOW>;
|
|
+
|
|
+ /* Also triggered by USB charger */
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&dc_det_pin>;
|
|
+ };
|
|
+
|
|
+ xin32k: xin32k {
|
|
+ compatible = "fixed-clock";
|
|
+ clock-frequency = <32768>;
|
|
+ clock-output-names = "xin32k";
|
|
+ #clock-cells = <0>;
|
|
+ };
|
|
+
|
|
+ clkin_gmac: external-gmac-clock {
|
|
+ compatible = "fixed-clock";
|
|
+ clock-frequency = <125000000>;
|
|
+ clock-output-names = "clkin_gmac";
|
|
+ #clock-cells = <0>;
|
|
+ };
|
|
+
|
|
+ vcc12v_dcin: vcc12v-dcin {
|
|
+ compatible = "regulator-fixed";
|
|
+ regulator-name = "vcc12v_dcin";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <12000000>;
|
|
+ regulator-max-microvolt = <12000000>;
|
|
+ };
|
|
+
|
|
+ vcc_sys: vcc-sys {
|
|
+ compatible = "regulator-fixed";
|
|
+ regulator-name = "vcc_sys";
|
|
+ regulator-min-microvolt = <5000000>;
|
|
+ regulator-max-microvolt = <5000000>;
|
|
+ regulator-always-on;
|
|
+ vin-supply = <&vcc12v_dcin>;
|
|
+ };
|
|
+
|
|
+ vcc3v3_sys: vcc3v3-sys {
|
|
+ compatible = "regulator-fixed";
|
|
+ regulator-name = "vcc3v3_sys";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <3300000>;
|
|
+ regulator-max-microvolt = <3300000>;
|
|
+ vin-supply = <&vcc5v0_sys>;
|
|
+ };
|
|
+
|
|
+ vcc3v0_sd: vcc3v0-sd {
|
|
+ compatible = "regulator-fixed";
|
|
+ enable-active-high;
|
|
+ gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&sdmmc0_pwr_h>;
|
|
+ regulator-name = "vcc3v0_sd";
|
|
+ regulator-always-on;
|
|
+ regulator-min-microvolt = <3000000>;
|
|
+ regulator-max-microvolt = <3000000>;
|
|
+ vin-supply = <&vcc3v3_sys>;
|
|
+
|
|
+ regulator-state-mem {
|
|
+ regulator-off-in-suspend;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vcc5v0_host: vcc5v0-host-regulator {
|
|
+ compatible = "regulator-fixed";
|
|
+ enable-active-high;
|
|
+ gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&vcc5v0_host_en>;
|
|
+ regulator-name = "vcc5v0_host";
|
|
+ regulator-always-on;
|
|
+ regulator-min-microvolt = <5000000>;
|
|
+ regulator-max-microvolt = <5000000>;
|
|
+ vin-supply = <&vcc5v0_usb>;
|
|
+ };
|
|
+
|
|
+ vcc5v0_typec: vcc5v0-typec-regulator {
|
|
+ compatible = "regulator-fixed";
|
|
+ enable-active-high;
|
|
+ gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&vcc5v0_typec_en>;
|
|
+ regulator-name = "vcc5v0_typec";
|
|
+ regulator-always-on;
|
|
+ vin-supply = <&vcc5v0_usb>;
|
|
+ };
|
|
+
|
|
+ vcc5v0_sys: vcc5v0-sys {
|
|
+ compatible = "regulator-fixed";
|
|
+ regulator-name = "vcc5v0_sys";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <5000000>;
|
|
+ regulator-max-microvolt = <5000000>;
|
|
+ vin-supply = <&vcc12v_dcin>;
|
|
+ };
|
|
+
|
|
+ vcc5v0_usb: vcc5v0-usb {
|
|
+ compatible = "regulator-fixed";
|
|
+ regulator-name = "vcc5v0_usb";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <5000000>;
|
|
+ regulator-max-microvolt = <5000000>;
|
|
+ vin-supply = <&vcc12v_dcin>;
|
|
+ };
|
|
+
|
|
+ vdd_log: vdd-log {
|
|
+ compatible = "pwm-regulator";
|
|
+ pwms = <&pwm2 0 25000 1>;
|
|
+ regulator-name = "vdd_log";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <800000>;
|
|
+ regulator-max-microvolt = <1700000>;
|
|
+ vin-supply = <&vcc5v0_sys>;
|
|
+ };
|
|
+
|
|
+ vcc5v5_lcd: vcc5v5-lcd {
|
|
+ compatible = "regulator-fixed";
|
|
+ enable-active-high;
|
|
+ gpio = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&vcc5v5_lcd_en>;
|
|
+ regulator-name = "vcc5v5_lcd";
|
|
+ regulator-min-microvolt = <5500000>;
|
|
+ regulator-max-microvolt = <5500000>;
|
|
+ vin-supply = <&vcc5v0_sys>;
|
|
+ };
|
|
+
|
|
+ vcc5v5_neg_lcd: vcc5v5-neg-lcd {
|
|
+ compatible = "regulator-fixed";
|
|
+ enable-active-high;
|
|
+ gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&vcc5v5_neg_lcd_en>;
|
|
+ regulator-name = "vcc5v5_neg_lcd";
|
|
+ /*
|
|
+ * technically negative
|
|
+ */
|
|
+ regulator-min-microvolt = <5500000>;
|
|
+ regulator-max-microvolt = <5500000>;
|
|
+ vin-supply = <&vcc5v0_sys>;
|
|
+ };
|
|
+
|
|
+ vcc_wifi: vcc-wifi-regulator {
|
|
+ compatible = "regulator-fixed";
|
|
+ enable-active-high;
|
|
+ enable-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_HIGH>;
|
|
+ gpio = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&wifi_pwr>;
|
|
+ regulator-name = "wifi_enable";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ };
|
|
+};
|
|
+
|
|
+&dmc {
|
|
+ status = "okay";
|
|
+ center-supply = <&vdd_center>;
|
|
+ operating-points-v2 = <&dmc_opp_table>;
|
|
+
|
|
+ rockchip,pd-idle-ns = <160>;
|
|
+ rockchip,sr-idle-ns = <10240>;
|
|
+ rockchip,sr-mc-gate-idle-ns = <40960>;
|
|
+ rockchip,srpd-lite-idle-ns = <61440>;
|
|
+ rockchip,standby-idle-ns = <81920>;
|
|
+
|
|
+ rockchip,lpddr4_odt_dis_freq = <666000000>;
|
|
+
|
|
+ rockchip,srpd-lite-idle-dis-freq-hz = <0>;
|
|
+ rockchip,standby-idle-dis-freq-hz = <928000000>;
|
|
+ rockchip,sr-mc-gate-idle-dis-freq-hz = <800000000>;
|
|
+ rockchip,pd-idle-dis-freq-hz = <800000000>;
|
|
+ rockchip,sr-idle-dis-freq-hz = <800000000>;
|
|
+};
|
|
+
|
|
+&dfi {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&cpu_thermal {
|
|
+ trips {
|
|
+ cpu_warm: cpu_warm {
|
|
+ temperature = <50000>;
|
|
+ hysteresis = <2000>;
|
|
+ type = "active";
|
|
+ };
|
|
+
|
|
+ cpu_hot: cpu_hot {
|
|
+ temperature = <55000>;
|
|
+ hysteresis = <2000>;
|
|
+ type = "active";
|
|
+ };
|
|
+
|
|
+ cpu_scalding: cpu_scalding {
|
|
+ temperature = <65000>;
|
|
+ hysteresis = <5000>;
|
|
+ type = "active";
|
|
+ };
|
|
+ };
|
|
+
|
|
+ cooling-maps {
|
|
+ map1 {
|
|
+ trip = <&cpu_warm>;
|
|
+ cooling-device = <&fan THERMAL_NO_LIMIT 1>;
|
|
+ };
|
|
+
|
|
+ map2 {
|
|
+ trip = <&cpu_hot>;
|
|
+ cooling-device = <&fan THERMAL_NO_LIMIT 1>;
|
|
+ };
|
|
+
|
|
+ map3 {
|
|
+ trip = <&cpu_scalding>;
|
|
+ cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
|
|
+ };
|
|
+ };
|
|
+};
|
|
+
|
|
+&cpu_l0 {
|
|
+ cpu-supply = <&vdd_cpu_l>;
|
|
+};
|
|
+
|
|
+&cpu_l1 {
|
|
+ cpu-supply = <&vdd_cpu_l>;
|
|
+};
|
|
+
|
|
+&cpu_l2 {
|
|
+ cpu-supply = <&vdd_cpu_l>;
|
|
+};
|
|
+
|
|
+&cpu_l3 {
|
|
+ cpu-supply = <&vdd_cpu_l>;
|
|
+};
|
|
+
|
|
+&cpu_b0 {
|
|
+ cpu-supply = <&vdd_cpu_b>;
|
|
+};
|
|
+
|
|
+&cpu_b1 {
|
|
+ cpu-supply = <&vdd_cpu_b>;
|
|
+};
|
|
+
|
|
+&saradc {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&sdio0 {
|
|
+ clock-frequency = <150000000>;
|
|
+ clock-freq-min-max = <100000 150000000>;
|
|
+ supports-sd;
|
|
+ no-sdio;
|
|
+ bus-width = <4>;
|
|
+ disable-wp;
|
|
+ cap-sd-highspeed;
|
|
+ cap-sdio-irq;
|
|
+ keep-power-in-suspend;
|
|
+ card-detect-delay = <800>;
|
|
+ cd-gpios = <&gpio2 RK_PC1 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/
|
|
+ num-slots = <1>;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&sdio0_clk &sdio0_cmd &sdio0_cd &sdio0_bus4>;
|
|
+ sd-uhs-sdr104;
|
|
+ vqmmc-supply = <&vcc3v0_touch>;
|
|
+ //vqmmc-supply = <&vcc_sdio>;
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&sdmmc {
|
|
+ bus-width = <4>;
|
|
+ cap-sd-highspeed;
|
|
+ cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
|
|
+ disable-wp;
|
|
+ max-frequency = <150000000>;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>;
|
|
+ vmmc-supply = <&vcc3v0_sd>;
|
|
+ vqmmc-supply = <&vcc_sdio>;
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&emmc_phy {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&gpu {
|
|
+ mali-supply = <&vdd_gpu>;
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&pwm0 {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&pwm1 {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&pwm2 {
|
|
+ status = "okay";
|
|
+ pinctrl-names = "active";
|
|
+ pinctrl-0 = <&pwm2_pin_pull_down>;
|
|
+};
|
|
+
|
|
+&pwm3 {
|
|
+ status = "okay";
|
|
+ label = "rumble-pwm";
|
|
+};
|
|
+
|
|
+&saradc {
|
|
+ vref-supply = <&vcc_1v8>;
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&sdhci {
|
|
+ assigned-clock-rates = <150000000>;
|
|
+
|
|
+ bus-width = <8>;
|
|
+ mmc-hs400-1_8v;
|
|
+ mmc-hs400-enhanced-strobe;
|
|
+ non-removable;
|
|
+
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&hdmi {
|
|
+ ddc-i2c-bus = <&i2c3>;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&hdmi_cec>;
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&mipi_dsi {
|
|
+ status = "okay";
|
|
+ clock-master;
|
|
+
|
|
+ ports {
|
|
+ mipi_out: port@1 {
|
|
+ #address-cells = <0>;
|
|
+ #size-cells = <0>;
|
|
+ reg = <1>;
|
|
+
|
|
+ mipi_out_panel: endpoint {
|
|
+ remote-endpoint = <&mipi_in_panel>;
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+
|
|
+ panel@0 {
|
|
+ reg = <0>;
|
|
+ compatible = "sharp,ls054b3sx01";
|
|
+ backlight = <&backlight>;
|
|
+ rotation = <270>;
|
|
+
|
|
+ iovcc-supply = <&vcc1v8_dvp>;
|
|
+ vsp-supply = <&vcc5v5_lcd>;
|
|
+ vsn-supply = <&vcc5v5_neg_lcd>;
|
|
+
|
|
+ reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_HIGH>;
|
|
+
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&lcd_reset_gpio>;
|
|
+
|
|
+ port {
|
|
+ mipi_in_panel: endpoint {
|
|
+ remote-endpoint = <&mipi_out_panel>;
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+};
|
|
+
|
|
+&i2c0 {
|
|
+ clock-frequency = <400000>;
|
|
+ i2c-scl-rising-time-ns = <168>;
|
|
+ i2c-scl-falling-time-ns = <4>;
|
|
+ status = "okay";
|
|
+
|
|
+ rk808: pmic@1b {
|
|
+ compatible = "rockchip,rk808";
|
|
+ reg = <0x1b>;
|
|
+ interrupt-parent = <&gpio3>;
|
|
+ interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
|
|
+ #clock-cells = <1>;
|
|
+ clock-output-names = "rk808-clkout1", "rk808-clkout2";
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&pmic_int_l>;
|
|
+ rockchip,system-power-controller;
|
|
+ wakeup-source;
|
|
+
|
|
+ vcc1-supply = <&vcc5v0_sys>;
|
|
+ vcc2-supply = <&vcc5v0_sys>;
|
|
+ vcc3-supply = <&vcc5v0_sys>;
|
|
+ vcc4-supply = <&vcc5v0_sys>;
|
|
+ vcc6-supply = <&vcc5v0_sys>;
|
|
+ vcc7-supply = <&vcc5v0_sys>;
|
|
+ vcc8-supply = <&vcc3v3_sys>;
|
|
+ vcc9-supply = <&vcc5v0_sys>;
|
|
+ vcc10-supply = <&vcc5v0_sys>;
|
|
+ vcc11-supply = <&vcc5v0_sys>;
|
|
+ vcc12-supply = <&vcc3v3_sys>;
|
|
+ vddio-supply = <&vcca_1v8>;
|
|
+
|
|
+ rtc {
|
|
+ status = "okay";
|
|
+ };
|
|
+
|
|
+ regulators {
|
|
+ vdd_center: DCDC_REG1 {
|
|
+ regulator-name = "vdd_center";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <900000>;
|
|
+ regulator-max-microvolt = <900000>;
|
|
+ regulator-ramp-delay = <6001>;
|
|
+ regulator-state-mem {
|
|
+ regulator-off-in-suspend;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vdd_cpu_l: DCDC_REG2 {
|
|
+ regulator-name = "vdd_cpu_l";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <750000>;
|
|
+ regulator-max-microvolt = <1350000>;
|
|
+ regulator-ramp-delay = <6001>;
|
|
+ regulator-state-mem {
|
|
+ regulator-off-in-suspend;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vcc_ddr: DCDC_REG3 {
|
|
+ regulator-name = "vcc_ddr";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-state-mem {
|
|
+ regulator-on-in-suspend;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vcc_1v8: DCDC_REG4 {
|
|
+ regulator-name = "vcc_1v8";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <1800000>;
|
|
+ regulator-max-microvolt = <1800000>;
|
|
+ regulator-state-mem {
|
|
+ regulator-on-in-suspend;
|
|
+ regulator-suspend-microvolt = <1800000>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vcc1v8_dvp: LDO_REG1 {
|
|
+ regulator-name = "vcc1v8_dvp";
|
|
+ regulator-min-microvolt = <1800000>;
|
|
+ regulator-max-microvolt = <1800000>;
|
|
+ regulator-state-mem {
|
|
+ regulator-off-in-suspend;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vcc3v0_touch: LDO_REG2 {
|
|
+ regulator-name = "vcc3v0_touch";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <1800000>;
|
|
+ regulator-max-microvolt = <3300000>;
|
|
+ regulator-state-mem {
|
|
+ regulator-off-in-suspend;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vcca_1v8: LDO_REG3 {
|
|
+ regulator-name = "vcca_1v8";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <1800000>;
|
|
+ regulator-max-microvolt = <1800000>;
|
|
+ regulator-state-mem {
|
|
+ regulator-on-in-suspend;
|
|
+ regulator-suspend-microvolt = <1800000>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vcc_sdio: LDO_REG4 {
|
|
+ regulator-name = "vcc_sdio";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <1800000>;
|
|
+ regulator-max-microvolt = <3300000>;
|
|
+ regulator-state-mem {
|
|
+ regulator-on-in-suspend;
|
|
+ regulator-suspend-microvolt = <3300000>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vcca3v0_codec: LDO_REG5 {
|
|
+ regulator-name = "vcca3v0_codec";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <3000000>;
|
|
+ regulator-max-microvolt = <3000000>;
|
|
+ regulator-state-mem {
|
|
+ regulator-off-in-suspend;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vcc_1v5: LDO_REG6 {
|
|
+ regulator-name = "vcc_1v5";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <1500000>;
|
|
+ regulator-max-microvolt = <1500000>;
|
|
+ regulator-state-mem {
|
|
+ regulator-on-in-suspend;
|
|
+ regulator-suspend-microvolt = <1500000>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vcca1v8_codec: LDO_REG7 {
|
|
+ regulator-name = "vcca1v8_codec";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <1800000>;
|
|
+ regulator-max-microvolt = <1800000>;
|
|
+ regulator-state-mem {
|
|
+ regulator-off-in-suspend;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vcc_3v0: LDO_REG8 {
|
|
+ regulator-name = "vcc_3v0";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-min-microvolt = <3000000>;
|
|
+ regulator-max-microvolt = <3000000>;
|
|
+ regulator-state-mem {
|
|
+ regulator-on-in-suspend;
|
|
+ regulator-suspend-microvolt = <3000000>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vcc3v3_s3: vcc_lan: SWITCH_REG1 {
|
|
+ regulator-name = "vcc3v3_s3";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-state-mem {
|
|
+ regulator-off-in-suspend;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vcc3v3_s0: SWITCH_REG2 {
|
|
+ regulator-name = "vcc3v3_s0";
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ regulator-state-mem {
|
|
+ regulator-off-in-suspend;
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vdd_cpu_b: regulator@40 {
|
|
+ compatible = "silergy,syr827";
|
|
+ reg = <0x40>;
|
|
+ fcs,suspend-voltage-selector = <1>;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&vsel1_pin>;
|
|
+ regulator-name = "vdd_cpu_b";
|
|
+ regulator-min-microvolt = <712500>;
|
|
+ regulator-max-microvolt = <1500000>;
|
|
+ regulator-ramp-delay = <1000>;
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ vin-supply = <&vcc5v0_sys>;
|
|
+
|
|
+ regulator-state-mem {
|
|
+ regulator-off-in-suspend;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ vdd_gpu: regulator@41 {
|
|
+ compatible = "silergy,syr828";
|
|
+ reg = <0x41>;
|
|
+ fcs,suspend-voltage-selector = <1>;
|
|
+ vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&vsel2_pin>;
|
|
+ regulator-name = "vdd_gpu";
|
|
+ regulator-min-microvolt = <712500>;
|
|
+ regulator-max-microvolt = <1500000>;
|
|
+ regulator-ramp-delay = <1000>;
|
|
+ regulator-always-on;
|
|
+ regulator-boot-on;
|
|
+ vin-supply = <&vcc5v0_sys>;
|
|
+
|
|
+ regulator-state-mem {
|
|
+ regulator-off-in-suspend;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ cw2015@62 {
|
|
+ compatible = "cellwise,cw2015";
|
|
+ reg = <0x62>;
|
|
+ cellwise,battery-profile = /bits/ 8 <
|
|
+ 0x15 0x7E 0x66 0x5B 0x58 0x55 0x51 0x4D
|
|
+ 0x4A 0x47 0x44 0x47 0x4D 0x46 0x32 0x27
|
|
+ 0x1F 0x1A 0x15 0x16 0x21 0x30 0x3F 0x4A
|
|
+ 0x46 0x5C 0x0C 0x29 0x19 0x31 0x59 0x74
|
|
+ 0x7B 0x7D 0x81 0x82 0x3F 0x1A 0x58 0x22
|
|
+ 0x06 0x42 0x2B 0x63 0x89 0x93 0x94 0x3C
|
|
+ 0x57 0x7D 0x93 0xAE 0x80 0xC2 0xD2 0xCB
|
|
+ 0x2F 0x00 0x64 0xA5 0xB5 0x1F 0xB0 0x11
|
|
+ >;
|
|
+ cellwise,monitor-interval-ms = <5000>;
|
|
+ monitored-battery = <&bat>;
|
|
+ power-supplies = <&mains_charger>, <&fusb0>;
|
|
+ };
|
|
+
|
|
+};
|
|
+
|
|
+&i2c1 {
|
|
+ clock-frequency = <100000>;
|
|
+ i2c-scl-rising-time-ns = <168>;
|
|
+ i2c-scl-falling-time-ns = <4>;
|
|
+ status = "okay";
|
|
+
|
|
+ es8316: es8316@11 {
|
|
+ compatible = "everest,es8316";
|
|
+ reg = <0x11>;
|
|
+ clocks = <&cru SCLK_I2S_8CH_OUT>;
|
|
+ clock-names = "mclk";
|
|
+ #sound-dai-cells = <0>;
|
|
+ };
|
|
+};
|
|
+
|
|
+&i2c3 {
|
|
+ i2c-scl-rising-time-ns = <450>;
|
|
+ i2c-scl-falling-time-ns = <15>;
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&i2c4 {
|
|
+ i2c-scl-rising-time-ns = <600>;
|
|
+ i2c-scl-falling-time-ns = <20>;
|
|
+ status = "okay";
|
|
+
|
|
+ gt9xx: gt9xx@14 {
|
|
+ compatible = "goodix,gt927";
|
|
+ reg = <0x14>;
|
|
+ irq-gpios = <&gpio3 RK_PD7 GPIO_ACTIVE_HIGH>;
|
|
+ reset-gpios = <&gpio3 RK_PD6 GPIO_ACTIVE_HIGH>;
|
|
+ touchscreen-size-x = <1152>;
|
|
+ touchscreen-size-y = <1920>;
|
|
+ touchscreen-inverted-x;
|
|
+ touchscreen-inverted-y;
|
|
+ interrupt-parent = <&gpio3>;
|
|
+ interrupts = <RK_PD7 IRQ_TYPE_EDGE_FALLING>;
|
|
+ AVDD28-supply = <&vcc3v0_touch>;
|
|
+ VDDIO-supply = <&vcc3v0_touch>;
|
|
+ };
|
|
+
|
|
+ fusb0: typec-portc@22 {
|
|
+ compatible = "fcs,fusb302";
|
|
+ status = "okay";
|
|
+ reg = <0x22>;
|
|
+ interrupt-parent = <&gpio1>;
|
|
+ interrupts = <RK_PA2 IRQ_TYPE_LEVEL_LOW>;
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&fusb0_int>;
|
|
+ vbus-supply = <&vcc5v0_typec>;
|
|
+
|
|
+ connector {
|
|
+ compatible = "usb-c-connector";
|
|
+ data-role = "dual";
|
|
+ label = "USB-C";
|
|
+ op-sink-microwatt = <1000000>;
|
|
+ power-role = "dual";
|
|
+ sink-pdos =
|
|
+ <PDO_FIXED(5000, 2500, PDO_FIXED_USB_COMM)>;
|
|
+ source-pdos =
|
|
+ <PDO_FIXED(5000, 1400, PDO_FIXED_USB_COMM)>;
|
|
+ try-power-role = "sink";
|
|
+
|
|
+ ports {
|
|
+ #address-cells = <1>;
|
|
+ #size-cells = <0>;
|
|
+
|
|
+ port@0 {
|
|
+ reg = <0>;
|
|
+
|
|
+ usbc_hs: endpoint {
|
|
+ remote-endpoint = <&u2phy0_typec_hs>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ port@1 {
|
|
+ reg = <1>;
|
|
+
|
|
+ usbc_ss: endpoint {
|
|
+ remote-endpoint = <&tcphy0_typec_ss>;
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+};
|
|
+
|
|
+&i2s1 {
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&i2s_8ch_mclk_pin>, <&i2s1_2ch_bus>;
|
|
+ rockchip,capture-channels = <8>;
|
|
+ rockchip,playback-channels = <8>;
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&i2s2 {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&io_domains {
|
|
+ status = "okay";
|
|
+
|
|
+ bt656-supply = <&vcc1v8_dvp>;
|
|
+ audio-supply = <&vcca3v0_codec>;
|
|
+ sdmmc-supply = <&vcc_sdio>;
|
|
+ gpio1830-supply = <&vcc_3v0>;
|
|
+};
|
|
+
|
|
+&pmu_io_domains {
|
|
+ pmu1830-supply = <&vcc_3v0>;
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&pinctrl {
|
|
+ dc-charger {
|
|
+ dc_det_pin: dc-det-pin {
|
|
+ rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ es8316 {
|
|
+ hp_det_pin: hp-det-pin {
|
|
+ rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ i2s1 {
|
|
+ i2s_8ch_mclk_pin: i2s-8ch-mclk-pin {
|
|
+ rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ fusb302x {
|
|
+ fusb0_int: fusb0-int {
|
|
+ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ pmic {
|
|
+ pmic_int_l: pmic-int-l {
|
|
+ rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
|
|
+ };
|
|
+
|
|
+ vsel1_pin: vsel1-pin {
|
|
+ rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
|
|
+ };
|
|
+
|
|
+ vsel2_pin: vsel2-pin {
|
|
+ rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ sdcard {
|
|
+ sdmmc0_pwr_h: sdmmc0-pwr-h {
|
|
+ rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
|
|
+ };
|
|
+
|
|
+ };
|
|
+
|
|
+ usb-typec {
|
|
+ vcc5v0_typec_en: vcc5v0_typec_en {
|
|
+ rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ usb2 {
|
|
+ vcc5v0_host_en: vcc5v0-host-en {
|
|
+ rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ gpio-leds {
|
|
+ leds_gpio: leds-gpio {
|
|
+ rockchip,pins =
|
|
+ <1 RK_PC4 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_up>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ lcd-panel {
|
|
+ lcd_reset_gpio: lcd-reset-gpio {
|
|
+ rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
|
|
+ };
|
|
+
|
|
+ vcc5v5_lcd_en: vcc5v5-lcd-en {
|
|
+ rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
|
|
+ };
|
|
+
|
|
+ vcc5v5_neg_lcd_en: vcc5v5-neg-lcd-en {
|
|
+ rockchip,pins = <0 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ wifi {
|
|
+ wifi_pwr: wifi-pwr {
|
|
+ rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
|
|
+ };
|
|
+ };
|
|
+
|
|
+ btns {
|
|
+ btn_pins: btn-pins {
|
|
+ rockchip,pins =
|
|
+ <3 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_up>;
|
|
+ };
|
|
+ vol_pwr_btn: vol-pwr-btn {
|
|
+ rockchip,pins =
|
|
+ <3 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>,
|
|
+ <3 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>;
|
|
+ };
|
|
+ pwr_btn: pwr-btn {
|
|
+ rockchip,pins =
|
|
+ <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
|
|
+ };
|
|
+ };
|
|
+};
|
|
+
|
|
+&tcphy0 {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&tcphy0_usb3 {
|
|
+ port {
|
|
+ tcphy0_typec_ss: endpoint {
|
|
+ remote-endpoint = <&usbc_ss>;
|
|
+ };
|
|
+ };
|
|
+};
|
|
+
|
|
+&tcphy1 {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&tsadc {
|
|
+ /* tshut mode 0:CRU 1:GPIO */
|
|
+ rockchip,hw-tshut-mode = <1>;
|
|
+ /* tshut polarity 0:LOW 1:HIGH */
|
|
+ rockchip,hw-tshut-polarity = <1>;
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&u2phy0 {
|
|
+ status = "okay";
|
|
+
|
|
+ u2phy0_otg: otg-port {
|
|
+ status = "okay";
|
|
+ };
|
|
+
|
|
+ u2phy0_host: host-port {
|
|
+ phy-supply = <&vcc5v0_host>;
|
|
+ status = "okay";
|
|
+ };
|
|
+
|
|
+ port {
|
|
+ u2phy0_typec_hs: endpoint {
|
|
+ remote-endpoint = <&usbc_hs>;
|
|
+ };
|
|
+ };
|
|
+};
|
|
+
|
|
+&u2phy1 {
|
|
+ status = "okay";
|
|
+
|
|
+ u2phy1_otg: otg-port {
|
|
+ status = "okay";
|
|
+ };
|
|
+
|
|
+ u2phy1_host: host-port {
|
|
+ phy-supply = <&vcc5v0_host>;
|
|
+ status = "okay";
|
|
+ };
|
|
+};
|
|
+
|
|
+&uart0 {
|
|
+ pinctrl-names = "default";
|
|
+ pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&uart2 {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&usb_host0_ehci {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&usb_host0_ohci {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&usb_host1_ehci {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&usb_host1_ohci {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&usbdrd3_0 {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&usbdrd_dwc3_0 {
|
|
+ status = "okay";
|
|
+ dr_mode = "host";
|
|
+};
|
|
+
|
|
+&usbdrd3_1 {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&usbdrd_dwc3_1 {
|
|
+ status = "okay";
|
|
+ dr_mode = "host";
|
|
+};
|
|
+
|
|
+&vopb {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&vopb_mmu {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&vopl {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&vopl_mmu {
|
|
+ status = "okay";
|
|
+};
|
|
diff -rupN linux.orig/arch/arm64/boot/dts/rockchip/rk3399.dtsi linux/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
|
--- linux.orig/arch/arm64/boot/dts/rockchip/rk3399.dtsi 2023-06-23 03:53:36.256094988 +0000
|
|
+++ linux/arch/arm64/boot/dts/rockchip/rk3399.dtsi 2023-07-24 20:00:14.430068009 +0000
|
|
@@ -1469,7 +1469,7 @@
|
|
<1000000000>,
|
|
<150000000>, <75000000>,
|
|
<37500000>,
|
|
- <100000000>, <100000000>,
|
|
+ <300000000>, <100000000>,
|
|
<50000000>, <600000000>,
|
|
<100000000>, <50000000>,
|
|
<400000000>, <400000000>,
|
|
diff -rupN linux.orig/drivers/gpio/gpio-rockchip.c linux/drivers/gpio/gpio-rockchip.c
|
|
--- linux.orig/drivers/gpio/gpio-rockchip.c 2023-07-16 19:38:02.962868756 +0000
|
|
+++ linux/drivers/gpio/gpio-rockchip.c 2023-07-22 17:35:57.766955315 +0000
|
|
@@ -335,13 +335,13 @@ static void rockchip_irq_demux(struct ir
|
|
unsigned long pending;
|
|
unsigned int irq;
|
|
|
|
- dev_dbg(bank->dev, "got irq for bank %s\n", bank->name);
|
|
+ //dev_dbg(bank->dev, "got irq for bank %s\n", bank->name);
|
|
|
|
chained_irq_enter(chip, desc);
|
|
|
|
pending = readl_relaxed(bank->reg_base + bank->gpio_regs->int_status);
|
|
for_each_set_bit(irq, &pending, 32) {
|
|
- dev_dbg(bank->dev, "handling irq %d\n", irq);
|
|
+ //dev_dbg(bank->dev, "handling irq %d\n", irq);
|
|
|
|
/*
|
|
* Triggering IRQ on both rising and falling edge
|
|
diff -rupN linux.orig/drivers/gpu/drm/panel/Kconfig linux/drivers/gpu/drm/panel/Kconfig
|
|
--- linux.orig/drivers/gpu/drm/panel/Kconfig 2023-06-23 03:53:39.968155272 +0000
|
|
+++ linux/drivers/gpu/drm/panel/Kconfig 2023-07-25 05:54:31.139292676 +0000
|
|
@@ -588,6 +588,15 @@ config DRM_PANEL_SHARP_LS043T1LE01
|
|
Say Y here if you want to enable support for Sharp LS043T1LE01 qHD
|
|
(540x960) DSI panel as found on the Qualcomm APQ8074 Dragonboard
|
|
|
|
+config DRM_PANEL_SHARP_LS054B3SX01
|
|
+ bool "Sharp LS054B3SX01 1152x1920 video mode panel"
|
|
+ depends on OF
|
|
+ depends on DRM_MIPI_DSI
|
|
+ depends on BACKLIGHT_CLASS_DEVICE
|
|
+ help
|
|
+ say Y here if you want to enable support for Sharp LS054B3SX01
|
|
+ 1152x1920 panel as found in Anbernic RG552.
|
|
+
|
|
config DRM_PANEL_SHARP_LS060T1SX01
|
|
tristate "Sharp LS060T1SX01 FullHD video mode panel"
|
|
depends on OF
|
|
diff -rupN linux.orig/drivers/gpu/drm/panel/Makefile linux/drivers/gpu/drm/panel/Makefile
|
|
--- linux.orig/drivers/gpu/drm/panel/Makefile 2023-06-23 03:53:39.968155272 +0000
|
|
+++ linux/drivers/gpu/drm/panel/Makefile 2023-07-22 17:35:58.626982361 +0000
|
|
@@ -59,6 +59,7 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) +=
|
|
obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
|
|
obj-$(CONFIG_DRM_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o
|
|
obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o
|
|
+obj-$(CONFIG_DRM_PANEL_SHARP_LS054B3SX01) += panel-sharp-ls054b3sx01.o
|
|
obj-$(CONFIG_DRM_PANEL_SHARP_LS060T1SX01) += panel-sharp-ls060t1sx01.o
|
|
obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7701) += panel-sitronix-st7701.o
|
|
obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7703) += panel-sitronix-st7703.o
|
|
diff -rupN linux.orig/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c linux/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c
|
|
--- linux.orig/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c 1970-01-01 00:00:00.000000000 +0000
|
|
+++ linux/drivers/gpu/drm/panel/panel-sharp-ls054b3sx01.c 2023-07-25 14:36:58.284854285 +0000
|
|
@@ -0,0 +1,360 @@
|
|
+// SPDX-License-Identifier: GPL-2.0-only
|
|
+/*
|
|
+ * Copyright (c) 2022 Maya Matuszczyk <maccraft123mc@gmail.com>
|
|
+ */
|
|
+
|
|
+#include <linux/delay.h>
|
|
+#include <linux/gpio/consumer.h>
|
|
+#include <linux/module.h>
|
|
+#include <linux/of.h>
|
|
+#include <linux/regulator/consumer.h>
|
|
+
|
|
+#include <video/mipi_display.h>
|
|
+
|
|
+#include <drm/drm_mipi_dsi.h>
|
|
+#include <drm/drm_modes.h>
|
|
+#include <drm/drm_panel.h>
|
|
+
|
|
+struct sharp_ls054 {
|
|
+ struct drm_panel panel;
|
|
+ struct mipi_dsi_device *dsi;
|
|
+ struct regulator *iovcc_supply;
|
|
+ struct regulator *vsp_supply;
|
|
+ struct regulator *vsn_supply;
|
|
+ struct gpio_desc *reset_gpio;
|
|
+ enum drm_panel_orientation orientation;
|
|
+ bool prepared;
|
|
+};
|
|
+
|
|
+static inline struct sharp_ls054 *to_sharp_ls054(struct drm_panel *panel)
|
|
+{
|
|
+ return container_of(panel, struct sharp_ls054, panel);
|
|
+}
|
|
+
|
|
+#define dsi_dcs_write_seq(dsi, cmd, seq...) do { \
|
|
+ static const u8 b[] = { cmd, seq }; \
|
|
+ int ret; \
|
|
+ ret = mipi_dsi_dcs_write_buffer(dsi, b, ARRAY_SIZE(b)); \
|
|
+ if (ret < 0) \
|
|
+ return ret; \
|
|
+ } while (0)
|
|
+
|
|
+#define SHARP_LS054_SETEXTC 0xB9
|
|
+#define SHARP_LS054_SETSEQUENCE 0xB0
|
|
+#define SHARP_LS054_SETGAMMACURVE 0xE0
|
|
+#define SHARP_LS054_SETPOWER 0xB1
|
|
+#define SHARP_LS054_SETVREF 0xD2
|
|
+#define SHARP_LS054_SETGIP0 0xD3
|
|
+#define SHARP_LS054_SETGIP1 0xD5
|
|
+#define SHARP_LS054_SETGIP2 0xD6
|
|
+#define SHARP_LS054_SETGIP3 0xD8
|
|
+#define SHARP_LS054_SETDISP 0xB2
|
|
+#define SHARP_LS054_SETCYC 0xB4
|
|
+#define SHARP_LS054_SETMIPI 0xBA
|
|
+#define SHARP_LS054_SETPTBA 0xBF
|
|
+
|
|
+static int sharp_ls054_init_sequence(struct sharp_ls054 *ctx)
|
|
+{
|
|
+ struct mipi_dsi_device *dsi = ctx->dsi;
|
|
+ int ret;
|
|
+
|
|
+ dsi_dcs_write_seq(dsi, SHARP_LS054_SETEXTC,
|
|
+ 0xFF, 0x83, 0x99);
|
|
+ //dsi_dcs_write_seq(dsi, SHARP_LS054_SETSEQUENCE,
|
|
+ // 0x00, 0x00, 0x65);
|
|
+ dsi_dcs_write_seq(dsi, SHARP_LS054_SETGAMMACURVE,
|
|
+ 0x01, 0x13, 0x17, 0x34, 0x38, 0x3E, 0x2C, 0x47,
|
|
+ 0x07, 0x0C, 0x0F, 0x12, 0x14, 0x11, 0x13, 0x12,
|
|
+ 0x18, 0x0B, 0x17, 0x07, 0x13, 0x02, 0x14, 0x18,
|
|
+ 0x32, 0x37, 0x3D, 0x29, 0x43, 0x07, 0x0E, 0x0C,
|
|
+ 0x0F, 0x11, 0x10, 0x12, 0x12, 0x18, 0x0C, 0x17,
|
|
+ 0x07, 0x13);
|
|
+ dsi_dcs_write_seq(dsi, SHARP_LS054_SETPOWER,
|
|
+ 0x00, 0x7C, 0x38, 0x35, 0x99, 0x09, 0x22, 0x22,
|
|
+ 0x72, 0xF2, 0x68, 0x58);
|
|
+ dsi_dcs_write_seq(dsi, SHARP_LS054_SETVREF,
|
|
+ 0x99);
|
|
+ dsi_dcs_write_seq(dsi, SHARP_LS054_SETGIP0,
|
|
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00,
|
|
+ 0x10, 0x05, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
|
|
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07,
|
|
+ 0x07, 0x03, 0x00, 0x00, 0x00, 0x05, 0x08);
|
|
+ dsi_dcs_write_seq(dsi, SHARP_LS054_SETGIP1,
|
|
+ 0x00, 0x00, 0x01, 0x00, 0x03, 0x02, 0x00, 0x00,
|
|
+ 0x00, 0x00, 0x19, 0x00, 0x18, 0x00, 0x21, 0x20,
|
|
+ 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
+ 0x00, 0x00, 0x32, 0x32, 0x31, 0x31, 0x30, 0x30);
|
|
+ dsi_dcs_write_seq(dsi, SHARP_LS054_SETGIP2,
|
|
+ 0x40, 0x40, 0x02, 0x03, 0x00, 0x01, 0x40, 0x40,
|
|
+ 0x40, 0x40, 0x18, 0x40, 0x19, 0x40, 0x20, 0x21,
|
|
+ 0x40, 0x18, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
|
|
+ 0x40, 0x40, 0x32, 0x32, 0x31, 0x31, 0x30, 0x30);
|
|
+ dsi_dcs_write_seq(dsi, SHARP_LS054_SETGIP3,
|
|
+ 0x28, 0x2A, 0x00, 0x2A, 0x28, 0x02, 0xC0, 0x2A,
|
|
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
+ 0x28, 0x02, 0x00, 0x2A, 0x28, 0x02, 0xC0, 0x2A);
|
|
+ dsi_dcs_write_seq(dsi, SHARP_LS054_SETDISP,
|
|
+ 0x00, 0x80, 0x10, 0x7F, 0x05, 0x01, 0x23, 0x4D,
|
|
+ 0x21, 0x01);
|
|
+ dsi_dcs_write_seq(dsi, SHARP_LS054_SETCYC,
|
|
+ 0x00, 0x3F, 0x00, 0x41, 0x00, 0x3D, 0x00, 0x00,
|
|
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x0F, 0x01, 0x02,
|
|
+ 0x05, 0x40, 0x00, 0x00, 0x3A, 0x00, 0x41, 0x00,
|
|
+ 0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
|
|
+ 0x0F, 0x01, 0x02, 0x05, 0x00, 0x00, 0x00, 0x3A);
|
|
+ dsi_dcs_write_seq(dsi, SHARP_LS054_SETMIPI,
|
|
+ 0x03, 0x82, 0xA0, 0xE5);
|
|
+
|
|
+ ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
|
|
+ if (ret < 0)
|
|
+ {
|
|
+ dev_err(&dsi->dev, "Failed to exit sleep mode: %d\n", ret);
|
|
+ return ret;
|
|
+ }
|
|
+ msleep(130);
|
|
+
|
|
+ dsi_dcs_write_seq(dsi, 0x29);
|
|
+ ret = mipi_dsi_dcs_set_display_on(dsi);
|
|
+ if (ret < 0)
|
|
+ {
|
|
+ dev_err(&dsi->dev, "Failed to set display on: %d\n", ret);
|
|
+ return ret;
|
|
+ }
|
|
+ msleep(50);
|
|
+
|
|
+ mipi_dsi_dcs_set_display_brightness(dsi, 0xFF);
|
|
+ dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00);
|
|
+ dsi_dcs_write_seq(dsi, 0x53, 0x24); //MIPI_DCS_WRITE_CONTROL_DISPLAY ?
|
|
+ mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static int sharp_ls054_prepare(struct drm_panel *panel)
|
|
+{
|
|
+ struct sharp_ls054 *ctx = to_sharp_ls054(panel);
|
|
+ struct mipi_dsi_device *dsi = ctx->dsi;
|
|
+ struct device *dev = &ctx->dsi->dev;
|
|
+ int ret;
|
|
+
|
|
+ if (ctx->prepared)
|
|
+ return 0;
|
|
+
|
|
+ gpiod_set_value_cansleep(ctx->reset_gpio, 0);
|
|
+
|
|
+ ret = regulator_enable(ctx->iovcc_supply);
|
|
+ if (ret < 0)
|
|
+ return ret;
|
|
+
|
|
+ usleep_range(1500, 3000);
|
|
+
|
|
+ ret = regulator_enable(ctx->vsp_supply);
|
|
+ if (ret < 0)
|
|
+ goto err_vsp;
|
|
+
|
|
+ usleep_range(1500, 3000);
|
|
+
|
|
+ ret = regulator_enable(ctx->vsn_supply);
|
|
+ if (ret < 0)
|
|
+ goto err_on;
|
|
+
|
|
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
|
|
+
|
|
+ msleep(200);
|
|
+
|
|
+ ret = sharp_ls054_init_sequence(ctx);
|
|
+ if (ret < 0) {
|
|
+ dev_err(dev, "Failed to initialize panel: %d\n", ret);
|
|
+ goto err_on;
|
|
+ }
|
|
+
|
|
+ ctx->prepared = true;
|
|
+
|
|
+ return 0;
|
|
+
|
|
+err_on:
|
|
+ regulator_disable(ctx->vsn_supply);
|
|
+
|
|
+err_vsp:
|
|
+ regulator_disable(ctx->vsp_supply);
|
|
+
|
|
+err_iovcc:
|
|
+ regulator_disable(ctx->iovcc_supply);
|
|
+ gpiod_set_value_cansleep(ctx->reset_gpio, 0);
|
|
+
|
|
+ return ret;
|
|
+}
|
|
+
|
|
+static int sharp_ls054_unprepare(struct drm_panel *panel)
|
|
+{
|
|
+ struct sharp_ls054 *ctx = to_sharp_ls054(panel);
|
|
+ struct mipi_dsi_device *dsi = ctx->dsi;
|
|
+ struct device *dev = &ctx->dsi->dev;
|
|
+ int ret;
|
|
+
|
|
+ if (!ctx->prepared)
|
|
+ return 0;
|
|
+
|
|
+ ret = mipi_dsi_dcs_set_display_off(dsi);
|
|
+ if (ret < 0) {
|
|
+ dev_err(dev, "Failed to set display off: %d\n", ret);
|
|
+ return ret;
|
|
+ }
|
|
+ usleep_range(2000, 3000);
|
|
+
|
|
+ ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
|
|
+ if (ret < 0) {
|
|
+ dev_err(dev, "Failed to enter sleep mode: %d\n", ret);
|
|
+ return ret;
|
|
+ }
|
|
+ msleep(5);
|
|
+
|
|
+ gpiod_set_value_cansleep(ctx->reset_gpio, 0);
|
|
+
|
|
+ usleep_range(500, 1000);
|
|
+ regulator_disable(ctx->vsn_supply);
|
|
+ usleep_range(500, 1000);
|
|
+ regulator_disable(ctx->vsp_supply);
|
|
+ usleep_range(500, 1000);
|
|
+ regulator_disable(ctx->iovcc_supply);
|
|
+
|
|
+ ctx->prepared = false;
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static const struct drm_display_mode sharp_ls054_mode = {
|
|
+ .clock = ((1152 + 64 + 4 + 32) * (1920 + 56 + 3 + 6) * 60) / 1000,
|
|
+ .hdisplay = 1152,
|
|
+ .hsync_start = 1152 + 64,
|
|
+ .hsync_end = 1152 + 64 + 4,
|
|
+ .htotal = 1152 + 64 + 4 + 32,
|
|
+ .vdisplay = 1920,
|
|
+ .vsync_start = 1920 + 56,
|
|
+ .vsync_end = 1920 + 56 + 3,
|
|
+ .vtotal = 1920 + 56 + 3 + 6,
|
|
+ .width_mm = 75,
|
|
+ .height_mm = 132,
|
|
+ .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
|
|
+};
|
|
+
|
|
+static int sharp_ls054_get_modes(struct drm_panel *panel,
|
|
+ struct drm_connector *connector)
|
|
+{
|
|
+ struct sharp_ls054 *ctx = to_sharp_ls054(panel);
|
|
+ struct drm_display_mode *mode;
|
|
+
|
|
+ mode = drm_mode_duplicate(connector->dev, &sharp_ls054_mode);
|
|
+ if (!mode)
|
|
+ return -ENOMEM;
|
|
+
|
|
+ drm_mode_set_name(mode);
|
|
+ mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
|
|
+
|
|
+ connector->display_info.width_mm = mode->width_mm;
|
|
+ connector->display_info.height_mm = mode->height_mm;
|
|
+
|
|
+ drm_mode_probed_add(connector, mode);
|
|
+ drm_connector_set_panel_orientation(connector, ctx->orientation);
|
|
+
|
|
+ return 1;
|
|
+}
|
|
+
|
|
+static const struct drm_panel_funcs sharp_ls054_panel_funcs = {
|
|
+ .prepare = sharp_ls054_prepare,
|
|
+ .unprepare = sharp_ls054_unprepare,
|
|
+ .get_modes = sharp_ls054_get_modes,
|
|
+};
|
|
+
|
|
+static int sharp_ls054_probe(struct mipi_dsi_device *dsi)
|
|
+{
|
|
+ struct device *dev = &dsi->dev;
|
|
+ struct sharp_ls054 *ctx;
|
|
+ int ret;
|
|
+
|
|
+ ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
|
|
+ if (!ctx)
|
|
+ return -ENOMEM;
|
|
+
|
|
+ ctx->iovcc_supply = devm_regulator_get(dev, "iovcc");
|
|
+ if (IS_ERR(ctx->iovcc_supply))
|
|
+ return PTR_ERR(ctx->iovcc_supply);
|
|
+
|
|
+ ctx->vsp_supply = devm_regulator_get(dev, "vsp");
|
|
+ if (IS_ERR(ctx->vsp_supply))
|
|
+ return PTR_ERR(ctx->vsp_supply);
|
|
+
|
|
+ ctx->vsn_supply = devm_regulator_get(dev, "vsn");
|
|
+ if (IS_ERR(ctx->vsn_supply))
|
|
+ return PTR_ERR(ctx->vsn_supply);
|
|
+
|
|
+ ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
|
|
+ if (IS_ERR(ctx->reset_gpio))
|
|
+ return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
|
|
+ "Failed to get reset-gpios\n");
|
|
+
|
|
+ ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
|
|
+ if (ret < 0)
|
|
+ dev_err(dev, "%pOF: failed to get orientation, %d\n", dev->of_node, ret);
|
|
+
|
|
+ ctx->dsi = dsi;
|
|
+ mipi_dsi_set_drvdata(dsi, ctx);
|
|
+
|
|
+ dsi->lanes = 4;
|
|
+ dsi->format = MIPI_DSI_FMT_RGB888;
|
|
+ dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
|
|
+ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET |
|
|
+ MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO_AUTO_VERT;
|
|
+
|
|
+ drm_panel_init(&ctx->panel, dev, &sharp_ls054_panel_funcs,
|
|
+ DRM_MODE_CONNECTOR_DSI);
|
|
+
|
|
+ ret = drm_panel_of_backlight(&ctx->panel);
|
|
+ if (ret)
|
|
+ return dev_err_probe(dev, ret, "Failed to get backlight\n");
|
|
+
|
|
+ drm_panel_add(&ctx->panel);
|
|
+
|
|
+ ret = mipi_dsi_attach(dsi);
|
|
+ if (ret < 0) {
|
|
+ dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
|
|
+ drm_panel_remove(&ctx->panel);
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static void sharp_ls054_remove(struct mipi_dsi_device *dsi)
|
|
+{
|
|
+ struct sharp_ls054 *ctx = mipi_dsi_get_drvdata(dsi);
|
|
+ int ret;
|
|
+
|
|
+ ret = mipi_dsi_detach(dsi);
|
|
+ if (ret < 0)
|
|
+ dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
|
|
+
|
|
+ drm_panel_remove(&ctx->panel);
|
|
+}
|
|
+
|
|
+static const struct of_device_id sharp_ls054b3sx01_of_match[] = {
|
|
+ { .compatible = "sharp,ls054b3sx01" },
|
|
+ { /* sentinel */ }
|
|
+};
|
|
+MODULE_DEVICE_TABLE(of, sharp_ls054b3sx01_of_match);
|
|
+
|
|
+static struct mipi_dsi_driver sharp_ls054_driver = {
|
|
+ .probe = sharp_ls054_probe,
|
|
+ .remove = sharp_ls054_remove,
|
|
+ .driver = {
|
|
+ .name = "panel-sharp-ls054b3sx01",
|
|
+ .of_match_table = sharp_ls054b3sx01_of_match,
|
|
+ },
|
|
+};
|
|
+module_mipi_dsi_driver(sharp_ls054_driver);
|
|
+
|
|
+MODULE_AUTHOR("Maya Matuszczyk <maccraft123mc@gmail.com>");
|
|
+MODULE_DESCRIPTION("Panel driver for Sharp LS054B3SX01 1152x1920 Video Mode DSI Panel");
|
|
+MODULE_LICENSE("GPL v2");
|
|
diff -rupN linux.orig/drivers/input/Kconfig linux/drivers/input/Kconfig
|
|
--- linux.orig/drivers/input/Kconfig 2023-06-23 03:53:40.600165543 +0000
|
|
+++ linux/drivers/input/Kconfig 2023-07-22 17:35:58.778987141 +0000
|
|
@@ -51,6 +51,19 @@ config INPUT_FF_MEMLESS
|
|
To compile this driver as a module, choose M here: the
|
|
module will be called ff-memless.
|
|
|
|
+config INPUT_POLLDEV
|
|
+ tristate "Polled input device skeleton"
|
|
+ help
|
|
+ Say Y here if you are using a driver for an input
|
|
+ device that periodically polls hardware state. This
|
|
+ option is only useful for out-of-tree drivers since
|
|
+ in-tree drivers select it automatically.
|
|
+
|
|
+ If unsure, say N.
|
|
+
|
|
+ To compile this driver as a module, choose M here: the
|
|
+ module will be called input-polldev.
|
|
+
|
|
config INPUT_SPARSEKMAP
|
|
tristate "Sparse keymap support library"
|
|
help
|
|
diff -rupN linux.orig/drivers/input/Makefile linux/drivers/input/Makefile
|
|
--- linux.orig/drivers/input/Makefile 2023-06-23 03:53:40.600165543 +0000
|
|
+++ linux/drivers/input/Makefile 2023-07-22 17:35:58.810988147 +0000
|
|
@@ -10,6 +10,7 @@ input-core-y := input.o input-compat.o i
|
|
input-core-y += touchscreen.o
|
|
|
|
obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o
|
|
+obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o
|
|
obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o
|
|
obj-$(CONFIG_INPUT_MATRIXKMAP) += matrix-keymap.o
|
|
obj-$(CONFIG_INPUT_VIVALDIFMAP) += vivaldi-fmap.o
|
|
diff -rupN linux.orig/drivers/input/input-polldev.c linux/drivers/input/input-polldev.c
|
|
--- linux.orig/drivers/input/input-polldev.c 1970-01-01 00:00:00.000000000 +0000
|
|
+++ linux/drivers/input/input-polldev.c 2023-07-22 17:35:58.810988147 +0000
|
|
@@ -0,0 +1,362 @@
|
|
+// SPDX-License-Identifier: GPL-2.0-only
|
|
+/*
|
|
+ * Generic implementation of a polled input device
|
|
+
|
|
+ * Copyright (c) 2007 Dmitry Torokhov
|
|
+ */
|
|
+
|
|
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
+
|
|
+#include <linux/jiffies.h>
|
|
+#include <linux/slab.h>
|
|
+#include <linux/mutex.h>
|
|
+#include <linux/workqueue.h>
|
|
+#include <linux/module.h>
|
|
+#include <linux/input-polldev.h>
|
|
+
|
|
+MODULE_AUTHOR("Dmitry Torokhov <dtor@mail.ru>");
|
|
+MODULE_DESCRIPTION("Generic implementation of a polled input device");
|
|
+MODULE_LICENSE("GPL v2");
|
|
+
|
|
+static void input_polldev_queue_work(struct input_polled_dev *dev)
|
|
+{
|
|
+ unsigned long delay;
|
|
+
|
|
+ delay = msecs_to_jiffies(dev->poll_interval);
|
|
+ if (delay >= HZ)
|
|
+ delay = round_jiffies_relative(delay);
|
|
+
|
|
+ queue_delayed_work(system_freezable_wq, &dev->work, delay);
|
|
+}
|
|
+
|
|
+static void input_polled_device_work(struct work_struct *work)
|
|
+{
|
|
+ struct input_polled_dev *dev =
|
|
+ container_of(work, struct input_polled_dev, work.work);
|
|
+
|
|
+ dev->poll(dev);
|
|
+ input_polldev_queue_work(dev);
|
|
+}
|
|
+
|
|
+static int input_open_polled_device(struct input_dev *input)
|
|
+{
|
|
+ struct input_polled_dev *dev = input_get_drvdata(input);
|
|
+
|
|
+ if (dev->open)
|
|
+ dev->open(dev);
|
|
+
|
|
+ /* Only start polling if polling is enabled */
|
|
+ if (dev->poll_interval > 0) {
|
|
+ dev->poll(dev);
|
|
+ input_polldev_queue_work(dev);
|
|
+ }
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static void input_close_polled_device(struct input_dev *input)
|
|
+{
|
|
+ struct input_polled_dev *dev = input_get_drvdata(input);
|
|
+
|
|
+ cancel_delayed_work_sync(&dev->work);
|
|
+
|
|
+ if (dev->close)
|
|
+ dev->close(dev);
|
|
+}
|
|
+
|
|
+/* SYSFS interface */
|
|
+
|
|
+static ssize_t input_polldev_get_poll(struct device *dev,
|
|
+ struct device_attribute *attr, char *buf)
|
|
+{
|
|
+ struct input_polled_dev *polldev = dev_get_drvdata(dev);
|
|
+
|
|
+ return sprintf(buf, "%d\n", polldev->poll_interval);
|
|
+}
|
|
+
|
|
+static ssize_t input_polldev_set_poll(struct device *dev,
|
|
+ struct device_attribute *attr, const char *buf,
|
|
+ size_t count)
|
|
+{
|
|
+ struct input_polled_dev *polldev = dev_get_drvdata(dev);
|
|
+ struct input_dev *input = polldev->input;
|
|
+ unsigned int interval;
|
|
+ int err;
|
|
+
|
|
+ err = kstrtouint(buf, 0, &interval);
|
|
+ if (err)
|
|
+ return err;
|
|
+
|
|
+ if (interval < polldev->poll_interval_min)
|
|
+ return -EINVAL;
|
|
+
|
|
+ if (interval > polldev->poll_interval_max)
|
|
+ return -EINVAL;
|
|
+
|
|
+ mutex_lock(&input->mutex);
|
|
+
|
|
+ polldev->poll_interval = interval;
|
|
+
|
|
+ if (input->users) {
|
|
+ cancel_delayed_work_sync(&polldev->work);
|
|
+ if (polldev->poll_interval > 0)
|
|
+ input_polldev_queue_work(polldev);
|
|
+ }
|
|
+
|
|
+ mutex_unlock(&input->mutex);
|
|
+
|
|
+ return count;
|
|
+}
|
|
+
|
|
+static DEVICE_ATTR(poll, S_IRUGO | S_IWUSR, input_polldev_get_poll,
|
|
+ input_polldev_set_poll);
|
|
+
|
|
+
|
|
+static ssize_t input_polldev_get_max(struct device *dev,
|
|
+ struct device_attribute *attr, char *buf)
|
|
+{
|
|
+ struct input_polled_dev *polldev = dev_get_drvdata(dev);
|
|
+
|
|
+ return sprintf(buf, "%d\n", polldev->poll_interval_max);
|
|
+}
|
|
+
|
|
+static DEVICE_ATTR(max, S_IRUGO, input_polldev_get_max, NULL);
|
|
+
|
|
+static ssize_t input_polldev_get_min(struct device *dev,
|
|
+ struct device_attribute *attr, char *buf)
|
|
+{
|
|
+ struct input_polled_dev *polldev = dev_get_drvdata(dev);
|
|
+
|
|
+ return sprintf(buf, "%d\n", polldev->poll_interval_min);
|
|
+}
|
|
+
|
|
+static DEVICE_ATTR(min, S_IRUGO, input_polldev_get_min, NULL);
|
|
+
|
|
+static struct attribute *sysfs_attrs[] = {
|
|
+ &dev_attr_poll.attr,
|
|
+ &dev_attr_max.attr,
|
|
+ &dev_attr_min.attr,
|
|
+ NULL
|
|
+};
|
|
+
|
|
+static struct attribute_group input_polldev_attribute_group = {
|
|
+ .attrs = sysfs_attrs
|
|
+};
|
|
+
|
|
+static const struct attribute_group *input_polldev_attribute_groups[] = {
|
|
+ &input_polldev_attribute_group,
|
|
+ NULL
|
|
+};
|
|
+
|
|
+/**
|
|
+ * input_allocate_polled_device - allocate memory for polled device
|
|
+ *
|
|
+ * The function allocates memory for a polled device and also
|
|
+ * for an input device associated with this polled device.
|
|
+ */
|
|
+struct input_polled_dev *input_allocate_polled_device(void)
|
|
+{
|
|
+ struct input_polled_dev *dev;
|
|
+
|
|
+ dev = kzalloc(sizeof(struct input_polled_dev), GFP_KERNEL);
|
|
+ if (!dev)
|
|
+ return NULL;
|
|
+
|
|
+ dev->input = input_allocate_device();
|
|
+ if (!dev->input) {
|
|
+ kfree(dev);
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
+ return dev;
|
|
+}
|
|
+EXPORT_SYMBOL(input_allocate_polled_device);
|
|
+
|
|
+struct input_polled_devres {
|
|
+ struct input_polled_dev *polldev;
|
|
+};
|
|
+
|
|
+static int devm_input_polldev_match(struct device *dev, void *res, void *data)
|
|
+{
|
|
+ struct input_polled_devres *devres = res;
|
|
+
|
|
+ return devres->polldev == data;
|
|
+}
|
|
+
|
|
+static void devm_input_polldev_release(struct device *dev, void *res)
|
|
+{
|
|
+ struct input_polled_devres *devres = res;
|
|
+ struct input_polled_dev *polldev = devres->polldev;
|
|
+
|
|
+ dev_dbg(dev, "%s: dropping reference/freeing %s\n",
|
|
+ __func__, dev_name(&polldev->input->dev));
|
|
+
|
|
+ input_put_device(polldev->input);
|
|
+ kfree(polldev);
|
|
+}
|
|
+
|
|
+static void devm_input_polldev_unregister(struct device *dev, void *res)
|
|
+{
|
|
+ struct input_polled_devres *devres = res;
|
|
+ struct input_polled_dev *polldev = devres->polldev;
|
|
+
|
|
+ dev_dbg(dev, "%s: unregistering device %s\n",
|
|
+ __func__, dev_name(&polldev->input->dev));
|
|
+ input_unregister_device(polldev->input);
|
|
+
|
|
+ /*
|
|
+ * Note that we are still holding extra reference to the input
|
|
+ * device so it will stick around until devm_input_polldev_release()
|
|
+ * is called.
|
|
+ */
|
|
+}
|
|
+
|
|
+/**
|
|
+ * devm_input_allocate_polled_device - allocate managed polled device
|
|
+ * @dev: device owning the polled device being created
|
|
+ *
|
|
+ * Returns prepared &struct input_polled_dev or %NULL.
|
|
+ *
|
|
+ * Managed polled input devices do not need to be explicitly unregistered
|
|
+ * or freed as it will be done automatically when owner device unbinds
|
|
+ * from * its driver (or binding fails). Once such managed polled device
|
|
+ * is allocated, it is ready to be set up and registered in the same
|
|
+ * fashion as regular polled input devices (using
|
|
+ * input_register_polled_device() function).
|
|
+ *
|
|
+ * If you want to manually unregister and free such managed polled devices,
|
|
+ * it can be still done by calling input_unregister_polled_device() and
|
|
+ * input_free_polled_device(), although it is rarely needed.
|
|
+ *
|
|
+ * NOTE: the owner device is set up as parent of input device and users
|
|
+ * should not override it.
|
|
+ */
|
|
+struct input_polled_dev *devm_input_allocate_polled_device(struct device *dev)
|
|
+{
|
|
+ struct input_polled_dev *polldev;
|
|
+ struct input_polled_devres *devres;
|
|
+
|
|
+ devres = devres_alloc(devm_input_polldev_release, sizeof(*devres),
|
|
+ GFP_KERNEL);
|
|
+ if (!devres)
|
|
+ return NULL;
|
|
+
|
|
+ polldev = input_allocate_polled_device();
|
|
+ if (!polldev) {
|
|
+ devres_free(devres);
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
+ polldev->input->dev.parent = dev;
|
|
+ polldev->devres_managed = true;
|
|
+
|
|
+ devres->polldev = polldev;
|
|
+ devres_add(dev, devres);
|
|
+
|
|
+ return polldev;
|
|
+}
|
|
+EXPORT_SYMBOL(devm_input_allocate_polled_device);
|
|
+
|
|
+/**
|
|
+ * input_free_polled_device - free memory allocated for polled device
|
|
+ * @dev: device to free
|
|
+ *
|
|
+ * The function frees memory allocated for polling device and drops
|
|
+ * reference to the associated input device.
|
|
+ */
|
|
+void input_free_polled_device(struct input_polled_dev *dev)
|
|
+{
|
|
+ if (dev) {
|
|
+ if (dev->devres_managed)
|
|
+ WARN_ON(devres_destroy(dev->input->dev.parent,
|
|
+ devm_input_polldev_release,
|
|
+ devm_input_polldev_match,
|
|
+ dev));
|
|
+ input_put_device(dev->input);
|
|
+ kfree(dev);
|
|
+ }
|
|
+}
|
|
+EXPORT_SYMBOL(input_free_polled_device);
|
|
+
|
|
+/**
|
|
+ * input_register_polled_device - register polled device
|
|
+ * @dev: device to register
|
|
+ *
|
|
+ * The function registers previously initialized polled input device
|
|
+ * with input layer. The device should be allocated with call to
|
|
+ * input_allocate_polled_device(). Callers should also set up poll()
|
|
+ * method and set up capabilities (id, name, phys, bits) of the
|
|
+ * corresponding input_dev structure.
|
|
+ */
|
|
+int input_register_polled_device(struct input_polled_dev *dev)
|
|
+{
|
|
+ struct input_polled_devres *devres = NULL;
|
|
+ struct input_dev *input = dev->input;
|
|
+ int error;
|
|
+
|
|
+ if (dev->devres_managed) {
|
|
+ devres = devres_alloc(devm_input_polldev_unregister,
|
|
+ sizeof(*devres), GFP_KERNEL);
|
|
+ if (!devres)
|
|
+ return -ENOMEM;
|
|
+
|
|
+ devres->polldev = dev;
|
|
+ }
|
|
+
|
|
+ input_set_drvdata(input, dev);
|
|
+ INIT_DELAYED_WORK(&dev->work, input_polled_device_work);
|
|
+
|
|
+ if (!dev->poll_interval)
|
|
+ dev->poll_interval = 500;
|
|
+ if (!dev->poll_interval_max)
|
|
+ dev->poll_interval_max = dev->poll_interval;
|
|
+
|
|
+ input->open = input_open_polled_device;
|
|
+ input->close = input_close_polled_device;
|
|
+
|
|
+ input->dev.groups = input_polldev_attribute_groups;
|
|
+
|
|
+ error = input_register_device(input);
|
|
+ if (error) {
|
|
+ devres_free(devres);
|
|
+ return error;
|
|
+ }
|
|
+
|
|
+ /*
|
|
+ * Take extra reference to the underlying input device so
|
|
+ * that it survives call to input_unregister_polled_device()
|
|
+ * and is deleted only after input_free_polled_device()
|
|
+ * has been invoked. This is needed to ease task of freeing
|
|
+ * sparse keymaps.
|
|
+ */
|
|
+ input_get_device(input);
|
|
+
|
|
+ if (dev->devres_managed) {
|
|
+ dev_dbg(input->dev.parent, "%s: registering %s with devres.\n",
|
|
+ __func__, dev_name(&input->dev));
|
|
+ devres_add(input->dev.parent, devres);
|
|
+ }
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+EXPORT_SYMBOL(input_register_polled_device);
|
|
+
|
|
+/**
|
|
+ * input_unregister_polled_device - unregister polled device
|
|
+ * @dev: device to unregister
|
|
+ *
|
|
+ * The function unregisters previously registered polled input
|
|
+ * device from input layer. Polling is stopped and device is
|
|
+ * ready to be freed with call to input_free_polled_device().
|
|
+ */
|
|
+void input_unregister_polled_device(struct input_polled_dev *dev)
|
|
+{
|
|
+ if (dev->devres_managed)
|
|
+ WARN_ON(devres_destroy(dev->input->dev.parent,
|
|
+ devm_input_polldev_unregister,
|
|
+ devm_input_polldev_match,
|
|
+ dev));
|
|
+
|
|
+ input_unregister_device(dev->input);
|
|
+}
|
|
+EXPORT_SYMBOL(input_unregister_polled_device);
|
|
diff -rupN linux.orig/drivers/input/joystick/Kconfig linux/drivers/input/joystick/Kconfig
|
|
--- linux.orig/drivers/input/joystick/Kconfig 2023-06-23 03:53:40.604165608 +0000
|
|
+++ linux/drivers/input/joystick/Kconfig 2023-07-22 17:35:58.782987267 +0000
|
|
@@ -393,6 +393,12 @@ config JOYSTICK_FSIA6B
|
|
To compile this driver as a module, choose M here: the
|
|
module will be called fsia6b.
|
|
|
|
+config JOYSTICK_SINGLEADCJOY
|
|
+ tristate "Single SARADC dual-joystick gamepad driver"
|
|
+ select INPUT_POLLDEV
|
|
+ help
|
|
+ The 1-in 4-out SARADC joypad driver.
|
|
+
|
|
config JOYSTICK_N64
|
|
bool "N64 controller"
|
|
depends on MACH_NINTENDO64
|
|
diff -rupN linux.orig/drivers/input/joystick/Makefile linux/drivers/input/joystick/Makefile
|
|
--- linux.orig/drivers/input/joystick/Makefile 2023-06-23 03:53:40.604165608 +0000
|
|
+++ linux/drivers/input/joystick/Makefile 2023-07-22 17:35:58.782987267 +0000
|
|
@@ -30,6 +30,7 @@ obj-$(CONFIG_JOYSTICK_PXRC) += pxrc.o
|
|
obj-$(CONFIG_JOYSTICK_QWIIC) += qwiic-joystick.o
|
|
obj-$(CONFIG_JOYSTICK_SENSEHAT) += sensehat-joystick.o
|
|
obj-$(CONFIG_JOYSTICK_SIDEWINDER) += sidewinder.o
|
|
+obj-$(CONFIG_JOYSTICK_SINGLEADCJOY) += singleadcjoy.o
|
|
obj-$(CONFIG_JOYSTICK_SPACEBALL) += spaceball.o
|
|
obj-$(CONFIG_JOYSTICK_SPACEORB) += spaceorb.o
|
|
obj-$(CONFIG_JOYSTICK_STINGER) += stinger.o
|
|
diff -rupN linux.orig/drivers/input/joystick/singleadcjoy.c linux/drivers/input/joystick/singleadcjoy.c
|
|
--- linux.orig/drivers/input/joystick/singleadcjoy.c 1970-01-01 00:00:00.000000000 +0000
|
|
+++ linux/drivers/input/joystick/singleadcjoy.c 2023-07-22 17:35:58.782987267 +0000
|
|
@@ -0,0 +1,1416 @@
|
|
+/*----------------------------------------------------------------------------*/
|
|
+
|
|
+/*
|
|
+ * Copyright (c) 2008-2021 Anbernic
|
|
+ */
|
|
+
|
|
+/*
|
|
+ * Single SARADC dual-joystick gamepad driver
|
|
+ */
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+#include <linux/kernel.h>
|
|
+#include <linux/module.h>
|
|
+#include <linux/slab.h>
|
|
+#include <linux/input.h>
|
|
+#include <linux/input-polldev.h>
|
|
+#include <linux/ioport.h>
|
|
+#include <linux/platform_device.h>
|
|
+#include <linux/gpio.h>
|
|
+#include <linux/gpio/consumer.h>
|
|
+#include <linux/gpio_keys.h>
|
|
+#include <linux/iio/consumer.h>
|
|
+#include <linux/iio/types.h>
|
|
+#include <linux/property.h>
|
|
+#include <linux/of_gpio.h>
|
|
+#include <linux/delay.h>
|
|
+#include <linux/pwm.h>
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+#define DRV_NAME "retrogame_joypad"
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+#define ADC_MAX_VOLTAGE 1800
|
|
+#define ADC_DATA_TUNING(x, p) ((x * p) / 100)
|
|
+#define ADC_TUNING_DEFAULT 180
|
|
+#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
|
|
+
|
|
+struct bt_adc {
|
|
+ /* report value (mV) */
|
|
+ int value;
|
|
+ /* report type */
|
|
+ int report_type;
|
|
+ /* input device init value (mV) */
|
|
+ int max, min;
|
|
+ /* calibrated adc value */
|
|
+ int cal;
|
|
+ /* adc scale value */
|
|
+ int scale;
|
|
+ /* invert report */
|
|
+ bool invert;
|
|
+ /* amux channel */
|
|
+ int amux_ch;
|
|
+ /* adc data tuning value([percent), p = positive, n = negative */
|
|
+ int tuning_p, tuning_n;
|
|
+};
|
|
+
|
|
+struct analog_mux {
|
|
+ /* IIO ADC Channel : amux connect channel */
|
|
+ struct iio_channel *iio_ch;
|
|
+ /* analog mux select(a,b) gpio */
|
|
+ int sel_a_gpio, sel_b_gpio;
|
|
+ /* analog mux enable gpio */
|
|
+ int en_gpio;
|
|
+};
|
|
+
|
|
+struct bt_gpio {
|
|
+ /* GPIO Request label */
|
|
+ const char *label;
|
|
+ /* GPIO Number */
|
|
+ int num;
|
|
+ /* report type */
|
|
+ int report_type;
|
|
+ /* report linux code */
|
|
+ int linux_code;
|
|
+ /* prev button value */
|
|
+ bool old_value;
|
|
+ /* button press level */
|
|
+ bool active_level;
|
|
+};
|
|
+
|
|
+struct joypad {
|
|
+ struct device *dev;
|
|
+ int poll_interval;
|
|
+
|
|
+ /* report enable/disable */
|
|
+ bool enable;
|
|
+
|
|
+ /* analog mux & joystick control */
|
|
+ struct analog_mux *amux;
|
|
+ /* analog mux max count */
|
|
+ int amux_count;
|
|
+ /* 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;
|
|
+
|
|
+ /* button auto repeat */
|
|
+ int auto_repeat;
|
|
+
|
|
+ /* report threshold (mV) */
|
|
+ int bt_adc_fuzz, bt_adc_flat;
|
|
+ /* adc read value scale */
|
|
+ int bt_adc_scale;
|
|
+ /* joystick deadzone control */
|
|
+ int bt_adc_deadzone;
|
|
+
|
|
+ struct mutex lock;
|
|
+
|
|
+ /* amux debug channel */
|
|
+ int debug_ch;
|
|
+
|
|
+ /* pwm device for rumble*/
|
|
+ struct input_dev *input;
|
|
+ struct pwm_device *pwm;
|
|
+ struct work_struct play_work;
|
|
+ u16 level;
|
|
+ u16 boost_weak;
|
|
+ u16 boost_strong;
|
|
+};
|
|
+
|
|
+static int pwm_vibrator_start(struct joypad *joypad)
|
|
+{
|
|
+ struct device *pdev = joypad->input->dev.parent;
|
|
+ struct pwm_state state;
|
|
+ int err;
|
|
+
|
|
+ pwm_get_state(joypad->pwm, &state);
|
|
+ pwm_set_relative_duty_cycle(&state, joypad->level, 0xffff);
|
|
+ state.enabled = true;
|
|
+
|
|
+ err = pwm_apply_state(joypad->pwm, &state);
|
|
+ if (err) {
|
|
+ dev_err(pdev, "failed to apply pwm state: %d", err);
|
|
+ return err;
|
|
+ }
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static void pwm_vibrator_stop(struct joypad *joypad)
|
|
+{
|
|
+ pwm_disable(joypad->pwm);
|
|
+}
|
|
+
|
|
+static void pwm_vibrator_play_work(struct work_struct *work)
|
|
+{
|
|
+ struct joypad *joypad = container_of(work,
|
|
+ struct joypad, play_work);
|
|
+
|
|
+ if (joypad->level)
|
|
+ pwm_vibrator_start(joypad);
|
|
+ else
|
|
+ pwm_vibrator_stop(joypad);
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+//
|
|
+// set to the value in the boot.ini file. (if exist)
|
|
+//
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static unsigned int g_button_adc_fuzz = 0;
|
|
+static unsigned int g_button_adc_flat = 0;
|
|
+static unsigned int g_button_adc_scale = 0;
|
|
+static unsigned int g_button_adc_deadzone = 0;
|
|
+
|
|
+static int button_adc_fuzz(char *str)
|
|
+{
|
|
+ if (!str)
|
|
+ return -EINVAL;
|
|
+ g_button_adc_fuzz = simple_strtoul(str, NULL, 10);
|
|
+ return 0;
|
|
+}
|
|
+__setup("button-adc-fuzz=", button_adc_fuzz);
|
|
+
|
|
+static int button_adc_flat(char *str)
|
|
+{
|
|
+ if (!str)
|
|
+ return -EINVAL;
|
|
+ g_button_adc_flat = simple_strtoul(str, NULL, 10);
|
|
+ return 0;
|
|
+}
|
|
+__setup("button-adc-flat=", button_adc_flat);
|
|
+
|
|
+static int button_adc_scale(char *str)
|
|
+{
|
|
+ if (!str)
|
|
+ return -EINVAL;
|
|
+ g_button_adc_scale = simple_strtoul(str, NULL, 10);
|
|
+ return 0;
|
|
+}
|
|
+__setup("button-adc-scale=", button_adc_scale);
|
|
+
|
|
+static int button_adc_deadzone(char *str)
|
|
+{
|
|
+ if (!str)
|
|
+ return -EINVAL;
|
|
+ g_button_adc_deadzone = simple_strtoul(str, NULL, 10);
|
|
+ return 0;
|
|
+}
|
|
+__setup("button-adc-deadzone=", button_adc_deadzone);
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static int joypad_amux_select(struct analog_mux *amux, int channel)
|
|
+{
|
|
+ /* select mux channel */
|
|
+ gpio_set_value(amux->en_gpio, 0);
|
|
+
|
|
+ switch(channel) {
|
|
+ case 0: /* EVENT (ABS_RY) */
|
|
+ gpio_set_value(amux->sel_a_gpio, 0);
|
|
+ gpio_set_value(amux->sel_b_gpio, 0);
|
|
+ break;
|
|
+ case 1: /* EVENT (ABS_RX) */
|
|
+ gpio_set_value(amux->sel_a_gpio, 0);
|
|
+ gpio_set_value(amux->sel_b_gpio, 1);
|
|
+ break;
|
|
+ case 2: /* EVENT (ABS_Y) */
|
|
+ gpio_set_value(amux->sel_a_gpio, 1);
|
|
+ gpio_set_value(amux->sel_b_gpio, 0);
|
|
+ break;
|
|
+ case 3: /* EVENT (ABS_X) */
|
|
+ gpio_set_value(amux->sel_a_gpio, 1);
|
|
+ gpio_set_value(amux->sel_b_gpio, 1);
|
|
+ break;
|
|
+ default:
|
|
+ /* amux disanle */
|
|
+ gpio_set_value(amux->en_gpio, 1);
|
|
+ return -1;
|
|
+ }
|
|
+ /* mux swtiching speed : 35ns(on) / 9ns(off) */
|
|
+ usleep_range(10, 20);
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static int joypad_adc_read(struct analog_mux *amux, struct bt_adc *adc)
|
|
+{
|
|
+ int value;
|
|
+
|
|
+
|
|
+ if (joypad_amux_select(amux, adc->amux_ch))
|
|
+ return 0;
|
|
+
|
|
+ iio_read_channel_raw(amux->iio_ch, &value);
|
|
+
|
|
+ value *= adc->scale;
|
|
+
|
|
+ return value;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*
|
|
+ * ATTRIBUTES:
|
|
+ *
|
|
+ * /sys/devices/platform/retrogame_joypad/poll_interval [rw]
|
|
+ */
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_store_poll_interval(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ const char *buf,
|
|
+ size_t count)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ mutex_lock(&joypad->lock);
|
|
+ joypad->poll_interval = simple_strtoul(buf, NULL, 10);
|
|
+ mutex_unlock(&joypad->lock);
|
|
+
|
|
+ return count;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_show_poll_interval(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ char *buf)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ return sprintf(buf, "%d\n", joypad->poll_interval);
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static DEVICE_ATTR(poll_interval, S_IWUSR | S_IRUGO,
|
|
+ joypad_show_poll_interval,
|
|
+ joypad_store_poll_interval);
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*
|
|
+ * ATTRIBUTES:
|
|
+ *
|
|
+ * /sys/devices/platform/retrogame_joypad/adc_fuzz [r]
|
|
+ */
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_show_adc_fuzz(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ char *buf)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ return sprintf(buf, "%d\n", joypad->bt_adc_fuzz);
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static DEVICE_ATTR(adc_fuzz, S_IWUSR | S_IRUGO,
|
|
+ joypad_show_adc_fuzz,
|
|
+ NULL);
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*
|
|
+ * ATTRIBUTES:
|
|
+ *
|
|
+ * /sys/devices/platform/retrogame_joypad/adc_flat [r]
|
|
+ */
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_show_adc_flat(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ char *buf)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ return sprintf(buf, "%d\n", joypad->bt_adc_flat);
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static DEVICE_ATTR(adc_flat, S_IWUSR | S_IRUGO,
|
|
+ joypad_show_adc_flat,
|
|
+ NULL);
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*
|
|
+ * ATTRIBUTES:
|
|
+ *
|
|
+ * /sys/devices/platform/retrogame_joypad/enable [rw]
|
|
+ */
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_store_enable(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ const char *buf,
|
|
+ size_t count)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ mutex_lock(&joypad->lock);
|
|
+ joypad->enable = simple_strtoul(buf, NULL, 10);
|
|
+ mutex_unlock(&joypad->lock);
|
|
+
|
|
+ return count;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_show_enable(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ char *buf)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ return sprintf(buf, "%d\n", joypad->enable);
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static DEVICE_ATTR(enable, S_IWUSR | S_IRUGO,
|
|
+ joypad_show_enable,
|
|
+ joypad_store_enable);
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*
|
|
+ * ATTRIBUTES:
|
|
+ *
|
|
+ * /sys/devices/platform/retrogame_joypad/adc_cal [rw]
|
|
+ */
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_store_adc_cal(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ const char *buf,
|
|
+ size_t count)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+ bool calibration;
|
|
+
|
|
+ calibration = simple_strtoul(buf, NULL, 10);
|
|
+
|
|
+ if (calibration) {
|
|
+ int nbtn;
|
|
+
|
|
+ mutex_lock(&joypad->lock);
|
|
+ for (nbtn = 0; nbtn < joypad->amux_count; nbtn++) {
|
|
+ struct bt_adc *adc = &joypad->adcs[nbtn];
|
|
+
|
|
+ adc->value = joypad_adc_read(joypad->amux, adc);
|
|
+ if (!adc->value) {
|
|
+ dev_err(joypad->dev, "%s : saradc channels[%d]!\n",
|
|
+ __func__, nbtn);
|
|
+ continue;
|
|
+ }
|
|
+ adc->cal = adc->value;
|
|
+ }
|
|
+ mutex_unlock(&joypad->lock);
|
|
+ }
|
|
+ return count;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_show_adc_cal(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ char *buf)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+ int nbtn;
|
|
+ ssize_t pos;
|
|
+
|
|
+ for (nbtn = 0, pos = 0; nbtn < joypad->amux_count; nbtn++) {
|
|
+ struct bt_adc *adc = &joypad->adcs[nbtn];
|
|
+ pos += sprintf(&buf[pos], "adc[%d]->cal = %d\n",
|
|
+ nbtn, adc->cal);
|
|
+ }
|
|
+ pos += sprintf(&buf[pos], "adc scale = %d\n", joypad->bt_adc_scale);
|
|
+ return pos;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static DEVICE_ATTR(adc_cal, S_IWUSR | S_IRUGO,
|
|
+ joypad_show_adc_cal,
|
|
+ joypad_store_adc_cal);
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*
|
|
+ * ATTRIBUTES:
|
|
+ *
|
|
+ * /sys/devices/platform/retrogame_joypad/amux_debug [rw]
|
|
+ *
|
|
+ * echo [debug channel] > amux_debug
|
|
+ * cat amux_debug : debug channel mux set & adc read
|
|
+ */
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_store_amux_debug(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ const char *buf,
|
|
+ size_t count)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ joypad->debug_ch = simple_strtoul(buf, NULL, 10);
|
|
+
|
|
+ /* if error than default setting(debug_ch = 0) */
|
|
+ if (joypad->debug_ch > joypad->amux_count)
|
|
+ joypad->debug_ch = 0;
|
|
+
|
|
+ return count;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_show_amux_debug(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ char *buf)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+ struct analog_mux *amux = joypad->amux;
|
|
+ ssize_t pos;
|
|
+ int value;
|
|
+
|
|
+ mutex_lock(&joypad->lock);
|
|
+
|
|
+ /* disable poll driver */
|
|
+ if (joypad->enable)
|
|
+ joypad->enable = false;
|
|
+
|
|
+ if (joypad_amux_select(amux, joypad->debug_ch))
|
|
+ goto err_out;
|
|
+
|
|
+ if (iio_read_channel_processed(amux->iio_ch, &value))
|
|
+ goto err_out;
|
|
+
|
|
+ pos = sprintf(buf, "amux ch[%d], adc scale = %d, adc value = %d\n",
|
|
+ joypad->debug_ch, joypad->bt_adc_scale,
|
|
+ value * joypad->bt_adc_scale);
|
|
+ goto out;
|
|
+
|
|
+err_out:
|
|
+ pos = sprintf(buf, "error : amux setup & adc read!\n");
|
|
+out:
|
|
+ mutex_unlock(&joypad->lock);
|
|
+ return pos;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static DEVICE_ATTR(amux_debug, S_IWUSR | S_IRUGO,
|
|
+ joypad_show_amux_debug,
|
|
+ joypad_store_amux_debug);
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*
|
|
+ * ATTRIBUTES:
|
|
+ *
|
|
+ * /sys/devices/platform/odroidgo2_joypad/rumble_period [rw]
|
|
+ */
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_store_period(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ const char *buf,
|
|
+ size_t count)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ mutex_lock(&joypad->lock);
|
|
+ pwm_set_period(joypad->pwm, simple_strtoul(buf, NULL, 21));
|
|
+ mutex_unlock(&joypad->lock);
|
|
+
|
|
+ return count;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_show_period(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ char *buf)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ return sprintf(buf, "%d\n", pwm_get_period(joypad->pwm));
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static DEVICE_ATTR(rumble_period, S_IWUSR | S_IRUGO,
|
|
+ joypad_show_period,
|
|
+ joypad_store_period);
|
|
+
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*
|
|
+ * ATTRIBUTES:
|
|
+ *
|
|
+ * /sys/devices/platform/odroidgo2_joypad/rumble_boost_strong [rw]
|
|
+ */
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_store_boost_strong(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ const char *buf,
|
|
+ size_t count)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ mutex_lock(&joypad->lock);
|
|
+ joypad->boost_strong = simple_strtoul(buf, NULL, 10);
|
|
+ mutex_unlock(&joypad->lock);
|
|
+
|
|
+ return count;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_show_boost_strong(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ char *buf)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ return sprintf(buf, "%d\n", joypad->boost_strong);
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static DEVICE_ATTR(rumble_boost_strong, S_IWUSR | S_IRUGO,
|
|
+ joypad_show_boost_strong,
|
|
+ joypad_store_boost_strong);
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*
|
|
+ * ATTRIBUTES:
|
|
+ *
|
|
+ * /sys/devices/platform/odroidgo2_joypad/rumble_boost_weak [rw]
|
|
+ */
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_store_boost_weak(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ const char *buf,
|
|
+ size_t count)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ mutex_lock(&joypad->lock);
|
|
+ joypad->boost_weak = simple_strtoul(buf, NULL, 10);
|
|
+ mutex_unlock(&joypad->lock);
|
|
+
|
|
+ return count;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_show_boost_weak(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ char *buf)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ return sprintf(buf, "%d\n", joypad->boost_weak);
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static DEVICE_ATTR(rumble_boost_weak, S_IWUSR | S_IRUGO,
|
|
+ joypad_show_boost_weak,
|
|
+ joypad_store_boost_weak);
|
|
+
|
|
+#define __HDMI__
|
|
+
|
|
+#ifdef __HDMI__
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*
|
|
+ * ATTRIBUTES:
|
|
+ *
|
|
+ * /sys/devices/platform/singleadc-joypad/hdst [rw]
|
|
+ */
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_store_hdst(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ const char *buf,
|
|
+ size_t count)
|
|
+{
|
|
+ return count;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static ssize_t joypad_show_hdst(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ char *buf)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+ //int stcon;
|
|
+ ssize_t pos=0;
|
|
+ if(gpio_get_value(54)==1)
|
|
+ {
|
|
+ pos += sprintf(&buf[pos], "disconnected\n");
|
|
+ }else{
|
|
+ pos += sprintf(&buf[pos], "connected\n");
|
|
+ }
|
|
+ return pos;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static DEVICE_ATTR(hdst, S_IWUSR | S_IRUGO,
|
|
+ joypad_show_hdst,
|
|
+ joypad_store_hdst);
|
|
+#endif
|
|
+
|
|
+#ifdef __HDMI__
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static struct attribute *joypad_attrs[] = {
|
|
+ &dev_attr_poll_interval.attr,
|
|
+ &dev_attr_adc_fuzz.attr,
|
|
+ &dev_attr_adc_flat.attr,
|
|
+ &dev_attr_enable.attr,
|
|
+ &dev_attr_adc_cal.attr,
|
|
+ &dev_attr_amux_debug.attr,
|
|
+ &dev_attr_hdst.attr,
|
|
+ &dev_attr_rumble_period.attr,
|
|
+ &dev_attr_rumble_boost_strong.attr,
|
|
+ &dev_attr_rumble_boost_weak.attr,
|
|
+ NULL,
|
|
+};
|
|
+#else
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static struct attribute *joypad_attrs[] = {
|
|
+ &dev_attr_poll_interval.attr,
|
|
+ &dev_attr_adc_fuzz.attr,
|
|
+ &dev_attr_adc_flat.attr,
|
|
+ &dev_attr_enable.attr,
|
|
+ &dev_attr_adc_cal.attr,
|
|
+ &dev_attr_amux_debug.attr,
|
|
+ &dev_attr_rumble_period.attr,
|
|
+ &dev_attr_rumble_boost_strong.attr,
|
|
+ &dev_attr_rumble_boost_weak.attr,
|
|
+ NULL,
|
|
+};
|
|
+#endif
|
|
+static struct attribute_group joypad_attr_group = {
|
|
+ .attrs = joypad_attrs,
|
|
+};
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static void joypad_gpio_check(struct input_polled_dev *poll_dev)
|
|
+{
|
|
+ struct joypad *joypad = poll_dev->private;
|
|
+ int nbtn, value;
|
|
+
|
|
+ for (nbtn = 0; nbtn < joypad->bt_gpio_count; nbtn++) {
|
|
+ struct bt_gpio *gpio = &joypad->gpios[nbtn];
|
|
+
|
|
+ if (gpio_get_value_cansleep(gpio->num) < 0) {
|
|
+ dev_err(joypad->dev, "failed to get gpio state\n");
|
|
+ continue;
|
|
+ }
|
|
+ value = gpio_get_value(gpio->num);
|
|
+ if (value != gpio->old_value) {
|
|
+ input_event(poll_dev->input,
|
|
+ gpio->report_type,
|
|
+ gpio->linux_code,
|
|
+ (value == gpio->active_level) ? 1 : 0);
|
|
+ gpio->old_value = value;
|
|
+ }
|
|
+ }
|
|
+ input_sync(poll_dev->input);
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static void joypad_adc_check(struct input_polled_dev *poll_dev)
|
|
+{
|
|
+ struct joypad *joypad = poll_dev->private;
|
|
+ int nbtn;
|
|
+
|
|
+ for (nbtn = 0; nbtn < joypad->amux_count; nbtn++) {
|
|
+ struct bt_adc *adc = &joypad->adcs[nbtn];
|
|
+
|
|
+ adc->value = joypad_adc_read(joypad->amux, adc);
|
|
+ if (!adc->value) {
|
|
+ //dev_err(joypad->dev, "%s : saradc channels[%d]! adc->value : %d\n",__func__, nbtn, adc->value);
|
|
+ continue;
|
|
+ }
|
|
+ adc->value = adc->value - adc->cal;
|
|
+
|
|
+ /* Joystick Deadzone check */
|
|
+ if (joypad->bt_adc_deadzone) {
|
|
+ if (abs(adc->value) < joypad->bt_adc_deadzone)
|
|
+ adc->value = 0;
|
|
+ }
|
|
+
|
|
+ /* adc data tuning */
|
|
+ if (adc->tuning_n && adc->value < 0)
|
|
+ adc->value = ADC_DATA_TUNING(adc->value, adc->tuning_n);
|
|
+ if (adc->tuning_p && adc->value > 0)
|
|
+ adc->value = ADC_DATA_TUNING(adc->value, adc->tuning_p);
|
|
+
|
|
+ adc->value = adc->value > adc->max ? adc->max : adc->value;
|
|
+ adc->value = adc->value < adc->min ? adc->min : adc->value;
|
|
+
|
|
+ input_report_abs(poll_dev->input,
|
|
+ adc->report_type,
|
|
+ adc->invert ? adc->value * (-1) : adc->value);
|
|
+ }
|
|
+ input_sync(poll_dev->input);
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static void joypad_poll(struct input_polled_dev *poll_dev)
|
|
+{
|
|
+ struct joypad *joypad = poll_dev->private;
|
|
+
|
|
+ if (joypad->enable) {
|
|
+ joypad_adc_check(poll_dev);
|
|
+ joypad_gpio_check(poll_dev);
|
|
+ }
|
|
+ if (poll_dev->poll_interval != joypad->poll_interval) {
|
|
+ mutex_lock(&joypad->lock);
|
|
+ poll_dev->poll_interval = joypad->poll_interval;
|
|
+ mutex_unlock(&joypad->lock);
|
|
+ }
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static void joypad_open(struct input_polled_dev *poll_dev)
|
|
+{
|
|
+ struct joypad *joypad = poll_dev->private;
|
|
+ int nbtn;
|
|
+
|
|
+ for (nbtn = 0; nbtn < joypad->bt_gpio_count; nbtn++) {
|
|
+ struct bt_gpio *gpio = &joypad->gpios[nbtn];
|
|
+ gpio->old_value = gpio->active_level ? 0 : 1;
|
|
+ }
|
|
+ for (nbtn = 0; nbtn < joypad->amux_count; nbtn++) {
|
|
+ struct bt_adc *adc = &joypad->adcs[nbtn];
|
|
+
|
|
+ adc->value = joypad_adc_read(joypad->amux, adc);
|
|
+ if (!adc->value) {
|
|
+ dev_err(joypad->dev, "%s : saradc channels[%d]!\n",
|
|
+ __func__, nbtn);
|
|
+ continue;
|
|
+ }
|
|
+ adc->cal = adc->value;
|
|
+ dev_info(joypad->dev, "%s : adc[%d] adc->cal = %d\n",
|
|
+ __func__, nbtn, adc->cal);
|
|
+ }
|
|
+ /* buttons status sync */
|
|
+ joypad_adc_check(poll_dev);
|
|
+ joypad_gpio_check(poll_dev);
|
|
+
|
|
+ /* button report enable */
|
|
+ mutex_lock(&joypad->lock);
|
|
+ joypad->enable = true;
|
|
+ mutex_unlock(&joypad->lock);
|
|
+
|
|
+ dev_info(joypad->dev, "%s : opened\n", __func__);
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static void joypad_close(struct input_polled_dev *poll_dev)
|
|
+{
|
|
+ struct joypad *joypad = poll_dev->private;
|
|
+
|
|
+ /* button report disable */
|
|
+ mutex_lock(&joypad->lock);
|
|
+ joypad->enable = false;
|
|
+ mutex_unlock(&joypad->lock);
|
|
+
|
|
+ cancel_work_sync(&joypad->play_work);
|
|
+ pwm_vibrator_stop(joypad);
|
|
+
|
|
+ dev_info(joypad->dev, "%s : closed\n", __func__);
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static int joypad_amux_setup(struct device *dev, struct joypad *joypad)
|
|
+{
|
|
+ struct analog_mux *amux;
|
|
+ enum iio_chan_type type;
|
|
+ enum of_gpio_flags flags;
|
|
+ int ret;
|
|
+
|
|
+ /* analog mux control struct init */
|
|
+ joypad->amux = devm_kzalloc(dev, sizeof(struct analog_mux),
|
|
+ GFP_KERNEL);
|
|
+ if (!joypad->amux) {
|
|
+ dev_err(dev, "%s amux devm_kzmalloc error!", __func__);
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+ amux = joypad->amux;
|
|
+ amux->iio_ch = devm_iio_channel_get(dev, "amux_adc");
|
|
+ if (IS_ERR(amux->iio_ch)) {
|
|
+ dev_err(dev, "iio channel get error\n");
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ if (!amux->iio_ch->indio_dev)
|
|
+ return -ENXIO;
|
|
+
|
|
+ if (iio_get_channel_type(amux->iio_ch, &type))
|
|
+ return -EINVAL;
|
|
+
|
|
+ if (type != IIO_VOLTAGE) {
|
|
+ dev_err(dev, "Incompatible channel type %d\n", type);
|
|
+ return -EINVAL;
|
|
+ }
|
|
+
|
|
+ amux->sel_a_gpio = of_get_named_gpio_flags(dev->of_node,
|
|
+ "amux-a-gpios", 0, &flags);
|
|
+ if (gpio_is_valid(amux->sel_a_gpio)) {
|
|
+ ret = devm_gpio_request(dev, amux->sel_a_gpio, "amux-sel-a");
|
|
+ if (ret < 0) {
|
|
+ dev_err(dev, "%s : failed to request amux-sel-a %d\n",
|
|
+ __func__, amux->sel_a_gpio);
|
|
+ goto err_out;
|
|
+ }
|
|
+ ret = gpio_direction_output(amux->sel_a_gpio, 0);
|
|
+ if (ret < 0)
|
|
+ goto err_out;
|
|
+ }
|
|
+
|
|
+ amux->sel_b_gpio = of_get_named_gpio_flags(dev->of_node,
|
|
+ "amux-b-gpios", 0, &flags);
|
|
+ if (gpio_is_valid(amux->sel_b_gpio)) {
|
|
+ ret = devm_gpio_request(dev, amux->sel_b_gpio, "amux-sel-b");
|
|
+ if (ret < 0) {
|
|
+ dev_err(dev, "%s : failed to request amux-sel-b %d\n",
|
|
+ __func__, amux->sel_b_gpio);
|
|
+ goto err_out;
|
|
+ }
|
|
+ ret = gpio_direction_output(amux->sel_b_gpio, 0);
|
|
+ if (ret < 0)
|
|
+ goto err_out;
|
|
+ }
|
|
+
|
|
+ amux->en_gpio = of_get_named_gpio_flags(dev->of_node,
|
|
+ "amux-en-gpios", 0, &flags);
|
|
+ if (gpio_is_valid(amux->en_gpio)) {
|
|
+ ret = devm_gpio_request(dev, amux->en_gpio, "amux-en");
|
|
+ if (ret < 0) {
|
|
+ dev_err(dev, "%s : failed to request amux-en %d\n",
|
|
+ __func__, amux->en_gpio);
|
|
+ goto err_out;
|
|
+ }
|
|
+ ret = gpio_direction_output(amux->en_gpio, 0);
|
|
+ if (ret < 0)
|
|
+ goto err_out;
|
|
+ }
|
|
+ return 0;
|
|
+err_out:
|
|
+ return ret;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static int joypad_adc_setup(struct device *dev, struct joypad *joypad)
|
|
+{
|
|
+ int nbtn;
|
|
+
|
|
+ /* adc button struct init */
|
|
+ joypad->adcs = devm_kzalloc(dev, joypad->amux_count *
|
|
+ sizeof(struct bt_adc), GFP_KERNEL);
|
|
+ if (!joypad->adcs) {
|
|
+ dev_err(dev, "%s devm_kzmalloc error!", __func__);
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+
|
|
+ for (nbtn = 0; nbtn < joypad->amux_count; nbtn++) {
|
|
+ struct bt_adc *adc = &joypad->adcs[nbtn];
|
|
+
|
|
+ adc->scale = joypad->bt_adc_scale;
|
|
+
|
|
+ adc->max = (ADC_MAX_VOLTAGE / 2);
|
|
+ adc->min = (ADC_MAX_VOLTAGE / 2) * (-1);
|
|
+ if (adc->scale) {
|
|
+ adc->max *= adc->scale;
|
|
+ adc->min *= adc->scale;
|
|
+ }
|
|
+ adc->amux_ch = nbtn;
|
|
+ adc->invert = false;
|
|
+
|
|
+ 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",
|
|
+ &adc->tuning_p))
|
|
+ adc->tuning_p = ADC_TUNING_DEFAULT;
|
|
+ if (device_property_read_u32(dev,
|
|
+ "abs_ry-n-tuning",
|
|
+ &adc->tuning_n))
|
|
+ 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",
|
|
+ &adc->tuning_p))
|
|
+ adc->tuning_p = ADC_TUNING_DEFAULT;
|
|
+ if (device_property_read_u32(dev,
|
|
+ "abs_rx-n-tuning",
|
|
+ &adc->tuning_n))
|
|
+ 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",
|
|
+ &adc->tuning_p))
|
|
+ adc->tuning_p = ADC_TUNING_DEFAULT;
|
|
+ if (device_property_read_u32(dev,
|
|
+ "abs_y-n-tuning",
|
|
+ &adc->tuning_n))
|
|
+ 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",
|
|
+ &adc->tuning_p))
|
|
+ adc->tuning_p = ADC_TUNING_DEFAULT;
|
|
+ if (device_property_read_u32(dev,
|
|
+ "abs_x-n-tuning",
|
|
+ &adc->tuning_n))
|
|
+ adc->tuning_n = ADC_TUNING_DEFAULT;
|
|
+ break;
|
|
+ default :
|
|
+ dev_err(dev, "%s amux count(%d) error!",
|
|
+ __func__, nbtn);
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ }
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static int joypad_gpio_setup(struct device *dev, struct joypad *joypad)
|
|
+{
|
|
+ struct device_node *node, *pp;
|
|
+ int nbtn;
|
|
+
|
|
+ node = dev->of_node;
|
|
+ if (!node)
|
|
+ return -ENODEV;
|
|
+
|
|
+ joypad->gpios = devm_kzalloc(dev, joypad->bt_gpio_count *
|
|
+ sizeof(struct bt_gpio), GFP_KERNEL);
|
|
+
|
|
+ if (!joypad->gpios) {
|
|
+ dev_err(dev, "%s devm_kzmalloc error!", __func__);
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+
|
|
+ nbtn = 0;
|
|
+ for_each_child_of_node(node, pp) {
|
|
+ enum of_gpio_flags flags;
|
|
+ struct bt_gpio *gpio = &joypad->gpios[nbtn++];
|
|
+ int error;
|
|
+
|
|
+ gpio->num = of_get_gpio_flags(pp, 0, &flags);
|
|
+ if (gpio->num < 0) {
|
|
+ error = gpio->num;
|
|
+ dev_err(dev, "Failed to get gpio flags, error: %d\n",
|
|
+ error);
|
|
+ return error;
|
|
+ }
|
|
+
|
|
+ /* gpio active level(key press level) */
|
|
+ gpio->active_level = (flags & OF_GPIO_ACTIVE_LOW) ? 0 : 1;
|
|
+
|
|
+ gpio->label = of_get_property(pp, "label", NULL);
|
|
+
|
|
+ if (gpio_is_valid(gpio->num)) {
|
|
+ error = devm_gpio_request_one(dev, gpio->num,
|
|
+ GPIOF_IN, gpio->label);
|
|
+ if (error < 0) {
|
|
+ dev_err(dev,
|
|
+ "Failed to request GPIO %d, error %d\n",
|
|
+ gpio->num, error);
|
|
+ return error;
|
|
+ }
|
|
+ }
|
|
+ if (of_property_read_u32(pp, "linux,code", &gpio->linux_code)) {
|
|
+ dev_err(dev, "Button without keycode: 0x%x\n",
|
|
+ gpio->num);
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ if (of_property_read_u32(pp, "linux,input-type",
|
|
+ &gpio->report_type))
|
|
+ gpio->report_type = EV_KEY;
|
|
+ }
|
|
+ if (nbtn == 0)
|
|
+ return -EINVAL;
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+struct input_dev * joypad_input_g;
|
|
+
|
|
+
|
|
+void rk_send_key_f_key_up(void)
|
|
+{
|
|
+ if (!joypad_input_g)
|
|
+ return;
|
|
+
|
|
+ input_report_key(joypad_input_g, BTN_MODE, 1);
|
|
+ input_sync(joypad_input_g);
|
|
+}
|
|
+EXPORT_SYMBOL(rk_send_key_f_key_up);
|
|
+
|
|
+
|
|
+void rk_send_key_f_key_down(void)
|
|
+{
|
|
+ if (!joypad_input_g)
|
|
+ return;
|
|
+
|
|
+ input_report_key(joypad_input_g, BTN_MODE, 0);
|
|
+ input_sync(joypad_input_g);
|
|
+}
|
|
+EXPORT_SYMBOL(rk_send_key_f_key_down);
|
|
+
|
|
+static int rumble_play_effect(struct input_dev *dev, void *data, struct ff_effect *effect)
|
|
+{
|
|
+ struct joypad *joypad = data;
|
|
+ u32 boosted_level;
|
|
+ if (effect->type != FF_RUMBLE)
|
|
+ return 0;
|
|
+
|
|
+ if (effect->u.rumble.strong_magnitude)
|
|
+ boosted_level = effect->u.rumble.strong_magnitude + joypad->boost_strong;
|
|
+ else
|
|
+ boosted_level = effect->u.rumble.weak_magnitude + joypad->boost_weak;
|
|
+
|
|
+ joypad->level = (u16)CLAMP(boosted_level, 0, 0xffff);
|
|
+
|
|
+ dev_info(joypad->dev,"joypad->level = %d", joypad->level);
|
|
+ schedule_work(&joypad->play_work);
|
|
+ return 0;
|
|
+}
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static int joypad_rumble_setup(struct device *dev, struct joypad *joypad)
|
|
+{
|
|
+ int err;
|
|
+ struct pwm_state state;
|
|
+
|
|
+ joypad->pwm = devm_pwm_get(dev, "enable");
|
|
+ if (IS_ERR(joypad->pwm))
|
|
+ {
|
|
+ dev_err(dev, "rumble get error\n");
|
|
+ return -EINVAL;
|
|
+ }
|
|
+
|
|
+ INIT_WORK(&joypad->play_work, pwm_vibrator_play_work);
|
|
+
|
|
+ /* Sync up PWM state and ensure it is off. */
|
|
+ pwm_init_state(joypad->pwm, &state);
|
|
+ state.enabled = false;
|
|
+ err = pwm_apply_state(joypad->pwm, &state);
|
|
+ if (err) {
|
|
+ dev_err(dev, "failed to apply initial PWM state: %d",
|
|
+ err);
|
|
+ return err;
|
|
+ }
|
|
+ dev_info(dev, "rumble setup success!\n");
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static int joypad_input_setup(struct device *dev, struct joypad *joypad)
|
|
+{
|
|
+ struct input_polled_dev *poll_dev;
|
|
+ struct input_dev *input;
|
|
+ int nbtn, error;
|
|
+ u32 joypad_revision = 0;
|
|
+ u32 joypad_product = 0;
|
|
+ u32 boost_weak = 0;
|
|
+ u32 boost_strong = 0;
|
|
+ poll_dev = devm_input_allocate_polled_device(dev);
|
|
+ if (!poll_dev) {
|
|
+ dev_err(dev, "no memory for polled device\n");
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+
|
|
+ poll_dev->private = joypad;
|
|
+ poll_dev->poll = joypad_poll;
|
|
+ poll_dev->poll_interval = joypad->poll_interval;
|
|
+ poll_dev->open = joypad_open;
|
|
+ poll_dev->close = joypad_close;
|
|
+
|
|
+ input = poll_dev->input;
|
|
+ joypad->input = poll_dev->input;
|
|
+
|
|
+ device_property_read_string(dev, "joypad-name", &input->name);
|
|
+ input->phys = DRV_NAME"/input0";
|
|
+
|
|
+ device_property_read_u32(dev, "joypad-revision", &joypad_revision);
|
|
+ device_property_read_u32(dev, "joypad-product", &joypad_product);
|
|
+ input->id.bustype = BUS_HOST;
|
|
+ input->id.vendor = 0x484B;
|
|
+ input->id.product = (u16)joypad_product;
|
|
+ input->id.version = (u16)joypad_revision;
|
|
+
|
|
+ /* IIO ADC key setup (0 mv ~ 1800 mv) * adc->scale */
|
|
+ __set_bit(EV_ABS, input->evbit);
|
|
+ for(nbtn = 0; nbtn < joypad->amux_count; nbtn++) {
|
|
+ struct bt_adc *adc = &joypad->adcs[nbtn];
|
|
+ input_set_abs_params(input, adc->report_type,
|
|
+ adc->min, adc->max,
|
|
+ joypad->bt_adc_fuzz,
|
|
+ joypad->bt_adc_flat);
|
|
+ dev_info(dev,
|
|
+ "%s : SCALE = %d, ABS min = %d, max = %d,"
|
|
+ " fuzz = %d, flat = %d, deadzone = %d\n",
|
|
+ __func__, adc->scale, adc->min, adc->max,
|
|
+ joypad->bt_adc_fuzz, joypad->bt_adc_flat,
|
|
+ joypad->bt_adc_deadzone);
|
|
+ dev_info(dev,
|
|
+ "%s : adc tuning_p = %d, adc_tuning_n = %d\n\n",
|
|
+ __func__, adc->tuning_p, adc->tuning_n);
|
|
+ }
|
|
+
|
|
+ /* Rumble setip*/
|
|
+ device_property_read_u32(dev, "rumble-boost-weak", &boost_weak);
|
|
+ device_property_read_u32(dev, "rumble-boost-strong", &boost_strong);
|
|
+ joypad->boost_weak = boost_weak;
|
|
+ joypad->boost_strong = boost_strong;
|
|
+ dev_info(dev, "Boost = %d, %d",boost_weak, boost_strong);
|
|
+ input_set_capability(input, EV_FF, FF_RUMBLE);
|
|
+ error = input_ff_create_memless(input, joypad, rumble_play_effect);
|
|
+ if (error) {
|
|
+ dev_err(dev, "unable to register rumble, err=%d\n",
|
|
+ error);
|
|
+ return error;
|
|
+ }
|
|
+
|
|
+
|
|
+ /* GPIO key setup */
|
|
+ __set_bit(EV_KEY, input->evbit);
|
|
+ for(nbtn = 0; nbtn < joypad->bt_gpio_count; nbtn++) {
|
|
+ struct bt_gpio *gpio = &joypad->gpios[nbtn];
|
|
+ input_set_capability(input, gpio->report_type,
|
|
+ gpio->linux_code);
|
|
+ }
|
|
+
|
|
+ if (joypad->auto_repeat)
|
|
+ __set_bit(EV_REP, input->evbit);
|
|
+
|
|
+ joypad->dev = dev;
|
|
+
|
|
+ error = input_register_polled_device(poll_dev);
|
|
+ if (error) {
|
|
+ dev_err(dev, "unable to register polled device, err=%d\n",
|
|
+ error);
|
|
+ return error;
|
|
+ }
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static void joypad_setup_value_check(struct device *dev, struct joypad *joypad)
|
|
+{
|
|
+ /*
|
|
+ fuzz: specifies fuzz value that is used to filter noise from
|
|
+ the event stream.
|
|
+ */
|
|
+ if (g_button_adc_fuzz)
|
|
+ joypad->bt_adc_fuzz = g_button_adc_fuzz;
|
|
+ else
|
|
+ device_property_read_u32(dev, "button-adc-fuzz",
|
|
+ &joypad->bt_adc_fuzz);
|
|
+ /*
|
|
+ flat: values that are within this value will be discarded by
|
|
+ joydev interface and reported as 0 instead.
|
|
+ */
|
|
+ if (g_button_adc_flat)
|
|
+ joypad->bt_adc_flat = g_button_adc_flat;
|
|
+ else
|
|
+ device_property_read_u32(dev, "button-adc-flat",
|
|
+ &joypad->bt_adc_flat);
|
|
+
|
|
+ /* Joystick report value control */
|
|
+ if (g_button_adc_scale)
|
|
+ joypad->bt_adc_scale = g_button_adc_scale;
|
|
+ else
|
|
+ device_property_read_u32(dev, "button-adc-scale",
|
|
+ &joypad->bt_adc_scale);
|
|
+
|
|
+ /* Joystick deadzone value control */
|
|
+ if (g_button_adc_deadzone)
|
|
+ joypad->bt_adc_deadzone = g_button_adc_deadzone;
|
|
+ else
|
|
+ device_property_read_u32(dev, "button-adc-deadzone",
|
|
+ &joypad->bt_adc_deadzone);
|
|
+
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static int joypad_dt_parse(struct device *dev, struct joypad *joypad)
|
|
+{
|
|
+ int error = 0;
|
|
+
|
|
+ /* initialize value check from boot.ini */
|
|
+ joypad_setup_value_check(dev, joypad);
|
|
+
|
|
+ device_property_read_u32(dev, "amux-count",
|
|
+ &joypad->amux_count);
|
|
+
|
|
+ device_property_read_u32(dev, "poll-interval",
|
|
+ &joypad->poll_interval);
|
|
+
|
|
+ joypad->auto_repeat = device_property_present(dev, "autorepeat");
|
|
+
|
|
+ /* change the report reference point? (ADC MAX - read value) */
|
|
+ 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, inveret-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)) {
|
|
+ dev_err(dev, "adc key = %d, gpio key = %d error!",
|
|
+ joypad->amux_count, joypad->bt_gpio_count);
|
|
+ return -EINVAL;
|
|
+ }
|
|
+
|
|
+ error = joypad_adc_setup(dev, joypad);
|
|
+ if (error)
|
|
+ return error;
|
|
+
|
|
+ error = joypad_amux_setup(dev, joypad);
|
|
+ if (error)
|
|
+ return error;
|
|
+
|
|
+ error = joypad_gpio_setup(dev, joypad);
|
|
+ if (error)
|
|
+ return error;
|
|
+
|
|
+ dev_info(dev, "%s : adc key cnt = %d, gpio key cnt = %d\n",
|
|
+ __func__, joypad->amux_count, joypad->bt_gpio_count);
|
|
+
|
|
+ return error;
|
|
+}
|
|
+static int __maybe_unused joypad_suspend(struct device *dev)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ cancel_work_sync(&joypad->play_work);
|
|
+ if (joypad->level)
|
|
+ pwm_vibrator_stop(joypad);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static int __maybe_unused joypad_resume(struct device *dev)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct joypad *joypad = platform_get_drvdata(pdev);
|
|
+
|
|
+ if (joypad->level)
|
|
+ pwm_vibrator_start(joypad);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static SIMPLE_DEV_PM_OPS(joypad_pm_ops,
|
|
+ joypad_suspend, joypad_resume);
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static int joypad_probe(struct platform_device *pdev)
|
|
+{
|
|
+ struct joypad *joypad;
|
|
+ struct device *dev = &pdev->dev;
|
|
+ int error;
|
|
+
|
|
+ joypad = devm_kzalloc(dev, sizeof(struct joypad), GFP_KERNEL);
|
|
+ if (!joypad) {
|
|
+ dev_err(dev, "joypad devm_kzmalloc error!");
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+
|
|
+ /* device tree data parse */
|
|
+ error = joypad_dt_parse(dev, joypad);
|
|
+ if (error) {
|
|
+ dev_err(dev, "dt parse error!(err = %d)\n", error);
|
|
+ return error;
|
|
+ }
|
|
+
|
|
+ mutex_init(&joypad->lock);
|
|
+ platform_set_drvdata(pdev, joypad);
|
|
+
|
|
+ error = sysfs_create_group(&pdev->dev.kobj, &joypad_attr_group);
|
|
+ if (error) {
|
|
+ dev_err(dev, "create sysfs group fail, error: %d\n",
|
|
+ error);
|
|
+ return error;
|
|
+ }
|
|
+
|
|
+ /* poll input device setup */
|
|
+ error = joypad_input_setup(dev, joypad);
|
|
+ if (error) {
|
|
+ dev_err(dev, "input setup failed!(err = %d)\n", error);
|
|
+ return error;
|
|
+ }
|
|
+
|
|
+ /* rumble setup */
|
|
+ error = joypad_rumble_setup(dev, joypad);
|
|
+ if (error) {
|
|
+ dev_err(dev, "rumble setup failed!(err = %d)\n", error);
|
|
+ return error;
|
|
+ }
|
|
+
|
|
+ dev_info(dev, "%s : probe success\n", __func__);
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static const struct of_device_id joypad_of_match[] = {
|
|
+ { .compatible = "singleadc-joypad", },
|
|
+ {},
|
|
+};
|
|
+
|
|
+MODULE_DEVICE_TABLE(of, joypad_of_match);
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static struct platform_driver joypad_driver = {
|
|
+ .probe = joypad_probe,
|
|
+ .driver = {
|
|
+ .name = DRV_NAME,
|
|
+ .pm = &joypad_pm_ops,
|
|
+ .of_match_table = of_match_ptr(joypad_of_match),
|
|
+ },
|
|
+};
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static int __init joypad_init(void)
|
|
+{
|
|
+ return platform_driver_register(&joypad_driver);
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+static void __exit joypad_exit(void)
|
|
+{
|
|
+ platform_driver_unregister(&joypad_driver);
|
|
+}
|
|
+
|
|
+/*----------------------------------------------------------------------------*/
|
|
+late_initcall(joypad_init);
|
|
+module_exit(joypad_exit);
|
|
diff -rupN linux.orig/drivers/input/touchscreen/goodix.c linux/drivers/input/touchscreen/goodix.c
|
|
--- linux.orig/drivers/input/touchscreen/goodix.c 2023-06-23 03:53:40.656166453 +0000
|
|
+++ linux/drivers/input/touchscreen/goodix.c 2023-07-22 17:35:58.806988021 +0000
|
|
@@ -1010,7 +1010,7 @@ retry_get_irq_gpio:
|
|
default:
|
|
if (ts->gpiod_int && ts->gpiod_rst) {
|
|
ts->reset_controller_at_probe = true;
|
|
- ts->load_cfg_from_disk = true;
|
|
+ ts->load_cfg_from_disk = false;
|
|
ts->irq_pin_access_method = IRQ_PIN_ACCESS_GPIO;
|
|
}
|
|
}
|
|
diff -rupN linux.orig/drivers/power/supply/cw2015_battery.c linux/drivers/power/supply/cw2015_battery.c
|
|
--- linux.orig/drivers/power/supply/cw2015_battery.c 2023-06-23 03:53:42.860202281 +0000
|
|
+++ linux/drivers/power/supply/cw2015_battery.c 2023-07-22 17:35:59.927023244 +0000
|
|
@@ -553,7 +553,7 @@ static enum power_supply_property cw_bat
|
|
};
|
|
|
|
static const struct power_supply_desc cw2015_bat_desc = {
|
|
- .name = "cw2015-battery",
|
|
+ .name = "battery",
|
|
.type = POWER_SUPPLY_TYPE_BATTERY,
|
|
.properties = cw_battery_properties,
|
|
.num_properties = ARRAY_SIZE(cw_battery_properties),
|
|
diff -rupN linux.orig/include/linux/input-polldev.h linux/include/linux/input-polldev.h
|
|
--- linux.orig/include/linux/input-polldev.h 1970-01-01 00:00:00.000000000 +0000
|
|
+++ linux/include/linux/input-polldev.h 2023-07-22 17:35:57.254939213 +0000
|
|
@@ -0,0 +1,58 @@
|
|
+/* SPDX-License-Identifier: GPL-2.0-only */
|
|
+#ifndef _INPUT_POLLDEV_H
|
|
+#define _INPUT_POLLDEV_H
|
|
+
|
|
+/*
|
|
+ * Copyright (c) 2007 Dmitry Torokhov
|
|
+ */
|
|
+
|
|
+#include <linux/input.h>
|
|
+#include <linux/workqueue.h>
|
|
+
|
|
+/**
|
|
+ * struct input_polled_dev - simple polled input device
|
|
+ * @private: private driver data.
|
|
+ * @open: driver-supplied method that prepares device for polling
|
|
+ * (enabled the device and maybe flushes device state).
|
|
+ * @close: driver-supplied method that is called when device is no
|
|
+ * longer being polled. Used to put device into low power mode.
|
|
+ * @poll: driver-supplied method that polls the device and posts
|
|
+ * input events (mandatory).
|
|
+ * @poll_interval: specifies how often the poll() method should be called.
|
|
+ * Defaults to 500 msec unless overridden when registering the device.
|
|
+ * @poll_interval_max: specifies upper bound for the poll interval.
|
|
+ * Defaults to the initial value of @poll_interval.
|
|
+ * @poll_interval_min: specifies lower bound for the poll interval.
|
|
+ * Defaults to 0.
|
|
+ * @input: input device structure associated with the polled device.
|
|
+ * Must be properly initialized by the driver (id, name, phys, bits).
|
|
+ *
|
|
+ * Polled input device provides a skeleton for supporting simple input
|
|
+ * devices that do not raise interrupts but have to be periodically
|
|
+ * scanned or polled to detect changes in their state.
|
|
+ */
|
|
+struct input_polled_dev {
|
|
+ void *private;
|
|
+
|
|
+ void (*open)(struct input_polled_dev *dev);
|
|
+ void (*close)(struct input_polled_dev *dev);
|
|
+ void (*poll)(struct input_polled_dev *dev);
|
|
+ unsigned int poll_interval; /* msec */
|
|
+ unsigned int poll_interval_max; /* msec */
|
|
+ unsigned int poll_interval_min; /* msec */
|
|
+
|
|
+ struct input_dev *input;
|
|
+
|
|
+/* private: */
|
|
+ struct delayed_work work;
|
|
+
|
|
+ bool devres_managed;
|
|
+};
|
|
+
|
|
+struct input_polled_dev *input_allocate_polled_device(void);
|
|
+struct input_polled_dev *devm_input_allocate_polled_device(struct device *dev);
|
|
+void input_free_polled_device(struct input_polled_dev *dev);
|
|
+int input_register_polled_device(struct input_polled_dev *dev);
|
|
+void input_unregister_polled_device(struct input_polled_dev *dev);
|
|
+
|
|
+#endif
|