diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile index 82646bb6fcb3..6a2babd67c60 100755 --- a/arch/arm64/boot/dts/qcom/Makefile +++ b/arch/arm64/boot/dts/qcom/Makefile @@ -6,16 +6,7 @@ ifeq ($(CONFIG_BUILD_ARM64_DT_OVERLAY),y) sdm845-mtp-overlay.dtbo \ sdm845-v2-mtp-overlay.dtbo \ sdm845-v2.1-mtp-overlay.dtbo \ - enchilada-evb-overlay.dtbo \ - enchilada-evb-v2-overlay.dtbo \ enchilada-evb-v2.1-overlay.dtbo \ - enchilada-t0-v2-overlay.dtbo \ - enchilada-evt1-v2-overlay.dtbo \ - enchilada-evt2-v2-overlay.dtbo \ - enchilada-evt2-cxo-v2-overlay.dtbo \ - enchilada-dvt-v2-overlay.dtbo \ - enchilada-pvt-v2-overlay.dtbo \ - enchilada-mp-v2-overlay.dtbo \ enchilada-t0-v2.1-overlay.dtbo \ enchilada-evt1-v2.1-overlay.dtbo \ enchilada-evt2-v2.1-overlay.dtbo \ @@ -25,22 +16,22 @@ ifeq ($(CONFIG_BUILD_ARM64_DT_OVERLAY),y) enchilada-dvt-v2.1-usb30-overlay.dtbo \ enchilada-pvt-v2.1-overlay.dtbo \ enchilada-pvt-v2.1-backup-overlay.dtbo \ - enchilada-mp-v2.1-overlay.dtbo - + enchilada-mp-v2.1-overlay.dtbo \ + fajita-evb-v2.1-overlay.dtbo \ + fajita-t0-v2.1-overlay.dtbo \ + fajita-evt1-v2.1-overlay.dtbo \ + fajita-dvt-v2.1-overlay.dtbo \ + fajita-dvt-v2.1-bu-overlay.dtbo \ + fajita-pvt-v2.1-overlay.dtbo \ + fajita-pvt-v2.1-bu-overlay.dtbo \ + fajita-pvt-v2.1-v1-overlay.dtbo \ + fajita-pvt-v2.1-spec-overlay.dtbo \ + fajita-mp-v2.1-spec-overlay.dtbo sdm845-mtp-overlay.dtbo-base := sdm845.dtb sdm845-v2-mtp-overlay.dtbo-base := sdm845-v2.dtb sdm845-v2.1-mtp-overlay.dtbo-base := sdm845-v2.1.dtb -enchilada-evb-overlay.dtbo-base := sdm845.dtb -enchilada-evb-v2-overlay.dtbo-base := sdm845-v2.dtb enchilada-evb-v2.1-overlay.dtbo-base := sdm845-v2.1.dtb -enchilada-t0-v2-overlay.dtbo-base := sdm845-v2.dtb -enchilada-evt1-v2-overlay.dtbo-base := sdm845-v2.dtb -enchilada-evt2-v2-overlay.dtbo-base := sdm845-v2.dtb -enchilada-evt2-cxo-v2-overlay.dtbo-base := sdm845-v2.dtb -enchilada-dvt-v2-overlay.dtbo-base := sdm845-v2.dtb -enchilada-pvt-v2-overlay.dtbo-base := sdm845-v2.dtb -enchilada-mp-v2-overlay.dtbo-base := sdm845-v2.dtb enchilada-t0-v2.1-overlay.dtbo-base := sdm845-v2.1.dtb enchilada-evt1-v2.1-overlay.dtbo-base := sdm845-v2.1.dtb enchilada-evt2-v2.1-overlay.dtbo-base := sdm845-v2.1.dtb @@ -51,6 +42,16 @@ enchilada-dvt-v2.1-usb30-overlay.dtbo-base := sdm845-v2.1.dtb enchilada-pvt-v2.1-overlay.dtbo-base := sdm845-v2.1.dtb enchilada-pvt-v2.1-backup-overlay.dtbo-base := sdm845-v2.1.dtb enchilada-mp-v2.1-overlay.dtbo-base := sdm845-v2.1.dtb +fajita-evb-v2.1-overlay.dtbo-base := sdm845-v2.1.dtb +fajita-t0-v2.1-overlay.dtbo-base := sdm845-v2.1.dtb +fajita-evt1-v2.1-overlay.dtbo-base := sdm845-v2.1.dtb +fajita-dvt-v2.1-overlay.dtbo-base := sdm845-v2.1.dtb +fajita-dvt-v2.1-bu-overlay.dtbo-base := sdm845-v2.1.dtb +fajita-pvt-v2.1-overlay.dtbo-base := sdm845-v2.1.dtb +fajita-pvt-v2.1-bu-overlay.dtbo-base := sdm845-v2.1.dtb +fajita-pvt-v2.1-v1-overlay.dtbo-base := sdm845-v2.1.dtb +fajita-pvt-v2.1-spec-overlay.dtbo-base := sdm845-v2.1.dtb +fajita-mp-v2.1-spec-overlay.dtbo-base := sdm845-v2.1.dtb else ifeq ($(CONFIG_BUILD_ARM64_DT_OVERLAY),n) diff --git a/arch/arm64/boot/dts/qcom/dsi-panel-samsung_s6e3fc2x01.dtsi b/arch/arm64/boot/dts/qcom/dsi-panel-samsung_s6e3fc2x01.dtsi index 0e37c5204ccc..df7c4bac224a 100755 --- a/arch/arm64/boot/dts/qcom/dsi-panel-samsung_s6e3fc2x01.dtsi +++ b/arch/arm64/boot/dts/qcom/dsi-panel-samsung_s6e3fc2x01.dtsi @@ -122,11 +122,11 @@ 39 01 00 00 00 00 02 B0 07 39 01 00 00 00 00 02 ED 67 39 01 00 00 00 00 03 FC A5 A5 - 39 01 00 00 00 00 03 FC A5 A5 + 39 01 00 00 00 00 03 F0 5A 5A 15 01 00 00 00 00 02 53 20 + 39 01 00 00 00 00 03 F0 A5 A5 /*ACL off*/ 39 01 00 00 01 00 02 55 00 - 39 01 00 00 00 00 03 FC A5 A5 /*SEED OFF*/ 39 01 00 00 00 00 03 F0 5A 5A 39 01 00 00 00 00 03 B1 00 01 @@ -201,23 +201,34 @@ ]; qcom,mdss-dsi-panel-hbm-on-command-5 = [ - /* - 39 01 00 00 00 00 03 F0 5A 5A - 15 01 00 00 00 00 02 B0 07 + /*ELVSS OFF*/ + 39 01 00 00 00 00 03 F0 5A 5A + 15 01 00 00 00 00 02 B0 07 15 01 00 00 00 00 02 B7 01 - 15 01 00 00 00 00 02 B0 08 - 15 01 00 00 00 00 02 B7 12 - 39 01 00 00 00 00 02 53 E0 - 39 01 00 00 24 00 03 F0 A5 A5 - 39 01 00 00 00 00 03 51 03 FF - */ + 15 01 00 00 00 00 02 B0 08 + 15 01 00 00 00 00 02 B7 12 + 39 01 00 00 00 00 03 F0 A5 A5 + /*DLY OFF*/ + 39 01 00 00 00 00 03 F0 5A 5A + 39 01 00 00 00 00 04 B7 00 01 5B + 39 01 00 00 00 00 03 F0 A5 A5 + 15 01 00 00 0A 00 02 53 E0 39 01 00 00 00 00 03 51 03 FF - 15 01 00 00 22 00 02 53 E0 - + /*DLY ON*/ + 39 01 00 00 00 00 03 F0 5A 5A + 39 01 00 00 00 00 04 B7 00 01 53 + 39 01 00 00 00 00 03 F0 A5 A5 ]; qcom,mdss-dsi-panel-hbm-off-command = [ - + /*DLY OFF*/ + 39 01 00 00 00 00 03 F0 5A 5A + 39 01 00 00 00 00 04 B7 00 01 5B + 39 01 00 00 00 00 03 F0 A5 A5 39 01 00 00 00 00 02 53 20 + /*DLY ON*/ + 39 01 00 00 00 00 03 F0 5A 5A + 39 01 00 00 00 00 04 B7 00 01 53 + 39 01 00 00 00 00 03 F0 A5 A5 ]; qcom,mdss-dsi-panel-hbm-max-brightness-command-on = [ 39 01 00 00 00 00 03 F0 5A 5A @@ -248,17 +259,9 @@ 39 01 00 00 00 00 03 9F A5 A5 05 01 00 00 0A 00 01 28 05 01 00 00 78 00 01 10 - 15 01 00 00 00 00 02 34 00 05 01 00 00 05 00 01 11 39 01 00 00 00 00 03 9F 5A 5A 39 01 00 00 00 00 03 F0 5A 5A - 15 01 00 00 00 00 02 B0 07 - 15 01 00 00 00 00 02 B7 01 - 15 01 00 00 00 00 02 B0 08 - 15 01 00 00 00 00 02 B7 12 - 39 01 00 00 00 00 03 F0 A5 A5 - 39 01 00 00 00 00 03 51 00 01 - 39 01 00 00 00 00 03 F0 5A 5A 15 01 00 00 00 00 02 B0 01 15 01 00 00 64 00 02 CD 02 15 01 00 00 00 00 02 53 23 @@ -266,42 +269,24 @@ 15 01 00 00 00 00 02 C7 00 39 01 00 00 00 00 03 F0 A5 A5 39 01 00 00 00 00 03 9F A5 A5 - 15 01 00 00 00 00 02 35 00 - 39 01 00 00 00 00 03 9F 5A 5A - 39 01 00 00 00 00 03 51 00 01 - 39 01 00 00 00 00 03 9F A5 A5 05 01 00 00 00 00 01 29 39 01 00 00 00 00 03 9F 5A 5A ]; qcom,mdss-dsi-panel-aod-on-command-2 = [ - 39 01 00 00 00 00 03 F0 5A 5A - 39 01 00 00 00 00 03 51 00 01 - 39 01 00 00 00 00 03 F0 A5 A5 - 39 01 00 00 00 00 03 9F A5 A5 - 05 01 00 00 0A 00 01 28 - 05 01 00 00 78 00 01 10 - 05 01 00 00 05 00 01 34 - 05 01 00 00 05 00 01 11 - 39 01 00 00 00 00 03 9F 5A 5A - 39 01 00 00 00 00 03 F0 5A 5A - 39 01 00 00 00 00 03 51 00 01 - 39 01 00 00 00 00 03 F0 A5 A5 - 39 01 00 00 00 00 03 F0 5A 5A - 15 01 00 00 00 00 02 B0 01 - 15 01 00 00 64 00 02 CD 02 - 15 01 00 00 00 00 02 53 22 - 15 01 00 00 00 00 02 B0 A5 - 15 01 00 00 00 00 02 C7 00 - 39 01 00 00 00 00 03 F0 A5 A5 - 39 01 00 00 00 00 03 9F A5 A5 - 15 01 00 00 00 00 02 35 00 - 39 01 00 00 00 00 03 9F 5A 5A - 39 01 00 00 00 00 03 9F A5 A5 - 39 01 00 00 00 00 03 F0 5A 5A - 39 01 00 00 00 00 03 51 00 01 - 39 01 00 00 00 00 03 F0 A5 A5 - 05 01 00 00 00 00 01 29 - 39 01 00 00 00 00 03 9F 5A 5A + 39 01 00 00 00 00 03 9F A5 A5 + 05 01 00 00 05 00 01 11 + 39 01 00 00 00 00 03 9F 5A 5A + 39 01 00 00 00 00 03 f0 5a 5a + 15 01 00 00 00 00 02 b0 01 + 15 01 00 00 53 00 02 cd 02 + 15 01 00 00 00 00 02 53 20 + 15 01 00 00 00 00 02 b0 a5 + 15 01 00 00 00 00 02 c7 00 + 15 01 00 00 00 00 02 53 22 + 39 01 00 00 00 00 03 f0 a5 a5 + 39 01 00 00 00 00 03 9F A5 A5 + 05 01 00 00 00 00 01 29 + 39 01 00 00 00 00 03 9F 5A 5A ]; qcom,mdss-dsi-panel-aod-on-command-3 = [ 39 01 00 00 00 00 03 F0 5A 5A @@ -317,60 +302,123 @@ 39 01 00 00 00 00 02 53 20 ]; qcom,mdss-dsi-panel-aod-off-command = [ - //39 01 00 00 00 00 03 9F A5 A5 - //05 01 00 00 0A 00 01 28 - //05 01 00 00 82 00 01 10 - //05 01 00 00 07 00 01 11 - //39 01 00 00 00 00 03 9F 5A 5A - 39 01 00 00 00 00 03 F0 5A 5A + /*ELVSS OFF*/ + 39 01 00 00 00 00 03 F0 5A 5A + 15 01 00 00 00 00 02 B0 08 + 15 01 00 00 00 00 02 B7 12 + 39 01 00 00 00 00 03 F0 A5 A5 + /*DLY OFF*/ + 39 01 00 00 00 00 03 F0 5A 5A + 39 01 00 00 00 00 04 B7 00 01 5B + 39 01 00 00 00 00 03 F0 A5 A5 + 39 01 00 00 00 00 03 F0 5A 5A 15 01 00 00 00 00 02 B0 01 15 01 00 00 00 00 02 CD 01 + 39 01 00 00 00 00 02 53 20 39 01 00 00 00 00 03 F0 A5 A5 + /*DLY ON*/ + 39 01 00 00 00 00 03 F0 5A 5A + 39 01 00 00 00 00 04 B7 00 01 53 + 39 01 00 00 00 00 03 F0 A5 A5 + ]; + qcom,mdss-dsi-panel-aod-off-samsung-command = [ + 39 01 00 00 00 00 03 9F A5 A5 + 05 01 00 00 0A 00 01 28 + 05 01 00 00 80 00 01 10 + 39 01 00 00 00 00 03 F0 5A 5A + 15 01 00 00 00 00 02 B0 05 + 15 01 00 00 00 00 02 F4 01 + 39 01 00 00 32 00 03 F0 A5 A5 + 05 01 00 00 07 00 01 11 + 39 01 00 00 00 00 03 9F 5A 5A 39 01 00 00 00 00 03 F0 5A 5A + 15 01 00 00 00 00 02 B0 01 + 15 01 00 00 00 00 02 CD 01 15 01 00 00 00 00 02 B0 07 15 01 00 00 00 00 02 B7 01 15 01 00 00 00 00 02 B0 08 15 01 00 00 00 00 02 B7 12 39 01 00 00 00 00 03 F0 A5 A5 - 39 01 00 00 00 00 02 53 20 + 15 01 00 00 00 00 02 53 28 39 01 00 00 00 00 03 9F A5 A5 + 05 01 00 00 00 00 01 13 05 01 00 00 00 00 01 29 - 39 01 00 00 00 00 03 9F 5A 5A + 39 01 00 00 00 00 03 9F 5A 5A ]; - qcom,mdss-dsi-panel-aod-off-samsung-command = [ + qcom,mdss-dsi-panel-aod-off-new-command = [ 39 01 00 00 00 00 03 9F A5 A5 05 01 00 00 0A 00 01 28 - 05 01 00 00 82 00 01 10 - 05 01 00 00 07 00 01 11 + 05 01 00 00 00 00 01 10 39 01 00 00 00 00 03 9F 5A 5A 39 01 00 00 00 00 03 F0 5A 5A + 15 01 00 00 00 00 02 B0 05 + 15 01 00 00 00 00 02 F4 01 + 39 01 00 00 96 00 03 F0 A5 A5 + 39 01 00 00 00 00 03 9F A5 A5 + 05 01 00 00 0A 00 02 11 00 + 39 01 00 00 00 00 03 9F 5A 5A + /*FD setting*/ + 39 01 00 00 00 00 03 F0 5A 5A 15 01 00 00 00 00 02 B0 01 15 01 00 00 00 00 02 CD 01 - 39 01 00 00 38 00 03 F0 A5 A5 + 39 01 00 00 0F 00 03 F0 A5 A5 + /*TE ON*/ + 39 01 00 00 00 00 03 9F A5 A5 + 15 01 00 00 00 00 02 35 00 + 39 01 00 00 00 00 03 9F 5A 5A + /*MIC Setting*/ + 39 01 00 00 00 00 03 F0 5A 5A + 39 01 00 00 00 00 08 EB 17 41 92 0E 10 82 5A + 39 01 00 00 00 00 03 F0 A5 A5 + /*CASET/PASET*/ + 39 01 00 00 00 00 05 2A 00 00 04 37 + 39 01 00 00 00 00 05 2B 00 00 09 23 + /*TSP H_sync Setting*/ + 39 01 00 00 00 00 03 F0 5A 5A + 39 01 00 00 00 00 02 B0 09 + 39 01 00 00 00 00 03 E8 10 30 + 39 01 00 00 00 00 03 F0 A5 A5 + /*Dimming Setting*/ 39 01 00 00 00 00 03 F0 5A 5A 15 01 00 00 00 00 02 B0 07 15 01 00 00 00 00 02 B7 01 15 01 00 00 00 00 02 B0 08 15 01 00 00 00 00 02 B7 12 39 01 00 00 00 00 03 F0 A5 A5 - 15 01 00 00 64 00 02 53 28 + 39 01 00 00 00 00 03 F0 5A 5A + 15 01 00 00 00 00 02 53 20 + 39 01 00 00 00 00 03 F0 A5 A5 + /*Display on*/ 39 01 00 00 00 00 03 9F A5 A5 - 05 01 00 00 00 00 01 13 - 05 01 00 00 32 00 01 29 - 39 01 00 00 00 00 03 9F 5A 5A + 05 01 00 00 00 00 02 29 00 + 39 01 00 00 00 00 03 9F 5A 5A ]; + qcom,mdss-dsi-panel-aod-off-new-command-state = "dsi_lp_mode"; qcom,mdss-dsi-panel-aod-off-samsung-command-state = "dsi_lp_mode"; qcom,mdss-dsi-panel-aod-off-hbm-on-command = [ - 39 01 00 00 00 00 03 51 03 FF - 39 01 00 00 00 00 02 53 E0 + + 39 01 00 00 00 00 03 F0 5A 5A + 39 01 00 00 00 00 02 B0 07 + 39 01 00 00 00 00 02 B7 01 + 39 01 00 00 00 00 02 B0 08 + 39 01 00 00 00 00 02 B7 12 + 39 01 00 00 00 00 03 F0 A5 A5 + 39 01 00 00 00 00 03 51 03 FF + 39 01 00 00 00 00 02 53 E0 ]; - qcom,mdss-dsi-panel-aod-off-hbm-on-command-state = "dsi_hs_mode"; + qcom,mdss-dsi-panel-aod-off-hbm-on-command-state = "dsi_lp_mode"; qcom,mdss-dsi-panel-hbm-off-aod-on-command = [ - 39 01 00 00 00 00 02 53 20 + 39 01 00 00 00 00 02 53 22 + 39 01 00 00 00 00 03 F0 5A 5A + 15 01 00 00 00 00 02 B0 07 + 15 01 00 00 00 00 02 B7 01 + 15 01 00 00 00 00 02 B0 08 + 15 01 00 00 00 00 02 B7 12 + 39 01 00 00 00 00 03 F0 A5 A5 ]; - qcom,mdss-dsi-panel-hbm-off-aod-on-command-state = "dsi_hs_mode"; - qcom,mdss-dsi-aod-on-command-state = "dsi_hs_mode"; - qcom,mdss-dsi-aod-off-command-state = "dsi_hs_mode"; + qcom,mdss-dsi-panel-hbm-off-aod-on-command-state = "dsi_lp_mode"; + qcom,mdss-dsi-aod-on-command-state = "dsi_lp_mode"; + qcom,mdss-dsi-aod-off-command-state = "dsi_lp_mode"; qcom,mdss-dsi-aod-mode-command-state = "dsi_lp_mode"; qcom,mdss-dsi-panel-serial-num-command = [ 06 01 00 00 00 00 01 A1 @@ -378,7 +426,7 @@ qcom,mdss-dsi-panel-serial-num-command-state = "dsi_lp_mode"; qcom,mdss-dsi-panel-srgb-on-command = [ - 39 01 00 00 00 00 02 81 90 + 39 01 00 00 12 00 02 81 90 39 01 00 00 00 00 03 f0 5A 5A 39 01 00 00 00 00 02 B0 02 39 01 00 00 00 00 16 B1 a6 04 04 47 DF 10 05 05 C3 4C EF D4 Bb 0B BF f1 EB 18 fe f9 d8 @@ -390,11 +438,11 @@ 39 01 00 00 00 00 03 B1 00 01 39 01 00 00 00 00 03 F0 A5 A5 ]; - qcom,mdss-dsi-srgb-on-command-state = "dsi_lp_mode"; - qcom,mdss-dsi-srgb-off-command-state = "dsi_lp_mode"; + qcom,mdss-dsi-panel-srgb-on-command-state = "dsi_lp_mode"; + qcom,mdss-dsi-panel-srgb-off-command-state = "dsi_lp_mode"; qcom,mdss-dsi-panel-dci-p3-on-command = [ - 39 01 00 00 00 00 02 81 90 + 39 01 00 00 12 00 02 81 90 39 01 00 00 00 00 03 f0 5A 5A 39 01 00 00 00 00 02 B0 02 39 01 00 00 00 00 16 B1 C6 00 00 21 ED 02 08 06 c1 27 FC dC E4 00 D9 e6 e7 00 fe f9 d8 @@ -406,11 +454,11 @@ 39 01 00 00 00 00 03 B1 00 01 39 01 00 00 00 00 03 F0 A5 A5 ]; - qcom,mdss-dsi-dci-p3-on-command-state = "dsi_lp_mode"; - qcom,mdss-dsi-dci-p3-off-command-state = "dsi_lp_mode"; + qcom,mdss-dsi-panel-dci-p3-on-command-state = "dsi_lp_mode"; + qcom,mdss-dsi-panel-dci-p3-off-command-state = "dsi_lp_mode"; qcom,mdss-dsi-panel-night-mode-on-command = [ - 39 01 00 00 00 00 02 81 90 + 39 01 00 00 12 00 02 81 90 39 01 00 00 00 00 03 f0 5A 5A 39 01 00 00 00 00 02 B0 02 39 01 00 00 00 00 16 B1 a6 04 04 47 DF 10 05 05 C3 4C EF D4 Bb 0B BF f1 EB 18 FF FE FA @@ -422,11 +470,11 @@ 39 01 00 00 00 00 03 B1 00 01 39 01 00 00 00 00 03 F0 A5 A5 ]; - qcom,mdss-dsi-night-mode-on-command-state = "dsi_lp_mode"; - qcom,mdss-dsi-night-mode-off-command-state = "dsi_lp_mode"; + qcom,mdss-dsi-panel-night-mode-on-command-state = "dsi_lp_mode"; + qcom,mdss-dsi-panel-night-mode-off-command-state = "dsi_lp_mode"; qcom,mdss-dsi-panel-oneplus-mode-on-command = [ - 39 01 00 00 00 00 02 81 90 + 39 01 00 00 12 00 02 81 90 39 01 00 00 00 00 03 f0 5A 5A 39 01 00 00 00 00 02 B0 02 39 01 00 00 00 00 16 B1 b4 02 04 05 ff 02 00 00 ff 00 ff ff f0 00 f0 e0 e1 18 ff fe fB @@ -439,10 +487,10 @@ 39 01 00 00 00 00 03 F0 A5 A5 ]; qcom,mdss-dsi-panel-oneplus-mode-on-command-state = "dsi_lp_mode"; - qcom,mdss-dsi-panel-oneplus-mode-off-command-state = "dsi_lp_mode"; + qcom,mdss-dsi-panel-oneplus-mode-off-comman-state = "dsi_lp_mode"; qcom,mdss-dsi-panel-adaption-mode-on-command = [ - 39 01 00 00 00 00 02 81 90 + 39 01 00 00 12 00 02 81 90 39 01 00 00 00 00 03 f0 5A 5A 39 01 00 00 00 00 02 B0 02 39 01 00 00 00 00 16 B1 C6 00 00 12 f8 02 04 00 c1 13 e9 de d5 00 e0 e4 e7 00 fb ff ff @@ -454,8 +502,8 @@ 39 01 00 00 00 00 03 B1 00 01 39 01 00 00 00 00 03 F0 A5 A5 ]; - qcom,mdss-dsi-adaption-mode-on-command-state = "dsi_lp_mode"; - qcom,mdss-dsi-adaption-mode-off-command-state = "dsi_lp_mode"; + qcom,mdss-dsi-panel-adaption-mode-on-command-state = "dsi_lp_mode"; + qcom,mdss-dsi-panel-adaption-mode-off-command-state = "dsi_lp_mode"; qcom,mdss-dsi-panel-status-command = [06 01 00 01 05 00 02 0E 08]; qcom,mdss-dsi-panel-status-command-state = "dsi_lp_mode"; qcom,mdss-dsi-panel-id-command = [06 01 00 01 05 00 02 DC 08]; diff --git a/arch/arm64/boot/dts/qcom/enchilada.dtsi b/arch/arm64/boot/dts/qcom/enchilada.dtsi index 9527d2e06954..062a2706a16e 100755 --- a/arch/arm64/boot/dts/qcom/enchilada.dtsi +++ b/arch/arm64/boot/dts/qcom/enchilada.dtsi @@ -2069,6 +2069,7 @@ status = "disabled"; &qupv3_se0_spi { status = "ok"; + qcom,disable-autosuspend; ese@0 { compatible = "nxp,p61"; diff --git a/arch/arm64/boot/dts/qcom/fajita-dvt-bu.dtsi b/arch/arm64/boot/dts/qcom/fajita-dvt-bu.dtsi new file mode 100644 index 000000000000..d1ff91d17f1b --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-dvt-bu.dtsi @@ -0,0 +1,20 @@ +/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +/*don't suggest add to this file, this file is only for different hw*/ + +&vendor { + +}; + +&soc { + +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-dvt-v2.1-bu-overlay.dts b/arch/arm64/boot/dts/qcom/fajita-dvt-v2.1-bu-overlay.dts new file mode 100644 index 000000000000..148cc5969b80 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-dvt-v2.1-bu-overlay.dts @@ -0,0 +1,33 @@ +/* Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +/plugin/; + +#include +#include +#include +#include +#include + +#include "sdm845-sde-display.dtsi" +#include "sdm845-mtp.dtsi" +#include "sdm845-audio-overlay.dtsi" +#include "fajita.dtsi" +#include "fajita-dvt-bu.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. SDM845 v2.1 MTP DVT 2nd"; + compatible = "qcom,sdm845-mtp", "qcom,sdm845", "qcom,mtp"; + qcom,msm-id = <321 0x20001>; + qcom,board-id = <8 0 18801 35>; +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-dvt-v2.1-overlay.dts b/arch/arm64/boot/dts/qcom/fajita-dvt-v2.1-overlay.dts new file mode 100644 index 000000000000..914d27d58612 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-dvt-v2.1-overlay.dts @@ -0,0 +1,33 @@ +/* Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +/plugin/; + +#include +#include +#include +#include +#include + +#include "sdm845-sde-display.dtsi" +#include "sdm845-mtp.dtsi" +#include "sdm845-audio-overlay.dtsi" +#include "fajita.dtsi" +#include "fajita-dvt.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. SDM845 v2.1 MTP DVT"; + compatible = "qcom,sdm845-mtp", "qcom,sdm845", "qcom,mtp"; + qcom,msm-id = <321 0x20001>; + qcom,board-id = <8 0 18801 34>; +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-dvt.dtsi b/arch/arm64/boot/dts/qcom/fajita-dvt.dtsi new file mode 100644 index 000000000000..d1ff91d17f1b --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-dvt.dtsi @@ -0,0 +1,20 @@ +/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +/*don't suggest add to this file, this file is only for different hw*/ + +&vendor { + +}; + +&soc { + +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-evb-v2.1-overlay.dts b/arch/arm64/boot/dts/qcom/fajita-evb-v2.1-overlay.dts new file mode 100644 index 000000000000..5286fc1f2c32 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-evb-v2.1-overlay.dts @@ -0,0 +1,33 @@ +/* Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +/plugin/; + +#include +#include +#include +#include +#include + +#include "sdm845-sde-display.dtsi" +#include "sdm845-mtp.dtsi" +#include "sdm845-audio-overlay.dtsi" +#include "fajita.dtsi" +#include "fajita-evb.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. SDM845 v2.1 MTP EVB"; + compatible = "qcom,sdm845-mtp", "qcom,sdm845", "qcom,mtp"; + qcom,msm-id = <321 0x20001>; + qcom,board-id = <8 0 18801 31>; +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-evb.dtsi b/arch/arm64/boot/dts/qcom/fajita-evb.dtsi new file mode 100644 index 000000000000..2e343c004c1b --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-evb.dtsi @@ -0,0 +1,26 @@ +/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +/*don't suggest add to this file, this file is only for different hw*/ + +&vendor { + +}; + +&soc { + +}; + +&qupv3_se12_i2c { + synaptics-rmi-ts@20 { + synaptics,1v8-gpio = <&tlmm 100 0x00>; + }; +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-evt1-v2.1-overlay.dts b/arch/arm64/boot/dts/qcom/fajita-evt1-v2.1-overlay.dts new file mode 100644 index 000000000000..934754eca8c1 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-evt1-v2.1-overlay.dts @@ -0,0 +1,33 @@ +/* Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +/plugin/; + +#include +#include +#include +#include +#include + +#include "sdm845-sde-display.dtsi" +#include "sdm845-mtp.dtsi" +#include "sdm845-audio-overlay.dtsi" +#include "fajita.dtsi" +#include "fajita-evt1.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. SDM845 v2.1 MTP EVT1"; + compatible = "qcom,sdm845-mtp", "qcom,sdm845", "qcom,mtp"; + qcom,msm-id = <321 0x20001>; + qcom,board-id = <8 0 18801 33>; +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-evt1.dtsi b/arch/arm64/boot/dts/qcom/fajita-evt1.dtsi new file mode 100644 index 000000000000..94cee095e46f --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-evt1.dtsi @@ -0,0 +1,66 @@ +/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +/*don't suggest add to this file, this file is only for different hw*/ + +&vendor { + +}; + +&soc { + +}; + +&qusb_phy0 { + qcom,usb-oe-exist; + qcom,overwrite-bias2-disable; + qcom,qusb-phy-init-seq = + /* */ + <0x23 0x210 /* PWR_CTRL1 */ + 0x03 0x04 /* PLL_ANALOG_CONTROLS_TWO */ + 0x7c 0x18c /* PLL_CLOCK_INVERTERS */ + 0x80 0x2c /* PLL_CMODE */ + 0x0a 0x184 /* PLL_LOCK_DELAY */ + 0x19 0xb4 /* PLL_DIGITAL_TIMERS_TWO */ + 0x40 0x194 /* PLL_BIAS_CONTROL_1 */ + 0x16 0x198 /* PLL_BIAS_CONTROL_2 */ + 0x21 0x214 /* PWR_CTRL2 */ + 0x07 0x220 /* IMP_CTRL1 */ + 0x58 0x224 /* IMP_CTRL2 */ + 0x47 0x240 /* TUNE1 */ + 0x2b 0x244 /* TUNE2 */ + 0xca 0x248 /* TUNE3 */ + 0x04 0x24c /* TUNE4 */ + 0x03 0x250 /* TUNE5 */ + 0x00 0x23c /* CHG_CTRL2 */ + 0x22 0x210>; /* PWR_CTRL1 */ + + qcom,qusb-phy-ophost-init-seq = + /* */ + <0x23 0x210 /* PWR_CTRL1 */ + 0x03 0x04 /* PLL_ANALOG_CONTROLS_TWO */ + 0x7c 0x18c /* PLL_CLOCK_INVERTERS */ + 0x80 0x2c /* PLL_CMODE */ + 0x0a 0x184 /* PLL_LOCK_DELAY */ + 0x19 0xb4 /* PLL_DIGITAL_TIMERS_TWO */ + 0x40 0x194 /* PLL_BIAS_CONTROL_1 */ + 0x21 0x198 /* PLL_BIAS_CONTROL_2 */ + 0x21 0x214 /* PWR_CTRL2 */ + 0x07 0x220 /* IMP_CTRL1 */ + 0x58 0x224 /* IMP_CTRL2 */ + 0x46 0x240 /* TUNE1 */ + 0x2b 0x244 /* TUNE2 */ + 0xca 0x248 /* TUNE3 */ + 0x04 0x24c /* TUNE4 */ + 0x03 0x250 /* TUNE5 */ + 0x00 0x23c /* CHG_CTRL2 */ + 0x22 0x210>; /* PWR_CTRL1 */ +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-mp-spec.dtsi b/arch/arm64/boot/dts/qcom/fajita-mp-spec.dtsi new file mode 100644 index 000000000000..d1ff91d17f1b --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-mp-spec.dtsi @@ -0,0 +1,20 @@ +/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +/*don't suggest add to this file, this file is only for different hw*/ + +&vendor { + +}; + +&soc { + +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-mp-v2.1-spec-overlay.dts b/arch/arm64/boot/dts/qcom/fajita-mp-v2.1-spec-overlay.dts new file mode 100644 index 000000000000..17386bf574bf --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-mp-v2.1-spec-overlay.dts @@ -0,0 +1,33 @@ +/* Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +/plugin/; + +#include +#include +#include +#include +#include + +#include "sdm845-sde-display.dtsi" +#include "sdm845-mtp.dtsi" +#include "sdm845-audio-overlay.dtsi" +#include "fajita.dtsi" +#include "fajita-mp-spec.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. SDM845 v2.1 MTP MP spec"; + compatible = "qcom,sdm845-mtp", "qcom,sdm845", "qcom,mtp"; + qcom,msm-id = <321 0x20001>; + qcom,board-id = <8 0 18801 45>; +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-pvt-bu.dtsi b/arch/arm64/boot/dts/qcom/fajita-pvt-bu.dtsi new file mode 100644 index 000000000000..d1ff91d17f1b --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-pvt-bu.dtsi @@ -0,0 +1,20 @@ +/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +/*don't suggest add to this file, this file is only for different hw*/ + +&vendor { + +}; + +&soc { + +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-pvt-spec.dtsi b/arch/arm64/boot/dts/qcom/fajita-pvt-spec.dtsi new file mode 100644 index 000000000000..d1ff91d17f1b --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-pvt-spec.dtsi @@ -0,0 +1,20 @@ +/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +/*don't suggest add to this file, this file is only for different hw*/ + +&vendor { + +}; + +&soc { + +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-pvt-v1.dtsi b/arch/arm64/boot/dts/qcom/fajita-pvt-v1.dtsi new file mode 100644 index 000000000000..d1ff91d17f1b --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-pvt-v1.dtsi @@ -0,0 +1,20 @@ +/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +/*don't suggest add to this file, this file is only for different hw*/ + +&vendor { + +}; + +&soc { + +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-pvt-v2.1-bu-overlay.dts b/arch/arm64/boot/dts/qcom/fajita-pvt-v2.1-bu-overlay.dts new file mode 100644 index 000000000000..4e18ae61e10b --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-pvt-v2.1-bu-overlay.dts @@ -0,0 +1,33 @@ +/* Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +/plugin/; + +#include +#include +#include +#include +#include + +#include "sdm845-sde-display.dtsi" +#include "sdm845-mtp.dtsi" +#include "sdm845-audio-overlay.dtsi" +#include "fajita.dtsi" +#include "fajita-pvt-bu.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. SDM845 v2.1 MTP PVT/MP 2nd"; + compatible = "qcom,sdm845-mtp", "qcom,sdm845", "qcom,mtp"; + qcom,msm-id = <321 0x20001>; + qcom,board-id = <8 0 18801 42>; +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-pvt-v2.1-overlay.dts b/arch/arm64/boot/dts/qcom/fajita-pvt-v2.1-overlay.dts new file mode 100644 index 000000000000..76a31da29cb3 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-pvt-v2.1-overlay.dts @@ -0,0 +1,33 @@ +/* Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +/plugin/; + +#include +#include +#include +#include +#include + +#include "sdm845-sde-display.dtsi" +#include "sdm845-mtp.dtsi" +#include "sdm845-audio-overlay.dtsi" +#include "fajita.dtsi" +#include "fajita-pvt.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. SDM845 v2.1 MTP PVT/MP"; + compatible = "qcom,sdm845-mtp", "qcom,sdm845", "qcom,mtp"; + qcom,msm-id = <321 0x20001>; + qcom,board-id = <8 0 18801 41>; +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-pvt-v2.1-spec-overlay.dts b/arch/arm64/boot/dts/qcom/fajita-pvt-v2.1-spec-overlay.dts new file mode 100644 index 000000000000..04dcbf331da1 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-pvt-v2.1-spec-overlay.dts @@ -0,0 +1,33 @@ +/* Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +/plugin/; + +#include +#include +#include +#include +#include + +#include "sdm845-sde-display.dtsi" +#include "sdm845-mtp.dtsi" +#include "sdm845-audio-overlay.dtsi" +#include "fajita.dtsi" +#include "fajita-pvt-spec.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. SDM845 v2.1 MTP PVT/MP spec"; + compatible = "qcom,sdm845-mtp", "qcom,sdm845", "qcom,mtp"; + qcom,msm-id = <321 0x20001>; + qcom,board-id = <8 0 18801 44>; +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-pvt-v2.1-v1-overlay.dts b/arch/arm64/boot/dts/qcom/fajita-pvt-v2.1-v1-overlay.dts new file mode 100644 index 000000000000..876235e7b1be --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-pvt-v2.1-v1-overlay.dts @@ -0,0 +1,33 @@ +/* Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +/plugin/; + +#include +#include +#include +#include +#include + +#include "sdm845-sde-display.dtsi" +#include "sdm845-mtp.dtsi" +#include "sdm845-audio-overlay.dtsi" +#include "fajita.dtsi" +#include "fajita-pvt-v1.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. SDM845 v2.1 MTP PVT/MP v1"; + compatible = "qcom,sdm845-mtp", "qcom,sdm845", "qcom,mtp"; + qcom,msm-id = <321 0x20001>; + qcom,board-id = <8 0 18801 43>; +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-pvt.dtsi b/arch/arm64/boot/dts/qcom/fajita-pvt.dtsi new file mode 100644 index 000000000000..d1ff91d17f1b --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-pvt.dtsi @@ -0,0 +1,20 @@ +/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +/*don't suggest add to this file, this file is only for different hw*/ + +&vendor { + +}; + +&soc { + +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-t0-v2.1-overlay.dts b/arch/arm64/boot/dts/qcom/fajita-t0-v2.1-overlay.dts new file mode 100644 index 000000000000..4037c0c36b6c --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-t0-v2.1-overlay.dts @@ -0,0 +1,33 @@ +/* Copyright (c) 2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; +/plugin/; + +#include +#include +#include +#include +#include + +#include "sdm845-sde-display.dtsi" +#include "sdm845-mtp.dtsi" +#include "sdm845-audio-overlay.dtsi" +#include "fajita.dtsi" +#include "fajita-t0.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. SDM845 v2.1 MTP t0"; + compatible = "qcom,sdm845-mtp", "qcom,sdm845", "qcom,mtp"; + qcom,msm-id = <321 0x20001>; + qcom,board-id = <8 0 18801 32>; +}; diff --git a/arch/arm64/boot/dts/qcom/fajita-t0.dtsi b/arch/arm64/boot/dts/qcom/fajita-t0.dtsi new file mode 100644 index 000000000000..d1ff91d17f1b --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita-t0.dtsi @@ -0,0 +1,20 @@ +/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +/*don't suggest add to this file, this file is only for different hw*/ + +&vendor { + +}; + +&soc { + +}; diff --git a/arch/arm64/boot/dts/qcom/fajita.dtsi b/arch/arm64/boot/dts/qcom/fajita.dtsi new file mode 100755 index 000000000000..b417a7be8cd8 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/fajita.dtsi @@ -0,0 +1,2359 @@ +/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +/*recommand add our code to this dtsi*/ +#include "dsi-panel-samsung_s6e3fc1_cmd.dtsi" +#include "dsi-panel-samsung_sofef00_m_cmd.dtsi" +#include "dsi-panel-samsung_sofef00_m_video.dtsi" +#include "dsi-panel-samsung_sefeg01_s_cmd.dtsi" +#include "dsi-panel-samsung_s6e3fc2x01.dtsi" +#include "dsi-panel-samsung_dsc.dtsi" + + +/{ +reserved-memory { + +}; +}; + +&vendor { + +}; + +&wdog{ + qcom,bark-time = <15000>; +}; + +&snd_934x { + qcom,audio-routing = + "AIF4 VI", "MCLK", + "RX_BIAS", "MCLK", + "MADINPUT", "MCLK", + "hifi amp", "LINEOUT1", + "hifi amp", "LINEOUT2", + "AMIC1", "MIC BIAS3", + "AMIC2", "MIC BIAS2", + "MIC BIAS2", "Headset Mic", + "AMIC3", "MIC BIAS4", + "MIC BIAS4", "ANCRight Headset Mic", + "AMIC4", "MIC BIAS1", + "MIC BIAS1", "ANCLeft Headset Mic", + "AMIC5", "MIC BIAS3", + "MIC BIAS3", "Handset Mic", + "DMIC0", "MIC BIAS1", + "MIC BIAS1", "Digital Mic0", + "DMIC1", "MIC BIAS1", + "MIC BIAS1", "Digital Mic1", + "DMIC2", "MIC BIAS3", + "MIC BIAS3", "Digital Mic2", + "DMIC3", "MIC BIAS3", + "MIC BIAS3", "Digital Mic3", + "DMIC4", "MIC BIAS4", + "MIC BIAS4", "Digital Mic4", + "DMIC5", "MIC BIAS4", + "MIC BIAS4", "Digital Mic5", + "SpkrLeft IN", "SPK1 OUT", + "SpkrRight IN", "SPK2 OUT"; + op,smartpa ="tfa98xx"; +// qcom,us-euro-gpios = <&tlmm 103 0>; + op,usb_sw; + usb_sw = <&pmi8998_gpios 10 GPIO_ACTIVE_LOW>; + hp_sw = <&tlmm 103 0>; + mbhc_sw = <&tlmm 36 1>; + ldo_sw = <&pmi8998_gpios 6 GPIO_ACTIVE_LOW>; +}; + +&wcd934x_cdc { + qcom,cdc-micbias1-mv = <1800>; + qcom,cdc-micbias2-mv = <2700>; + qcom,cdc-micbias3-mv = <2700>; + qcom,cdc-micbias4-mv = <1800>; +}; + +&soc { + + gpio_keys { + hallsensor_key { + label = "hallsensor_key"; + gpios = <&tlmm 124 1>; + interrupt-parent = <&tlmm>; + interrupts = <124 0x0>; + linux,input-type = <5>; + linux,code = <0>; + gpio-key,wakeup; + debounce-interval = <15>; + }; + }; + + + qcom,qbt1000 { + status = "disabled"; + }; + + fingerprint_detect { + compatible = "oneplus,fpdetect"; + fp-gpio-id0 = <&tlmm 91 0>; + pinctrl-names = "fp_id_up", "fp_id_down"; + pinctrl-0 = <&fp_id0_up>; + pinctrl-1 = <&fp_id0_down>; + oem,fajta; + }; + + fpc_fpc1020 { + compatible = "fpc,fpc1020"; + interrupt-parent = <&tlmm>; + fpc,irq-gpio = <&tlmm 121 0>; + fpc,reset-gpio = <&tlmm 35 0>; + pinctrl-names = "fp_reset_high", "fp_reset_low"; + pinctrl-0 = <&fp_reset_high>; + pinctrl-1 = <&fp_reset_low>; + }; + + goodix_fp { + compatible = "goodix,fingerprint"; + interrupt-parent = <&tlmm>; + vdd-3v2-supply = <&pm8998_l22>; + vdd-voltage = <3200000 3200000>; + vdd-current = <50000>; + fp-gpio-irq = <&tlmm 121 0x00>; + fp-gpio-reset = <&tlmm 35 0x00>; + fp-gpio-enable = <&tlmm 80 0x00>; + pinctrl-names = "fp_en_init", "fp_dis_init"; + pinctrl-0 = <&fp_enable_init &fp_irq_init>; + pinctrl-1 = <&fp_disable_init>; + oem,fajta; + status = "okay"; + }; + + silead_fp { + compatible = "sil,fingerprint"; + interrupt-parent = <&tlmm>; + avdd-supply = <&pm8998_l22>; + irq-gpios = <&tlmm 121 0x00>; + rst-gpios = <&tlmm 35 0x00>; + pinctrl-names = "fp_en_init"; + pinctrl-0 = <&fp_reset_init &fp_irq_init>; + oem,fajta; + status = "okay"; + }; + + tri_state_key { + compatible = "oneplus,tri-state-key"; + status = "okay"; + interrupt-parent = <&tlmm>; + tristate,gpio_key1 = <&tlmm 24 0x00>; + tristate,gpio_key2 = <&tlmm 52 0x00>; + tristate,gpio_key3 = <&tlmm 126 0x00>; + pinctrl-names = + "pmx_tri_state_key_active", "pmx_tri_state_key_suspend"; + pinctrl-0 = <&tri_state_key_active>; + pinctrl-1 = <&tri_state_key_suspend>; + }; + + dsi_panel_pwr_supply_no_labibb_2: dsi_panel_pwr_supply_no_labibb_2 { + #address-cells = <1>; + #size-cells = <0>; + qcom,panel-supply-entry@0 { + reg = <0>; + qcom,supply-name = "vddio"; + qcom,supply-min-voltage = <1850000>; + qcom,supply-max-voltage = <1850000>; + qcom,supply-enable-load = <62000>; + qcom,supply-disable-load = <80>; + qcom,supply-post-on-sleep = <0>; + }; + }; + + dsi_samsung_s6e3fc1_cmd_display: qcom,dsi-display@17 { + compatible = "qcom,dsi-display"; + label = "dsi_samsung_s6e3fc1_cmd_display"; + qcom,display-type = "primary"; + qcom,dsi-ctrl = <&mdss_dsi0>; + qcom,dsi-phy = <&mdss_dsi_phy0>; + clocks = <&mdss_dsi0_pll BYTECLK_MUX_0_CLK>, + <&mdss_dsi0_pll PCLK_MUX_0_CLK>; + clock-names = "src_byte_clk", "src_pixel_clk"; + pinctrl-names = "panel_active", "panel_suspend"; + pinctrl-0 = <&sde_dsi_active &sde_te_active &esd_check_active>; + pinctrl-1 = <&sde_dsi_suspend &sde_te_suspend &esd_check_suspend>; + qcom,dsi-panel = <&dsi_samsung_s6e3fc1_cmd>; + vddio-supply = <&pm8998_l14>; + qcom,platform-te-gpio = <&tlmm 30 0>; + }; + + dsi_samsung_sofef00_m_cmd_display: qcom,dsi-display@18 { + compatible = "qcom,dsi-display"; + label = "dsi_samsung_sofef00_m_cmd_display"; + qcom,display-type = "primary"; + qcom,dsi-ctrl = <&mdss_dsi0>; + qcom,dsi-phy = <&mdss_dsi_phy0>; + clocks = <&mdss_dsi0_pll BYTECLK_MUX_0_CLK>, + <&mdss_dsi0_pll PCLK_MUX_0_CLK>; + clock-names = "src_byte_clk", "src_pixel_clk"; + pinctrl-names = "panel_active", "panel_suspend"; + pinctrl-0 = <&sde_dsi_active &sde_te_active &esd_check_active>; + pinctrl-1 = <&sde_dsi_suspend &sde_te_suspend &esd_check_suspend>; + qcom,dsi-panel = <&dsi_samsung_sofef00_m_cmd>; + vddio-supply = <&pm8998_l14>; + qcom,platform-te-gpio = <&tlmm 30 0>; + }; + + dsi_samsung_sofef00_m_video_display: qcom,dsi-display@19 { + compatible = "qcom,dsi-display"; + label = "dsi_samsung_sofef00_m_video_display"; + qcom,display-type = "primary"; + qcom,dsi-ctrl = <&mdss_dsi0>; + qcom,dsi-phy = <&mdss_dsi_phy0>; + clocks = <&mdss_dsi0_pll BYTECLK_MUX_0_CLK>, + <&mdss_dsi0_pll PCLK_MUX_0_CLK>; + clock-names = "src_byte_clk", "src_pixel_clk"; + pinctrl-names = "panel_active", "panel_suspend"; + pinctrl-0 = <&sde_dsi_active &sde_te_active &esd_check_active>; + pinctrl-1 = <&sde_dsi_suspend &sde_te_suspend &esd_check_suspend>; + qcom,dsi-panel = <&dsi_samsung_sofef00_m_video>; + vddio-supply = <&pm8998_l14>; + qcom,platform-te-gpio = <&tlmm 30 0>; + }; + +dsi_samsung_sofeg01_s_cmd_display: qcom,dsi-display@20 { + compatible = "qcom,dsi-display"; + label = "dsi_samsung_sofeg01_s_cmd_display"; + qcom,display-type = "primary"; + qcom,dsi-ctrl = <&mdss_dsi0>; + qcom,dsi-phy = <&mdss_dsi_phy0>; + clocks = <&mdss_dsi0_pll BYTECLK_MUX_0_CLK>, + <&mdss_dsi0_pll PCLK_MUX_0_CLK>; + clock-names = "src_byte_clk", "src_pixel_clk"; + pinctrl-names = "panel_active", "panel_suspend"; + pinctrl-0 = <&sde_dsi_active &sde_te_active &esd_check_active>; + pinctrl-1 = <&sde_dsi_suspend &sde_te_suspend &esd_check_suspend>; + qcom,dsi-panel = <&dsi_samsung_sofeg01_s_cmd>; + vddio-supply = <&pm8998_l14>; + qcom,platform-te-gpio = <&tlmm 30 0>; + }; + +dsi_samsung_s6e3fc2x01_cmd_display: qcom,dsi-display@21 { + compatible = "qcom,dsi-display"; + label = "dsi_samsung_s6e3fc2x01_cmd_display"; + qcom,display-type = "primary"; + qcom,dsi-ctrl = <&mdss_dsi0>; + qcom,dsi-phy = <&mdss_dsi_phy0>; + clocks = <&mdss_dsi0_pll BYTECLK_MUX_0_CLK>, + <&mdss_dsi0_pll PCLK_MUX_0_CLK>; + clock-names = "src_byte_clk", "src_pixel_clk"; + pinctrl-names = "panel_active", "panel_suspend"; + pinctrl-0 = <&sde_dsi_active &sde_te_active &esd_check_active>; + pinctrl-1 = <&sde_dsi_suspend &sde_te_suspend &esd_check_suspend>; + qcom,dsi-panel = <&dsi_samsung_s6e3fc2x01_cmd>; + vddio-supply = <&pm8998_l14>; + qcom,platform-te-gpio = <&tlmm 10 0>; + }; + +dsi_samsung_dsc_cmd_display: qcom,dsi-display@22 { + compatible = "qcom,dsi-display"; + label = "dsi_samsung_dsc_cmd_display"; + qcom,display-type = "primary"; + qcom,dsi-ctrl = <&mdss_dsi0>; + qcom,dsi-phy = <&mdss_dsi_phy0>; + clocks = <&mdss_dsi0_pll BYTECLK_MUX_0_CLK>, + <&mdss_dsi0_pll PCLK_MUX_0_CLK>; + clock-names = "src_byte_clk", "src_pixel_clk"; + pinctrl-names = "panel_active", "panel_suspend"; + pinctrl-0 = <&sde_dsi_active &sde_te_active &esd_check_active>; + pinctrl-1 = <&sde_dsi_suspend &sde_te_suspend &esd_check_suspend>; + qcom,dsi-panel = <&dsi_samsung_dsc_cmd>; + vddio-supply = <&pm8998_l14>; + qcom,platform-te-gpio = <&tlmm 10 0>; + }; + + oem_serial_pinctrl { + compatible = "oem,oem_serial_pinctrl"; + pinctrl-names = "uart_pinctrl_active","uart_pinctrl_deactive"; + pinctrl-0 = <&qupv3_se9_2uart_active>; + pinctrl-1 = <&qupv3_se9_2uart_oem_sleep>; + + }; + +}; + +&tlmm { + qupv3_se9_2uart_oem_sleep: qupv3_se9_2uart_oem_sleep { + mux { + pins = "gpio4", "gpio5"; + function = "gpio"; + }; + config { + pins = "gpio4", "gpio5"; + drive-strength = <2>; + bias-pull-down; + }; + }; + +}; + +&qupv3_se9_2uart { + compatible = "qcom,msm-geni-console-oem"; +}; + + +&tlmm{ + config { + pins = "gpio37"; + drive-strength = <2>; + bias-pull-up; + }; +}; +&soc { + gpio_keys { + vol_up { + /delete-property/ gpio-key,wakeup; + }; + vol_down { + label = "volume_down"; + gpios = <&pm8998_gpios 5 GPIO_ACTIVE_LOW>; + linux,input-type = <1>; + linux,code = <114>; + debounce-interval = <15>; + linux,can-disable; + }; + //disable cam_snapshot,and cam_focus + cam_snapshot { + status = "disabled"; + }; + cam_focus { + status = "disabled"; + }; +}; + +}; + +&pm8998_gpios { + key_vol_down { + key_vol_down_default: key_vol_down_default { + pins = "gpio5"; + function = "normal"; + input-enable; + bias-pull-up; + power-source = <0>; + }; + }; +}; + +&soc{ + qcom,qbt1000 { + compatible = "qcom,qbt1000"; + clock-names = "core", "iface"; + clock-frequency = <25000000>; + qcom,ipc-gpio = <&tlmm 121 0>; + qcom,finger-detect-gpio = <&pm8998_gpios 5 0>; + status = "disabled"; + }; + +}; + +&qupv3_se4_i2c { + status = "ok"; + tfa98xx@34 { + compatible = "nxp,tfa9894"; + reg = <0x34>; + reset-gpio = <&tlmm 69 0>; + status = "ok"; + }; +}; + +&pmi8998_gpios { + gpio10_dig_out { + gpio10_dig_out_default: gpio10_dig_out_default { + pins = "gpio10"; /* GPIO 14 */ + function = "normal"; /* normal output */ + power-source = <0>; /* VIN0 */ + output-low; /* digital output, no invert */ + input-disable; /* prevent GPIO from being set to DIO */ + }; + }; +}; + +&pmi8998_gpios { + gpio6_dig_out { + gpio6_dig_out_default: gpio6_dig_out_default { + pins = "gpio6"; /* GPIO 6 */ + function = "normal"; /* normal output */ + power-source = <1>; /* VIN0 */ + output-low; /* digital output, no invert */ + input-disable; /* prevent GPIO from being set to DIO */ + }; + }; +}; + +&pmi8998_gpios { + qnovo_fet_ctrl { + qnovo_fet_ctrl_default: qnovo_fet_ctrl_default { + pins = "gpio6"; + function = "normal"; + output-low; + input-disable; + bias-disable; + power-source = <1>; + qcom,drive-strength = <1>; + }; + }; +}; + + +&qupv3_se7_i2c { + status = "ok"; + fsa4480@42 { + compatible = "fsa,fsa4480"; + reg = <0x42>; + mbhc_en = <&pmi8998_gpios 10 GPIO_ACTIVE_LOW>; + status = "ok"; + }; +}; + +&slim_aud { + tavil_codec { + op,usb_sw; + usb_sw = <&pmi8998_gpios 10 GPIO_ACTIVE_LOW>; + hp_sw = <&tlmm 103 0>; + mbhc_sw = <&tlmm 36 1>; + ldo_sw = <&pmi8998_gpios 6 GPIO_ACTIVE_LOW>; + }; +}; +&qupv3_se12_i2c { + status = "ok"; + synaptics-rmi-ts@20 { + compatible = "HWK,synaptics,s3320"; + reg = <0x20>; + interrupt-parent = <&tlmm>; + interrupts = <125 0x2008>; + //vcc_i2c_1v8-supply = <&pm8998_l6>; + vdd_2v8-supply = <&pm8998_l28>; + synaptics,tx-rx-num = <15 30>; + //synaptics,vdd-voltage = <1808000 1808000>; + synaptics,avdd-voltage = <3008000 3008000>; + //synaptics,vdd-current = <40000>; + synaptics,avdd-current = <20000>; + synaptics,display-coords = <1080 2160>; + synaptics,panel-coords = <1080 2160>; + synaptics,reset-gpio = <&tlmm 99 0x00>; + synaptics,irq-gpio = <&tlmm 125 0x2008>; + synaptics,1v8-gpio = <&tlmm 88 0x00>; + oem,support_1080x2160_tp; + oem,support_1080x2340_tp; + oem,support_hw_poweroff; + pinctrl-names = "pmx_ts_active", "pmx_ts_suspend"; + pinctrl-0 = <&ts_active>; + pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>; + oem,fajta; + }; +}; + + +&wsa881x_0211{ +status = "disabled"; +}; + +&wsa881x_0212{ +status = "disabled"; +}; + +&wsa881x_0213{ +status = "disabled"; +}; + +&wsa881x_0214{ +status = "disabled"; +}; + +&dai_mi2s3 { + qcom,msm-mi2s-rx-lines = <2>; + qcom,msm-mi2s-tx-lines = <1>; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&quat_mi2s_active + &quat_mi2s_sd0_active &quat_mi2s_sd1_active >; + pinctrl-1 = <&quat_mi2s_sleep + &quat_mi2s_sd0_sleep &quat_mi2s_sd1_sleep >; +}; + +&dsi_nt35597_truly_dsc_cmd_display { + /delete-property/qcom,dsi-display-active; +}; + +&mdss_dsi1 { +status = "disabled"; +}; + +&mdss_dsi0_pll { + qcom,ssc-frequency-hz = <33000>; +}; + +&sde_dp { + qcom,aux-en-gpio = <&tlmm 122 0>; + qcom,aux-sel-gpio = <&tlmm 123 0>; + qcom,usbplug-cc-gpio = <&tlmm 38 0>; +}; + +&dsi_samsung_s6e3fc1_cmd { + qcom,dsi-display-active; + qcom,panel-supply-entries = <&dsi_panel_pwr_supply_no_labibb_2>; + qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs"; + qcom,mdss-brightness-max-level = <1023>; + qcom,mdss-dsi-bl-min-level = <1>; + qcom,mdss-dsi-bl-max-level = <1023>; + qcom,platform-reset-gpio = <&tlmm 6 0>; + qcom,platform-vci-gpio = <&tlmm 26 0>; + qcom,platform-poc-gpio = <&tlmm 25 0>; +}; + +&dsi_samsung_s6e3fc1_cmd { + qcom,mdss-dsi-t-clk-post = <0x0E>; + qcom,mdss-dsi-t-clk-pre = <0x34>; + qcom,mdss-dsi-display-timings { + timing@0{ + qcom,mdss-dsi-panel-phy-timings = [00 21 09 09 25 23 09 + 09 06 03 04 00]; + qcom,display-topology = <1 0 1>; + qcom,default-topology-index = <0>; + }; + }; +}; + +&dsi_samsung_sofef00_m_cmd { + qcom,panel-supply-entries = <&dsi_panel_pwr_supply_no_labibb_2>; + qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs"; + qcom,mdss-brightness-max-level = <1023>; + qcom,mdss-dsi-bl-min-level = <1>; + qcom,mdss-dsi-bl-max-level = <1023>; + qcom,platform-reset-gpio = <&tlmm 6 0>; + qcom,platform-vci-gpio = <&tlmm 26 0>; + qcom,platform-poc-gpio = <&tlmm 25 0>; +}; + +&dsi_samsung_sofef00_m_cmd { + qcom,mdss-dsi-t-clk-post = <0x0E>; + qcom,mdss-dsi-t-clk-pre = <0x36>; + qcom,mdss-dsi-display-timings { + timing@0{ + qcom,mdss-dsi-panel-phy-timings = [00 23 09 09 26 24 09 + 09 06 03 04 00]; + qcom,display-topology = <1 0 1>; + qcom,default-topology-index = <0>; + }; + }; +}; + +&dsi_samsung_sofef00_m_video { + qcom,panel-supply-entries = <&dsi_panel_pwr_supply_no_labibb_2>; + qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs"; + qcom,mdss-brightness-max-level = <1023>; + qcom,mdss-dsi-bl-min-level = <1>; + qcom,mdss-dsi-bl-max-level = <1023>; + qcom,platform-reset-gpio = <&tlmm 6 0>; + qcom,platform-vci-gpio = <&tlmm 26 0>; + qcom,platform-poc-gpio = <&tlmm 25 0>; +}; + +&dsi_samsung_sofef00_m_video { + qcom,mdss-dsi-t-clk-post = <0x0E>; + qcom,mdss-dsi-t-clk-pre = <0x36>; + qcom,mdss-dsi-display-timings { + timing@0{ + qcom,mdss-dsi-panel-phy-timings = [00 23 09 09 26 24 09 + 09 06 03 04 00]; + qcom,display-topology = <1 0 1>; + qcom,default-topology-index = <0>; + }; + }; +}; + +&dsi_samsung_sofeg01_s_cmd { + qcom,panel-supply-entries = <&dsi_panel_pwr_supply_no_labibb_2>; + qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs"; + qcom,mdss-brightness-max-level = <1023>; + qcom,mdss-dsi-bl-min-level = <1>; + qcom,mdss-dsi-bl-max-level = <1023>; + qcom,platform-reset-gpio = <&tlmm 6 0>; + qcom,platform-vci-gpio = <&tlmm 26 0>; + qcom,platform-poc-gpio = <&tlmm 25 0>; +}; + +&dsi_samsung_sofeg01_s_cmd { + qcom,mdss-dsi-t-clk-post = <0x0E>; + qcom,mdss-dsi-t-clk-pre = <0x36>; + qcom,mdss-dsi-display-timings { + timing@0{ + qcom,mdss-dsi-panel-phy-timings = [00 23 09 09 26 24 09 + 09 06 03 04 00]; + qcom,display-topology = <1 0 1>; + qcom,default-topology-index = <0>; + }; + }; +}; + +&dsi_samsung_s6e3fc2x01_cmd { + qcom,panel-supply-entries = <&dsi_panel_pwr_supply_no_labibb_2>; + qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs"; + qcom,mdss-brightness-max-level = <1023>; + qcom,mdss-dsi-bl-min-level = <1>; + qcom,mdss-dsi-bl-max-level = <1023>; + qcom,platform-reset-gpio = <&tlmm 6 0>; + qcom,platform-vci-gpio = <&tlmm 26 0>; + qcom,platform-poc-gpio = <&tlmm 25 0>; +}; + +&dsi_samsung_s6e3fc2x01_cmd { + qcom,mdss-dsi-t-clk-post = <0x0E>; + qcom,mdss-dsi-t-clk-pre = <0x35>; + qcom,mdss-dsi-panel-clockrate = <1037000000>;// 518.5MHZ + qcom,mdss-dsi-display-timings { + timing@0{ + qcom,mdss-dsi-panel-phy-timings = [00 22 09 09 25 24 09 + 09 06 03 04 00]; + qcom,display-topology = <1 0 1>; + qcom,default-topology-index = <0>; + }; +}; +}; + + +&dsi_samsung_dsc_cmd { + qcom,panel-supply-entries = <&dsi_panel_pwr_supply_no_labibb_2>; + qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_dcs"; + qcom,mdss-brightness-max-level = <1023>; + qcom,mdss-dsi-bl-min-level = <1>; + qcom,mdss-dsi-bl-max-level = <1023>; + qcom,platform-reset-gpio = <&tlmm 6 0>; + qcom,platform-vci-gpio = <&tlmm 26 0>; + qcom,platform-poc-gpio = <&tlmm 25 0>; +}; + +&dsi_samsung_dsc_cmd { + qcom,mdss-dsi-t-clk-post = <0x0E>; + qcom,mdss-dsi-t-clk-pre = <0x35>; + //qcom,mdss-dsi-panel-clockrate = <1037000000>;// 518.5MHZ + qcom,mdss-dsi-display-timings { + timing@0{ + qcom,mdss-dsi-panel-phy-timings = [00 14 05 05 1F 0A 05 + 05 03 03 04 00]; + qcom,display-topology = <1 1 1>, + <2 2 1>, /* dsc merge */ + <2 1 1>; /* 3d mux */ + qcom,default-topology-index = <1>; + }; + }; +}; + +&qupv3_se4_i2c { + status = "ok"; + max98927@3a { + compatible = "maxim,max98927L"; + reg = <0x3a>; + mono_stereo_mode = <0>; + maxim,98927-reset-gpio = <&tlmm 69 0>; + status = "disabled"; + }; +}; + + +&qusb_phy0 { + qcom,usb-oe-exist; + qcom,overwrite-bias2-disable; + qcom,qusb-phy-init-seq = + /* */ + <0x23 0x210 /* PWR_CTRL1 */ + 0x03 0x04 /* PLL_ANALOG_CONTROLS_TWO */ + 0x7c 0x18c /* PLL_CLOCK_INVERTERS */ + 0x80 0x2c /* PLL_CMODE */ + 0x0a 0x184 /* PLL_LOCK_DELAY */ + 0x19 0xb4 /* PLL_DIGITAL_TIMERS_TWO */ + 0x40 0x194 /* PLL_BIAS_CONTROL_1 */ + 0x12 0x198 /* PLL_BIAS_CONTROL_2 */ + 0x21 0x214 /* PWR_CTRL2 */ + 0x07 0x220 /* IMP_CTRL1 */ + 0x58 0x224 /* IMP_CTRL2 */ + 0x47 0x240 /* TUNE1 */ + 0x2b 0x244 /* TUNE2 */ + 0xca 0x248 /* TUNE3 */ + 0x04 0x24c /* TUNE4 */ + 0x03 0x250 /* TUNE5 */ + 0x00 0x23c /* CHG_CTRL2 */ + 0x22 0x210>; /* PWR_CTRL1 */ + + qcom,qusb-phy-ophost-init-seq = + /* */ + <0x23 0x210 /* PWR_CTRL1 */ + 0x03 0x04 /* PLL_ANALOG_CONTROLS_TWO */ + 0x7c 0x18c /* PLL_CLOCK_INVERTERS */ + 0x80 0x2c /* PLL_CMODE */ + 0x0a 0x184 /* PLL_LOCK_DELAY */ + 0x19 0xb4 /* PLL_DIGITAL_TIMERS_TWO */ + 0x40 0x194 /* PLL_BIAS_CONTROL_1 */ + 0x21 0x198 /* PLL_BIAS_CONTROL_2 */ + 0x21 0x214 /* PWR_CTRL2 */ + 0x07 0x220 /* IMP_CTRL1 */ + 0x58 0x224 /* IMP_CTRL2 */ + 0x46 0x240 /* TUNE1 */ + 0x2b 0x244 /* TUNE2 */ + 0xca 0x248 /* TUNE3 */ + 0x04 0x24c /* TUNE4 */ + 0x03 0x250 /* TUNE5 */ + 0x00 0x23c /* CHG_CTRL2 */ + 0x22 0x210>; /* PWR_CTRL1 */ +}; + +&pmi8998_pdphy { + vbus-supply = <&smb2_vbus>; +}; + +&qupv3_se10_i2c { + qcom,clk-freq-out = <100000>; + bq27541-battery@55 { + status = "ok"; + compatible = "ti,bq27541-battery"; + reg = <0x55>; + qcom,modify-soc-smooth; + }; + + oneplus_fastchg@26{ + status = "ok"; + compatible = "microchip,oneplus_fastchg"; + reg = <0x26>; + microchip,mcu-en-gpio = <&tlmm 102 0x00>; + microchip,usb-sw-1-gpio = <&tlmm 37 0x00>; + microchip,usb-sw-2-gpio = <&tlmm 51 0x00>; + microchip,ap-clk = <&tlmm 43 0x00>; + microchip,ap-data = <&tlmm 44 0x00>; + + pinctrl-names = "mux_fastchg_active", + "mux_fastchg_suspend", + "mcu_data_active", + "mcu_data_suspend"; + pinctrl-0 = <&fastchg_active + &usb_sw_active + &ap_clk_active>; + pinctrl-1 = <&usb_sw_suspend + &fastchg_suspend + &ap_clk_suspend>; + pinctrl-2 =<&ap_data_active>; + pinctrl-3 =<&ap_data_suspend>; + }; +}; + +&mtp_batterydata{ + #include "OP-batterydata-3700mah.dtsi" +}; + +&pm8998_gpios { + gpio12_adc { + gpio12_adc_default: gpio12_adc_default { + pins = "gpio12"; /* GPIO 12 */ + function = "normal"; /* normal */ + bias-pull-up; + bias-high-impedance; /* DISABLE GPIO12 for ADC*/ + }; + }; +}; + +&pm8998_vadc { + chan@36 { + label = "gpio12_adc"; + reg = <0x36>; + qcom,decimation = <2>; + qcom,pre-div-channel-scaling = <0>; + qcom,calibration-type = "absolute"; + qcom,scale-function = <0>; + qcom,hw-settle-time = <2>; + qcom,fast-avg-setup = <0>; + }; +}; + +&pmi8998_charger { + qcom,dc-icl-ua = <1200000>; + qcom,fcc-max-ua = <500000>; + qcom,usb-icl-ua = <1800000>; + qcom,fv-max-uv = <4365000>; + /* ibatmax setting for different temp regions */ + ibatmax-little-cold-ma = <325>; + ibatmax-cool-ma = <500>; + ibatmax-little-cool-ma = <875>; + ibatmax-pre-normal-ma = <1625>; + ibatmax-normal-ma = <1950>; + ibatmax-warm-ma = <875>; + /* vbatmax setting for different temp regions */ + vbatmax-little-cold-mv = <3975>; + vbatmax-cool-mv = <4400>; + vbatmax-little-cool-mv = <4400>; + vbatmax-pre-normal-mv = <4400>; + vbatmax-normal-mv = <4400>; + vbatmax-warm-mv = <4080>; + /* vbatdet setting for different temp regions */ + vbatdet-little-cold-mv = <3700>; + vbatdet-cool-mv = <4150>; + vbatdet-little-cool-mv = <4270>; + vbatdet-pre-normal-mv = <4270>; + vbatdet-normal-mv = <4270>; + vbatdet-warm-mv = <3980>; + /* temp region settings */ + cold-bat-decidegc = <30>; + little-cold-bat-decidegc = <0>; + cool-bat-decidegc = <50>; + little-cool-bat-decidegc = <120>; + pre-normal-bat-decidegc = <160>; + warm-bat-decidegc = <450>; + hot-bat-decidegc = <530>; + op,sw-iterm-ma = <296>; + op,sw-check-full-enable; + /*otg low battery current limit*/ + op,otg-icl-ctrl-enable; + otg-low-battery-thr = <15>; + otg-low-bat-icl-thr = <1000000>; + otg-normal-bat-icl-thr = <1500000>; + /* other settings */ + qcom,cutoff-voltage-with-charger = <3250>; + disable-pd; + op,usb-check = <&tlmm 95 0x00>; + qcom,msm-bus,name = "dash_clk_vote"; + qcom,msm-bus,num-cases = <2>; + qcom,msm-bus,num-paths = <1>; + qcom,msm-bus,vectors-KBps = <1 731 0 300000000>, + <1 731 0 0>; + + qcom,usb-temp-vadc = <&pm8998_vadc>; + op,vbus-ctrl-gpio = <&pmi8998_gpios 3 GPIO_ACTIVE_LOW>; + +}; + +&pmi8998_fg { + qcom,fg-force-load-profile; + oem,use_external_fg; + qcom,fg-rsense-sel = <0>; + qcom,fg-sys-term-current = <180>; + qcom,fg-chg-term-current = <165>; +}; + +&qusb_phy0 { + pinctrl-names = "atest_usb13_suspend", "atest_usb13_active", + "usb_oe_suspend", "usb_oe_active"; + pinctrl-0 = <&atest_usb13_suspend>; + pinctrl-1 = <&atest_usb13_active>; + pinctrl-2 = <&usb_oe_suspend>; + pinctrl-3 = <&usb_oe_active>; +}; + +&tlmm { + hp_sw_active: hp_sw_active { + mux { + pins = "gpio103"; + function = "gpio"; + }; + + config { + pins = "gpio103"; + drive-strength = <2>; + bias-pull-up; + }; + }; + + hp_sw_suspend: hp_sw_suspend { + mux { + pins = "gpio103"; + function = "gpio"; + }; + + config { + pins = "gpio103"; + bias-pull-down; + drive-strength = <2>; + }; + }; + + atest_usb13_active: atest_usb13_active { + mux { + pins = "gpio7"; + function = "gpio"; + }; + + config { + pins = "gpio7"; + drive-strength = <12>; + bias-pull-up; + }; + }; + + atest_usb13_suspend: atest_usb13_suspend { + mux { + pins = "gpio7"; + function = "gpio"; + }; + + config { + pins = "gpio7"; + bias-pull-down; + drive-strength = <2>; + }; + }; + + usb_oe_active: usb_oe_active { + mux { + pins = "gpio87"; + function = "gpio"; + }; + + config { + pins = "gpio87"; + drive-strength = <12>; + bias-pull-up; + }; + }; + + usb_oe_suspend: usb_oe_suspend { + mux { + pins = "gpio87"; + function = "gpio"; + }; + + config { + pins = "gpio87"; + drive-strength = <2>; + bias-pull-down; + }; + }; + + oneplus_fastchg { + usb_sw_active: usb_sw_active { + mux { + pins = "gpio37", "gpio51"; + function = "gpio"; + }; + + config { + pins = "gpio37", "gpio51"; + drive-strength = <16>; + bias-pull-down; + }; + }; + + usb_sw_suspend: usb_sw_suspend { + mux { + pins = "gpio37", "gpio51"; + function = "gpio"; + }; + + config { + pins = "gpio37", "gpio51"; + drive-strength = <2>; + bias-disable; + }; + }; + + fastchg_active: fastchg_active { + mux { + pins = "gpio102"; + function = "gpio"; + }; + + config { + pins = "gpio102"; + drive-strength = <16>; + bias-pull-up; + }; + }; + + fastchg_suspend: fastchg_suspend { + mux { + pins = "gpio102"; + function = "gpio"; + }; + + config { + pins = "gpio102"; + drive-strength = <2>; + bias-disable; + }; + }; + + ap_clk_active: ap_clk_active { + mux { + pins = "gpio44"; + function = "gpio"; + }; + + config { + pins = "gpio44"; + drive-strength = <16>; + bias-pull-up; + }; + }; + + ap_clk_suspend: ap_clk_suspend { + mux { + pins = "gpio44"; + function = "gpio"; + }; + + config { + pins = "gpio44"; + drive-strength = <2>; + bias-disable; + }; + }; + + ap_data_active: ap_data_active { + mux { + pins = "gpio43"; + function = "gpio"; + }; + + config { + pins = "gpio43"; + drive-strength = <16>; + bias-pull-up; + }; + }; + + ap_data_suspend: ap_data_suspend { + mux { + pins = "gpio43"; + function = "gpio"; + }; + + config { + pins = "gpio43"; + drive-strength = <2>; + bias-disable; + }; + }; + }; +}; + +&pcie0 { + status = "disabled"; +}; + +&pcie1 { + status = "disabled"; +}; + + +&qupv3_se3_i2c { + status = "ok"; + nq@28 { + qcom,nq-firm = <&tlmm 62 0x00>; + + }; +}; + +&pmi8998_wled { + status = "disabled"; +}; + +&dsi_nt35597_truly_dsc_cmd_display { + status = "disabled"; +}; +&mdss_mdp { + connectors = <&sde_rscc &sde_wb>; +}; +&sde_dp{ + status = "disabled"; +}; + +&labibb { + status = "disabled"; +}; +&sdhc_2 { + status = "disabled"; +}; + +&pm8998_rtc { + compatible = "qcom,qpnp-rtc"; + qcom,qpnp-rtc-alarm-pwrup = <1>; +}; + +&pmi8998_haptics { + status = "okay"; + qcom,wave-shape = "sine"; + qcom,play-mode = "buffer"; + qcom,brake-pattern = <0x3 0x3 0x3 0x3>; + qcom,drive-period-code-max-variation-pct = <5>; + qcom,drive-period-code-min-variation-pct = <5>; + qcom,wave-rep-cnt = <1>; + qcom,wave-samp-rep-cnt = <1>; + qcom,vmax-mv = <2088>; + qcom,wave-play-rate-us = <4255>; + qcom,lra-auto-res-mode = "zxd-eop"; + qcom,lra-res-cal-period = <32>; +}; + +&red_led { + qcom,use-blink; + qcom,duty-pcts = [00 05 0a 0f 14 1d 28 32 3c 4b 64]; + qcom,duty-ms = <20>; + qcom,start-idx = <1>; + qcom,idx-len = <11>; + qcom,lut-flags = <0x1f>; + qcom,ramp-step-ms = <100>; + qcom,pause-lo = <2000>; + qcom,pause-hi = <1000>; + /delete-property/ linux,default-trigger; +}; + +&green_led { + qcom,use-blink; + qcom,duty-pcts = [00 05 0a 0f 14 1d 28 32 3c 4b 64]; + qcom,duty-ms = <20>; + qcom,start-idx = <13>; + qcom,idx-len = <11>; + qcom,lut-flags = <0x1f>; + qcom,ramp-step-ms = <100>; + qcom,pause-lo = <2000>; + qcom,pause-hi = <1000>; + /delete-property/ linux,default-trigger; +}; + +&blue_led { + qcom,use-blink; + qcom,duty-pcts = [00 05 0a 0f 14 1d 28 32 3c 4b 64]; + qcom,duty-ms = <20>; + qcom,start-idx = <13>; + qcom,idx-len = <11>; + qcom,lut-flags = <0x1f>; + qcom,ramp-step-ms = <100>; + qcom,pause-lo = <2000>; + qcom,pause-hi = <1000>; + /delete-property/ linux,default-trigger; +}; + +&sde_dsi_active { + mux { + pins = "gpio6", "gpio25", "gpio26"; + function = "gpio"; + }; + + config { + pins = "gpio6", "gpio25", "gpio26"; + drive-strength = <8>; /* 8 mA */ + bias-disable = <0>; /* no pull */ + }; + }; +&sde_dsi_suspend { + mux { + pins = "gpio6", "gpio25", "gpio26"; + function = "gpio"; + }; + + config { + pins = "gpio6", "gpio25", "gpio26"; + drive-strength = <2>; /* 2 mA */ + bias-pull-down; /* PULL DOWN */ + }; + }; + +&sde_dp_aux_active { + mux { + pins = "gpio122", "gpio123"; + function = "gpio"; + }; + + config { + pins = "gpio122", "gpio123"; + bias-disable = <0>; /* no pull */ + drive-strength = <8>; + }; +}; + +&sde_dp_aux_suspend { + mux { + pins = "gpio122", "gpio123"; + function = "gpio"; + }; + + config { + pins = "gpio122", "gpio123"; + bias-pull-down; + drive-strength = <2>; + }; +}; + +&tlmm { + fp_enable_init: fp_enable_init { + mux { + pins = "gpio80"; + function = "gpio"; + }; + + config { + pins = "gpio80"; + drive-strength = <8>; + bias-pull-up; + output-high; + }; + }; + + fp_irq_init: fp_irq_init { + mux { + pins = "gpio121"; + function = "gpio"; + }; + + config { + pins = "gpio121"; + drive-strength = <2>; + bias-disable; + input-enable; + }; + }; + + fp_disable_init: fp_disable_init { + mux { + pins = "gpio80"; + function = "gpio"; + }; + + config { + pins = "gpio80"; + drive-strength = <8>; + bias-pull-up; + output-low; + }; + }; + + fp_reset_init: fp_reset_init { + mux { + pins = "gpio35"; + function = "gpio"; + }; + + config { + pins = "gpio35"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + fp_reset_high: fp_reset_high { + mux { + pins = "gpio35"; + function = "gpio"; + }; + + config { + pins = "gpio35"; + drive-strength = <8>; + bias-pull-up; + output-high; + }; + }; + + fp_reset_low: fp_reset_low { + mux { + pins = "gpio35"; + function = "gpio"; + }; + + config { + pins = "gpio35"; + drive-strength = <8>; + bias-pull-up; + output-low; + }; + }; + + fp_id0_up: fp_id0_up { + mux { + pins = "gpio91"; + function = "gpio"; + }; + + config { + pins = "gpio91"; + drive-strength = <2>; + bias-pull-up; + input-enable; + }; + }; + + fp_id0_down: fp_id0_down { + mux { + pins = "gpio91"; + function = "gpio"; + }; + + config { + pins = "gpio91"; + drive-strength = <2>; + bias-disable; + input-enable; + }; + }; + tri_state_key_active: tri_state_key_active { + mux { + pins = "gpio24","gpio52","gpio126"; + function = "gpio"; + }; + + config { + pins = "gpio24","gpio52","gpio126"; + drive-strength = <2>; + bias-disable; + }; + }; + + tri_state_key_suspend: tri_state_key_suspend { + mux { + pins = "gpio24","gpio52","gpio126"; + function = "gpio"; + }; + + config { + pins = "gpio24","gpio52","gpio126"; + drive-strength = <2>; + bias-disable; + }; + }; + + esd_check_active: esd_check_active { + mux { + pins = "gpio30"; + function = "gpio"; + }; + config { + pins = "gpio30"; + drive-strength = <2>; + bias-pull-down; + input-enable; + }; + }; + esd_check_suspend: esd_check_suspend { + mux { + pins = "gpio30"; + function = "gpio"; + }; + config { + pins = "gpio30"; + drive-strength = <2>; + bias-pull-down; + input-enable; + }; + }; +}; + +&tlmm { + cam_sensor_rear_0_mclk_active: cam_sensor_rear_0_mclk_active { + /* MCLK0 */ + mux { + /* CLK, DATA */ + pins = "gpio13"; + function = "cam_mclk"; + }; + + config { + pins = "gpio13"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_0_mclk_suspend: cam_sensor_rear_0_mclk_suspend { + /* MCLK0 */ + mux { + /* CLK, DATA */ + pins = "gpio13"; + function = "cam_mclk"; + }; + + config { + pins = "gpio13"; + bias-pull-down; /* PULL DOWN */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_0_rest_active: cam_sensor_rear_0_rest_active { + /* RESET, STANDBY */ + mux { + pins = "gpio28"; + function = "gpio"; + }; + + config { + pins = "gpio28"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_0_rest_suspend: cam_sensor_rear_0_rest_suspend { + /* RESET, STANDBY */ + mux { + pins = "gpio28"; + function = "gpio"; + }; + + config { + pins = "gpio28"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_0_ana_active: cam_sensor_rear_0_ana_active { + /* VANA */ + mux { + pins = "gpio27"; + function = "gpio"; + }; + + config { + pins = "gpio27"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_0_ana_suspend: cam_sensor_rear_0_ana_suspend { + /* VANA */ + mux { + pins = "gpio27"; + function = "gpio"; + }; + + config { + pins = "gpio27"; + bias-pull-down; /* PULL DOWN */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_0_dig_active: cam_sensor_rear_0_dig_active { + /* DIG */ + mux { + pins = "gpio8"; + function = "gpio"; + }; + + config { + pins = "gpio8"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_0_dig_suspend: cam_sensor_rear_0_dig_suspend { + /* DIG */ + mux { + pins = "gpio8"; + function = "gpio"; + }; + + config { + pins = "gpio8"; + bias-pull-down; /* PULL DOWN */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_0_vaf_active: cam_sensor_rear_0_vaf_active { + /* ACTUATOR POWER */ + mux { + pins = "gpio31"; + function = "gpio"; + }; + + config { + pins = "gpio31"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_0_vaf_suspend: cam_sensor_rear_0_vaf_suspend { + /* ACTUATOR POWER */ + mux { + pins = "gpio31"; + function = "gpio"; + }; + + config { + pins = "gpio31"; + bias-pull-down; /* PULL DOWN */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_1_mclk_active: cam_sensor_rear_1_mclk_active { + /* MCLK1 */ + mux { + /* CLK, DATA */ + pins = "gpio15"; + function = "cam_mclk"; + }; + + config { + pins = "gpio15"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_1_mclk_suspend: cam_sensor_rear_1_mclk_suspend { + /* MCLK1 */ + mux { + /* CLK, DATA */ + pins = "gpio15"; + function = "cam_mclk"; + }; + + config { + pins = "gpio15"; + bias-pull-down; /* PULL DOWN */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_1_rest_active: cam_sensor_rear_1_rest_active { + /* RESET, STANDBY */ + mux { + pins = "gpio23"; + function = "gpio"; + }; + + config { + pins = "gpio23"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_1_rest_suspend: cam_sensor_rear_1_rest_suspend { + /* RESET, STANDBY */ + mux { + pins = "gpio23"; + function = "gpio"; + }; + config { + pins = "gpio23"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_1_ana_active: cam_sensor_rear_1_ana_active { + /* VANA */ + mux { + pins = "gpio78"; + function = "gpio"; + }; + + config { + pins = "gpio78"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_1_ana_suspend: cam_sensor_rear_1_ana_suspend { + /* VANA */ + mux { + pins = "gpio78"; + function = "gpio"; + }; + + config { + pins = "gpio78"; + bias-pull-down; /* PULL DOWN */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_1_vaf_active: cam_sensor_rear_1_vaf_active { + /* ACTUATOR POWER */ + mux { + pins = "gpio77"; + function = "gpio"; + }; + + config { + pins = "gpio77"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_1_vaf_suspend: cam_sensor_rear_1_vaf_suspend { + /* ACTUATOR POWER */ + mux { + pins = "gpio77"; + function = "gpio"; + }; + + config { + pins = "gpio77"; + bias-pull-down; /* PULL DOWN */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_1_dig_active: cam_sensor_rear_1_dig_active { + /* DIG */ + mux { + pins = "gpio79"; + function = "gpio"; + }; + + config { + pins = "gpio79"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_rear_1_dig_suspend: cam_sensor_rear_1_dig_suspend { + /* DIG */ + mux { + pins = "gpio79"; + function = "gpio"; + }; + + config { + pins = "gpio79"; + bias-pull-down; /* PULL DOWN */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_front_0_mclk_active: cam_sensor_front_0_mclk_active { + /* MCLK2 */ + mux { + /* CLK, DATA */ + pins = "gpio14"; + function = "cam_mclk"; + }; + + config { + pins = "gpio14"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_front_0_mclk_suspend: + cam_sensor_front_0_mclk_suspend { + /* MCLK2 */ + mux { + /* CLK, DATA */ + pins = "gpio14"; + function = "cam_mclk"; + }; + + config { + pins = "gpio14"; + bias-pull-down; /* PULL DOWN */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_front_0_rest_active: + cam_sensor_front_0_rest_active { + /* RESET, STANDBY */ + mux { + pins = "gpio9"; + function = "gpio"; + }; + + config { + pins = "gpio9"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_front_0_rest_suspend: + cam_sensor_front_0_rest_suspend { + /* RESET, STANDBY */ + mux { + pins = "gpio9"; + function = "gpio"; + }; + + config { + pins = "gpio9"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_front_0_ana_active: + cam_sensor_front_0_ana_active { + /* VANA */ + mux { + pins = "gpio104"; + function = "gpio"; + }; + + config { + pins = "gpio104"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_front_0_ana_suspend: + cam_sensor_front_0_ana_suspend { + /* VANA */ + mux { + pins = "gpio104"; + function = "gpio"; + }; + + config { + pins = "gpio104"; + bias-pull-down; /* PULL DOWN */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_front_0_dig_active: + cam_sensor_front_0_dig_active { + /* DIG */ + mux { + pins = "gpio117"; + function = "gpio"; + }; + + config { + pins = "gpio117"; + bias-disable; /* No PULL */ + drive-strength = <2>; /* 2 MA */ + }; + }; + + cam_sensor_front_0_dig_suspend: + cam_sensor_front_0_dig_suspend { + /* DIG */ + mux { + pins = "gpio117"; + function = "gpio"; + }; + + config { + pins = "gpio117"; + bias-pull-down; /* PULL DOWN */ + drive-strength = <2>; /* 2 MA */ + }; + }; +}; + +&soc { + led_flash_rear: qcom,camera-flash@0 { + cell-index = <0>; + reg = <0x00 0x00>; + compatible = "qcom,camera-flash"; + flash-source = <&pmi8998_flash0 &pmi8998_flash1>; + torch-source = <&pmi8998_torch0 &pmi8998_torch1>; + switch-source = <&pmi8998_switch0>; + status = "ok"; + }; + + rear_1_actuator_regulator: gpio-regulator@1 { + compatible = "regulator-fixed"; + reg = <0x01 0x00>; + regulator-name = "actuator_regulator"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-enable-ramp-delay = <100>; + enable-active-high; + gpio = <&tlmm 77 0>; + vin-supply = <&pmi8998_bob>; + }; + + rear_0_actuator_regulator: gpio-regulator@0 { + compatible = "regulator-fixed"; + reg = <0x00 0x00>; + regulator-name = "actuator_regulator"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-enable-ramp-delay = <100>; + enable-active-high; + gpio = <&tlmm 31 0>; + vin-supply = <&pmi8998_bob>; + }; +}; + +&cam_cci { + qcom,cam-res-mgr { + compatible = "qcom,cam-res-mgr"; + status = "ok"; + }; + + actuator_rear_0: qcom,actuator@0 { + cell-index = <0>; + reg = <0x0>; + compatible = "qcom,actuator"; + cci-master = <0>; + cam_vaf-supply = <&rear_0_actuator_regulator>; + regulator-names = "cam_vaf"; + rgltr-cntrl-support; + rgltr-min-voltage = <2800000>; + rgltr-max-voltage = <2800000>; + rgltr-load-current = <0>; + }; + + actuator_rear_1: qcom,actuator@1 { + cell-index = <1>; + reg = <0x1>; + compatible = "qcom,actuator"; + cci-master = <1>; + cam_vaf-supply = <&rear_1_actuator_regulator>; + regulator-names = "cam_vaf"; + rgltr-cntrl-support; + rgltr-min-voltage = <2800000>; + rgltr-max-voltage = <2800000>; + rgltr-load-current = <0>; + }; + + ois_rear_0: qcom,ois@0 { + cell-index = <0>; + reg = <0x0>; + compatible = "qcom,ois"; + cam_vaf-supply = <&pm8998_l21>; + regulator-names = "cam_vaf"; + rgltr-cntrl-support; + rgltr-min-voltage = <2850000>; + rgltr-max-voltage = <2850000>; + rgltr-load-current = <500000>; + gpio-no-mux = <0>; + gpios = <&tlmm 40 0>; + gpio-vaf = <0>; + gpio-req-tbl-num = <0>; + gpio-req-tbl-flags = <0>; + gpio-req-tbl-label = "CAM_OIS_PWD_0"; + cci-master = <0>; + status = "ok"; + }; + + eeprom_rear_0: qcom,eeprom@0 { + cell-index = <0>; + reg = <0>; + compatible = "qcom,eeprom"; + cam_vio-supply = <&pm8998_lvs1>; + cam_vana-supply = <&pmi8998_bob>; + cam_vdig-supply = <&pmi8998_bob>; + cam_clk-supply = <&titan_top_gdsc>; + regulator-names = "cam_vio", "cam_vana", "cam_vdig", + "cam_clk"; + rgltr-cntrl-support; + rgltr-min-voltage = <0 3312000 3312000 0>; + rgltr-max-voltage = <0 3600000 3600000 0>; + rgltr-load-current = <0 3600000 3600000 0>; + gpio-no-mux = <0>; + pinctrl-names = "cam_default", "cam_suspend"; + pinctrl-0 = <&cam_sensor_rear_0_mclk_active + &cam_sensor_rear_0_rest_active + &cam_sensor_rear_0_ana_active + &cam_sensor_rear_0_dig_active>; + pinctrl-1 = <&cam_sensor_rear_0_mclk_suspend + &cam_sensor_rear_0_rest_suspend + &cam_sensor_rear_0_ana_suspend + &cam_sensor_rear_0_dig_suspend>; + gpios = <&tlmm 13 0>, + <&tlmm 28 0>, + <&tlmm 27 0>, + <&tlmm 8 0>; + gpio-reset = <1>; + gpio-vana = <2>; + gpio-vdig = <3>; + gpio-req-tbl-num = <0 1 2 3>; + gpio-req-tbl-flags = <1 0 0 0>; + gpio-req-tbl-label = "CAMIF_MCLK_0", + "CAM_RESET_0", + "CAM_VANA_0", + "CAM_DIG_0"; + sensor-position = <0>; + sensor-mode = <0>; + cci-master = <0>; + status = "ok"; + clocks = <&clock_camcc CAM_CC_MCLK0_CLK>; + clock-names = "cam_clk"; + clock-cntl-level = "turbo"; + clock-rates = <24000000>; + }; + + eeprom_rear_1: qcom,eeprom@1 { + cell-index = <1>; + reg = <0x1>; + compatible = "qcom,eeprom"; + cam_vdig-supply = <&pmi8998_bob>; + cam_vio-supply = <&pm8998_lvs1>; + cam_vana-supply = <&pmi8998_bob>; + cam_clk-supply = <&titan_top_gdsc>; + regulator-names = "cam_vdig", "cam_vio", "cam_vana", + "cam_clk"; + rgltr-cntrl-support; + rgltr-min-voltage = <3312000 0 3312000 0>; + rgltr-max-voltage = <3600000 0 3600000 0>; + rgltr-load-current = <80000 0 80000 0>; + gpio-no-mux = <0>; + pinctrl-names = "cam_default", "cam_suspend"; + pinctrl-0 = <&cam_sensor_rear_1_mclk_active + &cam_sensor_rear_1_rest_active + &cam_sensor_rear_1_ana_active + &cam_sensor_rear_1_dig_active>; + pinctrl-1 = <&cam_sensor_rear_1_mclk_suspend + &cam_sensor_rear_1_rest_suspend + &cam_sensor_rear_1_ana_suspend + &cam_sensor_rear_1_dig_suspend>; + gpios = <&tlmm 15 0>, + <&tlmm 23 0>, + <&tlmm 78 0>, + <&tlmm 79 0>; + gpio-reset = <1>; + gpio-vana = <2>; + gpio-vdig = <3>; + gpio-req-tbl-num = <0 1 2 3>; + gpio-req-tbl-flags = <1 0 0 0>; + gpio-req-tbl-label = "CAMIF_MCLK_1", + "CAM_RESET_1", + "CAM_VANA_1", + "CAM_DIG_1"; + + sensor-position = <0>; + sensor-mode = <0>; + cci-master = <1>; + status = "ok"; + clocks = <&clock_camcc CAM_CC_MCLK2_CLK>; + clock-names = "cam_clk"; + clock-cntl-level = "turbo"; + clock-rates = <24000000>; + }; + + eeprom_front_0: qcom,eeprom@2 { + cell-index = <2>; + reg = <0x2>; + compatible = "qcom,eeprom"; + cam_vio-supply = <&pm8998_lvs1>; + cam_vana-supply = <&pmi8998_bob>; + cam_vdig-supply = <&pmi8998_bob>; + cam_clk-supply = <&titan_top_gdsc>; + regulator-names = "cam_vio", "cam_vana", "cam_vdig", + "cam_clk"; + rgltr-cntrl-support; + rgltr-min-voltage = <0 3312000 3312000 0>; + rgltr-max-voltage = <0 3600000 3600000 0>; + rgltr-load-current = <0 80000 80000 0>; + gpio-no-mux = <0>; + pinctrl-names = "cam_default", "cam_suspend"; + pinctrl-0 = <&cam_sensor_front_0_mclk_active + &cam_sensor_front_0_rest_active + &cam_sensor_front_0_ana_active + &cam_sensor_front_0_dig_active>; + pinctrl-1 = <&cam_sensor_front_0_mclk_suspend + &cam_sensor_front_0_rest_suspend + &cam_sensor_front_0_ana_suspend + &cam_sensor_front_0_dig_suspend>; + gpios = <&tlmm 14 0>, + <&tlmm 9 0>, + <&tlmm 104 0>, + <&tlmm 117 0>; + gpio-reset = <1>; + gpio-vana = <2>; + gpio-vdig = <3>; + gpio-req-tbl-num = <0 1 2 3>; + gpio-req-tbl-flags = <1 0 0 0>; + gpio-req-tbl-label = "CAMIF_MCLK_2", + "CAM_RESET_2", + "CAM_VANA_2", + "CAM_DIG_2"; + sensor-position = <1>; + sensor-mode = <0>; + cci-master = <0>; + status = "ok"; + clocks = <&clock_camcc CAM_CC_MCLK1_CLK>; + clock-names = "cam_clk"; + clock-cntl-level = "turbo"; + clock-rates = <24000000>; + }; + + qcom,cam-sensor@0 { + cell-index = <0>; + compatible = "qcom,cam-sensor"; + reg = <0x0>; + csiphy-sd-index = <0>; + sensor-position-roll = <270>; + sensor-position-pitch = <0>; + sensor-position-yaw = <180>; + led-flash-src = <&led_flash_rear>; + actuator-src = <&actuator_rear_0>; + ois-src = <&ois_rear_0>; + eeprom-src = <&eeprom_rear_0>; + cam_vio-supply = <&pm8998_lvs1>; + cam_vana-supply = <&pmi8998_bob>; + cam_vdig-supply = <&pmi8998_bob>; + cam_clk-supply = <&titan_top_gdsc>; + regulator-names = "cam_vio", "cam_vana", "cam_vdig", + "cam_clk"; + rgltr-cntrl-support; + rgltr-min-voltage = <0 3312000 3312000 0>; + rgltr-max-voltage = <0 3600000 3600000 0>; + rgltr-load-current = <0 3600000 3600000 0>; + gpio-no-mux = <0>; + pinctrl-names = "cam_default", "cam_suspend"; + pinctrl-0 = <&cam_sensor_rear_0_mclk_active + &cam_sensor_rear_0_rest_active + &cam_sensor_rear_0_ana_active + &cam_sensor_rear_0_dig_active>; + pinctrl-1 = <&cam_sensor_rear_0_mclk_suspend + &cam_sensor_rear_0_rest_suspend + &cam_sensor_rear_0_ana_suspend + &cam_sensor_rear_0_dig_suspend>; + gpios = <&tlmm 13 0>, + <&tlmm 28 0>, + <&tlmm 27 0>, + <&tlmm 8 0>; + gpio-reset = <1>; + gpio-vana = <2>; + gpio-vdig = <3>; + gpio-req-tbl-num = <0 1 2 3>; + gpio-req-tbl-flags = <1 0 0 0>; + gpio-req-tbl-label = "CAMIF_MCLK_0", + "CAM_RESET_0", + "CAM_VANA_0", + "CAM_DIG_0"; + sensor-mode = <0>; + cci-master = <0>; + status = "ok"; + clocks = <&clock_camcc CAM_CC_MCLK0_CLK>; + clock-names = "cam_clk"; + clock-cntl-level = "turbo"; + clock-rates = <24000000>; + }; + + qcom,cam-sensor@1 { + cell-index = <1>; + compatible = "qcom,cam-sensor"; + reg = <0x1>; + csiphy-sd-index = <1>; + sensor-position-roll = <90>; + sensor-position-pitch = <0>; + sensor-position-yaw = <180>; + led-flash-src = <&led_flash_rear>; + actuator-src = <&actuator_rear_1>; + eeprom-src = <&eeprom_rear_1>; + cam_vdig-supply = <&pmi8998_bob>; + cam_vio-supply = <&pm8998_lvs1>; + cam_vana-supply = <&pmi8998_bob>; + cam_clk-supply = <&titan_top_gdsc>; + regulator-names = "cam_vdig", "cam_vio", "cam_vana", + "cam_clk"; + rgltr-cntrl-support; + rgltr-min-voltage = <3312000 0 3312000 0>; + rgltr-max-voltage = <3600000 0 3600000 0>; + rgltr-load-current = <80000 0 80000 0>; + gpio-no-mux = <0>; + pinctrl-names = "cam_default", "cam_suspend"; + pinctrl-0 = <&cam_sensor_rear_1_mclk_active + &cam_sensor_rear_1_rest_active + &cam_sensor_rear_1_ana_active + &cam_sensor_rear_1_dig_active>; + pinctrl-1 = <&cam_sensor_rear_1_mclk_suspend + &cam_sensor_rear_1_rest_suspend + &cam_sensor_rear_1_ana_suspend + &cam_sensor_rear_1_dig_suspend>; + gpios = <&tlmm 15 0>, + <&tlmm 23 0>, + <&tlmm 78 0>, + <&tlmm 79 0>; + gpio-reset = <1>; + gpio-vana = <2>; + gpio-vdig = <3>; + gpio-req-tbl-num = <0 1 2 3>; + gpio-req-tbl-flags = <1 0 0 0>; + gpio-req-tbl-label = "CAMIF_MCLK_1", + "CAM_RESET_1", + "CAM_VANA_1", + "CAM_DIG_1"; + sensor-mode = <0>; + cci-master = <1>; + status = "ok"; + clocks = <&clock_camcc CAM_CC_MCLK2_CLK>; + clock-names = "cam_clk"; + clock-cntl-level = "turbo"; + clock-rates = <24000000>; + }; + + qcom,cam-sensor@2 { + cell-index = <2>; + compatible = "qcom,cam-sensor"; + reg = <0x02>; + csiphy-sd-index = <2>; + sensor-position-roll = <270>; + sensor-position-pitch = <0>; + sensor-position-yaw = <0>; + eeprom-src = <&eeprom_front_0>; + cam_vio-supply = <&pm8998_lvs1>; + cam_vana-supply = <&pmi8998_bob>; + cam_vdig-supply = <&pmi8998_bob>; + cam_clk-supply = <&titan_top_gdsc>; + regulator-names = "cam_vio", "cam_vana", "cam_vdig", + "cam_clk"; + rgltr-cntrl-support; + rgltr-min-voltage = <0 3312000 3312000 0>; + rgltr-max-voltage = <0 3600000 3600000 0>; + rgltr-load-current = <0 80000 80000 0>; + gpio-no-mux = <0>; + pinctrl-names = "cam_default", "cam_suspend"; + pinctrl-0 = <&cam_sensor_front_0_mclk_active + &cam_sensor_front_0_rest_active + &cam_sensor_front_0_ana_active + &cam_sensor_front_0_dig_active>; + pinctrl-1 = <&cam_sensor_front_0_mclk_suspend + &cam_sensor_front_0_rest_suspend + &cam_sensor_front_0_ana_suspend + &cam_sensor_front_0_dig_suspend>; + gpios = <&tlmm 14 0>, + <&tlmm 9 0>, + <&tlmm 104 0>, + <&tlmm 117 0>; + gpio-reset = <1>; + gpio-vana = <2>; + gpio-vdig = <3>; + gpio-req-tbl-num = <0 1 2 3>; + gpio-req-tbl-flags = <1 0 0 0>; + gpio-req-tbl-label = "CAMIF_MCLK_2", + "CAM_RESET_2", + "CAM_VANA_2", + "CAM_DIG_2"; + sensor-mode = <0>; + cci-master = <0>; + status = "ok"; + clocks = <&clock_camcc CAM_CC_MCLK1_CLK>; + clock-names = "cam_clk"; + clock-cntl-level = "turbo"; + clock-rates = <24000000>; + }; + +}; + +&tlmm { + ts_mux { + ts_active: ts_active { + mux { + pins = "gpio99", "gpio125"; + function = "gpio"; + }; + + config { + pins = "gpio99", "gpio125"; + drive-strength = <16>; + bias-pull-up; + }; + }; + + ts_reset_suspend: ts_reset_suspend { + mux { + pins = "gpio99"; + function = "gpio"; + }; + + config { + pins = "gpio99"; + drive-strength = <2>; + bias-pull-down; + }; + }; + + ts_int_suspend: ts_int_suspend { + mux { + pins = "gpio125"; + function = "gpio"; + }; + + config { + pins = "gpio125"; + drive-strength = <2>; + bias-disable; + }; + }; + }; +}; + +&pm8998_vadc { + chan@50 { + label = "pa1_therm"; + reg = <0x50>; + qcom,decimation = <2>; + qcom,pre-div-channel-scaling = <0>; + qcom,calibration-type = "ratiometric"; + qcom,scale-function = <2>; + qcom,hw-settle-time = <2>; + qcom,fast-avg-setup = <0>; + }; +}; + +&pm8998_adc_tm { + chan@50 { + label = "pa1_therm"; + reg = <0x50>; + qcom,pre-div-channel-scaling = <0>; + qcom,calibration-type = "ratiometric"; + qcom,scale-function = <2>; + qcom,hw-settle-time = <2>; + qcom,btm-channel-number = <0x90>; + qcom,thermal-node; + }; +}; + +&thermal_zones { + pa1-therml-adc { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pm8998_adc_tm 0x50>; + thermal-governor = "user_space"; + + trips { + active-config0 { + temperature = <65000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; +}; +&spmi_bus { + qcom,pm8998@0 { + qcom,power-on@800 { + qcom,pon_1 { + qcom,support-reset = <0>; + }; + }; + }; +}; + + +&tlmm { + oem_rf_cable_mux { + oem_rf_cable_active: oem_rf_cable_active { + mux { + pins = "gpio32","gpio128"; + function = "gpio"; + }; + config { + pins = "gpio32","gpio128"; + drive-strength = <2>; + bias-disable; + }; + }; + oem_rf_cable_suspend: oem_rf_cable_suspend { + mux { + pins = "gpio32","gpio128"; + function = "gpio"; + }; + config { + pins = "gpio32","gpio128"; + drive-strength = <2>; + bias-disable; + }; + }; + }; + oem_aboard_mux { + oem_aboard_mux_active: oem_aboard_mux_active { + mux { + pins = "gpio33","gpio34"; + function = "gpio"; + }; + config { + pins = "gpio33","gpio34"; + drive-strength = <2>; + bias-disable; + }; + }; + oem_aboard_mux_suspend: oem_aboard_mux_suspend { + mux { + pins = "gpio33","gpio34"; + function = "gpio"; + }; + config { + pins = "gpio33","gpio34"; + drive-strength = <2>; + bias-disable; + }; + }; + }; + +}; + +&soc { + oem_rf_cable { + compatible = "oem,rf_cable"; + interrupt-parent = <&tlmm>; + rf,cable-gpio-0 = <&tlmm 32 0>; + rf,cable-gpio-1 = <&tlmm 128 0>; + pinctrl-names = "oem_rf_cable_active", "oem_rf_cable_suspend"; + pinctrl-0 = <&oem_rf_cable_active >; + pinctrl-1 = <&oem_rf_cable_suspend >; + }; + + oem_aboard_check { + compatible = "oem,aboard"; + interrupt-parent = <&tlmm>; + oem,aboard-gpio-0 = <&tlmm 33 0>; + oem,aboard-gpio-1 = <&tlmm 34 0>; + pinctrl-names = "oem_aboard_active", "oem_aboard_suspend"; + pinctrl-0 = <&oem_aboard_mux_active >; + pinctrl-1 = <&oem_aboard_mux_suspend >; + }; + +}; + + +&spss_utils { + status = "disabled"; +}; + +&qupv3_se0_spi { + status = "ok"; + qcom,disable-autosuspend; + + ese@0 { + compatible = "nxp,p61"; + reg = <0>; + spi-max-frequency = <8000000>; + }; +}; + +&qupv3_se3_i2c { + + nq@28 { + status = "disabled"; + }; + + pn5xx@28 { + compatible = "nxp,pn544"; + reg = <0x28>; + nxp,pn544-irq = <&tlmm 63 0x00>; + nxp,pn544-ven = <&tlmm 12 0x00>; + nxp,pn544-fw-dwnld = <&tlmm 62 0x00>; + nxp,pn544-clk-gpio = <&pm8998_gpios 21 0x00>; + nxp,pn544-ese-pwr = <&tlmm 116 0x00>; + nfc_voltage_s4-supply = <&pm8998_s4>; + nxp,pn544-wake-up = <&tlmm 129 0x00>; + interrupt-parent = <&tlmm>; + qcom,clk-src = "BBCLK3"; + interrupts = <63 0>; + interrupt-names = "nfc_irq"; + pinctrl-names = "nfc_active", "nfc_suspend"; + pinctrl-0 = <&nfc_int_active + &nfc_enable_active + &nfc_clk_default>; + pinctrl-1 = <&nfc_int_suspend &nfc_enable_suspend>; + clocks = <&clock_rpmh RPMH_LN_BB_CLK3>; + clock-names = "ref_clk"; + }; +}; diff --git a/arch/arm64/boot/dts/qcom/sdm845-sde-display.dtsi b/arch/arm64/boot/dts/qcom/sdm845-sde-display.dtsi index 6e0bb8612139..bf9e4c2f4019 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-sde-display.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845-sde-display.dtsi @@ -516,7 +516,7 @@ }; }; }; - +/* &sde_dp { qcom,dp-usbpd-detection = <&pmi8998_pdphy>; qcom,ext-disp = <&ext_disp>; @@ -532,6 +532,10 @@ &mdss_mdp { connectors = <&sde_rscc &sde_wb &sde_dp>; }; +*/ +&mdss_mdp { + connectors = <&sde_rscc &sde_wb>; + }; &dsi_dual_nt35597_truly_video { qcom,mdss-dsi-t-clk-post = <0x0D>; diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi index dc4942b37056..0b2cf1cecc2d 100644 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi @@ -2677,7 +2677,6 @@ qcom,ipa-wdi2; qcom,use-64-bit-dma-mask; qcom,arm-smmu; - qcom,smmu-fast-map; qcom,bandwidth-vote-for-ipa; qcom,msm-bus,name = "ipa"; qcom,msm-bus,num-cases = <5>; @@ -2800,6 +2799,7 @@ ipa_smmu_ap: ipa_smmu_ap { compatible = "qcom,ipa-smmu-ap-cb"; + qcom,smmu-s1-bypass; iommus = <&apps_smmu 0x720 0x0>; qcom,iova-mapping = <0x20000000 0x40000000>; qcom,additional-mapping = @@ -2809,6 +2809,7 @@ ipa_smmu_wlan: ipa_smmu_wlan { compatible = "qcom,ipa-smmu-wlan-cb"; + qcom,smmu-s1-bypass; iommus = <&apps_smmu 0x721 0x0>; qcom,additional-mapping = /* ipa-uc ram */ @@ -2817,6 +2818,7 @@ ipa_smmu_uc: ipa_smmu_uc { compatible = "qcom,ipa-smmu-uc-cb"; + qcom,smmu-s1-bypass; iommus = <&apps_smmu 0x722 0x0>; qcom,iova-mapping = <0x40000000 0x20000000>; }; @@ -3107,6 +3109,7 @@ vdd-3.3-ch0-supply = <&pm8998_l25>; qcom,vdd-0.8-cx-mx-config = <800000 800000>; qcom,vdd-3.3-ch0-config = <3104000 3312000>; + qcom,smmu-s1-bypass; }; qmi-tmd-devices { diff --git a/arch/arm64/configs/sdm845-perf_defconfig b/arch/arm64/configs/sdm845-perf_defconfig index 15497b604469..12299f424819 100644 --- a/arch/arm64/configs/sdm845-perf_defconfig +++ b/arch/arm64/configs/sdm845-perf_defconfig @@ -312,6 +312,7 @@ CONFIG_INPUT_FINGERPRINT=y CONFIG_FINGERPRINT_DETECT=y CONFIG_FINGERPRINT_FPC=y CONFIG_FINGERPRINT_GOODIX=y +CONFIG_FINGERPRINT_SILEAD=y # CONFIG_SERIO_SERPORT is not set # CONFIG_VT is not set # CONFIG_LEGACY_PTYS is not set @@ -676,4 +677,4 @@ CONFIG_HOUSTON=y #end CONFIG_NET_CLS_CGROUP=y -# CONFIG_ADJ_CHAIN is not set +CONFIG_ADJ_CHAIN=y diff --git a/arch/arm64/configs/sdm845_defconfig b/arch/arm64/configs/sdm845_defconfig index 78737e717e23..957125bee9ea 100644 --- a/arch/arm64/configs/sdm845_defconfig +++ b/arch/arm64/configs/sdm845_defconfig @@ -318,6 +318,7 @@ CONFIG_INPUT_FINGERPRINT=y CONFIG_FINGERPRINT_DETECT=y CONFIG_FINGERPRINT_FPC=y CONFIG_FINGERPRINT_GOODIX=y +CONFIG_FINGERPRINT_SILEAD=y # CONFIG_SERIO_SERPORT is not set # CONFIG_VT is not set # CONFIG_LEGACY_PTYS is not set @@ -744,4 +745,4 @@ CONFIG_INPUT_KEYCHORD=y CONFIG_OP_DEBUG_CHG=y CONFIG_NET_CLS_CGROUP=y -# CONFIG_ADJ_CHAIN is not set +CONFIG_ADJ_CHAIN=y diff --git a/drivers/Kconfig b/drivers/Kconfig index 3479c6430ae8..317fad0b9ec0 100755 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -207,6 +207,7 @@ source "drivers/hwtracing/intel_th/Kconfig" source "drivers/fpga/Kconfig" source "drivers/sensors/Kconfig" +source "drivers/oem_debug/Kconfig" source "drivers/oem_debug/Kconfig" source "drivers/oneplus/Kconfig" diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index d881b378acf3..fa6a3d1221c8 100755 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c @@ -312,6 +312,41 @@ static ssize_t hbm_store(struct device *dev, return count; } +static ssize_t op_friginer_print_hbm_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct drm_connector *connector = to_drm_connector(dev); + int ret = 0; + int op_hbm_mode = 0; + + op_hbm_mode = dsi_display_get_fp_hbm_mode(connector); + + ret = scnprintf(buf, PAGE_SIZE, "OP_FP mode = %d\n" + "0--finger-hbm mode(off)\n" + "1--finger-hbm mode(600)\n", + op_hbm_mode); + return ret; +} + +static ssize_t op_friginer_print_hbm_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + struct drm_connector *connector = to_drm_connector(dev); + int ret = 0; + int op_hbm_mode = 0; + + ret = kstrtoint(buf, 10, &op_hbm_mode); + if (ret) { + pr_err("kstrtoint failed. ret=%d\n", ret); + return ret; + } + + ret = dsi_display_set_fp_hbm_mode(connector, op_hbm_mode); + if (ret) + pr_err("set hbm mode(%d) fail\n", op_hbm_mode); + + return count; +} static ssize_t aod_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -329,7 +364,7 @@ static ssize_t aod_show(struct device *dev, static ssize_t aod_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - //struct drm_connector *connector = to_drm_connector(dev); + struct drm_connector *connector = to_drm_connector(dev); int ret = 0; int aod_mode = 0; @@ -338,11 +373,10 @@ static ssize_t aod_store(struct device *dev, pr_err("kstrtoint failed. ret=%d\n", ret); return ret; } - - //ret = dsi_display_set_aod_mode(connector, aod_mode); - //if (ret) - // pr_err("set AOD mode(%d) fail\n", aod_mode); - + printk(KERN_ERR" node aod_mode=%d\n",aod_mode); + ret = dsi_display_set_aod_mode(connector, aod_mode); + if (ret) + pr_err("set AOD mode(%d) fail\n", aod_mode); return count; } @@ -644,13 +678,80 @@ static ssize_t panel_mismatch_show(struct device *dev, return ret; } +int oneplus_panel_alpha =0; +int oneplus_force_screenfp = 0; +extern int oneplus_get_panel_brightness_to_alpha(void); + +static ssize_t oneplus_display_get_dim_alpha(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%d\n", oneplus_get_panel_brightness_to_alpha()); +} + +static ssize_t oneplus_display_set_dim_alpha(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + sscanf(buf, "%x", &oneplus_panel_alpha); + + return count; +} + +static ssize_t oneplus_display_get_forcescreenfp(struct device *dev, + struct device_attribute *attr, char *buf) +{ + + struct drm_connector *connector = to_drm_connector(dev); + int ret = 0; + oneplus_force_screenfp = dsi_display_get_fp_hbm_mode(connector); + + ret = scnprintf(buf, PAGE_SIZE, "OP_FP mode = %d\n" + "0--finger-hbm mode(off)\n" + "1--finger-hbm mode(600)\n", + oneplus_force_screenfp); + return sprintf(buf, "%d\n", oneplus_force_screenfp); + +} + +static ssize_t oneplus_display_set_forcescreenfp(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + //sscanf(buf, "%x", &oneplus_force_screenfp); + struct drm_connector *connector = to_drm_connector(dev); + int ret = 0; + ret = kstrtoint(buf, 10, &oneplus_force_screenfp); + if (ret) { + pr_err("kstrtoint failed. ret=%d\n", ret); + return ret; + } + + ret = dsi_display_set_fp_hbm_mode(connector, oneplus_force_screenfp); + if (ret) + pr_err("set hbm mode(%d) fail\n", oneplus_force_screenfp); + return count; +} + +extern ssize_t oneplus_display_notify_fp_press(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count); + +extern ssize_t oneplus_display_notify_dim(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count); + +extern ssize_t oneplus_display_notify_aod_hid(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count); +/******************************************************************/ static DEVICE_ATTR_RW(status); static DEVICE_ATTR_RO(enabled); static DEVICE_ATTR_RO(dpms); static DEVICE_ATTR_RO(modes); static DEVICE_ATTR_RW(acl); static DEVICE_ATTR_RW(hbm); +static DEVICE_ATTR_RW(op_friginer_print_hbm); static DEVICE_ATTR_RW(aod); static DEVICE_ATTR_RW(aod_disable); static DEVICE_ATTR_RW(SRGB); @@ -661,6 +762,11 @@ static DEVICE_ATTR_RW(adaption_mode); static DEVICE_ATTR_RO(panel_serial_number); static DEVICE_ATTR_RW(dynamic_dsitiming); static DEVICE_ATTR_RO(panel_mismatch); +static DEVICE_ATTR(dim_alpha, S_IRUGO|S_IWUSR, oneplus_display_get_dim_alpha, oneplus_display_set_dim_alpha); +static DEVICE_ATTR(force_screenfp, S_IRUGO|S_IWUSR, oneplus_display_get_forcescreenfp, oneplus_display_set_forcescreenfp); +static DEVICE_ATTR(notify_fppress, S_IRUGO|S_IWUSR, NULL, oneplus_display_notify_fp_press); +static DEVICE_ATTR(notify_dim, S_IRUGO|S_IWUSR, NULL, oneplus_display_notify_dim); +static DEVICE_ATTR(notify_aod, S_IRUGO|S_IWUSR, NULL, oneplus_display_notify_aod_hid); static struct attribute *connector_dev_attrs[] = { &dev_attr_status.attr, @@ -669,6 +775,7 @@ static struct attribute *connector_dev_attrs[] = { &dev_attr_modes.attr, &dev_attr_acl.attr, &dev_attr_hbm.attr, + &dev_attr_op_friginer_print_hbm.attr, &dev_attr_aod.attr, &dev_attr_aod_disable.attr, &dev_attr_SRGB.attr, @@ -679,6 +786,11 @@ static struct attribute *connector_dev_attrs[] = { &dev_attr_panel_serial_number.attr, &dev_attr_dynamic_dsitiming.attr, &dev_attr_panel_mismatch.attr, + &dev_attr_force_screenfp.attr, + &dev_attr_dim_alpha.attr, + &dev_attr_notify_fppress.attr, + &dev_attr_notify_dim.attr, + &dev_attr_notify_aod.attr, NULL }; diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_defs.h b/drivers/gpu/drm/msm/dsi-staging/dsi_defs.h index 96105868161a..3bd8ecd1025e 100755 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_defs.h +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_defs.h @@ -275,13 +275,7 @@ enum dsi_cmd_set_type { DSI_CMD_SET_HBM_OFF, DSI_CMD_SET_AOD_ON_1, DSI_CMD_SET_AOD_ON_2, - DSI_CMD_SET_AOD_ON_3, - DSI_CMD_SET_AOD_ON_4, DSI_CMD_SET_AOD_OFF, - DSI_CMD_SET_AOD_MODE_1, - DSI_CMD_SET_AOD_MODE_2, - DSI_CMD_SET_AOD_MODE_3, - DSI_CMD_SET_AOD_MODE_4, DSI_CMD_SET_SRGB_ON, DSI_CMD_SET_SRGB_OFF, DSI_CMD_SET_DCI_P3_ON, @@ -305,6 +299,10 @@ enum dsi_cmd_set_type { DSI_CMD_READ_SAMSUNG_PANEL_REGISTER_OFF, DSI_CMD_HBM_MAX_BRIGHTNESS_SET_ON, DSI_CMD_HBM_MAX_BRIGHTNESS_SET_OFF, + DSI_CMD_AOD_OFF_HBM_ON_SETTING, + DSI_CMD_HBM_OFF_AOD_ON_SETTING, + DSI_CMD_SET_AOD_OFF_SAMSUNG, + DSI_CMD_SET_AOD_OFF_NEW, DSI_CMD_SET_MAX }; diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_display.c b/drivers/gpu/drm/msm/dsi-staging/dsi_display.c index d9d0a8d1d27c..d2d7cb0125e1 100755 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_display.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_display.c @@ -1128,39 +1128,15 @@ int dsi_display_set_power(struct drm_connector *connector, pr_err("invalid display/panel\n"); return -EINVAL; } - printk("enter dsi_display_set_power mode = %d\n", power_mode); switch (power_mode) { case SDE_MODE_DPMS_LP1: rc = dsi_panel_set_lp1(display->panel); - printk(KERN_ERR"SDE_MODE_DPMS_LP1\n"); - if (strcmp(display->panel->name, "samsung s6e3fc2x01 cmd mode dsi panel") == 0){ - display->panel->aod_mode=2; - } - else - display->panel->aod_mode=0; - if(display->panel->aod_mode!=0){ - dsi_panel_set_aod_mode(display->panel, display->panel->aod_mode); - display->panel->aod_status=1; - } break; case SDE_MODE_DPMS_LP2: rc = dsi_panel_set_lp2(display->panel); break; default: rc = dsi_panel_set_nolp(display->panel); - if ((power_mode == SDE_MODE_DPMS_ON) && display->panel->aod_status){ - display->panel->aod_mode=0; - printk(KERN_ERR"Turn off AOD MODE aod_mode start\n"); - display->panel->aod_status=0; - display->panel->aod_curr_mode = 0; - SDE_ATRACE_BEGIN("DSI_CMD_SET_AOD_OFF"); - rc = dsi_panel_tx_cmd_set_op(display->panel, DSI_CMD_SET_AOD_OFF); - SDE_ATRACE_END("DSI_CMD_SET_AOD_OFF"); - printk(KERN_ERR"Turn off AOD MODE aod_mode end\n"); - } else if ((power_mode == SDE_MODE_DPMS_OFF) - && display->panel->aod_status){ - display->panel->aod_status = 0; - display->panel->aod_curr_mode = 0; } break; } if (power_mode == SDE_MODE_DPMS_ON) { @@ -6807,6 +6783,78 @@ int dsi_display_get_hbm_mode(struct drm_connector *connector) return dsi_display->panel->hbm_mode; } +extern int oneplus_force_screenfp; + +int dsi_display_set_fp_hbm_mode(struct drm_connector *connector, int level) +{ + struct dsi_display *dsi_display = NULL; + struct dsi_panel *panel = NULL; + struct dsi_bridge *c_bridge; + int rc = 0; + + if ((connector == NULL) || (connector->encoder == NULL) + || (connector->encoder->bridge == NULL)) + return 0; + + c_bridge = to_dsi_bridge(connector->encoder->bridge); + dsi_display = c_bridge->display; + + if ((dsi_display == NULL) || (dsi_display->panel == NULL)) + return -EINVAL; + + panel = dsi_display->panel; + + mutex_lock(&dsi_display->display_lock); + + panel->op_force_screenfp = level; + oneplus_force_screenfp=panel->op_force_screenfp; + if (!dsi_panel_initialized(panel)) { + goto error; + } + + rc = dsi_display_clk_ctrl(dsi_display->dsi_clk_handle, + DSI_CORE_CLK, DSI_CLK_ON); + if (rc) { + pr_err("[%s] failed to enable DSI core clocks, rc=%d\n", + dsi_display->name, rc); + goto error; + } + + rc = dsi_panel_op_set_hbm_mode(panel, level); + if (rc) + pr_err("unable to set hbm mode\n"); + + rc = dsi_display_clk_ctrl(dsi_display->dsi_clk_handle, + DSI_CORE_CLK, DSI_CLK_OFF); + if (rc) { + pr_err("[%s] failed to disable DSI core clocks, rc=%d\n", + dsi_display->name, rc); + goto error; + } +error: + mutex_unlock(&dsi_display->display_lock); + return rc; +} + + +int dsi_display_get_fp_hbm_mode(struct drm_connector *connector) +{ + struct dsi_display *dsi_display = NULL; + struct dsi_bridge *c_bridge; + + if ((connector == NULL) || (connector->encoder == NULL) + || (connector->encoder->bridge == NULL)) + return 0; + + c_bridge = to_dsi_bridge(connector->encoder->bridge); + dsi_display = c_bridge->display; + + if ((dsi_display == NULL) || (dsi_display->panel == NULL)) + return 0; + + return dsi_display->panel->op_force_screenfp; +} + int dsi_display_set_srgb_mode(struct drm_connector *connector, int level) { struct dsi_display *dsi_display = NULL; @@ -7165,9 +7213,16 @@ int dsi_display_set_aod_mode(struct drm_connector *connector, int level) return -EINVAL; panel = dsi_display->panel; - mutex_lock(&dsi_display->display_lock); panel->aod_mode = level; - rc = dsi_panel_set_aod_mode(panel, level); + if (strcmp(dsi_display->panel->name, "samsung s6e3fc2x01 cmd mode dsi panel") == 0){ + printk(KERN_ERR"dsi_display_set_aod_mode\n"); + } + else + { + dsi_display->panel->aod_mode=0; + return 0; + } + mutex_lock(&dsi_display->display_lock); if (!dsi_panel_initialized(panel)) { goto error; } @@ -7189,6 +7244,7 @@ int dsi_display_set_aod_mode(struct drm_connector *connector, int level) dsi_display->name, rc); goto error; } + error: mutex_unlock(&dsi_display->display_lock); @@ -7707,6 +7763,10 @@ int dsi_display_unprepare(struct dsi_display *display) SDE_EVT32(SDE_EVTLOG_FUNC_EXIT); return rc; } +struct dsi_display *get_main_display(void) { + return primary_display; +} +EXPORT_SYMBOL(get_main_display); static int __init dsi_display_register(void) { diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c index bf33df4aded9..4b58d6fdb84d 100755 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c @@ -684,7 +684,7 @@ static int dsi_panel_led_bl_register(struct dsi_panel *panel, return 0; } #endif - +bool HBM_flag =false; static int dsi_panel_update_backlight(struct dsi_panel *panel, u32 bl_lvl) { @@ -697,9 +697,16 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel, } dsi = &panel->mipi_device; - + if (panel->is_hbm_enabled){ + return 0; + } if (panel->bl_config.bl_high2bit){ - rc = mipi_dsi_dcs_set_display_brightness_samsung(dsi, bl_lvl); + if(HBM_flag==true){ + return 0; + } + else{ + rc = mipi_dsi_dcs_set_display_brightness_samsung(dsi, bl_lvl); + } } else rc = mipi_dsi_dcs_set_display_brightness(dsi, bl_lvl); if (rc < 0) @@ -1549,13 +1556,7 @@ const char *cmd_set_prop_map[DSI_CMD_SET_MAX] = { "qcom,mdss-dsi-panel-hbm-off-command", "qcom,mdss-dsi-panel-aod-on-command-1",//10-alpm "qcom,mdss-dsi-panel-aod-on-command-2",//50 - "qcom,mdss-dsi-panel-aod-on-command-3",//10-hlpm - "qcom,mdss-dsi-panel-aod-on-command-4",//50 "qcom,mdss-dsi-panel-aod-off-command", - "qcom,mdss-dsi-panel-aod-mode-command-1", - "qcom,mdss-dsi-panel-aod-mode-command-2", - "qcom,mdss-dsi-panel-aod-mode-command-3", - "qcom,mdss-dsi-panel-aod-mode-command-4", "qcom,mdss-dsi-panel-srgb-on-command", "qcom,mdss-dsi-panel-srgb-off-command", "qcom,mdss-dsi-panel-dci-p3-on-command", @@ -1579,6 +1580,10 @@ const char *cmd_set_prop_map[DSI_CMD_SET_MAX] = { "qcom,mdss-dsi-panel-read-register-close-command", "qcom,mdss-dsi-panel-hbm-max-brightness-command-on", "qcom,mdss-dsi-panel-hbm-max-brightness-command-off", + "qcom,mdss-dsi-panel-aod-off-hbm-on-command", + "qcom,mdss-dsi-panel-hbm-off-aod-on-command", + "qcom,mdss-dsi-panel-aod-off-samsung-command", + "qcom,mdss-dsi-panel-aod-off-new-command", }; const char *cmd_set_state_map[DSI_CMD_SET_MAX] = { @@ -1612,23 +1617,17 @@ const char *cmd_set_state_map[DSI_CMD_SET_MAX] = { "qcom,mdss-dsi-hbm-off-command-state",//off "qcom,mdss-dsi-aod-on-command-state",// 1 "qcom,mdss-dsi-aod-on-command-state",// 2 - "qcom,mdss-dsi-aod-on-command-state",// 3 - "qcom,mdss-dsi-aod-on-command-state",// 4 "qcom,mdss-dsi-aod-off-command-state",//off - "qcom,mdss-dsi-aod-mode-command-state",//10nit - "qcom,mdss-dsi-aod-mode-command-state",//50nit - "qcom,mdss-dsi-aod-mode-command-state",//10nit - "qcom,mdss-dsi-aod-mode-command-state",//50nit - "qcom,mdss-dsi-srgb-on-command-state", - "qcom,mdss-dsi-srgb-off-command-state", - "qcom,mdss-dsi-dci-p3-on-command-state", - "qcom,mdss-dsi-dci-p3-off-command-state", - "qcom,mdss-dsi-night-mode-on-command-state", - "qcom,mdss-dsi-night-mode-off-command-state", + "qcom,mdss-dsi-panel-srgb-on-command-state", + "qcom,mdss-dsi-panel-srgb-off-command-state", + "qcom,mdss-dsi-panel-dci-p3-on-command-state", + "qcom,mdss-dsi-panel-dci-p3-off-command-state", + "qcom,mdss-dsi-panel-night-mode-on-command-state", + "qcom,mdss-dsi-panel-night-mode-off-command-state", "qcom,mdss-dsi-panel-oneplus-mode-on-command-state", "qcom,mdss-dsi-panel-oneplus-mode-off-command-state", - "qcom,mdss-dsi-adaption-mode-on-command-state", - "qcom,mdss-dsi-adaption-mode-off-command-state", + "qcom,mdss-dsi-panel-adaption-mode-on-command-state", + "qcom,mdss-dsi-panel-adaption-mode-off-command-state", "qcom,mdss-dsi-panel-serial-num-command-state", "qcom,mdss-dsi-panel-id-command-state", "qcom,mdss-dsi-panel-read-register-open-command-state", @@ -1642,6 +1641,10 @@ const char *cmd_set_state_map[DSI_CMD_SET_MAX] = { "qcom,mdss-dsi-panel-read-register-close-command-state", "qcom,mdss-dsi-panel-hbm-max-brightness-command-on-state", "qcom,mdss-dsi-panel-hbm-max-brightness-command-off-state", + "qcom,mdss-dsi-panel-aod-off-hbm-on-command-state", + "qcom,mdss-dsi-panel-hbm-off-aod-on-command-state", + "qcom,mdss-dsi-panel-aod-off-samsung-command-state", + "qcom,mdss-dsi-panel-aod-off-new-command-state", }; static int dsi_panel_get_cmd_pkt_count(const char *data, u32 length, u32 *cnt) @@ -3879,7 +3882,7 @@ int dsi_panel_post_switch(struct dsi_panel *panel) mutex_unlock(&panel->panel_lock); return rc; } - +int dsi_panel_set_aod_mode(struct dsi_panel *panel, int level); int dsi_panel_enable(struct dsi_panel *panel) { int rc = 0; @@ -3892,18 +3895,44 @@ int dsi_panel_enable(struct dsi_panel *panel) if (panel->type == EXT_BRIDGE) return 0; pr_err("start\n"); - mutex_lock(&panel->panel_lock); - + printk(KERN_ERR"Send DSI_CMD_SET_ON\n"); rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_ON); if (rc) { pr_err("[%s] failed to send DSI_CMD_SET_ON cmds, rc=%d\n", panel->name, rc); } panel->panel_initialized = true; + pr_err("aod_mode =%d\n",panel->aod_mode); mutex_unlock(&panel->panel_lock); + if(panel->aod_mode==2){ + rc = dsi_panel_set_aod_mode(panel, 2); + } + if(panel->aod_mode==2){ + panel->aod_status=1; + } + if(panel->aod_mode==0){ + rc = dsi_panel_set_aod_mode(panel, 0); + panel->aod_status=0; + } + if (panel->srgb_mode) + { + dsi_panel_set_srgb_mode(panel, panel->srgb_mode); + } + if (panel->dci_p3_mode){ + printk(KERN_ERR"Z2\n"); + dsi_panel_set_dci_p3_mode(panel, panel->dci_p3_mode); + } + if (panel->night_mode){ + printk(KERN_ERR"Z3\n"); + dsi_panel_set_night_mode(panel, panel->night_mode); + } + if (panel->adaption_mode){ + printk(KERN_ERR"Z4\n"); + dsi_panel_set_adaption_mode(panel, panel->adaption_mode); + } + pr_err("end\n"); - /* remove print actvie ws */ pm_print_active_wakeup_sources_queue(false); return rc; } @@ -3972,10 +4001,25 @@ int dsi_panel_disable(struct dsi_panel *panel) return 0; pr_err("start\n"); +panel->panel_initialized = false; mutex_lock(&panel->panel_lock); +if(panel->aod_mode==2) + { + //panel->aod_status = 0; + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_AOD_OFF_SAMSUNG); + } + /* Avoid sending panel off commands when ESD recovery is underway */ if (!atomic_read(&panel->esd_recovery_pending)) { - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_OFF); + HBM_flag=false; + + if(panel->aod_mode==2){ + panel->aod_status=1; + } + if(panel->aod_mode==0){ + panel->aod_status=0; + } + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_OFF); if (rc) { pr_err("[%s] failed to send DSI_CMD_SET_OFF cmds, rc=%d\n", panel->name, rc); @@ -4110,10 +4154,10 @@ int dsi_panel_set_hbm_mode(struct dsi_panel *panel, int level) pr_err("This panel does not support HBM mode off.\n"); goto error; } else - { + {HBM_flag=false; rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_HBM_OFF); - printk(KERN_ERR"When HBM OFF -->hbm_backight = %d panel->bl_config.bl_level =%d\n",panel->hbm_backlight,panel->bl_config.bl_level); - rc= dsi_panel_update_backlight(panel,panel->hbm_backlight); + printk(KERN_ERR"When HBM OFF -->hbm_backight = %d panel->bl_config.bl_level =%d\n",panel->hbm_backlight,panel->bl_config.bl_level); + rc= dsi_panel_update_backlight(panel,panel->hbm_backlight); } break; @@ -4163,6 +4207,7 @@ int dsi_panel_set_hbm_mode(struct dsi_panel *panel, int level) pr_err("This panel does not support HBM mode 5.\n"); goto error; } else { + HBM_flag=true; rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_HBM_ON_5); } break; @@ -4190,8 +4235,10 @@ int dsi_panel_set_hbm_mode(struct dsi_panel *panel, int level) break; } + pr_err("Set HBM Mode = %d\n", level); if(level==5) { + pr_err("HBM == 5 for fingerprint\n"); } error: @@ -4200,7 +4247,7 @@ int dsi_panel_set_hbm_mode(struct dsi_panel *panel, int level) return rc; } -int dsi_panel_set_srgb_mode(struct dsi_panel *panel, int level) +int dsi_panel_op_set_hbm_mode(struct dsi_panel *panel, int level) { int rc = 0; u32 count; @@ -4214,28 +4261,37 @@ int dsi_panel_set_srgb_mode(struct dsi_panel *panel, int level) mutex_lock(&panel->panel_lock); mode = panel->cur_mode; - - if (level) { - count = mode->priv_info->cmd_sets[DSI_CMD_SET_SRGB_ON].count; + switch (level) { + case 0: + count = mode->priv_info->cmd_sets[DSI_CMD_SET_HBM_OFF].count; if (!count) { - pr_err("This panel does not support sRGB mode on.\n"); + pr_err("This panel does not support HBM mode off.\n"); goto error; - } else{ - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_SRGB_ON); - pr_err("sRGB Mode On.\n"); - + } else { + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_HBM_OFF); + printk(KERN_ERR"When HBM OFF -->hbm_backight = %d panel->bl_config.bl_level =%d\n",panel->hbm_backlight,panel->bl_config.bl_level); + rc= dsi_panel_update_backlight(panel,panel->hbm_backlight); } + break; - } else { - count = mode->priv_info->cmd_sets[DSI_CMD_SET_SRGB_OFF].count; + case 1: + count = mode->priv_info->cmd_sets[DSI_CMD_SET_HBM_ON_5].count; if (!count) { - pr_err("This panel does not support sRGB mode off.\n"); + pr_err("This panel does not support HBM mode.\n"); goto error; } else { - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_SRGB_OFF); - pr_err("sRGB Mode Off.\n"); + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_HBM_ON_5); } + break; + default: + break; + } + pr_err("Set HBM Mode = %d\n", level); + if(level==5) + { + pr_err("HBM == 5 for fingerprint\n"); + } error: mutex_unlock(&panel->panel_lock); @@ -4243,47 +4299,56 @@ int dsi_panel_set_srgb_mode(struct dsi_panel *panel, int level) return rc; } -int dsi_panel_set_dci_p3_mode(struct dsi_panel *panel, int level) +int dsi_panel_set_srgb_mode(struct dsi_panel *panel, int level) { int rc = 0; u32 count; struct dsi_display_mode *mode; - if (!panel || !panel->cur_mode) { pr_err("Invalid params\n"); return -EINVAL; } - + mode = panel->cur_mode; mutex_lock(&panel->panel_lock); + if (level) { + count = mode->priv_info->cmd_sets[DSI_CMD_SET_SRGB_ON].count; - mode = panel->cur_mode; + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_SRGB_ON); + pr_err("sRGB Mode On.\n"); + } else { + count = mode->priv_info->cmd_sets[DSI_CMD_SET_SRGB_OFF].count; + + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_SRGB_OFF); + pr_err("sRGB Mode Off.\n"); + } + mutex_unlock(&panel->panel_lock); + return rc; +} + +int dsi_panel_set_dci_p3_mode(struct dsi_panel *panel, int level) +{ + int rc = 0; + u32 count; + struct dsi_display_mode *mode; + if (!panel || !panel->cur_mode) { + pr_err("Invalid params\n"); + return -EINVAL; + } + mode = panel->cur_mode; + mutex_lock(&panel->panel_lock); if (level) { count = mode->priv_info->cmd_sets[DSI_CMD_SET_DCI_P3_ON].count; - if (!count) { - pr_err("This panel does not support DCI-P3 mode on.\n"); - goto error; - } else { + + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_DCI_P3_ON); pr_err("DCI-P3 Mode On.\n"); + } else { - } - - } else { - count = mode->priv_info->cmd_sets[DSI_CMD_SET_DCI_P3_OFF].count; - if (!count) { - pr_err("This panel does not support DCI-P3 mode off.\n"); - goto error; - } else { rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_DCI_P3_OFF); pr_err("DCI-P3 Mode Off.\n"); - } - } - -error: mutex_unlock(&panel->panel_lock); - return rc; } @@ -4297,37 +4362,20 @@ int dsi_panel_set_night_mode(struct dsi_panel *panel, int level) pr_err("Invalid params\n"); return -EINVAL; } - - mutex_lock(&panel->panel_lock); - mode = panel->cur_mode; - + mutex_lock(&panel->panel_lock); if (level) { count = mode->priv_info->cmd_sets[DSI_CMD_SET_NIGHT_ON].count; - if (!count) { - pr_err("This panel does not support night mode on.\n"); - goto error; - } else { + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_NIGHT_ON); pr_err("night Mode On.\n"); - - } - } else { count = mode->priv_info->cmd_sets[DSI_CMD_SET_NIGHT_OFF].count; - if (!count) { - pr_err("This panel does not support night mode off.\n"); - goto error; - } else { + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_NIGHT_OFF); pr_err("night Mode Off.\n"); - } - } - -error: mutex_unlock(&panel->panel_lock); - return rc; } @@ -4385,43 +4433,27 @@ int dsi_panel_set_adaption_mode(struct dsi_panel *panel, int level) pr_err("Invalid params\n"); return -EINVAL; } - - mutex_lock(&panel->panel_lock); - mode = panel->cur_mode; + mutex_lock(&panel->panel_lock); if (level) { count = mode->priv_info->cmd_sets[DSI_CMD_SET_ADAPTION_ON].count; - if (!count) { - pr_err("This panel does not support adaption mode on.\n"); - goto error; - } else { - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_ADAPTION_ON); - pr_err("adaption Mode On.\n"); - - } + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_ADAPTION_ON); + pr_err("adaption Mode On.\n"); } else { count = mode->priv_info->cmd_sets[DSI_CMD_SET_ADAPTION_OFF].count; - if (!count) { - pr_err("This panel does not support adaption mode off.\n"); - goto error; - } else { + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_ADAPTION_OFF); pr_err("adaption Mode Off.\n"); - } - } -error: mutex_unlock(&panel->panel_lock); - - return rc; +return rc; } - +bool aod_real_flag = false; int dsi_panel_set_aod_mode(struct dsi_panel *panel, int level) { int rc = 0; - u32 count; struct dsi_display_mode *mode; if (!panel || !panel->cur_mode) { pr_err("Invalid params\n"); @@ -4430,97 +4462,51 @@ int dsi_panel_set_aod_mode(struct dsi_panel *panel, int level) if (panel->aod_disable) { return 0; } - mutex_lock(&panel->panel_lock); - if (panel->aod_curr_mode == level) { - goto error; - } + //if (panel->aod_curr_mode == level) { + //} mode = panel->cur_mode; if (level == 1) { if (panel->aod_status == 0) { - count = mode->priv_info->cmd_sets[DSI_CMD_SET_AOD_ON_1].count; - if (!count) { - pr_err("This panel does not support AOD ON 1.\n"); - goto error; - } + printk(KERN_ERR"send AOD ON commd mode 1 start \n"); rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_AOD_ON_1); + printk(KERN_ERR"send AOD ON commd mode 1 end \n"); panel->aod_status = 1; - } else { - count = mode->priv_info->cmd_sets[DSI_CMD_SET_AOD_MODE_1].count; - if (!count) { - pr_err("This panel does not support AOD mode 1.\n"); - goto error; - } - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_AOD_MODE_1); } } else if (level == 2) { if (panel->aod_status == 0) { - count = mode->priv_info->cmd_sets[DSI_CMD_SET_AOD_ON_2].count; - if (!count) { - pr_err("This panel does not support AOD ON 2.\n"); - goto error; - } + panel->aod_status = 1; + printk(KERN_ERR"send AOD ON commd mode 2 start \n"); rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_AOD_ON_2); - panel->aod_status = 1; - } else { - count = mode->priv_info->cmd_sets[DSI_CMD_SET_AOD_MODE_2].count; - if (!count) { - pr_err("This panel does not support AOD mode 2.\n"); - goto error; - } - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_AOD_MODE_2); + aod_real_flag=false; + printk(KERN_ERR"send AOD ON commd mode 2 end \n"); + } - } else if (level == 3) { - if (panel->aod_status == 0) { - count = mode->priv_info->cmd_sets[DSI_CMD_SET_AOD_ON_3].count; - if (!count) { - pr_err("This panel does not support AOD ON 3.\n"); - goto error; - } - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_AOD_ON_3); - panel->aod_status = 1; - } else { - count = mode->priv_info->cmd_sets[DSI_CMD_SET_AOD_MODE_3].count; - if (!count) { - pr_err("This panel does not support AOD mode 3.\n"); - goto error; - } - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_AOD_MODE_3); - } - } else if (level == 4) { - if (panel->aod_status == 0) { - count = mode->priv_info->cmd_sets[DSI_CMD_SET_AOD_ON_4].count; - if (!count) { - pr_err("This panel does not support AOD ON 4.\n"); - goto error; - } - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_AOD_ON_4); - panel->aod_status = 1; - } else { - count = mode->priv_info->cmd_sets[DSI_CMD_SET_AOD_MODE_4].count; - if (!count) { - pr_err("This panel does not support AOD mode 4.\n"); - goto error; - } - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_AOD_MODE_4); - } - } else { - count = mode->priv_info->cmd_sets[DSI_CMD_SET_AOD_OFF].count; - if (!count) { - pr_err("This panel does not support AOD mode off.\n"); - goto error; - } else { + }else { if (panel->aod_status) { + panel->aod_status = 0; + printk(KERN_ERR"send AOD OFF commd start \n"); + if(aod_real_flag==true){ + printk(KERN_ERR"send DSI_CMD_SET_AOD_OFF \n"); rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_AOD_OFF); - panel->aod_status = 0; + } + if(aod_real_flag==false){ + printk(KERN_ERR"send DSI_CMD_SET_AOD_OFF_NEW \n"); + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_AOD_OFF_NEW); + if (panel->srgb_mode) + dsi_panel_set_srgb_mode(panel, panel->srgb_mode); + if (panel->dci_p3_mode) + dsi_panel_set_dci_p3_mode(panel, panel->dci_p3_mode); + if (panel->night_mode) + dsi_panel_set_night_mode(panel, panel->night_mode); + if (panel->adaption_mode) + dsi_panel_set_adaption_mode(panel, panel->adaption_mode); + } + printk(KERN_ERR"send AOD OFF commd end \n"); + } } - } - panel->aod_curr_mode = level; pr_err("AOD MODE = %d\n", level); -error: - mutex_unlock(&panel->panel_lock); - - return rc; +return rc; } diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.h b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.h index d0e966c6b7c7..1bdc5db3cc4e 100755 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.h +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.h @@ -204,6 +204,9 @@ struct dsi_panel { int panel_mismatch_check; int panel_mismatch; int hbm_backlight; + bool is_hbm_enabled; + int op_force_screenfp; + bool dim_status; bool lp11_init; bool ulps_enabled; bool ulps_suspend_enabled; @@ -319,7 +322,7 @@ int dsi_panel_parse_esd_reg_read_configs(struct dsi_panel *panel, void dsi_panel_ext_bridge_put(struct dsi_panel *panel); int dsi_panel_set_acl_mode(struct dsi_panel *panel, int level); int dsi_panel_set_hbm_mode(struct dsi_panel *panel, int level); - +int dsi_panel_op_set_hbm_mode(struct dsi_panel *panel, int level); int dsi_panel_set_aod_mode(struct dsi_panel *panel, int level); int dsi_panel_set_srgb_mode(struct dsi_panel *panel, int level); diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index 332944966415..f21d293fe71a 100755 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -37,6 +37,8 @@ struct msm_commit { static BLOCKING_NOTIFIER_HEAD(msm_drm_notifier_list); +int connector_state_crtc_index; + /** * msm_drm_register_client - register a client notifier * @nb: notifier block to callback on events @@ -249,6 +251,7 @@ msm_disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) blank = MSM_DRM_BLANK_POWERDOWN; notifier_data.data = ␣ notifier_data.id = crtc_idx; + connector_state_crtc_index = crtc_idx; msm_drm_notifier_call_chain(MSM_DRM_EARLY_EVENT_BLANK, ¬ifier_data); /* @@ -400,7 +403,6 @@ void msm_atomic_helper_commit_modeset_disables(struct drm_device *dev, * and do the plane commits at the end. This is useful for drivers doing runtime * PM since planes updates then only happen when the CRTC is actually enabled. */ -int connector_state_crtc_index; static void msm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *old_state) { @@ -571,6 +573,8 @@ static void complete_commit(struct msm_commit *c) drm_atomic_state_free(state); + priv->commit_end_time = ktime_get(); //commit end time + commit_destroy(c); } diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 5fb6404927c3..e4363873377c 100755 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -638,6 +638,9 @@ struct msm_drm_private { /* update the flag when msm driver receives shutdown notification */ bool shutdown_in_progress; + + /*commit end time*/ + ktime_t commit_end_time; }; /* get struct msm_kms * from drm_device * */ diff --git a/drivers/gpu/drm/msm/sde/sde_connector.c b/drivers/gpu/drm/msm/sde/sde_connector.c index 9491aa389fae..22232869f303 100755 --- a/drivers/gpu/drm/msm/sde/sde_connector.c +++ b/drivers/gpu/drm/msm/sde/sde_connector.c @@ -513,6 +513,7 @@ static int _sde_connector_update_bl_scale(struct sde_connector *c_conn) struct dsi_display *dsi_display; struct dsi_backlight_config *bl_config; int rc = 0; + struct backlight_device *bd; if (!c_conn) { SDE_ERROR("Invalid params sde_connector null\n"); @@ -526,6 +527,13 @@ static int _sde_connector_update_bl_scale(struct sde_connector *c_conn) ((dsi_display) ? dsi_display->panel : NULL)); return -EINVAL; } + bd = c_conn->bl_device; + if (!bd) { + SDE_ERROR("Invalid params backlight_device null\n"); + return -EINVAL; + } + + mutex_lock(&bd->update_lock); bl_config = &dsi_display->panel->bl_config; @@ -543,10 +551,169 @@ static int _sde_connector_update_bl_scale(struct sde_connector *c_conn) bl_config->bl_scale, bl_config->bl_scale_ad, bl_config->bl_level); rc = c_conn->ops.set_backlight(dsi_display, bl_config->bl_level); + mutex_unlock(&bd->update_lock); return rc; } +extern bool sde_crtc_get_fingerprint_mode(struct drm_crtc_state *crtc_state); +extern bool sde_crtc_get_fingerprint_pressed(struct drm_crtc_state *crtc_state); +extern int dsi_display_set_hbm_mode(struct drm_connector *connector, int level); +static int dsi_panel_tx_cmd_set_op(struct dsi_panel *panel, + enum dsi_cmd_set_type type) +{ + int rc = 0, i = 0; + ssize_t len; + struct dsi_cmd_desc *cmds; + u32 count; + enum dsi_cmd_set_state state; + struct dsi_display_mode *mode; + const struct mipi_dsi_host_ops *ops = panel->host->ops; + + if (!panel || !panel->cur_mode) + return -EINVAL; + + if (panel->type == EXT_BRIDGE) + return 0; + + mode = panel->cur_mode; + + cmds = mode->priv_info->cmd_sets[type].cmds; + count = mode->priv_info->cmd_sets[type].count; + state = mode->priv_info->cmd_sets[type].state; + + if (count == 0) { + pr_debug("[%s] No commands to be sent for state(%d)\n", + panel->name, type); + goto error; + } + + for (i = 0; i < count; i++) { + if (state == DSI_CMD_SET_STATE_LP) + cmds->msg.flags |= MIPI_DSI_MSG_USE_LPM; + + if (cmds->last_command) + cmds->msg.flags |= MIPI_DSI_MSG_LASTCOMMAND; + + len = ops->transfer(panel->host, &cmds->msg); + if (len < 0) { + rc = len; + pr_err("failed to set cmds(%d), rc=%d\n", type, rc); + goto error; + } + if (cmds->post_wait_ms) + usleep_range(cmds->post_wait_ms*1000, + ((cmds->post_wait_ms*1000)+10)); + cmds++; + } +error: + return rc; +} +extern bool HBM_flag ; +extern int oneplus_dim_status; +extern bool aod_real_flag; +static int _sde_connector_update_hbm(struct sde_connector *c_conn) +{ + struct drm_connector *connector = &c_conn->base; + struct dsi_display *dsi_display; + struct sde_connector_state *c_state; + int rc = 0; + int fingerprint_mode; + + if (!c_conn) { + SDE_ERROR("Invalid params sde_connector null\n"); + return -EINVAL; + } + + if (c_conn->connector_type != DRM_MODE_CONNECTOR_DSI) + return 0; + + c_state = to_sde_connector_state(connector->state); + + dsi_display = c_conn->display; + if (!dsi_display || !dsi_display->panel) { + SDE_ERROR("Invalid params(s) dsi_display %pK, panel %pK\n", + dsi_display, + ((dsi_display) ? dsi_display->panel : NULL)); + return -EINVAL; + } + + if (!c_conn->encoder || !c_conn->encoder->crtc || + !c_conn->encoder->crtc->state) { + return 0; + } + if(dsi_display->panel->aod_status==1) { + if(oneplus_dim_status==5) + fingerprint_mode = false; + else + fingerprint_mode = !!oneplus_dim_status; + }else { + if(!(sde_crtc_get_fingerprint_mode(c_conn->encoder->crtc->state))) + fingerprint_mode = false; + else if(oneplus_dim_status == 1) + fingerprint_mode = !!oneplus_dim_status; + else + fingerprint_mode = sde_crtc_get_fingerprint_mode(c_conn->encoder->crtc->state); + } + if (fingerprint_mode != dsi_display->panel->is_hbm_enabled) { + //struct drm_encoder *drm_enc = c_conn->encoder; + dsi_display->panel->is_hbm_enabled = fingerprint_mode; + if (fingerprint_mode) { + HBM_flag=true; + mutex_lock(&dsi_display->panel->panel_lock); + if(dsi_display->panel->aod_status==1){ + printk(KERN_ERR"DSI_CMD_AOD_OFF_HBM_ON_SETTING\n"); + rc = dsi_panel_tx_cmd_set_op(dsi_display->panel, DSI_CMD_AOD_OFF_HBM_ON_SETTING); + aod_real_flag=true; + } + else{ + //sde_encoder_poll_line_counts(drm_enc); + printk(KERN_ERR"DSI_CMD_SET_HBM_ON_5\n"); + rc = dsi_panel_tx_cmd_set_op(dsi_display->panel, DSI_CMD_SET_HBM_ON_5); + } + SDE_ATRACE_END("set_hbm_on"); + mutex_unlock(&dsi_display->panel->panel_lock); + if (rc) { + pr_err("failed to send DSI_CMD_HBM_ON cmds, rc=%d\n", rc); + return rc; + } + } else { + + + HBM_flag=false; + //_sde_connector_update_bl_scale(c_conn); + mutex_lock(&dsi_display->panel->panel_lock); + if(dsi_display->panel->aod_status==1){ + if(oneplus_dim_status == 5){ + printk(KERN_ERR"DSI_CMD_SET_HBM_OFF \n"); + rc = dsi_panel_tx_cmd_set_op(dsi_display->panel, DSI_CMD_SET_HBM_OFF); + aod_real_flag=true; + oneplus_dim_status=0; + + } + else { + printk(KERN_ERR"DSI_CMD_HBM_OFF_AOD_ON_SETTING \n"); + rc = dsi_panel_tx_cmd_set_op(dsi_display->panel, DSI_CMD_HBM_OFF_AOD_ON_SETTING); + } + } + else + { + HBM_flag=false; + //sde_encoder_poll_line_counts(drm_enc); + printk(KERN_ERR"DSI_CMD_SET_HBM_OFF\n"); + rc = dsi_panel_tx_cmd_set_op(dsi_display->panel, DSI_CMD_SET_HBM_OFF); + } + SDE_ATRACE_END("set_hbm_off"); + mutex_unlock(&dsi_display->panel->panel_lock); + _sde_connector_update_bl_scale(c_conn); + if (rc) { + pr_err("failed to send DSI_CMD_HBM_OFF cmds, rc=%d\n", rc); + return rc; + } + } + } + return 0; +} static int _sde_connector_update_dirty_properties( struct drm_connector *connector) { @@ -615,7 +782,11 @@ int sde_connector_pre_kickoff(struct drm_connector *connector) SDE_EVT32(connector->base.id, SDE_EVTLOG_ERROR); goto end; } - + rc = _sde_connector_update_hbm(c_conn); + if (rc) { + SDE_EVT32(connector->base.id, SDE_EVTLOG_ERROR); + goto end; + } if (!c_conn->ops.pre_kickoff) return 0; diff --git a/drivers/gpu/drm/msm/sde/sde_crtc.c b/drivers/gpu/drm/msm/sde/sde_crtc.c index 3e575d977ec1..fbb7587ed22b 100755 --- a/drivers/gpu/drm/msm/sde/sde_crtc.c +++ b/drivers/gpu/drm/msm/sde/sde_crtc.c @@ -1656,6 +1656,11 @@ static void _sde_crtc_blend_setup_mixer(struct drm_crtc *crtc, for (i = 0; i < cstate->num_dim_layers; i++) _sde_crtc_setup_dim_layer_cfg(crtc, sde_crtc, mixer, &cstate->dim_layer[i]); + if (cstate->fingerprint_dim_layer) + { + _sde_crtc_setup_dim_layer_cfg(crtc, sde_crtc, + mixer, cstate->fingerprint_dim_layer); + } } _sde_crtc_program_lm_output_roi(crtc); @@ -2501,6 +2506,30 @@ void sde_crtc_complete_commit(struct drm_crtc *crtc, SDE_EVT32_VERBOSE(DRMID(crtc)); sde_core_perf_crtc_update(crtc, 0, false); + { + struct sde_crtc_state *old_cstate; + struct sde_crtc_state *cstate; + struct msm_drm_notifier notifier_data; + int blank; + + if (!old_state) { + SDE_ERROR("failed to find old cstate"); + return; + } + old_cstate = to_sde_crtc_state(old_state); + cstate = to_sde_crtc_state(crtc->state); + if (old_cstate->fingerprint_pressed != cstate->fingerprint_pressed) { + blank = cstate->fingerprint_pressed; + notifier_data.data = ␣ + notifier_data.id = MSM_DRM_PRIMARY_DISPLAY; + pr_err("fingerprint status: %s", + blank ? "pressed" : "up"); + SDE_ATRACE_BEGIN("press_event_notify"); + msm_drm_notifier_call_chain(MSM_DRM_ONSCREENFINGERPRINT_EVENT, + ¬ifier_data); + SDE_ATRACE_END("press_event_notify"); + } + } } /** @@ -2604,6 +2633,278 @@ static void _sde_crtc_set_dim_layer_v1(struct sde_crtc_state *cstate, } } +bool sde_crtc_get_fingerprint_mode(struct drm_crtc_state *crtc_state) +{ + struct sde_crtc_state *cstate; + + if (!crtc_state) + return false; + + cstate = to_sde_crtc_state(crtc_state); + return !!cstate->fingerprint_dim_layer; +} + +bool sde_crtc_get_fingerprint_pressed(struct drm_crtc_state *crtc_state) +{ + struct sde_crtc_state *cstate; + + if (!crtc_state) + return false; + + cstate = to_sde_crtc_state(crtc_state); + return cstate->fingerprint_pressed; +} + +/*******************************************************************/ + +extern int oneplus_force_screenfp; +extern int oneplus_panel_alpha; +struct ba { + u32 brightness; + u32 alpha; +}; + +struct ba brightness_alpha_lut[] = { + {0, 0xff}, + {1, 0xf1}, + {2, 0xec}, + {3, 0xeb}, + {4, 0xea}, + {6, 0xe8}, + {10, 0xe4}, + {20, 0xdc}, + {30, 0xd4}, + {45, 0xcc}, + {70, 0xbe}, + {100, 0xb3}, + {150, 0xa6}, + {227, 0x90}, + {300, 0x83}, + {400, 0x70}, + {500, 0x60}, + {600, 0x53}, + {800, 0x3c}, + {1023, 0x22}, + {2000, 0x83}, +}; + +static int interpolate(int x, int xa, int xb, int ya, int yb) +{ + int bf, factor, plus; + int sub = 0; + + bf = 2 * (yb - ya) * (x - xa) / (xb - xa); + factor = bf / 2; + plus = bf % 2; + if ((xa - xb) && (yb - ya)) + sub = 2 * (x - xa) * (x - xb) / (yb - ya) / (xa - xb); + + return ya + factor + plus + sub; +} + +int brightness_to_alpha(int brightness) +{ + int level = ARRAY_SIZE(brightness_alpha_lut); + int i = 0; + + for (i = 0; i < ARRAY_SIZE(brightness_alpha_lut); i++){ + if (brightness_alpha_lut[i].brightness >= brightness) + break; + } + + if (i == 0) + return brightness_alpha_lut[0].alpha; + else if (i == level) + return brightness_alpha_lut[level - 1].alpha; + + return interpolate(brightness, + brightness_alpha_lut[i-1].brightness, + brightness_alpha_lut[i].brightness, + brightness_alpha_lut[i-1].alpha, + brightness_alpha_lut[i].alpha); +} + +int oneplus_get_panel_brightness_to_alpha(void) +{ + struct dsi_display *display = get_main_display(); + + if (!display) + return 0; + if (oneplus_panel_alpha) + return oneplus_panel_alpha; + //if(display->panel->aod_status==1) + // return brightness_to_alpha(2000); + //else if ((display->panel->aod_status==1) && (display->panel->aod_mode==3)) + // return brightness_to_alpha(1023); + //else + return brightness_to_alpha(display->panel->hbm_backlight); +} + +int oneplus_onscreenaod_hid = 0; +int oneplus_aod_hid = 0; +ssize_t oneplus_display_notify_aod_hid(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int onscreenaod_hid = 0; + SDE_ATRACE_BEGIN("aod_hid_node"); + sscanf(buf, "%du", &onscreenaod_hid); + oneplus_onscreenaod_hid = !!onscreenaod_hid; + if (onscreenaod_hid == oneplus_onscreenaod_hid) + { + SDE_ATRACE_END("oneplus_display_notify_fp_press"); + return count; + } + + pr_err("notify aod hid %d\n", onscreenaod_hid ); + oneplus_onscreenaod_hid = onscreenaod_hid; + SDE_ATRACE_END("aod_hid_node"); + return count; +} + +int oneplus_onscreenfp_status = 0; +ssize_t oneplus_display_notify_fp_press(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct dsi_display *display = get_main_display(); + struct drm_device *drm_dev = display->drm_dev; + struct drm_connector *dsi_connector = display->drm_conn; + struct drm_mode_config *mode_config = &drm_dev->mode_config; + struct drm_atomic_state *state; + struct drm_crtc_state *crtc_state; + struct drm_crtc *crtc; + struct msm_drm_private *priv; + int err; + ktime_t now; + bool need_commit = false; + + int onscreenfp_status = 0; + sscanf(buf, "%du", &onscreenfp_status); + onscreenfp_status = !!onscreenfp_status; + if (onscreenfp_status == oneplus_onscreenfp_status) + { + SDE_ATRACE_END("oneplus_display_notify_fp_press"); + return count; + } + + pr_err("notify fingerpress %d\n", onscreenfp_status ); + oneplus_onscreenfp_status = onscreenfp_status; + + drm_modeset_lock_all(drm_dev); + state = drm_atomic_state_alloc(drm_dev); + state->acquire_ctx = mode_config->acquire_ctx; + crtc = dsi_connector->state->crtc; + crtc_state = drm_atomic_get_crtc_state(state, crtc); + priv = drm_dev->dev_private; + now = ktime_get(); + need_commit = (((now.tv64 - priv->commit_end_time.tv64) > 20000000 ? true:false)&&display->panel->aod_status==0); + + if(need_commit){ + err = drm_atomic_commit(state); + if (err < 0) + drm_atomic_state_free(state); + } + drm_modeset_unlock_all(drm_dev); + SDE_ATRACE_END("oneplus_display_notify_fp_press"); + return count; +} +extern bool HBM_flag; +int oneplus_dim_status = 0; + ssize_t oneplus_display_notify_dim(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct dsi_display *display = get_main_display(); + struct drm_device *drm_dev = display->drm_dev; + struct drm_connector *dsi_connector = display->drm_conn; + struct drm_mode_config *mode_config = &drm_dev->mode_config; + struct drm_atomic_state *state; + struct drm_crtc_state *crtc_state; + struct drm_crtc *crtc; + int dim_status = 0; + int err; + sscanf(buf, "%du", &dim_status); + //dim_status = !!dim_status; + pr_err("notify dim %d\n", dim_status); + + if(display->panel->aod_status==0 && (dim_status == 2)){ + pr_err("fp set it in normal status\n"); + if (dim_status == oneplus_dim_status) + return count; + oneplus_dim_status = dim_status; + SDE_ATRACE_END("oneplus_display_notify_dim"); + return count; + }else if(display->panel->aod_status==1&& dim_status == 2){ + oneplus_onscreenfp_status = 1; + }else if(display->panel->aod_status==1&& dim_status == 0){ + oneplus_onscreenfp_status = 0; + } + + if (dim_status == oneplus_dim_status) + return count; + oneplus_dim_status = dim_status; + drm_modeset_lock_all(drm_dev); + + state = drm_atomic_state_alloc(drm_dev); + state->acquire_ctx = mode_config->acquire_ctx; + crtc = dsi_connector->state->crtc; + crtc_state = drm_atomic_get_crtc_state(state, crtc); + if((oneplus_dim_status !=0) && !(oneplus_dim_status == 5 && display->panel->aod_status==0)){ + err = drm_atomic_commit(state); + if (err < 0) + drm_atomic_state_free(state); + } + drm_modeset_unlock_all(drm_dev); + SDE_ATRACE_END("oneplus_display_notify_dim"); + return count; +} +/***************************************************************************/ +static int sde_crtc_config_fingerprint_dim_layer(struct drm_crtc_state *crtc_state, int stage) +{ + struct sde_crtc_state *cstate; + struct drm_display_mode *mode = &crtc_state->adjusted_mode; + struct sde_hw_dim_layer *fingerprint_dim_layer; + int alpha = oneplus_get_panel_brightness_to_alpha(); + struct sde_kms *kms; + kms = _sde_crtc_get_kms(crtc_state->crtc); + if (!kms || !kms->catalog) { + SDE_ERROR("invalid kms\n"); + return -EINVAL; + } + + cstate = to_sde_crtc_state(crtc_state); + + if (cstate->num_dim_layers == SDE_MAX_DIM_LAYERS - 1) { + pr_err("failed to get available dim layer for custom\n"); + return -EINVAL; + } + + if (!alpha) { + cstate->fingerprint_dim_layer = NULL; + return 0; + } + + if ((stage + SDE_STAGE_0) >= kms->catalog->mixer[0].sblk->maxblendstages) { + return -EINVAL; + } + + fingerprint_dim_layer = &cstate->dim_layer[cstate->num_dim_layers]; + fingerprint_dim_layer->flags = SDE_DRM_DIM_LAYER_INCLUSIVE; + fingerprint_dim_layer->stage = stage + SDE_STAGE_0; + + fingerprint_dim_layer->rect.x = 0; + fingerprint_dim_layer->rect.y = 0; + fingerprint_dim_layer->rect.w = mode->hdisplay; + fingerprint_dim_layer->rect.h = mode->vdisplay; + fingerprint_dim_layer->color_fill = (struct sde_mdss_color) {0, 0, 0, alpha}; + cstate->fingerprint_dim_layer = fingerprint_dim_layer; + SDE_ATRACE_END("set_dim_layer"); + + return 0; +} + + /** * _sde_crtc_set_dest_scaler - copy dest scaler settings from userspace * @sde_crtc : Pointer to sde crtc @@ -4586,6 +4887,145 @@ static int _sde_crtc_check_secure_state(struct drm_crtc *crtc, return 0; } + +extern int sde_plane_check_fingerprint_layer(const struct drm_plane_state *drm_state); +static int sde_crtc_onscreenfinger_atomic_check(struct sde_crtc_state *cstate, + struct plane_state *pstates, int cnt) +{ + int fp_index = -1; + int fppressed_index = -1; + int aod_index = -1; + int zpos = INT_MAX; + int mode; + int fp_mode = oneplus_onscreenfp_status; + int dim_mode = oneplus_dim_status; + int aod_mode = -1; + int i; + struct dsi_display *display = get_main_display(); + + if (!display) + return 0; + + if(display->panel->aod_status==1){ + if(oneplus_dim_status == 2 && oneplus_onscreenfp_status ==1){ + fp_mode = 1; + dim_mode = 0; + }else if(oneplus_dim_status == 2 && oneplus_onscreenfp_status == 0){ + fp_mode = 1; + dim_mode = 0; + } + } + if(oneplus_onscreenaod_hid && oneplus_dim_status == 5) + oneplus_aod_hid = 1; + aod_mode = oneplus_aod_hid; + if(( oneplus_dim_status == 5) && display->panel->aod_status==0) + dim_mode = 0; + + for (i = 0; i < cnt; i++) { + mode = sde_plane_check_fingerprint_layer(pstates[i].drm_pstate); + if (mode == 1) + fp_index = i; + if (mode == 2) + fppressed_index = i; + if (mode ==3) + aod_index = i; + } + if(fp_index >=0) + display->panel->dim_status = true; + else + display->panel->dim_status = false; + + if(aod_index <0) + oneplus_aod_hid = 0; + + if (fp_index >= 0 || fppressed_index >= 0 || oneplus_force_screenfp) { + if (fp_index >= 0 && fppressed_index >= 0) { + if (pstates[fp_index].stage >= pstates[fppressed_index].stage) { + SDE_ERROR("Bug!!@@@@: fp layer top of fppressed layer\n"); + return -EINVAL; + } + } + if (fppressed_index >= 0) { + if (fp_mode == 0) { + pstates[fppressed_index].sde_pstate->property_values[PLANE_PROP_ALPHA].value = 0; + fppressed_index = -1; + } else { + pstates[fppressed_index].sde_pstate->property_values[PLANE_PROP_ALPHA].value = 0xff; + } + } + if (fp_index >= 0) { + if (dim_mode == 0) { + pstates[fp_index].sde_pstate->property_values[PLANE_PROP_ALPHA].value = 0; + fp_index = -1; + } else { + pstates[fp_index].sde_pstate->property_values[PLANE_PROP_ALPHA].value = 0xff; + } + } + + if (aod_index >= 0) { + if (aod_mode == 1) { + SDE_ATRACE_BEGIN("aod_layer_hid"); + pstates[aod_index].sde_pstate->property_values[PLANE_PROP_ALPHA].value = 0; + aod_index = -1; + SDE_ATRACE_END("aod_layer_hid"); + } + } + + if (aod_index >= 0) { + if (zpos > pstates[aod_index].stage) + zpos = pstates[aod_index].stage; + pstates[aod_index].stage++; + } + + if (fppressed_index >= 0) { + if (zpos > pstates[fppressed_index].stage) + zpos = pstates[fppressed_index].stage; + pstates[fppressed_index].stage++; + } + + if (fp_index >= 0) { + if (zpos > pstates[fp_index].stage) + zpos = pstates[fp_index].stage; + pstates[fp_index].stage++; + } + for (i = 0; i < cnt; i++) { + if (i == fp_index || i == fppressed_index || i == aod_index) + { + continue; + } + if (pstates[i].stage >= zpos) { + // SDE_ERROR("Warn!!: the fp layer not on top"); + pstates[i].stage++; + } + } + if (zpos == INT_MAX) { + zpos = 0; + for (i = 0; i < cnt; i++) { + if (pstates[i].stage > zpos) + zpos = pstates[i].stage; + } + zpos++; + } + + if (fp_index >= 0 && sde_crtc_config_fingerprint_dim_layer(&cstate->base, zpos)) { + SDE_ERROR("Failed to config dim layer\n"); + return -EINVAL; + } + if (fppressed_index >= 0) + cstate->fingerprint_pressed = true; + else { + cstate->fingerprint_pressed = false; + } + } + if(fp_index < 0){ + cstate->fingerprint_dim_layer = NULL; + } + if (fppressed_index < 0) + cstate->fingerprint_pressed = false; + + return 0; +} + static int sde_crtc_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state) { @@ -4735,6 +5175,10 @@ static int sde_crtc_atomic_check(struct drm_crtc *crtc, sde_plane_clear_multirect(pipe_staged[i]); } } + rc = sde_crtc_onscreenfinger_atomic_check(cstate, pstates, cnt); + if (rc) + goto end; + /* assign mixer stages based on sorted zpos property */ sort(pstates, cnt, sizeof(pstates[0]), pstate_cmp, NULL); rc = _sde_crtc_check_secure_state(crtc, state, pstates, cnt); diff --git a/drivers/gpu/drm/msm/sde/sde_crtc.h b/drivers/gpu/drm/msm/sde/sde_crtc.h index a1161abd9193..5c1602c52967 100755 --- a/drivers/gpu/drm/msm/sde/sde_crtc.h +++ b/drivers/gpu/drm/msm/sde/sde_crtc.h @@ -415,6 +415,9 @@ struct sde_crtc_state { u64 sbuf_clk_rate[2]; bool sbuf_clk_shifted; + bool fingerprint_pressed; + struct sde_hw_dim_layer *fingerprint_dim_layer; + struct sde_crtc_respool rp; }; diff --git a/drivers/gpu/drm/msm/sde/sde_encoder.c b/drivers/gpu/drm/msm/sde/sde_encoder.c index efce43df1d5a..36e42d345b9e 100755 --- a/drivers/gpu/drm/msm/sde/sde_encoder.c +++ b/drivers/gpu/drm/msm/sde/sde_encoder.c @@ -3571,6 +3571,35 @@ void sde_encoder_trigger_kickoff_pending(struct drm_encoder *drm_enc) } } +extern bool sde_crtc_get_fingerprint_mode(struct drm_crtc_state *crtc_state); +static bool +_sde_encoder_setup_dither_for_onscreenfingerprint(struct sde_encoder_phys *phys, + void *dither_cfg, int len) +{ + struct drm_encoder *drm_enc = phys->parent; + struct drm_msm_dither dither; + + if (!drm_enc || !drm_enc->crtc) + return -EFAULT; + + if (!sde_crtc_get_fingerprint_mode(drm_enc->crtc->state)) + return -EINVAL; + + if (len != sizeof(dither)) + return -EINVAL; + + memcpy(&dither, dither_cfg, len); + dither.c0_bitdepth = 6; + dither.c1_bitdepth = 6; + dither.c2_bitdepth = 6; + dither.c3_bitdepth = 6; + dither.temporal_en = 1; + + phys->hw_pp->ops.setup_dither(phys->hw_pp, &dither, len); + + return 0; +} + static void _sde_encoder_setup_dither(struct sde_encoder_phys *phys) { void *dither_cfg; @@ -3621,7 +3650,8 @@ static void _sde_encoder_setup_dither(struct sde_encoder_phys *phys) } } } else { - phys->hw_pp->ops.setup_dither(phys->hw_pp, dither_cfg, len); + if (_sde_encoder_setup_dither_for_onscreenfingerprint(phys, dither_cfg, len)) + phys->hw_pp->ops.setup_dither(phys->hw_pp, dither_cfg, len); } } diff --git a/drivers/gpu/drm/msm/sde/sde_hw_mdss.h b/drivers/gpu/drm/msm/sde/sde_hw_mdss.h index 9b4e03d65098..2a8a803187ec 100755 --- a/drivers/gpu/drm/msm/sde/sde_hw_mdss.h +++ b/drivers/gpu/drm/msm/sde/sde_hw_mdss.h @@ -535,6 +535,13 @@ struct sde_hw_dim_layer { struct sde_rect rect; }; +struct fingerprint_dim_layer { + uint32_t flags; + uint32_t stage; + struct sde_mdss_color color_fill; + struct sde_rect rect; +}; + /** * struct sde_splash_lm_hw - Struct contains LM block properties * @lm_id: stores the current LM ID diff --git a/drivers/gpu/drm/msm/sde/sde_plane.c b/drivers/gpu/drm/msm/sde/sde_plane.c index 210ee2ca6be7..dbaf5bfd21bf 100755 --- a/drivers/gpu/drm/msm/sde/sde_plane.c +++ b/drivers/gpu/drm/msm/sde/sde_plane.c @@ -2843,6 +2843,17 @@ void sde_plane_clear_multirect(const struct drm_plane_state *drm_state) pstate->multirect_index = SDE_SSPP_RECT_SOLO; pstate->multirect_mode = SDE_SSPP_MULTIRECT_NONE; } +int sde_plane_check_fingerprint_layer(const struct drm_plane_state *drm_state) +{ + struct sde_plane_state *pstate; + + if (!drm_state) + return 0; + + pstate = to_sde_plane_state(drm_state); + + return sde_plane_get_property(pstate, PLANE_PROP_CUSTOM); +} /** * multi_rect validate API allows to validate only R0 and R1 RECT * passing for each plane. Client of this API must not pass multiple diff --git a/drivers/input/fingerprint/Kconfig b/drivers/input/fingerprint/Kconfig index 36adb1ce512c..f7c793190132 100755 --- a/drivers/input/fingerprint/Kconfig +++ b/drivers/input/fingerprint/Kconfig @@ -21,4 +21,7 @@ config FINGERPRINT_GOODIX tristate "goodix fingerprint sensor support" depends on SPI_MASTER +config FINGERPRINT_SILEAD + tristate "silead fingerprint sensor support" + depends on SPI_MASTER endif diff --git a/drivers/input/fingerprint/Makefile b/drivers/input/fingerprint/Makefile index e91a39df7605..1489636478fb 100755 --- a/drivers/input/fingerprint/Makefile +++ b/drivers/input/fingerprint/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_FINGERPRINT_DETECT) += fingerprint_detect/ obj-$(CONFIG_FINGERPRINT_FPC) += fpc/ obj-$(CONFIG_FINGERPRINT_GOODIX) += goodix/ +obj-$(CONFIG_FINGERPRINT_SILEAD) += silead/ diff --git a/drivers/input/fingerprint/fingerprint_detect/fingerprint_detect.c b/drivers/input/fingerprint/fingerprint_detect/fingerprint_detect.c index e902afd22336..592f14a0bb53 100755 --- a/drivers/input/fingerprint/fingerprint_detect/fingerprint_detect.c +++ b/drivers/input/fingerprint/fingerprint_detect/fingerprint_detect.c @@ -286,7 +286,7 @@ static int fingerprint_detect_probe(struct platform_device *pdev) fp_detect->sensor_version = 0x04; } else { push_component_info(FINGERPRINTS, - "goodix5228", "goodix"); + "sileadgsl7000", "silead"); fp_detect->sensor_version = 0x05; } } diff --git a/drivers/input/fingerprint/goodix/gf_spi.c b/drivers/input/fingerprint/goodix/gf_spi.c index 2bf3fab2eeb4..fcf8bc175649 100644 --- a/drivers/input/fingerprint/goodix/gf_spi.c +++ b/drivers/input/fingerprint/goodix/gf_spi.c @@ -419,7 +419,7 @@ static long gf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) pr_info("power cmd\n"); } else { pr_info("Sensor is power off currently. \n"); - return -ENODEV; + //return -ENODEV; } } @@ -444,7 +444,7 @@ static long gf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) break; case GF_IOC_RESET: pr_info("%s GF_IOC_RESET. \n", __func__); - gf_hw_reset(gf_dev, 3); + gf_hw_reset(gf_dev, 0); break; case GF_IOC_INPUT_KEY_EVENT: if (copy_from_user(&gf_key, (struct gf_key *)arg, sizeof(struct gf_key))) { @@ -572,7 +572,7 @@ static int gf_open(struct inode *inode, struct file *filp) goto err_irq; } #endif - gf_hw_reset(gf_dev, 3); + //gf_hw_reset(gf_dev, 5); gf_dev->device_available = 1; } } else { @@ -661,6 +661,29 @@ static const struct attribute_group gf_attribute_group = { .attrs = gf_attributes, }; +int gf_opticalfp_irq_handler(int event) +{ + char msg = 0; + + pr_info("[info]:%s, event %d", __func__, event); + + if (gf.spi == NULL) { + return 0; + } + if (event == 1) { + msg = GF_NET_EVENT_TP_TOUCHDOWN; + sendnlmsg(&msg); + } else if (event == 0) { + msg = GF_NET_EVENT_TP_TOUCHUP; + sendnlmsg(&msg); + } + + __pm_wakeup_event(&fp_wakelock, 10*HZ); + + return 0; +} +EXPORT_SYMBOL(gf_opticalfp_irq_handler); + #if defined(CONFIG_FB) static int goodix_fb_state_chg_callback(struct notifier_block *nb, unsigned long val, void *data) @@ -725,7 +748,8 @@ static int goodix_fb_state_chg_callback( unsigned int blank; char msg = 0; - if (val != MSM_DRM_EARLY_EVENT_BLANK) + if (val != MSM_DRM_EARLY_EVENT_BLANK && + val != MSM_DRM_ONSCREENFINGERPRINT_EVENT) return 0; if (evdata->id != MSM_DRM_PRIMARY_DISPLAY) @@ -733,6 +757,27 @@ static int goodix_fb_state_chg_callback( pr_info("[info] %s go to the msm_drm_notifier_callback value = %d\n", __func__, (int)val); + blank = *(int *)(evdata->data); + if (val == MSM_DRM_ONSCREENFINGERPRINT_EVENT) { + pr_info("[%s] UI ready enter\n", __func__); + + switch (blank) { + case 0: + pr_info("[%s] UI disappear\n", __func__); + msg = GF_NET_EVENT_UI_DISAPPEAR; + sendnlmsg(&msg); + break; + case 1: + pr_info("[%s] UI ready\n", __func__); + msg = GF_NET_EVENT_UI_READY; + sendnlmsg(&msg); + break; + default: + pr_info("[%s] Unknown EVENT\n", __func__); + break; + } + return 0; + } gf_dev = container_of(nb, struct gf_dev, msm_drm_notif); if (evdata && evdata->data && val == MSM_DRM_EARLY_EVENT_BLANK && gf_dev) { diff --git a/drivers/input/fingerprint/goodix/gf_spi.h b/drivers/input/fingerprint/goodix/gf_spi.h index 07b3e8739c23..4b0d762a5f38 100644 --- a/drivers/input/fingerprint/goodix/gf_spi.h +++ b/drivers/input/fingerprint/goodix/gf_spi.h @@ -120,6 +120,10 @@ struct gf_ioc_chip_info { #define GF_NET_EVENT_IRQ 1 #define GF_NET_EVENT_FB_BLACK 2 #define GF_NET_EVENT_FB_UNBLACK 3 +#define GF_NET_EVENT_TP_TOUCHDOWN 4 +#define GF_NET_EVENT_TP_TOUCHUP 5 +#define GF_NET_EVENT_UI_READY 6 +#define GF_NET_EVENT_UI_DISAPPEAR 7 #define NETLINK_TEST 25 struct gf_dev { @@ -177,4 +181,5 @@ int gf_irq_num(struct gf_dev *gf_dev); void sendnlmsg(char *msg); int netlink_init(void); void netlink_exit(void); +extern int gf_opticalfp_irq_handler(int event); #endif /*__GF_SPI_H*/ diff --git a/drivers/input/fingerprint/goodix/platform.c b/drivers/input/fingerprint/goodix/platform.c index 6c925e3693df..c8783d1c335d 100644 --- a/drivers/input/fingerprint/goodix/platform.c +++ b/drivers/input/fingerprint/goodix/platform.c @@ -19,6 +19,8 @@ #elif defined(USE_PLATFORM_BUS) #include #endif +#include + int gf_pinctrl_init(struct gf_dev* gf_dev) { int ret = 0; @@ -133,8 +135,12 @@ int gf_parse_dts(struct gf_dev* gf_dev) if (rc) pr_err("Regulator vdd enable failed rc=%d\n", rc); - - + if (get_boot_mode() == MSM_BOOT_MODE__FACTORY) + { + rc = regulator_disable(gf_dev->vdd_3v2); + if (rc) + pr_err("Regulator vdd disable failed rc=%d\n", rc); + } err_irq: devm_gpio_free(dev, gf_dev->reset_gpio); @@ -161,7 +167,6 @@ int gf_power_on(struct gf_dev* gf_dev) { int rc = 0; - msleep(10); pr_info("---- power on ok ----\n"); return rc; @@ -169,9 +174,10 @@ int gf_power_on(struct gf_dev* gf_dev) int gf_power_off(struct gf_dev* gf_dev) { - int rc = 0; + int rc = 0; + + pr_info("---- power off ----\n"); - pr_info("---- power off ----\n"); return rc; } @@ -183,7 +189,7 @@ int gf_hw_reset(struct gf_dev *gf_dev, unsigned int delay_ms) } gpio_direction_output(gf_dev->reset_gpio, 1); gpio_set_value(gf_dev->reset_gpio, 0); - mdelay(20); + mdelay(3); gpio_set_value(gf_dev->reset_gpio, 1); mdelay(delay_ms); return 0; diff --git a/drivers/input/fingerprint/silead/Makefile b/drivers/input/fingerprint/silead/Makefile new file mode 100755 index 000000000000..076d71b55b19 --- /dev/null +++ b/drivers/input/fingerprint/silead/Makefile @@ -0,0 +1,3 @@ +ccflags-$(CONFIG_FINGERPRINT_SILEAD) += -DBSP_SIL_PLAT_QCOM +ccflags-$(CONFIG_FINGERPRINT_SILEAD) += -DBSP_SIL_POWER_SUPPLY_REGULATOR +obj-$(CONFIG_FINGERPRINT_SILEAD) += silead_fp_platform.o \ No newline at end of file diff --git a/drivers/input/fingerprint/silead/silead_fp.h b/drivers/input/fingerprint/silead/silead_fp.h new file mode 100755 index 000000000000..16b86b8fed89 --- /dev/null +++ b/drivers/input/fingerprint/silead/silead_fp.h @@ -0,0 +1,240 @@ +/* + * @file silead_fp.h + * @brief Contains silead_fp device head file. + * + * + * Copyright 2016-2018 Slead Inc. + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + * + * ------------------- Revision History ------------------------------ + * + * Bill Yu 2018/5/2 0.1.0 Init version + * Bill Yu 2018/5/28 0.1.1 Disable netlink if netlink id = 0 + * Bill Yu 2018/6/1 0.1.2 Support wakelock + * Bill Yu 2018/6/5 0.1.3 Support chip enter power down + * Bill Yu 2018/6/7 0.1.4 Support create proc node + * + */ + +#ifndef __SILEAD_FP_H__ +#define __SILEAD_FP_H__ + +#ifndef _LINUX_WAKELOCK_H +enum { + WAKE_LOCK_SUSPEND, /* Prevent suspend */ + WAKE_LOCK_TYPE_COUNT +}; + +struct wake_lock { + struct wakeup_source ws; +}; + +static inline void wake_lock_init(struct wake_lock *lock, int type, + const char *name) +{ + wakeup_source_init(&lock->ws, name); +} + +static inline void wake_lock_destroy(struct wake_lock *lock) +{ + wakeup_source_trash(&lock->ws); +} + +static inline void wake_lock(struct wake_lock *lock) +{ + __pm_stay_awake(&lock->ws); +} + +static inline void wake_lock_timeout(struct wake_lock *lock, long timeout) +{ + __pm_wakeup_event(&lock->ws, jiffies_to_msecs(timeout)); +} + +static inline void wake_unlock(struct wake_lock *lock) +{ + __pm_relax(&lock->ws); +} +#endif /* _LINUX_WAKELOCK_H */ + +enum _pwdn_mode_t { + SIFP_PWDN_NONE = 0, + SIFP_PWDN_POWEROFF = 1, /* shutdown the avdd power supply */ + SIFP_PWDN_FLASH = 2, /* shutdown avdd 200ms for H/W full reset */ + SIFP_PWDN_MAX, +}; +enum _netlink_cmd_t { + SIFP_NETLINK_START = 0, + SIFP_NETLINK_IRQ = 1, + SIFP_NETLINK_SCR_OFF, + SIFP_NETLINK_SCR_ON, + SIFP_NETLINK_CONNECT, + SIFP_NETLINK_DISCONNECT, + SIFP_NETLINK_UI_READY, + SIFP_NETLINK_TP_TOUCHDOWN, + SIFP_NETLINK_TP_TOUCHUP, + SIFP_NETLINK_MAX, +}; + +enum _fp_nav_key_v_t { + NAV_KEY_UNKNOWN = 0, + NAV_KEY_START = 1, + NAV_KEY_UP = NAV_KEY_START, + NAV_KEY_DOWN, + NAV_KEY_RIGHT, + NAV_KEY_LEFT, + NAV_KEY_CLICK, + NAV_KEY_DCLICK, + NAV_KEY_LONGPRESS, + NAV_KEY_CLICK_DOWN, + NAV_KEY_CLICK_UP, + NAV_KEY_MAX, + NAV_KEY_WAITMORE = 1000, +}; + +#define IS_KEY_VALID(k) ((k) > NAV_KEY_UNKNOWN && (k) < NAV_KEY_MAX) + +enum _fp_nav_key_f_t { + NAV_KEY_FLAG_UP = 0, + NAV_KEY_FLAG_DOWN, + NAV_KEY_FLAG_CLICK, +}; + +struct fp_dev_key_t { + int value; + uint32_t flag; /* key down = 1, key up = 0, key down+up = 2 */ +}; + +#define DEVNAME_LEN 16 +struct fp_dev_init_t { + uint8_t mode; + uint8_t bits; + uint16_t delay; + uint32_t speed; + char dev[DEVNAME_LEN]; + uint8_t nl_id; + uint8_t dev_id; + uint16_t reserve; + uint32_t reg; + char ta[DEVNAME_LEN]; +}; + +struct fp_underscreen_info { + uint8_t touch_state; + uint8_t area_rate; + uint16_t x; + uint16_t y; +}; + +struct fp_dev_debug_t { + uint8_t cmd[4]; +}; + +struct fp_dev_kmap_t { + uint16_t k[NAV_KEY_MAX-NAV_KEY_START]; /* Up/Down/Right/Left/Click/Double Click/Longpress */ +}; + +#define PROC_VND_ID_LEN 32 + +#define SIFP_IOC_MAGIC 's' + +#define SIFP_IOC_RESET _IOW(SIFP_IOC_MAGIC, 10, u8) + +#define SIFP_IOC_ENABLE_IRQ _IO(SIFP_IOC_MAGIC, 11) +#define SIFP_IOC_DISABLE_IRQ _IO(SIFP_IOC_MAGIC, 12) +#define SIFP_IOC_WAIT_IRQ _IOR(SIFP_IOC_MAGIC, 13, u8) +#define SIFP_IOC_CLR_IRQ _IO(SIFP_IOC_MAGIC, 14) +//#define SPFP_IOC_EXIT _IOR(SIFP_IOC_MAGIC, 1, u8) + +#define SIFP_IOC_KEY_EVENT _IOW(SIFP_IOC_MAGIC, 15, struct fp_dev_key_t) +#define SIFP_IOC_INIT _IOR(SIFP_IOC_MAGIC, 16, struct fp_dev_init_t) +#define SIFP_IOC_DEINIT _IO(SIFP_IOC_MAGIC, 17) +#define SIFP_IOC_IRQ_STATUS _IOR(SIFP_IOC_MAGIC, 18, u8) +#define SIFP_IOC_DEBUG _IOR(SIFP_IOC_MAGIC, 19, struct fp_dev_debug_t) +#define SIFP_IOC_SCR_STATUS _IOR(SIFP_IOC_MAGIC, 20, u8) +#define SIFP_IOC_GET_VER _IOR(SIFP_IOC_MAGIC, 21, char[10]) +#define SIFP_IOC_SET_KMAP _IOW(SIFP_IOC_MAGIC, 22, uint16_t[7]) +#define SIFP_IOC_ACQ_SPI _IO(SIFP_IOC_MAGIC, 23) +#define SIFP_IOC_RLS_SPI _IO(SIFP_IOC_MAGIC, 24) +#define SIFP_IOC_PKG_SIZE _IOR(SIFP_IOC_MAGIC, 25, u8) +#define SIFP_IOC_DBG_LEVEL _IOWR(SIFP_IOC_MAGIC,26, u8) +#define SIFP_IOC_WAKELOCK _IOW(SIFP_IOC_MAGIC, 27, u8) +#define SIFP_IOC_PWDN _IOW(SIFP_IOC_MAGIC, 28, u8) +#define SIFP_IOC_PROC_NODE _IOW(SIFP_IOC_MAGIC, 29, char[PROC_VND_ID_LEN]) +#define SIFP_IOC_GET_TP_TOUCH_INFO _IOR(SIFP_IOC_MAGIC, 30, struct fp_underscreen_info) +#define SIFP_IOC_SET_TP_MSG_REPORT_MODE _IOW(SIFP_IOC_MAGIC, 31, u8) + +#define SIFP_IOC_REPORT_KEY _IOW(SIFP_IOC_MAGIC, 32, uint8_t) + +#define RESET_TIME 1 /* Default chip reset wait time(ms) */ +#define RESET_TIME_MULTIPLE 1 /* Multiple for reset time multiple*wait_time */ +#define SIFP_NETLINK_ROUTE 30 +#define NL_MSG_LEN 16 + +//#define PROC_DIR "fp" /* if defined, create node under /proc/fp/xxx */ +//#define PROC_NODE "fp_id" /* proc node name */ //remove by chenran + +#if (SIFP_NETLINK_ROUTE > 0) + #define BSP_SIL_NETLINK +#endif + +#if !defined(BSP_SIL_PLAT_MTK) && !defined(BSP_SIL_PLAT_QCOM) + #define BSP_SIL_PLAT_COMM +#endif /* ! BSP_SIL_PLAT_MTK & ! BSP_SIL_PLAT_QCOM */ + +/* Todo: enable correct power supply mode */ +#if !defined(BSP_SIL_POWER_SUPPLY_REGULATOR) +#define BSP_SIL_POWER_SUPPLY_REGULATOR +//#define BSP_SIL_POWER_SUPPLY_PINCTRL +//#define BSP_SIL_POWER_SUPPLY_GPIO +#endif + +/* AVDD voltage range 2.8v ~ 3.3v */ +#define AVDD_MAX 3000000 +#define AVDD_MIN 3000000 + +/* VDDIO voltage range 1.8v ~ AVDD */ +#define VDDIO_MAX 1800000 +#define VDDIO_MIN 1800000 + +#define CURRENT 50000 + +#if defined(BSP_SIL_POWER_SUPPLY_REGULATOR) && defined(BSP_SIL_POWER_SUPPLY_PINCTRL) || defined(BSP_SIL_POWER_SUPPLY_REGULATOR) && defined(BSP_SIL_POWER_SUPPLY_GPIO) || defined(BSP_SIL_POWER_SUPPLY_GPIO) && defined(BSP_SIL_POWER_SUPPLY_PINCTRL) + #error "Don't define multiple power supply mode!" +#endif + +#ifdef BSP_SIL_PLAT_MTK + #include "silead_fp_mtk.h" + #define PLAT_H "silead_fp_mtk.c" + + #define DEVICE "/dev/spidev1.0" + //#define BSP_SIL_IRQ_CONFIRM + #define PKG_SIZE 1 +#elif defined(BSP_SIL_PLAT_QCOM) + #define QSEE_V4 /* Enable it if QSEE v4 or higher */ + #include "silead_fp_qcom.h" + #define PLAT_H "silead_fp_qcom.c" + + #define DEVICE "/dev/spidev0.0" + #define BSP_SIL_IRQ_CONFIRM + #define PKG_SIZE 4 + #define TANAME "sileadta" +#else + #include "silead_fp_comm.h" + #define PLAT_H "silead_fp_comm.c" + + #define DEVICE "/dev/spidev0.0" + #define BSP_SIL_IRQ_CONFIRM + #define PKG_SIZE 4 + #define TANAME "" +#endif /* BSP_SIL_PLAT_XXX */ + +extern int opticalfp_irq_handler(struct fp_underscreen_info* tp_info); +#endif /* __SILEAD_FP_H__ */ + +/* End of file silead_fp.h */ diff --git a/drivers/input/fingerprint/silead/silead_fp_platform.c b/drivers/input/fingerprint/silead/silead_fp_platform.c new file mode 100755 index 000000000000..66f80c13cacd --- /dev/null +++ b/drivers/input/fingerprint/silead/silead_fp_platform.c @@ -0,0 +1,1555 @@ +/************************************************************************************ + * @file silead_fp_platform.c + * @brief Contains silead_fp device implementation. + * + * + * Copyright 2016-2018 Slead Inc. + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + * + * ------------------- Revision History ------------------------------ + * + * Bill Yu 2018/4/2 0.1.6 Init version + * Bill Yu 2018/5/2 0.1.7 Fix compile error for some platform + * Bill Yu 2018/5/20 0.1.8 Default wait 3ms after reset + * Bill Yu 2018/5/28 0.1.9 Support poll/read if netlink id = 0 + * Bill Yu 2018/6/1 0.2.0 Support wakelock + * Bill Yu 2018/6/5 0.2.1 Support chip enter power down + * Bill Yu 2018/6/7 0.2.2 Support create proc node + * + * 2018/06/24 add fix for coverity 63621 63600 + * 2018/06/26 add silead power_on and power_offf for deep_sleep + * 2018/06/30 add for modify kernel warning (power on) + * 2018/07/07 add for tp irq and lcd notify + * 2018/07/21 add for get tp info + ***********************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)) +#include +#endif +#include +#ifdef CONFIG_HAS_EARLYSUSPEND +#include +#else +#include +#endif + +#include "silead_fp.h" +#include +#include +#include "../fingerprint_detect/fingerprint_detect.h" +#include "../../../gpu/drm/msm/sde/sde_trace.h" + +#define FP_DEV_NAME "silead_fp" +#define FP_DEV_MAJOR 0 /* assigned */ + +#define FP_CLASS_NAME "silead_fp" +#define FP_INPUT_NAME "fp-keys" + +#define FP_DEV_VERSION "v0.2.3" +#define LOG_TAG "[+silead_fp-] " + +#define BSP_SIL_IRQ_ASYNC /* IRQ use asynchrous mode. */ +static struct silfp_data *optical_fp; +static struct fp_underscreen_info fp_tpinfo; +static unsigned int lasttouchmode = 0; + +#ifndef BSP_SIL_NETLINK +struct silfp_msg_list { + unsigned char msg; + struct list_head list; +}; +#endif /* !BSP_SIL_NETLINK */ + +struct silfp_data { + dev_t devt; + struct cdev cdev; + spinlock_t spi_lock; + struct platform_device *spi; + struct list_head device_entry; + + unsigned users; + + struct device *dev; + int ref; + + struct input_dev *input; + + spinlock_t irq_lock; + int int_port; + int irq; + s32 irq_is_disable; + int irq_ignore; + s32 power_is_off; + int rst_port; + struct work_struct work; + struct completion done; + struct wake_lock wakelock; + struct wake_lock wakelock_hal; + +#ifdef BSP_SIL_NETLINK + /* for netlink use */ + struct sock *nl_sk; +#else + spinlock_t read_lock; + wait_queue_head_t read_queue; + struct list_head msg_q; +#endif + struct fp_dev_kmap_t keymap_cust; + + int scr_off; +#ifdef CONFIG_HAS_EARLYSUSPEND + struct early_suspend es; +#else + struct notifier_block msm_drm_notif; +#endif /* CONFIG_HAS_EARLYSUSPEND */ + + /* for power supply */ +#ifdef BSP_SIL_POWER_SUPPLY_REGULATOR + struct regulator *avdd_ldo; + struct regulator *vddio_ldo; +#endif /* BSP_SIL_POWER_SUPPLY_REGULATOR */ +#ifdef BSP_SIL_POWER_SUPPLY_GPIO + int avdd_port; + int vddio_port; +#endif /* BSP_SIL_POWER_SUPPLY_GPIO */ +#ifdef PROC_NODE + struct proc_dir_entry *proc_root; + struct proc_dir_entry *proc_entry; +#endif /* PROC_NODE */ + + /* for spi enable/disable */ + atomic_t spionoff_count; + + struct fp_plat_t pin; + + atomic_t init; + struct pinctrl *sl_pinctrl; + struct pinctrl_state *gpio_state_enable; +}; + +typedef enum _fp_spi_speet_t { + SPEED_1M=1*1000*1000, + SPEED_LOW = SPEED_1M, + SPEED_5M=5*1000*1000, + SPEED_MEDIUM = SPEED_5M, + SPEED_8M=8*1000*1000, + SPEED_9M=9*1000*1000, + SPEED_HIGH=SPEED_8M, + SPEED_10M=10*1000*1000, +} fp_spi_speet_t ; + +static struct fp_dev_init_t silfp_dev_init_d = { + .mode = 0, + .bits = 8, + .speed = SPEED_HIGH, + .delay = 100, + .dev = DEVICE, + .nl_id = SIFP_NETLINK_ROUTE, + .dev_id = 0, +}; + +/* on some platform, home key has been redefine to KEY_HOMEPAGE! */ +/* double check the define on customer board!!! + out/target/product/.../system/usr/keylayout/Generic.kl + kernel/include/uapi/linux/input.h + + KEY_HOMEPAGE + KEY_HOME + KEY_MENU + KEY_BACK + KEY_POWER + KEY_CAMERA + KEY_VOLUMEUP + KEY_VOLUMEDOWN */ + +typedef struct _key_map { + int key_orig; + int key_new; +} nav_keymap_t; + +static nav_keymap_t keymap[] = { + { NAV_KEY_UP, KEY_UP, }, /* KEY_RESERVED, ignore this key */ + { NAV_KEY_DOWN, KEY_DOWN, }, + { NAV_KEY_RIGHT, KEY_RIGHT, }, + { NAV_KEY_LEFT, KEY_LEFT, }, + { NAV_KEY_CLICK, KEY_HOMEPAGE, }, + { NAV_KEY_DCLICK, KEY_HOMEPAGE, }, + { NAV_KEY_LONGPRESS,KEY_HOMEPAGE, }, +}; + +static LIST_HEAD(device_list); +static DEFINE_MUTEX(device_list_lock); + +#ifdef BSP_SIL_NETLINK +static int pid; +#endif /* BSP_SIL_NETLINK */ + +#ifdef PROC_NODE +static char vendor_name[PROC_VND_ID_LEN]; +#endif /* PROC_NODE */ + + +struct class *silfp_class; + +static struct workqueue_struct *silfp_wq; + +static void silfp_hw_reset(struct silfp_data *fp_dev, u8 delay); +static void silfp_irq_disable(struct silfp_data *fp_dev); +static void silfp_irq_enable(struct silfp_data *fp_dev); +static int silfp_wait_irq(struct silfp_data *fp_dev); +static int silfp_irq_status(struct silfp_data *fp_dev); +static int silfp_resource_init(struct silfp_data *fp_dev, struct fp_dev_init_t *dev_info); +static int silfp_resource_deinit(struct silfp_data *fp_dev); +static void silfp_power_deinit(struct silfp_data *fp_dev); +static void silfp_pwdn(struct silfp_data *fp_dev, u8 flag_avdd); +static void silfp_hw_poweron(struct silfp_data *fp_dev); + +/* -------------------------------------------------------------------- */ +/* debug settings */ +/* -------------------------------------------------------------------- */ +typedef enum { + ERR_LOG=0, + DBG_LOG, + INFO_LOG, + ALL_LOG, +} fp_debug_level_t; + +/* debug log level */ +static fp_debug_level_t debug_level = DBG_LOG; + +#define LOG_MSG_DEBUG(level, fmt, args...) do { \ + if (debug_level >= level) {\ + pr_warn(LOG_TAG fmt, ##args); \ + } \ + } while (0) + +#include PLAT_H + +/* -------------------------------------------------------------------- */ +/* netlink functions */ +/* -------------------------------------------------------------------- */ +#ifdef BSP_SIL_NETLINK +static void silfp_netlink_send(struct silfp_data *fp_dev, const int cmd) +{ + struct nlmsghdr *nlh = NULL; + struct sk_buff *skb = NULL; + int ret; + + LOG_MSG_DEBUG(INFO_LOG, "[%s] send cmd %d\n", __func__, cmd); + if ( !fp_dev->nl_sk) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] invalid socket\n", __func__); + return; + } + + if (! pid) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] invalid PID\n", __func__); + return; + } + + /*alloc data buffer for sending to native*/ + /*malloc data space at least 1500 bytes, which is ethernet data length*/ + skb = alloc_skb(NL_MSG_LEN, GFP_ATOMIC); + if (skb == NULL) { + return; + } + + nlh = nlmsg_put(skb, 0, 0, 0, NL_MSG_LEN, 0); + if (!nlh) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] nlmsg_put() failed\n", __func__); + kfree_skb(skb); + return; + } + + NETLINK_CB(skb).portid = 0; + NETLINK_CB(skb).dst_group = 0; + + *(char *)NLMSG_DATA(nlh) = cmd; + ret = netlink_unicast(fp_dev->nl_sk, skb, pid, MSG_DONTWAIT); + if (ret == 0) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] send failed\n", __func__); + kfree_skb(skb); + return; + } + + LOG_MSG_DEBUG(INFO_LOG, "[%s] sent, len=%d\n", __func__, ret); +} + +static void silfp_netlink_recv(struct sk_buff *__skb) +{ + struct sk_buff *skb = NULL; + struct nlmsghdr *nlh = NULL; + char str[128]; + + skb = skb_get(__skb); + if (!skb ) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] skb NULL\n", __func__); + return; + } + + /* presume there is 5byte payload at leaset */ + if (skb->len >= NLMSG_SPACE(0)) { + nlh = nlmsg_hdr(skb); + memcpy(str, NLMSG_DATA(nlh), sizeof(str)); + pid = nlh->nlmsg_pid; + LOG_MSG_DEBUG(INFO_LOG, "[%s] PID=%d, msg=%s\n", __func__, pid, str); + } else { + LOG_MSG_DEBUG(ERR_LOG, "[%s] data len incorrect\n", __func__); + } + + kfree_skb(skb); +} + +static int silfp_netlink_init(struct silfp_data *fp_dev) +{ + struct netlink_kernel_cfg cfg; + + memset(&cfg, 0, sizeof(struct netlink_kernel_cfg)); + cfg.input = silfp_netlink_recv; + + fp_dev->nl_sk = netlink_kernel_create(&init_net, SIFP_NETLINK_ROUTE, &cfg); + if (fp_dev->nl_sk == NULL) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] netlink create failed\n", __func__); + return -1; + } + + LOG_MSG_DEBUG(INFO_LOG, "[%s] netlink create success\n", __func__); + return 0; +} + +static int silfp_netlink_destroy(struct silfp_data *fp_dev) +{ + if (fp_dev->nl_sk != NULL) { + netlink_kernel_release(fp_dev->nl_sk); + fp_dev->nl_sk = NULL; + return 0; + } + + LOG_MSG_DEBUG(ERR_LOG, "[%s] no netlink socket\n", __func__); + return -1; +} +#else +static void silfp_netlink_send(struct silfp_data *fp_dev, const int cmd) +{ + unsigned long flags; + struct silfp_msg_list *list; + + list = kzalloc(sizeof(*list), GFP_ATOMIC); + if (!list) { + return; + } + + list->msg = (unsigned char)cmd; + + LOG_MSG_DEBUG(INFO_LOG, "silfp_poll cmd %d\n", cmd); + spin_lock_irqsave(&fp_dev->read_lock, flags); + list_add_tail(&list->list, &fp_dev->msg_q); + spin_unlock_irqrestore(&fp_dev->read_lock, flags); + + wake_up_interruptible(&fp_dev->read_queue); +} + +static int silfp_netlink_init(struct silfp_data *fp_dev) +{ + spin_lock_init(&fp_dev->read_lock); + init_waitqueue_head(&fp_dev->read_queue); + INIT_LIST_HEAD(&fp_dev->msg_q); + + return 0; +} + +static int silfp_netlink_destroy(struct silfp_data *fp_dev) +{ + struct silfp_msg_list *list, *next; + unsigned long flags; + + if (fp_dev && (&fp_dev->msg_q)) { + spin_lock_irqsave(&fp_dev->read_lock, flags); + list_for_each_entry_safe(list, next, &fp_dev->msg_q, list) { + list_del(&list->list); + kfree(list); + } + spin_unlock_irqrestore(&fp_dev->read_lock, flags); + } + return 0; +} + +static unsigned int silfp_poll(struct file *fd, poll_table *wait) +{ + struct silfp_data *fp_dev; + unsigned int mask = 0; + + if (!fd) { + return -EINVAL; + } + + fp_dev = fd->private_data; + poll_wait(fd, &fp_dev->read_queue, wait); + + if(!list_empty(&fp_dev->msg_q)) { + mask |= POLLIN | POLLRDNORM; + } + + return mask; +} + +static ssize_t silfp_read(struct file *fd, char __user *buf, size_t len,loff_t *ptr) +{ + struct silfp_data *fp_dev; + struct silfp_msg_list *list; + unsigned long flags; + int32_t msglen = sizeof(char); + + if (!fd || !buf || (len < msglen)) { + return -EINVAL; + } + + fp_dev = fd->private_data; + if (!&fp_dev->msg_q) { + return -EINVAL; + } + + spin_lock_irqsave(&fp_dev->read_lock, flags); + while(list_empty(&fp_dev->msg_q)) { + spin_unlock_irqrestore(&fp_dev->read_lock, flags); + if (wait_event_interruptible(fp_dev->read_queue, !list_empty(&fp_dev->msg_q))) { + return -EINVAL; + } + spin_lock_irqsave(&fp_dev->read_lock, flags); + } + /* pick the first one */ + list = list_first_entry(&fp_dev->msg_q, + struct silfp_msg_list, list); + spin_unlock_irqrestore(&fp_dev->read_lock, flags); + + if (!list) { + return -EFAULT; + } + + if (copy_to_user(buf, &list->msg, msglen)) { + LOG_MSG_DEBUG(ERR_LOG, "copy_to fail\n"); + msglen = -EFAULT; + } else { + LOG_MSG_DEBUG(INFO_LOG, "[%s] %d\n", __func__, list->msg); + } + spin_lock_irqsave(&fp_dev->read_lock, flags); + list_del(&list->list); + kfree(list); + spin_unlock_irqrestore(&fp_dev->read_lock, flags); + + return msglen; +} +#endif /* BSP_SIL_NETLINK */ + +/*liuyan 2017/12/7 add for detect screen state*/ +static ssize_t screen_state_get(struct device *device, + struct device_attribute *attribute, + char *buffer) +{ + struct silfp_data *fp_dev = dev_get_drvdata(device); + + return scnprintf(buffer, PAGE_SIZE, "%i\n", !fp_dev->scr_off); +} + +static DEVICE_ATTR(screen_state, 0400, screen_state_get, NULL); + +static struct attribute *sl_attributes[] = { + &dev_attr_screen_state.attr, + NULL +}; + +static const struct attribute_group sl_attribute_group = { + .attrs = sl_attributes, +}; + + +#ifdef CONFIG_HAS_EARLYSUSPEND +static void silfp_early_suspend(struct early_suspend *es) +{ + struct silfp_data *fp_dev = container_of(es, struct silfp_data, es); + + LOG_MSG_DEBUG(INFO_LOG, "[%s] enter\n", __func__); + fp_dev->scr_off = 1; + silfp_netlink_send(fp_dev, SIFP_NETLINK_SCR_OFF); +} + +static void silfp_late_resume(struct early_suspend *es) +{ + struct silfp_data *fp_dev = container_of(es, struct silfp_data, es); + + LOG_MSG_DEBUG(INFO_LOG, "[%s] enter\n", __func__); + fp_dev->scr_off = 0; + silfp_netlink_send(fp_dev, SIFP_NETLINK_SCR_ON); +} +#else +static int silfp_fb_callback(struct notifier_block *notif, + unsigned long event, void *data) +{ + struct silfp_data *fp_dev = container_of(notif, struct silfp_data, msm_drm_notif); + struct msm_drm_notifier *evdata = data; + unsigned int blank; + int retval = 0; + + /* If we aren't interested in this event, skip it immediately ... */ + if (event == MSM_DRM_EARLY_EVENT_BLANK || event == MSM_DRM_ONSCREENFINGERPRINT_EVENT){ + + + if (evdata->id != MSM_DRM_PRIMARY_DISPLAY) + return 0; + + + + + blank = *(int *)evdata->data; + //printk(KERN_ERR"GZM FP1 blank = %d\n",blank); + //printk(KERN_ERR"GZM FP1 event = %ld\n",event); + //printk(KERN_ERR"GZM FP1 evdata->id = %d\n",evdata->id); + + if (event == MSM_DRM_ONSCREENFINGERPRINT_EVENT ) { + LOG_MSG_DEBUG(INFO_LOG, "[%s] UI ready enter\n", __func__); + //printk(KERN_ERR"GZM FP2 blank =%d\n",blank); + + switch (blank) { + case 0: + LOG_MSG_DEBUG(INFO_LOG, "[%s] UI disappear\n", __func__); + //printk(KERN_ERR"GZM FP3\n"); + //silfp_netlink_send(fp_dev, SIFP_NETLINK_UI_OFF);//SIFP_NETLINK_UI_OFF donothing now + break; + case 1: + //printk(KERN_ERR"GZM FP4\n"); + LOG_MSG_DEBUG(INFO_LOG, "[%s] UI ready \n", __func__); + SDE_ATRACE_BEGIN("fb_ui_ready"); + silfp_netlink_send(fp_dev, SIFP_NETLINK_UI_READY); + SDE_ATRACE_END("fb_ui_ready"); + break; + default: + LOG_MSG_DEBUG(INFO_LOG, "[%s] Unknown MSM_DRM_ONSCREENFINGERPRINT_EVENT\n", __func__); + break; + } + return retval; + } + LOG_MSG_DEBUG(INFO_LOG, "[%s] enter, blank=0x%x\n", __func__, blank); + + switch (blank) { + case MSM_DRM_BLANK_UNBLANK: + LOG_MSG_DEBUG(INFO_LOG, "[%s] LCD ON\n", __func__); + fp_dev->scr_off = 0; + silfp_netlink_send(fp_dev, SIFP_NETLINK_SCR_ON); + sysfs_notify(&fp_dev->spi->dev.kobj, + NULL, dev_attr_screen_state.attr.name); + break; + + case MSM_DRM_BLANK_POWERDOWN: + LOG_MSG_DEBUG(INFO_LOG, "[%s] LCD OFF\n", __func__); + fp_dev->scr_off = 1; + silfp_netlink_send(fp_dev, SIFP_NETLINK_SCR_OFF); + sysfs_notify(&fp_dev->spi->dev.kobj, + NULL, dev_attr_screen_state.attr.name); + break; + + default: + LOG_MSG_DEBUG(INFO_LOG, "[%s] Unknown notifier\n", __func__); + break; + } + return retval; + } + else + return 0; +} +#endif /* CONFIG_HAS_EARLYSUSPEND */ + +/* -------------------------------------------------------------------- */ +/* IRQ related functions */ +/* -------------------------------------------------------------------- */ +static void silfp_irq_disable(struct silfp_data *fp_dev) +{ + unsigned long irqflags; + + spin_lock_irqsave(&fp_dev->irq_lock, irqflags); + if (!fp_dev->irq_is_disable) { + fp_dev->irq_is_disable = 1; + disable_irq_nosync(fp_dev->irq); + LOG_MSG_DEBUG(INFO_LOG, "[%s] irq disabled\n", __func__); + } + spin_unlock_irqrestore(&fp_dev->irq_lock, irqflags); +} + +static void silfp_irq_enable(struct silfp_data *fp_dev) +{ + unsigned long irqflags = 0; + + spin_lock_irqsave(&fp_dev->irq_lock, irqflags); + if (fp_dev->irq_is_disable) { + enable_irq(fp_dev->irq); + fp_dev->irq_is_disable = 0; + reinit_completion(&fp_dev->done); + LOG_MSG_DEBUG(INFO_LOG, "[%s] irq enabled\n", __func__); + } + spin_unlock_irqrestore(&fp_dev->irq_lock, irqflags); +} + +static int silfp_wait_irq(struct silfp_data *fp_dev) +{ + // this function is obsolete, for test purpose only. + wait_for_completion(&fp_dev->done); + //return wait_for_completion_timeout(&fp_dev->done, msecs_to_jiffies(3000)); + return 1; +} + +static int silfp_irq_status(struct silfp_data *fp_dev) +{ + // this function is obsolete, for test purpose only. + if (fp_dev->int_port) { + return gpio_get_value(fp_dev->int_port); + } + return -1; +} + +static irqreturn_t silfp_irq_handler(int irq, void *dev_id) +{ + struct silfp_data *fp_dev = (struct silfp_data *)dev_id; + + if (fp_dev->irq_ignore) { + return IRQ_HANDLED; + } + +#ifdef BSP_SIL_IRQ_CONFIRM + if (gpio_get_value(fp_dev->int_port)) { +#else + if (true) { +#endif /* BSP_SIL_IRQ_CONFIRM */ + wake_lock_timeout(&fp_dev->wakelock, 10*HZ); /* set a little long for a poor MCU */ +#ifdef BSP_SIL_IRQ_ASYNC + queue_work(silfp_wq, &fp_dev->work); +#else + silfp_netlink_send(fp_dev, SIFP_NETLINK_IRQ); +#endif /* BSP_SIL_IRQ_ASYNC */ + complete(&fp_dev->done); + } else { + LOG_MSG_DEBUG(INFO_LOG, "[%s] irq ignore\n", __func__); + } + + return IRQ_HANDLED; +} + +int opticalfp_irq_handler(struct fp_underscreen_info* tp_info) +{ + + // wake_lock_timeout(&fp_dev->wakelock, 10*HZ); /* set a little long for a poor MCU */ + + //silfp_netlink_send(fp_dev, SIFP_NETLINK_IRQ); + //static unsigned int lasttouchmode = 0; + + if (optical_fp == NULL) + return 0; + fp_tpinfo = *tp_info; + LOG_MSG_DEBUG(INFO_LOG, "fp_tpinfo %d, %d, %d, %d \n" , + fp_tpinfo.touch_state, fp_tpinfo.area_rate, fp_tpinfo.x, fp_tpinfo.y); + + //complete(&fp_dev->done); + LOG_MSG_DEBUG(INFO_LOG, "[%s] touchmode = %d, lasttouchmode =%d \n", __func__, tp_info->touch_state, lasttouchmode); + if(tp_info->touch_state== lasttouchmode){ + return 0; + } + if(1 == tp_info->touch_state){ + silfp_netlink_send(optical_fp, SIFP_NETLINK_TP_TOUCHDOWN); + lasttouchmode = tp_info->touch_state; + }else{ + silfp_netlink_send(optical_fp, SIFP_NETLINK_TP_TOUCHUP); + lasttouchmode = tp_info->touch_state; + } + + wake_lock_timeout(&optical_fp->wakelock, 10*HZ); + + return 0; +} + +EXPORT_SYMBOL(opticalfp_irq_handler); + +static void silfp_work_func(struct work_struct *work) +{ + struct silfp_data *fp_dev = container_of(work, struct silfp_data, work); + + LOG_MSG_DEBUG(INFO_LOG, "[%s] running\n", __func__); + silfp_netlink_send(fp_dev, SIFP_NETLINK_IRQ); +} + +/* -------------------------------------------------------------------- */ +/* key event functions */ +/* -------------------------------------------------------------------- */ +static int silfp_keyevent(struct silfp_data *fp_dev, struct fp_dev_key_t *pkey) +{ + int ret = -EFAULT; + int i; + + //LOG_MSG_DEBUG(INFO_LOG, "[%s] key %d, flag %d\n", __func__,pkey->value,pkey->flag); + if (!fp_dev->input) { + LOG_MSG_DEBUG(INFO_LOG, "[%s] invalid input device\n",__func__); + return -1; + } + if ( IS_KEY_VALID(pkey->value) ) { + /* Translate Click Down/Up key to Click key. */ + switch( pkey->value ) { + case NAV_KEY_CLICK_DOWN: + pkey->value = NAV_KEY_CLICK; + pkey->flag = NAV_KEY_FLAG_DOWN; + break; + case NAV_KEY_CLICK_UP: + pkey->value = NAV_KEY_CLICK; + pkey->flag = NAV_KEY_FLAG_UP; + break; + default: + break; + } + + /* Check the custom define keymap */ + if ( fp_dev->keymap_cust.k[pkey->value - NAV_KEY_START] ) { + LOG_MSG_DEBUG(INFO_LOG, "[%s] custom-key %d\n", __func__,fp_dev->keymap_cust.k[pkey->value - NAV_KEY_START]); + if ( KEY_RESERVED != fp_dev->keymap_cust.k[pkey->value - NAV_KEY_START] ) { + if ( NAV_KEY_FLAG_CLICK == pkey->flag ) { + input_report_key(fp_dev->input, fp_dev->keymap_cust.k[pkey->value - NAV_KEY_START], NAV_KEY_FLAG_DOWN); + input_sync(fp_dev->input); + input_report_key(fp_dev->input, fp_dev->keymap_cust.k[pkey->value - NAV_KEY_START], NAV_KEY_FLAG_UP); + input_sync(fp_dev->input); + } else { + input_report_key(fp_dev->input, fp_dev->keymap_cust.k[pkey->value - NAV_KEY_START], pkey->flag); + input_sync(fp_dev->input); + } + } else { + // Here means this key is not set, simply ignore it. + } + ret = 0; + } + } + + for ( i = 0; ret && i < ARRAY_SIZE(keymap); i++ ) { + if ( keymap[i].key_orig == pkey->value ) { + LOG_MSG_DEBUG(INFO_LOG, "[%s] key %d\n", __func__,keymap[i].key_new); + if ( KEY_RESERVED != keymap[i].key_new ) { + if ( NAV_KEY_FLAG_CLICK == pkey->flag ) { + input_report_key(fp_dev->input, keymap[i].key_new, NAV_KEY_FLAG_DOWN); + input_sync(fp_dev->input); + input_report_key(fp_dev->input, keymap[i].key_new, NAV_KEY_FLAG_UP); + input_sync(fp_dev->input); + } else { + input_report_key(fp_dev->input, keymap[i].key_new, pkey->flag); + input_sync(fp_dev->input); + } + } else { + // Here means this key is not set, simply ignore it. + } + ret = 0; + } + } + + if ( ret ) { + LOG_MSG_DEBUG(INFO_LOG, "[%s] unregister custom-key %d\n", __func__,pkey->value); + input_report_key(fp_dev->input, pkey->value, pkey->flag); + input_sync(fp_dev->input); + ret = 0; + } + return ret; +} + +/* -------------------------------------------------------------------- */ +/* proc node functions */ +/* -------------------------------------------------------------------- */ +#ifdef PROC_NODE +static int silfp_proc_show(struct seq_file *m, void *v) +{ + seq_printf(m, "%s\n", vendor_name); + return 0; +} + +static int silfp_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, silfp_proc_show, NULL); +} + +static const struct file_operations silfp_proc_fops = { + .owner = THIS_MODULE, + .read = seq_read, + .open = silfp_proc_open, + .release = single_release, +}; + +static int silfp_proc_create_node(struct silfp_data *fp_dev) +{ + if (fp_dev->proc_entry == NULL) { + fp_dev->proc_root = NULL; +#ifdef PROC_DIR + fp_dev->proc_root = proc_mkdir(PROC_DIR, NULL); + if (fp_dev->proc_root == NULL) { + LOG_MSG_DEBUG(ERR_LOG, "Create dir %s under /proc error!\n", PROC_DIR); + goto err_out; + } +#endif /* PROC_DIR */ + fp_dev->proc_entry = proc_create(PROC_NODE, 0666, fp_dev->proc_root, &silfp_proc_fops); + if (fp_dev->proc_entry == NULL) { + LOG_MSG_DEBUG(ERR_LOG, "Create entry %s under /proc/ error!\n", PROC_NODE); + goto err_out1; + } + } + + return 0; + +err_out1: + remove_proc_entry(PROC_NODE, fp_dev->proc_root); +#ifdef PROC_DIR + remove_proc_entry(PROC_DIR, NULL); +err_out: +#endif /* PROC_DIR */ + fp_dev->proc_root = NULL; + fp_dev->proc_entry = NULL; + return -ENOMEM; +} + +static int silfp_proc_init(struct silfp_data *fp_dev) +{ + if (fp_dev) { + fp_dev->proc_root = NULL; + fp_dev->proc_entry = NULL; + } + return 0; + +} + +static void silfp_proc_deinit(struct silfp_data *fp_dev) +{ + if (fp_dev) { + if (fp_dev->proc_entry) { + remove_proc_entry(PROC_NODE, fp_dev->proc_root); + } +#ifdef PROC_DIR + if (fp_dev->proc_root) { + remove_proc_entry(PROC_DIR, NULL); + } +#endif /* PROC_DIR */ + fp_dev->proc_root = NULL; + fp_dev->proc_entry = NULL; + } +} +#endif /* PROC_NODE */ + +/* -------------------------------------------------------------------- */ +/* init/deinit functions */ +/* -------------------------------------------------------------------- */ +static int silfp_input_init(struct silfp_data *fp_dev) +{ + int i, status = 0; + + /*register device within input system.*/ + fp_dev->input = input_allocate_device(); + if (!fp_dev->input) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] input_allocate_device() fail!\n", __func__); + status = -ENOMEM; + return status; + } + + __set_bit(EV_KEY, fp_dev->input->evbit); + //__set_bit(KEY_Q, fp_dev->input->keybit); // it will cause Android think this is a physical keyboard. + __set_bit(KEY_HOME, fp_dev->input->keybit); + __set_bit(KEY_HOMEPAGE, fp_dev->input->keybit); + + __set_bit(KEY_MENU, fp_dev->input->keybit); + __set_bit(KEY_BACK, fp_dev->input->keybit); + __set_bit(KEY_CAMERA, fp_dev->input->keybit); + + __set_bit(KEY_F2, fp_dev->input->keybit); + + for ( i = 0; i < ARRAY_SIZE(keymap); i++ ) { + if ( keymap[i].key_new != KEY_RESERVED ) { + __set_bit(keymap[i].key_new, fp_dev->input->keybit); + } + } + + for ( i = 0; i < ARRAY_SIZE(fp_dev->keymap_cust.k); i++ ) { + if (fp_dev->keymap_cust.k[i] && (fp_dev->keymap_cust.k[i] != KEY_RESERVED)) { + __set_bit(fp_dev->keymap_cust.k[i], fp_dev->input->keybit); + } + } + + fp_dev->input->name = FP_INPUT_NAME; + if (input_register_device(fp_dev->input)) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] input_register_device() fail!\n", __func__); + input_free_device(fp_dev->input); + fp_dev->input = NULL; + status = -ENODEV; + } + return status; +} + +static int silfp_input_deinit(struct silfp_data *fp_dev) +{ + if (fp_dev->input) { + input_unregister_device(fp_dev->input); + fp_dev->input = NULL; + } + return 0; +} + +static int silfp_input_reinit(struct silfp_data *fp_dev) +{ + if (fp_dev->input) { + silfp_input_deinit(fp_dev); + } + return silfp_input_init(fp_dev); +} + +static int silfp_init(struct silfp_data *fp_dev) +{ + int status = 0; + + LOG_MSG_DEBUG(INFO_LOG, "[%s] enter\n", __func__); + init_completion(&fp_dev->done); + spin_lock_init(&fp_dev->irq_lock); + INIT_WORK(&fp_dev->work, silfp_work_func); + + /* netlink interface init */ + status = silfp_netlink_init(fp_dev); + if (status == -1) { + return status; + } + +#if defined(CONFIG_HAS_EARLYSUSPEND) + LOG_MSG_DEBUG(INFO_LOG, "[%s] register_early_suspend\n", __func__); + fp_dev->es.level = (EARLY_SUSPEND_LEVEL_DISABLE_FB - 1); + fp_dev->es.suspend = silfp_early_suspend; + fp_dev->es.resume = silfp_late_resume; + register_early_suspend(&fp_dev->es); +#else + fp_dev->msm_drm_notif.notifier_call = silfp_fb_callback; + status = msm_drm_register_client(&fp_dev->msm_drm_notif); + if (status) + LOG_MSG_DEBUG(INFO_LOG,"Unable to register msm_drm_notifier: %d\n", status); + else + LOG_MSG_DEBUG(INFO_LOG,"register msm_drm_notifier: %d\n", status); +#endif /* CONFIG_HAS_EARLYSUSPEND */ + + atomic_set(&fp_dev->spionoff_count,0); + + return status; +} + +static int silfp_resource_deinit(struct silfp_data *fp_dev) +{ + LOG_MSG_DEBUG(INFO_LOG, "[%s] enter\n", __func__); + + if (atomic_read(&fp_dev->init)) { + atomic_dec(&fp_dev->init); + + if (!atomic_read(&fp_dev->init)) { + LOG_MSG_DEBUG(INFO_LOG, "[%s] no more users, free GPIOs\n", __func__); + silfp_irq_disable(fp_dev); + free_irq(fp_dev->irq, fp_dev); + + gpio_direction_input(fp_dev->int_port); +#if !defined(BSP_SIL_PLAT_MTK) + gpio_free(fp_dev->int_port); + if (fp_dev->rst_port > 0 ) { + gpio_free(fp_dev->rst_port); + } +#endif /* !BSP_SIL_PLAT_MTK */ + fp_dev->int_port = 0; + fp_dev->rst_port = 0; + + silfp_input_deinit(fp_dev); + silfp_power_deinit(fp_dev); +#ifdef PROC_NODE + silfp_proc_deinit(fp_dev); +#endif /* PROC_NODE */ + } + silfp_netlink_send(fp_dev, SIFP_NETLINK_DISCONNECT); + } + return 0; +} + +static void silfp_exit(struct silfp_data *fp_dev) +{ + LOG_MSG_DEBUG(INFO_LOG, "[%s] enter\n", __func__); + +#ifdef CONFIG_HAS_EARLYSUSPEND + if (fp_dev->es.suspend) { + unregister_early_suspend(&fp_dev->es); + } +#else + if (msm_drm_unregister_client(&fp_dev->msm_drm_notif)) + pr_err("Error occurred while unregistering msm_drm_notifier.\n"); +#endif /* CONFIG_HAS_EARLYSUSPEND */ + + silfp_set_spi(fp_dev, false); /* release SPI resources */ + + if (silfp_wq) { + destroy_workqueue(silfp_wq); + silfp_wq = NULL; + } + silfp_netlink_destroy(fp_dev); +#ifdef PROC_NODE + silfp_proc_deinit(fp_dev); +#endif /* PROC_NODE */ +} + +static void silfp_wakelock_ctl(struct silfp_data *fp_dev, unsigned char lock) +{ + if (lock) { + wake_lock_timeout(&fp_dev->wakelock_hal, 10*HZ); + } else { + wake_unlock(&fp_dev->wakelock_hal); + } +} +/*-------------------------------------------------------------------------*/ + +static long +silfp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + int err = 0; + int retval = 0; + struct silfp_data *fp_dev; + struct fp_dev_key_t key; + + /* Check type and command number */ + if (_IOC_TYPE(cmd) != SIFP_IOC_MAGIC) + return -ENOTTY; + + /* Check access direction once here; don't repeat below. + * IOC_DIR is from the user perspective, while access_ok is + * from the kernel perspective; so they look reversed. + */ + if (_IOC_DIR(cmd) & _IOC_READ) { + err = !access_ok(VERIFY_WRITE, + (void __user *)arg, _IOC_SIZE(cmd)); + } + if (err == 0 && _IOC_DIR(cmd) & _IOC_WRITE) { + err = !access_ok(VERIFY_READ, + (void __user *)arg, _IOC_SIZE(cmd)); + } + if (err) { + return -EFAULT; + } + + /* guard against device removal before, or while, + * we issue this ioctl. + */ + fp_dev = filp->private_data; + + switch (cmd) { + case SIFP_IOC_INIT: + silfp_resource_init(fp_dev,&silfp_dev_init_d); + if (copy_to_user((void __user *)arg, (void *)&silfp_dev_init_d, sizeof(struct fp_dev_init_t))) { + retval = -EFAULT; + } + + break; + case SIFP_IOC_DEINIT: + silfp_resource_deinit(fp_dev); + break; + + case SIFP_IOC_RESET: { + unsigned char delay = RESET_TIME; + LOG_MSG_DEBUG(INFO_LOG, "[%s] chip reset\n", __func__); + if (arg) { + if (copy_from_user(&delay, (void __user *)arg, sizeof(char))) { + retval = -EFAULT; + break; + } + } + + if (fp_dev->power_is_off) { + silfp_hw_poweron(fp_dev); + mdelay(5); + } + fp_dev->irq_ignore = 1; + if (fp_dev->irq_is_disable) { + silfp_irq_enable(fp_dev); + silfp_hw_reset(fp_dev, delay); + silfp_irq_disable(fp_dev); + } else { + silfp_hw_reset(fp_dev, delay); + } + fp_dev->irq_ignore = 0; + } + break; + + case SIFP_IOC_ENABLE_IRQ: + LOG_MSG_DEBUG(INFO_LOG, "[%s] enable irq\n", __func__); + silfp_irq_enable(fp_dev); + break; + + case SIFP_IOC_DISABLE_IRQ: + LOG_MSG_DEBUG(INFO_LOG, "[%s] disable irq\n", __func__); + silfp_irq_disable(fp_dev); + break; + + case SIFP_IOC_CLR_IRQ: + LOG_MSG_DEBUG(INFO_LOG, "[%s] clear irq\n", __func__); + reinit_completion(&fp_dev->done); + break; + + case SIFP_IOC_WAIT_IRQ: + LOG_MSG_DEBUG(INFO_LOG, "[%s] wait irq\n", __func__); + retval = __put_user(silfp_wait_irq(fp_dev)?1:0, (__u8 __user *)arg); + break; + + case SIFP_IOC_IRQ_STATUS: + LOG_MSG_DEBUG(INFO_LOG, "[%s] irq status\n", __func__); + retval = __put_user((char)silfp_irq_status(fp_dev), (__u8 __user *)arg); + break; + + case SIFP_IOC_KEY_EVENT: + if (copy_from_user(&key, (struct fp_dev_key_t *)arg, sizeof(struct fp_dev_key_t))) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] copy key fail?\n",__func__); + retval = -EFAULT; + } else { + retval = silfp_keyevent(fp_dev,&key); + } + break; + + case SIFP_IOC_SCR_STATUS: + if (arg) { + LOG_MSG_DEBUG(INFO_LOG, "[IOC_SCR_STATUS] put v = %d\n",(u8)(!fp_dev->scr_off)); + retval = __put_user((u8)(!fp_dev->scr_off), (__u8 __user *)arg); + } else { + LOG_MSG_DEBUG(INFO_LOG, "[IOC_SCR_STATUS] send v = %d\n",(u8)(!fp_dev->scr_off)); + silfp_netlink_send(fp_dev, fp_dev->scr_off?SIFP_NETLINK_SCR_OFF:SIFP_NETLINK_SCR_ON); + } + break; + + case SIFP_IOC_GET_VER: + if ( copy_to_user((void __user *)arg, (void *)FP_DEV_VERSION, sizeof(char)*7)) { + LOG_MSG_DEBUG(ERR_LOG, "[IOC_GET_VER] copy_to fail\n"); + retval = -EFAULT; + } + break; + + case SIFP_IOC_SET_KMAP: + if (!arg) { + retval = -EFAULT; + break; + } + if (copy_from_user(&fp_dev->keymap_cust.k, (void __user *)arg, sizeof(struct fp_dev_kmap_t))) { + LOG_MSG_DEBUG(ERR_LOG, "[IOC_SET_KMAP] copy_from fail\n"); + retval = -EFAULT; + break; + } + + if (silfp_input_reinit(fp_dev)) { + retval = -EFAULT; + } + break; + + case SIFP_IOC_ACQ_SPI: + LOG_MSG_DEBUG(INFO_LOG, "[%s] acq spi\n", __func__); + retval = silfp_set_spi(fp_dev,true); + break; + + case SIFP_IOC_RLS_SPI: + LOG_MSG_DEBUG(INFO_LOG, "[%s] release spi\n", __func__); + retval = silfp_set_spi(fp_dev,false); + break; + + case SIFP_IOC_PKG_SIZE: + if (arg) { + LOG_MSG_DEBUG(DBG_LOG, "[IOC_PKG_SIZE] %d\n",(u8)(PKG_SIZE)); + retval = __put_user((u8)(PKG_SIZE), (__u8 __user *)arg); + } + break; + + case SIFP_IOC_DBG_LEVEL: + if (arg) { + unsigned char level = 0; + if (copy_from_user(&level, (void __user *)arg, sizeof(char)) || level > (uint8_t)ALL_LOG ) { + retval = -EFAULT; + break; + } + LOG_MSG_DEBUG(ERR_LOG, "debug level %d-->%d\n",debug_level,level); + retval = __put_user((u8)(debug_level), (__u8 __user *)arg); + debug_level = (fp_debug_level_t)level; + } + break; + + case SIFP_IOC_WAKELOCK: + if (arg) { + unsigned char lock = 0; + if (copy_from_user(&lock, (void __user *)arg, sizeof(char))) { + LOG_MSG_DEBUG(ERR_LOG, "[SIFP_IOC_WAKELOCK] copy_from fail\n"); + retval = -EFAULT; + break; + } + silfp_wakelock_ctl(fp_dev, lock); + } + break; + + case SIFP_IOC_PWDN: + if (arg) { + unsigned char flag_avdd = 0; + if (copy_from_user(&flag_avdd, (void __user *)arg, sizeof(char))) { + LOG_MSG_DEBUG(ERR_LOG, "[SIFP_IOC_PWDN] copy_from fail\n"); + retval = -EFAULT; + break; + } + silfp_pwdn(fp_dev, flag_avdd); + } else { + silfp_pwdn(fp_dev, SIFP_PWDN_NONE); + } + + break; + +#ifdef PROC_NODE + case SIFP_IOC_PROC_NODE: + if (arg) { + if (copy_from_user(vendor_name, (void __user *)arg, PROC_VND_ID_LEN)) { + LOG_MSG_DEBUG(ERR_LOG, "[SIFP_IOC_PROC_NODE] copy_from fail\n"); + retval = -EFAULT; + break; + } + retval = silfp_proc_create_node(fp_dev); + } + break; +#endif /* PROC_NODE */ + + case SIFP_IOC_GET_TP_TOUCH_INFO: + LOG_MSG_DEBUG(ERR_LOG, "[SIFP_IOC_GET_TP_TOUCH_INFO]enter\n"); + if (arg) { + if (copy_to_user((void __user *)arg, (void *)&fp_tpinfo, sizeof(fp_tpinfo))) { + LOG_MSG_DEBUG(ERR_LOG, "[SIFP_IOC_GET_TP_TOUCH_INFO] copy_to fail\n"); + retval = -EFAULT; + } + } + break; + case SIFP_IOC_SET_TP_MSG_REPORT_MODE: + LOG_MSG_DEBUG(INFO_LOG, "[SET_TP_MSG_REPORT_MODE]enter,arg =%d,lasttouchmode=%d\n", (int)arg, (int)lasttouchmode); + if(1 == lasttouchmode) { + lasttouchmode = arg;//arg =0 + LOG_MSG_DEBUG(INFO_LOG, " success lasttouchmode = %d\n", lasttouchmode); + } else { + LOG_MSG_DEBUG(ERR_LOG, "arg null,or mode is 0, do nothing!\n"); + } + break; + + case SIFP_IOC_REPORT_KEY: + LOG_MSG_DEBUG(INFO_LOG, "[SIFP_IOC_REPORT_KEY]enter,arg =%d\n", (int)arg); + input_report_key(fp_dev->input, KEY_F2, 1); + input_sync(fp_dev->input); + input_report_key(fp_dev->input, KEY_F2, 0); + input_sync(fp_dev->input); + break; + default: + retval = -ENOTTY; + break; + } + + return retval; +} + +#ifdef CONFIG_COMPAT +static long +silfp_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + return silfp_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); +} +#else +#define silfp_compat_ioctl NULL +#endif /* CONFIG_COMPAT */ + +static int silfp_open(struct inode *inode, struct file *filp) +{ + struct silfp_data *fp_dev; + int status = -ENXIO; + + mutex_lock(&device_list_lock); + + list_for_each_entry(fp_dev, &device_list, device_entry) { + if (fp_dev->devt == inode->i_rdev) { + status = 0; + break; + } + } + if (status == 0) { + fp_dev->users++; + filp->private_data = fp_dev; + nonseekable_open(inode, filp); + } else { + LOG_MSG_DEBUG(ERR_LOG, "silfp: nothing for minor %d\n", iminor(inode)); + } + + mutex_unlock(&device_list_lock); + + return status; +} + +static int silfp_release(struct inode *inode, struct file *filp) +{ + struct silfp_data *fp_dev; + int status = 0; + + mutex_lock(&device_list_lock); + fp_dev = filp->private_data; + filp->private_data = NULL; + + /* last close? */ + fp_dev->users--; + if (!fp_dev->users) { + int dofree = 0; + + if (dofree) + kfree(fp_dev); + } + mutex_unlock(&device_list_lock); + + return status; +} + +static const struct file_operations silfp_dev_fops = { + .owner = THIS_MODULE, + /* REVISIT switch to aio primitives, so that userspace + * gets more complete API coverage. It'll simplify things + * too, except for the locking. + */ + .unlocked_ioctl = silfp_ioctl, + .compat_ioctl = silfp_compat_ioctl, + .open = silfp_open, + .release = silfp_release, +#ifndef BSP_SIL_NETLINK + .read = silfp_read, + .poll = silfp_poll, +#endif /* !BSP_SIL_NETLINK */ +}; + +/*-------------------------------------------------------------------------*/ + +/* The main reason to have this class is to make mdev/udev create the + * /dev/spidevB.C character device nodes exposing our userspace API. + * It also simplifies memory management. + */ + +/*-------------------------------------------------------------------------*/ + +static int silfp_probe(struct platform_device *spi) +{ + struct silfp_data *fp_dev; + int status = 0; + //unsigned long minor; + + LOG_MSG_DEBUG(INFO_LOG, "[%s] enter.\n", __func__); + + LOG_MSG_DEBUG(INFO_LOG, "[%s] find silfp fingerprint.\n", __func__); + + /* Allocate driver data */ + fp_dev = kzalloc(sizeof(*fp_dev), GFP_KERNEL); + if (!fp_dev) { + return -ENOMEM; + } + + /* Initialize the driver data */ + fp_dev->spi = spi; + spin_lock_init(&fp_dev->spi_lock); + + wake_lock_init(&fp_dev->wakelock,WAKE_LOCK_SUSPEND,"silfp_wakelock"); + wake_lock_init(&fp_dev->wakelock_hal,WAKE_LOCK_SUSPEND,"silfp_wakelock_hal"); + INIT_LIST_HEAD(&fp_dev->device_entry); + + /* If we can allocate a minor number, hook up this device. + * Reusing minors is fine so long as udev or mdev is working. + */ + + if (FP_DEV_MAJOR > 0) { + fp_dev->devt = MKDEV(FP_DEV_MAJOR, fp_dev->ref++); + status = register_chrdev_region(fp_dev->devt, 1, FP_DEV_NAME); + } else { + status = alloc_chrdev_region(&fp_dev->devt, fp_dev->ref++, 1, FP_DEV_NAME); + } + if (status < 0) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] request devt fail, ret=%d.\n", __func__, status); + goto err_devt; + } else { + LOG_MSG_DEBUG(INFO_LOG, "[%s], major=%d, minor=%d\n", __func__, MAJOR(fp_dev->devt), MINOR(fp_dev->devt)); + } + + fp_dev->dev = device_create(silfp_class, &fp_dev->spi->dev, fp_dev->devt, fp_dev, FP_DEV_NAME); + if (IS_ERR(fp_dev->dev)) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] device_create() fail.\n", __func__); + status = -ENODEV; + goto err_dev; + } else { + mutex_lock(&device_list_lock); + list_add(&fp_dev->device_entry, &device_list); + mutex_unlock(&device_list_lock); + LOG_MSG_DEBUG(INFO_LOG, "[%s] device create success.\n", __func__); + } + + cdev_init(&fp_dev->cdev, &silfp_dev_fops); + fp_dev->cdev.owner = THIS_MODULE; + status = cdev_add(&fp_dev->cdev, fp_dev->devt, 1); + if (status) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] cdev_add() fail, ret=%d.\n", __func__, status); + goto err_cdev; + } + + atomic_set(&fp_dev->init,0); + status = silfp_init(fp_dev); + if (status) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] silfp_init fail ret=%d.\n", __func__, status); + goto err_cdev; + } +#ifdef PROC_NODE + silfp_proc_init(fp_dev); +#endif /* PROC_NODE */ + platform_set_drvdata(spi, fp_dev); + optical_fp = fp_dev; + + status = sysfs_create_group(&spi->dev.kobj, + &sl_attribute_group); + if (status) + pr_err("%s:could not create sysfs\n", __func__); + return status; + +err_cdev: + list_del(&fp_dev->device_entry); + +err_dev: + unregister_chrdev_region(fp_dev->devt, 1); + +err_devt: + platform_set_drvdata(spi, NULL); + fp_dev->spi = NULL; + kfree(fp_dev); + fp_dev = NULL; + + return status; +} + +static int silfp_remove(struct platform_device *spi) +{ + struct silfp_data *fp_dev = platform_get_drvdata(spi); + + wake_lock_destroy(&fp_dev->wakelock); + wake_lock_destroy(&fp_dev->wakelock_hal); + /* make sure ops on existing fds can abort cleanly */ + spin_lock_irq(&fp_dev->spi_lock); + fp_dev->spi = NULL; + spin_unlock_irq(&fp_dev->spi_lock); + + silfp_exit(fp_dev); + /* prevent new opens */ + mutex_lock(&device_list_lock); + list_del(&fp_dev->device_entry); + device_destroy(silfp_class, fp_dev->devt); + if (fp_dev->users == 0) + kfree(fp_dev); + mutex_unlock(&device_list_lock); + + return 0; +} + +static const struct of_device_id sildev_dt_ids[] = { + { .compatible = "sil,silead_fp" }, + { .compatible = "sil,silead-fp" }, + { .compatible = "sil,fingerprint" }, + { .compatible = "sil,silead_fp-pins" }, + {}, +}; + +MODULE_DEVICE_TABLE(of, sildev_dt_ids); + +static struct platform_driver silfp_driver = { + .driver = { + .name = "silead_fp", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(sildev_dt_ids), + }, + .probe = silfp_probe, + .remove = silfp_remove, + + /* NOTE: suspend/resume methods are not necessary here. + * We don't do anything except pass the requests to/from + * the underlying controller. The refrigerator handles + * most issues; the controller driver handles the rest. + */ +}; + +/*-------------------------------------------------------------------------*/ + +static int __init silfp_dev_init(void) +{ + int status = 0; + + LOG_MSG_DEBUG(ERR_LOG, "SILEAD_FP Driver, Version: %s.\n", FP_DEV_VERSION); + /* Claim our 256 reserved device numbers. Then register a class + * that will key udev/mdev to add/remove /dev nodes. Last, register + * the driver which manages those device numbers. + */ + pr_info("%s:fp version %x\n", __func__, fp_version); + if ((fp_version != 0x05)) + return 0; + status = register_chrdev(FP_DEV_MAJOR, "sil", &silfp_dev_fops); + if (status < 0) { + return status; + } + + silfp_class = class_create(THIS_MODULE, "silead_fp"); + if (IS_ERR(silfp_class)) { + unregister_chrdev(FP_DEV_MAJOR, silfp_driver.driver.name); + return PTR_ERR(silfp_class); + } + + status = platform_driver_register(&silfp_driver); + if (status < 0) { + class_destroy(silfp_class); + unregister_chrdev(FP_DEV_MAJOR, silfp_driver.driver.name); + LOG_MSG_DEBUG(ERR_LOG, "[%s] spi_register_driver fail ret=%d.\n", __func__, status); + return status; + } + silfp_wq = create_singlethread_workqueue("silfp_wq"); + return status; +} +module_init(silfp_dev_init); + +static void __exit silfp_dev_exit(void) +{ + platform_driver_unregister(&silfp_driver); + class_destroy(silfp_class); + unregister_chrdev(FP_DEV_MAJOR, silfp_driver.driver.name); +} + +module_exit(silfp_dev_exit); + +MODULE_AUTHOR("Bill Yu "); +MODULE_DESCRIPTION("Silead Fingerprint driver for GSL61XX/GSL62XX series."); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("sil:silead_fp"); diff --git a/drivers/input/fingerprint/silead/silead_fp_qcom.c b/drivers/input/fingerprint/silead/silead_fp_qcom.c new file mode 100755 index 000000000000..78880057d8c9 --- /dev/null +++ b/drivers/input/fingerprint/silead/silead_fp_qcom.c @@ -0,0 +1,606 @@ +/* + * @file silead_fp_qcom.c + * @brief Contains silead_fp device implements for Qualcomm platform. + * + * + * Copyright 2016-2018 Slead Inc. + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + * + * ------------------- Revision History ------------------------------ + * + * Bill Yu 2018/5/2 0.1.0 Init version + * Bill Yu 2018/5/20 0.1.1 Default wait 3ms after reset + * Bill Yu 2018/6/5 0.1.2 Support chip enter power down + * + */ + +#ifdef BSP_SIL_PLAT_QCOM + +#ifndef __SILEAD_FP_QCOM__ +#define __SILEAD_FP_QCOM__ + +#include + +#ifndef INIT_COMPLETION +#define INIT_COMPLETION(x) ((x).done = 0) +#endif /* INIT_COMPLETION */ +/* Qualcomm MNC platform, need define this. */ +#define reinit_completion(x) INIT_COMPLETION(*(x)) + +#define SPI_PINCTRL_STATE_DEFAULT "spi_default" +#define SPI_PINCTRL_STATE_SLEEP "spi_sleep" + +static irqreturn_t silfp_irq_handler(int irq, void *dev_id); +static void silfp_work_func(struct work_struct *work); +static int silfp_input_init(struct silfp_data *fp_dev); + +int sl_pinctrl_init(struct silfp_data *fp_dev) +{ + int ret = 0; + struct device *dev = &fp_dev->spi->dev; + + fp_dev->sl_pinctrl = devm_pinctrl_get(dev); + if (IS_ERR_OR_NULL(fp_dev->sl_pinctrl)) { + dev_err(dev, "Target does not use pinctrl\n"); + ret = PTR_ERR(fp_dev->sl_pinctrl); + goto err; + } + + fp_dev->gpio_state_enable = + pinctrl_lookup_state(fp_dev->sl_pinctrl, "fp_en_init"); + if (IS_ERR_OR_NULL(fp_dev->gpio_state_enable)) { + dev_err(dev, "Cannot get active pinstate\n"); + ret = PTR_ERR(fp_dev->gpio_state_enable); + goto err; + } + + ret = pinctrl_select_state(fp_dev->sl_pinctrl, + fp_dev->gpio_state_enable); + if (ret) { + pr_err("can not set %s pins\n", "fp_en_init"); + goto err; + } + + return 0; +err: + fp_dev->sl_pinctrl = NULL; + fp_dev->gpio_state_enable = NULL; + return ret; +} + +/* -------------------------------------------------------------------- */ +/* power supply */ +/* -------------------------------------------------------------------- */ +static void silfp_hw_poweron(struct silfp_data *fp_dev) +{ + int err = 0; + LOG_MSG_DEBUG(INFO_LOG, "[%s] enter.\n", __func__); + +#ifdef BSP_SIL_POWER_SUPPLY_REGULATOR + /* Power control by Regulators(LDO) */ + if ( fp_dev->avdd_ldo ) { + err = regulator_set_voltage(fp_dev->avdd_ldo, + AVDD_MIN, AVDD_MAX); /*set 2.8v*/ + err = regulator_set_load(fp_dev->avdd_ldo, CURRENT); + if (err < 0) + LOG_MSG_DEBUG(INFO_LOG, + "poweron: vreg mode(err:%d)\n", err); + err = regulator_enable(fp_dev->avdd_ldo); /*enable regulator*/ + //pmic_set_register_value(PMIC_RG_VCAMA_CAL,0x0A); + } + if (fp_dev->vddio_ldo) { + err = regulator_set_voltage(fp_dev->vddio_ldo, + VDDIO_MIN, VDDIO_MAX); /*set 1.8v*/ + err = regulator_set_load(fp_dev->vddio_ldo, 200000);//100ma + if (err < 0) + LOG_MSG_DEBUG(INFO_LOG, + "poweron: vreg mode(err:%d)\n", err); + err = regulator_enable(fp_dev->vddio_ldo); /*enable regulator*/ + //pmic_set_register_value(PMIC_RG_VCAMA_CAL,0x0A); + } +#endif /* BSP_SIL_POWER_SUPPLY_REGULATOR */ + +#ifdef BSP_SIL_POWER_SUPPLY_PINCTRL + /* Power control by GPIOs */ + if ( fp_dev->pin.pins_avdd_h ) { + err = pinctrl_select_state(fp_dev->pin.pinctrl, fp_dev->pin.pins_avdd_h); + } + if ( fp_dev->pin.pins_vddio_h ) { + err = pinctrl_select_state(fp_dev->pin.pinctrl, fp_dev->pin.pins_vddio_h); + } +#endif /* BSP_SIL_POWER_SUPPLY_PINCTRL */ + +#ifdef BSP_SIL_POWER_SUPPLY_GPIO + if ( fp_dev->avdd_port > 0 ) { + err = gpio_direction_output(fp_dev->avdd_port, 1); + } + if ( fp_dev->vddio_port > 0 ) { + err = gpio_direction_output(fp_dev->vddio_port, 1); + } +#endif /* BSP_SIL_POWER_SUPPLY_GPIO */ + fp_dev->power_is_off = 0; + LOG_MSG_DEBUG(INFO_LOG, "%s: power supply ret:%d \n", __func__, err); +} + +static void silfp_hw_poweroff(struct silfp_data *fp_dev) +{ + int err = 0; + + LOG_MSG_DEBUG(INFO_LOG, "[%s] enter.\n", __func__); +#ifdef BSP_SIL_POWER_SUPPLY_REGULATOR + /* Power control by Regulators(LDO) */ + if ((fp_dev->power_is_off == 0) && + fp_dev->avdd_ldo && + (regulator_is_enabled(fp_dev->avdd_ldo) > 0)) { + regulator_disable(fp_dev->avdd_ldo); /*disable regulator*/ + err = regulator_set_load(fp_dev->avdd_ldo, 0); + if (err < 0) + LOG_MSG_DEBUG(INFO_LOG, + "poweroff: vreg mode(err:%d)\n", err); + } + if ((fp_dev->power_is_off == 0) && + fp_dev->vddio_ldo && + (regulator_is_enabled(fp_dev->vddio_ldo) > 0)) { + regulator_disable(fp_dev->vddio_ldo); /*disable regulator*/ + err = regulator_set_load(fp_dev->vddio_ldo, 0); + if (err < 0) + LOG_MSG_DEBUG(INFO_LOG, + "poweroff: vreg mode(err:%d)\n", err); + } +#endif /* BSP_SIL_POWER_SUPPLY_REGULATOR */ + +#ifdef BSP_SIL_POWER_SUPPLY_PINCTRL + /* Power control by GPIOs */ + //fp_dev->pin.pins_avdd_h = NULL; + //fp_dev->pin.pins_vddio_h = NULL; +#endif /* BSP_SIL_POWER_SUPPLY_PINCTRL */ + +#ifdef BSP_SIL_POWER_SUPPLY_GPIO + if ( fp_dev->avdd_port > 0 ) { + gpio_direction_output(fp_dev->avdd_port, 0); + } + if ( fp_dev->vddio_port > 0 ) { + gpio_direction_output(fp_dev->vddio_port, 0); + } +#endif /* BSP_SIL_POWER_SUPPLY_GPIO */ + fp_dev->power_is_off = 1; +} + +static void silfp_power_deinit(struct silfp_data *fp_dev) +{ + int err = 0; + + LOG_MSG_DEBUG(INFO_LOG, "[%s] enter.\n", __func__); +#ifdef BSP_SIL_POWER_SUPPLY_REGULATOR + /* Power control by Regulators(LDO) */ + if (fp_dev->avdd_ldo) { + regulator_disable(fp_dev->avdd_ldo); /*disable regulator*/ + err = regulator_set_load(fp_dev->avdd_ldo, 0); + if (err < 0) + LOG_MSG_DEBUG(INFO_LOG, + "deinit: vreg mode(err:%d)\n", err); + regulator_put(fp_dev->avdd_ldo); + fp_dev->avdd_ldo = NULL; + } + if (fp_dev->vddio_ldo) { + regulator_disable(fp_dev->vddio_ldo); /*disable regulator*/ + err = regulator_set_load(fp_dev->vddio_ldo, 0); + if (err < 0) + LOG_MSG_DEBUG(INFO_LOG, + "deinit: Failed vreg mode(err:%d)\n", err); + regulator_put(fp_dev->vddio_ldo); + fp_dev->vddio_ldo = NULL; + } +#endif /* BSP_SIL_POWER_SUPPLY_REGULATOR */ + +#ifdef BSP_SIL_POWER_SUPPLY_PINCTRL + /* Power control by GPIOs */ + fp_dev->pin.pins_avdd_h = NULL; + fp_dev->pin.pins_vddio_h = NULL; +#endif /* BSP_SIL_POWER_SUPPLY_PINCTRL */ + +#ifdef BSP_SIL_POWER_SUPPLY_GPIO + if ( fp_dev->avdd_port > 0 ) { + gpio_direction_output(fp_dev->avdd_port, 0); + gpio_free(fp_dev->avdd_port); + fp_dev->avdd_port = 0; + } + if ( fp_dev->vddio_port > 0 ) { + gpio_direction_output(fp_dev->vddio_port, 0); + gpio_free(fp_dev->vddio_port); + fp_dev->vddio_port = 0; + } +#endif /* BSP_SIL_POWER_SUPPLY_GPIO */ +} + +/* -------------------------------------------------------------------- */ +/* hardware reset */ +/* -------------------------------------------------------------------- */ +static void silfp_hw_reset(struct silfp_data *fp_dev, u8 delay) +{ + LOG_MSG_DEBUG(INFO_LOG, + "[%s] enter, port=%d\n", __func__, fp_dev->rst_port); + + if (fp_dev->rst_port > 0) { + gpio_direction_output(fp_dev->rst_port, 0); + mdelay((delay?delay:1)*RESET_TIME_MULTIPLE); + gpio_direction_output(fp_dev->rst_port, 1); + + mdelay((delay?delay:1)*RESET_TIME_MULTIPLE); + } +} + +/* -------------------------------------------------------------------- */ +/* power down */ +/* -------------------------------------------------------------------- */ +static void silfp_pwdn(struct silfp_data *fp_dev, u8 flag_avdd) +{ + LOG_MSG_DEBUG(INFO_LOG, "[%s] enter, port=%d\n", __func__, fp_dev->rst_port); + + if (SIFP_PWDN_FLASH == flag_avdd) { + silfp_hw_poweroff(fp_dev); + msleep(200*RESET_TIME_MULTIPLE); + silfp_hw_poweron(fp_dev); + } + if ( fp_dev->rst_port > 0 ) { + gpio_direction_output(fp_dev->rst_port, 0); + } + + if (SIFP_PWDN_POWEROFF == flag_avdd) { + silfp_hw_poweroff(fp_dev); + } +} + +/* -------------------------------------------------------------------- */ +/* init/deinit functions */ +/* -------------------------------------------------------------------- */ +static int silfp_parse_dts(struct silfp_data* fp_dev) +{ + int ret; +#ifndef QSEE_V4 + /* Get the pinctrl node */ + fp_dev->pin.pinctrl = devm_pinctrl_get(&fp_dev->spi->dev); + if (IS_ERR_OR_NULL(fp_dev->pin.pinctrl)) { + LOG_MSG_DEBUG(ERR_LOG, "%s: Failed to get pinctrl\n", __func__); + return PTR_ERR(fp_dev->pin.pinctrl); + } + + /* Get the active setting */ + fp_dev->pin.active = pinctrl_lookup_state(fp_dev->pin.pinctrl, SPI_PINCTRL_STATE_DEFAULT); + if (IS_ERR_OR_NULL(fp_dev->pin.active)) { + fp_dev->pin.active = NULL; + fp_dev->pin.pinctrl = NULL; + LOG_MSG_DEBUG(ERR_LOG, "%s: Failed to get pinctrl state active\n",__func__); + return PTR_ERR(fp_dev->pin.active); + } + + /* Get power settings */ +#ifdef BSP_SIL_POWER_SUPPLY_PINCTRL + fp_dev->pin.pins_avdd_h = pinctrl_lookup_state(fp_dev->pin.pinctrl, "avdd-enable"); + if (IS_ERR_OR_NULL(fp_dev->pin.pins_avdd_h)) { + fp_dev->pin.pins_avdd_h = NULL; + LOG_MSG_DEBUG(ERR_LOG, "%s can't find silfp avdd-enable\n", __func__); + // Ignore error + } + + fp_dev->pin.pins_vddio_h = pinctrl_lookup_state(fp_dev->pin.pinctrl, "vddio-enable"); + if (IS_ERR_OR_NULL(fp_dev->pin.pins_vddio_h)) { + fp_dev->pin.pins_vddio_h = NULL; + LOG_MSG_DEBUG(ERR_LOG, "%s can't find silfp vddio-enable\n", __func__); + // Ignore error + } +#endif /* BSP_SIL_POWER_SUPPLY_PINCTRL */ +#endif /* QSEE_V4 */ + +#ifdef BSP_SIL_POWER_SUPPLY_REGULATOR + // Todo: use correct settings. + fp_dev->avdd_ldo = regulator_get(&fp_dev->spi->dev, "avdd"); + // fp_dev->vddio_ldo= regulator_get(&fp_dev->spi->dev, "vddio"); +#endif /* BSP_SIL_POWER_SUPPLY_REGULATOR */ + +#ifndef QSEE_V4 + /* Get sleep settings */ + fp_dev->pin.sleep = pinctrl_lookup_state(fp_dev->pin.pinctrl, SPI_PINCTRL_STATE_SLEEP); + if (IS_ERR_OR_NULL(fp_dev->pin.sleep)) { + fp_dev->pin.active = NULL; + fp_dev->pin.pinctrl = NULL; + LOG_MSG_DEBUG(ERR_LOG, "%s: Failed to get pinctrl state sleep\n",__func__); + return PTR_ERR(fp_dev->pin.sleep); + } + + /* Get iface_clk info */ + fp_dev->pin.iface_clk = clk_get(&fp_dev->spi->dev, "iface_clk"); + if (IS_ERR(fp_dev->pin.iface_clk)) { + fp_dev->pin.active = NULL; + fp_dev->pin.pinctrl = NULL; + LOG_MSG_DEBUG(ERR_LOG, "%s: Failed to get iface_clk %ld\n", __func__, PTR_ERR(fp_dev->pin.iface_clk)); + return PTR_ERR(fp_dev->pin.iface_clk); + } + + /* Get core_clk info */ + fp_dev->pin.core_clk = clk_get(&fp_dev->spi->dev, "core_clk"); + if (IS_ERR(fp_dev->pin.core_clk)) { + fp_dev->pin.active = NULL; + fp_dev->pin.pinctrl = NULL; + LOG_MSG_DEBUG(ERR_LOG, "%s: Failed to get core_clk %p\n", __func__, fp_dev->pin.core_clk); + return PTR_ERR(fp_dev->pin.core_clk); + } +#else + /* Get the SPI Max speed */ + ret = of_property_read_u32(fp_dev->spi->dev.of_node,"spi-max-frequency", &fp_dev->pin.max_speed_hz); + if (ret) { + fp_dev->pin.max_speed_hz = 0; + LOG_MSG_DEBUG(ERR_LOG, "Error getting spi max speed\n"); + } +#endif /* QSEE_V4 */ + + /* Get the QUP ID (#1-12) */ + ret = of_property_read_u32(fp_dev->spi->dev.of_node,"qcom,qup-id", &fp_dev->pin.qup_id); + if (ret) { + fp_dev->pin.qup_id = 0; + LOG_MSG_DEBUG(ERR_LOG, "Error getting qup_id\n"); + } + + LOG_MSG_DEBUG(INFO_LOG, "[%s] done (%d).\n",__func__,ret); + /* + Grab SPI master lock for exclusive access + call spi_bus_unlock to unlock the lock. + */ + //spi_bus_lock(fp_dev->spi->master); + return ret; +} + +#ifndef QSEE_V4 +static int spi_set_pinctrl(struct silfp_data* fp_dev, bool active) +{ + int ret = -1; + + if ( IS_ERR_OR_NULL(fp_dev->pin.pinctrl) || IS_ERR_OR_NULL(fp_dev->pin.active)) { + LOG_MSG_DEBUG(ERR_LOG, "%s: not support\n", __func__); + return ret; + } + if (active) { /* Change to active settings */ + ret = pinctrl_select_state(fp_dev->pin.pinctrl, fp_dev->pin.active); + } else { + ret = pinctrl_select_state(fp_dev->pin.pinctrl, fp_dev->pin.sleep); + } + + LOG_MSG_DEBUG(INFO_LOG, "%s: pinctrl_select_state ret:%d Setting:%d\n", __func__, ret, active); + return ret; +} + +static int spi_set_clks(struct silfp_data* fp_dev, bool enable) +{ + int ret = -1; + int clk = 19200000; + + if ( IS_ERR_OR_NULL(fp_dev->pin.pinctrl) || IS_ERR_OR_NULL(fp_dev->pin.active)) { + LOG_MSG_DEBUG(INFO_LOG, "%s: not support\n", __func__); + return ret; + } + if (enable) { + /* Enable the spi clocks */ + ret = clk_set_rate(fp_dev->pin.core_clk, fp_dev->spi->max_speed_hz); + if (ret) { + while ( clk > fp_dev->spi->max_speed_hz ) { + clk >>= 1; + } + if ( clk < 4800000 ) { + clk = 4800000; + } + ret = clk_set_rate(fp_dev->pin.core_clk, clk); + if ( ret ) { + LOG_MSG_DEBUG(ERR_LOG, "%s: Error setting clk_rate:%d, ret=%d\n",__func__, clk,ret); + } else { + fp_dev->spi->max_speed_hz = clk; + } + } + ret = clk_prepare_enable(fp_dev->pin.core_clk); + if (ret) { + LOG_MSG_DEBUG(ERR_LOG, "%s: Error enabling core clk, ret=%d\n",__func__,ret); + } + ret = clk_prepare_enable(fp_dev->pin.iface_clk); + if (ret) { + LOG_MSG_DEBUG(ERR_LOG, "%s: Error enabling iface clk, ret=%d\n",__func__,ret); + } + } else { + /* Disable the clocks */ + clk_disable_unprepare(fp_dev->pin.iface_clk); + clk_disable_unprepare(fp_dev->pin.core_clk); + ret = 0; + } + + LOG_MSG_DEBUG(DBG_LOG, "[%s] done (%d), speed = %d.\n",__func__,ret,fp_dev->spi->max_speed_hz ); + return ret; +} + +static int spi_set_fabric(struct silfp_data* fp_dev, bool active) +{ + int ret; + struct spi_master *master = fp_dev->spi->master; + + if (active) { + ret = master->prepare_transfer_hardware(master); + } else { + ret = master->unprepare_transfer_hardware(master); + } + LOG_MSG_DEBUG(DBG_LOG, "[%s] done (%d).\n",__func__,ret); + return ret; +} +#endif /* !QSEE_V4 */ + +static int silfp_set_spi(struct silfp_data *fp_dev, bool enable) +{ + int ret = -ENOENT; +#ifndef QSEE_V4 + if ( IS_ERR_OR_NULL(fp_dev->pin.pinctrl) || IS_ERR_OR_NULL(fp_dev->pin.active) || !fp_dev->pin.qup_id ) { + LOG_MSG_DEBUG(ERR_LOG, "%s: not support!\n", __func__); + return ret; + } + + if ( enable && !atomic_read(&fp_dev->spionoff_count) ) { + atomic_inc(&fp_dev->spionoff_count); + ret = spi_set_pinctrl(fp_dev, enable); + ret |= spi_set_fabric(fp_dev, enable); + ret |= spi_set_clks(fp_dev, enable); + } else if (atomic_read(&fp_dev->spionoff_count)) { + atomic_dec(&fp_dev->spionoff_count); + //spi_change_pipe_owner(false); + ret = spi_set_clks(fp_dev, enable); + ret |= spi_set_fabric(fp_dev, enable); + ret |= spi_set_pinctrl(fp_dev, enable); + } +#else + LOG_MSG_DEBUG(ERR_LOG, "%s: qsee4 no needed!\n", __func__); +#endif /* !QSEE_V4 */ + return ret; +} + +static int silfp_resource_init(struct silfp_data *fp_dev, struct fp_dev_init_t *dev_info) +{ + int status = 0; + int ret; + + if (atomic_read(&fp_dev->init)) { + atomic_inc(&fp_dev->init); + LOG_MSG_DEBUG(DBG_LOG, "[%s] dev already init(%d).\n",__func__,atomic_read(&fp_dev->init)); + return status; + } + + silfp_parse_dts(fp_dev); +#ifdef BSP_SIL_POWER_SUPPLY_GPIO + fp_dev->avdd_port = of_get_named_gpio(fp_dev->spi->dev.of_node, "avdd-gpios", 0); + fp_dev->vddio_port = of_get_named_gpio(fp_dev->spi->dev.of_node, "vddio-gpios", 0); + if (fp_dev->avdd_port > 0 ) { + gpio_free(fp_dev->avdd_port); + ret = gpio_request(fp_dev->avdd_port, "SILFP_AVDD_PIN"); + if (ret < 0) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] Failed to request GPIO=%d, ret=%d",__func__,(s32)fp_dev->avdd_port, ret); + status = -ENODEV; + goto err_avdd; + } + } + + if (fp_dev->vddio_port > 0 ) { + gpio_free(fp_dev->vddio_port); + ret = gpio_request(fp_dev->vddio_port, "SILFP_VDDIO_PIN"); + if (ret < 0) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] Failed to request GPIO=%d, ret=%d",__func__,(s32)fp_dev->vddio_port, ret); + status = -ENODEV; + goto err_vddio; + } + } +#endif /* BSP_SIL_POWER_SUPPLY_GPIO */ + silfp_hw_poweron(fp_dev); + fp_dev->int_port = of_get_named_gpio(fp_dev->spi->dev.of_node, "irq-gpios", 0); + fp_dev->rst_port = of_get_named_gpio(fp_dev->spi->dev.of_node, "rst-gpios", 0); + LOG_MSG_DEBUG(INFO_LOG, "[%s] int_port %d, rst_port %d.\n",__func__,fp_dev->int_port,fp_dev->rst_port); + if (fp_dev->int_port > 0 ) { + gpio_free(fp_dev->int_port); + } + + if (fp_dev->rst_port > 0 ) { + gpio_free(fp_dev->rst_port); + } + + ret = gpio_request(fp_dev->int_port, "SILFP_INT_IRQ"); + if (ret < 0) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] Failed to request GPIO=%d, ret=%d",__func__,(s32)fp_dev->int_port, ret); + status = -ENODEV; + goto err; + } else { + gpio_direction_input(fp_dev->int_port); + fp_dev->irq = gpio_to_irq(fp_dev->int_port); + fp_dev->irq_is_disable = 0; + + ret = request_irq(fp_dev->irq, + silfp_irq_handler, + IRQ_TYPE_EDGE_RISING, //IRQ_TYPE_LEVEL_HIGH, //irq_table[ts->int_trigger_type], + "silfp", + fp_dev); + if ( ret < 0 ) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] Filed to request_irq (%d), ert=%d",__func__,fp_dev->irq, ret); + status = -ENODEV; + goto err_irq; + } else { + LOG_MSG_DEBUG(INFO_LOG,"[%s] Enable_irq_wake.\n",__func__); + enable_irq_wake(fp_dev->irq); + silfp_irq_disable(fp_dev); + } + } + + if (fp_dev->rst_port > 0 ) { + ret = gpio_request(fp_dev->rst_port, "SILFP_RST_PIN"); + if (ret < 0) { + LOG_MSG_DEBUG(ERR_LOG, "[%s] Failed to request GPIO=%d, ret=%d",__func__,(s32)fp_dev->rst_port, ret); + status = -ENODEV; + goto err_rst; + } else { + gpio_direction_output(fp_dev->rst_port, 0); + } + } + + if (!ret) { + if (silfp_input_init(fp_dev)) { + goto err_input; + } + atomic_set(&fp_dev->init,1); + } + dev_info->reserve = PKG_SIZE; + dev_info->reserve <<= 12; +#ifdef QSEE_V4 + if (fp_dev->pin.max_speed_hz) { + dev_info->speed = fp_dev->pin.max_speed_hz; + } +#endif /* QSEE_V4 */ + + if (dev_info && fp_dev->pin.qup_id && (fp_dev->pin.qup_id < 16)) { + dev_info->dev_id = fp_dev->pin.qup_id; + strncpy(dev_info->ta,TANAME,sizeof(dev_info->ta)); + } + status = sl_pinctrl_init(fp_dev); + if (status < 0) + LOG_MSG_DEBUG(ERR_LOG, "[%s] Failed init gpio %d", + __func__, status); + return status; + +err_input: + if (fp_dev->rst_port > 0 ) { + gpio_free(fp_dev->rst_port); + } + +err_rst: + free_irq(fp_dev->irq, fp_dev); + gpio_direction_input(fp_dev->int_port); + +err_irq: + gpio_free(fp_dev->int_port); + +#ifdef BSP_SIL_POWER_SUPPLY_GPIO + gpio_free(fp_dev->vddio_port); +err_vddio: + gpio_free(fp_dev->avdd_port); + +err_avdd: + fp_dev->avdd_port = 0; + fp_dev->vddio_port = 0; +#endif /* BSP_SIL_POWER_SUPPLY_GPIO */ + +err: + fp_dev->int_port = 0; + fp_dev->rst_port = 0; + + return status; +} + +#endif /* __SILEAD_FP_QCOM__ */ + +#endif /* BSP_SIL_PLAT_QCOM */ + +/* End of file spilead_fp_qcom.c */ diff --git a/drivers/input/fingerprint/silead/silead_fp_qcom.h b/drivers/input/fingerprint/silead/silead_fp_qcom.h new file mode 100755 index 000000000000..c1e02f0a1bf3 --- /dev/null +++ b/drivers/input/fingerprint/silead/silead_fp_qcom.h @@ -0,0 +1,48 @@ +/* + * @file silead_fp_qcom.h + * @brief Contains silead_fp Qualcomm platform specific head file. + * + * + * Copyright 2016-2018 Slead Inc. + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + * + * ------------------- Revision History ------------------------------ + * + * Bill Yu 2018/5/2 0.1.0 Init version + * + */ + +#ifndef __SILEAD_FP_QCOM_H__ +#define __SILEAD_FP_QCOM_H__ + +#include +#include +#include + +struct fp_plat_t { + u32 qup_id; +#ifdef QSEE_V4 + u32 max_speed_hz; +#else + /* pinctrl info */ + struct pinctrl *pinctrl; + struct pinctrl_state *active; + struct pinctrl_state *sleep; +#ifdef BSP_SIL_POWER_SUPPLY_PINCTRL + struct pinctrl_state *pins_avdd_h, *pins_vddio_h; +#endif /* BSP_SIL_POWER_SUPPLY_PINCTRL */ + /* clock info */ + struct clk *core_clk; + struct clk *iface_clk; +#endif /* QSEE_V4 */ +}; + +#endif /* __SILEAD_FP_QCOM_H__ */ + +/* End of file silead_fp_qcom.h */ diff --git a/drivers/input/touchscreen/synaptics_baseline.h b/drivers/input/touchscreen/synaptics_baseline.h index 15510cda8d28..d43caf686a32 100644 --- a/drivers/input/touchscreen/synaptics_baseline.h +++ b/drivers/input/touchscreen/synaptics_baseline.h @@ -12,298 +12,42 @@ const int16_t baseline_cap_17819_data[2][TX_17819_NUMBER][RX_17819_NUMBER*2] = { //enable cbc Notice it is opposite to the xls format. { - {389, 909, 584, 1363, 611, 1426, 603, 1407, - 597, 1394, 608, 1419, 601, 1401, 599, 1397, - 605, 1411, 611, 1427, 611, 1426, 617, 1441, - 608, 1419, 621, 1448, 617, 1440, 615, 1436, - 625, 1458, 629, 1468, 624, 1456, 636, 1484, - 630, 1470, 629, 1467, 651, 1520, 643, 1499, - 647, 1510, 652, 1521, 661, 1541, 661, 1543, - 665, 1552, 671, 1566, 667, 1556, 666, 1555, - 627, 1463}, - {624, 1456, 626, 1460, 629, 1467, 618, 1442, - 613, 1430, 623, 1454, 615, 1436, 614, 1432, - 619, 1445, 626, 1460, 625, 1459, 632, 1475, - 622, 1452, 636, 1485, 632, 1474, 630, 1470, - 640, 1494, 645, 1505, 638, 1489, 651, 1519, - 645, 1505, 642, 1499, 655, 1529, 657, 1532, - 673, 1570, 665, 1552, 675, 1576, 675, 1576, - 678, 1582, 684, 1596, 680, 1587, 684, 1597, - 681, 1589}, - {614, 1433, 622, 1452, 624, 1457, 615, 1435, - 609, 1421, 619, 1444, 612, 1427, 610, 1424, - 617, 1439, 624, 1455, 623, 1453, 630, 1469, - 620, 1447, 633, 1477, 629, 1468, 627, 1462, - 637, 1485, 641, 1496, 635, 1482, 647, 1510, - 641, 1496, 650, 1518, 652, 1522, 653, 1524, - 658, 1535, 661, 1543, 671, 1566, 672, 1567, - 673, 1571, 681, 1589, 676, 1576, 680, 1586, - 674, 1572}, - {611, 1426, 622, 1451, 623, 1454, 613, 1431, - 608, 1420, 619, 1443, 611, 1426, 609, 1422, - 616, 1437, 622, 1452, 622, 1451, 628, 1465, - 619, 1443, 632, 1474, 627, 1464, 626, 1461, - 636, 1484, 641, 1495, 634, 1479, 657, 1534, - 640, 1494, 638, 1489, 651, 1519, 651, 1519, - 656, 1532, 660, 1539, 669, 1562, 670, 1563, - 672, 1569, 706, 1647, 674, 1572, 678, 1581, - 671, 1566}, - {611, 1426, 623, 1454, 623, 1454, 613, 1431, - 608, 1419, 618, 1442, 611, 1426, 609, 1422, - 627, 1463, 623, 1453, 621, 1450, 628, 1466, - 619, 1443, 632, 1475, 628, 1465, 625, 1458, - 635, 1482, 640, 1494, 633, 1478, 646, 1507, - 639, 1492, 638, 1488, 650, 1516, 651, 1520, - 656, 1530, 659, 1538, 668, 1559, 668, 1559, - 672, 1567, 677, 1580, 673, 1569, 677, 1580, - 668, 1559}, - {613, 1429, 650, 1517, 624, 1456, 615, 1435, - 609, 1421, 631, 1472, 612, 1427, 610, 1423, - 616, 1438, 623, 1454, 623, 1453, 629, 1468, - 621, 1448, 633, 1476, 629, 1467, 626, 1462, - 636, 1485, 641, 1496, 634, 1480, 647, 1510, - 641, 1495, 639, 1490, 651, 1519, 651, 1519, - 656, 1530, 660, 1539, 668, 1558, 668, 1559, - 671, 1565, 677, 1580, 672, 1568, 677, 1580, - 667, 1556}, - {561, 1309, 623, 1454, 626, 1460, 616, 1438, - 610, 1424, 620, 1448, 614, 1432, 612, 1427, - 618, 1443, 625, 1458, 624, 1457, 630, 1470, - 622, 1451, 635, 1481, 631, 1472, 640, 1494, - 638, 1489, 642, 1498, 636, 1484, 648, 1512, - 641, 1497, 639, 1491, 651, 1520, 652, 1520, - 656, 1531, 660, 1540, 667, 1557, 668, 1558, - 670, 1564, 677, 1579, 672, 1567, 677, 1580, - 667, 1556}, - {397, 926, 604, 1410, 627, 1464, 618, 1442, - 624, 1457, 623, 1453, 615, 1434, 613, 1430, - 621, 1448, 627, 1463, 627, 1463, 632, 1474, - 623, 1454, 637, 1486, 632, 1474, 630, 1470, - 640, 1494, 644, 1502, 638, 1489, 650, 1516, - 643, 1499, 641, 1496, 653, 1524, 653, 1525, - 657, 1534, 661, 1543, 669, 1562, 669, 1560, - 672, 1568, 677, 1580, 673, 1570, 678, 1581, - 666, 1553}, - {411, 959, 612, 1428, 626, 1460, 618, 1441, - 612, 1428, 622, 1452, 614, 1434, 613, 1431, - 620, 1447, 627, 1463, 626, 1461, 632, 1476, - 623, 1454, 637, 1485, 631, 1473, 630, 1471, - 640, 1493, 643, 1501, 637, 1487, 649, 1515, - 643, 1499, 640, 1494, 653, 1523, 664, 1550, - 657, 1533, 660, 1541, 669, 1561, 668, 1560, - 671, 1565, 677, 1581, 672, 1568, 677, 1579, - 663, 1546}, - {579, 1352, 625, 1458, 626, 1462, 617, 1439, - 611, 1426, 622, 1451, 614, 1433, 613, 1429, - 620, 1447, 626, 1460, 625, 1459, 644, 1502, - 623, 1453, 636, 1484, 631, 1472, 630, 1469, - 640, 1492, 643, 1500, 637, 1486, 649, 1515, - 641, 1496, 640, 1493, 652, 1522, 652, 1522, - 657, 1533, 660, 1540, 669, 1561, 668, 1559, - 671, 1566, 677, 1580, 672, 1569, 677, 1580, - 657, 1533}, - {631, 1472, 627, 1463, 626, 1461, 617, 1441, - 612, 1427, 623, 1453, 615, 1435, 614, 1432, - 620, 1447, 626, 1461, 626, 1461, 632, 1474, - 624, 1455, 637, 1485, 632, 1475, 630, 1470, - 639, 1491, 644, 1503, 638, 1488, 650, 1516, - 642, 1498, 640, 1493, 653, 1523, 652, 1522, - 657, 1533, 672, 1567, 669, 1561, 669, 1560, - 671, 1566, 677, 1579, 672, 1568, 677, 1580, - 664, 1549}, - {631, 1472, 627, 1463, 627, 1464, 618, 1442, - 613, 1429, 623, 1454, 615, 1436, 614, 1432, - 621, 1448, 627, 1464, 626, 1461, 633, 1477, - 624, 1456, 636, 1485, 632, 1475, 630, 1471, - 640, 1494, 644, 1503, 650, 1517, 650, 1518, - 643, 1500, 641, 1496, 653, 1524, 653, 1524, - 657, 1533, 661, 1542, 670, 1563, 669, 1561, - 672, 1567, 678, 1581, 673, 1569, 677, 1580, - 662, 1544}, - {633, 1478, 628, 1465, 628, 1466, 619, 1443, - 613, 1430, 624, 1457, 617, 1440, 615, 1435, - 622, 1451, 629, 1467, 639, 1491, 633, 1478, - 625, 1458, 637, 1487, 634, 1479, 632, 1474, - 642, 1497, 646, 1507, 640, 1493, 652, 1521, - 645, 1505, 644, 1502, 656, 1530, 656, 1530, - 661, 1543, 665, 1552, 674, 1574, 675, 1575, - 677, 1580, 684, 1597, 680, 1587, 685, 1598, - 671, 1566}, - {638, 1489, 632, 1474, 632, 1475, 622, 1452, - 617, 1440, 628, 1465, 621, 1448, 631, 1471, - 626, 1461, 632, 1476, 633, 1476, 638, 1489, - 629, 1468, 643, 1499, 638, 1488, 636, 1485, - 646, 1507, 650, 1517, 643, 1501, 656, 1530, - 648, 1513, 647, 1509, 658, 1535, 659, 1537, - 662, 1544, 666, 1554, 675, 1574, 676, 1576, - 678, 1581, 684, 1597, 680, 1586, 685, 1598, - 672, 1569}, - {633, 1477, 635, 1482, 634, 1479, 624, 1456, - 619, 1444, 630, 1469, 633, 1477, 620, 1448, - 626, 1461, 633, 1477, 632, 1476, 638, 1490, - 630, 1470, 643, 1499, 639, 1490, 637, 1486, - 646, 1508, 650, 1516, 644, 1503, 656, 1531, - 649, 1515, 647, 1510, 659, 1537, 659, 1538, - 663, 1548, 667, 1556, 676, 1577, 677, 1579, - 679, 1584, 686, 1600, 682, 1592, 687, 1603, - 671, 1565}, - {558, 1302, 637, 1487, 644, 1504, 631, 1472, - 622, 1451, 631, 1472, 622, 1450, 618, 1442, - 624, 1455, 629, 1467, 627, 1464, 633, 1476, - 623, 1455, 636, 1484, 642, 1497, 628, 1466, - 638, 1488, 640, 1494, 633, 1478, 646, 1506, - 638, 1488, 636, 1483, 648, 1511, 647, 1511, - 652, 1520, 655, 1527, 664, 1550, 665, 1552, - 667, 1555, 674, 1573, 672, 1567, 681, 1589, - 646, 1507} + {386, 901, 618, 1441, 645, 1506, 651, 1519, 642, 1498, 638, 1489, 641, 1495, 643, 1500, 649, 1514, 637, 1485, 642, 1499, 649, 1515, 641, 1496, 648, 1512, 648, 1513, 644, 1503, 644, 1502, 644, 1502, 647, 1509, 653, 1525, 652, 1522, 658, 1535, 680, 1586, 667, 1556, 659, 1539, 663, 1547, 651, 1520, 662, 1545, 668, 1558, 663, 1546, 660, 1540, 665, 1551, 630, 1471}, + {665, 1553, 667, 1555, 669, 1560, 676, 1576, 665, 1552, 662, 1544, 664, 1549, 667, 1557, 672, 1567, 663, 1546, 666, 1553, 673, 1570, 668, 1559, 676, 1577, 671, 1566, 667, 1556, 672, 1568, 670, 1563, 669, 1562, 676, 1577, 679, 1583, 676, 1576, 681, 1588, 685, 1598, 713, 1664, 686, 1601, 676, 1578, 687, 1602, 688, 1605, 688, 1605, 681, 1589, 691, 1613, 695, 1622}, + {650, 1517, 662, 1545, 663, 1548, 671, 1565, 660, 1539, 656, 1531, 658, 1536, 661, 1543, 667, 1556, 657, 1533, 661, 1542, 668, 1559, 663, 1546, 670, 1564, 666, 1555, 662, 1544, 666, 1553, 665, 1551, 665, 1551, 671, 1566, 674, 1573, 704, 1643, 676, 1577, 678, 1582, 675, 1576, 679, 1585, 671, 1565, 681, 1590, 682, 1591, 683, 1593, 675, 1575, 686, 1601, 687, 1602}, + {644, 1503, 660, 1539, 661, 1543, 668, 1559, 657, 1532, 654, 1525, 656, 1530, 658, 1535, 664, 1549, 654, 1526, 658, 1536, 664, 1549, 660, 1540, 667, 1557, 663, 1547, 658, 1536, 663, 1546, 661, 1543, 662, 1544, 702, 1639, 670, 1564, 667, 1557, 672, 1567, 675, 1575, 673, 1571, 676, 1577, 667, 1556, 678, 1582, 679, 1584, 705, 1646, 672, 1569, 683, 1593, 683, 1594}, + {644, 1503, 659, 1538, 660, 1540, 667, 1555, 656, 1530, 653, 1523, 654, 1527, 658, 1534, 699, 1631, 653, 1525, 656, 1531, 663, 1547, 659, 1538, 667, 1556, 661, 1543, 658, 1534, 662, 1544, 660, 1540, 660, 1540, 667, 1555, 669, 1561, 665, 1553, 670, 1564, 673, 1571, 671, 1565, 674, 1573, 665, 1553, 677, 1579, 677, 1580, 677, 1579, 670, 1564, 681, 1588, 680, 1587}, + {643, 1501, 685, 1597, 659, 1537, 666, 1554, 655, 1529, 687, 1602, 654, 1526, 656, 1531, 662, 1545, 652, 1522, 656, 1530, 663, 1546, 658, 1534, 665, 1552, 661, 1543, 656, 1530, 660, 1540, 659, 1537, 658, 1536, 665, 1552, 667, 1557, 664, 1549, 668, 1559, 671, 1567, 669, 1562, 672, 1568, 664, 1550, 674, 1573, 676, 1577, 675, 1576, 669, 1560, 680, 1586, 678, 1582}, + {583, 1360, 657, 1534, 660, 1539, 666, 1554, 655, 1529, 651, 1520, 655, 1528, 656, 1532, 662, 1545, 652, 1522, 657, 1532, 663, 1546, 658, 1536, 665, 1551, 662, 1544, 693, 1616, 661, 1542, 659, 1538, 659, 1538, 666, 1554, 668, 1558, 664, 1550, 668, 1559, 671, 1566, 669, 1561, 672, 1568, 663, 1548, 675, 1575, 675, 1576, 675, 1576, 669, 1561, 679, 1584, 677, 1580}, + {398, 930, 637, 1486, 659, 1539, 667, 1556, 691, 1613, 652, 1522, 655, 1527, 656, 1532, 663, 1546, 652, 1522, 657, 1532, 663, 1546, 658, 1536, 665, 1552, 662, 1544, 657, 1532, 661, 1542, 659, 1538, 658, 1535, 666, 1554, 666, 1554, 664, 1549, 668, 1559, 671, 1567, 669, 1560, 672, 1568, 664, 1548, 674, 1574, 675, 1575, 674, 1573, 668, 1559, 678, 1582, 676, 1576}, + {416, 970, 645, 1505, 658, 1536, 665, 1551, 654, 1526, 651, 1519, 653, 1524, 656, 1530, 661, 1543, 651, 1519, 655, 1529, 662, 1545, 657, 1532, 665, 1551, 660, 1541, 656, 1531, 660, 1539, 659, 1537, 658, 1535, 665, 1552, 666, 1554, 664, 1548, 668, 1558, 706, 1647, 668, 1559, 671, 1567, 663, 1547, 673, 1571, 674, 1573, 674, 1573, 668, 1558, 679, 1583, 672, 1568}, + {603, 1406, 657, 1534, 658, 1534, 664, 1548, 654, 1525, 650, 1516, 652, 1520, 656, 1530, 660, 1541, 651, 1520, 655, 1528, 697, 1627, 657, 1533, 665, 1551, 661, 1541, 655, 1528, 660, 1539, 658, 1534, 658, 1534, 665, 1551, 665, 1552, 663, 1547, 667, 1557, 670, 1564, 668, 1560, 670, 1564, 663, 1546, 673, 1570, 674, 1572, 674, 1573, 667, 1556, 678, 1583, 667, 1556}, + {659, 1538, 658, 1535, 657, 1533, 665, 1551, 653, 1525, 651, 1518, 652, 1521, 656, 1530, 660, 1541, 651, 1518, 655, 1528, 661, 1542, 657, 1533, 664, 1549, 660, 1539, 655, 1529, 659, 1539, 658, 1535, 658, 1535, 665, 1552, 666, 1554, 663, 1547, 668, 1558, 671, 1565, 668, 1559, 707, 1650, 662, 1544, 673, 1570, 674, 1573, 672, 1569, 667, 1556, 678, 1581, 672, 1569}, + {659, 1539, 658, 1535, 658, 1534, 665, 1551, 653, 1524, 650, 1516, 653, 1524, 655, 1528, 660, 1541, 651, 1518, 655, 1528, 662, 1545, 656, 1532, 664, 1550, 660, 1540, 655, 1529, 659, 1538, 658, 1535, 695, 1622, 665, 1553, 667, 1555, 663, 1546, 667, 1557, 671, 1565, 668, 1559, 671, 1567, 663, 1547, 673, 1570, 674, 1572, 674, 1573, 667, 1557, 677, 1580, 671, 1566}, + {661, 1542, 659, 1537, 658, 1536, 665, 1552, 654, 1525, 651, 1518, 653, 1523, 656, 1530, 661, 1543, 651, 1520, 692, 1615, 662, 1545, 658, 1534, 665, 1552, 661, 1543, 656, 1531, 660, 1540, 659, 1538, 660, 1539, 667, 1555, 668, 1559, 665, 1552, 670, 1563, 673, 1571, 672, 1568, 675, 1575, 667, 1556, 678, 1582, 680, 1586, 680, 1587, 674, 1572, 685, 1599, 680, 1586}, + {666, 1555, 662, 1546, 662, 1544, 668, 1560, 657, 1534, 654, 1526, 657, 1533, 696, 1624, 666, 1553, 656, 1531, 660, 1541, 666, 1555, 662, 1546, 669, 1562, 665, 1552, 661, 1542, 665, 1551, 663, 1548, 663, 1547, 670, 1564, 671, 1566, 668, 1559, 672, 1568, 676, 1577, 673, 1570, 676, 1578, 669, 1560, 679, 1585, 680, 1587, 681, 1589, 674, 1573, 686, 1600, 681, 1589}, + {659, 1537, 663, 1546, 662, 1545, 668, 1559, 658, 1535, 654, 1526, 692, 1615, 659, 1538, 665, 1553, 655, 1528, 659, 1539, 666, 1554, 661, 1542, 669, 1560, 665, 1551, 661, 1541, 664, 1549, 663, 1547, 663, 1547, 670, 1563, 672, 1568, 668, 1559, 673, 1570, 676, 1578, 674, 1573, 677, 1579, 669, 1561, 679, 1584, 681, 1590, 681, 1589, 675, 1576, 687, 1602, 679, 1585}, + {575, 1343, 672, 1567, 677, 1579, 679, 1584, 665, 1552, 659, 1538, 660, 1539, 660, 1540, 664, 1549, 652, 1522, 656, 1530, 661, 1542, 656, 1530, 662, 1546, 694, 1619, 652, 1522, 656, 1530, 654, 1526, 653, 1524, 660, 1539, 660, 1541, 657, 1533, 661, 1543, 664, 1549, 661, 1542, 663, 1548, 655, 1528, 666, 1554, 668, 1558, 668, 1558, 663, 1548, 678, 1582, 651, 1520}, }, - //disable cbc +/*disable cbc*/ { - {384, 896, 579, 1350, 606, 1414, 598, 1394, - 593, 1384, 603, 1407, 595, 1388, 593, 1384, - 600, 1400, 605, 1412, 606, 1414, 612, 1428, - 602, 1405, 616, 1436, 612, 1428, 610, 1423, - 619, 1444, 624, 1457, 619, 1444, 631, 1473, - 624, 1456, 624, 1455, 647, 1511, 637, 1486, - 641, 1496, 647, 1509, 655, 1527, 656, 1530, - 659, 1538, 665, 1551, 661, 1543, 661, 1542, - 622, 1451}, - {620, 1446, 621, 1449, 623, 1455, 614, 1432, - 609, 1420, 618, 1442, 611, 1425, 609, 1421, - 615, 1436, 621, 1450, 621, 1449, 627, 1463, - 618, 1441, 631, 1473, 627, 1463, 625, 1458, - 636, 1483, 640, 1494, 634, 1478, 646, 1508, - 640, 1493, 638, 1488, 651, 1518, 652, 1521, - 670, 1564, 661, 1541, 670, 1563, 671, 1565, - 673, 1571, 680, 1587, 675, 1575, 680, 1587, - 677, 1579}, - {610, 1423, 618, 1443, 620, 1447, 611, 1426, - 606, 1414, 615, 1436, 608, 1419, 606, 1414, - 612, 1429, 620, 1446, 618, 1443, 625, 1459, - 615, 1435, 629, 1468, 624, 1457, 622, 1452, - 632, 1475, 637, 1485, 630, 1471, 642, 1498, - 636, 1485, 649, 1514, 648, 1512, 648, 1513, - 653, 1524, 658, 1534, 666, 1555, 668, 1558, - 669, 1561, 676, 1577, 671, 1565, 676, 1576, - 669, 1562}, - {606, 1414, 617, 1441, 620, 1446, 610, 1423, - 605, 1412, 614, 1432, 606, 1414, 605, 1413, - 611, 1426, 618, 1441, 617, 1441, 624, 1456, - 614, 1433, 628, 1465, 623, 1454, 621, 1449, - 631, 1472, 636, 1483, 629, 1469, 655, 1529, - 635, 1482, 634, 1479, 646, 1507, 646, 1508, - 651, 1518, 656, 1531, 664, 1549, 665, 1552, - 667, 1556, 700, 1633, 668, 1559, 673, 1570, - 666, 1555}, - {608, 1418, 617, 1441, 619, 1445, 610, 1422, - 604, 1409, 613, 1431, 607, 1416, 604, 1410, - 626, 1460, 617, 1440, 618, 1441, 623, 1454, - 614, 1432, 627, 1464, 622, 1452, 621, 1449, - 630, 1470, 635, 1481, 629, 1467, 641, 1495, - 635, 1481, 633, 1477, 644, 1503, 646, 1506, - 650, 1517, 654, 1527, 663, 1548, 663, 1548, - 666, 1554, 671, 1567, 667, 1557, 672, 1568, - 664, 1549}, - {608, 1419, 645, 1506, 620, 1446, 611, 1425, - 605, 1412, 629, 1468, 607, 1416, 605, 1413, - 612, 1429, 618, 1443, 618, 1442, 624, 1456, - 616, 1437, 628, 1466, 624, 1456, 622, 1450, - 632, 1476, 636, 1485, 630, 1470, 641, 1497, - 635, 1482, 633, 1478, 646, 1506, 646, 1507, - 651, 1518, 655, 1528, 663, 1547, 663, 1548, - 666, 1554, 672, 1568, 666, 1555, 672, 1567, - 663, 1547}, - {556, 1296, 618, 1442, 621, 1449, 611, 1427, - 606, 1414, 616, 1436, 609, 1420, 606, 1415, - 613, 1431, 619, 1445, 619, 1445, 625, 1458, - 616, 1437, 629, 1469, 625, 1458, 636, 1484, - 633, 1476, 637, 1486, 631, 1472, 642, 1499, - 636, 1484, 634, 1479, 646, 1507, 646, 1508, - 651, 1518, 655, 1528, 661, 1543, 662, 1545, - 665, 1553, 671, 1567, 667, 1557, 671, 1566, - 662, 1544}, - {393, 916, 600, 1400, 622, 1452, 614, 1432, - 622, 1452, 619, 1444, 611, 1426, 610, 1423, - 617, 1439, 623, 1453, 622, 1452, 628, 1466, - 619, 1445, 633, 1476, 627, 1464, 626, 1460, - 635, 1482, 640, 1493, 633, 1477, 645, 1504, - 638, 1488, 636, 1485, 648, 1512, 648, 1512, - 652, 1522, 657, 1532, 664, 1550, 665, 1551, - 667, 1556, 672, 1568, 668, 1558, 672, 1569, - 662, 1544}, - {406, 947, 608, 1419, 622, 1450, 613, 1430, - 608, 1418, 618, 1442, 611, 1425, 609, 1422, - 616, 1437, 622, 1451, 622, 1450, 628, 1465, - 618, 1443, 632, 1475, 626, 1461, 625, 1458, - 635, 1481, 639, 1490, 633, 1477, 644, 1503, - 637, 1486, 636, 1484, 648, 1511, 661, 1542, - 652, 1520, 656, 1530, 664, 1549, 664, 1549, - 666, 1555, 672, 1568, 668, 1558, 672, 1567, - 658, 1536}, - {574, 1339, 620, 1447, 622, 1451, 612, 1428, - 607, 1416, 617, 1439, 610, 1422, 609, 1420, - 615, 1436, 621, 1450, 621, 1449, 640, 1493, - 618, 1442, 631, 1471, 627, 1462, 624, 1455, - 634, 1479, 638, 1489, 633, 1477, 644, 1502, - 636, 1485, 636, 1484, 647, 1510, 647, 1510, - 652, 1520, 655, 1529, 663, 1548, 664, 1549, - 666, 1554, 671, 1567, 667, 1557, 672, 1568, - 653, 1524}, - {626, 1460, 621, 1450, 622, 1452, 613, 1430, - 608, 1418, 618, 1441, 610, 1423, 609, 1422, - 616, 1438, 622, 1450, 621, 1450, 627, 1464, - 618, 1443, 632, 1474, 627, 1464, 624, 1457, - 635, 1482, 639, 1490, 632, 1475, 645, 1504, - 638, 1488, 636, 1484, 647, 1511, 648, 1512, - 652, 1520, 669, 1561, 664, 1549, 664, 1549, - 666, 1554, 672, 1567, 668, 1558, 672, 1568, - 659, 1539}, - {627, 1462, 623, 1454, 623, 1454, 614, 1433, - 608, 1419, 619, 1444, 612, 1428, 611, 1426, - 617, 1440, 622, 1452, 622, 1450, 628, 1465, - 620, 1446, 632, 1475, 628, 1465, 626, 1460, - 635, 1483, 640, 1493, 647, 1510, 645, 1506, - 638, 1489, 637, 1485, 649, 1514, 649, 1514, - 652, 1522, 657, 1532, 664, 1550, 665, 1552, - 667, 1557, 672, 1568, 668, 1559, 672, 1568, - 658, 1535}, - {630, 1469, 624, 1456, 624, 1456, 615, 1434, - 609, 1421, 619, 1445, 613, 1430, 611, 1426, - 618, 1442, 623, 1455, 636, 1484, 629, 1468, - 620, 1448, 634, 1479, 629, 1468, 627, 1463, - 636, 1485, 641, 1496, 635, 1482, 647, 1510, - 640, 1494, 639, 1492, 651, 1518, 652, 1521, - 656, 1531, 661, 1543, 670, 1563, 670, 1564, - 672, 1569, 679, 1584, 675, 1576, 681, 1588, - 668, 1558}, - {634, 1479, 627, 1462, 627, 1462, 617, 1440, - 613, 1429, 623, 1453, 615, 1435, 627, 1464, - 621, 1450, 628, 1465, 627, 1462, 633, 1477, - 625, 1457, 638, 1488, 633, 1476, 632, 1474, - 640, 1494, 645, 1505, 639, 1491, 650, 1518, - 643, 1501, 642, 1497, 652, 1522, 653, 1523, - 657, 1534, 662, 1544, 670, 1563, 670, 1564, - 672, 1569, 679, 1584, 675, 1575, 680, 1587, - 667, 1556}, - {628, 1464, 629, 1469, 629, 1468, 620, 1446, - 614, 1433, 624, 1456, 630, 1470, 616, 1436, - 622, 1452, 628, 1465, 627, 1463, 633, 1477, - 624, 1455, 638, 1488, 633, 1476, 631, 1472, - 640, 1494, 645, 1505, 638, 1489, 651, 1519, - 644, 1502, 642, 1498, 653, 1525, 653, 1524, - 658, 1535, 662, 1544, 670, 1563, 671, 1565, - 673, 1571, 679, 1585, 676, 1577, 681, 1590, - 665, 1552}, - {554, 1293, 633, 1478, 639, 1492, 626, 1462, - 619, 1443, 626, 1461, 616, 1438, 614, 1433, - 619, 1445, 624, 1457, 623, 1454, 627, 1464, - 618, 1443, 632, 1474, 638, 1488, 623, 1454, - 632, 1474, 636, 1484, 629, 1468, 641, 1495, - 633, 1478, 632, 1474, 642, 1499, 643, 1500, - 647, 1509, 651, 1518, 659, 1538, 660, 1541, - 663, 1547, 669, 1561, 667, 1556, 677, 1579, - 642, 1498} - } + {397, 927, 628, 1466, 653, 1524, 660, 1539, 649, 1513, 647, 1509, 650, 1517, 651, 1518, 657, 1532, 646, 1506, 652, 1520, 657, 1533, 652, 1521, 659, 1539, 658, 1536, 651, 1519, 655, 1528, 654, 1526, 654, 1526, 662, 1545, 664, 1549, 665, 1552, 677, 1579, 674, 1572, 668, 1558, 672, 1567, 662, 1545, 673, 1569, 677, 1581, 675, 1575, 669, 1560, 672, 1567, 637, 1486}, + {672, 1568, 673, 1570, 675, 1575, 682, 1592, 671, 1566, 668, 1558, 671, 1567, 672, 1569, 678, 1583, 668, 1558, 672, 1569, 680, 1586, 674, 1572, 682, 1590, 678, 1583, 673, 1570, 678, 1582, 676, 1577, 676, 1577, 683, 1594, 684, 1597, 682, 1591, 687, 1603, 691, 1613, 708, 1652, 693, 1617, 683, 1594, 694, 1618, 695, 1621, 695, 1621, 688, 1606, 696, 1625, 701, 1635}, + {656, 1531, 668, 1559, 670, 1564, 678, 1582, 666, 1553, 664, 1549, 666, 1554, 668, 1558, 674, 1573, 664, 1548, 668, 1559, 675, 1575, 669, 1561, 678, 1581, 673, 1570, 669, 1560, 673, 1571, 671, 1566, 671, 1566, 678, 1582, 681, 1590, 699, 1630, 683, 1595, 686, 1600, 682, 1591, 686, 1602, 677, 1580, 688, 1606, 690, 1609, 690, 1611, 683, 1594, 692, 1615, 693, 1616}, + {653, 1523, 667, 1557, 670, 1562, 677, 1579, 665, 1552, 662, 1545, 665, 1552, 666, 1553, 672, 1569, 662, 1545, 667, 1555, 673, 1569, 668, 1559, 676, 1576, 672, 1568, 666, 1555, 671, 1566, 670, 1563, 670, 1564, 699, 1630, 679, 1584, 675, 1575, 680, 1587, 683, 1594, 680, 1587, 684, 1595, 676, 1577, 686, 1600, 687, 1604, 714, 1666, 681, 1589, 689, 1608, 689, 1608}, + {652, 1521, 668, 1558, 668, 1558, 675, 1574, 663, 1547, 661, 1541, 662, 1546, 666, 1554, 694, 1618, 662, 1544, 665, 1551, 671, 1567, 667, 1555, 674, 1572, 670, 1563, 665, 1551, 670, 1563, 668, 1559, 668, 1558, 675, 1576, 676, 1577, 673, 1570, 677, 1580, 682, 1590, 678, 1581, 682, 1591, 674, 1572, 684, 1596, 684, 1596, 685, 1599, 679, 1584, 687, 1602, 686, 1602}, + {650, 1518, 691, 1612, 666, 1553, 672, 1569, 662, 1546, 682, 1592, 662, 1545, 662, 1546, 668, 1560, 659, 1537, 664, 1548, 669, 1562, 665, 1551, 672, 1567, 668, 1559, 662, 1546, 667, 1557, 665, 1553, 665, 1552, 672, 1568, 674, 1574, 671, 1565, 676, 1577, 679, 1583, 676, 1576, 679, 1584, 672, 1567, 681, 1590, 683, 1594, 683, 1593, 676, 1578, 685, 1598, 684, 1595}, + {590, 1376, 664, 1549, 666, 1555, 673, 1569, 661, 1543, 659, 1537, 662, 1544, 662, 1545, 668, 1560, 658, 1536, 663, 1548, 670, 1563, 665, 1551, 672, 1569, 669, 1561, 688, 1606, 668, 1558, 665, 1553, 665, 1552, 672, 1569, 674, 1574, 671, 1566, 675, 1575, 678, 1583, 676, 1576, 679, 1584, 671, 1566, 682, 1590, 682, 1591, 682, 1592, 676, 1576, 685, 1598, 683, 1594}, + {406, 947, 644, 1502, 666, 1554, 674, 1572, 686, 1600, 660, 1540, 662, 1544, 663, 1546, 669, 1561, 659, 1538, 663, 1548, 670, 1563, 665, 1552, 673, 1570, 669, 1560, 664, 1549, 668, 1558, 667, 1556, 665, 1552, 673, 1570, 674, 1572, 671, 1566, 675, 1575, 678, 1582, 676, 1577, 679, 1584, 672, 1567, 681, 1588, 682, 1590, 683, 1593, 676, 1576, 684, 1597, 682, 1591}, + {423, 988, 653, 1524, 665, 1552, 672, 1569, 661, 1542, 659, 1537, 662, 1544, 662, 1544, 668, 1560, 659, 1537, 663, 1547, 669, 1562, 665, 1552, 672, 1569, 668, 1559, 663, 1547, 668, 1559, 666, 1553, 666, 1554, 673, 1570, 674, 1572, 671, 1566, 676, 1578, 704, 1642, 675, 1576, 679, 1584, 671, 1565, 681, 1589, 681, 1590, 682, 1591, 676, 1577, 684, 1596, 680, 1586}, + {611, 1426, 666, 1553, 666, 1553, 672, 1569, 661, 1542, 659, 1537, 661, 1542, 662, 1545, 669, 1561, 659, 1537, 663, 1547, 696, 1623, 665, 1552, 673, 1570, 669, 1560, 663, 1547, 668, 1558, 666, 1553, 665, 1552, 673, 1570, 673, 1569, 671, 1566, 675, 1575, 679, 1584, 676, 1576, 679, 1585, 671, 1566, 680, 1588, 681, 1590, 682, 1592, 675, 1576, 685, 1598, 673, 1571}, + {667, 1556, 665, 1552, 665, 1551, 672, 1567, 660, 1539, 657, 1534, 661, 1541, 661, 1542, 668, 1558, 658, 1535, 662, 1546, 669, 1561, 664, 1549, 671, 1567, 667, 1557, 662, 1545, 667, 1556, 665, 1553, 664, 1550, 672, 1568, 673, 1570, 670, 1564, 675, 1575, 678, 1581, 675, 1575, 705, 1645, 670, 1563, 680, 1586, 681, 1589, 682, 1591, 675, 1574, 683, 1594, 679, 1584}, + {667, 1556, 665, 1552, 665, 1552, 672, 1569, 661, 1542, 658, 1535, 660, 1541, 662, 1545, 668, 1558, 658, 1536, 663, 1547, 670, 1563, 665, 1551, 672, 1569, 668, 1559, 663, 1547, 667, 1556, 666, 1555, 691, 1612, 672, 1569, 674, 1573, 671, 1566, 675, 1576, 678, 1582, 675, 1576, 679, 1583, 671, 1566, 680, 1588, 682, 1591, 682, 1592, 675, 1575, 684, 1596, 678, 1581}, + {669, 1562, 667, 1556, 666, 1553, 673, 1570, 661, 1543, 659, 1537, 662, 1544, 663, 1548, 669, 1560, 659, 1539, 689, 1608, 671, 1565, 665, 1552, 673, 1570, 670, 1562, 665, 1551, 669, 1562, 668, 1558, 666, 1555, 675, 1575, 676, 1577, 674, 1572, 678, 1581, 681, 1590, 678, 1583, 683, 1594, 675, 1575, 686, 1600, 688, 1606, 688, 1606, 682, 1591, 692, 1614, 687, 1602}, + {673, 1570, 668, 1558, 668, 1558, 674, 1573, 663, 1547, 661, 1542, 664, 1550, 690, 1611, 673, 1570, 663, 1547, 668, 1558, 674, 1572, 668, 1558, 677, 1579, 673, 1569, 667, 1557, 672, 1568, 670, 1564, 669, 1562, 677, 1581, 679, 1584, 675, 1576, 680, 1587, 683, 1593, 679, 1585, 684, 1595, 675, 1576, 686, 1601, 688, 1606, 688, 1606, 682, 1591, 692, 1614, 687, 1603}, + {667, 1556, 671, 1565, 670, 1562, 676, 1577, 664, 1550, 663, 1547, 689, 1608, 667, 1556, 673, 1569, 662, 1546, 667, 1557, 674, 1573, 668, 1559, 677, 1579, 673, 1569, 668, 1558, 672, 1569, 671, 1566, 670, 1564, 678, 1582, 679, 1583, 676, 1577, 680, 1588, 684, 1596, 681, 1588, 685, 1598, 677, 1579, 688, 1604, 689, 1608, 689, 1609, 683, 1594, 693, 1618, 685, 1599}, + {582, 1359, 678, 1583, 684, 1596, 686, 1600, 671, 1567, 666, 1555, 667, 1557, 666, 1554, 671, 1566, 659, 1538, 663, 1548, 668, 1560, 662, 1546, 671, 1565, 690, 1610, 659, 1539, 663, 1548, 661, 1542, 660, 1540, 667, 1556, 668, 1558, 664, 1549, 668, 1559, 671, 1565, 667, 1556, 671, 1567, 663, 1547, 672, 1569, 674, 1574, 676, 1577, 671, 1565, 684, 1596, 658, 1535}, +} }; const int16_t baseline_cap_data[2][TX_NUMBER][RX_NUMBER*2] = diff --git a/drivers/input/touchscreen/synaptics_driver_s3320.c b/drivers/input/touchscreen/synaptics_driver_s3320.c index 35c1874e50cc..94d3ea8d14ab 100755 --- a/drivers/input/touchscreen/synaptics_driver_s3320.c +++ b/drivers/input/touchscreen/synaptics_driver_s3320.c @@ -361,6 +361,8 @@ static int synaptics_rmi4_i2c_write_word(struct i2c_client* client, unsigned char addr,unsigned short data); static int synaptics_mode_change(int mode); int tp_single_tap_en(struct synaptics_ts_data *ts, bool enable); +int opticalfp_irq_handler(struct fp_underscreen_info* tp_info); +int gf_opticalfp_irq_handler(int event); #ifdef TPD_USE_EINT static irqreturn_t synaptics_irq_thread_fn(int irq, void *dev_id); @@ -1219,6 +1221,7 @@ static int set_tp_info(struct synaptics_ts_data *ts, uint8_t up_down) tp_info.y = tp_infor[3]<<8|tp_infor[2]; tp_info.area_rate = tp_infor[5]<<8|tp_infor[4]; tp_info.touch_state = up_down; + opticalfp_irq_handler(&tp_info); return ret; } @@ -1267,6 +1270,7 @@ static void fp_detect(struct synaptics_ts_data *ts) ts->fp_up_down); /*update tp info*/ set_tp_info(ts, 1); + gf_opticalfp_irq_handler(1); need_reset = 0; break; case FINGER_UP: @@ -1277,6 +1281,7 @@ static void fp_detect(struct synaptics_ts_data *ts) ts->fp_up_down); /*update tp info*/ set_tp_info(ts, 0); + gf_opticalfp_irq_handler(0); if (ts->fp_aod_cnt > 0) need_reset = 1; not_getbase = 0; @@ -1452,6 +1457,7 @@ static void gesture_judge(struct synaptics_ts_data *ts) ts->fp_up_down); /*update tp info*/ set_tp_info(ts, 1); + gf_opticalfp_irq_handler(1); not_getbase = 1; need_reset = 0; } @@ -1467,6 +1473,7 @@ static void gesture_judge(struct synaptics_ts_data *ts) ts->fp_up_down); /*update tp info*/ set_tp_info(ts, 0); + gf_opticalfp_irq_handler(0); } gesture = UnkownGestrue; break; @@ -1555,7 +1562,6 @@ static void gesture_judge(struct synaptics_ts_data *ts) input_report_key(ts->input_dev, keyCode, 0); input_sync(ts->input_dev); }else{ - mutex_lock(&ts->mutex); ret = i2c_smbus_read_i2c_block_data( ts->client, F12_2D_CTRL20, 3, &(reportbuf[0x0]) ); ret = reportbuf[2] & 0x20; if(ret == 0) @@ -1563,7 +1569,6 @@ static void gesture_judge(struct synaptics_ts_data *ts) ret = i2c_smbus_write_i2c_block_data( ts->client, F12_2D_CTRL20, 3, &(reportbuf[0x0]) ); //enable gesture if (ret < 0) TPD_ERR("%s :Failed to write report buffer\n", __func__); - mutex_unlock(&ts->mutex); } TPD_DEBUG("%s end!\n", __func__); } @@ -1805,7 +1810,9 @@ void int_touch(void) #ifdef SUPPORT_GESTURE if (ts->in_gesture_mode == 1 && ts->is_suspended == 1) { + mutex_lock(&ts->mutex); gesture_judge(ts); + mutex_unlock(&ts->mutex); } #endif @@ -4006,7 +4013,9 @@ static ssize_t tp_gesture_touch_hold_store(struct device *dev, { int tmp = 0; int touch_hold_enable = 0; + int touchhold_tmp = 0; int ret = 0; + int touch_hold_retry = 0; struct synaptics_ts_data *ts = dev_get_drvdata(dev); ret = kstrtoint(buf, 10, &tmp); @@ -4029,27 +4038,43 @@ static ssize_t tp_gesture_touch_hold_store(struct device *dev, mutex_lock(&ts->mutex); /* SYNA_F51_CUSTOM_CTRL20_00 0x0428*/ - ret = synaptics_rmi4_i2c_write_byte(ts->client, 0xff, 0x04); - if (ret < 0) - TPD_ERR("%s: set page 0x04 fail!\n", __func__); - touch_hold_enable = i2c_smbus_read_byte_data(ts->client, 0x2c); - - if (tmp == 1) { - touch_hold_enable = touch_hold_enable | 0x01; - ts->en_up_down = 1; - } else if (tmp == 0) { - touch_hold_enable = touch_hold_enable & 0xfe; - ts->en_up_down = 0; - } + while (1) { + if((tmp != 1) && (tmp != 0)) + break; + touch_hold_retry ++; + ret = synaptics_rmi4_i2c_write_byte(ts->client, + 0xff, 0x04); + if (ret < 0) + TPD_ERR("set page first fail!\n"); - ret = synaptics_rmi4_i2c_write_byte(ts->client, - 0x2c, touch_hold_enable); - if (ret < 0) - TPD_ERR("%s: set reg fail!\n", __func__); + touch_hold_enable = i2c_smbus_read_byte_data(ts->client, 0x2c); + TPDTM_DMESG("%s:read reg 0x%x\n", + __func__, touch_hold_enable); - ret = synaptics_rmi4_i2c_write_byte(ts->client, 0xff, 0x00); - if (ret < 0) - TPD_ERR("%s: set page 00 fail!\n", __func__); + if (tmp == 1) { + touch_hold_enable = touch_hold_enable | 0x01; + ts->en_up_down = 1; + } else if (tmp == 0) { + touch_hold_enable = touch_hold_enable & 0xfe; + ts->en_up_down = 0; + } + ret = synaptics_rmi4_i2c_write_byte(ts->client, + 0x2c, touch_hold_enable); + if (ret < 0) + TPD_ERR("set first fail!\n"); + touchhold_tmp = i2c_smbus_read_byte_data(ts->client, 0x2c); + TPDTM_DMESG("%s:read reg again 0x%x,0x%x,%d\n", __func__, + touch_hold_enable, touchhold_tmp, touch_hold_retry); + ret = synaptics_rmi4_i2c_write_byte(ts->client, + 0xff, 0x00); + if (ret < 0) + TPD_ERR("set page 00 fail!\n"); + if (touch_hold_enable == touchhold_tmp) + break; + if (touch_hold_retry == 5) + break; + msleep(10); + } mutex_unlock(&ts->mutex); return size; @@ -6383,9 +6408,6 @@ static int msm_drm_notifier_callback( if (event != MSM_DRM_EARLY_EVENT_BLANK && MSM_DRM_EVENT_BLANK != event) return 0; - /*add for morgan for EID447*/ - if (evdata->id != MSM_DRM_PRIMARY_DISPLAY) - return 0; if ((evdata) && (evdata->data) && (ts) && (ts->client)) { blank = evdata->data; TPD_ERR("%s blank[%d],event[0x%lx],evdata->id[%d]\n", @@ -6422,6 +6444,7 @@ static int msm_drm_notifier_callback( event == MSM_DRM_EVENT_BLANK && ts->fp_aod_cnt > 0) { set_tp_info(ts, 0); + gf_opticalfp_irq_handler(0); } } return 0; diff --git a/drivers/media/platform/msm/camera/cam_core/cam_node.c b/drivers/media/platform/msm/camera/cam_core/cam_node.c index 4e9034e2a76a..7e5b3ca2fd81 100644 --- a/drivers/media/platform/msm/camera/cam_core/cam_node.c +++ b/drivers/media/platform/msm/camera/cam_core/cam_node.c @@ -63,7 +63,8 @@ static int __cam_node_handle_query_cap(struct cam_node *node, return rc; } - +static uint64_t LrmeaRequreCount = 0; +static uint64_t LrmeaReleaseCount = 0; static int __cam_node_handle_acquire_dev(struct cam_node *node, struct cam_acquire_dev_cmd *acquire) { @@ -72,10 +73,15 @@ static int __cam_node_handle_acquire_dev(struct cam_node *node, if (!acquire) return -EINVAL; - + if (!strcmp(node->name, "cam-lrme")){ + CAM_ERR(CAM_CORE, "Acquire device for node %s session_handle =%d, %lld", + node->name,acquire->session_handle, ++LrmeaRequreCount); + } ctx = cam_node_get_ctxt_from_free_list(node); if (!ctx) { rc = -ENOMEM; + if (!strcmp(node->name, "cam-lrme")) + CAM_ERR(CAM_CORE, "Can not get context for node %s", node->name); goto err; } @@ -243,7 +249,10 @@ static int __cam_node_handle_release_dev(struct cam_node *node, CAM_ERR(CAM_CORE, "Invalid session handle for context"); return -EINVAL; } - + if (!strcmp(node->name, "cam-lrme")){ + CAM_ERR(CAM_CORE, "cam_node_handle_release_dev %d,node %s, %lld", + release->dev_handle, node->name,++LrmeaReleaseCount); + } ctx = (struct cam_context *)cam_get_device_priv(release->dev_handle); if (!ctx) { CAM_ERR(CAM_CORE, "Can not get context for handle %d node %s", diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/hw_utils/irq_controller/cam_irq_controller.c b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/hw_utils/irq_controller/cam_irq_controller.c index f41f0cdff490..ee61c1584b2b 100644 --- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/hw_utils/irq_controller/cam_irq_controller.c +++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/hw_utils/irq_controller/cam_irq_controller.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "cam_io_util.h" #include "cam_irq_controller.h" #include "cam_debug_util.h" @@ -598,7 +599,7 @@ static void cam_irq_controller_th_processing( if (irq_bh_api->get_bh_payload_func) { if (irq_bh_api->get_bh_payload_func( evt_handler->bottom_half, &bh_cmd)) { - CAM_ERR(CAM_ISP, "Can't get bh payload"); + CAM_ERR_RATE_LIMIT(CAM_ISP, "Can't get bh payload"); continue; } } diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor/cam_sensor_core.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor/cam_sensor_core.c index 87082ac7ed73..a0aef5b9a6fa 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor/cam_sensor_core.c +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor/cam_sensor_core.c @@ -481,6 +481,32 @@ int32_t cam_sensor_update_slave_info(struct cam_cmd_probe *probe_info, return rc; } +int32_t cam_sensor_update_id_info(struct cam_cmd_probe *probe_info, + struct cam_sensor_ctrl_t *s_ctrl) +{ + int32_t rc = 0; + + s_ctrl->sensordata->id_info.sensor_slave_addr = + probe_info->reserved; + s_ctrl->sensordata->id_info.sensor_id_reg_addr = + probe_info->reg_addr; + s_ctrl->sensordata->id_info.sensor_id_mask = + probe_info->data_mask; + s_ctrl->sensordata->id_info.sensor_id = + probe_info->expected_data; + s_ctrl->sensordata->id_info.sensor_addr_type = + probe_info->addr_type; + s_ctrl->sensordata->id_info.sensor_data_type = + probe_info->data_type; + + CAM_ERR(CAM_SENSOR, + "Sensor Addr: 0x%x sensor_id: 0x%x sensor_mask: 0x%x", + s_ctrl->sensordata->id_info.sensor_id_reg_addr, + s_ctrl->sensordata->id_info.sensor_id, + s_ctrl->sensordata->id_info.sensor_id_mask); + return rc; +} + int32_t cam_handle_cmd_buffers_for_probe(void *cmd_buf, struct cam_sensor_ctrl_t *s_ctrl, int32_t cmd_buf_num, int cmd_buf_length) @@ -505,6 +531,13 @@ int32_t cam_handle_cmd_buffers_for_probe(void *cmd_buf, CAM_ERR(CAM_SENSOR, "Updating the slave Info"); return rc; } + probe_info = (struct cam_cmd_probe *) + (cmd_buf + sizeof(struct cam_cmd_i2c_info) + sizeof(struct cam_cmd_probe)); + rc = cam_sensor_update_id_info(probe_info, s_ctrl); + if (rc < 0) { + CAM_ERR(CAM_SENSOR, "Updating the id Info"); + return rc; + } cmd_buf = probe_info; } break; @@ -661,6 +694,10 @@ int cam_sensor_match_id(struct cam_sensor_ctrl_t *s_ctrl) uint32_t chipid = 0; uint32_t sensor_version = 0; uint16_t sensor_version_reg = 0x0018; + uint16_t sensor_slave_addr = 0; + uint32_t id = 0; + uint32_t id_l = 0; + uint32_t id_h = 0; struct cam_camera_slave_info *slave_info; slave_info = &(s_ctrl->sensordata->slave_info); @@ -671,6 +708,31 @@ int cam_sensor_match_id(struct cam_sensor_ctrl_t *s_ctrl) return -EINVAL; } + if (((s_ctrl->sensordata->id_info.sensor_id_reg_addr & 0xFFFF) != 0) && ((s_ctrl->sensordata->id_info.sensor_id_reg_addr >> 16) != 0)) { + sensor_slave_addr = s_ctrl->io_master_info.cci_client->sid; + s_ctrl->io_master_info.cci_client->sid = s_ctrl->sensordata->id_info.sensor_slave_addr >> 1; + rc = camera_io_dev_read( + &(s_ctrl->io_master_info), + s_ctrl->sensordata->id_info.sensor_id_reg_addr & 0xFFFF, + &id_l, s_ctrl->sensordata->id_info.sensor_addr_type, + s_ctrl->sensordata->id_info.sensor_data_type); + rc = camera_io_dev_read( + &(s_ctrl->io_master_info), + s_ctrl->sensordata->id_info.sensor_id_reg_addr >> 16, + &id_h, s_ctrl->sensordata->id_info.sensor_addr_type, + s_ctrl->sensordata->id_info.sensor_data_type); + s_ctrl->io_master_info.cci_client->sid = sensor_slave_addr; + id = (id_h << 8) | id_l; + if (s_ctrl->sensordata->id_info.sensor_id != id) { + CAM_ERR(CAM_SENSOR, "sensor id 0x%x does not match 0x%x", id, s_ctrl->sensordata->id_info.sensor_id); + return -ENODEV; + } else { + CAM_ERR(CAM_SENSOR, "sensor id 0x%x matched", id); + } + } else { + CAM_ERR(CAM_SENSOR, "sensor id register is 0x%x", s_ctrl->sensordata->id_info.sensor_id_reg_addr); + } + rc = camera_io_dev_read( &(s_ctrl->io_master_info), slave_info->sensor_id_reg_addr, diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor_utils/cam_sensor_cmn_header.h b/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor_utils/cam_sensor_cmn_header.h index 81db963a855e..1047a170ab68 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor_utils/cam_sensor_cmn_header.h +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_sensor_utils/cam_sensor_cmn_header.h @@ -309,6 +309,15 @@ struct cam_camera_slave_info { uint16_t sensor_id_mask; }; +struct cam_camera_id_info { + uint16_t sensor_slave_addr; + uint16_t sensor_id_mask; + uint32_t sensor_id_reg_addr; + uint32_t sensor_id; + uint8_t sensor_addr_type; + uint8_t sensor_data_type; +}; + struct msm_sensor_init_params { int modes_supported; unsigned int sensor_mount_angle; @@ -344,6 +353,7 @@ struct cam_sensor_power_setting { struct cam_sensor_board_info { struct cam_camera_slave_info slave_info; + struct cam_camera_id_info id_info; int32_t sensor_mount_angle; int32_t secure_mode; int modes_supported; diff --git a/drivers/media/platform/msm/vidc/msm_vidc_debug.h b/drivers/media/platform/msm/vidc/msm_vidc_debug.h index dbebe5dbd8b0..a7ca8d903f1e 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_debug.h +++ b/drivers/media/platform/msm/vidc/msm_vidc_debug.h @@ -104,9 +104,6 @@ extern bool msm_vidc_syscache_disable; VIDC_MSG_PRIO2STRING(__level), \ ## arg); \ } else if (msm_vidc_debug_out == VIDC_OUT_FTRACE) { \ - trace_printk(KERN_DEBUG VIDC_DBG_TAG __fmt, \ - VIDC_MSG_PRIO2STRING(__level), \ - ## arg); \ } \ } \ } while (0) diff --git a/drivers/net/ppp/pppolac.c b/drivers/net/ppp/pppolac.c index 3a45cf805288..eb166ab26514 100644 --- a/drivers/net/ppp/pppolac.c +++ b/drivers/net/ppp/pppolac.c @@ -83,7 +83,7 @@ static int pppolac_recv_core(struct sock *sk_udp, struct sk_buff *skb) /* Put it back if it is a control packet. */ if (skb->data[sizeof(struct udphdr)] & L2TP_CONTROL_BIT) - return opt->backlog_rcv(sk_udp, skb); + return 2; /* Skip UDP header. */ skb_pull(skb, sizeof(struct udphdr)); @@ -190,9 +190,11 @@ static int pppolac_recv_core(struct sock *sk_udp, struct sk_buff *skb) static int pppolac_recv(struct sock *sk_udp, struct sk_buff *skb) { - sock_hold(sk_udp); - sk_receive_skb(sk_udp, skb, 0); - return 0; + int retval; + + sock_hold(sk_udp); + retval = sk_receive_skb(sk_udp, skb, 0); + return (retval >> 1); } static struct sk_buff_head delivery_queue; diff --git a/drivers/nfc/pn5xx.c b/drivers/nfc/pn5xx.c index 91e8ea887e38..0a0a7362eca8 100755 --- a/drivers/nfc/pn5xx.c +++ b/drivers/nfc/pn5xx.c @@ -78,6 +78,7 @@ #define MAX_SECURE_SESSIONS 1 /* Macro added to disable SVDD power toggling */ /* #define JCOP_4X_VALIDATION */ +#define WAKEUP_SRC_TIMEOUT 5000 struct pn544_dev { wait_queue_head_t read_wq; @@ -130,7 +131,7 @@ static void pn544_disable_irq(struct pn544_dev *pn544_dev) spin_lock_irqsave(&pn544_dev->irq_enabled_lock, flags); if (pn544_dev->irq_enabled) { disable_irq_nosync(pn544_dev->client->irq); - disable_irq_wake(pn544_dev->client->irq); + //disable_irq_wake(pn544_dev->client->irq); pn544_dev->irq_enabled = false; } spin_unlock_irqrestore(&pn544_dev->irq_enabled_lock, flags); @@ -140,6 +141,10 @@ static irqreturn_t pn544_dev_irq_handler(int irq, void *dev_id) { struct pn544_dev *pn544_dev = dev_id; + if (device_may_wakeup(&pn544_dev->client->dev)) { + pm_wakeup_event(&pn544_dev->client->dev, WAKEUP_SRC_TIMEOUT); + } + pn544_disable_irq(pn544_dev); /* HiKey Compilation fix */ #ifndef HiKey_620_COMPILATION_FIX @@ -181,7 +186,7 @@ static ssize_t pn544_dev_read(struct file *filp, char __user *buf, while (1) { pn544_dev->irq_enabled = true; enable_irq(pn544_dev->client->irq); - enable_irq_wake(pn544_dev->client->irq); + //enable_irq_wake(pn544_dev->client->irq); ret = wait_event_interruptible( pn544_dev->read_wq, !pn544_dev->irq_enabled); @@ -1276,6 +1281,8 @@ static int pn544_probe(struct i2c_client *client, goto err_request_irq_failed; } enable_irq_wake(pn544_dev->client->irq); + device_init_wakeup(&client->dev, true); + device_set_wakeup_capable(&client->dev, true); pn544_disable_irq(pn544_dev); i2c_set_clientdata(client, pn544_dev); #if HWINFO @@ -1331,6 +1338,28 @@ static int pn544_remove(struct i2c_client *client) return 0; } +static int pn544_suspend(struct device *device) +{ + struct i2c_client *client = to_i2c_client(device); + pn544_dev = i2c_get_clientdata(client); + + if (pn544_dev->nfc_ven_enabled && gpio_get_value(pn544_dev->irq_gpio)) { + pm_wakeup_event(&pn544_dev->client->dev, WAKEUP_SRC_TIMEOUT); + return -1; + } + + return 0; +} + +static int pn544_resume(struct device *device) +{ + return 0; +} + +static const struct dev_pm_ops nfc_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pn544_suspend, pn544_resume) +}; + static const struct i2c_device_id pn544_id[] = { { "pn544", 0 }, { } @@ -1349,6 +1378,7 @@ static struct i2c_driver pn544_driver = { .owner = THIS_MODULE, .name = "pn544", .of_match_table = pn544_i2c_dt_match, + .pm = &nfc_pm_ops, }, }; #if HWINFO @@ -1431,7 +1461,7 @@ static void check_hw_info() { * */ pn544_dev->irq_enabled = true; enable_irq(pn544_dev->client->irq); - enable_irq_wake(pn544_dev->client->irq); + //enable_irq_wake(pn544_dev->client->irq); ret = wait_event_interruptible( pn544_dev->read_wq, !pn544_dev->irq_enabled); diff --git a/drivers/power/supply/qcom/qpnp-smb2.c b/drivers/power/supply/qcom/qpnp-smb2.c index 93f3566699dd..fdee4b5b43e0 100755 --- a/drivers/power/supply/qcom/qpnp-smb2.c +++ b/drivers/power/supply/qcom/qpnp-smb2.c @@ -2712,7 +2712,13 @@ static void request_plug_irq(struct smb_charger *chip) __func__); vote(chip->otg_toggle_votable, HW_DETECT_VOTER, 1, 0); chip->hw_detect = 1; - } + chip->pre_cable_pluged = 1; + + ret = plugin_update(chip); + pr_info("%s:hw_detect=%d and report rc: %d\n", + __func__, chip->hw_detect, ret); + } else + chip->pre_cable_pluged = 0; } void requset_vbus_ctrl_gpio(struct smb_charger *chg) diff --git a/drivers/power/supply/qcom/smb-lib.c b/drivers/power/supply/qcom/smb-lib.c index 987a0c4a9b27..4b91c0e228f4 100644 --- a/drivers/power/supply/qcom/smb-lib.c +++ b/drivers/power/supply/qcom/smb-lib.c @@ -5005,7 +5005,12 @@ static void smblib_handle_typec_cc_state_change(struct smb_charger *chg) smblib_dbg(chg, PR_MISC, "TypeC removal\n"); smblib_handle_typec_removal(chg); } - + /* if audio adapter connectted,do not set ICL 0*/ + if (audio_adapter_flag) { + smblib_dbg(chg, PR_INTERRUPT, "IRQ: cc-state-change; Type-C %s detected\n", + smblib_typec_mode_name[chg->typec_mode]); + return; + } /* suspend usb if sink */ if ((chg->typec_status[3] & UFP_DFP_MODE_STATUS_BIT) && chg->typec_present) @@ -6176,7 +6181,9 @@ int get_prop_batt_status(struct smb_charger *chg) batt_status = 0; else batt_status = pval.intval; - + if (batt_status == POWER_SUPPLY_STATUS_FULL + && !(chg->chg_done || chg->recharge_status)) + return POWER_SUPPLY_STATUS_CHARGING; return batt_status; } @@ -7092,15 +7099,28 @@ void aging_test_check_aicl(struct smb_charger *chg) } } +int plugin_update(struct smb_charger *chg) +{ + int rc = 0; + char *connected_str[2] = { "USBCable=CONNECTED", NULL}; + char *disconnected_str[2] = { "USBCable=DISCONNECTED", NULL}; + + rc = kobject_uevent_env(&chg->dev->kobj, KOBJ_CHANGE, + chg->hw_detect ? connected_str : disconnected_str); + + return rc; +} + + static void op_otg_switch(struct work_struct *work) { - bool usb_pluged; - static bool pre_usb_pluged; + int usb_pluged; + int rc = 0; if (!g_chg) return; - usb_pluged = gpio_get_value(g_chg->plug_irq) ? false : true; - if (usb_pluged == pre_usb_pluged) { + usb_pluged = gpio_get_value(g_chg->plug_irq) ? 0 : 1; + if (usb_pluged == g_chg->pre_cable_pluged) { pr_info("same status,return;usb_present:%d\n", usb_pluged); return; } @@ -7112,8 +7132,10 @@ static void op_otg_switch(struct work_struct *work) vote(g_chg->otg_toggle_votable, HW_DETECT_VOTER, 0, 0); g_chg->hw_detect = 0; } - pr_info("%s:hw_detect=%d\n", __func__, g_chg->hw_detect); - pre_usb_pluged = usb_pluged; + rc = plugin_update(g_chg); + pr_info("%s:hw_detect=%d and report rc: %d\n", + __func__, g_chg->hw_detect, rc); + g_chg->pre_cable_pluged = usb_pluged; } static int get_usb_temp(struct smb_charger *chg) diff --git a/drivers/power/supply/qcom/smb-lib.h b/drivers/power/supply/qcom/smb-lib.h index cd9d46ca6671..86d23d8b99ff 100644 --- a/drivers/power/supply/qcom/smb-lib.h +++ b/drivers/power/supply/qcom/smb-lib.h @@ -384,8 +384,9 @@ struct smb_charger { int op_icl_val; int plug_irq; int sw_iterm_ma; + int pre_cable_pluged; + int hw_detect; bool otg_switch; - bool hw_detect; bool use_fake_chgvol; bool use_fake_temp; bool use_fake_protect_sts; @@ -603,6 +604,7 @@ bool get_prop_fastchg_status(struct smb_charger *chg); int op_usb_icl_set(struct smb_charger *chg, int icl_ua); int op_get_aicl_result(struct smb_charger *chg); void op_disconnect_vbus(struct smb_charger *chg, bool enable); +int plugin_update(struct smb_charger *chg); int smblib_set_prop_input_current_limited(struct smb_charger *chg, const union power_supply_propval *val); diff --git a/drivers/soc/qcom/msm_bus/msm_bus_fabric_rpmh.c b/drivers/soc/qcom/msm_bus/msm_bus_fabric_rpmh.c index 5a28e982925a..dd7544a53bdb 100644 --- a/drivers/soc/qcom/msm_bus/msm_bus_fabric_rpmh.c +++ b/drivers/soc/qcom/msm_bus/msm_bus_fabric_rpmh.c @@ -78,13 +78,6 @@ ssize_t bw_show(struct device *dev, struct device_attribute *attr, bus_node->lnode_list[i].lnode_ab[ACTIVE_CTX], bus_node->lnode_list[i].lnode_ib[DUAL_CTX], bus_node->lnode_list[i].lnode_ab[DUAL_CTX]); - trace_printk( - "[%d]:%s:Act_IB %llu Act_AB %llu Slp_IB %llu Slp_AB %llu\n", - i, bus_node->lnode_list[i].cl_name, - bus_node->lnode_list[i].lnode_ib[ACTIVE_CTX], - bus_node->lnode_list[i].lnode_ab[ACTIVE_CTX], - bus_node->lnode_list[i].lnode_ib[DUAL_CTX], - bus_node->lnode_list[i].lnode_ab[DUAL_CTX]); } off += scnprintf((buf + off), PAGE_SIZE, "Max_Act_IB %llu Sum_Act_AB %llu Act_Util_fact %d Act_Vrail_comp %d\n", @@ -98,18 +91,6 @@ ssize_t bw_show(struct device *dev, struct device_attribute *attr, bus_node->node_bw[DUAL_CTX].sum_ab, bus_node->node_bw[DUAL_CTX].util_used, bus_node->node_bw[DUAL_CTX].vrail_used); - trace_printk( - "Max_Act_IB %llu Sum_Act_AB %llu Act_Util_fact %d Act_Vrail_comp %d\n", - bus_node->node_bw[ACTIVE_CTX].max_ib, - bus_node->node_bw[ACTIVE_CTX].sum_ab, - bus_node->node_bw[ACTIVE_CTX].util_used, - bus_node->node_bw[ACTIVE_CTX].vrail_used); - trace_printk( - "Max_Slp_IB %llu Sum_Slp_AB %lluSlp_Util_fact %d Slp_Vrail_comp %d\n", - bus_node->node_bw[DUAL_CTX].max_ib, - bus_node->node_bw[DUAL_CTX].sum_ab, - bus_node->node_bw[DUAL_CTX].util_used, - bus_node->node_bw[DUAL_CTX].vrail_used); return off; } diff --git a/drivers/soc/qcom/project_info.c b/drivers/soc/qcom/project_info.c index 6591f6119bc8..a1e7ff62c011 100644 --- a/drivers/soc/qcom/project_info.c +++ b/drivers/soc/qcom/project_info.c @@ -595,10 +595,30 @@ int __init init_project_info(void) project_info_desc->project_name, "DVT"); break; case 35: + snprintf(mainboard_version, sizeof(mainboard_version), "%s %s", + project_info_desc->project_name, "DVT2nd"); + break; + case 41: snprintf(mainboard_version, sizeof(mainboard_version), "%s %s", project_info_desc->project_name, "PVT"); break; - case 55: + case 42: + snprintf(mainboard_version, sizeof(mainboard_version), "%s %s", + project_info_desc->project_name, "PVT2nd"); + break; + case 43: + snprintf(mainboard_version, sizeof(mainboard_version), "%s %s", + project_info_desc->project_name, "PVT-1"); + break; + case 44: + snprintf(mainboard_version, sizeof(mainboard_version), "%s %s", + project_info_desc->project_name, "PVTSpec"); + break; + case 45: + snprintf(mainboard_version, sizeof(mainboard_version), "%s %s", + project_info_desc->project_name, "MPSpec"); + break; + case 55: snprintf(mainboard_version, sizeof(mainboard_version), "%s %s", project_info_desc->project_name, "DVTUSB30"); break; @@ -623,22 +643,23 @@ int __init init_project_info(void) } snprintf(rf_version, sizeof(rf_version), " %d",project_info_desc->rf_v1); - push_component_info(RF_VERSION, rf_version, mainboard_manufacture); - - get_ddr_manufacture_name(); - - if (totalram_pages > 6*(1<<18)) - ddr_size = 8; - else if (totalram_pages > 5*(1<<18)) - ddr_size = 6; - else if (totalram_pages > 4*(1<<18)) - ddr_size = 5; - else if (totalram_pages > 3*(1<<18)) - ddr_size = 4; - else if (totalram_pages > 2*(1<<18)) - ddr_size = 3; - else if (totalram_pages > 1*(1<<18)) - ddr_size = 2; + push_component_info(RF_VERSION, rf_version, mainboard_manufacture); + + get_ddr_manufacture_name(); + if (totalram_pages > 9*(1<<18)) + ddr_size = 10; + else if (totalram_pages > 6*(1<<18)) + ddr_size = 8; + else if (totalram_pages > 5*(1<<18)) + ddr_size = 6; + else if (totalram_pages > 4*(1<<18)) + ddr_size = 5; + else if (totalram_pages > 3*(1<<18)) + ddr_size = 4; + else if (totalram_pages > 2*(1<<18)) + ddr_size = 3; + else if (totalram_pages > 1*(1<<18)) + ddr_size = 2; snprintf(ddr_version, sizeof(ddr_version), "size_%dG_r_%d_c_%d", ddr_size, project_info_desc->ddr_row, diff --git a/drivers/soc/qcom/secure_buffer.c b/drivers/soc/qcom/secure_buffer.c index 1c8bc5112256..f1d1d7a49c94 100644 --- a/drivers/soc/qcom/secure_buffer.c +++ b/drivers/soc/qcom/secure_buffer.c @@ -142,7 +142,8 @@ static int secure_buffer_change_table(struct sg_table *table, int lock) * secure environment to ensure the data is actually present * in RAM */ - dmac_flush_range(chunk_list, chunk_list + chunk_list_len); + dmac_flush_range(chunk_list, + (void *)chunk_list + chunk_list_len); ret = secure_buffer_change_chunk(chunk_list_phys, nchunks, V2_CHUNK_SIZE, lock); diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c index 22884ae953ad..06c56c3c4901 100644 --- a/drivers/spi/spi-geni-qcom.c +++ b/drivers/spi/spi-geni-qcom.c @@ -28,7 +28,8 @@ #define SPI_NUM_CHIPSELECT (4) #define SPI_XFER_TIMEOUT_MS (250) -#define SPI_AUTO_SUSPEND_DELAY (250) +/* Change suspend delay to avoid eSE lock issue */ +#define SPI_AUTO_SUSPEND_DELAY (50) /* SPI SE specific registers */ #define SE_SPI_CPHA (0x224) #define SE_SPI_LOOPBACK (0x22C) @@ -1391,6 +1392,8 @@ static int spi_geni_probe(struct platform_device *pdev) goto spi_geni_probe_err; } + pinctrl_select_state(rsc->geni_pinctrl, rsc->geni_gpio_sleep); + rsc->se_clk = devm_clk_get(&pdev->dev, "se-clk"); if (IS_ERR(rsc->se_clk)) { ret = PTR_ERR(rsc->se_clk); diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 6e9eed1b6067..6327d787e97a 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -155,7 +155,7 @@ static int adjust_minadj(short *min_score_adj) return ret; } -static int batch_kill; +static int batch_kill = 1; module_param(batch_kill, int, 0644); MODULE_PARM_DESC(batch_kill, "lowmemorykiller kill more strategy"); @@ -471,7 +471,7 @@ static void mark_lmk_victim(struct task_struct *tsk) static bool selftest_running = false; static int selftest_min_score_adj = 906; -static int quick_select; +static int quick_select = 1; module_param(quick_select, int, 0644); MODULE_PARM_DESC(quick_select, "lowmemorykiller quick select task from adj chain"); @@ -927,6 +927,7 @@ static unsigned long lowmem_batch_kill( lowmem_print(1, "batch Killing '%s' (%d) (tgid %d), adj %hd,\n" "to free %ldkB on behalf of '%s' (%d) because\n" "cache %ldkB is below limit %ldkB for oom score %hd\n" + "uid_lru_list size %ld pages\n" "Free memory is %ldkB above reserved.\n" "Free CMA is %ldkB\n" "Total reserve is %ldkB\n" @@ -941,6 +942,7 @@ static unsigned long lowmem_batch_kill( current->comm, current->pid, cache_size, cache_limit, min_score_adj, + uid_lru_size(), free, global_page_state(NR_FREE_CMA_PAGES) * (long)(PAGE_SIZE / 1024), @@ -1002,8 +1004,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) batch_kill_init(bkws); - uid_lru_total = - uid_lru_size(mem_cgroup_lruvec(NODE_DATA(0), sc->memcg)); + uid_lru_total = uid_lru_size(); if (!mutex_trylock(&scan_mutex)) return 0; diff --git a/drivers/thermal/qpnp-adc-tm.c b/drivers/thermal/qpnp-adc-tm.c index 22d96e080688..f20caff17209 100644 --- a/drivers/thermal/qpnp-adc-tm.c +++ b/drivers/thermal/qpnp-adc-tm.c @@ -1889,7 +1889,6 @@ static void notify_adc_tm_fn(struct work_struct *work) { struct qpnp_adc_tm_sensor *adc_tm = container_of(work, struct qpnp_adc_tm_sensor, work); - struct qpnp_adc_tm_chip *chip = adc_tm->chip; if (adc_tm->thermal_node) { pr_debug("notifying uspace client\n"); @@ -1900,8 +1899,6 @@ static void notify_adc_tm_fn(struct work_struct *work) else notify_clients(adc_tm); } - - atomic_dec(&chip->wq_cnt); } static int qpnp_adc_tm_recalib_request_check(struct qpnp_adc_tm_chip *chip, @@ -2145,11 +2142,8 @@ static int qpnp_adc_tm_disable_rearm_high_thresholds( return rc; } - if (!queue_work(chip->sensor[sensor_num].req_wq, - &chip->sensor[sensor_num].work)) { - /* The item is already queued, reduce the count */ - atomic_dec(&chip->wq_cnt); - } + queue_work(chip->sensor[sensor_num].req_wq, + &chip->sensor[sensor_num].work); return rc; } @@ -2256,11 +2250,8 @@ static int qpnp_adc_tm_disable_rearm_low_thresholds( return rc; } - if (!queue_work(chip->sensor[sensor_num].req_wq, - &chip->sensor[sensor_num].work)) { - /* The item is already queued, reduce the count */ - atomic_dec(&chip->wq_cnt); - } + queue_work(chip->sensor[sensor_num].req_wq, + &chip->sensor[sensor_num].work); return rc; } @@ -2324,8 +2315,6 @@ static int qpnp_adc_tm_read_status(struct qpnp_adc_tm_chip *chip) fail: mutex_unlock(&chip->adc->adc_lock); - if (rc < 0) - atomic_dec(&chip->wq_cnt); return rc; } @@ -2378,10 +2367,6 @@ static int qpnp_adc_tm_hc_read_status(struct qpnp_adc_tm_chip *chip) fail: mutex_unlock(&chip->adc->adc_lock); - if (rc < 0 || (!chip->th_info.adc_tm_high_enable && - !chip->th_info.adc_tm_low_enable)) - atomic_dec(&chip->wq_cnt); - return rc; } @@ -2491,7 +2476,6 @@ static irqreturn_t qpnp_adc_tm_high_thr_isr(int irq, void *data) } } - atomic_inc(&chip->wq_cnt); queue_work(chip->high_thr_wq, &chip->trigger_high_thr_work); return IRQ_HANDLED; @@ -2600,7 +2584,6 @@ static irqreturn_t qpnp_adc_tm_low_thr_isr(int irq, void *data) } } - atomic_inc(&chip->wq_cnt); queue_work(chip->low_thr_wq, &chip->trigger_low_thr_work); return IRQ_HANDLED; @@ -2729,14 +2712,14 @@ static irqreturn_t qpnp_adc_tm_rc_thr_isr(int irq, void *data) } if (sensor_low_notify_num) { - if (queue_work(chip->low_thr_wq, &chip->trigger_low_thr_work)) - atomic_inc(&chip->wq_cnt); + pm_wakeup_event(chip->dev, 2000); + queue_work(chip->low_thr_wq, &chip->trigger_low_thr_work); } if (sensor_high_notify_num) { - if (queue_work(chip->high_thr_wq, - &chip->trigger_high_thr_work)) - atomic_inc(&chip->wq_cnt); + pm_wakeup_event(chip->dev, 2000); + queue_work(chip->high_thr_wq, + &chip->trigger_high_thr_work); } return IRQ_HANDLED; @@ -3225,7 +3208,6 @@ static int qpnp_adc_tm_probe(struct platform_device *pdev) INIT_WORK(&chip->trigger_high_thr_work, qpnp_adc_tm_high_thr_work); INIT_WORK(&chip->trigger_low_thr_work, qpnp_adc_tm_low_thr_work); - atomic_set(&chip->wq_cnt, 0); if (!chip->adc_tm_hc) { rc = qpnp_adc_tm_initial_setup(chip); @@ -3332,11 +3314,18 @@ static void qpnp_adc_tm_shutdown(struct platform_device *pdev) static int qpnp_adc_tm_suspend_noirq(struct device *dev) { struct qpnp_adc_tm_chip *chip = dev_get_drvdata(dev); + struct device_node *node = dev->of_node, *child; + int i = 0; + + flush_workqueue(chip->high_thr_wq); + flush_workqueue(chip->low_thr_wq); - if (atomic_read(&chip->wq_cnt) != 0) { - pr_err( - "Aborting suspend, adc_tm notification running while suspending\n"); - return -EBUSY; + for_each_child_of_node(node, child) { + if (chip->sensor[i].req_wq) { + pr_debug("flushing queue for sensor %d\n", i); + flush_workqueue(chip->sensor[i].req_wq); + } + i++; } return 0; } diff --git a/fs/proc/base.c b/fs/proc/base.c index 0d75ab112592..9b41e7c4f9a6 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -2585,6 +2585,21 @@ static ssize_t page_hot_count_read(struct file *file, char __user *buf, return simple_read_from_buffer(buf, count, ppos, buffer, len); } +static struct cgroup_subsys_state * +task_get_css_noretry(struct task_struct *task, int subsys_id) +{ + struct cgroup_subsys_state *css; + + rcu_read_lock(); + css = task_css(task, subsys_id); + if (unlikely(!css_tryget_online(css))) { + rcu_read_unlock(); + return NULL; + } + rcu_read_unlock(); + return css; +} + static ssize_t page_hot_count_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { @@ -2621,16 +2636,20 @@ static ssize_t page_hot_count_write(struct file *file, const char __user *buf, struct css_task_iter it; struct task_struct *tsk; struct cgroup_subsys_state *parent; + struct cgroup_subsys_state * css; - parent = task_get_css(task, cpuacct_cgrp_id)->parent; - rcu_read_lock(); - css_for_each_child(pos, parent) { - css_task_iter_start(&pos->cgroup->self, &it); - while ((tsk = css_task_iter_next(&it))) - tsk->hot_count = 0; - css_task_iter_end(&it); + css = task_get_css_noretry(task, cpuacct_cgrp_id); + if (css) { + parent = css->parent; + rcu_read_lock(); + css_for_each_child(pos, parent) { + css_task_iter_start(&pos->cgroup->self, &it); + while ((tsk = css_task_iter_next(&it))) + tsk->hot_count = 0; + css_task_iter_end(&it); + } + rcu_read_unlock(); } - rcu_read_unlock(); reclaim_pages_from_uid_list(uid); delete_prio_node(uid); } else { diff --git a/fs/sdcardfs/main.c b/fs/sdcardfs/main.c index 30e0c431a1ea..27ec726e7a46 100644 --- a/fs/sdcardfs/main.c +++ b/fs/sdcardfs/main.c @@ -295,6 +295,13 @@ static int sdcardfs_read_super(struct vfsmount *mnt, struct super_block *sb, atomic_inc(&lower_sb->s_active); sdcardfs_set_lower_super(sb, lower_sb); + sb->s_stack_depth = lower_sb->s_stack_depth + 1; + if (sb->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) { + pr_err("sdcardfs: maximum fs stacking depth exceeded\n"); + err = -EINVAL; + goto out_sput; + } + /* inherit maxbytes from lower file system */ sb->s_maxbytes = lower_sb->s_maxbytes; diff --git a/include/linux/swap.h b/include/linux/swap.h index eeaa21318c3d..863d14d1cf90 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -425,7 +425,8 @@ static inline long get_nr_swap_pages(void) } extern int sysctl_page_cache_reside_switch; -extern unsigned long uid_lru_size(struct lruvec *lruvec); +extern int sysctl_page_cache_reside_max; +extern unsigned long uid_lru_size(void); extern void uid_lru_cache_add(struct page *page); extern void _uid_lru_add_fn(struct page *page, struct lruvec *lruvec); extern struct uid_node *find_uid_node(uid_t uid, struct lruvec *lruvec); diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index 73b8444efc82..17b204908ef0 100644 --- a/kernel/cgroup_freezer.c +++ b/kernel/cgroup_freezer.c @@ -343,7 +343,7 @@ static void unfreeze_cgroup(struct freezer *freezer) /*make sure all the thread of one uid been wake up by huruihuan*/ read_lock(&tasklist_lock); do_each_thread(g, p) { - if (tmp_tsk && + if (tmp_tsk && tmp_tsk->real_cred && p->real_cred && p->real_cred->uid.val == tmp_tsk->real_cred->uid.val) __thaw_task(p); } while_each_thread(g, p); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a247c765da51..dbb52435093b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7249,7 +7249,7 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, target_cpu = best_idle_cpu; best_idle_cpu = -1; } - trace_printk("%s-%d target %d\n", p->comm, p->pid, target_cpu); + /* * For non latency sensitive tasks, cases B and C in the previous loop, * we pick the best IDLE CPU only if we was not able to find a target diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 7b0d0be9543c..149e3d8f46a2 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1412,6 +1412,14 @@ static struct ctl_table vm_table[] = { .extra1 = &zero, .extra2 = &two, }, + { + .procname = "page_cache_reside_max", + .data = &sysctl_page_cache_reside_max, + .maxlen = sizeof(sysctl_page_cache_reside_max), + .mode = 0666, + .proc_handler = proc_dointvec_minmax, + }, + { .procname = "oom_kill_allocating_task", diff --git a/mm/filemap.c b/mm/filemap.c index 2354139a6507..124cba8825ab 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -757,7 +757,8 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping, } else ClearPageActive(page); if (current->group_leader->hot_count > 0 && - sysctl_page_cache_reside_switch) + sysctl_page_cache_reside_switch && + uid_lru_size() < sysctl_page_cache_reside_max) uid_lru_cache_add(page); else lru_cache_add(page); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 0e49bd3affda..826e860ef760 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4467,7 +4467,8 @@ void show_free_areas(unsigned int filter) " unevictable:%lu dirty:%lu writeback:%lu unstable:%lu\n" " slab_reclaimable:%lu slab_unreclaimable:%lu\n" " mapped:%lu shmem:%lu pagetables:%lu bounce:%lu\n" - " free:%lu free_pcp:%lu free_cma:%lu\n", + " free:%lu free_pcp:%lu free_cma:%lu\n" + " ramboost:%lu\n", global_node_page_state(NR_ACTIVE_ANON), global_node_page_state(NR_INACTIVE_ANON), global_node_page_state(NR_ISOLATED_ANON), @@ -4486,7 +4487,8 @@ void show_free_areas(unsigned int filter) global_page_state(NR_BOUNCE), global_page_state(NR_FREE_PAGES), free_pcp, - global_page_state(NR_FREE_CMA_PAGES)); + global_page_state(NR_FREE_CMA_PAGES), + global_page_state(NR_ZONE_UID_LRU)); for_each_online_pgdat(pgdat) { printk("Node %d" @@ -4568,6 +4570,7 @@ void show_free_areas(unsigned int filter) " free_pcp:%lukB" " local_pcp:%ukB" " free_cma:%lukB" + " ramboost:%lukB" "\n", zone->name, K(zone_page_state(zone, NR_FREE_PAGES)), @@ -4590,7 +4593,8 @@ void show_free_areas(unsigned int filter) K(zone_page_state(zone, NR_BOUNCE)), K(free_pcp), K(this_cpu_read(zone->pageset->pcp.count)), - K(zone_page_state(zone, NR_FREE_CMA_PAGES))); + K(zone_page_state(zone, NR_FREE_CMA_PAGES)), + K(zone_page_state(zone, NR_ZONE_UID_LRU))); printk("lowmem_reserve[]:"); for (i = 0; i < MAX_NR_ZONES; i++) printk(KERN_CONT " %ld", zone->lowmem_reserve[i]); diff --git a/mm/vmscan.c b/mm/vmscan.c index 7aab4027873e..a09982098fa0 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -60,6 +60,7 @@ #include int sysctl_page_cache_reside_switch; +int sysctl_page_cache_reside_max = 153600; //600M unsigned long inactive_nr, active_nr; unsigned long vmpress[5]; unsigned long priority_nr[3]; @@ -2328,29 +2329,15 @@ static void move_active_pages_to_lru(struct lruvec *lruvec, __count_vm_events(PGDEACTIVATE, pgmoved); } -unsigned long uid_lru_size(struct lruvec *lruvec) +unsigned long uid_lru_size() { - unsigned long lru_size = 0; - int zid; - - for (zid = 1; zid < MAX_NR_ZONES; zid++) { - struct zone *zone = &lruvec_pgdat(lruvec)->node_zones[zid]; - - if (!managed_zone(zone)) - continue; - - lru_size += zone_page_state(&lruvec_pgdat(lruvec)->node_zones[zid], - NR_ZONE_UID_LRU); - } - - return lru_size; + return global_page_state(NR_ZONE_UID_LRU); } - static int active_list_is_low(struct lruvec *lruvec) { unsigned long active = lruvec_lru_size(lruvec, LRU_ACTIVE_FILE, MAX_NR_ZONES); unsigned long inactive = lruvec_lru_size(lruvec, LRU_INACTIVE_FILE, MAX_NR_ZONES); - unsigned long total_uid_lru_nr = uid_lru_size(lruvec); + unsigned long total_uid_lru_nr = uid_lru_size(); return ((active + inactive) << 1) < (total_uid_lru_nr >> 2); } @@ -2362,7 +2349,7 @@ static void shrink_uid_lru_list(struct lruvec *lruvec, LIST_HEAD(frees_list); unsigned long nr_reclaimed = 0, nr_isolate_failed = 0; unsigned long dummy1, dummy2, dummy3, dummy4, dummy5; - unsigned long uid_size = uid_lru_size(lruvec); + unsigned long uid_size = uid_lru_size(); long nr_to_shrink = sc->nr_to_reclaim<< 1; struct hotcount_prio_node *pos; struct page *page; @@ -2415,9 +2402,9 @@ static void shrink_uid_lru_list(struct lruvec *lruvec, } sc->nr_reclaimed += nr_reclaimed; - pr_err("%s: reclaimed:%lu isolate:%lu isolate_failed:%lu ", + /*pr_err("%s: reclaimed:%lu isolate:%lu isolate_failed:%lu ", __func__, nr_reclaimed, - sc->nr_to_reclaim << 1, nr_isolate_failed); + sc->nr_to_reclaim << 1, nr_isolate_failed);*/ } static void shrink_active_list(unsigned long nr_to_scan, struct lruvec *lruvec, diff --git a/net/wireless/db.txt b/net/wireless/db.txt index 4c6464b9b077..c3160eedda93 100644 --- a/net/wireless/db.txt +++ b/net/wireless/db.txt @@ -855,7 +855,7 @@ country MY: DFS-FCC (5170 - 5250 @ 80), (24), AUTO-BW (5250 - 5330 @ 80), (24), DFS, AUTO-BW (5490 - 5650 @ 160), (24), DFS - (5735 - 5815 @ 80), (24) + (5735 - 5835 @ 80), (24) # 60 gHz band channels 1-3 (57240 - 63720 @ 2160), (40)