diff --git a/0001-HID-logitech-dj-Fix-forwarding-of-very-long-HID-repo.patch b/0001-HID-logitech-dj-Fix-forwarding-of-very-long-HID-repo.patch deleted file mode 100644 index 8c4f90c06..000000000 --- a/0001-HID-logitech-dj-Fix-forwarding-of-very-long-HID-repo.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 3b6df7e8130719b6bd83be241eb455f2aa862e9f Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Fri, 14 Jun 2019 09:28:32 +0200 -Subject: [PATCH] HID: logitech-dj: Fix forwarding of very long HID++ reports - -The HID++ spec also defines very long HID++ reports, with a reportid of -0x12. The MX5000 and MX5500 keyboards use 0x12 output reports for sending -messages to display on their buildin LCD. - -Userspace (libmx5000) supports this, in order for this to work when talking -to the HID devices instantiated for the keyboard by hid-logitech-dj, -we need to properly forward these reports to the device. - -This commit fixes logi_dj_ll_raw_request not forwarding these reports. - -Fixes: f2113c3020ef ("HID: logitech-dj: add support for Logitech Bluetooth Mini-Receiver") -Signed-off-by: Hans de Goede ---- - drivers/hid/hid-logitech-dj.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c -index 865b179d0a62..aedbe18182db 100644 ---- a/drivers/hid/hid-logitech-dj.c -+++ b/drivers/hid/hid-logitech-dj.c -@@ -30,6 +30,7 @@ - - #define REPORT_ID_HIDPP_SHORT 0x10 - #define REPORT_ID_HIDPP_LONG 0x11 -+#define REPORT_ID_HIDPP_VERY_LONG 0x12 - - #define HIDPP_REPORT_SHORT_LENGTH 7 - #define HIDPP_REPORT_LONG_LENGTH 20 -@@ -1242,7 +1243,8 @@ static int logi_dj_ll_raw_request(struct hid_device *hid, - int ret; - - if ((buf[0] == REPORT_ID_HIDPP_SHORT) || -- (buf[0] == REPORT_ID_HIDPP_LONG)) { -+ (buf[0] == REPORT_ID_HIDPP_LONG) || -+ (buf[0] == REPORT_ID_HIDPP_VERY_LONG)) { - if (count < 2) - return -EINVAL; - --- -2.21.0 - diff --git a/Revert-Bluetooth-Align-minimum-encryption-key-size.patch b/Revert-Bluetooth-Align-minimum-encryption-key-size.patch deleted file mode 100644 index 1318de32a..000000000 --- a/Revert-Bluetooth-Align-minimum-encryption-key-size.patch +++ /dev/null @@ -1,54 +0,0 @@ -From c8f57936ab21a1430ae2209fa874e842d13552d3 Mon Sep 17 00:00:00 2001 -From: Jeremy Cline -Date: Tue, 11 Jun 2019 14:59:23 +0000 -Subject: [PATCH] Revert "Bluetooth: Align minimum encryption key size for LE - and BR/EDR connections" - -This reverts commit d5bb334a8e171b262e48f378bd2096c0ea458265. - -This patch broke a number of older bluetooth devices and while an RFC -that fixes this patch has been posted upstream, it has not been merged -and there are still a few folks reporting problems. - -Signed-off-by: Jeremy Cline ---- - include/net/bluetooth/hci_core.h | 3 --- - net/bluetooth/hci_conn.c | 8 -------- - 2 files changed, 11 deletions(-) - -diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h -index 05b1b96f4d9e..094e61e07030 100644 ---- a/include/net/bluetooth/hci_core.h -+++ b/include/net/bluetooth/hci_core.h -@@ -190,9 +190,6 @@ struct adv_info { - - #define HCI_MAX_SHORT_NAME_LENGTH 10 - --/* Min encryption key size to match with SMP */ --#define HCI_MIN_ENC_KEY_SIZE 7 -- - /* Default LE RPA expiry time, 15 minutes */ - #define HCI_DEFAULT_RPA_TIMEOUT (15 * 60) - -diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c -index 3cf0764d5793..bd4978ce8c45 100644 ---- a/net/bluetooth/hci_conn.c -+++ b/net/bluetooth/hci_conn.c -@@ -1276,14 +1276,6 @@ int hci_conn_check_link_mode(struct hci_conn *conn) - !test_bit(HCI_CONN_ENCRYPT, &conn->flags)) - return 0; - -- /* The minimum encryption key size needs to be enforced by the -- * host stack before establishing any L2CAP connections. The -- * specification in theory allows a minimum of 1, but to align -- * BR/EDR and LE transports, a minimum of 7 is chosen. -- */ -- if (conn->enc_key_size < HCI_MIN_ENC_KEY_SIZE) -- return 0; -- - return 1; - } - --- -2.21.0 - diff --git a/arm64-acpi-ignore-5.1-fadts-reported-as-5.0.patch b/arm64-acpi-ignore-5.1-fadts-reported-as-5.0.patch new file mode 100644 index 000000000..6cf0ba926 --- /dev/null +++ b/arm64-acpi-ignore-5.1-fadts-reported-as-5.0.patch @@ -0,0 +1,41 @@ +From a7edc17544709d20f800dc0898096365a3d68613 Mon Sep 17 00:00:00 2001 +From: Ard Biesheuvel +Date: Sun, 2 Jun 2019 16:36:15 +0200 +Subject: [PATCH] acpi/arm64: ignore 5.1 FADTs that are reported as 5.0 + +Some Qualcomm Snapdragon based laptops built to run Microsoft Windows +are clearly ACPI 5.1 based, given that that is the first ACPI revision +that supports ARM, and introduced the FADT 'arm_boot_flags' field, +which has a non-zero field on those systems. + +So in these cases, infer from the ARM boot flags that the FADT must be +5.1 or later, and treat it as 5.1. + +Signed-off-by: Ard Biesheuvel +--- + arch/arm64/kernel/acpi.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c +index 803f0494dd3e3..7722e85fb69c3 100644 +--- a/arch/arm64/kernel/acpi.c ++++ b/arch/arm64/kernel/acpi.c +@@ -155,10 +155,14 @@ static int __init acpi_fadt_sanity_check(void) + */ + if (table->revision < 5 || + (table->revision == 5 && fadt->minor_revision < 1)) { +- pr_err("Unsupported FADT revision %d.%d, should be 5.1+\n", ++ pr_err(FW_BUG "Unsupported FADT revision %d.%d, should be 5.1+\n", + table->revision, fadt->minor_revision); +- ret = -EINVAL; +- goto out; ++ ++ if (!fadt->arm_boot_flags) { ++ ret = -EINVAL; ++ goto out; ++ } ++ pr_err("FADT has ARM boot flags set, assuming 5.1\n"); + } + + if (!(fadt->flags & ACPI_FADT_HW_REDUCED)) { + diff --git a/arm64-acpi-make-ac-and-battery-drivers-available-on-non-x86.patch b/arm64-acpi-make-ac-and-battery-drivers-available-on-non-x86.patch new file mode 100644 index 000000000..14e0eebf6 --- /dev/null +++ b/arm64-acpi-make-ac-and-battery-drivers-available-on-non-x86.patch @@ -0,0 +1,30 @@ +From 7b87bc98ab598ae40ef1818fb0c420d61dd87ed1 Mon Sep 17 00:00:00 2001 +From: Ard Biesheuvel +Date: Mon, 3 Jun 2019 08:37:11 +0200 +Subject: [PATCH] acpi: make AC and battery drivers available on !X86 + +Signed-off-by: Ard Biesheuvel +--- + drivers/acpi/Kconfig | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig +index e016f7a6ed136..3c8011e7b0d7c 100644 +--- a/drivers/acpi/Kconfig ++++ b/drivers/acpi/Kconfig +@@ -155,7 +155,6 @@ config ACPI_EC_DEBUGFS + + config ACPI_AC + tristate "AC Adapter" +- depends on X86 + select POWER_SUPPLY + default y + help +@@ -168,7 +167,6 @@ config ACPI_AC + + config ACPI_BATTERY + tristate "Battery" +- depends on X86 + select POWER_SUPPLY + default y + help diff --git a/arm64-dts-rockchip-Update-DWC3-modules-on-RK3399-SoCs.patch b/arm64-dts-rockchip-Update-DWC3-modules-on-RK3399-SoCs.patch new file mode 100644 index 000000000..c5ce675d4 --- /dev/null +++ b/arm64-dts-rockchip-Update-DWC3-modules-on-RK3399-SoCs.patch @@ -0,0 +1,145 @@ +From patchwork Thu Jun 13 16:27:45 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Enric Balletbo i Serra +X-Patchwork-Id: 10992783 +Return-Path: + +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C69976 + for ; + Thu, 13 Jun 2019 16:31:35 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A407202A5 + for ; + Thu, 13 Jun 2019 16:31:35 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id 1E11D205F8; Thu, 13 Jun 2019 16:31:35 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY + autolearn=ham version=3.3.1 +Received: from bombadil.infradead.org (bombadil.infradead.org + [198.137.202.133]) + (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E8E5E26253 + for ; + Thu, 13 Jun 2019 16:31:32 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20170209; h=Sender: + Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: + List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To + :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: + Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: + List-Owner; bh=DvpejaNT4eBhDns4FxJHLSG+zmWCjPWj3DUJGU1HA+0=; b=U5HR+BVOuAC/E8 + nFHo3NNnf/apQ+ctinRwRfb2KfTsAUb7ZUpIl54fuCw/9GaxhMVGPvViCELEYZSqU3In+Fo3+hP3s + kMyQxkFXCOuAawwfHbC5O/B5rW4mu3/wtmY6WU8/7j0+z295Xf6bcbL61ViJl004E6RRiw+o3AvsX + k5tb581Re61dLl+MWGJETzSUGZZl9OzPmwJiQ2MrQltCsHWXJM4Q+PjSa/figIf9yD8w3MUbDmtfX + Cj28FmfT2DfWi2kNlitMG7EqEvpPnc51G2u3JVUOnj1/C2UkRjWqMkbyLlzDAnqntyXFKePRDd2Uq + I2tA62mw1OY4IxFiP+Qw==; +Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) + id 1hbSdK-00080h-F1; Thu, 13 Jun 2019 16:31:26 +0000 +Received: from bhuna.collabora.co.uk ([46.235.227.227]) + by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) + id 1hbSZw-00036Y-Gr; Thu, 13 Jun 2019 16:27:58 +0000 +Received: from [127.0.0.1] (localhost [127.0.0.1]) + (Authenticated sender: eballetbo) with ESMTPSA id 2E34F27D7A1 +From: Enric Balletbo i Serra +To: devicetree@vger.kernel.org +Subject: [PATCH] arm64: dts: rockchip: Update DWC3 modules on RK3399 SoCs +Date: Thu, 13 Jun 2019 18:27:45 +0200 +Message-Id: <20190613162745.12195-1-enric.balletbo@collabora.com> +X-Mailer: git-send-email 2.20.1 +MIME-Version: 1.0 +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20190613_092756_843034_D5C41B2D +X-CRM114-Status: GOOD ( 10.09 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Cc: Mark Rutland , Heiko Stuebner , + Felipe Balbi , + linux-rockchip@lists.infradead.org, Tony Xie , + Viresh Kumar , Randy Li , + linux-kernel@vger.kernel.org, Vicente Bergas , + Masahiro Yamada , + Rob Herring , + Klaus Goger , + Matthias Brugger , + Collabora Kernel ML , + linux-arm-kernel@lists.infradead.org, + Christoph Muellner +Content-Type: text/plain; charset="us-ascii" +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org +X-Virus-Scanned: ClamAV using ClamSMTP + +As per binding documentation [1], the DWC3 core should have the "ref", +"bus_early" and "suspend" clocks. As explained in the binding, those +clocks are required for new platforms but not for existing platforms +before commit fe8abf332b8f ("usb: dwc3: support clocks and resets for +DWC3 core"). + +However, as those clocks are really treated as required, this ends with +having some annoying messages when the "rockchip,rk3399-dwc3" is used: + +[ 1.724107] dwc3 fe800000.dwc3: Failed to get clk 'ref': -2 +[ 1.731893] dwc3 fe900000.dwc3: Failed to get clk 'ref': -2 +[ 2.495937] dwc3 fe800000.dwc3: Failed to get clk 'ref': -2 +[ 2.647239] dwc3 fe900000.dwc3: Failed to get clk 'ref': -2 + +In order to remove those annoying messages, update the DWC3 hardware +module node and add all the required clocks. With this change, both, the +glue node and the DWC3 core node, have the clocks defined, but that's +not really a problem and there isn't a side effect on do this. So, we +can get rid of the annoying get clk error messages. + +[1] Documentation/devicetree/bindings/usb/dwc3.txt + +Signed-off-by: Enric Balletbo i Serra +--- + + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +index 196ac9b78076..a15348d185ce 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +@@ -414,6 +414,9 @@ + compatible = "snps,dwc3"; + reg = <0x0 0xfe800000 0x0 0x100000>; + interrupts = ; ++ clocks = <&cru SCLK_USB3OTG0_REF>, <&cru ACLK_USB3OTG0>, ++ <&cru SCLK_USB3OTG0_SUSPEND>; ++ clock-names = "ref", "bus_early", "suspend"; + dr_mode = "otg"; + phys = <&u2phy0_otg>, <&tcphy0_usb3>; + phy-names = "usb2-phy", "usb3-phy"; +@@ -447,6 +450,9 @@ + compatible = "snps,dwc3"; + reg = <0x0 0xfe900000 0x0 0x100000>; + interrupts = ; ++ clocks = <&cru SCLK_USB3OTG1_REF>, <&cru ACLK_USB3OTG1>, ++ <&cru SCLK_USB3OTG1_SUSPEND>; ++ clock-names = "ref", "bus_early", "suspend"; + dr_mode = "otg"; + phys = <&u2phy1_otg>, <&tcphy1_usb3>; + phy-names = "usb2-phy", "usb3-phy"; diff --git a/arm64-qcom-DWC3-USB-Add-support-for-ACPI-based-AArch64-Laptops.patch b/arm64-qcom-DWC3-USB-Add-support-for-ACPI-based-AArch64-Laptops.patch new file mode 100644 index 000000000..ece8d7af4 --- /dev/null +++ b/arm64-qcom-DWC3-USB-Add-support-for-ACPI-based-AArch64-Laptops.patch @@ -0,0 +1,1002 @@ +From patchwork Mon Jun 17 12:51:02 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Lee Jones +X-Patchwork-Id: 10999157 +Return-Path: + +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7F1314BB + for ; + Mon, 17 Jun 2019 12:51:26 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8630286B3 + for ; + Mon, 17 Jun 2019 12:51:26 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id A691B286B8; Mon, 17 Jun 2019 12:51:26 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 +Received: from bombadil.infradead.org (bombadil.infradead.org + [198.137.202.133]) + (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0AC2128910 + for ; + Mon, 17 Jun 2019 12:51:25 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20170209; h=Sender: + Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: + List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: + In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: + Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc + :Resent-Message-ID:List-Owner; + bh=hzd/ICcUtJ+qnY0TkQdQ/iqHchKimp0FpVwcGtPGgc4=; b=gs1Cboo2h8ZzR/erqYcUplo5Zl + kriLADbQY4FHKFwsCNhA8pnzI2v6O+vkVQvT8LacdXPkoTeBZ+HbujdKRUkqmjKPMYtG0Q3onvHQc + XcSThhrpJSJbDPR+e4SsBF5KOuTrXtDCUy4TIHAXVOQKow1tnieYvX17S9R5eZ96zdiG5mphR24fC + IQRF58TLVlspAu6KbO4vGgvef7A+R7rld5MmyzefOvmg5X1OAmBHLaI0Ifg0fpc2ihfyeQgjQaF9H + Sl4mE20tulm2qqwgB4o2Lu6EvLVO1OqwBZbV62O8lkUZQhB6YYo2tqAX6GaBkNEkADEhAxsYEiO7i + +T+ewIAw==; +Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) + id 1hcr6a-0004ri-Gm; Mon, 17 Jun 2019 12:51:24 +0000 +Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) + by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) + id 1hcr6N-0004gG-5m + for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2019 12:51:12 +0000 +Received: by mail-wr1-x444.google.com with SMTP id f9so9772453wre.12 + for ; + Mon, 17 Jun 2019 05:51:10 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=2zuxNNJ4iuFL5CUgXXBK/C8GK/Wfm+gcHDg2NkvAFB8=; + b=q+s/96q0GvL81bpISKq1BYq2qgGMpiINLYY94rSfeJIBgtJ0JASEtiXtDPecNFmtZL + IVM+FA8aky8PBmnMLL4+Kt0aJ3tCYdUb9UEdfNN6lMqZIm32xgDsGAGZEN75E5BGglZ5 + O0qHpPxDxjps+O6mgY7ewWjzgrArHawuVqm5pgALhFmzbvj/vTigwdNoWTRq+QYjzbQW + X4PP0kzs+r42vn1y/uQP2HCx+p4e6qaylctjsm4b3GGzN1UOWC+lSwN5UNNB59hZ9phn + mt8/uuVdLmFh2bLj3JPXGKXcTYEITepZw7iCLKx8El0VEXOnDiwDYGwUZY8bVg2fGUtk + a2Ig== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20161025; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references; + bh=2zuxNNJ4iuFL5CUgXXBK/C8GK/Wfm+gcHDg2NkvAFB8=; + b=oEWv7zocZKRfTgHf4lf/nnyVbj27HULH3eZBiAvukYZEy5p/04tKCn2xcjT0OupDq1 + JtpVjK45a/MT9EP3Q/pSczzpTAIukOZW8LSC0ZXb4h4JQBT/ujIaD6DvM2wwlDk1WJeh + hkzOO9qchV2sFB+hwWHCmWYkYfZ8ho6MPHJTnBG50J4aG03XZf8/wecsAZ3u97yuREXb + qgUDKvDB5WfS+Zu6k0IsITnMONtutyCaWI1xZ1I7tuVxYkROxaUG9L7ihFnaZL74UCuB + C+Hc6U8HY+y/m86LFHP76m6tpOxuUfZARSlzOkmGi/4QPMReV54qtbTGEX2NeRxAPd1d + OIDA== +X-Gm-Message-State: APjAAAU8mxXZGAfxADTLzRLiH5CIXMt9t7Nr3DoYsZO8CGVoMOXu7BYs + OGDCo19OAKar6a7vPcigSgL5yA== +X-Google-Smtp-Source: + APXvYqxQmsT3xz0CBZrCiSA472UgfglVRfGZm5u9OAQIPSBLxsX3r/VA44xZ+WxLMb03U8CAncn0Ag== +X-Received: by 2002:a5d:6050:: with SMTP id j16mr6799737wrt.20.1560775869586; + Mon, 17 Jun 2019 05:51:09 -0700 (PDT) +Received: from dell.watershed.co.uk ([2.27.35.243]) + by smtp.gmail.com with ESMTPSA id o11sm10477852wmh.37.2019.06.17.05.51.08 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Mon, 17 Jun 2019 05:51:09 -0700 (PDT) +From: Lee Jones +To: alokc@codeaurora.org, agross@kernel.org, david.brown@linaro.org, + bjorn.andersson@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org, + ard.biesheuvel@linaro.org, jlhugo@gmail.com, linux-arm-msm@vger.kernel.org, + linux-usb@vger.kernel.org, felipe.balbi@linux.intel.com +Subject: [RESEND v4 1/4] soc: qcom: geni: Add support for ACPI +Date: Mon, 17 Jun 2019 13:51:02 +0100 +Message-Id: <20190617125105.6186-2-lee.jones@linaro.org> +X-Mailer: git-send-email 2.17.1 +In-Reply-To: <20190617125105.6186-1-lee.jones@linaro.org> +References: <20190617125105.6186-1-lee.jones@linaro.org> +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20190617_055111_214407_390679F0 +X-CRM114-Status: GOOD ( 13.52 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Cc: Lee Jones , linux-kernel@vger.kernel.org, + linux-arm-kernel@lists.infradead.org +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org +X-Virus-Scanned: ClamAV using ClamSMTP + +When booting with ACPI as the active set of configuration tables, +all; clocks, regulators, pin functions ect are expected to be at +their ideal values/levels/rates, thus the associated frameworks +are unavailable. Ensure calls to these APIs are shielded when +ACPI is enabled. + +Signed-off-by: Lee Jones +Acked-by: Ard Biesheuvel +--- + drivers/soc/qcom/qcom-geni-se.c | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c +index 6b8ef01472e9..d5cf953b4337 100644 +--- a/drivers/soc/qcom/qcom-geni-se.c ++++ b/drivers/soc/qcom/qcom-geni-se.c +@@ -1,6 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 + // Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. + ++#include + #include + #include + #include +@@ -450,6 +451,9 @@ int geni_se_resources_off(struct geni_se *se) + { + int ret; + ++ if (has_acpi_companion(se->dev)) ++ return 0; ++ + ret = pinctrl_pm_select_sleep_state(se->dev); + if (ret) + return ret; +@@ -487,6 +491,9 @@ int geni_se_resources_on(struct geni_se *se) + { + int ret; + ++ if (has_acpi_companion(se->dev)) ++ return 0; ++ + ret = geni_se_clks_on(se); + if (ret) + return ret; +@@ -724,12 +731,14 @@ static int geni_se_probe(struct platform_device *pdev) + if (IS_ERR(wrapper->base)) + return PTR_ERR(wrapper->base); + +- wrapper->ahb_clks[0].id = "m-ahb"; +- wrapper->ahb_clks[1].id = "s-ahb"; +- ret = devm_clk_bulk_get(dev, NUM_AHB_CLKS, wrapper->ahb_clks); +- if (ret) { +- dev_err(dev, "Err getting AHB clks %d\n", ret); +- return ret; ++ if (!has_acpi_companion(&pdev->dev)) { ++ wrapper->ahb_clks[0].id = "m-ahb"; ++ wrapper->ahb_clks[1].id = "s-ahb"; ++ ret = devm_clk_bulk_get(dev, NUM_AHB_CLKS, wrapper->ahb_clks); ++ if (ret) { ++ dev_err(dev, "Err getting AHB clks %d\n", ret); ++ return ret; ++ } + } + + dev_set_drvdata(dev, wrapper); + +From patchwork Mon Jun 17 12:51:03 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Lee Jones +X-Patchwork-Id: 10999167 +Return-Path: + +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1A4214BB + for ; + Mon, 17 Jun 2019 12:51:48 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D06A5286E6 + for ; + Mon, 17 Jun 2019 12:51:48 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id C4C772871F; Mon, 17 Jun 2019 12:51:48 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable + version=3.3.1 +Received: from bombadil.infradead.org (bombadil.infradead.org + [198.137.202.133]) + (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D3C9228606 + for ; + Mon, 17 Jun 2019 12:51:47 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20170209; h=Sender: + Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: + List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: + In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: + Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc + :Resent-Message-ID:List-Owner; + bh=eqPeWeTSDW4tiMKnyJbFGfuUug/NP8BBhk/eXQMhuTs=; b=I7CwybOukEfOb8t13TjIrgAV4y + 4tH7lG3nM0NXHmiucaIDp4bKD5ly5m7WWzGSIEkg7/U4+EQjpiVd+H3sSH5wmvTRJ/y5J8eRrbiIg + DBauCWtmaNnCtHgysxinvyab3cb0ZdRkIKojvbFM9/rA7CNIN22US4++LPC5rDg2FcGknTRyIFaiG + rdLXD9yxEYf7K9xhxwIegcc6Zn2ZUOrjzYBt6+fxj85Gx0TWgBdfAGZFl8r+AF8HCXWaNiZjUQlav + eZlT6gbr5k/zdCU9/en4cY4fFIdULxg/C5EOMbqV+T9ce52uMt6YrMIeQ+3asgZROgxfua0gGWZ5V + cQOaQgWQ==; +Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) + id 1hcr6w-0005AV-Te; Mon, 17 Jun 2019 12:51:46 +0000 +Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) + by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) + id 1hcr6O-0004gf-45 + for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2019 12:51:13 +0000 +Received: by mail-wr1-x441.google.com with SMTP id f9so9772521wre.12 + for ; + Mon, 17 Jun 2019 05:51:11 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=ZYares2Zb0CMG5aj1Aq17AxyznnInv9luLnQDrDhVlk=; + b=r5dCfxbvH3U5b5C4s33cPxDL1vD/tiW6V96ulvZngp0n/hqT3oktaEclOpyvDC+R58 + SUfga9aWqbblZtMjr1jj22q46oZc0+qKFJJy1aIwr4ioiZXw8JKRWjnzTglMlhSmvRNj + FVCMZY11tsUacCETtgDReiUPN8Om7954wN6SXEkjDtExGnUmuVdTekdpD4US9VRnT5QK + i9DLIIfQpyKMQ7VZs5zCI/sBlpMqVBcEZB+9OtVbGIefAMiOnHCEX5mS3c7uu2R1dWb5 + ggotZKzJpFMA5Mmyzcjj0yPYPWAlMpFx7OZ+P1ZMGP9dwu1u4tj4YPT/IVry3dFV/Yv8 + YuZQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20161025; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references; + bh=ZYares2Zb0CMG5aj1Aq17AxyznnInv9luLnQDrDhVlk=; + b=PNg7mntx38NTDxi7cw63EQergFuUJW0s/McRf3KqBgZn60Dr6RjLQ9Pr+hTVheXOj1 + Yx2COODJLvl0fBxu1/yBZkuPtXxp2p+ASg4+MbAMMcyrkvgpQ6BId0qMtAX6yTIx0Bll + sggfQhYcHrGp8EfLBW2RQws5V9Emp2WzZtyjNXzOD4DpDKV3YAI+j4sHusXrwa5xEu2N + eGDXG2Mt/icgywLN3k97OmLea06sFRlYf7KYZRxcfE2R6GP522NSHZzNYoJkqgZsBi3Z + 2TdYKdw0o9cJHRI2OiapUQ08YLIv0BSmAJaVSPbxEjqa/tn57ty3h+ni5R4lbPEwaGAi + pZog== +X-Gm-Message-State: APjAAAVU7/rtL+UwLWfEM6vsQiiKLK8VD/zwoFn1P33esVlYh5EU2pqr + reXEg1fc4ji+BKvEjq+M3I+eFA== +X-Google-Smtp-Source: + APXvYqw4tU4zKvNxRkTtQHBbmrMwW6oDHDoXraOjSJrJg7Vgc+uuvKDECbAHi2x2yB80DzNCJv6ODQ== +X-Received: by 2002:a5d:5386:: with SMTP id d6mr24077969wrv.207.1560775870686; + Mon, 17 Jun 2019 05:51:10 -0700 (PDT) +Received: from dell.watershed.co.uk ([2.27.35.243]) + by smtp.gmail.com with ESMTPSA id o11sm10477852wmh.37.2019.06.17.05.51.09 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Mon, 17 Jun 2019 05:51:10 -0700 (PDT) +From: Lee Jones +To: alokc@codeaurora.org, agross@kernel.org, david.brown@linaro.org, + bjorn.andersson@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org, + ard.biesheuvel@linaro.org, jlhugo@gmail.com, linux-arm-msm@vger.kernel.org, + linux-usb@vger.kernel.org, felipe.balbi@linux.intel.com +Subject: [RESEND v4 2/4] usb: dwc3: qcom: Add support for booting with ACPI +Date: Mon, 17 Jun 2019 13:51:03 +0100 +Message-Id: <20190617125105.6186-3-lee.jones@linaro.org> +X-Mailer: git-send-email 2.17.1 +In-Reply-To: <20190617125105.6186-1-lee.jones@linaro.org> +References: <20190617125105.6186-1-lee.jones@linaro.org> +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20190617_055112_164384_7E92DD4C +X-CRM114-Status: GOOD ( 21.26 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Cc: Lee Jones , linux-kernel@vger.kernel.org, + linux-arm-kernel@lists.infradead.org +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org +X-Virus-Scanned: ClamAV using ClamSMTP + +In Linux, the DWC3 core exists as its own independent platform device. +Thus when describing relationships in Device Tree, the current default +boot configuration table option, the DWC3 core often resides as a child +of the platform specific node. Both of which are given their own +address space descriptions and the drivers can be mostly agnostic to +each other. + +However, other Operating Systems have taken a more monolithic approach, +which is evident in the configuration ACPI tables for the Qualcomm +Snapdragon SDM850, where all DWC3 (core and platform) components are +described under a single IO memory region. + +To ensure successful booting using the supplied ACPI tables, we need to +devise a way to chop up the address regions provided and subsequently +register the DWC3 core with the resultant information, which is +precisely what this patch aims to achieve. + +Signed-off-by: Lee Jones +Reviewed-by: Bjorn Andersson +--- + drivers/usb/dwc3/Kconfig | 2 +- + drivers/usb/dwc3/dwc3-qcom.c | 206 ++++++++++++++++++++++++++++++----- + 2 files changed, 179 insertions(+), 29 deletions(-) + +diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig +index 4a62045cc812..89abc6078703 100644 +--- a/drivers/usb/dwc3/Kconfig ++++ b/drivers/usb/dwc3/Kconfig +@@ -128,7 +128,7 @@ config USB_DWC3_QCOM + tristate "Qualcomm Platform" + depends on ARCH_QCOM || COMPILE_TEST + depends on EXTCON || !EXTCON +- depends on OF ++ depends on (OF || ACPI) + default USB_DWC3 + help + Some Qualcomm SoCs use DesignWare Core IP for USB2/3 +diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c +index 184df4daa590..0cb63f6c92d9 100644 +--- a/drivers/usb/dwc3/dwc3-qcom.c ++++ b/drivers/usb/dwc3/dwc3-qcom.c +@@ -4,6 +4,7 @@ + * Inspired by dwc3-of-simple.c + */ + ++#include + #include + #include + #include +@@ -38,6 +39,20 @@ + #define PWR_EVNT_LPM_IN_L2_MASK BIT(4) + #define PWR_EVNT_LPM_OUT_L2_MASK BIT(5) + ++#define SDM845_QSCRATCH_BASE_OFFSET 0xf8800 ++#define SDM845_QSCRATCH_SIZE 0x400 ++#define SDM845_DWC3_CORE_SIZE 0xcd00 ++ ++struct dwc3_acpi_pdata { ++ u32 qscratch_base_offset; ++ u32 qscratch_base_size; ++ u32 dwc3_core_base_size; ++ int hs_phy_irq_index; ++ int dp_hs_phy_irq_index; ++ int dm_hs_phy_irq_index; ++ int ss_phy_irq_index; ++}; ++ + struct dwc3_qcom { + struct device *dev; + void __iomem *qscratch_base; +@@ -56,6 +71,8 @@ struct dwc3_qcom { + struct notifier_block vbus_nb; + struct notifier_block host_nb; + ++ const struct dwc3_acpi_pdata *acpi_pdata; ++ + enum usb_dr_mode mode; + bool is_suspended; + bool pm_suspended; +@@ -300,12 +317,27 @@ static void dwc3_qcom_select_utmi_clk(struct dwc3_qcom *qcom) + PIPE_UTMI_CLK_DIS); + } + ++static int dwc3_qcom_get_irq(struct platform_device *pdev, ++ const char *name, int num) ++{ ++ struct device_node *np = pdev->dev.of_node; ++ int ret; ++ ++ if (np) ++ ret = platform_get_irq_byname(pdev, name); ++ else ++ ret = platform_get_irq(pdev, num); ++ ++ return ret; ++} ++ + static int dwc3_qcom_setup_irq(struct platform_device *pdev) + { + struct dwc3_qcom *qcom = platform_get_drvdata(pdev); ++ const struct dwc3_acpi_pdata *pdata = qcom->acpi_pdata; + int irq, ret; +- +- irq = platform_get_irq_byname(pdev, "hs_phy_irq"); ++ irq = dwc3_qcom_get_irq(pdev, "hs_phy_irq", ++ pdata ? pdata->hs_phy_irq_index : -1); + if (irq > 0) { + /* Keep wakeup interrupts disabled until suspend */ + irq_set_status_flags(irq, IRQ_NOAUTOEN); +@@ -320,7 +352,8 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) + qcom->hs_phy_irq = irq; + } + +- irq = platform_get_irq_byname(pdev, "dp_hs_phy_irq"); ++ irq = dwc3_qcom_get_irq(pdev, "dp_hs_phy_irq", ++ pdata ? pdata->dp_hs_phy_irq_index : -1); + if (irq > 0) { + irq_set_status_flags(irq, IRQ_NOAUTOEN); + ret = devm_request_threaded_irq(qcom->dev, irq, NULL, +@@ -334,7 +367,8 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) + qcom->dp_hs_phy_irq = irq; + } + +- irq = platform_get_irq_byname(pdev, "dm_hs_phy_irq"); ++ irq = dwc3_qcom_get_irq(pdev, "dm_hs_phy_irq", ++ pdata ? pdata->dm_hs_phy_irq_index : -1); + if (irq > 0) { + irq_set_status_flags(irq, IRQ_NOAUTOEN); + ret = devm_request_threaded_irq(qcom->dev, irq, NULL, +@@ -348,7 +382,8 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) + qcom->dm_hs_phy_irq = irq; + } + +- irq = platform_get_irq_byname(pdev, "ss_phy_irq"); ++ irq = dwc3_qcom_get_irq(pdev, "ss_phy_irq", ++ pdata ? pdata->ss_phy_irq_index : -1); + if (irq > 0) { + irq_set_status_flags(irq, IRQ_NOAUTOEN); + ret = devm_request_threaded_irq(qcom->dev, irq, NULL, +@@ -371,11 +406,11 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count) + struct device_node *np = dev->of_node; + int i; + +- qcom->num_clocks = count; +- +- if (!count) ++ if (!np || !count) + return 0; + ++ qcom->num_clocks = count; ++ + qcom->clks = devm_kcalloc(dev, qcom->num_clocks, + sizeof(struct clk *), GFP_KERNEL); + if (!qcom->clks) +@@ -409,12 +444,103 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count) + return 0; + } + +-static int dwc3_qcom_probe(struct platform_device *pdev) ++static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) + { ++ struct dwc3_qcom *qcom = platform_get_drvdata(pdev); ++ struct device *dev = &pdev->dev; ++ struct resource *res, *child_res = NULL; ++ int irq; ++ int ret; ++ ++ qcom->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); ++ if (!qcom->dwc3) ++ return -ENOMEM; ++ ++ qcom->dwc3->dev.parent = dev; ++ qcom->dwc3->dev.type = dev->type; ++ qcom->dwc3->dev.dma_mask = dev->dma_mask; ++ qcom->dwc3->dev.dma_parms = dev->dma_parms; ++ qcom->dwc3->dev.coherent_dma_mask = dev->coherent_dma_mask; ++ ++ child_res = kcalloc(2, sizeof(*child_res), GFP_KERNEL); ++ if (!child_res) ++ return -ENOMEM; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) { ++ dev_err(&pdev->dev, "failed to get memory resource\n"); ++ ret = -ENODEV; ++ goto out; ++ } ++ ++ child_res[0].flags = res->flags; ++ child_res[0].start = res->start; ++ child_res[0].end = child_res[0].start + ++ qcom->acpi_pdata->dwc3_core_base_size; ++ ++ irq = platform_get_irq(pdev, 0); ++ child_res[1].flags = IORESOURCE_IRQ; ++ child_res[1].start = child_res[1].end = irq; ++ ++ ret = platform_device_add_resources(qcom->dwc3, child_res, 2); ++ if (ret) { ++ dev_err(&pdev->dev, "failed to add resources\n"); ++ goto out; ++ } ++ ++ ret = platform_device_add(qcom->dwc3); ++ if (ret) ++ dev_err(&pdev->dev, "failed to add device\n"); ++ ++out: ++ kfree(child_res); ++ return ret; ++} ++ ++static int dwc3_qcom_of_register_core(struct platform_device *pdev) ++{ ++ struct dwc3_qcom *qcom = platform_get_drvdata(pdev); + struct device_node *np = pdev->dev.of_node, *dwc3_np; + struct device *dev = &pdev->dev; ++ int ret; ++ ++ dwc3_np = of_get_child_by_name(np, "dwc3"); ++ if (!dwc3_np) { ++ dev_err(dev, "failed to find dwc3 core child\n"); ++ return -ENODEV; ++ } ++ ++ ret = of_platform_populate(np, NULL, NULL, dev); ++ if (ret) { ++ dev_err(dev, "failed to register dwc3 core - %d\n", ret); ++ return ret; ++ } ++ ++ qcom->dwc3 = of_find_device_by_node(dwc3_np); ++ if (!qcom->dwc3) { ++ dev_err(dev, "failed to get dwc3 platform device\n"); ++ return -ENODEV; ++ } ++ ++ return 0; ++} ++ ++static const struct dwc3_acpi_pdata sdm845_acpi_pdata = { ++ .qscratch_base_offset = SDM845_QSCRATCH_BASE_OFFSET, ++ .qscratch_base_size = SDM845_QSCRATCH_SIZE, ++ .dwc3_core_base_size = SDM845_DWC3_CORE_SIZE, ++ .hs_phy_irq_index = 1, ++ .dp_hs_phy_irq_index = 4, ++ .dm_hs_phy_irq_index = 3, ++ .ss_phy_irq_index = 2 ++}; ++ ++static int dwc3_qcom_probe(struct platform_device *pdev) ++{ ++ struct device_node *np = pdev->dev.of_node; ++ struct device *dev = &pdev->dev; + struct dwc3_qcom *qcom; +- struct resource *res; ++ struct resource *res, *parent_res = NULL; + int ret, i; + bool ignore_pipe_clk; + +@@ -425,6 +551,14 @@ static int dwc3_qcom_probe(struct platform_device *pdev) + platform_set_drvdata(pdev, qcom); + qcom->dev = &pdev->dev; + ++ if (has_acpi_companion(dev)) { ++ qcom->acpi_pdata = acpi_device_get_match_data(dev); ++ if (!qcom->acpi_pdata) { ++ dev_err(&pdev->dev, "no supporting ACPI device data\n"); ++ return -EINVAL; ++ } ++ } ++ + qcom->resets = devm_reset_control_array_get_optional_exclusive(dev); + if (IS_ERR(qcom->resets)) { + ret = PTR_ERR(qcom->resets); +@@ -454,7 +588,21 @@ static int dwc3_qcom_probe(struct platform_device *pdev) + } + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- qcom->qscratch_base = devm_ioremap_resource(dev, res); ++ ++ if (np) { ++ parent_res = res; ++ } else { ++ parent_res = kmemdup(res, sizeof(struct resource), GFP_KERNEL); ++ if (!parent_res) ++ return -ENOMEM; ++ ++ parent_res->start = res->start + ++ qcom->acpi_pdata->qscratch_base_offset; ++ parent_res->end = parent_res->start + ++ qcom->acpi_pdata->qscratch_base_size; ++ } ++ ++ qcom->qscratch_base = devm_ioremap_resource(dev, parent_res); + if (IS_ERR(qcom->qscratch_base)) { + dev_err(dev, "failed to map qscratch, err=%d\n", ret); + ret = PTR_ERR(qcom->qscratch_base); +@@ -462,13 +610,8 @@ static int dwc3_qcom_probe(struct platform_device *pdev) + } + + ret = dwc3_qcom_setup_irq(pdev); +- if (ret) +- goto clk_disable; +- +- dwc3_np = of_get_child_by_name(np, "dwc3"); +- if (!dwc3_np) { +- dev_err(dev, "failed to find dwc3 core child\n"); +- ret = -ENODEV; ++ if (ret) { ++ dev_err(dev, "failed to setup IRQs, err=%d\n", ret); + goto clk_disable; + } + +@@ -481,16 +624,13 @@ static int dwc3_qcom_probe(struct platform_device *pdev) + if (ignore_pipe_clk) + dwc3_qcom_select_utmi_clk(qcom); + +- ret = of_platform_populate(np, NULL, NULL, dev); +- if (ret) { +- dev_err(dev, "failed to register dwc3 core - %d\n", ret); +- goto clk_disable; +- } ++ if (np) ++ ret = dwc3_qcom_of_register_core(pdev); ++ else ++ ret = dwc3_qcom_acpi_register_core(pdev); + +- qcom->dwc3 = of_find_device_by_node(dwc3_np); +- if (!qcom->dwc3) { +- dev_err(&pdev->dev, "failed to get dwc3 platform device\n"); +- ret = -ENODEV; ++ if (ret) { ++ dev_err(dev, "failed to register DWC3 Core, err=%d\n", ret); + goto depopulate; + } + +@@ -514,7 +654,10 @@ static int dwc3_qcom_probe(struct platform_device *pdev) + return 0; + + depopulate: +- of_platform_depopulate(&pdev->dev); ++ if (np) ++ of_platform_depopulate(&pdev->dev); ++ else ++ platform_device_put(pdev); + clk_disable: + for (i = qcom->num_clocks - 1; i >= 0; i--) { + clk_disable_unprepare(qcom->clks[i]); +@@ -601,6 +744,12 @@ static const struct of_device_id dwc3_qcom_of_match[] = { + }; + MODULE_DEVICE_TABLE(of, dwc3_qcom_of_match); + ++static const struct acpi_device_id dwc3_qcom_acpi_match[] = { ++ { "QCOM2430", (unsigned long)&sdm845_acpi_pdata }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(acpi, dwc3_qcom_acpi_match); ++ + static struct platform_driver dwc3_qcom_driver = { + .probe = dwc3_qcom_probe, + .remove = dwc3_qcom_remove, +@@ -608,6 +757,7 @@ static struct platform_driver dwc3_qcom_driver = { + .name = "dwc3-qcom", + .pm = &dwc3_qcom_dev_pm_ops, + .of_match_table = dwc3_qcom_of_match, ++ .acpi_match_table = ACPI_PTR(dwc3_qcom_acpi_match), + }, + }; + + +From patchwork Mon Jun 17 12:51:04 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Lee Jones +X-Patchwork-Id: 10999169 +Return-Path: + +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 59E436C5 + for ; + Mon, 17 Jun 2019 12:52:08 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49F6328720 + for ; + Mon, 17 Jun 2019 12:52:08 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id 484D828732; Mon, 17 Jun 2019 12:52:08 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable + version=3.3.1 +Received: from bombadil.infradead.org (bombadil.infradead.org + [198.137.202.133]) + (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B78822890E + for ; + Mon, 17 Jun 2019 12:52:07 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20170209; h=Sender: + Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: + List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: + In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: + Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc + :Resent-Message-ID:List-Owner; + bh=1QkFuxjOpyjnOEy2zHsXiVzRtFfJL6FqwyIAZ/9Gut4=; b=YA60sPqjbq2iXlOMXN9dmLURcq + Iz4na+d1NKhZtuP2CUDdAaStGbSSjVhK/os6IjlrZc7p41R8M579EqZ0HVEK4qz82WE/sZ1N8aCZx + Ruo85uuR/oV66KjW9Hv4ZEVoyqvrAwW0icnAN0s120v2oKHZOp4ALV0ZmFH3qplK8XWT0lEYbYhht + YKnq8wuLXiUk8EOTPK53ZAz9Ng8HO6EwyiWt+Et7LBSGHdJu0mTcXlCu2IZu8ojX8mDLaq+gbOdkV + RSimIoT8eRaC2kw3zEucerZPiH2j1UuTnfkZ1FKC6k/Y8Z/Xsdudz2ZZiRzFIk1huxmS8WpD+W/Fk + j6DSjSxQ==; +Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) + id 1hcr79-0005Pa-Na; Mon, 17 Jun 2019 12:51:59 +0000 +Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) + by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) + id 1hcr6O-0004gy-U8 + for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2019 12:51:14 +0000 +Received: by mail-wr1-x441.google.com with SMTP id x4so9820359wrt.6 + for ; + Mon, 17 Jun 2019 05:51:12 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=2C6MxhIF9Gjdvx3J9DYd/48/Suqux1auzpg7O20+XA4=; + b=MHuiL6Hd66D8KM0jn4ls2iBDOBivmXgGCkd0bRuw3BVISYThbeIBV65YPTVnC9S5pN + 8kwD7l1LeRLhShtYuu/Ido0JQEJeak94CdUos+d7lXijbpc7lq70fcnle30NFz0tcJIj + fAbhj9eIhnoDKlZtfNVWfkzOAx8xp0EuIZ9g38860fnnolOIibyFhNmFCQEOV3JsQtou + UjFRWCn0iZbk4TdcLNFh4kMAKOur21h0NofVuZCw5wYBD3SEo5yr15DOn4ZrA5obTtoT + wSTQGINMn3kmRWVRTFv5WxMKEdA0kEwajLFNzSkDL3ycCAfLXhvSJF2ZlVcb1F43lutn + H4ew== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20161025; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references; + bh=2C6MxhIF9Gjdvx3J9DYd/48/Suqux1auzpg7O20+XA4=; + b=g5oKdVRTACrVlNT9mDlepCqDm/U02p2CeTx7OdqMmBixU2mjAXvsMj+XahOxs5uFsO + Pl3GHa55jW2odCnqU9VxRpCVhjxno2vhx6tg+PXPuTBqk+jUURXrCVXyC22whKZcpHJr + yirYn9/pAYDqhMOEU0QXHLc2+hkADBRoIe6q0bwWkHAUhTTBNiXZXE/AmECsikfFweYY + /gxI4NxJV+DoqZUCLvfnDQNyMPQ/8PjcV+APjFzTg+joSGYwXUlmkEoTIr7wmU4PRJEJ + aqo/p8zPkt9WE7U5AouUleaAYafS7lL462sde12ORut0CLGLeMgOOc1Ts62W1sawCZnK + cgJQ== +X-Gm-Message-State: APjAAAUTdSRQtulqTKizpX2at2737W94BWN/oI7oAXlYMQGY5HDkwL/e + JmNLsqSgS0jLCPiCNJxyAmQ1zQ== +X-Google-Smtp-Source: + APXvYqwC65DYERLdER2UmlNerHOaEQY3c4hwpSMWsWud6VpPKrL6rBW7xSk8iiKL0ioPg8v7UxK/qQ== +X-Received: by 2002:adf:ebc6:: with SMTP id v6mr14844325wrn.222.1560775871713; + Mon, 17 Jun 2019 05:51:11 -0700 (PDT) +Received: from dell.watershed.co.uk ([2.27.35.243]) + by smtp.gmail.com with ESMTPSA id o11sm10477852wmh.37.2019.06.17.05.51.10 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Mon, 17 Jun 2019 05:51:11 -0700 (PDT) +From: Lee Jones +To: alokc@codeaurora.org, agross@kernel.org, david.brown@linaro.org, + bjorn.andersson@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org, + ard.biesheuvel@linaro.org, jlhugo@gmail.com, linux-arm-msm@vger.kernel.org, + linux-usb@vger.kernel.org, felipe.balbi@linux.intel.com +Subject: [RESEND v4 3/4] usb: dwc3: qcom: Start USB in 'host mode' on the + SDM845 +Date: Mon, 17 Jun 2019 13:51:04 +0100 +Message-Id: <20190617125105.6186-4-lee.jones@linaro.org> +X-Mailer: git-send-email 2.17.1 +In-Reply-To: <20190617125105.6186-1-lee.jones@linaro.org> +References: <20190617125105.6186-1-lee.jones@linaro.org> +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20190617_055112_973743_71B28B61 +X-CRM114-Status: GOOD ( 15.72 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Cc: Lee Jones , linux-kernel@vger.kernel.org, + linux-arm-kernel@lists.infradead.org +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org +X-Virus-Scanned: ClamAV using ClamSMTP + +When booting with Device Tree, the current default boot configuration +table option, the request to boot via 'host mode' comes from the +'dr_mode' property. A property of the same name can be used inside +ACPI tables too. However it is missing from the SDM845's ACPI tables +so we have to supply this information using Platform Device Properties +instead. + +This does not change the behaviour of any currently supported devices. +The property is only set on ACPI enabled platforms, thus for H/W +booting DT, unless a 'dr_mode' property is present, the default is +still OTG (On-The-Go) as per [0]. Any new ACPI devices added will +also be able to over-ride this implementation by providing a 'dr_mode' +property in their ACPI tables. In cases where 'dr_mode' is omitted +from the tables AND 'host mode' should not be the default (very +unlikely), then we will have to add some way of choosing between them +at run time - most likely by ACPI HID. + +[0] Documentation/devicetree/bindings/usb/generic.txt + +Signed-off-by: Lee Jones +Reviewed-by: Bjorn Andersson +--- + drivers/usb/dwc3/dwc3-qcom.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c +index 0cb63f6c92d9..2d050303d564 100644 +--- a/drivers/usb/dwc3/dwc3-qcom.c ++++ b/drivers/usb/dwc3/dwc3-qcom.c +@@ -444,6 +444,11 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count) + return 0; + } + ++static const struct property_entry dwc3_qcom_acpi_properties[] = { ++ PROPERTY_ENTRY_STRING("dr_mode", "host"), ++ {} ++}; ++ + static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) + { + struct dwc3_qcom *qcom = platform_get_drvdata(pdev); +@@ -488,6 +493,13 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) + goto out; + } + ++ ret = platform_device_add_properties(qcom->dwc3, ++ dwc3_qcom_acpi_properties); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "failed to add properties\n"); ++ goto out; ++ } ++ + ret = platform_device_add(qcom->dwc3); + if (ret) + dev_err(&pdev->dev, "failed to add device\n"); + +From patchwork Mon Jun 17 12:51:05 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Lee Jones +X-Patchwork-Id: 10999171 +Return-Path: + +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 056B014BB + for ; + Mon, 17 Jun 2019 12:52:24 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9F5D2623D + for ; + Mon, 17 Jun 2019 12:52:23 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id DE2D8286E6; Mon, 17 Jun 2019 12:52:23 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 +Received: from bombadil.infradead.org (bombadil.infradead.org + [198.137.202.133]) + (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4FDCC28910 + for ; + Mon, 17 Jun 2019 12:52:23 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20170209; h=Sender: + Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: + List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: + In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: + Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc + :Resent-Message-ID:List-Owner; + bh=+jtZnHBNzgQH/9Px1oGZt5RysFzYApYYAuGUPTs83g0=; b=isuYAdGtnV2Gnn9HFaejXX5oNk + FE+ANauzKQRQvIzRBcIKDx8ulhJQVhcGuK3T8Jch1Uboq+o3eWsxRoURfYBbGrflIOx21Yg8N25eY + BI7vshLQoF/8yr4DjMCu38+euxufpLS3Iy1ccfgdSWsrN4xNGQM8EMH9AnNO4CcCRvTNhd66JToDv + CeewDT5qNKNXJhX6uK7VSjjpqLLlL9xeDVHuVDlRBijmSlktSvXBSpx/foroGCL6PE/PHbTKY+84M + d2iMxiHV7HFNk88oc+cA1XibLNSKlrQqBSh0cTPEy9/FNF/HIhS2nZuW699O25srjt9WD5kHYTkWz + Uj9Onb5g==; +Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) + id 1hcr7Q-0005fB-VK; Mon, 17 Jun 2019 12:52:16 +0000 +Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) + by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) + id 1hcr6Q-0004hQ-9x + for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2019 12:51:15 +0000 +Received: by mail-wm1-x342.google.com with SMTP id c6so8984040wml.0 + for ; + Mon, 17 Jun 2019 05:51:13 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=Yh8KWN22mWMhTl8rcvEzBYBWJNOHxR/ZVbPRRDE/D+g=; + b=q/VQwMJ7CaCCS2TpiY40tB9SR/0BGYUD9cg5QmvyZlgN0oSe9DGo/a+8W3tFnih/es + f/TGbxw2+NhrkghexAa4OElVuqj6adr3zChACFmOr55PBTOD/M1NIEdtp5/IEy9qU/kC + fX2Qrs7PhDGqUidNClIWZ04Lwg4RW4iXSfsUN/mQ3Fz6ReP9i0AdV914a9optyVwxJ9W + Xy6Y1mSeoVn1NeqGDQGLUT+gzK0PwP6QYlI5aEiS1G795pxPRN55vGKPX1Kr7l+p8xwx + 9xxVx3Oo0mrnM/HpISh/Sd3kMq4WHV1BoTnn1nr+LgaU5NktIDT5p1PPAhig5lYx1wqZ + dRuw== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20161025; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references; + bh=Yh8KWN22mWMhTl8rcvEzBYBWJNOHxR/ZVbPRRDE/D+g=; + b=GDDwWmC9vgwB9dEThqnEfHcQ0p5geoDFCFkO7J5KNb9MMmOnioyHSEX/hc/ZVBKMJO + FJ5WEaXuIM9CNXi8tJnFihBgZh+RrxIyQE0XKiThAbKywAG/0O7CzV8zIALI0gjDuHnc + Z4EKuFVN6NOFCU4DwnkKs3ti0J1kjwTk4UXRwbCq/tdA25Jfe8s+dpgNFjsGKjJ9rhdb + 0HOQglShCMAL4K98A3uZhiBpD3DEYw0PE5f7bE85ztRROxzeyLdmCpE/7P62Tf7i6rRL + nLpK6Gkwh6BtejcNXq0oF8WDUhpCWFODaymkmLMZPTcUFsnvALORZa3xnahGffdxUoak + xpqw== +X-Gm-Message-State: APjAAAVe/oIFvOcyv+/Ca5uByLVj7kZtQ4Dw7Gzo/OG5v4XhjWwar3iK + OZZ9XFRIxxeYmle7YYU8S4BGNkgSBSw= +X-Google-Smtp-Source: + APXvYqyQ7uC0yXE6+rCbtoO1nXI3vuubKGuLiHCQLeIEVsa7DW/HvoU6icIxjcUwUpeyeJFFHJ6L2g== +X-Received: by 2002:a1c:63c4:: with SMTP id x187mr17953607wmb.4.1560775872645; + Mon, 17 Jun 2019 05:51:12 -0700 (PDT) +Received: from dell.watershed.co.uk ([2.27.35.243]) + by smtp.gmail.com with ESMTPSA id o11sm10477852wmh.37.2019.06.17.05.51.11 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Mon, 17 Jun 2019 05:51:12 -0700 (PDT) +From: Lee Jones +To: alokc@codeaurora.org, agross@kernel.org, david.brown@linaro.org, + bjorn.andersson@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org, + ard.biesheuvel@linaro.org, jlhugo@gmail.com, linux-arm-msm@vger.kernel.org, + linux-usb@vger.kernel.org, felipe.balbi@linux.intel.com +Subject: [RESEND v4 4/4] usb: dwc3: qcom: Improve error handling +Date: Mon, 17 Jun 2019 13:51:05 +0100 +Message-Id: <20190617125105.6186-5-lee.jones@linaro.org> +X-Mailer: git-send-email 2.17.1 +In-Reply-To: <20190617125105.6186-1-lee.jones@linaro.org> +References: <20190617125105.6186-1-lee.jones@linaro.org> +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20190617_055114_400272_E30946CF +X-CRM114-Status: GOOD ( 11.45 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Cc: Lee Jones , linux-kernel@vger.kernel.org, + linux-arm-kernel@lists.infradead.org +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org +X-Virus-Scanned: ClamAV using ClamSMTP + +dwc3_qcom_clk_init() is called with of_count_phandle_with_args() as an +argument. If of_count_phandle_with_args() returns an error, the number +of clocks will be a negative value and will lead to undefined behaviour. + +Ensure we check for an error before attempting to blindly use the value. + +Signed-off-by: Lee Jones +Reviewed-by: Bjorn Andersson +--- + drivers/usb/dwc3/dwc3-qcom.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c +index 2d050303d564..c59e9d8e8609 100644 +--- a/drivers/usb/dwc3/dwc3-qcom.c ++++ b/drivers/usb/dwc3/dwc3-qcom.c +@@ -409,6 +409,9 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count) + if (!np || !count) + return 0; + ++ if (count < 0) ++ return count; ++ + qcom->num_clocks = count; + + qcom->clks = devm_kcalloc(dev, qcom->num_clocks, diff --git a/arm64-qcom-pinctrl-support-for-ACPI.patch b/arm64-qcom-pinctrl-support-for-ACPI.patch new file mode 100644 index 000000000..a904b4789 --- /dev/null +++ b/arm64-qcom-pinctrl-support-for-ACPI.patch @@ -0,0 +1,293 @@ +From 0ab5b9df0c9f07ae747ddc678d4e423c42f69624 Mon Sep 17 00:00:00 2001 +From: Lee Jones +Date: Mon, 10 Jun 2019 09:42:06 +0100 +Subject: [PATCH 1/8] i2c: i2c-qcom-geni: Provide support for ACPI + +Add a match table to allow automatic probing of ACPI device +QCOM0220. Ignore clock attainment errors. Set default clock +frequency value. + +Signed-off-by: Lee Jones +Acked-by: Ard Biesheuvel +--- + drivers/i2c/busses/i2c-qcom-geni.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c +index db075bc0d952..9e3b8a98688d 100644 +--- a/drivers/i2c/busses/i2c-qcom-geni.c ++++ b/drivers/i2c/busses/i2c-qcom-geni.c +@@ -1,6 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 + // Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. + ++#include + #include + #include + #include +@@ -483,6 +484,14 @@ static const struct i2c_algorithm geni_i2c_algo = { + .functionality = geni_i2c_func, + }; + ++#ifdef CONFIG_ACPI ++static const struct acpi_device_id geni_i2c_acpi_match[] = { ++ { "QCOM0220"}, ++ { }, ++}; ++MODULE_DEVICE_TABLE(acpi, geni_i2c_acpi_match); ++#endif ++ + static int geni_i2c_probe(struct platform_device *pdev) + { + struct geni_i2c_dev *gi2c; +@@ -502,7 +511,7 @@ static int geni_i2c_probe(struct platform_device *pdev) + return PTR_ERR(gi2c->se.base); + + gi2c->se.clk = devm_clk_get(&pdev->dev, "se"); +- if (IS_ERR(gi2c->se.clk)) { ++ if (IS_ERR(gi2c->se.clk) && !has_acpi_companion(&pdev->dev)) { + ret = PTR_ERR(gi2c->se.clk); + dev_err(&pdev->dev, "Err getting SE Core clk %d\n", ret); + return ret; +@@ -516,6 +525,9 @@ static int geni_i2c_probe(struct platform_device *pdev) + gi2c->clk_freq_out = KHZ(100); + } + ++ if (has_acpi_companion(&pdev->dev)) ++ ACPI_COMPANION_SET(&gi2c->adap.dev, ACPI_COMPANION(&pdev->dev)); ++ + gi2c->irq = platform_get_irq(pdev, 0); + if (gi2c->irq < 0) { + dev_err(&pdev->dev, "IRQ error for i2c-geni\n"); +@@ -660,6 +672,7 @@ static struct platform_driver geni_i2c_driver = { + .name = "geni_i2c", + .pm = &geni_i2c_pm_ops, + .of_match_table = geni_i2c_dt_match, ++ .acpi_match_table = ACPI_PTR(geni_i2c_acpi_match), + }, + }; + +-- +2.21.0 + +From 5a0639fed6e05977d85c4824354e73d0a2fa92ef Mon Sep 17 00:00:00 2001 +From: Lee Jones +Date: Mon, 10 Jun 2019 09:42:07 +0100 +Subject: [PATCH 2/8] i2c: i2c-qcom-geni: Signify successful driver probe + +The Qualcomm Geni I2C driver currently probes silently which can be +confusing when debugging potential issues. Add a low level (INFO) +print when each I2C controller is successfully initially set-up. + +Signed-off-by: Lee Jones +Acked-by: Ard Biesheuvel +--- + drivers/i2c/busses/i2c-qcom-geni.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c +index 9e3b8a98688d..a89bfce5388e 100644 +--- a/drivers/i2c/busses/i2c-qcom-geni.c ++++ b/drivers/i2c/busses/i2c-qcom-geni.c +@@ -596,6 +596,8 @@ static int geni_i2c_probe(struct platform_device *pdev) + return ret; + } + ++ dev_dbg(&pdev->dev, "Geni-I2C adaptor successfully added\n"); ++ + return 0; + } + +-- +2.21.0 + +From 6f202eb6dbccf3172616a620faf934bf6195a0f9 Mon Sep 17 00:00:00 2001 +From: Lee Jones +Date: Mon, 10 Jun 2019 09:42:08 +0100 +Subject: [PATCH 3/8] pinctrl: msm: Add ability for drivers to supply a + reserved GPIO list + +When booting MSM based platforms with Device Tree or some ACPI +implementations, it is possible to provide a list of reserved pins +via the 'gpio-reserved-ranges' and 'gpios' properties respectively. +However some ACPI tables are not populated with this information, +thus it has to come from a knowledgable device driver instead. + +Here we provide the MSM common driver with additional support to +parse this informtion and correctly populate the widely used +'valid_mask'. + +Signed-off-by: Lee Jones +Reviewed-by: Bjorn Andersson +--- + drivers/pinctrl/qcom/pinctrl-msm.c | 18 ++++++++++++++++++ + drivers/pinctrl/qcom/pinctrl-msm.h | 1 + + 2 files changed, 19 insertions(+) + +diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c +index 6e319bcc2326..80682b017a47 100644 +--- a/drivers/pinctrl/qcom/pinctrl-msm.c ++++ b/drivers/pinctrl/qcom/pinctrl-msm.c +@@ -599,8 +599,23 @@ static int msm_gpio_init_valid_mask(struct gpio_chip *chip) + int ret; + unsigned int len, i; + unsigned int max_gpios = pctrl->soc->ngpios; ++ const int *reserved = pctrl->soc->reserved_gpios; + u16 *tmp; + ++ /* Driver provided reserved list overrides DT and ACPI */ ++ if (reserved) { ++ bitmap_fill(chip->valid_mask, max_gpios); ++ for (i = 0; reserved[i] >= 0; i++) { ++ if (i >= max_gpios || reserved[i] >= max_gpios) { ++ dev_err(pctrl->dev, "invalid list of reserved GPIOs\n"); ++ return -EINVAL; ++ } ++ clear_bit(reserved[i], chip->valid_mask); ++ } ++ ++ return 0; ++ } ++ + /* The number of GPIOs in the ACPI tables */ + len = ret = device_property_read_u16_array(pctrl->dev, "gpios", NULL, + 0); +@@ -956,6 +971,9 @@ static void msm_gpio_irq_handler(struct irq_desc *desc) + + static bool msm_gpio_needs_valid_mask(struct msm_pinctrl *pctrl) + { ++ if (pctrl->soc->reserved_gpios) ++ return true; ++ + return device_property_read_u16_array(pctrl->dev, "gpios", NULL, 0) > 0; + } + +diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h b/drivers/pinctrl/qcom/pinctrl-msm.h +index b724581c605c..48569cda8471 100644 +--- a/drivers/pinctrl/qcom/pinctrl-msm.h ++++ b/drivers/pinctrl/qcom/pinctrl-msm.h +@@ -113,6 +113,7 @@ struct msm_pinctrl_soc_data { + bool pull_no_keeper; + const char *const *tiles; + unsigned int ntiles; ++ const int *reserved_gpios; + }; + + extern const struct dev_pm_ops msm_pinctrl_dev_pm_ops; +-- +2.21.0 + +From 568ff4c9723d761164416fdf876232f5b14cf3ad Mon Sep 17 00:00:00 2001 +From: Lee Jones +Date: Mon, 10 Jun 2019 09:42:09 +0100 +Subject: [PATCH 4/8] pinctrl: qcom: sdm845: Provide ACPI support + +This patch provides basic support for booting with ACPI instead +of the currently supported Device Tree. When doing so there are a +couple of differences which we need to taken into consideration. + +Firstly, the SDM850 ACPI tables omit information pertaining to the +4 reserved GPIOs on the platform. If Linux attempts to touch/ +initialise any of these lines, the firmware will restart the +platform. + +Secondly, when booting with ACPI, it is expected that the firmware +will set-up things like; Regulators, Clocks, Pin Functions, etc in +their ideal configuration. Thus, the possible Pin Functions +available to this platform are not advertised when providing the +higher GPIOD/Pinctrl APIs with pin information. + +Signed-off-by: Lee Jones +Acked-by: Ard Biesheuvel +--- + drivers/pinctrl/qcom/Kconfig | 2 +- + drivers/pinctrl/qcom/pinctrl-sdm845.c | 36 ++++++++++++++++++++++++++- + 2 files changed, 36 insertions(+), 2 deletions(-) + +diff --git a/drivers/pinctrl/qcom/Kconfig b/drivers/pinctrl/qcom/Kconfig +index 890d0a3a790b..27ab585a639c 100644 +--- a/drivers/pinctrl/qcom/Kconfig ++++ b/drivers/pinctrl/qcom/Kconfig +@@ -169,7 +169,7 @@ config PINCTRL_SDM660 + + config PINCTRL_SDM845 + tristate "Qualcomm Technologies Inc SDM845 pin controller driver" +- depends on GPIOLIB && OF ++ depends on GPIOLIB && (OF || ACPI) + select PINCTRL_MSM + help + This is the pinctrl, pinmux, pinconf and gpiolib driver for the +diff --git a/drivers/pinctrl/qcom/pinctrl-sdm845.c b/drivers/pinctrl/qcom/pinctrl-sdm845.c +index c97f20fca5fd..98a438dba711 100644 +--- a/drivers/pinctrl/qcom/pinctrl-sdm845.c ++++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c +@@ -3,6 +3,7 @@ + * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. + */ + ++#include + #include + #include + #include +@@ -1277,6 +1278,10 @@ static const struct msm_pingroup sdm845_groups[] = { + UFS_RESET(ufs_reset, 0x99f000), + }; + ++static const int sdm845_acpi_reserved_gpios[] = { ++ 0, 1, 2, 3, 81, 82, 83, 84, -1 ++}; ++ + static const struct msm_pinctrl_soc_data sdm845_pinctrl = { + .pins = sdm845_pins, + .npins = ARRAY_SIZE(sdm845_pins), +@@ -1287,11 +1292,39 @@ static const struct msm_pinctrl_soc_data sdm845_pinctrl = { + .ngpios = 150, + }; + ++static const struct msm_pinctrl_soc_data sdm845_acpi_pinctrl = { ++ .pins = sdm845_pins, ++ .npins = ARRAY_SIZE(sdm845_pins), ++ .groups = sdm845_groups, ++ .ngroups = ARRAY_SIZE(sdm845_groups), ++ .reserved_gpios = sdm845_acpi_reserved_gpios, ++ .ngpios = 150, ++}; ++ + static int sdm845_pinctrl_probe(struct platform_device *pdev) + { +- return msm_pinctrl_probe(pdev, &sdm845_pinctrl); ++ int ret; ++ ++ if (pdev->dev.of_node) { ++ ret = msm_pinctrl_probe(pdev, &sdm845_pinctrl); ++ } else if (has_acpi_companion(&pdev->dev)) { ++ ret = msm_pinctrl_probe(pdev, &sdm845_acpi_pinctrl); ++ } else { ++ dev_err(&pdev->dev, "DT and ACPI disabled\n"); ++ return -EINVAL; ++ } ++ ++ return ret; + } + ++#ifdef CONFIG_ACPI ++static const struct acpi_device_id sdm845_pinctrl_acpi_match[] = { ++ { "QCOM0217"}, ++ { }, ++}; ++MODULE_DEVICE_TABLE(acpi, sdm845_pinctrl_acpi_match); ++#endif ++ + static const struct of_device_id sdm845_pinctrl_of_match[] = { + { .compatible = "qcom,sdm845-pinctrl", }, + { }, +@@ -1302,6 +1335,7 @@ static struct platform_driver sdm845_pinctrl_driver = { + .name = "sdm845-pinctrl", + .pm = &msm_pinctrl_dev_pm_ops, + .of_match_table = sdm845_pinctrl_of_match, ++ .acpi_match_table = ACPI_PTR(sdm845_pinctrl_acpi_match), + }, + .probe = sdm845_pinctrl_probe, + .remove = msm_pinctrl_remove, +-- +2.21.0 diff --git a/arm64-rock960-enable-tsadc.patch b/arm64-rock960-enable-tsadc.patch deleted file mode 100644 index 53d5303c2..000000000 --- a/arm64-rock960-enable-tsadc.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 02260a619efe574d0f6c2a4420b8b76c6802294e Mon Sep 17 00:00:00 2001 -From: Ezequiel Garcia -Date: Fri, 15 Feb 2019 12:25:39 -0300 -Subject: arm64: dts: rockchip: Enable tsadc device on rock960 - -Enable the thermal sensor. This device also provides -temperature shutdown protection. The shutdown value is -set at 110C, as tested by the vendor. - -Signed-off-by: Ezequiel Garcia -Signed-off-by: Heiko Stuebner ---- - arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi -index e40e66e33a5e..2927db4dda9d 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi -@@ -527,6 +527,13 @@ - status = "okay"; - }; - -+&tsadc { -+ rockchip,hw-tshut-mode = <1>; -+ rockchip,hw-tshut-polarity = <1>; -+ rockchip,hw-tshut-temp = <110000>; -+ status = "okay"; -+}; -+ - &uart0 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; --- -cgit 1.2-0.3.lf.el7 diff --git a/arm64-ufs-qcom-Add-support-for-platforms-booting-ACPI.patch b/arm64-ufs-qcom-Add-support-for-platforms-booting-ACPI.patch new file mode 100644 index 000000000..318922766 --- /dev/null +++ b/arm64-ufs-qcom-Add-support-for-platforms-booting-ACPI.patch @@ -0,0 +1,83 @@ +From 9ceb22fbffbad710db2c91ed32e4e73503f13301 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Tue, 25 Jun 2019 19:12:10 +0100 +Subject: [PATCH] scsi: ufs-qcom: Add support for platforms booting ACPI + +New Qualcomm AArch64 based laptops are now available which use UFS +as their primary data storage medium. These devices are supplied +with ACPI support out of the box. This patch ensures the Qualcomm +UFS driver will be bound when the "QCOM24A5" H/W device is +advertised as present. + +Signed-off-by: Lee Jones +Reviewed-by: Ard Biesheuvel +Signed-off-by: Peter Robinson +--- + drivers/scsi/ufs/ufs-qcom.c | 23 ++++++++++++++++++++--- + 1 file changed, 20 insertions(+), 3 deletions(-) + +diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c +index b4d1b5c22987..ee4b1da1e223 100644 +--- a/drivers/scsi/ufs/ufs-qcom.c ++++ b/drivers/scsi/ufs/ufs-qcom.c +@@ -3,6 +3,7 @@ + * Copyright (c) 2013-2016, Linux Foundation. All rights reserved. + */ + ++#include + #include + #include + #include +@@ -161,6 +162,9 @@ static int ufs_qcom_init_lane_clks(struct ufs_qcom_host *host) + int err = 0; + struct device *dev = host->hba->dev; + ++ if (has_acpi_companion(dev)) ++ return 0; ++ + err = ufs_qcom_host_clk_get(dev, "rx_lane0_sync_clk", + &host->rx_l0_sync_clk, false); + if (err) +@@ -1127,9 +1131,13 @@ static int ufs_qcom_init(struct ufs_hba *hba) + __func__, err); + goto out_variant_clear; + } else if (IS_ERR(host->generic_phy)) { +- err = PTR_ERR(host->generic_phy); +- dev_err(dev, "%s: PHY get failed %d\n", __func__, err); +- goto out_variant_clear; ++ if (has_acpi_companion(dev)) { ++ host->generic_phy = NULL; ++ } else { ++ err = PTR_ERR(host->generic_phy); ++ dev_err(dev, "%s: PHY get failed %d\n", __func__, err); ++ goto out_variant_clear; ++ } + } + + err = ufs_qcom_bus_register(host); +@@ -1599,6 +1607,14 @@ static const struct of_device_id ufs_qcom_of_match[] = { + }; + MODULE_DEVICE_TABLE(of, ufs_qcom_of_match); + ++#ifdef CONFIG_ACPI ++static const struct acpi_device_id ufs_qcom_acpi_match[] = { ++ { "QCOM24A5" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(acpi, ufs_qcom_acpi_match); ++#endif ++ + static const struct dev_pm_ops ufs_qcom_pm_ops = { + .suspend = ufshcd_pltfrm_suspend, + .resume = ufshcd_pltfrm_resume, +@@ -1615,6 +1631,7 @@ static struct platform_driver ufs_qcom_pltform = { + .name = "ufshcd-qcom", + .pm = &ufs_qcom_pm_ops, + .of_match_table = of_match_ptr(ufs_qcom_of_match), ++ .acpi_match_table = ACPI_PTR(ufs_qcom_acpi_match), + }, + }; + module_platform_driver(ufs_qcom_pltform); +-- +2.21.0 + diff --git a/bcm2835-camera-Restore-return-behavior-of-ctrl_set_bitrate.patch b/bcm2835-camera-Restore-return-behavior-of-ctrl_set_bitrate.patch new file mode 100644 index 000000000..e7ca70ab3 --- /dev/null +++ b/bcm2835-camera-Restore-return-behavior-of-ctrl_set_bitrate.patch @@ -0,0 +1,185 @@ +From patchwork Wed Jun 26 15:48:11 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Stefan Wahren +X-Patchwork-Id: 11018115 +Return-Path: + +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0546514BB + for ; + Wed, 26 Jun 2019 15:49:02 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6FEC288DC + for ; + Wed, 26 Jun 2019 15:49:01 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id DADF9288E5; Wed, 26 Jun 2019 15:49:01 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham + version=3.3.1 +Received: from bombadil.infradead.org (bombadil.infradead.org + [198.137.202.133]) + (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 73ADC288DC + for ; + Wed, 26 Jun 2019 15:49:01 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20170209; h=Sender: + Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: + List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: + Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: + Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: + References:List-Owner; bh=qjzvJkBweFVGZWCHd7cHawZMDpcLTzSf2CjoVEIv+0Q=; b=eu5 + ABKzcpImxwkRcYCdHG/4eTgYM8nrpBaJqeKW2TNWEhNUjvnfU8TgkbD4nsIXkBXSb/riyKYzEcGJo + 91zXHR6clQ6yf7eRtaHSX9IMfiwGPTC2YQvr6vQ+CrVJs+xDhlH/1V1+9myF4ySIX+mLOnm+w3pgi + j1JeP7vd7fpr8iyG29kaFoDH7FdC5Sw66TINVyaE5igT9yKcrFoAITGfRZevp1dd3uq5EKxs/+oo3 + 9BvpwHZ3Bdb+bWzFc9kS4udjL8V4+u7aesLq8tOOPLZab+W8ZW1iq4PHENzdHblrJyrK/2pGEECPx + bVAV7MIHqms4tvAAyXSlPai0wU/j12A==; +Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) + id 1hgAAK-00030G-Ny; Wed, 26 Jun 2019 15:48:56 +0000 +Received: from mout.gmx.net ([212.227.17.20]) + by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) + id 1hgAAH-0002yg-2E; Wed, 26 Jun 2019 15:48:54 +0000 +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; + s=badeba3b8450; t=1561564113; + bh=mWLTbdtxGfwZ13vnfxlQDfv6DzwTGycBEng3zNk/XaE=; + h=X-UI-Sender-Class:From:To:Cc:Subject:Date; + b=KYHDR8XZmzxft+7qC8J8cyQ71BSi6JkTsAhWvd+vK2f+YjWqjT42uTfrjNGCcQfdV + Z9gkAVPhUJWqXcu/GipMjVfx/QmxN65eJI1oHCOZ/vhkhzCqY9CuiJjHWnxF6jmydK + 5QSqYnKAOWM3NXmd6pWkd6wlKwIFV9zX8+x8R0gE= +X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c +Received: from localhost.localdomain ([37.4.249.111]) by mail.gmx.com + (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id + 0LyS5K-1ibrK32soI-015u60; Wed, 26 Jun 2019 17:48:33 +0200 +From: Stefan Wahren +To: Eric Anholt , + Greg Kroah-Hartman , + Madhumitha Prabakaran +Subject: [PATCH V2] staging: bcm2835-camera: Restore return behavior of + ctrl_set_bitrate() +Date: Wed, 26 Jun 2019 17:48:11 +0200 +Message-Id: <1561564091-14248-1-git-send-email-wahrenst@gmx.net> +X-Mailer: git-send-email 2.7.4 +X-Provags-ID: V03:K1:oGZaaF0VyX9aU1B2KlshIgSdbA6j0aZLN7PhhBatNb+3vHD/bim + IAE1eOdpYqQunHD6Pg0lTq7WJELowblFluMBHzPg8LdD02e6QUAOnsxpP9+ZsegmN4310bJ + qbWyOk73ZUf0L+ErExAilg9x9ygGjCdTujEDRrk0vloZc12lmdHMEA8VQs/4HDu6WGeOoac + M59q+7daHAsSTIgJrRUuA== +X-UI-Out-Filterresults: notjunk:1;V03:K0:+5QZJxEbxD4=:fxpwesVoxYf61efHxmcTKK + BddiAtw8+v4csO9cTNV4qSFAebPmgWlPv8KyLXPbOQdcjOl72FUcevKvhsznxi/uv5leFw9uX + Sr99W78EPj3EmJmQT1KZ8GMPWcB/hQa1h/t4bhjHByFu4VQ2xaIdpsJfZlFcR2poK1E6dEFT6 + jHlzWYjt2kP7anvsjMJvdSVILf9+ei6ysWz1aaMCKFLhxNUNmXH9onDdO8WOanGVr15zb+cVv + N4ecxzj0SonMoADsz1UJqgwb8Pi5/me809KQd8pQ/GhKDeLPNwQPXJMMhRbyPgmg5bJVCRUgp + MaMwDNiIn3qPl6t4jPx9uiSL5n47PAyt6vVlyufqp1lOr4EqgQFWp+2hknWJYJ8hzkBLgXrdZ + gfNGAtlqG9MdHsJds/KNtpjNvF3iCuOWcIyBEGAYKZL78LQggOcIFSlHn+KZ9JU2t9jGJHKF7 + 0E7pkZuWJIQjaWnt7WTAiO/Pv3tNhKukGVQXG7OTxkwS3+BsXI+vBB+xtOP+syI1QFkP3h+5c + 9HVQLB7CA73bkyul1AwmrHNV+OqITaTatTPFXsDojt54X59pz2G3SkQI5z8JZ2aq40Z3vwI6u + lyMT+gPPFDx2aNm460FX8Gm+2BisA5xrkpjxb4KIDZvTRDCexntK3cadXRyX7GZQWc6poIcVf + atWNWiKYv6KN6vA+lc2Ffl5FM8p7BFtkX4GA0GZ/XhMTvCqDtgxBdQ4sevKJ4riNMAvRuswrM + BUrlhaRg3ElFPF3x+S73QaRmNmtv34L7puWW57WxrkKKSJS7Td0oZd1ktx6eAW1CA+I8RmOn3 + A+rcm/ZfBf00TXqxsq3/t9h4mL3cP4KhBAxtyYg4z4yjuWt8AmXR6GfvTwCxk+qioygsV6KyY + 6yh532oUizARrL8gUwZBauRwgH5rk7e2BWINY86y8vr3nSBzocuIFAekTK42reIsJ+qq9OSD5 + IcQroenV1LixMtStvb6CiyHMHMqpxb+Buu+0bdl5qjKcUB4JxBA6KWMPC6Orj+Yf/GKaQlk+k + VsgZBuZAUHsZFuULBdIsUg//MyQJ0q/13WL31BSqJX9SAMgHFgsGeDo4yAg4YSF2Mbh1EgZu7 + a3+bklRX7SG3Ts= +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20190626_084853_443115_5EF1DFC7 +X-CRM114-Status: GOOD ( 11.55 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.29 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Cc: devel@driverdev.osuosl.org, Stefan Wahren , + Dave Stevenson , + Dan Carpenter , + linux-arm-kernel@lists.infradead.org, + linux-rpi-kernel@lists.infradead.org +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org +X-Virus-Scanned: ClamAV using ClamSMTP + +The commit 52c4dfcead49 ("Staging: vc04_services: Cleanup in +ctrl_set_bitrate()") changed the return behavior of ctrl_set_bitrate(). +We cannot do this because of a bug in the firmware, which breaks probing +of bcm2835-camera: + + bcm2835-v4l2: mmal_init: failed to set all camera controls: -3 + Cleanup: Destroy video encoder + Cleanup: Destroy image encoder + Cleanup: Destroy video render + Cleanup: Destroy camera + bcm2835-v4l2: bcm2835_mmal_probe: mmal init failed: -3 + bcm2835-camera: probe of bcm2835-camera failed with error -3 + +So restore the old behavior, add an explaining comment and a debug message +to verify that the bug has been fixed in firmware. + +Fixes: 52c4dfcead49 ("Staging: vc04_services: Cleanup in ctrl_set_bitrate()") +Signed-off-by: Stefan Wahren +Acked-by: Dan Carpenter +--- + .../staging/vc04_services/bcm2835-camera/controls.c | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +Changes in V2: +- add an explaining comment as suggest by Dan and Dave +- add a debug message to verify the firmware behavior + +-- +2.7.4 + +diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c +index d60e378..c251164 100644 +--- a/drivers/staging/vc04_services/bcm2835-camera/controls.c ++++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c +@@ -604,15 +604,28 @@ static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev, + struct v4l2_ctrl *ctrl, + const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl) + { ++ int ret; + struct vchiq_mmal_port *encoder_out; + + dev->capture.encode_bitrate = ctrl->val; + + encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; + +- return vchiq_mmal_port_parameter_set(dev->instance, encoder_out, +- mmal_ctrl->mmal_id, &ctrl->val, +- sizeof(ctrl->val)); ++ ret = vchiq_mmal_port_parameter_set(dev->instance, encoder_out, ++ mmal_ctrl->mmal_id, &ctrl->val, ++ sizeof(ctrl->val)); ++ ++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, ++ "%s: After: mmal_ctrl:%p ctrl id:0x%x ctrl val:%d ret %d(%d)\n", ++ __func__, mmal_ctrl, ctrl->id, ctrl->val, ret, ++ (ret == 0 ? 0 : -EINVAL)); ++ ++ /* ++ * Older firmware versions (pre July 2019) have a bug in handling ++ * MMAL_PARAMETER_VIDEO_BIT_RATE that result in the call ++ * returning -MMAL_MSG_STATUS_EINVAL. So ignore errors from this call. ++ */ ++ return 0; + } + + static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev, diff --git a/bcm2835-vchiq-use-interruptible-waits.patch b/bcm2835-vchiq-use-interruptible-waits.patch new file mode 100644 index 000000000..7f9e4f937 --- /dev/null +++ b/bcm2835-vchiq-use-interruptible-waits.patch @@ -0,0 +1,1133 @@ +From patchwork Thu May 9 14:31:33 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Nicolas Saenz Julienne +X-Patchwork-Id: 10937231 +Return-Path: + +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40C4F1390 + for ; + Thu, 9 May 2019 14:32:04 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BBD428A62 + for ; + Thu, 9 May 2019 14:32:04 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id 259A428AE0; Thu, 9 May 2019 14:32:04 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 +Received: from bombadil.infradead.org (bombadil.infradead.org + [198.137.202.133]) + (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 415AA28B73 + for ; + Thu, 9 May 2019 14:32:02 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20170209; h=Sender: + Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: + List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: + Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: + Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: + List-Owner; bh=3uJvYwW6NsoePeXJ/5ZwETYJ0KPDLBZYP0UKnW2FJN4=; b=C5epWZQXitegMi + If9WNmt+WIU1qZ5/Zf/K4VyHyLndbbGCz0fCiywJ6C2lL05k2rkyKPLD/5JD9WearPWtXUZKjfWel + 4TaT/dbnBmWnFmxZh/HH6Esg+Nm+f0XTmfQX4CTfAa37AkyGpHcpGoR+JHCXe8tJXjKtdGG3S+9Jl + l7TTzLJHyGUpJ6SOuB1s2T6hTBGi1fiJzUWjFZzONtMSbnu0gOhemwnL5paYqUdrs7KQq6BqZPU8Z + 48BFzV3uTQ/ux271qzmUx1beTRSqKwtlzquZtS9PutYKyvIm9oyEglAsOkBBVUY+9b8B0HWoWkUvv + w7rWaT6L1ZSjMthb9UtA==; +Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) + id 1hOk5T-0005hY-5q; Thu, 09 May 2019 14:31:55 +0000 +Received: from mx2.suse.de ([195.135.220.15] helo=mx1.suse.de) + by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) + id 1hOk5P-0005fv-Tq; Thu, 09 May 2019 14:31:53 +0000 +X-Virus-Scanned: by amavisd-new at test-mx.suse.de +Received: from relay2.suse.de (unknown [195.135.220.254]) + by mx1.suse.de (Postfix) with ESMTP id 9E8A6AC7E; + Thu, 9 May 2019 14:31:50 +0000 (UTC) +From: Nicolas Saenz Julienne +To: linux-kernel@vger.kernel.org +Subject: [PATCH v3 1/4] staging: vchiq_2835_arm: revert "quit using custom + down_interruptible()" +Date: Thu, 9 May 2019 16:31:33 +0200 +Message-Id: <20190509143137.31254-2-nsaenzjulienne@suse.de> +X-Mailer: git-send-email 2.21.0 +In-Reply-To: <20190509143137.31254-1-nsaenzjulienne@suse.de> +References: <20190509143137.31254-1-nsaenzjulienne@suse.de> +MIME-Version: 1.0 +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20190509_073152_105160_D40F2444 +X-CRM114-Status: GOOD ( 13.03 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.21 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Cc: stefan.wahren@i2se.com, devel@driverdev.osuosl.org, + Greg Kroah-Hartman , + Eric Anholt , + linux-rpi-kernel@lists.infradead.org, dan.carpenter@oracle.com, + Nicolas Saenz Julienne , + linux-arm-kernel@lists.infradead.org +Content-Type: text/plain; charset="us-ascii" +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org +X-Virus-Scanned: ClamAV using ClamSMTP + +The killable version of down() is meant to be used on situations where +it should not fail at all costs, but still have the convenience of being +able to kill it if really necessary. VCHIQ doesn't fit this criteria, as +it's mainly used as an interface to V4L2 and ALSA devices. + +Fixes: ff5979ad8636 ("staging: vchiq_2835_arm: quit using custom down_interruptible()") +Signed-off-by: Nicolas Saenz Julienne +Acked-by: Stefan Wahren +--- + .../staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index a9a22917ecdb..49d3b39b1059 100644 +--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -514,7 +514,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type) + (g_cache_line_size - 1)))) { + char *fragments; + +- if (down_killable(&g_free_fragments_sema)) { ++ if (down_interruptible(&g_free_fragments_sema) != 0) { + cleanup_pagelistinfo(pagelistinfo); + return NULL; + } + +From patchwork Thu May 9 14:31:34 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Nicolas Saenz Julienne +X-Patchwork-Id: 10937237 +Return-Path: + +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 94E28933 + for ; + Thu, 9 May 2019 14:32:36 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80F8B28B78 + for ; + Thu, 9 May 2019 14:32:36 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id 7D0F128B1B; Thu, 9 May 2019 14:32:36 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 +Received: from bombadil.infradead.org (bombadil.infradead.org + [198.137.202.133]) + (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9B03628BB9 + for ; + Thu, 9 May 2019 14:32:35 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20170209; h=Sender: + Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: + List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: + Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: + Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: + List-Owner; bh=WHM2WEnAejOnk0J6GjEHKXrK0nKxgdLNq48dTkgDLgo=; b=i5Mm8gffWR7Rwq + 4+uMDe6lJY5SKE65Kz4KtVkygMKsGS6oguaK3wvgh6OGo77kqnFU+0r6HHBQr3xb/0KJq4yq6IV9y + auU1WltykbzEJmRd+Tj3oJX6kaz+Tqagk88AQMUCSuyB95Elbvxqr7Q0ro4NGwveXvkM0CY8EkAcR + IvfNzMbS6tp0ZVcMflUHecbTThrfVr2H65WipivLLqS7FQtyly6cx1EkEyt3TV+53CAT2uY5l5wDb + BD2hOBPWrdwsgGFk4plnPlYV71/jQEL6zqb7ScYMQ8PXEC+SIifPvonzmTaGsXAss7CyNQefMsp6U + RSJQYwd9gv1L/MOawrgg==; +Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) + id 1hOk61-0006Sg-ER; Thu, 09 May 2019 14:32:29 +0000 +Received: from mx2.suse.de ([195.135.220.15] helo=mx1.suse.de) + by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) + id 1hOk5Q-0005fw-IZ; Thu, 09 May 2019 14:31:54 +0000 +X-Virus-Scanned: by amavisd-new at test-mx.suse.de +Received: from relay2.suse.de (unknown [195.135.220.254]) + by mx1.suse.de (Postfix) with ESMTP id 4DE02ACB1; + Thu, 9 May 2019 14:31:51 +0000 (UTC) +From: Nicolas Saenz Julienne +To: linux-kernel@vger.kernel.org +Subject: [PATCH v3 2/4] staging: vchiq: revert "switch to + wait_for_completion_killable" +Date: Thu, 9 May 2019 16:31:34 +0200 +Message-Id: <20190509143137.31254-3-nsaenzjulienne@suse.de> +X-Mailer: git-send-email 2.21.0 +In-Reply-To: <20190509143137.31254-1-nsaenzjulienne@suse.de> +References: <20190509143137.31254-1-nsaenzjulienne@suse.de> +MIME-Version: 1.0 +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20190509_073152_902395_DF67A86F +X-CRM114-Status: GOOD ( 15.86 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.21 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Cc: stefan.wahren@i2se.com, devel@driverdev.osuosl.org, + Greg Kroah-Hartman , + Eric Anholt , + linux-rpi-kernel@lists.infradead.org, dan.carpenter@oracle.com, + Nicolas Saenz Julienne , + linux-arm-kernel@lists.infradead.org +Content-Type: text/plain; charset="us-ascii" +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org +X-Virus-Scanned: ClamAV using ClamSMTP + +The killable version of wait_for_completion() is meant to be used on +situations where it should not fail at all costs, but still have the +convenience of being able to kill it if really necessary. VCHIQ doesn't +fit this criteria, as it's mainly used as an interface to V4L2 and ALSA +devices. + +Fixes: a772f116702e ("staging: vchiq: switch to wait_for_completion_killable") +Signed-off-by: Nicolas Saenz Julienne +--- + .../interface/vchiq_arm/vchiq_arm.c | 21 ++++++++++--------- + .../interface/vchiq_arm/vchiq_core.c | 21 ++++++++++--------- + .../interface/vchiq_arm/vchiq_util.c | 6 +++--- + 3 files changed, 25 insertions(+), 23 deletions(-) + +diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +index ab7d6a0ce94c..62d8f599e765 100644 +--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c ++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +@@ -532,7 +532,8 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason, + vchiq_log_trace(vchiq_arm_log_level, + "%s - completion queue full", __func__); + DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT); +- if (wait_for_completion_killable(&instance->remove_event)) { ++ if (wait_for_completion_interruptible( ++ &instance->remove_event)) { + vchiq_log_info(vchiq_arm_log_level, + "service_callback interrupted"); + return VCHIQ_RETRY; +@@ -643,7 +644,7 @@ service_callback(VCHIQ_REASON_T reason, struct vchiq_header *header, + } + + DEBUG_TRACE(SERVICE_CALLBACK_LINE); +- if (wait_for_completion_killable( ++ if (wait_for_completion_interruptible( + &user_service->remove_event) + != 0) { + vchiq_log_info(vchiq_arm_log_level, +@@ -978,7 +979,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + has been closed until the client library calls the + CLOSE_DELIVERED ioctl, signalling close_event. */ + if (user_service->close_pending && +- wait_for_completion_killable( ++ wait_for_completion_interruptible( + &user_service->close_event)) + status = VCHIQ_RETRY; + break; +@@ -1154,7 +1155,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + DEBUG_TRACE(AWAIT_COMPLETION_LINE); + mutex_unlock(&instance->completion_mutex); +- rc = wait_for_completion_killable( ++ rc = wait_for_completion_interruptible( + &instance->insert_event); + mutex_lock(&instance->completion_mutex); + if (rc != 0) { +@@ -1324,7 +1325,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + do { + spin_unlock(&msg_queue_spinlock); + DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); +- if (wait_for_completion_killable( ++ if (wait_for_completion_interruptible( + &user_service->insert_event)) { + vchiq_log_info(vchiq_arm_log_level, + "DEQUEUE_MESSAGE interrupted"); +@@ -2328,7 +2329,7 @@ vchiq_keepalive_thread_func(void *v) + while (1) { + long rc = 0, uc = 0; + +- if (wait_for_completion_killable(&arm_state->ka_evt) ++ if (wait_for_completion_interruptible(&arm_state->ka_evt) + != 0) { + vchiq_log_error(vchiq_susp_log_level, + "%s interrupted", __func__); +@@ -2579,7 +2580,7 @@ block_resume(struct vchiq_arm_state *arm_state) + write_unlock_bh(&arm_state->susp_res_lock); + vchiq_log_info(vchiq_susp_log_level, "%s wait for previously " + "blocked clients", __func__); +- if (wait_for_completion_killable_timeout( ++ if (wait_for_completion_interruptible_timeout( + &arm_state->blocked_blocker, timeout_val) + <= 0) { + vchiq_log_error(vchiq_susp_log_level, "%s wait for " +@@ -2605,7 +2606,7 @@ block_resume(struct vchiq_arm_state *arm_state) + write_unlock_bh(&arm_state->susp_res_lock); + vchiq_log_info(vchiq_susp_log_level, "%s wait for resume", + __func__); +- if (wait_for_completion_killable_timeout( ++ if (wait_for_completion_interruptible_timeout( + &arm_state->vc_resume_complete, timeout_val) + <= 0) { + vchiq_log_error(vchiq_susp_log_level, "%s wait for " +@@ -2812,7 +2813,7 @@ vchiq_arm_force_suspend(struct vchiq_state *state) + do { + write_unlock_bh(&arm_state->susp_res_lock); + +- rc = wait_for_completion_killable_timeout( ++ rc = wait_for_completion_interruptible_timeout( + &arm_state->vc_suspend_complete, + msecs_to_jiffies(FORCE_SUSPEND_TIMEOUT_MS)); + +@@ -2908,7 +2909,7 @@ vchiq_arm_allow_resume(struct vchiq_state *state) + write_unlock_bh(&arm_state->susp_res_lock); + + if (resume) { +- if (wait_for_completion_killable( ++ if (wait_for_completion_interruptible( + &arm_state->vc_resume_complete) < 0) { + vchiq_log_error(vchiq_susp_log_level, + "%s interrupted", __func__); +diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +index 0c387b6473a5..c65cf1e6f910 100644 +--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c ++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +@@ -560,7 +560,7 @@ reserve_space(struct vchiq_state *state, size_t space, int is_blocking) + remote_event_signal(&state->remote->trigger); + + if (!is_blocking || +- (wait_for_completion_killable( ++ (wait_for_completion_interruptible( + &state->slot_available_event))) + return NULL; /* No space available */ + } +@@ -830,7 +830,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, + spin_unlock("a_spinlock); + mutex_unlock(&state->slot_mutex); + +- if (wait_for_completion_killable( ++ if (wait_for_completion_interruptible( + &state->data_quota_event)) + return VCHIQ_RETRY; + +@@ -861,7 +861,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, + service_quota->slot_use_count); + VCHIQ_SERVICE_STATS_INC(service, quota_stalls); + mutex_unlock(&state->slot_mutex); +- if (wait_for_completion_killable( ++ if (wait_for_completion_interruptible( + &service_quota->quota_event)) + return VCHIQ_RETRY; + if (service->closing) +@@ -1710,7 +1710,8 @@ parse_rx_slots(struct vchiq_state *state) + &service->bulk_rx : &service->bulk_tx; + + DEBUG_TRACE(PARSE_LINE); +- if (mutex_lock_killable(&service->bulk_mutex)) { ++ if (mutex_lock_killable( ++ &service->bulk_mutex) != 0) { + DEBUG_TRACE(PARSE_LINE); + goto bail_not_ready; + } +@@ -2428,7 +2429,7 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id) + QMFLAGS_IS_BLOCKING); + if (status == VCHIQ_SUCCESS) { + /* Wait for the ACK/NAK */ +- if (wait_for_completion_killable(&service->remove_event)) { ++ if (wait_for_completion_interruptible(&service->remove_event)) { + status = VCHIQ_RETRY; + vchiq_release_service_internal(service); + } else if ((service->srvstate != VCHIQ_SRVSTATE_OPEN) && +@@ -2795,7 +2796,7 @@ vchiq_connect_internal(struct vchiq_state *state, VCHIQ_INSTANCE_T instance) + } + + if (state->conn_state == VCHIQ_CONNSTATE_CONNECTING) { +- if (wait_for_completion_killable(&state->connect)) ++ if (wait_for_completion_interruptible(&state->connect)) + return VCHIQ_RETRY; + + vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED); +@@ -2894,7 +2895,7 @@ vchiq_close_service(VCHIQ_SERVICE_HANDLE_T handle) + } + + while (1) { +- if (wait_for_completion_killable(&service->remove_event)) { ++ if (wait_for_completion_interruptible(&service->remove_event)) { + status = VCHIQ_RETRY; + break; + } +@@ -2955,7 +2956,7 @@ vchiq_remove_service(VCHIQ_SERVICE_HANDLE_T handle) + request_poll(service->state, service, VCHIQ_POLL_REMOVE); + } + while (1) { +- if (wait_for_completion_killable(&service->remove_event)) { ++ if (wait_for_completion_interruptible(&service->remove_event)) { + status = VCHIQ_RETRY; + break; + } +@@ -3038,7 +3039,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, + VCHIQ_SERVICE_STATS_INC(service, bulk_stalls); + do { + mutex_unlock(&service->bulk_mutex); +- if (wait_for_completion_killable( ++ if (wait_for_completion_interruptible( + &service->bulk_remove_event)) { + status = VCHIQ_RETRY; + goto error_exit; +@@ -3115,7 +3116,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, + + if (bulk_waiter) { + bulk_waiter->bulk = bulk; +- if (wait_for_completion_killable(&bulk_waiter->event)) ++ if (wait_for_completion_interruptible(&bulk_waiter->event)) + status = VCHIQ_RETRY; + else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED) + status = VCHIQ_ERROR; +diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c +index 6c519d8e48cb..8ee85c5e6f77 100644 +--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c ++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c +@@ -50,7 +50,7 @@ void vchiu_queue_push(struct vchiu_queue *queue, struct vchiq_header *header) + return; + + while (queue->write == queue->read + queue->size) { +- if (wait_for_completion_killable(&queue->pop)) ++ if (wait_for_completion_interruptible(&queue->pop)) + flush_signals(current); + } + +@@ -63,7 +63,7 @@ void vchiu_queue_push(struct vchiu_queue *queue, struct vchiq_header *header) + struct vchiq_header *vchiu_queue_peek(struct vchiu_queue *queue) + { + while (queue->write == queue->read) { +- if (wait_for_completion_killable(&queue->push)) ++ if (wait_for_completion_interruptible(&queue->push)) + flush_signals(current); + } + +@@ -77,7 +77,7 @@ struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue) + struct vchiq_header *header; + + while (queue->write == queue->read) { +- if (wait_for_completion_killable(&queue->push)) ++ if (wait_for_completion_interruptible(&queue->push)) + flush_signals(current); + } + + +From patchwork Thu May 9 14:31:35 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Nicolas Saenz Julienne +X-Patchwork-Id: 10937235 +Return-Path: + +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC5351390 + for ; + Thu, 9 May 2019 14:32:19 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99D2728B65 + for ; + Thu, 9 May 2019 14:32:19 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id 97D1428BB1; Thu, 9 May 2019 14:32:19 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 +Received: from bombadil.infradead.org (bombadil.infradead.org + [198.137.202.133]) + (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 33B1628B65 + for ; + Thu, 9 May 2019 14:32:19 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20170209; h=Sender: + Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: + List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: + Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: + Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: + List-Owner; bh=MppKCYBfq+FT3jZK/ObU3v+sP2fM91OxPw5GM5vFK98=; b=uphpQaXY93kD4n + qgHpU2dYayllgFMmHqHFKy8338sx7Rh7Whh12IOevJXT84Q43VFK/WoIk4//t7jh/pJYQfoRlmCnH + KJHT2uWjj2un8BkoTRQSR/fEO+EvLPI5n280twRaGYJQq1A5XprnriWSETDsTkgMcbt8Cj71kph8s + qqNkS1hkZGFOgh8B8EYP9MUwadwoYKkvovcJziv4ODUl/xaXoz9ST9ipqUpxRNyDnhj3gS0xGP4mU + eN4swml2LB//9oH9D3bt9GgKJhvURUm/vIKuBhCWQdYrfUPZNfPvIHwTyJStjhkiSuyN+i/yh/u0d + aVqlnEW/g+94vRfkoSfw==; +Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) + id 1hOk5p-0006Ao-3W; Thu, 09 May 2019 14:32:17 +0000 +Received: from mx2.suse.de ([195.135.220.15] helo=mx1.suse.de) + by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) + id 1hOk5R-0005gN-Bk; Thu, 09 May 2019 14:31:54 +0000 +X-Virus-Scanned: by amavisd-new at test-mx.suse.de +Received: from relay2.suse.de (unknown [195.135.220.254]) + by mx1.suse.de (Postfix) with ESMTP id 1944EACBA; + Thu, 9 May 2019 14:31:52 +0000 (UTC) +From: Nicolas Saenz Julienne +To: linux-kernel@vger.kernel.org +Subject: [PATCH v3 3/4] staging: vchiq: make wait events interruptible +Date: Thu, 9 May 2019 16:31:35 +0200 +Message-Id: <20190509143137.31254-4-nsaenzjulienne@suse.de> +X-Mailer: git-send-email 2.21.0 +In-Reply-To: <20190509143137.31254-1-nsaenzjulienne@suse.de> +References: <20190509143137.31254-1-nsaenzjulienne@suse.de> +MIME-Version: 1.0 +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20190509_073153_546153_CF6CDC2C +X-CRM114-Status: GOOD ( 12.69 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.21 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Cc: stefan.wahren@i2se.com, devel@driverdev.osuosl.org, + Greg Kroah-Hartman , + Eric Anholt , + linux-rpi-kernel@lists.infradead.org, dan.carpenter@oracle.com, + Nicolas Saenz Julienne , + linux-arm-kernel@lists.infradead.org +Content-Type: text/plain; charset="us-ascii" +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org +X-Virus-Scanned: ClamAV using ClamSMTP + +The killable version of wait_event() is meant to be used on situations +where it should not fail at all costs, but still have the convenience of +being able to kill it if really necessary. Wait events in VCHIQ doesn't +fit this criteria, as it's mainly used as an interface to V4L2 and ALSA +devices. + +Fixes: 852b2876a8a8 ("staging: vchiq: rework remove_event handling") +Signed-off-by: Nicolas Saenz Julienne +--- + .../vc04_services/interface/vchiq_arm/vchiq_core.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +index c65cf1e6f910..44bfa890e0e5 100644 +--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c ++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +@@ -395,13 +395,21 @@ remote_event_create(wait_queue_head_t *wq, struct remote_event *event) + init_waitqueue_head(wq); + } + ++/* ++ * All the event waiting routines in VCHIQ used a custom semaphore ++ * implementation that filtered most signals. This achieved a behaviour similar ++ * to the "killable" family of functions. While cleaning up this code all the ++ * routines where switched to the "interruptible" family of functions, as the ++ * former was deemed unjustified and the use "killable" set all VCHIQ's ++ * threads in D state. ++ */ + static inline int + remote_event_wait(wait_queue_head_t *wq, struct remote_event *event) + { + if (!event->fired) { + event->armed = 1; + dsb(sy); +- if (wait_event_killable(*wq, event->fired)) { ++ if (wait_event_interruptible(*wq, event->fired)) { + event->armed = 0; + return 0; + } + +From patchwork Thu May 9 14:31:36 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Nicolas Saenz Julienne +X-Patchwork-Id: 10937239 +Return-Path: + +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 662BC1390 + for ; + Thu, 9 May 2019 14:32:50 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 532DC289F8 + for ; + Thu, 9 May 2019 14:32:50 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id 5123C28A77; Thu, 9 May 2019 14:32:50 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 +Received: from bombadil.infradead.org (bombadil.infradead.org + [198.137.202.133]) + (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 171A028AE6 + for ; + Thu, 9 May 2019 14:32:49 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20170209; h=Sender: + Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: + List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: + Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: + Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: + List-Owner; bh=hbC4fga5OSh0T15ei+AWcZjFFpeyd4eloz75PA9+ZSQ=; b=hjJnppgChnF+da + gJbdcmOJUMpkaSPdRWwyDVndPiJqHfiacAhGzKZsMAPsymWXz2DiL4/KVE0ULmkTm5MwapaxCUliU + gdQQ7xNOT1yyCrlMWcXYZJaeDl06ngVfgu6QoNWN02uPS55159ez5rPNpCYtA0+5npkWsREnjEF6q + 4lo12R4nB6W62VLSy5Y1/37KoyYfIaaZOJoK3i15rKYrXoKn12hjF/2DwmVuhTA+NaadTByQyDE86 + 0A91ewtqOH/KTMHTJDQrG29q03l5LAI2l6Zr5tfz23o2jLCy+3F5vZCnXTYcGxYNNJUATVmobezZj + sxUS8TZjBOuPCowBB22g==; +Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) + id 1hOk6E-0006kx-RW; Thu, 09 May 2019 14:32:42 +0000 +Received: from mx2.suse.de ([195.135.220.15] helo=mx1.suse.de) + by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) + id 1hOk5T-0005hX-0e; Thu, 09 May 2019 14:32:02 +0000 +X-Virus-Scanned: by amavisd-new at test-mx.suse.de +Received: from relay2.suse.de (unknown [195.135.220.254]) + by mx1.suse.de (Postfix) with ESMTP id AC869ACBC; + Thu, 9 May 2019 14:31:53 +0000 (UTC) +From: Nicolas Saenz Julienne +To: Eric Anholt , Stefan Wahren , + Florian Fainelli , Ray Jui , + Scott Branden , + bcm-kernel-feedback-list@broadcom.com +Subject: [PATCH v3 4/4] staging: vchiq: stop explicitly comparing with zero to + catch errors +Date: Thu, 9 May 2019 16:31:36 +0200 +Message-Id: <20190509143137.31254-5-nsaenzjulienne@suse.de> +X-Mailer: git-send-email 2.21.0 +In-Reply-To: <20190509143137.31254-1-nsaenzjulienne@suse.de> +References: <20190509143137.31254-1-nsaenzjulienne@suse.de> +MIME-Version: 1.0 +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20190509_073155_533318_B386BD76 +X-CRM114-Status: GOOD ( 17.98 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.21 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Cc: devel@driverdev.osuosl.org, + Greg Kroah-Hartman , + linux-kernel@vger.kernel.org, + Nicolas Saenz Julienne , + dan.carpenter@oracle.com, linux-arm-kernel@lists.infradead.org, + linux-rpi-kernel@lists.infradead.org +Content-Type: text/plain; charset="us-ascii" +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org +X-Virus-Scanned: ClamAV using ClamSMTP + +The vchiq code tends to follow a coding pattern that's not accepted as +per the Linux kernel coding style + +We have this: + if (expression != 0) + +We want this: + if (expression) + +We make an exception if the expression refers to a size, in which case +it's accepted for the sake of clarity. + +Signed-off-by: Nicolas Saenz Julienne +--- + .../bcm2835-camera/bcm2835-camera.c | 11 ++-- + .../interface/vchiq_arm/vchiq_2835_arm.c | 2 +- + .../interface/vchiq_arm/vchiq_arm.c | 66 ++++++++----------- + .../interface/vchiq_arm/vchiq_connected.c | 4 +- + .../interface/vchiq_arm/vchiq_core.c | 28 ++++---- + .../interface/vchiq_arm/vchiq_debugfs.c | 4 +- + 6 files changed, 52 insertions(+), 63 deletions(-) + +diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +index 68f08dc18da9..57f79c153277 100644 +--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c ++++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +@@ -327,7 +327,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, + "%s: status:%d, buf:%p, length:%lu, flags %u, pts %lld\n", + __func__, status, buf, length, mmal_flags, pts); + +- if (status != 0) { ++ if (status) { + /* error in transfer */ + if (buf) { + /* there was a buffer with the error so return it */ +@@ -359,8 +359,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, + } + } else { + if (dev->capture.frame_count) { +- if (dev->capture.vc_start_timestamp != -1 && +- pts != 0) { ++ if (dev->capture.vc_start_timestamp != -1 && pts) { + ktime_t timestamp; + s64 runtime_us = pts - + dev->capture.vc_start_timestamp; +@@ -826,7 +825,7 @@ static int vidioc_enum_input(struct file *file, void *priv, + struct v4l2_input *inp) + { + /* only a single camera input */ +- if (inp->index != 0) ++ if (inp->index) + return -EINVAL; + + inp->type = V4L2_INPUT_TYPE_CAMERA; +@@ -842,7 +841,7 @@ static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) + + static int vidioc_s_input(struct file *file, void *priv, unsigned int i) + { +- if (i != 0) ++ if (i) + return -EINVAL; + + return 0; +@@ -1281,7 +1280,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, + } + + ret = mmal_setup_components(dev, f); +- if (ret != 0) { ++ if (ret) { + v4l2_err(&dev->v4l2_dev, + "%s: failed to setup mmal components: %d\n", + __func__, ret); +diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index 49d3b39b1059..cb588c0b9364 100644 +--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -514,7 +514,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type) + (g_cache_line_size - 1)))) { + char *fragments; + +- if (down_interruptible(&g_free_fragments_sema) != 0) { ++ if (down_interruptible(&g_free_fragments_sema)) { + cleanup_pagelistinfo(pagelistinfo); + return NULL; + } +diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +index 62d8f599e765..9264a07cf160 100644 +--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c ++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +@@ -238,7 +238,7 @@ VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance) + vchiq_log_trace(vchiq_core_log_level, + "%s(%p) called", __func__, instance); + +- if (mutex_lock_killable(&state->mutex) != 0) ++ if (mutex_lock_killable(&state->mutex)) + return VCHIQ_RETRY; + + /* Remove all services */ +@@ -280,7 +280,7 @@ VCHIQ_STATUS_T vchiq_connect(VCHIQ_INSTANCE_T instance) + vchiq_log_trace(vchiq_core_log_level, + "%s(%p) called", __func__, instance); + +- if (mutex_lock_killable(&state->mutex) != 0) { ++ if (mutex_lock_killable(&state->mutex)) { + vchiq_log_trace(vchiq_core_log_level, + "%s: call to mutex_lock failed", __func__); + status = VCHIQ_RETRY; +@@ -645,8 +645,7 @@ service_callback(VCHIQ_REASON_T reason, struct vchiq_header *header, + + DEBUG_TRACE(SERVICE_CALLBACK_LINE); + if (wait_for_completion_interruptible( +- &user_service->remove_event) +- != 0) { ++ &user_service->remove_event)) { + vchiq_log_info(vchiq_arm_log_level, + "%s interrupted", __func__); + DEBUG_TRACE(SERVICE_CALLBACK_LINE); +@@ -850,7 +849,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + break; + } + rc = mutex_lock_killable(&instance->state->mutex); +- if (rc != 0) { ++ if (rc) { + vchiq_log_error(vchiq_arm_log_level, + "vchiq: connect: could not lock mutex for " + "state %d: %d", +@@ -874,9 +873,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + void *userdata; + int srvstate; + +- if (copy_from_user +- (&args, (const void __user *)arg, +- sizeof(args)) != 0) { ++ if (copy_from_user(&args, (const void __user *)arg, ++ sizeof(args))) { + ret = -EFAULT; + break; + } +@@ -940,7 +938,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + &(((struct vchiq_create_service __user *) + arg)->handle), + (const void *)&service->handle, +- sizeof(service->handle)) != 0) { ++ sizeof(service->handle))) { + ret = -EFAULT; + vchiq_remove_service(service->handle); + } +@@ -1015,9 +1013,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + case VCHIQ_IOC_QUEUE_MESSAGE: { + struct vchiq_queue_message args; + +- if (copy_from_user +- (&args, (const void __user *)arg, +- sizeof(args)) != 0) { ++ if (copy_from_user(&args, (const void __user *)arg, ++ sizeof(args))) { + ret = -EFAULT; + break; + } +@@ -1049,9 +1046,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + (cmd == VCHIQ_IOC_QUEUE_BULK_TRANSMIT) ? + VCHIQ_BULK_TRANSMIT : VCHIQ_BULK_RECEIVE; + +- if (copy_from_user +- (&args, (const void __user *)arg, +- sizeof(args)) != 0) { ++ if (copy_from_user(&args, (const void __user *)arg, ++ sizeof(args))) { + ret = -EFAULT; + break; + } +@@ -1125,7 +1121,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + &(((struct vchiq_queue_bulk_transfer __user *) + arg)->mode), + (const void *)&mode_waiting, +- sizeof(mode_waiting)) != 0) ++ sizeof(mode_waiting))) + ret = -EFAULT; + } + } break; +@@ -1140,7 +1136,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + + if (copy_from_user(&args, (const void __user *)arg, +- sizeof(args)) != 0) { ++ sizeof(args))) { + ret = -EFAULT; + break; + } +@@ -1158,7 +1154,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + rc = wait_for_completion_interruptible( + &instance->insert_event); + mutex_lock(&instance->completion_mutex); +- if (rc != 0) { ++ if (rc) { + DEBUG_TRACE(AWAIT_COMPLETION_LINE); + vchiq_log_info(vchiq_arm_log_level, + "AWAIT_COMPLETION interrupted"); +@@ -1224,7 +1220,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + if (copy_from_user(&msgbuf, + (const void __user *) + &args.msgbufs[msgbufcount], +- sizeof(msgbuf)) != 0) { ++ sizeof(msgbuf))) { + if (ret == 0) + ret = -EFAULT; + break; +@@ -1232,7 +1228,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + /* Copy the message to user space */ + if (copy_to_user(msgbuf, header, +- msglen) != 0) { ++ msglen)) { + if (ret == 0) + ret = -EFAULT; + break; +@@ -1257,8 +1253,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + (size_t)args.buf + ret * + sizeof(struct vchiq_completion_data)), + completion, +- sizeof(struct vchiq_completion_data)) +- != 0) { ++ sizeof(struct vchiq_completion_data))) { + if (ret == 0) + ret = -EFAULT; + break; +@@ -1278,13 +1273,13 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + &((struct vchiq_await_completion *)arg) + ->msgbufcount, + &msgbufcount, +- sizeof(msgbufcount)) != 0) { ++ sizeof(msgbufcount))) { + ret = -EFAULT; + } + } + } + +- if (ret != 0) ++ if (ret) + complete(&instance->remove_event); + mutex_unlock(&instance->completion_mutex); + DEBUG_TRACE(AWAIT_COMPLETION_LINE); +@@ -1296,9 +1291,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + struct vchiq_header *header; + + DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); +- if (copy_from_user +- (&args, (const void __user *)arg, +- sizeof(args)) != 0) { ++ if (copy_from_user(&args, (const void __user *)arg, ++ sizeof(args))) { + ret = -EFAULT; + break; + } +@@ -1384,7 +1378,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + struct vchiq_config config; + + if (copy_from_user(&args, (const void __user *)arg, +- sizeof(args)) != 0) { ++ sizeof(args))) { + ret = -EFAULT; + break; + } +@@ -1403,9 +1397,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + case VCHIQ_IOC_SET_SERVICE_OPTION: { + struct vchiq_set_service_option args; + +- if (copy_from_user( +- &args, (const void __user *)arg, +- sizeof(args)) != 0) { ++ if (copy_from_user(&args, (const void __user *)arg, ++ sizeof(args))) { + ret = -EFAULT; + break; + } +@@ -2329,8 +2322,7 @@ vchiq_keepalive_thread_func(void *v) + while (1) { + long rc = 0, uc = 0; + +- if (wait_for_completion_interruptible(&arm_state->ka_evt) +- != 0) { ++ if (wait_for_completion_interruptible(&arm_state->ka_evt)) { + vchiq_log_error(vchiq_susp_log_level, + "%s interrupted", __func__); + flush_signals(current); +@@ -3011,7 +3003,7 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service, + vchiq_log_info(vchiq_susp_log_level, "%s %s resume " + "blocked - waiting...", __func__, entity); + if (wait_for_completion_killable( +- &arm_state->resume_blocker) != 0) { ++ &arm_state->resume_blocker)) { + vchiq_log_error(vchiq_susp_log_level, "%s %s " + "wait for resume blocker interrupted", + __func__, entity); +@@ -3060,7 +3052,7 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service, + vchiq_log_info(vchiq_susp_log_level, "%s %s wait for resume", + __func__, entity); + if (wait_for_completion_killable( +- &arm_state->vc_resume_complete) != 0) { ++ &arm_state->vc_resume_complete)) { + vchiq_log_error(vchiq_susp_log_level, "%s %s wait for " + "resume interrupted", __func__, entity); + ret = VCHIQ_ERROR; +@@ -3505,13 +3497,13 @@ static int vchiq_probe(struct platform_device *pdev) + platform_set_drvdata(pdev, drvdata); + + err = vchiq_platform_init(pdev, &g_state); +- if (err != 0) ++ if (err) + goto failed_platform_init; + + cdev_init(&vchiq_cdev, &vchiq_fops); + vchiq_cdev.owner = THIS_MODULE; + err = cdev_add(&vchiq_cdev, vchiq_devid, 1); +- if (err != 0) { ++ if (err) { + vchiq_log_error(vchiq_arm_log_level, + "Unable to register device"); + goto failed_platform_init; +diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c +index e87e6619695e..1640906e3929 100644 +--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c ++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c +@@ -41,7 +41,7 @@ void vchiq_add_connected_callback(VCHIQ_CONNECTED_CALLBACK_T callback) + { + connected_init(); + +- if (mutex_lock_killable(&g_connected_mutex) != 0) ++ if (mutex_lock_killable(&g_connected_mutex)) + return; + + if (g_connected) +@@ -76,7 +76,7 @@ void vchiq_call_connected_callbacks(void) + + connected_init(); + +- if (mutex_lock_killable(&g_connected_mutex) != 0) ++ if (mutex_lock_killable(&g_connected_mutex)) + return; + + for (i = 0; i < g_num_deferred_callbacks; i++) +diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +index 44bfa890e0e5..44f0eb64952a 100644 +--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c ++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +@@ -800,7 +800,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, + WARN_ON(!(stride <= VCHIQ_SLOT_SIZE)); + + if (!(flags & QMFLAGS_NO_MUTEX_LOCK) && +- (mutex_lock_killable(&state->slot_mutex) != 0)) ++ mutex_lock_killable(&state->slot_mutex)) + return VCHIQ_RETRY; + + if (type == VCHIQ_MSG_DATA) { +@@ -812,8 +812,8 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, + return VCHIQ_ERROR; + } + +- WARN_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | +- QMFLAGS_NO_MUTEX_UNLOCK)) != 0); ++ WARN_ON(flags & (QMFLAGS_NO_MUTEX_LOCK | ++ QMFLAGS_NO_MUTEX_UNLOCK)); + + if (service->closing) { + /* The service has been closed */ +@@ -874,7 +874,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, + return VCHIQ_RETRY; + if (service->closing) + return VCHIQ_ERROR; +- if (mutex_lock_killable(&state->slot_mutex) != 0) ++ if (mutex_lock_killable(&state->slot_mutex)) + return VCHIQ_RETRY; + if (service->srvstate != VCHIQ_SRVSTATE_OPEN) { + /* The service has been closed */ +@@ -912,8 +912,8 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, + header, size, VCHIQ_MSG_SRCPORT(msgid), + VCHIQ_MSG_DSTPORT(msgid)); + +- WARN_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | +- QMFLAGS_NO_MUTEX_UNLOCK)) != 0); ++ WARN_ON(flags & (QMFLAGS_NO_MUTEX_LOCK | ++ QMFLAGS_NO_MUTEX_UNLOCK)); + + callback_result = + copy_message_data(copy_callback, context, +@@ -1040,8 +1040,8 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service, + + local = state->local; + +- if ((VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME) && +- (mutex_lock_killable(&state->sync_mutex) != 0)) ++ if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME && ++ mutex_lock_killable(&state->sync_mutex)) + return VCHIQ_RETRY; + + remote_event_wait(&state->sync_release_event, &local->sync_release); +@@ -1718,8 +1718,7 @@ parse_rx_slots(struct vchiq_state *state) + &service->bulk_rx : &service->bulk_tx; + + DEBUG_TRACE(PARSE_LINE); +- if (mutex_lock_killable( +- &service->bulk_mutex) != 0) { ++ if (mutex_lock_killable(&service->bulk_mutex)) { + DEBUG_TRACE(PARSE_LINE); + goto bail_not_ready; + } +@@ -2523,7 +2522,7 @@ do_abort_bulks(struct vchiq_service *service) + VCHIQ_STATUS_T status; + + /* Abort any outstanding bulk transfers */ +- if (mutex_lock_killable(&service->bulk_mutex) != 0) ++ if (mutex_lock_killable(&service->bulk_mutex)) + return 0; + abort_outstanding_bulks(service, &service->bulk_tx); + abort_outstanding_bulks(service, &service->bulk_rx); +@@ -3038,7 +3037,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, + queue = (dir == VCHIQ_BULK_TRANSMIT) ? + &service->bulk_tx : &service->bulk_rx; + +- if (mutex_lock_killable(&service->bulk_mutex) != 0) { ++ if (mutex_lock_killable(&service->bulk_mutex)) { + status = VCHIQ_RETRY; + goto error_exit; + } +@@ -3052,8 +3051,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, + status = VCHIQ_RETRY; + goto error_exit; + } +- if (mutex_lock_killable(&service->bulk_mutex) +- != 0) { ++ if (mutex_lock_killable(&service->bulk_mutex)) { + status = VCHIQ_RETRY; + goto error_exit; + } +@@ -3081,7 +3079,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, + + /* The slot mutex must be held when the service is being closed, so + claim it here to ensure that isn't happening */ +- if (mutex_lock_killable(&state->slot_mutex) != 0) { ++ if (mutex_lock_killable(&state->slot_mutex)) { + status = VCHIQ_RETRY; + goto cancel_bulk_error_exit; + } +diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c +index 2bb9120883fd..f217b78d95a0 100644 +--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c ++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c +@@ -86,7 +86,7 @@ static ssize_t debugfs_log_write(struct file *file, + if (count >= DEBUGFS_WRITE_BUF_SIZE) + count = DEBUGFS_WRITE_BUF_SIZE; + +- if (copy_from_user(kbuf, buffer, count) != 0) ++ if (copy_from_user(kbuf, buffer, count)) + return -EFAULT; + kbuf[count - 1] = 0; + +@@ -151,7 +151,7 @@ static ssize_t debugfs_trace_write(struct file *file, + VCHIQ_INSTANCE_T instance = f->private; + char firstchar; + +- if (copy_from_user(&firstchar, buffer, 1) != 0) ++ if (copy_from_user(&firstchar, buffer, 1)) + return -EFAULT; + + switch (firstchar) { diff --git a/configs/fedora/generic/CONFIG_MSM_GCC_8994 b/configs/fedora/generic/arm/CONFIG_MSM_GCC_8994 similarity index 100% rename from configs/fedora/generic/CONFIG_MSM_GCC_8994 rename to configs/fedora/generic/arm/CONFIG_MSM_GCC_8994 diff --git a/configs/fedora/generic/CONFIG_MSM_GCC_8998 b/configs/fedora/generic/arm/CONFIG_MSM_GCC_8998 similarity index 100% rename from configs/fedora/generic/CONFIG_MSM_GCC_8998 rename to configs/fedora/generic/arm/CONFIG_MSM_GCC_8998 diff --git a/configs/fedora/generic/arm/CONFIG_PCIE_ROCKCHIP b/configs/fedora/generic/arm/CONFIG_PCIE_ROCKCHIP deleted file mode 100644 index 88cf51247..000000000 --- a/configs/fedora/generic/arm/CONFIG_PCIE_ROCKCHIP +++ /dev/null @@ -1 +0,0 @@ -# CONFIG_PCIE_ROCKCHIP is not set diff --git a/configs/fedora/generic/arm/aarch64/CONFIG_ACPI_AC b/configs/fedora/generic/arm/aarch64/CONFIG_ACPI_AC new file mode 100644 index 000000000..5dbaee1a8 --- /dev/null +++ b/configs/fedora/generic/arm/aarch64/CONFIG_ACPI_AC @@ -0,0 +1 @@ +CONFIG_ACPI_AC=y diff --git a/configs/fedora/generic/arm/aarch64/CONFIG_ACPI_BATTERY b/configs/fedora/generic/arm/aarch64/CONFIG_ACPI_BATTERY new file mode 100644 index 000000000..eb3286698 --- /dev/null +++ b/configs/fedora/generic/arm/aarch64/CONFIG_ACPI_BATTERY @@ -0,0 +1 @@ +CONFIG_ACPI_BATTERY=y diff --git a/configs/fedora/generic/arm/aarch64/CONFIG_COMMON_CLK_BD718XX b/configs/fedora/generic/arm/aarch64/CONFIG_COMMON_CLK_BD718XX new file mode 100644 index 000000000..a9e122a0c --- /dev/null +++ b/configs/fedora/generic/arm/aarch64/CONFIG_COMMON_CLK_BD718XX @@ -0,0 +1 @@ +CONFIG_COMMON_CLK_BD718XX=m diff --git a/configs/fedora/generic/arm/aarch64/CONFIG_MFD_ROHM_BD718XX b/configs/fedora/generic/arm/aarch64/CONFIG_MFD_ROHM_BD718XX new file mode 100644 index 000000000..330bd6f60 --- /dev/null +++ b/configs/fedora/generic/arm/aarch64/CONFIG_MFD_ROHM_BD718XX @@ -0,0 +1 @@ +CONFIG_MFD_ROHM_BD718XX=y diff --git a/configs/fedora/generic/arm/aarch64/CONFIG_REGULATOR_BD718XX b/configs/fedora/generic/arm/aarch64/CONFIG_REGULATOR_BD718XX new file mode 100644 index 000000000..fb1fae154 --- /dev/null +++ b/configs/fedora/generic/arm/aarch64/CONFIG_REGULATOR_BD718XX @@ -0,0 +1 @@ +CONFIG_REGULATOR_BD718XX=m diff --git a/configs/fedora/generic/arm/armv7/armv7/CONFIG_MFD_88PM800 b/configs/fedora/generic/arm/armv7/armv7/CONFIG_MFD_88PM800 deleted file mode 100644 index 98ea8db42..000000000 --- a/configs/fedora/generic/arm/armv7/armv7/CONFIG_MFD_88PM800 +++ /dev/null @@ -1 +0,0 @@ -CONFIG_MFD_88PM800=m diff --git a/configs/fedora/generic/arm/armv7/armv7/CONFIG_REGULATOR_88PM800 b/configs/fedora/generic/arm/armv7/armv7/CONFIG_REGULATOR_88PM800 deleted file mode 100644 index 68e334db0..000000000 --- a/configs/fedora/generic/arm/armv7/armv7/CONFIG_REGULATOR_88PM800 +++ /dev/null @@ -1 +0,0 @@ -# CONFIG_REGULATOR_88PM800 is not set diff --git a/gitrev b/gitrev index 3b31e963a..34b6edb32 100644 --- a/gitrev +++ b/gitrev @@ -1 +1 @@ -bed3c0d84e7e25c8e0964d297794f4c215b01f33 +6fbc7275c7a9ba97877050335f290341a1fd8dbf diff --git a/kernel-aarch64-debug.config b/kernel-aarch64-debug.config index 9de067db8..9a00df453 100644 --- a/kernel-aarch64-debug.config +++ b/kernel-aarch64-debug.config @@ -36,6 +36,7 @@ CONFIG_ACCESSIBILITY=y CONFIG_ACENIC=m # CONFIG_ACENIC_OMIT_TIGON_I is not set # CONFIG_ACORN_PARTITION is not set +CONFIG_ACPI_AC=y CONFIG_ACPI_ALS=m # CONFIG_ACPI_APEI_EINJ is not set # CONFIG_ACPI_APEI_ERST_DEBUG is not set @@ -44,6 +45,7 @@ CONFIG_ACPI_APEI_MEMORY_FAILURE=y CONFIG_ACPI_APEI_PCIEAER=y CONFIG_ACPI_APEI_SEA=y CONFIG_ACPI_APEI=y +CONFIG_ACPI_BATTERY=y CONFIG_ACPI_BGRT=y CONFIG_ACPI_BUTTON=y CONFIG_ACPI_CONFIGFS=m @@ -974,6 +976,7 @@ CONFIG_CNIC=m # CONFIG_CODA_FS is not set # CONFIG_COMEDI is not set # CONFIG_COMMON_CLK_AXG_AUDIO is not set +CONFIG_COMMON_CLK_BD718XX=m # CONFIG_COMMON_CLK_CDCE706 is not set # CONFIG_COMMON_CLK_CDCE925 is not set # CONFIG_COMMON_CLK_CS2000_CP is not set @@ -3350,7 +3353,7 @@ CONFIG_MFD_QCOM_RPM=m # CONFIG_MFD_RETU is not set CONFIG_MFD_RK808=y # CONFIG_MFD_RN5T618 is not set -# CONFIG_MFD_ROHM_BD718XX is not set +CONFIG_MFD_ROHM_BD718XX=y # CONFIG_MFD_RT5033 is not set # CONFIG_MFD_SEC_CORE is not set # CONFIG_MFD_SI476X_CORE is not set @@ -4387,7 +4390,6 @@ CONFIG_PCIEPORTBUS=y CONFIG_PCIE_PTM=y CONFIG_PCIE_QCOM=y # CONFIG_PCIE_ROCKCHIP_HOST is not set -# CONFIG_PCIE_ROCKCHIP is not set CONFIG_PCIE_XILINX_NWL=y CONFIG_PCIE_XILINX=y # CONFIG_PCI_FTPCI100 is not set @@ -4861,6 +4863,7 @@ CONFIG_REGULATOR_ACT8865=m CONFIG_REGULATOR_ANATOP=m CONFIG_REGULATOR_AS3722=m CONFIG_REGULATOR_AXP20X=m +CONFIG_REGULATOR_BD718XX=m CONFIG_REGULATOR_BD9571MWV=m # CONFIG_REGULATOR_DA9210 is not set # CONFIG_REGULATOR_DA9211 is not set diff --git a/kernel-aarch64.config b/kernel-aarch64.config index d1ea16ff6..120ac6973 100644 --- a/kernel-aarch64.config +++ b/kernel-aarch64.config @@ -36,6 +36,7 @@ CONFIG_ACCESSIBILITY=y CONFIG_ACENIC=m # CONFIG_ACENIC_OMIT_TIGON_I is not set # CONFIG_ACORN_PARTITION is not set +CONFIG_ACPI_AC=y CONFIG_ACPI_ALS=m # CONFIG_ACPI_APEI_EINJ is not set # CONFIG_ACPI_APEI_ERST_DEBUG is not set @@ -44,6 +45,7 @@ CONFIG_ACPI_APEI_MEMORY_FAILURE=y CONFIG_ACPI_APEI_PCIEAER=y CONFIG_ACPI_APEI_SEA=y CONFIG_ACPI_APEI=y +CONFIG_ACPI_BATTERY=y CONFIG_ACPI_BGRT=y CONFIG_ACPI_BUTTON=y CONFIG_ACPI_CONFIGFS=m @@ -974,6 +976,7 @@ CONFIG_CNIC=m # CONFIG_CODA_FS is not set # CONFIG_COMEDI is not set # CONFIG_COMMON_CLK_AXG_AUDIO is not set +CONFIG_COMMON_CLK_BD718XX=m # CONFIG_COMMON_CLK_CDCE706 is not set # CONFIG_COMMON_CLK_CDCE925 is not set # CONFIG_COMMON_CLK_CS2000_CP is not set @@ -3331,7 +3334,7 @@ CONFIG_MFD_QCOM_RPM=m # CONFIG_MFD_RETU is not set CONFIG_MFD_RK808=y # CONFIG_MFD_RN5T618 is not set -# CONFIG_MFD_ROHM_BD718XX is not set +CONFIG_MFD_ROHM_BD718XX=y # CONFIG_MFD_RT5033 is not set # CONFIG_MFD_SEC_CORE is not set # CONFIG_MFD_SI476X_CORE is not set @@ -4367,7 +4370,6 @@ CONFIG_PCIEPORTBUS=y CONFIG_PCIE_PTM=y CONFIG_PCIE_QCOM=y # CONFIG_PCIE_ROCKCHIP_HOST is not set -# CONFIG_PCIE_ROCKCHIP is not set CONFIG_PCIE_XILINX_NWL=y CONFIG_PCIE_XILINX=y # CONFIG_PCI_FTPCI100 is not set @@ -4840,6 +4842,7 @@ CONFIG_REGULATOR_ACT8865=m CONFIG_REGULATOR_ANATOP=m CONFIG_REGULATOR_AS3722=m CONFIG_REGULATOR_AXP20X=m +CONFIG_REGULATOR_BD718XX=m CONFIG_REGULATOR_BD9571MWV=m # CONFIG_REGULATOR_DA9210 is not set # CONFIG_REGULATOR_DA9211 is not set diff --git a/kernel-armv7hl-debug.config b/kernel-armv7hl-debug.config index 66c3bb97e..5392be345 100644 --- a/kernel-armv7hl-debug.config +++ b/kernel-armv7hl-debug.config @@ -3356,7 +3356,7 @@ CONFIG_MESON_SARADC=m CONFIG_MESON_SM=y CONFIG_MESON_WATCHDOG=m CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -CONFIG_MFD_88PM800=m +# CONFIG_MFD_88PM800 is not set CONFIG_MFD_88PM805=m # CONFIG_MFD_88PM860X is not set # CONFIG_MFD_AAT2870_CORE is not set @@ -4506,7 +4506,6 @@ CONFIG_PCIEPORTBUS=y CONFIG_PCIE_PTM=y CONFIG_PCIE_QCOM=y # CONFIG_PCIE_ROCKCHIP_HOST is not set -# CONFIG_PCIE_ROCKCHIP is not set CONFIG_PCIE_XILINX=y # CONFIG_PCI_FTPCI100 is not set # CONFIG_PCI_GOOLPC is not set @@ -4976,7 +4975,6 @@ CONFIG_REGMAP_SPI=y CONFIG_REGMAP_SPMI=m CONFIG_REGMAP=y # CONFIG_REGULATOR_88PG86X is not set -# CONFIG_REGULATOR_88PM800 is not set CONFIG_REGULATOR_ACT8865=m CONFIG_REGULATOR_AD5398=m CONFIG_REGULATOR_ANATOP=m diff --git a/kernel-armv7hl-lpae-debug.config b/kernel-armv7hl-lpae-debug.config index bc69eeaab..f6d101dd4 100644 --- a/kernel-armv7hl-lpae-debug.config +++ b/kernel-armv7hl-lpae-debug.config @@ -4342,7 +4342,6 @@ CONFIG_PCIE_ECRC=y CONFIG_PCIEPORTBUS=y CONFIG_PCIE_PTM=y # CONFIG_PCIE_ROCKCHIP_HOST is not set -# CONFIG_PCIE_ROCKCHIP is not set # CONFIG_PCIE_XILINX is not set # CONFIG_PCI_FTPCI100 is not set # CONFIG_PCI_GOOLPC is not set diff --git a/kernel-armv7hl-lpae.config b/kernel-armv7hl-lpae.config index 68eaa0855..4df791894 100644 --- a/kernel-armv7hl-lpae.config +++ b/kernel-armv7hl-lpae.config @@ -4323,7 +4323,6 @@ CONFIG_PCIE_ECRC=y CONFIG_PCIEPORTBUS=y CONFIG_PCIE_PTM=y # CONFIG_PCIE_ROCKCHIP_HOST is not set -# CONFIG_PCIE_ROCKCHIP is not set # CONFIG_PCIE_XILINX is not set # CONFIG_PCI_FTPCI100 is not set # CONFIG_PCI_GOOLPC is not set diff --git a/kernel-armv7hl.config b/kernel-armv7hl.config index 6f948e20d..7e41cfecd 100644 --- a/kernel-armv7hl.config +++ b/kernel-armv7hl.config @@ -3338,7 +3338,7 @@ CONFIG_MESON_SARADC=m CONFIG_MESON_SM=y CONFIG_MESON_WATCHDOG=m CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -CONFIG_MFD_88PM800=m +# CONFIG_MFD_88PM800 is not set CONFIG_MFD_88PM805=m # CONFIG_MFD_88PM860X is not set # CONFIG_MFD_AAT2870_CORE is not set @@ -4487,7 +4487,6 @@ CONFIG_PCIEPORTBUS=y CONFIG_PCIE_PTM=y CONFIG_PCIE_QCOM=y # CONFIG_PCIE_ROCKCHIP_HOST is not set -# CONFIG_PCIE_ROCKCHIP is not set CONFIG_PCIE_XILINX=y # CONFIG_PCI_FTPCI100 is not set # CONFIG_PCI_GOOLPC is not set @@ -4956,7 +4955,6 @@ CONFIG_REGMAP_SPI=y CONFIG_REGMAP_SPMI=m CONFIG_REGMAP=y # CONFIG_REGULATOR_88PG86X is not set -# CONFIG_REGULATOR_88PM800 is not set CONFIG_REGULATOR_ACT8865=m CONFIG_REGULATOR_AD5398=m CONFIG_REGULATOR_ANATOP=m diff --git a/kernel-i686-debug.config b/kernel-i686-debug.config index 3c70ae7d8..5b29fed59 100644 --- a/kernel-i686-debug.config +++ b/kernel-i686-debug.config @@ -3313,8 +3313,6 @@ CONFIG_MSDOS_FS=m CONFIG_MSDOS_PARTITION=y CONFIG_MSI_LAPTOP=m CONFIG_MSI_WMI=m -# CONFIG_MSM_GCC_8994 is not set -# CONFIG_MSM_GCC_8998 is not set CONFIG_MSPRO_BLOCK=m CONFIG_MT7601U=m CONFIG_MT7603E=m diff --git a/kernel-i686.config b/kernel-i686.config index 37ce38e86..6bd7a0f13 100644 --- a/kernel-i686.config +++ b/kernel-i686.config @@ -3294,8 +3294,6 @@ CONFIG_MSDOS_FS=m CONFIG_MSDOS_PARTITION=y CONFIG_MSI_LAPTOP=m CONFIG_MSI_WMI=m -# CONFIG_MSM_GCC_8994 is not set -# CONFIG_MSM_GCC_8998 is not set CONFIG_MSPRO_BLOCK=m CONFIG_MT7601U=m CONFIG_MT7603E=m diff --git a/kernel-ppc64le-debug.config b/kernel-ppc64le-debug.config index 6342edd7f..155c9914c 100644 --- a/kernel-ppc64le-debug.config +++ b/kernel-ppc64le-debug.config @@ -3046,8 +3046,6 @@ CONFIG_MQ_IOSCHED_KYBER=y CONFIG_MSDOS_FS=m CONFIG_MSDOS_PARTITION=y CONFIG_MSI_BITMAP_SELFTEST=y -# CONFIG_MSM_GCC_8994 is not set -# CONFIG_MSM_GCC_8998 is not set CONFIG_MSPRO_BLOCK=m CONFIG_MT7601U=m CONFIG_MT7603E=m diff --git a/kernel-ppc64le.config b/kernel-ppc64le.config index 974cd7bbc..6c8f4c896 100644 --- a/kernel-ppc64le.config +++ b/kernel-ppc64le.config @@ -3025,8 +3025,6 @@ CONFIG_MQ_IOSCHED_KYBER=y CONFIG_MSDOS_FS=m CONFIG_MSDOS_PARTITION=y CONFIG_MSI_BITMAP_SELFTEST=y -# CONFIG_MSM_GCC_8994 is not set -# CONFIG_MSM_GCC_8998 is not set CONFIG_MSPRO_BLOCK=m CONFIG_MT7601U=m CONFIG_MT7603E=m diff --git a/kernel-s390x-debug.config b/kernel-s390x-debug.config index 9ad0bfc14..d54b5913b 100644 --- a/kernel-s390x-debug.config +++ b/kernel-s390x-debug.config @@ -3020,8 +3020,6 @@ CONFIG_MQ_IOSCHED_KYBER=y # CONFIG_MS_BLOCK is not set CONFIG_MSDOS_FS=m CONFIG_MSDOS_PARTITION=y -# CONFIG_MSM_GCC_8994 is not set -# CONFIG_MSM_GCC_8998 is not set CONFIG_MSPRO_BLOCK=m CONFIG_MT7601U=m CONFIG_MT7603E=m diff --git a/kernel-s390x.config b/kernel-s390x.config index 6513fe6d7..6a25e92c6 100644 --- a/kernel-s390x.config +++ b/kernel-s390x.config @@ -2999,8 +2999,6 @@ CONFIG_MQ_IOSCHED_KYBER=y # CONFIG_MS_BLOCK is not set CONFIG_MSDOS_FS=m CONFIG_MSDOS_PARTITION=y -# CONFIG_MSM_GCC_8994 is not set -# CONFIG_MSM_GCC_8998 is not set CONFIG_MSPRO_BLOCK=m CONFIG_MT7601U=m CONFIG_MT7603E=m diff --git a/kernel-x86_64-debug.config b/kernel-x86_64-debug.config index 4f32662ac..161f58880 100644 --- a/kernel-x86_64-debug.config +++ b/kernel-x86_64-debug.config @@ -3361,8 +3361,6 @@ CONFIG_MSDOS_FS=m CONFIG_MSDOS_PARTITION=y CONFIG_MSI_LAPTOP=m CONFIG_MSI_WMI=m -# CONFIG_MSM_GCC_8994 is not set -# CONFIG_MSM_GCC_8998 is not set CONFIG_MSPRO_BLOCK=m CONFIG_MT7601U=m CONFIG_MT7603E=m diff --git a/kernel-x86_64.config b/kernel-x86_64.config index 3f4bfee7b..d696c892b 100644 --- a/kernel-x86_64.config +++ b/kernel-x86_64.config @@ -3342,8 +3342,6 @@ CONFIG_MSDOS_FS=m CONFIG_MSDOS_PARTITION=y CONFIG_MSI_LAPTOP=m CONFIG_MSI_WMI=m -# CONFIG_MSM_GCC_8994 is not set -# CONFIG_MSM_GCC_8998 is not set CONFIG_MSPRO_BLOCK=m CONFIG_MT7601U=m CONFIG_MT7603E=m diff --git a/kernel.spec b/kernel.spec index b5b17d244..912e7bc1c 100644 --- a/kernel.spec +++ b/kernel.spec @@ -22,6 +22,8 @@ Summary: The Linux kernel %if %{zipmodules} %global zipsed -e 's/\.ko$/\.ko.xz/' +# for parallel xz processes, replace with 1 to go back to single process +%global zcpu `nproc --all` %endif # define buildid .local @@ -67,9 +69,9 @@ Summary: The Linux kernel # The next upstream release sublevel (base_sublevel+1) %define upstream_sublevel %(echo $((%{base_sublevel} + 1))) # The rc snapshot level -%global rcrev 5 +%global rcrev 7 # The git snapshot level -%define gitrev 2 +%define gitrev 0 # Set rpm version accordingly %define rpmversion 5.%{upstream_sublevel}.0 %endif @@ -122,7 +124,7 @@ Summary: The Linux kernel # Set debugbuildsenabled to 1 for production (build separate debug kernels) # and 0 for rawhide (all kernels are debug kernels). # See also 'make debug' and 'make release'. -%define debugbuildsenabled 0 +%define debugbuildsenabled 1 # Kernel headers are being split out into a separate package %if 0%{?fedora} @@ -142,7 +144,7 @@ Summary: The Linux kernel # pkg_release is what we'll fill in for the rpm Release: field %if 0%{?released_kernel} -%define pkg_release %{fedora_build}%{?buildid}.2.riscv64%{?dist} +%define pkg_release %{fedora_build}%{?buildid}.0.riscv64%{?dist} %else @@ -157,7 +159,7 @@ Summary: The Linux kernel %else %define gittag .git0 %endif -%define pkg_release 0%{?rctag}%{?gittag}.%{fedora_build}%{?buildid}.2.riscv64%{?dist} +%define pkg_release 0%{?rctag}%{?gittag}.%{fedora_build}%{?buildid}.0.riscv64%{?dist} %endif @@ -561,17 +563,27 @@ Patch304: ACPI-irq-Workaround-firmware-issue-on-X-Gene-based-m400.patch # https://patchwork.kernel.org/project/linux-mmc/list/?submitter=71861 Patch305: arm-sdhci-esdhc-imx-fixes.patch -Patch306: arm64-rock960-enable-tsadc.patch +# Fix accepted for 5.3 https://patchwork.kernel.org/patch/10992783/ +Patch306: arm64-dts-rockchip-Update-DWC3-modules-on-RK3399-SoCs.patch +# Raspberry Pi bits Patch330: ARM-cpufreq-support-for-Raspberry-Pi.patch Patch331: watchdog-bcm2835_wdt-Fix-module-autoload.patch +Patch332: bcm2835-camera-Restore-return-behavior-of-ctrl_set_bitrate.patch + +Patch333: bcm2835-vchiq-use-interruptible-waits.patch + # Tegra bits Patch340: arm64-tegra-jetson-tx1-fixes.patch -# qcom bits -Patch350: qcom-Provide-support-for-ACPI.patch +# QCom ACPI device support pieces +Patch350: arm64-qcom-pinctrl-support-for-ACPI.patch +Patch351: arm64-acpi-ignore-5.1-fadts-reported-as-5.0.patch +Patch352: arm64-acpi-make-ac-and-battery-drivers-available-on-non-x86.patch +Patch353: arm64-qcom-DWC3-USB-Add-support-for-ACPI-based-AArch64-Laptops.patch +Patch354: arm64-ufs-qcom-Add-support-for-platforms-booting-ACPI.patch # 400 - IBM (ppc/s390x) patches @@ -592,12 +604,6 @@ Patch527: v2-powerpc-mm-mark-more-tlb-functions-as-__always_inline.patch Patch530: crypto-ghash-fix-unaligned-memory-access-in-ghash_setkey.patch -# Fix for new Logitech wireless keyboard support in 5.2, submitted upstream -Patch534: 0001-HID-logitech-dj-Fix-forwarding-of-very-long-HID-repo.patch - -# Fix for broken bluetooth, reverted in upstream stable, not yet in Torvald's tree -Patch535: Revert-Bluetooth-Align-minimum-encryption-key-size.patch - # RISC-V SECCOMP support v2 (not posted on linux-riscv yet) Patch550: 0001-riscv-add-SECCOMP-support.patch @@ -1574,7 +1580,7 @@ BuildKernel %make_target %kernel_image %{_use_vdso} fi \ fi \ if [ "%{zipmodules}" -eq "1" ]; then \ - find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs xz; \ + find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs -P%{zcpu} xz; \ fi \ %{nil} @@ -1839,6 +1845,34 @@ fi # # %changelog +* Mon Jul 01 2019 Justin M. Forbes - 5.2.0-0.rc7.git0.1 +- Linux v5.2-rc7 + +* Mon Jul 01 2019 Justin M. Forbes +- Disable debugging options. + +* Fri Jun 28 2019 Justin M. Forbes - 5.2.0-0.rc6.git2.1 +- Linux v5.2-rc6-93-g556e2f6020bf + +* Tue Jun 25 2019 Justin M. Forbes - 5.2.0-0.rc6.git1.1 +- Linux v5.2-rc6-15-g249155c20f9b +- Reenable debugging options. + +* Mon Jun 24 2019 Justin M. Forbes - 5.2.0-0.rc6.git0.1 +- Linux v5.2-rc6 + +* Mon Jun 24 2019 Justin M. Forbes +- Disable debugging options. + +* Sat Jun 22 2019 Peter Robinson +- QCom ACPI fixes + +* Fri Jun 21 2019 Justin M. Forbes - 5.2.0-0.rc5.git4.1 +- Linux v5.2-rc5-290-g4ae004a9bca8 + +* Thu Jun 20 2019 Justin M. Forbes - 5.2.0-0.rc5.git3.1 +- Linux v5.2-rc5-239-g241e39004581 + * Wed Jun 19 2019 Justin M. Forbes - 5.2.0-0.rc5.git2.1 - Linux v5.2-rc5-224-gbed3c0d84e7e diff --git a/qcom-Provide-support-for-ACPI.patch b/qcom-Provide-support-for-ACPI.patch deleted file mode 100644 index 8e34a739d..000000000 --- a/qcom-Provide-support-for-ACPI.patch +++ /dev/null @@ -1,841 +0,0 @@ -From 0ab5b9df0c9f07ae747ddc678d4e423c42f69624 Mon Sep 17 00:00:00 2001 -From: Lee Jones -Date: Mon, 10 Jun 2019 09:42:06 +0100 -Subject: [PATCH 1/8] i2c: i2c-qcom-geni: Provide support for ACPI - -Add a match table to allow automatic probing of ACPI device -QCOM0220. Ignore clock attainment errors. Set default clock -frequency value. - -Signed-off-by: Lee Jones -Acked-by: Ard Biesheuvel ---- - drivers/i2c/busses/i2c-qcom-geni.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c -index db075bc0d952..9e3b8a98688d 100644 ---- a/drivers/i2c/busses/i2c-qcom-geni.c -+++ b/drivers/i2c/busses/i2c-qcom-geni.c -@@ -1,6 +1,7 @@ - // SPDX-License-Identifier: GPL-2.0 - // Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. - -+#include - #include - #include - #include -@@ -483,6 +484,14 @@ static const struct i2c_algorithm geni_i2c_algo = { - .functionality = geni_i2c_func, - }; - -+#ifdef CONFIG_ACPI -+static const struct acpi_device_id geni_i2c_acpi_match[] = { -+ { "QCOM0220"}, -+ { }, -+}; -+MODULE_DEVICE_TABLE(acpi, geni_i2c_acpi_match); -+#endif -+ - static int geni_i2c_probe(struct platform_device *pdev) - { - struct geni_i2c_dev *gi2c; -@@ -502,7 +511,7 @@ static int geni_i2c_probe(struct platform_device *pdev) - return PTR_ERR(gi2c->se.base); - - gi2c->se.clk = devm_clk_get(&pdev->dev, "se"); -- if (IS_ERR(gi2c->se.clk)) { -+ if (IS_ERR(gi2c->se.clk) && !has_acpi_companion(&pdev->dev)) { - ret = PTR_ERR(gi2c->se.clk); - dev_err(&pdev->dev, "Err getting SE Core clk %d\n", ret); - return ret; -@@ -516,6 +525,9 @@ static int geni_i2c_probe(struct platform_device *pdev) - gi2c->clk_freq_out = KHZ(100); - } - -+ if (has_acpi_companion(&pdev->dev)) -+ ACPI_COMPANION_SET(&gi2c->adap.dev, ACPI_COMPANION(&pdev->dev)); -+ - gi2c->irq = platform_get_irq(pdev, 0); - if (gi2c->irq < 0) { - dev_err(&pdev->dev, "IRQ error for i2c-geni\n"); -@@ -660,6 +672,7 @@ static struct platform_driver geni_i2c_driver = { - .name = "geni_i2c", - .pm = &geni_i2c_pm_ops, - .of_match_table = geni_i2c_dt_match, -+ .acpi_match_table = ACPI_PTR(geni_i2c_acpi_match), - }, - }; - --- -2.21.0 - -From 5a0639fed6e05977d85c4824354e73d0a2fa92ef Mon Sep 17 00:00:00 2001 -From: Lee Jones -Date: Mon, 10 Jun 2019 09:42:07 +0100 -Subject: [PATCH 2/8] i2c: i2c-qcom-geni: Signify successful driver probe - -The Qualcomm Geni I2C driver currently probes silently which can be -confusing when debugging potential issues. Add a low level (INFO) -print when each I2C controller is successfully initially set-up. - -Signed-off-by: Lee Jones -Acked-by: Ard Biesheuvel ---- - drivers/i2c/busses/i2c-qcom-geni.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c -index 9e3b8a98688d..a89bfce5388e 100644 ---- a/drivers/i2c/busses/i2c-qcom-geni.c -+++ b/drivers/i2c/busses/i2c-qcom-geni.c -@@ -596,6 +596,8 @@ static int geni_i2c_probe(struct platform_device *pdev) - return ret; - } - -+ dev_dbg(&pdev->dev, "Geni-I2C adaptor successfully added\n"); -+ - return 0; - } - --- -2.21.0 - -From 6f202eb6dbccf3172616a620faf934bf6195a0f9 Mon Sep 17 00:00:00 2001 -From: Lee Jones -Date: Mon, 10 Jun 2019 09:42:08 +0100 -Subject: [PATCH 3/8] pinctrl: msm: Add ability for drivers to supply a - reserved GPIO list - -When booting MSM based platforms with Device Tree or some ACPI -implementations, it is possible to provide a list of reserved pins -via the 'gpio-reserved-ranges' and 'gpios' properties respectively. -However some ACPI tables are not populated with this information, -thus it has to come from a knowledgable device driver instead. - -Here we provide the MSM common driver with additional support to -parse this informtion and correctly populate the widely used -'valid_mask'. - -Signed-off-by: Lee Jones -Reviewed-by: Bjorn Andersson ---- - drivers/pinctrl/qcom/pinctrl-msm.c | 18 ++++++++++++++++++ - drivers/pinctrl/qcom/pinctrl-msm.h | 1 + - 2 files changed, 19 insertions(+) - -diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c -index 6e319bcc2326..80682b017a47 100644 ---- a/drivers/pinctrl/qcom/pinctrl-msm.c -+++ b/drivers/pinctrl/qcom/pinctrl-msm.c -@@ -599,8 +599,23 @@ static int msm_gpio_init_valid_mask(struct gpio_chip *chip) - int ret; - unsigned int len, i; - unsigned int max_gpios = pctrl->soc->ngpios; -+ const int *reserved = pctrl->soc->reserved_gpios; - u16 *tmp; - -+ /* Driver provided reserved list overrides DT and ACPI */ -+ if (reserved) { -+ bitmap_fill(chip->valid_mask, max_gpios); -+ for (i = 0; reserved[i] >= 0; i++) { -+ if (i >= max_gpios || reserved[i] >= max_gpios) { -+ dev_err(pctrl->dev, "invalid list of reserved GPIOs\n"); -+ return -EINVAL; -+ } -+ clear_bit(reserved[i], chip->valid_mask); -+ } -+ -+ return 0; -+ } -+ - /* The number of GPIOs in the ACPI tables */ - len = ret = device_property_read_u16_array(pctrl->dev, "gpios", NULL, - 0); -@@ -956,6 +971,9 @@ static void msm_gpio_irq_handler(struct irq_desc *desc) - - static bool msm_gpio_needs_valid_mask(struct msm_pinctrl *pctrl) - { -+ if (pctrl->soc->reserved_gpios) -+ return true; -+ - return device_property_read_u16_array(pctrl->dev, "gpios", NULL, 0) > 0; - } - -diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h b/drivers/pinctrl/qcom/pinctrl-msm.h -index b724581c605c..48569cda8471 100644 ---- a/drivers/pinctrl/qcom/pinctrl-msm.h -+++ b/drivers/pinctrl/qcom/pinctrl-msm.h -@@ -113,6 +113,7 @@ struct msm_pinctrl_soc_data { - bool pull_no_keeper; - const char *const *tiles; - unsigned int ntiles; -+ const int *reserved_gpios; - }; - - extern const struct dev_pm_ops msm_pinctrl_dev_pm_ops; --- -2.21.0 - -From 568ff4c9723d761164416fdf876232f5b14cf3ad Mon Sep 17 00:00:00 2001 -From: Lee Jones -Date: Mon, 10 Jun 2019 09:42:09 +0100 -Subject: [PATCH 4/8] pinctrl: qcom: sdm845: Provide ACPI support - -This patch provides basic support for booting with ACPI instead -of the currently supported Device Tree. When doing so there are a -couple of differences which we need to taken into consideration. - -Firstly, the SDM850 ACPI tables omit information pertaining to the -4 reserved GPIOs on the platform. If Linux attempts to touch/ -initialise any of these lines, the firmware will restart the -platform. - -Secondly, when booting with ACPI, it is expected that the firmware -will set-up things like; Regulators, Clocks, Pin Functions, etc in -their ideal configuration. Thus, the possible Pin Functions -available to this platform are not advertised when providing the -higher GPIOD/Pinctrl APIs with pin information. - -Signed-off-by: Lee Jones -Acked-by: Ard Biesheuvel ---- - drivers/pinctrl/qcom/Kconfig | 2 +- - drivers/pinctrl/qcom/pinctrl-sdm845.c | 36 ++++++++++++++++++++++++++- - 2 files changed, 36 insertions(+), 2 deletions(-) - -diff --git a/drivers/pinctrl/qcom/Kconfig b/drivers/pinctrl/qcom/Kconfig -index 890d0a3a790b..27ab585a639c 100644 ---- a/drivers/pinctrl/qcom/Kconfig -+++ b/drivers/pinctrl/qcom/Kconfig -@@ -169,7 +169,7 @@ config PINCTRL_SDM660 - - config PINCTRL_SDM845 - tristate "Qualcomm Technologies Inc SDM845 pin controller driver" -- depends on GPIOLIB && OF -+ depends on GPIOLIB && (OF || ACPI) - select PINCTRL_MSM - help - This is the pinctrl, pinmux, pinconf and gpiolib driver for the -diff --git a/drivers/pinctrl/qcom/pinctrl-sdm845.c b/drivers/pinctrl/qcom/pinctrl-sdm845.c -index c97f20fca5fd..98a438dba711 100644 ---- a/drivers/pinctrl/qcom/pinctrl-sdm845.c -+++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c -@@ -3,6 +3,7 @@ - * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. - */ - -+#include - #include - #include - #include -@@ -1277,6 +1278,10 @@ static const struct msm_pingroup sdm845_groups[] = { - UFS_RESET(ufs_reset, 0x99f000), - }; - -+static const int sdm845_acpi_reserved_gpios[] = { -+ 0, 1, 2, 3, 81, 82, 83, 84, -1 -+}; -+ - static const struct msm_pinctrl_soc_data sdm845_pinctrl = { - .pins = sdm845_pins, - .npins = ARRAY_SIZE(sdm845_pins), -@@ -1287,11 +1292,39 @@ static const struct msm_pinctrl_soc_data sdm845_pinctrl = { - .ngpios = 150, - }; - -+static const struct msm_pinctrl_soc_data sdm845_acpi_pinctrl = { -+ .pins = sdm845_pins, -+ .npins = ARRAY_SIZE(sdm845_pins), -+ .groups = sdm845_groups, -+ .ngroups = ARRAY_SIZE(sdm845_groups), -+ .reserved_gpios = sdm845_acpi_reserved_gpios, -+ .ngpios = 150, -+}; -+ - static int sdm845_pinctrl_probe(struct platform_device *pdev) - { -- return msm_pinctrl_probe(pdev, &sdm845_pinctrl); -+ int ret; -+ -+ if (pdev->dev.of_node) { -+ ret = msm_pinctrl_probe(pdev, &sdm845_pinctrl); -+ } else if (has_acpi_companion(&pdev->dev)) { -+ ret = msm_pinctrl_probe(pdev, &sdm845_acpi_pinctrl); -+ } else { -+ dev_err(&pdev->dev, "DT and ACPI disabled\n"); -+ return -EINVAL; -+ } -+ -+ return ret; - } - -+#if CONFIG_ACPI -+static const struct acpi_device_id sdm845_pinctrl_acpi_match[] = { -+ { "QCOM0217"}, -+ { }, -+}; -+MODULE_DEVICE_TABLE(acpi, sdm845_pinctrl_acpi_match); -+#endif -+ - static const struct of_device_id sdm845_pinctrl_of_match[] = { - { .compatible = "qcom,sdm845-pinctrl", }, - { }, -@@ -1302,6 +1335,7 @@ static struct platform_driver sdm845_pinctrl_driver = { - .name = "sdm845-pinctrl", - .pm = &msm_pinctrl_dev_pm_ops, - .of_match_table = sdm845_pinctrl_of_match, -+ .acpi_match_table = ACPI_PTR(sdm845_pinctrl_acpi_match), - }, - .probe = sdm845_pinctrl_probe, - .remove = msm_pinctrl_remove, --- -2.21.0 - -From 1960f541ea437ed1c704db11b9ca24a5248b31de Mon Sep 17 00:00:00 2001 -From: Lee Jones -Date: Mon, 10 Jun 2019 09:42:10 +0100 -Subject: [PATCH 5/8] soc: qcom: geni: Add support for ACPI - -When booting with ACPI as the active set of configuration tables, -all; clocks, regulators, pin functions ect are expected to be at -their ideal values/levels/rates, thus the associated frameworks -are unavailable. Ensure calls to these APIs are shielded when -ACPI is enabled. - -Signed-off-by: Lee Jones -Acked-by: Ard Biesheuvel ---- - drivers/soc/qcom/qcom-geni-se.c | 21 +++++++++++++++------ - 1 file changed, 15 insertions(+), 6 deletions(-) - -diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c -index 6b8ef01472e9..d5cf953b4337 100644 ---- a/drivers/soc/qcom/qcom-geni-se.c -+++ b/drivers/soc/qcom/qcom-geni-se.c -@@ -1,6 +1,7 @@ - // SPDX-License-Identifier: GPL-2.0 - // Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. - -+#include - #include - #include - #include -@@ -450,6 +451,9 @@ int geni_se_resources_off(struct geni_se *se) - { - int ret; - -+ if (has_acpi_companion(se->dev)) -+ return 0; -+ - ret = pinctrl_pm_select_sleep_state(se->dev); - if (ret) - return ret; -@@ -487,6 +491,9 @@ int geni_se_resources_on(struct geni_se *se) - { - int ret; - -+ if (has_acpi_companion(se->dev)) -+ return 0; -+ - ret = geni_se_clks_on(se); - if (ret) - return ret; -@@ -724,12 +731,14 @@ static int geni_se_probe(struct platform_device *pdev) - if (IS_ERR(wrapper->base)) - return PTR_ERR(wrapper->base); - -- wrapper->ahb_clks[0].id = "m-ahb"; -- wrapper->ahb_clks[1].id = "s-ahb"; -- ret = devm_clk_bulk_get(dev, NUM_AHB_CLKS, wrapper->ahb_clks); -- if (ret) { -- dev_err(dev, "Err getting AHB clks %d\n", ret); -- return ret; -+ if (!has_acpi_companion(&pdev->dev)) { -+ wrapper->ahb_clks[0].id = "m-ahb"; -+ wrapper->ahb_clks[1].id = "s-ahb"; -+ ret = devm_clk_bulk_get(dev, NUM_AHB_CLKS, wrapper->ahb_clks); -+ if (ret) { -+ dev_err(dev, "Err getting AHB clks %d\n", ret); -+ return ret; -+ } - } - - dev_set_drvdata(dev, wrapper); --- -2.21.0 - -From 0b10a369e159e4b76d1a786f613a2f061cdc3246 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Mon, 10 Jun 2019 10:31:02 +0100 -Subject: [PATCH 6/8] usb: dwc3: qcom: Add support for booting with ACPI - -In Linux, the DWC3 core exists as its own independent platform device. -Thus when describing relationships in Device Tree, the current default -boot configuration table option, the DWC3 core often resides as a child -of the platform specific node. Both of which are given their own -address space descriptions and the drivers can be mostly agnostic to -each other. - -However, other Operating Systems have taken a more monolithic approach, -which is evident in the configuration ACPI tables for the Qualcomm -Snapdragon SDM850, where all DWC3 (core and platform) components are -described under a single IO memory region. - -To ensure successful booting using the supplied ACPI tables, we need to -devise a way to chop up the address regions provided and subsequently -register the DWC3 core with the resultant information, which is -precisely what this patch aims to achieve. - -Signed-off-by: Lee Jones -Signed-off-by: Peter Robinson ---- - drivers/usb/dwc3/Kconfig | 2 +- - drivers/usb/dwc3/dwc3-qcom.c | 206 ++++++++++++++++++++++++++++++----- - 2 files changed, 179 insertions(+), 29 deletions(-) - -diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig -index 4a62045cc812..89abc6078703 100644 ---- a/drivers/usb/dwc3/Kconfig -+++ b/drivers/usb/dwc3/Kconfig -@@ -128,7 +128,7 @@ config USB_DWC3_QCOM - tristate "Qualcomm Platform" - depends on ARCH_QCOM || COMPILE_TEST - depends on EXTCON || !EXTCON -- depends on OF -+ depends on (OF || ACPI) - default USB_DWC3 - help - Some Qualcomm SoCs use DesignWare Core IP for USB2/3 -diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c -index 184df4daa590..1e1f12b7991d 100644 ---- a/drivers/usb/dwc3/dwc3-qcom.c -+++ b/drivers/usb/dwc3/dwc3-qcom.c -@@ -4,6 +4,7 @@ - * Inspired by dwc3-of-simple.c - */ - -+#include - #include - #include - #include -@@ -38,6 +39,20 @@ - #define PWR_EVNT_LPM_IN_L2_MASK BIT(4) - #define PWR_EVNT_LPM_OUT_L2_MASK BIT(5) - -+#define SDM845_QSCRATCH_BASE_OFFSET 0xf8800 -+#define SDM845_QSCRATCH_SIZE 0x400 -+#define SDM845_DWC3_CORE_SIZE 0xcd00 -+ -+struct dwc3_acpi_pdata { -+ u32 qscratch_base_offset; -+ u32 qscratch_base_size; -+ u32 dwc3_core_base_size; -+ int hs_phy_irq_index; -+ int dp_hs_phy_irq_index; -+ int dm_hs_phy_irq_index; -+ int ss_phy_irq_index; -+}; -+ - struct dwc3_qcom { - struct device *dev; - void __iomem *qscratch_base; -@@ -56,6 +71,8 @@ struct dwc3_qcom { - struct notifier_block vbus_nb; - struct notifier_block host_nb; - -+ const struct dwc3_acpi_pdata *acpi_pdata; -+ - enum usb_dr_mode mode; - bool is_suspended; - bool pm_suspended; -@@ -300,12 +317,27 @@ static void dwc3_qcom_select_utmi_clk(struct dwc3_qcom *qcom) - PIPE_UTMI_CLK_DIS); - } - -+static int dwc3_qcom_get_irq(struct platform_device *pdev, -+ const char *name, int num) -+{ -+ struct device_node *np = pdev->dev.of_node; -+ int ret; -+ -+ if (np) -+ ret = platform_get_irq_byname(pdev, name); -+ else -+ ret = platform_get_irq(pdev, num); -+ -+ return ret; -+} -+ - static int dwc3_qcom_setup_irq(struct platform_device *pdev) - { - struct dwc3_qcom *qcom = platform_get_drvdata(pdev); -+ const struct dwc3_acpi_pdata *pdata = qcom->acpi_pdata; - int irq, ret; -- -- irq = platform_get_irq_byname(pdev, "hs_phy_irq"); -+ irq = dwc3_qcom_get_irq(pdev, "hs_phy_irq", -+ pdata ? pdata->hs_phy_irq_index : -1); - if (irq > 0) { - /* Keep wakeup interrupts disabled until suspend */ - irq_set_status_flags(irq, IRQ_NOAUTOEN); -@@ -320,7 +352,8 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) - qcom->hs_phy_irq = irq; - } - -- irq = platform_get_irq_byname(pdev, "dp_hs_phy_irq"); -+ irq = dwc3_qcom_get_irq(pdev, "dp_hs_phy_irq", -+ pdata ? pdata->dp_hs_phy_irq_index : -1); - if (irq > 0) { - irq_set_status_flags(irq, IRQ_NOAUTOEN); - ret = devm_request_threaded_irq(qcom->dev, irq, NULL, -@@ -334,7 +367,8 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) - qcom->dp_hs_phy_irq = irq; - } - -- irq = platform_get_irq_byname(pdev, "dm_hs_phy_irq"); -+ irq = dwc3_qcom_get_irq(pdev, "dm_hs_phy_irq", -+ pdata ? pdata->dm_hs_phy_irq_index : -1); - if (irq > 0) { - irq_set_status_flags(irq, IRQ_NOAUTOEN); - ret = devm_request_threaded_irq(qcom->dev, irq, NULL, -@@ -348,7 +382,8 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) - qcom->dm_hs_phy_irq = irq; - } - -- irq = platform_get_irq_byname(pdev, "ss_phy_irq"); -+ irq = dwc3_qcom_get_irq(pdev, "ss_phy_irq", -+ pdata ? pdata->ss_phy_irq_index : -1); - if (irq > 0) { - irq_set_status_flags(irq, IRQ_NOAUTOEN); - ret = devm_request_threaded_irq(qcom->dev, irq, NULL, -@@ -371,11 +406,11 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count) - struct device_node *np = dev->of_node; - int i; - -- qcom->num_clocks = count; -- -- if (!count) -+ if (!np || !count) - return 0; - -+ qcom->num_clocks = count; -+ - qcom->clks = devm_kcalloc(dev, qcom->num_clocks, - sizeof(struct clk *), GFP_KERNEL); - if (!qcom->clks) -@@ -409,12 +444,103 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count) - return 0; - } - --static int dwc3_qcom_probe(struct platform_device *pdev) -+static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) - { -+ struct dwc3_qcom *qcom = platform_get_drvdata(pdev); -+ struct device *dev = &pdev->dev; -+ struct resource *res, *child_res = NULL; -+ int irq; -+ int ret; -+ -+ qcom->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); -+ if (!qcom->dwc3) -+ return -ENOMEM; -+ -+ qcom->dwc3->dev.parent = dev; -+ qcom->dwc3->dev.type = dev->type; -+ qcom->dwc3->dev.dma_mask = dev->dma_mask; -+ qcom->dwc3->dev.dma_parms = dev->dma_parms; -+ qcom->dwc3->dev.coherent_dma_mask = dev->coherent_dma_mask; -+ -+ child_res = kcalloc(2, sizeof(*child_res), GFP_KERNEL); -+ if (!child_res) -+ return -ENOMEM; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!res) { -+ dev_err(&pdev->dev, "failed to get memory resource\n"); -+ ret = -ENODEV; -+ goto out; -+ } -+ -+ child_res[0].flags = res->flags; -+ child_res[0].start = res->start; -+ child_res[0].end = child_res[0].start + -+ qcom->acpi_pdata->dwc3_core_base_size; -+ -+ irq = platform_get_irq(pdev, 0); -+ child_res[1].flags = IORESOURCE_IRQ; -+ child_res[1].start = child_res[1].end = irq; -+ -+ ret = platform_device_add_resources(qcom->dwc3, child_res, 2); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to add resources\n"); -+ goto out; -+ } -+ -+ ret = platform_device_add(qcom->dwc3); -+ if (ret) -+ dev_err(&pdev->dev, "failed to add device\n"); -+ -+out: -+ kfree(child_res); -+ return ret; -+} -+ -+static int dwc3_qcom_of_register_core(struct platform_device *pdev) -+{ -+ struct dwc3_qcom *qcom = platform_get_drvdata(pdev); - struct device_node *np = pdev->dev.of_node, *dwc3_np; - struct device *dev = &pdev->dev; -+ int ret; -+ -+ dwc3_np = of_get_child_by_name(np, "dwc3"); -+ if (!dwc3_np) { -+ dev_err(dev, "failed to find dwc3 core child\n"); -+ return -ENODEV; -+ } -+ -+ ret = of_platform_populate(np, NULL, NULL, dev); -+ if (ret) { -+ dev_err(dev, "failed to register dwc3 core - %d\n", ret); -+ return ret; -+ } -+ -+ qcom->dwc3 = of_find_device_by_node(dwc3_np); -+ if (!qcom->dwc3) { -+ dev_err(dev, "failed to get dwc3 platform device\n"); -+ return -ENODEV; -+ } -+ -+ return 0; -+} -+ -+static const struct dwc3_acpi_pdata sdm845_acpi_pdata = { -+ .qscratch_base_offset = SDM845_QSCRATCH_BASE_OFFSET, -+ .qscratch_base_size = SDM845_QSCRATCH_SIZE, -+ .dwc3_core_base_size = SDM845_DWC3_CORE_SIZE, -+ .hs_phy_irq_index = 1, -+ .dp_hs_phy_irq_index = 4, -+ .dm_hs_phy_irq_index = 3, -+ .ss_phy_irq_index = 2 -+}; -+ -+static int dwc3_qcom_probe(struct platform_device *pdev) -+{ -+ struct device_node *np = pdev->dev.of_node; -+ struct device *dev = &pdev->dev; - struct dwc3_qcom *qcom; -- struct resource *res; -+ struct resource *res, *parent_res = NULL; - int ret, i; - bool ignore_pipe_clk; - -@@ -425,6 +551,14 @@ static int dwc3_qcom_probe(struct platform_device *pdev) - platform_set_drvdata(pdev, qcom); - qcom->dev = &pdev->dev; - -+ if (ACPI_HANDLE(dev)) { -+ qcom->acpi_pdata = acpi_device_get_match_data(dev); -+ if (!qcom->acpi_pdata) { -+ dev_err(&pdev->dev, "no supporting ACPI device data\n"); -+ return -EINVAL; -+ } -+ } -+ - qcom->resets = devm_reset_control_array_get_optional_exclusive(dev); - if (IS_ERR(qcom->resets)) { - ret = PTR_ERR(qcom->resets); -@@ -454,7 +588,21 @@ static int dwc3_qcom_probe(struct platform_device *pdev) - } - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- qcom->qscratch_base = devm_ioremap_resource(dev, res); -+ -+ if (np) { -+ parent_res = res; -+ } else { -+ parent_res = kmemdup(res, sizeof(struct resource), GFP_KERNEL); -+ if (!parent_res) -+ return -ENOMEM; -+ -+ parent_res->start = res->start + -+ qcom->acpi_pdata->qscratch_base_offset; -+ parent_res->end = parent_res->start + -+ qcom->acpi_pdata->qscratch_base_size; -+ } -+ -+ qcom->qscratch_base = devm_ioremap_resource(dev, parent_res); - if (IS_ERR(qcom->qscratch_base)) { - dev_err(dev, "failed to map qscratch, err=%d\n", ret); - ret = PTR_ERR(qcom->qscratch_base); -@@ -462,13 +610,8 @@ static int dwc3_qcom_probe(struct platform_device *pdev) - } - - ret = dwc3_qcom_setup_irq(pdev); -- if (ret) -- goto clk_disable; -- -- dwc3_np = of_get_child_by_name(np, "dwc3"); -- if (!dwc3_np) { -- dev_err(dev, "failed to find dwc3 core child\n"); -- ret = -ENODEV; -+ if (ret) { -+ dev_err(dev, "failed to setup IRQs, err=%d\n", ret); - goto clk_disable; - } - -@@ -481,16 +624,13 @@ static int dwc3_qcom_probe(struct platform_device *pdev) - if (ignore_pipe_clk) - dwc3_qcom_select_utmi_clk(qcom); - -- ret = of_platform_populate(np, NULL, NULL, dev); -- if (ret) { -- dev_err(dev, "failed to register dwc3 core - %d\n", ret); -- goto clk_disable; -- } -+ if (np) -+ ret = dwc3_qcom_of_register_core(pdev); -+ else -+ ret = dwc3_qcom_acpi_register_core(pdev); - -- qcom->dwc3 = of_find_device_by_node(dwc3_np); -- if (!qcom->dwc3) { -- dev_err(&pdev->dev, "failed to get dwc3 platform device\n"); -- ret = -ENODEV; -+ if (ret) { -+ dev_err(dev, "failed to register DWC3 Core, err=%d\n", ret); - goto depopulate; - } - -@@ -514,7 +654,10 @@ static int dwc3_qcom_probe(struct platform_device *pdev) - return 0; - - depopulate: -- of_platform_depopulate(&pdev->dev); -+ if (np) -+ of_platform_depopulate(&pdev->dev); -+ else -+ platform_device_put(pdev); - clk_disable: - for (i = qcom->num_clocks - 1; i >= 0; i--) { - clk_disable_unprepare(qcom->clks[i]); -@@ -601,6 +744,12 @@ static const struct of_device_id dwc3_qcom_of_match[] = { - }; - MODULE_DEVICE_TABLE(of, dwc3_qcom_of_match); - -+static const struct acpi_device_id dwc3_qcom_acpi_match[] = { -+ { "QCOM2430", (unsigned long)&sdm845_acpi_pdata }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(acpi, dwc3_qcom_acpi_match); -+ - static struct platform_driver dwc3_qcom_driver = { - .probe = dwc3_qcom_probe, - .remove = dwc3_qcom_remove, -@@ -608,6 +757,7 @@ static struct platform_driver dwc3_qcom_driver = { - .name = "dwc3-qcom", - .pm = &dwc3_qcom_dev_pm_ops, - .of_match_table = dwc3_qcom_of_match, -+ .acpi_match_table = ACPI_PTR(dwc3_qcom_acpi_match), - }, - }; - --- -2.21.0 - -From 2511cdbc0cdd6dea8226fbb984418f06bc1983a9 Mon Sep 17 00:00:00 2001 -From: Lee Jones -Date: Mon, 10 Jun 2019 09:42:12 +0100 -Subject: [PATCH 7/8] usb: dwc3: qcom: Start USB in 'host mode' on the SDM845 - -When booting with Device Tree, the current default boot configuration -table option, the request to boot via 'host mode' comes from the -'dr_mode' property. A property of the same name can be used inside -ACPI tables too. However it is missing from the SDM845's ACPI tables -so we have to supply this information using Platform Device Properties -instead. - -This does not change the behaviour of any currently supported devices. -The property is only set on ACPI enabled platforms, thus for H/W -booting DT, unless a 'dr_mode' property is present, the default is -still OTG (On-The-Go) as per [0]. Any new ACPI devices added will -also be able to over-ride this implementation by providing a 'dr_mode' -property in their ACPI tables. In cases where 'dr_mode' is omitted -from the tables AND 'host mode' should not be the default (very -unlikely), then we will have to add some way of choosing between them -at run time - most likely by ACPI HID. - -[0] Documentation/devicetree/bindings/usb/generic.txt - -Signed-off-by: Lee Jones ---- - drivers/usb/dwc3/dwc3-qcom.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c -index 1e1f12b7991d..55ba04254e38 100644 ---- a/drivers/usb/dwc3/dwc3-qcom.c -+++ b/drivers/usb/dwc3/dwc3-qcom.c -@@ -444,6 +444,11 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count) - return 0; - } - -+static const struct property_entry dwc3_qcom_acpi_properties[] = { -+ PROPERTY_ENTRY_STRING("dr_mode", "host"), -+ {} -+}; -+ - static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) - { - struct dwc3_qcom *qcom = platform_get_drvdata(pdev); -@@ -488,6 +493,13 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) - goto out; - } - -+ ret = platform_device_add_properties(qcom->dwc3, -+ dwc3_qcom_acpi_properties); -+ if (ret < 0) { -+ dev_err(&pdev->dev, "failed to add properties\n"); -+ goto out; -+ } -+ - ret = platform_device_add(qcom->dwc3); - if (ret) - dev_err(&pdev->dev, "failed to add device\n"); --- -2.21.0 - -From 63a5217702e09f913bcc2d1c98285e7f3d9d1f31 Mon Sep 17 00:00:00 2001 -From: Lee Jones -Date: Mon, 10 Jun 2019 09:42:13 +0100 -Subject: [PATCH 8/8] usb: dwc3: qcom: Improve error handling - -dwc3_qcom_clk_init() is called with of_count_phandle_with_args() as an -argument. If of_count_phandle_with_args() returns an error, the number -of clocks will be a negative value and will lead to undefined behaviour. - -Ensure we check for an error before attempting to blindly use the value. - -Signed-off-by: Lee Jones -Reviewed-by: Bjorn Andersson ---- - drivers/usb/dwc3/dwc3-qcom.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c -index 55ba04254e38..e4dac82abd7d 100644 ---- a/drivers/usb/dwc3/dwc3-qcom.c -+++ b/drivers/usb/dwc3/dwc3-qcom.c -@@ -409,6 +409,9 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count) - if (!np || !count) - return 0; - -+ if (count < 0) -+ return count; -+ - qcom->num_clocks = count; - - qcom->clks = devm_kcalloc(dev, qcom->num_clocks, --- -2.21.0 - diff --git a/sources b/sources index d9a507699..24b5675e0 100644 --- a/sources +++ b/sources @@ -1,3 +1,2 @@ SHA512 (linux-5.1.tar.xz) = ae96f347badc95f1f3acf506c52b6cc23c0bd09ce8f4ce6705d4b4058b62593059bba1bc603c8d8b00a2f19131e7e56c31ac62b45883a346fa61d655e178f236 -SHA512 (patch-5.2-rc5.xz) = ee7caea50dccd299182da1453ca2a6f3f4947d544da81703e00b7f63e7c99d19975d4a34261282bbce36a8cf08060a60e51c095189a3aa43fdc34b67b05004c7 -SHA512 (patch-5.2-rc5-git2.xz) = c4ec98b8e357e4ff7049c0c73c922922fc708e71f0bae871b4a1c99d82631fe3f498a55931cc3c065454ef79189a0b7dfcff1250de4647c572cedb46714ed6b9 +SHA512 (patch-5.2-rc7.xz) = 07e23e8003f2c69b194fa59a5bd8ea3d200f7c16d4577c2b55b0e78d48c083c2770c941dbd32221a313c63f3954ac071eef7bce03d85eeaa3f32f78c378841d6