[PATCH] leds: trigger: Introduce a NETDEV trigger

2017-11-28 Thread Ben Whitten
This commit introduces a NETDEV trigger for named device activity. Available triggers are link, rx, and tx. Signed-off-by: Ben Whitten <ben.whit...@gmail.com> --- .../ABI/testing/sysfs-class-led-trigger-netdev | 45 +++ drivers/leds/trigger/Kconfig | 7 + d

[PATCH] Introduce a NETDEV LED trigger

2017-11-28 Thread Ben Whitten
in the initial submission have been addressed [1]. I am also including the netdev mailing list as it was suggested previously that if there is no activity the interval will still run and is wasteful [1] https://lkml.org/lkml/2010/11/14/116 Ben Whitten (1): leds: trigger: Introduce a NETDEV

[PATCH/RFC v2] leds: trigger: Introduce a NETDEV trigger

2017-12-05 Thread Ben Whitten
From: Ben Whitten <ben.whit...@gmail.com> This commit introduces a NETDEV trigger for named device activity. Available triggers are link, rx, and tx. Signed-off-by: Ben Whitten <ben.whit...@gmail.com> --- Changes in v2: Sort includes and redate documentation Correct licence

[PATCH/RFC v2] leds: trigger: Introduce a NETDEV trigger

2017-12-05 Thread Ben Whitten
From: Ben Whitten <ben.whit...@gmail.com> The patch was converted to led_blink_oneshot, in doing so we find that the behaviour has changed. As I dont want to break 'userspace' led behaviour this patch shouldn't be merged as is. Open to suggestions. Given an interval of 50ms and heavy thro

Re: [PATCH v3] leds: trigger: Introduce a NETDEV trigger

2017-12-07 Thread Ben Whitten
Philippe, On 7 December 2017 at 13:01, Philippe Ombredanne <pombreda...@nexb.com> wrote: > Ben, > > On Thu, Dec 7, 2017 at 12:46 PM, Ben Whitten <ben.whit...@gmail.com> wrote: >> From: Ben Whitten <ben.whit...@gmail.com> >> >> This commit introduces

[PATCH v3] leds: trigger: Introduce a NETDEV trigger

2017-12-07 Thread Ben Whitten
From: Ben Whitten <ben.whit...@gmail.com> This commit introduces a NETDEV trigger for named device activity. Available triggers are link, rx, and tx. Signed-off-by: Ben Whitten <ben.whit...@gmail.com> --- Changes in v3: Cancel the software blink prior to a oneshot re-queue Changes

Re: [PATCH/RFC v2] leds: trigger: Introduce a NETDEV trigger

2017-12-07 Thread Ben Whitten
On 6 December 2017 at 20:07, Ben Whitten <ben.whit...@gmail.com> wrote: > Hi Jacek, > > On 5 December 2017 at 20:38, Jacek Anaszewski > <jacek.anaszew...@gmail.com> wrote: >> Hi Ben, >> >> On 12/05/2017 12:19 PM, Ben Whitten wrote: >>> From: Be

Re: [PATCH/RFC v2] leds: trigger: Introduce a NETDEV trigger

2017-12-06 Thread Ben Whitten
Hi Jacek, On 5 December 2017 at 20:38, Jacek Anaszewski <jacek.anaszew...@gmail.com> wrote: > Hi Ben, > > On 12/05/2017 12:19 PM, Ben Whitten wrote: >> From: Ben Whitten <ben.whit...@gmail.com> >> >> The patch was converted to led_blink_oneshot, in doi

Re: [PATCH] leds: trigger: Introduce a NETDEV trigger

2017-12-04 Thread Ben Whitten
gt;> +}\ >> +static DEVICE_ATTR_RW(field); > > In order to get rid of this macro and avoid the need for camel case > macro name we could have one function that would accept an enum e.g. > > enum netdev_led_attr { > NETDEV_ATTR_LINK, > NETDEV_ATTR_RX, > NETDEV_ATTR_TX > }; > > The function would be called from each sysfs attr callback with the > related enum, and would alter the state of the related bit. > I was aiming for a bit of code de duplication, but it ended up a mess. Fixed as per your suggestion. -- Kind regards, Ben Whitten

[PATCH lora-next v2 5/8] net: lora: sx1301: remove duplicate firmware size checks

2018-08-09 Thread Ben Whitten
No need to check the size of the firmware multiple times, just do it once in the function responsible for loading as the firmwares are the same size. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 21 +++-- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git

[PATCH lora-next v2 2/8] net: lora: sx1301: convert to devm registration of netdev

2018-08-09 Thread Ben Whitten
We allow the devres framework handle the clean removal of resources on teardown of the device, in this case the SPI device, saving lengthy unwind code and improving clarity. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 87 +++ 1 file

[PATCH lora-next v2 3/8] net: lora: sx1301: convert to passing priv data throughout

2018-08-09 Thread Ben Whitten
Instead of passing around the spi device we instead pass around our driver data directly. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 305 +++--- 1 file changed, 155 insertions(+), 150 deletions(-) diff --git a/drivers/net/lora/sx1301.c b

[PATCH lora-next v2 7/8] net: lora: sx1301: add initial registration for regmap

2018-08-09 Thread Ben Whitten
nd regmap allocation. Further registers or fields are added as they are required in conversion. Signed-off-by: Ben Whitten --- drivers/net/lora/Kconfig | 1 + drivers/net/lora/sx1301.c | 46 ++ drivers/net/lora/sx1301.h | 10 ++ 3 files changed,

[PATCH lora-next v2 8/8] net: lora: sx1301: convert driver over to regmap reads and writes

2018-08-09 Thread Ben Whitten
The reads and writes are replaced with regmap versions and unneeded functions, variable, and defines removed. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 204 +++--- drivers/net/lora/sx1301.h | 30 +++ 2 files changed, 95 insertions

[PATCH lora-next v2 1/8] net: lora: add methods for devm registration

2018-08-09 Thread Ben Whitten
Follow the devm model so that we can avoid lengthy unwind code. Signed-off-by: Ben Whitten --- drivers/net/lora/dev.c | 28 include/linux/lora/dev.h | 1 + 2 files changed, 29 insertions(+) diff --git a/drivers/net/lora/dev.c b/drivers/net/lora/dev.c index

[PATCH lora-next v2 6/8] net: lora: sx1301: replace version and size magic numbers with defines

2018-08-09 Thread Ben Whitten
We replace the hard coded numbers for size and version with meaningful names. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 21 + drivers/net/lora/sx1301.h | 18 ++ 2 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 drivers/net

[PATCH lora-next v2 4/8] net: lora: sx1301: convert load_firmware to take firmware directly

2018-08-09 Thread Ben Whitten
We just pass the pointer to firmware down to the function that loads it. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/lora/sx1301.c b/drivers/net/lora/sx1301.c index 7324001..3f2a532

RE: [PATCH lora-next 01/10] net: lora: sx1301: add register, bit-fields, and helpers for regmap

2018-08-09 Thread Ben Whitten
> To: Ben Whitten ; Ben > Whitten > Cc: starni...@g.ncu.edu.tw; hasnain.v...@arm.com; > netdev@vger.kernel.org; Xue Liu > ; Sebastian Heß > > Subject: Re: [PATCH lora-next 01/10] net: lora: sx1301: add > register, bit-fields, and helpers for regmap > > + Xue Liu

[RFC] spi: add spi multiplexing functions for dt

2018-08-07 Thread Ben Whitten
Like I2C busses SPI devices can also sit behind multiplexers. This patch adds is based off the I2C implementation and allows description in the devicetree. Signed-off-by: Ben Whitten --- drivers/spi/Kconfig | 10 +++ drivers/spi/Makefile| 3 + drivers/spi/spi-mux.c | 181

[PATCH lora-next 09/10] net: lora: sx1301: convert agc calibrate to regmap functions

2018-08-07 Thread Ben Whitten
From: Ben Whitten We convert the AGC calibration function over to regmap and take the opportunity to make the expected firmware versions defines. Switch to taking a pointer to our private data. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 101

[PATCH lora-next 07/10] net: lora: sx1301: convert read and write burst to take priv data

2018-08-07 Thread Ben Whitten
From: Ben Whitten As part of standardising on passing our priv data around we convert read and write burst to take the priv data, there is a small compat step needed in the old _read and _write functions and will be removed in the next step. Signed-off-by: Ben Whitten --- drivers/net/lora

[PATCH lora-next 10/10] net: lora: sx1301: convert all firmware to regmap

2018-08-07 Thread Ben Whitten
The last stage in the probe function loads the final firmwares to the sx1301. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 67 --- 1 file changed, 28 insertions(+), 39 deletions(-) diff --git a/drivers/net/lora/sx1301.c b/drivers/net

[PATCH lora-next 01/10] net: lora: sx1301: add register, bit-fields, and helpers for regmap

2018-08-07 Thread Ben Whitten
From: Ben Whitten The register and bit-field definitions are taken from the SX1301 datasheet version 2.01 dated June 2014 with the revision information 'First released version'. The reset state and RW capability of each field is not reflected in this patch however from the datasheet: "

[PATCH lora-next 00/10] Conversing sx1301 to regmap and regfield

2018-08-07 Thread Ben Whitten
somewhere todo with sx1301_page_read on my hardware. Since conversion to regmap the sx1301 initialises properly, sx1257 still oopses because of the SPI bus read but presumably will go away with regmap_bus. Ben Whitten (10): net: lora: sx1301: add register, bit-fields, and helpers for regmap net: lora

[PATCH lora-next 08/10] net: lora: sx1301: convert read and write to priv pointer

2018-08-07 Thread Ben Whitten
From: Ben Whitten Convert the next layer of read and writes to our private pointer, once again compatiblity later in the page read and write layer. The page functions will be removed with this full stack as page switches are handled by regmap automatically. Signed-off-by: Ben Whitten

[PATCH lora-next 04/10] net: lora: sx1301: convert probe function to regmap access

2018-08-07 Thread Ben Whitten
From: Ben Whitten Keeping change sets small we convert the probe function over to regmap and regmap_field access for initialisation. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 155 +- drivers/net/lora/sx1301.h | 7 +++ 2 files

[PATCH lora-next 02/10] net: lora: add methods for devm registration

2018-08-07 Thread Ben Whitten
From: Ben Whitten Follow the devm model so that we can avoid lengthy unwind code. Signed-off-by: Ben Whitten --- drivers/net/lora/dev.c | 20 include/linux/lora/dev.h | 1 + 2 files changed, 21 insertions(+) diff --git a/drivers/net/lora/dev.c b/drivers/net/lora/dev.c

[PATCH lora-next 03/10] net: lora: sx1301: convert to devm registration of netdev

2018-08-07 Thread Ben Whitten
From: Ben Whitten We allow the devres framework handle the clean removal of resources on teardown of the device, in this case the SPI device, saving lengthy unwind code and improving clarity. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 87

[PATCH lora-next 06/10] net: lora: sx1301: simplify firmware loading and convert

2018-08-07 Thread Ben Whitten
From: Ben Whitten As part of changing our internal pointers to our priv data we add the spi_device temporarily for downstream burst read/writes. Just pass firmware pointer to the load and remove redundant size checks, as both MCUs have the same program size add a define. Use devm_kzalloc

[PATCH lora-next 05/10] net: lora: sx1301: add device to private data and convert ram reads

2018-08-07 Thread Ben Whitten
From: Ben Whitten It's easier to simply add a pointer to our device to our private data, this way we can avoid passing around our spi_device and instead just pass private data which is more flexible. As its a two line change its coupled with converting AGC and ARB ram reads to regmap functions

Re: [RFC] spi: add spi multiplexing functions for dt

2018-08-07 Thread Ben Whitten
On Tue, 7 Aug 2018 at 22:17, Andreas Färber wrote: > > Hi Ben, > > Am 07.08.2018 um 19:32 schrieb Ben Whitten: > > Like I2C busses SPI devices can also sit behind multiplexers. > > This patch adds is based off the I2C implementation and allows > > description in the

RE: [PATCH lora-next 01/10] net: lora: sx1301: add register, bit-fields, and helpers for regmap

2018-08-08 Thread Ben Whitten
> Subject: Re: [PATCH lora-next 01/10] net: lora: sx1301: add > register, bit-fields, and helpers for regmap > > Am 08.08.2018 um 14:32 schrieb Ben Whitten: > >>> drivers/net/lora/Kconfig | 1 + > >>&

Re: [PATCH lora-next v2 8/8] net: lora: sx1301: convert driver over to regmap reads and writes

2018-08-09 Thread Ben Whitten
On Thu, 9 Aug 2018 at 23:34, Andreas Färber wrote: > > Am 09.08.2018 um 14:33 schrieb Ben Whitten: > > The reads and writes are replaced with regmap versions and unneeded > > functions, variable, and defines removed. > > > > Signed-off-by: Ben Whitten > > ---

RE: [PATCH lora-next 01/10] net: lora: sx1301: add register, bit-fields, and helpers for regmap

2018-08-08 Thread Ben Whitten
> Subject: Re: [PATCH lora-next 01/10] net: lora: sx1301: add > register, bit-fields, and helpers for regmap > > Am 07.08.2018 um 19:32 schrieb Ben Whitten: > > diff --git a/drivers/net/lora/sx1301.c > b/drivers/net/lora/sx1301.c > > index 5342b61..49958f0 100644 > &

RE: [PATCH lora-next 01/10] net: lora: sx1301: add register, bit-fields, and helpers for regmap

2018-08-08 Thread Ben Whitten
> Subject: Re: [PATCH lora-next 01/10] net: lora: sx1301: add > register, bit-fields, and helpers for regmap > > Am 07.08.2018 um 19:32 schrieb Ben Whitten: > > From: Ben Whitten > > > > The register and bit-field definitions are taken from the > SX1301 > >

Re: [PATCH lora-next v2 3/8] net: lora: sx1301: convert to passing priv data throughout

2018-08-09 Thread Ben Whitten
On Thu, 9 Aug 2018 at 21:43, Andreas Färber wrote: > > Am 09.08.2018 um 14:33 schrieb Ben Whitten: > > Instead of passing around the spi device we instead pass around our > > driver data directly. > > > > Signed-off-by: Ben Whitten > > ---

[PATCH lora-next 2/3] net: lora: sx125x: convert to regmap fields

2018-08-22 Thread Ben Whitten
From: Ben Whitten We convert to using regmap fields to allow regmap to take care of read modify writes and bit shifting for ofset fields. Signed-off-by: Ben Whitten --- drivers/net/lora/sx125x.c | 59 --- 1 file changed, 51 insertions(+), 8

[PATCH lora-next 3/3] net: lora: sx125x sx1301: allow radio to register as a clk provider

2018-08-22 Thread Ben Whitten
From: Ben Whitten The 32M is run from the radio, before we just enabled it based on the radio number but now we can use the clk framework to request the clk is started when we need it. The 32M clock produced from the radio is really a gated version of tcxo which is a fixed clock provided

[PATCH lora-next 1/3] net: lora: sx1301: convert to using regmap fields for bit ops

2018-08-22 Thread Ben Whitten
From: Ben Whitten We convert to using regmap fields to allow bit access to the registers where regmap handles the read update write. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 240 +- drivers/net/lora/sx1301.h | 46 + 2

[PATCH v3 lora-next 2/5] net: lora: sx1301: replace burst spi functions with regmap_noinc

2018-10-12 Thread Ben Whitten
We can now use to regmap_noinc API to allow reading and writing to the internal FIFO register which controls processor memory. We also remove the now defunct spi element from the structure as this completes the move to regmap. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 22

[PATCH v3 lora-next 3/5] net: lora: sx1301: convert to using regmap fields for bit ops

2018-10-12 Thread Ben Whitten
From: Ben Whitten We convert to using regmap fields to allow bit access to the registers where regmap handles the read update write. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 234 +- drivers/net/lora/sx1301.h | 46 + 2

[PATCH v3 lora-next 4/5] net: lora: sx125x: convert to regmap fields

2018-10-12 Thread Ben Whitten
From: Ben Whitten We convert to using regmap fields to allow regmap to take care of read modify writes and bit shifting for ofset fields. Signed-off-by: Ben Whitten --- drivers/net/lora/sx125x.c | 59 --- 1 file changed, 51 insertions(+), 8

[PATCH v3 lora-next 5/5] net: lora: sx125x sx1301: allow radio to register as a clk provider

2018-10-12 Thread Ben Whitten
From: Ben Whitten The 32M is run from the radio, before we just enabled it based on the radio number but now we can use the clk framework to request the clk is started when we need it. The 32M clock produced from the radio is really a gated version of tcxo which is a fixed clock provided

[PATCH v3 lora-next 0/5] based on 4.19-rc7 migration to regmap and clk framewor

2018-10-12 Thread Ben Whitten
probed ip link set lora0 up sx125x_con spi0.0-b: enabling clkout Ben Whitten (5): regmap: Add regmap_noinc_write API net: lora: sx1301: replace burst spi functions with regmap_noinc net: lora: sx1301: convert to using regmap fields for bit ops net: lora: sx125x: convert to regmap fields net

[lora-next RFC] Socket details for PF_LORA on sx1301

2018-11-05 Thread Ben Whitten
this additional info down to the lora portion of the socket, setsockopts? Thanks, Ben Whitten

[PATCH v2 lora-next 0/4] migration to regmap and clk framework

2018-10-09 Thread Ben Whitten
: enabling clkout Ben Whitten (4): net: lora: sx1301: convert burst spi functions to regmap raw net: lora: sx1301: convert to using regmap fields for bit ops net: lora: sx125x: convert to regmap fields net: lora: sx125x sx1301: allow radio to register as a clk provider drivers/net/lora

[PATCH v2 lora-next 2/4] net: lora: sx1301: convert to using regmap fields for bit ops

2018-10-09 Thread Ben Whitten
From: Ben Whitten We convert to using regmap fields to allow bit access to the registers where regmap handles the read update write. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 240 +- drivers/net/lora/sx1301.h | 46 + 2

[PATCH v2 lora-next 4/4] net: lora: sx125x sx1301: allow radio to register as a clk provider

2018-10-09 Thread Ben Whitten
From: Ben Whitten The 32M is run from the radio, before we just enabled it based on the radio number but now we can use the clk framework to request the clk is started when we need it. The 32M clock produced from the radio is really a gated version of tcxo which is a fixed clock provided

[PATCH v2 lora-next 1/4] net: lora: sx1301: convert burst spi functions to regmap raw

2018-10-09 Thread Ben Whitten
As we have caching disabled we can access the regmap using raw for our firmware reading and writing bursts. We also remove the now defunct spi element from the structure as this completes the move to regmap. Signed-off-by: Ben Whitten --- drivers/net/lora/sx1301.c | 26

[PATCH v2 lora-next 3/4] net: lora: sx125x: convert to regmap fields

2018-10-09 Thread Ben Whitten
From: Ben Whitten We convert to using regmap fields to allow regmap to take care of read modify writes and bit shifting for ofset fields. Signed-off-by: Ben Whitten --- drivers/net/lora/sx125x.c | 59 --- 1 file changed, 51 insertions(+), 8

RE: [PATCH v2 lora-next 1/4] net: lora: sx1301: convert burst spi functions to regmap raw

2018-10-10 Thread Ben Whitten
> Subject: Re: [PATCH v2 lora-next 1/4] net: lora: sx1301: > convert burst spi functions to regmap raw > > Hi Ben and Mark, > > Am 09.10.18 um 14:52 schrieb Ben Whitten: > > As we have caching disabled we can access the regmap > using raw for our > > firmware r