diff options
author | Alexey Starikovskiy <astarikovskiy@suse.de> | 2007-06-23 16:24:48 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-06-23 16:24:48 -0400 |
commit | addad45494cb4f9c03470a4e5155f442791b0d7f (patch) | |
tree | 03eadbc093954233143a3db425ad115b4bcb9f85 /drivers/acpi/sbs.c | |
parent | 75154f402ef18e459ff97ddece25656b6c2b329c (diff) |
ACPI: sbs: probe smart battery vis SMBus controller
http://bugzilla.kernel.org/show_bug.cgi?id=8559
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/sbs.c')
-rw-r--r-- | drivers/acpi/sbs.c | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index c1bae106833c..974d00ccfe84 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -127,7 +127,7 @@ static int acpi_sbs_resume(struct acpi_device *device); | |||
127 | static struct acpi_driver acpi_sbs_driver = { | 127 | static struct acpi_driver acpi_sbs_driver = { |
128 | .name = "sbs", | 128 | .name = "sbs", |
129 | .class = ACPI_SBS_CLASS, | 129 | .class = ACPI_SBS_CLASS, |
130 | .ids = ACPI_SBS_HID, | 130 | .ids = "ACPI0001,ACPI0005", |
131 | .ops = { | 131 | .ops = { |
132 | .add = acpi_sbs_add, | 132 | .add = acpi_sbs_add, |
133 | .remove = acpi_sbs_remove, | 133 | .remove = acpi_sbs_remove, |
@@ -176,10 +176,8 @@ struct acpi_battery { | |||
176 | }; | 176 | }; |
177 | 177 | ||
178 | struct acpi_sbs { | 178 | struct acpi_sbs { |
179 | acpi_handle handle; | ||
180 | int base; | 179 | int base; |
181 | struct acpi_device *device; | 180 | struct acpi_device *device; |
182 | struct acpi_ec_smbus *smbus; | ||
183 | struct mutex mutex; | 181 | struct mutex mutex; |
184 | int sbsm_present; | 182 | int sbsm_present; |
185 | int sbsm_batteries_supported; | 183 | int sbsm_batteries_supported; |
@@ -511,7 +509,7 @@ static int acpi_sbsm_get_info(struct acpi_sbs *sbs) | |||
511 | "acpi_sbs_read_word() failed")); | 509 | "acpi_sbs_read_word() failed")); |
512 | goto end; | 510 | goto end; |
513 | } | 511 | } |
514 | 512 | sbs->sbsm_present = 1; | |
515 | sbs->sbsm_batteries_supported = battery_system_info & 0x000f; | 513 | sbs->sbsm_batteries_supported = battery_system_info & 0x000f; |
516 | 514 | ||
517 | end: | 515 | end: |
@@ -1630,13 +1628,12 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
1630 | { | 1628 | { |
1631 | struct acpi_sbs *sbs = NULL; | 1629 | struct acpi_sbs *sbs = NULL; |
1632 | int result = 0, remove_result = 0; | 1630 | int result = 0, remove_result = 0; |
1633 | unsigned long sbs_obj; | ||
1634 | int id; | 1631 | int id; |
1635 | acpi_status status = AE_OK; | 1632 | acpi_status status = AE_OK; |
1636 | unsigned long val; | 1633 | unsigned long val; |
1637 | 1634 | ||
1638 | status = | 1635 | status = |
1639 | acpi_evaluate_integer(device->parent->handle, "_EC", NULL, &val); | 1636 | acpi_evaluate_integer(device->handle, "_EC", NULL, &val); |
1640 | if (ACPI_FAILURE(status)) { | 1637 | if (ACPI_FAILURE(status)) { |
1641 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, "Error obtaining _EC")); | 1638 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, "Error obtaining _EC")); |
1642 | return -EIO; | 1639 | return -EIO; |
@@ -1653,7 +1650,7 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
1653 | 1650 | ||
1654 | sbs_mutex_lock(sbs); | 1651 | sbs_mutex_lock(sbs); |
1655 | 1652 | ||
1656 | sbs->base = (val & 0xff00ull) >> 8; | 1653 | sbs->base = 0xff & (val >> 8); |
1657 | sbs->device = device; | 1654 | sbs->device = device; |
1658 | 1655 | ||
1659 | strcpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME); | 1656 | strcpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME); |
@@ -1665,24 +1662,10 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
1665 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, "acpi_ac_add() failed")); | 1662 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, "acpi_ac_add() failed")); |
1666 | goto end; | 1663 | goto end; |
1667 | } | 1664 | } |
1668 | status = acpi_evaluate_integer(device->handle, "_SBS", NULL, &sbs_obj); | ||
1669 | if (status) { | ||
1670 | ACPI_EXCEPTION((AE_INFO, status, | ||
1671 | "acpi_evaluate_integer() failed")); | ||
1672 | result = -EIO; | ||
1673 | goto end; | ||
1674 | } | ||
1675 | if (sbs_obj > 0) { | ||
1676 | result = acpi_sbsm_get_info(sbs); | ||
1677 | if (result) { | ||
1678 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | ||
1679 | "acpi_sbsm_get_info() failed")); | ||
1680 | goto end; | ||
1681 | } | ||
1682 | sbs->sbsm_present = 1; | ||
1683 | } | ||
1684 | 1665 | ||
1685 | if (sbs->sbsm_present == 0) { | 1666 | acpi_sbsm_get_info(sbs); |
1667 | |||
1668 | if (!sbs->sbsm_present) { | ||
1686 | result = acpi_battery_add(sbs, 0); | 1669 | result = acpi_battery_add(sbs, 0); |
1687 | if (result) { | 1670 | if (result) { |
1688 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 1671 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
@@ -1702,8 +1685,6 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
1702 | } | 1685 | } |
1703 | } | 1686 | } |
1704 | 1687 | ||
1705 | sbs->handle = device->handle; | ||
1706 | |||
1707 | init_timer(&sbs->update_timer); | 1688 | init_timer(&sbs->update_timer); |
1708 | result = acpi_check_update_proc(sbs); | 1689 | result = acpi_check_update_proc(sbs); |
1709 | if (result) | 1690 | if (result) |