From: "Michel Dänzer" <michel@daenzer.net>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH] drm/radeon: Report panel connector status as unknown when lid is closed
Date: Wed, 8 Jul 2015 17:24:57 +0900 [thread overview]
Message-ID: <1436343897-3990-1-git-send-email-michel@daenzer.net> (raw)
From: Michel Dänzer <michel.daenzer@amd.com>
This makes fbcon and desktop environments such as GNOME automatically
not use the panel when the lid is closed.
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
drivers/gpu/drm/radeon/radeon_connectors.c | 82 ++++++++++++++++--------------
1 file changed, 44 insertions(+), 38 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index cebb65e..2484438 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -23,6 +23,7 @@
* Authors: Dave Airlie
* Alex Deucher
*/
+#include <acpi/button.h>
#include <drm/drmP.h>
#include <drm/drm_edid.h>
#include <drm/drm_crtc_helper.h>
@@ -890,25 +891,27 @@ radeon_lvds_detect(struct drm_connector *connector, bool force)
if (r < 0)
return connector_status_disconnected;
- if (encoder) {
- struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
- struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
+ if (acpi_lid_open()) {
+ if (encoder) {
+ struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
+ struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
- /* check if panel is valid */
- if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240)
- ret = connector_status_connected;
- /* don't fetch the edid from the vbios if ddc fails and runpm is
- * enabled so we report disconnected.
- */
- if ((rdev->flags & RADEON_IS_PX) && (radeon_runtime_pm != 0))
- ret = connector_status_disconnected;
- }
+ /* check if panel is valid */
+ if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240)
+ ret = connector_status_connected;
+ /* don't fetch the edid from the vbios if ddc fails and runpm is
+ * enabled so we report disconnected.
+ */
+ if ((rdev->flags & RADEON_IS_PX) && (radeon_runtime_pm != 0))
+ ret = connector_status_disconnected;
+ }
- /* check for edid as well */
- radeon_connector_get_edid(connector);
- if (radeon_connector->edid)
- ret = connector_status_connected;
- /* check acpi lid status ??? */
+ /* check for edid as well */
+ radeon_connector_get_edid(connector);
+ if (radeon_connector->edid)
+ ret = connector_status_connected;
+ } else
+ ret = connector_status_unknown;
radeon_connector_update_scratch_regs(connector, ret);
pm_runtime_mark_last_busy(connector->dev->dev);
@@ -1647,29 +1650,32 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
if ((connector->connector_type == DRM_MODE_CONNECTOR_eDP) ||
(connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) {
- if (encoder) {
- struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
- struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
+ if (acpi_lid_open()) {
+ if (encoder) {
+ struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
+ struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
- /* check if panel is valid */
- if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240)
+ /* check if panel is valid */
+ if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240)
+ ret = connector_status_connected;
+ /* don't fetch the edid from the vbios if ddc fails and runpm is
+ * enabled so we report disconnected.
+ */
+ if ((rdev->flags & RADEON_IS_PX) && (radeon_runtime_pm != 0))
+ ret = connector_status_disconnected;
+ }
+ /* eDP is always DP */
+ radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT;
+ if (!radeon_dig_connector->edp_on)
+ atombios_set_edp_panel_power(connector,
+ ATOM_TRANSMITTER_ACTION_POWER_ON);
+ if (radeon_dp_getdpcd(radeon_connector))
ret = connector_status_connected;
- /* don't fetch the edid from the vbios if ddc fails and runpm is
- * enabled so we report disconnected.
- */
- if ((rdev->flags & RADEON_IS_PX) && (radeon_runtime_pm != 0))
- ret = connector_status_disconnected;
- }
- /* eDP is always DP */
- radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT;
- if (!radeon_dig_connector->edp_on)
- atombios_set_edp_panel_power(connector,
- ATOM_TRANSMITTER_ACTION_POWER_ON);
- if (radeon_dp_getdpcd(radeon_connector))
- ret = connector_status_connected;
- if (!radeon_dig_connector->edp_on)
- atombios_set_edp_panel_power(connector,
- ATOM_TRANSMITTER_ACTION_POWER_OFF);
+ if (!radeon_dig_connector->edp_on)
+ atombios_set_edp_panel_power(connector,
+ ATOM_TRANSMITTER_ACTION_POWER_OFF);
+ } else
+ ret = connector_status_unknown;
} else if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) !=
ENCODER_OBJECT_ID_NONE) {
/* DP bridges are always DP */
--
2.1.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2015-07-08 8:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 8:24 Michel Dänzer [this message]
2015-07-08 16:03 ` [PATCH] drm/radeon: Report panel connector status as unknown when lid is closed Alex Deucher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1436343897-3990-1-git-send-email-michel@daenzer.net \
--to=michel@daenzer.net \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.