Commit f1415900 authored by Jani Nikula's avatar Jani Nikula
Browse files

drm/i915/opregion: use generic poll_timeout_us() instead of wait_for()



Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 1 ms sleep instead. The timeout remains, being
opregion defined, 50 ms by default, and 1500 ms at most.

Reviewed-by: default avatarJouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/63db3a1e1db9e55a18ed322c55f2dffe511a10bb.1756383233.git.jani.nikula@intel.com


Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 19b31edb
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -28,13 +28,13 @@
#include <linux/acpi.h>
#include <linux/debugfs.h>
#include <linux/dmi.h>
#include <linux/iopoll.h>
#include <acpi/video.h>

#include <drm/drm_edid.h>
#include <drm/drm_file.h>
#include <drm/drm_print.h>

#include "i915_utils.h"
#include "intel_acpi.h"
#include "intel_backlight.h"
#include "intel_display_core.h"
@@ -357,10 +357,12 @@ static int swsci(struct intel_display *display,
	pci_write_config_word(pdev, SWSCI, swsci_val);

	/* Poll for the result. */
#define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
	if (wait_for(C, dslp)) {
	ret = poll_timeout_us(scic = swsci->scic,
			      (scic & SWSCI_SCIC_INDICATOR) == 0,
			      1000, dslp * 1000, false);
	if (ret) {
		drm_dbg(display->drm, "SWSCI request timed out\n");
		return -ETIMEDOUT;
		return ret;
	}

	scic = (scic & SWSCI_SCIC_EXIT_STATUS_MASK) >>