Lines Matching +full:simple +full:- +full:pm +full:- +full:bus
1 // SPDX-License-Identifier: GPL-2.0
3 * device.h - generic, centralized driver model
5 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org>
6 * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de>
7 * Copyright (c) 2008-2009 Novell Inc.
9 * See Documentation/driver-api/driver-model/ for more information.
25 #include <linux/pm.h>
30 #include <linux/device/bus.h>
50 * struct subsys_interface - interfaces to device functions
57 * Simple interfaces attached to a subsystem. Multiple interfaces can
80 * or bus can contain devices of different types
82 * This identifies the device type and carries type-specific
95 const struct dev_pm_ops *pm; member
270 * devm_alloc_percpu - Resource-managed alloc_percpu
271 * @dev: Device to allocate per-cpu memory for
272 * @type: Type to allocate per-cpu memory for
274 * Managed alloc_percpu. Per-cpu memory allocated with this function is
299 * enum device_link_state - Device link states.
308 DL_STATE_NONE = -1,
321 * PM_RUNTIME: If set, the runtime PM framework will use this link.
338 * enum dl_dev_state - Device driver presence tracking information.
352 * struct dev_links_info - Device data related to device links.
372 * struct device - The basic device structure
374 * In most cases, a parent device is some sort of bus or host
375 * controller. If parent is NULL, the device, is a top-level device,
379 * @kobj: A top-level, abstract class from which other classes are derived.
382 * This identifies the device type and carries type-specific
387 * @bus: Type of bus device is on.
392 * to board-specific structures describing devices and how they
396 * minimizes board-specific #ifdefs in drivers.
400 * See Documentation/driver-api/pm/devices.rst for details.
402 * hibernation, system resume and during runtime PM transitions
403 * along with subsystem-level and driver-level callbacks.
406 * See Documentation/driver-api/pinctl.rst for details.
413 * hardware supports 64-bit addresses for consistent allocations
415 * @bus_dma_limit: Limit of an upstream bridge or bus which imposes a smaller
423 * @archdata: For arch-specific additions.
435 * device (i.e. the bus driver that discovered the device).
440 * @offline: Set after successful invocation of bus type's .offline().
441 * @of_node_reused: Set if the device-tree node is shared with an ancestor
444 * the software state of this device by calling the driver/bus
447 * architecture supports non-coherent devices.
449 * streaming DMA operations (->map_* / ->unmap_* / ->sync_*),
452 * instance from ->dma_supported.
460 * a higher-level representation of the device.
471 struct bus_type *bus; /* type of bus device is on */ member
564 * struct device_link - Device link representation.
572 * @rpm_active: Whether or not the consumer device is runtime-PM-active.
597 * device_iommu_mapped - Returns true when the device DMA is translated
603 return (dev->iommu_group != NULL); in device_iommu_mapped()
612 if (dev->init_name) in dev_name()
613 return dev->init_name; in dev_name()
615 return kobject_name(&dev->kobj); in dev_name()
619 * dev_bus_name - Return a device's bus/class name, if at all possible
620 * @dev: struct device to get the bus/class name of
622 * Will return the name of the bus/class the device is attached to. If it is
623 * not attached to a bus/class, an empty string will be returned.
627 return dev->bus ? dev->bus->name : (dev->class ? dev->class->name : ""); in dev_bus_name()
635 return dev->numa_node; in dev_to_node()
639 dev->numa_node = node; in set_dev_node()
654 return dev->msi_domain; in dev_get_msi_domain()
663 dev->msi_domain = d; in dev_set_msi_domain()
669 return dev->driver_data; in dev_get_drvdata()
674 dev->driver_data = data; in dev_set_drvdata()
679 return dev ? dev->power.subsys_data : NULL; in dev_to_psd()
684 return dev->kobj.uevent_suppress; in dev_get_uevent_suppress()
689 dev->kobj.uevent_suppress = val; in dev_set_uevent_suppress()
694 return dev->kobj.state_in_sysfs; in device_is_registered()
699 if (!dev->power.is_prepared) in device_enable_async_suspend()
700 dev->power.async_suspend = true; in device_enable_async_suspend()
705 if (!dev->power.is_prepared) in device_disable_async_suspend()
706 dev->power.async_suspend = false; in device_disable_async_suspend()
711 return !!dev->power.async_suspend; in device_async_suspend_enabled()
716 return dev->power.no_pm; in device_pm_not_required()
721 dev->power.no_pm = true; in device_set_pm_not_required()
727 dev->power.syscore = val; in dev_pm_syscore_device()
733 dev->power.driver_flags = flags; in dev_pm_set_driver_flags()
738 return !!(dev->power.driver_flags & flags); in dev_pm_test_driver_flags()
743 mutex_lock(&dev->mutex); in device_lock()
748 return mutex_lock_interruptible(&dev->mutex); in device_lock_interruptible()
753 return mutex_trylock(&dev->mutex); in device_trylock()
758 mutex_unlock(&dev->mutex); in device_unlock()
763 lockdep_assert_held(&dev->mutex); in device_lock_assert()
770 return dev->of_node; in dev_of_node()
777 if (dev->driver && dev->driver->sync_state) in dev_has_sync_state()
779 if (dev->bus && dev->bus->sync_state) in dev_has_sync_state()
785 * High level routines for use by the bus drivers
810 return dev->bus && dev->bus->offline && dev->bus->online; in device_supports_offline()
824 if (dev->bus && dev->bus->num_vf) in dev_num_vf()
825 return dev->bus->num_vf(dev); in dev_num_vf()
842 return dev->platform_data; in dev_get_platdata()
846 * Manual binding of a device to driver. See drivers/base/bus.c
901 * Platform "fixup" functions - allow the platform to have their say
912 * get_device - atomically increment the reference count for the device.
944 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
946 MODULE_ALIAS("char-major-" __stringify(major) "-*")