linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* imxfb does not turn on automatically
@ 2015-02-21 15:18 Fabio Estevam
  2016-01-08 20:18 ` Carlos Soto
  0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2015-02-21 15:18 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Carlos Soto uses a Karo mx25 and he noticed that the LCD only works if we do:

echo 1 > /sys/class/graphics/fb0/blank
echo 0 > /sys/class/graphics/fb0/blank

I can confirm the same on mx25pdk running 3.19 [1], but I could not
understand why the display does not start turned on by default.

[1] http://www.spinics.net/lists/arm-kernel/msg399949.html

Any ideas?

Thanks,

Fabio Estevam

^ permalink raw reply	[flat|nested] 4+ messages in thread

* imxfb does not turn on automatically
  2015-02-21 15:18 imxfb does not turn on automatically Fabio Estevam
@ 2016-01-08 20:18 ` Carlos Soto
  2016-01-11  7:16   ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Carlos Soto @ 2016-01-08 20:18 UTC (permalink / raw)
  To: linux-arm-kernel

2015-02-21 16:18 GMT+01:00 Fabio Estevam <festevam@gmail.com>:
>
> Hi,
>
> Carlos Soto uses a Karo mx25 and he noticed that the LCD only works if we do:
>
> echo 1 > /sys/class/graphics/fb0/blank
> echo 0 > /sys/class/graphics/fb0/blank
>
> I can confirm the same on mx25pdk running 3.19 [1], but I could not
> understand why the display does not start turned on by default.
>
> [1] http://www.spinics.net/lists/arm-kernel/msg399949.html
>
> Any ideas?
>
> Thanks,
>
> Fabio Estevam



Hi,
I know it's been a long time since Fabio posted the issue but recently
I had some time to work on it again, and I've narrowed it down a
little.

The problem seems to be related to the IPG clock used by the iMX25
framebuffer. All clocks used by the fb are enabled in
imxfb_enable_controller(...)

...
clk_prepare_enable(fbi->clk_ipg);
clk_prepare_enable(fbi->clk_ahb);
clk_prepare_enable(fbi->clk_per);
fbi->enabled = true;

...


But if the IPG clock is disabled and enabled right after, the LCD
works fine.

The changes made in imxfb.c were:
...

clk_prepare_enable(fbi->clk_ipg);
clk_disable_unprepare(fbi->clk_ipg);
clk_prepare_enable(fbi->clk_ipg);

clk_prepare_enable(fbi->clk_ahb);
clk_prepare_enable(fbi->clk_per);
fbi->enabled = true;

...

It was suggested by Fabio that this could be caused by a wrong clock
reference count which prevented the IPG fb clock to be enabled, but
I've checked in debugfs, and both enable_cnt  and prepare_cnt seem OK
for all three FB clocks.

So, I'm really stuck here. Any hints would be greatly appreciated.

Thanks,
Carlos Soto

2015-02-21 16:18 GMT+01:00 Fabio Estevam <festevam@gmail.com>:
> Hi,
>
> Carlos Soto uses a Karo mx25 and he noticed that the LCD only works if we do:
>
> echo 1 > /sys/class/graphics/fb0/blank
> echo 0 > /sys/class/graphics/fb0/blank
>
> I can confirm the same on mx25pdk running 3.19 [1], but I could not
> understand why the display does not start turned on by default.
>
> [1] http://www.spinics.net/lists/arm-kernel/msg399949.html
>
> Any ideas?
>
> Thanks,
>
> Fabio Estevam

^ permalink raw reply	[flat|nested] 4+ messages in thread

* imxfb does not turn on automatically
  2016-01-08 20:18 ` Carlos Soto
@ 2016-01-11  7:16   ` Sascha Hauer
  2016-01-11 16:32     ` Fabio Estevam
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2016-01-11  7:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Carlos,

On Fri, Jan 08, 2016 at 09:18:41PM +0100, Carlos Soto wrote:
> 2015-02-21 16:18 GMT+01:00 Fabio Estevam <festevam@gmail.com>:
> >
> > Hi,
> >
> > Carlos Soto uses a Karo mx25 and he noticed that the LCD only works if we do:
> >
> > echo 1 > /sys/class/graphics/fb0/blank
> > echo 0 > /sys/class/graphics/fb0/blank
> >
> > I can confirm the same on mx25pdk running 3.19 [1], but I could not
> > understand why the display does not start turned on by default.
> >
> > [1] http://www.spinics.net/lists/arm-kernel/msg399949.html
> >
> > Any ideas?
> >
> > Thanks,
> >
> > Fabio Estevam
> 
> 
> 
> Hi,
> I know it's been a long time since Fabio posted the issue but recently
> I had some time to work on it again, and I've narrowed it down a
> little.
> 
> The problem seems to be related to the IPG clock used by the iMX25
> framebuffer. All clocks used by the fb are enabled in
> imxfb_enable_controller(...)
> 
> ...
> clk_prepare_enable(fbi->clk_ipg);
> clk_prepare_enable(fbi->clk_ahb);
> clk_prepare_enable(fbi->clk_per);
> fbi->enabled = true;
> 
> ...
> 
> 
> But if the IPG clock is disabled and enabled right after, the LCD
> works fine.
> 
> The changes made in imxfb.c were:
> ...
> 
> clk_prepare_enable(fbi->clk_ipg);
> clk_disable_unprepare(fbi->clk_ipg);
> clk_prepare_enable(fbi->clk_ipg);
> 
> clk_prepare_enable(fbi->clk_ahb);
> clk_prepare_enable(fbi->clk_per);
> fbi->enabled = true;
> 
> ...
> 
> It was suggested by Fabio that this could be caused by a wrong clock
> reference count which prevented the IPG fb clock to be enabled, but
> I've checked in debugfs, and both enable_cnt  and prepare_cnt seem OK
> for all three FB clocks.

Unfortunately this LCD controller does not have an enable bit. The
controller starts directly when the clocks are enabled. If the clocks
are enabled when the controller is not yet programmed with proper
register values then it just goes into some undefined state. What I
suspect is that the clocks already were enabled before driver probe,
presumably by the bootloader, so the controller is already in undefined
state when entering Linux. Now by dis/enabling the ipg clock you
effectively reset the controller. Since you have programmed it with
valid register values in the mean time it starts working after this
reset.
To verify you could try to disable the LCDC related clock gates with
direct register writes in drivers/clk/imx/clk-imx25.c.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 4+ messages in thread

* imxfb does not turn on automatically
  2016-01-11  7:16   ` Sascha Hauer
@ 2016-01-11 16:32     ` Fabio Estevam
  0 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2016-01-11 16:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sascha,

On Mon, Jan 11, 2016 at 5:16 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:

> Unfortunately this LCD controller does not have an enable bit. The
> controller starts directly when the clocks are enabled. If the clocks
> are enabled when the controller is not yet programmed with proper
> register values then it just goes into some undefined state. What I
> suspect is that the clocks already were enabled before driver probe,
> presumably by the bootloader, so the controller is already in undefined
> state when entering Linux. Now by dis/enabling the ipg clock you
> effectively reset the controller. Since you have programmed it with
> valid register values in the mean time it starts working after this
> reset.
> To verify you could try to disable the LCDC related clock gates with
> direct register writes in drivers/clk/imx/clk-imx25.c.

Excellent! I did as you suggested and now the LCD turns on by default.

U-boot was enabling the LCD IPG clock.

Will submit a formal patch soon.

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-11 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-21 15:18 imxfb does not turn on automatically Fabio Estevam
2016-01-08 20:18 ` Carlos Soto
2016-01-11  7:16   ` Sascha Hauer
2016-01-11 16:32     ` Fabio Estevam

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