[PATCH] staging: pi433: pi433_if.c codestyle fix
This patch fixes the following checkpatch.pl error: ERROR: spaces required around that '>=' (ctx:VxV) #930: FILE: pi433_if.c:930: + for (i--; i>=0; i--) ERROR: spaces required around that '=' (ctx:VxV) #970: FILE: pi433_if.c:970: + for (i=0; i --- drivers/staging/pi433/pi433_if.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 2a205c6..d806523 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -927,8 +927,7 @@ static int setup_GPIOs(struct pi433_device *device) { retval = PTR_ERR(device->gpiod[i]); /* release already allocated gpios */ - for (i--; i>=0; i--) - { + for (i--; i >= 0; i--) { free_irq(device->irq_num[i], device); gpiod_put(device->gpiod[i]); } @@ -967,7 +966,7 @@ static void free_GPIOs(struct pi433_device *device) { int i; - for (i=0; igpiod[i]) ) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: pi433: pi433_if.c fix codestyle on two long lines
This patch fixes the following checkpatch.pl warning: WARNING: line over 80 characters #1233: FILE: pi433_if.c:1233: + unregister_chrdev(MAJOR(pi433_dev), pi433_spi_driver.driver.name); WARNING: line over 80 characters #1240: FILE: pi433_if.c:1240: + unregister_chrdev(MAJOR(pi433_dev), pi433_spi_driver.driver.name); Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index d806523..8d51f055 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -1229,14 +1229,16 @@ static int __init pi433_init(void) pi433_class = class_create(THIS_MODULE, "pi433"); if (IS_ERR(pi433_class)) { - unregister_chrdev(MAJOR(pi433_dev), pi433_spi_driver.driver.name); + unregister_chrdev(MAJOR(pi433_dev), + pi433_spi_driver.driver.name); return PTR_ERR(pi433_class); } status = spi_register_driver(&pi433_spi_driver); if (status < 0) { class_destroy(pi433_class); - unregister_chrdev(MAJOR(pi433_dev), pi433_spi_driver.driver.name); + unregister_chrdev(MAJOR(pi433_dev), + pi433_spi_driver.driver.name); } return status; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: pi433: pi433_if.c codestyle space prohibited
This patch fixes the following checkpatch.pl error: ERROR: space prohibited after that open parenthesis '(' #973: FILE: pi433_if.c:973: + if ( IS_ERR(device->gpiod[i]) ) ERROR: space prohibited after that open parenthesis '(' #19: FILE: drivers/staging/pi433/pi433_if.c:954: + if ( IS_ERR(device->gpiod[i])) Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 8d51f055..4b8980c 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -969,7 +969,7 @@ static void free_GPIOs(struct pi433_device *device) for (i = 0; i < NUM_DIO; i++) { /* check if gpiod is valid */ - if ( IS_ERR(device->gpiod[i]) ) + if (IS_ERR(device->gpiod[i])) continue; free_irq(device->irq_num[i], device); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: pi433: pi433_if.c codestyle fix space around kthread
This patch fixes the following checkpatch.pl errors: ERROR: space prohibited after that open parenthesis '(' #499: FILE: pi433_if.c:499: + if ( kthread_should_stop() ) ERROR: space prohibited before that close parenthesis ')' #499: FILE: pi433_if.c:499: + if ( kthread_should_stop() ) Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 4b8980c..28bb77a 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -496,7 +496,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) wait_event_interruptible(device->tx_wait_queue, ( !kfifo_is_empty(&device->tx_fifo) || kthread_should_stop() )); - if ( kthread_should_stop() ) + if (kthread_should_stop()) return 0; /* get data from fifo in the following order: -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: pi433: pi433_if.c codestyle brace on previous line
This patch fixes the following checkpatch.pl error: ERROR: that open brace { should be on the previous line in pi433_if.c as requested by TODO file Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 38 +- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 0d18412..1515198 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -133,19 +133,14 @@ static irqreturn_t DIO0_irq_handler(int irq, void *dev_id) { struct pi433_device *device = dev_id; - if (device->irq_state[DIO0] == DIO_PacketSent) - { + if (device->irq_state[DIO0] == DIO_PacketSent) { device->free_in_fifo = FIFO_SIZE; dev_dbg(device->dev, "DIO0 irq: Packet sent\n"); wake_up_interruptible(&device->fifo_wait_queue); - } - else if (device->irq_state[DIO0] == DIO_Rssi_DIO0) - { + } else if (device->irq_state[DIO0] == DIO_Rssi_DIO0) { dev_dbg(device->dev, "DIO0 irq: RSSI level over threshold\n"); wake_up_interruptible(&device->rx_wait_queue); - } - else if (device->irq_state[DIO0] == DIO_PayloadReady) - { + } else if (device->irq_state[DIO0] == DIO_PayloadReady) { dev_dbg(device->dev, "DIO0 irq: PayloadReady\n"); device->free_in_fifo = 0; wake_up_interruptible(&device->fifo_wait_queue); @@ -158,14 +153,13 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) { struct pi433_device *device = dev_id; - if (device->irq_state[DIO1] == DIO_FifoNotEmpty_DIO1) - { + if (device->irq_state[DIO1] == DIO_FifoNotEmpty_DIO1) { device->free_in_fifo = FIFO_SIZE; - } - else if (device->irq_state[DIO1] == DIO_FifoLevel) - { - if (device->rx_active) device->free_in_fifo = FIFO_THRESHOLD - 1; - elsedevice->free_in_fifo = FIFO_SIZE - FIFO_THRESHOLD - 1; + } else if (device->irq_state[DIO1] == DIO_FifoLevel) { + if (device->rx_active) + device->free_in_fifo = FIFO_THRESHOLD - 1; + else + device->free_in_fifo = FIFO_SIZE - FIFO_THRESHOLD - 1; } dev_dbg(device->dev, "DIO1 irq: %d bytes free in fifo\n", device->free_in_fifo); @@ -198,12 +192,9 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) /* packet config */ /* enable */ SET_CHECKED(rf69_set_sync_enable(dev->spi, rx_cfg->enable_sync)); - if (rx_cfg->enable_sync == optionOn) - { + if (rx_cfg->enable_sync == optionOn) { SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, afterSyncInterrupt)); - } - else - { + } else { SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, always)); } if (rx_cfg->enable_length_byte == optionOn) { @@ -220,12 +211,9 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) /* lengths */ SET_CHECKED(rf69_set_sync_size(dev->spi, rx_cfg->sync_length)); - if (rx_cfg->enable_length_byte == optionOn) - { + if (rx_cfg->enable_length_byte == optionOn) { SET_CHECKED(rf69_set_payload_length(dev->spi, 0xff)); - } - else if (rx_cfg->fixed_message_length != 0) - { + } else if (rx_cfg->fixed_message_length != 0) { payload_length = rx_cfg->fixed_message_length; if (rx_cfg->enable_length_byte == optionOn) payload_length++; if (rx_cfg->enable_address_filtering != filteringOff) payload_length++; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: pi433: pi433_if.c codestyle fix missing blank
This patch fixes the following checkpatch.pl error: ERROR: space required after that ',' (ctx:VxV) #342: FILE: pi433_if.c:342: + dev_dbg(dev->dev,"rx: going to wait for any tx to finish"); Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 98eb25d..7632849 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -325,7 +325,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) dev->interrupt_rx_allowed = false; /* wait for any tx to finish */ - dev_dbg(dev->dev,"rx: going to wait for any tx to finish"); + dev_dbg(dev->dev, "rx: going to wait for any tx to finish"); retval = wait_event_interruptible(dev->rx_wait_queue, !dev->tx_active); if(retval) /* wait was interrupted */ { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: pi433: pi433_if.c codestyle fix in IRQ_handler
This patch fixes the following checkpatch.pl errors: ERROR: that open brace { should be on the previous line #344: FILE: pi433_if.c:344: + if(retval) /* wait was interrupted */ + { ERROR: space required before the open parenthesis '(' #344: FILE: pi433_if.c:344: + if(retval) /* wait was interrupted */ Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 7632849..1cdff5c 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -327,8 +327,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) /* wait for any tx to finish */ dev_dbg(dev->dev, "rx: going to wait for any tx to finish"); retval = wait_event_interruptible(dev->rx_wait_queue, !dev->tx_active); - if(retval) /* wait was interrupted */ - { + if (retval) /* wait was interrupted */ { dev->interrupt_rx_allowed = true; wake_up_interruptible(&dev->tx_wait_queue); return retval; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: pi433: pi433_if.c added a blank in for loop
This patch fixes the following checkpatch.pl error: ERROR: spaces required around that '=' (ctx:VxV) #912: FILE: pi433_if.c:912: + for (i=0; i --- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index c134cc3..74d4abe 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -890,7 +890,7 @@ static int setup_GPIOs(struct pi433_device *device) DIO1_irq_handler }; - for (i=0; ihttp://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: pi433: pi433_if.c codestyle brace on previous line
This patch fixes the following checkpatch.pl error: WARNING: line over 80 characters SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, afterSyncInterrupt)); ERROR: that open brace { should be on the previous line + else + { ERROR: else should follow close brace '}' + } + else Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 3404cb9..17be4b6 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -198,12 +198,10 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) /* packet config */ /* enable */ SET_CHECKED(rf69_set_sync_enable(dev->spi, rx_cfg->enable_sync)); - if (rx_cfg->enable_sync == optionOn) - { - SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, afterSyncInterrupt)); - } - else - { + if (rx_cfg->enable_sync == optionOn) { + SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, +afterSyncInterrupt)); + } else { SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, always)); } if (rx_cfg->enable_length_byte == optionOn) { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: pi433: codestyle space required
This patch fixes the following checkpatch.pl error: ERROR: spaces required around that '+=' (ctx:WxV) + position +=temp; ^ Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 17be4b6..198f448 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -614,7 +614,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) rf69_write_fifo(spi, &buffer[position], temp); - position +=temp; + position += temp; } else { /* msg fits into fifo - take all */ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: pi433: pi433_if.c codestyle fix in IRQ_handler
This patch fixes the following checkpatch.pl errors: ERROR: that open brace { should be on the previous line #344: FILE: pi433_if.c:344: + if(retval) /* wait was interrupted */ + { ERROR: space required before the open parenthesis '(' #344: FILE: pi433_if.c:344: + if(retval) /* wait was interrupted */ Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 3404cb9..26576bf 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -341,8 +341,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) /* wait for any tx to finish */ dev_dbg(dev->dev,"rx: going to wait for any tx to finish"); retval = wait_event_interruptible(dev->rx_wait_queue, !dev->tx_active); - if(retval) /* wait was interrupted */ - { + if (retval) { dev->interrupt_rx_allowed = true; wake_up_interruptible(&dev->tx_wait_queue); return retval; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/10] staging: pi433: space prohibited in IS_ERR
This patch fixes this codestyle issue: ERROR: space prohibited after that open parenthesis '(' + if ( IS_ERR(device->gpiod[i]) ) ERROR: space prohibited before that close parenthesis ')' + if ( IS_ERR(device->gpiod[i]) ) Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index c85a0fa..88e8c74 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -998,7 +998,7 @@ static void free_GPIOs(struct pi433_device *device) for (i = 0; i < NUM_DIO; i++) { /* check if gpiod is valid */ - if ( IS_ERR(device->gpiod[i]) ) + if (IS_ERR(device->gpiod[i])) continue; free_irq(device->irq_num[i], device); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/10] staging: pi433: codestyle brace should be on previous line
This patch fixed codestyle issues of kind: ERROR: that open brace { should be on the previous line + if (device->rx_active) + { ERROR: that open brace { should be on the previous line + else + { ERROR: else should follow close brace '}' + } + else Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 70d2c39..3e79ebf 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -712,13 +712,10 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) /* just one read request at a time */ mutex_lock(&device->rx_lock); - if (device->rx_active) - { + if (device->rx_active) { mutex_unlock(&device->rx_lock); return -EAGAIN; - } - else - { + } else { device->rx_active = true; mutex_unlock(&device->rx_lock); } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/10] staging: pi433: pi433_if.c codestyle brace on previous line
ERROR: that open brace { should be on the previous line + if (rx_interrupted) + { Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 51da5b3..70d2c39 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -683,8 +683,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) /* everything sent? */ if (kfifo_is_empty(&device->tx_fifo)) { abort: - if (rx_interrupted) - { + if (rx_interrupted) { rx_interrupted = false; pi433_start_rx(device); } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/10] staging: pi433: space prohibted before that close parentesis
ERROR: space prohibited before that close parenthesis ')' +kthread_should_stop() ); Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 58b69b4..51da5b3 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -672,7 +672,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) dev_dbg(device->dev, "thread: wait for packet to get sent/fifo to be empty"); wait_event_interruptible(device->fifo_wait_queue, device->free_in_fifo == FIFO_SIZE || -kthread_should_stop() ); +kthread_should_stop()); if ( kthread_should_stop() )printk("ABORT\n"); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/10] staging: pi433: space prohibited
This patch fixes this codestyle issues: ERROR: space prohibited after that open parenthesis '(' + if ( retval != sizeof(instance->tx_cfg) ) ERROR: space prohibited before that close parenthesis ')' + if ( retval != sizeof(instance->tx_cfg) ) Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 3e79ebf..ae49212 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -768,7 +768,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) goto abort; retval = kfifo_in (&device->tx_fifo, &count, sizeof(size_t)); - if ( retval != sizeof(size_t) ) + if (retval != sizeof(size_t)) goto abort; retval = kfifo_from_user(&device->tx_fifo, buf, count, &copied); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/10] staging: pi433: codestyle space required
ERROR: spaces required around that '+=' (ctx:WxV) + position +=temp; ^ Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 55ed45f..726b710 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -651,7 +651,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) rf69_write_fifo(spi, &buffer[position], temp); - position +=temp; + position += temp; } else { /* msg fits into fifo - take all */ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/10] staging: pi433: space prohibited before closing parenthesis
ERROR: space prohibited before that close parenthesis ')' + (size - position) ); Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 726b710..58b69b4 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -659,7 +659,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) repetitions--; rf69_write_fifo(spi, &buffer[position], - (size - position) ); + (size - position)); position = 0; /* reset for next repetition */ } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/10] staging: pi433: forbidden space and open brace
This patch fixes this codestyle issues: ERROR: that open brace { should be on the previous line + if ( IS_ERR(device->gpiod[i]) ) + { ERROR: space prohibited after that open parenthesis '(' + if ( IS_ERR(device->gpiod[i]) ) ERROR: space prohibited before that close parenthesis ')' + if ( IS_ERR(device->gpiod[i]) ) Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 70f320c..1b9aef0 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -954,8 +954,7 @@ static int setup_GPIOs(struct pi433_device *device) if (device->gpiod[i] == ERR_PTR(-EBUSY)) dev_dbg(&device->spi->dev, "%s is busy.", name); - if ( IS_ERR(device->gpiod[i]) ) - { + if (IS_ERR(device->gpiod[i])) { retval = PTR_ERR(device->gpiod[i]); /* release already allocated gpios */ for (i--; i >= 0; i--) { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/10] staging: pi433: pi433_if.c space required in for loop
This patch fixes this codesstyle issues: ERROR: that open brace { should be on the previous line + for (i=0; i --- drivers/staging/pi433/pi433_if.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index ae49212..70f320c 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -941,8 +941,7 @@ static int setup_GPIOs(struct pi433_device *device) DIO1_irq_handler }; - for (i=0; igpiod[i] = gpiod_get(&device->spi->dev, name, 0 /*GPIOD_IN*/); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/10] staging: pi433: open brace on previous line
This patch fixes this codestyle issue: ERROR: that open brace { should be on the previous line + for (i = 0; i < NUM_DIO; i++) + { Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 1b9aef0..c85a0fa 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -996,8 +996,7 @@ static void free_GPIOs(struct pi433_device *device) { int i; - for (i = 0; i < NUM_DIO; i++) - { + for (i = 0; i < NUM_DIO; i++) { /* check if gpiod is valid */ if ( IS_ERR(device->gpiod[i]) ) continue; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
first try to send data with pi433 on Raspberry Pi
Hello list, I just got my pi433 working somehow on Raspberry Pi Model B Rev 2. Here are my findings: first I need to enabling spi in config.txt on boot partition. dtparam=spi=on then adding this node to bcm2835-rpi-b-rev2.dts and compile. &spi0_gpio7 { pi433: pi433@0 { compatible = "Smarthome-Wolf,pi433"; reg = <0>; /* CE 0 */ #address-cells = <1>; #size-cells = <0>; spi-max-frequency = <1000>; pinctrl-0 = <&pi433_pins>; DIO0-gpio = <&gpio 24 0>; DIO1-gpio = <&gpio 25 0>; DIO2-gpio = <&gpio 7 0>; status = "okay"; }; }; Then loading spi_bcm2835 and pi433 modules: modprobe spi_bcm2835 modprobe pi433 Is this the right usage to send some data over the air? echo 1 > /dev/pi433 [ 31.223963] spi-bcm2835 20204000.spi: registered master spi0 [ 31.224300] spi spi0.0: setup mode 0, 8 bits/w, 1000 Hz max --> 0 [ 31.224625] spi-bcm2835 20204000.spi: registered child spi0.0 [ 31.224687] spi spi0.1: setup mode 0, 8 bits/w, 12500 Hz max --> 0 [ 31.224977] spi-bcm2835 20204000.spi: registered child spi0.1 [ 34.062430] random: crng init done [ 43.122779] pi433: module is from the staging directory, the quality is unknown, you have been warned. [ 43.143436] pi433 spi0.0: setup mode 0, 8 bits/w, 1000 Hz max --> 0 [ 43.143465] pi433 spi0.0: spi interface setup: mode 0x 0, 8 bits per word, 1000hz max speed [ 43.143587] pi433 spi0.0: found pi433 (ver. 0x24) [ 43.144027] pi433 spi0.0: DIO0 succesfully configured [ 43.144259] pi433 spi0.0: DIO1 succesfully configured [ 43.144274] pi433 spi0.0: set: mode [ 43.144387] pi433 spi0.0: read 0x4 from reg 0x1 [ 43.144463] pi433 spi0.0: wrote 0x4 to reg 0x1 [ 43.144476] pi433 spi0.0: set: data mode [ 43.144548] pi433 spi0.0: read 0x8 from reg 0x2 [ 43.144617] pi433 spi0.0: wrote 0x8 to reg 0x2 [ 43.144632] pi433 spi0.0: set: amp #0 [ 43.144703] pi433 spi0.0: read 0x9f from reg 0x11 [ 43.144772] pi433 spi0.0: wrote 0x9f to reg 0x11 [ 43.144785] pi433 spi0.0: set: amp #1 [ 43.144856] pi433 spi0.0: read 0x9f from reg 0x11 [ 43.144923] pi433 spi0.0: wrote 0x9f to reg 0x11 [ 43.144936] pi433 spi0.0: set: amp #2 [ 43.145007] pi433 spi0.0: read 0x9f from reg 0x11 [ 43.145074] pi433 spi0.0: wrote 0x9f to reg 0x11 [ 43.145088] pi433 spi0.0: set: power level [ 43.145158] pi433 spi0.0: read 0x9f from reg 0x11 [ 43.145225] pi433 spi0.0: wrote 0x9f to reg 0x11 [ 43.145237] pi433 spi0.0: set: antenna impedance [ 43.145308] pi433 spi0.0: read 0x8 from reg 0x18 [ 43.145376] pi433 spi0.0: wrote 0x8 to reg 0x18 [ 43.145935] pi433 pi433: created device for major 244, minor 0 [ 43.148742] pi433 pi433: thread: going to wait for new messages Now I got hundreds messages of kind: [ 64.221295] pi433 pi433: write: generated new msg with 2 bytes. snip [ 64.222671] pi433 pi433: write: generated new msg with 2 bytes. [ 64.223882] pi433 pi433: read 2 message byte(s) from fifo queue. [ 64.223919] pi433 spi0.0: set: mode [ 64.224010] pi433 spi0.0: read 0x4 from reg 0x1 [ 64.224053] pi433 spi0.0: wrote 0x4 to reg 0x1 [ 64.224064] pi433 spi0.0: set: fifo threshold [ 64.224100] pi433 spi0.0: read 0xf from reg 0x3c [ 64.224129] pi433 spi0.0: wrote 0xf to reg 0x3c [ 64.224159] pi433 spi0.0: 0 - 0x0 [ 64.224170] pi433 spi0.0: set: payload length [ 64.224197] pi433 spi0.0: wrote 0x0 to reg 0x38 [ 64.224209] pi433 spi0.0: set: frequency [ 64.224237] pi433 spi0.0: wrote 0x0 to reg 0x7 [ 64.224263] pi433 spi0.0: wrote 0x0 to reg 0x8 [ 64.224292] pi433 spi0.0: wrote 0x0 to reg 0x9 [ 64.224303] pi433 spi0.0: set: bit rate [ 64.224331] pi433 spi0.0: wrote 0x1a to reg 0x3 [ 64.224359] pi433 spi0.0: wrote 0x88 to reg 0x4 [ 64.224370] pi433 spi0.0: set: modulation [ 64.224404] pi433 spi0.0: read 0x8 from reg 0x2 [ 64.224431] pi433 spi0.0: wrote 0x8 to reg 0x2 [ 64.224442] pi433 spi0.0: set: deviation [ 64.224450] pi433 spi0.0: set_deviation: illegal input param [ 64.224458] pi433 spi0.0: set: deviation [ 64.224466] pi433 spi0.0: set_deviation: illegal input param [ 64.224475] pi433 spi0.0: set: DIO mapping [ 64.224506] pi433 spi0.0: read 0x0 from reg 0x25 [ 64.224537] pi433 spi0.0: wrote 0x0 to reg 0x25 [ 64.224555] pi433 spi0.0: set: DIO mapping [ 64.224591] pi433 spi0.0: read 0x0 from reg 0x25 [ 64.224618] pi433 spi0.0: wrote 0x0 to reg 0x25 [ 64.224637] pi433 spi0.0: set: mode [ 64.224673] pi433 spi0.0: read 0x4 from reg 0x1 [ 64.224702] pi433 spi0.0: wrote 0xc to reg 0x1 [ 64.224718] pi433 pi433: thread: wait for packet to get sent/fifo to be empty [ 64.224728] pi433 pi433: thread: Packet sent. Set mode to stby. [ 64.224736] pi433 spi0.0: set: mode [ 64.224769] pi433 spi0.0: read 0x8 from reg 0x1 [ 64.224799] pi433 spi0.0: wrote 0x4 to reg 0x1 [ 64.224811] pi433 pi433: th
Re: first try to send data with pi433 on Raspberry Pi
On 11/12/17, Marcus Wolf wrote: > > Am 11.12.2017 um 20:40 schrieb Oliver Graute: > >Hello list, > > > >I just got my pi433 working somehow on Raspberry Pi Model B Rev 2. > > > >Here are my findings: > > > >first I need to enabling spi in config.txt on boot partition. > > > >dtparam=spi=on > > > >then adding this node to bcm2835-rpi-b-rev2.dts and compile. > > > >&spi0_gpio7 { > > pi433: pi433@0 { > > compatible = "Smarthome-Wolf,pi433"; > > reg = <0>; /* CE 0 */ > > #address-cells = <1>; > > #size-cells = <0>; > > spi-max-frequency = <1000>; > > > > pinctrl-0 = <&pi433_pins>; > > DIO0-gpio = <&gpio 24 0>; > > DIO1-gpio = <&gpio 25 0>; > > DIO2-gpio = <&gpio 7 0>; > > status = "okay"; > > }; > >}; > > > >Then loading spi_bcm2835 and pi433 modules: > > > >modprobe spi_bcm2835 > >modprobe pi433 > > > >Is this the right usage to send some data over the air? > > > >echo 1 > /dev/pi433 > >[ 64.258257] pi433 pi433: thread: going to wait for new messages > > > thanks for testing with real hardware :-) > > In my product, I use Raspbian. Therefore, I work with a kernel from > Raspbian. Raspbian supports device tree overlays. I used a buildroot system for this very first test. > So I don't use dtparam=spi=on, but dtoverlay=pi433. > I don't modify the bcm2835-rpi-b-rev2.dts, but use the > pi433-overlay.dts, provided in the driver documentation. > > I am not sure, whether you need to load spi_bcm2835. I never did > that, but maybe it is done implicitly on my system. > > > Never adressed Pi433 from command line, but always used a program to do so. > Anyway: The way you did it, you missed to setup the tx and/or rx > configuration. I am not sure, whether there are useful defaults in > the current version of the driver, allowing you can start with tx > right from the start. Most probably all entries are preset with > zero, that might lead to an not really perfect configuration of the > chip. So you need to use the ioctl first, to set usefull config > params. ok so I need to configure tx and rx before somehow. I'll look into it. If you could provide some example howto address /dev/pi433 from userspace and example settings would be nice. > I don't know, what generates the hundrets of "write: generated new > msg with 2 bytes.". > This message is shown up, as soon as you ask the driver to send > something. There is an internal (SW) queue, where tx jobs get > stored. The message tells you, that a telegram with 2 bytes was > stored in this queue. I guess the two bytes are the '1' and a new > line, generated by the echo. The repetition of the message is quite > strange. yes its strange, I also assume thats related to missing configuration. > Maybe due to misssing configuration / bad default settings. > As soon, as there is something in the queue, the driver should leave > RX mode (where he was waiting for messages in the air) and start to > transfer the messages from the queue with the given (or in your case > missing) configuration for TX. As soon as the queue is empty, the > driver should reconfigure for RX and restart listening on the air. > > Unfortunally I can't find the source code from my testprogram, that > is compatible with the current version of the driver. Hope I didn't > format the wrong SD-card. > Just found sources for the "old" version of the driver, that was > intended to support more then just Pi433... > > Will provide the source as soon as I find it. that would be great Best regards, Oliver ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 0/6] staging: pi433: pi433_if.c various codestyle fixes
rearranged the patches and summarized them Oliver Graute (6): staging: pi433: pi433_if.c codestyle space required staging: pi433: pi433_if.c style fix wrong placed brace staging: pi433: pi433_if.c style open brace staging: pi433: pi433_if.c space required in for loop staging: pi433: pi433_if.c style fix forbidden spaces staging: pi433: pi433_if.c style fix of space prohibited drivers/staging/pi433/pi433_if.c | 29 +++-- 1 file changed, 11 insertions(+), 18 deletions(-) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 1/6] staging: pi433: pi433_if.c codestyle space required
This patch fixes this checkpatch.pl error: ERROR: spaces required around that '+=' (ctx:WxV) + position +=temp; Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 32db3b3..8a057a3 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -734,7 +734,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) rf69_write_fifo(spi, &buffer[position], temp); - position +=temp; + position += temp; } else { /* msg fits into fifo - take all */ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 5/6] staging: pi433: pi433_if.c style fix forbidden spaces
This patch fixes this checkpatch.pl errors: ERROR: that open brace { should be on the previous line + if ( IS_ERR(device->gpiod[i]) ) + { ERROR: space prohibited after that open parenthesis '(' + if ( IS_ERR(device->gpiod[i]) ) ERROR: space prohibited before that close parenthesis ')' + if ( IS_ERR(device->gpiod[i]) ) Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 01fbcf6..19c6270 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -1039,8 +1039,7 @@ static int setup_GPIOs(struct pi433_device *device) if (device->gpiod[i] == ERR_PTR(-EBUSY)) dev_dbg(&device->spi->dev, "%s is busy.", name); - if ( IS_ERR(device->gpiod[i]) ) - { + if (IS_ERR(device->gpiod[i])) { retval = PTR_ERR(device->gpiod[i]); /* release already allocated gpios */ for (i--; i >= 0; i--) { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 4/6] staging: pi433: pi433_if.c space required in for loop
This patch fixes this checkpatch.pl errors: ERROR: that open brace { should be on the previous line + for (i=0; i --- drivers/staging/pi433/pi433_if.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 55d284d..01fbcf6 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -1026,8 +1026,7 @@ static int setup_GPIOs(struct pi433_device *device) DIO1_irq_handler }; - for (i=0; igpiod[i] = gpiod_get(&device->spi->dev, name, 0 /*GPIOD_IN*/); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 3/6] staging: pi433: pi433_if.c style open brace
This patch fixes this checkpatch.pl errors: ERROR: that open brace { should be on the previous line + if (device->rx_active) + { ERROR: that open brace { should be on the previous line + else + { ERROR: else should follow close brace '}' + } + else Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index b6dbd53..55d284d 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -797,13 +797,10 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) /* just one read request at a time */ mutex_lock(&device->rx_lock); - if (device->rx_active) - { + if (device->rx_active) { mutex_unlock(&device->rx_lock); return -EAGAIN; - } - else - { + } else { device->rx_active = true; mutex_unlock(&device->rx_lock); } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 2/6] staging: pi433: pi433_if.c style fix wrong placed brace
This patch fixes this checkpatch.pl error: ERROR: that open brace { should be on the previous line + if (rx_interrupted) + Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 8a057a3..b6dbd53 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -768,8 +768,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) /* everything sent? */ if (kfifo_is_empty(&device->tx_fifo)) { abort: - if (rx_interrupted) - { + if (rx_interrupted) { rx_interrupted = false; pi433_start_rx(device); } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 6/6] staging: pi433: pi433_if.c style fix of space prohibited
This patch fixes this checkpatch.pl errors: ERROR: space prohibited after that open parenthesis '(' + if ( IS_ERR(device->gpiod[i]) ) ERROR: space prohibited before that close parenthesis ')' + if ( IS_ERR(device->gpiod[i]) ) ERROR: space prohibited before that close parenthesis ')' + (size - position) ); ERROR: space prohibited before that close parenthesis ')' +kthread_should_stop() ); ERROR: space prohibited after that open parenthesis '(' + if ( retval != sizeof(instance->tx_cfg) ) ERROR: space prohibited before that close parenthesis ')' + if ( retval != sizeof(instance->tx_cfg) ) Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 19c6270..bafe2cc 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -742,7 +742,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) repetitions--; rf69_write_fifo(spi, &buffer[position], - (size - position) ); + (size - position)); position = 0; /* reset for next repetition */ } @@ -755,7 +755,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) dev_dbg(device->dev, "thread: wait for packet to get sent/fifo to be empty"); wait_event_interruptible(device->fifo_wait_queue, device->free_in_fifo == FIFO_SIZE || -kthread_should_stop() ); +kthread_should_stop()); if ( kthread_should_stop() )printk("ABORT\n"); @@ -853,7 +853,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) goto abort; retval = kfifo_in (&device->tx_fifo, &count, sizeof(size_t)); - if ( retval != sizeof(size_t) ) + if (retval != sizeof(size_t)) goto abort; retval = kfifo_from_user(&device->tx_fifo, buf, count, &copied); @@ -1081,10 +1081,9 @@ static void free_GPIOs(struct pi433_device *device) { int i; - for (i = 0; i < NUM_DIO; i++) - { + for (i = 0; i < NUM_DIO; i++) { /* check if gpiod is valid */ - if ( IS_ERR(device->gpiod[i]) ) + if (IS_ERR(device->gpiod[i])) continue; free_irq(device->irq_num[i], device); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCHv2 0/6] staging: pi433: pi433_if.c various codestyle fixes
On 13/12/17, Oliver Graute wrote: > rearranged the patches and summarized them > > Oliver Graute (6): > staging: pi433: pi433_if.c codestyle space required > staging: pi433: pi433_if.c style fix wrong placed brace > staging: pi433: pi433_if.c style open brace > staging: pi433: pi433_if.c space required in for loop > staging: pi433: pi433_if.c style fix forbidden spaces > staging: pi433: pi433_if.c style fix of space prohibited these changes are no longer necessary because they already fixed by Vincent patch series. Best Regards, Oliver ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v1] staging: fbtft: fb_st7789v: Initialize the Display
From: Oliver Graute Set Gamma Values and Register Values for the HSD20_IPS Signed-off-by: Oliver Graute --- drivers/staging/fbtft/fb_st7789v.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c index 84c5af2dc9a0..b0aa96b703a8 100644 --- a/drivers/staging/fbtft/fb_st7789v.c +++ b/drivers/staging/fbtft/fb_st7789v.c @@ -17,8 +17,8 @@ #define DRVNAME "fb_st7789v" #define DEFAULT_GAMMA \ - "70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25\n" \ - "70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25" + "D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \ + "D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33" /** * enum st7789v_command - ST7789V display controller commands @@ -83,13 +83,13 @@ static int init_display(struct fbtft_par *par) /* set pixel format to RGB-565 */ write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT); - write_reg(par, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22); + write_reg(par, PORCTRL, 0x05, 0x05, 0x00, 0x33, 0x33); /* * VGH = 13.26V * VGL = -10.43V */ - write_reg(par, GCTRL, 0x35); + write_reg(par, GCTRL, 0x75); /* * VDV and VRH register values come from command write @@ -101,13 +101,13 @@ static int init_display(struct fbtft_par *par) * VAP = 4.1V + (VCOM + VCOM offset + 0.5 * VDV) * VAN = -4.1V + (VCOM + VCOM offset + 0.5 * VDV) */ - write_reg(par, VRHS, 0x0B); + write_reg(par, VRHS, 0x13); /* VDV = 0V */ write_reg(par, VDVS, 0x20); /* VCOM = 0.9V */ - write_reg(par, VCOMS, 0x20); + write_reg(par, VCOMS, 0x22); /* VCOM offset = 0V */ write_reg(par, VCMOFSET, 0x20); -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v1] staging: fbtft: fb_st7789v: enabled inversion
From: Oliver Graute Enable inversion mode Signed-off-by: Oliver Graute --- drivers/staging/fbtft/fb_st7789v.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c index 3c3f387936e8..84c5af2dc9a0 100644 --- a/drivers/staging/fbtft/fb_st7789v.c +++ b/drivers/staging/fbtft/fb_st7789v.c @@ -120,6 +120,10 @@ static int init_display(struct fbtft_par *par) write_reg(par, PWCTRL1, 0xA4, 0xA1); write_reg(par, MIPI_DCS_SET_DISPLAY_ON); + + /* enable inversion mode */ + write_reg(par, 0x21); + return 0; } -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v1] staging: fbtft: fb_st7789v: enabled inversion
On 09/04/20, Dan Carpenter wrote: > On Thu, Apr 09, 2020 at 11:24:05AM +0200, Oliver Graute wrote: > > From: Oliver Graute > > > > Enable inversion mode > > What the heck is an inversion mode and why would you want it? Should I name it: Enable MIPI_DCS_ENTER_INVERT_MODE Best Regards, Oliver ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v1] staging: fbtft: fb_st7789v: enabled inversion
On 09/04/20, Dan Carpenter wrote: > On Thu, Apr 09, 2020 at 11:24:05AM +0200, Oliver Graute wrote: > > From: Oliver Graute > > > > Enable inversion mode > > > > Signed-off-by: Oliver Graute > > --- > > drivers/staging/fbtft/fb_st7789v.c | 4 > > 1 file changed, 4 insertions(+) > > > > diff --git a/drivers/staging/fbtft/fb_st7789v.c > > b/drivers/staging/fbtft/fb_st7789v.c > > index 3c3f387936e8..84c5af2dc9a0 100644 > > --- a/drivers/staging/fbtft/fb_st7789v.c > > +++ b/drivers/staging/fbtft/fb_st7789v.c > > @@ -120,6 +120,10 @@ static int init_display(struct fbtft_par *par) > > write_reg(par, PWCTRL1, 0xA4, 0xA1); > > > > write_reg(par, MIPI_DCS_SET_DISPLAY_ON); > > + > > + /* enable inversion mode */ > > + write_reg(par, 0x21); > > Use the define and delete the comment. > > write_reg(par, MIPI_DCS_ENTER_INVERT_MODE); ok, I'll do on next version Best regards, Oliver ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v1] staging: fbtft: fb_st7789v: Initialize the Display
On 09/04/20, Dan Carpenter wrote: > On Thu, Apr 09, 2020 at 11:25:32AM +0200, Oliver Graute wrote: > > From: Oliver Graute > > > > Set Gamma Values and Register Values for the HSD20_IPS > > > > Signed-off-by: Oliver Graute > > --- > > drivers/staging/fbtft/fb_st7789v.c | 12 ++-- > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/staging/fbtft/fb_st7789v.c > > b/drivers/staging/fbtft/fb_st7789v.c > > index 84c5af2dc9a0..b0aa96b703a8 100644 > > --- a/drivers/staging/fbtft/fb_st7789v.c > > +++ b/drivers/staging/fbtft/fb_st7789v.c > > @@ -17,8 +17,8 @@ > > #define DRVNAME "fb_st7789v" > > > > #define DEFAULT_GAMMA \ > > - "70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25\n" \ > > - "70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25" > > + "D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \ > > + "D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33" > > How do you know this won't break someone else's setup? Should I declare an extra define for my values? +#define HSD20_IPS_GAMMA \ + "D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \ + "D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33" > > Without knowing anything at all about this driver, it feels like this > should be: > > if (new_hardware) > write_reg(par, PORCTRL, 0x05, 0x05, 0x00, 0x33, 0x33); > else > write_reg(par, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22); ok, I'll update this. Best regards, Oliver ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v1] staging: fbtft: fb_st7789v: Initialize the Display
On 27/04/20, Dan Carpenter wrote: > On Mon, Apr 27, 2020 at 10:36:42AM +0200, Oliver Graute wrote: > > On 09/04/20, Dan Carpenter wrote: > > > On Thu, Apr 09, 2020 at 11:25:32AM +0200, Oliver Graute wrote: > > > > From: Oliver Graute > > > > > > > > Set Gamma Values and Register Values for the HSD20_IPS > > > > > > > > Signed-off-by: Oliver Graute > > > > --- > > > > drivers/staging/fbtft/fb_st7789v.c | 12 ++-- > > > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > > > > > diff --git a/drivers/staging/fbtft/fb_st7789v.c > > > > b/drivers/staging/fbtft/fb_st7789v.c > > > > index 84c5af2dc9a0..b0aa96b703a8 100644 > > > > --- a/drivers/staging/fbtft/fb_st7789v.c > > > > +++ b/drivers/staging/fbtft/fb_st7789v.c > > > > @@ -17,8 +17,8 @@ > > > > #define DRVNAME "fb_st7789v" > > > > > > > > #define DEFAULT_GAMMA \ > > > > - "70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25\n" \ > > > > - "70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25" > > > > + "D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \ > > > > + "D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33" > > > > > > How do you know this won't break someone else's setup? > > > > Should I declare an extra define for my values? > > > > +#define HSD20_IPS_GAMMA \ > > + "D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \ > > + "D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33" > > > > That's fine, but it can't be a compile time thing. Both types of > hardware have to be working/available at run time. ok, what is the proper way to handover the gamma values during run time? Best Regards, Oliver ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: fbtft: fb_st7789v: Initialize the Display
From: Oliver Graute Set Gamma Values and Register Values for the HSD20_IPS Panel Signed-off-by: Oliver Graute --- need information howto set HSD20_IPS Panel at run time and not at compile time Changes for v2: - added define for HSD20_IPS_GAMMA values - check for HSD20_IPS define - enabled MIPI_DCS_ENTER_INVERT_MODE drivers/staging/fbtft/fb_st7789v.c | 32 +- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c index 3c3f387936e8..ebc17e05ecd0 100644 --- a/drivers/staging/fbtft/fb_st7789v.c +++ b/drivers/staging/fbtft/fb_st7789v.c @@ -20,6 +20,12 @@ "70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25\n" \ "70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25" +#define HSD20_IPS_GAMMA \ + "D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \ + "D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33" + +#define HSD20_IPS "true" + /** * enum st7789v_command - ST7789V display controller commands * @@ -82,14 +88,20 @@ static int init_display(struct fbtft_par *par) /* set pixel format to RGB-565 */ write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT); + if (HSD20_IPS) + write_reg(par, PORCTRL, 0x05, 0x05, 0x00, 0x33, 0x33); - write_reg(par, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22); + else + write_reg(par, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22); /* * VGH = 13.26V * VGL = -10.43V */ - write_reg(par, GCTRL, 0x35); + if (HSD20_IPS) + write_reg(par, GCTRL, 0x75); + else + write_reg(par, GCTRL, 0x35); /* * VDV and VRH register values come from command write @@ -101,13 +113,19 @@ static int init_display(struct fbtft_par *par) * VAP = 4.1V + (VCOM + VCOM offset + 0.5 * VDV) * VAN = -4.1V + (VCOM + VCOM offset + 0.5 * VDV) */ - write_reg(par, VRHS, 0x0B); + if (HSD20_IPS) + write_reg(par, VRHS, 0x13); + else + write_reg(par, VRHS, 0x0B); /* VDV = 0V */ write_reg(par, VDVS, 0x20); /* VCOM = 0.9V */ - write_reg(par, VCOMS, 0x20); + if (HSD20_IPS) + write_reg(par, VCOMS, 0x22); + else + write_reg(par, VCOMS, 0x20); /* VCOM offset = 0V */ write_reg(par, VCMOFSET, 0x20); @@ -120,6 +138,10 @@ static int init_display(struct fbtft_par *par) write_reg(par, PWCTRL1, 0xA4, 0xA1); write_reg(par, MIPI_DCS_SET_DISPLAY_ON); + + if (HSD20_IPS) + write_reg(par, MIPI_DCS_ENTER_INVERT_MODE); + return 0; } @@ -234,7 +256,7 @@ static struct fbtft_display display = { .height = 320, .gamma_num = 2, .gamma_len = 14, - .gamma = DEFAULT_GAMMA, + .gamma = HSD20_IPS_GAMMA, .fbtftops = { .init_display = init_display, .set_var = set_var, -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: first try to send data with pi433 on Raspberry Pi
On 12/12/17, Marcin Ciupak wrote: > > this is due to fact that pi433_write returns 0 on successful copy while > it should return 'copied' value. So it is a bug :) > > '0' means nothing was copied so userpsace calls pi433_write again and > again, data is put to fifo and when it is full it goes to abort and > returns -EAGAIN and logs message write to fifo failed: 0x0 indeed you are right. I changed the return value and the error is gone! +++ b/drivers/staging/pi433/pi433_if.c @@ -845,7 +845,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) wake_up_interruptible(&device->tx_wait_queue); dev_dbg(device->dev, "write: generated new msg with %d bytes.", copied); - return 0; + return copied; If this is the only change here I can provide a patch. Best regards, Oliver ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: pi433: pi433_write fixed the return value
The pi433_write function should return the number of processed bytes. This fix endless sending if write is invoked from userspace. Signed-off-by: Oliver Graute --- drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 1f3ba55..109b9ea 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -845,7 +845,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) wake_up_interruptible(&device->tx_wait_queue); dev_dbg(device->dev, "write: generated new msg with %d bytes.", copied); - return 0; + return copied; abort: dev_dbg(device->dev, "write to fifo failed: 0x%x", retval); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2] staging: pi433: pi433_write fixed the return value
The pi433_write function should return the number of processed bytes Reported-by: Marcin Ciupak Signed-off-by: Oliver Graute --- Changes in v2: - added Reported-By Tag drivers/staging/pi433/pi433_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 1f3ba55..109b9ea 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -845,7 +845,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id) wake_up_interruptible(&device->tx_wait_queue); dev_dbg(device->dev, "write: generated new msg with %d bytes.", copied); - return 0; + return copied; abort: dev_dbg(device->dev, "write to fifo failed: 0x%x", retval); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: fbtft: fb_st7789v: make HSD20_IPS numeric and not a string
On 21/05/20, Colin King wrote: > From: Colin Ian King > > Currently HSD20_IPS is defined as "true" and will always result in a > non-zero result even if it is defined as "false" because it is an array > and that will never be zero. Fix this by defining it as an integer 1 > rather than a literal string. > > Addessses-Coverity: ("Array compared against 0") > Fixes: f03c9b788472 ("staging: fbtft: fb_st7789v: Initialize the Display") > Signed-off-by: Colin Ian King > --- > drivers/staging/fbtft/fb_st7789v.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/fbtft/fb_st7789v.c > b/drivers/staging/fbtft/fb_st7789v.c > index ebc17e05ecd0..3a280cc1892c 100644 > --- a/drivers/staging/fbtft/fb_st7789v.c > +++ b/drivers/staging/fbtft/fb_st7789v.c > @@ -24,7 +24,7 @@ > "D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \ > "D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33" > > -#define HSD20_IPS "true" > +#define HSD20_IPS 1 > > /** > * enum st7789v_command - ST7789V display controller commands Acked-by: Oliver Graute ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel