summaryrefslogtreecommitdiff
path: root/drivers/staging/fbtft/fbtft-core.c
AgeCommit message (Collapse)Author
2017-03-09staging: fbtft: add helper fbtft_write_buf_dcHeiner Kallweit
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>
2017-03-09staging: fbtft: improve a syslog message in fbtft_register_framebufferHeiner Kallweit
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>
2017-03-06staging: fbtft: Make the pointers to s16 init arrays constJoe Perches
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>
2017-03-06staging: fbtft: Remove blank lineGargi Sharma
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>
2017-03-06staging: fbtft: Match alignment with open parenthesesGargi Sharma
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>
2017-02-03staging: fbtft: change 'gamma' array to u32Arnd Bergmann
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>
2017-01-25staging: fbtft: fix checkpatch decimal permissions errorAbdul Rauf
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>
2017-01-19staging: fbtft: remove custom DMA mapped bufferAndy Shevchenko
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>
2017-01-19staging: fbtft: convert fbtft_reset() to be non-atomicAndy Shevchenko
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>
2016-11-10staging: fbtft: Fix 'line over 80 characters'Maninder Singh
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>
2016-10-16staging: fbtft: Convert int arrays to s16Joe Perches
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>
2016-10-02Staging: fbtft: Fix bug in fbtft-coreKsenija Stanojevic
Commit 367e8560e8d7a62d96e9b1d644028a3816e04206 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: 367e8560e8d7 ("Staging: fbtbt: Replace timespec with ktime_t") Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21Staging: fbtft: fixed unsigned type warningsMing Yang
Replace unsigned by unsigned int in fbtft driver. Issue found by checkpatch. Signed-off-by: Ming Yang <minos.future@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21staging: fbtft: do not allocate huge txbufMichal Suchanek
txbuflen can be set to arbitrary value by user and it is also set automagically to the maximum transfer size of the SPI master controller. Do not allocate the buffer when larger than vmem. When my SPI master controller reports maximum transfer size 16M the probe of fbtft fails. Signed-off-by: Michal Suchanek <hramrach@gmail.com> Acked-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11staging: fbtft: Use devm_kcalloc instead of devm_kzallocAmitoj Kaur Chawla
Replace devm_kzalloc with devm_kcalloc to ensure there are no integer overflows from the multiplication of a number * sizeof The following Coccinelle semantic patch was used to make this change: //<smpl> @@ expression dev,E1,E2,E3,E4; @@ - devm_kzalloc(dev,E1*E2*sizeof(E3),E4) + devm_kcalloc(dev,E1*E2,sizeof(E3),E4) //</smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11staging: fbtft: Remove unnecessary spi_set_drvdata()Amitoj Kaur Chawla
Unnecessary spi_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL. The Coccinelle semantic patch used to make this change is as follows: @@ struct spi_device *spi; @@ - spi_set_drvdata(spi, NULL); // </smpl> Due to this removal, variable `spi` was unused so dropped `spi` Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20staging: fbtft: Fix block comment coding styleAnchal Jain
Add the required leading * on subsequent lines as well as move the */ on a separate line. Checkpatch found this issue. Signed-off-by: Anchal Jain <anchalj109@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: fbtft: Use standard MIPI DCS command defines for fbtft driverPriit Laes
This patch makes use of the standard MIPI Display Command Set to remove some of the magic constants found in source code. Signed-off-by: Priit Laes <plaes@plaes.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07Staging: fbtft: fbtft-core: Removed unnecessary checksNizam Haider
The driver core clears the driver data to NULL after device_release or on probe failure. Signed-off-by: Nizam Haider <nijamh@cdac.in> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-13staging: fbtft: use alternate screen pointerLars Svensson
Member screen_base in struct fb_info is declared with __iomem qualifier causing sparse warnings when used as a regular ponter. To avoid the warnings, instead use alternate non-__iomem pointer, screen_buffer, troughout the driver. Signed-off-by: Lars Svensson <lars1.svensson@sonymobile.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08Staging: fbtbt: Replace timespec with ktime_tKsenija Stanojevic
struct timespec will overflow in year 2038, so replace it with ktime_t. And replace functions that use struct timespec, timespec_sub with ktime_sub. Also use monotonic time instead of real time, by replacing getnstimeofday with ktime_get, to be more robust against leap seconds and settimeofday() calls. Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-02Staging: fbtft: Remove debug messages related to DEBUG_BACKLIGHTShraddha Barke
Remove debug messages related to fbtft_par_dbg(DEBUG_BACKLIGHT.. ) as this info can be obtained using kernel function tracer Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-29Merge 4.3-rc3 into staging-nextGreg Kroah-Hartman
We want the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-21Staging: fbtft: Remove debug messagesShraddha Barke
Remove debug messages related to fbtft_par_dbg(DEBUG_INIT_DISPLAY.. ) as this info can be obtained using kernel function tracer Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-13staging: fbtft: fix 9-bit SPI support detectionStefan Wahren
Since the result of the setup function isn't adequate to check 9-bit SPI support, we better check bits_per_word_mask. Btw this change avoids a NULL pointer dereference with master drivers without a separate setup function. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Acked-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging/fbtft : Add missing whitespace around operatorsAnish Bhatt
Add blank spaces around operators where recommended by checkpatch.pl Signed-off-by: Anish Bhatt <anish@chelsio.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging/fbtft : Fix multiple/missing blank line issuesAnish Bhatt
Remove or add blank lines as recommended by checkpatch.pl Signed-off-by: Anish Bhatt <anish@chelsio.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging/fbtft : Remove repeated set_addr_win debug messagesAnish Bhatt
fbtft_par_dbg(DEBUG_SET_ADDR_WIN.. ) is repeated in every set_addr_win() handler, this could be replicated by using the kernel function tracer instead. Signed-off-by: Anish Bhatt <anish@chelsio.com> Suggested-by: Greg KH <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: fbtft: fbtft_request_gpios: reduce nestingMike Rapoport
Returning immediately if no platform_data or platform_data->gpios is specified reduceis code nesting Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: fbtft: fbtft-core: define backlight_ops staticallyMike Rapoport
instead of devm_kzalloc'ing them Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: fbtft: remove unused bl_ops from fbtft_unregister_backlightMike Rapoport
The only usage of bl_ops variable in fbtft_unregister_backlight function was assigment of a value to that variable, therefore the assignment and the variable itself can be safely removed Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging/fbtft : Remove FSF mailing addressAnish Bhatt
checkpatch.pl recommends that this is no longer required. Also replaces ASCII-art copyright notice with simple text Signed-off-by: Anish Bhatt <anish@chelsio.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-03staging: fbtft: core: Don't set device platform_dataNoralf Trønnes
Pass platform_data as an argument to fbtft_framebuffer_alloc() instead of using dev->platform_data. This fixes an issue where the device comes from Device Tree and fbtft_probe_common() sets dev->platform_data to allocated memory. When the module is reloaded, dev->platform_data points to freed memory. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14staging: fbtft: Add reset to fbtft_init_display_dt()Noralf Trønnes
When an init sequence is present in the Device Tree, fbtft_init_display_dt() is used to initialize the display. Add missing reset function call and activation of chip select for parallel bus. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-09staging: fbtft: fix build errorSudip Mukherjee
while building on i386 it gives a build warning about msg undeclared. Fixes: e6ffd1ba55a4931c ("staging: fbtft: fix out of bound access") Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-08staging: fbtft: fix out of bound accessSudip Mukherjee
str was 16 bytes but was mentioned as 128 in snprintf. again msg is 128 bytes but not sufficient to hold the complete debug message of register values. Now removed the use of str, msg and print the register values from the loop. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-08staging: fbtft: replace fbtft_dev_dbg with standard dev_dbg callMadhusudhanan Ravindran
This patch attempts to simplify the debugging using standard dev_dbg call so that individual debug prints can be enabled or disbled by dynamic debugging rather than using module params. Signed-off-by: Madhusudhanan Ravindran <mravindr@visteon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-30staging: fbtft: Disable DMA support if DMA is not availableGeert Uytterhoeven
If NO_DMA=y: drivers/built-in.o: In function `fbtft_framebuffer_alloc': (.text+0xb53cae): undefined reference to `dmam_alloc_coherent' As DMA support is already optional, make it depend on HAS_DMA. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-26staging: fbtft: Fix typo in fbtftMasanari Iida
This patch fix spelling typo in comment and printk within fbtft Signed-off-by: Masanari Iida <standby24x7@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06Staging: fbtft: add header for internal functionsDrew Fustini
Remove extern keyword from function prototypes to suppress warning from checkpatch.pl with --strict option: https://lkml.org/lkml/2013/7/23/422 fbtft maintainer Noralf Tronnes advised these functions are internal to this module & suggested moving these prototypes to new internal.h file. He also advised fbtft.h file will eventually live in include/linux/fbtft.h Suggested-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Drew Fustini <pdp7pdp7@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06Staging: fbtft: clean dev_err() loggingHaneen Mohammed
This patch removes __func__ from dev_err. dev_err includes information about: (devcice, driver, specific instance of device, etc) in the log printout. This was done using Coccinelle, with the following semantic patch: @a@ expression E, R; expression msg; @@ dev_err(E, msg, __func__, R); @script:python b@ e << a.msg; y; @@ if(e.find("%s: ") == True): m = e.replace("%s: ", "", 1); coccinelle.y = m; elif(e.find("%s ") == True): m = e.replace("%s ", "", 1); coccinelle.y = m; elif(e.find("%s:") == True): m = e.replace("%s:", "", 1); coccinelle.y = m; else: m = e.replace("%s", "",1); coccinelle.y = m; @c@ expression a.E, a.msg, a.R; identifier b.y; @@ - dev_err(E, msg, __func__, R); + dev_err(E, y, R); Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06Staging: fbtft: Remove unnecessary 'out of memory' message.Dilek Uzulmez
This patch fixes checkpatch.pl warning in file fbtft-core.c WARNING: Possible unnecessary 'out of memory' message Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06Staging: fbtft-core: remove unnecessary line continuationsYeliz Taneroglu
This fixes the checkpatch.pl warning: WARNING: Avoid unnecessary line continuations Signed-off-by: Yeliz Taneroglu <yeliztaneroglu@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01staging: fbtft: fbtft-core: Use '%zu' to print 'size_t' formatFabio Estevam
When building for ARM64 the following build warning is seen: drivers/staging/fbtft/fbtft-core.c:1004:4: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat=] Use '%zu' to print 'size_t' format. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01staging: fbtft: remove unused variableAya Mahfouz
This patch removes a variable that was simply used to store the return value of a function call before returning it. The issue was detected and resolved using the following coccinelle script: @@ identifier len,f; @@ -int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26staging: fbtft: fix space prohibited before that ','Aya Mahfouz
This patch fixes the following checkpatch.pl error: fix space prohibited before that ',' Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-25staging: fbtft: fbtft-core mark functions staticKrzysztof Adamski
This fixes sparse warnings like: warning: symbol XXX was not declared. Should it be static? by declaring all local functions static. Signed-off-by: Krzysztof Adamski <k@japko.eu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-17staging: fbtft: core supportThomas Petazzoni
This commit adds the core fbtft framework from https://github.com/notro/fbtft. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Noralf Tronnes <notro@tronnes.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>