drm/radeon: Report panel connector status as unknown when lid is closed
Subsystems (2)
PATCH 1/1 drm/radeon: Report panel connector status as unknown when lid is closed
From: Michel Dänzer <[email protected]>
This makes fbcon and desktop environments such as GNOME automatically not use the panel when the lid is closed.
--- drivers/gpu/drm/radeon/radeon_connectors.c | 82 ++++++++++++++++-------------- 1 file changed, 44 insertions(+), 38 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +44 -38
@@ -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 */
Signature · 6 lines
2.1.4 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
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 <[email protected]>
I've never really liked this approach. The panel is still attached then the lid is closed so it should still be reporting as attached. Desktop environments look at the lid status anyway, it seems like they should just use that rather than requiring the drivers jump through hoops to tell them something they already know.
Alex
Quoted 118 lines
--- drivers/gpu/drm/radeon/radeon_connectors.c | 82 ++++++++++++++++-------------- 1 file changed, 44 insertions(+), 38 deletions(-)drivers/gpu/drm/radeon/radeon_connectors.c +44
-39@@ -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
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel