summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2017-02-08 18:43:59 +0300
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2017-02-08 18:43:59 +0300
commitfdde1a8148d81617582c138cd1fbdc4594d4c941 (patch)
tree9e76f4eef6b4b0944288897faab4d65525ecae74 /drivers/video
parent519b4dba586198eed8f72ba07bc71808af2e0e32 (diff)
downloadlinux-fdde1a8148d81617582c138cd1fbdc4594d4c941.tar.xz
fbdev: ssd1307fb: Make reset gpio devicetree property optional
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>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/ssd1307fb.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index 8ffaaeeb2f84..89372af7bc5b 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -439,6 +439,10 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)
if (ret < 0)
return ret;
+ /* Clear the screen if we could not give reset at probe time */
+ if (!par->reset)
+ ssd1307fb_update_display(par);
+
/* Turn on the display */
ret = ssd1307fb_write_cmd(par->client, SSD1307FB_DISPLAY_ON);
if (ret < 0)
@@ -561,7 +565,8 @@ static int ssd1307fb_probe(struct i2c_client *client,
par->device_info = of_device_get_match_data(&client->dev);
- par->reset = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_LOW);
+ par->reset = devm_gpiod_get_optional(&client->dev, "reset",
+ GPIOD_OUT_LOW);
if (IS_ERR(par->reset)) {
dev_err(&client->dev, "failed to get reset gpio: %ld\n",
PTR_ERR(par->reset));
@@ -645,11 +650,13 @@ static int ssd1307fb_probe(struct i2c_client *client,
i2c_set_clientdata(client, info);
- /* Reset the screen */
- gpiod_set_value(par->reset, 0);
- udelay(4);
- gpiod_set_value(par->reset, 1);
- udelay(4);
+ if (par->reset) {
+ /* Reset the screen */
+ gpiod_set_value(par->reset, 0);
+ udelay(4);
+ gpiod_set_value(par->reset, 1);
+ udelay(4);
+ }
ret = ssd1307fb_init(par);
if (ret)