diff options
Diffstat (limited to 'drivers/video/aty')
-rw-r--r-- | drivers/video/aty/aty128fb.c | 55 | ||||
-rw-r--r-- | drivers/video/aty/atyfb_base.c | 49 | ||||
-rw-r--r-- | drivers/video/aty/radeon_backlight.c | 29 | ||||
-rw-r--r-- | drivers/video/aty/radeon_base.c | 3 |
4 files changed, 33 insertions, 103 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, |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 3b6529392359..66462286e704 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -2116,13 +2116,13 @@ static int atyfb_pci_resume(struct pci_dev *pdev) | |||
2116 | 2116 | ||
2117 | static struct backlight_properties aty_bl_data; | 2117 | static struct backlight_properties aty_bl_data; |
2118 | 2118 | ||
2119 | /* Call with fb_info->bl_mutex held */ | ||
2120 | static int aty_bl_get_level_brightness(struct atyfb_par *par, int level) | 2119 | static int aty_bl_get_level_brightness(struct atyfb_par *par, int level) |
2121 | { | 2120 | { |
2122 | struct fb_info *info = pci_get_drvdata(par->pdev); | 2121 | struct fb_info *info = pci_get_drvdata(par->pdev); |
2123 | int atylevel; | 2122 | int atylevel; |
2124 | 2123 | ||
2125 | /* Get and convert the value */ | 2124 | /* Get and convert the value */ |
2125 | /* No locking of bl_curve since we read a single value */ | ||
2126 | atylevel = info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL; | 2126 | atylevel = info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL; |
2127 | 2127 | ||
2128 | if (atylevel < 0) | 2128 | if (atylevel < 0) |
@@ -2133,8 +2133,7 @@ static int aty_bl_get_level_brightness(struct atyfb_par *par, int level) | |||
2133 | return atylevel; | 2133 | return atylevel; |
2134 | } | 2134 | } |
2135 | 2135 | ||
2136 | /* Call with fb_info->bl_mutex held */ | 2136 | static int aty_bl_update_status(struct backlight_device *bd) |
2137 | static int __aty_bl_update_status(struct backlight_device *bd) | ||
2138 | { | 2137 | { |
2139 | struct atyfb_par *par = class_get_devdata(&bd->class_dev); | 2138 | struct atyfb_par *par = class_get_devdata(&bd->class_dev); |
2140 | unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par); | 2139 | unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par); |
@@ -2159,19 +2158,6 @@ static int __aty_bl_update_status(struct backlight_device *bd) | |||
2159 | return 0; | 2158 | return 0; |
2160 | } | 2159 | } |
2161 | 2160 | ||
2162 | static int aty_bl_update_status(struct backlight_device *bd) | ||
2163 | { | ||
2164 | struct atyfb_par *par = class_get_devdata(&bd->class_dev); | ||
2165 | struct fb_info *info = pci_get_drvdata(par->pdev); | ||
2166 | int ret; | ||
2167 | |||
2168 | mutex_lock(&info->bl_mutex); | ||
2169 | ret = __aty_bl_update_status(bd); | ||
2170 | mutex_unlock(&info->bl_mutex); | ||
2171 | |||
2172 | return ret; | ||
2173 | } | ||
2174 | |||
2175 | static int aty_bl_get_brightness(struct backlight_device *bd) | 2161 | static int aty_bl_get_brightness(struct backlight_device *bd) |
2176 | { | 2162 | { |
2177 | return bd->props->brightness; | 2163 | return bd->props->brightness; |
@@ -2203,12 +2189,10 @@ static void aty_bl_init(struct atyfb_par *par) | |||
2203 | goto error; | 2189 | goto error; |
2204 | } | 2190 | } |
2205 | 2191 | ||
2206 | mutex_lock(&info->bl_mutex); | ||
2207 | info->bl_dev = bd; | 2192 | info->bl_dev = bd; |
2208 | fb_bl_default_curve(info, 0, | 2193 | fb_bl_default_curve(info, 0, |
2209 | 0x3F * FB_BACKLIGHT_MAX / MAX_LEVEL, | 2194 | 0x3F * FB_BACKLIGHT_MAX / MAX_LEVEL, |
2210 | 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL); | 2195 | 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL); |
2211 | mutex_unlock(&info->bl_mutex); | ||
2212 | 2196 | ||
2213 | bd->props->brightness = aty_bl_data.max_brightness; | 2197 | bd->props->brightness = aty_bl_data.max_brightness; |
2214 | bd->props->power = FB_BLANK_UNBLANK; | 2198 | bd->props->power = FB_BLANK_UNBLANK; |
@@ -2229,30 +2213,19 @@ error: | |||
2229 | return; | 2213 | return; |
2230 | } | 2214 | } |
2231 | 2215 | ||
2232 | static void aty_bl_exit(struct atyfb_par *par) | 2216 | static void aty_bl_exit(struct backlight_device *bd) |
2233 | { | 2217 | { |
2234 | struct fb_info *info = pci_get_drvdata(par->pdev); | 2218 | if (bd) { |
2235 | |||
2236 | #ifdef CONFIG_PMAC_BACKLIGHT | 2219 | #ifdef CONFIG_PMAC_BACKLIGHT |
2237 | mutex_lock(&pmac_backlight_mutex); | 2220 | mutex_lock(&pmac_backlight_mutex); |
2238 | #endif | 2221 | if (pmac_backlight == bd) |
2239 | |||
2240 | mutex_lock(&info->bl_mutex); | ||
2241 | if (info->bl_dev) { | ||
2242 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
2243 | if (pmac_backlight == info->bl_dev) | ||
2244 | pmac_backlight = NULL; | 2222 | pmac_backlight = NULL; |
2223 | mutex_unlock(&pmac_backlight_mutex); | ||
2245 | #endif | 2224 | #endif |
2246 | 2225 | backlight_device_unregister(bd); | |
2247 | backlight_device_unregister(info->bl_dev); | ||
2248 | 2226 | ||
2249 | printk("aty: Backlight unloaded\n"); | 2227 | printk("aty: Backlight unloaded\n"); |
2250 | } | 2228 | } |
2251 | mutex_unlock(&info->bl_mutex); | ||
2252 | |||
2253 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
2254 | mutex_unlock(&pmac_backlight_mutex); | ||
2255 | #endif | ||
2256 | } | 2229 | } |
2257 | 2230 | ||
2258 | #endif /* CONFIG_FB_ATY_BACKLIGHT */ | 2231 | #endif /* CONFIG_FB_ATY_BACKLIGHT */ |
@@ -3705,13 +3678,13 @@ static void __devexit atyfb_remove(struct fb_info *info) | |||
3705 | aty_set_crtc(par, &saved_crtc); | 3678 | aty_set_crtc(par, &saved_crtc); |
3706 | par->pll_ops->set_pll(info, &saved_pll); | 3679 | par->pll_ops->set_pll(info, &saved_pll); |
3707 | 3680 | ||
3681 | unregister_framebuffer(info); | ||
3682 | |||
3708 | #ifdef CONFIG_FB_ATY_BACKLIGHT | 3683 | #ifdef CONFIG_FB_ATY_BACKLIGHT |
3709 | if (M64_HAS(MOBIL_BUS)) | 3684 | if (M64_HAS(MOBIL_BUS)) |
3710 | aty_bl_exit(par); | 3685 | aty_bl_exit(info->bl_dev); |
3711 | #endif | 3686 | #endif |
3712 | 3687 | ||
3713 | unregister_framebuffer(info); | ||
3714 | |||
3715 | #ifdef CONFIG_MTRR | 3688 | #ifdef CONFIG_MTRR |
3716 | if (par->mtrr_reg >= 0) { | 3689 | if (par->mtrr_reg >= 0) { |
3717 | mtrr_del(par->mtrr_reg, 0, 0); | 3690 | mtrr_del(par->mtrr_reg, 0, 0); |
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c index 9cfcecac8b5e..f94e4616788d 100644 --- a/drivers/video/aty/radeon_backlight.c +++ b/drivers/video/aty/radeon_backlight.c | |||
@@ -29,17 +29,13 @@ struct radeon_bl_privdata { | |||
29 | static int radeon_bl_get_level_brightness(struct radeon_bl_privdata *pdata, | 29 | static int radeon_bl_get_level_brightness(struct radeon_bl_privdata *pdata, |
30 | int level) | 30 | int level) |
31 | { | 31 | { |
32 | struct fb_info *info = pdata->rinfo->info; | ||
33 | int rlevel; | 32 | int rlevel; |
34 | 33 | ||
35 | mutex_lock(&info->bl_mutex); | ||
36 | |||
37 | /* Get and convert the value */ | 34 | /* Get and convert the value */ |
35 | /* No locking of bl_curve since we read a single value */ | ||
38 | rlevel = pdata->rinfo->info->bl_curve[level] * | 36 | rlevel = pdata->rinfo->info->bl_curve[level] * |
39 | FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL; | 37 | FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL; |
40 | 38 | ||
41 | mutex_unlock(&info->bl_mutex); | ||
42 | |||
43 | if (rlevel < 0) | 39 | if (rlevel < 0) |
44 | rlevel = 0; | 40 | rlevel = 0; |
45 | else if (rlevel > MAX_RADEON_LEVEL) | 41 | else if (rlevel > MAX_RADEON_LEVEL) |
@@ -187,12 +183,10 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo) | |||
187 | machine_is_compatible("PowerBook6,5"); | 183 | machine_is_compatible("PowerBook6,5"); |
188 | #endif | 184 | #endif |
189 | 185 | ||
190 | mutex_lock(&rinfo->info->bl_mutex); | ||
191 | rinfo->info->bl_dev = bd; | 186 | rinfo->info->bl_dev = bd; |
192 | fb_bl_default_curve(rinfo->info, 0, | 187 | fb_bl_default_curve(rinfo->info, 0, |
193 | 63 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL, | 188 | 63 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL, |
194 | 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); | 189 | 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); |
195 | mutex_unlock(&rinfo->info->bl_mutex); | ||
196 | 190 | ||
197 | bd->props->brightness = radeon_bl_data.max_brightness; | 191 | bd->props->brightness = radeon_bl_data.max_brightness; |
198 | bd->props->power = FB_BLANK_UNBLANK; | 192 | bd->props->power = FB_BLANK_UNBLANK; |
@@ -216,29 +210,22 @@ error: | |||
216 | 210 | ||
217 | void radeonfb_bl_exit(struct radeonfb_info *rinfo) | 211 | void radeonfb_bl_exit(struct radeonfb_info *rinfo) |
218 | { | 212 | { |
219 | #ifdef CONFIG_PMAC_BACKLIGHT | 213 | struct backlight_device *bd = rinfo->info->bl_dev; |
220 | mutex_lock(&pmac_backlight_mutex); | ||
221 | #endif | ||
222 | 214 | ||
223 | mutex_lock(&rinfo->info->bl_mutex); | 215 | if (bd) { |
224 | if (rinfo->info->bl_dev) { | ||
225 | struct radeon_bl_privdata *pdata; | 216 | struct radeon_bl_privdata *pdata; |
226 | 217 | ||
227 | #ifdef CONFIG_PMAC_BACKLIGHT | 218 | #ifdef CONFIG_PMAC_BACKLIGHT |
228 | if (pmac_backlight == rinfo->info->bl_dev) | 219 | mutex_lock(&pmac_backlight_mutex); |
220 | if (pmac_backlight == bd) | ||
229 | pmac_backlight = NULL; | 221 | pmac_backlight = NULL; |
222 | mutex_unlock(&pmac_backlight_mutex); | ||
230 | #endif | 223 | #endif |
231 | 224 | pdata = class_get_devdata(&bd->class_dev); | |
232 | pdata = class_get_devdata(&rinfo->info->bl_dev->class_dev); | 225 | backlight_device_unregister(bd); |
233 | backlight_device_unregister(rinfo->info->bl_dev); | ||
234 | kfree(pdata); | 226 | kfree(pdata); |
235 | rinfo->info->bl_dev = NULL; | 227 | rinfo->info->bl_dev = NULL; |
236 | 228 | ||
237 | printk("radeonfb: Backlight unloaded\n"); | 229 | printk("radeonfb: Backlight unloaded\n"); |
238 | } | 230 | } |
239 | mutex_unlock(&rinfo->info->bl_mutex); | ||
240 | |||
241 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
242 | mutex_unlock(&pmac_backlight_mutex); | ||
243 | #endif | ||
244 | } | 231 | } |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 0ed577e7cc21..7e228aded4c2 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -2393,7 +2393,6 @@ static void __devexit radeonfb_pci_unregister (struct pci_dev *pdev) | |||
2393 | if (!rinfo) | 2393 | if (!rinfo) |
2394 | return; | 2394 | return; |
2395 | 2395 | ||
2396 | radeonfb_bl_exit(rinfo); | ||
2397 | radeonfb_pm_exit(rinfo); | 2396 | radeonfb_pm_exit(rinfo); |
2398 | 2397 | ||
2399 | if (rinfo->mon1_EDID) | 2398 | if (rinfo->mon1_EDID) |
@@ -2420,6 +2419,8 @@ static void __devexit radeonfb_pci_unregister (struct pci_dev *pdev) | |||
2420 | 2419 | ||
2421 | unregister_framebuffer(info); | 2420 | unregister_framebuffer(info); |
2422 | 2421 | ||
2422 | radeonfb_bl_exit(rinfo); | ||
2423 | |||
2423 | iounmap(rinfo->mmio_base); | 2424 | iounmap(rinfo->mmio_base); |
2424 | iounmap(rinfo->fb_base); | 2425 | iounmap(rinfo->fb_base); |
2425 | 2426 | ||