Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5172075img; Wed, 27 Mar 2019 03:37:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJqvNiCm4UXfendpIKjW7Drae8/3f8tufqmMnw8jdmkQ3UlDoruzXaCAxYvyMB1MJ2hmOt X-Received: by 2002:a63:fd06:: with SMTP id d6mr11583152pgh.183.1553683038327; Wed, 27 Mar 2019 03:37:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553683038; cv=none; d=google.com; s=arc-20160816; b=OXl2AG8PYDhGyDYdndPRvXANbkyQVx4tgQEhkNaFM2S3a5JiCJY3gWO2LxGYS9lyEY hllys9NSiRw3IffIzG15381BsJ2lxvEAzVe7vKLX8EmK3qk4WtWxiFnEEJXvEhyP0ZnO woKgja69/U5UZTgahR7YeY4wkArkmRKgE/+BwtjXvIwnlklwJbCF3LGwVZVdfAC4Agmb 84y42NHagWhQjoy1+AFy12wEN3Z0F6eRSjylNbjxqaNKq0FbmZd9hs8j3ZhSYUJu+FI7 k7NOwUD8P2UNGHRlvH7zu6Pe+vn4A0keciwWVrI5NAQsCn+rgoQ1MBGibV0TURruz5Oo 8Dfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature; bh=yKtcCvybmBEFXWv/zqPKz3ONgkVOg/mGMqEcPgLGl60=; b=d7ynoYgikXvkkpOb3l1U0IkfynIMHIfrByjHa6h5JBPBAWRnecXAFplu7df3Gc8cpl aBV+gRk8co1o0Alghm77QZHncO3Yi/ypU5YQiYnLlwSckVu73RIdecFlGOE3Mll7Dbj3 CGaZm4ktozWQDRbSLrrbNcf9FJZaciKDPTR8u/AfJBclyiTbabzZYy4sBQWpX7po4MgK sbqnr9T3O6Uq4wALRKImiMHFuRQrTXwYsW8LgAndzY/xRFwAhDUWpqQ+LZr1RDyj+F4t LesYTca7gzOgAr0JjJwxc/6kEU5sQlqkXbUluRNg4V8odML80xfDrNcHfTgsPHdHc/24 3mtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=XmworPG1; dkim=pass header.i=@codeaurora.org header.s=default header.b=BiogtWhX; 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 e10si17532763pgo.404.2019.03.27.03.37.02; Wed, 27 Mar 2019 03:37:18 -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=XmworPG1; dkim=pass header.i=@codeaurora.org header.s=default header.b=BiogtWhX; 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 S1732672AbfC0KgR (ORCPT + 99 others); Wed, 27 Mar 2019 06:36:17 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:34452 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727936AbfC0KgR (ORCPT ); Wed, 27 Mar 2019 06:36:17 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4ED2F60F3D; Wed, 27 Mar 2019 10:36:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553682975; bh=1kAu9FMdSZv3yup+qfNRLQoL6lZc00JcHMhXPNz/+j0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XmworPG1DSfEREe4MYzij0qqErN2qtMq3/BOUn5KLhBfR30VTQCE6cu5tacoL0JvX 71SQLKhLi5q7pofybJ+a2pUDt8n5L5++Qod3IImkbje85wldOLdmvbA4dSErare61z q+HS9SW6pogybvssvgeW+eLbQoiQz8vc7PhmQrv0= 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 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id E951B607C6; Wed, 27 Mar 2019 10:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553682972; bh=1kAu9FMdSZv3yup+qfNRLQoL6lZc00JcHMhXPNz/+j0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BiogtWhX+9dsojr/nEcu7JIS/2T8LUUGuFYlKefVee7+8XHEoAifF5M6hnVChedVw 9MjRFO/NA8q5rI1xIi8Qe/QoN/QgmogEKR0GE3rU+qG6CirKkxNlqOHRaGMomAeIvW nifBy6Jv/KE0AJrBnnt8Mgpa9e12AyggSQuazYNM= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 27 Mar 2019 16:06:11 +0530 From: Harish Bandi To: Matthias Kaehlcke Cc: marcel@holtmann.org, johan.hedberg@gmail.com, 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, devicetree@vger.kernel.org, mark.rutland@arm.com, robh+dt@kernel.org Subject: Re: [PATCH v5 1/2] Bluetooth: hci_qca: Added support for WCN3998 In-Reply-To: <20190326234403.GZ112750@google.com> References: <1553600756-8264-1-git-send-email-c-hbandi@codeaurora.org> <1553600756-8264-2-git-send-email-c-hbandi@codeaurora.org> <20190326234403.GZ112750@google.com> Message-ID: <0bc9e4191ecd2c33bf852bef9ad8ecf2@codeaurora.org> X-Sender: c-hbandi@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Matthias, On 2019-03-27 05:14, Matthias Kaehlcke wrote: > On Tue, Mar 26, 2019 at 05:15:55PM +0530, Harish Bandi wrote: >> Added new compatible for WCN3998 and corresponding voltage >> and current values to WCN3998 compatible. >> Changed driver code to support WCN3998 >> >> Signed-off-by: Harish Bandi >> --- >> Changes in V5: >> - changed is_qca_soc_type_wcn399x_family to >> - qca_is_wcn399x helper function >> - moved the qca_is_wcn399x function to btqca.c >> --- >> drivers/bluetooth/btqca.c | 13 +++++++++++-- >> drivers/bluetooth/btqca.h | 8 +++++++- >> drivers/bluetooth/hci_qca.c | 40 >> ++++++++++++++++++++++++++-------------- >> 3 files changed, 44 insertions(+), 17 deletions(-) >> >> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c >> index 6122685..383e99f 100644 >> --- a/drivers/bluetooth/btqca.c >> +++ b/drivers/bluetooth/btqca.c >> @@ -344,7 +344,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t >> baudrate, >> >> /* Download rampatch file */ >> config.type = TLV_TYPE_PATCH; >> - if (soc_type == QCA_WCN3990) { >> + if (qca_is_wcn399x(soc_type)) { >> /* Firmware files to download are based on ROM version. >> * ROM version is derived from last two bytes of soc_ver. >> */ >> @@ -365,7 +365,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t >> baudrate, >> >> /* Download NVM configuration */ >> config.type = TLV_TYPE_NVM; >> - if (soc_type == QCA_WCN3990) >> + if (qca_is_wcn399x(soc_type)) >> snprintf(config.fwname, sizeof(config.fwname), >> "qca/crnv%02x.bin", rom_ver); >> else >> @@ -410,6 +410,15 @@ int qca_set_bdaddr(struct hci_dev *hdev, const >> bdaddr_t *bdaddr) >> } >> EXPORT_SYMBOL_GPL(qca_set_bdaddr); >> >> +bool qca_is_wcn399x(enum qca_btsoc_type soc_type) >> +{ >> + if ((soc_type == QCA_WCN3990) || (soc_type == QCA_WCN3998)) >> + return true; >> + >> + return false; >> +} >> +EXPORT_SYMBOL_GPL(qca_is_wcn399x); >> + >> MODULE_AUTHOR("Ben Young Tae Kim "); >> MODULE_DESCRIPTION("Bluetooth support for Qualcomm Atheros family ver >> " VERSION); >> MODULE_VERSION(VERSION); >> diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h >> index 6fdc25d..aca7b0d 100644 >> --- a/drivers/bluetooth/btqca.h >> +++ b/drivers/bluetooth/btqca.h >> @@ -132,7 +132,8 @@ enum qca_btsoc_type { >> QCA_INVALID = -1, >> QCA_AR3002, >> QCA_ROME, >> - QCA_WCN3990 >> + QCA_WCN3990, >> + QCA_WCN3998, >> }; >> >> #if IS_ENABLED(CONFIG_BT_QCA) >> @@ -142,6 +143,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t >> baudrate, >> enum qca_btsoc_type soc_type, u32 soc_ver); >> int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version); >> int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr); >> +bool qca_is_wcn399x(enum qca_btsoc_type soc_type); >> #else >> >> static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const >> bdaddr_t *bdaddr) >> @@ -165,4 +167,8 @@ static inline int qca_set_bdaddr(struct hci_dev >> *hdev, const bdaddr_t *bdaddr) >> return -EOPNOTSUPP; >> } >> >> +static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type) >> +{ >> + return -EOPNOTSUPP; > > This function returns a bool, hence returning an error code is not > meaningful here. Just return false. [Harish] - ok will correct it new patch. > >> +} >> #endif >> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c >> index 4ea995d..4af580a 100644 >> --- a/drivers/bluetooth/hci_qca.c >> +++ b/drivers/bluetooth/hci_qca.c >> @@ -521,7 +521,7 @@ static int qca_open(struct hci_uart *hu) >> if (hu->serdev) { >> >> qcadev = serdev_device_get_drvdata(hu->serdev); >> - if (qcadev->btsoc_type != QCA_WCN3990) { >> + if (!qca_is_wcn399x(qcadev->btsoc_type)) { >> gpiod_set_value_cansleep(qcadev->bt_en, 1); >> } else { >> hu->init_speed = qcadev->init_speed; >> @@ -627,7 +627,7 @@ static int qca_close(struct hci_uart *hu) >> >> if (hu->serdev) { >> qcadev = serdev_device_get_drvdata(hu->serdev); >> - if (qcadev->btsoc_type == QCA_WCN3990) >> + if (qca_is_wcn399x(qcadev->btsoc_type)) >> qca_power_shutdown(hu); >> else >> gpiod_set_value_cansleep(qcadev->bt_en, 0); >> @@ -1008,7 +1008,7 @@ static int qca_set_baudrate(struct hci_dev >> *hdev, uint8_t baudrate) >> msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS)); >> >> /* Give the controller time to process the request */ >> - if (qca_soc_type(hu) == QCA_WCN3990) >> + if (qca_is_wcn399x(qca_soc_type(hu))) >> msleep(10); >> else >> msleep(300); >> @@ -1084,7 +1084,7 @@ static unsigned int qca_get_speed(struct >> hci_uart *hu, >> >> static int qca_check_speeds(struct hci_uart *hu) >> { >> - if (qca_soc_type(hu) == QCA_WCN3990) { >> + if (qca_is_wcn399x(qca_soc_type(hu))) { >> if (!qca_get_speed(hu, QCA_INIT_SPEED) && >> !qca_get_speed(hu, QCA_OPER_SPEED)) >> return -EINVAL; >> @@ -1116,7 +1116,7 @@ static int qca_set_speed(struct hci_uart *hu, >> enum qca_speed_type speed_type) >> /* Disable flow control for wcn3990 to deassert RTS while >> * changing the baudrate of chip and host. >> */ >> - if (soc_type == QCA_WCN3990) >> + if (qca_is_wcn399x(soc_type)) >> hci_uart_set_flow_control(hu, true); >> >> qca_baudrate = qca_get_baudrate_value(speed); >> @@ -1128,7 +1128,7 @@ static int qca_set_speed(struct hci_uart *hu, >> enum qca_speed_type speed_type) >> host_set_baudrate(hu, speed); >> >> error: >> - if (soc_type == QCA_WCN3990) >> + if (qca_is_wcn399x(soc_type)) >> hci_uart_set_flow_control(hu, false); >> } >> >> @@ -1201,7 +1201,7 @@ static int qca_setup(struct hci_uart *hu) >> /* Patch downloading has to be done without IBS mode */ >> clear_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags); >> >> - if (soc_type == QCA_WCN3990) { >> + if (qca_is_wcn399x(soc_type)) { >> bt_dev_info(hdev, "setting up wcn3990"); >> >> /* Enable NON_PERSISTENT_SETUP QUIRK to ensure to execute >> @@ -1232,7 +1232,7 @@ static int qca_setup(struct hci_uart *hu) >> qca_baudrate = qca_get_baudrate_value(speed); >> } >> >> - if (soc_type != QCA_WCN3990) { >> + if (!qca_is_wcn399x(soc_type)) { >> /* Get QCA version information */ >> ret = qca_read_soc_version(hdev, &soc_ver); >> if (ret) >> @@ -1257,7 +1257,7 @@ static int qca_setup(struct hci_uart *hu) >> } >> >> /* Setup bdaddr */ >> - if (soc_type == QCA_WCN3990) >> + if (qca_is_wcn399x(soc_type)) >> hu->hdev->set_bdaddr = qca_set_bdaddr; >> else >> hu->hdev->set_bdaddr = qca_set_bdaddr_rome; >> @@ -1280,7 +1280,7 @@ static int qca_setup(struct hci_uart *hu) >> .dequeue = qca_dequeue, >> }; >> >> -static const struct qca_vreg_data qca_soc_data = { >> +static const struct qca_vreg_data qca_soc_data_wcn3990 = { >> .soc_type = QCA_WCN3990, >> .vregs = (struct qca_vreg []) { >> { "vddio", 1800000, 1900000, 15000 }, >> @@ -1291,6 +1291,17 @@ static int qca_setup(struct hci_uart *hu) >> .num_vregs = 4, >> }; >> >> +static const struct qca_vreg_data qca_soc_data_wcn3998 = { >> + .soc_type = QCA_WCN3998, >> + .vregs = (struct qca_vreg []) { >> + { "vddio", 1800000, 1900000, 10000 }, >> + { "vddxo", 1800000, 1900000, 80000 }, >> + { "vddrf", 1300000, 1352000, 300000 }, >> + { "vddch0", 3300000, 3300000, 450000 }, >> + }, >> + .num_vregs = 4, >> +}; >> + >> static void qca_power_shutdown(struct hci_uart *hu) >> { >> struct qca_data *qca = hu->priv; >> @@ -1424,8 +1435,8 @@ static int qca_serdev_probe(struct serdev_device >> *serdev) >> qcadev->serdev_hu.serdev = serdev; >> data = of_device_get_match_data(&serdev->dev); >> serdev_device_set_drvdata(serdev, qcadev); >> - if (data && data->soc_type == QCA_WCN3990) { >> - qcadev->btsoc_type = QCA_WCN3990; >> + if (data && qca_is_wcn399x(data->soc_type)) { >> + qcadev->btsoc_type = data->soc_type; >> qcadev->bt_power = devm_kzalloc(&serdev->dev, >> sizeof(struct qca_power), >> GFP_KERNEL); >> @@ -1489,7 +1500,7 @@ static void qca_serdev_remove(struct >> serdev_device *serdev) >> { >> struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev); >> >> - if (qcadev->btsoc_type == QCA_WCN3990) >> + if (qca_is_wcn399x(qcadev->btsoc_type)) >> qca_power_shutdown(&qcadev->serdev_hu); >> else >> clk_disable_unprepare(qcadev->susclk); >> @@ -1499,7 +1510,8 @@ static void qca_serdev_remove(struct >> serdev_device *serdev) >> >> static const struct of_device_id qca_bluetooth_of_match[] = { >> { .compatible = "qcom,qca6174-bt" }, >> - { .compatible = "qcom,wcn3990-bt", .data = &qca_soc_data}, >> + { .compatible = "qcom,wcn3990-bt", .data = &qca_soc_data_wcn3990}, >> + { .compatible = "qcom,wcn3998-bt", .data = &qca_soc_data_wcn3998}, >> { /* sentinel */ } >> }; >> MODULE_DEVICE_TABLE(of, qca_bluetooth_of_match); > > Besides the return value in the qca_is_wcn399x() stub: > > Reviewed-by: Matthias Kaehlcke [Harish] - Thanks for reviewing Thanks, Harish