diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 000000000000..58917f3e1780 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,29 @@ +--- +kind: pipeline +type: docker +name: kernel_xiaomi_raphael + +platform: + os: linux + arch: amd64 + +clone: + depth: 1 + +steps: +- name: immensity_kernel + image: ubuntu:latest + environment: + CI_CHANNEL_ID: + from_secret: ci_channel_id + BOT_API_KEY: + from_secret: bot_api_key + RELEASE_VERSION: "test" + commands: + - apt-get update && apt-get install -y bison build-essential bc bison curl libssl-dev git zip python flex + - git clone --depth=1 https://github.com/UtsavBalar1231/scripts.git -b master script && cd script + - ./dronesetup.sh --proton + - ./kernel.sh --proton + when: + branch: + - auto-kernel-ci diff --git a/Documentation/devicetree/bindings/arm/msm/msm.txt b/Documentation/devicetree/bindings/arm/msm/msm.txt index b58a1eb312ee..288832098310 100644 --- a/Documentation/devicetree/bindings/arm/msm/msm.txt +++ b/Documentation/devicetree/bindings/arm/msm/msm.txt @@ -106,12 +106,6 @@ SoCs: - SDA429W compatible = "qcom,sda429w" -- QCM6125 - compatible = "qcom,qcm6125" - -- QCS6125 - compatible = "qcom,qcs6125" - - SA2145P compatible = "qcom,sa2145p" @@ -168,6 +162,11 @@ Generic board variants: - TTP device: compatible = "qcom,ttp" +- TRINKET-IOT + compatible = "qcom,trinket-iot" + +- TRINKETP-IOT + compatible = "qcom,trinketp-iot" Boards (SoC type + board variant): @@ -311,7 +310,7 @@ compatible = "qcom,sda429w-wdp" compatible = "qcom,sda429-wdp" compatible = "qcom,sdm429w-wdp" compatible = "qcom,sdm429-wdp" -compatible = "qcom,qcm6125" -compatible = "qcom,qcs6125" -compatible = "qcom,qcm6125-idp" -compatible = "qcom,qcs6125-idp" +compatible = "qcom,trinket-iot" +compatible = "qcom,trinketp-iot" +compatible = "qcom,trinket-iot-idp" +compatible = "qcom,trinketp-iot-idp" diff --git a/Documentation/devicetree/bindings/net/qcom,sja1105p-eth-switch.txt b/Documentation/devicetree/bindings/net/qcom,sja1105p-eth-switch.txt new file mode 100644 index 000000000000..701ba523fd59 --- /dev/null +++ b/Documentation/devicetree/bindings/net/qcom,sja1105p-eth-switch.txt @@ -0,0 +1,64 @@ +* NXP SJA1105P 10/100/1000 Ethernet Switch Driver + +Required properties: +### Properties of top level +- compatible: Should be "qcom,nxp,sja1105p-switch". +- reg: Should contain SPI chip select. +- spi-max-frequency: Should contain maximum spi clock frequency + for slave device. +- spi-cpha: SPI configuration to enable shift clock phase (CPHA) mode. +- switch-speed: Should contain switch ports speed 10/100/1000 Mbps. +- pinctrl-names : Names corresponding to the numbered pinctrl states +- pinctrl- : Pinctrl states as described in bindings/pinctrl/pinctrl-bindings.txt +- qcom,reset-gpio: Reference to the GPIO connected to the reset input. + +### Properties of the port-X child node +- `null-phy`: Determines if the port has a PHY connected to it or not +- `phy-ref`: _phandle_ to the connected ethernet PHY + **NOTE**: Must be `0x00` in case there is no PHY connected to port-X + (for example if port-X is a host port or a cascaded port) +- `logical-port-num`: logical port number, used for the port mapping + **NOTE**: Must be `0xff` in case port-X is a cascaded port. + +Example: + + sja1105: ethernet-switch@0{ + compatible = "qcom,nxp,sja1105p-switch"; + reg = <0>; + spi-max-frequency = <12000000>; + spi-cpha; + switch-speed = <1000>; + pinctrl-names = "default"; + pinctrl-0 = <&sja1105_default>; + qcom,reset-gpio = <&tlmm 91 0x1>; + + port-0 { + null-phy = <0x1>; + phy-ref = < 0 >; + logical-port-num = < 0 >; + }; + + port-1 { + null-phy = <0x1>; + phy-ref = < 0 >; + logical-port-num = < 1 >; + }; + + port-2 { + null-phy = <0x1>; + phy-ref = < 0 >; + logical-port-num = < 2 >; + }; + + port-3 { + null-phy = <0x1>; + phy-ref = < 0 >; + logical-port-num = < 3 >; + }; + + port-4 { + null-phy = <0x1>; + phy-ref = < 0 >; + logical-port-num = < 4 >; + }; + }; diff --git a/Documentation/devicetree/bindings/soc/qcom/bg_rsb.txt b/Documentation/devicetree/bindings/soc/qcom/bg_rsb.txt new file mode 100644 index 000000000000..5e4c0ef147ed --- /dev/null +++ b/Documentation/devicetree/bindings/soc/qcom/bg_rsb.txt @@ -0,0 +1,19 @@ +Qualcomm technologies, Inc. bg-rsb + +BG-RSB : bg-rsb is used to communicate with Blackghost over +Glink to configure the RSB events. bg-rsb enable/disable +LDO11 and LDO15 before making any communication to BG +regarding RSB. It also provides an input device, which is +used to send the RSB/Button events to input framework. + +Required properties: +- compatible : should be "qcom,bg-rsb" +- vdd-ldo1-supply : for powering main supply +- vdd-ldo2-supply : for powering sensor + +Example: + qcom,bg-rsb { + compatible = "qcom,bg-rsb"; + vdd-ldo1-supply = <&pm660_l11>; + vdd-ldo2-supply = <&pm660_l15>; + }; diff --git a/Makefile b/Makefile index 8ce39e9174d6..1dde0eb2e3bb 100644 --- a/Makefile +++ b/Makefile @@ -526,8 +526,6 @@ export CLANG_FLAGS ifeq ($(ld-name),lld) KBUILD_CFLAGS += -fuse-ld=lld endif -CLANG_FLAGS += -fno-builtin-stpcpy -CLANG_FLAGS += -fno-builtin-bcmp KBUILD_CPPFLAGS += -Qunused-arguments endif @@ -795,7 +793,6 @@ ifeq ($(cc-name),clang) KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) KBUILD_CFLAGS += $(call cc-disable-warning, gnu) KBUILD_CFLAGS += $(call cc-disable-warning, duplicate-decl-specifier) -KBUILD_CFLAGS += -fno-builtin KBUILD_CFLAGS += $(call cc-option, -Wno-undefined-optimized) KBUILD_CFLAGS += $(call cc-option, -Wno-tautological-constant-out-of-range-compare) KBUILD_CFLAGS += $(call cc-option, -mllvm -disable-struct-const-merge) diff --git a/README.md b/README.md index d8ba802aed14..416009d9e10a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # IMMENSiTY KERNAL for Redmi K20pro / Mi9Tpro +[![Build Status](https://cloud.drone.io/api/badges/UtsavBalar1231/kernel_xiaomi_raphael/status.svg?ref=refs/heads/auto-kernel-ci)](https://cloud.drone.io/UtsavBalar1231/kernel_xiaomi_raphael) ![logo](https://github.com/UtsavBalar1231/xda-stuff/raw/master/immensity-new.png "logo here") -> Merged AOSP android-4.14-stable [4.14.192] -> Latest CAF tag: **LE.UM.3.2.3-45100-SA2150p** +> Merged AOSP android-4.14-stable [4.14.195] +> Latest CAF tag: **LE.UM.3.2.3-00110-SA2150p** diff --git a/arch/arm/configs/vendor/sdm429-bg-perf_defconfig b/arch/arm/configs/vendor/sdm429-bg-perf_defconfig index d1fdcb58461c..0177cd8bf01f 100644 --- a/arch/arm/configs/vendor/sdm429-bg-perf_defconfig +++ b/arch/arm/configs/vendor/sdm429-bg-perf_defconfig @@ -277,6 +277,7 @@ CONFIG_DM_VERITY_FEC=y CONFIG_NETDEVICES=y CONFIG_BONDING=y CONFIG_DUMMY=y +CONFIG_IFB=y CONFIG_TUN=y CONFIG_MSM_RMNET_BAM=y CONFIG_PPP=y @@ -294,7 +295,21 @@ CONFIG_PPP_ASYNC=y CONFIG_PPP_SYNC_TTY=y CONFIG_USB_RTL8152=y CONFIG_USB_USBNET=y -CONFIG_WIL6210=m +# CONFIG_WLAN_VENDOR_ADMTEK is not set +# CONFIG_WLAN_VENDOR_ATMEL is not set +# CONFIG_WLAN_VENDOR_BROADCOM is not set +# CONFIG_WLAN_VENDOR_CISCO is not set +# CONFIG_WLAN_VENDOR_INTEL is not set +# CONFIG_WLAN_VENDOR_INTERSIL is not set +# CONFIG_WLAN_VENDOR_MARVELL is not set +# CONFIG_WLAN_VENDOR_MEDIATEK is not set +# CONFIG_WLAN_VENDOR_RALINK is not set +# CONFIG_WLAN_VENDOR_REALTEK is not set +# CONFIG_WLAN_VENDOR_RSI is not set +# CONFIG_WLAN_VENDOR_ST is not set +# CONFIG_WLAN_VENDOR_TI is not set +# CONFIG_WLAN_VENDOR_ZYDAS is not set +# CONFIG_WLAN_VENDOR_QUANTENNA is not set CONFIG_WCNSS_MEM_PRE_ALLOC=y CONFIG_CLD_LL_CORE=y CONFIG_INPUT_EVDEV=y @@ -544,7 +559,7 @@ CONFIG_SSR_SYSMON_NOTIF_TIMEOUT=20000 CONFIG_SSR_SUBSYS_NOTIF_TIMEOUT=20000 CONFIG_PANIC_ON_SSR_NOTIF_TIMEOUT=y CONFIG_MSM_BOOT_STATS=y -CONFIG_QCOM_DCC_V2=y +CONFIG_QCOM_DCC=y CONFIG_QCOM_SECURE_BUFFER=y CONFIG_ICNSS=y CONFIG_ICNSS_QMI=y diff --git a/arch/arm/configs/vendor/sdm429-bg_defconfig b/arch/arm/configs/vendor/sdm429-bg_defconfig index 23b7a19357f8..978012ae819b 100644 --- a/arch/arm/configs/vendor/sdm429-bg_defconfig +++ b/arch/arm/configs/vendor/sdm429-bg_defconfig @@ -284,6 +284,7 @@ CONFIG_DM_VERITY_FEC=y CONFIG_NETDEVICES=y CONFIG_BONDING=y CONFIG_DUMMY=y +CONFIG_IFB=y CONFIG_TUN=y CONFIG_MSM_RMNET_BAM=y CONFIG_PPP=y @@ -301,6 +302,21 @@ CONFIG_PPP_ASYNC=y CONFIG_PPP_SYNC_TTY=y CONFIG_USB_RTL8152=y CONFIG_USB_USBNET=y +# CONFIG_WLAN_VENDOR_ADMTEK is not set +# CONFIG_WLAN_VENDOR_ATMEL is not set +# CONFIG_WLAN_VENDOR_BROADCOM is not set +# CONFIG_WLAN_VENDOR_CISCO is not set +# CONFIG_WLAN_VENDOR_INTEL is not set +# CONFIG_WLAN_VENDOR_INTERSIL is not set +# CONFIG_WLAN_VENDOR_MARVELL is not set +# CONFIG_WLAN_VENDOR_MEDIATEK is not set +# CONFIG_WLAN_VENDOR_RALINK is not set +# CONFIG_WLAN_VENDOR_REALTEK is not set +# CONFIG_WLAN_VENDOR_RSI is not set +# CONFIG_WLAN_VENDOR_ST is not set +# CONFIG_WLAN_VENDOR_TI is not set +# CONFIG_WLAN_VENDOR_ZYDAS is not set +# CONFIG_WLAN_VENDOR_QUANTENNA is not set CONFIG_WCNSS_MEM_PRE_ALLOC=y CONFIG_CLD_LL_CORE=y CONFIG_INPUT_EVDEV=y @@ -564,7 +580,7 @@ CONFIG_SSR_SUBSYS_NOTIF_TIMEOUT=20000 CONFIG_PANIC_ON_SSR_NOTIF_TIMEOUT=y CONFIG_MSM_BOOT_STATS=y CONFIG_MSM_CORE_HANG_DETECT=y -CONFIG_QCOM_DCC_V2=y +CONFIG_QCOM_DCC=y CONFIG_MSM_GLADIATOR_HANG_DETECT=y CONFIG_MSM_GLADIATOR_ERP=y CONFIG_PANIC_ON_GLADIATOR_ERROR=y diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile index 4b0d6f551234..1d57b2938a8d 100644 --- a/arch/arm64/boot/dts/qcom/Makefile +++ b/arch/arm64/boot/dts/qcom/Makefile @@ -348,17 +348,7 @@ ifeq ($(CONFIG_BUILD_ARM64_DT_OVERLAY),y) trinket-external-codec-idp-overlay.dtbo \ trinket-usbc-external-codec-idp-overlay.dtbo \ trinket-usbc-idp-overlay.dtbo \ - trinket-dp-idp-overlay.dtbo \ - qcm6125-iot-idp-overlay.dtbo \ - qcs6125-iot-idp-overlay.dtbo \ - qcm6125-iot-external-codec-idp-overlay.dtbo \ - qcs6125-iot-external-codec-idp-overlay.dtbo \ - qcm6125-iot-usbc-external-codec-idp-overlay.dtbo \ - qcs6125-iot-usbc-external-codec-idp-overlay.dtbo \ - qcm6125-iot-usbc-idp-overlay.dtbo \ - qcs6125-iot-usbc-idp-overlay.dtbo \ - qcm6125-iot-dp-idp-overlay.dtbo \ - qcs6125-iot-dp-idp-overlay.dtbo + trinket-dp-idp-overlay.dtbo trinket-rumi-overlay.dtbo-base := trinket.dtb trinket-idp-overlay.dtbo-base := trinket.dtb @@ -367,16 +357,6 @@ trinket-external-codec-idp-overlay.dtbo-base := trinket.dtb trinket-usbc-external-codec-idp-overlay.dtbo-base := trinket.dtb trinket-usbc-idp-overlay.dtbo-base := trinket.dtb trinket-dp-idp-overlay.dtbo-base := trinket.dtb -qcm6125-iot-idp-overlay.dtbo-base := qcm6125.dtb -qcs6125-iot-idp-overlay.dtbo-base := qcs6125.dtb -qcm6125-iot-external-codec-idp-overlay.dtbo-base := qcm6125.dtb -qcs6125-iot-external-codec-idp-overlay.dtbo-base := qcs6125.dtb -qcm6125-iot-usbc-external-codec-idp-overlay.dtbo-base := qcm6125.dtb -qcs6125-iot-usbc-external-codec-idp-overlay.dtbo-base := qcs6125.dtb -qcm6125-iot-usbc-idp-overlay.dtbo-base := qcm6125.dtb -qcs6125-iot-usbc-idp-overlay.dtbo-base := qcs6125.dtb -qcm6125-iot-dp-idp-overlay.dtbo-base := qcm6125.dtb -qcs6125-iot-dp-idp-overlay.dtbo-base := qcs6125.dtb else dtb-$(CONFIG_ARCH_TRINKET) += trinket-rumi.dtb \ trinket-idp.dtb \ @@ -384,17 +364,7 @@ dtb-$(CONFIG_ARCH_TRINKET) += trinket-rumi.dtb \ trinket-external-codec-idp.dtb \ trinket-usbc-external-codec-idp.dtb \ trinket-usbc-idp.dtb \ - trinket-dp-idp.dtb \ - qcm6125-iot-idp.dtb \ - qcs6125-iot-idp.dtb \ - qcm6125-iot-external-codec-idp.dtb \ - qcs6125-iot-external-codec-idp.dtb \ - qcm6125-iot-usbc-external-codec-idp.dtb \ - qcs6125-iot-usbc-external-codec-idp.dtb \ - qcm6125-iot-usbc-idp.dtb \ - qcs6125-iot-usbc-idp.dtb \ - qcm6125-iot-dp-idp.dtb \ - qcs6125-iot-dp-idp.dtb + trinket-dp-idp.dtb endif ifeq ($(CONFIG_BUILD_ARM64_DT_OVERLAY),y) diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-dp-idp-overlay.dts b/arch/arm64/boot/dts/qcom/qcm6125-iot-dp-idp-overlay.dts deleted file mode 100644 index 96696b0399be..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125-iot-dp-idp-overlay.dts +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2020, 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 "qcm6125-iot-idp.dtsi" -#include "trinket-audio-overlay.dtsi" - -/ { - model = "Display Port Enable IDP"; - compatible = "qcom,qcm6125-idp", "qcom,qcm6125", "qcom,idp"; - qcom,msm-id = <467 0x10000>; - qcom,board-id = <34 4>; -}; - -&dsi_td4330_truly_cmd_display { - qcom,dsi-display-active; -}; - -&sde_dp { - status = "ok"; - qcom,dp-hpd-gpio = <&tlmm 100 0>; - qcom,dp-low-power-hw-hpd; -}; - -&mdss_dp_pll { - status = "ok"; -}; - -&usb0 { - dwc3@4e00000 { - usb-phy = <&qusb_phy0>, <&usb_nop_phy>; - maximum-speed = "high-speed"; - }; -}; - -&mdss_mdp { - connectors = <&sde_wb &sde_dsi &sde_dp>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-dp-idp.dts b/arch/arm64/boot/dts/qcom/qcm6125-iot-dp-idp.dts deleted file mode 100644 index 2a0232f76173..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125-iot-dp-idp.dts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2020, 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/; - -#include "qcm6125.dtsi" -#include "qcm6125-iot-idp.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCM6125 IOT Disp. Port Enable IDP"; - compatible = "qcom,qcm6125-idp", "qcom,qcm6125", "qcom,idp"; - qcom,board-id = <34 4>; -}; - -&sde_dp { - status = "ok"; - qcom,dp-hpd-gpio = <&tlmm 100 0>; - qcom,dp-low-power-hw-hpd; -}; - -&mdss_dp_pll { - status = "ok"; -}; - -&usb0 { - dwc3@4e00000 { - usb-phy = <&qusb_phy0>, <&usb_nop_phy>; - maximum-speed = "high-speed"; - }; -}; - -&mdss_mdp { - connectors = <&sde_wb &sde_dsi &sde_dp>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-external-codec-idp-overlay.dts b/arch/arm64/boot/dts/qcom/qcm6125-iot-external-codec-idp-overlay.dts deleted file mode 100644 index c8a93d2e1cc4..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125-iot-external-codec-idp-overlay.dts +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (c) 2020, 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 "qcm6125-iot-idp.dtsi" -#include "trinket-tasha-codec-audio-overlay.dtsi" -#include "trinket-tasha-codec.dtsi" - -/ { - model = "Ext Audio Codec IDP"; - compatible = "qcom,qcm6125-idp", "qcom,qcm6125", "qcom,idp"; - qcom,msm-id = <467 0x10000>; - qcom,board-id = <34 1>; -}; - -&dsi_td4330_truly_cmd_display { - qcom,dsi-display-active; -}; diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-external-codec-idp.dts b/arch/arm64/boot/dts/qcom/qcm6125-iot-external-codec-idp.dts deleted file mode 100644 index 586d54193c07..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125-iot-external-codec-idp.dts +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (c) 2020, 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/; - -#include "qcm6125.dtsi" -#include "qcm6125-iot-idp.dtsi" -#include "trinket-tasha-codec-audio-overlay.dtsi" -#include "trinket-tasha-codec.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCM6125 IOT Ext Audio Codec IDP"; - compatible = "qcom,qcm6125-idp", "qcom,qcm6125", "qcom,idp"; - qcom,board-id = <34 1>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-idp-overlay.dts b/arch/arm64/boot/dts/qcom/qcm6125-iot-idp-overlay.dts deleted file mode 100644 index 936473fcec4b..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125-iot-idp-overlay.dts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2020, 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 "qcm6125-iot-idp.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCM6125 IOT IDP Overlay"; - compatible = "qcom,qcm6125"; - qcom,msm-id = <467 0x10000>; - qcom,board-id = <34 0>; -}; - diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dts b/arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dts deleted file mode 100644 index 37f06e2c3f46..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2020, 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/; - -#include "qcm6125.dtsi" -#include "qcm6125-iot-idp.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCM6125 IOT IDP SoC"; - compatible = "qcom,qcm6125"; - qcom,board-id = <34 0>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dtsi b/arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dtsi deleted file mode 100644 index 6d198b235fbc..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125-iot-idp.dtsi +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 2020, 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. - */ -#include "trinket-idp.dtsi" diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-external-codec-idp-overlay.dts b/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-external-codec-idp-overlay.dts deleted file mode 100644 index 2c9d5820eccb..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-external-codec-idp-overlay.dts +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (c) 2020, 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 "qcm6125-iot-idp.dtsi" - -/ { - model = "USB-C Ext Audio Codec IDP"; - compatible = "qcom,qcm6125-idp", "qcom,qcm6125", "qcom,idp"; - qcom,msm-id = <467 0x10000>; - qcom,board-id = <34 3>; -}; - -&dsi_td4330_truly_cmd_display { - qcom,dsi-display-active; -}; diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-external-codec-idp.dts b/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-external-codec-idp.dts deleted file mode 100644 index a3c69c31f734..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-external-codec-idp.dts +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (c) 2020, 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/; - -#include "qcm6125.dtsi" -#include "qcm6125-iot-idp.dtsi" - -/ { - model = "Qualcomm Technologies,Inc. QCM6125 IOT USBC Ext Aud Codec IDP"; - compatible = "qcom,qcm6125-idp", "qcom,qcm6125", "qcom,idp"; - qcom,board-id = <34 3>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-idp-overlay.dts b/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-idp-overlay.dts deleted file mode 100644 index ef7a24aeb2bf..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-idp-overlay.dts +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2020, 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 "qcm6125-iot-idp.dtsi" -#include "qcm6125-iot-usbc-idp.dtsi" - -/ { - model = "USBC Audio IDP"; - compatible = "qcom,qcm6125-idp", "qcom,qcm6125", "qcom,idp"; - qcom,msm-id = <467 0x10000>; - qcom,board-id = <34 2>; -}; - -&dsi_td4330_truly_cmd_display { - qcom,dsi-display-active; -}; diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-idp.dts b/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-idp.dts deleted file mode 100644 index 73f65a9fc2d6..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-idp.dts +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (c) 2020, 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/; - -#include "qcm6125.dtsi" -#include "qcm6125-iot-idp.dtsi" -#include "qcm6125-iot-usbc-idp.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCM6125 IOT USBC Audio IDP"; - compatible = "qcom,qcm6125-idp", "qcom,qcm6125", "qcom,idp"; - qcom,board-id = <34 2>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-idp.dtsi b/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-idp.dtsi deleted file mode 100644 index faafcf82f5e3..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125-iot-usbc-idp.dtsi +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright (c) 2020, 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. - */ - -#include "trinket-audio-overlay.dtsi" - -&sm6150_snd { - qcom,msm-mbhc-usbc-audio-supported = <1>; - qcom,msm-mbhc-hphl-swh = <1>; - qcom,msm-mbhc-gnd-swh = <1>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcm6125.dts b/arch/arm64/boot/dts/qcom/qcm6125.dts deleted file mode 100644 index 4e31d2849dc3..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125.dts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2020, 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/; - -#include "qcm6125.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCM6125 IOT IDP SoC"; - compatible = "qcom,qcm6125"; - qcom,board-id = <0 0>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcm6125.dtsi b/arch/arm64/boot/dts/qcom/qcm6125.dtsi deleted file mode 100644 index dca459b90404..000000000000 --- a/arch/arm64/boot/dts/qcom/qcm6125.dtsi +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2020, 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. - */ - -#include "trinket.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCM6125"; - compatible = "qcom,qcm6125"; - qcom,msm-id = <467 0x0>; - qcom,msm-name = "QCM6125"; -}; diff --git a/arch/arm64/boot/dts/qcom/qcs405.dtsi b/arch/arm64/boot/dts/qcom/qcs405.dtsi index 45574c4891c6..52aff5591aea 100644 --- a/arch/arm64/boot/dts/qcom/qcs405.dtsi +++ b/arch/arm64/boot/dts/qcom/qcs405.dtsi @@ -1584,7 +1584,7 @@ }; mtl_tx_setup: tx-queues-config { - snps,tx-queues-to-use = <5>; + snps,tx-queues-to-use = <4>; snps,tx-sched-sp; queue0 { snps,dcb-algorithm; @@ -1611,7 +1611,7 @@ }; }; - ethqos_hw: qcom,ethernet@00020000 { + ethqos_hw: qcom,ethernet@07A80000 { compatible = "qcom,stmmac-ethqos"; reg = <0x07A80000 0x10000>, <0x7A96000 0x100>; @@ -1642,7 +1642,6 @@ qcom,bus-vector-names = "0", "10", "100", "1000"; snps,tso; snps,pbl = <32>; - mac-address = [00 55 7B B5 7D f7]; clocks = <&clock_gcc GCC_ETH_AXI_CLK>, <&clock_gcc GCC_ETH_SLAVE_AHB_CLK>, <&clock_gcc GCC_ETH_PTP_CLK>, diff --git a/arch/arm64/boot/dts/qcom/qcs610-iot.dtsi b/arch/arm64/boot/dts/qcom/qcs610-iot.dtsi index 6bf996060d60..3397b23ca9ba 100644 --- a/arch/arm64/boot/dts/qcom/qcs610-iot.dtsi +++ b/arch/arm64/boot/dts/qcom/qcs610-iot.dtsi @@ -365,6 +365,12 @@ status = "ok"; }; +&usb0 { + dwc3@a600000 { + snps,usb3-u1u2-disable; + }; +}; + &L16A { regulator-max-microvolt = <3304000>; }; diff --git a/arch/arm64/boot/dts/qcom/qcs610-ipc.dtsi b/arch/arm64/boot/dts/qcom/qcs610-ipc.dtsi index 9340e5cb4d18..934e4a7f95f1 100644 --- a/arch/arm64/boot/dts/qcom/qcs610-ipc.dtsi +++ b/arch/arm64/boot/dts/qcom/qcs610-ipc.dtsi @@ -67,6 +67,13 @@ qcom,wsa-max-devs = <1>; qcom,wsa-devs = <&wsa881x_0211>, <&wsa881x_0213>; qcom,wsa-aux-dev-prefix = "SpkrLeft", "SpkrLeft"; + qcom,linein-det-swh = <1>; + qcom,lineout-det-swh = <1>; + qcom,linein-det-gpio = <&tlmm 1 0>; + qcom,lineout-det-gpio = <&tlmm 60 0>; + pinctrl-names = "default"; + pinctrl-0 = <&jack_det_linein_default + &jack_det_lineout_default>; }; &pm6150_charger { diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-dp-idp-overlay.dts b/arch/arm64/boot/dts/qcom/qcs6125-iot-dp-idp-overlay.dts deleted file mode 100644 index 2830ca6cfde8..000000000000 --- a/arch/arm64/boot/dts/qcom/qcs6125-iot-dp-idp-overlay.dts +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2020, 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 "qcs6125-iot-idp.dtsi" -#include "trinket-audio-overlay.dtsi" - -/ { - model = "Display Port Enable IDP"; - compatible = "qcom,qcs6125-idp", "qcom,qcs6125", "qcom,idp"; - qcom,msm-id = <468 0x10000>; - qcom,board-id = <34 4>; -}; - -&dsi_td4330_truly_cmd_display { - qcom,dsi-display-active; -}; - -&sde_dp { - status = "ok"; - qcom,dp-hpd-gpio = <&tlmm 100 0>; - qcom,dp-low-power-hw-hpd; -}; - -&mdss_dp_pll { - status = "ok"; -}; - -&usb0 { - dwc3@4e00000 { - usb-phy = <&qusb_phy0>, <&usb_nop_phy>; - maximum-speed = "high-speed"; - }; -}; - -&mdss_mdp { - connectors = <&sde_wb &sde_dsi &sde_dp>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-dp-idp.dts b/arch/arm64/boot/dts/qcom/qcs6125-iot-dp-idp.dts deleted file mode 100644 index 69bf2c2be9d8..000000000000 --- a/arch/arm64/boot/dts/qcom/qcs6125-iot-dp-idp.dts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2020, 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/; - -#include "qcs6125.dtsi" -#include "qcs6125-iot-idp.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCM6125 IOT Disp. Port Enable IDP"; - compatible = "qcom,qcs6125-idp", "qcom,qcs6125", "qcom,idp"; - qcom,board-id = <34 4>; -}; - -&sde_dp { - status = "ok"; - qcom,dp-hpd-gpio = <&tlmm 100 0>; - qcom,dp-low-power-hw-hpd; -}; - -&mdss_dp_pll { - status = "ok"; -}; - -&usb0 { - dwc3@4e00000 { - usb-phy = <&qusb_phy0>, <&usb_nop_phy>; - maximum-speed = "high-speed"; - }; -}; - -&mdss_mdp { - connectors = <&sde_wb &sde_dsi &sde_dp>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-external-codec-idp-overlay.dts b/arch/arm64/boot/dts/qcom/qcs6125-iot-external-codec-idp-overlay.dts deleted file mode 100644 index d5c75339ba9d..000000000000 --- a/arch/arm64/boot/dts/qcom/qcs6125-iot-external-codec-idp-overlay.dts +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (c) 2020, 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 "qcs6125-iot-idp.dtsi" -#include "trinket-tasha-codec-audio-overlay.dtsi" -#include "trinket-tasha-codec.dtsi" - -/ { - model = "Ext Audio Codec IDP"; - compatible = "qcom,qcs6125-idp", "qcom,qcs6125", "qcom,idp"; - qcom,msm-id = <468 0x10000>; - qcom,board-id = <34 1>; -}; - -&dsi_td4330_truly_cmd_display { - qcom,dsi-display-active; -}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-external-codec-idp.dts b/arch/arm64/boot/dts/qcom/qcs6125-iot-external-codec-idp.dts deleted file mode 100644 index 7d75678fd29a..000000000000 --- a/arch/arm64/boot/dts/qcom/qcs6125-iot-external-codec-idp.dts +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (c) 2020, 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/; - -#include "qcs6125.dtsi" -#include "qcs6125-iot-idp.dtsi" -#include "trinket-tasha-codec-audio-overlay.dtsi" -#include "trinket-tasha-codec.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCS6125 IOT Ext Audio Codec IDP"; - compatible = "qcom,qcs6125-idp", "qcom,qcs6125", "qcom,idp"; - qcom,board-id = <34 1>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-idp-overlay.dts b/arch/arm64/boot/dts/qcom/qcs6125-iot-idp-overlay.dts deleted file mode 100644 index 8b80605046e5..000000000000 --- a/arch/arm64/boot/dts/qcom/qcs6125-iot-idp-overlay.dts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2020, 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 "qcs6125-iot-idp.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCS6125 IOT IDP Overlay"; - compatible = "qcom,qcs6125"; - qcom,msm-id = <468 0x10000>; - qcom,board-id = <34 0>; -}; - diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dts b/arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dts deleted file mode 100644 index 4eaa9b6ccccb..000000000000 --- a/arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2020, 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/; - -#include "qcs6125.dtsi" -#include "qcs6125-iot-idp.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCS6125 IOT IDP SoC"; - compatible = "qcom,qcs6125"; - qcom,board-id = <34 0>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-external-codec-idp-overlay.dts b/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-external-codec-idp-overlay.dts deleted file mode 100644 index 8fb605f7dac8..000000000000 --- a/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-external-codec-idp-overlay.dts +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (c) 2020, 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 "qcs6125-iot-idp.dtsi" - -/ { - model = "USB-C Ext Audio Codec IDP"; - compatible = "qcom,qcs6125-idp", "qcom,qcs6125", "qcom,idp"; - qcom,msm-id = <468 0x10000>; - qcom,board-id = <34 3>; -}; - -&dsi_td4330_truly_cmd_display { - qcom,dsi-display-active; -}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-external-codec-idp.dts b/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-external-codec-idp.dts deleted file mode 100644 index 8a47d58bc4d1..000000000000 --- a/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-external-codec-idp.dts +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (c) 2020, 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/; - -#include "qcs6125.dtsi" -#include "qcs6125-iot-idp.dtsi" - -/ { - model = "Qualcomm Technologies,Inc. QCS6125IOT USBC Ext AudioCodec IDP"; - compatible = "qcom,qcs6125-idp", "qcom,qcs6125", "qcom,idp"; - qcom,board-id = <34 3>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-idp-overlay.dts b/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-idp-overlay.dts deleted file mode 100644 index 3428c7b93bc4..000000000000 --- a/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-idp-overlay.dts +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2020, 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 "qcs6125-iot-idp.dtsi" -#include "qcs6125-iot-usbc-idp.dtsi" - -/ { - model = "USBC Audio IDP"; - compatible = "qcom,qcs6125-idp", "qcom,qcs6125", "qcom,idp"; - qcom,msm-id = <468 0x10000>; - qcom,board-id = <34 2>; -}; - -&dsi_td4330_truly_cmd_display { - qcom,dsi-display-active; -}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-idp.dts b/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-idp.dts deleted file mode 100644 index a33a34046fdc..000000000000 --- a/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-idp.dts +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (c) 2020, 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/; - -#include "qcs6125.dtsi" -#include "qcs6125-iot-idp.dtsi" -#include "qcs6125-iot-usbc-idp.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCS6125 IOT USBC Audio IDP"; - compatible = "qcom,qcs6125-idp", "qcom,qcs6125", "qcom,idp"; - qcom,board-id = <34 2>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-idp.dtsi b/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-idp.dtsi deleted file mode 100644 index faafcf82f5e3..000000000000 --- a/arch/arm64/boot/dts/qcom/qcs6125-iot-usbc-idp.dtsi +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright (c) 2020, 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. - */ - -#include "trinket-audio-overlay.dtsi" - -&sm6150_snd { - qcom,msm-mbhc-usbc-audio-supported = <1>; - qcom,msm-mbhc-hphl-swh = <1>; - qcom,msm-mbhc-gnd-swh = <1>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125.dts b/arch/arm64/boot/dts/qcom/qcs6125.dts deleted file mode 100644 index c2ac4473ee4b..000000000000 --- a/arch/arm64/boot/dts/qcom/qcs6125.dts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2020, 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/; - -#include "qcs6125.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCS6125 SoC"; - compatible = "qcom,qcs6125"; - qcom,board-id = <0 0>; -}; diff --git a/arch/arm64/boot/dts/qcom/qcs6125.dtsi b/arch/arm64/boot/dts/qcom/qcs6125.dtsi deleted file mode 100644 index aed91a655019..000000000000 --- a/arch/arm64/boot/dts/qcom/qcs6125.dtsi +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2020, 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. - */ - -#include "trinket.dtsi" - -/ { - model = "Qualcomm Technologies, Inc. QCS6125"; - compatible = "qcom,qcs6125"; - qcom,msm-id = <468 0x0>; - qcom,msm-name = "QCS6125"; -}; diff --git a/arch/arm64/boot/dts/qcom/sa2145p-ccard-nand-dc.dts b/arch/arm64/boot/dts/qcom/sa2145p-ccard-nand-dc.dts index 19b33f9f06ba..4f84d3aa500d 100644 --- a/arch/arm64/boot/dts/qcom/sa2145p-ccard-nand-dc.dts +++ b/arch/arm64/boot/dts/qcom/sa2145p-ccard-nand-dc.dts @@ -81,3 +81,33 @@ rx-dll-bypass; }; }; + +&tlmm { + /delete-node/ mdss_hdmi_ddc_active; + /delete-node/ mdss_hdmi_ddc_suspend; + rgmii_level_shifter: rgmii_level_shifter { + mux { + pins = "gpio16"; + function = "gpio"; + }; + config { + pins = "gpio16"; + drive-strength = <2>; + bias-pull-down; + output-low; + }; + }; +}; + +ðqos_hw { + pinctrl-names = "dev-emac-mdc", "dev-emac-mdio", + "dev-emac-rgmii_txd0_state", "dev-emac-rgmii_txd1_state", + "dev-emac-rgmii_txd2_state", "dev-emac-rgmii_txd3_state", + "dev-emac-rgmii_txc_state", "dev-emac-rgmii_tx_ctl_state", + "dev-emac-rgmii_rxd0_state", "dev-emac-rgmii_rxd1_state", + "dev-emac-rgmii_rxd2_state", "dev-emac-rgmii_rxd3_state", + "dev-emac-rgmii_rxc_state", "dev-emac-rgmii_rx_ctl_state", + "dev-emac-phy_intr", "dev-emac-phy_reset_state", + "dev-emac-rgmii_lvl_shift_state"; + pinctrl-16 = <&rgmii_level_shifter>; +}; diff --git a/arch/arm64/boot/dts/qcom/sa2150p-ccard-nand-dc.dts b/arch/arm64/boot/dts/qcom/sa2150p-ccard-nand-dc.dts index 418d9bb685a5..3f9b8b2428e7 100644 --- a/arch/arm64/boot/dts/qcom/sa2150p-ccard-nand-dc.dts +++ b/arch/arm64/boot/dts/qcom/sa2150p-ccard-nand-dc.dts @@ -155,3 +155,33 @@ rx-dll-bypass; }; }; + +&tlmm { + /delete-node/ mdss_hdmi_ddc_active; + /delete-node/ mdss_hdmi_ddc_suspend; + rgmii_level_shifter: rgmii_level_shifter { + mux { + pins = "gpio16"; + function = "gpio"; + }; + config { + pins = "gpio16"; + drive-strength = <2>; + bias-pull-down; + output-low; + }; + }; +}; + +ðqos_hw { + pinctrl-names = "dev-emac-mdc", "dev-emac-mdio", + "dev-emac-rgmii_txd0_state", "dev-emac-rgmii_txd1_state", + "dev-emac-rgmii_txd2_state", "dev-emac-rgmii_txd3_state", + "dev-emac-rgmii_txc_state", "dev-emac-rgmii_tx_ctl_state", + "dev-emac-rgmii_rxd0_state", "dev-emac-rgmii_rxd1_state", + "dev-emac-rgmii_rxd2_state", "dev-emac-rgmii_rxd3_state", + "dev-emac-rgmii_rxc_state", "dev-emac-rgmii_rx_ctl_state", + "dev-emac-phy_intr", "dev-emac-phy_reset_state", + "dev-emac-rgmii_lvl_shift_state"; + pinctrl-16 = <&rgmii_level_shifter>; +}; diff --git a/arch/arm64/boot/dts/qcom/sa2150p-ccard.dtsi b/arch/arm64/boot/dts/qcom/sa2150p-ccard.dtsi index 29e8955016f2..5988b66988b7 100644 --- a/arch/arm64/boot/dts/qcom/sa2150p-ccard.dtsi +++ b/arch/arm64/boot/dts/qcom/sa2150p-ccard.dtsi @@ -213,11 +213,39 @@ extcon = <&usb2_extcon>; }; +&mtl_rx_setup { + queue2 { + snps,dcb-algorithm; + }; + + queue3 { + snps,dcb-algorithm; + }; +}; + +&mtl_tx_setup { + queue2 { + snps,dcb-algorithm; + }; + + queue3 { + snps,dcb-algorithm; + }; +}; + ðqos_hw { status = "okay"; vreg_emac_phy-supply = <&vreg_emac_phy>; vreg_rgmii_io_pads-supply = <&vreg_rgmii_io_pads>; rxc-skew-ps = <0>; + qcom,qoe_mode = <1>; + qcom,qoe-queue = <2>; + qcom,qoe-vlan-offset = <0>; + snps,mtl-rx-config = <&mtl_rx_setup>; + snps,mtl-tx-config = <&mtl_tx_setup>; + qcom,cv2x_mode = <2>; + qcom,cv2x-queue = <3>; + qcom,cv2x-vlan-offset = <1>; pinctrl-names = "dev-emac-mdc", "dev-emac-mdio", "dev-emac-rgmii_txd0_state", "dev-emac-rgmii_txd1_state", diff --git a/arch/arm64/boot/dts/qcom/sa515m-ccard-eth-ep.dts b/arch/arm64/boot/dts/qcom/sa515m-ccard-eth-ep.dts index 7523ffe8312f..f00de0ec2110 100644 --- a/arch/arm64/boot/dts/qcom/sa515m-ccard-eth-ep.dts +++ b/arch/arm64/boot/dts/qcom/sa515m-ccard-eth-ep.dts @@ -54,3 +54,34 @@ qcom,default-policy-nop; status = "okay"; }; + +&mtl_rx_setup { + queue2 { + snps,dcb-algorithm; + }; + + queue3 { + snps,dcb-algorithm; + }; +}; + +&mtl_tx_setup { + queue2 { + snps,dcb-algorithm; + }; + + queue3 { + snps,dcb-algorithm; + }; +}; + +ðqos_hw { + qcom,qoe_mode = <1>; + qcom,qoe-queue = <2>; + qcom,qoe-vlan-offset = <0>; + snps,mtl-rx-config = <&mtl_rx_setup>; + snps,mtl-tx-config = <&mtl_tx_setup>; + qcom,cv2x_mode = <1>; + qcom,cv2x-queue = <3>; + qcom,cv2x-vlan-offset = <1>; +}; diff --git a/arch/arm64/boot/dts/qcom/sa515m-v2-ccard-eth-ep.dts b/arch/arm64/boot/dts/qcom/sa515m-v2-ccard-eth-ep.dts index e0a7d29a6b27..3b2746771558 100644 --- a/arch/arm64/boot/dts/qcom/sa515m-v2-ccard-eth-ep.dts +++ b/arch/arm64/boot/dts/qcom/sa515m-v2-ccard-eth-ep.dts @@ -54,3 +54,34 @@ qcom,default-policy-nop; status = "okay"; }; + +&mtl_rx_setup { + queue2 { + snps,dcb-algorithm; + }; + + queue3 { + snps,dcb-algorithm; + }; +}; + +&mtl_tx_setup { + queue2 { + snps,dcb-algorithm; + }; + + queue3 { + snps,dcb-algorithm; + }; +}; + +ðqos_hw { + qcom,qoe_mode = <1>; + qcom,qoe-queue = <2>; + qcom,qoe-vlan-offset = <0>; + snps,mtl-rx-config = <&mtl_rx_setup>; + snps,mtl-tx-config = <&mtl_tx_setup>; + qcom,cv2x_mode = <1>; + qcom,cv2x-queue = <3>; + qcom,cv2x-vlan-offset = <1>; +}; diff --git a/arch/arm64/boot/dts/qcom/sa6155-pmic.dtsi b/arch/arm64/boot/dts/qcom/sa6155-pmic.dtsi index ccef59f575bc..7b54f7d59b81 100644 --- a/arch/arm64/boot/dts/qcom/sa6155-pmic.dtsi +++ b/arch/arm64/boot/dts/qcom/sa6155-pmic.dtsi @@ -338,6 +338,15 @@ pm6155-1-tz { cooling-maps { + /* + * trip0 cooling map is dummy node to enable + * passive polling on trip0 violation. + */ + trip0_cpu0 { + trip = <&pm6155_trip0>; + cooling-device = <&CPU0 0 0>; + }; + trip1_cpu0 { trip = <&pm6155_trip1>; cooling-device = diff --git a/arch/arm64/boot/dts/qcom/sa8155-capture.dtsi b/arch/arm64/boot/dts/qcom/sa8155-capture.dtsi index b876b34ae0c9..ce36343a5d8d 100644 --- a/arch/arm64/boot/dts/qcom/sa8155-capture.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8155-capture.dtsi @@ -186,6 +186,7 @@ , , ; + status = "disabled"; }; qmp_aop: qcom,qmp-aop@c300000 { diff --git a/arch/arm64/boot/dts/qcom/sa8155-pmic-overlay.dtsi b/arch/arm64/boot/dts/qcom/sa8155-pmic-overlay.dtsi index 41df55dbe659..516b606cfcd3 100644 --- a/arch/arm64/boot/dts/qcom/sa8155-pmic-overlay.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8155-pmic-overlay.dtsi @@ -193,6 +193,15 @@ pm8150_1_gpios: &pm8150_gpios { }; cooling-maps { + /* + * trip0 cooling map is dummy node to enable + * passive polling on trip0 violation. + */ + trip0_cpu0 { + trip = <&pm8150_2_trip0>; + cooling-device = <&CPU0 0 0>; + }; + trip1_cpu0 { trip = <&pm8150_2_trip1>; cooling-device = @@ -253,6 +262,15 @@ pm8150_1_gpios: &pm8150_gpios { pm8150_tz { cooling-maps { + /* + * trip0 cooling map is dummy node to enable + * passive polling on trip0 violation. + */ + trip0_cpu0 { + trip = <&pm8150_trip0>; + cooling-device = <&CPU0 0 0>; + }; + trip1_cpu0 { trip = <&pm8150_trip1>; cooling-device = diff --git a/arch/arm64/boot/dts/qcom/sa8155-vm-lv-mt.dtsi b/arch/arm64/boot/dts/qcom/sa8155-vm-lv-mt.dtsi index c2ef8679006a..55c498669e61 100644 --- a/arch/arm64/boot/dts/qcom/sa8155-vm-lv-mt.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8155-vm-lv-mt.dtsi @@ -21,6 +21,7 @@ }; /delete-node/ cpus; + /delete-node/ rename_blk; }; &hab { diff --git a/arch/arm64/boot/dts/qcom/sa8155-vm-lv.dtsi b/arch/arm64/boot/dts/qcom/sa8155-vm-lv.dtsi index 5ef00509798f..f03c5e50c1ec 100644 --- a/arch/arm64/boot/dts/qcom/sa8155-vm-lv.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8155-vm-lv.dtsi @@ -19,6 +19,8 @@ label = "pmem_shared_mem"; }; }; + + /delete-node/ rename_blk; }; &hab { diff --git a/arch/arm64/boot/dts/qcom/sa8155-vm.dtsi b/arch/arm64/boot/dts/qcom/sa8155-vm.dtsi index 6982f506569d..009d2c30df29 100644 --- a/arch/arm64/boot/dts/qcom/sa8155-vm.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8155-vm.dtsi @@ -1046,3 +1046,19 @@ &tlmm { dirconn-list = <37 216 1>; }; + +&iommu_qupv3_0_geni_se_cb { + iommus = <&apps_smmu 0xd8 0x0>; +}; + +&iommu_qupv3_1_geni_se_cb { + iommus = <&apps_smmu 0x618 0x0>; +}; + +&iommu_qupv3_2_geni_se_cb { + iommus = <&apps_smmu 0x7b8 0x0>; +}; + +&iommu_qupv3_3_geni_se_cb { + iommus = <&apps_smmu 0x4f8 0x0>; +}; diff --git a/arch/arm64/boot/dts/qcom/sa8155.dtsi b/arch/arm64/boot/dts/qcom/sa8155.dtsi index d71a78090127..63b621a0dcd3 100644 --- a/arch/arm64/boot/dts/qcom/sa8155.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8155.dtsi @@ -786,6 +786,38 @@ status="disabled"; }; +&cti_cpu0 { + status = "disabled"; +}; + +&cti_cpu1 { + status = "disabled"; +}; + +&cti_cpu2 { + status = "disabled"; +}; + +&cti_cpu3 { + status = "disabled"; +}; + +&cti_cpu4 { + status = "disabled"; +}; + +&cti_cpu5 { + status = "disabled"; +}; + +&cti_cpu6 { + status = "disabled"; +}; + +&cti_cpu7 { + status = "disabled"; +}; + #include "sa8155-audio.dtsi" #include "sa8155-camera.dtsi" #include "sa8155-camera-sensor.dtsi" diff --git a/arch/arm64/boot/dts/qcom/sa8195-pmic.dtsi b/arch/arm64/boot/dts/qcom/sa8195-pmic.dtsi index ebeac6853f38..ff1d341d6729 100644 --- a/arch/arm64/boot/dts/qcom/sa8195-pmic.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8195-pmic.dtsi @@ -122,6 +122,15 @@ }; cooling-maps { + /* + * trip0 cooling map is dummy node to enable + * passive polling on trip0 violation. + */ + trip0_cpu0 { + trip = <&pm8195_1_trip0>; + cooling-device = <&CPU0 0 0>; + }; + trip1_cpu0 { trip = <&pm8195_1_trip1>; cooling-device = @@ -206,6 +215,15 @@ }; cooling-maps { + /* + * trip0 cooling map is dummy node to enable + * passive polling on trip0 violation. + */ + trip0_cpu0 { + trip = <&pm8195_2_trip0>; + cooling-device = <&CPU0 0 0>; + }; + trip1_cpu0 { trip = <&pm8195_2_trip1>; cooling-device = @@ -290,6 +308,15 @@ }; cooling-maps { + /* + * trip0 cooling map is dummy node to enable + * passive polling on trip0 violation. + */ + trip0_cpu0 { + trip = <&pm8195_3_trip0>; + cooling-device = <&CPU0 0 0>; + }; + trip1_cpu0 { trip = <&pm8195_3_trip1>; cooling-device = diff --git a/arch/arm64/boot/dts/qcom/sa8195-vm-lv-mt.dtsi b/arch/arm64/boot/dts/qcom/sa8195-vm-lv-mt.dtsi index 074d40913c28..a678e6c4afc7 100644 --- a/arch/arm64/boot/dts/qcom/sa8195-vm-lv-mt.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8195-vm-lv-mt.dtsi @@ -20,6 +20,7 @@ }; /delete-node/ cpus; + /delete-node/ rename_blk; }; &hab { diff --git a/arch/arm64/boot/dts/qcom/sa8195-vm-lv.dtsi b/arch/arm64/boot/dts/qcom/sa8195-vm-lv.dtsi index f55efa749ab1..097af7244c89 100644 --- a/arch/arm64/boot/dts/qcom/sa8195-vm-lv.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8195-vm-lv.dtsi @@ -19,6 +19,7 @@ }; }; + /delete-node/ rename_blk; }; &hab { diff --git a/arch/arm64/boot/dts/qcom/sa8195p.dtsi b/arch/arm64/boot/dts/qcom/sa8195p.dtsi index 3e31e5d48b2a..62728a000748 100644 --- a/arch/arm64/boot/dts/qcom/sa8195p.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8195p.dtsi @@ -774,3 +774,8 @@ }; }; }; + +&qupv3_se2_i2c { + qcom,clk-freq-out = <400000>; + status = "ok"; +}; diff --git a/arch/arm64/boot/dts/qcom/sda429-wdp-overlay.dts b/arch/arm64/boot/dts/qcom/sda429-wdp-overlay.dts index 5e1ba25527ff..62d2a33ec20e 100644 --- a/arch/arm64/boot/dts/qcom/sda429-wdp-overlay.dts +++ b/arch/arm64/boot/dts/qcom/sda429-wdp-overlay.dts @@ -15,6 +15,7 @@ /plugin/; #include "sda429-wdp.dtsi" +#include "sdm429-spyro-qrd-evt-audio.dtsi" / { model = "Qualcomm Technologies, Inc. SDA429 QRD BG WDP Overlay"; diff --git a/arch/arm64/boot/dts/qcom/sda429-wtp-overlay.dts b/arch/arm64/boot/dts/qcom/sda429-wtp-overlay.dts index aa6d7612dd96..8b141c392fdf 100644 --- a/arch/arm64/boot/dts/qcom/sda429-wtp-overlay.dts +++ b/arch/arm64/boot/dts/qcom/sda429-wtp-overlay.dts @@ -17,6 +17,7 @@ #include #include "sda429-wtp.dtsi" #include "sdm429-mdss-panels.dtsi" +#include "sdm429-spyro-qrd-evt-audio.dtsi" / { model = "Qualcomm Technologies, Inc. SDA429 QRD BG WTP Overlay"; diff --git a/arch/arm64/boot/dts/qcom/sdmmagpie.dtsi b/arch/arm64/boot/dts/qcom/sdmmagpie.dtsi index 2e2abfe4b014..3259d7cccc7e 100644 --- a/arch/arm64/boot/dts/qcom/sdmmagpie.dtsi +++ b/arch/arm64/boot/dts/qcom/sdmmagpie.dtsi @@ -2631,6 +2631,7 @@ qcom,smem-id = <421>; qcom,signal-aop; qcom,minidump-id = <3>; + qcom,aux-minidump-ids = <4>; qcom,complete-ramdump; qcom,msm-bus,name = "pil-modem"; diff --git a/arch/arm64/boot/dts/qcom/sdmshrike-sde.dtsi b/arch/arm64/boot/dts/qcom/sdmshrike-sde.dtsi index 9ad7c2c33df4..1068389f5898 100644 --- a/arch/arm64/boot/dts/qcom/sdmshrike-sde.dtsi +++ b/arch/arm64/boot/dts/qcom/sdmshrike-sde.dtsi @@ -618,6 +618,7 @@ qcom,phy-index = <0>; qcom,bond-dual-ctrl = <1 0>; + qcom,bond-tri-ctrl = <2 0 1>; reg = <0xae90000 0x0dc>, <0xae90200 0x0c0>, @@ -653,13 +654,15 @@ <&clock_dispcc DISP_CC_MDSS_DP_PIXEL1_CLK_SRC>, <&mdss_dp0_pll DP_VCO_DIVIDED_CLK_SRC_MUX>, <&clock_dispcc DISP_CC_MDSS_DP_PIXEL_CLK>, - <&clock_dispcc DISP_CC_MDSS_DP_PIXEL1_CLK>; + <&clock_dispcc DISP_CC_MDSS_DP_PIXEL1_CLK>, + <&mdss_dp2_pll DP_VCO_DIVIDED_CLK_SRC_MUX>; clock-names = "core_aux_clk", "core_usb_ref_clk_src", "core_usb_ref_clk", "core_usb_pipe_clk", "link_clk", "link_iface_clk", "crypto_clk", "pixel_clk_rcg", "pixel_parent", "pixel1_clk_rcg", "pixel1_parent", - "strm0_pixel_clk", "strm1_pixel_clk"; + "strm0_pixel_clk", "strm1_pixel_clk", + "bond_pixel_parent"; qcom,phy-version = <0x420>; qcom,phy-mode = "dp"; @@ -766,13 +769,15 @@ <&clock_dispcc DISP_CC_MDSS_DP_PIXEL1_CLK_SRC>, <&mdss_dp1_pll DP_VCO_DIVIDED_CLK_SRC_MUX>, <&clock_dispcc DISP_CC_MDSS_DP_PIXEL2_CLK>, - <&clock_dispcc DISP_CC_MDSS_DP_PIXEL1_CLK>; + <&clock_dispcc DISP_CC_MDSS_DP_PIXEL1_CLK>, + <&mdss_dp2_pll DP_VCO_DIVIDED_CLK_SRC_MUX>; clock-names = "core_aux_clk", "core_usb_ref_clk_src", "core_usb_ref_clk", "core_usb_pipe_clk", "link_clk", "link_iface_clk", "crypto_clk", "pixel_clk_rcg", "pixel_parent", "pixel1_clk_rcg", "pixel1_parent", - "strm0_pixel_clk", "strm1_pixel_clk"; + "strm0_pixel_clk", "strm1_pixel_clk", + "bond_pixel_parent"; qcom,phy-version = <0x420>; qcom,phy-mode = "dp"; @@ -872,11 +877,13 @@ <&clock_dispcc DISP_CC_MDSS_EDP_LINK_INTF_CLK>, <&clock_dispcc DISP_CC_MDSS_EDP_PIXEL_CLK_SRC>, <&mdss_edp_pll DP_VCO_DIVIDED_CLK_SRC_MUX>, - <&clock_dispcc DISP_CC_MDSS_EDP_PIXEL_CLK>; + <&clock_dispcc DISP_CC_MDSS_EDP_PIXEL_CLK>, + <&mdss_dp2_pll DP_VCO_DIVIDED_CLK_SRC_MUX>; clock-names = "core_aux_clk", "core_ref_clk", "link_clk", "link_iface_clk", "pixel_clk_rcg", "pixel_parent", - "strm0_pixel_clk"; + "strm0_pixel_clk", + "bond_pixel_parent"; qcom,phy-version = <0x500>; qcom,phy-mode = "edp"; @@ -895,6 +902,7 @@ qcom,dsc-feature-enable; qcom,fec-feature-enable; + qcom,widebus-enable; qcom,max-dp-dsc-blks = <2>; qcom,max-dp-dsc-input-width-pixs = <2048>; diff --git a/arch/arm64/boot/dts/qcom/sdmshrike.dtsi b/arch/arm64/boot/dts/qcom/sdmshrike.dtsi index 12825eaef049..2efff7a41249 100644 --- a/arch/arm64/boot/dts/qcom/sdmshrike.dtsi +++ b/arch/arm64/boot/dts/qcom/sdmshrike.dtsi @@ -46,6 +46,7 @@ hsuart0 = &qupv3_se13_4uart; spi0 = &qupv3_se3_spi; i2c0 = &qupv3_se4_i2c; + i2c2 = &qupv3_se2_i2c; }; cpus { diff --git a/arch/arm64/boot/dts/qcom/sdxprairie-v2-mtp-au-dsda.dts b/arch/arm64/boot/dts/qcom/sdxprairie-v2-mtp-au-dsda.dts index b81e0dd144ed..8ed717eb02d4 100644 --- a/arch/arm64/boot/dts/qcom/sdxprairie-v2-mtp-au-dsda.dts +++ b/arch/arm64/boot/dts/qcom/sdxprairie-v2-mtp-au-dsda.dts @@ -21,4 +21,10 @@ qcom,board-id = <0x08010008 0x0>; }; +&usb { + extcon = <&vbus_detect>; +}; +&vbus_detect { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/qcom/sdxprairie.dtsi b/arch/arm64/boot/dts/qcom/sdxprairie.dtsi index 3206654f92a7..2345e0f6e9df 100644 --- a/arch/arm64/boot/dts/qcom/sdxprairie.dtsi +++ b/arch/arm64/boot/dts/qcom/sdxprairie.dtsi @@ -264,7 +264,7 @@ reg-names = "wdt-base"; interrupts = <1 3 0>, <1 2 0>; qcom,bark-time = <11000>; - qcom,pet-time = <10000>; + qcom,pet-time = <9360>; qcom,wakeup-enable; }; @@ -1459,7 +1459,7 @@ }; mtl_tx_setup: tx-queues-config { - snps,tx-queues-to-use = <5>; + snps,tx-queues-to-use = <4>; snps,tx-sched-sp; queue0 { snps,dcb-algorithm; diff --git a/arch/arm64/boot/dts/qcom/sm6150-pinctrl.dtsi b/arch/arm64/boot/dts/qcom/sm6150-pinctrl.dtsi index 51d0f1baab6d..02a8141a6fb0 100644 --- a/arch/arm64/boot/dts/qcom/sm6150-pinctrl.dtsi +++ b/arch/arm64/boot/dts/qcom/sm6150-pinctrl.dtsi @@ -1146,6 +1146,35 @@ }; }; + + gpio_jack_det_line_in { + jack_det_linein_default: jack_det_linein_default { + mux { + pins = "gpio1"; + function = "gpio"; + }; + config { + pins = "gpio1"; + bias-pull-up; /* pull up */ + input-enable; + }; + }; + }; + + gpio_jack_det_line_out { + jack_det_lineout_default: jack_det_lineout_default { + mux { + pins = "gpio60"; + function = "gpio"; + }; + config { + pins = "gpio60"; + bias-pull-up; /* pull up */ + input-enable; + }; + }; + }; + ter_i2s_sck_ws { ter_i2s_sck_sleep: ter_i2s_sck_sleep { mux { diff --git a/arch/arm64/boot/dts/qcom/sm6150.dtsi b/arch/arm64/boot/dts/qcom/sm6150.dtsi index 5af542dee2a5..ee7812be6fcc 100644 --- a/arch/arm64/boot/dts/qcom/sm6150.dtsi +++ b/arch/arm64/boot/dts/qcom/sm6150.dtsi @@ -2428,6 +2428,7 @@ qcom,smem-id = <421>; qcom,signal-aop; qcom,minidump-id = <3>; + qcom,aux-minidump-ids = <4>; qcom,complete-ramdump; /* Inputs from mss */ diff --git a/arch/arm64/configs/raphael_defconfig b/arch/arm64/configs/raphael_defconfig index 3c5746c300ea..2f288689ed45 100644 --- a/arch/arm64/configs/raphael_defconfig +++ b/arch/arm64/configs/raphael_defconfig @@ -589,7 +589,7 @@ CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y # CONFIG_MEMORY_FAILURE is not set # CONFIG_TRANSPARENT_HUGEPAGE is not set # CONFIG_ARCH_WANTS_THP_SWAP is not set -# CONFIG_CLEANCACHE is not set +CONFIG_CLEANCACHE=y # CONFIG_FRONTSWAP is not set CONFIG_CMA=y CONFIG_CMA_AREAS=7 @@ -1048,7 +1048,7 @@ CONFIG_IP_NF_TARGET_REDIRECT=y CONFIG_IP_NF_MANGLE=y # CONFIG_IP_NF_TARGET_CLUSTERIP is not set # CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_TTL is not set +CONFIG_IP_NF_TARGET_TTL=y CONFIG_IP_NF_RAW=y CONFIG_IP_NF_SECURITY=y CONFIG_IP_NF_ARPTABLES=y @@ -1075,7 +1075,7 @@ CONFIG_IP6_NF_MATCH_HL=y # CONFIG_IP6_NF_MATCH_MH is not set CONFIG_IP6_NF_MATCH_RPFILTER=y # CONFIG_IP6_NF_MATCH_RT is not set -# CONFIG_IP6_NF_TARGET_HL is not set +CONFIG_IP6_NF_TARGET_HL=y CONFIG_IP6_NF_FILTER=y CONFIG_IP6_NF_TARGET_REJECT=y # CONFIG_IP6_NF_TARGET_SYNPROXY is not set @@ -2072,6 +2072,8 @@ CONFIG_HW_RANDOM_MSM_LEGACY=y # # Diag Support # +CONFIG_DIAG_CHAR=y +CONFIG_DIAG_OVER_USB=y CONFIG_MSM_FASTCVPD=y CONFIG_MSM_ADSPRPC=y # CONFIG_MSM_RDBG is not set @@ -2170,6 +2172,7 @@ CONFIG_SPI_QCOM_GENI=y CONFIG_SPI_SPIDEV=y # CONFIG_SPI_TLE62X0 is not set # CONFIG_SPI_SLAVE is not set +# CONFIG_SPI_DYNAMIC is not set CONFIG_SPMI=y CONFIG_SPMI_MSM_PMIC_ARB=y # CONFIG_SPMI_MSM_PMIC_ARB_DEBUG is not set @@ -3084,13 +3087,18 @@ CONFIG_SND_PROC_FS=y # CONFIG_SND_SEQUENCER is not set # CONFIG_SND_OPL3_LIB_SEQ is not set # CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_DRIVERS is not set +CONFIG_SND_DRIVERS=y +# CONFIG_SND_DUMMY is not set +# CONFIG_SND_ALOOP is not set +# CONFIG_SND_MTPAV is not set +# CONFIG_SND_SERIAL_U16550 is not set +# CONFIG_SND_MPU401 is not set # # HD-Audio # CONFIG_SND_HDA_PREALLOC_SIZE=64 -# CONFIG_SND_SPI is not set +CONFIG_SND_SPI=y CONFIG_SND_USB=y CONFIG_SND_USB_AUDIO=y # CONFIG_SND_USB_UA101 is not set @@ -3522,6 +3530,7 @@ CONFIG_USB_F_MTP=y CONFIG_USB_F_PTP=y CONFIG_USB_F_AUDIO_SRC=y CONFIG_USB_F_ACC=y +CONFIG_USB_F_DIAG=y CONFIG_USB_F_CDEV=y CONFIG_USB_F_CCID=y CONFIG_USB_F_GSI=y @@ -3553,7 +3562,7 @@ CONFIG_USB_CONFIGFS_F_MIDI=y # CONFIG_USB_CONFIGFS_F_HID is not set # CONFIG_USB_CONFIGFS_F_UVC is not set # CONFIG_USB_CONFIGFS_F_PRINTER is not set -# CONFIG_USB_CONFIGFS_F_DIAG is not set +CONFIG_USB_CONFIGFS_F_DIAG=y CONFIG_USB_CONFIGFS_F_CDEV=y CONFIG_USB_CONFIGFS_F_CCID=y CONFIG_USB_CONFIGFS_F_GSI=y @@ -4243,6 +4252,7 @@ CONFIG_QCOM_AOP_DDRSS_COMMANDS=y # CONFIG_QCOM_ADSP_MANUAL_VOTE is not set # CONFIG_MSM_BAM_DMUX is not set # CONFIG_MSM_BGCOM is not set +# CONFIG_MSM_BGRSB is not set # CONFIG_MSM_PIL_SSR_BG is not set CONFIG_QCOM_SOC_INFO=y # CONFIG_RENAME_BLOCK_DEVICE is not set @@ -4711,7 +4721,14 @@ CONFIG_NVMEM_SPMI_SDAM=y # CONFIG_FSI is not set # CONFIG_TEE is not set CONFIG_SENSORS_SSC=y -# CONFIG_ESOC is not set +CONFIG_ESOC=y +CONFIG_ESOC_DEV=y +CONFIG_ESOC_CLIENT=y +# CONFIG_ESOC_DEBUG is not set +CONFIG_ESOC_MDM_4x=y +CONFIG_ESOC_MDM_DRV=y +CONFIG_ESOC_MDM_DBG_ENG=y +# CONFIG_MDM_DBG_REQ_ENG is not set # # Qualcomm RmNet extensions diff --git a/drivers/char/diag/diag_debugfs.c b/drivers/char/diag/diag_debugfs.c index 49ee66f248f2..8b29410c9a6c 100644 --- a/drivers/char/diag/diag_debugfs.c +++ b/drivers/char/diag/diag_debugfs.c @@ -445,8 +445,7 @@ static ssize_t diag_dbgfs_read_usbinfo(struct file *file, char __user *ubuf, "write count: %lu\n" "read work pending: %d\n" "read done work pending: %d\n" - "connect work pending: %d\n" - "disconnect work pending: %d\n" + "event work pending: %d\n" "max size supported: %d\n\n", usb_info->id, usb_info->name, @@ -460,8 +459,7 @@ static ssize_t diag_dbgfs_read_usbinfo(struct file *file, char __user *ubuf, usb_info->write_cnt, work_pending(&usb_info->read_work), work_pending(&usb_info->read_done_work), - work_pending(&usb_info->connect_work), - work_pending(&usb_info->disconnect_work), + work_pending(&usb_info->event_work), usb_info->max_size); bytes_in_buffer += bytes_written; diff --git a/drivers/char/diag/diag_usb.c b/drivers/char/diag/diag_usb.c index 43cf043eb7d5..46e4c5692c16 100644 --- a/drivers/char/diag/diag_usb.c +++ b/drivers/char/diag/diag_usb.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2020, 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 @@ -94,7 +94,29 @@ struct diag_usb_info diag_usb[NUM_DIAG_USB_DEV] = { } #endif }; +static int diag_usb_event_add(struct diag_usb_info *usb_info, int data) +{ + struct diag_usb_event_q *entry = NULL; + entry = kzalloc(sizeof(struct diag_usb_event_q), GFP_ATOMIC); + if (!entry) + return -ENOMEM; + + entry->data = data; + INIT_LIST_HEAD(&entry->link); + list_add_tail(&entry->link, &usb_info->event_q); + + return 0; +} +static void diag_usb_event_remove(struct diag_usb_event_q *entry) +{ + if (!entry) + return; + + list_del(&entry->link); + kfree(entry); + entry = NULL; +} static int diag_usb_buf_tbl_add(struct diag_usb_info *usb_info, unsigned char *buf, uint32_t len, int ctxt) { @@ -202,25 +224,6 @@ static void usb_connect(struct diag_usb_info *ch) queue_work(ch->usb_wq, &(ch->read_work)); } -static void usb_connect_work_fn(struct work_struct *work) -{ - struct diag_usb_info *ch = container_of(work, struct diag_usb_info, - connect_work); - - wait_event_interruptible(ch->wait_q, ch->enabled > 0); - ch->max_size = usb_diag_request_size(ch->hdl); - atomic_set(&ch->connected, 1); - - DIAG_LOG(DIAG_DEBUG_PERIPHERALS, - "diag: USB channel %s: disconnected_status: %d, connected_status: %d\n", - ch->name, atomic_read(&ch->disconnected), atomic_read(&ch->connected)); - - usb_connect(ch); - - if (atomic_read(&ch->disconnected)) - wake_up_interruptible(&ch->wait_q); -} - /* * This function is called asynchronously when USB is disconnected * and synchronously when Diag wants to disconnect from USB @@ -232,32 +235,63 @@ static void usb_disconnect(struct diag_usb_info *ch) ch->ops->close(ch->ctxt, DIAG_USB_MODE); } -static void usb_disconnect_work_fn(struct work_struct *work) +static void usb_event_work_fn(struct work_struct *work) { struct diag_usb_info *ch = container_of(work, struct diag_usb_info, - disconnect_work); + event_work); + struct diag_usb_event_q *entry = NULL; + unsigned long flags; if (!ch) return; + spin_lock_irqsave(&ch->event_lock, flags); + entry = list_first_entry(&(ch->event_q), struct diag_usb_event_q, link); + if (!entry) { + spin_unlock_irqrestore(&ch->event_lock, flags); + return; + } - atomic_set(&ch->disconnected, 1); - DIAG_LOG(DIAG_DEBUG_PERIPHERALS, - "diag: USB channel %s: disconnected_status: %d, connected_status: %d\n", - ch->name, atomic_read(&ch->disconnected), atomic_read(&ch->connected)); + switch (entry->data) { + case USB_DIAG_CONNECT: - wait_event_interruptible(ch->wait_q, atomic_read(&ch->connected) > 0); - atomic_set(&ch->connected, 0); - atomic_set(&ch->disconnected, 0); - DIAG_LOG(DIAG_DEBUG_PERIPHERALS, - "diag: USB channel %s: Cleared disconnected(%d) and connected(%d) status\n", - ch->name, atomic_read(&ch->disconnected), atomic_read(&ch->connected)); + diag_usb_event_remove(entry); + spin_unlock_irqrestore(&ch->event_lock, flags); - if (!atomic_read(&ch->connected) && - driver->usb_connected && diag_mask_param() && - ch->id == DIAG_USB_LOCAL) - diag_clear_masks(0); + wait_event_interruptible(ch->wait_q, ch->enabled > 0); + ch->max_size = usb_diag_request_size(ch->hdl); + atomic_set(&ch->connected, 1); + + DIAG_LOG(DIAG_DEBUG_PERIPHERALS, + "diag: USB channel %s: connected_status: %d\n", + ch->name, atomic_read(&ch->connected)); + + usb_connect(ch); + break; + case USB_DIAG_DISCONNECT: + + diag_usb_event_remove(entry); + spin_unlock_irqrestore(&ch->event_lock, flags); + + atomic_set(&ch->connected, 0); + DIAG_LOG(DIAG_DEBUG_PERIPHERALS, + "diag: USB channel %s: Cleared connected(%d) status\n", + ch->name, atomic_read(&ch->connected)); + + if (!atomic_read(&ch->connected) && + driver->usb_connected && + (ch->id == DIAG_USB_LOCAL) && diag_mask_param()) + diag_clear_masks(0); + + usb_disconnect(ch); + break; + default: + spin_unlock_irqrestore(&ch->event_lock, flags); + break; + } + + if (!list_empty(&ch->event_q)) + queue_work(ch->usb_wq, &(ch->event_work)); - usb_disconnect(ch); } static void usb_read_work_fn(struct work_struct *work) @@ -352,8 +386,7 @@ static void diag_usb_write_done(struct diag_usb_info *ch, spin_unlock_irqrestore(&ch->write_lock, flags); return; } - DIAG_LOG(DIAG_DEBUG_MUX, "full write_done, ctxt: %d\n", - ctxt); + DIAG_LOG(DIAG_DEBUG_MUX, "full write_done\n"); list_del(&entry->track); ctxt = entry->ctxt; buf = entry->buf; @@ -386,15 +419,20 @@ static void diag_usb_notifier(void *priv, unsigned int event, case USB_DIAG_CONNECT: pr_info("diag: USB channel %s: Received Connect event\n", usb_info->name); - if (!atomic_read(&usb_info->connected)) - queue_work(usb_info->usb_wq, - &usb_info->connect_work); + spin_lock_irqsave(&usb_info->event_lock, flags); + diag_usb_event_add(usb_info, USB_DIAG_CONNECT); + spin_unlock_irqrestore(&usb_info->event_lock, flags); + queue_work(usb_info->usb_wq, + &usb_info->event_work); break; case USB_DIAG_DISCONNECT: pr_info("diag: USB channel %s: Received Disconnect event\n", usb_info->name); + spin_lock_irqsave(&usb_info->event_lock, flags); + diag_usb_event_add(usb_info, USB_DIAG_DISCONNECT); + spin_unlock_irqrestore(&usb_info->event_lock, flags); queue_work(usb_info->usb_wq, - &usb_info->disconnect_work); + &usb_info->event_work); break; case USB_DIAG_READ_DONE: spin_lock_irqsave(&usb_info->lock, flags); @@ -665,6 +703,7 @@ int diag_usb_register(int id, int ctxt, struct diag_mux_ops *ops) ch->ctxt = ctxt; spin_lock_init(&ch->lock); spin_lock_init(&ch->write_lock); + spin_lock_init(&ch->event_lock); ch->read_buf = kzalloc(USB_MAX_OUT_BUF, GFP_KERNEL); if (!ch->read_buf) goto err; @@ -672,7 +711,6 @@ int diag_usb_register(int id, int ctxt, struct diag_mux_ops *ops) if (!ch->read_ptr) goto err; atomic_set(&ch->connected, 0); - atomic_set(&ch->disconnected, 0); atomic_set(&ch->read_pending, 0); /* * This function is called when the mux registers with Diag-USB. @@ -681,11 +719,11 @@ int diag_usb_register(int id, int ctxt, struct diag_mux_ops *ops) */ atomic_set(&ch->diag_state, 1); INIT_LIST_HEAD(&ch->buf_tbl); + INIT_LIST_HEAD(&ch->event_q); diagmem_init(driver, ch->mempool); INIT_WORK(&(ch->read_work), usb_read_work_fn); INIT_WORK(&(ch->read_done_work), usb_read_done_work_fn); - INIT_WORK(&(ch->connect_work), usb_connect_work_fn); - INIT_WORK(&(ch->disconnect_work), usb_disconnect_work_fn); + INIT_WORK(&(ch->event_work), usb_event_work_fn); init_waitqueue_head(&ch->wait_q); strlcpy(wq_name, "DIAG_USB_", sizeof(wq_name)); strlcat(wq_name, ch->name, sizeof(wq_name)); diff --git a/drivers/char/diag/diag_usb.h b/drivers/char/diag/diag_usb.h index 95ef5ed58774..abebb0c309aa 100644 --- a/drivers/char/diag/diag_usb.h +++ b/drivers/char/diag/diag_usb.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2020, 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 @@ -46,6 +46,11 @@ struct diag_usb_buf_tbl_t { int ctxt; }; +struct diag_usb_event_q { + struct list_head link; + int data; +}; + struct diag_usb_info { int id; int ctxt; @@ -53,7 +58,6 @@ struct diag_usb_info { atomic_t connected; atomic_t diag_state; atomic_t read_pending; - atomic_t disconnected; int enabled; int mempool; int max_size; @@ -62,16 +66,17 @@ struct diag_usb_info { unsigned long write_cnt; spinlock_t lock; spinlock_t write_lock; + spinlock_t event_lock; struct usb_diag_ch *hdl; struct diag_mux_ops *ops; unsigned char *read_buf; struct diag_request *read_ptr; struct work_struct read_work; struct work_struct read_done_work; - struct work_struct connect_work; - struct work_struct disconnect_work; + struct work_struct event_work; struct workqueue_struct *usb_wq; wait_queue_head_t wait_q; + struct list_head event_q; }; #ifdef CONFIG_DIAG_OVER_USB diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 7ee62043cab9..296e1f263328 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -69,7 +69,7 @@ static struct hlist_head *all_lists[] = { NULL, }; -static struct hlist_head *orphan_list[] = { +static struct hlist_head __maybe_unused *orphan_list[] = { &clk_orphan_list, NULL, }; diff --git a/drivers/clk/qcom/gcc-qcs405.c b/drivers/clk/qcom/gcc-qcs405.c index 081df4a32e5b..da0fc7d409d0 100644 --- a/drivers/clk/qcom/gcc-qcs405.c +++ b/drivers/clk/qcom/gcc-qcs405.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, 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 @@ -853,7 +853,9 @@ static struct clk_rcg2 byte0_clk_src = { }; static const struct freq_tbl ftbl_emac_clk_src[] = { + F(2500000, P_GPLL1_OUT_MAIN, 4, 1, 50), F(5000000, P_GPLL1_OUT_MAIN, 2, 1, 50), + F(25000000, P_GPLL1_OUT_MAIN, 1, 1, 20), F(50000000, P_GPLL1_OUT_MAIN, 10, 0, 0), F(125000000, P_GPLL1_OUT_MAIN, 4, 0, 0), F(250000000, P_GPLL1_OUT_MAIN, 2, 0, 0), diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 759ed93f4ba8..cc58505b3eca 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c @@ -332,7 +332,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, }; struct drm_connector **connector_list; int num_connectors, ret; - bool visible; + bool visible = false; ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip, diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_parser.c b/drivers/gpu/drm/msm/dsi-staging/dsi_parser.c index d6e743754da7..94f787bfeb7f 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_parser.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_parser.c @@ -242,7 +242,7 @@ static bool dsi_parser_parse_prop(struct device *dev, if (!prop->raw) goto end; - strlcpy(prop->raw, buf, strlen(buf) + 1); + strlcpy(prop->raw, buf, strlen(prop->raw)); found = true; diff --git a/drivers/gpu/drm/msm/sde/sde_encoder.c b/drivers/gpu/drm/msm/sde/sde_encoder.c index 2eaac555d3b6..780810719d7e 100644 --- a/drivers/gpu/drm/msm/sde/sde_encoder.c +++ b/drivers/gpu/drm/msm/sde/sde_encoder.c @@ -224,6 +224,7 @@ enum sde_enc_rc_states { * @cur_conn_roi: current connector roi * @prv_conn_roi: previous connector roi to optimize if unchanged * @crtc pointer to drm_crtc + * @first_kickoff_done: boolean for whether the first kickoff is done * @recovery_events_enabled: status of hw recovery feature enable by client * @elevated_ahb_vote: increase AHB bus speed for the first frame * after power collapse @@ -284,6 +285,7 @@ struct sde_encoder_virt { struct sde_rect cur_conn_roi; struct sde_rect prv_conn_roi; struct drm_crtc *crtc; + bool first_kickoff_done; bool recovery_events_enabled; bool elevated_ahb_vote; @@ -4700,7 +4702,7 @@ static int _sde_encoder_reset_ctl_hw(struct drm_encoder *drm_enc) void sde_encoder_kickoff(struct drm_encoder *drm_enc, bool is_error) { - static bool first_run = true; + static __maybe_unused bool first_run = true; struct sde_encoder_virt *sde_enc; struct sde_encoder_phys *phys; ktime_t wakeup_time; @@ -4740,17 +4742,15 @@ void sde_encoder_kickoff(struct drm_encoder *drm_enc, bool is_error) * Trigger a panel reset if this is the first kickoff and the refresh * rate is not 60 Hz */ - if (cmpxchg(&first_run, true, false) && + if (!cmpxchg(&sde_enc->first_kickoff_done, false, true) && sde_enc->crtc->mode.vrefresh != 60) { - struct sde_connector *conn = container_of(phys->connector, struct sde_connector, base); + struct sde_connector *conn = to_sde_connector(phys->connector); struct drm_event event = { .type = DRM_EVENT_PANEL_DEAD, .length = sizeof(bool) }; conn->panel_dead = true; - event.type = DRM_EVENT_PANEL_DEAD; - event.length = sizeof(bool); msm_mode_object_event_notify(&conn->base.base, conn->base.dev, &event, (u8 *) &conn->panel_dead); } diff --git a/drivers/gpu/msm/a6xx_reg.h b/drivers/gpu/msm/a6xx_reg.h index 19b97a557224..d0751f298775 100644 --- a/drivers/gpu/msm/a6xx_reg.h +++ b/drivers/gpu/msm/a6xx_reg.h @@ -1076,6 +1076,7 @@ /* GPUCC registers */ #define A6XX_GPU_CC_GX_GDSCR 0x24403 #define A6XX_GPU_CC_GX_DOMAIN_MISC 0x24542 +#define A6XX_GPU_CC_CX_GDSCR 0x2441B /* GPU RSC sequencer registers */ #define A6XX_RSCC_PDC_SEQ_START_ADDR 0x23408 diff --git a/drivers/gpu/msm/adreno_a5xx.c b/drivers/gpu/msm/adreno_a5xx.c index ba46bd46d450..ef32eba17581 100644 --- a/drivers/gpu/msm/adreno_a5xx.c +++ b/drivers/gpu/msm/adreno_a5xx.c @@ -3315,11 +3315,11 @@ static void a5xx_gpmu_int_callback(struct adreno_device *adreno_dev, int bit) } /* - * a5x_gpc_err_int_callback() - Isr for GPC error interrupts + * a5xx_gpc_err_int_callback() - Isr for GPC error interrupts * @adreno_dev: Pointer to device * @bit: Interrupt bit */ -void a5x_gpc_err_int_callback(struct adreno_device *adreno_dev, int bit) +static void a5xx_gpc_err_int_callback(struct adreno_device *adreno_dev, int bit) { struct kgsl_device *device = KGSL_DEVICE(adreno_dev); @@ -3329,7 +3329,7 @@ void a5x_gpc_err_int_callback(struct adreno_device *adreno_dev, int bit) * with help of register dump. */ - KGSL_DRV_CRIT(device, "RBBM: GPC error\n"); + KGSL_DRV_CRIT_RATELIMIT(device, "RBBM: GPC error\n"); adreno_irqctrl(adreno_dev, 0); /* Trigger a fault in the dispatcher - this will effect a restart */ @@ -3367,7 +3367,7 @@ static struct adreno_irq_funcs a5xx_irq_funcs[32] = { ADRENO_IRQ_CALLBACK(a5xx_err_callback), /* 6 - RBBM_ATB_ASYNC_OVERFLOW */ ADRENO_IRQ_CALLBACK(a5xx_err_callback), - ADRENO_IRQ_CALLBACK(a5x_gpc_err_int_callback), /* 7 - GPC_ERR */ + ADRENO_IRQ_CALLBACK(a5xx_gpc_err_int_callback), /* 7 - GPC_ERR */ ADRENO_IRQ_CALLBACK(a5xx_preempt_callback),/* 8 - CP_SW */ ADRENO_IRQ_CALLBACK(a5xx_cp_hw_err_callback), /* 9 - CP_HW_ERROR */ /* 10 - CP_CCU_FLUSH_DEPTH_TS */ diff --git a/drivers/gpu/msm/adreno_a6xx.c b/drivers/gpu/msm/adreno_a6xx.c index 0506231ea9b7..4fe30ac71706 100644 --- a/drivers/gpu/msm/adreno_a6xx.c +++ b/drivers/gpu/msm/adreno_a6xx.c @@ -1760,6 +1760,29 @@ static void a6xx_cp_callback(struct adreno_device *adreno_dev, int bit) adreno_dispatcher_schedule(device); } +/* + * a6xx_gpc_err_int_callback() - Isr for GPC error interrupts + * @adreno_dev: Pointer to device + * @bit: Interrupt bit + */ +static void a6xx_gpc_err_int_callback(struct adreno_device *adreno_dev, int bit) +{ + struct kgsl_device *device = KGSL_DEVICE(adreno_dev); + + /* + * GPC error is typically the result of mistake SW programming. + * Force GPU fault for this interrupt so that we can debug it + * with help of register dump. + */ + + KGSL_DRV_CRIT_RATELIMIT(device, "RBBM: GPC error\n"); + adreno_irqctrl(adreno_dev, 0); + + /* Trigger a fault in the dispatcher - this will effect a restart */ + adreno_set_gpu_fault(adreno_dev, ADRENO_SOFT_FAULT); + adreno_dispatcher_schedule(device); +} + #define A6XX_INT_MASK \ ((1 << A6XX_INT_CP_AHB_ERROR) | \ (1 << A6XX_INT_ATB_ASYNCFIFO_OVERFLOW) | \ @@ -1785,7 +1808,7 @@ static struct adreno_irq_funcs a6xx_irq_funcs[32] = { ADRENO_IRQ_CALLBACK(NULL), /* 5 - UNUSED */ /* 6 - RBBM_ATB_ASYNC_OVERFLOW */ ADRENO_IRQ_CALLBACK(a6xx_err_callback), - ADRENO_IRQ_CALLBACK(NULL), /* 7 - GPC_ERR */ + ADRENO_IRQ_CALLBACK(a6xx_gpc_err_int_callback), /* 7 - GPC_ERR */ ADRENO_IRQ_CALLBACK(a6xx_preemption_callback),/* 8 - CP_SW */ ADRENO_IRQ_CALLBACK(a6xx_cp_hw_err_callback), /* 9 - CP_HW_ERROR */ ADRENO_IRQ_CALLBACK(NULL), /* 10 - CP_CCU_FLUSH_DEPTH_TS */ diff --git a/drivers/gpu/msm/adreno_a6xx_gmu.c b/drivers/gpu/msm/adreno_a6xx_gmu.c index d5eb3507c473..5812072d99b4 100644 --- a/drivers/gpu/msm/adreno_a6xx_gmu.c +++ b/drivers/gpu/msm/adreno_a6xx_gmu.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2018-2020, 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 @@ -350,6 +350,8 @@ static int a6xx_gmu_start(struct kgsl_device *device) /* Bring GMU out of reset */ gmu_core_regwrite(device, A6XX_GMU_CM3_SYSRESET, 0); + /* Make sure the request completes before continuing */ + wmb(); if (timed_poll_check(device, A6XX_GMU_CM3_FW_INIT_RESULT, 0xBABEFACE, @@ -828,6 +830,21 @@ static bool a6xx_gmu_gx_is_on(struct adreno_device *adreno_dev) return is_on(val); } +/* + * a6xx_gmu_cx_is_on() - Check if CX is on using GPUCC register + * @device - Pointer to KGSL device struct + */ +static bool a6xx_gmu_cx_is_on(struct kgsl_device *device) +{ + unsigned int val; + + if (ADRENO_QUIRK(ADRENO_DEVICE(device), ADRENO_QUIRK_CX_GDSC)) + return regulator_is_enabled(KGSL_GMU_DEVICE(device)->cx_gdsc); + + gmu_core_regread(device, A6XX_GPU_CC_CX_GDSCR, &val); + return (val & BIT(31)); +} + /* * a6xx_gmu_sptprac_is_on() - Check if SPTP is on using pwr status register * @adreno_dev - Pointer to adreno_device @@ -1047,6 +1064,13 @@ static int a6xx_gmu_fw_start(struct kgsl_device *device, gmu_core_regwrite(device, A6XX_GMU_AHB_FENCE_RANGE_0, GMU_FENCE_RANGE_MASK); + /* + * Make sure that CM3 state is at reset value. Snapshot is changing + * NMI bit and if we boot up GMU with NMI bit set.GMU will boot straight + * in to NMI handler without executing __main code + */ + gmu_core_regwrite(device, A6XX_GMU_CM3_CFG, 0x4052); + /* Pass chipid to GMU FW, must happen before starting GMU */ /* Keep Core and Major bitfields unchanged */ @@ -1188,6 +1212,8 @@ static int a6xx_gmu_suspend(struct kgsl_device *device) /* Check no outstanding RPMh voting */ a6xx_complete_rpmh_votes(device); + gmu_core_regwrite(device, A6XX_GMU_CM3_SYSRESET, 1); + /* * This is based on the assumption that GMU is the only one controlling * the GX HS. This code path is the only client voting for GX through @@ -1546,6 +1572,7 @@ struct gmu_dev_ops adreno_a6xx_gmudev = { .enable_lm = a6xx_gmu_enable_lm, .rpmh_gpu_pwrctrl = a6xx_gmu_rpmh_gpu_pwrctrl, .gx_is_on = a6xx_gmu_gx_is_on, + .cx_is_on = a6xx_gmu_cx_is_on, .wait_for_lowest_idle = a6xx_gmu_wait_for_lowest_idle, .wait_for_gmu_idle = a6xx_gmu_wait_for_idle, .ifpc_store = a6xx_gmu_ifpc_store, diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c index c346f4174e41..38a01e142698 100644 --- a/drivers/gpu/msm/kgsl.c +++ b/drivers/gpu/msm/kgsl.c @@ -2683,7 +2683,7 @@ long kgsl_ioctl_gpuobj_import(struct kgsl_device_private *dev_priv, return 0; unmap: - if (param->type == KGSL_USER_MEM_TYPE_DMABUF) { + if (kgsl_memdesc_usermem_type(&entry->memdesc) == KGSL_MEM_ENTRY_ION) { kgsl_destroy_ion(entry->priv_data); entry->memdesc.sgt = NULL; } @@ -2997,7 +2997,7 @@ long kgsl_ioctl_map_user_mem(struct kgsl_device_private *dev_priv, return result; error_attach: - switch (memtype) { + switch (kgsl_memdesc_usermem_type(&entry->memdesc)) { case KGSL_MEM_ENTRY_ION: kgsl_destroy_ion(entry->priv_data); entry->memdesc.sgt = NULL; @@ -4901,7 +4901,7 @@ int kgsl_device_platform_probe(struct kgsl_device *device) { int status = -EINVAL; struct resource *res; - int cpu; + __maybe_unused int cpu; status = _register_device(device); if (status) diff --git a/drivers/gpu/msm/kgsl_gmu.c b/drivers/gpu/msm/kgsl_gmu.c index cf993e7ebbf1..770ac448df1b 100644 --- a/drivers/gpu/msm/kgsl_gmu.c +++ b/drivers/gpu/msm/kgsl_gmu.c @@ -964,6 +964,8 @@ static int gmu_rpmh_init(struct kgsl_device *device, static void send_nmi_to_gmu(struct adreno_device *adreno_dev) { + u32 val; + /* Mask so there's no interrupt caused by NMI */ adreno_write_gmureg(adreno_dev, ADRENO_REG_GMU_GMU2HOST_INTR_MASK, 0xFFFFFFFF); @@ -972,9 +974,10 @@ static void send_nmi_to_gmu(struct adreno_device *adreno_dev) wmb(); adreno_write_gmureg(adreno_dev, ADRENO_REG_GMU_NMI_CONTROL_STATUS, 0); - adreno_write_gmureg(adreno_dev, - ADRENO_REG_GMU_CM3_CFG, - (1 << GMU_CM3_CFG_NONMASKINTR_SHIFT)); + + adreno_read_gmureg(adreno_dev, ADRENO_REG_GMU_CM3_CFG, &val); + val |= 1 << GMU_CM3_CFG_NONMASKINTR_SHIFT; + adreno_write_gmureg(adreno_dev, ADRENO_REG_GMU_CM3_CFG, val); /* Make sure the NMI is invoked before we proceed*/ wmb(); @@ -1538,8 +1541,9 @@ static int gmu_enable_gdsc(struct gmu_device *gmu) } #define CX_GDSC_TIMEOUT 5000 /* ms */ -static int gmu_disable_gdsc(struct gmu_device *gmu) +static int gmu_disable_gdsc(struct kgsl_device *device) { + struct gmu_device *gmu = KGSL_GMU_DEVICE(device); int ret; unsigned long t; @@ -1561,13 +1565,13 @@ static int gmu_disable_gdsc(struct gmu_device *gmu) */ t = jiffies + msecs_to_jiffies(CX_GDSC_TIMEOUT); do { - if (!regulator_is_enabled(gmu->cx_gdsc)) + if (!gmu_core_dev_cx_is_on(device)) return 0; usleep_range(10, 100); } while (!(time_after(jiffies, t))); - if (!regulator_is_enabled(gmu->cx_gdsc)) + if (!gmu_core_dev_cx_is_on(device)) return 0; dev_err(&gmu->pdev->dev, "GMU CX gdsc off timeout"); @@ -1595,7 +1599,7 @@ static int gmu_suspend(struct kgsl_device *device) if (ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_CX_GDSC)) regulator_set_mode(gmu->cx_gdsc, REGULATOR_MODE_IDLE); - gmu_disable_gdsc(gmu); + gmu_disable_gdsc(device); if (ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_CX_GDSC)) regulator_set_mode(gmu->cx_gdsc, REGULATOR_MODE_NORMAL); @@ -1752,7 +1756,7 @@ static void gmu_stop(struct kgsl_device *device) gmu_dev_ops->rpmh_gpu_pwrctrl(adreno_dev, GMU_FW_STOP, 0, 0); gmu_disable_clks(device); - gmu_disable_gdsc(gmu); + gmu_disable_gdsc(device); msm_bus_scale_client_update_request(gmu->pcl, 0); return; @@ -1862,7 +1866,7 @@ static bool gmu_is_initialized(struct kgsl_device *device) ret = gmu_dev_ops->is_initialized(adreno_dev); gmu_disable_clks(device); - gmu_disable_gdsc(gmu); + gmu_disable_gdsc(device); return ret; } diff --git a/drivers/gpu/msm/kgsl_gmu_core.c b/drivers/gpu/msm/kgsl_gmu_core.c index 1116b6b7dada..140baea8efdc 100644 --- a/drivers/gpu/msm/kgsl_gmu_core.c +++ b/drivers/gpu/msm/kgsl_gmu_core.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2018-2020, 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 @@ -275,6 +275,16 @@ void gmu_core_regrmw(struct kgsl_device *device, gmu_core_regwrite(device, offsetwords, val | bits); } +bool gmu_core_dev_cx_is_on(struct kgsl_device *device) +{ + struct gmu_dev_ops *ops = GMU_DEVICE_OPS(device); + + if (ops && ops->cx_is_on) + return ops->cx_is_on(device); + + return true; +} + bool gmu_core_is_initialized(struct kgsl_device *device) { struct gmu_core_ops *gmu_core_ops = GMU_CORE_OPS(device); diff --git a/drivers/gpu/msm/kgsl_gmu_core.h b/drivers/gpu/msm/kgsl_gmu_core.h index 3dff7fafbe12..e2f956cc9dc7 100644 --- a/drivers/gpu/msm/kgsl_gmu_core.h +++ b/drivers/gpu/msm/kgsl_gmu_core.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2018-2020, 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 @@ -164,6 +164,7 @@ struct gmu_dev_ops { unsigned int val); unsigned int (*ifpc_show)(struct adreno_device *adreno_dev); void (*snapshot)(struct adreno_device *, struct kgsl_snapshot *); + bool (*cx_is_on)(struct kgsl_device *device); void (*halt_execution)(struct kgsl_device *device); int (*wait_for_active_transition)(struct adreno_device *adreno_dev); bool (*is_initialized)(struct adreno_device *adreno_dev); @@ -231,6 +232,7 @@ void gmu_core_blkwrite(struct kgsl_device *device, unsigned int offsetwords, void gmu_core_regrmw(struct kgsl_device *device, unsigned int offsetwords, unsigned int mask, unsigned int bits); const char *gmu_core_oob_type_str(enum oob_request req); +bool gmu_core_dev_cx_is_on(struct kgsl_device *device); bool gmu_core_is_initialized(struct kgsl_device *device); u64 gmu_core_dev_read_ao_counter(struct kgsl_device *device); #endif /* __KGSL_GMU_CORE_H */ diff --git a/drivers/gpu/msm/kgsl_iommu.c b/drivers/gpu/msm/kgsl_iommu.c index ca65e8fc0dfd..a493c4fbe8d8 100644 --- a/drivers/gpu/msm/kgsl_iommu.c +++ b/drivers/gpu/msm/kgsl_iommu.c @@ -2502,6 +2502,22 @@ static uint64_t kgsl_iommu_find_svm_region(struct kgsl_pagetable *pagetable, return addr; } +static bool iommu_addr_in_svm_ranges(struct kgsl_iommu_pt *pt, + u64 gpuaddr, u64 size) +{ + if ((gpuaddr >= pt->compat_va_start && gpuaddr < pt->compat_va_end) && + ((gpuaddr + size) > pt->compat_va_start && + (gpuaddr + size) <= pt->compat_va_end)) + return true; + + if ((gpuaddr >= pt->svm_start && gpuaddr < pt->svm_end) && + ((gpuaddr + size) > pt->svm_start && + (gpuaddr + size) <= pt->svm_end)) + return true; + + return false; +} + static int kgsl_iommu_set_svm_region(struct kgsl_pagetable *pagetable, uint64_t gpuaddr, uint64_t size) { @@ -2509,9 +2525,8 @@ static int kgsl_iommu_set_svm_region(struct kgsl_pagetable *pagetable, struct kgsl_iommu_pt *pt = pagetable->priv; struct rb_node *node; - /* Make sure the requested address doesn't fall in the global range */ - if (ADDR_IN_GLOBAL(pagetable->mmu, gpuaddr) || - ADDR_IN_GLOBAL(pagetable->mmu, gpuaddr + size)) + /* Make sure the requested address doesn't fall out of SVM range */ + if (!iommu_addr_in_svm_ranges(pt, gpuaddr, size)) return -ENOMEM; spin_lock(&pagetable->lock); diff --git a/drivers/gpu/msm/kgsl_pwrctrl.c b/drivers/gpu/msm/kgsl_pwrctrl.c index 118840f87ce3..4317de6d6fee 100644 --- a/drivers/gpu/msm/kgsl_pwrctrl.c +++ b/drivers/gpu/msm/kgsl_pwrctrl.c @@ -2471,8 +2471,7 @@ int kgsl_pwrctrl_init(struct kgsl_device *device) KGSL_PWR_ERR(device, "Failed to register client with CX Ipeak %d\n", result); - //goto error_cleanup_pwr_limit; - result = 0; + goto error_cleanup_pwr_limit; } } return result; diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index 605e76a0f184..4b67f35fd077 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -94,8 +94,6 @@ struct cti_drvdata { struct coresight_cti cti; int refcnt; int cpu; - unsigned int trig_num_max; - unsigned int ch_num_max; bool cti_save; bool cti_hwclk; bool l2_off; @@ -1363,14 +1361,52 @@ static ssize_t cti_store_disable_gate(struct device *dev, } static DEVICE_ATTR(disable_gate, 0200, NULL, cti_store_disable_gate); -static ssize_t show_info_show(struct device *dev, struct device_attribute *attr, - char *buf) +struct cti_reg { + void __iomem *addr; + u32 data; +}; + +static void do_smp_cross_read(void *data) +{ + struct cti_reg *reg = data; + + reg->data = readl_relaxed(reg->addr); +} + +static u32 cti_devid_cross_read(const struct cti_drvdata *drvdata) +{ + struct cti_reg reg; + + reg.addr = drvdata->base + DEVID; + smp_call_function_single(drvdata->cpu, do_smp_cross_read, ®, 1); + return reg.data; +} + +static ssize_t show_info_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent); ssize_t size = 0; + unsigned int ctidevid, trig_num_max, chan_num_max; + + mutex_lock(&drvdata->mutex); + + pm_runtime_get_sync(drvdata->dev); + + if (drvdata->cpu == -ENODEV) + ctidevid = cti_readl(drvdata, DEVID); + else + ctidevid = cti_devid_cross_read(drvdata); + + pm_runtime_put_sync(drvdata->dev); + + trig_num_max = (ctidevid & GENMASK(15, 8)) >> 8; + chan_num_max = (ctidevid & GENMASK(21, 16)) >> 16; size = scnprintf(&buf[size], PAGE_SIZE, "%d %d\n", - drvdata->trig_num_max, drvdata->ch_num_max); + trig_num_max, chan_num_max); + + mutex_unlock(&drvdata->mutex); return size; } @@ -1433,7 +1469,6 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id) { int ret; int trig; - unsigned int ctidevid; struct device *dev = &adev->dev; struct coresight_platform_data *pdata; struct cti_drvdata *drvdata; @@ -1541,9 +1576,6 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id) registered++; } - ctidevid = cti_readl(drvdata, DEVID); - drvdata->trig_num_max = (ctidevid & GENMASK(15, 8)) >> 8; - drvdata->ch_num_max = (ctidevid & GENMASK(21, 16)) >> 16; pm_runtime_put(&adev->dev); dev_dbg(dev, "CTI initialized\n"); return 0; diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index ad591c9afbf7..cb1d4ff99341 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -803,7 +803,6 @@ static int geni_i2c_probe(struct platform_device *pdev) struct platform_device *wrapper_pdev; struct device_node *wrapper_ph_node; int ret; - char boot_marker[40]; u32 geni_i2c_clk_map_dt[5]; gi2c = devm_kzalloc(&pdev->dev, sizeof(*gi2c), GFP_KERNEL); diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 787afba77b2e..33d6011ac461 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c @@ -6,6 +6,7 @@ */ #include "dm-core.h" +#include "dm-ioctrl.h" #include #include @@ -2056,3 +2057,37 @@ out: return r; } + +int __init dm_ioctrl(uint cmd, struct dm_ioctl *param) +{ + int r = 0; + int ioctl_flags; + ioctl_fn fn = NULL; + size_t input_param_size; + + /* + * Nothing more to do for the version command. + */ + if (cmd == DM_VERSION_CMD) + return 0; + + DMDEBUG("dm_ctl_ioctl: command 0x%x", cmd); + + fn = lookup_ioctl(cmd, &ioctl_flags); + if (!fn) { + DMWARN("dm_ctl_ioctl: unknown command 0x%x", cmd); + return -ENOTTY; + } + + input_param_size = param->data_size; + param->data_size = sizeof(*param); + + r = fn(NULL, param, input_param_size); + + if (unlikely(param->flags & DM_BUFFER_FULL_FLAG) && + unlikely(ioctl_flags & IOCTL_FLAGS_NO_PARAMS)) + DMERR("ioctl %d but has IOCTL_FLAGS_NO_PARAMS set", cmd); + + return r; +} +EXPORT_SYMBOL(dm_ioctrl); diff --git a/arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dtsi b/drivers/md/dm-ioctrl.h similarity index 68% rename from arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dtsi rename to drivers/md/dm-ioctrl.h index 6d198b235fbc..d331fcd83df4 100644 --- a/arch/arm64/boot/dts/qcom/qcs6125-iot-idp.dtsi +++ b/drivers/md/dm-ioctrl.h @@ -1,5 +1,4 @@ -/* - * Copyright (c) 2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2019, 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 @@ -10,4 +9,12 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ -#include "trinket-idp.dtsi" + +#ifndef DM_IOCTRL_INTERNAL_H +#define DM_IOCTRL_INTERNAL_H + +#include + +int dm_ioctrl(uint cmd, struct dm_ioctl *param); + +#endif diff --git a/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.c b/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.c index 305120afbf3e..ba0c2b9e1388 100644 --- a/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.c +++ b/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.c @@ -686,6 +686,7 @@ static void ais_vfe_q_bufs_to_hw(struct ais_vfe_hw_core_info *core_info, struct ais_vfe_bus_ver2_reg_offset_bus_client *client_regs = NULL; uint32_t fifo_status = 0; bool is_full = false; + struct ais_ife_rdi_get_timestamp_args get_ts; rdi_path = &core_info->rdi_out[path]; bus_hw_info = core_info->vfe_hw_info->bus_hw_info; @@ -704,10 +705,19 @@ static void ais_vfe_q_bufs_to_hw(struct ais_vfe_hw_core_info *core_info, struct ais_vfe_buffer_t, list); list_del_init(&vfe_buf->list); - CAM_DBG(CAM_ISP, "IFE%d|RDI%d: Q %d(0x%x) FIFO:%d", + get_ts.path = path; + get_ts.ts = &vfe_buf->ts_hw; + core_info->csid_hw->hw_ops.process_cmd( + core_info->csid_hw->hw_priv, + AIS_IFE_CSID_CMD_GET_TIME_STAMP, + &get_ts, + sizeof(get_ts)); + + + CAM_DBG(CAM_ISP, "IFE%d|RDI%d: Q %d(0x%x) FIFO:%d ts %llu", core_info->vfe_idx, path, vfe_buf->bufIdx, vfe_buf->iova_addr, - rdi_path->num_buffer_hw_q); + rdi_path->num_buffer_hw_q, vfe_buf->ts_hw.cur_sof_ts); cam_io_w_mb(vfe_buf->iova_addr, core_info->mem_base + client_regs->image_addr); @@ -715,6 +725,7 @@ static void ais_vfe_q_bufs_to_hw(struct ais_vfe_hw_core_info *core_info, list_add_tail(&vfe_buf->list, &rdi_path->buffer_hw_q); ++rdi_path->num_buffer_hw_q; + fifo_status = cam_io_r_mb(core_info->mem_base + bus_hw_info->common_reg.addr_fifo_status); is_full = fifo_status & (1 << path); @@ -906,9 +917,10 @@ static int ais_vfe_q_sof(struct ais_vfe_hw_core_info *core_info, } else { rc = -1; - CAM_ERR(CAM_ISP, "I%d|R%d|F%llu: free timestamp empty (%d)", + CAM_ERR(CAM_ISP, + "I%d|R%d|F%llu: free timestamp empty (%d) sof %llu", core_info->vfe_idx, path, p_sof->frame_cnt, - p_rdi->num_buffer_hw_q); + p_rdi->num_buffer_hw_q, p_sof->cur_sof_hw_ts); } return rc; @@ -948,6 +960,13 @@ static void ais_vfe_handle_sof_rdi(struct ais_vfe_hw_core_info *core_info, prev_sof_hw_ts, p_rdi->last_sof_info.cur_sof_hw_ts, ts_delta); + + CAM_DBG(CAM_ISP, + "I%d R%d miss_sof %u prev %llu last %llu cur %llu", + core_info->vfe_idx, path, + miss_sof, prev_sof_hw_ts, + p_rdi->last_sof_info.cur_sof_hw_ts, + cur_sof_hw_ts); } } @@ -1151,6 +1170,7 @@ static void ais_vfe_bus_handle_client_frame_done( uint64_t cur_sof_hw_ts; bool last_addr_match = false; + CAM_DBG(CAM_ISP, "I%d|R%d last_addr 0x%x", core_info->vfe_idx, path, last_addr); @@ -1168,6 +1188,7 @@ static void ais_vfe_bus_handle_client_frame_done( while (rdi_path->num_buffer_hw_q && !last_addr_match) { struct ais_sof_info_t *p_sof_info = NULL; + bool is_sof_match = false; if (list_empty(&rdi_path->buffer_hw_q)) { CAM_DBG(CAM_ISP, "I%d|R%d: FD while HW Q empty", @@ -1192,10 +1213,29 @@ static void ais_vfe_bus_handle_client_frame_done( rdi_path->num_buffer_hw_q, last_addr); if (!list_empty(&rdi_path->sof_info_q)) { - p_sof_info = list_first_entry(&rdi_path->sof_info_q, - struct ais_sof_info_t, list); - list_del_init(&p_sof_info->list); - rdi_path->num_sof_info_q--; + while (!is_sof_match && + !list_empty(&rdi_path->sof_info_q)) { + p_sof_info = + list_first_entry(&rdi_path->sof_info_q, + struct ais_sof_info_t, list); + list_del_init(&p_sof_info->list); + rdi_path->num_sof_info_q--; + if (p_sof_info->cur_sof_hw_ts > + vfe_buf->ts_hw.cur_sof_ts) { + is_sof_match = true; + break; + } + list_add_tail(&p_sof_info->list, + &rdi_path->free_sof_info_list); + } + + if (!is_sof_match) { + p_sof_info = NULL; + CAM_ERR(CAM_ISP, + "I%d|R%d: can't find the match sof", + core_info->vfe_idx, path); + } + } else CAM_ERR(CAM_ISP, "I%d|R%d: SOF info Q is empty", core_info->vfe_idx, path); @@ -1554,6 +1594,7 @@ irqreturn_t ais_vfe_irq(int irq_num, void *data) CAM_DBG(CAM_ISP, "IFE%d BUS_WR", core_info->vfe_idx); work_data.evt_type = AIS_VFE_HW_IRQ_EVENT_BUS_WR; ais_vfe_irq_fill_bus_wr_status(core_info, &work_data); + ais_vfe_dispatch_irq(vfe_hw, &work_data); } if (ife_status[1]) { diff --git a/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.h b/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.h index c4bd0648dd27..ad097ce4bd0f 100644 --- a/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.h +++ b/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.h @@ -82,6 +82,7 @@ struct ais_vfe_buffer_t { int32_t mem_handle; uint64_t iova_addr; uint32_t bufIdx; + struct ais_ife_rdi_timestamps ts_hw; }; struct ais_sof_info_t { diff --git a/drivers/media/platform/msm/ais/cam_sensor_module/cam_cci/cam_cci_core.c b/drivers/media/platform/msm/ais/cam_sensor_module/cam_cci/cam_cci_core.c index d2096599a158..f987b801b4e9 100755 --- a/drivers/media/platform/msm/ais/cam_sensor_module/cam_cci/cam_cci_core.c +++ b/drivers/media/platform/msm/ais/cam_sensor_module/cam_cci/cam_cci_core.c @@ -2016,7 +2016,14 @@ int32_t cam_cci_core_cfg(struct v4l2_subdev *sd, struct cam_cci_ctrl *cci_ctrl) { int32_t rc = 0; - struct cci_device *cci_dev = v4l2_get_subdevdata(sd); + struct cci_device *cci_dev; + + if (sd == NULL || cci_ctrl == NULL) { + CAM_ERR(CAM_CCI, "cci_ctrl or sd null"); + rc = -ENODEV; + return rc; + } + cci_dev = v4l2_get_subdevdata(sd); CAM_DBG(CAM_CCI, "cmd %d", cci_ctrl->cmd); @@ -2074,12 +2081,10 @@ int32_t cam_cci_core_cam_ctrl(struct v4l2_subdev *sd, CAM_DBG(CAM_CCI, "cmd %d", cmd->op_code); - if (cmd->op_code != AIS_SENSOR_I2C_POWER_DOWN) { - if (cmd->handle_type != CAM_HANDLE_USER_POINTER) { - CAM_ERR(CAM_CCI, "Invalid handle type: %d", + if (cmd->handle_type != CAM_HANDLE_USER_POINTER) { + CAM_ERR(CAM_CCI, "Invalid handle type: %d", cmd->handle_type); - return -EINVAL; - } + return -EINVAL; } cci_ctrl.cci_info = kzalloc(sizeof(struct cam_sensor_cci_client), @@ -2093,7 +2098,7 @@ int32_t cam_cci_core_cam_ctrl(struct v4l2_subdev *sd, sensor_cap.slot_info = cci_dev->soc_info.index; if (copy_to_user(u64_to_user_ptr(cmd->handle), - &sensor_cap, sizeof(struct cam_sensor_query_cap))) { + &sensor_cap, sizeof(sensor_cap))) { CAM_ERR(CAM_CCI, "Failed Copy to User"); rc = -EFAULT; } diff --git a/drivers/media/platform/msm/ais/cam_sensor_module/cam_cci/cam_cci_dev.c b/drivers/media/platform/msm/ais/cam_sensor_module/cam_cci/cam_cci_dev.c index 3cd3227799fe..db1eb99661d2 100644 --- a/drivers/media/platform/msm/ais/cam_sensor_module/cam_cci/cam_cci_dev.c +++ b/drivers/media/platform/msm/ais/cam_sensor_module/cam_cci/cam_cci_dev.c @@ -37,9 +37,6 @@ static long cam_cci_subdev_ioctl(struct v4l2_subdev *sd, } switch (cmd) { - case VIDIOC_MSM_CCI_CFG: - rc = cam_cci_core_cfg(sd, arg); - break; case VIDIOC_CAM_CONTROL: rc = cam_cci_core_cam_ctrl(sd, arg); break; diff --git a/drivers/media/platform/msm/ais/cam_sensor_module/cam_cci/cam_cci_dev.h b/drivers/media/platform/msm/ais/cam_sensor_module/cam_cci/cam_cci_dev.h index 1c21e035447e..3e410b30e0ac 100644 --- a/drivers/media/platform/msm/ais/cam_sensor_module/cam_cci/cam_cci_dev.h +++ b/drivers/media/platform/msm/ais/cam_sensor_module/cam_cci/cam_cci_dev.h @@ -324,7 +324,5 @@ static inline struct v4l2_subdev *cam_cci_get_subdev(int cci_dev_index) } #endif -#define VIDIOC_MSM_CCI_CFG \ - _IOWR('V', BASE_VIDIOC_PRIVATE + 23, struct cam_cci_ctrl *) #endif /* _CAM_CCI_DEV_H_ */ diff --git a/drivers/media/platform/msm/ais/cam_sensor_module/cam_sensor_io/cam_sensor_cci_i2c.c b/drivers/media/platform/msm/ais/cam_sensor_module/cam_sensor_io/cam_sensor_cci_i2c.c index 16edb38d0f88..0078142eead3 100644 --- a/drivers/media/platform/msm/ais/cam_sensor_module/cam_sensor_io/cam_sensor_cci_i2c.c +++ b/drivers/media/platform/msm/ais/cam_sensor_module/cam_sensor_io/cam_sensor_cci_i2c.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2018,2020 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 @@ -12,7 +12,7 @@ #include "cam_sensor_cmn_header.h" #include "cam_sensor_i2c.h" -#include "cam_cci_dev.h" +#include "cam_cci_core.h" int32_t cam_cci_i2c_read(struct cam_sensor_cci_client *cci_client, uint32_t addr, uint32_t *data, @@ -36,8 +36,8 @@ int32_t cam_cci_i2c_read(struct cam_sensor_cci_client *cci_client, cci_ctrl.cfg.cci_i2c_read_cfg.data_type = data_type; cci_ctrl.cfg.cci_i2c_read_cfg.data = buf; cci_ctrl.cfg.cci_i2c_read_cfg.num_byte = data_type; - rc = v4l2_subdev_call(cci_client->cci_subdev, - core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl); + + rc = cam_cci_core_cfg(cci_client->cci_subdev, &cci_ctrl); if (rc < 0) { CAM_ERR(CAM_SENSOR, "rc = %d", rc); return rc; @@ -88,14 +88,18 @@ int32_t cam_camera_cci_i2c_read_seq(struct cam_sensor_cci_client *cci_client, cci_ctrl.cfg.cci_i2c_read_cfg.data = buf; cci_ctrl.cfg.cci_i2c_read_cfg.num_byte = num_byte; cci_ctrl.status = -EFAULT; - rc = v4l2_subdev_call(cci_client->cci_subdev, - core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl); - rc = cci_ctrl.status; + + rc = cam_cci_core_cfg(cci_client->cci_subdev, &cci_ctrl); CAM_DBG(CAM_SENSOR, "addr = 0x%x, rc = %d", addr, rc); - for (i = 0; i < num_byte; i++) { - data[i] = buf[i]; - CAM_DBG(CAM_SENSOR, "Byte %d: Data: 0x%x\n", i, data[i]); + + if (!rc) { + for (i = 0; i < num_byte; i++) { + data[i] = buf[i]; + CAM_DBG(CAM_SENSOR, "Byte %d: Data: 0x%x", + i, data[i]); + } } + kfree(buf); return rc; } @@ -124,13 +128,13 @@ static int32_t cam_cci_i2c_write_table_cmd( cci_ctrl.cfg.cci_i2c_write_cfg.data_type = write_setting->data_type; cci_ctrl.cfg.cci_i2c_write_cfg.addr_type = write_setting->addr_type; cci_ctrl.cfg.cci_i2c_write_cfg.size = write_setting->size; - rc = v4l2_subdev_call(cci_client->cci_subdev, - core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl); + + rc = cam_cci_core_cfg(cci_client->cci_subdev, &cci_ctrl); if (rc < 0) { CAM_ERR(CAM_SENSOR, "Failed rc = %d", rc); return rc; } - rc = cci_ctrl.status; + if (write_setting->delay > 20) msleep(write_setting->delay); else if (write_setting->delay) @@ -229,11 +233,11 @@ int32_t cam_sensor_cci_i2c_util(struct cam_sensor_cci_client *cci_client, cci_ctrl.cmd = cci_cmd; cci_ctrl.cci_info = cci_client; - rc = v4l2_subdev_call(cci_client->cci_subdev, - core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl); + + rc = cam_cci_core_cfg(cci_client->cci_subdev, &cci_ctrl); if (rc < 0) { CAM_ERR(CAM_SENSOR, "Failed rc = %d", rc); - return rc; } - return cci_ctrl.status; + + return rc; } diff --git a/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c b/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c index 8d705b0a76d6..a4a4eb92f811 100644 --- a/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c +++ b/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c @@ -900,11 +900,13 @@ static int __cam_isp_ctx_reg_upd_in_epoch_state( else if (ctx_isp->fps && ((rup_event_data->irq_mono_boot_time - ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) { ctx_isp->irq_delay_detect = true; - trace_cam_isp_irq_delay_detect("IRQ delay at reg_upd", - ctx, req->request_id, - ctx_isp->substate_activated, - (rup_event_data->irq_mono_boot_time - - ctx_isp->irq_timestamps)); + + if (req) + trace_cam_isp_irq_delay_detect("IRQ delay at reg_upd", + ctx, req->request_id, + ctx_isp->substate_activated, + (rup_event_data->irq_mono_boot_time - + ctx_isp->irq_timestamps)); } ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time; @@ -1220,7 +1222,7 @@ end: static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp, void *evt_data) { - struct cam_ctx_request *req; + struct cam_ctx_request *req = NULL; struct cam_isp_ctx_req *req_isp = NULL; struct cam_context *ctx = ctx_isp->base; uint64_t request_id = 0; @@ -2332,7 +2334,7 @@ static int __cam_isp_ctx_dump_in_top_state(struct cam_context *ctx, struct timeval cur_time; int rc = 0; uintptr_t cpu_addr; - size_t buf_len; + size_t buf_len = 0; struct cam_isp_context_dump_header *hdr; uint64_t *addr, *start; uint8_t *dst; @@ -2511,6 +2513,7 @@ static int __cam_isp_ctx_flush_req_in_top_state( struct cam_hw_stop_args stop_args; struct cam_isp_start_args start_isp; struct cam_hw_reset_args reset_args; + if (flush_req->type == CAM_REQ_MGR_FLUSH_TYPE_ALL) { CAM_INFO(CAM_ISP, "ctx id:%d Last request id to flush is %lld", ctx->ctx_id, flush_req->req_id); diff --git a/drivers/media/platform/msm/camera/cam_lrme/lrme_hw_mgr/lrme_hw/cam_lrme_hw_dev.c b/drivers/media/platform/msm/camera/cam_lrme/lrme_hw_mgr/lrme_hw/cam_lrme_hw_dev.c index ec4297822fb7..4de0f639a670 100644 --- a/drivers/media/platform/msm/camera/cam_lrme/lrme_hw_mgr/lrme_hw/cam_lrme_hw_dev.c +++ b/drivers/media/platform/msm/camera/cam_lrme/lrme_hw_mgr/lrme_hw/cam_lrme_hw_dev.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2018, 2020 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 @@ -273,13 +273,15 @@ static int cam_lrme_hw_dev_remove(struct platform_device *pdev) kfree(lrme_core); deinit_platform_res: - rc = cam_lrme_soc_deinit_resources(&lrme_hw->soc_info); - if (rc) - CAM_ERR(CAM_LRME, "Error in LRME soc deinit, rc=%d", rc); - - mutex_destroy(&lrme_hw->hw_mutex); - kfree(lrme_hw); + if (lrme_hw) { + rc = cam_lrme_soc_deinit_resources(&lrme_hw->soc_info); + if (rc) + CAM_ERR(CAM_LRME, + "Error in LRME soc deinit, rc=%d", rc); + mutex_destroy(&lrme_hw->hw_mutex); + kfree(lrme_hw); + } return rc; } diff --git a/drivers/media/platform/msm/sde/rotator/sde_rotator_base.c b/drivers/media/platform/msm/sde/rotator/sde_rotator_base.c index 399c293f0ffc..af6338d6f9e0 100644 --- a/drivers/media/platform/msm/sde/rotator/sde_rotator_base.c +++ b/drivers/media/platform/msm/sde/rotator/sde_rotator_base.c @@ -147,7 +147,7 @@ void vbif_lock(struct platform_device *parent_pdev) if (!parent_pdev) return; -// mdp_vbif_lock(parent_pdev, true); + mdp_vbif_lock(parent_pdev, true); } void vbif_unlock(struct platform_device *parent_pdev) @@ -155,7 +155,7 @@ void vbif_unlock(struct platform_device *parent_pdev) if (!parent_pdev) return; -// mdp_vbif_lock(parent_pdev, false); + mdp_vbif_lock(parent_pdev, false); } void sde_mdp_halt_vbif_xin(struct sde_mdp_vbif_halt_params *params) diff --git a/drivers/misc/lkdtm_perms.c b/drivers/misc/lkdtm_perms.c index 62f76d506f04..e859d94fd903 100644 --- a/drivers/misc/lkdtm_perms.c +++ b/drivers/misc/lkdtm_perms.c @@ -109,7 +109,12 @@ void lkdtm_WRITE_KERN(void) size_t size; unsigned char *ptr; - size = (unsigned long)do_overwritten - (unsigned long)do_nothing; + if ((unsigned long)do_overwritten < (unsigned long)do_nothing) + size = (unsigned long)do_nothing - + (unsigned long)do_overwritten; + else + size = (unsigned long)do_overwritten - + (unsigned long)do_nothing; ptr = (unsigned char *)do_overwritten; pr_info("attempting bad %zu byte write at %px\n", size, ptr); diff --git a/drivers/mtd/devices/msm_qpic_nand.c b/drivers/mtd/devices/msm_qpic_nand.c index 6e84a4b2c54b..6d80804d3310 100644 --- a/drivers/mtd/devices/msm_qpic_nand.c +++ b/drivers/mtd/devices/msm_qpic_nand.c @@ -1056,8 +1056,9 @@ static int msm_nand_flash_onfi_probe(struct msm_nand_info *info) flash->blksize = onfi_param_page_ptr->number_of_pages_per_block * flash->pagesize; flash->oobsize = onfi_param_page_ptr->number_of_spare_bytes_per_page; - flash->density = onfi_param_page_ptr->number_of_blocks_per_logical_unit - * flash->blksize; + flash->density = onfi_param_page_ptr->number_of_logical_units * + onfi_param_page_ptr->number_of_blocks_per_logical_unit * + flash->blksize; flash->ecc_correctability = onfi_param_page_ptr->number_of_bits_ecc_correctability; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index b6c8996c99b5..3e5177bad9c7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -23,10 +23,6 @@ #include #include #include -#include -#include -#include -#include #include "stmmac.h" #include "stmmac_platform.h" #include "dwmac-qcom-ethqos.h" @@ -44,7 +40,6 @@ static int phy_digital_loopback_config( struct qcom_ethqos *ethqos, int speed, int config); bool phy_intr_en; -static char buf[2000]; static struct ethqos_emac_por emac_por[] = { { .offset = RGMII_IO_MACRO_CONFIG, .value = 0x0 }, @@ -73,7 +68,7 @@ int stmmac_enable_ipc_low; char tmp_buff[MAX_PROC_SIZE]; static struct qmp_pkt pkt; static char qmp_buf[MAX_QMP_MSG_SIZE + 1] = {0}; -static struct ip_params pparams = {"", "", "", ""}; +static struct ip_params pparams; static void qcom_ethqos_read_iomacro_por_values(struct qcom_ethqos *ethqos) { @@ -630,9 +625,10 @@ static int ethqos_dll_configure(struct qcom_ethqos *ethqos) rgmii_updatel(ethqos, SDCC_DLL_CONFIG_CK_OUT_EN, 0, SDCC_HC_REG_DLL_CONFIG); - /* Set DLL_EN */ - rgmii_updatel(ethqos, SDCC_DLL_CONFIG_DLL_EN, - SDCC_DLL_CONFIG_DLL_EN, SDCC_HC_REG_DLL_CONFIG); + if (!ethqos->io_macro.rx_dll_bypass) + /* Set DLL_EN */ + rgmii_updatel(ethqos, SDCC_DLL_CONFIG_DLL_EN, + SDCC_DLL_CONFIG_DLL_EN, SDCC_HC_REG_DLL_CONFIG); if (ethqos->emac_ver != EMAC_HW_v2_3_2 && ethqos->emac_ver != EMAC_HW_v2_1_2) { @@ -677,8 +673,9 @@ static int ethqos_dll_configure(struct qcom_ethqos *ethqos) if (ethqos->emac_ver != EMAC_HW_v2_3_2 && ethqos->emac_ver != EMAC_HW_v2_1_2) { - rgmii_updatel(ethqos, SDCC_DLL_CONFIG2_DLL_CLOCK_DIS, - 0, SDCC_HC_REG_DLL_CONFIG2); + if (!ethqos->io_macro.rx_dll_bypass) + rgmii_updatel(ethqos, SDCC_DLL_CONFIG2_DLL_CLOCK_DIS, + 0, SDCC_HC_REG_DLL_CONFIG2); rgmii_updatel(ethqos, SDCC_DLL_CONFIG2_MCLK_FREQ_CALC, 0x1A << 10, SDCC_HC_REG_DLL_CONFIG2); @@ -728,15 +725,19 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos) RGMII_IO_MACRO_CONFIG2); /* Set PRG_RCLK_DLY to 57 for 1.8 ns delay */ - if (ethqos->emac_ver == EMAC_HW_v2_3_2) + if (ethqos->emac_ver == EMAC_HW_v2_3_2) { rgmii_updatel(ethqos, SDCC_DDR_CONFIG_PRG_RCLK_DLY, 69, SDCC_HC_REG_DDR_CONFIG); - else if (ethqos->emac_ver == EMAC_HW_v2_1_2) + } else if (ethqos->emac_ver == EMAC_HW_v2_1_2) { rgmii_updatel(ethqos, SDCC_DDR_CONFIG_PRG_RCLK_DLY, 52, SDCC_HC_REG_DDR_CONFIG); - else - rgmii_updatel(ethqos, SDCC_DDR_CONFIG_PRG_RCLK_DLY, - 57, SDCC_HC_REG_DDR_CONFIG); + } else { + if (!ethqos->io_macro.rx_dll_bypass) + rgmii_updatel(ethqos, + SDCC_DDR_CONFIG_PRG_RCLK_DLY, + 57, SDCC_HC_REG_DDR_CONFIG); + } + rgmii_updatel(ethqos, SDCC_DDR_CONFIG_PRG_DLY_EN, SDCC_DDR_CONFIG_PRG_DLY_EN, SDCC_HC_REG_DDR_CONFIG); @@ -770,8 +771,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos) BIT(6), RGMII_IO_MACRO_CONFIG); rgmii_updatel(ethqos, RGMII_CONFIG2_RSVD_CONFIG15, 0, RGMII_IO_MACRO_CONFIG2); - if (ethqos->emac_ver == EMAC_HW_v2_3_2 || - ethqos->emac_ver == EMAC_HW_v2_1_2) + if (ethqos->io_macro.rx_prog_swap) rgmii_updatel(ethqos, RGMII_CONFIG2_RX_PROG_SWAP, RGMII_CONFIG2_RX_PROG_SWAP, RGMII_IO_MACRO_CONFIG2); @@ -825,8 +825,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos) RGMII_IO_MACRO_CONFIG); rgmii_updatel(ethqos, RGMII_CONFIG2_RSVD_CONFIG15, 0, RGMII_IO_MACRO_CONFIG2); - if (ethqos->emac_ver == EMAC_HW_v2_3_2 || - ethqos->emac_ver == EMAC_HW_v2_1_2) + if (ethqos->io_macro.rx_prog_swap) rgmii_updatel(ethqos, RGMII_CONFIG2_RX_PROG_SWAP, RGMII_CONFIG2_RX_PROG_SWAP, RGMII_IO_MACRO_CONFIG2); @@ -890,33 +889,56 @@ static int ethqos_configure(struct qcom_ethqos *ethqos) SDCC_HC_REG_DLL_CONFIG); if (ethqos->speed != SPEED_100 && ethqos->speed != SPEED_10) { - /* Set DLL_EN */ - rgmii_updatel(ethqos, SDCC_DLL_CONFIG_DLL_EN, - SDCC_DLL_CONFIG_DLL_EN, SDCC_HC_REG_DLL_CONFIG); + if (ethqos->io_macro.rx_dll_bypass) { + /* Set DLL_CLOCK_DISABLE */ + rgmii_updatel(ethqos, + SDCC_DLL_CONFIG2_DLL_CLOCK_DIS, + SDCC_DLL_CONFIG2_DLL_CLOCK_DIS, + SDCC_HC_REG_DLL_CONFIG2); - /* Set CK_OUT_EN */ - rgmii_updatel(ethqos, SDCC_DLL_CONFIG_CK_OUT_EN, - SDCC_DLL_CONFIG_CK_OUT_EN, - SDCC_HC_REG_DLL_CONFIG); + /* Clear DLL_EN */ + rgmii_updatel(ethqos, SDCC_DLL_CONFIG_DLL_EN, + 0, SDCC_HC_REG_DLL_CONFIG); - /* Set USR_CTL bit 26 with mask of 3 bits */ - rgmii_updatel(ethqos, GENMASK(26, 24), BIT(26), SDCC_USR_CTL); + /* Set PDN */ + rgmii_updatel(ethqos, + SDCC_DLL_CONFIG_PDN, + SDCC_DLL_CONFIG_PDN, + SDCC_HC_REG_DLL_CONFIG); - /* wait for DLL LOCK */ - do { - mdelay(1); - dll_lock = rgmii_readl(ethqos, SDC4_STATUS); - if (dll_lock & SDC4_STATUS_DLL_LOCK) - break; - retry--; - } while (retry > 0); - if (!retry) - dev_err(ðqos->pdev->dev, - "Timeout while waiting for DLL lock\n"); - } + /* Set USR_CTL bit 30 */ + rgmii_updatel(ethqos, BIT(30), BIT(30), SDCC_USR_CTL); + } else { + /* Set DLL_EN */ + rgmii_updatel(ethqos, + SDCC_DLL_CONFIG_DLL_EN, + SDCC_DLL_CONFIG_DLL_EN, + SDCC_HC_REG_DLL_CONFIG); + + /* Set CK_OUT_EN */ + rgmii_updatel(ethqos, SDCC_DLL_CONFIG_CK_OUT_EN, + SDCC_DLL_CONFIG_CK_OUT_EN, + SDCC_HC_REG_DLL_CONFIG); + + /* Set USR_CTL bit 26 with mask of 3 bits */ + rgmii_updatel(ethqos, GENMASK(26, 24), BIT(26), + SDCC_USR_CTL); + + /* wait for DLL LOCK */ + do { + mdelay(1); + dll_lock = rgmii_readl(ethqos, SDC4_STATUS); + if (dll_lock & SDC4_STATUS_DLL_LOCK) + break; + retry--; + } while (retry > 0); + if (!retry) + dev_err(ðqos->pdev->dev, + "Timeout while waiting for DLL lock\n"); + } - if (ethqos->speed == SPEED_1000) ethqos_dll_configure(ethqos); + } ethqos_rgmii_macro_init(ethqos); @@ -970,44 +992,6 @@ static int ethqos_mdio_read(struct stmmac_priv *priv, int phyaddr, int phyreg) return data; } -static int ethqos_mdio_write(struct stmmac_priv *priv, int phyaddr, int phyreg, - u16 phydata) -{ - unsigned int mii_address = priv->hw->mii.addr; - unsigned int mii_data = priv->hw->mii.data; - u32 v; - u32 value = MII_BUSY; - struct qcom_ethqos *ethqos = priv->plat->bsp_priv; - - if (ethqos->phy_state == PHY_IS_OFF) { - ETHQOSINFO("Phy is in off state writing is not possible\n"); - return -EOPNOTSUPP; - } - value |= (phyaddr << priv->hw->mii.addr_shift) - & priv->hw->mii.addr_mask; - value |= (phyreg << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask; - - value |= (priv->clk_csr << priv->hw->mii.clk_csr_shift) - & priv->hw->mii.clk_csr_mask; - if (priv->plat->has_gmac4) - value |= MII_GMAC4_WRITE; - else - value |= MII_WRITE; - - /* Wait until any existing MII operation is complete */ - if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY), - 100, 10000)) - return -EBUSY; - - /* Set the MII address register to write */ - writel_relaxed(phydata, priv->ioaddr + mii_data); - writel_relaxed(value, priv->ioaddr + mii_address); - - /* Wait until any existing MII operation is complete */ - return readl_poll_timeout(priv->ioaddr + mii_address, v, - !(v & MII_BUSY), 100, 10000); -} - static int ethqos_phy_intr_config(struct qcom_ethqos *ethqos) { int ret = 0; @@ -1269,8 +1253,18 @@ static ssize_t read_phy_off(struct file *file, size_t count, loff_t *ppos) { unsigned int len = 0, buf_len = 2000; + char *buf; + ssize_t ret_cnt; struct qcom_ethqos *ethqos = file->private_data; + if (!ethqos) { + ETHQOSERR("NULL Pointer\n"); + return -EINVAL; + } + buf = kzalloc(buf_len, GFP_KERNEL); + if (!buf) + return -ENOMEM; + if (ethqos->current_phy_mode == DISABLE_PHY_IMMEDIATELY) len += scnprintf(buf + len, buf_len - len, "Disable phy immediately enabled\n"); @@ -1295,10 +1289,14 @@ static ssize_t read_phy_off(struct file *file, len += scnprintf(buf + len, buf_len - len, "Invalid Phy State\n"); - if (len > buf_len) + if (len > buf_len) { + ETHQOSERR("(len > buf_len) buffer not sufficient\n"); len = buf_len; + } - return simple_read_from_buffer(user_buf, count, ppos, buf, len); + ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len); + kfree(buf); + return ret_cnt; } static ssize_t phy_off_config( @@ -1436,9 +1434,12 @@ static int phy_digital_loopback_config( return -EINVAL; } if (phydata != 0) { - ethqos_mdio_write( - priv, priv->plat->phy_addr, MII_BMCR, phydata); - ETHQOSINFO("write done for phy loopback\n"); + if (priv->phydev) { + phy_write(priv->phydev, MII_BMCR, phydata); + ETHQOSINFO("write done for phy loopback\n"); + } else { + ETHQOSINFO("Phy dev is NULL\n"); + } } return 0; } @@ -1694,6 +1695,16 @@ static ssize_t read_loopback_config(struct file *file, { unsigned int len = 0, buf_len = 2000; struct qcom_ethqos *ethqos = file->private_data; + char *buf; + ssize_t ret_cnt; + + if (!ethqos) { + ETHQOSERR("NULL Pointer\n"); + return -EINVAL; + } + buf = kzalloc(buf_len, GFP_KERNEL); + if (!buf) + return -ENOMEM; if (ethqos->current_loopback == DISABLE_LOOPBACK) len += scnprintf(buf + len, buf_len - len, @@ -1713,7 +1724,9 @@ static ssize_t read_loopback_config(struct file *file, if (len > buf_len) len = buf_len; - return simple_read_from_buffer(user_buf, count, ppos, buf, len); + ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len); + kfree(buf); + return ret_cnt; } static const struct file_operations fops_phy_reg_dump = { @@ -2111,8 +2124,13 @@ inline bool qcom_ethqos_is_phy_link_up(struct qcom_ethqos *ethqos) */ struct stmmac_priv *priv = qcom_ethqos_get_priv(ethqos); - return ((priv->oldlink != -1) && - (priv->dev->phydev && priv->dev->phydev->link)); + if (priv->plat->mac2mac_en) { + return true; + } else { + return ((priv->oldlink != -1) && + (priv->dev->phydev && + priv->dev->phydev->link)); + } } static void qcom_ethqos_phy_resume_clks(struct qcom_ethqos *ethqos) @@ -2283,8 +2301,9 @@ static void ethqos_is_ipv6_NW_stack_ready(struct work_struct *work) flush_delayed_work(ðqos->ipv6_addr_assign_wq); } -static int ethqos_set_early_eth_param(struct stmmac_priv *priv, - struct qcom_ethqos *ethqos) +static void ethqos_set_early_eth_param( + struct stmmac_priv *priv, + struct qcom_ethqos *ethqos) { int ret = 0; @@ -2311,12 +2330,7 @@ static int ethqos_set_early_eth_param(struct stmmac_priv *priv, schedule_delayed_work(ðqos->ipv6_addr_assign_wq, msecs_to_jiffies(1000)); } - - if (pparams.is_valid_mac_addr) { - ether_addr_copy(dev_addr, pparams.mac_addr); - memcpy(priv->dev->dev_addr, dev_addr, ETH_ALEN); - } - return ret; + return; } bool qcom_ethqos_ipa_enabled(void) @@ -2330,6 +2344,7 @@ bool qcom_ethqos_ipa_enabled(void) static int qcom_ethqos_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; + struct device_node *io_macro_node = NULL; struct plat_stmmacenet_data *plat_dat; struct stmmac_resources stmmac_res; struct qcom_ethqos *ethqos; @@ -2429,6 +2444,14 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->tso_en = of_property_read_bool(np, "snps,tso"); plat_dat->early_eth = ethqos->early_eth_enabled; + /* Get rgmii interface speed for mac2c from device tree */ + if (of_property_read_u32(np, "mac2mac-rgmii-speed", + &plat_dat->mac2mac_rgmii_speed)) + plat_dat->mac2mac_rgmii_speed = -1; + else + ETHQOSINFO("mac2mac rgmii speed = %d\n", + plat_dat->mac2mac_rgmii_speed); + if (of_property_read_bool(pdev->dev.of_node, "qcom,arm-smmu")) { stmmac_emb_smmu_ctx.pdev_master = pdev; ret = of_platform_populate(pdev->dev.of_node, @@ -2475,6 +2498,24 @@ static int qcom_ethqos_probe(struct platform_device *pdev) ETHQOSINFO("emac-phy-off-suspend = %d\n", ethqos->current_phy_mode); + io_macro_node = of_find_node_by_name(pdev->dev.of_node, + "io-macro-info"); + + if (ethqos->emac_ver == EMAC_HW_v2_3_2 || + ethqos->emac_ver == EMAC_HW_v2_1_2) { + ethqos->io_macro.rx_prog_swap = 1; + } else if (!io_macro_node) { + ethqos->io_macro.rx_prog_swap = 0; + } else { + if (of_property_read_bool(io_macro_node, "rx-prog-swap")) + ethqos->io_macro.rx_prog_swap = 1; + } + + if (io_macro_node) { + if (of_property_read_bool(io_macro_node, "rx-dll-bypass")) + ethqos->io_macro.rx_dll_bypass = 1; + } + ethqos->ioaddr = (&stmmac_res)->addr; ethqos_update_rgmii_tx_drv_strength(ethqos); @@ -2511,6 +2552,11 @@ static int qcom_ethqos_probe(struct platform_device *pdev) ndev = dev_get_drvdata(ðqos->pdev->dev); priv = netdev_priv(ndev); + if (pparams.is_valid_mac_addr) { + ether_addr_copy(dev_addr, pparams.mac_addr); + memcpy(priv->dev->dev_addr, dev_addr, ETH_ALEN); + } + if (ethqos->early_eth_enabled) { /* Initialize work*/ INIT_WORK(ðqos->early_eth, @@ -2662,9 +2708,10 @@ static int qcom_ethqos_resume(struct device *dev) ethqos_reset_phy_enable_interrupt(ethqos); if (ethqos->backup_autoneg == AUTONEG_DISABLE) { priv->phydev->autoneg = ethqos->backup_autoneg; - ethqos_mdio_write( - priv, priv->plat->phy_addr, - MII_BMCR, ethqos->backup_bmcr); + if (priv->phydev) + phy_write(priv->phydev, MII_BMCR, ethqos->backup_bmcr); + } else { + ETHQOSINFO("Phy dev is NULL\n"); } } diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.h b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.h index e275873aa250..4c6c8f5143f3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.h @@ -408,6 +408,11 @@ struct ethqos_emac_driver_data { unsigned int num_por; }; +struct ethqos_io_macro { + bool rx_prog_swap; + bool rx_dll_bypass; +}; + struct qcom_ethqos { struct platform_device *pdev; void __iomem *rgmii_base; @@ -495,6 +500,9 @@ struct qcom_ethqos { int backup_suspend_speed; u32 backup_bmcr; unsigned backup_autoneg:1; + + /* IO Macro parameters */ + struct ethqos_io_macro io_macro; }; struct pps_cfg { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 52cdaa9c0c02..a3a66fcbc1a2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -35,7 +35,6 @@ #include "dwmac-qcom-ipa-offload.h" #include #include -#include #include struct stmmac_resources { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 9057ef572cf6..089572fafbed 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -286,6 +286,12 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev, struct stmmac_priv *priv = netdev_priv(dev); struct phy_device *phy = dev->phydev; + if (!phy) { + pr_err("%s: %s: PHY is not registered\n", + __func__, dev->name); + return -ENODEV; + } + if (priv->hw->pcs & STMMAC_PCS_RGMII || priv->hw->pcs & STMMAC_PCS_SGMII) { struct rgmii_adv adv; @@ -365,11 +371,6 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev, return 0; } - if (phy == NULL) { - pr_err("%s: %s: PHY is not registered\n", - __func__, dev->name); - return -ENODEV; - } if (!netif_running(dev)) { pr_err("%s: interface is disabled: we cannot track " "link speed / duplex setting\n", dev->name); @@ -388,6 +389,12 @@ stmmac_ethtool_set_link_ksettings(struct net_device *dev, int rc; u32 cmd_speed = cmd->base.speed; + if (!phy) { + pr_err("%s: %s: PHY is not registered\n", + __func__, dev->name); + return -ENODEV; + } + if (priv->hw->pcs & STMMAC_PCS_RGMII || priv->hw->pcs & STMMAC_PCS_SGMII) { u32 mask = ADVERTISED_Autoneg | ADVERTISED_Pause; @@ -505,6 +512,12 @@ stmmac_set_pauseparam(struct net_device *netdev, struct phy_device *phy = netdev->phydev; int new_pause = FLOW_OFF; + if (!phy) { + pr_err("%s: %s: PHY is not registered\n", + __func__, netdev->name); + return -ENODEV; + } + if (priv->hw->pcs && priv->hw->mac->pcs_get_adv_lp) { struct rgmii_adv adv_lp; @@ -634,6 +647,12 @@ static void stmmac_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) { struct stmmac_priv *priv = netdev_priv(dev); + if (!priv->phydev) { + pr_err("%s: %s: PHY is not registered\n", + __func__, dev->name); + return; + } + phy_ethtool_get_wol(priv->phydev, wol); mutex_lock(&priv->lock); if (device_can_wakeup(priv->device)) { @@ -650,6 +669,12 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) u32 emac_wol_support = 0; int ret; + if (!priv->phydev) { + pr_err("%s: %s: PHY is not registered\n", + __func__, dev->name); + return -ENODEV; + } + if (ethqos->phy_state == PHY_IS_OFF) { ETHQOSINFO("Phy is in off state Wol set not possible\n"); return -EOPNOTSUPP; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 85a4214f8e9c..0e64ed654670 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -295,8 +295,14 @@ static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv, u32 queue) */ static inline void stmmac_hw_fix_mac_speed(struct stmmac_priv *priv) { - if (likely(priv->plat->fix_mac_speed)) - priv->plat->fix_mac_speed(priv->plat->bsp_priv, priv->speed); + if (likely(priv->plat->fix_mac_speed)) { + if (priv->phydev->link) + priv->plat->fix_mac_speed(priv->plat->bsp_priv, + priv->speed); + else + priv->plat->fix_mac_speed(priv->plat->bsp_priv, + SPEED_10); + } } /** @@ -854,6 +860,7 @@ static void stmmac_adjust_link(struct net_device *dev) priv->oldlink = true; } } else if (priv->oldlink) { + stmmac_hw_fix_mac_speed(priv); new_state = true; priv->oldlink = false; priv->speed = SPEED_UNKNOWN; @@ -2734,9 +2741,10 @@ static int stmmac_open(struct net_device *dev) struct stmmac_priv *priv = netdev_priv(dev); int ret; - if (priv->hw->pcs != STMMAC_PCS_RGMII && - priv->hw->pcs != STMMAC_PCS_TBI && - priv->hw->pcs != STMMAC_PCS_RTBI) { + if (!priv->plat->mac2mac_en && + (priv->hw->pcs != STMMAC_PCS_RGMII && + priv->hw->pcs != STMMAC_PCS_TBI && + priv->hw->pcs != STMMAC_PCS_RTBI)) { ret = stmmac_init_phy(dev); if (ret) { netdev_err(priv->dev, @@ -2824,6 +2832,26 @@ static int stmmac_open(struct net_device *dev) if (priv->tx_queue[IPA_DMA_TX_CH].skip_sw) ethqos_ipa_offload_event_handler(priv, EV_DEV_OPEN); + if (priv->plat->mac2mac_en) { + u32 ctrl = readl_relaxed(priv->ioaddr + MAC_CTRL_REG); + + ctrl &= ~priv->hw->link.speed_mask; + + if (priv->plat->mac2mac_rgmii_speed == SPEED_1000) { + ctrl |= priv->hw->link.speed1000; + priv->speed = SPEED_1000; + } else if (priv->plat->mac2mac_rgmii_speed == SPEED_100) { + ctrl |= priv->hw->link.speed100; + priv->speed = SPEED_100; + } else { + ctrl |= priv->hw->link.speed10; + priv->speed = SPEED_10; + } + + stmmac_hw_fix_mac_speed(priv); + writel_relaxed(ctrl, priv->ioaddr + MAC_CTRL_REG); + } + return 0; lpiirq_error: @@ -4048,6 +4076,7 @@ static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) break; case SIOCSHWTSTAMP: ret = stmmac_hwtstamp_ioctl(dev, rq); + break; case SIOCDEVPRIVATE: ret = ethqos_handle_prv_ioctl(dev, rq, cmd); break; @@ -4580,9 +4609,10 @@ int stmmac_dvr_probe(struct device *device, stmmac_check_pcs_mode(priv); - if (priv->hw->pcs != STMMAC_PCS_RGMII && - priv->hw->pcs != STMMAC_PCS_TBI && - priv->hw->pcs != STMMAC_PCS_RTBI) { + if (!priv->plat->mac2mac_en && + (priv->hw->pcs != STMMAC_PCS_RGMII && + priv->hw->pcs != STMMAC_PCS_TBI && + priv->hw->pcs != STMMAC_PCS_RTBI)) { /* MDIO bus Registration */ ret = stmmac_mdio_register(ndev); if (ret < 0) { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 54893d12a22d..dbbf2857831d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -400,6 +400,9 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) /* Default to phy auto-detection */ plat->phy_addr = -1; + /* Flag for mac2mac feature support*/ + plat->mac2mac_en = of_property_read_bool(np, "mac2mac"); + /* "snps,phy-addr" is not a standard property. Mark it as deprecated * and warn of its use. Remove this when phy node support is added. */ @@ -407,8 +410,10 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); /* To Configure PHY by using all device-tree supported properties */ - if (stmmac_dt_phy(plat, np, &pdev->dev)) - return ERR_PTR(-ENODEV); + if (!plat->mac2mac_en) { + if (stmmac_dt_phy(plat, np, &pdev->dev)) + return ERR_PTR(-ENODEV); + } of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); diff --git a/drivers/pci/host/pci-msm.c b/drivers/pci/host/pci-msm.c index 2a6cbe368546..9ed570463cc7 100644 --- a/drivers/pci/host/pci-msm.c +++ b/drivers/pci/host/pci-msm.c @@ -3699,7 +3699,7 @@ static int msm_pcie_get_resources(struct msm_pcie_dev_t *dev, of_property_read_u32_array(pdev->dev.of_node, "qcom,bw-scale", (u32 *)dev->bw_scale, size / sizeof(u32)); - dev->bw_gen_max = size / sizeof(u32); + dev->bw_gen_max = size / sizeof(*dev->bw_scale); } else { PCIE_DBG(dev, "RC%d: bandwidth scaling is not supported\n", dev->rc_idx); @@ -6426,6 +6426,15 @@ int msm_pcie_set_link_bandwidth(struct pci_dev *pci_dev, u16 target_link_speed, pcie_dev = PCIE_BUS_PRIV_DATA(root_pci_dev->bus); + if (target_link_speed > pcie_dev->bw_gen_max || + (pcie_dev->target_link_speed && + target_link_speed > pcie_dev->target_link_speed)) { + PCIE_DBG(pcie_dev, + "PCIe: RC%d: invalid target link speed: %d\n", + pcie_dev->rc_idx, target_link_speed); + return -EINVAL; + } + pcie_capability_read_word(root_pci_dev, PCI_EXP_LNKSTA, &link_status); current_link_speed = link_status & PCI_EXP_LNKSTA_CLS; @@ -6713,7 +6722,7 @@ static int __init pcie_init(void) msm_pcie_dev[i].ipc_log = ipc_log_context_create(PCIE_LOG_PAGES, rc_name, 0); if (msm_pcie_dev[i].ipc_log == NULL) - pr_dbg("%s: unable to create IPC log context for %s\n", + pr_debug("%s: unable to create IPC log context for %s\n", __func__, rc_name); else PCIE_DBG(&msm_pcie_dev[i], @@ -6723,7 +6732,7 @@ static int __init pcie_init(void) msm_pcie_dev[i].ipc_log_long = ipc_log_context_create(PCIE_LOG_PAGES, rc_name, 0); if (msm_pcie_dev[i].ipc_log_long == NULL) - pr_dbg("%s: unable to create IPC log context for %s\n", + pr_debug("%s: unable to create IPC log context for %s\n", __func__, rc_name); else PCIE_DBG(&msm_pcie_dev[i], @@ -6733,7 +6742,7 @@ static int __init pcie_init(void) msm_pcie_dev[i].ipc_log_dump = ipc_log_context_create(PCIE_LOG_PAGES, rc_name, 0); if (msm_pcie_dev[i].ipc_log_dump == NULL) - pr_dbg("%s: unable to create IPC log context for %s\n", + pr_debug("%s: unable to create IPC log context for %s\n", __func__, rc_name); else PCIE_DBG(&msm_pcie_dev[i], diff --git a/drivers/platform/msm/ipa/ipa_api.c b/drivers/platform/msm/ipa/ipa_api.c index da78af4b31ee..7ad1b65d3308 100644 --- a/drivers/platform/msm/ipa/ipa_api.c +++ b/drivers/platform/msm/ipa/ipa_api.c @@ -224,6 +224,8 @@ const char *ipa_clients_strings[IPA_CLIENT_MAX] = { __stringify(IPA_CLIENT_MHI_LOW_LAT_CONS), __stringify(IPA_CLIENT_QDSS_PROD), __stringify(IPA_CLIENT_MHI_QDSS_CONS), + __stringify(IPA_CLIENT_ETHERNET2_PROD), + __stringify(IPA_CLIENT_ETHERNET2_CONS), }; /** diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index 72386cb1f5d8..df239c2dd660 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -862,6 +862,74 @@ static void ipa3_get_pcie_ep_info( } } +static void ipa3_get_eth_ep_info( + struct ipa_ioc_get_ep_info *ep_info, + struct ipa_ep_pair_info *pair_info + ) +{ + int ep_index = -1, i; + + ep_info->num_ep_pairs = 0; + for (i = 0; i < ep_info->max_ep_pairs; i++) { + pair_info[i].consumer_pipe_num = -1; + pair_info[i].producer_pipe_num = -1; + pair_info[i].ep_id = -1; + } + + ep_index = ipa3_get_ep_mapping(IPA_CLIENT_ETHERNET2_PROD); + + if ((ep_index != -1) && ipa3_ctx->ep[ep_index].valid) { + pair_info[ep_info->num_ep_pairs].consumer_pipe_num = ep_index; + ep_index = ipa3_get_ep_mapping(IPA_CLIENT_ETHERNET2_CONS); + if ((ep_index != -1) && (ipa3_ctx->ep[ep_index].valid)) { + pair_info[ep_info->num_ep_pairs].producer_pipe_num = + ep_index; + pair_info[ep_info->num_ep_pairs].ep_id = + IPA_ETH1_EP_ID; + + IPADBG("ep_pair_info consumer_pipe_num %d", + pair_info[ep_info->num_ep_pairs].consumer_pipe_num); + IPADBG(" producer_pipe_num %d ep_id %d\n", + pair_info[ep_info->num_ep_pairs].producer_pipe_num, + pair_info[ep_info->num_ep_pairs].ep_id); + ep_info->num_ep_pairs++; + } else { + pair_info[ep_info->num_ep_pairs].consumer_pipe_num = -1; + IPADBG("ep_pair_info consumer_pipe_num %d", + pair_info[ep_info->num_ep_pairs].consumer_pipe_num); + IPADBG(" producer_pipe_num %d ep_id %d\n", + pair_info[ep_info->num_ep_pairs].producer_pipe_num, + pair_info[ep_info->num_ep_pairs].ep_id); + } + } + + ep_index = ipa3_get_ep_mapping(IPA_CLIENT_ETHERNET_PROD); + + if ((ep_index != -1) && ipa3_ctx->ep[ep_index].valid) { + pair_info[ep_info->num_ep_pairs].consumer_pipe_num = ep_index; + ep_index = ipa3_get_ep_mapping(IPA_CLIENT_ETHERNET_CONS); + if ((ep_index != -1) && (ipa3_ctx->ep[ep_index].valid)) { + pair_info[ep_info->num_ep_pairs].producer_pipe_num = + ep_index; + pair_info[ep_info->num_ep_pairs].ep_id = + IPA_ETH0_EP_ID; + + IPADBG("ep_pair_info consumer_pipe_num %d", + pair_info[ep_info->num_ep_pairs].consumer_pipe_num); + IPADBG(" producer_pipe_num %d ep_id %d\n", + pair_info[ep_info->num_ep_pairs].producer_pipe_num, + pair_info[ep_info->num_ep_pairs].ep_id); + ep_info->num_ep_pairs++; + } else { + pair_info[ep_info->num_ep_pairs].consumer_pipe_num = -1; + IPADBG("ep_pair_info consumer_pipe_num %d", + pair_info[ep_info->num_ep_pairs].consumer_pipe_num); + IPADBG(" producer_pipe_num %d ep_id %d\n", + pair_info[ep_info->num_ep_pairs].producer_pipe_num, + pair_info[ep_info->num_ep_pairs].ep_id); + } + } +} static int ipa3_get_ep_info(struct ipa_ioc_get_ep_info *ep_info, u8 *param) @@ -878,6 +946,10 @@ static int ipa3_get_ep_info(struct ipa_ioc_get_ep_info *ep_info, ipa3_get_pcie_ep_info(ep_info, pair_info); break; + case IPA_DATA_EP_TYP_ETH: + ipa3_get_eth_ep_info(ep_info, pair_info); + break; + default: IPAERR_RL("Undefined ep_type %d\n", ep_info->ep_type); ret = -EFAULT; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_uc_ntn.c b/drivers/platform/msm/ipa/ipa_v3/ipa_uc_ntn.c index e3be643c3d0c..601ee86cea12 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_uc_ntn.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_uc_ntn.c @@ -606,7 +606,7 @@ int ipa3_tear_down_uc_offload_pipes(int ipa_ep_idx_ul, } /* unmap the DL pipe */ - result = ipa3_smmu_map_uc_ntn_pipes(¶ms->dl, false, true); + result = ipa3_smmu_map_uc_ntn_pipes(¶ms->dl, false, false); if (result) { IPAERR("failed to unmap SMMU for DL %d\n", result); goto fail; @@ -627,7 +627,7 @@ int ipa3_tear_down_uc_offload_pipes(int ipa_ep_idx_ul, } /* unmap the UL pipe */ - result = ipa3_smmu_map_uc_ntn_pipes(¶ms->ul, false, false); + result = ipa3_smmu_map_uc_ntn_pipes(¶ms->ul, false, true); if (result) { IPAERR("failed to unmap SMMU for UL %d\n", result); goto fail; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c index 529c9e3ac1a6..a887a93b56c6 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c @@ -2788,6 +2788,12 @@ static const struct ipa_ep_configuration ipa3_ep_mapping IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP, QMB_MASTER_SELECT_DDR, { 12, 0, 8, 16, IPA_EE_UC, GSI_SMART_PRE_FETCH, 3 } }, + [IPA_4_5_AUTO][IPA_CLIENT_ETHERNET2_PROD] = { + true, IPA_v4_5_GROUP_CV2X, + true, + IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP, + QMB_MASTER_SELECT_DDR, + { 10, 13, 8, 16, IPA_EE_UC, GSI_SMART_PRE_FETCH, 3 } }, [IPA_4_5_AUTO][IPA_CLIENT_Q6_WAN_PROD] = { true, IPA_v4_5_GROUP_UL_DL, true, @@ -2905,6 +2911,12 @@ static const struct ipa_ep_configuration ipa3_ep_mapping IPA_DPS_HPS_SEQ_TYPE_INVALID, QMB_MASTER_SELECT_DDR, { 28, 1, 9, 9, IPA_EE_UC, GSI_SMART_PRE_FETCH, 4 } }, + [IPA_4_5_AUTO][IPA_CLIENT_ETHERNET2_CONS] = { + true, IPA_v4_5_GROUP_CV2X, + false, + IPA_DPS_HPS_SEQ_TYPE_INVALID, + QMB_MASTER_SELECT_DDR, + { 25, 16, 9, 9, IPA_EE_UC, GSI_SMART_PRE_FETCH, 4 } }, [IPA_4_5_AUTO][IPA_CLIENT_Q6_LAN_CONS] = { true, IPA_v4_5_GROUP_UL_DL, false, @@ -3567,18 +3579,19 @@ bool ipa3_should_pipe_be_suspended(enum ipa_client_type client) if (client == IPA_CLIENT_USB_CONS || client == IPA_CLIENT_USB2_CONS || - client == IPA_CLIENT_USB_DPL_CONS || - client == IPA_CLIENT_MHI_QDSS_CONS || - client == IPA_CLIENT_MHI_CONS || - client == IPA_CLIENT_MHI_DPL_CONS || - client == IPA_CLIENT_HSIC1_CONS || - client == IPA_CLIENT_WLAN1_CONS || - client == IPA_CLIENT_WLAN2_CONS || - client == IPA_CLIENT_WLAN3_CONS || - client == IPA_CLIENT_WLAN4_CONS || - client == IPA_CLIENT_ODU_EMB_CONS || - client == IPA_CLIENT_ODU_TETH_CONS || - client == IPA_CLIENT_ETHERNET_CONS) + client == IPA_CLIENT_USB_DPL_CONS || + client == IPA_CLIENT_MHI_QDSS_CONS || + client == IPA_CLIENT_MHI_CONS || + client == IPA_CLIENT_MHI_DPL_CONS || + client == IPA_CLIENT_HSIC1_CONS || + client == IPA_CLIENT_WLAN1_CONS || + client == IPA_CLIENT_WLAN2_CONS || + client == IPA_CLIENT_WLAN3_CONS || + client == IPA_CLIENT_WLAN4_CONS || + client == IPA_CLIENT_ODU_EMB_CONS || + client == IPA_CLIENT_ODU_TETH_CONS || + client == IPA_CLIENT_ETHERNET_CONS || + client == IPA_CLIENT_ETHERNET2_CONS) return true; return false; @@ -5737,6 +5750,7 @@ int ipa3_write_qmap_id(struct ipa_ioc_write_qmapid *param_in) param_in->client == IPA_CLIENT_HSIC1_PROD || param_in->client == IPA_CLIENT_ODU_PROD || param_in->client == IPA_CLIENT_ETHERNET_PROD || + param_in->client == IPA_CLIENT_ETHERNET2_PROD || param_in->client == IPA_CLIENT_WIGIG_PROD || param_in->client == IPA_CLIENT_AQC_ETHERNET_PROD) { result = ipa3_cfg_ep_metadata(ipa_ep_idx, &meta); @@ -9029,6 +9043,8 @@ int ipa3_get_prot_id(enum ipa_client_type client) case IPA_CLIENT_USB_CONS: prot_id = IPA_HW_PROTOCOL_USB; break; + case IPA_CLIENT_ETHERNET2_PROD: + case IPA_CLIENT_ETHERNET2_CONS: case IPA_CLIENT_ETHERNET_PROD: case IPA_CLIENT_ETHERNET_CONS: prot_id = IPA_HW_PROTOCOL_ETH; diff --git a/drivers/power/supply/qcom/qpnp-fg-gen3.c b/drivers/power/supply/qcom/qpnp-fg-gen3.c index 8c4a2ace9f56..7134225ffbd5 100644 --- a/drivers/power/supply/qcom/qpnp-fg-gen3.c +++ b/drivers/power/supply/qcom/qpnp-fg-gen3.c @@ -3663,6 +3663,9 @@ static int fg_psy_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG: rc = fg_get_time_to_full(fg, &pval->intval); break; + case POWER_SUPPLY_PROP_TIME_TO_FULL_NOW: + rc = fg_get_time_to_full(fg, &pval->intval); + break; case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG: rc = fg_get_time_to_empty(fg, &pval->intval); break; @@ -3888,6 +3891,7 @@ static enum power_supply_property fg_psy_props[] = { POWER_SUPPLY_PROP_CHARGE_COUNTER_SHADOW, POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, + POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, POWER_SUPPLY_PROP_SOC_REPORTING_READY, POWER_SUPPLY_PROP_DEBUG_BATTERY, POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, diff --git a/drivers/power/supply/qcom/qpnp-fg-gen4.c b/drivers/power/supply/qcom/qpnp-fg-gen4.c index 11265be4dc03..fbcc2b5ff7a5 100644 --- a/drivers/power/supply/qcom/qpnp-fg-gen4.c +++ b/drivers/power/supply/qcom/qpnp-fg-gen4.c @@ -4528,6 +4528,9 @@ static int fg_psy_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG: rc = ttf_get_time_to_full(chip->ttf, &pval->intval); break; + case POWER_SUPPLY_PROP_TIME_TO_FULL_NOW: + rc = ttf_get_time_to_full(chip->ttf, &pval->intval); + break; case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG: rc = ttf_get_time_to_empty(chip->ttf, &pval->intval); break; @@ -4724,6 +4727,7 @@ static enum power_supply_property fg_psy_props[] = { POWER_SUPPLY_PROP_DEBUG_BATTERY, POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, + POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, POWER_SUPPLY_PROP_CC_STEP, POWER_SUPPLY_PROP_CC_STEP_SEL, diff --git a/drivers/power/supply/qcom/qpnp-qg.c b/drivers/power/supply/qcom/qpnp-qg.c index 29e3a0bc7161..e94ac6228dbf 100644 --- a/drivers/power/supply/qcom/qpnp-qg.c +++ b/drivers/power/supply/qcom/qpnp-qg.c @@ -2150,6 +2150,9 @@ static int qg_psy_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG: rc = ttf_get_time_to_full(chip->ttf, &pval->intval); break; + case POWER_SUPPLY_PROP_TIME_TO_FULL_NOW: + rc = ttf_get_time_to_full(chip->ttf, &pval->intval); + break; case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG: rc = ttf_get_time_to_empty(chip->ttf, &pval->intval); break; @@ -2235,6 +2238,7 @@ static enum power_supply_property qg_psy_props[] = { POWER_SUPPLY_PROP_CHARGE_FULL, POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, + POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, POWER_SUPPLY_PROP_ESR_ACTUAL, POWER_SUPPLY_PROP_ESR_NOMINAL, diff --git a/drivers/power/supply/qcom/qpnp-smb2.c b/drivers/power/supply/qcom/qpnp-smb2.c index b54c20d8c04e..c0e59cec26a6 100644 --- a/drivers/power/supply/qcom/qpnp-smb2.c +++ b/drivers/power/supply/qcom/qpnp-smb2.c @@ -1020,6 +1020,8 @@ static enum power_supply_property smb2_batt_props[] = { POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, POWER_SUPPLY_PROP_CHARGE_COUNTER, POWER_SUPPLY_PROP_CHARGE_FULL, + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, + POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, POWER_SUPPLY_PROP_CYCLE_COUNT, POWER_SUPPLY_PROP_FCC_STEPPER_ENABLE, }; @@ -1130,9 +1132,11 @@ static int smb2_batt_get_prop(struct power_supply *psy, break; case POWER_SUPPLY_PROP_CHARGE_COUNTER: case POWER_SUPPLY_PROP_CHARGE_FULL: + case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: case POWER_SUPPLY_PROP_CYCLE_COUNT: case POWER_SUPPLY_PROP_VOLTAGE_NOW: case POWER_SUPPLY_PROP_TEMP: + case POWER_SUPPLY_PROP_TIME_TO_FULL_NOW: rc = smblib_get_prop_from_bms(chg, psp, val); break; case POWER_SUPPLY_PROP_CURRENT_NOW: diff --git a/drivers/power/supply/qcom/qpnp-smb5.c b/drivers/power/supply/qcom/qpnp-smb5.c index 5222f4fb6f9f..0a36ac05be8c 100644 --- a/drivers/power/supply/qcom/qpnp-smb5.c +++ b/drivers/power/supply/qcom/qpnp-smb5.c @@ -2190,6 +2190,8 @@ static enum power_supply_property smb5_batt_props[] = { POWER_SUPPLY_PROP_RECHARGE_SOC, POWER_SUPPLY_PROP_CHARGE_FULL, POWER_SUPPLY_PROP_FORCE_RECHARGE, + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, + POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, POWER_SUPPLY_PROP_FCC_STEPPER_ENABLE, POWER_SUPPLY_PROP_DC_THERMAL_LEVELS, }; @@ -2332,6 +2334,14 @@ static int smb5_batt_get_prop(struct power_supply *psy, case POWER_SUPPLY_PROP_FORCE_RECHARGE: val->intval = 0; break; + case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: + rc = smblib_get_prop_from_bms(chg, + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, val); + break; + case POWER_SUPPLY_PROP_TIME_TO_FULL_NOW: + rc = smblib_get_prop_from_bms(chg, + POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, val); + break; case POWER_SUPPLY_PROP_FCC_STEPPER_ENABLE: val->intval = chg->fcc_stepper_enable; break; diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index caf6935e0624..612809de1e98 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -2028,7 +2028,7 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev, if (vm_support) irqflags = IRQF_TRIGGER_RISING; else - irqflags = IRQF_NO_SUSPEND | IRQF_SHARED; + irqflags = IRQF_SHARED; ret = devm_request_irq(dev, irq, qcom_glink_native_intr, @@ -2044,6 +2044,10 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev, if (ret) dev_err(dev, "failed to set irq wake\n"); + ret = enable_irq_wake(irq); + if (ret < 0) + dev_err(dev, "enable_irq_wake() failed on %d\n", irq); + size = of_property_count_u32_elems(dev->of_node, "cpu-affinity"); if (size > 0) { arr = kmalloc_array(size, sizeof(u32), GFP_KERNEL); diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index 03d828763411..426d2120d305 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -1031,6 +1031,15 @@ config MSM_BAM_DMUX communication between G-Link/bg_com_dev and BG processor over SPI. This handle the interrupts raised by BG and notify the G-link with interrupt event and event data. + +config MSM_BGRSB + bool "Provide support for rsb events on Blackghost chipset" + help + BGRSB communicates to BG over rpmsg driver for RSB configuration and + enable/disable on device power state change. It enables/disables + the regulator specific to RSB. Sends the side band events generated + by BG to input framework. + config MSM_PIL_SSR_BG tristate "MSM Subsystem Blackghost(BG) Support" depends on MSM_PIL && MSM_SUBSYSTEM_RESTART diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile index 8edfa4263d1d..0edad6b28747 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -71,6 +71,7 @@ obj-$(CONFIG_QCOM_SMCINVOKE) += smcinvoke.o obj-$(CONFIG_SDX_EXT_IPC) += sdx_ext_ipc.o obj-$(CONFIG_MSM_PIL_SSR_BG) += subsys-pil-bg.o obj-$(CONFIG_QTI_NOTIFY_SIDEBAND) += sideband_notify.o +obj-$(CONFIG_MSM_BGRSB) += bg_rsb.o ifdef CONFIG_MSM_SUBSYSTEM_RESTART obj-y += subsystem_notif.o diff --git a/drivers/soc/qcom/bg_rsb.c b/drivers/soc/qcom/bg_rsb.c new file mode 100644 index 000000000000..cafe5af25af9 --- /dev/null +++ b/drivers/soc/qcom/bg_rsb.c @@ -0,0 +1,891 @@ +/* Copyright (c) 2017-2020, 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. + * + */ + +#define pr_fmt(msg) "bgrsb: %s: " msg, __func__ +#include "bgrsb.h" + +struct bgrsb_priv { + void *handle; + struct input_dev *input; + struct mutex glink_mutex; + struct mutex rsb_state_mutex; + enum bgrsb_state bgrsb_current_state; + void *lhndl; + struct work_struct bg_up_work; + struct work_struct bg_down_work; + struct work_struct rsb_up_work; + struct work_struct rsb_down_work; + struct work_struct rsb_calibration_work; + struct work_struct bttn_configr_work; + struct workqueue_struct *bgrsb_wq; + struct bgrsb_regulator rgltr; + enum ldo_task ldo_action; + void *bgwear_subsys_handle; + struct completion bg_resp_cmplt; + struct completion wrk_cmplt; + struct completion bg_lnikup_cmplt; + struct completion tx_done; + struct device *ldev; + struct wakeup_source bgrsb_ws; + wait_queue_head_t link_state_wait; + uint32_t calbrtion_intrvl; + uint32_t calbrtion_cpi; + uint8_t bttn_configs; + int msmrsb_gpio; + bool rsb_rpmsg; + bool rsb_use_msm_gpio; + bool is_in_twm; + bool calibration_needed; + bool is_calibrd; + bool is_cnfgrd; + bool blk_rsb_cmnds; + bool pending_enable; +}; + +static void *bgrsb_drv; +static int bgrsb_enable(struct bgrsb_priv *dev, bool enable); + +void bgrsb_send_input(struct event *evnt) +{ + uint8_t press_code; + uint8_t value; + struct bgrsb_priv *dev = + container_of(bgrsb_drv, struct bgrsb_priv, lhndl); + + pr_debug("%s: Called\n", __func__); + if (!evnt) { + pr_err("%s: No event received\n", __func__); + return; + } + if (evnt->sub_id == 1) { + input_report_rel(dev->input, REL_WHEEL, evnt->evnt_data); + input_sync(dev->input); + } else if (evnt->sub_id == 2) { + press_code = (uint8_t) evnt->evnt_data; + value = (uint8_t) (evnt->evnt_data >> 8); + + switch (press_code) { + case 0x1: + if (value == 0) { + input_report_key(dev->input, KEY_VOLUMEDOWN, 1); + input_sync(dev->input); + } else { + input_report_key(dev->input, KEY_VOLUMEDOWN, 0); + input_sync(dev->input); + } + break; + case 0x2: + if (value == 0) { + input_report_key(dev->input, KEY_VOLUMEUP, 1); + input_sync(dev->input); + } else { + input_report_key(dev->input, KEY_VOLUMEUP, 0); + input_sync(dev->input); + } + break; + case 0x3: + if (value == 0) { + input_report_key(dev->input, KEY_POWER, 1); + input_sync(dev->input); + } else { + input_report_key(dev->input, KEY_POWER, 0); + input_sync(dev->input); + } + break; + default: + pr_info("event: type[%d] , data: %d\n", + evnt->sub_id, evnt->evnt_data); + } + } + pr_debug("%s: Ended\n", __func__); +} +EXPORT_SYMBOL(bgrsb_send_input); + +static int bgrsb_init_regulators(struct device *pdev) +{ + struct regulator *reg11; + struct regulator *reg15; + struct bgrsb_priv *dev = dev_get_drvdata(pdev); + + reg11 = devm_regulator_get(pdev, "vdd-ldo1"); + if (IS_ERR_OR_NULL(reg11)) { + pr_err("Unable to get regulator for LDO-11\n"); + return PTR_ERR(reg11); + } + + reg15 = devm_regulator_get(pdev, "vdd-ldo2"); + if (IS_ERR_OR_NULL(reg15)) { + pr_err("Unable to get regulator for LDO-15\n"); + return PTR_ERR(reg15); + } + + dev->rgltr.regldo11 = reg11; + dev->rgltr.regldo15 = reg15; + return 0; +} + +static int bgrsb_set_ldo(struct bgrsb_priv *dev, enum ldo_task ldo_action) +{ + int ret = 0; + bool value; + + switch (ldo_action) { + case BGRSB_HW_TURN_ON: + ret = regulator_set_voltage(dev->rgltr.regldo11, + BGRSB_LDO11_VTG_MIN_UV, BGRSB_LDO11_VTG_MAX_UV); + if (ret) { + pr_err("Failed to request LDO-11 voltage %d\n", ret); + goto err_ret; + } + ret = regulator_enable(dev->rgltr.regldo11); + if (ret) { + pr_err("Failed to enable LDO-11 %d\n", ret); + goto err_ret; + } + break; + case BGRSB_ENABLE_WHEEL_EVENTS: + if (dev->rsb_use_msm_gpio == true) { + if (!gpio_is_valid(dev->msmrsb_gpio)) { + pr_err("gpio %d is not valid\n", + dev->msmrsb_gpio); + ret = -ENXIO; + goto err_ret; + } + + /* Sleep 50ms for h/w to detect signal */ + msleep(50); + + gpio_set_value(dev->msmrsb_gpio, 1); + value = gpio_get_value(dev->msmrsb_gpio); + if (value == true) { + pr_debug("gpio %d set properly\n", + dev->msmrsb_gpio); + } else { + pr_debug("gpio %d set failed\n", + dev->msmrsb_gpio); + ret = -ENXIO; + goto err_ret; + } + } else { + ret = regulator_set_voltage(dev->rgltr.regldo15, + BGRSB_LDO15_VTG_MIN_UV, BGRSB_LDO15_VTG_MAX_UV); + if (ret) { + pr_err("Request failed LDO-15 %d\n", + ret); + goto err_ret; + } + ret = regulator_enable(dev->rgltr.regldo15); + if (ret) { + pr_err("LDO-15 not enabled%d\n", + ret); + goto err_ret; + } + } + break; + case BGRSB_HW_TURN_OFF: + ret = regulator_disable(dev->rgltr.regldo11); + if (ret) { + pr_err("Failed to disable LDO-11 %d\n", ret); + goto err_ret; + } + break; + case BGRSB_DISABLE_WHEEL_EVENTS: + if (dev->rsb_use_msm_gpio == true) { + if (!gpio_is_valid(dev->msmrsb_gpio)) { + pr_err("Invalid gpio %d\n", + dev->msmrsb_gpio); + ret = -ENXIO; + goto err_ret; + } + /* Sleep 50ms for h/w to detect signal */ + msleep(50); + gpio_set_value(dev->msmrsb_gpio, 0); + } else { + ret = regulator_disable(dev->rgltr.regldo15); + if (ret) { + pr_err("Failed to disable LDO-15 %d\n", ret); + goto err_ret; + } + regulator_set_load(dev->rgltr.regldo15, 0); + } + break; + default: + ret = -EINVAL; + } + +err_ret: + return ret; +} + +static void bgrsb_bgdown_work(struct work_struct *work) +{ + int ret = 0; + struct bgrsb_priv *dev = container_of(work, struct bgrsb_priv, + bg_down_work); + + mutex_lock(&dev->rsb_state_mutex); + if (dev->bgrsb_current_state == BGRSB_STATE_RSB_ENABLED) { + ret = bgrsb_set_ldo(dev, BGRSB_DISABLE_WHEEL_EVENTS); + if (ret == 0) + dev->bgrsb_current_state = BGRSB_STATE_RSB_CONFIGURED; + else + pr_err("Failed to unvote LDO-15 on BG down\n"); + } + + if (dev->bgrsb_current_state == BGRSB_STATE_RSB_CONFIGURED) { + ret = bgrsb_set_ldo(dev, BGRSB_HW_TURN_OFF); + if (ret == 0) + dev->bgrsb_current_state = BGRSB_STATE_INIT; + else + pr_err("Failed to unvote LDO-11 on BG down\n"); + } + + dev->is_cnfgrd = false; + dev->blk_rsb_cmnds = false; + pr_debug("RSB current state is : %d\n", dev->bgrsb_current_state); + + if (dev->bgrsb_current_state == BGRSB_STATE_INIT) { + if (dev->is_calibrd) + dev->calibration_needed = true; + } + mutex_unlock(&dev->rsb_state_mutex); +} + +static int bgrsb_tx_msg(struct bgrsb_priv *dev, void *msg, size_t len) +{ + int rc = 0; + + __pm_stay_awake(&dev->bgrsb_ws); + mutex_lock(&dev->glink_mutex); + if (!dev->rsb_rpmsg) { + pr_err("bgrsb-rpmsg is not probed yet, waiting for it to be probed\n"); + goto err_ret; + } + if (rc != 0) + pr_err("bgrsb_rpmsg_tx_msg failed %d\n", rc); + +err_ret: + mutex_unlock(&dev->glink_mutex); + __pm_relax(&dev->bgrsb_ws); + return rc; +} + +static int bgrsb_enable(struct bgrsb_priv *dev, bool enable) +{ + struct bgrsb_msg req = {0}; + + req.cmd_id = 0x02; + req.data = enable ? 0x01 : 0x00; + + return bgrsb_tx_msg(dev, &req, BGRSB_MSG_SIZE); +} + +static int bgrsb_configr_rsb(struct bgrsb_priv *dev, bool enable) +{ + struct bgrsb_msg req = {0}; + + req.cmd_id = 0x01; + req.data = enable ? 0x01 : 0x00; + + return bgrsb_tx_msg(dev, &req, BGRSB_MSG_SIZE); +} + +void bgrsb_notify_glink_channel_state(bool state) +{ + struct bgrsb_priv *dev = + container_of(bgrsb_drv, struct bgrsb_priv, lhndl); + + pr_debug("%s: RSB-CTRL channel state: %d\n", __func__, state); + dev->rsb_rpmsg = state; +} +EXPORT_SYMBOL(bgrsb_notify_glink_channel_state); + +static void bgrsb_bgup_work(struct work_struct *work) +{ + int ret = 0; + struct bgrsb_priv *dev = + container_of(work, struct bgrsb_priv, bg_up_work); + + mutex_lock(&dev->rsb_state_mutex); + ret = bgrsb_set_ldo(dev, BGRSB_HW_TURN_ON); + if (ret == 0) { + if (!dev->rsb_rpmsg) + pr_err("bgrsb-rpmsg is not probed yet\n"); + + ret = wait_event_timeout(dev->link_state_wait, + (dev->rsb_rpmsg == true), msecs_to_jiffies(TIMEOUT_MS)); + if (ret == 0) { + pr_err("channel connection time out %d\n", + ret); + goto unlock; + } + pr_debug("bgrsb-rpmsg is probed\n"); + ret = bgrsb_configr_rsb(dev, true); + if (ret != 0) { + pr_err("BG failed to configure RSB %d\n", ret); + if (bgrsb_set_ldo(dev, BGRSB_HW_TURN_OFF) == 0) + dev->bgrsb_current_state = BGRSB_STATE_INIT; + goto unlock; + } + dev->is_cnfgrd = true; + dev->bgrsb_current_state = BGRSB_STATE_RSB_CONFIGURED; + pr_debug("RSB Cofigured\n"); + if (dev->pending_enable) + queue_work(dev->bgrsb_wq, &dev->rsb_up_work); + } +unlock: + mutex_unlock(&dev->rsb_state_mutex); +} + +/** + * ssr_bg_cb(): callback function is called. + * @arg1: a notifier_block. + * @arg2: opcode that defines the event. + * @arg3: void pointer. + * + * by ssr framework when BG goes down, up and during + * ramdump collection. It handles BG shutdown and + * power up events. + * + * Return: NOTIFY_DONE. + */ +static int ssr_bgrsb_cb(struct notifier_block *this, + unsigned long opcode, void *data) +{ + struct bgrsb_priv *dev = container_of(bgrsb_drv, + struct bgrsb_priv, lhndl); + + switch (opcode) { + case SUBSYS_BEFORE_SHUTDOWN: + if (dev->bgrsb_current_state == BGRSB_STATE_RSB_ENABLED) + dev->pending_enable = true; + queue_work(dev->bgrsb_wq, &dev->bg_down_work); + break; + case SUBSYS_AFTER_POWERUP: + if (dev->bgrsb_current_state == BGRSB_STATE_INIT) + queue_work(dev->bgrsb_wq, &dev->bg_up_work); + break; + } + return NOTIFY_DONE; +} + +static struct notifier_block ssr_bg_nb = { + .notifier_call = ssr_bgrsb_cb, + .priority = 0, +}; + +/** + * bgrsb_ssr_register(): callback function is called. + * @arg1: pointer to bgrsb_priv structure. + * + * ssr_register checks that domain id should be in range + * and register SSR framework for value at domain id. + * + * Return: 0 for success and -ENODEV otherwise. + */ +static int bgrsb_ssr_register(struct bgrsb_priv *dev) +{ + struct notifier_block *nb; + + if (!dev) + return -ENODEV; + + nb = &ssr_bg_nb; + dev->bgwear_subsys_handle = + subsys_notif_register_notifier(BGRSB_BGWEAR_SUBSYS, nb); + + if (!dev->bgwear_subsys_handle) { + dev->bgwear_subsys_handle = NULL; + return -ENODEV; + } + return 0; +} + +static void bgrsb_enable_rsb(struct work_struct *work) +{ + int rc = 0; + struct bgrsb_priv *dev = + container_of(work, struct bgrsb_priv, rsb_up_work); + + mutex_lock(&dev->rsb_state_mutex); + if (dev->bgrsb_current_state == BGRSB_STATE_RSB_ENABLED) { + pr_debug("RSB is already enabled\n"); + goto unlock; + } + if (dev->bgrsb_current_state != BGRSB_STATE_RSB_CONFIGURED) { + pr_err("BG is not yet configured for RSB\n"); + dev->pending_enable = true; + goto unlock; + } + rc = bgrsb_set_ldo(dev, BGRSB_ENABLE_WHEEL_EVENTS); + if (rc == 0) { + rc = bgrsb_enable(dev, true); + if (rc != 0) { + pr_err("Failed to send enable command to BG %d\n", rc); + bgrsb_set_ldo(dev, BGRSB_DISABLE_WHEEL_EVENTS); + dev->bgrsb_current_state = BGRSB_STATE_RSB_CONFIGURED; + goto unlock; + } + } + dev->bgrsb_current_state = BGRSB_STATE_RSB_ENABLED; + dev->pending_enable = false; + pr_debug("RSB Enabled\n"); + + if (dev->calibration_needed) { + dev->calibration_needed = false; + queue_work(dev->bgrsb_wq, &dev->rsb_calibration_work); + } +unlock: + mutex_unlock(&dev->rsb_state_mutex); + +} + +static void bgrsb_disable_rsb(struct work_struct *work) +{ + int rc = 0; + struct bgrsb_priv *dev = container_of(work, struct bgrsb_priv, + rsb_down_work); + + mutex_lock(&dev->rsb_state_mutex); + dev->pending_enable = false; + if (dev->bgrsb_current_state == BGRSB_STATE_RSB_ENABLED) { + rc = bgrsb_enable(dev, false); + if (rc != 0) { + pr_err("Failed to send disable command to BG\n"); + goto unlock; + } + rc = bgrsb_set_ldo(dev, BGRSB_DISABLE_WHEEL_EVENTS); + if (rc != 0) + goto unlock; + + dev->bgrsb_current_state = BGRSB_STATE_RSB_CONFIGURED; + pr_debug("RSB Disabled\n"); + } + +unlock: + mutex_unlock(&dev->rsb_state_mutex); +} + +static void bgrsb_calibration(struct work_struct *work) +{ + int rc = 0; + struct bgrsb_msg req = {0}; + struct bgrsb_priv *dev = + container_of(work, struct bgrsb_priv, + rsb_calibration_work); + + mutex_lock(&dev->rsb_state_mutex); + if (!dev->is_cnfgrd) { + pr_err("RSB is not configured\n"); + goto unlock; + } + + req.cmd_id = 0x03; + req.data = dev->calbrtion_cpi; + + rc = bgrsb_tx_msg(dev, &req, 5); + if (rc != 0) { + pr_err("Failed to send resolution value to BG %d\n", rc); + goto unlock; + } + + req.cmd_id = 0x04; + req.data = dev->calbrtion_intrvl; + + rc = bgrsb_tx_msg(dev, &req, 5); + if (rc != 0) { + pr_err("Failed to send interval value to BG %d\n", rc); + goto unlock; + } + dev->is_calibrd = true; + pr_debug("RSB Calibrated\n"); + +unlock: + mutex_unlock(&dev->rsb_state_mutex); +} + +static void bgrsb_buttn_configration(struct work_struct *work) +{ + int rc = 0; + struct bgrsb_msg req = {0}; + struct bgrsb_priv *dev = + container_of(work, struct bgrsb_priv, + bttn_configr_work); + + mutex_lock(&dev->rsb_state_mutex); + if (!dev->is_cnfgrd) { + pr_err("RSB is not configured\n"); + goto unlock; + } + + req.cmd_id = 0x05; + req.data = dev->bttn_configs; + + rc = bgrsb_tx_msg(dev, &req, 5); + if (rc != 0) { + pr_err("configuration cmnd failed %d\n", + rc); + goto unlock; + } + + dev->bttn_configs = 0; + pr_debug("RSB Button configured\n"); + +unlock: + mutex_unlock(&dev->rsb_state_mutex); +} + +static int bgrsb_handle_cmd_in_ssr(struct bgrsb_priv *dev, char *str) +{ + long val; + int ret; + char *tmp; + + tmp = strsep(&str, ":"); + if (!tmp) + return -EINVAL; + + ret = kstrtol(tmp, 10, &val); + if (ret < 0) + return ret; + + if (val == BGRSB_POWER_ENABLE) + dev->pending_enable = true; + else if (val == BGRSB_POWER_DISABLE) + dev->pending_enable = false; + + return 0; +} + +static int split_bg_work(struct bgrsb_priv *dev, char *str) +{ + long val; + int ret; + char *tmp; + + tmp = strsep(&str, ":"); + if (!tmp) + return -EINVAL; + + ret = kstrtol(tmp, 10, &val); + if (ret < 0) + return ret; + + switch (val) { + case BGRSB_POWER_DISABLE: + queue_work(dev->bgrsb_wq, &dev->rsb_down_work); + break; + case BGRSB_POWER_ENABLE: + queue_work(dev->bgrsb_wq, &dev->rsb_up_work); + break; + case BGRSB_POWER_CALIBRATION: + tmp = strsep(&str, ":"); + if (!tmp) + return -EINVAL; + + ret = kstrtol(tmp, 10, &val); + if (ret < 0) + return ret; + + dev->calbrtion_intrvl = (uint32_t)val; + + tmp = strsep(&str, ":"); + if (!tmp) + return -EINVAL; + + ret = kstrtol(tmp, 10, &val); + if (ret < 0) + return ret; + + dev->calbrtion_cpi = (uint32_t)val; + + queue_work(dev->bgrsb_wq, &dev->rsb_calibration_work); + break; + case BGRSB_BTTN_CONFIGURE: + tmp = strsep(&str, ":"); + if (!tmp) + return -EINVAL; + + ret = kstrtol(tmp, 10, &val); + if (ret < 0) + return ret; + + dev->bttn_configs = (uint8_t)val; + queue_work(dev->bgrsb_wq, &dev->bttn_configr_work); + break; + case BGRSB_IN_TWM: + dev->is_in_twm = true; + case BGRSB_GLINK_POWER_DISABLE: + break; + case BGRSB_OUT_TWM: + dev->is_in_twm = false; + case BGRSB_GLINK_POWER_ENABLE: + break; + } + return 0; +} + +static int store_enable(struct device *pdev, struct device_attribute *attr, + const char *buff, size_t count) +{ + int rc; + struct bgrsb_priv *dev = dev_get_drvdata(pdev); + char *arr; + + if (dev->blk_rsb_cmnds) { + pr_err("Device is in TWM state\n"); + return count; + } + arr = kstrdup(buff, GFP_KERNEL); + if (!arr) + return -ENOMEM; + + rc = split_bg_work(dev, arr); + if (!dev->is_cnfgrd) { + bgrsb_handle_cmd_in_ssr(dev, arr); + kfree(arr); + return -ENOMEDIUM; + } + + if (rc != 0) + pr_err("Not able to process request\n"); + + kfree(arr); + return count; +} + +static int show_enable(struct device *dev, struct device_attribute *attr, + char *buff) +{ + return 0; +} + +static struct device_attribute dev_attr_rsb = { + .attr = { + .name = "enable", + .mode = 00660, + }, + .show = show_enable, + .store = store_enable, +}; + +static int bgrsb_init(struct bgrsb_priv *dev) +{ + bgrsb_drv = &dev->lhndl; + mutex_init(&dev->glink_mutex); + mutex_init(&dev->rsb_state_mutex); + + dev->ldo_action = BGRSB_NO_ACTION; + + dev->bgrsb_wq = + create_singlethread_workqueue("bg-work-queue"); + if (!dev->bgrsb_wq) { + pr_err("Failed to init BG-RSB work-queue\n"); + return -ENOMEM; + } + + init_waitqueue_head(&dev->link_state_wait); + + /* set default bgrsb state */ + dev->bgrsb_current_state = BGRSB_STATE_INIT; + + /* Init all works */ + INIT_WORK(&dev->bg_up_work, bgrsb_bgup_work); + INIT_WORK(&dev->bg_down_work, bgrsb_bgdown_work); + INIT_WORK(&dev->rsb_up_work, bgrsb_enable_rsb); + INIT_WORK(&dev->rsb_down_work, bgrsb_disable_rsb); + INIT_WORK(&dev->rsb_calibration_work, bgrsb_calibration); + INIT_WORK(&dev->bttn_configr_work, bgrsb_buttn_configration); + + return 0; +} + +static int bg_rsb_probe(struct platform_device *pdev) +{ + struct bgrsb_priv *dev; + struct input_dev *input; + struct device_node *node; + int rc; + unsigned int rsb_gpio; + + node = pdev->dev.of_node; + + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + if (!dev) + return -ENOMEM; + + /* Add wake lock for PM suspend */ + wakeup_source_init(&dev->bgrsb_ws, "BGRSB_wake_lock"); + + dev->bgrsb_current_state = BGRSB_STATE_UNKNOWN; + rc = bgrsb_init(dev); + if (rc) + goto err_ret_dev; + /* Set up input device */ + input = devm_input_allocate_device(&pdev->dev); + if (!input) + goto err_ret_dev; + + input_set_capability(input, EV_REL, REL_WHEEL); + input_set_capability(input, EV_KEY, KEY_VOLUMEUP); + input_set_capability(input, EV_KEY, KEY_VOLUMEDOWN); + input->name = "bg-spi"; + + rc = input_register_device(input); + if (rc) { + pr_err("Input device registration failed\n"); + goto err_ret_inp; + } + dev->input = input; + + /* register device for bg-wear ssr */ + rc = bgrsb_ssr_register(dev); + if (rc) { + pr_err("Failed to register for bg ssr\n"); + goto err_ret_inp; + } + rc = device_create_file(&pdev->dev, &dev_attr_rsb); + if (rc) { + pr_err("Not able to create the file bg-rsb/enable\n"); + goto err_ret_inp; + } + + dev->rsb_use_msm_gpio = + of_property_read_bool(node, "qcom,rsb-use-msm-gpio"); + + if (dev->rsb_use_msm_gpio == true) { + rsb_gpio = of_get_named_gpio(node, "qcom,bg-rsb-gpio", 0); + pr_debug("gpio %d is configured\n", rsb_gpio); + + if (!gpio_is_valid(rsb_gpio)) { + pr_err("gpio %d found is not valid\n", rsb_gpio); + goto err_ret; + } + + if (gpio_request(rsb_gpio, "msm_rsb_gpio")) { + pr_err("gpio %d request failed\n", rsb_gpio); + goto err_ret; + } + + if (gpio_direction_output(rsb_gpio, 1)) { + pr_err("gpio %d direction not set\n", rsb_gpio); + goto err_ret; + } + pr_debug("rsb gpio successfully requested\n"); + dev->msmrsb_gpio = rsb_gpio; + } + dev_set_drvdata(&pdev->dev, dev); + rc = bgrsb_init_regulators(&pdev->dev); + if (rc) { + pr_err("Failed to set regulators\n"); + goto err_ret_inp; + } + + pr_debug("RSB probe successfully\n"); + return 0; +err_ret: + return 0; +err_ret_inp: + input_free_device(input); +err_ret_dev: + devm_kfree(&pdev->dev, dev); + return -ENODEV; +} + +static int bg_rsb_remove(struct platform_device *pdev) +{ + struct bgrsb_priv *dev = platform_get_drvdata(pdev); + + destroy_workqueue(dev->bgrsb_wq); + input_free_device(dev->input); + wakeup_source_trash(&dev->bgrsb_ws); + return 0; +} + +static int bg_rsb_resume(struct device *pldev) +{ + struct platform_device *pdev = to_platform_device(pldev); + struct bgrsb_priv *dev = platform_get_drvdata(pdev); + + mutex_lock(&dev->rsb_state_mutex); + if (dev->bgrsb_current_state == BGRSB_STATE_RSB_CONFIGURED) + goto ret_success; + + if (dev->bgrsb_current_state == BGRSB_STATE_INIT) { + if (dev->is_cnfgrd && + bgrsb_set_ldo(dev, BGRSB_HW_TURN_ON) == 0) { + dev->bgrsb_current_state = BGRSB_STATE_RSB_CONFIGURED; + pr_debug("RSB Cofigured\n"); + goto ret_success; + } + pr_err("RSB failed to resume\n"); + } + mutex_unlock(&dev->rsb_state_mutex); + return -EINVAL; + +ret_success: + mutex_unlock(&dev->rsb_state_mutex); + return 0; +} + +static int bg_rsb_suspend(struct device *pldev) +{ + struct platform_device *pdev = to_platform_device(pldev); + struct bgrsb_priv *dev = platform_get_drvdata(pdev); + + mutex_lock(&dev->rsb_state_mutex); + if (dev->bgrsb_current_state == BGRSB_STATE_INIT) + goto ret_success; + + if (dev->bgrsb_current_state == BGRSB_STATE_RSB_ENABLED) { + if (bgrsb_set_ldo(dev, BGRSB_DISABLE_WHEEL_EVENTS) != 0) + goto ret_err; + } + + if (bgrsb_set_ldo(dev, BGRSB_HW_TURN_OFF) == 0) { + dev->bgrsb_current_state = BGRSB_STATE_INIT; + pr_debug("RSB Init\n"); + goto ret_success; + } + +ret_err: + pr_err("RSB failed to suspend\n"); + mutex_unlock(&dev->rsb_state_mutex); + return -EINVAL; + +ret_success: + mutex_unlock(&dev->rsb_state_mutex); + return 0; +} + +static const struct of_device_id bg_rsb_of_match[] = { + { .compatible = "qcom,bg-rsb", }, + { } +}; + +static const struct dev_pm_ops pm_rsb = { + .resume = bg_rsb_resume, + .suspend = bg_rsb_suspend, +}; + +static struct platform_driver bg_rsb_driver = { + .driver = { + .name = "bg-rsb", + .of_match_table = bg_rsb_of_match, + .pm = &pm_rsb, + }, + .probe = bg_rsb_probe, + .remove = bg_rsb_remove, +}; module_platform_driver(bg_rsb_driver); +MODULE_DESCRIPTION("SoC BG RSB driver"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/soc/qcom/bgcom_interface.c b/drivers/soc/qcom/bgcom_interface.c index 0705bc7ad16d..c207738e0d23 100644 --- a/drivers/soc/qcom/bgcom_interface.c +++ b/drivers/soc/qcom/bgcom_interface.c @@ -134,9 +134,9 @@ static void bgcom_load_twm_bg_work(struct work_struct *work) } else { dev->bg_twm_wear_load = true; dev->pil_h = subsystem_get_with_fwname("bg-wear", - "bg-twm-wear"); + "bg-twm"); if (!dev->pil_h) - pr_err("failed to load bg-twm-wear\n"); + pr_err("failed to load bg-twm\n"); } } @@ -617,7 +617,7 @@ static int ssr_bg_cb(struct notifier_block *this, break; case SUBSYS_AFTER_SHUTDOWN: if (dev->pending_bg_twm_wear_load) { - /* Load bg-twm-wear */ + /* Load bg-twm */ dev->pending_bg_twm_wear_load = false; queue_work(dev->bgdaemon_wq, &dev->bgdaemon_load_twm_bg_work); diff --git a/drivers/soc/qcom/bgrsb.h b/drivers/soc/qcom/bgrsb.h index 93a58b34bd28..ba0b88492ded 100644 --- a/drivers/soc/qcom/bgrsb.h +++ b/drivers/soc/qcom/bgrsb.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018,2020 The Linux Foundation. All rights reserved. +/* Copyright (c) 2017-2020, 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 @@ -13,6 +13,23 @@ #ifndef BGRSB_H #define BGRSB_H +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include struct event { uint8_t sub_id; @@ -20,17 +37,52 @@ struct event { uint32_t evnt_tm; }; +#define BGRSB_GLINK_INTENT_SIZE 0x04 +#define BGRSB_MSG_SIZE 0x08 +#define TIMEOUT_MS 2000 +#define BGRSB_LDO15_VTG_MIN_UV 3000000 +#define BGRSB_LDO15_VTG_MAX_UV 3000000 +#define BGRSB_LDO11_VTG_MIN_UV 1800000 +#define BGRSB_LDO11_VTG_MAX_UV 1800000 -struct bg_glink_chnl { - char *chnl_name; - char *chnl_edge; - char *chnl_trnsprt; +#define BGRSB_BGWEAR_SUBSYS "bg-wear" + +#define BGRSB_POWER_DISABLE 0 +#define BGRSB_POWER_ENABLE 1 +#define BGRSB_POWER_CALIBRATION 2 +#define BGRSB_BTTN_CONFIGURE 5 +#define BGRSB_GLINK_POWER_ENABLE 6 +#define BGRSB_GLINK_POWER_DISABLE 7 +#define BGRSB_IN_TWM 8 +#define BGRSB_OUT_TWM 9 + + +struct bgrsb_regulator { + struct regulator *regldo11; + struct regulator *regldo15; }; -/** - * bgrsb_send_input() - send the recived input to input framework - * @evnt: pointer to the event structure - */ -int bgrsb_send_input(struct event *evnt); +enum ldo_task { + BGRSB_HW_TURN_ON, + BGRSB_ENABLE_WHEEL_EVENTS, + BGRSB_HW_TURN_OFF, + BGRSB_DISABLE_WHEEL_EVENTS, + BGRSB_NO_ACTION +}; +enum bgrsb_state { + BGRSB_STATE_UNKNOWN, + BGRSB_STATE_INIT, + BGRSB_STATE_LDO11_ENABLED, + BGRSB_STATE_RSB_CONFIGURED, + BGRSB_STATE_RSB_ENABLED +}; + +struct bgrsb_msg { + uint32_t cmd_id; + uint32_t data; +}; + +void bgrsb_send_input(struct event *evnt); +void bgrsb_notify_glink_channel_state(bool state); #endif /* BGCOM_H */ diff --git a/drivers/soc/qcom/dfc_qmi.c b/drivers/soc/qcom/dfc_qmi.c index ef4470ea9445..8ca4db08fd5b 100644 --- a/drivers/soc/qcom/dfc_qmi.c +++ b/drivers/soc/qcom/dfc_qmi.c @@ -989,7 +989,8 @@ static u32 dfc_adjust_grant(struct rmnet_bearer_map *bearer, static int dfc_update_fc_map(struct net_device *dev, struct qos_info *qos, u8 ack_req, u32 ancillary, struct dfc_flow_status_info_type_v01 *fc_info, - bool is_query) + bool is_query, + int index) { struct rmnet_bearer_map *itm = NULL; int rc = 0; @@ -1010,9 +1011,16 @@ static int dfc_update_fc_map(struct net_device *dev, struct qos_info *qos, if (itm->rat_switch) return 0; - /* If TX is OFF but we received grant, ignore it */ - if (itm->tx_off && fc_info->num_bytes > 0) - return 0; + /* If TX is OFF but we received grant from the same modem, + * ignore it. If the grant is from a different modem, + * assume TX had become ON. + */ + if (itm->tx_off && fc_info->num_bytes > 0) { + if (itm->tx_status_index == index) + return 0; + itm->tx_off = false; + itm->tx_status_index = index; + } /* Adjuste grant for query */ if (dfc_qmap && is_query) { @@ -1120,7 +1128,7 @@ void dfc_do_burst_flow_control(struct dfc_qmi_data *dfc, else dfc_update_fc_map( dev, qos, ack_req, ancillary, flow_status, - is_query); + is_query, dfc->index); spin_unlock_bh(&qos->qos_lock); } @@ -1131,7 +1139,8 @@ clean_out: static void dfc_update_tx_link_status(struct net_device *dev, struct qos_info *qos, u8 tx_status, - struct dfc_bearer_info_type_v01 *binfo) + struct dfc_bearer_info_type_v01 *binfo, + int index) { struct rmnet_bearer_map *itm = NULL; @@ -1139,6 +1148,8 @@ static void dfc_update_tx_link_status(struct net_device *dev, if (!itm) return; + itm->tx_status_index = index; + /* If no change in tx status, ignore */ if (itm->tx_off == !tx_status) return; @@ -1190,7 +1201,7 @@ void dfc_handle_tx_link_status_ind(struct dfc_qmi_data *dfc, spin_lock_bh(&qos->qos_lock); dfc_update_tx_link_status( - dev, qos, ind->tx_status, bearer_info); + dev, qos, ind->tx_status, bearer_info, dfc->index); spin_unlock_bh(&qos->qos_lock); } diff --git a/drivers/soc/qcom/qmi_rmnet_i.h b/drivers/soc/qcom/qmi_rmnet_i.h index d28c5c99aaee..c87eed4f361d 100644 --- a/drivers/soc/qcom/qmi_rmnet_i.h +++ b/drivers/soc/qcom/qmi_rmnet_i.h @@ -51,6 +51,7 @@ struct rmnet_bearer_map { bool tcp_bidir; bool rat_switch; bool tx_off; + int tx_status_index; u32 ack_txid; u32 mq_idx; u32 ack_mq_idx; diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index 13042d0ef07f..5ce4aa03e537 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -465,9 +465,11 @@ static struct msm_soc_info cpu_of_id[] = { [416] = {MSM_CPU_SDM429W, "SDM429W"}, [437] = {MSM_CPU_SDA429W, "SDA429W"}, - /* QCM6125 IDs*/ - [467] = {MSM_CPU_QCM6125, "QCM6125"}, - [468] = {MSM_CPU_QCS6125, "QCS6125"}, + /* TRINKET-IOT IDs*/ + [467] = {MSM_CPU_TRINKET_IOT, "TRINKET-IOT"}, + + /* TRINKETP-IOT IDs*/ + [468] = {MSM_CPU_TRINKETP_IOT, "TRINKETP-IOT"}, /* Uninitialized IDs are not known to run Linux. * MSM_CPU_UNKNOWN is set to 0 to ensure these IDs are @@ -1489,13 +1491,13 @@ static void * __init setup_dummy_socinfo(void) dummy_socinfo.id = 437; strlcpy(dummy_socinfo.build_id, "sda429w - ", sizeof(dummy_socinfo.build_id)); - } else if (early_machine_is_qcm6125()) { + } else if (early_machine_is_trinket_iot()) { dummy_socinfo.id = 467; - strlcpy(dummy_socinfo.build_id, "qcm6125 - ", + strlcpy(dummy_socinfo.build_id, "trinket-iot - ", sizeof(dummy_socinfo.build_id)); - } else if (early_machine_is_qcs6125()) { + } else if (early_machine_is_trinketp_iot()) { dummy_socinfo.id = 468; - strlcpy(dummy_socinfo.build_id, "qcm6125 - ", + strlcpy(dummy_socinfo.build_id, "trinketp-iot - ", sizeof(dummy_socinfo.build_id)); } else strlcat(dummy_socinfo.build_id, "Dummy socinfo", diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c index 2d5ca183da3a..205920d55e03 100644 --- a/drivers/spi/spi-geni-qcom.c +++ b/drivers/spi/spi-geni-qcom.c @@ -1577,7 +1577,6 @@ static int spi_geni_probe(struct platform_device *pdev) struct platform_device *wrapper_pdev; struct device_node *wrapper_ph_node; bool rt_pri, slave_en; - char boot_marker[40]; spi = spi_alloc_master(&pdev->dev, sizeof(struct spi_geni_master)); if (!spi) { diff --git a/drivers/tty/serial/msm_geni_serial.c b/drivers/tty/serial/msm_geni_serial.c index f91872defa96..2214428a3074 100644 --- a/drivers/tty/serial/msm_geni_serial.c +++ b/drivers/tty/serial/msm_geni_serial.c @@ -2409,7 +2409,6 @@ static int msm_geni_serial_probe(struct platform_device *pdev) struct platform_device *wrapper_pdev; struct device_node *wrapper_ph_node; u32 wake_char = 0; - char boot_marker[40]; id = of_match_device(msm_geni_device_tbl, &pdev->dev); if (id) { diff --git a/drivers/usb/gadget/function/Makefile b/drivers/usb/gadget/function/Makefile index 7cd7afe1910e..bdca28e5dfec 100644 --- a/drivers/usb/gadget/function/Makefile +++ b/drivers/usb/gadget/function/Makefile @@ -5,6 +5,7 @@ ccflags-y := -I$(srctree)/drivers/usb/gadget/ ccflags-y += -I$(srctree)/drivers/usb/gadget/udc/ +ccflags-y += -Wno-unused-variable # USB Functions usb_f_acm-y := f_acm.o @@ -33,7 +34,6 @@ obj-$(CONFIG_USB_F_RNDIS) += usb_f_rndis.o usb_f_mass_storage-y := f_mass_storage.o storage_common.o obj-$(CONFIG_USB_F_MASS_STORAGE)+= usb_f_mass_storage.o usb_f_fs-y := f_fs.o -CFLAGS_f_fs.o += $(call cc-disable-warning, unused-variable) obj-$(CONFIG_USB_F_FS) += usb_f_fs.o obj-$(CONFIG_USB_U_AUDIO) += u_audio.o usb_f_uac1-y := f_uac1.o diff --git a/drivers/usb/gadget/function/f_gsi.c b/drivers/usb/gadget/function/f_gsi.c index 9b6fd9c4a85b..2fd0d3761bea 100644 --- a/drivers/usb/gadget/function/f_gsi.c +++ b/drivers/usb/gadget/function/f_gsi.c @@ -1839,9 +1839,41 @@ static int queue_notification_request(struct f_gsi *gsi) { int ret; unsigned long flags; + struct usb_function *func = &gsi->function; + struct usb_request *req = gsi->c_port.notify_req; + struct usb_ep *ep = gsi->c_port.notify; + struct usb_gadget *gadget = func->config->cdev->gadget; - ret = usb_func_ep_queue(&gsi->function, gsi->c_port.notify, - gsi->c_port.notify_req, GFP_ATOMIC); + if (gsi->c_port.is_suspended) { + /*For remote wakeup, queue the req from gsi_resume*/ + spin_lock_irqsave(&gsi->c_port.lock, flags); + gsi->c_port.notify_req_queued = false; + spin_unlock_irqrestore(&gsi->c_port.lock, flags); + + if (gsi->rwake_inprogress) { + log_event_dbg("%s remote-wakeup in progress\n", + __func__); + return -EBUSY; + } + + if (!usb_gsi_remote_wakeup_allowed(func)) { + log_event_dbg("%s remote-wakeup not capable\n", + __func__); + return -EOPNOTSUPP; + } + + log_event_dbg("%s wakeup host\n", __func__); + if (gadget->speed >= USB_SPEED_SUPER + && func->func_is_suspended) + ret = usb_func_wakeup(func); + else + ret = usb_gadget_wakeup(gadget); + + gsi->rwake_inprogress = true; + return ret; + } + + ret = usb_ep_queue(ep, req, GFP_ATOMIC); if (ret < 0) { spin_lock_irqsave(&gsi->c_port.lock, flags); gsi->c_port.notify_req_queued = false; @@ -2474,6 +2506,7 @@ static int gsi_set_alt(struct usb_function *f, unsigned int intf, gsi->data_id, gsi->data_interface_up); } + gsi->c_port.is_suspended = false; atomic_set(&gsi->connected, 1); /* send 0 len pkt to qti to notify state change */ @@ -2574,6 +2607,7 @@ static void gsi_suspend(struct usb_function *f) return; } + gsi->c_port.is_suspended = true; block_db = true; usb_gsi_ep_op(gsi->d_port.in_ep, (void *)&block_db, GSI_EP_OP_SET_CLR_BLOCK_DBL); @@ -2605,6 +2639,8 @@ static void gsi_resume(struct usb_function *f) if (gsi->c_port.notify && !gsi->c_port.notify->desc) config_ep_by_speed(cdev->gadget, f, gsi->c_port.notify); + gsi->c_port.is_suspended = false; + /* Check any pending cpkt, and queue immediately on resume */ gsi_ctrl_send_notification(gsi); diff --git a/drivers/usb/gadget/function/f_gsi.h b/drivers/usb/gadget/function/f_gsi.h index 0db1f0ac381d..7e9da0a189fa 100644 --- a/drivers/usb/gadget/function/f_gsi.h +++ b/drivers/usb/gadget/function/f_gsi.h @@ -209,6 +209,7 @@ struct gsi_ctrl_port { atomic_t ctrl_online; bool is_open; + bool is_suspended; wait_queue_head_t read_wq; diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index 214fad87ce05..fc5f05a4b5ab 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c @@ -798,13 +798,13 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb, } spin_unlock_irqrestore(&dev->lock, flags); - if (!in) { + if (skb && !in) { dev_kfree_skb_any(skb); return NETDEV_TX_OK; } /* apply outgoing CDC or RNDIS filters */ - if (!test_bit(RMNET_MODE_LLP_IP, &dev->flags) && + if (skb && !test_bit(RMNET_MODE_LLP_IP, &dev->flags) && !is_promisc(cdc_filter)) { u8 *dest = skb->data; @@ -872,16 +872,17 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb, if (dev->wrap) { if (dev->port_usb) skb = dev->wrap(dev->port_usb, skb); - if (!skb) { - spin_unlock_irqrestore(&dev->lock, flags); - /* Multi frame CDC protocols may store the frame for - * later which is not a dropped frame. - */ - if (dev->port_usb && - dev->port_usb->supports_multi_frame) - goto multiframe; - goto drop; - } + } + + if (!skb) { + spin_unlock_irqrestore(&dev->lock, flags); + /* Multi frame CDC protocols may store the frame for + * later which is not a dropped frame. + */ + if (dev->port_usb && + dev->port_usb->supports_multi_frame) + goto multiframe; + goto drop; } dev->tx_skb_hold_count++; diff --git a/drivers/usb/gadget/function/uvc.h b/drivers/usb/gadget/function/uvc.h index 11d70dead32b..bf5f25349531 100644 --- a/drivers/usb/gadget/function/uvc.h +++ b/drivers/usb/gadget/function/uvc.h @@ -94,7 +94,7 @@ extern unsigned int uvc_gadget_trace_param; * Driver specific constants */ -#define UVC_NUM_REQUESTS 4 +#define UVC_NUM_REQUESTS 8 #define UVC_MAX_REQUEST_SIZE 64 #define UVC_MAX_EVENTS 4 diff --git a/include/linux/ipa_uc_offload.h b/include/linux/ipa_uc_offload.h index 2e0905b14605..e77f38b7c400 100644 --- a/include/linux/ipa_uc_offload.h +++ b/include/linux/ipa_uc_offload.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2016-2020, 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 @@ -26,6 +26,7 @@ enum ipa_uc_offload_proto { IPA_UC_INVALID = 0, IPA_UC_WDI = 1, IPA_UC_NTN = 2, + IPA_UC_NTN_V2X = 3, IPA_UC_MAX_PROT_SIZE }; @@ -95,6 +96,7 @@ struct ntn_buff_smmu_map { * @num_buffers: Rx/Tx buffer pool size (in terms of elements) * @data_buff_size: size of the each data buffer allocated in DDR * @ntn_reg_base_ptr_pa: physical address of the Tx/Rx NTN Ring's + * @u8 db_mode: 0 means irq mode, 1 means db mode * tail pointer */ struct ipa_ntn_setup_info { @@ -117,6 +119,8 @@ struct ipa_ntn_setup_info { u32 data_buff_size; phys_addr_t ntn_reg_base_ptr_pa; + + u8 db_mode; }; /** @@ -182,10 +186,12 @@ struct ipa_uc_offload_conn_out_params { * struct ipa_perf_profile - To set BandWidth profile * * @client: type of "client" (IPA_CLIENT_ODU#_PROD/CONS) + * @proto: uC offload protocol type * @max_supported_bw_mbps: maximum bandwidth needed (in Mbps) */ struct ipa_perf_profile { enum ipa_client_type client; + enum ipa_uc_offload_proto proto; u32 max_supported_bw_mbps; }; diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 9ed7771ba212..3dc7d602ec15 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -201,5 +201,7 @@ struct plat_stmmacenet_data { bool early_eth; bool crc_strip_en; bool phy_intr_en; + int mac2mac_rgmii_speed; + bool mac2mac_en; }; #endif diff --git a/include/linux/string.h b/include/linux/string.h index 1e6dd1b3d232..40318121f97e 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -146,6 +146,9 @@ extern void * memscan(void *,int,__kernel_size_t); #ifndef __HAVE_ARCH_MEMCMP extern int memcmp(const void *,const void *,__kernel_size_t); #endif +#ifndef __HAVE_ARCH_BCMP +extern int bcmp(const void *,const void *,__kernel_size_t); +#endif #ifndef __HAVE_ARCH_MEMCHR extern void * memchr(const void *,int,__kernel_size_t); #endif diff --git a/include/soc/qcom/qrtr_ethernet.h b/include/soc/qcom/qrtr_ethernet.h new file mode 100644 index 000000000000..023453eaf0b4 --- /dev/null +++ b/include/soc/qcom/qrtr_ethernet.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2020, 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. + * + * QRTR-Ethernet API header + */ + +#ifndef _QRTR_ETHERNET_H +#define _QRTR_ETHERNET_H + +#include + +/** + * qrtr_ethernet_cb_info - struct to pass transport layer information to qrtr + * @eth_send: function pointer to send qrtr packets to transport layer + */ +struct qrtr_ethernet_cb_info { + int (*eth_send)(struct sk_buff *skb); +}; + +/** + * eth_adapt_result - struct to pass on buffer from external ap to qrtr + * buf_addr - address of the buffer that holds the data from external ap + * bytes_xferd - size of the above buffer + */ +struct eth_adapt_result { + void *buf_addr; + size_t bytes_xferd; +}; + +#if IS_ENABLED(CONFIG_QRTR_ETHERNET) || IS_ENABLED(CONFIG_QTI_QRTR_ETHERNET) +void qcom_ethernet_init_cb(struct qrtr_ethernet_cb_info *cbinfo); +void qcom_ethernet_qrtr_dl_cb(struct eth_adapt_result *eth_res); +void qcom_ethernet_qrtr_status_cb(unsigned int event); +#else +static inline void qcom_ethernet_init_cb(struct qrtr_ethernet_cb_info *cbinfo) +{ +} +static inline void qcom_ethernet_qrtr_dl_cb(struct eth_adapt_result *eth_res) {} +static inline void qcom_ethernet_qrtr_status_cb(unsigned int event) {} +#endif /* CONFIG_QRTR_ETHERNET or CONFIG_QTI_QRTR_ETHERNET */ + +#endif /* _QRTR_ETHERNET_H */ diff --git a/include/soc/qcom/socinfo.h b/include/soc/qcom/socinfo.h index 397503d1ed16..82393c160e33 100644 --- a/include/soc/qcom/socinfo.h +++ b/include/soc/qcom/socinfo.h @@ -121,10 +121,10 @@ of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdm429w") #define early_machine_is_sda429w() \ of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sda429w") -#define early_machine_is_qcm6125() \ - of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcm6125") -#define early_machine_is_qcs6125() \ - of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcs6125") +#define early_machine_is_trinket_iot() \ + of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,trinket-iot") +#define early_machine_is_trinketp_iot() \ + of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,trinketp-iot") #else #define of_board_is_sim() 0 #define of_board_is_rumi() 0 @@ -172,8 +172,8 @@ #define early_machine_is_sda660() 0 #define early_machine_is_sdm429w() 0 #define early_machine_is_sda429w() 0 -#define early_machine_is_qcm6125() 0 -#define early_machine_is_qcs6125() 0 +#define early_machine_is_trinket_iot() 0 +#define early_machine_is_trinketp_iot() 0 #endif #define PLATFORM_SUBTYPE_MDM 1 @@ -225,8 +225,8 @@ enum msm_cpu { MSM_CPU_SDA660, MSM_CPU_SDM429W, MSM_CPU_SDA429W, - MSM_CPU_QCM6125, - MSM_CPU_QCS6125, + MSM_CPU_TRINKET_IOT, + MSM_CPU_TRINKETP_IOT, }; struct msm_soc_info { diff --git a/include/uapi/linux/msm_eth.h b/include/uapi/linux/msm_eth.h new file mode 100644 index 000000000000..e60214ad5d5a --- /dev/null +++ b/include/uapi/linux/msm_eth.h @@ -0,0 +1,37 @@ +#ifndef _UAPI_MSM_ETH_H_ +#define _UAPI_MSM_ETH_H_ + +#include + +/** + * defines eth_meta_event - Events for eth + * + * CV2X pipe connect: CV2X pipe connected + * CV2X pipe disconnect: CV2X pipe disconnected + */ +#define ETH_EVT_START 0 +#define ETH_EVT_CV2X_PIPE_CONNECTED (ETH_EVT_START + 1) +#define ETH_EVT_CV2X_PIPE_DISCONNECTED (ETH_EVT_CV2X_PIPE_CONNECTED + 1) +#define ETH_EVT_CV2X_MODE_NOT_ENABLED (ETH_EVT_CV2X_PIPE_DISCONNECTED + 1) + +/** + * struct eth_msg_meta - Format of the message meta-data. + * @msg_type: the type of the message + * @rsvd: reserved bits for future use. + * @msg_len: the length of the message in bytes + * + * For push model: + * Client in user-space should issue a read on the device (/dev/emac) with a + * sufficiently large buffer in a continuous loop, call will block when there is + * no message to read. Upon return, client can read the eth_msg_meta from start + * of buffer to find out type and length of message + * size of buffer supplied >= (size of largest message + size of metadata) + * + */ +struct eth_msg_meta { + __u8 msg_type; + __u8 rsvd; + __u16 msg_len; +}; + +#endif /* _UAPI_MSM_ETH_H_ */ diff --git a/include/uapi/linux/msm_ipa.h b/include/uapi/linux/msm_ipa.h index 6d86d7357807..c6c47e59ff4f 100644 --- a/include/uapi/linux/msm_ipa.h +++ b/include/uapi/linux/msm_ipa.h @@ -419,9 +419,12 @@ enum ipa_client_type { IPA_CLIENT_QDSS_PROD = 110, IPA_CLIENT_MHI_QDSS_CONS = 111, + + IPA_CLIENT_ETHERNET2_PROD = 112, + IPA_CLIENT_ETHERNET2_CONS = 113, }; -#define IPA_CLIENT_MAX (IPA_CLIENT_MHI_QDSS_CONS + 1) +#define IPA_CLIENT_MAX (IPA_CLIENT_ETHERNET2_CONS + 1) #define IPA_CLIENT_WLAN2_PROD IPA_CLIENT_A5_WLAN_AMPDU_PROD #define IPA_CLIENT_Q6_DL_NLO_DATA_PROD IPA_CLIENT_Q6_DL_NLO_DATA_PROD @@ -2342,13 +2345,17 @@ struct ipa_ioc_gsb_info { #define IPA_PCIE0_EP_ID 21 #define IPA_PCIE1_EP_ID 22 +#define IPA_ETH0_EP_ID 31 +#define IPA_ETH1_EP_ID 32 + enum ipa_peripheral_ep_type { IPA_DATA_EP_TYP_RESERVED = 0, IPA_DATA_EP_TYP_HSIC = 1, IPA_DATA_EP_TYP_HSUSB = 2, IPA_DATA_EP_TYP_PCIE = 3, IPA_DATA_EP_TYP_EMBEDDED = 4, - IPA_DATA_EP_TYP_BAM_DMUX, + IPA_DATA_EP_TYP_BAM_DMUX = 5, + IPA_DATA_EP_TYP_ETH, }; enum ipa_data_ep_prot_type { @@ -2844,12 +2851,14 @@ struct ipa_ioc_get_vlan_mode { * @vlan_id: vlan ID bridge is mapped to * @bridge_ipv4: bridge interface ipv4 address * @subnet_mask: bridge interface subnet mask + * @lan2lan_sw: indicate lan2lan traffic take sw-path or not */ struct ipa_ioc_bridge_vlan_mapping_info { char bridge_name[IPA_RESOURCE_NAME_MAX]; uint16_t vlan_id; uint32_t bridge_ipv4; uint32_t subnet_mask; + uint8_t lan2lan_sw; }; struct ipa_coalesce_info { diff --git a/init/Makefile b/init/Makefile index e5dd3192ed35..62d8be1cee07 100644 --- a/init/Makefile +++ b/init/Makefile @@ -19,6 +19,7 @@ mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o mounts-$(CONFIG_BLK_DEV_DM) += do_mounts_dm.o +mounts-$(CONFIG_BLK_DEV_DM) += do_mounts_verity.o # dependencies on generated files need to be listed explicitly $(obj)/version.o: include/generated/compile.h diff --git a/init/do_mounts.c b/init/do_mounts.c index 63c3591937cc..0a7a201d1810 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -658,6 +658,7 @@ void __init prepare_namespace(void) md_run_setup(); dm_run_setup(); + dm_verity_setup(); // Try to mount partition labeled "system" first ROOT_DEV = name_to_dev_t("PARTLABEL=system"); diff --git a/init/do_mounts.h b/init/do_mounts.h index cd201124714b..9dfd4138aca8 100644 --- a/init/do_mounts.h +++ b/init/do_mounts.h @@ -8,6 +8,8 @@ #include #include #include +#include "uapi/linux/dm-ioctl.h" +#include void change_floppy(char *fmt, ...); void mount_block_root(char *name, int flags); @@ -71,3 +73,15 @@ void dm_run_setup(void); static inline void dm_run_setup(void) {} #endif + +#ifdef CONFIG_BLK_DEV_DM + +void dm_verity_setup(void); +extern int dm_ioctrl(uint cmd, struct dm_ioctl *param); +extern void dm_table_destroy(struct dm_table *t); + +#else + +static inline void dm_verity_setup(void) {} + +#endif diff --git a/init/do_mounts_verity.c b/init/do_mounts_verity.c new file mode 100644 index 000000000000..5d7c8a2efec9 --- /dev/null +++ b/init/do_mounts_verity.c @@ -0,0 +1,285 @@ +/* Copyright (c) 2019, 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. + */ + +#include +#include +#include +#include "uapi/linux/dm-ioctl.h" +#include +#include +#include "do_mounts.h" + +#define DM_BUF_SIZE 4096 + +#define DM_MSG_PREFIX "verity" + +#define VERITY_COMMANDLINE_PARAM_LENGTH 32 +#define VERITY_ROOT_HASH_PARAM_LENGTH 65 +#define VERITY_SALT_PARAM_LENGTH 65 + +static char dm_name[VERITY_COMMANDLINE_PARAM_LENGTH]; +static char dm_version[VERITY_COMMANDLINE_PARAM_LENGTH]; +static char dm_data_device[VERITY_COMMANDLINE_PARAM_LENGTH]; +static char dm_hash_device[VERITY_COMMANDLINE_PARAM_LENGTH]; +static char dm_data_block_size[VERITY_COMMANDLINE_PARAM_LENGTH]; +static char dm_hash_block_size[VERITY_COMMANDLINE_PARAM_LENGTH]; +static char dm_number_of_data_blocks[VERITY_COMMANDLINE_PARAM_LENGTH]; +static char dm_hash_start_block[VERITY_COMMANDLINE_PARAM_LENGTH]; +static char dm_algorithm[VERITY_COMMANDLINE_PARAM_LENGTH]; +static char dm_digest[VERITY_ROOT_HASH_PARAM_LENGTH]; +static char dm_salt[VERITY_SALT_PARAM_LENGTH]; +static char dm_opt[VERITY_COMMANDLINE_PARAM_LENGTH]; + +static void __init init_param(struct dm_ioctl *param, const char *name) +{ + memset(param, 0, DM_BUF_SIZE); + param->data_size = DM_BUF_SIZE; + param->data_start = sizeof(struct dm_ioctl); + param->version[0] = 4; + param->version[1] = 0; + param->version[2] = 0; + param->flags = DM_READONLY_FLAG; + strlcpy(param->name, name, sizeof(param->name)); +} + +static int __init dm_name_param(char *line) +{ + strlcpy(dm_name, line, sizeof(dm_name)); + return 1; +} +__setup("dmname=", dm_name_param); + +static int __init dm_version_param(char *line) +{ + strlcpy(dm_version, line, sizeof(dm_version)); + return 1; +} +__setup("version=", dm_version_param); + +static int __init dm_data_device_param(char *line) +{ + strlcpy(dm_data_device, line, sizeof(dm_data_device)); + return 1; +} +__setup("data_device=", dm_data_device_param); + +static int __init dm_hash_device_param(char *line) +{ + strlcpy(dm_hash_device, line, sizeof(dm_hash_device)); + return 1; +} +__setup("hash_device=", dm_hash_device_param); + +static int __init dm_data_block_size_param(char *line) +{ + strlcpy(dm_data_block_size, line, sizeof(dm_data_block_size)); + return 1; +} +__setup("data_block_size=", dm_data_block_size_param); + +static int __init dm_hash_block_size_param(char *line) +{ + strlcpy(dm_hash_block_size, line, sizeof(dm_hash_block_size)); + return 1; +} +__setup("hash_block_size=", dm_hash_block_size_param); + +static int __init dm_number_of_data_blocks_param(char *line) +{ + strlcpy(dm_number_of_data_blocks, line, sizeof(dm_number_of_data_blocks)); + return 1; +} +__setup("number_of_data_blocks=", dm_number_of_data_blocks_param); + +static int __init dm_hash_start_block_param(char *line) +{ + strlcpy(dm_hash_start_block, line, sizeof(dm_hash_start_block)); + return 1; +} +__setup("hash_start_block=", dm_hash_start_block_param); + +static int __init dm_algorithm_param(char *line) +{ + strlcpy(dm_algorithm, line, sizeof(dm_algorithm)); + return 1; +} +__setup("algorithm=", dm_algorithm_param); + +static int __init dm_digest_param(char *line) +{ + strlcpy(dm_digest, line, sizeof(dm_digest)); + return 1; +} +__setup("digest=", dm_digest_param); + +static int __init dm_salt_param(char *line) +{ + strlcpy(dm_salt, line, sizeof(dm_salt)); + return 1; +} +__setup("salt=", dm_salt_param); + +static int __init dm_opt_param(char *line) +{ + strlcpy(dm_opt, line, sizeof(dm_opt)); + return 1; +} +__setup("opt=", dm_opt_param); + +static void __init dm_setup_drive(void) +{ + const char *name; + const char *version; + const char *data_device; + const char *hash_device; + const char *data_block_size; + const char *hash_block_size; + const char *number_of_data_blocks; + const char *hash_start_block; + const char *algorithm; + const char *digest; + const char *salt; + const char *opt; + unsigned long long data_blocks; + char dummy; + char *verity_params; + size_t bufsize; + char *buffer = kzalloc(DM_BUF_SIZE, GFP_KERNEL); + struct dm_ioctl *param = (struct dm_ioctl *) buffer; + size_t dm_sz = sizeof(struct dm_ioctl); + struct dm_target_spec *tgt = (struct dm_target_spec *) &buffer[dm_sz]; + + if (!buffer) + goto fail; + name = dm_name; + if (name == NULL) + goto fail; + DMDEBUG("(I) name=%s", name); + + if (strcmp(name, "disabled") == 0) { + pr_info("dm: dm-verity is disabled."); + kfree(buffer); + return; + } + + version = dm_version; + if (version == NULL) + goto fail; + DMDEBUG("(I) version=%s", version); + + data_device = dm_data_device; + if (data_device == NULL) + goto fail; + DMDEBUG("(I) data_device=%s", data_device); + + hash_device = dm_hash_device; + if (hash_device == NULL) + goto fail; + DMDEBUG("(I) hash_device=%s", hash_device); + + data_block_size = dm_data_block_size; + if (data_block_size == NULL) + goto fail; + DMDEBUG("(I) data_block_size=%s", data_block_size); + + hash_block_size = dm_hash_block_size; + if (hash_block_size == NULL) + goto fail; + DMDEBUG("(I) hash_block_size=%s", hash_block_size); + + number_of_data_blocks = dm_number_of_data_blocks; + if (number_of_data_blocks == NULL) + goto fail; + DMDEBUG("(I) number_of_data_blocks=%s", number_of_data_blocks); + + hash_start_block = dm_hash_start_block; + if (hash_start_block == NULL) + goto fail; + DMDEBUG("(I) hash_start_block=%s", hash_start_block); + + algorithm = dm_algorithm; + if (algorithm == NULL) + goto fail; + DMDEBUG("(I) algorithm=%s", algorithm); + + digest = dm_digest; + if (digest == NULL) + goto fail; + DMDEBUG("(I) digest=%s", digest); + + salt = dm_salt; + if (salt == NULL) + goto fail; + DMDEBUG("(I) salt=%s", salt); + + opt = dm_opt; + if (opt == NULL) + goto fail; + DMDEBUG("(I) opt=%s", opt); + + init_param(param, name); + if (dm_ioctrl(DM_DEV_CREATE_CMD, param)) { + DMERR("(E) failed to create the device"); + goto fail; + } + + init_param(param, name); + param->target_count = 1; + /* set tgt arguments */ + tgt->status = 0; + tgt->sector_start = 0; + if (sscanf(number_of_data_blocks, "%llu%c", &data_blocks, &dummy) != 1) { + DMERR("(E) invalid number of data blocks"); + goto fail; + } + + tgt->length = data_blocks*4096/512; /* size in sector(512b) of data dev */ + strlcpy(tgt->target_type, "verity", sizeof(tgt->target_type)); + /* build the verity params here */ + verity_params = buffer + sizeof(struct dm_ioctl) + sizeof(struct dm_target_spec); + bufsize = DM_BUF_SIZE - (verity_params - buffer); + + verity_params += snprintf(verity_params, bufsize, "%s %s %s %s %s %s %s %s %s %s 1 %s", + version, + data_device, hash_device, + data_block_size, hash_block_size, + number_of_data_blocks, hash_start_block, + algorithm, digest, salt, opt); + + tgt->next = verity_params - buffer; + if (dm_ioctrl(DM_TABLE_LOAD_CMD, param)) { + DMERR("(E) failed to load the device"); + goto fail; + } + + init_param(param, name); + if (dm_ioctrl(DM_DEV_SUSPEND_CMD, param)) { + DMERR("(E) failed to suspend the device"); + goto fail; + } + + pr_info("dm: dm-0 (%s) is ready", data_device); + kfree(buffer); + return; + +fail: + pr_info("dm: starting dm-0 failed"); + kfree(buffer); + return; + +} + +void __init dm_verity_setup(void) +{ + pr_info("dm: attempting early device configuration."); + dm_setup_drive(); +} diff --git a/kernel/sched/walt.c b/kernel/sched/walt.c index 53b5acb6bc32..407d4a8a47c0 100644 --- a/kernel/sched/walt.c +++ b/kernel/sched/walt.c @@ -2662,7 +2662,7 @@ static void transfer_busy_time(struct rq *rq, struct related_thread_group *grp, * Enable colocation and frequency aggregation for all threads in a process. * The children inherits the group id from the parent. */ -unsigned int __read_mostly sysctl_sched_coloc_downmigrate_ns = 400000000; +unsigned int __read_mostly sysctl_sched_coloc_downmigrate_ns; struct related_thread_group *related_thread_groups[MAX_NUM_CGROUP_COLOC_ID]; static LIST_HEAD(active_related_thread_groups); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index b4e966df0fa5..887a8b950179 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -457,7 +457,7 @@ static struct ctl_table kern_table[] = { .procname = "sched_coloc_downmigrate_ns", .data = &sysctl_sched_coloc_downmigrate_ns, .maxlen = sizeof(unsigned int), - .mode = 0444, + .mode = 0644, .proc_handler = proc_douintvec_minmax, }, { diff --git a/lib/string.c b/lib/string.c index fbfe0e1b27ae..c9fd2c59c30b 100644 --- a/lib/string.c +++ b/lib/string.c @@ -267,7 +267,30 @@ ssize_t strscpy_pad(char *dest, const char *src, size_t count) return written; } -EXPORT_SYMBOL(strscpy_pad); + +/** + * stpcpy - copy a string from src to dest returning a pointer to the new end + * of dest, including src's %NUL-terminator. May overrun dest. + * @dest: pointer to end of string being copied into. Must be large enough + * to receive copy. + * @src: pointer to the beginning of string being copied from. Must not overlap + * dest. + * + * stpcpy differs from strcpy in a key way: the return value is the new + * %NUL-terminated character. (for strcpy, the return value is a pointer to + * src. This interface is considered unsafe as it doesn't perform bounds + * checking of the inputs. As such it's not recommended for usage. Instead, + * its definition is provided in case the compiler lowers other libcalls to + * stpcpy. + */ +char *stpcpy(char *__restrict__ dest, const char *__restrict__ src); +char *stpcpy(char *__restrict__ dest, const char *__restrict__ src) +{ + while ((*dest++ = *src++) != '\0') + /* nothing */; + return --dest; +} +EXPORT_SYMBOL(stpcpy); #ifndef __HAVE_ARCH_STRCAT /** @@ -886,6 +909,26 @@ __visible int memcmp(const void *cs, const void *ct, size_t count) EXPORT_SYMBOL(memcmp); #endif +#ifndef __HAVE_ARCH_BCMP +/** + * bcmp - returns 0 if and only if the buffers have identical contents. + * @a: pointer to first buffer. + * @b: pointer to second buffer. + * @len: size of buffers. + * + * The sign or magnitude of a non-zero return value has no particular + * meaning, and architectures may implement their own more efficient bcmp(). So + * while this particular implementation is a simple (tail) call to memcmp, do + * not rely on anything but whether the return value is zero or non-zero. + */ +#undef bcmp +int bcmp(const void *a, const void *b, size_t len) +{ + return memcmp(a, b, len); +} +EXPORT_SYMBOL(bcmp); +#endif + #ifndef __HAVE_ARCH_MEMSCAN /** * memscan - Find a character in an area of memory. diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index 3db31bb9df50..b7fdcde35590 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c @@ -496,7 +496,7 @@ void ip_options_undo(struct ip_options *opt) if (opt->srr) { unsigned char *optptr = opt->__data+opt->srr-sizeof(struct iphdr); memmove(optptr+7, optptr+3, optptr[1]-7); - memcpy(optptr+3, &opt->faddr, 4); + memcpy(optptr+3, &opt->faddr, 0); } if (opt->rr_needaddr) { unsigned char *optptr = opt->__data+opt->rr-sizeof(struct iphdr); diff --git a/scripts/Makefile.build b/scripts/Makefile.build index dadc24989390..559d7bf30d8f 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -351,7 +351,7 @@ endef # List module undefined symbols (or empty line if not enabled) ifdef CONFIG_TRIM_UNUSED_KSYMS -cmd_undef_syms = $(NM) $@ | sed -n 's/^ \+U //p' | xargs echo +cmd_undef_syms = $(NM) $@ | sed -n 's/^ \+U //p' | sort -u | xargs echo else cmd_undef_syms = echo endif diff --git a/security/selinux/avc.c b/security/selinux/avc.c index bf84e966512c..31e6c0c9687a 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c @@ -757,6 +757,9 @@ static void avc_audit_pre_callback(struct audit_buffer *ab, void *a) static void avc_audit_post_callback(struct audit_buffer *ab, void *a) { struct common_audit_data *ad = a; + u32 scontext_len; + int rc; + audit_log_format(ab, " "); avc_dump_query(ab, ad->selinux_audit_data->state, ad->selinux_audit_data->ssid, diff --git a/security/selinux/include/classmap.h b/security/selinux/include/classmap.h index f11020511d0e..34631690b5f9 100644 --- a/security/selinux/include/classmap.h +++ b/security/selinux/include/classmap.h @@ -28,9 +28,9 @@ #define COMMON_CAP2_PERMS "mac_override", "mac_admin", "syslog", \ "wake_alarm", "block_suspend", "audit_read" -//#if CAP_LAST_CAP > CAP_AUDIT_READ -//#error New capability defined, please update COMMON_CAP2_PERMS. -//#endif +#if CAP_LAST_CAP > CAP_AUDIT_READ +#error New capability defined, please update COMMON_CAP2_PERMS. +#endif /* * Note: The name for any socket class should be suffixed by "socket", diff --git a/techpack/audio/asoc/codecs/tfa98xx/src/tfa98xx.c b/techpack/audio/asoc/codecs/tfa98xx/src/tfa98xx.c index c6bb4763e5b7..ff861ad08f09 100644 --- a/techpack/audio/asoc/codecs/tfa98xx/src/tfa98xx.c +++ b/techpack/audio/asoc/codecs/tfa98xx/src/tfa98xx.c @@ -3806,6 +3806,13 @@ static long tfa98xx_misc_device_control_ioctl(struct file *file, /* clear buffer and read livedata from dsp.*/ memset((char *)(&livedata[0]), 0x00, sizeof(livedata)); + /* read original memtrack data from device. */ + if (Tfa98xx_Error_Ok == tfa98xx_read_memtrack_data(tfa98xx, &livedata[0])) { + pr_debug("Device 0x%x read memtrack data sucessed.\n", tfa98xx->i2c->addr); + } else { + pr_err("Device 0x%x read memtrack data failed.\n", tfa98xx->i2c->addr); + } + /* copy data to user spcace. if copied is successed, will be returned actual size to user space. */ livedata_length_bytes = sizeof(int) * MEMTRACK_ITEM_MAX;