From: Noralf Tronnes <notro@tronnes.org>
To: linux-fbdev@vger.kernel.org
Subject: Re: SSD1306 OLED driver
Date: Sat, 10 Jan 2015 00:03:04 +0000 [thread overview]
Message-ID: <54B06C38.6040207@tronnes.org> (raw)
In-Reply-To: <BAY176-W246A4D5C3A23D1928FC5D3D38C0@phx.gbl>
Den 09.01.2015 23:31, skrev maxime.ripard@free-electrons.com:
> On Fri, Jan 09, 2015 at 06:13:43PM +0530, Ssagarr Patil wrote:
>> Hi Maxime,
>>
>> Thanks for your response!
>>
>>> On Fri, Jan 09, 2015 at 03:45:01PM +0530, Ssagarr Patil wrote:
>>>> Hi Maxime,
>>>>
>>>>>>> Thanks for the pointer, I am using spi_write() call and I see /dev/fb0 node created.
>>>>>>> but when I do echo "1121"> /dev/fb0 nothing comes up on oled any pointers on this ?
>>>>>> You can't use it like that. It's a standard framebuffer, that is
>>>>>> represented as an array of pixels, so you need to use a font rendering
>>>>>> software if you want to output some text.
>>>>>>
>>>>> can fbtest
>>>>> (https://git.kernel.org/cgit/linux/kernel/git/geert/fbtest.git/)
>>>>> be used to to draw something ?
>>>>>
>>>> how do I set pixels of it ? Please if you can point me to some stuff that would be helpful.
>>> Last time I tried, fbtest didn't support monochrome display.
>>>
>>> And you'll find anything you need in the documentation.
>>> https://www.kernel.org/doc/Documentation/fb/framebuffer.txt
>>>
>> In my case I see that init is done but I dont see any pixels on the
>> screen at all.
>>
>> I am now concerned if the driver was tested in first place ?
> No. I just submitted some good looking code that never ever got
> tested.
>
> More seriously, There's a few thing that comes to my mind:
> - Your controller doesn't behave the same way than the ones already
> supported.
> - You haven't posted your changes yet, so maybe you're not doing the
> transfers right
> - Your SPI controller is doing something weird
>
> What happens if you plug a logical analyzer on the bus?
>
> Maxime
>
Hi,
The major difference between the SSD1306 SPI and I2C interfaces, is that
SPI uses a D/C pin to signal whether it's data or command coming in.
Looking at ssd1307fb, this Data/Command info is embedded as the first
byte in the i2c package/message.
Without looking up the datasheet, I would guess that this is the only
difference, the way the D/C bit is handled.
The rest of the package payload should be the same.
So:
dc=0, spi write command
dc=1, spi write data (optional)
Apart from that, I have SSD1306 SPI support in a project of mine:
This is the part writing the framebuffer:
https://github.com/notro/fbtft/blob/master/fb_ssd1306.c#L173
This writes commands (for many controllers):
https://github.com/notro/fbtft/blob/master/fbtft-bus.c#L10
This is the SPI specific part:
https://github.com/notro/fbtft/blob/master/fbtft-io.c#L10
Project wiki: https://github.com/notro/fbtft/wiki
The code isn't particularly pretty, it was my first venture into the kernel.
It has recently been submitted for the staging tree:
https://github.com/notro/fbtft/issues/161#issuecomment-68431405
I'm currently rewriting the project armed with better knowledge of the
kernel and the various LCD controllers.
I haven't done the SSD1306 controller yet, but the principle is almost
the same for all these MIPI DBI like controllers.
The major difference is that it's monochrome and has a different
register map.
In my rewrite I have made an abstraction for the LCD register:
https://github.com/notro/fbdbi/blob/master/core/lcdreg.h#L46
SPI part matching several controller variations:
https://github.com/notro/fbdbi/blob/master/core/lcdreg-spi.c
In case you wonder: In my code I set the the window where the update is
to take place every time, whereas ssd1307fb does this only once in init.
I do this because controllers supporting higher resolutions can be sped
up using partial updates (set_addr_win).
Regards,
Noralf Trønnes
next prev parent reply other threads:[~2015-01-10 0:03 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-14 11:51 SSD1306 OLED driver Ssagarr Patil
2014-11-16 9:50 ` maxime.ripard
2014-11-18 14:59 ` Ssagarr Patil
2014-11-18 15:20 ` maxime.ripard
2015-01-05 11:15 ` Ssagarr Patil
2015-01-05 13:47 ` maxime.ripard
2015-01-06 13:12 ` Ssagarr Patil
2015-01-08 9:33 ` maxime.ripard
2015-01-08 18:26 ` Ssagarr Patil
2015-01-09 10:27 ` Ssagarr Patil
2015-01-09 11:03 ` maxime.ripard
2015-01-09 12:55 ` Ssagarr Patil
2015-01-09 13:58 ` Geert Uytterhoeven
2015-01-09 22:23 ` maxime.ripard
2015-01-09 22:31 ` maxime.ripard
2015-01-10 0:03 ` Noralf Tronnes [this message]
2015-01-10 12:46 ` Ssagarr Patil
2015-01-10 13:50 ` Noralf Tronnes
2015-01-10 21:19 ` Ssagarr Patil
2015-01-11 14:20 ` Noralf Tronnes
2015-01-12 9:56 ` Ssagarr Patil
2015-01-12 14:30 ` Noralf Tronnes
2015-01-13 13:45 ` Ssagarr Patil
2015-01-14 13:51 ` Ssagarr Patil
2015-01-14 15:27 ` Geert Uytterhoeven
2015-01-14 16:17 ` Ssagarr Patil
2015-01-14 16:38 ` Ssagarr Patil
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=54B06C38.6040207@tronnes.org \
--to=notro@tronnes.org \
--cc=linux-fbdev@vger.kernel.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).