aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/fbdev/ssd1307fb.c
AgeCommit message (Collapse)Author
2018-10-09Revert "video: ssd1307fb: Do not hard code active-low reset sequence"Bartlomiej Zolnierkiewicz
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áč
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áč
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 Elfring
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 Stender
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 Bergmann
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 Valkeinen
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 Valkeinen
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 Sarha
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 Sarha
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 Corentin
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 Corentin
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 Lawall
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 ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm 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 Brezillon
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 Scheel
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 Schinagl
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 Schinagl
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 Lawall
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 Kozlowski
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üm
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>
2015-05-27fbdev: ssd1307fb: potential ERR_PTR dereferenceDan Carpenter
The error handling got shifted down a few lines from where it was supposed to be for some reason. Fixes: a14a7ba8cb0f ('fbdev: ssd1307fb: add backlight controls for setting the contrast') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-05-27fbdev: ssd1307fb: Add blank modeThomas Niederprüm
This patch adds ssd1307fb_blank() to make the framebuffer capable of blanking. Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-05-27fbdev: ssd1307fb: add backlight controls for setting the contrastThomas Niederprüm
The backlight class is used to create userspace handles for setting the OLED contrast. Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-05-27fbdev: ssd1307fb: Turn off display on driver unload.Thomas Niederprüm
This patch turns off the display when the driver is unloaded. Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-05-27fbdev: ssd1307fb: Add a module parameter to set the refresh rateThomas Niederprüm
This patch adds the module parameter "refreshrate" to set delay for the deferred io. The refresh rate is given in units of Hertz. The default refresh rate is 1 Hz. The refresh rate set through the newly introduced parameter applies to all instances of the driver and for now it is not possible to change it individually. Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-05-27fbdev: ssd1307fb: Add support for SSD1305Thomas Niederprüm
This patch adds support for the SSD1305 OLED controller. Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-05-27fbdev: ssd1307fb: Unify init code and obtain hw specific bits from DTThomas Niederprüm
The 130X controllers are very similar from the configuration point of view. The configuration registers for the SSD1305/6/7 are bit identical (except the the VHCOM register and the the default values for clock setup register). This patch unifies the init code of the controller and adds hardware specific properties to DT that are needed to correctly initialize the device. The SSD130X can be wired to the OLED panel in various ways. Even for the same controller this wiring can differ from one display module to another and can not be probed by software. The added DT properties reflect these hardware decisions of the display module manufacturer. The 'com-sequential', 'com-lrremap' and 'com-invdir' values define different possibilities for the COM signals pin configuration and readout direction of the video memory. The 'segment-no-remap' allows the inversion of the memory-to-pin mapping ultimately inverting the order of the controllers output pins. The 'prechargepX' values need to be adapted according to the capacitance of the OLEDs pixel cells. So far these hardware specific bits are hard coded in the init code, making the driver usable only for one certain wiring of the controller. This patch makes the driver usable with all possible hardware setups, given a valid hw description in DT. If these values are not set in DT the default values, as they are set in the ssd1307 init code right now, are used. This implies that without the corresponding DT property "segment-no-remap" the segment remap of the ssd130X controller gets activated. Even though this is not the default behaviour according to the datasheet it maintains backward compatibility with older DTBs. Note that the SSD1306 does not seem to be using the configuration written to the registers at all. Therefore this patch does not try to maintain these values without changes in DT. For reference an example is added to the DT bindings documentation that reproduces the configuration that is set in the current init code. Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de> Tested-by: Olliver Schinagl <o.schinagl@ultimaker.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-05-27fbdev: ssd1307fb: Allocate page aligned video memory.Thomas Niederprüm
Currently the videomemory is allocated by kmalloc, making it a memory region that is not necessarily page aligend. This leads to problems upon mmap call, where the video memory's address gets aligned to the next page boundary. The result is that the userspace program that issued the mmap call is not able to access the video memory from the start to the next page boundary. This patch changes the allocation of the video memory to use __get_free_pages() in order to obtain memory that is aligned to page boundaries. Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-05-27fbdev: ssd1307fb: fix memory address smem_start.Thomas Niederprüm
the smem_start pointer of the framebuffer info struct needs to hold the physical address rather than the logical address. Right now the logical address returned by kmalloc is stored. This patch converts this address to a physical address and thus fixes a driver crash on mmaping the framebuffer memory due to an access to the wrong memory address. Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-01-30fbdev: ssd1307fb: return proper error code if write command failsPrabhakar Lad
this patch fixes ssd1307fb_ssd1306_init() function to return proper error codes in case of failures. Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-01-15fbdev: ssd1307fb: set default height if not found in DT nodeLad, Prabhakar
this patch sets the default height if its not found in DT. Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-01-15fbdev: ssd1307fb: drop unused function ssd1307fb_write_data()Lad, Prabhakar
this patch drops the unused function ssd1307fb_write_data(). Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2014-04-17video: move fbdev to drivers/video/fbdevTomi Valkeinen
The drivers/video directory is a mess. It contains generic video related files, directories for backlight, console, linux logo, lots of fbdev device drivers, fbdev framework files. Make some order into the chaos by creating drivers/video/fbdev directory, and move all fbdev related files there. No functionality is changed, although I guess it is possible that some subtle Makefile build order related issue could be created by this patch. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Rob Clark <robdclark@gmail.com> Acked-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>