1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * sbs.c - ACPI Smart Battery System Driver ($Revision: 2.0 $)
5 * Copyright (c) 2007 Alexey Starikovskiy <astarikovskiy@suse.de>
6 * Copyright (c) 2005-2007 Vladimir Lebedev <vladimir.p.lebedev@intel.com>
7 * Copyright (c) 2005 Rich Townsend <rhdt@bartol.udel.edu>
10 #include <linux/init.h>
11 #include <linux/slab.h>
12 #include <linux/module.h>
13 #include <linux/moduleparam.h>
14 #include <linux/kernel.h>
16 #include <linux/acpi.h>
17 #include <linux/timer.h>
18 #include <linux/jiffies.h>
19 #include <linux/delay.h>
20 #include <linux/power_supply.h>
21 #include <linux/platform_data/x86/apple.h>
22 #include <acpi/battery.h>
26 #define PREFIX "ACPI: "
28 #define ACPI_SBS_CLASS "sbs"
29 #define ACPI_AC_CLASS "ac_adapter"
30 #define ACPI_SBS_DEVICE_NAME "Smart Battery System"
31 #define ACPI_SBS_FILE_INFO "info"
32 #define ACPI_SBS_FILE_STATE "state"
33 #define ACPI_SBS_FILE_ALARM "alarm"
34 #define ACPI_BATTERY_DIR_NAME "BAT%i"
35 #define ACPI_AC_DIR_NAME "AC0"
37 #define ACPI_SBS_NOTIFY_STATUS 0x80
38 #define ACPI_SBS_NOTIFY_INFO 0x81
40 MODULE_AUTHOR("Alexey Starikovskiy <astarikovskiy@suse.de>");
41 MODULE_DESCRIPTION("Smart Battery System ACPI interface driver");
42 MODULE_LICENSE("GPL");
44 static unsigned int cache_time
= 1000;
45 module_param(cache_time
, uint
, 0644);
46 MODULE_PARM_DESC(cache_time
, "cache time in milliseconds");
49 #define ACPI_SBS_BLOCK_MAX 32
51 static const struct acpi_device_id sbs_device_ids
[] = {
55 MODULE_DEVICE_TABLE(acpi
, sbs_device_ids
);
58 struct power_supply
*bat
;
59 struct power_supply_desc bat_desc
;
61 unsigned long update_time
;
63 char manufacturer_name
[ACPI_SBS_BLOCK_MAX
];
64 char device_name
[ACPI_SBS_BLOCK_MAX
];
65 char device_chemistry
[ACPI_SBS_BLOCK_MAX
];
67 u16 full_charge_capacity
;
83 u8 have_sysfs_alarm
:1;
86 #define to_acpi_battery(x) power_supply_get_drvdata(x)
89 struct power_supply
*charger
;
90 struct acpi_device
*device
;
91 struct acpi_smb_hc
*hc
;
93 struct acpi_battery battery
[MAX_SBS_BAT
];
94 u8 batteries_supported
:4;
100 #define to_acpi_sbs(x) power_supply_get_drvdata(x)
102 static int acpi_sbs_remove(struct acpi_device
*device
);
103 static int acpi_battery_get_state(struct acpi_battery
*battery
);
105 static inline int battery_scale(int log
)
113 static inline int acpi_battery_vscale(struct acpi_battery
*battery
)
115 return battery_scale((battery
->spec
& 0x0f00) >> 8);
118 static inline int acpi_battery_ipscale(struct acpi_battery
*battery
)
120 return battery_scale((battery
->spec
& 0xf000) >> 12);
123 static inline int acpi_battery_mode(struct acpi_battery
*battery
)
125 return (battery
->mode
& 0x8000);
128 static inline int acpi_battery_scale(struct acpi_battery
*battery
)
130 return (acpi_battery_mode(battery
) ? 10 : 1) *
131 acpi_battery_ipscale(battery
);
134 static int sbs_get_ac_property(struct power_supply
*psy
,
135 enum power_supply_property psp
,
136 union power_supply_propval
*val
)
138 struct acpi_sbs
*sbs
= to_acpi_sbs(psy
);
140 case POWER_SUPPLY_PROP_ONLINE
:
141 val
->intval
= sbs
->charger_present
;
149 static int acpi_battery_technology(struct acpi_battery
*battery
)
151 if (!strcasecmp("NiCd", battery
->device_chemistry
))
152 return POWER_SUPPLY_TECHNOLOGY_NiCd
;
153 if (!strcasecmp("NiMH", battery
->device_chemistry
))
154 return POWER_SUPPLY_TECHNOLOGY_NiMH
;
155 if (!strcasecmp("LION", battery
->device_chemistry
))
156 return POWER_SUPPLY_TECHNOLOGY_LION
;
157 if (!strcasecmp("LiP", battery
->device_chemistry
))
158 return POWER_SUPPLY_TECHNOLOGY_LIPO
;
159 return POWER_SUPPLY_TECHNOLOGY_UNKNOWN
;
162 static int acpi_sbs_battery_get_property(struct power_supply
*psy
,
163 enum power_supply_property psp
,
164 union power_supply_propval
*val
)
166 struct acpi_battery
*battery
= to_acpi_battery(psy
);
168 if ((!battery
->present
) && psp
!= POWER_SUPPLY_PROP_PRESENT
)
171 acpi_battery_get_state(battery
);
173 case POWER_SUPPLY_PROP_STATUS
:
174 if (battery
->rate_now
< 0)
175 val
->intval
= POWER_SUPPLY_STATUS_DISCHARGING
;
176 else if (battery
->rate_now
> 0)
177 val
->intval
= POWER_SUPPLY_STATUS_CHARGING
;
179 val
->intval
= POWER_SUPPLY_STATUS_FULL
;
181 case POWER_SUPPLY_PROP_PRESENT
:
182 val
->intval
= battery
->present
;
184 case POWER_SUPPLY_PROP_TECHNOLOGY
:
185 val
->intval
= acpi_battery_technology(battery
);
187 case POWER_SUPPLY_PROP_CYCLE_COUNT
:
188 val
->intval
= battery
->cycle_count
;
190 case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN
:
191 val
->intval
= battery
->design_voltage
*
192 acpi_battery_vscale(battery
) * 1000;
194 case POWER_SUPPLY_PROP_VOLTAGE_NOW
:
195 val
->intval
= battery
->voltage_now
*
196 acpi_battery_vscale(battery
) * 1000;
198 case POWER_SUPPLY_PROP_CURRENT_NOW
:
199 case POWER_SUPPLY_PROP_POWER_NOW
:
200 val
->intval
= abs(battery
->rate_now
) *
201 acpi_battery_ipscale(battery
) * 1000;
202 val
->intval
*= (acpi_battery_mode(battery
)) ?
203 (battery
->voltage_now
*
204 acpi_battery_vscale(battery
) / 1000) : 1;
206 case POWER_SUPPLY_PROP_CURRENT_AVG
:
207 case POWER_SUPPLY_PROP_POWER_AVG
:
208 val
->intval
= abs(battery
->rate_avg
) *
209 acpi_battery_ipscale(battery
) * 1000;
210 val
->intval
*= (acpi_battery_mode(battery
)) ?
211 (battery
->voltage_now
*
212 acpi_battery_vscale(battery
) / 1000) : 1;
214 case POWER_SUPPLY_PROP_CAPACITY
:
215 val
->intval
= battery
->state_of_charge
;
217 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN
:
218 case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN
:
219 val
->intval
= battery
->design_capacity
*
220 acpi_battery_scale(battery
) * 1000;
222 case POWER_SUPPLY_PROP_CHARGE_FULL
:
223 case POWER_SUPPLY_PROP_ENERGY_FULL
:
224 val
->intval
= battery
->full_charge_capacity
*
225 acpi_battery_scale(battery
) * 1000;
227 case POWER_SUPPLY_PROP_CHARGE_NOW
:
228 case POWER_SUPPLY_PROP_ENERGY_NOW
:
229 val
->intval
= battery
->capacity_now
*
230 acpi_battery_scale(battery
) * 1000;
232 case POWER_SUPPLY_PROP_TEMP
:
233 val
->intval
= battery
->temp_now
- 2730; // dK -> dC
235 case POWER_SUPPLY_PROP_MODEL_NAME
:
236 val
->strval
= battery
->device_name
;
238 case POWER_SUPPLY_PROP_MANUFACTURER
:
239 val
->strval
= battery
->manufacturer_name
;
247 static enum power_supply_property sbs_ac_props
[] = {
248 POWER_SUPPLY_PROP_ONLINE
,
251 static enum power_supply_property sbs_charge_battery_props
[] = {
252 POWER_SUPPLY_PROP_STATUS
,
253 POWER_SUPPLY_PROP_PRESENT
,
254 POWER_SUPPLY_PROP_TECHNOLOGY
,
255 POWER_SUPPLY_PROP_CYCLE_COUNT
,
256 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN
,
257 POWER_SUPPLY_PROP_VOLTAGE_NOW
,
258 POWER_SUPPLY_PROP_CURRENT_NOW
,
259 POWER_SUPPLY_PROP_CURRENT_AVG
,
260 POWER_SUPPLY_PROP_CAPACITY
,
261 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN
,
262 POWER_SUPPLY_PROP_CHARGE_FULL
,
263 POWER_SUPPLY_PROP_CHARGE_NOW
,
264 POWER_SUPPLY_PROP_TEMP
,
265 POWER_SUPPLY_PROP_MODEL_NAME
,
266 POWER_SUPPLY_PROP_MANUFACTURER
,
269 static enum power_supply_property sbs_energy_battery_props
[] = {
270 POWER_SUPPLY_PROP_STATUS
,
271 POWER_SUPPLY_PROP_PRESENT
,
272 POWER_SUPPLY_PROP_TECHNOLOGY
,
273 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN
,
274 POWER_SUPPLY_PROP_VOLTAGE_NOW
,
275 POWER_SUPPLY_PROP_CURRENT_NOW
,
276 POWER_SUPPLY_PROP_CURRENT_AVG
,
277 POWER_SUPPLY_PROP_POWER_NOW
,
278 POWER_SUPPLY_PROP_POWER_AVG
,
279 POWER_SUPPLY_PROP_CAPACITY
,
280 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN
,
281 POWER_SUPPLY_PROP_ENERGY_FULL
,
282 POWER_SUPPLY_PROP_ENERGY_NOW
,
283 POWER_SUPPLY_PROP_TEMP
,
284 POWER_SUPPLY_PROP_MODEL_NAME
,
285 POWER_SUPPLY_PROP_MANUFACTURER
,
288 static const struct power_supply_desc acpi_sbs_charger_desc
= {
289 .name
= "sbs-charger",
290 .type
= POWER_SUPPLY_TYPE_MAINS
,
291 .properties
= sbs_ac_props
,
292 .num_properties
= ARRAY_SIZE(sbs_ac_props
),
293 .get_property
= sbs_get_ac_property
,
296 /* --------------------------------------------------------------------------
297 Smart Battery System Management
298 -------------------------------------------------------------------------- */
300 struct acpi_battery_reader
{
301 u8 command
; /* command for battery */
302 u8 mode
; /* word or block? */
303 size_t offset
; /* offset inside struct acpi_sbs_battery */
306 static struct acpi_battery_reader info_readers
[] = {
307 {0x01, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, alarm_capacity
)},
308 {0x03, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, mode
)},
309 {0x10, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, full_charge_capacity
)},
310 {0x17, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, cycle_count
)},
311 {0x18, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, design_capacity
)},
312 {0x19, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, design_voltage
)},
313 {0x1a, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, spec
)},
314 {0x1c, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, serial_number
)},
315 {0x20, SMBUS_READ_BLOCK
, offsetof(struct acpi_battery
, manufacturer_name
)},
316 {0x21, SMBUS_READ_BLOCK
, offsetof(struct acpi_battery
, device_name
)},
317 {0x22, SMBUS_READ_BLOCK
, offsetof(struct acpi_battery
, device_chemistry
)},
320 static struct acpi_battery_reader state_readers
[] = {
321 {0x08, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, temp_now
)},
322 {0x09, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, voltage_now
)},
323 {0x0a, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, rate_now
)},
324 {0x0b, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, rate_avg
)},
325 {0x0f, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, capacity_now
)},
326 {0x0e, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, state_of_charge
)},
327 {0x16, SMBUS_READ_WORD
, offsetof(struct acpi_battery
, state
)},
330 static int acpi_manager_get_info(struct acpi_sbs
*sbs
)
333 u16 battery_system_info
;
335 result
= acpi_smbus_read(sbs
->hc
, SMBUS_READ_WORD
, ACPI_SBS_MANAGER
,
336 0x04, (u8
*)&battery_system_info
);
338 sbs
->batteries_supported
= battery_system_info
& 0x000f;
342 static int acpi_battery_get_info(struct acpi_battery
*battery
)
346 for (i
= 0; i
< ARRAY_SIZE(info_readers
); ++i
) {
347 result
= acpi_smbus_read(battery
->sbs
->hc
,
348 info_readers
[i
].mode
,
350 info_readers
[i
].command
,
352 info_readers
[i
].offset
);
359 static int acpi_battery_get_state(struct acpi_battery
*battery
)
363 if (battery
->update_time
&&
364 time_before(jiffies
, battery
->update_time
+
365 msecs_to_jiffies(cache_time
)))
367 for (i
= 0; i
< ARRAY_SIZE(state_readers
); ++i
) {
368 result
= acpi_smbus_read(battery
->sbs
->hc
,
369 state_readers
[i
].mode
,
371 state_readers
[i
].command
,
373 state_readers
[i
].offset
);
378 battery
->update_time
= jiffies
;
382 static int acpi_battery_get_alarm(struct acpi_battery
*battery
)
384 return acpi_smbus_read(battery
->sbs
->hc
, SMBUS_READ_WORD
,
385 ACPI_SBS_BATTERY
, 0x01,
386 (u8
*)&battery
->alarm_capacity
);
389 static int acpi_battery_set_alarm(struct acpi_battery
*battery
)
391 struct acpi_sbs
*sbs
= battery
->sbs
;
392 u16 value
, sel
= 1 << (battery
->id
+ 12);
397 if (sbs
->manager_present
) {
398 ret
= acpi_smbus_read(sbs
->hc
, SMBUS_READ_WORD
, ACPI_SBS_MANAGER
,
402 if ((value
& 0xf000) != sel
) {
405 ret
= acpi_smbus_write(sbs
->hc
, SMBUS_WRITE_WORD
,
407 0x01, (u8
*)&value
, 2);
412 ret
= acpi_smbus_write(sbs
->hc
, SMBUS_WRITE_WORD
, ACPI_SBS_BATTERY
,
413 0x01, (u8
*)&battery
->alarm_capacity
, 2);
418 static int acpi_ac_get_present(struct acpi_sbs
*sbs
)
423 result
= acpi_smbus_read(sbs
->hc
, SMBUS_READ_WORD
, ACPI_SBS_CHARGER
,
424 0x13, (u8
*) & status
);
430 * The spec requires that bit 4 always be 1. If it's not set, assume
431 * that the implementation doesn't support an SBS charger.
433 * And on some MacBooks a status of 0xffff is always returned, no
434 * matter whether the charger is plugged in or not, which is also
435 * wrong, so ignore the SBS charger for those too.
437 if (!((status
>> 4) & 0x1) || status
== 0xffff)
440 sbs
->charger_present
= (status
>> 15) & 0x1;
444 static ssize_t
acpi_battery_alarm_show(struct device
*dev
,
445 struct device_attribute
*attr
,
448 struct acpi_battery
*battery
= to_acpi_battery(dev_get_drvdata(dev
));
449 acpi_battery_get_alarm(battery
);
450 return sprintf(buf
, "%d\n", battery
->alarm_capacity
*
451 acpi_battery_scale(battery
) * 1000);
454 static ssize_t
acpi_battery_alarm_store(struct device
*dev
,
455 struct device_attribute
*attr
,
456 const char *buf
, size_t count
)
459 struct acpi_battery
*battery
= to_acpi_battery(dev_get_drvdata(dev
));
460 if (sscanf(buf
, "%lu\n", &x
) == 1)
461 battery
->alarm_capacity
= x
/
462 (1000 * acpi_battery_scale(battery
));
463 if (battery
->present
)
464 acpi_battery_set_alarm(battery
);
468 static const struct device_attribute alarm_attr
= {
469 .attr
= {.name
= "alarm", .mode
= 0644},
470 .show
= acpi_battery_alarm_show
,
471 .store
= acpi_battery_alarm_store
,
474 /* --------------------------------------------------------------------------
476 -------------------------------------------------------------------------- */
477 static int acpi_battery_read(struct acpi_battery
*battery
)
479 int result
= 0, saved_present
= battery
->present
;
482 if (battery
->sbs
->manager_present
) {
483 result
= acpi_smbus_read(battery
->sbs
->hc
, SMBUS_READ_WORD
,
484 ACPI_SBS_MANAGER
, 0x01, (u8
*)&state
);
486 battery
->present
= state
& (1 << battery
->id
);
488 state
|= 1 << (battery
->id
+ 12);
489 acpi_smbus_write(battery
->sbs
->hc
, SMBUS_WRITE_WORD
,
490 ACPI_SBS_MANAGER
, 0x01, (u8
*)&state
, 2);
491 } else if (battery
->id
== 0)
492 battery
->present
= 1;
494 if (result
|| !battery
->present
)
497 if (saved_present
!= battery
->present
) {
498 battery
->update_time
= 0;
499 result
= acpi_battery_get_info(battery
);
501 battery
->present
= 0;
505 result
= acpi_battery_get_state(battery
);
507 battery
->present
= 0;
512 static int acpi_battery_add(struct acpi_sbs
*sbs
, int id
)
514 struct acpi_battery
*battery
= &sbs
->battery
[id
];
515 struct power_supply_config psy_cfg
= { .drv_data
= battery
, };
520 result
= acpi_battery_read(battery
);
524 sprintf(battery
->name
, ACPI_BATTERY_DIR_NAME
, id
);
525 battery
->bat_desc
.name
= battery
->name
;
526 battery
->bat_desc
.type
= POWER_SUPPLY_TYPE_BATTERY
;
527 if (!acpi_battery_mode(battery
)) {
528 battery
->bat_desc
.properties
= sbs_charge_battery_props
;
529 battery
->bat_desc
.num_properties
=
530 ARRAY_SIZE(sbs_charge_battery_props
);
532 battery
->bat_desc
.properties
= sbs_energy_battery_props
;
533 battery
->bat_desc
.num_properties
=
534 ARRAY_SIZE(sbs_energy_battery_props
);
536 battery
->bat_desc
.get_property
= acpi_sbs_battery_get_property
;
537 battery
->bat
= power_supply_register(&sbs
->device
->dev
,
538 &battery
->bat_desc
, &psy_cfg
);
539 if (IS_ERR(battery
->bat
)) {
540 result
= PTR_ERR(battery
->bat
);
545 result
= device_create_file(&battery
->bat
->dev
, &alarm_attr
);
548 battery
->have_sysfs_alarm
= 1;
550 printk(KERN_INFO PREFIX
"%s [%s]: Battery Slot [%s] (battery %s)\n",
551 ACPI_SBS_DEVICE_NAME
, acpi_device_bid(sbs
->device
),
552 battery
->name
, battery
->present
? "present" : "absent");
556 static void acpi_battery_remove(struct acpi_sbs
*sbs
, int id
)
558 struct acpi_battery
*battery
= &sbs
->battery
[id
];
561 if (battery
->have_sysfs_alarm
)
562 device_remove_file(&battery
->bat
->dev
, &alarm_attr
);
563 power_supply_unregister(battery
->bat
);
567 static int acpi_charger_add(struct acpi_sbs
*sbs
)
570 struct power_supply_config psy_cfg
= { .drv_data
= sbs
, };
572 result
= acpi_ac_get_present(sbs
);
576 sbs
->charger_exists
= 1;
577 sbs
->charger
= power_supply_register(&sbs
->device
->dev
,
578 &acpi_sbs_charger_desc
, &psy_cfg
);
579 if (IS_ERR(sbs
->charger
)) {
580 result
= PTR_ERR(sbs
->charger
);
583 printk(KERN_INFO PREFIX
"%s [%s]: AC Adapter [%s] (%s)\n",
584 ACPI_SBS_DEVICE_NAME
, acpi_device_bid(sbs
->device
),
585 ACPI_AC_DIR_NAME
, sbs
->charger_present
? "on-line" : "off-line");
590 static void acpi_charger_remove(struct acpi_sbs
*sbs
)
593 power_supply_unregister(sbs
->charger
);
596 static void acpi_sbs_callback(void *context
)
599 struct acpi_sbs
*sbs
= context
;
600 struct acpi_battery
*bat
;
601 u8 saved_charger_state
= sbs
->charger_present
;
602 u8 saved_battery_state
;
604 if (sbs
->charger_exists
) {
605 acpi_ac_get_present(sbs
);
606 if (sbs
->charger_present
!= saved_charger_state
)
607 kobject_uevent(&sbs
->charger
->dev
.kobj
, KOBJ_CHANGE
);
610 if (sbs
->manager_present
) {
611 for (id
= 0; id
< MAX_SBS_BAT
; ++id
) {
612 if (!(sbs
->batteries_supported
& (1 << id
)))
614 bat
= &sbs
->battery
[id
];
615 saved_battery_state
= bat
->present
;
616 acpi_battery_read(bat
);
617 if (saved_battery_state
== bat
->present
)
619 kobject_uevent(&bat
->bat
->dev
.kobj
, KOBJ_CHANGE
);
624 static int acpi_sbs_add(struct acpi_device
*device
)
626 struct acpi_sbs
*sbs
;
630 sbs
= kzalloc(sizeof(struct acpi_sbs
), GFP_KERNEL
);
636 mutex_init(&sbs
->lock
);
638 sbs
->hc
= acpi_driver_data(device
->parent
);
639 sbs
->device
= device
;
640 strcpy(acpi_device_name(device
), ACPI_SBS_DEVICE_NAME
);
641 strcpy(acpi_device_class(device
), ACPI_SBS_CLASS
);
642 device
->driver_data
= sbs
;
644 result
= acpi_charger_add(sbs
);
645 if (result
&& result
!= -ENODEV
)
650 if (!x86_apple_machine
) {
651 result
= acpi_manager_get_info(sbs
);
653 sbs
->manager_present
= 1;
654 for (id
= 0; id
< MAX_SBS_BAT
; ++id
)
655 if ((sbs
->batteries_supported
& (1 << id
)))
656 acpi_battery_add(sbs
, id
);
660 if (!sbs
->manager_present
)
661 acpi_battery_add(sbs
, 0);
663 acpi_smbus_register_callback(sbs
->hc
, acpi_sbs_callback
, sbs
);
666 acpi_sbs_remove(device
);
670 static int acpi_sbs_remove(struct acpi_device
*device
)
672 struct acpi_sbs
*sbs
;
677 sbs
= acpi_driver_data(device
);
680 mutex_lock(&sbs
->lock
);
681 acpi_smbus_unregister_callback(sbs
->hc
);
682 for (id
= 0; id
< MAX_SBS_BAT
; ++id
)
683 acpi_battery_remove(sbs
, id
);
684 acpi_charger_remove(sbs
);
685 mutex_unlock(&sbs
->lock
);
686 mutex_destroy(&sbs
->lock
);
691 #ifdef CONFIG_PM_SLEEP
692 static int acpi_sbs_resume(struct device
*dev
)
694 struct acpi_sbs
*sbs
;
697 sbs
= to_acpi_device(dev
)->driver_data
;
698 acpi_sbs_callback(sbs
);
702 #define acpi_sbs_resume NULL
705 static SIMPLE_DEV_PM_OPS(acpi_sbs_pm
, NULL
, acpi_sbs_resume
);
707 static struct acpi_driver acpi_sbs_driver
= {
709 .class = ACPI_SBS_CLASS
,
710 .ids
= sbs_device_ids
,
713 .remove
= acpi_sbs_remove
,
715 .drv
.pm
= &acpi_sbs_pm
,
718 static int __init
acpi_sbs_init(void)
725 result
= acpi_bus_register_driver(&acpi_sbs_driver
);
732 static void __exit
acpi_sbs_exit(void)
734 acpi_bus_unregister_driver(&acpi_sbs_driver
);
738 module_init(acpi_sbs_init
);
739 module_exit(acpi_sbs_exit
);