Commit db1740a0 authored by Jani Nikula's avatar Jani Nikula Committed by Daniel Vetter

drm/i915/lvds: Move the acpi_lid_notifier from drm_i915_private to the connector

Based on earlier work by Chris Wilson <chris@chris-wilson.co.uk>

CC: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent c7362c4d
...@@ -507,8 +507,6 @@ typedef struct drm_i915_private { ...@@ -507,8 +507,6 @@ typedef struct drm_i915_private {
} edp; } edp;
bool no_aux_handshake; bool no_aux_handshake;
struct notifier_block lid_notifier;
int crt_ddc_pin; int crt_ddc_pin;
struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */ struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */
int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
/* Private structure for the integrated LVDS support */ /* Private structure for the integrated LVDS support */
struct intel_lvds_connector { struct intel_lvds_connector {
struct intel_connector base; struct intel_connector base;
struct notifier_block lid_notifier;
}; };
struct intel_lvds_encoder { struct intel_lvds_encoder {
...@@ -505,10 +507,11 @@ static const struct dmi_system_id intel_no_modeset_on_lid[] = { ...@@ -505,10 +507,11 @@ static const struct dmi_system_id intel_no_modeset_on_lid[] = {
static int intel_lid_notify(struct notifier_block *nb, unsigned long val, static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
void *unused) void *unused)
{ {
struct drm_i915_private *dev_priv = struct intel_lvds_connector *lvds_connector =
container_of(nb, struct drm_i915_private, lid_notifier); container_of(nb, struct intel_lvds_connector, lid_notifier);
struct drm_device *dev = dev_priv->dev; struct drm_connector *connector = &lvds_connector->base.base;
struct drm_connector *connector = dev_priv->int_lvds_connector; struct drm_device *dev = connector->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
if (dev->switch_power_state != DRM_SWITCH_POWER_ON) if (dev->switch_power_state != DRM_SWITCH_POWER_ON)
return NOTIFY_OK; return NOTIFY_OK;
...@@ -517,9 +520,7 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val, ...@@ -517,9 +520,7 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
* check and update the status of LVDS connector after receiving * check and update the status of LVDS connector after receiving
* the LID nofication event. * the LID nofication event.
*/ */
if (connector) connector->status = connector->funcs->detect(connector, false);
connector->status = connector->funcs->detect(connector,
false);
/* Don't force modeset on machines where it causes a GPU lockup */ /* Don't force modeset on machines where it causes a GPU lockup */
if (dmi_check_system(intel_no_modeset_on_lid)) if (dmi_check_system(intel_no_modeset_on_lid))
...@@ -550,13 +551,14 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val, ...@@ -550,13 +551,14 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
*/ */
static void intel_lvds_destroy(struct drm_connector *connector) static void intel_lvds_destroy(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct intel_lvds_connector *lvds_connector =
struct drm_i915_private *dev_priv = dev->dev_private; to_lvds_connector(connector);
if (lvds_connector->lid_notifier.notifier_call)
acpi_lid_notifier_unregister(&lvds_connector->lid_notifier);
intel_panel_destroy_backlight(dev); intel_panel_destroy_backlight(connector->dev);
if (dev_priv->lid_notifier.notifier_call)
acpi_lid_notifier_unregister(&dev_priv->lid_notifier);
drm_sysfs_connector_remove(connector); drm_sysfs_connector_remove(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(connector); kfree(connector);
...@@ -1096,10 +1098,10 @@ bool intel_lvds_init(struct drm_device *dev) ...@@ -1096,10 +1098,10 @@ bool intel_lvds_init(struct drm_device *dev)
I915_WRITE(PP_CONTROL, I915_WRITE(PP_CONTROL,
I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS); I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS);
} }
dev_priv->lid_notifier.notifier_call = intel_lid_notify; lvds_connector->lid_notifier.notifier_call = intel_lid_notify;
if (acpi_lid_notifier_register(&dev_priv->lid_notifier)) { if (acpi_lid_notifier_register(&lvds_connector->lid_notifier)) {
DRM_DEBUG_KMS("lid notifier registration failed\n"); DRM_DEBUG_KMS("lid notifier registration failed\n");
dev_priv->lid_notifier.notifier_call = NULL; lvds_connector->lid_notifier.notifier_call = NULL;
} }
/* keep the LVDS connector */ /* keep the LVDS connector */
dev_priv->int_lvds_connector = connector; dev_priv->int_lvds_connector = connector;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment