Commit b3cb53721890879d7bde31f5f9eefd4edf41ab64

Authored by Alberto Panizzo
Committed by Linus Torvalds
1 parent 859ddf0974

mx3fb: some debug and initialisation fixes

Fix the kernel oops when dev_dbg is called with mx3_fbi->txd == NULL

Fix the late initialisation of mx3fb->backlight_level.  If not, in the
chain of function started by init_fb_chan(), in __blank() call
sdc_set_brightness(mx3fb, mx3fb->backlight_level) that will shut down the
CONTRAST PWM output.

Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski <at> gmx.de>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 8 additions and 4 deletions Side-by-side Diff

drivers/video/mx3fb.c
... ... @@ -324,8 +324,11 @@
324 324 unsigned long flags;
325 325 dma_cookie_t cookie;
326 326  
327   - dev_dbg(mx3fb->dev, "mx3fbi %p, desc %p, sg %p\n", mx3_fbi,
328   - to_tx_desc(mx3_fbi->txd), to_tx_desc(mx3_fbi->txd)->sg);
  327 + if (mx3_fbi->txd)
  328 + dev_dbg(mx3fb->dev, "mx3fbi %p, desc %p, sg %p\n", mx3_fbi,
  329 + to_tx_desc(mx3_fbi->txd), to_tx_desc(mx3_fbi->txd)->sg);
  330 + else
  331 + dev_dbg(mx3fb->dev, "mx3fbi %p, txd = NULL\n", mx3_fbi);
329 332  
330 333 /* This enables the channel */
331 334 if (mx3_fbi->cookie < 0) {
... ... @@ -646,6 +649,7 @@
646 649  
647 650 static void sdc_set_brightness(struct mx3fb_data *mx3fb, uint8_t value)
648 651 {
  652 + dev_dbg(mx3fb->dev, "%s: value = %d\n", __func__, value);
649 653 /* This might be board-specific */
650 654 mx3fb_write_reg(mx3fb, 0x03000000UL | value << 16, SDC_PWM_CTRL);
651 655 return;
652 656  
... ... @@ -1486,11 +1490,11 @@
1486 1490 goto ersdc0;
1487 1491 }
1488 1492  
  1493 + mx3fb->backlight_level = 255;
  1494 +
1489 1495 ret = init_fb_chan(mx3fb, to_idmac_chan(chan));
1490 1496 if (ret < 0)
1491 1497 goto eisdc0;
1492   -
1493   - mx3fb->backlight_level = 255;
1494 1498  
1495 1499 return 0;
1496 1500