Skip to content

Commit

Permalink
apple-gmux: Fix index read functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bernhard Froemel authored and Matthew Garrett committed Sep 13, 2012
1 parent 07f377d commit c5a5052
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/platform/x86/apple-gmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ static u8 gmux_index_read8(struct apple_gmux_data *gmux_data, int port)
u8 val;

mutex_lock(&gmux_data->index_lock);
outb((port & 0xff), gmux_data->iostart + GMUX_PORT_READ);
gmux_index_wait_ready(gmux_data);
outb((port & 0xff), gmux_data->iostart + GMUX_PORT_READ);
gmux_index_wait_complete(gmux_data);
val = inb(gmux_data->iostart + GMUX_PORT_VALUE);
mutex_unlock(&gmux_data->index_lock);

Expand All @@ -166,8 +167,9 @@ static u32 gmux_index_read32(struct apple_gmux_data *gmux_data, int port)
u32 val;

mutex_lock(&gmux_data->index_lock);
outb((port & 0xff), gmux_data->iostart + GMUX_PORT_READ);
gmux_index_wait_ready(gmux_data);
outb((port & 0xff), gmux_data->iostart + GMUX_PORT_READ);
gmux_index_wait_complete(gmux_data);
val = inl(gmux_data->iostart + GMUX_PORT_VALUE);
mutex_unlock(&gmux_data->index_lock);

Expand Down

0 comments on commit c5a5052

Please sign in to comment.