Commit 6aff4c26 authored by Patrik Jakobsson's avatar Patrik Jakobsson Committed by Thomas Zimmermann

drm/gma500: Remove lid code

Due to a change in the order of initialization, the lid timer got
started before proper setup was made. This resulted in a crash during
boot.

The lid switch is handled by gma500 through a timer that periodically
polls the opregion for changes. These types of ACPI events shouldn't be
handled by the graphics driver so let's get rid of the lid code.  This
fixes the crash during boot.
Reported-by: default avatarEnrico Bartky <enrico.bartky@gmail.com>
Fixes: 8f1aaccb ("drm/gma500: Implement client-based fbdev emulation")
Tested-by: default avatarEnrico Bartky <enrico.bartky@gmail.com>
Signed-off-by: default avatarPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20240415112731.31841-1-patrik.r.jakobsson@gmail.com
parent 941c0bdb
...@@ -34,7 +34,6 @@ gma500_gfx-y += \ ...@@ -34,7 +34,6 @@ gma500_gfx-y += \
psb_intel_lvds.o \ psb_intel_lvds.o \
psb_intel_modes.o \ psb_intel_modes.o \
psb_intel_sdvo.o \ psb_intel_sdvo.o \
psb_lid.o \
psb_irq.o psb_irq.o
gma500_gfx-$(CONFIG_ACPI) += opregion.o gma500_gfx-$(CONFIG_ACPI) += opregion.o
......
...@@ -73,8 +73,7 @@ static int psb_backlight_setup(struct drm_device *dev) ...@@ -73,8 +73,7 @@ static int psb_backlight_setup(struct drm_device *dev)
} }
psb_intel_lvds_set_brightness(dev, PSB_MAX_BRIGHTNESS); psb_intel_lvds_set_brightness(dev, PSB_MAX_BRIGHTNESS);
/* This must occur after the backlight is properly initialised */
psb_lid_timer_init(dev_priv);
return 0; return 0;
} }
...@@ -259,8 +258,6 @@ static int psb_chip_setup(struct drm_device *dev) ...@@ -259,8 +258,6 @@ static int psb_chip_setup(struct drm_device *dev)
static void psb_chip_teardown(struct drm_device *dev) static void psb_chip_teardown(struct drm_device *dev)
{ {
struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
psb_lid_timer_takedown(dev_priv);
gma_intel_teardown_gmbus(dev); gma_intel_teardown_gmbus(dev);
} }
......
...@@ -162,7 +162,6 @@ ...@@ -162,7 +162,6 @@
#define PSB_NUM_VBLANKS 2 #define PSB_NUM_VBLANKS 2
#define PSB_WATCHDOG_DELAY (HZ * 2) #define PSB_WATCHDOG_DELAY (HZ * 2)
#define PSB_LID_DELAY (HZ / 10)
#define PSB_MAX_BRIGHTNESS 100 #define PSB_MAX_BRIGHTNESS 100
...@@ -491,11 +490,7 @@ struct drm_psb_private { ...@@ -491,11 +490,7 @@ struct drm_psb_private {
/* Hotplug handling */ /* Hotplug handling */
struct work_struct hotplug_work; struct work_struct hotplug_work;
/* LID-Switch */
spinlock_t lid_lock;
struct timer_list lid_timer;
struct psb_intel_opregion opregion; struct psb_intel_opregion opregion;
u32 lid_last_state;
/* Watchdog */ /* Watchdog */
uint32_t apm_reg; uint32_t apm_reg;
...@@ -591,10 +586,6 @@ struct psb_ops { ...@@ -591,10 +586,6 @@ struct psb_ops {
int i2c_bus; /* I2C bus identifier for Moorestown */ int i2c_bus; /* I2C bus identifier for Moorestown */
}; };
/* psb_lid.c */
extern void psb_lid_timer_init(struct drm_psb_private *dev_priv);
extern void psb_lid_timer_takedown(struct drm_psb_private *dev_priv);
/* modesetting */ /* modesetting */
extern void psb_modeset_init(struct drm_device *dev); extern void psb_modeset_init(struct drm_device *dev);
extern void psb_modeset_cleanup(struct drm_device *dev); extern void psb_modeset_cleanup(struct drm_device *dev);
......
// SPDX-License-Identifier: GPL-2.0-only
/**************************************************************************
* Copyright (c) 2007, Intel Corporation.
*
* Authors: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
**************************************************************************/
#include <linux/spinlock.h>
#include "psb_drv.h"
#include "psb_intel_reg.h"
#include "psb_reg.h"
static void psb_lid_timer_func(struct timer_list *t)
{
struct drm_psb_private *dev_priv = from_timer(dev_priv, t, lid_timer);
struct drm_device *dev = (struct drm_device *)&dev_priv->dev;
struct timer_list *lid_timer = &dev_priv->lid_timer;
unsigned long irq_flags;
u32 __iomem *lid_state = dev_priv->opregion.lid_state;
u32 pp_status;
if (readl(lid_state) == dev_priv->lid_last_state)
goto lid_timer_schedule;
if ((readl(lid_state)) & 0x01) {
/*lid state is open*/
REG_WRITE(PP_CONTROL, REG_READ(PP_CONTROL) | POWER_TARGET_ON);
do {
pp_status = REG_READ(PP_STATUS);
} while ((pp_status & PP_ON) == 0 &&
(pp_status & PP_SEQUENCE_MASK) != 0);
if (REG_READ(PP_STATUS) & PP_ON) {
/*FIXME: should be backlight level before*/
psb_intel_lvds_set_brightness(dev, 100);
} else {
DRM_DEBUG("LVDS panel never powered up");
return;
}
} else {
psb_intel_lvds_set_brightness(dev, 0);
REG_WRITE(PP_CONTROL, REG_READ(PP_CONTROL) & ~POWER_TARGET_ON);
do {
pp_status = REG_READ(PP_STATUS);
} while ((pp_status & PP_ON) == 0);
}
dev_priv->lid_last_state = readl(lid_state);
lid_timer_schedule:
spin_lock_irqsave(&dev_priv->lid_lock, irq_flags);
if (!timer_pending(lid_timer)) {
lid_timer->expires = jiffies + PSB_LID_DELAY;
add_timer(lid_timer);
}
spin_unlock_irqrestore(&dev_priv->lid_lock, irq_flags);
}
void psb_lid_timer_init(struct drm_psb_private *dev_priv)
{
struct timer_list *lid_timer = &dev_priv->lid_timer;
unsigned long irq_flags;
spin_lock_init(&dev_priv->lid_lock);
spin_lock_irqsave(&dev_priv->lid_lock, irq_flags);
timer_setup(lid_timer, psb_lid_timer_func, 0);
lid_timer->expires = jiffies + PSB_LID_DELAY;
add_timer(lid_timer);
spin_unlock_irqrestore(&dev_priv->lid_lock, irq_flags);
}
void psb_lid_timer_takedown(struct drm_psb_private *dev_priv)
{
del_timer_sync(&dev_priv->lid_timer);
}
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