apple-gmux: Add switch_ddc support
Originally by Seth Forshee <seth.forshee@canonical.com>, 2012-10-04:
The gmux allows muxing the DDC independently from the display, so
support this functionality. This will allow reading the EDID for the
inactive GPU, fixing issues with machines that either don't have a
VBT or have invalid mode data in the VBT.
Modified by Lukas Wunner <lukas@wunner.de>, 2015-04 - 2015-12:
Change semantics of ->switch_ddc handler callback to return previous
DDC owner. Original version tried to determine previous DDC owner
with find_active_client() in vga_switcheroo but this fails if the
inactive client registers before the active client.
v2.4: Retain semantics of ->switchto handler callback to switch all
pins, including DDC (Daniel Vetter)
v4: Advertise ->switch_ddc handler callback only on the pre-retina
Macbook Pro. The retina uses eDP instead of LVDS and gmux no
longer does the muxing itself but merely controls an external
mux. That mux is incapable of switching the AUX channel
separately from the main link. It's an NXP CBTL06142
(alternate parts: TI HD3SS212, Pericom PI3VDP12412,
see datasheets below).
v5: Rebase on "apple-gmux: Track switch state".
Rebase on "vga_switcheroo: Add handler flags infrastructure".
Rebase on
5d170139eb10 ("Constify vga_switcheroo_handler"),
requires 2 structs, 1x with ->switchto for pre-retinas,
1x without for retinas).
Add error message if handler registration with vga_switcheroo
fails.
Teardowns identifying the mux:
http://www.electronicproducts.com/-whatsinside_text-145.aspx
http://slideshare.net/jjwu6266/apple-2012-wwdc-apple-macbook-pro-with-retina-display
http://www.techrepublic.com/blog/cracking-open/teardown-shows-retina-macbook-pro-is-nearly-impossible-to-upgrade-difficult-to-work-on/
Mux Datasheets:
http://www.nxp.com/documents/data_sheet/CBTL06141.pdf
http://www.ti.com/lit/ds/symlink/hd3ss212.pdf
https://www.pericom.com/assets/Datasheets/PI3VDP12412.pdf
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=88861
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61115
Tested-by: Lukas Wunner <lukas@wunner.de>
[MBP 9,1 2012 intel IVB + nvidia GK107 pre-retina 15"]
Cc: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/17fe8bfb0415d713bb4174f84ac9aae5d7d9a5f8.1452525860.git.lukas@wunner.de