Message ID | 20e71ed5f0dc852a152b26d9ca9711a8fab5488f.1444670070.git.lukas@wunner.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Aug 14, 2015 at 12:18 PM, Lukas Wunner <lukas@wunner.de> wrote: > 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-10-07: > Advertise ->switch_ddc handler callback only on the pre-retina > Macbook Pro. The retina uses eDP and its mux is incapable of > switching the AUX channel separately from the main link. > It's an NXP CBTL06142 (alternate parts: TI HD3SS212, > Pericom PPI3VDP12412). > > Sources: > 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/ > > 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> > --- > drivers/platform/x86/apple-gmux.c | 21 +++++++++++++++++++-- > 1 file changed, 19 insertions(+), 2 deletions(-) > > diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c > index 0dec3f5..78997b7 100644 > --- a/drivers/platform/x86/apple-gmux.c > +++ b/drivers/platform/x86/apple-gmux.c > @@ -276,11 +276,9 @@ static const struct backlight_ops gmux_bl_ops = { > static int gmux_switchto(enum vga_switcheroo_client_id id) > { > if (id == VGA_SWITCHEROO_IGD) { > - gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 1); > gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DISPLAY, 2); > gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_EXTERNAL, 2); > } else { > - gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 2); > gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DISPLAY, 3); > gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_EXTERNAL, 3); > } Won't this hunk break manual switching until the later patches land? Seems like you might want to break this out as a separate patch later in the series. Alex > @@ -288,6 +286,18 @@ static int gmux_switchto(enum vga_switcheroo_client_id id) > return 0; > } > > +static int gmux_switch_ddc(enum vga_switcheroo_client_id id) > +{ > + pr_debug("Switching gmux DDC to %d\n", id); > + > + if (id == VGA_SWITCHEROO_IGD) > + gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 1); > + else > + gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 2); > + > + return 0; > +} > + > static int gmux_set_discrete_state(struct apple_gmux_data *gmux_data, > enum vga_switcheroo_state state) > { > @@ -588,6 +598,13 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) > gmux_data->gpe = -1; > } > > + /* > + * The gmux in pre-retina MacBook Pros can switch DDC separately > + * from the other pins of the outputs. It's distinguishable from > + * the gmux in retinas by being non-indexed. > + */ > + if (!gmux_data->indexed) > + gmux_handler.switch_ddc = gmux_switch_ddc; > if (vga_switcheroo_register_handler(&gmux_handler)) { > ret = -ENODEV; > goto err_register_handler; > -- > 1.8.5.2 (Apple Git-48) > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel
On Mon, Oct 12, 2015 at 5:07 PM, Alex Deucher <alexdeucher@gmail.com> wrote: > On Fri, Aug 14, 2015 at 12:18 PM, Lukas Wunner <lukas@wunner.de> wrote: >> 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-10-07: >> Advertise ->switch_ddc handler callback only on the pre-retina >> Macbook Pro. The retina uses eDP and its mux is incapable of >> switching the AUX channel separately from the main link. >> It's an NXP CBTL06142 (alternate parts: TI HD3SS212, >> Pericom PPI3VDP12412). >> >> Sources: >> 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/ >> >> 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> >> --- >> drivers/platform/x86/apple-gmux.c | 21 +++++++++++++++++++-- >> 1 file changed, 19 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c >> index 0dec3f5..78997b7 100644 >> --- a/drivers/platform/x86/apple-gmux.c >> +++ b/drivers/platform/x86/apple-gmux.c >> @@ -276,11 +276,9 @@ static const struct backlight_ops gmux_bl_ops = { >> static int gmux_switchto(enum vga_switcheroo_client_id id) >> { >> if (id == VGA_SWITCHEROO_IGD) { >> - gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 1); >> gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DISPLAY, 2); >> gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_EXTERNAL, 2); >> } else { >> - gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 2); >> gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DISPLAY, 3); >> gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_EXTERNAL, 3); >> } > > Won't this hunk break manual switching until the later patches land? > Seems like you might want to break this out as a separate patch later > in the series. Also. I'm not sure how the gmux works, but this might break ddc on external displays that are muxed. Alex > > Alex > > >> @@ -288,6 +286,18 @@ static int gmux_switchto(enum vga_switcheroo_client_id id) >> return 0; >> } >> >> +static int gmux_switch_ddc(enum vga_switcheroo_client_id id) >> +{ >> + pr_debug("Switching gmux DDC to %d\n", id); >> + >> + if (id == VGA_SWITCHEROO_IGD) >> + gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 1); >> + else >> + gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 2); >> + >> + return 0; >> +} >> + >> static int gmux_set_discrete_state(struct apple_gmux_data *gmux_data, >> enum vga_switcheroo_state state) >> { >> @@ -588,6 +598,13 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) >> gmux_data->gpe = -1; >> } >> >> + /* >> + * The gmux in pre-retina MacBook Pros can switch DDC separately >> + * from the other pins of the outputs. It's distinguishable from >> + * the gmux in retinas by being non-indexed. >> + */ >> + if (!gmux_data->indexed) >> + gmux_handler.switch_ddc = gmux_switch_ddc; >> if (vga_switcheroo_register_handler(&gmux_handler)) { >> ret = -ENODEV; >> goto err_register_handler; >> -- >> 1.8.5.2 (Apple Git-48) >> >> _______________________________________________ >> dri-devel mailing list >> dri-devel@lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/dri-devel
On Mon, Oct 12, 2015 at 05:10:20PM -0400, Alex Deucher wrote: > On Mon, Oct 12, 2015 at 5:07 PM, Alex Deucher <alexdeucher@gmail.com> wrote: > > On Fri, Aug 14, 2015 at 12:18 PM, Lukas Wunner <lukas@wunner.de> wrote: > >> 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-10-07: > >> Advertise ->switch_ddc handler callback only on the pre-retina > >> Macbook Pro. The retina uses eDP and its mux is incapable of > >> switching the AUX channel separately from the main link. > >> It's an NXP CBTL06142 (alternate parts: TI HD3SS212, > >> Pericom PPI3VDP12412). > >> > >> Sources: > >> 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/ > >> > >> 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> > >> --- > >> drivers/platform/x86/apple-gmux.c | 21 +++++++++++++++++++-- > >> 1 file changed, 19 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c > >> index 0dec3f5..78997b7 100644 > >> --- a/drivers/platform/x86/apple-gmux.c > >> +++ b/drivers/platform/x86/apple-gmux.c > >> @@ -276,11 +276,9 @@ static const struct backlight_ops gmux_bl_ops = { > >> static int gmux_switchto(enum vga_switcheroo_client_id id) > >> { > >> if (id == VGA_SWITCHEROO_IGD) { > >> - gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 1); > >> gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DISPLAY, 2); > >> gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_EXTERNAL, 2); > >> } else { > >> - gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 2); > >> gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DISPLAY, 3); > >> gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_EXTERNAL, 3); > >> } > > > > Won't this hunk break manual switching until the later patches land? > > Seems like you might want to break this out as a separate patch later > > in the series. > > Also. I'm not sure how the gmux works, but this might break ddc on > external displays that are muxed. Yeah I think the old desing was less surprising. And the s/ddc_lock/hw_lock/ change would the make sense again. Also when resending please also keep a per-patch changelog, not only in the cover letter. Otherwise you have to jump back&forth all the time between patches and cover letter. And the kerneldoc still seems to be missing in this resend, so looks incomplete (or I'm missing something). -Daniel
On Fri, Aug 14, 2015 at 06:18:55PM +0200, Lukas Wunner wrote: > 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-10-07: > Advertise ->switch_ddc handler callback only on the pre-retina > Macbook Pro. The retina uses eDP and its mux is incapable of > switching the AUX channel separately from the main link. > It's an NXP CBTL06142 (alternate parts: TI HD3SS212, > Pericom PPI3VDP12412). > > Sources: > 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/ > > 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> For platform/drivers/x86: Acked-by: Darren Hart <dvhart@linux.intel.com> Daniel, I presume this will ultimately get pulled in by you with the rest of the series?
On Wed, Oct 14, 2015 at 09:51:13PM -0700, Darren Hart wrote: > On Fri, Aug 14, 2015 at 06:18:55PM +0200, Lukas Wunner wrote: > > 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-10-07: > > Advertise ->switch_ddc handler callback only on the pre-retina > > Macbook Pro. The retina uses eDP and its mux is incapable of > > switching the AUX channel separately from the main link. > > It's an NXP CBTL06142 (alternate parts: TI HD3SS212, > > Pericom PPI3VDP12412). > > > > Sources: > > 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/ > > > > 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> > > For platform/drivers/x86: > > Acked-by: Darren Hart <dvhart@linux.intel.com> > > Daniel, I presume this will ultimately get pulled in by you with the rest of the > series? Yeah I can collect them all in drm-misc, if there's relevant acks. Thanks for yours. -Daniel
Hi Alex, On Mon, Oct 12, 2015 at 05:10:20PM -0400, Alex Deucher wrote: > On Mon, Oct 12, 2015 at 5:07 PM, Alex Deucher <alexdeucher@gmail.com> wrote: > > On Fri, Aug 14, 2015 at 12:18 PM, Lukas Wunner <lukas@wunner.de> wrote: > >> 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-10-07: > >> Advertise ->switch_ddc handler callback only on the pre-retina > >> Macbook Pro. The retina uses eDP and its mux is incapable of > >> switching the AUX channel separately from the main link. > >> It's an NXP CBTL06142 (alternate parts: TI HD3SS212, > >> Pericom PPI3VDP12412). > >> > >> Sources: > >> 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/ > >> > >> 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> > >> --- > >> drivers/platform/x86/apple-gmux.c | 21 +++++++++++++++++++-- > >> 1 file changed, 19 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c > >> index 0dec3f5..78997b7 100644 > >> --- a/drivers/platform/x86/apple-gmux.c > >> +++ b/drivers/platform/x86/apple-gmux.c > >> @@ -276,11 +276,9 @@ static const struct backlight_ops gmux_bl_ops = { > >> static int gmux_switchto(enum vga_switcheroo_client_id id) > >> { > >> if (id == VGA_SWITCHEROO_IGD) { > >> - gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 1); > >> gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DISPLAY, 2); > >> gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_EXTERNAL, 2); > >> } else { > >> - gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 2); > >> gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DISPLAY, 3); > >> gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_EXTERNAL, 3); > >> } > > > > Won't this hunk break manual switching until the later patches land? > > Seems like you might want to break this out as a separate patch later > > in the series. > > Also. I'm not sure how the gmux works, but this might break ddc on > external displays that are muxed. I had to do some experimenting and research to clarify this definitively, hence the belated reply. Answer is no, GMUX_PORT_SWITCH_DDC only switches DDC of the panel. The first two generations of the MacBook Pro (MBP 5 2008/09, MBP 6 2010) are able to switch the external DP port between GPUs, but only in its entirety. The mux used for this (NXP CBTL06141) is not capable of switching DDC separately. It's controlled by GMUX_PORT_SWITCH_EXTERNAL. The following two generations (MBP 8 2011, MBP 9 2012) replaced the external DP port with a combined DP/Thunderbolt port which can drive either a single "dumb" DP display or two daisy-chained Thunderbolt displays using DP-over-Thunderbolt. The ability to switch the external port in its entirety was given up but the AUX channel is still switchable, under the control of GMUX_PORT_SWITCH_EXTERNAL. The port appears disabled to the Intel GPU, but I hacked i915 to force-enable pipe B and all DP ports and was then able to retrieve DPCD and EDID from an external display. The retina MBP gained a second DP/Thunderbolt port and an HDMI port and is still able to switch AUX to the integrated GPU on both DP ports! I wonder why Apple went to these lengths. Maybe they found that HPD is unreliable, so they let the Intel GPU poll AUX and wake up the discrete GPU if anything is detected? Best regards, Lukas > > Alex > > > > > Alex > > > > > >> @@ -288,6 +286,18 @@ static int gmux_switchto(enum vga_switcheroo_client_id id) > >> return 0; > >> } > >> > >> +static int gmux_switch_ddc(enum vga_switcheroo_client_id id) > >> +{ > >> + pr_debug("Switching gmux DDC to %d\n", id); > >> + > >> + if (id == VGA_SWITCHEROO_IGD) > >> + gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 1); > >> + else > >> + gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 2); > >> + > >> + return 0; > >> +} > >> + > >> static int gmux_set_discrete_state(struct apple_gmux_data *gmux_data, > >> enum vga_switcheroo_state state) > >> { > >> @@ -588,6 +598,13 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) > >> gmux_data->gpe = -1; > >> } > >> > >> + /* > >> + * The gmux in pre-retina MacBook Pros can switch DDC separately > >> + * from the other pins of the outputs. It's distinguishable from > >> + * the gmux in retinas by being non-indexed. > >> + */ > >> + if (!gmux_data->indexed) > >> + gmux_handler.switch_ddc = gmux_switch_ddc; > >> if (vga_switcheroo_register_handler(&gmux_handler)) { > >> ret = -ENODEV; > >> goto err_register_handler; > >> -- > >> 1.8.5.2 (Apple Git-48) > >> > >> _______________________________________________ > >> dri-devel mailing list > >> dri-devel@lists.freedesktop.org > >> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c index 0dec3f5..78997b7 100644 --- a/drivers/platform/x86/apple-gmux.c +++ b/drivers/platform/x86/apple-gmux.c @@ -276,11 +276,9 @@ static const struct backlight_ops gmux_bl_ops = { static int gmux_switchto(enum vga_switcheroo_client_id id) { if (id == VGA_SWITCHEROO_IGD) { - gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 1); gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DISPLAY, 2); gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_EXTERNAL, 2); } else { - gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 2); gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DISPLAY, 3); gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_EXTERNAL, 3); } @@ -288,6 +286,18 @@ static int gmux_switchto(enum vga_switcheroo_client_id id) return 0; } +static int gmux_switch_ddc(enum vga_switcheroo_client_id id) +{ + pr_debug("Switching gmux DDC to %d\n", id); + + if (id == VGA_SWITCHEROO_IGD) + gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 1); + else + gmux_write8(apple_gmux_data, GMUX_PORT_SWITCH_DDC, 2); + + return 0; +} + static int gmux_set_discrete_state(struct apple_gmux_data *gmux_data, enum vga_switcheroo_state state) { @@ -588,6 +598,13 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) gmux_data->gpe = -1; } + /* + * The gmux in pre-retina MacBook Pros can switch DDC separately + * from the other pins of the outputs. It's distinguishable from + * the gmux in retinas by being non-indexed. + */ + if (!gmux_data->indexed) + gmux_handler.switch_ddc = gmux_switch_ddc; if (vga_switcheroo_register_handler(&gmux_handler)) { ret = -ENODEV; goto err_register_handler;