Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3931873pxb; Tue, 2 Nov 2021 00:41:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmFpxRid5F70VOUadGjTEERbdVhTtl2qBMPVuBWXzbQOqkEIdz5z3JNcgAszR9qMGYqtnp X-Received: by 2002:a05:6402:b5c:: with SMTP id bx28mr24789068edb.130.1635838904952; Tue, 02 Nov 2021 00:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635838904; cv=none; d=google.com; s=arc-20160816; b=cFCKgfzOfJbR2kb1LRfi6fU8+ERf/LtG29MTfZ8zsuZO52YXgPcSP7BeRbsTbGT38k knj0S8TRFj8b74qoP/IJfZpp03edWiwAKyK3uSiM93IdkzcuS0b96bn1Gz3je9vWRouF lP1+Y4edqqNp74Kim2v+OT+EWpSGm2FvpUSat9SDJhJC8/jfG74RIGIqP+jil0xEmjbk ebhyglv6InuAW6qzFQYg6tOdPyd//OXYO8YufZcx9EwjI0O4zmqNgpzwMNgk8q42Tge6 PF6oagYch5D3+ZiF4Hqwkx2nWa8eB9NITbfXaDl2yRWQIjvvo4KycCnOlzKpHOlvq9R2 d7rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=fSqbf7zuEViG17kmpn0XjGzN3SSqyh3nxxg2NmXqPM0=; b=kDfVWQWtWr9MjBeifc69XDFVdoPL6F2UmxzRWa+jzwHNen4mB5PXxxSNHwtDVddbus k+0Ih8DHzuMpNizlHJGjFN972lKyOrCIj09MpQhv1PP6HkD4itPgdRJN+H0W1Jnl30ye vmjpUn4k36IW2CRCCSQfAQBJpukSkeTUaZTacIxAzggSTkdFocr5GbbvHZrAvrSQTBOH jWswGxE97FSYi7YdsLIKfx/GO8GMZWnVqp5mqcs1SM7ROvmsRRd6A1DSIXgaUIOISNp1 wwhcrxvwDBQ1iozG/eKnbic7pnhw57+gYemFjK4c0lwy8wqRDOqrdkqZdEih9+hPyx9V nH6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qf24si5575734ejc.430.2021.11.02.00.41.20; Tue, 02 Nov 2021 00:41:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230005AbhKBHnY convert rfc822-to-8bit (ORCPT + 99 others); Tue, 2 Nov 2021 03:43:24 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:53142 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbhKBHnX (ORCPT ); Tue, 2 Nov 2021 03:43:23 -0400 Received: from smtpclient.apple (p4fefc15c.dip0.t-ipconnect.de [79.239.193.92]) by mail.holtmann.org (Postfix) with ESMTPSA id 971E6CECE9; Tue, 2 Nov 2021 08:40:47 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.20.0.1.32\)) Subject: Re: [PATCH v1 3/3] Bluetooth: hci_qca: Add support for QTI bluetooth MAPLE From: Marcel Holtmann In-Reply-To: Date: Tue, 2 Nov 2021 08:40:47 +0100 Cc: Zijun Hu , Johan Hedberg , Linux Kernel Mailing List , linux-bluetooth , MSM , Balakrishna Godavarthi , c-hbandi@codeaurora.org, Hemantg , Matthias Kaehlcke , rjliao@codeaurora.org, Zijun Hu Content-Transfer-Encoding: 8BIT Message-Id: References: <1635837177-1341-1-git-send-email-zijuhu@codeaurora.org> To: Greg KH X-Mailer: Apple Mail (2.3693.20.0.1.32) Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Greg, >> Add support for MAPLE integrated within SOC, it is mounted on >> a virtual tty port and powered on/off via relevant IOCTL, neither >> IBS nor RAMPATCH downloading is not required. >> >> Signed-off-by: Zijun Hu >> --- >> drivers/bluetooth/btqca.c | 13 ++++++++++++- >> drivers/bluetooth/btqca.h | 13 +++++++++++++ >> drivers/bluetooth/hci_qca.c | 47 ++++++++++++++++++++++++++++++++++++++++++++- >> 3 files changed, 71 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c >> index be04d74037d2..b83d2ecefe5d 100644 >> --- a/drivers/bluetooth/btqca.c >> +++ b/drivers/bluetooth/btqca.c >> @@ -255,6 +255,8 @@ static void qca_tlv_check_data(struct hci_dev *hdev, >> BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x000000ff); >> BT_DBG("Length\t\t : %d bytes", length); >> >> + if (qca_is_maple(soc_type)) >> + break; >> idx = 0; >> data = tlv->data; >> while (idx < length) { >> @@ -552,6 +554,9 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, >> rom_ver = ((soc_ver & 0x00000f00) >> 0x04) | (soc_ver & 0x0000000f); >> >> /* Download rampatch file */ >> + if (qca_is_maple(soc_type)) >> + goto download_nvm; >> + >> config.type = TLV_TYPE_PATCH; >> if (qca_is_wcn399x(soc_type)) { >> snprintf(config.fwname, sizeof(config.fwname), >> @@ -580,6 +585,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, >> /* Give the controller some time to get ready to receive the NVM */ >> msleep(10); >> >> +download_nvm: >> /* Download NVM configuration */ >> config.type = TLV_TYPE_NVM; >> if (firmware_name) >> @@ -597,6 +603,9 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, >> else if (soc_type == QCA_QCA6390) >> snprintf(config.fwname, sizeof(config.fwname), >> "qca/htnv%02x.bin", rom_ver); >> + else if (qca_is_maple(soc_type)) >> + snprintf(config.fwname, sizeof(config.fwname), >> + "qca/mpnv%02x.bin", rom_ver); >> else if (soc_type == QCA_WCN6750) >> snprintf(config.fwname, sizeof(config.fwname), >> "qca/msnv%02x.bin", rom_ver); >> @@ -609,6 +618,8 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, >> bt_dev_err(hdev, "QCA Failed to download NVM (%d)", err); >> return err; >> } >> + if (qca_is_maple(soc_type)) >> + msleep(MAPLE_NVM_READY_DELAY_MS); >> >> if (soc_type >= QCA_WCN3991) { >> err = qca_disable_soc_logging(hdev); >> @@ -637,7 +648,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, >> return err; >> } >> >> - if (soc_type == QCA_WCN3991 || soc_type == QCA_WCN6750) { >> + if (soc_type == QCA_WCN3991 || soc_type == QCA_WCN6750 || qca_is_maple(soc_type)) { >> /* get fw build info */ >> err = qca_read_fw_build_info(hdev); >> if (err < 0) >> diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h >> index 30afa7703afd..0a5a7d1daa71 100644 >> --- a/drivers/bluetooth/btqca.h >> +++ b/drivers/bluetooth/btqca.h >> @@ -46,6 +46,8 @@ >> >> #define QCA_FW_BUILD_VER_LEN 255 >> >> +#define MAPLE_NVM_READY_DELAY_MS 1500 >> +#define MAPLE_POWER_CONTROL_DELAY_MS 50 >> >> enum qca_baudrate { >> QCA_BAUDRATE_115200 = 0, >> @@ -145,6 +147,7 @@ enum qca_btsoc_type { >> QCA_WCN3991, >> QCA_QCA6390, >> QCA_WCN6750, >> + QCA_MAPLE, >> }; >> >> #if IS_ENABLED(CONFIG_BT_QCA) >> @@ -167,6 +170,11 @@ static inline bool qca_is_wcn6750(enum qca_btsoc_type soc_type) >> return soc_type == QCA_WCN6750; >> } >> >> +static inline bool qca_is_maple(enum qca_btsoc_type soc_type) >> +{ >> + return soc_type == QCA_MAPLE; >> +} >> + >> #else >> >> static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr) >> @@ -204,6 +212,11 @@ static inline bool qca_is_wcn6750(enum qca_btsoc_type soc_type) >> return false; >> } >> >> +static inline bool qca_is_maple(enum qca_btsoc_type soc_type) >> +{ >> + return false; >> +} >> + >> static inline int qca_send_pre_shutdown_cmd(struct hci_dev *hdev) >> { >> return -EOPNOTSUPP; >> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c >> index dd768a8ed7cb..f1d9670719c4 100644 >> --- a/drivers/bluetooth/hci_qca.c >> +++ b/drivers/bluetooth/hci_qca.c >> @@ -70,6 +70,10 @@ >> #define QCA_CRASHBYTE_PACKET_LEN 1096 >> #define QCA_MEMDUMP_BYTE 0xFB >> >> +#ifndef IOCTL_IPC_BOOT >> +#define IOCTL_IPC_BOOT 0xBE >> +#endif > > You send this command, but never use it. Where is the driver code that > uses this command? > > And why not tabs? > > And why is this patch series not properly threaded so tools can pick it > up and find them? > > And why the odd named ioctl that is different from other ones in this > file? > > And why not just use normal power management hooks for doing things like > turning on and off the hardware like all other drivers? I am not merging this. We are not starting an IPC via an external ioctl. Regards Marcel