diff options
Diffstat (limited to 'drivers/video/aty/aty128fb.c')
-rw-r--r-- | drivers/video/aty/aty128fb.c | 55 |
1 files changed, 12 insertions, 43 deletions
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 1c77cfb8e683..ef3e7861c27a 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -1697,7 +1697,6 @@ static int __devinit aty128fb_setup(char *options) | |||
1697 | 1697 | ||
1698 | static struct backlight_properties aty128_bl_data; | 1698 | static struct backlight_properties aty128_bl_data; |
1699 | 1699 | ||
1700 | /* Call with fb_info->bl_mutex held */ | ||
1701 | static int aty128_bl_get_level_brightness(struct aty128fb_par *par, | 1700 | static int aty128_bl_get_level_brightness(struct aty128fb_par *par, |
1702 | int level) | 1701 | int level) |
1703 | { | 1702 | { |
@@ -1705,6 +1704,7 @@ static int aty128_bl_get_level_brightness(struct aty128fb_par *par, | |||
1705 | int atylevel; | 1704 | int atylevel; |
1706 | 1705 | ||
1707 | /* Get and convert the value */ | 1706 | /* Get and convert the value */ |
1707 | /* No locking of bl_curve since we read a single value */ | ||
1708 | atylevel = MAX_LEVEL - | 1708 | atylevel = MAX_LEVEL - |
1709 | (info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL); | 1709 | (info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL); |
1710 | 1710 | ||
@@ -1724,8 +1724,7 @@ static int aty128_bl_get_level_brightness(struct aty128fb_par *par, | |||
1724 | /* That one prevents proper CRT output with LCD off */ | 1724 | /* That one prevents proper CRT output with LCD off */ |
1725 | #undef BACKLIGHT_DAC_OFF | 1725 | #undef BACKLIGHT_DAC_OFF |
1726 | 1726 | ||
1727 | /* Call with fb_info->bl_mutex held */ | 1727 | static int aty128_bl_update_status(struct backlight_device *bd) |
1728 | static int __aty128_bl_update_status(struct backlight_device *bd) | ||
1729 | { | 1728 | { |
1730 | struct aty128fb_par *par = class_get_devdata(&bd->class_dev); | 1729 | struct aty128fb_par *par = class_get_devdata(&bd->class_dev); |
1731 | unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); | 1730 | unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); |
@@ -1778,19 +1777,6 @@ static int __aty128_bl_update_status(struct backlight_device *bd) | |||
1778 | return 0; | 1777 | return 0; |
1779 | } | 1778 | } |
1780 | 1779 | ||
1781 | static int aty128_bl_update_status(struct backlight_device *bd) | ||
1782 | { | ||
1783 | struct aty128fb_par *par = class_get_devdata(&bd->class_dev); | ||
1784 | struct fb_info *info = pci_get_drvdata(par->pdev); | ||
1785 | int ret; | ||
1786 | |||
1787 | mutex_lock(&info->bl_mutex); | ||
1788 | ret = __aty128_bl_update_status(bd); | ||
1789 | mutex_unlock(&info->bl_mutex); | ||
1790 | |||
1791 | return ret; | ||
1792 | } | ||
1793 | |||
1794 | static int aty128_bl_get_brightness(struct backlight_device *bd) | 1780 | static int aty128_bl_get_brightness(struct backlight_device *bd) |
1795 | { | 1781 | { |
1796 | return bd->props->brightness; | 1782 | return bd->props->brightness; |
@@ -1804,14 +1790,10 @@ static struct backlight_properties aty128_bl_data = { | |||
1804 | 1790 | ||
1805 | static void aty128_bl_set_power(struct fb_info *info, int power) | 1791 | static void aty128_bl_set_power(struct fb_info *info, int power) |
1806 | { | 1792 | { |
1807 | mutex_lock(&info->bl_mutex); | ||
1808 | |||
1809 | if (info->bl_dev) { | 1793 | if (info->bl_dev) { |
1810 | info->bl_dev->props->power = power; | 1794 | info->bl_dev->props->power = power; |
1811 | __aty128_bl_update_status(info->bl_dev); | 1795 | backlight_update_status(info->bl_dev); |
1812 | } | 1796 | } |
1813 | |||
1814 | mutex_unlock(&info->bl_mutex); | ||
1815 | } | 1797 | } |
1816 | 1798 | ||
1817 | static void aty128_bl_init(struct aty128fb_par *par) | 1799 | static void aty128_bl_init(struct aty128fb_par *par) |
@@ -1838,12 +1820,10 @@ static void aty128_bl_init(struct aty128fb_par *par) | |||
1838 | goto error; | 1820 | goto error; |
1839 | } | 1821 | } |
1840 | 1822 | ||
1841 | mutex_lock(&info->bl_mutex); | ||
1842 | info->bl_dev = bd; | 1823 | info->bl_dev = bd; |
1843 | fb_bl_default_curve(info, 0, | 1824 | fb_bl_default_curve(info, 0, |
1844 | 63 * FB_BACKLIGHT_MAX / MAX_LEVEL, | 1825 | 63 * FB_BACKLIGHT_MAX / MAX_LEVEL, |
1845 | 219 * FB_BACKLIGHT_MAX / MAX_LEVEL); | 1826 | 219 * FB_BACKLIGHT_MAX / MAX_LEVEL); |
1846 | mutex_unlock(&info->bl_mutex); | ||
1847 | 1827 | ||
1848 | bd->props->brightness = aty128_bl_data.max_brightness; | 1828 | bd->props->brightness = aty128_bl_data.max_brightness; |
1849 | bd->props->power = FB_BLANK_UNBLANK; | 1829 | bd->props->power = FB_BLANK_UNBLANK; |
@@ -1864,31 +1844,19 @@ error: | |||
1864 | return; | 1844 | return; |
1865 | } | 1845 | } |
1866 | 1846 | ||
1867 | static void aty128_bl_exit(struct aty128fb_par *par) | 1847 | static void aty128_bl_exit(struct backlight_device *bd) |
1868 | { | 1848 | { |
1869 | struct fb_info *info = pci_get_drvdata(par->pdev); | 1849 | if (bd) { |
1870 | |||
1871 | #ifdef CONFIG_PMAC_BACKLIGHT | 1850 | #ifdef CONFIG_PMAC_BACKLIGHT |
1872 | mutex_lock(&pmac_backlight_mutex); | 1851 | mutex_lock(&pmac_backlight_mutex); |
1873 | #endif | 1852 | if (pmac_backlight == bd) |
1874 | |||
1875 | mutex_lock(&info->bl_mutex); | ||
1876 | if (info->bl_dev) { | ||
1877 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
1878 | if (pmac_backlight == info->bl_dev) | ||
1879 | pmac_backlight = NULL; | 1853 | pmac_backlight = NULL; |
1854 | mutex_unlock(&pmac_backlight_mutex); | ||
1880 | #endif | 1855 | #endif |
1881 | 1856 | backlight_device_unregister(bd); | |
1882 | backlight_device_unregister(info->bl_dev); | ||
1883 | info->bl_dev = NULL; | ||
1884 | 1857 | ||
1885 | printk("aty128: Backlight unloaded\n"); | 1858 | printk("aty128: Backlight unloaded\n"); |
1886 | } | 1859 | } |
1887 | mutex_unlock(&info->bl_mutex); | ||
1888 | |||
1889 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
1890 | mutex_unlock(&pmac_backlight_mutex); | ||
1891 | #endif | ||
1892 | } | 1860 | } |
1893 | #endif /* CONFIG_FB_ATY128_BACKLIGHT */ | 1861 | #endif /* CONFIG_FB_ATY128_BACKLIGHT */ |
1894 | 1862 | ||
@@ -2175,11 +2143,12 @@ static void __devexit aty128_remove(struct pci_dev *pdev) | |||
2175 | 2143 | ||
2176 | par = info->par; | 2144 | par = info->par; |
2177 | 2145 | ||
2146 | unregister_framebuffer(info); | ||
2147 | |||
2178 | #ifdef CONFIG_FB_ATY128_BACKLIGHT | 2148 | #ifdef CONFIG_FB_ATY128_BACKLIGHT |
2179 | aty128_bl_exit(par); | 2149 | aty128_bl_exit(info->bl_dev); |
2180 | #endif | 2150 | #endif |
2181 | 2151 | ||
2182 | unregister_framebuffer(info); | ||
2183 | #ifdef CONFIG_MTRR | 2152 | #ifdef CONFIG_MTRR |
2184 | if (par->mtrr.vram_valid) | 2153 | if (par->mtrr.vram_valid) |
2185 | mtrr_del(par->mtrr.vram, info->fix.smem_start, | 2154 | mtrr_del(par->mtrr.vram, info->fix.smem_start, |