Author: richard
Date: Tue Apr 28 07:34:43 2009
New Revision: 5517
URL: http://svn.slimdevices.com/jive?rev=5517&view=rev
Log:
r5...@harrypotter (orig r5489): richard | 2009-04-27 14:27:20 +0100
Bug: 11824
Description:
Add support for configuration of FF_WU_CFG1 in the lis302 driver.
r5...@harrypotter (orig r5490): felix | 2009-04-27 14:51:37 +0100
Bug: 11192
Description: Get SNR from wireless driver using ioctl instead of running a
shell command.
r5...@harrypotter (orig r5492): richard | 2009-04-27 15:43:11 +0100
Bug: 11824
Description:
Modify the parameters used by the accelerometer to wake up from suspend.
r5...@harrypotter (orig r5497): richard | 2009-04-27 22:01:45 +0100
Bug: 11824
Description:
Improved hueristics for power management.
1. The default time to suspend has been reduced, to 40 minutes when the
playmode is 'play' (eg
when the player being controller is playing), and 20 minutes at other times.
2. Motion does not prevent the device from suspending. You actually have to
use the buttons/wheel
to keep the Controller awake. This prevents accidental motion from keeping the
controller from
suspending, and also allows the controller to suspend quickly if accidentally
woken up.
Modified:
7.4/trunk/ (props changed)
7.4/trunk/squeezeos/poky/meta-squeezeos/packages/base-files/files/suspend
7.4/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/i2c/chips/lis302dl.c
7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveMeta.lua
Propchange: 7.4/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Tue Apr 28 07:34:43 2009
@@ -3,7 +3,7 @@
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.1/trunk:2920
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.2/trunk:2921
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.3/private-branches/jive-refresh:3653
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.3/trunk:5398
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.3/trunk:5497
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:2013
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378
Modified:
7.4/trunk/squeezeos/poky/meta-squeezeos/packages/base-files/files/suspend
URL:
http://svn.slimdevices.com/jive/7.4/trunk/squeezeos/poky/meta-squeezeos/packages/base-files/files/suspend?rev=5517&r1=5516&r2=5517&view=diff
==============================================================================
--- 7.4/trunk/squeezeos/poky/meta-squeezeos/packages/base-files/files/suspend
(original)
+++ 7.4/trunk/squeezeos/poky/meta-squeezeos/packages/base-files/files/suspend
Tue Apr 28 07:34:43 2009
@@ -19,10 +19,12 @@
/etc/init.d/wlan stop
# Enable accelerometer as wakeup source
+CONFIG=`cat /sys/bus/i2c/devices/0-001c/config`
DURATION=`cat /sys/bus/i2c/devices/0-001c/duration`
THRESHOLD=`cat /sys/bus/i2c/devices/0-001c/threshold`
-echo "4" > /sys/bus/i2c/devices/0-001c/duration
-echo "20" > /sys/bus/i2c/devices/0-001c/threshold
+echo "96" > /sys/bus/i2c/devices/0-001c/config
+echo "12" > /sys/bus/i2c/devices/0-001c/duration
+echo "10" > /sys/bus/i2c/devices/0-001c/threshold
echo "1" > /sys/bus/i2c/devices/0-001c/resume
# Suspend
@@ -35,6 +37,7 @@
/bin/sync
# Restore accelerometer parameters
+echo $CONFIG > /sys/bus/i2c/devices/0-001c/config
echo $DURATION > /sys/bus/i2c/devices/0-001c/duration
echo $THRESHOLD > /sys/bus/i2c/devices/0-001c/threshold
Modified:
7.4/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/i2c/chips/lis302dl.c
URL:
http://svn.slimdevices.com/jive/7.4/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/i2c/chips/lis302dl.c?rev=5517&r1=5516&r2=5517&view=diff
==============================================================================
--- 7.4/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/i2c/chips/lis302dl.c
(original)
+++ 7.4/trunk/squeezeos/src/s3c2412/linux-2.6.22/drivers/i2c/chips/lis302dl.c
Tue Apr 28 07:34:43 2009
@@ -64,6 +64,7 @@
unsigned int threshold;
unsigned int duration;
+ unsigned int config;
unsigned int resume_en : 1;
struct mutex lock;
@@ -193,15 +194,13 @@
/* I1CFG=FF_WU_1 */
lis302dl_write_value(client, LIS302DL_REG_CTRL_REG3, 0x01);
- /* threshold, duration */
+ /* threshold, duration, cfg_1 */
lis302dl_write_value(client, LIS302DL_REG_FF_WU_THS_1, data->threshold);
lis302dl_write_value(client, LIS302DL_REG_FF_WU_DURATION_1,
data->duration);
+ lis302dl_write_value(client, LIS302DL_REG_FF_WU_CFG_1, data->config);
/* reset HPF */
lis302dl_read_value(client, LIS302DL_REG_HP_FILTER_RESET);
-
- /* LIR, ZHIE, YHIE, XHIE */
- lis302dl_write_value(client, LIS302DL_REG_FF_WU_CFG_1, 0x6A);
INIT_WORK(&data->irq_work, lis302dl_irq_work);
}
@@ -279,6 +278,44 @@
}
static DEVICE_ATTR(duration, 0644, lis302dl_duration_show,
lis302dl_duration_store);
+
+
+static ssize_t lis302dl_config_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct lis302dl_data *data = i2c_get_clientdata(client);
+
+ return snprintf(buf, PAGE_SIZE, "%d\n", data->config);
+}
+
+static ssize_t lis302dl_config_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct lis302dl_data *data = i2c_get_clientdata(client);
+ char *ptr;
+ unsigned long val;
+
+ val = simple_strtoul(buf, &ptr, 10);
+ if (ptr == buf)
+ return -EINVAL;
+
+ if (val != data->config) {
+ data->config = val;
+
+ mutex_lock(&data->lock);
+
+ lis302dl_write_value(client, LIS302DL_REG_FF_WU_CFG_1,
data->config);
+
+ mutex_unlock(&data->lock);
+ }
+
+ return count;
+}
+
+static DEVICE_ATTR(config, 0644, lis302dl_config_show, lis302dl_config_store);
#ifdef CONFIG_PM
@@ -354,6 +391,7 @@
memset(data, 0, sizeof(struct lis302dl_data));
data->threshold = 0x14; // 350mg default
+ data->config = 0x6A; // LIR, ZHIE, YHIE, XHIE
mutex_init(&data->lock);
@@ -413,7 +451,8 @@
}
if ((err = device_create_file(&client->dev, &dev_attr_threshold)) ||
- (err = device_create_file(&client->dev, &dev_attr_duration))) {
+ (err = device_create_file(&client->dev, &dev_attr_duration)) ||
+ (err = device_create_file(&client->dev, &dev_attr_config))) {
dev_err(&client->dev, "cannot attach resume attribute\n");
}
Modified:
7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
URL:
http://svn.slimdevices.com/jive/7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua?rev=5517&r1=5516&r2=5517&view=diff
==============================================================================
---
7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
(original)
+++
7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
Tue Apr 28 07:34:43 2009
@@ -192,19 +192,24 @@
return EVENT_CONSUME
end)
- -- power management
- self.powerTimer = Timer(0, function() sleep(self) end)
+ -- power management (evaluate every minute)
+ self.lastMotion = Framework:getTicks()
+ self.lastPress = self.lastMotion
+ self.powerTimer = Timer(10000, function()
+ sleep(self)
+ end)
+
Framework:addListener(EVENT_MOTION,
function(event)
if not self.acpower then
- wakeup(self)
+ wakeup(self, 'motion')
end
return EVENT_UNUSED
end)
Framework:addListener(EVENT_SCROLL,
function(event)
- wakeup(self)
+ wakeup(self, 'press')
return EVENT_UNUSED
end)
@@ -219,7 +224,7 @@
return EVENT_CONSUME
end
- wakeup(self)
+ wakeup(self, 'press')
return EVENT_UNUSED
end)
@@ -586,7 +591,14 @@
-- called to wake up jive
-function wakeup(self)
+function wakeup(self, action)
+ if action == 'motion' then
+ self.lastMotion = Framework:getTicks()
+ end
+ if action == 'press' then
+ self.lastPress = Framework:getTicks()
+ end
+
if self.lockedPopup then
-- we're locked do nothing
return
@@ -607,41 +619,70 @@
-- called to sleep jive
function sleep(self)
+ local settings = self:getSettings()
+
+ local now = Framework:getTicks()
+ local deltaMotion = now - self.lastMotion
+ local deltaPress = now - self.lastPress
+
+ local motionTimeout = 0
+ local pressTimeout = 0
+ local nextState = false
+
-- don't sleep or suspend with a popup visible
-- e.g. Bug 6641 during a firmware upgrade
local topWindow = Framework.windowStack[1]
if not topWindow:canActivatePowersave()then
- self:setPowerState("active")
+ pressTimeout = now
+ nextState = "active"
elseif self.powerState == "active" then
- self:setPowerState("dimmed")
+ motionTimeout = settings.dimmedTimeout
+ pressTimeout = settings.dimmedTimeout
+ nextState = "dimmed"
elseif self.powerState == "locked" then
- self:setPowerState("sleep")
-
- else
- if self.powerState == "dimmed" then
- self:setPowerState("sleep")
- elseif self.powerState == "sleep" then
- self:setPowerState("suspend")
- elseif self.powerState == "suspend" then
- -- we can't go to sleep anymore
- end
+ motionTimeout = settings.dimmedTimeout
+ pressTimeout = settings.dimmedTimeout
+ nextState = "sleep"
+
+ elseif self.powerState == "dimmed" then
+ motionTimeout = settings.dimmedTimeout + settings.sleepTimeout
+ pressTimeout = settings.dimmedTimeout + settings.sleepTimeout
+ nextState = "sleep"
+
+ elseif self.powerState == "sleep" then
+ -- motion timeout to enter sleep is shorter than the press
+ -- timeout, so accidental motion does not prevent suspend
+ motionTimeout = settings.dimmedTimeout + settings.sleepTimeout
+
+ -- suspend timeout varies depending on playmode
+ local player = appletManager:callService("getCurrentPlayer")
+ if player and player:getPlayMode() == "play" then
+ pressTimeout = settings.sleepTimeout +
settings.suspendWhenPlayingTimeout
+ else
+ pressTimeout = settings.sleepTimeout +
settings.suspendWhenStoppedTimeout
+ end
+ nextState = "suspend"
+
+ elseif self.powerState == "suspend" then
+ -- we can't go to sleep anymore
+ end
+
+ log:debug("powerState=", self.powerState, " nextState=", nextState, "
motion=", (motionTimeout - deltaMotion), " press=", (pressTimeout - deltaPress))
+
+ if nextState and (deltaMotion >= motionTimeout) and (deltaPress >=
pressTimeout) then
+ self:setPowerState(nextState)
end
end
-- set the power state and update devices
-function setPowerState(self, state)
+function setPowerState(self, state, action)
local settings = self:getSettings()
log:info("setPowerState=", state, " acpower=", self.acpower)
self.powerState = state
-
- -- kill the timer
- self.powerTimer:stop()
-
- local interval = 0
if self.acpower then
-- charging
@@ -655,7 +696,6 @@
if state == "active" then
self:setBrightness()
- interval = settings.dimmedTimeout
elseif state == "dimmed" then
if settings.dimmedAC then
@@ -663,7 +703,6 @@
else
self:setBrightness()
end
- interval = settings.sleepTimeout
elseif state == "sleep" then
if settings.dimmedAC then
@@ -686,8 +725,6 @@
self.audioVolume = nil
end
- interval = settings.dimmedTimeout
-
elseif state == "locked" then
self:_cpuPowerSave(true)
self:setBrightness()
@@ -699,7 +736,6 @@
end
self.lockedTimer:restart()
- interval = settings.dimmedTimeout
elseif state == "dimmed" then
self:_cpuPowerSave(true)
@@ -707,8 +743,6 @@
self:_setBrightness(true, 8, 0)
end
- interval = settings.sleepTimeout
-
else
self:_setBrightness(true, 0, 0)
self:_cpuPowerSave(false)
@@ -719,10 +753,7 @@
Sample:setEffectVolume(0)
end
- if state == "sleep" then
- interval = settings.suspendTimeout
-
- elseif state == "suspend" then
+ if state == "suspend" then
if settings.suspendEnabled then
self:_suspend()
end
@@ -733,10 +764,7 @@
-- update wlan power save mode
self:_wlanPowerSave()
- if interval > 0 then
- self.powerTimer:setInterval(interval)
- self.powerTimer:start()
- end
+ self.powerTimer:restart()
end
@@ -960,10 +988,10 @@
end
end
- local suspendOptions = { 10, 30, 60, 600, 3600 }
+ local suspendOptions = { 10, 20, 30, 60, 600, 3600 }
local suspendIndex
for i, v in ipairs(suspendOptions) do
- if v == (settings.suspendTimeout / 1000) then
+ if v == (settings.suspendWhenPlayingTimeout / 1000) then
suspendIndex = i
break
end
@@ -977,7 +1005,7 @@
sleepOptions,
function(obj, selectedIndex)
settings.sleepTimeout =
sleepOptions[selectedIndex] * 1000
- log:info("sleepTimeout=",
settings.sleepTimeout)
+ log:debug("sleepTimeout=",
settings.sleepTimeout)
end,
sleepIndex
)
@@ -988,8 +1016,9 @@
"choice",
suspendOptions,
function(obj, selectedIndex)
- settings.suspendTimeout =
suspendOptions[selectedIndex] * 1000
- log:info("suspendTimeout=",
settings.suspendTimeout)
+
settings.suspendWhenPlayingTimeout = suspendOptions[selectedIndex] * 1000
+
settings.suspendWhenStoppedTimeout = (suspendOptions[selectedIndex] * 1000) / 2
+
log:debug("suspendWhenPlayingTimeout=", settings.suspendWhenPlayingTimeout)
end,
suspendIndex
)
Modified:
7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveMeta.lua
URL:
http://svn.slimdevices.com/jive/7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveMeta.lua?rev=5517&r1=5516&r2=5517&view=diff
==============================================================================
---
7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveMeta.lua
(original)
+++
7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveMeta.lua
Tue Apr 28 07:34:43 2009
@@ -23,7 +23,8 @@
brightness = 32,
dimmedTimeout = 10000, -- 10 seconds
sleepTimeout = 60000, -- 60 seconds
- suspendTimeout = 3600000, -- 1 hour
+ suspendWhenPlayingTimeout = 2400000, -- 40 minutes
+ suspendWhenStoppedTimeout = 1200000, -- 20 minutes
suspendEnabled = true,
suspendWake = nil,
dimmedAC = false,
@@ -37,9 +38,13 @@
-- Fixup settings after upgrade
local settings = meta:getSettings()
- if not settings.suspendTimeout then
- settings.suspendTimeout = 3600000 -- 1 hour
+ if not settings.suspendWhenPlayingTimeout then
+ settings.suspendTimeout = nil
+ settings.suspendWhenPlayingTimeout = 2400000
+ settings.suspendWhenStoppedTimeout = 1200000
+ meta:storeSettings()
end
+
-- Set player device type
LocalPlayer:setDeviceType("controller", "Controller")
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins