aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/aty
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2007-02-10 18:07:48 -0500
committerRichard Purdie <rpurdie@rpsys.net>2007-02-20 04:26:53 -0500
commit599a52d12629394236d785615808845823875868 (patch)
tree4e2dfa3a25ce761be0ecc0490acabac553f77a67 /drivers/video/aty
parent321709c5994f952b78d567fd7083dbebbdc381b7 (diff)
backlight: Separate backlight properties from backlight ops pointers
Per device data such as brightness belongs to the indivdual device and should therefore be separate from the the backlight operation function pointers. This patch splits the two types of data and allows simplifcation of some code. Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/video/aty')
-rw-r--r--drivers/video/aty/aty128fb.c20
-rw-r--r--drivers/video/aty/atyfb_base.c18
-rw-r--r--drivers/video/aty/radeon_backlight.c18
3 files changed, 25 insertions, 31 deletions
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index 4de8d6252c3c..8726c3669713 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -1695,8 +1695,6 @@ static int __devinit aty128fb_setup(char *options)
1695#ifdef CONFIG_FB_ATY128_BACKLIGHT 1695#ifdef CONFIG_FB_ATY128_BACKLIGHT
1696#define MAX_LEVEL 0xFF 1696#define MAX_LEVEL 0xFF
1697 1697
1698static struct backlight_properties aty128_bl_data;
1699
1700static int aty128_bl_get_level_brightness(struct aty128fb_par *par, 1698static int aty128_bl_get_level_brightness(struct aty128fb_par *par,
1701 int level) 1699 int level)
1702{ 1700{
@@ -1730,12 +1728,12 @@ static int aty128_bl_update_status(struct backlight_device *bd)
1730 unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); 1728 unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL);
1731 int level; 1729 int level;
1732 1730
1733 if (bd->props->power != FB_BLANK_UNBLANK || 1731 if (bd->props.power != FB_BLANK_UNBLANK ||
1734 bd->props->fb_blank != FB_BLANK_UNBLANK || 1732 bd->props.fb_blank != FB_BLANK_UNBLANK ||
1735 !par->lcd_on) 1733 !par->lcd_on)
1736 level = 0; 1734 level = 0;
1737 else 1735 else
1738 level = bd->props->brightness; 1736 level = bd->props.brightness;
1739 1737
1740 reg |= LVDS_BL_MOD_EN | LVDS_BLON; 1738 reg |= LVDS_BL_MOD_EN | LVDS_BLON;
1741 if (level > 0) { 1739 if (level > 0) {
@@ -1779,19 +1777,18 @@ static int aty128_bl_update_status(struct backlight_device *bd)
1779 1777
1780static int aty128_bl_get_brightness(struct backlight_device *bd) 1778static int aty128_bl_get_brightness(struct backlight_device *bd)
1781{ 1779{
1782 return bd->props->brightness; 1780 return bd->props.brightness;
1783} 1781}
1784 1782
1785static struct backlight_properties aty128_bl_data = { 1783static struct backlight_ops aty128_bl_data = {
1786 .get_brightness = aty128_bl_get_brightness, 1784 .get_brightness = aty128_bl_get_brightness,
1787 .update_status = aty128_bl_update_status, 1785 .update_status = aty128_bl_update_status,
1788 .max_brightness = (FB_BACKLIGHT_LEVELS - 1),
1789}; 1786};
1790 1787
1791static void aty128_bl_set_power(struct fb_info *info, int power) 1788static void aty128_bl_set_power(struct fb_info *info, int power)
1792{ 1789{
1793 if (info->bl_dev) { 1790 if (info->bl_dev) {
1794 info->bl_dev->props->power = power; 1791 info->bl_dev->props.power = power;
1795 backlight_update_status(info->bl_dev); 1792 backlight_update_status(info->bl_dev);
1796 } 1793 }
1797} 1794}
@@ -1825,8 +1822,9 @@ static void aty128_bl_init(struct aty128fb_par *par)
1825 63 * FB_BACKLIGHT_MAX / MAX_LEVEL, 1822 63 * FB_BACKLIGHT_MAX / MAX_LEVEL,
1826 219 * FB_BACKLIGHT_MAX / MAX_LEVEL); 1823 219 * FB_BACKLIGHT_MAX / MAX_LEVEL);
1827 1824
1828 bd->props->brightness = aty128_bl_data.max_brightness; 1825 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
1829 bd->props->power = FB_BLANK_UNBLANK; 1826 bd->props.brightness = bd->props.max_brightness;
1827 bd->props.power = FB_BLANK_UNBLANK;
1830 backlight_update_status(bd); 1828 backlight_update_status(bd);
1831 1829
1832 printk("aty128: Backlight initialized (%s)\n", name); 1830 printk("aty128: Backlight initialized (%s)\n", name);
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 35ba26567598..a7e0062233f2 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -2114,8 +2114,6 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
2114#ifdef CONFIG_FB_ATY_BACKLIGHT 2114#ifdef CONFIG_FB_ATY_BACKLIGHT
2115#define MAX_LEVEL 0xFF 2115#define MAX_LEVEL 0xFF
2116 2116
2117static struct backlight_properties aty_bl_data;
2118
2119static int aty_bl_get_level_brightness(struct atyfb_par *par, int level) 2117static int aty_bl_get_level_brightness(struct atyfb_par *par, int level)
2120{ 2118{
2121 struct fb_info *info = pci_get_drvdata(par->pdev); 2119 struct fb_info *info = pci_get_drvdata(par->pdev);
@@ -2139,11 +2137,11 @@ static int aty_bl_update_status(struct backlight_device *bd)
2139 unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par); 2137 unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par);
2140 int level; 2138 int level;
2141 2139
2142 if (bd->props->power != FB_BLANK_UNBLANK || 2140 if (bd->props.power != FB_BLANK_UNBLANK ||
2143 bd->props->fb_blank != FB_BLANK_UNBLANK) 2141 bd->props.fb_blank != FB_BLANK_UNBLANK)
2144 level = 0; 2142 level = 0;
2145 else 2143 else
2146 level = bd->props->brightness; 2144 level = bd->props.brightness;
2147 2145
2148 reg |= (BLMOD_EN | BIASMOD_EN); 2146 reg |= (BLMOD_EN | BIASMOD_EN);
2149 if (level > 0) { 2147 if (level > 0) {
@@ -2160,13 +2158,12 @@ static int aty_bl_update_status(struct backlight_device *bd)
2160 2158
2161static int aty_bl_get_brightness(struct backlight_device *bd) 2159static int aty_bl_get_brightness(struct backlight_device *bd)
2162{ 2160{
2163 return bd->props->brightness; 2161 return bd->props.brightness;
2164} 2162}
2165 2163
2166static struct backlight_properties aty_bl_data = { 2164static struct backlight_ops aty_bl_data = {
2167 .get_brightness = aty_bl_get_brightness, 2165 .get_brightness = aty_bl_get_brightness,
2168 .update_status = aty_bl_update_status, 2166 .update_status = aty_bl_update_status,
2169 .max_brightness = (FB_BACKLIGHT_LEVELS - 1),
2170}; 2167};
2171 2168
2172static void aty_bl_init(struct atyfb_par *par) 2169static void aty_bl_init(struct atyfb_par *par)
@@ -2194,8 +2191,9 @@ static void aty_bl_init(struct atyfb_par *par)
2194 0x3F * FB_BACKLIGHT_MAX / MAX_LEVEL, 2191 0x3F * FB_BACKLIGHT_MAX / MAX_LEVEL,
2195 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL); 2192 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL);
2196 2193
2197 bd->props->brightness = aty_bl_data.max_brightness; 2194 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
2198 bd->props->power = FB_BLANK_UNBLANK; 2195 bd->props.brightness = bd->props.max_brightness;
2196 bd->props.power = FB_BLANK_UNBLANK;
2199 backlight_update_status(bd); 2197 backlight_update_status(bd);
2200 2198
2201 printk("aty: Backlight initialized (%s)\n", name); 2199 printk("aty: Backlight initialized (%s)\n", name);
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c
index 8c775e6a7e03..0be25fa5540c 100644
--- a/drivers/video/aty/radeon_backlight.c
+++ b/drivers/video/aty/radeon_backlight.c
@@ -19,8 +19,6 @@
19 19
20#define MAX_RADEON_LEVEL 0xFF 20#define MAX_RADEON_LEVEL 0xFF
21 21
22static struct backlight_properties radeon_bl_data;
23
24struct radeon_bl_privdata { 22struct radeon_bl_privdata {
25 struct radeonfb_info *rinfo; 23 struct radeonfb_info *rinfo;
26 uint8_t negative; 24 uint8_t negative;
@@ -61,11 +59,11 @@ static int radeon_bl_update_status(struct backlight_device *bd)
61 * backlight. This provides some greater power saving and the display 59 * backlight. This provides some greater power saving and the display
62 * is useless without backlight anyway. 60 * is useless without backlight anyway.
63 */ 61 */
64 if (bd->props->power != FB_BLANK_UNBLANK || 62 if (bd->props.power != FB_BLANK_UNBLANK ||
65 bd->props->fb_blank != FB_BLANK_UNBLANK) 63 bd->props.fb_blank != FB_BLANK_UNBLANK)
66 level = 0; 64 level = 0;
67 else 65 else
68 level = bd->props->brightness; 66 level = bd->props.brightness;
69 67
70 del_timer_sync(&rinfo->lvds_timer); 68 del_timer_sync(&rinfo->lvds_timer);
71 radeon_engine_idle(); 69 radeon_engine_idle();
@@ -126,13 +124,12 @@ static int radeon_bl_update_status(struct backlight_device *bd)
126 124
127static int radeon_bl_get_brightness(struct backlight_device *bd) 125static int radeon_bl_get_brightness(struct backlight_device *bd)
128{ 126{
129 return bd->props->brightness; 127 return bd->props.brightness;
130} 128}
131 129
132static struct backlight_properties radeon_bl_data = { 130static struct backlight_ops radeon_bl_data = {
133 .get_brightness = radeon_bl_get_brightness, 131 .get_brightness = radeon_bl_get_brightness,
134 .update_status = radeon_bl_update_status, 132 .update_status = radeon_bl_update_status,
135 .max_brightness = (FB_BACKLIGHT_LEVELS - 1),
136}; 133};
137 134
138void radeonfb_bl_init(struct radeonfb_info *rinfo) 135void radeonfb_bl_init(struct radeonfb_info *rinfo)
@@ -188,8 +185,9 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
188 63 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL, 185 63 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL,
189 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); 186 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL);
190 187
191 bd->props->brightness = radeon_bl_data.max_brightness; 188 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
192 bd->props->power = FB_BLANK_UNBLANK; 189 bd->props.brightness = bd->props.max_brightness;
190 bd->props.power = FB_BLANK_UNBLANK;
193 backlight_update_status(bd); 191 backlight_update_status(bd);
194 192
195 printk("radeonfb: Backlight initialized (%s)\n", name); 193 printk("radeonfb: Backlight initialized (%s)\n", name);