From patchwork Wed Nov 7 10:12:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10672095 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 329C715E9 for ; Wed, 7 Nov 2018 10:16:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20F3A28DEE for ; Wed, 7 Nov 2018 10:16:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13D4C2B9E6; Wed, 7 Nov 2018 10:16:29 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 C0A72284E9 for ; Wed, 7 Nov 2018 10:16:28 +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=C1C8Yj4F+v/x8YJD6GgI1vk2aNYpN0joU+dZZodgTAs=; b=Eb4V68l86LjkLe laBMmXLvDRT3dmC+nkQeyigBYfGSde2S2CzabBBHelqz8RIkQ1ryifASotkSrqYfPNFgtF5Sryx83 9WEZscX1NM/WkVdPfYTVnfuIr6FZdjUUMO56/Y7daLhweyFa0cqhJ73DYlnYgQk9RZq/S3RC0ObNM KosvPHRyjm5Mr45QBkHLuJAzfSMAGgL0uet3t4LhslBYh4qgpI9xDD1K2ZQ8U5k8rkRr+pxKLSBDK /tlhOo+GLJKZoUoi1RwoxLbO+IthpZl5zwUsc6PQ5AUMjpxeiGISINjv1kII28iehwk4p+eTSLNuI cS42GTfns45/PRkc95bA==; 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 1gKKsr-00078N-Ef; Wed, 07 Nov 2018 10:16:25 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKKqS-0003YV-KQ for linux-arm-kernel@bombadil.infradead.org; Wed, 07 Nov 2018 10:13:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=rxBgY5hQXeMDpPrAVvhZxCEnwFscEHTduTHmHGRRcyA=; b=G41mwSnVU4I9RnOKu6qTR9pC7k KWPWH5Qyp2conWGrE0oaP011w9zqJDsn6VYYWZFmyd3S5bCZpW61ClJCvAqsZK/aGRMFUHo7TjPiB 7SrqGA0db2sQ2i7y3BaEQpE2dDch9YS/CJgln1VnZsikf4tKDlMlyIqXWDYmiZNn8o4V6ndkf0KLs TISLA44n0Mw3cmvjt4BPkkjRavCHG8Ys7lDHqMbQiu4P2o+3dMFXZXEL4SKh/N+gWmrSLGH2sTx0A 2tm2dATiz7bKE11YaKboMEUzTAuY6mNI16ceEV2X7Vc39d8Z/Haxo2wqnw0YzI544/4aXmkTaJRxN SKWAo+lg==; Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKKqP-0003B8-4f for linux-arm-kernel@lists.infradead.org; Wed, 07 Nov 2018 10:13:54 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 6E4B95FCC3; Wed, 7 Nov 2018 18:13:16 +0800 (CST) From: Chen-Yu Tsai To: Marcel Holtmann , Johan Hedberg , Rob Herring , Mark Rutland , Maxime Ripard Subject: [PATCH 05/15] Bluetooth: hci_bcm: Handle deferred probing for the clock supply Date: Wed, 7 Nov 2018 18:12:58 +0800 Message-Id: <20181107101308.7626-6-wens@csie.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181107101308.7626-1-wens@csie.org> References: <20181107101308.7626-1-wens@csie.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181107_101353_539780_8500D3C6 X-CRM114-Status: GOOD ( 12.62 ) 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: devicetree@vger.kernel.org, Chen-Yu Tsai , linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-sunxi@googlegroups.com, Loic Poulain , linux-arm-kernel@lists.infradead.org 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 On some systems that actually have the bluetooth controller wired up with an extra clock signal, it's possible the bluetooth controller probes before the clock provider. clk_get would return a defer probe error, which was not handled by this driver. Handle this properly, so that these systems can work reliably. Signed-off-by: Chen-Yu Tsai --- drivers/bluetooth/hci_bcm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index ddbd8c6a0ceb..0a20ad48b511 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -907,6 +907,10 @@ static int bcm_get_resources(struct bcm_device *dev) dev->clk = devm_clk_get(dev->dev, NULL); + /* Handle deferred probing */ + if (IS_ERR(dev->clk) && PTR_ERR(dev->clk) == -EPROBE_DEFER) + return PTR_ERR(dev->clk); + dev->device_wakeup = devm_gpiod_get_optional(dev->dev, "device-wakeup", GPIOD_OUT_LOW); if (IS_ERR(dev->device_wakeup))