Skip to content

Commit

Permalink
Remove SoftOff mode
Browse files Browse the repository at this point in the history
SoftOff mode is basically manual suspend to RAM for pre N900 era maemo
devices. The logic in MCE side does not work and also support needed by
it has beed dropped from DSME side ages ago.

Remove all remnants of SoftOff mode that still linger in mce code tree.

[mce] Remove SoftOff mode. Fixes JB#27285
  • Loading branch information
spiiroin committed Mar 14, 2015
1 parent bec0242 commit b6d161e
Show file tree
Hide file tree
Showing 11 changed files with 3 additions and 197 deletions.
6 changes: 0 additions & 6 deletions builtin-gconf.c
Expand Up @@ -1343,12 +1343,6 @@ static const setting_t gconf_defaults[] =
.type = "b",
.def = "true",
},
{
// MCE_LED_PATTERN_DEVICE_SOFT_OFF @ mce.h
.key = "/system/osso/dsm/leds/PatternDeviceSoftOff",
.type = "b",
.def = "true",
},
{
// MCE_LED_PATTERN_POWER_OFF @ mce.h
.key = "/system/osso/dsm/leds/PatternPowerOff",
Expand Down
3 changes: 0 additions & 3 deletions inifiles/hybris-led.ini
Expand Up @@ -26,9 +26,6 @@
PatternDeviceOn=254;0;0;0;0;0000ff
# 0000ff = blue

PatternDeviceSoftOff=253;0;0;0;0;00ffff
# 00ffff=cyan

PatternDisplayDimmed=252;7;0;0;0;001f1f
# 001f1f=low intensity cyan

Expand Down
10 changes: 0 additions & 10 deletions inifiles/legacy.ini
Expand Up @@ -31,7 +31,6 @@ CameraPopoutUnlock=1
# (0 for continuous light; ONLY when the charger is connected!)
# Intensity in steps from 0 (off) to 15 (full intensity)
PatternDeviceOn=254;0;0;75;5000;10
PatternDeviceSoftOff=253;0;0;100;10000;5
PatternPowerOn=9;3;0;2000;1000;15
PatternPowerOff=10;3;0;2000;1000;15
PatternCommunication=30;1;0;250;2000;15
Expand Down Expand Up @@ -91,7 +90,6 @@ PatternExample=42;1;30;500;1500;10
# e100 -- Wait for green trigger
# e200 -- Wait for blue trigger
PatternDeviceOn=254;0;0;4000205f20df7f007f007f007f000000;4000205f20df7f007f007f007f000000;4000205f20df7f007f007f007f000000
PatternDeviceSoftOff=253;0;0;4000203f20bf7f007f007f007f007f000000;4000203f20bf7f007f007f007f007f000000;0000
PatternPowerOn=9;3;0;4000207f207f01ff01ffc000;4000207f207f01ff01ffc000;4000207f207f01ff01ffc000
PatternPowerOff=10;3;0;4000017f017f36ff36ff7f00c000;4000017f017f36ff36ff7f00c000;4000017f017f36ff36ff7f00c000
PatternCommunication=30;1;0;0000;0000;40007f00017f017f050001ff01ff0000
Expand Down Expand Up @@ -148,7 +146,6 @@ PatternExample=42;1;30;4000167f167f17ff17ff0000;4000167f167f17ff17ff0000;0000
# e100 -- Wait for green trigger
# e200 -- Wait for blue trigger
PatternDeviceOn=254;0;0;4000e100207e207ee00420fe20fee0047f007f007f007f000000;4000e0024a15e0804a95e0807f007f007f007f000000;0000
PatternDeviceSoftOff=253;0;0;4000204f20cf7f007f007f007f007f000000;4000204f20cf7f007f007f007f007f000000;0000
PatternPowerOn=9;3;0;4000207f207f01ff01ffc000;4000207f207f01ff01ffc000;4000207f207f01ff01ffc000
PatternPowerOff=10;3;0;4000017f017f36ff36ff7f00c000;4000017f017f36ff36ff7f00c000;4000017f017f36ff36ff7f00c000
PatternCommunication=30;1;0;0000;0000;40007f00017f017f050001ff01ff0000
Expand Down Expand Up @@ -213,7 +210,6 @@ PatternExample=42;1;30;4000167f167f17ff17ff0000;4000167f167f17ff17ff0000;0000
# e100 -- Wait for engine 2 trigger
# e200 -- Wait for engine 3 trigger <used by key backlight!>
PatternDeviceOn=254;0;0;rgb;9d804000422043207f100000;9d800000
PatternDeviceSoftOff=253;0;0;rg;9d804000423f433f7f100000;9d800000
PatternPowerOn=9;3;0;rgb;9d80400042ff02ffc000;9d800000
PatternPowerOff=10;3;0;rgb;9d80400001ff43ff7f007f00c000;9d800000
PatternCommunication=30;1;0;b;9d80400002ff03ff02ff03ff71080000;9d800000
Expand Down Expand Up @@ -263,9 +259,6 @@ PatternExample=42;1;30;rg;9d80400044ff45ff0000;9d800000
# Use 0 steps to create pauses
# c000 -- End pattern execution

# FIXME: sloooooow breathing
PatternDeviceSoftOff=253;0;0;9d804000423f433f7f100000

PatternPowerOn=9;3;0;9d80400012ff03ffc000
PatternPowerOff=10;3;0;9d80400002ff1bffc000
PatternCommunication=30;1;0;9d80400004ff05ff04ff05ff437f0000
Expand Down Expand Up @@ -325,9 +318,6 @@ PatternExample=42;1;30;9d80400044ff45ff0000
# to cover the entire range from 0-255
# c000 -- End pattern execution

# FIXME: sloooooow breathing
PatternDeviceSoftOff=253;0;0;4000413f41bf5f900000

PatternPowerOn=9;3;0;4000087f087f01ff01ffc000
PatternPowerOff=10;3;0;4000017f017fc000
PatternCommunication=30;1;0;4000027f027f02ff02ff027f027f02ff02ff41ff0000
Expand Down
11 changes: 1 addition & 10 deletions inifiles/mce.ini
Expand Up @@ -18,15 +18,6 @@ ModulePath=/usr/lib/mce/modules
# Note: the name should not include the "lib"-prefix
Modules=radiostates;filter-brightness-als;display;keypad;led;battery-statefs;inactivity;alarm;callstate;audiorouting;proximity;powersavemode;cpu-keepalive;doubletap;packagekit;sensor-gestures;bluetooth;memnotify;usbmode

[SoftPowerOff]

# Charger connect policy
#
# Valid options:
# wakeup - wake up from soft poweroff when a charger is connected
# ignore - remain in soft poweroff when a charger is connected
ChargerPolicyConnect=ignore

[KeyPad]

# Timeout before disabling keyboard backlight when unused
Expand All @@ -51,7 +42,7 @@ BacklightFadeOutTime=1000
[LED]

# A list of all pattern names that should be configured
LEDPatternsRequired=PatternPowerOn;PatternPowerOff;PatternCommunication;PatternCommunicationAndBatteryFull;PatternBatteryCharging;PatternBatteryChargingFlat;PatternBatteryFull;PatternDeviceSoftOff
LEDPatternsRequired=PatternPowerOn;PatternPowerOff;PatternCommunication;PatternCommunicationAndBatteryFull;PatternBatteryCharging;PatternBatteryChargingFlat;PatternBatteryFull;
CombinationRules=CombinationCommunicationAndBatteryFull
# A list of pattern names that should not be used even if configured
LEDPatternsDisabled=
92 changes: 0 additions & 92 deletions mce-dsme.c
Expand Up @@ -38,9 +38,6 @@
#include <dsme/protocol.h>
#include <dsme/processwd.h>

/** Charger state; from charger_state_pipe */
static charger_state_t charger_state = CHARGER_STATE_UNDEF;

/** Availability of dsme; from dsme_available_pipe */
static service_state_t dsme_available = SERVICE_STATE_UNDEF;

Expand All @@ -56,23 +53,6 @@ static guint mce_dsme_iowatch_id = 0;
/** ID for delayed state transition reporting timer */
static guint mce_dsme_state_report_id = 0;

/** Soft poweroff charger connect policy */
static gint softoff_charger_connect_policy = DEFAULT_SOFTOFF_CHARGER_CONNECT;

/** Mapping of soft poweroff charger connect integer <-> policy string */
static const mce_translation_t soft_poweroff_charger_connect_translation[] = {
{
.number = SOFTOFF_CHARGER_CONNECT_WAKEUP,
.string = SOFTOFF_CHARGER_CONNECT_WAKEUP_STR
}, {
.number = SOFTOFF_CHARGER_CONNECT_IGNORE,
.string = SOFTOFF_CHARGER_CONNECT_IGNORE_STR
}, { /* MCE_INVALID_TRANSLATION marks the end of this array */
.number = MCE_INVALID_TRANSLATION,
.string = NULL
}
};

/* Internal functions */

static bool mce_dsme_send(gpointer msg, const char *request_name);
Expand All @@ -91,7 +71,6 @@ static system_state_t mce_dsme_normalise_system_state(dsme_state_t dsmestate);
static const char *mce_dsme_msg_type_repr(int type);
static gboolean mce_dsme_iowatch_cb(GIOChannel *source, GIOCondition condition, gpointer data);
static gboolean mce_dsme_init_done_cb(DBusMessage *const msg);
static void mce_dsme_charger_state_cb(gconstpointer const data);
static void mce_dsme_dsme_available_cb(gconstpointer const data);

static bool mce_dsme_connected(void);
Expand All @@ -101,7 +80,6 @@ static void mce_dsme_reconnect(void);

static void mce_dsme_init_dbus(void);
static void mce_dsme_quit_dbus(void);
static void mce_dsme_init_config(void);
static void mce_dsme_init_datapipes(void);
static void mce_dsme_quit_datapipes(void);

Expand Down Expand Up @@ -229,38 +207,6 @@ void mce_dsme_request_reboot(void)
return;
}

/**
* Request soft poweron
*/
void mce_dsme_request_soft_poweron(void)
{
/* Disable the soft poweroff LED pattern */
execute_datapipe_output_triggers(&led_pattern_deactivate_pipe,
MCE_LED_PATTERN_DEVICE_SOFT_OFF,
USE_INDATA);

mce_rem_submode_int32(MCE_SOFTOFF_SUBMODE);
execute_datapipe(&display_state_req_pipe,
GINT_TO_POINTER(MCE_DISPLAY_ON),
USE_INDATA, CACHE_INDATA);
}

/**
* Request soft poweroff
*/
void mce_dsme_request_soft_poweroff(void)
{
mce_add_submode_int32(MCE_SOFTOFF_SUBMODE);
execute_datapipe(&display_state_req_pipe,
GINT_TO_POINTER(MCE_DISPLAY_LPM_OFF),
USE_INDATA, CACHE_INDATA);

/* Enable the soft poweroff LED pattern */
execute_datapipe_output_triggers(&led_pattern_activate_pipe,
MCE_LED_PATTERN_DEVICE_SOFT_OFF,
USE_INDATA);
}

/**
* Timeout callback for transition
*
Expand Down Expand Up @@ -591,25 +537,6 @@ static gboolean mce_dsme_init_done_cb(DBusMessage *const msg)
return status;
}

/**
* Datapipe trigger for the charger state
*
* @param data TRUE if the charger was connected,
* FALSE if the charger was disconnected
*/
static void mce_dsme_charger_state_cb(gconstpointer const data)
{
submode_t submode = mce_get_submode_int32();

charger_state = GPOINTER_TO_INT(data);

if ((submode & MCE_SOFTOFF_SUBMODE) != 0) {
if (softoff_charger_connect_policy == SOFTOFF_CHARGER_CONNECT_WAKEUP) {
mce_dsme_request_soft_poweron();
}
}
}

/** Datapipe trigger for dsme availability
*/
static void mce_dsme_dsme_available_cb(gconstpointer const data)
Expand Down Expand Up @@ -748,19 +675,6 @@ static void mce_dsme_quit_dbus(void)
mce_dbus_handler_unregister_array(mce_dsme_dbus_handlers);
}

/** Get configuration options
*/
static void mce_dsme_init_config(void)
{
gchar *tmp = mce_conf_get_string(MCE_CONF_SOFTPOWEROFF_GROUP,
MCE_CONF_SOFTPOWEROFF_CHARGER_POLICY_CONNECT,
"");
softoff_charger_connect_policy =
mce_translate_string_to_int_with_default(soft_poweroff_charger_connect_translation,
tmp, DEFAULT_SOFTOFF_CHARGER_CONNECT);
g_free(tmp);
}

/** Array of datapipe handlers */
static datapipe_handler_t mce_dsme_datapipe_handlers[] =
{
Expand All @@ -769,10 +683,6 @@ static datapipe_handler_t mce_dsme_datapipe_handlers[] =
.datapipe = &dsme_available_pipe,
.output_cb = mce_dsme_dsme_available_cb,
},
{
.datapipe = &charger_state_pipe,
.output_cb = mce_dsme_charger_state_cb,
},
// sentinel
{
.datapipe = 0,
Expand Down Expand Up @@ -806,8 +716,6 @@ static void mce_dsme_quit_datapipes(void)
*/
gboolean mce_dsme_init(void)
{
mce_dsme_init_config();

mce_dsme_init_datapipes();

mce_dsme_init_dbus();
Expand Down
30 changes: 0 additions & 30 deletions mce-dsme.h
Expand Up @@ -32,38 +32,8 @@
*/
#define TRANSITION_DELAY -1

/** Name of Powerkey configuration group */
#define MCE_CONF_SOFTPOWEROFF_GROUP "SoftPowerOff"

/** Name of configuration key for charger connect policy in soft poweroff */
#define MCE_CONF_SOFTPOWEROFF_CHARGER_POLICY_CONNECT "ChargerPolicyConnect"

/**
* Name of configuration value for the "wake on charger" policy
* when in soft poweroff
*/
#define SOFTOFF_CHARGER_CONNECT_WAKEUP_STR "wakeup"

/**
* Name of configuration value for the "ignore charger" policy
* when in soft poweroff
*/
#define SOFTOFF_CHARGER_CONNECT_IGNORE_STR "ignore"

/** Soft poweroff charger connect policy */
enum {
/** Stay in offline mode */
SOFTOFF_CHARGER_CONNECT_WAKEUP = 0,
/** Restore previous mode */
SOFTOFF_CHARGER_CONNECT_IGNORE = 1,
/** Default setting */
DEFAULT_SOFTOFF_CHARGER_CONNECT = SOFTOFF_CHARGER_CONNECT_IGNORE,
};

void mce_dsme_request_powerup(void);
void mce_dsme_request_reboot(void);
void mce_dsme_request_soft_poweron(void);
void mce_dsme_request_soft_poweroff(void);
void mce_dsme_request_normal_shutdown(void);

/* When MCE is made modular, this will be handled differently */
Expand Down
6 changes: 0 additions & 6 deletions mce.h
Expand Up @@ -46,9 +46,6 @@
/** LED pattern used to indicate that the device is on when idle */
#define MCE_LED_PATTERN_DEVICE_ON "PatternDeviceOn"

/** LED pattern used when the device is in soft poweroff mode */
#define MCE_LED_PATTERN_DEVICE_SOFT_OFF "PatternDeviceSoftOff"

/** LED pattern used when charging the battery */
#define MCE_LED_PATTERN_BATTERY_CHARGING "PatternBatteryCharging"

Expand Down Expand Up @@ -135,9 +132,6 @@ typedef gint submode_t;
/** Event eater enabled */
#define MCE_EVEATER_SUBMODE (1 << 1)

/** Device emulates soft poweroff */
#define MCE_SOFTOFF_SUBMODE (1 << 2)

/** Bootup in progress */
#define MCE_BOOTUP_SUBMODE (1 << 3)

Expand Down
1 change: 0 additions & 1 deletion modetransition.c
Expand Up @@ -43,7 +43,6 @@ static char *mce_submode_change(const submode_t prev, const submode_t curr)
{ MCE_INVALID_SUBMODE, "INVALID" },
{ MCE_TKLOCK_SUBMODE, "TKLOCK" },
{ MCE_EVEATER_SUBMODE, "EVEATER" },
{ MCE_SOFTOFF_SUBMODE, "SOFTOFF" },
{ MCE_BOOTUP_SUBMODE, "BOOTUP" },
{ MCE_TRANSITION_SUBMODE, "TRANSITION" },
{ MCE_AUTORELOCK_SUBMODE, "AUTORELOCK" },
Expand Down
31 changes: 2 additions & 29 deletions powerkey.c
Expand Up @@ -144,7 +144,6 @@ static gint pwrkey_action_blank_mode = PWRKEY_BLANK_TO_OFF;
static guint pwrkey_action_blank_mode_gconf_id = 0;

static void pwrkey_action_shutdown (void);
static void pwrkey_action_softoff (void);
static void pwrkey_action_tklock (void);
static void pwrkey_action_blank (void);
static void pwrkey_action_unblank (void);
Expand Down Expand Up @@ -597,22 +596,6 @@ pwrkey_action_shutdown(void)
return;
}

static void
pwrkey_action_softoff(void)
{
submode_t submode = mce_get_submode_int32();

/* Only soft poweroff if the tklock isn't active */
if( submode & MCE_TKLOCK_SUBMODE )
goto EXIT;

mce_log(LL_DEVEL, "Requesting soft poweroff");
mce_dsme_request_soft_poweroff();

EXIT:
return;
}

static void
pwrkey_action_tklock(void)
{
Expand Down Expand Up @@ -751,10 +734,6 @@ static const pwrkey_bitconf_t pwrkey_action_lut[] =
.name = "devlock",
.func = pwrkey_action_devlock,
},
{
.name = "softoff",
.func = pwrkey_action_softoff,
},
{
.name = "shutdown",
.func = pwrkey_action_shutdown,
Expand Down Expand Up @@ -904,7 +883,6 @@ static void
pwrkey_actions_do_long_press(void)
{
system_state_t state = datapipe_get_gint(system_state_pipe);
submode_t submode = mce_get_submode_int32();

/* The action configuration applies only in the USER mode */

Expand All @@ -924,13 +902,8 @@ pwrkey_actions_do_long_press(void)
break;

case MCE_STATE_USER:
if( submode & MCE_SOFTOFF_SUBMODE ) {
/* Wake up from softoff */
mce_dsme_request_soft_poweron();
} else {
/* Apply configured actions */
pwrkey_mask_execute(pwrkey_actions_now->mask_long);
}
/* Apply configured actions */
pwrkey_mask_execute(pwrkey_actions_now->mask_long);
break;

default:
Expand Down

0 comments on commit b6d161e

Please sign in to comment.