aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Froemel <froemel@vmars.tuwien.ac.at>2012-08-25 04:30:48 -0400
committerMatthew Garrett <mjg@redhat.com>2012-09-13 16:46:29 -0400
commitc5a5052923c55990e32a3d64bdb4779b01162646 (patch)
tree6ffd57a7eba842cd14d18479f540fefabe9eb44f
parent07f377da7e8a7d3c3a6626333516f9c808637c9e (diff)
apple-gmux: Fix index read functions
Study of Apple's binary driver revealed that the GMUX_READ_PORT should be written between calls to gmux_index_wait_ready and gmux_index_wait_complete (i.e., the new index protocol must be followed). If this is not done correctly, the indexed gmux device only partially accepts writes which lead to problems concerning GPU switching. Special thanks to Seth Forshee who helped greatly with identifying unnecessary changes. Signed-off-by: Bernhard Froemel <froemel@vmars.tuwien.ac.at> Signed-off-by: Matthew Garrett <mjg@redhat.com>
-rw-r--r--drivers/platform/x86/apple-gmux.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
index c9558d1ea88c..0e43477de337 100644
--- a/drivers/platform/x86/apple-gmux.c
+++ b/drivers/platform/x86/apple-gmux.c
@@ -142,8 +142,9 @@ static u8 gmux_index_read8(struct apple_gmux_data *gmux_data, int port)
142 u8 val; 142 u8 val;
143 143
144 mutex_lock(&gmux_data->index_lock); 144 mutex_lock(&gmux_data->index_lock);
145 outb((port & 0xff), gmux_data->iostart + GMUX_PORT_READ);
146 gmux_index_wait_ready(gmux_data); 145 gmux_index_wait_ready(gmux_data);
146 outb((port & 0xff), gmux_data->iostart + GMUX_PORT_READ);
147 gmux_index_wait_complete(gmux_data);
147 val = inb(gmux_data->iostart + GMUX_PORT_VALUE); 148 val = inb(gmux_data->iostart + GMUX_PORT_VALUE);
148 mutex_unlock(&gmux_data->index_lock); 149 mutex_unlock(&gmux_data->index_lock);
149 150
@@ -166,8 +167,9 @@ static u32 gmux_index_read32(struct apple_gmux_data *gmux_data, int port)
166 u32 val; 167 u32 val;
167 168
168 mutex_lock(&gmux_data->index_lock); 169 mutex_lock(&gmux_data->index_lock);
169 outb((port & 0xff), gmux_data->iostart + GMUX_PORT_READ);
170 gmux_index_wait_ready(gmux_data); 170 gmux_index_wait_ready(gmux_data);
171 outb((port & 0xff), gmux_data->iostart + GMUX_PORT_READ);
172 gmux_index_wait_complete(gmux_data);
171 val = inl(gmux_data->iostart + GMUX_PORT_VALUE); 173 val = inl(gmux_data->iostart + GMUX_PORT_VALUE);
172 mutex_unlock(&gmux_data->index_lock); 174 mutex_unlock(&gmux_data->index_lock);
173 175