Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d8fe675 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge back earlier 'acpi-video' material.

parents 07d1d29e 9404cd95
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3461,7 +3461,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
			the allocated input device; If set to 0, video driver
			will only send out the event without touching backlight
			brightness level.
			default: 1
			default: 0

	virtio_mmio.device=
			[VMMIO] Memory mapped virtio (platform) device.
+89 −66
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ MODULE_AUTHOR("Bruno Ducrot");
MODULE_DESCRIPTION("ACPI Video Driver");
MODULE_LICENSE("GPL");

static bool brightness_switch_enabled = 1;
static bool brightness_switch_enabled;
module_param(brightness_switch_enabled, bool, 0644);

/*
@@ -150,6 +150,7 @@ struct acpi_video_enumerated_device {

struct acpi_video_bus {
	struct acpi_device *device;
	bool backlight_registered;
	u8 dos_setting;
	struct acpi_video_enumerated_device *attached_array;
	u8 attached_count;
@@ -1658,7 +1659,6 @@ acpi_video_bus_match(acpi_handle handle, u32 level, void *context,

static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
{
	if (acpi_video_verify_backlight_support()) {
	struct backlight_properties props;
	struct pci_dev *pdev;
	acpi_handle acpi_parent;
@@ -1706,11 +1706,9 @@ static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
				device->dev, &video_cooling_ops);
	if (IS_ERR(device->cooling_dev)) {
		/*
			 * Set cooling_dev to NULL so we don't crash trying to
			 * free it.
			 * Also, why the hell we are returning early and
			 * not attempt to register video output if cooling
			 * device registration failed?
		 * Set cooling_dev to NULL so we don't crash trying to free it.
		 * Also, why the hell we are returning early and not attempt to
		 * register video output if cooling device registration failed?
		 * -- dtor
		 */
		device->cooling_dev = NULL;
@@ -1729,17 +1727,21 @@ static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
	if (result)
		printk(KERN_ERR PREFIX "Create sysfs link\n");
}
}

static int acpi_video_bus_register_backlight(struct acpi_video_bus *video)
{
	struct acpi_video_device *dev;

	if (!acpi_video_verify_backlight_support())
		return 0;

	mutex_lock(&video->device_list_lock);
	list_for_each_entry(dev, &video->video_device_list, entry)
		acpi_video_dev_register_backlight(dev);
	mutex_unlock(&video->device_list_lock);

	video->backlight_registered = true;

	video->pm_nb.notifier_call = acpi_video_resume;
	video->pm_nb.priority = 0;
	return register_pm_notifier(&video->pm_nb);
@@ -1767,13 +1769,20 @@ static void acpi_video_dev_unregister_backlight(struct acpi_video_device *device
static int acpi_video_bus_unregister_backlight(struct acpi_video_bus *video)
{
	struct acpi_video_device *dev;
	int error = unregister_pm_notifier(&video->pm_nb);
	int error;

	if (!video->backlight_registered)
		return 0;

	error = unregister_pm_notifier(&video->pm_nb);

	mutex_lock(&video->device_list_lock);
	list_for_each_entry(dev, &video->video_device_list, entry)
		acpi_video_dev_unregister_backlight(dev);
	mutex_unlock(&video->device_list_lock);

	video->backlight_registered = false;

	return error;
}

@@ -2061,6 +2070,20 @@ void acpi_video_unregister(void)
}
EXPORT_SYMBOL(acpi_video_unregister);

void acpi_video_unregister_backlight(void)
{
	struct acpi_video_bus *video;

	if (!register_count)
		return;

	mutex_lock(&video_list_lock);
	list_for_each_entry(video, &video_bus_head, entry)
		acpi_video_bus_unregister_backlight(video);
	mutex_unlock(&video_list_lock);
}
EXPORT_SYMBOL(acpi_video_unregister_backlight);

/*
 * This is kind of nasty. Hardware using Intel chipsets may require
 * the video opregion code to be run first in order to initialise
+9 −1
Original line number Diff line number Diff line
@@ -570,6 +570,14 @@ static const struct dmi_system_id video_vendor_dmi_table[] = {
			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5750"),
		},
	},
	{
		.callback = video_set_backlight_video_vendor,
		.ident = "Acer Aspire 5741",
		.matches = {
			DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5741"),
		},
	},
	{}
};

@@ -2228,7 +2236,7 @@ static int __init acer_wmi_init(void)
		pr_info("Brightness must be controlled by acpi video driver\n");
	} else {
		pr_info("Disabling ACPI video driver\n");
		acpi_video_unregister();
		acpi_video_unregister_backlight();
	}

	if (wmi_has_guid(WMID_GUID3)) {
+2 −0
Original line number Diff line number Diff line
@@ -19,11 +19,13 @@ struct acpi_device;
#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
extern int acpi_video_register(void);
extern void acpi_video_unregister(void);
extern void acpi_video_unregister_backlight(void);
extern int acpi_video_get_edid(struct acpi_device *device, int type,
			       int device_id, void **edid);
#else
static inline int acpi_video_register(void) { return 0; }
static inline void acpi_video_unregister(void) { return; }
static inline void acpi_video_unregister_backlight(void) { return; }
static inline int acpi_video_get_edid(struct acpi_device *device, int type,
				      int device_id, void **edid)
{