diff options
author | Afzal Mohammed <afzal@ti.com> | 2013-08-05 18:02:35 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-08-09 07:02:43 -0400 |
commit | 2bdff0680f00ef4d2448b8d20d61a3554b368c24 (patch) | |
tree | 0594c6c9444646816181edfdca9a77b7ebf30393 /drivers/video/da8xx-fb.c | |
parent | 3a58101da20b409984e608811bc2dd828f1e8c96 (diff) |
video: da8xx-fb: reorganize panel detection
Move panel detection to a separate function, this helps in readability
as well as makes DT support cleaner.
Signed-off-by: Afzal Mohammed <afzal@ti.com>
Signed-off-by: Darren Etheridge <detheridge@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/da8xx-fb.c')
-rw-r--r-- | drivers/video/da8xx-fb.c | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index dec27777a931..d8b295ab85f5 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c | |||
@@ -1253,6 +1253,27 @@ static struct fb_ops da8xx_fb_ops = { | |||
1253 | .fb_blank = cfb_blank, | 1253 | .fb_blank = cfb_blank, |
1254 | }; | 1254 | }; |
1255 | 1255 | ||
1256 | static struct fb_videomode *da8xx_fb_get_videomode(struct platform_device *dev) | ||
1257 | { | ||
1258 | struct da8xx_lcdc_platform_data *fb_pdata = dev->dev.platform_data; | ||
1259 | struct fb_videomode *lcdc_info; | ||
1260 | int i; | ||
1261 | |||
1262 | for (i = 0, lcdc_info = known_lcd_panels; | ||
1263 | i < ARRAY_SIZE(known_lcd_panels); i++, lcdc_info++) { | ||
1264 | if (strcmp(fb_pdata->type, lcdc_info->name) == 0) | ||
1265 | break; | ||
1266 | } | ||
1267 | |||
1268 | if (i == ARRAY_SIZE(known_lcd_panels)) { | ||
1269 | dev_err(&dev->dev, "no panel found\n"); | ||
1270 | return NULL; | ||
1271 | } | ||
1272 | dev_info(&dev->dev, "found %s panel\n", lcdc_info->name); | ||
1273 | |||
1274 | return lcdc_info; | ||
1275 | } | ||
1276 | |||
1256 | static int fb_probe(struct platform_device *device) | 1277 | static int fb_probe(struct platform_device *device) |
1257 | { | 1278 | { |
1258 | struct da8xx_lcdc_platform_data *fb_pdata = | 1279 | struct da8xx_lcdc_platform_data *fb_pdata = |
@@ -1263,7 +1284,7 @@ static int fb_probe(struct platform_device *device) | |||
1263 | struct fb_info *da8xx_fb_info; | 1284 | struct fb_info *da8xx_fb_info; |
1264 | struct clk *fb_clk = NULL; | 1285 | struct clk *fb_clk = NULL; |
1265 | struct da8xx_fb_par *par; | 1286 | struct da8xx_fb_par *par; |
1266 | int ret, i; | 1287 | int ret; |
1267 | unsigned long ulcm; | 1288 | unsigned long ulcm; |
1268 | 1289 | ||
1269 | if (fb_pdata == NULL) { | 1290 | if (fb_pdata == NULL) { |
@@ -1271,6 +1292,10 @@ static int fb_probe(struct platform_device *device) | |||
1271 | return -ENOENT; | 1292 | return -ENOENT; |
1272 | } | 1293 | } |
1273 | 1294 | ||
1295 | lcdc_info = da8xx_fb_get_videomode(device); | ||
1296 | if (lcdc_info == NULL) | ||
1297 | return -ENODEV; | ||
1298 | |||
1274 | lcdc_regs = platform_get_resource(device, IORESOURCE_MEM, 0); | 1299 | lcdc_regs = platform_get_resource(device, IORESOURCE_MEM, 0); |
1275 | da8xx_fb_reg_base = devm_ioremap_resource(&device->dev, lcdc_regs); | 1300 | da8xx_fb_reg_base = devm_ioremap_resource(&device->dev, lcdc_regs); |
1276 | if (IS_ERR(da8xx_fb_reg_base)) | 1301 | if (IS_ERR(da8xx_fb_reg_base)) |
@@ -1302,21 +1327,6 @@ static int fb_probe(struct platform_device *device) | |||
1302 | break; | 1327 | break; |
1303 | } | 1328 | } |
1304 | 1329 | ||
1305 | for (i = 0, lcdc_info = known_lcd_panels; | ||
1306 | i < ARRAY_SIZE(known_lcd_panels); | ||
1307 | i++, lcdc_info++) { | ||
1308 | if (strcmp(fb_pdata->type, lcdc_info->name) == 0) | ||
1309 | break; | ||
1310 | } | ||
1311 | |||
1312 | if (i == ARRAY_SIZE(known_lcd_panels)) { | ||
1313 | dev_err(&device->dev, "GLCD: No valid panel found\n"); | ||
1314 | ret = -ENODEV; | ||
1315 | goto err_pm_runtime_disable; | ||
1316 | } else | ||
1317 | dev_info(&device->dev, "GLCD: Found %s panel\n", | ||
1318 | fb_pdata->type); | ||
1319 | |||
1320 | lcd_cfg = (struct lcd_ctrl_config *)fb_pdata->controller_data; | 1330 | lcd_cfg = (struct lcd_ctrl_config *)fb_pdata->controller_data; |
1321 | 1331 | ||
1322 | if (!lcd_cfg) { | 1332 | if (!lcd_cfg) { |