aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Goode <emilgoode@gmail.com>2012-06-08 12:55:20 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2012-07-24 16:47:06 -0400
commit659f675e4b79c3b0821f7aab377177007b4ba3fd (patch)
tree6116f72c65e5c39613f10c33ed8519f08f2c09ab
parent6fcdbc0c3a683003a00f383fceac80da1b7852ff (diff)
aty128fb: Fix coding style issues
This patch cleans up some coding style issues. -Some lines are indented with 4 spaces, most of this code is not used but it should be correctly indented anyway. -I also fixed some long lines exceeding the 80 char limit. Signed-off-by: Emil Goode <emilgoode@gmail.com> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
-rw-r--r--drivers/video/aty/aty128fb.c180
1 files changed, 101 insertions, 79 deletions
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index b0b2ac335347..747442d2c0f6 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -90,7 +90,8 @@
90#undef DEBUG 90#undef DEBUG
91 91
92#ifdef DEBUG 92#ifdef DEBUG
93#define DBG(fmt, args...) printk(KERN_DEBUG "aty128fb: %s " fmt, __func__, ##args); 93#define DBG(fmt, args...) \
94 printk(KERN_DEBUG "aty128fb: %s " fmt, __func__, ##args);
94#else 95#else
95#define DBG(fmt, args...) 96#define DBG(fmt, args...)
96#endif 97#endif
@@ -449,8 +450,9 @@ static int aty128_decode_var(struct fb_var_screeninfo *var,
449 struct aty128fb_par *par); 450 struct aty128fb_par *par);
450#if 0 451#if 0
451static void __devinit aty128_get_pllinfo(struct aty128fb_par *par, 452static void __devinit aty128_get_pllinfo(struct aty128fb_par *par,
452 void __iomem *bios); 453 void __iomem *bios);
453static void __devinit __iomem *aty128_map_ROM(struct pci_dev *pdev, const struct aty128fb_par *par); 454static void __devinit __iomem *aty128_map_ROM(struct pci_dev *pdev,
455 const struct aty128fb_par *par);
454#endif 456#endif
455static void aty128_timings(struct aty128fb_par *par); 457static void aty128_timings(struct aty128fb_par *par);
456static void aty128_init_engine(struct aty128fb_par *par); 458static void aty128_init_engine(struct aty128fb_par *par);
@@ -779,7 +781,8 @@ static u32 depth_to_dst(u32 depth)
779 781
780 782
781#ifndef __sparc__ 783#ifndef __sparc__
782static void __iomem * __devinit aty128_map_ROM(const struct aty128fb_par *par, struct pci_dev *dev) 784static void __iomem * __devinit aty128_map_ROM(const struct aty128fb_par *par,
785 struct pci_dev *dev)
783{ 786{
784 u16 dptr; 787 u16 dptr;
785 u8 rom_type; 788 u8 rom_type;
@@ -811,13 +814,14 @@ static void __iomem * __devinit aty128_map_ROM(const struct aty128fb_par *par, s
811 /* Look for the PCI data to check the ROM type */ 814 /* Look for the PCI data to check the ROM type */
812 dptr = BIOS_IN16(0x18); 815 dptr = BIOS_IN16(0x18);
813 816
814 /* Check the PCI data signature. If it's wrong, we still assume a normal x86 ROM 817 /* Check the PCI data signature. If it's wrong, we still assume a normal
815 * for now, until I've verified this works everywhere. The goal here is more 818 * x86 ROM for now, until I've verified this works everywhere.
816 * to phase out Open Firmware images. 819 * The goal here is more to phase out Open Firmware images.
817 * 820 *
818 * Currently, we only look at the first PCI data, we could iteratre and deal with 821 * Currently, we only look at the first PCI data, we could iteratre and
819 * them all, and we should use fb_bios_start relative to start of image and not 822 * deal with them all, and we should use fb_bios_start relative to start
820 * relative start of ROM, but so far, I never found a dual-image ATI card 823 * of image and not relative start of ROM, but so far, I never found a
824 * dual-image ATI card.
821 * 825 *
822 * typedef struct { 826 * typedef struct {
823 * u32 signature; + 0x00 827 * u32 signature; + 0x00
@@ -852,7 +856,8 @@ static void __iomem * __devinit aty128_map_ROM(const struct aty128fb_par *par, s
852 printk(KERN_INFO "aty128fb: Found HP PA-RISC ROM Image\n"); 856 printk(KERN_INFO "aty128fb: Found HP PA-RISC ROM Image\n");
853 goto failed; 857 goto failed;
854 default: 858 default:
855 printk(KERN_INFO "aty128fb: Found unknown type %d ROM Image\n", rom_type); 859 printk(KERN_INFO "aty128fb: Found unknown type %d ROM Image\n",
860 rom_type);
856 goto failed; 861 goto failed;
857 } 862 }
858 anyway: 863 anyway:
@@ -863,7 +868,8 @@ static void __iomem * __devinit aty128_map_ROM(const struct aty128fb_par *par, s
863 return NULL; 868 return NULL;
864} 869}
865 870
866static void __devinit aty128_get_pllinfo(struct aty128fb_par *par, unsigned char __iomem *bios) 871static void __devinit aty128_get_pllinfo(struct aty128fb_par *par,
872 unsigned char __iomem *bios)
867{ 873{
868 unsigned int bios_hdr; 874 unsigned int bios_hdr;
869 unsigned int bios_pll; 875 unsigned int bios_pll;
@@ -1247,10 +1253,13 @@ static int aty128_crtc_to_var(const struct aty128_crtc *crtc,
1247static void aty128_set_crt_enable(struct aty128fb_par *par, int on) 1253static void aty128_set_crt_enable(struct aty128fb_par *par, int on)
1248{ 1254{
1249 if (on) { 1255 if (on) {
1250 aty_st_le32(CRTC_EXT_CNTL, aty_ld_le32(CRTC_EXT_CNTL) | CRT_CRTC_ON); 1256 aty_st_le32(CRTC_EXT_CNTL, aty_ld_le32(CRTC_EXT_CNTL) |
1251 aty_st_le32(DAC_CNTL, (aty_ld_le32(DAC_CNTL) | DAC_PALETTE2_SNOOP_EN)); 1257 CRT_CRTC_ON);
1258 aty_st_le32(DAC_CNTL, (aty_ld_le32(DAC_CNTL) |
1259 DAC_PALETTE2_SNOOP_EN));
1252 } else 1260 } else
1253 aty_st_le32(CRTC_EXT_CNTL, aty_ld_le32(CRTC_EXT_CNTL) & ~CRT_CRTC_ON); 1261 aty_st_le32(CRTC_EXT_CNTL, aty_ld_le32(CRTC_EXT_CNTL) &
1262 ~CRT_CRTC_ON);
1254} 1263}
1255 1264
1256static void aty128_set_lcd_enable(struct aty128fb_par *par, int on) 1265static void aty128_set_lcd_enable(struct aty128fb_par *par, int on)
@@ -1281,7 +1290,8 @@ static void aty128_set_lcd_enable(struct aty128fb_par *par, int on)
1281 } 1290 }
1282} 1291}
1283 1292
1284static void aty128_set_pll(struct aty128_pll *pll, const struct aty128fb_par *par) 1293static void aty128_set_pll(struct aty128_pll *pll,
1294 const struct aty128fb_par *par)
1285{ 1295{
1286 u32 div3; 1296 u32 div3;
1287 1297
@@ -1366,7 +1376,8 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll,
1366} 1376}
1367 1377
1368 1378
1369static int aty128_pll_to_var(const struct aty128_pll *pll, struct fb_var_screeninfo *var) 1379static int aty128_pll_to_var(const struct aty128_pll *pll,
1380 struct fb_var_screeninfo *var)
1370{ 1381{
1371 var->pixclock = 100000000 / pll->vclk; 1382 var->pixclock = 100000000 / pll->vclk;
1372 1383
@@ -1512,7 +1523,8 @@ static int aty128fb_set_par(struct fb_info *info)
1512 * encode/decode the User Defined Part of the Display 1523 * encode/decode the User Defined Part of the Display
1513 */ 1524 */
1514 1525
1515static int aty128_decode_var(struct fb_var_screeninfo *var, struct aty128fb_par *par) 1526static int aty128_decode_var(struct fb_var_screeninfo *var,
1527 struct aty128fb_par *par)
1516{ 1528{
1517 int err; 1529 int err;
1518 struct aty128_crtc crtc; 1530 struct aty128_crtc crtc;
@@ -1559,7 +1571,8 @@ static int aty128_encode_var(struct fb_var_screeninfo *var,
1559} 1571}
1560 1572
1561 1573
1562static int aty128fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 1574static int aty128fb_check_var(struct fb_var_screeninfo *var,
1575 struct fb_info *info)
1563{ 1576{
1564 struct aty128fb_par par; 1577 struct aty128fb_par par;
1565 int err; 1578 int err;
@@ -1575,7 +1588,8 @@ static int aty128fb_check_var(struct fb_var_screeninfo *var, struct fb_info *inf
1575/* 1588/*
1576 * Pan or Wrap the Display 1589 * Pan or Wrap the Display
1577 */ 1590 */
1578static int aty128fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fb) 1591static int aty128fb_pan_display(struct fb_var_screeninfo *var,
1592 struct fb_info *fb)
1579{ 1593{
1580 struct aty128fb_par *par = fb->par; 1594 struct aty128fb_par *par = fb->par;
1581 u32 xoffset, yoffset; 1595 u32 xoffset, yoffset;
@@ -1594,7 +1608,8 @@ static int aty128fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *f
1594 par->crtc.xoffset = xoffset; 1608 par->crtc.xoffset = xoffset;
1595 par->crtc.yoffset = yoffset; 1609 par->crtc.yoffset = yoffset;
1596 1610
1597 offset = ((yoffset * par->crtc.vxres + xoffset)*(par->crtc.bpp >> 3)) & ~7; 1611 offset = ((yoffset * par->crtc.vxres + xoffset) * (par->crtc.bpp >> 3))
1612 & ~7;
1598 1613
1599 if (par->crtc.bpp == 24) 1614 if (par->crtc.bpp == 24)
1600 offset += 8 * (offset % 3); /* Must be multiple of 8 and 3 */ 1615 offset += 8 * (offset % 3); /* Must be multiple of 8 and 3 */
@@ -1620,11 +1635,13 @@ static void aty128_st_pal(u_int regno, u_int red, u_int green, u_int blue,
1620 * do mirroring 1635 * do mirroring
1621 */ 1636 */
1622 1637
1623 aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) | DAC_PALETTE_ACCESS_CNTL); 1638 aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) |
1639 DAC_PALETTE_ACCESS_CNTL);
1624 aty_st_8(PALETTE_INDEX, regno); 1640 aty_st_8(PALETTE_INDEX, regno);
1625 aty_st_le32(PALETTE_DATA, (red<<16)|(green<<8)|blue); 1641 aty_st_le32(PALETTE_DATA, (red<<16)|(green<<8)|blue);
1626#endif 1642#endif
1627 aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) & ~DAC_PALETTE_ACCESS_CNTL); 1643 aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) &
1644 ~DAC_PALETTE_ACCESS_CNTL);
1628 } 1645 }
1629 1646
1630 aty_st_8(PALETTE_INDEX, regno); 1647 aty_st_8(PALETTE_INDEX, regno);
@@ -1753,7 +1770,8 @@ static int aty128_bl_update_status(struct backlight_device *bd)
1753 aty_st_le32(LVDS_GEN_CNTL, reg); 1770 aty_st_le32(LVDS_GEN_CNTL, reg);
1754 } 1771 }
1755 reg &= ~LVDS_BL_MOD_LEVEL_MASK; 1772 reg &= ~LVDS_BL_MOD_LEVEL_MASK;
1756 reg |= (aty128_bl_get_level_brightness(par, level) << LVDS_BL_MOD_LEVEL_SHIFT); 1773 reg |= (aty128_bl_get_level_brightness(par, level) <<
1774 LVDS_BL_MOD_LEVEL_SHIFT);
1757#ifdef BACKLIGHT_LVDS_OFF 1775#ifdef BACKLIGHT_LVDS_OFF
1758 reg |= LVDS_ON | LVDS_EN; 1776 reg |= LVDS_ON | LVDS_EN;
1759 reg &= ~LVDS_DISPLAY_DIS; 1777 reg &= ~LVDS_DISPLAY_DIS;
@@ -1764,7 +1782,8 @@ static int aty128_bl_update_status(struct backlight_device *bd)
1764#endif 1782#endif
1765 } else { 1783 } else {
1766 reg &= ~LVDS_BL_MOD_LEVEL_MASK; 1784 reg &= ~LVDS_BL_MOD_LEVEL_MASK;
1767 reg |= (aty128_bl_get_level_brightness(par, 0) << LVDS_BL_MOD_LEVEL_SHIFT); 1785 reg |= (aty128_bl_get_level_brightness(par, 0) <<
1786 LVDS_BL_MOD_LEVEL_SHIFT);
1768#ifdef BACKLIGHT_LVDS_OFF 1787#ifdef BACKLIGHT_LVDS_OFF
1769 reg |= LVDS_DISPLAY_DIS; 1788 reg |= LVDS_DISPLAY_DIS;
1770 aty_st_le32(LVDS_GEN_CNTL, reg); 1789 aty_st_le32(LVDS_GEN_CNTL, reg);
@@ -1869,7 +1888,8 @@ static void aty128_early_resume(void *data)
1869} 1888}
1870#endif /* CONFIG_PPC_PMAC */ 1889#endif /* CONFIG_PPC_PMAC */
1871 1890
1872static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_id *ent) 1891static int __devinit aty128_init(struct pci_dev *pdev,
1892 const struct pci_device_id *ent)
1873{ 1893{
1874 struct fb_info *info = pci_get_drvdata(pdev); 1894 struct fb_info *info = pci_get_drvdata(pdev);
1875 struct aty128fb_par *par = info->par; 1895 struct aty128fb_par *par = info->par;
@@ -1887,7 +1907,8 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i
1887 1907
1888 /* range check to make sure */ 1908 /* range check to make sure */
1889 if (ent->driver_data < ARRAY_SIZE(r128_family)) 1909 if (ent->driver_data < ARRAY_SIZE(r128_family))
1890 strlcat(video_card, r128_family[ent->driver_data], sizeof(video_card)); 1910 strlcat(video_card, r128_family[ent->driver_data],
1911 sizeof(video_card));
1891 1912
1892 printk(KERN_INFO "aty128fb: %s [chip rev 0x%x] ", video_card, chip_rev); 1913 printk(KERN_INFO "aty128fb: %s [chip rev 0x%x] ", video_card, chip_rev);
1893 1914
@@ -1911,11 +1932,11 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i
1911 /* Indicate sleep capability */ 1932 /* Indicate sleep capability */
1912 if (par->chip_gen == rage_M3) { 1933 if (par->chip_gen == rage_M3) {
1913 pmac_call_feature(PMAC_FTR_DEVICE_CAN_WAKE, NULL, 0, 1); 1934 pmac_call_feature(PMAC_FTR_DEVICE_CAN_WAKE, NULL, 0, 1);
1914#if 0 /* Disable the early video resume hack for now as it's causing problems, among 1935#if 0 /* Disable the early video resume hack for now as it's causing problems,
1915 * others we now rely on the PCI core restoring the config space for us, which 1936 * among others we now rely on the PCI core restoring the config space
1916 * isn't the case with that hack, and that code path causes various things to 1937 * for us, which isn't the case with that hack, and that code path causes
1917 * be called with interrupts off while they shouldn't. I'm leaving the code in 1938 * various things to be called with interrupts off while they shouldn't.
1918 * as it can be useful for debugging purposes 1939 * I'm leaving the code in as it can be useful for debugging purposes
1919 */ 1940 */
1920 pmac_set_early_video_resume(aty128_early_resume, par); 1941 pmac_set_early_video_resume(aty128_early_resume, par);
1921#endif 1942#endif
@@ -1953,11 +1974,11 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i
1953 default_vmode = VMODE_1152_768_60; 1974 default_vmode = VMODE_1152_768_60;
1954 1975
1955 if (default_cmode > 16) 1976 if (default_cmode > 16)
1956 default_cmode = CMODE_32; 1977 default_cmode = CMODE_32;
1957 else if (default_cmode > 8) 1978 else if (default_cmode > 8)
1958 default_cmode = CMODE_16; 1979 default_cmode = CMODE_16;
1959 else 1980 else
1960 default_cmode = CMODE_8; 1981 default_cmode = CMODE_8;
1961 1982
1962 if (mac_vmode_to_var(default_vmode, default_cmode, &var)) 1983 if (mac_vmode_to_var(default_vmode, default_cmode, &var))
1963 var = default_var; 1984 var = default_var;
@@ -2018,7 +2039,8 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i
2018 2039
2019#ifdef CONFIG_PCI 2040#ifdef CONFIG_PCI
2020/* register a card ++ajoshi */ 2041/* register a card ++ajoshi */
2021static int __devinit aty128_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 2042static int __devinit aty128_probe(struct pci_dev *pdev,
2043 const struct pci_device_id *ent)
2022{ 2044{
2023 unsigned long fb_addr, reg_addr; 2045 unsigned long fb_addr, reg_addr;
2024 struct aty128fb_par *par; 2046 struct aty128fb_par *par;
@@ -2318,39 +2340,39 @@ static inline void aty128_rectcopy(int srcx, int srcy, int dstx, int dsty,
2318 u_int width, u_int height, 2340 u_int width, u_int height,
2319 struct fb_info_aty128 *par) 2341 struct fb_info_aty128 *par)
2320{ 2342{
2321 u32 save_dp_datatype, save_dp_cntl, dstval; 2343 u32 save_dp_datatype, save_dp_cntl, dstval;
2322 2344
2323 if (!width || !height) 2345 if (!width || !height)
2324 return; 2346 return;
2325 2347
2326 dstval = depth_to_dst(par->current_par.crtc.depth); 2348 dstval = depth_to_dst(par->current_par.crtc.depth);
2327 if (dstval == DST_24BPP) { 2349 if (dstval == DST_24BPP) {
2328 srcx *= 3; 2350 srcx *= 3;
2329 dstx *= 3; 2351 dstx *= 3;
2330 width *= 3; 2352 width *= 3;
2331 } else if (dstval == -EINVAL) { 2353 } else if (dstval == -EINVAL) {
2332 printk("aty128fb: invalid depth or RGBA\n"); 2354 printk("aty128fb: invalid depth or RGBA\n");
2333 return; 2355 return;
2334 } 2356 }
2335 2357
2336 wait_for_fifo(2, par); 2358 wait_for_fifo(2, par);
2337 save_dp_datatype = aty_ld_le32(DP_DATATYPE); 2359 save_dp_datatype = aty_ld_le32(DP_DATATYPE);
2338 save_dp_cntl = aty_ld_le32(DP_CNTL); 2360 save_dp_cntl = aty_ld_le32(DP_CNTL);
2339 2361
2340 wait_for_fifo(6, par); 2362 wait_for_fifo(6, par);
2341 aty_st_le32(SRC_Y_X, (srcy << 16) | srcx); 2363 aty_st_le32(SRC_Y_X, (srcy << 16) | srcx);
2342 aty_st_le32(DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT); 2364 aty_st_le32(DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT);
2343 aty_st_le32(DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM); 2365 aty_st_le32(DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM);
2344 aty_st_le32(DP_DATATYPE, save_dp_datatype | dstval | SRC_DSTCOLOR); 2366 aty_st_le32(DP_DATATYPE, save_dp_datatype | dstval | SRC_DSTCOLOR);
2345 2367
2346 aty_st_le32(DST_Y_X, (dsty << 16) | dstx); 2368 aty_st_le32(DST_Y_X, (dsty << 16) | dstx);
2347 aty_st_le32(DST_HEIGHT_WIDTH, (height << 16) | width); 2369 aty_st_le32(DST_HEIGHT_WIDTH, (height << 16) | width);
2348 2370
2349 par->blitter_may_be_busy = 1; 2371 par->blitter_may_be_busy = 1;
2350 2372
2351 wait_for_fifo(2, par); 2373 wait_for_fifo(2, par);
2352 aty_st_le32(DP_DATATYPE, save_dp_datatype); 2374 aty_st_le32(DP_DATATYPE, save_dp_datatype);
2353 aty_st_le32(DP_CNTL, save_dp_cntl); 2375 aty_st_le32(DP_CNTL, save_dp_cntl);
2354} 2376}
2355 2377
2356 2378
@@ -2358,17 +2380,17 @@ static inline void aty128_rectcopy(int srcx, int srcy, int dstx, int dsty,
2358 * Text mode accelerated functions 2380 * Text mode accelerated functions
2359 */ 2381 */
2360 2382
2361static void fbcon_aty128_bmove(struct display *p, int sy, int sx, int dy, int dx, 2383static void fbcon_aty128_bmove(struct display *p, int sy, int sx, int dy,
2362 int height, int width) 2384 int dx, int height, int width)
2363{ 2385{
2364 sx *= fontwidth(p); 2386 sx *= fontwidth(p);
2365 sy *= fontheight(p); 2387 sy *= fontheight(p);
2366 dx *= fontwidth(p); 2388 dx *= fontwidth(p);
2367 dy *= fontheight(p); 2389 dy *= fontheight(p);
2368 width *= fontwidth(p); 2390 width *= fontwidth(p);
2369 height *= fontheight(p); 2391 height *= fontheight(p);
2370 2392
2371 aty128_rectcopy(sx, sy, dx, dy, width, height, 2393 aty128_rectcopy(sx, sy, dx, dy, width, height,
2372 (struct fb_info_aty128 *)p->fb_info); 2394 (struct fb_info_aty128 *)p->fb_info);
2373} 2395}
2374#endif /* 0 */ 2396#endif /* 0 */