[PATCH] drm/gma500: Check power status before accessing lid data in opregion

Thomas Zimmermann tzimmermann at suse.de
Fri Apr 12 08:16:15 UTC 2024



Am 12.04.24 um 10:02 schrieb Thomas Zimmermann:
> Hi,
>
> the issue of hanging during boot is still resent.
'present'
>
> Best regards
> Thomas
>
> Am 12.04.24 um 09:24 schrieb Patrik Jakobsson:
>> Due to changes in the order of initialization the psb_lid_timer_func
>> could get called without the device being powered. Fix this by checking
>> the power status before accessing the opregion.
>>
>> Cc: Enrico Bartky <enrico.bartky at gmail.com>
>> Cc: Thomas Zimmermann <tzimmermann at suse.de>
>> Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson at gmail.com>
>> ---
>>   drivers/gpu/drm/gma500/psb_lid.c | 10 +++++++++-
>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/gma500/psb_lid.c 
>> b/drivers/gpu/drm/gma500/psb_lid.c
>> index 58a7fe392636..eeb91d11336e 100644
>> --- a/drivers/gpu/drm/gma500/psb_lid.c
>> +++ b/drivers/gpu/drm/gma500/psb_lid.c
>> @@ -10,6 +10,7 @@
>>   #include "psb_drv.h"
>>   #include "psb_intel_reg.h"
>>   #include "psb_reg.h"
>> +#include "power.h"
>>     static void psb_lid_timer_func(struct timer_list *t)
>>   {
>> @@ -20,9 +21,12 @@ static void psb_lid_timer_func(struct timer_list *t)
>>       u32 __iomem *lid_state = dev_priv->opregion.lid_state;
>>       u32 pp_status;
>>   -    if (readl(lid_state) == dev_priv->lid_last_state)
>> +    if (!gma_power_begin(dev, false))
>>           goto lid_timer_schedule;
>>   +    if (readl(lid_state) == dev_priv->lid_last_state)
>> +        goto power_end;
>> +
>>       if ((readl(lid_state)) & 0x01) {
>>           /*lid state is open*/
>>           REG_WRITE(PP_CONTROL, REG_READ(PP_CONTROL) | POWER_TARGET_ON);
>> @@ -36,6 +40,7 @@ static void psb_lid_timer_func(struct timer_list *t)
>>               psb_intel_lvds_set_brightness(dev, 100);
>>           } else {
>>               DRM_DEBUG("LVDS panel never powered up");
>> +            gma_power_end(dev);
>>               return;
>>           }
>>       } else {
>> @@ -48,6 +53,9 @@ static void psb_lid_timer_func(struct timer_list *t)
>>       }
>>       dev_priv->lid_last_state =  readl(lid_state);
>>   +power_end:
>> +    gma_power_end(dev);
>> +
>>   lid_timer_schedule:
>>       spin_lock_irqsave(&dev_priv->lid_lock, irq_flags);
>>       if (!timer_pending(lid_timer)) {
>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)



More information about the dri-devel mailing list