rtkit.c (6f84981772535e670e4e2df051a672af229b6694) rtkit.c (40eaa8c0cbba4a27668c7e01373ccd5b38381e2f)
1// SPDX-License-Identifier: GPL-2.0-only OR MIT
2/*
3 * Apple RTKit IPC library
4 * Copyright (C) The Asahi Linux Contributors
5 */
6
7#include "rtkit-internal.h"
8
9enum {
10 APPLE_RTKIT_PWR_STATE_OFF = 0x00, /* power off, cannot be restarted */
11 APPLE_RTKIT_PWR_STATE_SLEEP = 0x01, /* sleeping, can be restarted */
1// SPDX-License-Identifier: GPL-2.0-only OR MIT
2/*
3 * Apple RTKit IPC library
4 * Copyright (C) The Asahi Linux Contributors
5 */
6
7#include "rtkit-internal.h"
8
9enum {
10 APPLE_RTKIT_PWR_STATE_OFF = 0x00, /* power off, cannot be restarted */
11 APPLE_RTKIT_PWR_STATE_SLEEP = 0x01, /* sleeping, can be restarted */
12 APPLE_RTKIT_PWR_STATE_IDLE = 0x201, /* sleeping, retain state */
12 APPLE_RTKIT_PWR_STATE_QUIESCED = 0x10, /* running but no communication */
13 APPLE_RTKIT_PWR_STATE_ON = 0x20, /* normal operating state */
14};
15
16enum {
17 APPLE_RTKIT_EP_MGMT = 0,
18 APPLE_RTKIT_EP_CRASHLOG = 1,
19 APPLE_RTKIT_EP_SYSLOG = 2,

--- 856 unchanged lines hidden (view full) ---

876 ret = apple_rtkit_set_iop_power_state(rtk, APPLE_RTKIT_PWR_STATE_SLEEP);
877 if (ret)
878 return ret;
879
880 return apple_rtkit_reinit(rtk);
881}
882EXPORT_SYMBOL_GPL(apple_rtkit_shutdown);
883
13 APPLE_RTKIT_PWR_STATE_QUIESCED = 0x10, /* running but no communication */
14 APPLE_RTKIT_PWR_STATE_ON = 0x20, /* normal operating state */
15};
16
17enum {
18 APPLE_RTKIT_EP_MGMT = 0,
19 APPLE_RTKIT_EP_CRASHLOG = 1,
20 APPLE_RTKIT_EP_SYSLOG = 2,

--- 856 unchanged lines hidden (view full) ---

877 ret = apple_rtkit_set_iop_power_state(rtk, APPLE_RTKIT_PWR_STATE_SLEEP);
878 if (ret)
879 return ret;
880
881 return apple_rtkit_reinit(rtk);
882}
883EXPORT_SYMBOL_GPL(apple_rtkit_shutdown);
884
885int apple_rtkit_idle(struct apple_rtkit *rtk)
886{
887 int ret;
888
889 /* if OFF is used here the co-processor will not wake up again */
890 ret = apple_rtkit_set_ap_power_state(rtk,
891 APPLE_RTKIT_PWR_STATE_IDLE);
892 if (ret)
893 return ret;
894
895 ret = apple_rtkit_set_iop_power_state(rtk, APPLE_RTKIT_PWR_STATE_IDLE);
896 if (ret)
897 return ret;
898
899 rtk->iop_power_state = APPLE_RTKIT_PWR_STATE_IDLE;
900 rtk->ap_power_state = APPLE_RTKIT_PWR_STATE_IDLE;
901 return 0;
902}
903EXPORT_SYMBOL_GPL(apple_rtkit_idle);
904
884int apple_rtkit_quiesce(struct apple_rtkit *rtk)
885{
886 int ret;
887
888 ret = apple_rtkit_set_ap_power_state(rtk,
889 APPLE_RTKIT_PWR_STATE_QUIESCED);
890 if (ret)
891 return ret;

--- 74 unchanged lines hidden ---
905int apple_rtkit_quiesce(struct apple_rtkit *rtk)
906{
907 int ret;
908
909 ret = apple_rtkit_set_ap_power_state(rtk,
910 APPLE_RTKIT_PWR_STATE_QUIESCED);
911 if (ret)
912 return ret;

--- 74 unchanged lines hidden ---