"val" can be negative, so we'd write before the start of the
par->gpio.db[] array.
Fixes: c296d5f995 ("staging: fbtft: core support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Don't populate array gamma_par_mask on the stack but instead make it
static. Makes the object code smaller by 148 bytes:
Before:
text data bss dec hex filename
2993 1104 0 4097 1001 drivers/staging/fbtft/fb_st7789v.o
After:
text data bss dec hex filename
2757 1192 0 3949 f6d drivers/staging/fbtft/fb_st7789v.o
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Modify the code indentations to fix the checkpatch issues.
Signed-off-by: Christophe Colin <popscolin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sparse spits out a warning that a __be16 was being assigned to a u16.
Change the type of txbuf16 to __be16 b/c it's a restricted type and
prevents mixing endianness.
Signed-off-by: Alex Wilson <alex.david.wilson@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch replaces bit shifting on 1 with the BIT(x) macro.
This was done with coccinelle:
@@
constant c;
@@
-1 << c
+BIT(c)
Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use a single string literal as the fmt argument passed to dev_err()
instead of multiple string literals split with an embedded backslash
character.
Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Make use of new helper fbtft_write_buf_dc.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Make use of new helper fbtft_write_buf_dc.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Factor out setting DC GPIO and writing buffer content to helper
fbtft_write_buf_dc.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The default implementation of write_register keeps DC low for the first
byte only. SH1106 requires DC to be low for all bytes of a multi-byte
command. To deal with this limitation we currently use a separate call
to write_reg for each single command byte what is not really efficient.
Therefore override the default implementation of write_register with an
own one which keeps DC low for all bytes.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
There are drivers like fb_sh1106 which allocate a txbuf less than 1 KiB.
In this case the message would include "0 KiB buffer memory" what
doesn't make sense and in general I doubt that there is any benefit in
informing the user about allocation of a very small buffer.
Therefore omit this message part if the buffer has less than 1 KiB.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch adds support for the SH1106 OLED controller chip.
It's similar to the SSD1306, however it supports only a subset of
commands and the internal video memory has a different width.
Major differences:
- Internal video memory has a width of 132 pixels
- Only a subset of commands is supported
- Only page addressing mode is supported, no support for vertical and
horizontal addressing
- SPI frequency limited to 2 MHz according to the datasheet
Successfully tested with a 1.3" OLED display with this chip and
SPI interface.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Merged two if conditionals into a single one, since they had exactly
the same condition.
Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This allows making some of the actual arrays const.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Running make C=1 M=drivers/staging/fbtft reports warnings about conversion
from __be16 to unsigned short. Change the type of the variables being
assigned into __be16 to remove those warnings.
Signed-off-by: Anthony Brandon <anthony@amarulasolutions.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
__be16 type variables should be used with return value of macro
cpu_to_be16()
Signed-off-by: Julián de Gortari <kiototeko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove blank line before closing brace to fix the checkpatch
issue blank lines aren't necessary before a close brace '}'.
Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Indent code to match alignment with open parentheses, to
fix the checkpatch issue alignment should match open parenthesis.
Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Return value of strlcpy() is not checked. Name string is silently
truncated if longer that SPI_NAME_SIZE, whilst not detrimental to
the program logic it would be nice to notify the user. Module is
currently quite verbose, adding extra pr_warn() calls will not overly
impact this verbosity.
Check return value from call to strlcpy(). If source string is
truncated call pr_warn() to notify user.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Current call to strncmp() uses a magic number. There is a compile
time constant defined for this buffer, included and used already at
other sites in the file.
Remove magic number. Replace with pre-existing compile time constant.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Module copies a user supplied string (module parameter) into a buffer
using strncpy() and does not check that the buffer is null terminated.
Replace call to strncpy() with call to strlcpy() ensuring that the
buffer is null terminated.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix the following formatting issues:
CHECK: Alignment should match open parenthesis
Signed-off-by: Umang Raghuvanshi <u@umangis.me>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Having a local variable of 1024 bytes on 64-bit architectures is a bit
too much, and I ran into this warning while trying to see what functions
use the largest stack:
drivers/staging/fbtft/fbtft-sysfs.c: In function 'store_gamma_curve':
drivers/staging/fbtft/fbtft-sysfs.c:132:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]
As there is no need for 64-bit gamma values (on 32-bit architectures,
we don't use those either), I'm changing the type from 'unsigned long'
to 'u32' here, which cuts the required space in half everywhere.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix the following formatting issues:
CHECK: Alignment should match open parenthesis
Signed-off-by: Umang Raghuvanshi <u@umangis.me>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix the following errors:
Use 4 digit octal (0777) not decimal permissions
Signed-off-by: Abdul Rauf <abdulraufmujahid@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
There are multiple entries for ili9225 display defined in
flexfb_chip_table array. remove duplicate entries and
keep single entry.
Signed-off-by: Amitesh Singh <singh.amitesh@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Refactor write_vmem() for sake of readability.
While here, fix indentation in one comment.
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
There is 64x48 display exists. In order to support that set multiplexer
to 48 pixels and window address to proper position in the graphic display
data RAM.
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kstrto*() functions return proper error code.
Do propogate it to the user.
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
There is no need to duplicate what SPI core already does, i.e. mapping buffers
for DMA capable transfers.
Remove all related pices of code.
Note, that code, besides its redundancy, was buggy: DMA address potentially can
be 0, SPI slave device has nothing to do with DMA capable device properties and
DMA mask in particular.
Suggested-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
First of all, fbtft in current state doesn't allow to override GPIOs to be
optional, like "reset" one. It might be a bug somewhere, but rather out of
scope of this fix.
Second, not all GPIOs available on the board would be SoC based, some of them
might sit on I2C GPIO expanders, for example, on Intel Edison/Arduino, and thus
any communication with them might sleep.
Besides that using udelay() and mdelay() is kinda resource wasteful.
Summarize all of the above, convert fbtft_reset() function to non-atomic
variant by using gpio_set_value_cansleep(), usleep_range(), and msleep().
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
These changes where identified by checkpatch.pl as needed changes to
align the code with the linux development coding style. The several
lines of text where aligned with the precending parenthesis.
Signed-off-by: Scott Matheina <scott@matheina.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch fixes the following checkpatch.pl warning
WARNING: line over 80 characters
Signed-off-by: Maninder Singh <maninder.s2@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ERROR: Use 4 digit octal (0777) not decimal permissions
This error was detected by checkpatch.pl
Signed-off-by: Nadim Almas <nadim.902@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.
Export the module alias information using the MODULE_DEVICE_TABLE() macro.
Before this patch:
$ modinfo drivers/staging/fbtft/flexfb.ko | grep alias
$
After this patch:
$ modinfo drivers/staging/fbtft/flexfb.ko | grep alias
alias: platform:flexpfb
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This is a patch to the fb_agm1264k-fl.c file that fixes up the following
issue:
WARNING: Too many leading tabs - consider code refactoring
Add new function iterate_diffusion_matrix() to refactor a piece of code
inside write_vmem().
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
These arrays use -1, -2, and -3 as initiators for various types of
writes to initialize hardware.
No values are used that conflict with using these arrays as s16
instead of int and reducing overall data is good.
$ size drivers/staging/fbtft/built-in.o*
text data bss dec hex filename
116120 32872 4152 153144 25638 drivers/staging/fbtft/built-in.o.new
116104 36344 6200 158648 26bb8 drivers/staging/fbtft/built-in.o.old
Miscellaneous:
o Realign some of the arrays to make reading a bit easier
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch resolves all the following CHECKs caught by checkpatch.pl
CHECK: Alignment should match open parenthesis
Signed-off-by: Harman Kalra <harman4linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Commit 367e8560e8 introduced a bug
in fbtft-core where fps is always 0, this is because variable
update_time is not assigned correctly.
Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Fixes: 367e8560e8 ("Staging: fbtbt: Replace timespec with ktime_t")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixed the following checkpatch warnings (task #10 of eudyptula challenge):
- NULL comparison rewritten to use '!' operator
Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use !x instead of x == NULL. This patch was found by checkpatch.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
add spaces around << to fix the checkpatch issue, spaces preferred
around that '<<'.
Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Move && up to the previous line, to fix the checkpatch issue Logical
continuations should be on the previous line.
Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix checkpatch.pl warning:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line
Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>