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

Matthias Kaehlcke
2019-03-12T16:29:51Z

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@codeaurora.org>
> ---
> 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')

> ---
> 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, ...)

> /* 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.

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, ...)?

Thanks

Matthias