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

Commit bb7ca747 authored by Matthew Garrett's avatar Matthew Garrett Committed by Linus Torvalds
Browse files

backlight: add backlight type



There may be multiple ways of controlling the backlight on a given
machine.  Allow drivers to expose the type of interface they are
providing, making it possible for userspace to make appropriate policy
decisions.

Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: David Airlie <airlied@linux.ie>
Cc: Alex Deucher <alexdeucher@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ccd7510f
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -34,3 +34,23 @@ Contact: Richard Purdie <rpurdie@rpsys.net>
Description:
		Maximum brightness for <backlight>.
Users:		HAL

What:		/sys/class/backlight/<backlight>/type
Date:		September 2010
KernelVersion:	2.6.37
Contact:	Matthew Garrett <mjg@redhat.com>
Description:
		The type of interface controlled by <backlight>.
		"firmware": The driver uses a standard firmware interface
		"platform": The driver uses a platform-specific interface
		"raw": The driver controls hardware registers directly

		In the general case, when multiple backlight
		interfaces are available for a single device, firmware
		control should be preferred to platform control should
		be preferred to raw control. Using a firmware
		interface reduces the probability of confusion with
		the hardware and the OS independently updating the
		backlight state. Platform interfaces are mostly a
		holdover from pre-standardisation of firmware
		interfaces.
+1 −0
Original line number Diff line number Diff line
@@ -795,6 +795,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
		count++;

		memset(&props, 0, sizeof(struct backlight_properties));
		props.type = BACKLIGHT_FIRMWARE;
		props.max_brightness = device->brightness->count - 3;
		device->backlight = backlight_device_register(name, NULL, device,
							      &acpi_backlight_ops,
+2 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ static int nouveau_nv40_backlight_init(struct drm_device *dev)
		return 0;

	memset(&props, 0, sizeof(struct backlight_properties));
	props.type = BACKLIGHT_RAW;
	props.max_brightness = 31;
	bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev,
				       &nv40_bl_ops, &props);
@@ -121,6 +122,7 @@ static int nouveau_nv50_backlight_init(struct drm_device *dev)
		return 0;

	memset(&props, 0, sizeof(struct backlight_properties));
	props.type = BACKLIGHT_RAW;
	props.max_brightness = 1025;
	bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev,
				       &nv50_bl_ops, &props);
+1 −0
Original line number Diff line number Diff line
@@ -944,6 +944,7 @@ static int picolcd_init_backlight(struct picolcd_data *data, struct hid_report *
	}

	memset(&props, 0, sizeof(props));
	props.type = BACKLIGHT_RAW;
	props.max_brightness = 0xff;
	bdev = backlight_device_register(dev_name(dev), dev, data,
			&picolcd_blops, &props);
+1 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ void __init pmu_backlight_init()
	snprintf(name, sizeof(name), "pmubl");

	memset(&props, 0, sizeof(struct backlight_properties));
	props.type = BACKLIGHT_PLATFORM;
	props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
	bd = backlight_device_register(name, NULL, NULL, &pmu_backlight_data,
				       &props);
Loading