Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308223
b: refs/heads/master
c: 13aaea0
h: refs/heads/master
i:
  308221: 277f194
  308219: f762b46
  308215: aa10a02
  308207: 66ce265
  308191: c9d1fb4
  308159: 492198f
  308095: ac8fd87
  307967: a4eb8d8
  307711: 9d4255a
  307199: 34b6bcc
v: v3
  • Loading branch information
Sascha Hauer committed Apr 25, 2012
1 parent 3ccb466 commit 0939018
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aa29d840e3138fdf9459cc1e0101d6f25f8a48f4
refs/heads/master: 13aaea03b9e33af420a327b7ab800332d6fbabf5
50 changes: 35 additions & 15 deletions trunk/drivers/video/imxfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ struct imxfb_rgb {
struct imxfb_info {
struct platform_device *pdev;
void __iomem *regs;
struct clk *clk;
struct clk *clk_ipg;
struct clk *clk_ahb;
struct clk *clk_per;

/*
* These are the addresses we mapped
Expand Down Expand Up @@ -340,7 +342,7 @@ static int imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)

pr_debug("var->bits_per_pixel=%d\n", var->bits_per_pixel);

lcd_clk = clk_get_rate(fbi->clk);
lcd_clk = clk_get_rate(fbi->clk_per);

tmp = var->pixclock * (unsigned long long)lcd_clk;

Expand Down Expand Up @@ -455,11 +457,17 @@ static int imxfb_bl_update_status(struct backlight_device *bl)

fbi->pwmr = (fbi->pwmr & ~0xFF) | brightness;

if (bl->props.fb_blank != FB_BLANK_UNBLANK)
clk_enable(fbi->clk);
if (bl->props.fb_blank != FB_BLANK_UNBLANK) {
clk_prepare_enable(fbi->clk_ipg);
clk_prepare_enable(fbi->clk_ahb);
clk_prepare_enable(fbi->clk_per);
}
writel(fbi->pwmr, fbi->regs + LCDC_PWMR);
if (bl->props.fb_blank != FB_BLANK_UNBLANK)
clk_disable(fbi->clk);
if (bl->props.fb_blank != FB_BLANK_UNBLANK) {
clk_disable_unprepare(fbi->clk_per);
clk_disable_unprepare(fbi->clk_ahb);
clk_disable_unprepare(fbi->clk_ipg);
}

return 0;
}
Expand Down Expand Up @@ -522,7 +530,9 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
*/
writel(RMCR_LCDC_EN_MX1, fbi->regs + LCDC_RMCR);

clk_enable(fbi->clk);
clk_prepare_enable(fbi->clk_ipg);
clk_prepare_enable(fbi->clk_ahb);
clk_prepare_enable(fbi->clk_per);

if (fbi->backlight_power)
fbi->backlight_power(1);
Expand All @@ -539,7 +549,9 @@ static void imxfb_disable_controller(struct imxfb_info *fbi)
if (fbi->lcd_power)
fbi->lcd_power(0);

clk_disable(fbi->clk);
clk_disable_unprepare(fbi->clk_per);
clk_disable_unprepare(fbi->clk_ipg);
clk_disable_unprepare(fbi->clk_ahb);

writel(0, fbi->regs + LCDC_RMCR);
}
Expand Down Expand Up @@ -770,10 +782,21 @@ static int __init imxfb_probe(struct platform_device *pdev)
goto failed_req;
}

fbi->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(fbi->clk)) {
ret = PTR_ERR(fbi->clk);
dev_err(&pdev->dev, "unable to get clock: %d\n", ret);
fbi->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
if (IS_ERR(fbi->clk_ipg)) {
ret = PTR_ERR(fbi->clk_ipg);
goto failed_getclock;
}

fbi->clk_ahb = devm_clk_get(&pdev->dev, "ahb");
if (IS_ERR(fbi->clk_ahb)) {
ret = PTR_ERR(fbi->clk_ahb);
goto failed_getclock;
}

fbi->clk_per = devm_clk_get(&pdev->dev, "per");
if (IS_ERR(fbi->clk_per)) {
ret = PTR_ERR(fbi->clk_per);
goto failed_getclock;
}

Expand Down Expand Up @@ -858,7 +881,6 @@ static int __init imxfb_probe(struct platform_device *pdev)
failed_map:
iounmap(fbi->regs);
failed_ioremap:
clk_put(fbi->clk);
failed_getclock:
release_mem_region(res->start, resource_size(res));
failed_req:
Expand Down Expand Up @@ -895,8 +917,6 @@ static int __devexit imxfb_remove(struct platform_device *pdev)

iounmap(fbi->regs);
release_mem_region(res->start, resource_size(res));
clk_disable(fbi->clk);
clk_put(fbi->clk);

platform_set_drvdata(pdev, NULL);

Expand Down

0 comments on commit 0939018

Please sign in to comment.