include/linux/backlight.h

Source file repositories/reference/linux-study-clean/include/linux/backlight.h

File Facts

System
Linux kernel
Corpus path
include/linux/backlight.h
Extension
.h
Size
12401 bytes
Lines
452
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct backlight_ops {
	/**
	 * @options: Configure how operations are called from the core.
	 *
	 * The options parameter is used to adjust the behaviour of the core.
	 * Set BL_CORE_SUSPENDRESUME to get the update_status() operation called
	 * upon suspend and resume.
	 */
	unsigned int options;

#define BL_CORE_SUSPENDRESUME	(1 << 0)

	/**
	 * @update_status: Operation called when properties have changed.
	 *
	 * Notify the backlight driver some property has changed.
	 * The update_status operation is protected by the update_lock.
	 *
	 * The backlight driver is expected to use backlight_is_blank()
	 * to check if the display is blanked and set brightness accordingly.
	 * update_status() is called when any of the properties has changed.
	 *
	 * RETURNS:
	 *
	 * 0 on success, negative error code if any failure occurred.
	 */
	int (*update_status)(struct backlight_device *);

	/**
	 * @get_brightness: Return the current backlight brightness.
	 *
	 * The driver may implement this as a readback from the HW.
	 * This operation is optional and if not present then the current
	 * brightness property value is used.
	 *
	 * RETURNS:
	 *
	 * A brightness value which is 0 or a positive number.
	 * On failure a negative error code is returned.
	 */
	int (*get_brightness)(struct backlight_device *);

	/**
	 * @controls_device: Check against the display device
	 *
	 * Check if the backlight controls the given display device. This
	 * operation is optional and if not implemented it is assumed that
	 * the display is always the one controlled by the backlight.
	 *
	 * RETURNS:
	 *
	 * If display_dev is NULL or display_dev matches the device controlled by
	 * the backlight, return true. Otherwise return false.
	 */
	bool (*controls_device)(struct backlight_device *bd, struct device *display_dev);
};

/**
 * struct backlight_properties - backlight properties
 *
 * This structure defines all the properties of a backlight.
 */
struct backlight_properties {
	/**
	 * @brightness: The current brightness requested by the user.
	 *
	 * The backlight core makes sure the range is (0 to max_brightness)
	 * when the brightness is set via the sysfs attribute:
	 * /sys/class/backlight/<backlight>/brightness.
	 *
	 * This value can be set in the backlight_properties passed
	 * to devm_backlight_device_register() to set a default brightness
	 * value.
	 */
	int brightness;

	/**
	 * @max_brightness: The maximum brightness value.
	 *
	 * This value must be set in the backlight_properties passed to
	 * devm_backlight_device_register() and shall not be modified by the
	 * driver after registration.
	 */
	int max_brightness;

	/**
	 * @power: The current power mode.
	 *
	 * User space can configure the power mode using the sysfs
	 * attribute: /sys/class/backlight/<backlight>/bl_power

Annotation

Implementation Notes