summary refs log tree commit diff
path: root/drivers/video
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-05-16 19:41:41 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-16 19:41:41 -0700
commit46c13450624e36302547a2ac3695f2350fe7ffc3 (patch)
treee0454dae2c92873d193e8f9d8afeb920e3b0576a /drivers/video
parentd57d39431924d1628ac9b93a2de7f806fc80680a (diff)
parentfc723957801465c4a911d0a509709f0f8b91aa8a (diff)
downloadlinux-46c13450624e36302547a2ac3695f2350fe7ffc3.tar.gz
Merge tag 'acpi-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki:
 "The new features here are ACPI 6.1 support (and some previously
  missing bits of ACPI 6.0 support) in ACPICA and two new drivers, a
  driver for the ACPI Generic Event Device (GED) feature introduced by
  ACPI 6.1 and the INT3406 thermal driver for display thermal
  management.  Also the value returned by the _HRV (hardware revision)
  ACPI object will be exported to user space via sysfs now.

  In addition to that, ACPI on ARM64 will not depend on EXPERT any more.

  The rest is mostly fixes and cleanups and some code reorganization.

  Specifics:

   - In-kernel ACPICA code update to the upstream release 20160422
     adding support for ACPI 6.1 along with some previously missing bits
     of ACPI 6.0 support, making a fair amount of fixes and cleanups and
     reducing divergences between the upstream ACPICA and the in-kernel
     code (Bob Moore, Lv Zheng, Al Stone, Aleksey Makarov, Will Miles)

   - ACPI Generic Event Device (GED) support and a fix for it (Sinan
     Kaya, Paul Gortmaker)

   - INT3406 thermal driver for display thermal management and ACPI
     backlight support code reorganization related to it (Aaron Lu, Arnd
     Bergmann)

   - Support for exporting the value returned by the _HRV (hardware
     revision) ACPI object via sysfs (Betty Dall)

   - Removal of the EXPERT dependency for ACPI on ARM64 (Mark Brown)

   - Rework of the handling of ACPI _OSI mechanism allowing the
     _OSI("Darwin") support to be overridden from the kernel command
     line among other things (Lv Zheng, Chen Yu)

   - Rework of the ACPI tables override mechanism to prepare it for the
     introduction of overlays support going forward (Lv Zheng, Rafael
     Wysocki)

   - Fixes related to the ECDT support and module-level execution of AML
     (Lv Zheng)

   - ACPI PCI interrupts management update to make it work better on
     ARM64 mostly (Sinan Kaya)

   - ACPI SRAT handling update to make the code process all entires in
     the table order regardless of the entry type (Lukasz Anaczkowski)

   - EFI power off support for full-hardware ACPI platforms that don't
     support ACPI S5 (Chen Yu)

   - Fixes and cleanups related to the ACPI core's sysfs interface (Dan
     Carpenter, Betty Dall)

   - acpi_dev_present() API rework to reduce possible confusion related
     to it (Lukas Wunner)

   - Removal of CLK_IS_ROOT from two ACPI drivers (Stephen Boyd)"

* tag 'acpi-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (82 commits)
  ACPI / video: mark acpi_video_get_levels() inline
  Thermal / ACPI / video: add INT3406 thermal driver
  ACPI / GED: make evged.c explicitly non-modular
  ACPI / tables: Fix DSDT override mechanism
  ACPI / sysfs: fix error code in get_status()
  ACPICA: Update version to 20160422
  ACPICA: Move all ASCII utilities to a common file
  ACPICA: ACPI 2.0, Hardware: Add access_width/bit_offset support for acpi_hw_write()
  ACPICA: ACPI 2.0, Hardware: Add access_width/bit_offset support in acpi_hw_read()
  ACPICA: Executer: Introduce a set of macros to handle bit width mask generation
  ACPICA: Hardware: Add optimized access bit width support
  ACPICA: Utilities: Add ACPI_IS_ALIGNED() macro
  ACPICA: Renamed some #defined flag constants for clarity
  ACPICA: ACPI 6.0, tools/iasl: Add support for new resource descriptors
  ACPICA: ACPI 6.0: Update _BIX support for new package element
  ACPICA: ACPI 6.1: Support for new PCCT subtable
  ACPICA: Refactor evaluate_object to reduce nesting
  ACPICA: Divergence: remove unwanted spaces for typedef
  ACPI,PCI,IRQ: remove SCI penalize function
  ACPI,PCI,IRQ: remove redundant code in acpi_irq_penalty_init()
  ..
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/backlight/backlight.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index bddc8b17a4d8..288318ad21dd 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -164,18 +164,10 @@ static ssize_t brightness_show(struct device *dev,
 	return sprintf(buf, "%d\n", bd->props.brightness);
 }
 
-static ssize_t brightness_store(struct device *dev,
-		struct device_attribute *attr, const char *buf, size_t count)
+int backlight_device_set_brightness(struct backlight_device *bd,
+				    unsigned long brightness)
 {
-	int rc;
-	struct backlight_device *bd = to_backlight_device(dev);
-	unsigned long brightness;
-
-	rc = kstrtoul(buf, 0, &brightness);
-	if (rc)
-		return rc;
-
-	rc = -ENXIO;
+	int rc = -ENXIO;
 
 	mutex_lock(&bd->ops_lock);
 	if (bd->ops) {
@@ -185,7 +177,7 @@ static ssize_t brightness_store(struct device *dev,
 			pr_debug("set brightness to %lu\n", brightness);
 			bd->props.brightness = brightness;
 			backlight_update_status(bd);
-			rc = count;
+			rc = 0;
 		}
 	}
 	mutex_unlock(&bd->ops_lock);
@@ -194,6 +186,23 @@ static ssize_t brightness_store(struct device *dev,
 
 	return rc;
 }
+EXPORT_SYMBOL(backlight_device_set_brightness);
+
+static ssize_t brightness_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	int rc;
+	struct backlight_device *bd = to_backlight_device(dev);
+	unsigned long brightness;
+
+	rc = kstrtoul(buf, 0, &brightness);
+	if (rc)
+		return rc;
+
+	rc = backlight_device_set_brightness(bd, brightness);
+
+	return rc ? rc : count;
+}
 static DEVICE_ATTR_RW(brightness);
 
 static ssize_t type_show(struct device *dev, struct device_attribute *attr,
@@ -380,7 +389,7 @@ struct backlight_device *backlight_device_register(const char *name,
 }
 EXPORT_SYMBOL(backlight_device_register);
 
-bool backlight_device_registered(enum backlight_type type)
+struct backlight_device *backlight_device_get_by_type(enum backlight_type type)
 {
 	bool found = false;
 	struct backlight_device *bd;
@@ -394,9 +403,9 @@ bool backlight_device_registered(enum backlight_type type)
 	}
 	mutex_unlock(&backlight_dev_list_mutex);
 
-	return found;
+	return found ? bd : NULL;
 }
-EXPORT_SYMBOL(backlight_device_registered);
+EXPORT_SYMBOL(backlight_device_get_by_type);
 
 /**
  * backlight_device_unregister - unregisters a backlight device object.