Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp408164ybl; Fri, 30 Aug 2019 01:27:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRMz51oTCcSLdzyX5Te2RkqREsYhpPixSxP1l8wosSzpBynTHDFMrSFCF4YW6clZHNKTX6 X-Received: by 2002:aa7:85cd:: with SMTP id z13mr17006507pfn.214.1567153662957; Fri, 30 Aug 2019 01:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567153662; cv=none; d=google.com; s=arc-20160816; b=tefMXfFbOsZHM6Mbe3j5rUNemVeD7R6EUb80XgHKlHssawGfTwarXmXmce0/xlcTof ztquWnH94V7vnPQk8U/nfq9/cDcdN/ImQLMiuL7bvoWHsQmoEce4ifpOHc7HNjLmqTfA dKDF5FzCbcqp9kW9gG0I68k7aIZQxyIBwDq9NrDVux6kOILcFHNV8Yc9lEekklv+CyG8 lHv0cvBkSqZEzT8gw1JOv3WgkvYdXVpFWCBspH6HZCpy8M3U1EDUyUmdqqKVOEsTBOfh rg9L6ANYIeJb7aUcpDnLLjey3t7gK8zmROX5uQ6kVcpkrxl4bMzQaAZMX5fWdesZEgYz 6NqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature; bh=sXr8I9bdBxGs8D8wktlHK9A0GLpGLtJqQgi94pqaIL4=; b=I7coyAdOfluex/S4rRvAp91wB4+FG9sIDRjNiorI+k6oXxQJQX2RD4Wm6srgx4t4zE PzH2/KvicCpT2r5lEcGRpN3bGMDrk2lCtk2/jw7bjJLQQLAKgWppLalOwrkyTHpUG27n aUK83okmp/BualMd2Cy5t7vu0J7KG+UoWvV5QS34WUJBLU+AcVIfZwKdM6uG7G0c3+4R +0sPOaGTYOkpGqyAhSYy5F0nabEW1pO7azJLXIgWYhzZ2yiEvbKHt6wOTKd1dldnXtHQ zTxYBjaSu9J6/lt5hYGMEXYQJTlnW/DLsxvNYO1FFS371hhT/IrhlTvi2kcn1mAiEHKE BsIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=b18bVQjK; dkim=pass header.i=@codeaurora.org header.s=default header.b=Y5BEWXLj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q16si5804506pfl.234.2019.08.30.01.27.27; Fri, 30 Aug 2019 01:27:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=b18bVQjK; dkim=pass header.i=@codeaurora.org header.s=default header.b=Y5BEWXLj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727926AbfH3I0g (ORCPT + 99 others); Fri, 30 Aug 2019 04:26:36 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:42954 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726492AbfH3I0g (ORCPT ); Fri, 30 Aug 2019 04:26:36 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 686366155C; Fri, 30 Aug 2019 08:26:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1567153594; bh=fe+1CIFsLrsFmj7GnadvoGOHiiGzQrdsXLHYlpV+vnM=; h=From:To:Cc:Subject:Date:From; b=b18bVQjK0tujCHtmNVN7r2uJvzBYrVzIEND/NqFYiponvrWVncdoFvGUewLCFt+hr i5FWd3mfndhPExuUKD+DtyopBFJAqM/xDKSSHRE3RqJ0n/YF0vb1Dj6YD9r2Tl6BNL 2MiNFmcExEjQMbDS9yZW7jv6386j9+dVn+MD0/7E= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from c-hbandi-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: c-hbandi@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id DF1876333C; Fri, 30 Aug 2019 08:26:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1567153591; bh=fe+1CIFsLrsFmj7GnadvoGOHiiGzQrdsXLHYlpV+vnM=; h=From:To:Cc:Subject:Date:From; b=Y5BEWXLjOCPvhsZGooH78akW+LC0OFO32rHaVS3BdJf4WgOtuUVzL9euDsFqlDTjB ItOz53j7ogyCFylAvNVbSW6wUL2C7jcAIXKK4qaascaLjOrQaKtmmCqi9BoWUg+QaF WUabcHePRtcPdhyiuInrTKHEE6ToJKB2/NG2F8hk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org DF1876333C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=c-hbandi@codeaurora.org From: Harish Bandi To: marcel@holtmann.org, johan.hedberg@gmail.com Cc: mka@chromium.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, hemantg@codeaurora.org, linux-arm-msm@vger.kernel.org, bgodavar@codeaurora.org, anubhavg@codeaurora.org, Harish Bandi Subject: [PATCH v2] Bluetooth: hci_qca: wait for Pre shutdown complete event before sending the Power off pulse Date: Fri, 30 Aug 2019 13:56:16 +0530 Message-Id: <1567153576-16895-1-git-send-email-c-hbandi@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When SoC receives pre shut down command, it share the same with other COEX shared clients. So SoC needs a short time after sending VS pre shutdown command before turning off the regulators and sending the power off pulse. Along with short delay, needs to wait for command complete event for Pre shutdown VS command Signed-off-by: Harish Bandi Reviewed-by: Balakrishna Godavarthi --- Changes in V2: - Modified commit text. --- drivers/bluetooth/btqca.c | 22 ++++++++++++++++++++++ drivers/bluetooth/hci_qca.c | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c index 8b33128..d48dc9e 100644 --- a/drivers/bluetooth/btqca.c +++ b/drivers/bluetooth/btqca.c @@ -99,6 +99,28 @@ static int qca_send_reset(struct hci_dev *hdev) return 0; } +int qca_send_pre_shutdown_cmd(struct hci_dev *hdev) +{ + struct sk_buff *skb; + int err; + + bt_dev_dbg(hdev, "QCA pre shutdown cmd"); + + skb = __hci_cmd_sync_ev(hdev, QCA_PRE_SHUTDOWN_CMD, 0, + NULL, HCI_EV_CMD_COMPLETE, HCI_INIT_TIMEOUT); + + if (IS_ERR(skb)) { + err = PTR_ERR(skb); + bt_dev_err(hdev, "QCA preshutdown_cmd failed (%d)", err); + return err; + } + + kfree_skb(skb); + + return 0; +} +EXPORT_SYMBOL_GPL(qca_send_pre_shutdown_cmd); + static void qca_tlv_check_data(struct rome_config *config, const struct firmware *fw) { diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index ab4c18e..43df13c 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -1367,6 +1367,11 @@ static int qca_power_off(struct hci_dev *hdev) { struct hci_uart *hu = hci_get_drvdata(hdev); + /* Perform pre shutdown command */ + qca_send_pre_shutdown_cmd(hdev); + + usleep_range(8000, 10000); + qca_power_shutdown(hu); return 0; } -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project