aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/fbdev/ssd1307fb.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-09-16Merge tag 'v6.0-rc5' into i2c/for-mergewindowWolfram Sang1-1/+1
Linux 6.0-rc5
2022-08-24fbdev: ssd1307fb: Fix repeated words in commentsJilin Yuan1-1/+1
Delete the redundant word 'set'. Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com> Signed-off-by: Helge Deller <deller@gmx.de>
2022-08-16i2c: Make remove callback return voidUwe Kleine-König1-3/+1
The value returned by an i2c driver's remove function is mostly ignored. (Only an error message is printed if the value is non-zero that the error is ignored.) So change the prototype of the remove function to return no value. This way driver authors are not tempted to assume that passing an error to the upper layer is a good idea. All drivers are adapted accordingly. There is no intended change of behaviour, all callbacks were prepared to return 0 before. Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com> Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au> Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Crt Mori <cmo@melexis.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013 Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/* Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5 Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860 Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power Acked-by: Krzysztof Hałasa <khalasa@piap.pl> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
2022-05-03fbdev: Rename pagelist to pagereflist for deferred I/OThomas Zimmermann1-2/+1
Rename various instances of pagelist to pagereflist. The list now stores pageref structures, so the new name is more appropriate. In their write-back helpers, several fbdev drivers refer to the pageref list in struct fb_deferred_io instead of using the one supplied as argument to the function. Convert them over to the supplied one. It's the same instance, so no change of behavior occurs. v4: * fix commit message (Javier) Suggested-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220429100834.18898-5-tzimmermann@suse.de
2022-05-03fbdev: Put mmap for deferred I/O into driversThomas Zimmermann1-0/+1
The fbdev mmap function fb_mmap() unconditionally overrides the driver's implementation if deferred I/O has been activated. This makes it hard to implement mmap with anything but a vmalloc()'ed software buffer. That is specifically a problem for DRM, where video memory is maintained by a memory manager. Leave the mmap handling to drivers and expect them to call the helper for deferred I/O by thmeselves. v4: * unlock mm_lock in fb_mmap() error path (Dan) v3: * fix warning if fb_mmap is missing (kernel test robot) v2: * print a helpful error message if the defio setup is incorrect (Javier) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220429100834.18898-2-tzimmermann@suse.de
2022-01-29video: fbdev: ssd1307fb: Make use of the helper function dev_err_probe()Cai Huoqing1-4/+3
When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing <caihuoqing@baidu.com> Signed-off-by: Helge Deller <deller@gmx.de>
2021-07-27video: fbdev: ssd1307fb: Cache address rangesGeert Uytterhoeven1-2/+25
Cache the column and page ranges, to avoid doing unneeded I2C transfers when the values haven't changed. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210727134730.3765898-6-geert@linux-m68k.org
2021-07-27video: fbdev: ssd1307fb: Optimize screen updatesGeert Uytterhoeven1-21/+29
Currently, each screen update triggers an I2C transfer of all screen data, up to 1 KiB of data for a 128x64 display, which takes at least 20 ms in Fast mode. Reduce the amount of transferred data by only updating the rectangle that changed. Remove the calls to ssd1307fb_set_col_range() and ssd1307fb_set_page_range() during initialization, as ssd1307fb_update_rect() now takes care of that. Note that for now the optimized operation is only used for fillrect, copyarea, and imageblit, which are used by fbcon. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210727134730.3765898-5-geert@linux-m68k.org
2021-07-27video: fbdev: ssd1307fb: Extract ssd1307fb_set_{col,page}_range()Geert Uytterhoeven1-20/+37
Extract the code to set the column and page ranges into two helper functions. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210727134730.3765898-4-geert@linux-m68k.org
2021-07-27video: fbdev: ssd1307fb: Simplify ssd1307fb_update_display()Geert Uytterhoeven1-7/+10
Simplify the nested loops to handle conversion from linear frame buffer to ssd1307 page layout: 1. Move last page handling one level up, as the value of "m" is the same inside a page, 2. array->data[] is filled linearly, so there is no need to recalculate array_idx over and over again; a simple increment is sufficient. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210727134730.3765898-3-geert@linux-m68k.org
2021-07-27video: fbdev: ssd1307fb: Propagate errors via ssd1307fb_update_display()Geert Uytterhoeven1-6/+12
Make ssd1307fb_update_display() return an error code, so callers that can handle failures can propagate it. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210727134730.3765898-2-geert@linux-m68k.org
2020-09-08video: fbdev: ssd1307fb: Added support to Column offsetRodrigo Alencar1-2/+6
This patch provides support for displays like VGM128064B0W10, which requires a column offset of 2, i.e., its segments starts in SEG2 and ends in SEG129. Signed-off-by: Rodrigo Alencar <455.rodrigo.alencar@gmail.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/1595622138-3965-1-git-send-email-455.rodrigo.alencar@gmail.com
2020-06-17pwm: Convert period and duty cycle to u64Guru Das Srinagesh1-1/+1
Because period and duty cycle are defined as ints with units of nanoseconds, the maximum time duration that can be set is limited to ~2.147 seconds. Change their definitions to u64 in the structs of the PWM framework so that higher durations may be set. Also use the right format specifiers in debug prints in both core.c, pwm-stm32-lp.c as well as video/fbdev/ssd1307fb.c. Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2020-04-17video: ssd1307fb: Remove redundant forward declarationAndy Shevchenko1-2/+0
There is no need to have forward declaration of struct ssd1307fb_par. Drop it for good. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200324170532.44384-5-andriy.shevchenko@linux.intel.com
2020-04-17video: ssd1307fb: Convert to atomic PWM APIAndy Shevchenko1-12/+5
Use the atomic API wherever appropriate and get rid of pwm_apply_args() call (the reference period and polarity are now explicitly set when calling pwm_apply_state()). We also make use of the pwm_set_relative_duty_cycle() helper to ease relative to absolute duty_cycle conversion. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200324170532.44384-4-andriy.shevchenko@linux.intel.com
2020-04-17video: ssd1307fb: Make use of device propertiesAndy Shevchenko1-21/+19
Device property API allows to gather device resources from different sources, such as ACPI. Convert the drivers to unleash the power of device property API. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200324170532.44384-3-andriy.shevchenko@linux.intel.com
2020-04-17video: ssd1307fb: Introduce temporary variable to increase readabilityAndy Shevchenko1-18/+15
Introduce temporary variable to increase readability of the code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> [b.zolnierkie: fix lines over 80 characters] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200324170532.44384-2-andriy.shevchenko@linux.intel.com
2020-04-17video: ssd1307fb: Convert driver to use ->probe_new()Andy Shevchenko1-8/+2
Use the ->probe_new() callback. The driver does not use const struct i2c_device_id * argument, so convert it to utilise the simplified I²C driver registration. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200324170532.44384-1-andriy.shevchenko@linux.intel.com
2020-03-02video: Replace zero-length array with flexible-array memberGustavo A. R. Silva1-1/+1
The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200221160005.GA13552@embeddedor
2020-01-15video: ssd1307fb: add the missed regulator_disableChuhong Yuan1-0/+2
The driver forgets to disable the regulator in remove like what is done in probe failure. Add the missed call to fix it. Signed-off-by: Chuhong Yuan <hslester96@gmail.com> Tested-by: Michal Vokáč <michal.vokac@ysoft.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191118114150.25724-1-hslester96@gmail.com
2019-12-05video: constify fb ops across all driversJani Nikula1-1/+1
Now that the fbops member of struct fb_info is const, we can start making the ops const as well. This does not cover all drivers; some actually modify the fbops struct, for example to adjust for different configurations, and others do more involved things that I'd rather not touch in practically obsolete drivers. Mostly this is the low hanging fruit where we can add "const" and be done with it. v3: - un-constify atyfb, mb862xx, nvidia and uvesabf (0day) v2: - fix typo (Christophe de Dinechin) - use "static const" instead of "const static" in mx3fb.c - also constify smscufx.c Cc: linux-fbdev@vger.kernel.org Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/ce67f14435f3af498f2e8bf35ce4be11f7504132.1575390740.git.jani.nikula@intel.com
2019-07-23video: ssd1307fb: Add devicetree configuration of display setupMarko Kohtala1-16/+65
Various displays have differences that only mean initializing the display driver IC with different fixed register values. Defining these in devicetree offers easier way to adapt the driver to new displays than requiring a patch to the kernel. This adds devicetree properties needed to make the initialization match the example setup as offered by Densitron for their 128x36 display. It also makes some old one bit parameter handling a little cleaner. Signed-off-by: Marko Kohtala <marko.kohtala@okoko.fi> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@linux.ie> Cc: Michal Vokáč <michal.vokac@ysoft.com> [b.zolnierkie: fix parenthesis alignment] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190618074111.9309-7-marko.kohtala@okoko.fi
2019-07-23video: ssd1307fb: Handle width and height that are not multiple of 8Marko Kohtala1-13/+17
Some displays have dimensions that are not multiple of eight, for example height of 36, but the driver divided the dimensions by 8. Defining display to the next multiple of 8 is not good as then the display registers get configured to dimensions that do not match. This contradicts intructions by some display manufacturers. Use DIV_ROUND_UP to multiple of 8 when needed so correct values can be used. The ssd1307fb_update_display bit reordering receives a simplification in the process. Signed-off-by: Marko Kohtala <marko.kohtala@okoko.fi> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@linux.ie> Cc: Michal Vokáč <michal.vokac@ysoft.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190618074111.9309-5-marko.kohtala@okoko.fi
2019-07-23video: ssd1307fb: Start page range at page_offsetMarko Kohtala1-1/+1
The page_offset was only applied to the end of the page range. This caused the display updates to cause a scrolling effect on the display because the amount of data written to the display did not match the range display expected. Fixes: 301bc0675b67 ("video: ssd1307fb: Make use of horizontal addressing mode") Signed-off-by: Marko Kohtala <marko.kohtala@okoko.fi> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@linux.ie> Cc: Michal Vokáč <michal.vokac@ysoft.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190618074111.9309-4-marko.kohtala@okoko.fi
2019-07-23video: ssd1307fb: Remove unneeded semicolonsMarko Kohtala1-4/+4
coccicheck reported unneeded semicolons. Remove them. Signed-off-by: Marko Kohtala <marko.kohtala@okoko.fi> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@linux.ie> Cc: Michal Vokáč <michal.vokac@ysoft.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190618074111.9309-3-marko.kohtala@okoko.fi
2019-07-23video: ssd1307fb: Use screen_buffer instead of screen_baseMarko Kohtala1-5/+5
sparse reported incorrect type due to different address spaces. The screen_base is __iomem, but the memory is not from a device so we can use screen_buffer instead and avoid some type casts. Signed-off-by: Marko Kohtala <marko.kohtala@okoko.fi> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@linux.ie> Cc: Michal Vokáč <michal.vokac@ysoft.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190618074111.9309-2-marko.kohtala@okoko.fi
2019-06-28video: fbdev: don't print error message on framebuffer_alloc() failureBartlomiej Zolnierkiewicz1-3/+1
framebuffer_alloc() can fail only on kzalloc() memory allocation failure and since kzalloc() will print error message in such case we can omit printing extra error message in drivers (which BTW is what the majority of framebuffer_alloc() users is doing already). Cc: "Bruno Prémont" <bonbons@linux-vserver.org> Cc: Jiri Kosina <jikos@kernel.org> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
2019-05-24treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 71Thomas Gleixner1-2/+1
Based on 1 normalized pattern(s): licensed under the gplv2 or later extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 5 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190520071859.659568621@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-08video: ssd1307fb: Do not hard code active-low reset sequenceMichal Vokáč1-2/+2
The SSD130x OLED display reset signal is active low. Now the reset sequence is implemented in such a way that users are forced to define reset-gpios as GPIO_ACTIVE_HIGH in DT to make the reset work. Do not hard code the active-low sequence into the driver but instead allow the user to specify the gpio as GPIO_ACTIVE_LOW to reflect the real world. Reviewed-by: Rob Herring <robh@kernel.org> Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Fabio Estevam <fabio.estevam@nxp.com> Cc: Maxime Ripard <maxime.ripard@bootlin.com>, Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
2018-10-09Revert "video: ssd1307fb: Do not hard code active-low reset sequence"Bartlomiej Zolnierkiewicz1-2/+2
This reverts commit 9827f26374fb85e1811f2adbcc25c8a3992dbe7f. On 10/09/2018 02:20 AM, Shawn Guo wrote: > Well, it means the change breaks the ABI between kernel and device tree, > e.g. the new kernel will not work with existing/installed DTBs. Revert the change until DTB compatibility issue is resolved. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
2018-10-08video: ssd1307fb: Do not hard code active-low reset sequenceMichal Vokáč1-2/+2
The SSD130x OLED display reset signal is active low. Now the reset sequence is implemented in such a way that users are forced to define reset-gpios as GPIO_ACTIVE_HIGH in DT to make the reset work. Do not hard code the active-low sequence into the driver but instead allow the user to specify the gpio as GPIO_ACTIVE_LOW to reflect the real world. Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Rob Herring <robh+dt@kernel.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
2018-10-08video: ssd1307fb: Use gpiod_set_value_cansleep() for resetMichal Vokáč1-2/+2
The reset signal can be produced by GPIO expander that can sleep. In that case the probe function fails. Allow using GPIO expanders for the reset signal by using the non-atomic gpiod_set_value_cansleep() function. Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Rob Herring <robh+dt@kernel.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
2018-03-28video: ssd1307fb: Improve a size determination in ssd1307fb_probe()Markus Elfring1-1/+2
Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Bastian Stender <bst@pengutronix.de> Cc: Jyri Sarha <jsarha@ti.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
2017-04-07fbdev/ssd1307fb: fix optional VBAT supportBastian Stender1-8/+16
SSD1306 needs VBAT when it is wired in charge pump configuration only. Other controllers of the SSD1307 family do not need it at all. This was introduced by commit ba14301e0356 ("fbdev/ssd1307fb: add support to enable VBAT"). Without VBAT configuration the driver now fails with: failed to get VBAT regulator: -19 This is caused by misinterpretation of devm_regulator_get_optional which "returns a struct regulator corresponding to the regulator producer or IS_ERR() condition". Handle -ENODEV without bailing out and making VBAT support really optional. Signed-off-by: Bastian Stender <bst@pengutronix.de> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Jyri Sarha <jsarha@ti.com> Cc: Roger Quadros <rogerq@ti.com> [b.zolnierkie: minor fixups] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
2017-02-20fbdev: ssd1307fb: include linux/gpio/consumer.hArnd Bergmann1-0/+1
Changing this driver to the gpiod API requires the use of the new-style header, depending on the configuration: drivers/video/fbdev/ssd1307fb.c: In function 'ssd1307fb_probe': drivers/video/fbdev/ssd1307fb.c:569:15: error: implicit declaration of function 'devm_gpiod_get_optional';did you mean 'devm_regulator_get_optional'? [-Werror=implicit-function-declaration] drivers/video/fbdev/ssd1307fb.c:570:11: error: 'GPIOD_OUT_LOW' undeclared (first use in this function) Fixes: 72db33355c14 ("fbdev: ssd1307fb: Start to use gpiod API for reset gpio") Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Jyri Sarha <jsarha@ti.com> Cc: LABBE Corentin <clabbe.montjoie@gmail.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
2017-02-08fbdev/ssd1307fb: clear screen in probeTomi Valkeinen1-3/+2
SSD1306 does not clear the panel's framebuffer automatically, even if a HW reset happens, so we need to do that at probe time before enabling the panel. Cc: Rob Herring <robh+dt@kernel.org> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Benoît Cousson <bcousson@baylibre.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
2017-02-08fbdev/ssd1307fb: add support to enable VBATTomi Valkeinen1-1/+19
SSD1306 needs VBAT when it is wired in charge pump configuration. This patch adds support to the driver to enable VBAT regulator at init time. Cc: Rob Herring <robh+dt@kernel.org> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Benoît Cousson <bcousson@baylibre.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Reviewed-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
2017-02-08fbdev: ssd1307fb: Make reset gpio devicetree property optionalJyri Sarha1-6/+13
Make reset gpio devicetree property optional. Depending on the board designing there may not be a dedicated gpio for resetting the display. Without a proper reset there may be some junk in the display memory at probe time, so in such a case the display memory is cleared before turning it on. The devicetree binding document is also updated. Cc: Rob Herring <robh+dt@kernel.org> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Benoît Cousson <bcousson@baylibre.com> Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
2017-02-08fbdev: ssd1307fb: Start to use gpiod API for reset gpioJyri Sarha1-17/+8
Start to use gpiod API for reset gpio. Cc: Rob Herring <robh+dt@kernel.org> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Benoît Cousson <bcousson@baylibre.com> Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
2016-09-27fbdev: ssd1307fb: fix a possible NULL dereferenceLABBE Corentin1-2/+1
of_match_device could return NULL, and so cause a NULL pointer dereference later. For fixing this problem, we use of_device_get_match_data(), this will simplify the code a little by using a standard function for getting the match data. Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2016-09-27fbdev: ssd1307fb: constify the device_info pointerLABBE Corentin1-3/+3
of_match_device return const data, so instead of casting its return value this patch constify the device_info pointer. Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2016-09-27video: fbdev: constify fb_fix_screeninfo and fb_var_screeninfo structuresJulia Lawall1-2/+2
These structures are only used to copy into other structures, so declare them as const. The semantic patch that makes this change in the fb_fix_screeninfo case is as follows (http://coccinelle.lip6.fr/). The fb_var_screeninfo case is analogous. // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct fb_fix_screeninfo i@p = { ... }; @ok@ identifier r.i; expression e; position p; @@ e = i@p @bad@ position p != {r.p,ok.p}; identifier r.i; struct fb_fix_screeninfo e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct fb_fix_screeninfo i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2016-05-25Merge tag 'pwm/for-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwmLinus Torvalds1-1/+10
Pull pwm updates from Thierry Reding: "This set of changes introduces an atomic API to the PWM subsystem. This is influenced by the DRM atomic API that was introduced a while back, though it is obviously a lot simpler. The fundamental idea remains the same, though: drivers provide a single callback to implement the atomic configuration of a PWM channel. As a side-effect the PWM subsystem gains the ability for initial state retrieval, so that the logical state mirrors that of the hardware. Many use-cases don't care about this, but for others it is essential. These new features require changes in all users, which these patches take care of. The core is transitioned to use the atomic callback if available and provides a fallback mechanism for other drivers. Changes to transition users and drivers to the atomic API are postponed to v4.8" * tag 'pwm/for-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: (30 commits) pwm: Add information about polarity, duty cycle and period to debugfs pwm: Switch to the atomic API pwm: Update documentation pwm: Add core infrastructure to allow atomic updates pwm: Add hardware readout infrastructure pwm: Move the enabled/disabled info into pwm_state pwm: Introduce the pwm_state concept pwm: Keep PWM state in sync with hardware state ARM: Explicitly apply PWM config extracted from pwm_args drm: i915: Explicitly apply PWM config extracted from pwm_args input: misc: pwm-beeper: Explicitly apply PWM config extracted from pwm_args input: misc: max8997: Explicitly apply PWM config extracted from pwm_args backlight: lm3630a: explicitly apply PWM config extracted from pwm_args backlight: lp855x: Explicitly apply PWM config extracted from pwm_args backlight: lp8788: Explicitly apply PWM config extracted from pwm_args backlight: pwm_bl: Use pwm_get_args() where appropriate fbdev: ssd1307fb: Use pwm_get_args() where appropriate regulator: pwm: Use pwm_get_args() where appropriate leds: pwm: Use pwm_get_args() where appropriate input: misc: max77693: Use pwm_get_args() where appropriate ...
2016-05-17fbdev: ssd1307fb: Use pwm_get_args() where appropriateBoris Brezillon1-1/+10
The PWM framework has clarified the concept of reference PWM config (the platform dependent config retrieved from the DT or the PWM lookup table) and real PWM state. Use pwm_get_args() when the PWM user wants to retrieve this reference config and not the current state. This is part of the rework allowing the PWM framework to support hardware readout and expose real PWM state even when the PWM has just been requested (before the user calls pwm_config/enable/disable()). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2016-05-10fbdev: ssd1307fb: Fix charge pump settingJulian Scheel1-1/+1
Make sure bit 4 is set for the charge pump setting. It is required according to SSD1306 App Note. Signed-off-by: Julian Scheel <julian@jusst.de> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-09-24fbdev: ssd1307fb: add ssd1309 supportOlliver Schinagl1-0/+11
The ssd1307fb driver supports a lot of chips from the ssd130xfb series. This patch adds the ssd1309 chip, a 128x64 OLED driver chip. It is very similar to the other chips and only has some definitions added to support it. Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Prabhakar Lad <prabhakar.csengg@gmail.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-09-24fbdev: ssd1307fb: alphabetize headersOlliver Schinagl1-5/+5
This patch sorts the headers on ssd1307fb driver. Signed-off-by: Olliver Schinagl <oliver@schinagl.nl> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-09-01fbdev: ssd1307fb: fix error return codeJulia Lawall1-2/+3
Propagate error code on failure. Also changed %ld to %d in dev_err to use ret variable rather than putting two calls to PTR_ERR. A simplified version of the semantic match that finds the first problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-08-20video: fbdev: Drop owner assignment from i2c_driverKrzysztof Kozlowski1-1/+0
i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-05-27fbdev: ssd1307fb: fix logical errorThomas Niederprüm1-1/+1
The logical not needs to be done after the bit masking. Fixes: a3998fe03e87 ("fbdev: ssd1307fb: Unify init code and obtain hw specific bits from DT") Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>