···77 |-- 0000:17:00.088 | |-- class99 | |-- config1010- | |-- detach_state1110 | |-- device1211 | |-- irq1312 | |-- local_cpus···1819 | |-- subsystem_device1920 | |-- subsystem_vendor2021 | `-- vendor2121- `-- detach_state2222+ `-- ...22232324The topmost element describes the PCI domain and bus number. In this case,2425the domain number is 0000 and the bus number is 17 (both values are in hex).···3031 ---- --------3132 class PCI class (ascii, ro)3233 config PCI config space (binary, rw)3333- detach_state connection status (bool, rw)3434 device PCI device (ascii, ro)3535 irq IRQ number (ascii, ro)3636 local_cpus nearby CPU mask (cpumask, ro)
-21
Documentation/power/devices.txt
···207207#READY_AFTER_RESUME208208#209209210210-Driver Detach Power Management211211-212212-The kernel now supports the ability to place a device in a low-power213213-state when it is detached from its driver, which happens when its214214-module is removed. 215215-216216-Each device contains a 'detach_state' file in its sysfs directory217217-which can be used to control this state. Reading from this file218218-displays what the current detach state is set to. This is 0 (On) by219219-default. A user may write a positive integer value to this file in the220220-range of 1-4 inclusive. 221221-222222-A value of 1-3 will indicate the device should be placed in that223223-low-power state, which will cause ->suspend() to be called for that224224-device. A value of 4 indicates that the device should be shutdown, so225225-->shutdown() will be called for that device. 226226-227227-The driver is responsible for reinitializing the device when the228228-module is re-inserted during it's ->probe() (or equivalent) method. 229229-The driver core will not call any extra functions when binding the230230-device to the driver. 231210232211pm_message_t meaning233212
+2-2
Documentation/powerpc/hvcs.txt
···347347looks like the following:348348349349 Pow5:/sys/bus/vio/drivers/hvcs/30000004 # ls350350- . current_vty devspec name partner_vtys351351- .. detach_state index partner_clcs vterm_state350350+ . current_vty devspec name partner_vtys351351+ .. index partner_clcs vterm_state352352353353Each entry is provided, by default with a "name" attribute. Reading the354354"name" attribute will reveal the device type as shown in the following
···11-/*22- * drivers/base/interface.c - common driverfs interface that's exported to33- * the world for all devices.44- *55- * Copyright (c) 2002-3 Patrick Mochel66- * Copyright (c) 2002-3 Open Source Development Labs77- *88- * This file is released under the GPLv299- *1010- */1111-1212-#include <linux/device.h>1313-#include <linux/err.h>1414-#include <linux/stat.h>1515-#include <linux/string.h>1616-1717-/**1818- * detach_state - control the default power state for the device.1919- *2020- * This is the state the device enters when it's driver module is2121- * unloaded. The value is an unsigned integer, in the range of 0-4.2222- * '0' indicates 'On', so no action will be taken when the driver is2323- * unloaded. This is the default behavior.2424- * '4' indicates 'Off', meaning the driver core will call the driver's2525- * shutdown method to quiesce the device.2626- * 1-3 indicate a low-power state for the device to enter via the2727- * driver's suspend method.2828- */2929-3030-static ssize_t detach_show(struct device * dev, char * buf)3131-{3232- return sprintf(buf, "%u\n", dev->detach_state);3333-}3434-3535-static ssize_t detach_store(struct device * dev, const char * buf, size_t n)3636-{3737- u32 state;3838- state = simple_strtoul(buf, NULL, 10);3939- if (state > 4)4040- return -EINVAL;4141- dev->detach_state = state;4242- return n;4343-}4444-4545-static DEVICE_ATTR(detach_state, 0644, detach_show, detach_store);4646-4747-4848-struct attribute * dev_default_attrs[] = {4949- &dev_attr_detach_state.attr,5050- NULL,5151-};
···273273 BIOS data relevant to device) */274274 struct dev_pm_info power;275275276276- u32 detach_state; /* State to enter when device is277277- detached from its driver. */278278-279276 u64 *dma_mask; /* dma mask (if dma'able device) */280277 u64 coherent_dma_mask;/* Like dma_mask, but for281278 alloc_coherent mappings as
+3-3
kernel/power/main.c
···156156 goto Unlock;157157 }158158159159- pr_debug("PM: Preparing system for suspend\n");159159+ pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);160160 if ((error = suspend_prepare(state)))161161 goto Unlock;162162163163- pr_debug("PM: Entering state.\n");163163+ pr_debug("PM: Entering %s sleep\n", pm_states[state]);164164 error = suspend_enter(state);165165166166- pr_debug("PM: Finishing up.\n");166166+ pr_debug("PM: Finishing wakeup.\n");167167 suspend_finish(state);168168 Unlock:169169 up(&pm_sem);