1
0
Fork 0

video: mxsfb: Add support for second lcd supply

Searches device tree for lcd2-supply
pull/10/head
Lars Ivar Miljeteig 2020-04-17 14:12:03 +02:00 committed by Steinar Bakkemo
parent 95219396d6
commit b255585a90
1 changed files with 37 additions and 0 deletions

View File

@ -252,6 +252,7 @@ struct mxsfb_info {
unsigned dotclk_delay;
const struct mxsfb_devdata *devdata;
struct regulator *reg_lcd;
struct regulator *reg_lcd2;
bool wait4vsync;
struct completion vsync_complete;
struct completion flip_complete;
@ -701,6 +702,15 @@ static void mxsfb_enable_controller(struct fb_info *fb_info)
}
}
if (host->reg_lcd2) {
ret = regulator_enable(host->reg_lcd2);
if (ret) {
dev_err(&host->pdev->dev,
"lcd2 regulator enable failed: %d\n", ret);
return;
}
}
if (host->dispdrv && host->dispdrv->drv->enable) {
ret = host->dispdrv->drv->enable(host->dispdrv, fb_info);
if (ret < 0)
@ -729,6 +739,13 @@ static void mxsfb_enable_controller(struct fb_info *fb_info)
"lcd regulator disable failed: %d\n",
ret);
}
if (host->reg_lcd2) {
ret = regulator_disable(host->reg_lcd2);
if (ret)
dev_err(&host->pdev->dev,
"lcd2 regulator disable failed: %d\n",
ret);
}
return;
}
clk_enable_pix(host);
@ -799,6 +816,12 @@ static void mxsfb_disable_controller(struct fb_info *fb_info)
dev_err(&host->pdev->dev,
"lcd regulator disable failed: %d\n", ret);
}
if (host->reg_lcd2) {
ret = regulator_disable(host->reg_lcd2);
if (ret)
dev_err(&host->pdev->dev,
"lcd2 regulator disable failed: %d\n", ret);
}
}
/**
@ -2256,6 +2279,20 @@ static int mxsfb_probe(struct platform_device *pdev)
}
}
host->reg_lcd2 = devm_regulator_get(&pdev->dev, "lcd2");
if (IS_ERR(host->reg_lcd2)) {
ret = PTR_ERR(host->reg_lcd2);
if (ret == -EPROBE_DEFER) {
dev_warn(&pdev->dev, "lcd2-supply not ready, deferring\n");
goto fb_release;
} else {
dev_err(&pdev->dev,
"Failed to get lcd2-supply (errno %d), ignoring\n",
ret);
host->reg_lcd2 = NULL;
}
}
ret = devm_request_irq(&pdev->dev, irq, mxsfb_irq_handler, 0,
dev_name(&pdev->dev), host);
if (ret) {