Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.9/chimeraos #18

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
VERSION = 6
PATCHLEVEL = 9
SUBLEVEL = 12
EXTRAVERSION =
EXTRAVERSION = -chos9
NAME = Hurr durr I'ma ninja sloth

# *DOCUMENTATION*
Expand Down
94 changes: 78 additions & 16 deletions drivers/acpi/x86/s2idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/dmi.h>
#include <linux/power_supply.h>
#include <linux/suspend.h>

#include "../sleep.h"
Expand Down Expand Up @@ -53,13 +54,15 @@ static const struct acpi_device_id lps0_device_ids[] = {
#define ACPI_LPS0_SCREEN_OFF_AMD 4
#define ACPI_LPS0_SCREEN_ON_AMD 5

static struct acpi_device *lps0_device;
static acpi_handle lps0_device_handle;
static guid_t lps0_dsm_guid;
static int lps0_dsm_func_mask;

static guid_t lps0_dsm_guid_microsoft;
static int lps0_dsm_func_mask_microsoft;
static int lps0_dsm_state;
static int lps0_ac_state;

/* Device constraint entry structure */
struct lpi_device_info {
Expand Down Expand Up @@ -507,6 +510,8 @@ static int lps0_device_attach(struct acpi_device *adev,
return 0; //function evaluation failed

lps0_device_handle = adev->handle;
lps0_device = adev;
device_set_wakeup_capable(&adev->dev, true);

if (acpi_s2idle_vendor_amd())
lpi_device_get_constraints_amd();
Expand Down Expand Up @@ -539,17 +544,21 @@ static struct acpi_scan_handler lps0_handler = {
.attach = lps0_device_attach,
};

int acpi_s2idle_prepare_late(void)
static int acpi_s2idle_screen_off(void)
{
struct acpi_s2idle_dev_ops *handler;

if (!lps0_device_handle || sleep_no_lps0)
return 0;

if (pm_debug_messages_on)
lpi_check_constraints();
switch (lps0_dsm_state) {
case ACPI_LPS0_SCREEN_OFF_AMD:
case ACPI_LPS0_SCREEN_OFF:
if (pm_debug_messages_on)
acpi_handle_info(lps0_device_handle,
"already in %s\n",
acpi_sleep_dsm_state_to_str(lps0_dsm_state));
return 0;
}

/* Screen off */
if (lps0_dsm_func_mask > 0)
acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
ACPI_LPS0_SCREEN_OFF_AMD :
Expand All @@ -560,6 +569,50 @@ int acpi_s2idle_prepare_late(void)
acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF,
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);

return 0;
}

static int acpi_s2idle_screen_on(void)
{
if (!lps0_device_handle || sleep_no_lps0)
return 0;

switch (lps0_dsm_state) {
case ACPI_LPS0_SCREEN_ON_AMD:
case ACPI_LPS0_SCREEN_ON:
if (pm_debug_messages_on)
acpi_handle_info(lps0_device_handle,
"already in %s\n",
acpi_sleep_dsm_state_to_str(lps0_dsm_state));
return 0;
}

if (lps0_dsm_func_mask_microsoft > 0)
acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);

if (lps0_dsm_func_mask > 0)
acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
ACPI_LPS0_SCREEN_ON_AMD :
ACPI_LPS0_SCREEN_ON,
lps0_dsm_func_mask, lps0_dsm_guid);

return 0;
}

int acpi_s2idle_prepare_late(void)
{
struct acpi_s2idle_dev_ops *handler;

if (!lps0_device_handle || sleep_no_lps0)
return 0;

if (pm_debug_messages_on)
lpi_check_constraints();

/* capture AC adapter state */
lps0_ac_state = power_supply_is_system_supplied();

/* LPS0 entry */
if (lps0_dsm_func_mask > 0 && acpi_s2idle_vendor_amd())
acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY_AMD,
Expand Down Expand Up @@ -596,6 +649,15 @@ void acpi_s2idle_check(void)
if (handler->check)
handler->check();
}

/* if configured, wake system from AC adapter changes */
if (device_may_wakeup(&lps0_device->dev) &&
power_supply_is_system_supplied() != lps0_ac_state) {
if (pm_debug_messages_on)
acpi_handle_info(lps0_device_handle,
"AC adapter state changed\n");
acpi_pm_wakeup_event(&lps0_device->dev);
}
}

void acpi_s2idle_restore_early(void)
Expand Down Expand Up @@ -623,20 +685,18 @@ void acpi_s2idle_restore_early(void)
acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT,
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
}
}

/* Screen on */
if (lps0_dsm_func_mask_microsoft > 0)
acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
if (lps0_dsm_func_mask > 0)
acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
ACPI_LPS0_SCREEN_ON_AMD :
ACPI_LPS0_SCREEN_ON,
lps0_dsm_func_mask, lps0_dsm_guid);
static int acpi_x86_s2idle_begin(void)
{
lps0_dsm_state = -1;
return acpi_s2idle_begin();
}

static const struct platform_s2idle_ops acpi_s2idle_ops_lps0 = {
.begin = acpi_s2idle_begin,
.begin = acpi_x86_s2idle_begin,
.screen_off = acpi_s2idle_screen_off,
.screen_on = acpi_s2idle_screen_on,
.prepare = acpi_s2idle_prepare,
.prepare_late = acpi_s2idle_prepare_late,
.check = acpi_s2idle_check,
Expand All @@ -661,6 +721,8 @@ int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg)

sleep_flags = lock_system_sleep();
list_add(&arg->list_node, &lps0_s2idle_devops_head);
if (arg->wake_on_ac)
device_set_wakeup_enable(&lps0_device->dev, true);
unlock_system_sleep(sleep_flags);

return 0;
Expand Down
13 changes: 13 additions & 0 deletions drivers/gpu/drm/drm_atomic_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <linux/dma-fence.h>
#include <linux/ktime.h>
#include <linux/suspend.h>

#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
Expand Down Expand Up @@ -3526,6 +3527,13 @@ struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev)
goto unlock;
}

err = platform_suspend_screen_off();
if (err < 0) {
drm_atomic_state_put(state);
state = ERR_PTR(err);
goto unlock;
}

unlock:
DRM_MODESET_LOCK_ALL_END(dev, ctx, err);
if (err)
Expand Down Expand Up @@ -3607,7 +3615,12 @@ int drm_atomic_helper_resume(struct drm_device *dev,
DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, err);

err = drm_atomic_helper_commit_duplicated_state(state, &ctx);
if (err < 0)
goto unlock;

err = platform_suspend_screen_on();

unlock:
DRM_MODESET_LOCK_ALL_END(dev, ctx, err);
drm_atomic_state_put(state);

Expand Down
6 changes: 6 additions & 0 deletions drivers/gpu/drm/drm_panel_orientation_quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ static const struct dmi_system_id orientation_data[] = {
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYANEO 2"),
},
.driver_data = (void *)&lcd1200x1920_rightside_up,
}, { /* AYA NEO AYANEO 2S */
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYANEO"),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYANEO 2S"),
},
.driver_data = (void *)&lcd1200x1920_rightside_up,
}, { /* AYA NEO 2021 */
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYADEVICE"),
Expand Down
9 changes: 9 additions & 0 deletions drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ config HID_ASUS
- GL553V series
- GL753V series

config HID_ASUS_ALLY
tristate "Asus Ally gamepad configuration support"
depends on USB_HID
depends on LEDS_CLASS
depends on LEDS_CLASS_MULTICOLOR
select POWER_SUPPLY
help
Support for configuring the Asus ROG Ally gamepad using attributes.

config HID_AUREAL
tristate "Aureal"
help
Expand Down
1 change: 1 addition & 0 deletions drivers/hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ obj-$(CONFIG_HID_APPLE) += hid-apple.o
obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o
obj-$(CONFIG_HID_CREATIVE_SB0540) += hid-creative-sb0540.o
obj-$(CONFIG_HID_ASUS) += hid-asus.o
obj-$(CONFIG_HID_ASUS_ALLY) += hid-asus-ally.o
obj-$(CONFIG_HID_AUREAL) += hid-aureal.o
obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o
Expand Down
Loading