13 #include <linux/wait.h>
14 #include <linux/slab.h>
16 #include <linux/module.h>
20 #define PREFIX "ACPI: "
22 #define ACPI_SMB_HC_CLASS "smbus_host_ctl"
23 #define ACPI_SMB_HC_DEVICE_NAME "ACPI SMBus HC"
35 static int acpi_smbus_hc_add(
struct acpi_device *
device);
36 static int acpi_smbus_hc_remove(
struct acpi_device *
device,
int type);
46 static struct acpi_driver acpi_smb_hc_driver = {
49 .ids = sbs_device_ids,
51 .add = acpi_smbus_hc_add,
52 .remove = acpi_smbus_hc_remove,
101 static inline int smb_check_done(
struct acpi_smb_hc *hc)
108 static int wait_transaction_complete(
struct acpi_smb_hc *hc,
int timeout)
118 if (smb_check_done(hc))
143 if (!(protocol & 0x01)) {
154 ret = wait_transaction_complete(hc, 1000);
155 if (ret || !(protocol & 0x01))
173 for (i = 0; i < sz; ++
i)
181 u8 command,
u8 *data)
183 return acpi_smbus_transaction(hc, protocol, address, command, data, 0);
189 u8 command,
u8 *data,
u8 length)
191 return acpi_smbus_transaction(hc, protocol, address, command, data, length);
219 static inline void acpi_smbus_callback(
void *
context)
226 static int smbus_alarm(
void *context)
243 switch (address >> 1) {
248 acpi_smbus_callback, hc);
261 static int acpi_smbus_hc_add(
struct acpi_device *
device)
264 unsigned long long val;
285 hc->
ec = acpi_driver_data(device->parent);
286 hc->
offset = (val >> 8) & 0xff;
288 device->driver_data = hc;
299 static int acpi_smbus_hc_remove(
struct acpi_device *device,
int type)
306 hc = acpi_driver_data(device);
309 device->driver_data =
NULL;