<div dir="ltr">Hi,<br><br>sorry for the delay. This patch fixes the crash during boot! (tested against linux 6.9-rc3)<br><br>Greetings<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Mo., 15. Apr. 2024 um 13:57 Uhr schrieb Patrik Jakobsson <<a href="mailto:patrik.r.jakobsson@gmail.com">patrik.r.jakobsson@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Apr 15, 2024 at 1:45 PM Thomas Zimmermann <<a href="mailto:tzimmermann@suse.de" target="_blank">tzimmermann@suse.de</a>> wrote:<br>
><br>
> Hi<br>
><br>
> Am 15.04.24 um 13:27 schrieb Patrik Jakobsson:<br>
> > Due to a change in the order of initialization, the lid timer got<br>
> > started before proper setup was made. This resulted in a crash during<br>
> > boot.<br>
> ><br>
> > The lid switch is handled by gma500 through a timer that periodically<br>
> > polls the opregion for changes. These types of ACPI events shouldn't be<br>
> > handled by the graphics driver so let's get rid of the lid code. This<br>
> > fixes the crash during boot.<br>
> ><br>
> > Fixes: 8f1aaccb04b7 ("drm/gma500: Implement client-based fbdev emulation")<br>
> > Cc: Enrico Bartky <<a href="mailto:enrico.bartky@gmail.com" target="_blank">enrico.bartky@gmail.com</a>><br>
><br>
> The patch deserves a Reported-by: from Enrico.<br>
<br>
Enrico, can you test this patch to make sure it works for you as well?<br>
<br>
Thanks<br>
Patrik<br>
<br>
><br>
> With this fixed:<br>
><br>
> Reviewed-by: Thomas Zimmermann <<a href="mailto:tzimmermann@suse.de" target="_blank">tzimmermann@suse.de</a>><br>
><br>
> Best regards<br>
> Thomas<br>
><br>
> > Cc: Thomas Zimmermann <<a href="mailto:tzimmermann@suse.de" target="_blank">tzimmermann@suse.de</a>><br>
> > Signed-off-by: Patrik Jakobsson <<a href="mailto:patrik.r.jakobsson@gmail.com" target="_blank">patrik.r.jakobsson@gmail.com</a>><br>
> > ---<br>
> > drivers/gpu/drm/gma500/Makefile | 1 -<br>
> > drivers/gpu/drm/gma500/psb_device.c | 5 +-<br>
> > drivers/gpu/drm/gma500/psb_drv.h | 9 ----<br>
> > drivers/gpu/drm/gma500/psb_lid.c | 80 -----------------------------<br>
> > 4 files changed, 1 insertion(+), 94 deletions(-)<br>
> > delete mode 100644 drivers/gpu/drm/gma500/psb_lid.c<br>
> ><br>
> > diff --git a/drivers/gpu/drm/gma500/Makefile b/drivers/gpu/drm/gma500/Makefile<br>
> > index 4f302cd5e1a6..58fed80c7392 100644<br>
> > --- a/drivers/gpu/drm/gma500/Makefile<br>
> > +++ b/drivers/gpu/drm/gma500/Makefile<br>
> > @@ -34,7 +34,6 @@ gma500_gfx-y += \<br>
> > psb_intel_lvds.o \<br>
> > psb_intel_modes.o \<br>
> > psb_intel_sdvo.o \<br>
> > - psb_lid.o \<br>
> > psb_irq.o<br>
> ><br>
> > gma500_gfx-$(CONFIG_ACPI) += opregion.o<br>
> > diff --git a/drivers/gpu/drm/gma500/psb_device.c b/drivers/gpu/drm/gma500/psb_device.c<br>
> > index dcfcd7b89d4a..6dece8f0e380 100644<br>
> > --- a/drivers/gpu/drm/gma500/psb_device.c<br>
> > +++ b/drivers/gpu/drm/gma500/psb_device.c<br>
> > @@ -73,8 +73,7 @@ static int psb_backlight_setup(struct drm_device *dev)<br>
> > }<br>
> ><br>
> > psb_intel_lvds_set_brightness(dev, PSB_MAX_BRIGHTNESS);<br>
> > - /* This must occur after the backlight is properly initialised */<br>
> > - psb_lid_timer_init(dev_priv);<br>
> > +<br>
> > return 0;<br>
> > }<br>
> ><br>
> > @@ -259,8 +258,6 @@ static int psb_chip_setup(struct drm_device *dev)<br>
> ><br>
> > static void psb_chip_teardown(struct drm_device *dev)<br>
> > {<br>
> > - struct drm_psb_private *dev_priv = to_drm_psb_private(dev);<br>
> > - psb_lid_timer_takedown(dev_priv);<br>
> > gma_intel_teardown_gmbus(dev);<br>
> > }<br>
> ><br>
> > diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h<br>
> > index c5edfa4aa4cc..83c17689c454 100644<br>
> > --- a/drivers/gpu/drm/gma500/psb_drv.h<br>
> > +++ b/drivers/gpu/drm/gma500/psb_drv.h<br>
> > @@ -162,7 +162,6 @@<br>
> > #define PSB_NUM_VBLANKS 2<br>
> ><br>
> > #define PSB_WATCHDOG_DELAY (HZ * 2)<br>
> > -#define PSB_LID_DELAY (HZ / 10)<br>
> ><br>
> > #define PSB_MAX_BRIGHTNESS 100<br>
> ><br>
> > @@ -491,11 +490,7 @@ struct drm_psb_private {<br>
> > /* Hotplug handling */<br>
> > struct work_struct hotplug_work;<br>
> ><br>
> > - /* LID-Switch */<br>
> > - spinlock_t lid_lock;<br>
> > - struct timer_list lid_timer;<br>
> > struct psb_intel_opregion opregion;<br>
> > - u32 lid_last_state;<br>
> ><br>
> > /* Watchdog */<br>
> > uint32_t apm_reg;<br>
> > @@ -591,10 +586,6 @@ struct psb_ops {<br>
> > int i2c_bus; /* I2C bus identifier for Moorestown */<br>
> > };<br>
> ><br>
> > -/* psb_lid.c */<br>
> > -extern void psb_lid_timer_init(struct drm_psb_private *dev_priv);<br>
> > -extern void psb_lid_timer_takedown(struct drm_psb_private *dev_priv);<br>
> > -<br>
> > /* modesetting */<br>
> > extern void psb_modeset_init(struct drm_device *dev);<br>
> > extern void psb_modeset_cleanup(struct drm_device *dev);<br>
> > diff --git a/drivers/gpu/drm/gma500/psb_lid.c b/drivers/gpu/drm/gma500/psb_lid.c<br>
> > deleted file mode 100644<br>
> > index 58a7fe392636..000000000000<br>
> > --- a/drivers/gpu/drm/gma500/psb_lid.c<br>
> > +++ /dev/null<br>
> > @@ -1,80 +0,0 @@<br>
> > -// SPDX-License-Identifier: GPL-2.0-only<br>
> > -/**************************************************************************<br>
> > - * Copyright (c) 2007, Intel Corporation.<br>
> > - *<br>
> > - * Authors: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com><br>
> > - **************************************************************************/<br>
> > -<br>
> > -#include <linux/spinlock.h><br>
> > -<br>
> > -#include "psb_drv.h"<br>
> > -#include "psb_intel_reg.h"<br>
> > -#include "psb_reg.h"<br>
> > -<br>
> > -static void psb_lid_timer_func(struct timer_list *t)<br>
> > -{<br>
> > - struct drm_psb_private *dev_priv = from_timer(dev_priv, t, lid_timer);<br>
> > - struct drm_device *dev = (struct drm_device *)&dev_priv->dev;<br>
> > - struct timer_list *lid_timer = &dev_priv->lid_timer;<br>
> > - unsigned long irq_flags;<br>
> > - u32 __iomem *lid_state = dev_priv->opregion.lid_state;<br>
> > - u32 pp_status;<br>
> > -<br>
> > - if (readl(lid_state) == dev_priv->lid_last_state)<br>
> > - goto lid_timer_schedule;<br>
> > -<br>
> > - if ((readl(lid_state)) & 0x01) {<br>
> > - /*lid state is open*/<br>
> > - REG_WRITE(PP_CONTROL, REG_READ(PP_CONTROL) | POWER_TARGET_ON);<br>
> > - do {<br>
> > - pp_status = REG_READ(PP_STATUS);<br>
> > - } while ((pp_status & PP_ON) == 0 &&<br>
> > - (pp_status & PP_SEQUENCE_MASK) != 0);<br>
> > -<br>
> > - if (REG_READ(PP_STATUS) & PP_ON) {<br>
> > - /*FIXME: should be backlight level before*/<br>
> > - psb_intel_lvds_set_brightness(dev, 100);<br>
> > - } else {<br>
> > - DRM_DEBUG("LVDS panel never powered up");<br>
> > - return;<br>
> > - }<br>
> > - } else {<br>
> > - psb_intel_lvds_set_brightness(dev, 0);<br>
> > -<br>
> > - REG_WRITE(PP_CONTROL, REG_READ(PP_CONTROL) & ~POWER_TARGET_ON);<br>
> > - do {<br>
> > - pp_status = REG_READ(PP_STATUS);<br>
> > - } while ((pp_status & PP_ON) == 0);<br>
> > - }<br>
> > - dev_priv->lid_last_state = readl(lid_state);<br>
> > -<br>
> > -lid_timer_schedule:<br>
> > - spin_lock_irqsave(&dev_priv->lid_lock, irq_flags);<br>
> > - if (!timer_pending(lid_timer)) {<br>
> > - lid_timer->expires = jiffies + PSB_LID_DELAY;<br>
> > - add_timer(lid_timer);<br>
> > - }<br>
> > - spin_unlock_irqrestore(&dev_priv->lid_lock, irq_flags);<br>
> > -}<br>
> > -<br>
> > -void psb_lid_timer_init(struct drm_psb_private *dev_priv)<br>
> > -{<br>
> > - struct timer_list *lid_timer = &dev_priv->lid_timer;<br>
> > - unsigned long irq_flags;<br>
> > -<br>
> > - spin_lock_init(&dev_priv->lid_lock);<br>
> > - spin_lock_irqsave(&dev_priv->lid_lock, irq_flags);<br>
> > -<br>
> > - timer_setup(lid_timer, psb_lid_timer_func, 0);<br>
> > -<br>
> > - lid_timer->expires = jiffies + PSB_LID_DELAY;<br>
> > -<br>
> > - add_timer(lid_timer);<br>
> > - spin_unlock_irqrestore(&dev_priv->lid_lock, irq_flags);<br>
> > -}<br>
> > -<br>
> > -void psb_lid_timer_takedown(struct drm_psb_private *dev_priv)<br>
> > -{<br>
> > - del_timer_sync(&dev_priv->lid_timer);<br>
> > -}<br>
> > -<br>
><br>
> --<br>
> --<br>
> Thomas Zimmermann<br>
> Graphics Driver Developer<br>
> SUSE Software Solutions Germany GmbH<br>
> Frankenstrasse 146, 90461 Nuernberg, Germany<br>
> GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman<br>
> HRB 36809 (AG Nuernberg)<br>
><br>
</blockquote></div>