Re: Cannot shutdown power use from built in webcam in thinkpad T530 questions]

2013-09-28 Thread Marc MERLIN
On Mon, Sep 23, 2013 at 10:21:23AM +0200, Oleksij Rempel wrote:
  Understood, just making sure this was still potentially useful considering
  what I found out since my last message.
 
 Which version of powertop are you actually using? None of current

The latest, i.e. 2.4.

 versions would show you Watt usage for devices.

Sure it does :)

Summary: 3182.2 wakeups/second,  82.5 GPU ops/seconds, 0.0 VFS ops/sec and 33.5%

Power est.  Usage   Events/sCategory   Description
  9.82 W100.0%  Device USB device: Yubico Yubike
  2.67 W  4.1 ms/s  43.2Process/usr/bin/pulseaudio --sta
  2.58 W100.0%  Device USB device: Integrated Ca
  2.35 W100.0%  Device USB device: BCM20702A0 (B
  2.32 W 32.9%  Device Display backlight
  1.39 W100.0%  Device Radio device: btusb
  343 mW100.0%  Device Radio device: thinkpad_ac

Now, I've found those values to be often wrong or questionable.

 you can use watch grep . * instead and check fallowing fields:
 runtime_suspended_time - suspend time. If it is growing device is suspended
 runtime_active_kids - if not zero, some program use it
 control - if on then autosuspend is disabled.

Understood.

Thanks,
Marc
-- 
A mouse is a device used to point at the xterm you want to type in - A.S.R.
Microsoft is to operating systems 
   what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/  
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cannot shutdown power use from built in webcam in thinkpad T530 questions]

2013-09-28 Thread Oleksij Rempel
Am 28.09.2013 20:08, schrieb Marc MERLIN:
 On Mon, Sep 23, 2013 at 10:21:23AM +0200, Oleksij Rempel wrote:
 Understood, just making sure this was still potentially useful considering
 what I found out since my last message.

 Which version of powertop are you actually using? None of current
 
 The latest, i.e. 2.4.
 
 versions would show you Watt usage for devices.
 
 Sure it does :)
 
 Summary: 3182.2 wakeups/second,  82.5 GPU ops/seconds, 0.0 VFS ops/sec and 
 33.5%
 
 Power est.  Usage   Events/sCategory   Description
   9.82 W100.0%  Device USB device: Yubico 
 Yubike
   2.67 W  4.1 ms/s  43.2Process/usr/bin/pulseaudio 
 --sta
   2.58 W100.0%  Device USB device: Integrated 
 Ca
   2.35 W100.0%  Device USB device: BCM20702A0 
 (B
   2.32 W 32.9%  Device Display backlight
   1.39 W100.0%  Device Radio device: btusb
   343 mW100.0%  Device Radio device: 
 thinkpad_ac

ah ok, i see, you right. In usb.cpp:
double usbdevice::power_usage(struct result_bundle *result, struct
parameter_bundle *bundle)
{
double power;
double factor;
double util;

if (rootport || !cached_valid)
return 0.0;


power = 0;
factor = get_parameter_value(index, bundle);
util = get_result_value(r_index, result);

power += util * factor / 100.0;

return power;
}



but, if i understand it correctly, this values are not provided by usb.
If you start powertop --calibrate it will switch on/off some devices
and measure global power usage.

-- 
Regards,
Oleksij
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cannot shutdown power use from built in webcam in thinkpad T530 questions]

2013-09-23 Thread Oleksij Rempel
Am 22.09.2013 22:36, schrieb Marc MERLIN:
 On Sun, Sep 22, 2013 at 04:32:08PM -0400, Alan Stern wrote:
 I'm somehow thinking there is a driver or hardware problem when the device
 does get stuck in a mode where it won't sleep properly again until the next
 reboot (just unloading/loading the driver does not fix this).

 That's quite possible.  But if it is a driver problem, wouldn't 
 unloading and reloading the driver fix it?
  
 You'd think that but it hasn't so far with this one device.
 
 You might get more information from a kernel with CONFIG_USB_DEBUG 
 enabled.  Especially if you add

 #define VERBOSE_DEBUG

 to drivers/usb/core/driver.c before the first #include line.

 Do you think thaty would help debug the problem above, or not really? I'm

 There's no way to know in advance.

 starting to think that the USB layer is not at fault, although I could be
 wrong I suppose.

 You asked for advice on things to try, and I suggested something.  
 That's the best I can do.
 
 Understood, just making sure this was still potentially useful considering
 what I found out since my last message.

Which version of powertop are you actually using? None of current
versions would show you Watt usage for devices.
you can use watch grep . * instead and check fallowing fields:
runtime_suspended_time - suspend time. If it is growing device is suspended
runtime_active_kids - if not zero, some program use it
control - if on then autosuspend is disabled.

-- 
Regards,
Oleksij
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cannot shutdown power use from built in webcam in thinkpad T530 questions]

2013-09-22 Thread Alan Stern
On Wed, 18 Sep 2013, Marc MERLIN wrote:

 Howdy,
 
 I have a T530 with a built in webcam that uses the uvcvideo driver.
 Kernel 3.10.6, but the problem has been there for many kernel versions.
 
 From time to time (not always) it shows up at the top of powertop with
 an unexplained high power use while I'm not using the camera.
 Powertop says autosuspend is active:
 Note that tunables says:
Good  Autosuspend for USB device Integrated Camera [Chicony 
 Electronics Co., Ltd.]
 
 Unloading uvcvideo makes no difference. However if I never load uvcvideo
 and never use the camera after booting the laptop, then the device
 doesn't use any power.
 This is better than nothing, but not very desirable since I do use the
 camera from time to google for video conferencing.
 
 Here's the module info
 gandalfthegreat:/sys/bus/usb/drivers/uvcvideo# l
 total 0
 drwxr-xr-x  2 root root0 Sep 18 17:48 ./
 drwxr-xr-x 12 root root0 Sep 17 15:10 ../
 lrwxrwxrwx  1 root root0 Sep 18 21:30 3-1.6:1.0 - 
 ../../../../devices/pci:00/:00:1a.0/usb3/3-1/3-1.6/3-1.6:1.0/
 lrwxrwxrwx  1 root root0 Sep 18 21:30 3-1.6:1.1 - 
 ../../../../devices/pci:00/:00:1a.0/usb3/3-1/3-1.6/3-1.6:1.1/
 --w---  1 root root 4096 Sep 18 21:30 bind
 lrwxrwxrwx  1 root root0 Sep 18 21:30 module - 
 ../../../../module/uvcvideo/
 -rw-r--r--  1 root root 4096 Sep 18 21:30 new_id
 -rw-r--r--  1 root root 4096 Sep 18 21:30 remove_id
 --w---  1 root root 4096 Sep 18 17:48 uevent
 --w---  1 root root 4096 Sep 18 21:30 unbind
 
 gandalfthegreat:/sys/bus/usb/devices/3-1.6/power# grep . *
 active_duration:61227648
 async:enabled
 autosuspend:2
 autosuspend_delay_ms:2000
 connected_duration:66830880
 control:auto
 level:auto
 persist:1
 runtime_active_kids:0
 runtime_active_time:18870052
 runtime_enabled:enabled
 runtime_status:active
 runtime_suspended_time:5324088
 runtime_usage:0

This all looks correct.

 Any ideas?

You might get more information from a kernel with CONFIG_USB_DEBUG 
enabled.  Especially if you add

#define VERBOSE_DEBUG

to drivers/usb/core/driver.c before the first #include line.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cannot shutdown power use from built in webcam in thinkpad T530 questions]

2013-09-22 Thread Marc MERLIN
On Sun, Sep 22, 2013 at 12:38:56PM -0400, Alan Stern wrote:
  gandalfthegreat:/sys/bus/usb/devices/3-1.6/power# grep . *
  active_duration:61227648
  async:enabled
  autosuspend:2
  autosuspend_delay_ms:2000
  connected_duration:66830880
  control:auto
  level:auto
  persist:1
  runtime_active_kids:0
  runtime_active_time:18870052
  runtime_enabled:enabled
  runtime_status:active
  runtime_suspended_time:5324088
  runtime_usage:0
 
 This all looks correct.
 
Since then, I've confirmed that I don't have the problem some time after
reboot. It may be that the device doesn't seem to sleep well after I've used
it once.

What's interesting, is that I see this when power is plugged in:

Power est.  Events/sCategory   Description
  8.18 W100.0%  Device USB device: Yubico Yubikey II (Yubico)
  8.13 W100.0%  Device USB device: Integrated Camera (Chicony 
Electronics Co., Ltd.)

Somehow I know that my Yubikey isn't using 8W, so powertop numbers need to
be taken with a grain of salt.


Once I go to batteries, I see this:
Summary: 760.1 wakeups/second,  718.9 GPU ops/seconds, 0.0 VFS ops/sec and 6.9% 
CPU use

Power est.  Usage   Events/sCategory   Description
  8.32 W100.0%  Device USB device: Yubico 
Yubikey II (Yubico)
  2.52 W 73.3%  Device Display backlight

So at least for now, the camera does sleep ok, until later when it probably 
won't again.

I'm somehow thinking there is a driver or hardware problem when the device
does get stuck in a mode where it won't sleep properly again until the next
reboot (just unloading/loading the driver does not fix this).

  Any ideas?
 
 You might get more information from a kernel with CONFIG_USB_DEBUG 
 enabled.  Especially if you add
 
 #define VERBOSE_DEBUG
 
 to drivers/usb/core/driver.c before the first #include line.

Do you think thaty would help debug the problem above, or not really? I'm
starting to think that the USB layer is not at fault, although I could be
wrong I suppose.

Thanks,
Marc
-- 
A mouse is a device used to point at the xterm you want to type in - A.S.R.
Microsoft is to operating systems 
   what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/  
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cannot shutdown power use from built in webcam in thinkpad T530 questions]

2013-09-22 Thread Alan Stern
On Sun, 22 Sep 2013, Marc MERLIN wrote:

 On Sun, Sep 22, 2013 at 12:38:56PM -0400, Alan Stern wrote:
   gandalfthegreat:/sys/bus/usb/devices/3-1.6/power# grep . *
   active_duration:61227648
   async:enabled
   autosuspend:2
   autosuspend_delay_ms:2000
   connected_duration:66830880
   control:auto
   level:auto
   persist:1
   runtime_active_kids:0
   runtime_active_time:18870052
   runtime_enabled:enabled
   runtime_status:active
   runtime_suspended_time:5324088
   runtime_usage:0
  
  This all looks correct.
  
 Since then, I've confirmed that I don't have the problem some time after
 reboot. It may be that the device doesn't seem to sleep well after I've used
 it once.
 
 What's interesting, is that I see this when power is plugged in:
 
 Power est.  Events/sCategory   Description
   8.18 W100.0%  Device USB device: Yubico Yubikey II (Yubico)
   8.13 W100.0%  Device USB device: Integrated Camera (Chicony 
 Electronics Co., Ltd.)
 
 Somehow I know that my Yubikey isn't using 8W, so powertop numbers need to
 be taken with a grain of salt.

I don't know where powertop gets its numbers from.  Perhaps it uses the
value reported by the device (bMaxPower).  That value is only a
maximum; it doesn't change to reflect the actual usage.

 Once I go to batteries, I see this:
 Summary: 760.1 wakeups/second,  718.9 GPU ops/seconds, 0.0 VFS ops/sec and 
 6.9% CPU use
 
 Power est.  Usage   Events/sCategory   Description
   8.32 W100.0%  Device USB device: Yubico 
 Yubikey II (Yubico)
   2.52 W 73.3%  Device Display backlight
 
 So at least for now, the camera does sleep ok, until later when it probably 
 won't again.
 
 I'm somehow thinking there is a driver or hardware problem when the device
 does get stuck in a mode where it won't sleep properly again until the next
 reboot (just unloading/loading the driver does not fix this).

That's quite possible.  But if it is a driver problem, wouldn't 
unloading and reloading the driver fix it?

  You might get more information from a kernel with CONFIG_USB_DEBUG 
  enabled.  Especially if you add
  
  #define VERBOSE_DEBUG
  
  to drivers/usb/core/driver.c before the first #include line.
 
 Do you think thaty would help debug the problem above, or not really? I'm

There's no way to know in advance.

 starting to think that the USB layer is not at fault, although I could be
 wrong I suppose.

You asked for advice on things to try, and I suggested something.  
That's the best I can do.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cannot shutdown power use from built in webcam in thinkpad T530 questions]

2013-09-22 Thread Marc MERLIN
On Sun, Sep 22, 2013 at 04:32:08PM -0400, Alan Stern wrote:
  I'm somehow thinking there is a driver or hardware problem when the device
  does get stuck in a mode where it won't sleep properly again until the next
  reboot (just unloading/loading the driver does not fix this).
 
 That's quite possible.  But if it is a driver problem, wouldn't 
 unloading and reloading the driver fix it?
 
You'd think that but it hasn't so far with this one device.

   You might get more information from a kernel with CONFIG_USB_DEBUG 
   enabled.  Especially if you add
   
   #define VERBOSE_DEBUG
   
   to drivers/usb/core/driver.c before the first #include line.
  
  Do you think thaty would help debug the problem above, or not really? I'm
 
 There's no way to know in advance.
 
  starting to think that the USB layer is not at fault, although I could be
  wrong I suppose.
 
 You asked for advice on things to try, and I suggested something.  
 That's the best I can do.

Understood, just making sure this was still potentially useful considering
what I found out since my last message.

Thanks for your help,
Marc
-- 
A mouse is a device used to point at the xterm you want to type in - A.S.R.
Microsoft is to operating systems 
   what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/  
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Cannot shutdown power use from built in webcam in thinkpad T530 questions]

2013-09-22 Thread Ming Lei
On Thu, Sep 19, 2013 at 12:35 PM, Marc MERLIN m...@merlins.org wrote:

 gandalfthegreat:/sys/bus/usb/devices/3-1.6/power# grep . *
 active_duration:61227648
 async:enabled
 autosuspend:2
 autosuspend_delay_ms:2000
 connected_duration:66830880
 control:auto
 level:auto
 persist:1
 runtime_active_kids:0
 runtime_active_time:18870052
 runtime_enabled:enabled
 runtime_status:active
 runtime_suspended_time:5324088
 runtime_usage:0

The uvc device should have been put in auto-suspend state if no
application is using the device.  You can check if there is application
which is using the device by 'lsof | grep /dev/video'.

Also looks power usage estimation of 'power top' should be used
when battery provides power, and the data isn't correct if power is
provided from power adapter, if I remember correctly.

Thanks,
-- 
Ming Lei
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cannot shutdown power use from built in webcam in thinkpad T530 questions]

2013-09-21 Thread Marc MERLIN
Howdy,

I have a T530 with a built in webcam that uses the uvcvideo driver.
Kernel 3.10.6, but the problem has been there for many kernel versions.

From time to time (not always) it shows up at the top of powertop with
an unexplained high power use while I'm not using the camera.
Powertop says autosuspend is active:
Note that tunables says:
   Good  Autosuspend for USB device Integrated Camera [Chicony 
Electronics Co., Ltd.]

Unloading uvcvideo makes no difference. However if I never load uvcvideo
and never use the camera after booting the laptop, then the device
doesn't use any power.
This is better than nothing, but not very desirable since I do use the
camera from time to google for video conferencing.

Here's the module info
gandalfthegreat:/sys/bus/usb/drivers/uvcvideo# l
total 0
drwxr-xr-x  2 root root0 Sep 18 17:48 ./
drwxr-xr-x 12 root root0 Sep 17 15:10 ../
lrwxrwxrwx  1 root root0 Sep 18 21:30 3-1.6:1.0 - 
../../../../devices/pci:00/:00:1a.0/usb3/3-1/3-1.6/3-1.6:1.0/
lrwxrwxrwx  1 root root0 Sep 18 21:30 3-1.6:1.1 - 
../../../../devices/pci:00/:00:1a.0/usb3/3-1/3-1.6/3-1.6:1.1/
--w---  1 root root 4096 Sep 18 21:30 bind
lrwxrwxrwx  1 root root0 Sep 18 21:30 module - ../../../../module/uvcvideo/
-rw-r--r--  1 root root 4096 Sep 18 21:30 new_id
-rw-r--r--  1 root root 4096 Sep 18 21:30 remove_id
--w---  1 root root 4096 Sep 18 17:48 uevent
--w---  1 root root 4096 Sep 18 21:30 unbind

gandalfthegreat:/sys/bus/usb/devices/3-1.6/power# grep . *
active_duration:61227648
async:enabled
autosuspend:2
autosuspend_delay_ms:2000
connected_duration:66830880
control:auto
level:auto
persist:1
runtime_active_kids:0
runtime_active_time:18870052
runtime_enabled:enabled
runtime_status:active
runtime_suspended_time:5324088
runtime_usage:0

powertop 2.4 output:
-
The battery reports a discharge rate of 18.4 W
The estimated remaining time is 4 hours, 18 minutes

Summary: 657.6 wakeups/second,  28.4 GPU ops/seconds, 0.0 VFS ops/sec and 9.3% 
CPU use

Power est.  Usage   Events/s   Category   Description
  12.2 W100.0% Device USB device: Integrated Camera 
(Chicony Electronics Co., Ltd.)
  997 mW 60.0% Device Display backlight
 76.1 mW 34.9 µs/s  34.8   Process[rcu_preempt]
 23.1 mW  1.5 ms/s  16.5   Processxfce4-terminal -T window11 
--role=window11
 9.20 mW 59.0 ms/s 347.4   Process/usr/bin/enlightenment
-


Now after I resumed from S3 sleep, this time I'm seeing
  210 mW100.0%   Device USB device: Integrated Camera (Chicony Electronics 
Co., Ltd.)
While the 100% is bad, 210mW isn't as bad compared to 12W below (I'm sure it's 
not really 12W).


Any ideas?

Thanks,
Marc
-- 
A mouse is a device used to point at the xterm you want to type in - A.S.R.
Microsoft is to operating systems 
   what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/ | PGP 1024R/763BE901

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html