diff options
-rw-r--r-- | drivers/platform/x86/apple-gmux.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c index 905fa01ac8df..c9db50729f6f 100644 --- a/drivers/platform/x86/apple-gmux.c +++ b/drivers/platform/x86/apple-gmux.c | |||
@@ -75,6 +75,18 @@ static inline u32 gmux_read32(struct apple_gmux_data *gmux_data, int port) | |||
75 | return inl(gmux_data->iostart + port); | 75 | return inl(gmux_data->iostart + port); |
76 | } | 76 | } |
77 | 77 | ||
78 | static inline u32 gmux_write32(struct apple_gmux_data *gmux_data, int port, | ||
79 | u32 val) | ||
80 | { | ||
81 | int i; | ||
82 | u8 tmpval; | ||
83 | |||
84 | for (i = 0; i < 4; i++) { | ||
85 | tmpval = (val >> (i * 8)) & 0xff; | ||
86 | outb(tmpval, port + i); | ||
87 | } | ||
88 | } | ||
89 | |||
78 | static int gmux_get_brightness(struct backlight_device *bd) | 90 | static int gmux_get_brightness(struct backlight_device *bd) |
79 | { | 91 | { |
80 | struct apple_gmux_data *gmux_data = bl_get_data(bd); | 92 | struct apple_gmux_data *gmux_data = bl_get_data(bd); |
@@ -90,16 +102,7 @@ static int gmux_update_status(struct backlight_device *bd) | |||
90 | if (bd->props.state & BL_CORE_SUSPENDED) | 102 | if (bd->props.state & BL_CORE_SUSPENDED) |
91 | return 0; | 103 | return 0; |
92 | 104 | ||
93 | /* | 105 | gmux_write32(gmux_data, GMUX_PORT_BRIGHTNESS, brightness); |
94 | * Older gmux versions require writing out lower bytes first then | ||
95 | * setting the upper byte to 0 to flush the values. Newer versions | ||
96 | * accept a single u32 write, but the old method also works, so we | ||
97 | * just use the old method for all gmux versions. | ||
98 | */ | ||
99 | gmux_write8(gmux_data, GMUX_PORT_BRIGHTNESS, brightness); | ||
100 | gmux_write8(gmux_data, GMUX_PORT_BRIGHTNESS + 1, brightness >> 8); | ||
101 | gmux_write8(gmux_data, GMUX_PORT_BRIGHTNESS + 2, brightness >> 16); | ||
102 | gmux_write8(gmux_data, GMUX_PORT_BRIGHTNESS + 3, 0); | ||
103 | 106 | ||
104 | return 0; | 107 | return 0; |
105 | } | 108 | } |