linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] video: ssd1307fb: Enable charge pump only on displays that actually have it
@ 2021-05-12  9:48 Michal Vokáč
  0 siblings, 0 replies; only message in thread
From: Michal Vokáč @ 2021-05-12  9:48 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-fbdev, dri-devel, Michal Vokáč

A note in the datasheet says:

 "Patterns other than those given in the Command Table are prohibited to
  enter the chip as a command; as unexpected results can occur."

So do not send the charge pump command to displays that do not support it.

Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
---
 drivers/video/fbdev/ssd1307fb.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index 1b0b2a096afa..54903ea2e3ac 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -497,14 +497,16 @@ static int ssd1307fb_init_regs(struct ssd1307fb_par *par)
 		return ret;
 
 	/* Turn on the DC-DC Charge Pump */
-	ret = ssd1307fb_write_cmd(par->client, SSD1307FB_CHARGE_PUMP);
-	if (ret < 0)
-		return ret;
+	if (par->device_info->need_chargepump) {
+		ret = ssd1307fb_write_cmd(par->client, SSD1307FB_CHARGE_PUMP);
+		if (ret < 0)
+			return ret;
 
-	ret = ssd1307fb_write_cmd(par->client,
-		BIT(4) | (par->device_info->need_chargepump ? BIT(2) : 0));
-	if (ret < 0)
-		return ret;
+		ret = ssd1307fb_write_cmd(par->client,
+			BIT(4) | (par->device_info->need_chargepump ? BIT(2) : 0));
+		if (ret < 0)
+			return ret;
+	}
 
 	/* Set lookup table */
 	if (par->lookup_table_set) {
-- 
2.1.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-12  9:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12  9:48 [PATCH RESEND] video: ssd1307fb: Enable charge pump only on displays that actually have it Michal Vokáč

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).