Commit e5e0243e authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'acpi-video' and 'acpi-hotplug'

* acpi-video:
  ACPI: move models with win8 brightness problems from win8 blacklist to use_native_backlight
  ACPI / video: Fix backlight taking 2 steps on a brightness up/down keypress

* acpi-hotplug:
  ACPI / hotplug / PCI: Fix sparse non static symbol warning
  ACPI / hotplug: Simplify acpi_set_hp_context()
  ACPI / hotplug / PCI: Eliminate acpiphp_dev_to_bridge()
...@@ -247,75 +247,11 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { ...@@ -247,75 +247,11 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
}, },
/* /*
* The following machines have broken backlight support when reporting * These machines will power on immediately after shutdown when
* the Windows 2012 OSI, so disable it until their support is fixed. * reporting the Windows 2012 OSI.
*/ */
{ {
.callback = dmi_disable_osi_win8, .callback = dmi_disable_osi_win8,
.ident = "ASUS Zenbook Prime UX31A",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "UX31A"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "ThinkPad Edge E530",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "3259A2G"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "ThinkPad Edge E530",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "3259CTO"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "ThinkPad Edge E530",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "3259HJG"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "Acer Aspire V5-573G",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer Aspire"),
DMI_MATCH(DMI_PRODUCT_VERSION, "V5-573G/Dazzle_HW"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "Acer Aspire V5-572G",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer Aspire"),
DMI_MATCH(DMI_PRODUCT_VERSION, "V5-572G/Dazzle_CX"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "ThinkPad T431s",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "20AACTO1WW"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "ThinkPad T430",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"),
},
},
{
.callback = dmi_disable_osi_win8,
.ident = "Dell Inspiron 7737", .ident = "Dell Inspiron 7737",
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
......
...@@ -77,7 +77,9 @@ void acpi_initialize_hp_context(struct acpi_device *adev, ...@@ -77,7 +77,9 @@ void acpi_initialize_hp_context(struct acpi_device *adev,
void (*uevent)(struct acpi_device *, u32)) void (*uevent)(struct acpi_device *, u32))
{ {
acpi_lock_hp_context(); acpi_lock_hp_context();
acpi_set_hp_context(adev, hp, notify, uevent, NULL); hp->notify = notify;
hp->uevent = uevent;
acpi_set_hp_context(adev, hp);
acpi_unlock_hp_context(); acpi_unlock_hp_context();
} }
EXPORT_SYMBOL_GPL(acpi_initialize_hp_context); EXPORT_SYMBOL_GPL(acpi_initialize_hp_context);
......
...@@ -204,6 +204,8 @@ struct acpi_video_device { ...@@ -204,6 +204,8 @@ struct acpi_video_device {
struct acpi_video_device_flags flags; struct acpi_video_device_flags flags;
struct acpi_video_device_cap cap; struct acpi_video_device_cap cap;
struct list_head entry; struct list_head entry;
struct delayed_work switch_brightness_work;
int switch_brightness_event;
struct acpi_video_bus *video; struct acpi_video_bus *video;
struct acpi_device *dev; struct acpi_device *dev;
struct acpi_video_device_brightness *brightness; struct acpi_video_device_brightness *brightness;
...@@ -230,8 +232,7 @@ static int acpi_video_device_lcd_get_level_current( ...@@ -230,8 +232,7 @@ static int acpi_video_device_lcd_get_level_current(
unsigned long long *level, bool raw); unsigned long long *level, bool raw);
static int acpi_video_get_next_level(struct acpi_video_device *device, static int acpi_video_get_next_level(struct acpi_video_device *device,
u32 level_current, u32 event); u32 level_current, u32 event);
static int acpi_video_switch_brightness(struct acpi_video_device *device, static void acpi_video_switch_brightness(struct work_struct *work);
int event);
static bool acpi_video_use_native_backlight(void) static bool acpi_video_use_native_backlight(void)
{ {
...@@ -275,6 +276,7 @@ static int acpi_video_set_brightness(struct backlight_device *bd) ...@@ -275,6 +276,7 @@ static int acpi_video_set_brightness(struct backlight_device *bd)
int request_level = bd->props.brightness + 2; int request_level = bd->props.brightness + 2;
struct acpi_video_device *vd = bl_get_data(bd); struct acpi_video_device *vd = bl_get_data(bd);
cancel_delayed_work(&vd->switch_brightness_work);
return acpi_video_device_lcd_set_level(vd, return acpi_video_device_lcd_set_level(vd,
vd->brightness->levels[request_level]); vd->brightness->levels[request_level]);
} }
...@@ -459,6 +461,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = { ...@@ -459,6 +461,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"), DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"),
}, },
}, },
{
.callback = video_set_use_native_backlight,
.ident = "ThinkPad X230",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X230"),
},
},
{ {
.callback = video_set_use_native_backlight, .callback = video_set_use_native_backlight,
.ident = "ThinkPad T430 and T430s", .ident = "ThinkPad T430 and T430s",
...@@ -469,10 +479,42 @@ static struct dmi_system_id video_dmi_table[] __initdata = { ...@@ -469,10 +479,42 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
}, },
{ {
.callback = video_set_use_native_backlight, .callback = video_set_use_native_backlight,
.ident = "ThinkPad X230", .ident = "ThinkPad T430",
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X230"), DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "ThinkPad T431s",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "20AACTO1WW"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "ThinkPad Edge E530",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "3259A2G"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "ThinkPad Edge E530",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "3259CTO"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "ThinkPad Edge E530",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "3259HJG"),
}, },
}, },
{ {
...@@ -571,6 +613,30 @@ static struct dmi_system_id video_dmi_table[] __initdata = { ...@@ -571,6 +613,30 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate B113"), DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate B113"),
}, },
}, },
{
.callback = video_set_use_native_backlight,
.ident = "Acer Aspire V5-572G",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer Aspire"),
DMI_MATCH(DMI_PRODUCT_VERSION, "V5-572G/Dazzle_CX"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "Acer Aspire V5-573G",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer Aspire"),
DMI_MATCH(DMI_PRODUCT_VERSION, "V5-573G/Dazzle_HW"),
},
},
{
.callback = video_set_use_native_backlight,
.ident = "ASUS Zenbook Prime UX31A",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "UX31A"),
},
},
{ {
.callback = video_set_use_native_backlight, .callback = video_set_use_native_backlight,
.ident = "HP ProBook 4340s", .ident = "HP ProBook 4340s",
...@@ -1188,6 +1254,8 @@ acpi_video_bus_get_one_device(struct acpi_device *device, ...@@ -1188,6 +1254,8 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
data->device_id = device_id; data->device_id = device_id;
data->video = video; data->video = video;
data->dev = device; data->dev = device;
INIT_DELAYED_WORK(&data->switch_brightness_work,
acpi_video_switch_brightness);
attribute = acpi_video_get_device_attr(video, device_id); attribute = acpi_video_get_device_attr(video, device_id);
...@@ -1410,15 +1478,18 @@ acpi_video_get_next_level(struct acpi_video_device *device, ...@@ -1410,15 +1478,18 @@ acpi_video_get_next_level(struct acpi_video_device *device,
} }
} }
static int static void
acpi_video_switch_brightness(struct acpi_video_device *device, int event) acpi_video_switch_brightness(struct work_struct *work)
{ {
struct acpi_video_device *device = container_of(to_delayed_work(work),
struct acpi_video_device, switch_brightness_work);
unsigned long long level_current, level_next; unsigned long long level_current, level_next;
int event = device->switch_brightness_event;
int result = -EINVAL; int result = -EINVAL;
/* no warning message if acpi_backlight=vendor or a quirk is used */ /* no warning message if acpi_backlight=vendor or a quirk is used */
if (!acpi_video_verify_backlight_support()) if (!acpi_video_verify_backlight_support())
return 0; return;
if (!device->brightness) if (!device->brightness)
goto out; goto out;
...@@ -1440,8 +1511,6 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event) ...@@ -1440,8 +1511,6 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event)
out: out:
if (result) if (result)
printk(KERN_ERR PREFIX "Failed to switch the brightness\n"); printk(KERN_ERR PREFIX "Failed to switch the brightness\n");
return result;
} }
int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, int acpi_video_get_edid(struct acpi_device *device, int type, int device_id,
...@@ -1609,6 +1678,16 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) ...@@ -1609,6 +1678,16 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
return; return;
} }
static void brightness_switch_event(struct acpi_video_device *video_device,
u32 event)
{
if (!brightness_switch_enabled)
return;
video_device->switch_brightness_event = event;
schedule_delayed_work(&video_device->switch_brightness_work, HZ / 10);
}
static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
{ {
struct acpi_video_device *video_device = data; struct acpi_video_device *video_device = data;
...@@ -1626,28 +1705,23 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) ...@@ -1626,28 +1705,23 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
switch (event) { switch (event) {
case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */
if (brightness_switch_enabled) brightness_switch_event(video_device, event);
acpi_video_switch_brightness(video_device, event);
keycode = KEY_BRIGHTNESS_CYCLE; keycode = KEY_BRIGHTNESS_CYCLE;
break; break;
case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */ case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */
if (brightness_switch_enabled) brightness_switch_event(video_device, event);
acpi_video_switch_brightness(video_device, event);
keycode = KEY_BRIGHTNESSUP; keycode = KEY_BRIGHTNESSUP;
break; break;
case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */ case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */
if (brightness_switch_enabled) brightness_switch_event(video_device, event);
acpi_video_switch_brightness(video_device, event);
keycode = KEY_BRIGHTNESSDOWN; keycode = KEY_BRIGHTNESSDOWN;
break; break;
case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightness */ case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightness */
if (brightness_switch_enabled) brightness_switch_event(video_device, event);
acpi_video_switch_brightness(video_device, event);
keycode = KEY_BRIGHTNESS_ZERO; keycode = KEY_BRIGHTNESS_ZERO;
break; break;
case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */ case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */
if (brightness_switch_enabled) brightness_switch_event(video_device, event);
acpi_video_switch_brightness(video_device, event);
keycode = KEY_DISPLAY_OFF; keycode = KEY_DISPLAY_OFF;
break; break;
default: default:
......
...@@ -80,8 +80,9 @@ static struct acpiphp_context *acpiphp_init_context(struct acpi_device *adev) ...@@ -80,8 +80,9 @@ static struct acpiphp_context *acpiphp_init_context(struct acpi_device *adev)
return NULL; return NULL;
context->refcount = 1; context->refcount = 1;
acpi_set_hp_context(adev, &context->hp, acpiphp_hotplug_notify, NULL, context->hp.notify = acpiphp_hotplug_notify;
acpiphp_post_dock_fixup); context->hp.fixup = acpiphp_post_dock_fixup;
acpi_set_hp_context(adev, &context->hp);
return context; return context;
} }
...@@ -369,20 +370,6 @@ static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data, ...@@ -369,20 +370,6 @@ static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data,
return AE_OK; return AE_OK;
} }
static struct acpiphp_bridge *acpiphp_dev_to_bridge(struct acpi_device *adev)
{
struct acpiphp_bridge *bridge = NULL;
acpi_lock_hp_context();
if (adev->hp) {
bridge = to_acpiphp_root_context(adev->hp)->root_bridge;
if (bridge)
get_bridge(bridge);
}
acpi_unlock_hp_context();
return bridge;
}
static void cleanup_bridge(struct acpiphp_bridge *bridge) static void cleanup_bridge(struct acpiphp_bridge *bridge)
{ {
struct acpiphp_slot *slot; struct acpiphp_slot *slot;
...@@ -753,9 +740,15 @@ static void acpiphp_sanitize_bus(struct pci_bus *bus) ...@@ -753,9 +740,15 @@ static void acpiphp_sanitize_bus(struct pci_bus *bus)
void acpiphp_check_host_bridge(struct acpi_device *adev) void acpiphp_check_host_bridge(struct acpi_device *adev)
{ {
struct acpiphp_bridge *bridge; struct acpiphp_bridge *bridge = NULL;
bridge = acpiphp_dev_to_bridge(adev); acpi_lock_hp_context();
if (adev->hp) {
bridge = to_acpiphp_root_context(adev->hp)->root_bridge;
if (bridge)
get_bridge(bridge);
}
acpi_unlock_hp_context();
if (bridge) { if (bridge) {
pci_lock_rescan_remove(); pci_lock_rescan_remove();
...@@ -884,7 +877,7 @@ void acpiphp_enumerate_slots(struct pci_bus *bus) ...@@ -884,7 +877,7 @@ void acpiphp_enumerate_slots(struct pci_bus *bus)
goto err; goto err;
root_context->root_bridge = bridge; root_context->root_bridge = bridge;
acpi_set_hp_context(adev, &root_context->hp, NULL, NULL, NULL); acpi_set_hp_context(adev, &root_context->hp);
} else { } else {
struct acpiphp_context *context; struct acpiphp_context *context;
...@@ -927,7 +920,7 @@ void acpiphp_enumerate_slots(struct pci_bus *bus) ...@@ -927,7 +920,7 @@ void acpiphp_enumerate_slots(struct pci_bus *bus)
kfree(bridge); kfree(bridge);
} }
void acpiphp_drop_bridge(struct acpiphp_bridge *bridge) static void acpiphp_drop_bridge(struct acpiphp_bridge *bridge)
{ {
if (pci_is_root_bus(bridge->pci_bus)) { if (pci_is_root_bus(bridge->pci_bus)) {
struct acpiphp_root_context *root_context; struct acpiphp_root_context *root_context;
......
...@@ -379,15 +379,9 @@ static inline void acpi_set_device_status(struct acpi_device *adev, u32 sta) ...@@ -379,15 +379,9 @@ static inline void acpi_set_device_status(struct acpi_device *adev, u32 sta)
} }
static inline void acpi_set_hp_context(struct acpi_device *adev, static inline void acpi_set_hp_context(struct acpi_device *adev,
struct acpi_hotplug_context *hp, struct acpi_hotplug_context *hp)
int (*notify)(struct acpi_device *, u32),
void (*uevent)(struct acpi_device *, u32),
void (*fixup)(struct acpi_device *))
{ {
hp->self = adev; hp->self = adev;
hp->notify = notify;
hp->uevent = uevent;
hp->fixup = fixup;
adev->hp = hp; adev->hp = hp;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment