Thread (5 messages) 5 messages, 2 authors, 2016-01-29

Re: [PATCH] fbdev: ssd1307fb: Fix chargepump setting

From: Tomi Valkeinen <hidden>
Date: 2016-01-29 11:55:06

On 18/01/16 22:20, Julian Scheel wrote:
On 15.11.15 14:36, Julian Scheel wrote:
quoted
The charge pump setting must have bit D4 set all time according to the
SSD1306
App Note. Instead of doing an logical and off shifted setting bit with
0x14 it
must be an logical or with 0x10 to ensure D4 is set.
The code change looks ok, but I can't quite decipher the commit
description. "an logical and off shifted setting bit with 0x14"?
quoted
Signed-off-by: Julian Scheel <redacted>
---
  drivers/video/fbdev/ssd1307fb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/ssd1307fb.c
b/drivers/video/fbdev/ssd1307fb.c
index 1611215..5965a9b 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -389,7 +389,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)
          return ret;

      ret = ssd1307fb_write_cmd(par->client,
-        (par->device_info->need_chargepump & 0x1 << 2) & 0x14);
+        0x10 | ((par->device_info->need_chargepump & 0x01) << 2));
I presume 'need_chargepump' is really supposed to be a bool, instead of
int. And if it's really bool, something like this makes it more readable
to me:

BIT(4) | (par->device_info->need_chargepump ? BIT(2) : 0)

 Tomi

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help