| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Framebuffer driver for TI OMAP boards |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 9 | 10 | * Juha Yrjola <juha.yrjola@nokia.com> - Original driver and improvements |
|---|
| 10 | 11 | * Dirk Behme <dirk.behme@de.bosch.com> - changes for 2.6 kernel API |
|---|
| 11 | 12 | * Texas Instruments - H3 support |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 14 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 15 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 16 | | - * option) any later version. |
|---|
| 17 | | - * |
|---|
| 18 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 19 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 20 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 21 | | - * General Public License for more details. |
|---|
| 22 | | - * |
|---|
| 23 | | - * You should have received a copy of the GNU General Public License along |
|---|
| 24 | | - * with this program; if not, write to the Free Software Foundation, Inc., |
|---|
| 25 | | - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 26 | 13 | */ |
|---|
| 27 | 14 | #include <linux/platform_device.h> |
|---|
| 28 | 15 | #include <linux/mm.h> |
|---|
| .. | .. |
|---|
| 47 | 34 | static unsigned int def_rotate; |
|---|
| 48 | 35 | static unsigned int def_mirror; |
|---|
| 49 | 36 | |
|---|
| 50 | | -#ifdef CONFIG_FB_OMAP_MANUAL_UPDATE |
|---|
| 51 | | -static bool manual_update = 1; |
|---|
| 52 | | -#else |
|---|
| 53 | | -static bool manual_update; |
|---|
| 54 | | -#endif |
|---|
| 37 | +static bool manual_update = IS_BUILTIN(CONFIG_FB_OMAP_MANUAL_UPDATE); |
|---|
| 55 | 38 | |
|---|
| 56 | 39 | static struct platform_device *fbdev_pdev; |
|---|
| 57 | 40 | static struct lcd_panel *fbdev_panel; |
|---|
| .. | .. |
|---|
| 270 | 253 | if (fbdev->ctrl->setcolreg) |
|---|
| 271 | 254 | r = fbdev->ctrl->setcolreg(regno, red, green, blue, |
|---|
| 272 | 255 | transp, update_hw_pal); |
|---|
| 273 | | - /* Fallthrough */ |
|---|
| 256 | + fallthrough; |
|---|
| 274 | 257 | case OMAPFB_COLOR_RGB565: |
|---|
| 275 | 258 | case OMAPFB_COLOR_RGB444: |
|---|
| 276 | 259 | if (r != 0) |
|---|
| .. | .. |
|---|
| 460 | 443 | return 0; |
|---|
| 461 | 444 | case 12: |
|---|
| 462 | 445 | var->bits_per_pixel = 16; |
|---|
| 446 | + fallthrough; |
|---|
| 463 | 447 | case 16: |
|---|
| 464 | 448 | if (plane->fbdev->panel->bpp == 12) |
|---|
| 465 | 449 | plane->color_mode = OMAPFB_COLOR_RGB444; |
|---|
| .. | .. |
|---|
| 1064 | 1048 | { |
|---|
| 1065 | 1049 | struct omapfb_plane_struct *plane = fbi->par; |
|---|
| 1066 | 1050 | struct omapfb_device *fbdev = plane->fbdev; |
|---|
| 1067 | | - struct fb_ops *ops = fbi->fbops; |
|---|
| 1051 | + const struct fb_ops *ops = fbi->fbops; |
|---|
| 1068 | 1052 | union { |
|---|
| 1069 | 1053 | struct omapfb_update_window update_window; |
|---|
| 1070 | 1054 | struct omapfb_plane_info plane_info; |
|---|
| .. | .. |
|---|
| 1259 | 1243 | size = 0; |
|---|
| 1260 | 1244 | while (size < PAGE_SIZE && plane < OMAPFB_PLANE_NUM) { |
|---|
| 1261 | 1245 | omapfb_get_caps(fbdev, plane, &caps); |
|---|
| 1262 | | - size += snprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1246 | + size += scnprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1263 | 1247 | "plane#%d %#010x %#010x %#010x\n", |
|---|
| 1264 | 1248 | plane, caps.ctrl, caps.plane_color, caps.wnd_color); |
|---|
| 1265 | 1249 | plane++; |
|---|
| .. | .. |
|---|
| 1280 | 1264 | size = 0; |
|---|
| 1281 | 1265 | while (size < PAGE_SIZE && plane < OMAPFB_PLANE_NUM) { |
|---|
| 1282 | 1266 | omapfb_get_caps(fbdev, plane, &caps); |
|---|
| 1283 | | - size += snprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1267 | + size += scnprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1284 | 1268 | "plane#%d:\n", plane); |
|---|
| 1285 | 1269 | for (i = 0; i < ARRAY_SIZE(ctrl_caps) && |
|---|
| 1286 | 1270 | size < PAGE_SIZE; i++) { |
|---|
| 1287 | 1271 | if (ctrl_caps[i].flag & caps.ctrl) |
|---|
| 1288 | | - size += snprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1272 | + size += scnprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1289 | 1273 | " %s\n", ctrl_caps[i].name); |
|---|
| 1290 | 1274 | } |
|---|
| 1291 | | - size += snprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1275 | + size += scnprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1292 | 1276 | " plane colors:\n"); |
|---|
| 1293 | 1277 | for (i = 0; i < ARRAY_SIZE(color_caps) && |
|---|
| 1294 | 1278 | size < PAGE_SIZE; i++) { |
|---|
| 1295 | 1279 | if (color_caps[i].flag & caps.plane_color) |
|---|
| 1296 | | - size += snprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1280 | + size += scnprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1297 | 1281 | " %s\n", color_caps[i].name); |
|---|
| 1298 | 1282 | } |
|---|
| 1299 | | - size += snprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1283 | + size += scnprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1300 | 1284 | " window colors:\n"); |
|---|
| 1301 | 1285 | for (i = 0; i < ARRAY_SIZE(color_caps) && |
|---|
| 1302 | 1286 | size < PAGE_SIZE; i++) { |
|---|
| 1303 | 1287 | if (color_caps[i].flag & caps.wnd_color) |
|---|
| 1304 | | - size += snprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1288 | + size += scnprintf(&buf[size], PAGE_SIZE - size, |
|---|
| 1305 | 1289 | " %s\n", color_caps[i].name); |
|---|
| 1306 | 1290 | } |
|---|
| 1307 | 1291 | |
|---|
| .. | .. |
|---|
| 1515 | 1499 | fbi = framebuffer_alloc(sizeof(struct omapfb_plane_struct), |
|---|
| 1516 | 1500 | fbdev->dev); |
|---|
| 1517 | 1501 | if (fbi == NULL) { |
|---|
| 1518 | | - dev_err(fbdev->dev, |
|---|
| 1519 | | - "unable to allocate memory for plane info\n"); |
|---|
| 1520 | 1502 | planes_cleanup(fbdev); |
|---|
| 1521 | 1503 | return -ENOMEM; |
|---|
| 1522 | 1504 | } |
|---|
| .. | .. |
|---|
| 1549 | 1531 | case OMAPFB_ACTIVE: |
|---|
| 1550 | 1532 | for (i = 0; i < fbdev->mem_desc.region_cnt; i++) |
|---|
| 1551 | 1533 | unregister_framebuffer(fbdev->fb_info[i]); |
|---|
| 1534 | + fallthrough; |
|---|
| 1552 | 1535 | case 7: |
|---|
| 1553 | 1536 | omapfb_unregister_sysfs(fbdev); |
|---|
| 1537 | + fallthrough; |
|---|
| 1554 | 1538 | case 6: |
|---|
| 1555 | 1539 | if (fbdev->panel->disable) |
|---|
| 1556 | 1540 | fbdev->panel->disable(fbdev->panel); |
|---|
| 1541 | + fallthrough; |
|---|
| 1557 | 1542 | case 5: |
|---|
| 1558 | 1543 | omapfb_set_update_mode(fbdev, OMAPFB_UPDATE_DISABLED); |
|---|
| 1544 | + fallthrough; |
|---|
| 1559 | 1545 | case 4: |
|---|
| 1560 | 1546 | planes_cleanup(fbdev); |
|---|
| 1547 | + fallthrough; |
|---|
| 1561 | 1548 | case 3: |
|---|
| 1562 | 1549 | ctrl_cleanup(fbdev); |
|---|
| 1550 | + fallthrough; |
|---|
| 1563 | 1551 | case 2: |
|---|
| 1564 | 1552 | if (fbdev->panel->cleanup) |
|---|
| 1565 | 1553 | fbdev->panel->cleanup(fbdev->panel); |
|---|
| 1554 | + fallthrough; |
|---|
| 1566 | 1555 | case 1: |
|---|
| 1567 | 1556 | dev_set_drvdata(fbdev->dev, NULL); |
|---|
| 1568 | 1557 | kfree(fbdev); |
|---|
| .. | .. |
|---|
| 1865 | 1854 | case 'm': |
|---|
| 1866 | 1855 | case 'M': |
|---|
| 1867 | 1856 | vram *= 1024; |
|---|
| 1868 | | - /* Fall through */ |
|---|
| 1857 | + fallthrough; |
|---|
| 1869 | 1858 | case 'k': |
|---|
| 1870 | 1859 | case 'K': |
|---|
| 1871 | 1860 | vram *= 1024; |
|---|