Re: [PATCH v3 1/2] Bluetooth: hci_qca: Added support for wcn3998

From: c-hbandi
Date: Wed Mar 13 2019 - 02:24:42 EST


Hi Matthias,



On 2019-03-12 21:59, Matthias Kaehlcke wrote:
Hi Harish,

On Tue, Mar 12, 2019 at 05:52:58PM +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 <c-hbandi@xxxxxxxxxxxxxx>
---
changes in v3:
- updated to latest code base.

This is not useful, for future versions please describe what changed
(e.g. 'specify regulator constraints in the driver instead of the DT')


[Harish] -- added details in v2, and v3 uploaded just to rebase on tip of bluetooth-next
for better understanding of code in review. From new patch onwards will add all patch
version changes and add proper description.

---
drivers/bluetooth/btqca.c | 4 ++--
drivers/bluetooth/btqca.h | 3 ++-
drivers/bluetooth/hci_qca.c | 40 ++++++++++++++++++++++++++--------------
3 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 6122685..70cab13 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 (soc_type >= QCA_WCN3990) {

That works, but isn't super-clear and might need to be adapted when
future non-WCN399x controllers are added.

Some possible alternatives:

- is_wcn399x(soc_type)
- have a family (Rome, Cherokee (IIRC this name was used for WCN3990))
and a chip id (QCA6174, WCN3990, WCN3998, ...)


[Harish] -- Will change like is_wcn399x(soc_type) and come up with new patch

/* 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 (soc_type >= QCA_WCN3990)
snprintf(config.fwname, sizeof(config.fwname),
"qca/crnv%02x.bin", rom_ver);
else
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index c72c56e..f03d96e 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

nit: if you add a comma after the last value the line doesn't need to
be changed when a new type is added in the future.

[Harish] -- will take care in new patch

Is 'WCN3998' specific enough? You mentioned earlier that there are
multiple WCN3998 variants with different requirements for regulator
voltages/max currents. Which names does Qualcomm use to distinguish
between them (e.g. WCN3998-A, WCN3998-B, ...)?

[Harish] -- for now we want to add WCN3998 support only, What i mean to say in my earlier
explanation that. WCN3990 is base variant and on top of that we have variants like WCN3990,
WCN3998 and WCN3998-0,WCN3998-1 like that..


Thanks

Matthias

Thanks,
Harish