Skip to content

Commit

Permalink
Merge branches 'acpi-drivers', 'acpi-pm', 'acpi-ec' and 'acpi-video'
Browse files Browse the repository at this point in the history
* acpi-drivers:
  ACPI / GED: make evged.c explicitly non-modular
  ACPI / amba: Remove CLK_IS_ROOT
  ACPI / APD: Remove CLK_IS_ROOT
  ACPI: implement Generic Event Device

* acpi-pm:
  ACPI / PM: Introduce efi poweroff for HW-full platforms without _S5

* acpi-ec:
  ACPI 2.0 / AML: Improve module level execution by moving the If/Else/While execution to per-table basis
  ACPI 2.0 / ECDT: Enable correct ECDT initialization order
  ACPI 2.0 / ECDT: Remove early namespace reference from EC
  ACPI 2.0 / ECDT: Split EC_FLAGS_HANDLERS_INSTALLED

* acpi-video:
  ACPI / video: mark acpi_video_get_levels() inline
  Thermal / ACPI / video: add INT3406 thermal driver
  ACPI/video: export acpi_video_get_levels
  video / backlight: remove the backlight_device_registered API
  video / backlight: add two APIs for drivers to use
  • Loading branch information
rafaeljw committed May 16, 2016
5 parents 407aa3f + 437014b + 1373718 + 3d4b7ae + e4f35c1 commit a6becfb
Show file tree
Hide file tree
Showing 19 changed files with 675 additions and 232 deletions.
2 changes: 1 addition & 1 deletion arch/x86/platform/efi/quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,5 +373,5 @@ bool efi_reboot_required(void)

bool efi_poweroff_required(void)
{
return !!acpi_gbl_reduced_hardware;
return acpi_gbl_reduced_hardware || acpi_no_s5;
}
1 change: 1 addition & 0 deletions drivers/acpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ acpi-$(CONFIG_ARM_AMBA) += acpi_amba.o
acpi-y += int340x_thermal.o
acpi-y += power.o
acpi-y += event.o
acpi-$(CONFIG_ACPI_REDUCED_HARDWARE_ONLY) += evged.o
acpi-y += sysfs.o
acpi-y += property.o
acpi-$(CONFIG_X86) += acpi_cmos_rtc.o
Expand Down
3 changes: 1 addition & 2 deletions drivers/acpi/acpi_amba.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ static void amba_register_dummy_clk(void)
if (amba_dummy_clk)
return;

amba_dummy_clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL,
CLK_IS_ROOT, 0);
amba_dummy_clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, 0, 0);
clk_register_clkdev(amba_dummy_clk, "apb_pclk", NULL);
}

Expand Down
3 changes: 1 addition & 2 deletions drivers/acpi/acpi_apd.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ static int acpi_apd_setup(struct apd_private_data *pdata)
if (dev_desc->fixed_clk_rate) {
clk = clk_register_fixed_rate(&pdata->adev->dev,
dev_name(&pdata->adev->dev),
NULL, CLK_IS_ROOT,
dev_desc->fixed_clk_rate);
NULL, 0, dev_desc->fixed_clk_rate);
clk_register_clkdev(clk, NULL, dev_name(&pdata->adev->dev));
pdata->clk = clk;
}
Expand Down
83 changes: 45 additions & 38 deletions drivers/acpi/acpi_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,6 @@ struct acpi_video_device_cap {
u8 _DDC:1; /* Return the EDID for this device */
};

struct acpi_video_brightness_flags {
u8 _BCL_no_ac_battery_levels:1; /* no AC/Battery levels in _BCL */
u8 _BCL_reversed:1; /* _BCL package is in a reversed order */
u8 _BQC_use_index:1; /* _BQC returns an index value */
};

struct acpi_video_device_brightness {
int curr;
int count;
int *levels;
struct acpi_video_brightness_flags flags;
};

struct acpi_video_device {
unsigned long device_id;
struct acpi_video_device_flags flags;
Expand Down Expand Up @@ -325,7 +312,7 @@ static const struct thermal_cooling_device_ops video_cooling_ops = {
*/

static int
acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
acpi_video_device_lcd_query_levels(acpi_handle handle,
union acpi_object **levels)
{
int status;
Expand All @@ -335,7 +322,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,

*levels = NULL;

status = acpi_evaluate_object(device->dev->handle, "_BCL", NULL, &buffer);
status = acpi_evaluate_object(handle, "_BCL", NULL, &buffer);
if (!ACPI_SUCCESS(status))
return status;
obj = (union acpi_object *)buffer.pointer;
Expand Down Expand Up @@ -766,36 +753,28 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device,
return 0;
}


/*
* Arg:
* device : video output device (LCD, CRT, ..)
*
* Return Value:
* Maximum brightness level
*
* Allocate and initialize device->brightness.
*/

static int
acpi_video_init_brightness(struct acpi_video_device *device)
int acpi_video_get_levels(struct acpi_device *device,
struct acpi_video_device_brightness **dev_br)
{
union acpi_object *obj = NULL;
int i, max_level = 0, count = 0, level_ac_battery = 0;
unsigned long long level, level_old;
union acpi_object *o;
struct acpi_video_device_brightness *br = NULL;
int result = -EINVAL;
int result = 0;
u32 value;

if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) {
if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device->handle,
&obj))) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available "
"LCD brightness level\n"));
result = -ENODEV;
goto out;
}

if (obj->package.count < 2)
if (obj->package.count < 2) {
result = -EINVAL;
goto out;
}

br = kzalloc(sizeof(*br), GFP_KERNEL);
if (!br) {
Expand Down Expand Up @@ -861,6 +840,38 @@ acpi_video_init_brightness(struct acpi_video_device *device)
"Found unordered _BCL package"));

br->count = count;
*dev_br = br;

out:
kfree(obj);
return result;
out_free:
kfree(br);
goto out;
}
EXPORT_SYMBOL(acpi_video_get_levels);

/*
* Arg:
* device : video output device (LCD, CRT, ..)
*
* Return Value:
* Maximum brightness level
*
* Allocate and initialize device->brightness.
*/

static int
acpi_video_init_brightness(struct acpi_video_device *device)
{
int i, max_level = 0;
unsigned long long level, level_old;
struct acpi_video_device_brightness *br = NULL;
int result = -EINVAL;

result = acpi_video_get_levels(device->dev, &br);
if (result)
return result;
device->brightness = br;

/* _BQC uses INDEX while _BCL uses VALUE in some laptops */
Expand Down Expand Up @@ -903,17 +914,13 @@ acpi_video_init_brightness(struct acpi_video_device *device)
goto out_free_levels;

ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"found %d brightness levels\n", count - 2));
kfree(obj);
return result;
"found %d brightness levels\n", br->count - 2));
return 0;

out_free_levels:
kfree(br->levels);
out_free:
kfree(br);
out:
device->brightness = NULL;
kfree(obj);
return result;
}

Expand Down
39 changes: 25 additions & 14 deletions drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,11 +925,13 @@ void __init acpi_early_init(void)
goto error0;
}

status = acpi_load_tables();
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX
"Unable to load the System Description Tables\n");
goto error0;
if (acpi_gbl_group_module_level_code) {
status = acpi_load_tables();
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX
"Unable to load the System Description Tables\n");
goto error0;
}
}

#ifdef CONFIG_X86
Expand Down Expand Up @@ -995,24 +997,33 @@ static int __init acpi_bus_init(void)

acpi_os_initialize1();

status = acpi_enable_subsystem(ACPI_NO_ACPI_ENABLE);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX
"Unable to start the ACPI Interpreter\n");
goto error1;
}

/*
* ACPI 2.0 requires the EC driver to be loaded and work before
* the EC device is found in the namespace (i.e. before acpi_initialize_objects()
* is called).
* the EC device is found in the namespace (i.e. before
* acpi_load_tables() is called).
*
* This is accomplished by looking for the ECDT table, and getting
* the EC parameters out of that.
*/
status = acpi_ec_ecdt_probe();
/* Ignore result. Not having an ECDT is not fatal. */

if (!acpi_gbl_group_module_level_code) {
status = acpi_load_tables();
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX
"Unable to load the System Description Tables\n");
goto error1;
}
}

status = acpi_enable_subsystem(ACPI_NO_ACPI_ENABLE);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX
"Unable to start the ACPI Interpreter\n");
goto error1;
}

status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to initialize ACPI objects\n");
Expand Down
Loading

0 comments on commit a6becfb

Please sign in to comment.