diff options
Diffstat (limited to 'drivers/video/aty/aty128fb.c')
-rw-r--r-- | drivers/video/aty/aty128fb.c | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 72c589109471..c64a717e2d4b 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -52,7 +52,6 @@ | |||
52 | #include <linux/errno.h> | 52 | #include <linux/errno.h> |
53 | #include <linux/string.h> | 53 | #include <linux/string.h> |
54 | #include <linux/mm.h> | 54 | #include <linux/mm.h> |
55 | #include <linux/tty.h> | ||
56 | #include <linux/slab.h> | 55 | #include <linux/slab.h> |
57 | #include <linux/vmalloc.h> | 56 | #include <linux/vmalloc.h> |
58 | #include <linux/delay.h> | 57 | #include <linux/delay.h> |
@@ -456,6 +455,7 @@ static void do_wait_for_fifo(u16 entries, struct aty128fb_par *par); | |||
456 | static void wait_for_fifo(u16 entries, struct aty128fb_par *par); | 455 | static void wait_for_fifo(u16 entries, struct aty128fb_par *par); |
457 | static void wait_for_idle(struct aty128fb_par *par); | 456 | static void wait_for_idle(struct aty128fb_par *par); |
458 | static u32 depth_to_dst(u32 depth); | 457 | static u32 depth_to_dst(u32 depth); |
458 | static void aty128_bl_set_power(struct fb_info *info, int power); | ||
459 | 459 | ||
460 | #define BIOS_IN8(v) (readb(bios + (v))) | 460 | #define BIOS_IN8(v) (readb(bios + (v))) |
461 | #define BIOS_IN16(v) (readb(bios + (v)) | \ | 461 | #define BIOS_IN16(v) (readb(bios + (v)) | \ |
@@ -1258,25 +1258,11 @@ static void aty128_set_lcd_enable(struct aty128fb_par *par, int on) | |||
1258 | reg &= ~LVDS_DISPLAY_DIS; | 1258 | reg &= ~LVDS_DISPLAY_DIS; |
1259 | aty_st_le32(LVDS_GEN_CNTL, reg); | 1259 | aty_st_le32(LVDS_GEN_CNTL, reg); |
1260 | #ifdef CONFIG_FB_ATY128_BACKLIGHT | 1260 | #ifdef CONFIG_FB_ATY128_BACKLIGHT |
1261 | mutex_lock(&info->bl_mutex); | 1261 | aty128_bl_set_power(info, FB_BLANK_UNBLANK); |
1262 | if (info->bl_dev) { | ||
1263 | down(&info->bl_dev->sem); | ||
1264 | info->bl_dev->props->update_status(info->bl_dev); | ||
1265 | up(&info->bl_dev->sem); | ||
1266 | } | ||
1267 | mutex_unlock(&info->bl_mutex); | ||
1268 | #endif | 1262 | #endif |
1269 | } else { | 1263 | } else { |
1270 | #ifdef CONFIG_FB_ATY128_BACKLIGHT | 1264 | #ifdef CONFIG_FB_ATY128_BACKLIGHT |
1271 | mutex_lock(&info->bl_mutex); | 1265 | aty128_bl_set_power(info, FB_BLANK_POWERDOWN); |
1272 | if (info->bl_dev) { | ||
1273 | down(&info->bl_dev->sem); | ||
1274 | info->bl_dev->props->brightness = 0; | ||
1275 | info->bl_dev->props->power = FB_BLANK_POWERDOWN; | ||
1276 | info->bl_dev->props->update_status(info->bl_dev); | ||
1277 | up(&info->bl_dev->sem); | ||
1278 | } | ||
1279 | mutex_unlock(&info->bl_mutex); | ||
1280 | #endif | 1266 | #endif |
1281 | reg = aty_ld_le32(LVDS_GEN_CNTL); | 1267 | reg = aty_ld_le32(LVDS_GEN_CNTL); |
1282 | reg |= LVDS_DISPLAY_DIS; | 1268 | reg |= LVDS_DISPLAY_DIS; |
@@ -1703,6 +1689,7 @@ static int __devinit aty128fb_setup(char *options) | |||
1703 | 1689 | ||
1704 | static struct backlight_properties aty128_bl_data; | 1690 | static struct backlight_properties aty128_bl_data; |
1705 | 1691 | ||
1692 | /* Call with fb_info->bl_mutex held */ | ||
1706 | static int aty128_bl_get_level_brightness(struct aty128fb_par *par, | 1693 | static int aty128_bl_get_level_brightness(struct aty128fb_par *par, |
1707 | int level) | 1694 | int level) |
1708 | { | 1695 | { |
@@ -1710,10 +1697,8 @@ static int aty128_bl_get_level_brightness(struct aty128fb_par *par, | |||
1710 | int atylevel; | 1697 | int atylevel; |
1711 | 1698 | ||
1712 | /* Get and convert the value */ | 1699 | /* Get and convert the value */ |
1713 | mutex_lock(&info->bl_mutex); | ||
1714 | atylevel = MAX_LEVEL - | 1700 | atylevel = MAX_LEVEL - |
1715 | (info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL); | 1701 | (info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL); |
1716 | mutex_unlock(&info->bl_mutex); | ||
1717 | 1702 | ||
1718 | if (atylevel < 0) | 1703 | if (atylevel < 0) |
1719 | atylevel = 0; | 1704 | atylevel = 0; |
@@ -1731,7 +1716,8 @@ static int aty128_bl_get_level_brightness(struct aty128fb_par *par, | |||
1731 | /* That one prevents proper CRT output with LCD off */ | 1716 | /* That one prevents proper CRT output with LCD off */ |
1732 | #undef BACKLIGHT_DAC_OFF | 1717 | #undef BACKLIGHT_DAC_OFF |
1733 | 1718 | ||
1734 | static int aty128_bl_update_status(struct backlight_device *bd) | 1719 | /* Call with fb_info->bl_mutex held */ |
1720 | static int __aty128_bl_update_status(struct backlight_device *bd) | ||
1735 | { | 1721 | { |
1736 | struct aty128fb_par *par = class_get_devdata(&bd->class_dev); | 1722 | struct aty128fb_par *par = class_get_devdata(&bd->class_dev); |
1737 | unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); | 1723 | unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); |
@@ -1784,6 +1770,19 @@ static int aty128_bl_update_status(struct backlight_device *bd) | |||
1784 | return 0; | 1770 | return 0; |
1785 | } | 1771 | } |
1786 | 1772 | ||
1773 | static int aty128_bl_update_status(struct backlight_device *bd) | ||
1774 | { | ||
1775 | struct aty128fb_par *par = class_get_devdata(&bd->class_dev); | ||
1776 | struct fb_info *info = pci_get_drvdata(par->pdev); | ||
1777 | int ret; | ||
1778 | |||
1779 | mutex_lock(&info->bl_mutex); | ||
1780 | ret = __aty128_bl_update_status(bd); | ||
1781 | mutex_unlock(&info->bl_mutex); | ||
1782 | |||
1783 | return ret; | ||
1784 | } | ||
1785 | |||
1787 | static int aty128_bl_get_brightness(struct backlight_device *bd) | 1786 | static int aty128_bl_get_brightness(struct backlight_device *bd) |
1788 | { | 1787 | { |
1789 | return bd->props->brightness; | 1788 | return bd->props->brightness; |
@@ -1796,6 +1795,16 @@ static struct backlight_properties aty128_bl_data = { | |||
1796 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), | 1795 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), |
1797 | }; | 1796 | }; |
1798 | 1797 | ||
1798 | static void aty128_bl_set_power(struct fb_info *info, int power) | ||
1799 | { | ||
1800 | mutex_lock(&info->bl_mutex); | ||
1801 | up(&info->bl_dev->sem); | ||
1802 | info->bl_dev->props->power = power; | ||
1803 | __aty128_bl_update_status(info->bl_dev); | ||
1804 | down(&info->bl_dev->sem); | ||
1805 | mutex_unlock(&info->bl_mutex); | ||
1806 | } | ||
1807 | |||
1799 | static void aty128_bl_init(struct aty128fb_par *par) | 1808 | static void aty128_bl_init(struct aty128fb_par *par) |
1800 | { | 1809 | { |
1801 | struct fb_info *info = pci_get_drvdata(par->pdev); | 1810 | struct fb_info *info = pci_get_drvdata(par->pdev); |
@@ -2198,12 +2207,8 @@ static int aty128fb_blank(int blank, struct fb_info *fb) | |||
2198 | return 0; | 2207 | return 0; |
2199 | 2208 | ||
2200 | #ifdef CONFIG_FB_ATY128_BACKLIGHT | 2209 | #ifdef CONFIG_FB_ATY128_BACKLIGHT |
2201 | if (machine_is(powermac) && blank) { | 2210 | if (machine_is(powermac) && blank) |
2202 | down(&fb->bl_dev->sem); | 2211 | aty128_bl_set_power(fb, FB_BLANK_POWERDOWN); |
2203 | fb->bl_dev->props->power = FB_BLANK_POWERDOWN; | ||
2204 | fb->bl_dev->props->update_status(fb->bl_dev); | ||
2205 | up(&fb->bl_dev->sem); | ||
2206 | } | ||
2207 | #endif | 2212 | #endif |
2208 | 2213 | ||
2209 | if (blank & FB_BLANK_VSYNC_SUSPEND) | 2214 | if (blank & FB_BLANK_VSYNC_SUSPEND) |
@@ -2219,14 +2224,12 @@ static int aty128fb_blank(int blank, struct fb_info *fb) | |||
2219 | aty128_set_crt_enable(par, par->crt_on && !blank); | 2224 | aty128_set_crt_enable(par, par->crt_on && !blank); |
2220 | aty128_set_lcd_enable(par, par->lcd_on && !blank); | 2225 | aty128_set_lcd_enable(par, par->lcd_on && !blank); |
2221 | } | 2226 | } |
2227 | |||
2222 | #ifdef CONFIG_FB_ATY128_BACKLIGHT | 2228 | #ifdef CONFIG_FB_ATY128_BACKLIGHT |
2223 | if (machine_is(powermac) && !blank) { | 2229 | if (machine_is(powermac) && !blank) |
2224 | down(&fb->bl_dev->sem); | 2230 | aty128_bl_set_power(fb, FB_BLANK_UNBLANK); |
2225 | fb->bl_dev->props->power = FB_BLANK_UNBLANK; | ||
2226 | fb->bl_dev->props->update_status(fb->bl_dev); | ||
2227 | up(&fb->bl_dev->sem); | ||
2228 | } | ||
2229 | #endif | 2231 | #endif |
2232 | |||
2230 | return 0; | 2233 | return 0; |
2231 | } | 2234 | } |
2232 | 2235 | ||