From patchwork Wed Apr 27 18:49:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/4] Lenovo H8: add h8_ultrabay_device_present() Date: Wed, 27 Apr 2011 18:49:02 -0000 From: Sven Schnelle X-Patchwork-Id: 2922 Message-Id: <1303930145-9065-2-git-send-email-svens@stackframe.org> To: coreboot@coreboot.org Cc: svens@stackframe.org Signed-off-by: Sven Schnelle --- src/ec/lenovo/h8/h8.c | 6 ++++++ src/ec/lenovo/h8/h8.h | 5 +++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c index 6a59525..fafaef2 100644 --- a/src/ec/lenovo/h8/h8.c +++ b/src/ec/lenovo/h8/h8.c @@ -87,6 +87,12 @@ void h8_disable_event(int event) } +int h8_ultrabay_device_present(void) +{ + return ec_read(H8_STATUS1) & 0x5 ? 0 : 1; +} + + static void h8_enable(device_t dev) { struct ec_lenovo_h8_config *conf = dev->chip_info; diff --git a/src/ec/lenovo/h8/h8.h b/src/ec/lenovo/h8/h8.h index d263313..b5d8f01 100644 --- a/src/ec/lenovo/h8/h8.h +++ b/src/ec/lenovo/h8/h8.h @@ -25,6 +25,7 @@ void h8_wlan_enable(int on); void h8_set_audio_mute(int on); void h8_enable_event(int event); void h8_disable_event(int event); +int h8_ultrabay_device_present(void); /* EC registers */ #define H8_CONFIG0 0x00 @@ -102,6 +103,10 @@ void h8_disable_event(int event); #define H8_EVENT_FN_PRESS 0x39 +#define H8_STATUS0 0x46 +#define H8_STATUS1 0x47 +#define H8_STATUS2 0x48 + #define H8_EVENT_BAT0 0x4a #define H8_EVENT_BAT0_STATE 0x4b