Commit 86ab9985 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-misc-fixes-2024-04-25' of...

Merge tag 'drm-misc-fixes-2024-04-25' of https://gitlab.freedesktop.org/drm/misc/kernel

 into drm-fixes

Short summary of fixes pull:

atomic-helpers:
- Fix memory leak in drm_format_conv_state_copy()

fbdev:
- fbdefio: Fix address calculation

gma500:
- Fix crash during boot

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20240425102413.GA6301@localhost.localdomain
parents 26da9bfd 78d9161d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -224,8 +224,8 @@ __drm_gem_duplicate_shadow_plane_state(struct drm_plane *plane,

	__drm_atomic_helper_plane_duplicate_state(plane, &new_shadow_plane_state->base);

	drm_format_conv_state_copy(&shadow_plane_state->fmtcnv_state,
				   &new_shadow_plane_state->fmtcnv_state);
	drm_format_conv_state_copy(&new_shadow_plane_state->fmtcnv_state,
				   &shadow_plane_state->fmtcnv_state);
}
EXPORT_SYMBOL(__drm_gem_duplicate_shadow_plane_state);

+0 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ gma500_gfx-y += \
	  psb_intel_lvds.o \
	  psb_intel_modes.o \
	  psb_intel_sdvo.o \
	  psb_lid.o \
	  psb_irq.o

gma500_gfx-$(CONFIG_ACPI) +=  opregion.o
+1 −4
Original line number Diff line number Diff line
@@ -73,8 +73,7 @@ static int psb_backlight_setup(struct drm_device *dev)
	}

	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;
}

@@ -259,8 +258,6 @@ static int psb_chip_setup(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);
}

+0 −9
Original line number Diff line number Diff line
@@ -162,7 +162,6 @@
#define PSB_NUM_VBLANKS 2

#define PSB_WATCHDOG_DELAY (HZ * 2)
#define PSB_LID_DELAY (HZ / 10)

#define PSB_MAX_BRIGHTNESS		100

@@ -491,11 +490,7 @@ struct drm_psb_private {
	/* Hotplug handling */
	struct work_struct hotplug_work;

	/* LID-Switch */
	spinlock_t lid_lock;
	struct timer_list lid_timer;
	struct psb_intel_opregion opregion;
	u32 lid_last_state;

	/* Watchdog */
	uint32_t apm_reg;
@@ -591,10 +586,6 @@ struct psb_ops {
	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 */
extern void psb_modeset_init(struct drm_device *dev);
extern void psb_modeset_cleanup(struct drm_device *dev);

drivers/gpu/drm/gma500/psb_lid.c

deleted100644 → 0
+0 −80
Original line number Diff line number Diff line
// 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);
}
Loading