<feed xmlns='http://www.w3.org/2005/Atom'>
<title>talos-obmc-linux/include/linux/vga_switcheroo.h, branch v4.6</title>
<subtitle>Talos™ II Linux sources for OpenBMC</subtitle>
<id>https://git.raptorcs.com/git/talos-obmc-linux/atom?h=v4.6</id>
<link rel='self' href='https://git.raptorcs.com/git/talos-obmc-linux/atom?h=v4.6'/>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-obmc-linux/'/>
<updated>2016-02-09T10:21:07+00:00</updated>
<entry>
<title>vga_switcheroo: Add support for switching only the DDC</title>
<updated>2016-02-09T10:21:07+00:00</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2016-01-11T19:09:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-obmc-linux/commit/?id=e4cb81d7e49c806fa557cf0ff4f3f40bd7a9cb7c'/>
<id>urn:sha1:e4cb81d7e49c806fa557cf0ff4f3f40bd7a9cb7c</id>
<content type='text'>
Originally by Seth Forshee &lt;seth.forshee@canonical.com&gt;, 2012-10-04:
    During graphics driver initialization it's useful to be able to mux
    only the DDC to the inactive client in order to read the EDID. Add
    a switch_ddc callback to allow capable handlers to provide this
    functionality, and add vga_switcheroo_switch_ddc() to allow DRM
    to mux only the DDC.

Modified by Dave Airlie &lt;airlied@gmail.com&gt;, 2012-12-22:
    I can't figure out why I didn't like this, but I rewrote this [...]
    to lock/unlock the ddc lines [...]. I think I'd prefer something
    like that otherwise the interface got really ugly.

Modified by Lukas Wunner &lt;lukas@wunner.de&gt;, 2015-04 - 2015-10:
    Change semantics of -&gt;switch_ddc handler callback to return previous
    DDC owner. Original version tried to determine previous DDC owner
    with find_active_client() but this fails if the inactive client
    registers before the active client.

    Don't lock vgasr_mutex in _lock_ddc() / _unlock_ddc(), it can cause
    deadlocks because (a) during switch (with vgasr_mutex already held),
    GPU is woken and probes its outputs, tries to re-acquire vgasr_mutex
    to lock DDC lines; (b) Likewise during switch, GPU is suspended and
    calls cancel_delayed_work_sync() to stop output polling, if poll
    task is running at this moment we may wait forever for it to finish.

    Instead, lock mux_hw_lock when unregistering the handler because
    the only reason why we'd want to lock vgasr_mutex in _lock_ddc() /
    _unlock_ddc() is to block the handler from disappearing while DDC
    lines are switched.

    Also acquire mux_hw_lock in stage2 to avoid race condition where
    reading the EDID and switching happens simultaneously. Likewise on
    MIGD / MDIS commands and on runtime suspend.

    v2.1: Overhaul locking, squash commits (Daniel Vetter)

    v2.2: Readability improvements (Thierry Reding)

    v2.3: Overhaul locking once more

    v2.4: Retain semantics of -&gt;switchto handler callback to switch all
          pins, including DDC (Daniel Vetter)

    v5:   Rename ddc_lock to mux_hw_lock: Since we acquire this both
          when calling -&gt;switch_ddc and -&gt;switchto, it protects not just
          access to the DDC lines but to the mux in general. This is in
          line with the DRM convention to use low-level locks to avoid
          concurrent hw access (e.g. i2c, dp_aux) which are often called
          hw_lock (Daniel Vetter)

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=88861
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61115
Tested-by: Lukas Wunner &lt;lukas@wunner.de&gt;
    [MBP  9,1 2012  intel IVB + nvidia GK107  pre-retina  15"]
Cc: Seth Forshee &lt;seth.forshee@canonical.com&gt;
Cc: Dave Airlie &lt;airlied@gmail.com&gt;
Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: http://patchwork.freedesktop.org/patch/msgid/e81ae9722b84c5ed591805fee3ea6dbf5dc6c4b3.1452525860.git.lukas@wunner.de
</content>
</entry>
<entry>
<title>vga_switcheroo: Add handler flags infrastructure</title>
<updated>2016-02-09T10:21:07+00:00</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2016-01-11T19:09:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-obmc-linux/commit/?id=156d7d4120e1c860fde667fc30eeae84bc3e7a25'/>
<id>urn:sha1:156d7d4120e1c860fde667fc30eeae84bc3e7a25</id>
<content type='text'>
Allow handlers to declare their capabilities and allow clients to
obtain that information. So far we have these use cases:

* If the handler is able to switch DDC separately, clients need to
  probe EDID with drm_get_edid_switcheroo(). We should allow them
  to detect a capable handler to ensure this function only gets
  called when needed.

* Likewise if the handler is unable to switch AUX separately, the active
  client needs to communicate link training parameters to the inactive
  client, which may then skip the AUX handshake and set up its output
  with these pre-calibrated values (DisplayPort specification v1.1a,
  section 2.5.3.3). Clients need a way to recognize such a situation.

The flags for the radeon_atpx_handler and amdgpu_atpx_handler are
initially set to 0, this can later on be amended with
  handler_flags |= VGA_SWITCHEROO_CAN_SWITCH_DDC;
when a -&gt;switch_ddc callback is added.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=88861
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61115
Tested-by: Lukas Wunner &lt;lukas@wunner.de&gt;
    [MBP  9,1 2012  intel IVB + nvidia GK107  pre-retina  15"]
Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
Reviewed-by: Darren Hart &lt;dvhart@linux.intel.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: http://patchwork.freedesktop.org/patch/msgid/2b0d93ed6e511ca09e95e45e0b35627f330fabce.1452525860.git.lukas@wunner.de
</content>
</entry>
<entry>
<title>vga_switcheroo: Drop client power state VGA_SWITCHEROO_INIT</title>
<updated>2015-11-05T01:07:36+00:00</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2015-09-08T12:17:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-obmc-linux/commit/?id=e02328f47bd75fde9decf9657ec7d769b370f857'/>
<id>urn:sha1:e02328f47bd75fde9decf9657ec7d769b370f857</id>
<content type='text'>
hda_intel.c:azx_probe() defers initialization of an audio controller
on the discrete GPU if the GPU is powered off. The power state of the
GPU is determined by calling vga_switcheroo_get_client_state().

vga_switcheroo_get_client_state() returns VGA_SWITCHEROO_INIT if
vga_switcheroo is not enabled, i.e. if no second GPU or no handler
has registered.

This can go wrong in the following scenario:
- Driver for the integrated GPU is not loaded.
- Driver for the discrete GPU registers with vga_switcheroo, uses driver
  power control to power down the GPU, handler cuts power to the GPU.
- Driver for the audio controller gets loaded after the GPU was powered
  down, calls vga_switcheroo_get_client_state() which returns
  VGA_SWITCHEROO_INIT instead of VGA_SWITCHEROO_OFF.
- Consequence: azx_probe() tries to initialize the audio controller even
  though the GPU is powered down.

The power state VGA_SWITCHEROO_INIT was introduced by c8e9cf7bb240
("vga_switcheroo: Add a helper function to get the client state").
It is not apparent what its benefit might be. The idea seems to
be to initialize the audio controller even if the power state is
VGA_SWITCHEROO_OFF (were vga_switcheroo enabled), but as shown
above this can fail.

Drop VGA_SWITCHEROO_INIT to solve this.

Acked-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
Signed-off-by: Dave Airlie &lt;airlied@redhat.com&gt;
</content>
</entry>
<entry>
<title>vga_switcheroo: Constify vga_switcheroo_handler</title>
<updated>2015-10-20T18:19:29+00:00</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2015-10-18T11:05:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-obmc-linux/commit/?id=5d170139eb10ae12e1bd076245c42b35453d8324'/>
<id>urn:sha1:5d170139eb10ae12e1bd076245c42b35453d8324</id>
<content type='text'>
vga_switcheroo_client_ops has always been declared const since its
introduction with 26ec685ff9d9 ("vga_switcheroo: Introduce struct
vga_switcheroo_client_ops").

Do so for vga_switcheroo_handler as well.

 drivers/gpu/drm/amd/amdgpu/amdgpu.ko:
   6 .rodata       00009888
- 19 .data         00001f00
+ 19 .data         00001ee0
 drivers/gpu/drm/nouveau/nouveau.ko:
   6 .rodata       000460b8
  17 .data         00018fe0
 drivers/gpu/drm/radeon/radeon.ko:
-  7 .rodata       00030944
+  7 .rodata       00030964
- 21 .data         0000d6a0
+ 21 .data         0000d678
 drivers/platform/x86/apple-gmux.ko:
-  7 .rodata       00000140
+  7 .rodata       00000160
- 11 .data         000000e0
+ 11 .data         000000b8

Cc: Ben Skeggs &lt;bskeggs@redhat.com&gt;
Cc: Darren Hart &lt;dvhart@linux.intel.com&gt;
Cc: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;.
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>vga_switcheroo: Use enum vga_switcheroo_client_id instead of int</title>
<updated>2015-10-16T13:50:56+00:00</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2015-08-28T10:54:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-obmc-linux/commit/?id=fa3e967fffaf267ccab7959429722da34e45ad77'/>
<id>urn:sha1:fa3e967fffaf267ccab7959429722da34e45ad77</id>
<content type='text'>
Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>vga_switcheroo: Use VGA_SWITCHEROO_UNKNOWN_ID instead of -1</title>
<updated>2015-10-16T13:50:56+00:00</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2015-08-28T11:30:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-obmc-linux/commit/?id=21c5ba8c1ee02f204e556c26703cebaf9c4019e0'/>
<id>urn:sha1:21c5ba8c1ee02f204e556c26703cebaf9c4019e0</id>
<content type='text'>
Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>vga_switcheroo: Use enum vga_switcheroo_state instead of int</title>
<updated>2015-10-16T13:50:55+00:00</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2015-08-28T09:56:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-obmc-linux/commit/?id=203d027de4d7068c607b60d4310a1599dec8839f'/>
<id>urn:sha1:203d027de4d7068c607b60d4310a1599dec8839f</id>
<content type='text'>
Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
Reviewed-by: Jani Nikula &lt;jani.nikula@intel.com&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>vga_switcheroo: Set active attribute to false for audio clients</title>
<updated>2015-09-24T18:14:25+00:00</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2015-08-27T14:43:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-obmc-linux/commit/?id=21b45676b7c4b79334d8fe3c5a112af0517b66e9'/>
<id>urn:sha1:21b45676b7c4b79334d8fe3c5a112af0517b66e9</id>
<content type='text'>
The active attribute in struct vga_switcheroo_client denotes whether
the outputs are currently switched to this client. The attribute is
only meaningful for vga clients. It is never used for audio clients.

The function vga_switcheroo_register_audio_client() misuses this
attribute to store whether the audio device is fully initialized.
Most likely there was a misunderstanding about the meaning of
"active" when this was added.

Comment from Takashi's review:

"Not really.  The full initialization of audio was meant that the audio
is active indeed.  Admittedly, though, the active flag for each audio
client doesn't play any role because the audio always follows the gfx
state changes, and the value passed there doesn't reflect the actual
state due to the later change.  So, I agree with the removal of the
flag itself -- or let the audio active flag following the
corresponding gfx flag.  The latter will make the proc output more
consistent while the former is certainly more reduction of code."

Set the active attribute to false for audio clients. Remove the
active parameter from vga_switcheroo_register_audio_client() and
its sole caller, hda_intel.c:register_vga_switcheroo().

vga_switcheroo_register_audio_client() was introduced by 3e9e63dbd374
("vga_switcheroo: Add the support for audio clients"). Its use in
hda_intel.c was introduced by a82d51ed24bb ("ALSA: hda - Support
VGA-switcheroo").

v1.1: The changes above imply that in find_active_client() the call
to client_is_vga() is now superfluous. Drop it.

Cc: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
[danvet: Add Takashi's clarification to the commit message.]
Reviewed-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>vga_switcheroo: Document _ALL_ the things!</title>
<updated>2015-09-22T08:37:26+00:00</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2015-08-23T13:18:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-obmc-linux/commit/?id=a645654b817feba05e5156345325d19fc85ebc9f'/>
<id>urn:sha1:a645654b817feba05e5156345325d19fc85ebc9f</id>
<content type='text'>
This adds an "Overview" DOC section plus two DOC sections for the modes
of use ("Manual switching and manual power control" and "Driver power
control").

Also included is kernel-doc for all public functions, structs and enums.

Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
</content>
</entry>
<entry>
<title>vgaswitcheroo: add vga_switcheroo_fini_domain_pm_ops</title>
<updated>2014-09-18T23:21:20+00:00</updated>
<author>
<name>Alex Deucher</name>
<email>alexander.deucher@amd.com</email>
</author>
<published>2014-09-12T21:51:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-obmc-linux/commit/?id=766a53d059d1500c9755c8af017bd411bd8f1b20'/>
<id>urn:sha1:766a53d059d1500c9755c8af017bd411bd8f1b20</id>
<content type='text'>
Drivers should call this on unload to unregister pmops.

Bug:
https://bugzilla.kernel.org/show_bug.cgi?id=84431

Reviewed-by: Ben Skeggs &lt;bskeggs@redhat.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Pali Rohár &lt;pali.rohar@gmail.com&gt;
Cc: Ben Skeggs &lt;bskeggs@redhat.com&gt;
</content>
</entry>
</feed>
