Skip to content

Commit 61377bc

Browse files
vsyrjalagregkh
authored andcommitted
drm/i915: Nuke the LVDS lid notifier
commit 05c72e7 upstream. We broke the LVDS notifier resume thing in (presumably) commit e2c8b87 ("drm/i915: Use atomic helpers for suspend, v2.") as we no longer duplicate the current state in the LVDS notifier and thus we never resume it properly either. Instead of trying to fix it again let's just kill off the lid notifier entirely. None of the machines tested thus far have apparently needed it. Originally the lid notifier was added to work around cases where the VBIOS was clobbering some of the hardware state behind the driver's back, mostly on Thinkpads. We now have a few report of Thinkpads working just fine without the notifier. So maybe it was misdiagnosed originally, or something else has changed (ACPI video stuff perhaps?). If we do end up finding a machine where the VBIOS is still causing problems I would suggest that we first try setting various bits in the VBIOS scratch registers. There are several to choose from that may instruct the VBIOS to steer clear. With the notifier gone we'll also stop looking at the panel status in ->detect(). v2: Nuke enum modeset_restore (Rodrigo) Cc: stable@vger.kernel.org Cc: Wolfgang Draxinger <wdraxinger.maillist@draxit.de> Cc: Vito Caputo <vcaputo@pengaru.com> Cc: kitsunyan <kitsunyan@airmail.cc> Cc: Joonas Saarinen <jza@saunalahti.fi> Tested-by: Vito Caputo <vcaputo@pengaru.com> # Thinkapd X61s Tested-by: kitsunyan <kitsunyan@airmail.cc> # ThinkPad X200 Tested-by: Joonas Saarinen <jza@saunalahti.fi> # Fujitsu Siemens U9210 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105902 References: https://lists.freedesktop.org/archives/intel-gfx/2018-June/169315.html References: https://bugs.freedesktop.org/show_bug.cgi?id=21230 Fixes: e2c8b87 ("drm/i915: Use atomic helpers for suspend, v2.") Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180717174216.22252-1-ville.syrjala@linux.intel.com Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e896a2a commit 61377bc

3 files changed

Lines changed: 2 additions & 152 deletions

File tree

drivers/gpu/drm/i915/i915_drv.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,6 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
878878

879879
spin_lock_init(&dev_priv->mm.object_stat_lock);
880880
mutex_init(&dev_priv->sb_lock);
881-
mutex_init(&dev_priv->modeset_restore_lock);
882881
mutex_init(&dev_priv->av_mutex);
883882
mutex_init(&dev_priv->wm.wm_mutex);
884883
mutex_init(&dev_priv->pps_mutex);
@@ -1505,11 +1504,6 @@ static int i915_drm_suspend(struct drm_device *dev)
15051504
pci_power_t opregion_target_state;
15061505
int error;
15071506

1508-
/* ignore lid events during suspend */
1509-
mutex_lock(&dev_priv->modeset_restore_lock);
1510-
dev_priv->modeset_restore = MODESET_SUSPENDED;
1511-
mutex_unlock(&dev_priv->modeset_restore_lock);
1512-
15131507
disable_rpm_wakeref_asserts(dev_priv);
15141508

15151509
/* We do a lot of poking in a lot of registers, make sure they work
@@ -1718,10 +1712,6 @@ static int i915_drm_resume(struct drm_device *dev)
17181712

17191713
intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false);
17201714

1721-
mutex_lock(&dev_priv->modeset_restore_lock);
1722-
dev_priv->modeset_restore = MODESET_DONE;
1723-
mutex_unlock(&dev_priv->modeset_restore_lock);
1724-
17251715
intel_opregion_notify_adapter(dev_priv, PCI_D0);
17261716

17271717
intel_autoenable_gt_powersave(dev_priv);

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,12 +1614,6 @@ struct i915_gpu_error {
16141614
unsigned long test_irq_rings;
16151615
};
16161616

1617-
enum modeset_restore {
1618-
MODESET_ON_LID_OPEN,
1619-
MODESET_DONE,
1620-
MODESET_SUSPENDED,
1621-
};
1622-
16231617
#define DP_AUX_A 0x40
16241618
#define DP_AUX_B 0x10
16251619
#define DP_AUX_C 0x20
@@ -2296,8 +2290,6 @@ struct drm_i915_private {
22962290

22972291
unsigned long quirks;
22982292

2299-
enum modeset_restore modeset_restore;
2300-
struct mutex modeset_restore_lock;
23012293
struct drm_atomic_state *modeset_restore_state;
23022294
struct drm_modeset_acquire_ctx reset_ctx;
23032295

drivers/gpu/drm/i915/intel_lvds.c

Lines changed: 2 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
/* Private structure for the integrated LVDS support */
4545
struct intel_lvds_connector {
4646
struct intel_connector base;
47-
48-
struct notifier_block lid_notifier;
4947
};
5048

5149
struct intel_lvds_pps {
@@ -440,26 +438,9 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
440438
return true;
441439
}
442440

443-
/**
444-
* Detect the LVDS connection.
445-
*
446-
* Since LVDS doesn't have hotlug, we use the lid as a proxy. Open means
447-
* connected and closed means disconnected. We also send hotplug events as
448-
* needed, using lid status notification from the input layer.
449-
*/
450441
static enum drm_connector_status
451442
intel_lvds_detect(struct drm_connector *connector, bool force)
452443
{
453-
struct drm_i915_private *dev_priv = to_i915(connector->dev);
454-
enum drm_connector_status status;
455-
456-
DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
457-
connector->base.id, connector->name);
458-
459-
status = intel_panel_detect(dev_priv);
460-
if (status != connector_status_unknown)
461-
return status;
462-
463444
return connector_status_connected;
464445
}
465446

@@ -484,117 +465,6 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
484465
return 1;
485466
}
486467

487-
static int intel_no_modeset_on_lid_dmi_callback(const struct dmi_system_id *id)
488-
{
489-
DRM_INFO("Skipping forced modeset for %s\n", id->ident);
490-
return 1;
491-
}
492-
493-
/* The GPU hangs up on these systems if modeset is performed on LID open */
494-
static const struct dmi_system_id intel_no_modeset_on_lid[] = {
495-
{
496-
.callback = intel_no_modeset_on_lid_dmi_callback,
497-
.ident = "Toshiba Tecra A11",
498-
.matches = {
499-
DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
500-
DMI_MATCH(DMI_PRODUCT_NAME, "TECRA A11"),
501-
},
502-
},
503-
504-
{ } /* terminating entry */
505-
};
506-
507-
/*
508-
* Lid events. Note the use of 'modeset':
509-
* - we set it to MODESET_ON_LID_OPEN on lid close,
510-
* and set it to MODESET_DONE on open
511-
* - we use it as a "only once" bit (ie we ignore
512-
* duplicate events where it was already properly set)
513-
* - the suspend/resume paths will set it to
514-
* MODESET_SUSPENDED and ignore the lid open event,
515-
* because they restore the mode ("lid open").
516-
*/
517-
static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
518-
void *unused)
519-
{
520-
struct intel_lvds_connector *lvds_connector =
521-
container_of(nb, struct intel_lvds_connector, lid_notifier);
522-
struct drm_connector *connector = &lvds_connector->base.base;
523-
struct drm_device *dev = connector->dev;
524-
struct drm_i915_private *dev_priv = to_i915(dev);
525-
526-
if (dev->switch_power_state != DRM_SWITCH_POWER_ON)
527-
return NOTIFY_OK;
528-
529-
mutex_lock(&dev_priv->modeset_restore_lock);
530-
if (dev_priv->modeset_restore == MODESET_SUSPENDED)
531-
goto exit;
532-
/*
533-
* check and update the status of LVDS connector after receiving
534-
* the LID nofication event.
535-
*/
536-
connector->status = connector->funcs->detect(connector, false);
537-
538-
/* Don't force modeset on machines where it causes a GPU lockup */
539-
if (dmi_check_system(intel_no_modeset_on_lid))
540-
goto exit;
541-
if (!acpi_lid_open()) {
542-
/* do modeset on next lid open event */
543-
dev_priv->modeset_restore = MODESET_ON_LID_OPEN;
544-
goto exit;
545-
}
546-
547-
if (dev_priv->modeset_restore == MODESET_DONE)
548-
goto exit;
549-
550-
/*
551-
* Some old platform's BIOS love to wreak havoc while the lid is closed.
552-
* We try to detect this here and undo any damage. The split for PCH
553-
* platforms is rather conservative and a bit arbitrary expect that on
554-
* those platforms VGA disabling requires actual legacy VGA I/O access,
555-
* and as part of the cleanup in the hw state restore we also redisable
556-
* the vga plane.
557-
*/
558-
if (!HAS_PCH_SPLIT(dev_priv))
559-
intel_display_resume(dev);
560-
561-
dev_priv->modeset_restore = MODESET_DONE;
562-
563-
exit:
564-
mutex_unlock(&dev_priv->modeset_restore_lock);
565-
return NOTIFY_OK;
566-
}
567-
568-
static int
569-
intel_lvds_connector_register(struct drm_connector *connector)
570-
{
571-
struct intel_lvds_connector *lvds = to_lvds_connector(connector);
572-
int ret;
573-
574-
ret = intel_connector_register(connector);
575-
if (ret)
576-
return ret;
577-
578-
lvds->lid_notifier.notifier_call = intel_lid_notify;
579-
if (acpi_lid_notifier_register(&lvds->lid_notifier)) {
580-
DRM_DEBUG_KMS("lid notifier registration failed\n");
581-
lvds->lid_notifier.notifier_call = NULL;
582-
}
583-
584-
return 0;
585-
}
586-
587-
static void
588-
intel_lvds_connector_unregister(struct drm_connector *connector)
589-
{
590-
struct intel_lvds_connector *lvds = to_lvds_connector(connector);
591-
592-
if (lvds->lid_notifier.notifier_call)
593-
acpi_lid_notifier_unregister(&lvds->lid_notifier);
594-
595-
intel_connector_unregister(connector);
596-
}
597-
598468
/**
599469
* intel_lvds_destroy - unregister and free LVDS structures
600470
* @connector: connector to free
@@ -627,8 +497,8 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = {
627497
.fill_modes = drm_helper_probe_single_connector_modes,
628498
.atomic_get_property = intel_digital_connector_atomic_get_property,
629499
.atomic_set_property = intel_digital_connector_atomic_set_property,
630-
.late_register = intel_lvds_connector_register,
631-
.early_unregister = intel_lvds_connector_unregister,
500+
.late_register = intel_connector_register,
501+
.early_unregister = intel_connector_unregister,
632502
.destroy = intel_lvds_destroy,
633503
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
634504
.atomic_duplicate_state = intel_digital_connector_duplicate_state,
@@ -1091,8 +961,6 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
1091961
* 2) check for VBT data
1092962
* 3) check to see if LVDS is already on
1093963
* if none of the above, no panel
1094-
* 4) make sure lid is open
1095-
* if closed, act like it's not there for now
1096964
*/
1097965

1098966
/*

0 commit comments

Comments
 (0)