From: Jyri Sarha <jsarha-l0cyMroinI0@public.gmane.org>
To: linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org,
tomi.valkeinen-l0cyMroinI0@public.gmane.org,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org,
bcousson-rdvid1DuHRBWk0Htik3J/w@public.gmane.org,
Jyri Sarha <jsarha-l0cyMroinI0@public.gmane.org>
Subject: [PATCH 3/3] fbdev: ssd1307fb: Make reset gpio devicetree property optional
Date: Tue, 7 Jun 2016 16:51:14 +0300 [thread overview]
Message-ID: <2901318f99dbcdea2dcaff4aedc2797fd809b572.1465303439.git.jsarha@ti.com> (raw)
In-Reply-To: <cover.1465303439.git.jsarha-l0cyMroinI0@public.gmane.org>
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.
Signed-off-by: Jyri Sarha <jsarha-l0cyMroinI0@public.gmane.org>
---
.../devicetree/bindings/display/ssd1307fb.txt | 4 ++--
drivers/video/fbdev/ssd1307fb.c | 19 +++++++++++++------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/ssd1307fb.txt b/Documentation/devicetree/bindings/display/ssd1307fb.txt
index 4aee67f..6617df6 100644
--- a/Documentation/devicetree/bindings/display/ssd1307fb.txt
+++ b/Documentation/devicetree/bindings/display/ssd1307fb.txt
@@ -8,14 +8,14 @@ Required properties:
0x3c or 0x3d
- pwm: Should contain the pwm to use according to the OF device tree PWM
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,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
mapped to.
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
to segment mapping
- solomon,com-seq: Display uses sequential COM pin configuration
diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index b27912c..891dfe1 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)
@@ -562,7 +566,8 @@ static int ssd1307fb_probe(struct i2c_client *client,
par->device_info = (struct ssd1307fb_deviceinfo *)of_match_device(
ssd1307fb_of_match, &client->dev)->data;
- 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));
@@ -646,11 +651,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)
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2016-06-07 13:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-07 13:51 [PATCH 0/3] fbdev: ssd1307fb: Make reset-gpios optional property Jyri Sarha
[not found] ` <cover.1465303439.git.jsarha-l0cyMroinI0@public.gmane.org>
2016-06-07 13:51 ` [PATCH 1/3] fbdev: ssd1307fb: Start to use gpiod API for reset gpio Jyri Sarha
2016-06-07 13:51 ` [PATCH 2/3] fbdev: ssd1307fb: Remove reset-active-low from the DT binding document Jyri Sarha
[not found] ` <fc99babab77bbf9fcbe34fc82d7e2a18f9a1e464.1465303439.git.jsarha-l0cyMroinI0@public.gmane.org>
2016-06-08 20:09 ` Rob Herring
2016-06-07 13:51 ` Jyri Sarha [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2901318f99dbcdea2dcaff4aedc2797fd809b572.1465303439.git.jsarha@ti.com \
--to=jsarha-l0cymroini0@public.gmane.org \
--cc=bcousson-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org \
--cc=tomi.valkeinen-l0cyMroinI0@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).