diff --git a/aports/device/device-asus-flo/90-android-touch-dev.rules b/aports/device/device-asus-flo/90-android-touch-dev.rules index 6ed2e395..938dea98 100644 --- a/aports/device/device-asus-flo/90-android-touch-dev.rules +++ b/aports/device/device-asus-flo/90-android-touch-dev.rules @@ -1,6 +1,14 @@ # udev rules file # All device names can be read from weston's logfile (/tmp/weston.log in postmarketOS) -# Touchscreen (use 'weston-calibrator' to calibrate) +# Touchscreen +# default ENV{LIBINPUT_CALIBRATION_MATRIX}="1 0 0 0 1 0" +# Left - 90 degree clockwise ENV{LIBINPUT_CALIBRATION_MATRIX}="0 -1 1 1 0 0" +# 180 degree clockwise ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1" +# Right - 270 degree clockwise ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1" +# reflect along y axis ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 1 0 0" + SUBSYSTEM=="input", ATTRS{name}=="Elan Touchscreen", \ -ENV{ID_INPUT}="1", ENV{ID_INPUT_TOUCHSCREEN}="1" +ENV{ID_INPUT}="1", ENV{ID_INPUT_TOUCHSCREEN}="1", \ +ENV{LIBINPUT_CALIBRATION_MATRIX}="1 0 0 0 1 0" + diff --git a/aports/device/device-asus-flo/APKBUILD b/aports/device/device-asus-flo/APKBUILD index dd88023d..c895e66d 100644 --- a/aports/device/device-asus-flo/APKBUILD +++ b/aports/device/device-asus-flo/APKBUILD @@ -1,26 +1,29 @@ pkgname=device-asus-flo pkgver=0 -pkgrel=4 +pkgrel=5 pkgdesc="Google Nexus 7 2013 flo" url="https://github.com/postmarketOS" arch="noarch" license="MIT" -depends="linux-asus-flo mkbootimg firmware-asus-flo mesa mesa-dri-freedreno" +depends="linux-asus-flo mkbootimg firmware-asus-flo mesa mesa-egl mesa-dri-freedreno" makedepends="" install="" subpackages="" -source="deviceinfo 90-android-touch-dev.rules wpa_supplicant.conf" +source="deviceinfo 90-android-touch-dev.rules wpa_supplicant.conf pointercal" options="!check" package() { - install -D -m644 "$srcdir/deviceinfo" \ - "$pkgdir/etc/deviceinfo" - install -D -m644 "$srcdir/wpa_supplicant.conf" \ - "$pkgdir/etc/wpa_supplicant/wpa_supplicant.conf" - install -D -m644 "$srcdir/90-android-touch-dev.rules" \ - "$pkgdir/lib/udev/rules.d/90-android-touch-dev.rules" + install -D -m644 "$srcdir"/deviceinfo \ + "$pkgdir"/etc/deviceinfo + install -D -m644 "$srcdir"/wpa_supplicant.conf \ + "$pkgdir"/etc/wpa_supplicant/wpa_supplicant.conf + install -D -m644 "$srcdir"/90-android-touch-dev.rules \ + "$pkgdir"/etc/udev/rules.d/90-android-touch-dev.rules + install -D -m644 "$srcdir"/pointercal \ + "$pkgdir"/etc/pointercal } sha512sums="df489865a244af0d776897a5b13b609afbd6d3a28ed4e4c07ccfec5620379443cb6cea01807d74ab8a1c5d96e23dd64b8028a6954eea771aedc1b111509eaa8f deviceinfo -a02db4e1bdb622cc4616b750dc5c3248081f5124cc49ef18f25b430c921c80004eff9f6a9b84a76ce04785c256e71776ff90e0f60140e4cce6860ba8d80cf4d2 90-android-touch-dev.rules -3278921cc1617d10fdd13dfbeaf213cda0078d069e727acd8cfac10bd8ade6f373be1e22fd1e4b50ae71cd2eae09f7d6aad5de42338d9ea9f8c1a34f0b60cb69 wpa_supplicant.conf" +d175ff532edaebffd18b6e3ba8e9f5e627c737ba3350d10b51d08f8c6daf7f8b858c907a4cb30750517c6a6134969790e400653f132214123334189dd310be68 90-android-touch-dev.rules +3278921cc1617d10fdd13dfbeaf213cda0078d069e727acd8cfac10bd8ade6f373be1e22fd1e4b50ae71cd2eae09f7d6aad5de42338d9ea9f8c1a34f0b60cb69 wpa_supplicant.conf +cf913217b41a3dde8bc2a16a5bc82013c85679de0e81db1cfc36f2409ea034fec430082ddcb207c16746453601cf8381300b049cd2fb131f1916dc7dbcc247e3 pointercal" diff --git a/aports/device/device-asus-flo/pointercal b/aports/device/device-asus-flo/pointercal new file mode 100644 index 00000000..48e18ccd --- /dev/null +++ b/aports/device/device-asus-flo/pointercal @@ -0,0 +1 @@ +57486 105 31016 -393 54683 1214768 65536 1200 1920 diff --git a/aports/device/linux-asus-flo/00_Collapse_usb_support_into_one_node.patch b/aports/device/linux-asus-flo/00_Collapse_usb_support_into_one_node.patch new file mode 100644 index 00000000..704fc55a --- /dev/null +++ b/aports/device/linux-asus-flo/00_Collapse_usb_support_into_one_node.patch @@ -0,0 +1,491 @@ +author Stephen Boyd 2017-01-26 16:47:27 -0800 +committer John Stultz 2017-05-12 12:39:31 -0700 +commit 77b05751cbd9b5ebe9fa0a8ef9dd2277e978ee59 (patch) +tree a5481a707e6cd25a6f915fdec91b2cc0b5bfa22a +parent 733fde282f4cacf4163f74219af5787cbb01155a (diff) +download flo-77b05751cbd9b5ebe9fa0a8ef9dd2277e978ee59.tar.gz +ARM: dts: qcom-apq8064: Collapse usb support into one node +We currently have three device nodes for the same USB hardware +block, as evident by the reuse of the same reg address multiple +times. Now that the chipidea driver fully supports OTG with the +MSM wrapper we can collapse the three nodes into one USB device +node, reflecting the true nature of the hardware. + +Since we're here, we also mark the irq trigger flags correctly, +as IRQ_TYPE_LEVEL_HIGH instead of IRQ_TYPE_NONE. + +Cc: Bjorn Andersson +Cc: Srinivas Kandagatla +Cc: Nicolas Dechesne +Cc: John Stultz +Signed-off-by: Stephen Boyd +Signed-off-by: John Stultz +Diffstat +-rw-r--r-- arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts 49 + +-rw-r--r-- arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts 21 + +-rw-r--r-- arch/arm/boot/dts/qcom-apq8064-cm-qs600.dts 54 + +-rw-r--r-- arch/arm/boot/dts/qcom-apq8064-ifc6410.dts 54 + +-rw-r--r-- arch/arm/boot/dts/qcom-apq8064-sony-xperia-yuga.dts 16 + +-rw-r--r-- arch/arm/boot/dts/qcom-apq8064.dtsi 154 + +6 files changed, 169 insertions, 179 deletions +diff --git a/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts b/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts +index 8f5de02..c5f561f 100644 +--- a/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts ++++ b/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts +@@ -319,44 +319,37 @@ + target-supply = <&pm8921_lvs7>; + }; + +- /* OTG */ +- phy@12500000 { +- status = "okay"; +- dr_mode = "peripheral"; +- vddcx-supply = <&pm8921_s3>; +- v3p3-supply = <&pm8921_l3>; +- v1p8-supply = <&pm8921_l4>; +- }; +- +- phy@12520000 { +- status = "okay"; +- vddcx-supply = <&pm8921_s3>; +- v3p3-supply = <&pm8921_l3>; +- v1p8-supply = <&pm8921_l23>; +- }; +- +- phy@12530000 { +- status = "okay"; +- vddcx-supply = <&pm8921_s3>; +- v3p3-supply = <&pm8921_l3>; +- v1p8-supply = <&pm8921_l23>; +- }; +- +- gadget@12500000 { +- status = "okay"; +- }; +- +- /* OTG */ + usb@12500000 { + status = "okay"; ++ dr_mode = "peripheral"; ++ ulpi { ++ phy { ++ v3p3-supply = <&pm8921_l3>; ++ v1p8-supply = <&pm8921_l4>; ++ }; ++ }; + }; + + usb@12520000 { + status = "okay"; ++ dr_mode = "otg"; ++ ulpi { ++ phy { ++ v3p3-supply = <&pm8921_l3>; ++ v1p8-supply = <&pm8921_l23>; ++ }; ++ }; + }; + + usb@12530000 { + status = "okay"; ++ dr_mode = "otg"; ++ ulpi { ++ phy { ++ v3p3-supply = <&pm8921_l3>; ++ v1p8-supply = <&pm8921_l23>; ++ }; ++ }; + }; + + amba { +diff --git a/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts b/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts +index e39440a..e5fef32 100644 +--- a/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts ++++ b/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts +@@ -320,22 +320,15 @@ + }; + }; + +- /* OTG */ +- phy@12500000 { +- status = "okay"; +- vddcx-supply = <&pm8921_s3>; +- v3p3-supply = <&pm8921_l3>; +- v1p8-supply = <&pm8921_l4>; +- dr_mode = "otg"; +- }; +- +- gadget@12500000 { +- status = "okay"; +- }; +- +- /* OTG */ + usb@12500000 { + status = "okay"; ++ dr_mode = "otg"; ++ ulpi { ++ phy { ++ v3p3-supply = <&pm8921_l3>; ++ v1p8-supply = <&pm8921_l4>; ++ }; ++ }; + }; + + amba { +diff --git a/arch/arm/boot/dts/qcom-apq8064-cm-qs600.dts b/arch/arm/boot/dts/qcom-apq8064-cm-qs600.dts +index 35f1d46..d736203 100644 +--- a/arch/arm/boot/dts/qcom-apq8064-cm-qs600.dts ++++ b/arch/arm/boot/dts/qcom-apq8064-cm-qs600.dts +@@ -149,43 +149,37 @@ + }; + }; + +- /* OTG */ +- usb1_phy: phy@12500000 { +- status = "okay"; +- vddcx-supply = <&pm8921_s3>; +- v3p3-supply = <&pm8921_l3>; +- v1p8-supply = <&pm8921_l4>; +- }; +- +- usb3_phy: phy@12520000 { +- status = "okay"; +- vddcx-supply = <&pm8921_s3>; +- v3p3-supply = <&pm8921_l3>; +- v1p8-supply = <&pm8921_l23>; +- }; +- +- usb4_phy: phy@12530000 { +- status = "okay"; +- vddcx-supply = <&pm8921_s3>; +- v3p3-supply = <&pm8921_l3>; +- v1p8-supply = <&pm8921_l23>; +- }; +- +- gadget1: gadget@12500000 { +- status = "ok"; +- }; +- +- /* OTG */ +- usb1: usb@12500000 { ++ usb@12500000 { + status = "ok"; ++ dr_mode = "otg"; ++ ulpi { ++ phy { ++ v3p3-supply = <&pm8921_l3>; ++ v1p8-supply = <&pm8921_l4>; ++ }; ++ }; + }; + +- usb3: usb@12520000 { ++ usb@12520000 { + status = "okay"; ++ dr_mode = "host"; ++ ulpi { ++ phy { ++ v3p3-supply = <&pm8921_l3>; ++ v1p8-supply = <&pm8921_l23>; ++ }; ++ }; + }; + +- usb4: usb@12530000 { ++ usb@12530000 { + status = "okay"; ++ dr_mode = "host"; ++ ulpi { ++ phy { ++ v3p3-supply = <&pm8921_l3>; ++ v1p8-supply = <&pm8921_l23>; ++ }; ++ }; + }; + + /* on board fixed 3.3v supply */ +diff --git a/arch/arm/boot/dts/qcom-apq8064-ifc6410.dts b/arch/arm/boot/dts/qcom-apq8064-ifc6410.dts +index 881ce70..bbd1dac 100644 +--- a/arch/arm/boot/dts/qcom-apq8064-ifc6410.dts ++++ b/arch/arm/boot/dts/qcom-apq8064-ifc6410.dts +@@ -243,43 +243,37 @@ + target-supply = <&pm8921_s4>; + }; + +- /* OTG */ +- usb1_phy: phy@12500000 { +- status = "okay"; +- vddcx-supply = <&pm8921_s3>; +- v3p3-supply = <&pm8921_l3>; +- v1p8-supply = <&pm8921_l4>; +- }; +- +- usb3_phy: phy@12520000 { +- status = "okay"; +- vddcx-supply = <&pm8921_s3>; +- v3p3-supply = <&pm8921_l3>; +- v1p8-supply = <&pm8921_l23>; +- }; +- +- usb4_phy: phy@12530000 { +- status = "okay"; +- vddcx-supply = <&pm8921_s3>; +- v3p3-supply = <&pm8921_l3>; +- v1p8-supply = <&pm8921_l23>; +- }; +- +- gadget1: gadget@12500000 { +- status = "okay"; +- }; +- +- /* OTG */ +- usb1: usb@12500000 { ++ usb@12500000 { + status = "okay"; ++ dr_mode = "otg"; ++ ulpi { ++ phy { ++ v3p3-supply = <&pm8921_l3>; ++ v1p8-supply = <&pm8921_l4>; ++ }; ++ }; + }; + +- usb3: usb@12520000 { ++ usb@12520000 { + status = "okay"; ++ dr_mode = "host"; ++ ulpi { ++ phy { ++ v3p3-supply = <&pm8921_l3>; ++ v1p8-supply = <&pm8921_l23>; ++ }; ++ }; + }; + +- usb4: usb@12530000 { ++ usb@12530000 { + status = "okay"; ++ dr_mode = "host"; ++ ulpi { ++ phy { ++ v3p3-supply = <&pm8921_l3>; ++ v1p8-supply = <&pm8921_l23>; ++ }; ++ }; + }; + + pci@1b500000 { +diff --git a/arch/arm/boot/dts/qcom-apq8064-sony-xperia-yuga.dts b/arch/arm/boot/dts/qcom-apq8064-sony-xperia-yuga.dts +index a34ba35..88a9aff 100644 +--- a/arch/arm/boot/dts/qcom-apq8064-sony-xperia-yuga.dts ++++ b/arch/arm/boot/dts/qcom-apq8064-sony-xperia-yuga.dts +@@ -349,15 +349,15 @@ + }; + }; + +- phy@12500000 { +- status = "okay"; +- vddcx-supply = <&pm8921_s3>; +- v3p3-supply = <&pm8921_l3>; +- v1p8-supply = <&pm8921_l4>; +- }; +- +- gadget@12500000 { ++ usb@12500000 { + status = "okay"; ++ dr_mode = "otg"; ++ ulpi { ++ phy { ++ v3p3-supply = <&pm8921_l3>; ++ v1p8-supply = <&pm8921_l4>; ++ }; ++ }; + }; + + gsbi@1a200000 { +diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi +index 14a6f5e..f3db185 100644 +--- a/arch/arm/boot/dts/qcom-apq8064.dtsi ++++ b/arch/arm/boot/dts/qcom-apq8064.dtsi +@@ -197,7 +197,7 @@ + clock-frequency = <27000000>; + }; + +- sleep_clk { ++ sleep_clk: sleep_clk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; +@@ -884,81 +884,97 @@ + }; + }; + +- usb1_phy: phy@12500000 { +- compatible = "qcom,usb-otg-ci"; +- reg = <0x12500000 0x400>; +- interrupts = ; +- status = "disabled"; +- +- clocks = <&gcc USB_HS1_XCVR_CLK>, +- <&gcc USB_HS1_H_CLK>; +- clock-names = "core", "iface"; +- +- resets = <&gcc USB_HS1_RESET>; +- reset-names = "link"; +- }; +- +- usb3_phy: phy@12520000 { +- compatible = "qcom,usb-otg-ci"; +- reg = <0x12520000 0x400>; +- interrupts = ; +- status = "disabled"; +- dr_mode = "host"; +- +- clocks = <&gcc USB_HS3_XCVR_CLK>, +- <&gcc USB_HS3_H_CLK>; +- clock-names = "core", "iface"; +- +- resets = <&gcc USB_HS3_RESET>; +- reset-names = "link"; +- }; +- +- usb4_phy: phy@12530000 { +- compatible = "qcom,usb-otg-ci"; +- reg = <0x12530000 0x400>; +- interrupts = ; +- status = "disabled"; +- dr_mode = "host"; +- +- clocks = <&gcc USB_HS4_XCVR_CLK>, +- <&gcc USB_HS4_H_CLK>; +- clock-names = "core", "iface"; +- +- resets = <&gcc USB_HS4_RESET>; +- reset-names = "link"; +- }; +- +- gadget1: gadget@12500000 { +- compatible = "qcom,ci-hdrc"; +- reg = <0x12500000 0x400>; +- status = "disabled"; +- dr_mode = "peripheral"; +- interrupts = ; +- usb-phy = <&usb1_phy>; +- }; +- + usb1: usb@12500000 { +- compatible = "qcom,ehci-host"; +- reg = <0x12500000 0x400>; +- interrupts = ; +- status = "disabled"; +- usb-phy = <&usb1_phy>; ++ compatible = "qcom,ci-hdrc"; ++ reg = <0x12500000 0x200>, ++ <0x12500200 0x200>; ++ interrupts = ; ++ clocks = <&gcc USB_HS1_XCVR_CLK>, <&gcc USB_HS1_H_CLK>; ++ clock-names = "core", "iface"; ++ assigned-clocks = <&gcc USB_HS1_XCVR_CLK>; ++ assigned-clock-rates = <60000000>; ++ resets = <&gcc USB_HS1_RESET>; ++ reset-names = "core"; ++ phy_type = "ulpi"; ++ ahb-burst-config = <0>; ++ phys = <&usb_hs1_phy>; ++ phy-names = "usb-phy"; ++ status = "disabled"; ++ #reset-cells = <1>; ++ ++ ulpi { ++ usb_hs1_phy: phy { ++ compatible = "qcom,usb-hs-phy-apq8064", ++ "qcom,usb-hs-phy"; ++ #phy-cells = <0>; ++ clocks = <&sleep_clk>, <&cxo_board>; ++ clock-names = "sleep", "ref"; ++ resets = <&usb1 0>; ++ reset-names = "por"; ++ }; ++ }; + }; + + usb3: usb@12520000 { +- compatible = "qcom,ehci-host"; +- reg = <0x12520000 0x400>; +- interrupts = ; +- status = "disabled"; +- usb-phy = <&usb3_phy>; ++ compatible = "qcom,ci-hdrc"; ++ reg = <0x12520000 0x200>, ++ <0x12520200 0x200>; ++ interrupts = ; ++ clocks = <&gcc USB_HS3_XCVR_CLK>, <&gcc USB_HS3_H_CLK>; ++ clock-names = "core", "iface"; ++ assigned-clocks = <&gcc USB_HS3_XCVR_CLK>; ++ assigned-clock-rates = <60000000>; ++ resets = <&gcc USB_HS3_RESET>; ++ reset-names = "core"; ++ phy_type = "ulpi"; ++ ahb-burst-config = <0>; ++ phys = <&usb_hs3_phy>; ++ phy-names = "usb-phy"; ++ status = "disabled"; ++ #reset-cells = <1>; ++ ++ ulpi { ++ usb_hs3_phy: phy { ++ compatible = "qcom,usb-hs-phy-apq8064", ++ "qcom,usb-hs-phy"; ++ #phy-cells = <0>; ++ clocks = <&sleep_clk>, <&cxo_board>; ++ clock-names = "sleep", "ref"; ++ resets = <&usb3 0>; ++ reset-names = "por"; ++ }; ++ }; + }; + + usb4: usb@12530000 { +- compatible = "qcom,ehci-host"; +- reg = <0x12530000 0x400>; +- interrupts = ; +- status = "disabled"; +- usb-phy = <&usb4_phy>; ++ compatible = "qcom,ci-hdrc"; ++ reg = <0x12530000 0x200>, ++ <0x12530200 0x200>; ++ interrupts = ; ++ clocks = <&gcc USB_HS4_XCVR_CLK>, <&gcc USB_HS4_H_CLK>; ++ clock-names = "core", "iface"; ++ assigned-clocks = <&gcc USB_HS4_XCVR_CLK>; ++ assigned-clock-rates = <60000000>; ++ resets = <&gcc USB_HS4_RESET>; ++ reset-names = "core"; ++ phy_type = "ulpi"; ++ ahb-burst-config = <0>; ++ phys = <&usb_hs4_phy>; ++ phy-names = "usb-phy"; ++ status = "disabled"; ++ #reset-cells = <1>; ++ ++ ulpi { ++ usb_hs4_phy: phy { ++ compatible = "qcom,usb-hs-phy-apq8064", ++ "qcom,usb-hs-phy"; ++ #phy-cells = <0>; ++ clocks = <&sleep_clk>, <&cxo_board>; ++ clock-names = "sleep", "ref"; ++ resets = <&usb4 0>; ++ reset-names = "por"; ++ }; ++ }; + }; + + sata_phy0: phy@1b400000 { diff --git a/aports/device/linux-asus-flo/01_Add_regulator_tweaks_and_wcnss_entry_to_support_wifi.patch b/aports/device/linux-asus-flo/01_Add_regulator_tweaks_and_wcnss_entry_to_support_wifi.patch new file mode 100644 index 00000000..6e7635eb --- /dev/null +++ b/aports/device/linux-asus-flo/01_Add_regulator_tweaks_and_wcnss_entry_to_support_wifi.patch @@ -0,0 +1,136 @@ +author John Stultz 2016-02-29 20:23:21 -0800 +committer John Stultz 2017-05-12 14:09:02 -0700 +commit d337a84d6b6adc6d7e315de7faba6694bb25b05e (patch) +tree b5cd19a76d8c7590db47bea7845f003bf69ae6d6 +parent e4b001541f7fc4f142d1f2327bbed779db6193ec (diff) +download flo-d337a84d6b6adc6d7e315de7faba6694bb25b05e.tar.gz +ARM: dts: nexus7: Add regulator tweaks and wcnss entry to support wifi +Tweak and add some regulator entries that are needed to +support wifi. + +The values here were taken from: +arch/arm/mach-msm/asustek/flo/board-flo-regulator.c +in the AOSP msm 3.4 flo branch. + +This also adds a wcnss entry so it gets enabled on the board. + +Cc: Bjorn Andersson +Cc: Srinivas Kandagatla +Cc: Nicolas Dechesne +Cc: Stephen Boyd +Cc: Andy Gross +Cc: Rob Clark +Cc: Vinay Simha +Cc: David Brown +Cc: Rob Herring +Signed-off-by: John Stults +Diffstat +-rw-r--r-- arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts 42 + +1 files changed, 40 insertions, 2 deletions +diff --git a/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts b/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts +index e5fef32..3cae48f 100644 +--- a/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts ++++ b/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts +@@ -82,7 +82,17 @@ + bias-pull-down; + }; + +- /* msm otg HSUSB_VDDCX */ ++ /* wcnss_wlan.0-iris_vddrfa */ ++ s2 { ++ regulator-min-microvolt = <1300000>; ++ regulator-max-microvolt = <1300000>; ++ qcom,switch-mode-frequency = <1600000>; ++ }; ++ ++ /* ++ * msm otg HSUSB_VDDCX ++ * wcnss_wlan.0-riva_vddcx ++ */ + s3 { + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1150000>; +@@ -95,6 +105,7 @@ + * tabla2x-slim-CDC_VDDA_TX + * tabla2x-slim-CDC_VDD_CP + * tabla2x-slim-VDDIO_CDC ++ * wcnss_wlan.0-riva_vddpx + */ + s4 { + regulator-min-microvolt = <1800000>; +@@ -123,7 +134,10 @@ + bias-pull-down; + }; + +- /* msm_otg-HSUSB_1p8 */ ++ /* ++ * msm_otg-HSUSB_1p8 ++ * wcnss_wlan.0-iris_vddxo ++ */ + l4 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; +@@ -143,6 +157,12 @@ + regulator-max-microvolt = <2950000>; + }; + ++ /* wcnss_wlan.0-iris_vddpa */ ++ l10 { ++ regulator-min-microvolt = <2900000>; ++ regulator-max-microvolt = <2900000>; ++ }; ++ + /* mipi_dsi.1-dsi1_avdd */ + l11 { + regulator-min-microvolt = <3000000>; +@@ -165,6 +185,12 @@ + bias-pull-down; + }; + ++ /* wcnss_wlan.0-riva_vddmx */ ++ l24 { ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1150000>; ++ }; ++ + /* + * tabla2x-slim-CDC_VDDA_A_1P2V + * tabla2x-slim-VDDD_CDC_D +@@ -175,10 +201,15 @@ + bias-pull-down; + }; + ++ /* wcnss_wlan.0-iris_vddio */ + lvs1 { + bias-pull-down; + }; + ++ /* wcnss_wlan.0-iris_vdddig */ ++ lvs2 { ++ }; ++ + lvs4 { + bias-pull-down; + }; +@@ -196,6 +227,7 @@ + */ + lvs7 { + bias-pull-down; ++ regulator-always-on; + }; + }; + }; +@@ -340,6 +372,12 @@ + }; + }; + ++ riva-pil@3204000 { ++ status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&riva_wlan_pin_a>; ++ }; ++ + imem@2a03f000 { + compatible = "syscon", "simple-mfd"; + reg = <0x2a03f000 0x1000>; diff --git a/aports/device/linux-asus-flo/02_Avoid_sending_high_rates_to_downstream_clocks_during_set_rate.patch b/aports/device/linux-asus-flo/02_Avoid_sending_high_rates_to_downstream_clocks_during_set_rate.patch new file mode 100644 index 00000000..bf674d9c --- /dev/null +++ b/aports/device/linux-asus-flo/02_Avoid_sending_high_rates_to_downstream_clocks_during_set_rate.patch @@ -0,0 +1,109 @@ +author Stephen Boyd 2015-03-20 23:45:22 -0700 +committer John Stultz 2017-05-12 14:09:21 -0700 +commit a4daa927877f99711d1d90eb4ecbef9655ae7071 (patch) +tree 60d791c89659daf488265681a0e98f288f5168a7 +parent d337a84d6b6adc6d7e315de7faba6694bb25b05e (diff) +download flo-a4daa927877f99711d1d90eb4ecbef9655ae7071.tar.gz +clk: Avoid sending high rates to downstream clocks during set_rate +If a clock is on and we call clk_set_rate() on it we may get into +a situation where the clock temporarily increases in rate +dramatically while we walk the tree and call .set_rate() ops. For +example, consider a case where a PLL feeds into a divider. +Initially the divider is set to divide by 1 and the PLL is +running fairly slow (100MHz). The downstream consumer of the +divider output can only handle rates =< 400 MHz, but the divider +can only choose between divisors of 1 and 4. + + +-----+ +----------------+ + | PLL |-->| div 1 or div 4 |---> consumer device + +-----+ +----------------+ + +To achieve a rate of 400MHz on the output of the divider, we +would have to set the rate of the PLL to 1.6 GHz and then divide +it by 4. The current code would set the PLL to 1.6GHz first while +the divider is still set to 1, thus causing the downstream +consumer of the clock to receive a few clock cycles of 1.6GHz +clock (far beyond it's maximum acceptable rate). We should be +changing the divider first before increasing the PLL rate to +avoid this problem. + +Therefore, set the rate of any child clocks that are increasing +in rate from their current rate so that they can increase their +dividers if necessary. We assume that there isn't such a thing as +minimum rate requirements. + +Signed-off-by: Stephen Boyd + +Conflicts: + drivers/clk/clk.c +Diffstat +-rw-r--r-- drivers/clk/clk.c 22 + +1 files changed, 15 insertions, 7 deletions +diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c +index fc58c52..784d7a2 100644 +--- a/drivers/clk/clk.c ++++ b/drivers/clk/clk.c +@@ -1468,12 +1468,12 @@ static struct clk_core *clk_propagate_rate_change(struct clk_core *core, + * walk down a subtree and set the new rates notifying the rate + * change on the way + */ +-static void clk_change_rate(struct clk_core *core) ++static void ++clk_change_rate(struct clk_core *core, unsigned long best_parent_rate) + { + struct clk_core *child; + struct hlist_node *tmp; + unsigned long old_rate; +- unsigned long best_parent_rate = 0; + bool skip_set_rate = false; + struct clk_core *old_parent; + struct clk_core *parent = NULL; +@@ -1525,6 +1525,7 @@ static void clk_change_rate(struct clk_core *core) + trace_clk_set_rate_complete(core, core->new_rate); + + core->rate = clk_recalc(core, best_parent_rate); ++ core->rate = core->new_rate; + + if (core->flags & CLK_SET_RATE_UNGATE) { + unsigned long flags; +@@ -1552,12 +1553,13 @@ static void clk_change_rate(struct clk_core *core) + /* Skip children who will be reparented to another clock */ + if (child->new_parent && child->new_parent != core) + continue; +- clk_change_rate(child); ++ if (child->new_rate != child->rate) ++ clk_change_rate(child, core->new_rate); + } + +- /* handle the new child who might not be in core->children yet */ +- if (core->new_child) +- clk_change_rate(core->new_child); ++ /* handle the new child who might not be in clk->children yet */ ++ if (core->new_child && core->new_child->new_rate != core->new_child->rate) ++ clk_change_rate(core->new_child, core->new_rate); + } + + static int clk_core_set_rate_nolock(struct clk_core *core, +@@ -1565,6 +1567,7 @@ static int clk_core_set_rate_nolock(struct clk_core *core, + { + struct clk_core *top, *fail_clk; + unsigned long rate = req_rate; ++ unsigned long parent_rate; + + if (!core) + return 0; +@@ -1590,8 +1593,13 @@ static int clk_core_set_rate_nolock(struct clk_core *core, + return -EBUSY; + } + ++ if (top->parent) ++ parent_rate = top->parent->rate; ++ else ++ parent_rate = 0; ++ + /* change the rates */ +- clk_change_rate(top); ++ clk_change_rate(top, parent_rate); + + core->req_rate = req_rate; diff --git a/aports/device/linux-asus-flo/03_Support_devicetree_binding.patch b/aports/device/linux-asus-flo/03_Support_devicetree_binding.patch new file mode 100644 index 00000000..e10bc4aa --- /dev/null +++ b/aports/device/linux-asus-flo/03_Support_devicetree_binding.patch @@ -0,0 +1,311 @@ +author Vinay Simha BN 2016-07-26 23:22:16 +0530 +committer John Stultz 2017-05-12 12:39:39 -0700 +commit 04be7aa13586e450728845951f969f39ed577f0e (patch) +tree aba86875e93db08a8fd279c692caa2b28eb4fceb +parent c0648aa6e6063285cec2a15fecd360a3b4394af4 (diff) +download flo-04be7aa13586e450728845951f969f39ed577f0e.tar.gz +power: smb347-charger: Support devicetree binding +This patch makes smb347 charger driver to support dt binding. All legacy +platform data now can be parsed from dt. +Because of that smb347 is i2c client driver, IRQ number can be passed +automatically through client's irq variable if it is defined in dt. +No more to use requesting gpio to irq manually in dt-way. + +Signed-off-by: Jonghwa Lee +Acked-by : Chanwoo Choi +Acked-by : Myungjoo Ham +Signed-off-by: Vinay Simha BN +Diffstat +-rw-r--r-- Documentation/devicetree/bindings/power_supply/smb347_charger.txt 57 + +-rw-r--r-- drivers/power/supply/smb347-charger.c 140 + +2 files changed, 160 insertions, 37 deletions +diff --git a/Documentation/devicetree/bindings/power_supply/smb347_charger.txt b/Documentation/devicetree/bindings/power_supply/smb347_charger.txt +new file mode 100644 +index 0000000..91570a5 +--- /dev/null ++++ b/Documentation/devicetree/bindings/power_supply/smb347_charger.txt +@@ -0,0 +1,57 @@ ++smb347_charger bindings ++~~~~~~~~~~~~~~~~~~~~~~~~ ++ ++[Required porperties] ++- compatible : "summit,smb347" ++- reg : Slave address for i2c interface ++# At least one of followings should be set ++ - enable-usb-charging ++ - enable-otg-charging ++ - enable-mains-charging ++ ++[Optional properties] ++- interrupt-parent : The phandle for the interrupt controller ++- interrupts : Interrupt line index for mapping ++- enable-chg-ctrl : Enable charging control ++ <0> : SW (i2c interface) ++ <1> : Pin control (Active Low) ++ <2> : Pin control (Active High) ++# Charging constraints ++- max-chg-curr : Maximum current for charging (in uA) ++- max-chg-volt : Maximum voltage for charging (in uV) ++- pre-chg-curr : Pre-charging current (in uA) ++- term-curr : Charging cycle termination current (in uA) ++- fast-volt-thershold : Voltage threshold to transit to fast charge mode (in uV) ++- mains-curr-limit : Maximum input current from AC/DC input (in uA) ++- usb-curr-limit : Maximum input current from USB input (in uA) ++ ++# Related thermometer monitoring (in degree C) ++- chip-temp-threshold : Chip temperature for thermal regulaton. <100, 130> ++- soft-cold-temp-limit : Cold battery temperature for soft alarm. <0, 15>* ++- soft-hot-temp-limit : Hot battery temperature for soft alarm. <40, 55> ++- hard-cold-temp-limit : Cold battery temperature for hard alarm. <0, 15>* ++- hard-hot-temp-limit : Hot battery temperature for hard alarm. <55, 65> ++(* The written temperature has +5'C offset. 0'C -> -5'C, 15'C -> 10'C) ++- soft-comp-method : Soft temperature limit compensation method ++ (Not defined) : Use default setting ++ <0> : Compensation none ++ <1> : Charge current compensation ++ <2> : Voltage compensation ++ ++Example: ++ smb347@7f { ++ compatible = "summit,smb347"; ++ reg = <0x7f>; ++ status = "okay"; ++ ++ max-chg-curr = <1800000>; ++ mains-curr-limit = <2000000>; ++ usb-curr-limit = <450000>; ++ ++ chip-temp-thershold = <110>; ++ ++ enable-usb-charging; ++ enable-mains-charging; ++ ++ enable-chg-ctrl = <2>; /* Pin control (Active High) */ ++ }; +diff --git a/drivers/power/supply/smb347-charger.c b/drivers/power/supply/smb347-charger.c +index 072c518..0231844 100644 +--- a/drivers/power/supply/smb347-charger.c ++++ b/drivers/power/supply/smb347-charger.c +@@ -10,7 +10,7 @@ + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +- ++#define DEBUG + #include + #include + #include +@@ -834,22 +834,21 @@ static inline int smb347_irq_disable(struct smb347_charger *smb) + static int smb347_irq_init(struct smb347_charger *smb, + struct i2c_client *client) + { +- const struct smb347_charger_platform_data *pdata = smb->pdata; +- int ret, irq = gpio_to_irq(pdata->irq_gpio); ++ int ret; ++ unsigned long irqflags; + +- ret = gpio_request_one(pdata->irq_gpio, GPIOF_IN, client->name); +- if (ret < 0) +- goto fail; ++ irqflags = client->dev.of_node ? 0 : IRQF_TRIGGER_FALLING; ++ ++ ret = devm_request_threaded_irq(smb->dev, client->irq, NULL, ++ smb347_interrupt, irqflags | IRQF_ONESHOT, ++ client->name, smb); + +- ret = request_threaded_irq(irq, NULL, smb347_interrupt, +- IRQF_TRIGGER_FALLING | IRQF_ONESHOT, +- client->name, smb); + if (ret < 0) +- goto fail_gpio; ++ goto out; + + ret = smb347_set_writable(smb, true); + if (ret < 0) +- goto fail_irq; ++ goto out; + + /* + * Configure the STAT output to be suitable for interrupts: disable +@@ -859,20 +858,10 @@ static int smb347_irq_init(struct smb347_charger *smb, + CFG_STAT_ACTIVE_HIGH | CFG_STAT_DISABLED, + CFG_STAT_DISABLED); + if (ret < 0) +- goto fail_readonly; +- +- smb347_set_writable(smb, false); +- client->irq = irq; +- return 0; ++ client->irq = 0; + +-fail_readonly: + smb347_set_writable(smb, false); +-fail_irq: +- free_irq(irq, smb); +-fail_gpio: +- gpio_free(pdata->irq_gpio); +-fail: +- client->irq = 0; ++out: + return ret; + } + +@@ -1178,6 +1167,80 @@ static bool smb347_readable_reg(struct device *dev, unsigned int reg) + return smb347_volatile_reg(dev, reg); + } + ++static void smb347_dt_parse_pdata(struct device_node *np, ++ struct smb347_charger_platform_data *pdata) ++{ ++ /* Charing constraints */ ++ of_property_read_u32(np, "max-chg-curr", &pdata->max_charge_current); ++ of_property_read_u32(np, "max-chg-volt", &pdata->max_charge_voltage); ++ of_property_read_u32(np, "pre-chg-curr", &pdata->pre_charge_current); ++ of_property_read_u32(np, "term-curr", &pdata->termination_current); ++ of_property_read_u32(np, "fast-volt-threshold", ++ &pdata->pre_to_fast_voltage); ++ of_property_read_u32(np, "mains-curr-limit", ++ &pdata->mains_current_limit); ++ of_property_read_u32(np, "usb-curr-limit", ++ &pdata->usb_hc_current_limit); ++ ++ /* For thermometer monitoring */ ++ of_property_read_u32(np, "chip-temp-threshold", ++ &pdata->chip_temp_threshold); ++ if (of_property_read_u32(np, "soft-cold-temp-limit", ++ &pdata->soft_cold_temp_limit)) ++ pdata->soft_cold_temp_limit = SMB347_TEMP_USE_DEFAULT; ++ if (of_property_read_u32(np, "soft-hot-temp-limit", ++ &pdata->soft_hot_temp_limit)) ++ pdata->soft_hot_temp_limit = SMB347_TEMP_USE_DEFAULT; ++ if (of_property_read_u32(np, "hard-cold-temp-limit", ++ &pdata->hard_cold_temp_limit)) ++ pdata->hard_cold_temp_limit = SMB347_TEMP_USE_DEFAULT; ++ if (of_property_read_u32(np, "hard-hot-temp-limit", ++ &pdata->hard_hot_temp_limit)) ++ pdata->hard_hot_temp_limit = SMB347_TEMP_USE_DEFAULT; ++ ++ /* Suspend when battery temperature is outside hard limits */ ++ if ((pdata->hard_cold_temp_limit != SMB347_TEMP_USE_DEFAULT) ++ || (pdata->hard_hot_temp_limit != SMB347_TEMP_USE_DEFAULT)) ++ pdata->suspend_on_hard_temp_limit = true; ++ ++ if (of_property_read_u32(np, "soft-comp-method", ++ &pdata->soft_temp_limit_compensation)) ++ pdata->soft_temp_limit_compensation = ++ SMB347_SOFT_TEMP_COMPENSATE_DEFAULT; ++ ++ of_property_read_u32(np, "chg-curr-comp", ++ &pdata->charge_current_compensation); ++ ++ /* Supported charging mode */ ++ pdata->use_mains = of_property_read_bool(np, "enable-mains-charging"); ++ pdata->use_usb = of_property_read_bool(np, "enable-usb-charging"); ++ pdata->use_usb_otg = of_property_read_bool(np, "enable-otg-charging"); ++ ++ /* Enable charging method */ ++ of_property_read_u32(np, "enable-chg-ctrl", &pdata->enable_control); ++ ++ /* If IRQ is enabled or not */ ++ if (!of_get_property(np, "interrupts", NULL)) ++ pdata->irq_gpio = -1; ++ ++ return; ++} ++ ++static struct smb347_charger_platform_data ++ *smb347_get_platdata(struct device *dev) ++{ ++ struct smb347_charger_platform_data *pdata = NULL; ++ ++ if (dev->of_node) { ++ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); ++ smb347_dt_parse_pdata(dev->of_node, pdata); ++ } else { ++ pdata = dev_get_platdata(dev); ++ } ++ ++ return pdata; ++} ++ + static const struct regmap_config smb347_regmap = { + .reg_bits = 8, + .val_bits = 8, +@@ -1214,28 +1277,26 @@ static int smb347_probe(struct i2c_client *client, + const struct i2c_device_id *id) + { + static char *battery[] = { "smb347-battery" }; +- const struct smb347_charger_platform_data *pdata; + struct power_supply_config mains_usb_cfg = {}, battery_cfg = {}; + struct device *dev = &client->dev; + struct smb347_charger *smb; + int ret; + +- pdata = dev->platform_data; +- if (!pdata) +- return -EINVAL; +- +- if (!pdata->use_mains && !pdata->use_usb) +- return -EINVAL; +- + smb = devm_kzalloc(dev, sizeof(*smb), GFP_KERNEL); + if (!smb) + return -ENOMEM; + ++ smb->pdata = smb347_get_platdata(dev); ++ if (IS_ERR_OR_NULL(smb->pdata)) ++ return -ENODEV; ++ ++ if (!smb->pdata->use_mains && !smb->pdata->use_usb) ++ return -EINVAL; ++ + i2c_set_clientdata(client, smb); + + mutex_init(&smb->lock); + smb->dev = &client->dev; +- smb->pdata = pdata; + + smb->regmap = devm_regmap_init_i2c(client, &smb347_regmap); + if (IS_ERR(smb->regmap)) +@@ -1280,7 +1341,7 @@ static int smb347_probe(struct i2c_client *client, + * Interrupt pin is optional. If it is connected, we setup the + * interrupt support here. + */ +- if (pdata->irq_gpio >= 0) { ++ if (smb->pdata->irq_gpio >= 0) { + ret = smb347_irq_init(smb, client); + if (ret < 0) { + dev_warn(dev, "failed to initialize IRQ: %d\n", ret); +@@ -1297,11 +1358,8 @@ static int smb347_remove(struct i2c_client *client) + { + struct smb347_charger *smb = i2c_get_clientdata(client); + +- if (client->irq) { ++ if (client->irq) + smb347_irq_disable(smb); +- free_irq(client->irq, smb); +- gpio_free(smb->pdata->irq_gpio); +- } + + power_supply_unregister(smb->battery); + if (smb->pdata->use_usb) +@@ -1317,9 +1375,17 @@ static const struct i2c_device_id smb347_id[] = { + }; + MODULE_DEVICE_TABLE(i2c, smb347_id); + ++#ifdef CONFIG_OF ++static struct of_device_id of_smb347_ids[] = { ++ { .compatible = "summit,smb347" }, ++ {}, ++}; ++#endif ++ + static struct i2c_driver smb347_driver = { + .driver = { + .name = "smb347", ++ .of_match_table = of_match_ptr(of_smb347_ids), + }, + .probe = smb347_probe, + .remove = smb347_remove, diff --git a/aports/device/linux-asus-flo/04_Summit_SMB345_charger_IC.patch b/aports/device/linux-asus-flo/04_Summit_SMB345_charger_IC.patch new file mode 100644 index 00000000..6d9ea342 --- /dev/null +++ b/aports/device/linux-asus-flo/04_Summit_SMB345_charger_IC.patch @@ -0,0 +1,291 @@ +author Vinay Simha BN 2016-09-02 20:46:57 +0530 +committer John Stultz 2017-05-12 12:39:41 -0700 +commit cba521131c17b70b5973c662a59d134d607ad311 (patch) +tree d32a9ea9e23590ab7703944bc0b3db5b9d8b8835 +parent 04be7aa13586e450728845951f969f39ed577f0e (diff) +download flo-cba521131c17b70b5973c662a59d134d607ad311.tar.gz +power: smb347-charger: Summit SMB345 charger IC +Summit microelectronics SMB358 charger chip added. +It shares the same register map and functionality +with SMB347. + +Cc: Jonghwa Lee +Cc: Sumit Semwal +Cc: John Stultz +Signed-off-by: Vinay Simha BN +Diffstat +-rw-r--r-- Documentation/devicetree/bindings/power_supply/smb347_charger.txt 1 + +-rw-r--r-- drivers/power/supply/smb347-charger.c 122 + +2 files changed, 61 insertions, 62 deletions +diff --git a/Documentation/devicetree/bindings/power_supply/smb347_charger.txt b/Documentation/devicetree/bindings/power_supply/smb347_charger.txt +index 91570a5..ee39b58 100644 +--- a/Documentation/devicetree/bindings/power_supply/smb347_charger.txt ++++ b/Documentation/devicetree/bindings/power_supply/smb347_charger.txt +@@ -3,6 +3,7 @@ smb347_charger bindings + + [Required porperties] + - compatible : "summit,smb347" ++ "summit,smb345" + - reg : Slave address for i2c interface + # At least one of followings should be set + - enable-usb-charging +diff --git a/drivers/power/supply/smb347-charger.c b/drivers/power/supply/smb347-charger.c +index 0231844..4be638c 100644 +--- a/drivers/power/supply/smb347-charger.c ++++ b/drivers/power/supply/smb347-charger.c +@@ -136,6 +136,7 @@ + * @pdata: pointer to platform data + */ + struct smb347_charger { ++ int id; + struct mutex lock; + struct device *dev; + struct regmap *regmap; +@@ -148,58 +149,46 @@ struct smb347_charger { + const struct smb347_charger_platform_data *pdata; + }; + ++enum smb_charger_chipid { ++ SMB347, ++ SMB345, ++ NUM_CHIP_TYPES, ++}; ++ + /* Fast charge current in uA */ +-static const unsigned int fcc_tbl[] = { +- 700000, +- 900000, +- 1200000, +- 1500000, +- 1800000, +- 2000000, +- 2200000, +- 2500000, ++static const unsigned int fcc_tbl[NUM_CHIP_TYPES][8] = { ++ [SMB347] = { 700000, 900000, 1200000, 1500000, ++ 1800000, 2000000, 2200000, 2500000 }, ++ [SMB345] = { 200000, 450000, 600000, 900000, ++ 1300000, 1500000, 1800000, 2000000 }, + }; + + /* Pre-charge current in uA */ +-static const unsigned int pcc_tbl[] = { +- 100000, +- 150000, +- 200000, +- 250000, ++static const unsigned int pcc_tbl[NUM_CHIP_TYPES][4] = { ++ [SMB347] = { 100000, 150000, 200000, 250000 }, ++ [SMB345] = { 150000, 250000, 350000, 450000 }, + }; + + /* Termination current in uA */ +-static const unsigned int tc_tbl[] = { +- 37500, +- 50000, +- 100000, +- 150000, +- 200000, +- 250000, +- 500000, +- 600000, ++static const unsigned int tc_tbl[NUM_CHIP_TYPES][8] = { ++ [SMB347] = { 37500, 50000, 100000, 150000, ++ 200000, 250000, 500000, 600000 }, ++ [SMB345] = { 30000, 40000, 60000, 80000, ++ 100000, 125000, 150000, 200000 }, + }; + + /* Input current limit in uA */ +-static const unsigned int icl_tbl[] = { +- 300000, +- 500000, +- 700000, +- 900000, +- 1200000, +- 1500000, +- 1800000, +- 2000000, +- 2200000, +- 2500000, ++static const unsigned int icl_tbl[NUM_CHIP_TYPES][10] = { ++ [SMB347] = { 300000, 500000, 700000, 900000, 1200000, ++ 1500000, 1800000, 2000000, 2200000, 2500000 }, ++ [SMB345] = { 300000, 500000, 700000, 1000000, 1500000, ++ 1800000, 2000000, 2000000, 2000000, 2000000 }, + }; + + /* Charge current compensation in uA */ +-static const unsigned int ccc_tbl[] = { +- 250000, +- 700000, +- 900000, +- 1200000, ++static const unsigned int ccc_tbl[NUM_CHIP_TYPES][4] = { ++ [SMB347] = { 250000, 700000, 900000, 1200000 }, ++ [SMB345] = { 200000, 450000, 600000, 900000 }, + }; + + /* Convert register value to current using lookup table */ +@@ -354,10 +343,10 @@ static int smb347_start_stop_charging(struct smb347_charger *smb) + + static int smb347_set_charge_current(struct smb347_charger *smb) + { +- int ret; ++ int ret, id = smb->id; + + if (smb->pdata->max_charge_current) { +- ret = current_to_hw(fcc_tbl, ARRAY_SIZE(fcc_tbl), ++ ret = current_to_hw(fcc_tbl[id], ARRAY_SIZE(fcc_tbl[id]), + smb->pdata->max_charge_current); + if (ret < 0) + return ret; +@@ -370,7 +359,7 @@ static int smb347_set_charge_current(struct smb347_charger *smb) + } + + if (smb->pdata->pre_charge_current) { +- ret = current_to_hw(pcc_tbl, ARRAY_SIZE(pcc_tbl), ++ ret = current_to_hw(pcc_tbl[id], ARRAY_SIZE(pcc_tbl[id]), + smb->pdata->pre_charge_current); + if (ret < 0) + return ret; +@@ -383,7 +372,7 @@ static int smb347_set_charge_current(struct smb347_charger *smb) + } + + if (smb->pdata->termination_current) { +- ret = current_to_hw(tc_tbl, ARRAY_SIZE(tc_tbl), ++ ret = current_to_hw(tc_tbl[id], ARRAY_SIZE(tc_tbl[id]), + smb->pdata->termination_current); + if (ret < 0) + return ret; +@@ -399,10 +388,10 @@ static int smb347_set_charge_current(struct smb347_charger *smb) + + static int smb347_set_current_limits(struct smb347_charger *smb) + { +- int ret; ++ int ret, id = smb->id; + + if (smb->pdata->mains_current_limit) { +- ret = current_to_hw(icl_tbl, ARRAY_SIZE(icl_tbl), ++ ret = current_to_hw(icl_tbl[id], ARRAY_SIZE(icl_tbl[id]), + smb->pdata->mains_current_limit); + if (ret < 0) + return ret; +@@ -415,7 +404,7 @@ static int smb347_set_current_limits(struct smb347_charger *smb) + } + + if (smb->pdata->usb_hc_current_limit) { +- ret = current_to_hw(icl_tbl, ARRAY_SIZE(icl_tbl), ++ ret = current_to_hw(icl_tbl[id], ARRAY_SIZE(icl_tbl[id]), + smb->pdata->usb_hc_current_limit); + if (ret < 0) + return ret; +@@ -467,7 +456,7 @@ static int smb347_set_temp_limits(struct smb347_charger *smb) + { + bool enable_therm_monitor = false; + int ret = 0; +- int val; ++ int val, id = smb->id; + + if (smb->pdata->chip_temp_threshold) { + val = smb->pdata->chip_temp_threshold; +@@ -589,7 +578,7 @@ static int smb347_set_temp_limits(struct smb347_charger *smb) + } + + if (smb->pdata->charge_current_compensation) { +- val = current_to_hw(ccc_tbl, ARRAY_SIZE(ccc_tbl), ++ val = current_to_hw(ccc_tbl[id], ARRAY_SIZE(ccc_tbl[id]), + smb->pdata->charge_current_compensation); + if (val < 0) + return val; +@@ -723,10 +712,12 @@ static irqreturn_t smb347_interrupt(int irq, void *data) + return IRQ_NONE; + } + +- ret = regmap_read(smb->regmap, IRQSTAT_D, &irqstat_d); +- if (ret < 0) { +- dev_warn(smb->dev, "reading IRQSTAT_D failed\n"); +- return IRQ_NONE; ++ if(smb->id != SMB345) { ++ ret = regmap_read(smb->regmap, IRQSTAT_D, &irqstat_d); ++ if (ret < 0) { ++ dev_warn(smb->dev, "reading IRQSTAT_D failed\n"); ++ return IRQ_NONE; ++ } + } + + ret = regmap_read(smb->regmap, IRQSTAT_E, &irqstat_e); +@@ -761,13 +752,15 @@ static irqreturn_t smb347_interrupt(int irq, void *data) + * If we got a charger timeout INT that means the charge + * full is not detected with in charge timeout value. + */ +- if (irqstat_d & IRQSTAT_D_CHARGE_TIMEOUT_IRQ) { +- dev_dbg(smb->dev, "total Charge Timeout INT received\n"); ++ if(smb->id != SMB345) { ++ if (irqstat_d & IRQSTAT_D_CHARGE_TIMEOUT_IRQ) { ++ dev_dbg(smb->dev, "total Charge Timeout INT received\n"); + +- if (irqstat_d & IRQSTAT_D_CHARGE_TIMEOUT_STAT) +- dev_warn(smb->dev, "charging stopped due to timeout\n"); +- power_supply_changed(smb->battery); +- handled = true; ++ if (irqstat_d & IRQSTAT_D_CHARGE_TIMEOUT_STAT) ++ dev_warn(smb->dev, "charging stopped due to timeout\n"); ++ power_supply_changed(smb->battery); ++ handled = true; ++ } + } + + /* +@@ -871,7 +864,7 @@ out: + */ + static int get_const_charge_current(struct smb347_charger *smb) + { +- int ret, intval; ++ int ret, intval, id = smb->id; + unsigned int v; + + if (!smb347_is_ps_online(smb)) +@@ -886,10 +879,12 @@ static int get_const_charge_current(struct smb347_charger *smb) + * and we can detect which table to use from bit 5. + */ + if (v & 0x20) { +- intval = hw_to_current(fcc_tbl, ARRAY_SIZE(fcc_tbl), v & 7); ++ intval = hw_to_current(fcc_tbl[id], ++ ARRAY_SIZE(fcc_tbl[id]), v & 7); + } else { + v >>= 3; +- intval = hw_to_current(pcc_tbl, ARRAY_SIZE(pcc_tbl), v & 7); ++ intval = hw_to_current(pcc_tbl[id], ++ ARRAY_SIZE(pcc_tbl[id]), v & 7); + } + + return intval; +@@ -1296,6 +1291,7 @@ static int smb347_probe(struct i2c_client *client, + i2c_set_clientdata(client, smb); + + mutex_init(&smb->lock); ++ smb->id = id->driver_data; + smb->dev = &client->dev; + + smb->regmap = devm_regmap_init_i2c(client, &smb347_regmap); +@@ -1370,7 +1366,8 @@ static int smb347_remove(struct i2c_client *client) + } + + static const struct i2c_device_id smb347_id[] = { +- { "smb347", 0 }, ++ { "smb347", SMB347 }, ++ { "smb345", SMB345 }, + { } + }; + MODULE_DEVICE_TABLE(i2c, smb347_id); +@@ -1378,6 +1375,7 @@ MODULE_DEVICE_TABLE(i2c, smb347_id); + #ifdef CONFIG_OF + static struct of_device_id of_smb347_ids[] = { + { .compatible = "summit,smb347" }, ++ { .compatible = "summit,smb345" }, + {}, + }; + #endif diff --git a/aports/device/linux-asus-flo/05_Add_smb345_charger_node.patch b/aports/device/linux-asus-flo/05_Add_smb345_charger_node.patch new file mode 100644 index 00000000..fcc7af0e --- /dev/null +++ b/aports/device/linux-asus-flo/05_Add_smb345_charger_node.patch @@ -0,0 +1,43 @@ +author Vinay Simha BN 2016-10-17 13:45:44 -0700 +committer John Stultz 2017-05-12 14:09:23 -0700 +commit 7c0667f5e450796a1494e05b419aad1a264ee09f (patch) +tree bdae632852a7e70bc14bcb75deffa037b31ac95b +parent 25001b47cca9a155f261d5b8c9acea6150213ca9 (diff) +download flo-7c0667f5e450796a1494e05b419aad1a264ee09f.tar.gz +arm: dts: qcom: apq8064-nexus7: Add smb345 charger node +Add smb345 charger node to nexus7 dts. + +Signed-off-by: Vinay Simha BN +[jstultz: split out from larger patch from Vinay] +Signed-off-by: John Stultz +Diffstat +-rw-r--r-- arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts 17 + +1 files changed, 17 insertions, 0 deletions +diff --git a/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts b/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts +index 3cae48f..03a4b33 100644 +--- a/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts ++++ b/arch/arm/boot/dts/qcom-apq8064-asus-nexus7-flo.dts +@@ -329,6 +329,23 @@ + reg = <0x55>; + }; + ++ smb345@6a { ++ compatible = "summit,smb345"; ++ reg = <0x6a>; ++ status = "okay"; ++ interrupt-parent = <&tlmm_pinmux>; ++ interrupts = <23 IRQ_TYPE_EDGE_BOTH>; ++ ++ max-chg-curr = <1800000>; ++ usb-curr-limit = <450000>; ++ ++ chip-temp-thershold = <110>; ++ ++ enable-usb-charging; ++ enable-otg-charging; ++ ++ enable-chg-ctrl = <0>; /* SW (i2c interface) */ ++ }; + }; + }; diff --git a/aports/device/linux-asus-flo/06_Modify_the_elants_i2c_driver_to_not_immediately_fail_on_Nexus7.patch b/aports/device/linux-asus-flo/06_Modify_the_elants_i2c_driver_to_not_immediately_fail_on_Nexus7.patch new file mode 100644 index 00000000..d6717a80 --- /dev/null +++ b/aports/device/linux-asus-flo/06_Modify_the_elants_i2c_driver_to_not_immediately_fail_on_Nexus7.patch @@ -0,0 +1,41 @@ +author John Stultz 2015-06-22 16:37:30 -0700 +committer John Stultz 2017-05-12 14:09:24 -0700 +commit 18a343b4eb643e0eaf203d812b32b4aff19df17b (patch) +tree 66cf0beff9832db7b6be94bb1ef597654b6fd0d1 +parent 7c0667f5e450796a1494e05b419aad1a264ee09f (diff) +download flo-18a343b4eb643e0eaf203d812b32b4aff19df17b.tar.gz +HACK: Modify the elants_i2c driver to not immediately fail on Nexus7 +So the upstream elants_i2c driver doesn't seem to exactly +support the N7's touch screen, but its close, so tweak the +driver to accept the intial packet and this allows the driver +to load and detect the touchscreen. Allowing data from +/dev/input/event0 to show up on touch events. + +I've not yet validated if that data is at all correct or calibrated, +as that will have to wait for getting the display up and running. + +Signed-off-by: John Stultz +Diffstat +-rw-r--r-- drivers/input/touchscreen/elants_i2c.c 2 + +1 files changed, 1 insertions, 1 deletions +diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c +index 872750e..6079857 100644 +--- a/drivers/input/touchscreen/elants_i2c.c ++++ b/drivers/input/touchscreen/elants_i2c.c +@@ -894,7 +894,6 @@ static irqreturn_t elants_i2c_irq(int irq, void *_dev) + switch (ts->buf[FW_HDR_TYPE]) { + case CMD_HEADER_HELLO: + case CMD_HEADER_RESP: +- case CMD_HEADER_REK: + break; + + case QUEUE_HEADER_WAIT: +@@ -912,6 +911,7 @@ static irqreturn_t elants_i2c_irq(int irq, void *_dev) + elants_i2c_event(ts, &ts->buf[HEADER_SIZE]); + break; + ++ case CMD_HEADER_REK: + case QUEUE_HEADER_NORMAL: + report_count = ts->buf[FW_HDR_COUNT]; + if (report_count == 0 || report_count > 3) { diff --git a/aports/device/linux-asus-flo/07_Get_touchpanel_working_on_flo.patch b/aports/device/linux-asus-flo/07_Get_touchpanel_working_on_flo.patch new file mode 100644 index 00000000..993d8551 --- /dev/null +++ b/aports/device/linux-asus-flo/07_Get_touchpanel_working_on_flo.patch @@ -0,0 +1,60 @@ +author John Stultz 2016-02-24 23:02:26 -0800 +committer John Stultz 2017-05-12 14:09:25 -0700 +commit c347b88add07696addaf87d8ab8233331b02a393 (patch) +tree 91c8279fbc692fb7d4bc9bd651948df47972a111 +parent 18a343b4eb643e0eaf203d812b32b4aff19df17b (diff) +download flo-c347b88add07696addaf87d8ab8233331b02a393.tar.gz +HACK: Get touchpanel working on flo +Hack up the touchpanel to get the x/y coordinates rotated properly. +Also provide proper x_max and y_max values. + +Signed-off-by: John Stultz +Diffstat +-rw-r--r-- drivers/input/touchscreen/elants_i2c.c 12 + +1 files changed, 7 insertions, 5 deletions +diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c +index 6079857..6983302 100644 +--- a/drivers/input/touchscreen/elants_i2c.c ++++ b/drivers/input/touchscreen/elants_i2c.c +@@ -801,8 +801,8 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf) + u8 *pos; + + pos = &buf[FW_POS_XY + i * 3]; +- x = (((u16)pos[0] & 0xf0) << 4) | pos[1]; +- y = (((u16)pos[0] & 0x0f) << 8) | pos[2]; ++ y = 2240-((((u16)pos[0] & 0xf0) << 4) | pos[1]); ++ x = ((((u16)pos[0] & 0x0f) << 8) | pos[2]); + p = buf[FW_POS_PRESSURE + i]; + w = buf[FW_POS_WIDTH + i]; + +@@ -1233,8 +1233,9 @@ static int elants_i2c_probe(struct i2c_client *client, + ts->input->name = "Elan Touchscreen"; + ts->input->id.bustype = BUS_I2C; + +- __set_bit(BTN_TOUCH, ts->input->keybit); + __set_bit(EV_ABS, ts->input->evbit); ++#if 0 ++ __set_bit(BTN_TOUCH, ts->input->keybit); + __set_bit(EV_KEY, ts->input->evbit); + + /* Single touch input params setup */ +@@ -1243,6 +1244,7 @@ static int elants_i2c_probe(struct i2c_client *client, + input_set_abs_params(ts->input, ABS_PRESSURE, 0, 255, 0, 0); + input_abs_set_res(ts->input, ABS_X, ts->x_res); + input_abs_set_res(ts->input, ABS_Y, ts->y_res); ++#endif + + /* Multitouch input params setup */ + error = input_mt_init_slots(ts->input, MAX_CONTACT_NUM, +@@ -1253,8 +1255,8 @@ static int elants_i2c_probe(struct i2c_client *client, + return error; + } + +- input_set_abs_params(ts->input, ABS_MT_POSITION_X, 0, ts->x_max, 0, 0); +- input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, ts->y_max, 0, 0); ++ input_set_abs_params(ts->input, ABS_MT_POSITION_X, 0, 1350, 0, 0); ++ input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, 2240, 0, 0); + input_set_abs_params(ts->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); + input_set_abs_params(ts->input, ABS_MT_PRESSURE, 0, 255, 0, 0); + input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res); diff --git a/aports/device/linux-asus-flo/08_Add_mac_address.patch b/aports/device/linux-asus-flo/08_Add_mac_address.patch new file mode 100644 index 00000000..d30e54ea --- /dev/null +++ b/aports/device/linux-asus-flo/08_Add_mac_address.patch @@ -0,0 +1,26 @@ +author John Stultz 2017-01-03 22:40:13 -0800 +committer John Stultz 2017-05-12 14:09:26 -0700 +commit 7c27abcb9687786bc4a05885c308cc0a22b909ba (patch) +tree 175188552e1f1d7874c3b08e826f2591164d4728 +parent 5e3530082e5adf009a867364b76f9db013e49dc9 (diff) +download flo-7c27abcb9687786bc4a05885c308cc0a22b909ba.tar.gz +HACK: add mac address +Re-add mac address bits + +Signed-off-by: John Stultz +Diffstat +-rw-r--r-- arch/arm/boot/dts/qcom-apq8064.dtsi 1 + +1 files changed, 1 insertions, 0 deletions +diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi +index f3db185..0fae486 100644 +--- a/arch/arm/boot/dts/qcom-apq8064.dtsi ++++ b/arch/arm/boot/dts/qcom-apq8064.dtsi +@@ -1528,6 +1528,7 @@ + + qcom,smem-states = <&apps_smsm 10>, <&apps_smsm 9>; + qcom,smem-state-names = "tx-enable", "tx-rings-empty"; ++ local-mac-address = [ 18 00 2d 88 9c a9 ]; + }; + }; + }; diff --git a/aports/device/linux-asus-flo/09_Make_of_dma_deconfigure()_public.patch b/aports/device/linux-asus-flo/09_Make_of_dma_deconfigure()_public.patch new file mode 100644 index 00000000..c5a4660c --- /dev/null +++ b/aports/device/linux-asus-flo/09_Make_of_dma_deconfigure()_public.patch @@ -0,0 +1,81 @@ +author Laurent Pinchart 2015-05-15 02:00:05 +0300 +committer John Stultz 2017-05-12 12:39:34 -0700 +commit 6dd93436bf11ccd9fef459b8dc9f58c8635a6230 (patch) +tree 8855dd8b458c81c573d372354a3743bfde1691c0 +parent da8cb6993ea1b433adec1059b65db265b2fe85f3 (diff) +download flo-6dd93436bf11ccd9fef459b8dc9f58c8635a6230.tar.gz +of: dma: Make of_dma_deconfigure() public +As part of moving DMA initializing to probe time the +of_dma_deconfigure() function will need to be called from different +source files. Make it public and move it to drivers/of/device.c where +the of_dma_configure() function is. + +Signed-off-by: Laurent Pinchart +Diffstat +-rw-r--r-- drivers/of/device.c 12 + +-rw-r--r-- drivers/of/platform.c 5 + +-rw-r--r-- include/linux/of_device.h 3 + +3 files changed, 15 insertions, 5 deletions +diff --git a/drivers/of/device.c b/drivers/of/device.c +index b1e6beb..0d378c0 100644 +--- a/drivers/of/device.c ++++ b/drivers/of/device.c +@@ -151,6 +151,18 @@ void of_dma_configure(struct device *dev, struct device_node *np) + } + EXPORT_SYMBOL_GPL(of_dma_configure); + ++/** ++ * of_dma_deconfigure - Clean up DMA configuration ++ * @dev: Device for which to clean up DMA configuration ++ * ++ * Clean up all configuration performed by of_dma_configure_ops() and free all ++ * resources that have been allocated. ++ */ ++void of_dma_deconfigure(struct device *dev) ++{ ++ arch_teardown_dma_ops(dev); ++} ++ + int of_device_register(struct platform_device *pdev) + { + device_initialize(&pdev->dev); +diff --git a/drivers/of/platform.c b/drivers/of/platform.c +index 5dfcc96..5344db5 100644 +--- a/drivers/of/platform.c ++++ b/drivers/of/platform.c +@@ -158,11 +158,6 @@ struct platform_device *of_device_alloc(struct device_node *np, + } + EXPORT_SYMBOL(of_device_alloc); + +-static void of_dma_deconfigure(struct device *dev) +-{ +- arch_teardown_dma_ops(dev); +-} +- + /** + * of_platform_device_create_pdata - Alloc, initialize and register an of_device + * @np: pointer to node to create device for +diff --git a/include/linux/of_device.h b/include/linux/of_device.h +index c12dace..af98455 100644 +--- a/include/linux/of_device.h ++++ b/include/linux/of_device.h +@@ -56,6 +56,7 @@ static inline struct device_node *of_cpu_device_node_get(int cpu) + } + + void of_dma_configure(struct device *dev, struct device_node *np); ++void of_dma_deconfigure(struct device *dev); + #else /* CONFIG_OF */ + + static inline int of_driver_match_device(struct device *dev, +@@ -105,6 +106,8 @@ static inline struct device_node *of_cpu_device_node_get(int cpu) + } + static inline void of_dma_configure(struct device *dev, struct device_node *np) + {} ++static inline void of_dma_deconfigure(struct device *dev) ++{} + #endif /* CONFIG_OF */ + + #endif /* _LINUX_OF_DEVICE_H */ diff --git a/aports/device/linux-asus-flo/10_Split_of_configure_dma()_into_mask_and_ops_configuration.patch b/aports/device/linux-asus-flo/10_Split_of_configure_dma()_into_mask_and_ops_configuration.patch new file mode 100644 index 00000000..fa86a879 --- /dev/null +++ b/aports/device/linux-asus-flo/10_Split_of_configure_dma()_into_mask_and_ops_configuration.patch @@ -0,0 +1,183 @@ +author Laurent Pinchart 2015-05-15 02:00:06 +0300 +committer John Stultz 2017-05-12 12:39:36 -0700 +commit b3c0228dd8468ab9a9da3b70b2a011ffb855091b (patch) +tree 98ebf97c7cb6a3b42602124fcef49d2c78b992d7 +parent 6dd93436bf11ccd9fef459b8dc9f58c8635a6230 (diff) +download flo-b3c0228dd8468ab9a9da3b70b2a011ffb855091b.tar.gz +of: dma: Split of_configure_dma() into mask and ops configuration +The of_configure_dma() function configures both the DMA masks and ops. +Moving DMA ops configuration to probe time would thus also delay +configuration of the DMA masks, which might not be safe. To avoid issues +split the configuration in two to allow keeping masks configuration at +device add time and move ops configuration to device probe time. + +Signed-off-by: Laurent Pinchart +Diffstat +-rw-r--r-- drivers/of/device.c 47 + +-rw-r--r-- drivers/of/of_reserved_mem.c 3 + +-rw-r--r-- drivers/of/platform.c 6 + +-rw-r--r-- include/linux/of_device.h 11 + +4 files changed, 50 insertions, 17 deletions +diff --git a/drivers/of/device.c b/drivers/of/device.c +index 0d378c0..d73bfa19 100644 +--- a/drivers/of/device.c ++++ b/drivers/of/device.c +@@ -71,7 +71,7 @@ int of_device_add(struct platform_device *ofdev) + } + + /** +- * of_dma_configure - Setup DMA configuration ++ * of_dma_configure - Setup DMA masks and offset + * @dev: Device to apply DMA configuration + * @np: Pointer to OF node having DMA configuration + * +@@ -82,13 +82,12 @@ int of_device_add(struct platform_device *ofdev) + * can use a platform bus notifier and handle BUS_NOTIFY_ADD_DEVICE events + * to fix up DMA configuration. + */ +-void of_dma_configure(struct device *dev, struct device_node *np) ++void of_dma_configure_masks(struct device *dev, struct device_node *np) + { +- u64 dma_addr, paddr, size; +- int ret; +- bool coherent; ++ u64 dma_addr, paddr, size, range_mask; + unsigned long offset; + const struct iommu_ops *iommu; ++ int ret; + + /* + * Set default coherent_dma_mask to 32 bit. Drivers are expected to +@@ -106,9 +105,10 @@ void of_dma_configure(struct device *dev, struct device_node *np) + + ret = of_dma_get_range(np, &dma_addr, &paddr, &size); + if (ret < 0) { +- dma_addr = offset = 0; +- size = dev->coherent_dma_mask + 1; ++ range_mask = dev->coherent_dma_mask + 1; ++ offset = 0; + } else { ++ range_mask = DMA_BIT_MASK(ilog2(dma_addr + size)); + offset = PFN_DOWN(paddr - dma_addr); + + /* +@@ -134,10 +134,31 @@ void of_dma_configure(struct device *dev, struct device_node *np) + * Limit coherent and dma mask based on size and default mask + * set by the driver. + */ +- dev->coherent_dma_mask = min(dev->coherent_dma_mask, +- DMA_BIT_MASK(ilog2(dma_addr + size))); +- *dev->dma_mask = min((*dev->dma_mask), +- DMA_BIT_MASK(ilog2(dma_addr + size))); ++ dev->coherent_dma_mask = min(dev->coherent_dma_mask, range_mask); ++ *dev->dma_mask = min((*dev->dma_mask), range_mask); ++} ++EXPORT_SYMBOL_GPL(of_dma_configure_masks); ++ ++/** ++ * of_dma_configure_ops - Setup DMA operations ++ * @dev: Device to apply DMA configuration ++ * @np: Pointer to OF node having DMA configuration ++ * ++ * Try to get devices's DMA configuration from DT and update it ++ * accordingly. ++ */ ++int of_dma_configure_ops(struct device *dev, struct device_node *np) ++{ ++ u64 dma_addr, paddr, size; ++ struct iommu_ops *iommu; ++ bool coherent; ++ int ret; ++ ++ ret = of_dma_get_range(np, &dma_addr, &paddr, &size); ++ if (ret < 0) { ++ dma_addr = 0; ++ size = dev->coherent_dma_mask + 1; ++ } + + coherent = of_dma_is_coherent(np); + dev_dbg(dev, "device is%sdma coherent\n", +@@ -148,8 +169,10 @@ void of_dma_configure(struct device *dev, struct device_node *np) + iommu ? " " : " not "); + + arch_setup_dma_ops(dev, dma_addr, size, iommu, coherent); ++ ++ return 0; + } +-EXPORT_SYMBOL_GPL(of_dma_configure); ++EXPORT_SYMBOL_GPL(of_dma_configure_ops); + + /** + * of_dma_deconfigure - Clean up DMA configuration +diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c +index d507c35..a145480 100644 +--- a/drivers/of/of_reserved_mem.c ++++ b/drivers/of/of_reserved_mem.c +@@ -357,7 +357,8 @@ int of_reserved_mem_device_init_by_idx(struct device *dev, + /* ensure that dma_ops is set for virtual devices + * using reserved memory + */ +- of_dma_configure(dev, np); ++ of_dma_configure_masks(dev, np); ++ of_dma_configure_ops(dev, np); + + dev_info(dev, "assigned reserved memory node %s\n", rmem->name); + } else { +diff --git a/drivers/of/platform.c b/drivers/of/platform.c +index 5344db5..a2d27bc 100644 +--- a/drivers/of/platform.c ++++ b/drivers/of/platform.c +@@ -186,7 +186,8 @@ static struct platform_device *of_platform_device_create_pdata( + + dev->dev.bus = &platform_bus_type; + dev->dev.platform_data = platform_data; +- of_dma_configure(&dev->dev, dev->dev.of_node); ++ of_dma_configure_masks(&dev->dev, dev->dev.of_node); ++ of_dma_configure_ops(&dev->dev, dev->dev.of_node); + of_msi_configure(&dev->dev, dev->dev.of_node); + + if (of_device_add(dev) != 0) { +@@ -248,7 +249,8 @@ static struct amba_device *of_amba_device_create(struct device_node *node, + dev_set_name(&dev->dev, "%s", bus_id); + else + of_device_make_bus_id(&dev->dev); +- of_dma_configure(&dev->dev, dev->dev.of_node); ++ of_dma_configure_masks(&dev->dev, dev->dev.of_node); ++ of_dma_configure_ops(&dev->dev, dev->dev.of_node); + + /* Allow the HW Peripheral ID to be overridden */ + prop = of_get_property(node, "arm,primecell-periphid", NULL); +diff --git a/include/linux/of_device.h b/include/linux/of_device.h +index af98455..8c70184 100644 +--- a/include/linux/of_device.h ++++ b/include/linux/of_device.h +@@ -55,7 +55,8 @@ static inline struct device_node *of_cpu_device_node_get(int cpu) + return of_node_get(cpu_dev->of_node); + } + +-void of_dma_configure(struct device *dev, struct device_node *np); ++void of_dma_configure_masks(struct device *dev, struct device_node *np); ++int of_dma_configure_ops(struct device *dev, struct device_node *np); + void of_dma_deconfigure(struct device *dev); + #else /* CONFIG_OF */ + +@@ -104,8 +105,14 @@ static inline struct device_node *of_cpu_device_node_get(int cpu) + { + return NULL; + } +-static inline void of_dma_configure(struct device *dev, struct device_node *np) ++static inline void of_dma_configure_masks(struct device *dev, ++ struct device_node *np) + {} ++static inline int of_dma_configure_ops(struct device *dev, ++ struct device_node *np) ++{ ++ return 0; ++} + static inline void of_dma_deconfigure(struct device *dev) + {} + #endif /* CONFIG_OF */ diff --git a/aports/device/linux-asus-flo/11_Configure_dma_operations_at_probe_time.patch b/aports/device/linux-asus-flo/11_Configure_dma_operations_at_probe_time.patch new file mode 100644 index 00000000..a5fb960e --- /dev/null +++ b/aports/device/linux-asus-flo/11_Configure_dma_operations_at_probe_time.patch @@ -0,0 +1,82 @@ +author Laurent Pinchart 2015-05-15 02:00:07 +0300 +committer John Stultz 2017-05-12 12:39:37 -0700 +commit 4d4d7186492648fe2517178b983fcd5a55e3d575 (patch) +tree fea85da4e2e33bac4712d8c0ab66a0d0624920f8 +parent b3c0228dd8468ab9a9da3b70b2a011ffb855091b (diff) +download flo-4d4d7186492648fe2517178b983fcd5a55e3d575.tar.gz +drivers: platform: Configure dma operations at probe time +Configuring DMA ops at probe time will allow deferring device probe when +the IOMMU isn't available yet. + +Signed-off-by: Laurent Pinchart +Diffstat +-rw-r--r-- drivers/base/platform.c 9 + +-rw-r--r-- drivers/of/platform.c 7 + +2 files changed, 12 insertions, 4 deletions +diff --git a/drivers/base/platform.c b/drivers/base/platform.c +index c245683..1526298 100644 +--- a/drivers/base/platform.c ++++ b/drivers/base/platform.c +@@ -572,6 +572,10 @@ static int platform_drv_probe(struct device *_dev) + if (ret < 0) + return ret; + ++ ret = of_dma_configure_ops(_dev, _dev->of_node); ++ if (ret < 0) ++ goto done; ++ + ret = dev_pm_domain_attach(_dev, true); + if (ret != -EPROBE_DEFER) { + if (drv->probe) { +@@ -584,6 +588,10 @@ static int platform_drv_probe(struct device *_dev) + } + } + ++ if (ret) ++ of_dma_deconfigure(_dev); ++ ++done: + if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) { + dev_warn(_dev, "probe deferral not supported\n"); + ret = -ENXIO; +@@ -606,6 +614,7 @@ static int platform_drv_remove(struct device *_dev) + if (drv->remove) + ret = drv->remove(dev); + dev_pm_domain_detach(_dev, true); ++ of_dma_deconfigure(_dev); + + return ret; + } +diff --git a/drivers/of/platform.c b/drivers/of/platform.c +index a2d27bc..967f6ce 100644 +--- a/drivers/of/platform.c ++++ b/drivers/of/platform.c +@@ -187,11 +187,9 @@ static struct platform_device *of_platform_device_create_pdata( + dev->dev.bus = &platform_bus_type; + dev->dev.platform_data = platform_data; + of_dma_configure_masks(&dev->dev, dev->dev.of_node); +- of_dma_configure_ops(&dev->dev, dev->dev.of_node); + of_msi_configure(&dev->dev, dev->dev.of_node); + + if (of_device_add(dev) != 0) { +- of_dma_deconfigure(&dev->dev); + platform_device_put(dev); + goto err_clear_flag; + } +@@ -540,11 +538,12 @@ static int of_platform_device_destroy(struct device *dev, void *data) + if (dev->bus == &platform_bus_type) + platform_device_unregister(to_platform_device(dev)); + #ifdef CONFIG_ARM_AMBA +- else if (dev->bus == &amba_bustype) ++ else if (dev->bus == &amba_bustype) { + amba_device_unregister(to_amba_device(dev)); ++ of_dma_deconfigure(dev); ++ } + #endif + +- of_dma_deconfigure(dev); + of_node_clear_flag(dev->of_node, OF_POPULATED); + of_node_clear_flag(dev->of_node, OF_POPULATED_BUS); + return 0; diff --git a/aports/device/linux-asus-flo/12_Handle_IOMMU_lookup_failure_with_deferred_probing_or_error.patch b/aports/device/linux-asus-flo/12_Handle_IOMMU_lookup_failure_with_deferred_probing_or_error.patch new file mode 100644 index 00000000..004fd6a3 --- /dev/null +++ b/aports/device/linux-asus-flo/12_Handle_IOMMU_lookup_failure_with_deferred_probing_or_error.patch @@ -0,0 +1,93 @@ +author Laurent Pinchart 2015-05-15 02:00:09 +0300 +committer John Stultz 2017-05-12 12:39:38 -0700 +commit c0648aa6e6063285cec2a15fecd360a3b4394af4 (patch) +tree 0f23e82630929c7307560803faa4bf9b489ddd52 +parent 4d4d7186492648fe2517178b983fcd5a55e3d575 (diff) +download flo-c0648aa6e6063285cec2a15fecd360a3b4394af4.tar.gz +iommu: of: Handle IOMMU lookup failure with deferred probing or error +Failures to look up an IOMMU when parsing the DT iommus property need to +be handled separately from the .of_xlate() failures to support deferred +probing. + +The lack of a registered IOMMU can be caused by the lack of a driver for +the IOMMU, the IOMMU device probe not having been performed yet, having +been deferred, or having failed. + +The first case occurs when the device tree describes the bus master and +IOMMU topology correctly but no device driver exists for the IOMMU yet +or the device driver has not been compiled in. Return NULL, the caller +will configure the device without an IOMMU. + +The second and third cases are handled by deferring the probe of the bus +master device which will eventually get reprobed after the IOMMU. + +The last case is currently handled by deferring the probe of the bus +master device as well. A mechanism to either configure the bus master +device without an IOMMU or to fail the bus master device probe depending +on whether the IOMMU is optional or mandatory would be a good +enhancement. + +Signed-off-by: Laurent Pinchart +Diffstat +-rw-r--r-- drivers/iommu/of_iommu.c 18 + +-rw-r--r-- drivers/of/device.c 2 + +2 files changed, 16 insertions, 4 deletions +diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c +index 2683e9f..b171b2c 100644 +--- a/drivers/iommu/of_iommu.c ++++ b/drivers/iommu/of_iommu.c +@@ -159,10 +159,20 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, + np = iommu_spec.np; + ops = iommu_ops_from_fwnode(&np->fwnode); + +- if (!ops || !ops->of_xlate || ++ if (!ops) { ++ const struct of_device_id *oid; ++ ++ oid = of_match_node(&__iommu_of_table, np); ++ ops = oid ? ERR_PTR(-EPROBE_DEFER) : NULL; ++ goto err_put_node; ++ } ++ ++ if (!ops->of_xlate || + iommu_fwspec_init(dev, &np->fwnode, ops) || +- ops->of_xlate(dev, &iommu_spec)) ++ ops->of_xlate(dev, &iommu_spec)) { ++ ops = NULL; + goto err_put_node; ++ } + + of_node_put(np); + idx++; +@@ -172,7 +182,7 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, + + err_put_node: + of_node_put(np); +- return NULL; ++ return ops; + } + + static int __init of_iommu_init(void) +@@ -183,7 +193,7 @@ static int __init of_iommu_init(void) + for_each_matching_node_and_match(np, matches, &match) { + const of_iommu_init_fn init_fn = match->data; + +- if (init_fn(np)) ++ if (init_fn && init_fn(np)) + pr_err("Failed to initialise IOMMU %s\n", + of_node_full_name(np)); + } +diff --git a/drivers/of/device.c b/drivers/of/device.c +index d73bfa19..22365aa 100644 +--- a/drivers/of/device.c ++++ b/drivers/of/device.c +@@ -165,6 +165,8 @@ int of_dma_configure_ops(struct device *dev, struct device_node *np) + coherent ? " " : " not "); + + iommu = of_iommu_configure(dev, np); ++ if (IS_ERR(iommu)) ++ return PTR_ERR(iommu); + dev_dbg(dev, "device is%sbehind an iommu\n", + iommu ? " " : " not "); diff --git a/aports/device/linux-asus-flo/APKBUILD b/aports/device/linux-asus-flo/APKBUILD index a7a87f4f..84c8263d 100644 --- a/aports/device/linux-asus-flo/APKBUILD +++ b/aports/device/linux-asus-flo/APKBUILD @@ -1,39 +1,61 @@ _vendor=asus _flavor=asus-flo -_hash="26da7a1e84232d3f0fd89e2dae2e48e77db00873" _config="config-${_flavor}.armhf" - pkgname=linux-${_flavor} -pkgver=4.11 -case $pkgver in - *.*.*) _kernver=${pkgver%.*};; - *.*) _kernver=$pkgver;; -esac -pkgrel=3 +pkgver=4.11.12 +pkgrel=0 arch="armhf" -pkgdesc="Nexus 7 2013 WIFI mainline kernel" +pkgdesc="Upstream stable kernel with patches for Nexus 7 2013 WIFI" url="https://git.linaro.org/people/john.stultz/flo.git/log/?h=flo-v4.11" - depends="postmarketos-mkinitfs" makedepends="xz perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev" options="!strip !check !tracedeps" install= -source=" - $pkgname-$_hash.tar.gz::https://git.linaro.org/people/john.stultz/flo.git/snapshot/flo-$_hash.tar.gz +source="$pkgname-$pkgver.tar.xz::https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$pkgver.tar.xz $_config -" + 00_Collapse_usb_support_into_one_node.patch + 01_Add_regulator_tweaks_and_wcnss_entry_to_support_wifi.patch + 02_Avoid_sending_high_rates_to_downstream_clocks_during_set_rate.patch + 03_Support_devicetree_binding.patch + 04_Summit_SMB345_charger_IC.patch + 05_Add_smb345_charger_node.patch + 06_Modify_the_elants_i2c_driver_to_not_immediately_fail_on_Nexus7.patch + 07_Get_touchpanel_working_on_flo.patch + 08_Add_mac_address.patch + 09_Make_of_dma_deconfigure()_public.patch + 10_Split_of_configure_dma()_into_mask_and_ops_configuration.patch + 11_Configure_dma_operations_at_probe_time.patch + 12_Handle_IOMMU_lookup_failure_with_deferred_probing_or_error.patch + " subpackages="" license="GPL2" - _abi_release=${pkgver} _carch="arm" HOSTCC="${CC:-gcc}" HOSTCC="${HOSTCC#${CROSS_COMPILE}}" - -ksrcdir="$srcdir/flo-$_hash" +ksrcdir="$srcdir/linux-$pkgver" prepare() { - default_prepare + local _patch_failed= + cd "$ksrcdir" + # first apply patches in specified order + for i in $source; do + case $i in + *.patch) + msg "Applying $i..." + if ! patch -s -p1 -N -i "$srcdir"/$i; then + echo $i >>failed + _patch_failed=1 + fi + ;; + esac + done + + if ! [ -z "$_patch_failed" ]; then + error "The following patches failed:" + cat failed + return 1 + fi mkdir -p "$srcdir"/build cp "$srcdir"/$_config "$srcdir"/build/.config @@ -69,9 +91,25 @@ package() { "$pkgdir/usr/share/kernel/$_flavor/kernel.release" cd "$srcdir"/build - make -j1 modules_install \ - ARCH="$_carch" \ - INSTALL_MOD_PATH="$pkgdir" + unset LDFLAGS + + echo "--[ Installing modules ]--" + make ARCH="$_carch" CC="${CC:-gcc}" \ + KBUILD_BUILD_VERSION="$((pkgrel + 1))-Alpine" \ + INSTALL_MOD_PATH="$pkgdir" INSTALL_MOD_STRIP=1 modules_install } -sha512sums="13c16e580a960c4c4ed4daf13f1939909617cb91455d1c61323ddf1b98a8f492161a6be6ddcf317dd16786c5ef4f98f77175c9972ce7aae99f7e6f0570a665b6 linux-asus-flo-26da7a1e84232d3f0fd89e2dae2e48e77db00873.tar.gz -1c32a6190d0561f2144fc5922477f24a2390464773d9100da5cd00df57639dec3071dc5c7c94ed30435c00d372c41bc40933614ccd497e394fe1d14116735eb4 config-asus-flo.armhf" +sha512sums="92a40984e2706e18c392dcd9b8d64261c138a228de335fe63501ceae3d89adaff7d211e3fd849f859ce3869292ff7bffc935aefe40e1abaf457d2e3210b4f4ef linux-asus-flo-4.11.12.tar.xz +d7adf1aa8b0fac53ae62d456a6b3b95ecef6c0f4c8532b281c13307480ba04a37a996b6a32fcfff10058b26f7dfae07e8e48247d5d0f9dedb4f30f69b06c7a1a config-asus-flo.armhf +c79d93af715c59188c7fccbb0402623b599b2e9fed944bb444d0ea2279e4086fc2b9f9e30aac468331b0a25150e537cd1647dd5cb6f47b53bf0af573cf6c7c67 00_Collapse_usb_support_into_one_node.patch +f11d7351873aecc73c612fa3d6f9411c6f777bdb502dc9ba918cd824fbb36596c476b164fb9cf7eac2fa1c9484fa21b78ec8d03c13f959933cb5c1e30ed54754 01_Add_regulator_tweaks_and_wcnss_entry_to_support_wifi.patch +303b25b44280dfbaa4b85f6dbeabc7752956b69fa7b85a1d837947ef490327a1228789bf57077d90e7c669b2f79d35c927ca423d4bbffeecdf7c1369af1120fb 02_Avoid_sending_high_rates_to_downstream_clocks_during_set_rate.patch +412f1d3245831b37a0fe95622fae7af607b0df364317f828f0c5bba06c616efc78aff5d58de8d0ebe7b0f55032dbc7d5a807220e56ba676b47b25176c7e3d583 03_Support_devicetree_binding.patch +ebd987d3cc0c5515e042c7bc8bd89d8b951d0cd4a0fb74a3dd45333698812e299d0f9477988740d00417e6e84e21a97a67a7496f3c18dc5c13f3cf36044dceb9 04_Summit_SMB345_charger_IC.patch +0e2baf625cab807f645110b2a10f7e6c5eceac78433cedbe644b87bcdd0a4e71768107623b8a2a7b52033af1db6414f460f79ebcb71373300d720469cc90cdab 05_Add_smb345_charger_node.patch +b86e56c653f0426a0d2a4fb500a11bdce7739b48d053ff584bd6ee1e560fc7f7759cc8fe12c96da182e6ef126e0c687015f771d7b9c4a61c5f08a5a55b8eeb0a 06_Modify_the_elants_i2c_driver_to_not_immediately_fail_on_Nexus7.patch +957b3c317364c5f4973a09b18837101137fff6dfd97254fda1d9fc255e0e2277341cefd2cc9582dc275e2ec7c81fcaa3d7b544eed6c72cdfc4c04f5de80aa960 07_Get_touchpanel_working_on_flo.patch +7dcc9de43ed0e9f433f73e78999b9533f0e1d48ede06bebe32ac621513a49f6900dd80bb7c2ca06f67421b3826e5624f20e0e2fa3c0150efe7933895f21942df 08_Add_mac_address.patch +cc7fb2d646c1d602b507fa2d6ce77458e794e27d624ed0097cc35ce0486e71e4dd4cec96cdb8aaf5800126ec172efd30e1fd4706754eddb48a952d587284af32 09_Make_of_dma_deconfigure()_public.patch +e031b821cce7a561752aeb6837c93b97438c1bc1e81efa3bdda931ad552b515ffc89872b3df300ba8704bccd672a73af22974b49493e1f7ad5a8c652e43158af 10_Split_of_configure_dma()_into_mask_and_ops_configuration.patch +38a539a97d8dd00be1ec2ab7bdb72caafe16865cba4b7a7152cf6b78ce0c9cf6206163f3edfd3a8371098a422647fbd3e83b2d89692e7d0675a51f4cad279e44 11_Configure_dma_operations_at_probe_time.patch +25e9f71f038e1ef41c31a472f49487b63604668610232bec3842460dd67955c70158982744e51cf96143f0c5d2402b99bb86aec1d5e3bd9841ca5c11087a0b1b 12_Handle_IOMMU_lookup_failure_with_deferred_probing_or_error.patch" diff --git a/aports/device/linux-asus-flo/config-asus-flo.armhf b/aports/device/linux-asus-flo/config-asus-flo.armhf index 6ebdc4ef..3106be23 100644 --- a/aports/device/linux-asus-flo/config-asus-flo.armhf +++ b/aports/device/linux-asus-flo/config-asus-flo.armhf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 4.11.0 Kernel Configuration +# Linux/arm 4.11.12 Kernel Configuration # CONFIG_ARM=y CONFIG_ARM_HAS_SG_CHAIN=y @@ -743,7 +743,7 @@ CONFIG_IPV6_MROUTE=y # CONFIG_IPV6_SEG6_LWTUNNEL is not set # CONFIG_IPV6_SEG6_HMAC is not set # CONFIG_NETLABEL is not set -CONFIG_NETWORK_SECMARK=y +# CONFIG_NETWORK_SECMARK is not set # CONFIG_NET_PTP_CLASSIFY is not set # CONFIG_NETWORK_PHY_TIMESTAMPING is not set CONFIG_NETFILTER=y @@ -761,7 +761,6 @@ CONFIG_NETFILTER_NETLINK_LOG=y CONFIG_NF_CONNTRACK=y # CONFIG_NF_LOG_NETDEV is not set CONFIG_NF_CONNTRACK_MARK=y -CONFIG_NF_CONNTRACK_SECMARK=y CONFIG_NF_CONNTRACK_PROCFS=y CONFIG_NF_CONNTRACK_EVENTS=y # CONFIG_NF_CONNTRACK_TIMEOUT is not set @@ -833,7 +832,6 @@ CONFIG_NETFILTER_XT_CONNMARK=y # CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y CONFIG_NETFILTER_XT_TARGET_CONNMARK=y -CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y # CONFIG_NETFILTER_XT_TARGET_CT is not set # CONFIG_NETFILTER_XT_TARGET_DSCP is not set # CONFIG_NETFILTER_XT_TARGET_HL is not set @@ -851,7 +849,6 @@ CONFIG_NETFILTER_XT_TARGET_REDIRECT=y # CONFIG_NETFILTER_XT_TARGET_TEE is not set CONFIG_NETFILTER_XT_TARGET_TPROXY=y CONFIG_NETFILTER_XT_TARGET_TRACE=y -CONFIG_NETFILTER_XT_TARGET_SECMARK=y CONFIG_NETFILTER_XT_TARGET_TCPMSS=y # CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set @@ -1965,7 +1962,7 @@ CONFIG_SERIAL_MSM_CONSOLE=y CONFIG_HW_RANDOM=y # CONFIG_HW_RANDOM_TIMERIOMEM is not set # CONFIG_HW_RANDOM_VIRTIO is not set -# CONFIG_HW_RANDOM_MSM is not set +CONFIG_HW_RANDOM_MSM=y # CONFIG_R3964 is not set # CONFIG_RAW_DRIVER is not set # CONFIG_TCG_TPM is not set @@ -2946,9 +2943,10 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y # CONFIG_USB_DEFAULT_PERSIST=y # CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_OTG is not set +CONFIG_USB_OTG=y # CONFIG_USB_OTG_WHITELIST is not set # CONFIG_USB_OTG_BLACKLIST_HUB is not set +CONFIG_USB_OTG_FSM=y CONFIG_USB_MON=y # CONFIG_USB_WUSB_CBAF is not set