aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2017-02-08 10:43:59 -0500
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2017-02-08 10:43:59 -0500
commitfdde1a8148d81617582c138cd1fbdc4594d4c941 (patch)
tree9e76f4eef6b4b0944288897faab4d65525ecae74
parent519b4dba586198eed8f72ba07bc71808af2e0e32 (diff)
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>
-rw-r--r--Documentation/devicetree/bindings/display/ssd1307fb.txt4
-rw-r--r--drivers/video/fbdev/ssd1307fb.c19
2 files changed, 15 insertions, 8 deletions
diff --git a/Documentation/devicetree/bindings/display/ssd1307fb.txt b/Documentation/devicetree/bindings/display/ssd1307fb.txt
index 4aee67fdf2cf..6617df68d8b8 100644
--- a/Documentation/devicetree/bindings/display/ssd1307fb.txt
+++ b/Documentation/devicetree/bindings/display/ssd1307fb.txt
@@ -8,14 +8,14 @@ Required properties:
8 0x3c or 0x3d 8 0x3c or 0x3d
9 - pwm: Should contain the pwm to use according to the OF device tree PWM 9 - pwm: Should contain the pwm to use according to the OF device tree PWM
10 specification [0]. Only required for the ssd1307. 10 specification [0]. Only required for the ssd1307.
11 - reset-gpios: Should contain the GPIO used to reset the OLED display. See
12 Documentation/devicetree/bindings/gpio/gpio.txt for details.
13 - solomon,height: Height in pixel of the screen driven by the controller 11 - solomon,height: Height in pixel of the screen driven by the controller
14 - solomon,width: Width in pixel of the screen driven by the controller 12 - solomon,width: Width in pixel of the screen driven by the controller
15 - solomon,page-offset: Offset of pages (band of 8 pixels) that the screen is 13 - solomon,page-offset: Offset of pages (band of 8 pixels) that the screen is
16 mapped to. 14 mapped to.
17 15
18Optional properties: 16Optional properties:
17 - reset-gpios: The GPIO used to reset the OLED display, if available. See
18 Documentation/devicetree/bindings/gpio/gpio.txt for details.
19 - solomon,segment-no-remap: Display needs normal (non-inverted) data column 19 - solomon,segment-no-remap: Display needs normal (non-inverted) data column
20 to segment mapping 20 to segment mapping
21 - solomon,com-seq: Display uses sequential COM pin configuration 21 - solomon,com-seq: Display uses sequential COM pin configuration
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)
439 if (ret < 0) 439 if (ret < 0)
440 return ret; 440 return ret;
441 441
442 /* Clear the screen if we could not give reset at probe time */
443 if (!par->reset)
444 ssd1307fb_update_display(par);
445
442 /* Turn on the display */ 446 /* Turn on the display */
443 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_DISPLAY_ON); 447 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_DISPLAY_ON);
444 if (ret < 0) 448 if (ret < 0)
@@ -561,7 +565,8 @@ static int ssd1307fb_probe(struct i2c_client *client,
561 565
562 par->device_info = of_device_get_match_data(&client->dev); 566 par->device_info = of_device_get_match_data(&client->dev);
563 567
564 par->reset = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_LOW); 568 par->reset = devm_gpiod_get_optional(&client->dev, "reset",
569 GPIOD_OUT_LOW);
565 if (IS_ERR(par->reset)) { 570 if (IS_ERR(par->reset)) {
566 dev_err(&client->dev, "failed to get reset gpio: %ld\n", 571 dev_err(&client->dev, "failed to get reset gpio: %ld\n",
567 PTR_ERR(par->reset)); 572 PTR_ERR(par->reset));
@@ -645,11 +650,13 @@ static int ssd1307fb_probe(struct i2c_client *client,
645 650
646 i2c_set_clientdata(client, info); 651 i2c_set_clientdata(client, info);
647 652
648 /* Reset the screen */ 653 if (par->reset) {
649 gpiod_set_value(par->reset, 0); 654 /* Reset the screen */
650 udelay(4); 655 gpiod_set_value(par->reset, 0);
651 gpiod_set_value(par->reset, 1); 656 udelay(4);
652 udelay(4); 657 gpiod_set_value(par->reset, 1);
658 udelay(4);
659 }
653 660
654 ret = ssd1307fb_init(par); 661 ret = ssd1307fb_init(par);
655 if (ret) 662 if (ret)