Lenovo H8 EC: add usb_power_enable()
authorSven Schnelle <svens@stackframe.org>
Thu, 16 Jun 2011 14:43:04 +0000 (16:43 +0200)
committerSven Schnelle <svens@stackframe.org>
Thu, 16 Jun 2011 15:00:12 +0000 (17:00 +0200)
Can be used to disable/enable Power output on USB ports.

Change-Id: I5eb52b33c9e3359b0e5874bda2c0c8d75c196bc2
Signed-off-by: Sven Schnelle <svens@stackframe.org>
Reviewed-on: http://review.coreboot.org/37
Tested-by: build bot (Jenkins)
src/ec/lenovo/h8/acpi/ec.asl
src/ec/lenovo/h8/h8.c
src/ec/lenovo/h8/h8.h

index 0bcf44159c38e358f0546ab4de0b53106ffb11dd..3ba4aa9819aba25ad74154adbb59944272d2f956 100644 (file)
@@ -40,6 +40,8 @@ Device(EC)
                Offset (0x3B),
                                    , 1,
                                KBLT, 1,        /* Keyboard Light */
+                                   , 2,
+                               USPW, 1,        /* USB Power enable */
                Offset (0x4e),
                               WAKE, 16,
                Offset (0x78),
@@ -73,6 +75,12 @@ Device(EC)
                Store(Arg0, AMUT)
        }
 
+       Method (USBP, 1, NotSerialized)
+       {
+               Store(Arg0, USPW)
+       }
+
+
        /* Sleep Button pressed */
        Method(_Q13, 0, NotSerialized)
        {
index ef308b1bace63ce48c2794b2ed567f189f07edda..2c25d29141341843e0f1e81fb9b69c7528ef8be2 100644 (file)
@@ -88,6 +88,14 @@ void h8_disable_event(int event)
 
 }
 
+void h8_usb_power_enable(int onoff)
+{
+       if (onoff)
+               ec_set_bit(0x3b, 4);
+       else
+               ec_clr_bit(0x3b, 4);
+}
+
 int h8_ultrabay_device_present(void)
 {
        return ec_read(H8_STATUS1) & 0x5 ? 0 : 1;
@@ -129,6 +137,7 @@ static void h8_enable(device_t dev)
        ec_write(H8_FAN_CONTROL, H8_FAN_CONTROL_AUTO);
        h8_wlan_enable(conf->wlan_enable);
        h8_trackpoint_enable(conf->trackpoint_enable);
+       h8_usb_power_enable(1);
 
        if (!get_option(&val, "volume"))
                ec_write(H8_VOLUME_CONTROL, val);
index c87ace43c934579dde3e41fcc9e59cf028414fd1..717c0ce97c2eb44af8ea1319fa8b281c537dc450 100644 (file)
@@ -23,6 +23,7 @@
 void h8_trackpoint_enable(int on);
 void h8_wlan_enable(int on);
 void h8_set_audio_mute(int on);
+void h8_usb_power_enable(int on);
 void h8_enable_event(int event);
 void h8_disable_event(int event);
 int h8_ultrabay_device_present(void);