Commit fdde1a81 authored by Jyri Sarha's avatar Jyri Sarha Committed by Bartlomiej Zolnierkiewicz

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: default avatarJyri Sarha <jsarha@ti.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
parent 519b4dba
...@@ -8,14 +8,14 @@ Required properties: ...@@ -8,14 +8,14 @@ Required properties:
0x3c or 0x3d 0x3c or 0x3d
- pwm: Should contain the pwm to use according to the OF device tree PWM - pwm: Should contain the pwm to use according to the OF device tree PWM
specification [0]. Only required for the ssd1307. specification [0]. Only required for the ssd1307.
- reset-gpios: Should contain the GPIO used to reset the OLED display. See
Documentation/devicetree/bindings/gpio/gpio.txt for details.
- solomon,height: Height in pixel of the screen driven by the controller - solomon,height: Height in pixel of the screen driven by the controller
- solomon,width: Width in pixel of the screen driven by the controller - solomon,width: Width in pixel of the screen driven by the controller
- solomon,page-offset: Offset of pages (band of 8 pixels) that the screen is - solomon,page-offset: Offset of pages (band of 8 pixels) that the screen is
mapped to. mapped to.
Optional properties: Optional properties:
- reset-gpios: The GPIO used to reset the OLED display, if available. See
Documentation/devicetree/bindings/gpio/gpio.txt for details.
- solomon,segment-no-remap: Display needs normal (non-inverted) data column - solomon,segment-no-remap: Display needs normal (non-inverted) data column
to segment mapping to segment mapping
- solomon,com-seq: Display uses sequential COM pin configuration - solomon,com-seq: Display uses sequential COM pin configuration
......
...@@ -439,6 +439,10 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) ...@@ -439,6 +439,10 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)
if (ret < 0) if (ret < 0)
return ret; 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 */ /* Turn on the display */
ret = ssd1307fb_write_cmd(par->client, SSD1307FB_DISPLAY_ON); ret = ssd1307fb_write_cmd(par->client, SSD1307FB_DISPLAY_ON);
if (ret < 0) if (ret < 0)
...@@ -561,7 +565,8 @@ static int ssd1307fb_probe(struct i2c_client *client, ...@@ -561,7 +565,8 @@ static int ssd1307fb_probe(struct i2c_client *client,
par->device_info = of_device_get_match_data(&client->dev); 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)) { if (IS_ERR(par->reset)) {
dev_err(&client->dev, "failed to get reset gpio: %ld\n", dev_err(&client->dev, "failed to get reset gpio: %ld\n",
PTR_ERR(par->reset)); PTR_ERR(par->reset));
...@@ -645,11 +650,13 @@ static int ssd1307fb_probe(struct i2c_client *client, ...@@ -645,11 +650,13 @@ static int ssd1307fb_probe(struct i2c_client *client,
i2c_set_clientdata(client, info); i2c_set_clientdata(client, info);
/* Reset the screen */ if (par->reset) {
gpiod_set_value(par->reset, 0); /* Reset the screen */
udelay(4); gpiod_set_value(par->reset, 0);
gpiod_set_value(par->reset, 1); udelay(4);
udelay(4); gpiod_set_value(par->reset, 1);
udelay(4);
}
ret = ssd1307fb_init(par); ret = ssd1307fb_init(par);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment