Re: [PATCH] [v7] wireless: Initial driver submission for pureLiFi STA devices

2020-12-19 Thread Kalle Valo
Srinivasan Raju  writes:

>> What will be the directory structure in linux-firmware? It should be
>> unique so that it's not possible to mix with other drivers.
>
> I have created the following directory structure, Please let me know if this 
> is OK.
>
>  LICENCE.purelifi_firmware |  29 +
>  purelifi/Li-Fi-XL.bin | Bin 0 -> 70228 bytes
>  purelifi/fpga.bit | Bin 0 -> 3825907 bytes
>  purelifi/fpga_xc.bit  | Bin 0 -> 3825906 bytes
>  4 files changed, 29 insertions(+)

I would prefer to change purelifi to the name of the driver, I'll
explain more in my review in v11.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


Re: [PATCH] [v7] wireless: Initial driver submission for pureLiFi STA devices

2020-12-03 Thread Srinivasan Raju


> What will be the directory structure in linux-firmware? It should be
> unique so that it's not possible to mix with other drivers.

I have created the following directory structure, Please let me know if this is 
OK.

 LICENCE.purelifi_firmware |  29 +
 purelifi/Li-Fi-XL.bin | Bin 0 -> 70228 bytes
 purelifi/fpga.bit | Bin 0 -> 3825907 bytes
 purelifi/fpga_xc.bit  | Bin 0 -> 3825906 bytes
 4 files changed, 29 insertions(+)

Thanks 
Srini




Re: [PATCH] [v7] wireless: Initial driver submission for pureLiFi STA devices

2020-12-03 Thread Kalle Valo
Srinivasan Raju  writes:

> we will be submitting to linux-firmware repository @
> https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
> I will share the link once it is accpeted, we have sent another
> version of the patch v8 , please review and provide your comments

What will be the directory structure in linux-firmware? It should be
unique so that it's not possible to mix with other drivers.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


Re: [PATCH] [v7] wireless: Initial driver submission for pureLiFi STA devices

2020-12-02 Thread Srinivasan Raju
Hi Kalle,

we will be submitting to linux-firmware repository @ 
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
I will share the link once it is accpeted, we have sent another version of the 
patch v8 , please review and provide your comments

Thanks
Srini


From: Srinivasan Raju 
Sent: Thursday, November 26, 2020 10:31 AM
To: Kalle Valo
Cc: Mostafa Afgani; David S. Miller; Jakub Kicinski; Mauro Carvalho Chehab; Rob 
Herring; Lukas Bulwahn; open list; open list:NETWORKING DRIVERS (WIRELESS); 
open list:NETWORKING DRIVERS
Subject: Re: [PATCH] [v7] wireless: Initial driver submission for pureLiFi STA 
devices



> I haven't had a chance to review this yet but we have some documentation for 
> new drivers:

> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#new_driver

> Is the firmware publically available?

Thanks Kalle, We will make the firmware available in our website for public 
access and share the details.

Regards
Srini



Re: [PATCH] [v7] wireless: Initial driver submission for pureLiFi STA devices

2020-11-25 Thread Srinivasan Raju


> I haven't had a chance to review this yet but we have some documentation for 
> new drivers:

> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#new_driver

> Is the firmware publically available?

Thanks Kalle, We will make the firmware available in our website for public 
access and share the details.

Regards
Srini



Re: [PATCH] [v7] wireless: Initial driver submission for pureLiFi STA devices

2020-11-24 Thread Kalle Valo
Srinivasan Raju  wrote:

> This introduces the pureLiFi LiFi driver for LiFi-X, LiFi-XC
> and LiFi-XL USB devices.
> 
> This driver implementation has been based on the zd1211rw driver.
> 
> Driver is based on 802.11 softMAC Architecture and uses
> native 802.11 for configuration and management.
> 
> The driver is compiled and tested in ARM, x86 architectures and
> compiled in powerpc architecture.
> 
> Signed-off-by: Srinivasan Raju 
> 
> Changes v6->v7:
> - Magic numbers removed and used IEEE80211 macors
> - usb.c is split into two files firmware.c and dbgfs.c
> - Other code style and timer function fixes (mod_timer)
> Changes v5->v6:
> - Code style fix patch from Joe Perches
> Changes v4->v5:
> - Code refactoring for clarity and redundnacy removal
> - Fix warnings from kernel test robot
> Changes v3->v4:
> - Code refactoring based on kernel code guidelines
> - Remove multi level macors and use kernel debug macros
> Changes v2->v3:
> - Code style fixes kconfig fix
> Changes v1->v2:
> - v1 was submitted to staging, v2 submitted to wireless-next
> - Code style fixes and copyright statement fix

I haven't had a chance to review this yet but we have some documentation for 
new drivers:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#new_driver

Is the firmware publically available?

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20201116092253.1302196-1-srini.r...@purelifi.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [PATCH] [v7] wireless: Initial driver submission for pureLiFi STA devices

2020-11-17 Thread Srinivasan Raju

> trivial notes and some style and content defects:
> (I stopped reading after awhile)

Thanks, I will address the comments.

Regards
Srini

Re: [PATCH] [v7] wireless: Initial driver submission for pureLiFi STA devices

2020-11-16 Thread Joe Perches
On Mon, 2020-11-16 at 14:52 +0530, Srinivasan Raju wrote:
> This introduces the pureLiFi LiFi driver for LiFi-X, LiFi-XC
> and LiFi-XL USB devices.
> 
> This driver implementation has been based on the zd1211rw driver.
> 
> Driver is based on 802.11 softMAC Architecture and uses
> native 802.11 for configuration and management.
> 
> The driver is compiled and tested in ARM, x86 architectures and
> compiled in powerpc architecture.
> 
> Signed-off-by: Srinivasan Raju 

trivial notes and some style and content defects:
(I stopped reading after awhile)

Commonly this changelog would go below the --- separator line.

> 
> Changes v6->v7:
> - Magic numbers removed and used IEEE80211 macors
> - usb.c is split into two files firmware.c and dbgfs.c
> - Other code style and timer function fixes (mod_timer)
> Changes v5->v6:
> - Code style fix patch from Joe Perches
> Changes v4->v5:
> - Code refactoring for clarity and redundnacy removal
> - Fix warnings from kernel test robot
> Changes v3->v4:
> - Code refactoring based on kernel code guidelines
> - Remove multi level macors and use kernel debug macros
> Changes v2->v3:
> - Code style fixes kconfig fix
> Changes v1->v2:
> - v1 was submitted to staging, v2 submitted to wireless-next
> - Code style fixes and copyright statement fix
> ---
>  MAINTAINERS  |5 +

[]

> diff --git a/MAINTAINERS b/MAINTAINERS
[]
> @@ -14108,6 +14108,11 @@ T:   git git://linuxtv.org/media_tree.git
[]
> +PUREILIFI USB DRIVER
> +M:   Srinivasan Raju 
> +S:   Maintained

If you are employed there and are paid to maintain this code the
more common S: marking is "Supported"

> diff --git a/drivers/net/wireless/purelifi/Kconfig 
> b/drivers/net/wireless/purelifi/Kconfig
[]
> +++ b/drivers/net/wireless/purelifi/Kconfig
> @@ -0,0 +1,27 @@
> +# SPDX-License-Identifier: GPL-2.0

For clarity, I think it'd be nicer to use GPL-2.0-only here and elsewhere.

> diff --git a/drivers/net/wireless/purelifi/chip.c 
> b/drivers/net/wireless/purelifi/chip.c
[]
> +int purelifi_set_beacon_interval(struct purelifi_chip *chip, u16 interval,
> +  u8 dtim_period, int type)
> +{
> + if (!interval || (chip->beacon_set &&
> +   chip->beacon_interval == interval)) {
> + return 0;
> + }

It's ddd that checkpatch isn't complaining about single statement uses
with braces.  I would write this like the below, but there isn't really
anything wrong with what you did either.

if (!interval ||
(chip->beacon_set && chip->beacon_interval == interval))
return 0;

> +void purelifi_chip_disable_rxtx(struct purelifi_chip *chip)
> +{
> + u8 value;
> +
> + value = 0;

why not make this:

static const u8 value = 0;

> + usb_write_req((const u8 *), sizeof(value), USB_REQ_RXTX_WR);

so this is doesn't need a cast

usb_write_req(, sizeof(value), USB_REQ_RXTX_WR);

> +int purelifi_chip_set_rate(struct purelifi_chip *chip, u8 rate)
> +{
> + int r;
> +
> + if (!chip)
> + return -EINVAL;
> +
> + r = usb_write_req((const u8 *), sizeof(rate), USB_REQ_RATE_WR);

why is the cast needed here?

> +static inline void purelifi_mc_add_addr(struct purelifi_mc_hash *hash,
> + u8 *addr
> + )

Odd close parenthesis location

> diff --git a/drivers/net/wireless/purelifi/dbgfs.c 
> b/drivers/net/wireless/purelifi/dbgfs.c
[]
> +ssize_t purelifi_store_frequency(struct device *dev,
> +  struct device_attribute *attr,
> +  const char *buf,
> +  size_t len)
> +{
[]
> + if (valid) {
> + usr_input[0] = (char)predivider;
> + usr_input[1] = (char)feedback_divider;
> + usr_input[2] = (char)output_div_0;
> + usr_input[3] = (char)output_div_1;
> + usr_input[4] = (char)output_div_2;
> + usr_input[5] = (char)clkout3_phase;
> +
> + dev_err(dev, "options IP_DIV: %d VCO_MULT: %d OP_DIV_PHY: %d",
> + usr_input[0], usr_input[1], usr_input[2]);
> + dev_err(dev, "OP_DIV_CPU: %d OP_DIV_USB: %d CLK3_PH: %d\n",
> + usr_input[3], usr_input[4], usr_input[5]);

why is this dev_err?  It's not an error.
Shouldn't this be dev_notice or dev_info?

> +ssize_t purelifi_show_sysfs(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + return 0;
> +}

This doesn't seem useful.

> +ssize_t purelifi_show_modulation(struct device *dev,
> +  struct device_attribute *attr,
> +  char *buf)
> +{
> + return 0;
> +}

This either.

> diff --git a/drivers/net/wireless/purelifi/firmware.c 
> b/drivers/net/wireless/purelifi/firmware.c
[]
> +int download_fpga(struct usb_interface *intf)
> +{
[]
> +  

[PATCH] [v7] wireless: Initial driver submission for pureLiFi STA devices

2020-11-16 Thread Srinivasan Raju
This introduces the pureLiFi LiFi driver for LiFi-X, LiFi-XC
and LiFi-XL USB devices.

This driver implementation has been based on the zd1211rw driver.

Driver is based on 802.11 softMAC Architecture and uses
native 802.11 for configuration and management.

The driver is compiled and tested in ARM, x86 architectures and
compiled in powerpc architecture.

Signed-off-by: Srinivasan Raju 

Changes v6->v7:
- Magic numbers removed and used IEEE80211 macors
- usb.c is split into two files firmware.c and dbgfs.c
- Other code style and timer function fixes (mod_timer)
Changes v5->v6:
- Code style fix patch from Joe Perches
Changes v4->v5:
- Code refactoring for clarity and redundnacy removal
- Fix warnings from kernel test robot
Changes v3->v4:
- Code refactoring based on kernel code guidelines
- Remove multi level macors and use kernel debug macros
Changes v2->v3:
- Code style fixes kconfig fix
Changes v1->v2:
- v1 was submitted to staging, v2 submitted to wireless-next
- Code style fixes and copyright statement fix
---
 MAINTAINERS  |5 +
 drivers/net/wireless/Kconfig |1 +
 drivers/net/wireless/Makefile|1 +
 drivers/net/wireless/purelifi/Kconfig|   27 +
 drivers/net/wireless/purelifi/Makefile   |3 +
 drivers/net/wireless/purelifi/chip.c |   94 ++
 drivers/net/wireless/purelifi/chip.h |   82 ++
 drivers/net/wireless/purelifi/dbgfs.c|  161 
 drivers/net/wireless/purelifi/firmware.c |  367 
 drivers/net/wireless/purelifi/intf.h |   38 +
 drivers/net/wireless/purelifi/mac.c  |  876 ++
 drivers/net/wireless/purelifi/mac.h  |  189 
 drivers/net/wireless/purelifi/usb.c  | 1073 ++
 drivers/net/wireless/purelifi/usb.h  |  197 
 14 files changed, 3114 insertions(+)
 create mode 100644 drivers/net/wireless/purelifi/Kconfig
 create mode 100644 drivers/net/wireless/purelifi/Makefile
 create mode 100644 drivers/net/wireless/purelifi/chip.c
 create mode 100644 drivers/net/wireless/purelifi/chip.h
 create mode 100644 drivers/net/wireless/purelifi/dbgfs.c
 create mode 100644 drivers/net/wireless/purelifi/firmware.c
 create mode 100644 drivers/net/wireless/purelifi/intf.h
 create mode 100644 drivers/net/wireless/purelifi/mac.c
 create mode 100644 drivers/net/wireless/purelifi/mac.h
 create mode 100644 drivers/net/wireless/purelifi/usb.c
 create mode 100644 drivers/net/wireless/purelifi/usb.h

diff --git a/MAINTAINERS b/MAINTAINERS
index c80f87d7258c..150f592fb6e4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14108,6 +14108,11 @@ T: git git://linuxtv.org/media_tree.git
 F: Documentation/admin-guide/media/pulse8-cec.rst
 F: drivers/media/cec/usb/pulse8/
 
+PUREILIFI USB DRIVER
+M: Srinivasan Raju 
+S: Maintained
+F: drivers/net/wireless/purelifi
+
 PVRUSB2 VIDEO4LINUX DRIVER
 M: Mike Isely 
 L: pvru...@isely.net   (subscribers-only)
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 170a64e67709..b87da3139f94 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -48,6 +48,7 @@ source "drivers/net/wireless/st/Kconfig"
 source "drivers/net/wireless/ti/Kconfig"
 source "drivers/net/wireless/zydas/Kconfig"
 source "drivers/net/wireless/quantenna/Kconfig"
+source "drivers/net/wireless/purelifi/Kconfig"
 
 config PCMCIA_RAYCS
tristate "Aviator/Raytheon 2.4GHz wireless support"
diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
index 80b324499786..e9fc770026f0 100644
--- a/drivers/net/wireless/Makefile
+++ b/drivers/net/wireless/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_WLAN_VENDOR_ST) += st/
 obj-$(CONFIG_WLAN_VENDOR_TI) += ti/
 obj-$(CONFIG_WLAN_VENDOR_ZYDAS) += zydas/
 obj-$(CONFIG_WLAN_VENDOR_QUANTENNA) += quantenna/
+obj-$(CONFIG_WLAN_VENDOR_PURELIFI) += purelifi/
 
 # 16-bit wireless PCMCIA client drivers
 obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o
diff --git a/drivers/net/wireless/purelifi/Kconfig 
b/drivers/net/wireless/purelifi/Kconfig
new file mode 100644
index ..f6630791df9d
--- /dev/null
+++ b/drivers/net/wireless/purelifi/Kconfig
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0
+config WLAN_VENDOR_PURELIFI
+   bool "pureLiFi devices"
+   default y
+   help
+ If you have a pureLiFi device, say Y.
+
+ Note that the answer to this question doesn't directly affect the
+ kernel: saying N will just cause the configurator to skip all the
+ questions about these cards. If you say Y, you will be asked for
+ your specific card in the following questions.
+
+if WLAN_VENDOR_PURELIFI
+
+config PURELIFI
+
+   tristate "pureLiFi device support"
+   depends on CFG80211 && MAC80211 && USB
+   help
+  This driver makes the adapter appear as a normal WLAN interface.
+
+  The pureLiFi device requires external STA firmware to be loaded.
+
+  To compile this driver as